Merge branch 'master' into port-datomic-cloud
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
[clojure.string :as str]
|
||||
[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
|
||||
|
||||
(= :dollar (:format c))
|
||||
@@ -19,7 +19,8 @@
|
||||
cell-contents]
|
||||
cell-contents)]
|
||||
[:td
|
||||
(cond-> {:style {:width (str width "em")}}
|
||||
(cond-> {:style (cond-> {:width (str width "em")}
|
||||
other-style (merge other-style))}
|
||||
|
||||
(:border c) (update :style
|
||||
(fn [s]
|
||||
@@ -38,9 +39,9 @@
|
||||
(str/join ","
|
||||
(:color c))
|
||||
")"))
|
||||
(:bg-color c) (assoc-in [:style :background-color] (str "rgb("
|
||||
true (assoc-in [:style :background-color] (str "rgb("
|
||||
(str/join ","
|
||||
(:bg-color c))
|
||||
(or (:bg-color c) [255 255 255]))
|
||||
")")))
|
||||
|
||||
cell-contents]))
|
||||
@@ -53,20 +54,26 @@
|
||||
|
||||
(defn table [{:keys [table widths click-event]}]
|
||||
(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
|
||||
(fn [i header]
|
||||
(into ^{:key i}
|
||||
(fn [header-row header]
|
||||
(into ^{:key header-row}
|
||||
[:tr]
|
||||
(map
|
||||
(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
|
||||
header
|
||||
(range))))
|
||||
(range)
|
||||
(:header table))]
|
||||
|
||||
(conj
|
||||
(-> [:tbody {:style {}}]
|
||||
(into
|
||||
(for [[i row] (map vector (range) (:rows table))]
|
||||
^{:key i}
|
||||
@@ -84,7 +91,8 @@
|
||||
(conj ^{:key "last"}
|
||||
[:tr (for [i (range cell-count)]
|
||||
^{:key i}
|
||||
[cell {:click-event click-event} {:value " "}])]))))
|
||||
[cell {:click-event click-event} {:value " "}])])))
|
||||
)]))
|
||||
|
||||
(defn concat-tables [tables]
|
||||
(let [[first & rest] tables]
|
||||
|
||||
Reference in New Issue
Block a user