@toolbox-web/grid 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -4
- package/index.js +470 -466
- package/index.js.map +1 -1
- package/lib/core/internal/sanitize.d.ts +8 -0
- package/lib/core/internal/sanitize.d.ts.map +1 -1
- package/lib/core/internal/shell.d.ts.map +1 -1
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/package.json +1 -1
- package/umd/grid.all.umd.js +12 -12
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +6 -6
- package/umd/grid.umd.js.map +1 -1
package/index.js
CHANGED
|
@@ -10,49 +10,49 @@ function xe(t, e) {
|
|
|
10
10
|
const o = t._columns, n = Fe(t);
|
|
11
11
|
return {
|
|
12
12
|
columns: o.map((i, r) => {
|
|
13
|
-
const
|
|
13
|
+
const l = {
|
|
14
14
|
field: i.field,
|
|
15
15
|
order: r,
|
|
16
16
|
visible: !0
|
|
17
17
|
// If it's in _columns, it's visible (hidden columns are filtered out)
|
|
18
|
-
},
|
|
19
|
-
|
|
18
|
+
}, s = i;
|
|
19
|
+
s.__renderedWidth !== void 0 ? l.width = s.__renderedWidth : i.width !== void 0 && (l.width = typeof i.width == "string" ? parseFloat(i.width) : i.width);
|
|
20
20
|
const a = n.get(i.field);
|
|
21
|
-
a && (
|
|
21
|
+
a && (l.sort = a);
|
|
22
22
|
for (const c of e)
|
|
23
23
|
if (c.getColumnState) {
|
|
24
24
|
const f = c.getColumnState(i.field);
|
|
25
|
-
f && Object.assign(
|
|
25
|
+
f && Object.assign(l, f);
|
|
26
26
|
}
|
|
27
|
-
return
|
|
27
|
+
return l;
|
|
28
28
|
})
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
31
|
function Ge(t, e, o, n) {
|
|
32
32
|
if (!e.columns || e.columns.length === 0) return;
|
|
33
|
-
const i = new Map(e.columns.map((
|
|
34
|
-
const a = i.get(
|
|
35
|
-
if (!a) return
|
|
36
|
-
const c = { ...
|
|
33
|
+
const i = new Map(e.columns.map((s) => [s.field, s])), r = o.map((s) => {
|
|
34
|
+
const a = i.get(s.field);
|
|
35
|
+
if (!a) return s;
|
|
36
|
+
const c = { ...s };
|
|
37
37
|
return a.width !== void 0 && (c.width = a.width, c.__renderedWidth = a.width), a.visible !== void 0 && (c.hidden = !a.visible), c;
|
|
38
38
|
});
|
|
39
|
-
r.sort((
|
|
40
|
-
const c = i.get(
|
|
39
|
+
r.sort((s, a) => {
|
|
40
|
+
const c = i.get(s.field)?.order ?? 1 / 0, f = i.get(a.field)?.order ?? 1 / 0;
|
|
41
41
|
return c - f;
|
|
42
42
|
}), t._columns = r;
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
field:
|
|
48
|
-
direction:
|
|
43
|
+
const l = e.columns.filter((s) => s.sort !== void 0).sort((s, a) => (s.sort?.priority ?? 0) - (a.sort?.priority ?? 0));
|
|
44
|
+
if (l.length > 0) {
|
|
45
|
+
const s = l[0];
|
|
46
|
+
s.sort && (t._sortState = {
|
|
47
|
+
field: s.field,
|
|
48
|
+
direction: s.sort.direction === "asc" ? 1 : -1
|
|
49
49
|
});
|
|
50
50
|
} else
|
|
51
51
|
t._sortState = null;
|
|
52
|
-
for (const
|
|
53
|
-
if (
|
|
52
|
+
for (const s of n)
|
|
53
|
+
if (s.applyColumnState)
|
|
54
54
|
for (const a of e.columns)
|
|
55
|
-
|
|
55
|
+
s.applyColumnState(a.field, a);
|
|
56
56
|
}
|
|
57
57
|
function Ue(t, e, o) {
|
|
58
58
|
let n = null;
|
|
@@ -65,11 +65,11 @@ function Ue(t, e, o) {
|
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
67
|
function Ae(t, e, o, n) {
|
|
68
|
-
const i = t.effectiveConfig?.columns ?? [], r = i.find((
|
|
68
|
+
const i = t.effectiveConfig?.columns ?? [], r = i.find((s) => s.field === e);
|
|
69
69
|
return !r || !o && r.lockVisible || !o && i.filter((a) => !a.hidden && a.field !== e).length === 0 || !!r.hidden === !o ? !1 : (r.hidden = !o, n.emit("column-visibility", {
|
|
70
70
|
field: e,
|
|
71
71
|
visible: o,
|
|
72
|
-
visibleColumns: i.filter((
|
|
72
|
+
visibleColumns: i.filter((s) => !s.hidden).map((s) => s.field)
|
|
73
73
|
}), n.clearRowPool(), n.setup(), n.requestStateChange(), !0);
|
|
74
74
|
}
|
|
75
75
|
function Xe(t, e, o) {
|
|
@@ -101,8 +101,8 @@ function Je(t, e, o) {
|
|
|
101
101
|
if (!e.length) return;
|
|
102
102
|
const n = new Map(t._columns.map((r) => [r.field, r])), i = [];
|
|
103
103
|
for (const r of e) {
|
|
104
|
-
const
|
|
105
|
-
|
|
104
|
+
const l = n.get(r);
|
|
105
|
+
l && (i.push(l), n.delete(r));
|
|
106
106
|
}
|
|
107
107
|
for (const r of n.values())
|
|
108
108
|
i.push(r);
|
|
@@ -131,19 +131,23 @@ function et(t) {
|
|
|
131
131
|
function Le(t, e) {
|
|
132
132
|
if (e && e.length) {
|
|
133
133
|
const r = {};
|
|
134
|
-
return e.forEach((
|
|
135
|
-
|
|
134
|
+
return e.forEach((l) => {
|
|
135
|
+
l.type && (r[l.field] = l.type);
|
|
136
136
|
}), { columns: e, typeMap: r };
|
|
137
137
|
}
|
|
138
138
|
const o = t[0] || {}, n = Object.keys(o).map((r) => {
|
|
139
|
-
const
|
|
140
|
-
return { field: r, header: r.charAt(0).toUpperCase() + r.slice(1), type:
|
|
139
|
+
const l = o[r], s = et(l);
|
|
140
|
+
return { field: r, header: r.charAt(0).toUpperCase() + r.slice(1), type: s };
|
|
141
141
|
}), i = {};
|
|
142
142
|
return n.forEach((r) => {
|
|
143
143
|
i[r.field] = r.type || "string";
|
|
144
144
|
}), { columns: n, typeMap: i };
|
|
145
145
|
}
|
|
146
|
-
const tt = /{{\s*([^}]+)\s*}}/g, L = "__DG_EMPTY__", ot = /^[\w$. '?+\-*/%:()!<>=,&|]+$/, nt = /__(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
|
|
146
|
+
const tt = /{{\s*([^}]+)\s*}}/g, L = "__DG_EMPTY__", ot = /^[\w$. '?+\-*/%:()!<>=,&|]+$/, nt = /__(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/;
|
|
147
|
+
function it(t) {
|
|
148
|
+
return !t || typeof t != "string" ? "" : t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
149
|
+
}
|
|
150
|
+
const rt = /* @__PURE__ */ new Set([
|
|
147
151
|
"script",
|
|
148
152
|
"iframe",
|
|
149
153
|
"object",
|
|
@@ -168,56 +172,56 @@ const tt = /{{\s*([^}]+)\s*}}/g, L = "__DG_EMPTY__", ot = /^[\w$. '?+\-*/%:()!<>
|
|
|
168
172
|
"plaintext",
|
|
169
173
|
"xmp",
|
|
170
174
|
"listing"
|
|
171
|
-
]), ue = /^on\w+$/i,
|
|
175
|
+
]), ue = /^on\w+$/i, lt = /* @__PURE__ */ new Set(["href", "src", "action", "formaction", "data", "srcdoc", "xlink:href", "poster", "srcset"]), st = /^\s*(javascript|vbscript|data|blob):/i;
|
|
172
176
|
function Q(t) {
|
|
173
177
|
if (!t || typeof t != "string") return "";
|
|
174
178
|
if (t.indexOf("<") === -1) return t;
|
|
175
179
|
const e = document.createElement("template");
|
|
176
|
-
return e.innerHTML = t,
|
|
180
|
+
return e.innerHTML = t, at(e.content), e.innerHTML;
|
|
177
181
|
}
|
|
178
|
-
function
|
|
182
|
+
function at(t) {
|
|
179
183
|
const e = [], o = t.querySelectorAll("*");
|
|
180
184
|
for (const n of o) {
|
|
181
185
|
const i = n.tagName.toLowerCase();
|
|
182
|
-
if (
|
|
186
|
+
if (rt.has(i)) {
|
|
183
187
|
e.push(n);
|
|
184
188
|
continue;
|
|
185
189
|
}
|
|
186
190
|
if ((i === "svg" || n.namespaceURI === "http://www.w3.org/2000/svg") && Array.from(n.attributes).some(
|
|
187
|
-
(
|
|
191
|
+
(s) => ue.test(s.name) || s.name === "href" || s.name === "xlink:href"
|
|
188
192
|
)) {
|
|
189
193
|
e.push(n);
|
|
190
194
|
continue;
|
|
191
195
|
}
|
|
192
196
|
const r = [];
|
|
193
|
-
for (const
|
|
194
|
-
const
|
|
195
|
-
if (ue.test(
|
|
196
|
-
r.push(
|
|
197
|
+
for (const l of n.attributes) {
|
|
198
|
+
const s = l.name.toLowerCase();
|
|
199
|
+
if (ue.test(s)) {
|
|
200
|
+
r.push(l.name);
|
|
197
201
|
continue;
|
|
198
202
|
}
|
|
199
|
-
if (
|
|
200
|
-
r.push(
|
|
203
|
+
if (lt.has(s) && st.test(l.value)) {
|
|
204
|
+
r.push(l.name);
|
|
201
205
|
continue;
|
|
202
206
|
}
|
|
203
|
-
if (
|
|
204
|
-
r.push(
|
|
207
|
+
if (s === "style" && /expression\s*\(|javascript:|behavior\s*:/i.test(l.value)) {
|
|
208
|
+
r.push(l.name);
|
|
205
209
|
continue;
|
|
206
210
|
}
|
|
207
211
|
}
|
|
208
|
-
r.forEach((
|
|
212
|
+
r.forEach((l) => n.removeAttribute(l));
|
|
209
213
|
}
|
|
210
214
|
e.forEach((n) => n.remove());
|
|
211
215
|
}
|
|
212
216
|
function Pe(t, e) {
|
|
213
217
|
if (!t || t.indexOf("{{") === -1) return t;
|
|
214
|
-
const o = [], n = t.replace(tt, (
|
|
215
|
-
const c =
|
|
218
|
+
const o = [], n = t.replace(tt, (s, a) => {
|
|
219
|
+
const c = ct(a, e);
|
|
216
220
|
return o.push({ expr: a.trim(), result: c }), c;
|
|
217
|
-
}), i =
|
|
221
|
+
}), i = dt(n), r = o.length && o.every((s) => s.result === "" || s.result === L);
|
|
218
222
|
return /Reflect\.|\bProxy\b|ownKeys\(/.test(t) || r ? "" : i;
|
|
219
223
|
}
|
|
220
|
-
function
|
|
224
|
+
function ct(t, e) {
|
|
221
225
|
if (t = (t || "").trim(), !t || /\b(Reflect|Proxy|ownKeys)\b/.test(t)) return L;
|
|
222
226
|
if (t === "value") return e.value == null ? L : String(e.value);
|
|
223
227
|
if (t.startsWith("row.") && !/[()?]/.test(t) && !t.includes(":")) {
|
|
@@ -234,10 +238,10 @@ function at(t, e) {
|
|
|
234
238
|
return L;
|
|
235
239
|
}
|
|
236
240
|
}
|
|
237
|
-
function
|
|
241
|
+
function dt(t) {
|
|
238
242
|
return t && t.replace(new RegExp(L, "g"), "").replace(/Reflect\.[^<>{}\s]+/g, "").replace(/\bProxy\b/g, "").replace(/ownKeys\([^)]*\)/g, "");
|
|
239
243
|
}
|
|
240
|
-
function
|
|
244
|
+
function ut(t) {
|
|
241
245
|
if (/Reflect|Proxy|ownKeys/.test(t.textContent || "")) {
|
|
242
246
|
if (Array.from(t.childNodes).forEach((e) => {
|
|
243
247
|
e.nodeType === Node.TEXT_NODE && /Reflect|Proxy|ownKeys/.test(e.textContent || "") && (e.textContent = "");
|
|
@@ -253,11 +257,11 @@ function he(t) {
|
|
|
253
257
|
const e = /Reflect\.|\bProxy\b|ownKeys\(/.test(t), o = (n) => e ? "" : Pe(t, n);
|
|
254
258
|
return o.__blocked = e, o;
|
|
255
259
|
}
|
|
256
|
-
function
|
|
260
|
+
function ht(t) {
|
|
257
261
|
return Array.from(t.querySelectorAll("tbw-grid-column")).map((o) => {
|
|
258
262
|
const n = o.getAttribute("field") || "";
|
|
259
263
|
if (!n) return null;
|
|
260
|
-
const i = o.getAttribute("type") || void 0,
|
|
264
|
+
const i = o.getAttribute("type") || void 0, l = i && (/* @__PURE__ */ new Set(["number", "string", "date", "boolean", "select", "typeahead"])).has(i) ? i : void 0, s = o.getAttribute("header") || void 0, a = o.hasAttribute("sortable"), c = o.hasAttribute("editable"), f = { field: n, type: l, header: s, sortable: a, editable: c }, d = o.getAttribute("width");
|
|
261
265
|
if (d) {
|
|
262
266
|
const C = parseFloat(d);
|
|
263
267
|
!isNaN(C) && /^\d+(\.\d+)?$/.test(d.trim()) ? f.width = C : f.width = d;
|
|
@@ -290,7 +294,7 @@ function ut(t) {
|
|
|
290
294
|
return f;
|
|
291
295
|
}).filter((o) => !!o);
|
|
292
296
|
}
|
|
293
|
-
function
|
|
297
|
+
function ft(t, e) {
|
|
294
298
|
if ((!t || !t.length) && (!e || !e.length)) return [];
|
|
295
299
|
if (!t || !t.length) return e || [];
|
|
296
300
|
if (!e || !e.length) return t;
|
|
@@ -299,18 +303,18 @@ function ht(t, e) {
|
|
|
299
303
|
const r = o[i.field];
|
|
300
304
|
if (r) {
|
|
301
305
|
i.header && !r.header && (r.header = i.header), i.type && !r.type && (r.type = i.type), i.sortable && (r.sortable = !0), i.editable && (r.editable = !0), i.resizable && (r.resizable = !0), i.width != null && r.width == null && (r.width = i.width), i.minWidth != null && r.minWidth == null && (r.minWidth = i.minWidth), i.__viewTemplate && (r.__viewTemplate = i.__viewTemplate), i.__editorTemplate && (r.__editorTemplate = i.__editorTemplate), i.__headerTemplate && (r.__headerTemplate = i.__headerTemplate);
|
|
302
|
-
const
|
|
303
|
-
|
|
306
|
+
const l = i.renderer || i.viewRenderer, s = r.renderer || r.viewRenderer;
|
|
307
|
+
l && !s && (r.viewRenderer = l, i.renderer && (r.renderer = l)), i.editor && !r.editor && (r.editor = i.editor);
|
|
304
308
|
} else
|
|
305
309
|
o[i.field] = { ...i };
|
|
306
310
|
});
|
|
307
311
|
const n = t.map((i) => {
|
|
308
312
|
const r = o[i.field];
|
|
309
313
|
if (!r) return i;
|
|
310
|
-
const
|
|
311
|
-
r.header && !
|
|
312
|
-
const
|
|
313
|
-
return
|
|
314
|
+
const l = { ...i };
|
|
315
|
+
r.header && !l.header && (l.header = r.header), r.type && !l.type && (l.type = r.type), l.sortable = i.sortable || r.sortable, (i.resizable === !0 || r.resizable === !0) && (l.resizable = !0), l.editable = i.editable || r.editable, r.width != null && l.width == null && (l.width = r.width), r.minWidth != null && l.minWidth == null && (l.minWidth = r.minWidth), r.__viewTemplate && (l.__viewTemplate = r.__viewTemplate), r.__editorTemplate && (l.__editorTemplate = r.__editorTemplate), r.__headerTemplate && (l.__headerTemplate = r.__headerTemplate);
|
|
316
|
+
const s = r.renderer || r.viewRenderer, a = l.renderer || l.viewRenderer;
|
|
317
|
+
return s && !a && (l.viewRenderer = s, r.renderer && (l.renderer = s)), r.editor && !l.editor && (l.editor = r.editor), delete o[i.field], l;
|
|
314
318
|
});
|
|
315
319
|
return Object.keys(o).forEach((i) => n.push(o[i])), n;
|
|
316
320
|
}
|
|
@@ -325,8 +329,8 @@ function fe(t, e) {
|
|
|
325
329
|
function pe(t) {
|
|
326
330
|
t.__lightDomColumnsCache || (t.__originalColumnNodes = Array.from(
|
|
327
331
|
t.querySelectorAll("tbw-grid-column")
|
|
328
|
-
), t.__lightDomColumnsCache = t.__originalColumnNodes.length ?
|
|
329
|
-
const e = t.__lightDomColumnsCache, o =
|
|
332
|
+
), t.__lightDomColumnsCache = t.__originalColumnNodes.length ? ht(t) : []);
|
|
333
|
+
const e = t.__lightDomColumnsCache, o = ft(t._columns, e);
|
|
330
334
|
o.forEach((i) => {
|
|
331
335
|
i.__viewTemplate && !i.__compiledView && (i.__compiledView = he(i.__viewTemplate.innerHTML)), i.__editorTemplate && !i.__compiledEditor && (i.__compiledEditor = he(i.__editorTemplate.innerHTML));
|
|
332
336
|
});
|
|
@@ -341,16 +345,16 @@ function we(t) {
|
|
|
341
345
|
let n = !1;
|
|
342
346
|
t._visibleColumns.forEach((i, r) => {
|
|
343
347
|
if (i.width) return;
|
|
344
|
-
const
|
|
345
|
-
let
|
|
348
|
+
const l = o[r];
|
|
349
|
+
let s = l ? l.scrollWidth : 0;
|
|
346
350
|
for (const a of t._rowPool) {
|
|
347
351
|
const c = a.children[r];
|
|
348
352
|
if (c) {
|
|
349
353
|
const f = c.scrollWidth;
|
|
350
|
-
f >
|
|
354
|
+
f > s && (s = f);
|
|
351
355
|
}
|
|
352
356
|
}
|
|
353
|
-
|
|
357
|
+
s > 0 && (i.width = s + 2, i.__autoSized = !0, n = !0);
|
|
354
358
|
}), n && z(t), t.__didInitialAutoSize = !0;
|
|
355
359
|
}
|
|
356
360
|
function z(t) {
|
|
@@ -360,7 +364,7 @@ function z(t) {
|
|
|
360
364
|
return n != null ? `minmax(${n}px, 1fr)` : "1fr";
|
|
361
365
|
}).join(" ").trim() : t._gridTemplate = t._visibleColumns.map((o) => o.width ? `${o.width}px` : "max-content").join(" "), t.style.setProperty("--tbw-column-template", t._gridTemplate);
|
|
362
366
|
}
|
|
363
|
-
function
|
|
367
|
+
function pt(t) {
|
|
364
368
|
switch (t.type) {
|
|
365
369
|
case "number":
|
|
366
370
|
return (e) => {
|
|
@@ -386,14 +390,14 @@ function ft(t) {
|
|
|
386
390
|
return (e) => {
|
|
387
391
|
const o = document.createElement("select");
|
|
388
392
|
e.column.multi && (o.multiple = !0), (typeof e.column.options == "function" ? e.column.options() : e.column.options || []).forEach((r) => {
|
|
389
|
-
const
|
|
390
|
-
|
|
393
|
+
const l = document.createElement("option");
|
|
394
|
+
l.value = String(r.value), l.textContent = r.label, (e.column.multi && Array.isArray(e.value) && e.value.includes(r.value) || !e.column.multi && e.value === r.value) && (l.selected = !0), o.appendChild(l);
|
|
391
395
|
});
|
|
392
396
|
const i = () => {
|
|
393
397
|
if (e.column.multi) {
|
|
394
398
|
const r = [];
|
|
395
|
-
Array.from(o.selectedOptions).forEach((
|
|
396
|
-
r.push(
|
|
399
|
+
Array.from(o.selectedOptions).forEach((l) => {
|
|
400
|
+
r.push(l.value);
|
|
397
401
|
}), e.commit(r);
|
|
398
402
|
} else
|
|
399
403
|
e.commit(o.value);
|
|
@@ -434,18 +438,18 @@ function X(t) {
|
|
|
434
438
|
const e = t.getAttribute("data-col");
|
|
435
439
|
return e ? parseInt(e, 10) : -1;
|
|
436
440
|
}
|
|
437
|
-
function
|
|
441
|
+
function le(t) {
|
|
438
442
|
t && t.querySelectorAll(".cell-focus").forEach((e) => e.classList.remove("cell-focus"));
|
|
439
443
|
}
|
|
440
|
-
function
|
|
444
|
+
function wt(t, e) {
|
|
441
445
|
if (t._dispatchKeyDown?.(e))
|
|
442
446
|
return;
|
|
443
|
-
const o = t._rows.length - 1, n = t._visibleColumns.length - 1, i = t._activeEditRows !== void 0 && t._activeEditRows !== -1,
|
|
447
|
+
const o = t._rows.length - 1, n = t._visibleColumns.length - 1, i = t._activeEditRows !== void 0 && t._activeEditRows !== -1, l = t._visibleColumns[t._focusCol]?.type, s = e.composedPath ? e.composedPath() : [], a = s && s.length ? s[0] : e.target, c = (f) => {
|
|
444
448
|
if (!f) return !1;
|
|
445
449
|
const d = f.tagName;
|
|
446
450
|
return !!(d === "INPUT" || d === "SELECT" || d === "TEXTAREA" || f.isContentEditable);
|
|
447
451
|
};
|
|
448
|
-
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")) && !(i && (
|
|
452
|
+
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")) && !(i && (l === "select" || l === "typeahead") && (e.key === "ArrowDown" || e.key === "ArrowUp"))) {
|
|
449
453
|
switch (e.key) {
|
|
450
454
|
case "Tab": {
|
|
451
455
|
e.preventDefault(), !e.shiftKey ? t._focusCol < n ? t._focusCol += 1 : (typeof t.commitActiveRowEdit == "function" && t.commitActiveRowEdit(), t._focusRow < o && (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 = n), k(t);
|
|
@@ -492,45 +496,45 @@ function pt(t, e) {
|
|
|
492
496
|
}
|
|
493
497
|
function k(t, e) {
|
|
494
498
|
if (t._virtualization?.enabled) {
|
|
495
|
-
const { rowHeight:
|
|
499
|
+
const { rowHeight: l, container: s, viewportEl: a } = t._virtualization, c = s, f = a?.clientHeight ?? c?.clientHeight ?? 0;
|
|
496
500
|
if (c && f > 0) {
|
|
497
|
-
const d = t._focusRow *
|
|
498
|
-
d < c.scrollTop ? c.scrollTop = d : d +
|
|
501
|
+
const d = t._focusRow * l;
|
|
502
|
+
d < c.scrollTop ? c.scrollTop = d : d + l > c.scrollTop + f && (c.scrollTop = d - f + l);
|
|
499
503
|
}
|
|
500
504
|
}
|
|
501
505
|
const o = t._activeEditRows !== void 0 && t._activeEditRows !== -1;
|
|
502
|
-
o || t.refreshVirtualWindow(!1),
|
|
503
|
-
|
|
506
|
+
o || t.refreshVirtualWindow(!1), le(t._bodyEl), Array.from(t._bodyEl.querySelectorAll('[aria-selected="true"]')).forEach((l) => {
|
|
507
|
+
l.setAttribute("aria-selected", "false");
|
|
504
508
|
});
|
|
505
509
|
const n = t._focusRow, i = t._virtualization.start ?? 0, r = t._virtualization.end ?? t._rows.length;
|
|
506
510
|
if (n >= i && n < r) {
|
|
507
|
-
const
|
|
508
|
-
if (
|
|
509
|
-
|
|
511
|
+
const l = t._bodyEl.querySelectorAll(".data-grid-row")[n - i], s = l?.children[t._focusCol];
|
|
512
|
+
if (s) {
|
|
513
|
+
s.classList.add("cell-focus"), s.setAttribute("aria-selected", "true");
|
|
510
514
|
const a = t.shadowRoot?.querySelector(".tbw-scroll-area");
|
|
511
|
-
if (a &&
|
|
515
|
+
if (a && s && !o)
|
|
512
516
|
if (e?.forceScrollLeft)
|
|
513
517
|
a.scrollLeft = 0;
|
|
514
518
|
else if (e?.forceScrollRight)
|
|
515
519
|
a.scrollLeft = a.scrollWidth - a.clientWidth;
|
|
516
520
|
else {
|
|
517
|
-
const c = t._getHorizontalScrollOffsets?.(
|
|
521
|
+
const c = t._getHorizontalScrollOffsets?.(l ?? void 0, s) ?? { left: 0, right: 0 };
|
|
518
522
|
if (!c.skipScroll) {
|
|
519
|
-
const f =
|
|
523
|
+
const f = s.getBoundingClientRect(), d = a.getBoundingClientRect(), u = f.left - d.left + a.scrollLeft, w = u + f.width, h = a.scrollLeft + c.left, p = a.scrollLeft + a.clientWidth - c.right;
|
|
520
524
|
u < h ? a.scrollLeft = u - c.left : w > p && (a.scrollLeft = w - a.clientWidth + c.right);
|
|
521
525
|
}
|
|
522
526
|
}
|
|
523
|
-
if (t._activeEditRows !== void 0 && t._activeEditRows !== -1 &&
|
|
524
|
-
const c =
|
|
527
|
+
if (t._activeEditRows !== void 0 && t._activeEditRows !== -1 && s.classList.contains("editing")) {
|
|
528
|
+
const c = s.querySelector(q);
|
|
525
529
|
if (c && document.activeElement !== c)
|
|
526
530
|
try {
|
|
527
531
|
c.focus({ preventScroll: !0 });
|
|
528
532
|
} catch {
|
|
529
533
|
}
|
|
530
|
-
} else if (!
|
|
531
|
-
|
|
534
|
+
} else if (!s.contains(document.activeElement)) {
|
|
535
|
+
s.hasAttribute("tabindex") || s.setAttribute("tabindex", "-1");
|
|
532
536
|
try {
|
|
533
|
-
|
|
537
|
+
s.focus({ preventScroll: !0 });
|
|
534
538
|
} catch {
|
|
535
539
|
}
|
|
536
540
|
}
|
|
@@ -541,27 +545,27 @@ const Oe = document.createElement("template");
|
|
|
541
545
|
Oe.innerHTML = '<div class="cell" role="gridcell" part="cell"></div>';
|
|
542
546
|
const ke = document.createElement("template");
|
|
543
547
|
ke.innerHTML = '<div class="data-grid-row" role="row" part="row"></div>';
|
|
544
|
-
function
|
|
548
|
+
function bt() {
|
|
545
549
|
return Oe.content.firstElementChild.cloneNode(!0);
|
|
546
550
|
}
|
|
547
|
-
function
|
|
551
|
+
function gt() {
|
|
548
552
|
return ke.content.firstElementChild.cloneNode(!0);
|
|
549
553
|
}
|
|
550
|
-
const
|
|
554
|
+
const mt = "__cellDisplayCache", vt = "__cellCacheEpoch";
|
|
551
555
|
function Y(t) {
|
|
552
|
-
t[
|
|
556
|
+
t[mt] = void 0, t[vt] = void 0, t.__hasSpecialColumns = void 0;
|
|
553
557
|
}
|
|
554
|
-
function
|
|
555
|
-
const r = Math.max(0, o - e),
|
|
558
|
+
function _t(t, e, o, n, i) {
|
|
559
|
+
const r = Math.max(0, o - e), l = t._bodyEl, s = t._visibleColumns, a = s.length;
|
|
556
560
|
let c = t.__cachedHeaderRowCount;
|
|
557
561
|
for (c === void 0 && (c = t.shadowRoot?.querySelector(".header-group-row") ? 2 : 1, t.__cachedHeaderRowCount = c); t._rowPool.length < r; ) {
|
|
558
|
-
const d =
|
|
562
|
+
const d = gt();
|
|
559
563
|
d.addEventListener("click", (u) => be(t, u, d, !1)), d.addEventListener("dblclick", (u) => be(t, u, d, !0)), t._rowPool.push(d);
|
|
560
564
|
}
|
|
561
565
|
if (t._rowPool.length > r) {
|
|
562
566
|
for (let d = r; d < t._rowPool.length; d++) {
|
|
563
567
|
const u = t._rowPool[d];
|
|
564
|
-
u.parentNode ===
|
|
568
|
+
u.parentNode === l && u.remove();
|
|
565
569
|
}
|
|
566
570
|
t._rowPool.length = r;
|
|
567
571
|
}
|
|
@@ -569,14 +573,14 @@ function vt(t, e, o, n, i) {
|
|
|
569
573
|
for (let d = 0; d < r; d++) {
|
|
570
574
|
const u = e + d, w = t._rows[u], h = t._rowPool[d];
|
|
571
575
|
if (h.setAttribute("aria-rowindex", String(u + c + 1)), f && i(w, h, u)) {
|
|
572
|
-
h.__epoch = n, h.__rowDataRef = w, h.parentNode !==
|
|
576
|
+
h.__epoch = n, h.__rowDataRef = w, h.parentNode !== l && l.appendChild(h);
|
|
573
577
|
continue;
|
|
574
578
|
}
|
|
575
579
|
const p = h.__epoch, g = h.__rowDataRef, b = h.children.length, v = p === n && b === a, m = g !== w;
|
|
576
580
|
let E = !1;
|
|
577
581
|
if (v && m) {
|
|
578
582
|
for (let S = 0; S < a; S++)
|
|
579
|
-
if (
|
|
583
|
+
if (s[S].externalView && !h.querySelector(`.cell[data-col="${S}"] [data-external-view]`)) {
|
|
580
584
|
E = !0;
|
|
581
585
|
break;
|
|
582
586
|
}
|
|
@@ -618,15 +622,15 @@ function vt(t, e, o, n, i) {
|
|
|
618
622
|
}
|
|
619
623
|
}
|
|
620
624
|
const x = t._changedRowIndices.has(u), K = h.classList.contains("changed");
|
|
621
|
-
x !== K && h.classList.toggle("changed", x), h.parentNode !==
|
|
625
|
+
x !== K && h.classList.toggle("changed", x), h.parentNode !== l && l.appendChild(h);
|
|
622
626
|
}
|
|
623
627
|
}
|
|
624
628
|
function ne(t, e, o, n) {
|
|
625
|
-
const i = e.children, r = t._visibleColumns,
|
|
629
|
+
const i = e.children, r = t._visibleColumns, l = r.length, s = i.length, a = l < s ? l : s, c = t._focusRow, f = t._focusCol;
|
|
626
630
|
let d = t.__hasSpecialColumns;
|
|
627
631
|
if (d === void 0) {
|
|
628
632
|
d = !1;
|
|
629
|
-
for (let w = 0; w <
|
|
633
|
+
for (let w = 0; w < l; w++) {
|
|
630
634
|
const h = r[w];
|
|
631
635
|
if (h.__viewTemplate || h.__compiledView || h.renderer || h.viewRenderer || h.externalView || h.format || h.type === "date" || h.type === "boolean") {
|
|
632
636
|
d = !0;
|
|
@@ -677,11 +681,11 @@ function ne(t, e, o, n) {
|
|
|
677
681
|
}
|
|
678
682
|
function $(t, e, o, n) {
|
|
679
683
|
e.innerHTML = "";
|
|
680
|
-
const i = t._visibleColumns, r = i.length,
|
|
684
|
+
const i = t._visibleColumns, r = i.length, l = t._focusRow, s = t._focusCol;
|
|
681
685
|
t.effectiveConfig?.editOn || t.editOn;
|
|
682
686
|
const a = t, c = document.createDocumentFragment();
|
|
683
687
|
for (let f = 0; f < r; f++) {
|
|
684
|
-
const d = i[f], u =
|
|
688
|
+
const d = i[f], u = bt();
|
|
685
689
|
u.setAttribute("aria-colindex", String(f + 1)), u.setAttribute("data-col", String(f)), u.setAttribute("data-row", String(n)), u.setAttribute("data-field", d.field), d.type, d.type && u.setAttribute("data-type", d.type);
|
|
686
690
|
let w = o[d.field];
|
|
687
691
|
const h = d.format;
|
|
@@ -727,11 +731,11 @@ function $(t, e, o, n) {
|
|
|
727
731
|
} else
|
|
728
732
|
d.type === "date" ? u.textContent = He(w) : d.type === "boolean" ? u.innerHTML = ae(!!w) : u.textContent = w == null ? "" : String(w);
|
|
729
733
|
if (v) {
|
|
730
|
-
|
|
734
|
+
ut(u);
|
|
731
735
|
const m = u.textContent || "";
|
|
732
736
|
/Proxy|Reflect\.ownKeys/.test(m) && (u.textContent = m.replace(/Proxy|Reflect\.ownKeys/g, "").trim(), /Proxy|Reflect\.ownKeys/.test(u.textContent || "") && (u.textContent = ""));
|
|
733
737
|
}
|
|
734
|
-
u.hasAttribute("data-blocked-template") && (u.textContent || "").trim().length && (u.textContent = ""), d.editable ? u.tabIndex = 0 : d.type === "boolean" && (u.hasAttribute("tabindex") || (u.tabIndex = 0)),
|
|
738
|
+
u.hasAttribute("data-blocked-template") && (u.textContent || "").trim().length && (u.textContent = ""), d.editable ? u.tabIndex = 0 : d.type === "boolean" && (u.hasAttribute("tabindex") || (u.tabIndex = 0)), l === n && s === f ? (u.classList.add("cell-focus"), u.setAttribute("aria-selected", "true")) : u.setAttribute("aria-selected", "false"), c.appendChild(u);
|
|
735
739
|
}
|
|
736
740
|
e.appendChild(c);
|
|
737
741
|
}
|
|
@@ -739,28 +743,28 @@ function be(t, e, o, n) {
|
|
|
739
743
|
if (e.target?.closest(".resize-handle")) return;
|
|
740
744
|
const i = o.querySelector(".cell[data-row]"), r = Me(i);
|
|
741
745
|
if (r < 0) return;
|
|
742
|
-
const
|
|
743
|
-
if (!
|
|
746
|
+
const l = t._rows[r];
|
|
747
|
+
if (!l || t._dispatchRowClick?.(e, r, l, o))
|
|
744
748
|
return;
|
|
745
|
-
const
|
|
746
|
-
if (
|
|
747
|
-
const d = Number(
|
|
749
|
+
const s = e.target?.closest(".cell[data-col]");
|
|
750
|
+
if (s) {
|
|
751
|
+
const d = Number(s.getAttribute("data-col"));
|
|
748
752
|
if (!isNaN(d)) {
|
|
749
|
-
if (t._dispatchCellClick?.(e, r, d,
|
|
753
|
+
if (t._dispatchCellClick?.(e, r, d, s))
|
|
750
754
|
return;
|
|
751
755
|
const u = t._focusRow !== r || t._focusCol !== d;
|
|
752
|
-
if (t._focusRow = r, t._focusCol = d,
|
|
753
|
-
u && (
|
|
756
|
+
if (t._focusRow = r, t._focusCol = d, s.classList.contains("editing")) {
|
|
757
|
+
u && (le(t.shadowRoot ?? t._bodyEl), s.classList.add("cell-focus"));
|
|
754
758
|
return;
|
|
755
759
|
}
|
|
756
760
|
k(t);
|
|
757
761
|
}
|
|
758
762
|
}
|
|
759
763
|
if (t._activeEditRows === r) {
|
|
760
|
-
|
|
761
|
-
const d = Number(
|
|
762
|
-
if (u && u.editable &&
|
|
763
|
-
const w =
|
|
764
|
+
s && (le(t.shadowRoot ?? t._bodyEl), s.classList.add("cell-focus"), queueMicrotask(() => {
|
|
765
|
+
const d = Number(s.getAttribute("data-col")), u = t._visibleColumns[d];
|
|
766
|
+
if (u && u.editable && s.classList.contains("editing")) {
|
|
767
|
+
const w = s.querySelector(q);
|
|
764
768
|
try {
|
|
765
769
|
w?.focus({ preventScroll: !0 });
|
|
766
770
|
} catch {
|
|
@@ -784,15 +788,15 @@ function be(t, e, o, n) {
|
|
|
784
788
|
t.beginBulkEdit(r);
|
|
785
789
|
return;
|
|
786
790
|
}
|
|
787
|
-
G(t, r,
|
|
791
|
+
G(t, r, l);
|
|
788
792
|
} else return;
|
|
789
793
|
Array.from(o.children).forEach((d, u) => {
|
|
790
794
|
const w = t._visibleColumns[u];
|
|
791
|
-
w && w.editable && H(t,
|
|
792
|
-
}),
|
|
795
|
+
w && w.editable && H(t, l, r, w, d, !0);
|
|
796
|
+
}), s && queueMicrotask(() => {
|
|
793
797
|
const d = o.querySelector(`.cell[data-col="${t._focusCol}"]`);
|
|
794
798
|
if (d?.classList.contains("editing")) {
|
|
795
|
-
const u = d.querySelector(
|
|
799
|
+
const u = d.querySelector(q);
|
|
796
800
|
try {
|
|
797
801
|
u?.focus({ preventScroll: !0 });
|
|
798
802
|
} catch {
|
|
@@ -800,24 +804,24 @@ function be(t, e, o, n) {
|
|
|
800
804
|
}
|
|
801
805
|
});
|
|
802
806
|
}
|
|
803
|
-
const
|
|
804
|
-
function
|
|
807
|
+
const q = 'input,select,textarea,[contenteditable="true"],[contenteditable=""],[tabindex]:not([tabindex="-1"])';
|
|
808
|
+
function se(t) {
|
|
805
809
|
return !(t === "__proto__" || t === "constructor" || t === "prototype");
|
|
806
810
|
}
|
|
807
811
|
function ee(t) {
|
|
808
812
|
return (t.__editingCellCount ?? 0) > 0;
|
|
809
813
|
}
|
|
810
|
-
function
|
|
814
|
+
function Ct(t) {
|
|
811
815
|
const e = (t.__editingCellCount ?? 0) + 1;
|
|
812
816
|
t.__editingCellCount = e, t.setAttribute("data-has-editing", "");
|
|
813
817
|
}
|
|
814
818
|
function te(t) {
|
|
815
819
|
t.__editingCellCount = 0, t.removeAttribute("data-has-editing");
|
|
816
820
|
}
|
|
817
|
-
function
|
|
821
|
+
function Et(t, e, o, n, i) {
|
|
818
822
|
const r = t.querySelector("input,textarea,select");
|
|
819
823
|
if (!r) return;
|
|
820
|
-
const
|
|
824
|
+
const l = () => {
|
|
821
825
|
if (r instanceof HTMLInputElement) {
|
|
822
826
|
if (r.type === "checkbox") return r.checked;
|
|
823
827
|
if (r.type === "number") return r.value === "" ? null : Number(r.value);
|
|
@@ -826,8 +830,8 @@ function Ct(t, e, o, n, i) {
|
|
|
826
830
|
return e.type === "number" && r.value !== "" ? Number(r.value) : r.value;
|
|
827
831
|
};
|
|
828
832
|
r.addEventListener("blur", () => {
|
|
829
|
-
o(
|
|
830
|
-
}), r instanceof HTMLInputElement && r.type === "checkbox" ? r.addEventListener("change", () => o(r.checked)) : r instanceof HTMLSelectElement && r.addEventListener("change", () => o(
|
|
833
|
+
o(l());
|
|
834
|
+
}), r instanceof HTMLInputElement && r.type === "checkbox" ? r.addEventListener("change", () => o(r.checked)) : r instanceof HTMLSelectElement && r.addEventListener("change", () => o(l()));
|
|
831
835
|
}
|
|
832
836
|
function G(t, e, o) {
|
|
833
837
|
t._activeEditRows !== e && (t._rowEditSnapshots.set(e, { ...o }), t._activeEditRows = e);
|
|
@@ -835,26 +839,26 @@ function G(t, e, o) {
|
|
|
835
839
|
function D(t, e, o) {
|
|
836
840
|
if (t._activeEditRows !== e) return;
|
|
837
841
|
const n = t._rowEditSnapshots.get(e), i = t._rows[e], r = t.findRenderedRowElement?.(e);
|
|
838
|
-
if (!o && r && i && r.querySelectorAll(".cell.editing").forEach((
|
|
839
|
-
const a = Number(
|
|
842
|
+
if (!o && r && i && r.querySelectorAll(".cell.editing").forEach((s) => {
|
|
843
|
+
const a = Number(s.getAttribute("data-col"));
|
|
840
844
|
if (isNaN(a)) return;
|
|
841
845
|
const c = t._visibleColumns[a];
|
|
842
846
|
if (!c) return;
|
|
843
|
-
const f =
|
|
847
|
+
const f = s.querySelector("input,textarea,select");
|
|
844
848
|
if (f) {
|
|
845
849
|
let d;
|
|
846
850
|
f instanceof HTMLInputElement && f.type === "checkbox" ? d = f.checked : (d = f.value, c.type === "number" && d !== "" && (d = Number(d))), i[c.field] !== d && ce(t, e, c, d, i);
|
|
847
851
|
}
|
|
848
852
|
}), o && n && i)
|
|
849
|
-
Object.keys(n).forEach((
|
|
853
|
+
Object.keys(n).forEach((l) => i[l] = n[l]), t._changedRowIndices.delete(e), Y(t);
|
|
850
854
|
else if (!o) {
|
|
851
|
-
const
|
|
855
|
+
const l = t._changedRowIndices.has(e);
|
|
852
856
|
t.dispatchEvent(
|
|
853
857
|
new CustomEvent("row-commit", {
|
|
854
858
|
detail: {
|
|
855
859
|
rowIndex: e,
|
|
856
860
|
row: i,
|
|
857
|
-
changed:
|
|
861
|
+
changed: l,
|
|
858
862
|
changedRows: t.changedRows,
|
|
859
863
|
changedRowIndices: t.changedRowIndices
|
|
860
864
|
}
|
|
@@ -863,12 +867,12 @@ function D(t, e, o) {
|
|
|
863
867
|
}
|
|
864
868
|
t._rowEditSnapshots.delete(e), t._activeEditRows = -1, r && ($(t, r, t._rows[e], e), t._changedRowIndices.has(e) ? r.classList.add("changed") : r.classList.remove("changed")), queueMicrotask(() => {
|
|
865
869
|
try {
|
|
866
|
-
const
|
|
870
|
+
const l = t._focusRow, s = t._focusCol, a = t.findRenderedRowElement?.(l);
|
|
867
871
|
if (a) {
|
|
868
872
|
Array.from(t._bodyEl.querySelectorAll(".cell-focus")).forEach(
|
|
869
873
|
(f) => f.classList.remove("cell-focus")
|
|
870
874
|
);
|
|
871
|
-
const c = a.querySelector(`.cell[data-row="${
|
|
875
|
+
const c = a.querySelector(`.cell[data-row="${l}"][data-col="${s}"]`);
|
|
872
876
|
c && (c.classList.add("cell-focus"), c.setAttribute("aria-selected", "true"), c.hasAttribute("tabindex") || c.setAttribute("tabindex", "-1"), c.focus({ preventScroll: !0 }));
|
|
873
877
|
}
|
|
874
878
|
} catch {
|
|
@@ -877,9 +881,9 @@ function D(t, e, o) {
|
|
|
877
881
|
}
|
|
878
882
|
function ce(t, e, o, n, i) {
|
|
879
883
|
const r = o.field;
|
|
880
|
-
if (!
|
|
884
|
+
if (!se(r) || i[r] === n) return;
|
|
881
885
|
i[r] = n;
|
|
882
|
-
const
|
|
886
|
+
const s = !t._changedRowIndices.has(e);
|
|
883
887
|
t._changedRowIndices.add(e);
|
|
884
888
|
const a = t.findRenderedRowElement?.(e);
|
|
885
889
|
a && a.classList.add("changed"), t.dispatchEvent(
|
|
@@ -891,33 +895,33 @@ function ce(t, e, o, n, i) {
|
|
|
891
895
|
rowIndex: e,
|
|
892
896
|
changedRows: t.changedRows,
|
|
893
897
|
changedRowIndices: t.changedRowIndices,
|
|
894
|
-
firstTimeForRow:
|
|
898
|
+
firstTimeForRow: s
|
|
895
899
|
}
|
|
896
900
|
})
|
|
897
901
|
);
|
|
898
902
|
}
|
|
899
903
|
function H(t, e, o, n, i, r = !1) {
|
|
900
904
|
if (!n.editable || (t._activeEditRows !== o && G(t, o, e), i.classList.contains("editing"))) return;
|
|
901
|
-
const
|
|
905
|
+
const l = se(n.field) ? e[n.field] : void 0;
|
|
902
906
|
i.classList.add("editing");
|
|
903
|
-
const
|
|
904
|
-
|
|
907
|
+
const s = i.parentElement;
|
|
908
|
+
s && Ct(s);
|
|
905
909
|
let a = !1;
|
|
906
910
|
const c = (p) => {
|
|
907
911
|
a || t._activeEditRows === -1 || ce(t, o, n, p, e);
|
|
908
912
|
}, f = () => {
|
|
909
|
-
a = !0, e[n.field] =
|
|
913
|
+
a = !0, e[n.field] = se(n.field) ? l : void 0;
|
|
910
914
|
const p = i.querySelector("input,textarea,select");
|
|
911
|
-
p && (typeof HTMLInputElement < "u" && p instanceof HTMLInputElement && p.type === "checkbox" ? p.checked = !!
|
|
915
|
+
p && (typeof HTMLInputElement < "u" && p instanceof HTMLInputElement && p.type === "checkbox" ? p.checked = !!l : "value" in p && (p.value = l ?? ""));
|
|
912
916
|
}, d = document.createElement("div");
|
|
913
917
|
d.style.display = "contents", i.innerHTML = "", i.appendChild(d), d.addEventListener("keydown", (p) => {
|
|
914
918
|
p.key === "Enter" && (p.stopPropagation(), p.preventDefault(), a = !0, D(t, o, !1)), p.key === "Escape" && (p.stopPropagation(), p.preventDefault(), f(), D(t, o, !0));
|
|
915
919
|
});
|
|
916
|
-
const u = n.__editorTemplate, w = n.editor || (u ? "template" :
|
|
920
|
+
const u = n.__editorTemplate, w = n.editor || (u ? "template" : pt(n)), h = l;
|
|
917
921
|
if (w === "template" && u) {
|
|
918
922
|
const p = u.cloneNode(!0), g = n.__compiledEditor;
|
|
919
|
-
g ? p.innerHTML = g({ row: e, value:
|
|
920
|
-
_.childNodes.length === 1 && _.firstChild?.nodeType === Node.TEXT_NODE && (_.textContent = _.textContent?.replace(/{{\s*value\s*}}/g,
|
|
923
|
+
g ? p.innerHTML = g({ row: e, value: l, field: n.field, column: n }) : p.querySelectorAll("*").forEach((_) => {
|
|
924
|
+
_.childNodes.length === 1 && _.firstChild?.nodeType === Node.TEXT_NODE && (_.textContent = _.textContent?.replace(/{{\s*value\s*}}/g, l == null ? "" : String(l)).replace(/{{\s*row\.([a-zA-Z0-9_]+)\s*}}/g, (v, m) => {
|
|
921
925
|
const E = e[m];
|
|
922
926
|
return E == null ? "" : String(E);
|
|
923
927
|
}) || "");
|
|
@@ -925,7 +929,7 @@ function H(t, e, o, n, i, r = !1) {
|
|
|
925
929
|
const b = p.querySelector("input,textarea,select");
|
|
926
930
|
if (b) {
|
|
927
931
|
const _ = typeof HTMLInputElement < "u";
|
|
928
|
-
_ && b instanceof HTMLInputElement && b.type === "checkbox" ? b.checked = !!
|
|
932
|
+
_ && b instanceof HTMLInputElement && b.type === "checkbox" ? b.checked = !!l : "value" in b && (b.value = l ?? ""), b.addEventListener("blur", () => {
|
|
929
933
|
const v = _ && b instanceof HTMLInputElement && b.type === "checkbox" ? b.checked : b.value;
|
|
930
934
|
c(v);
|
|
931
935
|
}), b.addEventListener("keydown", (v) => {
|
|
@@ -944,12 +948,12 @@ function H(t, e, o, n, i, r = !1) {
|
|
|
944
948
|
} else if (typeof w == "string") {
|
|
945
949
|
const p = document.createElement(w);
|
|
946
950
|
p.value = h, p.addEventListener("change", () => c(p.value)), d.appendChild(p), r || queueMicrotask(() => {
|
|
947
|
-
d.querySelector(
|
|
951
|
+
d.querySelector(q)?.focus({ preventScroll: !0 });
|
|
948
952
|
});
|
|
949
953
|
} else if (typeof w == "function") {
|
|
950
954
|
const p = w({ row: e, value: h, field: n.field, column: n, commit: c, cancel: f });
|
|
951
|
-
typeof p == "string" ? (d.innerHTML = p,
|
|
952
|
-
d.querySelector(
|
|
955
|
+
typeof p == "string" ? (d.innerHTML = p, Et(d, n, c)) : d.appendChild(p), r || queueMicrotask(() => {
|
|
956
|
+
d.querySelector(q)?.focus({ preventScroll: !0 });
|
|
953
957
|
});
|
|
954
958
|
} else if (w && typeof w == "object") {
|
|
955
959
|
const p = document.createElement("div");
|
|
@@ -966,7 +970,7 @@ function H(t, e, o, n, i, r = !1) {
|
|
|
966
970
|
);
|
|
967
971
|
}
|
|
968
972
|
}
|
|
969
|
-
function
|
|
973
|
+
function yt(t, e, o) {
|
|
970
974
|
t.dispatchEvent(new CustomEvent(e, { detail: o, bubbles: !0 }));
|
|
971
975
|
}
|
|
972
976
|
function De(t) {
|
|
@@ -975,38 +979,38 @@ function De(t) {
|
|
|
975
979
|
function ze(t) {
|
|
976
980
|
return Array.from(t._changedRowIndices);
|
|
977
981
|
}
|
|
978
|
-
function
|
|
979
|
-
t._changedRowIndices.clear(), e ||
|
|
982
|
+
function St(t, e) {
|
|
983
|
+
t._changedRowIndices.clear(), e || yt(t, "changed-rows-reset", {
|
|
980
984
|
rows: De(t),
|
|
981
985
|
indices: ze(t)
|
|
982
986
|
}), t._rowPool.forEach((o) => o.classList.remove("changed"));
|
|
983
987
|
}
|
|
984
|
-
function
|
|
985
|
-
if (t.effectiveConfig?.editOn === !1 || !t._columns.some((
|
|
988
|
+
function Rt(t, e, o) {
|
|
989
|
+
if (t.effectiveConfig?.editOn === !1 || !t._columns.some((l) => l.editable)) return;
|
|
986
990
|
const i = t._rows[e];
|
|
987
991
|
G(t, e, i);
|
|
988
992
|
const r = o.findRenderedRowElement(e);
|
|
989
|
-
r && (Array.from(r.children).forEach((
|
|
990
|
-
const a = t._visibleColumns[
|
|
993
|
+
r && (Array.from(r.children).forEach((l, s) => {
|
|
994
|
+
const a = t._visibleColumns[s];
|
|
991
995
|
if (a?.editable) {
|
|
992
|
-
const c =
|
|
996
|
+
const c = l;
|
|
993
997
|
c.classList.contains("editing") || H(t, i, e, a, c, !0);
|
|
994
998
|
}
|
|
995
999
|
}), setTimeout(() => {
|
|
996
|
-
let
|
|
997
|
-
if (
|
|
998
|
-
const
|
|
1000
|
+
let l = r.querySelector(`.cell[data-col="${t._focusCol}"]`);
|
|
1001
|
+
if (l?.classList.contains("editing") || (l = r.querySelector(".cell.editing")), l?.classList.contains("editing")) {
|
|
1002
|
+
const s = l.querySelector(q);
|
|
999
1003
|
try {
|
|
1000
|
-
|
|
1004
|
+
s?.focus({ preventScroll: !0 });
|
|
1001
1005
|
} catch {
|
|
1002
1006
|
}
|
|
1003
1007
|
}
|
|
1004
1008
|
}, 0));
|
|
1005
1009
|
}
|
|
1006
|
-
function
|
|
1010
|
+
function Tt(t) {
|
|
1007
1011
|
t._activeEditRows !== -1 && D(t, t._activeEditRows, !1);
|
|
1008
1012
|
}
|
|
1009
|
-
function
|
|
1013
|
+
function xt(t) {
|
|
1010
1014
|
t._activeEditRows !== -1 && D(t, t._activeEditRows, !0);
|
|
1011
1015
|
}
|
|
1012
1016
|
function oe(t, e) {
|
|
@@ -1015,17 +1019,17 @@ function oe(t, e) {
|
|
|
1015
1019
|
const i = t._rows[o], r = t._visibleColumns[n];
|
|
1016
1020
|
return !i || !r ? null : { rowIndex: o, colIndex: n, rowData: i, col: r };
|
|
1017
1021
|
}
|
|
1018
|
-
function
|
|
1022
|
+
function At(t, e) {
|
|
1019
1023
|
if (e.classList.contains("editing")) return;
|
|
1020
1024
|
const o = oe(t, e);
|
|
1021
1025
|
o && (t._focusRow = o.rowIndex, t._focusCol = o.colIndex, k(t));
|
|
1022
1026
|
}
|
|
1023
|
-
function
|
|
1027
|
+
function Lt(t, e, o) {
|
|
1024
1028
|
if (e.classList.contains("editing")) return;
|
|
1025
1029
|
const n = oe(t, e);
|
|
1026
1030
|
n && (o.stopPropagation(), t._focusRow = n.rowIndex, t._focusCol = n.colIndex, H(t, n.rowData, n.rowIndex, n.col, e));
|
|
1027
1031
|
}
|
|
1028
|
-
function
|
|
1032
|
+
function Pt(t, e, o) {
|
|
1029
1033
|
o.stopPropagation();
|
|
1030
1034
|
const n = oe(t, e);
|
|
1031
1035
|
if (!n) return;
|
|
@@ -1037,28 +1041,28 @@ function Lt(t, e, o) {
|
|
|
1037
1041
|
const i = t.findRenderedRowElement?.(n.rowIndex);
|
|
1038
1042
|
if (i) {
|
|
1039
1043
|
const r = i.children;
|
|
1040
|
-
for (let
|
|
1041
|
-
const
|
|
1042
|
-
|
|
1044
|
+
for (let l = 0; l < r.length; l++) {
|
|
1045
|
+
const s = t._visibleColumns[l];
|
|
1046
|
+
s && s.editable && H(t, n.rowData, n.rowIndex, s, r[l], !0);
|
|
1043
1047
|
}
|
|
1044
1048
|
queueMicrotask(() => {
|
|
1045
|
-
const
|
|
1046
|
-
if (
|
|
1047
|
-
const
|
|
1049
|
+
const l = i.querySelector(`.cell[data-col="${t._focusCol}"]`);
|
|
1050
|
+
if (l?.classList.contains("editing")) {
|
|
1051
|
+
const s = l.querySelector(q);
|
|
1048
1052
|
try {
|
|
1049
|
-
|
|
1053
|
+
s?.focus({ preventScroll: !0 });
|
|
1050
1054
|
} catch {
|
|
1051
1055
|
}
|
|
1052
1056
|
}
|
|
1053
1057
|
});
|
|
1054
1058
|
}
|
|
1055
1059
|
}
|
|
1056
|
-
function
|
|
1060
|
+
function Ht(t, e, o) {
|
|
1057
1061
|
const n = oe(t, e);
|
|
1058
1062
|
if (!n) return;
|
|
1059
|
-
const { rowIndex: i, colIndex: r, rowData:
|
|
1060
|
-
if ((
|
|
1061
|
-
o.preventDefault(), t._activeEditRows !== i && G(t, i,
|
|
1063
|
+
const { rowIndex: i, colIndex: r, rowData: l, col: s } = n, a = e.classList.contains("editing");
|
|
1064
|
+
if ((s.type === "select" || s.type === "typeahead") && !a && o.key === "Enter") {
|
|
1065
|
+
o.preventDefault(), t._activeEditRows !== i && G(t, i, l), H(t, l, i, s, e), setTimeout(() => {
|
|
1062
1066
|
const c = e.querySelector("select");
|
|
1063
1067
|
try {
|
|
1064
1068
|
c?.showPicker?.();
|
|
@@ -1068,44 +1072,44 @@ function Pt(t, e, o) {
|
|
|
1068
1072
|
}, 0);
|
|
1069
1073
|
return;
|
|
1070
1074
|
}
|
|
1071
|
-
if (
|
|
1072
|
-
o.preventDefault(), t._activeEditRows !== i && G(t, i,
|
|
1073
|
-
const c = !s
|
|
1074
|
-
ce(t, i,
|
|
1075
|
+
if (s.type === "boolean" && o.key === " " && !a) {
|
|
1076
|
+
o.preventDefault(), t._activeEditRows !== i && G(t, i, l);
|
|
1077
|
+
const c = !l[s.field];
|
|
1078
|
+
ce(t, i, s, c, l), e.innerHTML = ae(!!c);
|
|
1075
1079
|
return;
|
|
1076
1080
|
}
|
|
1077
1081
|
if (o.key === "Enter" && !a) {
|
|
1078
|
-
o.preventDefault(), o.stopPropagation(), t._focusRow = i, t._focusCol = r, typeof t.beginBulkEdit == "function" ? t.beginBulkEdit(i) : H(t,
|
|
1082
|
+
o.preventDefault(), o.stopPropagation(), t._focusRow = i, t._focusCol = r, typeof t.beginBulkEdit == "function" ? t.beginBulkEdit(i) : H(t, l, i, s, e);
|
|
1079
1083
|
return;
|
|
1080
1084
|
}
|
|
1081
1085
|
if (o.key === "F2" && !a) {
|
|
1082
|
-
o.preventDefault(), H(t,
|
|
1086
|
+
o.preventDefault(), H(t, l, i, s, e);
|
|
1083
1087
|
return;
|
|
1084
1088
|
}
|
|
1085
1089
|
}
|
|
1086
|
-
function
|
|
1090
|
+
function Mt(t, e, o) {
|
|
1087
1091
|
const n = () => t.effectiveConfig?.editOn || t.editOn;
|
|
1088
1092
|
e.addEventListener(
|
|
1089
1093
|
"mousedown",
|
|
1090
1094
|
(i) => {
|
|
1091
1095
|
const r = i.target.closest(".cell[data-col]");
|
|
1092
1096
|
if (!r) return;
|
|
1093
|
-
const
|
|
1094
|
-
if (
|
|
1095
|
-
const
|
|
1096
|
-
|
|
1097
|
+
const l = X(r);
|
|
1098
|
+
if (l < 0) return;
|
|
1099
|
+
const s = t._visibleColumns[l];
|
|
1100
|
+
s && s.editable && At(t, r);
|
|
1097
1101
|
},
|
|
1098
1102
|
{ signal: o }
|
|
1099
1103
|
), e.addEventListener(
|
|
1100
1104
|
"click",
|
|
1101
1105
|
(i) => {
|
|
1102
1106
|
if (n() !== "click") return;
|
|
1103
|
-
const
|
|
1104
|
-
if (!
|
|
1105
|
-
const
|
|
1106
|
-
if (
|
|
1107
|
-
const a = t._visibleColumns[
|
|
1108
|
-
a && a.editable &&
|
|
1107
|
+
const l = i.target.closest(".cell[data-col]");
|
|
1108
|
+
if (!l) return;
|
|
1109
|
+
const s = X(l);
|
|
1110
|
+
if (s < 0) return;
|
|
1111
|
+
const a = t._visibleColumns[s];
|
|
1112
|
+
a && a.editable && Lt(t, l, i);
|
|
1109
1113
|
},
|
|
1110
1114
|
{ signal: o }
|
|
1111
1115
|
), e.addEventListener(
|
|
@@ -1113,12 +1117,12 @@ function Ht(t, e, o) {
|
|
|
1113
1117
|
(i) => {
|
|
1114
1118
|
const r = n();
|
|
1115
1119
|
if ((r === "dblclick" ? "dblClick" : r) === "click" || r === !1) return;
|
|
1116
|
-
const
|
|
1117
|
-
if (!
|
|
1118
|
-
const a = X(
|
|
1120
|
+
const s = i.target.closest(".cell[data-col]");
|
|
1121
|
+
if (!s) return;
|
|
1122
|
+
const a = X(s);
|
|
1119
1123
|
if (a < 0) return;
|
|
1120
1124
|
const c = t._visibleColumns[a];
|
|
1121
|
-
c && c.editable &&
|
|
1125
|
+
c && c.editable && Pt(t, s, i);
|
|
1122
1126
|
},
|
|
1123
1127
|
{ signal: o }
|
|
1124
1128
|
), e.addEventListener(
|
|
@@ -1126,20 +1130,20 @@ function Ht(t, e, o) {
|
|
|
1126
1130
|
(i) => {
|
|
1127
1131
|
const r = i.target.closest(".cell[data-col]");
|
|
1128
1132
|
if (!r) return;
|
|
1129
|
-
const
|
|
1130
|
-
if (
|
|
1131
|
-
const
|
|
1132
|
-
|
|
1133
|
+
const l = X(r);
|
|
1134
|
+
if (l < 0) return;
|
|
1135
|
+
const s = t._visibleColumns[l];
|
|
1136
|
+
s && s.editable && Ht(t, r, i);
|
|
1133
1137
|
},
|
|
1134
1138
|
{ signal: o }
|
|
1135
1139
|
);
|
|
1136
1140
|
}
|
|
1137
|
-
function
|
|
1141
|
+
function Ot(t, e) {
|
|
1138
1142
|
return t == null && e == null ? 0 : t == null ? -1 : e == null || t > e ? 1 : t < e ? -1 : 0;
|
|
1139
1143
|
}
|
|
1140
|
-
function
|
|
1141
|
-
const i = o.find((
|
|
1142
|
-
return [...t].sort((
|
|
1144
|
+
function kt(t, e, o) {
|
|
1145
|
+
const i = o.find((s) => s.field === e.field)?.sortComparator ?? Ot, { field: r, direction: l } = e;
|
|
1146
|
+
return [...t].sort((s, a) => i(s[r], a[r], s, a) * l);
|
|
1143
1147
|
}
|
|
1144
1148
|
function ge(t, e, o, n) {
|
|
1145
1149
|
t._rows = e, t.__rowRenderEpoch++, t._rowPool.forEach((i) => i.__epoch = -1), F(t), t.refreshVirtualWindow(!0), t.dispatchEvent(
|
|
@@ -1155,12 +1159,12 @@ function me(t, e) {
|
|
|
1155
1159
|
}
|
|
1156
1160
|
function ve(t, e, o) {
|
|
1157
1161
|
t._sortState = { field: e.field, direction: o };
|
|
1158
|
-
const n = { field: e.field, direction: o }, i = t._columns,
|
|
1159
|
-
|
|
1160
|
-
ge(t,
|
|
1161
|
-
}) : ge(t,
|
|
1162
|
+
const n = { field: e.field, direction: o }, i = t._columns, l = (t.effectiveConfig?.sortHandler ?? kt)(t._rows, n, i);
|
|
1163
|
+
l && typeof l.then == "function" ? l.then((s) => {
|
|
1164
|
+
ge(t, s, e, o);
|
|
1165
|
+
}) : ge(t, l, e, o);
|
|
1162
1166
|
}
|
|
1163
|
-
function
|
|
1167
|
+
function Dt(t, e) {
|
|
1164
1168
|
typeof e == "string" ? t.textContent = e : e instanceof HTMLElement && (t.innerHTML = "", t.appendChild(e.cloneNode(!0)));
|
|
1165
1169
|
}
|
|
1166
1170
|
function F(t) {
|
|
@@ -1170,17 +1174,17 @@ function F(t) {
|
|
|
1170
1174
|
const i = document.createElement("div");
|
|
1171
1175
|
i.className = "cell", fe(i, "header-cell"), i.setAttribute("role", "columnheader"), i.setAttribute("aria-colindex", String(n + 1)), i.setAttribute("data-field", o.field), i.setAttribute("data-col", String(n));
|
|
1172
1176
|
const r = o.__headerTemplate;
|
|
1173
|
-
if (r) Array.from(r.childNodes).forEach((
|
|
1177
|
+
if (r) Array.from(r.childNodes).forEach((l) => i.appendChild(l.cloneNode(!0)));
|
|
1174
1178
|
else {
|
|
1175
|
-
const
|
|
1176
|
-
|
|
1179
|
+
const l = o.header || o.field, s = document.createElement("span");
|
|
1180
|
+
s.textContent = l, i.appendChild(s);
|
|
1177
1181
|
}
|
|
1178
1182
|
if (o.sortable) {
|
|
1179
1183
|
i.classList.add("sortable"), i.tabIndex = 0;
|
|
1180
|
-
const
|
|
1181
|
-
fe(
|
|
1182
|
-
const
|
|
1183
|
-
|
|
1184
|
+
const l = document.createElement("span");
|
|
1185
|
+
fe(l, "sort-indicator");
|
|
1186
|
+
const s = t._sortState?.field === o.field ? t._sortState.direction : 0, a = { ...O, ...t.icons }, c = s === 1 ? a.sortAsc : s === -1 ? a.sortDesc : a.sortNone;
|
|
1187
|
+
Dt(l, c), i.appendChild(l), i.setAttribute("aria-sort", s === 0 ? "none" : s === 1 ? "ascending" : "descending"), i.addEventListener("click", (f) => {
|
|
1184
1188
|
t._resizeController?.isResizing || t._dispatchHeaderClick?.(f, n, i) || me(t, o);
|
|
1185
1189
|
}), i.addEventListener("keydown", (f) => {
|
|
1186
1190
|
if (f.key === "Enter" || f.key === " ") {
|
|
@@ -1191,12 +1195,12 @@ function F(t) {
|
|
|
1191
1195
|
}
|
|
1192
1196
|
if (o.resizable) {
|
|
1193
1197
|
i.style.position = "relative";
|
|
1194
|
-
const
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
}),
|
|
1198
|
-
|
|
1199
|
-
}), i.appendChild(
|
|
1198
|
+
const l = document.createElement("div");
|
|
1199
|
+
l.className = "resize-handle", l.setAttribute("aria-hidden", "true"), l.addEventListener("mousedown", (s) => {
|
|
1200
|
+
s.stopPropagation(), s.preventDefault(), t._resizeController.start(s, n, i);
|
|
1201
|
+
}), l.addEventListener("dblclick", (s) => {
|
|
1202
|
+
s.stopPropagation(), s.preventDefault(), t._resizeController.resetColumn(n);
|
|
1203
|
+
}), i.appendChild(l);
|
|
1200
1204
|
}
|
|
1201
1205
|
e.appendChild(i);
|
|
1202
1206
|
}), e.querySelectorAll(".cell.sortable").forEach((o) => {
|
|
@@ -1204,7 +1208,7 @@ function F(t) {
|
|
|
1204
1208
|
}), e.children.length > 0 ? (e.setAttribute("role", "row"), e.setAttribute("aria-rowindex", "1")) : (e.removeAttribute("role"), e.removeAttribute("aria-rowindex"));
|
|
1205
1209
|
}
|
|
1206
1210
|
const Ne = typeof requestIdleCallback == "function";
|
|
1207
|
-
function
|
|
1211
|
+
function zt(t, e) {
|
|
1208
1212
|
return Ne ? requestIdleCallback(t, e) : window.setTimeout(() => {
|
|
1209
1213
|
const o = Date.now();
|
|
1210
1214
|
t({
|
|
@@ -1216,7 +1220,7 @@ function Dt(t, e) {
|
|
|
1216
1220
|
function _e(t) {
|
|
1217
1221
|
Ne ? cancelIdleCallback(t) : clearTimeout(t);
|
|
1218
1222
|
}
|
|
1219
|
-
function
|
|
1223
|
+
function Nt(t) {
|
|
1220
1224
|
let e = null, o = null, n = null, i = null;
|
|
1221
1225
|
const r = (a) => {
|
|
1222
1226
|
if (!e) return;
|
|
@@ -1227,21 +1231,21 @@ function zt(t) {
|
|
|
1227
1231
|
new CustomEvent("column-resize", { detail: { field: d.field, width: f } })
|
|
1228
1232
|
);
|
|
1229
1233
|
};
|
|
1230
|
-
let
|
|
1231
|
-
const
|
|
1234
|
+
let l = !1;
|
|
1235
|
+
const s = () => {
|
|
1232
1236
|
const a = e !== null;
|
|
1233
|
-
a && (
|
|
1234
|
-
|
|
1235
|
-
})), window.removeEventListener("mousemove", r), window.removeEventListener("mouseup",
|
|
1237
|
+
a && (l = !0, requestAnimationFrame(() => {
|
|
1238
|
+
l = !1;
|
|
1239
|
+
})), window.removeEventListener("mousemove", r), window.removeEventListener("mouseup", s), n !== null && (document.documentElement.style.cursor = n, n = null), i !== null && (document.body.style.userSelect = i, i = null), e = null, a && t.requestStateChange && t.requestStateChange();
|
|
1236
1240
|
};
|
|
1237
1241
|
return {
|
|
1238
1242
|
get isResizing() {
|
|
1239
|
-
return e !== null ||
|
|
1243
|
+
return e !== null || l;
|
|
1240
1244
|
},
|
|
1241
1245
|
start(a, c, f) {
|
|
1242
1246
|
a.preventDefault();
|
|
1243
1247
|
const d = f.getBoundingClientRect();
|
|
1244
|
-
e = { startX: a.clientX, colIndex: c, startWidth: d.width }, window.addEventListener("mousemove", r), window.addEventListener("mouseup",
|
|
1248
|
+
e = { startX: a.clientX, colIndex: c, startWidth: d.width }, window.addEventListener("mousemove", r), window.addEventListener("mouseup", s), n === null && (n = document.documentElement.style.cursor), document.documentElement.style.cursor = "e-resize", i === null && (i = document.body.style.userSelect), document.body.style.userSelect = "none";
|
|
1245
1249
|
},
|
|
1246
1250
|
resetColumn(a) {
|
|
1247
1251
|
const c = t._visibleColumns[a];
|
|
@@ -1250,7 +1254,7 @@ function zt(t) {
|
|
|
1250
1254
|
));
|
|
1251
1255
|
},
|
|
1252
1256
|
dispose() {
|
|
1253
|
-
|
|
1257
|
+
s();
|
|
1254
1258
|
}
|
|
1255
1259
|
};
|
|
1256
1260
|
}
|
|
@@ -1285,8 +1289,8 @@ function Ce(t) {
|
|
|
1285
1289
|
const e = document.createElement("slot");
|
|
1286
1290
|
return t && (e.name = t), e;
|
|
1287
1291
|
}
|
|
1288
|
-
const
|
|
1289
|
-
|
|
1292
|
+
const qe = document.createElement("template");
|
|
1293
|
+
qe.innerHTML = `
|
|
1290
1294
|
<div class="tbw-scroll-area">
|
|
1291
1295
|
<div class="rows-body-wrapper">
|
|
1292
1296
|
<div class="rows-body" role="grid">
|
|
@@ -1305,8 +1309,8 @@ Be.innerHTML = `
|
|
|
1305
1309
|
<div class="faux-vscroll-spacer"></div>
|
|
1306
1310
|
</div>
|
|
1307
1311
|
`;
|
|
1308
|
-
function
|
|
1309
|
-
return
|
|
1312
|
+
function Be() {
|
|
1313
|
+
return qe.content.cloneNode(!0);
|
|
1310
1314
|
}
|
|
1311
1315
|
function Ee(t) {
|
|
1312
1316
|
const e = document.createDocumentFragment(), o = T(t.hasShell ? "tbw-grid-root has-shell" : "tbw-grid-root");
|
|
@@ -1314,11 +1318,11 @@ function Ee(t) {
|
|
|
1314
1318
|
o.appendChild(t.shellHeader), o.appendChild(t.shellBody);
|
|
1315
1319
|
else {
|
|
1316
1320
|
const n = T("tbw-grid-content");
|
|
1317
|
-
n.appendChild(
|
|
1321
|
+
n.appendChild(Be()), o.appendChild(n);
|
|
1318
1322
|
}
|
|
1319
1323
|
return e.appendChild(o), e;
|
|
1320
1324
|
}
|
|
1321
|
-
function
|
|
1325
|
+
function It(t) {
|
|
1322
1326
|
const e = T("tbw-shell-header", { part: "shell-header", role: "presentation" });
|
|
1323
1327
|
if (t.title) {
|
|
1324
1328
|
const r = T("tbw-shell-title");
|
|
@@ -1343,9 +1347,9 @@ function Nt(t) {
|
|
|
1343
1347
|
}
|
|
1344
1348
|
return e.appendChild(n), e;
|
|
1345
1349
|
}
|
|
1346
|
-
function
|
|
1350
|
+
function qt(t) {
|
|
1347
1351
|
const e = T("tbw-shell-body"), o = t.panels.length > 0, n = t.panels.length === 1, i = T("tbw-grid-content");
|
|
1348
|
-
i.appendChild(
|
|
1352
|
+
i.appendChild(Be());
|
|
1349
1353
|
let r = null;
|
|
1350
1354
|
if (o) {
|
|
1351
1355
|
r = Z("aside", {
|
|
@@ -1355,15 +1359,15 @@ function It(t) {
|
|
|
1355
1359
|
role: "presentation",
|
|
1356
1360
|
id: "tbw-tool-panel"
|
|
1357
1361
|
});
|
|
1358
|
-
const
|
|
1362
|
+
const l = t.position === "left" ? "right" : "left";
|
|
1359
1363
|
r.appendChild(
|
|
1360
1364
|
T("tbw-tool-panel-resize", {
|
|
1361
1365
|
"data-resize-handle": "",
|
|
1362
|
-
"data-handle-position":
|
|
1366
|
+
"data-handle-position": l,
|
|
1363
1367
|
"aria-hidden": "true"
|
|
1364
1368
|
})
|
|
1365
1369
|
);
|
|
1366
|
-
const
|
|
1370
|
+
const s = T("tbw-tool-panel-content", { role: "presentation" }), a = T("tbw-accordion");
|
|
1367
1371
|
for (const c of t.panels) {
|
|
1368
1372
|
const f = `tbw-accordion-section${c.isExpanded ? " expanded" : ""}${n ? " single" : ""}`, d = T(f, { "data-section": c.id }), u = Ie("tbw-accordion-header", {
|
|
1369
1373
|
"aria-expanded": String(c.isExpanded),
|
|
@@ -1385,7 +1389,7 @@ function It(t) {
|
|
|
1385
1389
|
})
|
|
1386
1390
|
), a.appendChild(d);
|
|
1387
1391
|
}
|
|
1388
|
-
|
|
1392
|
+
s.appendChild(a), r.appendChild(s);
|
|
1389
1393
|
}
|
|
1390
1394
|
return t.position === "left" && r ? (e.appendChild(r), e.appendChild(i)) : (e.appendChild(i), r && e.appendChild(r)), e;
|
|
1391
1395
|
}
|
|
@@ -1413,7 +1417,7 @@ function We(t, e) {
|
|
|
1413
1417
|
return !!(t?.header?.title || e.lightDomTitle || t?.header?.toolbarButtons?.length || e.toolPanels.size > 0 || e.headerContents.size > 0 || e.toolbarButtons.size > 0 || e.lightDomHeaderContent.length > 0 || e.hasToolButtonsContainer);
|
|
1414
1418
|
}
|
|
1415
1419
|
function ye(t, e, o = "☰") {
|
|
1416
|
-
const n = t?.header?.title ?? e.lightDomTitle ?? "", i = !!n, r = N(o),
|
|
1420
|
+
const n = t?.header?.title ?? e.lightDomTitle ?? "", i = !!n, r = N(o), l = t?.header?.toolbarButtons ?? [], s = l.some((p) => p.element || p.render), a = [...e.toolbarButtons.values()].some((p) => p.element || p.render), c = e.toolPanels.size > 0, d = (s || a) && c, u = [...l].sort((p, g) => (p.order ?? 100) - (g.order ?? 100)), w = [...e.toolbarButtons.values()].sort((p, g) => (p.order ?? 100) - (g.order ?? 100));
|
|
1417
1421
|
let h = "";
|
|
1418
1422
|
for (const p of u)
|
|
1419
1423
|
(p.element || p.render) && (h += `<div class="tbw-toolbar-btn-slot" data-btn-slot="${p.id}"></div>`);
|
|
@@ -1425,7 +1429,7 @@ function ye(t, e, o = "☰") {
|
|
|
1425
1429
|
}
|
|
1426
1430
|
return `
|
|
1427
1431
|
<div class="tbw-shell-header" part="shell-header" role="presentation">
|
|
1428
|
-
${i ? `<div class="tbw-shell-title">${n}</div>` : ""}
|
|
1432
|
+
${i ? `<div class="tbw-shell-title">${it(n)}</div>` : ""}
|
|
1429
1433
|
<div class="tbw-shell-content" part="shell-content" role="presentation">
|
|
1430
1434
|
<slot name="header-content"></slot>
|
|
1431
1435
|
</div>
|
|
@@ -1435,7 +1439,7 @@ function ye(t, e, o = "☰") {
|
|
|
1435
1439
|
</div>
|
|
1436
1440
|
`;
|
|
1437
1441
|
}
|
|
1438
|
-
function
|
|
1442
|
+
function B(t, e) {
|
|
1439
1443
|
const o = t.querySelector("tbw-grid-header");
|
|
1440
1444
|
if (!o) return;
|
|
1441
1445
|
if (!e.lightDomTitle) {
|
|
@@ -1453,10 +1457,10 @@ function W(t, e) {
|
|
|
1453
1457
|
}
|
|
1454
1458
|
function V(t, e, o) {
|
|
1455
1459
|
t.querySelectorAll(":scope > tbw-grid-tool-panel").forEach((i) => {
|
|
1456
|
-
const r = i,
|
|
1457
|
-
if (!
|
|
1460
|
+
const r = i, l = r.getAttribute("id"), s = r.getAttribute("title");
|
|
1461
|
+
if (!l || !s) {
|
|
1458
1462
|
console.warn(
|
|
1459
|
-
`[parseLightDomToolPanels] Tool panel missing required id or title attribute: id="${
|
|
1463
|
+
`[parseLightDomToolPanels] Tool panel missing required id or title attribute: id="${l ?? ""}", title="${s ?? ""}"`
|
|
1460
1464
|
);
|
|
1461
1465
|
return;
|
|
1462
1466
|
}
|
|
@@ -1472,60 +1476,60 @@ function V(t, e, o) {
|
|
|
1472
1476
|
return b.innerHTML = p, g.appendChild(b), () => b.remove();
|
|
1473
1477
|
};
|
|
1474
1478
|
}
|
|
1475
|
-
const w = e.toolPanels.get(
|
|
1479
|
+
const w = e.toolPanels.get(l);
|
|
1476
1480
|
if (w) {
|
|
1477
1481
|
if (u) {
|
|
1478
1482
|
w.render = d, w.order = f, w.icon = a, w.tooltip = c;
|
|
1479
|
-
const p = e.panelCleanups.get(
|
|
1480
|
-
p && (p(), e.panelCleanups.delete(
|
|
1483
|
+
const p = e.panelCleanups.get(l);
|
|
1484
|
+
p && (p(), e.panelCleanups.delete(l));
|
|
1481
1485
|
}
|
|
1482
1486
|
return;
|
|
1483
1487
|
}
|
|
1484
1488
|
const h = {
|
|
1485
|
-
id:
|
|
1486
|
-
title:
|
|
1489
|
+
id: l,
|
|
1490
|
+
title: s,
|
|
1487
1491
|
icon: a,
|
|
1488
1492
|
tooltip: c,
|
|
1489
1493
|
order: f,
|
|
1490
1494
|
render: d
|
|
1491
1495
|
};
|
|
1492
|
-
e.toolPanels.set(
|
|
1496
|
+
e.toolPanels.set(l, h), e.lightDomToolPanelIds.add(l), r.style.display = "none";
|
|
1493
1497
|
});
|
|
1494
1498
|
}
|
|
1495
|
-
function
|
|
1499
|
+
function Wt(t, e, o, n) {
|
|
1496
1500
|
const i = t.querySelector(".tbw-shell-toolbar");
|
|
1497
|
-
i && i.addEventListener("click", (
|
|
1498
|
-
const
|
|
1499
|
-
if (
|
|
1501
|
+
i && i.addEventListener("click", (l) => {
|
|
1502
|
+
const s = l.target;
|
|
1503
|
+
if (s.closest("[data-panel-toggle]")) {
|
|
1500
1504
|
n.onPanelToggle();
|
|
1501
1505
|
return;
|
|
1502
1506
|
}
|
|
1503
|
-
const c =
|
|
1507
|
+
const c = s.closest("[data-btn]");
|
|
1504
1508
|
if (c) {
|
|
1505
1509
|
const f = c.getAttribute("data-btn");
|
|
1506
1510
|
f && n.onToolbarButtonClick(f);
|
|
1507
1511
|
}
|
|
1508
1512
|
});
|
|
1509
1513
|
const r = t.querySelector(".tbw-accordion");
|
|
1510
|
-
r && r.addEventListener("click", (
|
|
1511
|
-
const a =
|
|
1514
|
+
r && r.addEventListener("click", (l) => {
|
|
1515
|
+
const a = l.target.closest(".tbw-accordion-header");
|
|
1512
1516
|
if (a) {
|
|
1513
1517
|
const f = a.closest("[data-section]")?.getAttribute("data-section");
|
|
1514
1518
|
f && n.onSectionToggle(f);
|
|
1515
1519
|
}
|
|
1516
1520
|
});
|
|
1517
1521
|
}
|
|
1518
|
-
function
|
|
1522
|
+
function Vt(t, e, o) {
|
|
1519
1523
|
const n = t.querySelector(".tbw-tool-panel"), i = t.querySelector("[data-resize-handle]"), r = t.querySelector(".tbw-shell-body");
|
|
1520
1524
|
if (!n || !i || !r)
|
|
1521
1525
|
return () => {
|
|
1522
1526
|
};
|
|
1523
|
-
const
|
|
1527
|
+
const l = e?.toolPanel?.position ?? "right", s = 200;
|
|
1524
1528
|
let a = 0, c = 0, f = 0, d = !1;
|
|
1525
1529
|
const u = (p) => {
|
|
1526
1530
|
if (!d) return;
|
|
1527
1531
|
p.preventDefault();
|
|
1528
|
-
const g =
|
|
1532
|
+
const g = l === "left" ? p.clientX - a : a - p.clientX, b = Math.min(f, Math.max(s, c + g));
|
|
1529
1533
|
n.style.width = `${b}px`;
|
|
1530
1534
|
}, w = () => {
|
|
1531
1535
|
if (!d) return;
|
|
@@ -1539,46 +1543,46 @@ function Wt(t, e, o) {
|
|
|
1539
1543
|
i.removeEventListener("mousedown", h), document.removeEventListener("mousemove", u), document.removeEventListener("mouseup", w);
|
|
1540
1544
|
};
|
|
1541
1545
|
}
|
|
1542
|
-
function
|
|
1546
|
+
function $t(t, e, o) {
|
|
1543
1547
|
const n = [...e?.header?.toolbarButtons ?? [], ...o.toolbarButtons.values()];
|
|
1544
1548
|
for (const i of n) {
|
|
1545
1549
|
const r = t.querySelector(`[data-btn-slot="${i.id}"]`);
|
|
1546
1550
|
if (!r) continue;
|
|
1547
|
-
const
|
|
1548
|
-
if (
|
|
1551
|
+
const l = o.toolbarButtonCleanups.get(i.id);
|
|
1552
|
+
if (l && (l(), o.toolbarButtonCleanups.delete(i.id)), i.element)
|
|
1549
1553
|
r.appendChild(i.element);
|
|
1550
1554
|
else if (i.render) {
|
|
1551
|
-
const
|
|
1552
|
-
|
|
1555
|
+
const s = i.render(r);
|
|
1556
|
+
s && o.toolbarButtonCleanups.set(i.id, s);
|
|
1553
1557
|
}
|
|
1554
1558
|
}
|
|
1555
1559
|
}
|
|
1556
1560
|
function Ve(t, e) {
|
|
1557
1561
|
const o = t.querySelector(".tbw-shell-content");
|
|
1558
1562
|
if (!o) return;
|
|
1559
|
-
const n = [...e.headerContents.values()].sort((r,
|
|
1563
|
+
const n = [...e.headerContents.values()].sort((r, l) => (r.order ?? 100) - (l.order ?? 100)), i = o.querySelector('slot[name="header-content"]');
|
|
1560
1564
|
for (const r of n) {
|
|
1561
|
-
const
|
|
1562
|
-
|
|
1563
|
-
let
|
|
1564
|
-
|
|
1565
|
-
const a = r.render(
|
|
1565
|
+
const l = e.headerContentCleanups.get(r.id);
|
|
1566
|
+
l && (l(), e.headerContentCleanups.delete(r.id));
|
|
1567
|
+
let s = o.querySelector(`[data-header-content="${r.id}"]`);
|
|
1568
|
+
s || (s = document.createElement("div"), s.setAttribute("data-header-content", r.id), i ? o.insertBefore(s, i) : o.appendChild(s));
|
|
1569
|
+
const a = r.render(s);
|
|
1566
1570
|
a && e.headerContentCleanups.set(r.id, a);
|
|
1567
1571
|
}
|
|
1568
1572
|
}
|
|
1569
|
-
function
|
|
1573
|
+
function Ft(t, e, o) {
|
|
1570
1574
|
if (!e.isPanelOpen) return;
|
|
1571
1575
|
const n = N(o?.expand ?? O.expand), i = N(o?.collapse ?? O.collapse);
|
|
1572
|
-
for (const [r,
|
|
1573
|
-
const
|
|
1576
|
+
for (const [r, l] of e.toolPanels) {
|
|
1577
|
+
const s = e.expandedSections.has(r), a = t.querySelector(`[data-section="${r}"]`), c = a?.querySelector(".tbw-accordion-content");
|
|
1574
1578
|
if (!a || !c) continue;
|
|
1575
|
-
a.classList.toggle("expanded",
|
|
1579
|
+
a.classList.toggle("expanded", s);
|
|
1576
1580
|
const f = a.querySelector(".tbw-accordion-header");
|
|
1577
|
-
f && f.setAttribute("aria-expanded", String(
|
|
1581
|
+
f && f.setAttribute("aria-expanded", String(s));
|
|
1578
1582
|
const d = a.querySelector(".tbw-accordion-chevron");
|
|
1579
|
-
if (d && (d.innerHTML =
|
|
1583
|
+
if (d && (d.innerHTML = s ? i : n), s) {
|
|
1580
1584
|
if (c.children.length === 0) {
|
|
1581
|
-
const u =
|
|
1585
|
+
const u = l.render(c);
|
|
1582
1586
|
u && e.panelCleanups.set(r, u);
|
|
1583
1587
|
}
|
|
1584
1588
|
} else {
|
|
@@ -1595,7 +1599,7 @@ function Re(t, e) {
|
|
|
1595
1599
|
const o = t.querySelector(".tbw-tool-panel");
|
|
1596
1600
|
o && (o.classList.toggle("open", e.isPanelOpen), e.isPanelOpen || (o.style.width = ""));
|
|
1597
1601
|
}
|
|
1598
|
-
function
|
|
1602
|
+
function Gt(t, e) {
|
|
1599
1603
|
const o = [];
|
|
1600
1604
|
for (const n of t?.header?.toolbarButtons ?? [])
|
|
1601
1605
|
o.push({
|
|
@@ -1618,7 +1622,7 @@ function Ft(t, e) {
|
|
|
1618
1622
|
});
|
|
1619
1623
|
return o;
|
|
1620
1624
|
}
|
|
1621
|
-
function
|
|
1625
|
+
function Ut(t) {
|
|
1622
1626
|
for (const e of t.headerContentCleanups.values())
|
|
1623
1627
|
e();
|
|
1624
1628
|
t.headerContentCleanups.clear();
|
|
@@ -1632,7 +1636,7 @@ function Gt(t) {
|
|
|
1632
1636
|
t.toolPanels.get(e)?.onClose?.();
|
|
1633
1637
|
t.isPanelOpen = !1, t.expandedSections.clear(), t.toolPanels.clear(), t.headerContents.clear(), t.toolbarButtons.clear(), t.lightDomHeaderContent = [];
|
|
1634
1638
|
}
|
|
1635
|
-
function
|
|
1639
|
+
function Xt(t, e) {
|
|
1636
1640
|
let o = !1;
|
|
1637
1641
|
const n = {
|
|
1638
1642
|
get isInitialized() {
|
|
@@ -1657,11 +1661,11 @@ function Ut(t, e) {
|
|
|
1657
1661
|
return;
|
|
1658
1662
|
}
|
|
1659
1663
|
if (t.isPanelOpen = !0, t.expandedSections.size === 0 && t.toolPanels.size > 0) {
|
|
1660
|
-
const
|
|
1661
|
-
|
|
1664
|
+
const l = [...t.toolPanels.values()].sort((s, a) => (s.order ?? 100) - (a.order ?? 100))[0];
|
|
1665
|
+
l && t.expandedSections.add(l.id);
|
|
1662
1666
|
}
|
|
1663
1667
|
const i = e.getShadow();
|
|
1664
|
-
Se(i, t), Re(i, t),
|
|
1668
|
+
Se(i, t), Re(i, t), Ft(i, t, e.getAccordionIcons()), e.emit("tool-panel-open", { sections: n.expandedSections });
|
|
1665
1669
|
},
|
|
1666
1670
|
closeToolPanel() {
|
|
1667
1671
|
if (!t.isPanelOpen) return;
|
|
@@ -1685,21 +1689,21 @@ function Ut(t, e) {
|
|
|
1685
1689
|
}
|
|
1686
1690
|
if (t.toolPanels.size === 1)
|
|
1687
1691
|
return;
|
|
1688
|
-
const
|
|
1689
|
-
if (
|
|
1692
|
+
const l = e.getShadow(), s = t.expandedSections.has(i);
|
|
1693
|
+
if (s) {
|
|
1690
1694
|
const a = t.panelCleanups.get(i);
|
|
1691
|
-
a && (a(), t.panelCleanups.delete(i)), r.onClose?.(), t.expandedSections.delete(i), ie(
|
|
1695
|
+
a && (a(), t.panelCleanups.delete(i)), r.onClose?.(), t.expandedSections.delete(i), ie(l, i, !1);
|
|
1692
1696
|
} else {
|
|
1693
1697
|
for (const [a, c] of t.toolPanels)
|
|
1694
1698
|
if (a !== i && t.expandedSections.has(a)) {
|
|
1695
1699
|
const f = t.panelCleanups.get(a);
|
|
1696
|
-
f && (f(), t.panelCleanups.delete(a)), c.onClose?.(), t.expandedSections.delete(a), ie(
|
|
1697
|
-
const d =
|
|
1700
|
+
f && (f(), t.panelCleanups.delete(a)), c.onClose?.(), t.expandedSections.delete(a), ie(l, a, !1);
|
|
1701
|
+
const d = l.querySelector(`[data-section="${a}"] .tbw-accordion-content`);
|
|
1698
1702
|
d && (d.innerHTML = "");
|
|
1699
1703
|
}
|
|
1700
|
-
t.expandedSections.add(i), ie(
|
|
1704
|
+
t.expandedSections.add(i), ie(l, i, !0), Yt(l, t, i);
|
|
1701
1705
|
}
|
|
1702
|
-
e.emit("tool-panel-section-toggle", { id: i, expanded: !
|
|
1706
|
+
e.emit("tool-panel-section-toggle", { id: i, expanded: !s });
|
|
1703
1707
|
},
|
|
1704
1708
|
getToolPanels() {
|
|
1705
1709
|
return [...t.toolPanels.values()];
|
|
@@ -1733,7 +1737,7 @@ function Ut(t, e) {
|
|
|
1733
1737
|
r && (r(), t.headerContentCleanups.delete(i)), t.headerContents.get(i)?.onDestroy?.(), t.headerContents.delete(i), e.getShadow().querySelector(`[data-header-content="${i}"]`)?.remove();
|
|
1734
1738
|
},
|
|
1735
1739
|
getToolbarButtons() {
|
|
1736
|
-
return
|
|
1740
|
+
return Gt(e.getShellConfig(), t);
|
|
1737
1741
|
},
|
|
1738
1742
|
registerToolbarButton(i) {
|
|
1739
1743
|
if (t.toolbarButtons.has(i.id)) {
|
|
@@ -1761,7 +1765,7 @@ function ie(t, e, o) {
|
|
|
1761
1765
|
const n = t.querySelector(`[data-section="${e}"]`);
|
|
1762
1766
|
n && n.classList.toggle("expanded", o);
|
|
1763
1767
|
}
|
|
1764
|
-
function
|
|
1768
|
+
function Yt(t, e, o) {
|
|
1765
1769
|
const n = e.toolPanels.get(o);
|
|
1766
1770
|
if (!n?.render) return;
|
|
1767
1771
|
const i = t.querySelector(`[data-section="${o}"] .tbw-accordion-content`);
|
|
@@ -1769,10 +1773,10 @@ function Xt(t, e, o) {
|
|
|
1769
1773
|
const r = n.render(i);
|
|
1770
1774
|
r && e.panelCleanups.set(o, r);
|
|
1771
1775
|
}
|
|
1772
|
-
function
|
|
1776
|
+
function jt(t, e, o, n) {
|
|
1773
1777
|
const i = We(e, o);
|
|
1774
1778
|
if (t.replaceChildren(), i) {
|
|
1775
|
-
const r = N(n?.toolPanel ?? O.toolPanel),
|
|
1779
|
+
const r = N(n?.toolPanel ?? O.toolPanel), l = N(n?.expand ?? O.expand), s = N(n?.collapse ?? O.collapse), c = [...e?.header?.toolbarButtons ?? []].sort((b, _) => (b.order ?? 100) - (_.order ?? 100)), f = [...o.toolbarButtons.values()].sort((b, _) => (b.order ?? 100) - (_.order ?? 100)), d = {
|
|
1776
1780
|
title: e?.header?.title ?? o.lightDomTitle ?? void 0,
|
|
1777
1781
|
hasPanels: o.toolPanels.size > 0,
|
|
1778
1782
|
isPanelOpen: o.isPanelOpen,
|
|
@@ -1790,15 +1794,15 @@ function Yt(t, e, o, n) {
|
|
|
1790
1794
|
}, u = [...o.toolPanels.values()].sort((b, _) => (b.order ?? 100) - (_.order ?? 100)), w = {
|
|
1791
1795
|
position: e?.toolPanel?.position ?? "right",
|
|
1792
1796
|
isPanelOpen: o.isPanelOpen,
|
|
1793
|
-
expandIcon:
|
|
1794
|
-
collapseIcon:
|
|
1797
|
+
expandIcon: l,
|
|
1798
|
+
collapseIcon: s,
|
|
1795
1799
|
panels: u.map((b) => ({
|
|
1796
1800
|
id: b.id,
|
|
1797
1801
|
title: b.title,
|
|
1798
1802
|
icon: N(b.icon),
|
|
1799
1803
|
isExpanded: o.expandedSections.has(b.id)
|
|
1800
1804
|
}))
|
|
1801
|
-
}, h =
|
|
1805
|
+
}, h = It(d), p = qt(w), g = Ee({
|
|
1802
1806
|
hasShell: !0,
|
|
1803
1807
|
shellHeader: h,
|
|
1804
1808
|
shellBody: p
|
|
@@ -1810,7 +1814,7 @@ function Yt(t, e, o, n) {
|
|
|
1810
1814
|
}
|
|
1811
1815
|
return i;
|
|
1812
1816
|
}
|
|
1813
|
-
function
|
|
1817
|
+
function Kt() {
|
|
1814
1818
|
return {
|
|
1815
1819
|
startY: null,
|
|
1816
1820
|
startX: null,
|
|
@@ -1824,59 +1828,59 @@ function jt() {
|
|
|
1824
1828
|
momentumRaf: 0
|
|
1825
1829
|
};
|
|
1826
1830
|
}
|
|
1827
|
-
function
|
|
1831
|
+
function Zt(t) {
|
|
1828
1832
|
t.startY = null, t.startX = null, t.scrollTop = null, t.scrollLeft = null, t.lastY = null, t.lastX = null, t.lastTime = null;
|
|
1829
1833
|
}
|
|
1830
1834
|
function $e(t) {
|
|
1831
1835
|
t.momentumRaf && (cancelAnimationFrame(t.momentumRaf), t.momentumRaf = 0);
|
|
1832
1836
|
}
|
|
1833
|
-
function
|
|
1837
|
+
function Jt(t, e, o) {
|
|
1834
1838
|
if (t.touches.length !== 1) return;
|
|
1835
1839
|
$e(e);
|
|
1836
1840
|
const n = t.touches[0];
|
|
1837
1841
|
e.startY = n.clientY, e.startX = n.clientX, e.lastY = n.clientY, e.lastX = n.clientX, e.lastTime = performance.now(), e.scrollTop = o.fauxScrollbar.scrollTop, e.scrollLeft = o.scrollArea?.scrollLeft ?? 0, e.velocityY = 0, e.velocityX = 0;
|
|
1838
1842
|
}
|
|
1839
|
-
function
|
|
1843
|
+
function Qt(t, e, o) {
|
|
1840
1844
|
if (t.touches.length !== 1 || e.startY === null || e.startX === null || e.scrollTop === null || e.scrollLeft === null)
|
|
1841
1845
|
return !1;
|
|
1842
|
-
const n = t.touches[0], i = n.clientY, r = n.clientX,
|
|
1846
|
+
const n = t.touches[0], i = n.clientY, r = n.clientX, l = performance.now(), s = e.startY - i, a = e.startX - r;
|
|
1843
1847
|
if (e.lastTime !== null && e.lastY !== null && e.lastX !== null) {
|
|
1844
|
-
const p =
|
|
1848
|
+
const p = l - e.lastTime;
|
|
1845
1849
|
p > 0 && (e.velocityY = (e.lastY - i) / p, e.velocityX = (e.lastX - r) / p);
|
|
1846
1850
|
}
|
|
1847
|
-
e.lastY = i, e.lastX = r, e.lastTime =
|
|
1848
|
-
const { scrollTop: c, scrollHeight: f, clientHeight: d } = o.fauxScrollbar, u = f - d, w =
|
|
1851
|
+
e.lastY = i, e.lastX = r, e.lastTime = l;
|
|
1852
|
+
const { scrollTop: c, scrollHeight: f, clientHeight: d } = o.fauxScrollbar, u = f - d, w = s > 0 && c < u || s < 0 && c > 0;
|
|
1849
1853
|
let h = !1;
|
|
1850
1854
|
if (o.scrollArea) {
|
|
1851
1855
|
const { scrollLeft: p, scrollWidth: g, clientWidth: b } = o.scrollArea, _ = g - b;
|
|
1852
1856
|
h = a > 0 && p < _ || a < 0 && p > 0;
|
|
1853
1857
|
}
|
|
1854
|
-
return w && (o.fauxScrollbar.scrollTop = e.scrollTop +
|
|
1855
|
-
}
|
|
1856
|
-
function Qt(t, e) {
|
|
1857
|
-
(Math.abs(t.velocityY) > 0.1 || Math.abs(t.velocityX) > 0.1) && eo(t, e), Kt(t);
|
|
1858
|
+
return w && (o.fauxScrollbar.scrollTop = e.scrollTop + s), h && o.scrollArea && (o.scrollArea.scrollLeft = e.scrollLeft + a), w || h;
|
|
1858
1859
|
}
|
|
1859
1860
|
function eo(t, e) {
|
|
1861
|
+
(Math.abs(t.velocityY) > 0.1 || Math.abs(t.velocityX) > 0.1) && to(t, e), Zt(t);
|
|
1862
|
+
}
|
|
1863
|
+
function to(t, e) {
|
|
1860
1864
|
const i = () => {
|
|
1861
1865
|
t.velocityY *= 0.95, t.velocityX *= 0.95;
|
|
1862
|
-
const r = t.velocityY * 16,
|
|
1863
|
-
Math.abs(t.velocityY) > 0.01 && (e.fauxScrollbar.scrollTop += r), Math.abs(t.velocityX) > 0.01 && e.scrollArea && (e.scrollArea.scrollLeft +=
|
|
1866
|
+
const r = t.velocityY * 16, l = t.velocityX * 16;
|
|
1867
|
+
Math.abs(t.velocityY) > 0.01 && (e.fauxScrollbar.scrollTop += r), Math.abs(t.velocityX) > 0.01 && e.scrollArea && (e.scrollArea.scrollLeft += l), Math.abs(t.velocityY) > 0.01 || Math.abs(t.velocityX) > 0.01 ? t.momentumRaf = requestAnimationFrame(i) : t.momentumRaf = 0;
|
|
1864
1868
|
};
|
|
1865
1869
|
t.momentumRaf = requestAnimationFrame(i);
|
|
1866
1870
|
}
|
|
1867
|
-
function
|
|
1868
|
-
t.addEventListener("touchstart", (i) =>
|
|
1871
|
+
function oo(t, e, o, n) {
|
|
1872
|
+
t.addEventListener("touchstart", (i) => Jt(i, e, o), {
|
|
1869
1873
|
passive: !0,
|
|
1870
1874
|
signal: n
|
|
1871
1875
|
}), t.addEventListener(
|
|
1872
1876
|
"touchmove",
|
|
1873
1877
|
(i) => {
|
|
1874
|
-
|
|
1878
|
+
Qt(i, e, o) && i.preventDefault();
|
|
1875
1879
|
},
|
|
1876
1880
|
{ passive: !1, signal: n }
|
|
1877
|
-
), t.addEventListener("touchend", () =>
|
|
1881
|
+
), t.addEventListener("touchend", () => eo(e, o), { passive: !0, signal: n });
|
|
1878
1882
|
}
|
|
1879
|
-
class
|
|
1883
|
+
class no {
|
|
1880
1884
|
constructor(e) {
|
|
1881
1885
|
this.grid = e;
|
|
1882
1886
|
}
|
|
@@ -2038,8 +2042,8 @@ class oo {
|
|
|
2038
2042
|
let i = e;
|
|
2039
2043
|
for (const r of this.plugins)
|
|
2040
2044
|
if (typeof r.adjustVirtualStart == "function") {
|
|
2041
|
-
const
|
|
2042
|
-
|
|
2045
|
+
const l = r.adjustVirtualStart(e, o, n);
|
|
2046
|
+
l < i && (i = l);
|
|
2043
2047
|
}
|
|
2044
2048
|
return i;
|
|
2045
2049
|
}
|
|
@@ -2159,9 +2163,9 @@ class oo {
|
|
|
2159
2163
|
*/
|
|
2160
2164
|
getHorizontalScrollOffsets(e, o) {
|
|
2161
2165
|
let n = 0, i = 0, r = !1;
|
|
2162
|
-
for (const
|
|
2163
|
-
const
|
|
2164
|
-
|
|
2166
|
+
for (const l of this.plugins) {
|
|
2167
|
+
const s = l.getHorizontalScrollOffsets?.(e, o);
|
|
2168
|
+
s && (n += s.left, i += s.right, s.skipScroll && (r = !0));
|
|
2165
2169
|
}
|
|
2166
2170
|
return { left: n, right: i, skipScroll: r };
|
|
2167
2171
|
}
|
|
@@ -2196,7 +2200,7 @@ class oo {
|
|
|
2196
2200
|
class I extends HTMLElement {
|
|
2197
2201
|
// TODO: Rename to 'data-grid' when migration is complete
|
|
2198
2202
|
static tagName = "tbw-grid";
|
|
2199
|
-
static version = "0.3.
|
|
2203
|
+
static version = "0.3.3";
|
|
2200
2204
|
// ---------------- Framework Adapters ----------------
|
|
2201
2205
|
/**
|
|
2202
2206
|
* Registry of framework adapters that handle converting light DOM elements
|
|
@@ -2246,7 +2250,7 @@ class I extends HTMLElement {
|
|
|
2246
2250
|
// These backing fields store raw user input. They are merged into
|
|
2247
2251
|
// #effectiveConfig by #mergeEffectiveConfig(). Never read directly
|
|
2248
2252
|
// for rendering logic - always use effectiveConfig or derived state.
|
|
2249
|
-
#
|
|
2253
|
+
#l = [];
|
|
2250
2254
|
#c;
|
|
2251
2255
|
#g;
|
|
2252
2256
|
#E;
|
|
@@ -2275,8 +2279,8 @@ class I extends HTMLElement {
|
|
|
2275
2279
|
#k;
|
|
2276
2280
|
// Cached hook to avoid closures
|
|
2277
2281
|
#T = !1;
|
|
2278
|
-
#K =
|
|
2279
|
-
#
|
|
2282
|
+
#K = Kt();
|
|
2283
|
+
#s;
|
|
2280
2284
|
#p;
|
|
2281
2285
|
#w;
|
|
2282
2286
|
// Watches first row for size changes (CSS loading, custom renderers)
|
|
@@ -2376,15 +2380,15 @@ class I extends HTMLElement {
|
|
|
2376
2380
|
return this._rows;
|
|
2377
2381
|
}
|
|
2378
2382
|
set rows(e) {
|
|
2379
|
-
const o = this.#
|
|
2380
|
-
this.#
|
|
2383
|
+
const o = this.#l;
|
|
2384
|
+
this.#l = e, o !== e && this.#_("rows");
|
|
2381
2385
|
}
|
|
2382
2386
|
/**
|
|
2383
2387
|
* Get the original unfiltered/unprocessed rows.
|
|
2384
2388
|
* Use this when you need access to all source data regardless of active filters.
|
|
2385
2389
|
*/
|
|
2386
2390
|
get sourceRows() {
|
|
2387
|
-
return this.#
|
|
2391
|
+
return this.#l;
|
|
2388
2392
|
}
|
|
2389
2393
|
get columns() {
|
|
2390
2394
|
return [...this._columns];
|
|
@@ -2432,22 +2436,22 @@ class I extends HTMLElement {
|
|
|
2432
2436
|
* element.addEventListener('click', handler, { signal: this.grid.disconnectSignal });
|
|
2433
2437
|
*/
|
|
2434
2438
|
get disconnectSignal() {
|
|
2435
|
-
return this.#
|
|
2439
|
+
return this.#s || (this.#s = new AbortController()), this.#s.signal;
|
|
2436
2440
|
}
|
|
2437
2441
|
// #endregion
|
|
2438
2442
|
constructor() {
|
|
2439
|
-
super(), this.#n = this.attachShadow({ mode: "open" }), this.#
|
|
2443
|
+
super(), this.#n = this.attachShadow({ mode: "open" }), this.#le(), this.#Y = new Promise((e) => this.#j = e), this.#i = Xt(this.#e, {
|
|
2440
2444
|
getShadow: () => this.#n,
|
|
2441
2445
|
getShellConfig: () => this.#o?.shell,
|
|
2442
2446
|
getAccordionIcons: () => ({
|
|
2443
2447
|
expand: this.#o?.icons?.expand ?? O.expand,
|
|
2444
2448
|
collapse: this.#o?.icons?.collapse ?? O.collapse
|
|
2445
2449
|
}),
|
|
2446
|
-
emit: (e, o) => this.#
|
|
2450
|
+
emit: (e, o) => this.#B(e, o),
|
|
2447
2451
|
refreshShellHeader: () => this.refreshShellHeader()
|
|
2448
2452
|
});
|
|
2449
2453
|
}
|
|
2450
|
-
async #
|
|
2454
|
+
async #le() {
|
|
2451
2455
|
const e = new CSSStyleSheet();
|
|
2452
2456
|
if (de.length > 0) {
|
|
2453
2457
|
e.replaceSync(de), this.#n.adoptedStyleSheets = [e];
|
|
@@ -2458,7 +2462,7 @@ class I extends HTMLElement {
|
|
|
2458
2462
|
let o = "";
|
|
2459
2463
|
for (const n of Array.from(document.styleSheets))
|
|
2460
2464
|
try {
|
|
2461
|
-
const r = Array.from(n.cssRules || []).map((
|
|
2465
|
+
const r = Array.from(n.cssRules || []).map((l) => l.cssText).join(`
|
|
2462
2466
|
`);
|
|
2463
2467
|
if (r.includes(".tbw-grid-root") && r.includes(":host")) {
|
|
2464
2468
|
o = r;
|
|
@@ -2524,7 +2528,7 @@ class I extends HTMLElement {
|
|
|
2524
2528
|
* Plugins are class instances passed in gridConfig.plugins[].
|
|
2525
2529
|
*/
|
|
2526
2530
|
#Z() {
|
|
2527
|
-
this.#t = new
|
|
2531
|
+
this.#t = new no(this);
|
|
2528
2532
|
const e = this.#o?.plugins, o = Array.isArray(e) ? e : [];
|
|
2529
2533
|
this.#t.attachAll(o);
|
|
2530
2534
|
}
|
|
@@ -2561,7 +2565,7 @@ class I extends HTMLElement {
|
|
|
2561
2565
|
/**
|
|
2562
2566
|
* Clean up plugin states when grid disconnects.
|
|
2563
2567
|
*/
|
|
2564
|
-
#
|
|
2568
|
+
#se() {
|
|
2565
2569
|
this.#t?.detachAll();
|
|
2566
2570
|
}
|
|
2567
2571
|
/**
|
|
@@ -2599,7 +2603,7 @@ class I extends HTMLElement {
|
|
|
2599
2603
|
}
|
|
2600
2604
|
// ---------------- Lifecycle ----------------
|
|
2601
2605
|
connectedCallback() {
|
|
2602
|
-
this.hasAttribute("tabindex") || (this.tabIndex = 0), this.hasAttribute("version") || this.setAttribute("version", I.version), this._rows = Array.isArray(this.#
|
|
2606
|
+
this.hasAttribute("tabindex") || (this.tabIndex = 0), this.hasAttribute("version") || this.setAttribute("version", I.version), this._rows = Array.isArray(this.#l) ? [...this.#l] : [], this.#s && (this.#s.abort(), this.#x = !1), this.#s = new AbortController(), this.#u && (_e(this.#u), this.#u = void 0), B(this, this.#e), W(this, this.#e), V(this, this.#e, this.#b()), this.#r(), this.#Z(), this.#ee(), this.#H || (this.#U(), this.#J(), this.#H = !0), this.#I(), this.#u = zt(
|
|
2603
2607
|
() => {
|
|
2604
2608
|
this.#Se();
|
|
2605
2609
|
},
|
|
@@ -2607,7 +2611,7 @@ class I extends HTMLElement {
|
|
|
2607
2611
|
);
|
|
2608
2612
|
}
|
|
2609
2613
|
disconnectedCallback() {
|
|
2610
|
-
this.#u && (_e(this.#u), this.#u = void 0), this.#
|
|
2614
|
+
this.#u && (_e(this.#u), this.#u = void 0), this.#se(), Ut(this.#e), this.#i.setInitialized(!1), this.#A?.(), this.#A = void 0, $e(this.#K), this.#s && (this.#s.abort(), this.#s = void 0), this.#v?.abort(), this.#v = void 0, this.#x = !1, this._resizeController && this._resizeController.dispose(), this.#p && (this.#p.disconnect(), this.#p = void 0), this.#w && (this.#w.disconnect(), this.#w = void 0, this.#q = !1), this.#d && (this.#d.disconnect(), this.#d = void 0), Y(this), this._rowEditSnapshots.clear(), this._changedRowIndices.clear(), this.#C.clear();
|
|
2611
2615
|
for (const e of this._rowPool)
|
|
2612
2616
|
e.remove();
|
|
2613
2617
|
this._rowPool.length = 0, this.__rowsBodyEl = null, this.#M = !1;
|
|
@@ -2639,15 +2643,15 @@ class I extends HTMLElement {
|
|
|
2639
2643
|
#I() {
|
|
2640
2644
|
const o = this.#n.querySelector(".tbw-grid-content") ?? this.#n.querySelector(".tbw-grid-root");
|
|
2641
2645
|
if (this._headerRowEl = o?.querySelector(".header-row"), this._virtualization.totalHeightEl = o?.querySelector(".faux-vscroll-spacer"), this._virtualization.viewportEl = o?.querySelector(".rows-viewport"), this._bodyEl = o?.querySelector(".rows"), this.__rowsBodyEl = o?.querySelector(".rows-body"), this.#i.isInitialized) {
|
|
2642
|
-
Ve(this.#n, this.#e),
|
|
2646
|
+
Ve(this.#n, this.#e), $t(this.#n, this.#o?.shell, this.#e);
|
|
2643
2647
|
const r = this.#o?.shell?.toolPanel?.defaultOpen;
|
|
2644
2648
|
r && this.#e.toolPanels.has(r) && (this.openToolPanel(), this.#e.expandedSections.add(r));
|
|
2645
2649
|
}
|
|
2646
|
-
if (this.setAttribute("data-upgraded", ""), this.#M = !0, this._resizeController =
|
|
2650
|
+
if (this.setAttribute("data-upgraded", ""), this.#M = !0, this._resizeController = Nt(this), this.#a(), this.#ae(o), this.#x)
|
|
2647
2651
|
return;
|
|
2648
2652
|
this.#x = !0;
|
|
2649
2653
|
const n = this.disconnectSignal;
|
|
2650
|
-
this.addEventListener("keydown", (r) =>
|
|
2654
|
+
this.addEventListener("keydown", (r) => wt(this, r), { signal: n }), document.addEventListener(
|
|
2651
2655
|
"keydown",
|
|
2652
2656
|
(r) => {
|
|
2653
2657
|
r.key === "Escape" && this._activeEditRows !== -1 && D(this, this._activeEditRows, !0);
|
|
@@ -2657,8 +2661,8 @@ class I extends HTMLElement {
|
|
|
2657
2661
|
"mousedown",
|
|
2658
2662
|
(r) => {
|
|
2659
2663
|
if (this._activeEditRows === -1) return;
|
|
2660
|
-
const
|
|
2661
|
-
!
|
|
2664
|
+
const l = this.findRenderedRowElement(this._activeEditRows);
|
|
2665
|
+
!l || (r.composedPath && r.composedPath() || []).includes(l) || D(this, this._activeEditRows, !1);
|
|
2662
2666
|
},
|
|
2663
2667
|
{ signal: n }
|
|
2664
2668
|
), this.#n.addEventListener("mousedown", (r) => this.#_e(r), { signal: n }), document.addEventListener("mousemove", (r) => this.#Ce(r), { signal: n }), document.addEventListener("mouseup", (r) => this.#Ee(r), { signal: n });
|
|
@@ -2674,9 +2678,9 @@ class I extends HTMLElement {
|
|
|
2674
2678
|
if (!e) return;
|
|
2675
2679
|
const o = e.querySelectorAll(".cell");
|
|
2676
2680
|
let n = 0;
|
|
2677
|
-
o.forEach((
|
|
2678
|
-
const
|
|
2679
|
-
|
|
2681
|
+
o.forEach((l) => {
|
|
2682
|
+
const s = l.offsetHeight;
|
|
2683
|
+
s > n && (n = s);
|
|
2680
2684
|
});
|
|
2681
2685
|
const i = e.getBoundingClientRect(), r = Math.max(i.height, n);
|
|
2682
2686
|
r > 0 && r !== this._virtualization.rowHeight && (this._virtualization.rowHeight = r, this.refreshVirtualWindow(!0));
|
|
@@ -2694,36 +2698,36 @@ class I extends HTMLElement {
|
|
|
2694
2698
|
"scroll",
|
|
2695
2699
|
() => {
|
|
2696
2700
|
if (!this._virtualization.enabled && !this.#R) return;
|
|
2697
|
-
const
|
|
2701
|
+
const s = n.scrollTop, a = this._virtualization.rowHeight;
|
|
2698
2702
|
if (this._rows.length <= this._virtualization.bypassThreshold)
|
|
2699
|
-
i.style.transform = `translateY(${-
|
|
2703
|
+
i.style.transform = `translateY(${-s}px)`;
|
|
2700
2704
|
else {
|
|
2701
|
-
const c = Math.floor(
|
|
2705
|
+
const c = Math.floor(s / a), f = c - c % 2, d = -(s - f * a);
|
|
2702
2706
|
i.style.transform = `translateY(${d}px)`;
|
|
2703
2707
|
}
|
|
2704
|
-
this.#S =
|
|
2708
|
+
this.#S = s, this.#f || (this.#f = requestAnimationFrame(() => {
|
|
2705
2709
|
this.#f = 0, this.#S !== null && (this.#ve(this.#S), this.#S = null);
|
|
2706
2710
|
}));
|
|
2707
2711
|
},
|
|
2708
2712
|
{ passive: !0, signal: o }
|
|
2709
2713
|
);
|
|
2710
|
-
const r = this.#n.querySelector(".tbw-grid-content"),
|
|
2714
|
+
const r = this.#n.querySelector(".tbw-grid-content"), l = this.#n.querySelector(".tbw-scroll-area");
|
|
2711
2715
|
r && (r.addEventListener(
|
|
2712
2716
|
"wheel",
|
|
2713
|
-
(
|
|
2714
|
-
const a =
|
|
2715
|
-
if (a &&
|
|
2716
|
-
const c =
|
|
2717
|
-
(c > 0 && f < d - u || c < 0 && f > 0) && (
|
|
2717
|
+
(s) => {
|
|
2718
|
+
const a = s.shiftKey || Math.abs(s.deltaX) > Math.abs(s.deltaY);
|
|
2719
|
+
if (a && l) {
|
|
2720
|
+
const c = s.shiftKey ? s.deltaY : s.deltaX, { scrollLeft: f, scrollWidth: d, clientWidth: u } = l;
|
|
2721
|
+
(c > 0 && f < d - u || c < 0 && f > 0) && (s.preventDefault(), l.scrollLeft += c);
|
|
2718
2722
|
} else if (!a) {
|
|
2719
2723
|
const { scrollTop: c, scrollHeight: f, clientHeight: d } = n;
|
|
2720
|
-
(
|
|
2724
|
+
(s.deltaY > 0 && c < f - d || s.deltaY < 0 && c > 0) && (s.preventDefault(), n.scrollTop += s.deltaY);
|
|
2721
2725
|
}
|
|
2722
2726
|
},
|
|
2723
2727
|
{ passive: !1, signal: o }
|
|
2724
|
-
),
|
|
2728
|
+
), oo(r, this.#K, { fauxScrollbar: n, scrollArea: l }, o));
|
|
2725
2729
|
}
|
|
2726
|
-
this._bodyEl &&
|
|
2730
|
+
this._bodyEl && Mt(this, this._bodyEl, o), this.#p?.disconnect(), this._virtualization.viewportEl && (this.#p = new ResizeObserver(() => {
|
|
2727
2731
|
this.#f || (this.#f = requestAnimationFrame(() => {
|
|
2728
2732
|
this.#f = 0, this.refreshVirtualWindow(!0), k(this);
|
|
2729
2733
|
}));
|
|
@@ -2736,28 +2740,28 @@ class I extends HTMLElement {
|
|
|
2736
2740
|
* Called after rows are rendered to observe the actual content cells.
|
|
2737
2741
|
* Handles dynamic CSS loading, lazy images, font loading, etc.
|
|
2738
2742
|
*/
|
|
2739
|
-
#
|
|
2743
|
+
#q = !1;
|
|
2740
2744
|
// Only set up once per lifecycle
|
|
2741
2745
|
#ce() {
|
|
2742
|
-
if (this.#
|
|
2746
|
+
if (this.#q) return;
|
|
2743
2747
|
const e = this._bodyEl?.querySelector(".data-grid-row");
|
|
2744
2748
|
if (!e) return;
|
|
2745
|
-
this.#
|
|
2749
|
+
this.#q = !0, this.#w?.disconnect();
|
|
2746
2750
|
const o = e.querySelectorAll(".cell");
|
|
2747
2751
|
o.length > 0 && (this.#w = new ResizeObserver(() => {
|
|
2748
2752
|
this.#te();
|
|
2749
2753
|
}), o.forEach((n) => this.#w.observe(n)));
|
|
2750
2754
|
}
|
|
2751
2755
|
// ---------------- Event Emitters ----------------
|
|
2752
|
-
#
|
|
2756
|
+
#B(e, o) {
|
|
2753
2757
|
this.dispatchEvent(new CustomEvent(e, { detail: o, bubbles: !0, composed: !0 }));
|
|
2754
2758
|
}
|
|
2755
2759
|
/** Update ARIA selection attributes on rendered rows/cells */
|
|
2756
2760
|
#de() {
|
|
2757
2761
|
this._bodyEl?.querySelectorAll(".data-grid-row")?.forEach((o, n) => {
|
|
2758
2762
|
const i = n === this._focusRow;
|
|
2759
|
-
o.setAttribute("aria-selected", String(i)), o.querySelectorAll(".cell").forEach((r,
|
|
2760
|
-
r.setAttribute("aria-selected", String(i &&
|
|
2763
|
+
o.setAttribute("aria-selected", String(i)), o.querySelectorAll(".cell").forEach((r, l) => {
|
|
2764
|
+
r.setAttribute("aria-selected", String(i && l === this._focusCol));
|
|
2761
2765
|
});
|
|
2762
2766
|
});
|
|
2763
2767
|
}
|
|
@@ -2795,7 +2799,7 @@ class I extends HTMLElement {
|
|
|
2795
2799
|
}
|
|
2796
2800
|
// Individual update applicators - these do the actual work
|
|
2797
2801
|
#he() {
|
|
2798
|
-
this._rows = Array.isArray(this.#
|
|
2802
|
+
this._rows = Array.isArray(this.#l) ? [...this.#l] : [], this.#P(), this._columns.length > 0 || Array.isArray(this.#o?.columns) && this.#o.columns.length > 0 || Array.isArray(this.#c) && this.#c.length > 0 ? (this.#L(), this.refreshVirtualWindow(!0)) : this.#a();
|
|
2799
2803
|
}
|
|
2800
2804
|
#fe() {
|
|
2801
2805
|
Y(this), this.#r(), this.#a();
|
|
@@ -2809,11 +2813,11 @@ class I extends HTMLElement {
|
|
|
2809
2813
|
this.#r(), this._rowPool.length = 0, this._bodyEl && (this._bodyEl.innerHTML = ""), this.__rowRenderEpoch++, this.refreshVirtualWindow(!0);
|
|
2810
2814
|
}
|
|
2811
2815
|
#be() {
|
|
2812
|
-
|
|
2816
|
+
B(this, this.#e), W(this, this.#e);
|
|
2813
2817
|
const e = !!this.#n.querySelector(".has-shell"), o = !!this.#n.querySelector(".tbw-tool-panel"), n = this.#n.querySelectorAll(".tbw-accordion-section").length;
|
|
2814
2818
|
pe(this), this.#r(), this.#Q(), V(this, this.#e, this.#b());
|
|
2815
|
-
const i = We(this.#o, this.#e), r = this.#e.toolPanels.size > 0,
|
|
2816
|
-
if (e !== i || !e && i || !o && r || o &&
|
|
2819
|
+
const i = We(this.#o, this.#e), r = this.#e.toolPanels.size > 0, l = this.#e.toolPanels.size !== n;
|
|
2820
|
+
if (e !== i || !e && i || !o && r || o && l) {
|
|
2817
2821
|
this.#U(), this.#I();
|
|
2818
2822
|
return;
|
|
2819
2823
|
}
|
|
@@ -2838,16 +2842,16 @@ class I extends HTMLElement {
|
|
|
2838
2842
|
if (this.#t) {
|
|
2839
2843
|
const e = this.#N.length > 0 ? this.#N : this._columns, o = e.filter((r) => !r.hidden), n = e.filter((r) => r.hidden), i = this.#t.processColumns([...o]);
|
|
2840
2844
|
if (i !== o) {
|
|
2841
|
-
const r = new Map(i.map((
|
|
2842
|
-
if (!o.some((
|
|
2845
|
+
const r = new Map(i.map((s, a) => [s.field, { col: s, order: a }]));
|
|
2846
|
+
if (!o.some((s) => r.has(s.field)) && i.length > 0)
|
|
2843
2847
|
this._columns = [...i, ...n];
|
|
2844
2848
|
else {
|
|
2845
|
-
const
|
|
2849
|
+
const s = e.map((a) => {
|
|
2846
2850
|
if (a.hidden) return a;
|
|
2847
2851
|
const c = r.get(a.field);
|
|
2848
2852
|
return c ? c.col : a;
|
|
2849
2853
|
});
|
|
2850
|
-
this._columns =
|
|
2854
|
+
this._columns = s;
|
|
2851
2855
|
}
|
|
2852
2856
|
} else
|
|
2853
2857
|
this._columns = [...e];
|
|
@@ -2856,7 +2860,7 @@ class I extends HTMLElement {
|
|
|
2856
2860
|
/** Recompute row model via plugin hooks. */
|
|
2857
2861
|
#P() {
|
|
2858
2862
|
Y(this);
|
|
2859
|
-
const e = Array.isArray(this.#
|
|
2863
|
+
const e = Array.isArray(this.#l) ? [...this.#l] : [], o = this.#t?.processRows(e) ?? e;
|
|
2860
2864
|
this._rows = o;
|
|
2861
2865
|
}
|
|
2862
2866
|
/**
|
|
@@ -2886,24 +2890,24 @@ class I extends HTMLElement {
|
|
|
2886
2890
|
if (n.length) {
|
|
2887
2891
|
const i = {};
|
|
2888
2892
|
o.forEach((r) => i[r.field] = r), n.forEach((r) => {
|
|
2889
|
-
const
|
|
2890
|
-
if (!
|
|
2893
|
+
const l = i[r.field];
|
|
2894
|
+
if (!l)
|
|
2891
2895
|
o.push(r), i[r.field] = r;
|
|
2892
2896
|
else {
|
|
2893
|
-
r.header && !
|
|
2894
|
-
const
|
|
2895
|
-
|
|
2897
|
+
r.header && !l.header && (l.header = r.header), r.type && !l.type && (l.type = r.type), l.sortable = l.sortable || r.sortable, r.resizable && (l.resizable = !0), r.editable && (l.editable = !0);
|
|
2898
|
+
const s = r.renderer || r.viewRenderer, a = l.renderer || l.viewRenderer;
|
|
2899
|
+
s && !a && (l.viewRenderer = s, r.renderer && (l.renderer = s)), r.editor && !l.editor && (l.editor = r.editor);
|
|
2896
2900
|
}
|
|
2897
2901
|
});
|
|
2898
2902
|
}
|
|
2899
2903
|
if (this.#c && this.#c.length && (o = [...this.#c]), (!o || o.length === 0) && this._rows.length && (o = Le(this._rows).columns), o.length) {
|
|
2900
|
-
o.forEach((
|
|
2901
|
-
|
|
2902
|
-
const
|
|
2903
|
-
|
|
2904
|
+
o.forEach((l) => {
|
|
2905
|
+
l.sortable === void 0 && (l.sortable = !0), l.resizable === void 0 && (l.resizable = !0);
|
|
2906
|
+
const s = l;
|
|
2907
|
+
s.__originalWidth === void 0 && typeof l.width == "number" && (s.__originalWidth = l.width);
|
|
2904
2908
|
});
|
|
2905
2909
|
const i = this.#o.columns;
|
|
2906
|
-
i?.some((
|
|
2910
|
+
i?.some((l) => l.__compiledView || l.__compiledEditor) ? e.columns = i : e.columns = o;
|
|
2907
2911
|
} else {
|
|
2908
2912
|
const i = this.#o.columns;
|
|
2909
2913
|
i?.some((r) => r.__compiledView || r.__compiledEditor) && (e.columns = i);
|
|
@@ -2926,7 +2930,7 @@ class I extends HTMLElement {
|
|
|
2926
2930
|
}
|
|
2927
2931
|
// ---------------- Delegate Wrappers ----------------
|
|
2928
2932
|
#W(e, o, n = this.__rowRenderEpoch) {
|
|
2929
|
-
this.#k || (this.#k = (i, r,
|
|
2933
|
+
this.#k || (this.#k = (i, r, l) => this.#t?.renderRow(i, r, l) ?? !1), _t(this, e, o, n, this.#k);
|
|
2930
2934
|
}
|
|
2931
2935
|
// Cache for ARIA counts to avoid redundant DOM writes on scroll (hot path)
|
|
2932
2936
|
#V = -1;
|
|
@@ -2965,7 +2969,7 @@ class I extends HTMLElement {
|
|
|
2965
2969
|
const o = this.#o.columns ?? [], n = this.#t?.getAll() ?? [];
|
|
2966
2970
|
Ge(this, e, o, n);
|
|
2967
2971
|
for (const i of e.columns) {
|
|
2968
|
-
const r = o.find((
|
|
2972
|
+
const r = o.find((l) => l.field === i.field);
|
|
2969
2973
|
r && (r.hidden = !i.visible);
|
|
2970
2974
|
}
|
|
2971
2975
|
}
|
|
@@ -3001,18 +3005,18 @@ class I extends HTMLElement {
|
|
|
3001
3005
|
* Returns true if any plugin handled the event.
|
|
3002
3006
|
*/
|
|
3003
3007
|
_dispatchCellClick(e, o, n, i) {
|
|
3004
|
-
const r = this._rows[o],
|
|
3005
|
-
if (!r || !
|
|
3006
|
-
const
|
|
3008
|
+
const r = this._rows[o], l = this._columns[n];
|
|
3009
|
+
if (!r || !l) return !1;
|
|
3010
|
+
const s = {
|
|
3007
3011
|
row: r,
|
|
3008
3012
|
rowIndex: o,
|
|
3009
3013
|
colIndex: n,
|
|
3010
|
-
field:
|
|
3011
|
-
value: r[
|
|
3014
|
+
field: l.field,
|
|
3015
|
+
value: r[l.field],
|
|
3012
3016
|
cellEl: i,
|
|
3013
3017
|
originalEvent: e
|
|
3014
3018
|
};
|
|
3015
|
-
return this.#t?.onCellClick(
|
|
3019
|
+
return this.#t?.onCellClick(s) ?? !1;
|
|
3016
3020
|
}
|
|
3017
3021
|
/**
|
|
3018
3022
|
* Dispatch a row click event to the plugin system.
|
|
@@ -3083,7 +3087,7 @@ class I extends HTMLElement {
|
|
|
3083
3087
|
const h = this.#n.elementFromPoint(e.clientX, e.clientY);
|
|
3084
3088
|
h && (n = h);
|
|
3085
3089
|
}
|
|
3086
|
-
const r = n?.closest?.("[data-col]"),
|
|
3090
|
+
const r = n?.closest?.("[data-col]"), l = n?.closest?.(".data-grid-row"), s = n?.closest?.(".header-row");
|
|
3087
3091
|
let a, c, f, d, u, w;
|
|
3088
3092
|
return r && (a = parseInt(r.getAttribute("data-row") ?? "-1", 10), c = parseInt(r.getAttribute("data-col") ?? "-1", 10), a >= 0 && c >= 0 && (f = this._rows[a], w = this._columns[c], d = w?.field, u = f && d ? f[d] : void 0)), {
|
|
3089
3093
|
type: o,
|
|
@@ -3095,8 +3099,8 @@ class I extends HTMLElement {
|
|
|
3095
3099
|
column: w,
|
|
3096
3100
|
originalEvent: e,
|
|
3097
3101
|
cellElement: r ?? void 0,
|
|
3098
|
-
rowElement:
|
|
3099
|
-
isHeader: !!
|
|
3102
|
+
rowElement: l ?? void 0,
|
|
3103
|
+
isHeader: !!s,
|
|
3100
3104
|
cell: a !== void 0 && c !== void 0 && a >= 0 && c >= 0 ? { row: a, col: c } : void 0
|
|
3101
3105
|
};
|
|
3102
3106
|
}
|
|
@@ -3131,18 +3135,18 @@ class I extends HTMLElement {
|
|
|
3131
3135
|
return ze(this);
|
|
3132
3136
|
}
|
|
3133
3137
|
async resetChangedRows(e) {
|
|
3134
|
-
|
|
3138
|
+
St(this, e);
|
|
3135
3139
|
}
|
|
3136
3140
|
async beginBulkEdit(e) {
|
|
3137
|
-
|
|
3141
|
+
Rt(this, e, {
|
|
3138
3142
|
findRenderedRowElement: (o) => this.findRenderedRowElement?.(o) ?? null
|
|
3139
3143
|
});
|
|
3140
3144
|
}
|
|
3141
3145
|
async commitActiveRowEdit() {
|
|
3142
|
-
|
|
3146
|
+
Tt(this);
|
|
3143
3147
|
}
|
|
3144
3148
|
async cancelActiveRowEdit() {
|
|
3145
|
-
|
|
3149
|
+
xt(this);
|
|
3146
3150
|
}
|
|
3147
3151
|
async ready() {
|
|
3148
3152
|
return this.#Y;
|
|
@@ -3158,7 +3162,7 @@ class I extends HTMLElement {
|
|
|
3158
3162
|
// Delegates to column-state.ts pure functions
|
|
3159
3163
|
/** Visibility callbacks for column-state.ts functions */
|
|
3160
3164
|
#F = {
|
|
3161
|
-
emit: (e, o) => this.#
|
|
3165
|
+
emit: (e, o) => this.#B(e, o),
|
|
3162
3166
|
clearRowPool: () => {
|
|
3163
3167
|
this._rowPool.length = 0, this._bodyEl && (this._bodyEl.innerHTML = ""), this.__rowRenderEpoch++;
|
|
3164
3168
|
},
|
|
@@ -3231,7 +3235,7 @@ class I extends HTMLElement {
|
|
|
3231
3235
|
this.#z || (this.#z = Ue(
|
|
3232
3236
|
this,
|
|
3233
3237
|
() => this.#t?.getAll() ?? [],
|
|
3234
|
-
(e) => this.#
|
|
3238
|
+
(e) => this.#B("column-state-change", e)
|
|
3235
3239
|
)), this.#z();
|
|
3236
3240
|
}
|
|
3237
3241
|
/**
|
|
@@ -3333,7 +3337,7 @@ class I extends HTMLElement {
|
|
|
3333
3337
|
* Call this after dynamically modifying <tbw-grid-header> children.
|
|
3334
3338
|
*/
|
|
3335
3339
|
refreshShellHeader() {
|
|
3336
|
-
|
|
3340
|
+
B(this, this.#e), W(this, this.#e), V(this, this.#e, this.#b()), this.#U(), this.#I();
|
|
3337
3341
|
}
|
|
3338
3342
|
// #region Custom Styles API
|
|
3339
3343
|
/** Map of registered custom style elements by ID */
|
|
@@ -3390,10 +3394,10 @@ class I extends HTMLElement {
|
|
|
3390
3394
|
let e = null, o = !1, n = !1;
|
|
3391
3395
|
const i = () => {
|
|
3392
3396
|
if (e = null, o) {
|
|
3393
|
-
const r = this.#e.lightDomTitle,
|
|
3394
|
-
|
|
3395
|
-
const
|
|
3396
|
-
if (
|
|
3397
|
+
const r = this.#e.lightDomTitle, l = this.#e.hasToolButtonsContainer;
|
|
3398
|
+
B(this, this.#e), W(this, this.#e), V(this, this.#e, this.#b());
|
|
3399
|
+
const s = this.#e.lightDomTitle, a = this.#e.hasToolButtonsContainer;
|
|
3400
|
+
if (s && !r || a && !l) {
|
|
3397
3401
|
this.#r();
|
|
3398
3402
|
const c = this.#n.querySelector(".tbw-shell-header");
|
|
3399
3403
|
if (c) {
|
|
@@ -3412,14 +3416,14 @@ class I extends HTMLElement {
|
|
|
3412
3416
|
n && (this.__lightDomColumnsCache = void 0, this.#a(), n = !1);
|
|
3413
3417
|
};
|
|
3414
3418
|
this.#d = new MutationObserver((r) => {
|
|
3415
|
-
for (const
|
|
3416
|
-
for (const
|
|
3417
|
-
if (
|
|
3418
|
-
const c =
|
|
3419
|
+
for (const l of r) {
|
|
3420
|
+
for (const s of l.addedNodes) {
|
|
3421
|
+
if (s.nodeType !== Node.ELEMENT_NODE) continue;
|
|
3422
|
+
const c = s.tagName.toLowerCase();
|
|
3419
3423
|
c === "tbw-grid-header" ? o = !0 : (c === "tbw-grid-column" || c === "tbw-grid-detail") && (n = !0);
|
|
3420
3424
|
}
|
|
3421
|
-
if (
|
|
3422
|
-
const a =
|
|
3425
|
+
if (l.type === "attributes" && l.target.nodeType === Node.ELEMENT_NODE) {
|
|
3426
|
+
const a = l.target.tagName.toLowerCase();
|
|
3423
3427
|
a === "tbw-grid-header" ? o = !0 : a === "tbw-grid-column" && (n = !0);
|
|
3424
3428
|
}
|
|
3425
3429
|
}
|
|
@@ -3448,20 +3452,20 @@ class I extends HTMLElement {
|
|
|
3448
3452
|
#Re() {
|
|
3449
3453
|
this.__lightDomColumnsCache = void 0, Y(this);
|
|
3450
3454
|
const e = this.#e.lightDomTitle, o = this.#e.hasToolButtonsContainer;
|
|
3451
|
-
|
|
3455
|
+
B(this, this.#e), W(this, this.#e), V(this, this.#e, this.#b());
|
|
3452
3456
|
const n = this.#e.lightDomTitle, i = this.#e.hasToolButtonsContainer;
|
|
3453
3457
|
if (n && !e || i && !o) {
|
|
3454
3458
|
this.#r();
|
|
3455
|
-
const
|
|
3456
|
-
if (
|
|
3457
|
-
const
|
|
3459
|
+
const l = this.#n.querySelector(".tbw-shell-header");
|
|
3460
|
+
if (l) {
|
|
3461
|
+
const s = ye(
|
|
3458
3462
|
this.#o.shell,
|
|
3459
3463
|
this.#e,
|
|
3460
3464
|
this.#o.icons?.toolPanel
|
|
3461
3465
|
), a = document.createElement("div");
|
|
3462
|
-
a.innerHTML =
|
|
3466
|
+
a.innerHTML = s;
|
|
3463
3467
|
const c = a.firstElementChild;
|
|
3464
|
-
c && (
|
|
3468
|
+
c && (l.replaceWith(c), this.#X());
|
|
3465
3469
|
}
|
|
3466
3470
|
}
|
|
3467
3471
|
this.#a();
|
|
@@ -3472,7 +3476,7 @@ class I extends HTMLElement {
|
|
|
3472
3476
|
* Used by both bypass and virtualized rendering paths to ensure consistent scroll behavior.
|
|
3473
3477
|
*/
|
|
3474
3478
|
#G(e) {
|
|
3475
|
-
const o = this._virtualization.rowHeight, n = this._virtualization.container ?? this, i = this._virtualization.viewportEl ?? n, r = n.clientHeight,
|
|
3479
|
+
const o = this._virtualization.rowHeight, n = this._virtualization.container ?? this, i = this._virtualization.viewportEl ?? n, r = n.clientHeight, l = i.clientHeight, a = this.shadowRoot?.querySelector(".tbw-scroll-area"), c = a ? a.clientHeight : r, d = c - l, u = this.#t?.getExtraHeight() ?? 0, w = Math.max(0, r - c);
|
|
3476
3480
|
return e * o + d + u + w;
|
|
3477
3481
|
}
|
|
3478
3482
|
/**
|
|
@@ -3491,18 +3495,18 @@ class I extends HTMLElement {
|
|
|
3491
3495
|
this._virtualization.start = 0, this._virtualization.end = o, e && (this._bodyEl.style.transform = "translateY(0px)"), this.#W(0, o, e ? ++this.__rowRenderEpoch : this.__rowRenderEpoch), this._virtualization.totalHeightEl && (this._virtualization.totalHeightEl.style.height = `${this.#G(o)}px`), this.#ne(o, this._visibleColumns.length), this.#t?.afterRender();
|
|
3492
3496
|
return;
|
|
3493
3497
|
}
|
|
3494
|
-
const n = this._virtualization.container ?? this, i = this._virtualization.viewportEl ?? n, r = i.clientHeight,
|
|
3495
|
-
let a = Math.floor(
|
|
3498
|
+
const n = this._virtualization.container ?? this, i = this._virtualization.viewportEl ?? n, r = i.clientHeight, l = this._virtualization.rowHeight, s = n.scrollTop;
|
|
3499
|
+
let a = Math.floor(s / l), c = 0;
|
|
3496
3500
|
const f = 10;
|
|
3497
3501
|
for (; c < f; ) {
|
|
3498
|
-
const _ = this.#t?.getExtraHeightBefore?.(a) ?? 0, v = Math.floor((
|
|
3502
|
+
const _ = this.#t?.getExtraHeightBefore?.(a) ?? 0, v = Math.floor((s - _) / l);
|
|
3499
3503
|
if (v >= a || v < 0) break;
|
|
3500
3504
|
a = v, c++;
|
|
3501
3505
|
}
|
|
3502
3506
|
a = a - a % 2, a < 0 && (a = 0);
|
|
3503
|
-
const d = this.#t?.adjustVirtualStart(a,
|
|
3507
|
+
const d = this.#t?.adjustVirtualStart(a, s, l);
|
|
3504
3508
|
d !== void 0 && d < a && (a = d, a = a - a % 2, a < 0 && (a = 0));
|
|
3505
|
-
const u = Math.ceil(r /
|
|
3509
|
+
const u = Math.ceil(r / l) + 3;
|
|
3506
3510
|
let w = a + u;
|
|
3507
3511
|
if (w > o && (w = o), this._virtualization.start = a, this._virtualization.end = w, n.clientHeight === 0 && r > 0) {
|
|
3508
3512
|
requestAnimationFrame(() => this.refreshVirtualWindow(e));
|
|
@@ -3510,7 +3514,7 @@ class I extends HTMLElement {
|
|
|
3510
3514
|
}
|
|
3511
3515
|
const p = this.#G(o);
|
|
3512
3516
|
this._virtualization.totalHeightEl && (this._virtualization.totalHeightEl.style.height = `${p}px`);
|
|
3513
|
-
const g = this.#t?.getExtraHeightBefore?.(a) ?? 0, b = -(
|
|
3517
|
+
const g = this.#t?.getExtraHeightBefore?.(a) ?? 0, b = -(s - a * l - g);
|
|
3514
3518
|
this._bodyEl.style.transform = `translateY(${b}px)`, this.#W(a, w, e ? ++this.__rowRenderEpoch : this.__rowRenderEpoch), this.#ne(o, this._visibleColumns.length), e && (this.#t?.afterRender(), queueMicrotask(() => {
|
|
3515
3519
|
const _ = n.clientHeight, v = i.clientHeight;
|
|
3516
3520
|
if (_ === 0 && v > 0) return;
|
|
@@ -3520,19 +3524,19 @@ class I extends HTMLElement {
|
|
|
3520
3524
|
}
|
|
3521
3525
|
// ---------------- Render ----------------
|
|
3522
3526
|
#U() {
|
|
3523
|
-
|
|
3527
|
+
B(this, this.#e), W(this, this.#e), V(this, this.#e, this.#b()), this.#r();
|
|
3524
3528
|
const e = this.#o?.shell;
|
|
3525
|
-
|
|
3529
|
+
jt(this.#n, e, this.#e, this.#o?.icons) && (this.#X(), this.#i.setInitialized(!0));
|
|
3526
3530
|
}
|
|
3527
3531
|
/**
|
|
3528
3532
|
* Set up shell event listeners after render.
|
|
3529
3533
|
*/
|
|
3530
3534
|
#X() {
|
|
3531
|
-
|
|
3535
|
+
Wt(this.#n, this.#o?.shell, this.#e, {
|
|
3532
3536
|
onPanelToggle: () => this.toggleToolPanel(),
|
|
3533
3537
|
onSectionToggle: (e) => this.toggleToolPanelSection(e),
|
|
3534
3538
|
onToolbarButtonClick: (e) => this.#Te(e)
|
|
3535
|
-
}), this.#A?.(), this.#A =
|
|
3539
|
+
}), this.#A?.(), this.#A = Vt(this.#n, this.#o?.shell, (e) => {
|
|
3536
3540
|
this.style.setProperty("--tbw-tool-panel-width", `${e}px`);
|
|
3537
3541
|
});
|
|
3538
3542
|
}
|
|
@@ -3547,13 +3551,13 @@ class I extends HTMLElement {
|
|
|
3547
3551
|
}
|
|
3548
3552
|
customElements.get(I.tagName) || customElements.define(I.tagName, I);
|
|
3549
3553
|
globalThis.DataGridElement = I;
|
|
3550
|
-
const
|
|
3554
|
+
const ro = {
|
|
3551
3555
|
/** Ask if a column can be moved. Context: ColumnConfig. Response: boolean | undefined */
|
|
3552
3556
|
CAN_MOVE_COLUMN: "canMoveColumn",
|
|
3553
3557
|
/** Get context menu items. Context: ContextMenuParams. Response: ContextMenuItem[] */
|
|
3554
3558
|
GET_CONTEXT_MENU_ITEMS: "getContextMenuItems"
|
|
3555
3559
|
};
|
|
3556
|
-
class
|
|
3560
|
+
class lo {
|
|
3557
3561
|
/** Plugin version - override in subclass if needed */
|
|
3558
3562
|
version = "1.0.0";
|
|
3559
3563
|
/** CSS styles to inject into the grid's shadow DOM */
|
|
@@ -3786,7 +3790,7 @@ const y = {
|
|
|
3786
3790
|
// State selectors
|
|
3787
3791
|
SELECTED_ROWS: `.${y.DATA_ROW}.${y.SELECTED}`,
|
|
3788
3792
|
EDITING_CELL: `.${y.DATA_CELL}.${y.EDITING}`
|
|
3789
|
-
},
|
|
3793
|
+
}, ao = {
|
|
3790
3794
|
// Colors
|
|
3791
3795
|
COLOR_BG: "--tbw-color-bg",
|
|
3792
3796
|
COLOR_FG: "--tbw-color-fg",
|
|
@@ -3808,7 +3812,7 @@ const y = {
|
|
|
3808
3812
|
// Borders
|
|
3809
3813
|
BORDER_RADIUS: "--tbw-border-radius",
|
|
3810
3814
|
FOCUS_OUTLINE: "--tbw-focus-outline"
|
|
3811
|
-
},
|
|
3815
|
+
}, co = {
|
|
3812
3816
|
CELL_COMMIT: "cell-commit",
|
|
3813
3817
|
ROW_COMMIT: "row-commit",
|
|
3814
3818
|
CHANGED_ROWS_RESET: "changed-rows-reset",
|
|
@@ -3819,7 +3823,7 @@ const y = {
|
|
|
3819
3823
|
ACTIVATE_CELL: "activate-cell",
|
|
3820
3824
|
GROUP_TOGGLE: "group-toggle",
|
|
3821
3825
|
COLUMN_STATE_CHANGE: "column-state-change"
|
|
3822
|
-
},
|
|
3826
|
+
}, uo = {
|
|
3823
3827
|
// Selection plugin
|
|
3824
3828
|
SELECTION_CHANGE: "selection-change",
|
|
3825
3829
|
// Tree plugin
|
|
@@ -3909,42 +3913,42 @@ const y = {
|
|
|
3909
3913
|
first: (t) => t[0] ?? 0,
|
|
3910
3914
|
last: (t) => t[t.length - 1] ?? 0
|
|
3911
3915
|
};
|
|
3912
|
-
function
|
|
3916
|
+
function io(t) {
|
|
3913
3917
|
return Te[t] ?? Te.sum;
|
|
3914
3918
|
}
|
|
3915
|
-
function
|
|
3916
|
-
return
|
|
3919
|
+
function ho(t, e) {
|
|
3920
|
+
return io(t)(e);
|
|
3917
3921
|
}
|
|
3918
|
-
const
|
|
3922
|
+
const fo = M.register.bind(M), po = M.unregister.bind(M), wo = M.get.bind(M), bo = M.run.bind(M), go = M.list.bind(M);
|
|
3919
3923
|
export {
|
|
3920
|
-
|
|
3924
|
+
lo as BaseGridPlugin,
|
|
3921
3925
|
Qe as DEFAULT_ANIMATION_CONFIG,
|
|
3922
3926
|
O as DEFAULT_GRID_ICONS,
|
|
3923
|
-
|
|
3927
|
+
co as DGEvents,
|
|
3924
3928
|
I as DataGridElement,
|
|
3925
3929
|
j as FitModeEnum,
|
|
3926
|
-
|
|
3930
|
+
ao as GridCSSVars,
|
|
3927
3931
|
y as GridClasses,
|
|
3928
3932
|
J as GridDataAttrs,
|
|
3929
3933
|
I as GridElement,
|
|
3930
3934
|
so as GridSelectors,
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3935
|
+
ro as PLUGIN_QUERIES,
|
|
3936
|
+
uo as PluginEvents,
|
|
3937
|
+
no as PluginManager,
|
|
3934
3938
|
k as a,
|
|
3935
3939
|
M as aggregatorRegistry,
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3940
|
+
kt as builtInSort,
|
|
3941
|
+
le as c,
|
|
3942
|
+
Ot as defaultComparator,
|
|
3939
3943
|
Pe as e,
|
|
3940
3944
|
Me as g,
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3945
|
+
wo as getAggregator,
|
|
3946
|
+
io as getValueAggregator,
|
|
3947
|
+
go as listAggregators,
|
|
3948
|
+
fo as registerAggregator,
|
|
3949
|
+
bo as runAggregator,
|
|
3950
|
+
ho as runValueAggregator,
|
|
3947
3951
|
Q as s,
|
|
3948
|
-
|
|
3952
|
+
po as unregisterAggregator
|
|
3949
3953
|
};
|
|
3950
3954
|
//# sourceMappingURL=index.js.map
|