@toolbox-web/grid 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/all.js CHANGED
@@ -1,6 +1,6 @@
1
- import { BaseGridPlugin as C, DEFAULT_GRID_ICONS as Ae, runAggregator as ee, getAggregator as _e, getValueAggregator as Ie } from "./index.js";
2
- import { DGEvents as co, DataGridElement as uo, FitModeEnum as ho, GridCSSVars as po, GridClasses as go, GridDataAttrs as fo, DataGridElement as mo, GridSelectors as bo, PluginEvents as wo, PluginManager as vo, SelectionPlugin as xo, TreePlugin as Co, aggregatorRegistry as yo, listAggregators as Ro, registerAggregator as So, runValueAggregator as Eo, unregisterAggregator as ko } from "./index.js";
3
- function Te(s, e, t, o) {
1
+ import { BaseGridPlugin as C, DEFAULT_GRID_ICONS as _e, runAggregator as te, getAggregator as Ie, getValueAggregator as Te } from "./index.js";
2
+ import { DGEvents as uo, DataGridElement as ho, FitModeEnum as po, GridCSSVars as go, GridClasses as fo, GridDataAttrs as mo, DataGridElement as bo, GridSelectors as wo, PluginEvents as vo, PluginManager as xo, SelectionPlugin as Co, TreePlugin as yo, aggregatorRegistry as Ro, listAggregators as So, registerAggregator as Eo, runValueAggregator as ko, unregisterAggregator as Ao } from "./index.js";
3
+ function Fe(s, e, t, o) {
4
4
  if (o.processCell)
5
5
  return o.processCell(s, e, t);
6
6
  if (s == null) return "";
@@ -10,7 +10,7 @@ function Te(s, e, t, o) {
10
10
  `;
11
11
  return o.quoteStrings || n.includes(i) || n.includes(r) || n.includes('"') ? `"${n.replace(/"/g, '""')}"` : n;
12
12
  }
13
- function D(s) {
13
+ function H(s) {
14
14
  const { rows: e, columns: t, selectedIndices: o, config: n } = s, i = n.delimiter ?? " ", r = n.newline ?? `
15
15
  `, l = t.filter((u) => !u.hidden && !u.field.startsWith("__")), a = [];
16
16
  if (n.includeHeaders) {
@@ -25,13 +25,13 @@ function D(s) {
25
25
  const h = e[u];
26
26
  if (!h) continue;
27
27
  const p = l.map(
28
- (g) => Te(h[g.field], g.field, h, n)
28
+ (g) => Fe(h[g.field], g.field, h, n)
29
29
  );
30
30
  a.push(p.join(i));
31
31
  }
32
32
  return a.join(r);
33
33
  }
34
- async function q(s) {
34
+ async function G(s) {
35
35
  try {
36
36
  return await navigator.clipboard.writeText(s), !0;
37
37
  } catch {
@@ -41,7 +41,7 @@ async function q(s) {
41
41
  return document.body.removeChild(e), t;
42
42
  }
43
43
  }
44
- function te(s, e) {
44
+ function oe(s, e) {
45
45
  const t = e.delimiter ?? " ", o = e.newline ?? `
46
46
  `, n = s.replace(/\r\n/g, `
47
47
  `).replace(/\r/g, `
@@ -53,14 +53,14 @@ function te(s, e) {
53
53
  }
54
54
  return r.push(l), (r.length > 1 || r.some((d) => d.trim() !== "")) && i.push(r), i;
55
55
  }
56
- async function oe() {
56
+ async function ne() {
57
57
  try {
58
58
  return await navigator.clipboard.readText();
59
59
  } catch {
60
60
  return "";
61
61
  }
62
62
  }
63
- class Ut extends C {
63
+ class Yt extends C {
64
64
  name = "clipboard";
65
65
  version = "1.0.0";
66
66
  get defaultConfig() {
@@ -92,7 +92,7 @@ class Ut extends C {
92
92
  const t = this.#t(), o = t?.getSelectedRows() ?? [], n = o.length > 0, i = t?.getRanges() ?? [], r = i.length > 0, l = t?.getSelectedCell() != null;
93
93
  let a, d, c;
94
94
  if (n && t)
95
- a = D({
95
+ a = H({
96
96
  rows: this.rows,
97
97
  columns: [...this.columns],
98
98
  selectedIndices: o,
@@ -115,7 +115,7 @@ class Ut extends C {
115
115
  if (!u) return;
116
116
  a = u.text, d = 1, c = 1;
117
117
  }
118
- q(a).then(() => {
118
+ G(a).then(() => {
119
119
  this.lastCopied = { text: a, timestamp: Date.now() }, this.emit("copy", { text: a, rowCount: d, columnCount: c });
120
120
  });
121
121
  }
@@ -123,9 +123,9 @@ class Ut extends C {
123
123
  * Handle paste operation
124
124
  */
125
125
  #o() {
126
- oe().then((e) => {
126
+ ne().then((e) => {
127
127
  if (!e) return;
128
- const t = te(e, this.config);
128
+ const t = oe(e, this.config);
129
129
  this.emit("paste", { rows: t, text: e });
130
130
  });
131
131
  }
@@ -174,8 +174,8 @@ class Ut extends C {
174
174
  const m = this.rows[g];
175
175
  if (!m) continue;
176
176
  const b = p.map((R) => {
177
- const E = m[R.field];
178
- return E == null ? "" : E instanceof Date ? E.toISOString() : String(E);
177
+ const k = m[R.field];
178
+ return k == null ? "" : k instanceof Date ? k.toISOString() : String(k);
179
179
  });
180
180
  h.push(b.join(c));
181
181
  }
@@ -215,13 +215,13 @@ class Ut extends C {
215
215
  * @returns The copied text
216
216
  */
217
217
  async copy() {
218
- const t = this.#t()?.getSelectedRows() ?? [], o = D({
218
+ const t = this.#t()?.getSelectedRows() ?? [], o = H({
219
219
  rows: this.rows,
220
220
  columns: [...this.columns],
221
221
  selectedIndices: t,
222
222
  config: this.config
223
223
  });
224
- return await q(o), this.lastCopied = { text: o, timestamp: Date.now() }, o;
224
+ return await G(o), this.lastCopied = { text: o, timestamp: Date.now() }, o;
225
225
  }
226
226
  /**
227
227
  * Copy specific rows by index to clipboard.
@@ -229,21 +229,21 @@ class Ut extends C {
229
229
  * @returns The copied text
230
230
  */
231
231
  async copyRows(e) {
232
- const t = D({
232
+ const t = H({
233
233
  rows: this.rows,
234
234
  columns: [...this.columns],
235
235
  selectedIndices: e,
236
236
  config: this.config
237
237
  });
238
- return await q(t), this.lastCopied = { text: t, timestamp: Date.now() }, t;
238
+ return await G(t), this.lastCopied = { text: t, timestamp: Date.now() }, t;
239
239
  }
240
240
  /**
241
241
  * Read and parse clipboard content.
242
242
  * @returns Parsed 2D array of cell values, or null if clipboard is empty
243
243
  */
244
244
  async paste() {
245
- const e = await oe();
246
- return e ? te(e, this.config) : null;
245
+ const e = await ne();
246
+ return e ? oe(e, this.config) : null;
247
247
  }
248
248
  /**
249
249
  * Get the last copied text and timestamp.
@@ -253,33 +253,33 @@ class Ut extends C {
253
253
  return this.lastCopied;
254
254
  }
255
255
  }
256
- const ne = 100;
257
- function U(s) {
256
+ const ie = 100;
257
+ function Y(s) {
258
258
  if (s == null)
259
- return ne;
259
+ return ie;
260
260
  if (typeof s == "number")
261
261
  return s;
262
262
  const e = parseFloat(s);
263
- return isNaN(e) ? ne : e;
264
- }
265
- function ie(s) {
266
- return s.map((e) => U(e.width));
263
+ return isNaN(e) ? ie : e;
267
264
  }
268
265
  function re(s) {
266
+ return s.map((e) => Y(e.width));
267
+ }
268
+ function se(s) {
269
269
  const e = [];
270
270
  let t = 0;
271
271
  for (const o of s)
272
- e.push(t), t += U(o.width);
272
+ e.push(t), t += Y(o.width);
273
273
  return e;
274
274
  }
275
- function se(s) {
276
- return s.reduce((e, t) => e + U(t.width), 0);
275
+ function le(s) {
276
+ return s.reduce((e, t) => e + Y(t.width), 0);
277
277
  }
278
- function Fe(s, e, t, o, n) {
278
+ function Le(s, e, t, o, n) {
279
279
  const i = t.length;
280
280
  if (i === 0)
281
281
  return { startCol: 0, endCol: 0, visibleColumns: [] };
282
- let r = Le(s, t, o);
282
+ let r = Ne(s, t, o);
283
283
  r = Math.max(0, r - n);
284
284
  const l = s + e;
285
285
  let a = r;
@@ -296,7 +296,7 @@ function Fe(s, e, t, o, n) {
296
296
  d.push(c);
297
297
  return { startCol: r, endCol: a, visibleColumns: d };
298
298
  }
299
- function Le(s, e, t) {
299
+ function Ne(s, e, t) {
300
300
  let o = 0, n = e.length - 1;
301
301
  for (; o < n; ) {
302
302
  const i = Math.floor((o + n) / 2);
@@ -304,10 +304,10 @@ function Le(s, e, t) {
304
304
  }
305
305
  return o;
306
306
  }
307
- function Ne(s, e, t) {
307
+ function Me(s, e, t) {
308
308
  return t ? s > e : !1;
309
309
  }
310
- class Yt extends C {
310
+ class Zt extends C {
311
311
  name = "columnVirtualization";
312
312
  version = "1.0.0";
313
313
  get defaultConfig() {
@@ -329,17 +329,17 @@ class Yt extends C {
329
329
  attach(e) {
330
330
  super.attach(e);
331
331
  const t = this.columns;
332
- this.columnWidths = ie(t), this.columnOffsets = re(t), this.totalWidth = se(t), this.endCol = t.length - 1;
332
+ this.columnWidths = re(t), this.columnOffsets = se(t), this.totalWidth = le(t), this.endCol = t.length - 1;
333
333
  }
334
334
  detach() {
335
335
  this.columnWidths = [], this.columnOffsets = [], this.isVirtualized = !1, this.startCol = 0, this.endCol = 0, this.scrollLeft = 0, this.totalWidth = 0;
336
336
  }
337
337
  // ===== Hooks =====
338
338
  processColumns(e) {
339
- const t = Ne(e.length, this.config.threshold ?? 30, this.config.autoEnable ?? !0);
340
- if (this.isVirtualized = t ?? !1, this.columnWidths = ie(e), this.columnOffsets = re(e), this.totalWidth = se(e), !t)
339
+ const t = Me(e.length, this.config.threshold ?? 30, this.config.autoEnable ?? !0);
340
+ if (this.isVirtualized = t ?? !1, this.columnWidths = re(e), this.columnOffsets = se(e), this.totalWidth = le(e), !t)
341
341
  return this.startCol = 0, this.endCol = e.length - 1, [...e];
342
- const o = this.grid.clientWidth || 800, n = Fe(
342
+ const o = this.grid.clientWidth || 800, n = Le(
343
343
  this.scrollLeft,
344
344
  o,
345
345
  this.columnOffsets,
@@ -397,13 +397,14 @@ class Yt extends C {
397
397
  return this.totalWidth;
398
398
  }
399
399
  }
400
- function $(s, e) {
400
+ const Pe = ".tbw-context-menu{position:fixed;background:light-dark(#f5f5f5,#2a2a2a);color:light-dark(#222,#eee);border:1px solid light-dark(#d0d0d4,#454545);border-radius:4px;box-shadow:0 2px 10px #00000026;min-width:160px;padding:4px 0;z-index:10000;font-size:13px;font-family:system-ui,sans-serif}.tbw-context-menu-item{display:flex;align-items:center;padding:6px 12px;cursor:pointer;gap:8px}.tbw-context-menu-item:hover:not(.disabled){background:light-dark(#e8e8e8,#3a3a3a)}.tbw-context-menu-item.disabled{opacity:.5;cursor:default}.tbw-context-menu-item.danger{color:light-dark(#c00,#f66)}.tbw-context-menu-icon{width:16px;text-align:center}.tbw-context-menu-label{flex:1}.tbw-context-menu-shortcut{color:light-dark(#888,#888);font-size:11px}.tbw-context-menu-arrow{font-size:10px;color:light-dark(#888,#888)}.tbw-context-menu-separator{height:1px;background:light-dark(#d0d0d4,#454545);margin:4px 0}";
401
+ function j(s, e) {
401
402
  return (typeof s == "function" ? s(e) : s).filter((o) => !(o.hidden === !0 || typeof o.hidden == "function" && o.hidden(e)));
402
403
  }
403
- function Me(s, e) {
404
+ function De(s, e) {
404
405
  return s.disabled === !0 ? !0 : typeof s.disabled == "function" ? s.disabled(e) : !1;
405
406
  }
406
- function j(s, e, t, o = Ae.submenuArrow) {
407
+ function U(s, e, t, o = _e.submenuArrow) {
407
408
  const n = document.createElement("div");
408
409
  n.className = "tbw-context-menu", n.setAttribute("role", "menu");
409
410
  for (const i of s) {
@@ -414,7 +415,7 @@ function j(s, e, t, o = Ae.submenuArrow) {
414
415
  }
415
416
  const r = document.createElement("div");
416
417
  r.className = "tbw-context-menu-item", i.cssClass && r.classList.add(i.cssClass), r.setAttribute("role", "menuitem"), r.setAttribute("data-id", i.id);
417
- const l = Me(i, e);
418
+ const l = De(i, e);
418
419
  if (l && (r.classList.add("disabled"), r.setAttribute("aria-disabled", "true")), i.icon) {
419
420
  const d = document.createElement("span");
420
421
  d.className = "tbw-context-menu-icon", d.innerHTML = i.icon, r.appendChild(d);
@@ -428,7 +429,7 @@ function j(s, e, t, o = Ae.submenuArrow) {
428
429
  const d = document.createElement("span");
429
430
  d.className = "tbw-context-menu-arrow", typeof o == "string" ? d.innerHTML = o : o instanceof HTMLElement && d.appendChild(o.cloneNode(!0)), r.appendChild(d), r.addEventListener("mouseenter", () => {
430
431
  if (r.querySelector(".tbw-context-menu") || !i.subMenu) return;
431
- const u = $(i.subMenu, e), h = j(u, e, t, o);
432
+ const u = j(i.subMenu, e), h = U(u, e, t, o);
432
433
  h.classList.add("tbw-context-submenu"), h.style.position = "absolute", h.style.left = "100%", h.style.top = "0", r.style.position = "relative", r.appendChild(h);
433
434
  }), r.addEventListener("mouseleave", () => {
434
435
  const c = r.querySelector(".tbw-context-menu");
@@ -441,65 +442,14 @@ function j(s, e, t, o = Ae.submenuArrow) {
441
442
  }
442
443
  return n;
443
444
  }
444
- function le(s, e, t) {
445
+ function ae(s, e, t) {
445
446
  s.style.position = "fixed", s.style.left = `${e}px`, s.style.top = `${t}px`, s.style.visibility = "hidden", s.style.zIndex = "10000";
446
447
  const o = s.getBoundingClientRect(), n = window.innerWidth, i = window.innerHeight;
447
448
  let r = e, l = t;
448
449
  e + o.width > n && (r = e - o.width), t + o.height > i && (l = t - o.height), r = Math.max(0, r), l = Math.max(0, l), s.style.left = `${r}px`, s.style.top = `${l}px`, s.style.visibility = "visible";
449
450
  }
450
- let H = null, G = null, A = null;
451
- const Pe = `
452
- .tbw-context-menu {
453
- position: fixed;
454
- background: light-dark(#f5f5f5, #2a2a2a);
455
- color: light-dark(#222, #eee);
456
- border: 1px solid light-dark(#d0d0d4, #454545);
457
- border-radius: 4px;
458
- box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
459
- min-width: 160px;
460
- padding: 4px 0;
461
- z-index: 10000;
462
- font-size: 13px;
463
- font-family: system-ui, sans-serif;
464
- }
465
- .tbw-context-menu-item {
466
- display: flex;
467
- align-items: center;
468
- padding: 6px 12px;
469
- cursor: pointer;
470
- gap: 8px;
471
- }
472
- .tbw-context-menu-item:hover:not(.disabled) {
473
- background: light-dark(#e8e8e8, #3a3a3a);
474
- }
475
- .tbw-context-menu-item.disabled {
476
- opacity: 0.5;
477
- cursor: default;
478
- }
479
- .tbw-context-menu-item.danger {
480
- color: light-dark(#c00, #f66);
481
- }
482
- .tbw-context-menu-icon {
483
- width: 16px;
484
- text-align: center;
485
- }
486
- .tbw-context-menu-label {
487
- flex: 1;
488
- }
489
- .tbw-context-menu-shortcut {
490
- color: light-dark(#888, #888);
491
- font-size: 11px;
492
- }
493
- .tbw-context-menu-arrow {
494
- font-size: 10px;
495
- color: light-dark(#888, #888);
496
- }
497
- .tbw-context-menu-separator {
498
- height: 1px;
499
- background: light-dark(#d0d0d4, #454545);
500
- margin: 4px 0;
501
- }
502
- `, O = [
451
+ let _ = null, I = null, E = null, O = 0;
452
+ const B = [
503
453
  {
504
454
  id: "copy",
505
455
  name: "Copy",
@@ -517,12 +467,12 @@ const Pe = `
517
467
  }
518
468
  }
519
469
  ];
520
- class Zt extends C {
470
+ class Xt extends C {
521
471
  name = "contextMenu";
522
472
  version = "1.0.0";
523
473
  get defaultConfig() {
524
474
  return {
525
- items: O
475
+ items: B
526
476
  };
527
477
  }
528
478
  // ===== Internal State =====
@@ -532,18 +482,25 @@ class Zt extends C {
532
482
  menuElement = null;
533
483
  // ===== Lifecycle =====
534
484
  attach(e) {
535
- super.attach(e), this.installGlobalHandlers();
485
+ super.attach(e), this.installGlobalHandlers(), O++;
536
486
  }
537
487
  detach() {
538
- this.menuElement && (this.menuElement.remove(), this.menuElement = null), this.isOpen = !1, this.params = null;
488
+ this.menuElement && (this.menuElement.remove(), this.menuElement = null), this.isOpen = !1, this.params = null, this.uninstallGlobalHandlers();
539
489
  }
540
490
  // ===== Private Methods =====
541
491
  installGlobalHandlers() {
542
- !A && typeof document < "u" && (A = document.createElement("style"), A.id = "tbw-context-menu-styles", A.textContent = Pe, document.head.appendChild(A)), H || (H = () => {
492
+ !E && typeof document < "u" && (E = document.createElement("style"), E.id = "tbw-context-menu-styles", E.textContent = Pe, document.head.appendChild(E)), _ || (_ = () => {
543
493
  document.querySelectorAll(".tbw-context-menu").forEach((t) => t.remove());
544
- }, document.addEventListener("click", H)), G || (G = (e) => {
494
+ }, document.addEventListener("click", _)), I || (I = (e) => {
545
495
  e.key === "Escape" && document.querySelectorAll(".tbw-context-menu").forEach((o) => o.remove());
546
- }, document.addEventListener("keydown", G));
496
+ }, document.addEventListener("keydown", I));
497
+ }
498
+ /**
499
+ * Clean up global handlers when the last instance detaches.
500
+ * Uses reference counting to ensure handlers persist while any grid uses the plugin.
501
+ */
502
+ uninstallGlobalHandlers() {
503
+ O--, !(O > 0) && (_ && (document.removeEventListener("click", _), _ = null), I && (document.removeEventListener("keydown", I), I = null), E && (E.remove(), E = null));
547
504
  }
548
505
  // ===== Hooks =====
549
506
  afterRender() {
@@ -582,15 +539,15 @@ class Zt extends C {
582
539
  } else
583
540
  return;
584
541
  this.params = a, this.position = { x: n.clientX, y: n.clientY };
585
- const d = $(this.config.items ?? O, a);
586
- d.length && (this.menuElement && this.menuElement.remove(), this.menuElement = j(
542
+ const d = j(this.config.items ?? B, a);
543
+ d.length && (this.menuElement && this.menuElement.remove(), this.menuElement = U(
587
544
  d,
588
545
  a,
589
546
  (c) => {
590
547
  c.action && c.action(a), this.menuElement?.remove(), this.menuElement = null, this.isOpen = !1;
591
548
  },
592
549
  this.gridIcons.submenuArrow
593
- ), document.body.appendChild(this.menuElement), le(this.menuElement, n.clientX, n.clientY), this.isOpen = !0, this.emit("context-menu-open", { params: a, items: d }));
550
+ ), document.body.appendChild(this.menuElement), ae(this.menuElement, n.clientX, n.clientY), this.isOpen = !0, this.emit("context-menu-open", { params: a, items: d }));
594
551
  }));
595
552
  }
596
553
  // ===== Public API =====
@@ -610,15 +567,15 @@ class Zt extends C {
610
567
  value: o.value ?? null,
611
568
  isHeader: o.isHeader ?? !1,
612
569
  event: o.event ?? new MouseEvent("contextmenu")
613
- }, i = $(this.config.items ?? O, n);
614
- this.menuElement && this.menuElement.remove(), this.menuElement = j(
570
+ }, i = j(this.config.items ?? B, n);
571
+ this.menuElement && this.menuElement.remove(), this.menuElement = U(
615
572
  i,
616
573
  n,
617
574
  (r) => {
618
575
  r.action && r.action(n), this.menuElement?.remove(), this.menuElement = null, this.isOpen = !1;
619
576
  },
620
577
  this.gridIcons.submenuArrow
621
- ), document.body.appendChild(this.menuElement), le(this.menuElement, e, t), this.isOpen = !0;
578
+ ), document.body.appendChild(this.menuElement), ae(this.menuElement, e, t), this.isOpen = !0;
622
579
  }
623
580
  /**
624
581
  * Hide the context menu.
@@ -635,7 +592,7 @@ class Zt extends C {
635
592
  }
636
593
  // Styles are injected globally via installGlobalHandlers() since menu renders in document.body
637
594
  }
638
- function ae(s, e = !0) {
595
+ function de(s, e = !0) {
639
596
  if (s == null) return "";
640
597
  if (s instanceof Date) return s.toISOString();
641
598
  if (typeof s == "object") return JSON.stringify(s);
@@ -643,37 +600,37 @@ function ae(s, e = !0) {
643
600
  return e && (t.includes(",") || t.includes('"') || t.includes(`
644
601
  `) || t.includes("\r")) ? `"${t.replace(/"/g, '""')}"` : t;
645
602
  }
646
- function De(s, e, t, o = {}) {
603
+ function qe(s, e, t, o = {}) {
647
604
  const n = o.delimiter ?? ",", i = o.newline ?? `
648
605
  `, r = [], l = o.bom ? "\uFEFF" : "";
649
606
  if (t.includeHeaders !== !1) {
650
607
  const a = e.map((d) => {
651
608
  const c = d.header || d.field, u = t.processHeader ? t.processHeader(c, d.field) : c;
652
- return ae(u);
609
+ return de(u);
653
610
  });
654
611
  r.push(a.join(n));
655
612
  }
656
613
  for (const a of s) {
657
614
  const d = e.map((c) => {
658
615
  let u = a[c.field];
659
- return t.processCell && (u = t.processCell(u, c.field, a)), ae(u);
616
+ return t.processCell && (u = t.processCell(u, c.field, a)), de(u);
660
617
  });
661
618
  r.push(d.join(n));
662
619
  }
663
620
  return l + r.join(i);
664
621
  }
665
- function Y(s, e) {
622
+ function Z(s, e) {
666
623
  const t = URL.createObjectURL(s), o = document.createElement("a");
667
624
  o.href = t, o.download = e, o.style.display = "none", document.body.appendChild(o), o.click(), document.body.removeChild(o), URL.revokeObjectURL(t);
668
625
  }
669
- function qe(s, e) {
626
+ function He(s, e) {
670
627
  const t = new Blob([s], { type: "text/csv;charset=utf-8;" });
671
- Y(t, e);
628
+ Z(t, e);
672
629
  }
673
- function de(s) {
630
+ function ce(s) {
674
631
  return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
675
632
  }
676
- function He(s, e, t) {
633
+ function Ge(s, e, t) {
677
634
  let o = `<?xml version="1.0" encoding="UTF-8"?>
678
635
  <?mso-application progid="Excel.Sheet"?>
679
636
  <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
@@ -685,7 +642,7 @@ function He(s, e, t) {
685
642
  <Row>`;
686
643
  for (const n of e) {
687
644
  const i = n.header || n.field, r = t.processHeader ? t.processHeader(i, n.field) : i;
688
- o += `<Cell><Data ss:Type="String">${de(r)}</Data></Cell>`;
645
+ o += `<Cell><Data ss:Type="String">${ce(r)}</Data></Cell>`;
689
646
  }
690
647
  o += "</Row>";
691
648
  }
@@ -696,7 +653,7 @@ function He(s, e, t) {
696
653
  let r = n[i.field];
697
654
  t.processCell && (r = t.processCell(r, i.field, n));
698
655
  let l = "String", a = "";
699
- r == null ? a = "" : typeof r == "number" && !isNaN(r) ? (l = "Number", a = String(r)) : r instanceof Date ? (l = "DateTime", a = r.toISOString()) : a = de(String(r)), o += `<Cell><Data ss:Type="${l}">${a}</Data></Cell>`;
656
+ r == null ? a = "" : typeof r == "number" && !isNaN(r) ? (l = "Number", a = String(r)) : r instanceof Date ? (l = "DateTime", a = r.toISOString()) : a = ce(String(r)), o += `<Cell><Data ss:Type="${l}">${a}</Data></Cell>`;
700
657
  }
701
658
  o += "</Row>";
702
659
  }
@@ -705,13 +662,13 @@ function He(s, e, t) {
705
662
  </Worksheet>
706
663
  </Workbook>`, o;
707
664
  }
708
- function Ge(s, e) {
665
+ function Oe(s, e) {
709
666
  const t = e.endsWith(".xls") ? e : `${e}.xls`, o = new Blob([s], {
710
667
  type: "application/vnd.ms-excel;charset=utf-8;"
711
668
  });
712
- Y(o, t);
669
+ Z(o, t);
713
670
  }
714
- class Xt extends C {
671
+ class Jt extends C {
715
672
  name = "export";
716
673
  version = "1.0.0";
717
674
  get defaultConfig() {
@@ -751,13 +708,13 @@ class Xt extends C {
751
708
  try {
752
709
  switch (e) {
753
710
  case "csv": {
754
- const a = De(r, i, n, { bom: !0 });
755
- l = l.endsWith(".csv") ? l : `${l}.csv`, qe(a, l);
711
+ const a = qe(r, i, n, { bom: !0 });
712
+ l = l.endsWith(".csv") ? l : `${l}.csv`, He(a, l);
756
713
  break;
757
714
  }
758
715
  case "excel": {
759
- const a = He(r, i, n);
760
- l = l.endsWith(".xls") ? l : `${l}.xls`, Ge(a, l);
716
+ const a = Ge(r, i, n);
717
+ l = l.endsWith(".xls") ? l : `${l}.xls`, Oe(a, l);
761
718
  break;
762
719
  }
763
720
  case "json": {
@@ -771,7 +728,7 @@ class Xt extends C {
771
728
  }), d = JSON.stringify(a, null, 2);
772
729
  l = l.endsWith(".json") ? l : `${l}.json`;
773
730
  const c = new Blob([d], { type: "application/json" });
774
- Y(c, l);
731
+ Z(c, l);
775
732
  break;
776
733
  }
777
734
  }
@@ -829,7 +786,7 @@ class Xt extends C {
829
786
  return this.lastExportInfo;
830
787
  }
831
788
  }
832
- function Oe(s) {
789
+ function Be(s) {
833
790
  const { totalRows: e, viewportHeight: t, scrollTop: o, rowHeight: n, overscan: i } = s, r = Math.ceil(t / n);
834
791
  let l = Math.floor(o / n) - i;
835
792
  l < 0 && (l = 0);
@@ -841,10 +798,10 @@ function Oe(s) {
841
798
  totalHeight: e * n
842
799
  };
843
800
  }
844
- function Be(s, e) {
801
+ function Ve(s, e) {
845
802
  return s <= e;
846
803
  }
847
- function Ve(s, e, t = !1) {
804
+ function Ke(s, e, t = !1) {
848
805
  const o = s[e.field];
849
806
  if (e.operator === "blank")
850
807
  return o == null || o === "";
@@ -886,10 +843,10 @@ function Ve(s, e, t = !1) {
886
843
  return !0;
887
844
  }
888
845
  }
889
- function Ke(s, e, t = !1) {
890
- return e.length ? s.filter((o) => e.every((n) => Ve(o, n, t))) : s;
846
+ function ze(s, e, t = !1) {
847
+ return e.length ? s.filter((o) => e.every((n) => Ke(o, n, t))) : s;
891
848
  }
892
- function ze(s) {
849
+ function We(s) {
893
850
  return JSON.stringify(
894
851
  s.map((e) => ({
895
852
  field: e.field,
@@ -899,7 +856,7 @@ function ze(s) {
899
856
  }))
900
857
  );
901
858
  }
902
- function ce(s, e) {
859
+ function ue(s, e) {
903
860
  const t = /* @__PURE__ */ new Set();
904
861
  for (const o of s) {
905
862
  const n = o[e];
@@ -907,7 +864,7 @@ function ce(s, e) {
907
864
  }
908
865
  return [...t].sort((o, n) => typeof o == "number" && typeof n == "number" ? o - n : String(o).localeCompare(String(n)));
909
866
  }
910
- const We = '.header-cell.filtered:before{content:"";position:absolute;top:4px;right:4px;width:6px;height:6px;background:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));border-radius:50%}.tbw-filter-btn{display:inline-flex;align-items:center;justify-content:center;background:transparent;border:none;cursor:pointer;padding:2px;margin-left:4px;opacity:.4;transition:opacity .15s;color:inherit;vertical-align:middle}.tbw-filter-btn:hover,.tbw-filter-btn.active{opacity:1}.tbw-filter-btn.active{color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6))}', $e = `
867
+ const $e = '.header-cell.filtered:before{content:"";position:absolute;top:4px;right:4px;width:6px;height:6px;background:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));border-radius:50%}.tbw-filter-btn{display:inline-flex;align-items:center;justify-content:center;background:transparent;border:none;cursor:pointer;padding:2px;margin-left:4px;opacity:.4;transition:opacity .15s;color:inherit;vertical-align:middle}.tbw-filter-btn:hover,.tbw-filter-btn.active{opacity:1}.tbw-filter-btn.active{color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6))}', je = `
911
868
  .tbw-filter-panel {
912
869
  position: fixed;
913
870
  background: var(--tbw-filter-panel-bg, var(--tbw-color-panel-bg, light-dark(#eeeeee, #222222)));
@@ -1049,7 +1006,7 @@ const We = '.header-cell.filtered:before{content:"";position:absolute;top:4px;ri
1049
1006
  background: var(--tbw-filter-hover, var(--tbw-color-row-hover, light-dark(#f0f6ff, #1c1c1c)));
1050
1007
  }
1051
1008
  `;
1052
- class k extends C {
1009
+ class A extends C {
1053
1010
  name = "filtering";
1054
1011
  version = "1.0.0";
1055
1012
  get defaultConfig() {
@@ -1087,10 +1044,10 @@ class k extends C {
1087
1044
  processRows(e) {
1088
1045
  const t = [...this.filters.values()];
1089
1046
  if (!t.length) return [...e];
1090
- const o = ze(t);
1047
+ const o = We(t);
1091
1048
  if (this.cacheKey === o && this.cachedResult)
1092
1049
  return this.cachedResult;
1093
- const n = Ke([...e], t, this.config.caseSensitive);
1050
+ const n = ze([...e], t, this.config.caseSensitive);
1094
1051
  return this.cachedResult = n, this.cacheKey = o, n;
1095
1052
  }
1096
1053
  afterRender() {
@@ -1192,7 +1149,7 @@ class k extends C {
1192
1149
  * Uses sourceRows to include all values regardless of current filter.
1193
1150
  */
1194
1151
  getUniqueValues(e) {
1195
- return ce(this.sourceRows, e);
1152
+ return ue(this.sourceRows, e);
1196
1153
  }
1197
1154
  // ===== Private Methods =====
1198
1155
  /**
@@ -1205,7 +1162,7 @@ class k extends C {
1205
1162
  return;
1206
1163
  }
1207
1164
  const e = document.createElement("style");
1208
- e.id = "tbw-filter-panel-styles", e.textContent = $e, document.head.appendChild(e), this.globalStylesInjected = !0;
1165
+ e.id = "tbw-filter-panel-styles", e.textContent = je, document.head.appendChild(e), this.globalStylesInjected = !0;
1209
1166
  }
1210
1167
  /**
1211
1168
  * Toggle the filter panel for a field
@@ -1218,7 +1175,7 @@ class k extends C {
1218
1175
  this.closeFilterPanel();
1219
1176
  const n = document.createElement("div");
1220
1177
  n.className = "tbw-filter-panel", this.panelElement = n, this.openPanelField = e;
1221
- const i = ce(this.sourceRows, e);
1178
+ const i = ue(this.sourceRows, e);
1222
1179
  let r = this.excludedValues.get(e);
1223
1180
  r || (r = /* @__PURE__ */ new Set(), this.excludedValues.set(e, r));
1224
1181
  const l = this.searchText.get(e) ?? "", a = {
@@ -1289,7 +1246,7 @@ class k extends C {
1289
1246
  const f = c.checked;
1290
1247
  for (const x of b.keys())
1291
1248
  b.set(x, f);
1292
- h(), P();
1249
+ h(), q();
1293
1250
  }), e.appendChild(a);
1294
1251
  const p = document.createElement("div");
1295
1252
  p.className = "tbw-filter-values";
@@ -1303,34 +1260,34 @@ class k extends C {
1303
1260
  b.set(x, !n.has(f));
1304
1261
  }), h();
1305
1262
  let R = [];
1306
- const E = (f, x) => {
1263
+ const k = (f, x) => {
1307
1264
  const y = f == null ? "(Blank)" : String(f), v = f == null ? "__null__" : String(f), w = document.createElement("label");
1308
- w.className = "tbw-filter-value-item", w.style.position = "absolute", w.style.top = `${x * k.LIST_ITEM_HEIGHT}px`, w.style.left = "0", w.style.right = "0", w.style.height = `${k.LIST_ITEM_HEIGHT}px`, w.style.boxSizing = "border-box";
1265
+ w.className = "tbw-filter-value-item", w.style.position = "absolute", w.style.top = `${x * A.LIST_ITEM_HEIGHT}px`, w.style.left = "0", w.style.right = "0", w.style.height = `${A.LIST_ITEM_HEIGHT}px`, w.style.boxSizing = "border-box";
1309
1266
  const S = document.createElement("input");
1310
1267
  S.type = "checkbox", S.className = "tbw-filter-checkbox", S.checked = b.get(v) ?? !0, S.dataset.value = v, S.addEventListener("change", () => {
1311
1268
  b.set(v, S.checked), h();
1312
1269
  });
1313
- const Q = document.createElement("span");
1314
- return Q.textContent = y, w.appendChild(S), w.appendChild(Q), w;
1315
- }, P = () => {
1270
+ const ee = document.createElement("span");
1271
+ return ee.textContent = y, w.appendChild(S), w.appendChild(ee), w;
1272
+ }, q = () => {
1316
1273
  const f = R.length, x = p.clientHeight, y = p.scrollTop;
1317
- if (g.style.height = `${f * k.LIST_ITEM_HEIGHT}px`, Be(f, k.LIST_BYPASS_THRESHOLD / 3)) {
1274
+ if (g.style.height = `${f * A.LIST_ITEM_HEIGHT}px`, Ve(f, A.LIST_BYPASS_THRESHOLD / 3)) {
1318
1275
  m.innerHTML = "", m.style.transform = "translateY(0px)", R.forEach((w, S) => {
1319
- m.appendChild(E(w, S));
1276
+ m.appendChild(k(w, S));
1320
1277
  });
1321
1278
  return;
1322
1279
  }
1323
- const v = Oe({
1280
+ const v = Be({
1324
1281
  totalRows: f,
1325
1282
  viewportHeight: x,
1326
1283
  scrollTop: y,
1327
- rowHeight: k.LIST_ITEM_HEIGHT,
1328
- overscan: k.LIST_OVERSCAN
1284
+ rowHeight: A.LIST_ITEM_HEIGHT,
1285
+ overscan: A.LIST_OVERSCAN
1329
1286
  });
1330
1287
  m.style.transform = `translateY(${v.offsetY}px)`, m.innerHTML = "";
1331
1288
  for (let w = v.start; w < v.end; w++)
1332
- m.appendChild(E(R[w], w - v.start));
1333
- }, X = (f) => {
1289
+ m.appendChild(k(R[w], w - v.start));
1290
+ }, J = (f) => {
1334
1291
  const x = f.toLowerCase();
1335
1292
  if (R = o.filter((y) => {
1336
1293
  const v = y == null ? "(Blank)" : String(y);
@@ -1341,25 +1298,25 @@ class k extends C {
1341
1298
  y.className = "tbw-filter-no-match", y.textContent = "No matching values", m.appendChild(y);
1342
1299
  return;
1343
1300
  }
1344
- P();
1301
+ q();
1345
1302
  };
1346
1303
  p.addEventListener(
1347
1304
  "scroll",
1348
1305
  () => {
1349
- R.length > 0 && P();
1306
+ R.length > 0 && q();
1350
1307
  },
1351
1308
  { passive: !0 }
1352
- ), X(l.value), e.appendChild(p);
1353
- let J;
1309
+ ), J(l.value), e.appendChild(p);
1310
+ let Q;
1354
1311
  l.addEventListener("input", () => {
1355
- clearTimeout(J), J = setTimeout(() => {
1356
- this.searchText.set(i, l.value), X(l.value);
1312
+ clearTimeout(Q), Q = setTimeout(() => {
1313
+ this.searchText.set(i, l.value), J(l.value);
1357
1314
  }, this.config.debounceMs ?? 150);
1358
1315
  });
1359
- const F = document.createElement("div");
1360
- F.className = "tbw-filter-buttons";
1361
- const L = document.createElement("button");
1362
- L.className = "tbw-filter-apply-btn", L.textContent = "Apply", L.addEventListener("click", () => {
1316
+ const N = document.createElement("div");
1317
+ N.className = "tbw-filter-buttons";
1318
+ const M = document.createElement("button");
1319
+ M.className = "tbw-filter-apply-btn", M.textContent = "Apply", M.addEventListener("click", () => {
1363
1320
  const f = [];
1364
1321
  for (const [x, y] of b)
1365
1322
  if (!y)
@@ -1370,11 +1327,11 @@ class k extends C {
1370
1327
  f.push(v !== void 0 ? v : x);
1371
1328
  }
1372
1329
  t.applySetFilter(f);
1373
- }), F.appendChild(L);
1374
- const N = document.createElement("button");
1375
- N.className = "tbw-filter-clear-btn", N.textContent = "Clear Filter", N.addEventListener("click", () => {
1330
+ }), N.appendChild(M);
1331
+ const P = document.createElement("button");
1332
+ P.className = "tbw-filter-clear-btn", P.textContent = "Clear Filter", P.addEventListener("click", () => {
1376
1333
  t.clearFilter();
1377
- }), F.appendChild(N), e.appendChild(F);
1334
+ }), N.appendChild(P), e.appendChild(N);
1378
1335
  }
1379
1336
  /**
1380
1337
  * Apply a set filter (exclude values)
@@ -1439,9 +1396,9 @@ class k extends C {
1439
1396
  this.filters.set(e, o), this.cachedResult = null, this.cacheKey = null;
1440
1397
  }
1441
1398
  // ===== Styles =====
1442
- styles = We;
1399
+ styles = $e;
1443
1400
  }
1444
- function je(s) {
1401
+ function Ue(s) {
1445
1402
  if (!s.length) return [];
1446
1403
  const e = /* @__PURE__ */ new Map(), t = [], o = (r, l) => {
1447
1404
  if (!l.length) return;
@@ -1476,7 +1433,7 @@ function je(s) {
1476
1433
  }, e.set(d, c), t.push(c)), c.columns.push(r);
1477
1434
  }), n.length && o(i, n), t.length === 1 && t[0].implicit && t[0].columns.length === s.length ? [] : t;
1478
1435
  }
1479
- function Ue(s, e, t) {
1436
+ function Ye(s, e, t) {
1480
1437
  if (!e.length || !s) return;
1481
1438
  const o = /* @__PURE__ */ new Map();
1482
1439
  for (const i of e)
@@ -1492,7 +1449,7 @@ function Ue(s, e, t) {
1492
1449
  l && l.classList.add("group-end");
1493
1450
  }
1494
1451
  }
1495
- function Ye(s, e) {
1452
+ function Ze(s, e) {
1496
1453
  if (s.length === 0) return null;
1497
1454
  const t = document.createElement("div");
1498
1455
  t.className = "header-group-row", t.setAttribute("role", "row");
@@ -1502,11 +1459,11 @@ function Ye(s, e) {
1502
1459
  }
1503
1460
  return t;
1504
1461
  }
1505
- function Ze(s) {
1462
+ function Xe(s) {
1506
1463
  return s.some((e) => e.group != null);
1507
1464
  }
1508
- const Xe = ".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:4px 8px;font-weight:600;font-size:.9em;text-transform:uppercase;letter-spacing:.5px;border-right:1px solid var(--tbw-grouping-columns-border, 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))}";
1509
- class Jt extends C {
1465
+ const Je = ".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:4px 8px;font-weight:600;font-size:.9em;text-transform:uppercase;letter-spacing:.5px;border-right:1px solid var(--tbw-grouping-columns-border, 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))}";
1466
+ class Qt extends C {
1510
1467
  name = "groupingColumns";
1511
1468
  version = "1.0.0";
1512
1469
  get defaultConfig() {
@@ -1527,11 +1484,11 @@ class Jt extends C {
1527
1484
  */
1528
1485
  static detect(e, t) {
1529
1486
  const o = t?.columns;
1530
- return Array.isArray(o) ? Ze(o) : !1;
1487
+ return Array.isArray(o) ? Xe(o) : !1;
1531
1488
  }
1532
1489
  // ===== Hooks =====
1533
1490
  processColumns(e) {
1534
- const t = je(e);
1491
+ const t = Ue(e);
1535
1492
  return t.length === 0 ? (this.isActive = !1, this.groups = [], [...e]) : (this.isActive = !0, this.groups = t, [...e]);
1536
1493
  }
1537
1494
  afterRender() {
@@ -1544,13 +1501,13 @@ class Jt extends C {
1544
1501
  if (!e) return;
1545
1502
  const t = e.querySelector(".header-group-row");
1546
1503
  t && t.remove();
1547
- const o = Ye(this.groups, this.columns);
1504
+ const o = Ze(this.groups, this.columns);
1548
1505
  if (o) {
1549
1506
  const i = e.querySelector(".header-row");
1550
1507
  i ? e.insertBefore(o, i) : e.appendChild(o);
1551
1508
  }
1552
1509
  const n = e.querySelector(".header-row");
1553
- n && Ue(n, this.groups, this.columns);
1510
+ n && Ye(n, this.groups, this.columns);
1554
1511
  }
1555
1512
  // ===== Public API =====
1556
1513
  /**
@@ -1583,9 +1540,9 @@ class Jt extends C {
1583
1540
  this.requestRender();
1584
1541
  }
1585
1542
  // ===== Styles =====
1586
- styles = Xe;
1543
+ styles = Je;
1587
1544
  }
1588
- function Je({ rows: s, config: e, expanded: t }) {
1545
+ function Qe({ rows: s, config: e, expanded: t }) {
1589
1546
  const o = e.groupOn;
1590
1547
  if (typeof o != "function")
1591
1548
  return [];
@@ -1618,24 +1575,24 @@ function Je({ rows: s, config: e, expanded: t }) {
1618
1575
  };
1619
1576
  return r(n), i;
1620
1577
  }
1621
- function Qe(s, e) {
1578
+ function et(s, e) {
1622
1579
  const t = new Set(s);
1623
1580
  return t.has(e) ? t.delete(e) : t.add(e), t;
1624
1581
  }
1625
- function et(s) {
1582
+ function tt(s) {
1626
1583
  const e = /* @__PURE__ */ new Set();
1627
1584
  for (const t of s)
1628
1585
  t.kind === "group" && e.add(t.key);
1629
1586
  return e;
1630
1587
  }
1631
- function tt() {
1588
+ function ot() {
1632
1589
  return /* @__PURE__ */ new Set();
1633
1590
  }
1634
- function ot(s) {
1591
+ function nt(s) {
1635
1592
  return s.kind !== "group" ? 0 : s.rows.length;
1636
1593
  }
1637
- const nt = '.group-row{background:var(--tbw-grouping-rows-bg, var(--tbw-color-panel-bg));font-weight:500}.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:20px;height:20px;margin-right:4px;font-size:10px}.group-toggle:hover{background:var(--tbw-grouping-rows-toggle-hover, var(--tbw-color-row-hover));border-radius:2px}.group-label{display:inline-flex;align-items:center;gap:8px}.group-count{color:var(--tbw-grouping-rows-count-color, var(--tbw-color-fg-muted));font-size:.85em;font-weight:400}[data-group-depth="0"] .group-label{padding-left:0}[data-group-depth="1"] .group-label{padding-left:20px}[data-group-depth="2"] .group-label{padding-left:40px}[data-group-depth="3"] .group-label{padding-left:60px}[data-group-depth="4"] .group-label{padding-left:80px}';
1638
- class Qt extends C {
1594
+ const it = '.group-row{background:var(--tbw-grouping-rows-bg, var(--tbw-color-panel-bg));font-weight:500}.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:20px;height:20px;margin-right:4px;font-size:10px}.group-toggle:hover{background:var(--tbw-grouping-rows-toggle-hover, var(--tbw-color-row-hover));border-radius:2px}.group-label{display:inline-flex;align-items:center;gap:8px}.group-count{color:var(--tbw-grouping-rows-count-color, var(--tbw-color-fg-muted));font-size:.85em;font-weight:400}[data-group-depth="0"] .group-label{padding-left:0}[data-group-depth="1"] .group-label{padding-left:20px}[data-group-depth="2"] .group-label{padding-left:40px}[data-group-depth="3"] .group-label{padding-left:60px}[data-group-depth="4"] .group-label{padding-left:80px}';
1595
+ class eo extends C {
1639
1596
  name = "groupingRows";
1640
1597
  version = "1.0.0";
1641
1598
  get defaultConfig() {
@@ -1666,7 +1623,7 @@ class Qt extends C {
1666
1623
  const t = this.config;
1667
1624
  if (typeof t.groupOn != "function")
1668
1625
  return this.isActive = !1, this.flattenedRows = [], [...e];
1669
- const o = Je({
1626
+ const o = Qe({
1670
1627
  rows: e,
1671
1628
  config: t,
1672
1629
  expanded: this.expandedKeys
@@ -1678,7 +1635,7 @@ class Qt extends C {
1678
1635
  __groupDepth: n.depth,
1679
1636
  __groupRows: n.rows,
1680
1637
  __groupExpanded: n.expanded,
1681
- __groupRowCount: ot(n)
1638
+ __groupRowCount: nt(n)
1682
1639
  } : n.row));
1683
1640
  }
1684
1641
  onCellClick(e) {
@@ -1742,7 +1699,7 @@ class Qt extends C {
1742
1699
  }), h.appendChild(p);
1743
1700
  const g = document.createElement("span"), m = i[c.field];
1744
1701
  if (m) {
1745
- const b = ee(m, l, c.field, c);
1702
+ const b = te(m, l, c.field, c);
1746
1703
  g.textContent = b != null ? String(b) : String(e.__groupValue);
1747
1704
  } else {
1748
1705
  const b = n.formatLabel ? n.formatLabel(e.__groupValue, e.__groupDepth || 0, e.__groupKey) : String(e.__groupValue);
@@ -1755,7 +1712,7 @@ class Qt extends C {
1755
1712
  } else {
1756
1713
  const p = i[c.field];
1757
1714
  if (p) {
1758
- const g = ee(p, l, c.field, c);
1715
+ const g = te(p, l, c.field, c);
1759
1716
  h.textContent = g != null ? String(g) : "";
1760
1717
  } else
1761
1718
  h.textContent = "";
@@ -1768,20 +1725,20 @@ class Qt extends C {
1768
1725
  * Expand all groups.
1769
1726
  */
1770
1727
  expandAll() {
1771
- this.expandedKeys = et(this.flattenedRows), this.requestRender();
1728
+ this.expandedKeys = tt(this.flattenedRows), this.requestRender();
1772
1729
  }
1773
1730
  /**
1774
1731
  * Collapse all groups.
1775
1732
  */
1776
1733
  collapseAll() {
1777
- this.expandedKeys = tt(), this.requestRender();
1734
+ this.expandedKeys = ot(), this.requestRender();
1778
1735
  }
1779
1736
  /**
1780
1737
  * Toggle expansion of a specific group.
1781
1738
  * @param key - The group key to toggle
1782
1739
  */
1783
1740
  toggle(e) {
1784
- this.expandedKeys = Qe(this.expandedKeys, e);
1741
+ this.expandedKeys = et(this.expandedKeys, e);
1785
1742
  const t = this.flattenedRows.find((o) => o.kind === "group" && o.key === e);
1786
1743
  this.emit("group-toggle", {
1787
1744
  key: e,
@@ -1871,24 +1828,24 @@ class Qt extends C {
1871
1828
  this.config.groupOn = e, this.requestRender();
1872
1829
  }
1873
1830
  // ===== Styles =====
1874
- styles = nt;
1831
+ styles = it;
1875
1832
  }
1876
- function B(s, e) {
1833
+ function V(s, e) {
1877
1834
  const t = new Set(s);
1878
1835
  return t.has(e) ? t.delete(e) : t.add(e), t;
1879
1836
  }
1880
- function it(s, e) {
1837
+ function rt(s, e) {
1881
1838
  const t = new Set(s);
1882
1839
  return t.add(e), t;
1883
1840
  }
1884
- function rt(s, e) {
1841
+ function st(s, e) {
1885
1842
  const t = new Set(s);
1886
1843
  return t.delete(e), t;
1887
1844
  }
1888
- function st(s, e) {
1845
+ function lt(s, e) {
1889
1846
  return s.has(e);
1890
1847
  }
1891
- function lt(s, e, t, o) {
1848
+ function at(s, e, t, o) {
1892
1849
  const n = document.createElement("div");
1893
1850
  n.className = "master-detail-row", n.setAttribute("data-detail-for", String(e)), n.setAttribute("role", "row");
1894
1851
  const i = document.createElement("div");
@@ -1896,8 +1853,8 @@ function lt(s, e, t, o) {
1896
1853
  const r = t(s, e);
1897
1854
  return typeof r == "string" ? i.innerHTML = r : r instanceof HTMLElement && i.appendChild(r), n.appendChild(i), n;
1898
1855
  }
1899
- const at = ".master-detail-cell-wrapper{display:flex;align-items:center;gap:4px}.master-detail-toggle{cursor:pointer;font-size:10px;opacity:.7;user-select:none}.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))}.master-detail-cell{padding:16px;overflow:auto}";
1900
- class eo extends C {
1856
+ const dt = ".master-detail-cell-wrapper{display:flex;align-items:center;gap:4px}.master-detail-toggle{cursor:pointer;font-size:10px;opacity:.7;user-select:none}.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))}.master-detail-cell{padding:16px;overflow:auto}";
1857
+ class to extends C {
1901
1858
  name = "masterDetail";
1902
1859
  version = "1.0.0";
1903
1860
  get defaultConfig() {
@@ -1928,10 +1885,10 @@ class eo extends C {
1928
1885
  const { value: l, row: a } = r, d = this.expandedRows.has(a), c = document.createElement("span");
1929
1886
  c.className = "master-detail-cell-wrapper";
1930
1887
  const u = document.createElement("span");
1931
- u.className = "master-detail-toggle", this.setIcon(u, this.resolveIcon(d ? "collapse" : "expand")), u.setAttribute("aria-expanded", String(d)), u.setAttribute("aria-label", d ? "Collapse details" : "Expand details"), u.addEventListener("click", (p) => {
1888
+ u.className = "master-detail-toggle", this.setIcon(u, this.resolveIcon(d ? "collapse" : "expand")), u.setAttribute("role", "button"), u.setAttribute("tabindex", "0"), u.setAttribute("aria-expanded", String(d)), u.setAttribute("aria-label", d ? "Collapse details" : "Expand details"), u.addEventListener("click", (p) => {
1932
1889
  p.stopPropagation();
1933
1890
  const g = this.rows.indexOf(a);
1934
- this.expandedRows = B(this.expandedRows, a), this.emit("detail-expand", {
1891
+ this.expandedRows = V(this.expandedRows, a), this.emit("detail-expand", {
1935
1892
  rowIndex: g,
1936
1893
  row: a,
1937
1894
  expanded: this.expandedRows.has(a)
@@ -1951,7 +1908,7 @@ class eo extends C {
1951
1908
  }
1952
1909
  onRowClick(e) {
1953
1910
  if (!(!this.config.expandOnRowClick || !this.config.detailRenderer))
1954
- return this.expandedRows = B(this.expandedRows, e.row), this.emit("detail-expand", {
1911
+ return this.expandedRows = V(this.expandedRows, e.row), this.emit("detail-expand", {
1955
1912
  rowIndex: e.rowIndex,
1956
1913
  row: e.row,
1957
1914
  expanded: this.expandedRows.has(e.row)
@@ -1996,7 +1953,7 @@ class eo extends C {
1996
1953
  d.previousElementSibling !== l && l.after(d);
1997
1954
  continue;
1998
1955
  }
1999
- const c = lt(a, r, this.config.detailRenderer, n);
1956
+ const c = at(a, r, this.config.detailRenderer, n);
2000
1957
  typeof this.config.detailHeight == "number" && (c.style.height = `${this.config.detailHeight}px`), l.after(c), this.detailElements.set(a, c);
2001
1958
  }
2002
1959
  }
@@ -2063,7 +2020,7 @@ class eo extends C {
2063
2020
  */
2064
2021
  expand(e) {
2065
2022
  const t = this.rows[e];
2066
- t && (this.expandedRows = it(this.expandedRows, t), this.requestRender());
2023
+ t && (this.expandedRows = rt(this.expandedRows, t), this.requestRender());
2067
2024
  }
2068
2025
  /**
2069
2026
  * Collapse the detail row at the given index.
@@ -2071,7 +2028,7 @@ class eo extends C {
2071
2028
  */
2072
2029
  collapse(e) {
2073
2030
  const t = this.rows[e];
2074
- t && (this.expandedRows = rt(this.expandedRows, t), this.requestRender());
2031
+ t && (this.expandedRows = st(this.expandedRows, t), this.requestRender());
2075
2032
  }
2076
2033
  /**
2077
2034
  * Toggle the detail row at the given index.
@@ -2079,7 +2036,7 @@ class eo extends C {
2079
2036
  */
2080
2037
  toggle(e) {
2081
2038
  const t = this.rows[e];
2082
- t && (this.expandedRows = B(this.expandedRows, t), this.requestRender());
2039
+ t && (this.expandedRows = V(this.expandedRows, t), this.requestRender());
2083
2040
  }
2084
2041
  /**
2085
2042
  * Check if the detail row at the given index is expanded.
@@ -2088,7 +2045,7 @@ class eo extends C {
2088
2045
  */
2089
2046
  isExpanded(e) {
2090
2047
  const t = this.rows[e];
2091
- return t ? st(this.expandedRows, t) : !1;
2048
+ return t ? lt(this.expandedRows, t) : !1;
2092
2049
  }
2093
2050
  /**
2094
2051
  * Expand all detail rows.
@@ -2126,34 +2083,34 @@ class eo extends C {
2126
2083
  return t ? this.detailElements.get(t) : void 0;
2127
2084
  }
2128
2085
  // ===== Styles =====
2129
- styles = at;
2086
+ styles = dt;
2130
2087
  }
2131
- function dt(s, e, t) {
2088
+ function ct(s, e, t) {
2132
2089
  return e.length ? [...s].sort((o, n) => {
2133
2090
  for (const i of e) {
2134
- const l = t.find((u) => u.field === i.field)?.sortComparator ?? ct, a = o[i.field], d = n[i.field], c = l(a, d, o, n);
2091
+ const l = t.find((u) => u.field === i.field)?.sortComparator ?? ut, a = o[i.field], d = n[i.field], c = l(a, d, o, n);
2135
2092
  if (c !== 0)
2136
2093
  return i.direction === "asc" ? c : -c;
2137
2094
  }
2138
2095
  return 0;
2139
2096
  }) : [...s];
2140
2097
  }
2141
- function ct(s, e) {
2098
+ function ut(s, e) {
2142
2099
  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));
2143
2100
  }
2144
- function ut(s, e, t, o) {
2101
+ function ht(s, e, t, o) {
2145
2102
  const n = s.find((i) => i.field === e);
2146
2103
  return t ? n ? n.direction === "asc" ? s.map((i) => i.field === e ? { ...i, direction: "desc" } : i) : s.filter((i) => i.field !== e) : s.length < o ? [...s, { field: e, direction: "asc" }] : s : n?.direction === "asc" ? [{ field: e, direction: "desc" }] : n?.direction === "desc" ? [] : [{ field: e, direction: "asc" }];
2147
2104
  }
2148
- function ue(s, e) {
2105
+ function he(s, e) {
2149
2106
  const t = s.findIndex((o) => o.field === e);
2150
2107
  return t >= 0 ? t + 1 : void 0;
2151
2108
  }
2152
- function he(s, e) {
2109
+ function pe(s, e) {
2153
2110
  return s.find((t) => t.field === e)?.direction;
2154
2111
  }
2155
- const ht = '.header-cell[data-sort=asc]:after{content:"↑";margin-left:4px;opacity:.8}.header-cell[data-sort=desc]:after{content:"↓";margin-left:4px;opacity:.8}.sort-index{font-size:10px;background:var(--tbw-multi-sort-badge-bg, var(--tbw-color-panel-bg));color:var(--tbw-multi-sort-badge-color, var(--tbw-color-fg));border-radius:50%;width:14px;height:14px;display:inline-flex;align-items:center;justify-content:center;margin-left:2px;font-weight:600}';
2156
- class to extends C {
2112
+ const pt = '.header-cell[data-sort=asc]:after{content:"↑";margin-left:4px;opacity:.8}.header-cell[data-sort=desc]:after{content:"↓";margin-left:4px;opacity:.8}.sort-index{font-size:10px;background:var(--tbw-multi-sort-badge-bg, var(--tbw-color-panel-bg));color:var(--tbw-multi-sort-badge-color, var(--tbw-color-fg));border-radius:50%;width:14px;height:14px;display:inline-flex;align-items:center;justify-content:center;margin-left:2px;font-weight:600}';
2113
+ class oo extends C {
2157
2114
  name = "multiSort";
2158
2115
  version = "1.0.0";
2159
2116
  get defaultConfig() {
@@ -2170,12 +2127,12 @@ class to extends C {
2170
2127
  }
2171
2128
  // ===== Hooks =====
2172
2129
  processRows(e) {
2173
- return this.sortModel.length === 0 ? [...e] : dt([...e], this.sortModel, [...this.columns]);
2130
+ return this.sortModel.length === 0 ? [...e] : ct([...e], this.sortModel, [...this.columns]);
2174
2131
  }
2175
2132
  onHeaderClick(e) {
2176
2133
  if (!this.columns.find((i) => i.field === e.field)?.sortable) return !1;
2177
2134
  const o = e.originalEvent.shiftKey, n = this.config.maxSortColumns ?? 3;
2178
- return this.sortModel = ut(this.sortModel, e.field, o, n), this.emit("sort-change", { sortModel: [...this.sortModel] }), this.requestRender(), !0;
2135
+ return this.sortModel = ht(this.sortModel, e.field, o, n), this.emit("sort-change", { sortModel: [...this.sortModel] }), this.requestRender(), !0;
2179
2136
  }
2180
2137
  afterRender() {
2181
2138
  const e = this.shadowRoot;
@@ -2184,7 +2141,7 @@ class to extends C {
2184
2141
  e.querySelectorAll(".header-row .cell[data-field]").forEach((n) => {
2185
2142
  const i = n.getAttribute("data-field");
2186
2143
  if (!i) return;
2187
- const r = ue(this.sortModel, i), l = he(this.sortModel, i);
2144
+ const r = he(this.sortModel, i), l = pe(this.sortModel, i);
2188
2145
  if (n.querySelector(".sort-index")?.remove(), l) {
2189
2146
  n.querySelector('[part~="sort-indicator"], .sort-indicator')?.remove(), n.setAttribute("data-sort", l);
2190
2147
  const c = document.createElement("span");
@@ -2223,7 +2180,7 @@ class to extends C {
2223
2180
  * @returns 1-based index or undefined if not sorted
2224
2181
  */
2225
2182
  getSortIndex(e) {
2226
- return ue(this.sortModel, e);
2183
+ return he(this.sortModel, e);
2227
2184
  }
2228
2185
  /**
2229
2186
  * Get the sort direction for a specific field.
@@ -2231,7 +2188,7 @@ class to extends C {
2231
2188
  * @returns Sort direction or undefined if not sorted
2232
2189
  */
2233
2190
  getSortDirection(e) {
2234
- return he(this.sortModel, e);
2191
+ return pe(this.sortModel, e);
2235
2192
  }
2236
2193
  // ===== Column State Hooks =====
2237
2194
  /**
@@ -2262,18 +2219,18 @@ class to extends C {
2262
2219
  o !== -1 ? this.sortModel[o] = n : this.sortModel.splice(t.sort.priority, 0, n);
2263
2220
  }
2264
2221
  // ===== Styles =====
2265
- styles = ht;
2222
+ styles = pt;
2266
2223
  }
2267
- function pt(s) {
2224
+ function gt(s) {
2268
2225
  return s.filter((e) => e.sticky === "left");
2269
2226
  }
2270
- function gt(s) {
2227
+ function ft(s) {
2271
2228
  return s.filter((e) => e.sticky === "right");
2272
2229
  }
2273
- function V(s) {
2230
+ function K(s) {
2274
2231
  return s.some((e) => e.sticky === "left" || e.sticky === "right");
2275
2232
  }
2276
- function pe(s, e) {
2233
+ function ge(s, e) {
2277
2234
  const t = s.shadowRoot;
2278
2235
  if (!t) return;
2279
2236
  const o = Array.from(t.querySelectorAll(".header-row .cell"));
@@ -2299,14 +2256,14 @@ function pe(s, e) {
2299
2256
  }), r += d.offsetWidth);
2300
2257
  }
2301
2258
  }
2302
- function ge(s) {
2259
+ function fe(s) {
2303
2260
  const e = s.shadowRoot;
2304
2261
  if (!e) return;
2305
2262
  e.querySelectorAll(".sticky-left, .sticky-right").forEach((o) => {
2306
2263
  o.classList.remove("sticky-left", "sticky-right"), o.style.left = "", o.style.right = "";
2307
2264
  });
2308
2265
  }
2309
- class oo extends C {
2266
+ class no extends C {
2310
2267
  name = "pinnedColumns";
2311
2268
  version = "1.0.0";
2312
2269
  get defaultConfig() {
@@ -2326,22 +2283,22 @@ class oo extends C {
2326
2283
  */
2327
2284
  static detect(e, t) {
2328
2285
  const o = t?.columns;
2329
- return Array.isArray(o) ? V(o) : !1;
2286
+ return Array.isArray(o) ? K(o) : !1;
2330
2287
  }
2331
2288
  // ===== Hooks =====
2332
2289
  processColumns(e) {
2333
- return this.isApplied = V([...e]), [...e];
2290
+ return this.isApplied = K([...e]), [...e];
2334
2291
  }
2335
2292
  afterRender() {
2336
2293
  if (!this.isApplied)
2337
2294
  return;
2338
2295
  const e = this.grid, t = [...this.columns];
2339
- if (!V(t)) {
2340
- ge(e), this.isApplied = !1;
2296
+ if (!K(t)) {
2297
+ fe(e), this.isApplied = !1;
2341
2298
  return;
2342
2299
  }
2343
2300
  queueMicrotask(() => {
2344
- pe(e, t);
2301
+ ge(e, t);
2345
2302
  });
2346
2303
  }
2347
2304
  // ===== Public API =====
@@ -2350,32 +2307,32 @@ class oo extends C {
2350
2307
  */
2351
2308
  refreshStickyOffsets() {
2352
2309
  const e = [...this.columns];
2353
- pe(this.grid, e);
2310
+ ge(this.grid, e);
2354
2311
  }
2355
2312
  /**
2356
2313
  * Get columns pinned to the left.
2357
2314
  */
2358
2315
  getLeftPinnedColumns() {
2359
2316
  const e = [...this.columns];
2360
- return pt(e);
2317
+ return gt(e);
2361
2318
  }
2362
2319
  /**
2363
2320
  * Get columns pinned to the right.
2364
2321
  */
2365
2322
  getRightPinnedColumns() {
2366
2323
  const e = [...this.columns];
2367
- return gt(e);
2324
+ return ft(e);
2368
2325
  }
2369
2326
  /**
2370
2327
  * Clear all sticky positioning.
2371
2328
  */
2372
2329
  clearStickyPositions() {
2373
- ge(this.grid);
2330
+ fe(this.grid);
2374
2331
  }
2375
2332
  }
2376
- function K(s, e) {
2333
+ function z(s, e) {
2377
2334
  const t = document.createElement("div");
2378
- t.className = "tbw-pinned-rows", t.setAttribute("role", "status"), t.setAttribute("aria-live", "polite");
2335
+ t.className = "tbw-pinned-rows", t.setAttribute("role", "presentation"), t.setAttribute("aria-live", "polite");
2379
2336
  const o = document.createElement("div");
2380
2337
  o.className = "tbw-pinned-rows-left";
2381
2338
  const n = document.createElement("div");
@@ -2395,7 +2352,7 @@ function K(s, e) {
2395
2352
  }
2396
2353
  if (s.customPanels)
2397
2354
  for (const r of s.customPanels) {
2398
- const l = ft(r, e);
2355
+ const l = mt(r, e);
2399
2356
  switch (r.position) {
2400
2357
  case "left":
2401
2358
  o.appendChild(l);
@@ -2410,15 +2367,15 @@ function K(s, e) {
2410
2367
  }
2411
2368
  return t.appendChild(o), t.appendChild(n), t.appendChild(i), t;
2412
2369
  }
2413
- function fe(s) {
2370
+ function me(s) {
2414
2371
  const e = document.createElement("div");
2415
- return e.className = `tbw-aggregation-rows tbw-aggregation-rows-${s}`, e.setAttribute("role", "rowgroup"), e;
2372
+ return e.className = `tbw-aggregation-rows tbw-aggregation-rows-${s}`, e.setAttribute("role", "presentation"), e;
2416
2373
  }
2417
- function me(s, e, t, o) {
2374
+ function be(s, e, t, o) {
2418
2375
  s.innerHTML = "";
2419
2376
  for (const n of e) {
2420
2377
  const i = document.createElement("div");
2421
- if (i.className = "tbw-aggregation-row", i.setAttribute("role", "row"), n.id && i.setAttribute("data-aggregation-id", n.id), n.fullWidth) {
2378
+ if (i.className = "tbw-aggregation-row", i.setAttribute("role", "presentation"), n.id && i.setAttribute("data-aggregation-id", n.id), n.fullWidth) {
2422
2379
  const r = document.createElement("div");
2423
2380
  r.className = "tbw-aggregation-cell tbw-aggregation-cell-full", r.style.gridColumn = "1 / -1", r.textContent = n.label || "", i.appendChild(r);
2424
2381
  } else
@@ -2428,7 +2385,7 @@ function me(s, e, t, o) {
2428
2385
  let a;
2429
2386
  const d = n.aggregators?.[r.field];
2430
2387
  if (d) {
2431
- const c = _e(d);
2388
+ const c = Ie(d);
2432
2389
  c && (a = c(o, r.field, r));
2433
2390
  } else if (n.cells && Object.prototype.hasOwnProperty.call(n.cells, r.field)) {
2434
2391
  const c = n.cells[r.field];
@@ -2439,13 +2396,13 @@ function me(s, e, t, o) {
2439
2396
  s.appendChild(i);
2440
2397
  }
2441
2398
  }
2442
- function ft(s, e) {
2399
+ function mt(s, e) {
2443
2400
  const t = document.createElement("div");
2444
2401
  t.className = "tbw-status-panel tbw-status-panel-custom", t.id = `status-panel-${s.id}`;
2445
2402
  const o = s.render(e);
2446
2403
  return typeof o == "string" ? t.innerHTML = o : t.appendChild(o), t;
2447
2404
  }
2448
- function be(s, e, t, o, n) {
2405
+ function we(s, e, t, o, n) {
2449
2406
  return {
2450
2407
  totalRows: s.length,
2451
2408
  filteredRows: n?.cachedResult?.length ?? s.length,
@@ -2455,8 +2412,8 @@ function be(s, e, t, o, n) {
2455
2412
  grid: t
2456
2413
  };
2457
2414
  }
2458
- const mt = ".tbw-footer{position:sticky;bottom: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:8px 12px;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:12px;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:16px}.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-weight:var(--tbw-aggregation-font-weight, 600)}.tbw-aggregation-cell{padding:var(--tbw-cell-padding, 2px 8px);min-height:var(--tbw-row-height, 28px);display:flex;align-items:center;border-right:1px solid var(--tbw-color-border-cell)}.tbw-aggregation-cell:last-child{border-right:0}.tbw-aggregation-cell-full{grid-column:1 / -1;border-right:0}";
2459
- class no extends C {
2415
+ const bt = ".tbw-footer{position:sticky;bottom: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:8px 12px;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:12px;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:16px}.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-weight:var(--tbw-aggregation-font-weight, 600)}.tbw-aggregation-cell{padding:var(--tbw-cell-padding, 2px 8px);min-height:var(--tbw-row-height, 28px);display:flex;align-items:center;border-right:1px solid var(--tbw-color-border-cell)}.tbw-aggregation-cell:last-child{border-right:0}.tbw-aggregation-cell-full{grid-column:1 / -1;border-right:0}";
2416
+ class io extends C {
2460
2417
  name = "pinnedRows";
2461
2418
  version = "1.0.0";
2462
2419
  get defaultConfig() {
@@ -2482,7 +2439,7 @@ class no extends C {
2482
2439
  if (!e) return;
2483
2440
  const t = e.querySelector(".tbw-scroll-area") ?? e.querySelector(".tbw-grid-content") ?? e.children[0];
2484
2441
  if (!t) return;
2485
- const o = this.getSelectionState(), n = this.getFilterState(), i = be(
2442
+ const o = this.getSelectionState(), n = this.getFilterState(), i = we(
2486
2443
  this.rows,
2487
2444
  this.columns,
2488
2445
  this.grid,
@@ -2491,11 +2448,11 @@ class no extends C {
2491
2448
  ), r = this.config.aggregationRows || [], l = r.filter((h) => h.position === "top"), a = r.filter((h) => h.position !== "top");
2492
2449
  if (l.length > 0) {
2493
2450
  if (!this.topAggregationContainer) {
2494
- this.topAggregationContainer = fe("top");
2451
+ this.topAggregationContainer = me("top");
2495
2452
  const h = e.querySelector(".header");
2496
2453
  h && h.nextSibling ? t.insertBefore(this.topAggregationContainer, h.nextSibling) : t.appendChild(this.topAggregationContainer);
2497
2454
  }
2498
- me(
2455
+ be(
2499
2456
  this.topAggregationContainer,
2500
2457
  l,
2501
2458
  this.visibleColumns,
@@ -2505,18 +2462,18 @@ class no extends C {
2505
2462
  const d = this.config.showRowCount !== !1 || this.config.showSelectedCount && i.selectedRows > 0 || this.config.showFilteredCount && i.filteredRows !== i.totalRows || this.config.customPanels && this.config.customPanels.length > 0, c = d && this.config.position !== "top", u = a.length > 0 || c;
2506
2463
  if (d && this.config.position === "top")
2507
2464
  if (!this.infoBarElement)
2508
- this.infoBarElement = K(this.config, i), t.insertBefore(this.infoBarElement, t.firstChild);
2465
+ this.infoBarElement = z(this.config, i), t.insertBefore(this.infoBarElement, t.firstChild);
2509
2466
  else {
2510
- const h = K(this.config, i);
2467
+ const h = z(this.config, i);
2511
2468
  this.infoBarElement.replaceWith(h), this.infoBarElement = h;
2512
2469
  }
2513
2470
  else this.config.position === "top" && this.infoBarElement && (this.infoBarElement.remove(), this.infoBarElement = null);
2514
- u ? (this.footerWrapper || (this.footerWrapper = document.createElement("div"), this.footerWrapper.className = "tbw-footer", t.appendChild(this.footerWrapper)), this.footerWrapper.innerHTML = "", a.length > 0 && (this.bottomAggregationContainer || (this.bottomAggregationContainer = fe("bottom")), this.footerWrapper.appendChild(this.bottomAggregationContainer), me(
2471
+ u ? (this.footerWrapper || (this.footerWrapper = document.createElement("div"), this.footerWrapper.className = "tbw-footer", t.appendChild(this.footerWrapper)), this.footerWrapper.innerHTML = "", a.length > 0 && (this.bottomAggregationContainer || (this.bottomAggregationContainer = me("bottom")), this.footerWrapper.appendChild(this.bottomAggregationContainer), be(
2515
2472
  this.bottomAggregationContainer,
2516
2473
  a,
2517
2474
  this.visibleColumns,
2518
2475
  this.rows
2519
- )), c && (this.infoBarElement = K(this.config, i), this.footerWrapper.appendChild(this.infoBarElement))) : this.cleanupFooter();
2476
+ )), c && (this.infoBarElement = z(this.config, i), this.footerWrapper.appendChild(this.infoBarElement))) : this.cleanupFooter();
2520
2477
  }
2521
2478
  // ===== Private Methods =====
2522
2479
  cleanup() {
@@ -2552,7 +2509,7 @@ class no extends C {
2552
2509
  */
2553
2510
  getContext() {
2554
2511
  const e = this.getSelectionState(), t = this.getFilterState();
2555
- return be(
2512
+ return we(
2556
2513
  this.rows,
2557
2514
  this.columns,
2558
2515
  this.grid,
@@ -2589,18 +2546,18 @@ class no extends C {
2589
2546
  this.config.aggregationRows && (this.config.aggregationRows = this.config.aggregationRows.filter((t) => t.id !== e), this.requestRender());
2590
2547
  }
2591
2548
  // ===== Styles =====
2592
- styles = mt;
2549
+ styles = bt;
2593
2550
  }
2594
- const bt = Ie;
2595
- function wt(s) {
2551
+ const wt = Te;
2552
+ function vt(s) {
2596
2553
  const e = [];
2597
2554
  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;
2598
2555
  }
2599
- function Z(s, e) {
2556
+ function X(s, e) {
2600
2557
  return [...s, e].join("|");
2601
2558
  }
2602
- function vt(s, e) {
2603
- const t = e.rowGroupFields ?? [], o = e.columnGroupFields ?? [], n = e.valueFields ?? [], i = xt(s, o), r = ke(
2559
+ function xt(s, e) {
2560
+ const t = e.rowGroupFields ?? [], o = e.columnGroupFields ?? [], n = e.valueFields ?? [], i = Ct(s, o), r = Ae(
2604
2561
  s,
2605
2562
  t,
2606
2563
  o,
@@ -2610,7 +2567,7 @@ function vt(s, e) {
2610
2567
  // starting depth
2611
2568
  ""
2612
2569
  // parent key prefix
2613
- ), l = yt(r, i, n), a = Object.values(l).reduce((d, c) => d + c, 0);
2570
+ ), l = Rt(r, i, n), a = Object.values(l).reduce((d, c) => d + c, 0);
2614
2571
  return {
2615
2572
  rows: r,
2616
2573
  columnKeys: i,
@@ -2618,7 +2575,7 @@ function vt(s, e) {
2618
2575
  grandTotal: a
2619
2576
  };
2620
2577
  }
2621
- function xt(s, e) {
2578
+ function Ct(s, e) {
2622
2579
  if (e.length === 0) return ["value"];
2623
2580
  const t = /* @__PURE__ */ new Set();
2624
2581
  for (const o of s) {
@@ -2627,7 +2584,7 @@ function xt(s, e) {
2627
2584
  }
2628
2585
  return [...t].sort();
2629
2586
  }
2630
- function Ct(s, e) {
2587
+ function yt(s, e) {
2631
2588
  const t = /* @__PURE__ */ new Map();
2632
2589
  for (const o of s) {
2633
2590
  const n = String(o[e] ?? ""), i = t.get(n);
@@ -2635,10 +2592,10 @@ function Ct(s, e) {
2635
2592
  }
2636
2593
  return t;
2637
2594
  }
2638
- function ke(s, e, t, o, n, i, r) {
2595
+ function Ae(s, e, t, o, n, i, r) {
2639
2596
  const l = [];
2640
2597
  if (e.length === 0) {
2641
- const h = we(s, t, o, n), p = ve(h);
2598
+ const h = ve(s, t, o, n), p = xe(h);
2642
2599
  return l.push({
2643
2600
  rowKey: r || "all",
2644
2601
  rowLabel: r || "All",
@@ -2649,11 +2606,11 @@ function ke(s, e, t, o, n, i, r) {
2649
2606
  rowCount: s.length
2650
2607
  }), l;
2651
2608
  }
2652
- const a = e[0], d = e.slice(1), c = d.length > 0, u = Ct(s, a);
2609
+ const a = e[0], d = e.slice(1), c = d.length > 0, u = yt(s, a);
2653
2610
  for (const [h, p] of u) {
2654
- const g = r ? `${r}|${h}` : h, m = we(p, t, o, n), b = ve(m);
2611
+ const g = r ? `${r}|${h}` : h, m = ve(p, t, o, n), b = xe(m);
2655
2612
  let R;
2656
- c && (R = ke(
2613
+ c && (R = Ae(
2657
2614
  p,
2658
2615
  d,
2659
2616
  t,
@@ -2674,36 +2631,36 @@ function ke(s, e, t, o, n, i, r) {
2674
2631
  }
2675
2632
  return l;
2676
2633
  }
2677
- function we(s, e, t, o) {
2634
+ function ve(s, e, t, o) {
2678
2635
  const n = {};
2679
2636
  for (const i of t)
2680
2637
  for (const r of o) {
2681
- const a = (e.length > 0 ? s.filter((h) => e.map((p) => String(h[p] ?? "")).join("|") === i) : s).map((h) => Number(h[r.field]) || 0), d = bt(r.aggFunc), c = a.length > 0 ? d(a) : null, u = Z([i], r.field);
2638
+ const a = (e.length > 0 ? s.filter((h) => e.map((p) => String(h[p] ?? "")).join("|") === i) : s).map((h) => Number(h[r.field]) || 0), d = wt(r.aggFunc), c = a.length > 0 ? d(a) : null, u = X([i], r.field);
2682
2639
  n[u] = c;
2683
2640
  }
2684
2641
  return n;
2685
2642
  }
2686
- function ve(s) {
2643
+ function xe(s) {
2687
2644
  let e = 0;
2688
2645
  for (const t of Object.values(s))
2689
2646
  e += t ?? 0;
2690
2647
  return e;
2691
2648
  }
2692
- function yt(s, e, t) {
2649
+ function Rt(s, e, t) {
2693
2650
  const o = {};
2694
2651
  function n(i) {
2695
2652
  for (const r of i)
2696
2653
  if (!r.isGroup || !r.children?.length)
2697
2654
  for (const l of e)
2698
2655
  for (const a of t) {
2699
- const d = Z([l], a.field);
2656
+ const d = X([l], a.field);
2700
2657
  o[d] = (o[d] ?? 0) + (r.values[d] ?? 0);
2701
2658
  }
2702
2659
  else r.children && n(r.children);
2703
2660
  }
2704
2661
  return n(s), o;
2705
2662
  }
2706
- function Rt(s, e, t = !0) {
2663
+ function St(s, e, t = !0) {
2707
2664
  const o = [];
2708
2665
  function n(i) {
2709
2666
  o.push(i);
@@ -2716,7 +2673,7 @@ function Rt(s, e, t = !0) {
2716
2673
  n(i);
2717
2674
  return o;
2718
2675
  }
2719
- function z(s) {
2676
+ function W(s) {
2720
2677
  const e = [];
2721
2678
  function t(o) {
2722
2679
  if (o.isGroup && e.push(o.rowKey), o.children)
@@ -2727,14 +2684,14 @@ function z(s) {
2727
2684
  t(o);
2728
2685
  return e;
2729
2686
  }
2730
- const St = ["sum", "avg", "count", "min", "max", "first", "last"];
2731
- function Et(s, e, t, o) {
2687
+ const Et = ["sum", "avg", "count", "min", "max", "first", "last"];
2688
+ function kt(s, e, t, o) {
2732
2689
  const n = new AbortController(), i = { config: e, callbacks: o, signal: n.signal }, r = document.createElement("div");
2733
- return r.className = "tbw-pivot-panel", r.appendChild(_("Options", () => Tt(t, i))), r.appendChild(_("Row Groups", () => xe("rowGroups", i))), r.appendChild(_("Column Groups", () => xe("columnGroups", i))), r.appendChild(_("Values", () => At(i))), r.appendChild(_("Available Fields", () => It(i))), s.appendChild(r), () => {
2690
+ return r.className = "tbw-pivot-panel", r.appendChild(T("Options", () => Ft(t, i))), r.appendChild(T("Row Groups", () => Ce("rowGroups", i))), r.appendChild(T("Column Groups", () => Ce("columnGroups", i))), r.appendChild(T("Values", () => _t(i))), r.appendChild(T("Available Fields", () => Tt(i))), s.appendChild(r), () => {
2734
2691
  n.abort(), r.remove();
2735
2692
  };
2736
2693
  }
2737
- function _(s, e) {
2694
+ function T(s, e) {
2738
2695
  const t = document.createElement("div");
2739
2696
  t.className = "tbw-pivot-section";
2740
2697
  const o = document.createElement("div");
@@ -2742,7 +2699,7 @@ function _(s, e) {
2742
2699
  const n = document.createElement("div");
2743
2700
  return n.className = "tbw-pivot-section-content", n.appendChild(e()), t.appendChild(o), t.appendChild(n), t;
2744
2701
  }
2745
- function xe(s, e) {
2702
+ function Ce(s, e) {
2746
2703
  const { config: t, callbacks: o, signal: n } = e, i = document.createElement("div");
2747
2704
  i.className = "tbw-pivot-drop-zone", i.setAttribute("data-zone", s);
2748
2705
  const r = s === "rowGroups" ? t.rowGroupFields ?? [] : t.columnGroupFields ?? [];
@@ -2751,7 +2708,7 @@ function xe(s, e) {
2751
2708
  l.className = "tbw-pivot-placeholder", l.textContent = "Drag fields here or click to add", i.appendChild(l);
2752
2709
  } else
2753
2710
  for (const l of r)
2754
- i.appendChild(kt(l, s, e));
2711
+ i.appendChild(At(l, s, e));
2755
2712
  return i.addEventListener(
2756
2713
  "dragover",
2757
2714
  (l) => {
@@ -2774,7 +2731,7 @@ function xe(s, e) {
2774
2731
  { signal: n }
2775
2732
  ), i;
2776
2733
  }
2777
- function kt(s, e, t) {
2734
+ function At(s, e, t) {
2778
2735
  const { callbacks: o, signal: n } = t, i = document.createElement("div");
2779
2736
  i.className = "tbw-pivot-field-chip", i.draggable = !0;
2780
2737
  const r = o.getAvailableFields().find((d) => d.field === s), l = document.createElement("span");
@@ -2800,7 +2757,7 @@ function kt(s, e, t) {
2800
2757
  { signal: n }
2801
2758
  ), i;
2802
2759
  }
2803
- function At(s) {
2760
+ function _t(s) {
2804
2761
  const { config: e, callbacks: t, signal: o } = s, n = document.createElement("div");
2805
2762
  n.className = "tbw-pivot-drop-zone tbw-pivot-values-zone", n.setAttribute("data-zone", "values");
2806
2763
  const i = e.valueFields ?? [];
@@ -2809,7 +2766,7 @@ function At(s) {
2809
2766
  r.className = "tbw-pivot-placeholder", r.textContent = "Drag numeric fields here for aggregation", n.appendChild(r);
2810
2767
  } else
2811
2768
  for (const r of i)
2812
- n.appendChild(_t(r, s));
2769
+ n.appendChild(It(r, s));
2813
2770
  return n.addEventListener(
2814
2771
  "dragover",
2815
2772
  (r) => {
@@ -2832,7 +2789,7 @@ function At(s) {
2832
2789
  { signal: o }
2833
2790
  ), n;
2834
2791
  }
2835
- function _t(s, e) {
2792
+ function It(s, e) {
2836
2793
  const { callbacks: t, signal: o } = e, n = document.createElement("div");
2837
2794
  n.className = "tbw-pivot-field-chip tbw-pivot-value-chip";
2838
2795
  const i = t.getAvailableFields().find((c) => c.field === s.field), r = document.createElement("div");
@@ -2841,7 +2798,7 @@ function _t(s, e) {
2841
2798
  l.className = "tbw-pivot-chip-label", l.textContent = i?.header ?? s.field;
2842
2799
  const a = document.createElement("select");
2843
2800
  a.className = "tbw-pivot-agg-select", a.title = "Aggregation function";
2844
- for (const c of St) {
2801
+ for (const c of Et) {
2845
2802
  const u = document.createElement("option");
2846
2803
  u.value = c, u.textContent = c.toUpperCase(), u.selected = c === s.aggFunc, a.appendChild(u);
2847
2804
  }
@@ -2861,7 +2818,7 @@ function _t(s, e) {
2861
2818
  { signal: o }
2862
2819
  ), r.appendChild(l), r.appendChild(a), n.appendChild(r), n.appendChild(d), n;
2863
2820
  }
2864
- function It(s) {
2821
+ function Tt(s) {
2865
2822
  const { config: e, callbacks: t, signal: o } = s, n = document.createElement("div");
2866
2823
  n.className = "tbw-pivot-available-fields";
2867
2824
  const i = t.getAvailableFields(), r = /* @__PURE__ */ new Set([
@@ -2891,10 +2848,10 @@ function It(s) {
2891
2848
  }
2892
2849
  return n;
2893
2850
  }
2894
- function Tt(s, e) {
2851
+ function Ft(s, e) {
2895
2852
  const { config: t, callbacks: o, signal: n } = e, i = document.createElement("div");
2896
2853
  return i.className = "tbw-pivot-options", i.appendChild(
2897
- W(
2854
+ $(
2898
2855
  "Enable Pivot View",
2899
2856
  s,
2900
2857
  (r) => {
@@ -2903,7 +2860,7 @@ function Tt(s, e) {
2903
2860
  n
2904
2861
  )
2905
2862
  ), i.appendChild(
2906
- W(
2863
+ $(
2907
2864
  "Show Row Totals",
2908
2865
  t.showTotals ?? !0,
2909
2866
  (r) => {
@@ -2912,7 +2869,7 @@ function Tt(s, e) {
2912
2869
  n
2913
2870
  )
2914
2871
  ), i.appendChild(
2915
- W(
2872
+ $(
2916
2873
  "Show Grand Total",
2917
2874
  t.showGrandTotal ?? !0,
2918
2875
  (r) => {
@@ -2922,7 +2879,7 @@ function Tt(s, e) {
2922
2879
  )
2923
2880
  ), i;
2924
2881
  }
2925
- function W(s, e, t, o) {
2882
+ function $(s, e, t, o) {
2926
2883
  const n = document.createElement("label");
2927
2884
  n.className = "tbw-pivot-checkbox";
2928
2885
  const i = document.createElement("input");
@@ -2930,8 +2887,8 @@ function W(s, e, t, o) {
2930
2887
  const r = document.createElement("span");
2931
2888
  return r.textContent = s, n.appendChild(i), n.appendChild(r), n;
2932
2889
  }
2933
- function Ft(s, e, t) {
2934
- return e.className = "pivot-group-row", e.setAttribute("data-pivot-depth", String(s.__pivotDepth ?? 0)), e.setAttribute("role", "row"), e.setAttribute("aria-expanded", String(s.__pivotExpanded)), e.innerHTML = "", t.columns.forEach((o, n) => {
2890
+ function Lt(s, e, t) {
2891
+ return e.className = "pivot-group-row", e.setAttribute("data-pivot-depth", String(s.__pivotDepth ?? 0)), e.setAttribute("role", "row"), e.innerHTML = "", t.columns.forEach((o, n) => {
2935
2892
  const i = document.createElement("div");
2936
2893
  if (i.className = "cell", i.setAttribute("data-col", String(n)), i.setAttribute("role", "gridcell"), n === 0) {
2937
2894
  const r = Number(s.__pivotIndent) || 0;
@@ -2951,7 +2908,7 @@ function Ft(s, e, t) {
2951
2908
  e.appendChild(i);
2952
2909
  }), !0;
2953
2910
  }
2954
- function Lt(s, e, t) {
2911
+ function Nt(s, e, t) {
2955
2912
  return e.className = "pivot-leaf-row", e.setAttribute("data-pivot-depth", String(s.__pivotDepth ?? 0)), e.innerHTML = "", t.forEach((o, n) => {
2956
2913
  const i = document.createElement("div");
2957
2914
  if (i.className = "cell", i.setAttribute("data-col", String(n)), i.setAttribute("role", "gridcell"), n === 0) {
@@ -2966,10 +2923,10 @@ function Lt(s, e, t) {
2966
2923
  e.appendChild(i);
2967
2924
  }), !0;
2968
2925
  }
2969
- function Nt(s, e, t) {
2970
- return e.className = "pivot-grand-total-row", e.setAttribute("role", "row"), e.innerHTML = "", t.forEach((o, n) => {
2926
+ function Mt(s, e, t) {
2927
+ return e.className = "pivot-grand-total-row", e.setAttribute("role", "presentation"), e.innerHTML = "", t.forEach((o, n) => {
2971
2928
  const i = document.createElement("div");
2972
- if (i.className = "cell", i.setAttribute("data-col", String(n)), i.setAttribute("role", "gridcell"), n === 0) {
2929
+ if (i.className = "cell", i.setAttribute("data-col", String(n)), n === 0) {
2973
2930
  const r = document.createElement("span");
2974
2931
  r.className = "pivot-label", r.textContent = "Grand Total", i.appendChild(r);
2975
2932
  } else {
@@ -2979,8 +2936,8 @@ function Nt(s, e, t) {
2979
2936
  e.appendChild(i);
2980
2937
  }), !0;
2981
2938
  }
2982
- const Mt = '.pivot-group-row{display:grid;grid-template-columns:var(--tbw-column-template);font-weight:600;background:var(--tbw-pivot-group-bg, var(--tbw-color-row-alt));min-height:var(--tbw-row-height);border-bottom:var(--tbw-row-divider)}.pivot-group-row:hover{background:var(--tbw-pivot-group-hover, var(--tbw-color-row-hover))}.pivot-leaf-row{display:grid;grid-template-columns:var(--tbw-column-template);background:var(--tbw-pivot-leaf-bg, var(--tbw-color-bg));min-height:var(--tbw-row-height);border-bottom:var(--tbw-row-divider)}.pivot-grand-total-row{display:grid;grid-template-columns:var(--tbw-column-template);font-weight:700;background:var(--tbw-pivot-grand-total-bg, var(--tbw-color-header-bg));min-height:var(--tbw-row-height);border-top:2px solid var(--tbw-color-border-strong)}.pivot-grand-total-row>.cell{display:flex;align-items:center;padding:var(--tbw-cell-padding);border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0}.pivot-grand-total-row>.cell:last-child{border-right:0}.pivot-grand-total-footer{position:sticky;bottom:0;z-index:var(--tbw-z-layer-pinned-rows, 20);background:var(--tbw-pivot-grand-total-bg, var(--tbw-color-header-bg));min-width:fit-content}.pivot-group-row>.cell,.pivot-leaf-row>.cell{display:flex;align-items:center;padding:var(--tbw-cell-padding);border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0}.pivot-group-row>.cell:last-child,.pivot-leaf-row>.cell:last-child{border-right:0}.pivot-toggle{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;margin-right:6px;border:none;background:transparent;cursor:pointer;font-size:10px;color:var(--tbw-pivot-toggle-color, var(--tbw-color-fg-muted));border-radius:var(--tbw-border-radius);transition:background .15s,color .15s}.pivot-toggle:hover{background:var(--tbw-pivot-toggle-hover-bg, var(--tbw-color-row-hover));color:var(--tbw-pivot-toggle-hover-color, var(--tbw-color-fg))}.pivot-toggle:focus{outline:var(--tbw-focus-outline);outline-offset:var(--tbw-focus-outline-offset)}.pivot-label{font-weight:inherit}.pivot-count{color:var(--tbw-pivot-count-color, var(--tbw-color-fg-muted));font-size:.9em;font-weight:400}.pivot-total-row{font-weight:700;border-top:2px solid var(--tbw-pivot-border, var(--tbw-color-border-strong))}[data-pivot-depth="1"]{--tbw-pivot-depth: 1}[data-pivot-depth="2"]{--tbw-pivot-depth: 2}[data-pivot-depth="3"]{--tbw-pivot-depth: 3}[data-pivot-depth="4"]{--tbw-pivot-depth: 4}.tbw-pivot-panel{display:flex;flex-direction:column;gap:12px;padding:12px;height:100%;overflow-y:auto;font-size:13px}.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:8px 12px;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:8px}.tbw-pivot-toggle-wrapper{display:flex;align-items:center}.tbw-pivot-toggle-label{display:flex;align-items:center;gap:8px;cursor:pointer}.tbw-pivot-toggle-label input{width:16px;height:16px;cursor:pointer}.tbw-pivot-drop-zone{min-height:60px;padding:8px;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:6px;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:8px;text-align:center;width:100%}.tbw-pivot-field-chip{display:inline-flex;align-items:center;gap:6px;padding:4px 8px;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:12px;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:16px;height:16px;padding:0;border:none;background:transparent;color:var(--tbw-color-fg-muted);font-size:14px;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:4px 8px}.tbw-pivot-value-label-wrapper{display:flex;align-items:center;gap:8px;flex:1;min-width:0}.tbw-pivot-agg-select{padding:2px 4px;font-size:11px;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:6px;min-height:40px}.tbw-pivot-options{display:flex;flex-direction:column;gap:8px}.tbw-pivot-checkbox{display:flex;align-items:center;gap:8px;cursor:pointer}.tbw-pivot-checkbox input{width:14px;height:14px;cursor:pointer}';
2983
- class I extends C {
2939
+ const Pt = '.pivot-group-row{display:grid;grid-template-columns:var(--tbw-column-template);font-weight:600;background:var(--tbw-pivot-group-bg, var(--tbw-color-row-alt));min-height:var(--tbw-row-height);border-bottom:var(--tbw-row-divider)}.pivot-group-row:hover{background:var(--tbw-pivot-group-hover, var(--tbw-color-row-hover))}.pivot-leaf-row{display:grid;grid-template-columns:var(--tbw-column-template);background:var(--tbw-pivot-leaf-bg, var(--tbw-color-bg));min-height:var(--tbw-row-height);border-bottom:var(--tbw-row-divider)}.pivot-grand-total-row{display:grid;grid-template-columns:var(--tbw-column-template);font-weight:700;background:var(--tbw-pivot-grand-total-bg, var(--tbw-color-header-bg));min-height:var(--tbw-row-height);border-top:2px solid var(--tbw-color-border-strong)}.pivot-grand-total-row>.cell{display:flex;align-items:center;padding:var(--tbw-cell-padding);border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0}.pivot-grand-total-row>.cell:last-child{border-right:0}.pivot-grand-total-footer{position:sticky;bottom:0;z-index:var(--tbw-z-layer-pinned-rows, 20);background:var(--tbw-pivot-grand-total-bg, var(--tbw-color-header-bg));min-width:fit-content}.pivot-group-row>.cell,.pivot-leaf-row>.cell{display:flex;align-items:center;padding:var(--tbw-cell-padding);border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0}.pivot-group-row>.cell:last-child,.pivot-leaf-row>.cell:last-child{border-right:0}.pivot-toggle{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;margin-right:6px;border:none;background:transparent;cursor:pointer;font-size:10px;color:var(--tbw-pivot-toggle-color, var(--tbw-color-fg-muted));border-radius:var(--tbw-border-radius);transition:background .15s,color .15s}.pivot-toggle:hover{background:var(--tbw-pivot-toggle-hover-bg, var(--tbw-color-row-hover));color:var(--tbw-pivot-toggle-hover-color, var(--tbw-color-fg))}.pivot-toggle:focus{outline:var(--tbw-focus-outline);outline-offset:var(--tbw-focus-outline-offset)}.pivot-label{font-weight:inherit}.pivot-count{color:var(--tbw-pivot-count-color, var(--tbw-color-fg-muted));font-size:.9em;font-weight:400}.pivot-total-row{font-weight:700;border-top:2px solid var(--tbw-pivot-border, var(--tbw-color-border-strong))}[data-pivot-depth="1"]{--tbw-pivot-depth: 1}[data-pivot-depth="2"]{--tbw-pivot-depth: 2}[data-pivot-depth="3"]{--tbw-pivot-depth: 3}[data-pivot-depth="4"]{--tbw-pivot-depth: 4}.tbw-pivot-panel{display:flex;flex-direction:column;gap:12px;padding:12px;height:100%;overflow-y:auto;font-size:13px}.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:8px 12px;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:8px}.tbw-pivot-toggle-wrapper{display:flex;align-items:center}.tbw-pivot-toggle-label{display:flex;align-items:center;gap:8px;cursor:pointer}.tbw-pivot-toggle-label input{width:16px;height:16px;cursor:pointer}.tbw-pivot-drop-zone{min-height:60px;padding:8px;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:6px;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:8px;text-align:center;width:100%}.tbw-pivot-field-chip{display:inline-flex;align-items:center;gap:6px;padding:4px 8px;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:12px;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:16px;height:16px;padding:0;border:none;background:transparent;color:var(--tbw-color-fg-muted);font-size:14px;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:4px 8px}.tbw-pivot-value-label-wrapper{display:flex;align-items:center;gap:8px;flex:1;min-width:0}.tbw-pivot-agg-select{padding:2px 4px;font-size:11px;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:6px;min-height:40px}.tbw-pivot-options{display:flex;flex-direction:column;gap:8px}.tbw-pivot-checkbox{display:flex;align-items:center;gap:8px;cursor:pointer}.tbw-pivot-checkbox input{width:14px;height:14px;cursor:pointer}';
2940
+ class F extends C {
2984
2941
  name = "pivot";
2985
2942
  version = "1.0.0";
2986
2943
  /** Tool panel ID for shell integration */
@@ -3015,7 +2972,7 @@ class I extends C {
3015
2972
  // ===== Shell Integration =====
3016
2973
  getToolPanel() {
3017
2974
  return {
3018
- id: I.PANEL_ID,
2975
+ id: F.PANEL_ID,
3019
2976
  title: "Pivot",
3020
2977
  icon: "⊞",
3021
2978
  tooltip: "Configure pivot table",
@@ -3027,21 +2984,21 @@ class I extends C {
3027
2984
  processRows(e) {
3028
2985
  if (!this.hasInitialized && this.config.active !== !1 && this.hasValidPivotConfig() && (this.hasInitialized = !0, this.isActive = !0), !this.isActive)
3029
2986
  return [...e];
3030
- const t = wt(this.config);
2987
+ const t = vt(this.config);
3031
2988
  if (t.length > 0)
3032
2989
  return this.warn(`Config errors: ${t.join(", ")}`), [...e];
3033
2990
  if (this.buildFieldHeaderMap(), this.defaultExpanded = this.config.defaultExpanded ?? !0, this.expandedKeys.size === 0 && this.defaultExpanded && this.pivotResult) {
3034
- const i = z(this.pivotResult.rows);
2991
+ const i = W(this.pivotResult.rows);
3035
2992
  for (const r of i)
3036
2993
  this.expandedKeys.add(r);
3037
2994
  }
3038
- if (this.pivotResult = vt(e, this.config), this.expandedKeys.size === 0 && this.defaultExpanded) {
3039
- const i = z(this.pivotResult.rows);
2995
+ if (this.pivotResult = xt(e, this.config), this.expandedKeys.size === 0 && this.defaultExpanded) {
2996
+ const i = W(this.pivotResult.rows);
3040
2997
  for (const r of i)
3041
2998
  this.expandedKeys.add(r);
3042
2999
  }
3043
3000
  const o = this.config.indentWidth ?? 20;
3044
- return Rt(
3001
+ return St(
3045
3002
  this.pivotResult.rows,
3046
3003
  this.expandedKeys,
3047
3004
  this.defaultExpanded
@@ -3069,7 +3026,7 @@ class I extends C {
3069
3026
  });
3070
3027
  for (const n of this.pivotResult.columnKeys)
3071
3028
  for (const i of this.config.valueFields ?? []) {
3072
- const r = Z([n], i.field), l = i.header || this.fieldHeaderMap.get(i.field) || i.field;
3029
+ const r = X([n], i.field), l = i.header || this.fieldHeaderMap.get(i.field) || i.field;
3073
3030
  t.push({
3074
3031
  field: r,
3075
3032
  header: `${n} - ${l} (${i.aggFunc})`,
@@ -3086,12 +3043,12 @@ class I extends C {
3086
3043
  }
3087
3044
  renderRow(e, t) {
3088
3045
  const o = e;
3089
- return o.__pivotRowKey && o.__pivotHasChildren ? Ft(o, t, {
3046
+ return o.__pivotRowKey && o.__pivotHasChildren ? Lt(o, t, {
3090
3047
  columns: this.gridColumns,
3091
3048
  onToggle: (n) => this.toggle(n),
3092
3049
  resolveIcon: (n) => this.resolveIcon(n),
3093
3050
  setIcon: (n, i) => this.setIcon(n, i)
3094
- }) : o.__pivotRowKey !== void 0 && this.isActive ? Lt(o, t, this.gridColumns) : (this.cleanupPivotStyling(t), !1);
3051
+ }) : o.__pivotRowKey !== void 0 && this.isActive ? Nt(o, t, this.gridColumns) : (this.cleanupPivotStyling(t), !1);
3095
3052
  }
3096
3053
  /**
3097
3054
  * Remove pivot-specific classes, attributes, and inline styles from a row element.
@@ -3121,7 +3078,7 @@ class I extends C {
3121
3078
  __pivotTotal: this.pivotResult.grandTotal,
3122
3079
  ...this.pivotResult.totals
3123
3080
  };
3124
- Nt(o, this.grandTotalFooter, this.gridColumns);
3081
+ Mt(o, this.grandTotalFooter, this.gridColumns);
3125
3082
  }
3126
3083
  /**
3127
3084
  * Remove the grand total footer element.
@@ -3141,7 +3098,7 @@ class I extends C {
3141
3098
  }
3142
3099
  expandAll() {
3143
3100
  if (this.pivotResult) {
3144
- const e = z(this.pivotResult.rows);
3101
+ const e = W(this.pivotResult.rows);
3145
3102
  for (const t of e)
3146
3103
  this.expandedKeys.add(t);
3147
3104
  this.requestRender();
@@ -3180,16 +3137,16 @@ class I extends C {
3180
3137
  }
3181
3138
  // ===== Tool Panel API =====
3182
3139
  showPanel() {
3183
- this.grid.openToolPanel(I.PANEL_ID);
3140
+ this.grid.openToolPanel(F.PANEL_ID);
3184
3141
  }
3185
3142
  hidePanel() {
3186
3143
  this.grid.closeToolPanel();
3187
3144
  }
3188
3145
  togglePanel() {
3189
- this.grid.toggleToolPanel(I.PANEL_ID);
3146
+ this.grid.toggleToolPanel(F.PANEL_ID);
3190
3147
  }
3191
3148
  isPanelVisible() {
3192
- return this.grid.activeToolPanel === I.PANEL_ID;
3149
+ return this.grid.activeToolPanel === F.PANEL_ID;
3193
3150
  }
3194
3151
  // ===== Private Helpers =====
3195
3152
  get gridColumns() {
@@ -3232,7 +3189,7 @@ class I extends C {
3232
3189
  },
3233
3190
  getAvailableFields: () => this.getAvailableFields()
3234
3191
  };
3235
- return Et(e, this.config, this.isActive, t);
3192
+ return kt(e, this.config, this.isActive, t);
3236
3193
  }
3237
3194
  refreshPanel() {
3238
3195
  this.panelContainer && (this.panelContainer.innerHTML = "", this.renderPanel(this.panelContainer));
@@ -3265,22 +3222,22 @@ class I extends C {
3265
3222
  n >= 0 && (o[n] = { ...o[n], aggFunc: t }, this.config.valueFields = [...o]), this.isActive && this.refresh();
3266
3223
  }
3267
3224
  // ===== Styles =====
3268
- styles = Mt;
3225
+ styles = Pt;
3269
3226
  }
3270
- function Pt(s) {
3227
+ function Dt(s) {
3271
3228
  const e = s.sticky;
3272
3229
  if (e === "left" || e === "right")
3273
3230
  return !1;
3274
3231
  const t = s.meta ?? {}, o = t.sticky;
3275
3232
  return o === "left" || o === "right" ? !1 : t.lockPosition !== !0 && t.suppressMovable !== !0;
3276
3233
  }
3277
- function Ce(s, e, t) {
3234
+ function ye(s, e, t) {
3278
3235
  if (e === t || e < 0 || e >= s.length || t < 0 || t > s.length) return s;
3279
3236
  const o = [...s], [n] = o.splice(e, 1);
3280
3237
  return o.splice(t, 0, n), o;
3281
3238
  }
3282
- const Dt = '.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}';
3283
- class io extends C {
3239
+ const qt = '.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}';
3240
+ class ro extends C {
3284
3241
  name = "reorder";
3285
3242
  version = "1.0.0";
3286
3243
  get defaultConfig() {
@@ -3317,7 +3274,7 @@ class io extends C {
3317
3274
  const n = o, i = n.getAttribute("data-field");
3318
3275
  if (!i) return;
3319
3276
  const r = this.columns.find((l) => l.field === i);
3320
- if (!r || !Pt(r)) {
3277
+ if (!r || !Dt(r)) {
3321
3278
  n.draggable = !1;
3322
3279
  return;
3323
3280
  }
@@ -3339,7 +3296,7 @@ class io extends C {
3339
3296
  const a = this.draggedField, d = this.draggedIndex, c = this.dropIndex;
3340
3297
  if (!this.isDragging || a === null || d === null || c === null)
3341
3298
  return;
3342
- const u = c > d ? c - 1 : c, h = this.getColumnOrder(), p = Ce(h, d, u), g = {
3299
+ const u = c > d ? c - 1 : c, h = this.getColumnOrder(), p = ye(h, d, u), g = {
3343
3300
  field: a,
3344
3301
  fromIndex: d,
3345
3302
  toIndex: u,
@@ -3365,7 +3322,7 @@ class io extends C {
3365
3322
  moveColumn(e, t) {
3366
3323
  const o = this.getColumnOrder(), n = o.indexOf(e);
3367
3324
  if (n === -1) return;
3368
- const i = Ce(o, n, t);
3325
+ const i = ye(o, n, t);
3369
3326
  this.grid.setColumnOrder(i), this.emit("column-move", {
3370
3327
  field: e,
3371
3328
  fromIndex: n,
@@ -3388,25 +3345,25 @@ class io extends C {
3388
3345
  this.grid.setColumnOrder(e), this.grid.requestStateChange?.();
3389
3346
  }
3390
3347
  // ===== Styles =====
3391
- styles = Dt;
3348
+ styles = qt;
3392
3349
  }
3393
- function M(s, e) {
3350
+ function D(s, e) {
3394
3351
  return Math.floor(s / e);
3395
3352
  }
3396
- function qt(s, e) {
3353
+ function Ht(s, e) {
3397
3354
  return {
3398
3355
  start: s * e,
3399
3356
  end: (s + 1) * e
3400
3357
  };
3401
3358
  }
3402
- function Ht(s, e, t) {
3403
- const o = M(s, t), n = M(e - 1, t), i = [];
3359
+ function Gt(s, e, t) {
3360
+ const o = D(s, t), n = D(e - 1, t), i = [];
3404
3361
  for (let r = o; r <= n; r++)
3405
3362
  i.push(r);
3406
3363
  return i;
3407
3364
  }
3408
- async function ye(s, e, t, o) {
3409
- const n = qt(e, t);
3365
+ async function Re(s, e, t, o) {
3366
+ const n = Ht(e, t);
3410
3367
  return s.getRows({
3411
3368
  startRow: n.start,
3412
3369
  endRow: n.end,
@@ -3414,14 +3371,14 @@ async function ye(s, e, t, o) {
3414
3371
  filterModel: o.filterModel
3415
3372
  });
3416
3373
  }
3417
- function Gt(s, e, t) {
3418
- const o = M(s, e), n = t.get(o);
3374
+ function Ot(s, e, t) {
3375
+ const o = D(s, e), n = t.get(o);
3419
3376
  if (!n) return;
3420
3377
  const i = s % e;
3421
3378
  return n[i];
3422
3379
  }
3423
- const Ot = 100;
3424
- class ro extends C {
3380
+ const Bt = 100;
3381
+ class so extends C {
3425
3382
  name = "serverSide";
3426
3383
  version = "1.0.0";
3427
3384
  get defaultConfig() {
@@ -3448,12 +3405,12 @@ class ro extends C {
3448
3405
  */
3449
3406
  loadRequiredBlocks() {
3450
3407
  if (!this.dataSource) return;
3451
- const e = this.grid, t = this.config.cacheBlockSize ?? 100, o = { startRow: e.virtualization.start, endRow: e.virtualization.end }, n = Ht(o.startRow, o.endRow, t);
3408
+ const e = this.grid, t = this.config.cacheBlockSize ?? 100, o = { startRow: e.virtualization.start, endRow: e.virtualization.end }, n = Gt(o.startRow, o.endRow, t);
3452
3409
  for (const i of n)
3453
3410
  if (!(this.loadedBlocks.has(i) || this.loadingBlocks.has(i))) {
3454
3411
  if (this.loadingBlocks.size >= (this.config.maxConcurrentRequests ?? 2))
3455
3412
  break;
3456
- this.loadingBlocks.add(i), ye(this.dataSource, i, t, {}).then((r) => {
3413
+ this.loadingBlocks.add(i), Re(this.dataSource, i, t, {}).then((r) => {
3457
3414
  this.loadedBlocks.set(i, r.rows), this.totalRowCount = r.totalRowCount, this.loadingBlocks.delete(i), this.requestRender(), this.loadRequiredBlocks();
3458
3415
  }).catch(() => {
3459
3416
  this.loadingBlocks.delete(i);
@@ -3465,7 +3422,7 @@ class ro extends C {
3465
3422
  if (!this.dataSource) return [...e];
3466
3423
  const t = [];
3467
3424
  for (let o = 0; o < this.totalRowCount; o++) {
3468
- const n = Gt(o, this.config.cacheBlockSize ?? 100, this.loadedBlocks);
3425
+ const n = Ot(o, this.config.cacheBlockSize ?? 100, this.loadedBlocks);
3469
3426
  t.push(n ?? { __loading: !0, __index: o });
3470
3427
  }
3471
3428
  return t;
@@ -3473,7 +3430,7 @@ class ro extends C {
3473
3430
  onScroll(e) {
3474
3431
  this.dataSource && (this.loadRequiredBlocks(), this.scrollDebounceTimer && clearTimeout(this.scrollDebounceTimer), this.scrollDebounceTimer = setTimeout(() => {
3475
3432
  this.loadRequiredBlocks();
3476
- }, Ot));
3433
+ }, Bt));
3477
3434
  }
3478
3435
  // ===== Public API =====
3479
3436
  /**
@@ -3483,7 +3440,7 @@ class ro extends C {
3483
3440
  setDataSource(e) {
3484
3441
  this.dataSource = e, this.loadedBlocks.clear(), this.loadingBlocks.clear();
3485
3442
  const t = this.config.cacheBlockSize ?? 100;
3486
- ye(e, 0, t, {}).then((o) => {
3443
+ Re(e, 0, t, {}).then((o) => {
3487
3444
  this.loadedBlocks.set(0, o.rows), this.totalRowCount = o.totalRowCount, this.requestRender();
3488
3445
  });
3489
3446
  }
@@ -3510,7 +3467,7 @@ class ro extends C {
3510
3467
  * @param rowIndex - Row index to check
3511
3468
  */
3512
3469
  isRowLoaded(e) {
3513
- const t = this.config.cacheBlockSize ?? 100, o = M(e, t);
3470
+ const t = this.config.cacheBlockSize ?? 100, o = D(e, t);
3514
3471
  return this.loadedBlocks.has(o);
3515
3472
  }
3516
3473
  /**
@@ -3520,7 +3477,7 @@ class ro extends C {
3520
3477
  return this.loadedBlocks.size;
3521
3478
  }
3522
3479
  }
3523
- function Bt(s, e, t) {
3480
+ function Vt(s, e, t) {
3524
3481
  const o = [...s.undoStack, e];
3525
3482
  for (; o.length > t; )
3526
3483
  o.shift();
@@ -3530,7 +3487,7 @@ function Bt(s, e, t) {
3530
3487
  // Clear redo on new action
3531
3488
  };
3532
3489
  }
3533
- function Re(s) {
3490
+ function Se(s) {
3534
3491
  if (s.undoStack.length === 0)
3535
3492
  return { newState: s, action: null };
3536
3493
  const e = [...s.undoStack], t = e.pop();
@@ -3542,7 +3499,7 @@ function Re(s) {
3542
3499
  action: t
3543
3500
  } : { newState: s, action: null };
3544
3501
  }
3545
- function Se(s) {
3502
+ function Ee(s) {
3546
3503
  if (s.redoStack.length === 0)
3547
3504
  return { newState: s, action: null };
3548
3505
  const e = [...s.redoStack], t = e.pop();
@@ -3554,16 +3511,16 @@ function Se(s) {
3554
3511
  action: t
3555
3512
  } : { newState: s, action: null };
3556
3513
  }
3557
- function Vt(s) {
3514
+ function Kt(s) {
3558
3515
  return s.undoStack.length > 0;
3559
3516
  }
3560
- function Kt(s) {
3517
+ function zt(s) {
3561
3518
  return s.redoStack.length > 0;
3562
3519
  }
3563
- function zt() {
3520
+ function Wt() {
3564
3521
  return { undoStack: [], redoStack: [] };
3565
3522
  }
3566
- function Wt(s, e, t, o) {
3523
+ function $t(s, e, t, o) {
3567
3524
  return {
3568
3525
  type: "cell-edit",
3569
3526
  rowIndex: s,
@@ -3573,7 +3530,7 @@ function Wt(s, e, t, o) {
3573
3530
  timestamp: Date.now()
3574
3531
  };
3575
3532
  }
3576
- class so extends C {
3533
+ class lo extends C {
3577
3534
  name = "undoRedo";
3578
3535
  version = "1.0.0";
3579
3536
  get defaultConfig() {
@@ -3598,7 +3555,7 @@ class so extends C {
3598
3555
  onKeyDown(e) {
3599
3556
  const t = (e.ctrlKey || e.metaKey) && e.key === "z" && !e.shiftKey, o = (e.ctrlKey || e.metaKey) && (e.key === "y" || e.key === "z" && e.shiftKey);
3600
3557
  if (t) {
3601
- const n = Re({ undoStack: this.undoStack, redoStack: this.redoStack });
3558
+ const n = Se({ undoStack: this.undoStack, redoStack: this.redoStack });
3602
3559
  if (n.action) {
3603
3560
  const i = this.rows;
3604
3561
  i[n.action.rowIndex] && (i[n.action.rowIndex][n.action.field] = n.action.oldValue), this.undoStack = n.newState.undoStack, this.redoStack = n.newState.redoStack, this.emit("undo", {
@@ -3609,7 +3566,7 @@ class so extends C {
3609
3566
  return !0;
3610
3567
  }
3611
3568
  if (o) {
3612
- const n = Se({ undoStack: this.undoStack, redoStack: this.redoStack });
3569
+ const n = Ee({ undoStack: this.undoStack, redoStack: this.redoStack });
3613
3570
  if (n.action) {
3614
3571
  const i = this.rows;
3615
3572
  i[n.action.rowIndex] && (i[n.action.rowIndex][n.action.field] = n.action.newValue), this.undoStack = n.newState.undoStack, this.redoStack = n.newState.redoStack, this.emit("redo", {
@@ -3632,7 +3589,7 @@ class so extends C {
3632
3589
  * @param newValue - The value after the edit
3633
3590
  */
3634
3591
  recordEdit(e, t, o, n) {
3635
- const i = Wt(e, t, o, n), r = Bt(
3592
+ const i = $t(e, t, o, n), r = Vt(
3636
3593
  { undoStack: this.undoStack, redoStack: this.redoStack },
3637
3594
  i,
3638
3595
  this.config.maxHistorySize ?? 100
@@ -3645,7 +3602,7 @@ class so extends C {
3645
3602
  * @returns The undone action, or null if nothing to undo
3646
3603
  */
3647
3604
  undo() {
3648
- const e = Re({ undoStack: this.undoStack, redoStack: this.redoStack });
3605
+ const e = Se({ undoStack: this.undoStack, redoStack: this.redoStack });
3649
3606
  if (e.action) {
3650
3607
  const t = this.rows;
3651
3608
  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();
@@ -3658,7 +3615,7 @@ class so extends C {
3658
3615
  * @returns The redone action, or null if nothing to redo
3659
3616
  */
3660
3617
  redo() {
3661
- const e = Se({ undoStack: this.undoStack, redoStack: this.redoStack });
3618
+ const e = Ee({ undoStack: this.undoStack, redoStack: this.redoStack });
3662
3619
  if (e.action) {
3663
3620
  const t = this.rows;
3664
3621
  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();
@@ -3669,19 +3626,19 @@ class so extends C {
3669
3626
  * Check if there are any actions that can be undone.
3670
3627
  */
3671
3628
  canUndo() {
3672
- return Vt({ undoStack: this.undoStack, redoStack: this.redoStack });
3629
+ return Kt({ undoStack: this.undoStack, redoStack: this.redoStack });
3673
3630
  }
3674
3631
  /**
3675
3632
  * Check if there are any actions that can be redone.
3676
3633
  */
3677
3634
  canRedo() {
3678
- return Kt({ undoStack: this.undoStack, redoStack: this.redoStack });
3635
+ return zt({ undoStack: this.undoStack, redoStack: this.redoStack });
3679
3636
  }
3680
3637
  /**
3681
3638
  * Clear all undo/redo history.
3682
3639
  */
3683
3640
  clearHistory() {
3684
- const e = zt();
3641
+ const e = Wt();
3685
3642
  this.undoStack = e.undoStack, this.redoStack = e.redoStack;
3686
3643
  }
3687
3644
  /**
@@ -3697,12 +3654,12 @@ class so extends C {
3697
3654
  return [...this.redoStack];
3698
3655
  }
3699
3656
  }
3700
- const $t = '.tbw-visibility-content{display:flex;flex-direction:column;height:100%}.tbw-visibility-list{flex:1;overflow-y:auto;padding:8px}.tbw-visibility-row{display:flex;align-items:center;gap:8px;padding:6px 4px;cursor:pointer;font-size:13px;border-radius:var(--tbw-border-radius, 4px);position:relative}.tbw-visibility-row:hover{background:var(--tbw-visibility-hover, var(--tbw-color-row-hover, #f3f4f6))}.tbw-visibility-row input[type=checkbox]{cursor:pointer}.tbw-visibility-row.locked span{color:var(--tbw-color-fg-muted, #888)}.tbw-visibility-handle{cursor:grab;color:var(--tbw-color-fg-muted, #888);font-size:10px;letter-spacing:-2px;user-select:none;flex-shrink:0}.tbw-visibility-row.reorderable:hover .tbw-visibility-handle{color:var(--tbw-color-fg, #1f2937)}.tbw-visibility-label{display:flex;align-items:center;gap:8px;flex:1;cursor:pointer}.tbw-visibility-row.dragging{opacity:.5;cursor:grabbing}.tbw-visibility-row.drop-before:before{content:"";position:absolute;left:0;right:0;top:0;height:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent, #3b82f6))}.tbw-visibility-row.drop-after:after{content:"";position:absolute;left:0;right:0;bottom:0;height:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent, #3b82f6))}.tbw-visibility-show-all{margin:8px;padding:8px 12px;border:1px solid var(--tbw-visibility-border, var(--tbw-color-border, #e5e7eb));border-radius:var(--tbw-border-radius, 4px);background:var(--tbw-visibility-btn-bg, var(--tbw-color-header-bg, #f9fafb));color:var(--tbw-color-fg, #1f2937);cursor:pointer;font-size:13px}.tbw-visibility-show-all:hover{background:var(--tbw-visibility-hover, var(--tbw-color-row-hover, #f3f4f6))}';
3701
- function Ee(s) {
3657
+ const jt = '.tbw-visibility-content{display:flex;flex-direction:column;height:100%}.tbw-visibility-list{flex:1;overflow-y:auto;padding:8px}.tbw-visibility-row{display:flex;align-items:center;gap:8px;padding:6px 4px;cursor:pointer;font-size:13px;border-radius:var(--tbw-border-radius, 4px);position:relative}.tbw-visibility-row:hover{background:var(--tbw-visibility-hover, var(--tbw-color-row-hover, #f3f4f6))}.tbw-visibility-row input[type=checkbox]{cursor:pointer}.tbw-visibility-row.locked span{color:var(--tbw-color-fg-muted, #888)}.tbw-visibility-handle{cursor:grab;color:var(--tbw-color-fg-muted, #888);font-size:10px;letter-spacing:-2px;user-select:none;flex-shrink:0}.tbw-visibility-row.reorderable:hover .tbw-visibility-handle{color:var(--tbw-color-fg, #1f2937)}.tbw-visibility-label{display:flex;align-items:center;gap:8px;flex:1;cursor:pointer}.tbw-visibility-row.dragging{opacity:.5;cursor:grabbing}.tbw-visibility-row.drop-before:before{content:"";position:absolute;left:0;right:0;top:0;height:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent, #3b82f6))}.tbw-visibility-row.drop-after:after{content:"";position:absolute;left:0;right:0;bottom:0;height:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent, #3b82f6))}.tbw-visibility-show-all{margin:8px;padding:8px 12px;border:1px solid var(--tbw-visibility-border, var(--tbw-color-border, #e5e7eb));border-radius:var(--tbw-border-radius, 4px);background:var(--tbw-visibility-btn-bg, var(--tbw-color-header-bg, #f9fafb));color:var(--tbw-color-fg, #1f2937);cursor:pointer;font-size:13px}.tbw-visibility-show-all:hover{background:var(--tbw-visibility-hover, var(--tbw-color-row-hover, #f3f4f6))}';
3658
+ function ke(s) {
3702
3659
  const e = s.meta ?? {};
3703
3660
  return e.lockPosition !== !0 && e.suppressMovable !== !0;
3704
3661
  }
3705
- class T extends C {
3662
+ class L extends C {
3706
3663
  name = "visibility";
3707
3664
  version = "1.0.0";
3708
3665
  /** Tool panel ID for shell integration */
@@ -3729,7 +3686,7 @@ class T extends C {
3729
3686
  */
3730
3687
  getToolPanel() {
3731
3688
  return {
3732
- id: T.PANEL_ID,
3689
+ id: L.PANEL_ID,
3733
3690
  title: "Columns",
3734
3691
  icon: "☰",
3735
3692
  tooltip: "Column visibility",
@@ -3743,7 +3700,7 @@ class T extends C {
3743
3700
  * Show the visibility sidebar panel.
3744
3701
  */
3745
3702
  show() {
3746
- this.grid.openToolPanel(T.PANEL_ID);
3703
+ this.grid.openToolPanel(L.PANEL_ID);
3747
3704
  }
3748
3705
  /**
3749
3706
  * Hide the visibility sidebar panel.
@@ -3755,7 +3712,7 @@ class T extends C {
3755
3712
  * Toggle the visibility sidebar panel.
3756
3713
  */
3757
3714
  toggle() {
3758
- this.grid.toggleToolPanel(T.PANEL_ID);
3715
+ this.grid.toggleToolPanel(L.PANEL_ID);
3759
3716
  }
3760
3717
  /**
3761
3718
  * Check if a specific column is visible.
@@ -3833,7 +3790,7 @@ class T extends C {
3833
3790
  * @returns True if the panel is open
3834
3791
  */
3835
3792
  isPanelVisible() {
3836
- return this.grid.activeToolPanel === T.PANEL_ID;
3793
+ return this.grid.activeToolPanel === L.PANEL_ID;
3837
3794
  }
3838
3795
  // ===== Private Methods =====
3839
3796
  /**
@@ -3869,7 +3826,7 @@ class T extends C {
3869
3826
  const n = t.getAllColumns();
3870
3827
  for (let i = 0; i < n.length; i++) {
3871
3828
  const r = n[i], l = r.header || r.field, a = document.createElement("div");
3872
- a.className = r.lockVisible ? "tbw-visibility-row locked" : "tbw-visibility-row", a.setAttribute("data-field", r.field), a.setAttribute("data-index", String(i)), o && Ee(r) && (a.draggable = !0, a.classList.add("reorderable"), this.setupDragListeners(a, r.field, i, e));
3829
+ a.className = r.lockVisible ? "tbw-visibility-row locked" : "tbw-visibility-row", a.setAttribute("data-field", r.field), a.setAttribute("data-index", String(i)), o && ke(r) && (a.draggable = !0, a.classList.add("reorderable"), this.setupDragListeners(a, r.field, i, e));
3873
3830
  const d = document.createElement("label");
3874
3831
  d.className = "tbw-visibility-label";
3875
3832
  const c = document.createElement("input");
@@ -3877,7 +3834,7 @@ class T extends C {
3877
3834
  t.toggleColumnVisibility(r.field), setTimeout(() => this.rebuildToggles(e), 0);
3878
3835
  });
3879
3836
  const u = document.createElement("span");
3880
- if (u.textContent = l, d.appendChild(c), d.appendChild(u), o && Ee(r)) {
3837
+ if (u.textContent = l, d.appendChild(c), d.appendChild(u), o && ke(r)) {
3881
3838
  const h = document.createElement("span");
3882
3839
  h.className = "tbw-visibility-handle", this.setIcon(h, this.resolveIcon("dragHandle")), h.title = "Drag to reorder", a.appendChild(h);
3883
3840
  }
@@ -3922,46 +3879,46 @@ class T extends C {
3922
3879
  });
3923
3880
  }
3924
3881
  // ===== Styles =====
3925
- styles = $t;
3882
+ styles = jt;
3926
3883
  }
3927
3884
  export {
3928
3885
  C as BaseGridPlugin,
3929
- Ut as ClipboardPlugin,
3930
- Yt as ColumnVirtualizationPlugin,
3931
- Zt as ContextMenuPlugin,
3932
- Ae as DEFAULT_GRID_ICONS,
3933
- co as DGEvents,
3934
- uo as DataGridElement,
3935
- Xt as ExportPlugin,
3936
- k as FilteringPlugin,
3937
- ho as FitModeEnum,
3938
- po as GridCSSVars,
3939
- go as GridClasses,
3940
- fo as GridDataAttrs,
3941
- mo as GridElement,
3942
- bo as GridSelectors,
3943
- Jt as GroupingColumnsPlugin,
3944
- Qt as GroupingRowsPlugin,
3945
- eo as MasterDetailPlugin,
3946
- to as MultiSortPlugin,
3947
- oo as PinnedColumnsPlugin,
3948
- no as PinnedRowsPlugin,
3949
- I as PivotPlugin,
3950
- wo as PluginEvents,
3951
- vo as PluginManager,
3952
- io as ReorderPlugin,
3953
- xo as SelectionPlugin,
3954
- ro as ServerSidePlugin,
3955
- Co as TreePlugin,
3956
- so as UndoRedoPlugin,
3957
- T as VisibilityPlugin,
3958
- yo as aggregatorRegistry,
3959
- _e as getAggregator,
3960
- Ie as getValueAggregator,
3961
- Ro as listAggregators,
3962
- So as registerAggregator,
3963
- ee as runAggregator,
3964
- Eo as runValueAggregator,
3965
- ko as unregisterAggregator
3886
+ Yt as ClipboardPlugin,
3887
+ Zt as ColumnVirtualizationPlugin,
3888
+ Xt as ContextMenuPlugin,
3889
+ _e as DEFAULT_GRID_ICONS,
3890
+ uo as DGEvents,
3891
+ ho as DataGridElement,
3892
+ Jt as ExportPlugin,
3893
+ A as FilteringPlugin,
3894
+ po as FitModeEnum,
3895
+ go as GridCSSVars,
3896
+ fo as GridClasses,
3897
+ mo as GridDataAttrs,
3898
+ bo as GridElement,
3899
+ wo as GridSelectors,
3900
+ Qt as GroupingColumnsPlugin,
3901
+ eo as GroupingRowsPlugin,
3902
+ to as MasterDetailPlugin,
3903
+ oo as MultiSortPlugin,
3904
+ no as PinnedColumnsPlugin,
3905
+ io as PinnedRowsPlugin,
3906
+ F as PivotPlugin,
3907
+ vo as PluginEvents,
3908
+ xo as PluginManager,
3909
+ ro as ReorderPlugin,
3910
+ Co as SelectionPlugin,
3911
+ so as ServerSidePlugin,
3912
+ yo as TreePlugin,
3913
+ lo as UndoRedoPlugin,
3914
+ L as VisibilityPlugin,
3915
+ Ro as aggregatorRegistry,
3916
+ Ie as getAggregator,
3917
+ Te as getValueAggregator,
3918
+ So as listAggregators,
3919
+ Eo as registerAggregator,
3920
+ te as runAggregator,
3921
+ ko as runValueAggregator,
3922
+ Ao as unregisterAggregator
3966
3923
  };
3967
3924
  //# sourceMappingURL=all.js.map