@toolbox-web/grid 1.12.1 → 1.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/all.js +1171 -943
  2. package/all.js.map +1 -1
  3. package/index.js +735 -737
  4. package/index.js.map +1 -1
  5. package/lib/core/grid.d.ts.map +1 -1
  6. package/lib/core/internal/row-animation.d.ts.map +1 -1
  7. package/lib/core/internal/sanitize.d.ts.map +1 -1
  8. package/lib/core/internal/validate-config.d.ts.map +1 -1
  9. package/lib/core/plugin/types.d.ts +1 -1
  10. package/lib/core/plugin/types.d.ts.map +1 -1
  11. package/lib/core/types.d.ts +48 -1
  12. package/lib/core/types.d.ts.map +1 -1
  13. package/lib/plugins/clipboard/ClipboardPlugin.d.ts +69 -8
  14. package/lib/plugins/clipboard/ClipboardPlugin.d.ts.map +1 -1
  15. package/lib/plugins/clipboard/index.d.ts +1 -1
  16. package/lib/plugins/clipboard/index.d.ts.map +1 -1
  17. package/lib/plugins/clipboard/index.js +257 -192
  18. package/lib/plugins/clipboard/index.js.map +1 -1
  19. package/lib/plugins/clipboard/types.d.ts +31 -0
  20. package/lib/plugins/clipboard/types.d.ts.map +1 -1
  21. package/lib/plugins/column-virtualization/index.js.map +1 -1
  22. package/lib/plugins/context-menu/ContextMenuPlugin.d.ts +8 -0
  23. package/lib/plugins/context-menu/ContextMenuPlugin.d.ts.map +1 -1
  24. package/lib/plugins/context-menu/index.js +75 -60
  25. package/lib/plugins/context-menu/index.js.map +1 -1
  26. package/lib/plugins/context-menu/types.d.ts +7 -0
  27. package/lib/plugins/context-menu/types.d.ts.map +1 -1
  28. package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
  29. package/lib/plugins/editing/editors.d.ts +2 -2
  30. package/lib/plugins/editing/editors.d.ts.map +1 -1
  31. package/lib/plugins/editing/index.d.ts +1 -1
  32. package/lib/plugins/editing/index.d.ts.map +1 -1
  33. package/lib/plugins/editing/index.js +393 -337
  34. package/lib/plugins/editing/index.js.map +1 -1
  35. package/lib/plugins/editing/types.d.ts +50 -23
  36. package/lib/plugins/editing/types.d.ts.map +1 -1
  37. package/lib/plugins/export/ExportPlugin.d.ts.map +1 -1
  38. package/lib/plugins/export/index.js +75 -66
  39. package/lib/plugins/export/index.js.map +1 -1
  40. package/lib/plugins/filtering/index.d.ts +1 -1
  41. package/lib/plugins/filtering/index.d.ts.map +1 -1
  42. package/lib/plugins/filtering/index.js +9 -9
  43. package/lib/plugins/filtering/index.js.map +1 -1
  44. package/lib/plugins/grouping-columns/index.js.map +1 -1
  45. package/lib/plugins/grouping-rows/index.js.map +1 -1
  46. package/lib/plugins/master-detail/index.js +57 -56
  47. package/lib/plugins/master-detail/index.js.map +1 -1
  48. package/lib/plugins/multi-sort/index.js.map +1 -1
  49. package/lib/plugins/pinned-columns/index.js.map +1 -1
  50. package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts +1 -0
  51. package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts.map +1 -1
  52. package/lib/plugins/pinned-rows/index.js +118 -87
  53. package/lib/plugins/pinned-rows/index.js.map +1 -1
  54. package/lib/plugins/pinned-rows/pinned-rows.d.ts +2 -1
  55. package/lib/plugins/pinned-rows/pinned-rows.d.ts.map +1 -1
  56. package/lib/plugins/pinned-rows/types.d.ts +23 -2
  57. package/lib/plugins/pinned-rows/types.d.ts.map +1 -1
  58. package/lib/plugins/pivot/index.js.map +1 -1
  59. package/lib/plugins/print/index.js.map +1 -1
  60. package/lib/plugins/reorder/index.js.map +1 -1
  61. package/lib/plugins/responsive/index.js +40 -39
  62. package/lib/plugins/responsive/index.js.map +1 -1
  63. package/lib/plugins/row-reorder/index.js.map +1 -1
  64. package/lib/plugins/selection/SelectionPlugin.d.ts +51 -0
  65. package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
  66. package/lib/plugins/selection/index.js +347 -145
  67. package/lib/plugins/selection/index.js.map +1 -1
  68. package/lib/plugins/selection/types.d.ts +18 -0
  69. package/lib/plugins/selection/types.d.ts.map +1 -1
  70. package/lib/plugins/server-side/index.js.map +1 -1
  71. package/lib/plugins/shared/data-collection.d.ts +33 -0
  72. package/lib/plugins/shared/data-collection.d.ts.map +1 -0
  73. package/lib/plugins/tree/index.js.map +1 -1
  74. package/lib/plugins/undo-redo/index.js.map +1 -1
  75. package/lib/plugins/visibility/index.js.map +1 -1
  76. package/package.json +1 -1
  77. package/public.d.ts +2 -0
  78. package/public.d.ts.map +1 -1
  79. package/themes/dg-theme-bootstrap.css +192 -8
  80. package/themes/dg-theme-material.css +243 -0
  81. package/umd/grid.all.umd.js +42 -42
  82. package/umd/grid.all.umd.js.map +1 -1
  83. package/umd/grid.umd.js +19 -19
  84. package/umd/grid.umd.js.map +1 -1
  85. package/umd/plugins/clipboard.umd.js +5 -5
  86. package/umd/plugins/clipboard.umd.js.map +1 -1
  87. package/umd/plugins/context-menu.umd.js +1 -1
  88. package/umd/plugins/context-menu.umd.js.map +1 -1
  89. package/umd/plugins/editing.umd.js +1 -1
  90. package/umd/plugins/editing.umd.js.map +1 -1
  91. package/umd/plugins/export.umd.js +7 -7
  92. package/umd/plugins/export.umd.js.map +1 -1
  93. package/umd/plugins/filtering.umd.js +1 -1
  94. package/umd/plugins/filtering.umd.js.map +1 -1
  95. package/umd/plugins/pinned-rows.umd.js +1 -1
  96. package/umd/plugins/pinned-rows.umd.js.map +1 -1
  97. package/umd/plugins/selection.umd.js +2 -2
  98. package/umd/plugins/selection.umd.js.map +1 -1
package/all.js CHANGED
@@ -1,33 +1,20 @@
1
- import { BaseGridPlugin as _, DEFAULT_GRID_ICONS as ht, F as M, e as F, s as ft, c as gt, runAggregator as te, a as Je, b as et, g as ue, r as pt, getAggregator as ye, getValueAggregator as mt, d as xe, f as wt } from "./index.js";
2
- import { DEFAULT_ANIMATION_CONFIG as Dn, DGEvents as Mn, DataGridElement as Nn, FitModeEnum as qn, GridCSSVars as Hn, GridClasses as Kn, GridDataAttrs as zn, DataGridElement as On, GridSelectors as Gn, PLUGIN_QUERIES as Bn, PluginEvents as Vn, PluginManager as Wn, RenderPhase as $n, builtInSort as jn, createGrid as Un, defaultComparator as Yn, queryGrid as Xn } from "./index.js";
3
- const tt = "__tbw_expander", bt = 32;
4
- function pe(s) {
5
- return s.field === tt;
6
- }
7
- function H(s) {
8
- return s.meta?.utility === !0;
1
+ import { BaseGridPlugin as _, DEFAULT_GRID_ICONS as pt, F as D, e as M, s as mt, c as wt, runAggregator as ne, a as tt, b as it, g as he, r as bt, getAggregator as xe, getValueAggregator as vt, d as Ce, f as Ee } from "./index.js";
2
+ import { DEFAULT_ANIMATION_CONFIG as Gn, DGEvents as Bn, DataGridElement as Vn, FitModeEnum as Wn, GridCSSVars as $n, GridClasses as jn, GridDataAttrs as Un, DataGridElement as Yn, GridSelectors as Xn, PLUGIN_QUERIES as Zn, PluginEvents as Qn, PluginManager as Jn, RenderPhase as er, builtInSort as tr, createGrid as ir, defaultComparator as nr, queryGrid as rr } from "./index.js";
3
+ function J(s, e, t = !0) {
4
+ let i = s;
5
+ if (t && (i = i.filter((n) => !n.hidden && !n.field.startsWith("__") && n.meta?.utility !== !0)), e?.length) {
6
+ const n = new Set(e);
7
+ i = i.filter((r) => n.has(r.field));
8
+ }
9
+ return i;
9
10
  }
10
- function vt(s) {
11
- return s.find(pe);
11
+ function fe(s, e) {
12
+ return e?.length ? [...e].sort((t, i) => t - i).map((t) => s[t]).filter((t) => t != null) : s;
12
13
  }
13
14
  function yt(s) {
14
- return {
15
- field: tt,
16
- header: "",
17
- width: bt,
18
- resizable: !1,
19
- sortable: !1,
20
- filterable: !1,
21
- meta: {
22
- lockPosition: !0,
23
- suppressMovable: !0,
24
- expanderColumn: !0,
25
- expanderPlugin: s,
26
- utility: !0
27
- }
28
- };
15
+ return s == null ? "" : s instanceof Date ? s.toISOString() : typeof s == "object" ? JSON.stringify(s) : String(s);
29
16
  }
30
- async function ie(s) {
17
+ async function xt(s) {
31
18
  try {
32
19
  return await navigator.clipboard.writeText(s), !0;
33
20
  } catch {
@@ -37,7 +24,7 @@ async function ie(s) {
37
24
  return document.body.removeChild(e), t;
38
25
  }
39
26
  }
40
- function Ce(s, e) {
27
+ function Re(s, e) {
41
28
  const t = e.delimiter ?? " ", i = e.newline ?? `
42
29
  `, n = s.replace(/\r\n/g, `
43
30
  `).replace(/\r/g, `
@@ -49,14 +36,14 @@ function Ce(s, e) {
49
36
  }
50
37
  return o.push(a), (o.length > 1 || o.some((d) => d.trim() !== "")) && r.push(o), r;
51
38
  }
52
- async function xt() {
39
+ async function Ct() {
53
40
  try {
54
41
  return await navigator.clipboard.readText();
55
42
  } catch {
56
43
  return "";
57
44
  }
58
45
  }
59
- function Ct(s, e) {
46
+ function Et(s, e) {
60
47
  const { rows: t, target: i, fields: n } = s;
61
48
  if (!i) return;
62
49
  const r = e.rows, o = e.effectiveConfig.columns ?? [], a = o.map((u) => u.field), l = /* @__PURE__ */ new Map();
@@ -81,7 +68,7 @@ function Ct(s, e) {
81
68
  }
82
69
  }), e.rows = d;
83
70
  }
84
- class pn extends _ {
71
+ class En extends _ {
85
72
  static dependencies = [
86
73
  { name: "selection", required: !1, reason: "Enables copy/paste of selected cells instead of entire grid" }
87
74
  ];
@@ -110,81 +97,76 @@ class pn extends _ {
110
97
  return (e.ctrlKey || e.metaKey) && e.key === "c" ? (this.#t(e.target), !0) : !1;
111
98
  }
112
99
  #t(e) {
113
- const t = this.#o(), i = this.columns.length - 1, n = this.rows.length - 1;
114
- let r;
115
- if (t && t.ranges.length > 0) {
116
- const { mode: a, ranges: l } = t, d = l[l.length - 1];
117
- a === "row" ? r = {
118
- startRow: d.from.row,
119
- startCol: 0,
120
- endRow: d.to.row,
121
- endCol: i
122
- } : r = {
123
- startRow: d.from.row,
124
- startCol: d.from.col,
125
- endRow: d.to.row,
126
- endCol: d.to.col
127
- };
128
- } else if (!t)
129
- r = { startRow: 0, startCol: 0, endRow: n, endCol: i };
130
- else {
131
- const a = this.#n(e);
132
- if (!a) return;
133
- r = { startRow: a.row, startCol: a.col, endRow: a.row, endCol: a.col };
134
- }
135
- const o = this.#i(r);
136
- ie(o.text).then(() => {
137
- this.lastCopied = { text: o.text, timestamp: Date.now() }, this.emit("copy", {
138
- text: o.text,
139
- rowCount: o.rowCount,
140
- columnCount: o.columnCount
141
- });
142
- });
100
+ const t = this.#r();
101
+ if (t && t.ranges.length === 0) {
102
+ const i = this.#l(e);
103
+ if (!i) return;
104
+ const n = this.columns[i.col];
105
+ if (!n) return;
106
+ this.copy({ rowIndices: [i.row], columns: [n.field] });
107
+ return;
108
+ }
109
+ this.copy();
143
110
  }
144
111
  #e(e) {
145
112
  const t = e.clipboardData?.getData("text/plain");
146
113
  if (!t) return;
147
114
  e.preventDefault();
148
- const i = Ce(t, this.config), n = this.#o(), r = n?.ranges?.[0], o = r?.from.row ?? 0, a = r?.from.col ?? 0, d = r && (n?.mode === "range" || n?.mode === "row") && (r.from.row !== r.to.row || r.from.col !== r.to.col) ? { endRow: r.to.row, endCol: r.to.col } : null, c = d?.endCol ?? this.columns.length - 1, u = this.columns[a], h = u ? { row: o, col: a, field: u.field, bounds: d } : null, f = [], g = i[0]?.length ?? 0;
115
+ const i = Re(t, this.config), n = this.#r(), r = n?.ranges?.[0], o = r?.from.row ?? 0, a = r?.from.col ?? 0, d = r && (n?.mode === "range" || n?.mode === "row") && (r.from.row !== r.to.row || r.from.col !== r.to.col) ? { endRow: r.to.row, endCol: r.to.col } : null, c = d?.endCol ?? this.columns.length - 1, u = this.columns[a], h = u ? { row: o, col: a, field: u.field, bounds: d } : null, f = [], g = i[0]?.length ?? 0;
149
116
  for (let w = 0; w < g && a + w <= c; w++) {
150
- const b = this.columns[a + w];
151
- b && !b.hidden && f.push(b.field);
117
+ const y = this.columns[a + w];
118
+ y && !y.hidden && f.push(y.field);
152
119
  }
153
120
  const p = { rows: i, text: t, target: h, fields: f };
154
- this.emit("paste", p), this.#s(p);
121
+ this.emit("paste", p), this.#o(p);
155
122
  }
156
- #s(e) {
123
+ #o(e) {
157
124
  if (!this.grid) return;
158
125
  const { pasteHandler: t } = this.config;
159
126
  if (t === null) return;
160
- (t ?? Ct)(e, this.grid);
127
+ (t ?? Et)(e, this.grid);
161
128
  }
162
- #o() {
163
- return this.grid?.query("getSelection", void 0)?.[0];
129
+ #r() {
130
+ return this.grid?.query("getSelection")?.[0];
164
131
  }
165
132
  #i(e) {
166
- 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 ?? `
167
- `, h = [], f = this.columns.slice(l, d + 1).filter((g) => !H(g));
168
- if (this.config.includeHeaders) {
169
- const g = f.map((p) => p.header || p.field);
170
- h.push(g.join(c));
171
- }
172
- for (let g = o; g <= a; g++) {
173
- const p = this.rows[g];
174
- if (!p) continue;
175
- const w = f.map((b) => {
176
- const y = p[b.field];
177
- return y == null ? "" : y instanceof Date ? y.toISOString() : String(y);
133
+ const t = this.#r();
134
+ let i;
135
+ if (e?.columns)
136
+ i = J(this.columns, e.columns);
137
+ else if (t?.ranges.length && t.mode !== "row") {
138
+ const r = t.ranges[t.ranges.length - 1], o = Math.min(r.from.col, r.to.col), a = Math.max(r.from.col, r.to.col);
139
+ i = J(this.columns.slice(o, a + 1));
140
+ } else
141
+ i = J(this.columns);
142
+ let n;
143
+ if (e?.rowIndices)
144
+ n = fe(this.rows, e.rowIndices);
145
+ else if (t?.ranges.length) {
146
+ const r = t.ranges[t.ranges.length - 1], o = Math.min(r.from.row, r.to.row), a = Math.max(r.from.row, r.to.row);
147
+ n = [];
148
+ for (let l = o; l <= a; l++) {
149
+ const d = this.rows[l];
150
+ d && n.push(d);
151
+ }
152
+ } else
153
+ n = this.rows;
154
+ return { columns: i, rows: n };
155
+ }
156
+ #n(e, t, i) {
157
+ const n = i?.delimiter ?? this.config.delimiter ?? " ", r = i?.newline ?? this.config.newline ?? `
158
+ `, o = i?.includeHeaders ?? this.config.includeHeaders ?? !1, a = i?.processCell ?? this.config.processCell, l = [];
159
+ o && l.push(e.map((d) => d.header || d.field).join(n));
160
+ for (const d of t) {
161
+ const c = e.map((u) => {
162
+ const h = d[u.field];
163
+ return a ? a(h, u.field, d) : yt(h);
178
164
  });
179
- h.push(w.join(c));
165
+ l.push(c.join(n));
180
166
  }
181
- return {
182
- text: h.join(u),
183
- rowCount: a - o + 1,
184
- columnCount: d - l + 1
185
- };
167
+ return l.join(r);
186
168
  }
187
- #n(e) {
169
+ #l(e) {
188
170
  const t = e.closest("[data-field-cache]");
189
171
  if (!t) return null;
190
172
  const i = t.dataset.fieldCache, n = t.dataset.row;
@@ -194,66 +176,58 @@ class pn extends _ {
194
176
  const o = this.columns.findIndex((a) => a.field === i);
195
177
  return o === -1 ? null : { row: r, col: o };
196
178
  }
197
- async copy() {
198
- const e = this.#o(), t = this.columns.length - 1;
199
- let i = { startRow: 0, startCol: 0, endRow: this.rows.length - 1, endCol: t };
200
- if (e && e.ranges.length > 0) {
201
- const r = e.ranges[e.ranges.length - 1];
202
- e.mode === "row" ? i = { startRow: r.from.row, startCol: 0, endRow: r.to.row, endCol: t } : i = {
203
- startRow: r.from.row,
204
- startCol: r.from.col,
205
- endRow: r.to.row,
206
- endCol: r.to.col
207
- };
208
- }
209
- const n = this.#i(i);
210
- return await ie(n.text), this.lastCopied = { text: n.text, timestamp: Date.now() }, n.text;
179
+ getSelectionAsText(e) {
180
+ const { columns: t, rows: i } = this.#i(e);
181
+ return t.length === 0 || i.length === 0 ? "" : this.#n(t, i, e);
182
+ }
183
+ async copy(e) {
184
+ const { columns: t, rows: i } = this.#i(e);
185
+ if (t.length === 0 || i.length === 0) return "";
186
+ const n = this.#n(t, i, e);
187
+ return await xt(n), this.lastCopied = { text: n, timestamp: Date.now() }, this.emit("copy", {
188
+ text: n,
189
+ rowCount: i.length,
190
+ columnCount: t.length
191
+ }), n;
211
192
  }
212
- async copyRows(e) {
213
- if (e.length === 0) return "";
214
- const t = [...e].sort((o, a) => o - a), i = this.columns.length - 1, n = {
215
- startRow: t[0],
216
- startCol: 0,
217
- endRow: t[t.length - 1],
218
- endCol: i
219
- }, r = this.#i(n);
220
- return await ie(r.text), this.lastCopied = { text: r.text, timestamp: Date.now() }, r.text;
193
+ async copyRows(e, t) {
194
+ return e.length === 0 ? "" : this.copy({ ...t, rowIndices: e });
221
195
  }
222
196
  async paste() {
223
- const e = await xt();
224
- return e ? Ce(e, this.config) : null;
197
+ const e = await Ct();
198
+ return e ? Re(e, this.config) : null;
225
199
  }
226
200
  getLastCopied() {
227
201
  return this.lastCopied;
228
202
  }
229
203
  }
230
- const Ee = 100;
231
- function me(s) {
204
+ const Se = 100;
205
+ function we(s) {
232
206
  if (s == null)
233
- return Ee;
207
+ return Se;
234
208
  if (typeof s == "number")
235
209
  return s;
236
210
  const e = parseFloat(s);
237
- return isNaN(e) ? Ee : e;
211
+ return isNaN(e) ? Se : e;
238
212
  }
239
- function Re(s) {
240
- return s.map((e) => me(e.width));
213
+ function ke(s) {
214
+ return s.map((e) => we(e.width));
241
215
  }
242
- function Se(s) {
216
+ function Ae(s) {
243
217
  const e = [];
244
218
  let t = 0;
245
219
  for (const i of s)
246
- e.push(t), t += me(i.width);
220
+ e.push(t), t += we(i.width);
247
221
  return e;
248
222
  }
249
- function ke(s) {
250
- return s.reduce((e, t) => e + me(t.width), 0);
223
+ function _e(s) {
224
+ return s.reduce((e, t) => e + we(t.width), 0);
251
225
  }
252
- function Et(s, e, t, i, n) {
226
+ function Rt(s, e, t, i, n) {
253
227
  const r = t.length;
254
228
  if (r === 0)
255
229
  return { startCol: 0, endCol: 0, visibleColumns: [] };
256
- let o = Rt(s, t, i);
230
+ let o = St(s, t, i);
257
231
  o = Math.max(0, o - n);
258
232
  const a = s + e;
259
233
  let l = o;
@@ -270,7 +244,7 @@ function Et(s, e, t, i, n) {
270
244
  d.push(c);
271
245
  return { startCol: o, endCol: l, visibleColumns: d };
272
246
  }
273
- function Rt(s, e, t) {
247
+ function St(s, e, t) {
274
248
  let i = 0, n = e.length - 1;
275
249
  for (; i < n; ) {
276
250
  const r = Math.floor((i + n) / 2);
@@ -278,10 +252,10 @@ function Rt(s, e, t) {
278
252
  }
279
253
  return i;
280
254
  }
281
- function St(s, e, t) {
255
+ function kt(s, e, t) {
282
256
  return t ? s > e : !1;
283
257
  }
284
- class mn extends _ {
258
+ class Rn extends _ {
285
259
  name = "columnVirtualization";
286
260
  get defaultConfig() {
287
261
  return {
@@ -301,7 +275,7 @@ class mn extends _ {
301
275
  attach(e) {
302
276
  super.attach(e);
303
277
  const t = this.columns;
304
- this.columnWidths = Re(t), this.columnOffsets = Se(t), this.totalWidth = ke(t), this.endCol = t.length - 1;
278
+ this.columnWidths = ke(t), this.columnOffsets = Ae(t), this.totalWidth = _e(t), this.endCol = t.length - 1;
305
279
  }
306
280
  detach() {
307
281
  this.#t(), this.columnWidths = [], this.columnOffsets = [], this.originalColumns = [], this.isVirtualized = !1, this.startCol = 0, this.endCol = 0, this.scrollLeft = 0, this.totalWidth = 0;
@@ -319,15 +293,15 @@ class mn extends _ {
319
293
  r && (r.style.minWidth = "");
320
294
  }
321
295
  processColumns(e) {
322
- (this.originalColumns.length === 0 || e.length > this.originalColumns.length) && (this.originalColumns = e, this.columnWidths = Re(e), this.columnOffsets = Se(e), this.totalWidth = ke(e));
323
- const i = this.originalColumns, n = St(
296
+ (this.originalColumns.length === 0 || e.length > this.originalColumns.length) && (this.originalColumns = e, this.columnWidths = ke(e), this.columnOffsets = Ae(e), this.totalWidth = _e(e));
297
+ const i = this.originalColumns, n = kt(
324
298
  i.length,
325
299
  this.config.threshold ?? 30,
326
300
  this.config.autoEnable ?? !0
327
301
  );
328
302
  if (this.isVirtualized = n ?? !1, !n)
329
303
  return this.startCol = 0, this.endCol = i.length - 1, [...i];
330
- const r = this.grid.clientWidth || 800, o = Et(
304
+ const r = this.grid.clientWidth || 800, o = Rt(
331
305
  this.scrollLeft,
332
306
  r,
333
307
  this.columnOffsets,
@@ -369,14 +343,14 @@ class mn extends _ {
369
343
  return this.totalWidth;
370
344
  }
371
345
  }
372
- 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:var(--tbw-context-menu-shadow, 0 2px 10px 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}}";
373
- function he(s, e) {
346
+ const re = "@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:var(--tbw-context-menu-shadow, 0 2px 10px 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}}";
347
+ function ge(s, e) {
374
348
  return (typeof s == "function" ? s(e) : s).filter((i) => !(i.hidden === !0 || typeof i.hidden == "function" && i.hidden(e)));
375
349
  }
376
- function kt(s, e) {
350
+ function At(s, e) {
377
351
  return s.disabled === !0 ? !0 : typeof s.disabled == "function" ? s.disabled(e) : !1;
378
352
  }
379
- function fe(s, e, t, i = ht.submenuArrow) {
353
+ function pe(s, e, t, i = pt.submenuArrow) {
380
354
  const n = document.createElement("div");
381
355
  n.className = "tbw-context-menu", n.setAttribute("role", "menu");
382
356
  for (const r of s) {
@@ -387,7 +361,7 @@ function fe(s, e, t, i = ht.submenuArrow) {
387
361
  }
388
362
  const o = document.createElement("div");
389
363
  o.className = "tbw-context-menu-item", r.cssClass && o.classList.add(r.cssClass), o.setAttribute("role", "menuitem"), o.setAttribute("data-id", r.id);
390
- const a = kt(r, e);
364
+ const a = At(r, e);
391
365
  if (a && (o.classList.add("disabled"), o.setAttribute("aria-disabled", "true")), r.icon) {
392
366
  const d = document.createElement("span");
393
367
  d.className = "tbw-context-menu-icon", d.innerHTML = r.icon, o.appendChild(d);
@@ -401,7 +375,7 @@ function fe(s, e, t, i = ht.submenuArrow) {
401
375
  const d = document.createElement("span");
402
376
  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", () => {
403
377
  if (o.querySelector(".tbw-context-menu") || !r.subMenu) return;
404
- const u = he(r.subMenu, e), h = fe(u, e, t, i);
378
+ const u = ge(r.subMenu, e), h = pe(u, e, t, i);
405
379
  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);
406
380
  }), o.addEventListener("mouseleave", () => {
407
381
  const c = o.querySelector(".tbw-context-menu");
@@ -414,14 +388,14 @@ function fe(s, e, t, i = ht.submenuArrow) {
414
388
  }
415
389
  return n;
416
390
  }
417
- function Ae(s, e, t) {
391
+ function Te(s, e, t) {
418
392
  s.style.position = "fixed", s.style.left = `${e}px`, s.style.top = `${t}px`, s.style.visibility = "hidden", s.style.zIndex = "10000";
419
393
  const i = s.getBoundingClientRect(), n = window.innerWidth, r = window.innerHeight;
420
394
  let o = e, a = t;
421
395
  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";
422
396
  }
423
- let O = null, G = null, N = null, re = 0;
424
- const oe = [
397
+ let z = null, O = null, N = null, oe = 0;
398
+ const se = [
425
399
  {
426
400
  id: "copy",
427
401
  name: "Copy",
@@ -439,11 +413,11 @@ const oe = [
439
413
  }
440
414
  }
441
415
  ];
442
- class it extends _ {
416
+ class nt extends _ {
443
417
  name = "contextMenu";
444
418
  get defaultConfig() {
445
419
  return {
446
- items: oe
420
+ items: se
447
421
  };
448
422
  }
449
423
  isOpen = !1;
@@ -451,11 +425,16 @@ class it extends _ {
451
425
  params = null;
452
426
  menuElement = null;
453
427
  attach(e) {
454
- super.attach(e), this.installGlobalHandlers(), re++;
428
+ super.attach(e), this.installGlobalHandlers(), oe++;
455
429
  }
456
430
  detach() {
457
431
  this.menuElement && (this.menuElement.remove(), this.menuElement = null), this.isOpen = !1, this.params = null, this.uninstallGlobalHandlers();
458
432
  }
433
+ syncSelectionOnContextMenu(e) {
434
+ if (e < 0) return [];
435
+ const i = this.grid?.query("getSelectedRowIndices")?.[0];
436
+ return i ? i.includes(e) ? i : (this.grid?.query("selectRows", [e]), [e]) : [e];
437
+ }
459
438
  static CSS_VARS_TO_COPY = [
460
439
  "--tbw-color-panel-bg",
461
440
  "--tbw-color-fg",
@@ -496,7 +475,7 @@ class it extends _ {
496
475
  if (!t) return;
497
476
  const i = getComputedStyle(t), n = [], r = i.getPropertyValue("color-scheme").trim();
498
477
  r && n.push(`color-scheme: ${r}`);
499
- for (const o of it.CSS_VARS_TO_COPY) {
478
+ for (const o of nt.CSS_VARS_TO_COPY) {
500
479
  const a = i.getPropertyValue(o).trim();
501
480
  a && n.push(`${o}: ${a}`);
502
481
  }
@@ -506,14 +485,14 @@ class it extends _ {
506
485
  }
507
486
  }
508
487
  installGlobalHandlers() {
509
- !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)), O || (O = () => {
488
+ !N && typeof document < "u" && typeof re == "string" && re && (N = document.createElement("style"), N.id = "tbw-context-menu-styles", N.textContent = re, document.head.appendChild(N)), z || (z = () => {
510
489
  document.querySelectorAll(".tbw-context-menu").forEach((t) => t.remove());
511
- }, document.addEventListener("click", O)), G || (G = (e) => {
490
+ }, document.addEventListener("click", z)), O || (O = (e) => {
512
491
  e.key === "Escape" && document.querySelectorAll(".tbw-context-menu").forEach((i) => i.remove());
513
- }, document.addEventListener("keydown", G));
492
+ }, document.addEventListener("keydown", O));
514
493
  }
515
494
  uninstallGlobalHandlers() {
516
- re--, !(re > 0) && (O && (document.removeEventListener("click", O), O = null), G && (document.removeEventListener("keydown", G), G = null), N && (N.remove(), N = null));
495
+ oe--, !(oe > 0) && (z && (document.removeEventListener("click", z), z = null), O && (document.removeEventListener("keydown", O), O = null), N && (N.remove(), N = null));
517
496
  }
518
497
  afterRender() {
519
498
  const e = this.gridElement;
@@ -525,7 +504,7 @@ class it extends _ {
525
504
  const r = n.target, o = r.closest("[data-row][data-col]"), a = r.closest(".header-cell");
526
505
  let l;
527
506
  if (o) {
528
- const c = parseInt(o.getAttribute("data-row") ?? "-1", 10), u = parseInt(o.getAttribute("data-col") ?? "-1", 10), h = this.columns[u], f = this.rows[c];
507
+ const c = parseInt(o.getAttribute("data-row") ?? "-1", 10), u = parseInt(o.getAttribute("data-col") ?? "-1", 10), h = this.columns[u], f = this.rows[c], g = this.syncSelectionOnContextMenu(c);
529
508
  l = {
530
509
  row: f,
531
510
  rowIndex: c,
@@ -534,7 +513,8 @@ class it extends _ {
534
513
  field: h?.field ?? "",
535
514
  value: f?.[h?.field] ?? null,
536
515
  isHeader: !1,
537
- event: n
516
+ event: n,
517
+ selectedRows: g
538
518
  };
539
519
  } else if (a) {
540
520
  const c = parseInt(a.getAttribute("data-col") ?? "-1", 10), u = this.columns[c];
@@ -546,20 +526,21 @@ class it extends _ {
546
526
  field: u?.field ?? "",
547
527
  value: null,
548
528
  isHeader: !0,
549
- event: n
529
+ event: n,
530
+ selectedRows: []
550
531
  };
551
532
  } else
552
533
  return;
553
534
  this.params = l, this.position = { x: n.clientX, y: n.clientY };
554
- const d = he(this.config.items ?? oe, l);
555
- d.length && (this.menuElement && this.menuElement.remove(), this.menuElement = fe(
535
+ const d = ge(this.config.items ?? se, l);
536
+ d.length && (this.menuElement && this.menuElement.remove(), this.menuElement = pe(
556
537
  d,
557
538
  l,
558
539
  (c) => {
559
540
  c.action && c.action(l), this.menuElement?.remove(), this.menuElement = null, this.isOpen = !1;
560
541
  },
561
542
  this.gridIcons.submenuArrow
562
- ), 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 }));
543
+ ), document.body.appendChild(this.menuElement), this.copyGridStyles(this.menuElement), Te(this.menuElement, n.clientX, n.clientY), this.isOpen = !0, this.emit("context-menu-open", { params: l, items: d }));
563
544
  }));
564
545
  }
565
546
  showMenu(e, t, i) {
@@ -571,16 +552,17 @@ class it extends _ {
571
552
  field: i.field ?? "",
572
553
  value: i.value ?? null,
573
554
  isHeader: i.isHeader ?? !1,
574
- event: i.event ?? new MouseEvent("contextmenu")
575
- }, r = he(this.config.items ?? oe, n);
576
- this.menuElement && this.menuElement.remove(), this.menuElement = fe(
555
+ event: i.event ?? new MouseEvent("contextmenu"),
556
+ selectedRows: i.selectedRows ?? []
557
+ }, r = ge(this.config.items ?? se, n);
558
+ this.menuElement && this.menuElement.remove(), this.menuElement = pe(
577
559
  r,
578
560
  n,
579
561
  (o) => {
580
562
  o.action && o.action(n), this.menuElement?.remove(), this.menuElement = null, this.isOpen = !1;
581
563
  },
582
564
  this.gridIcons.submenuArrow
583
- ), document.body.appendChild(this.menuElement), this.copyGridStyles(this.menuElement), Ae(this.menuElement, e, t), this.isOpen = !0;
565
+ ), document.body.appendChild(this.menuElement), this.copyGridStyles(this.menuElement), Te(this.menuElement, e, t), this.isOpen = !0;
584
566
  }
585
567
  hideMenu() {
586
568
  this.menuElement && (this.menuElement.remove(), this.menuElement = null, this.isOpen = !1);
@@ -589,12 +571,12 @@ class it extends _ {
589
571
  return this.isOpen;
590
572
  }
591
573
  }
592
- const At = "@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;&:not(.tbw-grid-mode) .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}--tbw-invalid-bg: light-dark(#fef2f2, #450a0a);--tbw-invalid-border-color: light-dark(#ef4444, #f87171);.data-grid-row>.cell[data-invalid=true]{background:var(--tbw-invalid-bg);outline:1px solid var(--tbw-invalid-border-color);outline-offset:-1px}}}";
593
- function _t(s) {
574
+ const _t = "@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;&:not(.tbw-grid-mode) .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}--tbw-invalid-bg: light-dark(#fef2f2, #450a0a);--tbw-invalid-border-color: light-dark(#ef4444, #f87171);.data-grid-row>.cell[data-invalid=true]{background:var(--tbw-invalid-bg);outline:1px solid var(--tbw-invalid-border-color);outline-offset:-1px}}}";
575
+ function Tt(s) {
594
576
  const e = s.options;
595
577
  return e ? typeof e == "function" ? e() : e : [];
596
578
  }
597
- function Tt(s) {
579
+ function Lt(s) {
598
580
  return (e) => {
599
581
  const t = s.editorParams, i = document.createElement("input");
600
582
  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);
@@ -604,13 +586,13 @@ function Tt(s) {
604
586
  }), i;
605
587
  };
606
588
  }
607
- function Lt() {
589
+ function It() {
608
590
  return (s) => {
609
591
  const e = document.createElement("input");
610
592
  return e.type = "checkbox", e.checked = !!s.value, e.addEventListener("change", () => s.commit(e.checked)), e;
611
593
  };
612
594
  }
613
- function It(s) {
595
+ function Ft(s) {
614
596
  return (e) => {
615
597
  const t = s.editorParams, i = document.createElement("input");
616
598
  i.type = "date", e.value instanceof Date ? i.valueAsDate = e.value : typeof e.value == "string" && e.value && (i.value = e.value.split("T")[0]), t?.min && (i.min = t.min), t?.max && (i.max = t.max), t?.placeholder && (i.placeholder = t.placeholder);
@@ -622,14 +604,14 @@ function It(s) {
622
604
  }), i;
623
605
  };
624
606
  }
625
- function Ft(s) {
607
+ function Pt(s) {
626
608
  return (e) => {
627
609
  const t = s.editorParams, i = document.createElement("select");
628
610
  if (s.multi && (i.multiple = !0), t?.includeEmpty) {
629
611
  const o = document.createElement("option");
630
612
  o.value = "", o.textContent = t.emptyLabel ?? "", i.appendChild(o);
631
613
  }
632
- _t(s).forEach((o) => {
614
+ Tt(s).forEach((o) => {
633
615
  const a = document.createElement("option");
634
616
  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);
635
617
  });
@@ -645,13 +627,13 @@ function Ft(s) {
645
627
  }), i;
646
628
  };
647
629
  }
648
- function Pt(s) {
630
+ function Mt(s) {
649
631
  return (e) => {
650
632
  const t = s.editorParams, i = document.createElement("input");
651
633
  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);
652
634
  const n = () => {
653
635
  const r = i.value;
654
- typeof e.value == "number" && r !== "" ? e.commit(Number(r)) : e.commit(r);
636
+ (e.value === null || e.value === void 0) && r === "" || typeof e.value == "string" && r === e.value.replace(/[\n\r]/g, "") || (typeof e.value == "number" && r !== "" ? e.commit(Number(r)) : e.commit(r));
655
637
  };
656
638
  return i.addEventListener("blur", n), i.addEventListener("keydown", (r) => {
657
639
  r.key === "Enter" && n(), r.key === "Escape" && e.cancel();
@@ -661,18 +643,18 @@ function Pt(s) {
661
643
  function Dt(s) {
662
644
  switch (s.type) {
663
645
  case "number":
664
- return Tt(s);
646
+ return Lt(s);
665
647
  case "boolean":
666
- return Lt();
648
+ return It();
667
649
  case "date":
668
- return It(s);
669
- case "select":
670
650
  return Ft(s);
671
- default:
651
+ case "select":
672
652
  return Pt(s);
653
+ default:
654
+ return Mt(s);
673
655
  }
674
656
  }
675
- function Mt(s, e) {
657
+ function Nt(s, e) {
676
658
  if (e.editor) return e.editor;
677
659
  if (e.__editorTemplate) return "template";
678
660
  if (!e.type) return;
@@ -689,25 +671,25 @@ function Mt(s, e) {
689
671
  function U(s) {
690
672
  return !(typeof s != "string" || s === "__proto__" || s === "constructor" || s === "prototype");
691
673
  }
692
- function Nt(s) {
674
+ function qt(s) {
693
675
  const e = (s.__editingCellCount ?? 0) + 1;
694
676
  s.__editingCellCount = e, s.setAttribute("data-has-editing", "");
695
677
  }
696
- function qt(s) {
678
+ function Ht(s) {
697
679
  s.__editingCellCount = 0, s.removeAttribute("data-has-editing");
698
680
  }
699
681
  function W(s, e, t) {
700
- return s instanceof HTMLInputElement ? s.type === "checkbox" ? s.checked : s.type === "number" ? s.value === "" ? null : Number(s.value) : s.type === "date" ? typeof t == "string" ? s.value : s.valueAsDate : typeof t == "number" ? s.value === "" ? null : Number(s.value) : t == null && s.value === "" ? t : s.value : e?.type === "number" && s.value !== "" || typeof t == "number" && s.value !== "" ? Number(s.value) : t == null && s.value === "" ? t : s.value;
682
+ return s instanceof HTMLInputElement ? s.type === "checkbox" ? s.checked : s.type === "number" ? s.value === "" ? null : Number(s.value) : s.type === "date" ? typeof t == "string" ? s.value : s.valueAsDate : typeof t == "number" ? s.value === "" ? null : Number(s.value) : t == null && s.value === "" || typeof t == "string" && s.value === t.replace(/[\n\r]/g, "") ? t : s.value : e?.type === "number" && s.value !== "" || typeof t == "number" && s.value !== "" ? Number(s.value) : t == null && s.value === "" ? t : s.value;
701
683
  }
702
- function _e(s) {
684
+ function Le(s) {
703
685
  }
704
- function Ht(s, e, t, i) {
686
+ function Kt(s, e, t, i) {
705
687
  const n = s.querySelector("input,textarea,select");
706
688
  n && (n.addEventListener("blur", () => {
707
689
  t(W(n, e, i));
708
690
  }), n instanceof HTMLInputElement && n.type === "checkbox" ? n.addEventListener("change", () => t(n.checked)) : n instanceof HTMLSelectElement && n.addEventListener("change", () => t(W(n, e, i))));
709
691
  }
710
- class wn extends _ {
692
+ class Sn extends _ {
711
693
  static manifest = {
712
694
  ownedProperties: [
713
695
  {
@@ -741,7 +723,7 @@ class wn extends _ {
741
723
  ]
742
724
  };
743
725
  name = "editing";
744
- styles = At;
726
+ styles = _t;
745
727
  get defaultConfig() {
746
728
  return {
747
729
  mode: "row",
@@ -752,15 +734,16 @@ class wn extends _ {
752
734
  return this.config.mode === "grid";
753
735
  }
754
736
  #e = -1;
755
- #s = -1;
756
- #o = /* @__PURE__ */ new Map();
737
+ #o = -1;
738
+ #r = /* @__PURE__ */ new Map();
757
739
  #i = /* @__PURE__ */ new Set();
758
740
  #n = /* @__PURE__ */ new Set();
759
- #u = !1;
760
- #l = -1;
761
- #r = /* @__PURE__ */ new Map();
762
- #d = !1;
763
- #f = !1;
741
+ #l = /* @__PURE__ */ new Map();
742
+ #c = !1;
743
+ #f = -1;
744
+ #s = /* @__PURE__ */ new Map();
745
+ #a = !1;
746
+ #p = !1;
764
747
  attach(e) {
765
748
  super.attach(e);
766
749
  const t = this.disconnectSignal, i = e;
@@ -778,7 +761,7 @@ class wn extends _ {
778
761
  if (!this.#t && n.key === "Escape" && this.#e !== -1) {
779
762
  if (this.config.onBeforeEditClose && this.config.onBeforeEditClose(n) === !1)
780
763
  return;
781
- this.#a(this.#e, !0);
764
+ this.#d(this.#e, !0);
782
765
  }
783
766
  },
784
767
  { capture: !0, signal: t }
@@ -788,20 +771,29 @@ class wn extends _ {
788
771
  if (this.#t || this.#e === -1) return;
789
772
  const r = i.findRenderedRowElement?.(this.#e);
790
773
  !r || (n.composedPath && n.composedPath() || []).includes(r) || this.config.onBeforeEditClose && this.config.onBeforeEditClose(n) === !1 || queueMicrotask(() => {
791
- this.#e !== -1 && this.#a(this.#e, !1);
774
+ this.#e !== -1 && this.#d(this.#e, !1);
792
775
  });
793
776
  },
794
777
  { signal: t }
778
+ ), this.gridElement.addEventListener(
779
+ "cell-change",
780
+ (n) => {
781
+ const r = n.detail;
782
+ if (r.source === "user") return;
783
+ const o = `${r.rowIndex}:${r.field}`, a = this.#l.get(o);
784
+ a && a(r.newValue);
785
+ },
786
+ { signal: t }
795
787
  ), this.#t && (this.gridElement.classList.add("tbw-grid-mode"), this.requestRender(), this.gridElement.addEventListener(
796
788
  "focusin",
797
789
  (n) => {
798
790
  const r = n.target;
799
- if (r.matches(M)) {
800
- if (this.#f) {
791
+ if (r.matches(D)) {
792
+ if (this.#p) {
801
793
  r.blur(), this.gridElement.focus();
802
794
  return;
803
795
  }
804
- this.#d = !0;
796
+ this.#a = !0;
805
797
  }
806
798
  },
807
799
  { signal: t }
@@ -809,28 +801,28 @@ class wn extends _ {
809
801
  "focusout",
810
802
  (n) => {
811
803
  const r = n.relatedTarget;
812
- (!r || !this.gridElement.contains(r) || !r.matches(M)) && (this.#d = !1);
804
+ (!r || !this.gridElement.contains(r) || !r.matches(D)) && (this.#a = !1);
813
805
  },
814
806
  { signal: t }
815
807
  ), this.gridElement.addEventListener(
816
808
  "keydown",
817
809
  (n) => {
818
- if (n.key === "Escape" && this.#d) {
810
+ if (n.key === "Escape" && this.#a) {
819
811
  const r = document.activeElement;
820
- r && this.gridElement.contains(r) && (r.blur(), this.gridElement.focus()), this.#d = !1, this.#f = !0, n.preventDefault(), n.stopPropagation();
812
+ r && this.gridElement.contains(r) && (r.blur(), this.gridElement.focus()), this.#a = !1, this.#p = !0, n.preventDefault(), n.stopPropagation();
821
813
  }
822
814
  },
823
815
  { capture: !0, signal: t }
824
816
  ), this.gridElement.addEventListener(
825
817
  "mousedown",
826
818
  (n) => {
827
- n.target.matches(M) && (this.#f = !1);
819
+ n.target.matches(D) && (this.#p = !1);
828
820
  },
829
821
  { signal: t }
830
822
  ));
831
823
  }
832
824
  detach() {
833
- this.gridElement.classList.remove("tbw-grid-mode"), this.#e = -1, this.#s = -1, this.#o.clear(), this.#i.clear(), this.#n.clear(), this.#d = !1, this.#f = !1, super.detach();
825
+ this.gridElement.classList.remove("tbw-grid-mode"), this.#e = -1, this.#o = -1, this.#r.clear(), this.#i.clear(), this.#n.clear(), this.#l.clear(), this.#a = !1, this.#p = !1, super.detach();
834
826
  }
835
827
  handleQuery(e) {
836
828
  if (e.type === "isEditing")
@@ -848,25 +840,25 @@ class wn extends _ {
848
840
  onKeyDown(e) {
849
841
  const t = this.grid;
850
842
  if (e.key === "Escape") {
851
- if (this.#t && this.#d) {
843
+ if (this.#t && this.#a) {
852
844
  const i = document.activeElement;
853
- return i && this.gridElement.contains(i) && i.blur(), this.#d = !1, this.requestAfterRender(), !0;
845
+ return i && this.gridElement.contains(i) && i.blur(), this.#a = !1, this.requestAfterRender(), !0;
854
846
  }
855
847
  if (this.#e !== -1 && !this.#t)
856
- return this.config.onBeforeEditClose && this.config.onBeforeEditClose(e) === !1 || this.#a(this.#e, !0), !0;
848
+ return this.config.onBeforeEditClose && this.config.onBeforeEditClose(e) === !1 || this.#d(this.#e, !0), !0;
857
849
  }
858
- if (this.#t && !this.#d && (e.key === "ArrowUp" || e.key === "ArrowDown" || e.key === "ArrowLeft" || e.key === "ArrowRight"))
850
+ if (this.#t && !this.#a && (e.key === "ArrowUp" || e.key === "ArrowDown" || e.key === "ArrowLeft" || e.key === "ArrowRight"))
859
851
  return !1;
860
852
  if ((e.key === "ArrowUp" || e.key === "ArrowDown") && this.#e !== -1 && !this.#t) {
861
853
  if (this.config.onBeforeEditClose && this.config.onBeforeEditClose(e) === !1)
862
854
  return !0;
863
855
  const i = t._rows.length - 1, n = this.#e;
864
- return this.#a(n, !1), e.key === "ArrowDown" ? t._focusRow = Math.min(i, t._focusRow + 1) : t._focusRow = Math.max(0, t._focusRow - 1), e.preventDefault(), F(t), this.requestAfterRender(), !0;
856
+ return this.#d(n, !1), e.key === "ArrowDown" ? t._focusRow = Math.min(i, t._focusRow + 1) : t._focusRow = Math.max(0, t._focusRow - 1), e.preventDefault(), M(t), this.requestAfterRender(), !0;
865
857
  }
866
858
  if (e.key === "Tab" && (this.#e !== -1 || this.#t)) {
867
859
  e.preventDefault();
868
860
  const i = !e.shiftKey;
869
- return this.#w(i), !0;
861
+ return this.#g(i), !0;
870
862
  }
871
863
  if (e.key === " " || e.key === "Spacebar") {
872
864
  if (this.#e !== -1)
@@ -878,15 +870,15 @@ class wn extends _ {
878
870
  const a = r.field;
879
871
  if (U(a)) {
880
872
  const d = !o[a];
881
- return this.#b(i, r, d, o), e.preventDefault(), this.requestRender(), !0;
873
+ return this.#v(i, r, d, o), e.preventDefault(), this.requestRender(), !0;
882
874
  }
883
875
  }
884
876
  }
885
877
  return !1;
886
878
  }
887
879
  if (e.key === "Enter" && !e.shiftKey) {
888
- if (this.#t && !this.#d)
889
- return this.#h(), !0;
880
+ if (this.#t && !this.#a)
881
+ return this.#b(), !0;
890
882
  if (this.#e !== -1)
891
883
  return !!(this.config.onBeforeEditClose && this.config.onBeforeEditClose(e) === !1);
892
884
  const i = this.config.editOn ?? t.effectiveConfig?.editOn;
@@ -936,9 +928,9 @@ class wn extends _ {
936
928
  }
937
929
  afterRender() {
938
930
  const e = this.grid;
939
- if (this.#u && (this.#u = !1, this.#x(e)), this.#l !== -1) {
940
- const t = this.#l;
941
- this.#l = -1, e.animateRow?.(t, "change");
931
+ if (this.#c && (this.#c = !1, this.#x(e)), this.#f !== -1) {
932
+ const t = this.#f;
933
+ this.#f = -1, e.animateRow?.(t, "change");
942
934
  }
943
935
  if (!this.#t && this.#n.size !== 0)
944
936
  for (const t of this.#n) {
@@ -947,13 +939,13 @@ class wn extends _ {
947
939
  const l = a.querySelector(`.cell[data-col="${o}"]`);
948
940
  if (!l || l.classList.contains("editing")) continue;
949
941
  const d = e._rows[r], c = e._visibleColumns[o];
950
- d && c && this.#m(d, r, c, o, l, !0);
942
+ d && c && this.#w(d, r, c, o, l, !0);
951
943
  }
952
944
  }
953
945
  afterCellRender(e) {
954
946
  if (!this.#t) return;
955
947
  const { row: t, rowIndex: i, column: n, colIndex: r, cellElement: o } = e;
956
- n.editable && (o.classList.contains("editing") || this.#m(t, i, n, r, o, !0));
948
+ n.editable && (o.classList.contains("editing") || this.#w(t, i, n, r, o, !0));
957
949
  }
958
950
  onScrollRender() {
959
951
  this.afterRender();
@@ -973,7 +965,7 @@ class wn extends _ {
973
965
  return this.#e;
974
966
  }
975
967
  get activeEditCol() {
976
- return this.#s;
968
+ return this.#o;
977
969
  }
978
970
  isRowEditing(e) {
979
971
  return this.#e === e;
@@ -995,40 +987,40 @@ class wn extends _ {
995
987
  return this.#i.has(e);
996
988
  }
997
989
  setInvalid(e, t, i = "") {
998
- let n = this.#r.get(e);
999
- n || (n = /* @__PURE__ */ new Map(), this.#r.set(e, n)), n.set(t, i), this.#p(e, t, !0);
990
+ let n = this.#s.get(e);
991
+ n || (n = /* @__PURE__ */ new Map(), this.#s.set(e, n)), n.set(t, i), this.#m(e, t, !0);
1000
992
  }
1001
993
  clearInvalid(e, t) {
1002
- const i = this.#r.get(e);
1003
- i && (i.delete(t), i.size === 0 && this.#r.delete(e)), this.#p(e, t, !1);
994
+ const i = this.#s.get(e);
995
+ i && (i.delete(t), i.size === 0 && this.#s.delete(e)), this.#m(e, t, !1);
1004
996
  }
1005
997
  clearRowInvalid(e) {
1006
- const t = this.#r.get(e);
998
+ const t = this.#s.get(e);
1007
999
  if (t) {
1008
1000
  const i = Array.from(t.keys());
1009
- this.#r.delete(e), i.forEach((n) => this.#p(e, n, !1));
1001
+ this.#s.delete(e), i.forEach((n) => this.#m(e, n, !1));
1010
1002
  }
1011
1003
  }
1012
1004
  clearAllInvalid() {
1013
- const e = Array.from(this.#r.entries());
1014
- this.#r.clear(), e.forEach(([t, i]) => {
1015
- i.forEach((n, r) => this.#p(t, r, !1));
1005
+ const e = Array.from(this.#s.entries());
1006
+ this.#s.clear(), e.forEach(([t, i]) => {
1007
+ i.forEach((n, r) => this.#m(t, r, !1));
1016
1008
  });
1017
1009
  }
1018
1010
  isCellInvalid(e, t) {
1019
- return this.#r.get(e)?.has(t) ?? !1;
1011
+ return this.#s.get(e)?.has(t) ?? !1;
1020
1012
  }
1021
1013
  getInvalidMessage(e, t) {
1022
- return this.#r.get(e)?.get(t);
1014
+ return this.#s.get(e)?.get(t);
1023
1015
  }
1024
1016
  hasInvalidCells(e) {
1025
- const t = this.#r.get(e);
1017
+ const t = this.#s.get(e);
1026
1018
  return t ? t.size > 0 : !1;
1027
1019
  }
1028
1020
  getInvalidFields(e) {
1029
- return new Map(this.#r.get(e) ?? []);
1021
+ return new Map(this.#s.get(e) ?? []);
1030
1022
  }
1031
- #p(e, t, i) {
1023
+ #m(e, t, i) {
1032
1024
  const n = this.grid, r = n._visibleColumns?.findIndex((c) => c.field === t);
1033
1025
  if (r === -1 || r === void 0) return;
1034
1026
  const a = n._rows?.findIndex((c) => {
@@ -1043,20 +1035,20 @@ class wn extends _ {
1043
1035
  if (d)
1044
1036
  if (i) {
1045
1037
  d.setAttribute("data-invalid", "true");
1046
- const c = this.#r.get(e)?.get(t);
1038
+ const c = this.#s.get(e)?.get(t);
1047
1039
  c && d.setAttribute("title", c);
1048
1040
  } else
1049
1041
  d.removeAttribute("data-invalid"), d.removeAttribute("title");
1050
1042
  }
1051
1043
  resetChangedRows(e) {
1052
1044
  const t = this.changedRows, i = this.changedRowIds;
1053
- this.#i.clear(), this.#c(), e || this.emit("changed-rows-reset", { rows: t, ids: i }), this.grid._rowPool?.forEach((r) => r.classList.remove("changed"));
1045
+ this.#i.clear(), this.#u(), e || this.emit("changed-rows-reset", { rows: t, ids: i }), this.grid._rowPool?.forEach((r) => r.classList.remove("changed"));
1054
1046
  }
1055
1047
  beginCellEdit(e, t) {
1056
1048
  const i = this.grid, n = i._visibleColumns.findIndex((l) => l.field === t);
1057
1049
  if (n === -1 || !i._visibleColumns[n]?.editable) return;
1058
1050
  const a = i.findRenderedRowElement?.(e)?.querySelector(`.cell[data-col="${n}"]`);
1059
- a && this.#v(e, n, a);
1051
+ a && this.#h(e, n, a);
1060
1052
  }
1061
1053
  beginBulkEdit(e) {
1062
1054
  const t = this.grid;
@@ -1064,16 +1056,16 @@ class wn extends _ {
1064
1056
  const r = t.findRenderedRowElement?.(e);
1065
1057
  if (!r) return;
1066
1058
  const o = t._rows[e];
1067
- this.#g(e, o), Array.from(r.children).forEach((a, l) => {
1059
+ this.#y(e, o), Array.from(r.children).forEach((a, l) => {
1068
1060
  const d = t._visibleColumns[l];
1069
1061
  if (d?.editable) {
1070
1062
  const c = a;
1071
- c.classList.contains("editing") || this.#m(o, e, d, l, c, !0);
1063
+ c.classList.contains("editing") || this.#w(o, e, d, l, c, !0);
1072
1064
  }
1073
1065
  }), setTimeout(() => {
1074
1066
  let a = r.querySelector(`.cell[data-col="${t._focusCol}"]`);
1075
1067
  if (a?.classList.contains("editing") || (a = r.querySelector(".cell.editing")), a?.classList.contains("editing")) {
1076
- const l = a.querySelector(M);
1068
+ const l = a.querySelector(D);
1077
1069
  try {
1078
1070
  l?.focus({ preventScroll: !0 });
1079
1071
  } catch {
@@ -1082,50 +1074,62 @@ class wn extends _ {
1082
1074
  }, 0);
1083
1075
  }
1084
1076
  commitActiveRowEdit() {
1085
- this.#e !== -1 && this.#a(this.#e, !1);
1077
+ this.#e !== -1 && this.#d(this.#e, !1);
1086
1078
  }
1087
1079
  cancelActiveRowEdit() {
1088
- this.#e !== -1 && this.#a(this.#e, !0);
1080
+ this.#e !== -1 && this.#d(this.#e, !0);
1089
1081
  }
1090
- #v(e, t, i) {
1082
+ #h(e, t, i) {
1091
1083
  const n = this.grid, r = n._rows[e], o = n._visibleColumns[t];
1092
- !r || !o?.editable || i.classList.contains("editing") || (this.#e !== e && this.#g(e, r), this.#s = t, this.#m(r, e, o, t, i, !1));
1084
+ !r || !o?.editable || i.classList.contains("editing") || (this.#e !== e && this.#y(e, r), this.#o = t, this.#w(r, e, o, t, i, !1));
1093
1085
  }
1094
- #h() {
1086
+ #b() {
1095
1087
  const e = this.grid, t = e._focusRow, i = e._focusCol;
1096
1088
  if (t < 0 || i < 0) return;
1097
1089
  const r = e.findRenderedRowElement?.(t)?.querySelector(`.cell[data-col="${i}"]`);
1098
1090
  if (r?.classList.contains("editing")) {
1099
- const o = r.querySelector(M);
1100
- o && (this.#f = !1, o.focus(), this.#d = !0, o instanceof HTMLInputElement && (o.type === "text" || o.type === "number") && o.select());
1091
+ const o = r.querySelector(D);
1092
+ o && (this.#p = !1, o.focus(), this.#a = !0, o instanceof HTMLInputElement && (o.type === "text" || o.type === "number") && o.select());
1101
1093
  }
1102
1094
  }
1103
- #w(e) {
1095
+ #g(e) {
1104
1096
  const t = this.grid, i = t._rows, n = this.#t ? t._focusRow : this.#e, r = t._visibleColumns.map((d, c) => d.editable ? c : -1).filter((d) => d >= 0);
1105
1097
  if (r.length === 0) return;
1106
1098
  const a = r.indexOf(t._focusCol) + (e ? 1 : -1);
1107
1099
  if (a >= 0 && a < r.length) {
1108
1100
  t._focusCol = r[a];
1109
1101
  const c = t.findRenderedRowElement?.(n)?.querySelector(`.cell[data-col="${r[a]}"]`);
1110
- c?.classList.contains("editing") && c.querySelector(M)?.focus({ preventScroll: !0 }), F(t, { forceHorizontalScroll: !0 });
1102
+ c?.classList.contains("editing") && c.querySelector(D)?.focus({ preventScroll: !0 }), M(t, { forceHorizontalScroll: !0 });
1111
1103
  return;
1112
1104
  }
1113
1105
  const l = n + (e ? 1 : -1);
1114
- l >= 0 && l < i.length && (this.#t ? (t._focusRow = l, t._focusCol = e ? r[0] : r[r.length - 1], F(t, { forceHorizontalScroll: !0 }), this.requestAfterRender(), setTimeout(() => {
1106
+ l >= 0 && l < i.length && (this.#t ? (t._focusRow = l, t._focusCol = e ? r[0] : r[r.length - 1], M(t, { forceHorizontalScroll: !0 }), this.requestAfterRender(), setTimeout(() => {
1115
1107
  const c = t.findRenderedRowElement?.(l)?.querySelector(`.cell[data-col="${t._focusCol}"]`);
1116
- c?.classList.contains("editing") && c.querySelector(M)?.focus({ preventScroll: !0 });
1117
- }, 0)) : (this.#a(n, !1), t._focusRow = l, t._focusCol = e ? r[0] : r[r.length - 1], this.beginBulkEdit(l), F(t, { forceHorizontalScroll: !0 })));
1108
+ c?.classList.contains("editing") && c.querySelector(D)?.focus({ preventScroll: !0 });
1109
+ }, 0)) : (this.#d(n, !1), t._focusRow = l, t._focusCol = e ? r[0] : r[r.length - 1], this.beginBulkEdit(l), M(t, { forceHorizontalScroll: !0 })));
1118
1110
  }
1119
- #c() {
1111
+ #u() {
1120
1112
  const e = this.grid;
1121
- e._activeEditRows = this.#e, e._rowEditSnapshots = this.#o;
1113
+ e._activeEditRows = this.#e, e._rowEditSnapshots = this.#r;
1122
1114
  }
1123
- #g(e, t) {
1124
- this.#e !== e && (this.#o.set(e, { ...t }), this.#e = e, this.#c());
1115
+ #y(e, t) {
1116
+ if (this.#e !== e && (this.#r.set(e, { ...t }), this.#e = e, this.#u(), !this.#t)) {
1117
+ const i = this.grid;
1118
+ let n = "";
1119
+ try {
1120
+ n = i.getRowId?.(t) ?? "";
1121
+ } catch {
1122
+ }
1123
+ this.emit("edit-open", {
1124
+ rowIndex: e,
1125
+ rowId: n,
1126
+ row: t
1127
+ });
1128
+ }
1125
1129
  }
1126
- #a(e, t) {
1130
+ #d(e, t) {
1127
1131
  if (this.#e !== e) return;
1128
- const i = this.grid, n = this.#o.get(e), r = i._rows[e], o = i.findRenderedRowElement?.(e);
1132
+ const i = this.grid, n = this.#r.get(e), r = i._rows[e], o = i.findRenderedRowElement?.(e);
1129
1133
  let a;
1130
1134
  if (r)
1131
1135
  try {
@@ -1141,14 +1145,14 @@ class wn extends _ {
1141
1145
  const h = d.querySelector("input,textarea,select");
1142
1146
  if (h) {
1143
1147
  const f = u.field, g = r[f], p = W(h, u, g);
1144
- g !== p && this.#b(e, u, p, r);
1148
+ g !== p && this.#v(e, u, p, r);
1145
1149
  }
1146
1150
  }), t && n && r)
1147
1151
  Object.keys(n).forEach((l) => {
1148
1152
  r[l] = n[l];
1149
1153
  }), a && (this.#i.delete(a), this.clearRowInvalid(a));
1150
1154
  else if (!t && r) {
1151
- const l = this.#C(n, r), d = a ? this.#i.has(a) : l, c = this.emitCancelable("row-commit", {
1155
+ const l = this.#E(n, r), d = a ? this.#i.has(a) : l, c = this.emitCancelable("row-commit", {
1152
1156
  rowIndex: e,
1153
1157
  rowId: a ?? "",
1154
1158
  row: r,
@@ -1160,16 +1164,23 @@ class wn extends _ {
1160
1164
  });
1161
1165
  c && n ? (Object.keys(n).forEach((u) => {
1162
1166
  r[u] = n[u];
1163
- }), a && (this.#i.delete(a), this.clearRowInvalid(a))) : !c && l && this.isAnimationEnabled && (this.#l = e);
1167
+ }), a && (this.#i.delete(a), this.clearRowInvalid(a))) : !c && l && this.isAnimationEnabled && (this.#f = e);
1164
1168
  }
1165
- this.#o.delete(e), this.#e = -1, this.#s = -1, this.#c();
1169
+ this.#r.delete(e), this.#e = -1, this.#o = -1, this.#u();
1166
1170
  for (const l of this.#n)
1167
1171
  l.startsWith(`${e}:`) && this.#n.delete(l);
1172
+ for (const l of this.#l.keys())
1173
+ l.startsWith(`${e}:`) && this.#l.delete(l);
1168
1174
  o && (o.querySelectorAll(".cell.editing").forEach((l) => {
1169
- l.classList.remove("editing"), qt(l.parentElement);
1170
- }), this.requestRender()), this.#u = !0, o || (this.#x(i), this.#u = !1);
1175
+ l.classList.remove("editing"), Ht(l.parentElement);
1176
+ }), this.requestRender()), this.#c = !0, o || (this.#x(i), this.#c = !1), !this.#t && r && this.emit("edit-close", {
1177
+ rowIndex: e,
1178
+ rowId: a ?? "",
1179
+ row: r,
1180
+ reverted: t
1181
+ });
1171
1182
  }
1172
- #b(e, t, i, n) {
1183
+ #v(e, t, i, n) {
1173
1184
  const r = t.field;
1174
1185
  if (!U(r)) return;
1175
1186
  const o = n[r];
@@ -1180,7 +1191,7 @@ class wn extends _ {
1180
1191
  l = this.grid.getRowId(n);
1181
1192
  } catch {
1182
1193
  }
1183
- const d = l ? !this.#i.has(l) : !0, c = l ? (p) => this.grid.updateRow(l, p, "cascade") : _e;
1194
+ const d = l ? !this.#i.has(l) : !0, c = l ? (p) => this.grid.updateRow(l, p, "cascade") : Le;
1184
1195
  let u = !1;
1185
1196
  const h = l ? (p) => {
1186
1197
  u = !0, this.setInvalid(l, r, p ?? "");
@@ -1199,7 +1210,7 @@ class wn extends _ {
1199
1210
  updateRow: c,
1200
1211
  setInvalid: h
1201
1212
  })) return;
1202
- l && !u && this.isCellInvalid(l, r) && this.clearInvalid(l, r), n[r] = i, l && this.#i.add(l), this.#c(), this.emitPluginEvent("cell-edit-committed", {
1213
+ l && !u && this.isCellInvalid(l, r) && this.clearInvalid(l, r), n[r] = i, l && this.#i.add(l), this.#u(), this.emitPluginEvent("cell-edit-committed", {
1203
1214
  rowIndex: e,
1204
1215
  field: r,
1205
1216
  oldValue: o,
@@ -1208,93 +1219,115 @@ class wn extends _ {
1208
1219
  const g = a.findRenderedRowElement?.(e);
1209
1220
  g && g.classList.add("changed");
1210
1221
  }
1211
- #m(e, t, i, n, r, o) {
1222
+ #w(e, t, i, n, r, o) {
1212
1223
  if (!i.editable || r.classList.contains("editing")) return;
1213
1224
  let a;
1214
1225
  try {
1215
1226
  a = this.grid.getRowId(e);
1216
1227
  } catch {
1217
1228
  }
1218
- const l = a ? (v) => this.grid.updateRow(a, v, "cascade") : _e, d = U(i.field) ? e[i.field] : void 0;
1229
+ const l = a ? (b) => this.grid.updateRow(a, b, "cascade") : Le, d = U(i.field) ? e[i.field] : void 0;
1219
1230
  r.classList.add("editing"), this.#n.add(`${t}:${n}`);
1220
1231
  const c = r.parentElement;
1221
- c && Nt(c);
1232
+ c && qt(c);
1222
1233
  let u = !1;
1223
- const h = (v) => {
1224
- u || !this.#t && this.#e === -1 || this.#b(t, i, v, e);
1234
+ const h = (b) => {
1235
+ u || !this.#t && this.#e === -1 || this.#v(t, i, b, e);
1225
1236
  }, f = () => {
1226
1237
  u = !0, U(i.field) && (e[i.field] = d);
1227
1238
  }, g = document.createElement("div");
1228
- g.className = "tbw-editor-host", r.innerHTML = "", r.appendChild(g), g.addEventListener("keydown", (v) => {
1229
- if (v.key === "Enter") {
1239
+ g.className = "tbw-editor-host", r.innerHTML = "", r.appendChild(g), g.addEventListener("keydown", (b) => {
1240
+ if (b.key === "Enter") {
1230
1241
  if (this.#t) {
1231
- v.stopPropagation(), v.preventDefault();
1232
- const E = g.querySelector("input,textarea,select");
1233
- E && h(W(E, i, d));
1242
+ b.stopPropagation(), b.preventDefault();
1243
+ const v = g.querySelector("input,textarea,select");
1244
+ v && h(W(v, i, d));
1234
1245
  return;
1235
1246
  }
1236
- if (this.config.onBeforeEditClose && this.config.onBeforeEditClose(v) === !1)
1247
+ if (this.config.onBeforeEditClose && this.config.onBeforeEditClose(b) === !1)
1237
1248
  return;
1238
- v.stopPropagation(), v.preventDefault(), u = !0, this.#a(t, !1);
1249
+ b.stopPropagation(), b.preventDefault(), u = !0, this.#d(t, !1);
1239
1250
  }
1240
- if (v.key === "Escape") {
1251
+ if (b.key === "Escape") {
1241
1252
  if (this.#t) {
1242
- v.stopPropagation(), v.preventDefault();
1253
+ b.stopPropagation(), b.preventDefault();
1243
1254
  return;
1244
1255
  }
1245
- if (this.config.onBeforeEditClose && this.config.onBeforeEditClose(v) === !1)
1256
+ if (this.config.onBeforeEditClose && this.config.onBeforeEditClose(b) === !1)
1246
1257
  return;
1247
- v.stopPropagation(), v.preventDefault(), f(), this.#a(t, !0);
1258
+ b.stopPropagation(), b.preventDefault(), f(), this.#d(t, !0);
1248
1259
  }
1249
1260
  });
1250
- const p = i, w = p.__editorTemplate, b = Mt(this.grid, p) ?? Dt(i), y = d;
1251
- if (b === "template" && w)
1252
- this.#y(g, p, e, d, h, f, o, t);
1253
- else if (typeof b == "string") {
1254
- const v = document.createElement(b);
1255
- v.value = y, v.addEventListener("change", () => h(v.value)), g.appendChild(v), o || queueMicrotask(() => {
1256
- g.querySelector(M)?.focus({ preventScroll: !0 });
1261
+ const p = i, w = p.__editorTemplate, y = Nt(this.grid, p) ?? Dt(i), E = d, F = `${t}:${i.field}`, P = [];
1262
+ this.#l.set(F, (b) => {
1263
+ for (const v of P) v(b);
1264
+ });
1265
+ const S = (b) => {
1266
+ P.push(b);
1267
+ };
1268
+ if (y === "template" && w)
1269
+ this.#C(g, p, e, d, h, f, o, t), S((b) => {
1270
+ const v = g.querySelector(
1271
+ "input,textarea,select"
1272
+ );
1273
+ v && (v instanceof HTMLInputElement && v.type === "checkbox" ? v.checked = !!b : v.value = String(b ?? ""));
1257
1274
  });
1258
- } else if (typeof b == "function") {
1259
- const v = {
1275
+ else if (typeof y == "string") {
1276
+ const b = document.createElement(y);
1277
+ b.value = E, b.addEventListener("change", () => h(b.value)), S((v) => {
1278
+ b.value = v;
1279
+ }), g.appendChild(b), o || queueMicrotask(() => {
1280
+ g.querySelector(D)?.focus({ preventScroll: !0 });
1281
+ });
1282
+ } else if (typeof y == "function") {
1283
+ const b = {
1260
1284
  row: e,
1261
1285
  rowId: a ?? "",
1262
- value: y,
1286
+ value: E,
1263
1287
  field: i.field,
1264
1288
  column: i,
1265
1289
  commit: h,
1266
1290
  cancel: f,
1267
- updateRow: l
1268
- }, E = b(v);
1269
- typeof E == "string" ? (g.innerHTML = E, Ht(g, i, h, d)) : E instanceof Node && (g.appendChild(E), E instanceof HTMLInputElement || E instanceof HTMLSelectElement || E instanceof HTMLTextAreaElement || r.setAttribute("data-editor-managed", "")), o || queueMicrotask(() => {
1270
- g.querySelector(M)?.focus({ preventScroll: !0 });
1291
+ updateRow: l,
1292
+ onValueChange: S
1293
+ }, v = y(b);
1294
+ typeof v == "string" ? (g.innerHTML = v, Kt(g, i, h, d), S((T) => {
1295
+ const R = g.querySelector(
1296
+ "input,textarea,select"
1297
+ );
1298
+ R && (R instanceof HTMLInputElement && R.type === "checkbox" ? R.checked = !!T : R.value = String(T ?? ""));
1299
+ })) : v instanceof Node && (g.appendChild(v), v instanceof HTMLInputElement || v instanceof HTMLSelectElement || v instanceof HTMLTextAreaElement ? S((R) => {
1300
+ v instanceof HTMLInputElement && v.type === "checkbox" ? v.checked = !!R : v.value = String(R ?? "");
1301
+ }) : r.setAttribute("data-editor-managed", "")), o || queueMicrotask(() => {
1302
+ g.querySelector(D)?.focus({ preventScroll: !0 });
1271
1303
  });
1272
- } else if (b && typeof b == "object") {
1273
- const v = document.createElement("div");
1274
- v.setAttribute("data-external-editor", ""), v.setAttribute("data-field", i.field), g.appendChild(v), r.setAttribute("data-editor-managed", "");
1275
- const E = {
1304
+ } else if (y && typeof y == "object") {
1305
+ const b = document.createElement("div");
1306
+ b.setAttribute("data-external-editor", ""), b.setAttribute("data-field", i.field), g.appendChild(b), r.setAttribute("data-editor-managed", "");
1307
+ const v = {
1276
1308
  row: e,
1277
1309
  rowId: a ?? "",
1278
- value: y,
1310
+ value: E,
1279
1311
  field: i.field,
1280
1312
  column: i,
1281
1313
  commit: h,
1282
1314
  cancel: f,
1283
- updateRow: l
1315
+ updateRow: l,
1316
+ onValueChange: S
1284
1317
  };
1285
- if (b.mount)
1318
+ if (y.mount)
1286
1319
  try {
1287
- b.mount({ placeholder: v, context: E, spec: b });
1288
- } catch (R) {
1289
- console.warn(`[tbw-grid] External editor mount error for column '${i.field}':`, R);
1320
+ y.mount({ placeholder: b, context: v, spec: y });
1321
+ } catch (T) {
1322
+ console.warn(`[tbw-grid] External editor mount error for column '${i.field}':`, T);
1290
1323
  }
1291
1324
  else
1292
1325
  this.grid.dispatchEvent(
1293
- new CustomEvent("mount-external-editor", { detail: { placeholder: v, spec: b, context: E } })
1326
+ new CustomEvent("mount-external-editor", { detail: { placeholder: b, spec: y, context: v } })
1294
1327
  );
1295
1328
  }
1296
1329
  }
1297
- #y(e, t, i, n, r, o, a, l) {
1330
+ #C(e, t, i, n, r, o, a, l) {
1298
1331
  const d = t.__editorTemplate;
1299
1332
  if (!d) return;
1300
1333
  const c = d.cloneNode(!0), u = t.__compiledEditor;
@@ -1325,18 +1358,18 @@ class wn extends _ {
1325
1358
  if (p.key === "Enter") {
1326
1359
  if (this.config.onBeforeEditClose && this.config.onBeforeEditClose(p) === !1)
1327
1360
  return;
1328
- p.stopPropagation(), p.preventDefault(), f = !0, r(W(h, t, n)), this.#a(l, !1);
1361
+ p.stopPropagation(), p.preventDefault(), f = !0, r(W(h, t, n)), this.#d(l, !1);
1329
1362
  }
1330
1363
  if (p.key === "Escape") {
1331
1364
  if (this.config.onBeforeEditClose && this.config.onBeforeEditClose(p) === !1)
1332
1365
  return;
1333
- p.stopPropagation(), p.preventDefault(), o(), this.#a(l, !0);
1366
+ p.stopPropagation(), p.preventDefault(), o(), this.#d(l, !0);
1334
1367
  }
1335
1368
  }), h instanceof HTMLInputElement && h.type === "checkbox" && h.addEventListener("change", () => r(h.checked)), a || setTimeout(() => h.focus({ preventScroll: !0 }), 0);
1336
1369
  }
1337
1370
  e.appendChild(c);
1338
1371
  }
1339
- #C(e, t) {
1372
+ #E(e, t) {
1340
1373
  if (!e) return !1;
1341
1374
  const i = e, n = t, r = /* @__PURE__ */ new Set([...Object.keys(i), ...Object.keys(n)]);
1342
1375
  for (const o of r)
@@ -1360,7 +1393,7 @@ class wn extends _ {
1360
1393
  });
1361
1394
  }
1362
1395
  }
1363
- function Te(s, e = !0) {
1396
+ function Ie(s, e = !0) {
1364
1397
  if (s == null) return "";
1365
1398
  if (s instanceof Date) return s.toISOString();
1366
1399
  if (typeof s == "object") return JSON.stringify(s);
@@ -1368,37 +1401,37 @@ function Te(s, e = !0) {
1368
1401
  return e && (t.includes(",") || t.includes('"') || t.includes(`
1369
1402
  `) || t.includes("\r")) ? `"${t.replace(/"/g, '""')}"` : t;
1370
1403
  }
1371
- function Kt(s, e, t, i = {}) {
1404
+ function zt(s, e, t, i = {}) {
1372
1405
  const n = i.delimiter ?? ",", r = i.newline ?? `
1373
1406
  `, o = [], a = i.bom ? "\uFEFF" : "";
1374
1407
  if (t.includeHeaders !== !1) {
1375
1408
  const l = e.map((d) => {
1376
1409
  const c = d.header || d.field, u = t.processHeader ? t.processHeader(c, d.field) : c;
1377
- return Te(u);
1410
+ return Ie(u);
1378
1411
  });
1379
1412
  o.push(l.join(n));
1380
1413
  }
1381
1414
  for (const l of s) {
1382
1415
  const d = e.map((c) => {
1383
1416
  let u = l[c.field];
1384
- return t.processCell && (u = t.processCell(u, c.field, l)), Te(u);
1417
+ return t.processCell && (u = t.processCell(u, c.field, l)), Ie(u);
1385
1418
  });
1386
1419
  o.push(d.join(n));
1387
1420
  }
1388
1421
  return a + o.join(r);
1389
1422
  }
1390
- function we(s, e) {
1423
+ function be(s, e) {
1391
1424
  const t = URL.createObjectURL(s), i = document.createElement("a");
1392
1425
  i.href = t, i.download = e, i.style.display = "none", document.body.appendChild(i), i.click(), document.body.removeChild(i), URL.revokeObjectURL(t);
1393
1426
  }
1394
- function zt(s, e) {
1427
+ function Ot(s, e) {
1395
1428
  const t = new Blob([s], { type: "text/csv;charset=utf-8;" });
1396
- we(t, e);
1429
+ be(t, e);
1397
1430
  }
1398
- function Le(s) {
1431
+ function Fe(s) {
1399
1432
  return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
1400
1433
  }
1401
- function Ot(s, e, t) {
1434
+ function Gt(s, e, t) {
1402
1435
  let i = `<?xml version="1.0" encoding="UTF-8"?>
1403
1436
  <?mso-application progid="Excel.Sheet"?>
1404
1437
  <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
@@ -1410,7 +1443,7 @@ function Ot(s, e, t) {
1410
1443
  <Row>`;
1411
1444
  for (const n of e) {
1412
1445
  const r = n.header || n.field, o = t.processHeader ? t.processHeader(r, n.field) : r;
1413
- i += `<Cell><Data ss:Type="String">${Le(o)}</Data></Cell>`;
1446
+ i += `<Cell><Data ss:Type="String">${Fe(o)}</Data></Cell>`;
1414
1447
  }
1415
1448
  i += "</Row>";
1416
1449
  }
@@ -1421,7 +1454,7 @@ function Ot(s, e, t) {
1421
1454
  let o = n[r.field];
1422
1455
  t.processCell && (o = t.processCell(o, r.field, n));
1423
1456
  let a = "String", l = "";
1424
- 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>`;
1457
+ o == null ? l = "" : typeof o == "number" && !isNaN(o) ? (a = "Number", l = String(o)) : o instanceof Date ? (a = "DateTime", l = o.toISOString()) : l = Fe(String(o)), i += `<Cell><Data ss:Type="${a}">${l}</Data></Cell>`;
1425
1458
  }
1426
1459
  i += "</Row>";
1427
1460
  }
@@ -1430,13 +1463,13 @@ function Ot(s, e, t) {
1430
1463
  </Worksheet>
1431
1464
  </Workbook>`, i;
1432
1465
  }
1433
- function Gt(s, e) {
1466
+ function Bt(s, e) {
1434
1467
  const t = e.endsWith(".xls") ? e : `${e}.xls`, i = new Blob([s], {
1435
1468
  type: "application/vnd.ms-excel;charset=utf-8;"
1436
1469
  });
1437
- we(i, t);
1470
+ be(i, t);
1438
1471
  }
1439
- class bn extends _ {
1472
+ class kn extends _ {
1440
1473
  name = "export";
1441
1474
  get defaultConfig() {
1442
1475
  return {
@@ -1457,29 +1490,27 @@ class bn extends _ {
1457
1490
  processHeader: t?.processHeader,
1458
1491
  columns: t?.columns,
1459
1492
  rowIndices: t?.rowIndices
1460
- };
1461
- let r = [...this.columns];
1462
- if (i.onlyVisible && (r = r.filter((l) => !l.hidden && !l.field.startsWith("__"))), t?.columns) {
1463
- const l = new Set(t.columns);
1464
- r = r.filter((d) => l.has(d.field));
1465
- }
1466
- let o = [...this.rows];
1467
- if (i.onlySelected) {
1493
+ }, r = J(this.columns, t?.columns, i.onlyVisible);
1494
+ let o;
1495
+ if (t?.rowIndices)
1496
+ o = fe(this.rows, t.rowIndices);
1497
+ else if (i.onlySelected) {
1468
1498
  const l = this.getSelectionState();
1469
- l?.selected?.size && (o = [...l.selected].sort((c, u) => c - u).map((c) => this.rows[c]).filter(Boolean));
1470
- }
1471
- t?.rowIndices && (o = t.rowIndices.map((l) => this.rows[l]).filter(Boolean)), this.isExportingFlag = !0;
1499
+ l?.selected?.size ? o = fe(this.rows, [...l.selected]) : o = [...this.rows];
1500
+ } else
1501
+ o = [...this.rows];
1502
+ this.isExportingFlag = !0;
1472
1503
  let a = n.fileName;
1473
1504
  try {
1474
1505
  switch (e) {
1475
1506
  case "csv": {
1476
- const l = Kt(o, r, n, { bom: !0 });
1477
- a = a.endsWith(".csv") ? a : `${a}.csv`, zt(l, a);
1507
+ const l = zt(o, r, n, { bom: !0 });
1508
+ a = a.endsWith(".csv") ? a : `${a}.csv`, Ot(l, a);
1478
1509
  break;
1479
1510
  }
1480
1511
  case "excel": {
1481
- const l = Ot(o, r, n);
1482
- a = a.endsWith(".xls") ? a : `${a}.xls`, Gt(l, a);
1512
+ const l = Gt(o, r, n);
1513
+ a = a.endsWith(".xls") ? a : `${a}.xls`, Bt(l, a);
1483
1514
  break;
1484
1515
  }
1485
1516
  case "json": {
@@ -1493,7 +1524,7 @@ class bn extends _ {
1493
1524
  }), d = JSON.stringify(l, null, 2);
1494
1525
  a = a.endsWith(".json") ? a : `${a}.json`;
1495
1526
  const c = new Blob([d], { type: "application/json" });
1496
- we(c, a);
1527
+ be(c, a);
1497
1528
  break;
1498
1529
  }
1499
1530
  }
@@ -1530,7 +1561,34 @@ class bn extends _ {
1530
1561
  return this.lastExportInfo;
1531
1562
  }
1532
1563
  }
1533
- function Bt(s, e, t = !1) {
1564
+ const rt = "__tbw_expander", Vt = 32;
1565
+ function ie(s) {
1566
+ return s.field === rt;
1567
+ }
1568
+ function G(s) {
1569
+ return s.meta?.utility === !0;
1570
+ }
1571
+ function Wt(s) {
1572
+ return s.find(ie);
1573
+ }
1574
+ function $t(s) {
1575
+ return {
1576
+ field: rt,
1577
+ header: "",
1578
+ width: Vt,
1579
+ resizable: !1,
1580
+ sortable: !1,
1581
+ filterable: !1,
1582
+ meta: {
1583
+ lockPosition: !0,
1584
+ suppressMovable: !0,
1585
+ expanderColumn: !0,
1586
+ expanderPlugin: s,
1587
+ utility: !0
1588
+ }
1589
+ };
1590
+ }
1591
+ function jt(s, e, t = !1) {
1534
1592
  const i = s[e.field];
1535
1593
  if (e.operator === "blank")
1536
1594
  return i == null || i === "";
@@ -1569,10 +1627,10 @@ function Bt(s, e, t = !1) {
1569
1627
  return !0;
1570
1628
  }
1571
1629
  }
1572
- function Vt(s, e, t = !1) {
1573
- return e.length ? s.filter((i) => e.every((n) => Bt(i, n, t))) : s;
1630
+ function Ut(s, e, t = !1) {
1631
+ return e.length ? s.filter((i) => e.every((n) => jt(i, n, t))) : s;
1574
1632
  }
1575
- function Wt(s) {
1633
+ function Yt(s) {
1576
1634
  return JSON.stringify(
1577
1635
  s.map((e) => ({
1578
1636
  field: e.field,
@@ -1582,7 +1640,7 @@ function Wt(s) {
1582
1640
  }))
1583
1641
  );
1584
1642
  }
1585
- function Ie(s, e) {
1643
+ function Pe(s, e) {
1586
1644
  const t = /* @__PURE__ */ new Set();
1587
1645
  for (const i of s) {
1588
1646
  const n = i[e];
@@ -1590,7 +1648,7 @@ function Ie(s, e) {
1590
1648
  }
1591
1649
  return [...t].sort((i, n) => typeof i == "number" && typeof n == "number" ? i - n : String(i).localeCompare(String(n)));
1592
1650
  }
1593
- const $t = '@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}}}', jt = "@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-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)}}";
1651
+ const Xt = '@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}}}', Zt = "@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-actions .tbw-filter-value-item{flex:1}.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-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)}}";
1594
1652
  class q extends _ {
1595
1653
  static manifest = {
1596
1654
  events: [
@@ -1601,7 +1659,7 @@ class q extends _ {
1601
1659
  ]
1602
1660
  };
1603
1661
  name = "filtering";
1604
- styles = $t;
1662
+ styles = Xt;
1605
1663
  get defaultConfig() {
1606
1664
  return {
1607
1665
  debounceMs: 300,
@@ -1654,10 +1712,10 @@ class q extends _ {
1654
1712
  if (!t.length) return [...e];
1655
1713
  if (this.config.filterHandler)
1656
1714
  return this.cachedResult ? this.cachedResult : [...e];
1657
- const i = Wt(t);
1715
+ const i = Yt(t);
1658
1716
  if (this.cacheKey === i && this.cachedResult)
1659
1717
  return this.cachedResult;
1660
- const n = Vt([...e], t, this.config.caseSensitive);
1718
+ const n = Ut([...e], t, this.config.caseSensitive);
1661
1719
  return this.cachedResult = n, this.cacheKey = i, n;
1662
1720
  }
1663
1721
  afterRender() {
@@ -1667,7 +1725,7 @@ class q extends _ {
1667
1725
  const n = i.getAttribute("data-col");
1668
1726
  if (n === null) return;
1669
1727
  const r = this.visibleColumns[parseInt(n, 10)];
1670
- if (!r || !this.isColumnFilterable(r) || H(r)) return;
1728
+ if (!r || !this.isColumnFilterable(r) || G(r)) return;
1671
1729
  const o = r.field;
1672
1730
  if (!o) return;
1673
1731
  const a = this.filters.has(o);
@@ -1735,7 +1793,7 @@ class q extends _ {
1735
1793
  return this.getFilters();
1736
1794
  }
1737
1795
  getUniqueValues(e) {
1738
- return Ie(this.sourceRows, e);
1796
+ return Pe(this.sourceRows, e);
1739
1797
  }
1740
1798
  copyGridThemeContext(e) {
1741
1799
  const t = this.gridElement;
@@ -1752,7 +1810,7 @@ class q extends _ {
1752
1810
  return;
1753
1811
  }
1754
1812
  const e = document.createElement("style");
1755
- e.id = "tbw-filter-panel-styles", e.textContent = jt, document.head.appendChild(e), this.globalStylesInjected = !0;
1813
+ e.id = "tbw-filter-panel-styles", e.textContent = Zt, document.head.appendChild(e), this.globalStylesInjected = !0;
1756
1814
  }
1757
1815
  toggleFilterPanel(e, t, i) {
1758
1816
  if (this.openPanelField === e) {
@@ -1767,7 +1825,7 @@ class q extends _ {
1767
1825
  });
1768
1826
  return;
1769
1827
  }
1770
- const r = Ie(this.sourceRows, e);
1828
+ const r = Pe(this.sourceRows, e);
1771
1829
  document.body.appendChild(n), this.positionPanel(n, i), this.renderPanelContent(e, t, n, r), this.setupPanelCloseHandler(n, i);
1772
1830
  }
1773
1831
  renderPanelContent(e, t, i, n) {
@@ -1848,14 +1906,14 @@ class q extends _ {
1848
1906
  const h = document.createElement("span");
1849
1907
  h.textContent = "Select All", c.appendChild(u), c.appendChild(h), d.appendChild(c);
1850
1908
  const f = () => {
1851
- const C = [...b.values()], k = C.every((m) => m), T = C.every((m) => !m);
1852
- u.checked = k, u.indeterminate = !k && !T;
1909
+ const C = [...y.values()], k = C.every((m) => m), L = C.every((m) => !m);
1910
+ u.checked = k, u.indeterminate = !k && !L;
1853
1911
  };
1854
1912
  u.addEventListener("change", () => {
1855
1913
  const C = u.checked;
1856
- for (const k of b.keys())
1857
- b.set(k, C);
1858
- f(), E();
1914
+ for (const k of y.keys())
1915
+ y.set(k, C);
1916
+ f(), P();
1859
1917
  }), e.appendChild(d);
1860
1918
  const g = document.createElement("div");
1861
1919
  g.className = "tbw-filter-values";
@@ -1863,72 +1921,72 @@ class q extends _ {
1863
1921
  p.className = "tbw-filter-values-spacer", g.appendChild(p);
1864
1922
  const w = document.createElement("div");
1865
1923
  w.className = "tbw-filter-values-content", g.appendChild(w);
1866
- const b = /* @__PURE__ */ new Map();
1924
+ const y = /* @__PURE__ */ new Map();
1867
1925
  i.forEach((C) => {
1868
1926
  const k = C == null ? "__null__" : String(C);
1869
- b.set(k, !n.has(C));
1927
+ y.set(k, !n.has(C));
1870
1928
  }), f();
1871
- let y = [];
1872
- const v = (C, k) => {
1873
- const T = C == null ? "(Blank)" : String(C), m = C == null ? "__null__" : String(C), x = document.createElement("label");
1929
+ let E = [];
1930
+ const F = (C, k) => {
1931
+ const L = C == null ? "(Blank)" : String(C), m = C == null ? "__null__" : String(C), x = document.createElement("label");
1874
1932
  x.className = "tbw-filter-value-item", x.style.position = "absolute", x.style.top = `calc(var(--tbw-filter-item-height, 28px) * ${k})`, x.style.left = "0", x.style.right = "0", x.style.boxSizing = "border-box";
1875
- const L = document.createElement("input");
1876
- L.type = "checkbox", L.className = "tbw-filter-checkbox", L.checked = b.get(m) ?? !0, L.dataset.value = m, L.addEventListener("change", () => {
1877
- b.set(m, L.checked), f();
1933
+ const I = document.createElement("input");
1934
+ I.type = "checkbox", I.className = "tbw-filter-checkbox", I.checked = y.get(m) ?? !0, I.dataset.value = m, I.addEventListener("change", () => {
1935
+ y.set(m, I.checked), f();
1878
1936
  });
1879
- const K = document.createElement("span");
1880
- return K.textContent = T, x.appendChild(L), x.appendChild(K), x;
1881
- }, E = () => {
1882
- const C = y.length, k = g.clientHeight, T = g.scrollTop;
1883
- if (p.style.height = `${C * o}px`, ft(C, q.LIST_BYPASS_THRESHOLD / 3)) {
1884
- w.innerHTML = "", w.style.transform = "translateY(0px)", y.forEach((x, L) => {
1885
- w.appendChild(v(x, L));
1937
+ const H = document.createElement("span");
1938
+ return H.textContent = L, x.appendChild(I), x.appendChild(H), x;
1939
+ }, P = () => {
1940
+ const C = E.length, k = g.clientHeight, L = g.scrollTop;
1941
+ if (p.style.height = `${C * o}px`, mt(C, q.LIST_BYPASS_THRESHOLD / 3)) {
1942
+ w.innerHTML = "", w.style.transform = "translateY(0px)", E.forEach((x, I) => {
1943
+ w.appendChild(F(x, I));
1886
1944
  });
1887
1945
  return;
1888
1946
  }
1889
- const m = gt({
1947
+ const m = wt({
1890
1948
  totalRows: C,
1891
1949
  viewportHeight: k,
1892
- scrollTop: T,
1950
+ scrollTop: L,
1893
1951
  rowHeight: o,
1894
1952
  overscan: q.LIST_OVERSCAN
1895
1953
  });
1896
1954
  w.style.transform = `translateY(${m.offsetY}px)`, w.innerHTML = "";
1897
1955
  for (let x = m.start; x < m.end; x++)
1898
- w.appendChild(v(y[x], x - m.start));
1899
- }, R = (C) => {
1900
- const k = this.config.caseSensitive ?? !1, T = k ? C : C.toLowerCase();
1901
- if (y = i.filter((m) => {
1902
- const x = m == null ? "(Blank)" : String(m), L = k ? x : x.toLowerCase();
1903
- return !C || L.includes(T);
1904
- }), y.length === 0) {
1956
+ w.appendChild(F(E[x], x - m.start));
1957
+ }, S = (C) => {
1958
+ const k = this.config.caseSensitive ?? !1, L = k ? C : C.toLowerCase();
1959
+ if (E = i.filter((m) => {
1960
+ const x = m == null ? "(Blank)" : String(m), I = k ? x : x.toLowerCase();
1961
+ return !C || I.includes(L);
1962
+ }), E.length === 0) {
1905
1963
  p.style.height = "0px", w.innerHTML = "";
1906
1964
  const m = document.createElement("div");
1907
1965
  m.className = "tbw-filter-no-match", m.textContent = "No matching values", w.appendChild(m);
1908
1966
  return;
1909
1967
  }
1910
- E();
1968
+ P();
1911
1969
  };
1912
1970
  g.addEventListener(
1913
1971
  "scroll",
1914
1972
  () => {
1915
- y.length > 0 && E();
1973
+ E.length > 0 && P();
1916
1974
  },
1917
1975
  { passive: !0 }
1918
- ), R(l.value), e.appendChild(g);
1919
- let D;
1976
+ ), S(l.value), e.appendChild(g);
1977
+ let b;
1920
1978
  l.addEventListener("input", () => {
1921
- clearTimeout(D), D = setTimeout(() => {
1922
- this.searchText.set(r, l.value), R(l.value);
1979
+ clearTimeout(b), b = setTimeout(() => {
1980
+ this.searchText.set(r, l.value), S(l.value);
1923
1981
  }, this.config.debounceMs ?? 150);
1924
1982
  });
1925
- const I = document.createElement("div");
1926
- I.className = "tbw-filter-buttons";
1927
- const P = document.createElement("button");
1928
- P.className = "tbw-filter-apply-btn", P.textContent = "Apply", P.addEventListener("click", () => {
1983
+ const v = document.createElement("div");
1984
+ v.className = "tbw-filter-buttons";
1985
+ const T = document.createElement("button");
1986
+ T.className = "tbw-filter-apply-btn", T.textContent = "Apply", T.addEventListener("click", () => {
1929
1987
  const C = [];
1930
- for (const [k, T] of b)
1931
- if (!T)
1988
+ for (const [k, L] of y)
1989
+ if (!L)
1932
1990
  if (k === "__null__")
1933
1991
  C.push(null);
1934
1992
  else {
@@ -1936,109 +1994,109 @@ class q extends _ {
1936
1994
  C.push(m !== void 0 ? m : k);
1937
1995
  }
1938
1996
  t.applySetFilter(C);
1939
- }), I.appendChild(P);
1940
- const S = document.createElement("button");
1941
- S.className = "tbw-filter-clear-btn", S.textContent = "Clear Filter", S.addEventListener("click", () => {
1997
+ }), v.appendChild(T);
1998
+ const R = document.createElement("button");
1999
+ R.className = "tbw-filter-clear-btn", R.textContent = "Clear Filter", R.addEventListener("click", () => {
1942
2000
  t.clearFilter();
1943
- }), I.appendChild(S), e.appendChild(I);
2001
+ }), v.appendChild(R), e.appendChild(v);
1944
2002
  }
1945
2003
  renderNumberFilterPanel(e, t, i) {
1946
- const { field: n, column: r } = t, o = r.filterParams, a = r.editorParams, l = (A, z) => {
2004
+ const { field: n, column: r } = t, o = r.filterParams, a = r.editorParams, l = (A, K) => {
1947
2005
  if (typeof A == "number") return A;
1948
2006
  if (typeof A == "string") {
1949
2007
  const j = parseFloat(A);
1950
- return isNaN(j) ? z : j;
2008
+ return isNaN(j) ? K : j;
1951
2009
  }
1952
- return z;
2010
+ return K;
1953
2011
  }, d = i.filter((A) => typeof A == "number" && !isNaN(A)), c = d.length > 0 ? Math.min(...d) : 0, u = d.length > 0 ? Math.max(...d) : 100, h = l(o?.min ?? a?.min, c), f = l(o?.max ?? a?.max, u), g = o?.step ?? a?.step ?? 1, p = this.filters.get(n);
1954
- let w = h, b = f;
1955
- p?.operator === "between" ? (w = l(p.value, h), b = l(p.valueTo, f)) : p?.operator === "greaterThanOrEqual" ? w = l(p.value, h) : p?.operator === "lessThanOrEqual" && (b = l(p.value, f));
1956
- const y = document.createElement("div");
1957
- y.className = "tbw-filter-range-inputs";
2012
+ let w = h, y = f;
2013
+ p?.operator === "between" ? (w = l(p.value, h), y = l(p.valueTo, f)) : p?.operator === "greaterThanOrEqual" ? w = l(p.value, h) : p?.operator === "lessThanOrEqual" && (y = l(p.value, f));
2014
+ const E = document.createElement("div");
2015
+ E.className = "tbw-filter-range-inputs";
2016
+ const F = document.createElement("div");
2017
+ F.className = "tbw-filter-range-group";
2018
+ const P = document.createElement("label");
2019
+ P.textContent = "Min", P.className = "tbw-filter-range-label";
2020
+ const S = document.createElement("input");
2021
+ S.type = "number", S.className = "tbw-filter-range-input", S.min = String(h), S.max = String(f), S.step = String(g), S.value = String(w), F.appendChild(P), F.appendChild(S), E.appendChild(F);
2022
+ const b = document.createElement("span");
2023
+ b.className = "tbw-filter-range-separator", b.textContent = "–", E.appendChild(b);
1958
2024
  const v = document.createElement("div");
1959
2025
  v.className = "tbw-filter-range-group";
1960
- const E = document.createElement("label");
1961
- E.textContent = "Min", E.className = "tbw-filter-range-label";
2026
+ const T = document.createElement("label");
2027
+ T.textContent = "Max", T.className = "tbw-filter-range-label";
1962
2028
  const R = document.createElement("input");
1963
- R.type = "number", R.className = "tbw-filter-range-input", R.min = String(h), R.max = String(f), R.step = String(g), R.value = String(w), v.appendChild(E), v.appendChild(R), y.appendChild(v);
1964
- const D = document.createElement("span");
1965
- D.className = "tbw-filter-range-separator", D.textContent = "–", y.appendChild(D);
1966
- const I = document.createElement("div");
1967
- I.className = "tbw-filter-range-group";
1968
- const P = document.createElement("label");
1969
- P.textContent = "Max", P.className = "tbw-filter-range-label";
1970
- const S = document.createElement("input");
1971
- S.type = "number", S.className = "tbw-filter-range-input", S.min = String(h), S.max = String(f), S.step = String(g), S.value = String(b), I.appendChild(P), I.appendChild(S), y.appendChild(I), e.appendChild(y);
2029
+ R.type = "number", R.className = "tbw-filter-range-input", R.min = String(h), R.max = String(f), R.step = String(g), R.value = String(y), v.appendChild(T), v.appendChild(R), E.appendChild(v), e.appendChild(E);
1972
2030
  const C = document.createElement("div");
1973
2031
  C.className = "tbw-filter-range-slider";
1974
2032
  const k = document.createElement("div");
1975
2033
  k.className = "tbw-filter-range-track";
1976
- const T = document.createElement("div");
1977
- T.className = "tbw-filter-range-fill";
2034
+ const L = document.createElement("div");
2035
+ L.className = "tbw-filter-range-fill";
1978
2036
  const m = document.createElement("input");
1979
2037
  m.type = "range", m.className = "tbw-filter-range-thumb tbw-filter-range-thumb-min", m.min = String(h), m.max = String(f), m.step = String(g), m.value = String(w);
1980
2038
  const x = document.createElement("input");
1981
- x.type = "range", x.className = "tbw-filter-range-thumb tbw-filter-range-thumb-max", x.min = String(h), x.max = String(f), x.step = String(g), x.value = String(b), C.appendChild(k), C.appendChild(T), C.appendChild(m), C.appendChild(x), e.appendChild(C);
1982
- const L = () => {
1983
- const A = parseFloat(m.value), z = parseFloat(x.value), j = f - h, ve = (A - h) / j * 100, ut = (z - h) / j * 100;
1984
- T.style.left = `${ve}%`, T.style.width = `${ut - ve}%`;
2039
+ x.type = "range", x.className = "tbw-filter-range-thumb tbw-filter-range-thumb-max", x.min = String(h), x.max = String(f), x.step = String(g), x.value = String(y), C.appendChild(k), C.appendChild(L), C.appendChild(m), C.appendChild(x), e.appendChild(C);
2040
+ const I = () => {
2041
+ const A = parseFloat(m.value), K = parseFloat(x.value), j = f - h, ye = (A - h) / j * 100, gt = (K - h) / j * 100;
2042
+ L.style.left = `${ye}%`, L.style.width = `${gt - ye}%`;
1985
2043
  };
1986
2044
  m.addEventListener("input", () => {
1987
2045
  const A = Math.min(parseFloat(m.value), parseFloat(x.value));
1988
- m.value = String(A), R.value = String(A), L();
2046
+ m.value = String(A), S.value = String(A), I();
1989
2047
  }), x.addEventListener("input", () => {
1990
2048
  const A = Math.max(parseFloat(x.value), parseFloat(m.value));
1991
- x.value = String(A), S.value = String(A), L();
1992
- }), R.addEventListener("input", () => {
1993
- let A = parseFloat(R.value) || h;
1994
- A = Math.max(h, Math.min(A, parseFloat(S.value))), m.value = String(A), L();
2049
+ x.value = String(A), R.value = String(A), I();
1995
2050
  }), S.addEventListener("input", () => {
1996
- let A = parseFloat(S.value) || f;
1997
- A = Math.min(f, Math.max(A, parseFloat(R.value))), x.value = String(A), L();
1998
- }), L();
1999
- const K = document.createElement("div");
2000
- K.className = "tbw-filter-buttons";
2051
+ let A = parseFloat(S.value) || h;
2052
+ A = Math.max(h, Math.min(A, parseFloat(R.value))), m.value = String(A), I();
2053
+ }), R.addEventListener("input", () => {
2054
+ let A = parseFloat(R.value) || f;
2055
+ A = Math.min(f, Math.max(A, parseFloat(S.value))), x.value = String(A), I();
2056
+ }), I();
2057
+ const H = document.createElement("div");
2058
+ H.className = "tbw-filter-buttons";
2001
2059
  const X = document.createElement("button");
2002
2060
  X.className = "tbw-filter-apply-btn", X.textContent = "Apply", X.addEventListener("click", () => {
2003
- const A = parseFloat(R.value), z = parseFloat(S.value);
2004
- t.applyTextFilter("between", A, z);
2005
- }), K.appendChild(X);
2061
+ const A = parseFloat(S.value), K = parseFloat(R.value);
2062
+ t.applyTextFilter("between", A, K);
2063
+ }), H.appendChild(X);
2006
2064
  const Z = document.createElement("button");
2007
2065
  Z.className = "tbw-filter-clear-btn", Z.textContent = "Clear Filter", Z.addEventListener("click", () => {
2008
2066
  t.clearFilter();
2009
- }), K.appendChild(Z), e.appendChild(K);
2067
+ }), H.appendChild(Z), e.appendChild(H);
2010
2068
  }
2011
2069
  renderDateFilterPanel(e, t, i) {
2012
2070
  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)) : "" : "", f = h(o?.min) || h(a?.min) || u(d), g = h(o?.max) || h(a?.max) || u(c), p = this.filters.get(n);
2013
- let w = "", b = "";
2014
- p?.operator === "between" ? (w = h(p.value) || "", b = h(p.valueTo) || "") : p?.operator === "greaterThanOrEqual" ? w = h(p.value) || "" : p?.operator === "lessThanOrEqual" && (b = h(p.value) || "");
2015
- const y = document.createElement("div");
2016
- y.className = "tbw-filter-date-range";
2071
+ let w = "", y = "";
2072
+ p?.operator === "between" ? (w = h(p.value) || "", y = h(p.valueTo) || "") : p?.operator === "greaterThanOrEqual" ? w = h(p.value) || "" : p?.operator === "lessThanOrEqual" && (y = h(p.value) || "");
2073
+ const E = document.createElement("div");
2074
+ E.className = "tbw-filter-date-range";
2075
+ const F = document.createElement("div");
2076
+ F.className = "tbw-filter-date-group";
2077
+ const P = document.createElement("label");
2078
+ P.textContent = "From", P.className = "tbw-filter-range-label";
2079
+ const S = document.createElement("input");
2080
+ S.type = "date", S.className = "tbw-filter-date-input", f && (S.min = f), g && (S.max = g), S.value = w, F.appendChild(P), F.appendChild(S), E.appendChild(F);
2081
+ const b = document.createElement("span");
2082
+ b.className = "tbw-filter-range-separator", b.textContent = "–", E.appendChild(b);
2017
2083
  const v = document.createElement("div");
2018
2084
  v.className = "tbw-filter-date-group";
2019
- const E = document.createElement("label");
2020
- E.textContent = "From", E.className = "tbw-filter-range-label";
2085
+ const T = document.createElement("label");
2086
+ T.textContent = "To", T.className = "tbw-filter-range-label";
2021
2087
  const R = document.createElement("input");
2022
- R.type = "date", R.className = "tbw-filter-date-input", f && (R.min = f), g && (R.max = g), R.value = w, v.appendChild(E), v.appendChild(R), y.appendChild(v);
2023
- const D = document.createElement("span");
2024
- D.className = "tbw-filter-range-separator", D.textContent = "–", y.appendChild(D);
2025
- const I = document.createElement("div");
2026
- I.className = "tbw-filter-date-group";
2027
- const P = document.createElement("label");
2028
- P.textContent = "To", P.className = "tbw-filter-range-label";
2029
- const S = document.createElement("input");
2030
- S.type = "date", S.className = "tbw-filter-date-input", f && (S.min = f), g && (S.max = g), S.value = b, I.appendChild(P), I.appendChild(S), y.appendChild(I), e.appendChild(y);
2088
+ R.type = "date", R.className = "tbw-filter-date-input", f && (R.min = f), g && (R.max = g), R.value = y, v.appendChild(T), v.appendChild(R), E.appendChild(v), e.appendChild(E);
2031
2089
  const C = document.createElement("div");
2032
2090
  C.className = "tbw-filter-buttons";
2033
2091
  const k = document.createElement("button");
2034
2092
  k.className = "tbw-filter-apply-btn", k.textContent = "Apply", k.addEventListener("click", () => {
2035
- const m = R.value, x = S.value;
2093
+ const m = S.value, x = R.value;
2036
2094
  m && x ? t.applyTextFilter("between", m, x) : m ? t.applyTextFilter("greaterThanOrEqual", m) : x ? t.applyTextFilter("lessThanOrEqual", x) : t.clearFilter();
2037
2095
  }), C.appendChild(k);
2038
- const T = document.createElement("button");
2039
- T.className = "tbw-filter-clear-btn", T.textContent = "Clear Filter", T.addEventListener("click", () => {
2096
+ const L = document.createElement("button");
2097
+ L.className = "tbw-filter-clear-btn", L.textContent = "Clear Filter", L.addEventListener("click", () => {
2040
2098
  t.clearFilter();
2041
- }), C.appendChild(T), e.appendChild(C);
2099
+ }), C.appendChild(L), e.appendChild(C);
2042
2100
  }
2043
2101
  applySetFilter(e, t) {
2044
2102
  this.excludedValues.set(e, new Set(t)), t.length === 0 ? this.filters.delete(e) : this.filters.set(e, {
@@ -2104,7 +2162,7 @@ class q extends _ {
2104
2162
  this.filters.set(e, i), this.cachedResult = null, this.cacheKey = null;
2105
2163
  }
2106
2164
  }
2107
- function Fe(s) {
2165
+ function Me(s) {
2108
2166
  if (!s.length) return [];
2109
2167
  const e = /* @__PURE__ */ new Map(), t = [], i = (o, a) => {
2110
2168
  if (!a.length) return;
@@ -2139,7 +2197,7 @@ function Fe(s) {
2139
2197
  }, e.set(d, c), t.push(c)), c.columns.push(o);
2140
2198
  }), n.length && i(r, n), t.length === 1 && t[0].implicit && t[0].columns.length === s.length ? [] : t;
2141
2199
  }
2142
- function Ut(s, e, t) {
2200
+ function Qt(s, e, t) {
2143
2201
  if (!e.length || !s) return;
2144
2202
  const i = /* @__PURE__ */ new Map();
2145
2203
  for (const r of e)
@@ -2155,7 +2213,7 @@ function Ut(s, e, t) {
2155
2213
  a && a.classList.add("group-end");
2156
2214
  }
2157
2215
  }
2158
- function Yt(s, e) {
2216
+ function Jt(s, e) {
2159
2217
  if (s.length === 0) return null;
2160
2218
  const t = document.createElement("div");
2161
2219
  t.className = "header-group-row", t.setAttribute("role", "row");
@@ -2167,11 +2225,11 @@ function Yt(s, e) {
2167
2225
  }
2168
2226
  return t;
2169
2227
  }
2170
- function Xt(s) {
2228
+ function ei(s) {
2171
2229
  return s.some((e) => e.group != null);
2172
2230
  }
2173
- const Zt = "@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)}}";
2174
- class vn extends _ {
2231
+ const ti = "@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)}}";
2232
+ class An extends _ {
2175
2233
  static manifest = {
2176
2234
  ownedProperties: [
2177
2235
  {
@@ -2188,7 +2246,7 @@ class vn extends _ {
2188
2246
  ]
2189
2247
  };
2190
2248
  name = "groupingColumns";
2191
- styles = Zt;
2249
+ styles = ti;
2192
2250
  get defaultConfig() {
2193
2251
  return {
2194
2252
  showGroupBorders: !0
@@ -2204,7 +2262,7 @@ class vn extends _ {
2204
2262
  if (t?.columnGroups && Array.isArray(t.columnGroups) && t.columnGroups.length > 0)
2205
2263
  return !0;
2206
2264
  const i = t?.columns;
2207
- return Array.isArray(i) ? Xt(i) : !1;
2265
+ return Array.isArray(i) ? ei(i) : !1;
2208
2266
  }
2209
2267
  processColumns(e) {
2210
2268
  const t = this.grid?.gridConfig?.columnGroups;
@@ -2220,7 +2278,7 @@ class vn extends _ {
2220
2278
  });
2221
2279
  } else
2222
2280
  i = [...e];
2223
- const n = Fe(i);
2281
+ const n = Me(i);
2224
2282
  if (n.length === 0)
2225
2283
  return this.isActive = !1, this.groups = [], i;
2226
2284
  this.isActive = !0, this.groups = n, this.#t.clear();
@@ -2240,16 +2298,16 @@ class vn extends _ {
2240
2298
  if (!e) return;
2241
2299
  const t = e.querySelector(".header-group-row");
2242
2300
  t && t.remove();
2243
- const i = this.columns, n = Fe(i);
2301
+ const i = this.columns, n = Me(i);
2244
2302
  if (n.length === 0) return;
2245
- const r = Yt(n, i);
2303
+ const r = Jt(n, i);
2246
2304
  if (r) {
2247
2305
  r.classList.toggle("no-borders", !this.config.showGroupBorders);
2248
2306
  const a = e.querySelector(".header-row");
2249
2307
  a ? e.insertBefore(r, a) : e.appendChild(r);
2250
2308
  }
2251
2309
  const o = e.querySelector(".header-row");
2252
- o && (o.classList.toggle("no-group-borders", !this.config.showGroupBorders), Ut(o, n));
2310
+ o && (o.classList.toggle("no-group-borders", !this.config.showGroupBorders), Qt(o, n));
2253
2311
  }
2254
2312
  afterCellRender(e) {
2255
2313
  !this.isActive || !this.config.showGroupBorders || e.cellElement.classList.toggle("group-end", this.#t.has(e.column.field));
@@ -2268,7 +2326,7 @@ class vn extends _ {
2268
2326
  this.requestRender();
2269
2327
  }
2270
2328
  }
2271
- function Pe({ rows: s, config: e, expanded: t, initialExpanded: i }) {
2329
+ function De({ rows: s, config: e, expanded: t, initialExpanded: i }) {
2272
2330
  const n = e.groupOn;
2273
2331
  if (typeof n != "function")
2274
2332
  return [];
@@ -2301,20 +2359,20 @@ function Pe({ rows: s, config: e, expanded: t, initialExpanded: i }) {
2301
2359
  };
2302
2360
  return l(r), a;
2303
2361
  }
2304
- function Qt(s, e) {
2362
+ function ii(s, e) {
2305
2363
  const t = new Set(s);
2306
2364
  return t.has(e) ? t.delete(e) : t.add(e), t;
2307
2365
  }
2308
- function Jt(s) {
2366
+ function ni(s) {
2309
2367
  const e = /* @__PURE__ */ new Set();
2310
2368
  for (const t of s)
2311
2369
  t.kind === "group" && e.add(t.key);
2312
2370
  return e;
2313
2371
  }
2314
- function ei() {
2372
+ function ri() {
2315
2373
  return /* @__PURE__ */ new Set();
2316
2374
  }
2317
- function ti(s, e) {
2375
+ function oi(s, e) {
2318
2376
  if (s === !0)
2319
2377
  return new Set(e);
2320
2378
  if (s === !1 || s == null)
@@ -2325,14 +2383,14 @@ function ti(s, e) {
2325
2383
  }
2326
2384
  return typeof s == "string" ? /* @__PURE__ */ new Set([s]) : Array.isArray(s) ? new Set(s) : /* @__PURE__ */ new Set();
2327
2385
  }
2328
- function ii(s) {
2386
+ function si(s) {
2329
2387
  return s.filter((e) => e.kind === "group").map((e) => e.key);
2330
2388
  }
2331
- function ni(s) {
2389
+ function ai(s) {
2332
2390
  return s.kind !== "group" ? 0 : s.rows.length;
2333
2391
  }
2334
- const ri = "@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}}}";
2335
- class yn extends _ {
2392
+ const li = "@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}}}";
2393
+ class _n extends _ {
2336
2394
  static manifest = {
2337
2395
  events: [
2338
2396
  {
@@ -2359,7 +2417,7 @@ class yn extends _ {
2359
2417
  ]
2360
2418
  };
2361
2419
  name = "groupingRows";
2362
- styles = ri;
2420
+ styles = li;
2363
2421
  get defaultConfig() {
2364
2422
  return {
2365
2423
  defaultExpanded: !1,
@@ -2397,7 +2455,7 @@ class yn extends _ {
2397
2455
  const t = this.config;
2398
2456
  if (typeof t.groupOn != "function")
2399
2457
  return this.isActive = !1, this.flattenedRows = [], [...e];
2400
- const i = Pe({
2458
+ const i = De({
2401
2459
  rows: [...e],
2402
2460
  config: t,
2403
2461
  expanded: /* @__PURE__ */ new Set()
@@ -2406,10 +2464,10 @@ class yn extends _ {
2406
2464
  return this.isActive = !1, this.flattenedRows = [], [...e];
2407
2465
  let n;
2408
2466
  if (!this.hasAppliedDefaultExpanded && this.expandedKeys.size === 0 && t.defaultExpanded !== !1) {
2409
- const a = ii(i);
2410
- n = ti(t.defaultExpanded ?? !1, a), n.size > 0 && (this.expandedKeys = new Set(n), this.hasAppliedDefaultExpanded = !0);
2467
+ const a = si(i);
2468
+ n = oi(t.defaultExpanded ?? !1, a), n.size > 0 && (this.expandedKeys = new Set(n), this.hasAppliedDefaultExpanded = !0);
2411
2469
  }
2412
- const r = Pe({
2470
+ const r = De({
2413
2471
  rows: [...e],
2414
2472
  config: t,
2415
2473
  expanded: this.expandedKeys,
@@ -2429,7 +2487,7 @@ class yn extends _ {
2429
2487
  __groupDepth: a.depth,
2430
2488
  __groupRows: a.rows,
2431
2489
  __groupExpanded: a.expanded,
2432
- __groupRowCount: ni(a),
2490
+ __groupRowCount: ai(a),
2433
2491
  __rowCacheKey: `group:${a.key}`
2434
2492
  } : a.row);
2435
2493
  }
@@ -2502,7 +2560,7 @@ class yn extends _ {
2502
2560
  const c = document.createElement("span");
2503
2561
  c.className = "group-aggregates";
2504
2562
  for (const [u, h] of d) {
2505
- const f = this.columns.find((p) => p.field === u), g = te(h, o, u, f);
2563
+ const f = this.columns.find((p) => p.field === u), g = ne(h, o, u, f);
2506
2564
  if (g != null) {
2507
2565
  const p = document.createElement("span");
2508
2566
  p.className = "group-aggregate", p.setAttribute("data-field", u);
@@ -2520,14 +2578,14 @@ class yn extends _ {
2520
2578
  let c = !1;
2521
2579
  o.forEach((u, h) => {
2522
2580
  const f = document.createElement("div");
2523
- if (f.className = "cell group-cell", f.setAttribute("data-col", String(h)), f.setAttribute("role", "gridcell"), pe(u)) {
2581
+ if (f.className = "cell group-cell", f.setAttribute("data-col", String(h)), f.setAttribute("role", "gridcell"), ie(u)) {
2524
2582
  f.setAttribute("data-field", u.field), t.appendChild(f);
2525
2583
  return;
2526
2584
  }
2527
2585
  if (c) {
2528
2586
  const g = r[u.field];
2529
2587
  if (g) {
2530
- const p = te(g, a, u.field, u);
2588
+ const p = ne(g, a, u.field, u);
2531
2589
  f.textContent = p != null ? String(p) : "";
2532
2590
  } else
2533
2591
  f.textContent = "";
@@ -2535,7 +2593,7 @@ class yn extends _ {
2535
2593
  c = !0, f.appendChild(this.createToggleButton(e.__groupExpanded, i));
2536
2594
  const g = document.createElement("span"), p = r[u.field];
2537
2595
  if (p) {
2538
- const w = te(p, a, u.field, u);
2596
+ const w = ne(p, a, u.field, u);
2539
2597
  g.textContent = w != null ? String(w) : String(e.__groupValue);
2540
2598
  } else
2541
2599
  g.textContent = this.getGroupLabelText(e.__groupValue, e.__groupDepth || 0, e.__groupKey);
@@ -2548,10 +2606,10 @@ class yn extends _ {
2548
2606
  });
2549
2607
  }
2550
2608
  expandAll() {
2551
- this.expandedKeys = Jt(this.flattenedRows), this.emitPluginEvent("grouping-state-change", { expandedKeys: [...this.expandedKeys] }), this.requestRender();
2609
+ this.expandedKeys = ni(this.flattenedRows), this.emitPluginEvent("grouping-state-change", { expandedKeys: [...this.expandedKeys] }), this.requestRender();
2552
2610
  }
2553
2611
  collapseAll() {
2554
- this.expandedKeys = ei(), this.emitPluginEvent("grouping-state-change", { expandedKeys: [...this.expandedKeys] }), this.requestRender();
2612
+ this.expandedKeys = ri(), this.emitPluginEvent("grouping-state-change", { expandedKeys: [...this.expandedKeys] }), this.requestRender();
2555
2613
  }
2556
2614
  toggle(e) {
2557
2615
  const t = !this.expandedKeys.has(e), i = this.config, n = this.flattenedRows.find((r) => r.kind === "group" && r.key === e);
@@ -2566,7 +2624,7 @@ class yn extends _ {
2566
2624
  }
2567
2625
  r.add(e), this.expandedKeys = r;
2568
2626
  } else
2569
- this.expandedKeys = Qt(this.expandedKeys, e);
2627
+ this.expandedKeys = ii(this.expandedKeys, e);
2570
2628
  this.emit("group-toggle", {
2571
2629
  key: e,
2572
2630
  expanded: this.expandedKeys.has(e),
@@ -2616,22 +2674,22 @@ class yn extends _ {
2616
2674
  this.config.groupOn = e, this.requestRender();
2617
2675
  }
2618
2676
  }
2619
- function De(s, e) {
2677
+ function Ne(s, e) {
2620
2678
  const t = new Set(s);
2621
2679
  return t.has(e) ? t.delete(e) : t.add(e), t;
2622
2680
  }
2623
- function oi(s, e) {
2681
+ function di(s, e) {
2624
2682
  const t = new Set(s);
2625
2683
  return t.add(e), t;
2626
2684
  }
2627
- function si(s, e) {
2685
+ function ci(s, e) {
2628
2686
  const t = new Set(s);
2629
2687
  return t.delete(e), t;
2630
2688
  }
2631
- function ai(s, e) {
2689
+ function ui(s, e) {
2632
2690
  return s.has(e);
2633
2691
  }
2634
- function li(s, e, t, i) {
2692
+ function hi(s, e, t, i) {
2635
2693
  const n = document.createElement("div");
2636
2694
  n.className = "master-detail-row", n.setAttribute("data-detail-for", String(e)), n.setAttribute("role", "row");
2637
2695
  const r = document.createElement("div");
@@ -2639,10 +2697,10 @@ function li(s, e, t, i) {
2639
2697
  const o = t(s, e);
2640
2698
  return typeof o == "string" ? r.innerHTML = o : o instanceof HTMLElement && r.appendChild(o), n.appendChild(r), n;
2641
2699
  }
2642
- const di = "@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}}}";
2643
- class nt extends _ {
2700
+ const fi = "@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}}}";
2701
+ class ot extends _ {
2644
2702
  name = "masterDetail";
2645
- styles = di;
2703
+ styles = fi;
2646
2704
  get defaultConfig() {
2647
2705
  return {
2648
2706
  detailHeight: "auto",
@@ -2671,8 +2729,8 @@ class nt extends _ {
2671
2729
  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));
2672
2730
  const c = t.innerHTML.trim();
2673
2731
  c && !this.config.detailRenderer && (d.detailRenderer = (u, h) => {
2674
- const f = Je(c, { value: u, row: u });
2675
- return et(f);
2732
+ const f = tt(c, { value: u, row: u });
2733
+ return it(f);
2676
2734
  }), Object.keys(d).length > 0 && (this.config = { ...this.config, ...d });
2677
2735
  }
2678
2736
  get animationStyle() {
@@ -2719,10 +2777,10 @@ class nt extends _ {
2719
2777
  return this.measuredDetailHeights.set(e, r), r;
2720
2778
  }
2721
2779
  const i = this.measuredDetailHeights.get(e);
2722
- return i && i > 0 ? i : typeof this.config?.detailHeight == "number" ? this.config.detailHeight : nt.DEFAULT_DETAIL_HEIGHT;
2780
+ return i && i > 0 ? i : typeof this.config?.detailHeight == "number" ? this.config.detailHeight : ot.DEFAULT_DETAIL_HEIGHT;
2723
2781
  }
2724
2782
  toggleAndEmit(e, t) {
2725
- this.expandedRows = De(this.expandedRows, e);
2783
+ this.expandedRows = Ne(this.expandedRows, e);
2726
2784
  const i = this.expandedRows.has(e);
2727
2785
  i && this.rowsToAnimate.add(e), this.emit("detail-expand", {
2728
2786
  rowIndex: t,
@@ -2737,9 +2795,9 @@ class nt extends _ {
2737
2795
  if (!(this.config.showExpandColumn === !0 || this.config.showExpandColumn !== !1 && !!this.config.detailRenderer))
2738
2796
  return [...e];
2739
2797
  const i = [...e];
2740
- if (vt(i))
2798
+ if (Wt(i))
2741
2799
  return i;
2742
- const r = yt(this.name);
2800
+ const r = $t(this.name);
2743
2801
  return r.viewRenderer = (o) => {
2744
2802
  const { row: a } = o, l = this.expandedRows.has(a), d = document.createElement("span");
2745
2803
  d.className = "master-detail-expander expander-cell";
@@ -2759,7 +2817,7 @@ class nt extends _ {
2759
2817
  onKeyDown(e) {
2760
2818
  if (e.key !== " ") return;
2761
2819
  const t = this.grid._focusCol, i = this.grid._focusRow, n = this.columns[t];
2762
- if (!n || !pe(n)) return;
2820
+ if (!n || !ie(n)) return;
2763
2821
  const r = this.rows[i];
2764
2822
  if (r)
2765
2823
  return e.preventDefault(), this.toggleAndEmit(r, i), this.requestRenderWithFocus(), !0;
@@ -2800,7 +2858,7 @@ class nt extends _ {
2800
2858
  f.previousElementSibling !== u && u.after(f);
2801
2859
  continue;
2802
2860
  }
2803
- const g = li(h, c, this.config.detailRenderer, o);
2861
+ const g = hi(h, c, this.config.detailRenderer, o);
2804
2862
  typeof this.config.detailHeight == "number" && (g.style.height = `${this.config.detailHeight}px`), u.after(g), this.detailElements.set(h, g);
2805
2863
  const p = this.rowsToAnimate.has(h);
2806
2864
  p && this.rowsToAnimate.delete(h), p && this.animateExpand(g, h, c) || requestAnimationFrame(() => {
@@ -2855,19 +2913,19 @@ class nt extends _ {
2855
2913
  }
2856
2914
  expand(e) {
2857
2915
  const t = this.rows[e];
2858
- t && (this.rowsToAnimate.add(t), this.expandedRows = oi(this.expandedRows, t), this.requestRender());
2916
+ t && (this.rowsToAnimate.add(t), this.expandedRows = di(this.expandedRows, t), this.requestRender());
2859
2917
  }
2860
2918
  collapse(e) {
2861
2919
  const t = this.rows[e];
2862
- t && (this.expandedRows = si(this.expandedRows, t), this.requestRender());
2920
+ t && (this.expandedRows = ci(this.expandedRows, t), this.requestRender());
2863
2921
  }
2864
2922
  toggle(e) {
2865
2923
  const t = this.rows[e];
2866
- t && (this.expandedRows = De(this.expandedRows, t), this.expandedRows.has(t) && this.rowsToAnimate.add(t), this.requestRender());
2924
+ t && (this.expandedRows = Ne(this.expandedRows, t), this.expandedRows.has(t) && this.rowsToAnimate.add(t), this.requestRender());
2867
2925
  }
2868
2926
  isExpanded(e) {
2869
2927
  const t = this.rows[e];
2870
- return t ? ai(this.expandedRows, t) : !1;
2928
+ return t ? ui(this.expandedRows, t) : !1;
2871
2929
  }
2872
2930
  expandAll() {
2873
2931
  for (const e of this.rows)
@@ -2897,34 +2955,34 @@ class nt extends _ {
2897
2955
  }
2898
2956
  }
2899
2957
  }
2900
- function ci(s, e, t) {
2958
+ function gi(s, e, t) {
2901
2959
  return e.length ? [...s].sort((i, n) => {
2902
2960
  for (const r of e) {
2903
- const a = t.find((u) => u.field === r.field)?.sortComparator ?? ui, l = i[r.field], d = n[r.field], c = a(l, d, i, n);
2961
+ const a = t.find((u) => u.field === r.field)?.sortComparator ?? pi, l = i[r.field], d = n[r.field], c = a(l, d, i, n);
2904
2962
  if (c !== 0)
2905
2963
  return r.direction === "asc" ? c : -c;
2906
2964
  }
2907
2965
  return 0;
2908
2966
  }) : [...s];
2909
2967
  }
2910
- function ui(s, e) {
2968
+ function pi(s, e) {
2911
2969
  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));
2912
2970
  }
2913
- function hi(s, e, t, i) {
2971
+ function mi(s, e, t, i) {
2914
2972
  const n = s.find((r) => r.field === e);
2915
2973
  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" }];
2916
2974
  }
2917
- function Me(s, e) {
2975
+ function qe(s, e) {
2918
2976
  const t = s.findIndex((i) => i.field === e);
2919
2977
  return t >= 0 ? t + 1 : void 0;
2920
2978
  }
2921
- function Ne(s, e) {
2979
+ function He(s, e) {
2922
2980
  return s.find((t) => t.field === e)?.direction;
2923
2981
  }
2924
- const fi = '@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}}';
2925
- class xn extends _ {
2982
+ const wi = '@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}}';
2983
+ class Tn extends _ {
2926
2984
  name = "multiSort";
2927
- styles = fi;
2985
+ styles = wi;
2928
2986
  get defaultConfig() {
2929
2987
  return {
2930
2988
  maxSortColumns: 3,
@@ -2936,12 +2994,12 @@ class xn extends _ {
2936
2994
  this.sortModel = [];
2937
2995
  }
2938
2996
  processRows(e) {
2939
- return this.sortModel.length === 0 ? [...e] : ci([...e], this.sortModel, [...this.columns]);
2997
+ return this.sortModel.length === 0 ? [...e] : gi([...e], this.sortModel, [...this.columns]);
2940
2998
  }
2941
2999
  onHeaderClick(e) {
2942
3000
  if (!this.columns.find((r) => r.field === e.field)?.sortable) return !1;
2943
3001
  const i = e.originalEvent.shiftKey, n = this.config.maxSortColumns ?? 3;
2944
- return this.sortModel = hi(this.sortModel, e.field, i, n), this.emit("sort-change", { sortModel: [...this.sortModel] }), this.requestRender(), !0;
3002
+ return this.sortModel = mi(this.sortModel, e.field, i, n), this.emit("sort-change", { sortModel: [...this.sortModel] }), this.requestRender(), !0;
2945
3003
  }
2946
3004
  afterRender() {
2947
3005
  const e = this.gridElement;
@@ -2950,7 +3008,7 @@ class xn extends _ {
2950
3008
  e.querySelectorAll(".header-row .cell[data-field]").forEach((n) => {
2951
3009
  const r = n.getAttribute("data-field");
2952
3010
  if (!r) return;
2953
- const o = Me(this.sortModel, r), a = Ne(this.sortModel, r);
3011
+ const o = qe(this.sortModel, r), a = He(this.sortModel, r);
2954
3012
  if (n.querySelector(".sort-index")?.remove(), a) {
2955
3013
  n.querySelector('[part~="sort-indicator"], .sort-indicator')?.remove(), n.setAttribute("data-sort", a);
2956
3014
  const c = document.createElement("span");
@@ -2974,10 +3032,10 @@ class xn extends _ {
2974
3032
  this.sortModel = [], this.emit("sort-change", { sortModel: [] }), this.requestRender();
2975
3033
  }
2976
3034
  getSortIndex(e) {
2977
- return Me(this.sortModel, e);
3035
+ return qe(this.sortModel, e);
2978
3036
  }
2979
3037
  getSortDirection(e) {
2980
- return Ne(this.sortModel, e);
3038
+ return He(this.sortModel, e);
2981
3039
  }
2982
3040
  getColumnState(e) {
2983
3041
  const t = this.sortModel.findIndex((n) => n.field === e);
@@ -3000,38 +3058,38 @@ class xn extends _ {
3000
3058
  i !== -1 ? this.sortModel[i] = n : this.sortModel.splice(t.sort.priority, 0, n);
3001
3059
  }
3002
3060
  }
3003
- function rt(s, e) {
3004
- return pt(s, e);
3061
+ function st(s, e) {
3062
+ return bt(s, e);
3005
3063
  }
3006
- function ot(s, e) {
3064
+ function at(s, e) {
3007
3065
  const t = s.sticky;
3008
- return t ? rt(t, e) === "left" : !1;
3066
+ return t ? st(t, e) === "left" : !1;
3009
3067
  }
3010
- function st(s, e) {
3068
+ function lt(s, e) {
3011
3069
  const t = s.sticky;
3012
- return t ? rt(t, e) === "right" : !1;
3070
+ return t ? st(t, e) === "right" : !1;
3013
3071
  }
3014
- function gi(s, e = "ltr") {
3015
- return s.filter((t) => ot(t, e));
3072
+ function bi(s, e = "ltr") {
3073
+ return s.filter((t) => at(t, e));
3016
3074
  }
3017
- function pi(s, e = "ltr") {
3018
- return s.filter((t) => st(t, e));
3075
+ function vi(s, e = "ltr") {
3076
+ return s.filter((t) => lt(t, e));
3019
3077
  }
3020
- function se(s) {
3078
+ function ae(s) {
3021
3079
  return s.some(
3022
3080
  (e) => e.sticky === "left" || e.sticky === "right" || e.sticky === "start" || e.sticky === "end"
3023
3081
  );
3024
3082
  }
3025
- function qe(s, e) {
3083
+ function Ke(s, e) {
3026
3084
  const t = Array.from(s.querySelectorAll(".header-row .cell"));
3027
3085
  if (!t.length) return;
3028
- const i = ue(s), n = /* @__PURE__ */ new Map();
3086
+ const i = he(s), n = /* @__PURE__ */ new Map();
3029
3087
  e.forEach((a, l) => {
3030
3088
  a.field && n.set(a.field, l);
3031
3089
  });
3032
3090
  let r = 0;
3033
3091
  for (const a of e)
3034
- if (ot(a, i)) {
3092
+ if (at(a, i)) {
3035
3093
  const l = n.get(a.field), d = t.find((c) => c.getAttribute("data-field") === a.field);
3036
3094
  d && (d.classList.add("sticky-left"), d.style.position = "sticky", d.style.left = r + "px", l !== void 0 && s.querySelectorAll(`.data-grid-row .cell[data-col="${l}"]`).forEach((c) => {
3037
3095
  c.classList.add("sticky-left"), c.style.position = "sticky", c.style.left = r + "px";
@@ -3039,20 +3097,20 @@ function qe(s, e) {
3039
3097
  }
3040
3098
  let o = 0;
3041
3099
  for (const a of [...e].reverse())
3042
- if (st(a, i)) {
3100
+ if (lt(a, i)) {
3043
3101
  const l = n.get(a.field), d = t.find((c) => c.getAttribute("data-field") === a.field);
3044
3102
  d && (d.classList.add("sticky-right"), d.style.position = "sticky", d.style.right = o + "px", l !== void 0 && s.querySelectorAll(`.data-grid-row .cell[data-col="${l}"]`).forEach((c) => {
3045
3103
  c.classList.add("sticky-right"), c.style.position = "sticky", c.style.right = o + "px";
3046
3104
  }), o += d.offsetWidth);
3047
3105
  }
3048
3106
  }
3049
- function He(s) {
3107
+ function ze(s) {
3050
3108
  s.querySelectorAll(".sticky-left, .sticky-right").forEach((t) => {
3051
3109
  t.classList.remove("sticky-left", "sticky-right"), t.style.position = "", t.style.left = "", t.style.right = "";
3052
3110
  });
3053
3111
  }
3054
- const Ke = "canMoveColumn";
3055
- class Cn extends _ {
3112
+ const Oe = "canMoveColumn";
3113
+ class Ln extends _ {
3056
3114
  static manifest = {
3057
3115
  ownedProperties: [
3058
3116
  {
@@ -3064,7 +3122,7 @@ class Cn extends _ {
3064
3122
  ],
3065
3123
  queries: [
3066
3124
  {
3067
- type: Ke,
3125
+ type: Oe,
3068
3126
  description: "Prevents pinned (sticky) columns from being moved/reordered"
3069
3127
  },
3070
3128
  {
@@ -3085,26 +3143,26 @@ class Cn extends _ {
3085
3143
  }
3086
3144
  static detect(e, t) {
3087
3145
  const i = t?.columns;
3088
- return Array.isArray(i) ? se(i) : !1;
3146
+ return Array.isArray(i) ? ae(i) : !1;
3089
3147
  }
3090
3148
  processColumns(e) {
3091
- return this.isApplied = se([...e]), [...e];
3149
+ return this.isApplied = ae([...e]), [...e];
3092
3150
  }
3093
3151
  afterRender() {
3094
3152
  if (!this.isApplied)
3095
3153
  return;
3096
3154
  const e = this.grid, t = [...this.columns];
3097
- if (!se(t)) {
3098
- He(e), this.isApplied = !1;
3155
+ if (!ae(t)) {
3156
+ ze(e), this.isApplied = !1;
3099
3157
  return;
3100
3158
  }
3101
3159
  queueMicrotask(() => {
3102
- qe(e, t);
3160
+ Ke(e, t);
3103
3161
  });
3104
3162
  }
3105
3163
  handleQuery(e) {
3106
3164
  switch (e.type) {
3107
- case Ke: {
3165
+ case Oe: {
3108
3166
  const t = e.context, i = t.sticky;
3109
3167
  if (i === "left" || i === "right" || i === "start" || i === "end")
3110
3168
  return !1;
@@ -3122,18 +3180,18 @@ class Cn extends _ {
3122
3180
  }
3123
3181
  refreshStickyOffsets() {
3124
3182
  const e = [...this.columns];
3125
- qe(this.grid, e);
3183
+ Ke(this.grid, e);
3126
3184
  }
3127
3185
  getLeftPinnedColumns() {
3128
- const e = [...this.columns], t = ue(this.grid);
3129
- return gi(e, t);
3186
+ const e = [...this.columns], t = he(this.grid);
3187
+ return bi(e, t);
3130
3188
  }
3131
3189
  getRightPinnedColumns() {
3132
- const e = [...this.columns], t = ue(this.grid);
3133
- return pi(e, t);
3190
+ const e = [...this.columns], t = he(this.grid);
3191
+ return vi(e, t);
3134
3192
  }
3135
3193
  clearStickyPositions() {
3136
- He(this.grid);
3194
+ ze(this.grid);
3137
3195
  }
3138
3196
  getHorizontalScrollOffsets(e, t) {
3139
3197
  if (!this.isApplied)
@@ -3154,10 +3212,10 @@ class Cn extends _ {
3154
3212
  return { left: i, right: n, skipScroll: r };
3155
3213
  }
3156
3214
  }
3157
- function mi(s) {
3215
+ function yi(s) {
3158
3216
  return typeof s == "object" && s !== null && "aggFunc" in s;
3159
3217
  }
3160
- function ae(s, e) {
3218
+ function le(s, e) {
3161
3219
  const t = document.createElement("div");
3162
3220
  t.className = "tbw-pinned-rows", t.setAttribute("role", "presentation"), t.setAttribute("aria-live", "polite");
3163
3221
  const i = document.createElement("div");
@@ -3179,7 +3237,7 @@ function ae(s, e) {
3179
3237
  }
3180
3238
  if (s.customPanels)
3181
3239
  for (const o of s.customPanels) {
3182
- const a = wi(o, e);
3240
+ const a = Ri(o, e);
3183
3241
  switch (o.position) {
3184
3242
  case "left":
3185
3243
  i.appendChild(a);
@@ -3194,47 +3252,76 @@ function ae(s, e) {
3194
3252
  }
3195
3253
  return t.appendChild(i), t.appendChild(n), t.appendChild(r), t;
3196
3254
  }
3197
- function ze(s) {
3255
+ function Ge(s) {
3198
3256
  const e = document.createElement("div");
3199
3257
  return e.className = `tbw-aggregation-rows tbw-aggregation-rows-${s}`, e.setAttribute("role", "presentation"), e;
3200
3258
  }
3201
- function Oe(s, e, t, i) {
3259
+ function Be(s, e, t, i, n = !1) {
3202
3260
  s.innerHTML = "";
3203
- for (const n of e) {
3261
+ for (const r of e) {
3262
+ const o = document.createElement("div");
3263
+ o.className = "tbw-aggregation-row", o.setAttribute("role", "presentation"), r.id && o.setAttribute("data-aggregation-id", r.id), r.fullWidth ?? n ? xi(o, r, t, i) : Ci(o, r, t, i), s.appendChild(o);
3264
+ }
3265
+ }
3266
+ function xi(s, e, t, i) {
3267
+ const n = document.createElement("div");
3268
+ n.className = "tbw-aggregation-cell tbw-aggregation-cell-full", n.style.gridColumn = "1 / -1";
3269
+ const r = typeof e.label == "function" ? e.label(i, t) : e.label;
3270
+ if (r) {
3271
+ const a = document.createElement("span");
3272
+ a.className = "tbw-aggregation-label", a.textContent = r, n.appendChild(a);
3273
+ }
3274
+ const o = Ei(e, t, i);
3275
+ o && n.appendChild(o), s.appendChild(n);
3276
+ }
3277
+ function Ci(s, e, t, i) {
3278
+ for (const n of t) {
3204
3279
  const r = document.createElement("div");
3205
- if (r.className = "tbw-aggregation-row", r.setAttribute("role", "presentation"), n.id && r.setAttribute("data-aggregation-id", n.id), n.fullWidth) {
3206
- const o = document.createElement("div");
3207
- o.className = "tbw-aggregation-cell tbw-aggregation-cell-full", o.style.gridColumn = "1 / -1", o.textContent = n.label || "", r.appendChild(o);
3208
- } else
3209
- for (const o of t) {
3210
- const a = document.createElement("div");
3211
- a.className = "tbw-aggregation-cell", a.setAttribute("data-field", o.field);
3212
- let l, d;
3213
- const c = n.aggregators?.[o.field];
3214
- if (c)
3215
- if (mi(c)) {
3216
- const u = ye(c.aggFunc);
3217
- u && (l = u(i, o.field, o)), d = c.formatter;
3218
- } else {
3219
- const u = ye(c);
3220
- u && (l = u(i, o.field, o));
3221
- }
3222
- else if (n.cells && Object.prototype.hasOwnProperty.call(n.cells, o.field)) {
3223
- const u = n.cells[o.field];
3224
- typeof u == "function" ? l = u(i, o.field, o) : l = u;
3225
- }
3226
- l != null ? a.textContent = d ? d(l, o.field, o) : String(l) : a.textContent = "", r.appendChild(a);
3227
- }
3228
- s.appendChild(r);
3280
+ r.className = "tbw-aggregation-cell", r.setAttribute("data-field", n.field);
3281
+ const { value: o, formatter: a } = dt(e, n, i);
3282
+ o != null ? r.textContent = a ? a(o, n.field, n) : String(o) : r.textContent = "", s.appendChild(r);
3229
3283
  }
3230
3284
  }
3231
- function wi(s, e) {
3285
+ function dt(s, e, t) {
3286
+ let i, n;
3287
+ const r = s.aggregators?.[e.field];
3288
+ if (r)
3289
+ if (yi(r)) {
3290
+ const o = xe(r.aggFunc);
3291
+ o && (i = o(t, e.field, e)), n = r.formatter;
3292
+ } else {
3293
+ const o = xe(r);
3294
+ o && (i = o(t, e.field, e));
3295
+ }
3296
+ else if (s.cells && Object.prototype.hasOwnProperty.call(s.cells, e.field)) {
3297
+ const o = s.cells[e.field];
3298
+ typeof o == "function" ? i = o(t, e.field, e) : i = o;
3299
+ }
3300
+ return { value: i, formatter: n };
3301
+ }
3302
+ function Ei(s, e, t) {
3303
+ const i = s.aggregators && Object.keys(s.aggregators).length > 0, n = s.cells && Object.keys(s.cells).length > 0;
3304
+ if (!i && !n) return null;
3305
+ const r = document.createElement("span");
3306
+ r.className = "tbw-aggregation-aggregates";
3307
+ for (const o of e) {
3308
+ const { value: a, formatter: l } = dt(s, o, t);
3309
+ if (a != null) {
3310
+ const d = document.createElement("span");
3311
+ d.className = "tbw-aggregation-aggregate", d.setAttribute("data-field", o.field);
3312
+ const c = o.header ?? o.field, u = l ? l(a, o.field, o) : String(a);
3313
+ d.textContent = `${c}: ${u}`, r.appendChild(d);
3314
+ }
3315
+ }
3316
+ return r.children.length > 0 ? r : null;
3317
+ }
3318
+ function Ri(s, e) {
3232
3319
  const t = document.createElement("div");
3233
3320
  t.className = "tbw-status-panel tbw-status-panel-custom", t.id = `status-panel-${s.id}`;
3234
3321
  const i = s.render(e);
3235
3322
  return typeof i == "string" ? t.innerHTML = i : t.appendChild(i), t;
3236
3323
  }
3237
- function Ge(s, e, t, i, n) {
3324
+ function Ve(s, e, t, i, n) {
3238
3325
  return {
3239
3326
  totalRows: s.length,
3240
3327
  filteredRows: n?.cachedResult?.length ?? s.length,
@@ -3244,10 +3331,10 @@ function Ge(s, e, t, i, n) {
3244
3331
  grid: t
3245
3332
  };
3246
3333
  }
3247
- const bi = "@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}}";
3248
- class En extends _ {
3334
+ 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;align-content: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;display:flex;align-items:center;gap:var(--tbw-spacing-lg, .75rem)}.tbw-aggregation-label{white-space:nowrap}.tbw-aggregation-aggregates{display:flex;align-items:center;gap:var(--tbw-spacing-lg, .75rem);font-weight:400;opacity:.85}.tbw-aggregation-aggregate{white-space:nowrap}}";
3335
+ class In extends _ {
3249
3336
  name = "pinnedRows";
3250
- styles = bi;
3337
+ styles = Si;
3251
3338
  get defaultConfig() {
3252
3339
  return {
3253
3340
  position: "bottom",
@@ -3269,7 +3356,7 @@ class En extends _ {
3269
3356
  const t = e.querySelector(".tbw-scroll-area") ?? e.querySelector(".tbw-grid-content") ?? e.children[0];
3270
3357
  if (!t) return;
3271
3358
  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);
3272
- const i = this.getSelectionState(), n = this.getFilterState(), r = Ge(
3359
+ const i = this.getSelectionState(), n = this.getFilterState(), r = Ve(
3273
3360
  this.sourceRows,
3274
3361
  this.columns,
3275
3362
  this.grid,
@@ -3278,32 +3365,34 @@ class En extends _ {
3278
3365
  ), o = this.config.aggregationRows || [], a = o.filter((h) => h.position === "top"), l = o.filter((h) => h.position !== "top");
3279
3366
  if (a.length > 0) {
3280
3367
  if (!this.topAggregationContainer) {
3281
- this.topAggregationContainer = ze("top");
3368
+ this.topAggregationContainer = Ge("top");
3282
3369
  const h = e.querySelector(".header");
3283
3370
  h && h.nextSibling ? t.insertBefore(this.topAggregationContainer, h.nextSibling) : t.appendChild(this.topAggregationContainer);
3284
3371
  }
3285
- Oe(
3372
+ Be(
3286
3373
  this.topAggregationContainer,
3287
3374
  a,
3288
3375
  this.visibleColumns,
3289
- this.sourceRows
3376
+ this.sourceRows,
3377
+ this.config.fullWidth
3290
3378
  );
3291
3379
  } else this.topAggregationContainer && (this.topAggregationContainer.remove(), this.topAggregationContainer = null);
3292
3380
  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;
3293
3381
  if (d && this.config.position === "top")
3294
3382
  if (!this.infoBarElement)
3295
- this.infoBarElement = ae(this.config, r), t.insertBefore(this.infoBarElement, t.firstChild);
3383
+ this.infoBarElement = le(this.config, r), t.insertBefore(this.infoBarElement, t.firstChild);
3296
3384
  else {
3297
- const h = ae(this.config, r);
3385
+ const h = le(this.config, r);
3298
3386
  this.infoBarElement.replaceWith(h), this.infoBarElement = h;
3299
3387
  }
3300
3388
  else this.config.position === "top" && this.infoBarElement && (this.infoBarElement.remove(), this.infoBarElement = null);
3301
- 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), Oe(
3389
+ 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 = Ge("bottom")), this.footerWrapper.appendChild(this.bottomAggregationContainer), Be(
3302
3390
  this.bottomAggregationContainer,
3303
3391
  l,
3304
3392
  this.visibleColumns,
3305
- this.sourceRows
3306
- )), c && (this.infoBarElement = ae(this.config, r), this.footerWrapper.appendChild(this.infoBarElement))) : this.cleanupFooter();
3393
+ this.sourceRows,
3394
+ this.config.fullWidth
3395
+ )), c && (this.infoBarElement = le(this.config, r), this.footerWrapper.appendChild(this.infoBarElement))) : this.cleanupFooter();
3307
3396
  }
3308
3397
  cleanup() {
3309
3398
  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);
@@ -3330,7 +3419,7 @@ class En extends _ {
3330
3419
  }
3331
3420
  getContext() {
3332
3421
  const e = this.getSelectionState(), t = this.getFilterState();
3333
- return Ge(
3422
+ return Ve(
3334
3423
  this.rows,
3335
3424
  this.columns,
3336
3425
  this.grid,
@@ -3351,16 +3440,16 @@ class En extends _ {
3351
3440
  this.config.aggregationRows && (this.config.aggregationRows = this.config.aggregationRows.filter((t) => t.id !== e), this.requestRender());
3352
3441
  }
3353
3442
  }
3354
- const vi = mt;
3355
- function yi(s) {
3443
+ const ki = vt;
3444
+ function Ai(s) {
3356
3445
  const e = [];
3357
3446
  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;
3358
3447
  }
3359
- function be(s, e) {
3448
+ function ve(s, e) {
3360
3449
  return [...s, e].join("|");
3361
3450
  }
3362
- function xi(s, e) {
3363
- const t = e.rowGroupFields ?? [], i = e.columnGroupFields ?? [], n = e.valueFields ?? [], r = Ci(s, i), o = at(
3451
+ function _i(s, e) {
3452
+ const t = e.rowGroupFields ?? [], i = e.columnGroupFields ?? [], n = e.valueFields ?? [], r = Ti(s, i), o = ct(
3364
3453
  s,
3365
3454
  t,
3366
3455
  i,
@@ -3368,7 +3457,7 @@ function xi(s, e) {
3368
3457
  n,
3369
3458
  0,
3370
3459
  ""
3371
- ), a = Ri(o, r, n), l = Object.values(a).reduce((d, c) => d + c, 0);
3460
+ ), a = Ii(o, r, n), l = Object.values(a).reduce((d, c) => d + c, 0);
3372
3461
  return {
3373
3462
  rows: o,
3374
3463
  columnKeys: r,
@@ -3376,7 +3465,7 @@ function xi(s, e) {
3376
3465
  grandTotal: l
3377
3466
  };
3378
3467
  }
3379
- function Ci(s, e) {
3468
+ function Ti(s, e) {
3380
3469
  if (e.length === 0) return ["value"];
3381
3470
  const t = /* @__PURE__ */ new Set();
3382
3471
  for (const i of s) {
@@ -3385,7 +3474,7 @@ function Ci(s, e) {
3385
3474
  }
3386
3475
  return [...t].sort();
3387
3476
  }
3388
- function Ei(s, e) {
3477
+ function Li(s, e) {
3389
3478
  const t = /* @__PURE__ */ new Map();
3390
3479
  for (const i of s) {
3391
3480
  const n = String(i[e] ?? ""), r = t.get(n);
@@ -3393,10 +3482,10 @@ function Ei(s, e) {
3393
3482
  }
3394
3483
  return t;
3395
3484
  }
3396
- function at(s, e, t, i, n, r, o) {
3485
+ function ct(s, e, t, i, n, r, o) {
3397
3486
  const a = [];
3398
3487
  if (e.length === 0) {
3399
- const h = Be(s, t, i, n), f = Ve(h);
3488
+ const h = We(s, t, i, n), f = $e(h);
3400
3489
  return a.push({
3401
3490
  rowKey: o || "all",
3402
3491
  rowLabel: o || "All",
@@ -3407,11 +3496,11 @@ function at(s, e, t, i, n, r, o) {
3407
3496
  rowCount: s.length
3408
3497
  }), a;
3409
3498
  }
3410
- const l = e[0], d = e.slice(1), c = d.length > 0, u = Ei(s, l);
3499
+ const l = e[0], d = e.slice(1), c = d.length > 0, u = Li(s, l);
3411
3500
  for (const [h, f] of u) {
3412
- const g = o ? `${o}|${h}` : h, p = Be(f, t, i, n), w = Ve(p);
3413
- let b;
3414
- c && (b = at(
3501
+ const g = o ? `${o}|${h}` : h, p = We(f, t, i, n), w = $e(p);
3502
+ let y;
3503
+ c && (y = ct(
3415
3504
  f,
3416
3505
  d,
3417
3506
  t,
@@ -3426,42 +3515,42 @@ function at(s, e, t, i, n, r, o) {
3426
3515
  values: p,
3427
3516
  total: w,
3428
3517
  isGroup: c,
3429
- children: b,
3518
+ children: y,
3430
3519
  rowCount: f.length
3431
3520
  });
3432
3521
  }
3433
3522
  return a;
3434
3523
  }
3435
- function Be(s, e, t, i) {
3524
+ function We(s, e, t, i) {
3436
3525
  const n = {};
3437
3526
  for (const r of t)
3438
3527
  for (const o of i) {
3439
- const l = (e.length > 0 ? s.filter((h) => e.map((f) => String(h[f] ?? "")).join("|") === r) : s).map((h) => Number(h[o.field]) || 0), d = vi(o.aggFunc), c = l.length > 0 ? d(l) : null, u = be([r], o.field);
3528
+ const l = (e.length > 0 ? s.filter((h) => e.map((f) => String(h[f] ?? "")).join("|") === r) : s).map((h) => Number(h[o.field]) || 0), d = ki(o.aggFunc), c = l.length > 0 ? d(l) : null, u = ve([r], o.field);
3440
3529
  n[u] = c;
3441
3530
  }
3442
3531
  return n;
3443
3532
  }
3444
- function Ve(s) {
3533
+ function $e(s) {
3445
3534
  let e = 0;
3446
3535
  for (const t of Object.values(s))
3447
3536
  e += t ?? 0;
3448
3537
  return e;
3449
3538
  }
3450
- function Ri(s, e, t) {
3539
+ function Ii(s, e, t) {
3451
3540
  const i = {};
3452
3541
  function n(r) {
3453
3542
  for (const o of r)
3454
3543
  if (!o.isGroup || !o.children?.length)
3455
3544
  for (const a of e)
3456
3545
  for (const l of t) {
3457
- const d = be([a], l.field);
3546
+ const d = ve([a], l.field);
3458
3547
  i[d] = (i[d] ?? 0) + (o.values[d] ?? 0);
3459
3548
  }
3460
3549
  else o.children && n(o.children);
3461
3550
  }
3462
3551
  return n(s), i;
3463
3552
  }
3464
- function Si(s, e, t = !0) {
3553
+ function Fi(s, e, t = !0) {
3465
3554
  const i = [];
3466
3555
  function n(r) {
3467
3556
  i.push(r);
@@ -3474,7 +3563,7 @@ function Si(s, e, t = !0) {
3474
3563
  n(r);
3475
3564
  return i;
3476
3565
  }
3477
- function ki(s) {
3566
+ function Pi(s) {
3478
3567
  const e = [];
3479
3568
  function t(i) {
3480
3569
  if (i.isGroup && e.push(i.rowKey), i.children)
@@ -3485,10 +3574,10 @@ function ki(s) {
3485
3574
  t(i);
3486
3575
  return e;
3487
3576
  }
3488
- const Ai = ["sum", "avg", "count", "min", "max", "first", "last"];
3489
- function _i(s, e, t, i) {
3577
+ const Mi = ["sum", "avg", "count", "min", "max", "first", "last"];
3578
+ function Di(s, e, t, i) {
3490
3579
  const n = new AbortController(), r = { config: e, callbacks: i, signal: n.signal }, o = document.createElement("div");
3491
- return o.className = "tbw-pivot-panel", o.appendChild(Y("Options", () => Pi(t, r))), o.appendChild(Y("Row Groups", () => We("rowGroups", r))), o.appendChild(Y("Column Groups", () => We("columnGroups", r))), o.appendChild(Y("Values", () => Li(r))), o.appendChild(Y("Available Fields", () => Fi(r))), s.appendChild(o), () => {
3580
+ return o.className = "tbw-pivot-panel", o.appendChild(Y("Options", () => zi(t, r))), o.appendChild(Y("Row Groups", () => je("rowGroups", r))), o.appendChild(Y("Column Groups", () => je("columnGroups", r))), o.appendChild(Y("Values", () => qi(r))), o.appendChild(Y("Available Fields", () => Ki(r))), s.appendChild(o), () => {
3492
3581
  n.abort(), o.remove();
3493
3582
  };
3494
3583
  }
@@ -3500,7 +3589,7 @@ function Y(s, e) {
3500
3589
  const n = document.createElement("div");
3501
3590
  return n.className = "tbw-pivot-section-content", n.appendChild(e()), t.appendChild(i), t.appendChild(n), t;
3502
3591
  }
3503
- function We(s, e) {
3592
+ function je(s, e) {
3504
3593
  const { config: t, callbacks: i, signal: n } = e, r = document.createElement("div");
3505
3594
  r.className = "tbw-pivot-drop-zone", r.setAttribute("data-zone", s);
3506
3595
  const o = s === "rowGroups" ? t.rowGroupFields ?? [] : t.columnGroupFields ?? [];
@@ -3509,7 +3598,7 @@ function We(s, e) {
3509
3598
  a.className = "tbw-pivot-placeholder", a.textContent = "Drag fields here or click to add", r.appendChild(a);
3510
3599
  } else
3511
3600
  for (const a of o)
3512
- r.appendChild(Ti(a, s, e));
3601
+ r.appendChild(Ni(a, s, e));
3513
3602
  return r.addEventListener(
3514
3603
  "dragover",
3515
3604
  (a) => {
@@ -3532,7 +3621,7 @@ function We(s, e) {
3532
3621
  { signal: n }
3533
3622
  ), r;
3534
3623
  }
3535
- function Ti(s, e, t) {
3624
+ function Ni(s, e, t) {
3536
3625
  const { callbacks: i, signal: n } = t, r = document.createElement("div");
3537
3626
  r.className = "tbw-pivot-field-chip", r.draggable = !0;
3538
3627
  const o = i.getAvailableFields().find((d) => d.field === s), a = document.createElement("span");
@@ -3558,7 +3647,7 @@ function Ti(s, e, t) {
3558
3647
  { signal: n }
3559
3648
  ), r;
3560
3649
  }
3561
- function Li(s) {
3650
+ function qi(s) {
3562
3651
  const { config: e, callbacks: t, signal: i } = s, n = document.createElement("div");
3563
3652
  n.className = "tbw-pivot-drop-zone tbw-pivot-values-zone", n.setAttribute("data-zone", "values");
3564
3653
  const r = e.valueFields ?? [];
@@ -3567,7 +3656,7 @@ function Li(s) {
3567
3656
  o.className = "tbw-pivot-placeholder", o.textContent = "Drag numeric fields here for aggregation", n.appendChild(o);
3568
3657
  } else
3569
3658
  for (const o of r)
3570
- n.appendChild(Ii(o, s));
3659
+ n.appendChild(Hi(o, s));
3571
3660
  return n.addEventListener(
3572
3661
  "dragover",
3573
3662
  (o) => {
@@ -3590,7 +3679,7 @@ function Li(s) {
3590
3679
  { signal: i }
3591
3680
  ), n;
3592
3681
  }
3593
- function Ii(s, e) {
3682
+ function Hi(s, e) {
3594
3683
  const { callbacks: t, signal: i } = e, n = document.createElement("div");
3595
3684
  n.className = "tbw-pivot-field-chip tbw-pivot-value-chip";
3596
3685
  const r = t.getAvailableFields().find((c) => c.field === s.field), o = document.createElement("div");
@@ -3599,7 +3688,7 @@ function Ii(s, e) {
3599
3688
  a.className = "tbw-pivot-chip-label", a.textContent = r?.header ?? s.field;
3600
3689
  const l = document.createElement("select");
3601
3690
  l.className = "tbw-pivot-agg-select", l.title = "Aggregation function";
3602
- for (const c of Ai) {
3691
+ for (const c of Mi) {
3603
3692
  const u = document.createElement("option");
3604
3693
  u.value = c, u.textContent = c.toUpperCase(), u.selected = c === s.aggFunc, l.appendChild(u);
3605
3694
  }
@@ -3619,7 +3708,7 @@ function Ii(s, e) {
3619
3708
  { signal: i }
3620
3709
  ), o.appendChild(a), o.appendChild(l), n.appendChild(o), n.appendChild(d), n;
3621
3710
  }
3622
- function Fi(s) {
3711
+ function Ki(s) {
3623
3712
  const { config: e, callbacks: t, signal: i } = s, n = document.createElement("div");
3624
3713
  n.className = "tbw-pivot-available-fields";
3625
3714
  const r = t.getAvailableFields(), o = /* @__PURE__ */ new Set([
@@ -3649,10 +3738,10 @@ function Fi(s) {
3649
3738
  }
3650
3739
  return n;
3651
3740
  }
3652
- function Pi(s, e) {
3741
+ function zi(s, e) {
3653
3742
  const { config: t, callbacks: i, signal: n } = e, r = document.createElement("div");
3654
3743
  return r.className = "tbw-pivot-options", r.appendChild(
3655
- le(
3744
+ de(
3656
3745
  "Enable Pivot View",
3657
3746
  s,
3658
3747
  (o) => {
@@ -3661,7 +3750,7 @@ function Pi(s, e) {
3661
3750
  n
3662
3751
  )
3663
3752
  ), r.appendChild(
3664
- le(
3753
+ de(
3665
3754
  "Show Row Totals",
3666
3755
  t.showTotals ?? !0,
3667
3756
  (o) => {
@@ -3670,7 +3759,7 @@ function Pi(s, e) {
3670
3759
  n
3671
3760
  )
3672
3761
  ), r.appendChild(
3673
- le(
3762
+ de(
3674
3763
  "Show Grand Total",
3675
3764
  t.showGrandTotal ?? !0,
3676
3765
  (o) => {
@@ -3680,7 +3769,7 @@ function Pi(s, e) {
3680
3769
  )
3681
3770
  ), r;
3682
3771
  }
3683
- function le(s, e, t, i) {
3772
+ function de(s, e, t, i) {
3684
3773
  const n = document.createElement("label");
3685
3774
  n.className = "tbw-pivot-checkbox";
3686
3775
  const r = document.createElement("input");
@@ -3688,7 +3777,7 @@ function le(s, e, t, i) {
3688
3777
  const o = document.createElement("span");
3689
3778
  return o.textContent = s, n.appendChild(r), n.appendChild(o), n;
3690
3779
  }
3691
- function Di(s, e, t) {
3780
+ function Oi(s, e, t) {
3692
3781
  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) => {
3693
3782
  const r = document.createElement("div");
3694
3783
  if (r.className = "cell", r.setAttribute("data-col", String(n)), r.setAttribute("data-row", String(t.rowIndex)), r.setAttribute("role", "gridcell"), n === 0) {
@@ -3709,7 +3798,7 @@ function Di(s, e, t) {
3709
3798
  e.appendChild(r);
3710
3799
  }), !0;
3711
3800
  }
3712
- function Mi(s, e, t, i) {
3801
+ function Gi(s, e, t, i) {
3713
3802
  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) => {
3714
3803
  const o = document.createElement("div");
3715
3804
  if (o.className = "cell", o.setAttribute("data-col", String(r)), o.setAttribute("data-row", String(i)), o.setAttribute("role", "gridcell"), r === 0) {
@@ -3724,7 +3813,7 @@ function Mi(s, e, t, i) {
3724
3813
  e.appendChild(o);
3725
3814
  }), !0;
3726
3815
  }
3727
- function Ni(s, e, t) {
3816
+ function Bi(s, e, t) {
3728
3817
  return e.className = "pivot-grand-total-row", e.setAttribute("role", "presentation"), e.innerHTML = "", t.forEach((i, n) => {
3729
3818
  const r = document.createElement("div");
3730
3819
  if (r.className = "cell", r.setAttribute("data-col", String(n)), n === 0) {
@@ -3737,10 +3826,10 @@ function Ni(s, e, t) {
3737
3826
  e.appendChild(r);
3738
3827
  }), !0;
3739
3828
  }
3740
- const qi = '@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}}}';
3829
+ const Vi = '@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}}}';
3741
3830
  class B extends _ {
3742
3831
  name = "pivot";
3743
- styles = qi;
3832
+ styles = Vi;
3744
3833
  static PANEL_ID = "pivot";
3745
3834
  get defaultConfig() {
3746
3835
  return {
@@ -3786,11 +3875,11 @@ class B extends _ {
3786
3875
  processRows(e) {
3787
3876
  if (!this.hasInitialized && this.config.active !== !1 && this.hasValidPivotConfig() && (this.hasInitialized = !0, this.isActive = !0), !this.isActive)
3788
3877
  return [...e];
3789
- const t = yi(this.config);
3878
+ const t = Ai(this.config);
3790
3879
  if (t.length > 0)
3791
3880
  return this.warn(`Config errors: ${t.join(", ")}`), [...e];
3792
- this.buildFieldHeaderMap(), this.defaultExpanded = this.config.defaultExpanded ?? !0, this.pivotResult = xi(e, this.config), this.expandedKeys.size === 0 && this.defaultExpanded && !this.userHasToggledExpand && this.expandAllKeys();
3793
- const i = this.config.indentWidth ?? 20, n = Si(
3881
+ this.buildFieldHeaderMap(), this.defaultExpanded = this.config.defaultExpanded ?? !0, this.pivotResult = _i(e, this.config), this.expandedKeys.size === 0 && this.defaultExpanded && !this.userHasToggledExpand && this.expandAllKeys();
3882
+ const i = this.config.indentWidth ?? 20, n = Fi(
3794
3883
  this.pivotResult.rows,
3795
3884
  this.expandedKeys,
3796
3885
  this.defaultExpanded
@@ -3825,7 +3914,7 @@ class B extends _ {
3825
3914
  });
3826
3915
  for (const n of this.pivotResult.columnKeys)
3827
3916
  for (const r of this.config.valueFields ?? []) {
3828
- const o = be([n], r.field), a = r.header || this.fieldHeaderMap.get(r.field) || r.field;
3917
+ const o = ve([n], r.field), a = r.header || this.fieldHeaderMap.get(r.field) || r.field;
3829
3918
  t.push({
3830
3919
  field: o,
3831
3920
  header: `${n} - ${a} (${r.aggFunc})`,
@@ -3842,13 +3931,13 @@ class B extends _ {
3842
3931
  }
3843
3932
  renderRow(e, t, i) {
3844
3933
  const n = e;
3845
- return n.__pivotRowKey && n.__pivotHasChildren ? Di(n, t, {
3934
+ return n.__pivotRowKey && n.__pivotHasChildren ? Oi(n, t, {
3846
3935
  columns: this.gridColumns,
3847
3936
  rowIndex: i,
3848
3937
  onToggle: (r) => this.toggle(r),
3849
3938
  resolveIcon: (r) => this.resolveIcon(r),
3850
3939
  setIcon: (r, o) => this.setIcon(r, o)
3851
- }) : n.__pivotRowKey !== void 0 && this.isActive ? Mi(n, t, this.gridColumns, i) : (this.cleanupPivotStyling(t), !1);
3940
+ }) : n.__pivotRowKey !== void 0 && this.isActive ? Gi(n, t, this.gridColumns, i) : (this.cleanupPivotStyling(t), !1);
3852
3941
  }
3853
3942
  cleanupPivotStyling(e) {
3854
3943
  (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 = "");
@@ -3886,7 +3975,7 @@ class B extends _ {
3886
3975
  __pivotTotal: this.pivotResult.grandTotal,
3887
3976
  ...this.pivotResult.totals
3888
3977
  };
3889
- Ni(i, this.grandTotalFooter, this.gridColumns);
3978
+ Bi(i, this.grandTotalFooter, this.gridColumns);
3890
3979
  }
3891
3980
  cleanupGrandTotalFooter() {
3892
3981
  this.grandTotalFooter && (this.grandTotalFooter.remove(), this.grandTotalFooter = null);
@@ -3908,7 +3997,7 @@ class B extends _ {
3908
3997
  }
3909
3998
  expandAllKeys() {
3910
3999
  if (!this.pivotResult) return;
3911
- const e = ki(this.pivotResult.rows);
4000
+ const e = Pi(this.pivotResult.rows);
3912
4001
  for (const t of e)
3913
4002
  this.expandedKeys.add(t);
3914
4003
  }
@@ -3993,7 +4082,7 @@ class B extends _ {
3993
4082
  },
3994
4083
  getAvailableFields: () => this.getAvailableFields()
3995
4084
  };
3996
- return _i(e, this.config, this.isActive, t);
4085
+ return Di(e, this.config, this.isActive, t);
3997
4086
  }
3998
4087
  refreshPanel() {
3999
4088
  this.panelContainer && (this.panelContainer.innerHTML = "", this.renderPanel(this.panelContainer));
@@ -4026,10 +4115,10 @@ class B extends _ {
4026
4115
  n >= 0 && (i[n] = { ...i[n], aggFunc: t }, this.config.valueFields = [...i]), this.isActive && this.refresh();
4027
4116
  }
4028
4117
  }
4029
- const J = "tbw-print-isolation-style";
4030
- function Hi(s, e) {
4118
+ const ee = "tbw-print-isolation-style";
4119
+ function Wi(s, e) {
4031
4120
  const t = document.createElement("style");
4032
- return t.id = J, t.textContent = `
4121
+ return t.id = ee, t.textContent = `
4033
4122
  /* Print isolation: hide everything except the target grid */
4034
4123
  @media print {
4035
4124
  /* Hide all body children by default */
@@ -4101,22 +4190,22 @@ function Hi(s, e) {
4101
4190
  }
4102
4191
  `, t;
4103
4192
  }
4104
- async function Ki(s, e = {}) {
4193
+ async function $i(s, e = {}) {
4105
4194
  const { orientation: t = "landscape" } = e, i = s.id;
4106
4195
  document.querySelectorAll(`#${CSS.escape(i)}`).length > 1 && console.warn(
4107
4196
  `[tbw-grid:print] Multiple elements found with id="${i}". Print isolation may not work correctly. Ensure each grid has a unique ID.`
4108
- ), document.getElementById(J)?.remove();
4109
- const r = Hi(i, t);
4197
+ ), document.getElementById(ee)?.remove();
4198
+ const r = Wi(i, t);
4110
4199
  return document.head.appendChild(r), new Promise((o) => {
4111
4200
  const a = () => {
4112
- window.removeEventListener("afterprint", a), document.getElementById(J)?.remove(), o();
4201
+ window.removeEventListener("afterprint", a), document.getElementById(ee)?.remove(), o();
4113
4202
  };
4114
4203
  window.addEventListener("afterprint", a), window.print(), setTimeout(() => {
4115
- window.removeEventListener("afterprint", a), document.getElementById(J)?.remove(), o();
4204
+ window.removeEventListener("afterprint", a), document.getElementById(ee)?.remove(), o();
4116
4205
  }, 5e3);
4117
4206
  });
4118
4207
  }
4119
- const zi = ".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:end}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-inline-end: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}}}", Oi = {
4208
+ const ji = ".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:end}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-inline-end: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}}}", Ui = {
4120
4209
  button: !1,
4121
4210
  orientation: "landscape",
4122
4211
  warnThreshold: 500,
@@ -4126,18 +4215,18 @@ const zi = ".tbw-print-header,.tbw-print-footer{display:none}@media print{tbw-gr
4126
4215
  title: "",
4127
4216
  isolate: !1
4128
4217
  };
4129
- class Rn extends _ {
4218
+ class Fn extends _ {
4130
4219
  name = "print";
4131
4220
  version = "1.0.0";
4132
- styles = zi;
4221
+ styles = ji;
4133
4222
  #t = !1;
4134
4223
  #e = null;
4135
- #s = null;
4136
4224
  #o = null;
4225
+ #r = null;
4137
4226
  #i = null;
4138
4227
  #n = null;
4139
- #u = null;
4140
- get #l() {
4228
+ #l = null;
4229
+ get #c() {
4141
4230
  return this.grid;
4142
4231
  }
4143
4232
  isPrinting() {
@@ -4153,7 +4242,7 @@ class Rn extends _ {
4153
4242
  console.warn("[PrintPlugin] Grid not available");
4154
4243
  return;
4155
4244
  }
4156
- const i = { ...Oi, ...this.config, ...e }, r = this.rows.length;
4245
+ const i = { ...Ui, ...this.config, ...e }, r = this.rows.length;
4157
4246
  let o = r, a = !1;
4158
4247
  if (i.warnThreshold > 0 && r > i.warnThreshold) {
4159
4248
  const d = i.maxRows > 0 ? `
@@ -4174,10 +4263,10 @@ Click OK to continue, or Cancel to abort.`
4174
4263
  originalRowCount: r
4175
4264
  });
4176
4265
  try {
4177
- const d = this.#l;
4178
- this.#s = {
4266
+ const d = this.#c;
4267
+ this.#o = {
4179
4268
  bypassThreshold: d._virtualization?.bypassThreshold ?? 24
4180
- }, this.#v(), a && (this.#o = this.sourceRows, this.grid.rows = this.sourceRows.slice(0, o), await new Promise((c) => setTimeout(c, 50))), (i.includeTitle || i.includeTimestamp) && this.#r(i), await this.#d(), await new Promise((c) => requestAnimationFrame(c)), await new Promise((c) => requestAnimationFrame(c)), t.classList.add(`print-${i.orientation}`), await new Promise((c) => requestAnimationFrame(c)), await new Promise((c) => requestAnimationFrame(c)), i.isolate ? await this.#p(i) : await this.#f(), this.emit("print-complete", {
4269
+ }, this.#m(), a && (this.#r = this.sourceRows, this.grid.rows = this.sourceRows.slice(0, o), await new Promise((c) => setTimeout(c, 50))), (i.includeTitle || i.includeTimestamp) && this.#f(i), await this.#s(), await new Promise((c) => requestAnimationFrame(c)), await new Promise((c) => requestAnimationFrame(c)), t.classList.add(`print-${i.orientation}`), await new Promise((c) => requestAnimationFrame(c)), await new Promise((c) => requestAnimationFrame(c)), i.isolate ? await this.#p(i) : await this.#a(), this.emit("print-complete", {
4181
4270
  success: !0,
4182
4271
  rowCount: o,
4183
4272
  duration: Math.round(performance.now() - l)
@@ -4189,10 +4278,10 @@ Click OK to continue, or Cancel to abort.`
4189
4278
  duration: Math.round(performance.now() - l)
4190
4279
  });
4191
4280
  } finally {
4192
- this.#w(), this.#t = !1;
4281
+ this.#b(), this.#t = !1;
4193
4282
  }
4194
4283
  }
4195
- #r(e) {
4284
+ #f(e) {
4196
4285
  const t = this.gridElement;
4197
4286
  if (t) {
4198
4287
  if (this.#i = document.createElement("div"), this.#i.className = "tbw-print-header", e.includeTitle) {
@@ -4206,13 +4295,13 @@ Click OK to continue, or Cancel to abort.`
4206
4295
  t.insertBefore(this.#i, t.firstChild), this.#n = document.createElement("div"), this.#n.className = "tbw-print-footer", this.#n.textContent = `Page generated from ${window.location.hostname}`, t.appendChild(this.#n);
4207
4296
  }
4208
4297
  }
4209
- async #d() {
4210
- const e = this.#l;
4298
+ async #s() {
4299
+ const e = this.#c;
4211
4300
  if (!e._virtualization) return;
4212
4301
  const t = this.rows.length;
4213
4302
  e._virtualization.bypassThreshold = t + 100, e.refreshVirtualWindow(!0), await new Promise((i) => setTimeout(i, 100));
4214
4303
  }
4215
- async #f() {
4304
+ async #a() {
4216
4305
  return new Promise((e) => {
4217
4306
  const t = () => {
4218
4307
  window.removeEventListener("afterprint", t), e();
@@ -4224,11 +4313,11 @@ Click OK to continue, or Cancel to abort.`
4224
4313
  }
4225
4314
  async #p(e) {
4226
4315
  const t = this.gridElement;
4227
- t && await Ki(t, {
4316
+ t && await $i(t, {
4228
4317
  orientation: e.orientation
4229
4318
  });
4230
4319
  }
4231
- #v() {
4320
+ #m() {
4232
4321
  const e = this.columns;
4233
4322
  if (e) {
4234
4323
  this.#e = /* @__PURE__ */ new Map();
@@ -4243,19 +4332,19 @@ Click OK to continue, or Cancel to abort.`
4243
4332
  this.#e = null;
4244
4333
  }
4245
4334
  }
4246
- #w() {
4335
+ #b() {
4247
4336
  const e = this.gridElement;
4248
4337
  if (!e) return;
4249
- this.#h(), e.classList.remove("print-portrait", "print-landscape"), this.#u !== null && (e.style.transform = "", e.style.transformOrigin = "", e.style.width = "", this.#u = null), this.#i && (this.#i.remove(), this.#i = null), this.#n && (this.#n.remove(), this.#n = null);
4250
- const t = this.#l;
4251
- this.#s && t._virtualization && (t._virtualization.bypassThreshold = this.#s.bypassThreshold, t.refreshVirtualWindow(!0), this.#s = null), this.#o !== null && (this.grid.rows = this.#o, this.#o = null);
4338
+ this.#h(), e.classList.remove("print-portrait", "print-landscape"), this.#l !== null && (e.style.transform = "", e.style.transformOrigin = "", e.style.width = "", this.#l = null), this.#i && (this.#i.remove(), this.#i = null), this.#n && (this.#n.remove(), this.#n = null);
4339
+ const t = this.#c;
4340
+ this.#o && t._virtualization && (t._virtualization.bypassThreshold = this.#o.bypassThreshold, t.refreshVirtualWindow(!0), this.#o = null), this.#r !== null && (this.grid.rows = this.#r, this.#r = null);
4252
4341
  }
4253
4342
  afterRender() {
4254
- this.config?.button && !this.#c && (this.#g(), this.#c = !0);
4343
+ this.config?.button && !this.#g && (this.#u(), this.#g = !0);
4255
4344
  }
4256
- #c = !1;
4257
- #g() {
4258
- this.#l.registerToolbarContent?.({
4345
+ #g = !1;
4346
+ #u() {
4347
+ this.#c.registerToolbarContent?.({
4259
4348
  id: "print-button",
4260
4349
  order: 900,
4261
4350
  render: (t) => {
@@ -4273,19 +4362,19 @@ Click OK to continue, or Cancel to abort.`
4273
4362
  });
4274
4363
  }
4275
4364
  }
4276
- function Gi(s) {
4365
+ function Yi(s) {
4277
4366
  const e = s.meta ?? {};
4278
4367
  return e.lockPosition !== !0 && e.suppressMovable !== !0;
4279
4368
  }
4280
- function $e(s, e, t) {
4369
+ function Ue(s, e, t) {
4281
4370
  if (e === t || e < 0 || e >= s.length || t < 0 || t > s.length) return s;
4282
4371
  const i = [...s], [n] = i.splice(e, 1);
4283
4372
  return i.splice(t, 0, n), i;
4284
4373
  }
4285
- const Bi = '@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}}';
4286
- class Sn extends _ {
4374
+ const Xi = '@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}}';
4375
+ class Pn extends _ {
4287
4376
  name = "reorder";
4288
- styles = Bi;
4377
+ styles = Xi;
4289
4378
  get defaultConfig() {
4290
4379
  return {
4291
4380
  animation: "flip"
@@ -4302,7 +4391,7 @@ class Sn extends _ {
4302
4391
  draggedIndex = null;
4303
4392
  dropIndex = null;
4304
4393
  canMoveColumnWithPlugins(e) {
4305
- return !e || !Gi(e) ? !1 : !this.grid.query("canMoveColumn", e).includes(!1);
4394
+ return !e || !Yi(e) ? !1 : !this.grid.query("canMoveColumn", e).includes(!1);
4306
4395
  }
4307
4396
  clearDragClasses() {
4308
4397
  this.gridElement?.querySelectorAll(".header-row > .cell").forEach((e) => {
@@ -4349,7 +4438,7 @@ class Sn extends _ {
4349
4438
  const l = this.draggedField, d = this.draggedIndex, c = this.dropIndex;
4350
4439
  if (!this.isDragging || l === null || d === null || c === null)
4351
4440
  return;
4352
- const u = c > d ? c - 1 : c, h = this.getColumnOrder(), f = $e(h, d, u), g = {
4441
+ const u = c > d ? c - 1 : c, h = this.getColumnOrder(), f = Ue(h, d, u), g = {
4353
4442
  field: l,
4354
4443
  fromIndex: d,
4355
4444
  toIndex: u,
@@ -4372,7 +4461,7 @@ class Sn extends _ {
4372
4461
  if (l < 0 || l >= o.length) return;
4373
4462
  const d = n.find((c) => c.field === o[l]);
4374
4463
  if (this.canMoveColumnWithPlugins(d))
4375
- return this.moveColumn(r.field, l), t._focusCol = l, F(this.grid), e.preventDefault(), e.stopPropagation(), !0;
4464
+ return this.moveColumn(r.field, l), t._focusCol = l, M(this.grid), e.preventDefault(), e.stopPropagation(), !0;
4376
4465
  }
4377
4466
  getColumnOrder() {
4378
4467
  return this.grid.getColumnOrder();
@@ -4380,7 +4469,7 @@ class Sn extends _ {
4380
4469
  moveColumn(e, t) {
4381
4470
  const i = this.getColumnOrder(), n = i.indexOf(e);
4382
4471
  if (n === -1) return;
4383
- const r = $e(i, n, t);
4472
+ const r = Ue(i, n, t);
4384
4473
  this.emitCancelable("column-move", {
4385
4474
  field: e,
4386
4475
  fromIndex: n,
@@ -4475,11 +4564,11 @@ class Sn extends _ {
4475
4564
  this.grid.requestStateChange?.();
4476
4565
  }
4477
4566
  }
4478
- const Vi = '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-inline-start: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;inset-inline-start: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-inline-end: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-inline-end: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}}';
4479
- class kn extends _ {
4567
+ const Zi = '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-inline-start: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;inset-inline-start: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-inline-end: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-inline-end: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}}';
4568
+ class Mn extends _ {
4480
4569
  name = "responsive";
4481
4570
  version = "1.0.0";
4482
- styles = Vi;
4571
+ styles = Zi;
4483
4572
  static manifest = {
4484
4573
  incompatibleWith: [
4485
4574
  {
@@ -4496,18 +4585,18 @@ class kn extends _ {
4496
4585
  };
4497
4586
  #t;
4498
4587
  #e = !1;
4499
- #s;
4500
- #o = !1;
4588
+ #o;
4589
+ #r = !1;
4501
4590
  #i = 0;
4502
4591
  #n = /* @__PURE__ */ new Set();
4503
- #u = /* @__PURE__ */ new Set();
4504
- #l = null;
4505
- #r = [];
4592
+ #l = /* @__PURE__ */ new Set();
4593
+ #c = null;
4594
+ #f = [];
4506
4595
  isResponsive() {
4507
4596
  return this.#e;
4508
4597
  }
4509
4598
  setResponsive(e) {
4510
- e !== this.#e && (this.#e = e, this.#w(), this.emit("responsive-change", {
4599
+ e !== this.#e && (this.#e = e, this.#b(), this.emit("responsive-change", {
4511
4600
  isResponsive: e,
4512
4601
  width: this.#i,
4513
4602
  breakpoint: this.config.breakpoint ?? 0
@@ -4523,17 +4612,17 @@ class kn extends _ {
4523
4612
  return this.#i;
4524
4613
  }
4525
4614
  getActiveBreakpoint() {
4526
- return this.#l;
4615
+ return this.#c;
4527
4616
  }
4528
4617
  attach(e) {
4529
- super.attach(e), this.#d(), this.#f(this.config.hiddenColumns), this.config.breakpoints?.length && (this.#r = [...this.config.breakpoints].sort((t, i) => i.maxWidth - t.maxWidth)), this.#t = new ResizeObserver((t) => {
4618
+ super.attach(e), this.#s(), this.#a(this.config.hiddenColumns), this.config.breakpoints?.length && (this.#f = [...this.config.breakpoints].sort((t, i) => i.maxWidth - t.maxWidth)), this.#t = new ResizeObserver((t) => {
4530
4619
  const i = t[0]?.contentRect.width ?? 0;
4531
- this.#i = i, clearTimeout(this.#s), this.#s = setTimeout(() => {
4620
+ this.#i = i, clearTimeout(this.#o), this.#o = setTimeout(() => {
4532
4621
  this.#p(i);
4533
4622
  }, this.config.debounceMs ?? 100);
4534
4623
  }), this.#t.observe(this.gridElement);
4535
4624
  }
4536
- #d() {
4625
+ #s() {
4537
4626
  const e = this.grid;
4538
4627
  if (!e || typeof e.querySelector != "function") return;
4539
4628
  const t = e.querySelector("tbw-grid-responsive-card");
@@ -4554,58 +4643,58 @@ class kn extends _ {
4554
4643
  }
4555
4644
  const c = t.innerHTML.trim();
4556
4645
  c && !this.config.cardRenderer && !i.__frameworkAdapter?.parseResponsiveCardElement && (d.cardRenderer = (u) => {
4557
- const h = Je(c, { value: u, row: u }), f = et(h), g = document.createElement("div");
4646
+ const h = tt(c, { value: u, row: u }), f = it(h), g = document.createElement("div");
4558
4647
  return g.className = "tbw-responsive-card-content", g.innerHTML = f, g;
4559
4648
  }), Object.keys(d).length > 0 && (this.config = { ...this.config, ...d });
4560
4649
  }
4561
- #f(e) {
4562
- if (this.#n.clear(), this.#u.clear(), !!e)
4650
+ #a(e) {
4651
+ if (this.#n.clear(), this.#l.clear(), !!e)
4563
4652
  for (const t of e)
4564
- typeof t == "string" ? this.#n.add(t) : t.showValue ? this.#u.add(t.field) : this.#n.add(t.field);
4653
+ typeof t == "string" ? this.#n.add(t) : t.showValue ? this.#l.add(t.field) : this.#n.add(t.field);
4565
4654
  }
4566
4655
  detach() {
4567
- this.#t?.disconnect(), this.#t = void 0, clearTimeout(this.#s), this.#s = void 0, this.gridElement && this.gridElement.removeAttribute("data-responsive"), super.detach();
4656
+ this.#t?.disconnect(), this.#t = void 0, clearTimeout(this.#o), this.#o = void 0, this.gridElement && this.gridElement.removeAttribute("data-responsive"), super.detach();
4568
4657
  }
4569
4658
  handleQuery(e) {
4570
4659
  if (e.type === "isCardMode")
4571
4660
  return this.#e;
4572
4661
  }
4573
4662
  afterRender() {
4574
- if (this.#R(), !(this.#r.length > 0 ? this.#l !== null : this.#e))
4663
+ if (this.#R(), !(this.#f.length > 0 ? this.#c !== null : this.#e))
4575
4664
  return;
4576
- const t = this.#n.size > 0, i = this.#u.size > 0;
4665
+ const t = this.#n.size > 0, i = this.#l.size > 0;
4577
4666
  if (!t && !i)
4578
4667
  return;
4579
4668
  const n = this.gridElement.querySelectorAll(".cell[data-field]");
4580
4669
  for (const r of n) {
4581
4670
  const o = r.getAttribute("data-field");
4582
- o && (this.#n.has(o) ? (r.setAttribute("data-responsive-hidden", ""), r.removeAttribute("data-responsive-value-only")) : this.#u.has(o) ? (r.setAttribute("data-responsive-value-only", ""), r.removeAttribute("data-responsive-hidden")) : (r.removeAttribute("data-responsive-hidden"), r.removeAttribute("data-responsive-value-only")));
4671
+ o && (this.#n.has(o) ? (r.setAttribute("data-responsive-hidden", ""), r.removeAttribute("data-responsive-value-only")) : this.#l.has(o) ? (r.setAttribute("data-responsive-value-only", ""), r.removeAttribute("data-responsive-hidden")) : (r.removeAttribute("data-responsive-hidden"), r.removeAttribute("data-responsive-value-only")));
4583
4672
  }
4584
4673
  }
4585
4674
  #p(e) {
4586
- if (this.#r.length > 0) {
4587
- this.#v(e);
4675
+ if (this.#f.length > 0) {
4676
+ this.#m(e);
4588
4677
  return;
4589
4678
  }
4590
4679
  const t = this.config.breakpoint ?? 0;
4591
- t === 0 && !this.#o && (this.#o = !0, console.warn(
4680
+ t === 0 && !this.#r && (this.#r = !0, console.warn(
4592
4681
  "[tbw-grid:ResponsivePlugin] No breakpoint configured. Responsive mode is disabled. Set a breakpoint based on your grid's column count."
4593
4682
  ));
4594
4683
  const i = t > 0 && e < t;
4595
- i !== this.#e && (this.#e = i, this.#w(), this.emit("responsive-change", {
4684
+ i !== this.#e && (this.#e = i, this.#b(), this.emit("responsive-change", {
4596
4685
  isResponsive: i,
4597
4686
  width: e,
4598
4687
  breakpoint: t
4599
4688
  }), this.requestRender());
4600
4689
  }
4601
- #v(e) {
4690
+ #m(e) {
4602
4691
  let t = null;
4603
- for (const n of this.#r)
4692
+ for (const n of this.#f)
4604
4693
  e <= n.maxWidth && (t = n);
4605
- if (t !== this.#l) {
4606
- this.#l = t, t?.hiddenColumns ? this.#f(t.hiddenColumns) : this.#f(this.config.hiddenColumns);
4694
+ if (t !== this.#c) {
4695
+ this.#c = t, t?.hiddenColumns ? this.#a(t.hiddenColumns) : this.#a(this.config.hiddenColumns);
4607
4696
  const n = t?.cardLayout === !0;
4608
- n !== this.#e && (this.#e = n, this.#w()), this.emit("responsive-change", {
4697
+ n !== this.#e && (this.#e = n, this.#b()), this.emit("responsive-change", {
4609
4698
  isResponsive: this.#e,
4610
4699
  width: e,
4611
4700
  breakpoint: t?.maxWidth ?? 0
@@ -4613,7 +4702,7 @@ class kn extends _ {
4613
4702
  }
4614
4703
  }
4615
4704
  #h;
4616
- #w() {
4705
+ #b() {
4617
4706
  this.gridElement.toggleAttribute("data-responsive", this.#e);
4618
4707
  const e = this.config.animate !== !1;
4619
4708
  this.gridElement.toggleAttribute("data-responsive-animate", e), this.config.animationDuration && this.gridElement.style.setProperty("--tbw-responsive-duration", `${this.config.animationDuration}ms`);
@@ -4626,7 +4715,7 @@ class kn extends _ {
4626
4715
  const i = this.gridElement.querySelectorAll(".data-grid-row");
4627
4716
  for (const n of i)
4628
4717
  n.style.height = "", n.classList.remove("responsive-card");
4629
- this.#h && this.#h > 0 && t._virtualization && (t._virtualization.rowHeight = this.#h, this.#h = void 0), this.#c = void 0, this.#g = void 0, this.#a = void 0;
4718
+ this.#h && this.#h > 0 && t._virtualization && (t._virtualization.rowHeight = this.#h, this.#h = void 0), this.#g = void 0, this.#u = void 0, this.#y = void 0;
4630
4719
  }
4631
4720
  }
4632
4721
  renderRow(e, t, i) {
@@ -4645,40 +4734,40 @@ class kn extends _ {
4645
4734
  switch (e.key) {
4646
4735
  case "ArrowDown":
4647
4736
  if (this.grid._focusCol < i)
4648
- return this.grid._focusCol += 1, e.preventDefault(), F(this.grid), !0;
4737
+ return this.grid._focusCol += 1, e.preventDefault(), M(this.grid), !0;
4649
4738
  if (this.grid._focusRow < t)
4650
- return this.grid._focusRow += 1, this.grid._focusCol = 0, e.preventDefault(), F(this.grid), !0;
4739
+ return this.grid._focusRow += 1, this.grid._focusCol = 0, e.preventDefault(), M(this.grid), !0;
4651
4740
  break;
4652
4741
  case "ArrowUp":
4653
4742
  if (this.grid._focusCol > 0)
4654
- return this.grid._focusCol -= 1, e.preventDefault(), F(this.grid), !0;
4743
+ return this.grid._focusCol -= 1, e.preventDefault(), M(this.grid), !0;
4655
4744
  if (this.grid._focusRow > 0)
4656
- return this.grid._focusRow -= 1, this.grid._focusCol = i, e.preventDefault(), F(this.grid), !0;
4745
+ return this.grid._focusRow -= 1, this.grid._focusCol = i, e.preventDefault(), M(this.grid), !0;
4657
4746
  break;
4658
4747
  case "ArrowRight":
4659
4748
  if (this.grid._focusRow < t)
4660
- return this.grid._focusRow += 1, e.preventDefault(), F(this.grid), !0;
4749
+ return this.grid._focusRow += 1, e.preventDefault(), M(this.grid), !0;
4661
4750
  break;
4662
4751
  case "ArrowLeft":
4663
4752
  if (this.grid._focusRow > 0)
4664
- return this.grid._focusRow -= 1, e.preventDefault(), F(this.grid), !0;
4753
+ return this.grid._focusRow -= 1, e.preventDefault(), M(this.grid), !0;
4665
4754
  break;
4666
4755
  }
4667
4756
  return !1;
4668
4757
  }
4669
- #c;
4670
4758
  #g;
4671
- #a;
4672
- #b() {
4673
- if (this.#c && this.#c > 0)
4674
- return this.#c;
4759
+ #u;
4760
+ #y;
4761
+ #d() {
4762
+ if (this.#g && this.#g > 0)
4763
+ return this.#g;
4675
4764
  const e = this.config.cardRowHeight;
4676
4765
  return typeof e == "number" && e > 0 ? e : 80;
4677
4766
  }
4678
- #m() {
4679
- return this.#g && this.#g > 0 ? this.#g : this.#h ?? 28;
4767
+ #v() {
4768
+ return this.#u && this.#u > 0 ? this.#u : this.#h ?? 28;
4680
4769
  }
4681
- #y() {
4770
+ #w() {
4682
4771
  for (const e of this.rows)
4683
4772
  if (e.__isGroupRow)
4684
4773
  return !0;
@@ -4691,15 +4780,15 @@ class kn extends _ {
4691
4780
  return { groupCount: e, cardCount: t };
4692
4781
  }
4693
4782
  getExtraHeight() {
4694
- if (!this.#e || !this.config.cardRenderer || !this.#y())
4783
+ if (!this.#e || !this.config.cardRenderer || !this.#w())
4695
4784
  return 0;
4696
- const e = this.#h ?? 28, t = this.#m(), i = this.#b(), { groupCount: n, cardCount: r } = this.#C(), o = n * Math.max(0, t - e), a = r * Math.max(0, i - e);
4785
+ const e = this.#h ?? 28, t = this.#v(), i = this.#d(), { groupCount: n, cardCount: r } = this.#C(), o = n * Math.max(0, t - e), a = r * Math.max(0, i - e);
4697
4786
  return o + a;
4698
4787
  }
4699
4788
  getExtraHeightBefore(e) {
4700
- if (!this.#e || !this.config.cardRenderer || !this.#y())
4789
+ if (!this.#e || !this.config.cardRenderer || !this.#w())
4701
4790
  return 0;
4702
- const t = this.#h ?? 28, i = this.#m(), n = this.#b(), r = Math.max(0, i - t), o = Math.max(0, n - t);
4791
+ const t = this.#h ?? 28, i = this.#v(), n = this.#d(), r = Math.max(0, i - t), o = Math.max(0, n - t);
4703
4792
  let a = 0, l = 0;
4704
4793
  const d = this.rows, c = Math.min(e, d.length);
4705
4794
  for (let u = 0; u < c; u++)
@@ -4708,41 +4797,41 @@ class kn extends _ {
4708
4797
  }
4709
4798
  getRowHeight(e, t) {
4710
4799
  if (!(!this.#e || !this.config.cardRenderer))
4711
- return e.__isGroupRow ? this.#m() : this.#b();
4800
+ return e.__isGroupRow ? this.#v() : this.#d();
4712
4801
  }
4713
- #x() {
4802
+ #E() {
4714
4803
  let e = 0;
4715
4804
  for (const t of this.rows)
4716
4805
  t.__isGroupRow || e++;
4717
4806
  return e;
4718
4807
  }
4719
- #E = !1;
4808
+ #x = !1;
4720
4809
  #R() {
4721
4810
  if (!this.#e || !this.config.cardRenderer)
4722
4811
  return;
4723
4812
  let e = !1;
4724
- const t = this.grid, i = this.#y(), n = this.#x();
4725
- if (n !== this.#a && (this.#a = n, e = !0), i) {
4813
+ const t = this.grid, i = this.#w(), n = this.#E();
4814
+ if (n !== this.#y && (this.#y = n, e = !0), i) {
4726
4815
  const o = this.gridElement.querySelector(".data-grid-row.group-row");
4727
4816
  if (o) {
4728
4817
  const a = o.getBoundingClientRect().height;
4729
- a > 0 && a !== this.#g && (this.#g = a, e = !0);
4818
+ a > 0 && a !== this.#u && (this.#u = a, e = !0);
4730
4819
  }
4731
4820
  }
4732
4821
  const r = this.gridElement.querySelector(".data-grid-row.responsive-card");
4733
4822
  if (r) {
4734
4823
  const o = r.getBoundingClientRect().height;
4735
- o > 0 && o !== this.#c && (this.#c = o, e = !0, !i && t._virtualization && (t._virtualization.rowHeight = o));
4824
+ o > 0 && o !== this.#g && (this.#g = o, e = !0, !i && t._virtualization && (t._virtualization.rowHeight = o));
4736
4825
  }
4737
- e && !this.#E && (this.#E = !0, queueMicrotask(() => {
4738
- this.#E = !1, this.grid && this.#e && this.grid.refreshVirtualWindow?.(!0, !0);
4826
+ e && !this.#x && (this.#x = !0, queueMicrotask(() => {
4827
+ this.#x = !1, this.grid && this.#e && this.grid.refreshVirtualWindow?.(!0, !0);
4739
4828
  }));
4740
4829
  }
4741
4830
  }
4742
- const Wi = '@layer tbw-plugins{[data-field=__tbw_row_drag]{display:flex;align-items:center;justify-content:center}.dg-row-drag-handle{display:flex;align-items:center;justify-content:center;min-width:1em;min-height:1em;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}}', $i = "__tbw_row_drag";
4743
- class An extends _ {
4831
+ const Qi = '@layer tbw-plugins{[data-field=__tbw_row_drag]{display:flex;align-items:center;justify-content:center}.dg-row-drag-handle{display:flex;align-items:center;justify-content:center;min-width:1em;min-height:1em;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}}', Ji = "__tbw_row_drag";
4832
+ class Dn extends _ {
4744
4833
  name = "rowReorder";
4745
- styles = Wi;
4834
+ styles = Qi;
4746
4835
  get defaultConfig() {
4747
4836
  return {
4748
4837
  enableKeyboard: !0,
@@ -4769,7 +4858,7 @@ class An extends _ {
4769
4858
  if (!this.config.showDragHandle)
4770
4859
  return [...e];
4771
4860
  const t = {
4772
- field: $i,
4861
+ field: Ji,
4773
4862
  header: "",
4774
4863
  width: this.config.dragHandleWidth ?? 40,
4775
4864
  resizable: !1,
@@ -4863,7 +4952,7 @@ class An extends _ {
4863
4952
  row: e
4864
4953
  }, this.lastFocusCol = r;
4865
4954
  const o = this.grid, a = [...o._rows ?? this.sourceRows], [l] = a.splice(t, 1);
4866
- a.splice(i, 0, l), o._rows = a, o._focusRow = i, o._focusCol = r, o.refreshVirtualWindow(!0), F(o), this.clearDebounceTimer(), this.debounceTimer = setTimeout(() => {
4955
+ a.splice(i, 0, l), o._rows = a, o._focusRow = i, o._focusCol = r, o.refreshVirtualWindow(!0), M(o), this.clearDebounceTimer(), this.debounceTimer = setTimeout(() => {
4867
4956
  this.flushPendingMove();
4868
4957
  }, this.config.debounceMs ?? 300);
4869
4958
  }
@@ -4882,7 +4971,7 @@ class An extends _ {
4882
4971
  const o = [...this.sourceRows], [a] = o.splice(t, 1);
4883
4972
  o.splice(e, 0, a);
4884
4973
  const l = this.grid;
4885
- l._rows = o, l._focusRow = e, l._focusCol = this.lastFocusCol, l.refreshVirtualWindow(!0), F(l);
4974
+ l._rows = o, l._focusRow = e, l._focusCol = this.lastFocusCol, l.refreshVirtualWindow(!0), M(l);
4886
4975
  }
4887
4976
  }
4888
4977
  executeMove(e, t, i, n) {
@@ -4960,38 +5049,38 @@ function $(s) {
4960
5049
  endCol: Math.max(s.startCol, s.endCol)
4961
5050
  };
4962
5051
  }
4963
- function ji(s) {
5052
+ function en(s) {
4964
5053
  const e = $(s);
4965
5054
  return {
4966
5055
  from: { row: e.startRow, col: e.startCol },
4967
5056
  to: { row: e.endRow, col: e.endCol }
4968
5057
  };
4969
5058
  }
4970
- function lt(s) {
4971
- return s.map(ji);
5059
+ function ut(s) {
5060
+ return s.map(en);
4972
5061
  }
4973
- function Ui(s, e, t) {
5062
+ function tn(s, e, t) {
4974
5063
  const i = $(t);
4975
5064
  return s >= i.startRow && s <= i.endRow && e >= i.startCol && e <= i.endCol;
4976
5065
  }
4977
- function je(s, e, t) {
4978
- return t.some((i) => Ui(s, e, i));
5066
+ function nn(s, e, t) {
5067
+ return t.some((i) => tn(s, e, i));
4979
5068
  }
4980
- function Yi(s) {
5069
+ function rn(s) {
4981
5070
  const e = [], t = $(s);
4982
5071
  for (let i = t.startRow; i <= t.endRow; i++)
4983
5072
  for (let n = t.startCol; n <= t.endCol; n++)
4984
5073
  e.push({ row: i, col: n });
4985
5074
  return e;
4986
5075
  }
4987
- function Xi(s) {
5076
+ function on(s) {
4988
5077
  const e = /* @__PURE__ */ new Map();
4989
5078
  for (const t of s)
4990
- for (const i of Yi(t))
5079
+ for (const i of rn(t))
4991
5080
  e.set(`${i.row},${i.col}`, i);
4992
5081
  return [...e.values()];
4993
5082
  }
4994
- function de(s, e) {
5083
+ function ce(s, e) {
4995
5084
  return {
4996
5085
  startRow: s.row,
4997
5086
  startCol: s.col,
@@ -5003,8 +5092,8 @@ function Q(s, e) {
5003
5092
  const t = $(s), i = $(e);
5004
5093
  return t.startRow === i.startRow && t.startCol === i.startCol && t.endRow === i.endRow && t.endCol === i.endCol;
5005
5094
  }
5006
- const Zi = "@layer tbw-plugins{tbw-grid{&.selecting .data-grid-row>.cell{user-select:none}&:has(.selection){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);padding-top:calc(var(--tbw-cell-padding, 2px 8px) - 2px)}&.bottom{border-bottom:2px solid var(--tbw-range-border-color);padding-bottom:calc(var(--tbw-cell-padding, 2px 8px) - 2px)}&.first{border-left:2px solid var(--tbw-range-border-color);padding-left:calc(var(--tbw-cell-padding, 2px 8px) - 2px)}&.last{border-right:2px solid var(--tbw-range-border-color);padding-right:calc(var(--tbw-cell-padding, 2px 8px) - 2px)}}.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}}}";
5007
- function Qi(s, e, t) {
5095
+ const sn = '@layer tbw-plugins{tbw-grid{&.selecting .data-grid-row>.cell{user-select:none}&:has(.selection){user-select:none}.data-grid-row.row-focus{background-color:var(--tbw-focus-background, rgba(from var(--tbw-color-accent) r g b / 12%));outline:none;position:relative;&:after{content:"";position:absolute;inset:0;pointer-events:none;border-width:0;border-style:var(--tbw-selection-border-style, var(--tbw-border-style));border-color:var(--tbw-range-border-color, var(--tbw-color-accent));border-top-width:var(--tbw-selection-border-width, var(--tbw-border-width));border-bottom-width:var(--tbw-selection-border-width, var(--tbw-border-width));z-index:1}+.data-grid-row.row-focus:after{border-top-width:0}&:has(+.data-grid-row.row-focus):after{border-bottom-width:0}}&[data-selection-mode=row] .cell-focus,&[data-selection-mode=row] .row-focus,&[data-selection-mode=range] .cell-focus{outline:none}.data-grid-row>.cell.selected{background-color:var(--tbw-range-selection-bg);position:relative;&:after{content:"";position:absolute;inset:0;pointer-events:none;border:0 var(--tbw-selection-border-style, var(--tbw-border-style)) var(--tbw-range-border-color);z-index:1}&.top:after{border-top-width:var(--tbw-selection-border-width, var(--tbw-border-width))}&.bottom:after{border-bottom-width:var(--tbw-selection-border-width, var(--tbw-border-width))}&.first:after{border-left-width:var(--tbw-selection-border-width, var(--tbw-border-width))}&.last:after{border-right-width:var(--tbw-selection-border-width, var(--tbw-border-width))}}.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}.data-grid-row>.cell[data-field=__tbw_checkbox],.header-row>.cell[data-field=__tbw_checkbox]{text-align:center;cursor:pointer;padding:0;display:flex;align-items:center;justify-content:center}.tbw-select-row-checkbox{pointer-events:none;margin:0;cursor:pointer}.tbw-checkbox-header{display:flex;justify-content:center;align-items:center;height:100%}.tbw-select-all-checkbox{margin:0;cursor:pointer}}}', Ye = "__tbw_checkbox";
5096
+ function an(s, e, t) {
5008
5097
  if (s === "cell" && e.selectedCell)
5009
5098
  return {
5010
5099
  mode: s,
@@ -5016,17 +5105,21 @@ function Qi(s, e, t) {
5016
5105
  ]
5017
5106
  };
5018
5107
  if (s === "row" && e.selected.size > 0) {
5019
- const i = [...e.selected].map((n) => ({
5020
- from: { row: n, col: 0 },
5021
- to: { row: n, col: t - 1 }
5022
- }));
5023
- return { mode: s, ranges: i };
5108
+ const i = [...e.selected].sort((a, l) => a - l), n = [];
5109
+ let r = i[0], o = r;
5110
+ for (let a = 1; a < i.length; a++)
5111
+ i[a] === o + 1 ? o = i[a] : (n.push({ from: { row: r, col: 0 }, to: { row: o, col: t - 1 } }), r = i[a], o = r);
5112
+ return n.push({ from: { row: r, col: 0 }, to: { row: o, col: t - 1 } }), { mode: s, ranges: n };
5024
5113
  }
5025
- return s === "range" && e.ranges.length > 0 ? { mode: s, ranges: lt(e.ranges) } : { mode: s, ranges: [] };
5114
+ return s === "range" && e.ranges.length > 0 ? { mode: s, ranges: ut(e.ranges) } : { mode: s, ranges: [] };
5026
5115
  }
5027
- class _n extends _ {
5116
+ class Nn extends _ {
5028
5117
  static manifest = {
5029
- queries: [{ type: "getSelection", description: "Get the current selection state" }],
5118
+ queries: [
5119
+ { type: "getSelection", description: "Get the current selection state" },
5120
+ { type: "selectRows", description: "Select specific rows by index (row mode only)" },
5121
+ { type: "getSelectedRowIndices", description: "Get sorted array of selected row indices" }
5122
+ ],
5030
5123
  configRules: [
5031
5124
  {
5032
5125
  id: "selection/range-dblclick",
@@ -5039,7 +5132,7 @@ class _n extends _ {
5039
5132
  ]
5040
5133
  };
5041
5134
  name = "selection";
5042
- styles = Zi;
5135
+ styles = sn;
5043
5136
  get defaultConfig() {
5044
5137
  return {
5045
5138
  mode: "cell",
@@ -5056,6 +5149,9 @@ class _n extends _ {
5056
5149
  isDragging = !1;
5057
5150
  pendingKeyboardUpdate = null;
5058
5151
  selectedCell = null;
5152
+ lastSyncedFocusRow = -1;
5153
+ lastSyncedFocusCol = -1;
5154
+ explicitSelection = !1;
5059
5155
  isSelectionEnabled() {
5060
5156
  return this.config.enabled === !1 ? !1 : this.grid.effectiveConfig?.selectable !== !1;
5061
5157
  }
@@ -5079,33 +5175,53 @@ class _n extends _ {
5079
5175
  handleQuery(e) {
5080
5176
  if (e.type === "getSelection")
5081
5177
  return this.getSelection();
5178
+ if (e.type === "getSelectedRowIndices")
5179
+ return this.getSelectedRowIndices();
5180
+ if (e.type === "selectRows")
5181
+ return this.selectRows(e.context), !0;
5082
5182
  }
5083
5183
  detach() {
5084
- this.selected.clear(), this.ranges = [], this.activeRange = null, this.cellAnchor = null, this.isDragging = !1, this.selectedCell = null, this.pendingKeyboardUpdate = null;
5184
+ this.selected.clear(), this.ranges = [], this.activeRange = null, this.cellAnchor = null, this.isDragging = !1, this.selectedCell = null, this.pendingKeyboardUpdate = null, this.lastSyncedFocusRow = -1, this.lastSyncedFocusCol = -1;
5085
5185
  }
5086
5186
  clearSelectionSilent() {
5087
- this.selected.clear(), this.ranges = [], this.activeRange = null, this.cellAnchor = null, this.selectedCell = null, this.lastSelected = null, this.anchor = null, this.requestAfterRender();
5187
+ this.selected.clear(), this.ranges = [], this.activeRange = null, this.cellAnchor = null, this.selectedCell = null, this.lastSelected = null, this.anchor = null, this.lastSyncedFocusRow = -1, this.lastSyncedFocusCol = -1, this.requestAfterRender();
5088
5188
  }
5089
5189
  onCellClick(e) {
5090
5190
  if (!this.isSelectionEnabled()) return !1;
5091
5191
  const { rowIndex: t, colIndex: i, originalEvent: n } = e, { mode: r, triggerOn: o = "click" } = this.config;
5092
5192
  if (n.type !== o)
5093
5193
  return !1;
5094
- const a = this.columns[i], l = a && H(a);
5194
+ const a = this.columns[i], l = a && G(a);
5095
5195
  if (r === "cell") {
5096
5196
  if (l || !this.isCellSelectable(t, i))
5097
5197
  return !1;
5098
5198
  const d = this.selectedCell;
5099
- return d && d.row === t && d.col === i || (this.selectedCell = { row: t, col: i }, this.emit("selection-change", this.#e()), this.requestAfterRender()), !1;
5199
+ return d && d.row === t && d.col === i || (this.selectedCell = { row: t, col: i }, this.emit("selection-change", this.#i()), this.requestAfterRender()), !1;
5200
+ }
5201
+ if (r === "row") {
5202
+ if (!this.isRowSelectable(t))
5203
+ return !1;
5204
+ const d = n.shiftKey, c = n.ctrlKey || n.metaKey, u = a?.meta?.checkboxColumn === !0;
5205
+ if (d && this.anchor !== null) {
5206
+ const h = Math.min(this.anchor, t), f = Math.max(this.anchor, t);
5207
+ c || this.selected.clear();
5208
+ for (let g = h; g <= f; g++)
5209
+ this.isRowSelectable(g) && this.selected.add(g);
5210
+ } else if (c || u)
5211
+ this.selected.has(t) ? this.selected.delete(t) : this.selected.add(t), this.anchor = t;
5212
+ else {
5213
+ if (this.selected.size === 1 && this.selected.has(t))
5214
+ return !1;
5215
+ this.selected.clear(), this.selected.add(t), this.anchor = t;
5216
+ }
5217
+ return this.lastSelected = t, this.explicitSelection = !0, this.emit("selection-change", this.#i()), this.requestAfterRender(), !1;
5100
5218
  }
5101
- if (r === "row")
5102
- return !this.isRowSelectable(t) || this.selected.size === 1 && this.selected.has(t) || (this.selected.clear(), this.selected.add(t), this.lastSelected = t, this.emit("selection-change", this.#e()), this.requestAfterRender()), !1;
5103
5219
  if (r === "range") {
5104
5220
  if (l || !this.isCellSelectable(t, i))
5105
5221
  return !1;
5106
5222
  const d = n.shiftKey, c = n.ctrlKey || n.metaKey;
5107
5223
  if (d && this.cellAnchor) {
5108
- const u = de(this.cellAnchor, { row: t, col: i }), h = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null;
5224
+ const u = ce(this.cellAnchor, { row: t, col: i }), h = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null;
5109
5225
  if (h && Q(h, u))
5110
5226
  return !1;
5111
5227
  c ? this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] = u : this.ranges.push(u) : this.ranges = [u], this.activeRange = u;
@@ -5128,7 +5244,7 @@ class _n extends _ {
5128
5244
  return !1;
5129
5245
  this.ranges = [u], this.activeRange = u, this.cellAnchor = { row: t, col: i };
5130
5246
  }
5131
- return this.emit("selection-change", this.#e()), this.requestAfterRender(), !1;
5247
+ return this.emit("selection-change", this.#i()), this.requestAfterRender(), !1;
5132
5248
  }
5133
5249
  return !1;
5134
5250
  }
@@ -5136,40 +5252,40 @@ class _n extends _ {
5136
5252
  if (!this.isSelectionEnabled()) return !1;
5137
5253
  const { mode: t } = this.config, n = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "Tab", "Home", "End", "PageUp", "PageDown"].includes(e.key);
5138
5254
  if (e.key === "Escape")
5139
- 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.#e()), this.requestAfterRender(), !0;
5255
+ return this.grid.query("isEditing").some(Boolean) ? !1 : (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.#i()), this.requestAfterRender(), !0);
5140
5256
  if (t === "cell" && n)
5141
5257
  return queueMicrotask(() => {
5142
5258
  const r = this.grid._focusRow, o = this.grid._focusCol;
5143
- this.isCellSelectable(r, o) ? this.selectedCell = { row: r, col: o } : this.selectedCell = null, this.emit("selection-change", this.#e()), this.requestAfterRender();
5144
- }), !1;
5145
- if (t === "row" && (e.key === "ArrowUp" || e.key === "ArrowDown"))
5146
- return queueMicrotask(() => {
5147
- const r = this.grid._focusRow;
5148
- this.isRowSelectable(r) ? (this.selected.clear(), this.selected.add(r), this.lastSelected = r) : this.selected.clear(), this.emit("selection-change", this.#e()), this.requestAfterRender();
5259
+ this.isCellSelectable(r, o) ? this.selectedCell = { row: r, col: o } : this.selectedCell = null, this.emit("selection-change", this.#i()), this.requestAfterRender();
5149
5260
  }), !1;
5261
+ if (t === "row") {
5262
+ if (e.key === "ArrowUp" || e.key === "ArrowDown") {
5263
+ const r = e.shiftKey;
5264
+ return r && this.anchor === null && (this.anchor = this.grid._focusRow), queueMicrotask(() => {
5265
+ const o = this.grid._focusRow;
5266
+ if (r && this.anchor !== null) {
5267
+ this.selected.clear();
5268
+ const a = Math.min(this.anchor, o), l = Math.max(this.anchor, o);
5269
+ for (let d = a; d <= l; d++)
5270
+ this.isRowSelectable(d) && this.selected.add(d);
5271
+ } else
5272
+ this.isRowSelectable(o) ? (this.selected.clear(), this.selected.add(o), this.anchor = o) : this.selected.clear();
5273
+ this.lastSelected = o, this.explicitSelection = !0, this.emit("selection-change", this.#i()), this.requestAfterRender();
5274
+ }), !1;
5275
+ }
5276
+ if (e.key === "a" && (e.ctrlKey || e.metaKey))
5277
+ return e.preventDefault(), e.stopPropagation(), this.selectAll(), !0;
5278
+ }
5150
5279
  if (t === "range" && n) {
5151
5280
  const r = e.key === "Tab", o = e.shiftKey && !r;
5152
5281
  return o && !this.cellAnchor && (this.cellAnchor = { row: this.grid._focusRow, col: this.grid._focusCol }), this.pendingKeyboardUpdate = { shiftKey: o }, queueMicrotask(() => this.requestAfterRender()), !1;
5153
5282
  }
5154
- if (t === "range" && e.key === "a" && (e.ctrlKey || e.metaKey)) {
5155
- const r = this.rows.length, o = this.columns.length;
5156
- if (r > 0 && o > 0) {
5157
- e.preventDefault(), e.stopPropagation();
5158
- const a = {
5159
- startRow: 0,
5160
- startCol: 0,
5161
- endRow: r - 1,
5162
- endCol: o - 1
5163
- };
5164
- return this.ranges = [a], this.activeRange = a, this.emit("selection-change", this.#e()), this.requestAfterRender(), !0;
5165
- }
5166
- }
5167
- return !1;
5283
+ return t === "range" && e.key === "a" && (e.ctrlKey || e.metaKey) ? (e.preventDefault(), e.stopPropagation(), this.selectAll(), !0) : !1;
5168
5284
  }
5169
5285
  onCellMouseDown(e) {
5170
5286
  if (!this.isSelectionEnabled() || this.config.mode !== "range" || e.rowIndex === void 0 || e.colIndex === void 0 || e.rowIndex < 0) return;
5171
5287
  const t = this.columns[e.colIndex];
5172
- if (t && H(t) || !this.isCellSelectable(e.rowIndex, e.colIndex) || e.originalEvent.shiftKey && this.cellAnchor)
5288
+ if (t && G(t) || !this.isCellSelectable(e.rowIndex, e.colIndex) || e.originalEvent.shiftKey && this.cellAnchor)
5173
5289
  return;
5174
5290
  this.isDragging = !0;
5175
5291
  const i = e.rowIndex, n = e.colIndex, r = e.originalEvent.ctrlKey || e.originalEvent.metaKey, o = {
@@ -5178,24 +5294,104 @@ class _n extends _ {
5178
5294
  endRow: i,
5179
5295
  endCol: n
5180
5296
  };
5181
- return !r && this.ranges.length === 1 && Q(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.#e()), this.requestAfterRender(), !0);
5297
+ return !r && this.ranges.length === 1 && Q(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.#i()), this.requestAfterRender(), !0);
5182
5298
  }
5183
5299
  onCellMouseMove(e) {
5184
5300
  if (!this.isSelectionEnabled() || this.config.mode !== "range" || !this.isDragging || !this.cellAnchor || e.rowIndex === void 0 || e.colIndex === void 0 || e.rowIndex < 0) return;
5185
5301
  let t = e.colIndex;
5186
5302
  const i = this.columns[t];
5187
- if (i && H(i)) {
5188
- const o = this.columns.findIndex((a) => !H(a));
5303
+ if (i && G(i)) {
5304
+ const o = this.columns.findIndex((a) => !G(a));
5189
5305
  o >= 0 && (t = o);
5190
5306
  }
5191
- const n = de(this.cellAnchor, { row: e.rowIndex, col: t }), r = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null;
5192
- return r && Q(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.#e()), this.requestAfterRender()), !0;
5307
+ const n = ce(this.cellAnchor, { row: e.rowIndex, col: t }), r = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null;
5308
+ return r && Q(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.#i()), this.requestAfterRender()), !0;
5193
5309
  }
5194
5310
  onCellMouseUp(e) {
5195
5311
  if (this.isSelectionEnabled() && this.config.mode === "range" && this.isDragging)
5196
5312
  return this.isDragging = !1, !0;
5197
5313
  }
5314
+ processColumns(e) {
5315
+ if (this.config.checkbox && this.config.mode === "row") {
5316
+ if (e.some((r) => r.field === Ye))
5317
+ return e;
5318
+ const t = this.#t(), i = e.findIndex(ie), n = i >= 0 ? i + 1 : 0;
5319
+ return [...e.slice(0, n), t, ...e.slice(n)];
5320
+ }
5321
+ return e;
5322
+ }
5198
5323
  #t() {
5324
+ return {
5325
+ field: Ye,
5326
+ header: "",
5327
+ width: 32,
5328
+ resizable: !1,
5329
+ sortable: !1,
5330
+ meta: {
5331
+ lockPosition: !0,
5332
+ suppressMovable: !0,
5333
+ utility: !0,
5334
+ checkboxColumn: !0
5335
+ },
5336
+ headerRenderer: () => {
5337
+ const e = document.createElement("div");
5338
+ e.className = "tbw-checkbox-header";
5339
+ const t = document.createElement("input");
5340
+ return t.type = "checkbox", t.className = "tbw-select-all-checkbox", t.addEventListener("click", (i) => {
5341
+ i.stopPropagation(), i.target.checked ? this.selectAll() : this.clearSelection();
5342
+ }), e.appendChild(t), e;
5343
+ },
5344
+ renderer: (e) => {
5345
+ const t = document.createElement("input");
5346
+ t.type = "checkbox", t.className = "tbw-select-row-checkbox";
5347
+ const i = e.cellEl;
5348
+ if (i) {
5349
+ const n = parseInt(i.getAttribute("data-row") ?? "-1", 10);
5350
+ n >= 0 && (t.checked = this.selected.has(n));
5351
+ }
5352
+ return t;
5353
+ }
5354
+ };
5355
+ }
5356
+ #e(e) {
5357
+ e.querySelectorAll(".tbw-select-row-checkbox").forEach((n) => {
5358
+ const r = n.closest(".cell"), o = r ? Ce(r) : -1;
5359
+ o >= 0 && (n.checked = this.selected.has(o));
5360
+ });
5361
+ const i = e.querySelector(".tbw-select-all-checkbox");
5362
+ if (i) {
5363
+ const n = this.rows.length;
5364
+ let r = 0;
5365
+ if (this.config.isSelectable)
5366
+ for (let l = 0; l < n; l++)
5367
+ this.isRowSelectable(l) && r++;
5368
+ else
5369
+ r = n;
5370
+ const o = r > 0 && this.selected.size >= r, a = this.selected.size > 0;
5371
+ i.checked = o, i.indeterminate = a && !o;
5372
+ }
5373
+ }
5374
+ #o(e) {
5375
+ const t = this.grid._focusRow, i = this.grid._focusCol;
5376
+ if (e === "row") {
5377
+ if (this.explicitSelection) {
5378
+ this.explicitSelection = !1, this.lastSyncedFocusRow = t;
5379
+ return;
5380
+ }
5381
+ t !== this.lastSyncedFocusRow && (this.lastSyncedFocusRow = t, this.isRowSelectable(t) && (!this.selected.has(t) || this.selected.size !== 1) && (this.selected.clear(), this.selected.add(t), this.lastSelected = t, this.anchor = t, this.emit("selection-change", this.#i())));
5382
+ }
5383
+ if (e === "cell") {
5384
+ if (this.explicitSelection) {
5385
+ this.explicitSelection = !1, this.lastSyncedFocusRow = t, this.lastSyncedFocusCol = i;
5386
+ return;
5387
+ }
5388
+ if ((t !== this.lastSyncedFocusRow || i !== this.lastSyncedFocusCol) && (this.lastSyncedFocusRow = t, this.lastSyncedFocusCol = i, this.isCellSelectable(t, i))) {
5389
+ const n = this.selectedCell;
5390
+ (!n || n.row !== t || n.col !== i) && (this.selectedCell = { row: t, col: i }, this.emit("selection-change", this.#i()));
5391
+ }
5392
+ }
5393
+ }
5394
+ #r() {
5199
5395
  const e = this.gridElement;
5200
5396
  if (!e) return;
5201
5397
  const { mode: t } = this.config, i = !!this.config.isSelectable;
@@ -5205,26 +5401,27 @@ class _n extends _ {
5205
5401
  const r = e.querySelectorAll(".data-grid-row");
5206
5402
  if (r.forEach((o) => {
5207
5403
  o.classList.remove("selected", "row-focus"), i && o.removeAttribute("data-selectable");
5208
- }), t === "row" && (xe(e), r.forEach((o) => {
5209
- const a = o.querySelector(".cell[data-row]"), l = wt(a);
5404
+ }), t === "row" && (Ee(e), r.forEach((o) => {
5405
+ const a = o.querySelector(".cell[data-row]"), l = Ce(a);
5210
5406
  l >= 0 && (i && !this.isRowSelectable(l) && o.setAttribute("data-selectable", "false"), this.selected.has(l) && o.classList.add("selected", "row-focus"));
5211
- })), (t === "cell" || t === "range") && i && e.querySelectorAll(".cell[data-row][data-col]").forEach((a) => {
5407
+ }), this.config.checkbox && this.#e(e)), (t === "cell" || t === "range") && i && e.querySelectorAll(".cell[data-row][data-col]").forEach((a) => {
5212
5408
  const l = parseInt(a.getAttribute("data-row") ?? "-1", 10), d = parseInt(a.getAttribute("data-col") ?? "-1", 10);
5213
5409
  l >= 0 && d >= 0 && (this.isCellSelectable(l, d) || a.setAttribute("data-selectable", "false"));
5214
5410
  }), t === "range" && this.ranges.length > 0) {
5215
- xe(e);
5216
- const o = this.activeRange ? $(this.activeRange) : null, a = this.columns.findIndex((d) => !H(d));
5217
- this.columns.length - 1, e.querySelectorAll(".cell[data-row][data-col]").forEach((d) => {
5411
+ Ee(e);
5412
+ const o = this.ranges.map($), a = (d, c) => {
5413
+ for (const u of o)
5414
+ if (d >= u.startRow && d <= u.endRow && c >= u.startCol && c <= u.endCol)
5415
+ return !0;
5416
+ return !1;
5417
+ };
5418
+ e.querySelectorAll(".cell[data-row][data-col]").forEach((d) => {
5218
5419
  const c = parseInt(d.getAttribute("data-row") ?? "-1", 10), u = parseInt(d.getAttribute("data-col") ?? "-1", 10);
5219
5420
  if (c >= 0 && u >= 0) {
5220
5421
  const h = this.columns[u];
5221
- if (h && H(h))
5422
+ if (h && G(h))
5222
5423
  return;
5223
- if (je(c, u, this.ranges) && (d.classList.add("selected"), o)) {
5224
- c === o.startRow && d.classList.add("top"), c === o.endRow && d.classList.add("bottom");
5225
- const g = Math.max(o.startCol, a);
5226
- u === g && d.classList.add("first"), u === o.endCol && d.classList.add("last");
5227
- }
5424
+ a(c, u) && (d.classList.add("selected"), a(c - 1, u) || d.classList.add("top"), a(c + 1, u) || d.classList.add("bottom"), a(c, u - 1) || d.classList.add("first"), a(c, u + 1) || d.classList.add("last"));
5228
5425
  }
5229
5426
  });
5230
5427
  }
@@ -5239,28 +5436,59 @@ class _n extends _ {
5239
5436
  this.pendingKeyboardUpdate = null;
5240
5437
  const r = this.grid._focusRow, o = this.grid._focusCol;
5241
5438
  if (n && this.cellAnchor) {
5242
- const a = de(this.cellAnchor, { row: r, col: o });
5439
+ const a = ce(this.cellAnchor, { row: r, col: o });
5243
5440
  this.ranges = [a], this.activeRange = a;
5244
5441
  } else n || (this.ranges = [], this.activeRange = null, this.cellAnchor = { row: r, col: o });
5245
- this.emit("selection-change", this.#e());
5442
+ this.emit("selection-change", this.#i());
5246
5443
  }
5247
- this.grid.setAttribute("data-selection-mode", i), t && t.classList.toggle("selecting", this.isDragging), this.#t();
5444
+ this.#o(i), this.grid.setAttribute("data-selection-mode", i), t && t.classList.toggle("selecting", this.isDragging), this.#r();
5248
5445
  }
5249
5446
  onScrollRender() {
5250
- this.isSelectionEnabled() && this.#t();
5447
+ this.isSelectionEnabled() && this.#r();
5251
5448
  }
5252
5449
  getSelection() {
5253
5450
  return {
5254
5451
  mode: this.config.mode,
5255
- ranges: this.#e().ranges,
5452
+ ranges: this.#i().ranges,
5256
5453
  anchor: this.cellAnchor
5257
5454
  };
5258
5455
  }
5259
5456
  getSelectedCells() {
5260
- return Xi(this.ranges);
5457
+ return on(this.ranges);
5261
5458
  }
5262
5459
  isCellSelected(e, t) {
5263
- return je(e, t, this.ranges);
5460
+ return nn(e, t, this.ranges);
5461
+ }
5462
+ selectAll() {
5463
+ const { mode: e } = this.config;
5464
+ if (e === "row") {
5465
+ this.selected.clear();
5466
+ for (let t = 0; t < this.rows.length; t++)
5467
+ this.isRowSelectable(t) && this.selected.add(t);
5468
+ this.explicitSelection = !0, this.emit("selection-change", this.#i()), this.requestAfterRender();
5469
+ } else if (e === "range") {
5470
+ const t = this.rows.length, i = this.columns.length;
5471
+ if (t > 0 && i > 0) {
5472
+ const n = {
5473
+ startRow: 0,
5474
+ startCol: 0,
5475
+ endRow: t - 1,
5476
+ endCol: i - 1
5477
+ };
5478
+ this.ranges = [n], this.activeRange = n, this.emit("selection-change", this.#i()), this.requestAfterRender();
5479
+ }
5480
+ }
5481
+ }
5482
+ selectRows(e) {
5483
+ if (this.config.mode === "row") {
5484
+ this.selected.clear();
5485
+ for (const t of e)
5486
+ t >= 0 && t < this.rows.length && this.isRowSelectable(t) && this.selected.add(t);
5487
+ this.anchor = e.length > 0 ? e[e.length - 1] : null, this.explicitSelection = !0, this.emit("selection-change", this.#i()), this.requestAfterRender();
5488
+ }
5489
+ }
5490
+ getSelectedRowIndices() {
5491
+ return [...this.selected].sort((e, t) => e - t);
5264
5492
  }
5265
5493
  clearSelection() {
5266
5494
  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();
@@ -5273,11 +5501,11 @@ class _n extends _ {
5273
5501
  endCol: t.to.col
5274
5502
  })), this.activeRange = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null, this.emit("selection-change", {
5275
5503
  mode: this.config.mode,
5276
- ranges: lt(this.ranges)
5504
+ ranges: ut(this.ranges)
5277
5505
  }), this.requestAfterRender();
5278
5506
  }
5279
- #e() {
5280
- return Qi(
5507
+ #i() {
5508
+ return an(
5281
5509
  this.config.mode,
5282
5510
  {
5283
5511
  selectedCell: this.selectedCell,
@@ -5288,23 +5516,23 @@ class _n extends _ {
5288
5516
  );
5289
5517
  }
5290
5518
  }
5291
- function ee(s, e) {
5519
+ function te(s, e) {
5292
5520
  return Math.floor(s / e);
5293
5521
  }
5294
- function Ji(s, e) {
5522
+ function ln(s, e) {
5295
5523
  return {
5296
5524
  start: s * e,
5297
5525
  end: (s + 1) * e
5298
5526
  };
5299
5527
  }
5300
- function en(s, e, t) {
5301
- const i = ee(s, t), n = ee(e - 1, t), r = [];
5528
+ function dn(s, e, t) {
5529
+ const i = te(s, t), n = te(e - 1, t), r = [];
5302
5530
  for (let o = i; o <= n; o++)
5303
5531
  r.push(o);
5304
5532
  return r;
5305
5533
  }
5306
- async function Ue(s, e, t, i) {
5307
- const n = Ji(e, t);
5534
+ async function Xe(s, e, t, i) {
5535
+ const n = ln(e, t);
5308
5536
  return s.getRows({
5309
5537
  startRow: n.start,
5310
5538
  endRow: n.end,
@@ -5312,14 +5540,14 @@ async function Ue(s, e, t, i) {
5312
5540
  filterModel: i.filterModel
5313
5541
  });
5314
5542
  }
5315
- function tn(s, e, t) {
5316
- const i = ee(s, e), n = t.get(i);
5543
+ function cn(s, e, t) {
5544
+ const i = te(s, e), n = t.get(i);
5317
5545
  if (!n) return;
5318
5546
  const r = s % e;
5319
5547
  return n[r];
5320
5548
  }
5321
- const nn = 100;
5322
- class Tn extends _ {
5549
+ const un = 100;
5550
+ class qn extends _ {
5323
5551
  name = "serverSide";
5324
5552
  get defaultConfig() {
5325
5553
  return {
@@ -5339,12 +5567,12 @@ class Tn extends _ {
5339
5567
  }
5340
5568
  loadRequiredBlocks() {
5341
5569
  if (!this.dataSource) return;
5342
- const e = this.grid, t = this.config.cacheBlockSize ?? 100, i = { startRow: e._virtualization.start, endRow: e._virtualization.end }, n = en(i.startRow, i.endRow, t);
5570
+ const e = this.grid, t = this.config.cacheBlockSize ?? 100, i = { startRow: e._virtualization.start, endRow: e._virtualization.end }, n = dn(i.startRow, i.endRow, t);
5343
5571
  for (const r of n)
5344
5572
  if (!(this.loadedBlocks.has(r) || this.loadingBlocks.has(r))) {
5345
5573
  if (this.loadingBlocks.size >= (this.config.maxConcurrentRequests ?? 2))
5346
5574
  break;
5347
- this.loadingBlocks.add(r), Ue(this.dataSource, r, t, {}).then((o) => {
5575
+ this.loadingBlocks.add(r), Xe(this.dataSource, r, t, {}).then((o) => {
5348
5576
  this.loadedBlocks.set(r, o.rows), this.totalRowCount = o.totalRowCount, this.loadingBlocks.delete(r), this.requestRender(), this.loadRequiredBlocks();
5349
5577
  }).catch(() => {
5350
5578
  this.loadingBlocks.delete(r);
@@ -5355,7 +5583,7 @@ class Tn extends _ {
5355
5583
  if (!this.dataSource) return [...e];
5356
5584
  const t = [];
5357
5585
  for (let i = 0; i < this.totalRowCount; i++) {
5358
- const n = tn(i, this.config.cacheBlockSize ?? 100, this.loadedBlocks);
5586
+ const n = cn(i, this.config.cacheBlockSize ?? 100, this.loadedBlocks);
5359
5587
  t.push(n ?? { __loading: !0, __index: i });
5360
5588
  }
5361
5589
  return t;
@@ -5363,12 +5591,12 @@ class Tn extends _ {
5363
5591
  onScroll(e) {
5364
5592
  this.dataSource && (this.loadRequiredBlocks(), this.scrollDebounceTimer && clearTimeout(this.scrollDebounceTimer), this.scrollDebounceTimer = setTimeout(() => {
5365
5593
  this.loadRequiredBlocks();
5366
- }, nn));
5594
+ }, un));
5367
5595
  }
5368
5596
  setDataSource(e) {
5369
5597
  this.dataSource = e, this.loadedBlocks.clear(), this.loadingBlocks.clear();
5370
5598
  const t = this.config.cacheBlockSize ?? 100;
5371
- Ue(e, 0, t, {}).then((i) => {
5599
+ Xe(e, 0, t, {}).then((i) => {
5372
5600
  this.loadedBlocks.set(0, i.rows), this.totalRowCount = i.totalRowCount, this.requestRender();
5373
5601
  });
5374
5602
  }
@@ -5382,59 +5610,59 @@ class Tn extends _ {
5382
5610
  return this.totalRowCount;
5383
5611
  }
5384
5612
  isRowLoaded(e) {
5385
- const t = this.config.cacheBlockSize ?? 100, i = ee(e, t);
5613
+ const t = this.config.cacheBlockSize ?? 100, i = te(e, t);
5386
5614
  return this.loadedBlocks.has(i);
5387
5615
  }
5388
5616
  getLoadedBlockCount() {
5389
5617
  return this.loadedBlocks.size;
5390
5618
  }
5391
5619
  }
5392
- function dt(s, e, t) {
5620
+ function ht(s, e, t) {
5393
5621
  return s.id !== void 0 ? String(s.id) : t ? `${t}-${e}` : String(e);
5394
5622
  }
5395
- function ce(s, e) {
5623
+ function ue(s, e) {
5396
5624
  const t = new Set(s);
5397
5625
  return t.has(e) ? t.delete(e) : t.add(e), t;
5398
5626
  }
5399
- function ge(s, e, t = null, i = 0) {
5627
+ function me(s, e, t = null, i = 0) {
5400
5628
  const n = e.childrenField ?? "children", r = /* @__PURE__ */ new Set();
5401
5629
  for (let o = 0; o < s.length; o++) {
5402
- const a = s[o], l = dt(a, o, t), d = a[n];
5630
+ const a = s[o], l = ht(a, o, t), d = a[n];
5403
5631
  if (Array.isArray(d) && d.length > 0) {
5404
5632
  r.add(l);
5405
- const c = ge(d, e, l, i + 1);
5633
+ const c = me(d, e, l, i + 1);
5406
5634
  for (const u of c) r.add(u);
5407
5635
  }
5408
5636
  }
5409
5637
  return r;
5410
5638
  }
5411
- function rn() {
5639
+ function hn() {
5412
5640
  return /* @__PURE__ */ new Set();
5413
5641
  }
5414
- function ct(s, e, t, i = null, n = 0) {
5642
+ function ft(s, e, t, i = null, n = 0) {
5415
5643
  const r = t.childrenField ?? "children";
5416
5644
  for (let o = 0; o < s.length; o++) {
5417
- const a = s[o], l = dt(a, o, i);
5645
+ const a = s[o], l = ht(a, o, i);
5418
5646
  if (l === e)
5419
5647
  return [l];
5420
5648
  const d = a[r];
5421
5649
  if (Array.isArray(d) && d.length > 0) {
5422
- const c = ct(d, e, t, l, n + 1);
5650
+ const c = ft(d, e, t, l, n + 1);
5423
5651
  if (c)
5424
5652
  return [l, ...c];
5425
5653
  }
5426
5654
  }
5427
5655
  return null;
5428
5656
  }
5429
- function on(s, e, t, i) {
5430
- const n = ct(s, e, t);
5657
+ function fn(s, e, t, i) {
5658
+ const n = ft(s, e, t);
5431
5659
  if (!n) return i;
5432
5660
  const r = new Set(i);
5433
5661
  for (let o = 0; o < n.length - 1; o++)
5434
5662
  r.add(n[o]);
5435
5663
  return r;
5436
5664
  }
5437
- function Ye(s, e = "children") {
5665
+ function Ze(s, e = "children") {
5438
5666
  if (!Array.isArray(s) || s.length === 0) return !1;
5439
5667
  for (const t of s) {
5440
5668
  if (!t) continue;
@@ -5444,7 +5672,7 @@ function Ye(s, e = "children") {
5444
5672
  }
5445
5673
  return !1;
5446
5674
  }
5447
- function sn(s) {
5675
+ function gn(s) {
5448
5676
  if (!Array.isArray(s) || s.length === 0) return null;
5449
5677
  const e = ["children", "items", "nodes", "subRows", "nested"];
5450
5678
  for (const t of s)
@@ -5456,8 +5684,8 @@ function sn(s) {
5456
5684
  }
5457
5685
  return null;
5458
5686
  }
5459
- const an = "@layer tbw-plugins{tbw-grid{.cell[data-field=__tbw_expander]{border-inline-end: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-inline-start: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}}}";
5460
- class Ln extends _ {
5687
+ const pn = "@layer tbw-plugins{tbw-grid{.cell[data-field=__tbw_expander]{border-inline-end: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-inline-start: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}}}";
5688
+ class Hn extends _ {
5461
5689
  static manifest = {
5462
5690
  events: [
5463
5691
  {
@@ -5473,7 +5701,7 @@ class Ln extends _ {
5473
5701
  ]
5474
5702
  };
5475
5703
  name = "tree";
5476
- styles = an;
5704
+ styles = pn;
5477
5705
  get defaultConfig() {
5478
5706
  return {
5479
5707
  childrenField: "children",
@@ -5506,15 +5734,15 @@ class Ln extends _ {
5506
5734
  }
5507
5735
  detect(e) {
5508
5736
  if (!this.config.autoDetect) return !1;
5509
- const t = e, i = this.config.childrenField ?? sn(t) ?? "children";
5510
- return Ye(t, i);
5737
+ const t = e, i = this.config.childrenField ?? gn(t) ?? "children";
5738
+ return Ze(t, i);
5511
5739
  }
5512
5740
  processRows(e) {
5513
5741
  const t = this.config.childrenField ?? "children", i = e;
5514
- if (!Ye(i, t))
5742
+ if (!Ze(i, t))
5515
5743
  return this.flattenedRows = [], this.rowKeyMap.clear(), this.previousVisibleKeys.clear(), [...e];
5516
5744
  let n = this.withStableKeys(i);
5517
- this.sortState && (n = this.sortTree(n, this.sortState.field, this.sortState.direction)), this.config.defaultExpanded && !this.initialExpansionDone && (this.expandedKeys = ge(n, this.config), this.initialExpansionDone = !0), this.flattenedRows = this.flattenTree(n, this.expandedKeys), this.rowKeyMap.clear(), this.keysToAnimate.clear();
5745
+ this.sortState && (n = this.sortTree(n, this.sortState.field, this.sortState.direction)), this.config.defaultExpanded && !this.initialExpansionDone && (this.expandedKeys = me(n, this.config), this.initialExpansionDone = !0), this.flattenedRows = this.flattenTree(n, this.expandedKeys), this.rowKeyMap.clear(), this.keysToAnimate.clear();
5518
5746
  const r = /* @__PURE__ */ new Set();
5519
5747
  for (const o of this.flattenedRows)
5520
5748
  this.rowKeyMap.set(o.key, o), r.add(o.key), !this.previousVisibleKeys.has(o.key) && o.depth > 0 && this.keysToAnimate.add(o.key);
@@ -5570,19 +5798,19 @@ class Ln extends _ {
5570
5798
  const { row: c, value: u } = d, { showExpandIcons: h = !0, indentWidth: f } = r(), g = c, p = g.__treeDepth ?? 0, w = document.createElement("span");
5571
5799
  if (w.className = "tree-cell-wrapper", w.style.setProperty("--tbw-tree-depth", String(p)), f !== void 0 && w.style.setProperty("--tbw-tree-indent-width", `${f}px`), h)
5572
5800
  if (g.__treeHasChildren) {
5573
- const y = document.createElement("span");
5574
- y.className = `tree-toggle${g.__treeExpanded ? " expanded" : ""}`, o(y, a(g.__treeExpanded ? "collapse" : "expand")), y.setAttribute("data-tree-key", String(g.__treeKey ?? "")), w.appendChild(y);
5801
+ const E = document.createElement("span");
5802
+ E.className = `tree-toggle${g.__treeExpanded ? " expanded" : ""}`, o(E, a(g.__treeExpanded ? "collapse" : "expand")), E.setAttribute("data-tree-key", String(g.__treeKey ?? "")), w.appendChild(E);
5575
5803
  } else {
5576
- const y = document.createElement("span");
5577
- y.className = "tree-spacer", w.appendChild(y);
5804
+ const E = document.createElement("span");
5805
+ E.className = "tree-spacer", w.appendChild(E);
5578
5806
  }
5579
- const b = document.createElement("span");
5580
- if (b.className = "tree-content", n) {
5581
- const y = n(d);
5582
- y instanceof Node ? b.appendChild(y) : typeof y == "string" && (b.innerHTML = y);
5807
+ const y = document.createElement("span");
5808
+ if (y.className = "tree-content", n) {
5809
+ const E = n(d);
5810
+ E instanceof Node ? y.appendChild(E) : typeof E == "string" && (y.innerHTML = E);
5583
5811
  } else
5584
- b.textContent = u != null ? String(u) : "";
5585
- return w.appendChild(b), w;
5812
+ y.textContent = u != null ? String(u) : "";
5813
+ return w.appendChild(y), w;
5586
5814
  };
5587
5815
  return t[0] = { ...i, viewRenderer: l }, t;
5588
5816
  }
@@ -5592,7 +5820,7 @@ class Ln extends _ {
5592
5820
  const i = t.getAttribute("data-tree-key");
5593
5821
  if (!i) return !1;
5594
5822
  const n = this.rowKeyMap.get(i);
5595
- return n ? (this.expandedKeys = ce(this.expandedKeys, i), this.emit("tree-expand", {
5823
+ return n ? (this.expandedKeys = ue(this.expandedKeys, i), this.emit("tree-expand", {
5596
5824
  key: i,
5597
5825
  row: n.data,
5598
5826
  expanded: this.expandedKeys.has(i),
@@ -5603,7 +5831,7 @@ class Ln extends _ {
5603
5831
  if (e.key !== " ") return;
5604
5832
  const t = this.grid._focusRow, i = this.flattenedRows[t];
5605
5833
  if (i?.hasChildren)
5606
- return e.preventDefault(), this.expandedKeys = ce(this.expandedKeys, i.key), this.emit("tree-expand", {
5834
+ return e.preventDefault(), this.expandedKeys = ue(this.expandedKeys, i.key), this.emit("tree-expand", {
5607
5835
  key: i.key,
5608
5836
  row: i.data,
5609
5837
  expanded: this.expandedKeys.has(i.key),
@@ -5636,13 +5864,13 @@ class Ln extends _ {
5636
5864
  this.expandedKeys.delete(e), this.requestRender();
5637
5865
  }
5638
5866
  toggle(e) {
5639
- this.expandedKeys = ce(this.expandedKeys, e), this.emitPluginEvent("tree-state-change", { expandedKeys: [...this.expandedKeys] }), this.requestRender();
5867
+ this.expandedKeys = ue(this.expandedKeys, e), this.emitPluginEvent("tree-state-change", { expandedKeys: [...this.expandedKeys] }), this.requestRender();
5640
5868
  }
5641
5869
  expandAll() {
5642
- this.expandedKeys = ge(this.rows, this.config), this.emitPluginEvent("tree-state-change", { expandedKeys: [...this.expandedKeys] }), this.requestRender();
5870
+ this.expandedKeys = me(this.rows, this.config), this.emitPluginEvent("tree-state-change", { expandedKeys: [...this.expandedKeys] }), this.requestRender();
5643
5871
  }
5644
5872
  collapseAll() {
5645
- this.expandedKeys = rn(), this.emitPluginEvent("tree-state-change", { expandedKeys: [...this.expandedKeys] }), this.requestRender();
5873
+ this.expandedKeys = hn(), this.emitPluginEvent("tree-state-change", { expandedKeys: [...this.expandedKeys] }), this.requestRender();
5646
5874
  }
5647
5875
  isExpanded(e) {
5648
5876
  return this.expandedKeys.has(e);
@@ -5657,10 +5885,10 @@ class Ln extends _ {
5657
5885
  return this.rowKeyMap.get(e)?.data;
5658
5886
  }
5659
5887
  expandToKey(e) {
5660
- this.expandedKeys = on(this.rows, e, this.config, this.expandedKeys), this.requestRender();
5888
+ this.expandedKeys = fn(this.rows, e, this.config, this.expandedKeys), this.requestRender();
5661
5889
  }
5662
5890
  }
5663
- function ln(s, e, t) {
5891
+ function mn(s, e, t) {
5664
5892
  const i = [...s.undoStack, e];
5665
5893
  for (; i.length > t; )
5666
5894
  i.shift();
@@ -5669,7 +5897,7 @@ function ln(s, e, t) {
5669
5897
  redoStack: []
5670
5898
  };
5671
5899
  }
5672
- function Xe(s) {
5900
+ function Qe(s) {
5673
5901
  if (s.undoStack.length === 0)
5674
5902
  return { newState: s, action: null };
5675
5903
  const e = [...s.undoStack], t = e.pop();
@@ -5681,7 +5909,7 @@ function Xe(s) {
5681
5909
  action: t
5682
5910
  } : { newState: s, action: null };
5683
5911
  }
5684
- function Ze(s) {
5912
+ function Je(s) {
5685
5913
  if (s.redoStack.length === 0)
5686
5914
  return { newState: s, action: null };
5687
5915
  const e = [...s.redoStack], t = e.pop();
@@ -5693,16 +5921,16 @@ function Ze(s) {
5693
5921
  action: t
5694
5922
  } : { newState: s, action: null };
5695
5923
  }
5696
- function dn(s) {
5924
+ function wn(s) {
5697
5925
  return s.undoStack.length > 0;
5698
5926
  }
5699
- function cn(s) {
5927
+ function bn(s) {
5700
5928
  return s.redoStack.length > 0;
5701
5929
  }
5702
- function un() {
5930
+ function vn() {
5703
5931
  return { undoStack: [], redoStack: [] };
5704
5932
  }
5705
- function hn(s, e, t, i) {
5933
+ function yn(s, e, t, i) {
5706
5934
  return {
5707
5935
  type: "cell-edit",
5708
5936
  rowIndex: s,
@@ -5712,7 +5940,7 @@ function hn(s, e, t, i) {
5712
5940
  timestamp: Date.now()
5713
5941
  };
5714
5942
  }
5715
- class In extends _ {
5943
+ class Kn extends _ {
5716
5944
  static dependencies = [
5717
5945
  { name: "editing", required: !0, reason: "UndoRedoPlugin tracks cell edit history" }
5718
5946
  ];
@@ -5738,7 +5966,7 @@ class In extends _ {
5738
5966
  onKeyDown(e) {
5739
5967
  const t = (e.ctrlKey || e.metaKey) && e.key === "z" && !e.shiftKey, i = (e.ctrlKey || e.metaKey) && (e.key === "y" || e.key === "z" && e.shiftKey);
5740
5968
  if (t) {
5741
- const n = Xe({ undoStack: this.undoStack, redoStack: this.redoStack });
5969
+ const n = Qe({ undoStack: this.undoStack, redoStack: this.redoStack });
5742
5970
  if (n.action) {
5743
5971
  const r = this.rows;
5744
5972
  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", {
@@ -5749,7 +5977,7 @@ class In extends _ {
5749
5977
  return !0;
5750
5978
  }
5751
5979
  if (i) {
5752
- const n = Ze({ undoStack: this.undoStack, redoStack: this.redoStack });
5980
+ const n = Je({ undoStack: this.undoStack, redoStack: this.redoStack });
5753
5981
  if (n.action) {
5754
5982
  const r = this.rows;
5755
5983
  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", {
@@ -5762,7 +5990,7 @@ class In extends _ {
5762
5990
  return !1;
5763
5991
  }
5764
5992
  recordEdit(e, t, i, n) {
5765
- const r = hn(e, t, i, n), o = ln(
5993
+ const r = yn(e, t, i, n), o = mn(
5766
5994
  { undoStack: this.undoStack, redoStack: this.redoStack },
5767
5995
  r,
5768
5996
  this.config.maxHistorySize ?? 100
@@ -5770,7 +5998,7 @@ class In extends _ {
5770
5998
  this.undoStack = o.undoStack, this.redoStack = o.redoStack;
5771
5999
  }
5772
6000
  undo() {
5773
- const e = Xe({ undoStack: this.undoStack, redoStack: this.redoStack });
6001
+ const e = Qe({ undoStack: this.undoStack, redoStack: this.redoStack });
5774
6002
  if (e.action) {
5775
6003
  const t = this.rows;
5776
6004
  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();
@@ -5778,7 +6006,7 @@ class In extends _ {
5778
6006
  return e.action;
5779
6007
  }
5780
6008
  redo() {
5781
- const e = Ze({ undoStack: this.undoStack, redoStack: this.redoStack });
6009
+ const e = Je({ undoStack: this.undoStack, redoStack: this.redoStack });
5782
6010
  if (e.action) {
5783
6011
  const t = this.rows;
5784
6012
  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();
@@ -5786,13 +6014,13 @@ class In extends _ {
5786
6014
  return e.action;
5787
6015
  }
5788
6016
  canUndo() {
5789
- return dn({ undoStack: this.undoStack, redoStack: this.redoStack });
6017
+ return wn({ undoStack: this.undoStack, redoStack: this.redoStack });
5790
6018
  }
5791
6019
  canRedo() {
5792
- return cn({ undoStack: this.undoStack, redoStack: this.redoStack });
6020
+ return bn({ undoStack: this.undoStack, redoStack: this.redoStack });
5793
6021
  }
5794
6022
  clearHistory() {
5795
- const e = un();
6023
+ const e = vn();
5796
6024
  this.undoStack = e.undoStack, this.redoStack = e.redoStack;
5797
6025
  }
5798
6026
  getUndoStack() {
@@ -5802,8 +6030,8 @@ class In extends _ {
5802
6030
  return [...this.redoStack];
5803
6031
  }
5804
6032
  }
5805
- const fn = '@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))}}';
5806
- function Qe(s) {
6033
+ const xn = '@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))}}';
6034
+ function et(s) {
5807
6035
  const e = s.meta ?? {};
5808
6036
  return e.lockPosition !== !0 && e.suppressMovable !== !0;
5809
6037
  }
@@ -5813,7 +6041,7 @@ class V extends _ {
5813
6041
  ];
5814
6042
  name = "visibility";
5815
6043
  static PANEL_ID = "columns";
5816
- styles = fn;
6044
+ styles = xn;
5817
6045
  get defaultConfig() {
5818
6046
  return {
5819
6047
  allowHideAll: !1
@@ -5903,7 +6131,7 @@ class V extends _ {
5903
6131
  const i = this.grid.getAllColumns().filter((n) => !n.utility);
5904
6132
  for (let n = 0; n < i.length; n++) {
5905
6133
  const r = i[n], o = r.header || r.field, a = document.createElement("div");
5906
- a.className = r.lockVisible ? "tbw-visibility-row locked" : "tbw-visibility-row", a.setAttribute("data-field", r.field), a.setAttribute("data-index", String(n)), t && Qe(r) && (a.draggable = !0, a.classList.add("reorderable"), this.setupDragListeners(a, r.field, n, e));
6134
+ a.className = r.lockVisible ? "tbw-visibility-row locked" : "tbw-visibility-row", a.setAttribute("data-field", r.field), a.setAttribute("data-index", String(n)), t && et(r) && (a.draggable = !0, a.classList.add("reorderable"), this.setupDragListeners(a, r.field, n, e));
5907
6135
  const l = document.createElement("label");
5908
6136
  l.className = "tbw-visibility-label";
5909
6137
  const d = document.createElement("input");
@@ -5911,7 +6139,7 @@ class V extends _ {
5911
6139
  this.grid.toggleColumnVisibility(r.field), setTimeout(() => this.rebuildToggles(e), 0);
5912
6140
  });
5913
6141
  const c = document.createElement("span");
5914
- if (c.textContent = o, l.appendChild(d), l.appendChild(c), t && Qe(r)) {
6142
+ if (c.textContent = o, l.appendChild(d), l.appendChild(c), t && et(r)) {
5915
6143
  const u = document.createElement("span");
5916
6144
  u.className = "tbw-visibility-handle", this.setIcon(u, this.resolveIcon("dragHandle")), u.title = "Drag to reorder", a.appendChild(u);
5917
6145
  }
@@ -5952,49 +6180,49 @@ class V extends _ {
5952
6180
  }
5953
6181
  export {
5954
6182
  _ as BaseGridPlugin,
5955
- pn as ClipboardPlugin,
5956
- mn as ColumnVirtualizationPlugin,
5957
- it as ContextMenuPlugin,
5958
- Dn as DEFAULT_ANIMATION_CONFIG,
5959
- ht as DEFAULT_GRID_ICONS,
5960
- Mn as DGEvents,
5961
- Nn as DataGridElement,
5962
- wn as EditingPlugin,
5963
- bn as ExportPlugin,
6183
+ En as ClipboardPlugin,
6184
+ Rn as ColumnVirtualizationPlugin,
6185
+ nt as ContextMenuPlugin,
6186
+ Gn as DEFAULT_ANIMATION_CONFIG,
6187
+ pt as DEFAULT_GRID_ICONS,
6188
+ Bn as DGEvents,
6189
+ Vn as DataGridElement,
6190
+ Sn as EditingPlugin,
6191
+ kn as ExportPlugin,
5964
6192
  q as FilteringPlugin,
5965
- qn as FitModeEnum,
5966
- Hn as GridCSSVars,
5967
- Kn as GridClasses,
5968
- zn as GridDataAttrs,
5969
- On as GridElement,
5970
- Gn as GridSelectors,
5971
- vn as GroupingColumnsPlugin,
5972
- yn as GroupingRowsPlugin,
5973
- nt as MasterDetailPlugin,
5974
- xn as MultiSortPlugin,
5975
- Bn as PLUGIN_QUERIES,
5976
- Cn as PinnedColumnsPlugin,
5977
- En as PinnedRowsPlugin,
6193
+ Wn as FitModeEnum,
6194
+ $n as GridCSSVars,
6195
+ jn as GridClasses,
6196
+ Un as GridDataAttrs,
6197
+ Yn as GridElement,
6198
+ Xn as GridSelectors,
6199
+ An as GroupingColumnsPlugin,
6200
+ _n as GroupingRowsPlugin,
6201
+ ot as MasterDetailPlugin,
6202
+ Tn as MultiSortPlugin,
6203
+ Zn as PLUGIN_QUERIES,
6204
+ Ln as PinnedColumnsPlugin,
6205
+ In as PinnedRowsPlugin,
5978
6206
  B as PivotPlugin,
5979
- Vn as PluginEvents,
5980
- Wn as PluginManager,
5981
- Rn as PrintPlugin,
5982
- $i as ROW_DRAG_HANDLE_FIELD,
5983
- $n as RenderPhase,
5984
- Sn as ReorderPlugin,
5985
- kn as ResponsivePlugin,
5986
- An as RowReorderPlugin,
5987
- _n as SelectionPlugin,
5988
- Tn as ServerSidePlugin,
5989
- Ln as TreePlugin,
5990
- In as UndoRedoPlugin,
6207
+ Qn as PluginEvents,
6208
+ Jn as PluginManager,
6209
+ Fn as PrintPlugin,
6210
+ Ji as ROW_DRAG_HANDLE_FIELD,
6211
+ er as RenderPhase,
6212
+ Pn as ReorderPlugin,
6213
+ Mn as ResponsivePlugin,
6214
+ Dn as RowReorderPlugin,
6215
+ Nn as SelectionPlugin,
6216
+ qn as ServerSidePlugin,
6217
+ Hn as TreePlugin,
6218
+ Kn as UndoRedoPlugin,
5991
6219
  V as VisibilityPlugin,
5992
- jn as builtInSort,
5993
- Un as createGrid,
5994
- Yn as defaultComparator,
6220
+ tr as builtInSort,
6221
+ ir as createGrid,
6222
+ nr as defaultComparator,
5995
6223
  Dt as defaultEditorFor,
5996
- Ct as defaultPasteHandler,
5997
- Ki as printGridIsolated,
5998
- Xn as queryGrid
6224
+ Et as defaultPasteHandler,
6225
+ $i as printGridIsolated,
6226
+ rr as queryGrid
5999
6227
  };
6000
6228
  //# sourceMappingURL=all.js.map