@toolbox-web/grid 0.4.2 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/README.md +2 -3
  2. package/all.js +1063 -1024
  3. package/all.js.map +1 -1
  4. package/index.js +1078 -912
  5. package/index.js.map +1 -1
  6. package/lib/core/grid.d.ts +28 -0
  7. package/lib/core/grid.d.ts.map +1 -1
  8. package/lib/core/internal/dom-builder.d.ts +2 -0
  9. package/lib/core/internal/dom-builder.d.ts.map +1 -1
  10. package/lib/core/internal/event-delegation.d.ts +21 -0
  11. package/lib/core/internal/event-delegation.d.ts.map +1 -1
  12. package/lib/core/internal/header.d.ts.map +1 -1
  13. package/lib/core/internal/resize.d.ts.map +1 -1
  14. package/lib/core/internal/rows.d.ts +1 -1
  15. package/lib/core/internal/rows.d.ts.map +1 -1
  16. package/lib/core/internal/shell.d.ts +19 -13
  17. package/lib/core/internal/shell.d.ts.map +1 -1
  18. package/lib/core/plugin/base-plugin.d.ts +13 -2
  19. package/lib/core/plugin/base-plugin.d.ts.map +1 -1
  20. package/lib/core/plugin/expander-column.d.ts.map +1 -1
  21. package/lib/core/plugin/plugin-manager.d.ts +6 -2
  22. package/lib/core/plugin/plugin-manager.d.ts.map +1 -1
  23. package/lib/core/types.d.ts +41 -3
  24. package/lib/core/types.d.ts.map +1 -1
  25. package/lib/plugins/clipboard/index.js +22 -11
  26. package/lib/plugins/clipboard/index.js.map +1 -1
  27. package/lib/plugins/column-virtualization/index.js +59 -48
  28. package/lib/plugins/column-virtualization/index.js.map +1 -1
  29. package/lib/plugins/context-menu/index.js +71 -60
  30. package/lib/plugins/context-menu/index.js.map +1 -1
  31. package/lib/plugins/editing/EditingPlugin.d.ts +1 -0
  32. package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
  33. package/lib/plugins/editing/index.js +93 -80
  34. package/lib/plugins/editing/index.js.map +1 -1
  35. package/lib/plugins/export/index.js +29 -18
  36. package/lib/plugins/export/index.js.map +1 -1
  37. package/lib/plugins/filtering/FilteringPlugin.d.ts +9 -1
  38. package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -1
  39. package/lib/plugins/filtering/index.js +199 -165
  40. package/lib/plugins/filtering/index.js.map +1 -1
  41. package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts +1 -0
  42. package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts.map +1 -1
  43. package/lib/plugins/grouping-columns/index.js +79 -49
  44. package/lib/plugins/grouping-columns/index.js.map +1 -1
  45. package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts.map +1 -1
  46. package/lib/plugins/grouping-rows/index.js +98 -87
  47. package/lib/plugins/grouping-rows/index.js.map +1 -1
  48. package/lib/plugins/master-detail/index.js +70 -57
  49. package/lib/plugins/master-detail/index.js.map +1 -1
  50. package/lib/plugins/multi-sort/index.js +48 -37
  51. package/lib/plugins/multi-sort/index.js.map +1 -1
  52. package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts.map +1 -1
  53. package/lib/plugins/pinned-columns/index.js +71 -66
  54. package/lib/plugins/pinned-columns/index.js.map +1 -1
  55. package/lib/plugins/pinned-columns/pinned-columns.d.ts +2 -2
  56. package/lib/plugins/pinned-columns/pinned-columns.d.ts.map +1 -1
  57. package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts.map +1 -1
  58. package/lib/plugins/pinned-rows/index.js +63 -52
  59. package/lib/plugins/pinned-rows/index.js.map +1 -1
  60. package/lib/plugins/pivot/PivotPlugin.d.ts.map +1 -1
  61. package/lib/plugins/pivot/index.js +310 -299
  62. package/lib/plugins/pivot/index.js.map +1 -1
  63. package/lib/plugins/reorder/ReorderPlugin.d.ts.map +1 -1
  64. package/lib/plugins/reorder/index.d.ts +1 -1
  65. package/lib/plugins/reorder/index.d.ts.map +1 -1
  66. package/lib/plugins/reorder/index.js +79 -68
  67. package/lib/plugins/reorder/index.js.map +1 -1
  68. package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
  69. package/lib/plugins/selection/index.js +115 -105
  70. package/lib/plugins/selection/index.js.map +1 -1
  71. package/lib/plugins/server-side/index.js +15 -4
  72. package/lib/plugins/server-side/index.js.map +1 -1
  73. package/lib/plugins/tree/TreePlugin.d.ts.map +1 -1
  74. package/lib/plugins/tree/index.js +41 -30
  75. package/lib/plugins/tree/index.js.map +1 -1
  76. package/lib/plugins/undo-redo/index.js +29 -18
  77. package/lib/plugins/undo-redo/index.js.map +1 -1
  78. package/lib/plugins/visibility/VisibilityPlugin.d.ts.map +1 -1
  79. package/lib/plugins/visibility/index.js +59 -47
  80. package/lib/plugins/visibility/index.js.map +1 -1
  81. package/package.json +6 -6
  82. package/public.d.ts +42 -0
  83. package/public.d.ts.map +1 -1
  84. package/themes/dg-theme-bootstrap.css +55 -53
  85. package/themes/dg-theme-contrast.css +42 -40
  86. package/themes/dg-theme-large.css +38 -37
  87. package/themes/dg-theme-material.css +54 -52
  88. package/themes/dg-theme-standard.css +19 -17
  89. package/themes/dg-theme-vibrant.css +16 -14
  90. package/umd/grid.all.umd.js +23 -22
  91. package/umd/grid.all.umd.js.map +1 -1
  92. package/umd/grid.umd.js +15 -14
  93. package/umd/grid.umd.js.map +1 -1
  94. package/umd/plugins/column-virtualization.umd.js +1 -1
  95. package/umd/plugins/column-virtualization.umd.js.map +1 -1
  96. package/umd/plugins/context-menu.umd.js +1 -1
  97. package/umd/plugins/context-menu.umd.js.map +1 -1
  98. package/umd/plugins/editing.umd.js +1 -1
  99. package/umd/plugins/editing.umd.js.map +1 -1
  100. package/umd/plugins/filtering.umd.js +1 -1
  101. package/umd/plugins/filtering.umd.js.map +1 -1
  102. package/umd/plugins/grouping-columns.umd.js +1 -1
  103. package/umd/plugins/grouping-columns.umd.js.map +1 -1
  104. package/umd/plugins/grouping-rows.umd.js +1 -1
  105. package/umd/plugins/grouping-rows.umd.js.map +1 -1
  106. package/umd/plugins/master-detail.umd.js +1 -1
  107. package/umd/plugins/master-detail.umd.js.map +1 -1
  108. package/umd/plugins/multi-sort.umd.js +1 -1
  109. package/umd/plugins/multi-sort.umd.js.map +1 -1
  110. package/umd/plugins/pinned-columns.umd.js +1 -1
  111. package/umd/plugins/pinned-columns.umd.js.map +1 -1
  112. package/umd/plugins/pinned-rows.umd.js +1 -1
  113. package/umd/plugins/pinned-rows.umd.js.map +1 -1
  114. package/umd/plugins/pivot.umd.js +1 -1
  115. package/umd/plugins/pivot.umd.js.map +1 -1
  116. package/umd/plugins/reorder.umd.js +1 -1
  117. package/umd/plugins/reorder.umd.js.map +1 -1
  118. package/umd/plugins/selection.umd.js +1 -1
  119. package/umd/plugins/selection.umd.js.map +1 -1
  120. package/umd/plugins/tree.umd.js +1 -1
  121. package/umd/plugins/tree.umd.js.map +1 -1
  122. package/umd/plugins/visibility.umd.js +1 -1
  123. package/umd/plugins/visibility.umd.js.map +1 -1
@@ -121,8 +121,8 @@ class P {
121
121
  * @returns `true` if the event was cancelled (preventDefault called), `false` otherwise
122
122
  */
123
123
  emitCancelable(e, t) {
124
- const i = new CustomEvent(e, { detail: t, bubbles: !0, cancelable: !0 });
125
- return this.grid?.dispatchEvent?.(i), i.defaultPrevented;
124
+ const o = new CustomEvent(e, { detail: t, bubbles: !0, cancelable: !0 });
125
+ return this.grid?.dispatchEvent?.(o), o.defaultPrevented;
126
126
  }
127
127
  /**
128
128
  * Request a re-render of the grid.
@@ -185,10 +185,21 @@ class P {
185
185
  return this.grid;
186
186
  }
187
187
  /**
188
- * Get the shadow root of the grid.
188
+ * Get the render root of the grid for DOM queries.
189
+ * @deprecated Use `gridElement` instead. This getter exists only for backward compatibility.
190
+ *
191
+ * With Shadow DOM removed, the grid element itself is the render root.
192
+ * All new code should use `this.gridElement` for DOM queries.
193
+ *
194
+ * @example
195
+ * // OLD (deprecated)
196
+ * const rows = this.shadowRoot?.querySelector('.rows');
197
+ *
198
+ * // NEW (preferred)
199
+ * const rows = this.gridElement.querySelector('.rows');
189
200
  */
190
201
  get shadowRoot() {
191
- return this.grid?.shadowRoot ?? null;
202
+ return this.gridElement;
192
203
  }
193
204
  /**
194
205
  * Get the disconnect signal for event listener cleanup.
@@ -239,7 +250,7 @@ class P {
239
250
  const e = this.grid?.effectiveConfig?.animation?.mode ?? "reduced-motion";
240
251
  if (e === !1 || e === "off") return !1;
241
252
  if (e === !0 || e === "on") return !0;
242
- const t = this.shadowRoot?.host;
253
+ const t = this.gridElement;
243
254
  return t ? getComputedStyle(t).getPropertyValue("--tbw-animation-enabled").trim() !== "0" : !0;
244
255
  }
245
256
  /**
@@ -255,10 +266,10 @@ class P {
255
266
  * ```
256
267
  */
257
268
  get animationDuration() {
258
- const e = this.shadowRoot?.host;
269
+ const e = this.gridElement;
259
270
  if (e) {
260
- const t = getComputedStyle(e).getPropertyValue("--tbw-animation-duration").trim(), i = parseInt(t, 10);
261
- if (!isNaN(i)) return i;
271
+ const t = getComputedStyle(e).getPropertyValue("--tbw-animation-duration").trim(), o = parseInt(t, 10);
272
+ if (!isNaN(o)) return o;
262
273
  }
263
274
  return 200;
264
275
  }
@@ -293,48 +304,48 @@ class P {
293
304
  // #endregion
294
305
  }
295
306
  const m = {
296
- sum: (o, e) => o.reduce((t, i) => t + (Number(i[e]) || 0), 0),
297
- avg: (o, e) => {
298
- const t = o.reduce((i, n) => i + (Number(n[e]) || 0), 0);
299
- return o.length ? t / o.length : 0;
307
+ sum: (i, e) => i.reduce((t, o) => t + (Number(o[e]) || 0), 0),
308
+ avg: (i, e) => {
309
+ const t = i.reduce((o, r) => o + (Number(r[e]) || 0), 0);
310
+ return i.length ? t / i.length : 0;
300
311
  },
301
- count: (o) => o.length,
302
- min: (o, e) => Math.min(...o.map((t) => Number(t[e]) || 1 / 0)),
303
- max: (o, e) => Math.max(...o.map((t) => Number(t[e]) || -1 / 0)),
304
- first: (o, e) => o[0]?.[e],
305
- last: (o, e) => o[o.length - 1]?.[e]
306
- }, f = /* @__PURE__ */ new Map(), h = {
312
+ count: (i) => i.length,
313
+ min: (i, e) => Math.min(...i.map((t) => Number(t[e]) || 1 / 0)),
314
+ max: (i, e) => Math.max(...i.map((t) => Number(t[e]) || -1 / 0)),
315
+ first: (i, e) => i[0]?.[e],
316
+ last: (i, e) => i[i.length - 1]?.[e]
317
+ }, f = /* @__PURE__ */ new Map(), g = {
307
318
  /**
308
319
  * Register a custom aggregator function.
309
320
  */
310
- register(o, e) {
311
- f.set(o, e);
321
+ register(i, e) {
322
+ f.set(i, e);
312
323
  },
313
324
  /**
314
325
  * Unregister a custom aggregator function.
315
326
  */
316
- unregister(o) {
317
- f.delete(o);
327
+ unregister(i) {
328
+ f.delete(i);
318
329
  },
319
330
  /**
320
331
  * Get an aggregator function by reference.
321
332
  */
322
- get(o) {
323
- if (o !== void 0)
324
- return typeof o == "function" ? o : f.get(o) ?? m[o];
333
+ get(i) {
334
+ if (i !== void 0)
335
+ return typeof i == "function" ? i : f.get(i) ?? m[i];
325
336
  },
326
337
  /**
327
338
  * Run an aggregator on a set of rows.
328
339
  */
329
- run(o, e, t, i) {
330
- const n = this.get(o);
331
- return n ? n(e, t, i) : void 0;
340
+ run(i, e, t, o) {
341
+ const r = this.get(i);
342
+ return r ? r(e, t, o) : void 0;
332
343
  },
333
344
  /**
334
345
  * Check if an aggregator exists.
335
346
  */
336
- has(o) {
337
- return f.has(o) || o in m;
347
+ has(i) {
348
+ return f.has(i) || i in m;
338
349
  },
339
350
  /**
340
351
  * List all available aggregator names.
@@ -343,303 +354,303 @@ const m = {
343
354
  return [...Object.keys(m), ...f.keys()];
344
355
  }
345
356
  }, A = {
346
- sum: (o) => o.reduce((e, t) => e + t, 0),
347
- avg: (o) => o.length ? o.reduce((e, t) => e + t, 0) / o.length : 0,
348
- count: (o) => o.length,
349
- min: (o) => o.length ? Math.min(...o) : 0,
350
- max: (o) => o.length ? Math.max(...o) : 0,
351
- first: (o) => o[0] ?? 0,
352
- last: (o) => o[o.length - 1] ?? 0
357
+ sum: (i) => i.reduce((e, t) => e + t, 0),
358
+ avg: (i) => i.length ? i.reduce((e, t) => e + t, 0) / i.length : 0,
359
+ count: (i) => i.length,
360
+ min: (i) => i.length ? Math.min(...i) : 0,
361
+ max: (i) => i.length ? Math.max(...i) : 0,
362
+ first: (i) => i[0] ?? 0,
363
+ last: (i) => i[i.length - 1] ?? 0
353
364
  };
354
- function k(o) {
355
- return A[o] ?? A.sum;
365
+ function k(i) {
366
+ return A[i] ?? A.sum;
356
367
  }
357
- h.register.bind(h);
358
- h.unregister.bind(h);
359
- h.get.bind(h);
360
- h.run.bind(h);
361
- h.list.bind(h);
368
+ g.register.bind(g);
369
+ g.unregister.bind(g);
370
+ g.get.bind(g);
371
+ g.run.bind(g);
372
+ g.list.bind(g);
362
373
  const N = k;
363
- function S(o) {
374
+ function S(i) {
364
375
  const e = [];
365
- return !o.rowGroupFields?.length && !o.columnGroupFields?.length && e.push("At least one row or column group field is required"), o.valueFields?.length || e.push("At least one value field is required"), e;
376
+ return !i.rowGroupFields?.length && !i.columnGroupFields?.length && e.push("At least one row or column group field is required"), i.valueFields?.length || e.push("At least one value field is required"), e;
366
377
  }
367
- function x(o, e) {
368
- return [...o, e].join("|");
378
+ function C(i, e) {
379
+ return [...i, e].join("|");
369
380
  }
370
- function K(o, e) {
371
- const t = e.rowGroupFields ?? [], i = e.columnGroupFields ?? [], n = e.valueFields ?? [], r = I(o, i), a = G(
372
- o,
373
- t,
381
+ function K(i, e) {
382
+ const t = e.rowGroupFields ?? [], o = e.columnGroupFields ?? [], r = e.valueFields ?? [], n = I(i, o), a = E(
374
383
  i,
375
- r,
384
+ t,
385
+ o,
376
386
  n,
387
+ r,
377
388
  0,
378
389
  // starting depth
379
390
  ""
380
391
  // parent key prefix
381
- ), s = D(a, r, n), l = Object.values(s).reduce((d, c) => d + c, 0);
392
+ ), s = z(a, n, r), l = Object.values(s).reduce((d, c) => d + c, 0);
382
393
  return {
383
394
  rows: a,
384
- columnKeys: r,
395
+ columnKeys: n,
385
396
  totals: s,
386
397
  grandTotal: l
387
398
  };
388
399
  }
389
- function I(o, e) {
400
+ function I(i, e) {
390
401
  if (e.length === 0) return ["value"];
391
402
  const t = /* @__PURE__ */ new Set();
392
- for (const i of o) {
393
- const n = e.map((r) => String(i[r] ?? "")).join("|");
394
- t.add(n);
403
+ for (const o of i) {
404
+ const r = e.map((n) => String(o[n] ?? "")).join("|");
405
+ t.add(r);
395
406
  }
396
407
  return [...t].sort();
397
408
  }
398
- function V(o, e) {
409
+ function V(i, e) {
399
410
  const t = /* @__PURE__ */ new Map();
400
- for (const i of o) {
401
- const n = String(i[e] ?? ""), r = t.get(n);
402
- r ? r.push(i) : t.set(n, [i]);
411
+ for (const o of i) {
412
+ const r = String(o[e] ?? ""), n = t.get(r);
413
+ n ? n.push(o) : t.set(r, [o]);
403
414
  }
404
415
  return t;
405
416
  }
406
- function G(o, e, t, i, n, r, a) {
417
+ function E(i, e, t, o, r, n, a) {
407
418
  const s = [];
408
419
  if (e.length === 0) {
409
- const u = R(o, t, i, n), g = _(u);
420
+ const u = _(i, t, o, r), h = R(u);
410
421
  return s.push({
411
422
  rowKey: a || "all",
412
423
  rowLabel: a || "All",
413
- depth: r,
424
+ depth: n,
414
425
  values: u,
415
- total: g,
426
+ total: h,
416
427
  isGroup: !1,
417
- rowCount: o.length
428
+ rowCount: i.length
418
429
  }), s;
419
430
  }
420
- const l = e[0], d = e.slice(1), c = d.length > 0, p = V(o, l);
421
- for (const [u, g] of p) {
422
- const C = a ? `${a}|${u}` : u, y = R(g, t, i, n), E = _(y);
431
+ const l = e[0], d = e.slice(1), c = d.length > 0, p = V(i, l);
432
+ for (const [u, h] of p) {
433
+ const y = a ? `${a}|${u}` : u, x = _(h, t, o, r), G = R(x);
423
434
  let F;
424
- c && (F = G(
425
- g,
435
+ c && (F = E(
436
+ h,
426
437
  d,
427
438
  t,
428
- i,
429
- n,
430
- r + 1,
431
- C
439
+ o,
440
+ r,
441
+ n + 1,
442
+ y
432
443
  )), s.push({
433
- rowKey: C,
444
+ rowKey: y,
434
445
  rowLabel: u || "(blank)",
435
- depth: r,
436
- values: y,
437
- total: E,
446
+ depth: n,
447
+ values: x,
448
+ total: G,
438
449
  isGroup: c,
439
450
  children: F,
440
- rowCount: g.length
451
+ rowCount: h.length
441
452
  });
442
453
  }
443
454
  return s;
444
455
  }
445
- function R(o, e, t, i) {
446
- const n = {};
447
- for (const r of t)
448
- for (const a of i) {
449
- const l = (e.length > 0 ? o.filter((u) => e.map((g) => String(u[g] ?? "")).join("|") === r) : o).map((u) => Number(u[a.field]) || 0), d = N(a.aggFunc), c = l.length > 0 ? d(l) : null, p = x([r], a.field);
450
- n[p] = c;
456
+ function _(i, e, t, o) {
457
+ const r = {};
458
+ for (const n of t)
459
+ for (const a of o) {
460
+ const l = (e.length > 0 ? i.filter((u) => e.map((h) => String(u[h] ?? "")).join("|") === n) : i).map((u) => Number(u[a.field]) || 0), d = N(a.aggFunc), c = l.length > 0 ? d(l) : null, p = C([n], a.field);
461
+ r[p] = c;
451
462
  }
452
- return n;
463
+ return r;
453
464
  }
454
- function _(o) {
465
+ function R(i) {
455
466
  let e = 0;
456
- for (const t of Object.values(o))
467
+ for (const t of Object.values(i))
457
468
  e += t ?? 0;
458
469
  return e;
459
470
  }
460
- function D(o, e, t) {
461
- const i = {};
462
- function n(r) {
463
- for (const a of r)
471
+ function z(i, e, t) {
472
+ const o = {};
473
+ function r(n) {
474
+ for (const a of n)
464
475
  if (!a.isGroup || !a.children?.length)
465
476
  for (const s of e)
466
477
  for (const l of t) {
467
- const d = x([s], l.field);
468
- i[d] = (i[d] ?? 0) + (a.values[d] ?? 0);
478
+ const d = C([s], l.field);
479
+ o[d] = (o[d] ?? 0) + (a.values[d] ?? 0);
469
480
  }
470
- else a.children && n(a.children);
481
+ else a.children && r(a.children);
471
482
  }
472
- return n(o), i;
483
+ return r(i), o;
473
484
  }
474
- function q(o, e, t = !0) {
475
- const i = [];
476
- function n(r) {
477
- i.push(r);
478
- const a = e ? e.has(r.rowKey) : t;
479
- if (r.children && a)
480
- for (const s of r.children)
481
- n(s);
482
- }
483
- for (const r of o)
484
- n(r);
485
- return i;
485
+ function D(i, e, t = !0) {
486
+ const o = [];
487
+ function r(n) {
488
+ o.push(n);
489
+ const a = e ? e.has(n.rowKey) : t;
490
+ if (n.children && a)
491
+ for (const s of n.children)
492
+ r(s);
493
+ }
494
+ for (const n of i)
495
+ r(n);
496
+ return o;
486
497
  }
487
- function H(o) {
498
+ function q(i) {
488
499
  const e = [];
489
- function t(i) {
490
- if (i.isGroup && e.push(i.rowKey), i.children)
491
- for (const n of i.children)
492
- t(n);
500
+ function t(o) {
501
+ if (o.isGroup && e.push(o.rowKey), o.children)
502
+ for (const r of o.children)
503
+ t(r);
493
504
  }
494
- for (const i of o)
495
- t(i);
505
+ for (const o of i)
506
+ t(o);
496
507
  return e;
497
508
  }
498
- const M = ["sum", "avg", "count", "min", "max", "first", "last"];
499
- function z(o, e, t, i) {
500
- const n = new AbortController(), r = { config: e, callbacks: i, signal: n.signal }, a = document.createElement("div");
501
- return a.className = "tbw-pivot-panel", a.appendChild(b("Options", () => W(t, r))), a.appendChild(b("Row Groups", () => T("rowGroups", r))), a.appendChild(b("Column Groups", () => T("columnGroups", r))), a.appendChild(b("Values", () => Z(r))), a.appendChild(b("Available Fields", () => j(r))), o.appendChild(a), () => {
502
- n.abort(), a.remove();
509
+ const H = ["sum", "avg", "count", "min", "max", "first", "last"];
510
+ function M(i, e, t, o) {
511
+ const r = new AbortController(), n = { config: e, callbacks: o, signal: r.signal }, a = document.createElement("div");
512
+ return a.className = "tbw-pivot-panel", a.appendChild(b("Options", () => W(t, n))), a.appendChild(b("Row Groups", () => T("rowGroups", n))), a.appendChild(b("Column Groups", () => T("columnGroups", n))), a.appendChild(b("Values", () => Z(n))), a.appendChild(b("Available Fields", () => j(n))), i.appendChild(a), () => {
513
+ r.abort(), a.remove();
503
514
  };
504
515
  }
505
- function b(o, e) {
516
+ function b(i, e) {
506
517
  const t = document.createElement("div");
507
518
  t.className = "tbw-pivot-section";
508
- const i = document.createElement("div");
509
- i.className = "tbw-pivot-section-header", i.textContent = o;
510
- const n = document.createElement("div");
511
- return n.className = "tbw-pivot-section-content", n.appendChild(e()), t.appendChild(i), t.appendChild(n), t;
519
+ const o = document.createElement("div");
520
+ o.className = "tbw-pivot-section-header", o.textContent = i;
521
+ const r = document.createElement("div");
522
+ return r.className = "tbw-pivot-section-content", r.appendChild(e()), t.appendChild(o), t.appendChild(r), t;
512
523
  }
513
- function T(o, e) {
514
- const { config: t, callbacks: i, signal: n } = e, r = document.createElement("div");
515
- r.className = "tbw-pivot-drop-zone", r.setAttribute("data-zone", o);
516
- const a = o === "rowGroups" ? t.rowGroupFields ?? [] : t.columnGroupFields ?? [];
524
+ function T(i, e) {
525
+ const { config: t, callbacks: o, signal: r } = e, n = document.createElement("div");
526
+ n.className = "tbw-pivot-drop-zone", n.setAttribute("data-zone", i);
527
+ const a = i === "rowGroups" ? t.rowGroupFields ?? [] : t.columnGroupFields ?? [];
517
528
  if (a.length === 0) {
518
529
  const s = document.createElement("div");
519
- s.className = "tbw-pivot-placeholder", s.textContent = "Drag fields here or click to add", r.appendChild(s);
530
+ s.className = "tbw-pivot-placeholder", s.textContent = "Drag fields here or click to add", n.appendChild(s);
520
531
  } else
521
532
  for (const s of a)
522
- r.appendChild(O(s, o, e));
523
- return r.addEventListener(
533
+ n.appendChild(O(s, i, e));
534
+ return n.addEventListener(
524
535
  "dragover",
525
536
  (s) => {
526
- s.preventDefault(), r.classList.add("drag-over");
537
+ s.preventDefault(), n.classList.add("drag-over");
527
538
  },
528
- { signal: n }
529
- ), r.addEventListener(
539
+ { signal: r }
540
+ ), n.addEventListener(
530
541
  "dragleave",
531
542
  () => {
532
- r.classList.remove("drag-over");
543
+ n.classList.remove("drag-over");
533
544
  },
534
- { signal: n }
535
- ), r.addEventListener(
545
+ { signal: r }
546
+ ), n.addEventListener(
536
547
  "drop",
537
548
  (s) => {
538
- s.preventDefault(), r.classList.remove("drag-over");
549
+ s.preventDefault(), n.classList.remove("drag-over");
539
550
  const l = s.dataTransfer?.getData("text/plain");
540
- l && i.onAddFieldToZone(l, o);
551
+ l && o.onAddFieldToZone(l, i);
541
552
  },
542
- { signal: n }
543
- ), r;
553
+ { signal: r }
554
+ ), n;
544
555
  }
545
- function O(o, e, t) {
546
- const { callbacks: i, signal: n } = t, r = document.createElement("div");
547
- r.className = "tbw-pivot-field-chip", r.draggable = !0;
548
- const a = i.getAvailableFields().find((d) => d.field === o), s = document.createElement("span");
549
- s.className = "tbw-pivot-chip-label", s.textContent = a?.header ?? o;
556
+ function O(i, e, t) {
557
+ const { callbacks: o, signal: r } = t, n = document.createElement("div");
558
+ n.className = "tbw-pivot-field-chip", n.draggable = !0;
559
+ const a = o.getAvailableFields().find((d) => d.field === i), s = document.createElement("span");
560
+ s.className = "tbw-pivot-chip-label", s.textContent = a?.header ?? i;
550
561
  const l = document.createElement("button");
551
562
  return l.className = "tbw-pivot-chip-remove", l.innerHTML = "×", l.title = "Remove field", l.addEventListener(
552
563
  "click",
553
564
  (d) => {
554
- d.stopPropagation(), i.onRemoveFieldFromZone(o, e);
565
+ d.stopPropagation(), o.onRemoveFieldFromZone(i, e);
555
566
  },
556
- { signal: n }
557
- ), r.appendChild(s), r.appendChild(l), r.addEventListener(
567
+ { signal: r }
568
+ ), n.appendChild(s), n.appendChild(l), n.addEventListener(
558
569
  "dragstart",
559
570
  (d) => {
560
- d.dataTransfer?.setData("text/plain", o), d.dataTransfer?.setData("source-zone", e), r.classList.add("dragging");
571
+ d.dataTransfer?.setData("text/plain", i), d.dataTransfer?.setData("source-zone", e), n.classList.add("dragging");
561
572
  },
562
- { signal: n }
563
- ), r.addEventListener(
573
+ { signal: r }
574
+ ), n.addEventListener(
564
575
  "dragend",
565
576
  () => {
566
- r.classList.remove("dragging");
577
+ n.classList.remove("dragging");
567
578
  },
568
- { signal: n }
569
- ), r;
579
+ { signal: r }
580
+ ), n;
570
581
  }
571
- function Z(o) {
572
- const { config: e, callbacks: t, signal: i } = o, n = document.createElement("div");
573
- n.className = "tbw-pivot-drop-zone tbw-pivot-values-zone", n.setAttribute("data-zone", "values");
574
- const r = e.valueFields ?? [];
575
- if (r.length === 0) {
582
+ function Z(i) {
583
+ const { config: e, callbacks: t, signal: o } = i, r = document.createElement("div");
584
+ r.className = "tbw-pivot-drop-zone tbw-pivot-values-zone", r.setAttribute("data-zone", "values");
585
+ const n = e.valueFields ?? [];
586
+ if (n.length === 0) {
576
587
  const a = document.createElement("div");
577
- a.className = "tbw-pivot-placeholder", a.textContent = "Drag numeric fields here for aggregation", n.appendChild(a);
588
+ a.className = "tbw-pivot-placeholder", a.textContent = "Drag numeric fields here for aggregation", r.appendChild(a);
578
589
  } else
579
- for (const a of r)
580
- n.appendChild($(a, o));
581
- return n.addEventListener(
590
+ for (const a of n)
591
+ r.appendChild($(a, i));
592
+ return r.addEventListener(
582
593
  "dragover",
583
594
  (a) => {
584
- a.preventDefault(), n.classList.add("drag-over");
595
+ a.preventDefault(), r.classList.add("drag-over");
585
596
  },
586
- { signal: i }
587
- ), n.addEventListener(
597
+ { signal: o }
598
+ ), r.addEventListener(
588
599
  "dragleave",
589
600
  () => {
590
- n.classList.remove("drag-over");
601
+ r.classList.remove("drag-over");
591
602
  },
592
- { signal: i }
593
- ), n.addEventListener(
603
+ { signal: o }
604
+ ), r.addEventListener(
594
605
  "drop",
595
606
  (a) => {
596
- a.preventDefault(), n.classList.remove("drag-over");
607
+ a.preventDefault(), r.classList.remove("drag-over");
597
608
  const s = a.dataTransfer?.getData("text/plain");
598
609
  s && t.onAddValueField(s, "sum");
599
610
  },
600
- { signal: i }
601
- ), n;
611
+ { signal: o }
612
+ ), r;
602
613
  }
603
- function $(o, e) {
604
- const { callbacks: t, signal: i } = e, n = document.createElement("div");
605
- n.className = "tbw-pivot-field-chip tbw-pivot-value-chip";
606
- const r = t.getAvailableFields().find((c) => c.field === o.field), a = document.createElement("div");
614
+ function $(i, e) {
615
+ const { callbacks: t, signal: o } = e, r = document.createElement("div");
616
+ r.className = "tbw-pivot-field-chip tbw-pivot-value-chip";
617
+ const n = t.getAvailableFields().find((c) => c.field === i.field), a = document.createElement("div");
607
618
  a.className = "tbw-pivot-value-label-wrapper";
608
619
  const s = document.createElement("span");
609
- s.className = "tbw-pivot-chip-label", s.textContent = r?.header ?? o.field;
620
+ s.className = "tbw-pivot-chip-label", s.textContent = n?.header ?? i.field;
610
621
  const l = document.createElement("select");
611
622
  l.className = "tbw-pivot-agg-select", l.title = "Aggregation function";
612
- for (const c of M) {
623
+ for (const c of H) {
613
624
  const p = document.createElement("option");
614
- p.value = c, p.textContent = c.toUpperCase(), p.selected = c === o.aggFunc, l.appendChild(p);
625
+ p.value = c, p.textContent = c.toUpperCase(), p.selected = c === i.aggFunc, l.appendChild(p);
615
626
  }
616
627
  l.addEventListener(
617
628
  "change",
618
629
  () => {
619
- t.onUpdateValueAggFunc(o.field, l.value);
630
+ t.onUpdateValueAggFunc(i.field, l.value);
620
631
  },
621
- { signal: i }
632
+ { signal: o }
622
633
  );
623
634
  const d = document.createElement("button");
624
635
  return d.className = "tbw-pivot-chip-remove", d.innerHTML = "×", d.title = "Remove value field", d.addEventListener(
625
636
  "click",
626
637
  (c) => {
627
- c.stopPropagation(), t.onRemoveValueField(o.field);
638
+ c.stopPropagation(), t.onRemoveValueField(i.field);
628
639
  },
629
- { signal: i }
630
- ), a.appendChild(s), a.appendChild(l), n.appendChild(a), n.appendChild(d), n;
640
+ { signal: o }
641
+ ), a.appendChild(s), a.appendChild(l), r.appendChild(a), r.appendChild(d), r;
631
642
  }
632
- function j(o) {
633
- const { config: e, callbacks: t, signal: i } = o, n = document.createElement("div");
634
- n.className = "tbw-pivot-available-fields";
635
- const r = t.getAvailableFields(), a = /* @__PURE__ */ new Set([
643
+ function j(i) {
644
+ const { config: e, callbacks: t, signal: o } = i, r = document.createElement("div");
645
+ r.className = "tbw-pivot-available-fields";
646
+ const n = t.getAvailableFields(), a = /* @__PURE__ */ new Set([
636
647
  ...e.rowGroupFields ?? [],
637
648
  ...e.columnGroupFields ?? [],
638
649
  ...e.valueFields?.map((l) => l.field) ?? []
639
- ]), s = r.filter((l) => !a.has(l.field));
650
+ ]), s = n.filter((l) => !a.has(l.field));
640
651
  if (s.length === 0) {
641
652
  const l = document.createElement("div");
642
- l.className = "tbw-pivot-placeholder", l.textContent = "All fields are in use", n.appendChild(l);
653
+ l.className = "tbw-pivot-placeholder", l.textContent = "All fields are in use", r.appendChild(l);
643
654
  } else
644
655
  for (const l of s) {
645
656
  const d = document.createElement("div");
@@ -648,106 +659,106 @@ function j(o) {
648
659
  (c) => {
649
660
  c.dataTransfer?.setData("text/plain", l.field), d.classList.add("dragging");
650
661
  },
651
- { signal: i }
662
+ { signal: o }
652
663
  ), d.addEventListener(
653
664
  "dragend",
654
665
  () => {
655
666
  d.classList.remove("dragging");
656
667
  },
657
- { signal: i }
658
- ), n.appendChild(d);
668
+ { signal: o }
669
+ ), r.appendChild(d);
659
670
  }
660
- return n;
671
+ return r;
661
672
  }
662
- function W(o, e) {
663
- const { config: t, callbacks: i, signal: n } = e, r = document.createElement("div");
664
- return r.className = "tbw-pivot-options", r.appendChild(
673
+ function W(i, e) {
674
+ const { config: t, callbacks: o, signal: r } = e, n = document.createElement("div");
675
+ return n.className = "tbw-pivot-options", n.appendChild(
665
676
  w(
666
677
  "Enable Pivot View",
667
- o,
678
+ i,
668
679
  (a) => {
669
- i.onTogglePivot(a);
680
+ o.onTogglePivot(a);
670
681
  },
671
- n
682
+ r
672
683
  )
673
- ), r.appendChild(
684
+ ), n.appendChild(
674
685
  w(
675
686
  "Show Row Totals",
676
687
  t.showTotals ?? !0,
677
688
  (a) => {
678
- i.onOptionChange("showTotals", a);
689
+ o.onOptionChange("showTotals", a);
679
690
  },
680
- n
691
+ r
681
692
  )
682
- ), r.appendChild(
693
+ ), n.appendChild(
683
694
  w(
684
695
  "Show Grand Total",
685
696
  t.showGrandTotal ?? !0,
686
697
  (a) => {
687
- i.onOptionChange("showGrandTotal", a);
698
+ o.onOptionChange("showGrandTotal", a);
688
699
  },
689
- n
700
+ r
690
701
  )
691
- ), r;
702
+ ), n;
692
703
  }
693
- function w(o, e, t, i) {
694
- const n = document.createElement("label");
695
- n.className = "tbw-pivot-checkbox";
696
- const r = document.createElement("input");
697
- r.type = "checkbox", r.checked = e, r.addEventListener("change", () => t(r.checked), { signal: i });
704
+ function w(i, e, t, o) {
705
+ const r = document.createElement("label");
706
+ r.className = "tbw-pivot-checkbox";
707
+ const n = document.createElement("input");
708
+ n.type = "checkbox", n.checked = e, n.addEventListener("change", () => t(n.checked), { signal: o });
698
709
  const a = document.createElement("span");
699
- return a.textContent = o, n.appendChild(r), n.appendChild(a), n;
710
+ return a.textContent = i, r.appendChild(n), r.appendChild(a), r;
700
711
  }
701
- function U(o, e, t) {
702
- return e.className = "data-grid-row pivot-group-row", e.setAttribute("data-pivot-depth", String(o.__pivotDepth ?? 0)), e.setAttribute("data-pivot-key", String(o.__pivotRowKey ?? "")), e.setAttribute("role", "row"), e.innerHTML = "", t.columns.forEach((i, n) => {
703
- const r = document.createElement("div");
704
- if (r.className = "cell", r.setAttribute("data-col", String(n)), r.setAttribute("data-row", String(t.rowIndex)), r.setAttribute("role", "gridcell"), n === 0) {
705
- const a = Number(o.__pivotIndent) || 0;
706
- r.style.paddingLeft = `${a}px`;
707
- const s = String(o.__pivotRowKey), l = document.createElement("button");
708
- l.type = "button", l.className = "pivot-toggle", l.setAttribute("aria-label", o.__pivotExpanded ? "Collapse group" : "Expand group"), t.setIcon(l, t.resolveIcon(o.__pivotExpanded ? "collapse" : "expand")), l.addEventListener("click", (p) => {
712
+ function U(i, e, t) {
713
+ return e.className = "data-grid-row pivot-group-row", e.setAttribute("data-pivot-depth", String(i.__pivotDepth ?? 0)), e.setAttribute("data-pivot-key", String(i.__pivotRowKey ?? "")), e.setAttribute("role", "row"), e.innerHTML = "", t.columns.forEach((o, r) => {
714
+ const n = document.createElement("div");
715
+ if (n.className = "cell", n.setAttribute("data-col", String(r)), n.setAttribute("data-row", String(t.rowIndex)), n.setAttribute("role", "gridcell"), r === 0) {
716
+ const a = Number(i.__pivotIndent) || 0;
717
+ n.style.paddingLeft = `${a}px`;
718
+ const s = String(i.__pivotRowKey), l = document.createElement("button");
719
+ l.type = "button", l.className = "pivot-toggle", l.setAttribute("aria-label", i.__pivotExpanded ? "Collapse group" : "Expand group"), t.setIcon(l, t.resolveIcon(i.__pivotExpanded ? "collapse" : "expand")), l.addEventListener("click", (p) => {
709
720
  p.stopPropagation(), t.onToggle(s);
710
- }), r.appendChild(l);
721
+ }), n.appendChild(l);
711
722
  const d = document.createElement("span");
712
- d.className = "pivot-label", d.textContent = String(o.__pivotLabel ?? ""), r.appendChild(d);
723
+ d.className = "pivot-label", d.textContent = String(i.__pivotLabel ?? ""), n.appendChild(d);
713
724
  const c = document.createElement("span");
714
- c.className = "pivot-count", c.textContent = ` (${Number(o.__pivotRowCount) || 0})`, r.appendChild(c);
725
+ c.className = "pivot-count", c.textContent = ` (${Number(i.__pivotRowCount) || 0})`, n.appendChild(c);
715
726
  } else {
716
- const a = o[i.field];
717
- r.textContent = a != null ? String(a) : "";
727
+ const a = i[o.field];
728
+ n.textContent = a != null ? String(a) : "";
718
729
  }
719
- e.appendChild(r);
730
+ e.appendChild(n);
720
731
  }), !0;
721
732
  }
722
- function B(o, e, t, i) {
723
- return e.className = "data-grid-row pivot-leaf-row", e.setAttribute("data-pivot-depth", String(o.__pivotDepth ?? 0)), e.setAttribute("data-pivot-key", String(o.__pivotRowKey ?? "")), e.innerHTML = "", t.forEach((n, r) => {
733
+ function B(i, e, t, o) {
734
+ return e.className = "data-grid-row pivot-leaf-row", e.setAttribute("data-pivot-depth", String(i.__pivotDepth ?? 0)), e.setAttribute("data-pivot-key", String(i.__pivotRowKey ?? "")), e.innerHTML = "", t.forEach((r, n) => {
724
735
  const a = document.createElement("div");
725
- if (a.className = "cell", a.setAttribute("data-col", String(r)), a.setAttribute("data-row", String(i)), a.setAttribute("role", "gridcell"), r === 0) {
726
- const s = Number(o.__pivotIndent) || 0;
736
+ if (a.className = "cell", a.setAttribute("data-col", String(n)), a.setAttribute("data-row", String(o)), a.setAttribute("role", "gridcell"), n === 0) {
737
+ const s = Number(i.__pivotIndent) || 0;
727
738
  a.style.paddingLeft = `${s + 20}px`;
728
739
  const l = document.createElement("span");
729
- l.className = "pivot-label", l.textContent = String(o.__pivotLabel ?? ""), a.appendChild(l);
740
+ l.className = "pivot-label", l.textContent = String(i.__pivotLabel ?? ""), a.appendChild(l);
730
741
  } else {
731
- const s = o[n.field];
742
+ const s = i[r.field];
732
743
  a.textContent = s != null ? String(s) : "";
733
744
  }
734
745
  e.appendChild(a);
735
746
  }), !0;
736
747
  }
737
- function J(o, e, t) {
738
- return e.className = "pivot-grand-total-row", e.setAttribute("role", "presentation"), e.innerHTML = "", t.forEach((i, n) => {
739
- const r = document.createElement("div");
740
- if (r.className = "cell", r.setAttribute("data-col", String(n)), n === 0) {
748
+ function J(i, e, t) {
749
+ return e.className = "pivot-grand-total-row", e.setAttribute("role", "presentation"), e.innerHTML = "", t.forEach((o, r) => {
750
+ const n = document.createElement("div");
751
+ if (n.className = "cell", n.setAttribute("data-col", String(r)), r === 0) {
741
752
  const a = document.createElement("span");
742
- a.className = "pivot-label", a.textContent = "Grand Total", r.appendChild(a);
753
+ a.className = "pivot-label", a.textContent = "Grand Total", n.appendChild(a);
743
754
  } else {
744
- const a = o[i.field];
745
- r.textContent = a != null ? String(a) : "";
755
+ const a = i[o.field];
756
+ n.textContent = a != null ? String(a) : "";
746
757
  }
747
- e.appendChild(r);
758
+ e.appendChild(n);
748
759
  }), !0;
749
760
  }
750
- const Q = '.pivot-group-row{display:grid;grid-template-columns:var(--tbw-column-template);font-weight:600;background:var(--tbw-pivot-group-bg, var(--tbw-color-row-alt));min-height:var(--tbw-row-height);border-bottom:var(--tbw-row-divider)}.pivot-group-row:hover{background:var(--tbw-pivot-group-hover, var(--tbw-color-row-hover))}.pivot-leaf-row{display:grid;grid-template-columns:var(--tbw-column-template);background:var(--tbw-pivot-leaf-bg, var(--tbw-color-bg));min-height:var(--tbw-row-height);border-bottom:var(--tbw-row-divider)}.pivot-grand-total-row{display:grid;grid-template-columns:var(--tbw-column-template);font-weight:700;background:var(--tbw-pivot-grand-total-bg, var(--tbw-color-header-bg));min-height:var(--tbw-row-height);border-top:2px solid var(--tbw-color-border-strong)}.pivot-grand-total-row>.cell{display:flex;align-items:center;padding:var(--tbw-cell-padding);border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0}.pivot-grand-total-row>.cell:last-child{border-right:0}.pivot-grand-total-footer{position:sticky;bottom:0;z-index:var(--tbw-z-layer-pinned-rows, 20);background:var(--tbw-pivot-grand-total-bg, var(--tbw-color-header-bg));min-width:fit-content}.pivot-group-row>.cell,.pivot-leaf-row>.cell{display:flex;align-items:center;padding:var(--tbw-cell-padding);border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0}.pivot-group-row>.cell:last-child,.pivot-leaf-row>.cell:last-child{border-right:0}.pivot-toggle{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;margin-right:6px;border:none;background:transparent;cursor:pointer;color:var(--tbw-pivot-toggle-color, var(--tbw-color-fg-muted));border-radius:var(--tbw-border-radius);transition:background .15s,color .15s}.pivot-toggle:hover{background:var(--tbw-pivot-toggle-hover-bg, var(--tbw-color-row-hover));color:var(--tbw-pivot-toggle-hover-color, var(--tbw-color-fg))}.pivot-toggle:focus{outline:var(--tbw-focus-outline);outline-offset:var(--tbw-focus-outline-offset)}.pivot-label{font-weight:inherit}.pivot-count{color:var(--tbw-pivot-count-color, var(--tbw-color-fg-muted));font-size:.9em;font-weight:400}.pivot-total-row{font-weight:700;border-top:2px solid var(--tbw-pivot-border, var(--tbw-color-border-strong))}[data-pivot-depth="1"]{--tbw-pivot-depth: 1}[data-pivot-depth="2"]{--tbw-pivot-depth: 2}[data-pivot-depth="3"]{--tbw-pivot-depth: 3}[data-pivot-depth="4"]{--tbw-pivot-depth: 4}.tbw-pivot-panel{display:flex;flex-direction:column;gap: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}.pivot-group-row.tbw-pivot-slide-in,.pivot-leaf-row.tbw-pivot-slide-in{animation:tbw-pivot-slide-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-pivot-slide-in{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}.pivot-group-row.tbw-pivot-fade-in,.pivot-leaf-row.tbw-pivot-fade-in{animation:tbw-pivot-fade-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-pivot-fade-in{0%{opacity:0}to{opacity:1}}';
761
+ const Q = '@layer tbw-plugins{.pivot-group-row{display:grid;grid-template-columns:var(--tbw-column-template);font-weight:600;background:var(--tbw-pivot-group-bg, var(--tbw-color-row-alt));min-height:var(--tbw-row-height);border-bottom:var(--tbw-row-divider)}.pivot-group-row:hover{background:var(--tbw-pivot-group-hover, var(--tbw-color-row-hover))}.pivot-leaf-row{display:grid;grid-template-columns:var(--tbw-column-template);background:var(--tbw-pivot-leaf-bg, var(--tbw-color-bg));min-height:var(--tbw-row-height);border-bottom:var(--tbw-row-divider)}.pivot-grand-total-row{display:grid;grid-template-columns:var(--tbw-column-template);font-weight:700;background:var(--tbw-pivot-grand-total-bg, var(--tbw-color-header-bg));min-height:var(--tbw-row-height);border-top:2px solid var(--tbw-color-border-strong)}.pivot-grand-total-row>.cell{display:flex;align-items:center;padding:var(--tbw-cell-padding);border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0}.pivot-grand-total-row>.cell:last-child{border-right:0}.pivot-grand-total-footer{position:sticky;bottom:0;z-index:var(--tbw-z-layer-pinned-rows, 20);background:var(--tbw-pivot-grand-total-bg, var(--tbw-color-header-bg));min-width:fit-content}.pivot-group-row>.cell,.pivot-leaf-row>.cell{display:flex;align-items:center;padding:var(--tbw-cell-padding);border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0}.pivot-group-row>.cell:last-child,.pivot-leaf-row>.cell:last-child{border-right:0}.pivot-toggle{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;margin-right:6px;border:none;background:transparent;cursor:pointer;color:var(--tbw-pivot-toggle-color, var(--tbw-color-fg-muted));border-radius:var(--tbw-border-radius);transition:background .15s,color .15s}.pivot-toggle:hover{background:var(--tbw-pivot-toggle-hover-bg, var(--tbw-color-row-hover));color:var(--tbw-pivot-toggle-hover-color, var(--tbw-color-fg))}.pivot-toggle:focus{outline:var(--tbw-focus-outline);outline-offset:var(--tbw-focus-outline-offset)}.pivot-label{font-weight:inherit}.pivot-count{color:var(--tbw-pivot-count-color, var(--tbw-color-fg-muted));font-size:.9em;font-weight:400}.pivot-total-row{font-weight:700;border-top:2px solid var(--tbw-pivot-border, var(--tbw-color-border-strong))}[data-pivot-depth="1"]{--tbw-pivot-depth: 1}[data-pivot-depth="2"]{--tbw-pivot-depth: 2}[data-pivot-depth="3"]{--tbw-pivot-depth: 3}[data-pivot-depth="4"]{--tbw-pivot-depth: 4}.tbw-pivot-panel{display:flex;flex-direction:column;gap:var(--tbw-panel-padding, var(--tbw-spacing-lg, .75rem));padding:var(--tbw-panel-padding, var(--tbw-spacing-lg, .75rem));height:100%;overflow-y:auto;font-size:var(--tbw-font-size-sm, .8125rem)}.tbw-pivot-section{border:1px solid var(--tbw-pivot-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius);background:var(--tbw-pivot-section-bg, var(--tbw-color-bg))}.tbw-pivot-section-header{padding:var(--tbw-button-padding, var(--tbw-spacing-md, .5rem) var(--tbw-spacing-lg, .75rem));font-weight:600;background:var(--tbw-pivot-header-bg, var(--tbw-color-header-bg));border-bottom:1px solid var(--tbw-pivot-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius) var(--tbw-border-radius) 0 0}.tbw-pivot-section-content{padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.tbw-pivot-toggle-wrapper{display:flex;align-items:center}.tbw-pivot-toggle-label{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));cursor:pointer}.tbw-pivot-toggle-label input{width:var(--tbw-icon-size, 1rem);height:var(--tbw-icon-size, 1rem);cursor:pointer}.tbw-pivot-drop-zone{min-height:60px;padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));border:2px dashed var(--tbw-pivot-drop-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius);background:var(--tbw-pivot-drop-bg, var(--tbw-color-row-alt));display:flex;flex-wrap:wrap;gap:var(--tbw-spacing-sm, .375rem);align-content:flex-start;transition:all .15s ease}.tbw-pivot-drop-zone.drag-over{border-color:var(--tbw-color-accent);background:var(--tbw-pivot-drop-active, var(--tbw-focus-background))}.tbw-pivot-placeholder{color:var(--tbw-color-fg-muted);font-style:italic;padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));text-align:center;width:100%}.tbw-pivot-field-chip{display:inline-flex;align-items:center;gap:var(--tbw-spacing-sm, .375rem);padding:var(--tbw-button-padding-sm, var(--tbw-spacing-xs, .25rem) var(--tbw-spacing-md, .5rem));background:var(--tbw-pivot-chip-bg, var(--tbw-color-header-bg));border:1px solid var(--tbw-pivot-chip-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius);cursor:grab;font-size:var(--tbw-font-size-xs, .75rem);transition:all .15s ease}.tbw-pivot-field-chip:hover{background:var(--tbw-pivot-chip-hover, var(--tbw-color-row-hover));border-color:var(--tbw-color-accent)}.tbw-pivot-field-chip.available{background:var(--tbw-color-bg)}.tbw-pivot-field-chip.dragging{opacity:.5;cursor:grabbing}.tbw-pivot-chip-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:120px}.tbw-pivot-chip-remove{display:flex;align-items:center;justify-content:center;width:var(--tbw-icon-size, 1rem);height:var(--tbw-icon-size, 1rem);padding:0;border:none;background:transparent;color:var(--tbw-color-fg-muted);font-size:var(--tbw-font-size-sm, .875rem);font-weight:700;cursor:pointer;border-radius:50%;transition:all .15s ease}.tbw-pivot-chip-remove:hover{background:var(--tbw-pivot-chip-remove-hover-bg, var(--tbw-color-accent));color:var(--tbw-pivot-chip-remove-hover-fg, var(--tbw-color-accent-fg))}.tbw-pivot-value-chip{padding:var(--tbw-button-padding-sm, var(--tbw-spacing-xs, .25rem) var(--tbw-spacing-md, .5rem))}.tbw-pivot-value-label-wrapper{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));flex:1;min-width:0}.tbw-pivot-agg-select{padding:var(--tbw-spacing-xs, .125rem) var(--tbw-spacing-xs, .25rem);font-size:var(--tbw-font-size-xs, .6875rem);border:1px solid var(--tbw-color-border);border-radius:var(--tbw-border-radius);background:var(--tbw-color-bg);cursor:pointer}.tbw-pivot-available-fields{display:flex;flex-wrap:wrap;gap:var(--tbw-spacing-sm, .375rem);min-height:40px}.tbw-pivot-options{display:flex;flex-direction:column;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.tbw-pivot-checkbox{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));cursor:pointer}.tbw-pivot-checkbox input{width:var(--tbw-icon-size-sm, .875rem);height:var(--tbw-icon-size-sm, .875rem);cursor:pointer}.pivot-group-row.tbw-pivot-slide-in,.pivot-leaf-row.tbw-pivot-slide-in{animation:tbw-pivot-slide-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-pivot-slide-in{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}.pivot-group-row.tbw-pivot-fade-in,.pivot-leaf-row.tbw-pivot-fade-in{animation:tbw-pivot-fade-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-pivot-fade-in{0%{opacity:0}to{opacity:1}}}';
751
762
  class v extends P {
752
763
  name = "pivot";
753
764
  styles = Q;
@@ -814,7 +825,7 @@ class v extends P {
814
825
  if (t.length > 0)
815
826
  return this.warn(`Config errors: ${t.join(", ")}`), [...e];
816
827
  this.buildFieldHeaderMap(), this.defaultExpanded = this.config.defaultExpanded ?? !0, this.expandedKeys.size === 0 && this.defaultExpanded && this.pivotResult && this.expandAllKeys(), this.pivotResult = K(e, this.config), this.expandedKeys.size === 0 && this.defaultExpanded && this.expandAllKeys();
817
- const i = this.config.indentWidth ?? 20, n = q(
828
+ const o = this.config.indentWidth ?? 20, r = D(
818
829
  this.pivotResult.rows,
819
830
  this.expandedKeys,
820
831
  this.defaultExpanded
@@ -826,33 +837,33 @@ class v extends P {
826
837
  __pivotHasChildren: !!a.children?.length,
827
838
  __pivotExpanded: this.expandedKeys.has(a.rowKey),
828
839
  __pivotRowCount: a.rowCount ?? 0,
829
- __pivotIndent: a.depth * i,
840
+ __pivotIndent: a.depth * o,
830
841
  __pivotTotal: a.total,
831
842
  ...a.values
832
843
  }));
833
844
  this.keysToAnimate.clear();
834
- const r = /* @__PURE__ */ new Set();
835
- for (const a of n) {
845
+ const n = /* @__PURE__ */ new Set();
846
+ for (const a of r) {
836
847
  const s = a.__pivotRowKey;
837
- r.add(s), !this.previousVisibleKeys.has(s) && a.__pivotDepth > 0 && this.keysToAnimate.add(s);
848
+ n.add(s), !this.previousVisibleKeys.has(s) && a.__pivotDepth > 0 && this.keysToAnimate.add(s);
838
849
  }
839
- return this.previousVisibleKeys = r, n;
850
+ return this.previousVisibleKeys = n, r;
840
851
  }
841
852
  processColumns(e) {
842
853
  if (!this.isActive || !this.pivotResult)
843
854
  return [...e];
844
- const t = [], i = (this.config.rowGroupFields ?? []).map((n) => this.fieldHeaderMap.get(n) ?? n).join(" / ");
855
+ const t = [], o = (this.config.rowGroupFields ?? []).map((r) => this.fieldHeaderMap.get(r) ?? r).join(" / ");
845
856
  t.push({
846
857
  field: "__pivotLabel",
847
- header: i || "Group",
858
+ header: o || "Group",
848
859
  width: 200
849
860
  });
850
- for (const n of this.pivotResult.columnKeys)
851
- for (const r of this.config.valueFields ?? []) {
852
- const a = x([n], r.field), s = r.header || this.fieldHeaderMap.get(r.field) || r.field;
861
+ for (const r of this.pivotResult.columnKeys)
862
+ for (const n of this.config.valueFields ?? []) {
863
+ const a = C([r], n.field), s = n.header || this.fieldHeaderMap.get(n.field) || n.field;
853
864
  t.push({
854
865
  field: a,
855
- header: `${n} - ${s} (${r.aggFunc})`,
866
+ header: `${r} - ${s} (${n.aggFunc})`,
856
867
  width: 120,
857
868
  type: "number"
858
869
  });
@@ -864,15 +875,15 @@ class v extends P {
864
875
  type: "number"
865
876
  }), t;
866
877
  }
867
- renderRow(e, t, i) {
868
- const n = e;
869
- return n.__pivotRowKey && n.__pivotHasChildren ? U(n, t, {
878
+ renderRow(e, t, o) {
879
+ const r = e;
880
+ return r.__pivotRowKey && r.__pivotHasChildren ? U(r, t, {
870
881
  columns: this.gridColumns,
871
- rowIndex: i,
872
- onToggle: (r) => this.toggle(r),
873
- resolveIcon: (r) => this.resolveIcon(r),
874
- setIcon: (r, a) => this.setIcon(r, a)
875
- }) : n.__pivotRowKey !== void 0 && this.isActive ? B(n, t, this.gridColumns, i) : (this.cleanupPivotStyling(t), !1);
882
+ rowIndex: o,
883
+ onToggle: (n) => this.toggle(n),
884
+ resolveIcon: (n) => this.resolveIcon(n),
885
+ setIcon: (n, a) => this.setIcon(n, a)
886
+ }) : r.__pivotRowKey !== void 0 && this.isActive ? B(r, t, this.gridColumns, o) : (this.cleanupPivotStyling(t), !1);
876
887
  }
877
888
  /**
878
889
  * Remove pivot-specific classes, attributes, and inline styles from a row element.
@@ -884,20 +895,20 @@ class v extends P {
884
895
  }
885
896
  onKeyDown(e) {
886
897
  if (e.key !== " " || !this.isActive) return;
887
- const t = this.grid._focusRow, i = this.rows[t];
888
- if (!(!i?.__pivotIsGroup || !i.__pivotHasChildren))
889
- return e.preventDefault(), this.toggle(i.__pivotRowKey), this.requestRenderWithFocus(), !0;
898
+ const t = this.grid._focusRow, o = this.rows[t];
899
+ if (!(!o?.__pivotIsGroup || !o.__pivotHasChildren))
900
+ return e.preventDefault(), this.toggle(o.__pivotRowKey), this.requestRenderWithFocus(), !0;
890
901
  }
891
902
  afterRender() {
892
903
  this.isActive && this.config.showGrandTotal && this.pivotResult ? this.renderGrandTotalFooter() : this.cleanupGrandTotalFooter();
893
904
  const e = this.animationStyle;
894
905
  if (e === !1 || this.keysToAnimate.size === 0) return;
895
- const t = this.shadowRoot?.querySelector(".rows");
906
+ const t = this.gridElement?.querySelector(".rows");
896
907
  if (!t) return;
897
- const i = e === "fade" ? "tbw-pivot-fade-in" : "tbw-pivot-slide-in";
898
- for (const n of t.querySelectorAll(".pivot-group-row, .pivot-leaf-row")) {
899
- const r = n.dataset.pivotKey;
900
- r && this.keysToAnimate.has(r) && (n.classList.add(i), n.addEventListener("animationend", () => n.classList.remove(i), { once: !0 }));
908
+ const o = e === "fade" ? "tbw-pivot-fade-in" : "tbw-pivot-slide-in";
909
+ for (const r of t.querySelectorAll(".pivot-group-row, .pivot-leaf-row")) {
910
+ const n = r.dataset.pivotKey;
911
+ n && this.keysToAnimate.has(n) && (r.classList.add(o), r.addEventListener("animationend", () => r.classList.remove(o), { once: !0 }));
901
912
  }
902
913
  this.keysToAnimate.clear();
903
914
  }
@@ -906,19 +917,19 @@ class v extends P {
906
917
  */
907
918
  renderGrandTotalFooter() {
908
919
  if (!this.pivotResult) return;
909
- const e = this.shadowRoot;
920
+ const e = this.gridElement;
910
921
  if (!e) return;
911
922
  const t = e.querySelector(".tbw-scroll-area") ?? e.querySelector(".tbw-grid-content") ?? e.children[0];
912
923
  if (!t) return;
913
924
  this.grandTotalFooter || (this.grandTotalFooter = document.createElement("div"), this.grandTotalFooter.className = "pivot-grand-total-footer", t.appendChild(this.grandTotalFooter));
914
- const i = {
925
+ const o = {
915
926
  __pivotRowKey: "__grandTotal",
916
927
  __pivotLabel: "Grand Total",
917
928
  __pivotIsGrandTotal: !0,
918
929
  __pivotTotal: this.pivotResult.grandTotal,
919
930
  ...this.pivotResult.totals
920
931
  };
921
- J(i, this.grandTotalFooter, this.gridColumns);
932
+ J(o, this.grandTotalFooter, this.gridColumns);
922
933
  }
923
934
  /**
924
935
  * Remove the grand total footer element.
@@ -948,7 +959,7 @@ class v extends P {
948
959
  */
949
960
  expandAllKeys() {
950
961
  if (!this.pivotResult) return;
951
- const e = H(this.pivotResult.rows);
962
+ const e = q(this.pivotResult.rows);
952
963
  for (const t of e)
953
964
  this.expandedKeys.add(t);
954
965
  }
@@ -1042,50 +1053,50 @@ class v extends P {
1042
1053
  renderPanel(e) {
1043
1054
  this.panelContainer = e, this.originalColumns.length === 0 && this.captureOriginalColumns();
1044
1055
  const t = {
1045
- onTogglePivot: (i) => {
1046
- i ? this.enablePivot() : this.disablePivot(), this.refreshPanel();
1056
+ onTogglePivot: (o) => {
1057
+ o ? this.enablePivot() : this.disablePivot(), this.refreshPanel();
1047
1058
  },
1048
- onAddFieldToZone: (i, n) => this.addFieldToZone(i, n),
1049
- onRemoveFieldFromZone: (i, n) => this.removeFieldFromZone(i, n),
1050
- onAddValueField: (i, n) => this.addValueField(i, n),
1051
- onRemoveValueField: (i) => this.removeValueField(i),
1052
- onUpdateValueAggFunc: (i, n) => this.updateValueAggFunc(i, n),
1053
- onOptionChange: (i, n) => {
1054
- this.config[i] = n, this.isActive && this.refresh();
1059
+ onAddFieldToZone: (o, r) => this.addFieldToZone(o, r),
1060
+ onRemoveFieldFromZone: (o, r) => this.removeFieldFromZone(o, r),
1061
+ onAddValueField: (o, r) => this.addValueField(o, r),
1062
+ onRemoveValueField: (o) => this.removeValueField(o),
1063
+ onUpdateValueAggFunc: (o, r) => this.updateValueAggFunc(o, r),
1064
+ onOptionChange: (o, r) => {
1065
+ this.config[o] = r, this.isActive && this.refresh();
1055
1066
  },
1056
1067
  getAvailableFields: () => this.getAvailableFields()
1057
1068
  };
1058
- return z(e, this.config, this.isActive, t);
1069
+ return M(e, this.config, this.isActive, t);
1059
1070
  }
1060
1071
  refreshPanel() {
1061
1072
  this.panelContainer && (this.panelContainer.innerHTML = "", this.renderPanel(this.panelContainer));
1062
1073
  }
1063
1074
  addFieldToZone(e, t) {
1064
1075
  if (t === "rowGroups") {
1065
- const i = this.config.rowGroupFields ?? [];
1066
- i.includes(e) || (this.config.rowGroupFields = [...i, e]);
1076
+ const o = this.config.rowGroupFields ?? [];
1077
+ o.includes(e) || (this.config.rowGroupFields = [...o, e]);
1067
1078
  } else {
1068
- const i = this.config.columnGroupFields ?? [];
1069
- i.includes(e) || (this.config.columnGroupFields = [...i, e]);
1079
+ const o = this.config.columnGroupFields ?? [];
1080
+ o.includes(e) || (this.config.columnGroupFields = [...o, e]);
1070
1081
  }
1071
1082
  this.removeFromOtherZones(e, t), this.refreshIfActive();
1072
1083
  }
1073
1084
  removeFieldFromZone(e, t) {
1074
- t === "rowGroups" ? this.config.rowGroupFields = (this.config.rowGroupFields ?? []).filter((i) => i !== e) : this.config.columnGroupFields = (this.config.columnGroupFields ?? []).filter((i) => i !== e), this.refreshIfActive();
1085
+ t === "rowGroups" ? this.config.rowGroupFields = (this.config.rowGroupFields ?? []).filter((o) => o !== e) : this.config.columnGroupFields = (this.config.columnGroupFields ?? []).filter((o) => o !== e), this.refreshIfActive();
1075
1086
  }
1076
1087
  removeFromOtherZones(e, t) {
1077
- t !== "rowGroups" && (this.config.rowGroupFields = (this.config.rowGroupFields ?? []).filter((i) => i !== e)), t !== "columnGroups" && (this.config.columnGroupFields = (this.config.columnGroupFields ?? []).filter((i) => i !== e)), t !== "values" && (this.config.valueFields = (this.config.valueFields ?? []).filter((i) => i.field !== e));
1088
+ t !== "rowGroups" && (this.config.rowGroupFields = (this.config.rowGroupFields ?? []).filter((o) => o !== e)), t !== "columnGroups" && (this.config.columnGroupFields = (this.config.columnGroupFields ?? []).filter((o) => o !== e)), t !== "values" && (this.config.valueFields = (this.config.valueFields ?? []).filter((o) => o.field !== e));
1078
1089
  }
1079
1090
  addValueField(e, t) {
1080
- const i = this.config.valueFields ?? [];
1081
- i.some((n) => n.field === e) || (this.config.valueFields = [...i, { field: e, aggFunc: t }]), this.removeFromOtherZones(e, "values"), this.refreshIfActive();
1091
+ const o = this.config.valueFields ?? [];
1092
+ o.some((r) => r.field === e) || (this.config.valueFields = [...o, { field: e, aggFunc: t }]), this.removeFromOtherZones(e, "values"), this.refreshIfActive();
1082
1093
  }
1083
1094
  removeValueField(e) {
1084
1095
  this.config.valueFields = (this.config.valueFields ?? []).filter((t) => t.field !== e), this.refreshIfActive();
1085
1096
  }
1086
1097
  updateValueAggFunc(e, t) {
1087
- const i = this.config.valueFields ?? [], n = i.findIndex((r) => r.field === e);
1088
- n >= 0 && (i[n] = { ...i[n], aggFunc: t }, this.config.valueFields = [...i]), this.isActive && this.refresh();
1098
+ const o = this.config.valueFields ?? [], r = o.findIndex((n) => n.field === e);
1099
+ r >= 0 && (o[r] = { ...o[r], aggFunc: t }, this.config.valueFields = [...o]), this.isActive && this.refresh();
1089
1100
  }
1090
1101
  // #endregion
1091
1102
  }