@toolbox-web/grid 0.4.2 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -3
- package/all.js +1063 -1024
- package/all.js.map +1 -1
- package/index.js +1078 -912
- package/index.js.map +1 -1
- package/lib/core/grid.d.ts +28 -0
- package/lib/core/grid.d.ts.map +1 -1
- package/lib/core/internal/dom-builder.d.ts +2 -0
- package/lib/core/internal/dom-builder.d.ts.map +1 -1
- package/lib/core/internal/event-delegation.d.ts +21 -0
- package/lib/core/internal/event-delegation.d.ts.map +1 -1
- package/lib/core/internal/header.d.ts.map +1 -1
- package/lib/core/internal/resize.d.ts.map +1 -1
- package/lib/core/internal/rows.d.ts +1 -1
- package/lib/core/internal/rows.d.ts.map +1 -1
- package/lib/core/internal/shell.d.ts +19 -13
- package/lib/core/internal/shell.d.ts.map +1 -1
- package/lib/core/plugin/base-plugin.d.ts +13 -2
- package/lib/core/plugin/base-plugin.d.ts.map +1 -1
- package/lib/core/plugin/expander-column.d.ts.map +1 -1
- package/lib/core/plugin/plugin-manager.d.ts +6 -2
- package/lib/core/plugin/plugin-manager.d.ts.map +1 -1
- package/lib/core/types.d.ts +41 -3
- package/lib/core/types.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.js +22 -11
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/column-virtualization/index.js +59 -48
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/context-menu/index.js +71 -60
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/editing/EditingPlugin.d.ts +1 -0
- package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
- package/lib/plugins/editing/index.js +93 -80
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/export/index.js +29 -18
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/FilteringPlugin.d.ts +9 -1
- package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -1
- package/lib/plugins/filtering/index.js +199 -165
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts +1 -0
- package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts.map +1 -1
- package/lib/plugins/grouping-columns/index.js +79 -49
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts.map +1 -1
- package/lib/plugins/grouping-rows/index.js +98 -87
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/master-detail/index.js +70 -57
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/multi-sort/index.js +48 -37
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts.map +1 -1
- package/lib/plugins/pinned-columns/index.js +71 -66
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-columns/pinned-columns.d.ts +2 -2
- package/lib/plugins/pinned-columns/pinned-columns.d.ts.map +1 -1
- package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts.map +1 -1
- package/lib/plugins/pinned-rows/index.js +63 -52
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pivot/PivotPlugin.d.ts.map +1 -1
- package/lib/plugins/pivot/index.js +310 -299
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/reorder/ReorderPlugin.d.ts.map +1 -1
- package/lib/plugins/reorder/index.d.ts +1 -1
- package/lib/plugins/reorder/index.d.ts.map +1 -1
- package/lib/plugins/reorder/index.js +79 -68
- package/lib/plugins/reorder/index.js.map +1 -1
- package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
- package/lib/plugins/selection/index.js +115 -105
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/server-side/index.js +15 -4
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/tree/TreePlugin.d.ts.map +1 -1
- package/lib/plugins/tree/index.js +41 -30
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/undo-redo/index.js +29 -18
- package/lib/plugins/undo-redo/index.js.map +1 -1
- package/lib/plugins/visibility/VisibilityPlugin.d.ts.map +1 -1
- package/lib/plugins/visibility/index.js +59 -47
- package/lib/plugins/visibility/index.js.map +1 -1
- package/package.json +6 -6
- package/public.d.ts +42 -0
- package/public.d.ts.map +1 -1
- package/themes/dg-theme-bootstrap.css +55 -53
- package/themes/dg-theme-contrast.css +42 -40
- package/themes/dg-theme-large.css +38 -37
- package/themes/dg-theme-material.css +54 -52
- package/themes/dg-theme-standard.css +19 -17
- package/themes/dg-theme-vibrant.css +16 -14
- package/umd/grid.all.umd.js +23 -22
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +15 -14
- package/umd/grid.umd.js.map +1 -1
- package/umd/plugins/column-virtualization.umd.js +1 -1
- package/umd/plugins/column-virtualization.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/filtering.umd.js +1 -1
- package/umd/plugins/filtering.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 +1 -1
- 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/multi-sort.umd.js +1 -1
- package/umd/plugins/multi-sort.umd.js.map +1 -1
- package/umd/plugins/pinned-columns.umd.js +1 -1
- package/umd/plugins/pinned-columns.umd.js.map +1 -1
- package/umd/plugins/pinned-rows.umd.js +1 -1
- package/umd/plugins/pinned-rows.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/reorder.umd.js +1 -1
- package/umd/plugins/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/tree.umd.js +1 -1
- package/umd/plugins/tree.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
|
|
1
|
+
const v = {
|
|
2
2
|
expand: "▶",
|
|
3
3
|
collapse: "▼",
|
|
4
4
|
sortAsc: "▲",
|
|
@@ -8,7 +8,7 @@ const R = {
|
|
|
8
8
|
dragHandle: "⋮⋮",
|
|
9
9
|
toolPanel: "☰"
|
|
10
10
|
};
|
|
11
|
-
class
|
|
11
|
+
class R {
|
|
12
12
|
/**
|
|
13
13
|
* Plugin dependencies - declare other plugins this one requires.
|
|
14
14
|
*
|
|
@@ -185,10 +185,21 @@ class x {
|
|
|
185
185
|
return this.grid;
|
|
186
186
|
}
|
|
187
187
|
/**
|
|
188
|
-
* Get the
|
|
188
|
+
* Get the render root of the grid for DOM queries.
|
|
189
|
+
* @deprecated Use `gridElement` instead. This getter exists only for backward compatibility.
|
|
190
|
+
*
|
|
191
|
+
* With Shadow DOM removed, the grid element itself is the render root.
|
|
192
|
+
* All new code should use `this.gridElement` for DOM queries.
|
|
193
|
+
*
|
|
194
|
+
* @example
|
|
195
|
+
* // OLD (deprecated)
|
|
196
|
+
* const rows = this.shadowRoot?.querySelector('.rows');
|
|
197
|
+
*
|
|
198
|
+
* // NEW (preferred)
|
|
199
|
+
* const rows = this.gridElement.querySelector('.rows');
|
|
189
200
|
*/
|
|
190
201
|
get shadowRoot() {
|
|
191
|
-
return this.
|
|
202
|
+
return this.gridElement;
|
|
192
203
|
}
|
|
193
204
|
/**
|
|
194
205
|
* Get the disconnect signal for event listener cleanup.
|
|
@@ -216,7 +227,7 @@ class x {
|
|
|
216
227
|
*/
|
|
217
228
|
get gridIcons() {
|
|
218
229
|
const e = this.grid?.gridConfig?.icons ?? {};
|
|
219
|
-
return { ...
|
|
230
|
+
return { ...v, ...e };
|
|
220
231
|
}
|
|
221
232
|
// #region Animation Helpers
|
|
222
233
|
/**
|
|
@@ -239,7 +250,7 @@ class x {
|
|
|
239
250
|
const e = this.grid?.effectiveConfig?.animation?.mode ?? "reduced-motion";
|
|
240
251
|
if (e === !1 || e === "off") return !1;
|
|
241
252
|
if (e === !0 || e === "on") return !0;
|
|
242
|
-
const t = this.
|
|
253
|
+
const t = this.gridElement;
|
|
243
254
|
return t ? getComputedStyle(t).getPropertyValue("--tbw-animation-enabled").trim() !== "0" : !0;
|
|
244
255
|
}
|
|
245
256
|
/**
|
|
@@ -255,7 +266,7 @@ class x {
|
|
|
255
266
|
* ```
|
|
256
267
|
*/
|
|
257
268
|
get animationDuration() {
|
|
258
|
-
const e = this.
|
|
269
|
+
const e = this.gridElement;
|
|
259
270
|
if (e) {
|
|
260
271
|
const t = getComputedStyle(e).getPropertyValue("--tbw-animation-duration").trim(), r = parseInt(t, 10);
|
|
261
272
|
if (!isNaN(r)) return r;
|
|
@@ -292,14 +303,14 @@ class x {
|
|
|
292
303
|
}
|
|
293
304
|
// #endregion
|
|
294
305
|
}
|
|
295
|
-
const
|
|
306
|
+
const x = "__tbw_expander";
|
|
296
307
|
function C(n) {
|
|
297
|
-
return n.field ===
|
|
308
|
+
return n.field === x;
|
|
298
309
|
}
|
|
299
|
-
const
|
|
310
|
+
const _ = {
|
|
300
311
|
sum: (n, e) => n.reduce((t, r) => t + (Number(r[e]) || 0), 0),
|
|
301
312
|
avg: (n, e) => {
|
|
302
|
-
const t = n.reduce((r,
|
|
313
|
+
const t = n.reduce((r, s) => r + (Number(s[e]) || 0), 0);
|
|
303
314
|
return n.length ? t / n.length : 0;
|
|
304
315
|
},
|
|
305
316
|
count: (n) => n.length,
|
|
@@ -325,26 +336,26 @@ const m = {
|
|
|
325
336
|
*/
|
|
326
337
|
get(n) {
|
|
327
338
|
if (n !== void 0)
|
|
328
|
-
return typeof n == "function" ? n : w.get(n) ??
|
|
339
|
+
return typeof n == "function" ? n : w.get(n) ?? _[n];
|
|
329
340
|
},
|
|
330
341
|
/**
|
|
331
342
|
* Run an aggregator on a set of rows.
|
|
332
343
|
*/
|
|
333
344
|
run(n, e, t, r) {
|
|
334
|
-
const
|
|
335
|
-
return
|
|
345
|
+
const s = this.get(n);
|
|
346
|
+
return s ? s(e, t, r) : void 0;
|
|
336
347
|
},
|
|
337
348
|
/**
|
|
338
349
|
* Check if an aggregator exists.
|
|
339
350
|
*/
|
|
340
351
|
has(n) {
|
|
341
|
-
return w.has(n) || n in
|
|
352
|
+
return w.has(n) || n in _;
|
|
342
353
|
},
|
|
343
354
|
/**
|
|
344
355
|
* List all available aggregator names.
|
|
345
356
|
*/
|
|
346
357
|
list() {
|
|
347
|
-
return [...Object.keys(
|
|
358
|
+
return [...Object.keys(_), ...w.keys()];
|
|
348
359
|
}
|
|
349
360
|
};
|
|
350
361
|
c.register.bind(c);
|
|
@@ -356,40 +367,40 @@ function A({ rows: n, config: e, expanded: t }) {
|
|
|
356
367
|
const r = e.groupOn;
|
|
357
368
|
if (typeof r != "function")
|
|
358
369
|
return [];
|
|
359
|
-
const
|
|
360
|
-
if (n.forEach((
|
|
361
|
-
let a = r(
|
|
370
|
+
const s = { key: "__root__", value: null, depth: -1, rows: [], children: /* @__PURE__ */ new Map() };
|
|
371
|
+
if (n.forEach((o) => {
|
|
372
|
+
let a = r(o);
|
|
362
373
|
a == null || a === !1 ? a = ["__ungrouped__"] : Array.isArray(a) || (a = [a]);
|
|
363
|
-
let
|
|
374
|
+
let u = s;
|
|
364
375
|
a.forEach((h, p) => {
|
|
365
|
-
const f = h == null ? "∅" : String(h), l =
|
|
366
|
-
let g =
|
|
367
|
-
g || (g = { key: l, value: h, depth: p, rows: [], children: /* @__PURE__ */ new Map(), parent:
|
|
368
|
-
}),
|
|
369
|
-
}),
|
|
376
|
+
const f = h == null ? "∅" : String(h), l = u.key === "__root__" ? f : u.key + "||" + f;
|
|
377
|
+
let g = u.children.get(f);
|
|
378
|
+
g || (g = { key: l, value: h, depth: p, rows: [], children: /* @__PURE__ */ new Map(), parent: u }, u.children.set(f, g)), u = g;
|
|
379
|
+
}), u.rows.push(o);
|
|
380
|
+
}), s.children.size === 1 && s.children.has("__ungrouped__") && s.children.get("__ungrouped__").rows.length === n.length)
|
|
370
381
|
return [];
|
|
371
|
-
const
|
|
372
|
-
if (
|
|
373
|
-
|
|
382
|
+
const i = [], d = (o) => {
|
|
383
|
+
if (o === s) {
|
|
384
|
+
o.children.forEach((u) => d(u));
|
|
374
385
|
return;
|
|
375
386
|
}
|
|
376
|
-
const a = t.has(
|
|
377
|
-
|
|
387
|
+
const a = t.has(o.key);
|
|
388
|
+
i.push({
|
|
378
389
|
kind: "group",
|
|
379
|
-
key:
|
|
380
|
-
value:
|
|
381
|
-
depth:
|
|
382
|
-
rows:
|
|
390
|
+
key: o.key,
|
|
391
|
+
value: o.value,
|
|
392
|
+
depth: o.depth,
|
|
393
|
+
rows: o.rows,
|
|
383
394
|
expanded: a
|
|
384
|
-
}), a && (
|
|
395
|
+
}), a && (o.children.size ? o.children.forEach((u) => d(u)) : o.rows.forEach((u) => i.push({ kind: "data", row: u, rowIndex: n.indexOf(u) })));
|
|
385
396
|
};
|
|
386
|
-
return
|
|
397
|
+
return d(s), i;
|
|
387
398
|
}
|
|
388
399
|
function k(n, e) {
|
|
389
400
|
const t = new Set(n);
|
|
390
401
|
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
391
402
|
}
|
|
392
|
-
function
|
|
403
|
+
function E(n) {
|
|
393
404
|
const e = /* @__PURE__ */ new Set();
|
|
394
405
|
for (const t of n)
|
|
395
406
|
t.kind === "group" && e.add(t.key);
|
|
@@ -398,11 +409,11 @@ function K(n) {
|
|
|
398
409
|
function S() {
|
|
399
410
|
return /* @__PURE__ */ new Set();
|
|
400
411
|
}
|
|
401
|
-
function
|
|
412
|
+
function K(n) {
|
|
402
413
|
return n.kind !== "group" ? 0 : n.rows.length;
|
|
403
414
|
}
|
|
404
|
-
const G =
|
|
405
|
-
class T extends
|
|
415
|
+
const G = "@layer tbw-plugins{.group-row{display:grid;grid-template-columns:var(--tbw-column-template);background:var(--tbw-grouping-rows-bg, var(--tbw-color-panel-bg));font-weight:500;border-bottom:var(--tbw-row-divider);min-height:var(--tbw-row-height)}.group-row .cell{display:flex;align-items:center;padding:var(--tbw-cell-padding, .125rem .5rem)}.group-row:hover{background:var(--tbw-grouping-rows-bg-hover, var(--tbw-color-row-hover))}.group-toggle{cursor:pointer;-webkit-user-select:none;user-select:none;display:inline-flex;align-items:center;justify-content:center;width:var(--tbw-toggle-size, 1.25rem);height:var(--tbw-toggle-size, 1.25rem);margin-right:.25rem;background:none;border:0;font:inherit}.group-toggle:hover{background:var(--tbw-grouping-rows-toggle-hover, var(--tbw-color-row-hover));border-radius:var(--tbw-border-radius, .125rem)}.group-label{display:inline-flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.group-count{color:var(--tbw-grouping-rows-count-color, var(--tbw-color-fg-muted));font-size:var(--tbw-font-size-xs, .85em);font-weight:400}.group-row{padding-left:calc(var(--tbw-group-depth, 0) * var(--tbw-group-indent-width, 1.25em))}.data-grid-row.tbw-group-slide-in{animation:tbw-group-slide-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-group-slide-in{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}.data-grid-row.tbw-group-fade-in{animation:tbw-group-fade-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-group-fade-in{0%{opacity:0}to{opacity:1}}}";
|
|
416
|
+
class T extends R {
|
|
406
417
|
name = "groupingRows";
|
|
407
418
|
styles = G;
|
|
408
419
|
get defaultConfig() {
|
|
@@ -455,21 +466,21 @@ class T extends x {
|
|
|
455
466
|
if (r.length === 0)
|
|
456
467
|
return this.isActive = !1, this.flattenedRows = [], [...e];
|
|
457
468
|
this.isActive = !0, this.flattenedRows = r, this.keysToAnimate.clear();
|
|
458
|
-
const
|
|
459
|
-
return r.forEach((
|
|
460
|
-
if (
|
|
461
|
-
const
|
|
462
|
-
|
|
469
|
+
const s = /* @__PURE__ */ new Set();
|
|
470
|
+
return r.forEach((i, d) => {
|
|
471
|
+
if (i.kind === "data") {
|
|
472
|
+
const o = `data-${d}`;
|
|
473
|
+
s.add(o), this.previousVisibleKeys.has(o) || this.keysToAnimate.add(o);
|
|
463
474
|
}
|
|
464
|
-
}), this.previousVisibleKeys =
|
|
475
|
+
}), this.previousVisibleKeys = s, r.map((i) => i.kind === "group" ? {
|
|
465
476
|
__isGroupRow: !0,
|
|
466
|
-
__groupKey:
|
|
467
|
-
__groupValue:
|
|
468
|
-
__groupDepth:
|
|
469
|
-
__groupRows:
|
|
470
|
-
__groupExpanded:
|
|
471
|
-
__groupRowCount:
|
|
472
|
-
} :
|
|
477
|
+
__groupKey: i.key,
|
|
478
|
+
__groupValue: i.value,
|
|
479
|
+
__groupDepth: i.depth,
|
|
480
|
+
__groupRows: i.rows,
|
|
481
|
+
__groupExpanded: i.expanded,
|
|
482
|
+
__groupRowCount: K(i)
|
|
483
|
+
} : i.row);
|
|
473
484
|
}
|
|
474
485
|
onCellClick(e) {
|
|
475
486
|
const t = e.row;
|
|
@@ -488,35 +499,35 @@ class T extends x {
|
|
|
488
499
|
renderRow(e, t, r) {
|
|
489
500
|
if (!e?.__isGroupRow)
|
|
490
501
|
return !1;
|
|
491
|
-
const
|
|
492
|
-
if (
|
|
493
|
-
const
|
|
502
|
+
const s = this.config;
|
|
503
|
+
if (s.groupRowRenderer) {
|
|
504
|
+
const o = () => {
|
|
494
505
|
this.toggle(e.__groupKey);
|
|
495
|
-
}, a =
|
|
506
|
+
}, a = s.groupRowRenderer({
|
|
496
507
|
key: e.__groupKey,
|
|
497
508
|
value: e.__groupValue,
|
|
498
509
|
depth: e.__groupDepth,
|
|
499
510
|
rows: e.__groupRows,
|
|
500
511
|
expanded: e.__groupExpanded,
|
|
501
|
-
toggleExpand:
|
|
512
|
+
toggleExpand: o
|
|
502
513
|
});
|
|
503
514
|
if (a)
|
|
504
515
|
return t.className = "data-grid-row group-row", t.__isCustomRow = !0, t.setAttribute("data-group-depth", String(e.__groupDepth)), typeof a == "string" ? t.innerHTML = a : (t.innerHTML = "", t.appendChild(a)), !0;
|
|
505
516
|
}
|
|
506
|
-
const
|
|
517
|
+
const i = () => {
|
|
507
518
|
this.toggle(e.__groupKey);
|
|
508
519
|
};
|
|
509
|
-
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.
|
|
520
|
+
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)), s.indentWidth !== void 0 && t.style.setProperty("--tbw-group-indent-width", `${s.indentWidth}px`), t.innerHTML = "", s.fullWidth !== !1 ? this.renderFullWidthGroupRow(e, t, i) : this.renderPerColumnGroupRow(e, t, i), !0;
|
|
510
521
|
}
|
|
511
522
|
afterRender() {
|
|
512
523
|
const e = this.animationStyle;
|
|
513
524
|
if (e === !1 || this.keysToAnimate.size === 0) return;
|
|
514
|
-
const t = this.
|
|
525
|
+
const t = this.gridElement?.querySelector(".rows");
|
|
515
526
|
if (!t) return;
|
|
516
527
|
const r = e === "fade" ? "tbw-group-fade-in" : "tbw-group-slide-in";
|
|
517
|
-
for (const
|
|
518
|
-
const
|
|
519
|
-
a && this.keysToAnimate.has(a) && (
|
|
528
|
+
for (const s of t.querySelectorAll(".data-grid-row:not(.group-row)")) {
|
|
529
|
+
const i = s.querySelector(".cell[data-row]"), d = i ? parseInt(i.getAttribute("data-row") ?? "-1", 10) : -1, a = this.flattenedRows[d]?.kind === "data" ? `data-${d}` : void 0;
|
|
530
|
+
a && this.keysToAnimate.has(a) && (s.classList.add(r), s.addEventListener("animationend", () => s.classList.remove(r), { once: !0 }));
|
|
520
531
|
}
|
|
521
532
|
this.keysToAnimate.clear();
|
|
522
533
|
}
|
|
@@ -527,55 +538,55 @@ class T extends x {
|
|
|
527
538
|
*/
|
|
528
539
|
createToggleButton(e, t) {
|
|
529
540
|
const r = document.createElement("button");
|
|
530
|
-
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", (
|
|
531
|
-
|
|
541
|
+
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", (s) => {
|
|
542
|
+
s.stopPropagation(), t();
|
|
532
543
|
}), r;
|
|
533
544
|
}
|
|
534
545
|
/**
|
|
535
546
|
* Get the formatted label text for a group.
|
|
536
547
|
*/
|
|
537
548
|
getGroupLabelText(e, t, r) {
|
|
538
|
-
const
|
|
539
|
-
return
|
|
549
|
+
const s = this.config;
|
|
550
|
+
return s.formatLabel ? s.formatLabel(e, t, r) : String(e);
|
|
540
551
|
}
|
|
541
552
|
renderFullWidthGroupRow(e, t, r) {
|
|
542
|
-
const
|
|
543
|
-
|
|
544
|
-
const
|
|
545
|
-
if (
|
|
546
|
-
const
|
|
547
|
-
|
|
553
|
+
const s = this.config, i = document.createElement("div");
|
|
554
|
+
i.className = "cell group-full", i.style.gridColumn = "1 / -1", i.setAttribute("role", "gridcell"), i.setAttribute("data-col", "0"), i.appendChild(this.createToggleButton(e.__groupExpanded, r));
|
|
555
|
+
const d = document.createElement("span");
|
|
556
|
+
if (d.className = "group-label", d.textContent = this.getGroupLabelText(e.__groupValue, e.__groupDepth || 0, e.__groupKey), i.appendChild(d), s.showRowCount !== !1) {
|
|
557
|
+
const o = document.createElement("span");
|
|
558
|
+
o.className = "group-count", o.textContent = `(${e.__groupRowCount ?? e.__groupRows?.length ?? 0})`, i.appendChild(o);
|
|
548
559
|
}
|
|
549
|
-
t.appendChild(
|
|
560
|
+
t.appendChild(i);
|
|
550
561
|
}
|
|
551
562
|
renderPerColumnGroupRow(e, t, r) {
|
|
552
|
-
const
|
|
553
|
-
|
|
563
|
+
const s = this.config, i = s.aggregators ?? {}, d = this.columns, o = e.__groupRows ?? [], u = this.gridElement?.querySelector(".body")?.style.gridTemplateColumns || "";
|
|
564
|
+
u && (t.style.display = "grid", t.style.gridTemplateColumns = u);
|
|
554
565
|
let h = !1;
|
|
555
|
-
|
|
566
|
+
d.forEach((p, f) => {
|
|
556
567
|
const l = document.createElement("div");
|
|
557
568
|
if (l.className = "cell group-cell", l.setAttribute("data-col", String(f)), l.setAttribute("role", "gridcell"), C(p)) {
|
|
558
569
|
l.setAttribute("data-field", p.field), t.appendChild(l);
|
|
559
570
|
return;
|
|
560
571
|
}
|
|
561
572
|
if (h) {
|
|
562
|
-
const g =
|
|
573
|
+
const g = i[p.field];
|
|
563
574
|
if (g) {
|
|
564
|
-
const b = y(g,
|
|
575
|
+
const b = y(g, o, p.field, p);
|
|
565
576
|
l.textContent = b != null ? String(b) : "";
|
|
566
577
|
} else
|
|
567
578
|
l.textContent = "";
|
|
568
579
|
} else {
|
|
569
580
|
h = !0, l.appendChild(this.createToggleButton(e.__groupExpanded, r));
|
|
570
|
-
const g = document.createElement("span"), b =
|
|
581
|
+
const g = document.createElement("span"), b = i[p.field];
|
|
571
582
|
if (b) {
|
|
572
|
-
const
|
|
573
|
-
g.textContent =
|
|
583
|
+
const m = y(b, o, p.field, p);
|
|
584
|
+
g.textContent = m != null ? String(m) : String(e.__groupValue);
|
|
574
585
|
} else
|
|
575
586
|
g.textContent = this.getGroupLabelText(e.__groupValue, e.__groupDepth || 0, e.__groupKey);
|
|
576
|
-
if (l.appendChild(g),
|
|
577
|
-
const
|
|
578
|
-
|
|
587
|
+
if (l.appendChild(g), s.showRowCount !== !1) {
|
|
588
|
+
const m = document.createElement("span");
|
|
589
|
+
m.className = "group-count", m.textContent = ` (${o.length})`, l.appendChild(m);
|
|
579
590
|
}
|
|
580
591
|
}
|
|
581
592
|
t.appendChild(l);
|
|
@@ -587,7 +598,7 @@ class T extends x {
|
|
|
587
598
|
* Expand all groups.
|
|
588
599
|
*/
|
|
589
600
|
expandAll() {
|
|
590
|
-
this.expandedKeys =
|
|
601
|
+
this.expandedKeys = E(this.flattenedRows), this.requestRender();
|
|
591
602
|
}
|
|
592
603
|
/**
|
|
593
604
|
* Collapse all groups.
|