@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 x = /{{\s*([^}]+)\s*}}/g, u = "__DG_EMPTY__", R = /^[\w$. '?+\-*/%:()!<>=,&|]+$/, E = /__(proto|defineGetter|defineSetter)|constructor|window|globalThis|global|process|Function|import|eval|Reflect|Proxy|Error|arguments|document|location|cookie|localStorage|sessionStorage|indexedDB|fetch|XMLHttpRequest|WebSocket|Worker|SharedWorker|ServiceWorker|opener|parent|top|frames|self|this\b/, v = /* @__PURE__ */ new Set([
|
|
2
2
|
"script",
|
|
3
3
|
"iframe",
|
|
4
4
|
"object",
|
|
@@ -23,7 +23,7 @@ const R = /{{\s*([^}]+)\s*}}/g, u = "__DG_EMPTY__", b = /^[\w$. '?+\-*/%:()!<>=,
|
|
|
23
23
|
"plaintext",
|
|
24
24
|
"xmp",
|
|
25
25
|
"listing"
|
|
26
|
-
]),
|
|
26
|
+
]), g = /^on\w+$/i, y = /* @__PURE__ */ new Set(["href", "src", "action", "formaction", "data", "srcdoc", "xlink:href", "poster", "srcset"]), C = /^\s*(javascript|vbscript|data|blob):/i;
|
|
27
27
|
function _(n) {
|
|
28
28
|
if (!n || typeof n != "string") return "";
|
|
29
29
|
if (n.indexOf("<") === -1) return n;
|
|
@@ -33,29 +33,29 @@ function _(n) {
|
|
|
33
33
|
function A(n) {
|
|
34
34
|
const e = [], t = n.querySelectorAll("*");
|
|
35
35
|
for (const i of t) {
|
|
36
|
-
const
|
|
37
|
-
if (v.has(
|
|
36
|
+
const s = i.tagName.toLowerCase();
|
|
37
|
+
if (v.has(s)) {
|
|
38
38
|
e.push(i);
|
|
39
39
|
continue;
|
|
40
40
|
}
|
|
41
|
-
if ((
|
|
42
|
-
(
|
|
41
|
+
if ((s === "svg" || i.namespaceURI === "http://www.w3.org/2000/svg") && Array.from(i.attributes).some(
|
|
42
|
+
(r) => g.test(r.name) || r.name === "href" || r.name === "xlink:href"
|
|
43
43
|
)) {
|
|
44
44
|
e.push(i);
|
|
45
45
|
continue;
|
|
46
46
|
}
|
|
47
47
|
const l = [];
|
|
48
48
|
for (const o of i.attributes) {
|
|
49
|
-
const
|
|
50
|
-
if (
|
|
49
|
+
const r = o.name.toLowerCase();
|
|
50
|
+
if (g.test(r)) {
|
|
51
51
|
l.push(o.name);
|
|
52
52
|
continue;
|
|
53
53
|
}
|
|
54
|
-
if (y.has(
|
|
54
|
+
if (y.has(r) && C.test(o.value)) {
|
|
55
55
|
l.push(o.name);
|
|
56
56
|
continue;
|
|
57
57
|
}
|
|
58
|
-
if (
|
|
58
|
+
if (r === "style" && /expression\s*\(|javascript:|behavior\s*:/i.test(o.value)) {
|
|
59
59
|
l.push(o.name);
|
|
60
60
|
continue;
|
|
61
61
|
}
|
|
@@ -66,24 +66,24 @@ function A(n) {
|
|
|
66
66
|
}
|
|
67
67
|
function D(n, e) {
|
|
68
68
|
if (!n || n.indexOf("{{") === -1) return n;
|
|
69
|
-
const t = [], i = n.replace(
|
|
69
|
+
const t = [], i = n.replace(x, (r, a) => {
|
|
70
70
|
const d = S(a, e);
|
|
71
71
|
return t.push({ expr: a.trim(), result: d }), d;
|
|
72
|
-
}),
|
|
73
|
-
return /Reflect\.|\bProxy\b|ownKeys\(/.test(n) || l ? "" :
|
|
72
|
+
}), s = L(i), l = t.length && t.every((r) => r.result === "" || r.result === u);
|
|
73
|
+
return /Reflect\.|\bProxy\b|ownKeys\(/.test(n) || l ? "" : s;
|
|
74
74
|
}
|
|
75
75
|
function S(n, e) {
|
|
76
76
|
if (n = (n || "").trim(), !n || /\b(Reflect|Proxy|ownKeys)\b/.test(n)) return u;
|
|
77
77
|
if (n === "value") return e.value == null ? u : String(e.value);
|
|
78
78
|
if (n.startsWith("row.") && !/[()?]/.test(n) && !n.includes(":")) {
|
|
79
|
-
const i = n.slice(4),
|
|
80
|
-
return
|
|
79
|
+
const i = n.slice(4), s = e.row ? e.row[i] : void 0;
|
|
80
|
+
return s == null ? u : String(s);
|
|
81
81
|
}
|
|
82
|
-
if (n.length > 80 || !
|
|
82
|
+
if (n.length > 80 || !R.test(n) || E.test(n)) return u;
|
|
83
83
|
const t = n.match(/\./g);
|
|
84
84
|
if (t && t.length > 1) return u;
|
|
85
85
|
try {
|
|
86
|
-
const
|
|
86
|
+
const s = new Function("value", "row", `return (${n});`)(e.value, e.row), l = s == null ? "" : String(s);
|
|
87
87
|
return /Reflect|Proxy|ownKeys/.test(l) ? u : l || u;
|
|
88
88
|
} catch {
|
|
89
89
|
return u;
|
|
@@ -279,10 +279,21 @@ class T {
|
|
|
279
279
|
return this.grid;
|
|
280
280
|
}
|
|
281
281
|
/**
|
|
282
|
-
* Get the
|
|
282
|
+
* Get the render root of the grid for DOM queries.
|
|
283
|
+
* @deprecated Use `gridElement` instead. This getter exists only for backward compatibility.
|
|
284
|
+
*
|
|
285
|
+
* With Shadow DOM removed, the grid element itself is the render root.
|
|
286
|
+
* All new code should use `this.gridElement` for DOM queries.
|
|
287
|
+
*
|
|
288
|
+
* @example
|
|
289
|
+
* // OLD (deprecated)
|
|
290
|
+
* const rows = this.shadowRoot?.querySelector('.rows');
|
|
291
|
+
*
|
|
292
|
+
* // NEW (preferred)
|
|
293
|
+
* const rows = this.gridElement.querySelector('.rows');
|
|
283
294
|
*/
|
|
284
295
|
get shadowRoot() {
|
|
285
|
-
return this.
|
|
296
|
+
return this.gridElement;
|
|
286
297
|
}
|
|
287
298
|
/**
|
|
288
299
|
* Get the disconnect signal for event listener cleanup.
|
|
@@ -333,7 +344,7 @@ class T {
|
|
|
333
344
|
const e = this.grid?.effectiveConfig?.animation?.mode ?? "reduced-motion";
|
|
334
345
|
if (e === !1 || e === "off") return !1;
|
|
335
346
|
if (e === !0 || e === "on") return !0;
|
|
336
|
-
const t = this.
|
|
347
|
+
const t = this.gridElement;
|
|
337
348
|
return t ? getComputedStyle(t).getPropertyValue("--tbw-animation-enabled").trim() !== "0" : !0;
|
|
338
349
|
}
|
|
339
350
|
/**
|
|
@@ -349,7 +360,7 @@ class T {
|
|
|
349
360
|
* ```
|
|
350
361
|
*/
|
|
351
362
|
get animationDuration() {
|
|
352
|
-
const e = this.
|
|
363
|
+
const e = this.gridElement;
|
|
353
364
|
if (e) {
|
|
354
365
|
const t = getComputedStyle(e).getPropertyValue("--tbw-animation-duration").trim(), i = parseInt(t, 10);
|
|
355
366
|
if (!isNaN(i)) return i;
|
|
@@ -401,6 +412,8 @@ function O(n) {
|
|
|
401
412
|
width: H,
|
|
402
413
|
resizable: !1,
|
|
403
414
|
sortable: !1,
|
|
415
|
+
filterable: !1,
|
|
416
|
+
// No filter button for expander column
|
|
404
417
|
meta: {
|
|
405
418
|
lockPosition: !0,
|
|
406
419
|
suppressMovable: !0,
|
|
@@ -411,7 +424,7 @@ function O(n) {
|
|
|
411
424
|
}
|
|
412
425
|
};
|
|
413
426
|
}
|
|
414
|
-
function
|
|
427
|
+
function h(n, e) {
|
|
415
428
|
const t = new Set(n);
|
|
416
429
|
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
417
430
|
}
|
|
@@ -427,14 +440,14 @@ function P(n, e) {
|
|
|
427
440
|
return n.has(e);
|
|
428
441
|
}
|
|
429
442
|
function M(n, e, t, i) {
|
|
430
|
-
const
|
|
431
|
-
|
|
443
|
+
const s = document.createElement("div");
|
|
444
|
+
s.className = "master-detail-row", s.setAttribute("data-detail-for", String(e)), s.setAttribute("role", "row");
|
|
432
445
|
const l = document.createElement("div");
|
|
433
446
|
l.className = "master-detail-cell", l.setAttribute("role", "cell"), l.style.gridColumn = `1 / ${i + 1}`;
|
|
434
447
|
const o = t(n, e);
|
|
435
|
-
return typeof o == "string" ? l.innerHTML = o : o instanceof HTMLElement && l.appendChild(o),
|
|
448
|
+
return typeof o == "string" ? l.innerHTML = o : o instanceof HTMLElement && l.appendChild(o), s.appendChild(l), s;
|
|
436
449
|
}
|
|
437
|
-
const F = ".cell[data-field=__tbw_expander]{border-right:none!important;padding:0;display:flex;align-items:center;justify-content:center}.header-row .cell[data-field=__tbw_expander]{
|
|
450
|
+
const F = "@layer tbw-plugins{tbw-grid .cell[data-field=__tbw_expander]{border-right:none!important;padding:0;display:flex;align-items:center;justify-content:center}tbw-grid .header-row .cell[data-field=__tbw_expander]{display:none}tbw-grid .header-row .cell[data-field=__tbw_expander]+.cell{grid-column:1 / 3}tbw-grid .master-detail-expander{display:flex;align-items:center;justify-content:center;width:100%;height:100%}tbw-grid .master-detail-toggle{cursor:pointer;opacity:.7;-webkit-user-select:none;user-select:none;display:inline-flex;align-items:center;justify-content:center}tbw-grid .master-detail-toggle:hover{opacity:1}tbw-grid .master-detail-row{grid-column:1 / -1;display:grid;background:var(--tbw-master-detail-bg, var(--tbw-color-row-alt));border-bottom:1px solid var(--tbw-master-detail-border, var(--tbw-color-border));overflow:hidden}tbw-grid .master-detail-cell{padding:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem));overflow:auto}tbw-grid .master-detail-row.tbw-expanding{animation:tbw-detail-expand var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}tbw-grid .master-detail-row.tbw-collapsing{animation:tbw-detail-collapse var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-detail-expand{0%{opacity:0;max-height:0;padding-top:0;padding-bottom:0}to{opacity:1;max-height:var(--tbw-detail-max-height, 31.25rem);padding-top:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem));padding-bottom:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem))}}@keyframes tbw-detail-collapse{0%{opacity:1;max-height:var(--tbw-detail-max-height, 31.25rem)}to{opacity:0;max-height:0}}}";
|
|
438
451
|
class w extends T {
|
|
439
452
|
name = "masterDetail";
|
|
440
453
|
styles = F;
|
|
@@ -491,12 +504,12 @@ class w extends T {
|
|
|
491
504
|
return;
|
|
492
505
|
}
|
|
493
506
|
}
|
|
494
|
-
const
|
|
495
|
-
|
|
507
|
+
const s = t.getAttribute("animation"), l = t.getAttribute("show-expand-column"), o = t.getAttribute("expand-on-row-click"), r = t.getAttribute("collapse-on-click-outside"), a = t.getAttribute("height"), d = {};
|
|
508
|
+
s !== null && (d.animation = s === "false" ? !1 : s), l !== null && (d.showExpandColumn = l !== "false"), o !== null && (d.expandOnRowClick = o === "true"), r !== null && (d.collapseOnClickOutside = r === "true"), a !== null && (d.detailHeight = a === "auto" ? "auto" : parseInt(a, 10));
|
|
496
509
|
const c = t.innerHTML.trim();
|
|
497
510
|
c && !this.config.detailRenderer && (d.detailRenderer = (f, G) => {
|
|
498
|
-
const
|
|
499
|
-
return _(
|
|
511
|
+
const b = D(c, { value: f, row: f });
|
|
512
|
+
return _(b);
|
|
500
513
|
}), Object.keys(d).length > 0 && (this.config = { ...this.config, ...d });
|
|
501
514
|
}
|
|
502
515
|
// #endregion
|
|
@@ -551,7 +564,7 @@ class w extends T {
|
|
|
551
564
|
* Toggle a row's detail and emit event.
|
|
552
565
|
*/
|
|
553
566
|
toggleAndEmit(e, t) {
|
|
554
|
-
this.expandedRows =
|
|
567
|
+
this.expandedRows = h(this.expandedRows, e), this.emit("detail-expand", {
|
|
555
568
|
rowIndex: t,
|
|
556
569
|
row: e,
|
|
557
570
|
expanded: this.expandedRows.has(e)
|
|
@@ -570,13 +583,13 @@ class w extends T {
|
|
|
570
583
|
const t = [...e];
|
|
571
584
|
if (k(t))
|
|
572
585
|
return t;
|
|
573
|
-
const
|
|
574
|
-
return
|
|
575
|
-
const { row: o } = l,
|
|
586
|
+
const s = O(this.name);
|
|
587
|
+
return s.viewRenderer = (l) => {
|
|
588
|
+
const { row: o } = l, r = this.expandedRows.has(o), a = document.createElement("span");
|
|
576
589
|
a.className = "master-detail-expander expander-cell";
|
|
577
590
|
const d = document.createElement("span");
|
|
578
|
-
return d.className = `master-detail-toggle${
|
|
579
|
-
}, [
|
|
591
|
+
return d.className = `master-detail-toggle${r ? " expanded" : ""}`, this.setIcon(d, this.resolveIcon(r ? "collapse" : "expand")), d.setAttribute("role", "button"), d.setAttribute("tabindex", "0"), d.setAttribute("aria-expanded", String(r)), d.setAttribute("aria-label", r ? "Collapse details" : "Expand details"), a.appendChild(d), a;
|
|
592
|
+
}, [s, ...t];
|
|
580
593
|
}
|
|
581
594
|
onRowClick(e) {
|
|
582
595
|
if (!(!this.config.expandOnRowClick || !this.config.detailRenderer))
|
|
@@ -589,8 +602,8 @@ class w extends T {
|
|
|
589
602
|
}
|
|
590
603
|
onKeyDown(e) {
|
|
591
604
|
if (e.key !== " ") return;
|
|
592
|
-
const t = this.grid._focusCol, i = this.grid._focusRow,
|
|
593
|
-
if (!
|
|
605
|
+
const t = this.grid._focusCol, i = this.grid._focusRow, s = this.columns[t];
|
|
606
|
+
if (!s || !m(s)) return;
|
|
594
607
|
const l = this.rows[i];
|
|
595
608
|
if (l)
|
|
596
609
|
return e.preventDefault(), this.toggleAndEmit(l, i), this.requestRenderWithFocus(), !0;
|
|
@@ -611,28 +624,28 @@ class w extends T {
|
|
|
611
624
|
*/
|
|
612
625
|
#e() {
|
|
613
626
|
if (!this.config.detailRenderer) return;
|
|
614
|
-
const e = this.
|
|
627
|
+
const e = this.gridElement?.querySelector(".rows");
|
|
615
628
|
if (!e) return;
|
|
616
|
-
const t = /* @__PURE__ */ new Map(), i = e.querySelectorAll(".data-grid-row"),
|
|
629
|
+
const t = /* @__PURE__ */ new Map(), i = e.querySelectorAll(".data-grid-row"), s = this.columns.length;
|
|
617
630
|
for (const o of i) {
|
|
618
|
-
const
|
|
631
|
+
const r = o.querySelector(".cell[data-row]"), a = r ? parseInt(r.getAttribute("data-row") ?? "-1", 10) : -1;
|
|
619
632
|
a >= 0 && t.set(a, o);
|
|
620
633
|
}
|
|
621
634
|
const l = e.querySelectorAll(".master-detail-row");
|
|
622
635
|
for (const o of l) {
|
|
623
|
-
const
|
|
636
|
+
const r = parseInt(o.getAttribute("data-detail-for") ?? "-1", 10), a = r >= 0 ? this.rows[r] : void 0, d = a && this.expandedRows.has(a), c = t.has(r);
|
|
624
637
|
(!d || !c) && (o.remove(), a && this.detailElements.delete(a));
|
|
625
638
|
}
|
|
626
|
-
for (const [o,
|
|
639
|
+
for (const [o, r] of t) {
|
|
627
640
|
const a = this.rows[o];
|
|
628
641
|
if (!a || !this.expandedRows.has(a)) continue;
|
|
629
642
|
const d = this.detailElements.get(a);
|
|
630
643
|
if (d) {
|
|
631
|
-
d.previousElementSibling !==
|
|
644
|
+
d.previousElementSibling !== r && r.after(d);
|
|
632
645
|
continue;
|
|
633
646
|
}
|
|
634
|
-
const c = M(a, o, this.config.detailRenderer,
|
|
635
|
-
typeof this.config.detailHeight == "number" && (c.style.height = `${this.config.detailHeight}px`),
|
|
647
|
+
const c = M(a, o, this.config.detailRenderer, s);
|
|
648
|
+
typeof this.config.detailHeight == "number" && (c.style.height = `${this.config.detailHeight}px`), r.after(c), this.detailElements.set(a, c), this.animateExpand(c);
|
|
636
649
|
}
|
|
637
650
|
}
|
|
638
651
|
/**
|
|
@@ -652,8 +665,8 @@ class w extends T {
|
|
|
652
665
|
getExtraHeightBefore(e) {
|
|
653
666
|
let t = 0;
|
|
654
667
|
for (const i of this.expandedRows) {
|
|
655
|
-
const
|
|
656
|
-
|
|
668
|
+
const s = this.rows.indexOf(i);
|
|
669
|
+
s >= 0 && s < e && (t += this.getDetailHeight(i));
|
|
657
670
|
}
|
|
658
671
|
return t;
|
|
659
672
|
}
|
|
@@ -663,16 +676,16 @@ class w extends T {
|
|
|
663
676
|
*/
|
|
664
677
|
adjustVirtualStart(e, t, i) {
|
|
665
678
|
if (this.expandedRows.size === 0) return e;
|
|
666
|
-
const
|
|
667
|
-
for (const
|
|
668
|
-
const a = this.rows.indexOf(
|
|
669
|
-
a >= 0 &&
|
|
679
|
+
const s = [];
|
|
680
|
+
for (const r of this.expandedRows) {
|
|
681
|
+
const a = this.rows.indexOf(r);
|
|
682
|
+
a >= 0 && s.push({ index: a, row: r });
|
|
670
683
|
}
|
|
671
|
-
|
|
684
|
+
s.sort((r, a) => r.index - a.index);
|
|
672
685
|
let l = e, o = 0;
|
|
673
|
-
for (const { index:
|
|
674
|
-
const d =
|
|
675
|
-
o += c, !(
|
|
686
|
+
for (const { index: r, row: a } of s) {
|
|
687
|
+
const d = r * i + o, c = this.getDetailHeight(a), f = d + i + c;
|
|
688
|
+
o += c, !(r >= e) && f > t && r < l && (l = r);
|
|
676
689
|
}
|
|
677
690
|
return l;
|
|
678
691
|
}
|
|
@@ -700,7 +713,7 @@ class w extends T {
|
|
|
700
713
|
*/
|
|
701
714
|
toggle(e) {
|
|
702
715
|
const t = this.rows[e];
|
|
703
|
-
t && (this.expandedRows =
|
|
716
|
+
t && (this.expandedRows = h(this.expandedRows, t), this.requestRender());
|
|
704
717
|
}
|
|
705
718
|
/**
|
|
706
719
|
* Check if the detail row at the given index is expanded.
|