@rozie-ui/data-table-solid 0.2.5 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/dist/index.cjs +594 -235
- package/dist/index.d.cts +7 -3
- package/dist/index.d.mts +7 -3
- package/dist/index.mjs +594 -235
- package/package.json +3 -3
- package/src/DataTable.tsx +1119 -385
- package/src/helpers/columnDefUtils.ts +35 -0
- package/src/helpers/indexMath.ts +25 -0
- package/src/helpers/rowValueUtils.ts +62 -0
- package/src/helpers/tsvGrid.ts +115 -0
package/dist/index.cjs
CHANGED
|
@@ -31,6 +31,163 @@ let _rozie_ui_popover_solid = require("@rozie-ui/popover-solid");
|
|
|
31
31
|
_rozie_ui_popover_solid = __toESM(_rozie_ui_popover_solid);
|
|
32
32
|
let _tanstack_table_core = require("@tanstack/table-core");
|
|
33
33
|
let _tanstack_virtual_core = require("@tanstack/virtual-core");
|
|
34
|
+
//#region src/helpers/columnDefUtils.ts
|
|
35
|
+
const isSafeKey = (k) => k !== "__proto__" && k !== "constructor" && k !== "prototype";
|
|
36
|
+
const wrapAggregationFn = (fn) => {
|
|
37
|
+
if (typeof fn === "string") return fn;
|
|
38
|
+
if (typeof fn !== "function") return void 0;
|
|
39
|
+
return (columnId, leafRows, childRows) => {
|
|
40
|
+
try {
|
|
41
|
+
return fn(columnId, leafRows, childRows);
|
|
42
|
+
} catch (err) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/helpers/indexMath.ts
|
|
49
|
+
const clamp = (v, lo, hi) => v < lo ? lo : v > hi ? hi : v;
|
|
50
|
+
const focusables = (cellEl) => {
|
|
51
|
+
if (!cellEl || !cellEl.querySelectorAll) return [];
|
|
52
|
+
return Array.prototype.slice.call(cellEl.querySelectorAll("button,[href],input,select,textarea,[tabindex]:not([tabindex=\"-1\"])")).filter((n) => !n.disabled);
|
|
53
|
+
};
|
|
54
|
+
const applyUpdater = (updater, current) => typeof updater === "function" ? updater(current) : updater;
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region src/helpers/tsvGrid.ts
|
|
57
|
+
const escapeTsvField = (s) => {
|
|
58
|
+
if (s.indexOf(" ") >= 0 || s.indexOf("\n") >= 0 || s.indexOf("\r") >= 0 || s.indexOf("\"") >= 0) return "\"" + s.replace(/"/g, "\"\"") + "\"";
|
|
59
|
+
return s;
|
|
60
|
+
};
|
|
61
|
+
const parseTsv = (text) => {
|
|
62
|
+
const str = text != null ? String(text) : "";
|
|
63
|
+
if (str === "" || str.length > 2e6) return [];
|
|
64
|
+
const rows = [];
|
|
65
|
+
let row = [];
|
|
66
|
+
let field = "";
|
|
67
|
+
let inQuotes = false;
|
|
68
|
+
let i = 0;
|
|
69
|
+
const n = str.length;
|
|
70
|
+
while (i < n) {
|
|
71
|
+
const ch = str[i];
|
|
72
|
+
if (inQuotes) {
|
|
73
|
+
if (ch === "\"") {
|
|
74
|
+
if (i + 1 < n && str[i + 1] === "\"") {
|
|
75
|
+
field = field + "\"";
|
|
76
|
+
i = i + 2;
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
inQuotes = false;
|
|
80
|
+
i = i + 1;
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
field = field + ch;
|
|
84
|
+
i = i + 1;
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
if (ch === "\"" && field === "") {
|
|
88
|
+
inQuotes = true;
|
|
89
|
+
i = i + 1;
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
if (ch === " ") {
|
|
93
|
+
row.push(field);
|
|
94
|
+
field = "";
|
|
95
|
+
i = i + 1;
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
if (ch === "\r") {
|
|
99
|
+
if (i + 1 < n && str[i + 1] === "\n") i = i + 1;
|
|
100
|
+
row.push(field);
|
|
101
|
+
field = "";
|
|
102
|
+
rows.push(row);
|
|
103
|
+
row = [];
|
|
104
|
+
i = i + 1;
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
if (ch === "\n") {
|
|
108
|
+
row.push(field);
|
|
109
|
+
field = "";
|
|
110
|
+
rows.push(row);
|
|
111
|
+
row = [];
|
|
112
|
+
i = i + 1;
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
field = field + ch;
|
|
116
|
+
i = i + 1;
|
|
117
|
+
}
|
|
118
|
+
row.push(field);
|
|
119
|
+
rows.push(row);
|
|
120
|
+
if (rows.length > 1) {
|
|
121
|
+
const last = rows[rows.length - 1];
|
|
122
|
+
if (last.length === 1 && last[0] === "") rows.pop();
|
|
123
|
+
}
|
|
124
|
+
return rows;
|
|
125
|
+
};
|
|
126
|
+
const tileGridToBox = (grid, box) => {
|
|
127
|
+
const srcRows = grid.length;
|
|
128
|
+
let srcCols = 0;
|
|
129
|
+
for (let i = 0; i < srcRows; i++) {
|
|
130
|
+
const w = grid[i] && grid[i].length ? grid[i].length : 0;
|
|
131
|
+
if (w > srcCols) srcCols = w;
|
|
132
|
+
}
|
|
133
|
+
if (srcRows <= 0 || srcCols <= 0) return grid;
|
|
134
|
+
const boxRows = box.r1 - box.r0 + 1;
|
|
135
|
+
const boxCols = box.c1 - box.c0 + 1;
|
|
136
|
+
const rows = boxRows > srcRows ? boxRows : srcRows;
|
|
137
|
+
const cols = boxCols > srcCols ? boxCols : srcCols;
|
|
138
|
+
const out = [];
|
|
139
|
+
for (let r = 0; r < rows; r++) {
|
|
140
|
+
const srcLine = grid[r % srcRows] || [];
|
|
141
|
+
const line = [];
|
|
142
|
+
for (let c = 0; c < cols; c++) {
|
|
143
|
+
const v = srcLine[c % srcCols];
|
|
144
|
+
line.push(v != null ? v : "");
|
|
145
|
+
}
|
|
146
|
+
out.push(line);
|
|
147
|
+
}
|
|
148
|
+
return out;
|
|
149
|
+
};
|
|
150
|
+
const tileIndex = (i, lo, hi) => {
|
|
151
|
+
const span = hi - lo + 1;
|
|
152
|
+
if (span <= 1) return lo;
|
|
153
|
+
let k = (i - lo) % span;
|
|
154
|
+
if (k < 0) k = k + span;
|
|
155
|
+
return lo + k;
|
|
156
|
+
};
|
|
157
|
+
//#endregion
|
|
158
|
+
//#region src/helpers/rowValueUtils.ts
|
|
159
|
+
const replaceRowValue = (rows, rowIndex, field, value) => {
|
|
160
|
+
const src = rows || [];
|
|
161
|
+
const out = [];
|
|
162
|
+
for (let i = 0; i < src.length; i++) if (i === rowIndex) out.push({
|
|
163
|
+
...src[i] || {},
|
|
164
|
+
[field]: value
|
|
165
|
+
});
|
|
166
|
+
else out.push(src[i]);
|
|
167
|
+
return out;
|
|
168
|
+
};
|
|
169
|
+
const replaceRowValues = (rows, rowIndex, fieldValues) => {
|
|
170
|
+
const src = rows || [];
|
|
171
|
+
const fv = fieldValues || {};
|
|
172
|
+
const out = [];
|
|
173
|
+
for (let i = 0; i < src.length; i++) if (i === rowIndex) out.push({
|
|
174
|
+
...src[i] || {},
|
|
175
|
+
...fv
|
|
176
|
+
});
|
|
177
|
+
else out.push(src[i]);
|
|
178
|
+
return out;
|
|
179
|
+
};
|
|
180
|
+
const indexOfRowIn = (rows, rowOriginal, rowId) => {
|
|
181
|
+
const list = rows || [];
|
|
182
|
+
for (let i = 0; i < list.length; i++) {
|
|
183
|
+
const r = list[i];
|
|
184
|
+
if (!r) continue;
|
|
185
|
+
if (rowId != null && r.id === rowId) return i;
|
|
186
|
+
if (rowOriginal != null && r.original === rowOriginal) return i;
|
|
187
|
+
}
|
|
188
|
+
return -1;
|
|
189
|
+
};
|
|
190
|
+
//#endregion
|
|
34
191
|
//#region src/DataTable.tsx
|
|
35
192
|
(0, _rozie_runtime_solid.__rozieInjectStyle)("DataTable-d5dcab4c", `.rozie-data-table[data-rozie-s-d5dcab4c] {
|
|
36
193
|
border-collapse: collapse;
|
|
@@ -38,6 +195,13 @@ let _tanstack_virtual_core = require("@tanstack/virtual-core");
|
|
|
38
195
|
font: var(--rdt-font, 14px system-ui, sans-serif);
|
|
39
196
|
color: var(--rdt-color, inherit);
|
|
40
197
|
}
|
|
198
|
+
.rozie-data-table.rdt-col-windowed[data-rozie-s-d5dcab4c] {
|
|
199
|
+
table-layout: fixed;
|
|
200
|
+
}
|
|
201
|
+
.rozie-data-table.rdt-col-windowed[data-rozie-s-d5dcab4c] .rdt-th[data-rozie-s-d5dcab4c],
|
|
202
|
+
.rozie-data-table.rdt-col-windowed[data-rozie-s-d5dcab4c] .rdt-td[data-rozie-s-d5dcab4c] {
|
|
203
|
+
box-sizing: border-box;
|
|
204
|
+
}
|
|
41
205
|
.rdt-sr-live[data-rozie-s-d5dcab4c] {
|
|
42
206
|
position: absolute;
|
|
43
207
|
width: 1px;
|
|
@@ -355,6 +519,7 @@ function DataTable(_props) {
|
|
|
355
519
|
undoLimit: 100,
|
|
356
520
|
virtual: false,
|
|
357
521
|
estimateRowHeight: 40,
|
|
522
|
+
autoMeasure: false,
|
|
358
523
|
maxHeight: ""
|
|
359
524
|
}, _props), [
|
|
360
525
|
"data",
|
|
@@ -384,6 +549,7 @@ function DataTable(_props) {
|
|
|
384
549
|
"undoLimit",
|
|
385
550
|
"virtual",
|
|
386
551
|
"estimateRowHeight",
|
|
552
|
+
"autoMeasure",
|
|
387
553
|
"maxHeight",
|
|
388
554
|
"children",
|
|
389
555
|
"ref",
|
|
@@ -558,10 +724,11 @@ function DataTable(_props) {
|
|
|
558
724
|
setRows(nextRows);
|
|
559
725
|
setHeaderGroups(nextGroups);
|
|
560
726
|
setRowModelVer(rowModelVer() + 1);
|
|
561
|
-
if (
|
|
727
|
+
if (rowsWindowed() && virtualizer) {
|
|
562
728
|
virtualizer.setOptions(virtualizerOptions());
|
|
563
729
|
virtualizer._willUpdate();
|
|
564
730
|
}
|
|
731
|
+
remeasureColumnWindow();
|
|
565
732
|
const nextRowCount = nextRows.length;
|
|
566
733
|
clampActiveCell(nextRowCount, nextRows.length ? nextRows[0].getVisibleCells().length : nextGroups.length ? (nextGroups[nextGroups.length - 1].headers || []).length : 0);
|
|
567
734
|
const pgState = table.getState().pagination;
|
|
@@ -582,17 +749,28 @@ function DataTable(_props) {
|
|
|
582
749
|
};
|
|
583
750
|
refreshRowModel();
|
|
584
751
|
gridRoot = __rozieRootRef ? __rozieRootRef.querySelector(".rozie-data-table") : null;
|
|
585
|
-
if (
|
|
586
|
-
|
|
752
|
+
if (isWindowed()) gridScrollEl = __rozieRootRef ? __rozieRootRef.querySelector(".rdt-scroll") : null;
|
|
753
|
+
if (rowsWindowed()) {
|
|
587
754
|
virtualizer = new _tanstack_virtual_core.Virtualizer(virtualizerOptions());
|
|
588
755
|
virtualizerCleanup = virtualizer._didMount();
|
|
589
|
-
|
|
756
|
+
}
|
|
757
|
+
if (colsWindowed()) {
|
|
758
|
+
colVirtualizer = new _tanstack_virtual_core.Virtualizer(columnVirtualizerOptions());
|
|
759
|
+
colVirtualizerCleanup = colVirtualizer._didMount();
|
|
760
|
+
}
|
|
761
|
+
if (isWindowed()) setWindowVer(windowVer() + 1);
|
|
762
|
+
if (isWindowed()) {
|
|
590
763
|
const afterFirstFrame = () => {
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
764
|
+
if (rowsWindowed()) {
|
|
765
|
+
remeasureWindow();
|
|
766
|
+
if (!(gridScrollEl ? gridScrollEl.clientHeight : 0)) console.warn("[rozie-data-table] virtual is on but the scroll container has no bounded height; set maxHeight or --rozie-data-table-max-height");
|
|
767
|
+
const pg = pagination();
|
|
768
|
+
const pgConfigured = pg != null && !(pg.pageIndex === 0 && pg.pageSize === 10);
|
|
769
|
+
if (local.manual !== true && pgConfigured) console.warn("[rozie-data-table] virtual+pagination: client pagination is configured but virtual windowing replaces it — the pagination chrome is auto-suppressed. Remove the pagination prop or set manual to silence this.");
|
|
770
|
+
}
|
|
771
|
+
if (colsWindowed()) {
|
|
772
|
+
if (!(gridScrollEl ? gridScrollEl.clientWidth : 0)) console.warn("[rozie-data-table] virtual is on for columns but the scroll container has no bounded width; set a CSS width on an ancestor so the column window can be measured");
|
|
773
|
+
}
|
|
596
774
|
};
|
|
597
775
|
if (typeof requestAnimationFrame === "function") requestAnimationFrame(() => requestAnimationFrame(afterFirstFrame));
|
|
598
776
|
else setTimeout(afterFirstFrame, 0);
|
|
@@ -603,6 +781,9 @@ function DataTable(_props) {
|
|
|
603
781
|
});
|
|
604
782
|
(0, Solid_js.onCleanup)(() => {
|
|
605
783
|
if (virtualizerCleanup) virtualizerCleanup();
|
|
784
|
+
if (colVirtualizerCleanup) colVirtualizerCleanup();
|
|
785
|
+
teardownColRtlWatch();
|
|
786
|
+
teardownRemeasure();
|
|
606
787
|
teardownFillDrag();
|
|
607
788
|
teardownRangeDrag();
|
|
608
789
|
});
|
|
@@ -657,7 +838,11 @@ function DataTable(_props) {
|
|
|
657
838
|
let virtualizer = null;
|
|
658
839
|
let virtualizerCleanup = null;
|
|
659
840
|
let gridScrollEl = null;
|
|
841
|
+
let colVirtualizer = null;
|
|
842
|
+
let colVirtualizerCleanup = null;
|
|
660
843
|
let remeasurePending = false;
|
|
844
|
+
let remeasureRaf = null;
|
|
845
|
+
let remeasureDisposed = false;
|
|
661
846
|
const GRID_PAGE_STEP = 10;
|
|
662
847
|
let gridRoot = null;
|
|
663
848
|
let programmatic = 0;
|
|
@@ -701,20 +886,6 @@ function DataTable(_props) {
|
|
|
701
886
|
function currentData() {
|
|
702
887
|
return data() != null ? data() : dataDefault();
|
|
703
888
|
}
|
|
704
|
-
function isSafeKey(k) {
|
|
705
|
-
return k !== "__proto__" && k !== "constructor" && k !== "prototype";
|
|
706
|
-
}
|
|
707
|
-
function wrapAggregationFn(fn) {
|
|
708
|
-
if (typeof fn === "string") return fn;
|
|
709
|
-
if (typeof fn !== "function") return void 0;
|
|
710
|
-
return (columnId, leafRows, childRows) => {
|
|
711
|
-
try {
|
|
712
|
-
return fn(columnId, leafRows, childRows);
|
|
713
|
-
} catch (err) {
|
|
714
|
-
return;
|
|
715
|
-
}
|
|
716
|
-
};
|
|
717
|
-
}
|
|
718
889
|
function buildConfigDef(c) {
|
|
719
890
|
if (!c) return null;
|
|
720
891
|
if (Array.isArray(c.columns)) {
|
|
@@ -759,10 +930,15 @@ function DataTable(_props) {
|
|
|
759
930
|
}
|
|
760
931
|
};
|
|
761
932
|
}
|
|
933
|
+
let columnDefsCache = null;
|
|
934
|
+
let columnDefsCacheColumnsRef = void 0;
|
|
935
|
+
let columnDefsCacheColRegRef = void 0;
|
|
762
936
|
function columnDefs() {
|
|
937
|
+
const cfg = local.columns || [];
|
|
938
|
+
const reg = colReg() || {};
|
|
939
|
+
if (columnDefsCache && local.columns === columnDefsCacheColumnsRef && colReg() === columnDefsCacheColRegRef) return columnDefsCache;
|
|
763
940
|
const byId = Object.create(null);
|
|
764
941
|
const order = [];
|
|
765
|
-
const cfg = local.columns || [];
|
|
766
942
|
for (const c of cfg) {
|
|
767
943
|
const def = buildConfigDef(c);
|
|
768
944
|
if (!def) continue;
|
|
@@ -770,7 +946,6 @@ function DataTable(_props) {
|
|
|
770
946
|
if (!(id in byId)) order.push(id);
|
|
771
947
|
byId[id] = def;
|
|
772
948
|
}
|
|
773
|
-
const reg = colReg() || {};
|
|
774
949
|
for (const id in reg) {
|
|
775
950
|
if (!isSafeKey(id)) continue;
|
|
776
951
|
const spec = reg[id];
|
|
@@ -798,6 +973,9 @@ function DataTable(_props) {
|
|
|
798
973
|
}
|
|
799
974
|
const out = [];
|
|
800
975
|
for (const id of order) if (byId[id]) out.push(byId[id]);
|
|
976
|
+
columnDefsCache = out;
|
|
977
|
+
columnDefsCacheColumnsRef = local.columns;
|
|
978
|
+
columnDefsCacheColRegRef = colReg();
|
|
801
979
|
return out;
|
|
802
980
|
}
|
|
803
981
|
const SELECT_COL_ID = "__rdt_select";
|
|
@@ -838,9 +1016,6 @@ function DataTable(_props) {
|
|
|
838
1016
|
_props.onSortChange?.(next);
|
|
839
1017
|
programmatic--;
|
|
840
1018
|
}
|
|
841
|
-
function applyUpdater(updater, current) {
|
|
842
|
-
return typeof updater === "function" ? updater(current) : updater;
|
|
843
|
-
}
|
|
844
1019
|
function writeExpanded(next) {
|
|
845
1020
|
if (programmatic) return;
|
|
846
1021
|
programmatic++;
|
|
@@ -1048,12 +1223,71 @@ function DataTable(_props) {
|
|
|
1048
1223
|
const next = applyUpdater(updater, columnSizingInfo());
|
|
1049
1224
|
setColumnSizingInfo(next != null ? next : columnSizingInfo());
|
|
1050
1225
|
}
|
|
1226
|
+
function resolveVirtual() {
|
|
1227
|
+
const v = local.virtual;
|
|
1228
|
+
if (typeof v === "string") {
|
|
1229
|
+
if (v === "rows") return "rows";
|
|
1230
|
+
if (v === "columns") return "columns";
|
|
1231
|
+
if (v === "both") return "both";
|
|
1232
|
+
return "off";
|
|
1233
|
+
}
|
|
1234
|
+
return v === true ? "rows" : "off";
|
|
1235
|
+
}
|
|
1236
|
+
function rowsWindowed() {
|
|
1237
|
+
const s = resolveVirtual();
|
|
1238
|
+
return s === "rows" || s === "both";
|
|
1239
|
+
}
|
|
1240
|
+
function colsWindowed() {
|
|
1241
|
+
const s = resolveVirtual();
|
|
1242
|
+
return s === "columns" || s === "both";
|
|
1243
|
+
}
|
|
1244
|
+
function isWindowed() {
|
|
1245
|
+
return rowsWindowed() || colsWindowed();
|
|
1246
|
+
}
|
|
1247
|
+
function autoMeasureOn() {
|
|
1248
|
+
return local.autoMeasure === true;
|
|
1249
|
+
}
|
|
1250
|
+
function columnCount() {
|
|
1251
|
+
return visibleColCount();
|
|
1252
|
+
}
|
|
1253
|
+
function columnSize(i) {
|
|
1254
|
+
if (!table || !table.getVisibleLeafColumns) return 150;
|
|
1255
|
+
const c = table.getVisibleLeafColumns()[i];
|
|
1256
|
+
return c && typeof c.getSize === "function" ? c.getSize() : 150;
|
|
1257
|
+
}
|
|
1258
|
+
function forcedColumns() {
|
|
1259
|
+
if (!colsWindowed()) return [];
|
|
1260
|
+
const out = [];
|
|
1261
|
+
if (table && table.getVisibleLeafColumns) {
|
|
1262
|
+
const cols = table.getVisibleLeafColumns();
|
|
1263
|
+
for (let i = 0; i < cols.length; i++) {
|
|
1264
|
+
const c = cols[i];
|
|
1265
|
+
if (c && c.getIsPinned && c.getIsPinned()) out.push(i);
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
if (!activeIsHeader() && activeColIndex() >= 0 && out.indexOf(activeColIndex()) === -1) out.push(activeColIndex());
|
|
1269
|
+
if (editingRow() >= 0 && editingCol() >= 0 && out.indexOf(editingCol()) === -1) out.push(editingCol());
|
|
1270
|
+
return out;
|
|
1271
|
+
}
|
|
1272
|
+
function windowedCells(row) {
|
|
1273
|
+
windowVer();
|
|
1274
|
+
const cells = visibleCellsFor(row);
|
|
1275
|
+
if (!colsWindowed()) return cells;
|
|
1276
|
+
const idx = windowedColIndices();
|
|
1277
|
+
const out = [];
|
|
1278
|
+
for (let i = 0; i < idx.length; i++) {
|
|
1279
|
+
const cell = cells[idx[i]];
|
|
1280
|
+
if (cell) out.push(cell);
|
|
1281
|
+
}
|
|
1282
|
+
return out;
|
|
1283
|
+
}
|
|
1051
1284
|
function windowSource() {
|
|
1052
1285
|
if (!table) return [];
|
|
1053
|
-
if (
|
|
1286
|
+
if (rowsWindowed()) return table.getPrePaginationRowModel().rows;
|
|
1054
1287
|
return table.getRowModel().rows;
|
|
1055
1288
|
}
|
|
1056
1289
|
function scheduleRemeasure() {
|
|
1290
|
+
if (remeasureDisposed) return;
|
|
1057
1291
|
if (remeasurePending) return;
|
|
1058
1292
|
remeasurePending = true;
|
|
1059
1293
|
let ranMicro = false;
|
|
@@ -1061,6 +1295,7 @@ function DataTable(_props) {
|
|
|
1061
1295
|
remeasureWindow();
|
|
1062
1296
|
};
|
|
1063
1297
|
const rafPass = () => {
|
|
1298
|
+
remeasureRaf = null;
|
|
1064
1299
|
remeasurePending = false;
|
|
1065
1300
|
remeasureWindow();
|
|
1066
1301
|
};
|
|
@@ -1068,9 +1303,18 @@ function DataTable(_props) {
|
|
|
1068
1303
|
ranMicro = true;
|
|
1069
1304
|
queueMicrotask(microPass);
|
|
1070
1305
|
}
|
|
1071
|
-
if (typeof requestAnimationFrame === "function") requestAnimationFrame(rafPass);
|
|
1306
|
+
if (typeof requestAnimationFrame === "function") remeasureRaf = requestAnimationFrame(rafPass);
|
|
1072
1307
|
else if (ranMicro) remeasurePending = false;
|
|
1073
|
-
else setTimeout(rafPass, 0);
|
|
1308
|
+
else remeasureRaf = setTimeout(rafPass, 0);
|
|
1309
|
+
}
|
|
1310
|
+
function teardownRemeasure() {
|
|
1311
|
+
remeasureDisposed = true;
|
|
1312
|
+
if (remeasureRaf != null) {
|
|
1313
|
+
if (typeof requestAnimationFrame === "function") cancelAnimationFrame(remeasureRaf);
|
|
1314
|
+
else clearTimeout(remeasureRaf);
|
|
1315
|
+
remeasureRaf = null;
|
|
1316
|
+
}
|
|
1317
|
+
remeasurePending = false;
|
|
1074
1318
|
}
|
|
1075
1319
|
function pinnedEditIndex() {
|
|
1076
1320
|
if (editingRow() >= 0) return editingRow();
|
|
@@ -1083,20 +1327,124 @@ function DataTable(_props) {
|
|
|
1083
1327
|
return ms && ms[pin] ? ms[pin] : null;
|
|
1084
1328
|
}
|
|
1085
1329
|
function remeasureWindow() {
|
|
1330
|
+
if (remeasureDisposed) return;
|
|
1086
1331
|
if (!virtualizer || !gridRoot) return;
|
|
1087
1332
|
if (virtualizer.scrollState) return;
|
|
1088
1333
|
const trs = gridRoot.querySelectorAll("tbody.rdt-tbody > tr[data-index]");
|
|
1089
1334
|
for (const tr of trs) virtualizer.measureElement(tr);
|
|
1335
|
+
if (afterRowRemeasure) afterRowRemeasure();
|
|
1090
1336
|
}
|
|
1091
1337
|
function virtualItemKey(i) {
|
|
1092
1338
|
const src = windowSource();
|
|
1093
1339
|
return src && src[i] ? src[i].id : void 0;
|
|
1094
1340
|
}
|
|
1341
|
+
const COL_OVERSCAN = 3;
|
|
1342
|
+
let colRtlObserver = null;
|
|
1343
|
+
let colRtlObserverEl = null;
|
|
1344
|
+
function isColRtl() {
|
|
1345
|
+
if (!gridScrollEl || typeof getComputedStyle !== "function") return false;
|
|
1346
|
+
return getComputedStyle(gridScrollEl).direction === "rtl";
|
|
1347
|
+
}
|
|
1348
|
+
function ensureColRtlWatch() {
|
|
1349
|
+
if (!gridScrollEl || colRtlObserverEl === gridScrollEl || typeof MutationObserver !== "function") return;
|
|
1350
|
+
if (colRtlObserver) colRtlObserver.disconnect();
|
|
1351
|
+
colRtlObserver = new MutationObserver(() => {
|
|
1352
|
+
if (colVirtualizer) colVirtualizer.setOptions({
|
|
1353
|
+
...colVirtualizer.options,
|
|
1354
|
+
isRtl: isColRtl()
|
|
1355
|
+
});
|
|
1356
|
+
});
|
|
1357
|
+
colRtlObserver.observe(gridScrollEl, {
|
|
1358
|
+
attributes: true,
|
|
1359
|
+
attributeFilter: ["dir"]
|
|
1360
|
+
});
|
|
1361
|
+
colRtlObserverEl = gridScrollEl;
|
|
1362
|
+
}
|
|
1363
|
+
function teardownColRtlWatch() {
|
|
1364
|
+
if (colRtlObserver) colRtlObserver.disconnect();
|
|
1365
|
+
colRtlObserver = null;
|
|
1366
|
+
colRtlObserverEl = null;
|
|
1367
|
+
}
|
|
1368
|
+
function columnVirtualizerOptions() {
|
|
1369
|
+
ensureColRtlWatch();
|
|
1370
|
+
return {
|
|
1371
|
+
count: columnCount(),
|
|
1372
|
+
getScrollElement: () => gridScrollEl,
|
|
1373
|
+
estimateSize: (i) => columnSize(i),
|
|
1374
|
+
horizontal: true,
|
|
1375
|
+
isRtl: isColRtl(),
|
|
1376
|
+
observeElementRect: _tanstack_virtual_core.observeElementRect,
|
|
1377
|
+
observeElementOffset: _tanstack_virtual_core.observeElementOffset,
|
|
1378
|
+
scrollToFn: _tanstack_virtual_core.elementScroll,
|
|
1379
|
+
measureElement: _tanstack_virtual_core.measureElement,
|
|
1380
|
+
overscan: COL_OVERSCAN,
|
|
1381
|
+
onChange: () => {
|
|
1382
|
+
setWindowVer(windowVer() + 1);
|
|
1383
|
+
}
|
|
1384
|
+
};
|
|
1385
|
+
}
|
|
1386
|
+
let measuredRowTotal = 0;
|
|
1387
|
+
let measuredRowCount = 0;
|
|
1388
|
+
let lastFedRowEstimate = 0;
|
|
1389
|
+
let foldedRowHeights = {};
|
|
1390
|
+
let windowVerBumpPending = false;
|
|
1391
|
+
function bumpWindowVer() {
|
|
1392
|
+
if (windowVerBumpPending) return;
|
|
1393
|
+
windowVerBumpPending = true;
|
|
1394
|
+
const flush = () => {
|
|
1395
|
+
windowVerBumpPending = false;
|
|
1396
|
+
setWindowVer(windowVer() + 1);
|
|
1397
|
+
};
|
|
1398
|
+
if (typeof queueMicrotask !== "undefined") queueMicrotask(flush);
|
|
1399
|
+
else setTimeout(flush, 0);
|
|
1400
|
+
}
|
|
1401
|
+
const ESTIMATE_REFEED_DELTA_PX = 4;
|
|
1402
|
+
function estimateRowSize(i) {
|
|
1403
|
+
if (!autoMeasureOn()) return local.estimateRowHeight;
|
|
1404
|
+
if (measuredRowCount === 0) return local.estimateRowHeight;
|
|
1405
|
+
return Math.round(measuredRowTotal / measuredRowCount);
|
|
1406
|
+
}
|
|
1407
|
+
function foldMeasuredRow(index, height) {
|
|
1408
|
+
const prev = foldedRowHeights[index];
|
|
1409
|
+
if (prev === height) return;
|
|
1410
|
+
if (prev == null) {
|
|
1411
|
+
measuredRowTotal = measuredRowTotal + height;
|
|
1412
|
+
measuredRowCount = measuredRowCount + 1;
|
|
1413
|
+
} else measuredRowTotal = measuredRowTotal - prev + height;
|
|
1414
|
+
foldedRowHeights[index] = height;
|
|
1415
|
+
}
|
|
1416
|
+
function refineRowEstimate() {
|
|
1417
|
+
if (!autoMeasureOn() || !virtualizer) return;
|
|
1418
|
+
const items = virtualizer.getVirtualItems();
|
|
1419
|
+
const measurements = virtualizer.getMeasurements();
|
|
1420
|
+
for (let i = 0; i < items.length; i++) {
|
|
1421
|
+
const idx = items[i].index;
|
|
1422
|
+
const m = measurements && measurements[idx];
|
|
1423
|
+
if (m) foldMeasuredRow(idx, m.size);
|
|
1424
|
+
}
|
|
1425
|
+
if (virtualizer.scrollState) return;
|
|
1426
|
+
const est = estimateRowSize(0);
|
|
1427
|
+
if (Math.abs(est - lastFedRowEstimate) < ESTIMATE_REFEED_DELTA_PX) return;
|
|
1428
|
+
const anchorIndex = items.length ? items[0].index : -1;
|
|
1429
|
+
const anchorStart = items.length ? items[0].start : 0;
|
|
1430
|
+
virtualizer.setOptions(virtualizerOptions());
|
|
1431
|
+
virtualizer._willUpdate();
|
|
1432
|
+
lastFedRowEstimate = est;
|
|
1433
|
+
if (anchorIndex >= 0 && gridScrollEl) {
|
|
1434
|
+
const freshMeasurements = virtualizer.getMeasurements();
|
|
1435
|
+
const fresh = freshMeasurements && freshMeasurements[anchorIndex];
|
|
1436
|
+
if (fresh) {
|
|
1437
|
+
const delta = fresh.start - anchorStart;
|
|
1438
|
+
if (delta !== 0) gridScrollEl.scrollTop = gridScrollEl.scrollTop + delta;
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
bumpWindowVer();
|
|
1442
|
+
}
|
|
1095
1443
|
function virtualizerOptions() {
|
|
1096
1444
|
return {
|
|
1097
1445
|
count: windowSource().length,
|
|
1098
1446
|
getScrollElement: () => gridScrollEl,
|
|
1099
|
-
estimateSize: () =>
|
|
1447
|
+
estimateSize: (i) => estimateRowSize(i),
|
|
1100
1448
|
observeElementRect: _tanstack_virtual_core.observeElementRect,
|
|
1101
1449
|
observeElementOffset: _tanstack_virtual_core.observeElementOffset,
|
|
1102
1450
|
scrollToFn: _tanstack_virtual_core.elementScroll,
|
|
@@ -1104,7 +1452,7 @@ function DataTable(_props) {
|
|
|
1104
1452
|
overscan: 8,
|
|
1105
1453
|
getItemKey: virtualItemKey,
|
|
1106
1454
|
onChange: () => {
|
|
1107
|
-
|
|
1455
|
+
bumpWindowVer();
|
|
1108
1456
|
scheduleRemeasure();
|
|
1109
1457
|
}
|
|
1110
1458
|
};
|
|
@@ -1116,8 +1464,8 @@ function DataTable(_props) {
|
|
|
1116
1464
|
windowVer();
|
|
1117
1465
|
editVer();
|
|
1118
1466
|
if (!virtualizer) {
|
|
1119
|
-
if (!
|
|
1120
|
-
vi:
|
|
1467
|
+
if (!rowsWindowed()) return (rows() || []).map((r, i) => ({
|
|
1468
|
+
vi: { index: i },
|
|
1121
1469
|
row: r
|
|
1122
1470
|
}));
|
|
1123
1471
|
return [];
|
|
@@ -1153,7 +1501,7 @@ function DataTable(_props) {
|
|
|
1153
1501
|
function padTop() {
|
|
1154
1502
|
windowVer();
|
|
1155
1503
|
editVer();
|
|
1156
|
-
if (!
|
|
1504
|
+
if (!rowsWindowed() || !virtualizer) return 0;
|
|
1157
1505
|
const items = virtualizer.getVirtualItems();
|
|
1158
1506
|
let pad = items.length ? items[0].start : 0;
|
|
1159
1507
|
const pin = pinnedEditIndex();
|
|
@@ -1167,7 +1515,7 @@ function DataTable(_props) {
|
|
|
1167
1515
|
function padBottom() {
|
|
1168
1516
|
windowVer();
|
|
1169
1517
|
editVer();
|
|
1170
|
-
if (!
|
|
1518
|
+
if (!rowsWindowed() || !virtualizer) return 0;
|
|
1171
1519
|
const items = virtualizer.getVirtualItems();
|
|
1172
1520
|
if (!items.length) return 0;
|
|
1173
1521
|
let pad = virtualizer.getTotalSize() - items[items.length - 1].end;
|
|
@@ -1188,11 +1536,59 @@ function DataTable(_props) {
|
|
|
1188
1536
|
return false;
|
|
1189
1537
|
}
|
|
1190
1538
|
function rowIsOutsideWindow(r) {
|
|
1191
|
-
if (!
|
|
1539
|
+
if (!rowsWindowed() || !virtualizer) return false;
|
|
1192
1540
|
const items = virtualizer.getVirtualItems();
|
|
1193
1541
|
for (const it of items) if (it.index === r) return false;
|
|
1194
1542
|
return true;
|
|
1195
1543
|
}
|
|
1544
|
+
function windowedColIndices() {
|
|
1545
|
+
windowVer();
|
|
1546
|
+
editVer();
|
|
1547
|
+
if (!colsWindowed()) {
|
|
1548
|
+
const n = columnCount();
|
|
1549
|
+
const out = [];
|
|
1550
|
+
for (let i = 0; i < n; i++) out.push(i);
|
|
1551
|
+
return out;
|
|
1552
|
+
}
|
|
1553
|
+
if (!colVirtualizer) return [];
|
|
1554
|
+
const idx = colVirtualizer.getVirtualItems().map((it) => it.index);
|
|
1555
|
+
const forced = forcedColumns();
|
|
1556
|
+
for (let i = 0; i < forced.length; i++) if (idx.indexOf(forced[i]) === -1) idx.push(forced[i]);
|
|
1557
|
+
idx.sort((a, b) => a - b);
|
|
1558
|
+
return idx;
|
|
1559
|
+
}
|
|
1560
|
+
function colPadLeft() {
|
|
1561
|
+
windowVer();
|
|
1562
|
+
editVer();
|
|
1563
|
+
if (!colsWindowed() || !colVirtualizer) return 0;
|
|
1564
|
+
const items = colVirtualizer.getVirtualItems();
|
|
1565
|
+
let pad = items.length ? items[0].start : 0;
|
|
1566
|
+
if (items.length) {
|
|
1567
|
+
const firstIdx = items[0].index;
|
|
1568
|
+
const forced = forcedColumns();
|
|
1569
|
+
for (let i = 0; i < forced.length; i++) if (forced[i] < firstIdx) pad = pad - columnSize(forced[i]);
|
|
1570
|
+
}
|
|
1571
|
+
return pad < 0 ? 0 : pad;
|
|
1572
|
+
}
|
|
1573
|
+
function colPadRight() {
|
|
1574
|
+
windowVer();
|
|
1575
|
+
editVer();
|
|
1576
|
+
if (!colsWindowed() || !colVirtualizer) return 0;
|
|
1577
|
+
const items = colVirtualizer.getVirtualItems();
|
|
1578
|
+
if (!items.length) return 0;
|
|
1579
|
+
let pad = colVirtualizer.getTotalSize() - items[items.length - 1].end;
|
|
1580
|
+
const lastIdx = items[items.length - 1].index;
|
|
1581
|
+
const forced = forcedColumns();
|
|
1582
|
+
for (let i = 0; i < forced.length; i++) if (forced[i] > lastIdx) pad = pad - columnSize(forced[i]);
|
|
1583
|
+
return pad < 0 ? 0 : pad;
|
|
1584
|
+
}
|
|
1585
|
+
function colIsOutsideWindow(c) {
|
|
1586
|
+
if (!colsWindowed() || !colVirtualizer) return false;
|
|
1587
|
+
const items = colVirtualizer.getVirtualItems();
|
|
1588
|
+
for (const it of items) if (it.index === c) return false;
|
|
1589
|
+
return true;
|
|
1590
|
+
}
|
|
1591
|
+
let afterRowRemeasure = refineRowEstimate;
|
|
1196
1592
|
const announceState = {
|
|
1197
1593
|
sorting: null,
|
|
1198
1594
|
columnFilters: null,
|
|
@@ -1609,7 +2005,7 @@ function DataTable(_props) {
|
|
|
1609
2005
|
}
|
|
1610
2006
|
function getRowIndexRelativeToPage(absRow) {
|
|
1611
2007
|
const abs = absRow == null ? toAbsRow(activeRow()) : Math.trunc(Number(absRow)) || 0;
|
|
1612
|
-
if (
|
|
2008
|
+
if (rowsWindowed()) return abs;
|
|
1613
2009
|
return abs - pageRowOffset();
|
|
1614
2010
|
}
|
|
1615
2011
|
function cut() {
|
|
@@ -1634,14 +2030,14 @@ function DataTable(_props) {
|
|
|
1634
2030
|
return (hg && hg.headers ? hg.headers : []).indexOf(header);
|
|
1635
2031
|
}
|
|
1636
2032
|
function pageRowOffset() {
|
|
1637
|
-
if (!isGrid() ||
|
|
2033
|
+
if (!isGrid() || rowsWindowed()) return 0;
|
|
1638
2034
|
return pageIndex() * pageSize();
|
|
1639
2035
|
}
|
|
1640
2036
|
function toAbsRow(localRow) {
|
|
1641
2037
|
return localRow + pageRowOffset();
|
|
1642
2038
|
}
|
|
1643
2039
|
function prePaginationRowCount() {
|
|
1644
|
-
if (!table ||
|
|
2040
|
+
if (!table || rowsWindowed()) return bodyRowCount();
|
|
1645
2041
|
const pm = table.getPrePaginationRowModel();
|
|
1646
2042
|
return pm && pm.rows ? pm.rows.length : bodyRowCount();
|
|
1647
2043
|
}
|
|
@@ -1676,8 +2072,11 @@ function DataTable(_props) {
|
|
|
1676
2072
|
const c = nextCol == null ? activeColIndex() : nextCol;
|
|
1677
2073
|
const lvl = nextLevel == null ? activeHeaderLevel() : nextLevel;
|
|
1678
2074
|
const header = nextIsHeader == null ? activeIsHeader() : nextIsHeader;
|
|
1679
|
-
|
|
1680
|
-
|
|
2075
|
+
const rowOut = rowsWindowed() && virtualizer && rowIsOutsideWindow(r);
|
|
2076
|
+
const colOut = colsWindowed() && colVirtualizer && colIsOutsideWindow(c);
|
|
2077
|
+
if (!header && (rowOut || colOut)) {
|
|
2078
|
+
if (rowOut) virtualizer.scrollToIndex(r, { align: "center" });
|
|
2079
|
+
if (colOut) colVirtualizer.scrollToIndex(c, { align: "center" });
|
|
1681
2080
|
let focusAttempts = 0;
|
|
1682
2081
|
const myEpoch = focusIntentEpoch;
|
|
1683
2082
|
const focusWhenReady = () => {
|
|
@@ -1725,9 +2124,6 @@ function DataTable(_props) {
|
|
|
1725
2124
|
function bodyRowCount() {
|
|
1726
2125
|
return (rows() || []).length;
|
|
1727
2126
|
}
|
|
1728
|
-
function clamp(v, lo, hi) {
|
|
1729
|
-
return v < lo ? lo : v > hi ? hi : v;
|
|
1730
|
-
}
|
|
1731
2127
|
function headerLeafLevel() {
|
|
1732
2128
|
const hg = headerGroups() || [];
|
|
1733
2129
|
return hg.length ? hg.length - 1 : 0;
|
|
@@ -1890,10 +2286,6 @@ function DataTable(_props) {
|
|
|
1890
2286
|
function currentCellEl() {
|
|
1891
2287
|
return resolveCellEl(activeIsHeader() ? "__header" : String(activeRow()), activeColIndex(), activeIsHeader() ? activeHeaderLevel() : null);
|
|
1892
2288
|
}
|
|
1893
|
-
function focusables(cellEl) {
|
|
1894
|
-
if (!cellEl || !cellEl.querySelectorAll) return [];
|
|
1895
|
-
return Array.prototype.slice.call(cellEl.querySelectorAll("button,[href],input,select,textarea,[tabindex]:not([tabindex=\"-1\"])")).filter((n) => !n.disabled);
|
|
1896
|
-
}
|
|
1897
2289
|
function enterControl() {
|
|
1898
2290
|
const list = focusables(currentCellEl());
|
|
1899
2291
|
if (!list.length) return;
|
|
@@ -2296,6 +2688,40 @@ function DataTable(_props) {
|
|
|
2296
2688
|
recoverGridFocus(String(recRow), recCol, null);
|
|
2297
2689
|
}
|
|
2298
2690
|
}
|
|
2691
|
+
function windowedHeadersFor(hg, hgLevel) {
|
|
2692
|
+
const headers = hg && hg.headers || [];
|
|
2693
|
+
if (!colsWindowed()) return headers.map((h) => ({
|
|
2694
|
+
header: h,
|
|
2695
|
+
span: h && h.colSpan > 1 ? h.colSpan : 1
|
|
2696
|
+
}));
|
|
2697
|
+
const idx = windowedColIndices();
|
|
2698
|
+
const idxSet = {};
|
|
2699
|
+
for (let i = 0; i < idx.length; i++) idxSet[idx[i]] = true;
|
|
2700
|
+
let cursor = 0;
|
|
2701
|
+
const out = [];
|
|
2702
|
+
for (let i = 0; i < headers.length; i++) {
|
|
2703
|
+
const h = headers[i];
|
|
2704
|
+
const leafCount = h && h.colSpan ? h.colSpan : 1;
|
|
2705
|
+
const start = cursor;
|
|
2706
|
+
const end = cursor + leafCount;
|
|
2707
|
+
cursor = end;
|
|
2708
|
+
let span = 0;
|
|
2709
|
+
for (let c = start; c < end; c++) if (idxSet[c]) span = span + 1;
|
|
2710
|
+
if (span > 0) out.push({
|
|
2711
|
+
header: h,
|
|
2712
|
+
span
|
|
2713
|
+
});
|
|
2714
|
+
}
|
|
2715
|
+
return out;
|
|
2716
|
+
}
|
|
2717
|
+
function windowedColSpan() {
|
|
2718
|
+
return colsWindowed() ? windowedColIndices().length + 2 : visibleColCount();
|
|
2719
|
+
}
|
|
2720
|
+
function remeasureColumnWindow() {
|
|
2721
|
+
if (!colsWindowed() || !colVirtualizer) return;
|
|
2722
|
+
colVirtualizer.setOptions(columnVirtualizerOptions());
|
|
2723
|
+
colVirtualizer._willUpdate();
|
|
2724
|
+
}
|
|
2299
2725
|
let gridEmptyFallback = false;
|
|
2300
2726
|
let rangeTransition = false;
|
|
2301
2727
|
let rangeClickPending = false;
|
|
@@ -2478,10 +2904,6 @@ function DataTable(_props) {
|
|
|
2478
2904
|
c1: ac > fc ? ac : fc
|
|
2479
2905
|
};
|
|
2480
2906
|
}
|
|
2481
|
-
function escapeTsvField(s) {
|
|
2482
|
-
if (s.indexOf(" ") >= 0 || s.indexOf("\n") >= 0 || s.indexOf("\r") >= 0 || s.indexOf("\"") >= 0) return "\"" + s.replace(/"/g, "\"\"") + "\"";
|
|
2483
|
-
return s;
|
|
2484
|
-
}
|
|
2485
2907
|
function rangeToTsv() {
|
|
2486
2908
|
const box = normalizedRange();
|
|
2487
2909
|
const r0 = box ? box.r0 : activeRow();
|
|
@@ -2499,71 +2921,6 @@ function DataTable(_props) {
|
|
|
2499
2921
|
}
|
|
2500
2922
|
return lines.join("\n");
|
|
2501
2923
|
}
|
|
2502
|
-
function parseTsv(text) {
|
|
2503
|
-
const str = text != null ? String(text) : "";
|
|
2504
|
-
if (str === "" || str.length > 2e6) return [];
|
|
2505
|
-
const rows = [];
|
|
2506
|
-
let row = [];
|
|
2507
|
-
let field = "";
|
|
2508
|
-
let inQuotes = false;
|
|
2509
|
-
let i = 0;
|
|
2510
|
-
const n = str.length;
|
|
2511
|
-
while (i < n) {
|
|
2512
|
-
const ch = str[i];
|
|
2513
|
-
if (inQuotes) {
|
|
2514
|
-
if (ch === "\"") {
|
|
2515
|
-
if (i + 1 < n && str[i + 1] === "\"") {
|
|
2516
|
-
field = field + "\"";
|
|
2517
|
-
i = i + 2;
|
|
2518
|
-
continue;
|
|
2519
|
-
}
|
|
2520
|
-
inQuotes = false;
|
|
2521
|
-
i = i + 1;
|
|
2522
|
-
continue;
|
|
2523
|
-
}
|
|
2524
|
-
field = field + ch;
|
|
2525
|
-
i = i + 1;
|
|
2526
|
-
continue;
|
|
2527
|
-
}
|
|
2528
|
-
if (ch === "\"" && field === "") {
|
|
2529
|
-
inQuotes = true;
|
|
2530
|
-
i = i + 1;
|
|
2531
|
-
continue;
|
|
2532
|
-
}
|
|
2533
|
-
if (ch === " ") {
|
|
2534
|
-
row.push(field);
|
|
2535
|
-
field = "";
|
|
2536
|
-
i = i + 1;
|
|
2537
|
-
continue;
|
|
2538
|
-
}
|
|
2539
|
-
if (ch === "\r") {
|
|
2540
|
-
if (i + 1 < n && str[i + 1] === "\n") i = i + 1;
|
|
2541
|
-
row.push(field);
|
|
2542
|
-
field = "";
|
|
2543
|
-
rows.push(row);
|
|
2544
|
-
row = [];
|
|
2545
|
-
i = i + 1;
|
|
2546
|
-
continue;
|
|
2547
|
-
}
|
|
2548
|
-
if (ch === "\n") {
|
|
2549
|
-
row.push(field);
|
|
2550
|
-
field = "";
|
|
2551
|
-
rows.push(row);
|
|
2552
|
-
row = [];
|
|
2553
|
-
i = i + 1;
|
|
2554
|
-
continue;
|
|
2555
|
-
}
|
|
2556
|
-
field = field + ch;
|
|
2557
|
-
i = i + 1;
|
|
2558
|
-
}
|
|
2559
|
-
row.push(field);
|
|
2560
|
-
rows.push(row);
|
|
2561
|
-
if (rows.length > 1) {
|
|
2562
|
-
const last = rows[rows.length - 1];
|
|
2563
|
-
if (last.length === 1 && last[0] === "") rows.pop();
|
|
2564
|
-
}
|
|
2565
|
-
return rows;
|
|
2566
|
-
}
|
|
2567
2924
|
function copyRange() {
|
|
2568
2925
|
if (!clipboardActiveAllowed()) return;
|
|
2569
2926
|
if (typeof navigator === "undefined" || !navigator.clipboard || !navigator.clipboard.writeText) return;
|
|
@@ -2630,30 +2987,6 @@ function DataTable(_props) {
|
|
|
2630
2987
|
const row = (rows() || [])[rowIndex];
|
|
2631
2988
|
return row ? row.id : null;
|
|
2632
2989
|
}
|
|
2633
|
-
function tileGridToBox(grid, box) {
|
|
2634
|
-
const srcRows = grid.length;
|
|
2635
|
-
let srcCols = 0;
|
|
2636
|
-
for (let i = 0; i < srcRows; i++) {
|
|
2637
|
-
const w = grid[i] && grid[i].length ? grid[i].length : 0;
|
|
2638
|
-
if (w > srcCols) srcCols = w;
|
|
2639
|
-
}
|
|
2640
|
-
if (srcRows <= 0 || srcCols <= 0) return grid;
|
|
2641
|
-
const boxRows = box.r1 - box.r0 + 1;
|
|
2642
|
-
const boxCols = box.c1 - box.c0 + 1;
|
|
2643
|
-
const rows = boxRows > srcRows ? boxRows : srcRows;
|
|
2644
|
-
const cols = boxCols > srcCols ? boxCols : srcCols;
|
|
2645
|
-
const out = [];
|
|
2646
|
-
for (let r = 0; r < rows; r++) {
|
|
2647
|
-
const srcLine = grid[r % srcRows] || [];
|
|
2648
|
-
const line = [];
|
|
2649
|
-
for (let c = 0; c < cols; c++) {
|
|
2650
|
-
const v = srcLine[c % srcCols];
|
|
2651
|
-
line.push(v != null ? v : "");
|
|
2652
|
-
}
|
|
2653
|
-
out.push(line);
|
|
2654
|
-
}
|
|
2655
|
-
return out;
|
|
2656
|
-
}
|
|
2657
2990
|
function pasteRange() {
|
|
2658
2991
|
if (!clipboardActiveAllowed()) return;
|
|
2659
2992
|
if (typeof navigator === "undefined" || !navigator.clipboard || !navigator.clipboard.readText) return;
|
|
@@ -2713,13 +3046,6 @@ function DataTable(_props) {
|
|
|
2713
3046
|
}
|
|
2714
3047
|
applyGridToRange(grid, r0, c0);
|
|
2715
3048
|
}
|
|
2716
|
-
function tileIndex(i, lo, hi) {
|
|
2717
|
-
const span = hi - lo + 1;
|
|
2718
|
-
if (span <= 1) return lo;
|
|
2719
|
-
let k = (i - lo) % span;
|
|
2720
|
-
if (k < 0) k = k + span;
|
|
2721
|
-
return lo + k;
|
|
2722
|
-
}
|
|
2723
3049
|
function fillRange(sourceBox, endCell) {
|
|
2724
3050
|
let box;
|
|
2725
3051
|
if (sourceBox && sourceBox.r0 != null && endCell) {
|
|
@@ -2759,6 +3085,30 @@ function DataTable(_props) {
|
|
|
2759
3085
|
let fillDragging = false;
|
|
2760
3086
|
let fillDragMove = null;
|
|
2761
3087
|
let fillDragUp = null;
|
|
3088
|
+
let fillEdgeScrollRaf = null;
|
|
3089
|
+
const FILL_EDGE_SCROLL_PX = 24;
|
|
3090
|
+
const FILL_EDGE_SCROLL_STEP = 16;
|
|
3091
|
+
function edgeDelta(clientX, clientY) {
|
|
3092
|
+
if (!gridScrollEl) return {
|
|
3093
|
+
dx: 0,
|
|
3094
|
+
dy: 0
|
|
3095
|
+
};
|
|
3096
|
+
const rect = gridScrollEl.getBoundingClientRect();
|
|
3097
|
+
let dx = 0;
|
|
3098
|
+
let dy = 0;
|
|
3099
|
+
if (colsWindowed()) {
|
|
3100
|
+
if (clientX - rect.left < FILL_EDGE_SCROLL_PX) dx = -FILL_EDGE_SCROLL_STEP;
|
|
3101
|
+
else if (rect.right - clientX < FILL_EDGE_SCROLL_PX) dx = FILL_EDGE_SCROLL_STEP;
|
|
3102
|
+
}
|
|
3103
|
+
if (rowsWindowed()) {
|
|
3104
|
+
if (clientY - rect.top < FILL_EDGE_SCROLL_PX) dy = -FILL_EDGE_SCROLL_STEP;
|
|
3105
|
+
else if (rect.bottom - clientY < FILL_EDGE_SCROLL_PX) dy = FILL_EDGE_SCROLL_STEP;
|
|
3106
|
+
}
|
|
3107
|
+
return {
|
|
3108
|
+
dx,
|
|
3109
|
+
dy
|
|
3110
|
+
};
|
|
3111
|
+
}
|
|
2762
3112
|
function teardownFillDrag() {
|
|
2763
3113
|
if (typeof document !== "undefined") {
|
|
2764
3114
|
if (fillDragMove) document.removeEventListener("pointermove", fillDragMove);
|
|
@@ -2767,6 +3117,10 @@ function DataTable(_props) {
|
|
|
2767
3117
|
fillDragMove = null;
|
|
2768
3118
|
fillDragUp = null;
|
|
2769
3119
|
fillDragging = false;
|
|
3120
|
+
if (fillEdgeScrollRaf != null) {
|
|
3121
|
+
if (typeof cancelAnimationFrame === "function") cancelAnimationFrame(fillEdgeScrollRaf);
|
|
3122
|
+
fillEdgeScrollRaf = null;
|
|
3123
|
+
}
|
|
2770
3124
|
}
|
|
2771
3125
|
function cellIndexFromPoint(clientX, clientY) {
|
|
2772
3126
|
if (typeof document === "undefined" || !document.elementFromPoint) return null;
|
|
@@ -2801,14 +3155,42 @@ function DataTable(_props) {
|
|
|
2801
3155
|
r: sourceBox.r1,
|
|
2802
3156
|
c: sourceBox.c1
|
|
2803
3157
|
} : null;
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
3158
|
+
let lastClientX = 0;
|
|
3159
|
+
let lastClientY = 0;
|
|
3160
|
+
const applyPointAt = (clientX, clientY) => {
|
|
3161
|
+
const cell = cellIndexFromPoint(clientX, clientY);
|
|
2807
3162
|
if (cell && (!lastCell || cell.r !== lastCell.r || cell.c !== lastCell.c)) {
|
|
2808
3163
|
lastCell = cell;
|
|
2809
3164
|
setRangeFocus$local(cell.r, cell.c);
|
|
2810
3165
|
}
|
|
2811
3166
|
};
|
|
3167
|
+
const scrollStep = () => {
|
|
3168
|
+
if (!fillDragging) {
|
|
3169
|
+
fillEdgeScrollRaf = null;
|
|
3170
|
+
return;
|
|
3171
|
+
}
|
|
3172
|
+
const d = edgeDelta(lastClientX, lastClientY);
|
|
3173
|
+
if (d.dx === 0 && d.dy === 0) {
|
|
3174
|
+
fillEdgeScrollRaf = null;
|
|
3175
|
+
return;
|
|
3176
|
+
}
|
|
3177
|
+
if (gridScrollEl) {
|
|
3178
|
+
if (d.dx !== 0) gridScrollEl.scrollLeft = gridScrollEl.scrollLeft + d.dx;
|
|
3179
|
+
if (d.dy !== 0) gridScrollEl.scrollTop = gridScrollEl.scrollTop + d.dy;
|
|
3180
|
+
}
|
|
3181
|
+
applyPointAt(lastClientX, lastClientY);
|
|
3182
|
+
fillEdgeScrollRaf = requestAnimationFrame(scrollStep);
|
|
3183
|
+
};
|
|
3184
|
+
const move = (ev) => {
|
|
3185
|
+
if (!fillDragging) return;
|
|
3186
|
+
lastClientX = ev.clientX;
|
|
3187
|
+
lastClientY = ev.clientY;
|
|
3188
|
+
applyPointAt(ev.clientX, ev.clientY);
|
|
3189
|
+
if (fillEdgeScrollRaf == null && typeof requestAnimationFrame === "function") {
|
|
3190
|
+
const d = edgeDelta(ev.clientX, ev.clientY);
|
|
3191
|
+
if (d.dx !== 0 || d.dy !== 0) fillEdgeScrollRaf = requestAnimationFrame(scrollStep);
|
|
3192
|
+
}
|
|
3193
|
+
};
|
|
2812
3194
|
const up = () => {
|
|
2813
3195
|
teardownFillDrag();
|
|
2814
3196
|
if (lastCell && sourceBox && (lastCell.r !== sourceBox.r1 || lastCell.c !== sourceBox.c1)) fillRange(sourceBox, lastCell);
|
|
@@ -2899,16 +3281,6 @@ function DataTable(_props) {
|
|
|
2899
3281
|
function setInvalid(msg) {
|
|
2900
3282
|
setInvalidMsg(msg != null ? msg : "");
|
|
2901
3283
|
}
|
|
2902
|
-
function replaceRowValue(rows, rowIndex, field, value) {
|
|
2903
|
-
const src = rows || [];
|
|
2904
|
-
const out = [];
|
|
2905
|
-
for (let i = 0; i < src.length; i++) if (i === rowIndex) out.push({
|
|
2906
|
-
...src[i] || {},
|
|
2907
|
-
[field]: value
|
|
2908
|
-
});
|
|
2909
|
-
else out.push(src[i]);
|
|
2910
|
-
return out;
|
|
2911
|
-
}
|
|
2912
3284
|
function sourceIndexOfRow(visibleRowIndex) {
|
|
2913
3285
|
const row = (rows() || [])[visibleRowIndex];
|
|
2914
3286
|
if (!row) return visibleRowIndex;
|
|
@@ -3015,16 +3387,6 @@ function DataTable(_props) {
|
|
|
3015
3387
|
if (typeof requestAnimationFrame === "function") requestAnimationFrame(tryFocus);
|
|
3016
3388
|
else setTimeout(tryFocus, 0);
|
|
3017
3389
|
}
|
|
3018
|
-
function indexOfRowIn(rows, rowOriginal, rowId) {
|
|
3019
|
-
const list = rows || [];
|
|
3020
|
-
for (let i = 0; i < list.length; i++) {
|
|
3021
|
-
const r = list[i];
|
|
3022
|
-
if (!r) continue;
|
|
3023
|
-
if (rowId != null && r.id === rowId) return i;
|
|
3024
|
-
if (rowOriginal != null && r.original === rowOriginal) return i;
|
|
3025
|
-
}
|
|
3026
|
-
return -1;
|
|
3027
|
-
}
|
|
3028
3390
|
function endEdit() {
|
|
3029
3391
|
setEditingRow(-1);
|
|
3030
3392
|
setEditingCol(-1);
|
|
@@ -3279,17 +3641,6 @@ function DataTable(_props) {
|
|
|
3279
3641
|
editTransition = false;
|
|
3280
3642
|
focusCellWhenReady(focusRow, focusCol);
|
|
3281
3643
|
}
|
|
3282
|
-
function replaceRowValues(rows, rowIndex, fieldValues) {
|
|
3283
|
-
const src = rows || [];
|
|
3284
|
-
const fv = fieldValues || {};
|
|
3285
|
-
const out = [];
|
|
3286
|
-
for (let i = 0; i < src.length; i++) if (i === rowIndex) out.push({
|
|
3287
|
-
...src[i] || {},
|
|
3288
|
-
...fv
|
|
3289
|
-
});
|
|
3290
|
-
else out.push(src[i]);
|
|
3291
|
-
return out;
|
|
3292
|
-
}
|
|
3293
3644
|
function nextEditableCell(fromRow, fromCol) {
|
|
3294
3645
|
const rowList = rows() || [];
|
|
3295
3646
|
const rowCount = rowList.length;
|
|
@@ -3540,8 +3891,9 @@ function DataTable(_props) {
|
|
|
3540
3891
|
const absLast = prePaginationRowCount() - 1;
|
|
3541
3892
|
const absRow = clamp(Math.trunc(Number(rowIndex)) || 0, 0, absLast < 0 ? 0 : absLast);
|
|
3542
3893
|
const prevAbs = toAbsRow(activeRow());
|
|
3894
|
+
const prevCol = activeColIndex();
|
|
3543
3895
|
const prevIsHeader = activeIsHeader();
|
|
3544
|
-
if (
|
|
3896
|
+
if (rowsWindowed()) {
|
|
3545
3897
|
setActiveIsHeader(false);
|
|
3546
3898
|
setActiveInControl(false);
|
|
3547
3899
|
setActiveRow(absRow);
|
|
@@ -3560,7 +3912,7 @@ function DataTable(_props) {
|
|
|
3560
3912
|
if (switched) focusAbsCellWhenReady(absRow, localRow, c);
|
|
3561
3913
|
else focusActiveCell(localRow, c, false);
|
|
3562
3914
|
}
|
|
3563
|
-
if (absRow !== prevAbs || prevIsHeader) _props.onActivecellChange?.({
|
|
3915
|
+
if (absRow !== prevAbs || c !== prevCol || prevIsHeader) _props.onActivecellChange?.({
|
|
3564
3916
|
rowIndex: absRow,
|
|
3565
3917
|
colIndex: c
|
|
3566
3918
|
});
|
|
@@ -3676,7 +4028,7 @@ function DataTable(_props) {
|
|
|
3676
4028
|
applyGrouping,
|
|
3677
4029
|
clearGrouping
|
|
3678
4030
|
}) ?? <_solid_primitives_keyed.Key each={groupingKeys()} by={(gk) => gk}>{(gk) => <span class={"rdt-group-token"} data-group-token="" data-rozie-s-d5dcab4c="">{(0, _rozie_runtime_solid.rozieDisplay)(gk())}</span>}</_solid_primitives_keyed.Key>}
|
|
3679
|
-
</div></Solid_js.Show>}{<Solid_js.Show when={
|
|
4031
|
+
</div></Solid_js.Show>}{<Solid_js.Show when={isWindowed()} fallback={<table aria-rowcount={(0, _rozie_runtime_solid.rozieAttr)(gridAriaRowCount())} class={"rozie-data-table " + (0, _rozie_runtime_solid.rozieClass)({ "rdt-sticky": local.stickyHeader })} role={(0, _rozie_runtime_solid.rozieAttr)(tableRole())} onKeyDown={($event) => {
|
|
3680
4032
|
onGridKeyDown($event);
|
|
3681
4033
|
}} onFocusIn={($event) => {
|
|
3682
4034
|
syncActiveFromEvent($event);
|
|
@@ -3863,8 +4215,11 @@ function DataTable(_props) {
|
|
|
3863
4215
|
</td>
|
|
3864
4216
|
</tr></Solid_js.Show>}</>}</_solid_primitives_keyed.Key>
|
|
3865
4217
|
</tbody>
|
|
3866
|
-
</table>}><div class={"rdt-scroll"} style={(0, _rozie_runtime_solid.parseInlineStyle)(local.maxHeight ? "max-height:" + local.maxHeight + ";overflow:auto;--rozie-data-table-max-height:" + local.maxHeight : "overflow:auto")} data-rozie-s-d5dcab4c="">
|
|
3867
|
-
<table aria-rowcount={(0, _rozie_runtime_solid.rozieAttr)(gridAriaRowCount())} class={"rozie-data-table " + (0, _rozie_runtime_solid.rozieClass)({
|
|
4218
|
+
</table>}><div class={"rdt-scroll"} style={(0, _rozie_runtime_solid.parseInlineStyle)(rowsWindowed() && local.maxHeight ? "max-height:" + local.maxHeight + ";overflow:auto;--rozie-data-table-max-height:" + local.maxHeight : "overflow:auto")} data-rozie-s-d5dcab4c="">
|
|
4219
|
+
<table aria-rowcount={(0, _rozie_runtime_solid.rozieAttr)(gridAriaRowCount())} class={"rozie-data-table " + (0, _rozie_runtime_solid.rozieClass)({
|
|
4220
|
+
"rdt-sticky": local.stickyHeader,
|
|
4221
|
+
"rdt-col-windowed": colsWindowed()
|
|
4222
|
+
})} role={(0, _rozie_runtime_solid.rozieAttr)(tableRole())} onKeyDown={($event) => {
|
|
3868
4223
|
onGridKeyDown($event);
|
|
3869
4224
|
}} onFocusIn={($event) => {
|
|
3870
4225
|
syncActiveFromEvent($event);
|
|
@@ -3879,53 +4234,54 @@ function DataTable(_props) {
|
|
|
3879
4234
|
}} data-rozie-s-d5dcab4c="">
|
|
3880
4235
|
<thead class={"rdt-thead"} role="rowgroup" data-rozie-s-d5dcab4c="">
|
|
3881
4236
|
<_solid_primitives_keyed.Key each={headerGroups()} by={(hg) => hg.id}>{(hg, hgLevel) => <tr class={"rdt-tr"} role="row" aria-rowindex={(0, _rozie_runtime_solid.rozieAttr)(hgLevel() + 1)} data-rozie-s-d5dcab4c="">
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
"rdt-
|
|
3885
|
-
"rdt-th
|
|
3886
|
-
"rdt-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
4237
|
+
|
|
4238
|
+
{<Solid_js.Show when={colsWindowed()}><th class={"rdt-col-spacer"} aria-hidden="true" style={(0, _rozie_runtime_solid.parseInlineStyle)("width:" + colPadLeft() + "px;padding:0;border:0")} data-rozie-s-d5dcab4c="" /></Solid_js.Show>}<_solid_primitives_keyed.Key each={windowedHeadersFor(hg(), hgLevel())} by={(wh) => wh.header.id}>{(wh) => <th class={"rdt-th " + (0, _rozie_runtime_solid.rozieClass)({
|
|
4239
|
+
"rdt-select-th": isSelectColumn(wh().header.column.id),
|
|
4240
|
+
"rdt-expander-th": isExpanderColumn(wh().header.column.id),
|
|
4241
|
+
"rdt-th-resizing": columnIsResizing(wh().header.column.id),
|
|
4242
|
+
"rdt-cell-active": isActiveCell("__header", headerColIndexOf(hg(), wh().header), hgLevel())
|
|
4243
|
+
})} role="columnheader" data-col={(0, _rozie_runtime_solid.rozieAttr)(wh().header.column.id)} data-grid-cell="" data-row="__header" data-header-level={(0, _rozie_runtime_solid.rozieAttr)(hgLevel())} colSpan={(0, _rozie_runtime_solid.rozieAttr)(wh().span > 1 ? wh().span : null)} data-col-index={(0, _rozie_runtime_solid.rozieAttr)(headerColIndexOf(hg(), wh().header))} tabIndex={(0, _rozie_runtime_solid.rozieAttr)(cellTabindex("__header", headerColIndexOf(hg(), wh().header), hgLevel()))} aria-sort={(0, _rozie_runtime_solid.rozieAttr)(ariaSortFor(wh().header.column.id))} style={(0, _rozie_runtime_solid.parseInlineStyle)(thStyle(wh().header.column.id))} data-rozie-s-d5dcab4c="">
|
|
4244
|
+
{<Solid_js.Show when={isSelectColumn(wh().header.column.id)} fallback={<Solid_js.Show when={isExpanderColumn(wh().header.column.id)} fallback={<span style={{ display: "contents" }} data-rozie-s-d5dcab4c="">
|
|
4245
|
+
{<Solid_js.Show when={wh().header.column.getCanSort && wh().header.column.getCanSort()} fallback={<span style={{ display: "contents" }} data-rozie-s-d5dcab4c="">
|
|
3890
4246
|
<span class={"rdt-header-label"} data-rozie-s-d5dcab4c="">
|
|
3891
4247
|
{(_props.colHeaderSlot ?? _props.slots?.["colHeader"])?.({
|
|
3892
|
-
columnId:
|
|
3893
|
-
column:
|
|
3894
|
-
label: headerLabel(
|
|
3895
|
-
}) ?? (0, _rozie_runtime_solid.rozieDisplay)(headerLabel(
|
|
4248
|
+
columnId: wh().header.column.id,
|
|
4249
|
+
column: wh().header.column,
|
|
4250
|
+
label: headerLabel(wh().header.column.id)
|
|
4251
|
+
}) ?? (0, _rozie_runtime_solid.rozieDisplay)(headerLabel(wh().header.column.id))}
|
|
3896
4252
|
</span>
|
|
3897
4253
|
</span>}><button type="button" class={"rdt-sort-btn"} onClick={($event) => {
|
|
3898
|
-
onHeaderSort(
|
|
4254
|
+
onHeaderSort(wh().header.column.id, $event);
|
|
3899
4255
|
}} data-rozie-s-d5dcab4c="">
|
|
3900
4256
|
<span class={"rdt-header-label"} data-rozie-s-d5dcab4c="">
|
|
3901
4257
|
{(_props.colHeaderSlot ?? _props.slots?.["colHeader"])?.({
|
|
3902
|
-
columnId:
|
|
3903
|
-
column:
|
|
3904
|
-
label: headerLabel(
|
|
3905
|
-
}) ?? (0, _rozie_runtime_solid.rozieDisplay)(headerLabel(
|
|
4258
|
+
columnId: wh().header.column.id,
|
|
4259
|
+
column: wh().header.column,
|
|
4260
|
+
label: headerLabel(wh().header.column.id)
|
|
4261
|
+
}) ?? (0, _rozie_runtime_solid.rozieDisplay)(headerLabel(wh().header.column.id))}
|
|
3906
4262
|
</span>
|
|
3907
|
-
<span class={"rdt-sort-ind"} aria-hidden="true" data-rozie-s-d5dcab4c="">{(0, _rozie_runtime_solid.rozieDisplay)(sortIndicator(
|
|
4263
|
+
<span class={"rdt-sort-ind"} aria-hidden="true" data-rozie-s-d5dcab4c="">{(0, _rozie_runtime_solid.rozieDisplay)(sortIndicator(wh().header.column.id))}</span>
|
|
3908
4264
|
</button></Solid_js.Show>}<_rozie_ui_popover_solid.default trigger="click" placement="bottom-end" strategy="fixed" offset={4} data-rozie-s-d5dcab4c="" anchorSlot={() => <>
|
|
3909
|
-
<button type="button" class={"rdt-col-menu-trigger"} aria-label={(0, _rozie_runtime_solid.rozieAttr)("Column options for " + headerLabel(
|
|
4265
|
+
<button type="button" class={"rdt-col-menu-trigger"} aria-label={(0, _rozie_runtime_solid.rozieAttr)("Column options for " + headerLabel(wh().header.column.id))} data-rozie-s-d5dcab4c="">⋯</button>
|
|
3910
4266
|
</>}><div class={"rdt-col-menu"} role="menu" data-rozie-s-d5dcab4c="">
|
|
3911
|
-
<button type="button" role="menuitem" aria-pressed={columnPinSide(
|
|
3912
|
-
onPinColumn(
|
|
4267
|
+
<button type="button" role="menuitem" aria-pressed={columnPinSide(wh().header.column.id) === "left"} class={"rdt-col-menu-item"} onClick={($event) => {
|
|
4268
|
+
onPinColumn(wh().header.column.id, "left", $event);
|
|
3913
4269
|
}} data-rozie-s-d5dcab4c="">Pin left</button>
|
|
3914
|
-
<button type="button" role="menuitem" aria-pressed={columnPinSide(
|
|
3915
|
-
onPinColumn(
|
|
4270
|
+
<button type="button" role="menuitem" aria-pressed={columnPinSide(wh().header.column.id) === "right"} class={"rdt-col-menu-item"} onClick={($event) => {
|
|
4271
|
+
onPinColumn(wh().header.column.id, "right", $event);
|
|
3916
4272
|
}} data-rozie-s-d5dcab4c="">Pin right</button>
|
|
3917
|
-
<button type="button" role="menuitem" aria-pressed={!columnPinSide(
|
|
3918
|
-
onPinColumn(
|
|
4273
|
+
<button type="button" role="menuitem" aria-pressed={!columnPinSide(wh().header.column.id)} class={"rdt-col-menu-item"} onClick={($event) => {
|
|
4274
|
+
onPinColumn(wh().header.column.id, false, $event);
|
|
3919
4275
|
}} data-rozie-s-d5dcab4c="">Unpin</button>
|
|
3920
4276
|
<hr class={"rdt-col-menu-sep"} data-rozie-s-d5dcab4c="" />
|
|
3921
4277
|
<button type="button" role="menuitem" class={"rdt-col-menu-item"} onClick={($event) => {
|
|
3922
|
-
onHideColumn(
|
|
4278
|
+
onHideColumn(wh().header.column.id, $event);
|
|
3923
4279
|
}} data-rozie-s-d5dcab4c="">Hide column</button>
|
|
3924
4280
|
</div></_rozie_ui_popover_solid.default>
|
|
3925
|
-
<button type="button" aria-label={(0, _rozie_runtime_solid.rozieAttr)("Resize " + headerLabel(
|
|
3926
|
-
onResizeStart(
|
|
4281
|
+
<button type="button" aria-label={(0, _rozie_runtime_solid.rozieAttr)("Resize " + headerLabel(wh().header.column.id))} class={"rdt-resize-handle"} onPointerDown={($event) => {
|
|
4282
|
+
onResizeStart(wh().header.column.id, $event);
|
|
3927
4283
|
}} onTouchStart={($event) => {
|
|
3928
|
-
onResizeStart(
|
|
4284
|
+
onResizeStart(wh().header.column.id, $event);
|
|
3929
4285
|
}} data-rozie-s-d5dcab4c=""><span class={"rdt-resize-grip"} aria-hidden="true" data-rozie-s-d5dcab4c="" /></button>
|
|
3930
4286
|
</span>}><span style={{ display: "contents" }} data-rozie-s-d5dcab4c="" /></Solid_js.Show>}><span style={{ display: "contents" }} data-rozie-s-d5dcab4c="">
|
|
3931
4287
|
{(_props.selectAllSlot ?? _props.slots?.["selectAll"])?.({
|
|
@@ -3936,30 +4292,31 @@ function DataTable(_props) {
|
|
|
3936
4292
|
onToggleAllRows($event);
|
|
3937
4293
|
}} data-rozie-s-d5dcab4c="" /></Solid_js.Show>}
|
|
3938
4294
|
</span></Solid_js.Show>}</th>}</_solid_primitives_keyed.Key>
|
|
3939
|
-
|
|
4295
|
+
|
|
4296
|
+
{<Solid_js.Show when={colsWindowed()}><th class={"rdt-col-spacer"} aria-hidden="true" style={(0, _rozie_runtime_solid.parseInlineStyle)("width:" + colPadRight() + "px;padding:0;border:0")} data-rozie-s-d5dcab4c="" /></Solid_js.Show>}</tr>}</_solid_primitives_keyed.Key>
|
|
3940
4297
|
|
|
3941
4298
|
{<Solid_js.Show when={hasAnyFilterableColumn()}><tr class={"rdt-filter-row"} data-rozie-s-d5dcab4c="">
|
|
3942
|
-
<_solid_primitives_keyed.Key each={headerGroups()[headerGroups().length - 1].
|
|
3943
|
-
{<Solid_js.Show when={isSelectColumn(
|
|
3944
|
-
{<Solid_js.Show when={columnIsFilterable(
|
|
3945
|
-
onColumnFilterInput(
|
|
4299
|
+
{<Solid_js.Show when={colsWindowed()}><th class={"rdt-col-spacer"} aria-hidden="true" style={(0, _rozie_runtime_solid.parseInlineStyle)("width:" + colPadLeft() + "px;padding:0;border:0")} data-rozie-s-d5dcab4c="" /></Solid_js.Show>}<_solid_primitives_keyed.Key each={windowedHeadersFor(headerGroups()[headerGroups().length - 1], headerGroups().length - 1)} by={(wh) => wh.header.id}>{(wh) => <th class={"rdt-filter-cell"} role="presentation" data-col={(0, _rozie_runtime_solid.rozieAttr)(wh().header.column.id)} style={(0, _rozie_runtime_solid.parseInlineStyle)(pinStyle(wh().header.column.id))} data-rozie-s-d5dcab4c="">
|
|
4300
|
+
{<Solid_js.Show when={isSelectColumn(wh().header.column.id)} fallback={<Solid_js.Show when={isExpanderColumn(wh().header.column.id)} fallback={<span style={{ display: "contents" }} data-rozie-s-d5dcab4c="">
|
|
4301
|
+
{<Solid_js.Show when={columnIsFilterable(wh().header.column.id) && !hasFilterSlot()}><input type="text" aria-label={(0, _rozie_runtime_solid.rozieAttr)("Filter " + headerLabel(wh().header.column.id))} class={"rdt-col-filter"} value={columnFilterValue(wh().header.column.id)} onInput={($event) => {
|
|
4302
|
+
onColumnFilterInput(wh().header.column.id, $event);
|
|
3946
4303
|
}} onClick={($event) => {
|
|
3947
4304
|
stopEvent($event);
|
|
3948
|
-
}} data-rozie-s-d5dcab4c="" /></Solid_js.Show>}{<Solid_js.Show when={columnIsFilterable(
|
|
4305
|
+
}} data-rozie-s-d5dcab4c="" /></Solid_js.Show>}{<Solid_js.Show when={columnIsFilterable(wh().header.column.id)}><span style={{ display: "contents" }} data-rozie-s-d5dcab4c="">
|
|
3949
4306
|
{(_props.filterSlot ?? _props.slots?.["filter"])?.({
|
|
3950
|
-
columnId:
|
|
3951
|
-
value: columnFilterValue(
|
|
3952
|
-
uniqueValues: getFacetedUniqueValues(
|
|
3953
|
-
minMax: getFacetedMinMaxValues(
|
|
4307
|
+
columnId: wh().header.column.id,
|
|
4308
|
+
value: columnFilterValue(wh().header.column.id),
|
|
4309
|
+
uniqueValues: getFacetedUniqueValues(wh().header.column.id),
|
|
4310
|
+
minMax: getFacetedMinMaxValues(wh().header.column.id),
|
|
3954
4311
|
setFilter: setColumnFilter
|
|
3955
4312
|
})}
|
|
3956
4313
|
</span></Solid_js.Show>}</span>}><span style={{ display: "contents" }} data-rozie-s-d5dcab4c="" /></Solid_js.Show>}><span style={{ display: "contents" }} data-rozie-s-d5dcab4c="" /></Solid_js.Show>}</th>}</_solid_primitives_keyed.Key>
|
|
3957
|
-
|
|
4314
|
+
{<Solid_js.Show when={colsWindowed()}><th class={"rdt-col-spacer"} aria-hidden="true" style={(0, _rozie_runtime_solid.parseInlineStyle)("width:" + colPadRight() + "px;padding:0;border:0")} data-rozie-s-d5dcab4c="" /></Solid_js.Show>}</tr></Solid_js.Show>}</thead>
|
|
3958
4315
|
|
|
3959
4316
|
<tbody class={"rdt-tbody"} role="rowgroup" data-rozie-s-d5dcab4c="">
|
|
3960
4317
|
|
|
3961
4318
|
<tr class={"rdt-spacer"} aria-hidden="true" data-rozie-s-d5dcab4c="">
|
|
3962
|
-
<td colSpan={(0, _rozie_runtime_solid.rozieAttr)(
|
|
4319
|
+
<td colSpan={(0, _rozie_runtime_solid.rozieAttr)(windowedColSpan())} style={(0, _rozie_runtime_solid.parseInlineStyle)("height:" + padTop() + "px;padding:0;border:0")} data-rozie-s-d5dcab4c="" />
|
|
3963
4320
|
</tr>
|
|
3964
4321
|
|
|
3965
4322
|
<_solid_primitives_keyed.Key each={windowedRows()} by={(wr) => wr.row.id}>{(wr) => <>
|
|
@@ -3967,7 +4324,8 @@ function DataTable(_props) {
|
|
|
3967
4324
|
"rdt-group-header": rowIsGrouped(wr().row),
|
|
3968
4325
|
"rdt-row-pinned": wr().pinned
|
|
3969
4326
|
})} role="row" data-row={(0, _rozie_runtime_solid.rozieAttr)(wr().vi.index)} aria-rowindex={(0, _rozie_runtime_solid.rozieAttr)(headerRowCount() + wr().vi.index + 1)} data-index={(0, _rozie_runtime_solid.rozieAttr)(wr().vi.index)} data-pinned={(0, _rozie_runtime_solid.rozieAttr)(wr().pinned ? "true" : null)} data-depth={(0, _rozie_runtime_solid.rozieAttr)(wr().row.depth)} data-group-header={(0, _rozie_runtime_solid.rozieAttr)(rowIsGrouped(wr().row) ? wr().row.id : null)} data-group-leaf={(0, _rozie_runtime_solid.rozieAttr)(groupingActive() && !rowIsGrouped(wr().row) ? wr().row.id : null)} aria-expanded={(rowIsGrouped(wr().row) ? !!rowIsExpanded(wr().row) : null) ?? void 0} aria-selected={(local.selectionMode !== "none" ? !!rowIsSelected(wr().row) : null) ?? void 0} aria-level={(0, _rozie_runtime_solid.rozieAttr)(groupingActive() ? wr().row.depth + 1 : null)} data-rozie-s-d5dcab4c="">
|
|
3970
|
-
|
|
4327
|
+
|
|
4328
|
+
{<Solid_js.Show when={colsWindowed()}><td class={"rdt-col-spacer"} aria-hidden="true" style={(0, _rozie_runtime_solid.parseInlineStyle)("width:" + colPadLeft() + "px;padding:0;border:0")} data-rozie-s-d5dcab4c="" /></Solid_js.Show>}<_solid_primitives_keyed.Key each={windowedCells(wr().row)} by={(cell) => cell.id}>{(cell) => <td class={"rdt-td " + (0, _rozie_runtime_solid.rozieClass)({
|
|
3971
4329
|
"rdt-select-td": isSelectColumn(cell().column.id),
|
|
3972
4330
|
"rdt-expander-td": isExpanderColumn(cell().column.id),
|
|
3973
4331
|
"rdt-in-range": inRange(wr().vi.index, colIndexOf(wr().row, cell())),
|
|
@@ -4045,20 +4403,21 @@ function DataTable(_props) {
|
|
|
4045
4403
|
}} data-rozie-s-d5dcab4c="">{(0, _rozie_runtime_solid.rozieDisplay)(rowIsExpanded(wr().row) ? "▾" : "▸")}</button></Solid_js.Show>}</span></Solid_js.Show>}{<Solid_js.Show when={isFillHandleCell(wr().vi.index, colIndexOf(wr().row, cell()))}><span data-fill-handle="" data-testid="fill-handle" aria-hidden="true" class={"rdt-fill-handle"} onPointerDown={($event) => {
|
|
4046
4404
|
onFillHandlePointerDown($event);
|
|
4047
4405
|
}} data-rozie-s-d5dcab4c="" /></Solid_js.Show>}</td>}</_solid_primitives_keyed.Key>
|
|
4048
|
-
|
|
4406
|
+
|
|
4407
|
+
{<Solid_js.Show when={colsWindowed()}><td class={"rdt-col-spacer"} aria-hidden="true" style={(0, _rozie_runtime_solid.parseInlineStyle)("width:" + colPadRight() + "px;padding:0;border:0")} data-rozie-s-d5dcab4c="" /></Solid_js.Show>}</tr>
|
|
4049
4408
|
|
|
4050
4409
|
{<Solid_js.Show when={rowShowsDetail(wr().row)}><tr class={"rdt-detail-row"} role="row" data-detail-row={(0, _rozie_runtime_solid.rozieAttr)(wr().row.id)} data-rozie-s-d5dcab4c="">
|
|
4051
|
-
<td class={"rdt-detail-cell"} colSpan={(0, _rozie_runtime_solid.rozieAttr)(
|
|
4410
|
+
<td class={"rdt-detail-cell"} colSpan={(0, _rozie_runtime_solid.rozieAttr)(windowedColSpan())} data-rozie-s-d5dcab4c="">
|
|
4052
4411
|
{(_props.detailSlot ?? _props.slots?.["detail"])?.({ row: wr().row.original })}
|
|
4053
4412
|
</td>
|
|
4054
4413
|
</tr></Solid_js.Show>}</>}</_solid_primitives_keyed.Key>
|
|
4055
4414
|
|
|
4056
4415
|
<tr class={"rdt-spacer"} aria-hidden="true" data-rozie-s-d5dcab4c="">
|
|
4057
|
-
<td colSpan={(0, _rozie_runtime_solid.rozieAttr)(
|
|
4416
|
+
<td colSpan={(0, _rozie_runtime_solid.rozieAttr)(windowedColSpan())} style={(0, _rozie_runtime_solid.parseInlineStyle)("height:" + padBottom() + "px;padding:0;border:0")} data-rozie-s-d5dcab4c="" />
|
|
4058
4417
|
</tr>
|
|
4059
4418
|
</tbody>
|
|
4060
4419
|
</table>
|
|
4061
|
-
</div></Solid_js.Show>}{<Solid_js.Show when={!
|
|
4420
|
+
</div></Solid_js.Show>}{<Solid_js.Show when={!rowsWindowed()}><div class={"rdt-pagination"} role="group" aria-label="Pagination" data-rozie-s-d5dcab4c="">
|
|
4062
4421
|
<button type="button" class={"rdt-page-btn rdt-page-prev"} disabled={!canPrevPage()} onClick={($event) => {
|
|
4063
4422
|
onPrevPage();
|
|
4064
4423
|
}} data-rozie-s-d5dcab4c="">Prev</button>
|