Merge branch 'master' into port-datomic-cloud
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
[clojure.string :as str]
|
[clojure.string :as str]
|
||||||
[auto-ap.views.utils :refer [->$ ->% dispatch-event]]))
|
[auto-ap.views.utils :refer [->$ ->% dispatch-event]]))
|
||||||
|
|
||||||
(defn cell [{:keys [width click-event]} c]
|
(defn cell [{:keys [width click-event other-style]} c]
|
||||||
(let [cell-contents (cond
|
(let [cell-contents (cond
|
||||||
|
|
||||||
(= :dollar (:format c))
|
(= :dollar (:format c))
|
||||||
@@ -19,7 +19,8 @@
|
|||||||
cell-contents]
|
cell-contents]
|
||||||
cell-contents)]
|
cell-contents)]
|
||||||
[:td
|
[:td
|
||||||
(cond-> {:style {:width (str width "em")}}
|
(cond-> {:style (cond-> {:width (str width "em")}
|
||||||
|
other-style (merge other-style))}
|
||||||
|
|
||||||
(:border c) (update :style
|
(:border c) (update :style
|
||||||
(fn [s]
|
(fn [s]
|
||||||
@@ -38,9 +39,9 @@
|
|||||||
(str/join ","
|
(str/join ","
|
||||||
(:color c))
|
(:color c))
|
||||||
")"))
|
")"))
|
||||||
(:bg-color c) (assoc-in [:style :background-color] (str "rgb("
|
true (assoc-in [:style :background-color] (str "rgb("
|
||||||
(str/join ","
|
(str/join ","
|
||||||
(:bg-color c))
|
(or (:bg-color c) [255 255 255]))
|
||||||
")")))
|
")")))
|
||||||
|
|
||||||
cell-contents]))
|
cell-contents]))
|
||||||
@@ -53,20 +54,26 @@
|
|||||||
|
|
||||||
(defn table [{:keys [table widths click-event]}]
|
(defn table [{:keys [table widths click-event]}]
|
||||||
(let [cell-count (cell-count table)]
|
(let [cell-count (cell-count table)]
|
||||||
(-> [:table.table.compact.balance-sheet {:style nil}
|
[:div {:style {:height "70vh"
|
||||||
|
:overflow-y "auto"}}
|
||||||
|
(-> [:table.table.compact.balance-sheet
|
||||||
(map
|
(map
|
||||||
(fn [i header]
|
(fn [header-row header]
|
||||||
(into ^{:key i}
|
(into ^{:key header-row}
|
||||||
[:tr]
|
[:tr]
|
||||||
(map
|
(map
|
||||||
(fn [w header i]
|
(fn [w header i]
|
||||||
^{:key i} [cell {:width w :click-event click-event} header])
|
^{:key i} [cell {:width w :click-event click-event
|
||||||
|
:other-style {:position "sticky"
|
||||||
|
:top (* header-row (+ 22 18))}} header])
|
||||||
widths
|
widths
|
||||||
header
|
header
|
||||||
(range))))
|
(range))))
|
||||||
(range)
|
(range)
|
||||||
(:header table))]
|
(:header table))]
|
||||||
|
|
||||||
|
(conj
|
||||||
|
(-> [:tbody {:style {}}]
|
||||||
(into
|
(into
|
||||||
(for [[i row] (map vector (range) (:rows table))]
|
(for [[i row] (map vector (range) (:rows table))]
|
||||||
^{:key i}
|
^{:key i}
|
||||||
@@ -84,7 +91,8 @@
|
|||||||
(conj ^{:key "last"}
|
(conj ^{:key "last"}
|
||||||
[:tr (for [i (range cell-count)]
|
[:tr (for [i (range cell-count)]
|
||||||
^{:key i}
|
^{:key i}
|
||||||
[cell {:click-event click-event} {:value " "}])]))))
|
[cell {:click-event click-event} {:value " "}])])))
|
||||||
|
)]))
|
||||||
|
|
||||||
(defn concat-tables [tables]
|
(defn concat-tables [tables]
|
||||||
(let [[first & rest] tables]
|
(let [[first & rest] tables]
|
||||||
|
|||||||
Reference in New Issue
Block a user