@toolbox-web/grid 1.11.0 → 1.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/all.js +1224 -1110
- package/all.js.map +1 -1
- package/index.js +2000 -1700
- package/index.js.map +1 -1
- package/lib/core/grid.d.ts +21 -1
- package/lib/core/grid.d.ts.map +1 -1
- package/lib/core/internal/aria.d.ts +52 -0
- package/lib/core/internal/aria.d.ts.map +1 -0
- package/lib/core/internal/config-manager.d.ts.map +1 -1
- package/lib/core/internal/idle-scheduler.d.ts +0 -27
- package/lib/core/internal/idle-scheduler.d.ts.map +1 -1
- package/lib/core/internal/loading.d.ts +0 -38
- package/lib/core/internal/loading.d.ts.map +1 -1
- package/lib/core/internal/row-animation.d.ts.map +1 -1
- package/lib/core/internal/shell.d.ts +6 -0
- package/lib/core/internal/shell.d.ts.map +1 -1
- package/lib/core/internal/style-injector.d.ts +0 -8
- package/lib/core/internal/style-injector.d.ts.map +1 -1
- package/lib/core/internal/utils.d.ts +6 -4
- package/lib/core/internal/utils.d.ts.map +1 -1
- package/lib/core/internal/validate-config.d.ts.map +1 -1
- package/lib/core/internal/virtualization.d.ts +177 -23
- package/lib/core/internal/virtualization.d.ts.map +1 -1
- package/lib/core/plugin/base-plugin.d.ts +50 -0
- package/lib/core/plugin/base-plugin.d.ts.map +1 -1
- package/lib/core/plugin/plugin-manager.d.ts +18 -0
- package/lib/core/plugin/plugin-manager.d.ts.map +1 -1
- package/lib/core/plugin/types.d.ts +16 -0
- package/lib/core/plugin/types.d.ts.map +1 -1
- package/lib/core/types.d.ts +56 -3
- package/lib/core/types.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/context-menu/ContextMenuPlugin.d.ts.map +1 -1
- package/lib/plugins/context-menu/index.js +1 -1
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/editing/EditingPlugin.d.ts +7 -5
- package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
- package/lib/plugins/editing/index.js +379 -278
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/editing/types.d.ts +14 -1
- package/lib/plugins/editing/types.d.ts.map +1 -1
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts +8 -1
- package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts.map +1 -1
- package/lib/plugins/grouping-columns/index.js +59 -60
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts +14 -0
- package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts.map +1 -1
- package/lib/plugins/grouping-rows/index.js +88 -69
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/grouping-rows/types.d.ts +17 -0
- package/lib/plugins/grouping-rows/types.d.ts.map +1 -1
- package/lib/plugins/master-detail/MasterDetailPlugin.d.ts +24 -0
- package/lib/plugins/master-detail/MasterDetailPlugin.d.ts.map +1 -1
- package/lib/plugins/master-detail/index.js +203 -128
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-rows/index.js +2 -2
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pivot/index.js +2 -2
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/print/index.js.map +1 -1
- package/lib/plugins/reorder/index.js.map +1 -1
- package/lib/plugins/responsive/ResponsivePlugin.d.ts +13 -0
- package/lib/plugins/responsive/ResponsivePlugin.d.ts.map +1 -1
- package/lib/plugins/responsive/index.js +65 -49
- package/lib/plugins/responsive/index.js.map +1 -1
- package/lib/plugins/row-reorder/index.js.map +1 -1
- package/lib/plugins/selection/index.js +5 -5
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/undo-redo/index.js.map +1 -1
- package/lib/plugins/visibility/index.js.map +1 -1
- package/package.json +1 -1
- package/umd/grid.all.umd.js +27 -25
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +18 -16
- 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/editing.umd.js +1 -1
- package/umd/plugins/editing.umd.js.map +1 -1
- package/umd/plugins/grouping-columns.umd.js +1 -1
- package/umd/plugins/grouping-columns.umd.js.map +1 -1
- package/umd/plugins/grouping-rows.umd.js +2 -2
- package/umd/plugins/grouping-rows.umd.js.map +1 -1
- package/umd/plugins/master-detail.umd.js +1 -1
- package/umd/plugins/master-detail.umd.js.map +1 -1
- package/umd/plugins/responsive.umd.js +1 -1
- package/umd/plugins/responsive.umd.js.map +1 -1
- package/umd/plugins/selection.umd.js +2 -2
- package/umd/plugins/selection.umd.js.map +1 -1
|
@@ -120,6 +120,20 @@ export declare class GroupingRowsPlugin extends BaseGridPlugin<GroupingRowsConfi
|
|
|
120
120
|
private get animationStyle();
|
|
121
121
|
/** @internal */
|
|
122
122
|
detach(): void;
|
|
123
|
+
/**
|
|
124
|
+
* Provide row height for group header rows.
|
|
125
|
+
*
|
|
126
|
+
* If `groupRowHeight` is configured, returns that value for group rows.
|
|
127
|
+
* This allows the variable row height system to use known heights for
|
|
128
|
+
* group headers without needing to measure them from the DOM.
|
|
129
|
+
*
|
|
130
|
+
* @param row - The row object (may be a group row)
|
|
131
|
+
* @param _index - Index in the processed rows array (unused)
|
|
132
|
+
* @returns Height in pixels for group rows, undefined for data rows
|
|
133
|
+
*
|
|
134
|
+
* @internal Plugin hook for variable row height support
|
|
135
|
+
*/
|
|
136
|
+
getRowHeight(row: unknown, _index: number): number | undefined;
|
|
123
137
|
/**
|
|
124
138
|
* Handle plugin queries.
|
|
125
139
|
* @internal
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupingRowsPlugin.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/grouping-rows/GroupingRowsPlugin.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,KAAK,cAAc,EAAE,KAAK,WAAW,EAAE,MAAM,+BAA+B,CAAC;AActH,OAAO,KAAK,EAEV,kBAAkB,EAGlB,SAAS,EACV,MAAM,SAAS,CAAC;AAEjB;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,2CAA2C;IAC3C,QAAQ,EAAE,OAAO,CAAC;IAClB,gCAAgC;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,6BAA6B;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,mCAAmC;IACnC,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgFG;AACH,qBAAa,kBAAmB,SAAQ,cAAc,CAAC,kBAAkB,CAAC;IACxE;;;OAGG;IACH,gBAAyB,QAAQ,EAAE,cAAc,CAAC,kBAAkB,CAAC,CAkCnE;IAEF,gBAAgB;IAChB,QAAQ,CAAC,IAAI,kBAAkB;IAC/B,gBAAgB;IAChB,SAAkB,MAAM,SAAU;IAElC,gBAAgB;IAChB,cAAuB,aAAa,IAAI,OAAO,CAAC,kBAAkB,CAAC,CASlE;IAGD,OAAO,CAAC,YAAY,CAA0B;IAC9C,OAAO,CAAC,aAAa,CAAmB;IACxC,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,mBAAmB,CAAqB;IAChD,OAAO,CAAC,aAAa,CAAqB;IAC1C,wDAAwD;IACxD,OAAO,CAAC,yBAAyB,CAAS;IAK1C;;;OAGG;IACH,OAAO,KAAK,cAAc,GAGzB;IAMD,gBAAgB;IACP,MAAM,IAAI,IAAI;IASvB;;;OAGG;IACM,WAAW,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO;IAcjD;;;OAGG;IACH,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,EAAE,EAAE,MAAM,EAAE,GAAG,GAAG,OAAO;IAIzD,gBAAgB;IACP,WAAW,CAAC,IAAI,EAAE,SAAS,GAAG,EAAE,GAAG,GAAG,EAAE;
|
|
1
|
+
{"version":3,"file":"GroupingRowsPlugin.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/grouping-rows/GroupingRowsPlugin.ts"],"names":[],"mappings":"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"}
|
|
@@ -384,15 +384,15 @@ function A(n) {
|
|
|
384
384
|
const y = {
|
|
385
385
|
sum: (n, e) => n.reduce((t, r) => t + (Number(r[e]) || 0), 0),
|
|
386
386
|
avg: (n, e) => {
|
|
387
|
-
const t = n.reduce((r,
|
|
387
|
+
const t = n.reduce((r, i) => r + (Number(i[e]) || 0), 0);
|
|
388
388
|
return n.length ? t / n.length : 0;
|
|
389
389
|
},
|
|
390
390
|
count: (n) => n.length,
|
|
391
|
-
min: (n, e) => Math.min(...n.map((t) => Number(t[e]) || 1 / 0)),
|
|
392
|
-
max: (n, e) => Math.max(...n.map((t) => Number(t[e]) || -1 / 0)),
|
|
391
|
+
min: (n, e) => n.length ? Math.min(...n.map((t) => Number(t[e]) || 1 / 0)) : 0,
|
|
392
|
+
max: (n, e) => n.length ? Math.max(...n.map((t) => Number(t[e]) || -1 / 0)) : 0,
|
|
393
393
|
first: (n, e) => n[0]?.[e],
|
|
394
394
|
last: (n, e) => n[n.length - 1]?.[e]
|
|
395
|
-
}, b = /* @__PURE__ */ new Map(),
|
|
395
|
+
}, b = /* @__PURE__ */ new Map(), w = {
|
|
396
396
|
/**
|
|
397
397
|
* Register a custom aggregator function.
|
|
398
398
|
*/
|
|
@@ -416,8 +416,8 @@ const y = {
|
|
|
416
416
|
* Run an aggregator on a set of rows.
|
|
417
417
|
*/
|
|
418
418
|
run(n, e, t, r) {
|
|
419
|
-
const
|
|
420
|
-
return
|
|
419
|
+
const i = this.get(n);
|
|
420
|
+
return i ? i(e, t, r) : void 0;
|
|
421
421
|
},
|
|
422
422
|
/**
|
|
423
423
|
* Check if an aggregator exists.
|
|
@@ -432,43 +432,43 @@ const y = {
|
|
|
432
432
|
return [...Object.keys(y), ...b.keys()];
|
|
433
433
|
}
|
|
434
434
|
};
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
const _ =
|
|
439
|
-
|
|
435
|
+
w.register.bind(w);
|
|
436
|
+
w.unregister.bind(w);
|
|
437
|
+
w.get.bind(w);
|
|
438
|
+
const _ = w.run.bind(w);
|
|
439
|
+
w.list.bind(w);
|
|
440
440
|
function v({ rows: n, config: e, expanded: t, initialExpanded: r }) {
|
|
441
|
-
const
|
|
442
|
-
if (typeof
|
|
441
|
+
const i = e.groupOn;
|
|
442
|
+
if (typeof i != "function")
|
|
443
443
|
return [];
|
|
444
444
|
const o = { key: "__root__", value: null, depth: -1, rows: [], children: /* @__PURE__ */ new Map() };
|
|
445
445
|
if (n.forEach((d) => {
|
|
446
|
-
let u =
|
|
446
|
+
let u = i(d);
|
|
447
447
|
u == null || u === !1 ? u = ["__ungrouped__"] : Array.isArray(u) || (u = [u]);
|
|
448
448
|
let a = o;
|
|
449
|
-
u.forEach((
|
|
450
|
-
const c =
|
|
449
|
+
u.forEach((m, p) => {
|
|
450
|
+
const c = m == null ? "∅" : String(m), h = a.key === "__root__" ? c : a.key + "||" + c;
|
|
451
451
|
let f = a.children.get(c);
|
|
452
|
-
f || (f = { key: h, value:
|
|
452
|
+
f || (f = { key: h, value: m, depth: p, rows: [], children: /* @__PURE__ */ new Map(), parent: a }, a.children.set(c, f)), a = f;
|
|
453
453
|
}), a.rows.push(d);
|
|
454
454
|
}), o.children.size === 1 && o.children.has("__ungrouped__") && o.children.get("__ungrouped__").rows.length === n.length)
|
|
455
455
|
return [];
|
|
456
|
-
const g = /* @__PURE__ */ new Set([...t, ...r ?? []]),
|
|
456
|
+
const g = /* @__PURE__ */ new Set([...t, ...r ?? []]), s = [], l = (d) => {
|
|
457
457
|
if (d === o) {
|
|
458
458
|
d.children.forEach((a) => l(a));
|
|
459
459
|
return;
|
|
460
460
|
}
|
|
461
461
|
const u = g.has(d.key);
|
|
462
|
-
|
|
462
|
+
s.push({
|
|
463
463
|
kind: "group",
|
|
464
464
|
key: d.key,
|
|
465
465
|
value: d.value,
|
|
466
466
|
depth: d.depth,
|
|
467
467
|
rows: d.rows,
|
|
468
468
|
expanded: u
|
|
469
|
-
}), u && (d.children.size ? d.children.forEach((a) => l(a)) : d.rows.forEach((a) =>
|
|
469
|
+
}), u && (d.children.size ? d.children.forEach((a) => l(a)) : d.rows.forEach((a) => s.push({ kind: "data", row: a, rowIndex: n.indexOf(a) })));
|
|
470
470
|
};
|
|
471
|
-
return l(o),
|
|
471
|
+
return l(o), s;
|
|
472
472
|
}
|
|
473
473
|
function K(n, e) {
|
|
474
474
|
const t = new Set(n);
|
|
@@ -570,6 +570,23 @@ class D extends C {
|
|
|
570
570
|
detach() {
|
|
571
571
|
this.expandedKeys.clear(), this.flattenedRows = [], this.isActive = !1, this.previousVisibleKeys.clear(), this.keysToAnimate.clear(), this.hasAppliedDefaultExpanded = !1;
|
|
572
572
|
}
|
|
573
|
+
/**
|
|
574
|
+
* Provide row height for group header rows.
|
|
575
|
+
*
|
|
576
|
+
* If `groupRowHeight` is configured, returns that value for group rows.
|
|
577
|
+
* This allows the variable row height system to use known heights for
|
|
578
|
+
* group headers without needing to measure them from the DOM.
|
|
579
|
+
*
|
|
580
|
+
* @param row - The row object (may be a group row)
|
|
581
|
+
* @param _index - Index in the processed rows array (unused)
|
|
582
|
+
* @returns Height in pixels for group rows, undefined for data rows
|
|
583
|
+
*
|
|
584
|
+
* @internal Plugin hook for variable row height support
|
|
585
|
+
*/
|
|
586
|
+
getRowHeight(e, t) {
|
|
587
|
+
if (this.config.groupRowHeight != null && e.__isGroupRow === !0)
|
|
588
|
+
return this.config.groupRowHeight;
|
|
589
|
+
}
|
|
573
590
|
/**
|
|
574
591
|
* Handle plugin queries.
|
|
575
592
|
* @internal
|
|
@@ -600,33 +617,35 @@ class D extends C {
|
|
|
600
617
|
});
|
|
601
618
|
if (r.length === 0)
|
|
602
619
|
return this.isActive = !1, this.flattenedRows = [], [...e];
|
|
603
|
-
let
|
|
620
|
+
let i;
|
|
604
621
|
if (!this.hasAppliedDefaultExpanded && this.expandedKeys.size === 0 && t.defaultExpanded !== !1) {
|
|
605
|
-
const
|
|
606
|
-
|
|
622
|
+
const s = T(r);
|
|
623
|
+
i = G(t.defaultExpanded ?? !1, s), i.size > 0 && (this.expandedKeys = new Set(i), this.hasAppliedDefaultExpanded = !0);
|
|
607
624
|
}
|
|
608
625
|
const o = v({
|
|
609
626
|
rows: [...e],
|
|
610
627
|
config: t,
|
|
611
628
|
expanded: this.expandedKeys,
|
|
612
|
-
initialExpanded:
|
|
629
|
+
initialExpanded: i
|
|
613
630
|
});
|
|
614
631
|
this.isActive = !0, this.flattenedRows = o, this.keysToAnimate.clear();
|
|
615
632
|
const g = /* @__PURE__ */ new Set();
|
|
616
|
-
return o.forEach((
|
|
617
|
-
if (
|
|
633
|
+
return o.forEach((s, l) => {
|
|
634
|
+
if (s.kind === "data") {
|
|
618
635
|
const d = `data-${l}`;
|
|
619
636
|
g.add(d), this.previousVisibleKeys.has(d) || this.keysToAnimate.add(d);
|
|
620
637
|
}
|
|
621
|
-
}), this.previousVisibleKeys = g, o.map((
|
|
638
|
+
}), this.previousVisibleKeys = g, o.map((s) => s.kind === "group" ? {
|
|
622
639
|
__isGroupRow: !0,
|
|
623
|
-
__groupKey:
|
|
624
|
-
__groupValue:
|
|
625
|
-
__groupDepth:
|
|
626
|
-
__groupRows:
|
|
627
|
-
__groupExpanded:
|
|
628
|
-
__groupRowCount: I(
|
|
629
|
-
|
|
640
|
+
__groupKey: s.key,
|
|
641
|
+
__groupValue: s.value,
|
|
642
|
+
__groupDepth: s.depth,
|
|
643
|
+
__groupRows: s.rows,
|
|
644
|
+
__groupExpanded: s.expanded,
|
|
645
|
+
__groupRowCount: I(s),
|
|
646
|
+
// Cache key for variable row height support - survives expand/collapse
|
|
647
|
+
__rowCacheKey: `group:${s.key}`
|
|
648
|
+
} : s.row);
|
|
630
649
|
}
|
|
631
650
|
/** @internal */
|
|
632
651
|
onCellClick(e) {
|
|
@@ -648,17 +667,17 @@ class D extends C {
|
|
|
648
667
|
renderRow(e, t, r) {
|
|
649
668
|
if (!e?.__isGroupRow)
|
|
650
669
|
return !1;
|
|
651
|
-
const
|
|
652
|
-
if (
|
|
653
|
-
const
|
|
670
|
+
const i = this.config;
|
|
671
|
+
if (i.groupRowRenderer) {
|
|
672
|
+
const s = () => {
|
|
654
673
|
this.toggle(e.__groupKey);
|
|
655
|
-
}, l =
|
|
674
|
+
}, l = i.groupRowRenderer({
|
|
656
675
|
key: e.__groupKey,
|
|
657
676
|
value: e.__groupValue,
|
|
658
677
|
depth: e.__groupDepth,
|
|
659
678
|
rows: e.__groupRows,
|
|
660
679
|
expanded: e.__groupExpanded,
|
|
661
|
-
toggleExpand:
|
|
680
|
+
toggleExpand: s
|
|
662
681
|
});
|
|
663
682
|
if (l)
|
|
664
683
|
return t.className = "data-grid-row group-row", t.__isCustomRow = !0, t.setAttribute("data-group-depth", String(e.__groupDepth)), typeof l == "string" ? t.innerHTML = l : (t.innerHTML = "", t.appendChild(l)), !0;
|
|
@@ -666,7 +685,7 @@ class D extends C {
|
|
|
666
685
|
const o = () => {
|
|
667
686
|
this.toggle(e.__groupKey);
|
|
668
687
|
};
|
|
669
|
-
return t.className = "data-grid-row group-row", t.__isCustomRow = !0, t.setAttribute("data-group-depth", String(e.__groupDepth)), t.setAttribute("role", "row"), t.setAttribute("aria-expanded", String(e.__groupExpanded)), t.style.setProperty("--tbw-group-depth", String(e.__groupDepth || 0)),
|
|
688
|
+
return t.className = "data-grid-row group-row", t.__isCustomRow = !0, t.setAttribute("data-group-depth", String(e.__groupDepth)), t.setAttribute("role", "row"), t.setAttribute("aria-expanded", String(e.__groupExpanded)), t.style.setProperty("--tbw-group-depth", String(e.__groupDepth || 0)), i.indentWidth !== void 0 && t.style.setProperty("--tbw-group-indent-width", `${i.indentWidth}px`), t.style.height = "", t.innerHTML = "", i.fullWidth !== !1 ? this.renderFullWidthGroupRow(e, t, o) : this.renderPerColumnGroupRow(e, t, o), !0;
|
|
670
689
|
}
|
|
671
690
|
/** @internal */
|
|
672
691
|
afterRender() {
|
|
@@ -675,9 +694,9 @@ class D extends C {
|
|
|
675
694
|
const t = this.gridElement?.querySelector(".rows");
|
|
676
695
|
if (!t) return;
|
|
677
696
|
const r = e === "fade" ? "tbw-group-fade-in" : "tbw-group-slide-in";
|
|
678
|
-
for (const
|
|
679
|
-
const o =
|
|
680
|
-
l && this.keysToAnimate.has(l) && (
|
|
697
|
+
for (const i of t.querySelectorAll(".data-grid-row:not(.group-row)")) {
|
|
698
|
+
const o = i.querySelector(".cell[data-row]"), g = o ? parseInt(o.getAttribute("data-row") ?? "-1", 10) : -1, l = this.flattenedRows[g]?.kind === "data" ? `data-${g}` : void 0;
|
|
699
|
+
l && this.keysToAnimate.has(l) && (i.classList.add(r), i.addEventListener("animationend", () => i.classList.remove(r), { once: !0 }));
|
|
681
700
|
}
|
|
682
701
|
this.keysToAnimate.clear();
|
|
683
702
|
}
|
|
@@ -688,31 +707,31 @@ class D extends C {
|
|
|
688
707
|
*/
|
|
689
708
|
createToggleButton(e, t) {
|
|
690
709
|
const r = document.createElement("button");
|
|
691
|
-
return r.type = "button", r.className = `group-toggle${e ? " expanded" : ""}`, r.setAttribute("aria-label", e ? "Collapse group" : "Expand group"), this.setIcon(r, this.resolveIcon(e ? "collapse" : "expand")), r.addEventListener("click", (
|
|
692
|
-
|
|
710
|
+
return r.type = "button", r.className = `group-toggle${e ? " expanded" : ""}`, r.setAttribute("aria-label", e ? "Collapse group" : "Expand group"), this.setIcon(r, this.resolveIcon(e ? "collapse" : "expand")), r.addEventListener("click", (i) => {
|
|
711
|
+
i.stopPropagation(), t();
|
|
693
712
|
}), r;
|
|
694
713
|
}
|
|
695
714
|
/**
|
|
696
715
|
* Get the formatted label text for a group.
|
|
697
716
|
*/
|
|
698
717
|
getGroupLabelText(e, t, r) {
|
|
699
|
-
const
|
|
700
|
-
return
|
|
718
|
+
const i = this.config;
|
|
719
|
+
return i.formatLabel ? i.formatLabel(e, t, r) : String(e);
|
|
701
720
|
}
|
|
702
721
|
renderFullWidthGroupRow(e, t, r) {
|
|
703
|
-
const
|
|
704
|
-
|
|
722
|
+
const i = this.config, o = i.aggregators ?? {}, g = e.__groupRows ?? [], s = document.createElement("div");
|
|
723
|
+
s.className = "cell group-full", s.style.gridColumn = "1 / -1", s.setAttribute("role", "gridcell"), s.setAttribute("data-col", "0"), s.appendChild(this.createToggleButton(e.__groupExpanded, r));
|
|
705
724
|
const l = document.createElement("span");
|
|
706
|
-
if (l.className = "group-label", l.textContent = this.getGroupLabelText(e.__groupValue, e.__groupDepth || 0, e.__groupKey),
|
|
725
|
+
if (l.className = "group-label", l.textContent = this.getGroupLabelText(e.__groupValue, e.__groupDepth || 0, e.__groupKey), s.appendChild(l), i.showRowCount !== !1) {
|
|
707
726
|
const u = document.createElement("span");
|
|
708
|
-
u.className = "group-count", u.textContent = `(${e.__groupRowCount ?? e.__groupRows?.length ?? 0})`,
|
|
727
|
+
u.className = "group-count", u.textContent = `(${e.__groupRowCount ?? e.__groupRows?.length ?? 0})`, s.appendChild(u);
|
|
709
728
|
}
|
|
710
729
|
const d = Object.entries(o);
|
|
711
730
|
if (d.length > 0) {
|
|
712
731
|
const u = document.createElement("span");
|
|
713
732
|
u.className = "group-aggregates";
|
|
714
|
-
for (const [a,
|
|
715
|
-
const p = this.columns.find((h) => h.field === a), c = _(
|
|
733
|
+
for (const [a, m] of d) {
|
|
734
|
+
const p = this.columns.find((h) => h.field === a), c = _(m, g, a, p);
|
|
716
735
|
if (c != null) {
|
|
717
736
|
const h = document.createElement("span");
|
|
718
737
|
h.className = "group-aggregate", h.setAttribute("data-field", a);
|
|
@@ -720,24 +739,24 @@ class D extends C {
|
|
|
720
739
|
h.textContent = `${f}: ${c}`, u.appendChild(h);
|
|
721
740
|
}
|
|
722
741
|
}
|
|
723
|
-
u.children.length > 0 &&
|
|
742
|
+
u.children.length > 0 && s.appendChild(u);
|
|
724
743
|
}
|
|
725
|
-
t.appendChild(
|
|
744
|
+
t.appendChild(s);
|
|
726
745
|
}
|
|
727
746
|
renderPerColumnGroupRow(e, t, r) {
|
|
728
|
-
const
|
|
747
|
+
const i = this.config, o = i.aggregators ?? {}, g = this.columns, s = e.__groupRows ?? [], d = this.gridElement?.querySelector(".body")?.style.gridTemplateColumns || "";
|
|
729
748
|
d && (t.style.display = "grid", t.style.gridTemplateColumns = d);
|
|
730
749
|
let u = !1;
|
|
731
|
-
g.forEach((a,
|
|
750
|
+
g.forEach((a, m) => {
|
|
732
751
|
const p = document.createElement("div");
|
|
733
|
-
if (p.className = "cell group-cell", p.setAttribute("data-col", String(
|
|
752
|
+
if (p.className = "cell group-cell", p.setAttribute("data-col", String(m)), p.setAttribute("role", "gridcell"), A(a)) {
|
|
734
753
|
p.setAttribute("data-field", a.field), t.appendChild(p);
|
|
735
754
|
return;
|
|
736
755
|
}
|
|
737
756
|
if (u) {
|
|
738
757
|
const c = o[a.field];
|
|
739
758
|
if (c) {
|
|
740
|
-
const h = _(c,
|
|
759
|
+
const h = _(c, s, a.field, a);
|
|
741
760
|
p.textContent = h != null ? String(h) : "";
|
|
742
761
|
} else
|
|
743
762
|
p.textContent = "";
|
|
@@ -745,13 +764,13 @@ class D extends C {
|
|
|
745
764
|
u = !0, p.appendChild(this.createToggleButton(e.__groupExpanded, r));
|
|
746
765
|
const c = document.createElement("span"), h = o[a.field];
|
|
747
766
|
if (h) {
|
|
748
|
-
const f = _(h,
|
|
767
|
+
const f = _(h, s, a.field, a);
|
|
749
768
|
c.textContent = f != null ? String(f) : String(e.__groupValue);
|
|
750
769
|
} else
|
|
751
770
|
c.textContent = this.getGroupLabelText(e.__groupValue, e.__groupDepth || 0, e.__groupKey);
|
|
752
|
-
if (p.appendChild(c),
|
|
771
|
+
if (p.appendChild(c), i.showRowCount !== !1) {
|
|
753
772
|
const f = document.createElement("span");
|
|
754
|
-
f.className = "group-count", f.textContent = ` (${
|
|
773
|
+
f.className = "group-count", f.textContent = ` (${s.length})`, p.appendChild(f);
|
|
755
774
|
}
|
|
756
775
|
}
|
|
757
776
|
t.appendChild(p);
|
|
@@ -777,15 +796,15 @@ class D extends C {
|
|
|
777
796
|
* @param key - The group key to toggle
|
|
778
797
|
*/
|
|
779
798
|
toggle(e) {
|
|
780
|
-
const t = !this.expandedKeys.has(e), r = this.config,
|
|
781
|
-
if (r.accordion && t &&
|
|
799
|
+
const t = !this.expandedKeys.has(e), r = this.config, i = this.flattenedRows.find((o) => o.kind === "group" && o.key === e);
|
|
800
|
+
if (r.accordion && t && i) {
|
|
782
801
|
const o = /* @__PURE__ */ new Set();
|
|
783
802
|
for (const g of this.expandedKeys)
|
|
784
803
|
if (e.startsWith(g + "||") || g.startsWith(e + "||"))
|
|
785
804
|
e.startsWith(g + "||") && o.add(g);
|
|
786
805
|
else {
|
|
787
|
-
const
|
|
788
|
-
|
|
806
|
+
const s = this.flattenedRows.find((l) => l.kind === "group" && l.key === g);
|
|
807
|
+
s && s.depth !== i.depth && o.add(g);
|
|
789
808
|
}
|
|
790
809
|
o.add(e), this.expandedKeys = o;
|
|
791
810
|
} else
|
|
@@ -793,8 +812,8 @@ class D extends C {
|
|
|
793
812
|
this.emit("group-toggle", {
|
|
794
813
|
key: e,
|
|
795
814
|
expanded: this.expandedKeys.has(e),
|
|
796
|
-
value:
|
|
797
|
-
depth:
|
|
815
|
+
value: i?.value,
|
|
816
|
+
depth: i?.depth ?? 0
|
|
798
817
|
}), this.emitPluginEvent("grouping-state-change", {
|
|
799
818
|
expandedKeys: [...this.expandedKeys]
|
|
800
819
|
}), this.requestRender();
|