Skip to content

Commit 2e3f795

Browse files
committed
[nested-v-grid] [wip] Add virtualization demo
1 parent 88cb9dc commit 2e3f795

File tree

6 files changed

+419
-889
lines changed

6 files changed

+419
-889
lines changed

package-lock.json

Lines changed: 48 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
{
22
"name": "re-com",
33
"devDependencies": {
4+
"@faker-js/faker": "^9.4.0",
45
"karma": "6.3.4",
56
"karma-chrome-launcher": "3.1.0",
67
"karma-cljs-test": "0.1.0",
78
"karma-junit-reporter": "2.0.1",
89
"react": "17.0.2",
910
"react-dom": "17.0.2",
1011
"shadow-cljs": "2.28.2"
12+
},
13+
"dependencies": {
14+
"@js-joda/core": "3.2.0",
15+
"@js-joda/locale_en-us": "3.1.1",
16+
"@js-joda/timezone": "2.5.0"
1117
}
1218
}

src/re_com/nested_v_grid.cljs

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -608,15 +608,15 @@
608608

609609
row-headers
610610
(for [i (range (count @row-paths))
611-
:let [row-path (get @row-paths i)
612-
path-ct (count row-path)
613-
end-path (some #(when (= (count %) path-ct) %) ;;TODO make this more efficient.
614-
(drop (inc i) @row-paths))
615-
{:keys [branch-end?]} (meta row-path)
616-
row-path-prop (cond-> row-path (not show-root-headers?) (subvec 1))
617-
cross-size (get @safe-row-header-widths
618-
(cond-> (dec path-ct) (not show-root-headers?) dec))
619-
size (get @row-sizes i)]
611+
:let [row-path (get @row-paths i)
612+
path-ct (count row-path)
613+
end-path (some #(when (= (count %) path-ct) %) ;;TODO make this more efficient.
614+
(drop (inc i) @row-paths))
615+
{:keys [branch-end? leaf?]} (meta row-path)
616+
row-path-prop (cond-> row-path (not show-root-headers?) (subvec 1))
617+
cross-size (get @safe-row-header-widths
618+
(cond-> (dec path-ct) (not show-root-headers?) dec))
619+
size (get @row-sizes i)]
620620
:let [props {:part ::row-header
621621
:row-path row-path-prop
622622
:path row-path-prop
@@ -632,9 +632,10 @@
632632
:grid-column-end -1}}
633633
props (assoc props :children [(part ::row-header-label
634634
{:props (assoc props
635-
:style (merge {:height (- size 5)
636-
:position :sticky
637-
:top @column-header-height-total}
635+
:style (merge {:height (- size 5)}
636+
(when-not leaf?
637+
{:position :sticky
638+
:top @column-header-height-total})
638639
(when-not branch-end?
639640
{:width (- cross-size 10)})))
640641
:impl ngp/row-header-label})])]]
@@ -714,10 +715,12 @@
714715
((some-fn :leaf? :show?) column-meta))
715716
:let [props {:row-path (cond-> row-path
716717
(not show-root-headers?) (subvec 1)
717-
(:branch-end? row-meta) pop)
718+
(:branch-end? row-meta) pop)
718719
:column-path (cond-> column-path
719-
(not show-root-headers?) (subvec 1)
720+
(not show-root-headers?) (subvec 1)
720721
(:branch-end? column-meta) pop)
722+
:row-meta row-meta
723+
:column-meta column-meta
721724
:style {:grid-row-start (ngu/path->grid-line-name row-path)
722725
:grid-column-start (ngu/path->grid-line-name column-path)}}
723726
props (merge props

src/re_com/nested_v_grid/theme.cljs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@
1818
(defmethod base ::nvg/cell-grid
1919
[props]
2020
(style props {:display :grid
21+
:overflow :hidden
2122
:grid-row-start 2
2223
:grid-column-start 2}))
2324

2425
(defmethod base ::nvg/column-header-grid
2526
[props]
2627
(style props {:display :grid
28+
:overflow :hidden
2729
:position :sticky
2830
:top 0}))
2931

0 commit comments

Comments
 (0)