@rozie-ui/data-table-lit 0.3.2 → 0.5.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.mjs CHANGED
@@ -396,12 +396,16 @@ let DataTable = class DataTable extends SignalWatcher(LitElement) {
396
396
  this._hasSlotDefault = false;
397
397
  this._hasSlotGroupBar = false;
398
398
  this._hasSlotSelectAll = false;
399
+ this._hasSlotDynamicColHeader = false;
400
+ this._hasSlotDynamicFilter = false;
401
+ this._hasSlotSelectCell = false;
402
+ this._hasSlotDynamicCell = false;
403
+ this._hasSlotDynamicEditor = false;
404
+ this._hasSlotDetail = false;
399
405
  this._hasSlotColHeader = false;
400
406
  this._hasSlotFilter = false;
401
- this._hasSlotSelectCell = false;
402
407
  this._hasSlotCell = false;
403
408
  this._hasSlotEditor = false;
404
- this._hasSlotDetail = false;
405
409
  this._disconnectCleanups = [];
406
410
  this._rozieTornDown = false;
407
411
  this.table = null;
@@ -435,6 +439,34 @@ let DataTable = class DataTable extends SignalWatcher(LitElement) {
435
439
  left: rail.concat(deduped)
436
440
  };
437
441
  };
442
+ this.pinSeedApplied = false;
443
+ this.seedColumnPinning = () => {
444
+ if (this.pinSeedApplied) return;
445
+ const live = this.columnPinning != null ? this.columnPinning : this._columnPinningDefault.value;
446
+ const isRealPin = (id) => id !== this.SELECT_COL_ID && id !== this.EXPANDER_COL_ID;
447
+ if ((live && live.left ? live.left : []).filter(isRealPin).length > 0 || (live && live.right ? live.right : []).filter(isRealPin).length > 0) {
448
+ this.pinSeedApplied = true;
449
+ return;
450
+ }
451
+ const defs = this.columnDefs();
452
+ if (!defs.length) return;
453
+ const left = [];
454
+ const right = [];
455
+ for (let i = 0; i < defs.length; i++) {
456
+ const def = defs[i];
457
+ if (!def) continue;
458
+ if (def.pinned === "left") left.push(def.id);
459
+ else if (def.pinned === "right") right.push(def.id);
460
+ }
461
+ if (!left.length && !right.length) return;
462
+ this.pinSeedApplied = true;
463
+ const seeded = {
464
+ left,
465
+ right
466
+ };
467
+ this._columnPinningDefault.value = seeded;
468
+ this._columnPinningControllable.write(seeded);
469
+ };
438
470
  this.currentState = () => ({
439
471
  sorting: this.sorting != null ? this.sorting : this._sortingDefault.value,
440
472
  globalFilter: this.globalFilter != null ? this.globalFilter : this._globalFilterDefault.value,
@@ -831,9 +863,12 @@ let DataTable = class DataTable extends SignalWatcher(LitElement) {
831
863
  this.onColumnPinningChangeCb = (updater) => {
832
864
  this.writeColumnPinning(applyUpdater(updater, this.currentState().columnPinning));
833
865
  };
866
+ this.columnSizingInfoSync = null;
834
867
  this.onColumnSizingInfoChangeCb = (updater) => {
835
- const next = applyUpdater(updater, this._columnSizingInfo.value);
836
- this._columnSizingInfo.value = next != null ? next : this._columnSizingInfo.value;
868
+ const next = applyUpdater(updater, this.columnSizingInfoSync != null ? this.columnSizingInfoSync : this._columnSizingInfo.value);
869
+ if (next == null) return;
870
+ this.columnSizingInfoSync = next;
871
+ this._columnSizingInfo.value = next;
837
872
  };
838
873
  this.resolveVirtual = () => {
839
874
  const v = this.virtual;
@@ -1310,8 +1345,6 @@ let DataTable = class DataTable extends SignalWatcher(LitElement) {
1310
1345
  const m = this.editMetaOf(colId);
1311
1346
  return m && m.editorOptions != null ? m.editorOptions : [];
1312
1347
  };
1313
- this.hasEditorSlot = (colId) => this.editorTypeOf(colId) === "custom" && !!(this._hasSlotEditor || this.editor !== void 0);
1314
- this.hasFilterSlot = () => !!(this._hasSlotFilter || this.filter !== void 0);
1315
1348
  this.columnIsFilterable = (colId) => {
1316
1349
  const d = this.defFor(colId);
1317
1350
  return !!(d && d.filterable);
@@ -1320,11 +1353,9 @@ let DataTable = class DataTable extends SignalWatcher(LitElement) {
1320
1353
  const d = this.defFor(colId);
1321
1354
  return d ? d.header : colId;
1322
1355
  };
1323
- this.headerWidth = (colId) => {
1324
- if (this.tick() < 0 || !this.table) return null;
1325
- const col = this.table.getColumn(colId);
1326
- if (!col) return null;
1327
- const w = col.getSize();
1356
+ this.headerWidth = (header) => {
1357
+ if (this.tick() < 0 || !header || typeof header.getSize !== "function") return null;
1358
+ const w = header.getSize();
1328
1359
  return w != null && w > 0 ? w + "px" : null;
1329
1360
  };
1330
1361
  this.onResizeStart = (colId, evt) => {
@@ -1393,11 +1424,11 @@ let DataTable = class DataTable extends SignalWatcher(LitElement) {
1393
1424
  if (side === "right") return "position:sticky;right:" + (col.getAfter ? col.getAfter("right") : 0) + "px;z-index:" + zIndex + ";";
1394
1425
  return "";
1395
1426
  };
1396
- this.thStyle = (colId) => {
1427
+ this.thStyle = (header) => {
1397
1428
  let s = "";
1398
- const w = this.headerWidth(colId);
1429
+ const w = this.headerWidth(header);
1399
1430
  if (w) s += "width:" + w + ";";
1400
- s += this.pinStyle(colId, 2);
1431
+ s += this.pinStyle(header && header.column ? header.column.id : null, 2);
1401
1432
  return s;
1402
1433
  };
1403
1434
  this.onGlobalFilterInput = (evt) => {
@@ -2703,8 +2734,9 @@ let DataTable = class DataTable extends SignalWatcher(LitElement) {
2703
2734
  this.fillEdgeScrollRaf = null;
2704
2735
  }
2705
2736
  };
2706
- this.cellIndexFromPoint = (clientX, clientY) => {
2707
- if (typeof document === "undefined" || !document.elementFromPoint) return null;
2737
+ this.FILL_HITTEST_PROBE_RADIUS_PX = 8;
2738
+ this.FILL_HITTEST_PROBE_STEP_PX = 2;
2739
+ this.resolveCellAt = (clientX, clientY) => {
2708
2740
  let el = document.elementFromPoint(clientX, clientY);
2709
2741
  while (el && el.shadowRoot && el.shadowRoot.elementFromPoint) {
2710
2742
  const inner = el.shadowRoot.elementFromPoint(clientX, clientY);
@@ -2725,6 +2757,18 @@ let DataTable = class DataTable extends SignalWatcher(LitElement) {
2725
2757
  c
2726
2758
  };
2727
2759
  };
2760
+ this.cellIndexFromPoint = (clientX, clientY) => {
2761
+ if (typeof document === "undefined" || !document.elementFromPoint) return null;
2762
+ const direct = this.resolveCellAt(clientX, clientY);
2763
+ if (direct) return direct;
2764
+ for (let d = this.FILL_HITTEST_PROBE_STEP_PX; d <= this.FILL_HITTEST_PROBE_RADIUS_PX; d += this.FILL_HITTEST_PROBE_STEP_PX) {
2765
+ const right = this.resolveCellAt(clientX + d, clientY);
2766
+ if (right) return right;
2767
+ const left = this.resolveCellAt(clientX - d, clientY);
2768
+ if (left) return left;
2769
+ }
2770
+ return null;
2771
+ };
2728
2772
  this.onFillHandlePointerDown = (e) => {
2729
2773
  if (!e) return;
2730
2774
  if (e.preventDefault) e.preventDefault();
@@ -2895,12 +2939,24 @@ let DataTable = class DataTable extends SignalWatcher(LitElement) {
2895
2939
  const row = (this._rows.value || [])[this._editingRow.value];
2896
2940
  return row ? row.id : null;
2897
2941
  };
2898
- this.focusEditorWhenReady = (selectAll = true) => {
2942
+ this.resolveEditFocusCellEl = (rowIndex, colIndex) => {
2943
+ if (rowIndex == null || colIndex == null || rowIndex < 0 || colIndex < 0) return null;
2944
+ return this.resolveCellEl(String(rowIndex), colIndex);
2945
+ };
2946
+ this.focusEditorWhenReady = (rowIndex, colIndex, selectAll = true) => {
2899
2947
  if (!this.gridRoot) return;
2900
- if (this._editFocusColId.value != null && this.hasEditorSlot(this._editFocusColId.value)) return;
2901
2948
  let attempts = 0;
2902
2949
  const tryFocus = () => {
2903
- const el = this.gridRoot ? this.gridRoot.querySelector("[data-editing-cell]") : null;
2950
+ const cellEl = this.resolveEditFocusCellEl(rowIndex, colIndex);
2951
+ const el = cellEl && cellEl.querySelector ? cellEl.querySelector("[data-editing-cell][data-builtin-editor]") : null;
2952
+ if (!el) {
2953
+ if (cellEl && cellEl.querySelector ? cellEl.querySelector("[data-editing-cell]") : null) return;
2954
+ attempts = attempts + 1;
2955
+ if (attempts >= 30) return;
2956
+ if (typeof requestAnimationFrame === "function") requestAnimationFrame(tryFocus);
2957
+ else setTimeout(tryFocus, 16);
2958
+ return;
2959
+ }
2904
2960
  const ae = this.gridRoot && this.gridRoot.getRootNode ? this.gridRoot.getRootNode().activeElement : null;
2905
2961
  if (ae && el && ae !== el && ae.closest && this.gridRoot.contains(ae) && ae.hasAttribute && ae.hasAttribute("data-editing-cell")) {
2906
2962
  const aeCell = ae.closest("[data-grid-cell]");
@@ -2909,17 +2965,10 @@ let DataTable = class DataTable extends SignalWatcher(LitElement) {
2909
2965
  const elCol = elCell ? elCell.getAttribute("data-col-index") : null;
2910
2966
  if (aeCol != null && aeCol !== elCol) return;
2911
2967
  }
2912
- if (el) {
2913
- el.focus();
2914
- if (selectAll && el.select) try {
2915
- el.select();
2916
- } catch (e) {}
2917
- return;
2918
- }
2919
- attempts = attempts + 1;
2920
- if (attempts >= 30) return;
2921
- if (typeof requestAnimationFrame === "function") requestAnimationFrame(tryFocus);
2922
- else setTimeout(tryFocus, 16);
2968
+ el.focus();
2969
+ if (selectAll && el.select) try {
2970
+ el.select();
2971
+ } catch (e) {}
2923
2972
  };
2924
2973
  if (typeof requestAnimationFrame === "function") requestAnimationFrame(tryFocus);
2925
2974
  else setTimeout(tryFocus, 0);
@@ -2950,7 +2999,7 @@ let DataTable = class DataTable extends SignalWatcher(LitElement) {
2950
2999
  this._activeInControl.value = true;
2951
3000
  this._editVer.value = this._editVer.value + 1;
2952
3001
  this._editFocusColId.value = colId;
2953
- this.focusEditorWhenReady(seed == null);
3002
+ this.focusEditorWhenReady(rowIndex, colIndex, seed == null);
2954
3003
  };
2955
3004
  this.focusCellWhenReady = (row, col) => {
2956
3005
  if (!this.gridRoot) return;
@@ -2958,6 +3007,11 @@ let DataTable = class DataTable extends SignalWatcher(LitElement) {
2958
3007
  const tryFocus = () => {
2959
3008
  const el = this.resolveCellEl(String(row), col);
2960
3009
  if (el) {
3010
+ const ae = this.gridRoot && this.gridRoot.getRootNode ? this.gridRoot.getRootNode().activeElement : null;
3011
+ if (ae && ae !== el && this.gridRoot.contains && this.gridRoot.contains(ae) && ae.closest) {
3012
+ const aeCell = ae.closest("[data-grid-cell]");
3013
+ if (aeCell && aeCell !== el) return;
3014
+ }
2961
3015
  el.focus();
2962
3016
  return;
2963
3017
  }
@@ -3019,7 +3073,7 @@ let DataTable = class DataTable extends SignalWatcher(LitElement) {
3019
3073
  const err = this.runValidator(colId, newValue, rowOriginal);
3020
3074
  if (err !== true) {
3021
3075
  this.setInvalid(err);
3022
- this.focusEditorWhenReady();
3076
+ this.focusEditorWhenReady(this._editingRow.value, this._editingCol.value);
3023
3077
  return false;
3024
3078
  }
3025
3079
  this.setInvalid("");
@@ -3121,12 +3175,10 @@ let DataTable = class DataTable extends SignalWatcher(LitElement) {
3121
3175
  };
3122
3176
  this.focusRowEditorAt = (rowIndex, colIndex) => {
3123
3177
  if (!this.gridRoot) return;
3124
- const colId = this.columnIdAt(rowIndex, colIndex);
3125
- if (colId != null && this.hasEditorSlot(colId)) return;
3126
3178
  let attempts = 0;
3127
3179
  const tryFocus = () => {
3128
3180
  const cellEl = this.resolveCellEl(String(rowIndex), colIndex);
3129
- const ed = cellEl && cellEl.querySelector ? cellEl.querySelector("[data-editing-cell]") : null;
3181
+ const ed = cellEl && cellEl.querySelector ? cellEl.querySelector("[data-editing-cell][data-builtin-editor]") : null;
3130
3182
  if (ed) {
3131
3183
  ed.focus();
3132
3184
  if (ed.select) try {
@@ -3134,6 +3186,7 @@ let DataTable = class DataTable extends SignalWatcher(LitElement) {
3134
3186
  } catch (e) {}
3135
3187
  return;
3136
3188
  }
3189
+ if (cellEl && cellEl.querySelector ? cellEl.querySelector("[data-editing-cell]") : null) return;
3137
3190
  attempts = attempts + 1;
3138
3191
  if (attempts >= 30) return;
3139
3192
  if (typeof requestAnimationFrame === "function") requestAnimationFrame(tryFocus);
@@ -3165,7 +3218,7 @@ let DataTable = class DataTable extends SignalWatcher(LitElement) {
3165
3218
  this._activeInControl.value = true;
3166
3219
  this._editVer.value = this._editVer.value + 1;
3167
3220
  this._editFocusColId.value = editable[0].colId;
3168
- this.focusEditorWhenReady();
3221
+ this.focusEditorWhenReady(rowIndex, editable[0].colIndex);
3169
3222
  };
3170
3223
  this.commitRow = () => {
3171
3224
  if (this._editingRowIndex.value == null) return false;
@@ -3579,6 +3632,34 @@ let DataTable = class DataTable extends SignalWatcher(LitElement) {
3579
3632
  static {
3580
3633
  this.styles = css`
3581
3634
  :host{display:contents}
3635
+ :host {
3636
+ --rdt-font: var(--rozie-data-table-font);
3637
+ --rdt-color: var(--rozie-data-table-fg);
3638
+ --rdt-cell-padding: var(--rozie-data-table-cell-padding);
3639
+ --rdt-border: 1px solid var(--rozie-data-table-border-color);
3640
+ --rdt-header-bg: var(--rozie-data-table-header-bg);
3641
+ --rdt-header-weight: var(--rozie-data-table-header-weight);
3642
+ --rdt-sort-ind-opacity: var(--rozie-data-table-sort-indicator-opacity);
3643
+ --rdt-filter-border: 1px solid var(--rozie-data-table-control-border-color);
3644
+ --rdt-filter-radius: var(--rozie-data-table-radius);
3645
+ --rdt-page-btn-border: 1px solid var(--rozie-data-table-control-border-color);
3646
+ --rdt-page-btn-radius: var(--rozie-data-table-radius);
3647
+ --rdt-page-btn-disabled-opacity: var(--rozie-data-table-disabled-opacity);
3648
+ --rdt-page-size-border: 1px solid var(--rozie-data-table-control-border-color);
3649
+ --rdt-page-size-radius: var(--rozie-data-table-radius);
3650
+ --rdt-resize-grip-color: var(--rozie-data-table-resize-grip-color);
3651
+ --rdt-resize-grip-active: var(--rozie-data-table-resize-grip-active);
3652
+ --rdt-pin-btn-border: 1px solid var(--rozie-data-table-control-border-color);
3653
+ --rdt-pin-btn-radius: var(--rozie-data-table-radius);
3654
+ --rdt-pin-btn-active-bg: var(--rozie-data-table-pin-active-bg);
3655
+ --rdt-colvis-summary-border: 1px solid var(--rozie-data-table-control-border-color);
3656
+ --rdt-colvis-summary-radius: var(--rozie-data-table-radius);
3657
+ --rdt-colvis-menu-border: 1px solid var(--rozie-data-table-border-color);
3658
+ --rdt-colvis-menu-radius: var(--rozie-data-table-radius);
3659
+ --rdt-colvis-menu-bg: var(--rozie-data-table-menu-bg);
3660
+ --rdt-colvis-menu-shadow: var(--rozie-data-table-menu-shadow);
3661
+ --rdt-select-accent: var(--rozie-data-table-select-accent);
3662
+ }
3582
3663
  .rozie-data-table[data-rozie-s-d5dcab4c] {
3583
3664
  border-collapse: collapse;
3584
3665
  width: 100%;
@@ -3950,10 +4031,10 @@ let DataTable = class DataTable extends SignalWatcher(LitElement) {
3950
4031
  }
3951
4032
  }
3952
4033
  {
3953
- const slotEl = this.shadowRoot?.querySelector("slot[name=\"colHeader\"]");
4034
+ const slotEl = this.shadowRoot?.querySelector("slot:not([name])");
3954
4035
  if (slotEl !== null && slotEl !== void 0) {
3955
4036
  const update = () => {
3956
- this._hasSlotColHeader = this._slotColHeaderElements.length > 0;
4037
+ this._hasSlotDynamicColHeader = this._slotDynamicColHeaderElements.length > 0;
3957
4038
  };
3958
4039
  slotEl.addEventListener("slotchange", update);
3959
4040
  this._disconnectCleanups.push(() => slotEl.removeEventListener("slotchange", update));
@@ -3961,10 +4042,10 @@ let DataTable = class DataTable extends SignalWatcher(LitElement) {
3961
4042
  }
3962
4043
  }
3963
4044
  {
3964
- const slotEl = this.shadowRoot?.querySelector("slot[name=\"filter\"]");
4045
+ const slotEl = this.shadowRoot?.querySelector("slot:not([name])");
3965
4046
  if (slotEl !== null && slotEl !== void 0) {
3966
4047
  const update = () => {
3967
- this._hasSlotFilter = this._slotFilterElements.length > 0;
4048
+ this._hasSlotDynamicFilter = this._slotDynamicFilterElements.length > 0;
3968
4049
  };
3969
4050
  slotEl.addEventListener("slotchange", update);
3970
4051
  this._disconnectCleanups.push(() => slotEl.removeEventListener("slotchange", update));
@@ -3983,10 +4064,10 @@ let DataTable = class DataTable extends SignalWatcher(LitElement) {
3983
4064
  }
3984
4065
  }
3985
4066
  {
3986
- const slotEl = this.shadowRoot?.querySelector("slot[name=\"cell\"]");
4067
+ const slotEl = this.shadowRoot?.querySelector("slot:not([name])");
3987
4068
  if (slotEl !== null && slotEl !== void 0) {
3988
4069
  const update = () => {
3989
- this._hasSlotCell = this._slotCellElements.length > 0;
4070
+ this._hasSlotDynamicCell = this._slotDynamicCellElements.length > 0;
3990
4071
  };
3991
4072
  slotEl.addEventListener("slotchange", update);
3992
4073
  this._disconnectCleanups.push(() => slotEl.removeEventListener("slotchange", update));
@@ -3994,10 +4075,10 @@ let DataTable = class DataTable extends SignalWatcher(LitElement) {
3994
4075
  }
3995
4076
  }
3996
4077
  {
3997
- const slotEl = this.shadowRoot?.querySelector("slot[name=\"editor\"]");
4078
+ const slotEl = this.shadowRoot?.querySelector("slot:not([name])");
3998
4079
  if (slotEl !== null && slotEl !== void 0) {
3999
4080
  const update = () => {
4000
- this._hasSlotEditor = this._slotEditorElements.length > 0;
4081
+ this._hasSlotDynamicEditor = this._slotDynamicEditorElements.length > 0;
4001
4082
  };
4002
4083
  slotEl.addEventListener("slotchange", update);
4003
4084
  this._disconnectCleanups.push(() => slotEl.removeEventListener("slotchange", update));
@@ -4015,17 +4096,65 @@ let DataTable = class DataTable extends SignalWatcher(LitElement) {
4015
4096
  update();
4016
4097
  }
4017
4098
  }
4099
+ {
4100
+ const slotEl = this.shadowRoot?.querySelector("slot[name=\"colHeader\"]");
4101
+ if (slotEl !== null && slotEl !== void 0) {
4102
+ const update = () => {
4103
+ this._hasSlotColHeader = this._slotColHeaderElements.length > 0;
4104
+ };
4105
+ slotEl.addEventListener("slotchange", update);
4106
+ this._disconnectCleanups.push(() => slotEl.removeEventListener("slotchange", update));
4107
+ update();
4108
+ }
4109
+ }
4110
+ {
4111
+ const slotEl = this.shadowRoot?.querySelector("slot[name=\"filter\"]");
4112
+ if (slotEl !== null && slotEl !== void 0) {
4113
+ const update = () => {
4114
+ this._hasSlotFilter = this._slotFilterElements.length > 0;
4115
+ };
4116
+ slotEl.addEventListener("slotchange", update);
4117
+ this._disconnectCleanups.push(() => slotEl.removeEventListener("slotchange", update));
4118
+ update();
4119
+ }
4120
+ }
4121
+ {
4122
+ const slotEl = this.shadowRoot?.querySelector("slot[name=\"cell\"]");
4123
+ if (slotEl !== null && slotEl !== void 0) {
4124
+ const update = () => {
4125
+ this._hasSlotCell = this._slotCellElements.length > 0;
4126
+ };
4127
+ slotEl.addEventListener("slotchange", update);
4128
+ this._disconnectCleanups.push(() => slotEl.removeEventListener("slotchange", update));
4129
+ update();
4130
+ }
4131
+ }
4132
+ {
4133
+ const slotEl = this.shadowRoot?.querySelector("slot[name=\"editor\"]");
4134
+ if (slotEl !== null && slotEl !== void 0) {
4135
+ const update = () => {
4136
+ this._hasSlotEditor = this._slotEditorElements.length > 0;
4137
+ };
4138
+ slotEl.addEventListener("slotchange", update);
4139
+ this._disconnectCleanups.push(() => slotEl.removeEventListener("slotchange", update));
4140
+ update();
4141
+ }
4142
+ }
4018
4143
  }
4019
4144
  connectedCallback() {
4020
4145
  this._hasSlotDefault = Array.from(this.children).some((el) => !el.hasAttribute("slot") && (el.nodeType !== 3 || (el.textContent?.trim().length ?? 0) > 0));
4021
4146
  this._hasSlotGroupBar = Array.from(this.children).some((el) => el.getAttribute("slot") === "groupBar");
4022
4147
  this._hasSlotSelectAll = Array.from(this.children).some((el) => el.getAttribute("slot") === "selectAll");
4148
+ this._hasSlotDynamicColHeader = Array.from(this.children).some((el) => !el.hasAttribute("slot") && (el.nodeType !== 3 || (el.textContent?.trim().length ?? 0) > 0));
4149
+ this._hasSlotDynamicFilter = Array.from(this.children).some((el) => !el.hasAttribute("slot") && (el.nodeType !== 3 || (el.textContent?.trim().length ?? 0) > 0));
4150
+ this._hasSlotSelectCell = Array.from(this.children).some((el) => el.getAttribute("slot") === "selectCell");
4151
+ this._hasSlotDynamicCell = Array.from(this.children).some((el) => !el.hasAttribute("slot") && (el.nodeType !== 3 || (el.textContent?.trim().length ?? 0) > 0));
4152
+ this._hasSlotDynamicEditor = Array.from(this.children).some((el) => !el.hasAttribute("slot") && (el.nodeType !== 3 || (el.textContent?.trim().length ?? 0) > 0));
4153
+ this._hasSlotDetail = Array.from(this.children).some((el) => el.getAttribute("slot") === "detail");
4023
4154
  this._hasSlotColHeader = Array.from(this.children).some((el) => el.getAttribute("slot") === "colHeader");
4024
4155
  this._hasSlotFilter = Array.from(this.children).some((el) => el.getAttribute("slot") === "filter");
4025
- this._hasSlotSelectCell = Array.from(this.children).some((el) => el.getAttribute("slot") === "selectCell");
4026
4156
  this._hasSlotCell = Array.from(this.children).some((el) => el.getAttribute("slot") === "cell");
4027
4157
  this._hasSlotEditor = Array.from(this.children).some((el) => el.getAttribute("slot") === "editor");
4028
- this._hasSlotDetail = Array.from(this.children).some((el) => el.getAttribute("slot") === "detail");
4029
4158
  super.connectedCallback();
4030
4159
  if (this.hasUpdated && this._rozieTornDown) {
4031
4160
  this._rozieTornDown = false;
@@ -4042,6 +4171,7 @@ let DataTable = class DataTable extends SignalWatcher(LitElement) {
4042
4171
  return;
4043
4172
  }
4044
4173
  (() => {
4174
+ this.seedColumnPinning();
4045
4175
  this.reFeed();
4046
4176
  this.maybeClearHistoryOnExternalSwap();
4047
4177
  })();
@@ -4081,6 +4211,7 @@ let DataTable = class DataTable extends SignalWatcher(LitElement) {
4081
4211
  }))(this));
4082
4212
  }));
4083
4213
  this._dataDefault.value = this.data || [];
4214
+ this.seedColumnPinning();
4084
4215
  this.table = createTable({
4085
4216
  data: this.currentData(),
4086
4217
  columns: this.tableColumns(),
@@ -4175,6 +4306,7 @@ let DataTable = class DataTable extends SignalWatcher(LitElement) {
4175
4306
  }
4176
4307
  if (this.colsWindowed()) {
4177
4308
  if (!(this.gridScrollEl ? this.gridScrollEl.clientWidth : 0)) console.warn("[rozie-data-table] virtual is on for columns but the scroll container has no bounded width; set a CSS width on an ancestor so the column window can be measured");
4309
+ this.bumpWindowVer();
4178
4310
  }
4179
4311
  };
4180
4312
  if (typeof requestAnimationFrame === "function") requestAnimationFrame(() => requestAnimationFrame(afterFirstFrame));
@@ -4287,7 +4419,7 @@ ${this.groupable ? html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4c>
4287
4419
  "rdt-expander-th": this.isExpanderColumn(wh.header.column.id),
4288
4420
  "rdt-th-resizing": this.columnIsResizing(wh.header.column.id),
4289
4421
  "rdt-cell-active": this.isActiveCell("__header", this.headerColIndexOf(hg, wh.header), hgLevel)
4290
- }).filter(([, v]) => v).map(([k]) => k).join(" ")}" role="columnheader" data-col=${rozieAttr(wh.header.column.id)} data-grid-cell="" data-row="__header" data-header-level=${rozieAttr(hgLevel)} colspan=${rozieAttr(wh.span > 1 ? wh.span : null)} data-col-index=${rozieAttr(this.headerColIndexOf(hg, wh.header))} tabindex=${rozieAttr(this.cellTabindex("__header", this.headerColIndexOf(hg, wh.header), hgLevel))} aria-sort=${rozieAttr(this.ariaSortFor(wh.header.column.id))} style=${rozieStyle(this.thStyle(wh.header.column.id))} data-rozie-s-d5dcab4c>
4422
+ }).filter(([, v]) => v).map(([k]) => k).join(" ")}" role="columnheader" data-col=${rozieAttr(wh.header.column.id)} data-grid-cell="" data-row="__header" data-header-level=${rozieAttr(hgLevel)} colspan=${rozieAttr(wh.span > 1 ? wh.span : null)} data-col-index=${rozieAttr(this.headerColIndexOf(hg, wh.header))} tabindex=${rozieAttr(this.cellTabindex("__header", this.headerColIndexOf(hg, wh.header), hgLevel))} aria-sort=${rozieAttr(this.ariaSortFor(wh.header.column.id))} style=${rozieStyle(this.thStyle(wh.header))} data-rozie-s-d5dcab4c>
4291
4423
  ${this.isSelectColumn(wh.header.column.id) ? html`<span style="display:contents" data-rozie-s-d5dcab4c>
4292
4424
  ${this.selectAll !== void 0 ? this.selectAll({
4293
4425
  checked: this.isAllRowsSelected(),
@@ -4311,7 +4443,22 @@ ${this.groupable ? html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4c>
4311
4443
  this.onHeaderSort(wh.header.column.id, $event);
4312
4444
  }} data-rozie-s-d5dcab4c>
4313
4445
  <span class="rdt-header-label" data-rozie-s-d5dcab4c>
4314
- ${this.colHeader !== void 0 ? this.colHeader({
4446
+ ${this.rozieSlots?.[`colHeader-${wh.header.column.id}`] !== void 0 ? this.rozieSlots?.[`colHeader-${wh.header.column.id}`]({
4447
+ columnId: wh.header.column.id,
4448
+ column: wh.header.column,
4449
+ label: this.headerLabel(wh.header.column.id)
4450
+ }) : html`<slot name="${`colHeader-${wh.header.column.id}`}" data-rozie-params=${(() => {
4451
+ try {
4452
+ return JSON.stringify({
4453
+ columnId: wh.header.column.id,
4454
+ column: wh.header.column,
4455
+ label: this.headerLabel(wh.header.column.id)
4456
+ });
4457
+ } catch {
4458
+ return "{}";
4459
+ }
4460
+ })()}>
4461
+ ${this.colHeader !== void 0 ? this.colHeader({
4315
4462
  columnId: wh.header.column.id,
4316
4463
  column: wh.header.column,
4317
4464
  label: this.headerLabel(wh.header.column.id)
@@ -4326,11 +4473,27 @@ ${this.groupable ? html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4c>
4326
4473
  return "{}";
4327
4474
  }
4328
4475
  })()}>${rozieDisplay(this.headerLabel(wh.header.column.id))}</slot>`}
4476
+ </slot>`}
4329
4477
  </span>
4330
4478
  <span class="rdt-sort-ind" aria-hidden="true" data-rozie-s-d5dcab4c>${rozieDisplay(this.sortIndicator(wh.header.column.id))}</span>
4331
4479
  </button>` : html`<span style="display:contents" data-rozie-s-d5dcab4c>
4332
4480
  <span class="rdt-header-label" data-rozie-s-d5dcab4c>
4333
- ${this.colHeader !== void 0 ? this.colHeader({
4481
+ ${this.rozieSlots?.[`colHeader-${wh.header.column.id}`] !== void 0 ? this.rozieSlots?.[`colHeader-${wh.header.column.id}`]({
4482
+ columnId: wh.header.column.id,
4483
+ column: wh.header.column,
4484
+ label: this.headerLabel(wh.header.column.id)
4485
+ }) : html`<slot name="${`colHeader-${wh.header.column.id}`}" data-rozie-params=${(() => {
4486
+ try {
4487
+ return JSON.stringify({
4488
+ columnId: wh.header.column.id,
4489
+ column: wh.header.column,
4490
+ label: this.headerLabel(wh.header.column.id)
4491
+ });
4492
+ } catch {
4493
+ return "{}";
4494
+ }
4495
+ })()}>
4496
+ ${this.colHeader !== void 0 ? this.colHeader({
4334
4497
  columnId: wh.header.column.id,
4335
4498
  column: wh.header.column,
4336
4499
  label: this.headerLabel(wh.header.column.id)
@@ -4345,6 +4508,7 @@ ${this.groupable ? html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4c>
4345
4508
  return "{}";
4346
4509
  }
4347
4510
  })()}>${rozieDisplay(this.headerLabel(wh.header.column.id))}</slot>`}
4511
+ </slot>`}
4348
4512
  </span>
4349
4513
  </span>`}<rozie-popover trigger="click" placement="bottom-end" strategy="fixed" .offset=${4} data-rozie-s-d5dcab4c><button class="rdt-col-menu-trigger" type="button" aria-label=${rozieAttr("Column options for " + this.headerLabel(wh.header.column.id))} data-rozie-s-d5dcab4c slot="anchor">⋯</button><div class="rdt-col-menu" role="menu" data-rozie-s-d5dcab4c>
4350
4514
  <button class="rdt-col-menu-item" type="button" role="menuitem" aria-pressed=${this.columnPinSide(wh.header.column.id) === "left"} @click=${($event) => {
@@ -4373,12 +4537,26 @@ ${this.groupable ? html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4c>
4373
4537
  ${this.hasAnyFilterableColumn() ? html`<tr class="rdt-filter-row" data-rozie-s-d5dcab4c>
4374
4538
  ${this.colsWindowed() ? html`<th class="rdt-col-spacer" aria-hidden="true" style=${rozieStyle("width:" + this.colPadLeft() + "px;padding:0;border:0")} data-rozie-s-d5dcab4c></th>` : nothing}${repeat(this.windowedHeadersFor(this._headerGroups.value[this._headerGroups.value.length - 1], this._headerGroups.value.length - 1), (wh, _idx) => wh.header.id, (wh, _idx) => html`<th class="rdt-filter-cell" role="presentation" data-col=${rozieAttr(wh.header.column.id)} style=${rozieStyle(this.pinStyle(wh.header.column.id))} data-rozie-s-d5dcab4c>
4375
4539
  ${this.isSelectColumn(wh.header.column.id) ? html`<span style="display:contents" data-rozie-s-d5dcab4c></span>` : this.isExpanderColumn(wh.header.column.id) ? html`<span style="display:contents" data-rozie-s-d5dcab4c></span>` : html`<span style="display:contents" data-rozie-s-d5dcab4c>
4376
- ${this.columnIsFilterable(wh.header.column.id) && !this.hasFilterSlot() ? html`<input class="rdt-col-filter" type="text" aria-label=${rozieAttr("Filter " + this.headerLabel(wh.header.column.id))} .value=${this.columnFilterValue(wh.header.column.id)} @input=${($event) => {
4377
- this.onColumnFilterInput(wh.header.column.id, $event);
4378
- }} @click=${($event) => {
4379
- this.stopEvent($event);
4380
- }} data-rozie-s-d5dcab4c />` : nothing}${this.columnIsFilterable(wh.header.column.id) ? html`<span style="display:contents" data-rozie-s-d5dcab4c>
4381
- ${this.filter !== void 0 ? this.filter({
4540
+ ${this.columnIsFilterable(wh.header.column.id) ? html`<span style="display:contents" data-rozie-s-d5dcab4c>
4541
+ ${this.rozieSlots?.[`filter-${wh.header.column.id}`] !== void 0 ? this.rozieSlots?.[`filter-${wh.header.column.id}`]({
4542
+ columnId: wh.header.column.id,
4543
+ value: this.columnFilterValue(wh.header.column.id),
4544
+ uniqueValues: this.getFacetedUniqueValues(wh.header.column.id),
4545
+ minMax: this.getFacetedMinMaxValues(wh.header.column.id),
4546
+ setFilter: this.setColumnFilter
4547
+ }) : html`<slot name="${`filter-${wh.header.column.id}`}" data-rozie-params=${(() => {
4548
+ try {
4549
+ return JSON.stringify({
4550
+ columnId: wh.header.column.id,
4551
+ value: this.columnFilterValue(wh.header.column.id),
4552
+ uniqueValues: this.getFacetedUniqueValues(wh.header.column.id),
4553
+ minMax: this.getFacetedMinMaxValues(wh.header.column.id)
4554
+ });
4555
+ } catch {
4556
+ return "{}";
4557
+ }
4558
+ })()} @rozie-default-set-filter=${($event) => this.setColumnFilter($event.detail)}>
4559
+ ${this.filter !== void 0 ? this.filter({
4382
4560
  columnId: wh.header.column.id,
4383
4561
  value: this.columnFilterValue(wh.header.column.id),
4384
4562
  uniqueValues: this.getFacetedUniqueValues(wh.header.column.id),
@@ -4395,7 +4573,14 @@ ${this.groupable ? html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4c>
4395
4573
  } catch {
4396
4574
  return "{}";
4397
4575
  }
4398
- })()} @rozie-filter-set-filter=${($event) => this.setColumnFilter($event.detail)}></slot>`}
4576
+ })()} @rozie-filter-set-filter=${($event) => this.setColumnFilter($event.detail)}>
4577
+ <input class="rdt-col-filter" type="text" aria-label=${rozieAttr("Filter " + this.headerLabel(wh.header.column.id))} .value=${this.columnFilterValue(wh.header.column.id)} @input=${($event) => {
4578
+ this.onColumnFilterInput(wh.header.column.id, $event);
4579
+ }} @click=${($event) => {
4580
+ this.stopEvent($event);
4581
+ }} data-rozie-s-d5dcab4c />
4582
+ </slot>`}
4583
+ </slot>`}
4399
4584
  </span>` : nothing}</span>`}</th>`)}
4400
4585
  ${this.colsWindowed() ? html`<th class="rdt-col-spacer" aria-hidden="true" style=${rozieStyle("width:" + this.colPadRight() + "px;padding:0;border:0")} data-rozie-s-d5dcab4c></th>` : nothing}</tr>` : nothing}</thead>
4401
4586
 
@@ -4447,7 +4632,24 @@ ${this.groupable ? html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4c>
4447
4632
  this.onToggleExpand(wr.row, $event);
4448
4633
  }} data-rozie-s-d5dcab4c>${rozieDisplay(this.rowIsExpanded(wr.row) ? "▾" : "▸")}</button>
4449
4634
  <span class="rdt-group-value" data-rozie-s-d5dcab4c>
4450
- ${this.cell !== void 0 ? this.cell({
4635
+ ${this.rozieSlots?.[`cell-${cell.column.id}`] !== void 0 ? this.rozieSlots?.[`cell-${cell.column.id}`]({
4636
+ columnId: cell.column.id,
4637
+ column: cell.column,
4638
+ row: this.cellSlotRow(wr.row),
4639
+ value: cell.getValue()
4640
+ }) : html`<slot name="${`cell-${cell.column.id}`}" data-rozie-params=${(() => {
4641
+ try {
4642
+ return JSON.stringify({
4643
+ columnId: cell.column.id,
4644
+ column: cell.column,
4645
+ row: this.cellSlotRow(wr.row),
4646
+ value: cell.getValue()
4647
+ });
4648
+ } catch {
4649
+ return "{}";
4650
+ }
4651
+ })()}>
4652
+ ${this.cell !== void 0 ? this.cell({
4451
4653
  columnId: cell.column.id,
4452
4654
  column: cell.column,
4453
4655
  row: this.cellSlotRow(wr.row),
@@ -4464,11 +4666,55 @@ ${this.groupable ? html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4c>
4464
4666
  return "{}";
4465
4667
  }
4466
4668
  })()}>${rozieDisplay(cell.getValue())}</slot>`}
4669
+ </slot>`}
4467
4670
  </span>
4468
4671
  <span class="rdt-group-count" data-rozie-s-d5dcab4c>${rozieDisplay("(" + this.groupSubRowCount(wr.row) + ")")}</span>
4469
4672
  </span>` : this.isEditing(wr.vi.index, this.colIndexOf(wr.row, cell)) ? html`<span style="display:contents" data-rozie-s-d5dcab4c>
4470
- ${this.hasEditorSlot(cell.column.id) ? html`<span style="display:contents" data-rozie-s-d5dcab4c>
4471
- ${this.editor !== void 0 ? this.editor({
4673
+ ${this.editorTypeOf(cell.column.id) === "number" ? html`<input class="rdt-cell-editor" type="number" data-editing-cell="" data-builtin-editor="" .value=${this.editorValueFor(cell.column.id)} @input=${($event) => {
4674
+ this.onCellEditorInput(cell.column.id, $event);
4675
+ }} @keydown=${($event) => {
4676
+ this.onEditorKeyDown($event);
4677
+ }} @blur=${($event) => {
4678
+ this.onEditorBlur($event);
4679
+ }} data-rozie-s-d5dcab4c />` : this.editorTypeOf(cell.column.id) === "select" ? html`<select class="rdt-cell-editor" data-editing-cell="" data-builtin-editor="" .value=${this.editorValueFor(cell.column.id)} @change=${($event) => {
4680
+ this.onCellEditorInput(cell.column.id, $event);
4681
+ }} @keydown=${($event) => {
4682
+ this.onEditorKeyDown($event);
4683
+ }} @blur=${($event) => {
4684
+ this.onEditorBlur($event);
4685
+ }} data-rozie-s-d5dcab4c>
4686
+ ${repeat(this.editorOptionsOf(cell.column.id), (opt, _idx) => opt.value, (opt, _idx) => html`<option value=${rozieAttr(opt.value)} data-rozie-s-d5dcab4c>${rozieDisplay(opt.label)}</option>`)}
4687
+ </select>` : this.editorTypeOf(cell.column.id) === "checkbox" ? html`<input class="rdt-cell-editor" type="checkbox" data-editing-cell="" data-builtin-editor="" ?checked=${this.editorCheckedFor(cell.column.id)} @change=${($event) => {
4688
+ this.onCellEditorCheckbox(cell.column.id, $event);
4689
+ }} @keydown=${($event) => {
4690
+ this.onEditorKeyDown($event);
4691
+ }} @blur=${($event) => {
4692
+ this.onEditorBlur($event);
4693
+ }} data-rozie-s-d5dcab4c />` : this.editorTypeOf(cell.column.id) === "custom" ? html`<span style="display:contents" data-rozie-s-d5dcab4c>
4694
+ ${this.rozieSlots?.[`editor-${cell.column.id}`] !== void 0 ? this.rozieSlots?.[`editor-${cell.column.id}`]({
4695
+ columnId: cell.column.id,
4696
+ column: cell.column,
4697
+ row: this.cellSlotRow(wr.row),
4698
+ value: this.editorValueFor(cell.column.id),
4699
+ commit: this.editorCommitFor(cell.column.id),
4700
+ cancel: this.editorCancelFor(),
4701
+ autofocus: this.editorAutofocusFor(cell.column.id, wr.vi.index)
4702
+ }) : html`<slot name="${`editor-${cell.column.id}`}" data-rozie-params=${(() => {
4703
+ try {
4704
+ return JSON.stringify({
4705
+ columnId: cell.column.id,
4706
+ column: cell.column,
4707
+ row: this.cellSlotRow(wr.row),
4708
+ value: this.editorValueFor(cell.column.id),
4709
+ commit: this.editorCommitFor(cell.column.id),
4710
+ cancel: this.editorCancelFor(),
4711
+ autofocus: this.editorAutofocusFor(cell.column.id, wr.vi.index)
4712
+ });
4713
+ } catch {
4714
+ return "{}";
4715
+ }
4716
+ })()}>
4717
+ ${this.editor !== void 0 ? this.editor({
4472
4718
  columnId: cell.column.id,
4473
4719
  column: cell.column,
4474
4720
  row: this.cellSlotRow(wr.row),
@@ -4490,35 +4736,41 @@ ${this.groupable ? html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4c>
4490
4736
  } catch {
4491
4737
  return "{}";
4492
4738
  }
4493
- })()}></slot>`}
4494
- </span>` : this.editorTypeOf(cell.column.id) === "number" ? html`<input class="rdt-cell-editor" type="number" data-editing-cell="" .value=${this.editorValueFor(cell.column.id)} @input=${($event) => {
4739
+ })()}>
4740
+ <input class="rdt-cell-editor" type="text" data-editing-cell="" data-builtin-editor="" .value=${this.editorValueFor(cell.column.id)} @input=${($event) => {
4495
4741
  this.onCellEditorInput(cell.column.id, $event);
4496
4742
  }} @keydown=${($event) => {
4497
4743
  this.onEditorKeyDown($event);
4498
4744
  }} @blur=${($event) => {
4499
4745
  this.onEditorBlur($event);
4500
- }} data-rozie-s-d5dcab4c />` : this.editorTypeOf(cell.column.id) === "select" ? html`<select class="rdt-cell-editor" data-editing-cell="" .value=${this.editorValueFor(cell.column.id)} @change=${($event) => {
4501
- this.onCellEditorInput(cell.column.id, $event);
4502
- }} @keydown=${($event) => {
4503
- this.onEditorKeyDown($event);
4504
- }} @blur=${($event) => {
4505
- this.onEditorBlur($event);
4506
- }} data-rozie-s-d5dcab4c>
4507
- ${repeat(this.editorOptionsOf(cell.column.id), (opt, _idx) => opt.value, (opt, _idx) => html`<option value=${rozieAttr(opt.value)} data-rozie-s-d5dcab4c>${rozieDisplay(opt.label)}</option>`)}
4508
- </select>` : this.editorTypeOf(cell.column.id) === "checkbox" ? html`<input class="rdt-cell-editor" type="checkbox" data-editing-cell="" ?checked=${this.editorCheckedFor(cell.column.id)} @change=${($event) => {
4509
- this.onCellEditorCheckbox(cell.column.id, $event);
4510
- }} @keydown=${($event) => {
4511
- this.onEditorKeyDown($event);
4512
- }} @blur=${($event) => {
4513
- this.onEditorBlur($event);
4514
- }} data-rozie-s-d5dcab4c />` : html`<input class="rdt-cell-editor" type="text" data-editing-cell="" .value=${this.editorValueFor(cell.column.id)} @input=${($event) => {
4746
+ }} data-rozie-s-d5dcab4c />
4747
+ </slot>`}
4748
+ </slot>`}
4749
+ </span>` : html`<input class="rdt-cell-editor" type="text" data-editing-cell="" data-builtin-editor="" .value=${this.editorValueFor(cell.column.id)} @input=${($event) => {
4515
4750
  this.onCellEditorInput(cell.column.id, $event);
4516
4751
  }} @keydown=${($event) => {
4517
4752
  this.onEditorKeyDown($event);
4518
4753
  }} @blur=${($event) => {
4519
4754
  this.onEditorBlur($event);
4520
4755
  }} data-rozie-s-d5dcab4c />`}</span>` : this.cellIsPlaceholder(cell) ? html`<span style="display:contents" data-rozie-s-d5dcab4c></span>` : html`<span class="rdt-cell-value" data-rozie-s-d5dcab4c>
4521
- ${this.cell !== void 0 ? this.cell({
4756
+ ${this.rozieSlots?.[`cell-${cell.column.id}`] !== void 0 ? this.rozieSlots?.[`cell-${cell.column.id}`]({
4757
+ columnId: cell.column.id,
4758
+ column: cell.column,
4759
+ row: this.cellSlotRow(wr.row),
4760
+ value: cell.getValue()
4761
+ }) : html`<slot name="${`cell-${cell.column.id}`}" data-rozie-params=${(() => {
4762
+ try {
4763
+ return JSON.stringify({
4764
+ columnId: cell.column.id,
4765
+ column: cell.column,
4766
+ row: this.cellSlotRow(wr.row),
4767
+ value: cell.getValue()
4768
+ });
4769
+ } catch {
4770
+ return "{}";
4771
+ }
4772
+ })()}>
4773
+ ${this.cell !== void 0 ? this.cell({
4522
4774
  columnId: cell.column.id,
4523
4775
  column: cell.column,
4524
4776
  row: this.cellSlotRow(wr.row),
@@ -4535,6 +4787,7 @@ ${this.groupable ? html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4c>
4535
4787
  return "{}";
4536
4788
  }
4537
4789
  })()}>${rozieDisplay(cell.getValue())}</slot>`}
4790
+ </slot>`}
4538
4791
  </span>`}${this.isFillHandleCell(wr.vi.index, this.colIndexOf(wr.row, cell)) ? html`<span class="rdt-fill-handle" data-fill-handle="" data-testid="fill-handle" aria-hidden="true" @pointerdown=${($event) => {
4539
4792
  this.onFillHandlePointerDown($event);
4540
4793
  }} data-rozie-s-d5dcab4c></span>` : nothing}</td>`)}
@@ -4582,7 +4835,7 @@ ${this.groupable ? html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4c>
4582
4835
  "rdt-expander-th": this.isExpanderColumn(header.column.id),
4583
4836
  "rdt-th-resizing": this.columnIsResizing(header.column.id),
4584
4837
  "rdt-cell-active": this.isActiveCell("__header", this.headerColIndexOf(hg, header), hgLevel)
4585
- }).filter(([, v]) => v).map(([k]) => k).join(" ")}" role="columnheader" data-col=${rozieAttr(header.column.id)} data-grid-cell="" data-row="__header" data-header-level=${rozieAttr(hgLevel)} colspan=${rozieAttr(header.colSpan > 1 ? header.colSpan : null)} data-col-index=${rozieAttr(this.headerColIndexOf(hg, header))} tabindex=${rozieAttr(this.cellTabindex("__header", this.headerColIndexOf(hg, header), hgLevel))} aria-sort=${rozieAttr(this.ariaSortFor(header.column.id))} style=${rozieStyle(this.thStyle(header.column.id))} data-rozie-s-d5dcab4c>
4838
+ }).filter(([, v]) => v).map(([k]) => k).join(" ")}" role="columnheader" data-col=${rozieAttr(header.column.id)} data-grid-cell="" data-row="__header" data-header-level=${rozieAttr(hgLevel)} colspan=${rozieAttr(header.colSpan > 1 ? header.colSpan : null)} data-col-index=${rozieAttr(this.headerColIndexOf(hg, header))} tabindex=${rozieAttr(this.cellTabindex("__header", this.headerColIndexOf(hg, header), hgLevel))} aria-sort=${rozieAttr(this.ariaSortFor(header.column.id))} style=${rozieStyle(this.thStyle(header))} data-rozie-s-d5dcab4c>
4586
4839
 
4587
4840
 
4588
4841
  ${this.isSelectColumn(header.column.id) ? html`<span style="display:contents" data-rozie-s-d5dcab4c>
@@ -4611,7 +4864,22 @@ ${this.groupable ? html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4c>
4611
4864
  }} data-rozie-s-d5dcab4c>
4612
4865
 
4613
4866
  <span class="rdt-header-label" data-rozie-s-d5dcab4c>
4614
- ${this.colHeader !== void 0 ? this.colHeader({
4867
+ ${this.rozieSlots?.[`colHeader-${header.column.id}`] !== void 0 ? this.rozieSlots?.[`colHeader-${header.column.id}`]({
4868
+ columnId: header.column.id,
4869
+ column: header.column,
4870
+ label: this.headerLabel(header.column.id)
4871
+ }) : html`<slot name="${`colHeader-${header.column.id}`}" data-rozie-params=${(() => {
4872
+ try {
4873
+ return JSON.stringify({
4874
+ columnId: header.column.id,
4875
+ column: header.column,
4876
+ label: this.headerLabel(header.column.id)
4877
+ });
4878
+ } catch {
4879
+ return "{}";
4880
+ }
4881
+ })()}>
4882
+ ${this.colHeader !== void 0 ? this.colHeader({
4615
4883
  columnId: header.column.id,
4616
4884
  column: header.column,
4617
4885
  label: this.headerLabel(header.column.id)
@@ -4626,11 +4894,27 @@ ${this.groupable ? html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4c>
4626
4894
  return "{}";
4627
4895
  }
4628
4896
  })()}>${rozieDisplay(this.headerLabel(header.column.id))}</slot>`}
4897
+ </slot>`}
4629
4898
  </span>
4630
4899
  <span class="rdt-sort-ind" aria-hidden="true" data-rozie-s-d5dcab4c>${rozieDisplay(this.sortIndicator(header.column.id))}</span>
4631
4900
  </button>` : html`<span style="display:contents" data-rozie-s-d5dcab4c>
4632
4901
  <span class="rdt-header-label" data-rozie-s-d5dcab4c>
4633
- ${this.colHeader !== void 0 ? this.colHeader({
4902
+ ${this.rozieSlots?.[`colHeader-${header.column.id}`] !== void 0 ? this.rozieSlots?.[`colHeader-${header.column.id}`]({
4903
+ columnId: header.column.id,
4904
+ column: header.column,
4905
+ label: this.headerLabel(header.column.id)
4906
+ }) : html`<slot name="${`colHeader-${header.column.id}`}" data-rozie-params=${(() => {
4907
+ try {
4908
+ return JSON.stringify({
4909
+ columnId: header.column.id,
4910
+ column: header.column,
4911
+ label: this.headerLabel(header.column.id)
4912
+ });
4913
+ } catch {
4914
+ return "{}";
4915
+ }
4916
+ })()}>
4917
+ ${this.colHeader !== void 0 ? this.colHeader({
4634
4918
  columnId: header.column.id,
4635
4919
  column: header.column,
4636
4920
  label: this.headerLabel(header.column.id)
@@ -4645,6 +4929,7 @@ ${this.groupable ? html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4c>
4645
4929
  return "{}";
4646
4930
  }
4647
4931
  })()}>${rozieDisplay(this.headerLabel(header.column.id))}</slot>`}
4932
+ </slot>`}
4648
4933
  </span>
4649
4934
  </span>`}<rozie-popover trigger="click" placement="bottom-end" strategy="fixed" .offset=${4} data-rozie-s-d5dcab4c><button class="rdt-col-menu-trigger" type="button" aria-label=${rozieAttr("Column options for " + this.headerLabel(header.column.id))} data-rozie-s-d5dcab4c slot="anchor">⋯</button><div class="rdt-col-menu" role="menu" data-rozie-s-d5dcab4c>
4650
4935
  <button class="rdt-col-menu-item" type="button" role="menuitem" aria-pressed=${this.columnPinSide(header.column.id) === "left"} @click=${($event) => {
@@ -4673,12 +4958,26 @@ ${this.groupable ? html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4c>
4673
4958
  ${this.hasAnyFilterableColumn() ? html`<tr class="rdt-filter-row" data-rozie-s-d5dcab4c>
4674
4959
  ${repeat(this._headerGroups.value[this._headerGroups.value.length - 1].headers, (header, _idx) => header.id, (header, _idx) => html`<th class="rdt-filter-cell" role="presentation" style=${rozieStyle(this.pinStyle(header.column.id))} data-rozie-s-d5dcab4c>
4675
4960
  ${this.isSelectColumn(header.column.id) ? html`<span style="display:contents" data-rozie-s-d5dcab4c></span>` : this.isExpanderColumn(header.column.id) ? html`<span style="display:contents" data-rozie-s-d5dcab4c></span>` : html`<span style="display:contents" data-rozie-s-d5dcab4c>
4676
- ${this.columnIsFilterable(header.column.id) && !this.hasFilterSlot() ? html`<input class="rdt-col-filter" type="text" aria-label=${rozieAttr("Filter " + this.headerLabel(header.column.id))} .value=${this.columnFilterValue(header.column.id)} @input=${($event) => {
4677
- this.onColumnFilterInput(header.column.id, $event);
4678
- }} @click=${($event) => {
4679
- this.stopEvent($event);
4680
- }} data-rozie-s-d5dcab4c />` : nothing}${this.columnIsFilterable(header.column.id) ? html`<span style="display:contents" data-rozie-s-d5dcab4c>
4681
- ${this.filter !== void 0 ? this.filter({
4961
+ ${this.columnIsFilterable(header.column.id) ? html`<span style="display:contents" data-rozie-s-d5dcab4c>
4962
+ ${this.rozieSlots?.[`filter-${header.column.id}`] !== void 0 ? this.rozieSlots?.[`filter-${header.column.id}`]({
4963
+ columnId: header.column.id,
4964
+ value: this.columnFilterValue(header.column.id),
4965
+ uniqueValues: this.getFacetedUniqueValues(header.column.id),
4966
+ minMax: this.getFacetedMinMaxValues(header.column.id),
4967
+ setFilter: this.setColumnFilter
4968
+ }) : html`<slot name="${`filter-${header.column.id}`}" data-rozie-params=${(() => {
4969
+ try {
4970
+ return JSON.stringify({
4971
+ columnId: header.column.id,
4972
+ value: this.columnFilterValue(header.column.id),
4973
+ uniqueValues: this.getFacetedUniqueValues(header.column.id),
4974
+ minMax: this.getFacetedMinMaxValues(header.column.id)
4975
+ });
4976
+ } catch {
4977
+ return "{}";
4978
+ }
4979
+ })()} @rozie-default-set-filter=${($event) => this.setColumnFilter($event.detail)}>
4980
+ ${this.filter !== void 0 ? this.filter({
4682
4981
  columnId: header.column.id,
4683
4982
  value: this.columnFilterValue(header.column.id),
4684
4983
  uniqueValues: this.getFacetedUniqueValues(header.column.id),
@@ -4695,7 +4994,14 @@ ${this.groupable ? html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4c>
4695
4994
  } catch {
4696
4995
  return "{}";
4697
4996
  }
4698
- })()} @rozie-filter-set-filter=${($event) => this.setColumnFilter($event.detail)}></slot>`}
4997
+ })()} @rozie-filter-set-filter=${($event) => this.setColumnFilter($event.detail)}>
4998
+ <input class="rdt-col-filter" type="text" aria-label=${rozieAttr("Filter " + this.headerLabel(header.column.id))} .value=${this.columnFilterValue(header.column.id)} @input=${($event) => {
4999
+ this.onColumnFilterInput(header.column.id, $event);
5000
+ }} @click=${($event) => {
5001
+ this.stopEvent($event);
5002
+ }} data-rozie-s-d5dcab4c />
5003
+ </slot>`}
5004
+ </slot>`}
4699
5005
  </span>` : nothing}</span>`}</th>`)}
4700
5006
  </tr>` : nothing}</thead>
4701
5007
 
@@ -4741,7 +5047,24 @@ ${this.groupable ? html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4c>
4741
5047
  this.onToggleExpand(row, $event);
4742
5048
  }} data-rozie-s-d5dcab4c>${rozieDisplay(this.rowIsExpanded(row) ? "▾" : "▸")}</button>
4743
5049
  <span class="rdt-group-value" data-rozie-s-d5dcab4c>
4744
- ${this.cell !== void 0 ? this.cell({
5050
+ ${this.rozieSlots?.[`cell-${cell.column.id}`] !== void 0 ? this.rozieSlots?.[`cell-${cell.column.id}`]({
5051
+ columnId: cell.column.id,
5052
+ column: cell.column,
5053
+ row: this.cellSlotRow(row),
5054
+ value: cell.getValue()
5055
+ }) : html`<slot name="${`cell-${cell.column.id}`}" data-rozie-params=${(() => {
5056
+ try {
5057
+ return JSON.stringify({
5058
+ columnId: cell.column.id,
5059
+ column: cell.column,
5060
+ row: this.cellSlotRow(row),
5061
+ value: cell.getValue()
5062
+ });
5063
+ } catch {
5064
+ return "{}";
5065
+ }
5066
+ })()}>
5067
+ ${this.cell !== void 0 ? this.cell({
4745
5068
  columnId: cell.column.id,
4746
5069
  column: cell.column,
4747
5070
  row: this.cellSlotRow(row),
@@ -4758,11 +5081,55 @@ ${this.groupable ? html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4c>
4758
5081
  return "{}";
4759
5082
  }
4760
5083
  })()}>${rozieDisplay(cell.getValue())}</slot>`}
5084
+ </slot>`}
4761
5085
  </span>
4762
5086
  <span class="rdt-group-count" data-rozie-s-d5dcab4c>${rozieDisplay("(" + this.groupSubRowCount(row) + ")")}</span>
4763
5087
  </span>` : this.isEditing(this.rowIndexOf(row), this.colIndexOf(row, cell)) ? html`<span style="display:contents" data-rozie-s-d5dcab4c>
4764
- ${this.hasEditorSlot(cell.column.id) ? html`<span style="display:contents" data-rozie-s-d5dcab4c>
4765
- ${this.editor !== void 0 ? this.editor({
5088
+ ${this.editorTypeOf(cell.column.id) === "number" ? html`<input class="rdt-cell-editor" type="number" data-editing-cell="" data-builtin-editor="" .value=${this.editorValueFor(cell.column.id)} @input=${($event) => {
5089
+ this.onCellEditorInput(cell.column.id, $event);
5090
+ }} @keydown=${($event) => {
5091
+ this.onEditorKeyDown($event);
5092
+ }} @blur=${($event) => {
5093
+ this.onEditorBlur($event);
5094
+ }} data-rozie-s-d5dcab4c />` : this.editorTypeOf(cell.column.id) === "select" ? html`<select class="rdt-cell-editor" data-editing-cell="" data-builtin-editor="" .value=${this.editorValueFor(cell.column.id)} @change=${($event) => {
5095
+ this.onCellEditorInput(cell.column.id, $event);
5096
+ }} @keydown=${($event) => {
5097
+ this.onEditorKeyDown($event);
5098
+ }} @blur=${($event) => {
5099
+ this.onEditorBlur($event);
5100
+ }} data-rozie-s-d5dcab4c>
5101
+ ${repeat(this.editorOptionsOf(cell.column.id), (opt, _idx) => opt.value, (opt, _idx) => html`<option value=${rozieAttr(opt.value)} data-rozie-s-d5dcab4c>${rozieDisplay(opt.label)}</option>`)}
5102
+ </select>` : this.editorTypeOf(cell.column.id) === "checkbox" ? html`<input class="rdt-cell-editor" type="checkbox" data-editing-cell="" data-builtin-editor="" ?checked=${this.editorCheckedFor(cell.column.id)} @change=${($event) => {
5103
+ this.onCellEditorCheckbox(cell.column.id, $event);
5104
+ }} @keydown=${($event) => {
5105
+ this.onEditorKeyDown($event);
5106
+ }} @blur=${($event) => {
5107
+ this.onEditorBlur($event);
5108
+ }} data-rozie-s-d5dcab4c />` : this.editorTypeOf(cell.column.id) === "custom" ? html`<span style="display:contents" data-rozie-s-d5dcab4c>
5109
+ ${this.rozieSlots?.[`editor-${cell.column.id}`] !== void 0 ? this.rozieSlots?.[`editor-${cell.column.id}`]({
5110
+ columnId: cell.column.id,
5111
+ column: cell.column,
5112
+ row: this.cellSlotRow(row),
5113
+ value: this.editorValueFor(cell.column.id),
5114
+ commit: this.editorCommitFor(cell.column.id),
5115
+ cancel: this.editorCancelFor(),
5116
+ autofocus: this.editorAutofocusFor(cell.column.id, this.rowIndexOf(row))
5117
+ }) : html`<slot name="${`editor-${cell.column.id}`}" data-rozie-params=${(() => {
5118
+ try {
5119
+ return JSON.stringify({
5120
+ columnId: cell.column.id,
5121
+ column: cell.column,
5122
+ row: this.cellSlotRow(row),
5123
+ value: this.editorValueFor(cell.column.id),
5124
+ commit: this.editorCommitFor(cell.column.id),
5125
+ cancel: this.editorCancelFor(),
5126
+ autofocus: this.editorAutofocusFor(cell.column.id, this.rowIndexOf(row))
5127
+ });
5128
+ } catch {
5129
+ return "{}";
5130
+ }
5131
+ })()}>
5132
+ ${this.editor !== void 0 ? this.editor({
4766
5133
  columnId: cell.column.id,
4767
5134
  column: cell.column,
4768
5135
  row: this.cellSlotRow(row),
@@ -4784,35 +5151,41 @@ ${this.groupable ? html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4c>
4784
5151
  } catch {
4785
5152
  return "{}";
4786
5153
  }
4787
- })()}></slot>`}
4788
- </span>` : this.editorTypeOf(cell.column.id) === "number" ? html`<input class="rdt-cell-editor" type="number" data-editing-cell="" .value=${this.editorValueFor(cell.column.id)} @input=${($event) => {
5154
+ })()}>
5155
+ <input class="rdt-cell-editor" type="text" data-editing-cell="" data-builtin-editor="" .value=${this.editorValueFor(cell.column.id)} @input=${($event) => {
4789
5156
  this.onCellEditorInput(cell.column.id, $event);
4790
5157
  }} @keydown=${($event) => {
4791
5158
  this.onEditorKeyDown($event);
4792
5159
  }} @blur=${($event) => {
4793
5160
  this.onEditorBlur($event);
4794
- }} data-rozie-s-d5dcab4c />` : this.editorTypeOf(cell.column.id) === "select" ? html`<select class="rdt-cell-editor" data-editing-cell="" .value=${this.editorValueFor(cell.column.id)} @change=${($event) => {
4795
- this.onCellEditorInput(cell.column.id, $event);
4796
- }} @keydown=${($event) => {
4797
- this.onEditorKeyDown($event);
4798
- }} @blur=${($event) => {
4799
- this.onEditorBlur($event);
4800
- }} data-rozie-s-d5dcab4c>
4801
- ${repeat(this.editorOptionsOf(cell.column.id), (opt, _idx) => opt.value, (opt, _idx) => html`<option value=${rozieAttr(opt.value)} data-rozie-s-d5dcab4c>${rozieDisplay(opt.label)}</option>`)}
4802
- </select>` : this.editorTypeOf(cell.column.id) === "checkbox" ? html`<input class="rdt-cell-editor" type="checkbox" data-editing-cell="" ?checked=${this.editorCheckedFor(cell.column.id)} @change=${($event) => {
4803
- this.onCellEditorCheckbox(cell.column.id, $event);
4804
- }} @keydown=${($event) => {
4805
- this.onEditorKeyDown($event);
4806
- }} @blur=${($event) => {
4807
- this.onEditorBlur($event);
4808
- }} data-rozie-s-d5dcab4c />` : html`<input class="rdt-cell-editor" type="text" data-editing-cell="" .value=${this.editorValueFor(cell.column.id)} @input=${($event) => {
5161
+ }} data-rozie-s-d5dcab4c />
5162
+ </slot>`}
5163
+ </slot>`}
5164
+ </span>` : html`<input class="rdt-cell-editor" type="text" data-editing-cell="" data-builtin-editor="" .value=${this.editorValueFor(cell.column.id)} @input=${($event) => {
4809
5165
  this.onCellEditorInput(cell.column.id, $event);
4810
5166
  }} @keydown=${($event) => {
4811
5167
  this.onEditorKeyDown($event);
4812
5168
  }} @blur=${($event) => {
4813
5169
  this.onEditorBlur($event);
4814
5170
  }} data-rozie-s-d5dcab4c />`}</span>` : this.cellIsPlaceholder(cell) ? html`<span style="display:contents" data-rozie-s-d5dcab4c></span>` : html`<span class="rdt-cell-value" data-rozie-s-d5dcab4c>
4815
- ${this.cell !== void 0 ? this.cell({
5171
+ ${this.rozieSlots?.[`cell-${cell.column.id}`] !== void 0 ? this.rozieSlots?.[`cell-${cell.column.id}`]({
5172
+ columnId: cell.column.id,
5173
+ column: cell.column,
5174
+ row: this.cellSlotRow(row),
5175
+ value: cell.getValue()
5176
+ }) : html`<slot name="${`cell-${cell.column.id}`}" data-rozie-params=${(() => {
5177
+ try {
5178
+ return JSON.stringify({
5179
+ columnId: cell.column.id,
5180
+ column: cell.column,
5181
+ row: this.cellSlotRow(row),
5182
+ value: cell.getValue()
5183
+ });
5184
+ } catch {
5185
+ return "{}";
5186
+ }
5187
+ })()}>
5188
+ ${this.cell !== void 0 ? this.cell({
4816
5189
  columnId: cell.column.id,
4817
5190
  column: cell.column,
4818
5191
  row: this.cellSlotRow(row),
@@ -4829,6 +5202,7 @@ ${this.groupable ? html`<div class="rdt-group-bar-host" data-rozie-s-d5dcab4c>
4829
5202
  return "{}";
4830
5203
  }
4831
5204
  })()}>${rozieDisplay(cell.getValue())}</slot>`}
5205
+ </slot>`}
4832
5206
  </span>`}${this.isFillHandleCell(this.rowIndexOf(row), this.colIndexOf(row, cell)) ? html`<span class="rdt-fill-handle" data-fill-handle="" data-testid="fill-handle" aria-hidden="true" @pointerdown=${($event) => {
4833
5207
  this.onFillHandlePointerDown($event);
4834
5208
  }} data-rozie-s-d5dcab4c></span>` : nothing}</td>`)}
@@ -5062,6 +5436,26 @@ __decorate([queryAssignedElements({
5062
5436
  flatten: true
5063
5437
  })], DataTable.prototype, "_slotSelectAllElements", void 0);
5064
5438
  __decorate([property({ attribute: false })], DataTable.prototype, "selectAll", void 0);
5439
+ __decorate([state()], DataTable.prototype, "_hasSlotDynamicColHeader", void 0);
5440
+ __decorate([queryAssignedElements({ flatten: true })], DataTable.prototype, "_slotDynamicColHeaderElements", void 0);
5441
+ __decorate([state()], DataTable.prototype, "_hasSlotDynamicFilter", void 0);
5442
+ __decorate([queryAssignedElements({ flatten: true })], DataTable.prototype, "_slotDynamicFilterElements", void 0);
5443
+ __decorate([state()], DataTable.prototype, "_hasSlotSelectCell", void 0);
5444
+ __decorate([queryAssignedElements({
5445
+ slot: "selectCell",
5446
+ flatten: true
5447
+ })], DataTable.prototype, "_slotSelectCellElements", void 0);
5448
+ __decorate([property({ attribute: false })], DataTable.prototype, "selectCell", void 0);
5449
+ __decorate([state()], DataTable.prototype, "_hasSlotDynamicCell", void 0);
5450
+ __decorate([queryAssignedElements({ flatten: true })], DataTable.prototype, "_slotDynamicCellElements", void 0);
5451
+ __decorate([state()], DataTable.prototype, "_hasSlotDynamicEditor", void 0);
5452
+ __decorate([queryAssignedElements({ flatten: true })], DataTable.prototype, "_slotDynamicEditorElements", void 0);
5453
+ __decorate([state()], DataTable.prototype, "_hasSlotDetail", void 0);
5454
+ __decorate([queryAssignedElements({
5455
+ slot: "detail",
5456
+ flatten: true
5457
+ })], DataTable.prototype, "_slotDetailElements", void 0);
5458
+ __decorate([property({ attribute: false })], DataTable.prototype, "detail", void 0);
5065
5459
  __decorate([state()], DataTable.prototype, "_hasSlotColHeader", void 0);
5066
5460
  __decorate([queryAssignedElements({
5067
5461
  slot: "colHeader",
@@ -5074,12 +5468,6 @@ __decorate([queryAssignedElements({
5074
5468
  flatten: true
5075
5469
  })], DataTable.prototype, "_slotFilterElements", void 0);
5076
5470
  __decorate([property({ attribute: false })], DataTable.prototype, "filter", void 0);
5077
- __decorate([state()], DataTable.prototype, "_hasSlotSelectCell", void 0);
5078
- __decorate([queryAssignedElements({
5079
- slot: "selectCell",
5080
- flatten: true
5081
- })], DataTable.prototype, "_slotSelectCellElements", void 0);
5082
- __decorate([property({ attribute: false })], DataTable.prototype, "selectCell", void 0);
5083
5471
  __decorate([state()], DataTable.prototype, "_hasSlotCell", void 0);
5084
5472
  __decorate([queryAssignedElements({
5085
5473
  slot: "cell",
@@ -5092,12 +5480,6 @@ __decorate([queryAssignedElements({
5092
5480
  flatten: true
5093
5481
  })], DataTable.prototype, "_slotEditorElements", void 0);
5094
5482
  __decorate([property({ attribute: false })], DataTable.prototype, "editor", void 0);
5095
- __decorate([state()], DataTable.prototype, "_hasSlotDetail", void 0);
5096
- __decorate([queryAssignedElements({
5097
- slot: "detail",
5098
- flatten: true
5099
- })], DataTable.prototype, "_slotDetailElements", void 0);
5100
- __decorate([property({ attribute: false })], DataTable.prototype, "detail", void 0);
5101
5483
  __decorate([property({ attribute: false })], DataTable.prototype, "rozieSlots", void 0);
5102
5484
  DataTable = __decorate([customElement("rozie-data-table")], DataTable);
5103
5485
  var DataTable_default = DataTable;