@rozie-ui/data-table-lit 0.5.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 +23 -19
- package/dist/index.cjs +989 -165
- package/dist/index.d.cts +180 -25
- package/dist/index.d.mts +180 -25
- package/dist/index.mjs +989 -165
- package/package.json +2 -2
- package/src/Column.ts +1 -1
- package/src/DataTable.ts +1270 -149
- 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 +96 -75
- package/src/themes/bootstrap.css +59 -34
- package/src/themes/material.css +53 -32
- package/src/themes/shadcn.css +58 -33
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";
|
|
@@ -486,6 +539,26 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
486
539
|
columnSizingInfo: this._columnSizingInfo.value
|
|
487
540
|
});
|
|
488
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
|
+
};
|
|
489
562
|
this.buildConfigDef = (c) => {
|
|
490
563
|
if (!c) return null;
|
|
491
564
|
if (Array.isArray(c.columns)) {
|
|
@@ -522,9 +595,10 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
522
595
|
aggregationFn: wrapAggregationFn(c.aggregationFn),
|
|
523
596
|
pinned: c.pinned != null ? c.pinned : "",
|
|
524
597
|
width: c.width != null ? c.width : "",
|
|
598
|
+
...this.parseWidthToSize(c.width) != null ? { size: this.parseWidthToSize(c.width) } : {},
|
|
525
599
|
meta: {
|
|
526
600
|
editable: c.editable === true,
|
|
527
|
-
editor: c.editor != null ? c.editor : "text",
|
|
601
|
+
editor: c.editor != null ? this.checkEditorKind(id, c.editor) : "text",
|
|
528
602
|
editorOptions: c.editorOptions != null ? c.editorOptions : [],
|
|
529
603
|
validate: typeof c.validate === "function" ? c.validate : null
|
|
530
604
|
}
|
|
@@ -564,9 +638,10 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
564
638
|
aggregationFn: wrapAggregationFn(spec.aggregationFn),
|
|
565
639
|
pinned: spec.pinned != null ? spec.pinned : "",
|
|
566
640
|
width: spec.width != null ? spec.width : "",
|
|
641
|
+
...this.parseWidthToSize(spec.width) != null ? { size: this.parseWidthToSize(spec.width) } : {},
|
|
567
642
|
meta: {
|
|
568
643
|
editable: spec.editable === true,
|
|
569
|
-
editor: spec.editor != null ? spec.editor : "text",
|
|
644
|
+
editor: spec.editor != null ? this.checkEditorKind(id, spec.editor) : "text",
|
|
570
645
|
editorOptions: spec.editorOptions != null ? spec.editorOptions : [],
|
|
571
646
|
validate: typeof spec.validate === "function" ? spec.validate : null
|
|
572
647
|
}
|
|
@@ -910,7 +985,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
910
985
|
if (c && c.getIsPinned && c.getIsPinned()) out.push(i);
|
|
911
986
|
}
|
|
912
987
|
}
|
|
913
|
-
if (
|
|
988
|
+
if (this._activeColIndex.value >= 0 && out.indexOf(this._activeColIndex.value) === -1) out.push(this._activeColIndex.value);
|
|
914
989
|
if (this._editingRow.value >= 0 && this._editingCol.value >= 0 && out.indexOf(this._editingCol.value) === -1) out.push(this._editingCol.value);
|
|
915
990
|
return out;
|
|
916
991
|
};
|
|
@@ -931,18 +1006,37 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
931
1006
|
if (this.rowsWindowed()) return this.table.getPrePaginationRowModel().rows;
|
|
932
1007
|
return this.table.getRowModel().rows;
|
|
933
1008
|
};
|
|
1009
|
+
this.REMEASURE_MAX_FRAMES = 10;
|
|
934
1010
|
this.scheduleRemeasure = () => {
|
|
935
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
|
+
}
|
|
936
1017
|
if (this.remeasurePending) return;
|
|
937
1018
|
this.remeasurePending = true;
|
|
938
1019
|
let ranMicro = false;
|
|
939
1020
|
const microPass = () => {
|
|
940
1021
|
this.remeasureWindow();
|
|
941
1022
|
};
|
|
1023
|
+
let rafAttempts = 0;
|
|
942
1024
|
const rafPass = () => {
|
|
943
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
|
+
}
|
|
944
1039
|
this.remeasurePending = false;
|
|
945
|
-
this.remeasureWindow();
|
|
946
1040
|
};
|
|
947
1041
|
if (typeof queueMicrotask !== "undefined") {
|
|
948
1042
|
ranMicro = true;
|
|
@@ -964,6 +1058,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
964
1058
|
this.pinnedEditIndex = () => {
|
|
965
1059
|
if (this._editingRow.value >= 0) return this._editingRow.value;
|
|
966
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;
|
|
967
1062
|
return -1;
|
|
968
1063
|
};
|
|
969
1064
|
this.pinnedMeasurement = (pin) => {
|
|
@@ -972,12 +1067,84 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
972
1067
|
return ms && ms[pin] ? ms[pin] : null;
|
|
973
1068
|
};
|
|
974
1069
|
this.remeasureWindow = () => {
|
|
975
|
-
if (this.remeasureDisposed) return;
|
|
976
|
-
if (!this.virtualizer || !this.gridRoot) return;
|
|
977
|
-
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;
|
|
978
1073
|
const trs = this.gridRoot.querySelectorAll("tbody.rdt-tbody > tr[data-index]");
|
|
979
|
-
|
|
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
|
+
}
|
|
980
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
|
+
}));
|
|
981
1148
|
};
|
|
982
1149
|
this.virtualItemKey = (i) => {
|
|
983
1150
|
const src = this.windowSource();
|
|
@@ -1084,6 +1251,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
1084
1251
|
}
|
|
1085
1252
|
}
|
|
1086
1253
|
this.bumpWindowVer();
|
|
1254
|
+
this.scheduleRemeasure();
|
|
1087
1255
|
};
|
|
1088
1256
|
this.virtualizerOptions = () => ({
|
|
1089
1257
|
count: this.windowSource().length,
|
|
@@ -1256,20 +1424,29 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
1256
1424
|
if (filterChanged) return this.totalRowCount() + " results";
|
|
1257
1425
|
return "";
|
|
1258
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
|
+
};
|
|
1259
1435
|
this.reFeed = () => {
|
|
1260
1436
|
if (!this.table) return;
|
|
1261
1437
|
this.table.setOptions((prev) => ({
|
|
1262
1438
|
...prev,
|
|
1263
|
-
data: this.
|
|
1439
|
+
data: this.feedData(),
|
|
1264
1440
|
columns: this.tableColumns(),
|
|
1265
1441
|
state: this.currentState(),
|
|
1266
|
-
enableRowSelection: this.
|
|
1442
|
+
enableRowSelection: this.rowSelectionOption(),
|
|
1267
1443
|
enableMultiRowSelection: this.selectionMode === "multiple",
|
|
1268
1444
|
rowCount: this.rowCount ?? void 0,
|
|
1269
1445
|
pageCount: this.pageCount ?? void 0,
|
|
1270
1446
|
getExpandedRowModel: (0, _tanstack_table_core.getExpandedRowModel)(),
|
|
1271
1447
|
getSubRows: this.getSubRows || void 0,
|
|
1272
|
-
|
|
1448
|
+
getRowId: this.rowIdOption(),
|
|
1449
|
+
getRowCanExpand: this.expandable === true && this.getSubRows == null ? (row) => !this.rowIsLazyPlaceholder(row) : void 0,
|
|
1273
1450
|
onExpandedChange: this.onExpandedChangeCb,
|
|
1274
1451
|
autoResetExpanded: false,
|
|
1275
1452
|
getGroupedRowModel: (0, _tanstack_table_core.getGroupedRowModel)(),
|
|
@@ -1428,9 +1605,9 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
1428
1605
|
if (side === "right") return "position:sticky;right:" + (col.getAfter ? col.getAfter("right") : 0) + "px;z-index:" + zIndex + ";";
|
|
1429
1606
|
return "";
|
|
1430
1607
|
};
|
|
1431
|
-
this.thStyle = (header) => {
|
|
1608
|
+
this.thStyle = (header, widthPx = null) => {
|
|
1432
1609
|
let s = "";
|
|
1433
|
-
const w = this.headerWidth(header);
|
|
1610
|
+
const w = widthPx != null && widthPx > 0 ? widthPx + "px" : this.headerWidth(header);
|
|
1434
1611
|
if (w) s += "width:" + w + ";";
|
|
1435
1612
|
s += this.pinStyle(header && header.column ? header.column.id : null, 2);
|
|
1436
1613
|
return s;
|
|
@@ -1642,6 +1819,16 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
1642
1819
|
this.rowIndexOf = (row) => this.tick() >= 0 ? (this._rows.value || []).indexOf(row) : -1;
|
|
1643
1820
|
this.colIndexOf = (row, cellCtx) => this.tick() >= 0 ? this.visibleCellsFor(row).indexOf(cellCtx) : -1;
|
|
1644
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
|
+
};
|
|
1645
1832
|
this.pageRowOffset = () => {
|
|
1646
1833
|
if (!this.isGrid() || this.rowsWindowed()) return 0;
|
|
1647
1834
|
return this.pageIndex() * this.pageSize();
|
|
@@ -1685,14 +1872,15 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
1685
1872
|
const header = nextIsHeader == null ? this._activeIsHeader.value : nextIsHeader;
|
|
1686
1873
|
const rowOut = this.rowsWindowed() && this.virtualizer && this.rowIsOutsideWindow(r);
|
|
1687
1874
|
const colOut = this.colsWindowed() && this.colVirtualizer && this.colIsOutsideWindow(c);
|
|
1688
|
-
|
|
1689
|
-
|
|
1875
|
+
const rowScroll = !header && rowOut;
|
|
1876
|
+
if (rowScroll || colOut) {
|
|
1877
|
+
if (rowScroll) this.virtualizer.scrollToIndex(r, { align: "center" });
|
|
1690
1878
|
if (colOut) this.colVirtualizer.scrollToIndex(c, { align: "center" });
|
|
1691
1879
|
let focusAttempts = 0;
|
|
1692
1880
|
const myEpoch = this.focusIntentEpoch;
|
|
1693
1881
|
const focusWhenReady = () => {
|
|
1694
1882
|
if (this.focusIntentEpoch !== myEpoch) return;
|
|
1695
|
-
const el = this.resolveCellEl(String(r), c);
|
|
1883
|
+
const el = this.resolveCellEl(header ? "__header" : String(r), c, header ? lvl : null);
|
|
1696
1884
|
if (el) {
|
|
1697
1885
|
el.focus();
|
|
1698
1886
|
return;
|
|
@@ -1712,6 +1900,10 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
1712
1900
|
};
|
|
1713
1901
|
this.totalRowCount = () => {
|
|
1714
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
|
+
}
|
|
1715
1907
|
const fm = this.table.getFilteredRowModel();
|
|
1716
1908
|
return fm && fm.rows ? fm.rows.length : (this._rows.value || []).length;
|
|
1717
1909
|
};
|
|
@@ -1719,6 +1911,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
1719
1911
|
this.gridAriaRowCount = () => this.headerRowCount() + this.totalRowCount();
|
|
1720
1912
|
this.ariaPageOffset = () => this.table ? this.pageIndex() * this.pageSize() : 0;
|
|
1721
1913
|
this.bodyAriaRowIndex = (row) => this.headerRowCount() + this.rowIndexOf(row) + this.ariaPageOffset() + 1;
|
|
1914
|
+
this.gridAriaColCount = () => this.visibleColCount();
|
|
1722
1915
|
this.visibleColCount = () => {
|
|
1723
1916
|
const rowList = this._rows.value || [];
|
|
1724
1917
|
if (rowList.length) return rowList[0].getVisibleCells().length;
|
|
@@ -1889,6 +2082,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
1889
2082
|
const rowKey = this._activeIsHeader.value ? "__header" : String(this._activeRow.value);
|
|
1890
2083
|
return this.resolveCellEl(rowKey, this._activeColIndex.value, this._activeIsHeader.value ? this._activeHeaderLevel.value : null);
|
|
1891
2084
|
};
|
|
2085
|
+
this.activeCellHasControls = () => focusables(this.currentCellEl()).length > 0;
|
|
1892
2086
|
this.enterControl = () => {
|
|
1893
2087
|
const list = focusables(this.currentCellEl());
|
|
1894
2088
|
if (!list.length) return;
|
|
@@ -1933,10 +2127,10 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
1933
2127
|
let nextLevel = prevLevel;
|
|
1934
2128
|
if ((e.ctrlKey || e.metaKey) && e.shiftKey && !this._activeIsHeader.value && (key === "ArrowUp" || key === "ArrowDown" || key === "ArrowLeft" || key === "ArrowRight")) {
|
|
1935
2129
|
e.preventDefault();
|
|
1936
|
-
if (key === "ArrowUp") this.extendRange(-this.
|
|
1937
|
-
else if (key === "ArrowDown") this.extendRange(this.bodyRowCount() - 1 - this.
|
|
1938
|
-
else if (key === "ArrowLeft") this.extendRange(0, -this.
|
|
1939
|
-
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());
|
|
1940
2134
|
return;
|
|
1941
2135
|
} else if ((e.ctrlKey || e.metaKey) && !this._activeIsHeader.value && (key === "ArrowUp" || key === "ArrowDown" || key === "ArrowLeft" || key === "ArrowRight")) {
|
|
1942
2136
|
e.preventDefault();
|
|
@@ -2019,15 +2213,15 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2019
2213
|
nextCol = en.col;
|
|
2020
2214
|
nextIsHeader = false;
|
|
2021
2215
|
} else nextCol = this.gotoColEdge(true);
|
|
2022
|
-
} 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()) {
|
|
2023
2217
|
e.preventDefault();
|
|
2024
2218
|
this.copyRange();
|
|
2025
2219
|
return;
|
|
2026
|
-
} 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()) {
|
|
2027
2221
|
e.preventDefault();
|
|
2028
2222
|
this.pasteRange();
|
|
2029
2223
|
return;
|
|
2030
|
-
} 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()) {
|
|
2031
2225
|
e.preventDefault();
|
|
2032
2226
|
this.cutRange();
|
|
2033
2227
|
return;
|
|
@@ -2057,6 +2251,23 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2057
2251
|
e.preventDefault();
|
|
2058
2252
|
if (!this._activeIsHeader.value) this.selectAllBody();
|
|
2059
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;
|
|
2060
2271
|
} else if (key === "F2" && e.shiftKey && this.isActiveCellEditable()) {
|
|
2061
2272
|
e.preventDefault();
|
|
2062
2273
|
this.beginRowEdit((this._rows.value || [])[this._activeRow.value]);
|
|
@@ -2082,6 +2293,10 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2082
2293
|
this.onToggleExpand((this._rows.value || [])[this._activeRow.value], e);
|
|
2083
2294
|
this.recoverGridFocus(String(grpRow), grpCol, null, true);
|
|
2084
2295
|
return;
|
|
2296
|
+
} else if (key === "Enter" && !this._activeIsHeader.value && !this.activeCellHasControls()) {
|
|
2297
|
+
e.preventDefault();
|
|
2298
|
+
this.activateRowAt(this._activeRow.value, "keyboard");
|
|
2299
|
+
return;
|
|
2085
2300
|
} else if (key === "Enter" || key === "F2") {
|
|
2086
2301
|
e.preventDefault();
|
|
2087
2302
|
this.enterControl();
|
|
@@ -2136,8 +2351,11 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2136
2351
|
this._activeColIndex.value = col;
|
|
2137
2352
|
if (isHeader !== prevIsHeader || col !== prevCol || (isHeader ? movedLevel !== prevLevel : movedRow !== prevRow)) this.focusIntentEpoch = this.focusIntentEpoch + 1;
|
|
2138
2353
|
if (this.rangeTransition) this.rangeTransition = false;
|
|
2139
|
-
else if (this.rangeClickPending) this.rangeClickPending =
|
|
2140
|
-
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
|
+
}
|
|
2141
2359
|
if (tgt === cellEl) this._activeInControl.value = false;
|
|
2142
2360
|
};
|
|
2143
2361
|
this.onGridMouseDown = (e) => {
|
|
@@ -2158,9 +2376,14 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2158
2376
|
this._activeIsHeader.value = false;
|
|
2159
2377
|
this._activeRow.value = row;
|
|
2160
2378
|
this._activeColIndex.value = col;
|
|
2161
|
-
this.rangeClickPending =
|
|
2379
|
+
this.rangeClickPending = {
|
|
2380
|
+
isHeader: false,
|
|
2381
|
+
r: row,
|
|
2382
|
+
c: col
|
|
2383
|
+
};
|
|
2162
2384
|
return;
|
|
2163
2385
|
}
|
|
2386
|
+
if (this.isEditing(row, col)) return;
|
|
2164
2387
|
this.beginRangeDrag(row, col);
|
|
2165
2388
|
};
|
|
2166
2389
|
this.onGridDblClick = (e) => {
|
|
@@ -2188,7 +2411,43 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2188
2411
|
this.beginEdit(row, col, null);
|
|
2189
2412
|
}
|
|
2190
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
|
+
};
|
|
2191
2449
|
this.onGridClick = (e) => {
|
|
2450
|
+
this.maybeActivateRowFromClick(e);
|
|
2192
2451
|
if (!this.isGrid() || !e) return;
|
|
2193
2452
|
if (!this.singleClickEdit) return;
|
|
2194
2453
|
if (e.shiftKey) return;
|
|
@@ -2299,7 +2558,8 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2299
2558
|
const headers = hg && hg.headers || [];
|
|
2300
2559
|
if (!this.colsWindowed()) return headers.map((h) => ({
|
|
2301
2560
|
header: h,
|
|
2302
|
-
span: h && h.colSpan > 1 ? h.colSpan : 1
|
|
2561
|
+
span: h && h.colSpan > 1 ? h.colSpan : 1,
|
|
2562
|
+
width: null
|
|
2303
2563
|
}));
|
|
2304
2564
|
const idx = this.windowedColIndices();
|
|
2305
2565
|
const idxSet = {};
|
|
@@ -2313,23 +2573,39 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2313
2573
|
const end = cursor + leafCount;
|
|
2314
2574
|
cursor = end;
|
|
2315
2575
|
let span = 0;
|
|
2316
|
-
|
|
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
|
+
}
|
|
2317
2581
|
if (span > 0) out.push({
|
|
2318
2582
|
header: h,
|
|
2319
|
-
span
|
|
2583
|
+
span,
|
|
2584
|
+
width
|
|
2320
2585
|
});
|
|
2321
2586
|
}
|
|
2322
2587
|
return out;
|
|
2323
2588
|
};
|
|
2324
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
|
+
};
|
|
2325
2600
|
this.remeasureColumnWindow = () => {
|
|
2326
2601
|
if (!this.colsWindowed() || !this.colVirtualizer) return;
|
|
2327
2602
|
this.colVirtualizer.setOptions(this.columnVirtualizerOptions());
|
|
2603
|
+
this.remeasureColumnSizes();
|
|
2328
2604
|
this.colVirtualizer._willUpdate();
|
|
2329
2605
|
};
|
|
2330
2606
|
this.gridEmptyFallback = false;
|
|
2331
2607
|
this.rangeTransition = false;
|
|
2332
|
-
this.rangeClickPending =
|
|
2608
|
+
this.rangeClickPending = null;
|
|
2333
2609
|
this.rangeActive = false;
|
|
2334
2610
|
this.inRange = (rIdx, cIdx) => {
|
|
2335
2611
|
const a = this._rangeAnchor.value;
|
|
@@ -2371,7 +2647,17 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2371
2647
|
const c1 = a.colIndex > f.colIndex ? a.colIndex : f.colIndex;
|
|
2372
2648
|
return rIdx === r1 && cIdx === c1;
|
|
2373
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
|
+
};
|
|
2374
2659
|
this.emitRangeChange = (anchor, focus) => {
|
|
2660
|
+
this._rangeAnnounce.value = this.rangeSummary(anchor, focus);
|
|
2375
2661
|
this.dispatchEvent(new CustomEvent("range-change", {
|
|
2376
2662
|
detail: {
|
|
2377
2663
|
anchor,
|
|
@@ -2414,11 +2700,15 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2414
2700
|
this.focusActiveCell(nextRow, nextCol, false);
|
|
2415
2701
|
if (!hadRange || nextRow !== focus.rowIndex || nextCol !== focus.colIndex) this.emitRangeChange(anchor, nextFocus);
|
|
2416
2702
|
};
|
|
2417
|
-
this.setRangeFocus = (rIdx, cIdx) => {
|
|
2703
|
+
this.setRangeFocus = (rIdx, cIdx, anchorR = null, anchorC = null) => {
|
|
2418
2704
|
const maxRow = this.bodyRowCount() - 1;
|
|
2419
2705
|
const maxCol = this.visibleColCount() - 1;
|
|
2420
2706
|
if (maxRow < 0 || maxCol < 0) return;
|
|
2421
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
|
+
};
|
|
2422
2712
|
if (!anchor) anchor = {
|
|
2423
2713
|
rowIndex: this._activeRow.value,
|
|
2424
2714
|
colIndex: this._activeColIndex.value
|
|
@@ -2449,6 +2739,32 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2449
2739
|
this.rangeActive = true;
|
|
2450
2740
|
this.emitRangeChange(anchor, focus);
|
|
2451
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
|
+
};
|
|
2452
2768
|
this.clearRange = () => {
|
|
2453
2769
|
if (!this.rangeActive) return;
|
|
2454
2770
|
this.rangeActive = false;
|
|
@@ -2528,6 +2844,8 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2528
2844
|
}
|
|
2529
2845
|
return lines.join("\n");
|
|
2530
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";
|
|
2531
2849
|
this.copyRange = () => {
|
|
2532
2850
|
if (!this.clipboardActiveAllowed()) return;
|
|
2533
2851
|
if (typeof navigator === "undefined" || !navigator.clipboard || !navigator.clipboard.writeText) return;
|
|
@@ -2536,27 +2854,30 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2536
2854
|
if (p && p.catch) p.catch(() => {});
|
|
2537
2855
|
} catch (err) {}
|
|
2538
2856
|
};
|
|
2539
|
-
this.applyGridToRange = (grid, originRow, originCol) => {
|
|
2857
|
+
this.applyGridToRange = (grid, originRow, originCol, verb) => {
|
|
2858
|
+
const opVerb = typeof verb === "string" && verb !== "" ? verb : "pasted";
|
|
2540
2859
|
const maxRow = this.bodyRowCount() - 1;
|
|
2541
2860
|
const maxCol = this.visibleColCount() - 1;
|
|
2542
2861
|
if (maxRow < 0 || maxCol < 0) return {
|
|
2543
2862
|
wrote: 0,
|
|
2863
|
+
changed: 0,
|
|
2544
2864
|
total: 0
|
|
2545
2865
|
};
|
|
2546
2866
|
let total = 0;
|
|
2547
|
-
let
|
|
2867
|
+
let applied = 0;
|
|
2548
2868
|
const committed = [];
|
|
2549
2869
|
let next = this.currentData();
|
|
2550
2870
|
for (let gr = 0; gr < grid.length; gr++) {
|
|
2551
2871
|
const r = originRow + gr;
|
|
2552
2872
|
if (r > maxRow) break;
|
|
2553
2873
|
const rowGrouped = this.rowIndexIsGrouped(r);
|
|
2874
|
+
const rowPlaceholder = this.rowIsLazyPlaceholder((this._rows.value || [])[r]);
|
|
2554
2875
|
const cols = grid[gr] || [];
|
|
2555
2876
|
for (let gc = 0; gc < cols.length; gc++) {
|
|
2556
2877
|
const c = originCol + gc;
|
|
2557
2878
|
if (c > maxCol) break;
|
|
2558
2879
|
total = total + 1;
|
|
2559
|
-
if (rowGrouped) continue;
|
|
2880
|
+
if (rowGrouped || rowPlaceholder) continue;
|
|
2560
2881
|
const colId = this.columnIdAt(r, c);
|
|
2561
2882
|
if (colId == null || !this.columnEditable(colId)) continue;
|
|
2562
2883
|
const rowObj = this.rowOriginalAt(r);
|
|
@@ -2565,6 +2886,8 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2565
2886
|
const field = this.fieldOfColId(colId);
|
|
2566
2887
|
const srcIndex = this.sourceIndexOfRow(r);
|
|
2567
2888
|
const oldValue = rowObj ? rowObj[field] : null;
|
|
2889
|
+
applied = applied + 1;
|
|
2890
|
+
if (oldValue === value) continue;
|
|
2568
2891
|
next = replaceRowValue(next, srcIndex, field, value);
|
|
2569
2892
|
committed.push({
|
|
2570
2893
|
rowId: this.rowIdAt(r),
|
|
@@ -2572,23 +2895,27 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2572
2895
|
oldValue,
|
|
2573
2896
|
newValue: value
|
|
2574
2897
|
});
|
|
2575
|
-
wrote = wrote + 1;
|
|
2576
2898
|
}
|
|
2577
2899
|
}
|
|
2578
|
-
if (
|
|
2900
|
+
if (committed.length > 0) {
|
|
2579
2901
|
this.editTransition = true;
|
|
2580
2902
|
this.writeData(next);
|
|
2581
2903
|
this.editTransition = false;
|
|
2582
|
-
for (let i = 0; i < committed.length; i++)
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
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
|
+
}
|
|
2587
2913
|
}
|
|
2588
|
-
if (
|
|
2589
|
-
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");
|
|
2590
2916
|
return {
|
|
2591
|
-
wrote,
|
|
2917
|
+
wrote: applied,
|
|
2918
|
+
changed: committed.length,
|
|
2592
2919
|
total
|
|
2593
2920
|
};
|
|
2594
2921
|
};
|
|
@@ -2620,11 +2947,15 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2620
2947
|
}
|
|
2621
2948
|
if (!p || !p.then) return;
|
|
2622
2949
|
p.then((text) => {
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
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
|
+
}, () => {});
|
|
2628
2959
|
};
|
|
2629
2960
|
this.cutRange = () => {
|
|
2630
2961
|
if (!this.clipboardActiveAllowed()) return;
|
|
@@ -2643,7 +2974,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2643
2974
|
for (let c = c0; c <= c1; c++) cols.push("");
|
|
2644
2975
|
grid.push(cols);
|
|
2645
2976
|
}
|
|
2646
|
-
this.applyGridToRange(grid, r0, c0);
|
|
2977
|
+
this.applyGridToRange(grid, r0, c0, "cut");
|
|
2647
2978
|
};
|
|
2648
2979
|
this.clearActiveRange = () => {
|
|
2649
2980
|
if (!this.clipboardActiveAllowed()) return;
|
|
@@ -2658,7 +2989,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2658
2989
|
for (let c = c0; c <= c1; c++) cols.push("");
|
|
2659
2990
|
grid.push(cols);
|
|
2660
2991
|
}
|
|
2661
|
-
this.applyGridToRange(grid, r0, c0);
|
|
2992
|
+
this.applyGridToRange(grid, r0, c0, "cleared");
|
|
2662
2993
|
};
|
|
2663
2994
|
this.fillRange = (sourceBox, endCell) => {
|
|
2664
2995
|
let box;
|
|
@@ -2696,7 +3027,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2696
3027
|
}
|
|
2697
3028
|
grid.push(cols);
|
|
2698
3029
|
}
|
|
2699
|
-
this.applyGridToRange(grid, box.r0, box.c0);
|
|
3030
|
+
this.applyGridToRange(grid, box.r0, box.c0, "filled");
|
|
2700
3031
|
};
|
|
2701
3032
|
this.fillDragging = false;
|
|
2702
3033
|
this.fillDragMove = null;
|
|
@@ -2858,7 +3189,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2858
3189
|
if (cell && (cell.r !== lastCell.r || cell.c !== lastCell.c)) {
|
|
2859
3190
|
lastCell = cell;
|
|
2860
3191
|
this.rangeDragMoved = true;
|
|
2861
|
-
this.setRangeFocus(cell.r, cell.c);
|
|
3192
|
+
this.setRangeFocus(cell.r, cell.c, anchorR, anchorC);
|
|
2862
3193
|
}
|
|
2863
3194
|
};
|
|
2864
3195
|
const up = () => {
|
|
@@ -2880,6 +3211,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2880
3211
|
};
|
|
2881
3212
|
this.isActiveCellEditable = () => {
|
|
2882
3213
|
if (this.rowIndexIsGrouped(this._activeRow.value)) return false;
|
|
3214
|
+
if (this.rowIsLazyPlaceholder((this._rows.value || [])[this._activeRow.value])) return false;
|
|
2883
3215
|
const colId = this.activeCellColumnId();
|
|
2884
3216
|
return colId != null && this.columnEditable(colId);
|
|
2885
3217
|
};
|
|
@@ -2991,12 +3323,14 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
2991
3323
|
};
|
|
2992
3324
|
this.beginEdit = (rowIndex, colIndex, seed) => {
|
|
2993
3325
|
if (this.rowIndexIsGrouped(rowIndex)) return;
|
|
3326
|
+
if (this.rowIsLazyPlaceholder((this._rows.value || [])[rowIndex])) return;
|
|
2994
3327
|
const colId = this.columnIdAt(rowIndex, colIndex);
|
|
2995
3328
|
if (colId == null || !this.columnEditable(colId)) return;
|
|
2996
3329
|
this.committedThisSession = false;
|
|
2997
3330
|
this.setInvalid("");
|
|
2998
3331
|
this._editingRowIndex.value = null;
|
|
2999
3332
|
this._rowDraft.value = {};
|
|
3333
|
+
this.rowDraftSync = {};
|
|
3000
3334
|
this._editingRow.value = rowIndex;
|
|
3001
3335
|
this._editingCol.value = colIndex;
|
|
3002
3336
|
this._draftValue.value = seed != null ? seed : this.cellValueAt(rowIndex, colIndex);
|
|
@@ -3039,6 +3373,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
3039
3373
|
this.endRowEdit = () => {
|
|
3040
3374
|
this._editingRowIndex.value = null;
|
|
3041
3375
|
this._rowDraft.value = {};
|
|
3376
|
+
this.rowDraftSync = {};
|
|
3042
3377
|
this._invalidMsg.value = "";
|
|
3043
3378
|
this._activeInControl.value = false;
|
|
3044
3379
|
this._editVer.value = this._editVer.value + 1;
|
|
@@ -3052,7 +3387,14 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
3052
3387
|
return this._editFocusColId.value != null && this._editFocusColId.value === colId;
|
|
3053
3388
|
};
|
|
3054
3389
|
this.coerceCellValue = (colId, raw) => {
|
|
3055
|
-
|
|
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;
|
|
3056
3398
|
if (raw == null) return null;
|
|
3057
3399
|
if (typeof raw === "number") return Number.isNaN(raw) ? null : raw;
|
|
3058
3400
|
const s = String(raw).trim();
|
|
@@ -3114,10 +3456,11 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
3114
3456
|
};
|
|
3115
3457
|
this.toggleActiveBooleanCell = () => {
|
|
3116
3458
|
if (this.rowIndexIsGrouped(this._activeRow.value)) return;
|
|
3117
|
-
const colId = this.columnIdAt(this._activeRow.value, this._activeColIndex.value);
|
|
3118
|
-
if (colId == null || !this.columnEditable(colId)) return;
|
|
3119
3459
|
const row = (this._rows.value || [])[this._activeRow.value];
|
|
3120
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;
|
|
3121
3464
|
const rowOriginal = row.original;
|
|
3122
3465
|
const rowId = row.id;
|
|
3123
3466
|
const oldValue = this.cellValueAt(this._activeRow.value, this._activeColIndex.value);
|
|
@@ -3203,6 +3546,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
3203
3546
|
const rowIndex = this.rowIndexOf(row);
|
|
3204
3547
|
if (rowIndex < 0) return;
|
|
3205
3548
|
if (this.rowIndexIsGrouped(rowIndex)) return;
|
|
3549
|
+
if (this.rowIsLazyPlaceholder((this._rows.value || [])[rowIndex])) return;
|
|
3206
3550
|
const editable = this.editableColumnsForRow(rowIndex);
|
|
3207
3551
|
if (editable.length === 0) return;
|
|
3208
3552
|
this.committedThisSession = false;
|
|
@@ -3218,6 +3562,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
3218
3562
|
draft[ec.colId] = orig ? orig[ec.field] : null;
|
|
3219
3563
|
}
|
|
3220
3564
|
this._rowDraft.value = draft;
|
|
3565
|
+
this.rowDraftSync = draft;
|
|
3221
3566
|
this._editingRowIndex.value = rowIndex;
|
|
3222
3567
|
this._activeInControl.value = true;
|
|
3223
3568
|
this._editVer.value = this._editVer.value + 1;
|
|
@@ -3235,7 +3580,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
3235
3580
|
const r = (this._rows.value || [])[rowIndex];
|
|
3236
3581
|
const rowOriginal = r ? r.original : null;
|
|
3237
3582
|
const rowId = r ? r.id : null;
|
|
3238
|
-
const draft = this.
|
|
3583
|
+
const draft = this.rowDraftSync || {};
|
|
3239
3584
|
for (let i = 0; i < editable.length; i++) {
|
|
3240
3585
|
const ec = editable[i];
|
|
3241
3586
|
const err = this.runValidator(ec.colId, this.coerceCellValue(ec.colId, draft[ec.colId]), rowOriginal);
|
|
@@ -3348,6 +3693,8 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
3348
3693
|
this.editTransition = false;
|
|
3349
3694
|
this.pendingEditFollow = null;
|
|
3350
3695
|
this.committedThisSession = false;
|
|
3696
|
+
this.rowDraftSync = {};
|
|
3697
|
+
this.dropinTabFlush = null;
|
|
3351
3698
|
this.inRowEdit = () => this._editingRowIndex.value != null;
|
|
3352
3699
|
this.editorValueFor = (colId) => this.inRowEdit() ? this._rowDraft.value ? this._rowDraft.value[colId] : null : this._draftValue.value;
|
|
3353
3700
|
this.editorCheckedFor = (colId) => !!(this.inRowEdit() ? this._rowDraft.value ? this._rowDraft.value[colId] : null : this._draftValue.value);
|
|
@@ -3356,6 +3703,11 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
3356
3703
|
this.setRowDraft(colId, value);
|
|
3357
3704
|
return;
|
|
3358
3705
|
}
|
|
3706
|
+
if (this.dropinTabFlush) {
|
|
3707
|
+
this.dropinTabFlush.called = true;
|
|
3708
|
+
if (this.commitEdit(value, true)) this.dropinTabFlush.committed = true;
|
|
3709
|
+
return;
|
|
3710
|
+
}
|
|
3359
3711
|
this.commitEdit(value);
|
|
3360
3712
|
};
|
|
3361
3713
|
this.editorCancelFor = () => () => {
|
|
@@ -3382,10 +3734,11 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
3382
3734
|
this._draftValue.value = v;
|
|
3383
3735
|
};
|
|
3384
3736
|
this.setRowDraft = (colId, value) => {
|
|
3385
|
-
const src = this.
|
|
3737
|
+
const src = this.rowDraftSync || {};
|
|
3386
3738
|
const next = {};
|
|
3387
3739
|
for (const k in src) next[k] = src[k];
|
|
3388
3740
|
next[colId] = value;
|
|
3741
|
+
this.rowDraftSync = next;
|
|
3389
3742
|
this._rowDraft.value = next;
|
|
3390
3743
|
};
|
|
3391
3744
|
this.rowEditTab = (target, backward) => {
|
|
@@ -3440,6 +3793,56 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
3440
3793
|
this.cancelEdit();
|
|
3441
3794
|
}
|
|
3442
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
|
+
};
|
|
3443
3846
|
this.onEditorBlur = (e) => {
|
|
3444
3847
|
if (this.inRowEdit()) {
|
|
3445
3848
|
if (this.editTransition) return;
|
|
@@ -3452,13 +3855,20 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
3452
3855
|
}
|
|
3453
3856
|
if (this._editingRow.value < 0 || this.editTransition) return;
|
|
3454
3857
|
const next = e ? e.relatedTarget : null;
|
|
3455
|
-
|
|
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
|
+
}
|
|
3456
3867
|
if (!(this.gridRoot && this.gridRoot.contains && this.gridRoot.contains(next))) {
|
|
3457
3868
|
this.commitEdit(void 0);
|
|
3458
3869
|
return;
|
|
3459
3870
|
}
|
|
3460
3871
|
const nextCell = next.closest ? next.closest("[data-grid-cell]") : null;
|
|
3461
|
-
const fromCell = e && e.target && e.target.closest ? e.target.closest("[data-grid-cell]") : null;
|
|
3462
3872
|
if (!nextCell || !fromCell || nextCell === fromCell) return;
|
|
3463
3873
|
const fromRow = fromCell.getAttribute("data-row");
|
|
3464
3874
|
const fromCol = fromCell.getAttribute("data-col-index");
|
|
@@ -3637,32 +4047,30 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
3637
4047
|
this.styles = lit.css`
|
|
3638
4048
|
:host{display:contents}
|
|
3639
4049
|
:host {
|
|
3640
|
-
--rdt-
|
|
3641
|
-
--rdt-
|
|
3642
|
-
--rdt-
|
|
3643
|
-
--rdt-border: 1px solid var(--rozie-data-table-border-color);
|
|
3644
|
-
--rdt-
|
|
3645
|
-
--rdt-
|
|
3646
|
-
--rdt-
|
|
3647
|
-
--rdt-
|
|
3648
|
-
--rdt-
|
|
3649
|
-
--rdt-
|
|
3650
|
-
--rdt-
|
|
3651
|
-
--rdt-
|
|
3652
|
-
--rdt-
|
|
3653
|
-
--rdt-
|
|
3654
|
-
--rdt-
|
|
3655
|
-
--rdt-
|
|
3656
|
-
--rdt-
|
|
3657
|
-
--rdt-
|
|
3658
|
-
--rdt-
|
|
3659
|
-
--rdt-
|
|
3660
|
-
--rdt-
|
|
3661
|
-
--rdt-
|
|
3662
|
-
--rdt-
|
|
3663
|
-
--rdt-
|
|
3664
|
-
--rdt-colvis-menu-shadow: var(--rozie-data-table-menu-shadow);
|
|
3665
|
-
--rdt-select-accent: var(--rozie-data-table-select-accent);
|
|
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));
|
|
3666
4074
|
}
|
|
3667
4075
|
.rozie-data-table[data-rozie-s-d5dcab4c] {
|
|
3668
4076
|
border-collapse: collapse;
|
|
@@ -3798,6 +4206,16 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
3798
4206
|
flex-direction: column;
|
|
3799
4207
|
gap: var(--rdt-chrome-gap, 0.5rem);
|
|
3800
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
|
+
}
|
|
3801
4219
|
.rozie-data-table-wrap[data-rozie-s-d5dcab4c] .rdt-toolbar[data-rozie-s-d5dcab4c] {
|
|
3802
4220
|
display: flex;
|
|
3803
4221
|
gap: var(--rdt-toolbar-gap, 0.5rem);
|
|
@@ -3836,6 +4254,9 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
3836
4254
|
.rozie-data-table[data-rozie-s-d5dcab4c] .rdt-filter-row[data-rozie-s-d5dcab4c] {
|
|
3837
4255
|
background: var(--rdt-filter-row-bg, rgba(0, 0, 0, 0.015));
|
|
3838
4256
|
}
|
|
4257
|
+
.rozie-data-table[data-rozie-s-d5dcab4c] .rdt-pinned[data-rozie-s-d5dcab4c] {
|
|
4258
|
+
box-sizing: border-box;
|
|
4259
|
+
}
|
|
3839
4260
|
.rozie-data-table[data-rozie-s-d5dcab4c] .rdt-filter-cell[data-rozie-s-d5dcab4c] {
|
|
3840
4261
|
padding: var(--rdt-filter-cell-padding, 0.35rem 0.75rem);
|
|
3841
4262
|
border-bottom: var(--rdt-border, 1px solid rgba(0, 0, 0, 0.08));
|
|
@@ -3955,6 +4376,9 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
3955
4376
|
.rozie-data-table-wrap[data-rozie-s-d5dcab4c] .rdt-colvis-summary[data-rozie-s-d5dcab4c] {
|
|
3956
4377
|
cursor: pointer;
|
|
3957
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;
|
|
3958
4382
|
padding: var(--rdt-colvis-summary-padding, 0.25rem 0.6rem);
|
|
3959
4383
|
border: var(--rdt-colvis-summary-border, 1px solid rgba(0, 0, 0, 0.2));
|
|
3960
4384
|
border-radius: var(--rdt-colvis-summary-radius, 4px);
|
|
@@ -3993,6 +4417,51 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
3993
4417
|
text-align: var(--rdt-expander-col-align, center);
|
|
3994
4418
|
white-space: nowrap;
|
|
3995
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
|
+
}
|
|
3996
4465
|
.rozie-data-table[data-rozie-s-d5dcab4c] .rdt-select-all[data-rozie-s-d5dcab4c],
|
|
3997
4466
|
.rozie-data-table[data-rozie-s-d5dcab4c] .rdt-select-row[data-rozie-s-d5dcab4c] {
|
|
3998
4467
|
cursor: pointer;
|
|
@@ -4056,6 +4525,17 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
4056
4525
|
update();
|
|
4057
4526
|
}
|
|
4058
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
|
+
}
|
|
4059
4539
|
{
|
|
4060
4540
|
const slotEl = this.shadowRoot?.querySelector("slot[name=\"selectCell\"]");
|
|
4061
4541
|
if (slotEl !== null && slotEl !== void 0) {
|
|
@@ -4151,6 +4631,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
4151
4631
|
this._hasSlotSelectAll = Array.from(this.children).some((el) => el.getAttribute("slot") === "selectAll");
|
|
4152
4632
|
this._hasSlotDynamicColHeader = Array.from(this.children).some((el) => !el.hasAttribute("slot") && (el.nodeType !== 3 || (el.textContent?.trim().length ?? 0) > 0));
|
|
4153
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");
|
|
4154
4635
|
this._hasSlotSelectCell = Array.from(this.children).some((el) => el.getAttribute("slot") === "selectCell");
|
|
4155
4636
|
this._hasSlotDynamicCell = Array.from(this.children).some((el) => !el.hasAttribute("slot") && (el.nodeType !== 3 || (el.textContent?.trim().length ?? 0) > 0));
|
|
4156
4637
|
this._hasSlotDynamicEditor = Array.from(this.children).some((el) => !el.hasAttribute("slot") && (el.nodeType !== 3 || (el.textContent?.trim().length ?? 0) > 0));
|
|
@@ -4168,12 +4649,22 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
4168
4649
|
firstUpdated() {
|
|
4169
4650
|
this._armListeners();
|
|
4170
4651
|
this._disconnectCleanups.push((0, _lit_labs_preact_signals.effect)(() => {
|
|
4171
|
-
this.
|
|
4652
|
+
this._windowVer.value;
|
|
4172
4653
|
(0, _lit_labs_preact_signals.untracked)(() => {
|
|
4173
4654
|
if (this.__rozieWatchInitial_0) {
|
|
4174
4655
|
this.__rozieWatchInitial_0 = false;
|
|
4175
4656
|
return;
|
|
4176
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
|
+
}
|
|
4177
4668
|
(() => {
|
|
4178
4669
|
this.seedColumnPinning();
|
|
4179
4670
|
this.reFeed();
|
|
@@ -4184,8 +4675,8 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
4184
4675
|
this._disconnectCleanups.push((0, _lit_labs_preact_signals.effect)(() => {
|
|
4185
4676
|
this.sorting, this.columnFilters, this.globalFilter, this._sortingDefault.value, this._columnFiltersDefault.value, this._globalFilterDefault.value;
|
|
4186
4677
|
(0, _lit_labs_preact_signals.untracked)(() => {
|
|
4187
|
-
if (this.
|
|
4188
|
-
this.
|
|
4678
|
+
if (this.__rozieWatchInitial_2) {
|
|
4679
|
+
this.__rozieWatchInitial_2 = false;
|
|
4189
4680
|
return;
|
|
4190
4681
|
}
|
|
4191
4682
|
(() => {
|
|
@@ -4201,6 +4692,8 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
4201
4692
|
if (id == null) return;
|
|
4202
4693
|
const key = String(id);
|
|
4203
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;
|
|
4204
4697
|
__rozieCtxHost._colReg.value = {
|
|
4205
4698
|
...__rozieCtxHost._colReg.value,
|
|
4206
4699
|
[key]: spec
|
|
@@ -4217,7 +4710,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
4217
4710
|
this._dataDefault.value = this.data || [];
|
|
4218
4711
|
this.seedColumnPinning();
|
|
4219
4712
|
this.table = (0, _tanstack_table_core.createTable)({
|
|
4220
|
-
data: this.
|
|
4713
|
+
data: this.feedData(),
|
|
4221
4714
|
columns: this.tableColumns(),
|
|
4222
4715
|
state: this.currentState(),
|
|
4223
4716
|
getCoreRowModel: (0, _tanstack_table_core.getCoreRowModel)(),
|
|
@@ -4226,7 +4719,8 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
4226
4719
|
getPaginationRowModel: (0, _tanstack_table_core.getPaginationRowModel)(),
|
|
4227
4720
|
getExpandedRowModel: (0, _tanstack_table_core.getExpandedRowModel)(),
|
|
4228
4721
|
getSubRows: this.getSubRows || void 0,
|
|
4229
|
-
|
|
4722
|
+
getRowId: this.rowIdOption(),
|
|
4723
|
+
getRowCanExpand: this.expandable === true && this.getSubRows == null ? (row) => !this.rowIsLazyPlaceholder(row) : void 0,
|
|
4230
4724
|
onExpandedChange: this.onExpandedChangeCb,
|
|
4231
4725
|
autoResetExpanded: false,
|
|
4232
4726
|
getGroupedRowModel: (0, _tanstack_table_core.getGroupedRowModel)(),
|
|
@@ -4239,7 +4733,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
4239
4733
|
manualSorting: this.manual === true,
|
|
4240
4734
|
rowCount: this.rowCount ?? void 0,
|
|
4241
4735
|
pageCount: this.pageCount ?? void 0,
|
|
4242
|
-
enableRowSelection: this.
|
|
4736
|
+
enableRowSelection: this.rowSelectionOption(),
|
|
4243
4737
|
enableMultiRowSelection: this.selectionMode === "multiple",
|
|
4244
4738
|
onSortingChange: this.onSortingChangeCb,
|
|
4245
4739
|
onGlobalFilterChange: this.onGlobalFilterChangeCb,
|
|
@@ -4264,6 +4758,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
4264
4758
|
this._headerGroups.value = nextGroups;
|
|
4265
4759
|
this._rowModelVer.value = this._rowModelVer.value + 1;
|
|
4266
4760
|
if (this.rowsWindowed() && this.virtualizer) {
|
|
4761
|
+
this.migratePlaceholderSizeCache();
|
|
4267
4762
|
this.virtualizer.setOptions(this.virtualizerOptions());
|
|
4268
4763
|
this.virtualizer._willUpdate();
|
|
4269
4764
|
}
|
|
@@ -4289,6 +4784,18 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
4289
4784
|
};
|
|
4290
4785
|
this.refreshRowModel();
|
|
4291
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
|
+
}
|
|
4292
4799
|
if (this.isWindowed()) this.gridScrollEl = this._ref__rozieRoot ? this._ref__rozieRoot.querySelector(".rdt-scroll") : null;
|
|
4293
4800
|
if (this.rowsWindowed()) {
|
|
4294
4801
|
this.virtualizer = new _tanstack_virtual_core.Virtualizer(this.virtualizerOptions());
|
|
@@ -4322,6 +4829,8 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
4322
4829
|
}
|
|
4323
4830
|
updated(changedProperties) {
|
|
4324
4831
|
this.maybeClearHistoryOnExternalSwap();
|
|
4832
|
+
this.emitVisibleRangeIfChanged();
|
|
4833
|
+
this.remeasureColumnSizes();
|
|
4325
4834
|
if (!this.table) return;
|
|
4326
4835
|
const d = this.currentData() || [];
|
|
4327
4836
|
if (d === this.lastData && d.length === this.lastDataLen) return;
|
|
@@ -4360,7 +4869,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
|
|
|
4360
4869
|
|
|
4361
4870
|
<div class="rdt-column-defs" style="display:none" aria-hidden="true" data-rozie-s-d5dcab4c><slot></slot></div>
|
|
4362
4871
|
|
|
4363
|
-
${!!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>
|
|
4364
4873
|
<input class="rdt-global-filter" type="text" role="searchbox" aria-label="Search table" .value=${this.globalFilterValue()} @input=${($event) => {
|
|
4365
4874
|
this.onGlobalFilterInput($event);
|
|
4366
4875
|
}} data-rozie-s-d5dcab4c />
|
|
@@ -4401,7 +4910,7 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4401
4910
|
"rozie-data-table": true,
|
|
4402
4911
|
"rdt-sticky": this.stickyHeader,
|
|
4403
4912
|
"rdt-col-windowed": this.colsWindowed()
|
|
4404
|
-
}).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) => {
|
|
4405
4914
|
this.onGridKeyDown($event);
|
|
4406
4915
|
}} @focusin=${($event) => {
|
|
4407
4916
|
this.syncActiveFromEvent($event);
|
|
@@ -4421,9 +4930,10 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4421
4930
|
"rdt-th": true,
|
|
4422
4931
|
"rdt-select-th": this.isSelectColumn(wh.header.column.id),
|
|
4423
4932
|
"rdt-expander-th": this.isExpanderColumn(wh.header.column.id),
|
|
4933
|
+
"rdt-pinned": this.columnPinSide(wh.header.column.id) !== "",
|
|
4424
4934
|
"rdt-th-resizing": this.columnIsResizing(wh.header.column.id),
|
|
4425
4935
|
"rdt-cell-active": this.isActiveCell("__header", this.headerColIndexOf(hg, wh.header), hgLevel)
|
|
4426
|
-
}).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>
|
|
4427
4937
|
${this.isSelectColumn(wh.header.column.id) ? lit.html`<span style="display:contents" data-rozie-s-d5dcab4c>
|
|
4428
4938
|
${this.selectAll !== void 0 ? this.selectAll({
|
|
4429
4939
|
checked: this.isAllRowsSelected(),
|
|
@@ -4539,7 +5049,10 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4539
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>`)}
|
|
4540
5050
|
|
|
4541
5051
|
${this.hasAnyFilterableColumn() ? lit.html`<tr class="rdt-filter-row" data-rozie-s-d5dcab4c>
|
|
4542
|
-
${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>
|
|
4543
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>
|
|
4544
5057
|
${this.columnIsFilterable(wh.header.column.id) ? lit.html`<span style="display:contents" data-rozie-s-d5dcab4c>
|
|
4545
5058
|
${this.rozieSlots?.[`filter-${wh.header.column.id}`] !== void 0 ? this.rozieSlots?.[`filter-${wh.header.column.id}`]({
|
|
@@ -4547,6 +5060,7 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4547
5060
|
value: this.columnFilterValue(wh.header.column.id),
|
|
4548
5061
|
uniqueValues: this.getFacetedUniqueValues(wh.header.column.id),
|
|
4549
5062
|
minMax: this.getFacetedMinMaxValues(wh.header.column.id),
|
|
5063
|
+
columnLabel: this.headerLabel(wh.header.column.id),
|
|
4550
5064
|
setFilter: this.setColumnFilter
|
|
4551
5065
|
}) : lit.html`<slot name="${`filter-${wh.header.column.id}`}" data-rozie-params=${(() => {
|
|
4552
5066
|
try {
|
|
@@ -4554,7 +5068,8 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4554
5068
|
columnId: wh.header.column.id,
|
|
4555
5069
|
value: this.columnFilterValue(wh.header.column.id),
|
|
4556
5070
|
uniqueValues: this.getFacetedUniqueValues(wh.header.column.id),
|
|
4557
|
-
minMax: this.getFacetedMinMaxValues(wh.header.column.id)
|
|
5071
|
+
minMax: this.getFacetedMinMaxValues(wh.header.column.id),
|
|
5072
|
+
columnLabel: this.headerLabel(wh.header.column.id)
|
|
4558
5073
|
});
|
|
4559
5074
|
} catch {
|
|
4560
5075
|
return "{}";
|
|
@@ -4565,6 +5080,7 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4565
5080
|
value: this.columnFilterValue(wh.header.column.id),
|
|
4566
5081
|
uniqueValues: this.getFacetedUniqueValues(wh.header.column.id),
|
|
4567
5082
|
minMax: this.getFacetedMinMaxValues(wh.header.column.id),
|
|
5083
|
+
columnLabel: this.headerLabel(wh.header.column.id),
|
|
4568
5084
|
setFilter: this.setColumnFilter
|
|
4569
5085
|
}) : lit.html`<slot name="filter" data-rozie-params=${(() => {
|
|
4570
5086
|
try {
|
|
@@ -4572,7 +5088,8 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4572
5088
|
columnId: wh.header.column.id,
|
|
4573
5089
|
value: this.columnFilterValue(wh.header.column.id),
|
|
4574
5090
|
uniqueValues: this.getFacetedUniqueValues(wh.header.column.id),
|
|
4575
|
-
minMax: this.getFacetedMinMaxValues(wh.header.column.id)
|
|
5091
|
+
minMax: this.getFacetedMinMaxValues(wh.header.column.id),
|
|
5092
|
+
columnLabel: this.headerLabel(wh.header.column.id)
|
|
4576
5093
|
});
|
|
4577
5094
|
} catch {
|
|
4578
5095
|
return "{}";
|
|
@@ -4598,18 +5115,40 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4598
5115
|
<tr class="${Object.entries({
|
|
4599
5116
|
"rdt-tr": true,
|
|
4600
5117
|
"rdt-group-header": this.rowIsGrouped(wr.row),
|
|
4601
|
-
"rdt-row-pinned": wr.pinned
|
|
4602
|
-
|
|
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>
|
|
4603
5121
|
|
|
4604
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({
|
|
4605
5123
|
"rdt-td": true,
|
|
4606
5124
|
"rdt-select-td": this.isSelectColumn(cell.column.id),
|
|
4607
5125
|
"rdt-expander-td": this.isExpanderColumn(cell.column.id),
|
|
5126
|
+
"rdt-pinned": this.columnPinSide(cell.column.id) !== "",
|
|
4608
5127
|
"rdt-in-range": this.inRange(wr.vi.index, this.colIndexOf(wr.row, cell)),
|
|
4609
5128
|
"rdt-cell-active": this.isActiveCell(String(wr.vi.index), this.colIndexOf(wr.row, cell))
|
|
4610
|
-
}).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>
|
|
4611
5130
|
|
|
4612
|
-
|
|
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>
|
|
4613
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) => {
|
|
4614
5153
|
this.onToggleExpand(wr.row, $event);
|
|
4615
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>
|
|
@@ -4674,27 +5213,29 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4674
5213
|
</span>
|
|
4675
5214
|
<span class="rdt-group-count" data-rozie-s-d5dcab4c>${(0, _rozie_runtime_lit.rozieDisplay)("(" + this.groupSubRowCount(wr.row) + ")")}</span>
|
|
4676
5215
|
</span>` : this.isEditing(wr.vi.index, this.colIndexOf(wr.row, cell)) ? lit.html`<span style="display:contents" data-rozie-s-d5dcab4c>
|
|
4677
|
-
${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) => {
|
|
4678
5217
|
this.onCellEditorInput(cell.column.id, $event);
|
|
4679
5218
|
}} @keydown=${($event) => {
|
|
4680
5219
|
this.onEditorKeyDown($event);
|
|
4681
5220
|
}} @blur=${($event) => {
|
|
4682
5221
|
this.onEditorBlur($event);
|
|
4683
|
-
}} 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) => {
|
|
4684
5223
|
this.onCellEditorInput(cell.column.id, $event);
|
|
4685
5224
|
}} @keydown=${($event) => {
|
|
4686
5225
|
this.onEditorKeyDown($event);
|
|
4687
5226
|
}} @blur=${($event) => {
|
|
4688
5227
|
this.onEditorBlur($event);
|
|
4689
5228
|
}} data-rozie-s-d5dcab4c>
|
|
4690
|
-
${(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>`)}
|
|
4691
|
-
</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) => {
|
|
4692
5231
|
this.onCellEditorCheckbox(cell.column.id, $event);
|
|
4693
5232
|
}} @keydown=${($event) => {
|
|
4694
5233
|
this.onEditorKeyDown($event);
|
|
4695
5234
|
}} @blur=${($event) => {
|
|
4696
5235
|
this.onEditorBlur($event);
|
|
4697
|
-
}} 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>
|
|
4698
5239
|
${this.rozieSlots?.[`editor-${cell.column.id}`] !== void 0 ? this.rozieSlots?.[`editor-${cell.column.id}`]({
|
|
4699
5240
|
columnId: cell.column.id,
|
|
4700
5241
|
column: cell.column,
|
|
@@ -4702,6 +5243,7 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4702
5243
|
value: this.editorValueFor(cell.column.id),
|
|
4703
5244
|
commit: this.editorCommitFor(cell.column.id),
|
|
4704
5245
|
cancel: this.editorCancelFor(),
|
|
5246
|
+
columnLabel: this.headerLabel(cell.column.id),
|
|
4705
5247
|
autofocus: this.editorAutofocusFor(cell.column.id, wr.vi.index)
|
|
4706
5248
|
}) : lit.html`<slot name="${`editor-${cell.column.id}`}" data-rozie-params=${(() => {
|
|
4707
5249
|
try {
|
|
@@ -4712,6 +5254,7 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4712
5254
|
value: this.editorValueFor(cell.column.id),
|
|
4713
5255
|
commit: this.editorCommitFor(cell.column.id),
|
|
4714
5256
|
cancel: this.editorCancelFor(),
|
|
5257
|
+
columnLabel: this.headerLabel(cell.column.id),
|
|
4715
5258
|
autofocus: this.editorAutofocusFor(cell.column.id, wr.vi.index)
|
|
4716
5259
|
});
|
|
4717
5260
|
} catch {
|
|
@@ -4725,6 +5268,7 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4725
5268
|
value: this.editorValueFor(cell.column.id),
|
|
4726
5269
|
commit: this.editorCommitFor(cell.column.id),
|
|
4727
5270
|
cancel: this.editorCancelFor(),
|
|
5271
|
+
columnLabel: this.headerLabel(cell.column.id),
|
|
4728
5272
|
autofocus: this.editorAutofocusFor(cell.column.id, wr.vi.index)
|
|
4729
5273
|
}) : lit.html`<slot name="editor" data-rozie-params=${(() => {
|
|
4730
5274
|
try {
|
|
@@ -4735,13 +5279,14 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4735
5279
|
value: this.editorValueFor(cell.column.id),
|
|
4736
5280
|
commit: this.editorCommitFor(cell.column.id),
|
|
4737
5281
|
cancel: this.editorCancelFor(),
|
|
5282
|
+
columnLabel: this.headerLabel(cell.column.id),
|
|
4738
5283
|
autofocus: this.editorAutofocusFor(cell.column.id, wr.vi.index)
|
|
4739
5284
|
});
|
|
4740
5285
|
} catch {
|
|
4741
5286
|
return "{}";
|
|
4742
5287
|
}
|
|
4743
5288
|
})()}>
|
|
4744
|
-
<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) => {
|
|
4745
5290
|
this.onCellEditorInput(cell.column.id, $event);
|
|
4746
5291
|
}} @keydown=${($event) => {
|
|
4747
5292
|
this.onEditorKeyDown($event);
|
|
@@ -4750,7 +5295,7 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4750
5295
|
}} data-rozie-s-d5dcab4c />
|
|
4751
5296
|
</slot>`}
|
|
4752
5297
|
</slot>`}
|
|
4753
|
-
</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) => {
|
|
4754
5299
|
this.onCellEditorInput(cell.column.id, $event);
|
|
4755
5300
|
}} @keydown=${($event) => {
|
|
4756
5301
|
this.onEditorKeyDown($event);
|
|
@@ -4818,7 +5363,7 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4818
5363
|
</div>` : lit.html`<table class="${Object.entries({
|
|
4819
5364
|
"rozie-data-table": true,
|
|
4820
5365
|
"rdt-sticky": this.stickyHeader
|
|
4821
|
-
}).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) => {
|
|
4822
5367
|
this.onGridKeyDown($event);
|
|
4823
5368
|
}} @focusin=${($event) => {
|
|
4824
5369
|
this.syncActiveFromEvent($event);
|
|
@@ -4837,9 +5382,10 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4837
5382
|
"rdt-th": true,
|
|
4838
5383
|
"rdt-select-th": this.isSelectColumn(header.column.id),
|
|
4839
5384
|
"rdt-expander-th": this.isExpanderColumn(header.column.id),
|
|
5385
|
+
"rdt-pinned": this.columnPinSide(header.column.id) !== "",
|
|
4840
5386
|
"rdt-th-resizing": this.columnIsResizing(header.column.id),
|
|
4841
5387
|
"rdt-cell-active": this.isActiveCell("__header", this.headerColIndexOf(hg, header), hgLevel)
|
|
4842
|
-
}).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>
|
|
4843
5389
|
|
|
4844
5390
|
|
|
4845
5391
|
${this.isSelectColumn(header.column.id) ? lit.html`<span style="display:contents" data-rozie-s-d5dcab4c>
|
|
@@ -4960,7 +5506,10 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4960
5506
|
</tr>`)}
|
|
4961
5507
|
|
|
4962
5508
|
${this.hasAnyFilterableColumn() ? lit.html`<tr class="rdt-filter-row" data-rozie-s-d5dcab4c>
|
|
4963
|
-
${(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>
|
|
4964
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>
|
|
4965
5514
|
${this.columnIsFilterable(header.column.id) ? lit.html`<span style="display:contents" data-rozie-s-d5dcab4c>
|
|
4966
5515
|
${this.rozieSlots?.[`filter-${header.column.id}`] !== void 0 ? this.rozieSlots?.[`filter-${header.column.id}`]({
|
|
@@ -4968,6 +5517,7 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4968
5517
|
value: this.columnFilterValue(header.column.id),
|
|
4969
5518
|
uniqueValues: this.getFacetedUniqueValues(header.column.id),
|
|
4970
5519
|
minMax: this.getFacetedMinMaxValues(header.column.id),
|
|
5520
|
+
columnLabel: this.headerLabel(header.column.id),
|
|
4971
5521
|
setFilter: this.setColumnFilter
|
|
4972
5522
|
}) : lit.html`<slot name="${`filter-${header.column.id}`}" data-rozie-params=${(() => {
|
|
4973
5523
|
try {
|
|
@@ -4975,7 +5525,8 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4975
5525
|
columnId: header.column.id,
|
|
4976
5526
|
value: this.columnFilterValue(header.column.id),
|
|
4977
5527
|
uniqueValues: this.getFacetedUniqueValues(header.column.id),
|
|
4978
|
-
minMax: this.getFacetedMinMaxValues(header.column.id)
|
|
5528
|
+
minMax: this.getFacetedMinMaxValues(header.column.id),
|
|
5529
|
+
columnLabel: this.headerLabel(header.column.id)
|
|
4979
5530
|
});
|
|
4980
5531
|
} catch {
|
|
4981
5532
|
return "{}";
|
|
@@ -4986,6 +5537,7 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4986
5537
|
value: this.columnFilterValue(header.column.id),
|
|
4987
5538
|
uniqueValues: this.getFacetedUniqueValues(header.column.id),
|
|
4988
5539
|
minMax: this.getFacetedMinMaxValues(header.column.id),
|
|
5540
|
+
columnLabel: this.headerLabel(header.column.id),
|
|
4989
5541
|
setFilter: this.setColumnFilter
|
|
4990
5542
|
}) : lit.html`<slot name="filter" data-rozie-params=${(() => {
|
|
4991
5543
|
try {
|
|
@@ -4993,7 +5545,8 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
4993
5545
|
columnId: header.column.id,
|
|
4994
5546
|
value: this.columnFilterValue(header.column.id),
|
|
4995
5547
|
uniqueValues: this.getFacetedUniqueValues(header.column.id),
|
|
4996
|
-
minMax: this.getFacetedMinMaxValues(header.column.id)
|
|
5548
|
+
minMax: this.getFacetedMinMaxValues(header.column.id),
|
|
5549
|
+
columnLabel: this.headerLabel(header.column.id)
|
|
4997
5550
|
});
|
|
4998
5551
|
} catch {
|
|
4999
5552
|
return "{}";
|
|
@@ -5020,9 +5573,10 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
5020
5573
|
"rdt-td": true,
|
|
5021
5574
|
"rdt-select-td": this.isSelectColumn(cell.column.id),
|
|
5022
5575
|
"rdt-expander-td": this.isExpanderColumn(cell.column.id),
|
|
5576
|
+
"rdt-pinned": this.columnPinSide(cell.column.id) !== "",
|
|
5023
5577
|
"rdt-in-range": this.inRange(this.rowIndexOf(row), this.colIndexOf(row, cell)),
|
|
5024
5578
|
"rdt-cell-active": this.isActiveCell(String(this.rowIndexOf(row)), this.colIndexOf(row, cell))
|
|
5025
|
-
}).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>
|
|
5026
5580
|
|
|
5027
5581
|
${this.isExpanderColumn(cell.column.id) ? lit.html`<span style="display:contents" data-rozie-s-d5dcab4c>
|
|
5028
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) => {
|
|
@@ -5089,27 +5643,29 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
5089
5643
|
</span>
|
|
5090
5644
|
<span class="rdt-group-count" data-rozie-s-d5dcab4c>${(0, _rozie_runtime_lit.rozieDisplay)("(" + this.groupSubRowCount(row) + ")")}</span>
|
|
5091
5645
|
</span>` : this.isEditing(this.rowIndexOf(row), this.colIndexOf(row, cell)) ? lit.html`<span style="display:contents" data-rozie-s-d5dcab4c>
|
|
5092
|
-
${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) => {
|
|
5093
5647
|
this.onCellEditorInput(cell.column.id, $event);
|
|
5094
5648
|
}} @keydown=${($event) => {
|
|
5095
5649
|
this.onEditorKeyDown($event);
|
|
5096
5650
|
}} @blur=${($event) => {
|
|
5097
5651
|
this.onEditorBlur($event);
|
|
5098
|
-
}} 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) => {
|
|
5099
5653
|
this.onCellEditorInput(cell.column.id, $event);
|
|
5100
5654
|
}} @keydown=${($event) => {
|
|
5101
5655
|
this.onEditorKeyDown($event);
|
|
5102
5656
|
}} @blur=${($event) => {
|
|
5103
5657
|
this.onEditorBlur($event);
|
|
5104
5658
|
}} data-rozie-s-d5dcab4c>
|
|
5105
|
-
${(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>`)}
|
|
5106
|
-
</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) => {
|
|
5107
5661
|
this.onCellEditorCheckbox(cell.column.id, $event);
|
|
5108
5662
|
}} @keydown=${($event) => {
|
|
5109
5663
|
this.onEditorKeyDown($event);
|
|
5110
5664
|
}} @blur=${($event) => {
|
|
5111
5665
|
this.onEditorBlur($event);
|
|
5112
|
-
}} 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>
|
|
5113
5669
|
${this.rozieSlots?.[`editor-${cell.column.id}`] !== void 0 ? this.rozieSlots?.[`editor-${cell.column.id}`]({
|
|
5114
5670
|
columnId: cell.column.id,
|
|
5115
5671
|
column: cell.column,
|
|
@@ -5117,6 +5673,7 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
5117
5673
|
value: this.editorValueFor(cell.column.id),
|
|
5118
5674
|
commit: this.editorCommitFor(cell.column.id),
|
|
5119
5675
|
cancel: this.editorCancelFor(),
|
|
5676
|
+
columnLabel: this.headerLabel(cell.column.id),
|
|
5120
5677
|
autofocus: this.editorAutofocusFor(cell.column.id, this.rowIndexOf(row))
|
|
5121
5678
|
}) : lit.html`<slot name="${`editor-${cell.column.id}`}" data-rozie-params=${(() => {
|
|
5122
5679
|
try {
|
|
@@ -5127,6 +5684,7 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
5127
5684
|
value: this.editorValueFor(cell.column.id),
|
|
5128
5685
|
commit: this.editorCommitFor(cell.column.id),
|
|
5129
5686
|
cancel: this.editorCancelFor(),
|
|
5687
|
+
columnLabel: this.headerLabel(cell.column.id),
|
|
5130
5688
|
autofocus: this.editorAutofocusFor(cell.column.id, this.rowIndexOf(row))
|
|
5131
5689
|
});
|
|
5132
5690
|
} catch {
|
|
@@ -5140,6 +5698,7 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
5140
5698
|
value: this.editorValueFor(cell.column.id),
|
|
5141
5699
|
commit: this.editorCommitFor(cell.column.id),
|
|
5142
5700
|
cancel: this.editorCancelFor(),
|
|
5701
|
+
columnLabel: this.headerLabel(cell.column.id),
|
|
5143
5702
|
autofocus: this.editorAutofocusFor(cell.column.id, this.rowIndexOf(row))
|
|
5144
5703
|
}) : lit.html`<slot name="editor" data-rozie-params=${(() => {
|
|
5145
5704
|
try {
|
|
@@ -5150,13 +5709,14 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
5150
5709
|
value: this.editorValueFor(cell.column.id),
|
|
5151
5710
|
commit: this.editorCommitFor(cell.column.id),
|
|
5152
5711
|
cancel: this.editorCancelFor(),
|
|
5712
|
+
columnLabel: this.headerLabel(cell.column.id),
|
|
5153
5713
|
autofocus: this.editorAutofocusFor(cell.column.id, this.rowIndexOf(row))
|
|
5154
5714
|
});
|
|
5155
5715
|
} catch {
|
|
5156
5716
|
return "{}";
|
|
5157
5717
|
}
|
|
5158
5718
|
})()}>
|
|
5159
|
-
<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) => {
|
|
5160
5720
|
this.onCellEditorInput(cell.column.id, $event);
|
|
5161
5721
|
}} @keydown=${($event) => {
|
|
5162
5722
|
this.onEditorKeyDown($event);
|
|
@@ -5165,7 +5725,7 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
5165
5725
|
}} data-rozie-s-d5dcab4c />
|
|
5166
5726
|
</slot>`}
|
|
5167
5727
|
</slot>`}
|
|
5168
|
-
</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) => {
|
|
5169
5729
|
this.onCellEditorInput(cell.column.id, $event);
|
|
5170
5730
|
}} @keydown=${($event) => {
|
|
5171
5731
|
this.onEditorKeyDown($event);
|
|
@@ -5237,10 +5797,10 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
|
|
|
5237
5797
|
<select class="rdt-page-size" aria-label="Rows per page" .value=${this.pageSize()} @change=${($event) => {
|
|
5238
5798
|
this.onPageSizeChange($event);
|
|
5239
5799
|
}} data-rozie-s-d5dcab4c>
|
|
5240
|
-
<option value=${10} data-rozie-s-d5dcab4c>10</option>
|
|
5241
|
-
<option value=${25} data-rozie-s-d5dcab4c>25</option>
|
|
5242
|
-
<option value=${50} data-rozie-s-d5dcab4c>50</option>
|
|
5243
|
-
<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>
|
|
5244
5804
|
</select>
|
|
5245
5805
|
</div>` : lit.nothing}</div>
|
|
5246
5806
|
`;
|
|
@@ -5363,6 +5923,7 @@ __decorate([(0, lit_decorators_js.property)({
|
|
|
5363
5923
|
type: Object,
|
|
5364
5924
|
attribute: "expanded"
|
|
5365
5925
|
})], DataTable.prototype, "_expanded_attr", void 0);
|
|
5926
|
+
__decorate([(0, lit_decorators_js.property)({ type: Function })], DataTable.prototype, "getRowId", void 0);
|
|
5366
5927
|
__decorate([(0, lit_decorators_js.property)({ type: Function })], DataTable.prototype, "getSubRows", void 0);
|
|
5367
5928
|
__decorate([(0, lit_decorators_js.property)({
|
|
5368
5929
|
type: Boolean,
|
|
@@ -5444,6 +6005,12 @@ __decorate([(0, lit_decorators_js.state)()], DataTable.prototype, "_hasSlotDynam
|
|
|
5444
6005
|
__decorate([(0, lit_decorators_js.queryAssignedElements)({ flatten: true })], DataTable.prototype, "_slotDynamicColHeaderElements", void 0);
|
|
5445
6006
|
__decorate([(0, lit_decorators_js.state)()], DataTable.prototype, "_hasSlotDynamicFilter", void 0);
|
|
5446
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);
|
|
5447
6014
|
__decorate([(0, lit_decorators_js.state)()], DataTable.prototype, "_hasSlotSelectCell", void 0);
|
|
5448
6015
|
__decorate([(0, lit_decorators_js.queryAssignedElements)({
|
|
5449
6016
|
slot: "selectCell",
|
|
@@ -5641,15 +6208,19 @@ let EditorText = class EditorText extends (0, _lit_labs_preact_signals.SignalWat
|
|
|
5641
6208
|
this.commit = null;
|
|
5642
6209
|
this.cancel = null;
|
|
5643
6210
|
this.autofocus = false;
|
|
6211
|
+
this.columnLabel = "";
|
|
5644
6212
|
this._draft = (0, _lit_labs_preact_signals.signal)("");
|
|
6213
|
+
this._touched = (0, _lit_labs_preact_signals.signal)(false);
|
|
5645
6214
|
this.__rozieFirstUpdateDone = false;
|
|
5646
6215
|
this._disconnectCleanups = [];
|
|
5647
6216
|
this._rozieTornDown = false;
|
|
6217
|
+
this.draftValue = () => this._touched.value ? this._draft.value : this.value != null ? String(this.value) : "";
|
|
5648
6218
|
this.onInput = (e) => {
|
|
5649
6219
|
this._draft.value = e && e.target ? e.target.value : "";
|
|
6220
|
+
this._touched.value = true;
|
|
5650
6221
|
};
|
|
5651
6222
|
this.doCommit = () => {
|
|
5652
|
-
this.commit && this.commit(this.
|
|
6223
|
+
this.commit && this.commit(this.draftValue());
|
|
5653
6224
|
};
|
|
5654
6225
|
this.doCancel = () => {
|
|
5655
6226
|
this.cancel && this.cancel();
|
|
@@ -5666,6 +6237,10 @@ let EditorText = class EditorText extends (0, _lit_labs_preact_signals.SignalWat
|
|
|
5666
6237
|
this.onBlur = () => {
|
|
5667
6238
|
this.doCommit();
|
|
5668
6239
|
};
|
|
6240
|
+
this.a11yLabel = () => {
|
|
6241
|
+
if (typeof this.columnLabel === "string" && this.columnLabel !== "") return this.columnLabel;
|
|
6242
|
+
return this.columnId;
|
|
6243
|
+
};
|
|
5669
6244
|
}
|
|
5670
6245
|
static {
|
|
5671
6246
|
this.styles = lit.css`
|
|
@@ -5673,7 +6248,6 @@ let EditorText = class EditorText extends (0, _lit_labs_preact_signals.SignalWat
|
|
|
5673
6248
|
`;
|
|
5674
6249
|
}
|
|
5675
6250
|
firstUpdated() {
|
|
5676
|
-
this._draft.value = this.value != null ? String(this.value) : "";
|
|
5677
6251
|
if (this.autofocus) this._refInputEl?.focus();
|
|
5678
6252
|
}
|
|
5679
6253
|
updated(changedProperties) {
|
|
@@ -5693,7 +6267,7 @@ let EditorText = class EditorText extends (0, _lit_labs_preact_signals.SignalWat
|
|
|
5693
6267
|
}
|
|
5694
6268
|
render() {
|
|
5695
6269
|
return lit.html`
|
|
5696
|
-
<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) => {
|
|
5697
6271
|
this.onInput($event);
|
|
5698
6272
|
}} @keydown=${($event) => {
|
|
5699
6273
|
this.onKeydown($event);
|
|
@@ -5716,6 +6290,10 @@ __decorate([(0, lit_decorators_js.property)({
|
|
|
5716
6290
|
type: Boolean,
|
|
5717
6291
|
reflect: true
|
|
5718
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);
|
|
5719
6297
|
__decorate([(0, lit_decorators_js.query)("[data-rozie-ref=\"inputEl\"]")], EditorText.prototype, "_refInputEl", void 0);
|
|
5720
6298
|
EditorText = __decorate([(0, lit_decorators_js.customElement)("rozie-editor-text")], EditorText);
|
|
5721
6299
|
var EditorText_default = EditorText;
|
|
@@ -5730,15 +6308,21 @@ let EditorNumber = class EditorNumber extends (0, _lit_labs_preact_signals.Signa
|
|
|
5730
6308
|
this.value = null;
|
|
5731
6309
|
this.commit = null;
|
|
5732
6310
|
this.cancel = null;
|
|
6311
|
+
this.autofocus = false;
|
|
6312
|
+
this.columnLabel = "";
|
|
5733
6313
|
this._draft = (0, _lit_labs_preact_signals.signal)("");
|
|
6314
|
+
this._touched = (0, _lit_labs_preact_signals.signal)(false);
|
|
6315
|
+
this.__rozieFirstUpdateDone = false;
|
|
5734
6316
|
this._disconnectCleanups = [];
|
|
5735
6317
|
this._rozieTornDown = false;
|
|
6318
|
+
this.draftValue = () => this._touched.value ? this._draft.value : this.value != null ? String(this.value) : "";
|
|
5736
6319
|
this.onInput = (e) => {
|
|
5737
6320
|
this._draft.value = e && e.target ? e.target.value : "";
|
|
6321
|
+
this._touched.value = true;
|
|
5738
6322
|
};
|
|
5739
6323
|
this.doCommit = () => {
|
|
5740
6324
|
if (!this.commit) return;
|
|
5741
|
-
const raw = this.
|
|
6325
|
+
const raw = this.draftValue();
|
|
5742
6326
|
if (raw == null || String(raw).trim() === "") {
|
|
5743
6327
|
this.commit(null);
|
|
5744
6328
|
return;
|
|
@@ -5761,6 +6345,10 @@ let EditorNumber = class EditorNumber extends (0, _lit_labs_preact_signals.Signa
|
|
|
5761
6345
|
this.onBlur = () => {
|
|
5762
6346
|
this.doCommit();
|
|
5763
6347
|
};
|
|
6348
|
+
this.a11yLabel = () => {
|
|
6349
|
+
if (typeof this.columnLabel === "string" && this.columnLabel !== "") return this.columnLabel;
|
|
6350
|
+
return this.columnId;
|
|
6351
|
+
};
|
|
5764
6352
|
}
|
|
5765
6353
|
static {
|
|
5766
6354
|
this.styles = lit.css`
|
|
@@ -5768,7 +6356,13 @@ let EditorNumber = class EditorNumber extends (0, _lit_labs_preact_signals.Signa
|
|
|
5768
6356
|
`;
|
|
5769
6357
|
}
|
|
5770
6358
|
firstUpdated() {
|
|
5771
|
-
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;
|
|
5772
6366
|
}
|
|
5773
6367
|
disconnectedCallback() {
|
|
5774
6368
|
super.disconnectedCallback();
|
|
@@ -5781,13 +6375,13 @@ let EditorNumber = class EditorNumber extends (0, _lit_labs_preact_signals.Signa
|
|
|
5781
6375
|
}
|
|
5782
6376
|
render() {
|
|
5783
6377
|
return lit.html`
|
|
5784
|
-
<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) => {
|
|
5785
6379
|
this.onInput($event);
|
|
5786
6380
|
}} @keydown=${($event) => {
|
|
5787
6381
|
this.onKeydown($event);
|
|
5788
6382
|
}} @blur=${($event) => {
|
|
5789
6383
|
this.onBlur();
|
|
5790
|
-
}} data-rozie-s-b2792b32 />
|
|
6384
|
+
}} data-rozie-ref="inputEl" data-rozie-s-b2792b32 />
|
|
5791
6385
|
`;
|
|
5792
6386
|
}
|
|
5793
6387
|
};
|
|
@@ -5800,6 +6394,15 @@ __decorate([(0, lit_decorators_js.property)({ type: Object })], EditorNumber.pro
|
|
|
5800
6394
|
__decorate([(0, lit_decorators_js.property)({ type: Object })], EditorNumber.prototype, "value", void 0);
|
|
5801
6395
|
__decorate([(0, lit_decorators_js.property)({ type: Function })], EditorNumber.prototype, "commit", void 0);
|
|
5802
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);
|
|
5803
6406
|
EditorNumber = __decorate([(0, lit_decorators_js.customElement)("rozie-editor-number")], EditorNumber);
|
|
5804
6407
|
var EditorNumber_default = EditorNumber;
|
|
5805
6408
|
//#endregion
|
|
@@ -5814,14 +6417,20 @@ let EditorSelect = class EditorSelect extends (0, _lit_labs_preact_signals.Signa
|
|
|
5814
6417
|
this.commit = null;
|
|
5815
6418
|
this.cancel = null;
|
|
5816
6419
|
this.options = [];
|
|
6420
|
+
this.autofocus = false;
|
|
6421
|
+
this.columnLabel = "";
|
|
5817
6422
|
this._draft = (0, _lit_labs_preact_signals.signal)("");
|
|
6423
|
+
this._touched = (0, _lit_labs_preact_signals.signal)(false);
|
|
6424
|
+
this.__rozieFirstUpdateDone = false;
|
|
5818
6425
|
this._disconnectCleanups = [];
|
|
5819
6426
|
this._rozieTornDown = false;
|
|
6427
|
+
this.draftValue = () => this._touched.value ? this._draft.value : this.value != null ? String(this.value) : "";
|
|
5820
6428
|
this.onChange = (e) => {
|
|
5821
6429
|
this._draft.value = e && e.target ? e.target.value : "";
|
|
6430
|
+
this._touched.value = true;
|
|
5822
6431
|
};
|
|
5823
6432
|
this.doCommit = () => {
|
|
5824
|
-
this.commit && this.commit(this.
|
|
6433
|
+
this.commit && this.commit(this.draftValue());
|
|
5825
6434
|
};
|
|
5826
6435
|
this.doCancel = () => {
|
|
5827
6436
|
this.cancel && this.cancel();
|
|
@@ -5838,6 +6447,10 @@ let EditorSelect = class EditorSelect extends (0, _lit_labs_preact_signals.Signa
|
|
|
5838
6447
|
this.onBlur = () => {
|
|
5839
6448
|
this.doCommit();
|
|
5840
6449
|
};
|
|
6450
|
+
this.a11yLabel = () => {
|
|
6451
|
+
if (typeof this.columnLabel === "string" && this.columnLabel !== "") return this.columnLabel;
|
|
6452
|
+
return this.columnId;
|
|
6453
|
+
};
|
|
5841
6454
|
}
|
|
5842
6455
|
static {
|
|
5843
6456
|
this.styles = lit.css`
|
|
@@ -5845,7 +6458,13 @@ let EditorSelect = class EditorSelect extends (0, _lit_labs_preact_signals.Signa
|
|
|
5845
6458
|
`;
|
|
5846
6459
|
}
|
|
5847
6460
|
firstUpdated() {
|
|
5848
|
-
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;
|
|
5849
6468
|
}
|
|
5850
6469
|
disconnectedCallback() {
|
|
5851
6470
|
super.disconnectedCallback();
|
|
@@ -5858,14 +6477,14 @@ let EditorSelect = class EditorSelect extends (0, _lit_labs_preact_signals.Signa
|
|
|
5858
6477
|
}
|
|
5859
6478
|
render() {
|
|
5860
6479
|
return lit.html`
|
|
5861
|
-
<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) => {
|
|
5862
6481
|
this.onChange($event);
|
|
5863
6482
|
}} @keydown=${($event) => {
|
|
5864
6483
|
this.onKeydown($event);
|
|
5865
6484
|
}} @blur=${($event) => {
|
|
5866
6485
|
this.onBlur();
|
|
5867
|
-
}} data-rozie-s-117f1a16>
|
|
5868
|
-
${(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>`)}
|
|
5869
6488
|
</select>
|
|
5870
6489
|
`;
|
|
5871
6490
|
}
|
|
@@ -5880,6 +6499,15 @@ __decorate([(0, lit_decorators_js.property)({ type: Object })], EditorSelect.pro
|
|
|
5880
6499
|
__decorate([(0, lit_decorators_js.property)({ type: Function })], EditorSelect.prototype, "commit", void 0);
|
|
5881
6500
|
__decorate([(0, lit_decorators_js.property)({ type: Function })], EditorSelect.prototype, "cancel", void 0);
|
|
5882
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);
|
|
5883
6511
|
EditorSelect = __decorate([(0, lit_decorators_js.customElement)("rozie-editor-select")], EditorSelect);
|
|
5884
6512
|
var EditorSelect_default = EditorSelect;
|
|
5885
6513
|
//#endregion
|
|
@@ -5893,6 +6521,9 @@ let EditorCheckbox = class EditorCheckbox extends (0, _lit_labs_preact_signals.S
|
|
|
5893
6521
|
this.value = null;
|
|
5894
6522
|
this.commit = null;
|
|
5895
6523
|
this.cancel = null;
|
|
6524
|
+
this.autofocus = false;
|
|
6525
|
+
this.columnLabel = "";
|
|
6526
|
+
this.__rozieFirstUpdateDone = false;
|
|
5896
6527
|
this._disconnectCleanups = [];
|
|
5897
6528
|
this._rozieTornDown = false;
|
|
5898
6529
|
this.onChange = (e) => {
|
|
@@ -5904,12 +6535,25 @@ let EditorCheckbox = class EditorCheckbox extends (0, _lit_labs_preact_signals.S
|
|
|
5904
6535
|
this.cancel && this.cancel();
|
|
5905
6536
|
}
|
|
5906
6537
|
};
|
|
6538
|
+
this.a11yLabel = () => {
|
|
6539
|
+
if (typeof this.columnLabel === "string" && this.columnLabel !== "") return this.columnLabel;
|
|
6540
|
+
return this.columnId;
|
|
6541
|
+
};
|
|
5907
6542
|
}
|
|
5908
6543
|
static {
|
|
5909
6544
|
this.styles = lit.css`
|
|
5910
6545
|
:host{display:contents}
|
|
5911
6546
|
`;
|
|
5912
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
|
+
}
|
|
5913
6557
|
disconnectedCallback() {
|
|
5914
6558
|
super.disconnectedCallback();
|
|
5915
6559
|
queueMicrotask(() => {
|
|
@@ -5921,11 +6565,11 @@ let EditorCheckbox = class EditorCheckbox extends (0, _lit_labs_preact_signals.S
|
|
|
5921
6565
|
}
|
|
5922
6566
|
render() {
|
|
5923
6567
|
return lit.html`
|
|
5924
|
-
<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) => {
|
|
5925
6569
|
this.onChange($event);
|
|
5926
6570
|
}} @keydown=${($event) => {
|
|
5927
6571
|
this.onKeydown($event);
|
|
5928
|
-
}} data-rozie-s-3d792482 />
|
|
6572
|
+
}} data-rozie-ref="inputEl" data-rozie-s-3d792482 />
|
|
5929
6573
|
`;
|
|
5930
6574
|
}
|
|
5931
6575
|
};
|
|
@@ -5938,9 +6582,51 @@ __decorate([(0, lit_decorators_js.property)({ type: Object })], EditorCheckbox.p
|
|
|
5938
6582
|
__decorate([(0, lit_decorators_js.property)({ type: Object })], EditorCheckbox.prototype, "value", void 0);
|
|
5939
6583
|
__decorate([(0, lit_decorators_js.property)({ type: Function })], EditorCheckbox.prototype, "commit", void 0);
|
|
5940
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);
|
|
5941
6594
|
EditorCheckbox = __decorate([(0, lit_decorators_js.customElement)("rozie-editor-checkbox")], EditorCheckbox);
|
|
5942
6595
|
var EditorCheckbox_default = EditorCheckbox;
|
|
5943
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
|
|
5944
6630
|
//#region src/EditorDate.ts
|
|
5945
6631
|
let EditorDate = class EditorDate extends (0, _lit_labs_preact_signals.SignalWatcher)(lit.LitElement) {
|
|
5946
6632
|
constructor(..._args) {
|
|
@@ -5951,20 +6637,27 @@ let EditorDate = class EditorDate extends (0, _lit_labs_preact_signals.SignalWat
|
|
|
5951
6637
|
this.value = null;
|
|
5952
6638
|
this.commit = null;
|
|
5953
6639
|
this.cancel = null;
|
|
6640
|
+
this.autofocus = false;
|
|
6641
|
+
this.columnLabel = "";
|
|
5954
6642
|
this._draft = (0, _lit_labs_preact_signals.signal)("");
|
|
6643
|
+
this._touched = (0, _lit_labs_preact_signals.signal)(false);
|
|
6644
|
+
this.__rozieFirstUpdateDone = false;
|
|
5955
6645
|
this._disconnectCleanups = [];
|
|
5956
6646
|
this._rozieTornDown = false;
|
|
6647
|
+
this.draftValue = () => this._touched.value ? this._draft.value : toIsoDateString(this.value);
|
|
5957
6648
|
this.onInput = (e) => {
|
|
5958
6649
|
this._draft.value = e && e.target ? e.target.value : "";
|
|
6650
|
+
this._touched.value = true;
|
|
5959
6651
|
};
|
|
5960
6652
|
this.doCommit = () => {
|
|
5961
|
-
this.commit && this.commit(this.
|
|
6653
|
+
this.commit && this.commit(this.draftValue());
|
|
5962
6654
|
};
|
|
5963
6655
|
this.doCancel = () => {
|
|
5964
6656
|
this.cancel && this.cancel();
|
|
5965
6657
|
};
|
|
5966
6658
|
this.onChange = (e) => {
|
|
5967
6659
|
this._draft.value = e && e.target ? e.target.value : "";
|
|
6660
|
+
this._touched.value = true;
|
|
5968
6661
|
};
|
|
5969
6662
|
this.onKeydown = (e) => {
|
|
5970
6663
|
if (e && e.key === "Enter") {
|
|
@@ -5978,6 +6671,10 @@ let EditorDate = class EditorDate extends (0, _lit_labs_preact_signals.SignalWat
|
|
|
5978
6671
|
this.onBlur = () => {
|
|
5979
6672
|
this.doCommit();
|
|
5980
6673
|
};
|
|
6674
|
+
this.a11yLabel = () => {
|
|
6675
|
+
if (typeof this.columnLabel === "string" && this.columnLabel !== "") return this.columnLabel;
|
|
6676
|
+
return this.columnId;
|
|
6677
|
+
};
|
|
5981
6678
|
}
|
|
5982
6679
|
static {
|
|
5983
6680
|
this.styles = lit.css`
|
|
@@ -5985,7 +6682,13 @@ let EditorDate = class EditorDate extends (0, _lit_labs_preact_signals.SignalWat
|
|
|
5985
6682
|
`;
|
|
5986
6683
|
}
|
|
5987
6684
|
firstUpdated() {
|
|
5988
|
-
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;
|
|
5989
6692
|
}
|
|
5990
6693
|
disconnectedCallback() {
|
|
5991
6694
|
super.disconnectedCallback();
|
|
@@ -5998,7 +6701,7 @@ let EditorDate = class EditorDate extends (0, _lit_labs_preact_signals.SignalWat
|
|
|
5998
6701
|
}
|
|
5999
6702
|
render() {
|
|
6000
6703
|
return lit.html`
|
|
6001
|
-
<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) => {
|
|
6002
6705
|
this.onInput($event);
|
|
6003
6706
|
}} @change=${($event) => {
|
|
6004
6707
|
this.onChange($event);
|
|
@@ -6006,7 +6709,7 @@ let EditorDate = class EditorDate extends (0, _lit_labs_preact_signals.SignalWat
|
|
|
6006
6709
|
this.onKeydown($event);
|
|
6007
6710
|
}} @blur=${($event) => {
|
|
6008
6711
|
this.onBlur();
|
|
6009
|
-
}} data-rozie-s-7abe1a56 />
|
|
6712
|
+
}} data-rozie-ref="inputEl" data-rozie-s-7abe1a56 />
|
|
6010
6713
|
`;
|
|
6011
6714
|
}
|
|
6012
6715
|
};
|
|
@@ -6019,6 +6722,15 @@ __decorate([(0, lit_decorators_js.property)({ type: Object })], EditorDate.proto
|
|
|
6019
6722
|
__decorate([(0, lit_decorators_js.property)({ type: Object })], EditorDate.prototype, "value", void 0);
|
|
6020
6723
|
__decorate([(0, lit_decorators_js.property)({ type: Function })], EditorDate.prototype, "commit", void 0);
|
|
6021
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);
|
|
6022
6734
|
EditorDate = __decorate([(0, lit_decorators_js.customElement)("rozie-editor-date")], EditorDate);
|
|
6023
6735
|
var EditorDate_default = EditorDate;
|
|
6024
6736
|
//#endregion
|
|
@@ -6030,17 +6742,23 @@ let FilterText = class FilterText extends (0, _lit_labs_preact_signals.SignalWat
|
|
|
6030
6742
|
this.column = null;
|
|
6031
6743
|
this.value = null;
|
|
6032
6744
|
this.setFilter = null;
|
|
6745
|
+
this.columnLabel = "";
|
|
6033
6746
|
this._draft = (0, _lit_labs_preact_signals.signal)("");
|
|
6747
|
+
this._touched = (0, _lit_labs_preact_signals.signal)(false);
|
|
6748
|
+
this.__rozieFirstUpdateDone = false;
|
|
6034
6749
|
this._disconnectCleanups = [];
|
|
6035
6750
|
this._rozieTornDown = false;
|
|
6751
|
+
this.draftValue = () => this._touched.value ? this._draft.value : this.value != null ? String(this.value) : "";
|
|
6036
6752
|
this.onInput = (e) => {
|
|
6037
6753
|
this._draft.value = e && e.target ? e.target.value : "";
|
|
6754
|
+
this._touched.value = true;
|
|
6038
6755
|
};
|
|
6039
6756
|
this.applyFilter = () => {
|
|
6040
|
-
this.setFilter && this.setFilter(this.columnId, this.
|
|
6757
|
+
this.setFilter && this.setFilter(this.columnId, this.draftValue());
|
|
6041
6758
|
};
|
|
6042
6759
|
this.clearFilter = () => {
|
|
6043
6760
|
this._draft.value = "";
|
|
6761
|
+
this._touched.value = false;
|
|
6044
6762
|
this.setFilter && this.setFilter(this.columnId, "");
|
|
6045
6763
|
};
|
|
6046
6764
|
this.onKeydown = (e) => {
|
|
@@ -6055,14 +6773,22 @@ let FilterText = class FilterText extends (0, _lit_labs_preact_signals.SignalWat
|
|
|
6055
6773
|
this.onBlur = () => {
|
|
6056
6774
|
this.applyFilter();
|
|
6057
6775
|
};
|
|
6776
|
+
this.a11yLabel = () => {
|
|
6777
|
+
if (typeof this.columnLabel === "string" && this.columnLabel !== "") return this.columnLabel;
|
|
6778
|
+
return this.columnId;
|
|
6779
|
+
};
|
|
6058
6780
|
}
|
|
6059
6781
|
static {
|
|
6060
6782
|
this.styles = lit.css`
|
|
6061
6783
|
:host{display:contents}
|
|
6062
6784
|
`;
|
|
6063
6785
|
}
|
|
6064
|
-
|
|
6065
|
-
this.
|
|
6786
|
+
updated(changedProperties) {
|
|
6787
|
+
if (this.__rozieFirstUpdateDone && changedProperties.has("value")) {
|
|
6788
|
+
this.value;
|
|
6789
|
+
this._touched.value = false;
|
|
6790
|
+
}
|
|
6791
|
+
this.__rozieFirstUpdateDone = true;
|
|
6066
6792
|
}
|
|
6067
6793
|
disconnectedCallback() {
|
|
6068
6794
|
super.disconnectedCallback();
|
|
@@ -6075,7 +6801,7 @@ let FilterText = class FilterText extends (0, _lit_labs_preact_signals.SignalWat
|
|
|
6075
6801
|
}
|
|
6076
6802
|
render() {
|
|
6077
6803
|
return lit.html`
|
|
6078
|
-
<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) => {
|
|
6079
6805
|
this.onInput($event);
|
|
6080
6806
|
}} @keydown=${($event) => {
|
|
6081
6807
|
this.onKeydown($event);
|
|
@@ -6092,6 +6818,10 @@ __decorate([(0, lit_decorators_js.property)({
|
|
|
6092
6818
|
__decorate([(0, lit_decorators_js.property)({ type: Object })], FilterText.prototype, "column", void 0);
|
|
6093
6819
|
__decorate([(0, lit_decorators_js.property)({ type: Object })], FilterText.prototype, "value", void 0);
|
|
6094
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);
|
|
6095
6825
|
FilterText = __decorate([(0, lit_decorators_js.customElement)("rozie-filter-text")], FilterText);
|
|
6096
6826
|
var FilterText_default = FilterText;
|
|
6097
6827
|
//#endregion
|
|
@@ -6104,24 +6834,41 @@ let FilterNumberRange = class FilterNumberRange extends (0, _lit_labs_preact_sig
|
|
|
6104
6834
|
this.value = null;
|
|
6105
6835
|
this.setFilter = null;
|
|
6106
6836
|
this.minMax = null;
|
|
6837
|
+
this.columnLabel = "";
|
|
6107
6838
|
this._minDraft = (0, _lit_labs_preact_signals.signal)("");
|
|
6108
6839
|
this._maxDraft = (0, _lit_labs_preact_signals.signal)("");
|
|
6840
|
+
this._touched = (0, _lit_labs_preact_signals.signal)(false);
|
|
6841
|
+
this.__rozieWatchInitial_0 = true;
|
|
6109
6842
|
this._disconnectCleanups = [];
|
|
6110
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]) : "";
|
|
6111
6846
|
this.onMinInput = (e) => {
|
|
6112
6847
|
this._minDraft.value = e && e.target ? e.target.value : "";
|
|
6848
|
+
this._touched.value = true;
|
|
6113
6849
|
};
|
|
6114
6850
|
this.onMaxInput = (e) => {
|
|
6115
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());
|
|
6116
6859
|
};
|
|
6117
6860
|
this.minPlaceholder = () => Array.isArray(this.minMax) && this.minMax[0] != null ? String(this.minMax[0]) : "";
|
|
6118
6861
|
this.maxPlaceholder = () => Array.isArray(this.minMax) && this.minMax[1] != null ? String(this.minMax[1]) : "";
|
|
6119
|
-
this.applyRange = () => {
|
|
6120
|
-
const minNum =
|
|
6121
|
-
const maxNum =
|
|
6862
|
+
this.applyRange = (minDraft, maxDraft) => {
|
|
6863
|
+
const minNum = minDraft === "" ? void 0 : Number(minDraft);
|
|
6864
|
+
const maxNum = maxDraft === "" ? void 0 : Number(maxDraft);
|
|
6122
6865
|
if (minNum === void 0 && maxNum === void 0) this.setFilter && this.setFilter(this.columnId, "");
|
|
6123
6866
|
else this.setFilter && this.setFilter(this.columnId, [minNum, maxNum]);
|
|
6124
6867
|
};
|
|
6868
|
+
this.a11yLabel = () => {
|
|
6869
|
+
if (typeof this.columnLabel === "string" && this.columnLabel !== "") return this.columnLabel;
|
|
6870
|
+
return this.columnId;
|
|
6871
|
+
};
|
|
6125
6872
|
}
|
|
6126
6873
|
static {
|
|
6127
6874
|
this.styles = lit.css`
|
|
@@ -6129,8 +6876,16 @@ let FilterNumberRange = class FilterNumberRange extends (0, _lit_labs_preact_sig
|
|
|
6129
6876
|
`;
|
|
6130
6877
|
}
|
|
6131
6878
|
firstUpdated() {
|
|
6132
|
-
this.
|
|
6133
|
-
|
|
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
|
+
}));
|
|
6134
6889
|
}
|
|
6135
6890
|
disconnectedCallback() {
|
|
6136
6891
|
super.disconnectedCallback();
|
|
@@ -6144,16 +6899,20 @@ let FilterNumberRange = class FilterNumberRange extends (0, _lit_labs_preact_sig
|
|
|
6144
6899
|
render() {
|
|
6145
6900
|
return lit.html`
|
|
6146
6901
|
<span style="display:flex; align-items: center" data-rozie-s-97b2c090>
|
|
6147
|
-
<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) => {
|
|
6148
6903
|
this.onMinInput($event);
|
|
6149
|
-
}} @
|
|
6150
|
-
this.
|
|
6904
|
+
}} @keydown=${($event) => {
|
|
6905
|
+
this.onKeydown($event);
|
|
6906
|
+
}} @blur=${($event) => {
|
|
6907
|
+
this.onBlur();
|
|
6151
6908
|
}} data-rozie-s-97b2c090 />
|
|
6152
6909
|
<span data-rozie-s-97b2c090> - </span>
|
|
6153
|
-
<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) => {
|
|
6154
6911
|
this.onMaxInput($event);
|
|
6155
|
-
}} @
|
|
6156
|
-
this.
|
|
6912
|
+
}} @keydown=${($event) => {
|
|
6913
|
+
this.onKeydown($event);
|
|
6914
|
+
}} @blur=${($event) => {
|
|
6915
|
+
this.onBlur();
|
|
6157
6916
|
}} data-rozie-s-97b2c090 />
|
|
6158
6917
|
</span>
|
|
6159
6918
|
`;
|
|
@@ -6167,6 +6926,10 @@ __decorate([(0, lit_decorators_js.property)({ type: Object })], FilterNumberRang
|
|
|
6167
6926
|
__decorate([(0, lit_decorators_js.property)({ type: Object })], FilterNumberRange.prototype, "value", void 0);
|
|
6168
6927
|
__decorate([(0, lit_decorators_js.property)({ type: Function })], FilterNumberRange.prototype, "setFilter", void 0);
|
|
6169
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);
|
|
6170
6933
|
FilterNumberRange = __decorate([(0, lit_decorators_js.customElement)("rozie-filter-number-range")], FilterNumberRange);
|
|
6171
6934
|
var FilterNumberRange_default = FilterNumberRange;
|
|
6172
6935
|
//#endregion
|
|
@@ -6179,6 +6942,7 @@ let FilterSelect = class FilterSelect extends (0, _lit_labs_preact_signals.Signa
|
|
|
6179
6942
|
this.value = null;
|
|
6180
6943
|
this.setFilter = null;
|
|
6181
6944
|
this.uniqueValues = [];
|
|
6945
|
+
this.columnLabel = "";
|
|
6182
6946
|
this._disconnectCleanups = [];
|
|
6183
6947
|
this._rozieTornDown = false;
|
|
6184
6948
|
this.selectValue = () => this.value != null ? String(this.value) : "";
|
|
@@ -6187,6 +6951,10 @@ let FilterSelect = class FilterSelect extends (0, _lit_labs_preact_signals.Signa
|
|
|
6187
6951
|
if (v === "") this.setFilter && this.setFilter(this.columnId, "");
|
|
6188
6952
|
else this.setFilter && this.setFilter(this.columnId, v);
|
|
6189
6953
|
};
|
|
6954
|
+
this.a11yLabel = () => {
|
|
6955
|
+
if (typeof this.columnLabel === "string" && this.columnLabel !== "") return this.columnLabel;
|
|
6956
|
+
return this.columnId;
|
|
6957
|
+
};
|
|
6190
6958
|
}
|
|
6191
6959
|
static {
|
|
6192
6960
|
this.styles = lit.css`
|
|
@@ -6204,11 +6972,11 @@ let FilterSelect = class FilterSelect extends (0, _lit_labs_preact_signals.Signa
|
|
|
6204
6972
|
}
|
|
6205
6973
|
render() {
|
|
6206
6974
|
return lit.html`
|
|
6207
|
-
<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) => {
|
|
6208
6976
|
this.onChange($event);
|
|
6209
6977
|
}} data-rozie-s-d75b42b2>
|
|
6210
6978
|
<option value="" data-rozie-s-d75b42b2>All</option>
|
|
6211
|
-
${(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>`)}
|
|
6212
6980
|
</select>
|
|
6213
6981
|
`;
|
|
6214
6982
|
}
|
|
@@ -6221,6 +6989,10 @@ __decorate([(0, lit_decorators_js.property)({ type: Object })], FilterSelect.pro
|
|
|
6221
6989
|
__decorate([(0, lit_decorators_js.property)({ type: Object })], FilterSelect.prototype, "value", void 0);
|
|
6222
6990
|
__decorate([(0, lit_decorators_js.property)({ type: Function })], FilterSelect.prototype, "setFilter", void 0);
|
|
6223
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);
|
|
6224
6996
|
FilterSelect = __decorate([(0, lit_decorators_js.customElement)("rozie-filter-select")], FilterSelect);
|
|
6225
6997
|
var FilterSelect_default = FilterSelect;
|
|
6226
6998
|
//#endregion
|
|
@@ -6296,6 +7068,42 @@ let GroupBar = class GroupBar extends (0, _lit_labs_preact_signals.SignalWatcher
|
|
|
6296
7068
|
this.removeKey = (key) => {
|
|
6297
7069
|
this.applyGrouping && this.applyGrouping(this.grouping.filter((k) => k !== key));
|
|
6298
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
|
+
};
|
|
6299
7107
|
this.clearAll = () => {
|
|
6300
7108
|
this.clearGrouping && this.clearGrouping();
|
|
6301
7109
|
};
|
|
@@ -6324,6 +7132,18 @@ let GroupBar = class GroupBar extends (0, _lit_labs_preact_signals.SignalWatcher
|
|
|
6324
7132
|
border-color: var(--rdt-group-drop-zone-border-over, rgba(37, 99, 235, 0.7));
|
|
6325
7133
|
background: var(--rdt-group-drop-zone-bg-over, rgba(37, 99, 235, 0.08));
|
|
6326
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
|
+
}
|
|
6327
7147
|
.rdt-group-drop-hint[data-rozie-s-546c469a] {
|
|
6328
7148
|
opacity: 0.55;
|
|
6329
7149
|
font-size: 0.8125em;
|
|
@@ -6379,17 +7199,19 @@ let GroupBar = class GroupBar extends (0, _lit_labs_preact_signals.SignalWatcher
|
|
|
6379
7199
|
return lit.html`
|
|
6380
7200
|
<div class="rdt-group-bar" data-rozie-s-546c469a>
|
|
6381
7201
|
|
|
6382
|
-
${(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) => {
|
|
6383
7203
|
this.onChipDragStart($event, col.id);
|
|
6384
7204
|
}} @dragend=${($event) => {
|
|
6385
7205
|
this.onDragEnd();
|
|
6386
|
-
}}
|
|
7206
|
+
}} @click=${($event) => {
|
|
7207
|
+
this.toggleKey(col.id);
|
|
7208
|
+
}} data-rozie-s-546c469a>${(0, _rozie_runtime_lit.rozieDisplay)(col.label)}</button>`)}
|
|
6387
7209
|
|
|
6388
7210
|
|
|
6389
7211
|
<span class="${Object.entries({
|
|
6390
7212
|
"rdt-group-drop-zone": true,
|
|
6391
7213
|
"is-over": this._isOver.value
|
|
6392
|
-
}).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) => {
|
|
6393
7215
|
this.onDragOver($event);
|
|
6394
7216
|
}} @dragleave=${($event) => {
|
|
6395
7217
|
this.onDragLeave($event);
|
|
@@ -6400,12 +7222,14 @@ let GroupBar = class GroupBar extends (0, _lit_labs_preact_signals.SignalWatcher
|
|
|
6400
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({
|
|
6401
7223
|
"rdt-group-token": true,
|
|
6402
7224
|
"is-drop-target": this._dragKind.value === "token" && this._dropKey.value === gk && this._draggingId.value !== gk
|
|
6403
|
-
}).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) => {
|
|
6404
7226
|
this.onTokenDragStart($event, gk);
|
|
6405
7227
|
}} @dragover=${($event) => {
|
|
6406
7228
|
this.onTokenDragOver($event, gk);
|
|
6407
7229
|
}} @dragend=${($event) => {
|
|
6408
7230
|
this.onDragEnd();
|
|
7231
|
+
}} @keydown=${($event) => {
|
|
7232
|
+
this.onTokenKeydown($event, gk);
|
|
6409
7233
|
}} data-rozie-s-546c469a>
|
|
6410
7234
|
${(0, _rozie_runtime_lit.rozieDisplay)(this.labelFor(gk))}
|
|
6411
7235
|
<button class="rdt-group-token-remove" type="button" aria-label=${(0, _rozie_runtime_lit.rozieAttr)("Remove " + this.labelFor(gk) + " grouping")} @click=${($event) => {
|