|
@@ -6,23 +6,16 @@
|
|
;for(let i = 0, s = new Set(); i < 10; i++){ let r = Math.floor(Math.random() * 15)+1, c = a[Math.floor(Math.random() * a.length)], k = `${c}${r}`; if(s.has(k)){ i--; continue; } s.add(k); v.push(`{:row ${r} :col "${c}" :value "${Math.floor(Math.random() * 10000)}"}`); }
|
|
;for(let i = 0, s = new Set(); i < 10; i++){ let r = Math.floor(Math.random() * 15)+1, c = a[Math.floor(Math.random() * a.length)], k = `${c}${r}`; if(s.has(k)){ i--; continue; } s.add(k); v.push(`{:row ${r} :col "${c}" :value "${Math.floor(Math.random() * 10000)}"}`); }
|
|
(def sample-data [{:row 1 :col "A" :value "59"}
|
|
(def sample-data [{:row 1 :col "A" :value "59"}
|
|
{:row 5 :col "C" :value "269"}
|
|
{:row 5 :col "C" :value "269"}
|
|
- {:row 5 :col "H" :value "2001"}
|
|
|
|
{:row 4 :col "B" :value "7893"}
|
|
{:row 4 :col "B" :value "7893"}
|
|
- {:row 8 :col "K" :value "8291"}
|
|
|
|
- {:row 8 :col "H" :value "755"}
|
|
|
|
{:row 2 :col "F" :value "8650"}
|
|
{:row 2 :col "F" :value "8650"}
|
|
{:row 6 :col "D" :value "4065"}
|
|
{:row 6 :col "D" :value "4065"}
|
|
- {:row 10 :col "G" :value "788"}
|
|
|
|
{:row 7 :col "F" :value "5316"}
|
|
{:row 7 :col "F" :value "5316"}
|
|
- {:row 15 :col "G" :value "8599"}
|
|
|
|
{:row 1 :col "A" :value "4910"}
|
|
{:row 1 :col "A" :value "4910"}
|
|
{:row 12 :col "A" :value "2405"}
|
|
{:row 12 :col "A" :value "2405"}
|
|
- {:row 14 :col "H" :value "7292"}
|
|
|
|
{:row 5 :col "B" :value "7863"}
|
|
{:row 5 :col "B" :value "7863"}
|
|
{:row 9 :col "E" :value "3144"}
|
|
{:row 9 :col "E" :value "3144"}
|
|
{:row 10 :col "D" :value "8272"}
|
|
{:row 10 :col "D" :value "8272"}
|
|
{:row 2 :col "F" :value "3013"}
|
|
{:row 2 :col "F" :value "3013"}
|
|
- {:row 12 :col "G" :value "9411"}
|
|
|
|
{:row 11 :col "D" :value "2495"}
|
|
{:row 11 :col "D" :value "2495"}
|
|
{:row 15 :col "E" :value "8968"}])
|
|
{:row 15 :col "E" :value "8968"}])
|
|
|
|
|
|
@@ -42,7 +35,8 @@
|
|
;; Views
|
|
;; Views
|
|
|
|
|
|
(defn cell [c r data]
|
|
(defn cell [c r data]
|
|
- ^{:key (str c r)} [:td (str c r)]
|
|
|
|
|
|
+ (let [datum (some #(if (and (= c (:col %)) (= r (:row %))) %) data)]
|
|
|
|
+ ^{:key (str c r)} [:td (or (:value datum) "")])
|
|
)
|
|
)
|
|
(defn row [r cols data]
|
|
(defn row [r cols data]
|
|
^{:key (str "row-" r)} [:tr
|
|
^{:key (str "row-" r)} [:tr
|