@rozie-ui/data-table-lit 0.4.0 → 0.6.0
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 +93 -82
- package/dist/index.cjs +1032 -141
- package/dist/index.d.cts +190 -32
- package/dist/index.d.mts +190 -32
- package/dist/index.mjs +1032 -141
- package/package.json +2 -2
- package/src/Column.ts +3 -3
- package/src/DataTable.ts +1466 -134
- package/src/EditorCheckbox.ts +35 -2
- package/src/EditorDate.ts +59 -6
- package/src/EditorNumber.ts +47 -5
- package/src/EditorSelect.ts +48 -7
- package/src/EditorText.ts +38 -6
- package/src/FilterNumberRange.ts +77 -9
- package/src/FilterSelect.ts +17 -2
- package/src/FilterText.ts +47 -6
- package/src/GroupBar.ts +76 -3
- package/src/helpers/columnDefUtils.ts +73 -1
- package/src/helpers/dateValue.ts +55 -0
- package/src/themes/base.css +122 -88
- package/src/themes/bootstrap.css +60 -24
- package/src/themes/material.css +54 -22
- package/src/themes/shadcn.css +59 -23
package/dist/index.cjs
CHANGED
|
@@ -57,6 +57,48 @@ const collectGroupableLeafDefs = (defs) => {
|
|
|
57
57
|
}
|
|
58
58
|
return out;
|
|
59
59
|
};
|
|
60
|
+
const EDITOR_KINDS = [
|
|
61
|
+
"text",
|
|
62
|
+
"number",
|
|
63
|
+
"select",
|
|
64
|
+
"checkbox",
|
|
65
|
+
"custom"
|
|
66
|
+
];
|
|
67
|
+
const editorKindWarning = (id, editor) => {
|
|
68
|
+
if (editor == null) return null;
|
|
69
|
+
if (typeof editor === "string" && EDITOR_KINDS.indexOf(editor) !== -1) return null;
|
|
70
|
+
return "[rozie-data-table] column \"" + String(id) + "\": editor=\"" + String(editor) + "\" is not a built-in editor. The built-ins are text | number | select | checkbox; anything else needs editor=\"custom\" plus an #editor slot fill (that is how <EditorDate> is used). Falling back to the text input.";
|
|
71
|
+
};
|
|
72
|
+
const columnSpecsEquivalent = (a, b, depth) => {
|
|
73
|
+
const d = typeof depth === "number" ? depth : 0;
|
|
74
|
+
if (a === b) return true;
|
|
75
|
+
if (d > 4) return false;
|
|
76
|
+
const ta = typeof a;
|
|
77
|
+
if (ta !== typeof b) return false;
|
|
78
|
+
if (ta === "function") try {
|
|
79
|
+
return String(a) === String(b);
|
|
80
|
+
} catch (err) {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
if (ta === "number") return a !== a && b !== b;
|
|
84
|
+
if (a === null || b === null || ta !== "object") return false;
|
|
85
|
+
const aArr = Array.isArray(a);
|
|
86
|
+
if (aArr !== Array.isArray(b)) return false;
|
|
87
|
+
if (aArr) {
|
|
88
|
+
if (a.length !== b.length) return false;
|
|
89
|
+
for (let i = 0; i < a.length; i++) if (!columnSpecsEquivalent(a[i], b[i], d + 1)) return false;
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
const ka = Object.keys(a);
|
|
93
|
+
const kb = Object.keys(b);
|
|
94
|
+
if (ka.length !== kb.length) return false;
|
|
95
|
+
for (let i = 0; i < ka.length; i++) {
|
|
96
|
+
const k = ka[i];
|
|
97
|
+
if (!Object.prototype.hasOwnProperty.call(b, k)) return false;
|
|
98
|
+
if (!columnSpecsEquivalent(a[k], b[k], d + 1)) return false;
|
|
99
|
+
}
|
|
100
|
+
return true;
|
|
101
|
+
};
|
|
60
102
|
//#endregion
|
|
61
103
|
//#region src/helpers/indexMath.ts
|
|
62
104
|
const clamp = (v, lo, hi) => v < lo ? lo : v > hi ? hi : v;
|
|
@@ -267,6 +309,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
267
309
|
defaultValue: null,
|
|
268
310
|
initialControlledValue: void 0
|
|
269
311
|
});
|
|
312
|
+
this.getRowId = null;
|
|
270
313
|
this.getSubRows = null;
|
|
271
314
|
this.groupable = false;
|
|
272
315
|
this._grouping_attr = null;
|
|
@@ -373,9 +416,11 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
373
416
|
this._rangeAnchor = (0, _lit_labs_preact_signals.signal)(null);
|
|
374
417
|
this._rangeFocus = (0, _lit_labs_preact_signals.signal)(null);
|
|
375
418
|
this._pasteAnnounce = (0, _lit_labs_preact_signals.signal)("");
|
|
419
|
+
this._rangeAnnounce = (0, _lit_labs_preact_signals.signal)("");
|
|
376
420
|
this._liveAnnounce = (0, _lit_labs_preact_signals.signal)("");
|
|
377
421
|
this.__rozieWatchInitial_0 = true;
|
|
378
422
|
this.__rozieWatchInitial_1 = true;
|
|
423
|
+
this.__rozieWatchInitial_2 = true;
|
|
379
424
|
this.__rozieCtxProvider_data_table_columns = new _lit_context.ContextProvider(this, {
|
|
380
425
|
context: __rozieCtx_data_table_columns$1,
|
|
381
426
|
initialValue: ((__rozieCtxHost) => ({
|
|
@@ -383,6 +428,8 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
383
428
|
if (id == null) return;
|
|
384
429
|
const key = String(id);
|
|
385
430
|
if (key === "__proto__" || key === "constructor" || key === "prototype") return;
|
|
431
|
+
const prev = __rozieCtxHost._colReg.value ? __rozieCtxHost._colReg.value[key] : void 0;
|
|
432
|
+
if (prev !== void 0 && columnSpecsEquivalent(prev, spec)) return;
|
|
386
433
|
__rozieCtxHost._colReg.value = {
|
|
387
434
|
...__rozieCtxHost._colReg.value,
|
|
388
435
|
[key]: spec
|
|
@@ -402,6 +449,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
402
449
|
this._hasSlotSelectAll = false;
|
|
403
450
|
this._hasSlotDynamicColHeader = false;
|
|
404
451
|
this._hasSlotDynamicFilter = false;
|
|
452
|
+
this._hasSlotPlaceholder = false;
|
|
405
453
|
this._hasSlotSelectCell = false;
|
|
406
454
|
this._hasSlotDynamicCell = false;
|
|
407
455
|
this._hasSlotDynamicEditor = false;
|
|
@@ -421,8 +469,13 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
421
469
|
this.remeasurePending = false;
|
|
422
470
|
this.remeasureRaf = null;
|
|
423
471
|
this.remeasureDisposed = false;
|
|
472
|
+
this.scrollEndPinned = false;
|
|
473
|
+
this.scrollEndPinnedCount = -1;
|
|
474
|
+
this.scrollEndPinnedTop = -1;
|
|
424
475
|
this.GRID_PAGE_STEP = 10;
|
|
425
476
|
this.gridRoot = null;
|
|
477
|
+
this.outsidePointerDown = false;
|
|
478
|
+
this.docPointerDown = null;
|
|
426
479
|
this.programmatic = 0;
|
|
427
480
|
this.focusIntentEpoch = 0;
|
|
428
481
|
this.DATA_WRITE_TOKEN_KEY = "__rozieDataWriteToken";
|
|
@@ -443,6 +496,34 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
443
496
|
left: rail.concat(deduped)
|
|
444
497
|
};
|
|
445
498
|
};
|
|
499
|
+
this.pinSeedApplied = false;
|
|
500
|
+
this.seedColumnPinning = () => {
|
|
501
|
+
if (this.pinSeedApplied) return;
|
|
502
|
+
const live = this.columnPinning != null ? this.columnPinning : this._columnPinningDefault.value;
|
|
503
|
+
const isRealPin = (id) => id !== this.SELECT_COL_ID && id !== this.EXPANDER_COL_ID;
|
|
504
|
+
if ((live && live.left ? live.left : []).filter(isRealPin).length > 0 || (live && live.right ? live.right : []).filter(isRealPin).length > 0) {
|
|
505
|
+
this.pinSeedApplied = true;
|
|
506
|
+
return;
|
|
507
|
+
}
|
|
508
|
+
const defs = this.columnDefs();
|
|
509
|
+
if (!defs.length) return;
|
|
510
|
+
const left = [];
|
|
511
|
+
const right = [];
|
|
512
|
+
for (let i = 0; i < defs.length; i++) {
|
|
513
|
+
const def = defs[i];
|
|
514
|
+
if (!def) continue;
|
|
515
|
+
if (def.pinned === "left") left.push(def.id);
|
|
516
|
+
else if (def.pinned === "right") right.push(def.id);
|
|
517
|
+
}
|
|
518
|
+
if (!left.length && !right.length) return;
|
|
519
|
+
this.pinSeedApplied = true;
|
|
520
|
+
const seeded = {
|
|
521
|
+
left,
|
|
522
|
+
right
|
|
523
|
+
};
|
|
524
|
+
this._columnPinningDefault.value = seeded;
|
|
525
|
+
this._columnPinningControllable.write(seeded);
|
|
526
|
+
};
|
|
446
527
|
this.currentState = () => ({
|
|
447
528
|
sorting: this.sorting != null ? this.sorting : this._sortingDefault.value,
|
|
448
529
|
globalFilter: this.globalFilter != null ? this.globalFilter : this._globalFilterDefault.value,
|
|
@@ -458,6 +539,26 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
458
539
|
columnSizingInfo: this._columnSizingInfo.value
|
|
459
540
|
});
|
|
460
541
|
this.currentData = () => this.data != null ? this.data : this._dataDefault.value;
|
|
542
|
+
this.parseWidthToSize = (w) => {
|
|
543
|
+
if (typeof w === "number") return Number.isFinite(w) && w > 0 ? w : null;
|
|
544
|
+
if (typeof w !== "string") return null;
|
|
545
|
+
const t = w.trim();
|
|
546
|
+
if (t === "") return null;
|
|
547
|
+
const m = /^(\d+(?:\.\d+)?)(px)?$/i.exec(t);
|
|
548
|
+
if (!m) return null;
|
|
549
|
+
const n = Number.parseFloat(m[1]);
|
|
550
|
+
return Number.isFinite(n) && n > 0 ? n : null;
|
|
551
|
+
};
|
|
552
|
+
this.editorWarned = Object.create(null);
|
|
553
|
+
this.checkEditorKind = (id, editor) => {
|
|
554
|
+
const msg = editorKindWarning(id, editor);
|
|
555
|
+
if (!msg) return editor;
|
|
556
|
+
const key = id + "\0" + String(editor);
|
|
557
|
+
if (this.editorWarned[key]) return editor;
|
|
558
|
+
this.editorWarned[key] = true;
|
|
559
|
+
console.warn(msg);
|
|
560
|
+
return editor;
|
|
561
|
+
};
|
|
461
562
|
this.buildConfigDef = (c) => {
|
|
462
563
|
if (!c) return null;
|
|
463
564
|
if (Array.isArray(c.columns)) {
|
|
@@ -494,9 +595,10 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
494
595
|
aggregationFn: wrapAggregationFn(c.aggregationFn),
|
|
495
596
|
pinned: c.pinned != null ? c.pinned : "",
|
|
496
597
|
width: c.width != null ? c.width : "",
|
|
598
|
+
...this.parseWidthToSize(c.width) != null ? { size: this.parseWidthToSize(c.width) } : {},
|
|
497
599
|
meta: {
|
|
498
600
|
editable: c.editable === true,
|
|
499
|
-
editor: c.editor != null ? c.editor : "text",
|
|
601
|
+
editor: c.editor != null ? this.checkEditorKind(id, c.editor) : "text",
|
|
500
602
|
editorOptions: c.editorOptions != null ? c.editorOptions : [],
|
|
501
603
|
validate: typeof c.validate === "function" ? c.validate : null
|
|
502
604
|
}
|
|
@@ -536,9 +638,10 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
536
638
|
aggregationFn: wrapAggregationFn(spec.aggregationFn),
|
|
537
639
|
pinned: spec.pinned != null ? spec.pinned : "",
|
|
538
640
|
width: spec.width != null ? spec.width : "",
|
|
641
|
+
...this.parseWidthToSize(spec.width) != null ? { size: this.parseWidthToSize(spec.width) } : {},
|
|
539
642
|
meta: {
|
|
540
643
|
editable: spec.editable === true,
|
|
541
|
-
editor: spec.editor != null ? spec.editor : "text",
|
|
644
|
+
editor: spec.editor != null ? this.checkEditorKind(id, spec.editor) : "text",
|
|
542
645
|
editorOptions: spec.editorOptions != null ? spec.editorOptions : [],
|
|
543
646
|
validate: typeof spec.validate === "function" ? spec.validate : null
|
|
544
647
|
}
|
|
@@ -839,9 +942,12 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
839
942
|
this.onColumnPinningChangeCb = (updater) => {
|
|
840
943
|
this.writeColumnPinning(applyUpdater(updater, this.currentState().columnPinning));
|
|
841
944
|
};
|
|
945
|
+
this.columnSizingInfoSync = null;
|
|
842
946
|
this.onColumnSizingInfoChangeCb = (updater) => {
|
|
843
|
-
const next = applyUpdater(updater, this._columnSizingInfo.value);
|
|
844
|
-
|
|
947
|
+
const next = applyUpdater(updater, this.columnSizingInfoSync != null ? this.columnSizingInfoSync : this._columnSizingInfo.value);
|
|
948
|
+
if (next == null) return;
|
|
949
|
+
this.columnSizingInfoSync = next;
|
|
950
|
+
this._columnSizingInfo.value = next;
|
|
845
951
|
};
|
|
846
952
|
this.resolveVirtual = () => {
|
|
847
953
|
const v = this.virtual;
|
|
@@ -879,7 +985,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
879
985
|
if (c && c.getIsPinned && c.getIsPinned()) out.push(i);
|
|
880
986
|
}
|
|
881
987
|
}
|
|
882
|
-
if (
|
|
988
|
+
if (this._activeColIndex.value >= 0 && out.indexOf(this._activeColIndex.value) === -1) out.push(this._activeColIndex.value);
|
|
883
989
|
if (this._editingRow.value >= 0 && this._editingCol.value >= 0 && out.indexOf(this._editingCol.value) === -1) out.push(this._editingCol.value);
|
|
884
990
|
return out;
|
|
885
991
|
};
|
|
@@ -900,18 +1006,37 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
900
1006
|
if (this.rowsWindowed()) return this.table.getPrePaginationRowModel().rows;
|
|
901
1007
|
return this.table.getRowModel().rows;
|
|
902
1008
|
};
|
|
1009
|
+
this.REMEASURE_MAX_FRAMES = 10;
|
|
903
1010
|
this.scheduleRemeasure = () => {
|
|
904
1011
|
if (this.remeasureDisposed) return;
|
|
1012
|
+
if (this.virtualizer && this.gridScrollEl && !this.virtualizer.scrollState && this.gridScrollEl.scrollTop !== this.scrollEndPinnedTop) {
|
|
1013
|
+
this.scrollEndPinnedTop = this.gridScrollEl.scrollTop;
|
|
1014
|
+
this.scrollEndPinned = this.virtualizer.getVirtualDistanceFromEnd() <= 1;
|
|
1015
|
+
this.scrollEndPinnedCount = this.windowSource().length;
|
|
1016
|
+
}
|
|
905
1017
|
if (this.remeasurePending) return;
|
|
906
1018
|
this.remeasurePending = true;
|
|
907
1019
|
let ranMicro = false;
|
|
908
1020
|
const microPass = () => {
|
|
909
1021
|
this.remeasureWindow();
|
|
910
1022
|
};
|
|
1023
|
+
let rafAttempts = 0;
|
|
911
1024
|
const rafPass = () => {
|
|
912
1025
|
this.remeasureRaf = null;
|
|
1026
|
+
const covered = this.remeasureWindow();
|
|
1027
|
+
rafAttempts = rafAttempts + 1;
|
|
1028
|
+
if (!covered && rafAttempts < this.REMEASURE_MAX_FRAMES && !this.remeasureDisposed && typeof requestAnimationFrame === "function") {
|
|
1029
|
+
this.remeasureRaf = requestAnimationFrame(rafPass);
|
|
1030
|
+
return;
|
|
1031
|
+
}
|
|
1032
|
+
if (this.scrollEndPinned && this.gridScrollEl && !this.remeasureDisposed && this.windowSource().length === this.scrollEndPinnedCount) {
|
|
1033
|
+
const maxTop = this.gridScrollEl.scrollHeight - this.gridScrollEl.clientHeight;
|
|
1034
|
+
if (maxTop - this.gridScrollEl.scrollTop > 1) {
|
|
1035
|
+
this.gridScrollEl.scrollTop = maxTop;
|
|
1036
|
+
this.scrollEndPinnedTop = this.gridScrollEl.scrollTop;
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
913
1039
|
this.remeasurePending = false;
|
|
914
|
-
this.remeasureWindow();
|
|
915
1040
|
};
|
|
916
1041
|
if (typeof queueMicrotask !== "undefined") {
|
|
917
1042
|
ranMicro = true;
|
|
@@ -933,6 +1058,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
933
1058
|
this.pinnedEditIndex = () => {
|
|
934
1059
|
if (this._editingRow.value >= 0) return this._editingRow.value;
|
|
935
1060
|
if (this._editingRowIndex.value != null) return this._editingRowIndex.value;
|
|
1061
|
+
if (this.interactionMode === "grid" && !this._activeIsHeader.value && this._activeRow.value >= 0) return this._activeRow.value;
|
|
936
1062
|
return -1;
|
|
937
1063
|
};
|
|
938
1064
|
this.pinnedMeasurement = (pin) => {
|
|
@@ -941,12 +1067,84 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
941
1067
|
return ms && ms[pin] ? ms[pin] : null;
|
|
942
1068
|
};
|
|
943
1069
|
this.remeasureWindow = () => {
|
|
944
|
-
if (this.remeasureDisposed) return;
|
|
945
|
-
if (!this.virtualizer || !this.gridRoot) return;
|
|
946
|
-
if (this.virtualizer.scrollState) return;
|
|
1070
|
+
if (this.remeasureDisposed) return true;
|
|
1071
|
+
if (!this.virtualizer || !this.gridRoot) return true;
|
|
1072
|
+
if (this.virtualizer.scrollState) return true;
|
|
947
1073
|
const trs = this.gridRoot.querySelectorAll("tbody.rdt-tbody > tr[data-index]");
|
|
948
|
-
|
|
1074
|
+
const rendered = /* @__PURE__ */ new Set();
|
|
1075
|
+
for (const tr of trs) {
|
|
1076
|
+
this.virtualizer.measureElement(tr);
|
|
1077
|
+
rendered.add(tr.getAttribute("data-index"));
|
|
1078
|
+
}
|
|
1079
|
+
let covered = true;
|
|
1080
|
+
const items = this.virtualizer.getVirtualItems();
|
|
1081
|
+
for (let i = 0; i < items.length; i++) if (!rendered.has(String(items[i].index))) {
|
|
1082
|
+
covered = false;
|
|
1083
|
+
break;
|
|
1084
|
+
}
|
|
949
1085
|
if (this.afterRowRemeasure) this.afterRowRemeasure();
|
|
1086
|
+
return covered;
|
|
1087
|
+
};
|
|
1088
|
+
this.LAZY_PLACEHOLDER_KEY = "__rdtLazyPlaceholder";
|
|
1089
|
+
this.LAZY_PLACEHOLDER_ROW_ID_PREFIX = "__rdt_ph_";
|
|
1090
|
+
this.lazyPlaceholders = {};
|
|
1091
|
+
this.lazyRowsActive = () => this.rowsWindowed() && !!this.manual && this.rowCount != null && this.rowCount > 0;
|
|
1092
|
+
this.isLazyPlaceholder = (orig) => !!orig && orig[this.LAZY_PLACEHOLDER_KEY] === true;
|
|
1093
|
+
this.rowIsLazyPlaceholder = (row) => !!row && this.isLazyPlaceholder(row.original);
|
|
1094
|
+
this.feedData = () => {
|
|
1095
|
+
const d = this.currentData() || [];
|
|
1096
|
+
if (!this.lazyRowsActive()) return d;
|
|
1097
|
+
const n = Math.max(d.length, Number(this.rowCount));
|
|
1098
|
+
const out = new Array(n);
|
|
1099
|
+
for (let i = 0; i < n; i++) {
|
|
1100
|
+
const v = d[i];
|
|
1101
|
+
if (v != null) out[i] = v;
|
|
1102
|
+
else {
|
|
1103
|
+
if (!this.lazyPlaceholders[i]) this.lazyPlaceholders[i] = {
|
|
1104
|
+
[this.LAZY_PLACEHOLDER_KEY]: true,
|
|
1105
|
+
index: i
|
|
1106
|
+
};
|
|
1107
|
+
out[i] = this.lazyPlaceholders[i];
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
return out;
|
|
1111
|
+
};
|
|
1112
|
+
this.migratePlaceholderSizeCache = () => {
|
|
1113
|
+
if (!this.virtualizer || !this.virtualizer.itemSizeCache || !this.table) return;
|
|
1114
|
+
const cache = this.virtualizer.itemSizeCache;
|
|
1115
|
+
const coreRows = this.table.getCoreRowModel().rows;
|
|
1116
|
+
let migrated = false;
|
|
1117
|
+
for (const oldKey of Array.from(cache.keys())) {
|
|
1118
|
+
if (typeof oldKey !== "string" || oldKey.indexOf(this.LAZY_PLACEHOLDER_ROW_ID_PREFIX) !== 0) continue;
|
|
1119
|
+
const row = coreRows[Number(oldKey.slice(this.LAZY_PLACEHOLDER_ROW_ID_PREFIX.length))];
|
|
1120
|
+
if (!row || this.rowIsLazyPlaceholder(row) || row.id === oldKey) continue;
|
|
1121
|
+
cache.set(row.id, cache.get(oldKey));
|
|
1122
|
+
cache.delete(oldKey);
|
|
1123
|
+
migrated = true;
|
|
1124
|
+
}
|
|
1125
|
+
if (!migrated) return;
|
|
1126
|
+
this.virtualizer.itemSizeCache = new Map(cache);
|
|
1127
|
+
if (typeof this.virtualizer.itemSizeCacheVersion === "number") this.virtualizer.itemSizeCacheVersion++;
|
|
1128
|
+
};
|
|
1129
|
+
this.lastRangeStart = -1;
|
|
1130
|
+
this.lastRangeEnd = -1;
|
|
1131
|
+
this.emitVisibleRangeIfChanged = () => {
|
|
1132
|
+
if (!this.rowsWindowed() || !this.virtualizer) return;
|
|
1133
|
+
const items = this.virtualizer.getVirtualItems();
|
|
1134
|
+
if (!items.length) return;
|
|
1135
|
+
const start = items[0].index;
|
|
1136
|
+
const end = items[items.length - 1].index + 1;
|
|
1137
|
+
if (start === this.lastRangeStart && end === this.lastRangeEnd) return;
|
|
1138
|
+
this.lastRangeStart = start;
|
|
1139
|
+
this.lastRangeEnd = end;
|
|
1140
|
+
this.dispatchEvent(new CustomEvent("visible-range-change", {
|
|
1141
|
+
detail: {
|
|
1142
|
+
start,
|
|
1143
|
+
end
|
|
1144
|
+
},
|
|
1145
|
+
bubbles: true,
|
|
1146
|
+
composed: true
|
|
1147
|
+
}));
|
|
950
1148
|
};
|
|
951
1149
|
this.virtualItemKey = (i) => {
|
|
952
1150
|
const src = this.windowSource();
|
|
@@ -1053,6 +1251,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
1053
1251
|
}
|
|
1054
1252
|
}
|
|
1055
1253
|
this.bumpWindowVer();
|
|
1254
|
+
this.scheduleRemeasure();
|
|
1056
1255
|
};
|
|
1057
1256
|
this.virtualizerOptions = () => ({
|
|
1058
1257
|
count: this.windowSource().length,
|
|
@@ -1225,20 +1424,29 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
1225
1424
|
if (filterChanged) return this.totalRowCount() + " results";
|
|
1226
1425
|
return "";
|
|
1227
1426
|
};
|
|
1427
|
+
this.rowIdOption = () => {
|
|
1428
|
+
const f = this.getRowId;
|
|
1429
|
+
return f ? (originalRow, index, parent) => this.isLazyPlaceholder(originalRow) ? this.LAZY_PLACEHOLDER_ROW_ID_PREFIX + originalRow.index : String(f(originalRow, index, parent)) : void 0;
|
|
1430
|
+
};
|
|
1431
|
+
this.rowSelectionOption = () => {
|
|
1432
|
+
if (this.selectionMode === "none") return false;
|
|
1433
|
+
return this.lazyRowsActive() ? (row) => !this.rowIsLazyPlaceholder(row) : true;
|
|
1434
|
+
};
|
|
1228
1435
|
this.reFeed = () => {
|
|
1229
1436
|
if (!this.table) return;
|
|
1230
1437
|
this.table.setOptions((prev) => ({
|
|
1231
1438
|
...prev,
|
|
1232
|
-
data: this.
|
|
1439
|
+
data: this.feedData(),
|
|
1233
1440
|
columns: this.tableColumns(),
|
|
1234
1441
|
state: this.currentState(),
|
|
1235
|
-
enableRowSelection: this.
|
|
1442
|
+
enableRowSelection: this.rowSelectionOption(),
|
|
1236
1443
|
enableMultiRowSelection: this.selectionMode === "multiple",
|
|
1237
1444
|
rowCount: this.rowCount ?? void 0,
|
|
1238
1445
|
pageCount: this.pageCount ?? void 0,
|
|
1239
1446
|
getExpandedRowModel: (0, _tanstack_table_core.getExpandedRowModel)(),
|
|
1240
1447
|
getSubRows: this.getSubRows || void 0,
|
|
1241
|
-
|
|
1448
|
+
getRowId: this.rowIdOption(),
|
|
1449
|
+
getRowCanExpand: this.expandable === true && this.getSubRows == null ? (row) => !this.rowIsLazyPlaceholder(row) : void 0,
|
|
1242
1450
|
onExpandedChange: this.onExpandedChangeCb,
|
|
1243
1451
|
autoResetExpanded: false,
|
|
1244
1452
|
getGroupedRowModel: (0, _tanstack_table_core.getGroupedRowModel)(),
|
|
@@ -1397,9 +1605,9 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
1397
1605
|
if (side === "right") return "position:sticky;right:" + (col.getAfter ? col.getAfter("right") : 0) + "px;z-index:" + zIndex + ";";
|
|
1398
1606
|
return "";
|
|
1399
1607
|
};
|
|
1400
|
-
this.thStyle = (header) => {
|
|
1608
|
+
this.thStyle = (header, widthPx = null) => {
|
|
1401
1609
|
let s = "";
|
|
1402
|
-
const w = this.headerWidth(header);
|
|
1610
|
+
const w = widthPx != null && widthPx > 0 ? widthPx + "px" : this.headerWidth(header);
|
|
1403
1611
|
if (w) s += "width:" + w + ";";
|
|
1404
1612
|
s += this.pinStyle(header && header.column ? header.column.id : null, 2);
|
|
1405
1613
|
return s;
|
|
@@ -1611,6 +1819,16 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
1611
1819
|
this.rowIndexOf = (row) => this.tick() >= 0 ? (this._rows.value || []).indexOf(row) : -1;
|
|
1612
1820
|
this.colIndexOf = (row, cellCtx) => this.tick() >= 0 ? this.visibleCellsFor(row).indexOf(cellCtx) : -1;
|
|
1613
1821
|
this.headerColIndexOf = (hg, header) => (hg && hg.headers ? hg.headers : []).indexOf(header);
|
|
1822
|
+
this.headerLeafStart = (hg, header) => {
|
|
1823
|
+
const list = hg && hg.headers ? hg.headers : [];
|
|
1824
|
+
let leaf = 0;
|
|
1825
|
+
for (let i = 0; i < list.length; i++) {
|
|
1826
|
+
if (list[i] === header) return leaf;
|
|
1827
|
+
const h = list[i];
|
|
1828
|
+
leaf = leaf + (h && h.colSpan > 1 ? h.colSpan : 1);
|
|
1829
|
+
}
|
|
1830
|
+
return -1;
|
|
1831
|
+
};
|
|
1614
1832
|
this.pageRowOffset = () => {
|
|
1615
1833
|
if (!this.isGrid() || this.rowsWindowed()) return 0;
|
|
1616
1834
|
return this.pageIndex() * this.pageSize();
|
|
@@ -1654,14 +1872,15 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
1654
1872
|
const header = nextIsHeader == null ? this._activeIsHeader.value : nextIsHeader;
|
|
1655
1873
|
const rowOut = this.rowsWindowed() && this.virtualizer && this.rowIsOutsideWindow(r);
|
|
1656
1874
|
const colOut = this.colsWindowed() && this.colVirtualizer && this.colIsOutsideWindow(c);
|
|
1657
|
-
|
|
1658
|
-
|
|
1875
|
+
const rowScroll = !header && rowOut;
|
|
1876
|
+
if (rowScroll || colOut) {
|
|
1877
|
+
if (rowScroll) this.virtualizer.scrollToIndex(r, { align: "center" });
|
|
1659
1878
|
if (colOut) this.colVirtualizer.scrollToIndex(c, { align: "center" });
|
|
1660
1879
|
let focusAttempts = 0;
|
|
1661
1880
|
const myEpoch = this.focusIntentEpoch;
|
|
1662
1881
|
const focusWhenReady = () => {
|
|
1663
1882
|
if (this.focusIntentEpoch !== myEpoch) return;
|
|
1664
|
-
const el = this.resolveCellEl(String(r), c);
|
|
1883
|
+
const el = this.resolveCellEl(header ? "__header" : String(r), c, header ? lvl : null);
|
|
1665
1884
|
if (el) {
|
|
1666
1885
|
el.focus();
|
|
1667
1886
|
return;
|
|
@@ -1681,6 +1900,10 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
1681
1900
|
};
|
|
1682
1901
|
this.totalRowCount = () => {
|
|
1683
1902
|
if (!this.table) return (this._rows.value || []).length;
|
|
1903
|
+
if (this.manual === true) {
|
|
1904
|
+
if (this.rowCount != null) return this.rowCount;
|
|
1905
|
+
if (this.pageCount != null) return this.pageCount * this.pageSize();
|
|
1906
|
+
}
|
|
1684
1907
|
const fm = this.table.getFilteredRowModel();
|
|
1685
1908
|
return fm && fm.rows ? fm.rows.length : (this._rows.value || []).length;
|
|
1686
1909
|
};
|
|
@@ -1688,6 +1911,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
1688
1911
|
this.gridAriaRowCount = () => this.headerRowCount() + this.totalRowCount();
|
|
1689
1912
|
this.ariaPageOffset = () => this.table ? this.pageIndex() * this.pageSize() : 0;
|
|
1690
1913
|
this.bodyAriaRowIndex = (row) => this.headerRowCount() + this.rowIndexOf(row) + this.ariaPageOffset() + 1;
|
|
1914
|
+
this.gridAriaColCount = () => this.visibleColCount();
|
|
1691
1915
|
this.visibleColCount = () => {
|
|
1692
1916
|
const rowList = this._rows.value || [];
|
|
1693
1917
|
if (rowList.length) return rowList[0].getVisibleCells().length;
|
|
@@ -1858,6 +2082,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
1858
2082
|
const rowKey = this._activeIsHeader.value ? "__header" : String(this._activeRow.value);
|
|
1859
2083
|
return this.resolveCellEl(rowKey, this._activeColIndex.value, this._activeIsHeader.value ? this._activeHeaderLevel.value : null);
|
|
1860
2084
|
};
|
|
2085
|
+
this.activeCellHasControls = () => focusables(this.currentCellEl()).length > 0;
|
|
1861
2086
|
this.enterControl = () => {
|
|
1862
2087
|
const list = focusables(this.currentCellEl());
|
|
1863
2088
|
if (!list.length) return;
|
|
@@ -1902,10 +2127,10 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
1902
2127
|
let nextLevel = prevLevel;
|
|
1903
2128
|
if ((e.ctrlKey || e.metaKey) && e.shiftKey && !this._activeIsHeader.value && (key === "ArrowUp" || key === "ArrowDown" || key === "ArrowLeft" || key === "ArrowRight")) {
|
|
1904
2129
|
e.preventDefault();
|
|
1905
|
-
if (key === "ArrowUp") this.extendRange(-this.
|
|
1906
|
-
else if (key === "ArrowDown") this.extendRange(this.bodyRowCount() - 1 - this.
|
|
1907
|
-
else if (key === "ArrowLeft") this.extendRange(0, -this.
|
|
1908
|
-
else this.extendRange(0, this.visibleColCount() - 1 - this.
|
|
2130
|
+
if (key === "ArrowUp") this.extendRange(-this.rangeFocusRow(), 0);
|
|
2131
|
+
else if (key === "ArrowDown") this.extendRange(this.bodyRowCount() - 1 - this.rangeFocusRow(), 0);
|
|
2132
|
+
else if (key === "ArrowLeft") this.extendRange(0, -this.rangeFocusCol());
|
|
2133
|
+
else this.extendRange(0, this.visibleColCount() - 1 - this.rangeFocusCol());
|
|
1909
2134
|
return;
|
|
1910
2135
|
} else if ((e.ctrlKey || e.metaKey) && !this._activeIsHeader.value && (key === "ArrowUp" || key === "ArrowDown" || key === "ArrowLeft" || key === "ArrowRight")) {
|
|
1911
2136
|
e.preventDefault();
|
|
@@ -1988,15 +2213,15 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
1988
2213
|
nextCol = en.col;
|
|
1989
2214
|
nextIsHeader = false;
|
|
1990
2215
|
} else nextCol = this.gotoColEdge(true);
|
|
1991
|
-
} else if ((key === "c" || key === "C") && (e.ctrlKey || e.metaKey) && this.clipboardActiveAllowed()) {
|
|
2216
|
+
} else if ((key === "c" || key === "C") && (e.ctrlKey || e.metaKey) && this.clipboardActiveAllowed() && this.clipboardWriteAvailable()) {
|
|
1992
2217
|
e.preventDefault();
|
|
1993
2218
|
this.copyRange();
|
|
1994
2219
|
return;
|
|
1995
|
-
} else if ((key === "v" || key === "V") && (e.ctrlKey || e.metaKey) && this.clipboardActiveAllowed()) {
|
|
2220
|
+
} else if ((key === "v" || key === "V") && (e.ctrlKey || e.metaKey) && this.clipboardActiveAllowed() && this.clipboardReadAvailable()) {
|
|
1996
2221
|
e.preventDefault();
|
|
1997
2222
|
this.pasteRange();
|
|
1998
2223
|
return;
|
|
1999
|
-
} else if ((key === "x" || key === "X") && (e.ctrlKey || e.metaKey) && this.clipboardActiveAllowed()) {
|
|
2224
|
+
} else if ((key === "x" || key === "X") && (e.ctrlKey || e.metaKey) && this.clipboardActiveAllowed() && this.clipboardWriteAvailable()) {
|
|
2000
2225
|
e.preventDefault();
|
|
2001
2226
|
this.cutRange();
|
|
2002
2227
|
return;
|
|
@@ -2026,6 +2251,23 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2026
2251
|
e.preventDefault();
|
|
2027
2252
|
if (!this._activeIsHeader.value) this.selectAllBody();
|
|
2028
2253
|
return;
|
|
2254
|
+
} else if (key === " " && e.shiftKey && !e.ctrlKey && !e.metaKey && !this._activeIsHeader.value) {
|
|
2255
|
+
e.preventDefault();
|
|
2256
|
+
if (this.selectionMode !== "none") {
|
|
2257
|
+
const selRow = (this._rows.value || [])[this._activeRow.value];
|
|
2258
|
+
if (selRow && selRow.toggleSelected) selRow.toggleSelected(!this.rowIsSelected(selRow));
|
|
2259
|
+
}
|
|
2260
|
+
return;
|
|
2261
|
+
} else if (key === " " && (e.ctrlKey || e.metaKey) && !e.shiftKey && !this._activeIsHeader.value) {
|
|
2262
|
+
e.preventDefault();
|
|
2263
|
+
this.selectActiveColumn();
|
|
2264
|
+
return;
|
|
2265
|
+
} else if (key === "Escape") {
|
|
2266
|
+
if (this.rangeActive || this._rangeAnchor.value != null) {
|
|
2267
|
+
e.preventDefault();
|
|
2268
|
+
this.clearRange();
|
|
2269
|
+
}
|
|
2270
|
+
return;
|
|
2029
2271
|
} else if (key === "F2" && e.shiftKey && this.isActiveCellEditable()) {
|
|
2030
2272
|
e.preventDefault();
|
|
2031
2273
|
this.beginRowEdit((this._rows.value || [])[this._activeRow.value]);
|
|
@@ -2051,6 +2293,10 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2051
2293
|
this.onToggleExpand((this._rows.value || [])[this._activeRow.value], e);
|
|
2052
2294
|
this.recoverGridFocus(String(grpRow), grpCol, null, true);
|
|
2053
2295
|
return;
|
|
2296
|
+
} else if (key === "Enter" && !this._activeIsHeader.value && !this.activeCellHasControls()) {
|
|
2297
|
+
e.preventDefault();
|
|
2298
|
+
this.activateRowAt(this._activeRow.value, "keyboard");
|
|
2299
|
+
return;
|
|
2054
2300
|
} else if (key === "Enter" || key === "F2") {
|
|
2055
2301
|
e.preventDefault();
|
|
2056
2302
|
this.enterControl();
|
|
@@ -2105,8 +2351,11 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2105
2351
|
this._activeColIndex.value = col;
|
|
2106
2352
|
if (isHeader !== prevIsHeader || col !== prevCol || (isHeader ? movedLevel !== prevLevel : movedRow !== prevRow)) this.focusIntentEpoch = this.focusIntentEpoch + 1;
|
|
2107
2353
|
if (this.rangeTransition) this.rangeTransition = false;
|
|
2108
|
-
else if (this.rangeClickPending) this.rangeClickPending =
|
|
2109
|
-
else
|
|
2354
|
+
else if (this.rangeClickPending && this.rangeClickPending.isHeader === isHeader && this.rangeClickPending.r === movedRow && this.rangeClickPending.c === col) this.rangeClickPending = null;
|
|
2355
|
+
else {
|
|
2356
|
+
this.rangeClickPending = null;
|
|
2357
|
+
this.clearRange();
|
|
2358
|
+
}
|
|
2110
2359
|
if (tgt === cellEl) this._activeInControl.value = false;
|
|
2111
2360
|
};
|
|
2112
2361
|
this.onGridMouseDown = (e) => {
|
|
@@ -2127,9 +2376,14 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2127
2376
|
this._activeIsHeader.value = false;
|
|
2128
2377
|
this._activeRow.value = row;
|
|
2129
2378
|
this._activeColIndex.value = col;
|
|
2130
|
-
this.rangeClickPending =
|
|
2379
|
+
this.rangeClickPending = {
|
|
2380
|
+
isHeader: false,
|
|
2381
|
+
r: row,
|
|
2382
|
+
c: col
|
|
2383
|
+
};
|
|
2131
2384
|
return;
|
|
2132
2385
|
}
|
|
2386
|
+
if (this.isEditing(row, col)) return;
|
|
2133
2387
|
this.beginRangeDrag(row, col);
|
|
2134
2388
|
};
|
|
2135
2389
|
this.onGridDblClick = (e) => {
|
|
@@ -2157,7 +2411,43 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2157
2411
|
this.beginEdit(row, col, null);
|
|
2158
2412
|
}
|
|
2159
2413
|
};
|
|
2414
|
+
this.activateRowAt = (index, trigger) => {
|
|
2415
|
+
const row = (this._rows.value || [])[index];
|
|
2416
|
+
if (!row || this.rowIsGrouped(row) || this.rowIsLazyPlaceholder(row)) return;
|
|
2417
|
+
this.dispatchEvent(new CustomEvent("row-activate", {
|
|
2418
|
+
detail: {
|
|
2419
|
+
row: row.original,
|
|
2420
|
+
index,
|
|
2421
|
+
trigger
|
|
2422
|
+
},
|
|
2423
|
+
bubbles: true,
|
|
2424
|
+
composed: true
|
|
2425
|
+
}));
|
|
2426
|
+
};
|
|
2427
|
+
this.ROW_ACTIVATE_CONTROLS = "input, button, a[href], select, textarea, label, summary, [contenteditable=\"\"], [contenteditable=\"true\"], [role=\"button\"], [role=\"checkbox\"], [role=\"link\"], [data-editing-cell]";
|
|
2428
|
+
this.maybeActivateRowFromClick = (e) => {
|
|
2429
|
+
if (!e || e.shiftKey || e.ctrlKey || e.metaKey || e.altKey) return;
|
|
2430
|
+
if (this.rangeDragMoved) return;
|
|
2431
|
+
const tgt = e.target;
|
|
2432
|
+
if (!tgt || !tgt.closest) return;
|
|
2433
|
+
const cellEl = tgt.closest("[data-row]");
|
|
2434
|
+
if (!cellEl) return;
|
|
2435
|
+
const control = tgt.closest(this.ROW_ACTIVATE_CONTROLS);
|
|
2436
|
+
if (control && cellEl.contains(control)) return;
|
|
2437
|
+
const rowAttr = cellEl.getAttribute("data-row");
|
|
2438
|
+
if (rowAttr == null || rowAttr === "__header") return;
|
|
2439
|
+
const index = parseInt(rowAttr, 10);
|
|
2440
|
+
if (!Number.isFinite(index)) return;
|
|
2441
|
+
if (this.isGrid() && this.singleClickEdit) {
|
|
2442
|
+
const colAttr = cellEl.getAttribute("data-col-index");
|
|
2443
|
+
const col = colAttr == null ? NaN : parseInt(colAttr, 10);
|
|
2444
|
+
const colId = Number.isFinite(col) ? this.columnIdAt(index, col) : null;
|
|
2445
|
+
if (colId != null && this.columnEditable(colId)) return;
|
|
2446
|
+
}
|
|
2447
|
+
this.activateRowAt(index, "click");
|
|
2448
|
+
};
|
|
2160
2449
|
this.onGridClick = (e) => {
|
|
2450
|
+
this.maybeActivateRowFromClick(e);
|
|
2161
2451
|
if (!this.isGrid() || !e) return;
|
|
2162
2452
|
if (!this.singleClickEdit) return;
|
|
2163
2453
|
if (e.shiftKey) return;
|
|
@@ -2268,7 +2558,8 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2268
2558
|
const headers = hg && hg.headers || [];
|
|
2269
2559
|
if (!this.colsWindowed()) return headers.map((h) => ({
|
|
2270
2560
|
header: h,
|
|
2271
|
-
span: h && h.colSpan > 1 ? h.colSpan : 1
|
|
2561
|
+
span: h && h.colSpan > 1 ? h.colSpan : 1,
|
|
2562
|
+
width: null
|
|
2272
2563
|
}));
|
|
2273
2564
|
const idx = this.windowedColIndices();
|
|
2274
2565
|
const idxSet = {};
|
|
@@ -2282,23 +2573,39 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2282
2573
|
const end = cursor + leafCount;
|
|
2283
2574
|
cursor = end;
|
|
2284
2575
|
let span = 0;
|
|
2285
|
-
|
|
2576
|
+
let width = 0;
|
|
2577
|
+
for (let c = start; c < end; c++) if (idxSet[c]) {
|
|
2578
|
+
span = span + 1;
|
|
2579
|
+
width = width + this.columnSize(c);
|
|
2580
|
+
}
|
|
2286
2581
|
if (span > 0) out.push({
|
|
2287
2582
|
header: h,
|
|
2288
|
-
span
|
|
2583
|
+
span,
|
|
2584
|
+
width
|
|
2289
2585
|
});
|
|
2290
2586
|
}
|
|
2291
2587
|
return out;
|
|
2292
2588
|
};
|
|
2293
2589
|
this.windowedColSpan = () => this.colsWindowed() ? this.windowedColIndices().length + 2 : this.visibleColCount();
|
|
2590
|
+
this.lastColSizeSig = 0;
|
|
2591
|
+
this.remeasureColumnSizes = () => {
|
|
2592
|
+
if (!this.colsWindowed() || !this.colVirtualizer || !this.colVirtualizer.measure) return;
|
|
2593
|
+
const n = this.columnCount();
|
|
2594
|
+
let sig = n;
|
|
2595
|
+
for (let i = 0; i < n; i++) sig = Math.imul(sig, 31) + this.columnSize(i) | 0;
|
|
2596
|
+
if (sig === this.lastColSizeSig) return;
|
|
2597
|
+
this.lastColSizeSig = sig;
|
|
2598
|
+
this.colVirtualizer.measure();
|
|
2599
|
+
};
|
|
2294
2600
|
this.remeasureColumnWindow = () => {
|
|
2295
2601
|
if (!this.colsWindowed() || !this.colVirtualizer) return;
|
|
2296
2602
|
this.colVirtualizer.setOptions(this.columnVirtualizerOptions());
|
|
2603
|
+
this.remeasureColumnSizes();
|
|
2297
2604
|
this.colVirtualizer._willUpdate();
|
|
2298
2605
|
};
|
|
2299
2606
|
this.gridEmptyFallback = false;
|
|
2300
2607
|
this.rangeTransition = false;
|
|
2301
|
-
this.rangeClickPending =
|
|
2608
|
+
this.rangeClickPending = null;
|
|
2302
2609
|
this.rangeActive = false;
|
|
2303
2610
|
this.inRange = (rIdx, cIdx) => {
|
|
2304
2611
|
const a = this._rangeAnchor.value;
|
|
@@ -2340,7 +2647,17 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2340
2647
|
const c1 = a.colIndex > f.colIndex ? a.colIndex : f.colIndex;
|
|
2341
2648
|
return rIdx === r1 && cIdx === c1;
|
|
2342
2649
|
};
|
|
2650
|
+
this.rangeSummary = (anchor, focus) => {
|
|
2651
|
+
if (!anchor || !focus) return "";
|
|
2652
|
+
const rows = Math.abs(focus.rowIndex - anchor.rowIndex) + 1;
|
|
2653
|
+
const cols = Math.abs(focus.colIndex - anchor.colIndex) + 1;
|
|
2654
|
+
if (rows === 1 && cols === 1) return "1 cell selected";
|
|
2655
|
+
const rowPart = rows + (rows === 1 ? " row" : " rows");
|
|
2656
|
+
const colPart = cols + (cols === 1 ? " column" : " columns");
|
|
2657
|
+
return rowPart + " by " + colPart + " selected, " + rows * cols + " cells";
|
|
2658
|
+
};
|
|
2343
2659
|
this.emitRangeChange = (anchor, focus) => {
|
|
2660
|
+
this._rangeAnnounce.value = this.rangeSummary(anchor, focus);
|
|
2344
2661
|
this.dispatchEvent(new CustomEvent("range-change", {
|
|
2345
2662
|
detail: {
|
|
2346
2663
|
anchor,
|
|
@@ -2383,11 +2700,15 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2383
2700
|
this.focusActiveCell(nextRow, nextCol, false);
|
|
2384
2701
|
if (!hadRange || nextRow !== focus.rowIndex || nextCol !== focus.colIndex) this.emitRangeChange(anchor, nextFocus);
|
|
2385
2702
|
};
|
|
2386
|
-
this.setRangeFocus = (rIdx, cIdx) => {
|
|
2703
|
+
this.setRangeFocus = (rIdx, cIdx, anchorR = null, anchorC = null) => {
|
|
2387
2704
|
const maxRow = this.bodyRowCount() - 1;
|
|
2388
2705
|
const maxCol = this.visibleColCount() - 1;
|
|
2389
2706
|
if (maxRow < 0 || maxCol < 0) return;
|
|
2390
2707
|
let anchor = this._rangeAnchor.value;
|
|
2708
|
+
if (!anchor && anchorR != null && anchorC != null) anchor = {
|
|
2709
|
+
rowIndex: clamp(Math.trunc(Number(anchorR)) || 0, 0, maxRow),
|
|
2710
|
+
colIndex: clamp(Math.trunc(Number(anchorC)) || 0, 0, maxCol)
|
|
2711
|
+
};
|
|
2391
2712
|
if (!anchor) anchor = {
|
|
2392
2713
|
rowIndex: this._activeRow.value,
|
|
2393
2714
|
colIndex: this._activeColIndex.value
|
|
@@ -2418,6 +2739,32 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2418
2739
|
this.rangeActive = true;
|
|
2419
2740
|
this.emitRangeChange(anchor, focus);
|
|
2420
2741
|
};
|
|
2742
|
+
this.rangeFocusRow = () => {
|
|
2743
|
+
const f = this._rangeFocus.value;
|
|
2744
|
+
return f && f.rowIndex != null ? f.rowIndex : this._activeRow.value;
|
|
2745
|
+
};
|
|
2746
|
+
this.rangeFocusCol = () => {
|
|
2747
|
+
const f = this._rangeFocus.value;
|
|
2748
|
+
return f && f.colIndex != null ? f.colIndex : this._activeColIndex.value;
|
|
2749
|
+
};
|
|
2750
|
+
this.selectActiveColumn = () => {
|
|
2751
|
+
const maxRow = this.bodyRowCount() - 1;
|
|
2752
|
+
const maxCol = this.visibleColCount() - 1;
|
|
2753
|
+
if (maxRow < 0 || maxCol < 0) return;
|
|
2754
|
+
const c = clamp(Math.trunc(Number(this._activeColIndex.value)) || 0, 0, maxCol);
|
|
2755
|
+
const anchor = {
|
|
2756
|
+
rowIndex: 0,
|
|
2757
|
+
colIndex: c
|
|
2758
|
+
};
|
|
2759
|
+
const focus = {
|
|
2760
|
+
rowIndex: maxRow,
|
|
2761
|
+
colIndex: c
|
|
2762
|
+
};
|
|
2763
|
+
this._rangeAnchor.value = anchor;
|
|
2764
|
+
this._rangeFocus.value = focus;
|
|
2765
|
+
this.rangeActive = true;
|
|
2766
|
+
this.emitRangeChange(anchor, focus);
|
|
2767
|
+
};
|
|
2421
2768
|
this.clearRange = () => {
|
|
2422
2769
|
if (!this.rangeActive) return;
|
|
2423
2770
|
this.rangeActive = false;
|
|
@@ -2497,6 +2844,8 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2497
2844
|
}
|
|
2498
2845
|
return lines.join("\n");
|
|
2499
2846
|
};
|
|
2847
|
+
this.clipboardWriteAvailable = () => typeof navigator !== "undefined" && !!navigator.clipboard && typeof navigator.clipboard.writeText === "function";
|
|
2848
|
+
this.clipboardReadAvailable = () => typeof navigator !== "undefined" && !!navigator.clipboard && typeof navigator.clipboard.readText === "function";
|
|
2500
2849
|
this.copyRange = () => {
|
|
2501
2850
|
if (!this.clipboardActiveAllowed()) return;
|
|
2502
2851
|
if (typeof navigator === "undefined" || !navigator.clipboard || !navigator.clipboard.writeText) return;
|
|
@@ -2505,27 +2854,30 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2505
2854
|
if (p && p.catch) p.catch(() => {});
|
|
2506
2855
|
} catch (err) {}
|
|
2507
2856
|
};
|
|
2508
|
-
this.applyGridToRange = (grid, originRow, originCol) => {
|
|
2857
|
+
this.applyGridToRange = (grid, originRow, originCol, verb) => {
|
|
2858
|
+
const opVerb = typeof verb === "string" && verb !== "" ? verb : "pasted";
|
|
2509
2859
|
const maxRow = this.bodyRowCount() - 1;
|
|
2510
2860
|
const maxCol = this.visibleColCount() - 1;
|
|
2511
2861
|
if (maxRow < 0 || maxCol < 0) return {
|
|
2512
2862
|
wrote: 0,
|
|
2863
|
+
changed: 0,
|
|
2513
2864
|
total: 0
|
|
2514
2865
|
};
|
|
2515
2866
|
let total = 0;
|
|
2516
|
-
let
|
|
2867
|
+
let applied = 0;
|
|
2517
2868
|
const committed = [];
|
|
2518
2869
|
let next = this.currentData();
|
|
2519
2870
|
for (let gr = 0; gr < grid.length; gr++) {
|
|
2520
2871
|
const r = originRow + gr;
|
|
2521
2872
|
if (r > maxRow) break;
|
|
2522
2873
|
const rowGrouped = this.rowIndexIsGrouped(r);
|
|
2874
|
+
const rowPlaceholder = this.rowIsLazyPlaceholder((this._rows.value || [])[r]);
|
|
2523
2875
|
const cols = grid[gr] || [];
|
|
2524
2876
|
for (let gc = 0; gc < cols.length; gc++) {
|
|
2525
2877
|
const c = originCol + gc;
|
|
2526
2878
|
if (c > maxCol) break;
|
|
2527
2879
|
total = total + 1;
|
|
2528
|
-
if (rowGrouped) continue;
|
|
2880
|
+
if (rowGrouped || rowPlaceholder) continue;
|
|
2529
2881
|
const colId = this.columnIdAt(r, c);
|
|
2530
2882
|
if (colId == null || !this.columnEditable(colId)) continue;
|
|
2531
2883
|
const rowObj = this.rowOriginalAt(r);
|
|
@@ -2534,6 +2886,8 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2534
2886
|
const field = this.fieldOfColId(colId);
|
|
2535
2887
|
const srcIndex = this.sourceIndexOfRow(r);
|
|
2536
2888
|
const oldValue = rowObj ? rowObj[field] : null;
|
|
2889
|
+
applied = applied + 1;
|
|
2890
|
+
if (oldValue === value) continue;
|
|
2537
2891
|
next = replaceRowValue(next, srcIndex, field, value);
|
|
2538
2892
|
committed.push({
|
|
2539
2893
|
rowId: this.rowIdAt(r),
|
|
@@ -2541,23 +2895,27 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2541
2895
|
oldValue,
|
|
2542
2896
|
newValue: value
|
|
2543
2897
|
});
|
|
2544
|
-
wrote = wrote + 1;
|
|
2545
2898
|
}
|
|
2546
2899
|
}
|
|
2547
|
-
if (
|
|
2900
|
+
if (committed.length > 0) {
|
|
2548
2901
|
this.editTransition = true;
|
|
2549
2902
|
this.writeData(next);
|
|
2550
2903
|
this.editTransition = false;
|
|
2551
|
-
for (let i = 0; i < committed.length; i++)
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2904
|
+
for (let i = 0; i < committed.length; i++) try {
|
|
2905
|
+
this.dispatchEvent(new CustomEvent("cell-edit-commit", {
|
|
2906
|
+
detail: committed[i],
|
|
2907
|
+
bubbles: true,
|
|
2908
|
+
composed: true
|
|
2909
|
+
}));
|
|
2910
|
+
} catch (err) {
|
|
2911
|
+
console.error("[rozie-data-table] paste failed partway: a cell-edit-commit listener threw. The model was already written; the remaining cells still notify.", err);
|
|
2912
|
+
}
|
|
2556
2913
|
}
|
|
2557
|
-
if (
|
|
2558
|
-
else if (total > 0) this.announce("No cells
|
|
2914
|
+
if (applied > 0) this.announce(applied + " of " + total + " cells " + opVerb);
|
|
2915
|
+
else if (total > 0) this.announce("No cells " + opVerb + " — " + total + " cells were invalid or read-only");
|
|
2559
2916
|
return {
|
|
2560
|
-
wrote,
|
|
2917
|
+
wrote: applied,
|
|
2918
|
+
changed: committed.length,
|
|
2561
2919
|
total
|
|
2562
2920
|
};
|
|
2563
2921
|
};
|
|
@@ -2589,11 +2947,15 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2589
2947
|
}
|
|
2590
2948
|
if (!p || !p.then) return;
|
|
2591
2949
|
p.then((text) => {
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2950
|
+
try {
|
|
2951
|
+
const grid = parseTsv(text);
|
|
2952
|
+
if (!grid.length) return;
|
|
2953
|
+
const tiled = tileGridToBox(grid, destBox);
|
|
2954
|
+
this.applyGridToRange(tiled, anchorRow, anchorCol, "pasted");
|
|
2955
|
+
} catch (err) {
|
|
2956
|
+
console.error("[rozie-data-table] paste failed: a row accessor, the data model setter or other consumer code threw. The paste was abandoned.", err);
|
|
2957
|
+
}
|
|
2958
|
+
}, () => {});
|
|
2597
2959
|
};
|
|
2598
2960
|
this.cutRange = () => {
|
|
2599
2961
|
if (!this.clipboardActiveAllowed()) return;
|
|
@@ -2612,7 +2974,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2612
2974
|
for (let c = c0; c <= c1; c++) cols.push("");
|
|
2613
2975
|
grid.push(cols);
|
|
2614
2976
|
}
|
|
2615
|
-
this.applyGridToRange(grid, r0, c0);
|
|
2977
|
+
this.applyGridToRange(grid, r0, c0, "cut");
|
|
2616
2978
|
};
|
|
2617
2979
|
this.clearActiveRange = () => {
|
|
2618
2980
|
if (!this.clipboardActiveAllowed()) return;
|
|
@@ -2627,7 +2989,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2627
2989
|
for (let c = c0; c <= c1; c++) cols.push("");
|
|
2628
2990
|
grid.push(cols);
|
|
2629
2991
|
}
|
|
2630
|
-
this.applyGridToRange(grid, r0, c0);
|
|
2992
|
+
this.applyGridToRange(grid, r0, c0, "cleared");
|
|
2631
2993
|
};
|
|
2632
2994
|
this.fillRange = (sourceBox, endCell) => {
|
|
2633
2995
|
let box;
|
|
@@ -2665,7 +3027,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2665
3027
|
}
|
|
2666
3028
|
grid.push(cols);
|
|
2667
3029
|
}
|
|
2668
|
-
this.applyGridToRange(grid, box.r0, box.c0);
|
|
3030
|
+
this.applyGridToRange(grid, box.r0, box.c0, "filled");
|
|
2669
3031
|
};
|
|
2670
3032
|
this.fillDragging = false;
|
|
2671
3033
|
this.fillDragMove = null;
|
|
@@ -2827,7 +3189,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2827
3189
|
if (cell && (cell.r !== lastCell.r || cell.c !== lastCell.c)) {
|
|
2828
3190
|
lastCell = cell;
|
|
2829
3191
|
this.rangeDragMoved = true;
|
|
2830
|
-
this.setRangeFocus(cell.r, cell.c);
|
|
3192
|
+
this.setRangeFocus(cell.r, cell.c, anchorR, anchorC);
|
|
2831
3193
|
}
|
|
2832
3194
|
};
|
|
2833
3195
|
const up = () => {
|
|
@@ -2849,6 +3211,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2849
3211
|
};
|
|
2850
3212
|
this.isActiveCellEditable = () => {
|
|
2851
3213
|
if (this.rowIndexIsGrouped(this._activeRow.value)) return false;
|
|
3214
|
+
if (this.rowIsLazyPlaceholder((this._rows.value || [])[this._activeRow.value])) return false;
|
|
2852
3215
|
const colId = this.activeCellColumnId();
|
|
2853
3216
|
return colId != null && this.columnEditable(colId);
|
|
2854
3217
|
};
|
|
@@ -2960,12 +3323,14 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2960
3323
|
};
|
|
2961
3324
|
this.beginEdit = (rowIndex, colIndex, seed) => {
|
|
2962
3325
|
if (this.rowIndexIsGrouped(rowIndex)) return;
|
|
3326
|
+
if (this.rowIsLazyPlaceholder((this._rows.value || [])[rowIndex])) return;
|
|
2963
3327
|
const colId = this.columnIdAt(rowIndex, colIndex);
|
|
2964
3328
|
if (colId == null || !this.columnEditable(colId)) return;
|
|
2965
3329
|
this.committedThisSession = false;
|
|
2966
3330
|
this.setInvalid("");
|
|
2967
3331
|
this._editingRowIndex.value = null;
|
|
2968
3332
|
this._rowDraft.value = {};
|
|
3333
|
+
this.rowDraftSync = {};
|
|
2969
3334
|
this._editingRow.value = rowIndex;
|
|
2970
3335
|
this._editingCol.value = colIndex;
|
|
2971
3336
|
this._draftValue.value = seed != null ? seed : this.cellValueAt(rowIndex, colIndex);
|
|
@@ -2980,6 +3345,11 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2980
3345
|
const tryFocus = () => {
|
|
2981
3346
|
const el = this.resolveCellEl(String(row), col);
|
|
2982
3347
|
if (el) {
|
|
3348
|
+
const ae = this.gridRoot && this.gridRoot.getRootNode ? this.gridRoot.getRootNode().activeElement : null;
|
|
3349
|
+
if (ae && ae !== el && this.gridRoot.contains && this.gridRoot.contains(ae) && ae.closest) {
|
|
3350
|
+
const aeCell = ae.closest("[data-grid-cell]");
|
|
3351
|
+
if (aeCell && aeCell !== el) return;
|
|
3352
|
+
}
|
|
2983
3353
|
el.focus();
|
|
2984
3354
|
return;
|
|
2985
3355
|
}
|
|
@@ -3003,6 +3373,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
3003
3373
|
this.endRowEdit = () => {
|
|
3004
3374
|
this._editingRowIndex.value = null;
|
|
3005
3375
|
this._rowDraft.value = {};
|
|
3376
|
+
this.rowDraftSync = {};
|
|
3006
3377
|
this._invalidMsg.value = "";
|
|
3007
3378
|
this._activeInControl.value = false;
|
|
3008
3379
|
this._editVer.value = this._editVer.value + 1;
|
|
@@ -3016,7 +3387,14 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
3016
3387
|
return this._editFocusColId.value != null && this._editFocusColId.value === colId;
|
|
3017
3388
|
};
|
|
3018
3389
|
this.coerceCellValue = (colId, raw) => {
|
|
3019
|
-
|
|
3390
|
+
const kind = this.editorTypeOf(colId);
|
|
3391
|
+
if (kind === "checkbox") {
|
|
3392
|
+
if (typeof raw === "boolean") return raw;
|
|
3393
|
+
if (raw == null) return false;
|
|
3394
|
+
if (typeof raw === "number") return raw !== 0;
|
|
3395
|
+
return /^\s*(true|1|yes|y|on)\s*$/i.test(String(raw));
|
|
3396
|
+
}
|
|
3397
|
+
if (kind !== "number") return raw;
|
|
3020
3398
|
if (raw == null) return null;
|
|
3021
3399
|
if (typeof raw === "number") return Number.isNaN(raw) ? null : raw;
|
|
3022
3400
|
const s = String(raw).trim();
|
|
@@ -3078,10 +3456,11 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
3078
3456
|
};
|
|
3079
3457
|
this.toggleActiveBooleanCell = () => {
|
|
3080
3458
|
if (this.rowIndexIsGrouped(this._activeRow.value)) return;
|
|
3081
|
-
const colId = this.columnIdAt(this._activeRow.value, this._activeColIndex.value);
|
|
3082
|
-
if (colId == null || !this.columnEditable(colId)) return;
|
|
3083
3459
|
const row = (this._rows.value || [])[this._activeRow.value];
|
|
3084
3460
|
if (!row) return;
|
|
3461
|
+
if (this.rowIsLazyPlaceholder(row)) return;
|
|
3462
|
+
const colId = this.columnIdAt(this._activeRow.value, this._activeColIndex.value);
|
|
3463
|
+
if (colId == null || !this.columnEditable(colId)) return;
|
|
3085
3464
|
const rowOriginal = row.original;
|
|
3086
3465
|
const rowId = row.id;
|
|
3087
3466
|
const oldValue = this.cellValueAt(this._activeRow.value, this._activeColIndex.value);
|
|
@@ -3167,6 +3546,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
3167
3546
|
const rowIndex = this.rowIndexOf(row);
|
|
3168
3547
|
if (rowIndex < 0) return;
|
|
3169
3548
|
if (this.rowIndexIsGrouped(rowIndex)) return;
|
|
3549
|
+
if (this.rowIsLazyPlaceholder((this._rows.value || [])[rowIndex])) return;
|
|
3170
3550
|
const editable = this.editableColumnsForRow(rowIndex);
|
|
3171
3551
|
if (editable.length === 0) return;
|
|
3172
3552
|
this.committedThisSession = false;
|
|
@@ -3182,6 +3562,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
3182
3562
|
draft[ec.colId] = orig ? orig[ec.field] : null;
|
|
3183
3563
|
}
|
|
3184
3564
|
this._rowDraft.value = draft;
|
|
3565
|
+
this.rowDraftSync = draft;
|
|
3185
3566
|
this._editingRowIndex.value = rowIndex;
|
|
3186
3567
|
this._activeInControl.value = true;
|
|
3187
3568
|
this._editVer.value = this._editVer.value + 1;
|
|
@@ -3199,7 +3580,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
3199
3580
|
const r = (this._rows.value || [])[rowIndex];
|
|
3200
3581
|
const rowOriginal = r ? r.original : null;
|
|
3201
3582
|
const rowId = r ? r.id : null;
|
|
3202
|
-
const draft = this.
|
|
3583
|
+
const draft = this.rowDraftSync || {};
|
|
3203
3584
|
for (let i = 0; i < editable.length; i++) {
|
|
3204
3585
|
const ec = editable[i];
|
|
3205
3586
|
const err = this.runValidator(ec.colId, this.coerceCellValue(ec.colId, draft[ec.colId]), rowOriginal);
|
|
@@ -3312,6 +3693,8 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
3312
3693
|
this.editTransition = false;
|
|
3313
3694
|
this.pendingEditFollow = null;
|
|
3314
3695
|
this.committedThisSession = false;
|
|
3696
|
+
this.rowDraftSync = {};
|
|
3697
|
+
this.dropinTabFlush = null;
|
|
3315
3698
|
this.inRowEdit = () => this._editingRowIndex.value != null;
|
|
3316
3699
|
this.editorValueFor = (colId) => this.inRowEdit() ? this._rowDraft.value ? this._rowDraft.value[colId] : null : this._draftValue.value;
|
|
3317
3700
|
this.editorCheckedFor = (colId) => !!(this.inRowEdit() ? this._rowDraft.value ? this._rowDraft.value[colId] : null : this._draftValue.value);
|
|
@@ -3320,6 +3703,11 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
3320
3703
|
this.setRowDraft(colId, value);
|
|
3321
3704
|
return;
|
|
3322
3705
|
}
|
|
3706
|
+
if (this.dropinTabFlush) {
|
|
3707
|
+
this.dropinTabFlush.called = true;
|
|
3708
|
+
if (this.commitEdit(value, true)) this.dropinTabFlush.committed = true;
|
|
3709
|
+
return;
|
|
3710
|
+
}
|
|
3323
3711
|
this.commitEdit(value);
|
|
3324
3712
|
};
|
|
3325
3713
|
this.editorCancelFor = () => () => {
|
|
@@ -3346,10 +3734,11 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
3346
3734
|
this._draftValue.value = v;
|
|
3347
3735
|
};
|
|
3348
3736
|
this.setRowDraft = (colId, value) => {
|
|
3349
|
-
const src = this.
|
|
3737
|
+
const src = this.rowDraftSync || {};
|
|
3350
3738
|
const next = {};
|
|
3351
3739
|
for (const k in src) next[k] = src[k];
|
|
3352
3740
|
next[colId] = value;
|
|
3741
|
+
this.rowDraftSync = next;
|
|
3353
3742
|
this._rowDraft.value = next;
|
|
3354
3743
|
};
|
|
3355
3744
|
this.rowEditTab = (target, backward) => {
|
|
@@ -3404,6 +3793,56 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
3404
3793
|
this.cancelEdit();
|
|
3405
3794
|
}
|
|
3406
3795
|
};
|
|
3796
|
+
this.onEditorDropinKeyDown = (e) => {
|
|
3797
|
+
if (!e) return;
|
|
3798
|
+
const key = e.key;
|
|
3799
|
+
if (this.inRowEdit()) {
|
|
3800
|
+
if (key === "Enter") {
|
|
3801
|
+
e.preventDefault();
|
|
3802
|
+
this.commitRow();
|
|
3803
|
+
return;
|
|
3804
|
+
}
|
|
3805
|
+
if (key === "Escape") {
|
|
3806
|
+
e.preventDefault();
|
|
3807
|
+
this.cancelRow();
|
|
3808
|
+
return;
|
|
3809
|
+
}
|
|
3810
|
+
if (key === "Tab") {
|
|
3811
|
+
e.preventDefault();
|
|
3812
|
+
this.rowEditTab(e.target, e.shiftKey);
|
|
3813
|
+
return;
|
|
3814
|
+
}
|
|
3815
|
+
return;
|
|
3816
|
+
}
|
|
3817
|
+
if (key !== "Tab" || e.defaultPrevented) return;
|
|
3818
|
+
e.preventDefault();
|
|
3819
|
+
const fromRow = this._editingRow.value;
|
|
3820
|
+
const fromCol = this._editingCol.value;
|
|
3821
|
+
const target = e.shiftKey ? this.prevEditableCell(fromRow, fromCol) : this.nextEditableCell(fromRow, fromCol);
|
|
3822
|
+
const el = e.target;
|
|
3823
|
+
const ownCell = el && el.closest ? el.closest("[data-grid-cell]") : null;
|
|
3824
|
+
const flush = {
|
|
3825
|
+
called: false,
|
|
3826
|
+
committed: false
|
|
3827
|
+
};
|
|
3828
|
+
this.dropinTabFlush = flush;
|
|
3829
|
+
if (ownCell && ownCell.focus) ownCell.focus();
|
|
3830
|
+
else if (el && el.blur) el.blur();
|
|
3831
|
+
this.dropinTabFlush = null;
|
|
3832
|
+
if (!flush.called) {
|
|
3833
|
+
this.onEditorKeyDown(e);
|
|
3834
|
+
return;
|
|
3835
|
+
}
|
|
3836
|
+
if (!flush.committed) {
|
|
3837
|
+
if (el && el.focus) el.focus();
|
|
3838
|
+
return;
|
|
3839
|
+
}
|
|
3840
|
+
if (target) {
|
|
3841
|
+
this._activeRow.value = target.row;
|
|
3842
|
+
this._activeColIndex.value = target.col;
|
|
3843
|
+
this.beginEdit(target.row, target.col, null);
|
|
3844
|
+
} else this.focusCellWhenReady(fromRow, fromCol);
|
|
3845
|
+
};
|
|
3407
3846
|
this.onEditorBlur = (e) => {
|
|
3408
3847
|
if (this.inRowEdit()) {
|
|
3409
3848
|
if (this.editTransition) return;
|
|
@@ -3416,13 +3855,20 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
3416
3855
|
}
|
|
3417
3856
|
if (this._editingRow.value < 0 || this.editTransition) return;
|
|
3418
3857
|
const next = e ? e.relatedTarget : null;
|
|
3419
|
-
|
|
3858
|
+
const fromCell = e && e.target && e.target.closest ? e.target.closest("[data-grid-cell]") : null;
|
|
3859
|
+
if (next == null) {
|
|
3860
|
+
if (!this.outsidePointerDown) return;
|
|
3861
|
+
this.outsidePointerDown = false;
|
|
3862
|
+
if (!fromCell) return;
|
|
3863
|
+
if (fromCell.getAttribute("data-row") !== String(this._editingRow.value) || fromCell.getAttribute("data-col-index") !== String(this._editingCol.value)) return;
|
|
3864
|
+
this.commitEdit(void 0, true);
|
|
3865
|
+
return;
|
|
3866
|
+
}
|
|
3420
3867
|
if (!(this.gridRoot && this.gridRoot.contains && this.gridRoot.contains(next))) {
|
|
3421
3868
|
this.commitEdit(void 0);
|
|
3422
3869
|
return;
|
|
3423
3870
|
}
|
|
3424
3871
|
const nextCell = next.closest ? next.closest("[data-grid-cell]") : null;
|
|
3425
|
-
const fromCell = e && e.target && e.target.closest ? e.target.closest("[data-grid-cell]") : null;
|
|
3426
3872
|
if (!nextCell || !fromCell || nextCell === fromCell) return;
|
|
3427
3873
|
const fromRow = fromCell.getAttribute("data-row");
|
|
3428
3874
|
const fromCol = fromCell.getAttribute("data-col-index");
|
|
@@ -3600,6 +4046,32 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
3600
4046
|
static {
|
|
3601
4047
|
this.styles = lit.css`
|
|
3602
4048
|
:host{display:contents}
|
|
4049
|
+
:host {
|
|
4050
|
+
--rdt-color: var(--rozie-data-table-fg, var(--rdt-ds-fg));
|
|
4051
|
+
--rdt-select-accent: var(--rozie-data-table-select-accent, var(--rozie-data-table-accent, var(--rdt-ds-select-accent)));
|
|
4052
|
+
--rdt-border: 1px solid var(--rozie-data-table-border-color, var(--rdt-ds-border-color));
|
|
4053
|
+
--rdt-filter-border: 1px solid var(--rozie-data-table-control-border-color, var(--rdt-ds-control-border-color));
|
|
4054
|
+
--rdt-filter-radius: var(--rozie-data-table-radius, var(--rdt-ds-radius));
|
|
4055
|
+
--rdt-font: var(--rozie-data-table-font, var(--rdt-ds-font));
|
|
4056
|
+
--rdt-cell-padding: var(--rozie-data-table-cell-padding, var(--rdt-ds-cell-padding));
|
|
4057
|
+
--rdt-header-bg: var(--rozie-data-table-header-bg, var(--rdt-ds-header-bg));
|
|
4058
|
+
--rdt-header-weight: var(--rozie-data-table-header-weight, var(--rdt-ds-header-weight));
|
|
4059
|
+
--rdt-sort-ind-opacity: var(--rozie-data-table-sort-indicator-opacity, var(--rdt-ds-sort-indicator-opacity));
|
|
4060
|
+
--rdt-resize-grip-color: var(--rozie-data-table-resize-grip-color, var(--rdt-ds-resize-grip-color));
|
|
4061
|
+
--rdt-resize-grip-active: var(--rozie-data-table-resize-grip-active, var(--rozie-data-table-accent, var(--rdt-ds-resize-grip-active)));
|
|
4062
|
+
--rdt-pin-btn-active-bg: var(--rozie-data-table-pin-active-bg, var(--rdt-ds-pin-active-bg));
|
|
4063
|
+
--rdt-colvis-menu-bg: var(--rozie-data-table-menu-bg, var(--rdt-ds-menu-bg));
|
|
4064
|
+
--rdt-colvis-menu-shadow: var(--rozie-data-table-menu-shadow, var(--rdt-ds-menu-shadow));
|
|
4065
|
+
--rdt-colvis-menu-border: 1px solid var(--rozie-data-table-border-color, var(--rdt-ds-border-color));
|
|
4066
|
+
--rdt-colvis-menu-radius: var(--rozie-data-table-radius, var(--rdt-ds-radius));
|
|
4067
|
+
--rdt-colvis-summary-border: 1px solid var(--rozie-data-table-control-border-color, var(--rdt-ds-control-border-color));
|
|
4068
|
+
--rdt-colvis-summary-radius: var(--rozie-data-table-radius, var(--rdt-ds-radius));
|
|
4069
|
+
--rdt-page-btn-disabled-opacity: var(--rozie-data-table-disabled-opacity, var(--rdt-ds-disabled-opacity));
|
|
4070
|
+
--rdt-page-btn-border: 1px solid var(--rozie-data-table-control-border-color, var(--rdt-ds-control-border-color));
|
|
4071
|
+
--rdt-page-btn-radius: var(--rozie-data-table-radius, var(--rdt-ds-radius));
|
|
4072
|
+
--rdt-page-size-border: 1px solid var(--rozie-data-table-control-border-color, var(--rdt-ds-control-border-color));
|
|
4073
|
+
--rdt-page-size-radius: var(--rozie-data-table-radius, var(--rdt-ds-radius));
|
|
4074
|
+
}
|
|
3603
4075
|
.rozie-data-table[data-rozie-s-d5dcab4c] {
|
|
3604
4076
|
border-collapse: collapse;
|
|
3605
4077
|
width: 100%;
|
|
@@ -3734,6 +4206,16 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
3734
4206
|
flex-direction: column;
|
|
3735
4207
|
gap: var(--rdt-chrome-gap, 0.5rem);
|
|
3736
4208
|
}
|
|
4209
|
+
.rozie-data-table[data-rozie-s-d5dcab4c] .rdt-skeleton[data-rozie-s-d5dcab4c] {
|
|
4210
|
+
/* inline-block on the cell's own line box, exactly like a text value (a block box was 2px
|
|
4211
|
+
short of a text row). */
|
|
4212
|
+
display: inline-block;
|
|
4213
|
+
width: 100%;
|
|
4214
|
+
vertical-align: baseline;
|
|
4215
|
+
border-radius: 4px;
|
|
4216
|
+
background: color-mix(in srgb, currentColor 12%, transparent);
|
|
4217
|
+
color: transparent;
|
|
4218
|
+
}
|
|
3737
4219
|
.rozie-data-table-wrap[data-rozie-s-d5dcab4c] .rdt-toolbar[data-rozie-s-d5dcab4c] {
|
|
3738
4220
|
display: flex;
|
|
3739
4221
|
gap: var(--rdt-toolbar-gap, 0.5rem);
|
|
@@ -3772,6 +4254,9 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
3772
4254
|
.rozie-data-table[data-rozie-s-d5dcab4c] .rdt-filter-row[data-rozie-s-d5dcab4c] {
|
|
3773
4255
|
background: var(--rdt-filter-row-bg, rgba(0, 0, 0, 0.015));
|
|
3774
4256
|
}
|
|
4257
|
+
.rozie-data-table[data-rozie-s-d5dcab4c] .rdt-pinned[data-rozie-s-d5dcab4c] {
|
|
4258
|
+
box-sizing: border-box;
|
|
4259
|
+
}
|
|
3775
4260
|
.rozie-data-table[data-rozie-s-d5dcab4c] .rdt-filter-cell[data-rozie-s-d5dcab4c] {
|
|
3776
4261
|
padding: var(--rdt-filter-cell-padding, 0.35rem 0.75rem);
|
|
3777
4262
|
border-bottom: var(--rdt-border, 1px solid rgba(0, 0, 0, 0.08));
|
|
@@ -3891,6 +4376,9 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
3891
4376
|
.rozie-data-table-wrap[data-rozie-s-d5dcab4c] .rdt-colvis-summary[data-rozie-s-d5dcab4c] {
|
|
3892
4377
|
cursor: pointer;
|
|
3893
4378
|
font: inherit;
|
|
4379
|
+
/* Own the margin too: content-site typography styles bare \`summary\` (VitePress sets
|
|
4380
|
+
\`margin: 16px 0\`), which grew the <details> and stretched the toolbar's search input. */
|
|
4381
|
+
margin: 0;
|
|
3894
4382
|
padding: var(--rdt-colvis-summary-padding, 0.25rem 0.6rem);
|
|
3895
4383
|
border: var(--rdt-colvis-summary-border, 1px solid rgba(0, 0, 0, 0.2));
|
|
3896
4384
|
border-radius: var(--rdt-colvis-summary-radius, 4px);
|
|
@@ -3929,6 +4417,51 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
3929
4417
|
text-align: var(--rdt-expander-col-align, center);
|
|
3930
4418
|
white-space: nowrap;
|
|
3931
4419
|
}
|
|
4420
|
+
.rozie-data-table[data-rozie-s-d5dcab4c] tbody[data-rozie-s-d5dcab4c] tr[data-depth="1"][data-rozie-s-d5dcab4c] > .rdt-expander-td[data-rozie-s-d5dcab4c] + .rdt-td[data-rozie-s-d5dcab4c]::before,
|
|
4421
|
+
.rozie-data-table[data-rozie-s-d5dcab4c] tbody[data-rozie-s-d5dcab4c] tr[data-depth="2"][data-rozie-s-d5dcab4c] > .rdt-expander-td[data-rozie-s-d5dcab4c] + .rdt-td[data-rozie-s-d5dcab4c]::before,
|
|
4422
|
+
.rozie-data-table[data-rozie-s-d5dcab4c] tbody[data-rozie-s-d5dcab4c] tr[data-depth="3"][data-rozie-s-d5dcab4c] > .rdt-expander-td[data-rozie-s-d5dcab4c] + .rdt-td[data-rozie-s-d5dcab4c]::before,
|
|
4423
|
+
.rozie-data-table[data-rozie-s-d5dcab4c] tbody[data-rozie-s-d5dcab4c] tr[data-depth="4"][data-rozie-s-d5dcab4c] > .rdt-expander-td[data-rozie-s-d5dcab4c] + .rdt-td[data-rozie-s-d5dcab4c]::before,
|
|
4424
|
+
.rozie-data-table[data-rozie-s-d5dcab4c] tbody[data-rozie-s-d5dcab4c] tr[data-depth="5"][data-rozie-s-d5dcab4c] > .rdt-expander-td[data-rozie-s-d5dcab4c] + .rdt-td[data-rozie-s-d5dcab4c]::before,
|
|
4425
|
+
.rozie-data-table[data-rozie-s-d5dcab4c] tbody[data-rozie-s-d5dcab4c] tr[data-depth="6"][data-rozie-s-d5dcab4c] > .rdt-expander-td[data-rozie-s-d5dcab4c] + .rdt-td[data-rozie-s-d5dcab4c]::before,
|
|
4426
|
+
.rozie-data-table[data-rozie-s-d5dcab4c] tbody[data-rozie-s-d5dcab4c] tr[data-depth="7"][data-rozie-s-d5dcab4c] > .rdt-expander-td[data-rozie-s-d5dcab4c] + .rdt-td[data-rozie-s-d5dcab4c]::before,
|
|
4427
|
+
.rozie-data-table[data-rozie-s-d5dcab4c] tbody[data-rozie-s-d5dcab4c] tr[data-depth="8"][data-rozie-s-d5dcab4c] > .rdt-expander-td[data-rozie-s-d5dcab4c] + .rdt-td[data-rozie-s-d5dcab4c]::before {
|
|
4428
|
+
content: '';
|
|
4429
|
+
display: inline-block;
|
|
4430
|
+
vertical-align: middle;
|
|
4431
|
+
}
|
|
4432
|
+
.rozie-data-table[data-rozie-s-d5dcab4c] tbody[data-rozie-s-d5dcab4c] tr[data-depth="1"][data-rozie-s-d5dcab4c] > .rdt-expander-td[data-rozie-s-d5dcab4c] + .rdt-td[data-rozie-s-d5dcab4c]::before {
|
|
4433
|
+
width: calc(1 * var(--rdt-tree-indent, 1.25rem));
|
|
4434
|
+
}
|
|
4435
|
+
.rozie-data-table[data-rozie-s-d5dcab4c] tbody[data-rozie-s-d5dcab4c] tr[data-depth="2"][data-rozie-s-d5dcab4c] > .rdt-expander-td[data-rozie-s-d5dcab4c] + .rdt-td[data-rozie-s-d5dcab4c]::before {
|
|
4436
|
+
width: calc(2 * var(--rdt-tree-indent, 1.25rem));
|
|
4437
|
+
}
|
|
4438
|
+
.rozie-data-table[data-rozie-s-d5dcab4c] tbody[data-rozie-s-d5dcab4c] tr[data-depth="3"][data-rozie-s-d5dcab4c] > .rdt-expander-td[data-rozie-s-d5dcab4c] + .rdt-td[data-rozie-s-d5dcab4c]::before {
|
|
4439
|
+
width: calc(3 * var(--rdt-tree-indent, 1.25rem));
|
|
4440
|
+
}
|
|
4441
|
+
.rozie-data-table[data-rozie-s-d5dcab4c] tbody[data-rozie-s-d5dcab4c] tr[data-depth="4"][data-rozie-s-d5dcab4c] > .rdt-expander-td[data-rozie-s-d5dcab4c] + .rdt-td[data-rozie-s-d5dcab4c]::before {
|
|
4442
|
+
width: calc(4 * var(--rdt-tree-indent, 1.25rem));
|
|
4443
|
+
}
|
|
4444
|
+
.rozie-data-table[data-rozie-s-d5dcab4c] tbody[data-rozie-s-d5dcab4c] tr[data-depth="5"][data-rozie-s-d5dcab4c] > .rdt-expander-td[data-rozie-s-d5dcab4c] + .rdt-td[data-rozie-s-d5dcab4c]::before {
|
|
4445
|
+
width: calc(5 * var(--rdt-tree-indent, 1.25rem));
|
|
4446
|
+
}
|
|
4447
|
+
.rozie-data-table[data-rozie-s-d5dcab4c] tbody[data-rozie-s-d5dcab4c] tr[data-depth="6"][data-rozie-s-d5dcab4c] > .rdt-expander-td[data-rozie-s-d5dcab4c] + .rdt-td[data-rozie-s-d5dcab4c]::before {
|
|
4448
|
+
width: calc(6 * var(--rdt-tree-indent, 1.25rem));
|
|
4449
|
+
}
|
|
4450
|
+
.rozie-data-table[data-rozie-s-d5dcab4c] tbody[data-rozie-s-d5dcab4c] tr[data-depth="7"][data-rozie-s-d5dcab4c] > .rdt-expander-td[data-rozie-s-d5dcab4c] + .rdt-td[data-rozie-s-d5dcab4c]::before {
|
|
4451
|
+
width: calc(7 * var(--rdt-tree-indent, 1.25rem));
|
|
4452
|
+
}
|
|
4453
|
+
.rozie-data-table[data-rozie-s-d5dcab4c] tbody[data-rozie-s-d5dcab4c] tr[data-depth="8"][data-rozie-s-d5dcab4c] > .rdt-expander-td[data-rozie-s-d5dcab4c] + .rdt-td[data-rozie-s-d5dcab4c]::before {
|
|
4454
|
+
width: calc(8 * var(--rdt-tree-indent, 1.25rem));
|
|
4455
|
+
}
|
|
4456
|
+
.rozie-data-table[role="grid"][data-rozie-s-d5dcab4c] {
|
|
4457
|
+
user-select: none;
|
|
4458
|
+
}
|
|
4459
|
+
.rozie-data-table[role="grid"][data-rozie-s-d5dcab4c] input[data-rozie-s-d5dcab4c],
|
|
4460
|
+
.rozie-data-table[role="grid"][data-rozie-s-d5dcab4c] textarea[data-rozie-s-d5dcab4c],
|
|
4461
|
+
.rozie-data-table[role="grid"][data-rozie-s-d5dcab4c] select[data-rozie-s-d5dcab4c],
|
|
4462
|
+
.rozie-data-table[role="grid"][data-rozie-s-d5dcab4c] [contenteditable="true"][data-rozie-s-d5dcab4c] {
|
|
4463
|
+
user-select: text;
|
|
4464
|
+
}
|
|
3932
4465
|
.rozie-data-table[data-rozie-s-d5dcab4c] .rdt-select-all[data-rozie-s-d5dcab4c],
|
|
3933
4466
|
.rozie-data-table[data-rozie-s-d5dcab4c] .rdt-select-row[data-rozie-s-d5dcab4c] {
|
|
3934
4467
|
cursor: pointer;
|
|
@@ -3992,6 +4525,17 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
3992
4525
|
update();
|
|
3993
4526
|
}
|
|
3994
4527
|
}
|
|
4528
|
+
{
|
|
4529
|
+
const slotEl = this.shadowRoot?.querySelector("slot[name=\"placeholder\"]");
|
|
4530
|
+
if (slotEl !== null && slotEl !== void 0) {
|
|
4531
|
+
const update = () => {
|
|
4532
|
+
this._hasSlotPlaceholder = this._slotPlaceholderElements.length > 0;
|
|
4533
|
+
};
|
|
4534
|
+
slotEl.addEventListener("slotchange", update);
|
|
4535
|
+
this._disconnectCleanups.push(() => slotEl.removeEventListener("slotchange", update));
|
|
4536
|
+
update();
|
|
4537
|
+
}
|
|
4538
|
+
}
|
|
3995
4539
|
{
|
|
3996
4540
|
const slotEl = this.shadowRoot?.querySelector("slot[name=\"selectCell\"]");
|
|
3997
4541
|
if (slotEl !== null && slotEl !== void 0) {
|
|
@@ -4087,6 +4631,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
4087
4631
|
this._hasSlotSelectAll = Array.from(this.children).some((el) => el.getAttribute("slot") === "selectAll");
|
|
4088
4632
|
this._hasSlotDynamicColHeader = Array.from(this.children).some((el) => !el.hasAttribute("slot") && (el.nodeType !== 3 || (el.textContent?.trim().length ?? 0) > 0));
|
|
4089
4633
|
this._hasSlotDynamicFilter = Array.from(this.children).some((el) => !el.hasAttribute("slot") && (el.nodeType !== 3 || (el.textContent?.trim().length ?? 0) > 0));
|
|
4634
|
+
this._hasSlotPlaceholder = Array.from(this.children).some((el) => el.getAttribute("slot") === "placeholder");
|
|
4090
4635
|
this._hasSlotSelectCell = Array.from(this.children).some((el) => el.getAttribute("slot") === "selectCell");
|
|
4091
4636
|
this._hasSlotDynamicCell = Array.from(this.children).some((el) => !el.hasAttribute("slot") && (el.nodeType !== 3 || (el.textContent?.trim().length ?? 0) > 0));
|
|
4092
4637
|
this._hasSlotDynamicEditor = Array.from(this.children).some((el) => !el.hasAttribute("slot") && (el.nodeType !== 3 || (el.textContent?.trim().length ?? 0) > 0));
|
|
@@ -4104,13 +4649,24 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
4104
4649
|
firstUpdated() {
|
|
4105
4650
|
this._armListeners();
|
|
4106
4651
|
this._disconnectCleanups.push((0, _lit_labs_preact_signals.effect)(() => {
|
|
4107
|
-
this.
|
|
4652
|
+
this._windowVer.value;
|
|
4108
4653
|
(0, _lit_labs_preact_signals.untracked)(() => {
|
|
4109
4654
|
if (this.__rozieWatchInitial_0) {
|
|
4110
4655
|
this.__rozieWatchInitial_0 = false;
|
|
4111
4656
|
return;
|
|
4112
4657
|
}
|
|
4658
|
+
this.emitVisibleRangeIfChanged();
|
|
4659
|
+
});
|
|
4660
|
+
}));
|
|
4661
|
+
this._disconnectCleanups.push((0, _lit_labs_preact_signals.effect)(() => {
|
|
4662
|
+
this.sorting, this.globalFilter, this.columnFilters, this.pagination, this.rowCount, this.pageCount, this.rowSelection, this.expanded, this.expandable, this.grouping, this.groupable, this.columnVisibility, this.columnSizing, this.columnOrder, this.columnPinning, this.selectionMode, (this.data || []).length, this.data, this._dataDefault.value, this.columns, this._colReg.value;
|
|
4663
|
+
(0, _lit_labs_preact_signals.untracked)(() => {
|
|
4664
|
+
if (this.__rozieWatchInitial_1) {
|
|
4665
|
+
this.__rozieWatchInitial_1 = false;
|
|
4666
|
+
return;
|
|
4667
|
+
}
|
|
4113
4668
|
(() => {
|
|
4669
|
+
this.seedColumnPinning();
|
|
4114
4670
|
this.reFeed();
|
|
4115
4671
|
this.maybeClearHistoryOnExternalSwap();
|
|
4116
4672
|
})();
|
|
@@ -4119,8 +4675,8 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
4119
4675
|
this._disconnectCleanups.push((0, _lit_labs_preact_signals.effect)(() => {
|
|
4120
4676
|
this.sorting, this.columnFilters, this.globalFilter, this._sortingDefault.value, this._columnFiltersDefault.value, this._globalFilterDefault.value;
|
|
4121
4677
|
(0, _lit_labs_preact_signals.untracked)(() => {
|
|
4122
|
-
if (this.
|
|
4123
|
-
this.
|
|
4678
|
+
if (this.__rozieWatchInitial_2) {
|
|
4679
|
+
this.__rozieWatchInitial_2 = false;
|
|
4124
4680
|
return;
|
|
4125
4681
|
}
|
|
4126
4682
|
(() => {
|
|
@@ -4136,6 +4692,8 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
4136
4692
|
if (id == null) return;
|
|
4137
4693
|
const key = String(id);
|
|
4138
4694
|
if (key === "__proto__" || key === "constructor" || key === "prototype") return;
|
|
4695
|
+
const prev = __rozieCtxHost._colReg.value ? __rozieCtxHost._colReg.value[key] : void 0;
|
|
4696
|
+
if (prev !== void 0 && columnSpecsEquivalent(prev, spec)) return;
|
|
4139
4697
|
__rozieCtxHost._colReg.value = {
|
|
4140
4698
|
...__rozieCtxHost._colReg.value,
|
|
4141
4699
|
[key]: spec
|
|
@@ -4150,8 +4708,9 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
4150
4708
|
}))(this));
|
|
4151
4709
|
}));
|
|
4152
4710
|
this._dataDefault.value = this.data || [];
|
|
4711
|
+
this.seedColumnPinning();
|
|
4153
4712
|
this.table = (0, _tanstack_table_core.createTable)({
|
|
4154
|
-
data: this.
|
|
4713
|
+
data: this.feedData(),
|
|
4155
4714
|
columns: this.tableColumns(),
|
|
4156
4715
|
state: this.currentState(),
|
|
4157
4716
|
getCoreRowModel: (0, _tanstack_table_core.getCoreRowModel)(),
|
|
@@ -4160,7 +4719,8 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
4160
4719
|
getPaginationRowModel: (0, _tanstack_table_core.getPaginationRowModel)(),
|
|
4161
4720
|
getExpandedRowModel: (0, _tanstack_table_core.getExpandedRowModel)(),
|
|
4162
4721
|
getSubRows: this.getSubRows || void 0,
|
|
4163
|
-
|
|
4722
|
+
getRowId: this.rowIdOption(),
|
|
4723
|
+
getRowCanExpand: this.expandable === true && this.getSubRows == null ? (row) => !this.rowIsLazyPlaceholder(row) : void 0,
|
|
4164
4724
|
onExpandedChange: this.onExpandedChangeCb,
|
|
4165
4725
|
autoResetExpanded: false,
|
|
4166
4726
|
getGroupedRowModel: (0, _tanstack_table_core.getGroupedRowModel)(),
|
|
@@ -4173,7 +4733,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
4173
4733
|
manualSorting: this.manual === true,
|
|
4174
4734
|
rowCount: this.rowCount ?? void 0,
|
|
4175
4735
|
pageCount: this.pageCount ?? void 0,
|
|
4176
|
-
enableRowSelection: this.
|
|
4736
|
+
enableRowSelection: this.rowSelectionOption(),
|
|
4177
4737
|
enableMultiRowSelection: this.selectionMode === "multiple",
|
|
4178
4738
|
onSortingChange: this.onSortingChangeCb,
|
|
4179
4739
|
onGlobalFilterChange: this.onGlobalFilterChangeCb,
|
|
@@ -4198,6 +4758,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
4198
4758
|
this._headerGroups.value = nextGroups;
|
|
4199
4759
|
this._rowModelVer.value = this._rowModelVer.value + 1;
|
|
4200
4760
|
if (this.rowsWindowed() && this.virtualizer) {
|
|
4761
|
+
this.migratePlaceholderSizeCache();
|
|
4201
4762
|
this.virtualizer.setOptions(this.virtualizerOptions());
|
|
4202
4763
|
this.virtualizer._willUpdate();
|
|
4203
4764
|
}
|
|
@@ -4223,6 +4784,18 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
4223
4784
|
};
|
|
4224
4785
|
this.refreshRowModel();
|
|
4225
4786
|
this.gridRoot = this._ref__rozieRoot ? this._ref__rozieRoot.querySelector(".rozie-data-table") : null;
|
|
4787
|
+
if (typeof document !== "undefined") {
|
|
4788
|
+
this.docPointerDown = (ev) => {
|
|
4789
|
+
if (!this.gridRoot) {
|
|
4790
|
+
this.outsidePointerDown = false;
|
|
4791
|
+
return;
|
|
4792
|
+
}
|
|
4793
|
+
const path = ev && typeof ev.composedPath === "function" ? ev.composedPath() : null;
|
|
4794
|
+
const inside = path ? path.indexOf(this.gridRoot) !== -1 : !!(ev && ev.target && this.gridRoot.contains && this.gridRoot.contains(ev.target));
|
|
4795
|
+
this.outsidePointerDown = !inside;
|
|
4796
|
+
};
|
|
4797
|
+
document.addEventListener("pointerdown", this.docPointerDown, true);
|
|
4798
|
+
}
|
|
4226
4799
|
if (this.isWindowed()) this.gridScrollEl = this._ref__rozieRoot ? this._ref__rozieRoot.querySelector(".rdt-scroll") : null;
|
|
4227
4800
|
if (this.rowsWindowed()) {
|
|
4228
4801
|
this.virtualizer = new _tanstack_virtual_core.Virtualizer(this.virtualizerOptions());
|
|
@@ -4244,6 +4817,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
4244
4817
|
}
|
|
4245
4818
|
if (this.colsWindowed()) {
|
|
4246
4819
|
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");
|
|
4820
|
+
this.bumpWindowVer();
|
|
4247
4821
|
}
|
|
4248
4822
|
};
|
|
4249
4823
|
if (typeof requestAnimationFrame === "function") requestAnimationFrame(() => requestAnimationFrame(afterFirstFrame));
|
|
@@ -4255,6 +4829,8 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
4255
4829
|
}
|
|
4256
4830
|
updated(changedProperties) {
|
|
4257
4831
|
this.maybeClearHistoryOnExternalSwap();
|
|
4832
|
+
this.emitVisibleRangeIfChanged();
|
|
4833
|
+
this.remeasureColumnSizes();
|
|
4258
4834
|
if (!this.table) return;
|
|
4259
4835
|
const d = this.currentData() || [];
|
|
4260
4836
|
if (d === this.lastData && d.length === this.lastDataLen) return;
|
|
@@ -4293,7 +4869,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
4293
4869
|
|
|
4294
4870
|
<div class="rdt-column-defs" style="display:none" aria-hidden="true" data-rozie-s-d5dcab4c><slot></slot></div>
|
|
4295
4871
|
|
|
4296
|
-
${!!this._invalidMsg.value ? lit.html`<div class="rdt-sr-live" role="status" aria-live="polite" aria-atomic="true" data-rozie-s-d5dcab4c>${this._invalidMsg.value}</div>` : lit.nothing}${!!this._pasteAnnounce.value ? lit.html`<div class="rdt-sr-live rdt-sr-paste" data-testid="paste-announce" role="status" aria-live="polite" aria-atomic="true" data-rozie-s-d5dcab4c>${this._pasteAnnounce.value}</div>` : lit.nothing}${!!this._liveAnnounce.value ? lit.html`<div class="rdt-sr-live rdt-sr-sortfilter" data-testid="sortfilter-announce" role="status" aria-live="polite" aria-atomic="true" data-rozie-s-d5dcab4c>${this._liveAnnounce.value}</div>` : lit.nothing}<div class="rdt-toolbar" data-rozie-s-d5dcab4c>
|
|
4872
|
+
${!!this._invalidMsg.value ? lit.html`<div class="rdt-sr-live" role="status" aria-live="polite" aria-atomic="true" data-rozie-s-d5dcab4c>${this._invalidMsg.value}</div>` : lit.nothing}${!!this._pasteAnnounce.value ? lit.html`<div class="rdt-sr-live rdt-sr-paste" data-testid="paste-announce" role="status" aria-live="polite" aria-atomic="true" data-rozie-s-d5dcab4c>${this._pasteAnnounce.value}</div>` : lit.nothing}${!!this._rangeAnnounce.value ? lit.html`<div class="rdt-sr-live rdt-sr-range" data-testid="range-announce" role="status" aria-live="polite" aria-atomic="true" data-rozie-s-d5dcab4c>${this._rangeAnnounce.value}</div>` : lit.nothing}${!!this._liveAnnounce.value ? lit.html`<div class="rdt-sr-live rdt-sr-sortfilter" data-testid="sortfilter-announce" role="status" aria-live="polite" aria-atomic="true" data-rozie-s-d5dcab4c>${this._liveAnnounce.value}</div>` : lit.nothing}<div class="rdt-toolbar" data-rozie-s-d5dcab4c>
|
|
4297
4873
|
<input class="rdt-global-filter" type="text" role="searchbox" aria-label="Search table" .value=${this.globalFilterValue()} @input=${($event) => {
|
|
4298
4874
|
this.onGlobalFilterInput($event);
|
|
4299
4875
|
}} data-rozie-s-d5dcab4c />
|
|
@@ -4334,7 +4910,7 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4334
4910
|
"rozie-data-table": true,
|
|
4335
4911
|
"rdt-sticky": this.stickyHeader,
|
|
4336
4912
|
"rdt-col-windowed": this.colsWindowed()
|
|
4337
|
-
}).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) => {
|
|
4913
|
+
}).filter(([, v]) => v).map(([k]) => k).join(" ")}" role=${(0, _rozie_runtime_lit.rozieAttr)(this.tableRole())} aria-rowcount=${(0, _rozie_runtime_lit.rozieAttr)(this.gridAriaRowCount())} aria-colcount=${(0, _rozie_runtime_lit.rozieAttr)(this.gridAriaColCount())} @keydown=${($event) => {
|
|
4338
4914
|
this.onGridKeyDown($event);
|
|
4339
4915
|
}} @focusin=${($event) => {
|
|
4340
4916
|
this.syncActiveFromEvent($event);
|
|
@@ -4354,9 +4930,10 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4354
4930
|
"rdt-th": true,
|
|
4355
4931
|
"rdt-select-th": this.isSelectColumn(wh.header.column.id),
|
|
4356
4932
|
"rdt-expander-th": this.isExpanderColumn(wh.header.column.id),
|
|
4933
|
+
"rdt-pinned": this.columnPinSide(wh.header.column.id) !== "",
|
|
4357
4934
|
"rdt-th-resizing": this.columnIsResizing(wh.header.column.id),
|
|
4358
4935
|
"rdt-cell-active": this.isActiveCell("__header", this.headerColIndexOf(hg, wh.header), hgLevel)
|
|
4359
|
-
}).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))} data-rozie-s-d5dcab4c>
|
|
4936
|
+
}).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))} aria-colindex=${(0, _rozie_runtime_lit.rozieAttr)(this.headerLeafStart(hg, wh.header) + 1)} 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, wh.width))} data-rozie-s-d5dcab4c>
|
|
4360
4937
|
${this.isSelectColumn(wh.header.column.id) ? lit.html`<span style="display:contents" data-rozie-s-d5dcab4c>
|
|
4361
4938
|
${this.selectAll !== void 0 ? this.selectAll({
|
|
4362
4939
|
checked: this.isAllRowsSelected(),
|
|
@@ -4472,7 +5049,10 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4472
5049
|
${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>`)}
|
|
4473
5050
|
|
|
4474
5051
|
${this.hasAnyFilterableColumn() ? lit.html`<tr class="rdt-filter-row" data-rozie-s-d5dcab4c>
|
|
4475
|
-
${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="
|
|
5052
|
+
${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="${Object.entries({
|
|
5053
|
+
"rdt-filter-cell": true,
|
|
5054
|
+
"rdt-pinned": this.columnPinSide(wh.header.column.id) !== ""
|
|
5055
|
+
}).filter(([, v]) => v).map(([k]) => k).join(" ")}" 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>
|
|
4476
5056
|
${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>
|
|
4477
5057
|
${this.columnIsFilterable(wh.header.column.id) ? lit.html`<span style="display:contents" data-rozie-s-d5dcab4c>
|
|
4478
5058
|
${this.rozieSlots?.[`filter-${wh.header.column.id}`] !== void 0 ? this.rozieSlots?.[`filter-${wh.header.column.id}`]({
|
|
@@ -4480,6 +5060,7 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4480
5060
|
value: this.columnFilterValue(wh.header.column.id),
|
|
4481
5061
|
uniqueValues: this.getFacetedUniqueValues(wh.header.column.id),
|
|
4482
5062
|
minMax: this.getFacetedMinMaxValues(wh.header.column.id),
|
|
5063
|
+
columnLabel: this.headerLabel(wh.header.column.id),
|
|
4483
5064
|
setFilter: this.setColumnFilter
|
|
4484
5065
|
}) : lit.html`<slot name="${`filter-${wh.header.column.id}`}" data-rozie-params=${(() => {
|
|
4485
5066
|
try {
|
|
@@ -4487,7 +5068,8 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4487
5068
|
columnId: wh.header.column.id,
|
|
4488
5069
|
value: this.columnFilterValue(wh.header.column.id),
|
|
4489
5070
|
uniqueValues: this.getFacetedUniqueValues(wh.header.column.id),
|
|
4490
|
-
minMax: this.getFacetedMinMaxValues(wh.header.column.id)
|
|
5071
|
+
minMax: this.getFacetedMinMaxValues(wh.header.column.id),
|
|
5072
|
+
columnLabel: this.headerLabel(wh.header.column.id)
|
|
4491
5073
|
});
|
|
4492
5074
|
} catch {
|
|
4493
5075
|
return "{}";
|
|
@@ -4498,6 +5080,7 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4498
5080
|
value: this.columnFilterValue(wh.header.column.id),
|
|
4499
5081
|
uniqueValues: this.getFacetedUniqueValues(wh.header.column.id),
|
|
4500
5082
|
minMax: this.getFacetedMinMaxValues(wh.header.column.id),
|
|
5083
|
+
columnLabel: this.headerLabel(wh.header.column.id),
|
|
4501
5084
|
setFilter: this.setColumnFilter
|
|
4502
5085
|
}) : lit.html`<slot name="filter" data-rozie-params=${(() => {
|
|
4503
5086
|
try {
|
|
@@ -4505,7 +5088,8 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4505
5088
|
columnId: wh.header.column.id,
|
|
4506
5089
|
value: this.columnFilterValue(wh.header.column.id),
|
|
4507
5090
|
uniqueValues: this.getFacetedUniqueValues(wh.header.column.id),
|
|
4508
|
-
minMax: this.getFacetedMinMaxValues(wh.header.column.id)
|
|
5091
|
+
minMax: this.getFacetedMinMaxValues(wh.header.column.id),
|
|
5092
|
+
columnLabel: this.headerLabel(wh.header.column.id)
|
|
4509
5093
|
});
|
|
4510
5094
|
} catch {
|
|
4511
5095
|
return "{}";
|
|
@@ -4531,18 +5115,40 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4531
5115
|
<tr class="${Object.entries({
|
|
4532
5116
|
"rdt-tr": true,
|
|
4533
5117
|
"rdt-group-header": this.rowIsGrouped(wr.row),
|
|
4534
|
-
"rdt-row-pinned": wr.pinned
|
|
4535
|
-
|
|
5118
|
+
"rdt-row-pinned": wr.pinned,
|
|
5119
|
+
"rdt-placeholder-row": this.rowIsLazyPlaceholder(wr.row)
|
|
5120
|
+
}).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)} aria-busy=${(0, _rozie_runtime_lit.rozieAttr)(this.rowIsLazyPlaceholder(wr.row) ? "true" : null)} data-rozie-s-d5dcab4c>
|
|
4536
5121
|
|
|
4537
5122
|
${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({
|
|
4538
5123
|
"rdt-td": true,
|
|
4539
5124
|
"rdt-select-td": this.isSelectColumn(cell.column.id),
|
|
4540
5125
|
"rdt-expander-td": this.isExpanderColumn(cell.column.id),
|
|
5126
|
+
"rdt-pinned": this.columnPinSide(cell.column.id) !== "",
|
|
4541
5127
|
"rdt-in-range": this.inRange(wr.vi.index, this.colIndexOf(wr.row, cell)),
|
|
4542
5128
|
"rdt-cell-active": this.isActiveCell(String(wr.vi.index), this.colIndexOf(wr.row, cell))
|
|
4543
|
-
}).filter(([, v]) => v).map(([k]) => k).join(" ")}" role=${(0, _rozie_runtime_lit.rozieAttr)(this.cellRole())} data-col=${(0, _rozie_runtime_lit.rozieAttr)(cell.column.id)} data-grid-cell="" data-row=${(0, _rozie_runtime_lit.rozieAttr)(wr.vi.index)} data-col-index=${(0, _rozie_runtime_lit.rozieAttr)(this.colIndexOf(wr.row, cell))} tabindex=${(0, _rozie_runtime_lit.rozieAttr)(this.cellTabindex(String(wr.vi.index), this.colIndexOf(wr.row, cell)))} style=${(0, _rozie_runtime_lit.rozieStyle)(this.bodyCellStyle(wr.row, cell.column.id))} aria-invalid=${(0, _rozie_runtime_lit.rozieAttr)(this.cellAriaInvalid(wr.vi.index, this.colIndexOf(wr.row, cell)))} data-in-range=${(0, _rozie_runtime_lit.rozieAttr)(this.inRange(wr.vi.index, this.colIndexOf(wr.row, cell)) ? "true" : null)} data-agg-cell=${(0, _rozie_runtime_lit.rozieAttr)(this.cellIsAggregated(cell) ? cell.column.id : null)} data-rozie-s-d5dcab4c>
|
|
5129
|
+
}).filter(([, v]) => v).map(([k]) => k).join(" ")}" role=${(0, _rozie_runtime_lit.rozieAttr)(this.cellRole())} data-col=${(0, _rozie_runtime_lit.rozieAttr)(cell.column.id)} data-grid-cell="" data-row=${(0, _rozie_runtime_lit.rozieAttr)(wr.vi.index)} data-col-index=${(0, _rozie_runtime_lit.rozieAttr)(this.colIndexOf(wr.row, cell))} tabindex=${(0, _rozie_runtime_lit.rozieAttr)(this.cellTabindex(String(wr.vi.index), this.colIndexOf(wr.row, cell)))} style=${(0, _rozie_runtime_lit.rozieStyle)(this.bodyCellStyle(wr.row, cell.column.id))} aria-invalid=${(0, _rozie_runtime_lit.rozieAttr)(this.cellAriaInvalid(wr.vi.index, this.colIndexOf(wr.row, cell)))} aria-colindex=${(0, _rozie_runtime_lit.rozieAttr)(this.colIndexOf(wr.row, cell) + 1)} aria-selected=${(0, _rozie_runtime_lit.rozieAttr)(this.inRange(wr.vi.index, this.colIndexOf(wr.row, cell)) ? "true" : null)} data-in-range=${(0, _rozie_runtime_lit.rozieAttr)(this.inRange(wr.vi.index, this.colIndexOf(wr.row, cell)) ? "true" : null)} data-agg-cell=${(0, _rozie_runtime_lit.rozieAttr)(this.cellIsAggregated(cell) ? cell.column.id : null)} data-rozie-s-d5dcab4c>
|
|
4544
5130
|
|
|
4545
|
-
|
|
5131
|
+
|
|
5132
|
+
${this.rowIsLazyPlaceholder(wr.row) && this.isSelectColumn(cell.column.id) ? lit.html`<span style="display:contents" data-rozie-s-d5dcab4c>
|
|
5133
|
+
|
|
5134
|
+
<input class="rdt-select-placeholder" type="checkbox" disabled="" tabindex="-1" aria-hidden="true" style="visibility:hidden" data-rozie-s-d5dcab4c />
|
|
5135
|
+
</span>` : this.rowIsLazyPlaceholder(wr.row) && this.isExpanderColumn(cell.column.id) ? lit.html`<span style="display:contents" data-rozie-s-d5dcab4c></span>` : this.rowIsLazyPlaceholder(wr.row) ? lit.html`<span style="display:contents" data-rozie-s-d5dcab4c>
|
|
5136
|
+
${this.placeholder !== void 0 ? this.placeholder({
|
|
5137
|
+
index: wr.vi.index,
|
|
5138
|
+
columnId: cell.column.id
|
|
5139
|
+
}) : lit.html`<slot name="placeholder" data-rozie-params=${(() => {
|
|
5140
|
+
try {
|
|
5141
|
+
return JSON.stringify({
|
|
5142
|
+
index: wr.vi.index,
|
|
5143
|
+
columnId: cell.column.id
|
|
5144
|
+
});
|
|
5145
|
+
} catch {
|
|
5146
|
+
return "{}";
|
|
5147
|
+
}
|
|
5148
|
+
})()}>
|
|
5149
|
+
<span class="rdt-skeleton" aria-hidden="true" data-rozie-s-d5dcab4c>​</span>
|
|
5150
|
+
</slot>`}
|
|
5151
|
+
</span>` : this.isExpanderColumn(cell.column.id) ? lit.html`<span style="display:contents" data-rozie-s-d5dcab4c>
|
|
4546
5152
|
${this.rowCanExpand(wr.row) ? lit.html`<button class="rdt-expander" type="button" data-expander="" aria-expanded=${!!this.rowIsExpanded(wr.row)} aria-label=${(0, _rozie_runtime_lit.rozieAttr)(this.rowIsExpanded(wr.row) ? "Collapse row" : "Expand row")} @click=${($event) => {
|
|
4547
5153
|
this.onToggleExpand(wr.row, $event);
|
|
4548
5154
|
}} 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>
|
|
@@ -4607,27 +5213,29 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4607
5213
|
</span>
|
|
4608
5214
|
<span class="rdt-group-count" data-rozie-s-d5dcab4c>${(0, _rozie_runtime_lit.rozieDisplay)("(" + this.groupSubRowCount(wr.row) + ")")}</span>
|
|
4609
5215
|
</span>` : this.isEditing(wr.vi.index, this.colIndexOf(wr.row, cell)) ? lit.html`<span style="display:contents" data-rozie-s-d5dcab4c>
|
|
4610
|
-
${this.editorTypeOf(cell.column.id) === "number" ? lit.html`<input class="rdt-cell-editor" type="number" data-editing-cell="" data-builtin-editor="" .value=${this.editorValueFor(cell.column.id)} @input=${($event) => {
|
|
5216
|
+
${this.editorTypeOf(cell.column.id) === "number" ? lit.html`<input class="rdt-cell-editor" type="number" data-editing-cell="" data-builtin-editor="" aria-invalid=${(0, _rozie_runtime_lit.rozieAttr)(this._invalidMsg.value ? "true" : null)} .value=${this.editorValueFor(cell.column.id)} @input=${($event) => {
|
|
4611
5217
|
this.onCellEditorInput(cell.column.id, $event);
|
|
4612
5218
|
}} @keydown=${($event) => {
|
|
4613
5219
|
this.onEditorKeyDown($event);
|
|
4614
5220
|
}} @blur=${($event) => {
|
|
4615
5221
|
this.onEditorBlur($event);
|
|
4616
|
-
}} data-rozie-s-d5dcab4c />` : this.editorTypeOf(cell.column.id) === "select" ? lit.html`<select class="rdt-cell-editor" data-editing-cell="" data-builtin-editor="" .value=${this.editorValueFor(cell.column.id)} @change=${($event) => {
|
|
5222
|
+
}} data-rozie-s-d5dcab4c />` : this.editorTypeOf(cell.column.id) === "select" ? lit.html`<select class="rdt-cell-editor" data-editing-cell="" data-builtin-editor="" aria-invalid=${(0, _rozie_runtime_lit.rozieAttr)(this._invalidMsg.value ? "true" : null)} .value=${this.editorValueFor(cell.column.id)} @change=${($event) => {
|
|
4617
5223
|
this.onCellEditorInput(cell.column.id, $event);
|
|
4618
5224
|
}} @keydown=${($event) => {
|
|
4619
5225
|
this.onEditorKeyDown($event);
|
|
4620
5226
|
}} @blur=${($event) => {
|
|
4621
5227
|
this.onEditorBlur($event);
|
|
4622
5228
|
}} data-rozie-s-d5dcab4c>
|
|
4623
|
-
${(0, lit_directives_repeat_js.repeat)(this.editorOptionsOf(cell.column.id), (opt, _idx) => opt.value, (opt, _idx) => lit.html`<option value=${(0, _rozie_runtime_lit.rozieAttr)(opt.value)} data-rozie-s-d5dcab4c>${(0, _rozie_runtime_lit.rozieDisplay)(opt.label)}</option>`)}
|
|
4624
|
-
</select>` : this.editorTypeOf(cell.column.id) === "checkbox" ? lit.html`<input class="rdt-cell-editor" type="checkbox" data-editing-cell="" data-builtin-editor="" ?checked=${this.editorCheckedFor(cell.column.id)} @change=${($event) => {
|
|
5229
|
+
${(0, lit_directives_repeat_js.repeat)(this.editorOptionsOf(cell.column.id), (opt, _idx) => opt.value, (opt, _idx) => lit.html`<option value=${(0, _rozie_runtime_lit.rozieAttr)(opt.value)} ?selected=${opt.value === this.editorValueFor(cell.column.id)} data-rozie-s-d5dcab4c>${(0, _rozie_runtime_lit.rozieDisplay)(opt.label)}</option>`)}
|
|
5230
|
+
</select>` : this.editorTypeOf(cell.column.id) === "checkbox" ? lit.html`<input class="rdt-cell-editor" type="checkbox" data-editing-cell="" data-builtin-editor="" aria-invalid=${(0, _rozie_runtime_lit.rozieAttr)(this._invalidMsg.value ? "true" : null)} ?checked=${this.editorCheckedFor(cell.column.id)} @change=${($event) => {
|
|
4625
5231
|
this.onCellEditorCheckbox(cell.column.id, $event);
|
|
4626
5232
|
}} @keydown=${($event) => {
|
|
4627
5233
|
this.onEditorKeyDown($event);
|
|
4628
5234
|
}} @blur=${($event) => {
|
|
4629
5235
|
this.onEditorBlur($event);
|
|
4630
|
-
}} data-rozie-s-d5dcab4c />` : this.editorTypeOf(cell.column.id) === "custom" ? lit.html`<span style="display:contents"
|
|
5236
|
+
}} data-rozie-s-d5dcab4c />` : this.editorTypeOf(cell.column.id) === "custom" ? lit.html`<span style="display:contents" @keydown=${($event) => {
|
|
5237
|
+
this.onEditorDropinKeyDown($event);
|
|
5238
|
+
}} data-rozie-s-d5dcab4c>
|
|
4631
5239
|
${this.rozieSlots?.[`editor-${cell.column.id}`] !== void 0 ? this.rozieSlots?.[`editor-${cell.column.id}`]({
|
|
4632
5240
|
columnId: cell.column.id,
|
|
4633
5241
|
column: cell.column,
|
|
@@ -4635,6 +5243,7 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4635
5243
|
value: this.editorValueFor(cell.column.id),
|
|
4636
5244
|
commit: this.editorCommitFor(cell.column.id),
|
|
4637
5245
|
cancel: this.editorCancelFor(),
|
|
5246
|
+
columnLabel: this.headerLabel(cell.column.id),
|
|
4638
5247
|
autofocus: this.editorAutofocusFor(cell.column.id, wr.vi.index)
|
|
4639
5248
|
}) : lit.html`<slot name="${`editor-${cell.column.id}`}" data-rozie-params=${(() => {
|
|
4640
5249
|
try {
|
|
@@ -4645,6 +5254,7 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4645
5254
|
value: this.editorValueFor(cell.column.id),
|
|
4646
5255
|
commit: this.editorCommitFor(cell.column.id),
|
|
4647
5256
|
cancel: this.editorCancelFor(),
|
|
5257
|
+
columnLabel: this.headerLabel(cell.column.id),
|
|
4648
5258
|
autofocus: this.editorAutofocusFor(cell.column.id, wr.vi.index)
|
|
4649
5259
|
});
|
|
4650
5260
|
} catch {
|
|
@@ -4658,6 +5268,7 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4658
5268
|
value: this.editorValueFor(cell.column.id),
|
|
4659
5269
|
commit: this.editorCommitFor(cell.column.id),
|
|
4660
5270
|
cancel: this.editorCancelFor(),
|
|
5271
|
+
columnLabel: this.headerLabel(cell.column.id),
|
|
4661
5272
|
autofocus: this.editorAutofocusFor(cell.column.id, wr.vi.index)
|
|
4662
5273
|
}) : lit.html`<slot name="editor" data-rozie-params=${(() => {
|
|
4663
5274
|
try {
|
|
@@ -4668,13 +5279,14 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4668
5279
|
value: this.editorValueFor(cell.column.id),
|
|
4669
5280
|
commit: this.editorCommitFor(cell.column.id),
|
|
4670
5281
|
cancel: this.editorCancelFor(),
|
|
5282
|
+
columnLabel: this.headerLabel(cell.column.id),
|
|
4671
5283
|
autofocus: this.editorAutofocusFor(cell.column.id, wr.vi.index)
|
|
4672
5284
|
});
|
|
4673
5285
|
} catch {
|
|
4674
5286
|
return "{}";
|
|
4675
5287
|
}
|
|
4676
5288
|
})()}>
|
|
4677
|
-
<input class="rdt-cell-editor" type="text" data-editing-cell="" data-builtin-editor="" .value=${this.editorValueFor(cell.column.id)} @input=${($event) => {
|
|
5289
|
+
<input class="rdt-cell-editor" type="text" data-editing-cell="" data-builtin-editor="" aria-invalid=${(0, _rozie_runtime_lit.rozieAttr)(this._invalidMsg.value ? "true" : null)} .value=${this.editorValueFor(cell.column.id)} @input=${($event) => {
|
|
4678
5290
|
this.onCellEditorInput(cell.column.id, $event);
|
|
4679
5291
|
}} @keydown=${($event) => {
|
|
4680
5292
|
this.onEditorKeyDown($event);
|
|
@@ -4683,7 +5295,7 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4683
5295
|
}} data-rozie-s-d5dcab4c />
|
|
4684
5296
|
</slot>`}
|
|
4685
5297
|
</slot>`}
|
|
4686
|
-
</span>` : lit.html`<input class="rdt-cell-editor" type="text" data-editing-cell="" data-builtin-editor="" .value=${this.editorValueFor(cell.column.id)} @input=${($event) => {
|
|
5298
|
+
</span>` : lit.html`<input class="rdt-cell-editor" type="text" data-editing-cell="" data-builtin-editor="" aria-invalid=${(0, _rozie_runtime_lit.rozieAttr)(this._invalidMsg.value ? "true" : null)} .value=${this.editorValueFor(cell.column.id)} @input=${($event) => {
|
|
4687
5299
|
this.onCellEditorInput(cell.column.id, $event);
|
|
4688
5300
|
}} @keydown=${($event) => {
|
|
4689
5301
|
this.onEditorKeyDown($event);
|
|
@@ -4751,7 +5363,7 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4751
5363
|
</div>` : lit.html`<table class="${Object.entries({
|
|
4752
5364
|
"rozie-data-table": true,
|
|
4753
5365
|
"rdt-sticky": this.stickyHeader
|
|
4754
|
-
}).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) => {
|
|
5366
|
+
}).filter(([, v]) => v).map(([k]) => k).join(" ")}" role=${(0, _rozie_runtime_lit.rozieAttr)(this.tableRole())} aria-rowcount=${(0, _rozie_runtime_lit.rozieAttr)(this.gridAriaRowCount())} aria-colcount=${(0, _rozie_runtime_lit.rozieAttr)(this.gridAriaColCount())} @keydown=${($event) => {
|
|
4755
5367
|
this.onGridKeyDown($event);
|
|
4756
5368
|
}} @focusin=${($event) => {
|
|
4757
5369
|
this.syncActiveFromEvent($event);
|
|
@@ -4770,9 +5382,10 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4770
5382
|
"rdt-th": true,
|
|
4771
5383
|
"rdt-select-th": this.isSelectColumn(header.column.id),
|
|
4772
5384
|
"rdt-expander-th": this.isExpanderColumn(header.column.id),
|
|
5385
|
+
"rdt-pinned": this.columnPinSide(header.column.id) !== "",
|
|
4773
5386
|
"rdt-th-resizing": this.columnIsResizing(header.column.id),
|
|
4774
5387
|
"rdt-cell-active": this.isActiveCell("__header", this.headerColIndexOf(hg, header), hgLevel)
|
|
4775
|
-
}).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)(header.colSpan > 1 ? header.colSpan : null)} data-col-index=${(0, _rozie_runtime_lit.rozieAttr)(this.headerColIndexOf(hg, header))} tabindex=${(0, _rozie_runtime_lit.rozieAttr)(this.cellTabindex("__header", this.headerColIndexOf(hg, header), hgLevel))} aria-sort=${(0, _rozie_runtime_lit.rozieAttr)(this.ariaSortFor(header.column.id))} style=${(0, _rozie_runtime_lit.rozieStyle)(this.thStyle(header))} data-rozie-s-d5dcab4c>
|
|
5388
|
+
}).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)(header.colSpan > 1 ? header.colSpan : null)} data-col-index=${(0, _rozie_runtime_lit.rozieAttr)(this.headerColIndexOf(hg, header))} aria-colindex=${(0, _rozie_runtime_lit.rozieAttr)(this.headerLeafStart(hg, header) + 1)} tabindex=${(0, _rozie_runtime_lit.rozieAttr)(this.cellTabindex("__header", this.headerColIndexOf(hg, header), hgLevel))} aria-sort=${(0, _rozie_runtime_lit.rozieAttr)(this.ariaSortFor(header.column.id))} style=${(0, _rozie_runtime_lit.rozieStyle)(this.thStyle(header))} data-rozie-s-d5dcab4c>
|
|
4776
5389
|
|
|
4777
5390
|
|
|
4778
5391
|
${this.isSelectColumn(header.column.id) ? lit.html`<span style="display:contents" data-rozie-s-d5dcab4c>
|
|
@@ -4893,7 +5506,10 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4893
5506
|
</tr>`)}
|
|
4894
5507
|
|
|
4895
5508
|
${this.hasAnyFilterableColumn() ? lit.html`<tr class="rdt-filter-row" data-rozie-s-d5dcab4c>
|
|
4896
|
-
${(0, lit_directives_repeat_js.repeat)(this._headerGroups.value[this._headerGroups.value.length - 1].headers, (header, _idx) => header.id, (header, _idx) => lit.html`<th class="
|
|
5509
|
+
${(0, lit_directives_repeat_js.repeat)(this._headerGroups.value[this._headerGroups.value.length - 1].headers, (header, _idx) => header.id, (header, _idx) => lit.html`<th class="${Object.entries({
|
|
5510
|
+
"rdt-filter-cell": true,
|
|
5511
|
+
"rdt-pinned": this.columnPinSide(header.column.id) !== ""
|
|
5512
|
+
}).filter(([, v]) => v).map(([k]) => k).join(" ")}" role="presentation" style=${(0, _rozie_runtime_lit.rozieStyle)(this.pinStyle(header.column.id))} data-rozie-s-d5dcab4c>
|
|
4897
5513
|
${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>
|
|
4898
5514
|
${this.columnIsFilterable(header.column.id) ? lit.html`<span style="display:contents" data-rozie-s-d5dcab4c>
|
|
4899
5515
|
${this.rozieSlots?.[`filter-${header.column.id}`] !== void 0 ? this.rozieSlots?.[`filter-${header.column.id}`]({
|
|
@@ -4901,6 +5517,7 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4901
5517
|
value: this.columnFilterValue(header.column.id),
|
|
4902
5518
|
uniqueValues: this.getFacetedUniqueValues(header.column.id),
|
|
4903
5519
|
minMax: this.getFacetedMinMaxValues(header.column.id),
|
|
5520
|
+
columnLabel: this.headerLabel(header.column.id),
|
|
4904
5521
|
setFilter: this.setColumnFilter
|
|
4905
5522
|
}) : lit.html`<slot name="${`filter-${header.column.id}`}" data-rozie-params=${(() => {
|
|
4906
5523
|
try {
|
|
@@ -4908,7 +5525,8 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4908
5525
|
columnId: header.column.id,
|
|
4909
5526
|
value: this.columnFilterValue(header.column.id),
|
|
4910
5527
|
uniqueValues: this.getFacetedUniqueValues(header.column.id),
|
|
4911
|
-
minMax: this.getFacetedMinMaxValues(header.column.id)
|
|
5528
|
+
minMax: this.getFacetedMinMaxValues(header.column.id),
|
|
5529
|
+
columnLabel: this.headerLabel(header.column.id)
|
|
4912
5530
|
});
|
|
4913
5531
|
} catch {
|
|
4914
5532
|
return "{}";
|
|
@@ -4919,6 +5537,7 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4919
5537
|
value: this.columnFilterValue(header.column.id),
|
|
4920
5538
|
uniqueValues: this.getFacetedUniqueValues(header.column.id),
|
|
4921
5539
|
minMax: this.getFacetedMinMaxValues(header.column.id),
|
|
5540
|
+
columnLabel: this.headerLabel(header.column.id),
|
|
4922
5541
|
setFilter: this.setColumnFilter
|
|
4923
5542
|
}) : lit.html`<slot name="filter" data-rozie-params=${(() => {
|
|
4924
5543
|
try {
|
|
@@ -4926,7 +5545,8 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4926
5545
|
columnId: header.column.id,
|
|
4927
5546
|
value: this.columnFilterValue(header.column.id),
|
|
4928
5547
|
uniqueValues: this.getFacetedUniqueValues(header.column.id),
|
|
4929
|
-
minMax: this.getFacetedMinMaxValues(header.column.id)
|
|
5548
|
+
minMax: this.getFacetedMinMaxValues(header.column.id),
|
|
5549
|
+
columnLabel: this.headerLabel(header.column.id)
|
|
4930
5550
|
});
|
|
4931
5551
|
} catch {
|
|
4932
5552
|
return "{}";
|
|
@@ -4953,9 +5573,10 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4953
5573
|
"rdt-td": true,
|
|
4954
5574
|
"rdt-select-td": this.isSelectColumn(cell.column.id),
|
|
4955
5575
|
"rdt-expander-td": this.isExpanderColumn(cell.column.id),
|
|
5576
|
+
"rdt-pinned": this.columnPinSide(cell.column.id) !== "",
|
|
4956
5577
|
"rdt-in-range": this.inRange(this.rowIndexOf(row), this.colIndexOf(row, cell)),
|
|
4957
5578
|
"rdt-cell-active": this.isActiveCell(String(this.rowIndexOf(row)), this.colIndexOf(row, cell))
|
|
4958
|
-
}).filter(([, v]) => v).map(([k]) => k).join(" ")}" role=${(0, _rozie_runtime_lit.rozieAttr)(this.cellRole())} data-col=${(0, _rozie_runtime_lit.rozieAttr)(cell.column.id)} data-grid-cell="" data-row=${(0, _rozie_runtime_lit.rozieAttr)(this.rowIndexOf(row))} data-col-index=${(0, _rozie_runtime_lit.rozieAttr)(this.colIndexOf(row, cell))} tabindex=${(0, _rozie_runtime_lit.rozieAttr)(this.cellTabindex(String(this.rowIndexOf(row)), this.colIndexOf(row, cell)))} style=${(0, _rozie_runtime_lit.rozieStyle)(this.bodyCellStyle(row, cell.column.id))} aria-invalid=${(0, _rozie_runtime_lit.rozieAttr)(this.cellAriaInvalid(this.rowIndexOf(row), this.colIndexOf(row, cell)))} data-in-range=${(0, _rozie_runtime_lit.rozieAttr)(this.inRange(this.rowIndexOf(row), this.colIndexOf(row, cell)) ? "true" : null)} data-agg-cell=${(0, _rozie_runtime_lit.rozieAttr)(this.cellIsAggregated(cell) ? cell.column.id : null)} data-rozie-s-d5dcab4c>
|
|
5579
|
+
}).filter(([, v]) => v).map(([k]) => k).join(" ")}" role=${(0, _rozie_runtime_lit.rozieAttr)(this.cellRole())} data-col=${(0, _rozie_runtime_lit.rozieAttr)(cell.column.id)} data-grid-cell="" data-row=${(0, _rozie_runtime_lit.rozieAttr)(this.rowIndexOf(row))} data-col-index=${(0, _rozie_runtime_lit.rozieAttr)(this.colIndexOf(row, cell))} tabindex=${(0, _rozie_runtime_lit.rozieAttr)(this.cellTabindex(String(this.rowIndexOf(row)), this.colIndexOf(row, cell)))} style=${(0, _rozie_runtime_lit.rozieStyle)(this.bodyCellStyle(row, cell.column.id))} aria-invalid=${(0, _rozie_runtime_lit.rozieAttr)(this.cellAriaInvalid(this.rowIndexOf(row), this.colIndexOf(row, cell)))} aria-colindex=${(0, _rozie_runtime_lit.rozieAttr)(this.colIndexOf(row, cell) + 1)} aria-selected=${(0, _rozie_runtime_lit.rozieAttr)(this.inRange(this.rowIndexOf(row), this.colIndexOf(row, cell)) ? "true" : null)} data-in-range=${(0, _rozie_runtime_lit.rozieAttr)(this.inRange(this.rowIndexOf(row), this.colIndexOf(row, cell)) ? "true" : null)} data-agg-cell=${(0, _rozie_runtime_lit.rozieAttr)(this.cellIsAggregated(cell) ? cell.column.id : null)} data-rozie-s-d5dcab4c>
|
|
4959
5580
|
|
|
4960
5581
|
${this.isExpanderColumn(cell.column.id) ? lit.html`<span style="display:contents" data-rozie-s-d5dcab4c>
|
|
4961
5582
|
${this.rowCanExpand(row) ? lit.html`<button class="rdt-expander" type="button" data-expander="" aria-expanded=${!!this.rowIsExpanded(row)} aria-label=${(0, _rozie_runtime_lit.rozieAttr)(this.rowIsExpanded(row) ? "Collapse row" : "Expand row")} @click=${($event) => {
|
|
@@ -5022,27 +5643,29 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
5022
5643
|
</span>
|
|
5023
5644
|
<span class="rdt-group-count" data-rozie-s-d5dcab4c>${(0, _rozie_runtime_lit.rozieDisplay)("(" + this.groupSubRowCount(row) + ")")}</span>
|
|
5024
5645
|
</span>` : this.isEditing(this.rowIndexOf(row), this.colIndexOf(row, cell)) ? lit.html`<span style="display:contents" data-rozie-s-d5dcab4c>
|
|
5025
|
-
${this.editorTypeOf(cell.column.id) === "number" ? lit.html`<input class="rdt-cell-editor" type="number" data-editing-cell="" data-builtin-editor="" .value=${this.editorValueFor(cell.column.id)} @input=${($event) => {
|
|
5646
|
+
${this.editorTypeOf(cell.column.id) === "number" ? lit.html`<input class="rdt-cell-editor" type="number" data-editing-cell="" data-builtin-editor="" aria-invalid=${(0, _rozie_runtime_lit.rozieAttr)(this._invalidMsg.value ? "true" : null)} .value=${this.editorValueFor(cell.column.id)} @input=${($event) => {
|
|
5026
5647
|
this.onCellEditorInput(cell.column.id, $event);
|
|
5027
5648
|
}} @keydown=${($event) => {
|
|
5028
5649
|
this.onEditorKeyDown($event);
|
|
5029
5650
|
}} @blur=${($event) => {
|
|
5030
5651
|
this.onEditorBlur($event);
|
|
5031
|
-
}} data-rozie-s-d5dcab4c />` : this.editorTypeOf(cell.column.id) === "select" ? lit.html`<select class="rdt-cell-editor" data-editing-cell="" data-builtin-editor="" .value=${this.editorValueFor(cell.column.id)} @change=${($event) => {
|
|
5652
|
+
}} data-rozie-s-d5dcab4c />` : this.editorTypeOf(cell.column.id) === "select" ? lit.html`<select class="rdt-cell-editor" data-editing-cell="" data-builtin-editor="" aria-invalid=${(0, _rozie_runtime_lit.rozieAttr)(this._invalidMsg.value ? "true" : null)} .value=${this.editorValueFor(cell.column.id)} @change=${($event) => {
|
|
5032
5653
|
this.onCellEditorInput(cell.column.id, $event);
|
|
5033
5654
|
}} @keydown=${($event) => {
|
|
5034
5655
|
this.onEditorKeyDown($event);
|
|
5035
5656
|
}} @blur=${($event) => {
|
|
5036
5657
|
this.onEditorBlur($event);
|
|
5037
5658
|
}} data-rozie-s-d5dcab4c>
|
|
5038
|
-
${(0, lit_directives_repeat_js.repeat)(this.editorOptionsOf(cell.column.id), (opt, _idx) => opt.value, (opt, _idx) => lit.html`<option value=${(0, _rozie_runtime_lit.rozieAttr)(opt.value)} data-rozie-s-d5dcab4c>${(0, _rozie_runtime_lit.rozieDisplay)(opt.label)}</option>`)}
|
|
5039
|
-
</select>` : this.editorTypeOf(cell.column.id) === "checkbox" ? lit.html`<input class="rdt-cell-editor" type="checkbox" data-editing-cell="" data-builtin-editor="" ?checked=${this.editorCheckedFor(cell.column.id)} @change=${($event) => {
|
|
5659
|
+
${(0, lit_directives_repeat_js.repeat)(this.editorOptionsOf(cell.column.id), (opt, _idx) => opt.value, (opt, _idx) => lit.html`<option value=${(0, _rozie_runtime_lit.rozieAttr)(opt.value)} ?selected=${opt.value === this.editorValueFor(cell.column.id)} data-rozie-s-d5dcab4c>${(0, _rozie_runtime_lit.rozieDisplay)(opt.label)}</option>`)}
|
|
5660
|
+
</select>` : this.editorTypeOf(cell.column.id) === "checkbox" ? lit.html`<input class="rdt-cell-editor" type="checkbox" data-editing-cell="" data-builtin-editor="" aria-invalid=${(0, _rozie_runtime_lit.rozieAttr)(this._invalidMsg.value ? "true" : null)} ?checked=${this.editorCheckedFor(cell.column.id)} @change=${($event) => {
|
|
5040
5661
|
this.onCellEditorCheckbox(cell.column.id, $event);
|
|
5041
5662
|
}} @keydown=${($event) => {
|
|
5042
5663
|
this.onEditorKeyDown($event);
|
|
5043
5664
|
}} @blur=${($event) => {
|
|
5044
5665
|
this.onEditorBlur($event);
|
|
5045
|
-
}} data-rozie-s-d5dcab4c />` : this.editorTypeOf(cell.column.id) === "custom" ? lit.html`<span style="display:contents"
|
|
5666
|
+
}} data-rozie-s-d5dcab4c />` : this.editorTypeOf(cell.column.id) === "custom" ? lit.html`<span style="display:contents" @keydown=${($event) => {
|
|
5667
|
+
this.onEditorDropinKeyDown($event);
|
|
5668
|
+
}} data-rozie-s-d5dcab4c>
|
|
5046
5669
|
${this.rozieSlots?.[`editor-${cell.column.id}`] !== void 0 ? this.rozieSlots?.[`editor-${cell.column.id}`]({
|
|
5047
5670
|
columnId: cell.column.id,
|
|
5048
5671
|
column: cell.column,
|
|
@@ -5050,6 +5673,7 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
5050
5673
|
value: this.editorValueFor(cell.column.id),
|
|
5051
5674
|
commit: this.editorCommitFor(cell.column.id),
|
|
5052
5675
|
cancel: this.editorCancelFor(),
|
|
5676
|
+
columnLabel: this.headerLabel(cell.column.id),
|
|
5053
5677
|
autofocus: this.editorAutofocusFor(cell.column.id, this.rowIndexOf(row))
|
|
5054
5678
|
}) : lit.html`<slot name="${`editor-${cell.column.id}`}" data-rozie-params=${(() => {
|
|
5055
5679
|
try {
|
|
@@ -5060,6 +5684,7 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
5060
5684
|
value: this.editorValueFor(cell.column.id),
|
|
5061
5685
|
commit: this.editorCommitFor(cell.column.id),
|
|
5062
5686
|
cancel: this.editorCancelFor(),
|
|
5687
|
+
columnLabel: this.headerLabel(cell.column.id),
|
|
5063
5688
|
autofocus: this.editorAutofocusFor(cell.column.id, this.rowIndexOf(row))
|
|
5064
5689
|
});
|
|
5065
5690
|
} catch {
|
|
@@ -5073,6 +5698,7 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
5073
5698
|
value: this.editorValueFor(cell.column.id),
|
|
5074
5699
|
commit: this.editorCommitFor(cell.column.id),
|
|
5075
5700
|
cancel: this.editorCancelFor(),
|
|
5701
|
+
columnLabel: this.headerLabel(cell.column.id),
|
|
5076
5702
|
autofocus: this.editorAutofocusFor(cell.column.id, this.rowIndexOf(row))
|
|
5077
5703
|
}) : lit.html`<slot name="editor" data-rozie-params=${(() => {
|
|
5078
5704
|
try {
|
|
@@ -5083,13 +5709,14 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
5083
5709
|
value: this.editorValueFor(cell.column.id),
|
|
5084
5710
|
commit: this.editorCommitFor(cell.column.id),
|
|
5085
5711
|
cancel: this.editorCancelFor(),
|
|
5712
|
+
columnLabel: this.headerLabel(cell.column.id),
|
|
5086
5713
|
autofocus: this.editorAutofocusFor(cell.column.id, this.rowIndexOf(row))
|
|
5087
5714
|
});
|
|
5088
5715
|
} catch {
|
|
5089
5716
|
return "{}";
|
|
5090
5717
|
}
|
|
5091
5718
|
})()}>
|
|
5092
|
-
<input class="rdt-cell-editor" type="text" data-editing-cell="" data-builtin-editor="" .value=${this.editorValueFor(cell.column.id)} @input=${($event) => {
|
|
5719
|
+
<input class="rdt-cell-editor" type="text" data-editing-cell="" data-builtin-editor="" aria-invalid=${(0, _rozie_runtime_lit.rozieAttr)(this._invalidMsg.value ? "true" : null)} .value=${this.editorValueFor(cell.column.id)} @input=${($event) => {
|
|
5093
5720
|
this.onCellEditorInput(cell.column.id, $event);
|
|
5094
5721
|
}} @keydown=${($event) => {
|
|
5095
5722
|
this.onEditorKeyDown($event);
|
|
@@ -5098,7 +5725,7 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
5098
5725
|
}} data-rozie-s-d5dcab4c />
|
|
5099
5726
|
</slot>`}
|
|
5100
5727
|
</slot>`}
|
|
5101
|
-
</span>` : lit.html`<input class="rdt-cell-editor" type="text" data-editing-cell="" data-builtin-editor="" .value=${this.editorValueFor(cell.column.id)} @input=${($event) => {
|
|
5728
|
+
</span>` : lit.html`<input class="rdt-cell-editor" type="text" data-editing-cell="" data-builtin-editor="" aria-invalid=${(0, _rozie_runtime_lit.rozieAttr)(this._invalidMsg.value ? "true" : null)} .value=${this.editorValueFor(cell.column.id)} @input=${($event) => {
|
|
5102
5729
|
this.onCellEditorInput(cell.column.id, $event);
|
|
5103
5730
|
}} @keydown=${($event) => {
|
|
5104
5731
|
this.onEditorKeyDown($event);
|
|
@@ -5170,10 +5797,10 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
5170
5797
|
<select class="rdt-page-size" aria-label="Rows per page" .value=${this.pageSize()} @change=${($event) => {
|
|
5171
5798
|
this.onPageSizeChange($event);
|
|
5172
5799
|
}} data-rozie-s-d5dcab4c>
|
|
5173
|
-
<option value=${10} data-rozie-s-d5dcab4c>10</option>
|
|
5174
|
-
<option value=${25} data-rozie-s-d5dcab4c>25</option>
|
|
5175
|
-
<option value=${50} data-rozie-s-d5dcab4c>50</option>
|
|
5176
|
-
<option value=${100} data-rozie-s-d5dcab4c>100</option>
|
|
5800
|
+
<option value=${10} ?selected=${10 === this.pageSize()} data-rozie-s-d5dcab4c>10</option>
|
|
5801
|
+
<option value=${25} ?selected=${25 === this.pageSize()} data-rozie-s-d5dcab4c>25</option>
|
|
5802
|
+
<option value=${50} ?selected=${50 === this.pageSize()} data-rozie-s-d5dcab4c>50</option>
|
|
5803
|
+
<option value=${100} ?selected=${100 === this.pageSize()} data-rozie-s-d5dcab4c>100</option>
|
|
5177
5804
|
</select>
|
|
5178
5805
|
</div>` : lit.nothing}</div>
|
|
5179
5806
|
`;
|
|
@@ -5296,6 +5923,7 @@ __decorate([(0, lit_decorators_js.property)({
|
|
|
5296
5923
|
type: Object,
|
|
5297
5924
|
attribute: "expanded"
|
|
5298
5925
|
})], DataTable.prototype, "_expanded_attr", void 0);
|
|
5926
|
+
__decorate([(0, lit_decorators_js.property)({ type: Function })], DataTable.prototype, "getRowId", void 0);
|
|
5299
5927
|
__decorate([(0, lit_decorators_js.property)({ type: Function })], DataTable.prototype, "getSubRows", void 0);
|
|
5300
5928
|
__decorate([(0, lit_decorators_js.property)({
|
|
5301
5929
|
type: Boolean,
|
|
@@ -5377,6 +6005,12 @@ __decorate([(0, lit_decorators_js.state)()], DataTable.prototype, "_hasSlotDynam
|
|
|
5377
6005
|
__decorate([(0, lit_decorators_js.queryAssignedElements)({ flatten: true })], DataTable.prototype, "_slotDynamicColHeaderElements", void 0);
|
|
5378
6006
|
__decorate([(0, lit_decorators_js.state)()], DataTable.prototype, "_hasSlotDynamicFilter", void 0);
|
|
5379
6007
|
__decorate([(0, lit_decorators_js.queryAssignedElements)({ flatten: true })], DataTable.prototype, "_slotDynamicFilterElements", void 0);
|
|
6008
|
+
__decorate([(0, lit_decorators_js.state)()], DataTable.prototype, "_hasSlotPlaceholder", void 0);
|
|
6009
|
+
__decorate([(0, lit_decorators_js.queryAssignedElements)({
|
|
6010
|
+
slot: "placeholder",
|
|
6011
|
+
flatten: true
|
|
6012
|
+
})], DataTable.prototype, "_slotPlaceholderElements", void 0);
|
|
6013
|
+
__decorate([(0, lit_decorators_js.property)({ attribute: false })], DataTable.prototype, "placeholder", void 0);
|
|
5380
6014
|
__decorate([(0, lit_decorators_js.state)()], DataTable.prototype, "_hasSlotSelectCell", void 0);
|
|
5381
6015
|
__decorate([(0, lit_decorators_js.queryAssignedElements)({
|
|
5382
6016
|
slot: "selectCell",
|
|
@@ -5574,15 +6208,19 @@ let EditorText = class EditorText extends (0, _lit_labs_preact_signals.SignalWat
|
|
|
5574
6208
|
this.commit = null;
|
|
5575
6209
|
this.cancel = null;
|
|
5576
6210
|
this.autofocus = false;
|
|
6211
|
+
this.columnLabel = "";
|
|
5577
6212
|
this._draft = (0, _lit_labs_preact_signals.signal)("");
|
|
6213
|
+
this._touched = (0, _lit_labs_preact_signals.signal)(false);
|
|
5578
6214
|
this.__rozieFirstUpdateDone = false;
|
|
5579
6215
|
this._disconnectCleanups = [];
|
|
5580
6216
|
this._rozieTornDown = false;
|
|
6217
|
+
this.draftValue = () => this._touched.value ? this._draft.value : this.value != null ? String(this.value) : "";
|
|
5581
6218
|
this.onInput = (e) => {
|
|
5582
6219
|
this._draft.value = e && e.target ? e.target.value : "";
|
|
6220
|
+
this._touched.value = true;
|
|
5583
6221
|
};
|
|
5584
6222
|
this.doCommit = () => {
|
|
5585
|
-
this.commit && this.commit(this.
|
|
6223
|
+
this.commit && this.commit(this.draftValue());
|
|
5586
6224
|
};
|
|
5587
6225
|
this.doCancel = () => {
|
|
5588
6226
|
this.cancel && this.cancel();
|
|
@@ -5599,6 +6237,10 @@ let EditorText = class EditorText extends (0, _lit_labs_preact_signals.SignalWat
|
|
|
5599
6237
|
this.onBlur = () => {
|
|
5600
6238
|
this.doCommit();
|
|
5601
6239
|
};
|
|
6240
|
+
this.a11yLabel = () => {
|
|
6241
|
+
if (typeof this.columnLabel === "string" && this.columnLabel !== "") return this.columnLabel;
|
|
6242
|
+
return this.columnId;
|
|
6243
|
+
};
|
|
5602
6244
|
}
|
|
5603
6245
|
static {
|
|
5604
6246
|
this.styles = lit.css`
|
|
@@ -5606,7 +6248,6 @@ let EditorText = class EditorText extends (0, _lit_labs_preact_signals.SignalWat
|
|
|
5606
6248
|
`;
|
|
5607
6249
|
}
|
|
5608
6250
|
firstUpdated() {
|
|
5609
|
-
this._draft.value = this.value != null ? String(this.value) : "";
|
|
5610
6251
|
if (this.autofocus) this._refInputEl?.focus();
|
|
5611
6252
|
}
|
|
5612
6253
|
updated(changedProperties) {
|
|
@@ -5626,7 +6267,7 @@ let EditorText = class EditorText extends (0, _lit_labs_preact_signals.SignalWat
|
|
|
5626
6267
|
}
|
|
5627
6268
|
render() {
|
|
5628
6269
|
return lit.html`
|
|
5629
|
-
<input class="rdt-cell-editor" type="text" data-editing-cell="" aria-label=${this.
|
|
6270
|
+
<input class="rdt-cell-editor" type="text" data-editing-cell="" aria-label=${(0, _rozie_runtime_lit.rozieAttr)(this.a11yLabel())} .value=${this.draftValue()} @input=${($event) => {
|
|
5630
6271
|
this.onInput($event);
|
|
5631
6272
|
}} @keydown=${($event) => {
|
|
5632
6273
|
this.onKeydown($event);
|
|
@@ -5649,6 +6290,10 @@ __decorate([(0, lit_decorators_js.property)({
|
|
|
5649
6290
|
type: Boolean,
|
|
5650
6291
|
reflect: true
|
|
5651
6292
|
})], EditorText.prototype, "autofocus", void 0);
|
|
6293
|
+
__decorate([(0, lit_decorators_js.property)({
|
|
6294
|
+
type: String,
|
|
6295
|
+
reflect: true
|
|
6296
|
+
})], EditorText.prototype, "columnLabel", void 0);
|
|
5652
6297
|
__decorate([(0, lit_decorators_js.query)("[data-rozie-ref=\"inputEl\"]")], EditorText.prototype, "_refInputEl", void 0);
|
|
5653
6298
|
EditorText = __decorate([(0, lit_decorators_js.customElement)("rozie-editor-text")], EditorText);
|
|
5654
6299
|
var EditorText_default = EditorText;
|
|
@@ -5663,15 +6308,21 @@ let EditorNumber = class EditorNumber extends (0, _lit_labs_preact_signals.Signa
|
|
|
5663
6308
|
this.value = null;
|
|
5664
6309
|
this.commit = null;
|
|
5665
6310
|
this.cancel = null;
|
|
6311
|
+
this.autofocus = false;
|
|
6312
|
+
this.columnLabel = "";
|
|
5666
6313
|
this._draft = (0, _lit_labs_preact_signals.signal)("");
|
|
6314
|
+
this._touched = (0, _lit_labs_preact_signals.signal)(false);
|
|
6315
|
+
this.__rozieFirstUpdateDone = false;
|
|
5667
6316
|
this._disconnectCleanups = [];
|
|
5668
6317
|
this._rozieTornDown = false;
|
|
6318
|
+
this.draftValue = () => this._touched.value ? this._draft.value : this.value != null ? String(this.value) : "";
|
|
5669
6319
|
this.onInput = (e) => {
|
|
5670
6320
|
this._draft.value = e && e.target ? e.target.value : "";
|
|
6321
|
+
this._touched.value = true;
|
|
5671
6322
|
};
|
|
5672
6323
|
this.doCommit = () => {
|
|
5673
6324
|
if (!this.commit) return;
|
|
5674
|
-
const raw = this.
|
|
6325
|
+
const raw = this.draftValue();
|
|
5675
6326
|
if (raw == null || String(raw).trim() === "") {
|
|
5676
6327
|
this.commit(null);
|
|
5677
6328
|
return;
|
|
@@ -5694,6 +6345,10 @@ let EditorNumber = class EditorNumber extends (0, _lit_labs_preact_signals.Signa
|
|
|
5694
6345
|
this.onBlur = () => {
|
|
5695
6346
|
this.doCommit();
|
|
5696
6347
|
};
|
|
6348
|
+
this.a11yLabel = () => {
|
|
6349
|
+
if (typeof this.columnLabel === "string" && this.columnLabel !== "") return this.columnLabel;
|
|
6350
|
+
return this.columnId;
|
|
6351
|
+
};
|
|
5697
6352
|
}
|
|
5698
6353
|
static {
|
|
5699
6354
|
this.styles = lit.css`
|
|
@@ -5701,7 +6356,13 @@ let EditorNumber = class EditorNumber extends (0, _lit_labs_preact_signals.Signa
|
|
|
5701
6356
|
`;
|
|
5702
6357
|
}
|
|
5703
6358
|
firstUpdated() {
|
|
5704
|
-
this.
|
|
6359
|
+
if (this.autofocus) this._refInputEl?.focus();
|
|
6360
|
+
}
|
|
6361
|
+
updated(changedProperties) {
|
|
6362
|
+
if (this.__rozieFirstUpdateDone && changedProperties.has("autofocus")) ((v) => {
|
|
6363
|
+
if (v) this._refInputEl?.focus();
|
|
6364
|
+
})(this.autofocus);
|
|
6365
|
+
this.__rozieFirstUpdateDone = true;
|
|
5705
6366
|
}
|
|
5706
6367
|
disconnectedCallback() {
|
|
5707
6368
|
super.disconnectedCallback();
|
|
@@ -5714,13 +6375,13 @@ let EditorNumber = class EditorNumber extends (0, _lit_labs_preact_signals.Signa
|
|
|
5714
6375
|
}
|
|
5715
6376
|
render() {
|
|
5716
6377
|
return lit.html`
|
|
5717
|
-
<input class="rdt-cell-editor" type="number" data-editing-cell="" aria-label=${this.
|
|
6378
|
+
<input class="rdt-cell-editor" type="number" data-editing-cell="" aria-label=${(0, _rozie_runtime_lit.rozieAttr)(this.a11yLabel())} .value=${this.draftValue()} @input=${($event) => {
|
|
5718
6379
|
this.onInput($event);
|
|
5719
6380
|
}} @keydown=${($event) => {
|
|
5720
6381
|
this.onKeydown($event);
|
|
5721
6382
|
}} @blur=${($event) => {
|
|
5722
6383
|
this.onBlur();
|
|
5723
|
-
}} data-rozie-s-b2792b32 />
|
|
6384
|
+
}} data-rozie-ref="inputEl" data-rozie-s-b2792b32 />
|
|
5724
6385
|
`;
|
|
5725
6386
|
}
|
|
5726
6387
|
};
|
|
@@ -5733,6 +6394,15 @@ __decorate([(0, lit_decorators_js.property)({ type: Object })], EditorNumber.pro
|
|
|
5733
6394
|
__decorate([(0, lit_decorators_js.property)({ type: Object })], EditorNumber.prototype, "value", void 0);
|
|
5734
6395
|
__decorate([(0, lit_decorators_js.property)({ type: Function })], EditorNumber.prototype, "commit", void 0);
|
|
5735
6396
|
__decorate([(0, lit_decorators_js.property)({ type: Function })], EditorNumber.prototype, "cancel", void 0);
|
|
6397
|
+
__decorate([(0, lit_decorators_js.property)({
|
|
6398
|
+
type: Boolean,
|
|
6399
|
+
reflect: true
|
|
6400
|
+
})], EditorNumber.prototype, "autofocus", void 0);
|
|
6401
|
+
__decorate([(0, lit_decorators_js.property)({
|
|
6402
|
+
type: String,
|
|
6403
|
+
reflect: true
|
|
6404
|
+
})], EditorNumber.prototype, "columnLabel", void 0);
|
|
6405
|
+
__decorate([(0, lit_decorators_js.query)("[data-rozie-ref=\"inputEl\"]")], EditorNumber.prototype, "_refInputEl", void 0);
|
|
5736
6406
|
EditorNumber = __decorate([(0, lit_decorators_js.customElement)("rozie-editor-number")], EditorNumber);
|
|
5737
6407
|
var EditorNumber_default = EditorNumber;
|
|
5738
6408
|
//#endregion
|
|
@@ -5747,14 +6417,20 @@ let EditorSelect = class EditorSelect extends (0, _lit_labs_preact_signals.Signa
|
|
|
5747
6417
|
this.commit = null;
|
|
5748
6418
|
this.cancel = null;
|
|
5749
6419
|
this.options = [];
|
|
6420
|
+
this.autofocus = false;
|
|
6421
|
+
this.columnLabel = "";
|
|
5750
6422
|
this._draft = (0, _lit_labs_preact_signals.signal)("");
|
|
6423
|
+
this._touched = (0, _lit_labs_preact_signals.signal)(false);
|
|
6424
|
+
this.__rozieFirstUpdateDone = false;
|
|
5751
6425
|
this._disconnectCleanups = [];
|
|
5752
6426
|
this._rozieTornDown = false;
|
|
6427
|
+
this.draftValue = () => this._touched.value ? this._draft.value : this.value != null ? String(this.value) : "";
|
|
5753
6428
|
this.onChange = (e) => {
|
|
5754
6429
|
this._draft.value = e && e.target ? e.target.value : "";
|
|
6430
|
+
this._touched.value = true;
|
|
5755
6431
|
};
|
|
5756
6432
|
this.doCommit = () => {
|
|
5757
|
-
this.commit && this.commit(this.
|
|
6433
|
+
this.commit && this.commit(this.draftValue());
|
|
5758
6434
|
};
|
|
5759
6435
|
this.doCancel = () => {
|
|
5760
6436
|
this.cancel && this.cancel();
|
|
@@ -5771,6 +6447,10 @@ let EditorSelect = class EditorSelect extends (0, _lit_labs_preact_signals.Signa
|
|
|
5771
6447
|
this.onBlur = () => {
|
|
5772
6448
|
this.doCommit();
|
|
5773
6449
|
};
|
|
6450
|
+
this.a11yLabel = () => {
|
|
6451
|
+
if (typeof this.columnLabel === "string" && this.columnLabel !== "") return this.columnLabel;
|
|
6452
|
+
return this.columnId;
|
|
6453
|
+
};
|
|
5774
6454
|
}
|
|
5775
6455
|
static {
|
|
5776
6456
|
this.styles = lit.css`
|
|
@@ -5778,7 +6458,13 @@ let EditorSelect = class EditorSelect extends (0, _lit_labs_preact_signals.Signa
|
|
|
5778
6458
|
`;
|
|
5779
6459
|
}
|
|
5780
6460
|
firstUpdated() {
|
|
5781
|
-
this.
|
|
6461
|
+
if (this.autofocus) this._refSelectEl?.focus();
|
|
6462
|
+
}
|
|
6463
|
+
updated(changedProperties) {
|
|
6464
|
+
if (this.__rozieFirstUpdateDone && changedProperties.has("autofocus")) ((v) => {
|
|
6465
|
+
if (v) this._refSelectEl?.focus();
|
|
6466
|
+
})(this.autofocus);
|
|
6467
|
+
this.__rozieFirstUpdateDone = true;
|
|
5782
6468
|
}
|
|
5783
6469
|
disconnectedCallback() {
|
|
5784
6470
|
super.disconnectedCallback();
|
|
@@ -5791,14 +6477,14 @@ let EditorSelect = class EditorSelect extends (0, _lit_labs_preact_signals.Signa
|
|
|
5791
6477
|
}
|
|
5792
6478
|
render() {
|
|
5793
6479
|
return lit.html`
|
|
5794
|
-
<select class="rdt-cell-editor" data-editing-cell="" aria-label=${this.
|
|
6480
|
+
<select class="rdt-cell-editor" data-editing-cell="" aria-label=${(0, _rozie_runtime_lit.rozieAttr)(this.a11yLabel())} .value=${this.draftValue()} @change=${($event) => {
|
|
5795
6481
|
this.onChange($event);
|
|
5796
6482
|
}} @keydown=${($event) => {
|
|
5797
6483
|
this.onKeydown($event);
|
|
5798
6484
|
}} @blur=${($event) => {
|
|
5799
6485
|
this.onBlur();
|
|
5800
|
-
}} data-rozie-s-117f1a16>
|
|
5801
|
-
${(0, lit_directives_repeat_js.repeat)(this.options, (opt, _idx) => opt.value, (opt, _idx) => lit.html`<option value=${(0, _rozie_runtime_lit.rozieAttr)(opt.value)} data-rozie-s-117f1a16>${(0, _rozie_runtime_lit.rozieDisplay)(opt.label)}</option>`)}
|
|
6486
|
+
}} data-rozie-ref="selectEl" data-rozie-s-117f1a16>
|
|
6487
|
+
${(0, lit_directives_repeat_js.repeat)(this.options, (opt, _idx) => opt.value, (opt, _idx) => lit.html`<option value=${(0, _rozie_runtime_lit.rozieAttr)(opt.value)} ?selected=${opt.value === this.draftValue()} data-rozie-s-117f1a16>${(0, _rozie_runtime_lit.rozieDisplay)(opt.label)}</option>`)}
|
|
5802
6488
|
</select>
|
|
5803
6489
|
`;
|
|
5804
6490
|
}
|
|
@@ -5813,6 +6499,15 @@ __decorate([(0, lit_decorators_js.property)({ type: Object })], EditorSelect.pro
|
|
|
5813
6499
|
__decorate([(0, lit_decorators_js.property)({ type: Function })], EditorSelect.prototype, "commit", void 0);
|
|
5814
6500
|
__decorate([(0, lit_decorators_js.property)({ type: Function })], EditorSelect.prototype, "cancel", void 0);
|
|
5815
6501
|
__decorate([(0, lit_decorators_js.property)({ type: Array })], EditorSelect.prototype, "options", void 0);
|
|
6502
|
+
__decorate([(0, lit_decorators_js.property)({
|
|
6503
|
+
type: Boolean,
|
|
6504
|
+
reflect: true
|
|
6505
|
+
})], EditorSelect.prototype, "autofocus", void 0);
|
|
6506
|
+
__decorate([(0, lit_decorators_js.property)({
|
|
6507
|
+
type: String,
|
|
6508
|
+
reflect: true
|
|
6509
|
+
})], EditorSelect.prototype, "columnLabel", void 0);
|
|
6510
|
+
__decorate([(0, lit_decorators_js.query)("[data-rozie-ref=\"selectEl\"]")], EditorSelect.prototype, "_refSelectEl", void 0);
|
|
5816
6511
|
EditorSelect = __decorate([(0, lit_decorators_js.customElement)("rozie-editor-select")], EditorSelect);
|
|
5817
6512
|
var EditorSelect_default = EditorSelect;
|
|
5818
6513
|
//#endregion
|
|
@@ -5826,6 +6521,9 @@ let EditorCheckbox = class EditorCheckbox extends (0, _lit_labs_preact_signals.S
|
|
|
5826
6521
|
this.value = null;
|
|
5827
6522
|
this.commit = null;
|
|
5828
6523
|
this.cancel = null;
|
|
6524
|
+
this.autofocus = false;
|
|
6525
|
+
this.columnLabel = "";
|
|
6526
|
+
this.__rozieFirstUpdateDone = false;
|
|
5829
6527
|
this._disconnectCleanups = [];
|
|
5830
6528
|
this._rozieTornDown = false;
|
|
5831
6529
|
this.onChange = (e) => {
|
|
@@ -5837,12 +6535,25 @@ let EditorCheckbox = class EditorCheckbox extends (0, _lit_labs_preact_signals.S
|
|
|
5837
6535
|
this.cancel && this.cancel();
|
|
5838
6536
|
}
|
|
5839
6537
|
};
|
|
6538
|
+
this.a11yLabel = () => {
|
|
6539
|
+
if (typeof this.columnLabel === "string" && this.columnLabel !== "") return this.columnLabel;
|
|
6540
|
+
return this.columnId;
|
|
6541
|
+
};
|
|
5840
6542
|
}
|
|
5841
6543
|
static {
|
|
5842
6544
|
this.styles = lit.css`
|
|
5843
6545
|
:host{display:contents}
|
|
5844
6546
|
`;
|
|
5845
6547
|
}
|
|
6548
|
+
firstUpdated() {
|
|
6549
|
+
if (this.autofocus) this._refInputEl?.focus();
|
|
6550
|
+
}
|
|
6551
|
+
updated(changedProperties) {
|
|
6552
|
+
if (this.__rozieFirstUpdateDone && changedProperties.has("autofocus")) ((v) => {
|
|
6553
|
+
if (v) this._refInputEl?.focus();
|
|
6554
|
+
})(this.autofocus);
|
|
6555
|
+
this.__rozieFirstUpdateDone = true;
|
|
6556
|
+
}
|
|
5846
6557
|
disconnectedCallback() {
|
|
5847
6558
|
super.disconnectedCallback();
|
|
5848
6559
|
queueMicrotask(() => {
|
|
@@ -5854,11 +6565,11 @@ let EditorCheckbox = class EditorCheckbox extends (0, _lit_labs_preact_signals.S
|
|
|
5854
6565
|
}
|
|
5855
6566
|
render() {
|
|
5856
6567
|
return lit.html`
|
|
5857
|
-
<input class="rdt-cell-editor" type="checkbox" data-editing-cell="" aria-label=${this.
|
|
6568
|
+
<input class="rdt-cell-editor" type="checkbox" data-editing-cell="" aria-label=${(0, _rozie_runtime_lit.rozieAttr)(this.a11yLabel())} ?checked=${!!this.value} @change=${($event) => {
|
|
5858
6569
|
this.onChange($event);
|
|
5859
6570
|
}} @keydown=${($event) => {
|
|
5860
6571
|
this.onKeydown($event);
|
|
5861
|
-
}} data-rozie-s-3d792482 />
|
|
6572
|
+
}} data-rozie-ref="inputEl" data-rozie-s-3d792482 />
|
|
5862
6573
|
`;
|
|
5863
6574
|
}
|
|
5864
6575
|
};
|
|
@@ -5871,9 +6582,51 @@ __decorate([(0, lit_decorators_js.property)({ type: Object })], EditorCheckbox.p
|
|
|
5871
6582
|
__decorate([(0, lit_decorators_js.property)({ type: Object })], EditorCheckbox.prototype, "value", void 0);
|
|
5872
6583
|
__decorate([(0, lit_decorators_js.property)({ type: Function })], EditorCheckbox.prototype, "commit", void 0);
|
|
5873
6584
|
__decorate([(0, lit_decorators_js.property)({ type: Function })], EditorCheckbox.prototype, "cancel", void 0);
|
|
6585
|
+
__decorate([(0, lit_decorators_js.property)({
|
|
6586
|
+
type: Boolean,
|
|
6587
|
+
reflect: true
|
|
6588
|
+
})], EditorCheckbox.prototype, "autofocus", void 0);
|
|
6589
|
+
__decorate([(0, lit_decorators_js.property)({
|
|
6590
|
+
type: String,
|
|
6591
|
+
reflect: true
|
|
6592
|
+
})], EditorCheckbox.prototype, "columnLabel", void 0);
|
|
6593
|
+
__decorate([(0, lit_decorators_js.query)("[data-rozie-ref=\"inputEl\"]")], EditorCheckbox.prototype, "_refInputEl", void 0);
|
|
5874
6594
|
EditorCheckbox = __decorate([(0, lit_decorators_js.customElement)("rozie-editor-checkbox")], EditorCheckbox);
|
|
5875
6595
|
var EditorCheckbox_default = EditorCheckbox;
|
|
5876
6596
|
//#endregion
|
|
6597
|
+
//#region src/helpers/dateValue.ts
|
|
6598
|
+
/**
|
|
6599
|
+
* Coerce an arbitrary cell value to the `YYYY-MM-DD` string a native date input accepts.
|
|
6600
|
+
* Returns `''` for anything that cannot be read as a date — which is what the input shows for
|
|
6601
|
+
* "no date", so an unparseable value degrades to empty rather than to a broken control.
|
|
6602
|
+
*/
|
|
6603
|
+
const toIsoDateString = (v) => {
|
|
6604
|
+
if (v == null || v === "") return "";
|
|
6605
|
+
if (typeof v === "string") {
|
|
6606
|
+
const s = v.trim();
|
|
6607
|
+
if (/^\d{4}-\d{2}-\d{2}$/.test(s)) return s;
|
|
6608
|
+
const iso = /^(\d{4}-\d{2}-\d{2})T/.exec(s);
|
|
6609
|
+
if (iso) return iso[1];
|
|
6610
|
+
return fromDate(new Date(s));
|
|
6611
|
+
}
|
|
6612
|
+
if (typeof v === "number") return Number.isFinite(v) ? fromDate(new Date(v)) : "";
|
|
6613
|
+
if (typeof v === "object" && typeof v.getTime === "function") return fromDate(v);
|
|
6614
|
+
return "";
|
|
6615
|
+
};
|
|
6616
|
+
/**
|
|
6617
|
+
* Format a Date as `YYYY-MM-DD` from its LOCAL parts. Local, not UTC: the input renders a
|
|
6618
|
+
* calendar day, and `toISOString()` would show the previous day for anyone west of UTC on a
|
|
6619
|
+
* midnight-local value.
|
|
6620
|
+
*/
|
|
6621
|
+
const fromDate = (d) => {
|
|
6622
|
+
const t = d.getTime();
|
|
6623
|
+
if (!Number.isFinite(t)) return "";
|
|
6624
|
+
const y = d.getFullYear();
|
|
6625
|
+
const m = d.getMonth() + 1;
|
|
6626
|
+
const day = d.getDate();
|
|
6627
|
+
return String(y).padStart(4, "0") + "-" + String(m).padStart(2, "0") + "-" + String(day).padStart(2, "0");
|
|
6628
|
+
};
|
|
6629
|
+
//#endregion
|
|
5877
6630
|
//#region src/EditorDate.ts
|
|
5878
6631
|
let EditorDate = class EditorDate extends (0, _lit_labs_preact_signals.SignalWatcher)(lit.LitElement) {
|
|
5879
6632
|
constructor(..._args) {
|
|
@@ -5884,20 +6637,27 @@ let EditorDate = class EditorDate extends (0, _lit_labs_preact_signals.SignalWat
|
|
|
5884
6637
|
this.value = null;
|
|
5885
6638
|
this.commit = null;
|
|
5886
6639
|
this.cancel = null;
|
|
6640
|
+
this.autofocus = false;
|
|
6641
|
+
this.columnLabel = "";
|
|
5887
6642
|
this._draft = (0, _lit_labs_preact_signals.signal)("");
|
|
6643
|
+
this._touched = (0, _lit_labs_preact_signals.signal)(false);
|
|
6644
|
+
this.__rozieFirstUpdateDone = false;
|
|
5888
6645
|
this._disconnectCleanups = [];
|
|
5889
6646
|
this._rozieTornDown = false;
|
|
6647
|
+
this.draftValue = () => this._touched.value ? this._draft.value : toIsoDateString(this.value);
|
|
5890
6648
|
this.onInput = (e) => {
|
|
5891
6649
|
this._draft.value = e && e.target ? e.target.value : "";
|
|
6650
|
+
this._touched.value = true;
|
|
5892
6651
|
};
|
|
5893
6652
|
this.doCommit = () => {
|
|
5894
|
-
this.commit && this.commit(this.
|
|
6653
|
+
this.commit && this.commit(this.draftValue());
|
|
5895
6654
|
};
|
|
5896
6655
|
this.doCancel = () => {
|
|
5897
6656
|
this.cancel && this.cancel();
|
|
5898
6657
|
};
|
|
5899
6658
|
this.onChange = (e) => {
|
|
5900
6659
|
this._draft.value = e && e.target ? e.target.value : "";
|
|
6660
|
+
this._touched.value = true;
|
|
5901
6661
|
};
|
|
5902
6662
|
this.onKeydown = (e) => {
|
|
5903
6663
|
if (e && e.key === "Enter") {
|
|
@@ -5911,6 +6671,10 @@ let EditorDate = class EditorDate extends (0, _lit_labs_preact_signals.SignalWat
|
|
|
5911
6671
|
this.onBlur = () => {
|
|
5912
6672
|
this.doCommit();
|
|
5913
6673
|
};
|
|
6674
|
+
this.a11yLabel = () => {
|
|
6675
|
+
if (typeof this.columnLabel === "string" && this.columnLabel !== "") return this.columnLabel;
|
|
6676
|
+
return this.columnId;
|
|
6677
|
+
};
|
|
5914
6678
|
}
|
|
5915
6679
|
static {
|
|
5916
6680
|
this.styles = lit.css`
|
|
@@ -5918,7 +6682,13 @@ let EditorDate = class EditorDate extends (0, _lit_labs_preact_signals.SignalWat
|
|
|
5918
6682
|
`;
|
|
5919
6683
|
}
|
|
5920
6684
|
firstUpdated() {
|
|
5921
|
-
this.
|
|
6685
|
+
if (this.autofocus) this._refInputEl?.focus();
|
|
6686
|
+
}
|
|
6687
|
+
updated(changedProperties) {
|
|
6688
|
+
if (this.__rozieFirstUpdateDone && changedProperties.has("autofocus")) ((v) => {
|
|
6689
|
+
if (v) this._refInputEl?.focus();
|
|
6690
|
+
})(this.autofocus);
|
|
6691
|
+
this.__rozieFirstUpdateDone = true;
|
|
5922
6692
|
}
|
|
5923
6693
|
disconnectedCallback() {
|
|
5924
6694
|
super.disconnectedCallback();
|
|
@@ -5931,7 +6701,7 @@ let EditorDate = class EditorDate extends (0, _lit_labs_preact_signals.SignalWat
|
|
|
5931
6701
|
}
|
|
5932
6702
|
render() {
|
|
5933
6703
|
return lit.html`
|
|
5934
|
-
<input class="rdt-cell-editor" type="date" data-editing-cell="" aria-label=${this.
|
|
6704
|
+
<input class="rdt-cell-editor" type="date" data-editing-cell="" aria-label=${(0, _rozie_runtime_lit.rozieAttr)(this.a11yLabel())} .value=${this.draftValue()} @input=${($event) => {
|
|
5935
6705
|
this.onInput($event);
|
|
5936
6706
|
}} @change=${($event) => {
|
|
5937
6707
|
this.onChange($event);
|
|
@@ -5939,7 +6709,7 @@ let EditorDate = class EditorDate extends (0, _lit_labs_preact_signals.SignalWat
|
|
|
5939
6709
|
this.onKeydown($event);
|
|
5940
6710
|
}} @blur=${($event) => {
|
|
5941
6711
|
this.onBlur();
|
|
5942
|
-
}} data-rozie-s-7abe1a56 />
|
|
6712
|
+
}} data-rozie-ref="inputEl" data-rozie-s-7abe1a56 />
|
|
5943
6713
|
`;
|
|
5944
6714
|
}
|
|
5945
6715
|
};
|
|
@@ -5952,6 +6722,15 @@ __decorate([(0, lit_decorators_js.property)({ type: Object })], EditorDate.proto
|
|
|
5952
6722
|
__decorate([(0, lit_decorators_js.property)({ type: Object })], EditorDate.prototype, "value", void 0);
|
|
5953
6723
|
__decorate([(0, lit_decorators_js.property)({ type: Function })], EditorDate.prototype, "commit", void 0);
|
|
5954
6724
|
__decorate([(0, lit_decorators_js.property)({ type: Function })], EditorDate.prototype, "cancel", void 0);
|
|
6725
|
+
__decorate([(0, lit_decorators_js.property)({
|
|
6726
|
+
type: Boolean,
|
|
6727
|
+
reflect: true
|
|
6728
|
+
})], EditorDate.prototype, "autofocus", void 0);
|
|
6729
|
+
__decorate([(0, lit_decorators_js.property)({
|
|
6730
|
+
type: String,
|
|
6731
|
+
reflect: true
|
|
6732
|
+
})], EditorDate.prototype, "columnLabel", void 0);
|
|
6733
|
+
__decorate([(0, lit_decorators_js.query)("[data-rozie-ref=\"inputEl\"]")], EditorDate.prototype, "_refInputEl", void 0);
|
|
5955
6734
|
EditorDate = __decorate([(0, lit_decorators_js.customElement)("rozie-editor-date")], EditorDate);
|
|
5956
6735
|
var EditorDate_default = EditorDate;
|
|
5957
6736
|
//#endregion
|
|
@@ -5963,17 +6742,23 @@ let FilterText = class FilterText extends (0, _lit_labs_preact_signals.SignalWat
|
|
|
5963
6742
|
this.column = null;
|
|
5964
6743
|
this.value = null;
|
|
5965
6744
|
this.setFilter = null;
|
|
6745
|
+
this.columnLabel = "";
|
|
5966
6746
|
this._draft = (0, _lit_labs_preact_signals.signal)("");
|
|
6747
|
+
this._touched = (0, _lit_labs_preact_signals.signal)(false);
|
|
6748
|
+
this.__rozieFirstUpdateDone = false;
|
|
5967
6749
|
this._disconnectCleanups = [];
|
|
5968
6750
|
this._rozieTornDown = false;
|
|
6751
|
+
this.draftValue = () => this._touched.value ? this._draft.value : this.value != null ? String(this.value) : "";
|
|
5969
6752
|
this.onInput = (e) => {
|
|
5970
6753
|
this._draft.value = e && e.target ? e.target.value : "";
|
|
6754
|
+
this._touched.value = true;
|
|
5971
6755
|
};
|
|
5972
6756
|
this.applyFilter = () => {
|
|
5973
|
-
this.setFilter && this.setFilter(this.columnId, this.
|
|
6757
|
+
this.setFilter && this.setFilter(this.columnId, this.draftValue());
|
|
5974
6758
|
};
|
|
5975
6759
|
this.clearFilter = () => {
|
|
5976
6760
|
this._draft.value = "";
|
|
6761
|
+
this._touched.value = false;
|
|
5977
6762
|
this.setFilter && this.setFilter(this.columnId, "");
|
|
5978
6763
|
};
|
|
5979
6764
|
this.onKeydown = (e) => {
|
|
@@ -5988,14 +6773,22 @@ let FilterText = class FilterText extends (0, _lit_labs_preact_signals.SignalWat
|
|
|
5988
6773
|
this.onBlur = () => {
|
|
5989
6774
|
this.applyFilter();
|
|
5990
6775
|
};
|
|
6776
|
+
this.a11yLabel = () => {
|
|
6777
|
+
if (typeof this.columnLabel === "string" && this.columnLabel !== "") return this.columnLabel;
|
|
6778
|
+
return this.columnId;
|
|
6779
|
+
};
|
|
5991
6780
|
}
|
|
5992
6781
|
static {
|
|
5993
6782
|
this.styles = lit.css`
|
|
5994
6783
|
:host{display:contents}
|
|
5995
6784
|
`;
|
|
5996
6785
|
}
|
|
5997
|
-
|
|
5998
|
-
this.
|
|
6786
|
+
updated(changedProperties) {
|
|
6787
|
+
if (this.__rozieFirstUpdateDone && changedProperties.has("value")) {
|
|
6788
|
+
this.value;
|
|
6789
|
+
this._touched.value = false;
|
|
6790
|
+
}
|
|
6791
|
+
this.__rozieFirstUpdateDone = true;
|
|
5999
6792
|
}
|
|
6000
6793
|
disconnectedCallback() {
|
|
6001
6794
|
super.disconnectedCallback();
|
|
@@ -6008,7 +6801,7 @@ let FilterText = class FilterText extends (0, _lit_labs_preact_signals.SignalWat
|
|
|
6008
6801
|
}
|
|
6009
6802
|
render() {
|
|
6010
6803
|
return lit.html`
|
|
6011
|
-
<input class="rdt-col-filter" part="col-filter" type="text" aria-label=${this.
|
|
6804
|
+
<input class="rdt-col-filter" part="col-filter" type="text" aria-label=${(0, _rozie_runtime_lit.rozieAttr)(this.a11yLabel())} .value=${this.draftValue()} @input=${($event) => {
|
|
6012
6805
|
this.onInput($event);
|
|
6013
6806
|
}} @keydown=${($event) => {
|
|
6014
6807
|
this.onKeydown($event);
|
|
@@ -6025,6 +6818,10 @@ __decorate([(0, lit_decorators_js.property)({
|
|
|
6025
6818
|
__decorate([(0, lit_decorators_js.property)({ type: Object })], FilterText.prototype, "column", void 0);
|
|
6026
6819
|
__decorate([(0, lit_decorators_js.property)({ type: Object })], FilterText.prototype, "value", void 0);
|
|
6027
6820
|
__decorate([(0, lit_decorators_js.property)({ type: Function })], FilterText.prototype, "setFilter", void 0);
|
|
6821
|
+
__decorate([(0, lit_decorators_js.property)({
|
|
6822
|
+
type: String,
|
|
6823
|
+
reflect: true
|
|
6824
|
+
})], FilterText.prototype, "columnLabel", void 0);
|
|
6028
6825
|
FilterText = __decorate([(0, lit_decorators_js.customElement)("rozie-filter-text")], FilterText);
|
|
6029
6826
|
var FilterText_default = FilterText;
|
|
6030
6827
|
//#endregion
|
|
@@ -6037,24 +6834,41 @@ let FilterNumberRange = class FilterNumberRange extends (0, _lit_labs_preact_sig
|
|
|
6037
6834
|
this.value = null;
|
|
6038
6835
|
this.setFilter = null;
|
|
6039
6836
|
this.minMax = null;
|
|
6837
|
+
this.columnLabel = "";
|
|
6040
6838
|
this._minDraft = (0, _lit_labs_preact_signals.signal)("");
|
|
6041
6839
|
this._maxDraft = (0, _lit_labs_preact_signals.signal)("");
|
|
6840
|
+
this._touched = (0, _lit_labs_preact_signals.signal)(false);
|
|
6841
|
+
this.__rozieWatchInitial_0 = true;
|
|
6042
6842
|
this._disconnectCleanups = [];
|
|
6043
6843
|
this._rozieTornDown = false;
|
|
6844
|
+
this.minDraftValue = () => this._touched.value ? this._minDraft.value : Array.isArray(this.value) && this.value[0] != null ? String(this.value[0]) : "";
|
|
6845
|
+
this.maxDraftValue = () => this._touched.value ? this._maxDraft.value : Array.isArray(this.value) && this.value[1] != null ? String(this.value[1]) : "";
|
|
6044
6846
|
this.onMinInput = (e) => {
|
|
6045
6847
|
this._minDraft.value = e && e.target ? e.target.value : "";
|
|
6848
|
+
this._touched.value = true;
|
|
6046
6849
|
};
|
|
6047
6850
|
this.onMaxInput = (e) => {
|
|
6048
6851
|
this._maxDraft.value = e && e.target ? e.target.value : "";
|
|
6852
|
+
this._touched.value = true;
|
|
6853
|
+
};
|
|
6854
|
+
this.onKeydown = (e) => {
|
|
6855
|
+
if (e && e.key === "Enter") this.applyRange(this.minDraftValue(), this.maxDraftValue());
|
|
6856
|
+
};
|
|
6857
|
+
this.onBlur = () => {
|
|
6858
|
+
this.applyRange(this.minDraftValue(), this.maxDraftValue());
|
|
6049
6859
|
};
|
|
6050
6860
|
this.minPlaceholder = () => Array.isArray(this.minMax) && this.minMax[0] != null ? String(this.minMax[0]) : "";
|
|
6051
6861
|
this.maxPlaceholder = () => Array.isArray(this.minMax) && this.minMax[1] != null ? String(this.minMax[1]) : "";
|
|
6052
|
-
this.applyRange = () => {
|
|
6053
|
-
const minNum =
|
|
6054
|
-
const maxNum =
|
|
6862
|
+
this.applyRange = (minDraft, maxDraft) => {
|
|
6863
|
+
const minNum = minDraft === "" ? void 0 : Number(minDraft);
|
|
6864
|
+
const maxNum = maxDraft === "" ? void 0 : Number(maxDraft);
|
|
6055
6865
|
if (minNum === void 0 && maxNum === void 0) this.setFilter && this.setFilter(this.columnId, "");
|
|
6056
6866
|
else this.setFilter && this.setFilter(this.columnId, [minNum, maxNum]);
|
|
6057
6867
|
};
|
|
6868
|
+
this.a11yLabel = () => {
|
|
6869
|
+
if (typeof this.columnLabel === "string" && this.columnLabel !== "") return this.columnLabel;
|
|
6870
|
+
return this.columnId;
|
|
6871
|
+
};
|
|
6058
6872
|
}
|
|
6059
6873
|
static {
|
|
6060
6874
|
this.styles = lit.css`
|
|
@@ -6062,8 +6876,16 @@ let FilterNumberRange = class FilterNumberRange extends (0, _lit_labs_preact_sig
|
|
|
6062
6876
|
`;
|
|
6063
6877
|
}
|
|
6064
6878
|
firstUpdated() {
|
|
6065
|
-
this.
|
|
6066
|
-
|
|
6879
|
+
this._disconnectCleanups.push((0, _lit_labs_preact_signals.effect)(() => {
|
|
6880
|
+
Array.isArray(this.value) && String(this.value[0]) + "" + String(this.value[1]);
|
|
6881
|
+
(0, _lit_labs_preact_signals.untracked)(() => {
|
|
6882
|
+
if (this.__rozieWatchInitial_0) {
|
|
6883
|
+
this.__rozieWatchInitial_0 = false;
|
|
6884
|
+
return;
|
|
6885
|
+
}
|
|
6886
|
+
this._touched.value = false;
|
|
6887
|
+
});
|
|
6888
|
+
}));
|
|
6067
6889
|
}
|
|
6068
6890
|
disconnectedCallback() {
|
|
6069
6891
|
super.disconnectedCallback();
|
|
@@ -6077,16 +6899,20 @@ let FilterNumberRange = class FilterNumberRange extends (0, _lit_labs_preact_sig
|
|
|
6077
6899
|
render() {
|
|
6078
6900
|
return lit.html`
|
|
6079
6901
|
<span style="display:flex; align-items: center" data-rozie-s-97b2c090>
|
|
6080
|
-
<input class="rdt-col-filter" part="col-filter" type="number" aria-label=${(0, _rozie_runtime_lit.rozieAttr)(this.
|
|
6902
|
+
<input class="rdt-col-filter" part="col-filter" type="number" aria-label=${(0, _rozie_runtime_lit.rozieAttr)(this.a11yLabel() + " min")} placeholder=${(0, _rozie_runtime_lit.rozieAttr)(this.minPlaceholder())} .value=${this.minDraftValue()} @input=${($event) => {
|
|
6081
6903
|
this.onMinInput($event);
|
|
6082
|
-
}} @
|
|
6083
|
-
this.
|
|
6904
|
+
}} @keydown=${($event) => {
|
|
6905
|
+
this.onKeydown($event);
|
|
6906
|
+
}} @blur=${($event) => {
|
|
6907
|
+
this.onBlur();
|
|
6084
6908
|
}} data-rozie-s-97b2c090 />
|
|
6085
6909
|
<span data-rozie-s-97b2c090> - </span>
|
|
6086
|
-
<input class="rdt-col-filter" part="col-filter" type="number" aria-label=${(0, _rozie_runtime_lit.rozieAttr)(this.
|
|
6910
|
+
<input class="rdt-col-filter" part="col-filter" type="number" aria-label=${(0, _rozie_runtime_lit.rozieAttr)(this.a11yLabel() + " max")} placeholder=${(0, _rozie_runtime_lit.rozieAttr)(this.maxPlaceholder())} .value=${this.maxDraftValue()} @input=${($event) => {
|
|
6087
6911
|
this.onMaxInput($event);
|
|
6088
|
-
}} @
|
|
6089
|
-
this.
|
|
6912
|
+
}} @keydown=${($event) => {
|
|
6913
|
+
this.onKeydown($event);
|
|
6914
|
+
}} @blur=${($event) => {
|
|
6915
|
+
this.onBlur();
|
|
6090
6916
|
}} data-rozie-s-97b2c090 />
|
|
6091
6917
|
</span>
|
|
6092
6918
|
`;
|
|
@@ -6100,6 +6926,10 @@ __decorate([(0, lit_decorators_js.property)({ type: Object })], FilterNumberRang
|
|
|
6100
6926
|
__decorate([(0, lit_decorators_js.property)({ type: Object })], FilterNumberRange.prototype, "value", void 0);
|
|
6101
6927
|
__decorate([(0, lit_decorators_js.property)({ type: Function })], FilterNumberRange.prototype, "setFilter", void 0);
|
|
6102
6928
|
__decorate([(0, lit_decorators_js.property)({ type: Object })], FilterNumberRange.prototype, "minMax", void 0);
|
|
6929
|
+
__decorate([(0, lit_decorators_js.property)({
|
|
6930
|
+
type: String,
|
|
6931
|
+
reflect: true
|
|
6932
|
+
})], FilterNumberRange.prototype, "columnLabel", void 0);
|
|
6103
6933
|
FilterNumberRange = __decorate([(0, lit_decorators_js.customElement)("rozie-filter-number-range")], FilterNumberRange);
|
|
6104
6934
|
var FilterNumberRange_default = FilterNumberRange;
|
|
6105
6935
|
//#endregion
|
|
@@ -6112,6 +6942,7 @@ let FilterSelect = class FilterSelect extends (0, _lit_labs_preact_signals.Signa
|
|
|
6112
6942
|
this.value = null;
|
|
6113
6943
|
this.setFilter = null;
|
|
6114
6944
|
this.uniqueValues = [];
|
|
6945
|
+
this.columnLabel = "";
|
|
6115
6946
|
this._disconnectCleanups = [];
|
|
6116
6947
|
this._rozieTornDown = false;
|
|
6117
6948
|
this.selectValue = () => this.value != null ? String(this.value) : "";
|
|
@@ -6120,6 +6951,10 @@ let FilterSelect = class FilterSelect extends (0, _lit_labs_preact_signals.Signa
|
|
|
6120
6951
|
if (v === "") this.setFilter && this.setFilter(this.columnId, "");
|
|
6121
6952
|
else this.setFilter && this.setFilter(this.columnId, v);
|
|
6122
6953
|
};
|
|
6954
|
+
this.a11yLabel = () => {
|
|
6955
|
+
if (typeof this.columnLabel === "string" && this.columnLabel !== "") return this.columnLabel;
|
|
6956
|
+
return this.columnId;
|
|
6957
|
+
};
|
|
6123
6958
|
}
|
|
6124
6959
|
static {
|
|
6125
6960
|
this.styles = lit.css`
|
|
@@ -6137,11 +6972,11 @@ let FilterSelect = class FilterSelect extends (0, _lit_labs_preact_signals.Signa
|
|
|
6137
6972
|
}
|
|
6138
6973
|
render() {
|
|
6139
6974
|
return lit.html`
|
|
6140
|
-
<select class="rdt-col-filter" part="col-filter" aria-label=${this.
|
|
6975
|
+
<select class="rdt-col-filter" part="col-filter" aria-label=${(0, _rozie_runtime_lit.rozieAttr)(this.a11yLabel())} .value=${this.selectValue()} @change=${($event) => {
|
|
6141
6976
|
this.onChange($event);
|
|
6142
6977
|
}} data-rozie-s-d75b42b2>
|
|
6143
6978
|
<option value="" data-rozie-s-d75b42b2>All</option>
|
|
6144
|
-
${(0, lit_directives_repeat_js.repeat)(this.uniqueValues, (opt, _idx) => opt, (opt, _idx) => lit.html`<option value=${(0, _rozie_runtime_lit.rozieAttr)(opt)} data-rozie-s-d75b42b2>${(0, _rozie_runtime_lit.rozieDisplay)(opt)}</option>`)}
|
|
6979
|
+
${(0, lit_directives_repeat_js.repeat)(this.uniqueValues, (opt, _idx) => opt, (opt, _idx) => lit.html`<option value=${(0, _rozie_runtime_lit.rozieAttr)(opt)} ?selected=${opt === this.selectValue()} data-rozie-s-d75b42b2>${(0, _rozie_runtime_lit.rozieDisplay)(opt)}</option>`)}
|
|
6145
6980
|
</select>
|
|
6146
6981
|
`;
|
|
6147
6982
|
}
|
|
@@ -6154,6 +6989,10 @@ __decorate([(0, lit_decorators_js.property)({ type: Object })], FilterSelect.pro
|
|
|
6154
6989
|
__decorate([(0, lit_decorators_js.property)({ type: Object })], FilterSelect.prototype, "value", void 0);
|
|
6155
6990
|
__decorate([(0, lit_decorators_js.property)({ type: Function })], FilterSelect.prototype, "setFilter", void 0);
|
|
6156
6991
|
__decorate([(0, lit_decorators_js.property)({ type: Array })], FilterSelect.prototype, "uniqueValues", void 0);
|
|
6992
|
+
__decorate([(0, lit_decorators_js.property)({
|
|
6993
|
+
type: String,
|
|
6994
|
+
reflect: true
|
|
6995
|
+
})], FilterSelect.prototype, "columnLabel", void 0);
|
|
6157
6996
|
FilterSelect = __decorate([(0, lit_decorators_js.customElement)("rozie-filter-select")], FilterSelect);
|
|
6158
6997
|
var FilterSelect_default = FilterSelect;
|
|
6159
6998
|
//#endregion
|
|
@@ -6229,6 +7068,42 @@ let GroupBar = class GroupBar extends (0, _lit_labs_preact_signals.SignalWatcher
|
|
|
6229
7068
|
this.removeKey = (key) => {
|
|
6230
7069
|
this.applyGrouping && this.applyGrouping(this.grouping.filter((k) => k !== key));
|
|
6231
7070
|
};
|
|
7071
|
+
this.toggleKey = (id) => {
|
|
7072
|
+
if (!id) return;
|
|
7073
|
+
if (this.grouping.indexOf(id) !== -1) {
|
|
7074
|
+
this.removeKey(id);
|
|
7075
|
+
return;
|
|
7076
|
+
}
|
|
7077
|
+
this.applyGrouping && this.applyGrouping(this.grouping.concat([id]));
|
|
7078
|
+
};
|
|
7079
|
+
this.moveKey = (key, delta) => {
|
|
7080
|
+
const cur = this.grouping;
|
|
7081
|
+
const from = cur.indexOf(key);
|
|
7082
|
+
if (from === -1) return;
|
|
7083
|
+
const to = from + delta;
|
|
7084
|
+
if (to < 0 || to >= cur.length) return;
|
|
7085
|
+
const next = cur.slice();
|
|
7086
|
+
next.splice(from, 1);
|
|
7087
|
+
next.splice(to, 0, key);
|
|
7088
|
+
this.applyGrouping && this.applyGrouping(next);
|
|
7089
|
+
};
|
|
7090
|
+
this.onTokenKeydown = (e, gk) => {
|
|
7091
|
+
if (!e) return;
|
|
7092
|
+
const key = e.key;
|
|
7093
|
+
if (key === "Delete" || key === "Backspace") {
|
|
7094
|
+
e.preventDefault();
|
|
7095
|
+
this.removeKey(gk);
|
|
7096
|
+
return;
|
|
7097
|
+
}
|
|
7098
|
+
if (!e.altKey) return;
|
|
7099
|
+
if (key === "ArrowLeft") {
|
|
7100
|
+
e.preventDefault();
|
|
7101
|
+
this.moveKey(gk, -1);
|
|
7102
|
+
} else if (key === "ArrowRight") {
|
|
7103
|
+
e.preventDefault();
|
|
7104
|
+
this.moveKey(gk, 1);
|
|
7105
|
+
}
|
|
7106
|
+
};
|
|
6232
7107
|
this.clearAll = () => {
|
|
6233
7108
|
this.clearGrouping && this.clearGrouping();
|
|
6234
7109
|
};
|
|
@@ -6257,6 +7132,18 @@ let GroupBar = class GroupBar extends (0, _lit_labs_preact_signals.SignalWatcher
|
|
|
6257
7132
|
border-color: var(--rdt-group-drop-zone-border-over, rgba(37, 99, 235, 0.7));
|
|
6258
7133
|
background: var(--rdt-group-drop-zone-bg-over, rgba(37, 99, 235, 0.08));
|
|
6259
7134
|
}
|
|
7135
|
+
.rdt-group-token-add[data-rozie-s-546c469a] {
|
|
7136
|
+
font: inherit;
|
|
7137
|
+
color: inherit;
|
|
7138
|
+
border: none;
|
|
7139
|
+
background: none;
|
|
7140
|
+
cursor: pointer;
|
|
7141
|
+
}
|
|
7142
|
+
.rdt-group-token-add[data-rozie-s-546c469a]:focus-visible,
|
|
7143
|
+
.rdt-group-drop-zone[data-rozie-s-546c469a] [data-group-token][data-rozie-s-546c469a]:focus-visible {
|
|
7144
|
+
outline: var(--rdt-focus-ring, 2px solid #2563eb);
|
|
7145
|
+
outline-offset: 1px;
|
|
7146
|
+
}
|
|
6260
7147
|
.rdt-group-drop-hint[data-rozie-s-546c469a] {
|
|
6261
7148
|
opacity: 0.55;
|
|
6262
7149
|
font-size: 0.8125em;
|
|
@@ -6312,17 +7199,19 @@ let GroupBar = class GroupBar extends (0, _lit_labs_preact_signals.SignalWatcher
|
|
|
6312
7199
|
return lit.html`
|
|
6313
7200
|
<div class="rdt-group-bar" data-rozie-s-546c469a>
|
|
6314
7201
|
|
|
6315
|
-
${(0, lit_directives_repeat_js.repeat)(this.groupableColumns, (col, _idx) => col.id, (col, _idx) => lit.html`<
|
|
7202
|
+
${(0, lit_directives_repeat_js.repeat)(this.groupableColumns, (col, _idx) => col.id, (col, _idx) => lit.html`<button class="rdt-group-token rdt-group-token-add" type="button" part="group-token" draggable="true" aria-pressed=${(0, _rozie_runtime_lit.rozieAttr)(this.grouping.indexOf(col.id) !== -1 ? "true" : "false")} aria-label=${(0, _rozie_runtime_lit.rozieAttr)("Group by " + col.label)} @dragstart=${($event) => {
|
|
6316
7203
|
this.onChipDragStart($event, col.id);
|
|
6317
7204
|
}} @dragend=${($event) => {
|
|
6318
7205
|
this.onDragEnd();
|
|
6319
|
-
}}
|
|
7206
|
+
}} @click=${($event) => {
|
|
7207
|
+
this.toggleKey(col.id);
|
|
7208
|
+
}} data-rozie-s-546c469a>${(0, _rozie_runtime_lit.rozieDisplay)(col.label)}</button>`)}
|
|
6320
7209
|
|
|
6321
7210
|
|
|
6322
7211
|
<span class="${Object.entries({
|
|
6323
7212
|
"rdt-group-drop-zone": true,
|
|
6324
7213
|
"is-over": this._isOver.value
|
|
6325
|
-
}).filter(([, v]) => v).map(([k]) => k).join(" ")}" data-group-drop-zone="" @dragover=${($event) => {
|
|
7214
|
+
}).filter(([, v]) => v).map(([k]) => k).join(" ")}" data-group-drop-zone="" role="list" aria-label="Active grouping" @dragover=${($event) => {
|
|
6326
7215
|
this.onDragOver($event);
|
|
6327
7216
|
}} @dragleave=${($event) => {
|
|
6328
7217
|
this.onDragLeave($event);
|
|
@@ -6333,12 +7222,14 @@ let GroupBar = class GroupBar extends (0, _lit_labs_preact_signals.SignalWatcher
|
|
|
6333
7222
|
${!this.grouping.length ? lit.html`<span class="rdt-group-drop-hint" data-rozie-s-546c469a>Drag columns here to group</span>` : lit.nothing}${(0, lit_directives_repeat_js.repeat)(this.grouping, (gk, _idx) => gk, (gk, _idx) => lit.html`<span class="${Object.entries({
|
|
6334
7223
|
"rdt-group-token": true,
|
|
6335
7224
|
"is-drop-target": this._dragKind.value === "token" && this._dropKey.value === gk && this._draggingId.value !== gk
|
|
6336
|
-
}).filter(([, v]) => v).map(([k]) => k).join(" ")}" part="group-token" data-group-token="" draggable="true" @dragstart=${($event) => {
|
|
7225
|
+
}).filter(([, v]) => v).map(([k]) => k).join(" ")}" part="group-token" data-group-token="" draggable="true" role="listitem" tabindex="0" aria-label=${(0, _rozie_runtime_lit.rozieAttr)(this.labelFor(gk) + " grouping, position " + (this.grouping.indexOf(gk) + 1) + " of " + this.grouping.length + ". Alt+Arrow to reorder, Delete to remove.")} @dragstart=${($event) => {
|
|
6337
7226
|
this.onTokenDragStart($event, gk);
|
|
6338
7227
|
}} @dragover=${($event) => {
|
|
6339
7228
|
this.onTokenDragOver($event, gk);
|
|
6340
7229
|
}} @dragend=${($event) => {
|
|
6341
7230
|
this.onDragEnd();
|
|
7231
|
+
}} @keydown=${($event) => {
|
|
7232
|
+
this.onTokenKeydown($event, gk);
|
|
6342
7233
|
}} data-rozie-s-546c469a>
|
|
6343
7234
|
${(0, _rozie_runtime_lit.rozieDisplay)(this.labelFor(gk))}
|
|
6344
7235
|
<button class="rdt-group-token-remove" type="button" aria-label=${(0, _rozie_runtime_lit.rozieAttr)("Remove " + this.labelFor(gk) + " grouping")} @click=${($event) => {
|