@toolbox-web/grid 1.15.0 → 1.16.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/all.js +33 -11
- package/all.js.map +1 -1
- package/index.js +877 -865
- package/index.js.map +1 -1
- package/lib/core/internal/columns.d.ts +0 -5
- package/lib/core/internal/columns.d.ts.map +1 -1
- package/lib/core/internal/rows.d.ts.map +1 -1
- package/lib/core/types.d.ts +12 -0
- 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/index.js +59 -49
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/context-menu/menu.d.ts.map +1 -1
- package/lib/plugins/context-menu/types.d.ts +4 -4
- package/lib/plugins/context-menu/types.d.ts.map +1 -1
- package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
- package/lib/plugins/editing/index.js +228 -216
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/filter-model.d.ts.map +1 -1
- package/lib/plugins/filtering/index.js +4 -5
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- 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.map +1 -1
- 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/index.js.map +1 -1
- package/lib/plugins/row-reorder/index.js.map +1 -1
- 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 +26 -26
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +21 -21
- 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/filtering.umd.js +1 -1
- package/umd/plugins/filtering.umd.js.map +1 -1
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function
|
|
1
|
+
function ct() {
|
|
2
2
|
return {
|
|
3
3
|
rowCount: -1,
|
|
4
4
|
colCount: -1,
|
|
@@ -6,32 +6,32 @@ function lt() {
|
|
|
6
6
|
ariaDescribedBy: void 0
|
|
7
7
|
};
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function dt(t, e, i, o, n) {
|
|
10
10
|
if (o === t.rowCount && n === t.colCount)
|
|
11
11
|
return !1;
|
|
12
12
|
const r = t.rowCount;
|
|
13
13
|
return t.rowCount = o, t.colCount = n, e && (e.setAttribute("aria-rowcount", String(o)), e.setAttribute("aria-colcount", String(n))), o !== r && i && (o > 0 ? i.setAttribute("role", "rowgroup") : i.removeAttribute("role")), !0;
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function ht(t, e) {
|
|
16
16
|
const i = t?.gridAriaLabel;
|
|
17
17
|
return i || (t?.shell?.header?.title ?? e?.lightDomTitle ?? void 0);
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function ut(t, e, i, o) {
|
|
20
20
|
if (!e) return !1;
|
|
21
21
|
let n = !1;
|
|
22
|
-
const r =
|
|
22
|
+
const r = ht(i, o);
|
|
23
23
|
r !== t.ariaLabel && (t.ariaLabel = r, r ? e.setAttribute("aria-label", r) : e.removeAttribute("aria-label"), n = !0);
|
|
24
24
|
const s = i?.gridAriaDescribedBy;
|
|
25
25
|
return s !== t.ariaDescribedBy && (t.ariaDescribedBy = s, s ? e.setAttribute("aria-describedby", s) : e.removeAttribute("aria-describedby"), n = !0), n;
|
|
26
26
|
}
|
|
27
|
-
const
|
|
27
|
+
const G = {
|
|
28
28
|
STRETCH: "stretch",
|
|
29
29
|
FIXED: "fixed"
|
|
30
|
-
},
|
|
30
|
+
}, ft = {
|
|
31
31
|
mode: "reduced-motion",
|
|
32
32
|
duration: 200,
|
|
33
33
|
easing: "ease-out"
|
|
34
|
-
},
|
|
34
|
+
}, Ee = '<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>', M = {
|
|
35
35
|
expand: "▶",
|
|
36
36
|
collapse: "▼",
|
|
37
37
|
sortAsc: "▲",
|
|
@@ -40,48 +40,48 @@ const B = {
|
|
|
40
40
|
submenuArrow: "▶",
|
|
41
41
|
dragHandle: "⋮⋮",
|
|
42
42
|
toolPanel: "☰",
|
|
43
|
-
filter:
|
|
44
|
-
filterActive:
|
|
43
|
+
filter: Ee,
|
|
44
|
+
filterActive: Ee,
|
|
45
45
|
print: "🖨️"
|
|
46
46
|
};
|
|
47
|
-
function
|
|
47
|
+
function gt(t) {
|
|
48
48
|
return Array.from(t.querySelectorAll("tbw-grid-column")).map((i) => {
|
|
49
49
|
const o = i.getAttribute("field") || "";
|
|
50
50
|
if (!o) return null;
|
|
51
|
-
const n = i.getAttribute("type") || void 0, s = n && (/* @__PURE__ */ new Set(["number", "string", "date", "boolean", "select"])).has(n) ? n : void 0, l = i.getAttribute("header") || void 0, a = i.hasAttribute("sortable"), c = i.hasAttribute("editable"),
|
|
51
|
+
const n = i.getAttribute("type") || void 0, s = n && (/* @__PURE__ */ new Set(["number", "string", "date", "boolean", "select"])).has(n) ? n : void 0, l = i.getAttribute("header") || void 0, a = i.hasAttribute("sortable"), c = i.hasAttribute("editable"), h = { field: o, type: s, header: l, sortable: a, editable: c }, f = i.getAttribute("width");
|
|
52
52
|
if (f) {
|
|
53
|
-
const
|
|
54
|
-
!isNaN(
|
|
53
|
+
const m = parseFloat(f);
|
|
54
|
+
!isNaN(m) && /^\d+(\.\d+)?$/.test(f.trim()) ? h.width = m : h.width = f;
|
|
55
55
|
}
|
|
56
|
-
const
|
|
57
|
-
if (
|
|
58
|
-
const
|
|
59
|
-
isNaN(
|
|
56
|
+
const p = i.getAttribute("minWidth") || i.getAttribute("min-width");
|
|
57
|
+
if (p) {
|
|
58
|
+
const m = parseFloat(p);
|
|
59
|
+
isNaN(m) || (h.minWidth = m);
|
|
60
60
|
}
|
|
61
|
-
i.hasAttribute("resizable") && (
|
|
62
|
-
const g = i.getAttribute("editor"),
|
|
63
|
-
g && (
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
const [
|
|
67
|
-
return { value:
|
|
61
|
+
i.hasAttribute("resizable") && (h.resizable = !0), i.hasAttribute("sizable") && (h.resizable = !0);
|
|
62
|
+
const g = i.getAttribute("editor"), u = i.getAttribute("renderer");
|
|
63
|
+
g && (h.__editorName = g), u && (h.__rendererName = u);
|
|
64
|
+
const d = i.getAttribute("options");
|
|
65
|
+
d && (h.options = d.split(",").map((m) => {
|
|
66
|
+
const [x, N] = m.includes(":") ? m.split(":") : [m.trim(), m.trim()];
|
|
67
|
+
return { value: x.trim(), label: N?.trim() || x.trim() };
|
|
68
68
|
}));
|
|
69
|
-
const w = i.querySelector("tbw-grid-column-view"),
|
|
70
|
-
w && (
|
|
71
|
-
const
|
|
72
|
-
if (
|
|
73
|
-
const
|
|
74
|
-
|
|
69
|
+
const w = i.querySelector("tbw-grid-column-view"), v = i.querySelector("tbw-grid-column-editor"), b = i.querySelector("tbw-grid-column-header");
|
|
70
|
+
w && (h.__viewTemplate = w), v && (h.__editorTemplate = v), b && (h.__headerTemplate = b);
|
|
71
|
+
const R = globalThis.DataGridElement?.getAdapters?.() ?? [], E = w ?? i, T = R.find((m) => m.canHandle(E));
|
|
72
|
+
if (T) {
|
|
73
|
+
const m = T.createRenderer(E);
|
|
74
|
+
m && (h.viewRenderer = m);
|
|
75
75
|
}
|
|
76
|
-
const
|
|
77
|
-
if (
|
|
78
|
-
const
|
|
79
|
-
|
|
76
|
+
const C = v ?? i, y = R.find((m) => m.canHandle(C));
|
|
77
|
+
if (y) {
|
|
78
|
+
const m = y.createEditor(C);
|
|
79
|
+
m && (h.editor = m);
|
|
80
80
|
}
|
|
81
|
-
return
|
|
81
|
+
return h;
|
|
82
82
|
}).filter((i) => !!i);
|
|
83
83
|
}
|
|
84
|
-
function
|
|
84
|
+
function Se(t, e) {
|
|
85
85
|
if ((!t || !t.length) && (!e || !e.length)) return [];
|
|
86
86
|
if (!t || !t.length) return e || [];
|
|
87
87
|
if (!e || !e.length) return t;
|
|
@@ -105,7 +105,7 @@ function Ee(t, e) {
|
|
|
105
105
|
});
|
|
106
106
|
return Object.keys(i).forEach((n) => o.push(i[n])), o;
|
|
107
107
|
}
|
|
108
|
-
function
|
|
108
|
+
function Ge(t, e) {
|
|
109
109
|
try {
|
|
110
110
|
t.part?.add?.(e);
|
|
111
111
|
} catch {
|
|
@@ -113,9 +113,9 @@ function Ve(t, e) {
|
|
|
113
113
|
const i = t.getAttribute("part");
|
|
114
114
|
i ? i.split(/\s+/).includes(e) || t.setAttribute("part", i + " " + e) : t.setAttribute("part", e);
|
|
115
115
|
}
|
|
116
|
-
function
|
|
117
|
-
const e = t.effectiveConfig?.fitMode || t.fitMode ||
|
|
118
|
-
if (e !==
|
|
116
|
+
function Re(t) {
|
|
117
|
+
const e = t.effectiveConfig?.fitMode || t.fitMode || G.STRETCH;
|
|
118
|
+
if (e !== G.STRETCH && e !== G.FIXED || t.__didInitialAutoSize || !t.isConnected) return;
|
|
119
119
|
const i = Array.from(t._headerRowEl?.children || []);
|
|
120
120
|
if (!i.length) return;
|
|
121
121
|
let o = !1;
|
|
@@ -126,37 +126,41 @@ function Se(t) {
|
|
|
126
126
|
for (const a of t._rowPool) {
|
|
127
127
|
const c = a.children[r];
|
|
128
128
|
if (c) {
|
|
129
|
-
const
|
|
130
|
-
|
|
129
|
+
const h = c.scrollWidth;
|
|
130
|
+
h > l && (l = h);
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
l > 0 && (n.width = l + 2, n.__autoSized = !0, o = !0);
|
|
134
|
-
}), o &&
|
|
134
|
+
}), o && V(t), t.__didInitialAutoSize = !0;
|
|
135
135
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
136
|
+
const pt = /^(?:\d+(?:\.\d+)?(?:px|%|fr|em|rem|ch|vw|vh|vmin|vmax)|calc\(.+\)|min-content|max-content|minmax\(.+\)|fit-content\(.+\)|auto)$/i;
|
|
137
|
+
function Ae(t, e) {
|
|
138
|
+
return typeof t == "number" ? `${t}px` : (pt.test(t) || console.warn(`[tbw-grid] Column '${e ?? "?"}' has an invalid CSS width value: '${t}'. Expected a number (px) or a valid CSS unit string (e.g. '30%', '2fr', 'calc(...)').`), t);
|
|
139
|
+
}
|
|
140
|
+
function V(t) {
|
|
141
|
+
(t.effectiveConfig?.fitMode || t.fitMode || G.STRETCH) === G.STRETCH ? t._gridTemplate = t._visibleColumns.map((i) => {
|
|
142
|
+
if (i.width != null) return Ae(i.width, i.field);
|
|
139
143
|
const o = i.minWidth;
|
|
140
144
|
return o != null ? `minmax(${o}px, 1fr)` : "1fr";
|
|
141
|
-
}).join(" ").trim() : t._gridTemplate = t._visibleColumns.map((i) => i.width ?
|
|
145
|
+
}).join(" ").trim() : t._gridTemplate = t._visibleColumns.map((i) => i.width != null ? Ae(i.width, i.field) : "max-content").join(" "), t.style.setProperty("--tbw-column-template", t._gridTemplate);
|
|
142
146
|
}
|
|
143
|
-
function
|
|
147
|
+
function wt(t) {
|
|
144
148
|
return t == null ? "string" : typeof t == "number" ? "number" : typeof t == "boolean" ? "boolean" : t instanceof Date || typeof t == "string" && /\d{4}-\d{2}-\d{2}/.test(t) && !isNaN(Date.parse(t)) ? "date" : "string";
|
|
145
149
|
}
|
|
146
|
-
function
|
|
150
|
+
function bt(t, e) {
|
|
147
151
|
const i = t[0] || {}, o = Object.keys(i).map((r) => {
|
|
148
|
-
const s = i[r], l =
|
|
152
|
+
const s = i[r], l = wt(s);
|
|
149
153
|
return { field: r, header: r.charAt(0).toUpperCase() + r.slice(1), type: l };
|
|
150
154
|
}), n = {};
|
|
151
155
|
return o.forEach((r) => {
|
|
152
156
|
n[r.field] = r.type || "string";
|
|
153
157
|
}), { columns: o, typeMap: n };
|
|
154
158
|
}
|
|
155
|
-
const
|
|
156
|
-
function
|
|
159
|
+
const mt = /{{\s*([^}]+)\s*}}/g, z = "__DG_EMPTY__", vt = /^[\w$. '?+\-*/%:()!<>=,&|]+$/, Ct = /__(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/;
|
|
160
|
+
function yt(t) {
|
|
157
161
|
return !t || typeof t != "string" ? "" : t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
158
162
|
}
|
|
159
|
-
const
|
|
163
|
+
const _t = /* @__PURE__ */ new Set([
|
|
160
164
|
"script",
|
|
161
165
|
"iframe",
|
|
162
166
|
"object",
|
|
@@ -181,23 +185,23 @@ const vt = /* @__PURE__ */ new Set([
|
|
|
181
185
|
"plaintext",
|
|
182
186
|
"xmp",
|
|
183
187
|
"listing"
|
|
184
|
-
]),
|
|
185
|
-
function
|
|
188
|
+
]), Te = /^on\w+$/i, Et = /* @__PURE__ */ new Set(["href", "src", "action", "formaction", "data", "srcdoc", "xlink:href", "poster", "srcset"]), St = /^\s*(javascript|vbscript|data|blob):/i;
|
|
189
|
+
function W(t) {
|
|
186
190
|
if (!t || typeof t != "string") return "";
|
|
187
191
|
if (t.indexOf("<") === -1) return t;
|
|
188
192
|
const e = document.createElement("template");
|
|
189
|
-
return e.innerHTML = t,
|
|
193
|
+
return e.innerHTML = t, Rt(e.content), e.innerHTML;
|
|
190
194
|
}
|
|
191
|
-
function
|
|
195
|
+
function Rt(t) {
|
|
192
196
|
const e = [], i = t.querySelectorAll("*");
|
|
193
197
|
for (const o of i) {
|
|
194
198
|
const n = o.tagName.toLowerCase();
|
|
195
|
-
if (
|
|
199
|
+
if (_t.has(n)) {
|
|
196
200
|
e.push(o);
|
|
197
201
|
continue;
|
|
198
202
|
}
|
|
199
203
|
if ((n === "svg" || o.namespaceURI === "http://www.w3.org/2000/svg") && Array.from(o.attributes).some(
|
|
200
|
-
(l) =>
|
|
204
|
+
(l) => Te.test(l.name) || l.name === "href" || l.name === "xlink:href"
|
|
201
205
|
)) {
|
|
202
206
|
e.push(o);
|
|
203
207
|
continue;
|
|
@@ -205,11 +209,11 @@ function _t(t) {
|
|
|
205
209
|
const r = [];
|
|
206
210
|
for (const s of o.attributes) {
|
|
207
211
|
const l = s.name.toLowerCase();
|
|
208
|
-
if (
|
|
212
|
+
if (Te.test(l)) {
|
|
209
213
|
r.push(s.name);
|
|
210
214
|
continue;
|
|
211
215
|
}
|
|
212
|
-
if (
|
|
216
|
+
if (Et.has(l) && St.test(s.value)) {
|
|
213
217
|
r.push(s.name);
|
|
214
218
|
continue;
|
|
215
219
|
}
|
|
@@ -222,48 +226,48 @@ function _t(t) {
|
|
|
222
226
|
}
|
|
223
227
|
e.forEach((o) => o.remove());
|
|
224
228
|
}
|
|
225
|
-
function
|
|
229
|
+
function Xe(t, e) {
|
|
226
230
|
if (!t || t.indexOf("{{") === -1) return t;
|
|
227
|
-
const i = [], o = t.replace(
|
|
228
|
-
const c =
|
|
231
|
+
const i = [], o = t.replace(mt, (l, a) => {
|
|
232
|
+
const c = At(a, e);
|
|
229
233
|
return i.push({ expr: a.trim(), result: c }), c;
|
|
230
|
-
}), n =
|
|
231
|
-
return
|
|
234
|
+
}), n = Tt(o), r = i.length && i.every((l) => l.result === "" || l.result === z);
|
|
235
|
+
return q.test(t) || r ? "" : n;
|
|
232
236
|
}
|
|
233
|
-
function
|
|
234
|
-
if (t = (t || "").trim(), !t ||
|
|
235
|
-
if (t === "value") return e.value == null ?
|
|
237
|
+
function At(t, e) {
|
|
238
|
+
if (t = (t || "").trim(), !t || q.test(t)) return z;
|
|
239
|
+
if (t === "value") return e.value == null ? z : String(e.value);
|
|
236
240
|
if (t.startsWith("row.") && !/[()?]/.test(t) && !t.includes(":")) {
|
|
237
241
|
const o = t.slice(4), n = e.row ? e.row[o] : void 0;
|
|
238
|
-
return n == null ?
|
|
242
|
+
return n == null ? z : String(n);
|
|
239
243
|
}
|
|
240
|
-
if (t.length > 80 || !
|
|
244
|
+
if (t.length > 80 || !vt.test(t) || Ct.test(t)) return z;
|
|
241
245
|
const i = t.match(/\./g);
|
|
242
|
-
if (i && i.length > 1) return
|
|
246
|
+
if (i && i.length > 1) return z;
|
|
243
247
|
try {
|
|
244
248
|
const n = new Function("value", "row", `return (${t});`)(e.value, e.row), r = n == null ? "" : String(n);
|
|
245
|
-
return
|
|
249
|
+
return q.test(r) ? z : r || z;
|
|
246
250
|
} catch {
|
|
247
|
-
return
|
|
251
|
+
return z;
|
|
248
252
|
}
|
|
249
253
|
}
|
|
250
|
-
const
|
|
251
|
-
function
|
|
252
|
-
return t && t.replace(new RegExp(
|
|
254
|
+
const q = /Reflect|Proxy|ownKeys/;
|
|
255
|
+
function Tt(t) {
|
|
256
|
+
return t && t.replace(new RegExp(z, "g"), "").replace(/Reflect\.[^<>{}\s]+|\bProxy\b|ownKeys\([^)]*\)/g, "");
|
|
253
257
|
}
|
|
254
|
-
function
|
|
255
|
-
if (
|
|
258
|
+
function xt(t) {
|
|
259
|
+
if (q.test(t.textContent || "")) {
|
|
256
260
|
for (const e of t.childNodes)
|
|
257
|
-
e.nodeType === Node.TEXT_NODE &&
|
|
258
|
-
|
|
261
|
+
e.nodeType === Node.TEXT_NODE && q.test(e.textContent || "") && (e.textContent = "");
|
|
262
|
+
q.test(t.textContent || "") && (t.textContent = "");
|
|
259
263
|
}
|
|
260
264
|
}
|
|
261
|
-
function
|
|
262
|
-
const e =
|
|
265
|
+
function xe(t) {
|
|
266
|
+
const e = q.test(t), i = ((o) => e ? "" : Xe(t, o));
|
|
263
267
|
return i.__blocked = e, i;
|
|
264
268
|
}
|
|
265
|
-
const
|
|
266
|
-
class
|
|
269
|
+
const Ht = 100;
|
|
270
|
+
class Lt {
|
|
267
271
|
#l;
|
|
268
272
|
#n;
|
|
269
273
|
#u;
|
|
@@ -378,19 +382,19 @@ class Tt {
|
|
|
378
382
|
const e = this.#l ? { ...this.#l } : {}, i = Array.isArray(e.columns) ? [...e.columns] : [], o = (this.#d ?? []).map((s) => ({
|
|
379
383
|
...s
|
|
380
384
|
}));
|
|
381
|
-
let n =
|
|
385
|
+
let n = Se(
|
|
382
386
|
i,
|
|
383
387
|
o
|
|
384
388
|
);
|
|
385
|
-
this.#n && this.#n.length && (n =
|
|
389
|
+
this.#n && this.#n.length && (n = Se(
|
|
386
390
|
this.#n,
|
|
387
391
|
o
|
|
388
392
|
));
|
|
389
393
|
const r = this.#r.getRows();
|
|
390
|
-
return n.length === 0 && r.length && (n =
|
|
394
|
+
return n.length === 0 && r.length && (n = bt(r).columns), n.length && (n.forEach((s) => {
|
|
391
395
|
s.sortable === void 0 && (s.sortable = !0), s.resizable === void 0 && (s.resizable = !0), s.__originalWidth === void 0 && typeof s.width == "number" && (s.__originalWidth = s.width);
|
|
392
396
|
}), n.forEach((s) => {
|
|
393
|
-
s.__viewTemplate && !s.__compiledView && (s.__compiledView =
|
|
397
|
+
s.__viewTemplate && !s.__compiledView && (s.__compiledView = xe(s.__viewTemplate.innerHTML)), s.__editorTemplate && !s.__compiledEditor && (s.__compiledEditor = xe(s.__editorTemplate.innerHTML));
|
|
394
398
|
}), e.columns = n), this.#u && (e.fitMode = this.#u), e.fitMode || (e.fitMode = "stretch"), this.#b(e), e.columnState && !this.#C && (this.#C = e.columnState), e;
|
|
395
399
|
}
|
|
396
400
|
#b(e) {
|
|
@@ -402,17 +406,17 @@ class Tt {
|
|
|
402
406
|
const n = this.#r.getShellToolPanels();
|
|
403
407
|
if (n.size > 0) {
|
|
404
408
|
const f = Array.from(n.values());
|
|
405
|
-
f.sort((
|
|
409
|
+
f.sort((p, g) => (p.order ?? 100) - (g.order ?? 100)), e.shell.toolPanels = f;
|
|
406
410
|
}
|
|
407
411
|
const r = this.#r.getShellHeaderContents();
|
|
408
412
|
if (r.size > 0) {
|
|
409
413
|
const f = Array.from(r.values());
|
|
410
|
-
f.sort((
|
|
414
|
+
f.sort((p, g) => (p.order ?? 100) - (g.order ?? 100)), e.shell.headerContents = f;
|
|
411
415
|
}
|
|
412
|
-
const s = this.#r.getShellToolbarContents(), l = Array.from(s.values()), a = this.#l?.shell?.header?.toolbarContents ?? [], c = new Set(a.map((f) => f.id)),
|
|
416
|
+
const s = this.#r.getShellToolbarContents(), l = Array.from(s.values()), a = this.#l?.shell?.header?.toolbarContents ?? [], c = new Set(a.map((f) => f.id)), h = [...a];
|
|
413
417
|
for (const f of l)
|
|
414
|
-
c.has(f.id) ||
|
|
415
|
-
|
|
418
|
+
c.has(f.id) || h.push(f);
|
|
419
|
+
h.sort((f, p) => (f.order ?? 0) - (p.order ?? 0)), e.shell.header.toolbarContents = h;
|
|
416
420
|
}
|
|
417
421
|
collectState(e) {
|
|
418
422
|
const i = this.columns, o = this.#y();
|
|
@@ -428,8 +432,8 @@ class Tt {
|
|
|
428
432
|
a && (s.sort = a);
|
|
429
433
|
for (const c of e)
|
|
430
434
|
if (c.getColumnState) {
|
|
431
|
-
const
|
|
432
|
-
|
|
435
|
+
const h = c.getColumnState(n.field);
|
|
436
|
+
h && Object.assign(s, h);
|
|
433
437
|
}
|
|
434
438
|
return s;
|
|
435
439
|
})
|
|
@@ -444,8 +448,8 @@ class Tt {
|
|
|
444
448
|
return a.width !== void 0 && (c.width = a.width, c.__renderedWidth = a.width), a.visible !== void 0 && (c.hidden = !a.visible), c;
|
|
445
449
|
});
|
|
446
450
|
r.sort((l, a) => {
|
|
447
|
-
const c = n.get(l.field)?.order ?? 1 / 0,
|
|
448
|
-
return c -
|
|
451
|
+
const c = n.get(l.field)?.order ?? 1 / 0, h = n.get(a.field)?.order ?? 1 / 0;
|
|
452
|
+
return c - h;
|
|
449
453
|
}), this.columns = r;
|
|
450
454
|
const s = e.columns.filter((l) => l.sort !== void 0).sort((l, a) => (l.sort?.priority ?? 0) - (a.sort?.priority ?? 0));
|
|
451
455
|
if (s.length > 0) {
|
|
@@ -485,7 +489,7 @@ class Tt {
|
|
|
485
489
|
this.#s = void 0;
|
|
486
490
|
const i = this.collectState(e);
|
|
487
491
|
this.#r.emit("column-state-change", i);
|
|
488
|
-
},
|
|
492
|
+
}, Ht);
|
|
489
493
|
}
|
|
490
494
|
setColumnVisible(e, i) {
|
|
491
495
|
const o = this.columns, n = o.find((s) => s.field === e);
|
|
@@ -533,7 +537,7 @@ class Tt {
|
|
|
533
537
|
this.columns = o, this.#r.renderHeader(), this.#r.updateTemplate(), this.#r.refreshVirtualWindow();
|
|
534
538
|
}
|
|
535
539
|
parseLightDomColumns(e) {
|
|
536
|
-
this.#d || (this.#h = Array.from(e.querySelectorAll("tbw-grid-column")), this.#d = this.#h.length ?
|
|
540
|
+
this.#d || (this.#h = Array.from(e.querySelectorAll("tbw-grid-column")), this.#d = this.#h.length ? gt(e) : []);
|
|
537
541
|
}
|
|
538
542
|
clearLightDomCache() {
|
|
539
543
|
this.#d = void 0;
|
|
@@ -586,7 +590,7 @@ class Tt {
|
|
|
586
590
|
this.#v?.disconnect(), this.#w = [], this.#s && clearTimeout(this.#s);
|
|
587
591
|
}
|
|
588
592
|
}
|
|
589
|
-
function
|
|
593
|
+
function ve() {
|
|
590
594
|
if (typeof window < "u" && window.location) {
|
|
591
595
|
const t = window.location.hostname;
|
|
592
596
|
if (t === "localhost" || t === "127.0.0.1" || t === "::1")
|
|
@@ -594,10 +598,10 @@ function me() {
|
|
|
594
598
|
}
|
|
595
599
|
return typeof process < "u" && process.env?.NODE_ENV !== "production";
|
|
596
600
|
}
|
|
597
|
-
function
|
|
601
|
+
function Ye(t) {
|
|
598
602
|
return `<span role="checkbox" aria-checked="${t}" aria-label="${t}">${t ? "🗹" : "☐"}</span>`;
|
|
599
603
|
}
|
|
600
|
-
function
|
|
604
|
+
function je(t) {
|
|
601
605
|
if (t == null || t === "") return "";
|
|
602
606
|
if (t instanceof Date)
|
|
603
607
|
return isNaN(t.getTime()) ? "" : t.toLocaleDateString();
|
|
@@ -607,7 +611,7 @@ function Xe(t) {
|
|
|
607
611
|
}
|
|
608
612
|
return "";
|
|
609
613
|
}
|
|
610
|
-
function
|
|
614
|
+
function Ke(t) {
|
|
611
615
|
if (!t) return -1;
|
|
612
616
|
const e = t.getAttribute("data-row");
|
|
613
617
|
if (e) return parseInt(e, 10);
|
|
@@ -620,15 +624,15 @@ function Ye(t) {
|
|
|
620
624
|
if (n[r] === i) return r;
|
|
621
625
|
return -1;
|
|
622
626
|
}
|
|
623
|
-
function
|
|
627
|
+
function Pt(t) {
|
|
624
628
|
if (!t) return -1;
|
|
625
629
|
const e = t.getAttribute("data-col");
|
|
626
630
|
return e ? parseInt(e, 10) : -1;
|
|
627
631
|
}
|
|
628
|
-
function
|
|
632
|
+
function Ce(t) {
|
|
629
633
|
t && t.querySelectorAll(".cell-focus").forEach((e) => e.classList.remove("cell-focus"));
|
|
630
634
|
}
|
|
631
|
-
function
|
|
635
|
+
function zt(t) {
|
|
632
636
|
try {
|
|
633
637
|
if (getComputedStyle(t).direction === "rtl") return "rtl";
|
|
634
638
|
} catch {
|
|
@@ -639,13 +643,13 @@ function Ht(t) {
|
|
|
639
643
|
}
|
|
640
644
|
return "ltr";
|
|
641
645
|
}
|
|
642
|
-
function
|
|
643
|
-
return
|
|
646
|
+
function He(t) {
|
|
647
|
+
return zt(t) === "rtl";
|
|
644
648
|
}
|
|
645
|
-
function
|
|
649
|
+
function oo(t, e) {
|
|
646
650
|
return t === "left" || t === "right" ? t : e === "rtl" ? t === "start" ? "right" : "left" : t === "start" ? "left" : "right";
|
|
647
651
|
}
|
|
648
|
-
function
|
|
652
|
+
function Qe(t, e) {
|
|
649
653
|
const i = e.renderer || e.viewRenderer;
|
|
650
654
|
if (i) return i;
|
|
651
655
|
if (!e.type) return;
|
|
@@ -656,7 +660,7 @@ function je(t, e) {
|
|
|
656
660
|
return n.renderer;
|
|
657
661
|
}
|
|
658
662
|
}
|
|
659
|
-
function
|
|
663
|
+
function Ze(t, e) {
|
|
660
664
|
if (e.format) return e.format;
|
|
661
665
|
if (!e.type) return;
|
|
662
666
|
const i = t.__frameworkAdapter;
|
|
@@ -666,291 +670,299 @@ function Ke(t, e) {
|
|
|
666
670
|
return o.format;
|
|
667
671
|
}
|
|
668
672
|
}
|
|
669
|
-
const
|
|
670
|
-
function
|
|
673
|
+
const Je = 'input,select,textarea,[contenteditable="true"],[contenteditable=""],[tabindex]:not([tabindex="-1"])';
|
|
674
|
+
function se(t) {
|
|
671
675
|
return (t.__editingCellCount ?? 0) > 0;
|
|
672
676
|
}
|
|
673
|
-
function
|
|
677
|
+
function le(t) {
|
|
674
678
|
t.__editingCellCount = 0, t.removeAttribute("data-has-editing"), t.querySelectorAll(".cell.editing").forEach((i) => i.classList.remove("editing"));
|
|
675
679
|
}
|
|
676
|
-
const
|
|
677
|
-
|
|
678
|
-
const
|
|
679
|
-
|
|
680
|
-
function
|
|
681
|
-
return
|
|
680
|
+
const et = document.createElement("template");
|
|
681
|
+
et.innerHTML = '<div class="cell" role="gridcell" part="cell"></div>';
|
|
682
|
+
const tt = document.createElement("template");
|
|
683
|
+
tt.innerHTML = '<div class="data-grid-row" role="row" part="row"></div>';
|
|
684
|
+
function Dt() {
|
|
685
|
+
return et.content.firstElementChild.cloneNode(!0);
|
|
682
686
|
}
|
|
683
|
-
function
|
|
684
|
-
return
|
|
687
|
+
function Ot() {
|
|
688
|
+
return tt.content.firstElementChild.cloneNode(!0);
|
|
685
689
|
}
|
|
686
|
-
function
|
|
690
|
+
function Y(t) {
|
|
687
691
|
t.__cellDisplayCache = void 0, t.__cellCacheEpoch = void 0, t.__hasSpecialColumns = void 0;
|
|
688
692
|
}
|
|
689
|
-
function
|
|
693
|
+
function Mt(t, e, i, o, n) {
|
|
690
694
|
const r = Math.max(0, i - e), s = t._bodyEl, l = t._visibleColumns, a = l.length;
|
|
691
695
|
let c = t.__cachedHeaderRowCount;
|
|
692
696
|
for (c === void 0 && (c = t.querySelector(".header-group-row") ? 2 : 1, t.__cachedHeaderRowCount = c); t._rowPool.length < r; ) {
|
|
693
|
-
const
|
|
694
|
-
t._rowPool.push(
|
|
697
|
+
const p = Ot();
|
|
698
|
+
t._rowPool.push(p);
|
|
695
699
|
}
|
|
696
700
|
if (t._rowPool.length > r) {
|
|
697
|
-
for (let
|
|
698
|
-
const g = t._rowPool[
|
|
701
|
+
for (let p = r; p < t._rowPool.length; p++) {
|
|
702
|
+
const g = t._rowPool[p];
|
|
699
703
|
g.parentNode === s && g.remove();
|
|
700
704
|
}
|
|
701
705
|
t._rowPool.length = r;
|
|
702
706
|
}
|
|
703
|
-
const
|
|
704
|
-
for (let
|
|
705
|
-
const g = e +
|
|
706
|
-
if (
|
|
707
|
-
|
|
707
|
+
const h = n && t.__hasRenderRowPlugins !== !1, f = t._hasAfterRowRenderHook?.() ?? !1;
|
|
708
|
+
for (let p = 0; p < r; p++) {
|
|
709
|
+
const g = e + p, u = t._rows[g], d = t._rowPool[p];
|
|
710
|
+
if (d.setAttribute("aria-rowindex", String(g + c + 1)), h && n(u, d, g)) {
|
|
711
|
+
d.__epoch = o, d.__rowDataRef = u, d.parentNode !== s && s.appendChild(d);
|
|
708
712
|
continue;
|
|
709
713
|
}
|
|
710
|
-
const w =
|
|
711
|
-
let
|
|
712
|
-
|
|
713
|
-
const
|
|
714
|
-
let
|
|
715
|
-
if (
|
|
716
|
-
for (let
|
|
717
|
-
if (l[
|
|
718
|
-
|
|
714
|
+
const w = d.__epoch, v = d.__rowDataRef;
|
|
715
|
+
let b = d.children.length;
|
|
716
|
+
b > a && d.lastElementChild?.classList.contains("tbw-row-loading-overlay") && b--;
|
|
717
|
+
const R = w === o && b === a, E = v !== u, T = !!t._isGridEditMode;
|
|
718
|
+
let C = !1;
|
|
719
|
+
if (R && E) {
|
|
720
|
+
for (let S = 0; S < a; S++)
|
|
721
|
+
if (l[S].externalView && !d.querySelector(`.cell[data-col="${S}"] [data-external-view]`)) {
|
|
722
|
+
C = !0;
|
|
719
723
|
break;
|
|
720
724
|
}
|
|
721
725
|
}
|
|
722
|
-
if (!
|
|
723
|
-
const
|
|
724
|
-
|
|
725
|
-
} else if (
|
|
726
|
-
const
|
|
727
|
-
|
|
726
|
+
if (!R || C) {
|
|
727
|
+
const S = se(d), L = T || t._activeEditRows === g;
|
|
728
|
+
S && !L ? (d.__isCustomRow && (d.className = "data-grid-row", d.setAttribute("role", "row"), d.__isCustomRow = !1), le(d), B(t, d, u, g), d.__epoch = o, d.__rowDataRef = u) : S && L ? (ae(t, d, u, g), d.__rowDataRef = u) : (d.__isCustomRow && (d.className = "data-grid-row", d.setAttribute("role", "row"), d.__isCustomRow = !1), B(t, d, u, g), d.__epoch = o, d.__rowDataRef = u);
|
|
729
|
+
} else if (E) {
|
|
730
|
+
const S = se(d), L = T || t._activeEditRows === g;
|
|
731
|
+
S && !L ? (le(d), B(t, d, u, g), d.__epoch = o, d.__rowDataRef = u) : (ae(t, d, u, g), d.__rowDataRef = u);
|
|
728
732
|
} else {
|
|
729
|
-
const
|
|
730
|
-
|
|
733
|
+
const S = se(d), L = T || t._activeEditRows === g;
|
|
734
|
+
S && !L ? (le(d), B(t, d, u, g), d.__epoch = o, d.__rowDataRef = u) : ae(t, d, u, g);
|
|
731
735
|
}
|
|
732
|
-
let
|
|
733
|
-
const
|
|
734
|
-
if (
|
|
736
|
+
let y = !1;
|
|
737
|
+
const m = t.changedRowIds;
|
|
738
|
+
if (m && m.length > 0)
|
|
735
739
|
try {
|
|
736
|
-
const
|
|
737
|
-
|
|
740
|
+
const S = t.getRowId?.(u);
|
|
741
|
+
S && (y = m.includes(S));
|
|
738
742
|
} catch {
|
|
739
743
|
}
|
|
740
|
-
const
|
|
741
|
-
|
|
742
|
-
const
|
|
743
|
-
if (
|
|
744
|
-
const
|
|
745
|
-
|
|
744
|
+
const x = d.classList.contains("changed");
|
|
745
|
+
y !== x && d.classList.toggle("changed", y);
|
|
746
|
+
const N = t.effectiveConfig?.rowClass;
|
|
747
|
+
if (N) {
|
|
748
|
+
const S = d.getAttribute("data-dynamic-classes");
|
|
749
|
+
S && S.split(" ").forEach((L) => L && d.classList.remove(L));
|
|
746
750
|
try {
|
|
747
|
-
const
|
|
748
|
-
if (
|
|
749
|
-
const
|
|
750
|
-
|
|
751
|
+
const L = N(u);
|
|
752
|
+
if (L && L.length > 0) {
|
|
753
|
+
const re = L.filter((X) => X && typeof X == "string");
|
|
754
|
+
re.forEach((X) => d.classList.add(X)), d.setAttribute("data-dynamic-classes", re.join(" "));
|
|
751
755
|
} else
|
|
752
|
-
|
|
753
|
-
} catch (
|
|
754
|
-
console.warn("[tbw-grid] rowClass callback error:",
|
|
756
|
+
d.removeAttribute("data-dynamic-classes");
|
|
757
|
+
} catch (L) {
|
|
758
|
+
console.warn("[tbw-grid] rowClass callback error:", L), d.removeAttribute("data-dynamic-classes");
|
|
755
759
|
}
|
|
756
760
|
}
|
|
757
761
|
f && t._afterRowRender?.({
|
|
758
|
-
row:
|
|
762
|
+
row: u,
|
|
759
763
|
rowIndex: g,
|
|
760
|
-
rowElement:
|
|
761
|
-
}),
|
|
762
|
-
}
|
|
763
|
-
}
|
|
764
|
-
function
|
|
765
|
-
const n = e.children, r = t._visibleColumns, s = r.length, l = n.length, a = s < l ? s : l, c = t._focusRow,
|
|
766
|
-
let
|
|
767
|
-
if (
|
|
768
|
-
|
|
769
|
-
const
|
|
770
|
-
for (let
|
|
771
|
-
const w = r[
|
|
772
|
-
if (w.__viewTemplate || w.__compiledView || w.renderer || w.viewRenderer || w.externalView || w.format || w.type === "date" || w.type === "boolean" || w.type &&
|
|
773
|
-
|
|
764
|
+
rowElement: d
|
|
765
|
+
}), d.parentNode !== s && s.appendChild(d);
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
function ae(t, e, i, o) {
|
|
769
|
+
const n = e.children, r = t._visibleColumns, s = r.length, l = n.length, a = s < l ? s : l, c = t._focusRow, h = t._focusCol, f = t._hasAfterCellRenderHook?.() ?? !1;
|
|
770
|
+
let p = t.__hasSpecialColumns;
|
|
771
|
+
if (p === void 0) {
|
|
772
|
+
p = !1;
|
|
773
|
+
const u = t.__frameworkAdapter;
|
|
774
|
+
for (let d = 0; d < s; d++) {
|
|
775
|
+
const w = r[d];
|
|
776
|
+
if (w.__viewTemplate || w.__compiledView || w.renderer || w.viewRenderer || w.externalView || w.format || w.type === "date" || w.type === "boolean" || w.type && u?.getTypeDefault?.(w.type)?.renderer || w.type && u?.getTypeDefault?.(w.type)?.format) {
|
|
777
|
+
p = !0;
|
|
774
778
|
break;
|
|
775
779
|
}
|
|
776
780
|
}
|
|
777
|
-
t.__hasSpecialColumns =
|
|
781
|
+
t.__hasSpecialColumns = p;
|
|
778
782
|
}
|
|
779
783
|
const g = String(o);
|
|
780
|
-
if (!
|
|
781
|
-
for (let
|
|
782
|
-
const
|
|
783
|
-
if (
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
784
|
+
if (!p) {
|
|
785
|
+
for (let u = 0; u < a; u++) {
|
|
786
|
+
const d = n[u];
|
|
787
|
+
if (d.classList.contains("editing")) continue;
|
|
788
|
+
d.firstElementChild && t.__frameworkAdapter?.releaseCell?.(d);
|
|
789
|
+
const w = r[u], v = i[w.field];
|
|
790
|
+
d.textContent = v == null ? "" : String(v), d.getAttribute("data-row") !== g && d.setAttribute("data-row", g);
|
|
791
|
+
const b = c === o && h === u, _ = d.classList.contains("cell-focus");
|
|
792
|
+
b !== _ && (d.classList.toggle("cell-focus", b), d.setAttribute("aria-selected", String(b))), f && t._afterCellRender?.({
|
|
788
793
|
row: i,
|
|
789
794
|
rowIndex: o,
|
|
790
795
|
column: w,
|
|
791
|
-
colIndex:
|
|
792
|
-
value:
|
|
793
|
-
cellElement:
|
|
796
|
+
colIndex: u,
|
|
797
|
+
value: v,
|
|
798
|
+
cellElement: d,
|
|
794
799
|
rowElement: e
|
|
795
800
|
});
|
|
796
801
|
}
|
|
797
802
|
return;
|
|
798
803
|
}
|
|
799
|
-
for (let
|
|
800
|
-
if (r[
|
|
801
|
-
|
|
804
|
+
for (let u = 0; u < a; u++)
|
|
805
|
+
if (r[u].externalView && !n[u].querySelector("[data-external-view]")) {
|
|
806
|
+
B(t, e, i, o);
|
|
802
807
|
return;
|
|
803
808
|
}
|
|
804
|
-
for (let
|
|
805
|
-
const
|
|
809
|
+
for (let u = 0; u < a; u++) {
|
|
810
|
+
const d = r[u], w = n[u];
|
|
806
811
|
w.getAttribute("data-row") !== g && w.setAttribute("data-row", g);
|
|
807
|
-
const
|
|
808
|
-
|
|
809
|
-
const
|
|
810
|
-
if (
|
|
811
|
-
const
|
|
812
|
-
|
|
812
|
+
const v = c === o && h === u, b = w.classList.contains("cell-focus");
|
|
813
|
+
v !== b && (w.classList.toggle("cell-focus", v), w.setAttribute("aria-selected", String(v)));
|
|
814
|
+
const _ = d.cellClass;
|
|
815
|
+
if (_) {
|
|
816
|
+
const y = w.getAttribute("data-dynamic-classes");
|
|
817
|
+
y && y.split(" ").forEach((m) => m && w.classList.remove(m));
|
|
813
818
|
try {
|
|
814
|
-
const
|
|
815
|
-
if (
|
|
816
|
-
const
|
|
817
|
-
|
|
819
|
+
const m = i[d.field], x = _(m, i, d);
|
|
820
|
+
if (x && x.length > 0) {
|
|
821
|
+
const N = x.filter((S) => S && typeof S == "string");
|
|
822
|
+
N.forEach((S) => w.classList.add(S)), w.setAttribute("data-dynamic-classes", N.join(" "));
|
|
818
823
|
} else
|
|
819
824
|
w.removeAttribute("data-dynamic-classes");
|
|
820
|
-
} catch (
|
|
821
|
-
console.warn(`[tbw-grid] cellClass callback error for column '${
|
|
825
|
+
} catch (m) {
|
|
826
|
+
console.warn(`[tbw-grid] cellClass callback error for column '${d.field}':`, m), w.removeAttribute("data-dynamic-classes");
|
|
822
827
|
}
|
|
823
828
|
}
|
|
824
829
|
if (w.classList.contains("editing")) continue;
|
|
825
|
-
const
|
|
826
|
-
if (
|
|
827
|
-
const
|
|
830
|
+
const R = Qe(t, d);
|
|
831
|
+
if (R) {
|
|
832
|
+
const y = i[d.field], m = R({
|
|
828
833
|
row: i,
|
|
829
|
-
value:
|
|
830
|
-
field:
|
|
831
|
-
column:
|
|
834
|
+
value: y,
|
|
835
|
+
field: d.field,
|
|
836
|
+
column: d,
|
|
832
837
|
cellEl: w
|
|
833
838
|
});
|
|
834
|
-
typeof
|
|
839
|
+
typeof m == "string" ? (t.__frameworkAdapter?.releaseCell?.(w), w.innerHTML = W(m)) : m instanceof Node ? m.parentElement !== w && (t.__frameworkAdapter?.releaseCell?.(w), w.innerHTML = "", w.appendChild(m)) : m == null && (t.__frameworkAdapter?.releaseCell?.(w), w.textContent = y == null ? "" : String(y)), f && t._afterCellRender?.({
|
|
835
840
|
row: i,
|
|
836
841
|
rowIndex: o,
|
|
837
|
-
column:
|
|
838
|
-
colIndex:
|
|
839
|
-
value:
|
|
842
|
+
column: d,
|
|
843
|
+
colIndex: u,
|
|
844
|
+
value: y,
|
|
840
845
|
cellElement: w,
|
|
841
846
|
rowElement: e
|
|
842
847
|
});
|
|
843
848
|
continue;
|
|
844
849
|
}
|
|
845
|
-
if (
|
|
850
|
+
if (d.__viewTemplate || d.__compiledView || d.externalView)
|
|
846
851
|
continue;
|
|
847
|
-
const
|
|
848
|
-
let
|
|
849
|
-
const
|
|
850
|
-
if (
|
|
852
|
+
const E = i[d.field];
|
|
853
|
+
let T;
|
|
854
|
+
const C = Ze(t, d);
|
|
855
|
+
if (C) {
|
|
851
856
|
try {
|
|
852
|
-
const
|
|
853
|
-
|
|
854
|
-
} catch (
|
|
855
|
-
console.warn(`[tbw-grid] Format error in column '${
|
|
857
|
+
const y = C(E, i);
|
|
858
|
+
T = y == null ? "" : String(y);
|
|
859
|
+
} catch (y) {
|
|
860
|
+
console.warn(`[tbw-grid] Format error in column '${d.field}':`, y), T = E == null ? "" : String(E);
|
|
856
861
|
}
|
|
857
|
-
w.textContent =
|
|
858
|
-
} else
|
|
862
|
+
w.textContent = T;
|
|
863
|
+
} else d.type === "date" ? (T = je(E), w.textContent = T) : d.type === "boolean" ? w.innerHTML = Ye(!!E) : (T = E == null ? "" : String(E), w.textContent = T);
|
|
859
864
|
f && t._afterCellRender?.({
|
|
860
865
|
row: i,
|
|
861
866
|
rowIndex: o,
|
|
862
|
-
column:
|
|
863
|
-
colIndex:
|
|
864
|
-
value:
|
|
867
|
+
column: d,
|
|
868
|
+
colIndex: u,
|
|
869
|
+
value: E,
|
|
865
870
|
cellElement: w,
|
|
866
871
|
rowElement: e
|
|
867
872
|
});
|
|
868
873
|
}
|
|
869
874
|
}
|
|
870
|
-
function
|
|
871
|
-
e.classList.remove("tbw-row-loading"), e.removeAttribute("aria-busy")
|
|
872
|
-
const n = t.
|
|
873
|
-
|
|
874
|
-
const
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
875
|
+
function B(t, e, i, o) {
|
|
876
|
+
e.classList.remove("tbw-row-loading"), e.removeAttribute("aria-busy");
|
|
877
|
+
const n = t.__frameworkAdapter;
|
|
878
|
+
if (n?.releaseCell) {
|
|
879
|
+
const p = e.children;
|
|
880
|
+
for (let g = p.length - 1; g >= 0; g--)
|
|
881
|
+
n.releaseCell(p[g]);
|
|
882
|
+
}
|
|
883
|
+
e.innerHTML = "";
|
|
884
|
+
const r = t._visibleColumns, s = r.length, l = t._focusRow, a = t._focusCol, c = t, h = t._hasAfterCellRenderHook?.() ?? !1, f = document.createDocumentFragment();
|
|
885
|
+
for (let p = 0; p < s; p++) {
|
|
886
|
+
const g = r[p], u = Dt();
|
|
887
|
+
u.setAttribute("aria-colindex", String(p + 1)), u.setAttribute("data-col", String(p)), u.setAttribute("data-row", String(o)), u.setAttribute("data-field", g.field), u.setAttribute("data-header", g.header ?? g.field), g.type && u.setAttribute("data-type", g.type);
|
|
888
|
+
let d = i[g.field];
|
|
889
|
+
const w = Ze(t, g);
|
|
890
|
+
if (w)
|
|
879
891
|
try {
|
|
880
|
-
|
|
881
|
-
} catch (
|
|
882
|
-
console.warn(`[tbw-grid] Format error in column '${
|
|
892
|
+
d = w(d, i);
|
|
893
|
+
} catch (C) {
|
|
894
|
+
console.warn(`[tbw-grid] Format error in column '${g.field}':`, C);
|
|
883
895
|
}
|
|
884
|
-
const
|
|
885
|
-
let
|
|
886
|
-
if (
|
|
887
|
-
const
|
|
888
|
-
typeof
|
|
889
|
-
} else if (
|
|
890
|
-
const
|
|
891
|
-
|
|
892
|
-
const
|
|
893
|
-
if (
|
|
896
|
+
const v = g.__compiledView, b = g.__viewTemplate, _ = Qe(t, g), R = g.externalView;
|
|
897
|
+
let E = !1;
|
|
898
|
+
if (_) {
|
|
899
|
+
const C = _({ row: i, value: d, field: g.field, column: g, cellEl: u });
|
|
900
|
+
typeof C == "string" ? (u.innerHTML = W(C), E = !0) : C instanceof Node ? C.parentElement !== u && (u.textContent = "", u.appendChild(C)) : C == null && (u.textContent = d == null ? "" : String(d));
|
|
901
|
+
} else if (R) {
|
|
902
|
+
const C = R, y = document.createElement("div");
|
|
903
|
+
y.setAttribute("data-external-view", ""), y.setAttribute("data-field", g.field), u.appendChild(y);
|
|
904
|
+
const m = { row: i, value: d, field: g.field, column: g };
|
|
905
|
+
if (C.mount)
|
|
894
906
|
try {
|
|
895
|
-
|
|
896
|
-
} catch (
|
|
897
|
-
console.warn(`[tbw-grid] External view mount error for column '${
|
|
907
|
+
C.mount({ placeholder: y, context: m, spec: C });
|
|
908
|
+
} catch (x) {
|
|
909
|
+
console.warn(`[tbw-grid] External view mount error for column '${g.field}':`, x);
|
|
898
910
|
}
|
|
899
911
|
else
|
|
900
912
|
queueMicrotask(() => {
|
|
901
913
|
try {
|
|
902
|
-
|
|
914
|
+
c.dispatchEvent(
|
|
903
915
|
new CustomEvent("mount-external-view", {
|
|
904
916
|
bubbles: !0,
|
|
905
917
|
composed: !0,
|
|
906
|
-
detail: { placeholder:
|
|
918
|
+
detail: { placeholder: y, spec: C, context: m }
|
|
907
919
|
})
|
|
908
920
|
);
|
|
909
|
-
} catch (
|
|
910
|
-
console.warn(`[tbw-grid] External view event dispatch error for column '${
|
|
921
|
+
} catch (x) {
|
|
922
|
+
console.warn(`[tbw-grid] External view event dispatch error for column '${g.field}':`, x);
|
|
911
923
|
}
|
|
912
924
|
});
|
|
913
|
-
|
|
914
|
-
} else if (
|
|
915
|
-
const
|
|
916
|
-
|
|
917
|
-
} else if (
|
|
918
|
-
const
|
|
919
|
-
/Reflect\.|\bProxy\b|ownKeys\(/.test(
|
|
925
|
+
y.setAttribute("data-mounted", "");
|
|
926
|
+
} else if (v) {
|
|
927
|
+
const C = v({ row: i, value: d, field: g.field, column: g }), y = v.__blocked;
|
|
928
|
+
u.innerHTML = y ? "" : W(C), E = !0, y && (u.textContent = "", u.setAttribute("data-blocked-template", ""));
|
|
929
|
+
} else if (b) {
|
|
930
|
+
const C = b.innerHTML;
|
|
931
|
+
/Reflect\.|\bProxy\b|ownKeys\(/.test(C) ? (u.textContent = "", u.setAttribute("data-blocked-template", "")) : (u.innerHTML = W(Xe(C, { row: i, value: d })), E = !0);
|
|
920
932
|
} else
|
|
921
|
-
|
|
922
|
-
if (
|
|
923
|
-
|
|
924
|
-
const
|
|
925
|
-
/Proxy|Reflect\.ownKeys/.test(
|
|
933
|
+
w ? u.textContent = d == null ? "" : String(d) : g.type === "date" ? u.textContent = je(d) : g.type === "boolean" ? u.innerHTML = Ye(!!d) : u.textContent = d == null ? "" : String(d);
|
|
934
|
+
if (E) {
|
|
935
|
+
xt(u);
|
|
936
|
+
const C = u.textContent || "";
|
|
937
|
+
/Proxy|Reflect\.ownKeys/.test(C) && (u.textContent = C.replace(/Proxy|Reflect\.ownKeys/g, "").trim(), /Proxy|Reflect\.ownKeys/.test(u.textContent || "") && (u.textContent = ""));
|
|
926
938
|
}
|
|
927
|
-
|
|
928
|
-
const
|
|
929
|
-
if (
|
|
939
|
+
u.hasAttribute("data-blocked-template") && (u.textContent || "").trim().length && (u.textContent = ""), g.editable ? u.tabIndex = 0 : g.type === "boolean" && (u.hasAttribute("tabindex") || (u.tabIndex = 0)), l === o && a === p ? (u.classList.add("cell-focus"), u.setAttribute("aria-selected", "true")) : u.setAttribute("aria-selected", "false");
|
|
940
|
+
const T = g.cellClass;
|
|
941
|
+
if (T)
|
|
930
942
|
try {
|
|
931
|
-
const
|
|
932
|
-
if (
|
|
933
|
-
const
|
|
934
|
-
|
|
943
|
+
const C = i[g.field], y = T(C, i, g);
|
|
944
|
+
if (y && y.length > 0) {
|
|
945
|
+
const m = y.filter((x) => x && typeof x == "string");
|
|
946
|
+
m.forEach((x) => u.classList.add(x)), u.setAttribute("data-dynamic-classes", m.join(" "));
|
|
935
947
|
}
|
|
936
|
-
} catch (
|
|
937
|
-
console.warn(`[tbw-grid] cellClass callback error for column '${
|
|
948
|
+
} catch (C) {
|
|
949
|
+
console.warn(`[tbw-grid] cellClass callback error for column '${g.field}':`, C);
|
|
938
950
|
}
|
|
939
|
-
|
|
951
|
+
h && t._afterCellRender?.({
|
|
940
952
|
row: i,
|
|
941
953
|
rowIndex: o,
|
|
942
|
-
column:
|
|
943
|
-
colIndex:
|
|
944
|
-
value:
|
|
945
|
-
cellElement:
|
|
954
|
+
column: g,
|
|
955
|
+
colIndex: p,
|
|
956
|
+
value: d,
|
|
957
|
+
cellElement: u,
|
|
946
958
|
rowElement: e
|
|
947
|
-
}),
|
|
959
|
+
}), f.appendChild(u);
|
|
948
960
|
}
|
|
949
|
-
e.appendChild(
|
|
961
|
+
e.appendChild(f);
|
|
950
962
|
}
|
|
951
|
-
function
|
|
963
|
+
function Le(t, e, i) {
|
|
952
964
|
if (e.target?.closest(".resize-handle")) return;
|
|
953
|
-
const o = i.querySelector(".cell[data-row]"), n =
|
|
965
|
+
const o = i.querySelector(".cell[data-row]"), n = Ke(o);
|
|
954
966
|
if (n < 0) return;
|
|
955
967
|
const r = t._rows[n];
|
|
956
968
|
if (!r || t._dispatchRowClick?.(e, n, r, i))
|
|
@@ -963,30 +975,30 @@ function xe(t, e, i) {
|
|
|
963
975
|
return;
|
|
964
976
|
const a = t._focusRow !== n || t._focusCol !== l;
|
|
965
977
|
if (t._focusRow = n, t._focusCol = l, s.classList.contains("editing")) {
|
|
966
|
-
a && (
|
|
967
|
-
const c = s.querySelector(
|
|
978
|
+
a && (Ce(t._bodyEl ?? t), s.classList.add("cell-focus"));
|
|
979
|
+
const c = s.querySelector(Je);
|
|
968
980
|
try {
|
|
969
981
|
c?.focus({ preventScroll: !0 });
|
|
970
982
|
} catch {
|
|
971
983
|
}
|
|
972
984
|
return;
|
|
973
985
|
}
|
|
974
|
-
|
|
986
|
+
$(t);
|
|
975
987
|
}
|
|
976
988
|
}
|
|
977
989
|
}
|
|
978
|
-
function
|
|
990
|
+
function kt(t, e) {
|
|
979
991
|
if (t._dispatchKeyDown?.(e))
|
|
980
992
|
return;
|
|
981
|
-
const i = t._rows.length - 1, o = t._visibleColumns.length - 1, n = t._activeEditRows !== void 0 && t._activeEditRows !== -1, s = t._visibleColumns[t._focusCol]?.type, l = e.composedPath?.() ?? [], a = l.length ? l[0] : e.target, c = (
|
|
982
|
-
if (!
|
|
983
|
-
const f =
|
|
984
|
-
return !!(f === "INPUT" || f === "SELECT" || f === "TEXTAREA" ||
|
|
993
|
+
const i = t._rows.length - 1, o = t._visibleColumns.length - 1, n = t._activeEditRows !== void 0 && t._activeEditRows !== -1, s = t._visibleColumns[t._focusCol]?.type, l = e.composedPath?.() ?? [], a = l.length ? l[0] : e.target, c = (h) => {
|
|
994
|
+
if (!h) return !1;
|
|
995
|
+
const f = h.tagName;
|
|
996
|
+
return !!(f === "INPUT" || f === "SELECT" || f === "TEXTAREA" || h.isContentEditable);
|
|
985
997
|
};
|
|
986
998
|
if (!(c(a) && (e.key === "Home" || e.key === "End")) && !(c(a) && (e.key === "ArrowUp" || e.key === "ArrowDown") && a.tagName === "INPUT" && a.type === "number") && !(c(a) && (e.key === "ArrowLeft" || e.key === "ArrowRight")) && !(c(a) && (e.key === "Enter" || e.key === "Escape")) && !(n && s === "select" && (e.key === "ArrowDown" || e.key === "ArrowUp"))) {
|
|
987
999
|
switch (e.key) {
|
|
988
1000
|
case "Tab": {
|
|
989
|
-
e.preventDefault(), !e.shiftKey ? t._focusCol < o ? t._focusCol += 1 : (typeof t.commitActiveRowEdit == "function" && t.commitActiveRowEdit(), t._focusRow < i && (t._focusRow += 1, t._focusCol = 0)) : t._focusCol > 0 ? t._focusCol -= 1 : t._focusRow > 0 && (typeof t.commitActiveRowEdit == "function" && t._activeEditRows === t._focusRow && t.commitActiveRowEdit(), t._focusRow -= 1, t._focusCol = o),
|
|
1001
|
+
e.preventDefault(), !e.shiftKey ? t._focusCol < o ? t._focusCol += 1 : (typeof t.commitActiveRowEdit == "function" && t.commitActiveRowEdit(), t._focusRow < i && (t._focusRow += 1, t._focusCol = 0)) : t._focusCol > 0 ? t._focusCol -= 1 : t._focusRow > 0 && (typeof t.commitActiveRowEdit == "function" && t._activeEditRows === t._focusRow && t.commitActiveRowEdit(), t._focusRow -= 1, t._focusCol = o), $(t);
|
|
990
1002
|
return;
|
|
991
1003
|
}
|
|
992
1004
|
case "ArrowDown":
|
|
@@ -996,18 +1008,18 @@ function Dt(t, e) {
|
|
|
996
1008
|
n && typeof t.commitActiveRowEdit == "function" && t.commitActiveRowEdit(), t._focusRow = Math.max(0, t._focusRow - 1), e.preventDefault();
|
|
997
1009
|
break;
|
|
998
1010
|
case "ArrowRight": {
|
|
999
|
-
|
|
1011
|
+
He(t) ? t._focusCol = Math.max(0, t._focusCol - 1) : t._focusCol = Math.min(o, t._focusCol + 1), e.preventDefault();
|
|
1000
1012
|
break;
|
|
1001
1013
|
}
|
|
1002
1014
|
case "ArrowLeft": {
|
|
1003
|
-
|
|
1015
|
+
He(t) ? t._focusCol = Math.min(o, t._focusCol + 1) : t._focusCol = Math.max(0, t._focusCol - 1), e.preventDefault();
|
|
1004
1016
|
break;
|
|
1005
1017
|
}
|
|
1006
1018
|
case "Home":
|
|
1007
|
-
(e.ctrlKey || e.metaKey) && (n && typeof t.commitActiveRowEdit == "function" && t.commitActiveRowEdit(), t._focusRow = 0), t._focusCol = 0, e.preventDefault(),
|
|
1019
|
+
(e.ctrlKey || e.metaKey) && (n && typeof t.commitActiveRowEdit == "function" && t.commitActiveRowEdit(), t._focusRow = 0), t._focusCol = 0, e.preventDefault(), $(t, { forceScrollLeft: !0 });
|
|
1008
1020
|
return;
|
|
1009
1021
|
case "End":
|
|
1010
|
-
(e.ctrlKey || e.metaKey) && (n && typeof t.commitActiveRowEdit == "function" && t.commitActiveRowEdit(), t._focusRow = i), t._focusCol = o, e.preventDefault(),
|
|
1022
|
+
(e.ctrlKey || e.metaKey) && (n && typeof t.commitActiveRowEdit == "function" && t.commitActiveRowEdit(), t._focusRow = i), t._focusCol = o, e.preventDefault(), $(t, { forceScrollRight: !0 });
|
|
1011
1023
|
return;
|
|
1012
1024
|
case "PageDown":
|
|
1013
1025
|
t._focusRow = Math.min(i, t._focusRow + 20), e.preventDefault();
|
|
@@ -1016,27 +1028,27 @@ function Dt(t, e) {
|
|
|
1016
1028
|
t._focusRow = Math.max(0, t._focusRow - 20), e.preventDefault();
|
|
1017
1029
|
break;
|
|
1018
1030
|
case "Enter": {
|
|
1019
|
-
const
|
|
1020
|
-
`[data-row="${
|
|
1021
|
-
),
|
|
1022
|
-
rowIndex:
|
|
1031
|
+
const h = t._focusRow, f = t._focusCol, p = t._visibleColumns[f], g = t._rows[h], u = p?.field ?? "", d = u && g ? g[u] : void 0, w = t.querySelector(
|
|
1032
|
+
`[data-row="${h}"][data-col="${f}"]`
|
|
1033
|
+
), v = {
|
|
1034
|
+
rowIndex: h,
|
|
1023
1035
|
colIndex: f,
|
|
1024
|
-
field:
|
|
1025
|
-
value:
|
|
1036
|
+
field: u,
|
|
1037
|
+
value: d,
|
|
1026
1038
|
row: g,
|
|
1027
1039
|
cellEl: w,
|
|
1028
1040
|
trigger: "keyboard",
|
|
1029
1041
|
originalEvent: e
|
|
1030
|
-
},
|
|
1042
|
+
}, b = new CustomEvent("cell-activate", {
|
|
1031
1043
|
cancelable: !0,
|
|
1032
|
-
detail:
|
|
1044
|
+
detail: v
|
|
1033
1045
|
});
|
|
1034
|
-
t.dispatchEvent(
|
|
1035
|
-
const
|
|
1046
|
+
t.dispatchEvent(b);
|
|
1047
|
+
const _ = new CustomEvent("activate-cell", {
|
|
1036
1048
|
cancelable: !0,
|
|
1037
|
-
detail: { row:
|
|
1049
|
+
detail: { row: h, col: f }
|
|
1038
1050
|
});
|
|
1039
|
-
if (t.dispatchEvent(
|
|
1051
|
+
if (t.dispatchEvent(_), b.defaultPrevented || _.defaultPrevented) {
|
|
1040
1052
|
e.preventDefault();
|
|
1041
1053
|
return;
|
|
1042
1054
|
}
|
|
@@ -1045,19 +1057,19 @@ function Dt(t, e) {
|
|
|
1045
1057
|
default:
|
|
1046
1058
|
return;
|
|
1047
1059
|
}
|
|
1048
|
-
|
|
1060
|
+
$(t);
|
|
1049
1061
|
}
|
|
1050
1062
|
}
|
|
1051
|
-
function
|
|
1063
|
+
function $(t, e) {
|
|
1052
1064
|
if (t._virtualization?.enabled) {
|
|
1053
|
-
const { rowHeight: s, container: l, viewportEl: a } = t._virtualization, c = l,
|
|
1054
|
-
if (c &&
|
|
1065
|
+
const { rowHeight: s, container: l, viewportEl: a } = t._virtualization, c = l, h = a?.clientHeight ?? c?.clientHeight ?? 0;
|
|
1066
|
+
if (c && h > 0) {
|
|
1055
1067
|
const f = t._focusRow * s;
|
|
1056
|
-
f < c.scrollTop ? c.scrollTop = f : f + s > c.scrollTop +
|
|
1068
|
+
f < c.scrollTop ? c.scrollTop = f : f + s > c.scrollTop + h && (c.scrollTop = f - h + s);
|
|
1057
1069
|
}
|
|
1058
1070
|
}
|
|
1059
1071
|
const i = t._activeEditRows !== void 0 && t._activeEditRows !== -1;
|
|
1060
|
-
i || t.refreshVirtualWindow(!1),
|
|
1072
|
+
i || t.refreshVirtualWindow(!1), Ce(t._bodyEl), Array.from(t._bodyEl.querySelectorAll('[aria-selected="true"]')).forEach((s) => {
|
|
1061
1073
|
s.setAttribute("aria-selected", "false");
|
|
1062
1074
|
});
|
|
1063
1075
|
const o = t._focusRow, n = t._virtualization.start ?? 0, r = t._virtualization.end ?? t._rows.length;
|
|
@@ -1075,12 +1087,12 @@ function q(t, e) {
|
|
|
1075
1087
|
else {
|
|
1076
1088
|
const c = t._getHorizontalScrollOffsets?.(s ?? void 0, l) ?? { left: 0, right: 0 };
|
|
1077
1089
|
if (!c.skipScroll) {
|
|
1078
|
-
const
|
|
1079
|
-
|
|
1090
|
+
const h = l.getBoundingClientRect(), f = a.getBoundingClientRect(), p = h.left - f.left + a.scrollLeft, g = p + h.width, u = a.scrollLeft + c.left, d = a.scrollLeft + a.clientWidth - c.right;
|
|
1091
|
+
p < u ? a.scrollLeft = p - c.left : g > d && (a.scrollLeft = g - a.clientWidth + c.right);
|
|
1080
1092
|
}
|
|
1081
1093
|
}
|
|
1082
1094
|
if (t._activeEditRows !== void 0 && t._activeEditRows !== -1 && l.classList.contains("editing")) {
|
|
1083
|
-
const c = l.querySelector(
|
|
1095
|
+
const c = l.querySelector(Je);
|
|
1084
1096
|
if (c && document.activeElement !== c)
|
|
1085
1097
|
try {
|
|
1086
1098
|
c.focus({ preventScroll: !0 });
|
|
@@ -1096,118 +1108,118 @@ function q(t, e) {
|
|
|
1096
1108
|
}
|
|
1097
1109
|
}
|
|
1098
1110
|
}
|
|
1099
|
-
const
|
|
1100
|
-
function
|
|
1101
|
-
const i =
|
|
1102
|
-
i < 0 || o < 0 || (t._focusRow = i, t._focusCol = o,
|
|
1111
|
+
const ie = /* @__PURE__ */ new WeakMap();
|
|
1112
|
+
function Nt(t, e) {
|
|
1113
|
+
const i = Ke(e), o = Pt(e);
|
|
1114
|
+
i < 0 || o < 0 || (t._focusRow = i, t._focusCol = o, Ce(t._bodyEl), e.classList.add("cell-focus"), e.setAttribute("aria-selected", "true"));
|
|
1103
1115
|
}
|
|
1104
|
-
function
|
|
1116
|
+
function ye(t, e, i, o) {
|
|
1105
1117
|
let n = null;
|
|
1106
1118
|
const r = i.composedPath?.();
|
|
1107
1119
|
if (r && r.length > 0 ? n = r[0] : n = i.target, n && !e.contains(n)) {
|
|
1108
|
-
const
|
|
1109
|
-
|
|
1120
|
+
const d = document.elementFromPoint(i.clientX, i.clientY);
|
|
1121
|
+
d && (n = d);
|
|
1110
1122
|
}
|
|
1111
1123
|
const s = n?.closest?.("[data-col]"), l = n?.closest?.(".data-grid-row"), a = n?.closest?.(".header-row");
|
|
1112
|
-
let c,
|
|
1113
|
-
return s && (c = parseInt(s.getAttribute("data-row") ?? "-1", 10),
|
|
1124
|
+
let c, h, f, p, g, u;
|
|
1125
|
+
return s && (c = parseInt(s.getAttribute("data-row") ?? "-1", 10), h = parseInt(s.getAttribute("data-col") ?? "-1", 10), c >= 0 && h >= 0 && (f = t._rows[c], u = t._columns[h], p = u?.field, g = f && p ? f[p] : void 0)), {
|
|
1114
1126
|
type: o,
|
|
1115
1127
|
row: f,
|
|
1116
1128
|
rowIndex: c !== void 0 && c >= 0 ? c : void 0,
|
|
1117
|
-
colIndex:
|
|
1118
|
-
field:
|
|
1129
|
+
colIndex: h !== void 0 && h >= 0 ? h : void 0,
|
|
1130
|
+
field: p,
|
|
1119
1131
|
value: g,
|
|
1120
|
-
column:
|
|
1132
|
+
column: u,
|
|
1121
1133
|
originalEvent: i,
|
|
1122
1134
|
cellElement: s ?? void 0,
|
|
1123
1135
|
rowElement: l ?? void 0,
|
|
1124
1136
|
isHeader: !!a,
|
|
1125
|
-
cell: c !== void 0 &&
|
|
1137
|
+
cell: c !== void 0 && h !== void 0 && c >= 0 && h >= 0 ? { row: c, col: h } : void 0
|
|
1126
1138
|
};
|
|
1127
1139
|
}
|
|
1128
|
-
function
|
|
1129
|
-
const o =
|
|
1130
|
-
(t._dispatchCellMouseDown?.(o) ?? !1) &&
|
|
1140
|
+
function It(t, e, i) {
|
|
1141
|
+
const o = ye(t, e, i, "mousedown");
|
|
1142
|
+
(t._dispatchCellMouseDown?.(o) ?? !1) && ie.set(t, !0);
|
|
1131
1143
|
}
|
|
1132
|
-
function
|
|
1133
|
-
if (!
|
|
1134
|
-
const o =
|
|
1144
|
+
function qt(t, e, i) {
|
|
1145
|
+
if (!ie.get(t)) return;
|
|
1146
|
+
const o = ye(t, e, i, "mousemove");
|
|
1135
1147
|
t._dispatchCellMouseMove?.(o);
|
|
1136
1148
|
}
|
|
1137
|
-
function
|
|
1138
|
-
if (!
|
|
1139
|
-
const o =
|
|
1140
|
-
t._dispatchCellMouseUp?.(o),
|
|
1149
|
+
function $t(t, e, i) {
|
|
1150
|
+
if (!ie.get(t)) return;
|
|
1151
|
+
const o = ye(t, e, i, "mouseup");
|
|
1152
|
+
t._dispatchCellMouseUp?.(o), ie.set(t, !1);
|
|
1141
1153
|
}
|
|
1142
|
-
function
|
|
1154
|
+
function Wt(t, e, i) {
|
|
1143
1155
|
e.addEventListener(
|
|
1144
1156
|
"mousedown",
|
|
1145
1157
|
(o) => {
|
|
1146
1158
|
const n = o.target.closest(".cell[data-col]");
|
|
1147
|
-
n && (n.classList.contains("editing") ||
|
|
1159
|
+
n && (n.classList.contains("editing") || Nt(t, n));
|
|
1148
1160
|
},
|
|
1149
1161
|
{ signal: i }
|
|
1150
1162
|
), e.addEventListener(
|
|
1151
1163
|
"click",
|
|
1152
1164
|
(o) => {
|
|
1153
1165
|
const n = o.target.closest(".data-grid-row");
|
|
1154
|
-
n &&
|
|
1166
|
+
n && Le(t, o, n);
|
|
1155
1167
|
},
|
|
1156
1168
|
{ signal: i }
|
|
1157
1169
|
), e.addEventListener(
|
|
1158
1170
|
"dblclick",
|
|
1159
1171
|
(o) => {
|
|
1160
1172
|
const n = o.target.closest(".data-grid-row");
|
|
1161
|
-
n &&
|
|
1173
|
+
n && Le(t, o, n);
|
|
1162
1174
|
},
|
|
1163
1175
|
{ signal: i }
|
|
1164
1176
|
);
|
|
1165
1177
|
}
|
|
1166
|
-
function
|
|
1167
|
-
e.addEventListener("keydown", (n) =>
|
|
1178
|
+
function Ft(t, e, i, o) {
|
|
1179
|
+
e.addEventListener("keydown", (n) => kt(t, n), { signal: o }), i.addEventListener("mousedown", (n) => It(t, i, n), { signal: o }), document.addEventListener("mousemove", (n) => qt(t, i, n), { signal: o }), document.addEventListener("mouseup", (n) => $t(t, i, n), { signal: o });
|
|
1168
1180
|
}
|
|
1169
|
-
function
|
|
1181
|
+
function Ut(t, e) {
|
|
1170
1182
|
return t == null && e == null ? 0 : t == null ? -1 : e == null || t > e ? 1 : t < e ? -1 : 0;
|
|
1171
1183
|
}
|
|
1172
|
-
function
|
|
1173
|
-
const n = i.find((l) => l.field === e.field)?.sortComparator ??
|
|
1184
|
+
function Vt(t, e, i) {
|
|
1185
|
+
const n = i.find((l) => l.field === e.field)?.sortComparator ?? Ut, { field: r, direction: s } = e;
|
|
1174
1186
|
return [...t].sort((l, a) => n(l[r], a[r], l, a) * s);
|
|
1175
1187
|
}
|
|
1176
|
-
function
|
|
1177
|
-
t._rows = e, t.__rowRenderEpoch++, t._rowPool.forEach((n) => n.__epoch = -1),
|
|
1188
|
+
function Pe(t, e, i, o) {
|
|
1189
|
+
t._rows = e, t.__rowRenderEpoch++, t._rowPool.forEach((n) => n.__epoch = -1), oe(t), t.refreshVirtualWindow(!0), t.dispatchEvent(
|
|
1178
1190
|
new CustomEvent("sort-change", { detail: { field: i.field, direction: o } })
|
|
1179
1191
|
), t.requestStateChange?.();
|
|
1180
1192
|
}
|
|
1181
|
-
function
|
|
1182
|
-
!t._sortState || t._sortState.field !== e.field ? (t._sortState || (t.__originalOrder = t._rows.slice()),
|
|
1193
|
+
function ze(t, e) {
|
|
1194
|
+
!t._sortState || t._sortState.field !== e.field ? (t._sortState || (t.__originalOrder = t._rows.slice()), De(t, e, 1)) : t._sortState.direction === 1 ? De(t, e, -1) : (t._sortState = null, t.__rowRenderEpoch++, t._rowPool.forEach((o) => o.__epoch = -1), t._rows = t.__originalOrder.slice(), oe(t), t._headerRowEl?.querySelectorAll('[role="columnheader"].sortable')?.forEach((o) => {
|
|
1183
1195
|
o.getAttribute("aria-sort") ? (o.getAttribute("aria-sort") === "ascending" || o.getAttribute("aria-sort") === "descending") && (t._sortState || o.setAttribute("aria-sort", "none")) : o.setAttribute("aria-sort", "none");
|
|
1184
1196
|
}), t.refreshVirtualWindow(!0), t.dispatchEvent(
|
|
1185
1197
|
new CustomEvent("sort-change", { detail: { field: e.field, direction: 0 } })
|
|
1186
1198
|
), t.requestStateChange?.());
|
|
1187
1199
|
}
|
|
1188
|
-
function
|
|
1200
|
+
function De(t, e, i) {
|
|
1189
1201
|
t._sortState = { field: e.field, direction: i };
|
|
1190
|
-
const o = { field: e.field, direction: i }, n = t._columns, s = (t.effectiveConfig?.sortHandler ??
|
|
1202
|
+
const o = { field: e.field, direction: i }, n = t._columns, s = (t.effectiveConfig?.sortHandler ?? Vt)(t._rows, o, n);
|
|
1191
1203
|
s && typeof s.then == "function" ? s.then((l) => {
|
|
1192
|
-
|
|
1193
|
-
}) :
|
|
1204
|
+
Pe(t, l, e, i);
|
|
1205
|
+
}) : Pe(t, s, e, i);
|
|
1194
1206
|
}
|
|
1195
|
-
function
|
|
1207
|
+
function F(t, e) {
|
|
1196
1208
|
return t.effectiveConfig?.sortable !== !1 && e.sortable === !0;
|
|
1197
1209
|
}
|
|
1198
|
-
function
|
|
1210
|
+
function j(t, e) {
|
|
1199
1211
|
return t.effectiveConfig?.resizable !== !1 && e.resizable !== !1;
|
|
1200
1212
|
}
|
|
1201
|
-
function
|
|
1213
|
+
function Bt(t, e) {
|
|
1202
1214
|
typeof e == "string" ? t.textContent = e : e instanceof HTMLElement && (t.innerHTML = "", t.appendChild(e.cloneNode(!0)));
|
|
1203
1215
|
}
|
|
1204
|
-
function
|
|
1216
|
+
function K(t, e) {
|
|
1205
1217
|
const i = document.createElement("span");
|
|
1206
|
-
|
|
1218
|
+
Ge(i, "sort-indicator");
|
|
1207
1219
|
const o = t._sortState?.field === e.field ? t._sortState.direction : 0, n = { ...M, ...t.icons }, r = o === 1 ? n.sortAsc : o === -1 ? n.sortDesc : n.sortNone;
|
|
1208
|
-
return
|
|
1220
|
+
return Bt(i, r), i;
|
|
1209
1221
|
}
|
|
1210
|
-
function
|
|
1222
|
+
function Q(t, e, i) {
|
|
1211
1223
|
const o = document.createElement("div");
|
|
1212
1224
|
return o.className = "resize-handle", o.setAttribute("aria-hidden", "true"), o.addEventListener("mousedown", (n) => {
|
|
1213
1225
|
n.stopPropagation(), n.preventDefault(), t._resizeController.start(n, e, i);
|
|
@@ -1215,32 +1227,32 @@ function K(t, e, i) {
|
|
|
1215
1227
|
n.stopPropagation(), n.preventDefault(), t._resizeController.resetColumn(e);
|
|
1216
1228
|
}), o;
|
|
1217
1229
|
}
|
|
1218
|
-
function
|
|
1230
|
+
function Z(t, e, i, o) {
|
|
1219
1231
|
o.classList.add("sortable"), o.tabIndex = 0;
|
|
1220
1232
|
const n = t._sortState?.field === e.field ? t._sortState.direction : 0;
|
|
1221
1233
|
o.setAttribute("aria-sort", n === 0 ? "none" : n === 1 ? "ascending" : "descending"), o.addEventListener("click", (r) => {
|
|
1222
|
-
t._resizeController?.isResizing || t._dispatchHeaderClick?.(r, i, o) ||
|
|
1234
|
+
t._resizeController?.isResizing || t._dispatchHeaderClick?.(r, i, o) || ze(t, e);
|
|
1223
1235
|
}), o.addEventListener("keydown", (r) => {
|
|
1224
1236
|
if (r.key === "Enter" || r.key === " ") {
|
|
1225
1237
|
if (r.preventDefault(), t._dispatchHeaderClick?.(r, i, o)) return;
|
|
1226
|
-
|
|
1238
|
+
ze(t, e);
|
|
1227
1239
|
}
|
|
1228
1240
|
});
|
|
1229
1241
|
}
|
|
1230
|
-
function
|
|
1242
|
+
function Gt(t, e) {
|
|
1231
1243
|
if (e != null)
|
|
1232
1244
|
if (typeof e == "string") {
|
|
1233
1245
|
const i = document.createElement("span");
|
|
1234
|
-
for (i.innerHTML =
|
|
1246
|
+
for (i.innerHTML = W(e); i.firstChild; )
|
|
1235
1247
|
t.appendChild(i.firstChild);
|
|
1236
1248
|
} else e instanceof Node && t.appendChild(e);
|
|
1237
1249
|
}
|
|
1238
|
-
function
|
|
1250
|
+
function oe(t) {
|
|
1239
1251
|
t._headerRowEl = t.findHeaderRow();
|
|
1240
1252
|
const e = t._headerRowEl;
|
|
1241
1253
|
e && (e.innerHTML = "", t._visibleColumns.forEach((i, o) => {
|
|
1242
1254
|
const n = document.createElement("div");
|
|
1243
|
-
n.className = "cell",
|
|
1255
|
+
n.className = "cell", Ge(n, "header-cell"), n.setAttribute("role", "columnheader"), n.setAttribute("aria-colindex", String(o + 1)), n.setAttribute("data-field", i.field), n.setAttribute("data-col", String(o));
|
|
1244
1256
|
const r = i.header ?? i.field, s = t._sortState?.field === i.field ? t._sortState.direction : 0, l = s === 1 ? "asc" : s === -1 ? "desc" : null;
|
|
1245
1257
|
if (i.headerRenderer) {
|
|
1246
1258
|
const a = {
|
|
@@ -1249,30 +1261,30 @@ function ie(t) {
|
|
|
1249
1261
|
sortState: l,
|
|
1250
1262
|
filterActive: !1,
|
|
1251
1263
|
cellEl: n,
|
|
1252
|
-
renderSortIcon: () =>
|
|
1264
|
+
renderSortIcon: () => F(t, i) ? K(t, i) : null,
|
|
1253
1265
|
renderFilterButton: () => null
|
|
1254
1266
|
}, c = i.headerRenderer(a);
|
|
1255
|
-
|
|
1267
|
+
Gt(n, c), F(t, i) && Z(t, i, o, n), j(t, i) && (n.classList.add("resizable"), n.appendChild(Q(t, o, n)));
|
|
1256
1268
|
} else if (i.headerLabelRenderer) {
|
|
1257
1269
|
const a = {
|
|
1258
1270
|
column: i,
|
|
1259
1271
|
value: r
|
|
1260
|
-
}, c = i.headerLabelRenderer(a),
|
|
1261
|
-
c == null ?
|
|
1272
|
+
}, c = i.headerLabelRenderer(a), h = document.createElement("span");
|
|
1273
|
+
c == null ? h.textContent = r : typeof c == "string" ? h.innerHTML = W(c) : c instanceof Node && h.appendChild(c), n.appendChild(h), F(t, i) && (Z(t, i, o, n), n.appendChild(K(t, i))), j(t, i) && (n.classList.add("resizable"), n.appendChild(Q(t, o, n)));
|
|
1262
1274
|
} else if (i.__headerTemplate)
|
|
1263
|
-
Array.from(i.__headerTemplate.childNodes).forEach((a) => n.appendChild(a.cloneNode(!0))),
|
|
1275
|
+
Array.from(i.__headerTemplate.childNodes).forEach((a) => n.appendChild(a.cloneNode(!0))), F(t, i) && (Z(t, i, o, n), n.appendChild(K(t, i))), j(t, i) && (n.classList.add("resizable"), n.appendChild(Q(t, o, n)));
|
|
1264
1276
|
else {
|
|
1265
1277
|
const a = document.createElement("span");
|
|
1266
|
-
a.textContent = r, n.appendChild(a),
|
|
1278
|
+
a.textContent = r, n.appendChild(a), F(t, i) && (Z(t, i, o, n), n.appendChild(K(t, i))), j(t, i) && (n.classList.add("resizable"), n.appendChild(Q(t, o, n)));
|
|
1267
1279
|
}
|
|
1268
1280
|
e.appendChild(n);
|
|
1269
1281
|
}), e.querySelectorAll(".cell.sortable").forEach((i) => {
|
|
1270
1282
|
i.getAttribute("aria-sort") || i.setAttribute("aria-sort", "none");
|
|
1271
1283
|
}), e.children.length > 0 ? (e.setAttribute("role", "row"), e.setAttribute("aria-rowindex", "1")) : (e.removeAttribute("role"), e.removeAttribute("aria-rowindex")));
|
|
1272
1284
|
}
|
|
1273
|
-
const
|
|
1274
|
-
function
|
|
1275
|
-
return
|
|
1285
|
+
const it = typeof requestIdleCallback == "function";
|
|
1286
|
+
function Xt(t, e) {
|
|
1287
|
+
return it ? requestIdleCallback(t, e) : window.setTimeout(() => {
|
|
1276
1288
|
const i = Date.now();
|
|
1277
1289
|
t({
|
|
1278
1290
|
didTimeout: !1,
|
|
@@ -1280,14 +1292,14 @@ function Vt(t, e) {
|
|
|
1280
1292
|
});
|
|
1281
1293
|
}, 1);
|
|
1282
1294
|
}
|
|
1283
|
-
function
|
|
1284
|
-
|
|
1295
|
+
function Oe(t) {
|
|
1296
|
+
it ? cancelIdleCallback(t) : clearTimeout(t);
|
|
1285
1297
|
}
|
|
1286
|
-
function
|
|
1298
|
+
function Yt(t) {
|
|
1287
1299
|
const e = document.createElement("div");
|
|
1288
1300
|
return e.className = `tbw-spinner tbw-spinner--${t}`, e.setAttribute("role", "progressbar"), e.setAttribute("aria-label", "Loading"), e;
|
|
1289
1301
|
}
|
|
1290
|
-
function
|
|
1302
|
+
function jt(t, e) {
|
|
1291
1303
|
if (e) {
|
|
1292
1304
|
const o = e({ size: t });
|
|
1293
1305
|
if (typeof o == "string") {
|
|
@@ -1296,19 +1308,19 @@ function Gt(t, e) {
|
|
|
1296
1308
|
}
|
|
1297
1309
|
return o;
|
|
1298
1310
|
}
|
|
1299
|
-
return
|
|
1311
|
+
return Yt(t);
|
|
1300
1312
|
}
|
|
1301
|
-
function
|
|
1313
|
+
function Kt(t) {
|
|
1302
1314
|
const e = document.createElement("div");
|
|
1303
|
-
return e.className = "tbw-loading-overlay", e.setAttribute("role", "status"), e.setAttribute("aria-live", "polite"), e.appendChild(
|
|
1315
|
+
return e.className = "tbw-loading-overlay", e.setAttribute("role", "status"), e.setAttribute("aria-live", "polite"), e.appendChild(jt("large", t)), e;
|
|
1304
1316
|
}
|
|
1305
|
-
function
|
|
1317
|
+
function Qt(t, e) {
|
|
1306
1318
|
t.appendChild(e);
|
|
1307
1319
|
}
|
|
1308
|
-
function
|
|
1320
|
+
function Zt(t) {
|
|
1309
1321
|
t?.remove();
|
|
1310
1322
|
}
|
|
1311
|
-
function
|
|
1323
|
+
function Jt(t, e) {
|
|
1312
1324
|
if (e) {
|
|
1313
1325
|
if (t.classList.add("tbw-row-loading"), t.setAttribute("aria-busy", "true"), !t.querySelector(".tbw-row-loading-overlay")) {
|
|
1314
1326
|
const i = document.createElement("div");
|
|
@@ -1319,11 +1331,11 @@ function Kt(t, e) {
|
|
|
1319
1331
|
} else
|
|
1320
1332
|
t.classList.remove("tbw-row-loading"), t.removeAttribute("aria-busy"), t.querySelector(".tbw-row-loading-overlay")?.remove();
|
|
1321
1333
|
}
|
|
1322
|
-
function
|
|
1334
|
+
function ei(t, e) {
|
|
1323
1335
|
e ? (t.classList.add("tbw-cell-loading"), t.setAttribute("aria-busy", "true")) : (t.classList.remove("tbw-cell-loading"), t.removeAttribute("aria-busy"));
|
|
1324
1336
|
}
|
|
1325
|
-
var
|
|
1326
|
-
class
|
|
1337
|
+
var A = ((t) => (t[t.STYLE = 1] = "STYLE", t[t.VIRTUALIZATION = 2] = "VIRTUALIZATION", t[t.HEADER = 3] = "HEADER", t[t.ROWS = 4] = "ROWS", t[t.COLUMNS = 5] = "COLUMNS", t[t.FULL = 6] = "FULL", t))(A || {});
|
|
1338
|
+
class ti {
|
|
1327
1339
|
#l;
|
|
1328
1340
|
#n = 0;
|
|
1329
1341
|
#u = 0;
|
|
@@ -1366,15 +1378,15 @@ class Zt {
|
|
|
1366
1378
|
this.#n = 0, e >= 5 && this.#l.mergeConfig(), e >= 4 && this.#l.processRows(), e >= 5 && (this.#l.processColumns(), this.#l.updateTemplate()), e >= 3 && this.#l.renderHeader(), e >= 2 && this.#l.renderVirtualWindow(), e >= 1 && this.#l.afterRender(), !this.#o && this.#a && (this.#o = !0, this.#a()), this.#h && (this.#h(), this.#h = null, this.#d = null);
|
|
1367
1379
|
}
|
|
1368
1380
|
}
|
|
1369
|
-
function
|
|
1381
|
+
function Me(t) {
|
|
1370
1382
|
let e = null, i = null, o = null, n = null;
|
|
1371
1383
|
const r = (a) => {
|
|
1372
1384
|
if (!e) return;
|
|
1373
|
-
const c = a.clientX - e.startX,
|
|
1374
|
-
f.width =
|
|
1385
|
+
const c = a.clientX - e.startX, h = Math.max(40, e.startWidth + c), f = t._visibleColumns[e.colIndex];
|
|
1386
|
+
f.width = h, f.__userResized = !0, f.__renderedWidth = h, i == null && (i = requestAnimationFrame(() => {
|
|
1375
1387
|
i = null, t.updateTemplate?.();
|
|
1376
1388
|
})), t.dispatchEvent(
|
|
1377
|
-
new CustomEvent("column-resize", { detail: { field: f.field, width:
|
|
1389
|
+
new CustomEvent("column-resize", { detail: { field: f.field, width: h } })
|
|
1378
1390
|
);
|
|
1379
1391
|
};
|
|
1380
1392
|
let s = !1;
|
|
@@ -1388,9 +1400,9 @@ function De(t) {
|
|
|
1388
1400
|
get isResizing() {
|
|
1389
1401
|
return e !== null || s;
|
|
1390
1402
|
},
|
|
1391
|
-
start(a, c,
|
|
1403
|
+
start(a, c, h) {
|
|
1392
1404
|
a.preventDefault();
|
|
1393
|
-
const f = t._visibleColumns[c],
|
|
1405
|
+
const f = t._visibleColumns[c], p = typeof f?.width == "number" ? f.width : void 0, g = f?.__renderedWidth ?? p ?? h.getBoundingClientRect().width;
|
|
1394
1406
|
e = { startX: a.clientX, colIndex: c, startWidth: g }, window.addEventListener("mousemove", r), window.addEventListener("mouseup", l), o === null && (o = document.documentElement.style.cursor), document.documentElement.style.cursor = "e-resize", n === null && (n = document.body.style.userSelect), document.body.style.userSelect = "none";
|
|
1395
1407
|
},
|
|
1396
1408
|
resetColumn(a) {
|
|
@@ -1404,48 +1416,48 @@ function De(t) {
|
|
|
1404
1416
|
}
|
|
1405
1417
|
};
|
|
1406
1418
|
}
|
|
1407
|
-
const
|
|
1419
|
+
const ce = "data-animating", ii = {
|
|
1408
1420
|
change: "--tbw-row-change-duration",
|
|
1409
1421
|
insert: "--tbw-row-insert-duration",
|
|
1410
1422
|
remove: "--tbw-row-remove-duration"
|
|
1411
|
-
},
|
|
1423
|
+
}, oi = {
|
|
1412
1424
|
change: 500,
|
|
1413
1425
|
insert: 300,
|
|
1414
1426
|
remove: 200
|
|
1415
1427
|
};
|
|
1416
|
-
function
|
|
1428
|
+
function ni(t) {
|
|
1417
1429
|
const e = t.trim().toLowerCase();
|
|
1418
1430
|
return e.endsWith("ms") ? parseFloat(e) : e.endsWith("s") ? parseFloat(e) * 1e3 : parseFloat(e);
|
|
1419
1431
|
}
|
|
1420
|
-
function
|
|
1421
|
-
const i =
|
|
1432
|
+
function ri(t, e) {
|
|
1433
|
+
const i = ii[e], o = getComputedStyle(t).getPropertyValue(i);
|
|
1422
1434
|
if (o) {
|
|
1423
|
-
const n =
|
|
1435
|
+
const n = ni(o);
|
|
1424
1436
|
if (!isNaN(n) && n > 0)
|
|
1425
1437
|
return n;
|
|
1426
1438
|
}
|
|
1427
|
-
return
|
|
1439
|
+
return oi[e];
|
|
1428
1440
|
}
|
|
1429
|
-
function
|
|
1430
|
-
t.removeAttribute(
|
|
1431
|
-
const o =
|
|
1441
|
+
function si(t, e, i) {
|
|
1442
|
+
t.removeAttribute(ce), t.offsetWidth, t.setAttribute(ce, e);
|
|
1443
|
+
const o = ri(t, e);
|
|
1432
1444
|
setTimeout(() => {
|
|
1433
|
-
e !== "remove" && t.removeAttribute(
|
|
1445
|
+
e !== "remove" && t.removeAttribute(ce);
|
|
1434
1446
|
}, o);
|
|
1435
1447
|
}
|
|
1436
|
-
function
|
|
1448
|
+
function _e(t, e, i) {
|
|
1437
1449
|
if (e < 0)
|
|
1438
1450
|
return !1;
|
|
1439
1451
|
const o = t.findRenderedRowElement?.(e);
|
|
1440
|
-
return o ? (
|
|
1452
|
+
return o ? (si(o, i), !0) : !1;
|
|
1441
1453
|
}
|
|
1442
|
-
function
|
|
1454
|
+
function li(t, e, i) {
|
|
1443
1455
|
let o = 0;
|
|
1444
1456
|
for (const n of e)
|
|
1445
|
-
|
|
1457
|
+
_e(t, n, i) && o++;
|
|
1446
1458
|
return o;
|
|
1447
1459
|
}
|
|
1448
|
-
function
|
|
1460
|
+
function ai(t, e, i) {
|
|
1449
1461
|
const o = t._rows ?? [], n = t.getRowId;
|
|
1450
1462
|
if (!n)
|
|
1451
1463
|
return !1;
|
|
@@ -1457,9 +1469,9 @@ function ri(t, e, i) {
|
|
|
1457
1469
|
return !1;
|
|
1458
1470
|
}
|
|
1459
1471
|
});
|
|
1460
|
-
return r < 0 ? !1 :
|
|
1472
|
+
return r < 0 ? !1 : _e(t, r, i);
|
|
1461
1473
|
}
|
|
1462
|
-
function
|
|
1474
|
+
function J(t, e, i) {
|
|
1463
1475
|
const o = document.createElement(t);
|
|
1464
1476
|
if (e)
|
|
1465
1477
|
for (const n in e) {
|
|
@@ -1468,7 +1480,7 @@ function Z(t, e, i) {
|
|
|
1468
1480
|
}
|
|
1469
1481
|
return o;
|
|
1470
1482
|
}
|
|
1471
|
-
function
|
|
1483
|
+
function P(t, e) {
|
|
1472
1484
|
const i = document.createElement("div");
|
|
1473
1485
|
if (t && (i.className = t), e)
|
|
1474
1486
|
for (const o in e) {
|
|
@@ -1477,7 +1489,7 @@ function L(t, e) {
|
|
|
1477
1489
|
}
|
|
1478
1490
|
return i;
|
|
1479
1491
|
}
|
|
1480
|
-
function
|
|
1492
|
+
function ot(t, e, i) {
|
|
1481
1493
|
const o = document.createElement("button");
|
|
1482
1494
|
if (t && (o.className = t), e)
|
|
1483
1495
|
for (const n in e) {
|
|
@@ -1486,8 +1498,8 @@ function tt(t, e, i) {
|
|
|
1486
1498
|
}
|
|
1487
1499
|
return o;
|
|
1488
1500
|
}
|
|
1489
|
-
const
|
|
1490
|
-
|
|
1501
|
+
const nt = document.createElement("template");
|
|
1502
|
+
nt.innerHTML = `
|
|
1491
1503
|
<div class="tbw-scroll-area">
|
|
1492
1504
|
<div class="rows-body-wrapper">
|
|
1493
1505
|
<div class="rows-body" role="grid">
|
|
@@ -1506,38 +1518,38 @@ it.innerHTML = `
|
|
|
1506
1518
|
<div class="faux-vscroll-spacer"></div>
|
|
1507
1519
|
</div>
|
|
1508
1520
|
`;
|
|
1509
|
-
function
|
|
1510
|
-
return
|
|
1521
|
+
function rt() {
|
|
1522
|
+
return nt.content.cloneNode(!0);
|
|
1511
1523
|
}
|
|
1512
|
-
function
|
|
1513
|
-
const e = document.createDocumentFragment(), i =
|
|
1524
|
+
function ke(t) {
|
|
1525
|
+
const e = document.createDocumentFragment(), i = P(t.hasShell ? "tbw-grid-root has-shell" : "tbw-grid-root");
|
|
1514
1526
|
if (t.hasShell && t.shellHeader && t.shellBody)
|
|
1515
1527
|
i.appendChild(t.shellHeader), i.appendChild(t.shellBody);
|
|
1516
1528
|
else {
|
|
1517
|
-
const o =
|
|
1518
|
-
o.appendChild(
|
|
1529
|
+
const o = P("tbw-grid-content");
|
|
1530
|
+
o.appendChild(rt()), i.appendChild(o);
|
|
1519
1531
|
}
|
|
1520
1532
|
return e.appendChild(i), e;
|
|
1521
1533
|
}
|
|
1522
|
-
function
|
|
1523
|
-
const e =
|
|
1534
|
+
function ci(t) {
|
|
1535
|
+
const e = P("tbw-shell-header", { part: "shell-header", role: "presentation" });
|
|
1524
1536
|
if (t.title) {
|
|
1525
|
-
const r =
|
|
1537
|
+
const r = P("tbw-shell-title");
|
|
1526
1538
|
r.textContent = t.title, e.appendChild(r);
|
|
1527
1539
|
}
|
|
1528
|
-
const i =
|
|
1540
|
+
const i = P("tbw-shell-content", {
|
|
1529
1541
|
part: "shell-content",
|
|
1530
1542
|
role: "presentation",
|
|
1531
1543
|
"data-light-dom-header-content": ""
|
|
1532
1544
|
});
|
|
1533
1545
|
e.appendChild(i);
|
|
1534
|
-
const o =
|
|
1546
|
+
const o = P("tbw-shell-toolbar", { part: "shell-toolbar", role: "presentation" });
|
|
1535
1547
|
for (const r of t.configButtons)
|
|
1536
|
-
r.hasRender && o.appendChild(
|
|
1548
|
+
r.hasRender && o.appendChild(P("tbw-toolbar-content-slot", { "data-toolbar-content": r.id }));
|
|
1537
1549
|
for (const r of t.apiButtons)
|
|
1538
|
-
r.hasRender && o.appendChild(
|
|
1539
|
-
if ((t.configButtons.some((r) => r.hasRender) || t.apiButtons.some((r) => r.hasRender)) && t.hasPanels && o.appendChild(
|
|
1540
|
-
const r =
|
|
1550
|
+
r.hasRender && o.appendChild(P("tbw-toolbar-content-slot", { "data-toolbar-content": r.id }));
|
|
1551
|
+
if ((t.configButtons.some((r) => r.hasRender) || t.apiButtons.some((r) => r.hasRender)) && t.hasPanels && o.appendChild(P("tbw-toolbar-separator")), t.hasPanels) {
|
|
1552
|
+
const r = ot(t.isPanelOpen ? "tbw-toolbar-btn active" : "tbw-toolbar-btn", {
|
|
1541
1553
|
"data-panel-toggle": "",
|
|
1542
1554
|
title: "Settings",
|
|
1543
1555
|
"aria-label": "Toggle settings panel",
|
|
@@ -1548,12 +1560,12 @@ function si(t) {
|
|
|
1548
1560
|
}
|
|
1549
1561
|
return e.appendChild(o), e;
|
|
1550
1562
|
}
|
|
1551
|
-
function
|
|
1552
|
-
const e =
|
|
1553
|
-
n.appendChild(
|
|
1563
|
+
function di(t) {
|
|
1564
|
+
const e = P("tbw-shell-body"), i = t.panels.length > 0, o = t.panels.length === 1, n = P("tbw-grid-content");
|
|
1565
|
+
n.appendChild(rt());
|
|
1554
1566
|
let r = null;
|
|
1555
1567
|
if (i) {
|
|
1556
|
-
r =
|
|
1568
|
+
r = J("aside", {
|
|
1557
1569
|
class: t.isPanelOpen ? "tbw-tool-panel open" : "tbw-tool-panel",
|
|
1558
1570
|
part: "tool-panel",
|
|
1559
1571
|
"data-position": t.position,
|
|
@@ -1562,29 +1574,29 @@ function li(t) {
|
|
|
1562
1574
|
});
|
|
1563
1575
|
const s = t.position === "left" ? "right" : "left";
|
|
1564
1576
|
r.appendChild(
|
|
1565
|
-
|
|
1577
|
+
P("tbw-tool-panel-resize", {
|
|
1566
1578
|
"data-resize-handle": "",
|
|
1567
1579
|
"data-handle-position": s,
|
|
1568
1580
|
"aria-hidden": "true"
|
|
1569
1581
|
})
|
|
1570
1582
|
);
|
|
1571
|
-
const l =
|
|
1583
|
+
const l = P("tbw-tool-panel-content", { role: "presentation" }), a = P("tbw-accordion");
|
|
1572
1584
|
for (const c of t.panels) {
|
|
1573
|
-
const
|
|
1585
|
+
const h = `tbw-accordion-section${c.isExpanded ? " expanded" : ""}${o ? " single" : ""}`, f = P(h, { "data-section": c.id }), p = ot("tbw-accordion-header", {
|
|
1574
1586
|
"aria-expanded": String(c.isExpanded),
|
|
1575
1587
|
"aria-controls": `tbw-section-${c.id}`
|
|
1576
1588
|
});
|
|
1577
|
-
if (o &&
|
|
1578
|
-
const
|
|
1579
|
-
|
|
1589
|
+
if (o && p.setAttribute("aria-disabled", "true"), c.icon) {
|
|
1590
|
+
const u = J("span", { class: "tbw-accordion-icon" });
|
|
1591
|
+
u.innerHTML = c.icon, p.appendChild(u);
|
|
1580
1592
|
}
|
|
1581
|
-
const g =
|
|
1582
|
-
if (g.textContent = c.title,
|
|
1583
|
-
const
|
|
1584
|
-
|
|
1593
|
+
const g = J("span", { class: "tbw-accordion-title" });
|
|
1594
|
+
if (g.textContent = c.title, p.appendChild(g), !o) {
|
|
1595
|
+
const u = J("span", { class: "tbw-accordion-chevron" });
|
|
1596
|
+
u.innerHTML = c.isExpanded ? t.collapseIcon : t.expandIcon, p.appendChild(u);
|
|
1585
1597
|
}
|
|
1586
|
-
f.appendChild(
|
|
1587
|
-
|
|
1598
|
+
f.appendChild(p), f.appendChild(
|
|
1599
|
+
P("tbw-accordion-content", {
|
|
1588
1600
|
id: `tbw-section-${c.id}`,
|
|
1589
1601
|
role: "presentation"
|
|
1590
1602
|
})
|
|
@@ -1594,10 +1606,10 @@ function li(t) {
|
|
|
1594
1606
|
}
|
|
1595
1607
|
return t.position === "left" && r ? (e.appendChild(r), e.appendChild(n)) : (e.appendChild(n), r && e.appendChild(r)), e;
|
|
1596
1608
|
}
|
|
1597
|
-
function
|
|
1609
|
+
function I(t) {
|
|
1598
1610
|
return t ? typeof t == "string" ? t : t.outerHTML : "";
|
|
1599
1611
|
}
|
|
1600
|
-
function
|
|
1612
|
+
function hi() {
|
|
1601
1613
|
return {
|
|
1602
1614
|
toolPanels: /* @__PURE__ */ new Map(),
|
|
1603
1615
|
headerContents: /* @__PURE__ */ new Map(),
|
|
@@ -1616,32 +1628,32 @@ function ai() {
|
|
|
1616
1628
|
lightDomContentMoved: !1
|
|
1617
1629
|
};
|
|
1618
1630
|
}
|
|
1619
|
-
function
|
|
1631
|
+
function st(t) {
|
|
1620
1632
|
return !!(t?.header?.title || t?.header?.toolbarContents?.length || t?.toolPanels?.length || t?.headerContents?.length || t?.header?.lightDomContent?.length || t?.header?.hasToolButtonsContainer);
|
|
1621
1633
|
}
|
|
1622
|
-
function
|
|
1623
|
-
const o = t?.header?.title ?? e.lightDomTitle ?? "", n = !!o, r =
|
|
1624
|
-
for (const
|
|
1625
|
-
a.has(
|
|
1626
|
-
const
|
|
1627
|
-
let
|
|
1628
|
-
for (const
|
|
1629
|
-
|
|
1630
|
-
if (
|
|
1631
|
-
const
|
|
1632
|
-
|
|
1634
|
+
function ui(t, e, i = "☰") {
|
|
1635
|
+
const o = t?.header?.title ?? e.lightDomTitle ?? "", n = !!o, r = I(i), s = t?.header?.toolbarContents ?? [], l = [...e.toolbarContents.values()], a = new Set(s.map((d) => d.id)), c = [...s];
|
|
1636
|
+
for (const d of l)
|
|
1637
|
+
a.has(d.id) || c.push(d);
|
|
1638
|
+
const h = c.length > 0, f = e.toolPanels.size > 0, p = h && f, g = [...c].sort((d, w) => (d.order ?? 0) - (w.order ?? 0));
|
|
1639
|
+
let u = "";
|
|
1640
|
+
for (const d of g)
|
|
1641
|
+
u += `<div class="tbw-toolbar-content-slot" data-toolbar-content="${d.id}"></div>`;
|
|
1642
|
+
if (p && (u += '<div class="tbw-toolbar-separator"></div>'), f) {
|
|
1643
|
+
const d = e.isPanelOpen;
|
|
1644
|
+
u += `<button class="${d ? "tbw-toolbar-btn active" : "tbw-toolbar-btn"}" data-panel-toggle title="Settings" aria-label="Toggle settings panel" aria-pressed="${d}" aria-controls="tbw-tool-panel">${r}</button>`;
|
|
1633
1645
|
}
|
|
1634
1646
|
return `
|
|
1635
1647
|
<div class="tbw-shell-header" part="shell-header" role="presentation">
|
|
1636
|
-
${n ? `<div class="tbw-shell-title">${
|
|
1648
|
+
${n ? `<div class="tbw-shell-title">${yt(o)}</div>` : ""}
|
|
1637
1649
|
<div class="tbw-shell-content" part="shell-content" role="presentation" data-light-dom-header-content></div>
|
|
1638
1650
|
<div class="tbw-shell-toolbar" part="shell-toolbar" role="presentation">
|
|
1639
|
-
${
|
|
1651
|
+
${u}
|
|
1640
1652
|
</div>
|
|
1641
1653
|
</div>
|
|
1642
1654
|
`;
|
|
1643
1655
|
}
|
|
1644
|
-
function
|
|
1656
|
+
function Ne(t, e) {
|
|
1645
1657
|
const i = t.querySelector("tbw-grid-header");
|
|
1646
1658
|
if (!i) return;
|
|
1647
1659
|
if (!e.lightDomTitle) {
|
|
@@ -1651,7 +1663,7 @@ function Me(t, e) {
|
|
|
1651
1663
|
const o = i.querySelectorAll("tbw-grid-header-content");
|
|
1652
1664
|
o.length > 0 && e.lightDomHeaderContent.length === 0 && (e.lightDomHeaderContent = Array.from(o)), i.style.display = "none";
|
|
1653
1665
|
}
|
|
1654
|
-
function
|
|
1666
|
+
function Ie(t, e, i) {
|
|
1655
1667
|
const o = t.querySelector(":scope > tbw-grid-tool-buttons");
|
|
1656
1668
|
if (!o) return;
|
|
1657
1669
|
e.hasToolButtonsContainer = !0;
|
|
@@ -1671,7 +1683,7 @@ function ke(t, e, i) {
|
|
|
1671
1683
|
};
|
|
1672
1684
|
e.toolbarContents.set(n, r), e.lightDomToolbarContentIds.add(n), o.style.display = "none";
|
|
1673
1685
|
}
|
|
1674
|
-
function
|
|
1686
|
+
function qe(t, e, i) {
|
|
1675
1687
|
t.querySelectorAll(":scope > tbw-grid-tool-panel").forEach((n) => {
|
|
1676
1688
|
const r = n, s = r.getAttribute("id"), l = r.getAttribute("title");
|
|
1677
1689
|
if (!s || !l) {
|
|
@@ -1680,39 +1692,39 @@ function Ne(t, e, i) {
|
|
|
1680
1692
|
);
|
|
1681
1693
|
return;
|
|
1682
1694
|
}
|
|
1683
|
-
const a = r.getAttribute("icon") ?? void 0, c = r.getAttribute("tooltip") ?? void 0,
|
|
1695
|
+
const a = r.getAttribute("icon") ?? void 0, c = r.getAttribute("tooltip") ?? void 0, h = parseInt(r.getAttribute("order") ?? "100", 10);
|
|
1684
1696
|
let f;
|
|
1685
|
-
const
|
|
1686
|
-
if (
|
|
1687
|
-
f =
|
|
1697
|
+
const p = i?.(r);
|
|
1698
|
+
if (p)
|
|
1699
|
+
f = p;
|
|
1688
1700
|
else {
|
|
1689
|
-
const
|
|
1701
|
+
const d = r.innerHTML.trim();
|
|
1690
1702
|
f = (w) => {
|
|
1691
|
-
const
|
|
1692
|
-
return
|
|
1703
|
+
const v = document.createElement("div");
|
|
1704
|
+
return v.innerHTML = d, w.appendChild(v), () => v.remove();
|
|
1693
1705
|
};
|
|
1694
1706
|
}
|
|
1695
1707
|
const g = e.toolPanels.get(s);
|
|
1696
1708
|
if (g) {
|
|
1697
|
-
if (
|
|
1698
|
-
g.render = f, g.order =
|
|
1699
|
-
const
|
|
1700
|
-
|
|
1709
|
+
if (p) {
|
|
1710
|
+
g.render = f, g.order = h, g.icon = a, g.tooltip = c;
|
|
1711
|
+
const d = e.panelCleanups.get(s);
|
|
1712
|
+
d && (d(), e.panelCleanups.delete(s));
|
|
1701
1713
|
}
|
|
1702
1714
|
return;
|
|
1703
1715
|
}
|
|
1704
|
-
const
|
|
1716
|
+
const u = {
|
|
1705
1717
|
id: s,
|
|
1706
1718
|
title: l,
|
|
1707
1719
|
icon: a,
|
|
1708
1720
|
tooltip: c,
|
|
1709
|
-
order:
|
|
1721
|
+
order: h,
|
|
1710
1722
|
render: f
|
|
1711
1723
|
};
|
|
1712
|
-
e.toolPanels.set(s,
|
|
1724
|
+
e.toolPanels.set(s, u), e.lightDomToolPanelIds.add(s), r.style.display = "none";
|
|
1713
1725
|
});
|
|
1714
1726
|
}
|
|
1715
|
-
function
|
|
1727
|
+
function fi(t, e, i, o) {
|
|
1716
1728
|
const n = t.querySelector(".tbw-shell-toolbar");
|
|
1717
1729
|
n && n.addEventListener("click", (s) => {
|
|
1718
1730
|
if (s.target.closest("[data-panel-toggle]")) {
|
|
@@ -1724,36 +1736,36 @@ function di(t, e, i, o) {
|
|
|
1724
1736
|
r && r.addEventListener("click", (s) => {
|
|
1725
1737
|
const a = s.target.closest(".tbw-accordion-header");
|
|
1726
1738
|
if (a) {
|
|
1727
|
-
const
|
|
1728
|
-
|
|
1739
|
+
const h = a.closest("[data-section]")?.getAttribute("data-section");
|
|
1740
|
+
h && o.onSectionToggle(h);
|
|
1729
1741
|
}
|
|
1730
1742
|
});
|
|
1731
1743
|
}
|
|
1732
|
-
function
|
|
1744
|
+
function gi(t, e, i) {
|
|
1733
1745
|
const o = t.querySelector(".tbw-tool-panel"), n = t.querySelector("[data-resize-handle]"), r = t.querySelector(".tbw-shell-body");
|
|
1734
1746
|
if (!o || !n || !r)
|
|
1735
1747
|
return () => {
|
|
1736
1748
|
};
|
|
1737
1749
|
const s = e?.toolPanel?.position ?? "right", l = 200;
|
|
1738
|
-
let a = 0, c = 0,
|
|
1739
|
-
const
|
|
1750
|
+
let a = 0, c = 0, h = 0, f = !1;
|
|
1751
|
+
const p = (d) => {
|
|
1740
1752
|
if (!f) return;
|
|
1741
|
-
|
|
1742
|
-
const w = s === "left" ?
|
|
1743
|
-
o.style.width = `${
|
|
1753
|
+
d.preventDefault();
|
|
1754
|
+
const w = s === "left" ? d.clientX - a : a - d.clientX, v = Math.min(h, Math.max(l, c + w));
|
|
1755
|
+
o.style.width = `${v}px`;
|
|
1744
1756
|
}, g = () => {
|
|
1745
1757
|
if (!f) return;
|
|
1746
1758
|
f = !1, n.classList.remove("resizing"), o.style.transition = "", document.body.style.cursor = "", document.body.style.userSelect = "";
|
|
1747
|
-
const
|
|
1748
|
-
i(
|
|
1749
|
-
},
|
|
1750
|
-
|
|
1759
|
+
const d = o.getBoundingClientRect().width;
|
|
1760
|
+
i(d), document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", g);
|
|
1761
|
+
}, u = (d) => {
|
|
1762
|
+
d.preventDefault(), f = !0, a = d.clientX, c = o.getBoundingClientRect().width, h = r.getBoundingClientRect().width - 20, n.classList.add("resizing"), o.style.transition = "none", document.body.style.cursor = "col-resize", document.body.style.userSelect = "none", document.addEventListener("mousemove", p), document.addEventListener("mouseup", g);
|
|
1751
1763
|
};
|
|
1752
|
-
return n.addEventListener("mousedown",
|
|
1753
|
-
n.removeEventListener("mousedown",
|
|
1764
|
+
return n.addEventListener("mousedown", u), () => {
|
|
1765
|
+
n.removeEventListener("mousedown", u), document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", g);
|
|
1754
1766
|
};
|
|
1755
1767
|
}
|
|
1756
|
-
function
|
|
1768
|
+
function de(t, e, i) {
|
|
1757
1769
|
const o = e?.header?.toolbarContents ?? [], n = [...i.toolbarContents.values()], r = new Set(o.map((l) => l.id)), s = [...o];
|
|
1758
1770
|
for (const l of n)
|
|
1759
1771
|
r.has(l.id) || s.push(l);
|
|
@@ -1765,7 +1777,7 @@ function ce(t, e, i) {
|
|
|
1765
1777
|
c && i.toolbarContentCleanups.set(l.id, c);
|
|
1766
1778
|
}
|
|
1767
1779
|
}
|
|
1768
|
-
function
|
|
1780
|
+
function ge(t, e) {
|
|
1769
1781
|
const i = e.lightDomHeaderContent.length > 0 && !e.lightDomContentMoved, o = e.headerContents.size > 0;
|
|
1770
1782
|
if (!i && !o) return;
|
|
1771
1783
|
const n = t.querySelector(".tbw-shell-content");
|
|
@@ -1785,41 +1797,41 @@ function fe(t, e) {
|
|
|
1785
1797
|
c && e.headerContentCleanups.set(s.id, c);
|
|
1786
1798
|
}
|
|
1787
1799
|
}
|
|
1788
|
-
function
|
|
1800
|
+
function pi(t, e, i) {
|
|
1789
1801
|
if (!e.isPanelOpen) return;
|
|
1790
|
-
const o =
|
|
1802
|
+
const o = I(i?.expand ?? M.expand), n = I(i?.collapse ?? M.collapse);
|
|
1791
1803
|
for (const [r, s] of e.toolPanels) {
|
|
1792
1804
|
const l = e.expandedSections.has(r), a = t.querySelector(`[data-section="${r}"]`), c = a?.querySelector(".tbw-accordion-content");
|
|
1793
1805
|
if (!a || !c) continue;
|
|
1794
1806
|
a.classList.toggle("expanded", l);
|
|
1795
|
-
const
|
|
1796
|
-
|
|
1807
|
+
const h = a.querySelector(".tbw-accordion-header");
|
|
1808
|
+
h && h.setAttribute("aria-expanded", String(l));
|
|
1797
1809
|
const f = a.querySelector(".tbw-accordion-chevron");
|
|
1798
1810
|
if (f && (f.innerHTML = l ? n : o), l) {
|
|
1799
1811
|
if (c.children.length === 0) {
|
|
1800
|
-
const
|
|
1801
|
-
|
|
1812
|
+
const p = s.render(c);
|
|
1813
|
+
p && e.panelCleanups.set(r, p);
|
|
1802
1814
|
}
|
|
1803
1815
|
} else {
|
|
1804
|
-
const
|
|
1805
|
-
|
|
1816
|
+
const p = e.panelCleanups.get(r);
|
|
1817
|
+
p && (p(), e.panelCleanups.delete(r)), c.innerHTML = "";
|
|
1806
1818
|
}
|
|
1807
1819
|
}
|
|
1808
1820
|
}
|
|
1809
|
-
function
|
|
1821
|
+
function $e(t, e) {
|
|
1810
1822
|
const i = t.querySelector("[data-panel-toggle]");
|
|
1811
1823
|
i && (i.classList.toggle("active", e.isPanelOpen), i.setAttribute("aria-pressed", String(e.isPanelOpen)));
|
|
1812
1824
|
}
|
|
1813
|
-
function
|
|
1825
|
+
function We(t, e) {
|
|
1814
1826
|
const i = t.querySelector(".tbw-tool-panel");
|
|
1815
1827
|
i && (i.classList.toggle("open", e.isPanelOpen), e.isPanelOpen || (i.style.width = ""));
|
|
1816
1828
|
}
|
|
1817
|
-
function
|
|
1829
|
+
function he(t) {
|
|
1818
1830
|
for (const e of t.toolbarContentCleanups.values())
|
|
1819
1831
|
e();
|
|
1820
1832
|
t.toolbarContentCleanups.clear();
|
|
1821
1833
|
}
|
|
1822
|
-
function
|
|
1834
|
+
function wi(t) {
|
|
1823
1835
|
for (const e of t.headerContentCleanups.values())
|
|
1824
1836
|
e();
|
|
1825
1837
|
t.headerContentCleanups.clear();
|
|
@@ -1836,7 +1848,7 @@ function fi(t) {
|
|
|
1836
1848
|
t.toolPanels.get(e)?.onClose?.();
|
|
1837
1849
|
t.isPanelOpen = !1, t.expandedSections.clear(), t.toolPanels.clear(), t.headerContents.clear(), t.toolbarContents.clear(), t.lightDomHeaderContent = [], t.lightDomToolPanelIds.clear(), t.lightDomToolbarContentIds.clear(), t.lightDomContentMoved = !1;
|
|
1838
1850
|
}
|
|
1839
|
-
function
|
|
1851
|
+
function bi(t, e) {
|
|
1840
1852
|
let i = !1;
|
|
1841
1853
|
const o = {
|
|
1842
1854
|
get isInitialized() {
|
|
@@ -1865,7 +1877,7 @@ function gi(t, e) {
|
|
|
1865
1877
|
s && t.expandedSections.add(s.id);
|
|
1866
1878
|
}
|
|
1867
1879
|
const n = e.getShadow();
|
|
1868
|
-
|
|
1880
|
+
$e(n, t), We(n, t), pi(n, t, e.getAccordionIcons()), e.emit("tool-panel-open", { sections: o.expandedSections });
|
|
1869
1881
|
},
|
|
1870
1882
|
closeToolPanel() {
|
|
1871
1883
|
if (!t.isPanelOpen) return;
|
|
@@ -1876,7 +1888,7 @@ function gi(t, e) {
|
|
|
1876
1888
|
r.onClose?.();
|
|
1877
1889
|
t.isPanelOpen = !1;
|
|
1878
1890
|
const n = e.getShadow();
|
|
1879
|
-
|
|
1891
|
+
$e(n, t), We(n, t), e.emit("tool-panel-close", {});
|
|
1880
1892
|
},
|
|
1881
1893
|
toggleToolPanel() {
|
|
1882
1894
|
t.isPanelOpen ? o.closeToolPanel() : o.openToolPanel();
|
|
@@ -1892,16 +1904,16 @@ function gi(t, e) {
|
|
|
1892
1904
|
const s = e.getShadow(), l = t.expandedSections.has(n);
|
|
1893
1905
|
if (l) {
|
|
1894
1906
|
const a = t.panelCleanups.get(n);
|
|
1895
|
-
a && (a(), t.panelCleanups.delete(n)), r.onClose?.(), t.expandedSections.delete(n),
|
|
1907
|
+
a && (a(), t.panelCleanups.delete(n)), r.onClose?.(), t.expandedSections.delete(n), ue(s, n, !1);
|
|
1896
1908
|
} else {
|
|
1897
1909
|
for (const [a, c] of t.toolPanels)
|
|
1898
1910
|
if (a !== n && t.expandedSections.has(a)) {
|
|
1899
|
-
const
|
|
1900
|
-
|
|
1911
|
+
const h = t.panelCleanups.get(a);
|
|
1912
|
+
h && (h(), t.panelCleanups.delete(a)), c.onClose?.(), t.expandedSections.delete(a), ue(s, a, !1);
|
|
1901
1913
|
const f = s.querySelector(`[data-section="${a}"] .tbw-accordion-content`);
|
|
1902
1914
|
f && (f.innerHTML = "");
|
|
1903
1915
|
}
|
|
1904
|
-
t.expandedSections.add(n),
|
|
1916
|
+
t.expandedSections.add(n), ue(s, n, !0), mi(s, t, n);
|
|
1905
1917
|
}
|
|
1906
1918
|
e.emit("tool-panel-section-toggle", { id: n, expanded: !l });
|
|
1907
1919
|
},
|
|
@@ -1930,7 +1942,7 @@ function gi(t, e) {
|
|
|
1930
1942
|
console.warn(`[tbw-grid] Header content "${n.id}" already registered`);
|
|
1931
1943
|
return;
|
|
1932
1944
|
}
|
|
1933
|
-
t.headerContents.set(n.id, n), i &&
|
|
1945
|
+
t.headerContents.set(n.id, n), i && ge(e.getShadow(), t);
|
|
1934
1946
|
},
|
|
1935
1947
|
unregisterHeaderContent(n) {
|
|
1936
1948
|
const r = t.headerContentCleanups.get(n);
|
|
@@ -1955,11 +1967,11 @@ function gi(t, e) {
|
|
|
1955
1967
|
};
|
|
1956
1968
|
return o;
|
|
1957
1969
|
}
|
|
1958
|
-
function
|
|
1970
|
+
function ue(t, e, i) {
|
|
1959
1971
|
const o = t.querySelector(`[data-section="${e}"]`);
|
|
1960
1972
|
o && o.classList.toggle("expanded", i);
|
|
1961
1973
|
}
|
|
1962
|
-
function
|
|
1974
|
+
function mi(t, e, i) {
|
|
1963
1975
|
const o = e.toolPanels.get(i);
|
|
1964
1976
|
if (!o?.render) return;
|
|
1965
1977
|
const n = t.querySelector(`[data-section="${i}"] .tbw-accordion-content`);
|
|
@@ -1967,8 +1979,8 @@ function pi(t, e, i) {
|
|
|
1967
1979
|
const r = o.render(n);
|
|
1968
1980
|
r && e.panelCleanups.set(i, r);
|
|
1969
1981
|
}
|
|
1970
|
-
function
|
|
1971
|
-
const n =
|
|
1982
|
+
function vi(t, e, i, o) {
|
|
1983
|
+
const n = st(e), r = [], s = [
|
|
1972
1984
|
"tbw-grid-header",
|
|
1973
1985
|
"tbw-grid-tool-buttons",
|
|
1974
1986
|
"tbw-grid-tool-panel",
|
|
@@ -1982,62 +1994,62 @@ function wi(t, e, i, o) {
|
|
|
1982
1994
|
for (const l of r)
|
|
1983
1995
|
t.appendChild(l);
|
|
1984
1996
|
if (n) {
|
|
1985
|
-
const l =
|
|
1997
|
+
const l = I(o?.toolPanel ?? M.toolPanel), a = I(o?.expand ?? M.expand), c = I(o?.collapse ?? M.collapse), f = [...e?.header?.toolbarContents ?? []].sort((_, R) => (_.order ?? 0) - (R.order ?? 0)), g = [...e?.toolPanels ?? []].sort((_, R) => (_.order ?? 100) - (R.order ?? 100)), u = {
|
|
1986
1998
|
title: e?.header?.title ?? void 0,
|
|
1987
1999
|
hasPanels: g.length > 0,
|
|
1988
2000
|
isPanelOpen: i.isPanelOpen,
|
|
1989
2001
|
toolPanelIcon: l,
|
|
1990
|
-
configButtons: f.map((
|
|
1991
|
-
id:
|
|
2002
|
+
configButtons: f.map((_) => ({
|
|
2003
|
+
id: _.id,
|
|
1992
2004
|
hasElement: !1,
|
|
1993
|
-
hasRender: !!
|
|
2005
|
+
hasRender: !!_.render
|
|
1994
2006
|
})),
|
|
1995
2007
|
apiButtons: []
|
|
1996
|
-
},
|
|
2008
|
+
}, d = {
|
|
1997
2009
|
position: e?.toolPanel?.position ?? "right",
|
|
1998
2010
|
isPanelOpen: i.isPanelOpen,
|
|
1999
2011
|
expandIcon: a,
|
|
2000
2012
|
collapseIcon: c,
|
|
2001
|
-
panels: g.map((
|
|
2002
|
-
id:
|
|
2003
|
-
title:
|
|
2004
|
-
icon:
|
|
2005
|
-
isExpanded: i.expandedSections.has(
|
|
2013
|
+
panels: g.map((_) => ({
|
|
2014
|
+
id: _.id,
|
|
2015
|
+
title: _.title,
|
|
2016
|
+
icon: I(_.icon),
|
|
2017
|
+
isExpanded: i.expandedSections.has(_.id)
|
|
2006
2018
|
}))
|
|
2007
|
-
}, w =
|
|
2019
|
+
}, w = ci(u), v = di(d), b = ke({
|
|
2008
2020
|
hasShell: !0,
|
|
2009
2021
|
shellHeader: w,
|
|
2010
|
-
shellBody:
|
|
2022
|
+
shellBody: v
|
|
2011
2023
|
});
|
|
2012
|
-
t.appendChild(
|
|
2024
|
+
t.appendChild(b);
|
|
2013
2025
|
} else {
|
|
2014
|
-
const l =
|
|
2026
|
+
const l = ke({ hasShell: !1 });
|
|
2015
2027
|
t.appendChild(l);
|
|
2016
2028
|
}
|
|
2017
2029
|
return n;
|
|
2018
2030
|
}
|
|
2019
|
-
const
|
|
2020
|
-
let
|
|
2021
|
-
const
|
|
2022
|
-
function
|
|
2023
|
-
let t = document.getElementById(
|
|
2024
|
-
return t || (t = document.createElement("style"), t.id =
|
|
2031
|
+
const Fe = "tbw-grid-styles";
|
|
2032
|
+
let te = "";
|
|
2033
|
+
const pe = /* @__PURE__ */ new Map();
|
|
2034
|
+
function Ci() {
|
|
2035
|
+
let t = document.getElementById(Fe);
|
|
2036
|
+
return t || (t = document.createElement("style"), t.id = Fe, t.setAttribute("data-tbw-grid", "true"), document.head.appendChild(t)), t;
|
|
2025
2037
|
}
|
|
2026
|
-
function
|
|
2027
|
-
const t =
|
|
2038
|
+
function we() {
|
|
2039
|
+
const t = Ci(), e = Array.from(pe.values()).join(`
|
|
2028
2040
|
`);
|
|
2029
|
-
t.textContent = `${
|
|
2041
|
+
t.textContent = `${te}
|
|
2030
2042
|
|
|
2031
2043
|
/* Plugin Styles */
|
|
2032
2044
|
${e}`;
|
|
2033
2045
|
}
|
|
2034
|
-
function
|
|
2046
|
+
function yi(t) {
|
|
2035
2047
|
let e = !1;
|
|
2036
2048
|
for (const { name: i, styles: o } of t)
|
|
2037
|
-
|
|
2038
|
-
return e &&
|
|
2049
|
+
pe.has(i) || (pe.set(i, o), e = !0);
|
|
2050
|
+
return e && we(), e;
|
|
2039
2051
|
}
|
|
2040
|
-
function
|
|
2052
|
+
function _i() {
|
|
2041
2053
|
try {
|
|
2042
2054
|
for (const t of Array.from(document.styleSheets))
|
|
2043
2055
|
try {
|
|
@@ -2053,22 +2065,22 @@ function vi() {
|
|
|
2053
2065
|
}
|
|
2054
2066
|
return null;
|
|
2055
2067
|
}
|
|
2056
|
-
async function
|
|
2057
|
-
if (
|
|
2068
|
+
async function Ei(t) {
|
|
2069
|
+
if (te)
|
|
2058
2070
|
return;
|
|
2059
2071
|
if (typeof t == "string" && t.length > 0) {
|
|
2060
|
-
|
|
2072
|
+
te = t, we();
|
|
2061
2073
|
return;
|
|
2062
2074
|
}
|
|
2063
2075
|
await new Promise((i) => setTimeout(i, 50));
|
|
2064
|
-
const e =
|
|
2065
|
-
e ? (
|
|
2076
|
+
const e = _i();
|
|
2077
|
+
e ? (te = e, we()) : (typeof process > "u" || process.env?.NODE_ENV !== "test") && console.warn(
|
|
2066
2078
|
"[tbw-grid] Could not find grid.css in document.styleSheets. Grid styling will not work.",
|
|
2067
2079
|
"Available stylesheets:",
|
|
2068
2080
|
Array.from(document.styleSheets).map((i) => i.href || "(inline)")
|
|
2069
2081
|
);
|
|
2070
2082
|
}
|
|
2071
|
-
function
|
|
2083
|
+
function Si() {
|
|
2072
2084
|
return {
|
|
2073
2085
|
startY: null,
|
|
2074
2086
|
startX: null,
|
|
@@ -2082,39 +2094,39 @@ function yi() {
|
|
|
2082
2094
|
momentumRaf: 0
|
|
2083
2095
|
};
|
|
2084
2096
|
}
|
|
2085
|
-
function
|
|
2097
|
+
function Ri(t) {
|
|
2086
2098
|
t.startY = null, t.startX = null, t.scrollTop = null, t.scrollLeft = null, t.lastY = null, t.lastX = null, t.lastTime = null;
|
|
2087
2099
|
}
|
|
2088
|
-
function
|
|
2100
|
+
function lt(t) {
|
|
2089
2101
|
t.momentumRaf && (cancelAnimationFrame(t.momentumRaf), t.momentumRaf = 0);
|
|
2090
2102
|
}
|
|
2091
|
-
function
|
|
2103
|
+
function Ai(t, e, i) {
|
|
2092
2104
|
if (t.touches.length !== 1) return;
|
|
2093
|
-
|
|
2105
|
+
lt(e);
|
|
2094
2106
|
const o = t.touches[0];
|
|
2095
2107
|
e.startY = o.clientY, e.startX = o.clientX, e.lastY = o.clientY, e.lastX = o.clientX, e.lastTime = performance.now(), e.scrollTop = i.fauxScrollbar.scrollTop, e.scrollLeft = i.scrollArea?.scrollLeft ?? 0, e.velocityY = 0, e.velocityX = 0;
|
|
2096
2108
|
}
|
|
2097
|
-
function
|
|
2109
|
+
function Ti(t, e, i) {
|
|
2098
2110
|
if (t.touches.length !== 1 || e.startY === null || e.startX === null || e.scrollTop === null || e.scrollLeft === null)
|
|
2099
2111
|
return !1;
|
|
2100
2112
|
const o = t.touches[0], n = o.clientY, r = o.clientX, s = performance.now(), l = e.startY - n, a = e.startX - r;
|
|
2101
2113
|
if (e.lastTime !== null && e.lastY !== null && e.lastX !== null) {
|
|
2102
|
-
const
|
|
2103
|
-
|
|
2114
|
+
const d = s - e.lastTime;
|
|
2115
|
+
d > 0 && (e.velocityY = (e.lastY - n) / d, e.velocityX = (e.lastX - r) / d);
|
|
2104
2116
|
}
|
|
2105
2117
|
e.lastY = n, e.lastX = r, e.lastTime = s;
|
|
2106
|
-
const { scrollTop: c, scrollHeight:
|
|
2107
|
-
let
|
|
2118
|
+
const { scrollTop: c, scrollHeight: h, clientHeight: f } = i.fauxScrollbar, p = h - f, g = l > 0 && c < p || l < 0 && c > 0;
|
|
2119
|
+
let u = !1;
|
|
2108
2120
|
if (i.scrollArea) {
|
|
2109
|
-
const { scrollLeft:
|
|
2110
|
-
|
|
2121
|
+
const { scrollLeft: d, scrollWidth: w, clientWidth: v } = i.scrollArea, b = w - v;
|
|
2122
|
+
u = a > 0 && d < b || a < 0 && d > 0;
|
|
2111
2123
|
}
|
|
2112
|
-
return g && (i.fauxScrollbar.scrollTop = e.scrollTop + l),
|
|
2124
|
+
return g && (i.fauxScrollbar.scrollTop = e.scrollTop + l), u && i.scrollArea && (i.scrollArea.scrollLeft = e.scrollLeft + a), g || u;
|
|
2113
2125
|
}
|
|
2114
|
-
function
|
|
2115
|
-
(Math.abs(t.velocityY) > 0.1 || Math.abs(t.velocityX) > 0.1) &&
|
|
2126
|
+
function xi(t, e) {
|
|
2127
|
+
(Math.abs(t.velocityY) > 0.1 || Math.abs(t.velocityX) > 0.1) && Hi(t, e), Ri(t);
|
|
2116
2128
|
}
|
|
2117
|
-
function
|
|
2129
|
+
function Hi(t, e) {
|
|
2118
2130
|
const n = () => {
|
|
2119
2131
|
t.velocityY *= 0.95, t.velocityX *= 0.95;
|
|
2120
2132
|
const r = t.velocityY * 16, s = t.velocityX * 16;
|
|
@@ -2122,19 +2134,19 @@ function Ai(t, e) {
|
|
|
2122
2134
|
};
|
|
2123
2135
|
t.momentumRaf = requestAnimationFrame(n);
|
|
2124
2136
|
}
|
|
2125
|
-
function
|
|
2126
|
-
t.addEventListener("touchstart", (n) =>
|
|
2137
|
+
function Li(t, e, i, o) {
|
|
2138
|
+
t.addEventListener("touchstart", (n) => Ai(n, e, i), {
|
|
2127
2139
|
passive: !0,
|
|
2128
2140
|
signal: o
|
|
2129
2141
|
}), t.addEventListener(
|
|
2130
2142
|
"touchmove",
|
|
2131
2143
|
(n) => {
|
|
2132
|
-
|
|
2144
|
+
Ti(n, e, i) && n.preventDefault();
|
|
2133
2145
|
},
|
|
2134
2146
|
{ passive: !1, signal: o }
|
|
2135
|
-
), t.addEventListener("touchend", () =>
|
|
2147
|
+
), t.addEventListener("touchend", () => xi(e, i), { passive: !0, signal: o });
|
|
2136
2148
|
}
|
|
2137
|
-
const
|
|
2149
|
+
const Pi = [
|
|
2138
2150
|
{
|
|
2139
2151
|
property: "editable",
|
|
2140
2152
|
pluginName: "editing",
|
|
@@ -2174,7 +2186,7 @@ const xi = [
|
|
|
2174
2186
|
description: 'the "sticky" column property (deprecated, use "pinned")',
|
|
2175
2187
|
isUsed: (t) => t === "left" || t === "right" || t === "start" || t === "end"
|
|
2176
2188
|
}
|
|
2177
|
-
],
|
|
2189
|
+
], zi = [
|
|
2178
2190
|
{
|
|
2179
2191
|
property: "columnGroups",
|
|
2180
2192
|
pluginName: "groupingColumns",
|
|
@@ -2183,56 +2195,56 @@ const xi = [
|
|
|
2183
2195
|
isUsed: (t) => Array.isArray(t) && t.length > 0
|
|
2184
2196
|
}
|
|
2185
2197
|
];
|
|
2186
|
-
function
|
|
2198
|
+
function Di(t) {
|
|
2187
2199
|
return t.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`);
|
|
2188
2200
|
}
|
|
2189
|
-
function
|
|
2190
|
-
return `import { ${
|
|
2201
|
+
function be(t) {
|
|
2202
|
+
return `import { ${D(t)}Plugin } from '@toolbox-web/grid/plugins/${Di(t)}';`;
|
|
2191
2203
|
}
|
|
2192
|
-
function
|
|
2204
|
+
function D(t) {
|
|
2193
2205
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
2194
2206
|
}
|
|
2195
|
-
function
|
|
2207
|
+
function Ue(t, e) {
|
|
2196
2208
|
return t.some((i) => i.name === e);
|
|
2197
2209
|
}
|
|
2198
|
-
function
|
|
2199
|
-
const i =
|
|
2200
|
-
function r(l, a, c,
|
|
2210
|
+
function Oi(t, e) {
|
|
2211
|
+
const i = Pi, o = zi, n = /* @__PURE__ */ new Map();
|
|
2212
|
+
function r(l, a, c, h, f = !1) {
|
|
2201
2213
|
n.has(l) || n.set(l, { description: a, importHint: c, fields: [], isConfigProperty: f });
|
|
2202
|
-
const
|
|
2203
|
-
|
|
2214
|
+
const p = n.get(l);
|
|
2215
|
+
p.fields.includes(h) || p.fields.push(h);
|
|
2204
2216
|
}
|
|
2205
2217
|
for (const l of o) {
|
|
2206
2218
|
const a = t[l.property];
|
|
2207
|
-
(l.isUsed ? l.isUsed(a) : a !== void 0) && !
|
|
2219
|
+
(l.isUsed ? l.isUsed(a) : a !== void 0) && !Ue(e, l.pluginName) && r(l.pluginName, l.description, be(l.pluginName), l.property, !0);
|
|
2208
2220
|
}
|
|
2209
2221
|
const s = t.columns;
|
|
2210
2222
|
if (s && s.length > 0)
|
|
2211
2223
|
for (const l of s)
|
|
2212
2224
|
for (const a of i) {
|
|
2213
2225
|
const c = l[a.property];
|
|
2214
|
-
if ((a.isUsed ? a.isUsed(c) : c !== void 0) && !
|
|
2226
|
+
if ((a.isUsed ? a.isUsed(c) : c !== void 0) && !Ue(e, a.pluginName)) {
|
|
2215
2227
|
const f = l.field || "<unknown>";
|
|
2216
|
-
r(a.pluginName, a.description,
|
|
2228
|
+
r(a.pluginName, a.description, be(a.pluginName), f);
|
|
2217
2229
|
}
|
|
2218
2230
|
}
|
|
2219
2231
|
if (n.size > 0) {
|
|
2220
2232
|
const l = [];
|
|
2221
|
-
for (const [a, { description: c, importHint:
|
|
2222
|
-
if (
|
|
2233
|
+
for (const [a, { description: c, importHint: h, fields: f, isConfigProperty: p }] of n)
|
|
2234
|
+
if (p)
|
|
2223
2235
|
l.push(
|
|
2224
2236
|
`Config uses ${c}, but the required plugin is not loaded.
|
|
2225
2237
|
→ Add the plugin to your gridConfig.plugins array:
|
|
2226
|
-
${
|
|
2227
|
-
plugins: [new ${
|
|
2238
|
+
${h}
|
|
2239
|
+
plugins: [new ${D(a)}Plugin(), ...]`
|
|
2228
2240
|
);
|
|
2229
2241
|
else {
|
|
2230
2242
|
const g = f.slice(0, 3).join(", ") + (f.length > 3 ? `, ... (${f.length} total)` : "");
|
|
2231
2243
|
l.push(
|
|
2232
2244
|
`Column(s) [${g}] use ${c}, but the required plugin is not loaded.
|
|
2233
2245
|
→ Add the plugin to your gridConfig.plugins array:
|
|
2234
|
-
${
|
|
2235
|
-
plugins: [new ${
|
|
2246
|
+
${h}
|
|
2247
|
+
plugins: [new ${D(a)}Plugin(), ...]`
|
|
2236
2248
|
);
|
|
2237
2249
|
}
|
|
2238
2250
|
throw new Error(
|
|
@@ -2246,7 +2258,7 @@ This validation helps catch misconfigurations early. The properties listed above
|
|
|
2246
2258
|
);
|
|
2247
2259
|
}
|
|
2248
2260
|
}
|
|
2249
|
-
function
|
|
2261
|
+
function Mi(t) {
|
|
2250
2262
|
const e = [], i = [];
|
|
2251
2263
|
for (const o of t) {
|
|
2252
2264
|
const r = o.constructor.manifest;
|
|
@@ -2254,12 +2266,12 @@ function zi(t) {
|
|
|
2254
2266
|
for (const s of r.configRules) {
|
|
2255
2267
|
const l = o.config;
|
|
2256
2268
|
if (s.check(l)) {
|
|
2257
|
-
const c = `${`[tbw-grid:${
|
|
2269
|
+
const c = `${`[tbw-grid:${D(o.name)}Plugin]`} Configuration warning: ${s.message}`;
|
|
2258
2270
|
s.severity === "error" ? e.push(c) : i.push(c);
|
|
2259
2271
|
}
|
|
2260
2272
|
}
|
|
2261
2273
|
}
|
|
2262
|
-
if (i.length > 0 &&
|
|
2274
|
+
if (i.length > 0 && ve())
|
|
2263
2275
|
for (const o of i)
|
|
2264
2276
|
console.warn(o);
|
|
2265
2277
|
if (e.length > 0)
|
|
@@ -2269,30 +2281,30 @@ ${e.join(`
|
|
|
2269
2281
|
|
|
2270
2282
|
`)}`);
|
|
2271
2283
|
}
|
|
2272
|
-
function
|
|
2284
|
+
function ki(t, e) {
|
|
2273
2285
|
const i = t.name, n = t.constructor.dependencies ?? [];
|
|
2274
2286
|
for (const r of n) {
|
|
2275
2287
|
const s = r.name, l = r.required ?? !0, a = r.reason;
|
|
2276
|
-
if (!e.some((
|
|
2277
|
-
const
|
|
2288
|
+
if (!e.some((h) => h.name === s)) {
|
|
2289
|
+
const h = a ?? `${D(i)}Plugin requires ${D(s)}Plugin`, f = be(s);
|
|
2278
2290
|
if (l)
|
|
2279
2291
|
throw new Error(
|
|
2280
2292
|
`[tbw-grid] Plugin dependency error:
|
|
2281
2293
|
|
|
2282
|
-
${
|
|
2294
|
+
${h}.
|
|
2283
2295
|
|
|
2284
|
-
→ Add the plugin to your gridConfig.plugins array BEFORE ${
|
|
2296
|
+
→ Add the plugin to your gridConfig.plugins array BEFORE ${D(i)}Plugin:
|
|
2285
2297
|
${f}
|
|
2286
|
-
plugins: [new ${
|
|
2298
|
+
plugins: [new ${D(s)}Plugin(), new ${D(i)}Plugin()]`
|
|
2287
2299
|
);
|
|
2288
2300
|
console.info(
|
|
2289
|
-
`[tbw-grid] ${
|
|
2301
|
+
`[tbw-grid] ${D(i)}Plugin: Optional "${s}" plugin not found. Some features may be unavailable.`
|
|
2290
2302
|
);
|
|
2291
2303
|
}
|
|
2292
2304
|
}
|
|
2293
2305
|
}
|
|
2294
|
-
function
|
|
2295
|
-
if (!
|
|
2306
|
+
function Ni(t) {
|
|
2307
|
+
if (!ve()) return;
|
|
2296
2308
|
const e = new Set(t.map((o) => o.name)), i = /* @__PURE__ */ new Set();
|
|
2297
2309
|
for (const o of t) {
|
|
2298
2310
|
const r = o.constructor.manifest;
|
|
@@ -2304,7 +2316,7 @@ function Oi(t) {
|
|
|
2304
2316
|
i.add(l), console.warn(
|
|
2305
2317
|
`[tbw-grid] Plugin incompatibility warning:
|
|
2306
2318
|
|
|
2307
|
-
${
|
|
2319
|
+
${D(o.name)}Plugin and ${D(s.name)}Plugin are both loaded, but they are currently incompatible.
|
|
2308
2320
|
|
|
2309
2321
|
→ ${s.reason}
|
|
2310
2322
|
|
|
@@ -2314,31 +2326,31 @@ ${z(o.name)}Plugin and ${z(s.name)}Plugin are both loaded, but they are currentl
|
|
|
2314
2326
|
}
|
|
2315
2327
|
}
|
|
2316
2328
|
}
|
|
2317
|
-
function
|
|
2329
|
+
function at(t, e) {
|
|
2318
2330
|
return !t || typeof t != "object" ? t : "__rowCacheKey" in t ? t.__rowCacheKey : "rowId" in t && t.rowId != null ? `id:${t.rowId}` : e ? `id:${e(t)}` : t;
|
|
2319
2331
|
}
|
|
2320
|
-
function
|
|
2321
|
-
const o =
|
|
2332
|
+
function Ii(t, e, i) {
|
|
2333
|
+
const o = at(e, i);
|
|
2322
2334
|
if (typeof o == "string")
|
|
2323
2335
|
return t.byKey.get(o);
|
|
2324
2336
|
if (o && typeof o == "object")
|
|
2325
2337
|
return t.byRef.get(o);
|
|
2326
2338
|
}
|
|
2327
|
-
function
|
|
2328
|
-
const n =
|
|
2339
|
+
function qi(t, e, i, o) {
|
|
2340
|
+
const n = at(e, o);
|
|
2329
2341
|
typeof n == "string" ? t.byKey.set(n, i) : n && typeof n == "object" && t.byRef.set(n, i);
|
|
2330
2342
|
}
|
|
2331
|
-
function
|
|
2343
|
+
function $i(t, e, i, o, n) {
|
|
2332
2344
|
const r = new Array(t.length);
|
|
2333
2345
|
let s = 0;
|
|
2334
2346
|
for (let l = 0; l < t.length; l++) {
|
|
2335
2347
|
const a = t[l];
|
|
2336
|
-
let c = n?.(a, l),
|
|
2337
|
-
c === void 0 && (c =
|
|
2348
|
+
let c = n?.(a, l), h = c !== void 0;
|
|
2349
|
+
c === void 0 && (c = Ii(e, a, o.rowId), h = c !== void 0), c === void 0 && (c = i, h = !1), r[l] = { offset: s, height: c, measured: h }, s += c;
|
|
2338
2350
|
}
|
|
2339
2351
|
return r;
|
|
2340
2352
|
}
|
|
2341
|
-
function
|
|
2353
|
+
function me(t, e, i) {
|
|
2342
2354
|
if (e < 0 || e >= t.length) return;
|
|
2343
2355
|
const o = t[e], n = i - o.height;
|
|
2344
2356
|
if (n !== 0) {
|
|
@@ -2347,12 +2359,12 @@ function be(t, e, i) {
|
|
|
2347
2359
|
t[r].offset += n;
|
|
2348
2360
|
}
|
|
2349
2361
|
}
|
|
2350
|
-
function
|
|
2362
|
+
function Wi(t) {
|
|
2351
2363
|
if (t.length === 0) return 0;
|
|
2352
2364
|
const e = t[t.length - 1];
|
|
2353
2365
|
return e.offset + e.height;
|
|
2354
2366
|
}
|
|
2355
|
-
function
|
|
2367
|
+
function Ve(t, e) {
|
|
2356
2368
|
if (t.length === 0) return -1;
|
|
2357
2369
|
if (e <= 0) return 0;
|
|
2358
2370
|
let i = 0, o = t.length - 1;
|
|
@@ -2367,42 +2379,42 @@ function Fe(t, e) {
|
|
|
2367
2379
|
}
|
|
2368
2380
|
return Math.max(0, Math.min(i, t.length - 1));
|
|
2369
2381
|
}
|
|
2370
|
-
function
|
|
2382
|
+
function Fi(t, e) {
|
|
2371
2383
|
let i = 0, o = 0;
|
|
2372
2384
|
for (const n of t)
|
|
2373
2385
|
n.measured && (i += n.height, o++);
|
|
2374
2386
|
return o > 0 ? i / o : e;
|
|
2375
2387
|
}
|
|
2376
|
-
function
|
|
2388
|
+
function Ui(t) {
|
|
2377
2389
|
let e = 0;
|
|
2378
2390
|
for (const i of t)
|
|
2379
2391
|
i.measured && e++;
|
|
2380
2392
|
return e;
|
|
2381
2393
|
}
|
|
2382
|
-
function
|
|
2394
|
+
function Vi(t, e) {
|
|
2383
2395
|
const { positionCache: i, heightCache: o, rows: n, start: r, end: s, getPluginHeight: l, getRowId: a } = t;
|
|
2384
2396
|
let c = !1;
|
|
2385
|
-
e.forEach((
|
|
2386
|
-
const g =
|
|
2397
|
+
e.forEach((p) => {
|
|
2398
|
+
const g = p.dataset.rowIndex;
|
|
2387
2399
|
if (!g) return;
|
|
2388
|
-
const
|
|
2389
|
-
if (
|
|
2390
|
-
const
|
|
2400
|
+
const u = parseInt(g, 10);
|
|
2401
|
+
if (u < r || u >= s || u >= n.length) return;
|
|
2402
|
+
const d = n[u], w = l?.(d, u);
|
|
2391
2403
|
if (w !== void 0) {
|
|
2392
|
-
const
|
|
2393
|
-
(!
|
|
2404
|
+
const b = i[u];
|
|
2405
|
+
(!b.measured || Math.abs(b.height - w) > 1) && (me(i, u, w), c = !0);
|
|
2394
2406
|
return;
|
|
2395
2407
|
}
|
|
2396
|
-
const
|
|
2397
|
-
if (
|
|
2398
|
-
const
|
|
2399
|
-
(!
|
|
2408
|
+
const v = p.offsetHeight;
|
|
2409
|
+
if (v > 0) {
|
|
2410
|
+
const b = i[u];
|
|
2411
|
+
(!b.measured || Math.abs(b.height - v) > 1) && (me(i, u, v), qi(o, d, v, a), c = !0);
|
|
2400
2412
|
}
|
|
2401
2413
|
});
|
|
2402
|
-
const
|
|
2403
|
-
return { hasChanges: c, measuredCount:
|
|
2414
|
+
const h = c ? Ui(i) : 0, f = c ? Fi(i, t.defaultHeight) : 0;
|
|
2415
|
+
return { hasChanges: c, measuredCount: h, averageHeight: f };
|
|
2404
2416
|
}
|
|
2405
|
-
function
|
|
2417
|
+
function Bi(t, e, i, o) {
|
|
2406
2418
|
let n = 0, r = 0;
|
|
2407
2419
|
for (let s = 0; s < t.length; s++) {
|
|
2408
2420
|
const l = t[s];
|
|
@@ -2413,7 +2425,7 @@ function Fi(t, e, i, o) {
|
|
|
2413
2425
|
averageHeight: n > 0 ? r / n : i
|
|
2414
2426
|
};
|
|
2415
2427
|
}
|
|
2416
|
-
function
|
|
2428
|
+
function no(t) {
|
|
2417
2429
|
const { totalRows: e, viewportHeight: i, scrollTop: o, rowHeight: n, overscan: r } = t, s = Math.ceil(i / n);
|
|
2418
2430
|
let l = Math.floor(o / n) - r;
|
|
2419
2431
|
l < 0 && (l = 0);
|
|
@@ -2425,10 +2437,10 @@ function to(t) {
|
|
|
2425
2437
|
totalHeight: e * n
|
|
2426
2438
|
};
|
|
2427
2439
|
}
|
|
2428
|
-
function
|
|
2440
|
+
function ro(t, e) {
|
|
2429
2441
|
return t <= e;
|
|
2430
2442
|
}
|
|
2431
|
-
class
|
|
2443
|
+
class ne {
|
|
2432
2444
|
constructor(e) {
|
|
2433
2445
|
this.grid = e;
|
|
2434
2446
|
}
|
|
@@ -2448,7 +2460,7 @@ class oe {
|
|
|
2448
2460
|
this.attach(i);
|
|
2449
2461
|
}
|
|
2450
2462
|
attach(e) {
|
|
2451
|
-
if (
|
|
2463
|
+
if (ki(e, this.plugins), this.pluginMap.set(e.constructor, e), this.plugins.push(e), e.cellRenderers)
|
|
2452
2464
|
for (const [i, o] of Object.entries(e.cellRenderers))
|
|
2453
2465
|
this.cellRenderers.set(i, o);
|
|
2454
2466
|
if (e.headerRenderers)
|
|
@@ -2471,9 +2483,9 @@ class oe {
|
|
|
2471
2483
|
}
|
|
2472
2484
|
warnDeprecatedHooks(e) {
|
|
2473
2485
|
const i = e.constructor;
|
|
2474
|
-
if (
|
|
2486
|
+
if (ne.deprecationWarned.has(i) || !ve()) return;
|
|
2475
2487
|
const o = typeof e.getExtraHeight == "function" || typeof e.getExtraHeightBefore == "function", n = typeof e.getRowHeight == "function";
|
|
2476
|
-
o && !n && (
|
|
2488
|
+
o && !n && (ne.deprecationWarned.add(i), console.warn(
|
|
2477
2489
|
`[tbw-grid] Deprecation warning: "${e.name}" uses getExtraHeight() / getExtraHeightBefore() which are deprecated and will be removed in v3.0.
|
|
2478
2490
|
→ Migrate to getRowHeight(row, index) for better variable row height support.
|
|
2479
2491
|
→ See: https://toolbox-web.dev/docs/grid/plugins/migration#row-height-hooks`
|
|
@@ -2713,7 +2725,7 @@ class oe {
|
|
|
2713
2725
|
return e.sort((i, o) => (i.content.order ?? 0) - (o.content.order ?? 0));
|
|
2714
2726
|
}
|
|
2715
2727
|
}
|
|
2716
|
-
const Ui = "@layer tbw-base{tbw-grid{.tbw-expanding{animation:tbw-expand var(--tbw-animation-duration) var(--tbw-animation-easing) forwards;overflow:hidden}.tbw-collapsing{animation:tbw-collapse var(--tbw-animation-duration) var(--tbw-animation-easing) forwards;overflow:hidden}&[data-animation-mode=off]{--tbw-animation-enabled: 0;--tbw-animation-duration: 0ms;.data-grid-row[data-animating]{animation:none}}}tbw-grid .data-grid-row[data-animating=change]{animation:tbw-row-change var(--tbw-row-change-duration) ease-out}tbw-grid .data-grid-row[data-animating=insert]{animation:tbw-row-insert var(--tbw-row-insert-duration) ease-out;will-change:max-height,opacity}tbw-grid .data-grid-row[data-animating=remove]{animation:tbw-row-remove var(--tbw-row-remove-duration) ease-out forwards;will-change:max-height,opacity,transform;pointer-events:none}}@keyframes tbw-expand{0%{opacity:0;max-height:0;transform:translateY(-8px)}to{opacity:1;max-height:500px;transform:translateY(0)}}@keyframes tbw-collapse{0%{opacity:1;max-height:500px;transform:translateY(0)}to{opacity:0;max-height:0;transform:translateY(-8px)}}@keyframes tbw-row-change{0%{background-color:transparent}20%{background-color:var(--tbw-row-change-color)}to{background-color:transparent}}@keyframes tbw-row-insert{0%{opacity:0;max-height:0;overflow:hidden}to{opacity:1;max-height:var(--tbw-row-height, 28px);overflow:hidden}}@keyframes tbw-row-remove{0%{opacity:1;transform:translateY(0);max-height:var(--tbw-row-height, 28px)}to{opacity:0;max-height:0;transform:translateY(-8px)}}@keyframes tbw-spin{to{transform:rotate(360deg)}}@keyframes tbw-fade-in{0%{opacity:0}to{opacity:1}}", Vi = '@layer tbw-base{tbw-grid{color-scheme:inherit;position:relative;display:block;width:100%;height:100%;min-height:0;contain:content;font-family:var(--tbw-font-family);font-size:var(--tbw-font-size);font-feature-settings:"tnum","lnum";background:var(--tbw-color-bg);color:var(--tbw-color-fg);border:1px solid var(--tbw-color-border);border-radius:var(--tbw-border-radius);overflow:clip;outline:none;&,*{box-sizing:border-box}.tbw-grid-root{position:relative;display:flex;flex-direction:column;height:100%;&.has-shell{display:flex;flex-direction:column;height:100%}&:has(.selected){user-select:none}}.rows-body-wrapper{flex:1;min-height:0;display:flex;flex-direction:row;width:100%;min-width:fit-content}.rows-body{flex:1;min-width:0;min-height:0;display:flex;flex-direction:column;overflow:visible}.rows-container{display:flex;flex-direction:row;flex:1;min-height:0;overflow:visible}.rows-viewport{flex:1;min-width:0;position:relative;display:block;overflow:clip;.rows{position:absolute;top:0;left:0;min-width:100%;will-change:transform;z-index:var(--tbw-z-layer-rows, 1)}}.faux-vscroll{position:sticky;inset-inline-end:0;flex-shrink:0;width:auto;overflow-y:auto;overflow-x:hidden;z-index:var(--tbw-z-layer-header, 30)}.faux-vscroll-spacer{width:1px}&[data-has-focus]{.cell-focus,.row-focus{outline:var(--tbw-focus-outline);outline-offset:var(--tbw-focus-outline-offset)}}.sticky-left,.sticky-right{position:sticky;z-index:25}.sticky-left{box-shadow:1px 0 0 var(--tbw-color-border)}.sticky-right{box-shadow:-1px 0 0 var(--tbw-color-border)}}}', Bi = '@layer tbw-base{tbw-grid{.header{display:block;flex-shrink:0;z-index:var(--tbw-z-layer-header, 30);background:var(--tbw-color-header-bg);overflow:visible}.header-group-row{display:grid;grid-template-columns:var(--tbw-column-template);background:var(--tbw-color-header-bg);z-index:var(--tbw-z-layer-header, 30)}.header-group-cell{display:flex;align-items:center;justify-content:flex-start;padding:var(--tbw-cell-padding-header, 2px 8px);color:var(--tbw-color-header-group-fg, var(--tbw-color-header-fg));font-weight:var(--tbw-font-weight-header-group, var(--tbw-font-weight-header));justify-content:var(--tbw-align-header-group, var(--tbw-align-header, flex-start));&:not(:last-child){border-right:2px solid var(--tbw-color-border)}}.header-row{display:grid;grid-template-columns:var(--tbw-column-template);color:var(--tbw-color-header-fg);font-size:var(--tbw-font-size-header);min-height:var(--tbw-header-height);border-bottom:var(--tbw-border-header);z-index:var(--tbw-z-layer-header, 30);text-transform:var(--tbw-header-text-transform);letter-spacing:var(--tbw-header-letter-spacing);>.cell{display:flex;align-items:center;gap:4px;padding:var(--tbw-cell-padding-header, 2px 8px);background-color:var(--tbw-color-header-bg);font-weight:var(--tbw-font-weight-header);border-right:1px solid var(--tbw-color-border-cell);overflow:visible;min-width:0;>span:first-child{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:inherit}>span[part~=sort-indicator]{flex-shrink:0;opacity:.6;color:var(--tbw-sort-indicator-color);display:var(--tbw-sort-indicator-display, inline-flex);visibility:var(--tbw-sort-indicator-visibility, visible);transition:opacity .15s,visibility 0s,display 0s allow-discrete;transition-behavior:allow-discrete}&:hover>span[part~=sort-indicator]{display:inline-flex;visibility:visible}&[aria-sort=ascending]>span[part~=sort-indicator],&[aria-sort=descending]>span[part~=sort-indicator]{display:inline-flex;visibility:visible;opacity:1;color:var(--tbw-sort-indicator-active-color)}&:last-child{border-right:0;.resize-handle{right:0;width:calc(var(--tbw-resize-handle-width) / 2)}}&.grouped.group-end:not(:last-child){border-right:2px solid var(--tbw-color-border)}&.resizable{position:relative}&.sticky-left,&.sticky-right{background:var(--tbw-color-header-bg);z-index:35}}}.sortable{cursor:pointer;user-select:none}.resize-handle{position:absolute;top:0;right:calc(var(--tbw-resize-handle-width) / -2);width:var(--tbw-resize-handle-width);height:100%;cursor:e-resize;user-select:none;touch-action:none;z-index:20;background:var(--tbw-resize-handle-color);transition:background .12s ease;border-radius:var(--tbw-resize-handle-border-radius);&:after{content:"";position:absolute;top:100%;left:50%;transform:translate(-50%);width:var(--tbw-resize-indicator-width, 2px);height:0;background:var(--tbw-resize-indicator-color, var(--tbw-color-accent));opacity:0;pointer-events:none;transition:opacity .12s ease,height 0s .12s;z-index:1000}&:hover{background:var(--tbw-resize-handle-color-hover);&:after{height:100vh;opacity:var(--tbw-resize-indicator-opacity, .6);transition:opacity .12s ease,height 0s}}}}}', Gi = '@layer tbw-base{.tbw-loading-overlay{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:light-dark(rgba(255,255,255,.7),rgba(0,0,0,.5));z-index:1000;pointer-events:all;animation:tbw-fade-in .15s ease-out}.tbw-spinner{--tbw-spinner-size: 48px;--tbw-spinner-border-width: 3px;--tbw-spinner-color: var(--tbw-color-accent);--tbw-spinner-track-color: var(--tbw-color-border);width:var(--tbw-spinner-size);height:var(--tbw-spinner-size);border:var(--tbw-spinner-border-width) solid var(--tbw-spinner-track-color);border-top-color:var(--tbw-spinner-color);border-radius:50%;animation:tbw-spin .8s linear infinite}.tbw-spinner--large{--tbw-spinner-size: min(48px, calc(100% - 16px) )}.tbw-spinner--small{--tbw-spinner-size: calc(var(--tbw-row-height, 28px) * .6);--tbw-spinner-border-width: 2px}.data-grid-row.tbw-row-loading{position:relative;pointer-events:none}.tbw-row-loading-overlay{position:absolute;inset:0;background:light-dark(rgba(255,255,255,.7),rgba(0,0,0,.5));z-index:26;animation:tbw-fade-in .15s ease-out;pointer-events:none;display:flex;align-items:center}.tbw-row-loading-spinner{--_spinner-size: calc(var(--tbw-row-height, 28px) * .6);margin-left:var(--tbw-spacing-md);width:var(--_spinner-size);height:var(--_spinner-size);border:2px solid var(--tbw-spinner-track-color, var(--tbw-color-border));border-top-color:var(--tbw-spinner-color, var(--tbw-color-accent));border-radius:50%;animation:tbw-spin .8s linear infinite}.cell.tbw-cell-loading{position:relative;pointer-events:none;&:before{content:"";position:absolute;inset:0;background:light-dark(rgba(255,255,255,.7),rgba(0,0,0,.5));z-index:26;animation:tbw-fade-in .15s ease-out}&:after{--_spinner-size: calc(var(--tbw-row-height, 28px) * .5);content:"";position:absolute;left:var(--tbw-spacing-sm);top:0;bottom:0;margin:auto 0;width:var(--_spinner-size);height:var(--_spinner-size);border:2px solid var(--tbw-spinner-track-color, var(--tbw-color-border));border-top-color:var(--tbw-spinner-color, var(--tbw-color-accent));border-radius:50%;animation:tbw-spin .8s linear infinite;z-index:27}}}', Xi = "@layer tbw-base{@media(forced-colors:active){tbw-grid{--tbw-color-border: CanvasText;--tbw-color-border-strong: CanvasText;--tbw-color-border-cell: CanvasText;--tbw-color-border-header: CanvasText;--tbw-color-fg: CanvasText;--tbw-color-bg: Canvas;--tbw-color-panel-bg: Canvas;--tbw-color-header-bg: Canvas;--tbw-color-header-fg: CanvasText;--tbw-color-accent: Highlight;--tbw-color-accent-fg: HighlightText;--tbw-color-selection: Highlight;--tbw-color-row-hover: Highlight;--tbw-focus-outline: 2px solid Highlight;--tbw-range-border-color: Highlight;.cell:focus,.cell.active-cell{outline:2px solid Highlight!important;outline-offset:-2px}.data-grid-row[aria-selected=true]{background:Highlight!important;color:HighlightText!important}}}@media(prefers-reduced-motion:reduce){tbw-grid[data-animation-mode=reduced-motion]{--tbw-animation-enabled: 0;--tbw-animation-duration: 0ms;.data-grid-row[data-animating]{animation:none}}}}", Yi = "@layer tbw-base{tbw-grid{.data-grid-row{display:grid;grid-template-columns:var(--tbw-column-template);contain:layout style;&:nth-child(2n){background:var(--tbw-color-row-alt)}&:hover{background:var(--tbw-color-row-hover)}>.cell{display:block;padding:var(--tbw-cell-padding, 2px 8px);border-bottom:var(--tbw-row-divider);min-height:var(--tbw-row-height);align-content:center;border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0;white-space:var(--tbw-cell-white-space, nowrap);text-overflow:ellipsis;>*{overflow:hidden;text-overflow:ellipsis;white-space:inherit;min-width:0}&:last-child{border-right:0}&[data-type=boolean]{text-align:center;input[type=checkbox]{margin:0;width:var(--tbw-checkbox-size);height:var(--tbw-checkbox-size);vertical-align:middle}}&.selected:focus-visible,&:focus-visible:not(.cell-focus){outline:none}&.sticky-left,&.sticky-right{background:var(--tbw-color-panel-bg)}}}.selecting .data-grid-row>.cell{user-select:none}}}", ji = "@layer tbw-base{tbw-grid{.tbw-shell-header{display:flex;align-items:center;gap:8px;min-height:var(--tbw-shell-header-height);padding:0 8px;background:var(--tbw-shell-header-bg);border-bottom:1px solid var(--tbw-shell-header-border);flex-shrink:0}.tbw-shell-title{font-size:var(--tbw-shell-title-font-size);font-weight:var(--tbw-shell-title-font-weight);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tbw-shell-content{flex:1;display:flex;align-items:center;gap:12px;min-width:0;overflow:hidden}.tbw-shell-toolbar{display:flex;align-items:center;gap:var(--tbw-toolbar-button-gap);flex-shrink:0}.tbw-toolbar-btn{display:inline-flex;align-items:center;justify-content:center;width:var(--tbw-toolbar-button-size);height:var(--tbw-toolbar-button-size);padding:0;border:1px solid transparent;border-radius:var(--tbw-border-radius);background:transparent;color:var(--tbw-color-fg);cursor:pointer;font-size:16px;transition:background var(--tbw-transition-duration) var(--tbw-transition-ease),border-color var(--tbw-transition-duration) var(--tbw-transition-ease);&:hover{background:var(--tbw-color-row-hover)}&:focus-visible{outline:var(--tbw-focus-outline);outline-offset:var(--tbw-focus-outline-offset)}&.active{background:var(--tbw-focus-background);border-color:var(--tbw-color-accent)}&:disabled{opacity:.5;cursor:not-allowed}}.tbw-toolbar-separator{width:1px;height:20px;background:var(--tbw-color-border);margin:0 4px}.tbw-shell-body{position:relative;display:flex;flex:1;min-height:0;overflow:visible}.tbw-grid-content{flex:1;min-width:0;min-height:0;display:flex;flex-direction:row;overflow:hidden}.tbw-scroll-area{flex:1;min-width:0;min-height:0;display:flex;flex-direction:column;overflow-x:auto;overflow-y:hidden;overflow-anchor:none}}}", Ki = "@layer tbw-base{tbw-grid{.tbw-tool-panel{position:absolute;top:0;bottom:0;right:0;width:0;overflow:hidden;background:var(--tbw-tool-panel-bg);border-left:1px solid var(--tbw-tool-panel-border);transition:width var(--tbw-tool-panel-transition);display:flex;flex-direction:column;z-index:30;box-shadow:-2px 0 8px var(--tbw-color-shadow);&[data-position=left]{right:auto;left:0;border-left:none;border-right:1px solid var(--tbw-tool-panel-border);box-shadow:2px 0 8px var(--tbw-color-shadow)}&.open{width:var(--tbw-tool-panel-width)}}.tbw-tool-panel-resize{position:absolute;top:0;bottom:0;width:6px;cursor:col-resize;background:transparent;z-index:10;transition:background var(--tbw-transition-duration) var(--tbw-transition-ease);&[data-handle-position=left]{left:0}&[data-handle-position=right]{right:0}&:hover,&.resizing{background:var(--tbw-color-accent)}}.tbw-tool-panel-header{display:flex;align-items:center;justify-content:space-between;min-height:var(--tbw-tool-panel-header-height);padding:0 12px;border-bottom:1px solid var(--tbw-tool-panel-border);flex-shrink:0}.tbw-tool-panel-title{font-weight:600;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tbw-tool-panel-close{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:none;border-radius:var(--tbw-border-radius);background:transparent;color:var(--tbw-color-fg-muted);cursor:pointer;font-size:14px;&:hover{background:var(--tbw-color-row-hover);color:var(--tbw-color-fg)}}.tbw-tool-panel-content{flex:1;overflow:auto}.tbw-accordion{display:flex;flex-direction:column;gap:0}.tbw-accordion-section{border-bottom:1px solid var(--tbw-tool-panel-border);&:last-child{border-bottom:none}&.single .tbw-accordion-header{cursor:default;&:hover{background:transparent}}&.expanded{.tbw-accordion-chevron{transform:rotate(90deg)}.tbw-accordion-content{display:block}}}.tbw-accordion-header{display:flex;align-items:center;gap:8px;width:100%;padding:10px 12px;border:none;background:transparent;color:var(--tbw-color-fg);font-size:13px;font-weight:600;text-align:start;cursor:pointer;user-select:none;&:hover{background:var(--tbw-color-row-hover)}}.tbw-accordion-chevron{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;font-size:10px;color:var(--tbw-color-fg-muted);transition:transform .15s ease;flex-shrink:0}.tbw-accordion-icon{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;font-size:14px;flex-shrink:0}.tbw-accordion-title{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tbw-accordion-content{display:none}}}", Qi = "@layer tbw-base{tbw-grid{--tbw-base-icon-size: 1em;--tbw-base-radius: .25em;--tbw-font-size: 1em;--tbw-font-size-sm: .9285em;--tbw-font-size-xs: .7857em;--tbw-font-size-2xs: .7142em;--tbw-spacing-xs: .25em;--tbw-spacing-sm: .375em;--tbw-spacing-md: .5em;--tbw-spacing-lg: .75em;--tbw-spacing-xl: 1em;--tbw-icon-size: var(--tbw-base-icon-size);--tbw-icon-size-sm: .875em;--tbw-checkbox-size: var(--tbw-base-icon-size);--tbw-toggle-size: 1.25em;--tbw-border-radius: var(--tbw-base-radius);--tbw-color-bg: transparent;--tbw-color-panel-bg: light-dark(#eeeeee, #222222);--tbw-color-fg: light-dark(#222222, #eeeeee);--tbw-color-fg-muted: light-dark(#555555, #aaaaaa);--tbw-color-accent: light-dark(#3b82f6, #3b82f6);--tbw-color-accent-fg: light-dark(#ffffff, #000000);--tbw-color-success: light-dark(hsl(122, 39%, 40%), hsl(122, 39%, 49%));--tbw-color-warning: light-dark(hsl(38, 92%, 50%), hsl(38, 92%, 50%));--tbw-color-error: light-dark(hsl(0, 65%, 51%), hsl(0, 65%, 55%));--tbw-color-danger: var(--tbw-color-error);--tbw-color-selection: light-dark(#fff7d6, #333333);--tbw-color-row-alt: var(--tbw-color-bg);--tbw-color-row-hover: light-dark(#f0f6ff, #1c1c1c);--tbw-color-header-bg: color-mix(in hsl, var(--tbw-color-panel-bg) 85%, var(--tbw-color-fg));--tbw-color-header-fg: color-mix(in hsl, var(--tbw-color-fg) 75%, var(--tbw-color-panel-bg));--tbw-color-border: light-dark(#d0d0d4, #454545);--tbw-color-border-strong: light-dark(#777777, #666666);--tbw-color-border-cell: var(--tbw-color-border);--tbw-color-border-header: var(--tbw-color-border);--tbw-color-shadow: light-dark(rgba(0, 0, 0, .1), rgba(0, 0, 0, .3));--tbw-font-family: inherit;--tbw-font-size-header: var(--tbw-font-size);--tbw-font-weight-header: bold;--tbw-cell-padding-header: var(--tbw-spacing-xs) var(--tbw-spacing-md);--tbw-cell-padding-v: var(--tbw-spacing-xs);--tbw-cell-padding-h: var(--tbw-spacing-md);--tbw-cell-padding: var(--tbw-cell-padding-v) var(--tbw-cell-padding-h);--tbw-cell-padding-input: var(--tbw-spacing-xs) var(--tbw-spacing-sm);--tbw-row-height: 1.75em;--tbw-header-height: 1.875em;--tbw-cell-white-space: nowrap;--tbw-border-width: 1px;--tbw-border-style: solid;--tbw-border-input: var(--tbw-border-width) var(--tbw-border-style) var(--tbw-color-border-strong);--tbw-border-header: var(--tbw-border-width) var(--tbw-border-style) var(--tbw-color-border-header);--tbw-row-divider: var(--tbw-border-width) var(--tbw-border-style) var(--tbw-color-border-cell);--tbw-row-hover-outline: 0;--tbw-color-active-row-bg: var(--tbw-color-selection);--tbw-active-row-outline: 0;--tbw-focus-outline-width: 2px;--tbw-focus-outline: var(--tbw-focus-outline-width) var(--tbw-border-style) var(--tbw-color-accent);--tbw-focus-outline-offset: -2px;--tbw-focus-background: rgba(from var(--tbw-color-accent) r g b / 12%);--tbw-range-border-color: var(--tbw-color-accent);--tbw-range-selection-bg: rgba(from var(--tbw-range-border-color) r g b / 12%);--tbw-resize-handle-width: var(--tbw-spacing-sm);--tbw-resize-handle-color: transparent;--tbw-resize-handle-color-hover: var(--tbw-color-accent);--tbw-resize-handle-border-radius: 0;--tbw-resize-indicator-width: 2px;--tbw-resize-indicator-color: var(--tbw-color-accent);--tbw-resize-indicator-opacity: .6;--tbw-transition-duration: .12s;--tbw-transition-ease: ease;--tbw-animation-duration: .2s;--tbw-animation-easing: ease-out;--tbw-animation-enabled: 1;--tbw-row-change-duration: .5s;--tbw-row-insert-duration: .3s;--tbw-row-remove-duration: .2s;--tbw-row-change-color: rgba(from var(--tbw-color-accent) r g b / 25%);--tbw-sort-indicator-color: var(--tbw-color-fg-muted);--tbw-sort-indicator-active-color: var(--tbw-color-accent);--tbw-sort-indicator-display: inline-flex;--tbw-sort-indicator-visibility: visible;--tbw-header-text-transform: none;--tbw-header-letter-spacing: normal;--tbw-color-header-separator: var(--tbw-color-border-cell);--tbw-density-scale: 1;--tbw-shell-header-height: 2.75em;--tbw-shell-header-bg: var(--tbw-color-panel-bg);--tbw-shell-header-border: var(--tbw-color-border);--tbw-shell-title-font-size: var(--tbw-font-size);--tbw-shell-title-font-weight: 600;--tbw-tool-panel-width: 17.5em;--tbw-tool-panel-bg: var(--tbw-color-panel-bg);--tbw-tool-panel-border: var(--tbw-color-border);--tbw-tool-panel-header-height: 2.5em;--tbw-tool-panel-transition: var(--tbw-animation-duration) var(--tbw-animation-easing);--tbw-toolbar-button-size: 2em;--tbw-toolbar-button-gap: var(--tbw-spacing-xs);--tbw-panel-padding: var(--tbw-spacing-lg);--tbw-panel-gap: var(--tbw-spacing-md);--tbw-menu-item-padding: var(--tbw-spacing-sm) var(--tbw-spacing-lg);--tbw-menu-item-gap: var(--tbw-spacing-md);--tbw-menu-min-width: 10rem;--tbw-button-padding: var(--tbw-spacing-sm) var(--tbw-spacing-lg);--tbw-button-padding-sm: var(--tbw-spacing-xs) var(--tbw-spacing-md);--tbw-input-height: var(--tbw-row-height);--tbw-input-padding: 0 var(--tbw-spacing-md);--tbw-detail-padding: var(--tbw-spacing-xl);--tbw-detail-max-height: 31.25rem;--tbw-indicator-size: var(--tbw-spacing-sm)}}", Zi = `/**
|
|
2728
|
+
const Gi = "@layer tbw-base{tbw-grid{.tbw-expanding{animation:tbw-expand var(--tbw-animation-duration) var(--tbw-animation-easing) forwards;overflow:hidden}.tbw-collapsing{animation:tbw-collapse var(--tbw-animation-duration) var(--tbw-animation-easing) forwards;overflow:hidden}&[data-animation-mode=off]{--tbw-animation-enabled: 0;--tbw-animation-duration: 0ms;.data-grid-row[data-animating]{animation:none}}}tbw-grid .data-grid-row[data-animating=change]{animation:tbw-row-change var(--tbw-row-change-duration) ease-out}tbw-grid .data-grid-row[data-animating=insert]{animation:tbw-row-insert var(--tbw-row-insert-duration) ease-out;will-change:max-height,opacity}tbw-grid .data-grid-row[data-animating=remove]{animation:tbw-row-remove var(--tbw-row-remove-duration) ease-out forwards;will-change:max-height,opacity,transform;pointer-events:none}}@keyframes tbw-expand{0%{opacity:0;max-height:0;transform:translateY(-8px)}to{opacity:1;max-height:500px;transform:translateY(0)}}@keyframes tbw-collapse{0%{opacity:1;max-height:500px;transform:translateY(0)}to{opacity:0;max-height:0;transform:translateY(-8px)}}@keyframes tbw-row-change{0%{background-color:transparent}20%{background-color:var(--tbw-row-change-color)}to{background-color:transparent}}@keyframes tbw-row-insert{0%{opacity:0;max-height:0;overflow:hidden}to{opacity:1;max-height:var(--tbw-row-height, 28px);overflow:hidden}}@keyframes tbw-row-remove{0%{opacity:1;transform:translateY(0);max-height:var(--tbw-row-height, 28px)}to{opacity:0;max-height:0;transform:translateY(-8px)}}@keyframes tbw-spin{to{transform:rotate(360deg)}}@keyframes tbw-fade-in{0%{opacity:0}to{opacity:1}}", Xi = '@layer tbw-base{tbw-grid{color-scheme:inherit;position:relative;display:block;width:100%;height:100%;min-height:0;contain:content;font-family:var(--tbw-font-family);font-size:var(--tbw-font-size);font-feature-settings:"tnum","lnum";background:var(--tbw-color-bg);color:var(--tbw-color-fg);border:1px solid var(--tbw-color-border);border-radius:var(--tbw-border-radius);overflow:clip;outline:none;&,*{box-sizing:border-box}.tbw-grid-root{position:relative;display:flex;flex-direction:column;height:100%;&.has-shell{display:flex;flex-direction:column;height:100%}&:has(.selected){user-select:none}}.rows-body-wrapper{flex:1;min-height:0;display:flex;flex-direction:row;width:100%;min-width:fit-content}.rows-body{flex:1;min-width:0;min-height:0;display:flex;flex-direction:column;overflow:visible}.rows-container{display:flex;flex-direction:row;flex:1;min-height:0;overflow:visible}.rows-viewport{flex:1;min-width:0;position:relative;display:block;overflow:clip;.rows{position:absolute;top:0;left:0;min-width:100%;will-change:transform;z-index:var(--tbw-z-layer-rows, 1)}}.faux-vscroll{position:sticky;inset-inline-end:0;flex-shrink:0;width:auto;overflow-y:auto;overflow-x:hidden;z-index:var(--tbw-z-layer-header, 30)}.faux-vscroll-spacer{width:1px}&[data-has-focus]{.cell-focus,.row-focus{outline:var(--tbw-focus-outline);outline-offset:var(--tbw-focus-outline-offset)}}.sticky-left,.sticky-right{position:sticky;z-index:25}.sticky-left{box-shadow:1px 0 0 var(--tbw-color-border)}.sticky-right{box-shadow:-1px 0 0 var(--tbw-color-border)}}}', Yi = '@layer tbw-base{tbw-grid{.header{display:block;flex-shrink:0;z-index:var(--tbw-z-layer-header, 30);background:var(--tbw-color-header-bg);overflow:visible}.header-group-row{display:grid;grid-template-columns:var(--tbw-column-template);background:var(--tbw-color-header-bg);z-index:var(--tbw-z-layer-header, 30)}.header-group-cell{display:flex;align-items:center;justify-content:flex-start;padding:var(--tbw-cell-padding-header, 2px 8px);color:var(--tbw-color-header-group-fg, var(--tbw-color-header-fg));font-weight:var(--tbw-font-weight-header-group, var(--tbw-font-weight-header));justify-content:var(--tbw-align-header-group, var(--tbw-align-header, flex-start));&:not(:last-child){border-right:2px solid var(--tbw-color-border)}}.header-row{display:grid;grid-template-columns:var(--tbw-column-template);color:var(--tbw-color-header-fg);font-size:var(--tbw-font-size-header);min-height:var(--tbw-header-height);border-bottom:var(--tbw-border-header);z-index:var(--tbw-z-layer-header, 30);text-transform:var(--tbw-header-text-transform);letter-spacing:var(--tbw-header-letter-spacing);>.cell{display:flex;align-items:center;gap:4px;padding:var(--tbw-cell-padding-header, 2px 8px);background-color:var(--tbw-color-header-bg);font-weight:var(--tbw-font-weight-header);border-right:1px solid var(--tbw-color-border-cell);overflow:visible;min-width:0;>span:first-child{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:inherit}>span[part~=sort-indicator]{flex-shrink:0;opacity:.6;color:var(--tbw-sort-indicator-color);display:var(--tbw-sort-indicator-display, inline-flex);visibility:var(--tbw-sort-indicator-visibility, visible);transition:opacity .15s,visibility 0s,display 0s allow-discrete;transition-behavior:allow-discrete}&:hover>span[part~=sort-indicator]{display:inline-flex;visibility:visible}&[aria-sort=ascending]>span[part~=sort-indicator],&[aria-sort=descending]>span[part~=sort-indicator]{display:inline-flex;visibility:visible;opacity:1;color:var(--tbw-sort-indicator-active-color)}&:last-child{border-right:0;.resize-handle{right:0;width:calc(var(--tbw-resize-handle-width) / 2)}}&.grouped.group-end:not(:last-child){border-right:2px solid var(--tbw-color-border)}&.resizable{position:relative}&.sticky-left,&.sticky-right{background:var(--tbw-color-header-bg);z-index:35}}}.sortable{cursor:pointer;user-select:none}.resize-handle{position:absolute;top:0;right:calc(var(--tbw-resize-handle-width) / -2);width:var(--tbw-resize-handle-width);height:100%;cursor:e-resize;user-select:none;touch-action:none;z-index:20;background:var(--tbw-resize-handle-color);transition:background .12s ease;border-radius:var(--tbw-resize-handle-border-radius);&:after{content:"";position:absolute;top:100%;left:50%;transform:translate(-50%);width:var(--tbw-resize-indicator-width, 2px);height:0;background:var(--tbw-resize-indicator-color, var(--tbw-color-accent));opacity:0;pointer-events:none;transition:opacity .12s ease,height 0s .12s;z-index:1000}&:hover{background:var(--tbw-resize-handle-color-hover);&:after{height:100vh;opacity:var(--tbw-resize-indicator-opacity, .6);transition:opacity .12s ease,height 0s}}}}}', ji = '@layer tbw-base{.tbw-loading-overlay{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:light-dark(rgba(255,255,255,.7),rgba(0,0,0,.5));z-index:1000;pointer-events:all;animation:tbw-fade-in .15s ease-out}.tbw-spinner{--tbw-spinner-size: 48px;--tbw-spinner-border-width: 3px;--tbw-spinner-color: var(--tbw-color-accent);--tbw-spinner-track-color: var(--tbw-color-border);width:var(--tbw-spinner-size);height:var(--tbw-spinner-size);border:var(--tbw-spinner-border-width) solid var(--tbw-spinner-track-color);border-top-color:var(--tbw-spinner-color);border-radius:50%;animation:tbw-spin .8s linear infinite}.tbw-spinner--large{--tbw-spinner-size: min(48px, calc(100% - 16px) )}.tbw-spinner--small{--tbw-spinner-size: calc(var(--tbw-row-height, 28px) * .6);--tbw-spinner-border-width: 2px}.data-grid-row.tbw-row-loading{position:relative;pointer-events:none}.tbw-row-loading-overlay{position:absolute;inset:0;background:light-dark(rgba(255,255,255,.7),rgba(0,0,0,.5));z-index:26;animation:tbw-fade-in .15s ease-out;pointer-events:none;display:flex;align-items:center}.tbw-row-loading-spinner{--_spinner-size: calc(var(--tbw-row-height, 28px) * .6);margin-left:var(--tbw-spacing-md);width:var(--_spinner-size);height:var(--_spinner-size);border:2px solid var(--tbw-spinner-track-color, var(--tbw-color-border));border-top-color:var(--tbw-spinner-color, var(--tbw-color-accent));border-radius:50%;animation:tbw-spin .8s linear infinite}.cell.tbw-cell-loading{position:relative;pointer-events:none;&:before{content:"";position:absolute;inset:0;background:light-dark(rgba(255,255,255,.7),rgba(0,0,0,.5));z-index:26;animation:tbw-fade-in .15s ease-out}&:after{--_spinner-size: calc(var(--tbw-row-height, 28px) * .5);content:"";position:absolute;left:var(--tbw-spacing-sm);top:0;bottom:0;margin:auto 0;width:var(--_spinner-size);height:var(--_spinner-size);border:2px solid var(--tbw-spinner-track-color, var(--tbw-color-border));border-top-color:var(--tbw-spinner-color, var(--tbw-color-accent));border-radius:50%;animation:tbw-spin .8s linear infinite;z-index:27}}}', Ki = "@layer tbw-base{@media(forced-colors:active){tbw-grid{--tbw-color-border: CanvasText;--tbw-color-border-strong: CanvasText;--tbw-color-border-cell: CanvasText;--tbw-color-border-header: CanvasText;--tbw-color-fg: CanvasText;--tbw-color-bg: Canvas;--tbw-color-panel-bg: Canvas;--tbw-color-header-bg: Canvas;--tbw-color-header-fg: CanvasText;--tbw-color-accent: Highlight;--tbw-color-accent-fg: HighlightText;--tbw-color-selection: Highlight;--tbw-color-row-hover: Highlight;--tbw-focus-outline: 2px solid Highlight;--tbw-range-border-color: Highlight;.cell:focus,.cell.active-cell{outline:2px solid Highlight!important;outline-offset:-2px}.data-grid-row[aria-selected=true]{background:Highlight!important;color:HighlightText!important}}}@media(prefers-reduced-motion:reduce){tbw-grid[data-animation-mode=reduced-motion]{--tbw-animation-enabled: 0;--tbw-animation-duration: 0ms;.data-grid-row[data-animating]{animation:none}}}}", Qi = "@layer tbw-base{tbw-grid{.data-grid-row{display:grid;grid-template-columns:var(--tbw-column-template);contain:layout style;&:nth-child(2n){background:var(--tbw-color-row-alt)}&:hover{background:var(--tbw-color-row-hover)}>.cell{display:block;padding:var(--tbw-cell-padding, 2px 8px);border-bottom:var(--tbw-row-divider);min-height:var(--tbw-row-height);align-content:center;border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0;white-space:var(--tbw-cell-white-space, nowrap);text-overflow:ellipsis;>*{overflow:hidden;text-overflow:ellipsis;white-space:inherit;min-width:0}&:last-child{border-right:0}&[data-type=boolean]{text-align:center;input[type=checkbox]{margin:0;width:var(--tbw-checkbox-size);height:var(--tbw-checkbox-size);vertical-align:middle}}&.selected:focus-visible,&:focus-visible:not(.cell-focus){outline:none}&.sticky-left,&.sticky-right{background:var(--tbw-color-panel-bg)}}}.selecting .data-grid-row>.cell{user-select:none}}}", Zi = "@layer tbw-base{tbw-grid{.tbw-shell-header{display:flex;align-items:center;gap:8px;min-height:var(--tbw-shell-header-height);padding:0 8px;background:var(--tbw-shell-header-bg);border-bottom:1px solid var(--tbw-shell-header-border);flex-shrink:0}.tbw-shell-title{font-size:var(--tbw-shell-title-font-size);font-weight:var(--tbw-shell-title-font-weight);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tbw-shell-content{flex:1;display:flex;align-items:center;gap:12px;min-width:0;overflow:hidden}.tbw-shell-toolbar{display:flex;align-items:center;gap:var(--tbw-toolbar-button-gap);flex-shrink:0}.tbw-toolbar-btn{display:inline-flex;align-items:center;justify-content:center;width:var(--tbw-toolbar-button-size);height:var(--tbw-toolbar-button-size);padding:0;border:1px solid transparent;border-radius:var(--tbw-border-radius);background:transparent;color:var(--tbw-color-fg);cursor:pointer;font-size:16px;transition:background var(--tbw-transition-duration) var(--tbw-transition-ease),border-color var(--tbw-transition-duration) var(--tbw-transition-ease);&:hover{background:var(--tbw-color-row-hover)}&:focus-visible{outline:var(--tbw-focus-outline);outline-offset:var(--tbw-focus-outline-offset)}&.active{background:var(--tbw-focus-background);border-color:var(--tbw-color-accent)}&:disabled{opacity:.5;cursor:not-allowed}}.tbw-toolbar-separator{width:1px;height:20px;background:var(--tbw-color-border);margin:0 4px}.tbw-shell-body{position:relative;display:flex;flex:1;min-height:0;overflow:visible}.tbw-grid-content{flex:1;min-width:0;min-height:0;display:flex;flex-direction:row;overflow:hidden}.tbw-scroll-area{flex:1;min-width:0;min-height:0;display:flex;flex-direction:column;overflow-x:auto;overflow-y:hidden;overflow-anchor:none}}}", Ji = "@layer tbw-base{tbw-grid{.tbw-tool-panel{position:absolute;top:0;bottom:0;right:0;width:0;overflow:hidden;background:var(--tbw-tool-panel-bg);border-left:1px solid var(--tbw-tool-panel-border);transition:width var(--tbw-tool-panel-transition);display:flex;flex-direction:column;z-index:30;box-shadow:-2px 0 8px var(--tbw-color-shadow);&[data-position=left]{right:auto;left:0;border-left:none;border-right:1px solid var(--tbw-tool-panel-border);box-shadow:2px 0 8px var(--tbw-color-shadow)}&.open{width:var(--tbw-tool-panel-width)}}.tbw-tool-panel-resize{position:absolute;top:0;bottom:0;width:6px;cursor:col-resize;background:transparent;z-index:10;transition:background var(--tbw-transition-duration) var(--tbw-transition-ease);&[data-handle-position=left]{left:0}&[data-handle-position=right]{right:0}&:hover,&.resizing{background:var(--tbw-color-accent)}}.tbw-tool-panel-header{display:flex;align-items:center;justify-content:space-between;min-height:var(--tbw-tool-panel-header-height);padding:0 12px;border-bottom:1px solid var(--tbw-tool-panel-border);flex-shrink:0}.tbw-tool-panel-title{font-weight:600;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tbw-tool-panel-close{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:none;border-radius:var(--tbw-border-radius);background:transparent;color:var(--tbw-color-fg-muted);cursor:pointer;font-size:14px;&:hover{background:var(--tbw-color-row-hover);color:var(--tbw-color-fg)}}.tbw-tool-panel-content{flex:1;overflow:auto}.tbw-accordion{display:flex;flex-direction:column;gap:0}.tbw-accordion-section{border-bottom:1px solid var(--tbw-tool-panel-border);&:last-child{border-bottom:none}&.single .tbw-accordion-header{cursor:default;&:hover{background:transparent}}&.expanded{.tbw-accordion-chevron{transform:rotate(90deg)}.tbw-accordion-content{display:block}}}.tbw-accordion-header{display:flex;align-items:center;gap:8px;width:100%;padding:10px 12px;border:none;background:transparent;color:var(--tbw-color-fg);font-size:13px;font-weight:600;text-align:start;cursor:pointer;user-select:none;&:hover{background:var(--tbw-color-row-hover)}}.tbw-accordion-chevron{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;font-size:10px;color:var(--tbw-color-fg-muted);transition:transform .15s ease;flex-shrink:0}.tbw-accordion-icon{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;font-size:14px;flex-shrink:0}.tbw-accordion-title{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tbw-accordion-content{display:none}}}", eo = "@layer tbw-base{tbw-grid{--tbw-base-icon-size: 1em;--tbw-base-radius: .25em;--tbw-font-size: 1em;--tbw-font-size-sm: .9285em;--tbw-font-size-xs: .7857em;--tbw-font-size-2xs: .7142em;--tbw-spacing-xs: .25em;--tbw-spacing-sm: .375em;--tbw-spacing-md: .5em;--tbw-spacing-lg: .75em;--tbw-spacing-xl: 1em;--tbw-icon-size: var(--tbw-base-icon-size);--tbw-icon-size-sm: .875em;--tbw-checkbox-size: var(--tbw-base-icon-size);--tbw-toggle-size: 1.25em;--tbw-border-radius: var(--tbw-base-radius);--tbw-color-bg: transparent;--tbw-color-panel-bg: light-dark(#eeeeee, #222222);--tbw-color-fg: light-dark(#222222, #eeeeee);--tbw-color-fg-muted: light-dark(#555555, #aaaaaa);--tbw-color-accent: light-dark(#3b82f6, #3b82f6);--tbw-color-accent-fg: light-dark(#ffffff, #000000);--tbw-color-success: light-dark(hsl(122, 39%, 40%), hsl(122, 39%, 49%));--tbw-color-warning: light-dark(hsl(38, 92%, 50%), hsl(38, 92%, 50%));--tbw-color-error: light-dark(hsl(0, 65%, 51%), hsl(0, 65%, 55%));--tbw-color-danger: var(--tbw-color-error);--tbw-color-selection: light-dark(#fff7d6, #333333);--tbw-color-row-alt: var(--tbw-color-bg);--tbw-color-row-hover: light-dark(#f0f6ff, #1c1c1c);--tbw-color-header-bg: color-mix(in hsl, var(--tbw-color-panel-bg) 85%, var(--tbw-color-fg));--tbw-color-header-fg: color-mix(in hsl, var(--tbw-color-fg) 75%, var(--tbw-color-panel-bg));--tbw-color-border: light-dark(#d0d0d4, #454545);--tbw-color-border-strong: light-dark(#777777, #666666);--tbw-color-border-cell: var(--tbw-color-border);--tbw-color-border-header: var(--tbw-color-border);--tbw-color-shadow: light-dark(rgba(0, 0, 0, .1), rgba(0, 0, 0, .3));--tbw-font-family: inherit;--tbw-font-size-header: var(--tbw-font-size);--tbw-font-weight-header: bold;--tbw-cell-padding-header: var(--tbw-spacing-xs) var(--tbw-spacing-md);--tbw-cell-padding-v: var(--tbw-spacing-xs);--tbw-cell-padding-h: var(--tbw-spacing-md);--tbw-cell-padding: var(--tbw-cell-padding-v) var(--tbw-cell-padding-h);--tbw-cell-padding-input: var(--tbw-spacing-xs) var(--tbw-spacing-sm);--tbw-row-height: 1.75em;--tbw-header-height: 1.875em;--tbw-cell-white-space: nowrap;--tbw-border-width: 1px;--tbw-border-style: solid;--tbw-border-input: var(--tbw-border-width) var(--tbw-border-style) var(--tbw-color-border-strong);--tbw-border-header: var(--tbw-border-width) var(--tbw-border-style) var(--tbw-color-border-header);--tbw-row-divider: var(--tbw-border-width) var(--tbw-border-style) var(--tbw-color-border-cell);--tbw-row-hover-outline: 0;--tbw-color-active-row-bg: var(--tbw-color-selection);--tbw-active-row-outline: 0;--tbw-focus-outline-width: 2px;--tbw-focus-outline: var(--tbw-focus-outline-width) var(--tbw-border-style) var(--tbw-color-accent);--tbw-focus-outline-offset: -2px;--tbw-focus-background: rgba(from var(--tbw-color-accent) r g b / 12%);--tbw-range-border-color: var(--tbw-color-accent);--tbw-range-selection-bg: rgba(from var(--tbw-range-border-color) r g b / 12%);--tbw-resize-handle-width: var(--tbw-spacing-sm);--tbw-resize-handle-color: transparent;--tbw-resize-handle-color-hover: var(--tbw-color-accent);--tbw-resize-handle-border-radius: 0;--tbw-resize-indicator-width: 2px;--tbw-resize-indicator-color: var(--tbw-color-accent);--tbw-resize-indicator-opacity: .6;--tbw-transition-duration: .12s;--tbw-transition-ease: ease;--tbw-animation-duration: .2s;--tbw-animation-easing: ease-out;--tbw-animation-enabled: 1;--tbw-row-change-duration: .5s;--tbw-row-insert-duration: .3s;--tbw-row-remove-duration: .2s;--tbw-row-change-color: rgba(from var(--tbw-color-accent) r g b / 25%);--tbw-sort-indicator-color: var(--tbw-color-fg-muted);--tbw-sort-indicator-active-color: var(--tbw-color-accent);--tbw-sort-indicator-display: inline-flex;--tbw-sort-indicator-visibility: visible;--tbw-header-text-transform: none;--tbw-header-letter-spacing: normal;--tbw-color-header-separator: var(--tbw-color-border-cell);--tbw-density-scale: 1;--tbw-shell-header-height: 2.75em;--tbw-shell-header-bg: var(--tbw-color-panel-bg);--tbw-shell-header-border: var(--tbw-color-border);--tbw-shell-title-font-size: var(--tbw-font-size);--tbw-shell-title-font-weight: 600;--tbw-tool-panel-width: 17.5em;--tbw-tool-panel-bg: var(--tbw-color-panel-bg);--tbw-tool-panel-border: var(--tbw-color-border);--tbw-tool-panel-header-height: 2.5em;--tbw-tool-panel-transition: var(--tbw-animation-duration) var(--tbw-animation-easing);--tbw-toolbar-button-size: 2em;--tbw-toolbar-button-gap: var(--tbw-spacing-xs);--tbw-panel-padding: var(--tbw-spacing-lg);--tbw-panel-gap: var(--tbw-spacing-md);--tbw-menu-item-padding: var(--tbw-spacing-sm) var(--tbw-spacing-lg);--tbw-menu-item-gap: var(--tbw-spacing-md);--tbw-menu-min-width: 10rem;--tbw-button-padding: var(--tbw-spacing-sm) var(--tbw-spacing-lg);--tbw-button-padding-sm: var(--tbw-spacing-xs) var(--tbw-spacing-md);--tbw-input-height: var(--tbw-row-height);--tbw-input-padding: 0 var(--tbw-spacing-md);--tbw-detail-padding: var(--tbw-spacing-xl);--tbw-detail-max-height: 31.25rem;--tbw-indicator-size: var(--tbw-spacing-sm)}}", to = `/**
|
|
2717
2729
|
* tbw-grid Light DOM Styles
|
|
2718
2730
|
*
|
|
2719
2731
|
* This stylesheet uses CSS nesting to scope all styles to the tbw-grid element.
|
|
@@ -2732,19 +2744,19 @@ const Ui = "@layer tbw-base{tbw-grid{.tbw-expanding{animation:tbw-expand var(--t
|
|
|
2732
2744
|
/* Declare layer order - earlier layers have lower priority */
|
|
2733
2745
|
@layer tbw-base, tbw-plugins, tbw-theme;
|
|
2734
2746
|
|
|
2735
|
-
${
|
|
2736
|
-
${
|
|
2737
|
-
${Bi}
|
|
2747
|
+
${eo}
|
|
2748
|
+
${Xi}
|
|
2738
2749
|
${Yi}
|
|
2750
|
+
${Qi}
|
|
2751
|
+
${Zi}
|
|
2752
|
+
${Ji}
|
|
2739
2753
|
${ji}
|
|
2740
|
-
${Ki}
|
|
2741
2754
|
${Gi}
|
|
2742
|
-
${
|
|
2743
|
-
${Xi}
|
|
2755
|
+
${Ki}
|
|
2744
2756
|
`;
|
|
2745
2757
|
class k extends HTMLElement {
|
|
2746
2758
|
static tagName = "tbw-grid";
|
|
2747
|
-
static version = "1.
|
|
2759
|
+
static version = "1.16.0";
|
|
2748
2760
|
static #l = 0;
|
|
2749
2761
|
static adapters = [];
|
|
2750
2762
|
static registerAdapter(e) {
|
|
@@ -2784,7 +2796,7 @@ class k extends HTMLElement {
|
|
|
2784
2796
|
#x = !1;
|
|
2785
2797
|
#m = 0;
|
|
2786
2798
|
#z;
|
|
2787
|
-
#N =
|
|
2799
|
+
#N = Si();
|
|
2788
2800
|
#b;
|
|
2789
2801
|
#y;
|
|
2790
2802
|
#p;
|
|
@@ -2804,7 +2816,7 @@ class k extends HTMLElement {
|
|
|
2804
2816
|
#V;
|
|
2805
2817
|
#O;
|
|
2806
2818
|
#t;
|
|
2807
|
-
#i =
|
|
2819
|
+
#i = hi();
|
|
2808
2820
|
#c;
|
|
2809
2821
|
#q;
|
|
2810
2822
|
#M = !1;
|
|
@@ -2941,28 +2953,28 @@ class k extends HTMLElement {
|
|
|
2941
2953
|
return this.#b || (this.#b = new AbortController()), this.#b.signal;
|
|
2942
2954
|
}
|
|
2943
2955
|
constructor() {
|
|
2944
|
-
super(), this.#be(), this.#d = new Promise((e) => this.#h = e), this.#s = new
|
|
2956
|
+
super(), this.#be(), this.#d = new Promise((e) => this.#h = e), this.#s = new ti({
|
|
2945
2957
|
mergeConfig: () => {
|
|
2946
|
-
this.#t.parseLightDomColumns(this), this.#t.merge(), this.#te(),
|
|
2958
|
+
this.#t.parseLightDomColumns(this), this.#t.merge(), this.#te(), Oi(this.#o, this.#e?.getPlugins() ?? []), Mi(this.#e?.getPlugins() ?? []), Ni(this.#e?.getPlugins() ?? []), this.#ze(), this.#B = [...this._columns];
|
|
2947
2959
|
},
|
|
2948
2960
|
processColumns: () => this.#xe(),
|
|
2949
2961
|
processRows: () => this.#Le(),
|
|
2950
|
-
renderHeader: () =>
|
|
2951
|
-
updateTemplate: () =>
|
|
2962
|
+
renderHeader: () => oe(this),
|
|
2963
|
+
updateTemplate: () => V(this),
|
|
2952
2964
|
renderVirtualWindow: () => this.refreshVirtualWindow(!0, !0),
|
|
2953
2965
|
afterRender: () => {
|
|
2954
2966
|
this.#e?.afterRender(), this._virtualization.enabled && this._virtualization.totalHeightEl && queueMicrotask(() => {
|
|
2955
2967
|
if (!this._virtualization.totalHeightEl) return;
|
|
2956
2968
|
const i = this.#T(this._rows.length);
|
|
2957
2969
|
this._virtualization.totalHeightEl.style.height = `${i}px`;
|
|
2958
|
-
}), this.#o.fitMode === "fixed" && !this.__didInitialAutoSize && (this.__didInitialAutoSize = !0,
|
|
2970
|
+
}), this.#o.fitMode === "fixed" && !this.__didInitialAutoSize && (this.__didInitialAutoSize = !0, Re(this)), this._restoreFocusAfterRender && (this._restoreFocusAfterRender = !1, $(this)), this._virtualization.enabled && !this.#F && this.#Ce(), this.#x && (this.#x = !1, requestAnimationFrame(() => {
|
|
2959
2971
|
requestAnimationFrame(() => {
|
|
2960
2972
|
this.#ve();
|
|
2961
2973
|
});
|
|
2962
2974
|
})), this.#M && this.#he();
|
|
2963
2975
|
},
|
|
2964
2976
|
isConnected: () => this.isConnected && this.#f
|
|
2965
|
-
}), this.#s.setInitialReadyResolver(() => this.#h?.()), this.#c =
|
|
2977
|
+
}), this.#s.setInitialReadyResolver(() => this.#h?.()), this.#c = bi(this.#i, {
|
|
2966
2978
|
getShadow: () => this.#n,
|
|
2967
2979
|
getShellConfig: () => this.#o?.shell,
|
|
2968
2980
|
getAccordionIcons: () => ({
|
|
@@ -2971,23 +2983,23 @@ class k extends HTMLElement {
|
|
|
2971
2983
|
}),
|
|
2972
2984
|
emit: (e, i) => this.#L(e, i),
|
|
2973
2985
|
refreshShellHeader: () => this.refreshShellHeader()
|
|
2974
|
-
}), this.#t = new
|
|
2986
|
+
}), this.#t = new Lt({
|
|
2975
2987
|
getRows: () => this.#a,
|
|
2976
2988
|
getSortState: () => this._sortState,
|
|
2977
2989
|
setSortState: (e) => {
|
|
2978
2990
|
this._sortState = e;
|
|
2979
2991
|
},
|
|
2980
2992
|
onConfigChange: () => {
|
|
2981
|
-
this.#s.requestPhase(
|
|
2993
|
+
this.#s.requestPhase(A.FULL, "configChange");
|
|
2982
2994
|
},
|
|
2983
2995
|
emit: (e, i) => this.#L(e, i),
|
|
2984
2996
|
clearRowPool: () => {
|
|
2985
2997
|
this._rowPool.length = 0, this._bodyEl && (this._bodyEl.innerHTML = ""), this.__rowRenderEpoch++;
|
|
2986
2998
|
},
|
|
2987
2999
|
setup: () => this.#P(),
|
|
2988
|
-
renderHeader: () =>
|
|
2989
|
-
updateTemplate: () =>
|
|
2990
|
-
refreshVirtualWindow: () => this.#s.requestPhase(
|
|
3000
|
+
renderHeader: () => oe(this),
|
|
3001
|
+
updateTemplate: () => V(this),
|
|
3002
|
+
refreshVirtualWindow: () => this.#s.requestPhase(A.VIRTUALIZATION, "configManager"),
|
|
2991
3003
|
getVirtualization: () => this._virtualization,
|
|
2992
3004
|
setRowHeight: (e) => {
|
|
2993
3005
|
this._virtualization.rowHeight = e;
|
|
@@ -3002,7 +3014,7 @@ class k extends HTMLElement {
|
|
|
3002
3014
|
});
|
|
3003
3015
|
}
|
|
3004
3016
|
async #be() {
|
|
3005
|
-
await
|
|
3017
|
+
await Ei(to);
|
|
3006
3018
|
}
|
|
3007
3019
|
getPlugin(e) {
|
|
3008
3020
|
return this.#e?.getPlugin(e);
|
|
@@ -3011,28 +3023,28 @@ class k extends HTMLElement {
|
|
|
3011
3023
|
return this.#e?.getPluginByName(e);
|
|
3012
3024
|
}
|
|
3013
3025
|
requestRender() {
|
|
3014
|
-
this.#s.requestPhase(
|
|
3026
|
+
this.#s.requestPhase(A.ROWS, "plugin:requestRender");
|
|
3015
3027
|
}
|
|
3016
3028
|
requestColumnsRender() {
|
|
3017
|
-
this.#s.requestPhase(
|
|
3029
|
+
this.#s.requestPhase(A.COLUMNS, "plugin:requestColumnsRender");
|
|
3018
3030
|
}
|
|
3019
3031
|
requestRenderWithFocus() {
|
|
3020
|
-
this._restoreFocusAfterRender = !0, this.#s.requestPhase(
|
|
3032
|
+
this._restoreFocusAfterRender = !0, this.#s.requestPhase(A.ROWS, "plugin:requestRenderWithFocus");
|
|
3021
3033
|
}
|
|
3022
3034
|
updateTemplate() {
|
|
3023
|
-
|
|
3035
|
+
V(this);
|
|
3024
3036
|
}
|
|
3025
3037
|
requestAfterRender() {
|
|
3026
|
-
this.#s.requestPhase(
|
|
3038
|
+
this.#s.requestPhase(A.STYLE, "plugin:requestAfterRender");
|
|
3027
3039
|
}
|
|
3028
3040
|
#ee() {
|
|
3029
|
-
this.#e = new
|
|
3041
|
+
this.#e = new ne(this);
|
|
3030
3042
|
const e = this.#o?.plugins, i = Array.isArray(e) ? e : [];
|
|
3031
3043
|
this.#e.attachAll(i);
|
|
3032
3044
|
}
|
|
3033
3045
|
#W() {
|
|
3034
3046
|
const e = this.#e?.getPluginStyles() ?? [];
|
|
3035
|
-
|
|
3047
|
+
yi(e);
|
|
3036
3048
|
}
|
|
3037
3049
|
#te() {
|
|
3038
3050
|
const e = this.#o?.plugins, i = Array.isArray(e) ? e : [];
|
|
@@ -3090,9 +3102,9 @@ class k extends HTMLElement {
|
|
|
3090
3102
|
};
|
|
3091
3103
|
}
|
|
3092
3104
|
connectedCallback() {
|
|
3093
|
-
this.hasAttribute("tabindex") || (this.tabIndex = 0), this.hasAttribute("version") || this.setAttribute("version", k.version), this.id || (this.id = `tbw-grid-${++k.#l}`), this._rows = Array.isArray(this.#a) ? [...this.#a] : [], this.#b && (this.#b.abort(), this.#I = !1), this.#b = new AbortController(), this.#S && (
|
|
3105
|
+
this.hasAttribute("tabindex") || (this.tabIndex = 0), this.hasAttribute("version") || this.setAttribute("version", k.version), this.id || (this.id = `tbw-grid-${++k.#l}`), this._rows = Array.isArray(this.#a) ? [...this.#a] : [], this.#b && (this.#b.abort(), this.#I = !1), this.#b = new AbortController(), this.#S && (Oe(this.#S), this.#S = void 0), this.#k(), this.#t.parseLightDomColumns(this), this.#t.merge(), this.#ee();
|
|
3094
3106
|
const e = this.#o?.plugins;
|
|
3095
|
-
this.#_ = Array.isArray(e) ? e : [], this.#ie(), this.#u || (this.#Z(), this.#W(), this.#u = !0), this.#ne(), this.#S =
|
|
3107
|
+
this.#_ = Array.isArray(e) ? e : [], this.#ie(), this.#u || (this.#Z(), this.#W(), this.#u = !0), this.#ne(), this.#S = Xt(
|
|
3096
3108
|
() => {
|
|
3097
3109
|
this.#ke();
|
|
3098
3110
|
},
|
|
@@ -3100,7 +3112,7 @@ class k extends HTMLElement {
|
|
|
3100
3112
|
);
|
|
3101
3113
|
}
|
|
3102
3114
|
disconnectedCallback() {
|
|
3103
|
-
this.#S && (
|
|
3115
|
+
this.#S && (Oe(this.#S), this.#S = void 0), this.#m && (clearTimeout(this.#m), this.#m = 0), this.#me(), wi(this.#i), this.#c.setInitialized(!1), this.#q?.(), this.#q = void 0, lt(this.#N), this.#b && (this.#b.abort(), this.#b = void 0), this.#D?.abort(), this.#D = void 0, this.#I = !1, this._resizeController && this._resizeController.dispose(), this.#y && (this.#y.disconnect(), this.#y = void 0), this.#p && (this.#p.disconnect(), this.#p = void 0, this.#F = !1), Y(this), this.#A.clear(), this.#_ = void 0;
|
|
3104
3116
|
for (const e of this._rowPool)
|
|
3105
3117
|
e.remove();
|
|
3106
3118
|
this._rowPool.length = 0, this.__rowsBodyEl = null, this.#f = !1;
|
|
@@ -3124,15 +3136,15 @@ class k extends HTMLElement {
|
|
|
3124
3136
|
#ne() {
|
|
3125
3137
|
const i = this.#n.querySelector(".tbw-grid-content") ?? this.#n.querySelector(".tbw-grid-root");
|
|
3126
3138
|
if (this._headerRowEl = i?.querySelector(".header-row"), this._virtualization.totalHeightEl = i?.querySelector(".faux-vscroll-spacer"), this._virtualization.viewportEl = i?.querySelector(".rows-viewport"), this._bodyEl = i?.querySelector(".rows"), this.__rowsBodyEl = i?.querySelector(".rows-body"), this.#c.isInitialized) {
|
|
3127
|
-
|
|
3139
|
+
ge(this.#n, this.#i), de(this.#n, this.#o?.shell, this.#i);
|
|
3128
3140
|
const n = this.#o?.shell?.toolPanel?.defaultOpen;
|
|
3129
3141
|
n && this.#i.toolPanels.has(n) && (this.openToolPanel(), this.#i.expandedSections.add(n));
|
|
3130
3142
|
}
|
|
3131
|
-
if (this.setAttribute("data-upgraded", ""), this.#f = !0, this._resizeController =
|
|
3143
|
+
if (this.setAttribute("data-upgraded", ""), this.#f = !0, this._resizeController = Me(this), this.#P(), this.#G(i), this.#I)
|
|
3132
3144
|
return;
|
|
3133
3145
|
this.#I = !0;
|
|
3134
3146
|
const o = this.disconnectSignal;
|
|
3135
|
-
|
|
3147
|
+
Ft(this, this, this.#n, o), this.#re(), queueMicrotask(() => this.#ye()), this.#s.requestPhase(A.FULL, "afterConnect");
|
|
3136
3148
|
}
|
|
3137
3149
|
#re() {
|
|
3138
3150
|
const e = this.#o.rowHeight, i = this.#e.hasRowHeightPlugin();
|
|
@@ -3150,7 +3162,7 @@ class k extends HTMLElement {
|
|
|
3150
3162
|
l > o && (o = l);
|
|
3151
3163
|
});
|
|
3152
3164
|
const n = e.getBoundingClientRect(), r = Math.max(n.height, o);
|
|
3153
|
-
r > 0 && Math.abs(r - this._virtualization.rowHeight) > 1 && (this._virtualization.rowHeight = r, this.#s.requestPhase(
|
|
3165
|
+
r > 0 && Math.abs(r - this._virtualization.rowHeight) > 1 && (this._virtualization.rowHeight = r, this.#s.requestPhase(A.VIRTUALIZATION, "measureRowHeight"));
|
|
3154
3166
|
}
|
|
3155
3167
|
#ve() {
|
|
3156
3168
|
const e = this._bodyEl?.querySelector(".data-grid-row");
|
|
@@ -3179,15 +3191,15 @@ class k extends HTMLElement {
|
|
|
3179
3191
|
if (this._rows.length <= this._virtualization.bypassThreshold)
|
|
3180
3192
|
n.style.transform = `translateY(${-a}px)`;
|
|
3181
3193
|
else {
|
|
3182
|
-
const
|
|
3183
|
-
let f,
|
|
3184
|
-
if (this._virtualization.variableHeights &&
|
|
3185
|
-
f =
|
|
3186
|
-
const
|
|
3187
|
-
|
|
3194
|
+
const h = this._virtualization.positionCache;
|
|
3195
|
+
let f, p;
|
|
3196
|
+
if (this._virtualization.variableHeights && h && h.length > 0) {
|
|
3197
|
+
f = Ve(h, a), f === -1 && (f = 0);
|
|
3198
|
+
const u = f - f % 2;
|
|
3199
|
+
p = h[u]?.offset ?? u * c;
|
|
3188
3200
|
} else
|
|
3189
|
-
f = Math.floor(a / c),
|
|
3190
|
-
const g = -(a -
|
|
3201
|
+
f = Math.floor(a / c), p = (f - f % 2) * c;
|
|
3202
|
+
const g = -(a - p);
|
|
3191
3203
|
n.style.transform = `translateY(${g}px)`;
|
|
3192
3204
|
}
|
|
3193
3205
|
this.#r = a, this.#C || (this.#C = requestAnimationFrame(() => {
|
|
@@ -3211,23 +3223,23 @@ class k extends HTMLElement {
|
|
|
3211
3223
|
(a) => {
|
|
3212
3224
|
const c = a.shiftKey || Math.abs(a.deltaX) > Math.abs(a.deltaY);
|
|
3213
3225
|
if (c && l) {
|
|
3214
|
-
const
|
|
3215
|
-
(
|
|
3226
|
+
const h = a.shiftKey ? a.deltaY : a.deltaX, { scrollLeft: f, scrollWidth: p, clientWidth: g } = l;
|
|
3227
|
+
(h > 0 && f < p - g || h < 0 && f > 0) && (a.preventDefault(), l.scrollLeft += h);
|
|
3216
3228
|
} else if (!c) {
|
|
3217
|
-
const { scrollTop:
|
|
3218
|
-
(a.deltaY > 0 &&
|
|
3229
|
+
const { scrollTop: h, scrollHeight: f, clientHeight: p } = o;
|
|
3230
|
+
(a.deltaY > 0 && h < f - p || a.deltaY < 0 && h > 0) && (a.preventDefault(), o.scrollTop += a.deltaY);
|
|
3219
3231
|
}
|
|
3220
3232
|
},
|
|
3221
3233
|
{ passive: !1, signal: i }
|
|
3222
|
-
),
|
|
3234
|
+
), Li(
|
|
3223
3235
|
s,
|
|
3224
3236
|
this.#N,
|
|
3225
3237
|
{ fauxScrollbar: o, scrollArea: l },
|
|
3226
3238
|
i
|
|
3227
3239
|
));
|
|
3228
3240
|
}
|
|
3229
|
-
this._bodyEl &&
|
|
3230
|
-
this.#Ne(), this.#s.requestPhase(
|
|
3241
|
+
this._bodyEl && Wt(this, this._bodyEl, i), this.#y?.disconnect(), this._virtualization.viewportEl && (this.#y = new ResizeObserver(() => {
|
|
3242
|
+
this.#Ne(), this.#s.requestPhase(A.VIRTUALIZATION, "resize-observer");
|
|
3231
3243
|
}), this.#y.observe(this._virtualization.viewportEl)), this.#n.addEventListener(
|
|
3232
3244
|
"focusin",
|
|
3233
3245
|
() => {
|
|
@@ -3289,7 +3301,7 @@ class k extends HTMLElement {
|
|
|
3289
3301
|
e.columns && this.#Se(), e.rows && this.#le(), e.fitMode && this.#Re();
|
|
3290
3302
|
}
|
|
3291
3303
|
#le() {
|
|
3292
|
-
this._rows = Array.isArray(this.#a) ? [...this.#a] : [], this.#X(), this.#s.requestPhase(
|
|
3304
|
+
this._rows = Array.isArray(this.#a) ? [...this.#a] : [], this.#X(), this.#s.requestPhase(A.ROWS, "applyRowsUpdate");
|
|
3293
3305
|
}
|
|
3294
3306
|
#X() {
|
|
3295
3307
|
this.#R.clear();
|
|
@@ -3315,23 +3327,23 @@ class k extends HTMLElement {
|
|
|
3315
3327
|
return o;
|
|
3316
3328
|
}
|
|
3317
3329
|
#Se() {
|
|
3318
|
-
|
|
3330
|
+
Y(this), this.#t.merge(), this.#P();
|
|
3319
3331
|
}
|
|
3320
3332
|
#Re() {
|
|
3321
|
-
this.#t.merge(), this.#o.fitMode === "fixed" ? (this.__didInitialAutoSize = !1,
|
|
3333
|
+
this.#t.merge(), this.#o.fitMode === "fixed" ? (this.__didInitialAutoSize = !1, Re(this)) : (this._columns.forEach((i) => {
|
|
3322
3334
|
!i.__userResized && i.__autoSized && delete i.width;
|
|
3323
|
-
}),
|
|
3335
|
+
}), V(this));
|
|
3324
3336
|
}
|
|
3325
3337
|
#Ae() {
|
|
3326
|
-
|
|
3338
|
+
Ne(this, this.#i), Ie(this, this.#i);
|
|
3327
3339
|
const e = !!this.#n.querySelector(".has-shell"), i = !!this.#n.querySelector(".tbw-tool-panel"), o = this.#n.querySelectorAll(".tbw-accordion-section").length;
|
|
3328
|
-
this.#t.parseLightDomColumns(this), this.#t.merge(), this.#te(),
|
|
3329
|
-
const n =
|
|
3340
|
+
this.#t.parseLightDomColumns(this), this.#t.merge(), this.#te(), qe(this, this.#i, this.#oe()), this.#t.markSourcesChanged(), this.#t.merge();
|
|
3341
|
+
const n = st(this.#o?.shell), r = (this.#o?.shell?.toolPanels?.length ?? 0) > 0, s = this.#o?.shell?.toolPanels?.length ?? 0;
|
|
3330
3342
|
if (e !== n || !i && r || i && s !== o) {
|
|
3331
|
-
|
|
3343
|
+
he(this.#i), this.#Z(), this.#W(), this.#ne(), this.#X();
|
|
3332
3344
|
return;
|
|
3333
3345
|
}
|
|
3334
|
-
e && this.#Te(), this.#X(), this.#s.requestPhase(
|
|
3346
|
+
e && this.#Te(), this.#X(), this.#s.requestPhase(A.COLUMNS, "applyGridConfigUpdate");
|
|
3335
3347
|
}
|
|
3336
3348
|
#Te() {
|
|
3337
3349
|
const e = this.#n.querySelector(".tbw-shell-header");
|
|
@@ -3370,39 +3382,39 @@ class k extends HTMLElement {
|
|
|
3370
3382
|
return l.push(...s), l;
|
|
3371
3383
|
}
|
|
3372
3384
|
#Le() {
|
|
3373
|
-
|
|
3385
|
+
Y(this);
|
|
3374
3386
|
const e = Array.isArray(this.#a) ? [...this.#a] : [], i = this.#e?.processRows(e) ?? e;
|
|
3375
3387
|
this._rows = i, this._virtualization.variableHeights && this.#Q();
|
|
3376
3388
|
}
|
|
3377
3389
|
#Pe(e) {
|
|
3378
3390
|
const i = {
|
|
3379
|
-
...
|
|
3391
|
+
...ft,
|
|
3380
3392
|
...e.animation
|
|
3381
3393
|
}, o = i.mode ?? "reduced-motion";
|
|
3382
3394
|
let n = 1;
|
|
3383
3395
|
o === !1 || o === "off" ? n = 0 : (o === !0 || o === "on") && (n = 1), this.style.setProperty("--tbw-animation-duration", `${i.duration}ms`), this.style.setProperty("--tbw-animation-easing", i.easing ?? "ease-out"), this.style.setProperty("--tbw-animation-enabled", String(n)), this.dataset.animationMode = typeof o == "boolean" ? o ? "on" : "off" : o;
|
|
3384
3396
|
}
|
|
3385
3397
|
#Y(e, i, o = this.__rowRenderEpoch) {
|
|
3386
|
-
if (this.#z || (this.#z = (n, r, s) => this.#e?.renderRow(n, r, s) ?? !1),
|
|
3398
|
+
if (this.#z || (this.#z = (n, r, s) => this.#e?.renderRow(n, r, s) ?? !1), Mt(this, e, i, o, this.#z), this.#E.size > 0)
|
|
3387
3399
|
for (const n of this.#E)
|
|
3388
3400
|
this.#j(n, !0);
|
|
3389
3401
|
}
|
|
3390
|
-
#ce =
|
|
3402
|
+
#ce = ct();
|
|
3391
3403
|
#de(e, i) {
|
|
3392
|
-
|
|
3404
|
+
dt(this.#ce, this.__rowsBodyEl, this._bodyEl, e, i);
|
|
3393
3405
|
}
|
|
3394
3406
|
#ze() {
|
|
3395
|
-
|
|
3407
|
+
ut(this.#ce, this.__rowsBodyEl, this.#o, this.#i);
|
|
3396
3408
|
}
|
|
3397
3409
|
#he() {
|
|
3398
3410
|
const e = this.querySelector(".tbw-grid-root");
|
|
3399
|
-
e && (this.#M ? (this.#$ || (this.#$ =
|
|
3411
|
+
e && (this.#M ? (this.#$ || (this.#$ = Kt(this.#o?.loadingRenderer)), Qt(e, this.#$)) : Zt(this.#$));
|
|
3400
3412
|
}
|
|
3401
3413
|
#j(e, i) {
|
|
3402
3414
|
const o = this.#R.get(e);
|
|
3403
3415
|
if (!o) return;
|
|
3404
3416
|
const n = this.findRenderedRowElement?.(o.index);
|
|
3405
|
-
n &&
|
|
3417
|
+
n && Jt(n, i);
|
|
3406
3418
|
}
|
|
3407
3419
|
#ue(e, i, o) {
|
|
3408
3420
|
const n = this.#R.get(e);
|
|
@@ -3412,7 +3424,7 @@ class k extends HTMLElement {
|
|
|
3412
3424
|
const s = this._visibleColumns.findIndex((a) => a.field === i);
|
|
3413
3425
|
if (s < 0) return;
|
|
3414
3426
|
const l = r.children[s];
|
|
3415
|
-
l &&
|
|
3427
|
+
l && ei(l, o);
|
|
3416
3428
|
}
|
|
3417
3429
|
#P() {
|
|
3418
3430
|
if (this.isConnected && !(!this._headerRowEl || !this._bodyEl)) {
|
|
@@ -3422,7 +3434,7 @@ class k extends HTMLElement {
|
|
|
3422
3434
|
const i = this.#e?.getAll() ?? [];
|
|
3423
3435
|
this.#t.applyState(e, i);
|
|
3424
3436
|
}
|
|
3425
|
-
this._bodyEl && (this._bodyEl.style.display = "", this._bodyEl.style.gridTemplateColumns = ""), this.#s.requestPhase(
|
|
3437
|
+
this._bodyEl && (this._bodyEl.style.display = "", this._bodyEl.style.gridTemplateColumns = ""), this.#s.requestPhase(A.FULL, "setup");
|
|
3426
3438
|
}
|
|
3427
3439
|
}
|
|
3428
3440
|
#De(e) {
|
|
@@ -3467,7 +3479,7 @@ class k extends HTMLElement {
|
|
|
3467
3479
|
});
|
|
3468
3480
|
if (this.dispatchEvent(c), c.defaultPrevented)
|
|
3469
3481
|
return !0;
|
|
3470
|
-
const
|
|
3482
|
+
const h = {
|
|
3471
3483
|
row: r,
|
|
3472
3484
|
rowIndex: i,
|
|
3473
3485
|
colIndex: o,
|
|
@@ -3475,8 +3487,8 @@ class k extends HTMLElement {
|
|
|
3475
3487
|
value: a,
|
|
3476
3488
|
cellEl: n,
|
|
3477
3489
|
originalEvent: e
|
|
3478
|
-
}, f = this.#e?.onCellClick(
|
|
3479
|
-
return this.#L("cell-click",
|
|
3490
|
+
}, f = this.#e?.onCellClick(h) ?? !1;
|
|
3491
|
+
return this.#L("cell-click", h), f;
|
|
3480
3492
|
}
|
|
3481
3493
|
_dispatchRowClick(e, i, o, n) {
|
|
3482
3494
|
if (!o) return !1;
|
|
@@ -3537,7 +3549,7 @@ class k extends HTMLElement {
|
|
|
3537
3549
|
return this.#d;
|
|
3538
3550
|
}
|
|
3539
3551
|
async forceLayout() {
|
|
3540
|
-
return this.#s.requestPhase(
|
|
3552
|
+
return this.#s.requestPhase(A.FULL, "forceLayout"), this.#s.whenReady();
|
|
3541
3553
|
}
|
|
3542
3554
|
async getConfig() {
|
|
3543
3555
|
return Object.freeze({ ...this.#o || {} });
|
|
@@ -3556,21 +3568,21 @@ class k extends HTMLElement {
|
|
|
3556
3568
|
);
|
|
3557
3569
|
const { row: r, index: s } = n, l = [];
|
|
3558
3570
|
for (const [a, c] of Object.entries(i)) {
|
|
3559
|
-
const
|
|
3560
|
-
|
|
3571
|
+
const h = r[a];
|
|
3572
|
+
h !== c && (l.push({ field: a, oldValue: h, newValue: c }), r[a] = c);
|
|
3561
3573
|
}
|
|
3562
|
-
for (const { field: a, oldValue: c, newValue:
|
|
3574
|
+
for (const { field: a, oldValue: c, newValue: h } of l)
|
|
3563
3575
|
this.#L("cell-change", {
|
|
3564
3576
|
row: r,
|
|
3565
3577
|
rowId: e,
|
|
3566
3578
|
rowIndex: s,
|
|
3567
3579
|
field: a,
|
|
3568
3580
|
oldValue: c,
|
|
3569
|
-
newValue:
|
|
3581
|
+
newValue: h,
|
|
3570
3582
|
changes: i,
|
|
3571
3583
|
source: o
|
|
3572
3584
|
});
|
|
3573
|
-
l.length > 0 && this.#s.requestPhase(
|
|
3585
|
+
l.length > 0 && this.#s.requestPhase(A.ROWS, "updateRow");
|
|
3574
3586
|
}
|
|
3575
3587
|
updateRows(e, i = "api") {
|
|
3576
3588
|
let o = !1;
|
|
@@ -3581,30 +3593,30 @@ class k extends HTMLElement {
|
|
|
3581
3593
|
`[tbw-grid] Row with ID "${n}" not found. Ensure the row exists and getRowId is correctly configured.`
|
|
3582
3594
|
);
|
|
3583
3595
|
const { row: l, index: a } = s;
|
|
3584
|
-
for (const [c,
|
|
3596
|
+
for (const [c, h] of Object.entries(r)) {
|
|
3585
3597
|
const f = l[c];
|
|
3586
|
-
f !==
|
|
3598
|
+
f !== h && (o = !0, l[c] = h, this.#L("cell-change", {
|
|
3587
3599
|
row: l,
|
|
3588
3600
|
rowId: n,
|
|
3589
3601
|
rowIndex: a,
|
|
3590
3602
|
field: c,
|
|
3591
3603
|
oldValue: f,
|
|
3592
|
-
newValue:
|
|
3604
|
+
newValue: h,
|
|
3593
3605
|
changes: r,
|
|
3594
3606
|
source: i
|
|
3595
3607
|
}));
|
|
3596
3608
|
}
|
|
3597
3609
|
}
|
|
3598
|
-
o && this.#s.requestPhase(
|
|
3610
|
+
o && this.#s.requestPhase(A.ROWS, "updateRows");
|
|
3599
3611
|
}
|
|
3600
3612
|
animateRow(e, i) {
|
|
3601
|
-
|
|
3613
|
+
_e(this, e, i);
|
|
3602
3614
|
}
|
|
3603
3615
|
animateRows(e, i) {
|
|
3604
|
-
|
|
3616
|
+
li(this, e, i);
|
|
3605
3617
|
}
|
|
3606
3618
|
animateRowById(e, i) {
|
|
3607
|
-
return
|
|
3619
|
+
return ai(this, e, i);
|
|
3608
3620
|
}
|
|
3609
3621
|
setColumnVisible(e, i) {
|
|
3610
3622
|
const o = this.#t.setColumnVisible(e, i);
|
|
@@ -3703,17 +3715,17 @@ class k extends HTMLElement {
|
|
|
3703
3715
|
#K = !1;
|
|
3704
3716
|
refreshShellHeader() {
|
|
3705
3717
|
this.#K || (this.#K = !0, queueMicrotask(() => {
|
|
3706
|
-
this.#K = !1, this.isConnected && (this.#k(), this.#t.markSourcesChanged(), this.#t.merge(),
|
|
3718
|
+
this.#K = !1, this.isConnected && (this.#k(), this.#t.markSourcesChanged(), this.#t.merge(), he(this.#i), this.#Z(), this.#W(), this.#Me());
|
|
3707
3719
|
}));
|
|
3708
3720
|
}
|
|
3709
3721
|
#Me() {
|
|
3710
3722
|
const i = this.#n.querySelector(".tbw-grid-content") ?? this.#n.querySelector(".tbw-grid-root");
|
|
3711
3723
|
if (this._headerRowEl = i?.querySelector(".header-row"), this._virtualization.totalHeightEl = i?.querySelector(".faux-vscroll-spacer"), this._virtualization.viewportEl = i?.querySelector(".rows-viewport"), this._bodyEl = i?.querySelector(".rows"), this.__rowsBodyEl = i?.querySelector(".rows-body"), this.#c.isInitialized) {
|
|
3712
|
-
|
|
3724
|
+
ge(this.#n, this.#i), de(this.#n, this.#o?.shell, this.#i);
|
|
3713
3725
|
const o = this.#o?.shell?.toolPanel?.defaultOpen;
|
|
3714
3726
|
o && this.#i.toolPanels.has(o) && (this.openToolPanel(), this.#i.expandedSections.add(o));
|
|
3715
3727
|
}
|
|
3716
|
-
this._resizeController =
|
|
3728
|
+
this._resizeController = Me(this), this.#G(i), this.#s.requestPhase(A.COLUMNS, "shellRefresh");
|
|
3717
3729
|
}
|
|
3718
3730
|
#A = /* @__PURE__ */ new Map();
|
|
3719
3731
|
registerStyles(e, i) {
|
|
@@ -3733,20 +3745,20 @@ class k extends HTMLElement {
|
|
|
3733
3745
|
document.adoptedStyleSheets = [...i, ...e];
|
|
3734
3746
|
}
|
|
3735
3747
|
#k() {
|
|
3736
|
-
|
|
3748
|
+
Ne(this, this.#i), Ie(this, this.#i), qe(this, this.#i, this.#oe());
|
|
3737
3749
|
}
|
|
3738
3750
|
#ge() {
|
|
3739
3751
|
const e = this.#n.querySelector(".tbw-shell-header");
|
|
3740
3752
|
if (!e) return;
|
|
3741
|
-
|
|
3742
|
-
const i =
|
|
3753
|
+
he(this.#i);
|
|
3754
|
+
const i = ui(
|
|
3743
3755
|
this.#o.shell,
|
|
3744
3756
|
this.#i,
|
|
3745
3757
|
this.#o.icons?.toolPanel
|
|
3746
3758
|
), o = document.createElement("div");
|
|
3747
3759
|
o.innerHTML = i;
|
|
3748
3760
|
const n = o.firstElementChild;
|
|
3749
|
-
n && (e.replaceWith(n), this.#we(),
|
|
3761
|
+
n && (e.replaceWith(n), this.#we(), de(this.#n, this.#o?.shell, this.#i));
|
|
3750
3762
|
}
|
|
3751
3763
|
#ke() {
|
|
3752
3764
|
const e = () => {
|
|
@@ -3760,11 +3772,11 @@ class k extends HTMLElement {
|
|
|
3760
3772
|
this.#t.registerLightDomHandler("tbw-grid-header", e), this.#t.registerLightDomHandler("tbw-grid-tool-buttons", e), this.#t.registerLightDomHandler("tbw-grid-tool-panel", e), this.#t.registerLightDomHandler("tbw-grid-column", i), this.#t.registerLightDomHandler("tbw-grid-detail", i), this.#t.observeLightDOM(this);
|
|
3761
3773
|
}
|
|
3762
3774
|
refreshColumns() {
|
|
3763
|
-
this.__lightDomColumnsCache = void 0,
|
|
3775
|
+
this.__lightDomColumnsCache = void 0, Y(this), this.#t.parseLightDomColumns(this);
|
|
3764
3776
|
const e = this.#i.lightDomTitle, i = this.#i.hasToolButtonsContainer;
|
|
3765
3777
|
this.#k();
|
|
3766
3778
|
const o = this.#i.lightDomTitle, n = this.#i.hasToolButtonsContainer;
|
|
3767
|
-
(o && !e || n && !i) && (this.#t.markSourcesChanged(), this.#t.merge(), this.#ge()), this.#s.requestPhase(
|
|
3779
|
+
(o && !e || n && !i) && (this.#t.markSourcesChanged(), this.#t.merge(), this.#ge()), this.#s.requestPhase(A.COLUMNS, "refreshColumns");
|
|
3768
3780
|
}
|
|
3769
3781
|
#Ne() {
|
|
3770
3782
|
const e = this._virtualization.container, i = this._virtualization.viewportEl ?? e;
|
|
@@ -3776,18 +3788,18 @@ class k extends HTMLElement {
|
|
|
3776
3788
|
const o = this._virtualization;
|
|
3777
3789
|
let n, r, s;
|
|
3778
3790
|
if (i) {
|
|
3779
|
-
const
|
|
3780
|
-
n =
|
|
3791
|
+
const p = o.container ?? this, g = o.viewportEl ?? p, u = o.scrollAreaEl;
|
|
3792
|
+
n = p.clientHeight, r = g.clientHeight, s = u ? u.clientHeight : n, o.cachedFauxHeight = n, o.cachedViewportHeight = r, o.cachedScrollAreaHeight = s;
|
|
3781
3793
|
} else
|
|
3782
3794
|
n = o.cachedFauxHeight, r = o.cachedViewportHeight, s = o.cachedScrollAreaHeight || n;
|
|
3783
3795
|
const l = s - r, a = Math.max(0, n - s);
|
|
3784
|
-
let c,
|
|
3785
|
-
return o.variableHeights && o.positionCache ? c =
|
|
3796
|
+
let c, h = 0;
|
|
3797
|
+
return o.variableHeights && o.positionCache ? c = Wi(o.positionCache) : (c = e * o.rowHeight, h = this.#e?.getExtraHeight() ?? 0), c + l + h + a;
|
|
3786
3798
|
}
|
|
3787
3799
|
#Q() {
|
|
3788
3800
|
if (!this._virtualization.variableHeights) return;
|
|
3789
3801
|
const e = this._rows, i = this._virtualization.rowHeight || 28, o = this.#o.rowHeight, n = this.#o.getRowId, r = n ? (l) => n(l) : void 0;
|
|
3790
|
-
this._virtualization.positionCache =
|
|
3802
|
+
this._virtualization.positionCache = $i(
|
|
3791
3803
|
e,
|
|
3792
3804
|
this._virtualization.heightCache,
|
|
3793
3805
|
i,
|
|
@@ -3796,12 +3808,12 @@ class k extends HTMLElement {
|
|
|
3796
3808
|
const c = this.#e?.getRowHeight?.(l, a);
|
|
3797
3809
|
if (c !== void 0) return c;
|
|
3798
3810
|
if (o) {
|
|
3799
|
-
const
|
|
3800
|
-
if (
|
|
3811
|
+
const h = o(l, a);
|
|
3812
|
+
if (h !== void 0 && h > 0) return h;
|
|
3801
3813
|
}
|
|
3802
3814
|
}
|
|
3803
3815
|
);
|
|
3804
|
-
const s =
|
|
3816
|
+
const s = Bi(
|
|
3805
3817
|
this._virtualization.positionCache,
|
|
3806
3818
|
e,
|
|
3807
3819
|
i,
|
|
@@ -3815,14 +3827,14 @@ class k extends HTMLElement {
|
|
|
3815
3827
|
let r = i;
|
|
3816
3828
|
r === void 0 && (r = this.#e?.getRowHeight?.(n, e)), r === void 0 && (r = this._virtualization.rowHeight);
|
|
3817
3829
|
const s = o[e];
|
|
3818
|
-
if (!(!s || Math.abs(s.height - r) < 1) && (
|
|
3830
|
+
if (!(!s || Math.abs(s.height - r) < 1) && (me(o, e, r), this._virtualization.totalHeightEl)) {
|
|
3819
3831
|
const l = this.#T(this._rows.length);
|
|
3820
3832
|
this._virtualization.totalHeightEl.style.height = `${l}px`;
|
|
3821
3833
|
}
|
|
3822
3834
|
}
|
|
3823
3835
|
#pe(e, i) {
|
|
3824
3836
|
if (!this._virtualization.variableHeights || !this._virtualization.positionCache || !this._bodyEl) return;
|
|
3825
|
-
const o = this._bodyEl.querySelectorAll(".data-grid-row"), n = this.#o.getRowId, r =
|
|
3837
|
+
const o = this._bodyEl.querySelectorAll(".data-grid-row"), n = this.#o.getRowId, r = Vi(
|
|
3826
3838
|
{
|
|
3827
3839
|
positionCache: this._virtualization.positionCache,
|
|
3828
3840
|
heightCache: this._virtualization.heightCache,
|
|
@@ -3849,68 +3861,68 @@ class k extends HTMLElement {
|
|
|
3849
3861
|
return this._virtualization.start = 0, this._virtualization.end = o, e && (this._bodyEl.style.transform = "translateY(0px)"), this.#Y(0, o, e ? ++this.__rowRenderEpoch : this.__rowRenderEpoch), e && this._virtualization.totalHeightEl && (this._virtualization.totalHeightEl.style.height = `${this.#T(o, !0)}px`), this.#de(o, this._visibleColumns.length), i || this.#e?.afterRender(), !0;
|
|
3850
3862
|
const n = this._virtualization.container ?? this, r = this._virtualization.viewportEl ?? n, s = e ? this._virtualization.cachedViewportHeight = r.clientHeight : this._virtualization.cachedViewportHeight || (this._virtualization.cachedViewportHeight = r.clientHeight), l = this._virtualization.rowHeight, a = n.scrollTop;
|
|
3851
3863
|
let c;
|
|
3852
|
-
const
|
|
3853
|
-
if (this._virtualization.variableHeights &&
|
|
3854
|
-
c =
|
|
3864
|
+
const h = this._virtualization.positionCache;
|
|
3865
|
+
if (this._virtualization.variableHeights && h && h.length > 0)
|
|
3866
|
+
c = Ve(h, a), c === -1 && (c = 0);
|
|
3855
3867
|
else {
|
|
3856
3868
|
c = Math.floor(a / l);
|
|
3857
|
-
let
|
|
3858
|
-
const
|
|
3859
|
-
for (;
|
|
3860
|
-
const
|
|
3861
|
-
if (
|
|
3862
|
-
c =
|
|
3869
|
+
let b = 0;
|
|
3870
|
+
const _ = 10;
|
|
3871
|
+
for (; b < _; ) {
|
|
3872
|
+
const R = this.#e?.getExtraHeightBefore?.(c) ?? 0, E = Math.floor((a - R) / l);
|
|
3873
|
+
if (E >= c || E < 0) break;
|
|
3874
|
+
c = E, b++;
|
|
3863
3875
|
}
|
|
3864
3876
|
}
|
|
3865
3877
|
c = c - c % 2, c < 0 && (c = 0);
|
|
3866
3878
|
const f = this.#e?.adjustVirtualStart(c, a, l);
|
|
3867
3879
|
f !== void 0 && f < c && (c = f, c = c - c % 2, c < 0 && (c = 0));
|
|
3868
|
-
let
|
|
3869
|
-
if (this._virtualization.variableHeights &&
|
|
3870
|
-
const
|
|
3871
|
-
let
|
|
3872
|
-
for (
|
|
3873
|
-
|
|
3874
|
-
const
|
|
3875
|
-
|
|
3880
|
+
let p;
|
|
3881
|
+
if (this._virtualization.variableHeights && h && h.length > 0) {
|
|
3882
|
+
const b = s + l * 3;
|
|
3883
|
+
let _ = 0;
|
|
3884
|
+
for (p = c; p < o && _ < b; )
|
|
3885
|
+
_ += h[p].height, p++;
|
|
3886
|
+
const R = Math.ceil(s / l) + 3;
|
|
3887
|
+
p - c < R && (p = Math.min(c + R, o));
|
|
3876
3888
|
} else {
|
|
3877
|
-
const
|
|
3878
|
-
|
|
3889
|
+
const b = Math.ceil(s / l) + 3;
|
|
3890
|
+
p = c + b;
|
|
3879
3891
|
}
|
|
3880
|
-
|
|
3881
|
-
const g = this._virtualization.start,
|
|
3882
|
-
if (!e && c === g &&
|
|
3892
|
+
p > o && (p = o);
|
|
3893
|
+
const g = this._virtualization.start, u = this._virtualization.end;
|
|
3894
|
+
if (!e && c === g && p === u)
|
|
3883
3895
|
return !1;
|
|
3884
|
-
this._virtualization.start = c, this._virtualization.end =
|
|
3885
|
-
const
|
|
3896
|
+
this._virtualization.start = c, this._virtualization.end = p;
|
|
3897
|
+
const d = e ? this._virtualization.cachedFauxHeight = n.clientHeight : this._virtualization.cachedFauxHeight || (this._virtualization.cachedFauxHeight = n.clientHeight);
|
|
3886
3898
|
if (e) {
|
|
3887
|
-
const
|
|
3888
|
-
|
|
3899
|
+
const b = this._virtualization.scrollAreaEl;
|
|
3900
|
+
b && (this._virtualization.cachedScrollAreaHeight = b.clientHeight);
|
|
3889
3901
|
}
|
|
3890
|
-
if (
|
|
3891
|
-
return this.#s.requestPhase(
|
|
3902
|
+
if (d === 0 && s > 0)
|
|
3903
|
+
return this.#s.requestPhase(A.VIRTUALIZATION, "stale-refs-retry"), !1;
|
|
3892
3904
|
if (e && this._virtualization.totalHeightEl) {
|
|
3893
|
-
const
|
|
3894
|
-
this._virtualization.totalHeightEl.style.height = `${
|
|
3905
|
+
const b = this.#T(o);
|
|
3906
|
+
this._virtualization.totalHeightEl.style.height = `${b}px`;
|
|
3895
3907
|
}
|
|
3896
3908
|
let w;
|
|
3897
|
-
if (this._virtualization.variableHeights &&
|
|
3898
|
-
w =
|
|
3909
|
+
if (this._virtualization.variableHeights && h && h[c])
|
|
3910
|
+
w = h[c].offset;
|
|
3899
3911
|
else {
|
|
3900
|
-
const
|
|
3901
|
-
w = c * l +
|
|
3912
|
+
const b = this.#e?.getExtraHeightBefore?.(c) ?? 0;
|
|
3913
|
+
w = c * l + b;
|
|
3902
3914
|
}
|
|
3903
|
-
const
|
|
3904
|
-
return this._bodyEl.style.transform = `translateY(${
|
|
3915
|
+
const v = -(a - w);
|
|
3916
|
+
return this._bodyEl.style.transform = `translateY(${v}px)`, this.#Y(c, p, e ? ++this.__rowRenderEpoch : this.__rowRenderEpoch), e && this._virtualization.variableHeights && this.#pe(c, p), this.#de(o, this._visibleColumns.length), e && !i && (this.#e?.afterRender(), queueMicrotask(() => {
|
|
3905
3917
|
if (!this._virtualization.totalHeightEl) return;
|
|
3906
|
-
const
|
|
3907
|
-
this._virtualization.cachedFauxHeight === 0 && this._virtualization.cachedViewportHeight > 0 || (this._virtualization.totalHeightEl.style.height = `${
|
|
3918
|
+
const b = this.#T(o);
|
|
3919
|
+
this._virtualization.cachedFauxHeight === 0 && this._virtualization.cachedViewportHeight > 0 || (this._virtualization.totalHeightEl.style.height = `${b}px`);
|
|
3908
3920
|
})), !0;
|
|
3909
3921
|
}
|
|
3910
3922
|
#Z() {
|
|
3911
3923
|
this.#k(), this.#t.markSourcesChanged(), this.#t.merge();
|
|
3912
3924
|
const e = this.#o?.shell;
|
|
3913
|
-
|
|
3925
|
+
vi(
|
|
3914
3926
|
this.#n,
|
|
3915
3927
|
e,
|
|
3916
3928
|
{ isPanelOpen: this.#i.isPanelOpen, expandedSections: this.#i.expandedSections },
|
|
@@ -3918,24 +3930,24 @@ class k extends HTMLElement {
|
|
|
3918
3930
|
) && (this.#we(), this.#c.setInitialized(!0));
|
|
3919
3931
|
}
|
|
3920
3932
|
#we() {
|
|
3921
|
-
|
|
3933
|
+
fi(this.#n, this.#o?.shell, this.#i, {
|
|
3922
3934
|
onPanelToggle: () => this.toggleToolPanel(),
|
|
3923
3935
|
onSectionToggle: (e) => this.toggleToolPanelSection(e)
|
|
3924
|
-
}), this.#q?.(), this.#q =
|
|
3936
|
+
}), this.#q?.(), this.#q = gi(this.#n, this.#o?.shell, (e) => {
|
|
3925
3937
|
this.style.setProperty("--tbw-tool-panel-width", `${e}px`);
|
|
3926
3938
|
});
|
|
3927
3939
|
}
|
|
3928
3940
|
}
|
|
3929
3941
|
customElements.get(k.tagName) || customElements.define(k.tagName, k);
|
|
3930
3942
|
globalThis.DataGridElement = k;
|
|
3931
|
-
const
|
|
3943
|
+
const so = {
|
|
3932
3944
|
CAN_MOVE_COLUMN: "canMoveColumn",
|
|
3933
3945
|
GET_CONTEXT_MENU_ITEMS: "getContextMenuItems"
|
|
3934
3946
|
};
|
|
3935
|
-
class
|
|
3947
|
+
class lo {
|
|
3936
3948
|
static dependencies;
|
|
3937
3949
|
static manifest;
|
|
3938
|
-
version = "1.
|
|
3950
|
+
version = "1.16.0";
|
|
3939
3951
|
styles;
|
|
3940
3952
|
cellRenderers;
|
|
3941
3953
|
headerRenderers;
|
|
@@ -4067,14 +4079,14 @@ const H = {
|
|
|
4067
4079
|
GROUP_COUNT: "group-count",
|
|
4068
4080
|
RANGE_SELECTION: "range-selection",
|
|
4069
4081
|
SELECTION_OVERLAY: "selection-overlay"
|
|
4070
|
-
},
|
|
4082
|
+
}, ee = {
|
|
4071
4083
|
ROW_INDEX: "data-row-index",
|
|
4072
4084
|
COL_INDEX: "data-col-index",
|
|
4073
4085
|
FIELD: "data-field",
|
|
4074
4086
|
GROUP_KEY: "data-group-key",
|
|
4075
4087
|
TREE_LEVEL: "data-tree-level",
|
|
4076
4088
|
STICKY: "data-sticky"
|
|
4077
|
-
},
|
|
4089
|
+
}, ao = {
|
|
4078
4090
|
ROOT: `.${H.ROOT}`,
|
|
4079
4091
|
HEADER: `.${H.HEADER}`,
|
|
4080
4092
|
HEADER_ROW: `.${H.HEADER_ROW}`,
|
|
@@ -4084,12 +4096,12 @@ const H = {
|
|
|
4084
4096
|
DATA_ROW: `.${H.DATA_ROW}`,
|
|
4085
4097
|
DATA_CELL: `.${H.DATA_CELL}`,
|
|
4086
4098
|
GROUP_ROW: `.${H.GROUP_ROW}`,
|
|
4087
|
-
ROW_BY_INDEX: (t) => `.${H.DATA_ROW}[${
|
|
4088
|
-
CELL_BY_FIELD: (t) => `.${H.DATA_CELL}[${
|
|
4089
|
-
CELL_AT: (t, e) => `.${H.DATA_ROW}[${
|
|
4099
|
+
ROW_BY_INDEX: (t) => `.${H.DATA_ROW}[${ee.ROW_INDEX}="${t}"]`,
|
|
4100
|
+
CELL_BY_FIELD: (t) => `.${H.DATA_CELL}[${ee.FIELD}="${t}"]`,
|
|
4101
|
+
CELL_AT: (t, e) => `.${H.DATA_ROW}[${ee.ROW_INDEX}="${t}"] .${H.DATA_CELL}[${ee.COL_INDEX}="${e}"]`,
|
|
4090
4102
|
SELECTED_ROWS: `.${H.DATA_ROW}.${H.SELECTED}`,
|
|
4091
4103
|
EDITING_CELL: `.${H.DATA_CELL}.${H.EDITING}`
|
|
4092
|
-
},
|
|
4104
|
+
}, co = {
|
|
4093
4105
|
COLOR_BG: "--tbw-color-bg",
|
|
4094
4106
|
COLOR_FG: "--tbw-color-fg",
|
|
4095
4107
|
COLOR_FG_MUTED: "--tbw-color-fg-muted",
|
|
@@ -4108,14 +4120,14 @@ const H = {
|
|
|
4108
4120
|
BORDER_RADIUS: "--tbw-border-radius",
|
|
4109
4121
|
FOCUS_OUTLINE: "--tbw-focus-outline"
|
|
4110
4122
|
};
|
|
4111
|
-
function
|
|
4123
|
+
function ho(t) {
|
|
4112
4124
|
const e = document.createElement("tbw-grid");
|
|
4113
4125
|
return t && (e.gridConfig = t), e;
|
|
4114
4126
|
}
|
|
4115
|
-
function
|
|
4127
|
+
function uo(t, e = document) {
|
|
4116
4128
|
return e.querySelector(t);
|
|
4117
4129
|
}
|
|
4118
|
-
const
|
|
4130
|
+
const fo = {
|
|
4119
4131
|
CELL_CHANGE: "cell-change",
|
|
4120
4132
|
CELL_COMMIT: "cell-commit",
|
|
4121
4133
|
ROW_COMMIT: "row-commit",
|
|
@@ -4130,7 +4142,7 @@ const co = {
|
|
|
4130
4142
|
CELL_ACTIVATE: "cell-activate",
|
|
4131
4143
|
GROUP_TOGGLE: "group-toggle",
|
|
4132
4144
|
COLUMN_STATE_CHANGE: "column-state-change"
|
|
4133
|
-
},
|
|
4145
|
+
}, go = {
|
|
4134
4146
|
SELECTION_CHANGE: "selection-change",
|
|
4135
4147
|
TREE_EXPAND: "tree-expand",
|
|
4136
4148
|
FILTER_CHANGE: "filter-change",
|
|
@@ -4148,7 +4160,7 @@ const co = {
|
|
|
4148
4160
|
COLUMN_REORDER: "column-reorder",
|
|
4149
4161
|
DETAIL_EXPAND: "detail-expand",
|
|
4150
4162
|
GROUP_EXPAND: "group-expand"
|
|
4151
|
-
},
|
|
4163
|
+
}, fe = {
|
|
4152
4164
|
sum: (t, e) => t.reduce((i, o) => i + (Number(o[e]) || 0), 0),
|
|
4153
4165
|
avg: (t, e) => {
|
|
4154
4166
|
const i = t.reduce((o, n) => o + (Number(n[e]) || 0), 0);
|
|
@@ -4159,28 +4171,28 @@ const co = {
|
|
|
4159
4171
|
max: (t, e) => t.length ? Math.max(...t.map((i) => Number(i[e]) || -1 / 0)) : 0,
|
|
4160
4172
|
first: (t, e) => t[0]?.[e],
|
|
4161
4173
|
last: (t, e) => t[t.length - 1]?.[e]
|
|
4162
|
-
},
|
|
4174
|
+
}, U = /* @__PURE__ */ new Map(), O = {
|
|
4163
4175
|
register(t, e) {
|
|
4164
|
-
|
|
4176
|
+
U.set(t, e);
|
|
4165
4177
|
},
|
|
4166
4178
|
unregister(t) {
|
|
4167
|
-
|
|
4179
|
+
U.delete(t);
|
|
4168
4180
|
},
|
|
4169
4181
|
get(t) {
|
|
4170
4182
|
if (t !== void 0)
|
|
4171
|
-
return typeof t == "function" ? t :
|
|
4183
|
+
return typeof t == "function" ? t : U.get(t) ?? fe[t];
|
|
4172
4184
|
},
|
|
4173
4185
|
run(t, e, i, o) {
|
|
4174
4186
|
const n = this.get(t);
|
|
4175
4187
|
return n ? n(e, i, o) : void 0;
|
|
4176
4188
|
},
|
|
4177
4189
|
has(t) {
|
|
4178
|
-
return
|
|
4190
|
+
return U.has(t) || t in fe;
|
|
4179
4191
|
},
|
|
4180
4192
|
list() {
|
|
4181
|
-
return [...Object.keys(
|
|
4193
|
+
return [...Object.keys(fe), ...U.keys()];
|
|
4182
4194
|
}
|
|
4183
|
-
},
|
|
4195
|
+
}, Be = {
|
|
4184
4196
|
sum: (t) => t.reduce((e, i) => e + i, 0),
|
|
4185
4197
|
avg: (t) => t.length ? t.reduce((e, i) => e + i, 0) / t.length : 0,
|
|
4186
4198
|
count: (t) => t.length,
|
|
@@ -4189,50 +4201,50 @@ const co = {
|
|
|
4189
4201
|
first: (t) => t[0] ?? 0,
|
|
4190
4202
|
last: (t) => t[t.length - 1] ?? 0
|
|
4191
4203
|
};
|
|
4192
|
-
function
|
|
4193
|
-
return
|
|
4204
|
+
function io(t) {
|
|
4205
|
+
return Be[t] ?? Be.sum;
|
|
4194
4206
|
}
|
|
4195
|
-
function
|
|
4196
|
-
return
|
|
4207
|
+
function po(t, e) {
|
|
4208
|
+
return io(t)(e);
|
|
4197
4209
|
}
|
|
4198
|
-
const
|
|
4210
|
+
const wo = O.register.bind(O), bo = O.unregister.bind(O), mo = O.get.bind(O), vo = O.run.bind(O), Co = O.list.bind(O);
|
|
4199
4211
|
export {
|
|
4200
|
-
|
|
4201
|
-
|
|
4212
|
+
lo as BaseGridPlugin,
|
|
4213
|
+
ft as DEFAULT_ANIMATION_CONFIG,
|
|
4202
4214
|
M as DEFAULT_GRID_ICONS,
|
|
4203
|
-
|
|
4215
|
+
fo as DGEvents,
|
|
4204
4216
|
k as DataGridElement,
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4217
|
+
Je as F,
|
|
4218
|
+
G as FitModeEnum,
|
|
4219
|
+
co as GridCSSVars,
|
|
4208
4220
|
H as GridClasses,
|
|
4209
|
-
|
|
4221
|
+
ee as GridDataAttrs,
|
|
4210
4222
|
k as GridElement,
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4223
|
+
ao as GridSelectors,
|
|
4224
|
+
so as PLUGIN_QUERIES,
|
|
4225
|
+
go as PluginEvents,
|
|
4226
|
+
ne as PluginManager,
|
|
4227
|
+
A as RenderPhase,
|
|
4228
|
+
Xe as a,
|
|
4229
|
+
O as aggregatorRegistry,
|
|
4230
|
+
W as b,
|
|
4231
|
+
Vt as builtInSort,
|
|
4232
|
+
no as c,
|
|
4233
|
+
ho as createGrid,
|
|
4234
|
+
Ke as d,
|
|
4235
|
+
Ut as defaultComparator,
|
|
4236
|
+
$ as e,
|
|
4237
|
+
Ce as f,
|
|
4238
|
+
zt as g,
|
|
4239
|
+
mo as getAggregator,
|
|
4240
|
+
io as getValueAggregator,
|
|
4241
|
+
Co as listAggregators,
|
|
4242
|
+
uo as queryGrid,
|
|
4243
|
+
oo as r,
|
|
4244
|
+
wo as registerAggregator,
|
|
4245
|
+
vo as runAggregator,
|
|
4246
|
+
po as runValueAggregator,
|
|
4247
|
+
ro as s,
|
|
4248
|
+
bo as unregisterAggregator
|
|
4237
4249
|
};
|
|
4238
4250
|
//# sourceMappingURL=index.js.map
|