@toolbox-web/grid 1.5.0 → 1.6.1

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.
Files changed (82) hide show
  1. package/all.js +854 -638
  2. package/all.js.map +1 -1
  3. package/index.js +513 -495
  4. package/index.js.map +1 -1
  5. package/lib/core/internal/header.d.ts.map +1 -1
  6. package/lib/core/internal/rows.d.ts +8 -0
  7. package/lib/core/internal/rows.d.ts.map +1 -1
  8. package/lib/core/types.d.ts +82 -17
  9. package/lib/core/types.d.ts.map +1 -1
  10. package/lib/plugins/clipboard/index.js.map +1 -1
  11. package/lib/plugins/column-virtualization/index.js.map +1 -1
  12. package/lib/plugins/context-menu/ContextMenuPlugin.d.ts +11 -0
  13. package/lib/plugins/context-menu/ContextMenuPlugin.d.ts.map +1 -1
  14. package/lib/plugins/context-menu/index.js +136 -77
  15. package/lib/plugins/context-menu/index.js.map +1 -1
  16. package/lib/plugins/editing/index.js.map +1 -1
  17. package/lib/plugins/editing/types.d.ts +68 -0
  18. package/lib/plugins/editing/types.d.ts.map +1 -1
  19. package/lib/plugins/export/index.js.map +1 -1
  20. package/lib/plugins/filtering/FilteringPlugin.d.ts +18 -1
  21. package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -1
  22. package/lib/plugins/filtering/index.d.ts +1 -1
  23. package/lib/plugins/filtering/index.d.ts.map +1 -1
  24. package/lib/plugins/filtering/index.js +313 -183
  25. package/lib/plugins/filtering/index.js.map +1 -1
  26. package/lib/plugins/filtering/types.d.ts +81 -2
  27. package/lib/plugins/filtering/types.d.ts.map +1 -1
  28. package/lib/plugins/grouping-columns/index.js.map +1 -1
  29. package/lib/plugins/grouping-rows/index.js.map +1 -1
  30. package/lib/plugins/master-detail/index.js.map +1 -1
  31. package/lib/plugins/multi-sort/index.js +11 -11
  32. package/lib/plugins/multi-sort/index.js.map +1 -1
  33. package/lib/plugins/pinned-columns/index.js.map +1 -1
  34. package/lib/plugins/pinned-rows/index.js.map +1 -1
  35. package/lib/plugins/pivot/PivotPlugin.d.ts +2 -0
  36. package/lib/plugins/pivot/PivotPlugin.d.ts.map +1 -1
  37. package/lib/plugins/pivot/index.js +29 -27
  38. package/lib/plugins/pivot/index.js.map +1 -1
  39. package/lib/plugins/print/index.js +1 -1
  40. package/lib/plugins/print/index.js.map +1 -1
  41. package/lib/plugins/reorder/index.js.map +1 -1
  42. package/lib/plugins/responsive/index.js.map +1 -1
  43. package/lib/plugins/row-reorder/RowReorderPlugin.d.ts +18 -0
  44. package/lib/plugins/row-reorder/RowReorderPlugin.d.ts.map +1 -1
  45. package/lib/plugins/row-reorder/index.js +132 -72
  46. package/lib/plugins/row-reorder/index.js.map +1 -1
  47. package/lib/plugins/selection/SelectionPlugin.d.ts +5 -0
  48. package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
  49. package/lib/plugins/selection/index.js +91 -78
  50. package/lib/plugins/selection/index.js.map +1 -1
  51. package/lib/plugins/selection/types.d.ts +45 -0
  52. package/lib/plugins/selection/types.d.ts.map +1 -1
  53. package/lib/plugins/server-side/index.js.map +1 -1
  54. package/lib/plugins/tree/index.js.map +1 -1
  55. package/lib/plugins/undo-redo/index.js.map +1 -1
  56. package/lib/plugins/visibility/index.js +7 -7
  57. package/lib/plugins/visibility/index.js.map +1 -1
  58. package/package.json +1 -1
  59. package/themes/dg-theme-bootstrap.css +60 -33
  60. package/themes/dg-theme-material.css +83 -52
  61. package/themes/dg-theme-standard.css +80 -12
  62. package/themes/dg-theme-vibrant.css +78 -9
  63. package/umd/grid.all.umd.js +24 -24
  64. package/umd/grid.all.umd.js.map +1 -1
  65. package/umd/grid.umd.js +10 -10
  66. package/umd/grid.umd.js.map +1 -1
  67. package/umd/plugins/context-menu.umd.js +1 -1
  68. package/umd/plugins/context-menu.umd.js.map +1 -1
  69. package/umd/plugins/filtering.umd.js +1 -1
  70. package/umd/plugins/filtering.umd.js.map +1 -1
  71. package/umd/plugins/multi-sort.umd.js +1 -1
  72. package/umd/plugins/multi-sort.umd.js.map +1 -1
  73. package/umd/plugins/pivot.umd.js +1 -1
  74. package/umd/plugins/pivot.umd.js.map +1 -1
  75. package/umd/plugins/print.umd.js +1 -1
  76. package/umd/plugins/print.umd.js.map +1 -1
  77. package/umd/plugins/row-reorder.umd.js +1 -1
  78. package/umd/plugins/row-reorder.umd.js.map +1 -1
  79. package/umd/plugins/selection.umd.js +2 -2
  80. package/umd/plugins/selection.umd.js.map +1 -1
  81. package/umd/plugins/visibility.umd.js +1 -1
  82. package/umd/plugins/visibility.umd.js.map +1 -1
package/all.js CHANGED
@@ -1,20 +1,20 @@
1
- import { BaseGridPlugin as R, DEFAULT_GRID_ICONS as Je, a as Qe, runAggregator as j, e as et, s as tt, PLUGIN_QUERIES as We, getAggregator as ge, getValueAggregator as it, b as _, c as fe, g as nt } from "./index.js";
2
- import { DEFAULT_ANIMATION_CONFIG as Rn, DGEvents as En, DataGridElement as Sn, FitModeEnum as kn, GridCSSVars as An, GridClasses as _n, GridDataAttrs as Ln, DataGridElement as Tn, GridSelectors as In, PluginEvents as Pn, PluginManager as Dn, RenderPhase as Fn, builtInSort as Mn, createGrid as qn, defaultComparator as Kn, queryGrid as Nn } from "./index.js";
3
- const $e = "__tbw_expander", rt = 32;
4
- function ae(s) {
5
- return s.field === $e;
1
+ import { BaseGridPlugin as _, DEFAULT_GRID_ICONS as at, a as lt, runAggregator as te, e as dt, s as ct, PLUGIN_QUERIES as Je, getAggregator as ye, getValueAggregator as ut, b as D, c as xe, g as ht } from "./index.js";
2
+ import { DEFAULT_ANIMATION_CONFIG as Fn, DGEvents as In, DataGridElement as Pn, FitModeEnum as Dn, GridCSSVars as Mn, GridClasses as Nn, GridDataAttrs as qn, DataGridElement as Hn, GridSelectors as zn, PluginEvents as Kn, PluginManager as On, RenderPhase as Gn, builtInSort as Bn, createGrid as Vn, defaultComparator as Wn, queryGrid as $n } from "./index.js";
3
+ const Qe = "__tbw_expander", gt = 32;
4
+ function pe(s) {
5
+ return s.field === Qe;
6
6
  }
7
- function I(s) {
7
+ function H(s) {
8
8
  return s.meta?.utility === !0;
9
9
  }
10
- function ot(s) {
11
- return s.find(ae);
10
+ function ft(s) {
11
+ return s.find(pe);
12
12
  }
13
- function st(s) {
13
+ function pt(s) {
14
14
  return {
15
- field: $e,
15
+ field: Qe,
16
16
  header: "",
17
- width: rt,
17
+ width: gt,
18
18
  resizable: !1,
19
19
  sortable: !1,
20
20
  filterable: !1,
@@ -27,7 +27,7 @@ function st(s) {
27
27
  }
28
28
  };
29
29
  }
30
- async function U(s) {
30
+ async function ie(s) {
31
31
  try {
32
32
  return await navigator.clipboard.writeText(s), !0;
33
33
  } catch {
@@ -37,7 +37,7 @@ async function U(s) {
37
37
  return document.body.removeChild(e), t;
38
38
  }
39
39
  }
40
- function pe(s, e) {
40
+ function Ce(s, e) {
41
41
  const t = e.delimiter ?? " ", i = e.newline ?? `
42
42
  `, n = s.replace(/\r\n/g, `
43
43
  `).replace(/\r/g, `
@@ -49,14 +49,14 @@ function pe(s, e) {
49
49
  }
50
50
  return o.push(a), (o.length > 1 || o.some((d) => d.trim() !== "")) && r.push(o), r;
51
51
  }
52
- async function at() {
52
+ async function mt() {
53
53
  try {
54
54
  return await navigator.clipboard.readText();
55
55
  } catch {
56
56
  return "";
57
57
  }
58
58
  }
59
- function lt(s, e) {
59
+ function wt(s, e) {
60
60
  const { rows: t, target: i, fields: n } = s;
61
61
  if (!i) return;
62
62
  const r = e.rows, o = e.effectiveConfig.columns ?? [], a = o.map((u) => u.field), l = /* @__PURE__ */ new Map();
@@ -75,13 +75,13 @@ function lt(s, e) {
75
75
  a.forEach((p) => f[p] = ""), d.push(f);
76
76
  }
77
77
  d[g] = { ...d[g] }, u.forEach((f, p) => {
78
- const m = n[p];
79
- m && l.get(m) && (d[g][m] = f);
78
+ const w = n[p];
79
+ w && l.get(w) && (d[g][w] = f);
80
80
  });
81
81
  }
82
82
  }), e.rows = d;
83
83
  }
84
- class nn extends R {
84
+ class hn extends _ {
85
85
  static dependencies = [
86
86
  { name: "selection", required: !1, reason: "Enables copy/paste of selected cells instead of entire grid" }
87
87
  ];
@@ -133,7 +133,7 @@ class nn extends R {
133
133
  o = { startRow: l.row, startCol: l.col, endRow: l.row, endCol: l.col };
134
134
  }
135
135
  const a = this.#i(o);
136
- U(a.text).then(() => {
136
+ ie(a.text).then(() => {
137
137
  this.lastCopied = { text: a.text, timestamp: Date.now() }, this.emit("copy", {
138
138
  text: a.text,
139
139
  rowCount: a.rowCount,
@@ -145,19 +145,19 @@ class nn extends R {
145
145
  const t = e.clipboardData?.getData("text/plain");
146
146
  if (!t) return;
147
147
  e.preventDefault();
148
- const i = pe(t, this.config), r = this.#n()?.getSelection(), o = r?.ranges?.[0], a = o?.from.row ?? 0, l = o?.from.col ?? 0, c = o && (r?.mode === "range" || r?.mode === "row") && (o.from.row !== o.to.row || o.from.col !== o.to.col) ? { endRow: o.to.row, endCol: o.to.col } : null, u = c?.endCol ?? this.columns.length - 1, h = this.columns[l], g = h ? { row: a, col: l, field: h.field, bounds: c } : null, f = [], p = i[0]?.length ?? 0;
149
- for (let w = 0; w < p && l + w <= u; w++) {
150
- const b = this.columns[l + w];
151
- b && !b.hidden && f.push(b.field);
148
+ const i = Ce(t, this.config), r = this.#n()?.getSelection(), o = r?.ranges?.[0], a = o?.from.row ?? 0, l = o?.from.col ?? 0, c = o && (r?.mode === "range" || r?.mode === "row") && (o.from.row !== o.to.row || o.from.col !== o.to.col) ? { endRow: o.to.row, endCol: o.to.col } : null, u = c?.endCol ?? this.columns.length - 1, h = this.columns[l], g = h ? { row: a, col: l, field: h.field, bounds: c } : null, f = [], p = i[0]?.length ?? 0;
149
+ for (let v = 0; v < p && l + v <= u; v++) {
150
+ const y = this.columns[l + v];
151
+ y && !y.hidden && f.push(y.field);
152
152
  }
153
- const m = { rows: i, text: t, target: g, fields: f };
154
- this.emit("paste", m), this.#o(m);
153
+ const w = { rows: i, text: t, target: g, fields: f };
154
+ this.emit("paste", w), this.#o(w);
155
155
  }
156
156
  #o(e) {
157
157
  if (!this.grid) return;
158
158
  const { pasteHandler: t } = this.config;
159
159
  if (t === null) return;
160
- (t ?? lt)(e, this.grid);
160
+ (t ?? wt)(e, this.grid);
161
161
  }
162
162
  #n() {
163
163
  try {
@@ -169,7 +169,7 @@ class nn extends R {
169
169
  }
170
170
  #i(e) {
171
171
  const { startRow: t, startCol: i, endRow: n, endCol: r } = e, o = Math.min(t, n), a = Math.max(t, n), l = Math.min(i, r), d = Math.max(i, r), c = this.config.delimiter ?? " ", u = this.config.newline ?? `
172
- `, h = [], g = this.columns.slice(l, d + 1).filter((f) => !I(f));
172
+ `, h = [], g = this.columns.slice(l, d + 1).filter((f) => !H(f));
173
173
  if (this.config.includeHeaders) {
174
174
  const f = g.map((p) => p.header || p.field);
175
175
  h.push(f.join(c));
@@ -177,11 +177,11 @@ class nn extends R {
177
177
  for (let f = o; f <= a; f++) {
178
178
  const p = this.rows[f];
179
179
  if (!p) continue;
180
- const m = g.map((w) => {
181
- const b = p[w.field];
182
- return b == null ? "" : b instanceof Date ? b.toISOString() : String(b);
180
+ const w = g.map((v) => {
181
+ const y = p[v.field];
182
+ return y == null ? "" : y instanceof Date ? y.toISOString() : String(y);
183
183
  });
184
- h.push(m.join(c));
184
+ h.push(w.join(c));
185
185
  }
186
186
  return {
187
187
  text: h.join(u),
@@ -212,7 +212,7 @@ class nn extends R {
212
212
  };
213
213
  }
214
214
  const r = this.#i(n);
215
- return await U(r.text), this.lastCopied = { text: r.text, timestamp: Date.now() }, r.text;
215
+ return await ie(r.text), this.lastCopied = { text: r.text, timestamp: Date.now() }, r.text;
216
216
  }
217
217
  async copyRows(e) {
218
218
  if (e.length === 0) return "";
@@ -222,43 +222,43 @@ class nn extends R {
222
222
  endRow: t[t.length - 1],
223
223
  endCol: i
224
224
  }, r = this.#i(n);
225
- return await U(r.text), this.lastCopied = { text: r.text, timestamp: Date.now() }, r.text;
225
+ return await ie(r.text), this.lastCopied = { text: r.text, timestamp: Date.now() }, r.text;
226
226
  }
227
227
  async paste() {
228
- const e = await at();
229
- return e ? pe(e, this.config) : null;
228
+ const e = await mt();
229
+ return e ? Ce(e, this.config) : null;
230
230
  }
231
231
  getLastCopied() {
232
232
  return this.lastCopied;
233
233
  }
234
234
  }
235
- const me = 100;
236
- function le(s) {
235
+ const Ee = 100;
236
+ function me(s) {
237
237
  if (s == null)
238
- return me;
238
+ return Ee;
239
239
  if (typeof s == "number")
240
240
  return s;
241
241
  const e = parseFloat(s);
242
- return isNaN(e) ? me : e;
242
+ return isNaN(e) ? Ee : e;
243
243
  }
244
- function we(s) {
245
- return s.map((e) => le(e.width));
244
+ function Re(s) {
245
+ return s.map((e) => me(e.width));
246
246
  }
247
- function be(s) {
247
+ function Se(s) {
248
248
  const e = [];
249
249
  let t = 0;
250
250
  for (const i of s)
251
- e.push(t), t += le(i.width);
251
+ e.push(t), t += me(i.width);
252
252
  return e;
253
253
  }
254
- function ve(s) {
255
- return s.reduce((e, t) => e + le(t.width), 0);
254
+ function ke(s) {
255
+ return s.reduce((e, t) => e + me(t.width), 0);
256
256
  }
257
- function dt(s, e, t, i, n) {
257
+ function bt(s, e, t, i, n) {
258
258
  const r = t.length;
259
259
  if (r === 0)
260
260
  return { startCol: 0, endCol: 0, visibleColumns: [] };
261
- let o = ct(s, t, i);
261
+ let o = vt(s, t, i);
262
262
  o = Math.max(0, o - n);
263
263
  const a = s + e;
264
264
  let l = o;
@@ -275,7 +275,7 @@ function dt(s, e, t, i, n) {
275
275
  d.push(c);
276
276
  return { startCol: o, endCol: l, visibleColumns: d };
277
277
  }
278
- function ct(s, e, t) {
278
+ function vt(s, e, t) {
279
279
  let i = 0, n = e.length - 1;
280
280
  for (; i < n; ) {
281
281
  const r = Math.floor((i + n) / 2);
@@ -283,10 +283,10 @@ function ct(s, e, t) {
283
283
  }
284
284
  return i;
285
285
  }
286
- function ut(s, e, t) {
286
+ function yt(s, e, t) {
287
287
  return t ? s > e : !1;
288
288
  }
289
- class rn extends R {
289
+ class gn extends _ {
290
290
  name = "columnVirtualization";
291
291
  get defaultConfig() {
292
292
  return {
@@ -305,16 +305,16 @@ class rn extends R {
305
305
  attach(e) {
306
306
  super.attach(e);
307
307
  const t = this.columns;
308
- this.columnWidths = we(t), this.columnOffsets = be(t), this.totalWidth = ve(t), this.endCol = t.length - 1;
308
+ this.columnWidths = Re(t), this.columnOffsets = Se(t), this.totalWidth = ke(t), this.endCol = t.length - 1;
309
309
  }
310
310
  detach() {
311
311
  this.columnWidths = [], this.columnOffsets = [], this.isVirtualized = !1, this.startCol = 0, this.endCol = 0, this.scrollLeft = 0, this.totalWidth = 0;
312
312
  }
313
313
  processColumns(e) {
314
- const t = ut(e.length, this.config.threshold ?? 30, this.config.autoEnable ?? !0);
315
- if (this.isVirtualized = t ?? !1, this.columnWidths = we(e), this.columnOffsets = be(e), this.totalWidth = ve(e), !t)
314
+ const t = yt(e.length, this.config.threshold ?? 30, this.config.autoEnable ?? !0);
315
+ if (this.isVirtualized = t ?? !1, this.columnWidths = Re(e), this.columnOffsets = Se(e), this.totalWidth = ke(e), !t)
316
316
  return this.startCol = 0, this.endCol = e.length - 1, [...e];
317
- const i = this.grid.clientWidth || 800, n = dt(
317
+ const i = this.grid.clientWidth || 800, n = bt(
318
318
  this.scrollLeft,
319
319
  i,
320
320
  this.columnOffsets,
@@ -354,14 +354,14 @@ class rn extends R {
354
354
  return this.totalWidth;
355
355
  }
356
356
  }
357
- const Y = "@layer tbw-plugins{.tbw-context-menu{position:fixed;background:var(--tbw-context-menu-bg, var(--tbw-color-panel-bg, light-dark(#f5f5f5, #2a2a2a)));color:var(--tbw-context-menu-fg, var(--tbw-color-fg, light-dark(#222, #eee)));border:1px solid var(--tbw-context-menu-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:var(--tbw-border-radius, .25rem);box-shadow:0 2px 10px var(--tbw-color-shadow, rgba(0, 0, 0, .15));min-width:var(--tbw-menu-min-width, 10rem);padding:var(--tbw-spacing-xs, .25rem) 0;z-index:10000;font-size:var(--tbw-font-size-sm, .8125rem);font-family:var(--tbw-font-family, system-ui, sans-serif)}.tbw-context-menu-item{display:flex;align-items:center;padding:var(--tbw-menu-item-padding, .375rem .75rem);cursor:pointer;gap:var(--tbw-menu-item-gap, .5rem)}.tbw-context-menu-item:hover:not(.disabled){background:var(--tbw-context-menu-hover, var(--tbw-color-row-hover, light-dark(#e8e8e8, #3a3a3a)))}.tbw-context-menu-item.disabled{opacity:.5;cursor:default}.tbw-context-menu-item.danger{color:light-dark(#c00,#f66)}.tbw-context-menu-icon{width:var(--tbw-icon-size, 1rem);text-align:center}.tbw-context-menu-label{flex:1}.tbw-context-menu-shortcut{color:var(--tbw-color-fg-muted, light-dark(#888, #888));font-size:var(--tbw-font-size-xs, .6875rem)}.tbw-context-menu-arrow{font-size:var(--tbw-font-size-2xs, .625rem);color:var(--tbw-color-fg-muted, light-dark(#888, #888))}.tbw-context-menu-separator{height:1px;background:var(--tbw-context-menu-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));margin:var(--tbw-spacing-xs, .25rem) 0}}";
358
- function re(s, e) {
357
+ const ne = "@layer tbw-plugins{.tbw-context-menu{position:fixed;background:var(--tbw-context-menu-bg, var(--tbw-color-panel-bg));color:var(--tbw-context-menu-fg, var(--tbw-color-fg));border:1px solid var(--tbw-context-menu-border, var(--tbw-color-border));border-radius:var(--tbw-context-menu-radius, var(--tbw-border-radius));box-shadow:0 2px 10px var(--tbw-context-menu-shadow, var(--tbw-color-shadow));min-width:var(--tbw-context-menu-min-width, var(--tbw-menu-min-width));padding:var(--tbw-spacing-xs) 0;z-index:10000;font-size:var(--tbw-context-menu-font-size, var(--tbw-font-size-sm));font-family:var(--tbw-context-menu-font-family, var(--tbw-font-family))}.tbw-context-menu-item{display:flex;align-items:center;padding:var(--tbw-context-menu-item-padding, var(--tbw-menu-item-padding));cursor:pointer;gap:var(--tbw-context-menu-item-gap, var(--tbw-menu-item-gap))}.tbw-context-menu-item:hover:not(.disabled){background:var(--tbw-context-menu-hover, var(--tbw-color-row-hover))}.tbw-context-menu-item.disabled{opacity:.5;cursor:default}.tbw-context-menu-item.danger{color:var(--tbw-context-menu-danger, var(--tbw-color-danger))}.tbw-context-menu-icon{width:var(--tbw-context-menu-icon-size, var(--tbw-icon-size));text-align:center}.tbw-context-menu-label{flex:1}.tbw-context-menu-shortcut{color:var(--tbw-context-menu-muted, var(--tbw-color-fg-muted));font-size:var(--tbw-context-menu-shortcut-size, var(--tbw-font-size-xs))}.tbw-context-menu-arrow{font-size:var(--tbw-context-menu-arrow-size, var(--tbw-font-size-2xs));color:var(--tbw-context-menu-muted, var(--tbw-color-fg-muted))}.tbw-context-menu-separator{height:1px;background:var(--tbw-context-menu-border, var(--tbw-color-border));margin:var(--tbw-spacing-xs) 0}}";
358
+ function he(s, e) {
359
359
  return (typeof s == "function" ? s(e) : s).filter((i) => !(i.hidden === !0 || typeof i.hidden == "function" && i.hidden(e)));
360
360
  }
361
- function ht(s, e) {
361
+ function xt(s, e) {
362
362
  return s.disabled === !0 ? !0 : typeof s.disabled == "function" ? s.disabled(e) : !1;
363
363
  }
364
- function oe(s, e, t, i = Je.submenuArrow) {
364
+ function ge(s, e, t, i = at.submenuArrow) {
365
365
  const n = document.createElement("div");
366
366
  n.className = "tbw-context-menu", n.setAttribute("role", "menu");
367
367
  for (const r of s) {
@@ -372,7 +372,7 @@ function oe(s, e, t, i = Je.submenuArrow) {
372
372
  }
373
373
  const o = document.createElement("div");
374
374
  o.className = "tbw-context-menu-item", r.cssClass && o.classList.add(r.cssClass), o.setAttribute("role", "menuitem"), o.setAttribute("data-id", r.id);
375
- const a = ht(r, e);
375
+ const a = xt(r, e);
376
376
  if (a && (o.classList.add("disabled"), o.setAttribute("aria-disabled", "true")), r.icon) {
377
377
  const d = document.createElement("span");
378
378
  d.className = "tbw-context-menu-icon", d.innerHTML = r.icon, o.appendChild(d);
@@ -386,7 +386,7 @@ function oe(s, e, t, i = Je.submenuArrow) {
386
386
  const d = document.createElement("span");
387
387
  d.className = "tbw-context-menu-arrow", typeof i == "string" ? d.innerHTML = i : i instanceof HTMLElement && d.appendChild(i.cloneNode(!0)), o.appendChild(d), o.addEventListener("mouseenter", () => {
388
388
  if (o.querySelector(".tbw-context-menu") || !r.subMenu) return;
389
- const u = re(r.subMenu, e), h = oe(u, e, t, i);
389
+ const u = he(r.subMenu, e), h = ge(u, e, t, i);
390
390
  h.classList.add("tbw-context-submenu"), h.style.position = "absolute", h.style.left = "100%", h.style.top = "0", o.style.position = "relative", o.appendChild(h);
391
391
  }), o.addEventListener("mouseleave", () => {
392
392
  const c = o.querySelector(".tbw-context-menu");
@@ -399,14 +399,14 @@ function oe(s, e, t, i = Je.submenuArrow) {
399
399
  }
400
400
  return n;
401
401
  }
402
- function ye(s, e, t) {
402
+ function Ae(s, e, t) {
403
403
  s.style.position = "fixed", s.style.left = `${e}px`, s.style.top = `${t}px`, s.style.visibility = "hidden", s.style.zIndex = "10000";
404
404
  const i = s.getBoundingClientRect(), n = window.innerWidth, r = window.innerHeight;
405
405
  let o = e, a = t;
406
406
  e + i.width > n && (o = e - i.width), t + i.height > r && (a = t - i.height), o = Math.max(0, o), a = Math.max(0, a), s.style.left = `${o}px`, s.style.top = `${a}px`, s.style.visibility = "visible";
407
407
  }
408
- let P = null, D = null, L = null, X = 0;
409
- const Z = [
408
+ let K = null, O = null, N = null, re = 0;
409
+ const oe = [
410
410
  {
411
411
  id: "copy",
412
412
  name: "Copy",
@@ -424,11 +424,11 @@ const Z = [
424
424
  }
425
425
  }
426
426
  ];
427
- class on extends R {
427
+ class et extends _ {
428
428
  name = "contextMenu";
429
429
  get defaultConfig() {
430
430
  return {
431
- items: Z
431
+ items: oe
432
432
  };
433
433
  }
434
434
  isOpen = !1;
@@ -436,20 +436,68 @@ class on extends R {
436
436
  params = null;
437
437
  menuElement = null;
438
438
  attach(e) {
439
- super.attach(e), this.installGlobalHandlers(), X++;
439
+ super.attach(e), this.installGlobalHandlers(), re++;
440
440
  }
441
441
  detach() {
442
442
  this.menuElement && (this.menuElement.remove(), this.menuElement = null), this.isOpen = !1, this.params = null, this.uninstallGlobalHandlers();
443
443
  }
444
+ static CSS_VARS_TO_COPY = [
445
+ "--tbw-color-panel-bg",
446
+ "--tbw-color-fg",
447
+ "--tbw-color-fg-muted",
448
+ "--tbw-color-border",
449
+ "--tbw-color-row-hover",
450
+ "--tbw-color-shadow",
451
+ "--tbw-color-danger",
452
+ "--tbw-border-radius",
453
+ "--tbw-font-family",
454
+ "--tbw-font-size-sm",
455
+ "--tbw-font-size-xs",
456
+ "--tbw-font-size-2xs",
457
+ "--tbw-spacing-xs",
458
+ "--tbw-icon-size",
459
+ "--tbw-menu-min-width",
460
+ "--tbw-menu-item-padding",
461
+ "--tbw-menu-item-gap",
462
+ "--tbw-context-menu-bg",
463
+ "--tbw-context-menu-fg",
464
+ "--tbw-context-menu-border",
465
+ "--tbw-context-menu-radius",
466
+ "--tbw-context-menu-shadow",
467
+ "--tbw-context-menu-hover",
468
+ "--tbw-context-menu-danger",
469
+ "--tbw-context-menu-muted",
470
+ "--tbw-context-menu-min-width",
471
+ "--tbw-context-menu-font-size",
472
+ "--tbw-context-menu-font-family",
473
+ "--tbw-context-menu-item-padding",
474
+ "--tbw-context-menu-item-gap",
475
+ "--tbw-context-menu-icon-size",
476
+ "--tbw-context-menu-shortcut-size",
477
+ "--tbw-context-menu-arrow-size"
478
+ ];
479
+ copyGridStyles(e) {
480
+ const t = this.gridElement;
481
+ if (!t) return;
482
+ const i = getComputedStyle(t), n = [];
483
+ for (const r of et.CSS_VARS_TO_COPY) {
484
+ const o = i.getPropertyValue(r).trim();
485
+ o && n.push(`${r}: ${o}`);
486
+ }
487
+ if (n.length > 0) {
488
+ const r = e.getAttribute("style") || "";
489
+ e.setAttribute("style", r + n.join("; ") + ";");
490
+ }
491
+ }
444
492
  installGlobalHandlers() {
445
- !L && typeof document < "u" && typeof Y == "string" && Y && (L = document.createElement("style"), L.id = "tbw-context-menu-styles", L.textContent = Y, document.head.appendChild(L)), P || (P = () => {
493
+ !N && typeof document < "u" && typeof ne == "string" && ne && (N = document.createElement("style"), N.id = "tbw-context-menu-styles", N.textContent = ne, document.head.appendChild(N)), K || (K = () => {
446
494
  document.querySelectorAll(".tbw-context-menu").forEach((t) => t.remove());
447
- }, document.addEventListener("click", P)), D || (D = (e) => {
495
+ }, document.addEventListener("click", K)), O || (O = (e) => {
448
496
  e.key === "Escape" && document.querySelectorAll(".tbw-context-menu").forEach((i) => i.remove());
449
- }, document.addEventListener("keydown", D));
497
+ }, document.addEventListener("keydown", O));
450
498
  }
451
499
  uninstallGlobalHandlers() {
452
- X--, !(X > 0) && (P && (document.removeEventListener("click", P), P = null), D && (document.removeEventListener("keydown", D), D = null), L && (L.remove(), L = null));
500
+ re--, !(re > 0) && (K && (document.removeEventListener("click", K), K = null), O && (document.removeEventListener("keydown", O), O = null), N && (N.remove(), N = null));
453
501
  }
454
502
  afterRender() {
455
503
  const e = this.gridElement;
@@ -487,15 +535,15 @@ class on extends R {
487
535
  } else
488
536
  return;
489
537
  this.params = l, this.position = { x: n.clientX, y: n.clientY };
490
- const d = re(this.config.items ?? Z, l);
491
- d.length && (this.menuElement && this.menuElement.remove(), this.menuElement = oe(
538
+ const d = he(this.config.items ?? oe, l);
539
+ d.length && (this.menuElement && this.menuElement.remove(), this.menuElement = ge(
492
540
  d,
493
541
  l,
494
542
  (c) => {
495
543
  c.action && c.action(l), this.menuElement?.remove(), this.menuElement = null, this.isOpen = !1;
496
544
  },
497
545
  this.gridIcons.submenuArrow
498
- ), document.body.appendChild(this.menuElement), ye(this.menuElement, n.clientX, n.clientY), this.isOpen = !0, this.emit("context-menu-open", { params: l, items: d }));
546
+ ), document.body.appendChild(this.menuElement), this.copyGridStyles(this.menuElement), Ae(this.menuElement, n.clientX, n.clientY), this.isOpen = !0, this.emit("context-menu-open", { params: l, items: d }));
499
547
  }));
500
548
  }
501
549
  showMenu(e, t, i) {
@@ -508,15 +556,15 @@ class on extends R {
508
556
  value: i.value ?? null,
509
557
  isHeader: i.isHeader ?? !1,
510
558
  event: i.event ?? new MouseEvent("contextmenu")
511
- }, r = re(this.config.items ?? Z, n);
512
- this.menuElement && this.menuElement.remove(), this.menuElement = oe(
559
+ }, r = he(this.config.items ?? oe, n);
560
+ this.menuElement && this.menuElement.remove(), this.menuElement = ge(
513
561
  r,
514
562
  n,
515
563
  (o) => {
516
564
  o.action && o.action(n), this.menuElement?.remove(), this.menuElement = null, this.isOpen = !1;
517
565
  },
518
566
  this.gridIcons.submenuArrow
519
- ), document.body.appendChild(this.menuElement), ye(this.menuElement, e, t), this.isOpen = !0;
567
+ ), document.body.appendChild(this.menuElement), this.copyGridStyles(this.menuElement), Ae(this.menuElement, e, t), this.isOpen = !0;
520
568
  }
521
569
  hideMenu() {
522
570
  this.menuElement && (this.menuElement.remove(), this.menuElement = null, this.isOpen = !1);
@@ -525,12 +573,12 @@ class on extends R {
525
573
  return this.isOpen;
526
574
  }
527
575
  }
528
- const gt = "@layer tbw-plugins{tbw-grid{--tbw-editing-bg: var(--tbw-color-selection);--tbw-editing-row-bg: var(--tbw-editing-bg);--tbw-editing-border: var(--tbw-border-input, 1px solid var(--tbw-color-border-strong));--tbw-padding-editing-input: var(--tbw-cell-padding-input, 2px 6px);--tbw-font-size-editor: inherit;--tbw-editing-row-outline-color: var(--tbw-color-accent);--tbw-editing-row-outline-width: 1px;.data-grid-row:has(.editing){background:var(--tbw-editing-row-bg);outline:var(--tbw-editing-row-outline-width) solid var(--tbw-editing-row-outline-color);outline-offset:calc(-1 * var(--tbw-editing-row-outline-width))}.data-grid-row>.cell.editing{overflow:hidden;padding:0;display:flex;min-height:calc(var(--tbw-row-height) + 2px);align-items:center;justify-content:center}.data-grid-row>.cell.editing input:not([type=checkbox]),.data-grid-row>.cell.editing select,.data-grid-row>.cell.editing textarea{width:100%;height:100%;flex:1 1 auto;min-width:0;border:var(--tbw-editing-border);padding:var(--tbw-padding-editing-input);font-size:var(--tbw-font-size-editor)}.tbw-editor-host{display:contents}}}";
529
- function ft(s) {
576
+ const Ct = "@layer tbw-plugins{tbw-grid{--tbw-editing-bg: var(--tbw-color-selection);--tbw-editing-row-bg: var(--tbw-editing-bg);--tbw-editing-border: var(--tbw-border-input, 1px solid var(--tbw-color-border-strong));--tbw-padding-editing-input: var(--tbw-cell-padding-input, 2px 6px);--tbw-font-size-editor: inherit;--tbw-editing-row-outline-color: var(--tbw-color-accent);--tbw-editing-row-outline-width: 1px;.data-grid-row:has(.editing){background:var(--tbw-editing-row-bg);outline:var(--tbw-editing-row-outline-width) solid var(--tbw-editing-row-outline-color);outline-offset:calc(-1 * var(--tbw-editing-row-outline-width))}.data-grid-row>.cell.editing{overflow:hidden;padding:0;display:flex;min-height:calc(var(--tbw-row-height) + 2px);align-items:center;justify-content:center}.data-grid-row>.cell.editing input:not([type=checkbox]),.data-grid-row>.cell.editing select,.data-grid-row>.cell.editing textarea{width:100%;height:100%;flex:1 1 auto;min-width:0;border:var(--tbw-editing-border);padding:var(--tbw-padding-editing-input);font-size:var(--tbw-font-size-editor)}.tbw-editor-host{display:contents}}}";
577
+ function Et(s) {
530
578
  const e = s.options;
531
579
  return e ? typeof e == "function" ? e() : e : [];
532
580
  }
533
- function pt(s) {
581
+ function Rt(s) {
534
582
  return (e) => {
535
583
  const t = s.editorParams, i = document.createElement("input");
536
584
  i.type = "number", i.value = e.value != null ? String(e.value) : "", t?.min !== void 0 && (i.min = String(t.min)), t?.max !== void 0 && (i.max = String(t.max)), t?.step !== void 0 && (i.step = String(t.step)), t?.placeholder && (i.placeholder = t.placeholder);
@@ -540,13 +588,13 @@ function pt(s) {
540
588
  }), i;
541
589
  };
542
590
  }
543
- function mt() {
591
+ function St() {
544
592
  return (s) => {
545
593
  const e = document.createElement("input");
546
594
  return e.type = "checkbox", e.checked = !!s.value, e.addEventListener("change", () => s.commit(e.checked)), e;
547
595
  };
548
596
  }
549
- function wt(s) {
597
+ function kt(s) {
550
598
  return (e) => {
551
599
  const t = s.editorParams, i = document.createElement("input");
552
600
  return i.type = "date", e.value instanceof Date && (i.valueAsDate = e.value), t?.min && (i.min = t.min), t?.max && (i.max = t.max), t?.placeholder && (i.placeholder = t.placeholder), i.addEventListener("change", () => e.commit(i.valueAsDate)), i.addEventListener("keydown", (n) => {
@@ -554,14 +602,14 @@ function wt(s) {
554
602
  }), i;
555
603
  };
556
604
  }
557
- function bt(s) {
605
+ function At(s) {
558
606
  return (e) => {
559
607
  const t = s.editorParams, i = document.createElement("select");
560
608
  if (s.multi && (i.multiple = !0), t?.includeEmpty) {
561
609
  const o = document.createElement("option");
562
610
  o.value = "", o.textContent = t.emptyLabel ?? "", i.appendChild(o);
563
611
  }
564
- ft(s).forEach((o) => {
612
+ Et(s).forEach((o) => {
565
613
  const a = document.createElement("option");
566
614
  a.value = String(o.value), a.textContent = o.label, (s.multi && Array.isArray(e.value) && e.value.includes(o.value) || !s.multi && e.value === o.value) && (a.selected = !0), i.appendChild(a);
567
615
  });
@@ -577,7 +625,7 @@ function bt(s) {
577
625
  }), i;
578
626
  };
579
627
  }
580
- function vt(s) {
628
+ function _t(s) {
581
629
  return (e) => {
582
630
  const t = s.editorParams, i = document.createElement("input");
583
631
  return i.type = "text", i.value = e.value != null ? String(e.value) : "", t?.maxLength !== void 0 && (i.maxLength = t.maxLength), t?.pattern && (i.pattern = t.pattern), t?.placeholder && (i.placeholder = t.placeholder), i.addEventListener("blur", () => e.commit(i.value)), i.addEventListener("keydown", (n) => {
@@ -585,22 +633,22 @@ function vt(s) {
585
633
  }), i;
586
634
  };
587
635
  }
588
- function yt(s) {
636
+ function Tt(s) {
589
637
  switch (s.type) {
590
638
  case "number":
591
- return pt(s);
639
+ return Rt(s);
592
640
  case "boolean":
593
- return mt();
641
+ return St();
594
642
  case "date":
595
- return wt(s);
643
+ return kt(s);
596
644
  case "select":
597
- return bt(s);
645
+ return At(s);
598
646
  default:
599
- return vt(s);
647
+ return _t(s);
600
648
  }
601
649
  }
602
- const J = 'input,select,textarea,[contenteditable="true"],[contenteditable=""],[tabindex]:not([tabindex="-1"])';
603
- function xt(s, e) {
650
+ const se = 'input,select,textarea,[contenteditable="true"],[contenteditable=""],[tabindex]:not([tabindex="-1"])';
651
+ function Lt(s, e) {
604
652
  if (e.editor) return e.editor;
605
653
  if (e.__editorTemplate) return "template";
606
654
  if (!e.type) return;
@@ -614,28 +662,28 @@ function xt(s, e) {
614
662
  return r.editor;
615
663
  }
616
664
  }
617
- function N(s) {
665
+ function $(s) {
618
666
  return !(typeof s != "string" || s === "__proto__" || s === "constructor" || s === "prototype");
619
667
  }
620
- function Ct(s) {
668
+ function Ft(s) {
621
669
  const e = (s.__editingCellCount ?? 0) + 1;
622
670
  s.__editingCellCount = e, s.setAttribute("data-has-editing", "");
623
671
  }
624
- function Rt(s) {
672
+ function It(s) {
625
673
  s.__editingCellCount = 0, s.removeAttribute("data-has-editing");
626
674
  }
627
- function z(s, e) {
675
+ function U(s, e) {
628
676
  return s instanceof HTMLInputElement ? s.type === "checkbox" ? s.checked : s.type === "number" ? s.value === "" ? null : Number(s.value) : s.type === "date" ? s.valueAsDate : s.value : e?.type === "number" && s.value !== "" ? Number(s.value) : s.value;
629
677
  }
630
- function xe(s) {
678
+ function _e(s) {
631
679
  }
632
- function Et(s, e, t) {
680
+ function Pt(s, e, t) {
633
681
  const i = s.querySelector("input,textarea,select");
634
682
  i && (i.addEventListener("blur", () => {
635
- t(z(i, e));
636
- }), i instanceof HTMLInputElement && i.type === "checkbox" ? i.addEventListener("change", () => t(i.checked)) : i instanceof HTMLSelectElement && i.addEventListener("change", () => t(z(i, e))));
683
+ t(U(i, e));
684
+ }), i instanceof HTMLInputElement && i.type === "checkbox" ? i.addEventListener("change", () => t(i.checked)) : i instanceof HTMLSelectElement && i.addEventListener("change", () => t(U(i, e))));
637
685
  }
638
- class sn extends R {
686
+ class fn extends _ {
639
687
  static manifest = {
640
688
  ownedProperties: [
641
689
  {
@@ -657,7 +705,7 @@ class sn extends R {
657
705
  ]
658
706
  };
659
707
  name = "editing";
660
- styles = gt;
708
+ styles = Ct;
661
709
  get defaultConfig() {
662
710
  return {
663
711
  editOn: "click"
@@ -719,7 +767,7 @@ class sn extends R {
719
767
  const r = t._visibleColumns[n], o = t._rows[i];
720
768
  if (r?.editable && r.type === "boolean" && o) {
721
769
  const a = r.field;
722
- if (N(a)) {
770
+ if ($(a)) {
723
771
  const d = !o[a];
724
772
  return this.#h(i, r, d, o), e.preventDefault(), this.requestRender(), !0;
725
773
  }
@@ -851,7 +899,7 @@ class sn extends R {
851
899
  }), setTimeout(() => {
852
900
  let a = r.querySelector(`.cell[data-col="${t._focusCol}"]`);
853
901
  if (a?.classList.contains("editing") || (a = r.querySelector(".cell.editing")), a?.classList.contains("editing")) {
854
- const l = a.querySelector(J);
902
+ const l = a.querySelector(se);
855
903
  try {
856
904
  l?.focus({ preventScroll: !0 });
857
905
  } catch {
@@ -892,7 +940,7 @@ class sn extends R {
892
940
  if (!u) return;
893
941
  const h = d.querySelector("input,textarea,select");
894
942
  if (h) {
895
- const g = z(h, u);
943
+ const g = U(h, u);
896
944
  r[u.field] !== g && this.#h(e, u, g, r);
897
945
  }
898
946
  }), t && n && r)
@@ -914,12 +962,12 @@ class sn extends R {
914
962
  for (const l of this.#i)
915
963
  l.startsWith(`${e}:`) && this.#i.delete(l);
916
964
  o && (o.querySelectorAll(".cell.editing").forEach((l) => {
917
- l.classList.remove("editing"), Rt(l.parentElement);
965
+ l.classList.remove("editing"), It(l.parentElement);
918
966
  }), this.requestRender()), this.#r = !0, o || (this.#g(i), this.#r = !1);
919
967
  }
920
968
  #h(e, t, i, n) {
921
969
  const r = t.field;
922
- if (!N(r)) return;
970
+ if (!$(r)) return;
923
971
  const o = n[r];
924
972
  if (o === i) return;
925
973
  const a = this.grid;
@@ -928,7 +976,7 @@ class sn extends R {
928
976
  l = this.grid.getRowId(n);
929
977
  } catch {
930
978
  }
931
- const d = l ? !this.#n.has(l) : !0, c = l ? (g) => this.grid.updateRow(l, g, "cascade") : xe;
979
+ const d = l ? !this.#n.has(l) : !0, c = l ? (g) => this.grid.updateRow(l, g, "cascade") : _e;
932
980
  if (this.emitCancelable("cell-commit", {
933
981
  row: n,
934
982
  rowId: l ?? "",
@@ -943,7 +991,7 @@ class sn extends R {
943
991
  })) return;
944
992
  n[r] = i, l && this.#n.add(l), this.#a();
945
993
  const h = a.findRenderedRowElement?.(e);
946
- h && (h.classList.add("changed"), Qe(h, "change"));
994
+ h && (h.classList.add("changed"), lt(h, "change"));
947
995
  }
948
996
  #p(e, t, i, n, r, o) {
949
997
  if (!i.editable || r.classList.contains("editing")) return;
@@ -952,63 +1000,63 @@ class sn extends R {
952
1000
  a = this.grid.getRowId(e);
953
1001
  } catch {
954
1002
  }
955
- const l = a ? (v) => this.grid.updateRow(a, v, "cascade") : xe, d = N(i.field) ? e[i.field] : void 0;
1003
+ const l = a ? (x) => this.grid.updateRow(a, x, "cascade") : _e, d = $(i.field) ? e[i.field] : void 0;
956
1004
  r.classList.add("editing"), this.#i.add(`${t}:${n}`);
957
1005
  const c = r.parentElement;
958
- c && Ct(c);
1006
+ c && Ft(c);
959
1007
  let u = !1;
960
- const h = (v) => {
961
- u || this.#e === -1 || this.#h(t, i, v, e);
1008
+ const h = (x) => {
1009
+ u || this.#e === -1 || this.#h(t, i, x, e);
962
1010
  }, g = () => {
963
- u = !0, N(i.field) && (e[i.field] = d);
1011
+ u = !0, $(i.field) && (e[i.field] = d);
964
1012
  }, f = document.createElement("div");
965
- f.className = "tbw-editor-host", r.innerHTML = "", r.appendChild(f), f.addEventListener("keydown", (v) => {
966
- v.key === "Enter" && (v.stopPropagation(), v.preventDefault(), u = !0, this.#s(t, !1)), v.key === "Escape" && (v.stopPropagation(), v.preventDefault(), g(), this.#s(t, !0));
1013
+ f.className = "tbw-editor-host", r.innerHTML = "", r.appendChild(f), f.addEventListener("keydown", (x) => {
1014
+ x.key === "Enter" && (x.stopPropagation(), x.preventDefault(), u = !0, this.#s(t, !1)), x.key === "Escape" && (x.stopPropagation(), x.preventDefault(), g(), this.#s(t, !0));
967
1015
  });
968
- const p = i, m = p.__editorTemplate, w = xt(this.grid, p) ?? yt(i), b = d;
969
- if (w === "template" && m)
1016
+ const p = i, w = p.__editorTemplate, v = Lt(this.grid, p) ?? Tt(i), y = d;
1017
+ if (v === "template" && w)
970
1018
  this.#l(f, p, e, d, h, g, o, t);
971
- else if (typeof w == "string") {
972
- const v = document.createElement(w);
973
- v.value = b, v.addEventListener("change", () => h(v.value)), f.appendChild(v), o || queueMicrotask(() => {
974
- f.querySelector(J)?.focus({ preventScroll: !0 });
1019
+ else if (typeof v == "string") {
1020
+ const x = document.createElement(v);
1021
+ x.value = y, x.addEventListener("change", () => h(x.value)), f.appendChild(x), o || queueMicrotask(() => {
1022
+ f.querySelector(se)?.focus({ preventScroll: !0 });
975
1023
  });
976
- } else if (typeof w == "function") {
977
- const v = {
1024
+ } else if (typeof v == "function") {
1025
+ const x = {
978
1026
  row: e,
979
1027
  rowId: a ?? "",
980
- value: b,
1028
+ value: y,
981
1029
  field: i.field,
982
1030
  column: i,
983
1031
  commit: h,
984
1032
  cancel: g,
985
1033
  updateRow: l
986
- }, S = w(v);
987
- typeof S == "string" ? (f.innerHTML = S, Et(f, i, h)) : S instanceof Node && f.appendChild(S), o || queueMicrotask(() => {
988
- f.querySelector(J)?.focus({ preventScroll: !0 });
1034
+ }, A = v(x);
1035
+ typeof A == "string" ? (f.innerHTML = A, Pt(f, i, h)) : A instanceof Node && f.appendChild(A), o || queueMicrotask(() => {
1036
+ f.querySelector(se)?.focus({ preventScroll: !0 });
989
1037
  });
990
- } else if (w && typeof w == "object") {
991
- const v = document.createElement("div");
992
- v.setAttribute("data-external-editor", ""), v.setAttribute("data-field", i.field), f.appendChild(v);
993
- const S = {
1038
+ } else if (v && typeof v == "object") {
1039
+ const x = document.createElement("div");
1040
+ x.setAttribute("data-external-editor", ""), x.setAttribute("data-field", i.field), f.appendChild(x);
1041
+ const A = {
994
1042
  row: e,
995
1043
  rowId: a ?? "",
996
- value: b,
1044
+ value: y,
997
1045
  field: i.field,
998
1046
  column: i,
999
1047
  commit: h,
1000
1048
  cancel: g,
1001
1049
  updateRow: l
1002
1050
  };
1003
- if (w.mount)
1051
+ if (v.mount)
1004
1052
  try {
1005
- w.mount({ placeholder: v, context: S, spec: w });
1006
- } catch (K) {
1007
- console.warn(`[tbw-grid] External editor mount error for column '${i.field}':`, K);
1053
+ v.mount({ placeholder: x, context: A, spec: v });
1054
+ } catch (F) {
1055
+ console.warn(`[tbw-grid] External editor mount error for column '${i.field}':`, F);
1008
1056
  }
1009
1057
  else
1010
1058
  this.grid.dispatchEvent(
1011
- new CustomEvent("mount-external-editor", { detail: { placeholder: v, spec: w, context: S } })
1059
+ new CustomEvent("mount-external-editor", { detail: { placeholder: x, spec: v, context: A } })
1012
1060
  );
1013
1061
  }
1014
1062
  }
@@ -1025,9 +1073,9 @@ class sn extends R {
1025
1073
  cancel: o
1026
1074
  }) : c.querySelectorAll("*").forEach((g) => {
1027
1075
  g.childNodes.length === 1 && g.firstChild?.nodeType === Node.TEXT_NODE && (g.textContent = g.textContent?.replace(/{{\s*value\s*}}/g, n == null ? "" : String(n)).replace(/{{\s*row\.([a-zA-Z0-9_]+)\s*}}/g, (f, p) => {
1028
- if (!N(p)) return "";
1029
- const m = i[p];
1030
- return m == null ? "" : String(m);
1076
+ if (!$(p)) return "";
1077
+ const w = i[p];
1078
+ return w == null ? "" : String(w);
1031
1079
  }) || "");
1032
1080
  });
1033
1081
  const h = c.querySelector(
@@ -1037,10 +1085,10 @@ class sn extends R {
1037
1085
  h instanceof HTMLInputElement && h.type === "checkbox" ? h.checked = !!n : h.value = String(n ?? "");
1038
1086
  let g = !1;
1039
1087
  h.addEventListener("blur", () => {
1040
- g || r(z(h, t));
1088
+ g || r(U(h, t));
1041
1089
  }), h.addEventListener("keydown", (f) => {
1042
1090
  const p = f;
1043
- p.key === "Enter" && (p.stopPropagation(), p.preventDefault(), g = !0, r(z(h, t)), this.#s(l, !1)), p.key === "Escape" && (p.stopPropagation(), p.preventDefault(), o(), this.#s(l, !0));
1091
+ p.key === "Enter" && (p.stopPropagation(), p.preventDefault(), g = !0, r(U(h, t)), this.#s(l, !1)), p.key === "Escape" && (p.stopPropagation(), p.preventDefault(), o(), this.#s(l, !0));
1044
1092
  }), h instanceof HTMLInputElement && h.type === "checkbox" && h.addEventListener("change", () => r(h.checked)), a || setTimeout(() => h.focus({ preventScroll: !0 }), 0);
1045
1093
  }
1046
1094
  e.appendChild(c);
@@ -1061,7 +1109,7 @@ class sn extends R {
1061
1109
  });
1062
1110
  }
1063
1111
  }
1064
- function Ce(s, e = !0) {
1112
+ function Te(s, e = !0) {
1065
1113
  if (s == null) return "";
1066
1114
  if (s instanceof Date) return s.toISOString();
1067
1115
  if (typeof s == "object") return JSON.stringify(s);
@@ -1069,37 +1117,37 @@ function Ce(s, e = !0) {
1069
1117
  return e && (t.includes(",") || t.includes('"') || t.includes(`
1070
1118
  `) || t.includes("\r")) ? `"${t.replace(/"/g, '""')}"` : t;
1071
1119
  }
1072
- function St(s, e, t, i = {}) {
1120
+ function Dt(s, e, t, i = {}) {
1073
1121
  const n = i.delimiter ?? ",", r = i.newline ?? `
1074
1122
  `, o = [], a = i.bom ? "\uFEFF" : "";
1075
1123
  if (t.includeHeaders !== !1) {
1076
1124
  const l = e.map((d) => {
1077
1125
  const c = d.header || d.field, u = t.processHeader ? t.processHeader(c, d.field) : c;
1078
- return Ce(u);
1126
+ return Te(u);
1079
1127
  });
1080
1128
  o.push(l.join(n));
1081
1129
  }
1082
1130
  for (const l of s) {
1083
1131
  const d = e.map((c) => {
1084
1132
  let u = l[c.field];
1085
- return t.processCell && (u = t.processCell(u, c.field, l)), Ce(u);
1133
+ return t.processCell && (u = t.processCell(u, c.field, l)), Te(u);
1086
1134
  });
1087
1135
  o.push(d.join(n));
1088
1136
  }
1089
1137
  return a + o.join(r);
1090
1138
  }
1091
- function de(s, e) {
1139
+ function we(s, e) {
1092
1140
  const t = URL.createObjectURL(s), i = document.createElement("a");
1093
1141
  i.href = t, i.download = e, i.style.display = "none", document.body.appendChild(i), i.click(), document.body.removeChild(i), URL.revokeObjectURL(t);
1094
1142
  }
1095
- function kt(s, e) {
1143
+ function Mt(s, e) {
1096
1144
  const t = new Blob([s], { type: "text/csv;charset=utf-8;" });
1097
- de(t, e);
1145
+ we(t, e);
1098
1146
  }
1099
- function Re(s) {
1147
+ function Le(s) {
1100
1148
  return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
1101
1149
  }
1102
- function At(s, e, t) {
1150
+ function Nt(s, e, t) {
1103
1151
  let i = `<?xml version="1.0" encoding="UTF-8"?>
1104
1152
  <?mso-application progid="Excel.Sheet"?>
1105
1153
  <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
@@ -1111,7 +1159,7 @@ function At(s, e, t) {
1111
1159
  <Row>`;
1112
1160
  for (const n of e) {
1113
1161
  const r = n.header || n.field, o = t.processHeader ? t.processHeader(r, n.field) : r;
1114
- i += `<Cell><Data ss:Type="String">${Re(o)}</Data></Cell>`;
1162
+ i += `<Cell><Data ss:Type="String">${Le(o)}</Data></Cell>`;
1115
1163
  }
1116
1164
  i += "</Row>";
1117
1165
  }
@@ -1122,7 +1170,7 @@ function At(s, e, t) {
1122
1170
  let o = n[r.field];
1123
1171
  t.processCell && (o = t.processCell(o, r.field, n));
1124
1172
  let a = "String", l = "";
1125
- o == null ? l = "" : typeof o == "number" && !isNaN(o) ? (a = "Number", l = String(o)) : o instanceof Date ? (a = "DateTime", l = o.toISOString()) : l = Re(String(o)), i += `<Cell><Data ss:Type="${a}">${l}</Data></Cell>`;
1173
+ o == null ? l = "" : typeof o == "number" && !isNaN(o) ? (a = "Number", l = String(o)) : o instanceof Date ? (a = "DateTime", l = o.toISOString()) : l = Le(String(o)), i += `<Cell><Data ss:Type="${a}">${l}</Data></Cell>`;
1126
1174
  }
1127
1175
  i += "</Row>";
1128
1176
  }
@@ -1131,13 +1179,13 @@ function At(s, e, t) {
1131
1179
  </Worksheet>
1132
1180
  </Workbook>`, i;
1133
1181
  }
1134
- function _t(s, e) {
1182
+ function qt(s, e) {
1135
1183
  const t = e.endsWith(".xls") ? e : `${e}.xls`, i = new Blob([s], {
1136
1184
  type: "application/vnd.ms-excel;charset=utf-8;"
1137
1185
  });
1138
- de(i, t);
1186
+ we(i, t);
1139
1187
  }
1140
- class an extends R {
1188
+ class pn extends _ {
1141
1189
  name = "export";
1142
1190
  get defaultConfig() {
1143
1191
  return {
@@ -1174,13 +1222,13 @@ class an extends R {
1174
1222
  try {
1175
1223
  switch (e) {
1176
1224
  case "csv": {
1177
- const l = St(o, r, n, { bom: !0 });
1178
- a = a.endsWith(".csv") ? a : `${a}.csv`, kt(l, a);
1225
+ const l = Dt(o, r, n, { bom: !0 });
1226
+ a = a.endsWith(".csv") ? a : `${a}.csv`, Mt(l, a);
1179
1227
  break;
1180
1228
  }
1181
1229
  case "excel": {
1182
- const l = At(o, r, n);
1183
- a = a.endsWith(".xls") ? a : `${a}.xls`, _t(l, a);
1230
+ const l = Nt(o, r, n);
1231
+ a = a.endsWith(".xls") ? a : `${a}.xls`, qt(l, a);
1184
1232
  break;
1185
1233
  }
1186
1234
  case "json": {
@@ -1194,7 +1242,7 @@ class an extends R {
1194
1242
  }), d = JSON.stringify(l, null, 2);
1195
1243
  a = a.endsWith(".json") ? a : `${a}.json`;
1196
1244
  const c = new Blob([d], { type: "application/json" });
1197
- de(c, a);
1245
+ we(c, a);
1198
1246
  break;
1199
1247
  }
1200
1248
  }
@@ -1231,7 +1279,7 @@ class an extends R {
1231
1279
  return this.lastExportInfo;
1232
1280
  }
1233
1281
  }
1234
- function Lt(s) {
1282
+ function Ht(s) {
1235
1283
  const { totalRows: e, viewportHeight: t, scrollTop: i, rowHeight: n, overscan: r } = s, o = Math.ceil(t / n);
1236
1284
  let a = Math.floor(i / n) - r;
1237
1285
  a < 0 && (a = 0);
@@ -1243,10 +1291,10 @@ function Lt(s) {
1243
1291
  totalHeight: e * n
1244
1292
  };
1245
1293
  }
1246
- function Tt(s, e) {
1294
+ function zt(s, e) {
1247
1295
  return s <= e;
1248
1296
  }
1249
- function It(s, e, t = !1) {
1297
+ function Kt(s, e, t = !1) {
1250
1298
  const i = s[e.field];
1251
1299
  if (e.operator === "blank")
1252
1300
  return i == null || i === "";
@@ -1285,10 +1333,10 @@ function It(s, e, t = !1) {
1285
1333
  return !0;
1286
1334
  }
1287
1335
  }
1288
- function Pt(s, e, t = !1) {
1289
- return e.length ? s.filter((i) => e.every((n) => It(i, n, t))) : s;
1336
+ function Ot(s, e, t = !1) {
1337
+ return e.length ? s.filter((i) => e.every((n) => Kt(i, n, t))) : s;
1290
1338
  }
1291
- function Dt(s) {
1339
+ function Gt(s) {
1292
1340
  return JSON.stringify(
1293
1341
  s.map((e) => ({
1294
1342
  field: e.field,
@@ -1298,7 +1346,7 @@ function Dt(s) {
1298
1346
  }))
1299
1347
  );
1300
1348
  }
1301
- function Ee(s, e) {
1349
+ function Fe(s, e) {
1302
1350
  const t = /* @__PURE__ */ new Set();
1303
1351
  for (const i of s) {
1304
1352
  const n = i[e];
@@ -1306,10 +1354,10 @@ function Ee(s, e) {
1306
1354
  }
1307
1355
  return [...t].sort((i, n) => typeof i == "number" && typeof n == "number" ? i - n : String(i).localeCompare(String(n)));
1308
1356
  }
1309
- const Ft = '@layer tbw-plugins{tbw-grid{.tbw-quick-filter-input{flex:1;max-width:300px;height:var(--tbw-input-height, 1.75rem);padding:var(--tbw-input-padding, 0 .5rem);border:1px solid var(--tbw-color-border);border-radius:var(--tbw-border-radius);background:var(--tbw-color-bg);color:var(--tbw-color-fg);font-size:var(--tbw-font-size-sm, .8125rem);&:focus{outline:none;border-color:var(--tbw-color-accent)}}.header-cell.filtered:before{content:"";position:absolute;top:var(--tbw-spacing-xs, .25rem);right:var(--tbw-spacing-xs, .25rem);width:var(--tbw-indicator-size, .375rem);height:var(--tbw-indicator-size, .375rem);background:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));border-radius:50%}.tbw-filter-btn{display:var(--tbw-filter-btn-display, inline-flex);visibility:var(--tbw-filter-btn-visibility, visible);align-items:center;justify-content:center;background:transparent;border:none;cursor:pointer;padding:2px;margin-left:var(--tbw-spacing-xs, .25rem);opacity:.4;transition:opacity .15s,visibility 0s,display 0s allow-discrete;color:inherit;vertical-align:middle;transition-behavior:allow-discrete;&:hover,&.active{opacity:1;visibility:visible;display:inline-flex}&.active{color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6))}}.header-row .cell:hover .tbw-filter-btn,.header-row .cell.filtered .tbw-filter-btn{display:inline-flex;visibility:visible}}}', Mt = "@layer tbw-plugins{.tbw-filter-panel{position:fixed;background:var(--tbw-filter-panel-bg, var(--tbw-color-panel-bg, light-dark(#eeeeee, #222222)));color:var(--tbw-filter-panel-fg, var(--tbw-color-fg, light-dark(#222222, #eeeeee)));border:1px solid var(--tbw-filter-panel-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:var(--tbw-filter-panel-radius, var(--tbw-border-radius, .25rem));box-shadow:0 4px 16px var(--tbw-filter-panel-shadow, var(--tbw-color-shadow, light-dark(rgba(0, 0, 0, .1), rgba(0, 0, 0, .3))));padding:var(--tbw-panel-padding, var(--tbw-spacing-lg, .75rem));z-index:10000;min-width:200px;max-width:280px;max-height:350px;display:flex;flex-direction:column;font-family:var(--tbw-font-family, system-ui, sans-serif);font-size:var(--tbw-font-size, .8125rem);transform-origin:top center}.tbw-filter-panel.tbw-filter-panel-above{transform-origin:bottom center}.tbw-filter-panel.tbw-filter-panel-animated{animation:tbw-filter-panel-enter var(--tbw-animation-duration, .15s) var(--tbw-animation-easing, ease-out)}.tbw-filter-panel.tbw-filter-panel-above.tbw-filter-panel-animated{animation:tbw-filter-panel-enter-above var(--tbw-animation-duration, .15s) var(--tbw-animation-easing, ease-out)}@keyframes tbw-filter-panel-enter{0%{opacity:0;transform:scaleY(.3) translateY(-10px)}to{opacity:1;transform:scaleY(1) translateY(0)}}@keyframes tbw-filter-panel-enter-above{0%{opacity:0;transform:scaleY(.3) translateY(10px)}to{opacity:1;transform:scaleY(1) translateY(0)}}@supports (anchor-name: --test){.tbw-filter-panel{position-anchor:--tbw-filter-anchor;top:anchor(bottom);left:anchor(left);margin-top:4px;position-try-fallbacks:flip-inline,flip-block,flip-block flip-inline}}.tbw-filter-search{margin-bottom:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.tbw-filter-search-input{width:100%;padding:var(--tbw-filter-search-padding, var(--tbw-spacing-sm, .375rem) var(--tbw-spacing-md, .5rem));background:var(--tbw-filter-input-bg, var(--tbw-color-bg, transparent));color:inherit;border:1px solid var(--tbw-filter-input-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:var(--tbw-filter-input-radius, var(--tbw-border-radius, .25rem));font-size:inherit;box-sizing:border-box}.tbw-filter-search-input:focus{outline:none;border-color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));box-shadow:0 0 0 2px rgba(from var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6)) r g b / 15%)}.tbw-filter-actions{display:flex;padding:var(--tbw-button-padding-sm, .25rem .125rem);margin-bottom:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));border-bottom:1px solid var(--tbw-filter-divider, var(--tbw-color-border, light-dark(#d0d0d4, #454545)))}.tbw-filter-action-btn{background:transparent;border:none;color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));cursor:pointer;font-size:var(--tbw-font-size-xs, .75rem);padding:2px 0}.tbw-filter-action-btn:hover{text-decoration:underline}.tbw-filter-values{flex:1;overflow-y:auto;margin-bottom:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));max-height:180px;position:relative}.tbw-filter-values-spacer{width:1px}.tbw-filter-values-content{position:absolute;top:0;left:0;right:0}.tbw-filter-value-item{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));padding:var(--tbw-button-padding-sm, .25rem .125rem);cursor:pointer;border-radius:3px;min-height:var(--tbw-filter-item-height, 28px)}.tbw-filter-value-item:hover{background:var(--tbw-filter-hover, var(--tbw-color-row-hover, light-dark(#f0f6ff, #1c1c1c)))}.tbw-filter-checkbox{margin:0;cursor:pointer;accent-color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6))}.tbw-filter-no-match{color:var(--tbw-filter-muted, var(--tbw-color-fg-muted, light-dark(#555555, #aaaaaa)));padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem)) 0;text-align:center;font-style:italic}.tbw-filter-buttons{display:flex;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));padding-top:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));border-top:1px solid var(--tbw-filter-divider, var(--tbw-color-border, light-dark(#d0d0d4, #454545)))}.tbw-filter-apply-btn{flex:1;padding:var(--tbw-filter-btn-padding, var(--tbw-button-padding, .375rem .75rem));background:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));color:var(--tbw-filter-accent-fg, var(--tbw-color-accent-fg, light-dark(#ffffff, #000000)));border:none;border-radius:var(--tbw-border-radius, .25rem);cursor:pointer;font-size:var(--tbw-font-size-sm, .8125rem);font-weight:var(--tbw-filter-btn-font-weight, 500);min-height:var(--tbw-filter-btn-min-height, auto)}.tbw-filter-apply-btn:hover{filter:brightness(.9)}.tbw-filter-clear-btn{flex:1;padding:var(--tbw-filter-btn-padding, var(--tbw-button-padding, .375rem .75rem));background:transparent;color:var(--tbw-filter-muted, var(--tbw-color-fg-muted, light-dark(#555555, #aaaaaa)));border:1px solid var(--tbw-filter-input-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:var(--tbw-border-radius, .25rem);cursor:pointer;font-size:var(--tbw-font-size-sm, .8125rem);font-weight:var(--tbw-filter-btn-font-weight, 500);min-height:var(--tbw-filter-btn-min-height, auto)}.tbw-filter-clear-btn:hover{background:var(--tbw-filter-hover, var(--tbw-color-row-hover, light-dark(#f0f6ff, #1c1c1c)))}}";
1310
- class T extends R {
1357
+ const Bt = '@layer tbw-plugins{tbw-grid{.tbw-quick-filter-input{flex:1;max-width:300px;height:var(--tbw-input-height, 1.75rem);padding:var(--tbw-input-padding, 0 .5rem);border:1px solid var(--tbw-color-border);border-radius:var(--tbw-border-radius);background:var(--tbw-color-bg);color:var(--tbw-color-fg);font-size:var(--tbw-font-size-sm, .8125rem);&:focus{outline:none;border-color:var(--tbw-color-accent)}}.header-cell.filtered:before{content:"";position:absolute;top:var(--tbw-spacing-xs, .25rem);right:var(--tbw-spacing-xs, .25rem);width:var(--tbw-indicator-size, .375rem);height:var(--tbw-indicator-size, .375rem);background:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));border-radius:50%}.tbw-filter-btn{display:var(--tbw-filter-btn-display, inline-flex);visibility:var(--tbw-filter-btn-visibility, visible);align-items:center;justify-content:center;background:transparent;border:none;cursor:pointer;padding:2px;margin-left:var(--tbw-spacing-xs, .25rem);opacity:.4;transition:opacity .15s,visibility 0s,display 0s allow-discrete;color:inherit;vertical-align:middle;transition-behavior:allow-discrete;&:hover,&.active{opacity:1;visibility:visible;display:inline-flex}&.active{color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6))}}.header-row .cell:hover .tbw-filter-btn,.header-row .cell.filtered .tbw-filter-btn{display:inline-flex;visibility:visible}}}', Vt = "@layer tbw-plugins{.tbw-filter-panel{position:fixed;background:var(--tbw-filter-panel-bg, var(--tbw-color-panel-bg, light-dark(#eeeeee, #222222)));color:var(--tbw-filter-panel-fg, var(--tbw-color-fg, light-dark(#222222, #eeeeee)));border:1px solid var(--tbw-filter-panel-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:var(--tbw-filter-panel-radius, var(--tbw-border-radius, .25rem));box-shadow:0 4px 16px var(--tbw-filter-panel-shadow, var(--tbw-color-shadow, light-dark(rgba(0, 0, 0, .1), rgba(0, 0, 0, .3))));padding:var(--tbw-panel-padding, var(--tbw-spacing-lg, .75rem));z-index:10000;min-width:200px;max-width:280px;max-height:350px;display:flex;flex-direction:column;font-family:var(--tbw-font-family, system-ui, sans-serif);font-size:var(--tbw-font-size, .8125rem);transform-origin:top center}.tbw-filter-panel.tbw-filter-panel-above{transform-origin:bottom center}.tbw-filter-panel.tbw-filter-panel-animated{animation:tbw-filter-panel-enter var(--tbw-animation-duration, .15s) var(--tbw-animation-easing, ease-out)}.tbw-filter-panel.tbw-filter-panel-above.tbw-filter-panel-animated{animation:tbw-filter-panel-enter-above var(--tbw-animation-duration, .15s) var(--tbw-animation-easing, ease-out)}@keyframes tbw-filter-panel-enter{0%{opacity:0;transform:scaleY(.3) translateY(-10px)}to{opacity:1;transform:scaleY(1) translateY(0)}}@keyframes tbw-filter-panel-enter-above{0%{opacity:0;transform:scaleY(.3) translateY(10px)}to{opacity:1;transform:scaleY(1) translateY(0)}}@supports (anchor-name: --test){.tbw-filter-panel{position-anchor:--tbw-filter-anchor;top:anchor(bottom);left:anchor(left);margin-top:4px;position-try-fallbacks:flip-inline,flip-block,flip-block flip-inline}}.tbw-filter-search{margin-bottom:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));min-height:var(--tbw-filter-item-height, 28px)}.tbw-filter-search-input{height:var(--tbw-filter-item-height, 28px);width:100%;padding:var(--tbw-filter-search-padding, var(--tbw-spacing-sm, .375rem) var(--tbw-spacing-md, .5rem));background:var(--tbw-filter-input-bg, var(--tbw-color-bg, transparent));color:inherit;border:1px solid var(--tbw-filter-input-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:var(--tbw-filter-input-radius, var(--tbw-border-radius, .25rem));font-size:inherit;box-sizing:border-box}.tbw-filter-search-input:focus{outline:none;border-color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));box-shadow:0 0 0 2px rgba(from var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6)) r g b / 15%)}.tbw-filter-actions{display:flex;padding:var(--tbw-button-padding-sm, .25rem .125rem);margin-bottom:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));border-bottom:1px solid var(--tbw-filter-divider, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));min-height:var(--tbw-filter-item-height, 28px)}.tbw-filter-action-btn{background:transparent;border:none;color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));cursor:pointer;font-size:var(--tbw-font-size-xs, .75rem);padding:2px 0}.tbw-filter-action-btn:hover{text-decoration:underline}.tbw-filter-values{flex:1;overflow-y:auto;margin-bottom:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));max-height:180px;position:relative}.tbw-filter-values-spacer{width:1px}.tbw-filter-values-content{position:absolute;top:0;left:0;right:0}.tbw-filter-value-item{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));padding:var(--tbw-button-padding-sm, .25rem .125rem);cursor:pointer;border-radius:3px;height:var(--tbw-filter-item-height, 28px)}.tbw-filter-value-item:hover{background:var(--tbw-filter-hover, var(--tbw-color-row-hover, light-dark(#f0f6ff, #1c1c1c)))}.tbw-filter-checkbox{margin:0;cursor:pointer;accent-color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6))}.tbw-filter-no-match{color:var(--tbw-filter-muted, var(--tbw-color-fg-muted, light-dark(#555555, #aaaaaa)));padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem)) 0;text-align:center;font-style:italic}.tbw-filter-buttons{display:flex;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));padding-top:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));border-top:1px solid var(--tbw-filter-divider, var(--tbw-color-border, light-dark(#d0d0d4, #454545)))}.tbw-filter-apply-btn{flex:1;padding:var(--tbw-filter-btn-padding, var(--tbw-button-padding, .375rem .75rem));background:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));color:var(--tbw-filter-accent-fg, var(--tbw-color-accent-fg, light-dark(#ffffff, #000000)));border:none;border-radius:var(--tbw-border-radius, .25rem);cursor:pointer;font-size:var(--tbw-font-size-sm, .8125rem);font-weight:var(--tbw-filter-btn-font-weight, 500);min-height:var(--tbw-filter-btn-min-height, auto)}.tbw-filter-apply-btn:hover{filter:brightness(.9)}.tbw-filter-clear-btn{flex:1;padding:var(--tbw-filter-btn-padding, var(--tbw-button-padding, .375rem .75rem));background:transparent;color:var(--tbw-filter-muted, var(--tbw-color-fg-muted, light-dark(#555555, #aaaaaa)));border:1px solid var(--tbw-filter-input-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:var(--tbw-border-radius, .25rem);cursor:pointer;font-size:var(--tbw-font-size-sm, .8125rem);font-weight:var(--tbw-filter-btn-font-weight, 500);min-height:var(--tbw-filter-btn-min-height, auto)}.tbw-filter-clear-btn:hover{background:var(--tbw-filter-hover, var(--tbw-color-row-hover, light-dark(#f0f6ff, #1c1c1c)))}.tbw-filter-range-title{font-weight:500;margin-bottom:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));padding-bottom:var(--tbw-spacing-sm, .375rem);border-bottom:1px solid var(--tbw-filter-divider, var(--tbw-color-border, light-dark(#d0d0d4, #454545)))}.tbw-filter-range-inputs,.tbw-filter-date-range{display:flex;align-items:flex-end;gap:var(--tbw-spacing-sm, .375rem);margin-bottom:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.tbw-filter-range-group,.tbw-filter-date-group{display:flex;flex-direction:column;gap:var(--tbw-spacing-xs, .25rem);flex:1}.tbw-filter-range-label{font-size:var(--tbw-font-size-xs, .75rem);color:var(--tbw-filter-muted, var(--tbw-color-fg-muted, light-dark(#555555, #aaaaaa)))}.tbw-filter-range-input,.tbw-filter-date-input{width:100%;height:var(--tbw-filter-item-height, 28px);padding:var(--tbw-spacing-xs, .25rem) var(--tbw-spacing-sm, .375rem);background:var(--tbw-filter-input-bg, var(--tbw-color-bg, transparent));color:inherit;border:1px solid var(--tbw-filter-input-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:var(--tbw-filter-input-radius, var(--tbw-border-radius, .25rem));font-size:inherit;box-sizing:border-box}.tbw-filter-range-input:focus,.tbw-filter-date-input:focus{outline:none;border-color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));box-shadow:0 0 0 2px rgba(from var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6)) r g b / 15%)}.tbw-filter-range-separator{color:var(--tbw-filter-muted, var(--tbw-color-fg-muted, light-dark(#555555, #aaaaaa)));padding-bottom:var(--tbw-spacing-xs, .25rem)}.tbw-filter-range-slider{position:relative;height:24px;margin:var(--tbw-spacing-md, .5rem) 0 var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.tbw-filter-range-track{position:absolute;top:50%;left:0;right:0;height:4px;background:var(--tbw-filter-input-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:2px;transform:translateY(-50%)}.tbw-filter-range-fill{position:absolute;top:50%;height:4px;background:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));border-radius:2px;transform:translateY(-50%)}.tbw-filter-range-thumb{position:absolute;top:0;width:100%;height:100%;background:none;pointer-events:none;-webkit-appearance:none;appearance:none}.tbw-filter-range-thumb::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:16px;height:16px;background:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));border:2px solid var(--tbw-filter-panel-bg, var(--tbw-color-panel-bg, light-dark(#eeeeee, #222222)));border-radius:50%;cursor:pointer;pointer-events:all;box-shadow:0 1px 3px #0003}.tbw-filter-range-thumb::-moz-range-thumb{width:16px;height:16px;background:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));border:2px solid var(--tbw-filter-panel-bg, var(--tbw-color-panel-bg, light-dark(#eeeeee, #222222)));border-radius:50%;cursor:pointer;pointer-events:all;box-shadow:0 1px 3px #0003}.tbw-filter-range-thumb::-webkit-slider-thumb:hover{transform:scale(1.1)}.tbw-filter-range-thumb::-moz-range-thumb:hover{transform:scale(1.1)}}";
1358
+ class q extends _ {
1311
1359
  name = "filtering";
1312
- styles = Ft;
1360
+ styles = Bt;
1313
1361
  get defaultConfig() {
1314
1362
  return {
1315
1363
  debounceMs: 300,
@@ -1318,6 +1366,12 @@ class T extends R {
1318
1366
  useWorker: !0
1319
1367
  };
1320
1368
  }
1369
+ isFilteringEnabled() {
1370
+ return this.grid.effectiveConfig?.filterable !== !1;
1371
+ }
1372
+ isColumnFilterable(e) {
1373
+ return this.isFilteringEnabled() ? e.filterable !== !1 : !1;
1374
+ }
1321
1375
  filters = /* @__PURE__ */ new Map();
1322
1376
  cachedResult = null;
1323
1377
  cacheKey = null;
@@ -1340,7 +1394,7 @@ class T extends R {
1340
1394
  return t;
1341
1395
  }
1342
1396
  }
1343
- return T.DEFAULT_LIST_ITEM_HEIGHT;
1397
+ return q.DEFAULT_LIST_ITEM_HEIGHT;
1344
1398
  }
1345
1399
  syncExcludedValues(e, t) {
1346
1400
  t ? t.type === "set" && t.operator === "notIn" && Array.isArray(t.value) ? this.excludedValues.set(e, new Set(t.value)) : t.type === "set" && this.excludedValues.delete(e) : this.excludedValues.delete(e);
@@ -1356,10 +1410,10 @@ class T extends R {
1356
1410
  if (!t.length) return [...e];
1357
1411
  if (this.config.filterHandler)
1358
1412
  return this.cachedResult ? this.cachedResult : [...e];
1359
- const i = Dt(t);
1413
+ const i = Gt(t);
1360
1414
  if (this.cacheKey === i && this.cachedResult)
1361
1415
  return this.cachedResult;
1362
- const n = Pt([...e], t, this.config.caseSensitive);
1416
+ const n = Ot([...e], t, this.config.caseSensitive);
1363
1417
  return this.cachedResult = n, this.cacheKey = i, n;
1364
1418
  }
1365
1419
  afterRender() {
@@ -1369,7 +1423,7 @@ class T extends R {
1369
1423
  const n = i.getAttribute("data-col");
1370
1424
  if (n === null) return;
1371
1425
  const r = this.visibleColumns[parseInt(n, 10)];
1372
- if (!r || r.filterable === !1 || I(r)) return;
1426
+ if (!r || !this.isColumnFilterable(r) || H(r)) return;
1373
1427
  const o = r.field;
1374
1428
  if (!o) return;
1375
1429
  const a = this.filters.has(o);
@@ -1437,7 +1491,7 @@ class T extends R {
1437
1491
  return this.getFilters();
1438
1492
  }
1439
1493
  getUniqueValues(e) {
1440
- return Ee(this.sourceRows, e);
1494
+ return Fe(this.sourceRows, e);
1441
1495
  }
1442
1496
  copyGridThemeContext(e) {
1443
1497
  const t = this.gridElement;
@@ -1454,7 +1508,7 @@ class T extends R {
1454
1508
  return;
1455
1509
  }
1456
1510
  const e = document.createElement("style");
1457
- e.id = "tbw-filter-panel-styles", e.textContent = Mt, document.head.appendChild(e), this.globalStylesInjected = !0;
1511
+ e.id = "tbw-filter-panel-styles", e.textContent = Vt, document.head.appendChild(e), this.globalStylesInjected = !0;
1458
1512
  }
1459
1513
  toggleFilterPanel(e, t, i) {
1460
1514
  if (this.openPanelField === e) {
@@ -1469,8 +1523,8 @@ class T extends R {
1469
1523
  });
1470
1524
  return;
1471
1525
  }
1472
- const r = Ee(this.sourceRows, e);
1473
- this.renderPanelContent(e, t, n, r), document.body.appendChild(n), this.positionPanel(n, i), this.setupPanelCloseHandler(n, i);
1526
+ const r = Fe(this.sourceRows, e);
1527
+ document.body.appendChild(n), this.positionPanel(n, i), this.renderPanelContent(e, t, n, r), this.setupPanelCloseHandler(n, i);
1474
1528
  }
1475
1529
  renderPanelContent(e, t, i, n) {
1476
1530
  let r = this.excludedValues.get(e);
@@ -1493,7 +1547,14 @@ class T extends R {
1493
1547
  closePanel: () => this.closeFilterPanel()
1494
1548
  };
1495
1549
  let l = !1;
1496
- this.config.filterPanelRenderer && (this.config.filterPanelRenderer(i, a), l = i.children.length > 0), l || this.renderDefaultFilterPanel(i, a, n, r);
1550
+ if (this.config.filterPanelRenderer && (this.config.filterPanelRenderer(i, a), l = i.children.length > 0), !l && t.type) {
1551
+ const d = this.grid.effectiveConfig.typeDefaults?.[t.type];
1552
+ d?.filterPanelRenderer && (d.filterPanelRenderer(i, a), l = i.children.length > 0);
1553
+ }
1554
+ if (!l) {
1555
+ const d = t.type;
1556
+ d === "number" ? this.renderNumberFilterPanel(i, a, n) : d === "date" ? this.renderDateFilterPanel(i, a, n) : this.renderDefaultFilterPanel(i, a, n, r);
1557
+ }
1497
1558
  }
1498
1559
  setupPanelCloseHandler(e, t) {
1499
1560
  this.panelAbortController = new AbortController(), setTimeout(() => {
@@ -1512,11 +1573,11 @@ class T extends R {
1512
1573
  }
1513
1574
  static supportsAnchorPositioning = null;
1514
1575
  static checkAnchorPositioningSupport() {
1515
- return T.supportsAnchorPositioning === null && (T.supportsAnchorPositioning = CSS.supports("anchor-name", "--test")), T.supportsAnchorPositioning;
1576
+ return q.supportsAnchorPositioning === null && (q.supportsAnchorPositioning = CSS.supports("anchor-name", "--test")), q.supportsAnchorPositioning;
1516
1577
  }
1517
1578
  positionPanel(e, t) {
1518
1579
  const n = t.closest(".cell") ?? t;
1519
- if (n.style.anchorName = "--tbw-filter-anchor", this.panelAnchorElement = n, T.checkAnchorPositioningSupport()) {
1580
+ if (n.style.anchorName = "--tbw-filter-anchor", this.panelAnchorElement = n, q.checkAnchorPositioningSupport()) {
1520
1581
  requestAnimationFrame(() => {
1521
1582
  const o = e.getBoundingClientRect(), a = n.getBoundingClientRect();
1522
1583
  o.top < a.top && e.classList.add("tbw-filter-panel-above");
@@ -1543,99 +1604,201 @@ class T extends R {
1543
1604
  const h = document.createElement("span");
1544
1605
  h.textContent = "Select All", c.appendChild(u), c.appendChild(h), d.appendChild(c);
1545
1606
  const g = () => {
1546
- const y = [...w.values()], E = y.every((x) => x), A = y.every((x) => !x);
1547
- u.checked = E, u.indeterminate = !E && !A;
1607
+ const b = [...v.values()], R = b.every((C) => C), T = b.every((C) => !C);
1608
+ u.checked = R, u.indeterminate = !R && !T;
1548
1609
  };
1549
1610
  u.addEventListener("change", () => {
1550
- const y = u.checked;
1551
- for (const E of w.keys())
1552
- w.set(E, y);
1553
- g(), S();
1611
+ const b = u.checked;
1612
+ for (const R of v.keys())
1613
+ v.set(R, b);
1614
+ g(), A();
1554
1615
  }), e.appendChild(d);
1555
1616
  const f = document.createElement("div");
1556
1617
  f.className = "tbw-filter-values";
1557
1618
  const p = document.createElement("div");
1558
1619
  p.className = "tbw-filter-values-spacer", f.appendChild(p);
1559
- const m = document.createElement("div");
1560
- m.className = "tbw-filter-values-content", f.appendChild(m);
1561
- const w = /* @__PURE__ */ new Map();
1562
- i.forEach((y) => {
1563
- const E = y == null ? "__null__" : String(y);
1564
- w.set(E, !n.has(y));
1620
+ const w = document.createElement("div");
1621
+ w.className = "tbw-filter-values-content", f.appendChild(w);
1622
+ const v = /* @__PURE__ */ new Map();
1623
+ i.forEach((b) => {
1624
+ const R = b == null ? "__null__" : String(b);
1625
+ v.set(R, !n.has(b));
1565
1626
  }), g();
1566
- let b = [];
1567
- const v = (y, E) => {
1568
- const A = y == null ? "(Blank)" : String(y), x = y == null ? "__null__" : String(y), C = document.createElement("label");
1569
- C.className = "tbw-filter-value-item", C.style.position = "absolute", C.style.top = `${E * o}px`, C.style.left = "0", C.style.right = "0", C.style.height = `${o}px`, C.style.boxSizing = "border-box";
1570
- const k = document.createElement("input");
1571
- k.type = "checkbox", k.className = "tbw-filter-checkbox", k.checked = w.get(x) ?? !0, k.dataset.value = x, k.addEventListener("change", () => {
1572
- w.set(x, k.checked), g();
1627
+ let y = [];
1628
+ const x = (b, R) => {
1629
+ const T = b == null ? "(Blank)" : String(b), C = b == null ? "__null__" : String(b), m = document.createElement("label");
1630
+ m.className = "tbw-filter-value-item", m.style.position = "absolute", m.style.top = `calc(var(--tbw-filter-item-height, 28px) * ${R})`, m.style.left = "0", m.style.right = "0", m.style.boxSizing = "border-box";
1631
+ const E = document.createElement("input");
1632
+ E.type = "checkbox", E.className = "tbw-filter-checkbox", E.checked = v.get(C) ?? !0, E.dataset.value = C, E.addEventListener("change", () => {
1633
+ v.set(C, E.checked), g();
1573
1634
  });
1574
- const he = document.createElement("span");
1575
- return he.textContent = A, C.appendChild(k), C.appendChild(he), C;
1576
- }, S = () => {
1577
- const y = b.length, E = f.clientHeight, A = f.scrollTop;
1578
- if (p.style.height = `${y * o}px`, Tt(y, T.LIST_BYPASS_THRESHOLD / 3)) {
1579
- m.innerHTML = "", m.style.transform = "translateY(0px)", b.forEach((C, k) => {
1580
- m.appendChild(v(C, k));
1635
+ const M = document.createElement("span");
1636
+ return M.textContent = T, m.appendChild(E), m.appendChild(M), m;
1637
+ }, A = () => {
1638
+ const b = y.length, R = f.clientHeight, T = f.scrollTop;
1639
+ if (p.style.height = `${b * o}px`, zt(b, q.LIST_BYPASS_THRESHOLD / 3)) {
1640
+ w.innerHTML = "", w.style.transform = "translateY(0px)", y.forEach((m, E) => {
1641
+ w.appendChild(x(m, E));
1581
1642
  });
1582
1643
  return;
1583
1644
  }
1584
- const x = Lt({
1585
- totalRows: y,
1586
- viewportHeight: E,
1587
- scrollTop: A,
1645
+ const C = Ht({
1646
+ totalRows: b,
1647
+ viewportHeight: R,
1648
+ scrollTop: T,
1588
1649
  rowHeight: o,
1589
- overscan: T.LIST_OVERSCAN
1650
+ overscan: q.LIST_OVERSCAN
1590
1651
  });
1591
- m.style.transform = `translateY(${x.offsetY}px)`, m.innerHTML = "";
1592
- for (let C = x.start; C < x.end; C++)
1593
- m.appendChild(v(b[C], C - x.start));
1594
- }, K = (y) => {
1595
- const E = this.config.caseSensitive ?? !1, A = E ? y : y.toLowerCase();
1596
- if (b = i.filter((x) => {
1597
- const C = x == null ? "(Blank)" : String(x), k = E ? C : C.toLowerCase();
1598
- return !y || k.includes(A);
1599
- }), b.length === 0) {
1600
- p.style.height = "0px", m.innerHTML = "";
1601
- const x = document.createElement("div");
1602
- x.className = "tbw-filter-no-match", x.textContent = "No matching values", m.appendChild(x);
1652
+ w.style.transform = `translateY(${C.offsetY}px)`, w.innerHTML = "";
1653
+ for (let m = C.start; m < C.end; m++)
1654
+ w.appendChild(x(y[m], m - C.start));
1655
+ }, F = (b) => {
1656
+ const R = this.config.caseSensitive ?? !1, T = R ? b : b.toLowerCase();
1657
+ if (y = i.filter((C) => {
1658
+ const m = C == null ? "(Blank)" : String(C), E = R ? m : m.toLowerCase();
1659
+ return !b || E.includes(T);
1660
+ }), y.length === 0) {
1661
+ p.style.height = "0px", w.innerHTML = "";
1662
+ const C = document.createElement("div");
1663
+ C.className = "tbw-filter-no-match", C.textContent = "No matching values", w.appendChild(C);
1603
1664
  return;
1604
1665
  }
1605
- S();
1666
+ A();
1606
1667
  };
1607
1668
  f.addEventListener(
1608
1669
  "scroll",
1609
1670
  () => {
1610
- b.length > 0 && S();
1671
+ y.length > 0 && A();
1611
1672
  },
1612
1673
  { passive: !0 }
1613
- ), K(l.value), e.appendChild(f);
1614
- let ue;
1674
+ ), F(l.value), e.appendChild(f);
1675
+ let k;
1615
1676
  l.addEventListener("input", () => {
1616
- clearTimeout(ue), ue = setTimeout(() => {
1617
- this.searchText.set(r, l.value), K(l.value);
1677
+ clearTimeout(k), k = setTimeout(() => {
1678
+ this.searchText.set(r, l.value), F(l.value);
1618
1679
  }, this.config.debounceMs ?? 150);
1619
1680
  });
1620
- const G = document.createElement("div");
1621
- G.className = "tbw-filter-buttons";
1622
- const O = document.createElement("button");
1623
- O.className = "tbw-filter-apply-btn", O.textContent = "Apply", O.addEventListener("click", () => {
1624
- const y = [];
1625
- for (const [E, A] of w)
1626
- if (!A)
1627
- if (E === "__null__")
1628
- y.push(null);
1681
+ const I = document.createElement("div");
1682
+ I.className = "tbw-filter-buttons";
1683
+ const L = document.createElement("button");
1684
+ L.className = "tbw-filter-apply-btn", L.textContent = "Apply", L.addEventListener("click", () => {
1685
+ const b = [];
1686
+ for (const [R, T] of v)
1687
+ if (!T)
1688
+ if (R === "__null__")
1689
+ b.push(null);
1629
1690
  else {
1630
- const x = i.find((C) => String(C) === E);
1631
- y.push(x !== void 0 ? x : E);
1691
+ const C = i.find((m) => String(m) === R);
1692
+ b.push(C !== void 0 ? C : R);
1632
1693
  }
1633
- t.applySetFilter(y);
1634
- }), G.appendChild(O);
1635
- const B = document.createElement("button");
1636
- B.className = "tbw-filter-clear-btn", B.textContent = "Clear Filter", B.addEventListener("click", () => {
1694
+ t.applySetFilter(b);
1695
+ }), I.appendChild(L);
1696
+ const P = document.createElement("button");
1697
+ P.className = "tbw-filter-clear-btn", P.textContent = "Clear Filter", P.addEventListener("click", () => {
1637
1698
  t.clearFilter();
1638
- }), G.appendChild(B), e.appendChild(G);
1699
+ }), I.appendChild(P), e.appendChild(I);
1700
+ }
1701
+ renderNumberFilterPanel(e, t, i) {
1702
+ const { field: n, column: r } = t, o = r.filterParams, a = r.editorParams, l = (S, z) => {
1703
+ if (typeof S == "number") return S;
1704
+ if (typeof S == "string") {
1705
+ const W = parseFloat(S);
1706
+ return isNaN(W) ? z : W;
1707
+ }
1708
+ return z;
1709
+ }, d = i.filter((S) => typeof S == "number" && !isNaN(S)), c = d.length > 0 ? Math.min(...d) : 0, u = d.length > 0 ? Math.max(...d) : 100, h = l(o?.min ?? a?.min, c), g = l(o?.max ?? a?.max, u), f = o?.step ?? a?.step ?? 1, p = this.filters.get(n);
1710
+ let w = h, v = g;
1711
+ p?.operator === "between" ? (w = l(p.value, h), v = l(p.valueTo, g)) : p?.operator === "greaterThanOrEqual" ? w = l(p.value, h) : p?.operator === "lessThanOrEqual" && (v = l(p.value, g));
1712
+ const y = document.createElement("div");
1713
+ y.className = "tbw-filter-range-title", y.textContent = r.header || n, e.appendChild(y);
1714
+ const x = document.createElement("div");
1715
+ x.className = "tbw-filter-range-inputs";
1716
+ const A = document.createElement("div");
1717
+ A.className = "tbw-filter-range-group";
1718
+ const F = document.createElement("label");
1719
+ F.textContent = "Min", F.className = "tbw-filter-range-label";
1720
+ const k = document.createElement("input");
1721
+ k.type = "number", k.className = "tbw-filter-range-input", k.min = String(h), k.max = String(g), k.step = String(f), k.value = String(w), A.appendChild(F), A.appendChild(k), x.appendChild(A);
1722
+ const I = document.createElement("span");
1723
+ I.className = "tbw-filter-range-separator", I.textContent = "–", x.appendChild(I);
1724
+ const L = document.createElement("div");
1725
+ L.className = "tbw-filter-range-group";
1726
+ const P = document.createElement("label");
1727
+ P.textContent = "Max", P.className = "tbw-filter-range-label";
1728
+ const b = document.createElement("input");
1729
+ b.type = "number", b.className = "tbw-filter-range-input", b.min = String(h), b.max = String(g), b.step = String(f), b.value = String(v), L.appendChild(P), L.appendChild(b), x.appendChild(L), e.appendChild(x);
1730
+ const R = document.createElement("div");
1731
+ R.className = "tbw-filter-range-slider";
1732
+ const T = document.createElement("div");
1733
+ T.className = "tbw-filter-range-track";
1734
+ const C = document.createElement("div");
1735
+ C.className = "tbw-filter-range-fill";
1736
+ const m = document.createElement("input");
1737
+ m.type = "range", m.className = "tbw-filter-range-thumb tbw-filter-range-thumb-min", m.min = String(h), m.max = String(g), m.step = String(f), m.value = String(w);
1738
+ const E = document.createElement("input");
1739
+ E.type = "range", E.className = "tbw-filter-range-thumb tbw-filter-range-thumb-max", E.min = String(h), E.max = String(g), E.step = String(f), E.value = String(v), R.appendChild(T), R.appendChild(C), R.appendChild(m), R.appendChild(E), e.appendChild(R);
1740
+ const M = () => {
1741
+ const S = parseFloat(m.value), z = parseFloat(E.value), W = g - h, ve = (S - h) / W * 100, st = (z - h) / W * 100;
1742
+ C.style.left = `${ve}%`, C.style.width = `${st - ve}%`;
1743
+ };
1744
+ m.addEventListener("input", () => {
1745
+ const S = Math.min(parseFloat(m.value), parseFloat(E.value));
1746
+ m.value = String(S), k.value = String(S), M();
1747
+ }), E.addEventListener("input", () => {
1748
+ const S = Math.max(parseFloat(E.value), parseFloat(m.value));
1749
+ E.value = String(S), b.value = String(S), M();
1750
+ }), k.addEventListener("input", () => {
1751
+ let S = parseFloat(k.value) || h;
1752
+ S = Math.max(h, Math.min(S, parseFloat(b.value))), m.value = String(S), M();
1753
+ }), b.addEventListener("input", () => {
1754
+ let S = parseFloat(b.value) || g;
1755
+ S = Math.min(g, Math.max(S, parseFloat(k.value))), E.value = String(S), M();
1756
+ }), M();
1757
+ const Y = document.createElement("div");
1758
+ Y.className = "tbw-filter-buttons";
1759
+ const X = document.createElement("button");
1760
+ X.className = "tbw-filter-apply-btn", X.textContent = "Apply", X.addEventListener("click", () => {
1761
+ const S = parseFloat(k.value), z = parseFloat(b.value);
1762
+ t.applyTextFilter("between", S, z);
1763
+ }), Y.appendChild(X);
1764
+ const Z = document.createElement("button");
1765
+ Z.className = "tbw-filter-clear-btn", Z.textContent = "Clear Filter", Z.addEventListener("click", () => {
1766
+ t.clearFilter();
1767
+ }), Y.appendChild(Z), e.appendChild(Y);
1768
+ }
1769
+ renderDateFilterPanel(e, t, i) {
1770
+ const { field: n, column: r } = t, o = r.filterParams, a = r.editorParams, l = i.filter((m) => m instanceof Date || typeof m == "string" && !isNaN(Date.parse(m))).map((m) => m instanceof Date ? m : new Date(m)).filter((m) => !isNaN(m.getTime())), d = l.length > 0 ? new Date(Math.min(...l.map((m) => m.getTime()))) : null, c = l.length > 0 ? new Date(Math.max(...l.map((m) => m.getTime()))) : null, u = (m) => m ? m.toISOString().split("T")[0] : "", h = (m) => m ? typeof m == "string" ? m : typeof m == "number" ? u(new Date(m)) : "" : "", g = h(o?.min) || h(a?.min) || u(d), f = h(o?.max) || h(a?.max) || u(c), p = this.filters.get(n);
1771
+ let w = "", v = "";
1772
+ p?.operator === "between" ? (w = h(p.value) || "", v = h(p.valueTo) || "") : p?.operator === "greaterThanOrEqual" ? w = h(p.value) || "" : p?.operator === "lessThanOrEqual" && (v = h(p.value) || "");
1773
+ const y = document.createElement("div");
1774
+ y.className = "tbw-filter-range-title", y.textContent = r.header || n, e.appendChild(y);
1775
+ const x = document.createElement("div");
1776
+ x.className = "tbw-filter-date-range";
1777
+ const A = document.createElement("div");
1778
+ A.className = "tbw-filter-date-group";
1779
+ const F = document.createElement("label");
1780
+ F.textContent = "From", F.className = "tbw-filter-range-label";
1781
+ const k = document.createElement("input");
1782
+ k.type = "date", k.className = "tbw-filter-date-input", g && (k.min = g), f && (k.max = f), k.value = w, A.appendChild(F), A.appendChild(k), x.appendChild(A);
1783
+ const I = document.createElement("span");
1784
+ I.className = "tbw-filter-range-separator", I.textContent = "–", x.appendChild(I);
1785
+ const L = document.createElement("div");
1786
+ L.className = "tbw-filter-date-group";
1787
+ const P = document.createElement("label");
1788
+ P.textContent = "To", P.className = "tbw-filter-range-label";
1789
+ const b = document.createElement("input");
1790
+ b.type = "date", b.className = "tbw-filter-date-input", g && (b.min = g), f && (b.max = f), b.value = v, L.appendChild(P), L.appendChild(b), x.appendChild(L), e.appendChild(x);
1791
+ const R = document.createElement("div");
1792
+ R.className = "tbw-filter-buttons";
1793
+ const T = document.createElement("button");
1794
+ T.className = "tbw-filter-apply-btn", T.textContent = "Apply", T.addEventListener("click", () => {
1795
+ const m = k.value, E = b.value;
1796
+ m && E ? t.applyTextFilter("between", m, E) : m ? t.applyTextFilter("greaterThanOrEqual", m) : E ? t.applyTextFilter("lessThanOrEqual", E) : t.clearFilter();
1797
+ }), R.appendChild(T);
1798
+ const C = document.createElement("button");
1799
+ C.className = "tbw-filter-clear-btn", C.textContent = "Clear Filter", C.addEventListener("click", () => {
1800
+ t.clearFilter();
1801
+ }), R.appendChild(C), e.appendChild(R);
1639
1802
  }
1640
1803
  applySetFilter(e, t) {
1641
1804
  this.excludedValues.set(e, new Set(t)), t.length === 0 ? this.filters.delete(e) : this.filters.set(e, {
@@ -1701,7 +1864,7 @@ class T extends R {
1701
1864
  this.filters.set(e, i), this.cachedResult = null, this.cacheKey = null;
1702
1865
  }
1703
1866
  }
1704
- function Se(s) {
1867
+ function Ie(s) {
1705
1868
  if (!s.length) return [];
1706
1869
  const e = /* @__PURE__ */ new Map(), t = [], i = (o, a) => {
1707
1870
  if (!a.length) return;
@@ -1736,7 +1899,7 @@ function Se(s) {
1736
1899
  }, e.set(d, c), t.push(c)), c.columns.push(o);
1737
1900
  }), n.length && i(r, n), t.length === 1 && t[0].implicit && t[0].columns.length === s.length ? [] : t;
1738
1901
  }
1739
- function qt(s, e, t) {
1902
+ function Wt(s, e, t) {
1740
1903
  if (!e.length || !s) return;
1741
1904
  const i = /* @__PURE__ */ new Map();
1742
1905
  for (const r of e)
@@ -1752,7 +1915,7 @@ function qt(s, e, t) {
1752
1915
  a && a.classList.add("group-end");
1753
1916
  }
1754
1917
  }
1755
- function Kt(s, e) {
1918
+ function $t(s, e) {
1756
1919
  if (s.length === 0) return null;
1757
1920
  const t = document.createElement("div");
1758
1921
  t.className = "header-group-row", t.setAttribute("role", "row");
@@ -1764,11 +1927,11 @@ function Kt(s, e) {
1764
1927
  }
1765
1928
  return t;
1766
1929
  }
1767
- function Nt(s) {
1930
+ function jt(s) {
1768
1931
  return s.some((e) => e.group != null);
1769
1932
  }
1770
- const Ht = "@layer tbw-plugins{.header-group-row{display:grid;grid-auto-flow:column;background:var(--tbw-grouping-columns-header-bg, var(--tbw-color-header-bg));border-bottom:1px solid var(--tbw-grouping-columns-border, var(--tbw-color-border))}.header-group-cell{display:flex;align-items:center;justify-content:center;padding:var(--tbw-button-padding-sm, .25rem .5rem);font-weight:600;font-size:var(--tbw-font-size-sm, .9em);text-transform:uppercase;letter-spacing:.5px;border-right:2px solid var(--tbw-grouping-columns-separator, var(--tbw-color-border-strong, var(--tbw-color-border)))}.header-group-cell:last-child{border-right:none}.header-row .cell.grouped{border-top:none}.header-row .cell.group-end{border-right:2px solid var(--tbw-grouping-columns-separator, var(--tbw-color-border-strong, var(--tbw-color-border)))}.header-row .cell.group-end:last-child{border-right:none}.rows .cell.group-end{border-right:2px solid var(--tbw-grouping-columns-separator, var(--tbw-color-border-strong, var(--tbw-color-border)))}.rows .cell.group-end:last-child{border-right:none}.header-group-row.no-borders{border-bottom:none}.header-group-row.no-borders .header-group-cell{border-right:none}.header-row.no-group-borders .cell.group-end{border-right:1px solid var(--tbw-color-border)}}";
1771
- class ln extends R {
1933
+ const Ut = "@layer tbw-plugins{.header-group-row{display:grid;grid-auto-flow:column;background:var(--tbw-grouping-columns-header-bg, var(--tbw-color-header-bg));border-bottom:1px solid var(--tbw-grouping-columns-border, var(--tbw-color-border))}.header-group-cell{display:flex;align-items:center;justify-content:center;padding:var(--tbw-button-padding-sm, .25rem .5rem);font-weight:600;font-size:var(--tbw-font-size-sm, .9em);text-transform:uppercase;letter-spacing:.5px;border-right:2px solid var(--tbw-grouping-columns-separator, var(--tbw-color-border-strong, var(--tbw-color-border)))}.header-group-cell:last-child{border-right:none}.header-row .cell.grouped{border-top:none}.header-row .cell.group-end{border-right:2px solid var(--tbw-grouping-columns-separator, var(--tbw-color-border-strong, var(--tbw-color-border)))}.header-row .cell.group-end:last-child{border-right:none}.rows .cell.group-end{border-right:2px solid var(--tbw-grouping-columns-separator, var(--tbw-color-border-strong, var(--tbw-color-border)))}.rows .cell.group-end:last-child{border-right:none}.header-group-row.no-borders{border-bottom:none}.header-group-row.no-borders .header-group-cell{border-right:none}.header-row.no-group-borders .cell.group-end{border-right:1px solid var(--tbw-color-border)}}";
1934
+ class mn extends _ {
1772
1935
  static manifest = {
1773
1936
  ownedProperties: [
1774
1937
  {
@@ -1785,7 +1948,7 @@ class ln extends R {
1785
1948
  ]
1786
1949
  };
1787
1950
  name = "groupingColumns";
1788
- styles = Ht;
1951
+ styles = Ut;
1789
1952
  get defaultConfig() {
1790
1953
  return {
1791
1954
  showGroupBorders: !0
@@ -1800,7 +1963,7 @@ class ln extends R {
1800
1963
  if (t?.columnGroups && Array.isArray(t.columnGroups) && t.columnGroups.length > 0)
1801
1964
  return !0;
1802
1965
  const i = t?.columns;
1803
- return Array.isArray(i) ? Nt(i) : !1;
1966
+ return Array.isArray(i) ? jt(i) : !1;
1804
1967
  }
1805
1968
  processColumns(e) {
1806
1969
  const t = this.grid?.gridConfig?.columnGroups;
@@ -1816,7 +1979,7 @@ class ln extends R {
1816
1979
  });
1817
1980
  } else
1818
1981
  i = [...e];
1819
- const n = Se(i);
1982
+ const n = Ie(i);
1820
1983
  return n.length === 0 ? (this.isActive = !1, this.groups = [], i) : (this.isActive = !0, this.groups = n, i);
1821
1984
  }
1822
1985
  afterRender() {
@@ -1829,16 +1992,16 @@ class ln extends R {
1829
1992
  if (!e) return;
1830
1993
  const t = e.querySelector(".header-group-row");
1831
1994
  t && t.remove();
1832
- const i = this.columns, n = Se(i);
1995
+ const i = this.columns, n = Ie(i);
1833
1996
  if (n.length === 0) return;
1834
- const r = Kt(n, i);
1997
+ const r = $t(n, i);
1835
1998
  if (r) {
1836
1999
  r.classList.toggle("no-borders", !this.config.showGroupBorders);
1837
2000
  const a = e.querySelector(".header-row");
1838
2001
  a ? e.insertBefore(r, a) : e.appendChild(r);
1839
2002
  }
1840
2003
  const o = e.querySelector(".header-row");
1841
- o && (o.classList.toggle("no-group-borders", !this.config.showGroupBorders), qt(o, n)), this.#e(n);
2004
+ o && (o.classList.toggle("no-group-borders", !this.config.showGroupBorders), Wt(o, n)), this.#e(n);
1842
2005
  }
1843
2006
  #e(e) {
1844
2007
  if (!this.config.showGroupBorders) return;
@@ -1869,7 +2032,7 @@ class ln extends R {
1869
2032
  this.requestRender();
1870
2033
  }
1871
2034
  }
1872
- function ke({ rows: s, config: e, expanded: t, initialExpanded: i }) {
2035
+ function Pe({ rows: s, config: e, expanded: t, initialExpanded: i }) {
1873
2036
  const n = e.groupOn;
1874
2037
  if (typeof n != "function")
1875
2038
  return [];
@@ -1880,8 +2043,8 @@ function ke({ rows: s, config: e, expanded: t, initialExpanded: i }) {
1880
2043
  let u = r;
1881
2044
  c.forEach((h, g) => {
1882
2045
  const f = h == null ? "∅" : String(h), p = u.key === "__root__" ? f : u.key + "||" + f;
1883
- let m = u.children.get(f);
1884
- m || (m = { key: p, value: h, depth: g, rows: [], children: /* @__PURE__ */ new Map(), parent: u }, u.children.set(f, m)), u = m;
2046
+ let w = u.children.get(f);
2047
+ w || (w = { key: p, value: h, depth: g, rows: [], children: /* @__PURE__ */ new Map(), parent: u }, u.children.set(f, w)), u = w;
1885
2048
  }), u.rows.push(d);
1886
2049
  }), r.children.size === 1 && r.children.has("__ungrouped__") && r.children.get("__ungrouped__").rows.length === s.length)
1887
2050
  return [];
@@ -1902,20 +2065,20 @@ function ke({ rows: s, config: e, expanded: t, initialExpanded: i }) {
1902
2065
  };
1903
2066
  return l(r), a;
1904
2067
  }
1905
- function zt(s, e) {
2068
+ function Yt(s, e) {
1906
2069
  const t = new Set(s);
1907
2070
  return t.has(e) ? t.delete(e) : t.add(e), t;
1908
2071
  }
1909
- function Gt(s) {
2072
+ function Xt(s) {
1910
2073
  const e = /* @__PURE__ */ new Set();
1911
2074
  for (const t of s)
1912
2075
  t.kind === "group" && e.add(t.key);
1913
2076
  return e;
1914
2077
  }
1915
- function Ot() {
2078
+ function Zt() {
1916
2079
  return /* @__PURE__ */ new Set();
1917
2080
  }
1918
- function Bt(s, e) {
2081
+ function Jt(s, e) {
1919
2082
  if (s === !0)
1920
2083
  return new Set(e);
1921
2084
  if (s === !1 || s == null)
@@ -1926,14 +2089,14 @@ function Bt(s, e) {
1926
2089
  }
1927
2090
  return typeof s == "string" ? /* @__PURE__ */ new Set([s]) : Array.isArray(s) ? new Set(s) : /* @__PURE__ */ new Set();
1928
2091
  }
1929
- function Vt(s) {
2092
+ function Qt(s) {
1930
2093
  return s.filter((e) => e.kind === "group").map((e) => e.key);
1931
2094
  }
1932
- function Wt(s) {
2095
+ function ei(s) {
1933
2096
  return s.kind !== "group" ? 0 : s.rows.length;
1934
2097
  }
1935
- const $t = "@layer tbw-plugins{.group-row{display:grid;grid-template-columns:var(--tbw-column-template);background:var(--tbw-grouping-rows-bg, var(--tbw-color-panel-bg));font-weight:500;border-bottom:var(--tbw-row-divider);min-height:var(--tbw-row-height)}.group-row .cell{display:flex;align-items:center;padding:var(--tbw-cell-padding, .125rem .5rem)}.group-row:hover{background:var(--tbw-grouping-rows-bg-hover, var(--tbw-color-row-hover))}.group-toggle{cursor:pointer;user-select:none;display:inline-flex;align-items:center;justify-content:center;width:var(--tbw-toggle-size, 1.25rem);height:var(--tbw-toggle-size, 1.25rem);margin-right:.25rem;background:none;border:0;font:inherit}.group-toggle:hover{background:var(--tbw-grouping-rows-toggle-hover, var(--tbw-color-row-hover));border-radius:var(--tbw-border-radius, .125rem)}.group-label{display:inline-flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.group-count{color:var(--tbw-grouping-rows-count-color, var(--tbw-color-fg-muted));font-size:var(--tbw-font-size-xs, .85em);font-weight:400}.group-aggregates{display:inline-flex;align-items:center;gap:var(--tbw-spacing-lg, 1rem);margin-left:var(--tbw-spacing-lg, 1rem);font-weight:400;font-size:var(--tbw-font-size-sm, .875em);color:var(--tbw-grouping-rows-aggregate-color, var(--tbw-color-fg-muted))}.group-aggregate{white-space:nowrap}.group-row{padding-left:calc(var(--tbw-group-depth, 0) * var(--tbw-group-indent-width, 1.25em))}.data-grid-row.tbw-group-slide-in{animation:tbw-group-slide-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-group-slide-in{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}.data-grid-row.tbw-group-fade-in{animation:tbw-group-fade-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-group-fade-in{0%{opacity:0}to{opacity:1}}}";
1936
- class dn extends R {
2098
+ const ti = "@layer tbw-plugins{.group-row{display:grid;grid-template-columns:var(--tbw-column-template);background:var(--tbw-grouping-rows-bg, var(--tbw-color-panel-bg));font-weight:500;border-bottom:var(--tbw-row-divider);min-height:var(--tbw-row-height)}.group-row .cell{display:flex;align-items:center;padding:var(--tbw-cell-padding, .125rem .5rem)}.group-row:hover{background:var(--tbw-grouping-rows-bg-hover, var(--tbw-color-row-hover))}.group-toggle{cursor:pointer;user-select:none;display:inline-flex;align-items:center;justify-content:center;width:var(--tbw-toggle-size, 1.25rem);height:var(--tbw-toggle-size, 1.25rem);margin-right:.25rem;background:none;border:0;font:inherit}.group-toggle:hover{background:var(--tbw-grouping-rows-toggle-hover, var(--tbw-color-row-hover));border-radius:var(--tbw-border-radius, .125rem)}.group-label{display:inline-flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.group-count{color:var(--tbw-grouping-rows-count-color, var(--tbw-color-fg-muted));font-size:var(--tbw-font-size-xs, .85em);font-weight:400}.group-aggregates{display:inline-flex;align-items:center;gap:var(--tbw-spacing-lg, 1rem);margin-left:var(--tbw-spacing-lg, 1rem);font-weight:400;font-size:var(--tbw-font-size-sm, .875em);color:var(--tbw-grouping-rows-aggregate-color, var(--tbw-color-fg-muted))}.group-aggregate{white-space:nowrap}.group-row{padding-left:calc(var(--tbw-group-depth, 0) * var(--tbw-group-indent-width, 1.25em))}.data-grid-row.tbw-group-slide-in{animation:tbw-group-slide-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-group-slide-in{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}.data-grid-row.tbw-group-fade-in{animation:tbw-group-fade-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-group-fade-in{0%{opacity:0}to{opacity:1}}}";
2099
+ class wn extends _ {
1937
2100
  static manifest = {
1938
2101
  configRules: [
1939
2102
  {
@@ -1948,7 +2111,7 @@ class dn extends R {
1948
2111
  ]
1949
2112
  };
1950
2113
  name = "groupingRows";
1951
- styles = $t;
2114
+ styles = ti;
1952
2115
  get defaultConfig() {
1953
2116
  return {
1954
2117
  defaultExpanded: !1,
@@ -1978,7 +2141,7 @@ class dn extends R {
1978
2141
  const t = this.config;
1979
2142
  if (typeof t.groupOn != "function")
1980
2143
  return this.isActive = !1, this.flattenedRows = [], [...e];
1981
- const i = ke({
2144
+ const i = Pe({
1982
2145
  rows: [...e],
1983
2146
  config: t,
1984
2147
  expanded: /* @__PURE__ */ new Set()
@@ -1987,10 +2150,10 @@ class dn extends R {
1987
2150
  return this.isActive = !1, this.flattenedRows = [], [...e];
1988
2151
  let n;
1989
2152
  if (!this.hasAppliedDefaultExpanded && this.expandedKeys.size === 0 && t.defaultExpanded !== !1) {
1990
- const a = Vt(i);
1991
- n = Bt(t.defaultExpanded ?? !1, a), n.size > 0 && (this.expandedKeys = new Set(n), this.hasAppliedDefaultExpanded = !0);
2153
+ const a = Qt(i);
2154
+ n = Jt(t.defaultExpanded ?? !1, a), n.size > 0 && (this.expandedKeys = new Set(n), this.hasAppliedDefaultExpanded = !0);
1992
2155
  }
1993
- const r = ke({
2156
+ const r = Pe({
1994
2157
  rows: [...e],
1995
2158
  config: t,
1996
2159
  expanded: this.expandedKeys,
@@ -2010,7 +2173,7 @@ class dn extends R {
2010
2173
  __groupDepth: a.depth,
2011
2174
  __groupRows: a.rows,
2012
2175
  __groupExpanded: a.expanded,
2013
- __groupRowCount: Wt(a)
2176
+ __groupRowCount: ei(a)
2014
2177
  } : a.row);
2015
2178
  }
2016
2179
  onCellClick(e) {
@@ -2082,12 +2245,12 @@ class dn extends R {
2082
2245
  const c = document.createElement("span");
2083
2246
  c.className = "group-aggregates";
2084
2247
  for (const [u, h] of d) {
2085
- const g = this.columns.find((p) => p.field === u), f = j(h, o, u, g);
2248
+ const g = this.columns.find((p) => p.field === u), f = te(h, o, u, g);
2086
2249
  if (f != null) {
2087
2250
  const p = document.createElement("span");
2088
2251
  p.className = "group-aggregate", p.setAttribute("data-field", u);
2089
- const m = g?.header ?? u;
2090
- p.textContent = `${m}: ${f}`, c.appendChild(p);
2252
+ const w = g?.header ?? u;
2253
+ p.textContent = `${w}: ${f}`, c.appendChild(p);
2091
2254
  }
2092
2255
  }
2093
2256
  c.children.length > 0 && a.appendChild(c);
@@ -2100,14 +2263,14 @@ class dn extends R {
2100
2263
  let c = !1;
2101
2264
  o.forEach((u, h) => {
2102
2265
  const g = document.createElement("div");
2103
- if (g.className = "cell group-cell", g.setAttribute("data-col", String(h)), g.setAttribute("role", "gridcell"), ae(u)) {
2266
+ if (g.className = "cell group-cell", g.setAttribute("data-col", String(h)), g.setAttribute("role", "gridcell"), pe(u)) {
2104
2267
  g.setAttribute("data-field", u.field), t.appendChild(g);
2105
2268
  return;
2106
2269
  }
2107
2270
  if (c) {
2108
2271
  const f = r[u.field];
2109
2272
  if (f) {
2110
- const p = j(f, a, u.field, u);
2273
+ const p = te(f, a, u.field, u);
2111
2274
  g.textContent = p != null ? String(p) : "";
2112
2275
  } else
2113
2276
  g.textContent = "";
@@ -2115,23 +2278,23 @@ class dn extends R {
2115
2278
  c = !0, g.appendChild(this.createToggleButton(e.__groupExpanded, i));
2116
2279
  const f = document.createElement("span"), p = r[u.field];
2117
2280
  if (p) {
2118
- const m = j(p, a, u.field, u);
2119
- f.textContent = m != null ? String(m) : String(e.__groupValue);
2281
+ const w = te(p, a, u.field, u);
2282
+ f.textContent = w != null ? String(w) : String(e.__groupValue);
2120
2283
  } else
2121
2284
  f.textContent = this.getGroupLabelText(e.__groupValue, e.__groupDepth || 0, e.__groupKey);
2122
2285
  if (g.appendChild(f), n.showRowCount !== !1) {
2123
- const m = document.createElement("span");
2124
- m.className = "group-count", m.textContent = ` (${a.length})`, g.appendChild(m);
2286
+ const w = document.createElement("span");
2287
+ w.className = "group-count", w.textContent = ` (${a.length})`, g.appendChild(w);
2125
2288
  }
2126
2289
  }
2127
2290
  t.appendChild(g);
2128
2291
  });
2129
2292
  }
2130
2293
  expandAll() {
2131
- this.expandedKeys = Gt(this.flattenedRows), this.requestRender();
2294
+ this.expandedKeys = Xt(this.flattenedRows), this.requestRender();
2132
2295
  }
2133
2296
  collapseAll() {
2134
- this.expandedKeys = Ot(), this.requestRender();
2297
+ this.expandedKeys = Zt(), this.requestRender();
2135
2298
  }
2136
2299
  toggle(e) {
2137
2300
  const t = !this.expandedKeys.has(e), i = this.config, n = this.flattenedRows.find((r) => r.kind === "group" && r.key === e);
@@ -2146,7 +2309,7 @@ class dn extends R {
2146
2309
  }
2147
2310
  r.add(e), this.expandedKeys = r;
2148
2311
  } else
2149
- this.expandedKeys = zt(this.expandedKeys, e);
2312
+ this.expandedKeys = Yt(this.expandedKeys, e);
2150
2313
  this.emit("group-toggle", {
2151
2314
  key: e,
2152
2315
  expanded: this.expandedKeys.has(e),
@@ -2194,22 +2357,22 @@ class dn extends R {
2194
2357
  this.config.groupOn = e, this.requestRender();
2195
2358
  }
2196
2359
  }
2197
- function Ae(s, e) {
2360
+ function De(s, e) {
2198
2361
  const t = new Set(s);
2199
2362
  return t.has(e) ? t.delete(e) : t.add(e), t;
2200
2363
  }
2201
- function jt(s, e) {
2364
+ function ii(s, e) {
2202
2365
  const t = new Set(s);
2203
2366
  return t.add(e), t;
2204
2367
  }
2205
- function Ut(s, e) {
2368
+ function ni(s, e) {
2206
2369
  const t = new Set(s);
2207
2370
  return t.delete(e), t;
2208
2371
  }
2209
- function Yt(s, e) {
2372
+ function ri(s, e) {
2210
2373
  return s.has(e);
2211
2374
  }
2212
- function Xt(s, e, t, i) {
2375
+ function oi(s, e, t, i) {
2213
2376
  const n = document.createElement("div");
2214
2377
  n.className = "master-detail-row", n.setAttribute("data-detail-for", String(e)), n.setAttribute("role", "row");
2215
2378
  const r = document.createElement("div");
@@ -2217,10 +2380,10 @@ function Xt(s, e, t, i) {
2217
2380
  const o = t(s, e);
2218
2381
  return typeof o == "string" ? r.innerHTML = o : o instanceof HTMLElement && r.appendChild(o), n.appendChild(r), n;
2219
2382
  }
2220
- const Zt = "@layer tbw-plugins{tbw-grid{.cell[data-field=__tbw_expander]{border-right:none!important;padding:0;display:flex;align-items:center;justify-content:center}.header-row .cell[data-field=__tbw_expander]{display:none}.header-row .cell[data-field=__tbw_expander]+.cell{grid-column:1 / 3}.master-detail-expander{display:flex;align-items:center;justify-content:center;width:100%;height:100%}.master-detail-toggle{cursor:pointer;opacity:.7;user-select:none;display:inline-flex;align-items:center;justify-content:center}.master-detail-toggle:hover{opacity:1}.master-detail-row{grid-column:1 / -1;display:grid;background:var(--tbw-master-detail-bg, var(--tbw-color-row-alt));border-bottom:1px solid var(--tbw-master-detail-border, var(--tbw-color-border));overflow:hidden}.master-detail-cell{padding:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem));overflow:auto}.master-detail-row.tbw-expanding{animation:tbw-detail-expand var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}.master-detail-row.tbw-collapsing{animation:tbw-detail-collapse var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}}@keyframes tbw-detail-expand{0%{opacity:0;max-height:0;padding-top:0;padding-bottom:0}to{opacity:1;max-height:var(--tbw-detail-max-height, 31.25rem);padding-top:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem));padding-bottom:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem))}}@keyframes tbw-detail-collapse{0%{opacity:1;max-height:var(--tbw-detail-max-height, 31.25rem)}to{opacity:0;max-height:0}}}";
2221
- class je extends R {
2383
+ const si = "@layer tbw-plugins{tbw-grid{.cell[data-field=__tbw_expander]{border-right:none!important;padding:0;display:flex;align-items:center;justify-content:center}.header-row .cell[data-field=__tbw_expander]{display:none}.header-row .cell[data-field=__tbw_expander]+.cell{grid-column:1 / 3}.master-detail-expander{display:flex;align-items:center;justify-content:center;width:100%;height:100%}.master-detail-toggle{cursor:pointer;opacity:.7;user-select:none;display:inline-flex;align-items:center;justify-content:center}.master-detail-toggle:hover{opacity:1}.master-detail-row{grid-column:1 / -1;display:grid;background:var(--tbw-master-detail-bg, var(--tbw-color-row-alt));border-bottom:1px solid var(--tbw-master-detail-border, var(--tbw-color-border));overflow:hidden}.master-detail-cell{padding:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem));overflow:auto}.master-detail-row.tbw-expanding{animation:tbw-detail-expand var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}.master-detail-row.tbw-collapsing{animation:tbw-detail-collapse var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}}@keyframes tbw-detail-expand{0%{opacity:0;max-height:0;padding-top:0;padding-bottom:0}to{opacity:1;max-height:var(--tbw-detail-max-height, 31.25rem);padding-top:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem));padding-bottom:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem))}}@keyframes tbw-detail-collapse{0%{opacity:1;max-height:var(--tbw-detail-max-height, 31.25rem)}to{opacity:0;max-height:0}}}";
2384
+ class tt extends _ {
2222
2385
  name = "masterDetail";
2223
- styles = Zt;
2386
+ styles = si;
2224
2387
  get defaultConfig() {
2225
2388
  return {
2226
2389
  detailHeight: "auto",
@@ -2249,8 +2412,8 @@ class je extends R {
2249
2412
  n !== null && (d.animation = n === "false" ? !1 : n), r !== null && (d.showExpandColumn = r !== "false"), o !== null && (d.expandOnRowClick = o === "true"), a !== null && (d.collapseOnClickOutside = a === "true"), l !== null && (d.detailHeight = l === "auto" ? "auto" : parseInt(l, 10));
2250
2413
  const c = t.innerHTML.trim();
2251
2414
  c && !this.config.detailRenderer && (d.detailRenderer = (u, h) => {
2252
- const g = et(c, { value: u, row: u });
2253
- return tt(g);
2415
+ const g = dt(c, { value: u, row: u });
2416
+ return ct(g);
2254
2417
  }), Object.keys(d).length > 0 && (this.config = { ...this.config, ...d });
2255
2418
  }
2256
2419
  get animationStyle() {
@@ -2281,10 +2444,10 @@ class je extends R {
2281
2444
  static DEFAULT_DETAIL_HEIGHT = 150;
2282
2445
  getDetailHeight(e) {
2283
2446
  const t = this.detailElements.get(e);
2284
- return t ? t.offsetHeight : typeof this.config?.detailHeight == "number" ? this.config.detailHeight : je.DEFAULT_DETAIL_HEIGHT;
2447
+ return t ? t.offsetHeight : typeof this.config?.detailHeight == "number" ? this.config.detailHeight : tt.DEFAULT_DETAIL_HEIGHT;
2285
2448
  }
2286
2449
  toggleAndEmit(e, t) {
2287
- this.expandedRows = Ae(this.expandedRows, e), this.emit("detail-expand", {
2450
+ this.expandedRows = De(this.expandedRows, e), this.emit("detail-expand", {
2288
2451
  rowIndex: t,
2289
2452
  row: e,
2290
2453
  expanded: this.expandedRows.has(e)
@@ -2297,9 +2460,9 @@ class je extends R {
2297
2460
  if (!(this.config.showExpandColumn === !0 || this.config.showExpandColumn !== !1 && !!this.config.detailRenderer))
2298
2461
  return [...e];
2299
2462
  const i = [...e];
2300
- if (ot(i))
2463
+ if (ft(i))
2301
2464
  return i;
2302
- const r = st(this.name);
2465
+ const r = pt(this.name);
2303
2466
  return r.viewRenderer = (o) => {
2304
2467
  const { row: a } = o, l = this.expandedRows.has(a), d = document.createElement("span");
2305
2468
  d.className = "master-detail-expander expander-cell";
@@ -2319,7 +2482,7 @@ class je extends R {
2319
2482
  onKeyDown(e) {
2320
2483
  if (e.key !== " ") return;
2321
2484
  const t = this.grid._focusCol, i = this.grid._focusRow, n = this.columns[t];
2322
- if (!n || !ae(n)) return;
2485
+ if (!n || !pe(n)) return;
2323
2486
  const r = this.rows[i];
2324
2487
  if (r)
2325
2488
  return e.preventDefault(), this.toggleAndEmit(r, i), this.requestRenderWithFocus(), !0;
@@ -2352,7 +2515,7 @@ class je extends R {
2352
2515
  d.previousElementSibling !== a && a.after(d);
2353
2516
  continue;
2354
2517
  }
2355
- const c = Xt(l, o, this.config.detailRenderer, n);
2518
+ const c = oi(l, o, this.config.detailRenderer, n);
2356
2519
  typeof this.config.detailHeight == "number" && (c.style.height = `${this.config.detailHeight}px`), a.after(c), this.detailElements.set(l, c), this.animateExpand(c);
2357
2520
  }
2358
2521
  }
@@ -2387,19 +2550,19 @@ class je extends R {
2387
2550
  }
2388
2551
  expand(e) {
2389
2552
  const t = this.rows[e];
2390
- t && (this.expandedRows = jt(this.expandedRows, t), this.requestRender());
2553
+ t && (this.expandedRows = ii(this.expandedRows, t), this.requestRender());
2391
2554
  }
2392
2555
  collapse(e) {
2393
2556
  const t = this.rows[e];
2394
- t && (this.expandedRows = Ut(this.expandedRows, t), this.requestRender());
2557
+ t && (this.expandedRows = ni(this.expandedRows, t), this.requestRender());
2395
2558
  }
2396
2559
  toggle(e) {
2397
2560
  const t = this.rows[e];
2398
- t && (this.expandedRows = Ae(this.expandedRows, t), this.requestRender());
2561
+ t && (this.expandedRows = De(this.expandedRows, t), this.requestRender());
2399
2562
  }
2400
2563
  isExpanded(e) {
2401
2564
  const t = this.rows[e];
2402
- return t ? Yt(this.expandedRows, t) : !1;
2565
+ return t ? ri(this.expandedRows, t) : !1;
2403
2566
  }
2404
2567
  expandAll() {
2405
2568
  for (const e of this.rows)
@@ -2429,34 +2592,34 @@ class je extends R {
2429
2592
  }
2430
2593
  }
2431
2594
  }
2432
- function Jt(s, e, t) {
2595
+ function ai(s, e, t) {
2433
2596
  return e.length ? [...s].sort((i, n) => {
2434
2597
  for (const r of e) {
2435
- const a = t.find((u) => u.field === r.field)?.sortComparator ?? Qt, l = i[r.field], d = n[r.field], c = a(l, d, i, n);
2598
+ const a = t.find((u) => u.field === r.field)?.sortComparator ?? li, l = i[r.field], d = n[r.field], c = a(l, d, i, n);
2436
2599
  if (c !== 0)
2437
2600
  return r.direction === "asc" ? c : -c;
2438
2601
  }
2439
2602
  return 0;
2440
2603
  }) : [...s];
2441
2604
  }
2442
- function Qt(s, e) {
2605
+ function li(s, e) {
2443
2606
  return s == null && e == null ? 0 : s == null ? 1 : e == null ? -1 : typeof s == "number" && typeof e == "number" ? s - e : s instanceof Date && e instanceof Date ? s.getTime() - e.getTime() : typeof s == "boolean" && typeof e == "boolean" ? s === e ? 0 : s ? -1 : 1 : String(s).localeCompare(String(e));
2444
2607
  }
2445
- function ei(s, e, t, i) {
2608
+ function di(s, e, t, i) {
2446
2609
  const n = s.find((r) => r.field === e);
2447
2610
  return t ? n ? n.direction === "asc" ? s.map((r) => r.field === e ? { ...r, direction: "desc" } : r) : s.filter((r) => r.field !== e) : s.length < i ? [...s, { field: e, direction: "asc" }] : s : n?.direction === "asc" ? [{ field: e, direction: "desc" }] : n?.direction === "desc" ? [] : [{ field: e, direction: "asc" }];
2448
2611
  }
2449
- function _e(s, e) {
2612
+ function Me(s, e) {
2450
2613
  const t = s.findIndex((i) => i.field === e);
2451
2614
  return t >= 0 ? t + 1 : void 0;
2452
2615
  }
2453
- function Le(s, e) {
2616
+ function Ne(s, e) {
2454
2617
  return s.find((t) => t.field === e)?.direction;
2455
2618
  }
2456
- const ti = '@layer tbw-plugins{.header-cell[data-sort=asc]:after{content:"↑";margin-left:4px;opacity:.8}.header-cell[data-sort=desc]:after{content:"↓";margin-left:4px;opacity:.8}.sort-indicator{margin-left:4px;opacity:.8}.sort-index{font-size:10px;background:var(--tbw-multi-sort-badge-bg, var(--tbw-color-panel-bg));color:var(--tbw-multi-sort-badge-color, var(--tbw-color-fg));border-radius:50%;width:14px;height:14px;display:inline-flex;align-items:center;justify-content:center;margin-left:2px;font-weight:600}}';
2457
- class cn extends R {
2619
+ const ci = '@layer tbw-plugins{.header-cell[data-sort=asc]:after{content:"↑";margin-left:var(--tbw-spacing-xs, .25em);opacity:.8}.header-cell[data-sort=desc]:after{content:"↓";margin-left:var(--tbw-spacing-xs, .25em);opacity:.8}.sort-indicator{margin-left:var(--tbw-spacing-xs, .25em);opacity:.8}.sort-index{font-size:var(--tbw-font-size-2xs, .7em);background:var(--tbw-multi-sort-badge-bg, var(--tbw-color-panel-bg));color:var(--tbw-multi-sort-badge-color, var(--tbw-color-fg));border-radius:50%;width:var(--tbw-multi-sort-badge-size, 1em);height:var(--tbw-multi-sort-badge-size, 1em);display:inline-flex;align-items:center;justify-content:center;margin-left:var(--tbw-spacing-xs, .125em);font-weight:600}}';
2620
+ class bn extends _ {
2458
2621
  name = "multiSort";
2459
- styles = ti;
2622
+ styles = ci;
2460
2623
  get defaultConfig() {
2461
2624
  return {
2462
2625
  maxSortColumns: 3,
@@ -2468,12 +2631,12 @@ class cn extends R {
2468
2631
  this.sortModel = [];
2469
2632
  }
2470
2633
  processRows(e) {
2471
- return this.sortModel.length === 0 ? [...e] : Jt([...e], this.sortModel, [...this.columns]);
2634
+ return this.sortModel.length === 0 ? [...e] : ai([...e], this.sortModel, [...this.columns]);
2472
2635
  }
2473
2636
  onHeaderClick(e) {
2474
2637
  if (!this.columns.find((r) => r.field === e.field)?.sortable) return !1;
2475
2638
  const i = e.originalEvent.shiftKey, n = this.config.maxSortColumns ?? 3;
2476
- return this.sortModel = ei(this.sortModel, e.field, i, n), this.emit("sort-change", { sortModel: [...this.sortModel] }), this.requestRender(), !0;
2639
+ return this.sortModel = di(this.sortModel, e.field, i, n), this.emit("sort-change", { sortModel: [...this.sortModel] }), this.requestRender(), !0;
2477
2640
  }
2478
2641
  afterRender() {
2479
2642
  const e = this.gridElement;
@@ -2482,7 +2645,7 @@ class cn extends R {
2482
2645
  e.querySelectorAll(".header-row .cell[data-field]").forEach((n) => {
2483
2646
  const r = n.getAttribute("data-field");
2484
2647
  if (!r) return;
2485
- const o = _e(this.sortModel, r), a = Le(this.sortModel, r);
2648
+ const o = Me(this.sortModel, r), a = Ne(this.sortModel, r);
2486
2649
  if (n.querySelector(".sort-index")?.remove(), a) {
2487
2650
  n.querySelector('[part~="sort-indicator"], .sort-indicator')?.remove(), n.setAttribute("data-sort", a);
2488
2651
  const c = document.createElement("span");
@@ -2506,10 +2669,10 @@ class cn extends R {
2506
2669
  this.sortModel = [], this.emit("sort-change", { sortModel: [] }), this.requestRender();
2507
2670
  }
2508
2671
  getSortIndex(e) {
2509
- return _e(this.sortModel, e);
2672
+ return Me(this.sortModel, e);
2510
2673
  }
2511
2674
  getSortDirection(e) {
2512
- return Le(this.sortModel, e);
2675
+ return Ne(this.sortModel, e);
2513
2676
  }
2514
2677
  getColumnState(e) {
2515
2678
  const t = this.sortModel.findIndex((n) => n.field === e);
@@ -2532,16 +2695,16 @@ class cn extends R {
2532
2695
  i !== -1 ? this.sortModel[i] = n : this.sortModel.splice(t.sort.priority, 0, n);
2533
2696
  }
2534
2697
  }
2535
- function ii(s) {
2698
+ function ui(s) {
2536
2699
  return s.filter((e) => e.sticky === "left");
2537
2700
  }
2538
- function ni(s) {
2701
+ function hi(s) {
2539
2702
  return s.filter((e) => e.sticky === "right");
2540
2703
  }
2541
- function Q(s) {
2704
+ function ae(s) {
2542
2705
  return s.some((e) => e.sticky === "left" || e.sticky === "right");
2543
2706
  }
2544
- function Te(s, e) {
2707
+ function qe(s, e) {
2545
2708
  const t = Array.from(s.querySelectorAll(".header-row .cell"));
2546
2709
  if (!t.length) return;
2547
2710
  const i = /* @__PURE__ */ new Map();
@@ -2565,12 +2728,12 @@ function Te(s, e) {
2565
2728
  }), r += l.offsetWidth);
2566
2729
  }
2567
2730
  }
2568
- function Ie(s) {
2731
+ function He(s) {
2569
2732
  s.querySelectorAll(".sticky-left, .sticky-right").forEach((t) => {
2570
2733
  t.classList.remove("sticky-left", "sticky-right"), t.style.position = "", t.style.left = "", t.style.right = "";
2571
2734
  });
2572
2735
  }
2573
- class un extends R {
2736
+ class vn extends _ {
2574
2737
  static manifest = {
2575
2738
  ownedProperties: [
2576
2739
  {
@@ -2593,26 +2756,26 @@ class un extends R {
2593
2756
  }
2594
2757
  static detect(e, t) {
2595
2758
  const i = t?.columns;
2596
- return Array.isArray(i) ? Q(i) : !1;
2759
+ return Array.isArray(i) ? ae(i) : !1;
2597
2760
  }
2598
2761
  processColumns(e) {
2599
- return this.isApplied = Q([...e]), [...e];
2762
+ return this.isApplied = ae([...e]), [...e];
2600
2763
  }
2601
2764
  afterRender() {
2602
2765
  if (!this.isApplied)
2603
2766
  return;
2604
2767
  const e = this.grid, t = [...this.columns];
2605
- if (!Q(t)) {
2606
- Ie(e), this.isApplied = !1;
2768
+ if (!ae(t)) {
2769
+ He(e), this.isApplied = !1;
2607
2770
  return;
2608
2771
  }
2609
2772
  queueMicrotask(() => {
2610
- Te(e, t);
2773
+ qe(e, t);
2611
2774
  });
2612
2775
  }
2613
2776
  onPluginQuery(e) {
2614
2777
  switch (e.type) {
2615
- case We.CAN_MOVE_COLUMN: {
2778
+ case Je.CAN_MOVE_COLUMN: {
2616
2779
  const t = e.context, i = t.sticky;
2617
2780
  if (i === "left" || i === "right")
2618
2781
  return !1;
@@ -2625,18 +2788,18 @@ class un extends R {
2625
2788
  }
2626
2789
  refreshStickyOffsets() {
2627
2790
  const e = [...this.columns];
2628
- Te(this.grid, e);
2791
+ qe(this.grid, e);
2629
2792
  }
2630
2793
  getLeftPinnedColumns() {
2631
2794
  const e = [...this.columns];
2632
- return ii(e);
2795
+ return ui(e);
2633
2796
  }
2634
2797
  getRightPinnedColumns() {
2635
2798
  const e = [...this.columns];
2636
- return ni(e);
2799
+ return hi(e);
2637
2800
  }
2638
2801
  clearStickyPositions() {
2639
- Ie(this.grid);
2802
+ He(this.grid);
2640
2803
  }
2641
2804
  getHorizontalScrollOffsets(e, t) {
2642
2805
  if (!this.isApplied)
@@ -2657,10 +2820,10 @@ class un extends R {
2657
2820
  return { left: i, right: n, skipScroll: r };
2658
2821
  }
2659
2822
  }
2660
- function ri(s) {
2823
+ function gi(s) {
2661
2824
  return typeof s == "object" && s !== null && "aggFunc" in s;
2662
2825
  }
2663
- function ee(s, e) {
2826
+ function le(s, e) {
2664
2827
  const t = document.createElement("div");
2665
2828
  t.className = "tbw-pinned-rows", t.setAttribute("role", "presentation"), t.setAttribute("aria-live", "polite");
2666
2829
  const i = document.createElement("div");
@@ -2682,7 +2845,7 @@ function ee(s, e) {
2682
2845
  }
2683
2846
  if (s.customPanels)
2684
2847
  for (const o of s.customPanels) {
2685
- const a = oi(o, e);
2848
+ const a = fi(o, e);
2686
2849
  switch (o.position) {
2687
2850
  case "left":
2688
2851
  i.appendChild(a);
@@ -2697,11 +2860,11 @@ function ee(s, e) {
2697
2860
  }
2698
2861
  return t.appendChild(i), t.appendChild(n), t.appendChild(r), t;
2699
2862
  }
2700
- function Pe(s) {
2863
+ function ze(s) {
2701
2864
  const e = document.createElement("div");
2702
2865
  return e.className = `tbw-aggregation-rows tbw-aggregation-rows-${s}`, e.setAttribute("role", "presentation"), e;
2703
2866
  }
2704
- function De(s, e, t, i) {
2867
+ function Ke(s, e, t, i) {
2705
2868
  s.innerHTML = "";
2706
2869
  for (const n of e) {
2707
2870
  const r = document.createElement("div");
@@ -2715,11 +2878,11 @@ function De(s, e, t, i) {
2715
2878
  let l, d;
2716
2879
  const c = n.aggregators?.[o.field];
2717
2880
  if (c)
2718
- if (ri(c)) {
2719
- const u = ge(c.aggFunc);
2881
+ if (gi(c)) {
2882
+ const u = ye(c.aggFunc);
2720
2883
  u && (l = u(i, o.field, o)), d = c.formatter;
2721
2884
  } else {
2722
- const u = ge(c);
2885
+ const u = ye(c);
2723
2886
  u && (l = u(i, o.field, o));
2724
2887
  }
2725
2888
  else if (n.cells && Object.prototype.hasOwnProperty.call(n.cells, o.field)) {
@@ -2731,13 +2894,13 @@ function De(s, e, t, i) {
2731
2894
  s.appendChild(r);
2732
2895
  }
2733
2896
  }
2734
- function oi(s, e) {
2897
+ function fi(s, e) {
2735
2898
  const t = document.createElement("div");
2736
2899
  t.className = "tbw-status-panel tbw-status-panel-custom", t.id = `status-panel-${s.id}`;
2737
2900
  const i = s.render(e);
2738
2901
  return typeof i == "string" ? t.innerHTML = i : t.appendChild(i), t;
2739
2902
  }
2740
- function Fe(s, e, t, i, n) {
2903
+ function Oe(s, e, t, i, n) {
2741
2904
  return {
2742
2905
  totalRows: s.length,
2743
2906
  filteredRows: n?.cachedResult?.length ?? s.length,
@@ -2747,10 +2910,10 @@ function Fe(s, e, t, i, n) {
2747
2910
  grid: t
2748
2911
  };
2749
2912
  }
2750
- const si = "@layer tbw-plugins{.tbw-footer{flex-shrink:0;z-index:var(--tbw-z-layer-pinned-rows, 20);background:var(--tbw-color-panel-bg)}.tbw-pinned-rows{display:flex;align-items:center;justify-content:space-between;padding:var(--tbw-button-padding, var(--tbw-spacing-md, .5rem) var(--tbw-spacing-lg, .75rem));background:var(--tbw-pinned-rows-bg, var(--tbw-color-panel-bg));border-top:1px solid var(--tbw-pinned-rows-border, var(--tbw-color-border));font-size:var(--tbw-font-size-xs, .75rem);color:var(--tbw-pinned-rows-color, var(--tbw-color-fg-muted));min-height:32px;box-sizing:border-box;min-width:fit-content}.tbw-pinned-rows-left,.tbw-pinned-rows-center,.tbw-pinned-rows-right{display:flex;align-items:center;gap:var(--tbw-spacing-xl, 1rem)}.tbw-pinned-rows-left{justify-content:flex-start}.tbw-pinned-rows-center{justify-content:center;flex:1}.tbw-pinned-rows-right{justify-content:flex-end}.tbw-status-panel{white-space:nowrap}.tbw-aggregation-rows{min-width:fit-content;background:var(--tbw-aggregation-bg, var(--tbw-color-header-bg))}.tbw-aggregation-rows-top{border-bottom:1px solid var(--tbw-aggregation-border, var(--tbw-color-border))}.tbw-aggregation-rows-bottom{border-top:1px solid var(--tbw-aggregation-border, var(--tbw-color-border))}.tbw-aggregation-row{display:grid;grid-template-columns:var(--tbw-column-template);font-size:var(--tbw-aggregation-font-size, .8em);font-weight:var(--tbw-aggregation-font-weight, 600)}.tbw-aggregation-cell{padding:var(--tbw-cell-padding, .125rem .5rem);min-height:var(--tbw-row-height, 1.75rem);display:block;align-items:center;border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;text-overflow:ellipsis;white-space:var(--tbw-cell-white-space, nowrap)}.tbw-aggregation-cell:last-child{border-right:0}.tbw-aggregation-cell-full{grid-column:1 / -1;border-right:0}}";
2751
- class hn extends R {
2913
+ const pi = "@layer tbw-plugins{.tbw-footer{flex-shrink:0;z-index:var(--tbw-z-layer-pinned-rows, 20);background:var(--tbw-color-panel-bg)}.tbw-pinned-rows{display:flex;align-items:center;justify-content:space-between;padding:var(--tbw-button-padding, var(--tbw-spacing-md, .5rem) var(--tbw-spacing-lg, .75rem));background:var(--tbw-pinned-rows-bg, var(--tbw-color-panel-bg));border-top:1px solid var(--tbw-pinned-rows-border, var(--tbw-color-border));font-size:var(--tbw-font-size-xs, .75rem);color:var(--tbw-pinned-rows-color, var(--tbw-color-fg-muted));min-height:32px;box-sizing:border-box;min-width:fit-content}.tbw-pinned-rows-left,.tbw-pinned-rows-center,.tbw-pinned-rows-right{display:flex;align-items:center;gap:var(--tbw-spacing-xl, 1rem)}.tbw-pinned-rows-left{justify-content:flex-start}.tbw-pinned-rows-center{justify-content:center;flex:1}.tbw-pinned-rows-right{justify-content:flex-end}.tbw-status-panel{white-space:nowrap}.tbw-aggregation-rows{min-width:fit-content;background:var(--tbw-aggregation-bg, var(--tbw-color-header-bg))}.tbw-aggregation-rows-top{border-bottom:1px solid var(--tbw-aggregation-border, var(--tbw-color-border))}.tbw-aggregation-rows-bottom{border-top:1px solid var(--tbw-aggregation-border, var(--tbw-color-border))}.tbw-aggregation-row{display:grid;grid-template-columns:var(--tbw-column-template);font-size:var(--tbw-aggregation-font-size, .8em);font-weight:var(--tbw-aggregation-font-weight, 600)}.tbw-aggregation-cell{padding:var(--tbw-cell-padding, .125rem .5rem);min-height:var(--tbw-row-height, 1.75rem);display:block;align-items:center;border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;text-overflow:ellipsis;white-space:var(--tbw-cell-white-space, nowrap)}.tbw-aggregation-cell:last-child{border-right:0}.tbw-aggregation-cell-full{grid-column:1 / -1;border-right:0}}";
2914
+ class yn extends _ {
2752
2915
  name = "pinnedRows";
2753
- styles = si;
2916
+ styles = pi;
2754
2917
  get defaultConfig() {
2755
2918
  return {
2756
2919
  position: "bottom",
@@ -2772,7 +2935,7 @@ class hn extends R {
2772
2935
  const t = e.querySelector(".tbw-scroll-area") ?? e.querySelector(".tbw-grid-content") ?? e.children[0];
2773
2936
  if (!t) return;
2774
2937
  this.footerWrapper && !t.contains(this.footerWrapper) && (this.footerWrapper = null, this.bottomAggregationContainer = null, this.infoBarElement = null), this.topAggregationContainer && !t.contains(this.topAggregationContainer) && (this.topAggregationContainer = null), this.infoBarElement && !t.contains(this.infoBarElement) && (this.infoBarElement = null);
2775
- const i = this.getSelectionState(), n = this.getFilterState(), r = Fe(
2938
+ const i = this.getSelectionState(), n = this.getFilterState(), r = Oe(
2776
2939
  this.rows,
2777
2940
  this.columns,
2778
2941
  this.grid,
@@ -2781,11 +2944,11 @@ class hn extends R {
2781
2944
  ), o = this.config.aggregationRows || [], a = o.filter((h) => h.position === "top"), l = o.filter((h) => h.position !== "top");
2782
2945
  if (a.length > 0) {
2783
2946
  if (!this.topAggregationContainer) {
2784
- this.topAggregationContainer = Pe("top");
2947
+ this.topAggregationContainer = ze("top");
2785
2948
  const h = e.querySelector(".header");
2786
2949
  h && h.nextSibling ? t.insertBefore(this.topAggregationContainer, h.nextSibling) : t.appendChild(this.topAggregationContainer);
2787
2950
  }
2788
- De(
2951
+ Ke(
2789
2952
  this.topAggregationContainer,
2790
2953
  a,
2791
2954
  this.visibleColumns,
@@ -2795,18 +2958,18 @@ class hn extends R {
2795
2958
  const d = this.config.showRowCount !== !1 || this.config.showSelectedCount && r.selectedRows > 0 || this.config.showFilteredCount && r.filteredRows !== r.totalRows || this.config.customPanels && this.config.customPanels.length > 0, c = d && this.config.position !== "top", u = l.length > 0 || c;
2796
2959
  if (d && this.config.position === "top")
2797
2960
  if (!this.infoBarElement)
2798
- this.infoBarElement = ee(this.config, r), t.insertBefore(this.infoBarElement, t.firstChild);
2961
+ this.infoBarElement = le(this.config, r), t.insertBefore(this.infoBarElement, t.firstChild);
2799
2962
  else {
2800
- const h = ee(this.config, r);
2963
+ const h = le(this.config, r);
2801
2964
  this.infoBarElement.replaceWith(h), this.infoBarElement = h;
2802
2965
  }
2803
2966
  else this.config.position === "top" && this.infoBarElement && (this.infoBarElement.remove(), this.infoBarElement = null);
2804
- u ? (this.footerWrapper || (this.footerWrapper = document.createElement("div"), this.footerWrapper.className = "tbw-footer", t.appendChild(this.footerWrapper)), this.footerWrapper.innerHTML = "", l.length > 0 && (this.bottomAggregationContainer || (this.bottomAggregationContainer = Pe("bottom")), this.footerWrapper.appendChild(this.bottomAggregationContainer), De(
2967
+ u ? (this.footerWrapper || (this.footerWrapper = document.createElement("div"), this.footerWrapper.className = "tbw-footer", t.appendChild(this.footerWrapper)), this.footerWrapper.innerHTML = "", l.length > 0 && (this.bottomAggregationContainer || (this.bottomAggregationContainer = ze("bottom")), this.footerWrapper.appendChild(this.bottomAggregationContainer), Ke(
2805
2968
  this.bottomAggregationContainer,
2806
2969
  l,
2807
2970
  this.visibleColumns,
2808
2971
  this.rows
2809
- )), c && (this.infoBarElement = ee(this.config, r), this.footerWrapper.appendChild(this.infoBarElement))) : this.cleanupFooter();
2972
+ )), c && (this.infoBarElement = le(this.config, r), this.footerWrapper.appendChild(this.infoBarElement))) : this.cleanupFooter();
2810
2973
  }
2811
2974
  cleanup() {
2812
2975
  this.infoBarElement && (this.infoBarElement.remove(), this.infoBarElement = null), this.topAggregationContainer && (this.topAggregationContainer.remove(), this.topAggregationContainer = null), this.bottomAggregationContainer && (this.bottomAggregationContainer.remove(), this.bottomAggregationContainer = null), this.footerWrapper && (this.footerWrapper.remove(), this.footerWrapper = null);
@@ -2833,7 +2996,7 @@ class hn extends R {
2833
2996
  }
2834
2997
  getContext() {
2835
2998
  const e = this.getSelectionState(), t = this.getFilterState();
2836
- return Fe(
2999
+ return Oe(
2837
3000
  this.rows,
2838
3001
  this.columns,
2839
3002
  this.grid,
@@ -2854,16 +3017,16 @@ class hn extends R {
2854
3017
  this.config.aggregationRows && (this.config.aggregationRows = this.config.aggregationRows.filter((t) => t.id !== e), this.requestRender());
2855
3018
  }
2856
3019
  }
2857
- const ai = it;
2858
- function li(s) {
3020
+ const mi = ut;
3021
+ function wi(s) {
2859
3022
  const e = [];
2860
3023
  return !s.rowGroupFields?.length && !s.columnGroupFields?.length && e.push("At least one row or column group field is required"), s.valueFields?.length || e.push("At least one value field is required"), e;
2861
3024
  }
2862
- function ce(s, e) {
3025
+ function be(s, e) {
2863
3026
  return [...s, e].join("|");
2864
3027
  }
2865
- function di(s, e) {
2866
- const t = e.rowGroupFields ?? [], i = e.columnGroupFields ?? [], n = e.valueFields ?? [], r = ci(s, i), o = Ue(
3028
+ function bi(s, e) {
3029
+ const t = e.rowGroupFields ?? [], i = e.columnGroupFields ?? [], n = e.valueFields ?? [], r = vi(s, i), o = it(
2867
3030
  s,
2868
3031
  t,
2869
3032
  i,
@@ -2871,7 +3034,7 @@ function di(s, e) {
2871
3034
  n,
2872
3035
  0,
2873
3036
  ""
2874
- ), a = hi(o, r, n), l = Object.values(a).reduce((d, c) => d + c, 0);
3037
+ ), a = xi(o, r, n), l = Object.values(a).reduce((d, c) => d + c, 0);
2875
3038
  return {
2876
3039
  rows: o,
2877
3040
  columnKeys: r,
@@ -2879,7 +3042,7 @@ function di(s, e) {
2879
3042
  grandTotal: l
2880
3043
  };
2881
3044
  }
2882
- function ci(s, e) {
3045
+ function vi(s, e) {
2883
3046
  if (e.length === 0) return ["value"];
2884
3047
  const t = /* @__PURE__ */ new Set();
2885
3048
  for (const i of s) {
@@ -2888,7 +3051,7 @@ function ci(s, e) {
2888
3051
  }
2889
3052
  return [...t].sort();
2890
3053
  }
2891
- function ui(s, e) {
3054
+ function yi(s, e) {
2892
3055
  const t = /* @__PURE__ */ new Map();
2893
3056
  for (const i of s) {
2894
3057
  const n = String(i[e] ?? ""), r = t.get(n);
@@ -2896,10 +3059,10 @@ function ui(s, e) {
2896
3059
  }
2897
3060
  return t;
2898
3061
  }
2899
- function Ue(s, e, t, i, n, r, o) {
3062
+ function it(s, e, t, i, n, r, o) {
2900
3063
  const a = [];
2901
3064
  if (e.length === 0) {
2902
- const h = Me(s, t, i, n), g = qe(h);
3065
+ const h = Ge(s, t, i, n), g = Be(h);
2903
3066
  return a.push({
2904
3067
  rowKey: o || "all",
2905
3068
  rowLabel: o || "All",
@@ -2910,11 +3073,11 @@ function Ue(s, e, t, i, n, r, o) {
2910
3073
  rowCount: s.length
2911
3074
  }), a;
2912
3075
  }
2913
- const l = e[0], d = e.slice(1), c = d.length > 0, u = ui(s, l);
3076
+ const l = e[0], d = e.slice(1), c = d.length > 0, u = yi(s, l);
2914
3077
  for (const [h, g] of u) {
2915
- const f = o ? `${o}|${h}` : h, p = Me(g, t, i, n), m = qe(p);
2916
- let w;
2917
- c && (w = Ue(
3078
+ const f = o ? `${o}|${h}` : h, p = Ge(g, t, i, n), w = Be(p);
3079
+ let v;
3080
+ c && (v = it(
2918
3081
  g,
2919
3082
  d,
2920
3083
  t,
@@ -2927,44 +3090,44 @@ function Ue(s, e, t, i, n, r, o) {
2927
3090
  rowLabel: h || "(blank)",
2928
3091
  depth: r,
2929
3092
  values: p,
2930
- total: m,
3093
+ total: w,
2931
3094
  isGroup: c,
2932
- children: w,
3095
+ children: v,
2933
3096
  rowCount: g.length
2934
3097
  });
2935
3098
  }
2936
3099
  return a;
2937
3100
  }
2938
- function Me(s, e, t, i) {
3101
+ function Ge(s, e, t, i) {
2939
3102
  const n = {};
2940
3103
  for (const r of t)
2941
3104
  for (const o of i) {
2942
- const l = (e.length > 0 ? s.filter((h) => e.map((g) => String(h[g] ?? "")).join("|") === r) : s).map((h) => Number(h[o.field]) || 0), d = ai(o.aggFunc), c = l.length > 0 ? d(l) : null, u = ce([r], o.field);
3105
+ const l = (e.length > 0 ? s.filter((h) => e.map((g) => String(h[g] ?? "")).join("|") === r) : s).map((h) => Number(h[o.field]) || 0), d = mi(o.aggFunc), c = l.length > 0 ? d(l) : null, u = be([r], o.field);
2943
3106
  n[u] = c;
2944
3107
  }
2945
3108
  return n;
2946
3109
  }
2947
- function qe(s) {
3110
+ function Be(s) {
2948
3111
  let e = 0;
2949
3112
  for (const t of Object.values(s))
2950
3113
  e += t ?? 0;
2951
3114
  return e;
2952
3115
  }
2953
- function hi(s, e, t) {
3116
+ function xi(s, e, t) {
2954
3117
  const i = {};
2955
3118
  function n(r) {
2956
3119
  for (const o of r)
2957
3120
  if (!o.isGroup || !o.children?.length)
2958
3121
  for (const a of e)
2959
3122
  for (const l of t) {
2960
- const d = ce([a], l.field);
3123
+ const d = be([a], l.field);
2961
3124
  i[d] = (i[d] ?? 0) + (o.values[d] ?? 0);
2962
3125
  }
2963
3126
  else o.children && n(o.children);
2964
3127
  }
2965
3128
  return n(s), i;
2966
3129
  }
2967
- function gi(s, e, t = !0) {
3130
+ function Ci(s, e, t = !0) {
2968
3131
  const i = [];
2969
3132
  function n(r) {
2970
3133
  i.push(r);
@@ -2977,7 +3140,7 @@ function gi(s, e, t = !0) {
2977
3140
  n(r);
2978
3141
  return i;
2979
3142
  }
2980
- function fi(s) {
3143
+ function Ei(s) {
2981
3144
  const e = [];
2982
3145
  function t(i) {
2983
3146
  if (i.isGroup && e.push(i.rowKey), i.children)
@@ -2988,14 +3151,14 @@ function fi(s) {
2988
3151
  t(i);
2989
3152
  return e;
2990
3153
  }
2991
- const pi = ["sum", "avg", "count", "min", "max", "first", "last"];
2992
- function mi(s, e, t, i) {
3154
+ const Ri = ["sum", "avg", "count", "min", "max", "first", "last"];
3155
+ function Si(s, e, t, i) {
2993
3156
  const n = new AbortController(), r = { config: e, callbacks: i, signal: n.signal }, o = document.createElement("div");
2994
- return o.className = "tbw-pivot-panel", o.appendChild(H("Options", () => xi(t, r))), o.appendChild(H("Row Groups", () => Ke("rowGroups", r))), o.appendChild(H("Column Groups", () => Ke("columnGroups", r))), o.appendChild(H("Values", () => bi(r))), o.appendChild(H("Available Fields", () => yi(r))), s.appendChild(o), () => {
3157
+ return o.className = "tbw-pivot-panel", o.appendChild(j("Options", () => Li(t, r))), o.appendChild(j("Row Groups", () => Ve("rowGroups", r))), o.appendChild(j("Column Groups", () => Ve("columnGroups", r))), o.appendChild(j("Values", () => Ai(r))), o.appendChild(j("Available Fields", () => Ti(r))), s.appendChild(o), () => {
2995
3158
  n.abort(), o.remove();
2996
3159
  };
2997
3160
  }
2998
- function H(s, e) {
3161
+ function j(s, e) {
2999
3162
  const t = document.createElement("div");
3000
3163
  t.className = "tbw-pivot-section";
3001
3164
  const i = document.createElement("div");
@@ -3003,7 +3166,7 @@ function H(s, e) {
3003
3166
  const n = document.createElement("div");
3004
3167
  return n.className = "tbw-pivot-section-content", n.appendChild(e()), t.appendChild(i), t.appendChild(n), t;
3005
3168
  }
3006
- function Ke(s, e) {
3169
+ function Ve(s, e) {
3007
3170
  const { config: t, callbacks: i, signal: n } = e, r = document.createElement("div");
3008
3171
  r.className = "tbw-pivot-drop-zone", r.setAttribute("data-zone", s);
3009
3172
  const o = s === "rowGroups" ? t.rowGroupFields ?? [] : t.columnGroupFields ?? [];
@@ -3012,7 +3175,7 @@ function Ke(s, e) {
3012
3175
  a.className = "tbw-pivot-placeholder", a.textContent = "Drag fields here or click to add", r.appendChild(a);
3013
3176
  } else
3014
3177
  for (const a of o)
3015
- r.appendChild(wi(a, s, e));
3178
+ r.appendChild(ki(a, s, e));
3016
3179
  return r.addEventListener(
3017
3180
  "dragover",
3018
3181
  (a) => {
@@ -3035,7 +3198,7 @@ function Ke(s, e) {
3035
3198
  { signal: n }
3036
3199
  ), r;
3037
3200
  }
3038
- function wi(s, e, t) {
3201
+ function ki(s, e, t) {
3039
3202
  const { callbacks: i, signal: n } = t, r = document.createElement("div");
3040
3203
  r.className = "tbw-pivot-field-chip", r.draggable = !0;
3041
3204
  const o = i.getAvailableFields().find((d) => d.field === s), a = document.createElement("span");
@@ -3061,7 +3224,7 @@ function wi(s, e, t) {
3061
3224
  { signal: n }
3062
3225
  ), r;
3063
3226
  }
3064
- function bi(s) {
3227
+ function Ai(s) {
3065
3228
  const { config: e, callbacks: t, signal: i } = s, n = document.createElement("div");
3066
3229
  n.className = "tbw-pivot-drop-zone tbw-pivot-values-zone", n.setAttribute("data-zone", "values");
3067
3230
  const r = e.valueFields ?? [];
@@ -3070,7 +3233,7 @@ function bi(s) {
3070
3233
  o.className = "tbw-pivot-placeholder", o.textContent = "Drag numeric fields here for aggregation", n.appendChild(o);
3071
3234
  } else
3072
3235
  for (const o of r)
3073
- n.appendChild(vi(o, s));
3236
+ n.appendChild(_i(o, s));
3074
3237
  return n.addEventListener(
3075
3238
  "dragover",
3076
3239
  (o) => {
@@ -3093,7 +3256,7 @@ function bi(s) {
3093
3256
  { signal: i }
3094
3257
  ), n;
3095
3258
  }
3096
- function vi(s, e) {
3259
+ function _i(s, e) {
3097
3260
  const { callbacks: t, signal: i } = e, n = document.createElement("div");
3098
3261
  n.className = "tbw-pivot-field-chip tbw-pivot-value-chip";
3099
3262
  const r = t.getAvailableFields().find((c) => c.field === s.field), o = document.createElement("div");
@@ -3102,7 +3265,7 @@ function vi(s, e) {
3102
3265
  a.className = "tbw-pivot-chip-label", a.textContent = r?.header ?? s.field;
3103
3266
  const l = document.createElement("select");
3104
3267
  l.className = "tbw-pivot-agg-select", l.title = "Aggregation function";
3105
- for (const c of pi) {
3268
+ for (const c of Ri) {
3106
3269
  const u = document.createElement("option");
3107
3270
  u.value = c, u.textContent = c.toUpperCase(), u.selected = c === s.aggFunc, l.appendChild(u);
3108
3271
  }
@@ -3122,7 +3285,7 @@ function vi(s, e) {
3122
3285
  { signal: i }
3123
3286
  ), o.appendChild(a), o.appendChild(l), n.appendChild(o), n.appendChild(d), n;
3124
3287
  }
3125
- function yi(s) {
3288
+ function Ti(s) {
3126
3289
  const { config: e, callbacks: t, signal: i } = s, n = document.createElement("div");
3127
3290
  n.className = "tbw-pivot-available-fields";
3128
3291
  const r = t.getAvailableFields(), o = /* @__PURE__ */ new Set([
@@ -3152,10 +3315,10 @@ function yi(s) {
3152
3315
  }
3153
3316
  return n;
3154
3317
  }
3155
- function xi(s, e) {
3318
+ function Li(s, e) {
3156
3319
  const { config: t, callbacks: i, signal: n } = e, r = document.createElement("div");
3157
3320
  return r.className = "tbw-pivot-options", r.appendChild(
3158
- te(
3321
+ de(
3159
3322
  "Enable Pivot View",
3160
3323
  s,
3161
3324
  (o) => {
@@ -3164,7 +3327,7 @@ function xi(s, e) {
3164
3327
  n
3165
3328
  )
3166
3329
  ), r.appendChild(
3167
- te(
3330
+ de(
3168
3331
  "Show Row Totals",
3169
3332
  t.showTotals ?? !0,
3170
3333
  (o) => {
@@ -3173,7 +3336,7 @@ function xi(s, e) {
3173
3336
  n
3174
3337
  )
3175
3338
  ), r.appendChild(
3176
- te(
3339
+ de(
3177
3340
  "Show Grand Total",
3178
3341
  t.showGrandTotal ?? !0,
3179
3342
  (o) => {
@@ -3183,7 +3346,7 @@ function xi(s, e) {
3183
3346
  )
3184
3347
  ), r;
3185
3348
  }
3186
- function te(s, e, t, i) {
3349
+ function de(s, e, t, i) {
3187
3350
  const n = document.createElement("label");
3188
3351
  n.className = "tbw-pivot-checkbox";
3189
3352
  const r = document.createElement("input");
@@ -3191,7 +3354,7 @@ function te(s, e, t, i) {
3191
3354
  const o = document.createElement("span");
3192
3355
  return o.textContent = s, n.appendChild(r), n.appendChild(o), n;
3193
3356
  }
3194
- function Ci(s, e, t) {
3357
+ function Fi(s, e, t) {
3195
3358
  return e.className = "data-grid-row pivot-group-row", e.setAttribute("data-pivot-depth", String(s.__pivotDepth ?? 0)), e.setAttribute("data-pivot-key", String(s.__pivotRowKey ?? "")), e.setAttribute("role", "row"), e.innerHTML = "", t.columns.forEach((i, n) => {
3196
3359
  const r = document.createElement("div");
3197
3360
  if (r.className = "cell", r.setAttribute("data-col", String(n)), r.setAttribute("data-row", String(t.rowIndex)), r.setAttribute("role", "gridcell"), n === 0) {
@@ -3212,7 +3375,7 @@ function Ci(s, e, t) {
3212
3375
  e.appendChild(r);
3213
3376
  }), !0;
3214
3377
  }
3215
- function Ri(s, e, t, i) {
3378
+ function Ii(s, e, t, i) {
3216
3379
  return e.className = "data-grid-row pivot-leaf-row", e.setAttribute("data-pivot-depth", String(s.__pivotDepth ?? 0)), e.setAttribute("data-pivot-key", String(s.__pivotRowKey ?? "")), e.innerHTML = "", t.forEach((n, r) => {
3217
3380
  const o = document.createElement("div");
3218
3381
  if (o.className = "cell", o.setAttribute("data-col", String(r)), o.setAttribute("data-row", String(i)), o.setAttribute("role", "gridcell"), r === 0) {
@@ -3227,7 +3390,7 @@ function Ri(s, e, t, i) {
3227
3390
  e.appendChild(o);
3228
3391
  }), !0;
3229
3392
  }
3230
- function Ei(s, e, t) {
3393
+ function Pi(s, e, t) {
3231
3394
  return e.className = "pivot-grand-total-row", e.setAttribute("role", "presentation"), e.innerHTML = "", t.forEach((i, n) => {
3232
3395
  const r = document.createElement("div");
3233
3396
  if (r.className = "cell", r.setAttribute("data-col", String(n)), n === 0) {
@@ -3240,10 +3403,10 @@ function Ei(s, e, t) {
3240
3403
  e.appendChild(r);
3241
3404
  }), !0;
3242
3405
  }
3243
- const Si = '@layer tbw-plugins{.pivot-group-row{display:grid;grid-template-columns:var(--tbw-column-template);font-weight:600;background:var(--tbw-pivot-group-bg, var(--tbw-color-row-alt));min-height:var(--tbw-row-height);border-bottom:var(--tbw-row-divider)}.pivot-group-row:hover{background:var(--tbw-pivot-group-hover, var(--tbw-color-row-hover))}.pivot-leaf-row{display:grid;grid-template-columns:var(--tbw-column-template);background:var(--tbw-pivot-leaf-bg, var(--tbw-color-bg));min-height:var(--tbw-row-height);border-bottom:var(--tbw-row-divider)}.pivot-grand-total-row{display:grid;grid-template-columns:var(--tbw-column-template);font-weight:700;background:var(--tbw-pivot-grand-total-bg, var(--tbw-color-header-bg));min-height:var(--tbw-row-height);border-top:2px solid var(--tbw-color-border-strong)}.pivot-grand-total-row>.cell{display:flex;align-items:center;padding:var(--tbw-cell-padding);border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0}.pivot-grand-total-row>.cell:last-child{border-right:0}.pivot-grand-total-footer{position:sticky;bottom:0;z-index:var(--tbw-z-layer-pinned-rows, 20);background:var(--tbw-pivot-grand-total-bg, var(--tbw-color-header-bg));min-width:fit-content}.pivot-group-row>.cell,.pivot-leaf-row>.cell{display:flex;align-items:center;padding:var(--tbw-cell-padding);border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0}.pivot-group-row>.cell:last-child,.pivot-leaf-row>.cell:last-child{border-right:0}.pivot-toggle{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;margin-right:6px;border:none;background:transparent;cursor:pointer;color:var(--tbw-pivot-toggle-color, var(--tbw-color-fg-muted));border-radius:var(--tbw-border-radius);transition:background .15s,color .15s}.pivot-toggle:hover{background:var(--tbw-pivot-toggle-hover-bg, var(--tbw-color-row-hover));color:var(--tbw-pivot-toggle-hover-color, var(--tbw-color-fg))}.pivot-toggle:focus{outline:var(--tbw-focus-outline);outline-offset:var(--tbw-focus-outline-offset)}.pivot-label{font-weight:inherit}.pivot-count{color:var(--tbw-pivot-count-color, var(--tbw-color-fg-muted));font-size:.9em;font-weight:400}.pivot-total-row{font-weight:700;border-top:2px solid var(--tbw-pivot-border, var(--tbw-color-border-strong))}[data-pivot-depth="1"]{--tbw-pivot-depth: 1}[data-pivot-depth="2"]{--tbw-pivot-depth: 2}[data-pivot-depth="3"]{--tbw-pivot-depth: 3}[data-pivot-depth="4"]{--tbw-pivot-depth: 4}.tbw-pivot-panel{display:flex;flex-direction:column;gap:var(--tbw-panel-padding, var(--tbw-spacing-lg, .75rem));padding:var(--tbw-panel-padding, var(--tbw-spacing-lg, .75rem));height:100%;overflow-y:auto;font-size:var(--tbw-font-size-sm, .8125rem)}.tbw-pivot-section{border:1px solid var(--tbw-pivot-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius);background:var(--tbw-pivot-section-bg, var(--tbw-color-bg))}.tbw-pivot-section-header{padding:var(--tbw-button-padding, var(--tbw-spacing-md, .5rem) var(--tbw-spacing-lg, .75rem));font-weight:600;background:var(--tbw-pivot-header-bg, var(--tbw-color-header-bg));border-bottom:1px solid var(--tbw-pivot-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius) var(--tbw-border-radius) 0 0}.tbw-pivot-section-content{padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.tbw-pivot-toggle-wrapper{display:flex;align-items:center}.tbw-pivot-toggle-label{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));cursor:pointer}.tbw-pivot-toggle-label input{width:var(--tbw-icon-size, 1rem);height:var(--tbw-icon-size, 1rem);cursor:pointer}.tbw-pivot-drop-zone{min-height:60px;padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));border:2px dashed var(--tbw-pivot-drop-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius);background:var(--tbw-pivot-drop-bg, var(--tbw-color-row-alt));display:flex;flex-wrap:wrap;gap:var(--tbw-spacing-sm, .375rem);align-content:flex-start;transition:all .15s ease}.tbw-pivot-drop-zone.drag-over{border-color:var(--tbw-color-accent);background:var(--tbw-pivot-drop-active, var(--tbw-focus-background))}.tbw-pivot-placeholder{color:var(--tbw-color-fg-muted);font-style:italic;padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));text-align:center;width:100%}.tbw-pivot-field-chip{display:inline-flex;align-items:center;gap:var(--tbw-spacing-sm, .375rem);padding:var(--tbw-button-padding-sm, var(--tbw-spacing-xs, .25rem) var(--tbw-spacing-md, .5rem));background:var(--tbw-pivot-chip-bg, var(--tbw-color-header-bg));border:1px solid var(--tbw-pivot-chip-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius);cursor:grab;font-size:var(--tbw-font-size-xs, .75rem);transition:all .15s ease}.tbw-pivot-field-chip:hover{background:var(--tbw-pivot-chip-hover, var(--tbw-color-row-hover));border-color:var(--tbw-color-accent)}.tbw-pivot-field-chip.available{background:var(--tbw-color-bg)}.tbw-pivot-field-chip.dragging{opacity:.5;cursor:grabbing}.tbw-pivot-chip-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:120px}.tbw-pivot-chip-remove{display:flex;align-items:center;justify-content:center;width:var(--tbw-icon-size, 1rem);height:var(--tbw-icon-size, 1rem);padding:0;border:none;background:transparent;color:var(--tbw-color-fg-muted);font-size:var(--tbw-font-size-sm, .875rem);font-weight:700;cursor:pointer;border-radius:50%;transition:all .15s ease}.tbw-pivot-chip-remove:hover{background:var(--tbw-pivot-chip-remove-hover-bg, var(--tbw-color-accent));color:var(--tbw-pivot-chip-remove-hover-fg, var(--tbw-color-accent-fg))}.tbw-pivot-value-chip{padding:var(--tbw-button-padding-sm, var(--tbw-spacing-xs, .25rem) var(--tbw-spacing-md, .5rem))}.tbw-pivot-value-label-wrapper{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));flex:1;min-width:0}.tbw-pivot-agg-select{padding:var(--tbw-spacing-xs, .125rem) var(--tbw-spacing-xs, .25rem);font-size:var(--tbw-font-size-xs, .6875rem);border:1px solid var(--tbw-color-border);border-radius:var(--tbw-border-radius);background:var(--tbw-color-bg);cursor:pointer}.tbw-pivot-available-fields{display:flex;flex-wrap:wrap;gap:var(--tbw-spacing-sm, .375rem);min-height:40px}.tbw-pivot-options{display:flex;flex-direction:column;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.tbw-pivot-checkbox{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));cursor:pointer}.tbw-pivot-checkbox input{width:var(--tbw-icon-size-sm, .875rem);height:var(--tbw-icon-size-sm, .875rem);cursor:pointer}.pivot-group-row.tbw-pivot-slide-in,.pivot-leaf-row.tbw-pivot-slide-in{animation:tbw-pivot-slide-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-pivot-slide-in{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}.pivot-group-row.tbw-pivot-fade-in,.pivot-leaf-row.tbw-pivot-fade-in{animation:tbw-pivot-fade-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-pivot-fade-in{0%{opacity:0}to{opacity:1}}}';
3244
- class F extends R {
3406
+ const Di = '@layer tbw-plugins{.pivot-group-row{display:grid;grid-template-columns:var(--tbw-column-template);font-weight:600;background:var(--tbw-pivot-group-bg, var(--tbw-color-row-alt));min-height:var(--tbw-row-height);border-bottom:var(--tbw-row-divider)}.pivot-group-row:hover{background:var(--tbw-pivot-group-hover, var(--tbw-color-row-hover))}.pivot-leaf-row{display:grid;grid-template-columns:var(--tbw-column-template);background:var(--tbw-pivot-leaf-bg, var(--tbw-color-bg));min-height:var(--tbw-row-height);border-bottom:var(--tbw-row-divider)}.pivot-grand-total-row{display:grid;grid-template-columns:var(--tbw-column-template);font-weight:700;background:var(--tbw-pivot-grand-total-bg, var(--tbw-color-header-bg));min-height:var(--tbw-row-height);border-top:2px solid var(--tbw-color-border-strong)}.pivot-grand-total-row>.cell{display:flex;align-items:center;padding:var(--tbw-cell-padding);border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0}.pivot-grand-total-row>.cell:last-child{border-right:0}.pivot-grand-total-footer{position:sticky;bottom:0;z-index:var(--tbw-z-layer-pinned-rows, 20);background:var(--tbw-pivot-grand-total-bg, var(--tbw-color-header-bg));min-width:fit-content}.pivot-group-row>.cell,.pivot-leaf-row>.cell{display:flex;align-items:center;padding:var(--tbw-cell-padding);border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0}.pivot-group-row>.cell:last-child,.pivot-leaf-row>.cell:last-child{border-right:0}.pivot-toggle{display:inline-flex;align-items:center;justify-content:center;width:var(--tbw-pivot-toggle-size, var(--tbw-toggle-size, 1.25em));height:var(--tbw-pivot-toggle-size, var(--tbw-toggle-size, 1.25em));margin-right:var(--tbw-spacing-sm, .375em);border:none;background:transparent;cursor:pointer;color:var(--tbw-pivot-toggle-color, var(--tbw-color-fg-muted));border-radius:var(--tbw-border-radius);transition:background var(--tbw-transition-duration, .12s) var(--tbw-transition-ease, ease),color var(--tbw-transition-duration, .12s) var(--tbw-transition-ease, ease)}.pivot-toggle:hover{background:var(--tbw-pivot-toggle-hover-bg, var(--tbw-color-row-hover));color:var(--tbw-pivot-toggle-hover-color, var(--tbw-color-fg))}.pivot-toggle:focus{outline:var(--tbw-focus-outline);outline-offset:var(--tbw-focus-outline-offset)}.pivot-label{font-weight:inherit}.pivot-count{color:var(--tbw-pivot-count-color, var(--tbw-color-fg-muted));font-size:.9em;font-weight:400}.pivot-total-row{font-weight:700;border-top:2px solid var(--tbw-pivot-border, var(--tbw-color-border-strong))}[data-pivot-depth="1"]{--tbw-pivot-depth: 1}[data-pivot-depth="2"]{--tbw-pivot-depth: 2}[data-pivot-depth="3"]{--tbw-pivot-depth: 3}[data-pivot-depth="4"]{--tbw-pivot-depth: 4}.tbw-pivot-panel{display:flex;flex-direction:column;gap:var(--tbw-panel-padding, var(--tbw-spacing-lg, .75rem));padding:var(--tbw-panel-padding, var(--tbw-spacing-lg, .75rem));height:100%;overflow-y:auto;font-size:var(--tbw-font-size-sm, .8125rem)}.tbw-pivot-section{border:1px solid var(--tbw-pivot-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius);background:var(--tbw-pivot-section-bg, var(--tbw-color-bg))}.tbw-pivot-section-header{padding:var(--tbw-button-padding, var(--tbw-spacing-md, .5rem) var(--tbw-spacing-lg, .75rem));font-weight:600;background:var(--tbw-pivot-header-bg, var(--tbw-color-header-bg));border-bottom:1px solid var(--tbw-pivot-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius) var(--tbw-border-radius) 0 0}.tbw-pivot-section-content{padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.tbw-pivot-toggle-wrapper{display:flex;align-items:center}.tbw-pivot-toggle-label{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));cursor:pointer}.tbw-pivot-toggle-label input{width:var(--tbw-icon-size, 1rem);height:var(--tbw-icon-size, 1rem);cursor:pointer}.tbw-pivot-drop-zone{min-height:60px;padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));border:2px dashed var(--tbw-pivot-drop-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius);background:var(--tbw-pivot-drop-bg, var(--tbw-color-row-alt));display:flex;flex-wrap:wrap;gap:var(--tbw-spacing-sm, .375rem);align-content:flex-start;transition:all .15s ease}.tbw-pivot-drop-zone.drag-over{border-color:var(--tbw-color-accent);background:var(--tbw-pivot-drop-active, var(--tbw-focus-background))}.tbw-pivot-placeholder{color:var(--tbw-color-fg-muted);font-style:italic;padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));text-align:center;width:100%}.tbw-pivot-field-chip{display:inline-flex;align-items:center;gap:var(--tbw-spacing-sm, .375rem);padding:var(--tbw-button-padding-sm, var(--tbw-spacing-xs, .25rem) var(--tbw-spacing-md, .5rem));background:var(--tbw-pivot-chip-bg, var(--tbw-color-header-bg));border:1px solid var(--tbw-pivot-chip-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius);cursor:grab;font-size:var(--tbw-font-size-xs, .75rem);transition:all .15s ease}.tbw-pivot-field-chip:hover{background:var(--tbw-pivot-chip-hover, var(--tbw-color-row-hover));border-color:var(--tbw-color-accent)}.tbw-pivot-field-chip.available{background:var(--tbw-color-bg)}.tbw-pivot-field-chip.dragging{opacity:.5;cursor:grabbing}.tbw-pivot-chip-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:120px}.tbw-pivot-chip-remove{display:flex;align-items:center;justify-content:center;width:var(--tbw-icon-size, 1rem);height:var(--tbw-icon-size, 1rem);padding:0;border:none;background:transparent;color:var(--tbw-color-fg-muted);font-size:var(--tbw-font-size-sm, .875rem);font-weight:700;cursor:pointer;border-radius:50%;transition:all .15s ease}.tbw-pivot-chip-remove:hover{background:var(--tbw-pivot-chip-remove-hover-bg, var(--tbw-color-accent));color:var(--tbw-pivot-chip-remove-hover-fg, var(--tbw-color-accent-fg))}.tbw-pivot-value-chip{padding:var(--tbw-button-padding-sm, var(--tbw-spacing-xs, .25rem) var(--tbw-spacing-md, .5rem))}.tbw-pivot-value-label-wrapper{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));flex:1;min-width:0}.tbw-pivot-agg-select{padding:var(--tbw-spacing-xs, .125rem) var(--tbw-spacing-xs, .25rem);font-size:var(--tbw-font-size-xs, .6875rem);border:1px solid var(--tbw-color-border);border-radius:var(--tbw-border-radius);background:var(--tbw-color-bg);cursor:pointer}.tbw-pivot-available-fields{display:flex;flex-wrap:wrap;gap:var(--tbw-spacing-sm, .375rem);min-height:40px}.tbw-pivot-options{display:flex;flex-direction:column;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.tbw-pivot-checkbox{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));cursor:pointer}.tbw-pivot-checkbox input{width:var(--tbw-icon-size-sm, .875rem);height:var(--tbw-icon-size-sm, .875rem);cursor:pointer}.pivot-group-row.tbw-pivot-slide-in,.pivot-leaf-row.tbw-pivot-slide-in{animation:tbw-pivot-slide-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-pivot-slide-in{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}.pivot-group-row.tbw-pivot-fade-in,.pivot-leaf-row.tbw-pivot-fade-in{animation:tbw-pivot-fade-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-pivot-fade-in{0%{opacity:0}to{opacity:1}}}';
3407
+ class G extends _ {
3245
3408
  name = "pivot";
3246
- styles = Si;
3409
+ styles = Di;
3247
3410
  static PANEL_ID = "pivot";
3248
3411
  get defaultConfig() {
3249
3412
  return {
@@ -3260,6 +3423,7 @@ class F extends R {
3260
3423
  fieldHeaderMap = /* @__PURE__ */ new Map();
3261
3424
  expandedKeys = /* @__PURE__ */ new Set();
3262
3425
  defaultExpanded = !0;
3426
+ userHasToggledExpand = !1;
3263
3427
  originalColumns = [];
3264
3428
  panelContainer = null;
3265
3429
  grandTotalFooter = null;
@@ -3272,12 +3436,12 @@ class F extends R {
3272
3436
  return this.isAnimationEnabled ? this.config.animation ?? "slide" : !1;
3273
3437
  }
3274
3438
  detach() {
3275
- this.isActive = !1, this.hasInitialized = !1, this.pivotResult = null, this.fieldHeaderMap.clear(), this.originalColumns = [], this.panelContainer = null, this.cleanupGrandTotalFooter(), this.previousVisibleKeys.clear(), this.keysToAnimate.clear();
3439
+ this.isActive = !1, this.hasInitialized = !1, this.pivotResult = null, this.fieldHeaderMap.clear(), this.originalColumns = [], this.panelContainer = null, this.cleanupGrandTotalFooter(), this.previousVisibleKeys.clear(), this.keysToAnimate.clear(), this.userHasToggledExpand = !1;
3276
3440
  }
3277
3441
  getToolPanel() {
3278
3442
  if ((this.config?.showToolPanel ?? this.userConfig?.showToolPanel ?? !0) !== !1)
3279
3443
  return {
3280
- id: F.PANEL_ID,
3444
+ id: G.PANEL_ID,
3281
3445
  title: "Pivot",
3282
3446
  icon: "⊞",
3283
3447
  tooltip: "Configure pivot table",
@@ -3288,11 +3452,11 @@ class F extends R {
3288
3452
  processRows(e) {
3289
3453
  if (!this.hasInitialized && this.config.active !== !1 && this.hasValidPivotConfig() && (this.hasInitialized = !0, this.isActive = !0), !this.isActive)
3290
3454
  return [...e];
3291
- const t = li(this.config);
3455
+ const t = wi(this.config);
3292
3456
  if (t.length > 0)
3293
3457
  return this.warn(`Config errors: ${t.join(", ")}`), [...e];
3294
- this.buildFieldHeaderMap(), this.defaultExpanded = this.config.defaultExpanded ?? !0, this.expandedKeys.size === 0 && this.defaultExpanded && this.pivotResult && this.expandAllKeys(), this.pivotResult = di(e, this.config), this.expandedKeys.size === 0 && this.defaultExpanded && this.expandAllKeys();
3295
- const i = this.config.indentWidth ?? 20, n = gi(
3458
+ this.buildFieldHeaderMap(), this.defaultExpanded = this.config.defaultExpanded ?? !0, this.pivotResult = bi(e, this.config), this.expandedKeys.size === 0 && this.defaultExpanded && !this.userHasToggledExpand && this.expandAllKeys();
3459
+ const i = this.config.indentWidth ?? 20, n = Ci(
3296
3460
  this.pivotResult.rows,
3297
3461
  this.expandedKeys,
3298
3462
  this.defaultExpanded
@@ -3327,7 +3491,7 @@ class F extends R {
3327
3491
  });
3328
3492
  for (const n of this.pivotResult.columnKeys)
3329
3493
  for (const r of this.config.valueFields ?? []) {
3330
- const o = ce([n], r.field), a = r.header || this.fieldHeaderMap.get(r.field) || r.field;
3494
+ const o = be([n], r.field), a = r.header || this.fieldHeaderMap.get(r.field) || r.field;
3331
3495
  t.push({
3332
3496
  field: o,
3333
3497
  header: `${n} - ${a} (${r.aggFunc})`,
@@ -3344,13 +3508,13 @@ class F extends R {
3344
3508
  }
3345
3509
  renderRow(e, t, i) {
3346
3510
  const n = e;
3347
- return n.__pivotRowKey && n.__pivotHasChildren ? Ci(n, t, {
3511
+ return n.__pivotRowKey && n.__pivotHasChildren ? Fi(n, t, {
3348
3512
  columns: this.gridColumns,
3349
3513
  rowIndex: i,
3350
3514
  onToggle: (r) => this.toggle(r),
3351
3515
  resolveIcon: (r) => this.resolveIcon(r),
3352
3516
  setIcon: (r, o) => this.setIcon(r, o)
3353
- }) : n.__pivotRowKey !== void 0 && this.isActive ? Ri(n, t, this.gridColumns, i) : (this.cleanupPivotStyling(t), !1);
3517
+ }) : n.__pivotRowKey !== void 0 && this.isActive ? Ii(n, t, this.gridColumns, i) : (this.cleanupPivotStyling(t), !1);
3354
3518
  }
3355
3519
  cleanupPivotStyling(e) {
3356
3520
  (e.classList.contains("pivot-group-row") || e.classList.contains("pivot-leaf-row") || e.classList.contains("pivot-grand-total-row")) && (e.classList.remove("pivot-group-row", "pivot-leaf-row", "pivot-grand-total-row"), e.classList.add("data-grid-row"), e.removeAttribute("data-pivot-depth"), e.innerHTML = "");
@@ -3388,29 +3552,29 @@ class F extends R {
3388
3552
  __pivotTotal: this.pivotResult.grandTotal,
3389
3553
  ...this.pivotResult.totals
3390
3554
  };
3391
- Ei(i, this.grandTotalFooter, this.gridColumns);
3555
+ Pi(i, this.grandTotalFooter, this.gridColumns);
3392
3556
  }
3393
3557
  cleanupGrandTotalFooter() {
3394
3558
  this.grandTotalFooter && (this.grandTotalFooter.remove(), this.grandTotalFooter = null);
3395
3559
  }
3396
3560
  toggle(e) {
3397
- this.expandedKeys.has(e) ? this.expandedKeys.delete(e) : this.expandedKeys.add(e), this.requestRender();
3561
+ this.userHasToggledExpand = !0, this.expandedKeys.has(e) ? this.expandedKeys.delete(e) : this.expandedKeys.add(e), this.requestRender();
3398
3562
  }
3399
3563
  expand(e) {
3400
- this.expandedKeys.add(e), this.requestRender();
3564
+ this.userHasToggledExpand = !0, this.expandedKeys.add(e), this.requestRender();
3401
3565
  }
3402
3566
  collapse(e) {
3403
- this.expandedKeys.delete(e), this.requestRender();
3567
+ this.userHasToggledExpand = !0, this.expandedKeys.delete(e), this.requestRender();
3404
3568
  }
3405
3569
  expandAll() {
3406
- this.expandAllKeys(), this.requestRender();
3570
+ this.userHasToggledExpand = !0, this.expandAllKeys(), this.requestRender();
3407
3571
  }
3408
3572
  collapseAll() {
3409
- this.expandedKeys.clear(), this.requestRender();
3573
+ this.userHasToggledExpand = !0, this.expandedKeys.clear(), this.requestRender();
3410
3574
  }
3411
3575
  expandAllKeys() {
3412
3576
  if (!this.pivotResult) return;
3413
- const e = fi(this.pivotResult.rows);
3577
+ const e = Ei(this.pivotResult.rows);
3414
3578
  for (const t of e)
3415
3579
  this.expandedKeys.add(t);
3416
3580
  }
@@ -3442,16 +3606,16 @@ class F extends R {
3442
3606
  this.pivotResult = null, this.requestRender();
3443
3607
  }
3444
3608
  showPanel() {
3445
- this.grid.openToolPanel(), this.grid.expandedToolPanelSections.includes(F.PANEL_ID) || this.grid.toggleToolPanelSection(F.PANEL_ID);
3609
+ this.grid.openToolPanel(), this.grid.expandedToolPanelSections.includes(G.PANEL_ID) || this.grid.toggleToolPanelSection(G.PANEL_ID);
3446
3610
  }
3447
3611
  hidePanel() {
3448
3612
  this.grid.closeToolPanel();
3449
3613
  }
3450
3614
  togglePanel() {
3451
- this.grid.isToolPanelOpen || this.grid.openToolPanel(), this.grid.toggleToolPanelSection(F.PANEL_ID);
3615
+ this.grid.isToolPanelOpen || this.grid.openToolPanel(), this.grid.toggleToolPanelSection(G.PANEL_ID);
3452
3616
  }
3453
3617
  isPanelVisible() {
3454
- return this.grid.isToolPanelOpen && this.grid.expandedToolPanelSections.includes(F.PANEL_ID);
3618
+ return this.grid.isToolPanelOpen && this.grid.expandedToolPanelSections.includes(G.PANEL_ID);
3455
3619
  }
3456
3620
  get gridColumns() {
3457
3621
  return this.grid.columns ?? [];
@@ -3495,7 +3659,7 @@ class F extends R {
3495
3659
  },
3496
3660
  getAvailableFields: () => this.getAvailableFields()
3497
3661
  };
3498
- return mi(e, this.config, this.isActive, t);
3662
+ return Si(e, this.config, this.isActive, t);
3499
3663
  }
3500
3664
  refreshPanel() {
3501
3665
  this.panelContainer && (this.panelContainer.innerHTML = "", this.renderPanel(this.panelContainer));
@@ -3528,10 +3692,10 @@ class F extends R {
3528
3692
  n >= 0 && (i[n] = { ...i[n], aggFunc: t }, this.config.valueFields = [...i]), this.isActive && this.refresh();
3529
3693
  }
3530
3694
  }
3531
- const W = "tbw-print-isolation-style";
3532
- function ki(s, e) {
3695
+ const Q = "tbw-print-isolation-style";
3696
+ function Mi(s, e) {
3533
3697
  const t = document.createElement("style");
3534
- return t.id = W, t.textContent = `
3698
+ return t.id = Q, t.textContent = `
3535
3699
  /* Print isolation: hide everything except the target grid */
3536
3700
  @media print {
3537
3701
  /* Hide all body children by default */
@@ -3603,22 +3767,22 @@ function ki(s, e) {
3603
3767
  }
3604
3768
  `, t;
3605
3769
  }
3606
- async function Ai(s, e = {}) {
3770
+ async function Ni(s, e = {}) {
3607
3771
  const { orientation: t = "landscape" } = e, i = s.id;
3608
3772
  document.querySelectorAll(`#${CSS.escape(i)}`).length > 1 && console.warn(
3609
3773
  `[tbw-grid:print] Multiple elements found with id="${i}". Print isolation may not work correctly. Ensure each grid has a unique ID.`
3610
- ), document.getElementById(W)?.remove();
3611
- const r = ki(i, t);
3774
+ ), document.getElementById(Q)?.remove();
3775
+ const r = Mi(i, t);
3612
3776
  return document.head.appendChild(r), new Promise((o) => {
3613
3777
  const a = () => {
3614
- window.removeEventListener("afterprint", a), document.getElementById(W)?.remove(), o();
3778
+ window.removeEventListener("afterprint", a), document.getElementById(Q)?.remove(), o();
3615
3779
  };
3616
3780
  window.addEventListener("afterprint", a), window.print(), setTimeout(() => {
3617
- window.removeEventListener("afterprint", a), document.getElementById(W)?.remove(), o();
3781
+ window.removeEventListener("afterprint", a), document.getElementById(Q)?.remove(), o();
3618
3782
  }, 5e3);
3619
3783
  });
3620
3784
  }
3621
- const _i = ".tbw-print-header,.tbw-print-footer{display:none}@media print{tbw-grid{overflow:visible!important;height:auto!important;border:none!important;border-radius:0!important;color-scheme:light only;-webkit-print-color-adjust:exact;print-color-adjust:exact}tbw-grid .tbw-grid-content{overflow:visible!important;height:auto!important;max-height:none!important}tbw-grid .tbw-scroll-area{overflow:visible!important;height:auto!important;max-height:none!important}tbw-grid .rows-body{overflow:visible!important;height:auto!important;max-height:none!important}tbw-grid .rows-container,tbw-grid .rows-viewport,tbw-grid .rows{overflow:visible!important;height:auto!important;max-height:none!important;transform:none!important}tbw-grid .rows-viewport .rows{position:static!important}tbw-grid .resize-handle,tbw-grid [part=sort-indicator],tbw-grid .tbw-filter-btn,tbw-grid .tool-panel,tbw-grid .tool-panel-content,tbw-grid .tbw-shell-header,tbw-grid .shell-toolbar,tbw-grid .tool-panel-toggle,tbw-grid [data-print-hide],tbw-grid .expander-cell,tbw-grid .tree-toggle,tbw-grid .context-menu,tbw-grid .faux-vscroll{display:none!important}tbw-grid .tbw-print-header{display:flex;justify-content:space-between;align-items:baseline;padding:.5em 0;margin-bottom:.5em;border-bottom:2px solid var(--tbw-color-border, #333);font-family:inherit}.tbw-print-header-title{font-size:1.25em;font-weight:700}.tbw-print-header-timestamp{font-size:.875em;color:var(--tbw-color-fg-muted, #666)}tbw-grid .tbw-print-footer{display:block;margin-top:.5em;padding-top:.5em;border-top:1px solid var(--tbw-color-border, #ccc);font-size:.75em;color:var(--tbw-color-fg-muted, #666);text-align:right}tbw-grid .data-grid-row{break-inside:avoid;page-break-inside:avoid}tbw-grid .cell{border:1px solid var(--tbw-color-border, #ddd)!important}tbw-grid .header-row,tbw-grid .data-grid-row{padding-right:1px}tbw-grid .data-grid-row:hover,tbw-grid .cell:hover{background:inherit!important}@page{margin:1cm}tbw-grid.print-landscape{@page{size:landscape}}tbw-grid.print-portrait{@page{size:portrait}}}", Li = {
3785
+ const qi = ".tbw-print-header,.tbw-print-footer{display:none}@media print{tbw-grid{overflow:visible!important;height:auto!important;border:none!important;border-radius:0!important;color-scheme:light only;-webkit-print-color-adjust:exact;print-color-adjust:exact}tbw-grid .tbw-grid-content{overflow:visible!important;height:auto!important;max-height:none!important}tbw-grid .tbw-scroll-area{overflow:visible!important;height:auto!important;max-height:none!important}tbw-grid .rows-body{overflow:visible!important;height:auto!important;max-height:none!important}tbw-grid .rows-container,tbw-grid .rows-viewport,tbw-grid .rows{overflow:visible!important;height:auto!important;max-height:none!important;transform:none!important}tbw-grid .rows-viewport .rows{position:static!important}tbw-grid .resize-handle,tbw-grid [part=sort-indicator],tbw-grid .tbw-filter-btn,tbw-grid .tool-panel,tbw-grid .tool-panel-content,tbw-grid .tbw-shell-header,tbw-grid .shell-toolbar,tbw-grid .tool-panel-toggle,tbw-grid [data-print-hide],tbw-grid .expander-cell,tbw-grid .tree-toggle,tbw-grid .context-menu,tbw-grid .faux-vscroll{display:none!important}tbw-grid .tbw-print-header{display:flex;justify-content:space-between;align-items:baseline;padding:var(--tbw-spacing-md, .5em) 0;margin-bottom:var(--tbw-spacing-md, .5em);border-bottom:2px solid var(--tbw-print-border, var(--tbw-color-border-strong));font-family:inherit}.tbw-print-header-title{font-size:1.25em;font-weight:700}.tbw-print-header-timestamp{font-size:var(--tbw-font-size-sm, .875em);color:var(--tbw-print-muted, var(--tbw-color-fg-muted))}tbw-grid .tbw-print-footer{display:block;margin-top:var(--tbw-spacing-md, .5em);padding-top:var(--tbw-spacing-md, .5em);border-top:1px solid var(--tbw-print-border, var(--tbw-color-border));font-size:var(--tbw-font-size-xs, .75em);color:var(--tbw-print-muted, var(--tbw-color-fg-muted));text-align:right}tbw-grid .data-grid-row{break-inside:avoid;page-break-inside:avoid}tbw-grid .cell{border:1px solid var(--tbw-print-cell-border, var(--tbw-color-border))!important}tbw-grid .header-row,tbw-grid .data-grid-row{padding-right:1px}tbw-grid .data-grid-row:hover,tbw-grid .cell:hover{background:inherit!important}@page{margin:1cm}tbw-grid.print-landscape{@page{size:landscape}}tbw-grid.print-portrait{@page{size:portrait}}}", Hi = {
3622
3786
  button: !1,
3623
3787
  orientation: "landscape",
3624
3788
  warnThreshold: 500,
@@ -3628,10 +3792,10 @@ const _i = ".tbw-print-header,.tbw-print-footer{display:none}@media print{tbw-gr
3628
3792
  title: "",
3629
3793
  isolate: !1
3630
3794
  };
3631
- class gn extends R {
3795
+ class xn extends _ {
3632
3796
  name = "print";
3633
3797
  version = "1.0.0";
3634
- styles = _i;
3798
+ styles = qi;
3635
3799
  #e = !1;
3636
3800
  #t = null;
3637
3801
  #o = null;
@@ -3655,7 +3819,7 @@ class gn extends R {
3655
3819
  console.warn("[PrintPlugin] Grid not available");
3656
3820
  return;
3657
3821
  }
3658
- const i = { ...Li, ...this.config, ...e }, r = this.rows.length;
3822
+ const i = { ...Hi, ...this.config, ...e }, r = this.rows.length;
3659
3823
  let o = r, a = !1;
3660
3824
  if (i.warnThreshold > 0 && r > i.warnThreshold) {
3661
3825
  const d = i.maxRows > 0 ? `
@@ -3726,7 +3890,7 @@ Click OK to continue, or Cancel to abort.`
3726
3890
  }
3727
3891
  async #p(e) {
3728
3892
  const t = this.gridElement;
3729
- t && await Ai(t, {
3893
+ t && await Ni(t, {
3730
3894
  orientation: e.orientation
3731
3895
  });
3732
3896
  }
@@ -3775,19 +3939,19 @@ Click OK to continue, or Cancel to abort.`
3775
3939
  });
3776
3940
  }
3777
3941
  }
3778
- function Ti(s) {
3942
+ function zi(s) {
3779
3943
  const e = s.meta ?? {};
3780
3944
  return e.lockPosition !== !0 && e.suppressMovable !== !0;
3781
3945
  }
3782
- function Ne(s, e, t) {
3946
+ function We(s, e, t) {
3783
3947
  if (e === t || e < 0 || e >= s.length || t < 0 || t > s.length) return s;
3784
3948
  const i = [...s], [n] = i.splice(e, 1);
3785
3949
  return i.splice(t, 0, n), i;
3786
3950
  }
3787
- const Ii = '@layer tbw-plugins{.header-row>.cell[draggable=true]{cursor:grab;position:relative}.header-row>.cell.dragging{opacity:.5;cursor:grabbing}.header-row>.cell.drop-before:before{content:"";position:absolute;left:0;top:0;bottom:0;width:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent));z-index:1}.header-row>.cell.drop-after:after{content:"";position:absolute;right:0;top:0;bottom:0;width:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent));z-index:1}.cell.flip-animating{transition:transform var(--tbw-animation-duration, .2s) ease-out;will-change:transform;z-index:1}@keyframes reorder-fade-in{0%{opacity:0}to{opacity:1}}.cell.fade-animating{animation:reorder-fade-in var(--tbw-animation-duration, .2s) ease-out backwards}}';
3788
- class fn extends R {
3951
+ const Ki = '@layer tbw-plugins{.header-row>.cell[draggable=true]{cursor:grab;position:relative}.header-row>.cell.dragging{opacity:.5;cursor:grabbing}.header-row>.cell.drop-before:before{content:"";position:absolute;left:0;top:0;bottom:0;width:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent));z-index:1}.header-row>.cell.drop-after:after{content:"";position:absolute;right:0;top:0;bottom:0;width:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent));z-index:1}.cell.flip-animating{transition:transform var(--tbw-animation-duration, .2s) ease-out;will-change:transform;z-index:1}@keyframes reorder-fade-in{0%{opacity:0}to{opacity:1}}.cell.fade-animating{animation:reorder-fade-in var(--tbw-animation-duration, .2s) ease-out backwards}}';
3952
+ class Cn extends _ {
3789
3953
  name = "reorder";
3790
- styles = Ii;
3954
+ styles = Ki;
3791
3955
  get defaultConfig() {
3792
3956
  return {
3793
3957
  animation: "flip"
@@ -3804,8 +3968,8 @@ class fn extends R {
3804
3968
  draggedIndex = null;
3805
3969
  dropIndex = null;
3806
3970
  canMoveColumnWithPlugins(e) {
3807
- return !e || !Ti(e) ? !1 : !this.grid.queryPlugins({
3808
- type: We.CAN_MOVE_COLUMN,
3971
+ return !e || !zi(e) ? !1 : !this.grid.queryPlugins({
3972
+ type: Je.CAN_MOVE_COLUMN,
3809
3973
  context: e
3810
3974
  }).includes(!1);
3811
3975
  }
@@ -3854,7 +4018,7 @@ class fn extends R {
3854
4018
  const l = this.draggedField, d = this.draggedIndex, c = this.dropIndex;
3855
4019
  if (!this.isDragging || l === null || d === null || c === null)
3856
4020
  return;
3857
- const u = c > d ? c - 1 : c, h = this.getColumnOrder(), g = Ne(h, d, u), f = {
4021
+ const u = c > d ? c - 1 : c, h = this.getColumnOrder(), g = We(h, d, u), f = {
3858
4022
  field: l,
3859
4023
  fromIndex: d,
3860
4024
  toIndex: u,
@@ -3877,7 +4041,7 @@ class fn extends R {
3877
4041
  if (l < 0 || l >= o.length) return;
3878
4042
  const d = n.find((c) => c.field === o[l]);
3879
4043
  if (this.canMoveColumnWithPlugins(d))
3880
- return this.moveColumn(r.field, l), t._focusCol = l, _(this.grid), e.preventDefault(), e.stopPropagation(), !0;
4044
+ return this.moveColumn(r.field, l), t._focusCol = l, D(this.grid), e.preventDefault(), e.stopPropagation(), !0;
3881
4045
  }
3882
4046
  getColumnOrder() {
3883
4047
  return this.grid.getColumnOrder();
@@ -3885,7 +4049,7 @@ class fn extends R {
3885
4049
  moveColumn(e, t) {
3886
4050
  const i = this.getColumnOrder(), n = i.indexOf(e);
3887
4051
  if (n === -1) return;
3888
- const r = Ne(i, n, t);
4052
+ const r = We(i, n, t);
3889
4053
  this.emitCancelable("column-move", {
3890
4054
  field: e,
3891
4055
  fromIndex: n,
@@ -3980,11 +4144,11 @@ class fn extends R {
3980
4144
  this.grid.requestStateChange?.();
3981
4145
  }
3982
4146
  }
3983
- const Pi = 'tbw-grid[data-responsive-animate]{.data-grid-row,.data-grid-row>.cell{transition:opacity var(--tbw-responsive-duration, .2s) ease-out,transform var(--tbw-responsive-duration, .2s) ease-out}}tbw-grid[data-responsive][data-responsive-animate]{.data-grid-row{animation:responsive-card-enter var(--tbw-responsive-duration, .2s) ease-out}}@keyframes responsive-card-enter{0%{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}tbw-grid[data-responsive]{.header{display:none!important}.footer-row{display:none}.tbw-scroll-area{overflow-x:hidden;min-width:0!important}.rows-body-wrapper{min-width:0!important}.data-grid-row:not(.group-row){display:block!important;grid-template-columns:none!important;padding:var(--tbw-cell-padding);padding-left:var(--tbw-spacing-xl);border-bottom:1px solid var(--tbw-color-border);min-height:auto!important;height:auto!important;contain:none!important;content-visibility:visible!important;background:var(--tbw-color-bg);position:relative;&:nth-child(2n){background:var(--tbw-color-row-alt)}&:hover{background:var(--tbw-color-row-hover)}&[aria-selected=true]{background:var(--tbw-color-selection);&:before{content:"";position:absolute;left:0;top:0;bottom:0;width:4px;background:var(--tbw-color-accent)}}}.data-grid-row:not(.group-row)>.cell{display:flex!important;justify-content:space-between;align-items:center;padding:var(--tbw-spacing-xs) var(--tbw-spacing-md);width:100%!important;min-width:0!important;min-height:auto!important;height:auto!important;line-height:1.5!important;position:static!important;left:auto!important;right:auto!important;border:none!important;border-bottom:none!important;border-right:none!important;background:transparent!important;white-space:normal!important;overflow:visible!important;&:before{content:attr(data-header) ": ";font-weight:600;color:var(--tbw-color-header-fg);flex-shrink:0;margin-right:var(--tbw-spacing-md);min-width:100px}&:after{content:none}}.cell[data-utility]{display:none!important}}tbw-grid[data-responsive] .cell[data-responsive-hidden]{display:none!important}tbw-grid[data-responsive] .cell[data-responsive-value-only]{&:before{display:none!important}justify-content:flex-start!important;font-weight:500}tbw-grid:not([data-responsive]) .cell[data-responsive-hidden]{display:none!important}tbw-grid[data-responsive]{.tbw-footer,.tbw-pinned-rows,.tbw-aggregation-rows{display:none!important}.tbw-pinned-rows,.tbw-aggregation-rows,.tbw-aggregation-row{min-width:0!important}}tbw-grid[data-responsive] .data-grid-row.responsive-card{display:block!important;padding:var(--tbw-cell-padding);border-bottom:1px solid var(--tbw-color-border);>*{width:100%}.cell:before{display:none}}';
3984
- class pn extends R {
4147
+ const Oi = 'tbw-grid[data-responsive-animate]{.data-grid-row,.data-grid-row>.cell{transition:opacity var(--tbw-responsive-duration, .2s) ease-out,transform var(--tbw-responsive-duration, .2s) ease-out}}tbw-grid[data-responsive][data-responsive-animate]{.data-grid-row{animation:responsive-card-enter var(--tbw-responsive-duration, .2s) ease-out}}@keyframes responsive-card-enter{0%{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}tbw-grid[data-responsive]{.header{display:none!important}.footer-row{display:none}.tbw-scroll-area{overflow-x:hidden;min-width:0!important}.rows-body-wrapper{min-width:0!important}.data-grid-row:not(.group-row){display:block!important;grid-template-columns:none!important;padding:var(--tbw-cell-padding);padding-left:var(--tbw-spacing-xl);border-bottom:1px solid var(--tbw-color-border);min-height:auto!important;height:auto!important;contain:none!important;content-visibility:visible!important;background:var(--tbw-color-bg);position:relative;&:nth-child(2n){background:var(--tbw-color-row-alt)}&:hover{background:var(--tbw-color-row-hover)}&[aria-selected=true]{background:var(--tbw-color-selection);&:before{content:"";position:absolute;left:0;top:0;bottom:0;width:4px;background:var(--tbw-color-accent)}}}.data-grid-row:not(.group-row)>.cell{display:flex!important;justify-content:space-between;align-items:center;padding:var(--tbw-spacing-xs) var(--tbw-spacing-md);width:100%!important;min-width:0!important;min-height:auto!important;height:auto!important;line-height:1.5!important;position:static!important;left:auto!important;right:auto!important;border:none!important;border-bottom:none!important;border-right:none!important;background:transparent!important;white-space:normal!important;overflow:visible!important;&:before{content:attr(data-header) ": ";font-weight:600;color:var(--tbw-color-header-fg);flex-shrink:0;margin-right:var(--tbw-spacing-md);min-width:100px}&:after{content:none}}.cell[data-utility]{display:none!important}}tbw-grid[data-responsive] .cell[data-responsive-hidden]{display:none!important}tbw-grid[data-responsive] .cell[data-responsive-value-only]{&:before{display:none!important}justify-content:flex-start!important;font-weight:500}tbw-grid:not([data-responsive]) .cell[data-responsive-hidden]{display:none!important}tbw-grid[data-responsive]{.tbw-footer,.tbw-pinned-rows,.tbw-aggregation-rows{display:none!important}.tbw-pinned-rows,.tbw-aggregation-rows,.tbw-aggregation-row{min-width:0!important}}tbw-grid[data-responsive] .data-grid-row.responsive-card{display:block!important;padding:var(--tbw-cell-padding);border-bottom:1px solid var(--tbw-color-border);>*{width:100%}.cell:before{display:none}}';
4148
+ class En extends _ {
3985
4149
  name = "responsive";
3986
4150
  version = "1.0.0";
3987
- styles = Pi;
4151
+ styles = Oi;
3988
4152
  static manifest = {
3989
4153
  incompatibleWith: [
3990
4154
  {
@@ -4041,7 +4205,7 @@ class pn extends R {
4041
4205
  this.#e?.disconnect(), this.#e = void 0, clearTimeout(this.#o), this.#o = void 0, this.gridElement && this.gridElement.removeAttribute("data-responsive"), super.detach();
4042
4206
  }
4043
4207
  afterRender() {
4044
- if (this.#R(), !(this.#c.length > 0 ? this.#a !== null : this.#t))
4208
+ if (this.#E(), !(this.#c.length > 0 ? this.#a !== null : this.#t))
4045
4209
  return;
4046
4210
  const t = this.#r.size > 0, i = this.#d.size > 0;
4047
4211
  if (!t && !i)
@@ -4115,23 +4279,23 @@ class pn extends R {
4115
4279
  switch (e.key) {
4116
4280
  case "ArrowDown":
4117
4281
  if (this.grid._focusCol < i)
4118
- return this.grid._focusCol += 1, e.preventDefault(), _(this.grid), !0;
4282
+ return this.grid._focusCol += 1, e.preventDefault(), D(this.grid), !0;
4119
4283
  if (this.grid._focusRow < t)
4120
- return this.grid._focusRow += 1, this.grid._focusCol = 0, e.preventDefault(), _(this.grid), !0;
4284
+ return this.grid._focusRow += 1, this.grid._focusCol = 0, e.preventDefault(), D(this.grid), !0;
4121
4285
  break;
4122
4286
  case "ArrowUp":
4123
4287
  if (this.grid._focusCol > 0)
4124
- return this.grid._focusCol -= 1, e.preventDefault(), _(this.grid), !0;
4288
+ return this.grid._focusCol -= 1, e.preventDefault(), D(this.grid), !0;
4125
4289
  if (this.grid._focusRow > 0)
4126
- return this.grid._focusRow -= 1, this.grid._focusCol = i, e.preventDefault(), _(this.grid), !0;
4290
+ return this.grid._focusRow -= 1, this.grid._focusCol = i, e.preventDefault(), D(this.grid), !0;
4127
4291
  break;
4128
4292
  case "ArrowRight":
4129
4293
  if (this.grid._focusRow < t)
4130
- return this.grid._focusRow += 1, e.preventDefault(), _(this.grid), !0;
4294
+ return this.grid._focusRow += 1, e.preventDefault(), D(this.grid), !0;
4131
4295
  break;
4132
4296
  case "ArrowLeft":
4133
4297
  if (this.grid._focusRow > 0)
4134
- return this.grid._focusRow -= 1, e.preventDefault(), _(this.grid), !0;
4298
+ return this.grid._focusRow -= 1, e.preventDefault(), D(this.grid), !0;
4135
4299
  break;
4136
4300
  }
4137
4301
  return !1;
@@ -4183,7 +4347,7 @@ class pn extends R {
4183
4347
  return e;
4184
4348
  }
4185
4349
  #b = !1;
4186
- #R() {
4350
+ #E() {
4187
4351
  if (!this.#t || !this.config.cardRenderer)
4188
4352
  return;
4189
4353
  let e = !1;
@@ -4205,10 +4369,10 @@ class pn extends R {
4205
4369
  }));
4206
4370
  }
4207
4371
  }
4208
- const Di = '.dg-row-drag-handle{display:flex;align-items:center;justify-content:center;cursor:grab;user-select:none;color:var(--tbw-color-fg-muted, #999);transition:color .15s ease;font-size:14px;letter-spacing:-2px;&:hover{color:var(--tbw-color-fg, #333)}&:active{cursor:grabbing}}.data-grid-row.dragging{opacity:.6}.data-grid-row.drop-target{position:relative;&.drop-before:before{content:"";position:absolute;top:0;left:0;right:0;height:2px;background-color:var(--tbw-color-accent, #1976d2);z-index:10}&.drop-after:after{content:"";position:absolute;bottom:0;left:0;right:0;height:2px;background-color:var(--tbw-color-accent, #1976d2);z-index:10}}.data-grid-row.keyboard-moving{background-color:var(--tbw-color-bg-selected, #e3f2fd);box-shadow:0 0 0 1px var(--tbw-color-accent, #1976d2) inset}.data-grid-row.animate-flip{transition:transform var(--tbw-animation-duration, .2s) ease-out}', Fi = "__tbw_row_drag";
4209
- class mn extends R {
4372
+ const Gi = '@layer tbw-plugins{.dg-row-drag-handle{display:flex;align-items:center;justify-content:center;cursor:grab;user-select:none;color:var(--tbw-row-reorder-handle-color, var(--tbw-color-fg-muted));transition:color var(--tbw-transition-duration, .12s) var(--tbw-transition-ease, ease);font-size:var(--tbw-font-size, 1em);letter-spacing:-2px;&:hover{color:var(--tbw-row-reorder-handle-hover, var(--tbw-color-fg))}&:active{cursor:grabbing}}.data-grid-row.dragging{opacity:.6}.data-grid-row.drop-target{position:relative;&.drop-before:before{content:"";position:absolute;top:0;left:0;right:0;height:2px;background-color:var(--tbw-row-reorder-indicator, var(--tbw-color-accent));z-index:10}&.drop-after:after{content:"";position:absolute;bottom:0;left:0;right:0;height:2px;background-color:var(--tbw-row-reorder-indicator, var(--tbw-color-accent));z-index:10}}.data-grid-row.keyboard-moving{background-color:var(--tbw-row-reorder-moving-bg, var(--tbw-focus-background));box-shadow:0 0 0 1px var(--tbw-row-reorder-moving-border, var(--tbw-color-accent)) inset}.data-grid-row.flip-animating{transition:transform var(--tbw-animation-duration, .2s) ease-out;will-change:transform;z-index:1}}', Bi = "__tbw_row_drag";
4373
+ class Rn extends _ {
4210
4374
  name = "rowReorder";
4211
- styles = Di;
4375
+ styles = Gi;
4212
4376
  get defaultConfig() {
4213
4377
  return {
4214
4378
  enableKeyboard: !0,
@@ -4219,6 +4383,9 @@ class mn extends R {
4219
4383
  animation: "flip"
4220
4384
  };
4221
4385
  }
4386
+ get animationType() {
4387
+ return this.isAnimationEnabled ? this.config.animation !== void 0 ? this.config.animation : "flip" : !1;
4388
+ }
4222
4389
  isDragging = !1;
4223
4390
  draggedRowIndex = null;
4224
4391
  dropRowIndex = null;
@@ -4232,7 +4399,7 @@ class mn extends R {
4232
4399
  if (!this.config.showDragHandle)
4233
4400
  return [...e];
4234
4401
  const t = {
4235
- field: Fi,
4402
+ field: Bi,
4236
4403
  header: "",
4237
4404
  width: this.config.dragHandleWidth ?? 40,
4238
4405
  resizable: !1,
@@ -4326,7 +4493,7 @@ class mn extends R {
4326
4493
  row: e
4327
4494
  }, this.lastFocusCol = r;
4328
4495
  const o = this.grid, a = [...o._rows ?? this.sourceRows], [l] = a.splice(t, 1);
4329
- a.splice(i, 0, l), o._rows = a, o._focusRow = i, o._focusCol = r, o.refreshVirtualWindow(!0), _(o), this.clearDebounceTimer(), this.debounceTimer = setTimeout(() => {
4496
+ a.splice(i, 0, l), o._rows = a, o._focusRow = i, o._focusCol = r, o.refreshVirtualWindow(!0), D(o), this.clearDebounceTimer(), this.debounceTimer = setTimeout(() => {
4330
4497
  this.flushPendingMove();
4331
4498
  }, this.config.debounceMs ?? 300);
4332
4499
  }
@@ -4345,7 +4512,7 @@ class mn extends R {
4345
4512
  const o = [...this.sourceRows], [a] = o.splice(t, 1);
4346
4513
  o.splice(e, 0, a);
4347
4514
  const l = this.grid;
4348
- l._rows = o, l._focusRow = e, l._focusCol = this.lastFocusCol, l.refreshVirtualWindow(!0), _(l);
4515
+ l._rows = o, l._focusRow = e, l._focusCol = this.lastFocusCol, l.refreshVirtualWindow(!0), D(l);
4349
4516
  }
4350
4517
  }
4351
4518
  executeMove(e, t, i, n) {
@@ -4358,7 +4525,49 @@ class mn extends R {
4358
4525
  rows: r,
4359
4526
  source: n
4360
4527
  };
4361
- this.emitCancelable("row-move", a) || (this.grid.rows = r);
4528
+ if (!this.emitCancelable("row-move", a))
4529
+ if (this.animationType === "flip" && this.gridElement) {
4530
+ const d = this.captureRowPositions();
4531
+ this.grid.rows = r, requestAnimationFrame(() => {
4532
+ this.gridElement.offsetHeight, this.animateFLIP(d, t, i);
4533
+ });
4534
+ } else
4535
+ this.grid.rows = r;
4536
+ }
4537
+ captureRowPositions() {
4538
+ const e = /* @__PURE__ */ new Map();
4539
+ return this.gridElement?.querySelectorAll(".data-grid-row").forEach((t) => {
4540
+ const i = this.getRowIndex(t);
4541
+ i >= 0 && e.set(i, t.getBoundingClientRect().top);
4542
+ }), e;
4543
+ }
4544
+ animateFLIP(e, t, i) {
4545
+ const n = this.gridElement;
4546
+ if (!n || e.size === 0) return;
4547
+ const r = Math.min(t, i), o = Math.max(t, i), a = [];
4548
+ if (n.querySelectorAll(".data-grid-row").forEach((d) => {
4549
+ const c = d, u = this.getRowIndex(c);
4550
+ if (u < 0 || u < r || u > o) return;
4551
+ let h;
4552
+ u === i ? h = t : t < i ? h = u + 1 : h = u - 1;
4553
+ const g = e.get(h);
4554
+ if (g === void 0) return;
4555
+ const f = c.getBoundingClientRect().top, p = g - f;
4556
+ Math.abs(p) > 1 && a.push({ el: c, deltaY: p });
4557
+ }), a.length === 0) return;
4558
+ a.forEach(({ el: d, deltaY: c }) => {
4559
+ d.style.transform = `translateY(${c}px)`;
4560
+ }), n.offsetHeight;
4561
+ const l = this.animationDuration;
4562
+ requestAnimationFrame(() => {
4563
+ a.forEach(({ el: d }) => {
4564
+ d.classList.add("flip-animating"), d.style.transform = "";
4565
+ }), setTimeout(() => {
4566
+ a.forEach(({ el: d }) => {
4567
+ d.style.transform = "", d.classList.remove("flip-animating");
4568
+ });
4569
+ }, l + 50);
4570
+ });
4362
4571
  }
4363
4572
  getRowIndex(e) {
4364
4573
  const t = e.querySelector(".cell[data-row]");
@@ -4373,7 +4582,7 @@ class mn extends R {
4373
4582
  this.debounceTimer && (clearTimeout(this.debounceTimer), this.debounceTimer = null);
4374
4583
  }
4375
4584
  }
4376
- function q(s) {
4585
+ function V(s) {
4377
4586
  return {
4378
4587
  startRow: Math.min(s.startRow, s.endRow),
4379
4588
  startCol: Math.min(s.startCol, s.endCol),
@@ -4381,38 +4590,38 @@ function q(s) {
4381
4590
  endCol: Math.max(s.startCol, s.endCol)
4382
4591
  };
4383
4592
  }
4384
- function Mi(s) {
4385
- const e = q(s);
4593
+ function Vi(s) {
4594
+ const e = V(s);
4386
4595
  return {
4387
4596
  from: { row: e.startRow, col: e.startCol },
4388
4597
  to: { row: e.endRow, col: e.endCol }
4389
4598
  };
4390
4599
  }
4391
- function Ye(s) {
4392
- return s.map(Mi);
4600
+ function nt(s) {
4601
+ return s.map(Vi);
4393
4602
  }
4394
- function qi(s, e, t) {
4395
- const i = q(t);
4603
+ function Wi(s, e, t) {
4604
+ const i = V(t);
4396
4605
  return s >= i.startRow && s <= i.endRow && e >= i.startCol && e <= i.endCol;
4397
4606
  }
4398
- function He(s, e, t) {
4399
- return t.some((i) => qi(s, e, i));
4607
+ function $e(s, e, t) {
4608
+ return t.some((i) => Wi(s, e, i));
4400
4609
  }
4401
- function Ki(s) {
4402
- const e = [], t = q(s);
4610
+ function $i(s) {
4611
+ const e = [], t = V(s);
4403
4612
  for (let i = t.startRow; i <= t.endRow; i++)
4404
4613
  for (let n = t.startCol; n <= t.endCol; n++)
4405
4614
  e.push({ row: i, col: n });
4406
4615
  return e;
4407
4616
  }
4408
- function Ni(s) {
4617
+ function ji(s) {
4409
4618
  const e = /* @__PURE__ */ new Map();
4410
4619
  for (const t of s)
4411
- for (const i of Ki(t))
4620
+ for (const i of $i(t))
4412
4621
  e.set(`${i.row},${i.col}`, i);
4413
4622
  return [...e.values()];
4414
4623
  }
4415
- function ie(s, e) {
4624
+ function ce(s, e) {
4416
4625
  return {
4417
4626
  startRow: s.row,
4418
4627
  startCol: s.col,
@@ -4420,12 +4629,12 @@ function ie(s, e) {
4420
4629
  endCol: e.col
4421
4630
  };
4422
4631
  }
4423
- function V(s, e) {
4424
- const t = q(s), i = q(e);
4632
+ function J(s, e) {
4633
+ const t = V(s), i = V(e);
4425
4634
  return t.startRow === i.startRow && t.startCol === i.startCol && t.endRow === i.endRow && t.endCol === i.endCol;
4426
4635
  }
4427
- const Hi = "@layer tbw-plugins{tbw-grid{&.selecting .data-grid-row>.cell{user-select:none}&[data-has-focus] .data-grid-row.row-focus{background-color:var(--tbw-focus-background, rgba(from var(--tbw-color-accent) r g b / 12%))}&[data-selection-mode=row] .cell-focus{outline:none}.data-grid-row>.cell.selected{background-color:var(--tbw-range-selection-bg);&.top{border-top:2px solid var(--tbw-range-border-color)}&.bottom{border-bottom:2px solid var(--tbw-range-border-color)}&.first{border-left:2px solid var(--tbw-range-border-color)}&.last{border-right:2px solid var(--tbw-range-border-color)}}.data-grid-row[data-selectable=false]{cursor:not-allowed;opacity:.6;&.row-focus{background-color:var(--tbw-color-row-alt)}}.data-grid-row>.cell[data-selectable=false]{cursor:not-allowed;opacity:.6;&.selected{background-color:var(--tbw-color-warning-bg, rgba(255, 243, 205, .5))}}.tbw-selection-summary{font-size:var(--tbw-font-size-sm, .8125rem);color:var(--tbw-color-fg-muted);white-space:nowrap}}}";
4428
- function zi(s, e, t) {
4636
+ const Ui = "@layer tbw-plugins{tbw-grid{&.selecting .data-grid-row>.cell{user-select:none}&[data-has-focus] .data-grid-row.row-focus{background-color:var(--tbw-focus-background, rgba(from var(--tbw-color-accent) r g b / 12%))}&[data-selection-mode=row] .cell-focus{outline:none}.data-grid-row>.cell.selected{background-color:var(--tbw-range-selection-bg);&.top{border-top:2px solid var(--tbw-range-border-color)}&.bottom{border-bottom:2px solid var(--tbw-range-border-color)}&.first{border-left:2px solid var(--tbw-range-border-color)}&.last{border-right:2px solid var(--tbw-range-border-color)}}.data-grid-row[data-selectable=false]{cursor:not-allowed;opacity:.6;&.row-focus{background-color:var(--tbw-color-row-alt)}}.data-grid-row>.cell[data-selectable=false]{cursor:not-allowed;opacity:.6;&.selected{background-color:var(--tbw-selection-warning-bg, rgba(from var(--tbw-color-error) r g b / 50%))}}.tbw-selection-summary{font-size:var(--tbw-font-size-sm, .8125rem);color:var(--tbw-color-fg-muted);white-space:nowrap}}}";
4637
+ function Yi(s, e, t) {
4429
4638
  if (s === "cell" && e.selectedCell)
4430
4639
  return {
4431
4640
  mode: s,
@@ -4443,9 +4652,9 @@ function zi(s, e, t) {
4443
4652
  }));
4444
4653
  return { mode: s, ranges: i };
4445
4654
  }
4446
- return s === "range" && e.ranges.length > 0 ? { mode: s, ranges: Ye(e.ranges) } : { mode: s, ranges: [] };
4655
+ return s === "range" && e.ranges.length > 0 ? { mode: s, ranges: nt(e.ranges) } : { mode: s, ranges: [] };
4447
4656
  }
4448
- class wn extends R {
4657
+ class Sn extends _ {
4449
4658
  static manifest = {
4450
4659
  configRules: [
4451
4660
  {
@@ -4459,11 +4668,12 @@ class wn extends R {
4459
4668
  ]
4460
4669
  };
4461
4670
  name = "selection";
4462
- styles = Hi;
4671
+ styles = Ui;
4463
4672
  get defaultConfig() {
4464
4673
  return {
4465
4674
  mode: "cell",
4466
- triggerOn: "click"
4675
+ triggerOn: "click",
4676
+ enabled: !0
4467
4677
  };
4468
4678
  }
4469
4679
  selected = /* @__PURE__ */ new Set();
@@ -4475,6 +4685,9 @@ class wn extends R {
4475
4685
  isDragging = !1;
4476
4686
  pendingKeyboardUpdate = null;
4477
4687
  selectedCell = null;
4688
+ isSelectionEnabled() {
4689
+ return this.config.enabled === !1 ? !1 : this.grid.effectiveConfig?.selectable !== !1;
4690
+ }
4478
4691
  checkSelectable(e, t) {
4479
4692
  const { isSelectable: i } = this.config;
4480
4693
  if (!i) return !0;
@@ -4493,10 +4706,11 @@ class wn extends R {
4493
4706
  this.selected.clear(), this.ranges = [], this.activeRange = null, this.cellAnchor = null, this.isDragging = !1, this.selectedCell = null, this.pendingKeyboardUpdate = null;
4494
4707
  }
4495
4708
  onCellClick(e) {
4709
+ if (!this.isSelectionEnabled()) return !1;
4496
4710
  const { rowIndex: t, colIndex: i, originalEvent: n } = e, { mode: r, triggerOn: o = "click" } = this.config;
4497
4711
  if (n.type !== o)
4498
4712
  return !1;
4499
- const a = this.columns[i], l = a && I(a);
4713
+ const a = this.columns[i], l = a && H(a);
4500
4714
  if (r === "cell") {
4501
4715
  if (l || !this.isCellSelectable(t, i))
4502
4716
  return !1;
@@ -4510,8 +4724,8 @@ class wn extends R {
4510
4724
  return !1;
4511
4725
  const d = n.shiftKey, c = n.ctrlKey || n.metaKey;
4512
4726
  if (d && this.cellAnchor) {
4513
- const u = ie(this.cellAnchor, { row: t, col: i }), h = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null;
4514
- if (h && V(h, u))
4727
+ const u = ce(this.cellAnchor, { row: t, col: i }), h = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null;
4728
+ if (h && J(h, u))
4515
4729
  return !1;
4516
4730
  c ? this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] = u : this.ranges.push(u) : this.ranges = [u], this.activeRange = u;
4517
4731
  } else if (c) {
@@ -4529,7 +4743,7 @@ class wn extends R {
4529
4743
  endRow: t,
4530
4744
  endCol: i
4531
4745
  };
4532
- if (this.ranges.length === 1 && V(this.ranges[0], u))
4746
+ if (this.ranges.length === 1 && J(this.ranges[0], u))
4533
4747
  return !1;
4534
4748
  this.ranges = [u], this.activeRange = u, this.cellAnchor = { row: t, col: i };
4535
4749
  }
@@ -4538,6 +4752,7 @@ class wn extends R {
4538
4752
  return !1;
4539
4753
  }
4540
4754
  onKeyDown(e) {
4755
+ if (!this.isSelectionEnabled()) return !1;
4541
4756
  const { mode: t } = this.config, n = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "Tab", "Home", "End", "PageUp", "PageDown"].includes(e.key);
4542
4757
  if (e.key === "Escape")
4543
4758
  return t === "cell" ? this.selectedCell = null : t === "row" ? (this.selected.clear(), this.anchor = null) : t === "range" && (this.ranges = [], this.activeRange = null, this.cellAnchor = null), this.emit("selection-change", this.#t()), this.requestAfterRender(), !0;
@@ -4571,9 +4786,9 @@ class wn extends R {
4571
4786
  return !1;
4572
4787
  }
4573
4788
  onCellMouseDown(e) {
4574
- if (this.config.mode !== "range" || e.rowIndex === void 0 || e.colIndex === void 0 || e.rowIndex < 0) return;
4789
+ if (!this.isSelectionEnabled() || this.config.mode !== "range" || e.rowIndex === void 0 || e.colIndex === void 0 || e.rowIndex < 0) return;
4575
4790
  const t = this.columns[e.colIndex];
4576
- if (t && I(t) || !this.isCellSelectable(e.rowIndex, e.colIndex) || e.originalEvent.shiftKey && this.cellAnchor)
4791
+ if (t && H(t) || !this.isCellSelectable(e.rowIndex, e.colIndex) || e.originalEvent.shiftKey && this.cellAnchor)
4577
4792
  return;
4578
4793
  this.isDragging = !0;
4579
4794
  const i = e.rowIndex, n = e.colIndex, r = e.originalEvent.ctrlKey || e.originalEvent.metaKey, o = {
@@ -4582,21 +4797,21 @@ class wn extends R {
4582
4797
  endRow: i,
4583
4798
  endCol: n
4584
4799
  };
4585
- return !r && this.ranges.length === 1 && V(this.ranges[0], o) ? (this.cellAnchor = { row: i, col: n }, !0) : (this.cellAnchor = { row: i, col: n }, r || (this.ranges = []), this.ranges.push(o), this.activeRange = o, this.emit("selection-change", this.#t()), this.requestAfterRender(), !0);
4800
+ return !r && this.ranges.length === 1 && J(this.ranges[0], o) ? (this.cellAnchor = { row: i, col: n }, !0) : (this.cellAnchor = { row: i, col: n }, r || (this.ranges = []), this.ranges.push(o), this.activeRange = o, this.emit("selection-change", this.#t()), this.requestAfterRender(), !0);
4586
4801
  }
4587
4802
  onCellMouseMove(e) {
4588
- if (this.config.mode !== "range" || !this.isDragging || !this.cellAnchor || e.rowIndex === void 0 || e.colIndex === void 0 || e.rowIndex < 0) return;
4803
+ if (!this.isSelectionEnabled() || this.config.mode !== "range" || !this.isDragging || !this.cellAnchor || e.rowIndex === void 0 || e.colIndex === void 0 || e.rowIndex < 0) return;
4589
4804
  let t = e.colIndex;
4590
4805
  const i = this.columns[t];
4591
- if (i && I(i)) {
4592
- const o = this.columns.findIndex((a) => !I(a));
4806
+ if (i && H(i)) {
4807
+ const o = this.columns.findIndex((a) => !H(a));
4593
4808
  o >= 0 && (t = o);
4594
4809
  }
4595
- const n = ie(this.cellAnchor, { row: e.rowIndex, col: t }), r = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null;
4596
- return r && V(r, n) || (this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] = n : this.ranges.push(n), this.activeRange = n, this.emit("selection-change", this.#t()), this.requestAfterRender()), !0;
4810
+ const n = ce(this.cellAnchor, { row: e.rowIndex, col: t }), r = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null;
4811
+ return r && J(r, n) || (this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] = n : this.ranges.push(n), this.activeRange = n, this.emit("selection-change", this.#t()), this.requestAfterRender()), !0;
4597
4812
  }
4598
4813
  onCellMouseUp(e) {
4599
- if (this.config.mode === "range" && this.isDragging)
4814
+ if (this.isSelectionEnabled() && this.config.mode === "range" && this.isDragging)
4600
4815
  return this.isDragging = !1, !0;
4601
4816
  }
4602
4817
  #e() {
@@ -4609,22 +4824,22 @@ class wn extends R {
4609
4824
  const r = e.querySelectorAll(".data-grid-row");
4610
4825
  if (r.forEach((o) => {
4611
4826
  o.classList.remove("selected", "row-focus"), i && o.removeAttribute("data-selectable");
4612
- }), t === "row" && (fe(e), r.forEach((o) => {
4613
- const a = o.querySelector(".cell[data-row]"), l = nt(a);
4827
+ }), t === "row" && (xe(e), r.forEach((o) => {
4828
+ const a = o.querySelector(".cell[data-row]"), l = ht(a);
4614
4829
  l >= 0 && (i && !this.isRowSelectable(l) && o.setAttribute("data-selectable", "false"), this.selected.has(l) && o.classList.add("selected", "row-focus"));
4615
4830
  })), (t === "cell" || t === "range") && i && e.querySelectorAll(".cell[data-row][data-col]").forEach((a) => {
4616
4831
  const l = parseInt(a.getAttribute("data-row") ?? "-1", 10), d = parseInt(a.getAttribute("data-col") ?? "-1", 10);
4617
4832
  l >= 0 && d >= 0 && (this.isCellSelectable(l, d) || a.setAttribute("data-selectable", "false"));
4618
4833
  }), t === "range" && this.ranges.length > 0) {
4619
- fe(e);
4620
- const o = this.activeRange ? q(this.activeRange) : null, a = this.columns.findIndex((d) => !I(d));
4834
+ xe(e);
4835
+ const o = this.activeRange ? V(this.activeRange) : null, a = this.columns.findIndex((d) => !H(d));
4621
4836
  this.columns.length - 1, e.querySelectorAll(".cell[data-row][data-col]").forEach((d) => {
4622
4837
  const c = parseInt(d.getAttribute("data-row") ?? "-1", 10), u = parseInt(d.getAttribute("data-col") ?? "-1", 10);
4623
4838
  if (c >= 0 && u >= 0) {
4624
4839
  const h = this.columns[u];
4625
- if (h && I(h))
4840
+ if (h && H(h))
4626
4841
  return;
4627
- if (He(c, u, this.ranges) && (d.classList.add("selected"), o)) {
4842
+ if ($e(c, u, this.ranges) && (d.classList.add("selected"), o)) {
4628
4843
  c === o.startRow && d.classList.add("top"), c === o.endRow && d.classList.add("bottom");
4629
4844
  const f = Math.max(o.startCol, a);
4630
4845
  u === f && d.classList.add("first"), u === o.endCol && d.classList.add("last");
@@ -4634,6 +4849,7 @@ class wn extends R {
4634
4849
  }
4635
4850
  }
4636
4851
  afterRender() {
4852
+ if (!this.isSelectionEnabled()) return;
4637
4853
  const e = this.gridElement;
4638
4854
  if (!e) return;
4639
4855
  const t = e.children[0], { mode: i } = this.config;
@@ -4642,7 +4858,7 @@ class wn extends R {
4642
4858
  this.pendingKeyboardUpdate = null;
4643
4859
  const r = this.grid._focusRow, o = this.grid._focusCol;
4644
4860
  if (n && this.cellAnchor) {
4645
- const a = ie(this.cellAnchor, { row: r, col: o });
4861
+ const a = ce(this.cellAnchor, { row: r, col: o });
4646
4862
  this.ranges = [a], this.activeRange = a;
4647
4863
  } else n || (this.ranges = [], this.activeRange = null, this.cellAnchor = { row: r, col: o });
4648
4864
  this.emit("selection-change", this.#t());
@@ -4650,7 +4866,7 @@ class wn extends R {
4650
4866
  this.grid.setAttribute("data-selection-mode", i), t && t.classList.toggle("selecting", this.isDragging), this.#e();
4651
4867
  }
4652
4868
  onScrollRender() {
4653
- this.#e();
4869
+ this.isSelectionEnabled() && this.#e();
4654
4870
  }
4655
4871
  getSelection() {
4656
4872
  return {
@@ -4660,10 +4876,10 @@ class wn extends R {
4660
4876
  };
4661
4877
  }
4662
4878
  getSelectedCells() {
4663
- return Ni(this.ranges);
4879
+ return ji(this.ranges);
4664
4880
  }
4665
4881
  isCellSelected(e, t) {
4666
- return He(e, t, this.ranges);
4882
+ return $e(e, t, this.ranges);
4667
4883
  }
4668
4884
  clearSelection() {
4669
4885
  this.selectedCell = null, this.selected.clear(), this.anchor = null, this.ranges = [], this.activeRange = null, this.cellAnchor = null, this.emit("selection-change", { mode: this.config.mode, ranges: [] }), this.requestAfterRender();
@@ -4676,11 +4892,11 @@ class wn extends R {
4676
4892
  endCol: t.to.col
4677
4893
  })), this.activeRange = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null, this.emit("selection-change", {
4678
4894
  mode: this.config.mode,
4679
- ranges: Ye(this.ranges)
4895
+ ranges: nt(this.ranges)
4680
4896
  }), this.requestAfterRender();
4681
4897
  }
4682
4898
  #t() {
4683
- return zi(
4899
+ return Yi(
4684
4900
  this.config.mode,
4685
4901
  {
4686
4902
  selectedCell: this.selectedCell,
@@ -4691,23 +4907,23 @@ class wn extends R {
4691
4907
  );
4692
4908
  }
4693
4909
  }
4694
- function $(s, e) {
4910
+ function ee(s, e) {
4695
4911
  return Math.floor(s / e);
4696
4912
  }
4697
- function Gi(s, e) {
4913
+ function Xi(s, e) {
4698
4914
  return {
4699
4915
  start: s * e,
4700
4916
  end: (s + 1) * e
4701
4917
  };
4702
4918
  }
4703
- function Oi(s, e, t) {
4704
- const i = $(s, t), n = $(e - 1, t), r = [];
4919
+ function Zi(s, e, t) {
4920
+ const i = ee(s, t), n = ee(e - 1, t), r = [];
4705
4921
  for (let o = i; o <= n; o++)
4706
4922
  r.push(o);
4707
4923
  return r;
4708
4924
  }
4709
- async function ze(s, e, t, i) {
4710
- const n = Gi(e, t);
4925
+ async function je(s, e, t, i) {
4926
+ const n = Xi(e, t);
4711
4927
  return s.getRows({
4712
4928
  startRow: n.start,
4713
4929
  endRow: n.end,
@@ -4715,14 +4931,14 @@ async function ze(s, e, t, i) {
4715
4931
  filterModel: i.filterModel
4716
4932
  });
4717
4933
  }
4718
- function Bi(s, e, t) {
4719
- const i = $(s, e), n = t.get(i);
4934
+ function Ji(s, e, t) {
4935
+ const i = ee(s, e), n = t.get(i);
4720
4936
  if (!n) return;
4721
4937
  const r = s % e;
4722
4938
  return n[r];
4723
4939
  }
4724
- const Vi = 100;
4725
- class bn extends R {
4940
+ const Qi = 100;
4941
+ class kn extends _ {
4726
4942
  name = "serverSide";
4727
4943
  get defaultConfig() {
4728
4944
  return {
@@ -4742,12 +4958,12 @@ class bn extends R {
4742
4958
  }
4743
4959
  loadRequiredBlocks() {
4744
4960
  if (!this.dataSource) return;
4745
- const e = this.grid, t = this.config.cacheBlockSize ?? 100, i = { startRow: e._virtualization.start, endRow: e._virtualization.end }, n = Oi(i.startRow, i.endRow, t);
4961
+ const e = this.grid, t = this.config.cacheBlockSize ?? 100, i = { startRow: e._virtualization.start, endRow: e._virtualization.end }, n = Zi(i.startRow, i.endRow, t);
4746
4962
  for (const r of n)
4747
4963
  if (!(this.loadedBlocks.has(r) || this.loadingBlocks.has(r))) {
4748
4964
  if (this.loadingBlocks.size >= (this.config.maxConcurrentRequests ?? 2))
4749
4965
  break;
4750
- this.loadingBlocks.add(r), ze(this.dataSource, r, t, {}).then((o) => {
4966
+ this.loadingBlocks.add(r), je(this.dataSource, r, t, {}).then((o) => {
4751
4967
  this.loadedBlocks.set(r, o.rows), this.totalRowCount = o.totalRowCount, this.loadingBlocks.delete(r), this.requestRender(), this.loadRequiredBlocks();
4752
4968
  }).catch(() => {
4753
4969
  this.loadingBlocks.delete(r);
@@ -4758,7 +4974,7 @@ class bn extends R {
4758
4974
  if (!this.dataSource) return [...e];
4759
4975
  const t = [];
4760
4976
  for (let i = 0; i < this.totalRowCount; i++) {
4761
- const n = Bi(i, this.config.cacheBlockSize ?? 100, this.loadedBlocks);
4977
+ const n = Ji(i, this.config.cacheBlockSize ?? 100, this.loadedBlocks);
4762
4978
  t.push(n ?? { __loading: !0, __index: i });
4763
4979
  }
4764
4980
  return t;
@@ -4766,12 +4982,12 @@ class bn extends R {
4766
4982
  onScroll(e) {
4767
4983
  this.dataSource && (this.loadRequiredBlocks(), this.scrollDebounceTimer && clearTimeout(this.scrollDebounceTimer), this.scrollDebounceTimer = setTimeout(() => {
4768
4984
  this.loadRequiredBlocks();
4769
- }, Vi));
4985
+ }, Qi));
4770
4986
  }
4771
4987
  setDataSource(e) {
4772
4988
  this.dataSource = e, this.loadedBlocks.clear(), this.loadingBlocks.clear();
4773
4989
  const t = this.config.cacheBlockSize ?? 100;
4774
- ze(e, 0, t, {}).then((i) => {
4990
+ je(e, 0, t, {}).then((i) => {
4775
4991
  this.loadedBlocks.set(0, i.rows), this.totalRowCount = i.totalRowCount, this.requestRender();
4776
4992
  });
4777
4993
  }
@@ -4785,59 +5001,59 @@ class bn extends R {
4785
5001
  return this.totalRowCount;
4786
5002
  }
4787
5003
  isRowLoaded(e) {
4788
- const t = this.config.cacheBlockSize ?? 100, i = $(e, t);
5004
+ const t = this.config.cacheBlockSize ?? 100, i = ee(e, t);
4789
5005
  return this.loadedBlocks.has(i);
4790
5006
  }
4791
5007
  getLoadedBlockCount() {
4792
5008
  return this.loadedBlocks.size;
4793
5009
  }
4794
5010
  }
4795
- function Xe(s, e, t) {
5011
+ function rt(s, e, t) {
4796
5012
  return s.id !== void 0 ? String(s.id) : t ? `${t}-${e}` : String(e);
4797
5013
  }
4798
- function ne(s, e) {
5014
+ function ue(s, e) {
4799
5015
  const t = new Set(s);
4800
5016
  return t.has(e) ? t.delete(e) : t.add(e), t;
4801
5017
  }
4802
- function se(s, e, t = null, i = 0) {
5018
+ function fe(s, e, t = null, i = 0) {
4803
5019
  const n = e.childrenField ?? "children", r = /* @__PURE__ */ new Set();
4804
5020
  for (let o = 0; o < s.length; o++) {
4805
- const a = s[o], l = Xe(a, o, t), d = a[n];
5021
+ const a = s[o], l = rt(a, o, t), d = a[n];
4806
5022
  if (Array.isArray(d) && d.length > 0) {
4807
5023
  r.add(l);
4808
- const c = se(d, e, l, i + 1);
5024
+ const c = fe(d, e, l, i + 1);
4809
5025
  for (const u of c) r.add(u);
4810
5026
  }
4811
5027
  }
4812
5028
  return r;
4813
5029
  }
4814
- function Wi() {
5030
+ function en() {
4815
5031
  return /* @__PURE__ */ new Set();
4816
5032
  }
4817
- function Ze(s, e, t, i = null, n = 0) {
5033
+ function ot(s, e, t, i = null, n = 0) {
4818
5034
  const r = t.childrenField ?? "children";
4819
5035
  for (let o = 0; o < s.length; o++) {
4820
- const a = s[o], l = Xe(a, o, i);
5036
+ const a = s[o], l = rt(a, o, i);
4821
5037
  if (l === e)
4822
5038
  return [l];
4823
5039
  const d = a[r];
4824
5040
  if (Array.isArray(d) && d.length > 0) {
4825
- const c = Ze(d, e, t, l, n + 1);
5041
+ const c = ot(d, e, t, l, n + 1);
4826
5042
  if (c)
4827
5043
  return [l, ...c];
4828
5044
  }
4829
5045
  }
4830
5046
  return null;
4831
5047
  }
4832
- function $i(s, e, t, i) {
4833
- const n = Ze(s, e, t);
5048
+ function tn(s, e, t, i) {
5049
+ const n = ot(s, e, t);
4834
5050
  if (!n) return i;
4835
5051
  const r = new Set(i);
4836
5052
  for (let o = 0; o < n.length - 1; o++)
4837
5053
  r.add(n[o]);
4838
5054
  return r;
4839
5055
  }
4840
- function Ge(s, e = "children") {
5056
+ function Ue(s, e = "children") {
4841
5057
  if (!Array.isArray(s) || s.length === 0) return !1;
4842
5058
  for (const t of s) {
4843
5059
  if (!t) continue;
@@ -4847,7 +5063,7 @@ function Ge(s, e = "children") {
4847
5063
  }
4848
5064
  return !1;
4849
5065
  }
4850
- function ji(s) {
5066
+ function nn(s) {
4851
5067
  if (!Array.isArray(s) || s.length === 0) return null;
4852
5068
  const e = ["children", "items", "nodes", "subRows", "nested"];
4853
5069
  for (const t of s)
@@ -4859,10 +5075,10 @@ function ji(s) {
4859
5075
  }
4860
5076
  return null;
4861
5077
  }
4862
- const Ui = "@layer tbw-plugins{tbw-grid{.cell[data-field=__tbw_expander]{border-right:none!important;padding:0;display:flex;align-items:center;justify-content:flex-start}.header-row .cell[data-field=__tbw_expander]{display:none}.header-row .cell[data-field=__tbw_expander]+.cell{grid-column:1 / 3}.tree-cell-wrapper{display:inline-flex;align-items:center;padding-left:calc(var(--tbw-tree-depth, 0) * var(--tbw-tree-indent-width, var(--tbw-tree-toggle-size, 1.25em)))}.tree-expander{display:flex;align-items:center;justify-content:flex-start;width:100%;height:100%;box-sizing:border-box}.tree-toggle{cursor:pointer;user-select:none;display:inline-flex;align-items:center;justify-content:center;width:var(--tbw-tree-toggle-size, 1.25em);height:var(--tbw-tree-toggle-size, 1.25em);flex-shrink:0}.tree-toggle:hover{color:var(--tbw-tree-accent, var(--tbw-color-accent))}.tree-spacer{width:var(--tbw-tree-toggle-size, 1.25em);display:inline-block;flex-shrink:0}.data-grid-row.tbw-tree-slide-in{animation:tbw-tree-slide-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}.data-grid-row.tbw-tree-fade-in{animation:tbw-tree-fade-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}}@keyframes tbw-tree-slide-in{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}@keyframes tbw-tree-fade-in{0%{opacity:0}to{opacity:1}}}";
4863
- class vn extends R {
5078
+ const rn = "@layer tbw-plugins{tbw-grid{.cell[data-field=__tbw_expander]{border-right:none!important;padding:0;display:flex;align-items:center;justify-content:flex-start}.header-row .cell[data-field=__tbw_expander]{display:none}.header-row .cell[data-field=__tbw_expander]+.cell{grid-column:1 / 3}.tree-cell-wrapper{display:inline-flex;align-items:center;padding-left:calc(var(--tbw-tree-depth, 0) * var(--tbw-tree-indent-width, var(--tbw-tree-toggle-size, 1.25em)))}.tree-expander{display:flex;align-items:center;justify-content:flex-start;width:100%;height:100%;box-sizing:border-box}.tree-toggle{cursor:pointer;user-select:none;display:inline-flex;align-items:center;justify-content:center;width:var(--tbw-tree-toggle-size, 1.25em);height:var(--tbw-tree-toggle-size, 1.25em);flex-shrink:0}.tree-toggle:hover{color:var(--tbw-tree-accent, var(--tbw-color-accent))}.tree-spacer{width:var(--tbw-tree-toggle-size, 1.25em);display:inline-block;flex-shrink:0}.data-grid-row.tbw-tree-slide-in{animation:tbw-tree-slide-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}.data-grid-row.tbw-tree-fade-in{animation:tbw-tree-fade-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}}@keyframes tbw-tree-slide-in{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}@keyframes tbw-tree-fade-in{0%{opacity:0}to{opacity:1}}}";
5079
+ class An extends _ {
4864
5080
  name = "tree";
4865
- styles = Ui;
5081
+ styles = rn;
4866
5082
  get defaultConfig() {
4867
5083
  return {
4868
5084
  childrenField: "children",
@@ -4888,15 +5104,15 @@ class vn extends R {
4888
5104
  }
4889
5105
  detect(e) {
4890
5106
  if (!this.config.autoDetect) return !1;
4891
- const t = e, i = this.config.childrenField ?? ji(t) ?? "children";
4892
- return Ge(t, i);
5107
+ const t = e, i = this.config.childrenField ?? nn(t) ?? "children";
5108
+ return Ue(t, i);
4893
5109
  }
4894
5110
  processRows(e) {
4895
5111
  const t = this.config.childrenField ?? "children", i = e;
4896
- if (!Ge(i, t))
5112
+ if (!Ue(i, t))
4897
5113
  return this.flattenedRows = [], this.rowKeyMap.clear(), this.previousVisibleKeys.clear(), [...e];
4898
5114
  let n = this.withStableKeys(i);
4899
- this.sortState && (n = this.sortTree(n, this.sortState.field, this.sortState.direction)), this.config.defaultExpanded && !this.initialExpansionDone && (this.expandedKeys = se(n, this.config), this.initialExpansionDone = !0), this.flattenedRows = this.flattenTree(n, this.expandedKeys), this.rowKeyMap.clear(), this.keysToAnimate.clear();
5115
+ this.sortState && (n = this.sortTree(n, this.sortState.field, this.sortState.direction)), this.config.defaultExpanded && !this.initialExpansionDone && (this.expandedKeys = fe(n, this.config), this.initialExpansionDone = !0), this.flattenedRows = this.flattenTree(n, this.expandedKeys), this.rowKeyMap.clear(), this.keysToAnimate.clear();
4900
5116
  const r = /* @__PURE__ */ new Set();
4901
5117
  for (const o of this.flattenedRows)
4902
5118
  this.rowKeyMap.set(o.key, o), r.add(o.key), !this.previousVisibleKeys.has(o.key) && o.depth > 0 && this.keysToAnimate.add(o.key);
@@ -4949,22 +5165,22 @@ class vn extends R {
4949
5165
  const t = [...e];
4950
5166
  if (t.length === 0) return t;
4951
5167
  const i = t[0], n = i.viewRenderer, r = () => this.config, o = this.setIcon.bind(this), a = this.resolveIcon.bind(this), l = (d) => {
4952
- const { row: c, value: u } = d, { showExpandIcons: h = !0, indentWidth: g } = r(), f = c, p = f.__treeDepth ?? 0, m = document.createElement("span");
4953
- if (m.className = "tree-cell-wrapper", m.style.setProperty("--tbw-tree-depth", String(p)), g !== void 0 && m.style.setProperty("--tbw-tree-indent-width", `${g}px`), h)
5168
+ const { row: c, value: u } = d, { showExpandIcons: h = !0, indentWidth: g } = r(), f = c, p = f.__treeDepth ?? 0, w = document.createElement("span");
5169
+ if (w.className = "tree-cell-wrapper", w.style.setProperty("--tbw-tree-depth", String(p)), g !== void 0 && w.style.setProperty("--tbw-tree-indent-width", `${g}px`), h)
4954
5170
  if (f.__treeHasChildren) {
4955
- const b = document.createElement("span");
4956
- b.className = `tree-toggle${f.__treeExpanded ? " expanded" : ""}`, o(b, a(f.__treeExpanded ? "collapse" : "expand")), b.setAttribute("data-tree-key", String(f.__treeKey ?? "")), m.appendChild(b);
5171
+ const y = document.createElement("span");
5172
+ y.className = `tree-toggle${f.__treeExpanded ? " expanded" : ""}`, o(y, a(f.__treeExpanded ? "collapse" : "expand")), y.setAttribute("data-tree-key", String(f.__treeKey ?? "")), w.appendChild(y);
4957
5173
  } else {
4958
- const b = document.createElement("span");
4959
- b.className = "tree-spacer", m.appendChild(b);
5174
+ const y = document.createElement("span");
5175
+ y.className = "tree-spacer", w.appendChild(y);
4960
5176
  }
4961
- const w = document.createElement("span");
4962
- if (w.className = "tree-content", n) {
4963
- const b = n(d);
4964
- b instanceof Node ? w.appendChild(b) : typeof b == "string" && (w.innerHTML = b);
5177
+ const v = document.createElement("span");
5178
+ if (v.className = "tree-content", n) {
5179
+ const y = n(d);
5180
+ y instanceof Node ? v.appendChild(y) : typeof y == "string" && (v.innerHTML = y);
4965
5181
  } else
4966
- w.textContent = u != null ? String(u) : "";
4967
- return m.appendChild(w), m;
5182
+ v.textContent = u != null ? String(u) : "";
5183
+ return w.appendChild(v), w;
4968
5184
  };
4969
5185
  return t[0] = { ...i, viewRenderer: l }, t;
4970
5186
  }
@@ -4974,7 +5190,7 @@ class vn extends R {
4974
5190
  const i = t.getAttribute("data-tree-key");
4975
5191
  if (!i) return !1;
4976
5192
  const n = this.rowKeyMap.get(i);
4977
- return n ? (this.expandedKeys = ne(this.expandedKeys, i), this.emit("tree-expand", {
5193
+ return n ? (this.expandedKeys = ue(this.expandedKeys, i), this.emit("tree-expand", {
4978
5194
  key: i,
4979
5195
  row: n.data,
4980
5196
  expanded: this.expandedKeys.has(i),
@@ -4985,7 +5201,7 @@ class vn extends R {
4985
5201
  if (e.key !== " ") return;
4986
5202
  const t = this.grid._focusRow, i = this.flattenedRows[t];
4987
5203
  if (i?.hasChildren)
4988
- return e.preventDefault(), this.expandedKeys = ne(this.expandedKeys, i.key), this.emit("tree-expand", {
5204
+ return e.preventDefault(), this.expandedKeys = ue(this.expandedKeys, i.key), this.emit("tree-expand", {
4989
5205
  key: i.key,
4990
5206
  row: i.data,
4991
5207
  expanded: this.expandedKeys.has(i.key),
@@ -5018,13 +5234,13 @@ class vn extends R {
5018
5234
  this.expandedKeys.delete(e), this.requestRender();
5019
5235
  }
5020
5236
  toggle(e) {
5021
- this.expandedKeys = ne(this.expandedKeys, e), this.requestRender();
5237
+ this.expandedKeys = ue(this.expandedKeys, e), this.requestRender();
5022
5238
  }
5023
5239
  expandAll() {
5024
- this.expandedKeys = se(this.rows, this.config), this.requestRender();
5240
+ this.expandedKeys = fe(this.rows, this.config), this.requestRender();
5025
5241
  }
5026
5242
  collapseAll() {
5027
- this.expandedKeys = Wi(), this.requestRender();
5243
+ this.expandedKeys = en(), this.requestRender();
5028
5244
  }
5029
5245
  isExpanded(e) {
5030
5246
  return this.expandedKeys.has(e);
@@ -5039,10 +5255,10 @@ class vn extends R {
5039
5255
  return this.rowKeyMap.get(e)?.data;
5040
5256
  }
5041
5257
  expandToKey(e) {
5042
- this.expandedKeys = $i(this.rows, e, this.config, this.expandedKeys), this.requestRender();
5258
+ this.expandedKeys = tn(this.rows, e, this.config, this.expandedKeys), this.requestRender();
5043
5259
  }
5044
5260
  }
5045
- function Yi(s, e, t) {
5261
+ function on(s, e, t) {
5046
5262
  const i = [...s.undoStack, e];
5047
5263
  for (; i.length > t; )
5048
5264
  i.shift();
@@ -5051,7 +5267,7 @@ function Yi(s, e, t) {
5051
5267
  redoStack: []
5052
5268
  };
5053
5269
  }
5054
- function Oe(s) {
5270
+ function Ye(s) {
5055
5271
  if (s.undoStack.length === 0)
5056
5272
  return { newState: s, action: null };
5057
5273
  const e = [...s.undoStack], t = e.pop();
@@ -5063,7 +5279,7 @@ function Oe(s) {
5063
5279
  action: t
5064
5280
  } : { newState: s, action: null };
5065
5281
  }
5066
- function Be(s) {
5282
+ function Xe(s) {
5067
5283
  if (s.redoStack.length === 0)
5068
5284
  return { newState: s, action: null };
5069
5285
  const e = [...s.redoStack], t = e.pop();
@@ -5075,16 +5291,16 @@ function Be(s) {
5075
5291
  action: t
5076
5292
  } : { newState: s, action: null };
5077
5293
  }
5078
- function Xi(s) {
5294
+ function sn(s) {
5079
5295
  return s.undoStack.length > 0;
5080
5296
  }
5081
- function Zi(s) {
5297
+ function an(s) {
5082
5298
  return s.redoStack.length > 0;
5083
5299
  }
5084
- function Ji() {
5300
+ function ln() {
5085
5301
  return { undoStack: [], redoStack: [] };
5086
5302
  }
5087
- function Qi(s, e, t, i) {
5303
+ function dn(s, e, t, i) {
5088
5304
  return {
5089
5305
  type: "cell-edit",
5090
5306
  rowIndex: s,
@@ -5094,7 +5310,7 @@ function Qi(s, e, t, i) {
5094
5310
  timestamp: Date.now()
5095
5311
  };
5096
5312
  }
5097
- class yn extends R {
5313
+ class _n extends _ {
5098
5314
  static dependencies = [
5099
5315
  { name: "editing", required: !0, reason: "UndoRedoPlugin tracks cell edit history" }
5100
5316
  ];
@@ -5112,7 +5328,7 @@ class yn extends R {
5112
5328
  onKeyDown(e) {
5113
5329
  const t = (e.ctrlKey || e.metaKey) && e.key === "z" && !e.shiftKey, i = (e.ctrlKey || e.metaKey) && (e.key === "y" || e.key === "z" && e.shiftKey);
5114
5330
  if (t) {
5115
- const n = Oe({ undoStack: this.undoStack, redoStack: this.redoStack });
5331
+ const n = Ye({ undoStack: this.undoStack, redoStack: this.redoStack });
5116
5332
  if (n.action) {
5117
5333
  const r = this.rows;
5118
5334
  r[n.action.rowIndex] && (r[n.action.rowIndex][n.action.field] = n.action.oldValue), this.undoStack = n.newState.undoStack, this.redoStack = n.newState.redoStack, this.emit("undo", {
@@ -5123,7 +5339,7 @@ class yn extends R {
5123
5339
  return !0;
5124
5340
  }
5125
5341
  if (i) {
5126
- const n = Be({ undoStack: this.undoStack, redoStack: this.redoStack });
5342
+ const n = Xe({ undoStack: this.undoStack, redoStack: this.redoStack });
5127
5343
  if (n.action) {
5128
5344
  const r = this.rows;
5129
5345
  r[n.action.rowIndex] && (r[n.action.rowIndex][n.action.field] = n.action.newValue), this.undoStack = n.newState.undoStack, this.redoStack = n.newState.redoStack, this.emit("redo", {
@@ -5136,7 +5352,7 @@ class yn extends R {
5136
5352
  return !1;
5137
5353
  }
5138
5354
  recordEdit(e, t, i, n) {
5139
- const r = Qi(e, t, i, n), o = Yi(
5355
+ const r = dn(e, t, i, n), o = on(
5140
5356
  { undoStack: this.undoStack, redoStack: this.redoStack },
5141
5357
  r,
5142
5358
  this.config.maxHistorySize ?? 100
@@ -5144,7 +5360,7 @@ class yn extends R {
5144
5360
  this.undoStack = o.undoStack, this.redoStack = o.redoStack;
5145
5361
  }
5146
5362
  undo() {
5147
- const e = Oe({ undoStack: this.undoStack, redoStack: this.redoStack });
5363
+ const e = Ye({ undoStack: this.undoStack, redoStack: this.redoStack });
5148
5364
  if (e.action) {
5149
5365
  const t = this.rows;
5150
5366
  t[e.action.rowIndex] && (t[e.action.rowIndex][e.action.field] = e.action.oldValue), this.undoStack = e.newState.undoStack, this.redoStack = e.newState.redoStack, this.requestRender();
@@ -5152,7 +5368,7 @@ class yn extends R {
5152
5368
  return e.action;
5153
5369
  }
5154
5370
  redo() {
5155
- const e = Be({ undoStack: this.undoStack, redoStack: this.redoStack });
5371
+ const e = Xe({ undoStack: this.undoStack, redoStack: this.redoStack });
5156
5372
  if (e.action) {
5157
5373
  const t = this.rows;
5158
5374
  t[e.action.rowIndex] && (t[e.action.rowIndex][e.action.field] = e.action.newValue), this.undoStack = e.newState.undoStack, this.redoStack = e.newState.redoStack, this.requestRender();
@@ -5160,13 +5376,13 @@ class yn extends R {
5160
5376
  return e.action;
5161
5377
  }
5162
5378
  canUndo() {
5163
- return Xi({ undoStack: this.undoStack, redoStack: this.redoStack });
5379
+ return sn({ undoStack: this.undoStack, redoStack: this.redoStack });
5164
5380
  }
5165
5381
  canRedo() {
5166
- return Zi({ undoStack: this.undoStack, redoStack: this.redoStack });
5382
+ return an({ undoStack: this.undoStack, redoStack: this.redoStack });
5167
5383
  }
5168
5384
  clearHistory() {
5169
- const e = Ji();
5385
+ const e = ln();
5170
5386
  this.undoStack = e.undoStack, this.redoStack = e.redoStack;
5171
5387
  }
5172
5388
  getUndoStack() {
@@ -5176,18 +5392,18 @@ class yn extends R {
5176
5392
  return [...this.redoStack];
5177
5393
  }
5178
5394
  }
5179
- const en = '@layer tbw-plugins{.tbw-visibility-content{display:flex;flex-direction:column;height:100%}.tbw-visibility-list{flex:1;overflow-y:auto;padding:var(--tbw-panel-padding, var(--tbw-spacing-md, .5rem))}.tbw-visibility-row{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));padding:var(--tbw-menu-item-padding, .375rem .25rem);cursor:pointer;font-size:var(--tbw-font-size-sm, .8125rem);border-radius:var(--tbw-border-radius, .25rem);position:relative}.tbw-visibility-row:hover{background:var(--tbw-visibility-hover, var(--tbw-color-row-hover, #f3f4f6))}.tbw-visibility-row input[type=checkbox]{cursor:pointer}.tbw-visibility-row.locked span{color:var(--tbw-color-fg-muted, #888)}.tbw-visibility-handle{cursor:grab;color:var(--tbw-color-fg-muted, #888);font-size:var(--tbw-font-size-2xs, .625rem);letter-spacing:-2px;user-select:none;flex-shrink:0}.tbw-visibility-row.reorderable:hover .tbw-visibility-handle{color:var(--tbw-color-fg, #1f2937)}.tbw-visibility-label{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));flex:1;cursor:pointer}.tbw-visibility-row.dragging{opacity:.5;cursor:grabbing}.tbw-visibility-row.drop-before:before{content:"";position:absolute;left:0;right:0;top:0;height:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent, #3b82f6))}.tbw-visibility-row.drop-after:after{content:"";position:absolute;left:0;right:0;bottom:0;height:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent, #3b82f6))}.tbw-visibility-show-all{margin:var(--tbw-panel-padding, var(--tbw-spacing-md, .5rem));padding:var(--tbw-button-padding, .5rem .75rem);border:1px solid var(--tbw-visibility-border, var(--tbw-color-border, #e5e7eb));border-radius:var(--tbw-border-radius, .25rem);background:var(--tbw-visibility-btn-bg, var(--tbw-color-header-bg, #f9fafb));color:var(--tbw-color-fg, #1f2937);cursor:pointer;font-size:var(--tbw-font-size-sm, .8125rem)}.tbw-visibility-show-all:hover{background:var(--tbw-visibility-hover, var(--tbw-color-row-hover, #f3f4f6))}}';
5180
- function Ve(s) {
5395
+ const cn = '@layer tbw-plugins{.tbw-visibility-content{display:flex;flex-direction:column;height:100%}.tbw-visibility-list{flex:1;overflow-y:auto;padding:var(--tbw-panel-padding, var(--tbw-spacing-md, .5rem))}.tbw-visibility-row{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));padding:var(--tbw-menu-item-padding, .375rem .25rem);cursor:pointer;font-size:var(--tbw-font-size-sm, .8125rem);border-radius:var(--tbw-border-radius, .25rem);position:relative}.tbw-visibility-row:hover{background:var(--tbw-visibility-hover, var(--tbw-color-row-hover))}.tbw-visibility-row input[type=checkbox]{cursor:pointer}.tbw-visibility-row.locked span{color:var(--tbw-color-fg-muted)}.tbw-visibility-handle{cursor:grab;color:var(--tbw-color-fg-muted);font-size:var(--tbw-font-size-2xs, .625rem);letter-spacing:-2px;user-select:none;flex-shrink:0}.tbw-visibility-row.reorderable:hover .tbw-visibility-handle{color:var(--tbw-color-fg)}.tbw-visibility-label{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));flex:1;cursor:pointer}.tbw-visibility-row.dragging{opacity:.5;cursor:grabbing}.tbw-visibility-row.drop-before:before{content:"";position:absolute;left:0;right:0;top:0;height:2px;background:var(--tbw-visibility-indicator, var(--tbw-color-accent))}.tbw-visibility-row.drop-after:after{content:"";position:absolute;left:0;right:0;bottom:0;height:2px;background:var(--tbw-visibility-indicator, var(--tbw-color-accent))}.tbw-visibility-show-all{margin:var(--tbw-panel-padding, var(--tbw-spacing-md, .5rem));padding:var(--tbw-button-padding, .5rem .75rem);border:1px solid var(--tbw-visibility-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius, .25rem);background:var(--tbw-visibility-btn-bg, var(--tbw-color-header-bg));color:var(--tbw-color-fg);cursor:pointer;font-size:var(--tbw-font-size-sm, .8125rem)}.tbw-visibility-show-all:hover{background:var(--tbw-visibility-hover, var(--tbw-color-row-hover))}}';
5396
+ function Ze(s) {
5181
5397
  const e = s.meta ?? {};
5182
5398
  return e.lockPosition !== !0 && e.suppressMovable !== !0;
5183
5399
  }
5184
- class M extends R {
5400
+ class B extends _ {
5185
5401
  static dependencies = [
5186
5402
  { name: "reorder", required: !1, reason: "Enables drag-to-reorder columns in visibility panel" }
5187
5403
  ];
5188
5404
  name = "visibility";
5189
5405
  static PANEL_ID = "columns";
5190
- styles = en;
5406
+ styles = cn;
5191
5407
  get defaultConfig() {
5192
5408
  return {
5193
5409
  allowHideAll: !1
@@ -5208,7 +5424,7 @@ class M extends R {
5208
5424
  }
5209
5425
  getToolPanel() {
5210
5426
  return {
5211
- id: M.PANEL_ID,
5427
+ id: B.PANEL_ID,
5212
5428
  title: "Columns",
5213
5429
  icon: "☰",
5214
5430
  tooltip: "Column visibility",
@@ -5217,13 +5433,13 @@ class M extends R {
5217
5433
  };
5218
5434
  }
5219
5435
  show() {
5220
- this.grid.openToolPanel(), this.grid.expandedToolPanelSections.includes(M.PANEL_ID) || this.grid.toggleToolPanelSection(M.PANEL_ID);
5436
+ this.grid.openToolPanel(), this.grid.expandedToolPanelSections.includes(B.PANEL_ID) || this.grid.toggleToolPanelSection(B.PANEL_ID);
5221
5437
  }
5222
5438
  hide() {
5223
5439
  this.grid.closeToolPanel();
5224
5440
  }
5225
5441
  toggle() {
5226
- this.grid.isToolPanelOpen || this.grid.openToolPanel(), this.grid.toggleToolPanelSection(M.PANEL_ID);
5442
+ this.grid.isToolPanelOpen || this.grid.openToolPanel(), this.grid.toggleToolPanelSection(B.PANEL_ID);
5227
5443
  }
5228
5444
  isColumnVisible(e) {
5229
5445
  return this.grid.isColumnVisible(e);
@@ -5253,7 +5469,7 @@ class M extends R {
5253
5469
  return this.grid.getAllColumns();
5254
5470
  }
5255
5471
  isPanelVisible() {
5256
- return this.grid.isToolPanelOpen && this.grid.expandedToolPanelSections.includes(M.PANEL_ID);
5472
+ return this.grid.isToolPanelOpen && this.grid.expandedToolPanelSections.includes(B.PANEL_ID);
5257
5473
  }
5258
5474
  renderPanelContent(e) {
5259
5475
  const t = document.createElement("div");
@@ -5277,7 +5493,7 @@ class M extends R {
5277
5493
  const i = this.grid.getAllColumns().filter((n) => !n.utility);
5278
5494
  for (let n = 0; n < i.length; n++) {
5279
5495
  const r = i[n], o = r.header || r.field, a = document.createElement("div");
5280
- a.className = r.lockVisible ? "tbw-visibility-row locked" : "tbw-visibility-row", a.setAttribute("data-field", r.field), a.setAttribute("data-index", String(n)), t && Ve(r) && (a.draggable = !0, a.classList.add("reorderable"), this.setupDragListeners(a, r.field, n, e));
5496
+ a.className = r.lockVisible ? "tbw-visibility-row locked" : "tbw-visibility-row", a.setAttribute("data-field", r.field), a.setAttribute("data-index", String(n)), t && Ze(r) && (a.draggable = !0, a.classList.add("reorderable"), this.setupDragListeners(a, r.field, n, e));
5281
5497
  const l = document.createElement("label");
5282
5498
  l.className = "tbw-visibility-label";
5283
5499
  const d = document.createElement("input");
@@ -5285,7 +5501,7 @@ class M extends R {
5285
5501
  this.grid.toggleColumnVisibility(r.field), setTimeout(() => this.rebuildToggles(e), 0);
5286
5502
  });
5287
5503
  const c = document.createElement("span");
5288
- if (c.textContent = o, l.appendChild(d), l.appendChild(c), t && Ve(r)) {
5504
+ if (c.textContent = o, l.appendChild(d), l.appendChild(c), t && Ze(r)) {
5289
5505
  const u = document.createElement("span");
5290
5506
  u.className = "tbw-visibility-handle", this.setIcon(u, this.resolveIcon("dragHandle")), u.title = "Drag to reorder", a.appendChild(u);
5291
5507
  }
@@ -5325,50 +5541,50 @@ class M extends R {
5325
5541
  }
5326
5542
  }
5327
5543
  export {
5328
- R as BaseGridPlugin,
5329
- nn as ClipboardPlugin,
5330
- rn as ColumnVirtualizationPlugin,
5331
- on as ContextMenuPlugin,
5332
- Rn as DEFAULT_ANIMATION_CONFIG,
5333
- Je as DEFAULT_GRID_ICONS,
5334
- En as DGEvents,
5335
- Sn as DataGridElement,
5336
- sn as EditingPlugin,
5337
- an as ExportPlugin,
5338
- T as FilteringPlugin,
5339
- kn as FitModeEnum,
5340
- An as GridCSSVars,
5341
- _n as GridClasses,
5342
- Ln as GridDataAttrs,
5343
- Tn as GridElement,
5344
- In as GridSelectors,
5345
- ln as GroupingColumnsPlugin,
5346
- dn as GroupingRowsPlugin,
5347
- je as MasterDetailPlugin,
5348
- cn as MultiSortPlugin,
5349
- We as PLUGIN_QUERIES,
5350
- un as PinnedColumnsPlugin,
5351
- hn as PinnedRowsPlugin,
5352
- F as PivotPlugin,
5353
- Pn as PluginEvents,
5354
- Dn as PluginManager,
5355
- gn as PrintPlugin,
5356
- Fi as ROW_DRAG_HANDLE_FIELD,
5357
- Fn as RenderPhase,
5358
- fn as ReorderPlugin,
5359
- pn as ResponsivePlugin,
5360
- mn as RowReorderPlugin,
5361
- wn as SelectionPlugin,
5362
- bn as ServerSidePlugin,
5363
- vn as TreePlugin,
5364
- yn as UndoRedoPlugin,
5365
- M as VisibilityPlugin,
5366
- Mn as builtInSort,
5367
- qn as createGrid,
5368
- Kn as defaultComparator,
5369
- yt as defaultEditorFor,
5370
- lt as defaultPasteHandler,
5371
- Ai as printGridIsolated,
5372
- Nn as queryGrid
5544
+ _ as BaseGridPlugin,
5545
+ hn as ClipboardPlugin,
5546
+ gn as ColumnVirtualizationPlugin,
5547
+ et as ContextMenuPlugin,
5548
+ Fn as DEFAULT_ANIMATION_CONFIG,
5549
+ at as DEFAULT_GRID_ICONS,
5550
+ In as DGEvents,
5551
+ Pn as DataGridElement,
5552
+ fn as EditingPlugin,
5553
+ pn as ExportPlugin,
5554
+ q as FilteringPlugin,
5555
+ Dn as FitModeEnum,
5556
+ Mn as GridCSSVars,
5557
+ Nn as GridClasses,
5558
+ qn as GridDataAttrs,
5559
+ Hn as GridElement,
5560
+ zn as GridSelectors,
5561
+ mn as GroupingColumnsPlugin,
5562
+ wn as GroupingRowsPlugin,
5563
+ tt as MasterDetailPlugin,
5564
+ bn as MultiSortPlugin,
5565
+ Je as PLUGIN_QUERIES,
5566
+ vn as PinnedColumnsPlugin,
5567
+ yn as PinnedRowsPlugin,
5568
+ G as PivotPlugin,
5569
+ Kn as PluginEvents,
5570
+ On as PluginManager,
5571
+ xn as PrintPlugin,
5572
+ Bi as ROW_DRAG_HANDLE_FIELD,
5573
+ Gn as RenderPhase,
5574
+ Cn as ReorderPlugin,
5575
+ En as ResponsivePlugin,
5576
+ Rn as RowReorderPlugin,
5577
+ Sn as SelectionPlugin,
5578
+ kn as ServerSidePlugin,
5579
+ An as TreePlugin,
5580
+ _n as UndoRedoPlugin,
5581
+ B as VisibilityPlugin,
5582
+ Bn as builtInSort,
5583
+ Vn as createGrid,
5584
+ Wn as defaultComparator,
5585
+ Tt as defaultEditorFor,
5586
+ wt as defaultPasteHandler,
5587
+ Ni as printGridIsolated,
5588
+ $n as queryGrid
5373
5589
  };
5374
5590
  //# sourceMappingURL=all.js.map