Skip to content

Commit

Permalink
[nested-v-grid] Add :resize-column-header-height? prop
Browse files Browse the repository at this point in the history
  • Loading branch information
kimo-k committed Jan 22, 2025
1 parent 966c3f3 commit fe35261
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/re_com/nested_v_grid.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -229,17 +229,19 @@
row-header-grid column-header-grid
corner-header-grid cell-grid
resize-row-height?
resize-column-header-height?
row-height column-width]} :parts
:as props
:or
{hide-root? true
resize-row-height? true
on-resize (fn [{:keys [header-dimension size-dimension keypath size]}]
(case [header-dimension size-dimension]
[:column :height] (swap! internal-column-header-heights assoc-in keypath size)
[:row :width] (swap! internal-row-header-widths assoc-in keypath size)
[:row :height] (swap! internal-row-tree update-in keypath assoc :size size)
[:column :width] (swap! internal-column-tree update-in keypath assoc :size size)))}}]
{hide-root? true
resize-row-height? true
resize-column-header-height? true
on-resize (fn [{:keys [header-dimension size-dimension keypath size]}]
(case [header-dimension size-dimension]
[:column :height] (swap! internal-column-header-heights assoc-in keypath size)
[:row :width] (swap! internal-row-header-widths assoc-in keypath size)
[:row :height] (swap! internal-row-tree update-in keypath assoc :size size)
[:column :width] (swap! internal-column-tree update-in keypath assoc :size size)))}}]
(let [ensure-reactivity u/deref-or-value
external-keys [:row-tree :row-header-widths :row-height
:column-tree :column-header-heights :column-width
Expand Down Expand Up @@ -446,7 +448,8 @@
:part ::column-header-grid
:props {:children (cond-> column-headers
(not @hide-resizers?)
(concat column-height-resizers
(concat (when resize-column-header-height?
column-height-resizers)
(column-width-resizers {:offset -1})))
:style {:grid-template-rows @column-cross-template
:grid-template-columns @column-template}}})
Expand All @@ -466,7 +469,8 @@
:props {:children (cond-> corner-headers
(not @hide-resizers?)
(concat row-width-resizers
column-height-resizers))
(when resize-column-header-height?
column-height-resizers)))
:style {:grid-template-rows @column-cross-template
:grid-template-columns @row-cross-template}}})
(u/deref-or-value overlay)]}})))})))

0 comments on commit fe35261

Please sign in to comment.