@toolbox-web/grid 1.6.0 → 1.6.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.
- package/all.js +561 -471
- package/all.js.map +1 -1
- package/index.js +3 -3
- package/index.js.map +1 -1
- package/lib/plugins/context-menu/ContextMenuPlugin.d.ts +11 -0
- package/lib/plugins/context-menu/ContextMenuPlugin.d.ts.map +1 -1
- package/lib/plugins/context-menu/index.js +136 -77
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -1
- package/lib/plugins/filtering/index.js +246 -250
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/multi-sort/index.js +11 -11
- package/lib/plugins/pivot/PivotPlugin.d.ts +2 -0
- package/lib/plugins/pivot/PivotPlugin.d.ts.map +1 -1
- package/lib/plugins/pivot/index.js +29 -27
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/print/index.js +1 -1
- package/lib/plugins/print/index.js.map +1 -1
- package/lib/plugins/row-reorder/RowReorderPlugin.d.ts +18 -0
- package/lib/plugins/row-reorder/RowReorderPlugin.d.ts.map +1 -1
- package/lib/plugins/row-reorder/index.js +132 -72
- package/lib/plugins/row-reorder/index.js.map +1 -1
- package/lib/plugins/selection/index.js +1 -1
- package/lib/plugins/visibility/index.js +7 -7
- package/package.json +1 -1
- package/themes/dg-theme-bootstrap.css +60 -33
- package/themes/dg-theme-material.css +83 -52
- package/themes/dg-theme-standard.css +80 -12
- package/themes/dg-theme-vibrant.css +78 -9
- package/umd/grid.all.umd.js +17 -17
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +1 -1
- package/umd/grid.umd.js.map +1 -1
- package/umd/plugins/context-menu.umd.js +1 -1
- package/umd/plugins/context-menu.umd.js.map +1 -1
- package/umd/plugins/filtering.umd.js +1 -1
- package/umd/plugins/filtering.umd.js.map +1 -1
- package/umd/plugins/multi-sort.umd.js +1 -1
- package/umd/plugins/multi-sort.umd.js.map +1 -1
- package/umd/plugins/pivot.umd.js +1 -1
- package/umd/plugins/pivot.umd.js.map +1 -1
- package/umd/plugins/print.umd.js +1 -1
- package/umd/plugins/print.umd.js.map +1 -1
- package/umd/plugins/row-reorder.umd.js +1 -1
- package/umd/plugins/row-reorder.umd.js.map +1 -1
- package/umd/plugins/selection.umd.js +1 -1
- package/umd/plugins/selection.umd.js.map +1 -1
- package/umd/plugins/visibility.umd.js +1 -1
- package/umd/plugins/visibility.umd.js.map +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const h = '<svg viewBox="0 0 16 16" width="12" height="12"><path fill="currentColor" d="M6 10.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5z"/></svg>',
|
|
1
|
+
const h = '<svg viewBox="0 0 16 16" width="12" height="12"><path fill="currentColor" d="M6 10.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5z"/></svg>', x = {
|
|
2
2
|
expand: "▶",
|
|
3
3
|
collapse: "▼",
|
|
4
4
|
sortAsc: "▲",
|
|
@@ -235,7 +235,7 @@ class C {
|
|
|
235
235
|
*/
|
|
236
236
|
get gridIcons() {
|
|
237
237
|
const t = this.grid?.gridConfig?.icons ?? {};
|
|
238
|
-
return { ...
|
|
238
|
+
return { ...x, ...t };
|
|
239
239
|
}
|
|
240
240
|
// #region Animation Helpers
|
|
241
241
|
/**
|
|
@@ -314,17 +314,17 @@ class C {
|
|
|
314
314
|
function S(r, t, e) {
|
|
315
315
|
return t.length ? [...r].sort((o, i) => {
|
|
316
316
|
for (const n of t) {
|
|
317
|
-
const d = e.find((c) => c.field === n.field)?.sortComparator ??
|
|
317
|
+
const d = e.find((c) => c.field === n.field)?.sortComparator ?? v, u = o[n.field], f = i[n.field], s = d(u, f, o, i);
|
|
318
318
|
if (s !== 0)
|
|
319
319
|
return n.direction === "asc" ? s : -s;
|
|
320
320
|
}
|
|
321
321
|
return 0;
|
|
322
322
|
}) : [...r];
|
|
323
323
|
}
|
|
324
|
-
function
|
|
324
|
+
function v(r, t) {
|
|
325
325
|
return r == null && t == null ? 0 : r == null ? 1 : t == null ? -1 : typeof r == "number" && typeof t == "number" ? r - t : r instanceof Date && t instanceof Date ? r.getTime() - t.getTime() : typeof r == "boolean" && typeof t == "boolean" ? r === t ? 0 : r ? -1 : 1 : String(r).localeCompare(String(t));
|
|
326
326
|
}
|
|
327
|
-
function
|
|
327
|
+
function w(r, t, e, o) {
|
|
328
328
|
const i = r.find((n) => n.field === t);
|
|
329
329
|
return e ? i ? i.direction === "asc" ? r.map((n) => n.field === t ? { ...n, direction: "desc" } : n) : r.filter((n) => n.field !== t) : r.length < o ? [...r, { field: t, direction: "asc" }] : r : i?.direction === "asc" ? [{ field: t, direction: "desc" }] : i?.direction === "desc" ? [] : [{ field: t, direction: "asc" }];
|
|
330
330
|
}
|
|
@@ -335,12 +335,12 @@ function m(r, t) {
|
|
|
335
335
|
function p(r, t) {
|
|
336
336
|
return r.find((e) => e.field === t)?.direction;
|
|
337
337
|
}
|
|
338
|
-
const
|
|
339
|
-
class
|
|
338
|
+
const y = '@layer tbw-plugins{.header-cell[data-sort=asc]:after{content:"↑";margin-left:var(--tbw-spacing-xs, .25em);opacity:.8}.header-cell[data-sort=desc]:after{content:"↓";margin-left:var(--tbw-spacing-xs, .25em);opacity:.8}.sort-indicator{margin-left:var(--tbw-spacing-xs, .25em);opacity:.8}.sort-index{font-size:var(--tbw-font-size-2xs, .7em);background:var(--tbw-multi-sort-badge-bg, var(--tbw-color-panel-bg));color:var(--tbw-multi-sort-badge-color, var(--tbw-color-fg));border-radius:50%;width:var(--tbw-multi-sort-badge-size, 1em);height:var(--tbw-multi-sort-badge-size, 1em);display:inline-flex;align-items:center;justify-content:center;margin-left:var(--tbw-spacing-xs, .125em);font-weight:600}}';
|
|
339
|
+
class M extends C {
|
|
340
340
|
/** @internal */
|
|
341
341
|
name = "multiSort";
|
|
342
342
|
/** @internal */
|
|
343
|
-
styles =
|
|
343
|
+
styles = y;
|
|
344
344
|
/** @internal */
|
|
345
345
|
get defaultConfig() {
|
|
346
346
|
return {
|
|
@@ -366,7 +366,7 @@ class v extends C {
|
|
|
366
366
|
onHeaderClick(t) {
|
|
367
367
|
if (!this.columns.find((n) => n.field === t.field)?.sortable) return !1;
|
|
368
368
|
const o = t.originalEvent.shiftKey, i = this.config.maxSortColumns ?? 3;
|
|
369
|
-
return this.sortModel =
|
|
369
|
+
return this.sortModel = w(this.sortModel, t.field, o, i), this.emit("sort-change", { sortModel: [...this.sortModel] }), this.requestRender(), !0;
|
|
370
370
|
}
|
|
371
371
|
/** @internal */
|
|
372
372
|
afterRender() {
|
|
@@ -381,7 +381,7 @@ class v extends C {
|
|
|
381
381
|
i.querySelector('[part~="sort-indicator"], .sort-indicator')?.remove(), i.setAttribute("data-sort", d);
|
|
382
382
|
const s = document.createElement("span");
|
|
383
383
|
s.className = "sort-indicator", this.setIcon(s, this.resolveIcon(d === "asc" ? "sortAsc" : "sortDesc"));
|
|
384
|
-
const c = i.querySelector(".tbw-filter-btn"),
|
|
384
|
+
const c = i.querySelector(".tbw-filter-btn"), b = i.querySelector(".resize-handle"), g = c ?? b;
|
|
385
385
|
if (g ? i.insertBefore(s, g) : i.appendChild(s), e && this.sortModel.length > 1 && a !== void 0) {
|
|
386
386
|
const l = document.createElement("span");
|
|
387
387
|
l.className = "sort-index", l.textContent = String(a), s.nextSibling ? i.insertBefore(l, s.nextSibling) : i.appendChild(l);
|
|
@@ -462,6 +462,6 @@ class v extends C {
|
|
|
462
462
|
// #endregion
|
|
463
463
|
}
|
|
464
464
|
export {
|
|
465
|
-
|
|
465
|
+
M as MultiSortPlugin
|
|
466
466
|
};
|
|
467
467
|
//# sourceMappingURL=index.js.map
|
|
@@ -96,6 +96,8 @@ export declare class PivotPlugin extends BaseGridPlugin<PivotConfig> {
|
|
|
96
96
|
private fieldHeaderMap;
|
|
97
97
|
private expandedKeys;
|
|
98
98
|
private defaultExpanded;
|
|
99
|
+
/** Tracks whether user has manually interacted with expand/collapse */
|
|
100
|
+
private userHasToggledExpand;
|
|
99
101
|
private originalColumns;
|
|
100
102
|
private panelContainer;
|
|
101
103
|
private grandTotalFooter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PivotPlugin.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/pivot/PivotPlugin.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAAiD,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAIlG,OAAO,KAAK,EAAoC,WAAW,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAK3G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8EG;AACH,qBAAa,WAAY,SAAQ,cAAc,CAAC,WAAW,CAAC;IAC1D,gBAAgB;IAChB,QAAQ,CAAC,IAAI,WAAW;IACxB,gBAAgB;IAChB,SAAkB,MAAM,SAAU;IAElC,0CAA0C;IAC1C,MAAM,CAAC,QAAQ,CAAC,QAAQ,WAAW;IAEnC,gBAAgB;IAChB,cAAuB,aAAa,IAAI,OAAO,CAA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ields?.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;
|
|
385
385
|
}
|
|
386
386
|
function C(i, e) {
|
|
387
387
|
return [...i, e].join("|");
|
|
388
388
|
}
|
|
389
|
-
function
|
|
390
|
-
const t = e.rowGroupFields ?? [], o = e.columnGroupFields ?? [], r = e.valueFields ?? [], n =
|
|
389
|
+
function K(i, e) {
|
|
390
|
+
const t = e.rowGroupFields ?? [], o = e.columnGroupFields ?? [], r = e.valueFields ?? [], n = z(i, o), a = G(
|
|
391
391
|
i,
|
|
392
392
|
t,
|
|
393
393
|
o,
|
|
@@ -397,7 +397,7 @@ function I(i, e) {
|
|
|
397
397
|
// starting depth
|
|
398
398
|
""
|
|
399
399
|
// parent key prefix
|
|
400
|
-
), s =
|
|
400
|
+
), s = H(a, n, r), l = Object.values(s).reduce((d, c) => d + c, 0);
|
|
401
401
|
return {
|
|
402
402
|
rows: a,
|
|
403
403
|
columnKeys: n,
|
|
@@ -405,7 +405,7 @@ function I(i, e) {
|
|
|
405
405
|
grandTotal: l
|
|
406
406
|
};
|
|
407
407
|
}
|
|
408
|
-
function
|
|
408
|
+
function z(i, e) {
|
|
409
409
|
if (e.length === 0) return ["value"];
|
|
410
410
|
const t = /* @__PURE__ */ new Set();
|
|
411
411
|
for (const o of i) {
|
|
@@ -414,7 +414,7 @@ function V(i, e) {
|
|
|
414
414
|
}
|
|
415
415
|
return [...t].sort();
|
|
416
416
|
}
|
|
417
|
-
function
|
|
417
|
+
function V(i, e) {
|
|
418
418
|
const t = /* @__PURE__ */ new Map();
|
|
419
419
|
for (const o of i) {
|
|
420
420
|
const r = String(o[e] ?? ""), n = t.get(r);
|
|
@@ -425,7 +425,7 @@ function z(i, e) {
|
|
|
425
425
|
function G(i, e, t, o, r, n, a) {
|
|
426
426
|
const s = [];
|
|
427
427
|
if (e.length === 0) {
|
|
428
|
-
const u =
|
|
428
|
+
const u = T(i, t, o, r), h = R(u);
|
|
429
429
|
return s.push({
|
|
430
430
|
rowKey: a || "all",
|
|
431
431
|
rowLabel: a || "All",
|
|
@@ -436,9 +436,9 @@ function G(i, e, t, o, r, n, a) {
|
|
|
436
436
|
rowCount: i.length
|
|
437
437
|
}), s;
|
|
438
438
|
}
|
|
439
|
-
const l = e[0], d = e.slice(1), c = d.length > 0, p =
|
|
439
|
+
const l = e[0], d = e.slice(1), c = d.length > 0, p = V(i, l);
|
|
440
440
|
for (const [u, h] of p) {
|
|
441
|
-
const y = a ? `${a}|${u}` : u, x =
|
|
441
|
+
const y = a ? `${a}|${u}` : u, x = T(h, t, o, r), L = R(x);
|
|
442
442
|
let F;
|
|
443
443
|
c && (F = G(
|
|
444
444
|
h,
|
|
@@ -461,7 +461,7 @@ function G(i, e, t, o, r, n, a) {
|
|
|
461
461
|
}
|
|
462
462
|
return s;
|
|
463
463
|
}
|
|
464
|
-
function
|
|
464
|
+
function T(i, e, t, o) {
|
|
465
465
|
const r = {};
|
|
466
466
|
for (const n of t)
|
|
467
467
|
for (const a of o) {
|
|
@@ -470,13 +470,13 @@ function R(i, e, t, o) {
|
|
|
470
470
|
}
|
|
471
471
|
return r;
|
|
472
472
|
}
|
|
473
|
-
function
|
|
473
|
+
function R(i) {
|
|
474
474
|
let e = 0;
|
|
475
475
|
for (const t of Object.values(i))
|
|
476
476
|
e += t ?? 0;
|
|
477
477
|
return e;
|
|
478
478
|
}
|
|
479
|
-
function
|
|
479
|
+
function H(i, e, t) {
|
|
480
480
|
const o = {};
|
|
481
481
|
function r(n) {
|
|
482
482
|
for (const a of n)
|
|
@@ -490,7 +490,7 @@ function D(i, e, t) {
|
|
|
490
490
|
}
|
|
491
491
|
return r(i), o;
|
|
492
492
|
}
|
|
493
|
-
function
|
|
493
|
+
function D(i, e, t = !0) {
|
|
494
494
|
const o = [];
|
|
495
495
|
function r(n) {
|
|
496
496
|
o.push(n);
|
|
@@ -503,7 +503,7 @@ function M(i, e, t = !0) {
|
|
|
503
503
|
r(n);
|
|
504
504
|
return o;
|
|
505
505
|
}
|
|
506
|
-
function
|
|
506
|
+
function M(i) {
|
|
507
507
|
const e = [];
|
|
508
508
|
function t(o) {
|
|
509
509
|
if (o.isGroup && e.push(o.rowKey), o.children)
|
|
@@ -514,7 +514,7 @@ function q(i) {
|
|
|
514
514
|
t(o);
|
|
515
515
|
return e;
|
|
516
516
|
}
|
|
517
|
-
const
|
|
517
|
+
const q = ["sum", "avg", "count", "min", "max", "first", "last"];
|
|
518
518
|
function O(i, e, t, o) {
|
|
519
519
|
const r = new AbortController(), n = { config: e, callbacks: o, signal: r.signal }, a = document.createElement("div");
|
|
520
520
|
return a.className = "tbw-pivot-panel", a.appendChild(b("Options", () => W(t, n))), a.appendChild(b("Row Groups", () => E("rowGroups", n))), a.appendChild(b("Column Groups", () => E("columnGroups", n))), a.appendChild(b("Values", () => $(n))), a.appendChild(b("Available Fields", () => U(n))), i.appendChild(a), () => {
|
|
@@ -628,7 +628,7 @@ function j(i, e) {
|
|
|
628
628
|
s.className = "tbw-pivot-chip-label", s.textContent = n?.header ?? i.field;
|
|
629
629
|
const l = document.createElement("select");
|
|
630
630
|
l.className = "tbw-pivot-agg-select", l.title = "Aggregation function";
|
|
631
|
-
for (const c of
|
|
631
|
+
for (const c of q) {
|
|
632
632
|
const p = document.createElement("option");
|
|
633
633
|
p.value = c, p.textContent = c.toUpperCase(), p.selected = c === i.aggFunc, l.appendChild(p);
|
|
634
634
|
}
|
|
@@ -766,7 +766,7 @@ function Q(i, e, t) {
|
|
|
766
766
|
e.appendChild(n);
|
|
767
767
|
}), !0;
|
|
768
768
|
}
|
|
769
|
-
const X = '@layer tbw-plugins{.pivot-group-row{display:grid;grid-template-columns:var(--tbw-column-template);font-weight:600;background:var(--tbw-pivot-group-bg, var(--tbw-color-row-alt));min-height:var(--tbw-row-height);border-bottom:var(--tbw-row-divider)}.pivot-group-row:hover{background:var(--tbw-pivot-group-hover, var(--tbw-color-row-hover))}.pivot-leaf-row{display:grid;grid-template-columns:var(--tbw-column-template);background:var(--tbw-pivot-leaf-bg, var(--tbw-color-bg));min-height:var(--tbw-row-height);border-bottom:var(--tbw-row-divider)}.pivot-grand-total-row{display:grid;grid-template-columns:var(--tbw-column-template);font-weight:700;background:var(--tbw-pivot-grand-total-bg, var(--tbw-color-header-bg));min-height:var(--tbw-row-height);border-top:2px solid var(--tbw-color-border-strong)}.pivot-grand-total-row>.cell{display:flex;align-items:center;padding:var(--tbw-cell-padding);border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0}.pivot-grand-total-row>.cell:last-child{border-right:0}.pivot-grand-total-footer{position:sticky;bottom:0;z-index:var(--tbw-z-layer-pinned-rows, 20);background:var(--tbw-pivot-grand-total-bg, var(--tbw-color-header-bg));min-width:fit-content}.pivot-group-row>.cell,.pivot-leaf-row>.cell{display:flex;align-items:center;padding:var(--tbw-cell-padding);border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0}.pivot-group-row>.cell:last-child,.pivot-leaf-row>.cell:last-child{border-right:0}.pivot-toggle{display:inline-flex;align-items:center;justify-content:center;width:
|
|
769
|
+
const X = '@layer tbw-plugins{.pivot-group-row{display:grid;grid-template-columns:var(--tbw-column-template);font-weight:600;background:var(--tbw-pivot-group-bg, var(--tbw-color-row-alt));min-height:var(--tbw-row-height);border-bottom:var(--tbw-row-divider)}.pivot-group-row:hover{background:var(--tbw-pivot-group-hover, var(--tbw-color-row-hover))}.pivot-leaf-row{display:grid;grid-template-columns:var(--tbw-column-template);background:var(--tbw-pivot-leaf-bg, var(--tbw-color-bg));min-height:var(--tbw-row-height);border-bottom:var(--tbw-row-divider)}.pivot-grand-total-row{display:grid;grid-template-columns:var(--tbw-column-template);font-weight:700;background:var(--tbw-pivot-grand-total-bg, var(--tbw-color-header-bg));min-height:var(--tbw-row-height);border-top:2px solid var(--tbw-color-border-strong)}.pivot-grand-total-row>.cell{display:flex;align-items:center;padding:var(--tbw-cell-padding);border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0}.pivot-grand-total-row>.cell:last-child{border-right:0}.pivot-grand-total-footer{position:sticky;bottom:0;z-index:var(--tbw-z-layer-pinned-rows, 20);background:var(--tbw-pivot-grand-total-bg, var(--tbw-color-header-bg));min-width:fit-content}.pivot-group-row>.cell,.pivot-leaf-row>.cell{display:flex;align-items:center;padding:var(--tbw-cell-padding);border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0}.pivot-group-row>.cell:last-child,.pivot-leaf-row>.cell:last-child{border-right:0}.pivot-toggle{display:inline-flex;align-items:center;justify-content:center;width:var(--tbw-pivot-toggle-size, var(--tbw-toggle-size, 1.25em));height:var(--tbw-pivot-toggle-size, var(--tbw-toggle-size, 1.25em));margin-right:var(--tbw-spacing-sm, .375em);border:none;background:transparent;cursor:pointer;color:var(--tbw-pivot-toggle-color, var(--tbw-color-fg-muted));border-radius:var(--tbw-border-radius);transition:background var(--tbw-transition-duration, .12s) var(--tbw-transition-ease, ease),color var(--tbw-transition-duration, .12s) var(--tbw-transition-ease, ease)}.pivot-toggle:hover{background:var(--tbw-pivot-toggle-hover-bg, var(--tbw-color-row-hover));color:var(--tbw-pivot-toggle-hover-color, var(--tbw-color-fg))}.pivot-toggle:focus{outline:var(--tbw-focus-outline);outline-offset:var(--tbw-focus-outline-offset)}.pivot-label{font-weight:inherit}.pivot-count{color:var(--tbw-pivot-count-color, var(--tbw-color-fg-muted));font-size:.9em;font-weight:400}.pivot-total-row{font-weight:700;border-top:2px solid var(--tbw-pivot-border, var(--tbw-color-border-strong))}[data-pivot-depth="1"]{--tbw-pivot-depth: 1}[data-pivot-depth="2"]{--tbw-pivot-depth: 2}[data-pivot-depth="3"]{--tbw-pivot-depth: 3}[data-pivot-depth="4"]{--tbw-pivot-depth: 4}.tbw-pivot-panel{display:flex;flex-direction:column;gap:var(--tbw-panel-padding, var(--tbw-spacing-lg, .75rem));padding:var(--tbw-panel-padding, var(--tbw-spacing-lg, .75rem));height:100%;overflow-y:auto;font-size:var(--tbw-font-size-sm, .8125rem)}.tbw-pivot-section{border:1px solid var(--tbw-pivot-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius);background:var(--tbw-pivot-section-bg, var(--tbw-color-bg))}.tbw-pivot-section-header{padding:var(--tbw-button-padding, var(--tbw-spacing-md, .5rem) var(--tbw-spacing-lg, .75rem));font-weight:600;background:var(--tbw-pivot-header-bg, var(--tbw-color-header-bg));border-bottom:1px solid var(--tbw-pivot-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius) var(--tbw-border-radius) 0 0}.tbw-pivot-section-content{padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.tbw-pivot-toggle-wrapper{display:flex;align-items:center}.tbw-pivot-toggle-label{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));cursor:pointer}.tbw-pivot-toggle-label input{width:var(--tbw-icon-size, 1rem);height:var(--tbw-icon-size, 1rem);cursor:pointer}.tbw-pivot-drop-zone{min-height:60px;padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));border:2px dashed var(--tbw-pivot-drop-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius);background:var(--tbw-pivot-drop-bg, var(--tbw-color-row-alt));display:flex;flex-wrap:wrap;gap:var(--tbw-spacing-sm, .375rem);align-content:flex-start;transition:all .15s ease}.tbw-pivot-drop-zone.drag-over{border-color:var(--tbw-color-accent);background:var(--tbw-pivot-drop-active, var(--tbw-focus-background))}.tbw-pivot-placeholder{color:var(--tbw-color-fg-muted);font-style:italic;padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));text-align:center;width:100%}.tbw-pivot-field-chip{display:inline-flex;align-items:center;gap:var(--tbw-spacing-sm, .375rem);padding:var(--tbw-button-padding-sm, var(--tbw-spacing-xs, .25rem) var(--tbw-spacing-md, .5rem));background:var(--tbw-pivot-chip-bg, var(--tbw-color-header-bg));border:1px solid var(--tbw-pivot-chip-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius);cursor:grab;font-size:var(--tbw-font-size-xs, .75rem);transition:all .15s ease}.tbw-pivot-field-chip:hover{background:var(--tbw-pivot-chip-hover, var(--tbw-color-row-hover));border-color:var(--tbw-color-accent)}.tbw-pivot-field-chip.available{background:var(--tbw-color-bg)}.tbw-pivot-field-chip.dragging{opacity:.5;cursor:grabbing}.tbw-pivot-chip-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:120px}.tbw-pivot-chip-remove{display:flex;align-items:center;justify-content:center;width:var(--tbw-icon-size, 1rem);height:var(--tbw-icon-size, 1rem);padding:0;border:none;background:transparent;color:var(--tbw-color-fg-muted);font-size:var(--tbw-font-size-sm, .875rem);font-weight:700;cursor:pointer;border-radius:50%;transition:all .15s ease}.tbw-pivot-chip-remove:hover{background:var(--tbw-pivot-chip-remove-hover-bg, var(--tbw-color-accent));color:var(--tbw-pivot-chip-remove-hover-fg, var(--tbw-color-accent-fg))}.tbw-pivot-value-chip{padding:var(--tbw-button-padding-sm, var(--tbw-spacing-xs, .25rem) var(--tbw-spacing-md, .5rem))}.tbw-pivot-value-label-wrapper{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));flex:1;min-width:0}.tbw-pivot-agg-select{padding:var(--tbw-spacing-xs, .125rem) var(--tbw-spacing-xs, .25rem);font-size:var(--tbw-font-size-xs, .6875rem);border:1px solid var(--tbw-color-border);border-radius:var(--tbw-border-radius);background:var(--tbw-color-bg);cursor:pointer}.tbw-pivot-available-fields{display:flex;flex-wrap:wrap;gap:var(--tbw-spacing-sm, .375rem);min-height:40px}.tbw-pivot-options{display:flex;flex-direction:column;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.tbw-pivot-checkbox{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));cursor:pointer}.tbw-pivot-checkbox input{width:var(--tbw-icon-size-sm, .875rem);height:var(--tbw-icon-size-sm, .875rem);cursor:pointer}.pivot-group-row.tbw-pivot-slide-in,.pivot-leaf-row.tbw-pivot-slide-in{animation:tbw-pivot-slide-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-pivot-slide-in{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}.pivot-group-row.tbw-pivot-fade-in,.pivot-leaf-row.tbw-pivot-fade-in{animation:tbw-pivot-fade-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-pivot-fade-in{0%{opacity:0}to{opacity:1}}}';
|
|
770
770
|
class v extends k {
|
|
771
771
|
/** @internal */
|
|
772
772
|
name = "pivot";
|
|
@@ -791,6 +791,8 @@ class v extends k {
|
|
|
791
791
|
fieldHeaderMap = /* @__PURE__ */ new Map();
|
|
792
792
|
expandedKeys = /* @__PURE__ */ new Set();
|
|
793
793
|
defaultExpanded = !0;
|
|
794
|
+
/** Tracks whether user has manually interacted with expand/collapse */
|
|
795
|
+
userHasToggledExpand = !1;
|
|
794
796
|
originalColumns = [];
|
|
795
797
|
panelContainer = null;
|
|
796
798
|
grandTotalFooter = null;
|
|
@@ -813,7 +815,7 @@ class v extends k {
|
|
|
813
815
|
// #region Lifecycle
|
|
814
816
|
/** @internal */
|
|
815
817
|
detach() {
|
|
816
|
-
this.isActive = !1, this.hasInitialized = !1, this.pivotResult = null, this.fieldHeaderMap.clear(), this.originalColumns = [], this.panelContainer = null, this.cleanupGrandTotalFooter(), this.previousVisibleKeys.clear(), this.keysToAnimate.clear();
|
|
818
|
+
this.isActive = !1, this.hasInitialized = !1, this.pivotResult = null, this.fieldHeaderMap.clear(), this.originalColumns = [], this.panelContainer = null, this.cleanupGrandTotalFooter(), this.previousVisibleKeys.clear(), this.keysToAnimate.clear(), this.userHasToggledExpand = !1;
|
|
817
819
|
}
|
|
818
820
|
// #endregion
|
|
819
821
|
// #region Shell Integration
|
|
@@ -835,11 +837,11 @@ class v extends k {
|
|
|
835
837
|
processRows(e) {
|
|
836
838
|
if (!this.hasInitialized && this.config.active !== !1 && this.hasValidPivotConfig() && (this.hasInitialized = !0, this.isActive = !0), !this.isActive)
|
|
837
839
|
return [...e];
|
|
838
|
-
const t =
|
|
840
|
+
const t = I(this.config);
|
|
839
841
|
if (t.length > 0)
|
|
840
842
|
return this.warn(`Config errors: ${t.join(", ")}`), [...e];
|
|
841
|
-
this.buildFieldHeaderMap(), this.defaultExpanded = this.config.defaultExpanded ?? !0, this.
|
|
842
|
-
const o = this.config.indentWidth ?? 20, r =
|
|
843
|
+
this.buildFieldHeaderMap(), this.defaultExpanded = this.config.defaultExpanded ?? !0, this.pivotResult = K(e, this.config), this.expandedKeys.size === 0 && this.defaultExpanded && !this.userHasToggledExpand && this.expandAllKeys();
|
|
844
|
+
const o = this.config.indentWidth ?? 20, r = D(
|
|
843
845
|
this.pivotResult.rows,
|
|
844
846
|
this.expandedKeys,
|
|
845
847
|
this.defaultExpanded
|
|
@@ -958,26 +960,26 @@ class v extends k {
|
|
|
958
960
|
// #endregion
|
|
959
961
|
// #region Expand/Collapse API
|
|
960
962
|
toggle(e) {
|
|
961
|
-
this.expandedKeys.has(e) ? this.expandedKeys.delete(e) : this.expandedKeys.add(e), this.requestRender();
|
|
963
|
+
this.userHasToggledExpand = !0, this.expandedKeys.has(e) ? this.expandedKeys.delete(e) : this.expandedKeys.add(e), this.requestRender();
|
|
962
964
|
}
|
|
963
965
|
expand(e) {
|
|
964
|
-
this.expandedKeys.add(e), this.requestRender();
|
|
966
|
+
this.userHasToggledExpand = !0, this.expandedKeys.add(e), this.requestRender();
|
|
965
967
|
}
|
|
966
968
|
collapse(e) {
|
|
967
|
-
this.expandedKeys.delete(e), this.requestRender();
|
|
969
|
+
this.userHasToggledExpand = !0, this.expandedKeys.delete(e), this.requestRender();
|
|
968
970
|
}
|
|
969
971
|
expandAll() {
|
|
970
|
-
this.expandAllKeys(), this.requestRender();
|
|
972
|
+
this.userHasToggledExpand = !0, this.expandAllKeys(), this.requestRender();
|
|
971
973
|
}
|
|
972
974
|
collapseAll() {
|
|
973
|
-
this.expandedKeys.clear(), this.requestRender();
|
|
975
|
+
this.userHasToggledExpand = !0, this.expandedKeys.clear(), this.requestRender();
|
|
974
976
|
}
|
|
975
977
|
/**
|
|
976
978
|
* Add all group keys from the current pivot result to expandedKeys.
|
|
977
979
|
*/
|
|
978
980
|
expandAllKeys() {
|
|
979
981
|
if (!this.pivotResult) return;
|
|
980
|
-
const e =
|
|
982
|
+
const e = M(this.pivotResult.rows);
|
|
981
983
|
for (const t of e)
|
|
982
984
|
this.expandedKeys.add(t);
|
|
983
985
|
}
|