@rozie-ui/data-table-lit 0.5.0 → 0.7.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/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 (!this._activeIsHeader.value && this._activeColIndex.value >= 0 && out.indexOf(this._activeColIndex.value) === -1) out.push(this._activeColIndex.value);
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,13 +1067,90 @@ 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
- for (const tr of trs) this.virtualizer.measureElement(tr);
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
  };
1149
+ this.scrollToRow = (index, options) => {
1150
+ if (!this.rowsWindowed() || !this.virtualizer) return;
1151
+ this.virtualizer.scrollToIndex(Math.trunc(Number(index)) || 0, options || void 0);
1152
+ };
1153
+ this.getScrollElement = () => this.gridScrollEl;
982
1154
  this.virtualItemKey = (i) => {
983
1155
  const src = this.windowSource();
984
1156
  return src && src[i] ? src[i].id : void 0;
@@ -1084,6 +1256,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
1084
1256
  }
1085
1257
  }
1086
1258
  this.bumpWindowVer();
1259
+ this.scheduleRemeasure();
1087
1260
  };
1088
1261
  this.virtualizerOptions = () => ({
1089
1262
  count: this.windowSource().length,
@@ -1256,20 +1429,29 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
1256
1429
  if (filterChanged) return this.totalRowCount() + " results";
1257
1430
  return "";
1258
1431
  };
1432
+ this.rowIdOption = () => {
1433
+ const f = this.getRowId;
1434
+ return f ? (originalRow, index, parent) => this.isLazyPlaceholder(originalRow) ? this.LAZY_PLACEHOLDER_ROW_ID_PREFIX + originalRow.index : String(f(originalRow, index, parent)) : void 0;
1435
+ };
1436
+ this.rowSelectionOption = () => {
1437
+ if (this.selectionMode === "none") return false;
1438
+ return this.lazyRowsActive() ? (row) => !this.rowIsLazyPlaceholder(row) : true;
1439
+ };
1259
1440
  this.reFeed = () => {
1260
1441
  if (!this.table) return;
1261
1442
  this.table.setOptions((prev) => ({
1262
1443
  ...prev,
1263
- data: this.currentData(),
1444
+ data: this.feedData(),
1264
1445
  columns: this.tableColumns(),
1265
1446
  state: this.currentState(),
1266
- enableRowSelection: this.selectionMode !== "none",
1447
+ enableRowSelection: this.rowSelectionOption(),
1267
1448
  enableMultiRowSelection: this.selectionMode === "multiple",
1268
1449
  rowCount: this.rowCount ?? void 0,
1269
1450
  pageCount: this.pageCount ?? void 0,
1270
1451
  getExpandedRowModel: (0, _tanstack_table_core.getExpandedRowModel)(),
1271
1452
  getSubRows: this.getSubRows || void 0,
1272
- getRowCanExpand: this.expandable === true && this.getSubRows == null ? () => true : void 0,
1453
+ getRowId: this.rowIdOption(),
1454
+ getRowCanExpand: this.expandable === true && this.getSubRows == null ? (row) => !this.rowIsLazyPlaceholder(row) : void 0,
1273
1455
  onExpandedChange: this.onExpandedChangeCb,
1274
1456
  autoResetExpanded: false,
1275
1457
  getGroupedRowModel: (0, _tanstack_table_core.getGroupedRowModel)(),
@@ -1428,9 +1610,9 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
1428
1610
  if (side === "right") return "position:sticky;right:" + (col.getAfter ? col.getAfter("right") : 0) + "px;z-index:" + zIndex + ";";
1429
1611
  return "";
1430
1612
  };
1431
- this.thStyle = (header) => {
1613
+ this.thStyle = (header, widthPx = null) => {
1432
1614
  let s = "";
1433
- const w = this.headerWidth(header);
1615
+ const w = widthPx != null && widthPx > 0 ? widthPx + "px" : this.headerWidth(header);
1434
1616
  if (w) s += "width:" + w + ";";
1435
1617
  s += this.pinStyle(header && header.column ? header.column.id : null, 2);
1436
1618
  return s;
@@ -1642,6 +1824,16 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
1642
1824
  this.rowIndexOf = (row) => this.tick() >= 0 ? (this._rows.value || []).indexOf(row) : -1;
1643
1825
  this.colIndexOf = (row, cellCtx) => this.tick() >= 0 ? this.visibleCellsFor(row).indexOf(cellCtx) : -1;
1644
1826
  this.headerColIndexOf = (hg, header) => (hg && hg.headers ? hg.headers : []).indexOf(header);
1827
+ this.headerLeafStart = (hg, header) => {
1828
+ const list = hg && hg.headers ? hg.headers : [];
1829
+ let leaf = 0;
1830
+ for (let i = 0; i < list.length; i++) {
1831
+ if (list[i] === header) return leaf;
1832
+ const h = list[i];
1833
+ leaf = leaf + (h && h.colSpan > 1 ? h.colSpan : 1);
1834
+ }
1835
+ return -1;
1836
+ };
1645
1837
  this.pageRowOffset = () => {
1646
1838
  if (!this.isGrid() || this.rowsWindowed()) return 0;
1647
1839
  return this.pageIndex() * this.pageSize();
@@ -1685,14 +1877,15 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
1685
1877
  const header = nextIsHeader == null ? this._activeIsHeader.value : nextIsHeader;
1686
1878
  const rowOut = this.rowsWindowed() && this.virtualizer && this.rowIsOutsideWindow(r);
1687
1879
  const colOut = this.colsWindowed() && this.colVirtualizer && this.colIsOutsideWindow(c);
1688
- if (!header && (rowOut || colOut)) {
1689
- if (rowOut) this.virtualizer.scrollToIndex(r, { align: "center" });
1880
+ const rowScroll = !header && rowOut;
1881
+ if (rowScroll || colOut) {
1882
+ if (rowScroll) this.virtualizer.scrollToIndex(r, { align: "center" });
1690
1883
  if (colOut) this.colVirtualizer.scrollToIndex(c, { align: "center" });
1691
1884
  let focusAttempts = 0;
1692
1885
  const myEpoch = this.focusIntentEpoch;
1693
1886
  const focusWhenReady = () => {
1694
1887
  if (this.focusIntentEpoch !== myEpoch) return;
1695
- const el = this.resolveCellEl(String(r), c);
1888
+ const el = this.resolveCellEl(header ? "__header" : String(r), c, header ? lvl : null);
1696
1889
  if (el) {
1697
1890
  el.focus();
1698
1891
  return;
@@ -1712,6 +1905,10 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
1712
1905
  };
1713
1906
  this.totalRowCount = () => {
1714
1907
  if (!this.table) return (this._rows.value || []).length;
1908
+ if (this.manual === true) {
1909
+ if (this.rowCount != null) return this.rowCount;
1910
+ if (this.pageCount != null) return this.pageCount * this.pageSize();
1911
+ }
1715
1912
  const fm = this.table.getFilteredRowModel();
1716
1913
  return fm && fm.rows ? fm.rows.length : (this._rows.value || []).length;
1717
1914
  };
@@ -1719,6 +1916,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
1719
1916
  this.gridAriaRowCount = () => this.headerRowCount() + this.totalRowCount();
1720
1917
  this.ariaPageOffset = () => this.table ? this.pageIndex() * this.pageSize() : 0;
1721
1918
  this.bodyAriaRowIndex = (row) => this.headerRowCount() + this.rowIndexOf(row) + this.ariaPageOffset() + 1;
1919
+ this.gridAriaColCount = () => this.visibleColCount();
1722
1920
  this.visibleColCount = () => {
1723
1921
  const rowList = this._rows.value || [];
1724
1922
  if (rowList.length) return rowList[0].getVisibleCells().length;
@@ -1889,6 +2087,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
1889
2087
  const rowKey = this._activeIsHeader.value ? "__header" : String(this._activeRow.value);
1890
2088
  return this.resolveCellEl(rowKey, this._activeColIndex.value, this._activeIsHeader.value ? this._activeHeaderLevel.value : null);
1891
2089
  };
2090
+ this.activeCellHasControls = () => focusables(this.currentCellEl()).length > 0;
1892
2091
  this.enterControl = () => {
1893
2092
  const list = focusables(this.currentCellEl());
1894
2093
  if (!list.length) return;
@@ -1933,10 +2132,10 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
1933
2132
  let nextLevel = prevLevel;
1934
2133
  if ((e.ctrlKey || e.metaKey) && e.shiftKey && !this._activeIsHeader.value && (key === "ArrowUp" || key === "ArrowDown" || key === "ArrowLeft" || key === "ArrowRight")) {
1935
2134
  e.preventDefault();
1936
- if (key === "ArrowUp") this.extendRange(-this._activeRow.value, 0);
1937
- else if (key === "ArrowDown") this.extendRange(this.bodyRowCount() - 1 - this._activeRow.value, 0);
1938
- else if (key === "ArrowLeft") this.extendRange(0, -this._activeColIndex.value);
1939
- else this.extendRange(0, this.visibleColCount() - 1 - this._activeColIndex.value);
2135
+ if (key === "ArrowUp") this.extendRange(-this.rangeFocusRow(), 0);
2136
+ else if (key === "ArrowDown") this.extendRange(this.bodyRowCount() - 1 - this.rangeFocusRow(), 0);
2137
+ else if (key === "ArrowLeft") this.extendRange(0, -this.rangeFocusCol());
2138
+ else this.extendRange(0, this.visibleColCount() - 1 - this.rangeFocusCol());
1940
2139
  return;
1941
2140
  } else if ((e.ctrlKey || e.metaKey) && !this._activeIsHeader.value && (key === "ArrowUp" || key === "ArrowDown" || key === "ArrowLeft" || key === "ArrowRight")) {
1942
2141
  e.preventDefault();
@@ -2019,15 +2218,15 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
2019
2218
  nextCol = en.col;
2020
2219
  nextIsHeader = false;
2021
2220
  } else nextCol = this.gotoColEdge(true);
2022
- } else if ((key === "c" || key === "C") && (e.ctrlKey || e.metaKey) && this.clipboardActiveAllowed()) {
2221
+ } else if ((key === "c" || key === "C") && (e.ctrlKey || e.metaKey) && this.clipboardActiveAllowed() && this.clipboardWriteAvailable()) {
2023
2222
  e.preventDefault();
2024
2223
  this.copyRange();
2025
2224
  return;
2026
- } else if ((key === "v" || key === "V") && (e.ctrlKey || e.metaKey) && this.clipboardActiveAllowed()) {
2225
+ } else if ((key === "v" || key === "V") && (e.ctrlKey || e.metaKey) && this.clipboardActiveAllowed() && this.clipboardReadAvailable()) {
2027
2226
  e.preventDefault();
2028
2227
  this.pasteRange();
2029
2228
  return;
2030
- } else if ((key === "x" || key === "X") && (e.ctrlKey || e.metaKey) && this.clipboardActiveAllowed()) {
2229
+ } else if ((key === "x" || key === "X") && (e.ctrlKey || e.metaKey) && this.clipboardActiveAllowed() && this.clipboardWriteAvailable()) {
2031
2230
  e.preventDefault();
2032
2231
  this.cutRange();
2033
2232
  return;
@@ -2057,6 +2256,23 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
2057
2256
  e.preventDefault();
2058
2257
  if (!this._activeIsHeader.value) this.selectAllBody();
2059
2258
  return;
2259
+ } else if (key === " " && e.shiftKey && !e.ctrlKey && !e.metaKey && !this._activeIsHeader.value) {
2260
+ e.preventDefault();
2261
+ if (this.selectionMode !== "none") {
2262
+ const selRow = (this._rows.value || [])[this._activeRow.value];
2263
+ if (selRow && selRow.toggleSelected) selRow.toggleSelected(!this.rowIsSelected(selRow));
2264
+ }
2265
+ return;
2266
+ } else if (key === " " && (e.ctrlKey || e.metaKey) && !e.shiftKey && !this._activeIsHeader.value) {
2267
+ e.preventDefault();
2268
+ this.selectActiveColumn();
2269
+ return;
2270
+ } else if (key === "Escape") {
2271
+ if (this.rangeActive || this._rangeAnchor.value != null) {
2272
+ e.preventDefault();
2273
+ this.clearRange();
2274
+ }
2275
+ return;
2060
2276
  } else if (key === "F2" && e.shiftKey && this.isActiveCellEditable()) {
2061
2277
  e.preventDefault();
2062
2278
  this.beginRowEdit((this._rows.value || [])[this._activeRow.value]);
@@ -2082,6 +2298,10 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
2082
2298
  this.onToggleExpand((this._rows.value || [])[this._activeRow.value], e);
2083
2299
  this.recoverGridFocus(String(grpRow), grpCol, null, true);
2084
2300
  return;
2301
+ } else if (key === "Enter" && !this._activeIsHeader.value && !this.activeCellHasControls()) {
2302
+ e.preventDefault();
2303
+ this.activateRowAt(this._activeRow.value, "keyboard");
2304
+ return;
2085
2305
  } else if (key === "Enter" || key === "F2") {
2086
2306
  e.preventDefault();
2087
2307
  this.enterControl();
@@ -2136,8 +2356,11 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
2136
2356
  this._activeColIndex.value = col;
2137
2357
  if (isHeader !== prevIsHeader || col !== prevCol || (isHeader ? movedLevel !== prevLevel : movedRow !== prevRow)) this.focusIntentEpoch = this.focusIntentEpoch + 1;
2138
2358
  if (this.rangeTransition) this.rangeTransition = false;
2139
- else if (this.rangeClickPending) this.rangeClickPending = false;
2140
- else this.clearRange();
2359
+ else if (this.rangeClickPending && this.rangeClickPending.isHeader === isHeader && this.rangeClickPending.r === movedRow && this.rangeClickPending.c === col) this.rangeClickPending = null;
2360
+ else {
2361
+ this.rangeClickPending = null;
2362
+ this.clearRange();
2363
+ }
2141
2364
  if (tgt === cellEl) this._activeInControl.value = false;
2142
2365
  };
2143
2366
  this.onGridMouseDown = (e) => {
@@ -2158,9 +2381,14 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
2158
2381
  this._activeIsHeader.value = false;
2159
2382
  this._activeRow.value = row;
2160
2383
  this._activeColIndex.value = col;
2161
- this.rangeClickPending = true;
2384
+ this.rangeClickPending = {
2385
+ isHeader: false,
2386
+ r: row,
2387
+ c: col
2388
+ };
2162
2389
  return;
2163
2390
  }
2391
+ if (this.isEditing(row, col)) return;
2164
2392
  this.beginRangeDrag(row, col);
2165
2393
  };
2166
2394
  this.onGridDblClick = (e) => {
@@ -2188,7 +2416,43 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
2188
2416
  this.beginEdit(row, col, null);
2189
2417
  }
2190
2418
  };
2419
+ this.activateRowAt = (index, trigger) => {
2420
+ const row = (this._rows.value || [])[index];
2421
+ if (!row || this.rowIsGrouped(row) || this.rowIsLazyPlaceholder(row)) return;
2422
+ this.dispatchEvent(new CustomEvent("row-activate", {
2423
+ detail: {
2424
+ row: row.original,
2425
+ index,
2426
+ trigger
2427
+ },
2428
+ bubbles: true,
2429
+ composed: true
2430
+ }));
2431
+ };
2432
+ this.ROW_ACTIVATE_CONTROLS = "input, button, a[href], select, textarea, label, summary, [contenteditable=\"\"], [contenteditable=\"true\"], [role=\"button\"], [role=\"checkbox\"], [role=\"link\"], [data-editing-cell]";
2433
+ this.maybeActivateRowFromClick = (e) => {
2434
+ if (!e || e.shiftKey || e.ctrlKey || e.metaKey || e.altKey) return;
2435
+ if (this.rangeDragMoved) return;
2436
+ const tgt = e.target;
2437
+ if (!tgt || !tgt.closest) return;
2438
+ const cellEl = tgt.closest("[data-row]");
2439
+ if (!cellEl) return;
2440
+ const control = tgt.closest(this.ROW_ACTIVATE_CONTROLS);
2441
+ if (control && cellEl.contains(control)) return;
2442
+ const rowAttr = cellEl.getAttribute("data-row");
2443
+ if (rowAttr == null || rowAttr === "__header") return;
2444
+ const index = parseInt(rowAttr, 10);
2445
+ if (!Number.isFinite(index)) return;
2446
+ if (this.isGrid() && this.singleClickEdit) {
2447
+ const colAttr = cellEl.getAttribute("data-col-index");
2448
+ const col = colAttr == null ? NaN : parseInt(colAttr, 10);
2449
+ const colId = Number.isFinite(col) ? this.columnIdAt(index, col) : null;
2450
+ if (colId != null && this.columnEditable(colId)) return;
2451
+ }
2452
+ this.activateRowAt(index, "click");
2453
+ };
2191
2454
  this.onGridClick = (e) => {
2455
+ this.maybeActivateRowFromClick(e);
2192
2456
  if (!this.isGrid() || !e) return;
2193
2457
  if (!this.singleClickEdit) return;
2194
2458
  if (e.shiftKey) return;
@@ -2299,7 +2563,8 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
2299
2563
  const headers = hg && hg.headers || [];
2300
2564
  if (!this.colsWindowed()) return headers.map((h) => ({
2301
2565
  header: h,
2302
- span: h && h.colSpan > 1 ? h.colSpan : 1
2566
+ span: h && h.colSpan > 1 ? h.colSpan : 1,
2567
+ width: null
2303
2568
  }));
2304
2569
  const idx = this.windowedColIndices();
2305
2570
  const idxSet = {};
@@ -2313,23 +2578,39 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
2313
2578
  const end = cursor + leafCount;
2314
2579
  cursor = end;
2315
2580
  let span = 0;
2316
- for (let c = start; c < end; c++) if (idxSet[c]) span = span + 1;
2581
+ let width = 0;
2582
+ for (let c = start; c < end; c++) if (idxSet[c]) {
2583
+ span = span + 1;
2584
+ width = width + this.columnSize(c);
2585
+ }
2317
2586
  if (span > 0) out.push({
2318
2587
  header: h,
2319
- span
2588
+ span,
2589
+ width
2320
2590
  });
2321
2591
  }
2322
2592
  return out;
2323
2593
  };
2324
2594
  this.windowedColSpan = () => this.colsWindowed() ? this.windowedColIndices().length + 2 : this.visibleColCount();
2595
+ this.lastColSizeSig = 0;
2596
+ this.remeasureColumnSizes = () => {
2597
+ if (!this.colsWindowed() || !this.colVirtualizer || !this.colVirtualizer.measure) return;
2598
+ const n = this.columnCount();
2599
+ let sig = n;
2600
+ for (let i = 0; i < n; i++) sig = Math.imul(sig, 31) + this.columnSize(i) | 0;
2601
+ if (sig === this.lastColSizeSig) return;
2602
+ this.lastColSizeSig = sig;
2603
+ this.colVirtualizer.measure();
2604
+ };
2325
2605
  this.remeasureColumnWindow = () => {
2326
2606
  if (!this.colsWindowed() || !this.colVirtualizer) return;
2327
2607
  this.colVirtualizer.setOptions(this.columnVirtualizerOptions());
2608
+ this.remeasureColumnSizes();
2328
2609
  this.colVirtualizer._willUpdate();
2329
2610
  };
2330
2611
  this.gridEmptyFallback = false;
2331
2612
  this.rangeTransition = false;
2332
- this.rangeClickPending = false;
2613
+ this.rangeClickPending = null;
2333
2614
  this.rangeActive = false;
2334
2615
  this.inRange = (rIdx, cIdx) => {
2335
2616
  const a = this._rangeAnchor.value;
@@ -2371,7 +2652,17 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
2371
2652
  const c1 = a.colIndex > f.colIndex ? a.colIndex : f.colIndex;
2372
2653
  return rIdx === r1 && cIdx === c1;
2373
2654
  };
2655
+ this.rangeSummary = (anchor, focus) => {
2656
+ if (!anchor || !focus) return "";
2657
+ const rows = Math.abs(focus.rowIndex - anchor.rowIndex) + 1;
2658
+ const cols = Math.abs(focus.colIndex - anchor.colIndex) + 1;
2659
+ if (rows === 1 && cols === 1) return "1 cell selected";
2660
+ const rowPart = rows + (rows === 1 ? " row" : " rows");
2661
+ const colPart = cols + (cols === 1 ? " column" : " columns");
2662
+ return rowPart + " by " + colPart + " selected, " + rows * cols + " cells";
2663
+ };
2374
2664
  this.emitRangeChange = (anchor, focus) => {
2665
+ this._rangeAnnounce.value = this.rangeSummary(anchor, focus);
2375
2666
  this.dispatchEvent(new CustomEvent("range-change", {
2376
2667
  detail: {
2377
2668
  anchor,
@@ -2414,11 +2705,15 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
2414
2705
  this.focusActiveCell(nextRow, nextCol, false);
2415
2706
  if (!hadRange || nextRow !== focus.rowIndex || nextCol !== focus.colIndex) this.emitRangeChange(anchor, nextFocus);
2416
2707
  };
2417
- this.setRangeFocus = (rIdx, cIdx) => {
2708
+ this.setRangeFocus = (rIdx, cIdx, anchorR = null, anchorC = null) => {
2418
2709
  const maxRow = this.bodyRowCount() - 1;
2419
2710
  const maxCol = this.visibleColCount() - 1;
2420
2711
  if (maxRow < 0 || maxCol < 0) return;
2421
2712
  let anchor = this._rangeAnchor.value;
2713
+ if (!anchor && anchorR != null && anchorC != null) anchor = {
2714
+ rowIndex: clamp(Math.trunc(Number(anchorR)) || 0, 0, maxRow),
2715
+ colIndex: clamp(Math.trunc(Number(anchorC)) || 0, 0, maxCol)
2716
+ };
2422
2717
  if (!anchor) anchor = {
2423
2718
  rowIndex: this._activeRow.value,
2424
2719
  colIndex: this._activeColIndex.value
@@ -2449,6 +2744,32 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
2449
2744
  this.rangeActive = true;
2450
2745
  this.emitRangeChange(anchor, focus);
2451
2746
  };
2747
+ this.rangeFocusRow = () => {
2748
+ const f = this._rangeFocus.value;
2749
+ return f && f.rowIndex != null ? f.rowIndex : this._activeRow.value;
2750
+ };
2751
+ this.rangeFocusCol = () => {
2752
+ const f = this._rangeFocus.value;
2753
+ return f && f.colIndex != null ? f.colIndex : this._activeColIndex.value;
2754
+ };
2755
+ this.selectActiveColumn = () => {
2756
+ const maxRow = this.bodyRowCount() - 1;
2757
+ const maxCol = this.visibleColCount() - 1;
2758
+ if (maxRow < 0 || maxCol < 0) return;
2759
+ const c = clamp(Math.trunc(Number(this._activeColIndex.value)) || 0, 0, maxCol);
2760
+ const anchor = {
2761
+ rowIndex: 0,
2762
+ colIndex: c
2763
+ };
2764
+ const focus = {
2765
+ rowIndex: maxRow,
2766
+ colIndex: c
2767
+ };
2768
+ this._rangeAnchor.value = anchor;
2769
+ this._rangeFocus.value = focus;
2770
+ this.rangeActive = true;
2771
+ this.emitRangeChange(anchor, focus);
2772
+ };
2452
2773
  this.clearRange = () => {
2453
2774
  if (!this.rangeActive) return;
2454
2775
  this.rangeActive = false;
@@ -2528,6 +2849,8 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
2528
2849
  }
2529
2850
  return lines.join("\n");
2530
2851
  };
2852
+ this.clipboardWriteAvailable = () => typeof navigator !== "undefined" && !!navigator.clipboard && typeof navigator.clipboard.writeText === "function";
2853
+ this.clipboardReadAvailable = () => typeof navigator !== "undefined" && !!navigator.clipboard && typeof navigator.clipboard.readText === "function";
2531
2854
  this.copyRange = () => {
2532
2855
  if (!this.clipboardActiveAllowed()) return;
2533
2856
  if (typeof navigator === "undefined" || !navigator.clipboard || !navigator.clipboard.writeText) return;
@@ -2536,27 +2859,30 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
2536
2859
  if (p && p.catch) p.catch(() => {});
2537
2860
  } catch (err) {}
2538
2861
  };
2539
- this.applyGridToRange = (grid, originRow, originCol) => {
2862
+ this.applyGridToRange = (grid, originRow, originCol, verb) => {
2863
+ const opVerb = typeof verb === "string" && verb !== "" ? verb : "pasted";
2540
2864
  const maxRow = this.bodyRowCount() - 1;
2541
2865
  const maxCol = this.visibleColCount() - 1;
2542
2866
  if (maxRow < 0 || maxCol < 0) return {
2543
2867
  wrote: 0,
2868
+ changed: 0,
2544
2869
  total: 0
2545
2870
  };
2546
2871
  let total = 0;
2547
- let wrote = 0;
2872
+ let applied = 0;
2548
2873
  const committed = [];
2549
2874
  let next = this.currentData();
2550
2875
  for (let gr = 0; gr < grid.length; gr++) {
2551
2876
  const r = originRow + gr;
2552
2877
  if (r > maxRow) break;
2553
2878
  const rowGrouped = this.rowIndexIsGrouped(r);
2879
+ const rowPlaceholder = this.rowIsLazyPlaceholder((this._rows.value || [])[r]);
2554
2880
  const cols = grid[gr] || [];
2555
2881
  for (let gc = 0; gc < cols.length; gc++) {
2556
2882
  const c = originCol + gc;
2557
2883
  if (c > maxCol) break;
2558
2884
  total = total + 1;
2559
- if (rowGrouped) continue;
2885
+ if (rowGrouped || rowPlaceholder) continue;
2560
2886
  const colId = this.columnIdAt(r, c);
2561
2887
  if (colId == null || !this.columnEditable(colId)) continue;
2562
2888
  const rowObj = this.rowOriginalAt(r);
@@ -2565,6 +2891,8 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
2565
2891
  const field = this.fieldOfColId(colId);
2566
2892
  const srcIndex = this.sourceIndexOfRow(r);
2567
2893
  const oldValue = rowObj ? rowObj[field] : null;
2894
+ applied = applied + 1;
2895
+ if (oldValue === value) continue;
2568
2896
  next = replaceRowValue(next, srcIndex, field, value);
2569
2897
  committed.push({
2570
2898
  rowId: this.rowIdAt(r),
@@ -2572,23 +2900,27 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
2572
2900
  oldValue,
2573
2901
  newValue: value
2574
2902
  });
2575
- wrote = wrote + 1;
2576
2903
  }
2577
2904
  }
2578
- if (wrote > 0) {
2905
+ if (committed.length > 0) {
2579
2906
  this.editTransition = true;
2580
2907
  this.writeData(next);
2581
2908
  this.editTransition = false;
2582
- for (let i = 0; i < committed.length; i++) this.dispatchEvent(new CustomEvent("cell-edit-commit", {
2583
- detail: committed[i],
2584
- bubbles: true,
2585
- composed: true
2586
- }));
2909
+ for (let i = 0; i < committed.length; i++) try {
2910
+ this.dispatchEvent(new CustomEvent("cell-edit-commit", {
2911
+ detail: committed[i],
2912
+ bubbles: true,
2913
+ composed: true
2914
+ }));
2915
+ } catch (err) {
2916
+ 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);
2917
+ }
2587
2918
  }
2588
- if (wrote > 0) this.announce(wrote + " of " + total + " cells pasted");
2589
- else if (total > 0) this.announce("No cells pasted — " + total + " cells were invalid or read-only");
2919
+ if (applied > 0) this.announce(applied + " of " + total + " cells " + opVerb);
2920
+ else if (total > 0) this.announce("No cells " + opVerb + " — " + total + " cells were invalid or read-only");
2590
2921
  return {
2591
- wrote,
2922
+ wrote: applied,
2923
+ changed: committed.length,
2592
2924
  total
2593
2925
  };
2594
2926
  };
@@ -2620,11 +2952,15 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
2620
2952
  }
2621
2953
  if (!p || !p.then) return;
2622
2954
  p.then((text) => {
2623
- const grid = parseTsv(text);
2624
- if (!grid.length) return;
2625
- const tiled = tileGridToBox(grid, destBox);
2626
- this.applyGridToRange(tiled, anchorRow, anchorCol);
2627
- }).catch(() => {});
2955
+ try {
2956
+ const grid = parseTsv(text);
2957
+ if (!grid.length) return;
2958
+ const tiled = tileGridToBox(grid, destBox);
2959
+ this.applyGridToRange(tiled, anchorRow, anchorCol, "pasted");
2960
+ } catch (err) {
2961
+ console.error("[rozie-data-table] paste failed: a row accessor, the data model setter or other consumer code threw. The paste was abandoned.", err);
2962
+ }
2963
+ }, () => {});
2628
2964
  };
2629
2965
  this.cutRange = () => {
2630
2966
  if (!this.clipboardActiveAllowed()) return;
@@ -2643,7 +2979,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
2643
2979
  for (let c = c0; c <= c1; c++) cols.push("");
2644
2980
  grid.push(cols);
2645
2981
  }
2646
- this.applyGridToRange(grid, r0, c0);
2982
+ this.applyGridToRange(grid, r0, c0, "cut");
2647
2983
  };
2648
2984
  this.clearActiveRange = () => {
2649
2985
  if (!this.clipboardActiveAllowed()) return;
@@ -2658,7 +2994,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
2658
2994
  for (let c = c0; c <= c1; c++) cols.push("");
2659
2995
  grid.push(cols);
2660
2996
  }
2661
- this.applyGridToRange(grid, r0, c0);
2997
+ this.applyGridToRange(grid, r0, c0, "cleared");
2662
2998
  };
2663
2999
  this.fillRange = (sourceBox, endCell) => {
2664
3000
  let box;
@@ -2696,7 +3032,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
2696
3032
  }
2697
3033
  grid.push(cols);
2698
3034
  }
2699
- this.applyGridToRange(grid, box.r0, box.c0);
3035
+ this.applyGridToRange(grid, box.r0, box.c0, "filled");
2700
3036
  };
2701
3037
  this.fillDragging = false;
2702
3038
  this.fillDragMove = null;
@@ -2858,7 +3194,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
2858
3194
  if (cell && (cell.r !== lastCell.r || cell.c !== lastCell.c)) {
2859
3195
  lastCell = cell;
2860
3196
  this.rangeDragMoved = true;
2861
- this.setRangeFocus(cell.r, cell.c);
3197
+ this.setRangeFocus(cell.r, cell.c, anchorR, anchorC);
2862
3198
  }
2863
3199
  };
2864
3200
  const up = () => {
@@ -2880,6 +3216,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
2880
3216
  };
2881
3217
  this.isActiveCellEditable = () => {
2882
3218
  if (this.rowIndexIsGrouped(this._activeRow.value)) return false;
3219
+ if (this.rowIsLazyPlaceholder((this._rows.value || [])[this._activeRow.value])) return false;
2883
3220
  const colId = this.activeCellColumnId();
2884
3221
  return colId != null && this.columnEditable(colId);
2885
3222
  };
@@ -2991,12 +3328,14 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
2991
3328
  };
2992
3329
  this.beginEdit = (rowIndex, colIndex, seed) => {
2993
3330
  if (this.rowIndexIsGrouped(rowIndex)) return;
3331
+ if (this.rowIsLazyPlaceholder((this._rows.value || [])[rowIndex])) return;
2994
3332
  const colId = this.columnIdAt(rowIndex, colIndex);
2995
3333
  if (colId == null || !this.columnEditable(colId)) return;
2996
3334
  this.committedThisSession = false;
2997
3335
  this.setInvalid("");
2998
3336
  this._editingRowIndex.value = null;
2999
3337
  this._rowDraft.value = {};
3338
+ this.rowDraftSync = {};
3000
3339
  this._editingRow.value = rowIndex;
3001
3340
  this._editingCol.value = colIndex;
3002
3341
  this._draftValue.value = seed != null ? seed : this.cellValueAt(rowIndex, colIndex);
@@ -3039,6 +3378,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
3039
3378
  this.endRowEdit = () => {
3040
3379
  this._editingRowIndex.value = null;
3041
3380
  this._rowDraft.value = {};
3381
+ this.rowDraftSync = {};
3042
3382
  this._invalidMsg.value = "";
3043
3383
  this._activeInControl.value = false;
3044
3384
  this._editVer.value = this._editVer.value + 1;
@@ -3052,7 +3392,14 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
3052
3392
  return this._editFocusColId.value != null && this._editFocusColId.value === colId;
3053
3393
  };
3054
3394
  this.coerceCellValue = (colId, raw) => {
3055
- if (this.editorTypeOf(colId) !== "number") return raw;
3395
+ const kind = this.editorTypeOf(colId);
3396
+ if (kind === "checkbox") {
3397
+ if (typeof raw === "boolean") return raw;
3398
+ if (raw == null) return false;
3399
+ if (typeof raw === "number") return raw !== 0;
3400
+ return /^\s*(true|1|yes|y|on)\s*$/i.test(String(raw));
3401
+ }
3402
+ if (kind !== "number") return raw;
3056
3403
  if (raw == null) return null;
3057
3404
  if (typeof raw === "number") return Number.isNaN(raw) ? null : raw;
3058
3405
  const s = String(raw).trim();
@@ -3114,10 +3461,11 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
3114
3461
  };
3115
3462
  this.toggleActiveBooleanCell = () => {
3116
3463
  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
3464
  const row = (this._rows.value || [])[this._activeRow.value];
3120
3465
  if (!row) return;
3466
+ if (this.rowIsLazyPlaceholder(row)) return;
3467
+ const colId = this.columnIdAt(this._activeRow.value, this._activeColIndex.value);
3468
+ if (colId == null || !this.columnEditable(colId)) return;
3121
3469
  const rowOriginal = row.original;
3122
3470
  const rowId = row.id;
3123
3471
  const oldValue = this.cellValueAt(this._activeRow.value, this._activeColIndex.value);
@@ -3203,6 +3551,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
3203
3551
  const rowIndex = this.rowIndexOf(row);
3204
3552
  if (rowIndex < 0) return;
3205
3553
  if (this.rowIndexIsGrouped(rowIndex)) return;
3554
+ if (this.rowIsLazyPlaceholder((this._rows.value || [])[rowIndex])) return;
3206
3555
  const editable = this.editableColumnsForRow(rowIndex);
3207
3556
  if (editable.length === 0) return;
3208
3557
  this.committedThisSession = false;
@@ -3218,6 +3567,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
3218
3567
  draft[ec.colId] = orig ? orig[ec.field] : null;
3219
3568
  }
3220
3569
  this._rowDraft.value = draft;
3570
+ this.rowDraftSync = draft;
3221
3571
  this._editingRowIndex.value = rowIndex;
3222
3572
  this._activeInControl.value = true;
3223
3573
  this._editVer.value = this._editVer.value + 1;
@@ -3235,7 +3585,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
3235
3585
  const r = (this._rows.value || [])[rowIndex];
3236
3586
  const rowOriginal = r ? r.original : null;
3237
3587
  const rowId = r ? r.id : null;
3238
- const draft = this._rowDraft.value || {};
3588
+ const draft = this.rowDraftSync || {};
3239
3589
  for (let i = 0; i < editable.length; i++) {
3240
3590
  const ec = editable[i];
3241
3591
  const err = this.runValidator(ec.colId, this.coerceCellValue(ec.colId, draft[ec.colId]), rowOriginal);
@@ -3348,6 +3698,8 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
3348
3698
  this.editTransition = false;
3349
3699
  this.pendingEditFollow = null;
3350
3700
  this.committedThisSession = false;
3701
+ this.rowDraftSync = {};
3702
+ this.dropinTabFlush = null;
3351
3703
  this.inRowEdit = () => this._editingRowIndex.value != null;
3352
3704
  this.editorValueFor = (colId) => this.inRowEdit() ? this._rowDraft.value ? this._rowDraft.value[colId] : null : this._draftValue.value;
3353
3705
  this.editorCheckedFor = (colId) => !!(this.inRowEdit() ? this._rowDraft.value ? this._rowDraft.value[colId] : null : this._draftValue.value);
@@ -3356,6 +3708,11 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
3356
3708
  this.setRowDraft(colId, value);
3357
3709
  return;
3358
3710
  }
3711
+ if (this.dropinTabFlush) {
3712
+ this.dropinTabFlush.called = true;
3713
+ if (this.commitEdit(value, true)) this.dropinTabFlush.committed = true;
3714
+ return;
3715
+ }
3359
3716
  this.commitEdit(value);
3360
3717
  };
3361
3718
  this.editorCancelFor = () => () => {
@@ -3382,10 +3739,11 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
3382
3739
  this._draftValue.value = v;
3383
3740
  };
3384
3741
  this.setRowDraft = (colId, value) => {
3385
- const src = this._rowDraft.value || {};
3742
+ const src = this.rowDraftSync || {};
3386
3743
  const next = {};
3387
3744
  for (const k in src) next[k] = src[k];
3388
3745
  next[colId] = value;
3746
+ this.rowDraftSync = next;
3389
3747
  this._rowDraft.value = next;
3390
3748
  };
3391
3749
  this.rowEditTab = (target, backward) => {
@@ -3440,6 +3798,56 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
3440
3798
  this.cancelEdit();
3441
3799
  }
3442
3800
  };
3801
+ this.onEditorDropinKeyDown = (e) => {
3802
+ if (!e) return;
3803
+ const key = e.key;
3804
+ if (this.inRowEdit()) {
3805
+ if (key === "Enter") {
3806
+ e.preventDefault();
3807
+ this.commitRow();
3808
+ return;
3809
+ }
3810
+ if (key === "Escape") {
3811
+ e.preventDefault();
3812
+ this.cancelRow();
3813
+ return;
3814
+ }
3815
+ if (key === "Tab") {
3816
+ e.preventDefault();
3817
+ this.rowEditTab(e.target, e.shiftKey);
3818
+ return;
3819
+ }
3820
+ return;
3821
+ }
3822
+ if (key !== "Tab" || e.defaultPrevented) return;
3823
+ e.preventDefault();
3824
+ const fromRow = this._editingRow.value;
3825
+ const fromCol = this._editingCol.value;
3826
+ const target = e.shiftKey ? this.prevEditableCell(fromRow, fromCol) : this.nextEditableCell(fromRow, fromCol);
3827
+ const el = e.target;
3828
+ const ownCell = el && el.closest ? el.closest("[data-grid-cell]") : null;
3829
+ const flush = {
3830
+ called: false,
3831
+ committed: false
3832
+ };
3833
+ this.dropinTabFlush = flush;
3834
+ if (ownCell && ownCell.focus) ownCell.focus();
3835
+ else if (el && el.blur) el.blur();
3836
+ this.dropinTabFlush = null;
3837
+ if (!flush.called) {
3838
+ this.onEditorKeyDown(e);
3839
+ return;
3840
+ }
3841
+ if (!flush.committed) {
3842
+ if (el && el.focus) el.focus();
3843
+ return;
3844
+ }
3845
+ if (target) {
3846
+ this._activeRow.value = target.row;
3847
+ this._activeColIndex.value = target.col;
3848
+ this.beginEdit(target.row, target.col, null);
3849
+ } else this.focusCellWhenReady(fromRow, fromCol);
3850
+ };
3443
3851
  this.onEditorBlur = (e) => {
3444
3852
  if (this.inRowEdit()) {
3445
3853
  if (this.editTransition) return;
@@ -3452,13 +3860,20 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
3452
3860
  }
3453
3861
  if (this._editingRow.value < 0 || this.editTransition) return;
3454
3862
  const next = e ? e.relatedTarget : null;
3455
- if (next == null) return;
3863
+ const fromCell = e && e.target && e.target.closest ? e.target.closest("[data-grid-cell]") : null;
3864
+ if (next == null) {
3865
+ if (!this.outsidePointerDown) return;
3866
+ this.outsidePointerDown = false;
3867
+ if (!fromCell) return;
3868
+ if (fromCell.getAttribute("data-row") !== String(this._editingRow.value) || fromCell.getAttribute("data-col-index") !== String(this._editingCol.value)) return;
3869
+ this.commitEdit(void 0, true);
3870
+ return;
3871
+ }
3456
3872
  if (!(this.gridRoot && this.gridRoot.contains && this.gridRoot.contains(next))) {
3457
3873
  this.commitEdit(void 0);
3458
3874
  return;
3459
3875
  }
3460
3876
  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
3877
  if (!nextCell || !fromCell || nextCell === fromCell) return;
3463
3878
  const fromRow = fromCell.getAttribute("data-row");
3464
3879
  const fromCol = fromCell.getAttribute("data-col-index");
@@ -3637,32 +4052,30 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
3637
4052
  this.styles = lit.css`
3638
4053
  :host{display:contents}
3639
4054
  :host {
3640
- --rdt-font: var(--rozie-data-table-font);
3641
- --rdt-color: var(--rozie-data-table-fg);
3642
- --rdt-cell-padding: var(--rozie-data-table-cell-padding);
3643
- --rdt-border: 1px solid var(--rozie-data-table-border-color);
3644
- --rdt-header-bg: var(--rozie-data-table-header-bg);
3645
- --rdt-header-weight: var(--rozie-data-table-header-weight);
3646
- --rdt-sort-ind-opacity: var(--rozie-data-table-sort-indicator-opacity);
3647
- --rdt-filter-border: 1px solid var(--rozie-data-table-control-border-color);
3648
- --rdt-filter-radius: var(--rozie-data-table-radius);
3649
- --rdt-page-btn-border: 1px solid var(--rozie-data-table-control-border-color);
3650
- --rdt-page-btn-radius: var(--rozie-data-table-radius);
3651
- --rdt-page-btn-disabled-opacity: var(--rozie-data-table-disabled-opacity);
3652
- --rdt-page-size-border: 1px solid var(--rozie-data-table-control-border-color);
3653
- --rdt-page-size-radius: var(--rozie-data-table-radius);
3654
- --rdt-resize-grip-color: var(--rozie-data-table-resize-grip-color);
3655
- --rdt-resize-grip-active: var(--rozie-data-table-resize-grip-active);
3656
- --rdt-pin-btn-border: 1px solid var(--rozie-data-table-control-border-color);
3657
- --rdt-pin-btn-radius: var(--rozie-data-table-radius);
3658
- --rdt-pin-btn-active-bg: var(--rozie-data-table-pin-active-bg);
3659
- --rdt-colvis-summary-border: 1px solid var(--rozie-data-table-control-border-color);
3660
- --rdt-colvis-summary-radius: var(--rozie-data-table-radius);
3661
- --rdt-colvis-menu-border: 1px solid var(--rozie-data-table-border-color);
3662
- --rdt-colvis-menu-radius: var(--rozie-data-table-radius);
3663
- --rdt-colvis-menu-bg: var(--rozie-data-table-menu-bg);
3664
- --rdt-colvis-menu-shadow: var(--rozie-data-table-menu-shadow);
3665
- --rdt-select-accent: var(--rozie-data-table-select-accent);
4055
+ --rdt-color: var(--rozie-data-table-fg, var(--rdt-ds-fg));
4056
+ --rdt-select-accent: var(--rozie-data-table-select-accent, var(--rozie-data-table-accent, var(--rdt-ds-select-accent)));
4057
+ --rdt-border: 1px solid var(--rozie-data-table-border-color, var(--rdt-ds-border-color));
4058
+ --rdt-filter-border: 1px solid var(--rozie-data-table-control-border-color, var(--rdt-ds-control-border-color));
4059
+ --rdt-filter-radius: var(--rozie-data-table-radius, var(--rdt-ds-radius));
4060
+ --rdt-font: var(--rozie-data-table-font, var(--rdt-ds-font));
4061
+ --rdt-cell-padding: var(--rozie-data-table-cell-padding, var(--rdt-ds-cell-padding));
4062
+ --rdt-header-bg: var(--rozie-data-table-header-bg, var(--rdt-ds-header-bg));
4063
+ --rdt-header-weight: var(--rozie-data-table-header-weight, var(--rdt-ds-header-weight));
4064
+ --rdt-sort-ind-opacity: var(--rozie-data-table-sort-indicator-opacity, var(--rdt-ds-sort-indicator-opacity));
4065
+ --rdt-resize-grip-color: var(--rozie-data-table-resize-grip-color, var(--rdt-ds-resize-grip-color));
4066
+ --rdt-resize-grip-active: var(--rozie-data-table-resize-grip-active, var(--rozie-data-table-accent, var(--rdt-ds-resize-grip-active)));
4067
+ --rdt-pin-btn-active-bg: var(--rozie-data-table-pin-active-bg, var(--rdt-ds-pin-active-bg));
4068
+ --rdt-colvis-menu-bg: var(--rozie-data-table-menu-bg, var(--rdt-ds-menu-bg));
4069
+ --rdt-colvis-menu-shadow: var(--rozie-data-table-menu-shadow, var(--rdt-ds-menu-shadow));
4070
+ --rdt-colvis-menu-border: 1px solid var(--rozie-data-table-border-color, var(--rdt-ds-border-color));
4071
+ --rdt-colvis-menu-radius: var(--rozie-data-table-radius, var(--rdt-ds-radius));
4072
+ --rdt-colvis-summary-border: 1px solid var(--rozie-data-table-control-border-color, var(--rdt-ds-control-border-color));
4073
+ --rdt-colvis-summary-radius: var(--rozie-data-table-radius, var(--rdt-ds-radius));
4074
+ --rdt-page-btn-disabled-opacity: var(--rozie-data-table-disabled-opacity, var(--rdt-ds-disabled-opacity));
4075
+ --rdt-page-btn-border: 1px solid var(--rozie-data-table-control-border-color, var(--rdt-ds-control-border-color));
4076
+ --rdt-page-btn-radius: var(--rozie-data-table-radius, var(--rdt-ds-radius));
4077
+ --rdt-page-size-border: 1px solid var(--rozie-data-table-control-border-color, var(--rdt-ds-control-border-color));
4078
+ --rdt-page-size-radius: var(--rozie-data-table-radius, var(--rdt-ds-radius));
3666
4079
  }
3667
4080
  .rozie-data-table[data-rozie-s-d5dcab4c] {
3668
4081
  border-collapse: collapse;
@@ -3798,6 +4211,16 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
3798
4211
  flex-direction: column;
3799
4212
  gap: var(--rdt-chrome-gap, 0.5rem);
3800
4213
  }
4214
+ .rozie-data-table[data-rozie-s-d5dcab4c] .rdt-skeleton[data-rozie-s-d5dcab4c] {
4215
+ /* inline-block on the cell's own line box, exactly like a text value (a block box was 2px
4216
+ short of a text row). */
4217
+ display: inline-block;
4218
+ width: 100%;
4219
+ vertical-align: baseline;
4220
+ border-radius: 4px;
4221
+ background: color-mix(in srgb, currentColor 12%, transparent);
4222
+ color: transparent;
4223
+ }
3801
4224
  .rozie-data-table-wrap[data-rozie-s-d5dcab4c] .rdt-toolbar[data-rozie-s-d5dcab4c] {
3802
4225
  display: flex;
3803
4226
  gap: var(--rdt-toolbar-gap, 0.5rem);
@@ -3836,6 +4259,9 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
3836
4259
  .rozie-data-table[data-rozie-s-d5dcab4c] .rdt-filter-row[data-rozie-s-d5dcab4c] {
3837
4260
  background: var(--rdt-filter-row-bg, rgba(0, 0, 0, 0.015));
3838
4261
  }
4262
+ .rozie-data-table[data-rozie-s-d5dcab4c] .rdt-pinned[data-rozie-s-d5dcab4c] {
4263
+ box-sizing: border-box;
4264
+ }
3839
4265
  .rozie-data-table[data-rozie-s-d5dcab4c] .rdt-filter-cell[data-rozie-s-d5dcab4c] {
3840
4266
  padding: var(--rdt-filter-cell-padding, 0.35rem 0.75rem);
3841
4267
  border-bottom: var(--rdt-border, 1px solid rgba(0, 0, 0, 0.08));
@@ -3955,6 +4381,9 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
3955
4381
  .rozie-data-table-wrap[data-rozie-s-d5dcab4c] .rdt-colvis-summary[data-rozie-s-d5dcab4c] {
3956
4382
  cursor: pointer;
3957
4383
  font: inherit;
4384
+ /* Own the margin too: content-site typography styles bare \`summary\` (VitePress sets
4385
+ \`margin: 16px 0\`), which grew the <details> and stretched the toolbar's search input. */
4386
+ margin: 0;
3958
4387
  padding: var(--rdt-colvis-summary-padding, 0.25rem 0.6rem);
3959
4388
  border: var(--rdt-colvis-summary-border, 1px solid rgba(0, 0, 0, 0.2));
3960
4389
  border-radius: var(--rdt-colvis-summary-radius, 4px);
@@ -3993,6 +4422,51 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
3993
4422
  text-align: var(--rdt-expander-col-align, center);
3994
4423
  white-space: nowrap;
3995
4424
  }
4425
+ .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,
4426
+ .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,
4427
+ .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,
4428
+ .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,
4429
+ .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,
4430
+ .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,
4431
+ .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,
4432
+ .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 {
4433
+ content: '';
4434
+ display: inline-block;
4435
+ vertical-align: middle;
4436
+ }
4437
+ .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 {
4438
+ width: calc(1 * var(--rdt-tree-indent, 1.25rem));
4439
+ }
4440
+ .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 {
4441
+ width: calc(2 * var(--rdt-tree-indent, 1.25rem));
4442
+ }
4443
+ .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 {
4444
+ width: calc(3 * var(--rdt-tree-indent, 1.25rem));
4445
+ }
4446
+ .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 {
4447
+ width: calc(4 * var(--rdt-tree-indent, 1.25rem));
4448
+ }
4449
+ .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 {
4450
+ width: calc(5 * var(--rdt-tree-indent, 1.25rem));
4451
+ }
4452
+ .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 {
4453
+ width: calc(6 * var(--rdt-tree-indent, 1.25rem));
4454
+ }
4455
+ .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 {
4456
+ width: calc(7 * var(--rdt-tree-indent, 1.25rem));
4457
+ }
4458
+ .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 {
4459
+ width: calc(8 * var(--rdt-tree-indent, 1.25rem));
4460
+ }
4461
+ .rozie-data-table[role="grid"][data-rozie-s-d5dcab4c] {
4462
+ user-select: none;
4463
+ }
4464
+ .rozie-data-table[role="grid"][data-rozie-s-d5dcab4c] input[data-rozie-s-d5dcab4c],
4465
+ .rozie-data-table[role="grid"][data-rozie-s-d5dcab4c] textarea[data-rozie-s-d5dcab4c],
4466
+ .rozie-data-table[role="grid"][data-rozie-s-d5dcab4c] select[data-rozie-s-d5dcab4c],
4467
+ .rozie-data-table[role="grid"][data-rozie-s-d5dcab4c] [contenteditable="true"][data-rozie-s-d5dcab4c] {
4468
+ user-select: text;
4469
+ }
3996
4470
  .rozie-data-table[data-rozie-s-d5dcab4c] .rdt-select-all[data-rozie-s-d5dcab4c],
3997
4471
  .rozie-data-table[data-rozie-s-d5dcab4c] .rdt-select-row[data-rozie-s-d5dcab4c] {
3998
4472
  cursor: pointer;
@@ -4056,6 +4530,17 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
4056
4530
  update();
4057
4531
  }
4058
4532
  }
4533
+ {
4534
+ const slotEl = this.shadowRoot?.querySelector("slot[name=\"placeholder\"]");
4535
+ if (slotEl !== null && slotEl !== void 0) {
4536
+ const update = () => {
4537
+ this._hasSlotPlaceholder = this._slotPlaceholderElements.length > 0;
4538
+ };
4539
+ slotEl.addEventListener("slotchange", update);
4540
+ this._disconnectCleanups.push(() => slotEl.removeEventListener("slotchange", update));
4541
+ update();
4542
+ }
4543
+ }
4059
4544
  {
4060
4545
  const slotEl = this.shadowRoot?.querySelector("slot[name=\"selectCell\"]");
4061
4546
  if (slotEl !== null && slotEl !== void 0) {
@@ -4151,6 +4636,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
4151
4636
  this._hasSlotSelectAll = Array.from(this.children).some((el) => el.getAttribute("slot") === "selectAll");
4152
4637
  this._hasSlotDynamicColHeader = Array.from(this.children).some((el) => !el.hasAttribute("slot") && (el.nodeType !== 3 || (el.textContent?.trim().length ?? 0) > 0));
4153
4638
  this._hasSlotDynamicFilter = Array.from(this.children).some((el) => !el.hasAttribute("slot") && (el.nodeType !== 3 || (el.textContent?.trim().length ?? 0) > 0));
4639
+ this._hasSlotPlaceholder = Array.from(this.children).some((el) => el.getAttribute("slot") === "placeholder");
4154
4640
  this._hasSlotSelectCell = Array.from(this.children).some((el) => el.getAttribute("slot") === "selectCell");
4155
4641
  this._hasSlotDynamicCell = Array.from(this.children).some((el) => !el.hasAttribute("slot") && (el.nodeType !== 3 || (el.textContent?.trim().length ?? 0) > 0));
4156
4642
  this._hasSlotDynamicEditor = Array.from(this.children).some((el) => !el.hasAttribute("slot") && (el.nodeType !== 3 || (el.textContent?.trim().length ?? 0) > 0));
@@ -4168,12 +4654,22 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
4168
4654
  firstUpdated() {
4169
4655
  this._armListeners();
4170
4656
  this._disconnectCleanups.push((0, _lit_labs_preact_signals.effect)(() => {
4171
- 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;
4657
+ this._windowVer.value;
4172
4658
  (0, _lit_labs_preact_signals.untracked)(() => {
4173
4659
  if (this.__rozieWatchInitial_0) {
4174
4660
  this.__rozieWatchInitial_0 = false;
4175
4661
  return;
4176
4662
  }
4663
+ this.emitVisibleRangeIfChanged();
4664
+ });
4665
+ }));
4666
+ this._disconnectCleanups.push((0, _lit_labs_preact_signals.effect)(() => {
4667
+ 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;
4668
+ (0, _lit_labs_preact_signals.untracked)(() => {
4669
+ if (this.__rozieWatchInitial_1) {
4670
+ this.__rozieWatchInitial_1 = false;
4671
+ return;
4672
+ }
4177
4673
  (() => {
4178
4674
  this.seedColumnPinning();
4179
4675
  this.reFeed();
@@ -4184,8 +4680,8 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
4184
4680
  this._disconnectCleanups.push((0, _lit_labs_preact_signals.effect)(() => {
4185
4681
  this.sorting, this.columnFilters, this.globalFilter, this._sortingDefault.value, this._columnFiltersDefault.value, this._globalFilterDefault.value;
4186
4682
  (0, _lit_labs_preact_signals.untracked)(() => {
4187
- if (this.__rozieWatchInitial_1) {
4188
- this.__rozieWatchInitial_1 = false;
4683
+ if (this.__rozieWatchInitial_2) {
4684
+ this.__rozieWatchInitial_2 = false;
4189
4685
  return;
4190
4686
  }
4191
4687
  (() => {
@@ -4201,6 +4697,8 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
4201
4697
  if (id == null) return;
4202
4698
  const key = String(id);
4203
4699
  if (key === "__proto__" || key === "constructor" || key === "prototype") return;
4700
+ const prev = __rozieCtxHost._colReg.value ? __rozieCtxHost._colReg.value[key] : void 0;
4701
+ if (prev !== void 0 && columnSpecsEquivalent(prev, spec)) return;
4204
4702
  __rozieCtxHost._colReg.value = {
4205
4703
  ...__rozieCtxHost._colReg.value,
4206
4704
  [key]: spec
@@ -4217,7 +4715,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
4217
4715
  this._dataDefault.value = this.data || [];
4218
4716
  this.seedColumnPinning();
4219
4717
  this.table = (0, _tanstack_table_core.createTable)({
4220
- data: this.currentData(),
4718
+ data: this.feedData(),
4221
4719
  columns: this.tableColumns(),
4222
4720
  state: this.currentState(),
4223
4721
  getCoreRowModel: (0, _tanstack_table_core.getCoreRowModel)(),
@@ -4226,7 +4724,8 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
4226
4724
  getPaginationRowModel: (0, _tanstack_table_core.getPaginationRowModel)(),
4227
4725
  getExpandedRowModel: (0, _tanstack_table_core.getExpandedRowModel)(),
4228
4726
  getSubRows: this.getSubRows || void 0,
4229
- getRowCanExpand: this.expandable === true && this.getSubRows == null ? () => true : void 0,
4727
+ getRowId: this.rowIdOption(),
4728
+ getRowCanExpand: this.expandable === true && this.getSubRows == null ? (row) => !this.rowIsLazyPlaceholder(row) : void 0,
4230
4729
  onExpandedChange: this.onExpandedChangeCb,
4231
4730
  autoResetExpanded: false,
4232
4731
  getGroupedRowModel: (0, _tanstack_table_core.getGroupedRowModel)(),
@@ -4239,7 +4738,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
4239
4738
  manualSorting: this.manual === true,
4240
4739
  rowCount: this.rowCount ?? void 0,
4241
4740
  pageCount: this.pageCount ?? void 0,
4242
- enableRowSelection: this.selectionMode !== "none",
4741
+ enableRowSelection: this.rowSelectionOption(),
4243
4742
  enableMultiRowSelection: this.selectionMode === "multiple",
4244
4743
  onSortingChange: this.onSortingChangeCb,
4245
4744
  onGlobalFilterChange: this.onGlobalFilterChangeCb,
@@ -4264,6 +4763,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
4264
4763
  this._headerGroups.value = nextGroups;
4265
4764
  this._rowModelVer.value = this._rowModelVer.value + 1;
4266
4765
  if (this.rowsWindowed() && this.virtualizer) {
4766
+ this.migratePlaceholderSizeCache();
4267
4767
  this.virtualizer.setOptions(this.virtualizerOptions());
4268
4768
  this.virtualizer._willUpdate();
4269
4769
  }
@@ -4289,6 +4789,18 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
4289
4789
  };
4290
4790
  this.refreshRowModel();
4291
4791
  this.gridRoot = this._ref__rozieRoot ? this._ref__rozieRoot.querySelector(".rozie-data-table") : null;
4792
+ if (typeof document !== "undefined") {
4793
+ this.docPointerDown = (ev) => {
4794
+ if (!this.gridRoot) {
4795
+ this.outsidePointerDown = false;
4796
+ return;
4797
+ }
4798
+ const path = ev && typeof ev.composedPath === "function" ? ev.composedPath() : null;
4799
+ const inside = path ? path.indexOf(this.gridRoot) !== -1 : !!(ev && ev.target && this.gridRoot.contains && this.gridRoot.contains(ev.target));
4800
+ this.outsidePointerDown = !inside;
4801
+ };
4802
+ document.addEventListener("pointerdown", this.docPointerDown, true);
4803
+ }
4292
4804
  if (this.isWindowed()) this.gridScrollEl = this._ref__rozieRoot ? this._ref__rozieRoot.querySelector(".rdt-scroll") : null;
4293
4805
  if (this.rowsWindowed()) {
4294
4806
  this.virtualizer = new _tanstack_virtual_core.Virtualizer(this.virtualizerOptions());
@@ -4322,6 +4834,8 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
4322
4834
  }
4323
4835
  updated(changedProperties) {
4324
4836
  this.maybeClearHistoryOnExternalSwap();
4837
+ this.emitVisibleRangeIfChanged();
4838
+ this.remeasureColumnSizes();
4325
4839
  if (!this.table) return;
4326
4840
  const d = this.currentData() || [];
4327
4841
  if (d === this.lastData && d.length === this.lastDataLen) return;
@@ -4360,7 +4874,7 @@ let DataTable = class DataTable extends (0, _lit_labs_preact_signals.SignalWatch
4360
4874
 
4361
4875
  <div class="rdt-column-defs" style="display:none" aria-hidden="true" data-rozie-s-d5dcab4c><slot></slot></div>
4362
4876
 
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>
4877
+ ${!!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
4878
  <input class="rdt-global-filter" type="text" role="searchbox" aria-label="Search table" .value=${this.globalFilterValue()} @input=${($event) => {
4365
4879
  this.onGlobalFilterInput($event);
4366
4880
  }} data-rozie-s-d5dcab4c />
@@ -4401,7 +4915,7 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
4401
4915
  "rozie-data-table": true,
4402
4916
  "rdt-sticky": this.stickyHeader,
4403
4917
  "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) => {
4918
+ }).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
4919
  this.onGridKeyDown($event);
4406
4920
  }} @focusin=${($event) => {
4407
4921
  this.syncActiveFromEvent($event);
@@ -4421,9 +4935,10 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
4421
4935
  "rdt-th": true,
4422
4936
  "rdt-select-th": this.isSelectColumn(wh.header.column.id),
4423
4937
  "rdt-expander-th": this.isExpanderColumn(wh.header.column.id),
4938
+ "rdt-pinned": this.columnPinSide(wh.header.column.id) !== "",
4424
4939
  "rdt-th-resizing": this.columnIsResizing(wh.header.column.id),
4425
4940
  "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>
4941
+ }).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
4942
  ${this.isSelectColumn(wh.header.column.id) ? lit.html`<span style="display:contents" data-rozie-s-d5dcab4c>
4428
4943
  ${this.selectAll !== void 0 ? this.selectAll({
4429
4944
  checked: this.isAllRowsSelected(),
@@ -4539,7 +5054,10 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
4539
5054
  ${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
5055
 
4541
5056
  ${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="rdt-filter-cell" role="presentation" data-col=${(0, _rozie_runtime_lit.rozieAttr)(wh.header.column.id)} style=${(0, _rozie_runtime_lit.rozieStyle)(this.pinStyle(wh.header.column.id))} data-rozie-s-d5dcab4c>
5057
+ ${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({
5058
+ "rdt-filter-cell": true,
5059
+ "rdt-pinned": this.columnPinSide(wh.header.column.id) !== ""
5060
+ }).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
5061
  ${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
5062
  ${this.columnIsFilterable(wh.header.column.id) ? lit.html`<span style="display:contents" data-rozie-s-d5dcab4c>
4545
5063
  ${this.rozieSlots?.[`filter-${wh.header.column.id}`] !== void 0 ? this.rozieSlots?.[`filter-${wh.header.column.id}`]({
@@ -4547,6 +5065,7 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
4547
5065
  value: this.columnFilterValue(wh.header.column.id),
4548
5066
  uniqueValues: this.getFacetedUniqueValues(wh.header.column.id),
4549
5067
  minMax: this.getFacetedMinMaxValues(wh.header.column.id),
5068
+ columnLabel: this.headerLabel(wh.header.column.id),
4550
5069
  setFilter: this.setColumnFilter
4551
5070
  }) : lit.html`<slot name="${`filter-${wh.header.column.id}`}" data-rozie-params=${(() => {
4552
5071
  try {
@@ -4554,7 +5073,8 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
4554
5073
  columnId: wh.header.column.id,
4555
5074
  value: this.columnFilterValue(wh.header.column.id),
4556
5075
  uniqueValues: this.getFacetedUniqueValues(wh.header.column.id),
4557
- minMax: this.getFacetedMinMaxValues(wh.header.column.id)
5076
+ minMax: this.getFacetedMinMaxValues(wh.header.column.id),
5077
+ columnLabel: this.headerLabel(wh.header.column.id)
4558
5078
  });
4559
5079
  } catch {
4560
5080
  return "{}";
@@ -4565,6 +5085,7 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
4565
5085
  value: this.columnFilterValue(wh.header.column.id),
4566
5086
  uniqueValues: this.getFacetedUniqueValues(wh.header.column.id),
4567
5087
  minMax: this.getFacetedMinMaxValues(wh.header.column.id),
5088
+ columnLabel: this.headerLabel(wh.header.column.id),
4568
5089
  setFilter: this.setColumnFilter
4569
5090
  }) : lit.html`<slot name="filter" data-rozie-params=${(() => {
4570
5091
  try {
@@ -4572,7 +5093,8 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
4572
5093
  columnId: wh.header.column.id,
4573
5094
  value: this.columnFilterValue(wh.header.column.id),
4574
5095
  uniqueValues: this.getFacetedUniqueValues(wh.header.column.id),
4575
- minMax: this.getFacetedMinMaxValues(wh.header.column.id)
5096
+ minMax: this.getFacetedMinMaxValues(wh.header.column.id),
5097
+ columnLabel: this.headerLabel(wh.header.column.id)
4576
5098
  });
4577
5099
  } catch {
4578
5100
  return "{}";
@@ -4598,18 +5120,40 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
4598
5120
  <tr class="${Object.entries({
4599
5121
  "rdt-tr": true,
4600
5122
  "rdt-group-header": this.rowIsGrouped(wr.row),
4601
- "rdt-row-pinned": wr.pinned
4602
- }).filter(([, v]) => v).map(([k]) => k).join(" ")}" role="row" data-row=${(0, _rozie_runtime_lit.rozieAttr)(wr.vi.index)} aria-rowindex=${(0, _rozie_runtime_lit.rozieAttr)(this.headerRowCount() + wr.vi.index + 1)} data-index=${(0, _rozie_runtime_lit.rozieAttr)(wr.vi.index)} data-pinned=${(0, _rozie_runtime_lit.rozieAttr)(wr.pinned ? "true" : null)} data-depth=${(0, _rozie_runtime_lit.rozieAttr)(wr.row.depth)} data-group-header=${(0, _rozie_runtime_lit.rozieAttr)(this.rowIsGrouped(wr.row) ? wr.row.id : null)} data-group-leaf=${(0, _rozie_runtime_lit.rozieAttr)(this.groupingActive() && !this.rowIsGrouped(wr.row) ? wr.row.id : null)} aria-expanded=${(0, _rozie_runtime_lit.rozieAttr)(this.rowIsGrouped(wr.row) ? !!this.rowIsExpanded(wr.row) : null)} aria-selected=${(0, _rozie_runtime_lit.rozieAttr)(this.selectionMode !== "none" ? !!this.rowIsSelected(wr.row) : null)} aria-level=${(0, _rozie_runtime_lit.rozieAttr)(this.groupingActive() ? wr.row.depth + 1 : null)} data-rozie-s-d5dcab4c>
5123
+ "rdt-row-pinned": wr.pinned,
5124
+ "rdt-placeholder-row": this.rowIsLazyPlaceholder(wr.row)
5125
+ }).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
5126
 
4604
5127
  ${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
5128
  "rdt-td": true,
4606
5129
  "rdt-select-td": this.isSelectColumn(cell.column.id),
4607
5130
  "rdt-expander-td": this.isExpanderColumn(cell.column.id),
5131
+ "rdt-pinned": this.columnPinSide(cell.column.id) !== "",
4608
5132
  "rdt-in-range": this.inRange(wr.vi.index, this.colIndexOf(wr.row, cell)),
4609
5133
  "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>
5134
+ }).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
5135
 
4612
- ${this.isExpanderColumn(cell.column.id) ? lit.html`<span style="display:contents" data-rozie-s-d5dcab4c>
5136
+
5137
+ ${this.rowIsLazyPlaceholder(wr.row) && this.isSelectColumn(cell.column.id) ? lit.html`<span style="display:contents" data-rozie-s-d5dcab4c>
5138
+
5139
+ <input class="rdt-select-placeholder" type="checkbox" disabled="" tabindex="-1" aria-hidden="true" style="visibility:hidden" data-rozie-s-d5dcab4c />
5140
+ </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>
5141
+ ${this.placeholder !== void 0 ? this.placeholder({
5142
+ index: wr.vi.index,
5143
+ columnId: cell.column.id
5144
+ }) : lit.html`<slot name="placeholder" data-rozie-params=${(() => {
5145
+ try {
5146
+ return JSON.stringify({
5147
+ index: wr.vi.index,
5148
+ columnId: cell.column.id
5149
+ });
5150
+ } catch {
5151
+ return "{}";
5152
+ }
5153
+ })()}>
5154
+ <span class="rdt-skeleton" aria-hidden="true" data-rozie-s-d5dcab4c>&#8203;</span>
5155
+ </slot>`}
5156
+ </span>` : this.isExpanderColumn(cell.column.id) ? lit.html`<span style="display:contents" data-rozie-s-d5dcab4c>
4613
5157
  ${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
5158
  this.onToggleExpand(wr.row, $event);
4615
5159
  }} 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 +5218,29 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
4674
5218
  </span>
4675
5219
  <span class="rdt-group-count" data-rozie-s-d5dcab4c>${(0, _rozie_runtime_lit.rozieDisplay)("(" + this.groupSubRowCount(wr.row) + ")")}</span>
4676
5220
  </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) => {
5221
+ ${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
5222
  this.onCellEditorInput(cell.column.id, $event);
4679
5223
  }} @keydown=${($event) => {
4680
5224
  this.onEditorKeyDown($event);
4681
5225
  }} @blur=${($event) => {
4682
5226
  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) => {
5227
+ }} 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
5228
  this.onCellEditorInput(cell.column.id, $event);
4685
5229
  }} @keydown=${($event) => {
4686
5230
  this.onEditorKeyDown($event);
4687
5231
  }} @blur=${($event) => {
4688
5232
  this.onEditorBlur($event);
4689
5233
  }} 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) => {
5234
+ ${(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>`)}
5235
+ </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
5236
  this.onCellEditorCheckbox(cell.column.id, $event);
4693
5237
  }} @keydown=${($event) => {
4694
5238
  this.onEditorKeyDown($event);
4695
5239
  }} @blur=${($event) => {
4696
5240
  this.onEditorBlur($event);
4697
- }} data-rozie-s-d5dcab4c />` : this.editorTypeOf(cell.column.id) === "custom" ? lit.html`<span style="display:contents" data-rozie-s-d5dcab4c>
5241
+ }} data-rozie-s-d5dcab4c />` : this.editorTypeOf(cell.column.id) === "custom" ? lit.html`<span style="display:contents" @keydown=${($event) => {
5242
+ this.onEditorDropinKeyDown($event);
5243
+ }} data-rozie-s-d5dcab4c>
4698
5244
  ${this.rozieSlots?.[`editor-${cell.column.id}`] !== void 0 ? this.rozieSlots?.[`editor-${cell.column.id}`]({
4699
5245
  columnId: cell.column.id,
4700
5246
  column: cell.column,
@@ -4702,6 +5248,7 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
4702
5248
  value: this.editorValueFor(cell.column.id),
4703
5249
  commit: this.editorCommitFor(cell.column.id),
4704
5250
  cancel: this.editorCancelFor(),
5251
+ columnLabel: this.headerLabel(cell.column.id),
4705
5252
  autofocus: this.editorAutofocusFor(cell.column.id, wr.vi.index)
4706
5253
  }) : lit.html`<slot name="${`editor-${cell.column.id}`}" data-rozie-params=${(() => {
4707
5254
  try {
@@ -4712,6 +5259,7 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
4712
5259
  value: this.editorValueFor(cell.column.id),
4713
5260
  commit: this.editorCommitFor(cell.column.id),
4714
5261
  cancel: this.editorCancelFor(),
5262
+ columnLabel: this.headerLabel(cell.column.id),
4715
5263
  autofocus: this.editorAutofocusFor(cell.column.id, wr.vi.index)
4716
5264
  });
4717
5265
  } catch {
@@ -4725,6 +5273,7 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
4725
5273
  value: this.editorValueFor(cell.column.id),
4726
5274
  commit: this.editorCommitFor(cell.column.id),
4727
5275
  cancel: this.editorCancelFor(),
5276
+ columnLabel: this.headerLabel(cell.column.id),
4728
5277
  autofocus: this.editorAutofocusFor(cell.column.id, wr.vi.index)
4729
5278
  }) : lit.html`<slot name="editor" data-rozie-params=${(() => {
4730
5279
  try {
@@ -4735,13 +5284,14 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
4735
5284
  value: this.editorValueFor(cell.column.id),
4736
5285
  commit: this.editorCommitFor(cell.column.id),
4737
5286
  cancel: this.editorCancelFor(),
5287
+ columnLabel: this.headerLabel(cell.column.id),
4738
5288
  autofocus: this.editorAutofocusFor(cell.column.id, wr.vi.index)
4739
5289
  });
4740
5290
  } catch {
4741
5291
  return "{}";
4742
5292
  }
4743
5293
  })()}>
4744
- <input class="rdt-cell-editor" type="text" data-editing-cell="" data-builtin-editor="" .value=${this.editorValueFor(cell.column.id)} @input=${($event) => {
5294
+ <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
5295
  this.onCellEditorInput(cell.column.id, $event);
4746
5296
  }} @keydown=${($event) => {
4747
5297
  this.onEditorKeyDown($event);
@@ -4750,7 +5300,7 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
4750
5300
  }} data-rozie-s-d5dcab4c />
4751
5301
  </slot>`}
4752
5302
  </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) => {
5303
+ </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
5304
  this.onCellEditorInput(cell.column.id, $event);
4755
5305
  }} @keydown=${($event) => {
4756
5306
  this.onEditorKeyDown($event);
@@ -4818,7 +5368,7 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
4818
5368
  </div>` : lit.html`<table class="${Object.entries({
4819
5369
  "rozie-data-table": true,
4820
5370
  "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) => {
5371
+ }).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
5372
  this.onGridKeyDown($event);
4823
5373
  }} @focusin=${($event) => {
4824
5374
  this.syncActiveFromEvent($event);
@@ -4837,9 +5387,10 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
4837
5387
  "rdt-th": true,
4838
5388
  "rdt-select-th": this.isSelectColumn(header.column.id),
4839
5389
  "rdt-expander-th": this.isExpanderColumn(header.column.id),
5390
+ "rdt-pinned": this.columnPinSide(header.column.id) !== "",
4840
5391
  "rdt-th-resizing": this.columnIsResizing(header.column.id),
4841
5392
  "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>
5393
+ }).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
5394
 
4844
5395
 
4845
5396
  ${this.isSelectColumn(header.column.id) ? lit.html`<span style="display:contents" data-rozie-s-d5dcab4c>
@@ -4960,7 +5511,10 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
4960
5511
  </tr>`)}
4961
5512
 
4962
5513
  ${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="rdt-filter-cell" role="presentation" style=${(0, _rozie_runtime_lit.rozieStyle)(this.pinStyle(header.column.id))} data-rozie-s-d5dcab4c>
5514
+ ${(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({
5515
+ "rdt-filter-cell": true,
5516
+ "rdt-pinned": this.columnPinSide(header.column.id) !== ""
5517
+ }).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
5518
  ${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
5519
  ${this.columnIsFilterable(header.column.id) ? lit.html`<span style="display:contents" data-rozie-s-d5dcab4c>
4966
5520
  ${this.rozieSlots?.[`filter-${header.column.id}`] !== void 0 ? this.rozieSlots?.[`filter-${header.column.id}`]({
@@ -4968,6 +5522,7 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
4968
5522
  value: this.columnFilterValue(header.column.id),
4969
5523
  uniqueValues: this.getFacetedUniqueValues(header.column.id),
4970
5524
  minMax: this.getFacetedMinMaxValues(header.column.id),
5525
+ columnLabel: this.headerLabel(header.column.id),
4971
5526
  setFilter: this.setColumnFilter
4972
5527
  }) : lit.html`<slot name="${`filter-${header.column.id}`}" data-rozie-params=${(() => {
4973
5528
  try {
@@ -4975,7 +5530,8 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
4975
5530
  columnId: header.column.id,
4976
5531
  value: this.columnFilterValue(header.column.id),
4977
5532
  uniqueValues: this.getFacetedUniqueValues(header.column.id),
4978
- minMax: this.getFacetedMinMaxValues(header.column.id)
5533
+ minMax: this.getFacetedMinMaxValues(header.column.id),
5534
+ columnLabel: this.headerLabel(header.column.id)
4979
5535
  });
4980
5536
  } catch {
4981
5537
  return "{}";
@@ -4986,6 +5542,7 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
4986
5542
  value: this.columnFilterValue(header.column.id),
4987
5543
  uniqueValues: this.getFacetedUniqueValues(header.column.id),
4988
5544
  minMax: this.getFacetedMinMaxValues(header.column.id),
5545
+ columnLabel: this.headerLabel(header.column.id),
4989
5546
  setFilter: this.setColumnFilter
4990
5547
  }) : lit.html`<slot name="filter" data-rozie-params=${(() => {
4991
5548
  try {
@@ -4993,7 +5550,8 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
4993
5550
  columnId: header.column.id,
4994
5551
  value: this.columnFilterValue(header.column.id),
4995
5552
  uniqueValues: this.getFacetedUniqueValues(header.column.id),
4996
- minMax: this.getFacetedMinMaxValues(header.column.id)
5553
+ minMax: this.getFacetedMinMaxValues(header.column.id),
5554
+ columnLabel: this.headerLabel(header.column.id)
4997
5555
  });
4998
5556
  } catch {
4999
5557
  return "{}";
@@ -5020,9 +5578,10 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
5020
5578
  "rdt-td": true,
5021
5579
  "rdt-select-td": this.isSelectColumn(cell.column.id),
5022
5580
  "rdt-expander-td": this.isExpanderColumn(cell.column.id),
5581
+ "rdt-pinned": this.columnPinSide(cell.column.id) !== "",
5023
5582
  "rdt-in-range": this.inRange(this.rowIndexOf(row), this.colIndexOf(row, cell)),
5024
5583
  "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>
5584
+ }).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
5585
 
5027
5586
  ${this.isExpanderColumn(cell.column.id) ? lit.html`<span style="display:contents" data-rozie-s-d5dcab4c>
5028
5587
  ${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 +5648,29 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
5089
5648
  </span>
5090
5649
  <span class="rdt-group-count" data-rozie-s-d5dcab4c>${(0, _rozie_runtime_lit.rozieDisplay)("(" + this.groupSubRowCount(row) + ")")}</span>
5091
5650
  </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) => {
5651
+ ${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
5652
  this.onCellEditorInput(cell.column.id, $event);
5094
5653
  }} @keydown=${($event) => {
5095
5654
  this.onEditorKeyDown($event);
5096
5655
  }} @blur=${($event) => {
5097
5656
  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) => {
5657
+ }} 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
5658
  this.onCellEditorInput(cell.column.id, $event);
5100
5659
  }} @keydown=${($event) => {
5101
5660
  this.onEditorKeyDown($event);
5102
5661
  }} @blur=${($event) => {
5103
5662
  this.onEditorBlur($event);
5104
5663
  }} 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) => {
5664
+ ${(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>`)}
5665
+ </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
5666
  this.onCellEditorCheckbox(cell.column.id, $event);
5108
5667
  }} @keydown=${($event) => {
5109
5668
  this.onEditorKeyDown($event);
5110
5669
  }} @blur=${($event) => {
5111
5670
  this.onEditorBlur($event);
5112
- }} data-rozie-s-d5dcab4c />` : this.editorTypeOf(cell.column.id) === "custom" ? lit.html`<span style="display:contents" data-rozie-s-d5dcab4c>
5671
+ }} data-rozie-s-d5dcab4c />` : this.editorTypeOf(cell.column.id) === "custom" ? lit.html`<span style="display:contents" @keydown=${($event) => {
5672
+ this.onEditorDropinKeyDown($event);
5673
+ }} data-rozie-s-d5dcab4c>
5113
5674
  ${this.rozieSlots?.[`editor-${cell.column.id}`] !== void 0 ? this.rozieSlots?.[`editor-${cell.column.id}`]({
5114
5675
  columnId: cell.column.id,
5115
5676
  column: cell.column,
@@ -5117,6 +5678,7 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
5117
5678
  value: this.editorValueFor(cell.column.id),
5118
5679
  commit: this.editorCommitFor(cell.column.id),
5119
5680
  cancel: this.editorCancelFor(),
5681
+ columnLabel: this.headerLabel(cell.column.id),
5120
5682
  autofocus: this.editorAutofocusFor(cell.column.id, this.rowIndexOf(row))
5121
5683
  }) : lit.html`<slot name="${`editor-${cell.column.id}`}" data-rozie-params=${(() => {
5122
5684
  try {
@@ -5127,6 +5689,7 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
5127
5689
  value: this.editorValueFor(cell.column.id),
5128
5690
  commit: this.editorCommitFor(cell.column.id),
5129
5691
  cancel: this.editorCancelFor(),
5692
+ columnLabel: this.headerLabel(cell.column.id),
5130
5693
  autofocus: this.editorAutofocusFor(cell.column.id, this.rowIndexOf(row))
5131
5694
  });
5132
5695
  } catch {
@@ -5140,6 +5703,7 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
5140
5703
  value: this.editorValueFor(cell.column.id),
5141
5704
  commit: this.editorCommitFor(cell.column.id),
5142
5705
  cancel: this.editorCancelFor(),
5706
+ columnLabel: this.headerLabel(cell.column.id),
5143
5707
  autofocus: this.editorAutofocusFor(cell.column.id, this.rowIndexOf(row))
5144
5708
  }) : lit.html`<slot name="editor" data-rozie-params=${(() => {
5145
5709
  try {
@@ -5150,13 +5714,14 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
5150
5714
  value: this.editorValueFor(cell.column.id),
5151
5715
  commit: this.editorCommitFor(cell.column.id),
5152
5716
  cancel: this.editorCancelFor(),
5717
+ columnLabel: this.headerLabel(cell.column.id),
5153
5718
  autofocus: this.editorAutofocusFor(cell.column.id, this.rowIndexOf(row))
5154
5719
  });
5155
5720
  } catch {
5156
5721
  return "{}";
5157
5722
  }
5158
5723
  })()}>
5159
- <input class="rdt-cell-editor" type="text" data-editing-cell="" data-builtin-editor="" .value=${this.editorValueFor(cell.column.id)} @input=${($event) => {
5724
+ <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
5725
  this.onCellEditorInput(cell.column.id, $event);
5161
5726
  }} @keydown=${($event) => {
5162
5727
  this.onEditorKeyDown($event);
@@ -5165,7 +5730,7 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
5165
5730
  }} data-rozie-s-d5dcab4c />
5166
5731
  </slot>`}
5167
5732
  </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) => {
5733
+ </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
5734
  this.onCellEditorInput(cell.column.id, $event);
5170
5735
  }} @keydown=${($event) => {
5171
5736
  this.onEditorKeyDown($event);
@@ -5237,10 +5802,10 @@ ${this.groupable ? lit.html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4
5237
5802
  <select class="rdt-page-size" aria-label="Rows per page" .value=${this.pageSize()} @change=${($event) => {
5238
5803
  this.onPageSizeChange($event);
5239
5804
  }} 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>
5805
+ <option value=${10} ?selected=${10 === this.pageSize()} data-rozie-s-d5dcab4c>10</option>
5806
+ <option value=${25} ?selected=${25 === this.pageSize()} data-rozie-s-d5dcab4c>25</option>
5807
+ <option value=${50} ?selected=${50 === this.pageSize()} data-rozie-s-d5dcab4c>50</option>
5808
+ <option value=${100} ?selected=${100 === this.pageSize()} data-rozie-s-d5dcab4c>100</option>
5244
5809
  </select>
5245
5810
  </div>` : lit.nothing}</div>
5246
5811
  `;
@@ -5363,6 +5928,7 @@ __decorate([(0, lit_decorators_js.property)({
5363
5928
  type: Object,
5364
5929
  attribute: "expanded"
5365
5930
  })], DataTable.prototype, "_expanded_attr", void 0);
5931
+ __decorate([(0, lit_decorators_js.property)({ type: Function })], DataTable.prototype, "getRowId", void 0);
5366
5932
  __decorate([(0, lit_decorators_js.property)({ type: Function })], DataTable.prototype, "getSubRows", void 0);
5367
5933
  __decorate([(0, lit_decorators_js.property)({
5368
5934
  type: Boolean,
@@ -5444,6 +6010,12 @@ __decorate([(0, lit_decorators_js.state)()], DataTable.prototype, "_hasSlotDynam
5444
6010
  __decorate([(0, lit_decorators_js.queryAssignedElements)({ flatten: true })], DataTable.prototype, "_slotDynamicColHeaderElements", void 0);
5445
6011
  __decorate([(0, lit_decorators_js.state)()], DataTable.prototype, "_hasSlotDynamicFilter", void 0);
5446
6012
  __decorate([(0, lit_decorators_js.queryAssignedElements)({ flatten: true })], DataTable.prototype, "_slotDynamicFilterElements", void 0);
6013
+ __decorate([(0, lit_decorators_js.state)()], DataTable.prototype, "_hasSlotPlaceholder", void 0);
6014
+ __decorate([(0, lit_decorators_js.queryAssignedElements)({
6015
+ slot: "placeholder",
6016
+ flatten: true
6017
+ })], DataTable.prototype, "_slotPlaceholderElements", void 0);
6018
+ __decorate([(0, lit_decorators_js.property)({ attribute: false })], DataTable.prototype, "placeholder", void 0);
5447
6019
  __decorate([(0, lit_decorators_js.state)()], DataTable.prototype, "_hasSlotSelectCell", void 0);
5448
6020
  __decorate([(0, lit_decorators_js.queryAssignedElements)({
5449
6021
  slot: "selectCell",
@@ -5641,15 +6213,19 @@ let EditorText = class EditorText extends (0, _lit_labs_preact_signals.SignalWat
5641
6213
  this.commit = null;
5642
6214
  this.cancel = null;
5643
6215
  this.autofocus = false;
6216
+ this.columnLabel = "";
5644
6217
  this._draft = (0, _lit_labs_preact_signals.signal)("");
6218
+ this._touched = (0, _lit_labs_preact_signals.signal)(false);
5645
6219
  this.__rozieFirstUpdateDone = false;
5646
6220
  this._disconnectCleanups = [];
5647
6221
  this._rozieTornDown = false;
6222
+ this.draftValue = () => this._touched.value ? this._draft.value : this.value != null ? String(this.value) : "";
5648
6223
  this.onInput = (e) => {
5649
6224
  this._draft.value = e && e.target ? e.target.value : "";
6225
+ this._touched.value = true;
5650
6226
  };
5651
6227
  this.doCommit = () => {
5652
- this.commit && this.commit(this._draft.value);
6228
+ this.commit && this.commit(this.draftValue());
5653
6229
  };
5654
6230
  this.doCancel = () => {
5655
6231
  this.cancel && this.cancel();
@@ -5666,6 +6242,10 @@ let EditorText = class EditorText extends (0, _lit_labs_preact_signals.SignalWat
5666
6242
  this.onBlur = () => {
5667
6243
  this.doCommit();
5668
6244
  };
6245
+ this.a11yLabel = () => {
6246
+ if (typeof this.columnLabel === "string" && this.columnLabel !== "") return this.columnLabel;
6247
+ return this.columnId;
6248
+ };
5669
6249
  }
5670
6250
  static {
5671
6251
  this.styles = lit.css`
@@ -5673,7 +6253,6 @@ let EditorText = class EditorText extends (0, _lit_labs_preact_signals.SignalWat
5673
6253
  `;
5674
6254
  }
5675
6255
  firstUpdated() {
5676
- this._draft.value = this.value != null ? String(this.value) : "";
5677
6256
  if (this.autofocus) this._refInputEl?.focus();
5678
6257
  }
5679
6258
  updated(changedProperties) {
@@ -5693,7 +6272,7 @@ let EditorText = class EditorText extends (0, _lit_labs_preact_signals.SignalWat
5693
6272
  }
5694
6273
  render() {
5695
6274
  return lit.html`
5696
- <input class="rdt-cell-editor" type="text" data-editing-cell="" aria-label=${this.columnId} .value=${this._draft.value} @input=${($event) => {
6275
+ <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
6276
  this.onInput($event);
5698
6277
  }} @keydown=${($event) => {
5699
6278
  this.onKeydown($event);
@@ -5716,6 +6295,10 @@ __decorate([(0, lit_decorators_js.property)({
5716
6295
  type: Boolean,
5717
6296
  reflect: true
5718
6297
  })], EditorText.prototype, "autofocus", void 0);
6298
+ __decorate([(0, lit_decorators_js.property)({
6299
+ type: String,
6300
+ reflect: true
6301
+ })], EditorText.prototype, "columnLabel", void 0);
5719
6302
  __decorate([(0, lit_decorators_js.query)("[data-rozie-ref=\"inputEl\"]")], EditorText.prototype, "_refInputEl", void 0);
5720
6303
  EditorText = __decorate([(0, lit_decorators_js.customElement)("rozie-editor-text")], EditorText);
5721
6304
  var EditorText_default = EditorText;
@@ -5730,15 +6313,21 @@ let EditorNumber = class EditorNumber extends (0, _lit_labs_preact_signals.Signa
5730
6313
  this.value = null;
5731
6314
  this.commit = null;
5732
6315
  this.cancel = null;
6316
+ this.autofocus = false;
6317
+ this.columnLabel = "";
5733
6318
  this._draft = (0, _lit_labs_preact_signals.signal)("");
6319
+ this._touched = (0, _lit_labs_preact_signals.signal)(false);
6320
+ this.__rozieFirstUpdateDone = false;
5734
6321
  this._disconnectCleanups = [];
5735
6322
  this._rozieTornDown = false;
6323
+ this.draftValue = () => this._touched.value ? this._draft.value : this.value != null ? String(this.value) : "";
5736
6324
  this.onInput = (e) => {
5737
6325
  this._draft.value = e && e.target ? e.target.value : "";
6326
+ this._touched.value = true;
5738
6327
  };
5739
6328
  this.doCommit = () => {
5740
6329
  if (!this.commit) return;
5741
- const raw = this._draft.value;
6330
+ const raw = this.draftValue();
5742
6331
  if (raw == null || String(raw).trim() === "") {
5743
6332
  this.commit(null);
5744
6333
  return;
@@ -5761,6 +6350,10 @@ let EditorNumber = class EditorNumber extends (0, _lit_labs_preact_signals.Signa
5761
6350
  this.onBlur = () => {
5762
6351
  this.doCommit();
5763
6352
  };
6353
+ this.a11yLabel = () => {
6354
+ if (typeof this.columnLabel === "string" && this.columnLabel !== "") return this.columnLabel;
6355
+ return this.columnId;
6356
+ };
5764
6357
  }
5765
6358
  static {
5766
6359
  this.styles = lit.css`
@@ -5768,7 +6361,13 @@ let EditorNumber = class EditorNumber extends (0, _lit_labs_preact_signals.Signa
5768
6361
  `;
5769
6362
  }
5770
6363
  firstUpdated() {
5771
- this._draft.value = this.value != null ? String(this.value) : "";
6364
+ if (this.autofocus) this._refInputEl?.focus();
6365
+ }
6366
+ updated(changedProperties) {
6367
+ if (this.__rozieFirstUpdateDone && changedProperties.has("autofocus")) ((v) => {
6368
+ if (v) this._refInputEl?.focus();
6369
+ })(this.autofocus);
6370
+ this.__rozieFirstUpdateDone = true;
5772
6371
  }
5773
6372
  disconnectedCallback() {
5774
6373
  super.disconnectedCallback();
@@ -5781,13 +6380,13 @@ let EditorNumber = class EditorNumber extends (0, _lit_labs_preact_signals.Signa
5781
6380
  }
5782
6381
  render() {
5783
6382
  return lit.html`
5784
- <input class="rdt-cell-editor" type="number" data-editing-cell="" aria-label=${this.columnId} .value=${this._draft.value} @input=${($event) => {
6383
+ <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
6384
  this.onInput($event);
5786
6385
  }} @keydown=${($event) => {
5787
6386
  this.onKeydown($event);
5788
6387
  }} @blur=${($event) => {
5789
6388
  this.onBlur();
5790
- }} data-rozie-s-b2792b32 />
6389
+ }} data-rozie-ref="inputEl" data-rozie-s-b2792b32 />
5791
6390
  `;
5792
6391
  }
5793
6392
  };
@@ -5800,6 +6399,15 @@ __decorate([(0, lit_decorators_js.property)({ type: Object })], EditorNumber.pro
5800
6399
  __decorate([(0, lit_decorators_js.property)({ type: Object })], EditorNumber.prototype, "value", void 0);
5801
6400
  __decorate([(0, lit_decorators_js.property)({ type: Function })], EditorNumber.prototype, "commit", void 0);
5802
6401
  __decorate([(0, lit_decorators_js.property)({ type: Function })], EditorNumber.prototype, "cancel", void 0);
6402
+ __decorate([(0, lit_decorators_js.property)({
6403
+ type: Boolean,
6404
+ reflect: true
6405
+ })], EditorNumber.prototype, "autofocus", void 0);
6406
+ __decorate([(0, lit_decorators_js.property)({
6407
+ type: String,
6408
+ reflect: true
6409
+ })], EditorNumber.prototype, "columnLabel", void 0);
6410
+ __decorate([(0, lit_decorators_js.query)("[data-rozie-ref=\"inputEl\"]")], EditorNumber.prototype, "_refInputEl", void 0);
5803
6411
  EditorNumber = __decorate([(0, lit_decorators_js.customElement)("rozie-editor-number")], EditorNumber);
5804
6412
  var EditorNumber_default = EditorNumber;
5805
6413
  //#endregion
@@ -5814,14 +6422,20 @@ let EditorSelect = class EditorSelect extends (0, _lit_labs_preact_signals.Signa
5814
6422
  this.commit = null;
5815
6423
  this.cancel = null;
5816
6424
  this.options = [];
6425
+ this.autofocus = false;
6426
+ this.columnLabel = "";
5817
6427
  this._draft = (0, _lit_labs_preact_signals.signal)("");
6428
+ this._touched = (0, _lit_labs_preact_signals.signal)(false);
6429
+ this.__rozieFirstUpdateDone = false;
5818
6430
  this._disconnectCleanups = [];
5819
6431
  this._rozieTornDown = false;
6432
+ this.draftValue = () => this._touched.value ? this._draft.value : this.value != null ? String(this.value) : "";
5820
6433
  this.onChange = (e) => {
5821
6434
  this._draft.value = e && e.target ? e.target.value : "";
6435
+ this._touched.value = true;
5822
6436
  };
5823
6437
  this.doCommit = () => {
5824
- this.commit && this.commit(this._draft.value);
6438
+ this.commit && this.commit(this.draftValue());
5825
6439
  };
5826
6440
  this.doCancel = () => {
5827
6441
  this.cancel && this.cancel();
@@ -5838,6 +6452,10 @@ let EditorSelect = class EditorSelect extends (0, _lit_labs_preact_signals.Signa
5838
6452
  this.onBlur = () => {
5839
6453
  this.doCommit();
5840
6454
  };
6455
+ this.a11yLabel = () => {
6456
+ if (typeof this.columnLabel === "string" && this.columnLabel !== "") return this.columnLabel;
6457
+ return this.columnId;
6458
+ };
5841
6459
  }
5842
6460
  static {
5843
6461
  this.styles = lit.css`
@@ -5845,7 +6463,13 @@ let EditorSelect = class EditorSelect extends (0, _lit_labs_preact_signals.Signa
5845
6463
  `;
5846
6464
  }
5847
6465
  firstUpdated() {
5848
- this._draft.value = this.value != null ? String(this.value) : "";
6466
+ if (this.autofocus) this._refSelectEl?.focus();
6467
+ }
6468
+ updated(changedProperties) {
6469
+ if (this.__rozieFirstUpdateDone && changedProperties.has("autofocus")) ((v) => {
6470
+ if (v) this._refSelectEl?.focus();
6471
+ })(this.autofocus);
6472
+ this.__rozieFirstUpdateDone = true;
5849
6473
  }
5850
6474
  disconnectedCallback() {
5851
6475
  super.disconnectedCallback();
@@ -5858,14 +6482,14 @@ let EditorSelect = class EditorSelect extends (0, _lit_labs_preact_signals.Signa
5858
6482
  }
5859
6483
  render() {
5860
6484
  return lit.html`
5861
- <select class="rdt-cell-editor" data-editing-cell="" aria-label=${this.columnId} .value=${this._draft.value} @change=${($event) => {
6485
+ <select class="rdt-cell-editor" data-editing-cell="" aria-label=${(0, _rozie_runtime_lit.rozieAttr)(this.a11yLabel())} .value=${this.draftValue()} @change=${($event) => {
5862
6486
  this.onChange($event);
5863
6487
  }} @keydown=${($event) => {
5864
6488
  this.onKeydown($event);
5865
6489
  }} @blur=${($event) => {
5866
6490
  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>`)}
6491
+ }} data-rozie-ref="selectEl" data-rozie-s-117f1a16>
6492
+ ${(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
6493
  </select>
5870
6494
  `;
5871
6495
  }
@@ -5880,6 +6504,15 @@ __decorate([(0, lit_decorators_js.property)({ type: Object })], EditorSelect.pro
5880
6504
  __decorate([(0, lit_decorators_js.property)({ type: Function })], EditorSelect.prototype, "commit", void 0);
5881
6505
  __decorate([(0, lit_decorators_js.property)({ type: Function })], EditorSelect.prototype, "cancel", void 0);
5882
6506
  __decorate([(0, lit_decorators_js.property)({ type: Array })], EditorSelect.prototype, "options", void 0);
6507
+ __decorate([(0, lit_decorators_js.property)({
6508
+ type: Boolean,
6509
+ reflect: true
6510
+ })], EditorSelect.prototype, "autofocus", void 0);
6511
+ __decorate([(0, lit_decorators_js.property)({
6512
+ type: String,
6513
+ reflect: true
6514
+ })], EditorSelect.prototype, "columnLabel", void 0);
6515
+ __decorate([(0, lit_decorators_js.query)("[data-rozie-ref=\"selectEl\"]")], EditorSelect.prototype, "_refSelectEl", void 0);
5883
6516
  EditorSelect = __decorate([(0, lit_decorators_js.customElement)("rozie-editor-select")], EditorSelect);
5884
6517
  var EditorSelect_default = EditorSelect;
5885
6518
  //#endregion
@@ -5893,6 +6526,9 @@ let EditorCheckbox = class EditorCheckbox extends (0, _lit_labs_preact_signals.S
5893
6526
  this.value = null;
5894
6527
  this.commit = null;
5895
6528
  this.cancel = null;
6529
+ this.autofocus = false;
6530
+ this.columnLabel = "";
6531
+ this.__rozieFirstUpdateDone = false;
5896
6532
  this._disconnectCleanups = [];
5897
6533
  this._rozieTornDown = false;
5898
6534
  this.onChange = (e) => {
@@ -5904,12 +6540,25 @@ let EditorCheckbox = class EditorCheckbox extends (0, _lit_labs_preact_signals.S
5904
6540
  this.cancel && this.cancel();
5905
6541
  }
5906
6542
  };
6543
+ this.a11yLabel = () => {
6544
+ if (typeof this.columnLabel === "string" && this.columnLabel !== "") return this.columnLabel;
6545
+ return this.columnId;
6546
+ };
5907
6547
  }
5908
6548
  static {
5909
6549
  this.styles = lit.css`
5910
6550
  :host{display:contents}
5911
6551
  `;
5912
6552
  }
6553
+ firstUpdated() {
6554
+ if (this.autofocus) this._refInputEl?.focus();
6555
+ }
6556
+ updated(changedProperties) {
6557
+ if (this.__rozieFirstUpdateDone && changedProperties.has("autofocus")) ((v) => {
6558
+ if (v) this._refInputEl?.focus();
6559
+ })(this.autofocus);
6560
+ this.__rozieFirstUpdateDone = true;
6561
+ }
5913
6562
  disconnectedCallback() {
5914
6563
  super.disconnectedCallback();
5915
6564
  queueMicrotask(() => {
@@ -5921,11 +6570,11 @@ let EditorCheckbox = class EditorCheckbox extends (0, _lit_labs_preact_signals.S
5921
6570
  }
5922
6571
  render() {
5923
6572
  return lit.html`
5924
- <input class="rdt-cell-editor" type="checkbox" data-editing-cell="" aria-label=${this.columnId} ?checked=${!!this.value} @change=${($event) => {
6573
+ <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
6574
  this.onChange($event);
5926
6575
  }} @keydown=${($event) => {
5927
6576
  this.onKeydown($event);
5928
- }} data-rozie-s-3d792482 />
6577
+ }} data-rozie-ref="inputEl" data-rozie-s-3d792482 />
5929
6578
  `;
5930
6579
  }
5931
6580
  };
@@ -5938,9 +6587,51 @@ __decorate([(0, lit_decorators_js.property)({ type: Object })], EditorCheckbox.p
5938
6587
  __decorate([(0, lit_decorators_js.property)({ type: Object })], EditorCheckbox.prototype, "value", void 0);
5939
6588
  __decorate([(0, lit_decorators_js.property)({ type: Function })], EditorCheckbox.prototype, "commit", void 0);
5940
6589
  __decorate([(0, lit_decorators_js.property)({ type: Function })], EditorCheckbox.prototype, "cancel", void 0);
6590
+ __decorate([(0, lit_decorators_js.property)({
6591
+ type: Boolean,
6592
+ reflect: true
6593
+ })], EditorCheckbox.prototype, "autofocus", void 0);
6594
+ __decorate([(0, lit_decorators_js.property)({
6595
+ type: String,
6596
+ reflect: true
6597
+ })], EditorCheckbox.prototype, "columnLabel", void 0);
6598
+ __decorate([(0, lit_decorators_js.query)("[data-rozie-ref=\"inputEl\"]")], EditorCheckbox.prototype, "_refInputEl", void 0);
5941
6599
  EditorCheckbox = __decorate([(0, lit_decorators_js.customElement)("rozie-editor-checkbox")], EditorCheckbox);
5942
6600
  var EditorCheckbox_default = EditorCheckbox;
5943
6601
  //#endregion
6602
+ //#region src/helpers/dateValue.ts
6603
+ /**
6604
+ * Coerce an arbitrary cell value to the `YYYY-MM-DD` string a native date input accepts.
6605
+ * Returns `''` for anything that cannot be read as a date — which is what the input shows for
6606
+ * "no date", so an unparseable value degrades to empty rather than to a broken control.
6607
+ */
6608
+ const toIsoDateString = (v) => {
6609
+ if (v == null || v === "") return "";
6610
+ if (typeof v === "string") {
6611
+ const s = v.trim();
6612
+ if (/^\d{4}-\d{2}-\d{2}$/.test(s)) return s;
6613
+ const iso = /^(\d{4}-\d{2}-\d{2})T/.exec(s);
6614
+ if (iso) return iso[1];
6615
+ return fromDate(new Date(s));
6616
+ }
6617
+ if (typeof v === "number") return Number.isFinite(v) ? fromDate(new Date(v)) : "";
6618
+ if (typeof v === "object" && typeof v.getTime === "function") return fromDate(v);
6619
+ return "";
6620
+ };
6621
+ /**
6622
+ * Format a Date as `YYYY-MM-DD` from its LOCAL parts. Local, not UTC: the input renders a
6623
+ * calendar day, and `toISOString()` would show the previous day for anyone west of UTC on a
6624
+ * midnight-local value.
6625
+ */
6626
+ const fromDate = (d) => {
6627
+ const t = d.getTime();
6628
+ if (!Number.isFinite(t)) return "";
6629
+ const y = d.getFullYear();
6630
+ const m = d.getMonth() + 1;
6631
+ const day = d.getDate();
6632
+ return String(y).padStart(4, "0") + "-" + String(m).padStart(2, "0") + "-" + String(day).padStart(2, "0");
6633
+ };
6634
+ //#endregion
5944
6635
  //#region src/EditorDate.ts
5945
6636
  let EditorDate = class EditorDate extends (0, _lit_labs_preact_signals.SignalWatcher)(lit.LitElement) {
5946
6637
  constructor(..._args) {
@@ -5951,20 +6642,27 @@ let EditorDate = class EditorDate extends (0, _lit_labs_preact_signals.SignalWat
5951
6642
  this.value = null;
5952
6643
  this.commit = null;
5953
6644
  this.cancel = null;
6645
+ this.autofocus = false;
6646
+ this.columnLabel = "";
5954
6647
  this._draft = (0, _lit_labs_preact_signals.signal)("");
6648
+ this._touched = (0, _lit_labs_preact_signals.signal)(false);
6649
+ this.__rozieFirstUpdateDone = false;
5955
6650
  this._disconnectCleanups = [];
5956
6651
  this._rozieTornDown = false;
6652
+ this.draftValue = () => this._touched.value ? this._draft.value : toIsoDateString(this.value);
5957
6653
  this.onInput = (e) => {
5958
6654
  this._draft.value = e && e.target ? e.target.value : "";
6655
+ this._touched.value = true;
5959
6656
  };
5960
6657
  this.doCommit = () => {
5961
- this.commit && this.commit(this._draft.value);
6658
+ this.commit && this.commit(this.draftValue());
5962
6659
  };
5963
6660
  this.doCancel = () => {
5964
6661
  this.cancel && this.cancel();
5965
6662
  };
5966
6663
  this.onChange = (e) => {
5967
6664
  this._draft.value = e && e.target ? e.target.value : "";
6665
+ this._touched.value = true;
5968
6666
  };
5969
6667
  this.onKeydown = (e) => {
5970
6668
  if (e && e.key === "Enter") {
@@ -5978,6 +6676,10 @@ let EditorDate = class EditorDate extends (0, _lit_labs_preact_signals.SignalWat
5978
6676
  this.onBlur = () => {
5979
6677
  this.doCommit();
5980
6678
  };
6679
+ this.a11yLabel = () => {
6680
+ if (typeof this.columnLabel === "string" && this.columnLabel !== "") return this.columnLabel;
6681
+ return this.columnId;
6682
+ };
5981
6683
  }
5982
6684
  static {
5983
6685
  this.styles = lit.css`
@@ -5985,7 +6687,13 @@ let EditorDate = class EditorDate extends (0, _lit_labs_preact_signals.SignalWat
5985
6687
  `;
5986
6688
  }
5987
6689
  firstUpdated() {
5988
- this._draft.value = this.value != null ? String(this.value) : "";
6690
+ if (this.autofocus) this._refInputEl?.focus();
6691
+ }
6692
+ updated(changedProperties) {
6693
+ if (this.__rozieFirstUpdateDone && changedProperties.has("autofocus")) ((v) => {
6694
+ if (v) this._refInputEl?.focus();
6695
+ })(this.autofocus);
6696
+ this.__rozieFirstUpdateDone = true;
5989
6697
  }
5990
6698
  disconnectedCallback() {
5991
6699
  super.disconnectedCallback();
@@ -5998,7 +6706,7 @@ let EditorDate = class EditorDate extends (0, _lit_labs_preact_signals.SignalWat
5998
6706
  }
5999
6707
  render() {
6000
6708
  return lit.html`
6001
- <input class="rdt-cell-editor" type="date" data-editing-cell="" aria-label=${this.columnId} .value=${this._draft.value} @input=${($event) => {
6709
+ <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
6710
  this.onInput($event);
6003
6711
  }} @change=${($event) => {
6004
6712
  this.onChange($event);
@@ -6006,7 +6714,7 @@ let EditorDate = class EditorDate extends (0, _lit_labs_preact_signals.SignalWat
6006
6714
  this.onKeydown($event);
6007
6715
  }} @blur=${($event) => {
6008
6716
  this.onBlur();
6009
- }} data-rozie-s-7abe1a56 />
6717
+ }} data-rozie-ref="inputEl" data-rozie-s-7abe1a56 />
6010
6718
  `;
6011
6719
  }
6012
6720
  };
@@ -6019,6 +6727,15 @@ __decorate([(0, lit_decorators_js.property)({ type: Object })], EditorDate.proto
6019
6727
  __decorate([(0, lit_decorators_js.property)({ type: Object })], EditorDate.prototype, "value", void 0);
6020
6728
  __decorate([(0, lit_decorators_js.property)({ type: Function })], EditorDate.prototype, "commit", void 0);
6021
6729
  __decorate([(0, lit_decorators_js.property)({ type: Function })], EditorDate.prototype, "cancel", void 0);
6730
+ __decorate([(0, lit_decorators_js.property)({
6731
+ type: Boolean,
6732
+ reflect: true
6733
+ })], EditorDate.prototype, "autofocus", void 0);
6734
+ __decorate([(0, lit_decorators_js.property)({
6735
+ type: String,
6736
+ reflect: true
6737
+ })], EditorDate.prototype, "columnLabel", void 0);
6738
+ __decorate([(0, lit_decorators_js.query)("[data-rozie-ref=\"inputEl\"]")], EditorDate.prototype, "_refInputEl", void 0);
6022
6739
  EditorDate = __decorate([(0, lit_decorators_js.customElement)("rozie-editor-date")], EditorDate);
6023
6740
  var EditorDate_default = EditorDate;
6024
6741
  //#endregion
@@ -6030,17 +6747,23 @@ let FilterText = class FilterText extends (0, _lit_labs_preact_signals.SignalWat
6030
6747
  this.column = null;
6031
6748
  this.value = null;
6032
6749
  this.setFilter = null;
6750
+ this.columnLabel = "";
6033
6751
  this._draft = (0, _lit_labs_preact_signals.signal)("");
6752
+ this._touched = (0, _lit_labs_preact_signals.signal)(false);
6753
+ this.__rozieFirstUpdateDone = false;
6034
6754
  this._disconnectCleanups = [];
6035
6755
  this._rozieTornDown = false;
6756
+ this.draftValue = () => this._touched.value ? this._draft.value : this.value != null ? String(this.value) : "";
6036
6757
  this.onInput = (e) => {
6037
6758
  this._draft.value = e && e.target ? e.target.value : "";
6759
+ this._touched.value = true;
6038
6760
  };
6039
6761
  this.applyFilter = () => {
6040
- this.setFilter && this.setFilter(this.columnId, this._draft.value);
6762
+ this.setFilter && this.setFilter(this.columnId, this.draftValue());
6041
6763
  };
6042
6764
  this.clearFilter = () => {
6043
6765
  this._draft.value = "";
6766
+ this._touched.value = false;
6044
6767
  this.setFilter && this.setFilter(this.columnId, "");
6045
6768
  };
6046
6769
  this.onKeydown = (e) => {
@@ -6055,14 +6778,22 @@ let FilterText = class FilterText extends (0, _lit_labs_preact_signals.SignalWat
6055
6778
  this.onBlur = () => {
6056
6779
  this.applyFilter();
6057
6780
  };
6781
+ this.a11yLabel = () => {
6782
+ if (typeof this.columnLabel === "string" && this.columnLabel !== "") return this.columnLabel;
6783
+ return this.columnId;
6784
+ };
6058
6785
  }
6059
6786
  static {
6060
6787
  this.styles = lit.css`
6061
6788
  :host{display:contents}
6062
6789
  `;
6063
6790
  }
6064
- firstUpdated() {
6065
- this._draft.value = this.value != null ? String(this.value) : "";
6791
+ updated(changedProperties) {
6792
+ if (this.__rozieFirstUpdateDone && changedProperties.has("value")) {
6793
+ this.value;
6794
+ this._touched.value = false;
6795
+ }
6796
+ this.__rozieFirstUpdateDone = true;
6066
6797
  }
6067
6798
  disconnectedCallback() {
6068
6799
  super.disconnectedCallback();
@@ -6075,7 +6806,7 @@ let FilterText = class FilterText extends (0, _lit_labs_preact_signals.SignalWat
6075
6806
  }
6076
6807
  render() {
6077
6808
  return lit.html`
6078
- <input class="rdt-col-filter" part="col-filter" type="text" aria-label=${this.columnId} .value=${this._draft.value} @input=${($event) => {
6809
+ <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
6810
  this.onInput($event);
6080
6811
  }} @keydown=${($event) => {
6081
6812
  this.onKeydown($event);
@@ -6092,6 +6823,10 @@ __decorate([(0, lit_decorators_js.property)({
6092
6823
  __decorate([(0, lit_decorators_js.property)({ type: Object })], FilterText.prototype, "column", void 0);
6093
6824
  __decorate([(0, lit_decorators_js.property)({ type: Object })], FilterText.prototype, "value", void 0);
6094
6825
  __decorate([(0, lit_decorators_js.property)({ type: Function })], FilterText.prototype, "setFilter", void 0);
6826
+ __decorate([(0, lit_decorators_js.property)({
6827
+ type: String,
6828
+ reflect: true
6829
+ })], FilterText.prototype, "columnLabel", void 0);
6095
6830
  FilterText = __decorate([(0, lit_decorators_js.customElement)("rozie-filter-text")], FilterText);
6096
6831
  var FilterText_default = FilterText;
6097
6832
  //#endregion
@@ -6104,24 +6839,41 @@ let FilterNumberRange = class FilterNumberRange extends (0, _lit_labs_preact_sig
6104
6839
  this.value = null;
6105
6840
  this.setFilter = null;
6106
6841
  this.minMax = null;
6842
+ this.columnLabel = "";
6107
6843
  this._minDraft = (0, _lit_labs_preact_signals.signal)("");
6108
6844
  this._maxDraft = (0, _lit_labs_preact_signals.signal)("");
6845
+ this._touched = (0, _lit_labs_preact_signals.signal)(false);
6846
+ this.__rozieWatchInitial_0 = true;
6109
6847
  this._disconnectCleanups = [];
6110
6848
  this._rozieTornDown = false;
6849
+ this.minDraftValue = () => this._touched.value ? this._minDraft.value : Array.isArray(this.value) && this.value[0] != null ? String(this.value[0]) : "";
6850
+ this.maxDraftValue = () => this._touched.value ? this._maxDraft.value : Array.isArray(this.value) && this.value[1] != null ? String(this.value[1]) : "";
6111
6851
  this.onMinInput = (e) => {
6112
6852
  this._minDraft.value = e && e.target ? e.target.value : "";
6853
+ this._touched.value = true;
6113
6854
  };
6114
6855
  this.onMaxInput = (e) => {
6115
6856
  this._maxDraft.value = e && e.target ? e.target.value : "";
6857
+ this._touched.value = true;
6858
+ };
6859
+ this.onKeydown = (e) => {
6860
+ if (e && e.key === "Enter") this.applyRange(this.minDraftValue(), this.maxDraftValue());
6861
+ };
6862
+ this.onBlur = () => {
6863
+ this.applyRange(this.minDraftValue(), this.maxDraftValue());
6116
6864
  };
6117
6865
  this.minPlaceholder = () => Array.isArray(this.minMax) && this.minMax[0] != null ? String(this.minMax[0]) : "";
6118
6866
  this.maxPlaceholder = () => Array.isArray(this.minMax) && this.minMax[1] != null ? String(this.minMax[1]) : "";
6119
- this.applyRange = () => {
6120
- const minNum = this._minDraft.value === "" ? void 0 : Number(this._minDraft.value);
6121
- const maxNum = this._maxDraft.value === "" ? void 0 : Number(this._maxDraft.value);
6867
+ this.applyRange = (minDraft, maxDraft) => {
6868
+ const minNum = minDraft === "" ? void 0 : Number(minDraft);
6869
+ const maxNum = maxDraft === "" ? void 0 : Number(maxDraft);
6122
6870
  if (minNum === void 0 && maxNum === void 0) this.setFilter && this.setFilter(this.columnId, "");
6123
6871
  else this.setFilter && this.setFilter(this.columnId, [minNum, maxNum]);
6124
6872
  };
6873
+ this.a11yLabel = () => {
6874
+ if (typeof this.columnLabel === "string" && this.columnLabel !== "") return this.columnLabel;
6875
+ return this.columnId;
6876
+ };
6125
6877
  }
6126
6878
  static {
6127
6879
  this.styles = lit.css`
@@ -6129,8 +6881,16 @@ let FilterNumberRange = class FilterNumberRange extends (0, _lit_labs_preact_sig
6129
6881
  `;
6130
6882
  }
6131
6883
  firstUpdated() {
6132
- this._minDraft.value = Array.isArray(this.value) && this.value[0] != null ? String(this.value[0]) : "";
6133
- this._maxDraft.value = Array.isArray(this.value) && this.value[1] != null ? String(this.value[1]) : "";
6884
+ this._disconnectCleanups.push((0, _lit_labs_preact_signals.effect)(() => {
6885
+ Array.isArray(this.value) && String(this.value[0]) + "" + String(this.value[1]);
6886
+ (0, _lit_labs_preact_signals.untracked)(() => {
6887
+ if (this.__rozieWatchInitial_0) {
6888
+ this.__rozieWatchInitial_0 = false;
6889
+ return;
6890
+ }
6891
+ this._touched.value = false;
6892
+ });
6893
+ }));
6134
6894
  }
6135
6895
  disconnectedCallback() {
6136
6896
  super.disconnectedCallback();
@@ -6144,16 +6904,20 @@ let FilterNumberRange = class FilterNumberRange extends (0, _lit_labs_preact_sig
6144
6904
  render() {
6145
6905
  return lit.html`
6146
6906
  <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.columnId + " min")} placeholder=${(0, _rozie_runtime_lit.rozieAttr)(this.minPlaceholder())} .value=${this._minDraft.value} @input=${($event) => {
6907
+ <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
6908
  this.onMinInput($event);
6149
- }} @change=${($event) => {
6150
- this.applyRange();
6909
+ }} @keydown=${($event) => {
6910
+ this.onKeydown($event);
6911
+ }} @blur=${($event) => {
6912
+ this.onBlur();
6151
6913
  }} data-rozie-s-97b2c090 />
6152
6914
  <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.columnId + " max")} placeholder=${(0, _rozie_runtime_lit.rozieAttr)(this.maxPlaceholder())} .value=${this._maxDraft.value} @input=${($event) => {
6915
+ <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
6916
  this.onMaxInput($event);
6155
- }} @change=${($event) => {
6156
- this.applyRange();
6917
+ }} @keydown=${($event) => {
6918
+ this.onKeydown($event);
6919
+ }} @blur=${($event) => {
6920
+ this.onBlur();
6157
6921
  }} data-rozie-s-97b2c090 />
6158
6922
  </span>
6159
6923
  `;
@@ -6167,6 +6931,10 @@ __decorate([(0, lit_decorators_js.property)({ type: Object })], FilterNumberRang
6167
6931
  __decorate([(0, lit_decorators_js.property)({ type: Object })], FilterNumberRange.prototype, "value", void 0);
6168
6932
  __decorate([(0, lit_decorators_js.property)({ type: Function })], FilterNumberRange.prototype, "setFilter", void 0);
6169
6933
  __decorate([(0, lit_decorators_js.property)({ type: Object })], FilterNumberRange.prototype, "minMax", void 0);
6934
+ __decorate([(0, lit_decorators_js.property)({
6935
+ type: String,
6936
+ reflect: true
6937
+ })], FilterNumberRange.prototype, "columnLabel", void 0);
6170
6938
  FilterNumberRange = __decorate([(0, lit_decorators_js.customElement)("rozie-filter-number-range")], FilterNumberRange);
6171
6939
  var FilterNumberRange_default = FilterNumberRange;
6172
6940
  //#endregion
@@ -6179,6 +6947,7 @@ let FilterSelect = class FilterSelect extends (0, _lit_labs_preact_signals.Signa
6179
6947
  this.value = null;
6180
6948
  this.setFilter = null;
6181
6949
  this.uniqueValues = [];
6950
+ this.columnLabel = "";
6182
6951
  this._disconnectCleanups = [];
6183
6952
  this._rozieTornDown = false;
6184
6953
  this.selectValue = () => this.value != null ? String(this.value) : "";
@@ -6187,6 +6956,10 @@ let FilterSelect = class FilterSelect extends (0, _lit_labs_preact_signals.Signa
6187
6956
  if (v === "") this.setFilter && this.setFilter(this.columnId, "");
6188
6957
  else this.setFilter && this.setFilter(this.columnId, v);
6189
6958
  };
6959
+ this.a11yLabel = () => {
6960
+ if (typeof this.columnLabel === "string" && this.columnLabel !== "") return this.columnLabel;
6961
+ return this.columnId;
6962
+ };
6190
6963
  }
6191
6964
  static {
6192
6965
  this.styles = lit.css`
@@ -6204,11 +6977,11 @@ let FilterSelect = class FilterSelect extends (0, _lit_labs_preact_signals.Signa
6204
6977
  }
6205
6978
  render() {
6206
6979
  return lit.html`
6207
- <select class="rdt-col-filter" part="col-filter" aria-label=${this.columnId} .value=${this.selectValue()} @change=${($event) => {
6980
+ <select class="rdt-col-filter" part="col-filter" aria-label=${(0, _rozie_runtime_lit.rozieAttr)(this.a11yLabel())} .value=${this.selectValue()} @change=${($event) => {
6208
6981
  this.onChange($event);
6209
6982
  }} data-rozie-s-d75b42b2>
6210
6983
  <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>`)}
6984
+ ${(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
6985
  </select>
6213
6986
  `;
6214
6987
  }
@@ -6221,6 +6994,10 @@ __decorate([(0, lit_decorators_js.property)({ type: Object })], FilterSelect.pro
6221
6994
  __decorate([(0, lit_decorators_js.property)({ type: Object })], FilterSelect.prototype, "value", void 0);
6222
6995
  __decorate([(0, lit_decorators_js.property)({ type: Function })], FilterSelect.prototype, "setFilter", void 0);
6223
6996
  __decorate([(0, lit_decorators_js.property)({ type: Array })], FilterSelect.prototype, "uniqueValues", void 0);
6997
+ __decorate([(0, lit_decorators_js.property)({
6998
+ type: String,
6999
+ reflect: true
7000
+ })], FilterSelect.prototype, "columnLabel", void 0);
6224
7001
  FilterSelect = __decorate([(0, lit_decorators_js.customElement)("rozie-filter-select")], FilterSelect);
6225
7002
  var FilterSelect_default = FilterSelect;
6226
7003
  //#endregion
@@ -6296,6 +7073,42 @@ let GroupBar = class GroupBar extends (0, _lit_labs_preact_signals.SignalWatcher
6296
7073
  this.removeKey = (key) => {
6297
7074
  this.applyGrouping && this.applyGrouping(this.grouping.filter((k) => k !== key));
6298
7075
  };
7076
+ this.toggleKey = (id) => {
7077
+ if (!id) return;
7078
+ if (this.grouping.indexOf(id) !== -1) {
7079
+ this.removeKey(id);
7080
+ return;
7081
+ }
7082
+ this.applyGrouping && this.applyGrouping(this.grouping.concat([id]));
7083
+ };
7084
+ this.moveKey = (key, delta) => {
7085
+ const cur = this.grouping;
7086
+ const from = cur.indexOf(key);
7087
+ if (from === -1) return;
7088
+ const to = from + delta;
7089
+ if (to < 0 || to >= cur.length) return;
7090
+ const next = cur.slice();
7091
+ next.splice(from, 1);
7092
+ next.splice(to, 0, key);
7093
+ this.applyGrouping && this.applyGrouping(next);
7094
+ };
7095
+ this.onTokenKeydown = (e, gk) => {
7096
+ if (!e) return;
7097
+ const key = e.key;
7098
+ if (key === "Delete" || key === "Backspace") {
7099
+ e.preventDefault();
7100
+ this.removeKey(gk);
7101
+ return;
7102
+ }
7103
+ if (!e.altKey) return;
7104
+ if (key === "ArrowLeft") {
7105
+ e.preventDefault();
7106
+ this.moveKey(gk, -1);
7107
+ } else if (key === "ArrowRight") {
7108
+ e.preventDefault();
7109
+ this.moveKey(gk, 1);
7110
+ }
7111
+ };
6299
7112
  this.clearAll = () => {
6300
7113
  this.clearGrouping && this.clearGrouping();
6301
7114
  };
@@ -6324,6 +7137,18 @@ let GroupBar = class GroupBar extends (0, _lit_labs_preact_signals.SignalWatcher
6324
7137
  border-color: var(--rdt-group-drop-zone-border-over, rgba(37, 99, 235, 0.7));
6325
7138
  background: var(--rdt-group-drop-zone-bg-over, rgba(37, 99, 235, 0.08));
6326
7139
  }
7140
+ .rdt-group-token-add[data-rozie-s-546c469a] {
7141
+ font: inherit;
7142
+ color: inherit;
7143
+ border: none;
7144
+ background: none;
7145
+ cursor: pointer;
7146
+ }
7147
+ .rdt-group-token-add[data-rozie-s-546c469a]:focus-visible,
7148
+ .rdt-group-drop-zone[data-rozie-s-546c469a] [data-group-token][data-rozie-s-546c469a]:focus-visible {
7149
+ outline: var(--rdt-focus-ring, 2px solid #2563eb);
7150
+ outline-offset: 1px;
7151
+ }
6327
7152
  .rdt-group-drop-hint[data-rozie-s-546c469a] {
6328
7153
  opacity: 0.55;
6329
7154
  font-size: 0.8125em;
@@ -6379,17 +7204,19 @@ let GroupBar = class GroupBar extends (0, _lit_labs_preact_signals.SignalWatcher
6379
7204
  return lit.html`
6380
7205
  <div class="rdt-group-bar" data-rozie-s-546c469a>
6381
7206
 
6382
- ${(0, lit_directives_repeat_js.repeat)(this.groupableColumns, (col, _idx) => col.id, (col, _idx) => lit.html`<span class="rdt-group-token" part="group-token" draggable="true" @dragstart=${($event) => {
7207
+ ${(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
7208
  this.onChipDragStart($event, col.id);
6384
7209
  }} @dragend=${($event) => {
6385
7210
  this.onDragEnd();
6386
- }} data-rozie-s-546c469a>${(0, _rozie_runtime_lit.rozieDisplay)(col.label)}</span>`)}
7211
+ }} @click=${($event) => {
7212
+ this.toggleKey(col.id);
7213
+ }} data-rozie-s-546c469a>${(0, _rozie_runtime_lit.rozieDisplay)(col.label)}</button>`)}
6387
7214
 
6388
7215
 
6389
7216
  <span class="${Object.entries({
6390
7217
  "rdt-group-drop-zone": true,
6391
7218
  "is-over": this._isOver.value
6392
- }).filter(([, v]) => v).map(([k]) => k).join(" ")}" data-group-drop-zone="" @dragover=${($event) => {
7219
+ }).filter(([, v]) => v).map(([k]) => k).join(" ")}" data-group-drop-zone="" role="list" aria-label="Active grouping" @dragover=${($event) => {
6393
7220
  this.onDragOver($event);
6394
7221
  }} @dragleave=${($event) => {
6395
7222
  this.onDragLeave($event);
@@ -6400,12 +7227,14 @@ let GroupBar = class GroupBar extends (0, _lit_labs_preact_signals.SignalWatcher
6400
7227
  ${!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
7228
  "rdt-group-token": true,
6402
7229
  "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) => {
7230
+ }).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
7231
  this.onTokenDragStart($event, gk);
6405
7232
  }} @dragover=${($event) => {
6406
7233
  this.onTokenDragOver($event, gk);
6407
7234
  }} @dragend=${($event) => {
6408
7235
  this.onDragEnd();
7236
+ }} @keydown=${($event) => {
7237
+ this.onTokenKeydown($event, gk);
6409
7238
  }} data-rozie-s-546c469a>
6410
7239
  ${(0, _rozie_runtime_lit.rozieDisplay)(this.labelFor(gk))}
6411
7240
  <button class="rdt-group-token-remove" type="button" aria-label=${(0, _rozie_runtime_lit.rozieAttr)("Remove " + this.labelFor(gk) + " grouping")} @click=${($event) => {