@toolbox-web/grid 0.4.1 → 0.4.2

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 (157) hide show
  1. package/README.md +10 -13
  2. package/all.js +1101 -1048
  3. package/all.js.map +1 -1
  4. package/index.js +245 -137
  5. package/index.js.map +1 -1
  6. package/lib/core/grid.d.ts +10 -0
  7. package/lib/core/grid.d.ts.map +1 -1
  8. package/lib/core/internal/config-manager.d.ts +1 -0
  9. package/lib/core/internal/config-manager.d.ts.map +1 -1
  10. package/lib/core/internal/keyboard.d.ts.map +1 -1
  11. package/lib/core/internal/utils.d.ts +1 -0
  12. package/lib/core/internal/utils.d.ts.map +1 -1
  13. package/lib/core/plugin/base-plugin.d.ts +57 -1
  14. package/lib/core/plugin/base-plugin.d.ts.map +1 -1
  15. package/lib/core/plugin/expander-column.d.ts +51 -0
  16. package/lib/core/plugin/expander-column.d.ts.map +1 -0
  17. package/lib/core/plugin/types.d.ts +117 -1
  18. package/lib/core/plugin/types.d.ts.map +1 -1
  19. package/lib/core/types.d.ts +4 -2
  20. package/lib/core/types.d.ts.map +1 -1
  21. package/lib/plugins/clipboard/ClipboardPlugin.d.ts +5 -4
  22. package/lib/plugins/clipboard/ClipboardPlugin.d.ts.map +1 -1
  23. package/lib/plugins/clipboard/index.d.ts +1 -1
  24. package/lib/plugins/clipboard/index.d.ts.map +1 -1
  25. package/lib/plugins/clipboard/index.js +282 -188
  26. package/lib/plugins/clipboard/index.js.map +1 -1
  27. package/lib/plugins/clipboard/types.d.ts +72 -2
  28. package/lib/plugins/clipboard/types.d.ts.map +1 -1
  29. package/lib/plugins/column-virtualization/ColumnVirtualizationPlugin.d.ts +0 -1
  30. package/lib/plugins/column-virtualization/ColumnVirtualizationPlugin.d.ts.map +1 -1
  31. package/lib/plugins/column-virtualization/index.js +102 -26
  32. package/lib/plugins/column-virtualization/index.js.map +1 -1
  33. package/lib/plugins/context-menu/ContextMenuPlugin.d.ts +0 -1
  34. package/lib/plugins/context-menu/ContextMenuPlugin.d.ts.map +1 -1
  35. package/lib/plugins/context-menu/index.js +154 -78
  36. package/lib/plugins/context-menu/index.js.map +1 -1
  37. package/lib/plugins/editing/EditingPlugin.d.ts +1 -7
  38. package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
  39. package/lib/plugins/editing/index.js +200 -136
  40. package/lib/plugins/editing/index.js.map +1 -1
  41. package/lib/plugins/export/ExportPlugin.d.ts +0 -1
  42. package/lib/plugins/export/ExportPlugin.d.ts.map +1 -1
  43. package/lib/plugins/export/index.js +175 -99
  44. package/lib/plugins/export/index.js.map +1 -1
  45. package/lib/plugins/filtering/FilteringPlugin.d.ts +5 -2
  46. package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -1
  47. package/lib/plugins/filtering/index.js +129 -43
  48. package/lib/plugins/filtering/index.js.map +1 -1
  49. package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts +1 -2
  50. package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts.map +1 -1
  51. package/lib/plugins/grouping-columns/grouping-columns.d.ts +1 -1
  52. package/lib/plugins/grouping-columns/grouping-columns.d.ts.map +1 -1
  53. package/lib/plugins/grouping-columns/index.js +144 -66
  54. package/lib/plugins/grouping-columns/index.js.map +1 -1
  55. package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts +14 -2
  56. package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts.map +1 -1
  57. package/lib/plugins/grouping-rows/index.js +230 -138
  58. package/lib/plugins/grouping-rows/index.js.map +1 -1
  59. package/lib/plugins/master-detail/MasterDetailPlugin.d.ts +13 -11
  60. package/lib/plugins/master-detail/MasterDetailPlugin.d.ts.map +1 -1
  61. package/lib/plugins/master-detail/index.js +265 -196
  62. package/lib/plugins/master-detail/index.js.map +1 -1
  63. package/lib/plugins/master-detail/types.d.ts +0 -10
  64. package/lib/plugins/master-detail/types.d.ts.map +1 -1
  65. package/lib/plugins/multi-sort/MultiSortPlugin.d.ts +1 -2
  66. package/lib/plugins/multi-sort/MultiSortPlugin.d.ts.map +1 -1
  67. package/lib/plugins/multi-sort/index.js +105 -31
  68. package/lib/plugins/multi-sort/index.js.map +1 -1
  69. package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts +0 -1
  70. package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts.map +1 -1
  71. package/lib/plugins/pinned-columns/index.js +128 -52
  72. package/lib/plugins/pinned-columns/index.js.map +1 -1
  73. package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts +1 -2
  74. package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts.map +1 -1
  75. package/lib/plugins/pinned-rows/index.js +162 -88
  76. package/lib/plugins/pinned-rows/index.js.map +1 -1
  77. package/lib/plugins/pivot/PivotPlugin.d.ts +26 -4
  78. package/lib/plugins/pivot/PivotPlugin.d.ts.map +1 -1
  79. package/lib/plugins/pivot/index.js +398 -310
  80. package/lib/plugins/pivot/index.js.map +1 -1
  81. package/lib/plugins/pivot/pivot-rows.d.ts +2 -1
  82. package/lib/plugins/pivot/pivot-rows.d.ts.map +1 -1
  83. package/lib/plugins/reorder/ReorderPlugin.d.ts +13 -10
  84. package/lib/plugins/reorder/ReorderPlugin.d.ts.map +1 -1
  85. package/lib/plugins/reorder/index.js +288 -226
  86. package/lib/plugins/reorder/index.js.map +1 -1
  87. package/lib/plugins/selection/SelectionPlugin.d.ts +21 -3
  88. package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
  89. package/lib/plugins/selection/index.d.ts +2 -2
  90. package/lib/plugins/selection/index.d.ts.map +1 -1
  91. package/lib/plugins/selection/index.js +276 -145
  92. package/lib/plugins/selection/index.js.map +1 -1
  93. package/lib/plugins/selection/types.d.ts +24 -0
  94. package/lib/plugins/selection/types.d.ts.map +1 -1
  95. package/lib/plugins/server-side/ServerSidePlugin.d.ts +0 -1
  96. package/lib/plugins/server-side/ServerSidePlugin.d.ts.map +1 -1
  97. package/lib/plugins/server-side/index.js +83 -7
  98. package/lib/plugins/server-side/index.js.map +1 -1
  99. package/lib/plugins/tree/TreePlugin.d.ts +5 -1
  100. package/lib/plugins/tree/TreePlugin.d.ts.map +1 -1
  101. package/lib/plugins/tree/index.js +197 -112
  102. package/lib/plugins/tree/index.js.map +1 -1
  103. package/lib/plugins/tree/types.d.ts +0 -10
  104. package/lib/plugins/tree/types.d.ts.map +1 -1
  105. package/lib/plugins/undo-redo/UndoRedoPlugin.d.ts +0 -1
  106. package/lib/plugins/undo-redo/UndoRedoPlugin.d.ts.map +1 -1
  107. package/lib/plugins/undo-redo/index.js +93 -17
  108. package/lib/plugins/undo-redo/index.js.map +1 -1
  109. package/lib/plugins/visibility/VisibilityPlugin.d.ts +7 -4
  110. package/lib/plugins/visibility/VisibilityPlugin.d.ts.map +1 -1
  111. package/lib/plugins/visibility/index.js +144 -65
  112. package/lib/plugins/visibility/index.js.map +1 -1
  113. package/package.json +1 -1
  114. package/umd/grid.all.umd.js +17 -19
  115. package/umd/grid.all.umd.js.map +1 -1
  116. package/umd/grid.umd.js +7 -7
  117. package/umd/grid.umd.js.map +1 -1
  118. package/umd/plugins/clipboard.umd.js +5 -7
  119. package/umd/plugins/clipboard.umd.js.map +1 -1
  120. package/umd/plugins/column-virtualization.umd.js +1 -1
  121. package/umd/plugins/column-virtualization.umd.js.map +1 -1
  122. package/umd/plugins/context-menu.umd.js +1 -1
  123. package/umd/plugins/context-menu.umd.js.map +1 -1
  124. package/umd/plugins/editing.umd.js +1 -1
  125. package/umd/plugins/editing.umd.js.map +1 -1
  126. package/umd/plugins/export.umd.js +1 -1
  127. package/umd/plugins/export.umd.js.map +1 -1
  128. package/umd/plugins/filtering.umd.js +1 -1
  129. package/umd/plugins/filtering.umd.js.map +1 -1
  130. package/umd/plugins/grouping-columns.umd.js +1 -1
  131. package/umd/plugins/grouping-columns.umd.js.map +1 -1
  132. package/umd/plugins/grouping-rows.umd.js +1 -1
  133. package/umd/plugins/grouping-rows.umd.js.map +1 -1
  134. package/umd/plugins/master-detail.umd.js +1 -1
  135. package/umd/plugins/master-detail.umd.js.map +1 -1
  136. package/umd/plugins/multi-sort.umd.js +1 -1
  137. package/umd/plugins/multi-sort.umd.js.map +1 -1
  138. package/umd/plugins/pinned-columns.umd.js +1 -1
  139. package/umd/plugins/pinned-columns.umd.js.map +1 -1
  140. package/umd/plugins/pinned-rows.umd.js +1 -1
  141. package/umd/plugins/pinned-rows.umd.js.map +1 -1
  142. package/umd/plugins/pivot.umd.js +1 -1
  143. package/umd/plugins/pivot.umd.js.map +1 -1
  144. package/umd/plugins/reorder.umd.js +1 -1
  145. package/umd/plugins/reorder.umd.js.map +1 -1
  146. package/umd/plugins/selection.umd.js +1 -1
  147. package/umd/plugins/selection.umd.js.map +1 -1
  148. package/umd/plugins/server-side.umd.js +1 -1
  149. package/umd/plugins/server-side.umd.js.map +1 -1
  150. package/umd/plugins/tree.umd.js +1 -1
  151. package/umd/plugins/tree.umd.js.map +1 -1
  152. package/umd/plugins/undo-redo.umd.js +1 -1
  153. package/umd/plugins/undo-redo.umd.js.map +1 -1
  154. package/umd/plugins/visibility.umd.js +1 -1
  155. package/umd/plugins/visibility.umd.js.map +1 -1
  156. package/lib/core/internal/editing.d.ts +0 -76
  157. package/lib/core/internal/editing.d.ts.map +0 -1
@@ -1,4 +1,4 @@
1
- const E = {
1
+ const L = {
2
2
  expand: "▶",
3
3
  collapse: "▼",
4
4
  sortAsc: "▲",
@@ -25,8 +25,11 @@ class P {
25
25
  * ```
26
26
  */
27
27
  static dependencies;
28
- /** Plugin version - override in subclass if needed */
29
- version = "1.0.0";
28
+ /**
29
+ * Plugin version - defaults to grid version for built-in plugins.
30
+ * Third-party plugins can override with their own semver.
31
+ */
32
+ version = typeof __GRID_VERSION__ < "u" ? __GRID_VERSION__ : "dev";
30
33
  /** CSS styles to inject into the grid's shadow DOM */
31
34
  styles;
32
35
  /** Custom cell renderers keyed by type name */
@@ -113,12 +116,28 @@ class P {
113
116
  emit(e, t) {
114
117
  this.grid?.dispatchEvent?.(new CustomEvent(e, { detail: t, bubbles: !0 }));
115
118
  }
119
+ /**
120
+ * Emit a cancelable custom event from the grid.
121
+ * @returns `true` if the event was cancelled (preventDefault called), `false` otherwise
122
+ */
123
+ emitCancelable(e, t) {
124
+ const i = new CustomEvent(e, { detail: t, bubbles: !0, cancelable: !0 });
125
+ return this.grid?.dispatchEvent?.(i), i.defaultPrevented;
126
+ }
116
127
  /**
117
128
  * Request a re-render of the grid.
118
129
  */
119
130
  requestRender() {
120
131
  this.grid?.requestRender?.();
121
132
  }
133
+ /**
134
+ * Request a re-render and restore focus styling afterward.
135
+ * Use this when a plugin action (like expand/collapse) triggers a render
136
+ * but needs to maintain keyboard navigation focus.
137
+ */
138
+ requestRenderWithFocus() {
139
+ this.grid?.requestRenderWithFocus?.();
140
+ }
122
141
  /**
123
142
  * Request a lightweight style update without rebuilding DOM.
124
143
  * Use this instead of requestRender() when only CSS classes need updating.
@@ -152,6 +171,19 @@ class P {
152
171
  get visibleColumns() {
153
172
  return this.grid?._visibleColumns ?? [];
154
173
  }
174
+ /**
175
+ * Get the grid as an HTMLElement for direct DOM operations.
176
+ * Use sparingly - prefer the typed GridElementRef API when possible.
177
+ *
178
+ * @example
179
+ * ```ts
180
+ * const width = this.gridElement.clientWidth;
181
+ * this.gridElement.classList.add('my-plugin-active');
182
+ * ```
183
+ */
184
+ get gridElement() {
185
+ return this.grid;
186
+ }
155
187
  /**
156
188
  * Get the shadow root of the grid.
157
189
  */
@@ -184,8 +216,53 @@ class P {
184
216
  */
185
217
  get gridIcons() {
186
218
  const e = this.grid?.gridConfig?.icons ?? {};
187
- return { ...E, ...e };
219
+ return { ...L, ...e };
220
+ }
221
+ // #region Animation Helpers
222
+ /**
223
+ * Check if animations are enabled at the grid level.
224
+ * Respects gridConfig.animation.mode and the CSS variable set by the grid.
225
+ *
226
+ * Plugins should use this to skip animations when:
227
+ * - Animation mode is 'off' or `false`
228
+ * - User prefers reduced motion and mode is 'reduced-motion' (default)
229
+ *
230
+ * @example
231
+ * ```ts
232
+ * private get animationStyle(): 'slide' | 'fade' | false {
233
+ * if (!this.isAnimationEnabled) return false;
234
+ * return this.config.animation ?? 'slide';
235
+ * }
236
+ * ```
237
+ */
238
+ get isAnimationEnabled() {
239
+ const e = this.grid?.effectiveConfig?.animation?.mode ?? "reduced-motion";
240
+ if (e === !1 || e === "off") return !1;
241
+ if (e === !0 || e === "on") return !0;
242
+ const t = this.shadowRoot?.host;
243
+ return t ? getComputedStyle(t).getPropertyValue("--tbw-animation-enabled").trim() !== "0" : !0;
244
+ }
245
+ /**
246
+ * Get the animation duration in milliseconds from CSS variable.
247
+ * Falls back to 200ms if not set.
248
+ *
249
+ * Plugins can use this for their animation timing to stay consistent
250
+ * with the grid-level animation.duration setting.
251
+ *
252
+ * @example
253
+ * ```ts
254
+ * element.animate(keyframes, { duration: this.animationDuration });
255
+ * ```
256
+ */
257
+ get animationDuration() {
258
+ const e = this.shadowRoot?.host;
259
+ if (e) {
260
+ const t = getComputedStyle(e).getPropertyValue("--tbw-animation-duration").trim(), i = parseInt(t, 10);
261
+ if (!isNaN(i)) return i;
262
+ }
263
+ return 200;
188
264
  }
265
+ // #endregion
189
266
  /**
190
267
  * Resolve an icon value to string or HTMLElement.
191
268
  * Checks plugin config first, then grid-level icons, then defaults.
@@ -216,237 +293,237 @@ class P {
216
293
  // #endregion
217
294
  }
218
295
  const m = {
219
- sum: (i, e) => i.reduce((t, o) => t + (Number(o[e]) || 0), 0),
220
- avg: (i, e) => {
221
- const t = i.reduce((o, n) => o + (Number(n[e]) || 0), 0);
222
- return i.length ? t / i.length : 0;
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;
223
300
  },
224
- count: (i) => i.length,
225
- min: (i, e) => Math.min(...i.map((t) => Number(t[e]) || 1 / 0)),
226
- max: (i, e) => Math.max(...i.map((t) => Number(t[e]) || -1 / 0)),
227
- first: (i, e) => i[0]?.[e],
228
- last: (i, e) => i[i.length - 1]?.[e]
229
- }, v = /* @__PURE__ */ new Map(), h = {
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 = {
230
307
  /**
231
308
  * Register a custom aggregator function.
232
309
  */
233
- register(i, e) {
234
- v.set(i, e);
310
+ register(o, e) {
311
+ f.set(o, e);
235
312
  },
236
313
  /**
237
314
  * Unregister a custom aggregator function.
238
315
  */
239
- unregister(i) {
240
- v.delete(i);
316
+ unregister(o) {
317
+ f.delete(o);
241
318
  },
242
319
  /**
243
320
  * Get an aggregator function by reference.
244
321
  */
245
- get(i) {
246
- if (i !== void 0)
247
- return typeof i == "function" ? i : v.get(i) ?? m[i];
322
+ get(o) {
323
+ if (o !== void 0)
324
+ return typeof o == "function" ? o : f.get(o) ?? m[o];
248
325
  },
249
326
  /**
250
327
  * Run an aggregator on a set of rows.
251
328
  */
252
- run(i, e, t, o) {
253
- const n = this.get(i);
254
- return n ? n(e, t, o) : void 0;
329
+ run(o, e, t, i) {
330
+ const n = this.get(o);
331
+ return n ? n(e, t, i) : void 0;
255
332
  },
256
333
  /**
257
334
  * Check if an aggregator exists.
258
335
  */
259
- has(i) {
260
- return v.has(i) || i in m;
336
+ has(o) {
337
+ return f.has(o) || o in m;
261
338
  },
262
339
  /**
263
340
  * List all available aggregator names.
264
341
  */
265
342
  list() {
266
- return [...Object.keys(m), ...v.keys()];
267
- }
268
- }, R = {
269
- sum: (i) => i.reduce((e, t) => e + t, 0),
270
- avg: (i) => i.length ? i.reduce((e, t) => e + t, 0) / i.length : 0,
271
- count: (i) => i.length,
272
- min: (i) => i.length ? Math.min(...i) : 0,
273
- max: (i) => i.length ? Math.max(...i) : 0,
274
- first: (i) => i[0] ?? 0,
275
- last: (i) => i[i.length - 1] ?? 0
343
+ return [...Object.keys(m), ...f.keys()];
344
+ }
345
+ }, 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
276
353
  };
277
- function N(i) {
278
- return R[i] ?? R.sum;
354
+ function k(o) {
355
+ return A[o] ?? A.sum;
279
356
  }
280
357
  h.register.bind(h);
281
358
  h.unregister.bind(h);
282
359
  h.get.bind(h);
283
360
  h.run.bind(h);
284
361
  h.list.bind(h);
285
- const K = N;
286
- function S(i) {
362
+ const N = k;
363
+ function S(o) {
287
364
  const e = [];
288
- 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;
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;
289
366
  }
290
- function C(i, e) {
291
- return [...i, e].join("|");
367
+ function x(o, e) {
368
+ return [...o, e].join("|");
292
369
  }
293
- function I(i, e) {
294
- const t = e.rowGroupFields ?? [], o = e.columnGroupFields ?? [], n = e.valueFields ?? [], r = V(i, o), s = L(
295
- i,
296
- t,
370
+ function K(o, e) {
371
+ const t = e.rowGroupFields ?? [], i = e.columnGroupFields ?? [], n = e.valueFields ?? [], r = I(o, i), a = G(
297
372
  o,
373
+ t,
374
+ i,
298
375
  r,
299
376
  n,
300
377
  0,
301
378
  // starting depth
302
379
  ""
303
380
  // parent key prefix
304
- ), a = D(s, r, n), l = Object.values(a).reduce((d, c) => d + c, 0);
381
+ ), s = D(a, r, n), l = Object.values(s).reduce((d, c) => d + c, 0);
305
382
  return {
306
- rows: s,
383
+ rows: a,
307
384
  columnKeys: r,
308
- totals: a,
385
+ totals: s,
309
386
  grandTotal: l
310
387
  };
311
388
  }
312
- function V(i, e) {
389
+ function I(o, e) {
313
390
  if (e.length === 0) return ["value"];
314
391
  const t = /* @__PURE__ */ new Set();
315
- for (const o of i) {
316
- const n = e.map((r) => String(o[r] ?? "")).join("|");
392
+ for (const i of o) {
393
+ const n = e.map((r) => String(i[r] ?? "")).join("|");
317
394
  t.add(n);
318
395
  }
319
396
  return [...t].sort();
320
397
  }
321
- function M(i, e) {
398
+ function V(o, e) {
322
399
  const t = /* @__PURE__ */ new Map();
323
- for (const o of i) {
324
- const n = String(o[e] ?? ""), r = t.get(n);
325
- r ? r.push(o) : t.set(n, [o]);
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]);
326
403
  }
327
404
  return t;
328
405
  }
329
- function L(i, e, t, o, n, r, s) {
330
- const a = [];
406
+ function G(o, e, t, i, n, r, a) {
407
+ const s = [];
331
408
  if (e.length === 0) {
332
- const u = T(i, t, o, n), g = _(u);
333
- return a.push({
334
- rowKey: s || "all",
335
- rowLabel: s || "All",
409
+ const u = R(o, t, i, n), g = _(u);
410
+ return s.push({
411
+ rowKey: a || "all",
412
+ rowLabel: a || "All",
336
413
  depth: r,
337
414
  values: u,
338
415
  total: g,
339
416
  isGroup: !1,
340
- rowCount: i.length
341
- }), a;
417
+ rowCount: o.length
418
+ }), s;
342
419
  }
343
- const l = e[0], d = e.slice(1), c = d.length > 0, p = M(i, l);
420
+ const l = e[0], d = e.slice(1), c = d.length > 0, p = V(o, l);
344
421
  for (const [u, g] of p) {
345
- const y = s ? `${s}|${u}` : u, F = T(g, t, o, n), k = _(F);
346
- let A;
347
- c && (A = L(
422
+ const C = a ? `${a}|${u}` : u, y = R(g, t, i, n), E = _(y);
423
+ let F;
424
+ c && (F = G(
348
425
  g,
349
426
  d,
350
427
  t,
351
- o,
428
+ i,
352
429
  n,
353
430
  r + 1,
354
- y
355
- )), a.push({
356
- rowKey: y,
431
+ C
432
+ )), s.push({
433
+ rowKey: C,
357
434
  rowLabel: u || "(blank)",
358
435
  depth: r,
359
- values: F,
360
- total: k,
436
+ values: y,
437
+ total: E,
361
438
  isGroup: c,
362
- children: A,
439
+ children: F,
363
440
  rowCount: g.length
364
441
  });
365
442
  }
366
- return a;
443
+ return s;
367
444
  }
368
- function T(i, e, t, o) {
445
+ function R(o, e, t, i) {
369
446
  const n = {};
370
447
  for (const r of t)
371
- for (const s of o) {
372
- const l = (e.length > 0 ? i.filter((u) => e.map((g) => String(u[g] ?? "")).join("|") === r) : i).map((u) => Number(u[s.field]) || 0), d = K(s.aggFunc), c = l.length > 0 ? d(l) : null, p = C([r], s.field);
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);
373
450
  n[p] = c;
374
451
  }
375
452
  return n;
376
453
  }
377
- function _(i) {
454
+ function _(o) {
378
455
  let e = 0;
379
- for (const t of Object.values(i))
456
+ for (const t of Object.values(o))
380
457
  e += t ?? 0;
381
458
  return e;
382
459
  }
383
- function D(i, e, t) {
384
- const o = {};
460
+ function D(o, e, t) {
461
+ const i = {};
385
462
  function n(r) {
386
- for (const s of r)
387
- if (!s.isGroup || !s.children?.length)
388
- for (const a of e)
463
+ for (const a of r)
464
+ if (!a.isGroup || !a.children?.length)
465
+ for (const s of e)
389
466
  for (const l of t) {
390
- const d = C([a], l.field);
391
- o[d] = (o[d] ?? 0) + (s.values[d] ?? 0);
467
+ const d = x([s], l.field);
468
+ i[d] = (i[d] ?? 0) + (a.values[d] ?? 0);
392
469
  }
393
- else s.children && n(s.children);
470
+ else a.children && n(a.children);
394
471
  }
395
- return n(i), o;
472
+ return n(o), i;
396
473
  }
397
- function H(i, e, t = !0) {
398
- const o = [];
474
+ function q(o, e, t = !0) {
475
+ const i = [];
399
476
  function n(r) {
400
- o.push(r);
401
- const s = e ? e.has(r.rowKey) : t;
402
- if (r.children && s)
403
- for (const a of r.children)
404
- n(a);
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);
405
482
  }
406
- for (const r of i)
483
+ for (const r of o)
407
484
  n(r);
408
- return o;
485
+ return i;
409
486
  }
410
- function w(i) {
487
+ function H(o) {
411
488
  const e = [];
412
- function t(o) {
413
- if (o.isGroup && e.push(o.rowKey), o.children)
414
- for (const n of o.children)
489
+ function t(i) {
490
+ if (i.isGroup && e.push(i.rowKey), i.children)
491
+ for (const n of i.children)
415
492
  t(n);
416
493
  }
417
- for (const o of i)
418
- t(o);
494
+ for (const i of o)
495
+ t(i);
419
496
  return e;
420
497
  }
421
- const q = ["sum", "avg", "count", "min", "max", "first", "last"];
422
- function z(i, e, t, o) {
423
- const n = new AbortController(), r = { config: e, callbacks: o, signal: n.signal }, s = document.createElement("div");
424
- return s.className = "tbw-pivot-panel", s.appendChild(f("Options", () => U(t, r))), s.appendChild(f("Row Groups", () => G("rowGroups", r))), s.appendChild(f("Column Groups", () => G("columnGroups", r))), s.appendChild(f("Values", () => Z(r))), s.appendChild(f("Available Fields", () => j(r))), i.appendChild(s), () => {
425
- n.abort(), s.remove();
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();
426
503
  };
427
504
  }
428
- function f(i, e) {
505
+ function b(o, e) {
429
506
  const t = document.createElement("div");
430
507
  t.className = "tbw-pivot-section";
431
- const o = document.createElement("div");
432
- o.className = "tbw-pivot-section-header", o.textContent = i;
508
+ const i = document.createElement("div");
509
+ i.className = "tbw-pivot-section-header", i.textContent = o;
433
510
  const n = document.createElement("div");
434
- return n.className = "tbw-pivot-section-content", n.appendChild(e()), t.appendChild(o), t.appendChild(n), t;
511
+ return n.className = "tbw-pivot-section-content", n.appendChild(e()), t.appendChild(i), t.appendChild(n), t;
435
512
  }
436
- function G(i, e) {
437
- const { config: t, callbacks: o, signal: n } = e, r = document.createElement("div");
438
- r.className = "tbw-pivot-drop-zone", r.setAttribute("data-zone", i);
439
- const s = i === "rowGroups" ? t.rowGroupFields ?? [] : t.columnGroupFields ?? [];
440
- if (s.length === 0) {
441
- const a = document.createElement("div");
442
- a.className = "tbw-pivot-placeholder", a.textContent = "Drag fields here or click to add", r.appendChild(a);
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 ?? [];
517
+ if (a.length === 0) {
518
+ const s = document.createElement("div");
519
+ s.className = "tbw-pivot-placeholder", s.textContent = "Drag fields here or click to add", r.appendChild(s);
443
520
  } else
444
- for (const a of s)
445
- r.appendChild(O(a, i, e));
521
+ for (const s of a)
522
+ r.appendChild(O(s, o, e));
446
523
  return r.addEventListener(
447
524
  "dragover",
448
- (a) => {
449
- a.preventDefault(), r.classList.add("drag-over");
525
+ (s) => {
526
+ s.preventDefault(), r.classList.add("drag-over");
450
527
  },
451
528
  { signal: n }
452
529
  ), r.addEventListener(
@@ -457,30 +534,30 @@ function G(i, e) {
457
534
  { signal: n }
458
535
  ), r.addEventListener(
459
536
  "drop",
460
- (a) => {
461
- a.preventDefault(), r.classList.remove("drag-over");
462
- const l = a.dataTransfer?.getData("text/plain");
463
- l && o.onAddFieldToZone(l, i);
537
+ (s) => {
538
+ s.preventDefault(), r.classList.remove("drag-over");
539
+ const l = s.dataTransfer?.getData("text/plain");
540
+ l && i.onAddFieldToZone(l, o);
464
541
  },
465
542
  { signal: n }
466
543
  ), r;
467
544
  }
468
- function O(i, e, t) {
469
- const { callbacks: o, signal: n } = t, r = document.createElement("div");
545
+ function O(o, e, t) {
546
+ const { callbacks: i, signal: n } = t, r = document.createElement("div");
470
547
  r.className = "tbw-pivot-field-chip", r.draggable = !0;
471
- const s = o.getAvailableFields().find((d) => d.field === i), a = document.createElement("span");
472
- a.className = "tbw-pivot-chip-label", a.textContent = s?.header ?? i;
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;
473
550
  const l = document.createElement("button");
474
551
  return l.className = "tbw-pivot-chip-remove", l.innerHTML = "×", l.title = "Remove field", l.addEventListener(
475
552
  "click",
476
553
  (d) => {
477
- d.stopPropagation(), o.onRemoveFieldFromZone(i, e);
554
+ d.stopPropagation(), i.onRemoveFieldFromZone(o, e);
478
555
  },
479
556
  { signal: n }
480
- ), r.appendChild(a), r.appendChild(l), r.addEventListener(
557
+ ), r.appendChild(s), r.appendChild(l), r.addEventListener(
481
558
  "dragstart",
482
559
  (d) => {
483
- d.dataTransfer?.setData("text/plain", i), d.dataTransfer?.setData("source-zone", e), r.classList.add("dragging");
560
+ d.dataTransfer?.setData("text/plain", o), d.dataTransfer?.setData("source-zone", e), r.classList.add("dragging");
484
561
  },
485
562
  { signal: n }
486
563
  ), r.addEventListener(
@@ -491,189 +568,189 @@ function O(i, e, t) {
491
568
  { signal: n }
492
569
  ), r;
493
570
  }
494
- function Z(i) {
495
- const { config: e, callbacks: t, signal: o } = i, n = document.createElement("div");
571
+ function Z(o) {
572
+ const { config: e, callbacks: t, signal: i } = o, n = document.createElement("div");
496
573
  n.className = "tbw-pivot-drop-zone tbw-pivot-values-zone", n.setAttribute("data-zone", "values");
497
574
  const r = e.valueFields ?? [];
498
575
  if (r.length === 0) {
499
- const s = document.createElement("div");
500
- s.className = "tbw-pivot-placeholder", s.textContent = "Drag numeric fields here for aggregation", n.appendChild(s);
576
+ const a = document.createElement("div");
577
+ a.className = "tbw-pivot-placeholder", a.textContent = "Drag numeric fields here for aggregation", n.appendChild(a);
501
578
  } else
502
- for (const s of r)
503
- n.appendChild($(s, i));
579
+ for (const a of r)
580
+ n.appendChild($(a, o));
504
581
  return n.addEventListener(
505
582
  "dragover",
506
- (s) => {
507
- s.preventDefault(), n.classList.add("drag-over");
583
+ (a) => {
584
+ a.preventDefault(), n.classList.add("drag-over");
508
585
  },
509
- { signal: o }
586
+ { signal: i }
510
587
  ), n.addEventListener(
511
588
  "dragleave",
512
589
  () => {
513
590
  n.classList.remove("drag-over");
514
591
  },
515
- { signal: o }
592
+ { signal: i }
516
593
  ), n.addEventListener(
517
594
  "drop",
518
- (s) => {
519
- s.preventDefault(), n.classList.remove("drag-over");
520
- const a = s.dataTransfer?.getData("text/plain");
521
- a && t.onAddValueField(a, "sum");
595
+ (a) => {
596
+ a.preventDefault(), n.classList.remove("drag-over");
597
+ const s = a.dataTransfer?.getData("text/plain");
598
+ s && t.onAddValueField(s, "sum");
522
599
  },
523
- { signal: o }
600
+ { signal: i }
524
601
  ), n;
525
602
  }
526
- function $(i, e) {
527
- const { callbacks: t, signal: o } = e, n = document.createElement("div");
603
+ function $(o, e) {
604
+ const { callbacks: t, signal: i } = e, n = document.createElement("div");
528
605
  n.className = "tbw-pivot-field-chip tbw-pivot-value-chip";
529
- const r = t.getAvailableFields().find((c) => c.field === i.field), s = document.createElement("div");
530
- s.className = "tbw-pivot-value-label-wrapper";
531
- const a = document.createElement("span");
532
- a.className = "tbw-pivot-chip-label", a.textContent = r?.header ?? i.field;
606
+ const r = t.getAvailableFields().find((c) => c.field === o.field), a = document.createElement("div");
607
+ a.className = "tbw-pivot-value-label-wrapper";
608
+ const s = document.createElement("span");
609
+ s.className = "tbw-pivot-chip-label", s.textContent = r?.header ?? o.field;
533
610
  const l = document.createElement("select");
534
611
  l.className = "tbw-pivot-agg-select", l.title = "Aggregation function";
535
- for (const c of q) {
612
+ for (const c of M) {
536
613
  const p = document.createElement("option");
537
- p.value = c, p.textContent = c.toUpperCase(), p.selected = c === i.aggFunc, l.appendChild(p);
614
+ p.value = c, p.textContent = c.toUpperCase(), p.selected = c === o.aggFunc, l.appendChild(p);
538
615
  }
539
616
  l.addEventListener(
540
617
  "change",
541
618
  () => {
542
- t.onUpdateValueAggFunc(i.field, l.value);
619
+ t.onUpdateValueAggFunc(o.field, l.value);
543
620
  },
544
- { signal: o }
621
+ { signal: i }
545
622
  );
546
623
  const d = document.createElement("button");
547
624
  return d.className = "tbw-pivot-chip-remove", d.innerHTML = "×", d.title = "Remove value field", d.addEventListener(
548
625
  "click",
549
626
  (c) => {
550
- c.stopPropagation(), t.onRemoveValueField(i.field);
627
+ c.stopPropagation(), t.onRemoveValueField(o.field);
551
628
  },
552
- { signal: o }
553
- ), s.appendChild(a), s.appendChild(l), n.appendChild(s), n.appendChild(d), n;
629
+ { signal: i }
630
+ ), a.appendChild(s), a.appendChild(l), n.appendChild(a), n.appendChild(d), n;
554
631
  }
555
- function j(i) {
556
- const { config: e, callbacks: t, signal: o } = i, n = document.createElement("div");
632
+ function j(o) {
633
+ const { config: e, callbacks: t, signal: i } = o, n = document.createElement("div");
557
634
  n.className = "tbw-pivot-available-fields";
558
- const r = t.getAvailableFields(), s = /* @__PURE__ */ new Set([
635
+ const r = t.getAvailableFields(), a = /* @__PURE__ */ new Set([
559
636
  ...e.rowGroupFields ?? [],
560
637
  ...e.columnGroupFields ?? [],
561
638
  ...e.valueFields?.map((l) => l.field) ?? []
562
- ]), a = r.filter((l) => !s.has(l.field));
563
- if (a.length === 0) {
639
+ ]), s = r.filter((l) => !a.has(l.field));
640
+ if (s.length === 0) {
564
641
  const l = document.createElement("div");
565
642
  l.className = "tbw-pivot-placeholder", l.textContent = "All fields are in use", n.appendChild(l);
566
643
  } else
567
- for (const l of a) {
644
+ for (const l of s) {
568
645
  const d = document.createElement("div");
569
646
  d.className = "tbw-pivot-field-chip available", d.textContent = l.header, d.draggable = !0, d.title = `Drag to add "${l.field}" to a zone`, d.addEventListener(
570
647
  "dragstart",
571
648
  (c) => {
572
649
  c.dataTransfer?.setData("text/plain", l.field), d.classList.add("dragging");
573
650
  },
574
- { signal: o }
651
+ { signal: i }
575
652
  ), d.addEventListener(
576
653
  "dragend",
577
654
  () => {
578
655
  d.classList.remove("dragging");
579
656
  },
580
- { signal: o }
657
+ { signal: i }
581
658
  ), n.appendChild(d);
582
659
  }
583
660
  return n;
584
661
  }
585
- function U(i, e) {
586
- const { config: t, callbacks: o, signal: n } = e, r = document.createElement("div");
662
+ function W(o, e) {
663
+ const { config: t, callbacks: i, signal: n } = e, r = document.createElement("div");
587
664
  return r.className = "tbw-pivot-options", r.appendChild(
588
- x(
665
+ w(
589
666
  "Enable Pivot View",
590
- i,
591
- (s) => {
592
- o.onTogglePivot(s);
667
+ o,
668
+ (a) => {
669
+ i.onTogglePivot(a);
593
670
  },
594
671
  n
595
672
  )
596
673
  ), r.appendChild(
597
- x(
674
+ w(
598
675
  "Show Row Totals",
599
676
  t.showTotals ?? !0,
600
- (s) => {
601
- o.onOptionChange("showTotals", s);
677
+ (a) => {
678
+ i.onOptionChange("showTotals", a);
602
679
  },
603
680
  n
604
681
  )
605
682
  ), r.appendChild(
606
- x(
683
+ w(
607
684
  "Show Grand Total",
608
685
  t.showGrandTotal ?? !0,
609
- (s) => {
610
- o.onOptionChange("showGrandTotal", s);
686
+ (a) => {
687
+ i.onOptionChange("showGrandTotal", a);
611
688
  },
612
689
  n
613
690
  )
614
691
  ), r;
615
692
  }
616
- function x(i, e, t, o) {
693
+ function w(o, e, t, i) {
617
694
  const n = document.createElement("label");
618
695
  n.className = "tbw-pivot-checkbox";
619
696
  const r = document.createElement("input");
620
- r.type = "checkbox", r.checked = e, r.addEventListener("change", () => t(r.checked), { signal: o });
621
- const s = document.createElement("span");
622
- return s.textContent = i, n.appendChild(r), n.appendChild(s), n;
697
+ r.type = "checkbox", r.checked = e, r.addEventListener("change", () => t(r.checked), { signal: i });
698
+ const a = document.createElement("span");
699
+ return a.textContent = o, n.appendChild(r), n.appendChild(a), n;
623
700
  }
624
- function B(i, e, t) {
625
- return e.className = "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, n) => {
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) => {
626
703
  const r = document.createElement("div");
627
- if (r.className = "cell", r.setAttribute("data-col", String(n)), r.setAttribute("role", "gridcell"), n === 0) {
628
- const s = Number(i.__pivotIndent) || 0;
629
- r.style.paddingLeft = `${s}px`;
630
- const a = String(i.__pivotRowKey), l = document.createElement("button");
631
- 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) => {
632
- p.stopPropagation(), t.onToggle(a);
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) => {
709
+ p.stopPropagation(), t.onToggle(s);
633
710
  }), r.appendChild(l);
634
711
  const d = document.createElement("span");
635
- d.className = "pivot-label", d.textContent = String(i.__pivotLabel ?? ""), r.appendChild(d);
712
+ d.className = "pivot-label", d.textContent = String(o.__pivotLabel ?? ""), r.appendChild(d);
636
713
  const c = document.createElement("span");
637
- c.className = "pivot-count", c.textContent = ` (${Number(i.__pivotRowCount) || 0})`, r.appendChild(c);
714
+ c.className = "pivot-count", c.textContent = ` (${Number(o.__pivotRowCount) || 0})`, r.appendChild(c);
638
715
  } else {
639
- const s = i[o.field];
640
- r.textContent = s != null ? String(s) : "";
716
+ const a = o[i.field];
717
+ r.textContent = a != null ? String(a) : "";
641
718
  }
642
719
  e.appendChild(r);
643
720
  }), !0;
644
721
  }
645
- function W(i, e, t) {
646
- return e.className = "pivot-leaf-row", e.setAttribute("data-pivot-depth", String(i.__pivotDepth ?? 0)), e.setAttribute("data-pivot-key", String(i.__pivotRowKey ?? "")), e.innerHTML = "", t.forEach((o, n) => {
647
- const r = document.createElement("div");
648
- if (r.className = "cell", r.setAttribute("data-col", String(n)), r.setAttribute("role", "gridcell"), n === 0) {
649
- const s = Number(i.__pivotIndent) || 0;
650
- r.style.paddingLeft = `${s + 20}px`;
651
- const a = document.createElement("span");
652
- a.className = "pivot-label", a.textContent = String(i.__pivotLabel ?? ""), r.appendChild(a);
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) => {
724
+ 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;
727
+ a.style.paddingLeft = `${s + 20}px`;
728
+ const l = document.createElement("span");
729
+ l.className = "pivot-label", l.textContent = String(o.__pivotLabel ?? ""), a.appendChild(l);
653
730
  } else {
654
- const s = i[o.field];
655
- r.textContent = s != null ? String(s) : "";
731
+ const s = o[n.field];
732
+ a.textContent = s != null ? String(s) : "";
656
733
  }
657
- e.appendChild(r);
734
+ e.appendChild(a);
658
735
  }), !0;
659
736
  }
660
- function J(i, e, t) {
661
- return e.className = "pivot-grand-total-row", e.setAttribute("role", "presentation"), e.innerHTML = "", t.forEach((o, n) => {
737
+ function J(o, e, t) {
738
+ return e.className = "pivot-grand-total-row", e.setAttribute("role", "presentation"), e.innerHTML = "", t.forEach((i, n) => {
662
739
  const r = document.createElement("div");
663
740
  if (r.className = "cell", r.setAttribute("data-col", String(n)), n === 0) {
664
- const s = document.createElement("span");
665
- s.className = "pivot-label", s.textContent = "Grand Total", r.appendChild(s);
741
+ const a = document.createElement("span");
742
+ a.className = "pivot-label", a.textContent = "Grand Total", r.appendChild(a);
666
743
  } else {
667
- const s = i[o.field];
668
- r.textContent = s != null ? String(s) : "";
744
+ const a = o[i.field];
745
+ r.textContent = a != null ? String(a) : "";
669
746
  }
670
747
  e.appendChild(r);
671
748
  }), !0;
672
749
  }
673
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}}';
674
- class b extends P {
751
+ class v extends P {
675
752
  name = "pivot";
676
- version = "1.0.0";
753
+ styles = Q;
677
754
  /** Tool panel ID for shell integration */
678
755
  static PANEL_ID = "pivot";
679
756
  get defaultConfig() {
@@ -704,17 +781,11 @@ class b extends P {
704
781
  return (this.config.valueFields?.length ?? 0) > 0;
705
782
  }
706
783
  /**
707
- * Get animation style respecting grid-level animation mode.
784
+ * Get expand/collapse animation style from plugin config.
785
+ * Uses base class isAnimationEnabled to respect grid-level settings.
708
786
  */
709
787
  get animationStyle() {
710
- const t = this.grid.effectiveConfig?.animation?.mode ?? "reduced-motion";
711
- if (t === !1 || t === "off") return !1;
712
- if (t !== !0 && t !== "on") {
713
- const o = this.shadowRoot?.host;
714
- if (o && getComputedStyle(o).getPropertyValue("--tbw-animation-enabled").trim() === "0")
715
- return !1;
716
- }
717
- return this.config.animation ?? "slide";
788
+ return this.isAnimationEnabled ? this.config.animation ?? "slide" : !1;
718
789
  }
719
790
  // #endregion
720
791
  // #region Lifecycle
@@ -726,7 +797,7 @@ class b extends P {
726
797
  getToolPanel() {
727
798
  if ((this.config?.showToolPanel ?? this.userConfig?.showToolPanel ?? !0) !== !1)
728
799
  return {
729
- id: b.PANEL_ID,
800
+ id: v.PANEL_ID,
730
801
  title: "Pivot",
731
802
  icon: "⊞",
732
803
  tooltip: "Configure pivot table",
@@ -742,55 +813,46 @@ class b extends P {
742
813
  const t = S(this.config);
743
814
  if (t.length > 0)
744
815
  return this.warn(`Config errors: ${t.join(", ")}`), [...e];
745
- if (this.buildFieldHeaderMap(), this.defaultExpanded = this.config.defaultExpanded ?? !0, this.expandedKeys.size === 0 && this.defaultExpanded && this.pivotResult) {
746
- const s = w(this.pivotResult.rows);
747
- for (const a of s)
748
- this.expandedKeys.add(a);
749
- }
750
- if (this.pivotResult = I(e, this.config), this.expandedKeys.size === 0 && this.defaultExpanded) {
751
- const s = w(this.pivotResult.rows);
752
- for (const a of s)
753
- this.expandedKeys.add(a);
754
- }
755
- const o = this.config.indentWidth ?? 20, n = H(
816
+ 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(
756
818
  this.pivotResult.rows,
757
819
  this.expandedKeys,
758
820
  this.defaultExpanded
759
- ).map((s) => ({
760
- __pivotRowKey: s.rowKey,
761
- __pivotLabel: s.rowLabel,
762
- __pivotDepth: s.depth,
763
- __pivotIsGroup: s.isGroup,
764
- __pivotHasChildren: !!s.children?.length,
765
- __pivotExpanded: this.expandedKeys.has(s.rowKey),
766
- __pivotRowCount: s.rowCount ?? 0,
767
- __pivotIndent: s.depth * o,
768
- __pivotTotal: s.total,
769
- ...s.values
821
+ ).map((a) => ({
822
+ __pivotRowKey: a.rowKey,
823
+ __pivotLabel: a.rowLabel,
824
+ __pivotDepth: a.depth,
825
+ __pivotIsGroup: a.isGroup,
826
+ __pivotHasChildren: !!a.children?.length,
827
+ __pivotExpanded: this.expandedKeys.has(a.rowKey),
828
+ __pivotRowCount: a.rowCount ?? 0,
829
+ __pivotIndent: a.depth * i,
830
+ __pivotTotal: a.total,
831
+ ...a.values
770
832
  }));
771
833
  this.keysToAnimate.clear();
772
834
  const r = /* @__PURE__ */ new Set();
773
- for (const s of n) {
774
- const a = s.__pivotRowKey;
775
- r.add(a), !this.previousVisibleKeys.has(a) && s.__pivotDepth > 0 && this.keysToAnimate.add(a);
835
+ for (const a of n) {
836
+ const s = a.__pivotRowKey;
837
+ r.add(s), !this.previousVisibleKeys.has(s) && a.__pivotDepth > 0 && this.keysToAnimate.add(s);
776
838
  }
777
839
  return this.previousVisibleKeys = r, n;
778
840
  }
779
841
  processColumns(e) {
780
842
  if (!this.isActive || !this.pivotResult)
781
843
  return [...e];
782
- const t = [], o = (this.config.rowGroupFields ?? []).map((n) => this.fieldHeaderMap.get(n) ?? n).join(" / ");
844
+ const t = [], i = (this.config.rowGroupFields ?? []).map((n) => this.fieldHeaderMap.get(n) ?? n).join(" / ");
783
845
  t.push({
784
846
  field: "__pivotLabel",
785
- header: o || "Group",
847
+ header: i || "Group",
786
848
  width: 200
787
849
  });
788
850
  for (const n of this.pivotResult.columnKeys)
789
851
  for (const r of this.config.valueFields ?? []) {
790
- const s = C([n], r.field), a = r.header || this.fieldHeaderMap.get(r.field) || r.field;
852
+ const a = x([n], r.field), s = r.header || this.fieldHeaderMap.get(r.field) || r.field;
791
853
  t.push({
792
- field: s,
793
- header: `${n} - ${a} (${r.aggFunc})`,
854
+ field: a,
855
+ header: `${n} - ${s} (${r.aggFunc})`,
794
856
  width: 120,
795
857
  type: "number"
796
858
  });
@@ -802,14 +864,15 @@ class b extends P {
802
864
  type: "number"
803
865
  }), t;
804
866
  }
805
- renderRow(e, t) {
806
- const o = e;
807
- return o.__pivotRowKey && o.__pivotHasChildren ? B(o, t, {
867
+ renderRow(e, t, i) {
868
+ const n = e;
869
+ return n.__pivotRowKey && n.__pivotHasChildren ? U(n, t, {
808
870
  columns: this.gridColumns,
809
- onToggle: (n) => this.toggle(n),
810
- resolveIcon: (n) => this.resolveIcon(n),
811
- setIcon: (n, r) => this.setIcon(n, r)
812
- }) : o.__pivotRowKey !== void 0 && this.isActive ? W(o, t, this.gridColumns) : (this.cleanupPivotStyling(t), !1);
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);
813
876
  }
814
877
  /**
815
878
  * Remove pivot-specific classes, attributes, and inline styles from a row element.
@@ -819,16 +882,22 @@ class b extends P {
819
882
  cleanupPivotStyling(e) {
820
883
  (e.classList.contains("pivot-group-row") || e.classList.contains("pivot-leaf-row") || e.classList.contains("pivot-grand-total-row")) && (e.classList.remove("pivot-group-row", "pivot-leaf-row", "pivot-grand-total-row"), e.classList.add("data-grid-row"), e.removeAttribute("data-pivot-depth"), e.innerHTML = "");
821
884
  }
885
+ onKeyDown(e) {
886
+ 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;
890
+ }
822
891
  afterRender() {
823
892
  this.isActive && this.config.showGrandTotal && this.pivotResult ? this.renderGrandTotalFooter() : this.cleanupGrandTotalFooter();
824
893
  const e = this.animationStyle;
825
894
  if (e === !1 || this.keysToAnimate.size === 0) return;
826
895
  const t = this.shadowRoot?.querySelector(".rows");
827
896
  if (!t) return;
828
- const o = e === "fade" ? "tbw-pivot-fade-in" : "tbw-pivot-slide-in";
897
+ const i = e === "fade" ? "tbw-pivot-fade-in" : "tbw-pivot-slide-in";
829
898
  for (const n of t.querySelectorAll(".pivot-group-row, .pivot-leaf-row")) {
830
899
  const r = n.dataset.pivotKey;
831
- r && this.keysToAnimate.has(r) && (n.classList.add(o), n.addEventListener("animationend", () => n.classList.remove(o), { once: !0 }));
900
+ r && this.keysToAnimate.has(r) && (n.classList.add(i), n.addEventListener("animationend", () => n.classList.remove(i), { once: !0 }));
832
901
  }
833
902
  this.keysToAnimate.clear();
834
903
  }
@@ -842,14 +911,14 @@ class b extends P {
842
911
  const t = e.querySelector(".tbw-scroll-area") ?? e.querySelector(".tbw-grid-content") ?? e.children[0];
843
912
  if (!t) return;
844
913
  this.grandTotalFooter || (this.grandTotalFooter = document.createElement("div"), this.grandTotalFooter.className = "pivot-grand-total-footer", t.appendChild(this.grandTotalFooter));
845
- const o = {
914
+ const i = {
846
915
  __pivotRowKey: "__grandTotal",
847
916
  __pivotLabel: "Grand Total",
848
917
  __pivotIsGrandTotal: !0,
849
918
  __pivotTotal: this.pivotResult.grandTotal,
850
919
  ...this.pivotResult.totals
851
920
  };
852
- J(o, this.grandTotalFooter, this.gridColumns);
921
+ J(i, this.grandTotalFooter, this.gridColumns);
853
922
  }
854
923
  /**
855
924
  * Remove the grand total footer element.
@@ -869,16 +938,20 @@ class b extends P {
869
938
  this.expandedKeys.delete(e), this.requestRender();
870
939
  }
871
940
  expandAll() {
872
- if (this.pivotResult) {
873
- const e = w(this.pivotResult.rows);
874
- for (const t of e)
875
- this.expandedKeys.add(t);
876
- this.requestRender();
877
- }
941
+ this.expandAllKeys(), this.requestRender();
878
942
  }
879
943
  collapseAll() {
880
944
  this.expandedKeys.clear(), this.requestRender();
881
945
  }
946
+ /**
947
+ * Add all group keys from the current pivot result to expandedKeys.
948
+ */
949
+ expandAllKeys() {
950
+ if (!this.pivotResult) return;
951
+ const e = H(this.pivotResult.rows);
952
+ for (const t of e)
953
+ this.expandedKeys.add(t);
954
+ }
882
955
  isExpanded(e) {
883
956
  return this.expandedKeys.has(e);
884
957
  }
@@ -910,23 +983,42 @@ class b extends P {
910
983
  }
911
984
  // #endregion
912
985
  // #region Tool Panel API
986
+ /**
987
+ * Show the pivot tool panel.
988
+ * Opens the tool panel and ensures this section is expanded.
989
+ */
913
990
  showPanel() {
914
- this.grid.openToolPanel(b.PANEL_ID);
991
+ this.grid.openToolPanel(), this.grid.expandedToolPanelSections.includes(v.PANEL_ID) || this.grid.toggleToolPanelSection(v.PANEL_ID);
915
992
  }
993
+ /**
994
+ * Hide the tool panel.
995
+ */
916
996
  hidePanel() {
917
997
  this.grid.closeToolPanel();
918
998
  }
999
+ /**
1000
+ * Toggle the pivot tool panel section.
1001
+ */
919
1002
  togglePanel() {
920
- this.grid.toggleToolPanel(b.PANEL_ID);
1003
+ this.grid.isToolPanelOpen || this.grid.openToolPanel(), this.grid.toggleToolPanelSection(v.PANEL_ID);
921
1004
  }
1005
+ /**
1006
+ * Check if the pivot panel section is currently expanded.
1007
+ */
922
1008
  isPanelVisible() {
923
- return this.grid.activeToolPanel === b.PANEL_ID;
1009
+ return this.grid.isToolPanelOpen && this.grid.expandedToolPanelSections.includes(v.PANEL_ID);
924
1010
  }
925
1011
  // #endregion
926
1012
  // #region Private Helpers
927
1013
  get gridColumns() {
928
1014
  return this.grid.columns ?? [];
929
1015
  }
1016
+ /**
1017
+ * Refresh pivot and update tool panel if active.
1018
+ */
1019
+ refreshIfActive() {
1020
+ this.isActive && this.refresh(), this.refreshPanel();
1021
+ }
930
1022
  buildFieldHeaderMap() {
931
1023
  const e = this.getAvailableFields();
932
1024
  this.fieldHeaderMap.clear();
@@ -937,12 +1029,11 @@ class b extends P {
937
1029
  return this.originalColumns.length > 0 ? this.originalColumns : this.captureOriginalColumns();
938
1030
  }
939
1031
  captureOriginalColumns() {
940
- const e = this.grid;
941
1032
  try {
942
- const t = e.getAllColumns?.() ?? e.columns ?? [];
943
- return this.originalColumns = t.filter((o) => !o.field.startsWith("__pivot")).map((o) => ({
944
- field: o.field,
945
- header: o.header ?? o.field
1033
+ const e = this.grid.getAllColumns?.() ?? this.grid.columns ?? [];
1034
+ return this.originalColumns = e.filter((t) => !t.field.startsWith("__pivot")).map((t) => ({
1035
+ field: t.field,
1036
+ header: t.header ?? t.field
946
1037
  })), this.originalColumns;
947
1038
  } catch {
948
1039
  return [];
@@ -951,16 +1042,16 @@ class b extends P {
951
1042
  renderPanel(e) {
952
1043
  this.panelContainer = e, this.originalColumns.length === 0 && this.captureOriginalColumns();
953
1044
  const t = {
954
- onTogglePivot: (o) => {
955
- o ? this.enablePivot() : this.disablePivot(), this.refreshPanel();
1045
+ onTogglePivot: (i) => {
1046
+ i ? this.enablePivot() : this.disablePivot(), this.refreshPanel();
956
1047
  },
957
- onAddFieldToZone: (o, n) => this.addFieldToZone(o, n),
958
- onRemoveFieldFromZone: (o, n) => this.removeFieldFromZone(o, n),
959
- onAddValueField: (o, n) => this.addValueField(o, n),
960
- onRemoveValueField: (o) => this.removeValueField(o),
961
- onUpdateValueAggFunc: (o, n) => this.updateValueAggFunc(o, n),
962
- onOptionChange: (o, n) => {
963
- this.config[o] = n, this.isActive && this.refresh();
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();
964
1055
  },
965
1056
  getAvailableFields: () => this.getAvailableFields()
966
1057
  };
@@ -971,37 +1062,34 @@ class b extends P {
971
1062
  }
972
1063
  addFieldToZone(e, t) {
973
1064
  if (t === "rowGroups") {
974
- const o = this.config.rowGroupFields ?? [];
975
- o.includes(e) || (this.config.rowGroupFields = [...o, e]);
1065
+ const i = this.config.rowGroupFields ?? [];
1066
+ i.includes(e) || (this.config.rowGroupFields = [...i, e]);
976
1067
  } else {
977
- const o = this.config.columnGroupFields ?? [];
978
- o.includes(e) || (this.config.columnGroupFields = [...o, e]);
1068
+ const i = this.config.columnGroupFields ?? [];
1069
+ i.includes(e) || (this.config.columnGroupFields = [...i, e]);
979
1070
  }
980
- this.removeFromOtherZones(e, t), this.isActive && this.refresh(), this.refreshPanel();
1071
+ this.removeFromOtherZones(e, t), this.refreshIfActive();
981
1072
  }
982
1073
  removeFieldFromZone(e, t) {
983
- t === "rowGroups" ? this.config.rowGroupFields = (this.config.rowGroupFields ?? []).filter((o) => o !== e) : this.config.columnGroupFields = (this.config.columnGroupFields ?? []).filter((o) => o !== e), this.isActive && this.refresh(), this.refreshPanel();
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();
984
1075
  }
985
1076
  removeFromOtherZones(e, t) {
986
- 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));
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));
987
1078
  }
988
1079
  addValueField(e, t) {
989
- const o = this.config.valueFields ?? [];
990
- o.some((n) => n.field === e) || (this.config.valueFields = [...o, { field: e, aggFunc: t }]), this.removeFromOtherZones(e, "values"), this.isActive && this.refresh(), this.refreshPanel();
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();
991
1082
  }
992
1083
  removeValueField(e) {
993
- this.config.valueFields = (this.config.valueFields ?? []).filter((t) => t.field !== e), this.isActive && this.refresh(), this.refreshPanel();
1084
+ this.config.valueFields = (this.config.valueFields ?? []).filter((t) => t.field !== e), this.refreshIfActive();
994
1085
  }
995
1086
  updateValueAggFunc(e, t) {
996
- const o = this.config.valueFields ?? [], n = o.findIndex((r) => r.field === e);
997
- n >= 0 && (o[n] = { ...o[n], aggFunc: t }, this.config.valueFields = [...o]), this.isActive && this.refresh();
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();
998
1089
  }
999
1090
  // #endregion
1000
- // #region Styles
1001
- styles = Q;
1002
- // #endregion
1003
1091
  }
1004
1092
  export {
1005
- b as PivotPlugin
1093
+ v as PivotPlugin
1006
1094
  };
1007
1095
  //# sourceMappingURL=index.js.map