Skip to content

Commit

Permalink
Rename & document :on-export-row-label-fn
Browse files Browse the repository at this point in the history
  • Loading branch information
kimo-k committed Jul 15, 2024
1 parent 4afbeeb commit 4e3b1d8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/re_com/simple_v_table.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,8 @@
[:span "one element for each column in the table. Must contain "
[:code ":id"] "," [:code ":header-label"] "," [:code ":row-label-fn"]
"," [:code ":width"] ", and " [:code ":height"]
". Optionally contains " [:code ":sort-by"] ", " [:code ":align"]
". Optionally contains " [:code ":sort-by"] ", " [:code ":align"] ", "
[:code ":on-export-row-label-fn"] ", "
" and " [:code ":vertical-align"] ". " [:code ":sort-by"] " can be "
[:code "true"] " or a map optionally containing " [:code ":key-fn"]
" and " [:code ":comp"] " ala " [:code "cljs.core/sort-by"] "."]}
Expand Down
2 changes: 1 addition & 1 deletion src/re_com/util.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@

(defn table->tsv [columns rows]
(let [header-value-fn (some-fn :export-header-label :header-label (comp name :id))
row-value-fn (some-fn :row-export-fn :row-label-fn :id)
row-value-fn (some-fn :on-export-row-label-fn :row-label-fn :id)
row->cells (apply juxt (map row-value-fn columns))]
(->> rows
(map row->cells)
Expand Down
4 changes: 2 additions & 2 deletions src/re_demo/simple_v_table_sales.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,8 @@
[{:id :id :header-label "Code" :row-label-fn :id :width 70 :align "center" :vertical-align "middle" :export? false}
{:id :region :header-label "Region" :row-label-fn :region :width 100 :align "left" :vertical-align "middle"}
{:id :name :header-label "Name" :row-label-fn :person :width 100 :align "left" :vertical-align "middle" :sort-by {}}
{:id :email :header-label "Email" :row-label-fn email-row-label-fn :width 200 :align "left" :vertical-align "middle" :row-export-fn :email}
{:id :method :header-label "Method" :row-label-fn method-row-label-fn :width 100 :align "center" :vertical-align "middle" :row-export-fn (comp name :method)}
{:id :email :header-label "Email" :row-label-fn email-row-label-fn :width 200 :align "left" :vertical-align "middle" :on-export-row-label-fn :email}
{:id :method :header-label "Method" :row-label-fn method-row-label-fn :width 100 :align "center" :vertical-align "middle" :on-export-row-label-fn (comp name :method)}
{:id :sales :header-label "Sales" :row-label-fn #(str "$" (:sales %)) :width 100 :align "right" :vertical-align "middle" :sort-by {:key-fn :sales}}
{:id :units :header-label "Units" :row-label-fn :units :width 100 :align "right" :vertical-align "middle" :sort-by true}]
:fixed-column-count @fixed-column-count
Expand Down

0 comments on commit 4e3b1d8

Please sign in to comment.