@rozie-ui/data-table-lit 0.2.7 → 0.3.2
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 +758 -327
- package/dist/index.d.cts +63 -15
- package/dist/index.d.mts +63 -15
- package/dist/index.mjs +758 -327
- package/package.json +2 -2
- package/src/DataTable.ts +1425 -468
- package/src/helpers/columnDefUtils.ts +111 -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
|
@@ -11,6 +11,196 @@ let lit_directives_repeat_js = require("lit/directives/repeat.js");
|
|
|
11
11
|
require("@rozie-ui/popover-lit");
|
|
12
12
|
let _tanstack_table_core = require("@tanstack/table-core");
|
|
13
13
|
let _tanstack_virtual_core = require("@tanstack/virtual-core");
|
|
14
|
+
//#region src/helpers/columnDefUtils.ts
|
|
15
|
+
const isSafeKey = (k) => k !== "__proto__" && k !== "constructor" && k !== "prototype";
|
|
16
|
+
const wrapAggregationFn = (fn) => {
|
|
17
|
+
if (typeof fn === "string") return fn;
|
|
18
|
+
if (typeof fn !== "function") return void 0;
|
|
19
|
+
return (columnId, leafRows, childRows) => {
|
|
20
|
+
try {
|
|
21
|
+
return fn(columnId, leafRows, childRows);
|
|
22
|
+
} catch (err) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
const collectNestedDefs = (list, out) => {
|
|
28
|
+
if (!Array.isArray(list)) return;
|
|
29
|
+
for (const d of list) {
|
|
30
|
+
if (!d || d.id == null) continue;
|
|
31
|
+
const id = String(d.id);
|
|
32
|
+
if (!(id in out)) out[id] = d;
|
|
33
|
+
if (Array.isArray(d.columns)) collectNestedDefs(d.columns, out);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const indexDefsById = (defs) => {
|
|
37
|
+
const out = Object.create(null);
|
|
38
|
+
if (!Array.isArray(defs)) return out;
|
|
39
|
+
for (const d of defs) {
|
|
40
|
+
if (!d || d.id == null) continue;
|
|
41
|
+
out[String(d.id)] = d;
|
|
42
|
+
}
|
|
43
|
+
for (const d of defs) if (d && Array.isArray(d.columns)) collectNestedDefs(d.columns, out);
|
|
44
|
+
return out;
|
|
45
|
+
};
|
|
46
|
+
const collectGroupableLeafDefs = (defs) => {
|
|
47
|
+
const out = [];
|
|
48
|
+
if (!Array.isArray(defs)) return out;
|
|
49
|
+
for (const d of defs) {
|
|
50
|
+
if (!d) continue;
|
|
51
|
+
if (Array.isArray(d.columns)) {
|
|
52
|
+
out.push(...collectGroupableLeafDefs(d.columns));
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
if (d.groupable === false) continue;
|
|
56
|
+
out.push(d);
|
|
57
|
+
}
|
|
58
|
+
return out;
|
|
59
|
+
};
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region src/helpers/indexMath.ts
|
|
62
|
+
const clamp = (v, lo, hi) => v < lo ? lo : v > hi ? hi : v;
|
|
63
|
+
const focusables = (cellEl) => {
|
|
64
|
+
if (!cellEl || !cellEl.querySelectorAll) return [];
|
|
65
|
+
return Array.prototype.slice.call(cellEl.querySelectorAll("button,[href],input,select,textarea,[tabindex]:not([tabindex=\"-1\"])")).filter((n) => !n.disabled);
|
|
66
|
+
};
|
|
67
|
+
const applyUpdater = (updater, current) => typeof updater === "function" ? updater(current) : updater;
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region src/helpers/tsvGrid.ts
|
|
70
|
+
const escapeTsvField = (s) => {
|
|
71
|
+
if (s.indexOf(" ") >= 0 || s.indexOf("\n") >= 0 || s.indexOf("\r") >= 0 || s.indexOf("\"") >= 0) return "\"" + s.replace(/"/g, "\"\"") + "\"";
|
|
72
|
+
return s;
|
|
73
|
+
};
|
|
74
|
+
const parseTsv = (text) => {
|
|
75
|
+
const str = text != null ? String(text) : "";
|
|
76
|
+
if (str === "" || str.length > 2e6) return [];
|
|
77
|
+
const rows = [];
|
|
78
|
+
let row = [];
|
|
79
|
+
let field = "";
|
|
80
|
+
let inQuotes = false;
|
|
81
|
+
let i = 0;
|
|
82
|
+
const n = str.length;
|
|
83
|
+
while (i < n) {
|
|
84
|
+
const ch = str[i];
|
|
85
|
+
if (inQuotes) {
|
|
86
|
+
if (ch === "\"") {
|
|
87
|
+
if (i + 1 < n && str[i + 1] === "\"") {
|
|
88
|
+
field = field + "\"";
|
|
89
|
+
i = i + 2;
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
inQuotes = false;
|
|
93
|
+
i = i + 1;
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
field = field + ch;
|
|
97
|
+
i = i + 1;
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
if (ch === "\"" && field === "") {
|
|
101
|
+
inQuotes = true;
|
|
102
|
+
i = i + 1;
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
if (ch === " ") {
|
|
106
|
+
row.push(field);
|
|
107
|
+
field = "";
|
|
108
|
+
i = i + 1;
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
if (ch === "\r") {
|
|
112
|
+
if (i + 1 < n && str[i + 1] === "\n") i = i + 1;
|
|
113
|
+
row.push(field);
|
|
114
|
+
field = "";
|
|
115
|
+
rows.push(row);
|
|
116
|
+
row = [];
|
|
117
|
+
i = i + 1;
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
if (ch === "\n") {
|
|
121
|
+
row.push(field);
|
|
122
|
+
field = "";
|
|
123
|
+
rows.push(row);
|
|
124
|
+
row = [];
|
|
125
|
+
i = i + 1;
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
field = field + ch;
|
|
129
|
+
i = i + 1;
|
|
130
|
+
}
|
|
131
|
+
row.push(field);
|
|
132
|
+
rows.push(row);
|
|
133
|
+
if (rows.length > 1) {
|
|
134
|
+
const last = rows[rows.length - 1];
|
|
135
|
+
if (last.length === 1 && last[0] === "") rows.pop();
|
|
136
|
+
}
|
|
137
|
+
return rows;
|
|
138
|
+
};
|
|
139
|
+
const tileGridToBox = (grid, box) => {
|
|
140
|
+
const srcRows = grid.length;
|
|
141
|
+
let srcCols = 0;
|
|
142
|
+
for (let i = 0; i < srcRows; i++) {
|
|
143
|
+
const w = grid[i] && grid[i].length ? grid[i].length : 0;
|
|
144
|
+
if (w > srcCols) srcCols = w;
|
|
145
|
+
}
|
|
146
|
+
if (srcRows <= 0 || srcCols <= 0) return grid;
|
|
147
|
+
const boxRows = box.r1 - box.r0 + 1;
|
|
148
|
+
const boxCols = box.c1 - box.c0 + 1;
|
|
149
|
+
const rows = boxRows > srcRows ? boxRows : srcRows;
|
|
150
|
+
const cols = boxCols > srcCols ? boxCols : srcCols;
|
|
151
|
+
const out = [];
|
|
152
|
+
for (let r = 0; r < rows; r++) {
|
|
153
|
+
const srcLine = grid[r % srcRows] || [];
|
|
154
|
+
const line = [];
|
|
155
|
+
for (let c = 0; c < cols; c++) {
|
|
156
|
+
const v = srcLine[c % srcCols];
|
|
157
|
+
line.push(v != null ? v : "");
|
|
158
|
+
}
|
|
159
|
+
out.push(line);
|
|
160
|
+
}
|
|
161
|
+
return out;
|
|
162
|
+
};
|
|
163
|
+
const tileIndex = (i, lo, hi) => {
|
|
164
|
+
const span = hi - lo + 1;
|
|
165
|
+
if (span <= 1) return lo;
|
|
166
|
+
let k = (i - lo) % span;
|
|
167
|
+
if (k < 0) k = k + span;
|
|
168
|
+
return lo + k;
|
|
169
|
+
};
|
|
170
|
+
//#endregion
|
|
171
|
+
//#region src/helpers/rowValueUtils.ts
|
|
172
|
+
const replaceRowValue = (rows, rowIndex, field, value) => {
|
|
173
|
+
const src = rows || [];
|
|
174
|
+
const out = [];
|
|
175
|
+
for (let i = 0; i < src.length; i++) if (i === rowIndex) out.push({
|
|
176
|
+
...src[i] || {},
|
|
177
|
+
[field]: value
|
|
178
|
+
});
|
|
179
|
+
else out.push(src[i]);
|
|
180
|
+
return out;
|
|
181
|
+
};
|
|
182
|
+
const replaceRowValues = (rows, rowIndex, fieldValues) => {
|
|
183
|
+
const src = rows || [];
|
|
184
|
+
const fv = fieldValues || {};
|
|
185
|
+
const out = [];
|
|
186
|
+
for (let i = 0; i < src.length; i++) if (i === rowIndex) out.push({
|
|
187
|
+
...src[i] || {},
|
|
188
|
+
...fv
|
|
189
|
+
});
|
|
190
|
+
else out.push(src[i]);
|
|
191
|
+
return out;
|
|
192
|
+
};
|
|
193
|
+
const indexOfRowIn = (rows, rowOriginal, rowId) => {
|
|
194
|
+
const list = rows || [];
|
|
195
|
+
for (let i = 0; i < list.length; i++) {
|
|
196
|
+
const r = list[i];
|
|
197
|
+
if (!r) continue;
|
|
198
|
+
if (rowId != null && r.id === rowId) return i;
|
|
199
|
+
if (rowOriginal != null && r.original === rowOriginal) return i;
|
|
200
|
+
}
|
|
201
|
+
return -1;
|
|
202
|
+
};
|
|
203
|
+
//#endregion
|
|
14
204
|
//#region \0@oxc-project+runtime@0.127.0/helpers/decorate.js
|
|
15
205
|
function __decorate(decorators, target, key, desc) {
|
|
16
206
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -134,6 +324,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
134
324
|
this.undoLimit = 100;
|
|
135
325
|
this.virtual = false;
|
|
136
326
|
this.estimateRowHeight = 40;
|
|
327
|
+
this.autoMeasure = false;
|
|
137
328
|
this.maxHeight = "";
|
|
138
329
|
this._dataDefault = (0, _lit_labs_preact_signals.signal)([]);
|
|
139
330
|
this._sortingDefault = (0, _lit_labs_preact_signals.signal)([]);
|
|
@@ -221,7 +412,11 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
221
412
|
this.virtualizer = null;
|
|
222
413
|
this.virtualizerCleanup = null;
|
|
223
414
|
this.gridScrollEl = null;
|
|
415
|
+
this.colVirtualizer = null;
|
|
416
|
+
this.colVirtualizerCleanup = null;
|
|
224
417
|
this.remeasurePending = false;
|
|
418
|
+
this.remeasureRaf = null;
|
|
419
|
+
this.remeasureDisposed = false;
|
|
225
420
|
this.GRID_PAGE_STEP = 10;
|
|
226
421
|
this.gridRoot = null;
|
|
227
422
|
this.programmatic = 0;
|
|
@@ -259,18 +454,6 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
259
454
|
columnSizingInfo: this._columnSizingInfo.value
|
|
260
455
|
});
|
|
261
456
|
this.currentData = () => this.data != null ? this.data : this._dataDefault.value;
|
|
262
|
-
this.isSafeKey = (k) => k !== "__proto__" && k !== "constructor" && k !== "prototype";
|
|
263
|
-
this.wrapAggregationFn = (fn) => {
|
|
264
|
-
if (typeof fn === "string") return fn;
|
|
265
|
-
if (typeof fn !== "function") return void 0;
|
|
266
|
-
return (columnId, leafRows, childRows) => {
|
|
267
|
-
try {
|
|
268
|
-
return fn(columnId, leafRows, childRows);
|
|
269
|
-
} catch (err) {
|
|
270
|
-
return;
|
|
271
|
-
}
|
|
272
|
-
};
|
|
273
|
-
};
|
|
274
457
|
this.buildConfigDef = (c) => {
|
|
275
458
|
if (!c) return null;
|
|
276
459
|
if (Array.isArray(c.columns)) {
|
|
@@ -284,7 +467,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
284
467
|
if (gid == null) gid = c.header != null ? "__grp_" + kids.map((k) => k.id).join("_") : null;
|
|
285
468
|
if (gid == null) return null;
|
|
286
469
|
const id = String(gid);
|
|
287
|
-
if (!
|
|
470
|
+
if (!isSafeKey(id)) return null;
|
|
288
471
|
return {
|
|
289
472
|
id,
|
|
290
473
|
header: c.header != null ? c.header : id,
|
|
@@ -294,7 +477,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
294
477
|
const rawId = c.id != null ? c.id : c.field;
|
|
295
478
|
if (rawId == null) return null;
|
|
296
479
|
const id = String(rawId);
|
|
297
|
-
if (!
|
|
480
|
+
if (!isSafeKey(id)) return null;
|
|
298
481
|
return {
|
|
299
482
|
id,
|
|
300
483
|
accessorKey: c.field != null ? c.field : id,
|
|
@@ -304,7 +487,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
304
487
|
filterable: c.filterable === true,
|
|
305
488
|
expandable: c.expandable === true,
|
|
306
489
|
groupable: c.groupable !== false,
|
|
307
|
-
aggregationFn:
|
|
490
|
+
aggregationFn: wrapAggregationFn(c.aggregationFn),
|
|
308
491
|
pinned: c.pinned != null ? c.pinned : "",
|
|
309
492
|
width: c.width != null ? c.width : "",
|
|
310
493
|
meta: {
|
|
@@ -315,10 +498,16 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
315
498
|
}
|
|
316
499
|
};
|
|
317
500
|
};
|
|
501
|
+
this.columnDefsCache = null;
|
|
502
|
+
this.columnDefsCacheColumnsRef = void 0;
|
|
503
|
+
this.columnDefsCacheColRegRef = void 0;
|
|
504
|
+
this.columnDefsIndexCache = null;
|
|
318
505
|
this.columnDefs = () => {
|
|
506
|
+
const cfg = this.columns || [];
|
|
507
|
+
const reg = this._colReg.value || {};
|
|
508
|
+
if (this.columnDefsCache && this.columns === this.columnDefsCacheColumnsRef && this._colReg.value === this.columnDefsCacheColRegRef) return this.columnDefsCache;
|
|
319
509
|
const byId = Object.create(null);
|
|
320
510
|
const order = [];
|
|
321
|
-
const cfg = this.columns || [];
|
|
322
511
|
for (const c of cfg) {
|
|
323
512
|
const def = this.buildConfigDef(c);
|
|
324
513
|
if (!def) continue;
|
|
@@ -326,9 +515,8 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
326
515
|
if (!(id in byId)) order.push(id);
|
|
327
516
|
byId[id] = def;
|
|
328
517
|
}
|
|
329
|
-
const reg = this._colReg.value || {};
|
|
330
518
|
for (const id in reg) {
|
|
331
|
-
if (!
|
|
519
|
+
if (!isSafeKey(id)) continue;
|
|
332
520
|
const spec = reg[id];
|
|
333
521
|
if (!spec) continue;
|
|
334
522
|
if (!(id in byId)) order.push(id);
|
|
@@ -341,7 +529,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
341
529
|
filterable: spec.filterable === true,
|
|
342
530
|
expandable: spec.expandable === true,
|
|
343
531
|
groupable: spec.groupable !== false,
|
|
344
|
-
aggregationFn:
|
|
532
|
+
aggregationFn: wrapAggregationFn(spec.aggregationFn),
|
|
345
533
|
pinned: spec.pinned != null ? spec.pinned : "",
|
|
346
534
|
width: spec.width != null ? spec.width : "",
|
|
347
535
|
meta: {
|
|
@@ -354,8 +542,16 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
354
542
|
}
|
|
355
543
|
const out = [];
|
|
356
544
|
for (const id of order) if (byId[id]) out.push(byId[id]);
|
|
545
|
+
this.columnDefsCache = out;
|
|
546
|
+
this.columnDefsCacheColumnsRef = this.columns;
|
|
547
|
+
this.columnDefsCacheColRegRef = this._colReg.value;
|
|
548
|
+
this.columnDefsIndexCache = indexDefsById(out);
|
|
357
549
|
return out;
|
|
358
550
|
};
|
|
551
|
+
this.defIndex = () => {
|
|
552
|
+
this.columnDefs();
|
|
553
|
+
return this.columnDefsIndexCache || Object.create(null);
|
|
554
|
+
};
|
|
359
555
|
this.SELECT_COL_ID = "__rdt_select";
|
|
360
556
|
this.EXPANDER_COL_ID = "__rdt_expander";
|
|
361
557
|
this.selectionEnabled = () => this.selectionMode === "single" || this.selectionMode === "multiple";
|
|
@@ -396,7 +592,6 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
396
592
|
}));
|
|
397
593
|
this.programmatic--;
|
|
398
594
|
};
|
|
399
|
-
this.applyUpdater = (updater, current) => typeof updater === "function" ? updater(current) : updater;
|
|
400
595
|
this.writeExpanded = (next) => {
|
|
401
596
|
if (this.programmatic) return;
|
|
402
597
|
this.programmatic++;
|
|
@@ -608,48 +803,101 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
608
803
|
};
|
|
609
804
|
this.refreshRowModel = null;
|
|
610
805
|
this.onSortingChangeCb = (updater) => {
|
|
611
|
-
this.writeSorting(
|
|
806
|
+
this.writeSorting(applyUpdater(updater, this.currentState().sorting));
|
|
612
807
|
};
|
|
613
808
|
this.onExpandedChangeCb = (updater) => {
|
|
614
|
-
this.writeExpanded(
|
|
809
|
+
this.writeExpanded(applyUpdater(updater, this.currentState().expanded));
|
|
615
810
|
};
|
|
616
811
|
this.onGroupingChangeCb = (updater) => {
|
|
617
|
-
this.writeGrouping(
|
|
812
|
+
this.writeGrouping(applyUpdater(updater, this.currentState().grouping));
|
|
618
813
|
};
|
|
619
814
|
this.onGlobalFilterChangeCb = (updater) => {
|
|
620
|
-
this.writeGlobalFilter(
|
|
815
|
+
this.writeGlobalFilter(applyUpdater(updater, this.currentState().globalFilter));
|
|
621
816
|
};
|
|
622
817
|
this.onColumnFiltersChangeCb = (updater) => {
|
|
623
|
-
this.writeColumnFilters(
|
|
818
|
+
this.writeColumnFilters(applyUpdater(updater, this.currentState().columnFilters));
|
|
624
819
|
};
|
|
625
820
|
this.onPaginationChangeCb = (updater) => {
|
|
626
|
-
this.writePagination(
|
|
821
|
+
this.writePagination(applyUpdater(updater, this.currentState().pagination));
|
|
627
822
|
};
|
|
628
823
|
this.onRowSelectionChangeCb = (updater) => {
|
|
629
|
-
this.writeRowSelection(
|
|
824
|
+
this.writeRowSelection(applyUpdater(updater, this.currentState().rowSelection));
|
|
630
825
|
};
|
|
631
826
|
this.onColumnVisibilityChangeCb = (updater) => {
|
|
632
|
-
this.writeColumnVisibility(
|
|
827
|
+
this.writeColumnVisibility(applyUpdater(updater, this.currentState().columnVisibility));
|
|
633
828
|
};
|
|
634
829
|
this.onColumnSizingChangeCb = (updater) => {
|
|
635
|
-
this.writeColumnSizing(
|
|
830
|
+
this.writeColumnSizing(applyUpdater(updater, this.currentState().columnSizing));
|
|
636
831
|
};
|
|
637
832
|
this.onColumnOrderChangeCb = (updater) => {
|
|
638
|
-
this.writeColumnOrder(
|
|
833
|
+
this.writeColumnOrder(applyUpdater(updater, this.currentState().columnOrder));
|
|
639
834
|
};
|
|
640
835
|
this.onColumnPinningChangeCb = (updater) => {
|
|
641
|
-
this.writeColumnPinning(
|
|
836
|
+
this.writeColumnPinning(applyUpdater(updater, this.currentState().columnPinning));
|
|
642
837
|
};
|
|
643
838
|
this.onColumnSizingInfoChangeCb = (updater) => {
|
|
644
|
-
const next =
|
|
839
|
+
const next = applyUpdater(updater, this._columnSizingInfo.value);
|
|
645
840
|
this._columnSizingInfo.value = next != null ? next : this._columnSizingInfo.value;
|
|
646
841
|
};
|
|
842
|
+
this.resolveVirtual = () => {
|
|
843
|
+
const v = this.virtual;
|
|
844
|
+
if (typeof v === "string") {
|
|
845
|
+
if (v === "rows") return "rows";
|
|
846
|
+
if (v === "columns") return "columns";
|
|
847
|
+
if (v === "both") return "both";
|
|
848
|
+
return "off";
|
|
849
|
+
}
|
|
850
|
+
return v === true ? "rows" : "off";
|
|
851
|
+
};
|
|
852
|
+
this.rowsWindowed = () => {
|
|
853
|
+
const s = this.resolveVirtual();
|
|
854
|
+
return s === "rows" || s === "both";
|
|
855
|
+
};
|
|
856
|
+
this.colsWindowed = () => {
|
|
857
|
+
const s = this.resolveVirtual();
|
|
858
|
+
return s === "columns" || s === "both";
|
|
859
|
+
};
|
|
860
|
+
this.isWindowed = () => this.rowsWindowed() || this.colsWindowed();
|
|
861
|
+
this.autoMeasureOn = () => this.autoMeasure === true;
|
|
862
|
+
this.columnCount = () => this.visibleColCount();
|
|
863
|
+
this.columnSize = (i) => {
|
|
864
|
+
if (!this.table || !this.table.getVisibleLeafColumns) return 150;
|
|
865
|
+
const c = this.table.getVisibleLeafColumns()[i];
|
|
866
|
+
return c && typeof c.getSize === "function" ? c.getSize() : 150;
|
|
867
|
+
};
|
|
868
|
+
this.forcedColumns = () => {
|
|
869
|
+
if (!this.colsWindowed()) return [];
|
|
870
|
+
const out = [];
|
|
871
|
+
if (this.table && this.table.getVisibleLeafColumns) {
|
|
872
|
+
const cols = this.table.getVisibleLeafColumns();
|
|
873
|
+
for (let i = 0; i < cols.length; i++) {
|
|
874
|
+
const c = cols[i];
|
|
875
|
+
if (c && c.getIsPinned && c.getIsPinned()) out.push(i);
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
if (!this._activeIsHeader.value && this._activeColIndex.value >= 0 && out.indexOf(this._activeColIndex.value) === -1) out.push(this._activeColIndex.value);
|
|
879
|
+
if (this._editingRow.value >= 0 && this._editingCol.value >= 0 && out.indexOf(this._editingCol.value) === -1) out.push(this._editingCol.value);
|
|
880
|
+
return out;
|
|
881
|
+
};
|
|
882
|
+
this.windowedCells = (row) => {
|
|
883
|
+
this._windowVer.value;
|
|
884
|
+
const cells = this.visibleCellsFor(row);
|
|
885
|
+
if (!this.colsWindowed()) return cells;
|
|
886
|
+
const idx = this.windowedColIndices();
|
|
887
|
+
const out = [];
|
|
888
|
+
for (let i = 0; i < idx.length; i++) {
|
|
889
|
+
const cell = cells[idx[i]];
|
|
890
|
+
if (cell) out.push(cell);
|
|
891
|
+
}
|
|
892
|
+
return out;
|
|
893
|
+
};
|
|
647
894
|
this.windowSource = () => {
|
|
648
895
|
if (!this.table) return [];
|
|
649
|
-
if (this.
|
|
896
|
+
if (this.rowsWindowed()) return this.table.getPrePaginationRowModel().rows;
|
|
650
897
|
return this.table.getRowModel().rows;
|
|
651
898
|
};
|
|
652
899
|
this.scheduleRemeasure = () => {
|
|
900
|
+
if (this.remeasureDisposed) return;
|
|
653
901
|
if (this.remeasurePending) return;
|
|
654
902
|
this.remeasurePending = true;
|
|
655
903
|
let ranMicro = false;
|
|
@@ -657,6 +905,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
657
905
|
this.remeasureWindow();
|
|
658
906
|
};
|
|
659
907
|
const rafPass = () => {
|
|
908
|
+
this.remeasureRaf = null;
|
|
660
909
|
this.remeasurePending = false;
|
|
661
910
|
this.remeasureWindow();
|
|
662
911
|
};
|
|
@@ -664,9 +913,18 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
664
913
|
ranMicro = true;
|
|
665
914
|
queueMicrotask(microPass);
|
|
666
915
|
}
|
|
667
|
-
if (typeof requestAnimationFrame === "function") requestAnimationFrame(rafPass);
|
|
916
|
+
if (typeof requestAnimationFrame === "function") this.remeasureRaf = requestAnimationFrame(rafPass);
|
|
668
917
|
else if (ranMicro) this.remeasurePending = false;
|
|
669
|
-
else setTimeout(rafPass, 0);
|
|
918
|
+
else this.remeasureRaf = setTimeout(rafPass, 0);
|
|
919
|
+
};
|
|
920
|
+
this.teardownRemeasure = () => {
|
|
921
|
+
this.remeasureDisposed = true;
|
|
922
|
+
if (this.remeasureRaf != null) {
|
|
923
|
+
if (typeof requestAnimationFrame === "function") cancelAnimationFrame(this.remeasureRaf);
|
|
924
|
+
else clearTimeout(this.remeasureRaf);
|
|
925
|
+
this.remeasureRaf = null;
|
|
926
|
+
}
|
|
927
|
+
this.remeasurePending = false;
|
|
670
928
|
};
|
|
671
929
|
this.pinnedEditIndex = () => {
|
|
672
930
|
if (this._editingRow.value >= 0) return this._editingRow.value;
|
|
@@ -679,19 +937,123 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
679
937
|
return ms && ms[pin] ? ms[pin] : null;
|
|
680
938
|
};
|
|
681
939
|
this.remeasureWindow = () => {
|
|
940
|
+
if (this.remeasureDisposed) return;
|
|
682
941
|
if (!this.virtualizer || !this.gridRoot) return;
|
|
683
942
|
if (this.virtualizer.scrollState) return;
|
|
684
943
|
const trs = this.gridRoot.querySelectorAll("tbody.rdt-tbody > tr[data-index]");
|
|
685
944
|
for (const tr of trs) this.virtualizer.measureElement(tr);
|
|
945
|
+
if (this.afterRowRemeasure) this.afterRowRemeasure();
|
|
686
946
|
};
|
|
687
947
|
this.virtualItemKey = (i) => {
|
|
688
948
|
const src = this.windowSource();
|
|
689
949
|
return src && src[i] ? src[i].id : void 0;
|
|
690
950
|
};
|
|
951
|
+
this.COL_OVERSCAN = 3;
|
|
952
|
+
this.colRtlObserver = null;
|
|
953
|
+
this.colRtlObserverEl = null;
|
|
954
|
+
this.isColRtl = () => {
|
|
955
|
+
if (!this.gridScrollEl || typeof getComputedStyle !== "function") return false;
|
|
956
|
+
return getComputedStyle(this.gridScrollEl).direction === "rtl";
|
|
957
|
+
};
|
|
958
|
+
this.ensureColRtlWatch = () => {
|
|
959
|
+
if (!this.gridScrollEl || this.colRtlObserverEl === this.gridScrollEl || typeof MutationObserver !== "function") return;
|
|
960
|
+
if (this.colRtlObserver) this.colRtlObserver.disconnect();
|
|
961
|
+
this.colRtlObserver = new MutationObserver(() => {
|
|
962
|
+
if (this.colVirtualizer) this.colVirtualizer.setOptions({
|
|
963
|
+
...this.colVirtualizer.options,
|
|
964
|
+
isRtl: this.isColRtl()
|
|
965
|
+
});
|
|
966
|
+
});
|
|
967
|
+
this.colRtlObserver.observe(this.gridScrollEl, {
|
|
968
|
+
attributes: true,
|
|
969
|
+
attributeFilter: ["dir"]
|
|
970
|
+
});
|
|
971
|
+
this.colRtlObserverEl = this.gridScrollEl;
|
|
972
|
+
};
|
|
973
|
+
this.teardownColRtlWatch = () => {
|
|
974
|
+
if (this.colRtlObserver) this.colRtlObserver.disconnect();
|
|
975
|
+
this.colRtlObserver = null;
|
|
976
|
+
this.colRtlObserverEl = null;
|
|
977
|
+
};
|
|
978
|
+
this.columnVirtualizerOptions = () => {
|
|
979
|
+
this.ensureColRtlWatch();
|
|
980
|
+
return {
|
|
981
|
+
count: this.columnCount(),
|
|
982
|
+
getScrollElement: () => this.gridScrollEl,
|
|
983
|
+
estimateSize: (i) => this.columnSize(i),
|
|
984
|
+
horizontal: true,
|
|
985
|
+
isRtl: this.isColRtl(),
|
|
986
|
+
observeElementRect: _tanstack_virtual_core.observeElementRect,
|
|
987
|
+
observeElementOffset: _tanstack_virtual_core.observeElementOffset,
|
|
988
|
+
scrollToFn: _tanstack_virtual_core.elementScroll,
|
|
989
|
+
measureElement: _tanstack_virtual_core.measureElement,
|
|
990
|
+
overscan: this.COL_OVERSCAN,
|
|
991
|
+
onChange: () => {
|
|
992
|
+
this._windowVer.value = this._windowVer.value + 1;
|
|
993
|
+
}
|
|
994
|
+
};
|
|
995
|
+
};
|
|
996
|
+
this.measuredRowTotal = 0;
|
|
997
|
+
this.measuredRowCount = 0;
|
|
998
|
+
this.lastFedRowEstimate = 0;
|
|
999
|
+
this.foldedRowHeights = {};
|
|
1000
|
+
this.windowVerBumpPending = false;
|
|
1001
|
+
this.bumpWindowVer = () => {
|
|
1002
|
+
if (this.windowVerBumpPending) return;
|
|
1003
|
+
this.windowVerBumpPending = true;
|
|
1004
|
+
const flush = () => {
|
|
1005
|
+
this.windowVerBumpPending = false;
|
|
1006
|
+
this._windowVer.value = this._windowVer.value + 1;
|
|
1007
|
+
};
|
|
1008
|
+
if (typeof queueMicrotask !== "undefined") queueMicrotask(flush);
|
|
1009
|
+
else setTimeout(flush, 0);
|
|
1010
|
+
};
|
|
1011
|
+
this.ESTIMATE_REFEED_DELTA_PX = 4;
|
|
1012
|
+
this.estimateRowSize = (i) => {
|
|
1013
|
+
if (!this.autoMeasureOn()) return this.estimateRowHeight;
|
|
1014
|
+
if (this.measuredRowCount === 0) return this.estimateRowHeight;
|
|
1015
|
+
return Math.round(this.measuredRowTotal / this.measuredRowCount);
|
|
1016
|
+
};
|
|
1017
|
+
this.foldMeasuredRow = (index, height) => {
|
|
1018
|
+
const prev = this.foldedRowHeights[index];
|
|
1019
|
+
if (prev === height) return;
|
|
1020
|
+
if (prev == null) {
|
|
1021
|
+
this.measuredRowTotal = this.measuredRowTotal + height;
|
|
1022
|
+
this.measuredRowCount = this.measuredRowCount + 1;
|
|
1023
|
+
} else this.measuredRowTotal = this.measuredRowTotal - prev + height;
|
|
1024
|
+
this.foldedRowHeights[index] = height;
|
|
1025
|
+
};
|
|
1026
|
+
this.refineRowEstimate = () => {
|
|
1027
|
+
if (!this.autoMeasureOn() || !this.virtualizer) return;
|
|
1028
|
+
const items = this.virtualizer.getVirtualItems();
|
|
1029
|
+
const measurements = this.virtualizer.getMeasurements();
|
|
1030
|
+
for (let i = 0; i < items.length; i++) {
|
|
1031
|
+
const idx = items[i].index;
|
|
1032
|
+
const m = measurements && measurements[idx];
|
|
1033
|
+
if (m) this.foldMeasuredRow(idx, m.size);
|
|
1034
|
+
}
|
|
1035
|
+
if (this.virtualizer.scrollState) return;
|
|
1036
|
+
const est = this.estimateRowSize(0);
|
|
1037
|
+
if (Math.abs(est - this.lastFedRowEstimate) < this.ESTIMATE_REFEED_DELTA_PX) return;
|
|
1038
|
+
const anchorIndex = items.length ? items[0].index : -1;
|
|
1039
|
+
const anchorStart = items.length ? items[0].start : 0;
|
|
1040
|
+
this.virtualizer.setOptions(this.virtualizerOptions());
|
|
1041
|
+
this.virtualizer._willUpdate();
|
|
1042
|
+
this.lastFedRowEstimate = est;
|
|
1043
|
+
if (anchorIndex >= 0 && this.gridScrollEl) {
|
|
1044
|
+
const freshMeasurements = this.virtualizer.getMeasurements();
|
|
1045
|
+
const fresh = freshMeasurements && freshMeasurements[anchorIndex];
|
|
1046
|
+
if (fresh) {
|
|
1047
|
+
const delta = fresh.start - anchorStart;
|
|
1048
|
+
if (delta !== 0) this.gridScrollEl.scrollTop = this.gridScrollEl.scrollTop + delta;
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
this.bumpWindowVer();
|
|
1052
|
+
};
|
|
691
1053
|
this.virtualizerOptions = () => ({
|
|
692
1054
|
count: this.windowSource().length,
|
|
693
1055
|
getScrollElement: () => this.gridScrollEl,
|
|
694
|
-
estimateSize: () => this.
|
|
1056
|
+
estimateSize: (i) => this.estimateRowSize(i),
|
|
695
1057
|
observeElementRect: _tanstack_virtual_core.observeElementRect,
|
|
696
1058
|
observeElementOffset: _tanstack_virtual_core.observeElementOffset,
|
|
697
1059
|
scrollToFn: _tanstack_virtual_core.elementScroll,
|
|
@@ -699,7 +1061,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
699
1061
|
overscan: 8,
|
|
700
1062
|
getItemKey: this.virtualItemKey,
|
|
701
1063
|
onChange: () => {
|
|
702
|
-
this.
|
|
1064
|
+
this.bumpWindowVer();
|
|
703
1065
|
this.scheduleRemeasure();
|
|
704
1066
|
}
|
|
705
1067
|
});
|
|
@@ -708,8 +1070,8 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
708
1070
|
this._windowVer.value;
|
|
709
1071
|
this._editVer.value;
|
|
710
1072
|
if (!this.virtualizer) {
|
|
711
|
-
if (!this.
|
|
712
|
-
vi:
|
|
1073
|
+
if (!this.rowsWindowed()) return (this._rows.value || []).map((r, i) => ({
|
|
1074
|
+
vi: { index: i },
|
|
713
1075
|
row: r
|
|
714
1076
|
}));
|
|
715
1077
|
return [];
|
|
@@ -745,7 +1107,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
745
1107
|
this.padTop = () => {
|
|
746
1108
|
this._windowVer.value;
|
|
747
1109
|
this._editVer.value;
|
|
748
|
-
if (!this.
|
|
1110
|
+
if (!this.rowsWindowed() || !this.virtualizer) return 0;
|
|
749
1111
|
const items = this.virtualizer.getVirtualItems();
|
|
750
1112
|
let pad = items.length ? items[0].start : 0;
|
|
751
1113
|
const pin = this.pinnedEditIndex();
|
|
@@ -759,7 +1121,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
759
1121
|
this.padBottom = () => {
|
|
760
1122
|
this._windowVer.value;
|
|
761
1123
|
this._editVer.value;
|
|
762
|
-
if (!this.
|
|
1124
|
+
if (!this.rowsWindowed() || !this.virtualizer) return 0;
|
|
763
1125
|
const items = this.virtualizer.getVirtualItems();
|
|
764
1126
|
if (!items.length) return 0;
|
|
765
1127
|
let pad = this.virtualizer.getTotalSize() - items[items.length - 1].end;
|
|
@@ -780,11 +1142,59 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
780
1142
|
return false;
|
|
781
1143
|
};
|
|
782
1144
|
this.rowIsOutsideWindow = (r) => {
|
|
783
|
-
if (!this.
|
|
1145
|
+
if (!this.rowsWindowed() || !this.virtualizer) return false;
|
|
784
1146
|
const items = this.virtualizer.getVirtualItems();
|
|
785
1147
|
for (const it of items) if (it.index === r) return false;
|
|
786
1148
|
return true;
|
|
787
1149
|
};
|
|
1150
|
+
this.windowedColIndices = () => {
|
|
1151
|
+
this._windowVer.value;
|
|
1152
|
+
this._editVer.value;
|
|
1153
|
+
if (!this.colsWindowed()) {
|
|
1154
|
+
const n = this.columnCount();
|
|
1155
|
+
const out = [];
|
|
1156
|
+
for (let i = 0; i < n; i++) out.push(i);
|
|
1157
|
+
return out;
|
|
1158
|
+
}
|
|
1159
|
+
if (!this.colVirtualizer) return [];
|
|
1160
|
+
const idx = this.colVirtualizer.getVirtualItems().map((it) => it.index);
|
|
1161
|
+
const forced = this.forcedColumns();
|
|
1162
|
+
for (let i = 0; i < forced.length; i++) if (idx.indexOf(forced[i]) === -1) idx.push(forced[i]);
|
|
1163
|
+
idx.sort((a, b) => a - b);
|
|
1164
|
+
return idx;
|
|
1165
|
+
};
|
|
1166
|
+
this.colPadLeft = () => {
|
|
1167
|
+
this._windowVer.value;
|
|
1168
|
+
this._editVer.value;
|
|
1169
|
+
if (!this.colsWindowed() || !this.colVirtualizer) return 0;
|
|
1170
|
+
const items = this.colVirtualizer.getVirtualItems();
|
|
1171
|
+
let pad = items.length ? items[0].start : 0;
|
|
1172
|
+
if (items.length) {
|
|
1173
|
+
const firstIdx = items[0].index;
|
|
1174
|
+
const forced = this.forcedColumns();
|
|
1175
|
+
for (let i = 0; i < forced.length; i++) if (forced[i] < firstIdx) pad = pad - this.columnSize(forced[i]);
|
|
1176
|
+
}
|
|
1177
|
+
return pad < 0 ? 0 : pad;
|
|
1178
|
+
};
|
|
1179
|
+
this.colPadRight = () => {
|
|
1180
|
+
this._windowVer.value;
|
|
1181
|
+
this._editVer.value;
|
|
1182
|
+
if (!this.colsWindowed() || !this.colVirtualizer) return 0;
|
|
1183
|
+
const items = this.colVirtualizer.getVirtualItems();
|
|
1184
|
+
if (!items.length) return 0;
|
|
1185
|
+
let pad = this.colVirtualizer.getTotalSize() - items[items.length - 1].end;
|
|
1186
|
+
const lastIdx = items[items.length - 1].index;
|
|
1187
|
+
const forced = this.forcedColumns();
|
|
1188
|
+
for (let i = 0; i < forced.length; i++) if (forced[i] > lastIdx) pad = pad - this.columnSize(forced[i]);
|
|
1189
|
+
return pad < 0 ? 0 : pad;
|
|
1190
|
+
};
|
|
1191
|
+
this.colIsOutsideWindow = (c) => {
|
|
1192
|
+
if (!this.colsWindowed() || !this.colVirtualizer) return false;
|
|
1193
|
+
const items = this.colVirtualizer.getVirtualItems();
|
|
1194
|
+
for (const it of items) if (it.index === c) return false;
|
|
1195
|
+
return true;
|
|
1196
|
+
};
|
|
1197
|
+
this.afterRowRemeasure = this.refineRowEstimate;
|
|
788
1198
|
this.announceState = {
|
|
789
1199
|
sorting: null,
|
|
790
1200
|
columnFilters: null,
|
|
@@ -883,9 +1293,9 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
883
1293
|
return "";
|
|
884
1294
|
};
|
|
885
1295
|
this.defFor = (colId) => {
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
return null;
|
|
1296
|
+
if (colId == null) return null;
|
|
1297
|
+
const d = this.defIndex()[String(colId)];
|
|
1298
|
+
return d != null ? d : null;
|
|
889
1299
|
};
|
|
890
1300
|
this.visibleCellsFor = (row) => this._rowModelVer.value >= 0 ? row.getVisibleCells() : [];
|
|
891
1301
|
this.editMetaOf = (colId) => {
|
|
@@ -1062,22 +1472,56 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
1062
1472
|
return base;
|
|
1063
1473
|
};
|
|
1064
1474
|
this.rowIsGrouped = (row) => !!(this.tick() >= 0 && row && row.getIsGrouped && row.getIsGrouped());
|
|
1475
|
+
this.rowIndexIsGrouped = (rowIndex) => this.rowIsGrouped((this._rows.value || [])[rowIndex]);
|
|
1065
1476
|
this.groupingActive = () => this.tick() >= 0 && (this.currentState().grouping || []).length > 0;
|
|
1066
1477
|
this.cellIsGrouped = (cellCtx) => !!(this.tick() >= 0 && cellCtx && cellCtx.getIsGrouped && cellCtx.getIsGrouped());
|
|
1067
1478
|
this.cellIsAggregated = (cellCtx) => !!(this.tick() >= 0 && cellCtx && cellCtx.getIsAggregated && cellCtx.getIsAggregated());
|
|
1068
1479
|
this.cellIsPlaceholder = (cellCtx) => !!(this.tick() >= 0 && cellCtx && cellCtx.getIsPlaceholder && cellCtx.getIsPlaceholder());
|
|
1069
|
-
this.groupSubRowCount = (row) =>
|
|
1480
|
+
this.groupSubRowCount = (row) => {
|
|
1481
|
+
if (row && row.getLeafRows) {
|
|
1482
|
+
const leaves = row.getLeafRows();
|
|
1483
|
+
let n = 0;
|
|
1484
|
+
for (let i = 0; i < leaves.length; i++) {
|
|
1485
|
+
const r = leaves[i];
|
|
1486
|
+
if (!(r && r.getIsGrouped && r.getIsGrouped())) n = n + 1;
|
|
1487
|
+
}
|
|
1488
|
+
return n;
|
|
1489
|
+
}
|
|
1490
|
+
return row && row.subRows ? row.subRows.length : 0;
|
|
1491
|
+
};
|
|
1492
|
+
this.groupRowDescriptorCache = null;
|
|
1493
|
+
this.groupRowDescriptorCacheVer = void 0;
|
|
1494
|
+
this.groupRowDescriptor = (row) => {
|
|
1495
|
+
const ver = this._rowModelVer.value;
|
|
1496
|
+
if (!this.groupRowDescriptorCache || this.groupRowDescriptorCacheVer !== ver) {
|
|
1497
|
+
this.groupRowDescriptorCache = Object.create(null);
|
|
1498
|
+
this.groupRowDescriptorCacheVer = ver;
|
|
1499
|
+
}
|
|
1500
|
+
const key = String(row.id);
|
|
1501
|
+
let d = this.groupRowDescriptorCache[key];
|
|
1502
|
+
if (!d) {
|
|
1503
|
+
const groupingColumnId = row.groupingColumnId != null ? row.groupingColumnId : "";
|
|
1504
|
+
const groupingValue = row.getGroupingValue ? row.getGroupingValue(groupingColumnId) : row.groupingValue;
|
|
1505
|
+
d = {
|
|
1506
|
+
isGroupRow: true,
|
|
1507
|
+
groupId: row.id,
|
|
1508
|
+
groupingColumnId,
|
|
1509
|
+
groupingValue,
|
|
1510
|
+
leafCount: this.groupSubRowCount(row)
|
|
1511
|
+
};
|
|
1512
|
+
this.groupRowDescriptorCache[key] = d;
|
|
1513
|
+
}
|
|
1514
|
+
return d;
|
|
1515
|
+
};
|
|
1516
|
+
this.cellSlotRow = (row) => this.rowIsGrouped(row) ? this.groupRowDescriptor(row) : row ? row.original : null;
|
|
1070
1517
|
this.groupingKeys = () => this.currentState().grouping || [];
|
|
1071
1518
|
this.groupableColumns = () => {
|
|
1072
1519
|
const out = [];
|
|
1073
|
-
const defs = this.columnDefs();
|
|
1074
|
-
for (const d of defs) {
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
label: d.header != null ? d.header : d.id
|
|
1079
|
-
});
|
|
1080
|
-
}
|
|
1520
|
+
const defs = collectGroupableLeafDefs(this.columnDefs());
|
|
1521
|
+
for (const d of defs) out.push({
|
|
1522
|
+
id: d.id,
|
|
1523
|
+
label: d.header != null ? d.header : d.id
|
|
1524
|
+
});
|
|
1081
1525
|
return out;
|
|
1082
1526
|
};
|
|
1083
1527
|
this.stopEvent = (evt) => {
|
|
@@ -1157,7 +1601,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
1157
1601
|
};
|
|
1158
1602
|
this.getRowIndexRelativeToPage = (absRow) => {
|
|
1159
1603
|
const abs = absRow == null ? this.toAbsRow(this._activeRow.value) : Math.trunc(Number(absRow)) || 0;
|
|
1160
|
-
if (this.
|
|
1604
|
+
if (this.rowsWindowed()) return abs;
|
|
1161
1605
|
return abs - this.pageRowOffset();
|
|
1162
1606
|
};
|
|
1163
1607
|
this.cut = () => this.cutRange();
|
|
@@ -1168,12 +1612,12 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
1168
1612
|
this.colIndexOf = (row, cellCtx) => this.tick() >= 0 ? this.visibleCellsFor(row).indexOf(cellCtx) : -1;
|
|
1169
1613
|
this.headerColIndexOf = (hg, header) => (hg && hg.headers ? hg.headers : []).indexOf(header);
|
|
1170
1614
|
this.pageRowOffset = () => {
|
|
1171
|
-
if (!this.isGrid() || this.
|
|
1615
|
+
if (!this.isGrid() || this.rowsWindowed()) return 0;
|
|
1172
1616
|
return this.pageIndex() * this.pageSize();
|
|
1173
1617
|
};
|
|
1174
1618
|
this.toAbsRow = (localRow) => localRow + this.pageRowOffset();
|
|
1175
1619
|
this.prePaginationRowCount = () => {
|
|
1176
|
-
if (!this.table || this.
|
|
1620
|
+
if (!this.table || this.rowsWindowed()) return this.bodyRowCount();
|
|
1177
1621
|
const pm = this.table.getPrePaginationRowModel();
|
|
1178
1622
|
return pm && pm.rows ? pm.rows.length : this.bodyRowCount();
|
|
1179
1623
|
};
|
|
@@ -1208,8 +1652,11 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
1208
1652
|
const c = nextCol == null ? this._activeColIndex.value : nextCol;
|
|
1209
1653
|
const lvl = nextLevel == null ? this._activeHeaderLevel.value : nextLevel;
|
|
1210
1654
|
const header = nextIsHeader == null ? this._activeIsHeader.value : nextIsHeader;
|
|
1211
|
-
|
|
1212
|
-
|
|
1655
|
+
const rowOut = this.rowsWindowed() && this.virtualizer && this.rowIsOutsideWindow(r);
|
|
1656
|
+
const colOut = this.colsWindowed() && this.colVirtualizer && this.colIsOutsideWindow(c);
|
|
1657
|
+
if (!header && (rowOut || colOut)) {
|
|
1658
|
+
if (rowOut) this.virtualizer.scrollToIndex(r, { align: "center" });
|
|
1659
|
+
if (colOut) this.colVirtualizer.scrollToIndex(c, { align: "center" });
|
|
1213
1660
|
let focusAttempts = 0;
|
|
1214
1661
|
const myEpoch = this.focusIntentEpoch;
|
|
1215
1662
|
const focusWhenReady = () => {
|
|
@@ -1248,7 +1695,6 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
1248
1695
|
return hg.length ? (hg[hg.length - 1].headers || []).length : 0;
|
|
1249
1696
|
};
|
|
1250
1697
|
this.bodyRowCount = () => (this._rows.value || []).length;
|
|
1251
|
-
this.clamp = (v, lo, hi) => v < lo ? lo : v > hi ? hi : v;
|
|
1252
1698
|
this.headerLeafLevel = () => {
|
|
1253
1699
|
const hg = this._headerGroups.value || [];
|
|
1254
1700
|
return hg.length ? hg.length - 1 : 0;
|
|
@@ -1294,7 +1740,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
1294
1740
|
};
|
|
1295
1741
|
this.moveCol = (delta) => {
|
|
1296
1742
|
const max = (this._activeIsHeader.value ? this.headerCountAtLevel(this._activeHeaderLevel.value) : this.visibleColCount()) - 1;
|
|
1297
|
-
const nextCol =
|
|
1743
|
+
const nextCol = clamp(this._activeColIndex.value + delta, 0, max < 0 ? 0 : max);
|
|
1298
1744
|
this._activeColIndex.value = nextCol;
|
|
1299
1745
|
return nextCol;
|
|
1300
1746
|
};
|
|
@@ -1324,7 +1770,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
1324
1770
|
isHeader: true,
|
|
1325
1771
|
level: this._activeHeaderLevel.value
|
|
1326
1772
|
};
|
|
1327
|
-
const landRow =
|
|
1773
|
+
const landRow = clamp(delta - 1, 0, maxRow);
|
|
1328
1774
|
this._activeIsHeader.value = false;
|
|
1329
1775
|
this._activeRow.value = landRow;
|
|
1330
1776
|
return {
|
|
@@ -1363,7 +1809,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
1363
1809
|
level: leafLevel
|
|
1364
1810
|
};
|
|
1365
1811
|
}
|
|
1366
|
-
const nextRow =
|
|
1812
|
+
const nextRow = clamp(this._activeRow.value + delta, 0, maxRow);
|
|
1367
1813
|
this._activeRow.value = nextRow;
|
|
1368
1814
|
this._activeIsHeader.value = false;
|
|
1369
1815
|
return {
|
|
@@ -1412,19 +1858,14 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
1412
1858
|
const rowKey = this._activeIsHeader.value ? "__header" : String(this._activeRow.value);
|
|
1413
1859
|
return this.resolveCellEl(rowKey, this._activeColIndex.value, this._activeIsHeader.value ? this._activeHeaderLevel.value : null);
|
|
1414
1860
|
};
|
|
1415
|
-
this.focusables = (cellEl) => {
|
|
1416
|
-
if (!cellEl || !cellEl.querySelectorAll) return [];
|
|
1417
|
-
return Array.prototype.slice.call(cellEl.querySelectorAll("button,[href],input,select,textarea,[tabindex]:not([tabindex=\"-1\"])")).filter((n) => !n.disabled);
|
|
1418
|
-
};
|
|
1419
1861
|
this.enterControl = () => {
|
|
1420
|
-
const
|
|
1421
|
-
const list = this.focusables(cellEl);
|
|
1862
|
+
const list = focusables(this.currentCellEl());
|
|
1422
1863
|
if (!list.length) return;
|
|
1423
1864
|
this._activeInControl.value = true;
|
|
1424
1865
|
list[0].focus();
|
|
1425
1866
|
};
|
|
1426
1867
|
this.cycleWithinCell = (cellEl, forward) => {
|
|
1427
|
-
const list =
|
|
1868
|
+
const list = focusables(cellEl);
|
|
1428
1869
|
if (!list.length) return;
|
|
1429
1870
|
const active = this.gridRoot ? this.gridRoot.getRootNode().activeElement : null;
|
|
1430
1871
|
const cur = list.indexOf(active);
|
|
@@ -1795,7 +2236,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
1795
2236
|
}
|
|
1796
2237
|
}
|
|
1797
2238
|
const maxCol = colN - 1;
|
|
1798
|
-
const col =
|
|
2239
|
+
const col = clamp(this._activeColIndex.value, 0, maxCol < 0 ? 0 : maxCol);
|
|
1799
2240
|
if (col !== this._activeColIndex.value) this._activeColIndex.value = col;
|
|
1800
2241
|
if (rowN <= 0) {
|
|
1801
2242
|
this._activeIsHeader.value = true;
|
|
@@ -1813,16 +2254,48 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
1813
2254
|
if (!this._activeIsHeader.value) {
|
|
1814
2255
|
const lastRow = rowN - 1;
|
|
1815
2256
|
const maxRow = lastRow < 0 ? 0 : lastRow;
|
|
1816
|
-
const row =
|
|
2257
|
+
const row = clamp(this._activeRow.value, 0, maxRow);
|
|
1817
2258
|
if (row !== this._activeRow.value) this._activeRow.value = row;
|
|
1818
2259
|
}
|
|
1819
2260
|
this.clampRange(rowN - 1, colN - 1);
|
|
1820
2261
|
if (recoverFocus) {
|
|
1821
|
-
const recRow =
|
|
1822
|
-
const recCol =
|
|
2262
|
+
const recRow = clamp(doomedRow, 0, rowN - 1);
|
|
2263
|
+
const recCol = clamp(doomedCol, 0, maxCol < 0 ? 0 : maxCol);
|
|
1823
2264
|
this.recoverGridFocus(String(recRow), recCol, null);
|
|
1824
2265
|
}
|
|
1825
2266
|
};
|
|
2267
|
+
this.windowedHeadersFor = (hg, hgLevel) => {
|
|
2268
|
+
const headers = hg && hg.headers || [];
|
|
2269
|
+
if (!this.colsWindowed()) return headers.map((h) => ({
|
|
2270
|
+
header: h,
|
|
2271
|
+
span: h && h.colSpan > 1 ? h.colSpan : 1
|
|
2272
|
+
}));
|
|
2273
|
+
const idx = this.windowedColIndices();
|
|
2274
|
+
const idxSet = {};
|
|
2275
|
+
for (let i = 0; i < idx.length; i++) idxSet[idx[i]] = true;
|
|
2276
|
+
let cursor = 0;
|
|
2277
|
+
const out = [];
|
|
2278
|
+
for (let i = 0; i < headers.length; i++) {
|
|
2279
|
+
const h = headers[i];
|
|
2280
|
+
const leafCount = h && h.colSpan ? h.colSpan : 1;
|
|
2281
|
+
const start = cursor;
|
|
2282
|
+
const end = cursor + leafCount;
|
|
2283
|
+
cursor = end;
|
|
2284
|
+
let span = 0;
|
|
2285
|
+
for (let c = start; c < end; c++) if (idxSet[c]) span = span + 1;
|
|
2286
|
+
if (span > 0) out.push({
|
|
2287
|
+
header: h,
|
|
2288
|
+
span
|
|
2289
|
+
});
|
|
2290
|
+
}
|
|
2291
|
+
return out;
|
|
2292
|
+
};
|
|
2293
|
+
this.windowedColSpan = () => this.colsWindowed() ? this.windowedColIndices().length + 2 : this.visibleColCount();
|
|
2294
|
+
this.remeasureColumnWindow = () => {
|
|
2295
|
+
if (!this.colsWindowed() || !this.colVirtualizer) return;
|
|
2296
|
+
this.colVirtualizer.setOptions(this.columnVirtualizerOptions());
|
|
2297
|
+
this.colVirtualizer._willUpdate();
|
|
2298
|
+
};
|
|
1826
2299
|
this.gridEmptyFallback = false;
|
|
1827
2300
|
this.rangeTransition = false;
|
|
1828
2301
|
this.rangeClickPending = false;
|
|
@@ -1851,8 +2324,8 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
1851
2324
|
focus: null
|
|
1852
2325
|
};
|
|
1853
2326
|
const clampCorner = (c) => c == null ? null : {
|
|
1854
|
-
rowIndex:
|
|
1855
|
-
colIndex:
|
|
2327
|
+
rowIndex: clamp(c.rowIndex, 0, maxRow),
|
|
2328
|
+
colIndex: clamp(c.colIndex, 0, maxCol)
|
|
1856
2329
|
};
|
|
1857
2330
|
return {
|
|
1858
2331
|
anchor: clampCorner(a),
|
|
@@ -1895,8 +2368,8 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
1895
2368
|
colIndex: this._activeColIndex.value
|
|
1896
2369
|
};
|
|
1897
2370
|
}
|
|
1898
|
-
const nextRow =
|
|
1899
|
-
const nextCol =
|
|
2371
|
+
const nextRow = clamp(focus.rowIndex + dRow, 0, maxRow);
|
|
2372
|
+
const nextCol = clamp(focus.colIndex + dCol, 0, maxCol);
|
|
1900
2373
|
const nextFocus = {
|
|
1901
2374
|
rowIndex: nextRow,
|
|
1902
2375
|
colIndex: nextCol
|
|
@@ -1920,8 +2393,8 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
1920
2393
|
colIndex: this._activeColIndex.value
|
|
1921
2394
|
};
|
|
1922
2395
|
const nextFocus = {
|
|
1923
|
-
rowIndex:
|
|
1924
|
-
colIndex:
|
|
2396
|
+
rowIndex: clamp(Math.trunc(Number(rIdx)) || 0, 0, maxRow),
|
|
2397
|
+
colIndex: clamp(Math.trunc(Number(cIdx)) || 0, 0, maxCol)
|
|
1925
2398
|
};
|
|
1926
2399
|
this._rangeAnchor.value = anchor;
|
|
1927
2400
|
this._rangeFocus.value = nextFocus;
|
|
@@ -1965,16 +2438,16 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
1965
2438
|
return;
|
|
1966
2439
|
}
|
|
1967
2440
|
if (a) {
|
|
1968
|
-
const ar =
|
|
1969
|
-
const ac =
|
|
2441
|
+
const ar = clamp(a.rowIndex, 0, maxRow);
|
|
2442
|
+
const ac = clamp(a.colIndex, 0, maxCol);
|
|
1970
2443
|
if (ar !== a.rowIndex || ac !== a.colIndex) this._rangeAnchor.value = {
|
|
1971
2444
|
rowIndex: ar,
|
|
1972
2445
|
colIndex: ac
|
|
1973
2446
|
};
|
|
1974
2447
|
}
|
|
1975
2448
|
if (f) {
|
|
1976
|
-
const fr =
|
|
1977
|
-
const fc =
|
|
2449
|
+
const fr = clamp(f.rowIndex, 0, maxRow);
|
|
2450
|
+
const fc = clamp(f.colIndex, 0, maxCol);
|
|
1978
2451
|
if (fr !== f.rowIndex || fc !== f.colIndex) this._rangeFocus.value = {
|
|
1979
2452
|
rowIndex: fr,
|
|
1980
2453
|
colIndex: fc
|
|
@@ -1996,10 +2469,10 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
1996
2469
|
const maxRow = this.bodyRowCount() - 1;
|
|
1997
2470
|
const maxCol = this.visibleColCount() - 1;
|
|
1998
2471
|
if (maxRow < 0 || maxCol < 0) return null;
|
|
1999
|
-
const ar =
|
|
2000
|
-
const ac =
|
|
2001
|
-
const fr =
|
|
2002
|
-
const fc =
|
|
2472
|
+
const ar = clamp(a.rowIndex, 0, maxRow);
|
|
2473
|
+
const ac = clamp(a.colIndex, 0, maxCol);
|
|
2474
|
+
const fr = clamp(f.rowIndex, 0, maxRow);
|
|
2475
|
+
const fc = clamp(f.colIndex, 0, maxCol);
|
|
2003
2476
|
return {
|
|
2004
2477
|
r0: ar < fr ? ar : fr,
|
|
2005
2478
|
r1: ar > fr ? ar : fr,
|
|
@@ -2007,10 +2480,6 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2007
2480
|
c1: ac > fc ? ac : fc
|
|
2008
2481
|
};
|
|
2009
2482
|
};
|
|
2010
|
-
this.escapeTsvField = (s) => {
|
|
2011
|
-
if (s.indexOf(" ") >= 0 || s.indexOf("\n") >= 0 || s.indexOf("\r") >= 0 || s.indexOf("\"") >= 0) return "\"" + s.replace(/"/g, "\"\"") + "\"";
|
|
2012
|
-
return s;
|
|
2013
|
-
};
|
|
2014
2483
|
this.rangeToTsv = () => {
|
|
2015
2484
|
const box = this.normalizedRange();
|
|
2016
2485
|
const r0 = box ? box.r0 : this._activeRow.value;
|
|
@@ -2022,77 +2491,12 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2022
2491
|
const cells = [];
|
|
2023
2492
|
for (let c = c0; c <= c1; c++) {
|
|
2024
2493
|
const v = this.cellValueAt(r, c);
|
|
2025
|
-
cells.push(
|
|
2494
|
+
cells.push(escapeTsvField(v == null ? "" : String(v)));
|
|
2026
2495
|
}
|
|
2027
2496
|
lines.push(cells.join(" "));
|
|
2028
2497
|
}
|
|
2029
2498
|
return lines.join("\n");
|
|
2030
2499
|
};
|
|
2031
|
-
this.parseTsv = (text) => {
|
|
2032
|
-
const str = text != null ? String(text) : "";
|
|
2033
|
-
if (str === "" || str.length > 2e6) return [];
|
|
2034
|
-
const rows = [];
|
|
2035
|
-
let row = [];
|
|
2036
|
-
let field = "";
|
|
2037
|
-
let inQuotes = false;
|
|
2038
|
-
let i = 0;
|
|
2039
|
-
const n = str.length;
|
|
2040
|
-
while (i < n) {
|
|
2041
|
-
const ch = str[i];
|
|
2042
|
-
if (inQuotes) {
|
|
2043
|
-
if (ch === "\"") {
|
|
2044
|
-
if (i + 1 < n && str[i + 1] === "\"") {
|
|
2045
|
-
field = field + "\"";
|
|
2046
|
-
i = i + 2;
|
|
2047
|
-
continue;
|
|
2048
|
-
}
|
|
2049
|
-
inQuotes = false;
|
|
2050
|
-
i = i + 1;
|
|
2051
|
-
continue;
|
|
2052
|
-
}
|
|
2053
|
-
field = field + ch;
|
|
2054
|
-
i = i + 1;
|
|
2055
|
-
continue;
|
|
2056
|
-
}
|
|
2057
|
-
if (ch === "\"" && field === "") {
|
|
2058
|
-
inQuotes = true;
|
|
2059
|
-
i = i + 1;
|
|
2060
|
-
continue;
|
|
2061
|
-
}
|
|
2062
|
-
if (ch === " ") {
|
|
2063
|
-
row.push(field);
|
|
2064
|
-
field = "";
|
|
2065
|
-
i = i + 1;
|
|
2066
|
-
continue;
|
|
2067
|
-
}
|
|
2068
|
-
if (ch === "\r") {
|
|
2069
|
-
if (i + 1 < n && str[i + 1] === "\n") i = i + 1;
|
|
2070
|
-
row.push(field);
|
|
2071
|
-
field = "";
|
|
2072
|
-
rows.push(row);
|
|
2073
|
-
row = [];
|
|
2074
|
-
i = i + 1;
|
|
2075
|
-
continue;
|
|
2076
|
-
}
|
|
2077
|
-
if (ch === "\n") {
|
|
2078
|
-
row.push(field);
|
|
2079
|
-
field = "";
|
|
2080
|
-
rows.push(row);
|
|
2081
|
-
row = [];
|
|
2082
|
-
i = i + 1;
|
|
2083
|
-
continue;
|
|
2084
|
-
}
|
|
2085
|
-
field = field + ch;
|
|
2086
|
-
i = i + 1;
|
|
2087
|
-
}
|
|
2088
|
-
row.push(field);
|
|
2089
|
-
rows.push(row);
|
|
2090
|
-
if (rows.length > 1) {
|
|
2091
|
-
const last = rows[rows.length - 1];
|
|
2092
|
-
if (last.length === 1 && last[0] === "") rows.pop();
|
|
2093
|
-
}
|
|
2094
|
-
return rows;
|
|
2095
|
-
};
|
|
2096
2500
|
this.copyRange = () => {
|
|
2097
2501
|
if (!this.clipboardActiveAllowed()) return;
|
|
2098
2502
|
if (typeof navigator === "undefined" || !navigator.clipboard || !navigator.clipboard.writeText) return;
|
|
@@ -2115,11 +2519,13 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2115
2519
|
for (let gr = 0; gr < grid.length; gr++) {
|
|
2116
2520
|
const r = originRow + gr;
|
|
2117
2521
|
if (r > maxRow) break;
|
|
2522
|
+
const rowGrouped = this.rowIndexIsGrouped(r);
|
|
2118
2523
|
const cols = grid[gr] || [];
|
|
2119
2524
|
for (let gc = 0; gc < cols.length; gc++) {
|
|
2120
2525
|
const c = originCol + gc;
|
|
2121
2526
|
if (c > maxCol) break;
|
|
2122
2527
|
total = total + 1;
|
|
2528
|
+
if (rowGrouped) continue;
|
|
2123
2529
|
const colId = this.columnIdAt(r, c);
|
|
2124
2530
|
if (colId == null || !this.columnEditable(colId)) continue;
|
|
2125
2531
|
const rowObj = this.rowOriginalAt(r);
|
|
@@ -2128,7 +2534,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2128
2534
|
const field = this.fieldOfColId(colId);
|
|
2129
2535
|
const srcIndex = this.sourceIndexOfRow(r);
|
|
2130
2536
|
const oldValue = rowObj ? rowObj[field] : null;
|
|
2131
|
-
next =
|
|
2537
|
+
next = replaceRowValue(next, srcIndex, field, value);
|
|
2132
2538
|
committed.push({
|
|
2133
2539
|
rowId: this.rowIdAt(r),
|
|
2134
2540
|
columnId: colId,
|
|
@@ -2163,30 +2569,6 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2163
2569
|
const row = (this._rows.value || [])[rowIndex];
|
|
2164
2570
|
return row ? row.id : null;
|
|
2165
2571
|
};
|
|
2166
|
-
this.tileGridToBox = (grid, box) => {
|
|
2167
|
-
const srcRows = grid.length;
|
|
2168
|
-
let srcCols = 0;
|
|
2169
|
-
for (let i = 0; i < srcRows; i++) {
|
|
2170
|
-
const w = grid[i] && grid[i].length ? grid[i].length : 0;
|
|
2171
|
-
if (w > srcCols) srcCols = w;
|
|
2172
|
-
}
|
|
2173
|
-
if (srcRows <= 0 || srcCols <= 0) return grid;
|
|
2174
|
-
const boxRows = box.r1 - box.r0 + 1;
|
|
2175
|
-
const boxCols = box.c1 - box.c0 + 1;
|
|
2176
|
-
const rows = boxRows > srcRows ? boxRows : srcRows;
|
|
2177
|
-
const cols = boxCols > srcCols ? boxCols : srcCols;
|
|
2178
|
-
const out = [];
|
|
2179
|
-
for (let r = 0; r < rows; r++) {
|
|
2180
|
-
const srcLine = grid[r % srcRows] || [];
|
|
2181
|
-
const line = [];
|
|
2182
|
-
for (let c = 0; c < cols; c++) {
|
|
2183
|
-
const v = srcLine[c % srcCols];
|
|
2184
|
-
line.push(v != null ? v : "");
|
|
2185
|
-
}
|
|
2186
|
-
out.push(line);
|
|
2187
|
-
}
|
|
2188
|
-
return out;
|
|
2189
|
-
};
|
|
2190
2572
|
this.pasteRange = () => {
|
|
2191
2573
|
if (!this.clipboardActiveAllowed()) return;
|
|
2192
2574
|
if (typeof navigator === "undefined" || !navigator.clipboard || !navigator.clipboard.readText) return;
|
|
@@ -2207,9 +2589,9 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2207
2589
|
}
|
|
2208
2590
|
if (!p || !p.then) return;
|
|
2209
2591
|
p.then((text) => {
|
|
2210
|
-
const grid =
|
|
2592
|
+
const grid = parseTsv(text);
|
|
2211
2593
|
if (!grid.length) return;
|
|
2212
|
-
const tiled =
|
|
2594
|
+
const tiled = tileGridToBox(grid, destBox);
|
|
2213
2595
|
this.applyGridToRange(tiled, anchorRow, anchorCol);
|
|
2214
2596
|
}).catch(() => {});
|
|
2215
2597
|
};
|
|
@@ -2247,13 +2629,6 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2247
2629
|
}
|
|
2248
2630
|
this.applyGridToRange(grid, r0, c0);
|
|
2249
2631
|
};
|
|
2250
|
-
this.tileIndex = (i, lo, hi) => {
|
|
2251
|
-
const span = hi - lo + 1;
|
|
2252
|
-
if (span <= 1) return lo;
|
|
2253
|
-
let k = (i - lo) % span;
|
|
2254
|
-
if (k < 0) k = k + span;
|
|
2255
|
-
return lo + k;
|
|
2256
|
-
};
|
|
2257
2632
|
this.fillRange = (sourceBox, endCell) => {
|
|
2258
2633
|
let box;
|
|
2259
2634
|
if (sourceBox && sourceBox.r0 != null && endCell) {
|
|
@@ -2283,8 +2658,8 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2283
2658
|
for (let r = box.r0; r <= box.r1; r++) {
|
|
2284
2659
|
const cols = [];
|
|
2285
2660
|
for (let c = box.c0; c <= box.c1; c++) {
|
|
2286
|
-
const sr =
|
|
2287
|
-
const sc =
|
|
2661
|
+
const sr = tileIndex(r, src.r0, src.r1);
|
|
2662
|
+
const sc = tileIndex(c, src.c0, src.c1);
|
|
2288
2663
|
const v = this.cellValueAt(sr, sc);
|
|
2289
2664
|
cols.push(v == null ? "" : String(v));
|
|
2290
2665
|
}
|
|
@@ -2295,6 +2670,30 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2295
2670
|
this.fillDragging = false;
|
|
2296
2671
|
this.fillDragMove = null;
|
|
2297
2672
|
this.fillDragUp = null;
|
|
2673
|
+
this.fillEdgeScrollRaf = null;
|
|
2674
|
+
this.FILL_EDGE_SCROLL_PX = 24;
|
|
2675
|
+
this.FILL_EDGE_SCROLL_STEP = 16;
|
|
2676
|
+
this.edgeDelta = (clientX, clientY) => {
|
|
2677
|
+
if (!this.gridScrollEl) return {
|
|
2678
|
+
dx: 0,
|
|
2679
|
+
dy: 0
|
|
2680
|
+
};
|
|
2681
|
+
const rect = this.gridScrollEl.getBoundingClientRect();
|
|
2682
|
+
let dx = 0;
|
|
2683
|
+
let dy = 0;
|
|
2684
|
+
if (this.colsWindowed()) {
|
|
2685
|
+
if (clientX - rect.left < this.FILL_EDGE_SCROLL_PX) dx = -this.FILL_EDGE_SCROLL_STEP;
|
|
2686
|
+
else if (rect.right - clientX < this.FILL_EDGE_SCROLL_PX) dx = this.FILL_EDGE_SCROLL_STEP;
|
|
2687
|
+
}
|
|
2688
|
+
if (this.rowsWindowed()) {
|
|
2689
|
+
if (clientY - rect.top < this.FILL_EDGE_SCROLL_PX) dy = -this.FILL_EDGE_SCROLL_STEP;
|
|
2690
|
+
else if (rect.bottom - clientY < this.FILL_EDGE_SCROLL_PX) dy = this.FILL_EDGE_SCROLL_STEP;
|
|
2691
|
+
}
|
|
2692
|
+
return {
|
|
2693
|
+
dx,
|
|
2694
|
+
dy
|
|
2695
|
+
};
|
|
2696
|
+
};
|
|
2298
2697
|
this.teardownFillDrag = () => {
|
|
2299
2698
|
if (typeof document !== "undefined") {
|
|
2300
2699
|
if (this.fillDragMove) document.removeEventListener("pointermove", this.fillDragMove);
|
|
@@ -2303,6 +2702,10 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2303
2702
|
this.fillDragMove = null;
|
|
2304
2703
|
this.fillDragUp = null;
|
|
2305
2704
|
this.fillDragging = false;
|
|
2705
|
+
if (this.fillEdgeScrollRaf != null) {
|
|
2706
|
+
if (typeof cancelAnimationFrame === "function") cancelAnimationFrame(this.fillEdgeScrollRaf);
|
|
2707
|
+
this.fillEdgeScrollRaf = null;
|
|
2708
|
+
}
|
|
2306
2709
|
};
|
|
2307
2710
|
this.cellIndexFromPoint = (clientX, clientY) => {
|
|
2308
2711
|
if (typeof document === "undefined" || !document.elementFromPoint) return null;
|
|
@@ -2337,14 +2740,42 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2337
2740
|
r: sourceBox.r1,
|
|
2338
2741
|
c: sourceBox.c1
|
|
2339
2742
|
} : null;
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2743
|
+
let lastClientX = 0;
|
|
2744
|
+
let lastClientY = 0;
|
|
2745
|
+
const applyPointAt = (clientX, clientY) => {
|
|
2746
|
+
const cell = this.cellIndexFromPoint(clientX, clientY);
|
|
2343
2747
|
if (cell && (!lastCell || cell.r !== lastCell.r || cell.c !== lastCell.c)) {
|
|
2344
2748
|
lastCell = cell;
|
|
2345
2749
|
this.setRangeFocus(cell.r, cell.c);
|
|
2346
2750
|
}
|
|
2347
2751
|
};
|
|
2752
|
+
const scrollStep = () => {
|
|
2753
|
+
if (!this.fillDragging) {
|
|
2754
|
+
this.fillEdgeScrollRaf = null;
|
|
2755
|
+
return;
|
|
2756
|
+
}
|
|
2757
|
+
const d = this.edgeDelta(lastClientX, lastClientY);
|
|
2758
|
+
if (d.dx === 0 && d.dy === 0) {
|
|
2759
|
+
this.fillEdgeScrollRaf = null;
|
|
2760
|
+
return;
|
|
2761
|
+
}
|
|
2762
|
+
if (this.gridScrollEl) {
|
|
2763
|
+
if (d.dx !== 0) this.gridScrollEl.scrollLeft = this.gridScrollEl.scrollLeft + d.dx;
|
|
2764
|
+
if (d.dy !== 0) this.gridScrollEl.scrollTop = this.gridScrollEl.scrollTop + d.dy;
|
|
2765
|
+
}
|
|
2766
|
+
applyPointAt(lastClientX, lastClientY);
|
|
2767
|
+
this.fillEdgeScrollRaf = requestAnimationFrame(scrollStep);
|
|
2768
|
+
};
|
|
2769
|
+
const move = (ev) => {
|
|
2770
|
+
if (!this.fillDragging) return;
|
|
2771
|
+
lastClientX = ev.clientX;
|
|
2772
|
+
lastClientY = ev.clientY;
|
|
2773
|
+
applyPointAt(ev.clientX, ev.clientY);
|
|
2774
|
+
if (this.fillEdgeScrollRaf == null && typeof requestAnimationFrame === "function") {
|
|
2775
|
+
const d = this.edgeDelta(ev.clientX, ev.clientY);
|
|
2776
|
+
if (d.dx !== 0 || d.dy !== 0) this.fillEdgeScrollRaf = requestAnimationFrame(scrollStep);
|
|
2777
|
+
}
|
|
2778
|
+
};
|
|
2348
2779
|
const up = () => {
|
|
2349
2780
|
this.teardownFillDrag();
|
|
2350
2781
|
if (lastCell && sourceBox && (lastCell.r !== sourceBox.r1 || lastCell.c !== sourceBox.c1)) this.fillRange(sourceBox, lastCell);
|
|
@@ -2404,11 +2835,13 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2404
2835
|
return cell && cell.column ? cell.column.id : null;
|
|
2405
2836
|
};
|
|
2406
2837
|
this.isActiveCellEditable = () => {
|
|
2838
|
+
if (this.rowIndexIsGrouped(this._activeRow.value)) return false;
|
|
2407
2839
|
const colId = this.activeCellColumnId();
|
|
2408
2840
|
return colId != null && this.columnEditable(colId);
|
|
2409
2841
|
};
|
|
2410
2842
|
this.isEditing = (rowIndex, colIndex) => {
|
|
2411
2843
|
if (this._editVer.value < 0) return false;
|
|
2844
|
+
if (this.rowIndexIsGrouped(rowIndex)) return false;
|
|
2412
2845
|
if (this._editingRowIndex.value != null && this._editingRowIndex.value === rowIndex) {
|
|
2413
2846
|
const colId = this.columnIdAt(rowIndex, colIndex);
|
|
2414
2847
|
return colId != null && this.columnEditable(colId);
|
|
@@ -2433,16 +2866,6 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2433
2866
|
this.setInvalid = (msg) => {
|
|
2434
2867
|
this._invalidMsg.value = msg != null ? msg : "";
|
|
2435
2868
|
};
|
|
2436
|
-
this.replaceRowValue = (rows, rowIndex, field, value) => {
|
|
2437
|
-
const src = rows || [];
|
|
2438
|
-
const out = [];
|
|
2439
|
-
for (let i = 0; i < src.length; i++) if (i === rowIndex) out.push({
|
|
2440
|
-
...src[i] || {},
|
|
2441
|
-
[field]: value
|
|
2442
|
-
});
|
|
2443
|
-
else out.push(src[i]);
|
|
2444
|
-
return out;
|
|
2445
|
-
};
|
|
2446
2869
|
this.sourceIndexOfRow = (visibleRowIndex) => {
|
|
2447
2870
|
const row = (this._rows.value || [])[visibleRowIndex];
|
|
2448
2871
|
if (!row) return visibleRowIndex;
|
|
@@ -2518,6 +2941,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2518
2941
|
return cell ? cell.getValue() : null;
|
|
2519
2942
|
};
|
|
2520
2943
|
this.beginEdit = (rowIndex, colIndex, seed) => {
|
|
2944
|
+
if (this.rowIndexIsGrouped(rowIndex)) return;
|
|
2521
2945
|
const colId = this.columnIdAt(rowIndex, colIndex);
|
|
2522
2946
|
if (colId == null || !this.columnEditable(colId)) return;
|
|
2523
2947
|
this.committedThisSession = false;
|
|
@@ -2549,16 +2973,6 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2549
2973
|
if (typeof requestAnimationFrame === "function") requestAnimationFrame(tryFocus);
|
|
2550
2974
|
else setTimeout(tryFocus, 0);
|
|
2551
2975
|
};
|
|
2552
|
-
this.indexOfRowIn = (rows, rowOriginal, rowId) => {
|
|
2553
|
-
const list = rows || [];
|
|
2554
|
-
for (let i = 0; i < list.length; i++) {
|
|
2555
|
-
const r = list[i];
|
|
2556
|
-
if (!r) continue;
|
|
2557
|
-
if (rowId != null && r.id === rowId) return i;
|
|
2558
|
-
if (rowOriginal != null && r.original === rowOriginal) return i;
|
|
2559
|
-
}
|
|
2560
|
-
return -1;
|
|
2561
|
-
};
|
|
2562
2976
|
this.endEdit = () => {
|
|
2563
2977
|
this._editingRow.value = -1;
|
|
2564
2978
|
this._editingCol.value = -1;
|
|
@@ -2620,7 +3034,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2620
3034
|
this.committedThisSession = true;
|
|
2621
3035
|
if (changed) {
|
|
2622
3036
|
const srcIndex = this.sourceIndexOfRow(this._editingRow.value);
|
|
2623
|
-
const next =
|
|
3037
|
+
const next = replaceRowValue(this.currentData(), srcIndex, field, newValue);
|
|
2624
3038
|
this.writeData(next);
|
|
2625
3039
|
this.dispatchEvent(new CustomEvent("cell-edit-commit", {
|
|
2626
3040
|
detail: {
|
|
@@ -2645,6 +3059,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2645
3059
|
return true;
|
|
2646
3060
|
};
|
|
2647
3061
|
this.toggleActiveBooleanCell = () => {
|
|
3062
|
+
if (this.rowIndexIsGrouped(this._activeRow.value)) return;
|
|
2648
3063
|
const colId = this.columnIdAt(this._activeRow.value, this._activeColIndex.value);
|
|
2649
3064
|
if (colId == null || !this.columnEditable(colId)) return;
|
|
2650
3065
|
const row = (this._rows.value || [])[this._activeRow.value];
|
|
@@ -2663,7 +3078,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2663
3078
|
const field = def && def.accessorKey != null ? def.accessorKey : colId;
|
|
2664
3079
|
const srcIndex = this.sourceIndexOfRow(this._activeRow.value);
|
|
2665
3080
|
this.committedThisSession = true;
|
|
2666
|
-
this.writeData(
|
|
3081
|
+
this.writeData(replaceRowValue(this.currentData(), srcIndex, field, newValue));
|
|
2667
3082
|
this.dispatchEvent(new CustomEvent("cell-edit-commit", {
|
|
2668
3083
|
detail: {
|
|
2669
3084
|
rowId,
|
|
@@ -2734,6 +3149,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2734
3149
|
this.beginRowEdit = (row) => {
|
|
2735
3150
|
const rowIndex = this.rowIndexOf(row);
|
|
2736
3151
|
if (rowIndex < 0) return;
|
|
3152
|
+
if (this.rowIndexIsGrouped(rowIndex)) return;
|
|
2737
3153
|
const editable = this.editableColumnsForRow(rowIndex);
|
|
2738
3154
|
if (editable.length === 0) return;
|
|
2739
3155
|
this.committedThisSession = false;
|
|
@@ -2798,7 +3214,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2798
3214
|
this.editTransition = true;
|
|
2799
3215
|
if (changed) {
|
|
2800
3216
|
const srcIndex = this.sourceIndexOfRow(rowIndex);
|
|
2801
|
-
const next =
|
|
3217
|
+
const next = replaceRowValues(this.currentData(), srcIndex, fieldValues);
|
|
2802
3218
|
this.writeData(next);
|
|
2803
3219
|
this.dispatchEvent(new CustomEvent("row-edit-commit", {
|
|
2804
3220
|
detail: {
|
|
@@ -2828,17 +3244,6 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2828
3244
|
this.editTransition = false;
|
|
2829
3245
|
this.focusCellWhenReady(focusRow, focusCol);
|
|
2830
3246
|
};
|
|
2831
|
-
this.replaceRowValues = (rows, rowIndex, fieldValues) => {
|
|
2832
|
-
const src = rows || [];
|
|
2833
|
-
const fv = fieldValues || {};
|
|
2834
|
-
const out = [];
|
|
2835
|
-
for (let i = 0; i < src.length; i++) if (i === rowIndex) out.push({
|
|
2836
|
-
...src[i] || {},
|
|
2837
|
-
...fv
|
|
2838
|
-
});
|
|
2839
|
-
else out.push(src[i]);
|
|
2840
|
-
return out;
|
|
2841
|
-
};
|
|
2842
3247
|
this.nextEditableCell = (fromRow, fromCol) => {
|
|
2843
3248
|
const rowList = this._rows.value || [];
|
|
2844
3249
|
const rowCount = rowList.length;
|
|
@@ -3023,8 +3428,8 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
3023
3428
|
const lastRow = this.bodyRowCount() - 1;
|
|
3024
3429
|
const maxRow = lastRow < 0 ? 0 : lastRow;
|
|
3025
3430
|
const maxCol = this.visibleColCount() - 1;
|
|
3026
|
-
const r =
|
|
3027
|
-
const c =
|
|
3431
|
+
const r = clamp(Math.trunc(Number(rowIndex)) || 0, 0, maxRow);
|
|
3432
|
+
const c = clamp(Math.trunc(Number(colIndex)) || 0, 0, maxCol < 0 ? 0 : maxCol);
|
|
3028
3433
|
this.committedThisSession = false;
|
|
3029
3434
|
this._activeIsHeader.value = false;
|
|
3030
3435
|
this._activeRow.value = r;
|
|
@@ -3041,7 +3446,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
3041
3446
|
this.editRow = (rowIndex) => {
|
|
3042
3447
|
const lastRow = this.bodyRowCount() - 1;
|
|
3043
3448
|
const maxRow = lastRow < 0 ? 0 : lastRow;
|
|
3044
|
-
const r =
|
|
3449
|
+
const r = clamp(Math.trunc(Number(rowIndex)) || 0, 0, maxRow);
|
|
3045
3450
|
const row = (this._rows.value || [])[r];
|
|
3046
3451
|
if (!row) return;
|
|
3047
3452
|
this._activeIsHeader.value = false;
|
|
@@ -3075,12 +3480,13 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
3075
3480
|
if (!this.isGrid()) return;
|
|
3076
3481
|
this.focusIntentEpoch = this.focusIntentEpoch + 1;
|
|
3077
3482
|
const maxCol = this.visibleColCount() - 1;
|
|
3078
|
-
const c =
|
|
3483
|
+
const c = clamp(Math.trunc(Number(colIndex)) || 0, 0, maxCol < 0 ? 0 : maxCol);
|
|
3079
3484
|
const absLast = this.prePaginationRowCount() - 1;
|
|
3080
|
-
const absRow =
|
|
3485
|
+
const absRow = clamp(Math.trunc(Number(rowIndex)) || 0, 0, absLast < 0 ? 0 : absLast);
|
|
3081
3486
|
const prevAbs = this.toAbsRow(this._activeRow.value);
|
|
3487
|
+
const prevCol = this._activeColIndex.value;
|
|
3082
3488
|
const prevIsHeader = this._activeIsHeader.value;
|
|
3083
|
-
if (this.
|
|
3489
|
+
if (this.rowsWindowed()) {
|
|
3084
3490
|
this._activeIsHeader.value = false;
|
|
3085
3491
|
this._activeInControl.value = false;
|
|
3086
3492
|
this._activeRow.value = absRow;
|
|
@@ -3099,7 +3505,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
3099
3505
|
if (switched) this.focusAbsCellWhenReady(absRow, localRow, c);
|
|
3100
3506
|
else this.focusActiveCell(localRow, c, false);
|
|
3101
3507
|
}
|
|
3102
|
-
if (absRow !== prevAbs || prevIsHeader) this.dispatchEvent(new CustomEvent("activecell-change", {
|
|
3508
|
+
if (absRow !== prevAbs || c !== prevCol || prevIsHeader) this.dispatchEvent(new CustomEvent("activecell-change", {
|
|
3103
3509
|
detail: {
|
|
3104
3510
|
rowIndex: absRow,
|
|
3105
3511
|
colIndex: c
|
|
@@ -3183,6 +3589,13 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
3183
3589
|
font: var(--rdt-font, 14px system-ui, sans-serif);
|
|
3184
3590
|
color: var(--rdt-color, inherit);
|
|
3185
3591
|
}
|
|
3592
|
+
.rozie-data-table.rdt-col-windowed[data-rozie-s-d5dcab4c] {
|
|
3593
|
+
table-layout: fixed;
|
|
3594
|
+
}
|
|
3595
|
+
.rozie-data-table.rdt-col-windowed[data-rozie-s-d5dcab4c] .rdt-th[data-rozie-s-d5dcab4c],
|
|
3596
|
+
.rozie-data-table.rdt-col-windowed[data-rozie-s-d5dcab4c] .rdt-td[data-rozie-s-d5dcab4c] {
|
|
3597
|
+
box-sizing: border-box;
|
|
3598
|
+
}
|
|
3186
3599
|
.rdt-sr-live[data-rozie-s-d5dcab4c] {
|
|
3187
3600
|
position: absolute;
|
|
3188
3601
|
width: 1px;
|
|
@@ -3719,10 +4132,11 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
3719
4132
|
this._rows.value = nextRows;
|
|
3720
4133
|
this._headerGroups.value = nextGroups;
|
|
3721
4134
|
this._rowModelVer.value = this._rowModelVer.value + 1;
|
|
3722
|
-
if (this.
|
|
4135
|
+
if (this.rowsWindowed() && this.virtualizer) {
|
|
3723
4136
|
this.virtualizer.setOptions(this.virtualizerOptions());
|
|
3724
4137
|
this.virtualizer._willUpdate();
|
|
3725
4138
|
}
|
|
4139
|
+
this.remeasureColumnWindow();
|
|
3726
4140
|
const nextRowCount = nextRows.length;
|
|
3727
4141
|
const nextColCount = nextRows.length ? nextRows[0].getVisibleCells().length : nextGroups.length ? (nextGroups[nextGroups.length - 1].headers || []).length : 0;
|
|
3728
4142
|
this.clampActiveCell(nextRowCount, nextColCount);
|
|
@@ -3735,7 +4149,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
3735
4149
|
if (this.pendingEditFollow && this.isGrid()) {
|
|
3736
4150
|
const follow = this.pendingEditFollow;
|
|
3737
4151
|
this.pendingEditFollow = null;
|
|
3738
|
-
const followIdx =
|
|
4152
|
+
const followIdx = indexOfRowIn(nextRows, follow.rowOriginal, follow.rowId);
|
|
3739
4153
|
if (followIdx >= 0) this.focusCellWhenReady(followIdx, follow.col);
|
|
3740
4154
|
}
|
|
3741
4155
|
this.syncIndeterminate();
|
|
@@ -3744,17 +4158,28 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
3744
4158
|
};
|
|
3745
4159
|
this.refreshRowModel();
|
|
3746
4160
|
this.gridRoot = this._ref__rozieRoot ? this._ref__rozieRoot.querySelector(".rozie-data-table") : null;
|
|
3747
|
-
if (this.
|
|
3748
|
-
|
|
4161
|
+
if (this.isWindowed()) this.gridScrollEl = this._ref__rozieRoot ? this._ref__rozieRoot.querySelector(".rdt-scroll") : null;
|
|
4162
|
+
if (this.rowsWindowed()) {
|
|
3749
4163
|
this.virtualizer = new _tanstack_virtual_core.Virtualizer(this.virtualizerOptions());
|
|
3750
4164
|
this.virtualizerCleanup = this.virtualizer._didMount();
|
|
3751
|
-
|
|
4165
|
+
}
|
|
4166
|
+
if (this.colsWindowed()) {
|
|
4167
|
+
this.colVirtualizer = new _tanstack_virtual_core.Virtualizer(this.columnVirtualizerOptions());
|
|
4168
|
+
this.colVirtualizerCleanup = this.colVirtualizer._didMount();
|
|
4169
|
+
}
|
|
4170
|
+
if (this.isWindowed()) this._windowVer.value = this._windowVer.value + 1;
|
|
4171
|
+
if (this.isWindowed()) {
|
|
3752
4172
|
const afterFirstFrame = () => {
|
|
3753
|
-
this.
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
4173
|
+
if (this.rowsWindowed()) {
|
|
4174
|
+
this.remeasureWindow();
|
|
4175
|
+
if (!(this.gridScrollEl ? this.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");
|
|
4176
|
+
const pg = this.pagination;
|
|
4177
|
+
const pgConfigured = pg != null && !(pg.pageIndex === 0 && pg.pageSize === 10);
|
|
4178
|
+
if (this.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.");
|
|
4179
|
+
}
|
|
4180
|
+
if (this.colsWindowed()) {
|
|
4181
|
+
if (!(this.gridScrollEl ? this.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");
|
|
4182
|
+
}
|
|
3758
4183
|
};
|
|
3759
4184
|
if (typeof requestAnimationFrame === "function") requestAnimationFrame(() => requestAnimationFrame(afterFirstFrame));
|
|
3760
4185
|
else setTimeout(afterFirstFrame, 0);
|
|
@@ -3839,10 +4264,11 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
3839
4264
|
})()} @rozie-group-bar-apply-grouping=${($event) => this.applyGrouping($event.detail)} @rozie-group-bar-clear-grouping=${($event) => this.clearGrouping($event.detail)}>
|
|
3840
4265
|
${(0, lit_directives_repeat_js.repeat)(this.groupingKeys(), (gk, _idx) => gk, (gk, _idx) => lit.html`<span class="rdt-group-token" data-group-token="" data-rozie-s-d5dcab4c>${(0, _rozie_runtime_lit.rozieDisplay)(gk)}</span>`)}
|
|
3841
4266
|
</slot>`}
|
|
3842
|
-
</div>` : lit.nothing}${this.
|
|
4267
|
+
</div>` : lit.nothing}${this.isWindowed() ? lit.html`<div class="rdt-scroll" style=${(0, _rozie_runtime_lit.rozieStyle)(this.rowsWindowed() && this.maxHeight ? "max-height:" + this.maxHeight + ";overflow:auto;--rozie-data-table-max-height:" + this.maxHeight : "overflow:auto")} data-rozie-s-d5dcab4c>
|
|
3843
4268
|
<table class="${Object.entries({
|
|
3844
4269
|
"rozie-data-table": true,
|
|
3845
|
-
"rdt-sticky": this.stickyHeader
|
|
4270
|
+
"rdt-sticky": this.stickyHeader,
|
|
4271
|
+
"rdt-col-windowed": this.colsWindowed()
|
|
3846
4272
|
}).filter(([, v]) => v).map(([k]) => k).join(" ")}" role=${(0, _rozie_runtime_lit.rozieAttr)(this.tableRole())} aria-rowcount=${(0, _rozie_runtime_lit.rozieAttr)(this.gridAriaRowCount())} @keydown=${($event) => {
|
|
3847
4273
|
this.onGridKeyDown($event);
|
|
3848
4274
|
}} @focusin=${($event) => {
|
|
@@ -3858,14 +4284,15 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
3858
4284
|
}} data-rozie-s-d5dcab4c>
|
|
3859
4285
|
<thead class="rdt-thead" role="rowgroup" data-rozie-s-d5dcab4c>
|
|
3860
4286
|
${(0, lit_directives_repeat_js.repeat)(this._headerGroups.value, (hg, hgLevel) => hg.id, (hg, hgLevel) => lit.html`<tr class="rdt-tr" role="row" aria-rowindex=${(0, _rozie_runtime_lit.rozieAttr)(hgLevel + 1)} data-rozie-s-d5dcab4c>
|
|
3861
|
-
|
|
4287
|
+
|
|
4288
|
+
${this.colsWindowed() ? lit.html`<th class="rdt-col-spacer" aria-hidden="true" style=${(0, _rozie_runtime_lit.rozieStyle)("width:" + this.colPadLeft() + "px;padding:0;border:0")} data-rozie-s-d5dcab4c></th>` : lit.nothing}${(0, lit_directives_repeat_js.repeat)(this.windowedHeadersFor(hg, hgLevel), (wh, _idx) => wh.header.id, (wh, _idx) => lit.html`<th class="${Object.entries({
|
|
3862
4289
|
"rdt-th": true,
|
|
3863
|
-
"rdt-select-th": this.isSelectColumn(header.column.id),
|
|
3864
|
-
"rdt-expander-th": this.isExpanderColumn(header.column.id),
|
|
3865
|
-
"rdt-th-resizing": this.columnIsResizing(header.column.id),
|
|
3866
|
-
"rdt-cell-active": this.isActiveCell("__header", this.headerColIndexOf(hg, header), hgLevel)
|
|
3867
|
-
}).filter(([, v]) => v).map(([k]) => k).join(" ")}" role="columnheader" data-col=${(0, _rozie_runtime_lit.rozieAttr)(header.column.id)} data-grid-cell="" data-row="__header" data-header-level=${(0, _rozie_runtime_lit.rozieAttr)(hgLevel)} colspan=${(0, _rozie_runtime_lit.rozieAttr)(
|
|
3868
|
-
${this.isSelectColumn(header.column.id) ? lit.html`<span style="display:contents" data-rozie-s-d5dcab4c>
|
|
4290
|
+
"rdt-select-th": this.isSelectColumn(wh.header.column.id),
|
|
4291
|
+
"rdt-expander-th": this.isExpanderColumn(wh.header.column.id),
|
|
4292
|
+
"rdt-th-resizing": this.columnIsResizing(wh.header.column.id),
|
|
4293
|
+
"rdt-cell-active": this.isActiveCell("__header", this.headerColIndexOf(hg, wh.header), hgLevel)
|
|
4294
|
+
}).filter(([, v]) => v).map(([k]) => k).join(" ")}" role="columnheader" data-col=${(0, _rozie_runtime_lit.rozieAttr)(wh.header.column.id)} data-grid-cell="" data-row="__header" data-header-level=${(0, _rozie_runtime_lit.rozieAttr)(hgLevel)} colspan=${(0, _rozie_runtime_lit.rozieAttr)(wh.span > 1 ? wh.span : null)} data-col-index=${(0, _rozie_runtime_lit.rozieAttr)(this.headerColIndexOf(hg, wh.header))} tabindex=${(0, _rozie_runtime_lit.rozieAttr)(this.cellTabindex("__header", this.headerColIndexOf(hg, wh.header), hgLevel))} aria-sort=${(0, _rozie_runtime_lit.rozieAttr)(this.ariaSortFor(wh.header.column.id))} style=${(0, _rozie_runtime_lit.rozieStyle)(this.thStyle(wh.header.column.id))} data-rozie-s-d5dcab4c>
|
|
4295
|
+
${this.isSelectColumn(wh.header.column.id) ? lit.html`<span style="display:contents" data-rozie-s-d5dcab4c>
|
|
3869
4296
|
${this.selectAll !== void 0 ? this.selectAll({
|
|
3870
4297
|
checked: this.isAllRowsSelected(),
|
|
3871
4298
|
indeterminate: this.isSomeRowsSelected(),
|
|
@@ -3883,102 +4310,103 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
3883
4310
|
${this.selectionMode === "multiple" ? lit.html`<input class="rdt-select-all" type="checkbox" aria-label="Select all rows" ?checked=${this.isAllRowsSelected()} @change=${($event) => {
|
|
3884
4311
|
this.onToggleAllRows($event);
|
|
3885
4312
|
}} data-rozie-s-d5dcab4c />` : lit.nothing}</slot>`}
|
|
3886
|
-
</span>` : this.isExpanderColumn(header.column.id) ? lit.html`<span style="display:contents" data-rozie-s-d5dcab4c></span>` : lit.html`<span style="display:contents" data-rozie-s-d5dcab4c>
|
|
3887
|
-
${header.column.getCanSort && header.column.getCanSort() ? lit.html`<button class="rdt-sort-btn" type="button" @click=${($event) => {
|
|
3888
|
-
this.onHeaderSort(header.column.id, $event);
|
|
4313
|
+
</span>` : this.isExpanderColumn(wh.header.column.id) ? lit.html`<span style="display:contents" data-rozie-s-d5dcab4c></span>` : lit.html`<span style="display:contents" data-rozie-s-d5dcab4c>
|
|
4314
|
+
${wh.header.column.getCanSort && wh.header.column.getCanSort() ? lit.html`<button class="rdt-sort-btn" type="button" @click=${($event) => {
|
|
4315
|
+
this.onHeaderSort(wh.header.column.id, $event);
|
|
3889
4316
|
}} data-rozie-s-d5dcab4c>
|
|
3890
4317
|
<span class="rdt-header-label" data-rozie-s-d5dcab4c>
|
|
3891
4318
|
${this.colHeader !== void 0 ? this.colHeader({
|
|
3892
|
-
columnId: header.column.id,
|
|
3893
|
-
column: header.column,
|
|
3894
|
-
label: this.headerLabel(header.column.id)
|
|
4319
|
+
columnId: wh.header.column.id,
|
|
4320
|
+
column: wh.header.column,
|
|
4321
|
+
label: this.headerLabel(wh.header.column.id)
|
|
3895
4322
|
}) : lit.html`<slot name="colHeader" data-rozie-params=${(() => {
|
|
3896
4323
|
try {
|
|
3897
4324
|
return JSON.stringify({
|
|
3898
|
-
columnId: header.column.id,
|
|
3899
|
-
column: header.column,
|
|
3900
|
-
label: this.headerLabel(header.column.id)
|
|
4325
|
+
columnId: wh.header.column.id,
|
|
4326
|
+
column: wh.header.column,
|
|
4327
|
+
label: this.headerLabel(wh.header.column.id)
|
|
3901
4328
|
});
|
|
3902
4329
|
} catch {
|
|
3903
4330
|
return "{}";
|
|
3904
4331
|
}
|
|
3905
|
-
})()}>${(0, _rozie_runtime_lit.rozieDisplay)(this.headerLabel(header.column.id))}</slot>`}
|
|
4332
|
+
})()}>${(0, _rozie_runtime_lit.rozieDisplay)(this.headerLabel(wh.header.column.id))}</slot>`}
|
|
3906
4333
|
</span>
|
|
3907
|
-
<span class="rdt-sort-ind" aria-hidden="true" data-rozie-s-d5dcab4c>${(0, _rozie_runtime_lit.rozieDisplay)(this.sortIndicator(header.column.id))}</span>
|
|
4334
|
+
<span class="rdt-sort-ind" aria-hidden="true" data-rozie-s-d5dcab4c>${(0, _rozie_runtime_lit.rozieDisplay)(this.sortIndicator(wh.header.column.id))}</span>
|
|
3908
4335
|
</button>` : lit.html`<span style="display:contents" data-rozie-s-d5dcab4c>
|
|
3909
4336
|
<span class="rdt-header-label" data-rozie-s-d5dcab4c>
|
|
3910
4337
|
${this.colHeader !== void 0 ? this.colHeader({
|
|
3911
|
-
columnId: header.column.id,
|
|
3912
|
-
column: header.column,
|
|
3913
|
-
label: this.headerLabel(header.column.id)
|
|
4338
|
+
columnId: wh.header.column.id,
|
|
4339
|
+
column: wh.header.column,
|
|
4340
|
+
label: this.headerLabel(wh.header.column.id)
|
|
3914
4341
|
}) : lit.html`<slot name="colHeader" data-rozie-params=${(() => {
|
|
3915
4342
|
try {
|
|
3916
4343
|
return JSON.stringify({
|
|
3917
|
-
columnId: header.column.id,
|
|
3918
|
-
column: header.column,
|
|
3919
|
-
label: this.headerLabel(header.column.id)
|
|
4344
|
+
columnId: wh.header.column.id,
|
|
4345
|
+
column: wh.header.column,
|
|
4346
|
+
label: this.headerLabel(wh.header.column.id)
|
|
3920
4347
|
});
|
|
3921
4348
|
} catch {
|
|
3922
4349
|
return "{}";
|
|
3923
4350
|
}
|
|
3924
|
-
})()}>${(0, _rozie_runtime_lit.rozieDisplay)(this.headerLabel(header.column.id))}</slot>`}
|
|
4351
|
+
})()}>${(0, _rozie_runtime_lit.rozieDisplay)(this.headerLabel(wh.header.column.id))}</slot>`}
|
|
3925
4352
|
</span>
|
|
3926
|
-
</span>`}<rozie-popover trigger="click" placement="bottom-end" strategy="fixed" .offset=${4} data-rozie-s-d5dcab4c><button class="rdt-col-menu-trigger" type="button" aria-label=${(0, _rozie_runtime_lit.rozieAttr)("Column options for " + this.headerLabel(header.column.id))} data-rozie-s-d5dcab4c slot="anchor">⋯</button><div class="rdt-col-menu" role="menu" data-rozie-s-d5dcab4c>
|
|
3927
|
-
<button class="rdt-col-menu-item" type="button" role="menuitem" aria-pressed=${this.columnPinSide(header.column.id) === "left"} @click=${($event) => {
|
|
3928
|
-
this.onPinColumn(header.column.id, "left", $event);
|
|
4353
|
+
</span>`}<rozie-popover trigger="click" placement="bottom-end" strategy="fixed" .offset=${4} data-rozie-s-d5dcab4c><button class="rdt-col-menu-trigger" type="button" aria-label=${(0, _rozie_runtime_lit.rozieAttr)("Column options for " + this.headerLabel(wh.header.column.id))} data-rozie-s-d5dcab4c slot="anchor">⋯</button><div class="rdt-col-menu" role="menu" data-rozie-s-d5dcab4c>
|
|
4354
|
+
<button class="rdt-col-menu-item" type="button" role="menuitem" aria-pressed=${this.columnPinSide(wh.header.column.id) === "left"} @click=${($event) => {
|
|
4355
|
+
this.onPinColumn(wh.header.column.id, "left", $event);
|
|
3929
4356
|
}} data-rozie-s-d5dcab4c>Pin left</button>
|
|
3930
|
-
<button class="rdt-col-menu-item" type="button" role="menuitem" aria-pressed=${this.columnPinSide(header.column.id) === "right"} @click=${($event) => {
|
|
3931
|
-
this.onPinColumn(header.column.id, "right", $event);
|
|
4357
|
+
<button class="rdt-col-menu-item" type="button" role="menuitem" aria-pressed=${this.columnPinSide(wh.header.column.id) === "right"} @click=${($event) => {
|
|
4358
|
+
this.onPinColumn(wh.header.column.id, "right", $event);
|
|
3932
4359
|
}} data-rozie-s-d5dcab4c>Pin right</button>
|
|
3933
|
-
<button class="rdt-col-menu-item" type="button" role="menuitem" aria-pressed=${!this.columnPinSide(header.column.id)} @click=${($event) => {
|
|
3934
|
-
this.onPinColumn(header.column.id, false, $event);
|
|
4360
|
+
<button class="rdt-col-menu-item" type="button" role="menuitem" aria-pressed=${!this.columnPinSide(wh.header.column.id)} @click=${($event) => {
|
|
4361
|
+
this.onPinColumn(wh.header.column.id, false, $event);
|
|
3935
4362
|
}} data-rozie-s-d5dcab4c>Unpin</button>
|
|
3936
4363
|
<hr class="rdt-col-menu-sep" data-rozie-s-d5dcab4c />
|
|
3937
4364
|
<button class="rdt-col-menu-item" type="button" role="menuitem" @click=${($event) => {
|
|
3938
|
-
this.onHideColumn(header.column.id, $event);
|
|
4365
|
+
this.onHideColumn(wh.header.column.id, $event);
|
|
3939
4366
|
}} data-rozie-s-d5dcab4c>Hide column</button>
|
|
3940
4367
|
</div></rozie-popover>
|
|
3941
|
-
<button class="rdt-resize-handle" type="button" aria-label=${(0, _rozie_runtime_lit.rozieAttr)("Resize " + this.headerLabel(header.column.id))} @pointerdown=${($event) => {
|
|
3942
|
-
this.onResizeStart(header.column.id, $event);
|
|
4368
|
+
<button class="rdt-resize-handle" type="button" aria-label=${(0, _rozie_runtime_lit.rozieAttr)("Resize " + this.headerLabel(wh.header.column.id))} @pointerdown=${($event) => {
|
|
4369
|
+
this.onResizeStart(wh.header.column.id, $event);
|
|
3943
4370
|
}} @touchstart=${($event) => {
|
|
3944
|
-
this.onResizeStart(header.column.id, $event);
|
|
4371
|
+
this.onResizeStart(wh.header.column.id, $event);
|
|
3945
4372
|
}} data-rozie-s-d5dcab4c><span class="rdt-resize-grip" aria-hidden="true" data-rozie-s-d5dcab4c></span></button>
|
|
3946
4373
|
</span>`}</th>`)}
|
|
3947
|
-
|
|
4374
|
+
|
|
4375
|
+
${this.colsWindowed() ? lit.html`<th class="rdt-col-spacer" aria-hidden="true" style=${(0, _rozie_runtime_lit.rozieStyle)("width:" + this.colPadRight() + "px;padding:0;border:0")} data-rozie-s-d5dcab4c></th>` : lit.nothing}</tr>`)}
|
|
3948
4376
|
|
|
3949
4377
|
${this.hasAnyFilterableColumn() ? lit.html`<tr class="rdt-filter-row" data-rozie-s-d5dcab4c>
|
|
3950
|
-
${(0, lit_directives_repeat_js.repeat)(this._headerGroups.value[this._headerGroups.value.length - 1].
|
|
3951
|
-
${this.isSelectColumn(header.column.id) ? lit.html`<span style="display:contents" data-rozie-s-d5dcab4c></span>` : this.isExpanderColumn(header.column.id) ? lit.html`<span style="display:contents" data-rozie-s-d5dcab4c></span>` : lit.html`<span style="display:contents" data-rozie-s-d5dcab4c>
|
|
3952
|
-
${this.columnIsFilterable(header.column.id) && !this.hasFilterSlot() ? lit.html`<input class="rdt-col-filter" type="text" aria-label=${(0, _rozie_runtime_lit.rozieAttr)("Filter " + this.headerLabel(header.column.id))} .value=${this.columnFilterValue(header.column.id)} @input=${($event) => {
|
|
3953
|
-
this.onColumnFilterInput(header.column.id, $event);
|
|
4378
|
+
${this.colsWindowed() ? lit.html`<th class="rdt-col-spacer" aria-hidden="true" style=${(0, _rozie_runtime_lit.rozieStyle)("width:" + this.colPadLeft() + "px;padding:0;border:0")} data-rozie-s-d5dcab4c></th>` : lit.nothing}${(0, lit_directives_repeat_js.repeat)(this.windowedHeadersFor(this._headerGroups.value[this._headerGroups.value.length - 1], this._headerGroups.value.length - 1), (wh, _idx) => wh.header.id, (wh, _idx) => lit.html`<th class="rdt-filter-cell" role="presentation" data-col=${(0, _rozie_runtime_lit.rozieAttr)(wh.header.column.id)} style=${(0, _rozie_runtime_lit.rozieStyle)(this.pinStyle(wh.header.column.id))} data-rozie-s-d5dcab4c>
|
|
4379
|
+
${this.isSelectColumn(wh.header.column.id) ? lit.html`<span style="display:contents" data-rozie-s-d5dcab4c></span>` : this.isExpanderColumn(wh.header.column.id) ? lit.html`<span style="display:contents" data-rozie-s-d5dcab4c></span>` : lit.html`<span style="display:contents" data-rozie-s-d5dcab4c>
|
|
4380
|
+
${this.columnIsFilterable(wh.header.column.id) && !this.hasFilterSlot() ? lit.html`<input class="rdt-col-filter" type="text" aria-label=${(0, _rozie_runtime_lit.rozieAttr)("Filter " + this.headerLabel(wh.header.column.id))} .value=${this.columnFilterValue(wh.header.column.id)} @input=${($event) => {
|
|
4381
|
+
this.onColumnFilterInput(wh.header.column.id, $event);
|
|
3954
4382
|
}} @click=${($event) => {
|
|
3955
4383
|
this.stopEvent($event);
|
|
3956
|
-
}} data-rozie-s-d5dcab4c />` : lit.nothing}${this.columnIsFilterable(header.column.id) ? lit.html`<span style="display:contents" data-rozie-s-d5dcab4c>
|
|
4384
|
+
}} data-rozie-s-d5dcab4c />` : lit.nothing}${this.columnIsFilterable(wh.header.column.id) ? lit.html`<span style="display:contents" data-rozie-s-d5dcab4c>
|
|
3957
4385
|
${this.filter !== void 0 ? this.filter({
|
|
3958
|
-
columnId: header.column.id,
|
|
3959
|
-
value: this.columnFilterValue(header.column.id),
|
|
3960
|
-
uniqueValues: this.getFacetedUniqueValues(header.column.id),
|
|
3961
|
-
minMax: this.getFacetedMinMaxValues(header.column.id),
|
|
4386
|
+
columnId: wh.header.column.id,
|
|
4387
|
+
value: this.columnFilterValue(wh.header.column.id),
|
|
4388
|
+
uniqueValues: this.getFacetedUniqueValues(wh.header.column.id),
|
|
4389
|
+
minMax: this.getFacetedMinMaxValues(wh.header.column.id),
|
|
3962
4390
|
setFilter: this.setColumnFilter
|
|
3963
4391
|
}) : lit.html`<slot name="filter" data-rozie-params=${(() => {
|
|
3964
4392
|
try {
|
|
3965
4393
|
return JSON.stringify({
|
|
3966
|
-
columnId: header.column.id,
|
|
3967
|
-
value: this.columnFilterValue(header.column.id),
|
|
3968
|
-
uniqueValues: this.getFacetedUniqueValues(header.column.id),
|
|
3969
|
-
minMax: this.getFacetedMinMaxValues(header.column.id)
|
|
4394
|
+
columnId: wh.header.column.id,
|
|
4395
|
+
value: this.columnFilterValue(wh.header.column.id),
|
|
4396
|
+
uniqueValues: this.getFacetedUniqueValues(wh.header.column.id),
|
|
4397
|
+
minMax: this.getFacetedMinMaxValues(wh.header.column.id)
|
|
3970
4398
|
});
|
|
3971
4399
|
} catch {
|
|
3972
4400
|
return "{}";
|
|
3973
4401
|
}
|
|
3974
4402
|
})()} @rozie-filter-set-filter=${($event) => this.setColumnFilter($event.detail)}></slot>`}
|
|
3975
4403
|
</span>` : lit.nothing}</span>`}</th>`)}
|
|
3976
|
-
|
|
4404
|
+
${this.colsWindowed() ? lit.html`<th class="rdt-col-spacer" aria-hidden="true" style=${(0, _rozie_runtime_lit.rozieStyle)("width:" + this.colPadRight() + "px;padding:0;border:0")} data-rozie-s-d5dcab4c></th>` : lit.nothing}</tr>` : lit.nothing}</thead>
|
|
3977
4405
|
|
|
3978
4406
|
<tbody class="rdt-tbody" role="rowgroup" data-rozie-s-d5dcab4c>
|
|
3979
4407
|
|
|
3980
4408
|
<tr class="rdt-spacer" aria-hidden="true" data-rozie-s-d5dcab4c>
|
|
3981
|
-
<td colspan=${(0, _rozie_runtime_lit.rozieAttr)(this.
|
|
4409
|
+
<td colspan=${(0, _rozie_runtime_lit.rozieAttr)(this.windowedColSpan())} style=${(0, _rozie_runtime_lit.rozieStyle)("height:" + this.padTop() + "px;padding:0;border:0")} data-rozie-s-d5dcab4c></td>
|
|
3982
4410
|
</tr>
|
|
3983
4411
|
|
|
3984
4412
|
${(0, lit_directives_repeat_js.repeat)(this.windowedRows(), (wr, _idx) => wr.row.id, (wr, _idx) => lit.html`
|
|
@@ -3987,7 +4415,8 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
3987
4415
|
"rdt-group-header": this.rowIsGrouped(wr.row),
|
|
3988
4416
|
"rdt-row-pinned": wr.pinned
|
|
3989
4417
|
}).filter(([, v]) => v).map(([k]) => k).join(" ")}" role="row" data-row=${(0, _rozie_runtime_lit.rozieAttr)(wr.vi.index)} aria-rowindex=${(0, _rozie_runtime_lit.rozieAttr)(this.headerRowCount() + wr.vi.index + 1)} data-index=${(0, _rozie_runtime_lit.rozieAttr)(wr.vi.index)} data-pinned=${(0, _rozie_runtime_lit.rozieAttr)(wr.pinned ? "true" : null)} data-depth=${(0, _rozie_runtime_lit.rozieAttr)(wr.row.depth)} data-group-header=${(0, _rozie_runtime_lit.rozieAttr)(this.rowIsGrouped(wr.row) ? wr.row.id : null)} data-group-leaf=${(0, _rozie_runtime_lit.rozieAttr)(this.groupingActive() && !this.rowIsGrouped(wr.row) ? wr.row.id : null)} aria-expanded=${(0, _rozie_runtime_lit.rozieAttr)(this.rowIsGrouped(wr.row) ? !!this.rowIsExpanded(wr.row) : null)} aria-selected=${(0, _rozie_runtime_lit.rozieAttr)(this.selectionMode !== "none" ? !!this.rowIsSelected(wr.row) : null)} aria-level=${(0, _rozie_runtime_lit.rozieAttr)(this.groupingActive() ? wr.row.depth + 1 : null)} data-rozie-s-d5dcab4c>
|
|
3990
|
-
|
|
4418
|
+
|
|
4419
|
+
${this.colsWindowed() ? lit.html`<td class="rdt-col-spacer" aria-hidden="true" style=${(0, _rozie_runtime_lit.rozieStyle)("width:" + this.colPadLeft() + "px;padding:0;border:0")} data-rozie-s-d5dcab4c></td>` : lit.nothing}${(0, lit_directives_repeat_js.repeat)(this.windowedCells(wr.row), (cell, _idx) => cell.id, (cell, _idx) => lit.html`<td class="${Object.entries({
|
|
3991
4420
|
"rdt-td": true,
|
|
3992
4421
|
"rdt-select-td": this.isSelectColumn(cell.column.id),
|
|
3993
4422
|
"rdt-expander-td": this.isExpanderColumn(cell.column.id),
|
|
@@ -4000,13 +4429,13 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4000
4429
|
this.onToggleExpand(wr.row, $event);
|
|
4001
4430
|
}} data-rozie-s-d5dcab4c>${(0, _rozie_runtime_lit.rozieDisplay)(this.rowIsExpanded(wr.row) ? "▾" : "▸")}</button>` : lit.nothing}</span>` : this.isSelectColumn(cell.column.id) ? lit.html`<span style="display:contents" data-rozie-s-d5dcab4c>
|
|
4002
4431
|
${this.selectCell !== void 0 ? this.selectCell({
|
|
4003
|
-
row: wr.row
|
|
4432
|
+
row: this.cellSlotRow(wr.row),
|
|
4004
4433
|
checked: this.rowIsSelected(wr.row),
|
|
4005
4434
|
toggle: (e) => this.onToggleRow(wr.row, e)
|
|
4006
4435
|
}) : lit.html`<slot name="selectCell" data-rozie-params=${(() => {
|
|
4007
4436
|
try {
|
|
4008
4437
|
return JSON.stringify({
|
|
4009
|
-
row: wr.row
|
|
4438
|
+
row: this.cellSlotRow(wr.row),
|
|
4010
4439
|
checked: this.rowIsSelected(wr.row)
|
|
4011
4440
|
});
|
|
4012
4441
|
} catch {
|
|
@@ -4025,14 +4454,14 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4025
4454
|
${this.cell !== void 0 ? this.cell({
|
|
4026
4455
|
columnId: cell.column.id,
|
|
4027
4456
|
column: cell.column,
|
|
4028
|
-
row: wr.row
|
|
4457
|
+
row: this.cellSlotRow(wr.row),
|
|
4029
4458
|
value: cell.getValue()
|
|
4030
4459
|
}) : lit.html`<slot name="cell" data-rozie-params=${(() => {
|
|
4031
4460
|
try {
|
|
4032
4461
|
return JSON.stringify({
|
|
4033
4462
|
columnId: cell.column.id,
|
|
4034
4463
|
column: cell.column,
|
|
4035
|
-
row: wr.row
|
|
4464
|
+
row: this.cellSlotRow(wr.row),
|
|
4036
4465
|
value: cell.getValue()
|
|
4037
4466
|
});
|
|
4038
4467
|
} catch {
|
|
@@ -4046,7 +4475,7 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4046
4475
|
${this.editor !== void 0 ? this.editor({
|
|
4047
4476
|
columnId: cell.column.id,
|
|
4048
4477
|
column: cell.column,
|
|
4049
|
-
row: wr.row
|
|
4478
|
+
row: this.cellSlotRow(wr.row),
|
|
4050
4479
|
value: this.editorValueFor(cell.column.id),
|
|
4051
4480
|
commit: this.editorCommitFor(cell.column.id),
|
|
4052
4481
|
cancel: this.editorCancelFor(),
|
|
@@ -4056,7 +4485,7 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4056
4485
|
return JSON.stringify({
|
|
4057
4486
|
columnId: cell.column.id,
|
|
4058
4487
|
column: cell.column,
|
|
4059
|
-
row: wr.row
|
|
4488
|
+
row: this.cellSlotRow(wr.row),
|
|
4060
4489
|
value: this.editorValueFor(cell.column.id),
|
|
4061
4490
|
commit: this.editorCommitFor(cell.column.id),
|
|
4062
4491
|
cancel: this.editorCancelFor(),
|
|
@@ -4096,14 +4525,14 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4096
4525
|
${this.cell !== void 0 ? this.cell({
|
|
4097
4526
|
columnId: cell.column.id,
|
|
4098
4527
|
column: cell.column,
|
|
4099
|
-
row: wr.row
|
|
4528
|
+
row: this.cellSlotRow(wr.row),
|
|
4100
4529
|
value: cell.getValue()
|
|
4101
4530
|
}) : lit.html`<slot name="cell" data-rozie-params=${(() => {
|
|
4102
4531
|
try {
|
|
4103
4532
|
return JSON.stringify({
|
|
4104
4533
|
columnId: cell.column.id,
|
|
4105
4534
|
column: cell.column,
|
|
4106
|
-
row: wr.row
|
|
4535
|
+
row: this.cellSlotRow(wr.row),
|
|
4107
4536
|
value: cell.getValue()
|
|
4108
4537
|
});
|
|
4109
4538
|
} catch {
|
|
@@ -4113,10 +4542,11 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4113
4542
|
</span>`}${this.isFillHandleCell(wr.vi.index, this.colIndexOf(wr.row, cell)) ? lit.html`<span class="rdt-fill-handle" data-fill-handle="" data-testid="fill-handle" aria-hidden="true" @pointerdown=${($event) => {
|
|
4114
4543
|
this.onFillHandlePointerDown($event);
|
|
4115
4544
|
}} data-rozie-s-d5dcab4c></span>` : lit.nothing}</td>`)}
|
|
4116
|
-
|
|
4545
|
+
|
|
4546
|
+
${this.colsWindowed() ? lit.html`<td class="rdt-col-spacer" aria-hidden="true" style=${(0, _rozie_runtime_lit.rozieStyle)("width:" + this.colPadRight() + "px;padding:0;border:0")} data-rozie-s-d5dcab4c></td>` : lit.nothing}</tr>
|
|
4117
4547
|
|
|
4118
4548
|
${this.rowShowsDetail(wr.row) ? lit.html`<tr class="rdt-detail-row" role="row" data-detail-row=${(0, _rozie_runtime_lit.rozieAttr)(wr.row.id)} data-rozie-s-d5dcab4c>
|
|
4119
|
-
<td class="rdt-detail-cell" colspan=${(0, _rozie_runtime_lit.rozieAttr)(this.
|
|
4549
|
+
<td class="rdt-detail-cell" colspan=${(0, _rozie_runtime_lit.rozieAttr)(this.windowedColSpan())} data-rozie-s-d5dcab4c>
|
|
4120
4550
|
${this.detail !== void 0 ? this.detail({ row: wr.row.original }) : lit.html`<slot name="detail" data-rozie-params=${(() => {
|
|
4121
4551
|
try {
|
|
4122
4552
|
return JSON.stringify({ row: wr.row.original });
|
|
@@ -4128,7 +4558,7 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4128
4558
|
</tr>` : lit.nothing}`)}
|
|
4129
4559
|
|
|
4130
4560
|
<tr class="rdt-spacer" aria-hidden="true" data-rozie-s-d5dcab4c>
|
|
4131
|
-
<td colspan=${(0, _rozie_runtime_lit.rozieAttr)(this.
|
|
4561
|
+
<td colspan=${(0, _rozie_runtime_lit.rozieAttr)(this.windowedColSpan())} style=${(0, _rozie_runtime_lit.rozieStyle)("height:" + this.padBottom() + "px;padding:0;border:0")} data-rozie-s-d5dcab4c></td>
|
|
4132
4562
|
</tr>
|
|
4133
4563
|
</tbody>
|
|
4134
4564
|
</table>
|
|
@@ -4293,13 +4723,13 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4293
4723
|
this.onToggleExpand(row, $event);
|
|
4294
4724
|
}} data-rozie-s-d5dcab4c>${(0, _rozie_runtime_lit.rozieDisplay)(this.rowIsExpanded(row) ? "▾" : "▸")}</button>` : lit.nothing}</span>` : this.isSelectColumn(cell.column.id) ? lit.html`<span style="display:contents" data-rozie-s-d5dcab4c>
|
|
4295
4725
|
${this.selectCell !== void 0 ? this.selectCell({
|
|
4296
|
-
row: row
|
|
4726
|
+
row: this.cellSlotRow(row),
|
|
4297
4727
|
checked: this.rowIsSelected(row),
|
|
4298
4728
|
toggle: (e) => this.onToggleRow(row, e)
|
|
4299
4729
|
}) : lit.html`<slot name="selectCell" data-rozie-params=${(() => {
|
|
4300
4730
|
try {
|
|
4301
4731
|
return JSON.stringify({
|
|
4302
|
-
row: row
|
|
4732
|
+
row: this.cellSlotRow(row),
|
|
4303
4733
|
checked: this.rowIsSelected(row)
|
|
4304
4734
|
});
|
|
4305
4735
|
} catch {
|
|
@@ -4318,14 +4748,14 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4318
4748
|
${this.cell !== void 0 ? this.cell({
|
|
4319
4749
|
columnId: cell.column.id,
|
|
4320
4750
|
column: cell.column,
|
|
4321
|
-
row: row
|
|
4751
|
+
row: this.cellSlotRow(row),
|
|
4322
4752
|
value: cell.getValue()
|
|
4323
4753
|
}) : lit.html`<slot name="cell" data-rozie-params=${(() => {
|
|
4324
4754
|
try {
|
|
4325
4755
|
return JSON.stringify({
|
|
4326
4756
|
columnId: cell.column.id,
|
|
4327
4757
|
column: cell.column,
|
|
4328
|
-
row: row
|
|
4758
|
+
row: this.cellSlotRow(row),
|
|
4329
4759
|
value: cell.getValue()
|
|
4330
4760
|
});
|
|
4331
4761
|
} catch {
|
|
@@ -4339,7 +4769,7 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4339
4769
|
${this.editor !== void 0 ? this.editor({
|
|
4340
4770
|
columnId: cell.column.id,
|
|
4341
4771
|
column: cell.column,
|
|
4342
|
-
row: row
|
|
4772
|
+
row: this.cellSlotRow(row),
|
|
4343
4773
|
value: this.editorValueFor(cell.column.id),
|
|
4344
4774
|
commit: this.editorCommitFor(cell.column.id),
|
|
4345
4775
|
cancel: this.editorCancelFor(),
|
|
@@ -4349,7 +4779,7 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4349
4779
|
return JSON.stringify({
|
|
4350
4780
|
columnId: cell.column.id,
|
|
4351
4781
|
column: cell.column,
|
|
4352
|
-
row: row
|
|
4782
|
+
row: this.cellSlotRow(row),
|
|
4353
4783
|
value: this.editorValueFor(cell.column.id),
|
|
4354
4784
|
commit: this.editorCommitFor(cell.column.id),
|
|
4355
4785
|
cancel: this.editorCancelFor(),
|
|
@@ -4389,14 +4819,14 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4389
4819
|
${this.cell !== void 0 ? this.cell({
|
|
4390
4820
|
columnId: cell.column.id,
|
|
4391
4821
|
column: cell.column,
|
|
4392
|
-
row: row
|
|
4822
|
+
row: this.cellSlotRow(row),
|
|
4393
4823
|
value: cell.getValue()
|
|
4394
4824
|
}) : lit.html`<slot name="cell" data-rozie-params=${(() => {
|
|
4395
4825
|
try {
|
|
4396
4826
|
return JSON.stringify({
|
|
4397
4827
|
columnId: cell.column.id,
|
|
4398
4828
|
column: cell.column,
|
|
4399
|
-
row: row
|
|
4829
|
+
row: this.cellSlotRow(row),
|
|
4400
4830
|
value: cell.getValue()
|
|
4401
4831
|
});
|
|
4402
4832
|
} catch {
|
|
@@ -4420,7 +4850,7 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4420
4850
|
</td>
|
|
4421
4851
|
</tr>` : lit.nothing}`)}
|
|
4422
4852
|
</tbody>
|
|
4423
|
-
</table>`}${!this.
|
|
4853
|
+
</table>`}${!this.rowsWindowed() ? lit.html`<div class="rdt-pagination" role="group" aria-label="Pagination" data-rozie-s-d5dcab4c>
|
|
4424
4854
|
<button class="rdt-page-btn rdt-page-prev" type="button" ?disabled=${!this.canPrevPage()} @click=${($event) => {
|
|
4425
4855
|
this.onPrevPage();
|
|
4426
4856
|
}} data-rozie-s-d5dcab4c>Prev</button>
|
|
@@ -4608,14 +5038,15 @@ __decorate([(0, lit_decorators_js.property)({
|
|
|
4608
5038
|
type: Number,
|
|
4609
5039
|
reflect: true
|
|
4610
5040
|
})], DataTable.prototype, "undoLimit", void 0);
|
|
4611
|
-
__decorate([(0, lit_decorators_js.property)({
|
|
4612
|
-
type: Boolean,
|
|
4613
|
-
reflect: true
|
|
4614
|
-
})], DataTable.prototype, "virtual", void 0);
|
|
5041
|
+
__decorate([(0, lit_decorators_js.property)({ converter: { fromAttribute: (v) => v === null ? false : v === "true" ? true : v === "false" ? false : v === "" ? true : v } })], DataTable.prototype, "virtual", void 0);
|
|
4615
5042
|
__decorate([(0, lit_decorators_js.property)({
|
|
4616
5043
|
type: Number,
|
|
4617
5044
|
reflect: true
|
|
4618
5045
|
})], DataTable.prototype, "estimateRowHeight", void 0);
|
|
5046
|
+
__decorate([(0, lit_decorators_js.property)({
|
|
5047
|
+
type: Boolean,
|
|
5048
|
+
reflect: true
|
|
5049
|
+
})], DataTable.prototype, "autoMeasure", void 0);
|
|
4619
5050
|
__decorate([(0, lit_decorators_js.property)({
|
|
4620
5051
|
type: String,
|
|
4621
5052
|
reflect: true
|