@toolbox-web/grid 1.7.0 → 1.9.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 +51 -15
- package/all.js +717 -574
- package/all.js.map +1 -1
- package/index.js +586 -505
- package/index.js.map +1 -1
- package/lib/core/grid.d.ts +22 -1
- package/lib/core/grid.d.ts.map +1 -1
- package/lib/core/internal/header.d.ts.map +1 -1
- package/lib/core/internal/keyboard.d.ts.map +1 -1
- package/lib/core/internal/rows.d.ts.map +1 -1
- package/lib/core/internal/utils.d.ts +46 -0
- package/lib/core/internal/utils.d.ts.map +1 -1
- package/lib/core/plugin/base-plugin.d.ts +182 -1
- package/lib/core/plugin/base-plugin.d.ts.map +1 -1
- package/lib/core/plugin/index.d.ts +1 -1
- package/lib/core/plugin/index.d.ts.map +1 -1
- package/lib/core/plugin/plugin-manager.d.ts +56 -1
- package/lib/core/plugin/plugin-manager.d.ts.map +1 -1
- package/lib/core/plugin/types.d.ts +36 -0
- package/lib/core/plugin/types.d.ts.map +1 -1
- package/lib/core/types.d.ts +1232 -28
- package/lib/core/types.d.ts.map +1 -1
- package/lib/plugins/clipboard/ClipboardPlugin.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.js +140 -87
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/column-virtualization/index.js +64 -7
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/context-menu/index.js +101 -44
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/editing/EditingPlugin.d.ts +6 -1
- package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
- package/lib/plugins/editing/index.js +95 -13
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/export/index.js +91 -34
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/FilteringPlugin.d.ts +6 -1
- package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -1
- package/lib/plugins/filtering/index.js +192 -123
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/index.js +57 -0
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts +7 -2
- package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts.map +1 -1
- package/lib/plugins/grouping-rows/index.js +139 -60
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/master-detail/index.js +69 -12
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/multi-sort/index.js +70 -13
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts +16 -9
- package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts.map +1 -1
- package/lib/plugins/pinned-columns/index.js +158 -61
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-columns/pinned-columns.d.ts +24 -7
- package/lib/plugins/pinned-columns/pinned-columns.d.ts.map +1 -1
- package/lib/plugins/pinned-columns/types.d.ts +51 -2
- package/lib/plugins/pinned-columns/types.d.ts.map +1 -1
- package/lib/plugins/pinned-rows/index.js +57 -0
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pivot/index.js +57 -0
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/print/index.js +58 -1
- package/lib/plugins/print/index.js.map +1 -1
- package/lib/plugins/reorder/ReorderPlugin.d.ts.map +1 -1
- package/lib/plugins/reorder/column-drag.d.ts +2 -2
- package/lib/plugins/reorder/index.js +68 -17
- package/lib/plugins/reorder/index.js.map +1 -1
- package/lib/plugins/responsive/ResponsivePlugin.d.ts +6 -1
- package/lib/plugins/responsive/ResponsivePlugin.d.ts.map +1 -1
- package/lib/plugins/responsive/index.js +299 -85
- package/lib/plugins/responsive/index.js.map +1 -1
- package/lib/plugins/row-reorder/index.js +169 -112
- package/lib/plugins/row-reorder/index.js.map +1 -1
- package/lib/plugins/selection/SelectionPlugin.d.ts +14 -2
- package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
- package/lib/plugins/selection/index.js +84 -7
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/server-side/index.js +79 -22
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/tree/TreePlugin.d.ts +7 -1
- package/lib/plugins/tree/TreePlugin.d.ts.map +1 -1
- package/lib/plugins/tree/index.js +143 -61
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/undo-redo/UndoRedoPlugin.d.ts +6 -1
- package/lib/plugins/undo-redo/UndoRedoPlugin.d.ts.map +1 -1
- package/lib/plugins/undo-redo/index.js +79 -10
- package/lib/plugins/undo-redo/index.js.map +1 -1
- package/lib/plugins/visibility/index.js +57 -0
- package/lib/plugins/visibility/index.js.map +1 -1
- package/package.json +1 -1
- package/public.d.ts +79 -1
- package/public.d.ts.map +1 -1
- package/umd/grid.all.umd.js +25 -25
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +11 -11
- package/umd/grid.umd.js.map +1 -1
- package/umd/plugins/clipboard.umd.js +5 -5
- package/umd/plugins/clipboard.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-rows.umd.js +2 -2
- package/umd/plugins/grouping-rows.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/print.umd.js +1 -1
- package/umd/plugins/print.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/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
- package/umd/plugins/tree.umd.js +1 -1
- package/umd/plugins/tree.umd.js.map +1 -1
- package/umd/plugins/undo-redo.umd.js +1 -1
- package/umd/plugins/undo-redo.umd.js.map +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseGridPlugin, GridElement, PluginManifest } from '../../core/plugin/base-plugin';
|
|
1
|
+
import { BaseGridPlugin, GridElement, PluginManifest, PluginQuery } from '../../core/plugin/base-plugin';
|
|
2
2
|
import { BreakpointConfig, ResponsivePluginConfig } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* Responsive Plugin for tbw-grid
|
|
@@ -90,6 +90,11 @@ export declare class ResponsivePlugin<T = unknown> extends BaseGridPlugin<Respon
|
|
|
90
90
|
getActiveBreakpoint(): BreakpointConfig | null;
|
|
91
91
|
attach(grid: GridElement): void;
|
|
92
92
|
detach(): void;
|
|
93
|
+
/**
|
|
94
|
+
* Handle plugin queries.
|
|
95
|
+
* @internal
|
|
96
|
+
*/
|
|
97
|
+
handleQuery(query: PluginQuery): unknown;
|
|
93
98
|
/**
|
|
94
99
|
* Apply hidden and value-only columns.
|
|
95
100
|
* In legacy mode (single breakpoint), only applies when in responsive mode.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResponsivePlugin.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/responsive/ResponsivePlugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;
|
|
1
|
+
{"version":3,"file":"ResponsivePlugin.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/responsive/ResponsivePlugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAIH,OAAO,EAAE,cAAc,EAAE,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,KAAK,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAGxH,OAAO,KAAK,EAAE,gBAAgB,EAA8C,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEpH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,qBAAa,gBAAgB,CAAC,CAAC,GAAG,OAAO,CAAE,SAAQ,cAAc,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC;;IAC1F,QAAQ,CAAC,IAAI,gBAAgB;IAC7B,SAAkB,OAAO,WAAW;IACpC,SAAkB,MAAM,SAAU;IAElC;;OAEG;IACH,gBAAyB,QAAQ,EAAE,cAAc,CAe/C;IAgBF;;;OAGG;IACH,YAAY,IAAI,OAAO;IAIvB;;;;OAIG;IACH,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAYrC;;;OAGG;IACH,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAKlC;;;;OAIG;IACH,eAAe,CAAC,QAAQ,EAAE,sBAAsB,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,GAAG,IAAI;IAQ1E;;;OAGG;IACH,QAAQ,IAAI,MAAM;IAIlB;;;OAGG;IACH,mBAAmB,IAAI,gBAAgB,GAAG,IAAI;IAIrC,MAAM,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI;IA+J/B,MAAM,IAAI,IAAI;IAcvB;;;OAGG;IACM,WAAW,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO;IAOjD;;;;OAIG;IACM,WAAW,IAAI,IAAI;IAyL5B;;;;;;;;;;OAUG;IACM,SAAS,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI;IAqCtF;;;;;;;;;;;;;OAaG;IACM,SAAS,CAAC,CAAC,EAAE,aAAa,GAAG,OAAO;IAkK7C;;;;;;;;;;OAUG;IACM,cAAc,IAAI,MAAM;IAyBjC;;;;;OAKG;IACM,oBAAoB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM;CA8H9D"}
|
|
@@ -1,41 +1,135 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
const R = /{{\s*([^}]+)\s*}}/g, u = "__DG_EMPTY__", y = /^[\w$. '?+\-*/%:()!<>=,&|]+$/, _ = /__(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/, C = /* @__PURE__ */ new Set([
|
|
2
|
+
"script",
|
|
3
|
+
"iframe",
|
|
4
|
+
"object",
|
|
5
|
+
"embed",
|
|
6
|
+
"form",
|
|
7
|
+
"input",
|
|
8
|
+
"button",
|
|
9
|
+
"textarea",
|
|
10
|
+
"select",
|
|
11
|
+
"link",
|
|
12
|
+
"meta",
|
|
13
|
+
"base",
|
|
14
|
+
"style",
|
|
15
|
+
"template",
|
|
16
|
+
"slot",
|
|
17
|
+
"portal",
|
|
18
|
+
"frame",
|
|
19
|
+
"frameset",
|
|
20
|
+
"applet",
|
|
21
|
+
"noscript",
|
|
22
|
+
"noembed",
|
|
23
|
+
"plaintext",
|
|
24
|
+
"xmp",
|
|
25
|
+
"listing"
|
|
26
|
+
]), m = /^on\w+$/i, E = /* @__PURE__ */ new Set(["href", "src", "action", "formaction", "data", "srcdoc", "xlink:href", "poster", "srcset"]), A = /^\s*(javascript|vbscript|data|blob):/i;
|
|
27
|
+
function S(r) {
|
|
28
|
+
if (!r || typeof r != "string") return "";
|
|
29
|
+
if (r.indexOf("<") === -1) return r;
|
|
30
|
+
const t = document.createElement("template");
|
|
31
|
+
return t.innerHTML = r, k(t.content), t.innerHTML;
|
|
3
32
|
}
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
if (d && h > 0) {
|
|
12
|
-
const c = s._focusRow * r;
|
|
13
|
-
c < d.scrollTop ? d.scrollTop = c : c + r > d.scrollTop + h && (d.scrollTop = c - h + r);
|
|
33
|
+
function k(r) {
|
|
34
|
+
const t = [], e = r.querySelectorAll("*");
|
|
35
|
+
for (const i of e) {
|
|
36
|
+
const n = i.tagName.toLowerCase();
|
|
37
|
+
if (C.has(n)) {
|
|
38
|
+
t.push(i);
|
|
39
|
+
continue;
|
|
14
40
|
}
|
|
41
|
+
if ((n === "svg" || i.namespaceURI === "http://www.w3.org/2000/svg") && Array.from(i.attributes).some(
|
|
42
|
+
(o) => m.test(o.name) || o.name === "href" || o.name === "xlink:href"
|
|
43
|
+
)) {
|
|
44
|
+
t.push(i);
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
const a = [];
|
|
48
|
+
for (const s of i.attributes) {
|
|
49
|
+
const o = s.name.toLowerCase();
|
|
50
|
+
if (m.test(o)) {
|
|
51
|
+
a.push(s.name);
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
if (E.has(o) && A.test(s.value)) {
|
|
55
|
+
a.push(s.name);
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
if (o === "style" && /expression\s*\(|javascript:|behavior\s*:/i.test(s.value)) {
|
|
59
|
+
a.push(s.name);
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
a.forEach((s) => i.removeAttribute(s));
|
|
64
|
+
}
|
|
65
|
+
t.forEach((i) => i.remove());
|
|
66
|
+
}
|
|
67
|
+
function H(r, t) {
|
|
68
|
+
if (!r || r.indexOf("{{") === -1) return r;
|
|
69
|
+
const e = [], i = r.replace(R, (o, d) => {
|
|
70
|
+
const l = T(d, t);
|
|
71
|
+
return e.push({ expr: d.trim(), result: l }), l;
|
|
72
|
+
}), n = L(i), a = e.length && e.every((o) => o.result === "" || o.result === u);
|
|
73
|
+
return /Reflect\.|\bProxy\b|ownKeys\(/.test(r) || a ? "" : n;
|
|
74
|
+
}
|
|
75
|
+
function T(r, t) {
|
|
76
|
+
if (r = (r || "").trim(), !r || /\b(Reflect|Proxy|ownKeys)\b/.test(r)) return u;
|
|
77
|
+
if (r === "value") return t.value == null ? u : String(t.value);
|
|
78
|
+
if (r.startsWith("row.") && !/[()?]/.test(r) && !r.includes(":")) {
|
|
79
|
+
const i = r.slice(4), n = t.row ? t.row[i] : void 0;
|
|
80
|
+
return n == null ? u : String(n);
|
|
81
|
+
}
|
|
82
|
+
if (r.length > 80 || !y.test(r) || _.test(r)) return u;
|
|
83
|
+
const e = r.match(/\./g);
|
|
84
|
+
if (e && e.length > 1) return u;
|
|
85
|
+
try {
|
|
86
|
+
const n = new Function("value", "row", `return (${r});`)(t.value, t.row), a = n == null ? "" : String(n);
|
|
87
|
+
return /Reflect|Proxy|ownKeys/.test(a) ? u : a || u;
|
|
88
|
+
} catch {
|
|
89
|
+
return u;
|
|
15
90
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
91
|
+
}
|
|
92
|
+
function L(r) {
|
|
93
|
+
return r && r.replace(new RegExp(u, "g"), "").replace(/Reflect\.[^<>{}\s]+/g, "").replace(/\bProxy\b/g, "").replace(/ownKeys\([^)]*\)/g, "");
|
|
94
|
+
}
|
|
95
|
+
function x(r) {
|
|
96
|
+
r && r.querySelectorAll(".cell-focus").forEach((t) => t.classList.remove("cell-focus"));
|
|
97
|
+
}
|
|
98
|
+
const M = 'input,select,textarea,[contenteditable="true"],[contenteditable=""],[tabindex]:not([tabindex="-1"])', D = document.createElement("template");
|
|
99
|
+
D.innerHTML = '<div class="cell" role="gridcell" part="cell"></div>';
|
|
100
|
+
const q = document.createElement("template");
|
|
101
|
+
q.innerHTML = '<div class="data-grid-row" role="row" part="row"></div>';
|
|
102
|
+
function g(r, t) {
|
|
103
|
+
if (r._virtualization?.enabled) {
|
|
104
|
+
const { rowHeight: s, container: o, viewportEl: d } = r._virtualization, l = o, h = d?.clientHeight ?? l?.clientHeight ?? 0;
|
|
105
|
+
if (l && h > 0) {
|
|
106
|
+
const c = r._focusRow * s;
|
|
107
|
+
c < l.scrollTop ? l.scrollTop = c : c + s > l.scrollTop + h && (l.scrollTop = c - h + s);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
const e = r._activeEditRows !== void 0 && r._activeEditRows !== -1;
|
|
111
|
+
e || r.refreshVirtualWindow(!1), x(r._bodyEl), Array.from(r._bodyEl.querySelectorAll('[aria-selected="true"]')).forEach((s) => {
|
|
112
|
+
s.setAttribute("aria-selected", "false");
|
|
19
113
|
});
|
|
20
|
-
const i =
|
|
114
|
+
const i = r._focusRow, n = r._virtualization.start ?? 0, a = r._virtualization.end ?? r._rows.length;
|
|
21
115
|
if (i >= n && i < a) {
|
|
22
|
-
const
|
|
23
|
-
let o =
|
|
24
|
-
if ((!o || !o.classList?.contains("cell")) && (o =
|
|
116
|
+
const s = r._bodyEl.querySelectorAll(".data-grid-row")[i - n];
|
|
117
|
+
let o = s?.children[r._focusCol];
|
|
118
|
+
if ((!o || !o.classList?.contains("cell")) && (o = s?.querySelector(`.cell[data-col="${r._focusCol}"]`) ?? s?.querySelector(".cell[data-col]")), o) {
|
|
25
119
|
o.classList.add("cell-focus"), o.setAttribute("aria-selected", "true");
|
|
26
|
-
const
|
|
27
|
-
if (
|
|
28
|
-
const
|
|
29
|
-
if (!
|
|
30
|
-
const h = o.getBoundingClientRect(), c =
|
|
31
|
-
|
|
120
|
+
const d = r.querySelector(".tbw-scroll-area");
|
|
121
|
+
if (d && o && !e) {
|
|
122
|
+
const l = r._getHorizontalScrollOffsets?.(s ?? void 0, o) ?? { left: 0, right: 0 };
|
|
123
|
+
if (!l.skipScroll) {
|
|
124
|
+
const h = o.getBoundingClientRect(), c = d.getBoundingClientRect(), f = h.left - c.left + d.scrollLeft, w = f + h.width, p = d.scrollLeft + l.left, b = d.scrollLeft + d.clientWidth - l.right;
|
|
125
|
+
f < p ? d.scrollLeft = f - l.left : w > b && (d.scrollLeft = w - d.clientWidth + l.right);
|
|
32
126
|
}
|
|
33
127
|
}
|
|
34
|
-
if (
|
|
35
|
-
const
|
|
36
|
-
if (
|
|
128
|
+
if (r._activeEditRows !== void 0 && r._activeEditRows !== -1 && o.classList.contains("editing")) {
|
|
129
|
+
const l = o.querySelector(M);
|
|
130
|
+
if (l && document.activeElement !== l)
|
|
37
131
|
try {
|
|
38
|
-
|
|
132
|
+
l.focus({ preventScroll: !0 });
|
|
39
133
|
} catch {
|
|
40
134
|
}
|
|
41
135
|
} else if (!o.contains(document.activeElement)) {
|
|
@@ -48,7 +142,7 @@ function u(s, t) {
|
|
|
48
142
|
}
|
|
49
143
|
}
|
|
50
144
|
}
|
|
51
|
-
const
|
|
145
|
+
const v = '<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>', N = {
|
|
52
146
|
expand: "▶",
|
|
53
147
|
collapse: "▼",
|
|
54
148
|
sortAsc: "▲",
|
|
@@ -57,11 +151,11 @@ const p = '<svg viewBox="0 0 16 16" width="12" height="12"><path fill="currentCo
|
|
|
57
151
|
submenuArrow: "▶",
|
|
58
152
|
dragHandle: "⋮⋮",
|
|
59
153
|
toolPanel: "☰",
|
|
60
|
-
filter:
|
|
61
|
-
filterActive:
|
|
154
|
+
filter: v,
|
|
155
|
+
filterActive: v,
|
|
62
156
|
print: "🖨️"
|
|
63
157
|
};
|
|
64
|
-
class
|
|
158
|
+
class P {
|
|
65
159
|
/**
|
|
66
160
|
* Plugin dependencies - declare other plugins this one requires.
|
|
67
161
|
*
|
|
@@ -199,6 +293,63 @@ class _ {
|
|
|
199
293
|
const i = new CustomEvent(t, { detail: e, bubbles: !0, cancelable: !0 });
|
|
200
294
|
return this.grid?.dispatchEvent?.(i), i.defaultPrevented;
|
|
201
295
|
}
|
|
296
|
+
// =========================================================================
|
|
297
|
+
// Event Bus - Plugin-to-Plugin Communication
|
|
298
|
+
// =========================================================================
|
|
299
|
+
/**
|
|
300
|
+
* Subscribe to an event from another plugin.
|
|
301
|
+
* The subscription is automatically cleaned up when this plugin is detached.
|
|
302
|
+
*
|
|
303
|
+
* @category Plugin Development
|
|
304
|
+
* @param eventType - The event type to listen for (e.g., 'filter-change')
|
|
305
|
+
* @param callback - The callback to invoke when the event is emitted
|
|
306
|
+
*
|
|
307
|
+
* @example
|
|
308
|
+
* ```typescript
|
|
309
|
+
* // In attach() or other initialization
|
|
310
|
+
* this.on('filter-change', (detail) => {
|
|
311
|
+
* console.log('Filter changed:', detail);
|
|
312
|
+
* });
|
|
313
|
+
* ```
|
|
314
|
+
*/
|
|
315
|
+
on(t, e) {
|
|
316
|
+
this.grid?._pluginManager?.subscribe(this, t, e);
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Unsubscribe from a plugin event.
|
|
320
|
+
*
|
|
321
|
+
* @category Plugin Development
|
|
322
|
+
* @param eventType - The event type to stop listening for
|
|
323
|
+
*
|
|
324
|
+
* @example
|
|
325
|
+
* ```typescript
|
|
326
|
+
* this.off('filter-change');
|
|
327
|
+
* ```
|
|
328
|
+
*/
|
|
329
|
+
off(t) {
|
|
330
|
+
this.grid?._pluginManager?.unsubscribe(this, t);
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Emit an event to other plugins via the Event Bus.
|
|
334
|
+
* This is for inter-plugin communication only; it does NOT dispatch DOM events.
|
|
335
|
+
* Use `emit()` to dispatch DOM events that external consumers can listen to.
|
|
336
|
+
*
|
|
337
|
+
* @category Plugin Development
|
|
338
|
+
* @param eventType - The event type to emit (should be declared in manifest.events)
|
|
339
|
+
* @param detail - The event payload
|
|
340
|
+
*
|
|
341
|
+
* @example
|
|
342
|
+
* ```typescript
|
|
343
|
+
* // Emit to other plugins (not DOM)
|
|
344
|
+
* this.emitPluginEvent('filter-change', { field: 'name', value: 'Alice' });
|
|
345
|
+
*
|
|
346
|
+
* // For DOM events that consumers can addEventListener to:
|
|
347
|
+
* this.emit('filter-change', { field: 'name', value: 'Alice' });
|
|
348
|
+
* ```
|
|
349
|
+
*/
|
|
350
|
+
emitPluginEvent(t, e) {
|
|
351
|
+
this.grid?._pluginManager?.emitPluginEvent(t, e);
|
|
352
|
+
}
|
|
202
353
|
/**
|
|
203
354
|
* Request a re-render of the grid.
|
|
204
355
|
*/
|
|
@@ -285,7 +436,7 @@ class _ {
|
|
|
285
436
|
*/
|
|
286
437
|
get gridIcons() {
|
|
287
438
|
const t = this.grid?.gridConfig?.icons ?? {};
|
|
288
|
-
return { ...
|
|
439
|
+
return { ...N, ...t };
|
|
289
440
|
}
|
|
290
441
|
// #region Animation Helpers
|
|
291
442
|
/**
|
|
@@ -361,11 +512,11 @@ class _ {
|
|
|
361
512
|
}
|
|
362
513
|
// #endregion
|
|
363
514
|
}
|
|
364
|
-
const
|
|
365
|
-
class
|
|
515
|
+
const I = 'tbw-grid[data-responsive-animate] .data-grid-row,tbw-grid[data-responsive-animate] .data-grid-row>.cell{transition:opacity var(--tbw-responsive-duration, .2s) ease-out,transform var(--tbw-responsive-duration, .2s) ease-out}tbw-grid[data-responsive][data-responsive-animate] .data-grid-row{animation:responsive-card-enter var(--tbw-responsive-duration, .2s) ease-out}@keyframes responsive-card-enter{0%{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}tbw-grid[data-responsive] .header{display:none!important}tbw-grid[data-responsive] .footer-row{display:none}tbw-grid[data-responsive] .tbw-scroll-area{overflow-x:hidden;min-width:0!important}tbw-grid[data-responsive] .rows-body-wrapper{min-width:0!important}tbw-grid[data-responsive] .data-grid-row:not(.group-row){display:block!important;grid-template-columns:none!important;padding:var(--tbw-cell-padding);padding-inline-start:var(--tbw-spacing-xl);border-bottom:1px solid var(--tbw-color-border);min-height:auto!important;height:auto!important;contain:none!important;content-visibility:visible!important;background:var(--tbw-color-bg);position:relative}tbw-grid[data-responsive] .data-grid-row:not(.group-row):nth-child(2n){background:var(--tbw-color-row-alt)}tbw-grid[data-responsive] .data-grid-row:not(.group-row):hover{background:var(--tbw-color-row-hover)}tbw-grid[data-responsive] .data-grid-row:not(.group-row)[aria-selected=true]{background:var(--tbw-color-selection)}tbw-grid[data-responsive] .data-grid-row:not(.group-row)[aria-selected=true]:before{content:"";position:absolute;inset-inline-start:0;top:0;bottom:0;width:4px;background:var(--tbw-color-accent)}tbw-grid[data-responsive] .data-grid-row:not(.group-row)>.cell{display:flex!important;justify-content:space-between;align-items:center;padding:var(--tbw-spacing-xs) var(--tbw-spacing-md);width:100%!important;min-width:0!important;min-height:auto!important;height:auto!important;line-height:1.5!important;position:static!important;left:auto!important;right:auto!important;border:none!important;border-bottom:none!important;border-inline-end:none!important;background:transparent!important;white-space:normal!important;overflow:visible!important}tbw-grid[data-responsive] .data-grid-row:not(.group-row)>.cell:before{content:attr(data-header) ": ";font-weight:600;color:var(--tbw-color-header-fg);flex-shrink:0;margin-inline-end:var(--tbw-spacing-md);min-width:100px}tbw-grid[data-responsive] .data-grid-row:not(.group-row)>.cell:after{content:none}tbw-grid[data-responsive] .cell[data-utility]{display:none!important}tbw-grid[data-responsive] .cell[data-responsive-hidden]{display:none!important}tbw-grid[data-responsive] .cell[data-responsive-value-only]{justify-content:flex-start!important;font-weight:500}tbw-grid[data-responsive] .cell[data-responsive-value-only]:before{display:none!important}tbw-grid:not([data-responsive]) .cell[data-responsive-hidden]{display:none!important}tbw-grid[data-responsive] .tbw-footer,tbw-grid[data-responsive] .tbw-pinned-rows,tbw-grid[data-responsive] .tbw-aggregation-rows{display:none!important}tbw-grid[data-responsive] .tbw-pinned-rows,tbw-grid[data-responsive] .tbw-aggregation-rows,tbw-grid[data-responsive] .tbw-aggregation-row{min-width:0!important}tbw-grid[data-responsive] .data-grid-row.responsive-card{display:block!important;padding:var(--tbw-cell-padding);border-bottom:1px solid var(--tbw-color-border)}tbw-grid[data-responsive] .data-grid-row.responsive-card>*{width:100%}tbw-grid[data-responsive] .data-grid-row.responsive-card .cell:before{display:none}';
|
|
516
|
+
class B extends P {
|
|
366
517
|
name = "responsive";
|
|
367
518
|
version = "1.0.0";
|
|
368
|
-
styles =
|
|
519
|
+
styles = I;
|
|
369
520
|
/**
|
|
370
521
|
* Plugin manifest declaring incompatibilities with other plugins.
|
|
371
522
|
*/
|
|
@@ -375,6 +526,12 @@ class A extends _ {
|
|
|
375
526
|
name: "groupingRows",
|
|
376
527
|
reason: "Responsive card layout does not yet support row grouping. The variable row heights (cards vs group headers) cause scroll calculation issues."
|
|
377
528
|
}
|
|
529
|
+
],
|
|
530
|
+
queries: [
|
|
531
|
+
{
|
|
532
|
+
type: "isCardMode",
|
|
533
|
+
description: "Returns whether the grid is currently in responsive card mode"
|
|
534
|
+
}
|
|
378
535
|
]
|
|
379
536
|
};
|
|
380
537
|
#e;
|
|
@@ -385,11 +542,11 @@ class A extends _ {
|
|
|
385
542
|
/** Set of column fields to completely hide */
|
|
386
543
|
#s = /* @__PURE__ */ new Set();
|
|
387
544
|
/** Set of column fields to show value only (no header label) */
|
|
388
|
-
#
|
|
545
|
+
#l = /* @__PURE__ */ new Set();
|
|
389
546
|
/** Currently active breakpoint, or null if none */
|
|
390
|
-
#
|
|
547
|
+
#c = null;
|
|
391
548
|
/** Sorted breakpoints from largest to smallest */
|
|
392
|
-
#
|
|
549
|
+
#d = [];
|
|
393
550
|
/**
|
|
394
551
|
* Check if currently in responsive mode.
|
|
395
552
|
* @returns `true` if the grid is in card layout mode
|
|
@@ -403,7 +560,7 @@ class A extends _ {
|
|
|
403
560
|
* @param enabled - Whether to enable responsive mode
|
|
404
561
|
*/
|
|
405
562
|
setResponsive(t) {
|
|
406
|
-
t !== this.#t && (this.#t = t, this.#
|
|
563
|
+
t !== this.#t && (this.#t = t, this.#h(), this.emit("responsive-change", {
|
|
407
564
|
isResponsive: t,
|
|
408
565
|
width: this.#a,
|
|
409
566
|
breakpoint: this.config.breakpoint ?? 0
|
|
@@ -414,7 +571,7 @@ class A extends _ {
|
|
|
414
571
|
* @param width - New breakpoint width in pixels
|
|
415
572
|
*/
|
|
416
573
|
setBreakpoint(t) {
|
|
417
|
-
this.config.breakpoint = t, this.#
|
|
574
|
+
this.config.breakpoint = t, this.#m(this.#a);
|
|
418
575
|
}
|
|
419
576
|
/**
|
|
420
577
|
* Set a custom card renderer.
|
|
@@ -436,51 +593,108 @@ class A extends _ {
|
|
|
436
593
|
* @returns The active BreakpointConfig, or null if no breakpoint is active
|
|
437
594
|
*/
|
|
438
595
|
getActiveBreakpoint() {
|
|
439
|
-
return this.#
|
|
596
|
+
return this.#c;
|
|
440
597
|
}
|
|
441
598
|
attach(t) {
|
|
442
|
-
super.attach(t), this.#
|
|
599
|
+
super.attach(t), this.#R(), this.#u(this.config.hiddenColumns), this.config.breakpoints?.length && (this.#d = [...this.config.breakpoints].sort((e, i) => i.maxWidth - e.maxWidth)), this.#e = new ResizeObserver((e) => {
|
|
443
600
|
const i = e[0]?.contentRect.width ?? 0;
|
|
444
601
|
this.#a = i, clearTimeout(this.#n), this.#n = setTimeout(() => {
|
|
445
|
-
this.#
|
|
602
|
+
this.#m(i);
|
|
446
603
|
}, this.config.debounceMs ?? 100);
|
|
447
604
|
}), this.#e.observe(this.gridElement);
|
|
448
605
|
}
|
|
606
|
+
// #region Light DOM Parsing
|
|
607
|
+
/**
|
|
608
|
+
* Parse `<tbw-grid-responsive-card>` elements from the grid's light DOM.
|
|
609
|
+
*
|
|
610
|
+
* Allows declarative configuration:
|
|
611
|
+
* ```html
|
|
612
|
+
* <tbw-grid [rows]="data">
|
|
613
|
+
* <tbw-grid-responsive-card breakpoint="500" card-row-height="80">
|
|
614
|
+
* <div class="custom-card">
|
|
615
|
+
* <strong>{{ row.name }}</strong>
|
|
616
|
+
* <span>{{ row.email }}</span>
|
|
617
|
+
* </div>
|
|
618
|
+
* </tbw-grid-responsive-card>
|
|
619
|
+
* </tbw-grid>
|
|
620
|
+
* ```
|
|
621
|
+
*
|
|
622
|
+
* Attributes:
|
|
623
|
+
* - `breakpoint`: number - Width threshold for responsive mode
|
|
624
|
+
* - `card-row-height`: number | 'auto' - Card height (default: 'auto')
|
|
625
|
+
* - `hidden-columns`: string - Comma-separated fields to hide
|
|
626
|
+
* - `hide-header`: 'true' | 'false' - Hide header row (default: 'true')
|
|
627
|
+
* - `debounce-ms`: number - Resize debounce delay (default: 100)
|
|
628
|
+
*/
|
|
629
|
+
#R() {
|
|
630
|
+
const t = this.grid;
|
|
631
|
+
if (!t || typeof t.querySelector != "function") return;
|
|
632
|
+
const e = t.querySelector("tbw-grid-responsive-card");
|
|
633
|
+
if (!e) return;
|
|
634
|
+
const i = t;
|
|
635
|
+
if (i.__frameworkAdapter?.parseResponsiveCardElement) {
|
|
636
|
+
const c = i.__frameworkAdapter.parseResponsiveCardElement(e);
|
|
637
|
+
c && (this.config = { ...this.config, cardRenderer: c });
|
|
638
|
+
}
|
|
639
|
+
const n = e.getAttribute("breakpoint"), a = e.getAttribute("card-row-height"), s = e.getAttribute("hidden-columns"), o = e.getAttribute("hide-header"), d = e.getAttribute("debounce-ms"), l = {};
|
|
640
|
+
if (n !== null) {
|
|
641
|
+
const c = parseInt(n, 10);
|
|
642
|
+
isNaN(c) || (l.breakpoint = c);
|
|
643
|
+
}
|
|
644
|
+
if (a !== null && (l.cardRowHeight = a === "auto" ? "auto" : parseInt(a, 10)), s !== null && (l.hiddenColumns = s.split(",").map((c) => c.trim()).filter((c) => c.length > 0)), o !== null && (l.hideHeader = o !== "false"), d !== null) {
|
|
645
|
+
const c = parseInt(d, 10);
|
|
646
|
+
isNaN(c) || (l.debounceMs = c);
|
|
647
|
+
}
|
|
648
|
+
const h = e.innerHTML.trim();
|
|
649
|
+
h && !this.config.cardRenderer && !i.__frameworkAdapter?.parseResponsiveCardElement && (l.cardRenderer = (c) => {
|
|
650
|
+
const f = H(h, { value: c, row: c }), w = S(f), p = document.createElement("div");
|
|
651
|
+
return p.className = "tbw-responsive-card-content", p.innerHTML = w, p;
|
|
652
|
+
}), Object.keys(l).length > 0 && (this.config = { ...this.config, ...l });
|
|
653
|
+
}
|
|
654
|
+
// #endregion
|
|
449
655
|
/**
|
|
450
656
|
* Build the hidden and value-only column sets from config.
|
|
451
657
|
*/
|
|
452
|
-
#
|
|
453
|
-
if (this.#s.clear(), this.#
|
|
658
|
+
#u(t) {
|
|
659
|
+
if (this.#s.clear(), this.#l.clear(), !!t)
|
|
454
660
|
for (const e of t)
|
|
455
|
-
typeof e == "string" ? this.#s.add(e) : e.showValue ? this.#
|
|
661
|
+
typeof e == "string" ? this.#s.add(e) : e.showValue ? this.#l.add(e.field) : this.#s.add(e.field);
|
|
456
662
|
}
|
|
457
663
|
detach() {
|
|
458
664
|
this.#e?.disconnect(), this.#e = void 0, clearTimeout(this.#n), this.#n = void 0, this.gridElement && this.gridElement.removeAttribute("data-responsive"), super.detach();
|
|
459
665
|
}
|
|
666
|
+
/**
|
|
667
|
+
* Handle plugin queries.
|
|
668
|
+
* @internal
|
|
669
|
+
*/
|
|
670
|
+
handleQuery(t) {
|
|
671
|
+
if (t.type === "isCardMode")
|
|
672
|
+
return this.#t;
|
|
673
|
+
}
|
|
460
674
|
/**
|
|
461
675
|
* Apply hidden and value-only columns.
|
|
462
676
|
* In legacy mode (single breakpoint), only applies when in responsive mode.
|
|
463
677
|
* In multi-breakpoint mode, applies whenever there's an active breakpoint.
|
|
464
678
|
*/
|
|
465
679
|
afterRender() {
|
|
466
|
-
if (this.#
|
|
680
|
+
if (this.#E(), !(this.#d.length > 0 ? this.#c !== null : this.#t))
|
|
467
681
|
return;
|
|
468
|
-
const e = this.#s.size > 0, i = this.#
|
|
682
|
+
const e = this.#s.size > 0, i = this.#l.size > 0;
|
|
469
683
|
if (!e && !i)
|
|
470
684
|
return;
|
|
471
685
|
const n = this.gridElement.querySelectorAll(".cell[data-field]");
|
|
472
686
|
for (const a of n) {
|
|
473
|
-
const
|
|
474
|
-
|
|
687
|
+
const s = a.getAttribute("data-field");
|
|
688
|
+
s && (this.#s.has(s) ? (a.setAttribute("data-responsive-hidden", ""), a.removeAttribute("data-responsive-value-only")) : this.#l.has(s) ? (a.setAttribute("data-responsive-value-only", ""), a.removeAttribute("data-responsive-hidden")) : (a.removeAttribute("data-responsive-hidden"), a.removeAttribute("data-responsive-value-only")));
|
|
475
689
|
}
|
|
476
690
|
}
|
|
477
691
|
/**
|
|
478
692
|
* Check if width has crossed any breakpoint threshold.
|
|
479
693
|
* Handles both single breakpoint (legacy) and multi-breakpoint modes.
|
|
480
694
|
*/
|
|
481
|
-
#
|
|
482
|
-
if (this.#
|
|
483
|
-
this.#
|
|
695
|
+
#m(t) {
|
|
696
|
+
if (this.#d.length > 0) {
|
|
697
|
+
this.#y(t);
|
|
484
698
|
return;
|
|
485
699
|
}
|
|
486
700
|
const e = this.config.breakpoint ?? 0;
|
|
@@ -488,7 +702,7 @@ class A extends _ {
|
|
|
488
702
|
"[tbw-grid:ResponsivePlugin] No breakpoint configured. Responsive mode is disabled. Set a breakpoint based on your grid's column count."
|
|
489
703
|
));
|
|
490
704
|
const i = e > 0 && t < e;
|
|
491
|
-
i !== this.#t && (this.#t = i, this.#
|
|
705
|
+
i !== this.#t && (this.#t = i, this.#h(), this.emit("responsive-change", {
|
|
492
706
|
isResponsive: i,
|
|
493
707
|
width: t,
|
|
494
708
|
breakpoint: e
|
|
@@ -498,14 +712,14 @@ class A extends _ {
|
|
|
498
712
|
* Check breakpoints in multi-breakpoint mode.
|
|
499
713
|
* Evaluates breakpoints from largest to smallest, applying the first match.
|
|
500
714
|
*/
|
|
501
|
-
#
|
|
715
|
+
#y(t) {
|
|
502
716
|
let e = null;
|
|
503
|
-
for (const n of this.#
|
|
717
|
+
for (const n of this.#d)
|
|
504
718
|
t <= n.maxWidth && (e = n);
|
|
505
|
-
if (e !== this.#
|
|
506
|
-
this.#
|
|
719
|
+
if (e !== this.#c) {
|
|
720
|
+
this.#c = e, e?.hiddenColumns ? this.#u(e.hiddenColumns) : this.#u(this.config.hiddenColumns);
|
|
507
721
|
const n = e?.cardLayout === !0;
|
|
508
|
-
n !== this.#t && (this.#t = n, this.#
|
|
722
|
+
n !== this.#t && (this.#t = n, this.#h()), this.emit("responsive-change", {
|
|
509
723
|
isResponsive: this.#t,
|
|
510
724
|
width: t,
|
|
511
725
|
breakpoint: e?.maxWidth ?? 0
|
|
@@ -518,7 +732,7 @@ class A extends _ {
|
|
|
518
732
|
* Apply the responsive state to the grid element.
|
|
519
733
|
* Handles scroll reset when entering responsive mode and row height restoration on exit.
|
|
520
734
|
*/
|
|
521
|
-
#
|
|
735
|
+
#h() {
|
|
522
736
|
this.gridElement.toggleAttribute("data-responsive", this.#t);
|
|
523
737
|
const t = this.config.animate !== !1;
|
|
524
738
|
this.gridElement.toggleAttribute("data-responsive-animate", t), this.config.animationDuration && this.gridElement.style.setProperty("--tbw-responsive-duration", `${this.config.animationDuration}ms`);
|
|
@@ -575,23 +789,23 @@ class A extends _ {
|
|
|
575
789
|
switch (t.key) {
|
|
576
790
|
case "ArrowDown":
|
|
577
791
|
if (this.grid._focusCol < i)
|
|
578
|
-
return this.grid._focusCol += 1, t.preventDefault(),
|
|
792
|
+
return this.grid._focusCol += 1, t.preventDefault(), g(this.grid), !0;
|
|
579
793
|
if (this.grid._focusRow < e)
|
|
580
|
-
return this.grid._focusRow += 1, this.grid._focusCol = 0, t.preventDefault(),
|
|
794
|
+
return this.grid._focusRow += 1, this.grid._focusCol = 0, t.preventDefault(), g(this.grid), !0;
|
|
581
795
|
break;
|
|
582
796
|
case "ArrowUp":
|
|
583
797
|
if (this.grid._focusCol > 0)
|
|
584
|
-
return this.grid._focusCol -= 1, t.preventDefault(),
|
|
798
|
+
return this.grid._focusCol -= 1, t.preventDefault(), g(this.grid), !0;
|
|
585
799
|
if (this.grid._focusRow > 0)
|
|
586
|
-
return this.grid._focusRow -= 1, this.grid._focusCol = i, t.preventDefault(),
|
|
800
|
+
return this.grid._focusRow -= 1, this.grid._focusCol = i, t.preventDefault(), g(this.grid), !0;
|
|
587
801
|
break;
|
|
588
802
|
case "ArrowRight":
|
|
589
803
|
if (this.grid._focusRow < e)
|
|
590
|
-
return this.grid._focusRow += 1, t.preventDefault(),
|
|
804
|
+
return this.grid._focusRow += 1, t.preventDefault(), g(this.grid), !0;
|
|
591
805
|
break;
|
|
592
806
|
case "ArrowLeft":
|
|
593
807
|
if (this.grid._focusRow > 0)
|
|
594
|
-
return this.grid._focusRow -= 1, t.preventDefault(),
|
|
808
|
+
return this.grid._focusRow -= 1, t.preventDefault(), g(this.grid), !0;
|
|
595
809
|
break;
|
|
596
810
|
}
|
|
597
811
|
return !1;
|
|
@@ -610,7 +824,7 @@ class A extends _ {
|
|
|
610
824
|
* Prioritizes DOM-measured height (actual rendered size) over config,
|
|
611
825
|
* since content can overflow the configured height.
|
|
612
826
|
*/
|
|
613
|
-
#
|
|
827
|
+
#v() {
|
|
614
828
|
if (this.#r && this.#r > 0)
|
|
615
829
|
return this.#r;
|
|
616
830
|
const t = this.config.cardRowHeight;
|
|
@@ -620,7 +834,7 @@ class A extends _ {
|
|
|
620
834
|
* Get the effective group row height for virtualization calculations.
|
|
621
835
|
* Uses DOM-measured height, falling back to original row height.
|
|
622
836
|
*/
|
|
623
|
-
#
|
|
837
|
+
#b() {
|
|
624
838
|
return this.#o && this.#o > 0 ? this.#o : this.#i ?? 28;
|
|
625
839
|
}
|
|
626
840
|
/**
|
|
@@ -636,7 +850,7 @@ class A extends _ {
|
|
|
636
850
|
/**
|
|
637
851
|
* Count group rows and card rows in the current dataset.
|
|
638
852
|
*/
|
|
639
|
-
#
|
|
853
|
+
#_() {
|
|
640
854
|
let t = 0, e = 0;
|
|
641
855
|
for (const i of this.rows)
|
|
642
856
|
i.__isGroupRow ? t++ : e++;
|
|
@@ -656,8 +870,8 @@ class A extends _ {
|
|
|
656
870
|
getExtraHeight() {
|
|
657
871
|
if (!this.#t || !this.config.cardRenderer || !this.#f())
|
|
658
872
|
return 0;
|
|
659
|
-
const t = this.#i ?? 28, e = this.#
|
|
660
|
-
return
|
|
873
|
+
const t = this.#i ?? 28, e = this.#b(), i = this.#v(), { groupCount: n, cardCount: a } = this.#_(), s = n * Math.max(0, e - t), o = a * Math.max(0, i - t);
|
|
874
|
+
return s + o;
|
|
661
875
|
}
|
|
662
876
|
/**
|
|
663
877
|
* Return extra height that appears before a given row index.
|
|
@@ -668,12 +882,12 @@ class A extends _ {
|
|
|
668
882
|
getExtraHeightBefore(t) {
|
|
669
883
|
if (!this.#t || !this.config.cardRenderer || !this.#f())
|
|
670
884
|
return 0;
|
|
671
|
-
const e = this.#i ?? 28, i = this.#
|
|
672
|
-
let o = 0,
|
|
673
|
-
const
|
|
885
|
+
const e = this.#i ?? 28, i = this.#b(), n = this.#v(), a = Math.max(0, i - e), s = Math.max(0, n - e);
|
|
886
|
+
let o = 0, d = 0;
|
|
887
|
+
const l = this.rows, h = Math.min(t, l.length);
|
|
674
888
|
for (let c = 0; c < h; c++)
|
|
675
|
-
|
|
676
|
-
return o * a +
|
|
889
|
+
l[c].__isGroupRow ? o++ : d++;
|
|
890
|
+
return o * a + d * s;
|
|
677
891
|
}
|
|
678
892
|
/**
|
|
679
893
|
* Count the number of card rows (non-group rows) in the current dataset.
|
|
@@ -701,22 +915,22 @@ class A extends _ {
|
|
|
701
915
|
*
|
|
702
916
|
* The refresh is deferred via microtask to avoid nested render cycles.
|
|
703
917
|
*/
|
|
704
|
-
#
|
|
918
|
+
#E() {
|
|
705
919
|
if (!this.#t || !this.config.cardRenderer)
|
|
706
920
|
return;
|
|
707
921
|
let t = !1;
|
|
708
922
|
const e = this.grid, i = this.#f(), n = this.#C();
|
|
709
923
|
if (n !== this.#g && (this.#g = n, t = !0), i) {
|
|
710
|
-
const
|
|
711
|
-
if (
|
|
712
|
-
const o =
|
|
924
|
+
const s = this.gridElement.querySelector(".data-grid-row.group-row");
|
|
925
|
+
if (s) {
|
|
926
|
+
const o = s.getBoundingClientRect().height;
|
|
713
927
|
o > 0 && o !== this.#o && (this.#o = o, t = !0);
|
|
714
928
|
}
|
|
715
929
|
}
|
|
716
930
|
const a = this.gridElement.querySelector(".data-grid-row.responsive-card");
|
|
717
931
|
if (a) {
|
|
718
|
-
const
|
|
719
|
-
|
|
932
|
+
const s = a.getBoundingClientRect().height;
|
|
933
|
+
s > 0 && s !== this.#r && (this.#r = s, t = !0, !i && e._virtualization && (e._virtualization.rowHeight = s));
|
|
720
934
|
}
|
|
721
935
|
t && !this.#p && (this.#p = !0, queueMicrotask(() => {
|
|
722
936
|
this.#p = !1, this.grid && this.#t && this.grid.refreshVirtualWindow?.(!0, !0);
|
|
@@ -724,6 +938,6 @@ class A extends _ {
|
|
|
724
938
|
}
|
|
725
939
|
}
|
|
726
940
|
export {
|
|
727
|
-
|
|
941
|
+
B as ResponsivePlugin
|
|
728
942
|
};
|
|
729
943
|
//# sourceMappingURL=index.js.map
|