Skip to content

Commit fb41b0b

Browse files
committed
[nested-grid] Adjust responsive sizing with native-width/height
1 parent 6dd8476 commit fb41b0b

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

src/re_com/nested_grid.cljs

+11-14
Original file line numberDiff line numberDiff line change
@@ -781,10 +781,7 @@
781781
export-spacers #(vec (repeat column-depth (vec (repeat row-depth nil))))
782782
control-panel [:div {:style {:position :relative
783783
:background-color "white"
784-
:width (if max-width
785-
max-width
786-
"1fr"
787-
#_(px (apply + showing-column-widths)))}}
784+
:width (or max-width "1fr")}}
788785
[:div {:style {:position :absolute
789786
:right 0}}
790787
(when show-export-button?
@@ -922,7 +919,13 @@
922919
:selection-grid-spec selection-grid-spec}]
923920
;; FIXME This changes on different browsers - do we need to get it dynamically?
924921
;; FIXME We should use :scrollbar-gutter (chrome>=94)
925-
native-scrollbar-width 10]
922+
native-scrollbar-width 10
923+
native-width (apply +
924+
native-scrollbar-width
925+
showing-column-widths)
926+
native-height (apply +
927+
native-scrollbar-width
928+
showing-row-heights)]
926929
[:div
927930
[:div {:on-mouse-enter #(reset! hover? true)
928931
:on-mouse-leave #(reset! hover? false)
@@ -932,11 +935,8 @@
932935
:display "grid"
933936
:grid-template-columns (grid-template [(px (apply + max-row-widths))
934937
(if-not max-width
935-
"1fr"
936-
(px (cond->
937-
(apply +
938-
native-scrollbar-width
939-
showing-column-widths)
938+
(str "minmax(0, " (+ 2 native-width) "px)")
939+
(px (cond-> native-width
940940
max-width
941941
(min
942942
(parse-long
@@ -946,10 +946,7 @@
946946
:grid-template-rows (grid-template (into (if show-export-button? ["25px"] [])
947947
[showing-column-widths
948948
(px (apply + max-column-heights))
949-
(px (apply +
950-
4
951-
native-scrollbar-width
952-
showing-row-heights))]))}}
949+
(px (+ native-height 4))]))}}
953950
(when show-export-button? [:div])
954951
(when show-export-button? control-panel)
955952
[:div {:style {:display "grid"

0 commit comments

Comments
 (0)