@toolbox-web/grid 1.15.0 → 1.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/all.js +45 -23
- package/all.js.map +1 -1
- package/index.js +883 -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/event-delegation.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/ClipboardPlugin.d.ts.map +1 -1
- package/lib/plugins/clipboard/copy.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.js +55 -55
- 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/clipboard.umd.js +4 -4
- package/umd/plugins/clipboard.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,124 @@ function q(t, e) {
|
|
|
1096
1108
|
}
|
|
1097
1109
|
}
|
|
1098
1110
|
}
|
|
1099
|
-
const
|
|
1100
|
-
function
|
|
1101
|
-
const i =
|
|
1102
|
-
i < 0 || o < 0
|
|
1111
|
+
const ie = /* @__PURE__ */ new WeakMap();
|
|
1112
|
+
function Nt(t, e) {
|
|
1113
|
+
const i = Ke(e), o = Pt(e);
|
|
1114
|
+
if (i < 0 || o < 0) return;
|
|
1115
|
+
t._focusRow = i, t._focusCol = o, Ce(t._bodyEl), e.classList.add("cell-focus"), e.setAttribute("aria-selected", "true");
|
|
1116
|
+
const n = e.closest("tbw-grid");
|
|
1117
|
+
n && document.activeElement !== n && n.focus({ preventScroll: !0 });
|
|
1103
1118
|
}
|
|
1104
|
-
function
|
|
1119
|
+
function ye(t, e, i, o) {
|
|
1105
1120
|
let n = null;
|
|
1106
1121
|
const r = i.composedPath?.();
|
|
1107
1122
|
if (r && r.length > 0 ? n = r[0] : n = i.target, n && !e.contains(n)) {
|
|
1108
|
-
const
|
|
1109
|
-
|
|
1123
|
+
const d = document.elementFromPoint(i.clientX, i.clientY);
|
|
1124
|
+
d && (n = d);
|
|
1110
1125
|
}
|
|
1111
1126
|
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),
|
|
1127
|
+
let c, h, f, p, g, u;
|
|
1128
|
+
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
1129
|
type: o,
|
|
1115
1130
|
row: f,
|
|
1116
1131
|
rowIndex: c !== void 0 && c >= 0 ? c : void 0,
|
|
1117
|
-
colIndex:
|
|
1118
|
-
field:
|
|
1132
|
+
colIndex: h !== void 0 && h >= 0 ? h : void 0,
|
|
1133
|
+
field: p,
|
|
1119
1134
|
value: g,
|
|
1120
|
-
column:
|
|
1135
|
+
column: u,
|
|
1121
1136
|
originalEvent: i,
|
|
1122
1137
|
cellElement: s ?? void 0,
|
|
1123
1138
|
rowElement: l ?? void 0,
|
|
1124
1139
|
isHeader: !!a,
|
|
1125
|
-
cell: c !== void 0 &&
|
|
1140
|
+
cell: c !== void 0 && h !== void 0 && c >= 0 && h >= 0 ? { row: c, col: h } : void 0
|
|
1126
1141
|
};
|
|
1127
1142
|
}
|
|
1128
|
-
function
|
|
1129
|
-
const o =
|
|
1130
|
-
(t._dispatchCellMouseDown?.(o) ?? !1) &&
|
|
1143
|
+
function It(t, e, i) {
|
|
1144
|
+
const o = ye(t, e, i, "mousedown");
|
|
1145
|
+
(t._dispatchCellMouseDown?.(o) ?? !1) && ie.set(t, !0);
|
|
1131
1146
|
}
|
|
1132
|
-
function
|
|
1133
|
-
if (!
|
|
1134
|
-
const o =
|
|
1147
|
+
function qt(t, e, i) {
|
|
1148
|
+
if (!ie.get(t)) return;
|
|
1149
|
+
const o = ye(t, e, i, "mousemove");
|
|
1135
1150
|
t._dispatchCellMouseMove?.(o);
|
|
1136
1151
|
}
|
|
1137
|
-
function
|
|
1138
|
-
if (!
|
|
1139
|
-
const o =
|
|
1140
|
-
t._dispatchCellMouseUp?.(o),
|
|
1152
|
+
function $t(t, e, i) {
|
|
1153
|
+
if (!ie.get(t)) return;
|
|
1154
|
+
const o = ye(t, e, i, "mouseup");
|
|
1155
|
+
t._dispatchCellMouseUp?.(o), ie.set(t, !1);
|
|
1141
1156
|
}
|
|
1142
|
-
function
|
|
1157
|
+
function Wt(t, e, i) {
|
|
1143
1158
|
e.addEventListener(
|
|
1144
1159
|
"mousedown",
|
|
1145
1160
|
(o) => {
|
|
1146
1161
|
const n = o.target.closest(".cell[data-col]");
|
|
1147
|
-
n && (n.classList.contains("editing") ||
|
|
1162
|
+
n && (n.classList.contains("editing") || (o.preventDefault(), Nt(t, n)));
|
|
1148
1163
|
},
|
|
1149
1164
|
{ signal: i }
|
|
1150
1165
|
), e.addEventListener(
|
|
1151
1166
|
"click",
|
|
1152
1167
|
(o) => {
|
|
1153
1168
|
const n = o.target.closest(".data-grid-row");
|
|
1154
|
-
n &&
|
|
1169
|
+
if (n && Le(t, o, n), !document.activeElement?.closest(".cell.editing")) {
|
|
1170
|
+
const r = o.target.closest("tbw-grid");
|
|
1171
|
+
r && r.focus({ preventScroll: !0 });
|
|
1172
|
+
}
|
|
1155
1173
|
},
|
|
1156
1174
|
{ signal: i }
|
|
1157
1175
|
), e.addEventListener(
|
|
1158
1176
|
"dblclick",
|
|
1159
1177
|
(o) => {
|
|
1160
1178
|
const n = o.target.closest(".data-grid-row");
|
|
1161
|
-
n &&
|
|
1179
|
+
n && Le(t, o, n);
|
|
1162
1180
|
},
|
|
1163
1181
|
{ signal: i }
|
|
1164
1182
|
);
|
|
1165
1183
|
}
|
|
1166
|
-
function
|
|
1167
|
-
e.addEventListener("keydown", (n) =>
|
|
1184
|
+
function Ft(t, e, i, o) {
|
|
1185
|
+
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
1186
|
}
|
|
1169
|
-
function
|
|
1187
|
+
function Ut(t, e) {
|
|
1170
1188
|
return t == null && e == null ? 0 : t == null ? -1 : e == null || t > e ? 1 : t < e ? -1 : 0;
|
|
1171
1189
|
}
|
|
1172
|
-
function
|
|
1173
|
-
const n = i.find((l) => l.field === e.field)?.sortComparator ??
|
|
1190
|
+
function Vt(t, e, i) {
|
|
1191
|
+
const n = i.find((l) => l.field === e.field)?.sortComparator ?? Ut, { field: r, direction: s } = e;
|
|
1174
1192
|
return [...t].sort((l, a) => n(l[r], a[r], l, a) * s);
|
|
1175
1193
|
}
|
|
1176
|
-
function
|
|
1177
|
-
t._rows = e, t.__rowRenderEpoch++, t._rowPool.forEach((n) => n.__epoch = -1),
|
|
1194
|
+
function Pe(t, e, i, o) {
|
|
1195
|
+
t._rows = e, t.__rowRenderEpoch++, t._rowPool.forEach((n) => n.__epoch = -1), oe(t), t.refreshVirtualWindow(!0), t.dispatchEvent(
|
|
1178
1196
|
new CustomEvent("sort-change", { detail: { field: i.field, direction: o } })
|
|
1179
1197
|
), t.requestStateChange?.();
|
|
1180
1198
|
}
|
|
1181
|
-
function
|
|
1182
|
-
!t._sortState || t._sortState.field !== e.field ? (t._sortState || (t.__originalOrder = t._rows.slice()),
|
|
1199
|
+
function ze(t, e) {
|
|
1200
|
+
!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
1201
|
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
1202
|
}), t.refreshVirtualWindow(!0), t.dispatchEvent(
|
|
1185
1203
|
new CustomEvent("sort-change", { detail: { field: e.field, direction: 0 } })
|
|
1186
1204
|
), t.requestStateChange?.());
|
|
1187
1205
|
}
|
|
1188
|
-
function
|
|
1206
|
+
function De(t, e, i) {
|
|
1189
1207
|
t._sortState = { field: e.field, direction: i };
|
|
1190
|
-
const o = { field: e.field, direction: i }, n = t._columns, s = (t.effectiveConfig?.sortHandler ??
|
|
1208
|
+
const o = { field: e.field, direction: i }, n = t._columns, s = (t.effectiveConfig?.sortHandler ?? Vt)(t._rows, o, n);
|
|
1191
1209
|
s && typeof s.then == "function" ? s.then((l) => {
|
|
1192
|
-
|
|
1193
|
-
}) :
|
|
1210
|
+
Pe(t, l, e, i);
|
|
1211
|
+
}) : Pe(t, s, e, i);
|
|
1194
1212
|
}
|
|
1195
|
-
function
|
|
1213
|
+
function F(t, e) {
|
|
1196
1214
|
return t.effectiveConfig?.sortable !== !1 && e.sortable === !0;
|
|
1197
1215
|
}
|
|
1198
|
-
function
|
|
1216
|
+
function j(t, e) {
|
|
1199
1217
|
return t.effectiveConfig?.resizable !== !1 && e.resizable !== !1;
|
|
1200
1218
|
}
|
|
1201
|
-
function
|
|
1219
|
+
function Bt(t, e) {
|
|
1202
1220
|
typeof e == "string" ? t.textContent = e : e instanceof HTMLElement && (t.innerHTML = "", t.appendChild(e.cloneNode(!0)));
|
|
1203
1221
|
}
|
|
1204
|
-
function
|
|
1222
|
+
function K(t, e) {
|
|
1205
1223
|
const i = document.createElement("span");
|
|
1206
|
-
|
|
1224
|
+
Ge(i, "sort-indicator");
|
|
1207
1225
|
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
|
|
1226
|
+
return Bt(i, r), i;
|
|
1209
1227
|
}
|
|
1210
|
-
function
|
|
1228
|
+
function Q(t, e, i) {
|
|
1211
1229
|
const o = document.createElement("div");
|
|
1212
1230
|
return o.className = "resize-handle", o.setAttribute("aria-hidden", "true"), o.addEventListener("mousedown", (n) => {
|
|
1213
1231
|
n.stopPropagation(), n.preventDefault(), t._resizeController.start(n, e, i);
|
|
@@ -1215,32 +1233,32 @@ function K(t, e, i) {
|
|
|
1215
1233
|
n.stopPropagation(), n.preventDefault(), t._resizeController.resetColumn(e);
|
|
1216
1234
|
}), o;
|
|
1217
1235
|
}
|
|
1218
|
-
function
|
|
1236
|
+
function Z(t, e, i, o) {
|
|
1219
1237
|
o.classList.add("sortable"), o.tabIndex = 0;
|
|
1220
1238
|
const n = t._sortState?.field === e.field ? t._sortState.direction : 0;
|
|
1221
1239
|
o.setAttribute("aria-sort", n === 0 ? "none" : n === 1 ? "ascending" : "descending"), o.addEventListener("click", (r) => {
|
|
1222
|
-
t._resizeController?.isResizing || t._dispatchHeaderClick?.(r, i, o) ||
|
|
1240
|
+
t._resizeController?.isResizing || t._dispatchHeaderClick?.(r, i, o) || ze(t, e);
|
|
1223
1241
|
}), o.addEventListener("keydown", (r) => {
|
|
1224
1242
|
if (r.key === "Enter" || r.key === " ") {
|
|
1225
1243
|
if (r.preventDefault(), t._dispatchHeaderClick?.(r, i, o)) return;
|
|
1226
|
-
|
|
1244
|
+
ze(t, e);
|
|
1227
1245
|
}
|
|
1228
1246
|
});
|
|
1229
1247
|
}
|
|
1230
|
-
function
|
|
1248
|
+
function Gt(t, e) {
|
|
1231
1249
|
if (e != null)
|
|
1232
1250
|
if (typeof e == "string") {
|
|
1233
1251
|
const i = document.createElement("span");
|
|
1234
|
-
for (i.innerHTML =
|
|
1252
|
+
for (i.innerHTML = W(e); i.firstChild; )
|
|
1235
1253
|
t.appendChild(i.firstChild);
|
|
1236
1254
|
} else e instanceof Node && t.appendChild(e);
|
|
1237
1255
|
}
|
|
1238
|
-
function
|
|
1256
|
+
function oe(t) {
|
|
1239
1257
|
t._headerRowEl = t.findHeaderRow();
|
|
1240
1258
|
const e = t._headerRowEl;
|
|
1241
1259
|
e && (e.innerHTML = "", t._visibleColumns.forEach((i, o) => {
|
|
1242
1260
|
const n = document.createElement("div");
|
|
1243
|
-
n.className = "cell",
|
|
1261
|
+
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
1262
|
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
1263
|
if (i.headerRenderer) {
|
|
1246
1264
|
const a = {
|
|
@@ -1249,30 +1267,30 @@ function ie(t) {
|
|
|
1249
1267
|
sortState: l,
|
|
1250
1268
|
filterActive: !1,
|
|
1251
1269
|
cellEl: n,
|
|
1252
|
-
renderSortIcon: () =>
|
|
1270
|
+
renderSortIcon: () => F(t, i) ? K(t, i) : null,
|
|
1253
1271
|
renderFilterButton: () => null
|
|
1254
1272
|
}, c = i.headerRenderer(a);
|
|
1255
|
-
|
|
1273
|
+
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
1274
|
} else if (i.headerLabelRenderer) {
|
|
1257
1275
|
const a = {
|
|
1258
1276
|
column: i,
|
|
1259
1277
|
value: r
|
|
1260
|
-
}, c = i.headerLabelRenderer(a),
|
|
1261
|
-
c == null ?
|
|
1278
|
+
}, c = i.headerLabelRenderer(a), h = document.createElement("span");
|
|
1279
|
+
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
1280
|
} else if (i.__headerTemplate)
|
|
1263
|
-
Array.from(i.__headerTemplate.childNodes).forEach((a) => n.appendChild(a.cloneNode(!0))),
|
|
1281
|
+
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
1282
|
else {
|
|
1265
1283
|
const a = document.createElement("span");
|
|
1266
|
-
a.textContent = r, n.appendChild(a),
|
|
1284
|
+
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
1285
|
}
|
|
1268
1286
|
e.appendChild(n);
|
|
1269
1287
|
}), e.querySelectorAll(".cell.sortable").forEach((i) => {
|
|
1270
1288
|
i.getAttribute("aria-sort") || i.setAttribute("aria-sort", "none");
|
|
1271
1289
|
}), e.children.length > 0 ? (e.setAttribute("role", "row"), e.setAttribute("aria-rowindex", "1")) : (e.removeAttribute("role"), e.removeAttribute("aria-rowindex")));
|
|
1272
1290
|
}
|
|
1273
|
-
const
|
|
1274
|
-
function
|
|
1275
|
-
return
|
|
1291
|
+
const it = typeof requestIdleCallback == "function";
|
|
1292
|
+
function Xt(t, e) {
|
|
1293
|
+
return it ? requestIdleCallback(t, e) : window.setTimeout(() => {
|
|
1276
1294
|
const i = Date.now();
|
|
1277
1295
|
t({
|
|
1278
1296
|
didTimeout: !1,
|
|
@@ -1280,14 +1298,14 @@ function Vt(t, e) {
|
|
|
1280
1298
|
});
|
|
1281
1299
|
}, 1);
|
|
1282
1300
|
}
|
|
1283
|
-
function
|
|
1284
|
-
|
|
1301
|
+
function Oe(t) {
|
|
1302
|
+
it ? cancelIdleCallback(t) : clearTimeout(t);
|
|
1285
1303
|
}
|
|
1286
|
-
function
|
|
1304
|
+
function Yt(t) {
|
|
1287
1305
|
const e = document.createElement("div");
|
|
1288
1306
|
return e.className = `tbw-spinner tbw-spinner--${t}`, e.setAttribute("role", "progressbar"), e.setAttribute("aria-label", "Loading"), e;
|
|
1289
1307
|
}
|
|
1290
|
-
function
|
|
1308
|
+
function jt(t, e) {
|
|
1291
1309
|
if (e) {
|
|
1292
1310
|
const o = e({ size: t });
|
|
1293
1311
|
if (typeof o == "string") {
|
|
@@ -1296,19 +1314,19 @@ function Gt(t, e) {
|
|
|
1296
1314
|
}
|
|
1297
1315
|
return o;
|
|
1298
1316
|
}
|
|
1299
|
-
return
|
|
1317
|
+
return Yt(t);
|
|
1300
1318
|
}
|
|
1301
|
-
function
|
|
1319
|
+
function Kt(t) {
|
|
1302
1320
|
const e = document.createElement("div");
|
|
1303
|
-
return e.className = "tbw-loading-overlay", e.setAttribute("role", "status"), e.setAttribute("aria-live", "polite"), e.appendChild(
|
|
1321
|
+
return e.className = "tbw-loading-overlay", e.setAttribute("role", "status"), e.setAttribute("aria-live", "polite"), e.appendChild(jt("large", t)), e;
|
|
1304
1322
|
}
|
|
1305
|
-
function
|
|
1323
|
+
function Qt(t, e) {
|
|
1306
1324
|
t.appendChild(e);
|
|
1307
1325
|
}
|
|
1308
|
-
function
|
|
1326
|
+
function Zt(t) {
|
|
1309
1327
|
t?.remove();
|
|
1310
1328
|
}
|
|
1311
|
-
function
|
|
1329
|
+
function Jt(t, e) {
|
|
1312
1330
|
if (e) {
|
|
1313
1331
|
if (t.classList.add("tbw-row-loading"), t.setAttribute("aria-busy", "true"), !t.querySelector(".tbw-row-loading-overlay")) {
|
|
1314
1332
|
const i = document.createElement("div");
|
|
@@ -1319,11 +1337,11 @@ function Kt(t, e) {
|
|
|
1319
1337
|
} else
|
|
1320
1338
|
t.classList.remove("tbw-row-loading"), t.removeAttribute("aria-busy"), t.querySelector(".tbw-row-loading-overlay")?.remove();
|
|
1321
1339
|
}
|
|
1322
|
-
function
|
|
1340
|
+
function ei(t, e) {
|
|
1323
1341
|
e ? (t.classList.add("tbw-cell-loading"), t.setAttribute("aria-busy", "true")) : (t.classList.remove("tbw-cell-loading"), t.removeAttribute("aria-busy"));
|
|
1324
1342
|
}
|
|
1325
|
-
var
|
|
1326
|
-
class
|
|
1343
|
+
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 || {});
|
|
1344
|
+
class ti {
|
|
1327
1345
|
#l;
|
|
1328
1346
|
#n = 0;
|
|
1329
1347
|
#u = 0;
|
|
@@ -1366,15 +1384,15 @@ class Zt {
|
|
|
1366
1384
|
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
1385
|
}
|
|
1368
1386
|
}
|
|
1369
|
-
function
|
|
1387
|
+
function Me(t) {
|
|
1370
1388
|
let e = null, i = null, o = null, n = null;
|
|
1371
1389
|
const r = (a) => {
|
|
1372
1390
|
if (!e) return;
|
|
1373
|
-
const c = a.clientX - e.startX,
|
|
1374
|
-
f.width =
|
|
1391
|
+
const c = a.clientX - e.startX, h = Math.max(40, e.startWidth + c), f = t._visibleColumns[e.colIndex];
|
|
1392
|
+
f.width = h, f.__userResized = !0, f.__renderedWidth = h, i == null && (i = requestAnimationFrame(() => {
|
|
1375
1393
|
i = null, t.updateTemplate?.();
|
|
1376
1394
|
})), t.dispatchEvent(
|
|
1377
|
-
new CustomEvent("column-resize", { detail: { field: f.field, width:
|
|
1395
|
+
new CustomEvent("column-resize", { detail: { field: f.field, width: h } })
|
|
1378
1396
|
);
|
|
1379
1397
|
};
|
|
1380
1398
|
let s = !1;
|
|
@@ -1388,9 +1406,9 @@ function De(t) {
|
|
|
1388
1406
|
get isResizing() {
|
|
1389
1407
|
return e !== null || s;
|
|
1390
1408
|
},
|
|
1391
|
-
start(a, c,
|
|
1409
|
+
start(a, c, h) {
|
|
1392
1410
|
a.preventDefault();
|
|
1393
|
-
const f = t._visibleColumns[c],
|
|
1411
|
+
const f = t._visibleColumns[c], p = typeof f?.width == "number" ? f.width : void 0, g = f?.__renderedWidth ?? p ?? h.getBoundingClientRect().width;
|
|
1394
1412
|
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
1413
|
},
|
|
1396
1414
|
resetColumn(a) {
|
|
@@ -1404,48 +1422,48 @@ function De(t) {
|
|
|
1404
1422
|
}
|
|
1405
1423
|
};
|
|
1406
1424
|
}
|
|
1407
|
-
const
|
|
1425
|
+
const ce = "data-animating", ii = {
|
|
1408
1426
|
change: "--tbw-row-change-duration",
|
|
1409
1427
|
insert: "--tbw-row-insert-duration",
|
|
1410
1428
|
remove: "--tbw-row-remove-duration"
|
|
1411
|
-
},
|
|
1429
|
+
}, oi = {
|
|
1412
1430
|
change: 500,
|
|
1413
1431
|
insert: 300,
|
|
1414
1432
|
remove: 200
|
|
1415
1433
|
};
|
|
1416
|
-
function
|
|
1434
|
+
function ni(t) {
|
|
1417
1435
|
const e = t.trim().toLowerCase();
|
|
1418
1436
|
return e.endsWith("ms") ? parseFloat(e) : e.endsWith("s") ? parseFloat(e) * 1e3 : parseFloat(e);
|
|
1419
1437
|
}
|
|
1420
|
-
function
|
|
1421
|
-
const i =
|
|
1438
|
+
function ri(t, e) {
|
|
1439
|
+
const i = ii[e], o = getComputedStyle(t).getPropertyValue(i);
|
|
1422
1440
|
if (o) {
|
|
1423
|
-
const n =
|
|
1441
|
+
const n = ni(o);
|
|
1424
1442
|
if (!isNaN(n) && n > 0)
|
|
1425
1443
|
return n;
|
|
1426
1444
|
}
|
|
1427
|
-
return
|
|
1445
|
+
return oi[e];
|
|
1428
1446
|
}
|
|
1429
|
-
function
|
|
1430
|
-
t.removeAttribute(
|
|
1431
|
-
const o =
|
|
1447
|
+
function si(t, e, i) {
|
|
1448
|
+
t.removeAttribute(ce), t.offsetWidth, t.setAttribute(ce, e);
|
|
1449
|
+
const o = ri(t, e);
|
|
1432
1450
|
setTimeout(() => {
|
|
1433
|
-
e !== "remove" && t.removeAttribute(
|
|
1451
|
+
e !== "remove" && t.removeAttribute(ce);
|
|
1434
1452
|
}, o);
|
|
1435
1453
|
}
|
|
1436
|
-
function
|
|
1454
|
+
function _e(t, e, i) {
|
|
1437
1455
|
if (e < 0)
|
|
1438
1456
|
return !1;
|
|
1439
1457
|
const o = t.findRenderedRowElement?.(e);
|
|
1440
|
-
return o ? (
|
|
1458
|
+
return o ? (si(o, i), !0) : !1;
|
|
1441
1459
|
}
|
|
1442
|
-
function
|
|
1460
|
+
function li(t, e, i) {
|
|
1443
1461
|
let o = 0;
|
|
1444
1462
|
for (const n of e)
|
|
1445
|
-
|
|
1463
|
+
_e(t, n, i) && o++;
|
|
1446
1464
|
return o;
|
|
1447
1465
|
}
|
|
1448
|
-
function
|
|
1466
|
+
function ai(t, e, i) {
|
|
1449
1467
|
const o = t._rows ?? [], n = t.getRowId;
|
|
1450
1468
|
if (!n)
|
|
1451
1469
|
return !1;
|
|
@@ -1457,9 +1475,9 @@ function ri(t, e, i) {
|
|
|
1457
1475
|
return !1;
|
|
1458
1476
|
}
|
|
1459
1477
|
});
|
|
1460
|
-
return r < 0 ? !1 :
|
|
1478
|
+
return r < 0 ? !1 : _e(t, r, i);
|
|
1461
1479
|
}
|
|
1462
|
-
function
|
|
1480
|
+
function J(t, e, i) {
|
|
1463
1481
|
const o = document.createElement(t);
|
|
1464
1482
|
if (e)
|
|
1465
1483
|
for (const n in e) {
|
|
@@ -1468,7 +1486,7 @@ function Z(t, e, i) {
|
|
|
1468
1486
|
}
|
|
1469
1487
|
return o;
|
|
1470
1488
|
}
|
|
1471
|
-
function
|
|
1489
|
+
function P(t, e) {
|
|
1472
1490
|
const i = document.createElement("div");
|
|
1473
1491
|
if (t && (i.className = t), e)
|
|
1474
1492
|
for (const o in e) {
|
|
@@ -1477,7 +1495,7 @@ function L(t, e) {
|
|
|
1477
1495
|
}
|
|
1478
1496
|
return i;
|
|
1479
1497
|
}
|
|
1480
|
-
function
|
|
1498
|
+
function ot(t, e, i) {
|
|
1481
1499
|
const o = document.createElement("button");
|
|
1482
1500
|
if (t && (o.className = t), e)
|
|
1483
1501
|
for (const n in e) {
|
|
@@ -1486,8 +1504,8 @@ function tt(t, e, i) {
|
|
|
1486
1504
|
}
|
|
1487
1505
|
return o;
|
|
1488
1506
|
}
|
|
1489
|
-
const
|
|
1490
|
-
|
|
1507
|
+
const nt = document.createElement("template");
|
|
1508
|
+
nt.innerHTML = `
|
|
1491
1509
|
<div class="tbw-scroll-area">
|
|
1492
1510
|
<div class="rows-body-wrapper">
|
|
1493
1511
|
<div class="rows-body" role="grid">
|
|
@@ -1506,38 +1524,38 @@ it.innerHTML = `
|
|
|
1506
1524
|
<div class="faux-vscroll-spacer"></div>
|
|
1507
1525
|
</div>
|
|
1508
1526
|
`;
|
|
1509
|
-
function
|
|
1510
|
-
return
|
|
1527
|
+
function rt() {
|
|
1528
|
+
return nt.content.cloneNode(!0);
|
|
1511
1529
|
}
|
|
1512
|
-
function
|
|
1513
|
-
const e = document.createDocumentFragment(), i =
|
|
1530
|
+
function ke(t) {
|
|
1531
|
+
const e = document.createDocumentFragment(), i = P(t.hasShell ? "tbw-grid-root has-shell" : "tbw-grid-root");
|
|
1514
1532
|
if (t.hasShell && t.shellHeader && t.shellBody)
|
|
1515
1533
|
i.appendChild(t.shellHeader), i.appendChild(t.shellBody);
|
|
1516
1534
|
else {
|
|
1517
|
-
const o =
|
|
1518
|
-
o.appendChild(
|
|
1535
|
+
const o = P("tbw-grid-content");
|
|
1536
|
+
o.appendChild(rt()), i.appendChild(o);
|
|
1519
1537
|
}
|
|
1520
1538
|
return e.appendChild(i), e;
|
|
1521
1539
|
}
|
|
1522
|
-
function
|
|
1523
|
-
const e =
|
|
1540
|
+
function ci(t) {
|
|
1541
|
+
const e = P("tbw-shell-header", { part: "shell-header", role: "presentation" });
|
|
1524
1542
|
if (t.title) {
|
|
1525
|
-
const r =
|
|
1543
|
+
const r = P("tbw-shell-title");
|
|
1526
1544
|
r.textContent = t.title, e.appendChild(r);
|
|
1527
1545
|
}
|
|
1528
|
-
const i =
|
|
1546
|
+
const i = P("tbw-shell-content", {
|
|
1529
1547
|
part: "shell-content",
|
|
1530
1548
|
role: "presentation",
|
|
1531
1549
|
"data-light-dom-header-content": ""
|
|
1532
1550
|
});
|
|
1533
1551
|
e.appendChild(i);
|
|
1534
|
-
const o =
|
|
1552
|
+
const o = P("tbw-shell-toolbar", { part: "shell-toolbar", role: "presentation" });
|
|
1535
1553
|
for (const r of t.configButtons)
|
|
1536
|
-
r.hasRender && o.appendChild(
|
|
1554
|
+
r.hasRender && o.appendChild(P("tbw-toolbar-content-slot", { "data-toolbar-content": r.id }));
|
|
1537
1555
|
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 =
|
|
1556
|
+
r.hasRender && o.appendChild(P("tbw-toolbar-content-slot", { "data-toolbar-content": r.id }));
|
|
1557
|
+
if ((t.configButtons.some((r) => r.hasRender) || t.apiButtons.some((r) => r.hasRender)) && t.hasPanels && o.appendChild(P("tbw-toolbar-separator")), t.hasPanels) {
|
|
1558
|
+
const r = ot(t.isPanelOpen ? "tbw-toolbar-btn active" : "tbw-toolbar-btn", {
|
|
1541
1559
|
"data-panel-toggle": "",
|
|
1542
1560
|
title: "Settings",
|
|
1543
1561
|
"aria-label": "Toggle settings panel",
|
|
@@ -1548,12 +1566,12 @@ function si(t) {
|
|
|
1548
1566
|
}
|
|
1549
1567
|
return e.appendChild(o), e;
|
|
1550
1568
|
}
|
|
1551
|
-
function
|
|
1552
|
-
const e =
|
|
1553
|
-
n.appendChild(
|
|
1569
|
+
function di(t) {
|
|
1570
|
+
const e = P("tbw-shell-body"), i = t.panels.length > 0, o = t.panels.length === 1, n = P("tbw-grid-content");
|
|
1571
|
+
n.appendChild(rt());
|
|
1554
1572
|
let r = null;
|
|
1555
1573
|
if (i) {
|
|
1556
|
-
r =
|
|
1574
|
+
r = J("aside", {
|
|
1557
1575
|
class: t.isPanelOpen ? "tbw-tool-panel open" : "tbw-tool-panel",
|
|
1558
1576
|
part: "tool-panel",
|
|
1559
1577
|
"data-position": t.position,
|
|
@@ -1562,29 +1580,29 @@ function li(t) {
|
|
|
1562
1580
|
});
|
|
1563
1581
|
const s = t.position === "left" ? "right" : "left";
|
|
1564
1582
|
r.appendChild(
|
|
1565
|
-
|
|
1583
|
+
P("tbw-tool-panel-resize", {
|
|
1566
1584
|
"data-resize-handle": "",
|
|
1567
1585
|
"data-handle-position": s,
|
|
1568
1586
|
"aria-hidden": "true"
|
|
1569
1587
|
})
|
|
1570
1588
|
);
|
|
1571
|
-
const l =
|
|
1589
|
+
const l = P("tbw-tool-panel-content", { role: "presentation" }), a = P("tbw-accordion");
|
|
1572
1590
|
for (const c of t.panels) {
|
|
1573
|
-
const
|
|
1591
|
+
const h = `tbw-accordion-section${c.isExpanded ? " expanded" : ""}${o ? " single" : ""}`, f = P(h, { "data-section": c.id }), p = ot("tbw-accordion-header", {
|
|
1574
1592
|
"aria-expanded": String(c.isExpanded),
|
|
1575
1593
|
"aria-controls": `tbw-section-${c.id}`
|
|
1576
1594
|
});
|
|
1577
|
-
if (o &&
|
|
1578
|
-
const
|
|
1579
|
-
|
|
1595
|
+
if (o && p.setAttribute("aria-disabled", "true"), c.icon) {
|
|
1596
|
+
const u = J("span", { class: "tbw-accordion-icon" });
|
|
1597
|
+
u.innerHTML = c.icon, p.appendChild(u);
|
|
1580
1598
|
}
|
|
1581
|
-
const g =
|
|
1582
|
-
if (g.textContent = c.title,
|
|
1583
|
-
const
|
|
1584
|
-
|
|
1599
|
+
const g = J("span", { class: "tbw-accordion-title" });
|
|
1600
|
+
if (g.textContent = c.title, p.appendChild(g), !o) {
|
|
1601
|
+
const u = J("span", { class: "tbw-accordion-chevron" });
|
|
1602
|
+
u.innerHTML = c.isExpanded ? t.collapseIcon : t.expandIcon, p.appendChild(u);
|
|
1585
1603
|
}
|
|
1586
|
-
f.appendChild(
|
|
1587
|
-
|
|
1604
|
+
f.appendChild(p), f.appendChild(
|
|
1605
|
+
P("tbw-accordion-content", {
|
|
1588
1606
|
id: `tbw-section-${c.id}`,
|
|
1589
1607
|
role: "presentation"
|
|
1590
1608
|
})
|
|
@@ -1594,10 +1612,10 @@ function li(t) {
|
|
|
1594
1612
|
}
|
|
1595
1613
|
return t.position === "left" && r ? (e.appendChild(r), e.appendChild(n)) : (e.appendChild(n), r && e.appendChild(r)), e;
|
|
1596
1614
|
}
|
|
1597
|
-
function
|
|
1615
|
+
function I(t) {
|
|
1598
1616
|
return t ? typeof t == "string" ? t : t.outerHTML : "";
|
|
1599
1617
|
}
|
|
1600
|
-
function
|
|
1618
|
+
function hi() {
|
|
1601
1619
|
return {
|
|
1602
1620
|
toolPanels: /* @__PURE__ */ new Map(),
|
|
1603
1621
|
headerContents: /* @__PURE__ */ new Map(),
|
|
@@ -1616,32 +1634,32 @@ function ai() {
|
|
|
1616
1634
|
lightDomContentMoved: !1
|
|
1617
1635
|
};
|
|
1618
1636
|
}
|
|
1619
|
-
function
|
|
1637
|
+
function st(t) {
|
|
1620
1638
|
return !!(t?.header?.title || t?.header?.toolbarContents?.length || t?.toolPanels?.length || t?.headerContents?.length || t?.header?.lightDomContent?.length || t?.header?.hasToolButtonsContainer);
|
|
1621
1639
|
}
|
|
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
|
-
|
|
1640
|
+
function ui(t, e, i = "☰") {
|
|
1641
|
+
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];
|
|
1642
|
+
for (const d of l)
|
|
1643
|
+
a.has(d.id) || c.push(d);
|
|
1644
|
+
const h = c.length > 0, f = e.toolPanels.size > 0, p = h && f, g = [...c].sort((d, w) => (d.order ?? 0) - (w.order ?? 0));
|
|
1645
|
+
let u = "";
|
|
1646
|
+
for (const d of g)
|
|
1647
|
+
u += `<div class="tbw-toolbar-content-slot" data-toolbar-content="${d.id}"></div>`;
|
|
1648
|
+
if (p && (u += '<div class="tbw-toolbar-separator"></div>'), f) {
|
|
1649
|
+
const d = e.isPanelOpen;
|
|
1650
|
+
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
1651
|
}
|
|
1634
1652
|
return `
|
|
1635
1653
|
<div class="tbw-shell-header" part="shell-header" role="presentation">
|
|
1636
|
-
${n ? `<div class="tbw-shell-title">${
|
|
1654
|
+
${n ? `<div class="tbw-shell-title">${yt(o)}</div>` : ""}
|
|
1637
1655
|
<div class="tbw-shell-content" part="shell-content" role="presentation" data-light-dom-header-content></div>
|
|
1638
1656
|
<div class="tbw-shell-toolbar" part="shell-toolbar" role="presentation">
|
|
1639
|
-
${
|
|
1657
|
+
${u}
|
|
1640
1658
|
</div>
|
|
1641
1659
|
</div>
|
|
1642
1660
|
`;
|
|
1643
1661
|
}
|
|
1644
|
-
function
|
|
1662
|
+
function Ne(t, e) {
|
|
1645
1663
|
const i = t.querySelector("tbw-grid-header");
|
|
1646
1664
|
if (!i) return;
|
|
1647
1665
|
if (!e.lightDomTitle) {
|
|
@@ -1651,7 +1669,7 @@ function Me(t, e) {
|
|
|
1651
1669
|
const o = i.querySelectorAll("tbw-grid-header-content");
|
|
1652
1670
|
o.length > 0 && e.lightDomHeaderContent.length === 0 && (e.lightDomHeaderContent = Array.from(o)), i.style.display = "none";
|
|
1653
1671
|
}
|
|
1654
|
-
function
|
|
1672
|
+
function Ie(t, e, i) {
|
|
1655
1673
|
const o = t.querySelector(":scope > tbw-grid-tool-buttons");
|
|
1656
1674
|
if (!o) return;
|
|
1657
1675
|
e.hasToolButtonsContainer = !0;
|
|
@@ -1671,7 +1689,7 @@ function ke(t, e, i) {
|
|
|
1671
1689
|
};
|
|
1672
1690
|
e.toolbarContents.set(n, r), e.lightDomToolbarContentIds.add(n), o.style.display = "none";
|
|
1673
1691
|
}
|
|
1674
|
-
function
|
|
1692
|
+
function qe(t, e, i) {
|
|
1675
1693
|
t.querySelectorAll(":scope > tbw-grid-tool-panel").forEach((n) => {
|
|
1676
1694
|
const r = n, s = r.getAttribute("id"), l = r.getAttribute("title");
|
|
1677
1695
|
if (!s || !l) {
|
|
@@ -1680,39 +1698,39 @@ function Ne(t, e, i) {
|
|
|
1680
1698
|
);
|
|
1681
1699
|
return;
|
|
1682
1700
|
}
|
|
1683
|
-
const a = r.getAttribute("icon") ?? void 0, c = r.getAttribute("tooltip") ?? void 0,
|
|
1701
|
+
const a = r.getAttribute("icon") ?? void 0, c = r.getAttribute("tooltip") ?? void 0, h = parseInt(r.getAttribute("order") ?? "100", 10);
|
|
1684
1702
|
let f;
|
|
1685
|
-
const
|
|
1686
|
-
if (
|
|
1687
|
-
f =
|
|
1703
|
+
const p = i?.(r);
|
|
1704
|
+
if (p)
|
|
1705
|
+
f = p;
|
|
1688
1706
|
else {
|
|
1689
|
-
const
|
|
1707
|
+
const d = r.innerHTML.trim();
|
|
1690
1708
|
f = (w) => {
|
|
1691
|
-
const
|
|
1692
|
-
return
|
|
1709
|
+
const v = document.createElement("div");
|
|
1710
|
+
return v.innerHTML = d, w.appendChild(v), () => v.remove();
|
|
1693
1711
|
};
|
|
1694
1712
|
}
|
|
1695
1713
|
const g = e.toolPanels.get(s);
|
|
1696
1714
|
if (g) {
|
|
1697
|
-
if (
|
|
1698
|
-
g.render = f, g.order =
|
|
1699
|
-
const
|
|
1700
|
-
|
|
1715
|
+
if (p) {
|
|
1716
|
+
g.render = f, g.order = h, g.icon = a, g.tooltip = c;
|
|
1717
|
+
const d = e.panelCleanups.get(s);
|
|
1718
|
+
d && (d(), e.panelCleanups.delete(s));
|
|
1701
1719
|
}
|
|
1702
1720
|
return;
|
|
1703
1721
|
}
|
|
1704
|
-
const
|
|
1722
|
+
const u = {
|
|
1705
1723
|
id: s,
|
|
1706
1724
|
title: l,
|
|
1707
1725
|
icon: a,
|
|
1708
1726
|
tooltip: c,
|
|
1709
|
-
order:
|
|
1727
|
+
order: h,
|
|
1710
1728
|
render: f
|
|
1711
1729
|
};
|
|
1712
|
-
e.toolPanels.set(s,
|
|
1730
|
+
e.toolPanels.set(s, u), e.lightDomToolPanelIds.add(s), r.style.display = "none";
|
|
1713
1731
|
});
|
|
1714
1732
|
}
|
|
1715
|
-
function
|
|
1733
|
+
function fi(t, e, i, o) {
|
|
1716
1734
|
const n = t.querySelector(".tbw-shell-toolbar");
|
|
1717
1735
|
n && n.addEventListener("click", (s) => {
|
|
1718
1736
|
if (s.target.closest("[data-panel-toggle]")) {
|
|
@@ -1724,36 +1742,36 @@ function di(t, e, i, o) {
|
|
|
1724
1742
|
r && r.addEventListener("click", (s) => {
|
|
1725
1743
|
const a = s.target.closest(".tbw-accordion-header");
|
|
1726
1744
|
if (a) {
|
|
1727
|
-
const
|
|
1728
|
-
|
|
1745
|
+
const h = a.closest("[data-section]")?.getAttribute("data-section");
|
|
1746
|
+
h && o.onSectionToggle(h);
|
|
1729
1747
|
}
|
|
1730
1748
|
});
|
|
1731
1749
|
}
|
|
1732
|
-
function
|
|
1750
|
+
function gi(t, e, i) {
|
|
1733
1751
|
const o = t.querySelector(".tbw-tool-panel"), n = t.querySelector("[data-resize-handle]"), r = t.querySelector(".tbw-shell-body");
|
|
1734
1752
|
if (!o || !n || !r)
|
|
1735
1753
|
return () => {
|
|
1736
1754
|
};
|
|
1737
1755
|
const s = e?.toolPanel?.position ?? "right", l = 200;
|
|
1738
|
-
let a = 0, c = 0,
|
|
1739
|
-
const
|
|
1756
|
+
let a = 0, c = 0, h = 0, f = !1;
|
|
1757
|
+
const p = (d) => {
|
|
1740
1758
|
if (!f) return;
|
|
1741
|
-
|
|
1742
|
-
const w = s === "left" ?
|
|
1743
|
-
o.style.width = `${
|
|
1759
|
+
d.preventDefault();
|
|
1760
|
+
const w = s === "left" ? d.clientX - a : a - d.clientX, v = Math.min(h, Math.max(l, c + w));
|
|
1761
|
+
o.style.width = `${v}px`;
|
|
1744
1762
|
}, g = () => {
|
|
1745
1763
|
if (!f) return;
|
|
1746
1764
|
f = !1, n.classList.remove("resizing"), o.style.transition = "", document.body.style.cursor = "", document.body.style.userSelect = "";
|
|
1747
|
-
const
|
|
1748
|
-
i(
|
|
1749
|
-
},
|
|
1750
|
-
|
|
1765
|
+
const d = o.getBoundingClientRect().width;
|
|
1766
|
+
i(d), document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", g);
|
|
1767
|
+
}, u = (d) => {
|
|
1768
|
+
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
1769
|
};
|
|
1752
|
-
return n.addEventListener("mousedown",
|
|
1753
|
-
n.removeEventListener("mousedown",
|
|
1770
|
+
return n.addEventListener("mousedown", u), () => {
|
|
1771
|
+
n.removeEventListener("mousedown", u), document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", g);
|
|
1754
1772
|
};
|
|
1755
1773
|
}
|
|
1756
|
-
function
|
|
1774
|
+
function de(t, e, i) {
|
|
1757
1775
|
const o = e?.header?.toolbarContents ?? [], n = [...i.toolbarContents.values()], r = new Set(o.map((l) => l.id)), s = [...o];
|
|
1758
1776
|
for (const l of n)
|
|
1759
1777
|
r.has(l.id) || s.push(l);
|
|
@@ -1765,7 +1783,7 @@ function ce(t, e, i) {
|
|
|
1765
1783
|
c && i.toolbarContentCleanups.set(l.id, c);
|
|
1766
1784
|
}
|
|
1767
1785
|
}
|
|
1768
|
-
function
|
|
1786
|
+
function ge(t, e) {
|
|
1769
1787
|
const i = e.lightDomHeaderContent.length > 0 && !e.lightDomContentMoved, o = e.headerContents.size > 0;
|
|
1770
1788
|
if (!i && !o) return;
|
|
1771
1789
|
const n = t.querySelector(".tbw-shell-content");
|
|
@@ -1785,41 +1803,41 @@ function fe(t, e) {
|
|
|
1785
1803
|
c && e.headerContentCleanups.set(s.id, c);
|
|
1786
1804
|
}
|
|
1787
1805
|
}
|
|
1788
|
-
function
|
|
1806
|
+
function pi(t, e, i) {
|
|
1789
1807
|
if (!e.isPanelOpen) return;
|
|
1790
|
-
const o =
|
|
1808
|
+
const o = I(i?.expand ?? M.expand), n = I(i?.collapse ?? M.collapse);
|
|
1791
1809
|
for (const [r, s] of e.toolPanels) {
|
|
1792
1810
|
const l = e.expandedSections.has(r), a = t.querySelector(`[data-section="${r}"]`), c = a?.querySelector(".tbw-accordion-content");
|
|
1793
1811
|
if (!a || !c) continue;
|
|
1794
1812
|
a.classList.toggle("expanded", l);
|
|
1795
|
-
const
|
|
1796
|
-
|
|
1813
|
+
const h = a.querySelector(".tbw-accordion-header");
|
|
1814
|
+
h && h.setAttribute("aria-expanded", String(l));
|
|
1797
1815
|
const f = a.querySelector(".tbw-accordion-chevron");
|
|
1798
1816
|
if (f && (f.innerHTML = l ? n : o), l) {
|
|
1799
1817
|
if (c.children.length === 0) {
|
|
1800
|
-
const
|
|
1801
|
-
|
|
1818
|
+
const p = s.render(c);
|
|
1819
|
+
p && e.panelCleanups.set(r, p);
|
|
1802
1820
|
}
|
|
1803
1821
|
} else {
|
|
1804
|
-
const
|
|
1805
|
-
|
|
1822
|
+
const p = e.panelCleanups.get(r);
|
|
1823
|
+
p && (p(), e.panelCleanups.delete(r)), c.innerHTML = "";
|
|
1806
1824
|
}
|
|
1807
1825
|
}
|
|
1808
1826
|
}
|
|
1809
|
-
function
|
|
1827
|
+
function $e(t, e) {
|
|
1810
1828
|
const i = t.querySelector("[data-panel-toggle]");
|
|
1811
1829
|
i && (i.classList.toggle("active", e.isPanelOpen), i.setAttribute("aria-pressed", String(e.isPanelOpen)));
|
|
1812
1830
|
}
|
|
1813
|
-
function
|
|
1831
|
+
function We(t, e) {
|
|
1814
1832
|
const i = t.querySelector(".tbw-tool-panel");
|
|
1815
1833
|
i && (i.classList.toggle("open", e.isPanelOpen), e.isPanelOpen || (i.style.width = ""));
|
|
1816
1834
|
}
|
|
1817
|
-
function
|
|
1835
|
+
function he(t) {
|
|
1818
1836
|
for (const e of t.toolbarContentCleanups.values())
|
|
1819
1837
|
e();
|
|
1820
1838
|
t.toolbarContentCleanups.clear();
|
|
1821
1839
|
}
|
|
1822
|
-
function
|
|
1840
|
+
function wi(t) {
|
|
1823
1841
|
for (const e of t.headerContentCleanups.values())
|
|
1824
1842
|
e();
|
|
1825
1843
|
t.headerContentCleanups.clear();
|
|
@@ -1836,7 +1854,7 @@ function fi(t) {
|
|
|
1836
1854
|
t.toolPanels.get(e)?.onClose?.();
|
|
1837
1855
|
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
1856
|
}
|
|
1839
|
-
function
|
|
1857
|
+
function bi(t, e) {
|
|
1840
1858
|
let i = !1;
|
|
1841
1859
|
const o = {
|
|
1842
1860
|
get isInitialized() {
|
|
@@ -1865,7 +1883,7 @@ function gi(t, e) {
|
|
|
1865
1883
|
s && t.expandedSections.add(s.id);
|
|
1866
1884
|
}
|
|
1867
1885
|
const n = e.getShadow();
|
|
1868
|
-
|
|
1886
|
+
$e(n, t), We(n, t), pi(n, t, e.getAccordionIcons()), e.emit("tool-panel-open", { sections: o.expandedSections });
|
|
1869
1887
|
},
|
|
1870
1888
|
closeToolPanel() {
|
|
1871
1889
|
if (!t.isPanelOpen) return;
|
|
@@ -1876,7 +1894,7 @@ function gi(t, e) {
|
|
|
1876
1894
|
r.onClose?.();
|
|
1877
1895
|
t.isPanelOpen = !1;
|
|
1878
1896
|
const n = e.getShadow();
|
|
1879
|
-
|
|
1897
|
+
$e(n, t), We(n, t), e.emit("tool-panel-close", {});
|
|
1880
1898
|
},
|
|
1881
1899
|
toggleToolPanel() {
|
|
1882
1900
|
t.isPanelOpen ? o.closeToolPanel() : o.openToolPanel();
|
|
@@ -1892,16 +1910,16 @@ function gi(t, e) {
|
|
|
1892
1910
|
const s = e.getShadow(), l = t.expandedSections.has(n);
|
|
1893
1911
|
if (l) {
|
|
1894
1912
|
const a = t.panelCleanups.get(n);
|
|
1895
|
-
a && (a(), t.panelCleanups.delete(n)), r.onClose?.(), t.expandedSections.delete(n),
|
|
1913
|
+
a && (a(), t.panelCleanups.delete(n)), r.onClose?.(), t.expandedSections.delete(n), ue(s, n, !1);
|
|
1896
1914
|
} else {
|
|
1897
1915
|
for (const [a, c] of t.toolPanels)
|
|
1898
1916
|
if (a !== n && t.expandedSections.has(a)) {
|
|
1899
|
-
const
|
|
1900
|
-
|
|
1917
|
+
const h = t.panelCleanups.get(a);
|
|
1918
|
+
h && (h(), t.panelCleanups.delete(a)), c.onClose?.(), t.expandedSections.delete(a), ue(s, a, !1);
|
|
1901
1919
|
const f = s.querySelector(`[data-section="${a}"] .tbw-accordion-content`);
|
|
1902
1920
|
f && (f.innerHTML = "");
|
|
1903
1921
|
}
|
|
1904
|
-
t.expandedSections.add(n),
|
|
1922
|
+
t.expandedSections.add(n), ue(s, n, !0), mi(s, t, n);
|
|
1905
1923
|
}
|
|
1906
1924
|
e.emit("tool-panel-section-toggle", { id: n, expanded: !l });
|
|
1907
1925
|
},
|
|
@@ -1930,7 +1948,7 @@ function gi(t, e) {
|
|
|
1930
1948
|
console.warn(`[tbw-grid] Header content "${n.id}" already registered`);
|
|
1931
1949
|
return;
|
|
1932
1950
|
}
|
|
1933
|
-
t.headerContents.set(n.id, n), i &&
|
|
1951
|
+
t.headerContents.set(n.id, n), i && ge(e.getShadow(), t);
|
|
1934
1952
|
},
|
|
1935
1953
|
unregisterHeaderContent(n) {
|
|
1936
1954
|
const r = t.headerContentCleanups.get(n);
|
|
@@ -1955,11 +1973,11 @@ function gi(t, e) {
|
|
|
1955
1973
|
};
|
|
1956
1974
|
return o;
|
|
1957
1975
|
}
|
|
1958
|
-
function
|
|
1976
|
+
function ue(t, e, i) {
|
|
1959
1977
|
const o = t.querySelector(`[data-section="${e}"]`);
|
|
1960
1978
|
o && o.classList.toggle("expanded", i);
|
|
1961
1979
|
}
|
|
1962
|
-
function
|
|
1980
|
+
function mi(t, e, i) {
|
|
1963
1981
|
const o = e.toolPanels.get(i);
|
|
1964
1982
|
if (!o?.render) return;
|
|
1965
1983
|
const n = t.querySelector(`[data-section="${i}"] .tbw-accordion-content`);
|
|
@@ -1967,8 +1985,8 @@ function pi(t, e, i) {
|
|
|
1967
1985
|
const r = o.render(n);
|
|
1968
1986
|
r && e.panelCleanups.set(i, r);
|
|
1969
1987
|
}
|
|
1970
|
-
function
|
|
1971
|
-
const n =
|
|
1988
|
+
function vi(t, e, i, o) {
|
|
1989
|
+
const n = st(e), r = [], s = [
|
|
1972
1990
|
"tbw-grid-header",
|
|
1973
1991
|
"tbw-grid-tool-buttons",
|
|
1974
1992
|
"tbw-grid-tool-panel",
|
|
@@ -1982,62 +2000,62 @@ function wi(t, e, i, o) {
|
|
|
1982
2000
|
for (const l of r)
|
|
1983
2001
|
t.appendChild(l);
|
|
1984
2002
|
if (n) {
|
|
1985
|
-
const l =
|
|
2003
|
+
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
2004
|
title: e?.header?.title ?? void 0,
|
|
1987
2005
|
hasPanels: g.length > 0,
|
|
1988
2006
|
isPanelOpen: i.isPanelOpen,
|
|
1989
2007
|
toolPanelIcon: l,
|
|
1990
|
-
configButtons: f.map((
|
|
1991
|
-
id:
|
|
2008
|
+
configButtons: f.map((_) => ({
|
|
2009
|
+
id: _.id,
|
|
1992
2010
|
hasElement: !1,
|
|
1993
|
-
hasRender: !!
|
|
2011
|
+
hasRender: !!_.render
|
|
1994
2012
|
})),
|
|
1995
2013
|
apiButtons: []
|
|
1996
|
-
},
|
|
2014
|
+
}, d = {
|
|
1997
2015
|
position: e?.toolPanel?.position ?? "right",
|
|
1998
2016
|
isPanelOpen: i.isPanelOpen,
|
|
1999
2017
|
expandIcon: a,
|
|
2000
2018
|
collapseIcon: c,
|
|
2001
|
-
panels: g.map((
|
|
2002
|
-
id:
|
|
2003
|
-
title:
|
|
2004
|
-
icon:
|
|
2005
|
-
isExpanded: i.expandedSections.has(
|
|
2019
|
+
panels: g.map((_) => ({
|
|
2020
|
+
id: _.id,
|
|
2021
|
+
title: _.title,
|
|
2022
|
+
icon: I(_.icon),
|
|
2023
|
+
isExpanded: i.expandedSections.has(_.id)
|
|
2006
2024
|
}))
|
|
2007
|
-
}, w =
|
|
2025
|
+
}, w = ci(u), v = di(d), b = ke({
|
|
2008
2026
|
hasShell: !0,
|
|
2009
2027
|
shellHeader: w,
|
|
2010
|
-
shellBody:
|
|
2028
|
+
shellBody: v
|
|
2011
2029
|
});
|
|
2012
|
-
t.appendChild(
|
|
2030
|
+
t.appendChild(b);
|
|
2013
2031
|
} else {
|
|
2014
|
-
const l =
|
|
2032
|
+
const l = ke({ hasShell: !1 });
|
|
2015
2033
|
t.appendChild(l);
|
|
2016
2034
|
}
|
|
2017
2035
|
return n;
|
|
2018
2036
|
}
|
|
2019
|
-
const
|
|
2020
|
-
let
|
|
2021
|
-
const
|
|
2022
|
-
function
|
|
2023
|
-
let t = document.getElementById(
|
|
2024
|
-
return t || (t = document.createElement("style"), t.id =
|
|
2037
|
+
const Fe = "tbw-grid-styles";
|
|
2038
|
+
let te = "";
|
|
2039
|
+
const pe = /* @__PURE__ */ new Map();
|
|
2040
|
+
function Ci() {
|
|
2041
|
+
let t = document.getElementById(Fe);
|
|
2042
|
+
return t || (t = document.createElement("style"), t.id = Fe, t.setAttribute("data-tbw-grid", "true"), document.head.appendChild(t)), t;
|
|
2025
2043
|
}
|
|
2026
|
-
function
|
|
2027
|
-
const t =
|
|
2044
|
+
function we() {
|
|
2045
|
+
const t = Ci(), e = Array.from(pe.values()).join(`
|
|
2028
2046
|
`);
|
|
2029
|
-
t.textContent = `${
|
|
2047
|
+
t.textContent = `${te}
|
|
2030
2048
|
|
|
2031
2049
|
/* Plugin Styles */
|
|
2032
2050
|
${e}`;
|
|
2033
2051
|
}
|
|
2034
|
-
function
|
|
2052
|
+
function yi(t) {
|
|
2035
2053
|
let e = !1;
|
|
2036
2054
|
for (const { name: i, styles: o } of t)
|
|
2037
|
-
|
|
2038
|
-
return e &&
|
|
2055
|
+
pe.has(i) || (pe.set(i, o), e = !0);
|
|
2056
|
+
return e && we(), e;
|
|
2039
2057
|
}
|
|
2040
|
-
function
|
|
2058
|
+
function _i() {
|
|
2041
2059
|
try {
|
|
2042
2060
|
for (const t of Array.from(document.styleSheets))
|
|
2043
2061
|
try {
|
|
@@ -2053,22 +2071,22 @@ function vi() {
|
|
|
2053
2071
|
}
|
|
2054
2072
|
return null;
|
|
2055
2073
|
}
|
|
2056
|
-
async function
|
|
2057
|
-
if (
|
|
2074
|
+
async function Ei(t) {
|
|
2075
|
+
if (te)
|
|
2058
2076
|
return;
|
|
2059
2077
|
if (typeof t == "string" && t.length > 0) {
|
|
2060
|
-
|
|
2078
|
+
te = t, we();
|
|
2061
2079
|
return;
|
|
2062
2080
|
}
|
|
2063
2081
|
await new Promise((i) => setTimeout(i, 50));
|
|
2064
|
-
const e =
|
|
2065
|
-
e ? (
|
|
2082
|
+
const e = _i();
|
|
2083
|
+
e ? (te = e, we()) : (typeof process > "u" || process.env?.NODE_ENV !== "test") && console.warn(
|
|
2066
2084
|
"[tbw-grid] Could not find grid.css in document.styleSheets. Grid styling will not work.",
|
|
2067
2085
|
"Available stylesheets:",
|
|
2068
2086
|
Array.from(document.styleSheets).map((i) => i.href || "(inline)")
|
|
2069
2087
|
);
|
|
2070
2088
|
}
|
|
2071
|
-
function
|
|
2089
|
+
function Si() {
|
|
2072
2090
|
return {
|
|
2073
2091
|
startY: null,
|
|
2074
2092
|
startX: null,
|
|
@@ -2082,39 +2100,39 @@ function yi() {
|
|
|
2082
2100
|
momentumRaf: 0
|
|
2083
2101
|
};
|
|
2084
2102
|
}
|
|
2085
|
-
function
|
|
2103
|
+
function Ri(t) {
|
|
2086
2104
|
t.startY = null, t.startX = null, t.scrollTop = null, t.scrollLeft = null, t.lastY = null, t.lastX = null, t.lastTime = null;
|
|
2087
2105
|
}
|
|
2088
|
-
function
|
|
2106
|
+
function lt(t) {
|
|
2089
2107
|
t.momentumRaf && (cancelAnimationFrame(t.momentumRaf), t.momentumRaf = 0);
|
|
2090
2108
|
}
|
|
2091
|
-
function
|
|
2109
|
+
function Ai(t, e, i) {
|
|
2092
2110
|
if (t.touches.length !== 1) return;
|
|
2093
|
-
|
|
2111
|
+
lt(e);
|
|
2094
2112
|
const o = t.touches[0];
|
|
2095
2113
|
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
2114
|
}
|
|
2097
|
-
function
|
|
2115
|
+
function Ti(t, e, i) {
|
|
2098
2116
|
if (t.touches.length !== 1 || e.startY === null || e.startX === null || e.scrollTop === null || e.scrollLeft === null)
|
|
2099
2117
|
return !1;
|
|
2100
2118
|
const o = t.touches[0], n = o.clientY, r = o.clientX, s = performance.now(), l = e.startY - n, a = e.startX - r;
|
|
2101
2119
|
if (e.lastTime !== null && e.lastY !== null && e.lastX !== null) {
|
|
2102
|
-
const
|
|
2103
|
-
|
|
2120
|
+
const d = s - e.lastTime;
|
|
2121
|
+
d > 0 && (e.velocityY = (e.lastY - n) / d, e.velocityX = (e.lastX - r) / d);
|
|
2104
2122
|
}
|
|
2105
2123
|
e.lastY = n, e.lastX = r, e.lastTime = s;
|
|
2106
|
-
const { scrollTop: c, scrollHeight:
|
|
2107
|
-
let
|
|
2124
|
+
const { scrollTop: c, scrollHeight: h, clientHeight: f } = i.fauxScrollbar, p = h - f, g = l > 0 && c < p || l < 0 && c > 0;
|
|
2125
|
+
let u = !1;
|
|
2108
2126
|
if (i.scrollArea) {
|
|
2109
|
-
const { scrollLeft:
|
|
2110
|
-
|
|
2127
|
+
const { scrollLeft: d, scrollWidth: w, clientWidth: v } = i.scrollArea, b = w - v;
|
|
2128
|
+
u = a > 0 && d < b || a < 0 && d > 0;
|
|
2111
2129
|
}
|
|
2112
|
-
return g && (i.fauxScrollbar.scrollTop = e.scrollTop + l),
|
|
2130
|
+
return g && (i.fauxScrollbar.scrollTop = e.scrollTop + l), u && i.scrollArea && (i.scrollArea.scrollLeft = e.scrollLeft + a), g || u;
|
|
2113
2131
|
}
|
|
2114
|
-
function
|
|
2115
|
-
(Math.abs(t.velocityY) > 0.1 || Math.abs(t.velocityX) > 0.1) &&
|
|
2132
|
+
function xi(t, e) {
|
|
2133
|
+
(Math.abs(t.velocityY) > 0.1 || Math.abs(t.velocityX) > 0.1) && Hi(t, e), Ri(t);
|
|
2116
2134
|
}
|
|
2117
|
-
function
|
|
2135
|
+
function Hi(t, e) {
|
|
2118
2136
|
const n = () => {
|
|
2119
2137
|
t.velocityY *= 0.95, t.velocityX *= 0.95;
|
|
2120
2138
|
const r = t.velocityY * 16, s = t.velocityX * 16;
|
|
@@ -2122,19 +2140,19 @@ function Ai(t, e) {
|
|
|
2122
2140
|
};
|
|
2123
2141
|
t.momentumRaf = requestAnimationFrame(n);
|
|
2124
2142
|
}
|
|
2125
|
-
function
|
|
2126
|
-
t.addEventListener("touchstart", (n) =>
|
|
2143
|
+
function Li(t, e, i, o) {
|
|
2144
|
+
t.addEventListener("touchstart", (n) => Ai(n, e, i), {
|
|
2127
2145
|
passive: !0,
|
|
2128
2146
|
signal: o
|
|
2129
2147
|
}), t.addEventListener(
|
|
2130
2148
|
"touchmove",
|
|
2131
2149
|
(n) => {
|
|
2132
|
-
|
|
2150
|
+
Ti(n, e, i) && n.preventDefault();
|
|
2133
2151
|
},
|
|
2134
2152
|
{ passive: !1, signal: o }
|
|
2135
|
-
), t.addEventListener("touchend", () =>
|
|
2153
|
+
), t.addEventListener("touchend", () => xi(e, i), { passive: !0, signal: o });
|
|
2136
2154
|
}
|
|
2137
|
-
const
|
|
2155
|
+
const Pi = [
|
|
2138
2156
|
{
|
|
2139
2157
|
property: "editable",
|
|
2140
2158
|
pluginName: "editing",
|
|
@@ -2174,7 +2192,7 @@ const xi = [
|
|
|
2174
2192
|
description: 'the "sticky" column property (deprecated, use "pinned")',
|
|
2175
2193
|
isUsed: (t) => t === "left" || t === "right" || t === "start" || t === "end"
|
|
2176
2194
|
}
|
|
2177
|
-
],
|
|
2195
|
+
], zi = [
|
|
2178
2196
|
{
|
|
2179
2197
|
property: "columnGroups",
|
|
2180
2198
|
pluginName: "groupingColumns",
|
|
@@ -2183,56 +2201,56 @@ const xi = [
|
|
|
2183
2201
|
isUsed: (t) => Array.isArray(t) && t.length > 0
|
|
2184
2202
|
}
|
|
2185
2203
|
];
|
|
2186
|
-
function
|
|
2204
|
+
function Di(t) {
|
|
2187
2205
|
return t.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`);
|
|
2188
2206
|
}
|
|
2189
|
-
function
|
|
2190
|
-
return `import { ${
|
|
2207
|
+
function be(t) {
|
|
2208
|
+
return `import { ${D(t)}Plugin } from '@toolbox-web/grid/plugins/${Di(t)}';`;
|
|
2191
2209
|
}
|
|
2192
|
-
function
|
|
2210
|
+
function D(t) {
|
|
2193
2211
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
2194
2212
|
}
|
|
2195
|
-
function
|
|
2213
|
+
function Ue(t, e) {
|
|
2196
2214
|
return t.some((i) => i.name === e);
|
|
2197
2215
|
}
|
|
2198
|
-
function
|
|
2199
|
-
const i =
|
|
2200
|
-
function r(l, a, c,
|
|
2216
|
+
function Oi(t, e) {
|
|
2217
|
+
const i = Pi, o = zi, n = /* @__PURE__ */ new Map();
|
|
2218
|
+
function r(l, a, c, h, f = !1) {
|
|
2201
2219
|
n.has(l) || n.set(l, { description: a, importHint: c, fields: [], isConfigProperty: f });
|
|
2202
|
-
const
|
|
2203
|
-
|
|
2220
|
+
const p = n.get(l);
|
|
2221
|
+
p.fields.includes(h) || p.fields.push(h);
|
|
2204
2222
|
}
|
|
2205
2223
|
for (const l of o) {
|
|
2206
2224
|
const a = t[l.property];
|
|
2207
|
-
(l.isUsed ? l.isUsed(a) : a !== void 0) && !
|
|
2225
|
+
(l.isUsed ? l.isUsed(a) : a !== void 0) && !Ue(e, l.pluginName) && r(l.pluginName, l.description, be(l.pluginName), l.property, !0);
|
|
2208
2226
|
}
|
|
2209
2227
|
const s = t.columns;
|
|
2210
2228
|
if (s && s.length > 0)
|
|
2211
2229
|
for (const l of s)
|
|
2212
2230
|
for (const a of i) {
|
|
2213
2231
|
const c = l[a.property];
|
|
2214
|
-
if ((a.isUsed ? a.isUsed(c) : c !== void 0) && !
|
|
2232
|
+
if ((a.isUsed ? a.isUsed(c) : c !== void 0) && !Ue(e, a.pluginName)) {
|
|
2215
2233
|
const f = l.field || "<unknown>";
|
|
2216
|
-
r(a.pluginName, a.description,
|
|
2234
|
+
r(a.pluginName, a.description, be(a.pluginName), f);
|
|
2217
2235
|
}
|
|
2218
2236
|
}
|
|
2219
2237
|
if (n.size > 0) {
|
|
2220
2238
|
const l = [];
|
|
2221
|
-
for (const [a, { description: c, importHint:
|
|
2222
|
-
if (
|
|
2239
|
+
for (const [a, { description: c, importHint: h, fields: f, isConfigProperty: p }] of n)
|
|
2240
|
+
if (p)
|
|
2223
2241
|
l.push(
|
|
2224
2242
|
`Config uses ${c}, but the required plugin is not loaded.
|
|
2225
2243
|
→ Add the plugin to your gridConfig.plugins array:
|
|
2226
|
-
${
|
|
2227
|
-
plugins: [new ${
|
|
2244
|
+
${h}
|
|
2245
|
+
plugins: [new ${D(a)}Plugin(), ...]`
|
|
2228
2246
|
);
|
|
2229
2247
|
else {
|
|
2230
2248
|
const g = f.slice(0, 3).join(", ") + (f.length > 3 ? `, ... (${f.length} total)` : "");
|
|
2231
2249
|
l.push(
|
|
2232
2250
|
`Column(s) [${g}] use ${c}, but the required plugin is not loaded.
|
|
2233
2251
|
→ Add the plugin to your gridConfig.plugins array:
|
|
2234
|
-
${
|
|
2235
|
-
plugins: [new ${
|
|
2252
|
+
${h}
|
|
2253
|
+
plugins: [new ${D(a)}Plugin(), ...]`
|
|
2236
2254
|
);
|
|
2237
2255
|
}
|
|
2238
2256
|
throw new Error(
|
|
@@ -2246,7 +2264,7 @@ This validation helps catch misconfigurations early. The properties listed above
|
|
|
2246
2264
|
);
|
|
2247
2265
|
}
|
|
2248
2266
|
}
|
|
2249
|
-
function
|
|
2267
|
+
function Mi(t) {
|
|
2250
2268
|
const e = [], i = [];
|
|
2251
2269
|
for (const o of t) {
|
|
2252
2270
|
const r = o.constructor.manifest;
|
|
@@ -2254,12 +2272,12 @@ function zi(t) {
|
|
|
2254
2272
|
for (const s of r.configRules) {
|
|
2255
2273
|
const l = o.config;
|
|
2256
2274
|
if (s.check(l)) {
|
|
2257
|
-
const c = `${`[tbw-grid:${
|
|
2275
|
+
const c = `${`[tbw-grid:${D(o.name)}Plugin]`} Configuration warning: ${s.message}`;
|
|
2258
2276
|
s.severity === "error" ? e.push(c) : i.push(c);
|
|
2259
2277
|
}
|
|
2260
2278
|
}
|
|
2261
2279
|
}
|
|
2262
|
-
if (i.length > 0 &&
|
|
2280
|
+
if (i.length > 0 && ve())
|
|
2263
2281
|
for (const o of i)
|
|
2264
2282
|
console.warn(o);
|
|
2265
2283
|
if (e.length > 0)
|
|
@@ -2269,30 +2287,30 @@ ${e.join(`
|
|
|
2269
2287
|
|
|
2270
2288
|
`)}`);
|
|
2271
2289
|
}
|
|
2272
|
-
function
|
|
2290
|
+
function ki(t, e) {
|
|
2273
2291
|
const i = t.name, n = t.constructor.dependencies ?? [];
|
|
2274
2292
|
for (const r of n) {
|
|
2275
2293
|
const s = r.name, l = r.required ?? !0, a = r.reason;
|
|
2276
|
-
if (!e.some((
|
|
2277
|
-
const
|
|
2294
|
+
if (!e.some((h) => h.name === s)) {
|
|
2295
|
+
const h = a ?? `${D(i)}Plugin requires ${D(s)}Plugin`, f = be(s);
|
|
2278
2296
|
if (l)
|
|
2279
2297
|
throw new Error(
|
|
2280
2298
|
`[tbw-grid] Plugin dependency error:
|
|
2281
2299
|
|
|
2282
|
-
${
|
|
2300
|
+
${h}.
|
|
2283
2301
|
|
|
2284
|
-
→ Add the plugin to your gridConfig.plugins array BEFORE ${
|
|
2302
|
+
→ Add the plugin to your gridConfig.plugins array BEFORE ${D(i)}Plugin:
|
|
2285
2303
|
${f}
|
|
2286
|
-
plugins: [new ${
|
|
2304
|
+
plugins: [new ${D(s)}Plugin(), new ${D(i)}Plugin()]`
|
|
2287
2305
|
);
|
|
2288
2306
|
console.info(
|
|
2289
|
-
`[tbw-grid] ${
|
|
2307
|
+
`[tbw-grid] ${D(i)}Plugin: Optional "${s}" plugin not found. Some features may be unavailable.`
|
|
2290
2308
|
);
|
|
2291
2309
|
}
|
|
2292
2310
|
}
|
|
2293
2311
|
}
|
|
2294
|
-
function
|
|
2295
|
-
if (!
|
|
2312
|
+
function Ni(t) {
|
|
2313
|
+
if (!ve()) return;
|
|
2296
2314
|
const e = new Set(t.map((o) => o.name)), i = /* @__PURE__ */ new Set();
|
|
2297
2315
|
for (const o of t) {
|
|
2298
2316
|
const r = o.constructor.manifest;
|
|
@@ -2304,7 +2322,7 @@ function Oi(t) {
|
|
|
2304
2322
|
i.add(l), console.warn(
|
|
2305
2323
|
`[tbw-grid] Plugin incompatibility warning:
|
|
2306
2324
|
|
|
2307
|
-
${
|
|
2325
|
+
${D(o.name)}Plugin and ${D(s.name)}Plugin are both loaded, but they are currently incompatible.
|
|
2308
2326
|
|
|
2309
2327
|
→ ${s.reason}
|
|
2310
2328
|
|
|
@@ -2314,31 +2332,31 @@ ${z(o.name)}Plugin and ${z(s.name)}Plugin are both loaded, but they are currentl
|
|
|
2314
2332
|
}
|
|
2315
2333
|
}
|
|
2316
2334
|
}
|
|
2317
|
-
function
|
|
2335
|
+
function at(t, e) {
|
|
2318
2336
|
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
2337
|
}
|
|
2320
|
-
function
|
|
2321
|
-
const o =
|
|
2338
|
+
function Ii(t, e, i) {
|
|
2339
|
+
const o = at(e, i);
|
|
2322
2340
|
if (typeof o == "string")
|
|
2323
2341
|
return t.byKey.get(o);
|
|
2324
2342
|
if (o && typeof o == "object")
|
|
2325
2343
|
return t.byRef.get(o);
|
|
2326
2344
|
}
|
|
2327
|
-
function
|
|
2328
|
-
const n =
|
|
2345
|
+
function qi(t, e, i, o) {
|
|
2346
|
+
const n = at(e, o);
|
|
2329
2347
|
typeof n == "string" ? t.byKey.set(n, i) : n && typeof n == "object" && t.byRef.set(n, i);
|
|
2330
2348
|
}
|
|
2331
|
-
function
|
|
2349
|
+
function $i(t, e, i, o, n) {
|
|
2332
2350
|
const r = new Array(t.length);
|
|
2333
2351
|
let s = 0;
|
|
2334
2352
|
for (let l = 0; l < t.length; l++) {
|
|
2335
2353
|
const a = t[l];
|
|
2336
|
-
let c = n?.(a, l),
|
|
2337
|
-
c === void 0 && (c =
|
|
2354
|
+
let c = n?.(a, l), h = c !== void 0;
|
|
2355
|
+
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
2356
|
}
|
|
2339
2357
|
return r;
|
|
2340
2358
|
}
|
|
2341
|
-
function
|
|
2359
|
+
function me(t, e, i) {
|
|
2342
2360
|
if (e < 0 || e >= t.length) return;
|
|
2343
2361
|
const o = t[e], n = i - o.height;
|
|
2344
2362
|
if (n !== 0) {
|
|
@@ -2347,12 +2365,12 @@ function be(t, e, i) {
|
|
|
2347
2365
|
t[r].offset += n;
|
|
2348
2366
|
}
|
|
2349
2367
|
}
|
|
2350
|
-
function
|
|
2368
|
+
function Wi(t) {
|
|
2351
2369
|
if (t.length === 0) return 0;
|
|
2352
2370
|
const e = t[t.length - 1];
|
|
2353
2371
|
return e.offset + e.height;
|
|
2354
2372
|
}
|
|
2355
|
-
function
|
|
2373
|
+
function Ve(t, e) {
|
|
2356
2374
|
if (t.length === 0) return -1;
|
|
2357
2375
|
if (e <= 0) return 0;
|
|
2358
2376
|
let i = 0, o = t.length - 1;
|
|
@@ -2367,42 +2385,42 @@ function Fe(t, e) {
|
|
|
2367
2385
|
}
|
|
2368
2386
|
return Math.max(0, Math.min(i, t.length - 1));
|
|
2369
2387
|
}
|
|
2370
|
-
function
|
|
2388
|
+
function Fi(t, e) {
|
|
2371
2389
|
let i = 0, o = 0;
|
|
2372
2390
|
for (const n of t)
|
|
2373
2391
|
n.measured && (i += n.height, o++);
|
|
2374
2392
|
return o > 0 ? i / o : e;
|
|
2375
2393
|
}
|
|
2376
|
-
function
|
|
2394
|
+
function Ui(t) {
|
|
2377
2395
|
let e = 0;
|
|
2378
2396
|
for (const i of t)
|
|
2379
2397
|
i.measured && e++;
|
|
2380
2398
|
return e;
|
|
2381
2399
|
}
|
|
2382
|
-
function
|
|
2400
|
+
function Vi(t, e) {
|
|
2383
2401
|
const { positionCache: i, heightCache: o, rows: n, start: r, end: s, getPluginHeight: l, getRowId: a } = t;
|
|
2384
2402
|
let c = !1;
|
|
2385
|
-
e.forEach((
|
|
2386
|
-
const g =
|
|
2403
|
+
e.forEach((p) => {
|
|
2404
|
+
const g = p.dataset.rowIndex;
|
|
2387
2405
|
if (!g) return;
|
|
2388
|
-
const
|
|
2389
|
-
if (
|
|
2390
|
-
const
|
|
2406
|
+
const u = parseInt(g, 10);
|
|
2407
|
+
if (u < r || u >= s || u >= n.length) return;
|
|
2408
|
+
const d = n[u], w = l?.(d, u);
|
|
2391
2409
|
if (w !== void 0) {
|
|
2392
|
-
const
|
|
2393
|
-
(!
|
|
2410
|
+
const b = i[u];
|
|
2411
|
+
(!b.measured || Math.abs(b.height - w) > 1) && (me(i, u, w), c = !0);
|
|
2394
2412
|
return;
|
|
2395
2413
|
}
|
|
2396
|
-
const
|
|
2397
|
-
if (
|
|
2398
|
-
const
|
|
2399
|
-
(!
|
|
2414
|
+
const v = p.offsetHeight;
|
|
2415
|
+
if (v > 0) {
|
|
2416
|
+
const b = i[u];
|
|
2417
|
+
(!b.measured || Math.abs(b.height - v) > 1) && (me(i, u, v), qi(o, d, v, a), c = !0);
|
|
2400
2418
|
}
|
|
2401
2419
|
});
|
|
2402
|
-
const
|
|
2403
|
-
return { hasChanges: c, measuredCount:
|
|
2420
|
+
const h = c ? Ui(i) : 0, f = c ? Fi(i, t.defaultHeight) : 0;
|
|
2421
|
+
return { hasChanges: c, measuredCount: h, averageHeight: f };
|
|
2404
2422
|
}
|
|
2405
|
-
function
|
|
2423
|
+
function Bi(t, e, i, o) {
|
|
2406
2424
|
let n = 0, r = 0;
|
|
2407
2425
|
for (let s = 0; s < t.length; s++) {
|
|
2408
2426
|
const l = t[s];
|
|
@@ -2413,7 +2431,7 @@ function Fi(t, e, i, o) {
|
|
|
2413
2431
|
averageHeight: n > 0 ? r / n : i
|
|
2414
2432
|
};
|
|
2415
2433
|
}
|
|
2416
|
-
function
|
|
2434
|
+
function no(t) {
|
|
2417
2435
|
const { totalRows: e, viewportHeight: i, scrollTop: o, rowHeight: n, overscan: r } = t, s = Math.ceil(i / n);
|
|
2418
2436
|
let l = Math.floor(o / n) - r;
|
|
2419
2437
|
l < 0 && (l = 0);
|
|
@@ -2425,10 +2443,10 @@ function to(t) {
|
|
|
2425
2443
|
totalHeight: e * n
|
|
2426
2444
|
};
|
|
2427
2445
|
}
|
|
2428
|
-
function
|
|
2446
|
+
function ro(t, e) {
|
|
2429
2447
|
return t <= e;
|
|
2430
2448
|
}
|
|
2431
|
-
class
|
|
2449
|
+
class ne {
|
|
2432
2450
|
constructor(e) {
|
|
2433
2451
|
this.grid = e;
|
|
2434
2452
|
}
|
|
@@ -2448,7 +2466,7 @@ class oe {
|
|
|
2448
2466
|
this.attach(i);
|
|
2449
2467
|
}
|
|
2450
2468
|
attach(e) {
|
|
2451
|
-
if (
|
|
2469
|
+
if (ki(e, this.plugins), this.pluginMap.set(e.constructor, e), this.plugins.push(e), e.cellRenderers)
|
|
2452
2470
|
for (const [i, o] of Object.entries(e.cellRenderers))
|
|
2453
2471
|
this.cellRenderers.set(i, o);
|
|
2454
2472
|
if (e.headerRenderers)
|
|
@@ -2471,9 +2489,9 @@ class oe {
|
|
|
2471
2489
|
}
|
|
2472
2490
|
warnDeprecatedHooks(e) {
|
|
2473
2491
|
const i = e.constructor;
|
|
2474
|
-
if (
|
|
2492
|
+
if (ne.deprecationWarned.has(i) || !ve()) return;
|
|
2475
2493
|
const o = typeof e.getExtraHeight == "function" || typeof e.getExtraHeightBefore == "function", n = typeof e.getRowHeight == "function";
|
|
2476
|
-
o && !n && (
|
|
2494
|
+
o && !n && (ne.deprecationWarned.add(i), console.warn(
|
|
2477
2495
|
`[tbw-grid] Deprecation warning: "${e.name}" uses getExtraHeight() / getExtraHeightBefore() which are deprecated and will be removed in v3.0.
|
|
2478
2496
|
→ Migrate to getRowHeight(row, index) for better variable row height support.
|
|
2479
2497
|
→ See: https://toolbox-web.dev/docs/grid/plugins/migration#row-height-hooks`
|
|
@@ -2713,7 +2731,7 @@ class oe {
|
|
|
2713
2731
|
return e.sort((i, o) => (i.content.order ?? 0) - (o.content.order ?? 0));
|
|
2714
2732
|
}
|
|
2715
2733
|
}
|
|
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 = `/**
|
|
2734
|
+
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
2735
|
* tbw-grid Light DOM Styles
|
|
2718
2736
|
*
|
|
2719
2737
|
* This stylesheet uses CSS nesting to scope all styles to the tbw-grid element.
|
|
@@ -2732,19 +2750,19 @@ const Ui = "@layer tbw-base{tbw-grid{.tbw-expanding{animation:tbw-expand var(--t
|
|
|
2732
2750
|
/* Declare layer order - earlier layers have lower priority */
|
|
2733
2751
|
@layer tbw-base, tbw-plugins, tbw-theme;
|
|
2734
2752
|
|
|
2735
|
-
${
|
|
2736
|
-
${
|
|
2737
|
-
${Bi}
|
|
2753
|
+
${eo}
|
|
2754
|
+
${Xi}
|
|
2738
2755
|
${Yi}
|
|
2756
|
+
${Qi}
|
|
2757
|
+
${Zi}
|
|
2758
|
+
${Ji}
|
|
2739
2759
|
${ji}
|
|
2740
|
-
${Ki}
|
|
2741
2760
|
${Gi}
|
|
2742
|
-
${
|
|
2743
|
-
${Xi}
|
|
2761
|
+
${Ki}
|
|
2744
2762
|
`;
|
|
2745
2763
|
class k extends HTMLElement {
|
|
2746
2764
|
static tagName = "tbw-grid";
|
|
2747
|
-
static version = "1.
|
|
2765
|
+
static version = "1.16.1";
|
|
2748
2766
|
static #l = 0;
|
|
2749
2767
|
static adapters = [];
|
|
2750
2768
|
static registerAdapter(e) {
|
|
@@ -2784,7 +2802,7 @@ class k extends HTMLElement {
|
|
|
2784
2802
|
#x = !1;
|
|
2785
2803
|
#m = 0;
|
|
2786
2804
|
#z;
|
|
2787
|
-
#N =
|
|
2805
|
+
#N = Si();
|
|
2788
2806
|
#b;
|
|
2789
2807
|
#y;
|
|
2790
2808
|
#p;
|
|
@@ -2804,7 +2822,7 @@ class k extends HTMLElement {
|
|
|
2804
2822
|
#V;
|
|
2805
2823
|
#O;
|
|
2806
2824
|
#t;
|
|
2807
|
-
#i =
|
|
2825
|
+
#i = hi();
|
|
2808
2826
|
#c;
|
|
2809
2827
|
#q;
|
|
2810
2828
|
#M = !1;
|
|
@@ -2941,28 +2959,28 @@ class k extends HTMLElement {
|
|
|
2941
2959
|
return this.#b || (this.#b = new AbortController()), this.#b.signal;
|
|
2942
2960
|
}
|
|
2943
2961
|
constructor() {
|
|
2944
|
-
super(), this.#be(), this.#d = new Promise((e) => this.#h = e), this.#s = new
|
|
2962
|
+
super(), this.#be(), this.#d = new Promise((e) => this.#h = e), this.#s = new ti({
|
|
2945
2963
|
mergeConfig: () => {
|
|
2946
|
-
this.#t.parseLightDomColumns(this), this.#t.merge(), this.#te(),
|
|
2964
|
+
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
2965
|
},
|
|
2948
2966
|
processColumns: () => this.#xe(),
|
|
2949
2967
|
processRows: () => this.#Le(),
|
|
2950
|
-
renderHeader: () =>
|
|
2951
|
-
updateTemplate: () =>
|
|
2968
|
+
renderHeader: () => oe(this),
|
|
2969
|
+
updateTemplate: () => V(this),
|
|
2952
2970
|
renderVirtualWindow: () => this.refreshVirtualWindow(!0, !0),
|
|
2953
2971
|
afterRender: () => {
|
|
2954
2972
|
this.#e?.afterRender(), this._virtualization.enabled && this._virtualization.totalHeightEl && queueMicrotask(() => {
|
|
2955
2973
|
if (!this._virtualization.totalHeightEl) return;
|
|
2956
2974
|
const i = this.#T(this._rows.length);
|
|
2957
2975
|
this._virtualization.totalHeightEl.style.height = `${i}px`;
|
|
2958
|
-
}), this.#o.fitMode === "fixed" && !this.__didInitialAutoSize && (this.__didInitialAutoSize = !0,
|
|
2976
|
+
}), 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
2977
|
requestAnimationFrame(() => {
|
|
2960
2978
|
this.#ve();
|
|
2961
2979
|
});
|
|
2962
2980
|
})), this.#M && this.#he();
|
|
2963
2981
|
},
|
|
2964
2982
|
isConnected: () => this.isConnected && this.#f
|
|
2965
|
-
}), this.#s.setInitialReadyResolver(() => this.#h?.()), this.#c =
|
|
2983
|
+
}), this.#s.setInitialReadyResolver(() => this.#h?.()), this.#c = bi(this.#i, {
|
|
2966
2984
|
getShadow: () => this.#n,
|
|
2967
2985
|
getShellConfig: () => this.#o?.shell,
|
|
2968
2986
|
getAccordionIcons: () => ({
|
|
@@ -2971,23 +2989,23 @@ class k extends HTMLElement {
|
|
|
2971
2989
|
}),
|
|
2972
2990
|
emit: (e, i) => this.#L(e, i),
|
|
2973
2991
|
refreshShellHeader: () => this.refreshShellHeader()
|
|
2974
|
-
}), this.#t = new
|
|
2992
|
+
}), this.#t = new Lt({
|
|
2975
2993
|
getRows: () => this.#a,
|
|
2976
2994
|
getSortState: () => this._sortState,
|
|
2977
2995
|
setSortState: (e) => {
|
|
2978
2996
|
this._sortState = e;
|
|
2979
2997
|
},
|
|
2980
2998
|
onConfigChange: () => {
|
|
2981
|
-
this.#s.requestPhase(
|
|
2999
|
+
this.#s.requestPhase(A.FULL, "configChange");
|
|
2982
3000
|
},
|
|
2983
3001
|
emit: (e, i) => this.#L(e, i),
|
|
2984
3002
|
clearRowPool: () => {
|
|
2985
3003
|
this._rowPool.length = 0, this._bodyEl && (this._bodyEl.innerHTML = ""), this.__rowRenderEpoch++;
|
|
2986
3004
|
},
|
|
2987
3005
|
setup: () => this.#P(),
|
|
2988
|
-
renderHeader: () =>
|
|
2989
|
-
updateTemplate: () =>
|
|
2990
|
-
refreshVirtualWindow: () => this.#s.requestPhase(
|
|
3006
|
+
renderHeader: () => oe(this),
|
|
3007
|
+
updateTemplate: () => V(this),
|
|
3008
|
+
refreshVirtualWindow: () => this.#s.requestPhase(A.VIRTUALIZATION, "configManager"),
|
|
2991
3009
|
getVirtualization: () => this._virtualization,
|
|
2992
3010
|
setRowHeight: (e) => {
|
|
2993
3011
|
this._virtualization.rowHeight = e;
|
|
@@ -3002,7 +3020,7 @@ class k extends HTMLElement {
|
|
|
3002
3020
|
});
|
|
3003
3021
|
}
|
|
3004
3022
|
async #be() {
|
|
3005
|
-
await
|
|
3023
|
+
await Ei(to);
|
|
3006
3024
|
}
|
|
3007
3025
|
getPlugin(e) {
|
|
3008
3026
|
return this.#e?.getPlugin(e);
|
|
@@ -3011,28 +3029,28 @@ class k extends HTMLElement {
|
|
|
3011
3029
|
return this.#e?.getPluginByName(e);
|
|
3012
3030
|
}
|
|
3013
3031
|
requestRender() {
|
|
3014
|
-
this.#s.requestPhase(
|
|
3032
|
+
this.#s.requestPhase(A.ROWS, "plugin:requestRender");
|
|
3015
3033
|
}
|
|
3016
3034
|
requestColumnsRender() {
|
|
3017
|
-
this.#s.requestPhase(
|
|
3035
|
+
this.#s.requestPhase(A.COLUMNS, "plugin:requestColumnsRender");
|
|
3018
3036
|
}
|
|
3019
3037
|
requestRenderWithFocus() {
|
|
3020
|
-
this._restoreFocusAfterRender = !0, this.#s.requestPhase(
|
|
3038
|
+
this._restoreFocusAfterRender = !0, this.#s.requestPhase(A.ROWS, "plugin:requestRenderWithFocus");
|
|
3021
3039
|
}
|
|
3022
3040
|
updateTemplate() {
|
|
3023
|
-
|
|
3041
|
+
V(this);
|
|
3024
3042
|
}
|
|
3025
3043
|
requestAfterRender() {
|
|
3026
|
-
this.#s.requestPhase(
|
|
3044
|
+
this.#s.requestPhase(A.STYLE, "plugin:requestAfterRender");
|
|
3027
3045
|
}
|
|
3028
3046
|
#ee() {
|
|
3029
|
-
this.#e = new
|
|
3047
|
+
this.#e = new ne(this);
|
|
3030
3048
|
const e = this.#o?.plugins, i = Array.isArray(e) ? e : [];
|
|
3031
3049
|
this.#e.attachAll(i);
|
|
3032
3050
|
}
|
|
3033
3051
|
#W() {
|
|
3034
3052
|
const e = this.#e?.getPluginStyles() ?? [];
|
|
3035
|
-
|
|
3053
|
+
yi(e);
|
|
3036
3054
|
}
|
|
3037
3055
|
#te() {
|
|
3038
3056
|
const e = this.#o?.plugins, i = Array.isArray(e) ? e : [];
|
|
@@ -3090,9 +3108,9 @@ class k extends HTMLElement {
|
|
|
3090
3108
|
};
|
|
3091
3109
|
}
|
|
3092
3110
|
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 && (
|
|
3111
|
+
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
3112
|
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 =
|
|
3113
|
+
this.#_ = Array.isArray(e) ? e : [], this.#ie(), this.#u || (this.#Z(), this.#W(), this.#u = !0), this.#ne(), this.#S = Xt(
|
|
3096
3114
|
() => {
|
|
3097
3115
|
this.#ke();
|
|
3098
3116
|
},
|
|
@@ -3100,7 +3118,7 @@ class k extends HTMLElement {
|
|
|
3100
3118
|
);
|
|
3101
3119
|
}
|
|
3102
3120
|
disconnectedCallback() {
|
|
3103
|
-
this.#S && (
|
|
3121
|
+
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
3122
|
for (const e of this._rowPool)
|
|
3105
3123
|
e.remove();
|
|
3106
3124
|
this._rowPool.length = 0, this.__rowsBodyEl = null, this.#f = !1;
|
|
@@ -3124,15 +3142,15 @@ class k extends HTMLElement {
|
|
|
3124
3142
|
#ne() {
|
|
3125
3143
|
const i = this.#n.querySelector(".tbw-grid-content") ?? this.#n.querySelector(".tbw-grid-root");
|
|
3126
3144
|
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
|
-
|
|
3145
|
+
ge(this.#n, this.#i), de(this.#n, this.#o?.shell, this.#i);
|
|
3128
3146
|
const n = this.#o?.shell?.toolPanel?.defaultOpen;
|
|
3129
3147
|
n && this.#i.toolPanels.has(n) && (this.openToolPanel(), this.#i.expandedSections.add(n));
|
|
3130
3148
|
}
|
|
3131
|
-
if (this.setAttribute("data-upgraded", ""), this.#f = !0, this._resizeController =
|
|
3149
|
+
if (this.setAttribute("data-upgraded", ""), this.#f = !0, this._resizeController = Me(this), this.#P(), this.#G(i), this.#I)
|
|
3132
3150
|
return;
|
|
3133
3151
|
this.#I = !0;
|
|
3134
3152
|
const o = this.disconnectSignal;
|
|
3135
|
-
|
|
3153
|
+
Ft(this, this, this.#n, o), this.#re(), queueMicrotask(() => this.#ye()), this.#s.requestPhase(A.FULL, "afterConnect");
|
|
3136
3154
|
}
|
|
3137
3155
|
#re() {
|
|
3138
3156
|
const e = this.#o.rowHeight, i = this.#e.hasRowHeightPlugin();
|
|
@@ -3150,7 +3168,7 @@ class k extends HTMLElement {
|
|
|
3150
3168
|
l > o && (o = l);
|
|
3151
3169
|
});
|
|
3152
3170
|
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(
|
|
3171
|
+
r > 0 && Math.abs(r - this._virtualization.rowHeight) > 1 && (this._virtualization.rowHeight = r, this.#s.requestPhase(A.VIRTUALIZATION, "measureRowHeight"));
|
|
3154
3172
|
}
|
|
3155
3173
|
#ve() {
|
|
3156
3174
|
const e = this._bodyEl?.querySelector(".data-grid-row");
|
|
@@ -3179,15 +3197,15 @@ class k extends HTMLElement {
|
|
|
3179
3197
|
if (this._rows.length <= this._virtualization.bypassThreshold)
|
|
3180
3198
|
n.style.transform = `translateY(${-a}px)`;
|
|
3181
3199
|
else {
|
|
3182
|
-
const
|
|
3183
|
-
let f,
|
|
3184
|
-
if (this._virtualization.variableHeights &&
|
|
3185
|
-
f =
|
|
3186
|
-
const
|
|
3187
|
-
|
|
3200
|
+
const h = this._virtualization.positionCache;
|
|
3201
|
+
let f, p;
|
|
3202
|
+
if (this._virtualization.variableHeights && h && h.length > 0) {
|
|
3203
|
+
f = Ve(h, a), f === -1 && (f = 0);
|
|
3204
|
+
const u = f - f % 2;
|
|
3205
|
+
p = h[u]?.offset ?? u * c;
|
|
3188
3206
|
} else
|
|
3189
|
-
f = Math.floor(a / c),
|
|
3190
|
-
const g = -(a -
|
|
3207
|
+
f = Math.floor(a / c), p = (f - f % 2) * c;
|
|
3208
|
+
const g = -(a - p);
|
|
3191
3209
|
n.style.transform = `translateY(${g}px)`;
|
|
3192
3210
|
}
|
|
3193
3211
|
this.#r = a, this.#C || (this.#C = requestAnimationFrame(() => {
|
|
@@ -3211,23 +3229,23 @@ class k extends HTMLElement {
|
|
|
3211
3229
|
(a) => {
|
|
3212
3230
|
const c = a.shiftKey || Math.abs(a.deltaX) > Math.abs(a.deltaY);
|
|
3213
3231
|
if (c && l) {
|
|
3214
|
-
const
|
|
3215
|
-
(
|
|
3232
|
+
const h = a.shiftKey ? a.deltaY : a.deltaX, { scrollLeft: f, scrollWidth: p, clientWidth: g } = l;
|
|
3233
|
+
(h > 0 && f < p - g || h < 0 && f > 0) && (a.preventDefault(), l.scrollLeft += h);
|
|
3216
3234
|
} else if (!c) {
|
|
3217
|
-
const { scrollTop:
|
|
3218
|
-
(a.deltaY > 0 &&
|
|
3235
|
+
const { scrollTop: h, scrollHeight: f, clientHeight: p } = o;
|
|
3236
|
+
(a.deltaY > 0 && h < f - p || a.deltaY < 0 && h > 0) && (a.preventDefault(), o.scrollTop += a.deltaY);
|
|
3219
3237
|
}
|
|
3220
3238
|
},
|
|
3221
3239
|
{ passive: !1, signal: i }
|
|
3222
|
-
),
|
|
3240
|
+
), Li(
|
|
3223
3241
|
s,
|
|
3224
3242
|
this.#N,
|
|
3225
3243
|
{ fauxScrollbar: o, scrollArea: l },
|
|
3226
3244
|
i
|
|
3227
3245
|
));
|
|
3228
3246
|
}
|
|
3229
|
-
this._bodyEl &&
|
|
3230
|
-
this.#Ne(), this.#s.requestPhase(
|
|
3247
|
+
this._bodyEl && Wt(this, this._bodyEl, i), this.#y?.disconnect(), this._virtualization.viewportEl && (this.#y = new ResizeObserver(() => {
|
|
3248
|
+
this.#Ne(), this.#s.requestPhase(A.VIRTUALIZATION, "resize-observer");
|
|
3231
3249
|
}), this.#y.observe(this._virtualization.viewportEl)), this.#n.addEventListener(
|
|
3232
3250
|
"focusin",
|
|
3233
3251
|
() => {
|
|
@@ -3289,7 +3307,7 @@ class k extends HTMLElement {
|
|
|
3289
3307
|
e.columns && this.#Se(), e.rows && this.#le(), e.fitMode && this.#Re();
|
|
3290
3308
|
}
|
|
3291
3309
|
#le() {
|
|
3292
|
-
this._rows = Array.isArray(this.#a) ? [...this.#a] : [], this.#X(), this.#s.requestPhase(
|
|
3310
|
+
this._rows = Array.isArray(this.#a) ? [...this.#a] : [], this.#X(), this.#s.requestPhase(A.ROWS, "applyRowsUpdate");
|
|
3293
3311
|
}
|
|
3294
3312
|
#X() {
|
|
3295
3313
|
this.#R.clear();
|
|
@@ -3315,23 +3333,23 @@ class k extends HTMLElement {
|
|
|
3315
3333
|
return o;
|
|
3316
3334
|
}
|
|
3317
3335
|
#Se() {
|
|
3318
|
-
|
|
3336
|
+
Y(this), this.#t.merge(), this.#P();
|
|
3319
3337
|
}
|
|
3320
3338
|
#Re() {
|
|
3321
|
-
this.#t.merge(), this.#o.fitMode === "fixed" ? (this.__didInitialAutoSize = !1,
|
|
3339
|
+
this.#t.merge(), this.#o.fitMode === "fixed" ? (this.__didInitialAutoSize = !1, Re(this)) : (this._columns.forEach((i) => {
|
|
3322
3340
|
!i.__userResized && i.__autoSized && delete i.width;
|
|
3323
|
-
}),
|
|
3341
|
+
}), V(this));
|
|
3324
3342
|
}
|
|
3325
3343
|
#Ae() {
|
|
3326
|
-
|
|
3344
|
+
Ne(this, this.#i), Ie(this, this.#i);
|
|
3327
3345
|
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 =
|
|
3346
|
+
this.#t.parseLightDomColumns(this), this.#t.merge(), this.#te(), qe(this, this.#i, this.#oe()), this.#t.markSourcesChanged(), this.#t.merge();
|
|
3347
|
+
const n = st(this.#o?.shell), r = (this.#o?.shell?.toolPanels?.length ?? 0) > 0, s = this.#o?.shell?.toolPanels?.length ?? 0;
|
|
3330
3348
|
if (e !== n || !i && r || i && s !== o) {
|
|
3331
|
-
|
|
3349
|
+
he(this.#i), this.#Z(), this.#W(), this.#ne(), this.#X();
|
|
3332
3350
|
return;
|
|
3333
3351
|
}
|
|
3334
|
-
e && this.#Te(), this.#X(), this.#s.requestPhase(
|
|
3352
|
+
e && this.#Te(), this.#X(), this.#s.requestPhase(A.COLUMNS, "applyGridConfigUpdate");
|
|
3335
3353
|
}
|
|
3336
3354
|
#Te() {
|
|
3337
3355
|
const e = this.#n.querySelector(".tbw-shell-header");
|
|
@@ -3370,39 +3388,39 @@ class k extends HTMLElement {
|
|
|
3370
3388
|
return l.push(...s), l;
|
|
3371
3389
|
}
|
|
3372
3390
|
#Le() {
|
|
3373
|
-
|
|
3391
|
+
Y(this);
|
|
3374
3392
|
const e = Array.isArray(this.#a) ? [...this.#a] : [], i = this.#e?.processRows(e) ?? e;
|
|
3375
3393
|
this._rows = i, this._virtualization.variableHeights && this.#Q();
|
|
3376
3394
|
}
|
|
3377
3395
|
#Pe(e) {
|
|
3378
3396
|
const i = {
|
|
3379
|
-
...
|
|
3397
|
+
...ft,
|
|
3380
3398
|
...e.animation
|
|
3381
3399
|
}, o = i.mode ?? "reduced-motion";
|
|
3382
3400
|
let n = 1;
|
|
3383
3401
|
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
3402
|
}
|
|
3385
3403
|
#Y(e, i, o = this.__rowRenderEpoch) {
|
|
3386
|
-
if (this.#z || (this.#z = (n, r, s) => this.#e?.renderRow(n, r, s) ?? !1),
|
|
3404
|
+
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
3405
|
for (const n of this.#E)
|
|
3388
3406
|
this.#j(n, !0);
|
|
3389
3407
|
}
|
|
3390
|
-
#ce =
|
|
3408
|
+
#ce = ct();
|
|
3391
3409
|
#de(e, i) {
|
|
3392
|
-
|
|
3410
|
+
dt(this.#ce, this.__rowsBodyEl, this._bodyEl, e, i);
|
|
3393
3411
|
}
|
|
3394
3412
|
#ze() {
|
|
3395
|
-
|
|
3413
|
+
ut(this.#ce, this.__rowsBodyEl, this.#o, this.#i);
|
|
3396
3414
|
}
|
|
3397
3415
|
#he() {
|
|
3398
3416
|
const e = this.querySelector(".tbw-grid-root");
|
|
3399
|
-
e && (this.#M ? (this.#$ || (this.#$ =
|
|
3417
|
+
e && (this.#M ? (this.#$ || (this.#$ = Kt(this.#o?.loadingRenderer)), Qt(e, this.#$)) : Zt(this.#$));
|
|
3400
3418
|
}
|
|
3401
3419
|
#j(e, i) {
|
|
3402
3420
|
const o = this.#R.get(e);
|
|
3403
3421
|
if (!o) return;
|
|
3404
3422
|
const n = this.findRenderedRowElement?.(o.index);
|
|
3405
|
-
n &&
|
|
3423
|
+
n && Jt(n, i);
|
|
3406
3424
|
}
|
|
3407
3425
|
#ue(e, i, o) {
|
|
3408
3426
|
const n = this.#R.get(e);
|
|
@@ -3412,7 +3430,7 @@ class k extends HTMLElement {
|
|
|
3412
3430
|
const s = this._visibleColumns.findIndex((a) => a.field === i);
|
|
3413
3431
|
if (s < 0) return;
|
|
3414
3432
|
const l = r.children[s];
|
|
3415
|
-
l &&
|
|
3433
|
+
l && ei(l, o);
|
|
3416
3434
|
}
|
|
3417
3435
|
#P() {
|
|
3418
3436
|
if (this.isConnected && !(!this._headerRowEl || !this._bodyEl)) {
|
|
@@ -3422,7 +3440,7 @@ class k extends HTMLElement {
|
|
|
3422
3440
|
const i = this.#e?.getAll() ?? [];
|
|
3423
3441
|
this.#t.applyState(e, i);
|
|
3424
3442
|
}
|
|
3425
|
-
this._bodyEl && (this._bodyEl.style.display = "", this._bodyEl.style.gridTemplateColumns = ""), this.#s.requestPhase(
|
|
3443
|
+
this._bodyEl && (this._bodyEl.style.display = "", this._bodyEl.style.gridTemplateColumns = ""), this.#s.requestPhase(A.FULL, "setup");
|
|
3426
3444
|
}
|
|
3427
3445
|
}
|
|
3428
3446
|
#De(e) {
|
|
@@ -3467,7 +3485,7 @@ class k extends HTMLElement {
|
|
|
3467
3485
|
});
|
|
3468
3486
|
if (this.dispatchEvent(c), c.defaultPrevented)
|
|
3469
3487
|
return !0;
|
|
3470
|
-
const
|
|
3488
|
+
const h = {
|
|
3471
3489
|
row: r,
|
|
3472
3490
|
rowIndex: i,
|
|
3473
3491
|
colIndex: o,
|
|
@@ -3475,8 +3493,8 @@ class k extends HTMLElement {
|
|
|
3475
3493
|
value: a,
|
|
3476
3494
|
cellEl: n,
|
|
3477
3495
|
originalEvent: e
|
|
3478
|
-
}, f = this.#e?.onCellClick(
|
|
3479
|
-
return this.#L("cell-click",
|
|
3496
|
+
}, f = this.#e?.onCellClick(h) ?? !1;
|
|
3497
|
+
return this.#L("cell-click", h), f;
|
|
3480
3498
|
}
|
|
3481
3499
|
_dispatchRowClick(e, i, o, n) {
|
|
3482
3500
|
if (!o) return !1;
|
|
@@ -3537,7 +3555,7 @@ class k extends HTMLElement {
|
|
|
3537
3555
|
return this.#d;
|
|
3538
3556
|
}
|
|
3539
3557
|
async forceLayout() {
|
|
3540
|
-
return this.#s.requestPhase(
|
|
3558
|
+
return this.#s.requestPhase(A.FULL, "forceLayout"), this.#s.whenReady();
|
|
3541
3559
|
}
|
|
3542
3560
|
async getConfig() {
|
|
3543
3561
|
return Object.freeze({ ...this.#o || {} });
|
|
@@ -3556,21 +3574,21 @@ class k extends HTMLElement {
|
|
|
3556
3574
|
);
|
|
3557
3575
|
const { row: r, index: s } = n, l = [];
|
|
3558
3576
|
for (const [a, c] of Object.entries(i)) {
|
|
3559
|
-
const
|
|
3560
|
-
|
|
3577
|
+
const h = r[a];
|
|
3578
|
+
h !== c && (l.push({ field: a, oldValue: h, newValue: c }), r[a] = c);
|
|
3561
3579
|
}
|
|
3562
|
-
for (const { field: a, oldValue: c, newValue:
|
|
3580
|
+
for (const { field: a, oldValue: c, newValue: h } of l)
|
|
3563
3581
|
this.#L("cell-change", {
|
|
3564
3582
|
row: r,
|
|
3565
3583
|
rowId: e,
|
|
3566
3584
|
rowIndex: s,
|
|
3567
3585
|
field: a,
|
|
3568
3586
|
oldValue: c,
|
|
3569
|
-
newValue:
|
|
3587
|
+
newValue: h,
|
|
3570
3588
|
changes: i,
|
|
3571
3589
|
source: o
|
|
3572
3590
|
});
|
|
3573
|
-
l.length > 0 && this.#s.requestPhase(
|
|
3591
|
+
l.length > 0 && this.#s.requestPhase(A.ROWS, "updateRow");
|
|
3574
3592
|
}
|
|
3575
3593
|
updateRows(e, i = "api") {
|
|
3576
3594
|
let o = !1;
|
|
@@ -3581,30 +3599,30 @@ class k extends HTMLElement {
|
|
|
3581
3599
|
`[tbw-grid] Row with ID "${n}" not found. Ensure the row exists and getRowId is correctly configured.`
|
|
3582
3600
|
);
|
|
3583
3601
|
const { row: l, index: a } = s;
|
|
3584
|
-
for (const [c,
|
|
3602
|
+
for (const [c, h] of Object.entries(r)) {
|
|
3585
3603
|
const f = l[c];
|
|
3586
|
-
f !==
|
|
3604
|
+
f !== h && (o = !0, l[c] = h, this.#L("cell-change", {
|
|
3587
3605
|
row: l,
|
|
3588
3606
|
rowId: n,
|
|
3589
3607
|
rowIndex: a,
|
|
3590
3608
|
field: c,
|
|
3591
3609
|
oldValue: f,
|
|
3592
|
-
newValue:
|
|
3610
|
+
newValue: h,
|
|
3593
3611
|
changes: r,
|
|
3594
3612
|
source: i
|
|
3595
3613
|
}));
|
|
3596
3614
|
}
|
|
3597
3615
|
}
|
|
3598
|
-
o && this.#s.requestPhase(
|
|
3616
|
+
o && this.#s.requestPhase(A.ROWS, "updateRows");
|
|
3599
3617
|
}
|
|
3600
3618
|
animateRow(e, i) {
|
|
3601
|
-
|
|
3619
|
+
_e(this, e, i);
|
|
3602
3620
|
}
|
|
3603
3621
|
animateRows(e, i) {
|
|
3604
|
-
|
|
3622
|
+
li(this, e, i);
|
|
3605
3623
|
}
|
|
3606
3624
|
animateRowById(e, i) {
|
|
3607
|
-
return
|
|
3625
|
+
return ai(this, e, i);
|
|
3608
3626
|
}
|
|
3609
3627
|
setColumnVisible(e, i) {
|
|
3610
3628
|
const o = this.#t.setColumnVisible(e, i);
|
|
@@ -3703,17 +3721,17 @@ class k extends HTMLElement {
|
|
|
3703
3721
|
#K = !1;
|
|
3704
3722
|
refreshShellHeader() {
|
|
3705
3723
|
this.#K || (this.#K = !0, queueMicrotask(() => {
|
|
3706
|
-
this.#K = !1, this.isConnected && (this.#k(), this.#t.markSourcesChanged(), this.#t.merge(),
|
|
3724
|
+
this.#K = !1, this.isConnected && (this.#k(), this.#t.markSourcesChanged(), this.#t.merge(), he(this.#i), this.#Z(), this.#W(), this.#Me());
|
|
3707
3725
|
}));
|
|
3708
3726
|
}
|
|
3709
3727
|
#Me() {
|
|
3710
3728
|
const i = this.#n.querySelector(".tbw-grid-content") ?? this.#n.querySelector(".tbw-grid-root");
|
|
3711
3729
|
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
|
-
|
|
3730
|
+
ge(this.#n, this.#i), de(this.#n, this.#o?.shell, this.#i);
|
|
3713
3731
|
const o = this.#o?.shell?.toolPanel?.defaultOpen;
|
|
3714
3732
|
o && this.#i.toolPanels.has(o) && (this.openToolPanel(), this.#i.expandedSections.add(o));
|
|
3715
3733
|
}
|
|
3716
|
-
this._resizeController =
|
|
3734
|
+
this._resizeController = Me(this), this.#G(i), this.#s.requestPhase(A.COLUMNS, "shellRefresh");
|
|
3717
3735
|
}
|
|
3718
3736
|
#A = /* @__PURE__ */ new Map();
|
|
3719
3737
|
registerStyles(e, i) {
|
|
@@ -3733,20 +3751,20 @@ class k extends HTMLElement {
|
|
|
3733
3751
|
document.adoptedStyleSheets = [...i, ...e];
|
|
3734
3752
|
}
|
|
3735
3753
|
#k() {
|
|
3736
|
-
|
|
3754
|
+
Ne(this, this.#i), Ie(this, this.#i), qe(this, this.#i, this.#oe());
|
|
3737
3755
|
}
|
|
3738
3756
|
#ge() {
|
|
3739
3757
|
const e = this.#n.querySelector(".tbw-shell-header");
|
|
3740
3758
|
if (!e) return;
|
|
3741
|
-
|
|
3742
|
-
const i =
|
|
3759
|
+
he(this.#i);
|
|
3760
|
+
const i = ui(
|
|
3743
3761
|
this.#o.shell,
|
|
3744
3762
|
this.#i,
|
|
3745
3763
|
this.#o.icons?.toolPanel
|
|
3746
3764
|
), o = document.createElement("div");
|
|
3747
3765
|
o.innerHTML = i;
|
|
3748
3766
|
const n = o.firstElementChild;
|
|
3749
|
-
n && (e.replaceWith(n), this.#we(),
|
|
3767
|
+
n && (e.replaceWith(n), this.#we(), de(this.#n, this.#o?.shell, this.#i));
|
|
3750
3768
|
}
|
|
3751
3769
|
#ke() {
|
|
3752
3770
|
const e = () => {
|
|
@@ -3760,11 +3778,11 @@ class k extends HTMLElement {
|
|
|
3760
3778
|
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
3779
|
}
|
|
3762
3780
|
refreshColumns() {
|
|
3763
|
-
this.__lightDomColumnsCache = void 0,
|
|
3781
|
+
this.__lightDomColumnsCache = void 0, Y(this), this.#t.parseLightDomColumns(this);
|
|
3764
3782
|
const e = this.#i.lightDomTitle, i = this.#i.hasToolButtonsContainer;
|
|
3765
3783
|
this.#k();
|
|
3766
3784
|
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(
|
|
3785
|
+
(o && !e || n && !i) && (this.#t.markSourcesChanged(), this.#t.merge(), this.#ge()), this.#s.requestPhase(A.COLUMNS, "refreshColumns");
|
|
3768
3786
|
}
|
|
3769
3787
|
#Ne() {
|
|
3770
3788
|
const e = this._virtualization.container, i = this._virtualization.viewportEl ?? e;
|
|
@@ -3776,18 +3794,18 @@ class k extends HTMLElement {
|
|
|
3776
3794
|
const o = this._virtualization;
|
|
3777
3795
|
let n, r, s;
|
|
3778
3796
|
if (i) {
|
|
3779
|
-
const
|
|
3780
|
-
n =
|
|
3797
|
+
const p = o.container ?? this, g = o.viewportEl ?? p, u = o.scrollAreaEl;
|
|
3798
|
+
n = p.clientHeight, r = g.clientHeight, s = u ? u.clientHeight : n, o.cachedFauxHeight = n, o.cachedViewportHeight = r, o.cachedScrollAreaHeight = s;
|
|
3781
3799
|
} else
|
|
3782
3800
|
n = o.cachedFauxHeight, r = o.cachedViewportHeight, s = o.cachedScrollAreaHeight || n;
|
|
3783
3801
|
const l = s - r, a = Math.max(0, n - s);
|
|
3784
|
-
let c,
|
|
3785
|
-
return o.variableHeights && o.positionCache ? c =
|
|
3802
|
+
let c, h = 0;
|
|
3803
|
+
return o.variableHeights && o.positionCache ? c = Wi(o.positionCache) : (c = e * o.rowHeight, h = this.#e?.getExtraHeight() ?? 0), c + l + h + a;
|
|
3786
3804
|
}
|
|
3787
3805
|
#Q() {
|
|
3788
3806
|
if (!this._virtualization.variableHeights) return;
|
|
3789
3807
|
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 =
|
|
3808
|
+
this._virtualization.positionCache = $i(
|
|
3791
3809
|
e,
|
|
3792
3810
|
this._virtualization.heightCache,
|
|
3793
3811
|
i,
|
|
@@ -3796,12 +3814,12 @@ class k extends HTMLElement {
|
|
|
3796
3814
|
const c = this.#e?.getRowHeight?.(l, a);
|
|
3797
3815
|
if (c !== void 0) return c;
|
|
3798
3816
|
if (o) {
|
|
3799
|
-
const
|
|
3800
|
-
if (
|
|
3817
|
+
const h = o(l, a);
|
|
3818
|
+
if (h !== void 0 && h > 0) return h;
|
|
3801
3819
|
}
|
|
3802
3820
|
}
|
|
3803
3821
|
);
|
|
3804
|
-
const s =
|
|
3822
|
+
const s = Bi(
|
|
3805
3823
|
this._virtualization.positionCache,
|
|
3806
3824
|
e,
|
|
3807
3825
|
i,
|
|
@@ -3815,14 +3833,14 @@ class k extends HTMLElement {
|
|
|
3815
3833
|
let r = i;
|
|
3816
3834
|
r === void 0 && (r = this.#e?.getRowHeight?.(n, e)), r === void 0 && (r = this._virtualization.rowHeight);
|
|
3817
3835
|
const s = o[e];
|
|
3818
|
-
if (!(!s || Math.abs(s.height - r) < 1) && (
|
|
3836
|
+
if (!(!s || Math.abs(s.height - r) < 1) && (me(o, e, r), this._virtualization.totalHeightEl)) {
|
|
3819
3837
|
const l = this.#T(this._rows.length);
|
|
3820
3838
|
this._virtualization.totalHeightEl.style.height = `${l}px`;
|
|
3821
3839
|
}
|
|
3822
3840
|
}
|
|
3823
3841
|
#pe(e, i) {
|
|
3824
3842
|
if (!this._virtualization.variableHeights || !this._virtualization.positionCache || !this._bodyEl) return;
|
|
3825
|
-
const o = this._bodyEl.querySelectorAll(".data-grid-row"), n = this.#o.getRowId, r =
|
|
3843
|
+
const o = this._bodyEl.querySelectorAll(".data-grid-row"), n = this.#o.getRowId, r = Vi(
|
|
3826
3844
|
{
|
|
3827
3845
|
positionCache: this._virtualization.positionCache,
|
|
3828
3846
|
heightCache: this._virtualization.heightCache,
|
|
@@ -3849,68 +3867,68 @@ class k extends HTMLElement {
|
|
|
3849
3867
|
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
3868
|
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
3869
|
let c;
|
|
3852
|
-
const
|
|
3853
|
-
if (this._virtualization.variableHeights &&
|
|
3854
|
-
c =
|
|
3870
|
+
const h = this._virtualization.positionCache;
|
|
3871
|
+
if (this._virtualization.variableHeights && h && h.length > 0)
|
|
3872
|
+
c = Ve(h, a), c === -1 && (c = 0);
|
|
3855
3873
|
else {
|
|
3856
3874
|
c = Math.floor(a / l);
|
|
3857
|
-
let
|
|
3858
|
-
const
|
|
3859
|
-
for (;
|
|
3860
|
-
const
|
|
3861
|
-
if (
|
|
3862
|
-
c =
|
|
3875
|
+
let b = 0;
|
|
3876
|
+
const _ = 10;
|
|
3877
|
+
for (; b < _; ) {
|
|
3878
|
+
const R = this.#e?.getExtraHeightBefore?.(c) ?? 0, E = Math.floor((a - R) / l);
|
|
3879
|
+
if (E >= c || E < 0) break;
|
|
3880
|
+
c = E, b++;
|
|
3863
3881
|
}
|
|
3864
3882
|
}
|
|
3865
3883
|
c = c - c % 2, c < 0 && (c = 0);
|
|
3866
3884
|
const f = this.#e?.adjustVirtualStart(c, a, l);
|
|
3867
3885
|
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
|
-
|
|
3886
|
+
let p;
|
|
3887
|
+
if (this._virtualization.variableHeights && h && h.length > 0) {
|
|
3888
|
+
const b = s + l * 3;
|
|
3889
|
+
let _ = 0;
|
|
3890
|
+
for (p = c; p < o && _ < b; )
|
|
3891
|
+
_ += h[p].height, p++;
|
|
3892
|
+
const R = Math.ceil(s / l) + 3;
|
|
3893
|
+
p - c < R && (p = Math.min(c + R, o));
|
|
3876
3894
|
} else {
|
|
3877
|
-
const
|
|
3878
|
-
|
|
3895
|
+
const b = Math.ceil(s / l) + 3;
|
|
3896
|
+
p = c + b;
|
|
3879
3897
|
}
|
|
3880
|
-
|
|
3881
|
-
const g = this._virtualization.start,
|
|
3882
|
-
if (!e && c === g &&
|
|
3898
|
+
p > o && (p = o);
|
|
3899
|
+
const g = this._virtualization.start, u = this._virtualization.end;
|
|
3900
|
+
if (!e && c === g && p === u)
|
|
3883
3901
|
return !1;
|
|
3884
|
-
this._virtualization.start = c, this._virtualization.end =
|
|
3885
|
-
const
|
|
3902
|
+
this._virtualization.start = c, this._virtualization.end = p;
|
|
3903
|
+
const d = e ? this._virtualization.cachedFauxHeight = n.clientHeight : this._virtualization.cachedFauxHeight || (this._virtualization.cachedFauxHeight = n.clientHeight);
|
|
3886
3904
|
if (e) {
|
|
3887
|
-
const
|
|
3888
|
-
|
|
3905
|
+
const b = this._virtualization.scrollAreaEl;
|
|
3906
|
+
b && (this._virtualization.cachedScrollAreaHeight = b.clientHeight);
|
|
3889
3907
|
}
|
|
3890
|
-
if (
|
|
3891
|
-
return this.#s.requestPhase(
|
|
3908
|
+
if (d === 0 && s > 0)
|
|
3909
|
+
return this.#s.requestPhase(A.VIRTUALIZATION, "stale-refs-retry"), !1;
|
|
3892
3910
|
if (e && this._virtualization.totalHeightEl) {
|
|
3893
|
-
const
|
|
3894
|
-
this._virtualization.totalHeightEl.style.height = `${
|
|
3911
|
+
const b = this.#T(o);
|
|
3912
|
+
this._virtualization.totalHeightEl.style.height = `${b}px`;
|
|
3895
3913
|
}
|
|
3896
3914
|
let w;
|
|
3897
|
-
if (this._virtualization.variableHeights &&
|
|
3898
|
-
w =
|
|
3915
|
+
if (this._virtualization.variableHeights && h && h[c])
|
|
3916
|
+
w = h[c].offset;
|
|
3899
3917
|
else {
|
|
3900
|
-
const
|
|
3901
|
-
w = c * l +
|
|
3918
|
+
const b = this.#e?.getExtraHeightBefore?.(c) ?? 0;
|
|
3919
|
+
w = c * l + b;
|
|
3902
3920
|
}
|
|
3903
|
-
const
|
|
3904
|
-
return this._bodyEl.style.transform = `translateY(${
|
|
3921
|
+
const v = -(a - w);
|
|
3922
|
+
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
3923
|
if (!this._virtualization.totalHeightEl) return;
|
|
3906
|
-
const
|
|
3907
|
-
this._virtualization.cachedFauxHeight === 0 && this._virtualization.cachedViewportHeight > 0 || (this._virtualization.totalHeightEl.style.height = `${
|
|
3924
|
+
const b = this.#T(o);
|
|
3925
|
+
this._virtualization.cachedFauxHeight === 0 && this._virtualization.cachedViewportHeight > 0 || (this._virtualization.totalHeightEl.style.height = `${b}px`);
|
|
3908
3926
|
})), !0;
|
|
3909
3927
|
}
|
|
3910
3928
|
#Z() {
|
|
3911
3929
|
this.#k(), this.#t.markSourcesChanged(), this.#t.merge();
|
|
3912
3930
|
const e = this.#o?.shell;
|
|
3913
|
-
|
|
3931
|
+
vi(
|
|
3914
3932
|
this.#n,
|
|
3915
3933
|
e,
|
|
3916
3934
|
{ isPanelOpen: this.#i.isPanelOpen, expandedSections: this.#i.expandedSections },
|
|
@@ -3918,24 +3936,24 @@ class k extends HTMLElement {
|
|
|
3918
3936
|
) && (this.#we(), this.#c.setInitialized(!0));
|
|
3919
3937
|
}
|
|
3920
3938
|
#we() {
|
|
3921
|
-
|
|
3939
|
+
fi(this.#n, this.#o?.shell, this.#i, {
|
|
3922
3940
|
onPanelToggle: () => this.toggleToolPanel(),
|
|
3923
3941
|
onSectionToggle: (e) => this.toggleToolPanelSection(e)
|
|
3924
|
-
}), this.#q?.(), this.#q =
|
|
3942
|
+
}), this.#q?.(), this.#q = gi(this.#n, this.#o?.shell, (e) => {
|
|
3925
3943
|
this.style.setProperty("--tbw-tool-panel-width", `${e}px`);
|
|
3926
3944
|
});
|
|
3927
3945
|
}
|
|
3928
3946
|
}
|
|
3929
3947
|
customElements.get(k.tagName) || customElements.define(k.tagName, k);
|
|
3930
3948
|
globalThis.DataGridElement = k;
|
|
3931
|
-
const
|
|
3949
|
+
const so = {
|
|
3932
3950
|
CAN_MOVE_COLUMN: "canMoveColumn",
|
|
3933
3951
|
GET_CONTEXT_MENU_ITEMS: "getContextMenuItems"
|
|
3934
3952
|
};
|
|
3935
|
-
class
|
|
3953
|
+
class lo {
|
|
3936
3954
|
static dependencies;
|
|
3937
3955
|
static manifest;
|
|
3938
|
-
version = "1.
|
|
3956
|
+
version = "1.16.1";
|
|
3939
3957
|
styles;
|
|
3940
3958
|
cellRenderers;
|
|
3941
3959
|
headerRenderers;
|
|
@@ -4067,14 +4085,14 @@ const H = {
|
|
|
4067
4085
|
GROUP_COUNT: "group-count",
|
|
4068
4086
|
RANGE_SELECTION: "range-selection",
|
|
4069
4087
|
SELECTION_OVERLAY: "selection-overlay"
|
|
4070
|
-
},
|
|
4088
|
+
}, ee = {
|
|
4071
4089
|
ROW_INDEX: "data-row-index",
|
|
4072
4090
|
COL_INDEX: "data-col-index",
|
|
4073
4091
|
FIELD: "data-field",
|
|
4074
4092
|
GROUP_KEY: "data-group-key",
|
|
4075
4093
|
TREE_LEVEL: "data-tree-level",
|
|
4076
4094
|
STICKY: "data-sticky"
|
|
4077
|
-
},
|
|
4095
|
+
}, ao = {
|
|
4078
4096
|
ROOT: `.${H.ROOT}`,
|
|
4079
4097
|
HEADER: `.${H.HEADER}`,
|
|
4080
4098
|
HEADER_ROW: `.${H.HEADER_ROW}`,
|
|
@@ -4084,12 +4102,12 @@ const H = {
|
|
|
4084
4102
|
DATA_ROW: `.${H.DATA_ROW}`,
|
|
4085
4103
|
DATA_CELL: `.${H.DATA_CELL}`,
|
|
4086
4104
|
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}[${
|
|
4105
|
+
ROW_BY_INDEX: (t) => `.${H.DATA_ROW}[${ee.ROW_INDEX}="${t}"]`,
|
|
4106
|
+
CELL_BY_FIELD: (t) => `.${H.DATA_CELL}[${ee.FIELD}="${t}"]`,
|
|
4107
|
+
CELL_AT: (t, e) => `.${H.DATA_ROW}[${ee.ROW_INDEX}="${t}"] .${H.DATA_CELL}[${ee.COL_INDEX}="${e}"]`,
|
|
4090
4108
|
SELECTED_ROWS: `.${H.DATA_ROW}.${H.SELECTED}`,
|
|
4091
4109
|
EDITING_CELL: `.${H.DATA_CELL}.${H.EDITING}`
|
|
4092
|
-
},
|
|
4110
|
+
}, co = {
|
|
4093
4111
|
COLOR_BG: "--tbw-color-bg",
|
|
4094
4112
|
COLOR_FG: "--tbw-color-fg",
|
|
4095
4113
|
COLOR_FG_MUTED: "--tbw-color-fg-muted",
|
|
@@ -4108,14 +4126,14 @@ const H = {
|
|
|
4108
4126
|
BORDER_RADIUS: "--tbw-border-radius",
|
|
4109
4127
|
FOCUS_OUTLINE: "--tbw-focus-outline"
|
|
4110
4128
|
};
|
|
4111
|
-
function
|
|
4129
|
+
function ho(t) {
|
|
4112
4130
|
const e = document.createElement("tbw-grid");
|
|
4113
4131
|
return t && (e.gridConfig = t), e;
|
|
4114
4132
|
}
|
|
4115
|
-
function
|
|
4133
|
+
function uo(t, e = document) {
|
|
4116
4134
|
return e.querySelector(t);
|
|
4117
4135
|
}
|
|
4118
|
-
const
|
|
4136
|
+
const fo = {
|
|
4119
4137
|
CELL_CHANGE: "cell-change",
|
|
4120
4138
|
CELL_COMMIT: "cell-commit",
|
|
4121
4139
|
ROW_COMMIT: "row-commit",
|
|
@@ -4130,7 +4148,7 @@ const co = {
|
|
|
4130
4148
|
CELL_ACTIVATE: "cell-activate",
|
|
4131
4149
|
GROUP_TOGGLE: "group-toggle",
|
|
4132
4150
|
COLUMN_STATE_CHANGE: "column-state-change"
|
|
4133
|
-
},
|
|
4151
|
+
}, go = {
|
|
4134
4152
|
SELECTION_CHANGE: "selection-change",
|
|
4135
4153
|
TREE_EXPAND: "tree-expand",
|
|
4136
4154
|
FILTER_CHANGE: "filter-change",
|
|
@@ -4148,7 +4166,7 @@ const co = {
|
|
|
4148
4166
|
COLUMN_REORDER: "column-reorder",
|
|
4149
4167
|
DETAIL_EXPAND: "detail-expand",
|
|
4150
4168
|
GROUP_EXPAND: "group-expand"
|
|
4151
|
-
},
|
|
4169
|
+
}, fe = {
|
|
4152
4170
|
sum: (t, e) => t.reduce((i, o) => i + (Number(o[e]) || 0), 0),
|
|
4153
4171
|
avg: (t, e) => {
|
|
4154
4172
|
const i = t.reduce((o, n) => o + (Number(n[e]) || 0), 0);
|
|
@@ -4159,28 +4177,28 @@ const co = {
|
|
|
4159
4177
|
max: (t, e) => t.length ? Math.max(...t.map((i) => Number(i[e]) || -1 / 0)) : 0,
|
|
4160
4178
|
first: (t, e) => t[0]?.[e],
|
|
4161
4179
|
last: (t, e) => t[t.length - 1]?.[e]
|
|
4162
|
-
},
|
|
4180
|
+
}, U = /* @__PURE__ */ new Map(), O = {
|
|
4163
4181
|
register(t, e) {
|
|
4164
|
-
|
|
4182
|
+
U.set(t, e);
|
|
4165
4183
|
},
|
|
4166
4184
|
unregister(t) {
|
|
4167
|
-
|
|
4185
|
+
U.delete(t);
|
|
4168
4186
|
},
|
|
4169
4187
|
get(t) {
|
|
4170
4188
|
if (t !== void 0)
|
|
4171
|
-
return typeof t == "function" ? t :
|
|
4189
|
+
return typeof t == "function" ? t : U.get(t) ?? fe[t];
|
|
4172
4190
|
},
|
|
4173
4191
|
run(t, e, i, o) {
|
|
4174
4192
|
const n = this.get(t);
|
|
4175
4193
|
return n ? n(e, i, o) : void 0;
|
|
4176
4194
|
},
|
|
4177
4195
|
has(t) {
|
|
4178
|
-
return
|
|
4196
|
+
return U.has(t) || t in fe;
|
|
4179
4197
|
},
|
|
4180
4198
|
list() {
|
|
4181
|
-
return [...Object.keys(
|
|
4199
|
+
return [...Object.keys(fe), ...U.keys()];
|
|
4182
4200
|
}
|
|
4183
|
-
},
|
|
4201
|
+
}, Be = {
|
|
4184
4202
|
sum: (t) => t.reduce((e, i) => e + i, 0),
|
|
4185
4203
|
avg: (t) => t.length ? t.reduce((e, i) => e + i, 0) / t.length : 0,
|
|
4186
4204
|
count: (t) => t.length,
|
|
@@ -4189,50 +4207,50 @@ const co = {
|
|
|
4189
4207
|
first: (t) => t[0] ?? 0,
|
|
4190
4208
|
last: (t) => t[t.length - 1] ?? 0
|
|
4191
4209
|
};
|
|
4192
|
-
function
|
|
4193
|
-
return
|
|
4210
|
+
function io(t) {
|
|
4211
|
+
return Be[t] ?? Be.sum;
|
|
4194
4212
|
}
|
|
4195
|
-
function
|
|
4196
|
-
return
|
|
4213
|
+
function po(t, e) {
|
|
4214
|
+
return io(t)(e);
|
|
4197
4215
|
}
|
|
4198
|
-
const
|
|
4216
|
+
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
4217
|
export {
|
|
4200
|
-
|
|
4201
|
-
|
|
4218
|
+
lo as BaseGridPlugin,
|
|
4219
|
+
ft as DEFAULT_ANIMATION_CONFIG,
|
|
4202
4220
|
M as DEFAULT_GRID_ICONS,
|
|
4203
|
-
|
|
4221
|
+
fo as DGEvents,
|
|
4204
4222
|
k as DataGridElement,
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4223
|
+
Je as F,
|
|
4224
|
+
G as FitModeEnum,
|
|
4225
|
+
co as GridCSSVars,
|
|
4208
4226
|
H as GridClasses,
|
|
4209
|
-
|
|
4227
|
+
ee as GridDataAttrs,
|
|
4210
4228
|
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
|
-
|
|
4229
|
+
ao as GridSelectors,
|
|
4230
|
+
so as PLUGIN_QUERIES,
|
|
4231
|
+
go as PluginEvents,
|
|
4232
|
+
ne as PluginManager,
|
|
4233
|
+
A as RenderPhase,
|
|
4234
|
+
Xe as a,
|
|
4235
|
+
O as aggregatorRegistry,
|
|
4236
|
+
W as b,
|
|
4237
|
+
Vt as builtInSort,
|
|
4238
|
+
no as c,
|
|
4239
|
+
ho as createGrid,
|
|
4240
|
+
Ke as d,
|
|
4241
|
+
Ut as defaultComparator,
|
|
4242
|
+
$ as e,
|
|
4243
|
+
Ce as f,
|
|
4244
|
+
zt as g,
|
|
4245
|
+
mo as getAggregator,
|
|
4246
|
+
io as getValueAggregator,
|
|
4247
|
+
Co as listAggregators,
|
|
4248
|
+
uo as queryGrid,
|
|
4249
|
+
oo as r,
|
|
4250
|
+
wo as registerAggregator,
|
|
4251
|
+
vo as runAggregator,
|
|
4252
|
+
po as runValueAggregator,
|
|
4253
|
+
ro as s,
|
|
4254
|
+
bo as unregisterAggregator
|
|
4237
4255
|
};
|
|
4238
4256
|
//# sourceMappingURL=index.js.map
|