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