@toolbox-web/grid 1.2.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +80 -22
- package/all.js +619 -571
- package/all.js.map +1 -1
- package/index.js +362 -302
- package/index.js.map +1 -1
- package/lib/core/grid.d.ts +64 -1
- package/lib/core/grid.d.ts.map +1 -1
- package/lib/core/internal/row-animation.d.ts +37 -0
- package/lib/core/internal/row-animation.d.ts.map +1 -0
- package/lib/core/types.d.ts +17 -0
- package/lib/core/types.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.js +82 -76
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/clipboard/types.d.ts +1 -0
- package/lib/plugins/clipboard/types.d.ts.map +1 -1
- package/lib/plugins/column-virtualization/index.js +43 -41
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/context-menu/index.js +24 -22
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
- package/lib/plugins/editing/index.js +83 -52
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/export/index.js +22 -20
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/FilteringPlugin.d.ts +11 -1
- package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -1
- package/lib/plugins/filtering/index.js +160 -125
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/index.js +20 -18
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/index.js +66 -64
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/master-detail/index.js +51 -49
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/multi-sort/index.js +17 -15
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/index.js +24 -22
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-rows/index.js +25 -23
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pivot/index.js +49 -47
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/reorder/index.js +24 -22
- package/lib/plugins/reorder/index.js.map +1 -1
- package/lib/plugins/responsive/index.js +19 -17
- package/lib/plugins/responsive/index.js.map +1 -1
- package/lib/plugins/row-reorder/index.js +38 -36
- package/lib/plugins/row-reorder/index.js.map +1 -1
- package/lib/plugins/selection/SelectionPlugin.d.ts +13 -0
- package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
- package/lib/plugins/selection/index.d.ts +1 -1
- package/lib/plugins/selection/index.d.ts.map +1 -1
- package/lib/plugins/selection/index.js +118 -85
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/selection/types.d.ts +50 -6
- package/lib/plugins/selection/types.d.ts.map +1 -1
- package/lib/plugins/server-side/index.js +34 -32
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/tree/index.js +25 -23
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/undo-redo/index.js +22 -20
- package/lib/plugins/undo-redo/index.js.map +1 -1
- package/lib/plugins/visibility/index.js +21 -19
- package/lib/plugins/visibility/index.js.map +1 -1
- package/package.json +21 -4
- package/public.d.ts +1 -1
- package/public.d.ts.map +1 -1
- package/umd/grid.all.umd.js +19 -19
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +9 -9
- package/umd/grid.umd.js.map +1 -1
- package/umd/plugins/clipboard.umd.js +5 -5
- package/umd/plugins/clipboard.umd.js.map +1 -1
- package/umd/plugins/editing.umd.js +1 -1
- package/umd/plugins/editing.umd.js.map +1 -1
- package/umd/plugins/filtering.umd.js +1 -1
- package/umd/plugins/filtering.umd.js.map +1 -1
- package/umd/plugins/selection.umd.js +2 -2
- package/umd/plugins/selection.umd.js.map +1 -1
package/all.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { BaseGridPlugin as R, DEFAULT_GRID_ICONS as
|
|
2
|
-
import { DEFAULT_ANIMATION_CONFIG as
|
|
3
|
-
const
|
|
1
|
+
import { BaseGridPlugin as R, DEFAULT_GRID_ICONS as Ye, a as Xe, runAggregator as ce, e as Ze, s as Je, PLUGIN_QUERIES as Oe, getAggregator as ue, getValueAggregator as Qe, b as _, c as he, g as et } from "./index.js";
|
|
2
|
+
import { DEFAULT_ANIMATION_CONFIG as gn, DGEvents as pn, DataGridElement as mn, FitModeEnum as wn, GridCSSVars as bn, GridClasses as vn, GridDataAttrs as yn, DataGridElement as Cn, GridSelectors as xn, PluginEvents as Rn, PluginManager as En, RenderPhase as Sn, builtInSort as kn, createGrid as An, defaultComparator as _n, queryGrid as Ln } from "./index.js";
|
|
3
|
+
const Be = "__tbw_expander", tt = 32;
|
|
4
4
|
function re(s) {
|
|
5
|
-
return s.field ===
|
|
5
|
+
return s.field === Be;
|
|
6
6
|
}
|
|
7
7
|
function I(s) {
|
|
8
8
|
return s.meta?.utility === !0;
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function it(s) {
|
|
11
11
|
return s.find(re);
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function nt(s) {
|
|
14
14
|
return {
|
|
15
|
-
field:
|
|
15
|
+
field: Be,
|
|
16
16
|
header: "",
|
|
17
|
-
width:
|
|
17
|
+
width: tt,
|
|
18
18
|
resizable: !1,
|
|
19
19
|
sortable: !1,
|
|
20
20
|
filterable: !1,
|
|
@@ -37,7 +37,7 @@ async function W(s) {
|
|
|
37
37
|
return document.body.removeChild(e), t;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function fe(s, e) {
|
|
41
41
|
const t = e.delimiter ?? " ", i = e.newline ?? `
|
|
42
42
|
`, n = s.replace(/\r\n/g, `
|
|
43
43
|
`).replace(/\r/g, `
|
|
@@ -49,35 +49,39 @@ function he(s, e) {
|
|
|
49
49
|
}
|
|
50
50
|
return o.push(a), (o.length > 1 || o.some((d) => d.trim() !== "")) && r.push(o), r;
|
|
51
51
|
}
|
|
52
|
-
async function
|
|
52
|
+
async function rt() {
|
|
53
53
|
try {
|
|
54
54
|
return await navigator.clipboard.readText();
|
|
55
55
|
} catch {
|
|
56
56
|
return "";
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function ot(s, e) {
|
|
60
60
|
const { rows: t, target: i, fields: n } = s;
|
|
61
61
|
if (!i) return;
|
|
62
|
-
const r = e.rows,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
const r = e.rows, o = e.effectiveConfig.columns ?? [], a = o.map((u) => u.field), l = /* @__PURE__ */ new Map();
|
|
63
|
+
o.forEach((u) => {
|
|
64
|
+
l.set(u.field, u.editable === !0);
|
|
65
|
+
});
|
|
66
|
+
const d = [...r], c = i.bounds ? i.bounds.endRow : 1 / 0;
|
|
67
|
+
t.forEach((u, h) => {
|
|
68
|
+
const f = i.row + h;
|
|
69
|
+
if (!(f > c)) {
|
|
66
70
|
if (i.bounds) {
|
|
67
|
-
if (
|
|
71
|
+
if (f >= d.length)
|
|
68
72
|
return;
|
|
69
|
-
} else for (;
|
|
73
|
+
} else for (; f >= d.length; ) {
|
|
70
74
|
const g = {};
|
|
71
|
-
a.forEach((
|
|
75
|
+
a.forEach((p) => g[p] = ""), d.push(g);
|
|
72
76
|
}
|
|
73
|
-
|
|
74
|
-
const
|
|
75
|
-
|
|
77
|
+
d[f] = { ...d[f] }, u.forEach((g, p) => {
|
|
78
|
+
const m = n[p];
|
|
79
|
+
m && l.get(m) && (d[f][m] = g);
|
|
76
80
|
});
|
|
77
81
|
}
|
|
78
|
-
}), e.rows =
|
|
82
|
+
}), e.rows = d;
|
|
79
83
|
}
|
|
80
|
-
class
|
|
84
|
+
class Ui extends R {
|
|
81
85
|
static dependencies = [
|
|
82
86
|
{ name: "selection", required: !1, reason: "Enables copy/paste of selected cells instead of entire grid" }
|
|
83
87
|
];
|
|
@@ -141,19 +145,19 @@ class $i extends R {
|
|
|
141
145
|
const t = e.clipboardData?.getData("text/plain");
|
|
142
146
|
if (!t) return;
|
|
143
147
|
e.preventDefault();
|
|
144
|
-
const i =
|
|
148
|
+
const i = fe(t, this.config), r = this.#i()?.getSelection(), o = r?.ranges?.[0], a = o?.from.row ?? 0, l = o?.from.col ?? 0, c = o && (r?.mode === "range" || r?.mode === "row") && (o.from.row !== o.to.row || o.from.col !== o.to.col) ? { endRow: o.to.row, endCol: o.to.col } : null, u = c?.endCol ?? this.columns.length - 1, h = this.columns[l], f = h ? { row: a, col: l, field: h.field, bounds: c } : null, g = [], p = i[0]?.length ?? 0;
|
|
145
149
|
for (let w = 0; w < p && l + w <= u; w++) {
|
|
146
150
|
const b = this.columns[l + w];
|
|
147
|
-
b && !b.hidden &&
|
|
151
|
+
b && !b.hidden && g.push(b.field);
|
|
148
152
|
}
|
|
149
|
-
const m = { rows: i, text: t, target:
|
|
153
|
+
const m = { rows: i, text: t, target: f, fields: g };
|
|
150
154
|
this.emit("paste", m), this.#o(m);
|
|
151
155
|
}
|
|
152
156
|
#o(e) {
|
|
153
157
|
if (!this.grid) return;
|
|
154
158
|
const { pasteHandler: t } = this.config;
|
|
155
159
|
if (t === null) return;
|
|
156
|
-
(t ??
|
|
160
|
+
(t ?? ot)(e, this.grid);
|
|
157
161
|
}
|
|
158
162
|
#i() {
|
|
159
163
|
try {
|
|
@@ -165,15 +169,15 @@ class $i extends R {
|
|
|
165
169
|
}
|
|
166
170
|
#n(e) {
|
|
167
171
|
const { startRow: t, startCol: i, endRow: n, endCol: r } = e, o = Math.min(t, n), a = Math.max(t, n), l = Math.min(i, r), d = Math.max(i, r), c = this.config.delimiter ?? " ", u = this.config.newline ?? `
|
|
168
|
-
`, h = [],
|
|
172
|
+
`, h = [], f = this.columns.slice(l, d + 1).filter((g) => !I(g));
|
|
169
173
|
if (this.config.includeHeaders) {
|
|
170
|
-
const
|
|
171
|
-
h.push(
|
|
174
|
+
const g = f.map((p) => p.header || p.field);
|
|
175
|
+
h.push(g.join(c));
|
|
172
176
|
}
|
|
173
|
-
for (let
|
|
174
|
-
const p = this.rows[
|
|
177
|
+
for (let g = o; g <= a; g++) {
|
|
178
|
+
const p = this.rows[g];
|
|
175
179
|
if (!p) continue;
|
|
176
|
-
const m =
|
|
180
|
+
const m = f.map((w) => {
|
|
177
181
|
const b = p[w.field];
|
|
178
182
|
return b == null ? "" : b instanceof Date ? b.toISOString() : String(b);
|
|
179
183
|
});
|
|
@@ -221,8 +225,8 @@ class $i extends R {
|
|
|
221
225
|
return await W(r.text), this.lastCopied = { text: r.text, timestamp: Date.now() }, r.text;
|
|
222
226
|
}
|
|
223
227
|
async paste() {
|
|
224
|
-
const e = await
|
|
225
|
-
return e ?
|
|
228
|
+
const e = await rt();
|
|
229
|
+
return e ? fe(e, this.config) : null;
|
|
226
230
|
}
|
|
227
231
|
getLastCopied() {
|
|
228
232
|
return this.lastCopied;
|
|
@@ -237,24 +241,24 @@ function oe(s) {
|
|
|
237
241
|
const e = parseFloat(s);
|
|
238
242
|
return isNaN(e) ? ge : e;
|
|
239
243
|
}
|
|
240
|
-
function
|
|
244
|
+
function pe(s) {
|
|
241
245
|
return s.map((e) => oe(e.width));
|
|
242
246
|
}
|
|
243
|
-
function
|
|
247
|
+
function me(s) {
|
|
244
248
|
const e = [];
|
|
245
249
|
let t = 0;
|
|
246
250
|
for (const i of s)
|
|
247
251
|
e.push(t), t += oe(i.width);
|
|
248
252
|
return e;
|
|
249
253
|
}
|
|
250
|
-
function
|
|
254
|
+
function we(s) {
|
|
251
255
|
return s.reduce((e, t) => e + oe(t.width), 0);
|
|
252
256
|
}
|
|
253
|
-
function
|
|
257
|
+
function st(s, e, t, i, n) {
|
|
254
258
|
const r = t.length;
|
|
255
259
|
if (r === 0)
|
|
256
260
|
return { startCol: 0, endCol: 0, visibleColumns: [] };
|
|
257
|
-
let o =
|
|
261
|
+
let o = at(s, t, i);
|
|
258
262
|
o = Math.max(0, o - n);
|
|
259
263
|
const a = s + e;
|
|
260
264
|
let l = o;
|
|
@@ -271,7 +275,7 @@ function rt(s, e, t, i, n) {
|
|
|
271
275
|
d.push(c);
|
|
272
276
|
return { startCol: o, endCol: l, visibleColumns: d };
|
|
273
277
|
}
|
|
274
|
-
function
|
|
278
|
+
function at(s, e, t) {
|
|
275
279
|
let i = 0, n = e.length - 1;
|
|
276
280
|
for (; i < n; ) {
|
|
277
281
|
const r = Math.floor((i + n) / 2);
|
|
@@ -279,10 +283,10 @@ function ot(s, e, t) {
|
|
|
279
283
|
}
|
|
280
284
|
return i;
|
|
281
285
|
}
|
|
282
|
-
function
|
|
286
|
+
function lt(s, e, t) {
|
|
283
287
|
return t ? s > e : !1;
|
|
284
288
|
}
|
|
285
|
-
class
|
|
289
|
+
class Yi extends R {
|
|
286
290
|
name = "columnVirtualization";
|
|
287
291
|
get defaultConfig() {
|
|
288
292
|
return {
|
|
@@ -301,16 +305,16 @@ class ji extends R {
|
|
|
301
305
|
attach(e) {
|
|
302
306
|
super.attach(e);
|
|
303
307
|
const t = this.columns;
|
|
304
|
-
this.columnWidths =
|
|
308
|
+
this.columnWidths = pe(t), this.columnOffsets = me(t), this.totalWidth = we(t), this.endCol = t.length - 1;
|
|
305
309
|
}
|
|
306
310
|
detach() {
|
|
307
311
|
this.columnWidths = [], this.columnOffsets = [], this.isVirtualized = !1, this.startCol = 0, this.endCol = 0, this.scrollLeft = 0, this.totalWidth = 0;
|
|
308
312
|
}
|
|
309
313
|
processColumns(e) {
|
|
310
|
-
const t =
|
|
311
|
-
if (this.isVirtualized = t ?? !1, this.columnWidths =
|
|
314
|
+
const t = lt(e.length, this.config.threshold ?? 30, this.config.autoEnable ?? !0);
|
|
315
|
+
if (this.isVirtualized = t ?? !1, this.columnWidths = pe(e), this.columnOffsets = me(e), this.totalWidth = we(e), !t)
|
|
312
316
|
return this.startCol = 0, this.endCol = e.length - 1, [...e];
|
|
313
|
-
const i = this.grid.clientWidth || 800, n =
|
|
317
|
+
const i = this.grid.clientWidth || 800, n = st(
|
|
314
318
|
this.scrollLeft,
|
|
315
319
|
i,
|
|
316
320
|
this.columnOffsets,
|
|
@@ -354,10 +358,10 @@ const $ = "@layer tbw-plugins{.tbw-context-menu{position:fixed;background:var(--
|
|
|
354
358
|
function te(s, e) {
|
|
355
359
|
return (typeof s == "function" ? s(e) : s).filter((i) => !(i.hidden === !0 || typeof i.hidden == "function" && i.hidden(e)));
|
|
356
360
|
}
|
|
357
|
-
function
|
|
361
|
+
function dt(s, e) {
|
|
358
362
|
return s.disabled === !0 ? !0 : typeof s.disabled == "function" ? s.disabled(e) : !1;
|
|
359
363
|
}
|
|
360
|
-
function ie(s, e, t, i =
|
|
364
|
+
function ie(s, e, t, i = Ye.submenuArrow) {
|
|
361
365
|
const n = document.createElement("div");
|
|
362
366
|
n.className = "tbw-context-menu", n.setAttribute("role", "menu");
|
|
363
367
|
for (const r of s) {
|
|
@@ -368,7 +372,7 @@ function ie(s, e, t, i = Ue.submenuArrow) {
|
|
|
368
372
|
}
|
|
369
373
|
const o = document.createElement("div");
|
|
370
374
|
o.className = "tbw-context-menu-item", r.cssClass && o.classList.add(r.cssClass), o.setAttribute("role", "menuitem"), o.setAttribute("data-id", r.id);
|
|
371
|
-
const a =
|
|
375
|
+
const a = dt(r, e);
|
|
372
376
|
if (a && (o.classList.add("disabled"), o.setAttribute("aria-disabled", "true")), r.icon) {
|
|
373
377
|
const d = document.createElement("span");
|
|
374
378
|
d.className = "tbw-context-menu-icon", d.innerHTML = r.icon, o.appendChild(d);
|
|
@@ -395,13 +399,13 @@ function ie(s, e, t, i = Ue.submenuArrow) {
|
|
|
395
399
|
}
|
|
396
400
|
return n;
|
|
397
401
|
}
|
|
398
|
-
function
|
|
402
|
+
function be(s, e, t) {
|
|
399
403
|
s.style.position = "fixed", s.style.left = `${e}px`, s.style.top = `${t}px`, s.style.visibility = "hidden", s.style.zIndex = "10000";
|
|
400
404
|
const i = s.getBoundingClientRect(), n = window.innerWidth, r = window.innerHeight;
|
|
401
405
|
let o = e, a = t;
|
|
402
406
|
e + i.width > n && (o = e - i.width), t + i.height > r && (a = t - i.height), o = Math.max(0, o), a = Math.max(0, a), s.style.left = `${o}px`, s.style.top = `${a}px`, s.style.visibility = "visible";
|
|
403
407
|
}
|
|
404
|
-
let
|
|
408
|
+
let F = null, D = null, L = null, j = 0;
|
|
405
409
|
const U = [
|
|
406
410
|
{
|
|
407
411
|
id: "copy",
|
|
@@ -420,7 +424,7 @@ const U = [
|
|
|
420
424
|
}
|
|
421
425
|
}
|
|
422
426
|
];
|
|
423
|
-
class
|
|
427
|
+
class Xi extends R {
|
|
424
428
|
name = "contextMenu";
|
|
425
429
|
get defaultConfig() {
|
|
426
430
|
return {
|
|
@@ -438,14 +442,14 @@ class Ui extends R {
|
|
|
438
442
|
this.menuElement && (this.menuElement.remove(), this.menuElement = null), this.isOpen = !1, this.params = null, this.uninstallGlobalHandlers();
|
|
439
443
|
}
|
|
440
444
|
installGlobalHandlers() {
|
|
441
|
-
!
|
|
445
|
+
!L && typeof document < "u" && typeof $ == "string" && $ && (L = document.createElement("style"), L.id = "tbw-context-menu-styles", L.textContent = $, document.head.appendChild(L)), F || (F = () => {
|
|
442
446
|
document.querySelectorAll(".tbw-context-menu").forEach((t) => t.remove());
|
|
443
|
-
}, document.addEventListener("click",
|
|
447
|
+
}, document.addEventListener("click", F)), D || (D = (e) => {
|
|
444
448
|
e.key === "Escape" && document.querySelectorAll(".tbw-context-menu").forEach((i) => i.remove());
|
|
445
|
-
}, document.addEventListener("keydown",
|
|
449
|
+
}, document.addEventListener("keydown", D));
|
|
446
450
|
}
|
|
447
451
|
uninstallGlobalHandlers() {
|
|
448
|
-
j--, !(j > 0) && (
|
|
452
|
+
j--, !(j > 0) && (F && (document.removeEventListener("click", F), F = null), D && (document.removeEventListener("keydown", D), D = null), L && (L.remove(), L = null));
|
|
449
453
|
}
|
|
450
454
|
afterRender() {
|
|
451
455
|
const e = this.gridElement;
|
|
@@ -457,14 +461,14 @@ class Ui extends R {
|
|
|
457
461
|
const r = n.target, o = r.closest("[data-row][data-col]"), a = r.closest(".header-cell");
|
|
458
462
|
let l;
|
|
459
463
|
if (o) {
|
|
460
|
-
const c = parseInt(o.getAttribute("data-row") ?? "-1", 10), u = parseInt(o.getAttribute("data-col") ?? "-1", 10), h = this.columns[u],
|
|
464
|
+
const c = parseInt(o.getAttribute("data-row") ?? "-1", 10), u = parseInt(o.getAttribute("data-col") ?? "-1", 10), h = this.columns[u], f = this.rows[c];
|
|
461
465
|
l = {
|
|
462
|
-
row:
|
|
466
|
+
row: f,
|
|
463
467
|
rowIndex: c,
|
|
464
468
|
column: h,
|
|
465
469
|
columnIndex: u,
|
|
466
470
|
field: h?.field ?? "",
|
|
467
|
-
value:
|
|
471
|
+
value: f?.[h?.field] ?? null,
|
|
468
472
|
isHeader: !1,
|
|
469
473
|
event: n
|
|
470
474
|
};
|
|
@@ -491,7 +495,7 @@ class Ui extends R {
|
|
|
491
495
|
c.action && c.action(l), this.menuElement?.remove(), this.menuElement = null, this.isOpen = !1;
|
|
492
496
|
},
|
|
493
497
|
this.gridIcons.submenuArrow
|
|
494
|
-
), document.body.appendChild(this.menuElement),
|
|
498
|
+
), document.body.appendChild(this.menuElement), be(this.menuElement, n.clientX, n.clientY), this.isOpen = !0, this.emit("context-menu-open", { params: l, items: d }));
|
|
495
499
|
}));
|
|
496
500
|
}
|
|
497
501
|
showMenu(e, t, i) {
|
|
@@ -512,7 +516,7 @@ class Ui extends R {
|
|
|
512
516
|
o.action && o.action(n), this.menuElement?.remove(), this.menuElement = null, this.isOpen = !1;
|
|
513
517
|
},
|
|
514
518
|
this.gridIcons.submenuArrow
|
|
515
|
-
), document.body.appendChild(this.menuElement),
|
|
519
|
+
), document.body.appendChild(this.menuElement), be(this.menuElement, e, t), this.isOpen = !0;
|
|
516
520
|
}
|
|
517
521
|
hideMenu() {
|
|
518
522
|
this.menuElement && (this.menuElement.remove(), this.menuElement = null, this.isOpen = !1);
|
|
@@ -521,12 +525,12 @@ class Ui extends R {
|
|
|
521
525
|
return this.isOpen;
|
|
522
526
|
}
|
|
523
527
|
}
|
|
524
|
-
const
|
|
525
|
-
function
|
|
528
|
+
const ct = "@layer tbw-plugins{tbw-grid{--tbw-editing-bg: var(--tbw-color-selection);--tbw-editing-row-bg: var(--tbw-editing-bg);--tbw-editing-border: var(--tbw-border-input, 1px solid var(--tbw-color-border-strong));--tbw-padding-editing-input: var(--tbw-cell-padding-input, 2px 6px);--tbw-font-size-editor: inherit;--tbw-editing-row-outline-color: var(--tbw-color-accent);--tbw-editing-row-outline-width: 1px;.data-grid-row:has(.editing){background:var(--tbw-editing-row-bg);outline:var(--tbw-editing-row-outline-width) solid var(--tbw-editing-row-outline-color);outline-offset:calc(-1 * var(--tbw-editing-row-outline-width))}.data-grid-row>.cell.editing{overflow:hidden;padding:0;display:flex;min-height:calc(var(--tbw-row-height) + 2px);align-items:center;justify-content:center}.data-grid-row>.cell.editing input:not([type=checkbox]),.data-grid-row>.cell.editing select,.data-grid-row>.cell.editing textarea{width:100%;height:100%;flex:1 1 auto;min-width:0;border:var(--tbw-editing-border);padding:var(--tbw-padding-editing-input);font-size:var(--tbw-font-size-editor)}.tbw-editor-host{display:contents}}}";
|
|
529
|
+
function ut(s) {
|
|
526
530
|
const e = s.options;
|
|
527
531
|
return e ? typeof e == "function" ? e() : e : [];
|
|
528
532
|
}
|
|
529
|
-
function
|
|
533
|
+
function ht(s) {
|
|
530
534
|
return (e) => {
|
|
531
535
|
const t = s.editorParams, i = document.createElement("input");
|
|
532
536
|
i.type = "number", i.value = e.value != null ? String(e.value) : "", t?.min !== void 0 && (i.min = String(t.min)), t?.max !== void 0 && (i.max = String(t.max)), t?.step !== void 0 && (i.step = String(t.step)), t?.placeholder && (i.placeholder = t.placeholder);
|
|
@@ -536,13 +540,13 @@ function ct(s) {
|
|
|
536
540
|
}), i;
|
|
537
541
|
};
|
|
538
542
|
}
|
|
539
|
-
function
|
|
543
|
+
function ft() {
|
|
540
544
|
return (s) => {
|
|
541
545
|
const e = document.createElement("input");
|
|
542
546
|
return e.type = "checkbox", e.checked = !!s.value, e.addEventListener("change", () => s.commit(e.checked)), e;
|
|
543
547
|
};
|
|
544
548
|
}
|
|
545
|
-
function
|
|
549
|
+
function gt(s) {
|
|
546
550
|
return (e) => {
|
|
547
551
|
const t = s.editorParams, i = document.createElement("input");
|
|
548
552
|
return i.type = "date", e.value instanceof Date && (i.valueAsDate = e.value), t?.min && (i.min = t.min), t?.max && (i.max = t.max), t?.placeholder && (i.placeholder = t.placeholder), i.addEventListener("change", () => e.commit(i.valueAsDate)), i.addEventListener("keydown", (n) => {
|
|
@@ -550,14 +554,14 @@ function ht(s) {
|
|
|
550
554
|
}), i;
|
|
551
555
|
};
|
|
552
556
|
}
|
|
553
|
-
function
|
|
557
|
+
function pt(s) {
|
|
554
558
|
return (e) => {
|
|
555
559
|
const t = s.editorParams, i = document.createElement("select");
|
|
556
560
|
if (s.multi && (i.multiple = !0), t?.includeEmpty) {
|
|
557
561
|
const o = document.createElement("option");
|
|
558
562
|
o.value = "", o.textContent = t.emptyLabel ?? "", i.appendChild(o);
|
|
559
563
|
}
|
|
560
|
-
|
|
564
|
+
ut(s).forEach((o) => {
|
|
561
565
|
const a = document.createElement("option");
|
|
562
566
|
a.value = String(o.value), a.textContent = o.label, (s.multi && Array.isArray(e.value) && e.value.includes(o.value) || !s.multi && e.value === o.value) && (a.selected = !0), i.appendChild(a);
|
|
563
567
|
});
|
|
@@ -573,7 +577,7 @@ function gt(s) {
|
|
|
573
577
|
}), i;
|
|
574
578
|
};
|
|
575
579
|
}
|
|
576
|
-
function
|
|
580
|
+
function mt(s) {
|
|
577
581
|
return (e) => {
|
|
578
582
|
const t = s.editorParams, i = document.createElement("input");
|
|
579
583
|
return i.type = "text", i.value = e.value != null ? String(e.value) : "", t?.maxLength !== void 0 && (i.maxLength = t.maxLength), t?.pattern && (i.pattern = t.pattern), t?.placeholder && (i.placeholder = t.placeholder), i.addEventListener("blur", () => e.commit(i.value)), i.addEventListener("keydown", (n) => {
|
|
@@ -581,22 +585,22 @@ function ft(s) {
|
|
|
581
585
|
}), i;
|
|
582
586
|
};
|
|
583
587
|
}
|
|
584
|
-
function
|
|
588
|
+
function wt(s) {
|
|
585
589
|
switch (s.type) {
|
|
586
590
|
case "number":
|
|
587
|
-
return
|
|
591
|
+
return ht(s);
|
|
588
592
|
case "boolean":
|
|
589
|
-
return
|
|
593
|
+
return ft();
|
|
590
594
|
case "date":
|
|
591
|
-
return ht(s);
|
|
592
|
-
case "select":
|
|
593
595
|
return gt(s);
|
|
596
|
+
case "select":
|
|
597
|
+
return pt(s);
|
|
594
598
|
default:
|
|
595
|
-
return
|
|
599
|
+
return mt(s);
|
|
596
600
|
}
|
|
597
601
|
}
|
|
598
602
|
const Y = 'input,select,textarea,[contenteditable="true"],[contenteditable=""],[tabindex]:not([tabindex="-1"])';
|
|
599
|
-
function
|
|
603
|
+
function bt(s, e) {
|
|
600
604
|
if (e.editor) return e.editor;
|
|
601
605
|
if (e.__editorTemplate) return "template";
|
|
602
606
|
if (!e.type) return;
|
|
@@ -613,25 +617,25 @@ function mt(s, e) {
|
|
|
613
617
|
function K(s) {
|
|
614
618
|
return !(typeof s != "string" || s === "__proto__" || s === "constructor" || s === "prototype");
|
|
615
619
|
}
|
|
616
|
-
function
|
|
620
|
+
function vt(s) {
|
|
617
621
|
const e = (s.__editingCellCount ?? 0) + 1;
|
|
618
622
|
s.__editingCellCount = e, s.setAttribute("data-has-editing", "");
|
|
619
623
|
}
|
|
620
|
-
function
|
|
624
|
+
function yt(s) {
|
|
621
625
|
s.__editingCellCount = 0, s.removeAttribute("data-has-editing");
|
|
622
626
|
}
|
|
623
627
|
function N(s, e) {
|
|
624
628
|
return s instanceof HTMLInputElement ? s.type === "checkbox" ? s.checked : s.type === "number" ? s.value === "" ? null : Number(s.value) : s.type === "date" ? s.valueAsDate : s.value : e?.type === "number" && s.value !== "" ? Number(s.value) : s.value;
|
|
625
629
|
}
|
|
626
|
-
function
|
|
630
|
+
function ve(s) {
|
|
627
631
|
}
|
|
628
|
-
function
|
|
632
|
+
function Ct(s, e, t) {
|
|
629
633
|
const i = s.querySelector("input,textarea,select");
|
|
630
634
|
i && (i.addEventListener("blur", () => {
|
|
631
635
|
t(N(i, e));
|
|
632
636
|
}), i instanceof HTMLInputElement && i.type === "checkbox" ? i.addEventListener("change", () => t(i.checked)) : i instanceof HTMLSelectElement && i.addEventListener("change", () => t(N(i, e))));
|
|
633
637
|
}
|
|
634
|
-
class
|
|
638
|
+
class Zi extends R {
|
|
635
639
|
static manifest = {
|
|
636
640
|
ownedProperties: [
|
|
637
641
|
{
|
|
@@ -653,7 +657,7 @@ class Yi extends R {
|
|
|
653
657
|
]
|
|
654
658
|
};
|
|
655
659
|
name = "editing";
|
|
656
|
-
styles =
|
|
660
|
+
styles = ct;
|
|
657
661
|
get defaultConfig() {
|
|
658
662
|
return {
|
|
659
663
|
editOn: "click"
|
|
@@ -743,12 +747,12 @@ class Yi extends R {
|
|
|
743
747
|
}
|
|
744
748
|
});
|
|
745
749
|
this.gridElement.dispatchEvent(h);
|
|
746
|
-
const
|
|
750
|
+
const f = new CustomEvent("activate-cell", {
|
|
747
751
|
cancelable: !0,
|
|
748
752
|
bubbles: !0,
|
|
749
753
|
detail: { row: n, col: r }
|
|
750
754
|
});
|
|
751
|
-
return this.gridElement.dispatchEvent(
|
|
755
|
+
return this.gridElement.dispatchEvent(f), h.defaultPrevented || f.defaultPrevented ? (e.preventDefault(), !0) : (this.beginBulkEdit(n), !0);
|
|
752
756
|
}
|
|
753
757
|
return !1;
|
|
754
758
|
}
|
|
@@ -886,8 +890,8 @@ class Yi extends R {
|
|
|
886
890
|
if (!u) return;
|
|
887
891
|
const h = d.querySelector("input,textarea,select");
|
|
888
892
|
if (h) {
|
|
889
|
-
const
|
|
890
|
-
r[u.field] !==
|
|
893
|
+
const f = N(h, u);
|
|
894
|
+
r[u.field] !== f && this.#u(e, u, f, r);
|
|
891
895
|
}
|
|
892
896
|
}), t && n && r)
|
|
893
897
|
Object.keys(n).forEach((l) => {
|
|
@@ -902,13 +906,13 @@ class Yi extends R {
|
|
|
902
906
|
changed: l,
|
|
903
907
|
changedRows: this.changedRows,
|
|
904
908
|
changedRowIds: this.changedRowIds
|
|
905
|
-
});
|
|
909
|
+
}), l && this.isAnimationEnabled && i.animateRow?.(e, "change");
|
|
906
910
|
}
|
|
907
911
|
this.#o.delete(e), this.#e = -1, this.#t = -1, this.#l();
|
|
908
912
|
for (const l of this.#n)
|
|
909
913
|
l.startsWith(`${e}:`) && this.#n.delete(l);
|
|
910
914
|
o && (o.querySelectorAll(".cell.editing").forEach((l) => {
|
|
911
|
-
l.classList.remove("editing"),
|
|
915
|
+
l.classList.remove("editing"), yt(l.parentElement);
|
|
912
916
|
}), this.requestRender()), this.#s = !0, o || (this.#h(i), this.#s = !1);
|
|
913
917
|
}
|
|
914
918
|
#u(e, t, i, n) {
|
|
@@ -922,7 +926,7 @@ class Yi extends R {
|
|
|
922
926
|
l = this.grid.getRowId(n);
|
|
923
927
|
} catch {
|
|
924
928
|
}
|
|
925
|
-
const d = l ? !this.#i.has(l) : !0, c = l ? (
|
|
929
|
+
const d = l ? !this.#i.has(l) : !0, c = l ? (f) => this.grid.updateRow(l, f, "cascade") : ve;
|
|
926
930
|
if (this.emitCancelable("cell-commit", {
|
|
927
931
|
row: n,
|
|
928
932
|
rowId: l ?? "",
|
|
@@ -937,7 +941,7 @@ class Yi extends R {
|
|
|
937
941
|
})) return;
|
|
938
942
|
n[r] = i, l && this.#i.add(l), this.#l();
|
|
939
943
|
const h = a.findRenderedRowElement?.(e);
|
|
940
|
-
h && h.classList.add("changed");
|
|
944
|
+
h && (h.classList.add("changed"), Xe(h, "change"));
|
|
941
945
|
}
|
|
942
946
|
#p(e, t, i, n, r, o) {
|
|
943
947
|
if (!i.editable || r.classList.contains("editing")) return;
|
|
@@ -946,26 +950,26 @@ class Yi extends R {
|
|
|
946
950
|
a = this.grid.getRowId(e);
|
|
947
951
|
} catch {
|
|
948
952
|
}
|
|
949
|
-
const l = a ? (v) => this.grid.updateRow(a, v, "cascade") :
|
|
953
|
+
const l = a ? (v) => this.grid.updateRow(a, v, "cascade") : ve, d = K(i.field) ? e[i.field] : void 0;
|
|
950
954
|
r.classList.add("editing"), this.#n.add(`${t}:${n}`);
|
|
951
955
|
const c = r.parentElement;
|
|
952
|
-
c &&
|
|
956
|
+
c && vt(c);
|
|
953
957
|
let u = !1;
|
|
954
958
|
const h = (v) => {
|
|
955
959
|
u || this.#e === -1 || this.#u(t, i, v, e);
|
|
956
|
-
},
|
|
960
|
+
}, f = () => {
|
|
957
961
|
u = !0, K(i.field) && (e[i.field] = d);
|
|
958
|
-
},
|
|
959
|
-
|
|
960
|
-
v.key === "Enter" && (v.stopPropagation(), v.preventDefault(), u = !0, this.#r(t, !1)), v.key === "Escape" && (v.stopPropagation(), v.preventDefault(),
|
|
962
|
+
}, g = document.createElement("div");
|
|
963
|
+
g.className = "tbw-editor-host", r.innerHTML = "", r.appendChild(g), g.addEventListener("keydown", (v) => {
|
|
964
|
+
v.key === "Enter" && (v.stopPropagation(), v.preventDefault(), u = !0, this.#r(t, !1)), v.key === "Escape" && (v.stopPropagation(), v.preventDefault(), f(), this.#r(t, !0));
|
|
961
965
|
});
|
|
962
|
-
const p = i, m = p.__editorTemplate, w =
|
|
966
|
+
const p = i, m = p.__editorTemplate, w = bt(this.grid, p) ?? wt(i), b = d;
|
|
963
967
|
if (w === "template" && m)
|
|
964
|
-
this.#a(
|
|
968
|
+
this.#a(g, p, e, d, h, f, o, t);
|
|
965
969
|
else if (typeof w == "string") {
|
|
966
970
|
const v = document.createElement(w);
|
|
967
|
-
v.value = b, v.addEventListener("change", () => h(v.value)),
|
|
968
|
-
|
|
971
|
+
v.value = b, v.addEventListener("change", () => h(v.value)), g.appendChild(v), o || queueMicrotask(() => {
|
|
972
|
+
g.querySelector(Y)?.focus({ preventScroll: !0 });
|
|
969
973
|
});
|
|
970
974
|
} else if (typeof w == "function") {
|
|
971
975
|
const v = {
|
|
@@ -975,34 +979,34 @@ class Yi extends R {
|
|
|
975
979
|
field: i.field,
|
|
976
980
|
column: i,
|
|
977
981
|
commit: h,
|
|
978
|
-
cancel:
|
|
982
|
+
cancel: f,
|
|
979
983
|
updateRow: l
|
|
980
|
-
},
|
|
981
|
-
typeof
|
|
982
|
-
|
|
984
|
+
}, S = w(v);
|
|
985
|
+
typeof S == "string" ? (g.innerHTML = S, Ct(g, i, h)) : S instanceof Node && g.appendChild(S), o || queueMicrotask(() => {
|
|
986
|
+
g.querySelector(Y)?.focus({ preventScroll: !0 });
|
|
983
987
|
});
|
|
984
988
|
} else if (w && typeof w == "object") {
|
|
985
989
|
const v = document.createElement("div");
|
|
986
|
-
v.setAttribute("data-external-editor", ""), v.setAttribute("data-field", i.field),
|
|
987
|
-
const
|
|
990
|
+
v.setAttribute("data-external-editor", ""), v.setAttribute("data-field", i.field), g.appendChild(v);
|
|
991
|
+
const S = {
|
|
988
992
|
row: e,
|
|
989
993
|
rowId: a ?? "",
|
|
990
994
|
value: b,
|
|
991
995
|
field: i.field,
|
|
992
996
|
column: i,
|
|
993
997
|
commit: h,
|
|
994
|
-
cancel:
|
|
998
|
+
cancel: f,
|
|
995
999
|
updateRow: l
|
|
996
1000
|
};
|
|
997
1001
|
if (w.mount)
|
|
998
1002
|
try {
|
|
999
|
-
w.mount({ placeholder: v, context:
|
|
1003
|
+
w.mount({ placeholder: v, context: S, spec: w });
|
|
1000
1004
|
} catch (q) {
|
|
1001
1005
|
console.warn(`[tbw-grid] External editor mount error for column '${i.field}':`, q);
|
|
1002
1006
|
}
|
|
1003
1007
|
else
|
|
1004
1008
|
this.grid.dispatchEvent(
|
|
1005
|
-
new CustomEvent("mount-external-editor", { detail: { placeholder: v, spec: w, context:
|
|
1009
|
+
new CustomEvent("mount-external-editor", { detail: { placeholder: v, spec: w, context: S } })
|
|
1006
1010
|
);
|
|
1007
1011
|
}
|
|
1008
1012
|
}
|
|
@@ -1017,8 +1021,8 @@ class Yi extends R {
|
|
|
1017
1021
|
column: t,
|
|
1018
1022
|
commit: r,
|
|
1019
1023
|
cancel: o
|
|
1020
|
-
}) : c.querySelectorAll("*").forEach((
|
|
1021
|
-
|
|
1024
|
+
}) : c.querySelectorAll("*").forEach((f) => {
|
|
1025
|
+
f.childNodes.length === 1 && f.firstChild?.nodeType === Node.TEXT_NODE && (f.textContent = f.textContent?.replace(/{{\s*value\s*}}/g, n == null ? "" : String(n)).replace(/{{\s*row\.([a-zA-Z0-9_]+)\s*}}/g, (g, p) => {
|
|
1022
1026
|
if (!K(p)) return "";
|
|
1023
1027
|
const m = i[p];
|
|
1024
1028
|
return m == null ? "" : String(m);
|
|
@@ -1029,12 +1033,12 @@ class Yi extends R {
|
|
|
1029
1033
|
);
|
|
1030
1034
|
if (h) {
|
|
1031
1035
|
h instanceof HTMLInputElement && h.type === "checkbox" ? h.checked = !!n : h.value = String(n ?? "");
|
|
1032
|
-
let
|
|
1036
|
+
let f = !1;
|
|
1033
1037
|
h.addEventListener("blur", () => {
|
|
1034
|
-
|
|
1035
|
-
}), h.addEventListener("keydown", (
|
|
1036
|
-
const p =
|
|
1037
|
-
p.key === "Enter" && (p.stopPropagation(), p.preventDefault(),
|
|
1038
|
+
f || r(N(h, t));
|
|
1039
|
+
}), h.addEventListener("keydown", (g) => {
|
|
1040
|
+
const p = g;
|
|
1041
|
+
p.key === "Enter" && (p.stopPropagation(), p.preventDefault(), f = !0, r(N(h, t)), this.#r(l, !1)), p.key === "Escape" && (p.stopPropagation(), p.preventDefault(), o(), this.#r(l, !0));
|
|
1038
1042
|
}), h instanceof HTMLInputElement && h.type === "checkbox" && h.addEventListener("change", () => r(h.checked)), a || setTimeout(() => h.focus({ preventScroll: !0 }), 0);
|
|
1039
1043
|
}
|
|
1040
1044
|
e.appendChild(c);
|
|
@@ -1055,7 +1059,7 @@ class Yi extends R {
|
|
|
1055
1059
|
});
|
|
1056
1060
|
}
|
|
1057
1061
|
}
|
|
1058
|
-
function
|
|
1062
|
+
function ye(s, e = !0) {
|
|
1059
1063
|
if (s == null) return "";
|
|
1060
1064
|
if (s instanceof Date) return s.toISOString();
|
|
1061
1065
|
if (typeof s == "object") return JSON.stringify(s);
|
|
@@ -1063,20 +1067,20 @@ function ve(s, e = !0) {
|
|
|
1063
1067
|
return e && (t.includes(",") || t.includes('"') || t.includes(`
|
|
1064
1068
|
`) || t.includes("\r")) ? `"${t.replace(/"/g, '""')}"` : t;
|
|
1065
1069
|
}
|
|
1066
|
-
function
|
|
1070
|
+
function xt(s, e, t, i = {}) {
|
|
1067
1071
|
const n = i.delimiter ?? ",", r = i.newline ?? `
|
|
1068
1072
|
`, o = [], a = i.bom ? "\uFEFF" : "";
|
|
1069
1073
|
if (t.includeHeaders !== !1) {
|
|
1070
1074
|
const l = e.map((d) => {
|
|
1071
1075
|
const c = d.header || d.field, u = t.processHeader ? t.processHeader(c, d.field) : c;
|
|
1072
|
-
return
|
|
1076
|
+
return ye(u);
|
|
1073
1077
|
});
|
|
1074
1078
|
o.push(l.join(n));
|
|
1075
1079
|
}
|
|
1076
1080
|
for (const l of s) {
|
|
1077
1081
|
const d = e.map((c) => {
|
|
1078
1082
|
let u = l[c.field];
|
|
1079
|
-
return t.processCell && (u = t.processCell(u, c.field, l)),
|
|
1083
|
+
return t.processCell && (u = t.processCell(u, c.field, l)), ye(u);
|
|
1080
1084
|
});
|
|
1081
1085
|
o.push(d.join(n));
|
|
1082
1086
|
}
|
|
@@ -1086,14 +1090,14 @@ function se(s, e) {
|
|
|
1086
1090
|
const t = URL.createObjectURL(s), i = document.createElement("a");
|
|
1087
1091
|
i.href = t, i.download = e, i.style.display = "none", document.body.appendChild(i), i.click(), document.body.removeChild(i), URL.revokeObjectURL(t);
|
|
1088
1092
|
}
|
|
1089
|
-
function
|
|
1093
|
+
function Rt(s, e) {
|
|
1090
1094
|
const t = new Blob([s], { type: "text/csv;charset=utf-8;" });
|
|
1091
1095
|
se(t, e);
|
|
1092
1096
|
}
|
|
1093
|
-
function
|
|
1097
|
+
function Ce(s) {
|
|
1094
1098
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
1095
1099
|
}
|
|
1096
|
-
function
|
|
1100
|
+
function Et(s, e, t) {
|
|
1097
1101
|
let i = `<?xml version="1.0" encoding="UTF-8"?>
|
|
1098
1102
|
<?mso-application progid="Excel.Sheet"?>
|
|
1099
1103
|
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
|
|
@@ -1105,7 +1109,7 @@ function Ct(s, e, t) {
|
|
|
1105
1109
|
<Row>`;
|
|
1106
1110
|
for (const n of e) {
|
|
1107
1111
|
const r = n.header || n.field, o = t.processHeader ? t.processHeader(r, n.field) : r;
|
|
1108
|
-
i += `<Cell><Data ss:Type="String">${
|
|
1112
|
+
i += `<Cell><Data ss:Type="String">${Ce(o)}</Data></Cell>`;
|
|
1109
1113
|
}
|
|
1110
1114
|
i += "</Row>";
|
|
1111
1115
|
}
|
|
@@ -1116,7 +1120,7 @@ function Ct(s, e, t) {
|
|
|
1116
1120
|
let o = n[r.field];
|
|
1117
1121
|
t.processCell && (o = t.processCell(o, r.field, n));
|
|
1118
1122
|
let a = "String", l = "";
|
|
1119
|
-
o == null ? l = "" : typeof o == "number" && !isNaN(o) ? (a = "Number", l = String(o)) : o instanceof Date ? (a = "DateTime", l = o.toISOString()) : l =
|
|
1123
|
+
o == null ? l = "" : typeof o == "number" && !isNaN(o) ? (a = "Number", l = String(o)) : o instanceof Date ? (a = "DateTime", l = o.toISOString()) : l = Ce(String(o)), i += `<Cell><Data ss:Type="${a}">${l}</Data></Cell>`;
|
|
1120
1124
|
}
|
|
1121
1125
|
i += "</Row>";
|
|
1122
1126
|
}
|
|
@@ -1125,13 +1129,13 @@ function Ct(s, e, t) {
|
|
|
1125
1129
|
</Worksheet>
|
|
1126
1130
|
</Workbook>`, i;
|
|
1127
1131
|
}
|
|
1128
|
-
function
|
|
1132
|
+
function St(s, e) {
|
|
1129
1133
|
const t = e.endsWith(".xls") ? e : `${e}.xls`, i = new Blob([s], {
|
|
1130
1134
|
type: "application/vnd.ms-excel;charset=utf-8;"
|
|
1131
1135
|
});
|
|
1132
1136
|
se(i, t);
|
|
1133
1137
|
}
|
|
1134
|
-
class
|
|
1138
|
+
class Ji extends R {
|
|
1135
1139
|
name = "export";
|
|
1136
1140
|
get defaultConfig() {
|
|
1137
1141
|
return {
|
|
@@ -1168,21 +1172,21 @@ class Xi extends R {
|
|
|
1168
1172
|
try {
|
|
1169
1173
|
switch (e) {
|
|
1170
1174
|
case "csv": {
|
|
1171
|
-
const l =
|
|
1172
|
-
a = a.endsWith(".csv") ? a : `${a}.csv`,
|
|
1175
|
+
const l = xt(o, r, n, { bom: !0 });
|
|
1176
|
+
a = a.endsWith(".csv") ? a : `${a}.csv`, Rt(l, a);
|
|
1173
1177
|
break;
|
|
1174
1178
|
}
|
|
1175
1179
|
case "excel": {
|
|
1176
|
-
const l =
|
|
1177
|
-
a = a.endsWith(".xls") ? a : `${a}.xls`,
|
|
1180
|
+
const l = Et(o, r, n);
|
|
1181
|
+
a = a.endsWith(".xls") ? a : `${a}.xls`, St(l, a);
|
|
1178
1182
|
break;
|
|
1179
1183
|
}
|
|
1180
1184
|
case "json": {
|
|
1181
1185
|
const l = o.map((u) => {
|
|
1182
1186
|
const h = {};
|
|
1183
|
-
for (const
|
|
1184
|
-
let
|
|
1185
|
-
n.processCell && (
|
|
1187
|
+
for (const f of r) {
|
|
1188
|
+
let g = u[f.field];
|
|
1189
|
+
n.processCell && (g = n.processCell(g, f.field, u)), h[f.field] = g;
|
|
1186
1190
|
}
|
|
1187
1191
|
return h;
|
|
1188
1192
|
}), d = JSON.stringify(l, null, 2);
|
|
@@ -1225,7 +1229,7 @@ class Xi extends R {
|
|
|
1225
1229
|
return this.lastExportInfo;
|
|
1226
1230
|
}
|
|
1227
1231
|
}
|
|
1228
|
-
function
|
|
1232
|
+
function kt(s) {
|
|
1229
1233
|
const { totalRows: e, viewportHeight: t, scrollTop: i, rowHeight: n, overscan: r } = s, o = Math.ceil(t / n);
|
|
1230
1234
|
let a = Math.floor(i / n) - r;
|
|
1231
1235
|
a < 0 && (a = 0);
|
|
@@ -1237,10 +1241,10 @@ function Et(s) {
|
|
|
1237
1241
|
totalHeight: e * n
|
|
1238
1242
|
};
|
|
1239
1243
|
}
|
|
1240
|
-
function
|
|
1244
|
+
function At(s, e) {
|
|
1241
1245
|
return s <= e;
|
|
1242
1246
|
}
|
|
1243
|
-
function
|
|
1247
|
+
function _t(s, e, t = !1) {
|
|
1244
1248
|
const i = s[e.field];
|
|
1245
1249
|
if (e.operator === "blank")
|
|
1246
1250
|
return i == null || i === "";
|
|
@@ -1279,10 +1283,10 @@ function St(s, e, t = !1) {
|
|
|
1279
1283
|
return !0;
|
|
1280
1284
|
}
|
|
1281
1285
|
}
|
|
1282
|
-
function
|
|
1283
|
-
return e.length ? s.filter((i) => e.every((n) =>
|
|
1286
|
+
function Lt(s, e, t = !1) {
|
|
1287
|
+
return e.length ? s.filter((i) => e.every((n) => _t(i, n, t))) : s;
|
|
1284
1288
|
}
|
|
1285
|
-
function
|
|
1289
|
+
function Tt(s) {
|
|
1286
1290
|
return JSON.stringify(
|
|
1287
1291
|
s.map((e) => ({
|
|
1288
1292
|
field: e.field,
|
|
@@ -1300,10 +1304,10 @@ function xe(s, e) {
|
|
|
1300
1304
|
}
|
|
1301
1305
|
return [...t].sort((i, n) => typeof i == "number" && typeof n == "number" ? i - n : String(i).localeCompare(String(n)));
|
|
1302
1306
|
}
|
|
1303
|
-
const
|
|
1304
|
-
class
|
|
1307
|
+
const It = '@layer tbw-plugins{tbw-grid{.tbw-quick-filter-input{flex:1;max-width:300px;height:var(--tbw-input-height, 1.75rem);padding:var(--tbw-input-padding, 0 .5rem);border:1px solid var(--tbw-color-border);border-radius:var(--tbw-border-radius);background:var(--tbw-color-bg);color:var(--tbw-color-fg);font-size:var(--tbw-font-size-sm, .8125rem);&:focus{outline:none;border-color:var(--tbw-color-accent)}}.header-cell.filtered:before{content:"";position:absolute;top:var(--tbw-spacing-xs, .25rem);right:var(--tbw-spacing-xs, .25rem);width:var(--tbw-indicator-size, .375rem);height:var(--tbw-indicator-size, .375rem);background:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));border-radius:50%}.tbw-filter-btn{display:var(--tbw-filter-btn-display, inline-flex);visibility:var(--tbw-filter-btn-visibility, visible);align-items:center;justify-content:center;background:transparent;border:none;cursor:pointer;padding:2px;margin-left:var(--tbw-spacing-xs, .25rem);opacity:.4;transition:opacity .15s,visibility 0s;color:inherit;vertical-align:middle;&:hover,&.active{opacity:1;visibility:visible}&.active{color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6))}}}}', Ft = "@layer tbw-plugins{.tbw-filter-panel{position:fixed;background:var(--tbw-filter-panel-bg, var(--tbw-color-panel-bg, light-dark(#eeeeee, #222222)));color:var(--tbw-filter-panel-fg, var(--tbw-color-fg, light-dark(#222222, #eeeeee)));border:1px solid var(--tbw-filter-panel-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:var(--tbw-filter-panel-radius, var(--tbw-border-radius, .25rem));box-shadow:0 4px 16px var(--tbw-filter-panel-shadow, var(--tbw-color-shadow, light-dark(rgba(0, 0, 0, .1), rgba(0, 0, 0, .3))));padding:var(--tbw-panel-padding, var(--tbw-spacing-lg, .75rem));z-index:10000;min-width:200px;max-width:280px;max-height:350px;display:flex;flex-direction:column;font-family:var(--tbw-font-family, system-ui, sans-serif);font-size:var(--tbw-font-size, .8125rem);transform-origin:top center}.tbw-filter-panel.tbw-filter-panel-above{transform-origin:bottom center}.tbw-filter-panel.tbw-filter-panel-animated{animation:tbw-filter-panel-enter var(--tbw-animation-duration, .15s) var(--tbw-animation-easing, ease-out)}.tbw-filter-panel.tbw-filter-panel-above.tbw-filter-panel-animated{animation:tbw-filter-panel-enter-above var(--tbw-animation-duration, .15s) var(--tbw-animation-easing, ease-out)}@keyframes tbw-filter-panel-enter{0%{opacity:0;transform:scaleY(.3) translateY(-10px)}to{opacity:1;transform:scaleY(1) translateY(0)}}@keyframes tbw-filter-panel-enter-above{0%{opacity:0;transform:scaleY(.3) translateY(10px)}to{opacity:1;transform:scaleY(1) translateY(0)}}@supports (anchor-name: --test){.tbw-filter-panel{position-anchor:--tbw-filter-anchor;top:anchor(bottom);left:anchor(left);margin-top:4px;position-try-fallbacks:flip-inline,flip-block,flip-block flip-inline}}.tbw-filter-search{margin-bottom:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.tbw-filter-search-input{width:100%;padding:var(--tbw-filter-search-padding, var(--tbw-spacing-sm, .375rem) var(--tbw-spacing-md, .5rem));background:var(--tbw-filter-input-bg, var(--tbw-color-bg, transparent));color:inherit;border:1px solid var(--tbw-filter-input-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:var(--tbw-filter-input-radius, var(--tbw-border-radius, .25rem));font-size:inherit;box-sizing:border-box}.tbw-filter-search-input:focus{outline:none;border-color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));box-shadow:0 0 0 2px rgba(from var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6)) r g b / 15%)}.tbw-filter-actions{display:flex;padding:var(--tbw-button-padding-sm, .25rem .125rem);margin-bottom:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));border-bottom:1px solid var(--tbw-filter-divider, var(--tbw-color-border, light-dark(#d0d0d4, #454545)))}.tbw-filter-action-btn{background:transparent;border:none;color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));cursor:pointer;font-size:var(--tbw-font-size-xs, .75rem);padding:2px 0}.tbw-filter-action-btn:hover{text-decoration:underline}.tbw-filter-values{flex:1;overflow-y:auto;margin-bottom:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));max-height:180px;position:relative}.tbw-filter-values-spacer{width:1px}.tbw-filter-values-content{position:absolute;top:0;left:0;right:0}.tbw-filter-value-item{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));padding:var(--tbw-button-padding-sm, .25rem .125rem);cursor:pointer;border-radius:3px;min-height:var(--tbw-filter-item-height, 28px)}.tbw-filter-value-item:hover{background:var(--tbw-filter-hover, var(--tbw-color-row-hover, light-dark(#f0f6ff, #1c1c1c)))}.tbw-filter-checkbox{margin:0;cursor:pointer;accent-color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6))}.tbw-filter-no-match{color:var(--tbw-filter-muted, var(--tbw-color-fg-muted, light-dark(#555555, #aaaaaa)));padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem)) 0;text-align:center;font-style:italic}.tbw-filter-buttons{display:flex;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));padding-top:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));border-top:1px solid var(--tbw-filter-divider, var(--tbw-color-border, light-dark(#d0d0d4, #454545)))}.tbw-filter-apply-btn{flex:1;padding:var(--tbw-filter-btn-padding, var(--tbw-button-padding, .375rem .75rem));background:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));color:var(--tbw-filter-accent-fg, var(--tbw-color-accent-fg, light-dark(#ffffff, #000000)));border:none;border-radius:var(--tbw-border-radius, .25rem);cursor:pointer;font-size:var(--tbw-font-size-sm, .8125rem);font-weight:var(--tbw-filter-btn-font-weight, 500);min-height:var(--tbw-filter-btn-min-height, auto)}.tbw-filter-apply-btn:hover{filter:brightness(.9)}.tbw-filter-clear-btn{flex:1;padding:var(--tbw-filter-btn-padding, var(--tbw-button-padding, .375rem .75rem));background:transparent;color:var(--tbw-filter-muted, var(--tbw-color-fg-muted, light-dark(#555555, #aaaaaa)));border:1px solid var(--tbw-filter-input-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:var(--tbw-border-radius, .25rem);cursor:pointer;font-size:var(--tbw-font-size-sm, .8125rem);font-weight:var(--tbw-filter-btn-font-weight, 500);min-height:var(--tbw-filter-btn-min-height, auto)}.tbw-filter-clear-btn:hover{background:var(--tbw-filter-hover, var(--tbw-color-row-hover, light-dark(#f0f6ff, #1c1c1c)))}}";
|
|
1308
|
+
class T extends R {
|
|
1305
1309
|
name = "filtering";
|
|
1306
|
-
styles =
|
|
1310
|
+
styles = It;
|
|
1307
1311
|
get defaultConfig() {
|
|
1308
1312
|
return {
|
|
1309
1313
|
debounceMs: 300,
|
|
@@ -1322,9 +1326,20 @@ class A extends R {
|
|
|
1322
1326
|
excludedValues = /* @__PURE__ */ new Map();
|
|
1323
1327
|
panelAbortController = null;
|
|
1324
1328
|
globalStylesInjected = !1;
|
|
1325
|
-
static
|
|
1329
|
+
static DEFAULT_LIST_ITEM_HEIGHT = 28;
|
|
1326
1330
|
static LIST_OVERSCAN = 3;
|
|
1327
1331
|
static LIST_BYPASS_THRESHOLD = 50;
|
|
1332
|
+
getListItemHeight() {
|
|
1333
|
+
if (this.panelElement) {
|
|
1334
|
+
const e = getComputedStyle(this.panelElement).getPropertyValue("--tbw-filter-item-height");
|
|
1335
|
+
if (e && e.trim()) {
|
|
1336
|
+
const t = parseFloat(e);
|
|
1337
|
+
if (!isNaN(t) && t > 0)
|
|
1338
|
+
return t;
|
|
1339
|
+
}
|
|
1340
|
+
}
|
|
1341
|
+
return T.DEFAULT_LIST_ITEM_HEIGHT;
|
|
1342
|
+
}
|
|
1328
1343
|
syncExcludedValues(e, t) {
|
|
1329
1344
|
t ? t.type === "set" && t.operator === "notIn" && Array.isArray(t.value) ? this.excludedValues.set(e, new Set(t.value)) : t.type === "set" && this.excludedValues.delete(e) : this.excludedValues.delete(e);
|
|
1330
1345
|
}
|
|
@@ -1339,10 +1354,10 @@ class A extends R {
|
|
|
1339
1354
|
if (!t.length) return [...e];
|
|
1340
1355
|
if (this.config.filterHandler)
|
|
1341
1356
|
return this.cachedResult ? this.cachedResult : [...e];
|
|
1342
|
-
const i =
|
|
1357
|
+
const i = Tt(t);
|
|
1343
1358
|
if (this.cacheKey === i && this.cachedResult)
|
|
1344
1359
|
return this.cachedResult;
|
|
1345
|
-
const n =
|
|
1360
|
+
const n = Lt([...e], t, this.config.caseSensitive);
|
|
1346
1361
|
return this.cachedResult = n, this.cacheKey = i, n;
|
|
1347
1362
|
}
|
|
1348
1363
|
afterRender() {
|
|
@@ -1358,14 +1373,20 @@ class A extends R {
|
|
|
1358
1373
|
const a = this.filters.has(o);
|
|
1359
1374
|
let l = i.querySelector(".tbw-filter-btn");
|
|
1360
1375
|
if (l) {
|
|
1361
|
-
l.classList.
|
|
1376
|
+
const u = l.classList.contains("active");
|
|
1377
|
+
if (l.classList.toggle("active", a), i.classList.toggle("filtered", a), u !== a) {
|
|
1378
|
+
const h = a ? "filterActive" : "filter";
|
|
1379
|
+
this.setIcon(l, this.resolveIcon(h));
|
|
1380
|
+
}
|
|
1362
1381
|
return;
|
|
1363
1382
|
}
|
|
1364
|
-
l = document.createElement("button"), l.className = "tbw-filter-btn", l.setAttribute("aria-label", `Filter ${r.header ?? o}`)
|
|
1365
|
-
|
|
1383
|
+
l = document.createElement("button"), l.className = "tbw-filter-btn", l.setAttribute("aria-label", `Filter ${r.header ?? o}`);
|
|
1384
|
+
const d = a ? "filterActive" : "filter";
|
|
1385
|
+
this.setIcon(l, this.resolveIcon(d)), a && (l.classList.add("active"), i.classList.add("filtered")), l.addEventListener("click", (u) => {
|
|
1386
|
+
u.stopPropagation(), this.toggleFilterPanel(o, r, l);
|
|
1366
1387
|
});
|
|
1367
|
-
const
|
|
1368
|
-
|
|
1388
|
+
const c = i.querySelector(".resize-handle");
|
|
1389
|
+
c ? i.insertBefore(l, c) : i.appendChild(l);
|
|
1369
1390
|
});
|
|
1370
1391
|
}
|
|
1371
1392
|
setFilter(e, t) {
|
|
@@ -1416,6 +1437,14 @@ class A extends R {
|
|
|
1416
1437
|
getUniqueValues(e) {
|
|
1417
1438
|
return xe(this.sourceRows, e);
|
|
1418
1439
|
}
|
|
1440
|
+
copyGridThemeContext(e) {
|
|
1441
|
+
const t = this.gridElement;
|
|
1442
|
+
if (!t) return;
|
|
1443
|
+
for (const n of t.classList)
|
|
1444
|
+
n.startsWith("tbw-") || n === "selecting" || e.classList.add(n);
|
|
1445
|
+
const i = t.dataset.theme;
|
|
1446
|
+
i && (e.dataset.theme = i);
|
|
1447
|
+
}
|
|
1419
1448
|
injectGlobalStyles() {
|
|
1420
1449
|
if (this.globalStylesInjected) return;
|
|
1421
1450
|
if (document.getElementById("tbw-filter-panel-styles")) {
|
|
@@ -1423,7 +1452,7 @@ class A extends R {
|
|
|
1423
1452
|
return;
|
|
1424
1453
|
}
|
|
1425
1454
|
const e = document.createElement("style");
|
|
1426
|
-
e.id = "tbw-filter-panel-styles", e.textContent =
|
|
1455
|
+
e.id = "tbw-filter-panel-styles", e.textContent = Ft, document.head.appendChild(e), this.globalStylesInjected = !0;
|
|
1427
1456
|
}
|
|
1428
1457
|
toggleFilterPanel(e, t, i) {
|
|
1429
1458
|
if (this.openPanelField === e) {
|
|
@@ -1432,7 +1461,7 @@ class A extends R {
|
|
|
1432
1461
|
}
|
|
1433
1462
|
this.closeFilterPanel();
|
|
1434
1463
|
const n = document.createElement("div");
|
|
1435
|
-
if (n.className = "tbw-filter-panel", this.isAnimationEnabled && n.classList.add("tbw-filter-panel-animated"), this.panelElement = n, this.openPanelField = e, this.config.valuesHandler) {
|
|
1464
|
+
if (n.className = "tbw-filter-panel", this.copyGridThemeContext(n), this.isAnimationEnabled && n.classList.add("tbw-filter-panel-animated"), this.panelElement = n, this.openPanelField = e, this.config.valuesHandler) {
|
|
1436
1465
|
n.innerHTML = '<div class="tbw-filter-loading">Loading...</div>', document.body.appendChild(n), this.positionPanel(n, i), this.setupPanelCloseHandler(n, i), this.config.valuesHandler(e, t).then((o) => {
|
|
1437
1466
|
this.openPanelField !== e || !this.panelElement || (n.innerHTML = "", this.renderPanelContent(e, t, n, o));
|
|
1438
1467
|
});
|
|
@@ -1481,11 +1510,11 @@ class A extends R {
|
|
|
1481
1510
|
}
|
|
1482
1511
|
static supportsAnchorPositioning = null;
|
|
1483
1512
|
static checkAnchorPositioningSupport() {
|
|
1484
|
-
return
|
|
1513
|
+
return T.supportsAnchorPositioning === null && (T.supportsAnchorPositioning = CSS.supports("anchor-name", "--test")), T.supportsAnchorPositioning;
|
|
1485
1514
|
}
|
|
1486
1515
|
positionPanel(e, t) {
|
|
1487
1516
|
const n = t.closest(".cell") ?? t;
|
|
1488
|
-
if (n.style.anchorName = "--tbw-filter-anchor", this.panelAnchorElement = n,
|
|
1517
|
+
if (n.style.anchorName = "--tbw-filter-anchor", this.panelAnchorElement = n, T.checkAnchorPositioningSupport()) {
|
|
1489
1518
|
requestAnimationFrame(() => {
|
|
1490
1519
|
const o = e.getBoundingClientRect(), a = n.getBoundingClientRect();
|
|
1491
1520
|
o.top < a.top && e.classList.add("tbw-filter-panel-above");
|
|
@@ -1499,91 +1528,91 @@ class A extends R {
|
|
|
1499
1528
|
});
|
|
1500
1529
|
}
|
|
1501
1530
|
renderDefaultFilterPanel(e, t, i, n) {
|
|
1502
|
-
const { field: r } = t, o = document.createElement("div");
|
|
1503
|
-
|
|
1504
|
-
const
|
|
1505
|
-
|
|
1506
|
-
const
|
|
1507
|
-
|
|
1508
|
-
const
|
|
1509
|
-
|
|
1510
|
-
const
|
|
1511
|
-
|
|
1512
|
-
const
|
|
1513
|
-
|
|
1514
|
-
const
|
|
1515
|
-
const y = [...
|
|
1516
|
-
|
|
1531
|
+
const { field: r } = t, o = this.getListItemHeight(), a = document.createElement("div");
|
|
1532
|
+
a.className = "tbw-filter-search";
|
|
1533
|
+
const l = document.createElement("input");
|
|
1534
|
+
l.type = "text", l.placeholder = "Search...", l.className = "tbw-filter-search-input", l.value = this.searchText.get(r) ?? "", a.appendChild(l), e.appendChild(a);
|
|
1535
|
+
const d = document.createElement("div");
|
|
1536
|
+
d.className = "tbw-filter-actions";
|
|
1537
|
+
const c = document.createElement("label");
|
|
1538
|
+
c.className = "tbw-filter-value-item", c.style.padding = "0", c.style.margin = "0";
|
|
1539
|
+
const u = document.createElement("input");
|
|
1540
|
+
u.type = "checkbox", u.className = "tbw-filter-checkbox";
|
|
1541
|
+
const h = document.createElement("span");
|
|
1542
|
+
h.textContent = "Select All", c.appendChild(u), c.appendChild(h), d.appendChild(c);
|
|
1543
|
+
const f = () => {
|
|
1544
|
+
const y = [...w.values()], E = y.every((C) => C), A = y.every((C) => !C);
|
|
1545
|
+
u.checked = E, u.indeterminate = !E && !A;
|
|
1517
1546
|
};
|
|
1518
|
-
|
|
1519
|
-
const y =
|
|
1520
|
-
for (const E of
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
}), e.appendChild(
|
|
1547
|
+
u.addEventListener("change", () => {
|
|
1548
|
+
const y = u.checked;
|
|
1549
|
+
for (const E of w.keys())
|
|
1550
|
+
w.set(E, y);
|
|
1551
|
+
f(), S();
|
|
1552
|
+
}), e.appendChild(d);
|
|
1524
1553
|
const g = document.createElement("div");
|
|
1525
1554
|
g.className = "tbw-filter-values";
|
|
1526
|
-
const f = document.createElement("div");
|
|
1527
|
-
f.className = "tbw-filter-values-spacer", g.appendChild(f);
|
|
1528
1555
|
const p = document.createElement("div");
|
|
1529
|
-
p.className = "tbw-filter-values-
|
|
1530
|
-
const m =
|
|
1556
|
+
p.className = "tbw-filter-values-spacer", g.appendChild(p);
|
|
1557
|
+
const m = document.createElement("div");
|
|
1558
|
+
m.className = "tbw-filter-values-content", g.appendChild(m);
|
|
1559
|
+
const w = /* @__PURE__ */ new Map();
|
|
1531
1560
|
i.forEach((y) => {
|
|
1532
1561
|
const E = y == null ? "__null__" : String(y);
|
|
1533
|
-
|
|
1534
|
-
}),
|
|
1535
|
-
let
|
|
1536
|
-
const
|
|
1537
|
-
const
|
|
1538
|
-
|
|
1539
|
-
const
|
|
1540
|
-
|
|
1541
|
-
|
|
1562
|
+
w.set(E, !n.has(y));
|
|
1563
|
+
}), f();
|
|
1564
|
+
let b = [];
|
|
1565
|
+
const v = (y, E) => {
|
|
1566
|
+
const A = y == null ? "(Blank)" : String(y), C = y == null ? "__null__" : String(y), x = document.createElement("label");
|
|
1567
|
+
x.className = "tbw-filter-value-item", x.style.position = "absolute", x.style.top = `${E * o}px`, x.style.left = "0", x.style.right = "0", x.style.height = `${o}px`, x.style.boxSizing = "border-box";
|
|
1568
|
+
const k = document.createElement("input");
|
|
1569
|
+
k.type = "checkbox", k.className = "tbw-filter-checkbox", k.checked = w.get(C) ?? !0, k.dataset.value = C, k.addEventListener("change", () => {
|
|
1570
|
+
w.set(C, k.checked), f();
|
|
1542
1571
|
});
|
|
1543
|
-
const
|
|
1544
|
-
return
|
|
1545
|
-
},
|
|
1546
|
-
const y =
|
|
1547
|
-
if (
|
|
1548
|
-
|
|
1549
|
-
|
|
1572
|
+
const de = document.createElement("span");
|
|
1573
|
+
return de.textContent = A, x.appendChild(k), x.appendChild(de), x;
|
|
1574
|
+
}, S = () => {
|
|
1575
|
+
const y = b.length, E = g.clientHeight, A = g.scrollTop;
|
|
1576
|
+
if (p.style.height = `${y * o}px`, At(y, T.LIST_BYPASS_THRESHOLD / 3)) {
|
|
1577
|
+
m.innerHTML = "", m.style.transform = "translateY(0px)", b.forEach((x, k) => {
|
|
1578
|
+
m.appendChild(v(x, k));
|
|
1550
1579
|
});
|
|
1551
1580
|
return;
|
|
1552
1581
|
}
|
|
1553
|
-
const
|
|
1582
|
+
const C = kt({
|
|
1554
1583
|
totalRows: y,
|
|
1555
1584
|
viewportHeight: E,
|
|
1556
|
-
scrollTop:
|
|
1557
|
-
rowHeight:
|
|
1558
|
-
overscan:
|
|
1585
|
+
scrollTop: A,
|
|
1586
|
+
rowHeight: o,
|
|
1587
|
+
overscan: T.LIST_OVERSCAN
|
|
1559
1588
|
});
|
|
1560
|
-
|
|
1561
|
-
for (let
|
|
1562
|
-
|
|
1563
|
-
},
|
|
1564
|
-
const E = this.config.caseSensitive ?? !1,
|
|
1565
|
-
if (
|
|
1566
|
-
const
|
|
1567
|
-
return !y ||
|
|
1568
|
-
}),
|
|
1569
|
-
|
|
1570
|
-
const
|
|
1571
|
-
|
|
1589
|
+
m.style.transform = `translateY(${C.offsetY}px)`, m.innerHTML = "";
|
|
1590
|
+
for (let x = C.start; x < C.end; x++)
|
|
1591
|
+
m.appendChild(v(b[x], x - C.start));
|
|
1592
|
+
}, q = (y) => {
|
|
1593
|
+
const E = this.config.caseSensitive ?? !1, A = E ? y : y.toLowerCase();
|
|
1594
|
+
if (b = i.filter((C) => {
|
|
1595
|
+
const x = C == null ? "(Blank)" : String(C), k = E ? x : x.toLowerCase();
|
|
1596
|
+
return !y || k.includes(A);
|
|
1597
|
+
}), b.length === 0) {
|
|
1598
|
+
p.style.height = "0px", m.innerHTML = "";
|
|
1599
|
+
const C = document.createElement("div");
|
|
1600
|
+
C.className = "tbw-filter-no-match", C.textContent = "No matching values", m.appendChild(C);
|
|
1572
1601
|
return;
|
|
1573
1602
|
}
|
|
1574
|
-
|
|
1603
|
+
S();
|
|
1575
1604
|
};
|
|
1576
1605
|
g.addEventListener(
|
|
1577
1606
|
"scroll",
|
|
1578
1607
|
() => {
|
|
1579
|
-
|
|
1608
|
+
b.length > 0 && S();
|
|
1580
1609
|
},
|
|
1581
1610
|
{ passive: !0 }
|
|
1582
|
-
),
|
|
1583
|
-
let
|
|
1584
|
-
|
|
1585
|
-
clearTimeout(
|
|
1586
|
-
this.searchText.set(r,
|
|
1611
|
+
), q(l.value), e.appendChild(g);
|
|
1612
|
+
let le;
|
|
1613
|
+
l.addEventListener("input", () => {
|
|
1614
|
+
clearTimeout(le), le = setTimeout(() => {
|
|
1615
|
+
this.searchText.set(r, l.value), q(l.value);
|
|
1587
1616
|
}, this.config.debounceMs ?? 150);
|
|
1588
1617
|
});
|
|
1589
1618
|
const z = document.createElement("div");
|
|
@@ -1591,13 +1620,13 @@ class A extends R {
|
|
|
1591
1620
|
const G = document.createElement("button");
|
|
1592
1621
|
G.className = "tbw-filter-apply-btn", G.textContent = "Apply", G.addEventListener("click", () => {
|
|
1593
1622
|
const y = [];
|
|
1594
|
-
for (const [E,
|
|
1595
|
-
if (!
|
|
1623
|
+
for (const [E, A] of w)
|
|
1624
|
+
if (!A)
|
|
1596
1625
|
if (E === "__null__")
|
|
1597
1626
|
y.push(null);
|
|
1598
1627
|
else {
|
|
1599
|
-
const
|
|
1600
|
-
y.push(
|
|
1628
|
+
const C = i.find((x) => String(x) === E);
|
|
1629
|
+
y.push(C !== void 0 ? C : E);
|
|
1601
1630
|
}
|
|
1602
1631
|
t.applySetFilter(y);
|
|
1603
1632
|
}), z.appendChild(G);
|
|
@@ -1670,7 +1699,7 @@ class A extends R {
|
|
|
1670
1699
|
this.filters.set(e, i), this.cachedResult = null, this.cacheKey = null;
|
|
1671
1700
|
}
|
|
1672
1701
|
}
|
|
1673
|
-
function
|
|
1702
|
+
function Re(s) {
|
|
1674
1703
|
if (!s.length) return [];
|
|
1675
1704
|
const e = /* @__PURE__ */ new Map(), t = [], i = (o, a) => {
|
|
1676
1705
|
if (!a.length) return;
|
|
@@ -1705,7 +1734,7 @@ function Ce(s) {
|
|
|
1705
1734
|
}, e.set(d, c), t.push(c)), c.columns.push(o);
|
|
1706
1735
|
}), n.length && i(r, n), t.length === 1 && t[0].implicit && t[0].columns.length === s.length ? [] : t;
|
|
1707
1736
|
}
|
|
1708
|
-
function
|
|
1737
|
+
function Dt(s, e, t) {
|
|
1709
1738
|
if (!e.length || !s) return;
|
|
1710
1739
|
const i = /* @__PURE__ */ new Map();
|
|
1711
1740
|
for (const r of e)
|
|
@@ -1721,7 +1750,7 @@ function It(s, e, t) {
|
|
|
1721
1750
|
a && a.classList.add("group-end");
|
|
1722
1751
|
}
|
|
1723
1752
|
}
|
|
1724
|
-
function
|
|
1753
|
+
function Pt(s, e) {
|
|
1725
1754
|
if (s.length === 0) return null;
|
|
1726
1755
|
const t = document.createElement("div");
|
|
1727
1756
|
t.className = "header-group-row", t.setAttribute("role", "row");
|
|
@@ -1733,11 +1762,11 @@ function Dt(s, e) {
|
|
|
1733
1762
|
}
|
|
1734
1763
|
return t;
|
|
1735
1764
|
}
|
|
1736
|
-
function
|
|
1765
|
+
function Mt(s) {
|
|
1737
1766
|
return s.some((e) => e.group != null);
|
|
1738
1767
|
}
|
|
1739
|
-
const
|
|
1740
|
-
class
|
|
1768
|
+
const qt = "@layer tbw-plugins{.header-group-row{display:grid;grid-auto-flow:column;background:var(--tbw-grouping-columns-header-bg, var(--tbw-color-header-bg));border-bottom:1px solid var(--tbw-grouping-columns-border, var(--tbw-color-border))}.header-group-cell{display:flex;align-items:center;justify-content:center;padding:var(--tbw-button-padding-sm, .25rem .5rem);font-weight:600;font-size:var(--tbw-font-size-sm, .9em);text-transform:uppercase;letter-spacing:.5px;border-right:2px solid var(--tbw-grouping-columns-separator, var(--tbw-color-border-strong, var(--tbw-color-border)))}.header-group-cell:last-child{border-right:none}.header-row .cell.grouped{border-top:none}.header-row .cell.group-end{border-right:2px solid var(--tbw-grouping-columns-separator, var(--tbw-color-border-strong, var(--tbw-color-border)))}.header-row .cell.group-end:last-child{border-right:none}.rows .cell.group-end{border-right:2px solid var(--tbw-grouping-columns-separator, var(--tbw-color-border-strong, var(--tbw-color-border)))}.rows .cell.group-end:last-child{border-right:none}.header-group-row.no-borders{border-bottom:none}.header-group-row.no-borders .header-group-cell{border-right:none}.header-row.no-group-borders .cell.group-end{border-right:1px solid var(--tbw-color-border)}}";
|
|
1769
|
+
class Qi extends R {
|
|
1741
1770
|
static manifest = {
|
|
1742
1771
|
ownedProperties: [
|
|
1743
1772
|
{
|
|
@@ -1754,7 +1783,7 @@ class Zi extends R {
|
|
|
1754
1783
|
]
|
|
1755
1784
|
};
|
|
1756
1785
|
name = "groupingColumns";
|
|
1757
|
-
styles =
|
|
1786
|
+
styles = qt;
|
|
1758
1787
|
get defaultConfig() {
|
|
1759
1788
|
return {
|
|
1760
1789
|
showGroupBorders: !0
|
|
@@ -1769,7 +1798,7 @@ class Zi extends R {
|
|
|
1769
1798
|
if (t?.columnGroups && Array.isArray(t.columnGroups) && t.columnGroups.length > 0)
|
|
1770
1799
|
return !0;
|
|
1771
1800
|
const i = t?.columns;
|
|
1772
|
-
return Array.isArray(i) ?
|
|
1801
|
+
return Array.isArray(i) ? Mt(i) : !1;
|
|
1773
1802
|
}
|
|
1774
1803
|
processColumns(e) {
|
|
1775
1804
|
const t = this.grid?.gridConfig?.columnGroups;
|
|
@@ -1785,7 +1814,7 @@ class Zi extends R {
|
|
|
1785
1814
|
});
|
|
1786
1815
|
} else
|
|
1787
1816
|
i = [...e];
|
|
1788
|
-
const n =
|
|
1817
|
+
const n = Re(i);
|
|
1789
1818
|
return n.length === 0 ? (this.isActive = !1, this.groups = [], i) : (this.isActive = !0, this.groups = n, i);
|
|
1790
1819
|
}
|
|
1791
1820
|
afterRender() {
|
|
@@ -1798,16 +1827,16 @@ class Zi extends R {
|
|
|
1798
1827
|
if (!e) return;
|
|
1799
1828
|
const t = e.querySelector(".header-group-row");
|
|
1800
1829
|
t && t.remove();
|
|
1801
|
-
const i = this.columns, n =
|
|
1830
|
+
const i = this.columns, n = Re(i);
|
|
1802
1831
|
if (n.length === 0) return;
|
|
1803
|
-
const r =
|
|
1832
|
+
const r = Pt(n, i);
|
|
1804
1833
|
if (r) {
|
|
1805
1834
|
r.classList.toggle("no-borders", !this.config.showGroupBorders);
|
|
1806
1835
|
const a = e.querySelector(".header-row");
|
|
1807
1836
|
a ? e.insertBefore(r, a) : e.appendChild(r);
|
|
1808
1837
|
}
|
|
1809
1838
|
const o = e.querySelector(".header-row");
|
|
1810
|
-
o && (o.classList.toggle("no-group-borders", !this.config.showGroupBorders),
|
|
1839
|
+
o && (o.classList.toggle("no-group-borders", !this.config.showGroupBorders), Dt(o, n)), this.#e(n);
|
|
1811
1840
|
}
|
|
1812
1841
|
#e(e) {
|
|
1813
1842
|
if (!this.config.showGroupBorders) return;
|
|
@@ -1838,7 +1867,7 @@ class Zi extends R {
|
|
|
1838
1867
|
this.requestRender();
|
|
1839
1868
|
}
|
|
1840
1869
|
}
|
|
1841
|
-
function
|
|
1870
|
+
function Kt({ rows: s, config: e, expanded: t }) {
|
|
1842
1871
|
const i = e.groupOn;
|
|
1843
1872
|
if (typeof i != "function")
|
|
1844
1873
|
return [];
|
|
@@ -1848,9 +1877,9 @@ function Pt({ rows: s, config: e, expanded: t }) {
|
|
|
1848
1877
|
l == null || l === !1 ? l = ["__ungrouped__"] : Array.isArray(l) || (l = [l]);
|
|
1849
1878
|
let d = n;
|
|
1850
1879
|
l.forEach((c, u) => {
|
|
1851
|
-
const h = c == null ? "∅" : String(c),
|
|
1852
|
-
let
|
|
1853
|
-
|
|
1880
|
+
const h = c == null ? "∅" : String(c), f = d.key === "__root__" ? h : d.key + "||" + h;
|
|
1881
|
+
let g = d.children.get(h);
|
|
1882
|
+
g || (g = { key: f, value: c, depth: u, rows: [], children: /* @__PURE__ */ new Map(), parent: d }, d.children.set(h, g)), d = g;
|
|
1854
1883
|
}), d.rows.push(a);
|
|
1855
1884
|
}), n.children.size === 1 && n.children.has("__ungrouped__") && n.children.get("__ungrouped__").rows.length === s.length)
|
|
1856
1885
|
return [];
|
|
@@ -1871,26 +1900,26 @@ function Pt({ rows: s, config: e, expanded: t }) {
|
|
|
1871
1900
|
};
|
|
1872
1901
|
return o(n), r;
|
|
1873
1902
|
}
|
|
1874
|
-
function
|
|
1903
|
+
function Ht(s, e) {
|
|
1875
1904
|
const t = new Set(s);
|
|
1876
1905
|
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
1877
1906
|
}
|
|
1878
|
-
function
|
|
1907
|
+
function Nt(s) {
|
|
1879
1908
|
const e = /* @__PURE__ */ new Set();
|
|
1880
1909
|
for (const t of s)
|
|
1881
1910
|
t.kind === "group" && e.add(t.key);
|
|
1882
1911
|
return e;
|
|
1883
1912
|
}
|
|
1884
|
-
function
|
|
1913
|
+
function zt() {
|
|
1885
1914
|
return /* @__PURE__ */ new Set();
|
|
1886
1915
|
}
|
|
1887
|
-
function
|
|
1916
|
+
function Gt(s) {
|
|
1888
1917
|
return s.kind !== "group" ? 0 : s.rows.length;
|
|
1889
1918
|
}
|
|
1890
|
-
const
|
|
1891
|
-
class
|
|
1919
|
+
const Ot = "@layer tbw-plugins{.group-row{display:grid;grid-template-columns:var(--tbw-column-template);background:var(--tbw-grouping-rows-bg, var(--tbw-color-panel-bg));font-weight:500;border-bottom:var(--tbw-row-divider);min-height:var(--tbw-row-height)}.group-row .cell{display:flex;align-items:center;padding:var(--tbw-cell-padding, .125rem .5rem)}.group-row:hover{background:var(--tbw-grouping-rows-bg-hover, var(--tbw-color-row-hover))}.group-toggle{cursor:pointer;user-select:none;display:inline-flex;align-items:center;justify-content:center;width:var(--tbw-toggle-size, 1.25rem);height:var(--tbw-toggle-size, 1.25rem);margin-right:.25rem;background:none;border:0;font:inherit}.group-toggle:hover{background:var(--tbw-grouping-rows-toggle-hover, var(--tbw-color-row-hover));border-radius:var(--tbw-border-radius, .125rem)}.group-label{display:inline-flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.group-count{color:var(--tbw-grouping-rows-count-color, var(--tbw-color-fg-muted));font-size:var(--tbw-font-size-xs, .85em);font-weight:400}.group-row{padding-left:calc(var(--tbw-group-depth, 0) * var(--tbw-group-indent-width, 1.25em))}.data-grid-row.tbw-group-slide-in{animation:tbw-group-slide-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-group-slide-in{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}.data-grid-row.tbw-group-fade-in{animation:tbw-group-fade-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-group-fade-in{0%{opacity:0}to{opacity:1}}}";
|
|
1920
|
+
class en extends R {
|
|
1892
1921
|
name = "groupingRows";
|
|
1893
|
-
styles =
|
|
1922
|
+
styles = Ot;
|
|
1894
1923
|
get defaultConfig() {
|
|
1895
1924
|
return {
|
|
1896
1925
|
defaultExpanded: !1,
|
|
@@ -1918,7 +1947,7 @@ class Ji extends R {
|
|
|
1918
1947
|
const t = this.config;
|
|
1919
1948
|
if (typeof t.groupOn != "function")
|
|
1920
1949
|
return this.isActive = !1, this.flattenedRows = [], [...e];
|
|
1921
|
-
const i =
|
|
1950
|
+
const i = Kt({
|
|
1922
1951
|
rows: [...e],
|
|
1923
1952
|
config: t,
|
|
1924
1953
|
expanded: this.expandedKeys
|
|
@@ -1939,7 +1968,7 @@ class Ji extends R {
|
|
|
1939
1968
|
__groupDepth: r.depth,
|
|
1940
1969
|
__groupRows: r.rows,
|
|
1941
1970
|
__groupExpanded: r.expanded,
|
|
1942
|
-
__groupRowCount:
|
|
1971
|
+
__groupRowCount: Gt(r)
|
|
1943
1972
|
} : r.row);
|
|
1944
1973
|
}
|
|
1945
1974
|
onCellClick(e) {
|
|
@@ -2013,42 +2042,42 @@ class Ji extends R {
|
|
|
2013
2042
|
d && (t.style.display = "grid", t.style.gridTemplateColumns = d);
|
|
2014
2043
|
let c = !1;
|
|
2015
2044
|
o.forEach((u, h) => {
|
|
2016
|
-
const
|
|
2017
|
-
if (
|
|
2018
|
-
|
|
2045
|
+
const f = document.createElement("div");
|
|
2046
|
+
if (f.className = "cell group-cell", f.setAttribute("data-col", String(h)), f.setAttribute("role", "gridcell"), re(u)) {
|
|
2047
|
+
f.setAttribute("data-field", u.field), t.appendChild(f);
|
|
2019
2048
|
return;
|
|
2020
2049
|
}
|
|
2021
2050
|
if (c) {
|
|
2022
|
-
const
|
|
2023
|
-
if (
|
|
2024
|
-
const p =
|
|
2025
|
-
|
|
2051
|
+
const g = r[u.field];
|
|
2052
|
+
if (g) {
|
|
2053
|
+
const p = ce(g, a, u.field, u);
|
|
2054
|
+
f.textContent = p != null ? String(p) : "";
|
|
2026
2055
|
} else
|
|
2027
|
-
|
|
2056
|
+
f.textContent = "";
|
|
2028
2057
|
} else {
|
|
2029
|
-
c = !0,
|
|
2030
|
-
const
|
|
2058
|
+
c = !0, f.appendChild(this.createToggleButton(e.__groupExpanded, i));
|
|
2059
|
+
const g = document.createElement("span"), p = r[u.field];
|
|
2031
2060
|
if (p) {
|
|
2032
|
-
const m =
|
|
2033
|
-
|
|
2061
|
+
const m = ce(p, a, u.field, u);
|
|
2062
|
+
g.textContent = m != null ? String(m) : String(e.__groupValue);
|
|
2034
2063
|
} else
|
|
2035
|
-
|
|
2036
|
-
if (
|
|
2064
|
+
g.textContent = this.getGroupLabelText(e.__groupValue, e.__groupDepth || 0, e.__groupKey);
|
|
2065
|
+
if (f.appendChild(g), n.showRowCount !== !1) {
|
|
2037
2066
|
const m = document.createElement("span");
|
|
2038
|
-
m.className = "group-count", m.textContent = ` (${a.length})`,
|
|
2067
|
+
m.className = "group-count", m.textContent = ` (${a.length})`, f.appendChild(m);
|
|
2039
2068
|
}
|
|
2040
2069
|
}
|
|
2041
|
-
t.appendChild(
|
|
2070
|
+
t.appendChild(f);
|
|
2042
2071
|
});
|
|
2043
2072
|
}
|
|
2044
2073
|
expandAll() {
|
|
2045
|
-
this.expandedKeys =
|
|
2074
|
+
this.expandedKeys = Nt(this.flattenedRows), this.requestRender();
|
|
2046
2075
|
}
|
|
2047
2076
|
collapseAll() {
|
|
2048
|
-
this.expandedKeys =
|
|
2077
|
+
this.expandedKeys = zt(), this.requestRender();
|
|
2049
2078
|
}
|
|
2050
2079
|
toggle(e) {
|
|
2051
|
-
this.expandedKeys =
|
|
2080
|
+
this.expandedKeys = Ht(this.expandedKeys, e);
|
|
2052
2081
|
const t = this.flattenedRows.find((i) => i.kind === "group" && i.key === e);
|
|
2053
2082
|
this.emit("group-toggle", {
|
|
2054
2083
|
key: e,
|
|
@@ -2097,22 +2126,22 @@ class Ji extends R {
|
|
|
2097
2126
|
this.config.groupOn = e, this.requestRender();
|
|
2098
2127
|
}
|
|
2099
2128
|
}
|
|
2100
|
-
function
|
|
2129
|
+
function Ee(s, e) {
|
|
2101
2130
|
const t = new Set(s);
|
|
2102
2131
|
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
2103
2132
|
}
|
|
2104
|
-
function
|
|
2133
|
+
function Bt(s, e) {
|
|
2105
2134
|
const t = new Set(s);
|
|
2106
2135
|
return t.add(e), t;
|
|
2107
2136
|
}
|
|
2108
|
-
function
|
|
2137
|
+
function Vt(s, e) {
|
|
2109
2138
|
const t = new Set(s);
|
|
2110
2139
|
return t.delete(e), t;
|
|
2111
2140
|
}
|
|
2112
|
-
function
|
|
2141
|
+
function Wt(s, e) {
|
|
2113
2142
|
return s.has(e);
|
|
2114
2143
|
}
|
|
2115
|
-
function
|
|
2144
|
+
function $t(s, e, t, i) {
|
|
2116
2145
|
const n = document.createElement("div");
|
|
2117
2146
|
n.className = "master-detail-row", n.setAttribute("data-detail-for", String(e)), n.setAttribute("role", "row");
|
|
2118
2147
|
const r = document.createElement("div");
|
|
@@ -2120,10 +2149,10 @@ function Vt(s, e, t, i) {
|
|
|
2120
2149
|
const o = t(s, e);
|
|
2121
2150
|
return typeof o == "string" ? r.innerHTML = o : o instanceof HTMLElement && r.appendChild(o), n.appendChild(r), n;
|
|
2122
2151
|
}
|
|
2123
|
-
const
|
|
2124
|
-
class
|
|
2152
|
+
const jt = "@layer tbw-plugins{tbw-grid{.cell[data-field=__tbw_expander]{border-right:none!important;padding:0;display:flex;align-items:center;justify-content:center}.header-row .cell[data-field=__tbw_expander]{display:none}.header-row .cell[data-field=__tbw_expander]+.cell{grid-column:1 / 3}.master-detail-expander{display:flex;align-items:center;justify-content:center;width:100%;height:100%}.master-detail-toggle{cursor:pointer;opacity:.7;user-select:none;display:inline-flex;align-items:center;justify-content:center}.master-detail-toggle:hover{opacity:1}.master-detail-row{grid-column:1 / -1;display:grid;background:var(--tbw-master-detail-bg, var(--tbw-color-row-alt));border-bottom:1px solid var(--tbw-master-detail-border, var(--tbw-color-border));overflow:hidden}.master-detail-cell{padding:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem));overflow:auto}.master-detail-row.tbw-expanding{animation:tbw-detail-expand var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}.master-detail-row.tbw-collapsing{animation:tbw-detail-collapse var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}}@keyframes tbw-detail-expand{0%{opacity:0;max-height:0;padding-top:0;padding-bottom:0}to{opacity:1;max-height:var(--tbw-detail-max-height, 31.25rem);padding-top:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem));padding-bottom:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem))}}@keyframes tbw-detail-collapse{0%{opacity:1;max-height:var(--tbw-detail-max-height, 31.25rem)}to{opacity:0;max-height:0}}}";
|
|
2153
|
+
class Ve extends R {
|
|
2125
2154
|
name = "masterDetail";
|
|
2126
|
-
styles =
|
|
2155
|
+
styles = jt;
|
|
2127
2156
|
get defaultConfig() {
|
|
2128
2157
|
return {
|
|
2129
2158
|
detailHeight: "auto",
|
|
@@ -2152,8 +2181,8 @@ class Be extends R {
|
|
|
2152
2181
|
n !== null && (d.animation = n === "false" ? !1 : n), r !== null && (d.showExpandColumn = r !== "false"), o !== null && (d.expandOnRowClick = o === "true"), a !== null && (d.collapseOnClickOutside = a === "true"), l !== null && (d.detailHeight = l === "auto" ? "auto" : parseInt(l, 10));
|
|
2153
2182
|
const c = t.innerHTML.trim();
|
|
2154
2183
|
c && !this.config.detailRenderer && (d.detailRenderer = (u, h) => {
|
|
2155
|
-
const
|
|
2156
|
-
return
|
|
2184
|
+
const f = Ze(c, { value: u, row: u });
|
|
2185
|
+
return Je(f);
|
|
2157
2186
|
}), Object.keys(d).length > 0 && (this.config = { ...this.config, ...d });
|
|
2158
2187
|
}
|
|
2159
2188
|
get animationStyle() {
|
|
@@ -2184,10 +2213,10 @@ class Be extends R {
|
|
|
2184
2213
|
static DEFAULT_DETAIL_HEIGHT = 150;
|
|
2185
2214
|
getDetailHeight(e) {
|
|
2186
2215
|
const t = this.detailElements.get(e);
|
|
2187
|
-
return t ? t.offsetHeight : typeof this.config?.detailHeight == "number" ? this.config.detailHeight :
|
|
2216
|
+
return t ? t.offsetHeight : typeof this.config?.detailHeight == "number" ? this.config.detailHeight : Ve.DEFAULT_DETAIL_HEIGHT;
|
|
2188
2217
|
}
|
|
2189
2218
|
toggleAndEmit(e, t) {
|
|
2190
|
-
this.expandedRows =
|
|
2219
|
+
this.expandedRows = Ee(this.expandedRows, e), this.emit("detail-expand", {
|
|
2191
2220
|
rowIndex: t,
|
|
2192
2221
|
row: e,
|
|
2193
2222
|
expanded: this.expandedRows.has(e)
|
|
@@ -2200,9 +2229,9 @@ class Be extends R {
|
|
|
2200
2229
|
if (!(this.config.showExpandColumn === !0 || this.config.showExpandColumn !== !1 && !!this.config.detailRenderer))
|
|
2201
2230
|
return [...e];
|
|
2202
2231
|
const i = [...e];
|
|
2203
|
-
if (
|
|
2232
|
+
if (it(i))
|
|
2204
2233
|
return i;
|
|
2205
|
-
const r =
|
|
2234
|
+
const r = nt(this.name);
|
|
2206
2235
|
return r.viewRenderer = (o) => {
|
|
2207
2236
|
const { row: a } = o, l = this.expandedRows.has(a), d = document.createElement("span");
|
|
2208
2237
|
d.className = "master-detail-expander expander-cell";
|
|
@@ -2255,7 +2284,7 @@ class Be extends R {
|
|
|
2255
2284
|
d.previousElementSibling !== a && a.after(d);
|
|
2256
2285
|
continue;
|
|
2257
2286
|
}
|
|
2258
|
-
const c =
|
|
2287
|
+
const c = $t(l, o, this.config.detailRenderer, n);
|
|
2259
2288
|
typeof this.config.detailHeight == "number" && (c.style.height = `${this.config.detailHeight}px`), a.after(c), this.detailElements.set(l, c), this.animateExpand(c);
|
|
2260
2289
|
}
|
|
2261
2290
|
}
|
|
@@ -2290,19 +2319,19 @@ class Be extends R {
|
|
|
2290
2319
|
}
|
|
2291
2320
|
expand(e) {
|
|
2292
2321
|
const t = this.rows[e];
|
|
2293
|
-
t && (this.expandedRows =
|
|
2322
|
+
t && (this.expandedRows = Bt(this.expandedRows, t), this.requestRender());
|
|
2294
2323
|
}
|
|
2295
2324
|
collapse(e) {
|
|
2296
2325
|
const t = this.rows[e];
|
|
2297
|
-
t && (this.expandedRows =
|
|
2326
|
+
t && (this.expandedRows = Vt(this.expandedRows, t), this.requestRender());
|
|
2298
2327
|
}
|
|
2299
2328
|
toggle(e) {
|
|
2300
2329
|
const t = this.rows[e];
|
|
2301
|
-
t && (this.expandedRows =
|
|
2330
|
+
t && (this.expandedRows = Ee(this.expandedRows, t), this.requestRender());
|
|
2302
2331
|
}
|
|
2303
2332
|
isExpanded(e) {
|
|
2304
2333
|
const t = this.rows[e];
|
|
2305
|
-
return t ?
|
|
2334
|
+
return t ? Wt(this.expandedRows, t) : !1;
|
|
2306
2335
|
}
|
|
2307
2336
|
expandAll() {
|
|
2308
2337
|
for (const e of this.rows)
|
|
@@ -2332,34 +2361,34 @@ class Be extends R {
|
|
|
2332
2361
|
}
|
|
2333
2362
|
}
|
|
2334
2363
|
}
|
|
2335
|
-
function
|
|
2364
|
+
function Ut(s, e, t) {
|
|
2336
2365
|
return e.length ? [...s].sort((i, n) => {
|
|
2337
2366
|
for (const r of e) {
|
|
2338
|
-
const a = t.find((u) => u.field === r.field)?.sortComparator ??
|
|
2367
|
+
const a = t.find((u) => u.field === r.field)?.sortComparator ?? Yt, l = i[r.field], d = n[r.field], c = a(l, d, i, n);
|
|
2339
2368
|
if (c !== 0)
|
|
2340
2369
|
return r.direction === "asc" ? c : -c;
|
|
2341
2370
|
}
|
|
2342
2371
|
return 0;
|
|
2343
2372
|
}) : [...s];
|
|
2344
2373
|
}
|
|
2345
|
-
function
|
|
2374
|
+
function Yt(s, e) {
|
|
2346
2375
|
return s == null && e == null ? 0 : s == null ? 1 : e == null ? -1 : typeof s == "number" && typeof e == "number" ? s - e : s instanceof Date && e instanceof Date ? s.getTime() - e.getTime() : typeof s == "boolean" && typeof e == "boolean" ? s === e ? 0 : s ? -1 : 1 : String(s).localeCompare(String(e));
|
|
2347
2376
|
}
|
|
2348
|
-
function
|
|
2377
|
+
function Xt(s, e, t, i) {
|
|
2349
2378
|
const n = s.find((r) => r.field === e);
|
|
2350
2379
|
return t ? n ? n.direction === "asc" ? s.map((r) => r.field === e ? { ...r, direction: "desc" } : r) : s.filter((r) => r.field !== e) : s.length < i ? [...s, { field: e, direction: "asc" }] : s : n?.direction === "asc" ? [{ field: e, direction: "desc" }] : n?.direction === "desc" ? [] : [{ field: e, direction: "asc" }];
|
|
2351
2380
|
}
|
|
2352
|
-
function
|
|
2381
|
+
function Se(s, e) {
|
|
2353
2382
|
const t = s.findIndex((i) => i.field === e);
|
|
2354
2383
|
return t >= 0 ? t + 1 : void 0;
|
|
2355
2384
|
}
|
|
2356
2385
|
function ke(s, e) {
|
|
2357
2386
|
return s.find((t) => t.field === e)?.direction;
|
|
2358
2387
|
}
|
|
2359
|
-
const
|
|
2360
|
-
class
|
|
2388
|
+
const Zt = '@layer tbw-plugins{.header-cell[data-sort=asc]:after{content:"↑";margin-left:4px;opacity:.8}.header-cell[data-sort=desc]:after{content:"↓";margin-left:4px;opacity:.8}.sort-indicator{margin-left:4px;opacity:.8}.sort-index{font-size:10px;background:var(--tbw-multi-sort-badge-bg, var(--tbw-color-panel-bg));color:var(--tbw-multi-sort-badge-color, var(--tbw-color-fg));border-radius:50%;width:14px;height:14px;display:inline-flex;align-items:center;justify-content:center;margin-left:2px;font-weight:600}}';
|
|
2389
|
+
class tn extends R {
|
|
2361
2390
|
name = "multiSort";
|
|
2362
|
-
styles =
|
|
2391
|
+
styles = Zt;
|
|
2363
2392
|
get defaultConfig() {
|
|
2364
2393
|
return {
|
|
2365
2394
|
maxSortColumns: 3,
|
|
@@ -2371,12 +2400,12 @@ class Qi extends R {
|
|
|
2371
2400
|
this.sortModel = [];
|
|
2372
2401
|
}
|
|
2373
2402
|
processRows(e) {
|
|
2374
|
-
return this.sortModel.length === 0 ? [...e] :
|
|
2403
|
+
return this.sortModel.length === 0 ? [...e] : Ut([...e], this.sortModel, [...this.columns]);
|
|
2375
2404
|
}
|
|
2376
2405
|
onHeaderClick(e) {
|
|
2377
2406
|
if (!this.columns.find((r) => r.field === e.field)?.sortable) return !1;
|
|
2378
2407
|
const i = e.originalEvent.shiftKey, n = this.config.maxSortColumns ?? 3;
|
|
2379
|
-
return this.sortModel =
|
|
2408
|
+
return this.sortModel = Xt(this.sortModel, e.field, i, n), this.emit("sort-change", { sortModel: [...this.sortModel] }), this.requestRender(), !0;
|
|
2380
2409
|
}
|
|
2381
2410
|
afterRender() {
|
|
2382
2411
|
const e = this.gridElement;
|
|
@@ -2385,15 +2414,15 @@ class Qi extends R {
|
|
|
2385
2414
|
e.querySelectorAll(".header-row .cell[data-field]").forEach((n) => {
|
|
2386
2415
|
const r = n.getAttribute("data-field");
|
|
2387
2416
|
if (!r) return;
|
|
2388
|
-
const o =
|
|
2417
|
+
const o = Se(this.sortModel, r), a = ke(this.sortModel, r);
|
|
2389
2418
|
if (n.querySelector(".sort-index")?.remove(), a) {
|
|
2390
2419
|
n.querySelector('[part~="sort-indicator"], .sort-indicator')?.remove(), n.setAttribute("data-sort", a);
|
|
2391
2420
|
const c = document.createElement("span");
|
|
2392
2421
|
c.className = "sort-indicator", this.setIcon(c, this.resolveIcon(a === "asc" ? "sortAsc" : "sortDesc"));
|
|
2393
|
-
const u = n.querySelector(".tbw-filter-btn"), h = n.querySelector(".resize-handle"),
|
|
2394
|
-
if (
|
|
2395
|
-
const
|
|
2396
|
-
|
|
2422
|
+
const u = n.querySelector(".tbw-filter-btn"), h = n.querySelector(".resize-handle"), f = u ?? h;
|
|
2423
|
+
if (f ? n.insertBefore(c, f) : n.appendChild(c), t && this.sortModel.length > 1 && o !== void 0) {
|
|
2424
|
+
const g = document.createElement("span");
|
|
2425
|
+
g.className = "sort-index", g.textContent = String(o), c.nextSibling ? n.insertBefore(g, c.nextSibling) : n.appendChild(g);
|
|
2397
2426
|
}
|
|
2398
2427
|
} else
|
|
2399
2428
|
n.removeAttribute("data-sort");
|
|
@@ -2409,7 +2438,7 @@ class Qi extends R {
|
|
|
2409
2438
|
this.sortModel = [], this.emit("sort-change", { sortModel: [] }), this.requestRender();
|
|
2410
2439
|
}
|
|
2411
2440
|
getSortIndex(e) {
|
|
2412
|
-
return
|
|
2441
|
+
return Se(this.sortModel, e);
|
|
2413
2442
|
}
|
|
2414
2443
|
getSortDirection(e) {
|
|
2415
2444
|
return ke(this.sortModel, e);
|
|
@@ -2435,16 +2464,16 @@ class Qi extends R {
|
|
|
2435
2464
|
i !== -1 ? this.sortModel[i] = n : this.sortModel.splice(t.sort.priority, 0, n);
|
|
2436
2465
|
}
|
|
2437
2466
|
}
|
|
2438
|
-
function
|
|
2467
|
+
function Jt(s) {
|
|
2439
2468
|
return s.filter((e) => e.sticky === "left");
|
|
2440
2469
|
}
|
|
2441
|
-
function
|
|
2470
|
+
function Qt(s) {
|
|
2442
2471
|
return s.filter((e) => e.sticky === "right");
|
|
2443
2472
|
}
|
|
2444
2473
|
function X(s) {
|
|
2445
2474
|
return s.some((e) => e.sticky === "left" || e.sticky === "right");
|
|
2446
2475
|
}
|
|
2447
|
-
function
|
|
2476
|
+
function Ae(s, e) {
|
|
2448
2477
|
const t = Array.from(s.querySelectorAll(".header-row .cell"));
|
|
2449
2478
|
if (!t.length) return;
|
|
2450
2479
|
const i = /* @__PURE__ */ new Map();
|
|
@@ -2468,12 +2497,12 @@ function Se(s, e) {
|
|
|
2468
2497
|
}), r += l.offsetWidth);
|
|
2469
2498
|
}
|
|
2470
2499
|
}
|
|
2471
|
-
function
|
|
2500
|
+
function _e(s) {
|
|
2472
2501
|
s.querySelectorAll(".sticky-left, .sticky-right").forEach((t) => {
|
|
2473
2502
|
t.classList.remove("sticky-left", "sticky-right"), t.style.position = "", t.style.left = "", t.style.right = "";
|
|
2474
2503
|
});
|
|
2475
2504
|
}
|
|
2476
|
-
class
|
|
2505
|
+
class nn extends R {
|
|
2477
2506
|
static manifest = {
|
|
2478
2507
|
ownedProperties: [
|
|
2479
2508
|
{
|
|
@@ -2506,16 +2535,16 @@ class en extends R {
|
|
|
2506
2535
|
return;
|
|
2507
2536
|
const e = this.grid, t = [...this.columns];
|
|
2508
2537
|
if (!X(t)) {
|
|
2509
|
-
|
|
2538
|
+
_e(e), this.isApplied = !1;
|
|
2510
2539
|
return;
|
|
2511
2540
|
}
|
|
2512
2541
|
queueMicrotask(() => {
|
|
2513
|
-
|
|
2542
|
+
Ae(e, t);
|
|
2514
2543
|
});
|
|
2515
2544
|
}
|
|
2516
2545
|
onPluginQuery(e) {
|
|
2517
2546
|
switch (e.type) {
|
|
2518
|
-
case
|
|
2547
|
+
case Oe.CAN_MOVE_COLUMN: {
|
|
2519
2548
|
const t = e.context, i = t.sticky;
|
|
2520
2549
|
if (i === "left" || i === "right")
|
|
2521
2550
|
return !1;
|
|
@@ -2528,18 +2557,18 @@ class en extends R {
|
|
|
2528
2557
|
}
|
|
2529
2558
|
refreshStickyOffsets() {
|
|
2530
2559
|
const e = [...this.columns];
|
|
2531
|
-
|
|
2560
|
+
Ae(this.grid, e);
|
|
2532
2561
|
}
|
|
2533
2562
|
getLeftPinnedColumns() {
|
|
2534
2563
|
const e = [...this.columns];
|
|
2535
|
-
return
|
|
2564
|
+
return Jt(e);
|
|
2536
2565
|
}
|
|
2537
2566
|
getRightPinnedColumns() {
|
|
2538
2567
|
const e = [...this.columns];
|
|
2539
|
-
return
|
|
2568
|
+
return Qt(e);
|
|
2540
2569
|
}
|
|
2541
2570
|
clearStickyPositions() {
|
|
2542
|
-
|
|
2571
|
+
_e(this.grid);
|
|
2543
2572
|
}
|
|
2544
2573
|
getHorizontalScrollOffsets(e, t) {
|
|
2545
2574
|
if (!this.isApplied)
|
|
@@ -2560,7 +2589,7 @@ class en extends R {
|
|
|
2560
2589
|
return { left: i, right: n, skipScroll: r };
|
|
2561
2590
|
}
|
|
2562
2591
|
}
|
|
2563
|
-
function
|
|
2592
|
+
function ei(s) {
|
|
2564
2593
|
return typeof s == "object" && s !== null && "aggFunc" in s;
|
|
2565
2594
|
}
|
|
2566
2595
|
function Z(s, e) {
|
|
@@ -2585,7 +2614,7 @@ function Z(s, e) {
|
|
|
2585
2614
|
}
|
|
2586
2615
|
if (s.customPanels)
|
|
2587
2616
|
for (const o of s.customPanels) {
|
|
2588
|
-
const a =
|
|
2617
|
+
const a = ti(o, e);
|
|
2589
2618
|
switch (o.position) {
|
|
2590
2619
|
case "left":
|
|
2591
2620
|
i.appendChild(a);
|
|
@@ -2600,11 +2629,11 @@ function Z(s, e) {
|
|
|
2600
2629
|
}
|
|
2601
2630
|
return t.appendChild(i), t.appendChild(n), t.appendChild(r), t;
|
|
2602
2631
|
}
|
|
2603
|
-
function
|
|
2632
|
+
function Le(s) {
|
|
2604
2633
|
const e = document.createElement("div");
|
|
2605
2634
|
return e.className = `tbw-aggregation-rows tbw-aggregation-rows-${s}`, e.setAttribute("role", "presentation"), e;
|
|
2606
2635
|
}
|
|
2607
|
-
function
|
|
2636
|
+
function Te(s, e, t, i) {
|
|
2608
2637
|
s.innerHTML = "";
|
|
2609
2638
|
for (const n of e) {
|
|
2610
2639
|
const r = document.createElement("div");
|
|
@@ -2618,11 +2647,11 @@ function Le(s, e, t, i) {
|
|
|
2618
2647
|
let l, d;
|
|
2619
2648
|
const c = n.aggregators?.[o.field];
|
|
2620
2649
|
if (c)
|
|
2621
|
-
if (
|
|
2622
|
-
const u =
|
|
2650
|
+
if (ei(c)) {
|
|
2651
|
+
const u = ue(c.aggFunc);
|
|
2623
2652
|
u && (l = u(i, o.field, o)), d = c.formatter;
|
|
2624
2653
|
} else {
|
|
2625
|
-
const u =
|
|
2654
|
+
const u = ue(c);
|
|
2626
2655
|
u && (l = u(i, o.field, o));
|
|
2627
2656
|
}
|
|
2628
2657
|
else if (n.cells && Object.prototype.hasOwnProperty.call(n.cells, o.field)) {
|
|
@@ -2634,13 +2663,13 @@ function Le(s, e, t, i) {
|
|
|
2634
2663
|
s.appendChild(r);
|
|
2635
2664
|
}
|
|
2636
2665
|
}
|
|
2637
|
-
function
|
|
2666
|
+
function ti(s, e) {
|
|
2638
2667
|
const t = document.createElement("div");
|
|
2639
2668
|
t.className = "tbw-status-panel tbw-status-panel-custom", t.id = `status-panel-${s.id}`;
|
|
2640
2669
|
const i = s.render(e);
|
|
2641
2670
|
return typeof i == "string" ? t.innerHTML = i : t.appendChild(i), t;
|
|
2642
2671
|
}
|
|
2643
|
-
function
|
|
2672
|
+
function Ie(s, e, t, i, n) {
|
|
2644
2673
|
return {
|
|
2645
2674
|
totalRows: s.length,
|
|
2646
2675
|
filteredRows: n?.cachedResult?.length ?? s.length,
|
|
@@ -2650,10 +2679,10 @@ function Te(s, e, t, i, n) {
|
|
|
2650
2679
|
grid: t
|
|
2651
2680
|
};
|
|
2652
2681
|
}
|
|
2653
|
-
const
|
|
2654
|
-
class
|
|
2682
|
+
const ii = "@layer tbw-plugins{.tbw-footer{flex-shrink:0;z-index:var(--tbw-z-layer-pinned-rows, 20);background:var(--tbw-color-panel-bg)}.tbw-pinned-rows{display:flex;align-items:center;justify-content:space-between;padding:var(--tbw-button-padding, var(--tbw-spacing-md, .5rem) var(--tbw-spacing-lg, .75rem));background:var(--tbw-pinned-rows-bg, var(--tbw-color-panel-bg));border-top:1px solid var(--tbw-pinned-rows-border, var(--tbw-color-border));font-size:var(--tbw-font-size-xs, .75rem);color:var(--tbw-pinned-rows-color, var(--tbw-color-fg-muted));min-height:32px;box-sizing:border-box;min-width:fit-content}.tbw-pinned-rows-left,.tbw-pinned-rows-center,.tbw-pinned-rows-right{display:flex;align-items:center;gap:var(--tbw-spacing-xl, 1rem)}.tbw-pinned-rows-left{justify-content:flex-start}.tbw-pinned-rows-center{justify-content:center;flex:1}.tbw-pinned-rows-right{justify-content:flex-end}.tbw-status-panel{white-space:nowrap}.tbw-aggregation-rows{min-width:fit-content;background:var(--tbw-aggregation-bg, var(--tbw-color-header-bg))}.tbw-aggregation-rows-top{border-bottom:1px solid var(--tbw-aggregation-border, var(--tbw-color-border))}.tbw-aggregation-rows-bottom{border-top:1px solid var(--tbw-aggregation-border, var(--tbw-color-border))}.tbw-aggregation-row{display:grid;grid-template-columns:var(--tbw-column-template);font-size:var(--tbw-aggregation-font-size, .8em);font-weight:var(--tbw-aggregation-font-weight, 600)}.tbw-aggregation-cell{padding:var(--tbw-cell-padding, .125rem .5rem);min-height:var(--tbw-row-height, 1.75rem);display:flex;align-items:center;border-right:1px solid var(--tbw-color-border-cell)}.tbw-aggregation-cell:last-child{border-right:0}.tbw-aggregation-cell-full{grid-column:1 / -1;border-right:0}}";
|
|
2683
|
+
class rn extends R {
|
|
2655
2684
|
name = "pinnedRows";
|
|
2656
|
-
styles =
|
|
2685
|
+
styles = ii;
|
|
2657
2686
|
get defaultConfig() {
|
|
2658
2687
|
return {
|
|
2659
2688
|
position: "bottom",
|
|
@@ -2675,7 +2704,7 @@ class tn extends R {
|
|
|
2675
2704
|
const t = e.querySelector(".tbw-scroll-area") ?? e.querySelector(".tbw-grid-content") ?? e.children[0];
|
|
2676
2705
|
if (!t) return;
|
|
2677
2706
|
this.footerWrapper && !t.contains(this.footerWrapper) && (this.footerWrapper = null, this.bottomAggregationContainer = null, this.infoBarElement = null), this.topAggregationContainer && !t.contains(this.topAggregationContainer) && (this.topAggregationContainer = null), this.infoBarElement && !t.contains(this.infoBarElement) && (this.infoBarElement = null);
|
|
2678
|
-
const i = this.getSelectionState(), n = this.getFilterState(), r =
|
|
2707
|
+
const i = this.getSelectionState(), n = this.getFilterState(), r = Ie(
|
|
2679
2708
|
this.rows,
|
|
2680
2709
|
this.columns,
|
|
2681
2710
|
this.grid,
|
|
@@ -2684,11 +2713,11 @@ class tn extends R {
|
|
|
2684
2713
|
), o = this.config.aggregationRows || [], a = o.filter((h) => h.position === "top"), l = o.filter((h) => h.position !== "top");
|
|
2685
2714
|
if (a.length > 0) {
|
|
2686
2715
|
if (!this.topAggregationContainer) {
|
|
2687
|
-
this.topAggregationContainer =
|
|
2716
|
+
this.topAggregationContainer = Le("top");
|
|
2688
2717
|
const h = e.querySelector(".header");
|
|
2689
2718
|
h && h.nextSibling ? t.insertBefore(this.topAggregationContainer, h.nextSibling) : t.appendChild(this.topAggregationContainer);
|
|
2690
2719
|
}
|
|
2691
|
-
|
|
2720
|
+
Te(
|
|
2692
2721
|
this.topAggregationContainer,
|
|
2693
2722
|
a,
|
|
2694
2723
|
this.visibleColumns,
|
|
@@ -2704,7 +2733,7 @@ class tn extends R {
|
|
|
2704
2733
|
this.infoBarElement.replaceWith(h), this.infoBarElement = h;
|
|
2705
2734
|
}
|
|
2706
2735
|
else this.config.position === "top" && this.infoBarElement && (this.infoBarElement.remove(), this.infoBarElement = null);
|
|
2707
|
-
u ? (this.footerWrapper || (this.footerWrapper = document.createElement("div"), this.footerWrapper.className = "tbw-footer", t.appendChild(this.footerWrapper)), this.footerWrapper.innerHTML = "", l.length > 0 && (this.bottomAggregationContainer || (this.bottomAggregationContainer =
|
|
2736
|
+
u ? (this.footerWrapper || (this.footerWrapper = document.createElement("div"), this.footerWrapper.className = "tbw-footer", t.appendChild(this.footerWrapper)), this.footerWrapper.innerHTML = "", l.length > 0 && (this.bottomAggregationContainer || (this.bottomAggregationContainer = Le("bottom")), this.footerWrapper.appendChild(this.bottomAggregationContainer), Te(
|
|
2708
2737
|
this.bottomAggregationContainer,
|
|
2709
2738
|
l,
|
|
2710
2739
|
this.visibleColumns,
|
|
@@ -2736,7 +2765,7 @@ class tn extends R {
|
|
|
2736
2765
|
}
|
|
2737
2766
|
getContext() {
|
|
2738
2767
|
const e = this.getSelectionState(), t = this.getFilterState();
|
|
2739
|
-
return
|
|
2768
|
+
return Ie(
|
|
2740
2769
|
this.rows,
|
|
2741
2770
|
this.columns,
|
|
2742
2771
|
this.grid,
|
|
@@ -2757,16 +2786,16 @@ class tn extends R {
|
|
|
2757
2786
|
this.config.aggregationRows && (this.config.aggregationRows = this.config.aggregationRows.filter((t) => t.id !== e), this.requestRender());
|
|
2758
2787
|
}
|
|
2759
2788
|
}
|
|
2760
|
-
const
|
|
2761
|
-
function
|
|
2789
|
+
const ni = Qe;
|
|
2790
|
+
function ri(s) {
|
|
2762
2791
|
const e = [];
|
|
2763
2792
|
return !s.rowGroupFields?.length && !s.columnGroupFields?.length && e.push("At least one row or column group field is required"), s.valueFields?.length || e.push("At least one value field is required"), e;
|
|
2764
2793
|
}
|
|
2765
2794
|
function ae(s, e) {
|
|
2766
2795
|
return [...s, e].join("|");
|
|
2767
2796
|
}
|
|
2768
|
-
function
|
|
2769
|
-
const t = e.rowGroupFields ?? [], i = e.columnGroupFields ?? [], n = e.valueFields ?? [], r =
|
|
2797
|
+
function oi(s, e) {
|
|
2798
|
+
const t = e.rowGroupFields ?? [], i = e.columnGroupFields ?? [], n = e.valueFields ?? [], r = si(s, i), o = We(
|
|
2770
2799
|
s,
|
|
2771
2800
|
t,
|
|
2772
2801
|
i,
|
|
@@ -2774,7 +2803,7 @@ function ni(s, e) {
|
|
|
2774
2803
|
n,
|
|
2775
2804
|
0,
|
|
2776
2805
|
""
|
|
2777
|
-
), a =
|
|
2806
|
+
), a = li(o, r, n), l = Object.values(a).reduce((d, c) => d + c, 0);
|
|
2778
2807
|
return {
|
|
2779
2808
|
rows: o,
|
|
2780
2809
|
columnKeys: r,
|
|
@@ -2782,7 +2811,7 @@ function ni(s, e) {
|
|
|
2782
2811
|
grandTotal: l
|
|
2783
2812
|
};
|
|
2784
2813
|
}
|
|
2785
|
-
function
|
|
2814
|
+
function si(s, e) {
|
|
2786
2815
|
if (e.length === 0) return ["value"];
|
|
2787
2816
|
const t = /* @__PURE__ */ new Set();
|
|
2788
2817
|
for (const i of s) {
|
|
@@ -2791,7 +2820,7 @@ function ri(s, e) {
|
|
|
2791
2820
|
}
|
|
2792
2821
|
return [...t].sort();
|
|
2793
2822
|
}
|
|
2794
|
-
function
|
|
2823
|
+
function ai(s, e) {
|
|
2795
2824
|
const t = /* @__PURE__ */ new Map();
|
|
2796
2825
|
for (const i of s) {
|
|
2797
2826
|
const n = String(i[e] ?? ""), r = t.get(n);
|
|
@@ -2799,50 +2828,50 @@ function oi(s, e) {
|
|
|
2799
2828
|
}
|
|
2800
2829
|
return t;
|
|
2801
2830
|
}
|
|
2802
|
-
function
|
|
2831
|
+
function We(s, e, t, i, n, r, o) {
|
|
2803
2832
|
const a = [];
|
|
2804
2833
|
if (e.length === 0) {
|
|
2805
|
-
const h =
|
|
2834
|
+
const h = Fe(s, t, i, n), f = De(h);
|
|
2806
2835
|
return a.push({
|
|
2807
2836
|
rowKey: o || "all",
|
|
2808
2837
|
rowLabel: o || "All",
|
|
2809
2838
|
depth: r,
|
|
2810
2839
|
values: h,
|
|
2811
|
-
total:
|
|
2840
|
+
total: f,
|
|
2812
2841
|
isGroup: !1,
|
|
2813
2842
|
rowCount: s.length
|
|
2814
2843
|
}), a;
|
|
2815
2844
|
}
|
|
2816
|
-
const l = e[0], d = e.slice(1), c = d.length > 0, u =
|
|
2817
|
-
for (const [h,
|
|
2818
|
-
const
|
|
2845
|
+
const l = e[0], d = e.slice(1), c = d.length > 0, u = ai(s, l);
|
|
2846
|
+
for (const [h, f] of u) {
|
|
2847
|
+
const g = o ? `${o}|${h}` : h, p = Fe(f, t, i, n), m = De(p);
|
|
2819
2848
|
let w;
|
|
2820
|
-
c && (w =
|
|
2821
|
-
|
|
2849
|
+
c && (w = We(
|
|
2850
|
+
f,
|
|
2822
2851
|
d,
|
|
2823
2852
|
t,
|
|
2824
2853
|
i,
|
|
2825
2854
|
n,
|
|
2826
2855
|
r + 1,
|
|
2827
|
-
|
|
2856
|
+
g
|
|
2828
2857
|
)), a.push({
|
|
2829
|
-
rowKey:
|
|
2858
|
+
rowKey: g,
|
|
2830
2859
|
rowLabel: h || "(blank)",
|
|
2831
2860
|
depth: r,
|
|
2832
2861
|
values: p,
|
|
2833
2862
|
total: m,
|
|
2834
2863
|
isGroup: c,
|
|
2835
2864
|
children: w,
|
|
2836
|
-
rowCount:
|
|
2865
|
+
rowCount: f.length
|
|
2837
2866
|
});
|
|
2838
2867
|
}
|
|
2839
2868
|
return a;
|
|
2840
2869
|
}
|
|
2841
|
-
function
|
|
2870
|
+
function Fe(s, e, t, i) {
|
|
2842
2871
|
const n = {};
|
|
2843
2872
|
for (const r of t)
|
|
2844
2873
|
for (const o of i) {
|
|
2845
|
-
const l = (e.length > 0 ? s.filter((h) => e.map((
|
|
2874
|
+
const l = (e.length > 0 ? s.filter((h) => e.map((f) => String(h[f] ?? "")).join("|") === r) : s).map((h) => Number(h[o.field]) || 0), d = ni(o.aggFunc), c = l.length > 0 ? d(l) : null, u = ae([r], o.field);
|
|
2846
2875
|
n[u] = c;
|
|
2847
2876
|
}
|
|
2848
2877
|
return n;
|
|
@@ -2853,7 +2882,7 @@ function De(s) {
|
|
|
2853
2882
|
e += t ?? 0;
|
|
2854
2883
|
return e;
|
|
2855
2884
|
}
|
|
2856
|
-
function
|
|
2885
|
+
function li(s, e, t) {
|
|
2857
2886
|
const i = {};
|
|
2858
2887
|
function n(r) {
|
|
2859
2888
|
for (const o of r)
|
|
@@ -2867,7 +2896,7 @@ function si(s, e, t) {
|
|
|
2867
2896
|
}
|
|
2868
2897
|
return n(s), i;
|
|
2869
2898
|
}
|
|
2870
|
-
function
|
|
2899
|
+
function di(s, e, t = !0) {
|
|
2871
2900
|
const i = [];
|
|
2872
2901
|
function n(r) {
|
|
2873
2902
|
i.push(r);
|
|
@@ -2880,7 +2909,7 @@ function ai(s, e, t = !0) {
|
|
|
2880
2909
|
n(r);
|
|
2881
2910
|
return i;
|
|
2882
2911
|
}
|
|
2883
|
-
function
|
|
2912
|
+
function ci(s) {
|
|
2884
2913
|
const e = [];
|
|
2885
2914
|
function t(i) {
|
|
2886
2915
|
if (i.isGroup && e.push(i.rowKey), i.children)
|
|
@@ -2891,10 +2920,10 @@ function li(s) {
|
|
|
2891
2920
|
t(i);
|
|
2892
2921
|
return e;
|
|
2893
2922
|
}
|
|
2894
|
-
const
|
|
2895
|
-
function
|
|
2923
|
+
const ui = ["sum", "avg", "count", "min", "max", "first", "last"];
|
|
2924
|
+
function hi(s, e, t, i) {
|
|
2896
2925
|
const n = new AbortController(), r = { config: e, callbacks: i, signal: n.signal }, o = document.createElement("div");
|
|
2897
|
-
return o.className = "tbw-pivot-panel", o.appendChild(H("Options", () =>
|
|
2926
|
+
return o.className = "tbw-pivot-panel", o.appendChild(H("Options", () => wi(t, r))), o.appendChild(H("Row Groups", () => Pe("rowGroups", r))), o.appendChild(H("Column Groups", () => Pe("columnGroups", r))), o.appendChild(H("Values", () => gi(r))), o.appendChild(H("Available Fields", () => mi(r))), s.appendChild(o), () => {
|
|
2898
2927
|
n.abort(), o.remove();
|
|
2899
2928
|
};
|
|
2900
2929
|
}
|
|
@@ -2906,7 +2935,7 @@ function H(s, e) {
|
|
|
2906
2935
|
const n = document.createElement("div");
|
|
2907
2936
|
return n.className = "tbw-pivot-section-content", n.appendChild(e()), t.appendChild(i), t.appendChild(n), t;
|
|
2908
2937
|
}
|
|
2909
|
-
function
|
|
2938
|
+
function Pe(s, e) {
|
|
2910
2939
|
const { config: t, callbacks: i, signal: n } = e, r = document.createElement("div");
|
|
2911
2940
|
r.className = "tbw-pivot-drop-zone", r.setAttribute("data-zone", s);
|
|
2912
2941
|
const o = s === "rowGroups" ? t.rowGroupFields ?? [] : t.columnGroupFields ?? [];
|
|
@@ -2915,7 +2944,7 @@ function Fe(s, e) {
|
|
|
2915
2944
|
a.className = "tbw-pivot-placeholder", a.textContent = "Drag fields here or click to add", r.appendChild(a);
|
|
2916
2945
|
} else
|
|
2917
2946
|
for (const a of o)
|
|
2918
|
-
r.appendChild(
|
|
2947
|
+
r.appendChild(fi(a, s, e));
|
|
2919
2948
|
return r.addEventListener(
|
|
2920
2949
|
"dragover",
|
|
2921
2950
|
(a) => {
|
|
@@ -2938,7 +2967,7 @@ function Fe(s, e) {
|
|
|
2938
2967
|
{ signal: n }
|
|
2939
2968
|
), r;
|
|
2940
2969
|
}
|
|
2941
|
-
function
|
|
2970
|
+
function fi(s, e, t) {
|
|
2942
2971
|
const { callbacks: i, signal: n } = t, r = document.createElement("div");
|
|
2943
2972
|
r.className = "tbw-pivot-field-chip", r.draggable = !0;
|
|
2944
2973
|
const o = i.getAvailableFields().find((d) => d.field === s), a = document.createElement("span");
|
|
@@ -2964,7 +2993,7 @@ function ui(s, e, t) {
|
|
|
2964
2993
|
{ signal: n }
|
|
2965
2994
|
), r;
|
|
2966
2995
|
}
|
|
2967
|
-
function
|
|
2996
|
+
function gi(s) {
|
|
2968
2997
|
const { config: e, callbacks: t, signal: i } = s, n = document.createElement("div");
|
|
2969
2998
|
n.className = "tbw-pivot-drop-zone tbw-pivot-values-zone", n.setAttribute("data-zone", "values");
|
|
2970
2999
|
const r = e.valueFields ?? [];
|
|
@@ -2973,7 +3002,7 @@ function hi(s) {
|
|
|
2973
3002
|
o.className = "tbw-pivot-placeholder", o.textContent = "Drag numeric fields here for aggregation", n.appendChild(o);
|
|
2974
3003
|
} else
|
|
2975
3004
|
for (const o of r)
|
|
2976
|
-
n.appendChild(
|
|
3005
|
+
n.appendChild(pi(o, s));
|
|
2977
3006
|
return n.addEventListener(
|
|
2978
3007
|
"dragover",
|
|
2979
3008
|
(o) => {
|
|
@@ -2996,7 +3025,7 @@ function hi(s) {
|
|
|
2996
3025
|
{ signal: i }
|
|
2997
3026
|
), n;
|
|
2998
3027
|
}
|
|
2999
|
-
function
|
|
3028
|
+
function pi(s, e) {
|
|
3000
3029
|
const { callbacks: t, signal: i } = e, n = document.createElement("div");
|
|
3001
3030
|
n.className = "tbw-pivot-field-chip tbw-pivot-value-chip";
|
|
3002
3031
|
const r = t.getAvailableFields().find((c) => c.field === s.field), o = document.createElement("div");
|
|
@@ -3005,7 +3034,7 @@ function gi(s, e) {
|
|
|
3005
3034
|
a.className = "tbw-pivot-chip-label", a.textContent = r?.header ?? s.field;
|
|
3006
3035
|
const l = document.createElement("select");
|
|
3007
3036
|
l.className = "tbw-pivot-agg-select", l.title = "Aggregation function";
|
|
3008
|
-
for (const c of
|
|
3037
|
+
for (const c of ui) {
|
|
3009
3038
|
const u = document.createElement("option");
|
|
3010
3039
|
u.value = c, u.textContent = c.toUpperCase(), u.selected = c === s.aggFunc, l.appendChild(u);
|
|
3011
3040
|
}
|
|
@@ -3025,7 +3054,7 @@ function gi(s, e) {
|
|
|
3025
3054
|
{ signal: i }
|
|
3026
3055
|
), o.appendChild(a), o.appendChild(l), n.appendChild(o), n.appendChild(d), n;
|
|
3027
3056
|
}
|
|
3028
|
-
function
|
|
3057
|
+
function mi(s) {
|
|
3029
3058
|
const { config: e, callbacks: t, signal: i } = s, n = document.createElement("div");
|
|
3030
3059
|
n.className = "tbw-pivot-available-fields";
|
|
3031
3060
|
const r = t.getAvailableFields(), o = /* @__PURE__ */ new Set([
|
|
@@ -3055,7 +3084,7 @@ function fi(s) {
|
|
|
3055
3084
|
}
|
|
3056
3085
|
return n;
|
|
3057
3086
|
}
|
|
3058
|
-
function
|
|
3087
|
+
function wi(s, e) {
|
|
3059
3088
|
const { config: t, callbacks: i, signal: n } = e, r = document.createElement("div");
|
|
3060
3089
|
return r.className = "tbw-pivot-options", r.appendChild(
|
|
3061
3090
|
J(
|
|
@@ -3094,7 +3123,7 @@ function J(s, e, t, i) {
|
|
|
3094
3123
|
const o = document.createElement("span");
|
|
3095
3124
|
return o.textContent = s, n.appendChild(r), n.appendChild(o), n;
|
|
3096
3125
|
}
|
|
3097
|
-
function
|
|
3126
|
+
function bi(s, e, t) {
|
|
3098
3127
|
return e.className = "data-grid-row pivot-group-row", e.setAttribute("data-pivot-depth", String(s.__pivotDepth ?? 0)), e.setAttribute("data-pivot-key", String(s.__pivotRowKey ?? "")), e.setAttribute("role", "row"), e.innerHTML = "", t.columns.forEach((i, n) => {
|
|
3099
3128
|
const r = document.createElement("div");
|
|
3100
3129
|
if (r.className = "cell", r.setAttribute("data-col", String(n)), r.setAttribute("data-row", String(t.rowIndex)), r.setAttribute("role", "gridcell"), n === 0) {
|
|
@@ -3115,7 +3144,7 @@ function mi(s, e, t) {
|
|
|
3115
3144
|
e.appendChild(r);
|
|
3116
3145
|
}), !0;
|
|
3117
3146
|
}
|
|
3118
|
-
function
|
|
3147
|
+
function vi(s, e, t, i) {
|
|
3119
3148
|
return e.className = "data-grid-row pivot-leaf-row", e.setAttribute("data-pivot-depth", String(s.__pivotDepth ?? 0)), e.setAttribute("data-pivot-key", String(s.__pivotRowKey ?? "")), e.innerHTML = "", t.forEach((n, r) => {
|
|
3120
3149
|
const o = document.createElement("div");
|
|
3121
3150
|
if (o.className = "cell", o.setAttribute("data-col", String(r)), o.setAttribute("data-row", String(i)), o.setAttribute("role", "gridcell"), r === 0) {
|
|
@@ -3130,7 +3159,7 @@ function wi(s, e, t, i) {
|
|
|
3130
3159
|
e.appendChild(o);
|
|
3131
3160
|
}), !0;
|
|
3132
3161
|
}
|
|
3133
|
-
function
|
|
3162
|
+
function yi(s, e, t) {
|
|
3134
3163
|
return e.className = "pivot-grand-total-row", e.setAttribute("role", "presentation"), e.innerHTML = "", t.forEach((i, n) => {
|
|
3135
3164
|
const r = document.createElement("div");
|
|
3136
3165
|
if (r.className = "cell", r.setAttribute("data-col", String(n)), n === 0) {
|
|
@@ -3143,10 +3172,10 @@ function bi(s, e, t) {
|
|
|
3143
3172
|
e.appendChild(r);
|
|
3144
3173
|
}), !0;
|
|
3145
3174
|
}
|
|
3146
|
-
const
|
|
3147
|
-
class
|
|
3175
|
+
const Ci = '@layer tbw-plugins{.pivot-group-row{display:grid;grid-template-columns:var(--tbw-column-template);font-weight:600;background:var(--tbw-pivot-group-bg, var(--tbw-color-row-alt));min-height:var(--tbw-row-height);border-bottom:var(--tbw-row-divider)}.pivot-group-row:hover{background:var(--tbw-pivot-group-hover, var(--tbw-color-row-hover))}.pivot-leaf-row{display:grid;grid-template-columns:var(--tbw-column-template);background:var(--tbw-pivot-leaf-bg, var(--tbw-color-bg));min-height:var(--tbw-row-height);border-bottom:var(--tbw-row-divider)}.pivot-grand-total-row{display:grid;grid-template-columns:var(--tbw-column-template);font-weight:700;background:var(--tbw-pivot-grand-total-bg, var(--tbw-color-header-bg));min-height:var(--tbw-row-height);border-top:2px solid var(--tbw-color-border-strong)}.pivot-grand-total-row>.cell{display:flex;align-items:center;padding:var(--tbw-cell-padding);border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0}.pivot-grand-total-row>.cell:last-child{border-right:0}.pivot-grand-total-footer{position:sticky;bottom:0;z-index:var(--tbw-z-layer-pinned-rows, 20);background:var(--tbw-pivot-grand-total-bg, var(--tbw-color-header-bg));min-width:fit-content}.pivot-group-row>.cell,.pivot-leaf-row>.cell{display:flex;align-items:center;padding:var(--tbw-cell-padding);border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0}.pivot-group-row>.cell:last-child,.pivot-leaf-row>.cell:last-child{border-right:0}.pivot-toggle{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;margin-right:6px;border:none;background:transparent;cursor:pointer;color:var(--tbw-pivot-toggle-color, var(--tbw-color-fg-muted));border-radius:var(--tbw-border-radius);transition:background .15s,color .15s}.pivot-toggle:hover{background:var(--tbw-pivot-toggle-hover-bg, var(--tbw-color-row-hover));color:var(--tbw-pivot-toggle-hover-color, var(--tbw-color-fg))}.pivot-toggle:focus{outline:var(--tbw-focus-outline);outline-offset:var(--tbw-focus-outline-offset)}.pivot-label{font-weight:inherit}.pivot-count{color:var(--tbw-pivot-count-color, var(--tbw-color-fg-muted));font-size:.9em;font-weight:400}.pivot-total-row{font-weight:700;border-top:2px solid var(--tbw-pivot-border, var(--tbw-color-border-strong))}[data-pivot-depth="1"]{--tbw-pivot-depth: 1}[data-pivot-depth="2"]{--tbw-pivot-depth: 2}[data-pivot-depth="3"]{--tbw-pivot-depth: 3}[data-pivot-depth="4"]{--tbw-pivot-depth: 4}.tbw-pivot-panel{display:flex;flex-direction:column;gap:var(--tbw-panel-padding, var(--tbw-spacing-lg, .75rem));padding:var(--tbw-panel-padding, var(--tbw-spacing-lg, .75rem));height:100%;overflow-y:auto;font-size:var(--tbw-font-size-sm, .8125rem)}.tbw-pivot-section{border:1px solid var(--tbw-pivot-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius);background:var(--tbw-pivot-section-bg, var(--tbw-color-bg))}.tbw-pivot-section-header{padding:var(--tbw-button-padding, var(--tbw-spacing-md, .5rem) var(--tbw-spacing-lg, .75rem));font-weight:600;background:var(--tbw-pivot-header-bg, var(--tbw-color-header-bg));border-bottom:1px solid var(--tbw-pivot-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius) var(--tbw-border-radius) 0 0}.tbw-pivot-section-content{padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.tbw-pivot-toggle-wrapper{display:flex;align-items:center}.tbw-pivot-toggle-label{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));cursor:pointer}.tbw-pivot-toggle-label input{width:var(--tbw-icon-size, 1rem);height:var(--tbw-icon-size, 1rem);cursor:pointer}.tbw-pivot-drop-zone{min-height:60px;padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));border:2px dashed var(--tbw-pivot-drop-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius);background:var(--tbw-pivot-drop-bg, var(--tbw-color-row-alt));display:flex;flex-wrap:wrap;gap:var(--tbw-spacing-sm, .375rem);align-content:flex-start;transition:all .15s ease}.tbw-pivot-drop-zone.drag-over{border-color:var(--tbw-color-accent);background:var(--tbw-pivot-drop-active, var(--tbw-focus-background))}.tbw-pivot-placeholder{color:var(--tbw-color-fg-muted);font-style:italic;padding:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));text-align:center;width:100%}.tbw-pivot-field-chip{display:inline-flex;align-items:center;gap:var(--tbw-spacing-sm, .375rem);padding:var(--tbw-button-padding-sm, var(--tbw-spacing-xs, .25rem) var(--tbw-spacing-md, .5rem));background:var(--tbw-pivot-chip-bg, var(--tbw-color-header-bg));border:1px solid var(--tbw-pivot-chip-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius);cursor:grab;font-size:var(--tbw-font-size-xs, .75rem);transition:all .15s ease}.tbw-pivot-field-chip:hover{background:var(--tbw-pivot-chip-hover, var(--tbw-color-row-hover));border-color:var(--tbw-color-accent)}.tbw-pivot-field-chip.available{background:var(--tbw-color-bg)}.tbw-pivot-field-chip.dragging{opacity:.5;cursor:grabbing}.tbw-pivot-chip-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:120px}.tbw-pivot-chip-remove{display:flex;align-items:center;justify-content:center;width:var(--tbw-icon-size, 1rem);height:var(--tbw-icon-size, 1rem);padding:0;border:none;background:transparent;color:var(--tbw-color-fg-muted);font-size:var(--tbw-font-size-sm, .875rem);font-weight:700;cursor:pointer;border-radius:50%;transition:all .15s ease}.tbw-pivot-chip-remove:hover{background:var(--tbw-pivot-chip-remove-hover-bg, var(--tbw-color-accent));color:var(--tbw-pivot-chip-remove-hover-fg, var(--tbw-color-accent-fg))}.tbw-pivot-value-chip{padding:var(--tbw-button-padding-sm, var(--tbw-spacing-xs, .25rem) var(--tbw-spacing-md, .5rem))}.tbw-pivot-value-label-wrapper{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));flex:1;min-width:0}.tbw-pivot-agg-select{padding:var(--tbw-spacing-xs, .125rem) var(--tbw-spacing-xs, .25rem);font-size:var(--tbw-font-size-xs, .6875rem);border:1px solid var(--tbw-color-border);border-radius:var(--tbw-border-radius);background:var(--tbw-color-bg);cursor:pointer}.tbw-pivot-available-fields{display:flex;flex-wrap:wrap;gap:var(--tbw-spacing-sm, .375rem);min-height:40px}.tbw-pivot-options{display:flex;flex-direction:column;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.tbw-pivot-checkbox{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));cursor:pointer}.tbw-pivot-checkbox input{width:var(--tbw-icon-size-sm, .875rem);height:var(--tbw-icon-size-sm, .875rem);cursor:pointer}.pivot-group-row.tbw-pivot-slide-in,.pivot-leaf-row.tbw-pivot-slide-in{animation:tbw-pivot-slide-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-pivot-slide-in{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}.pivot-group-row.tbw-pivot-fade-in,.pivot-leaf-row.tbw-pivot-fade-in{animation:tbw-pivot-fade-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-pivot-fade-in{0%{opacity:0}to{opacity:1}}}';
|
|
3176
|
+
class P extends R {
|
|
3148
3177
|
name = "pivot";
|
|
3149
|
-
styles =
|
|
3178
|
+
styles = Ci;
|
|
3150
3179
|
static PANEL_ID = "pivot";
|
|
3151
3180
|
get defaultConfig() {
|
|
3152
3181
|
return {
|
|
@@ -3180,7 +3209,7 @@ class M extends R {
|
|
|
3180
3209
|
getToolPanel() {
|
|
3181
3210
|
if ((this.config?.showToolPanel ?? this.userConfig?.showToolPanel ?? !0) !== !1)
|
|
3182
3211
|
return {
|
|
3183
|
-
id:
|
|
3212
|
+
id: P.PANEL_ID,
|
|
3184
3213
|
title: "Pivot",
|
|
3185
3214
|
icon: "⊞",
|
|
3186
3215
|
tooltip: "Configure pivot table",
|
|
@@ -3191,11 +3220,11 @@ class M extends R {
|
|
|
3191
3220
|
processRows(e) {
|
|
3192
3221
|
if (!this.hasInitialized && this.config.active !== !1 && this.hasValidPivotConfig() && (this.hasInitialized = !0, this.isActive = !0), !this.isActive)
|
|
3193
3222
|
return [...e];
|
|
3194
|
-
const t =
|
|
3223
|
+
const t = ri(this.config);
|
|
3195
3224
|
if (t.length > 0)
|
|
3196
3225
|
return this.warn(`Config errors: ${t.join(", ")}`), [...e];
|
|
3197
|
-
this.buildFieldHeaderMap(), this.defaultExpanded = this.config.defaultExpanded ?? !0, this.expandedKeys.size === 0 && this.defaultExpanded && this.pivotResult && this.expandAllKeys(), this.pivotResult =
|
|
3198
|
-
const i = this.config.indentWidth ?? 20, n =
|
|
3226
|
+
this.buildFieldHeaderMap(), this.defaultExpanded = this.config.defaultExpanded ?? !0, this.expandedKeys.size === 0 && this.defaultExpanded && this.pivotResult && this.expandAllKeys(), this.pivotResult = oi(e, this.config), this.expandedKeys.size === 0 && this.defaultExpanded && this.expandAllKeys();
|
|
3227
|
+
const i = this.config.indentWidth ?? 20, n = di(
|
|
3199
3228
|
this.pivotResult.rows,
|
|
3200
3229
|
this.expandedKeys,
|
|
3201
3230
|
this.defaultExpanded
|
|
@@ -3247,13 +3276,13 @@ class M extends R {
|
|
|
3247
3276
|
}
|
|
3248
3277
|
renderRow(e, t, i) {
|
|
3249
3278
|
const n = e;
|
|
3250
|
-
return n.__pivotRowKey && n.__pivotHasChildren ?
|
|
3279
|
+
return n.__pivotRowKey && n.__pivotHasChildren ? bi(n, t, {
|
|
3251
3280
|
columns: this.gridColumns,
|
|
3252
3281
|
rowIndex: i,
|
|
3253
3282
|
onToggle: (r) => this.toggle(r),
|
|
3254
3283
|
resolveIcon: (r) => this.resolveIcon(r),
|
|
3255
3284
|
setIcon: (r, o) => this.setIcon(r, o)
|
|
3256
|
-
}) : n.__pivotRowKey !== void 0 && this.isActive ?
|
|
3285
|
+
}) : n.__pivotRowKey !== void 0 && this.isActive ? vi(n, t, this.gridColumns, i) : (this.cleanupPivotStyling(t), !1);
|
|
3257
3286
|
}
|
|
3258
3287
|
cleanupPivotStyling(e) {
|
|
3259
3288
|
(e.classList.contains("pivot-group-row") || e.classList.contains("pivot-leaf-row") || e.classList.contains("pivot-grand-total-row")) && (e.classList.remove("pivot-group-row", "pivot-leaf-row", "pivot-grand-total-row"), e.classList.add("data-grid-row"), e.removeAttribute("data-pivot-depth"), e.innerHTML = "");
|
|
@@ -3291,7 +3320,7 @@ class M extends R {
|
|
|
3291
3320
|
__pivotTotal: this.pivotResult.grandTotal,
|
|
3292
3321
|
...this.pivotResult.totals
|
|
3293
3322
|
};
|
|
3294
|
-
|
|
3323
|
+
yi(i, this.grandTotalFooter, this.gridColumns);
|
|
3295
3324
|
}
|
|
3296
3325
|
cleanupGrandTotalFooter() {
|
|
3297
3326
|
this.grandTotalFooter && (this.grandTotalFooter.remove(), this.grandTotalFooter = null);
|
|
@@ -3313,7 +3342,7 @@ class M extends R {
|
|
|
3313
3342
|
}
|
|
3314
3343
|
expandAllKeys() {
|
|
3315
3344
|
if (!this.pivotResult) return;
|
|
3316
|
-
const e =
|
|
3345
|
+
const e = ci(this.pivotResult.rows);
|
|
3317
3346
|
for (const t of e)
|
|
3318
3347
|
this.expandedKeys.add(t);
|
|
3319
3348
|
}
|
|
@@ -3345,16 +3374,16 @@ class M extends R {
|
|
|
3345
3374
|
this.pivotResult = null, this.requestRender();
|
|
3346
3375
|
}
|
|
3347
3376
|
showPanel() {
|
|
3348
|
-
this.grid.openToolPanel(), this.grid.expandedToolPanelSections.includes(
|
|
3377
|
+
this.grid.openToolPanel(), this.grid.expandedToolPanelSections.includes(P.PANEL_ID) || this.grid.toggleToolPanelSection(P.PANEL_ID);
|
|
3349
3378
|
}
|
|
3350
3379
|
hidePanel() {
|
|
3351
3380
|
this.grid.closeToolPanel();
|
|
3352
3381
|
}
|
|
3353
3382
|
togglePanel() {
|
|
3354
|
-
this.grid.isToolPanelOpen || this.grid.openToolPanel(), this.grid.toggleToolPanelSection(
|
|
3383
|
+
this.grid.isToolPanelOpen || this.grid.openToolPanel(), this.grid.toggleToolPanelSection(P.PANEL_ID);
|
|
3355
3384
|
}
|
|
3356
3385
|
isPanelVisible() {
|
|
3357
|
-
return this.grid.isToolPanelOpen && this.grid.expandedToolPanelSections.includes(
|
|
3386
|
+
return this.grid.isToolPanelOpen && this.grid.expandedToolPanelSections.includes(P.PANEL_ID);
|
|
3358
3387
|
}
|
|
3359
3388
|
get gridColumns() {
|
|
3360
3389
|
return this.grid.columns ?? [];
|
|
@@ -3398,7 +3427,7 @@ class M extends R {
|
|
|
3398
3427
|
},
|
|
3399
3428
|
getAvailableFields: () => this.getAvailableFields()
|
|
3400
3429
|
};
|
|
3401
|
-
return
|
|
3430
|
+
return hi(e, this.config, this.isActive, t);
|
|
3402
3431
|
}
|
|
3403
3432
|
refreshPanel() {
|
|
3404
3433
|
this.panelContainer && (this.panelContainer.innerHTML = "", this.renderPanel(this.panelContainer));
|
|
@@ -3431,7 +3460,7 @@ class M extends R {
|
|
|
3431
3460
|
n >= 0 && (i[n] = { ...i[n], aggFunc: t }, this.config.valueFields = [...i]), this.isActive && this.refresh();
|
|
3432
3461
|
}
|
|
3433
3462
|
}
|
|
3434
|
-
function
|
|
3463
|
+
function xi(s) {
|
|
3435
3464
|
const e = s.meta ?? {};
|
|
3436
3465
|
return e.lockPosition !== !0 && e.suppressMovable !== !0;
|
|
3437
3466
|
}
|
|
@@ -3440,10 +3469,10 @@ function Me(s, e, t) {
|
|
|
3440
3469
|
const i = [...s], [n] = i.splice(e, 1);
|
|
3441
3470
|
return i.splice(t, 0, n), i;
|
|
3442
3471
|
}
|
|
3443
|
-
const
|
|
3444
|
-
class
|
|
3472
|
+
const Ri = '@layer tbw-plugins{.header-row>.cell[draggable=true]{cursor:grab;position:relative}.header-row>.cell.dragging{opacity:.5;cursor:grabbing}.header-row>.cell.drop-before:before{content:"";position:absolute;left:0;top:0;bottom:0;width:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent));z-index:1}.header-row>.cell.drop-after:after{content:"";position:absolute;right:0;top:0;bottom:0;width:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent));z-index:1}.cell.flip-animating{transition:transform var(--tbw-animation-duration, .2s) ease-out;will-change:transform;z-index:1}@keyframes reorder-fade-in{0%{opacity:0}to{opacity:1}}.cell.fade-animating{animation:reorder-fade-in var(--tbw-animation-duration, .2s) ease-out backwards}}';
|
|
3473
|
+
class on extends R {
|
|
3445
3474
|
name = "reorder";
|
|
3446
|
-
styles =
|
|
3475
|
+
styles = Ri;
|
|
3447
3476
|
get defaultConfig() {
|
|
3448
3477
|
return {
|
|
3449
3478
|
animation: "flip"
|
|
@@ -3460,8 +3489,8 @@ class nn extends R {
|
|
|
3460
3489
|
draggedIndex = null;
|
|
3461
3490
|
dropIndex = null;
|
|
3462
3491
|
canMoveColumnWithPlugins(e) {
|
|
3463
|
-
return !e || !
|
|
3464
|
-
type:
|
|
3492
|
+
return !e || !xi(e) ? !1 : !this.grid.queryPlugins({
|
|
3493
|
+
type: Oe.CAN_MOVE_COLUMN,
|
|
3465
3494
|
context: e
|
|
3466
3495
|
}).includes(!1);
|
|
3467
3496
|
}
|
|
@@ -3510,13 +3539,13 @@ class nn extends R {
|
|
|
3510
3539
|
const l = this.draggedField, d = this.draggedIndex, c = this.dropIndex;
|
|
3511
3540
|
if (!this.isDragging || l === null || d === null || c === null)
|
|
3512
3541
|
return;
|
|
3513
|
-
const u = c > d ? c - 1 : c, h = this.getColumnOrder(),
|
|
3542
|
+
const u = c > d ? c - 1 : c, h = this.getColumnOrder(), f = Me(h, d, u), g = {
|
|
3514
3543
|
field: l,
|
|
3515
3544
|
fromIndex: d,
|
|
3516
3545
|
toIndex: u,
|
|
3517
|
-
columnOrder:
|
|
3546
|
+
columnOrder: f
|
|
3518
3547
|
};
|
|
3519
|
-
this.emitCancelable("column-move",
|
|
3548
|
+
this.emitCancelable("column-move", g) || this.updateColumnOrder(f);
|
|
3520
3549
|
}));
|
|
3521
3550
|
});
|
|
3522
3551
|
}
|
|
@@ -3533,7 +3562,7 @@ class nn extends R {
|
|
|
3533
3562
|
if (l < 0 || l >= o.length) return;
|
|
3534
3563
|
const d = n.find((c) => c.field === o[l]);
|
|
3535
3564
|
if (this.canMoveColumnWithPlugins(d))
|
|
3536
|
-
return this.moveColumn(r.field, l), t._focusCol = l,
|
|
3565
|
+
return this.moveColumn(r.field, l), t._focusCol = l, _(this.grid), e.preventDefault(), e.stopPropagation(), !0;
|
|
3537
3566
|
}
|
|
3538
3567
|
getColumnOrder() {
|
|
3539
3568
|
return this.grid.getColumnOrder();
|
|
@@ -3636,11 +3665,11 @@ class nn extends R {
|
|
|
3636
3665
|
this.grid.requestStateChange?.();
|
|
3637
3666
|
}
|
|
3638
3667
|
}
|
|
3639
|
-
const
|
|
3640
|
-
class
|
|
3668
|
+
const Ei = 'tbw-grid[data-responsive-animate]{.data-grid-row,.data-grid-row>.cell{transition:opacity var(--tbw-responsive-duration, .2s) ease-out,transform var(--tbw-responsive-duration, .2s) ease-out}}tbw-grid[data-responsive][data-responsive-animate]{.data-grid-row{animation:responsive-card-enter var(--tbw-responsive-duration, .2s) ease-out}}@keyframes responsive-card-enter{0%{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}tbw-grid[data-responsive]{.header{display:none!important}.footer-row{display:none}.tbw-scroll-area{overflow-x:hidden;min-width:0!important}.rows-body-wrapper{min-width:0!important}.data-grid-row:not(.group-row){display:block!important;grid-template-columns:none!important;padding:var(--tbw-cell-padding);padding-left:var(--tbw-spacing-xl);border-bottom:1px solid var(--tbw-color-border);min-height:auto!important;height:auto!important;contain:none!important;content-visibility:visible!important;background:var(--tbw-color-bg);position:relative;&:nth-child(2n){background:var(--tbw-color-row-alt)}&:hover{background:var(--tbw-color-row-hover)}&[aria-selected=true]{background:var(--tbw-color-selection);&:before{content:"";position:absolute;left:0;top:0;bottom:0;width:4px;background:var(--tbw-color-accent)}}}.data-grid-row:not(.group-row)>.cell{display:flex!important;justify-content:space-between;align-items:center;padding:var(--tbw-spacing-xs) var(--tbw-spacing-md);width:100%!important;min-width:0!important;min-height:auto!important;height:auto!important;line-height:1.5!important;position:static!important;left:auto!important;right:auto!important;border:none!important;border-bottom:none!important;border-right:none!important;background:transparent!important;white-space:normal!important;overflow:visible!important;&:before{content:attr(data-header) ": ";font-weight:600;color:var(--tbw-color-header-fg);flex-shrink:0;margin-right:var(--tbw-spacing-md);min-width:100px}&:after{content:none}}.cell[data-utility]{display:none!important}}tbw-grid[data-responsive] .cell[data-responsive-hidden]{display:none!important}tbw-grid[data-responsive] .cell[data-responsive-value-only]{&:before{display:none!important}justify-content:flex-start!important;font-weight:500}tbw-grid:not([data-responsive]) .cell[data-responsive-hidden]{display:none!important}tbw-grid[data-responsive]{.tbw-footer,.tbw-pinned-rows,.tbw-aggregation-rows{display:none!important}.tbw-pinned-rows,.tbw-aggregation-rows,.tbw-aggregation-row{min-width:0!important}}tbw-grid[data-responsive] .data-grid-row.responsive-card{display:block!important;padding:var(--tbw-cell-padding);border-bottom:1px solid var(--tbw-color-border);>*{width:100%}.cell:before{display:none}}';
|
|
3669
|
+
class sn extends R {
|
|
3641
3670
|
name = "responsive";
|
|
3642
3671
|
version = "1.0.0";
|
|
3643
|
-
styles =
|
|
3672
|
+
styles = Ei;
|
|
3644
3673
|
static manifest = {
|
|
3645
3674
|
incompatibleWith: [
|
|
3646
3675
|
{
|
|
@@ -3752,7 +3781,7 @@ class rn extends R {
|
|
|
3752
3781
|
const i = this.gridElement.querySelectorAll(".data-grid-row");
|
|
3753
3782
|
for (const n of i)
|
|
3754
3783
|
n.style.height = "", n.classList.remove("responsive-card");
|
|
3755
|
-
this.#a && this.#a > 0 && t._virtualization && (t._virtualization.rowHeight = this.#a, this.#a = void 0), this.#
|
|
3784
|
+
this.#a && this.#a > 0 && t._virtualization && (t._virtualization.rowHeight = this.#a, this.#a = void 0), this.#f = void 0, this.#g = void 0, this.#m = void 0;
|
|
3756
3785
|
}
|
|
3757
3786
|
}
|
|
3758
3787
|
renderRow(e, t, i) {
|
|
@@ -3771,38 +3800,38 @@ class rn extends R {
|
|
|
3771
3800
|
switch (e.key) {
|
|
3772
3801
|
case "ArrowDown":
|
|
3773
3802
|
if (this.grid._focusCol < i)
|
|
3774
|
-
return this.grid._focusCol += 1, e.preventDefault(),
|
|
3803
|
+
return this.grid._focusCol += 1, e.preventDefault(), _(this.grid), !0;
|
|
3775
3804
|
if (this.grid._focusRow < t)
|
|
3776
|
-
return this.grid._focusRow += 1, this.grid._focusCol = 0, e.preventDefault(),
|
|
3805
|
+
return this.grid._focusRow += 1, this.grid._focusCol = 0, e.preventDefault(), _(this.grid), !0;
|
|
3777
3806
|
break;
|
|
3778
3807
|
case "ArrowUp":
|
|
3779
3808
|
if (this.grid._focusCol > 0)
|
|
3780
|
-
return this.grid._focusCol -= 1, e.preventDefault(),
|
|
3809
|
+
return this.grid._focusCol -= 1, e.preventDefault(), _(this.grid), !0;
|
|
3781
3810
|
if (this.grid._focusRow > 0)
|
|
3782
|
-
return this.grid._focusRow -= 1, this.grid._focusCol = i, e.preventDefault(),
|
|
3811
|
+
return this.grid._focusRow -= 1, this.grid._focusCol = i, e.preventDefault(), _(this.grid), !0;
|
|
3783
3812
|
break;
|
|
3784
3813
|
case "ArrowRight":
|
|
3785
3814
|
if (this.grid._focusRow < t)
|
|
3786
|
-
return this.grid._focusRow += 1, e.preventDefault(),
|
|
3815
|
+
return this.grid._focusRow += 1, e.preventDefault(), _(this.grid), !0;
|
|
3787
3816
|
break;
|
|
3788
3817
|
case "ArrowLeft":
|
|
3789
3818
|
if (this.grid._focusRow > 0)
|
|
3790
|
-
return this.grid._focusRow -= 1, e.preventDefault(),
|
|
3819
|
+
return this.grid._focusRow -= 1, e.preventDefault(), _(this.grid), !0;
|
|
3791
3820
|
break;
|
|
3792
3821
|
}
|
|
3793
3822
|
return !1;
|
|
3794
3823
|
}
|
|
3795
|
-
#g;
|
|
3796
3824
|
#f;
|
|
3825
|
+
#g;
|
|
3797
3826
|
#m;
|
|
3798
3827
|
#v() {
|
|
3799
|
-
if (this.#
|
|
3800
|
-
return this.#
|
|
3828
|
+
if (this.#f && this.#f > 0)
|
|
3829
|
+
return this.#f;
|
|
3801
3830
|
const e = this.config.cardRowHeight;
|
|
3802
3831
|
return typeof e == "number" && e > 0 ? e : 80;
|
|
3803
3832
|
}
|
|
3804
3833
|
#y() {
|
|
3805
|
-
return this.#
|
|
3834
|
+
return this.#g && this.#g > 0 ? this.#g : this.#a ?? 28;
|
|
3806
3835
|
}
|
|
3807
3836
|
#w() {
|
|
3808
3837
|
for (const e of this.rows)
|
|
@@ -3810,7 +3839,7 @@ class rn extends R {
|
|
|
3810
3839
|
return !0;
|
|
3811
3840
|
return !1;
|
|
3812
3841
|
}
|
|
3813
|
-
#
|
|
3842
|
+
#C() {
|
|
3814
3843
|
let e = 0, t = 0;
|
|
3815
3844
|
for (const i of this.rows)
|
|
3816
3845
|
i.__isGroupRow ? e++ : t++;
|
|
@@ -3819,7 +3848,7 @@ class rn extends R {
|
|
|
3819
3848
|
getExtraHeight() {
|
|
3820
3849
|
if (!this.#t || !this.config.cardRenderer || !this.#w())
|
|
3821
3850
|
return 0;
|
|
3822
|
-
const e = this.#a ?? 28, t = this.#y(), i = this.#v(), { groupCount: n, cardCount: r } = this.#
|
|
3851
|
+
const e = this.#a ?? 28, t = this.#y(), i = this.#v(), { groupCount: n, cardCount: r } = this.#C(), o = n * Math.max(0, t - e), a = r * Math.max(0, i - e);
|
|
3823
3852
|
return o + a;
|
|
3824
3853
|
}
|
|
3825
3854
|
getExtraHeightBefore(e) {
|
|
@@ -3832,7 +3861,7 @@ class rn extends R {
|
|
|
3832
3861
|
d[u].__isGroupRow ? a++ : l++;
|
|
3833
3862
|
return a * r + l * o;
|
|
3834
3863
|
}
|
|
3835
|
-
#
|
|
3864
|
+
#x() {
|
|
3836
3865
|
let e = 0;
|
|
3837
3866
|
for (const t of this.rows)
|
|
3838
3867
|
t.__isGroupRow || e++;
|
|
@@ -3843,28 +3872,28 @@ class rn extends R {
|
|
|
3843
3872
|
if (!this.#t || !this.config.cardRenderer)
|
|
3844
3873
|
return;
|
|
3845
3874
|
let e = !1;
|
|
3846
|
-
const t = this.grid, i = this.#w(), n = this.#
|
|
3875
|
+
const t = this.grid, i = this.#w(), n = this.#x();
|
|
3847
3876
|
if (n !== this.#m && (this.#m = n, e = !0), i) {
|
|
3848
3877
|
const o = this.gridElement.querySelector(".data-grid-row.group-row");
|
|
3849
3878
|
if (o) {
|
|
3850
3879
|
const a = o.getBoundingClientRect().height;
|
|
3851
|
-
a > 0 && a !== this.#
|
|
3880
|
+
a > 0 && a !== this.#g && (this.#g = a, e = !0);
|
|
3852
3881
|
}
|
|
3853
3882
|
}
|
|
3854
3883
|
const r = this.gridElement.querySelector(".data-grid-row.responsive-card");
|
|
3855
3884
|
if (r) {
|
|
3856
3885
|
const o = r.getBoundingClientRect().height;
|
|
3857
|
-
o > 0 && o !== this.#
|
|
3886
|
+
o > 0 && o !== this.#f && (this.#f = o, e = !0, !i && t._virtualization && (t._virtualization.rowHeight = o));
|
|
3858
3887
|
}
|
|
3859
3888
|
e && !this.#b && (this.#b = !0, queueMicrotask(() => {
|
|
3860
3889
|
this.#b = !1, this.grid && this.#t && this.grid.refreshVirtualWindow?.(!0, !0);
|
|
3861
3890
|
}));
|
|
3862
3891
|
}
|
|
3863
3892
|
}
|
|
3864
|
-
const
|
|
3865
|
-
class
|
|
3893
|
+
const Si = '.dg-row-drag-handle{display:flex;align-items:center;justify-content:center;cursor:grab;user-select:none;color:var(--tbw-color-fg-muted, #999);transition:color .15s ease;font-size:14px;letter-spacing:-2px;&:hover{color:var(--tbw-color-fg, #333)}&:active{cursor:grabbing}}.data-grid-row.dragging{opacity:.6}.data-grid-row.drop-target{position:relative;&.drop-before:before{content:"";position:absolute;top:0;left:0;right:0;height:2px;background-color:var(--tbw-color-accent, #1976d2);z-index:10}&.drop-after:after{content:"";position:absolute;bottom:0;left:0;right:0;height:2px;background-color:var(--tbw-color-accent, #1976d2);z-index:10}}.data-grid-row.keyboard-moving{background-color:var(--tbw-color-bg-selected, #e3f2fd);box-shadow:0 0 0 1px var(--tbw-color-accent, #1976d2) inset}.data-grid-row.animate-flip{transition:transform var(--tbw-animation-duration, .2s) ease-out}', ki = "__tbw_row_drag";
|
|
3894
|
+
class an extends R {
|
|
3866
3895
|
name = "rowReorder";
|
|
3867
|
-
styles =
|
|
3896
|
+
styles = Si;
|
|
3868
3897
|
get defaultConfig() {
|
|
3869
3898
|
return {
|
|
3870
3899
|
enableKeyboard: !0,
|
|
@@ -3888,7 +3917,7 @@ class on extends R {
|
|
|
3888
3917
|
if (!this.config.showDragHandle)
|
|
3889
3918
|
return [...e];
|
|
3890
3919
|
const t = {
|
|
3891
|
-
field:
|
|
3920
|
+
field: ki,
|
|
3892
3921
|
header: "",
|
|
3893
3922
|
width: this.config.dragHandleWidth ?? 40,
|
|
3894
3923
|
resizable: !1,
|
|
@@ -3982,7 +4011,7 @@ class on extends R {
|
|
|
3982
4011
|
row: e
|
|
3983
4012
|
}, this.lastFocusCol = r;
|
|
3984
4013
|
const o = this.grid, a = [...o._rows ?? this.sourceRows], [l] = a.splice(t, 1);
|
|
3985
|
-
a.splice(i, 0, l), o._rows = a, o._focusRow = i, o._focusCol = r, o.refreshVirtualWindow(!0),
|
|
4014
|
+
a.splice(i, 0, l), o._rows = a, o._focusRow = i, o._focusCol = r, o.refreshVirtualWindow(!0), _(o), this.clearDebounceTimer(), this.debounceTimer = setTimeout(() => {
|
|
3986
4015
|
this.flushPendingMove();
|
|
3987
4016
|
}, this.config.debounceMs ?? 300);
|
|
3988
4017
|
}
|
|
@@ -4001,7 +4030,7 @@ class on extends R {
|
|
|
4001
4030
|
const o = [...this.sourceRows], [a] = o.splice(t, 1);
|
|
4002
4031
|
o.splice(e, 0, a);
|
|
4003
4032
|
const l = this.grid;
|
|
4004
|
-
l._rows = o, l._focusRow = e, l._focusCol = this.lastFocusCol, l.refreshVirtualWindow(!0),
|
|
4033
|
+
l._rows = o, l._focusRow = e, l._focusCol = this.lastFocusCol, l.refreshVirtualWindow(!0), _(l);
|
|
4005
4034
|
}
|
|
4006
4035
|
}
|
|
4007
4036
|
executeMove(e, t, i, n) {
|
|
@@ -4037,34 +4066,34 @@ function V(s) {
|
|
|
4037
4066
|
endCol: Math.max(s.startCol, s.endCol)
|
|
4038
4067
|
};
|
|
4039
4068
|
}
|
|
4040
|
-
function
|
|
4069
|
+
function Ai(s) {
|
|
4041
4070
|
const e = V(s);
|
|
4042
4071
|
return {
|
|
4043
4072
|
from: { row: e.startRow, col: e.startCol },
|
|
4044
4073
|
to: { row: e.endRow, col: e.endCol }
|
|
4045
4074
|
};
|
|
4046
4075
|
}
|
|
4047
|
-
function
|
|
4048
|
-
return s.map(
|
|
4076
|
+
function $e(s) {
|
|
4077
|
+
return s.map(Ai);
|
|
4049
4078
|
}
|
|
4050
|
-
function
|
|
4079
|
+
function _i(s, e, t) {
|
|
4051
4080
|
const i = V(t);
|
|
4052
4081
|
return s >= i.startRow && s <= i.endRow && e >= i.startCol && e <= i.endCol;
|
|
4053
4082
|
}
|
|
4054
|
-
function
|
|
4055
|
-
return t.some((i) =>
|
|
4083
|
+
function qe(s, e, t) {
|
|
4084
|
+
return t.some((i) => _i(s, e, i));
|
|
4056
4085
|
}
|
|
4057
|
-
function
|
|
4086
|
+
function Li(s) {
|
|
4058
4087
|
const e = [], t = V(s);
|
|
4059
4088
|
for (let i = t.startRow; i <= t.endRow; i++)
|
|
4060
4089
|
for (let n = t.startCol; n <= t.endCol; n++)
|
|
4061
4090
|
e.push({ row: i, col: n });
|
|
4062
4091
|
return e;
|
|
4063
4092
|
}
|
|
4064
|
-
function
|
|
4093
|
+
function Ti(s) {
|
|
4065
4094
|
const e = /* @__PURE__ */ new Map();
|
|
4066
4095
|
for (const t of s)
|
|
4067
|
-
for (const i of
|
|
4096
|
+
for (const i of Li(t))
|
|
4068
4097
|
e.set(`${i.row},${i.col}`, i);
|
|
4069
4098
|
return [...e.values()];
|
|
4070
4099
|
}
|
|
@@ -4076,8 +4105,8 @@ function Q(s, e) {
|
|
|
4076
4105
|
endCol: e.col
|
|
4077
4106
|
};
|
|
4078
4107
|
}
|
|
4079
|
-
const
|
|
4080
|
-
function
|
|
4108
|
+
const Ii = "@layer tbw-plugins{tbw-grid{&.selecting .data-grid-row>.cell{user-select:none}&[data-has-focus] .data-grid-row.row-focus{background-color:var(--tbw-focus-background, rgba(from var(--tbw-color-accent) r g b / 12%))}&[data-selection-mode=row] .cell-focus{outline:none}.data-grid-row>.cell.selected{background-color:var(--tbw-range-selection-bg);&.top{border-top:2px solid var(--tbw-range-border-color)}&.bottom{border-bottom:2px solid var(--tbw-range-border-color)}&.first{border-left:2px solid var(--tbw-range-border-color)}&.last{border-right:2px solid var(--tbw-range-border-color)}}.data-grid-row[data-selectable=false]{cursor:not-allowed;opacity:.6;&.row-focus{background-color:var(--tbw-color-row-alt)}}.data-grid-row>.cell[data-selectable=false]{cursor:not-allowed;opacity:.6;&.selected{background-color:var(--tbw-color-warning-bg, rgba(255, 243, 205, .5))}}.tbw-selection-summary{font-size:var(--tbw-font-size-sm, .8125rem);color:var(--tbw-color-fg-muted);white-space:nowrap}}}";
|
|
4109
|
+
function Fi(s, e, t) {
|
|
4081
4110
|
if (s === "cell" && e.selectedCell)
|
|
4082
4111
|
return {
|
|
4083
4112
|
mode: s,
|
|
@@ -4095,9 +4124,9 @@ function Ti(s, e, t) {
|
|
|
4095
4124
|
}));
|
|
4096
4125
|
return { mode: s, ranges: i };
|
|
4097
4126
|
}
|
|
4098
|
-
return s === "range" && e.ranges.length > 0 ? { mode: s, ranges:
|
|
4127
|
+
return s === "range" && e.ranges.length > 0 ? { mode: s, ranges: $e(e.ranges) } : { mode: s, ranges: [] };
|
|
4099
4128
|
}
|
|
4100
|
-
class
|
|
4129
|
+
class ln extends R {
|
|
4101
4130
|
static manifest = {
|
|
4102
4131
|
configRules: [
|
|
4103
4132
|
{
|
|
@@ -4111,7 +4140,7 @@ class sn extends R {
|
|
|
4111
4140
|
]
|
|
4112
4141
|
};
|
|
4113
4142
|
name = "selection";
|
|
4114
|
-
styles =
|
|
4143
|
+
styles = Ii;
|
|
4115
4144
|
get defaultConfig() {
|
|
4116
4145
|
return {
|
|
4117
4146
|
mode: "cell",
|
|
@@ -4127,6 +4156,20 @@ class sn extends R {
|
|
|
4127
4156
|
isDragging = !1;
|
|
4128
4157
|
pendingKeyboardUpdate = null;
|
|
4129
4158
|
selectedCell = null;
|
|
4159
|
+
checkSelectable(e, t) {
|
|
4160
|
+
const { isSelectable: i } = this.config;
|
|
4161
|
+
if (!i) return !0;
|
|
4162
|
+
const n = this.rows[e];
|
|
4163
|
+
if (!n) return !1;
|
|
4164
|
+
const r = t !== void 0 ? this.columns[t] : void 0;
|
|
4165
|
+
return i(n, e, r, t);
|
|
4166
|
+
}
|
|
4167
|
+
isRowSelectable(e) {
|
|
4168
|
+
return this.checkSelectable(e);
|
|
4169
|
+
}
|
|
4170
|
+
isCellSelectable(e, t) {
|
|
4171
|
+
return this.checkSelectable(e, t);
|
|
4172
|
+
}
|
|
4130
4173
|
detach() {
|
|
4131
4174
|
this.selected.clear(), this.ranges = [], this.activeRange = null, this.cellAnchor = null, this.isDragging = !1, this.selectedCell = null, this.pendingKeyboardUpdate = null;
|
|
4132
4175
|
}
|
|
@@ -4136,11 +4179,11 @@ class sn extends R {
|
|
|
4136
4179
|
return !1;
|
|
4137
4180
|
const a = this.columns[i], l = a && I(a);
|
|
4138
4181
|
if (r === "cell")
|
|
4139
|
-
return l || (this.selectedCell = { row: t, col: i }, this.emit("selection-change", this.#t()), this.requestAfterRender()), !1;
|
|
4182
|
+
return l || !this.isCellSelectable(t, i) || (this.selectedCell = { row: t, col: i }, this.emit("selection-change", this.#t()), this.requestAfterRender()), !1;
|
|
4140
4183
|
if (r === "row")
|
|
4141
|
-
return this.selected.clear(), this.selected.add(t), this.lastSelected = t, this.emit("selection-change", this.#t()), this.requestAfterRender(), !1;
|
|
4184
|
+
return this.isRowSelectable(t) && (this.selected.clear(), this.selected.add(t), this.lastSelected = t, this.emit("selection-change", this.#t()), this.requestAfterRender()), !1;
|
|
4142
4185
|
if (r === "range") {
|
|
4143
|
-
if (l)
|
|
4186
|
+
if (l || !this.isCellSelectable(t, i))
|
|
4144
4187
|
return !1;
|
|
4145
4188
|
const d = n.shiftKey, c = n.ctrlKey || n.metaKey;
|
|
4146
4189
|
if (d && this.cellAnchor) {
|
|
@@ -4173,11 +4216,13 @@ class sn extends R {
|
|
|
4173
4216
|
return t === "cell" ? this.selectedCell = null : t === "row" ? (this.selected.clear(), this.anchor = null) : t === "range" && (this.ranges = [], this.activeRange = null, this.cellAnchor = null), this.emit("selection-change", this.#t()), this.requestAfterRender(), !0;
|
|
4174
4217
|
if (t === "cell" && n)
|
|
4175
4218
|
return queueMicrotask(() => {
|
|
4176
|
-
|
|
4219
|
+
const r = this.grid._focusRow, o = this.grid._focusCol;
|
|
4220
|
+
this.isCellSelectable(r, o) ? this.selectedCell = { row: r, col: o } : this.selectedCell = null, this.emit("selection-change", this.#t()), this.requestAfterRender();
|
|
4177
4221
|
}), !1;
|
|
4178
4222
|
if (t === "row" && (e.key === "ArrowUp" || e.key === "ArrowDown"))
|
|
4179
4223
|
return queueMicrotask(() => {
|
|
4180
|
-
|
|
4224
|
+
const r = this.grid._focusRow;
|
|
4225
|
+
this.isRowSelectable(r) ? (this.selected.clear(), this.selected.add(r), this.lastSelected = r) : this.selected.clear(), this.emit("selection-change", this.#t()), this.requestAfterRender();
|
|
4181
4226
|
}), !1;
|
|
4182
4227
|
if (t === "range" && n) {
|
|
4183
4228
|
const r = e.key === "Tab", o = e.shiftKey && !r;
|
|
@@ -4200,7 +4245,7 @@ class sn extends R {
|
|
|
4200
4245
|
onCellMouseDown(e) {
|
|
4201
4246
|
if (this.config.mode !== "range" || e.rowIndex === void 0 || e.colIndex === void 0 || e.rowIndex < 0) return;
|
|
4202
4247
|
const t = this.columns[e.colIndex];
|
|
4203
|
-
if (t && I(t) || e.originalEvent.shiftKey && this.cellAnchor)
|
|
4248
|
+
if (t && I(t) || !this.isCellSelectable(e.rowIndex, e.colIndex) || e.originalEvent.shiftKey && this.cellAnchor)
|
|
4204
4249
|
return;
|
|
4205
4250
|
this.isDragging = !0;
|
|
4206
4251
|
const i = e.rowIndex, n = e.colIndex;
|
|
@@ -4231,29 +4276,32 @@ class sn extends R {
|
|
|
4231
4276
|
#e() {
|
|
4232
4277
|
const e = this.gridElement;
|
|
4233
4278
|
if (!e) return;
|
|
4234
|
-
const { mode: t } = this.config;
|
|
4235
|
-
e.querySelectorAll(".cell").forEach((
|
|
4236
|
-
|
|
4279
|
+
const { mode: t } = this.config, i = !!this.config.isSelectable;
|
|
4280
|
+
e.querySelectorAll(".cell").forEach((o) => {
|
|
4281
|
+
o.classList.remove("selected", "top", "bottom", "first", "last"), i && o.removeAttribute("data-selectable");
|
|
4237
4282
|
});
|
|
4238
|
-
const
|
|
4239
|
-
if (
|
|
4240
|
-
|
|
4241
|
-
}), t === "row" && (
|
|
4242
|
-
const
|
|
4243
|
-
|
|
4244
|
-
})), t === "range" &&
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4283
|
+
const r = e.querySelectorAll(".data-grid-row");
|
|
4284
|
+
if (r.forEach((o) => {
|
|
4285
|
+
o.classList.remove("selected", "row-focus"), i && o.removeAttribute("data-selectable");
|
|
4286
|
+
}), t === "row" && (he(e), r.forEach((o) => {
|
|
4287
|
+
const a = o.querySelector(".cell[data-row]"), l = et(a);
|
|
4288
|
+
l >= 0 && (i && !this.isRowSelectable(l) && o.setAttribute("data-selectable", "false"), this.selected.has(l) && o.classList.add("selected", "row-focus"));
|
|
4289
|
+
})), (t === "cell" || t === "range") && i && e.querySelectorAll(".cell[data-row][data-col]").forEach((a) => {
|
|
4290
|
+
const l = parseInt(a.getAttribute("data-row") ?? "-1", 10), d = parseInt(a.getAttribute("data-col") ?? "-1", 10);
|
|
4291
|
+
l >= 0 && d >= 0 && (this.isCellSelectable(l, d) || a.setAttribute("data-selectable", "false"));
|
|
4292
|
+
}), t === "range" && this.ranges.length > 0) {
|
|
4293
|
+
he(e);
|
|
4294
|
+
const o = this.activeRange ? V(this.activeRange) : null, a = this.columns.findIndex((d) => !I(d));
|
|
4295
|
+
this.columns.length - 1, e.querySelectorAll(".cell[data-row][data-col]").forEach((d) => {
|
|
4296
|
+
const c = parseInt(d.getAttribute("data-row") ?? "-1", 10), u = parseInt(d.getAttribute("data-col") ?? "-1", 10);
|
|
4297
|
+
if (c >= 0 && u >= 0) {
|
|
4298
|
+
const h = this.columns[u];
|
|
4299
|
+
if (h && I(h))
|
|
4252
4300
|
return;
|
|
4253
|
-
if (
|
|
4254
|
-
|
|
4255
|
-
const g = Math.max(
|
|
4256
|
-
|
|
4301
|
+
if (qe(c, u, this.ranges) && (d.classList.add("selected"), o)) {
|
|
4302
|
+
c === o.startRow && d.classList.add("top"), c === o.endRow && d.classList.add("bottom");
|
|
4303
|
+
const g = Math.max(o.startCol, a);
|
|
4304
|
+
u === g && d.classList.add("first"), u === o.endCol && d.classList.add("last");
|
|
4257
4305
|
}
|
|
4258
4306
|
}
|
|
4259
4307
|
});
|
|
@@ -4286,10 +4334,10 @@ class sn extends R {
|
|
|
4286
4334
|
};
|
|
4287
4335
|
}
|
|
4288
4336
|
getSelectedCells() {
|
|
4289
|
-
return
|
|
4337
|
+
return Ti(this.ranges);
|
|
4290
4338
|
}
|
|
4291
4339
|
isCellSelected(e, t) {
|
|
4292
|
-
return
|
|
4340
|
+
return qe(e, t, this.ranges);
|
|
4293
4341
|
}
|
|
4294
4342
|
clearSelection() {
|
|
4295
4343
|
this.selectedCell = null, this.selected.clear(), this.anchor = null, this.ranges = [], this.activeRange = null, this.cellAnchor = null, this.emit("selection-change", { mode: this.config.mode, ranges: [] }), this.requestAfterRender();
|
|
@@ -4302,11 +4350,11 @@ class sn extends R {
|
|
|
4302
4350
|
endCol: t.to.col
|
|
4303
4351
|
})), this.activeRange = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null, this.emit("selection-change", {
|
|
4304
4352
|
mode: this.config.mode,
|
|
4305
|
-
ranges:
|
|
4353
|
+
ranges: $e(this.ranges)
|
|
4306
4354
|
}), this.requestAfterRender();
|
|
4307
4355
|
}
|
|
4308
4356
|
#t() {
|
|
4309
|
-
return
|
|
4357
|
+
return Fi(
|
|
4310
4358
|
this.config.mode,
|
|
4311
4359
|
{
|
|
4312
4360
|
selectedCell: this.selectedCell,
|
|
@@ -4320,20 +4368,20 @@ class sn extends R {
|
|
|
4320
4368
|
function B(s, e) {
|
|
4321
4369
|
return Math.floor(s / e);
|
|
4322
4370
|
}
|
|
4323
|
-
function
|
|
4371
|
+
function Di(s, e) {
|
|
4324
4372
|
return {
|
|
4325
4373
|
start: s * e,
|
|
4326
4374
|
end: (s + 1) * e
|
|
4327
4375
|
};
|
|
4328
4376
|
}
|
|
4329
|
-
function
|
|
4377
|
+
function Pi(s, e, t) {
|
|
4330
4378
|
const i = B(s, t), n = B(e - 1, t), r = [];
|
|
4331
4379
|
for (let o = i; o <= n; o++)
|
|
4332
4380
|
r.push(o);
|
|
4333
4381
|
return r;
|
|
4334
4382
|
}
|
|
4335
|
-
async function
|
|
4336
|
-
const n =
|
|
4383
|
+
async function Ke(s, e, t, i) {
|
|
4384
|
+
const n = Di(e, t);
|
|
4337
4385
|
return s.getRows({
|
|
4338
4386
|
startRow: n.start,
|
|
4339
4387
|
endRow: n.end,
|
|
@@ -4341,14 +4389,14 @@ async function qe(s, e, t, i) {
|
|
|
4341
4389
|
filterModel: i.filterModel
|
|
4342
4390
|
});
|
|
4343
4391
|
}
|
|
4344
|
-
function
|
|
4392
|
+
function Mi(s, e, t) {
|
|
4345
4393
|
const i = B(s, e), n = t.get(i);
|
|
4346
4394
|
if (!n) return;
|
|
4347
4395
|
const r = s % e;
|
|
4348
4396
|
return n[r];
|
|
4349
4397
|
}
|
|
4350
|
-
const
|
|
4351
|
-
class
|
|
4398
|
+
const qi = 100;
|
|
4399
|
+
class dn extends R {
|
|
4352
4400
|
name = "serverSide";
|
|
4353
4401
|
get defaultConfig() {
|
|
4354
4402
|
return {
|
|
@@ -4368,12 +4416,12 @@ class an extends R {
|
|
|
4368
4416
|
}
|
|
4369
4417
|
loadRequiredBlocks() {
|
|
4370
4418
|
if (!this.dataSource) return;
|
|
4371
|
-
const e = this.grid, t = this.config.cacheBlockSize ?? 100, i = { startRow: e._virtualization.start, endRow: e._virtualization.end }, n =
|
|
4419
|
+
const e = this.grid, t = this.config.cacheBlockSize ?? 100, i = { startRow: e._virtualization.start, endRow: e._virtualization.end }, n = Pi(i.startRow, i.endRow, t);
|
|
4372
4420
|
for (const r of n)
|
|
4373
4421
|
if (!(this.loadedBlocks.has(r) || this.loadingBlocks.has(r))) {
|
|
4374
4422
|
if (this.loadingBlocks.size >= (this.config.maxConcurrentRequests ?? 2))
|
|
4375
4423
|
break;
|
|
4376
|
-
this.loadingBlocks.add(r),
|
|
4424
|
+
this.loadingBlocks.add(r), Ke(this.dataSource, r, t, {}).then((o) => {
|
|
4377
4425
|
this.loadedBlocks.set(r, o.rows), this.totalRowCount = o.totalRowCount, this.loadingBlocks.delete(r), this.requestRender(), this.loadRequiredBlocks();
|
|
4378
4426
|
}).catch(() => {
|
|
4379
4427
|
this.loadingBlocks.delete(r);
|
|
@@ -4384,7 +4432,7 @@ class an extends R {
|
|
|
4384
4432
|
if (!this.dataSource) return [...e];
|
|
4385
4433
|
const t = [];
|
|
4386
4434
|
for (let i = 0; i < this.totalRowCount; i++) {
|
|
4387
|
-
const n =
|
|
4435
|
+
const n = Mi(i, this.config.cacheBlockSize ?? 100, this.loadedBlocks);
|
|
4388
4436
|
t.push(n ?? { __loading: !0, __index: i });
|
|
4389
4437
|
}
|
|
4390
4438
|
return t;
|
|
@@ -4392,12 +4440,12 @@ class an extends R {
|
|
|
4392
4440
|
onScroll(e) {
|
|
4393
4441
|
this.dataSource && (this.loadRequiredBlocks(), this.scrollDebounceTimer && clearTimeout(this.scrollDebounceTimer), this.scrollDebounceTimer = setTimeout(() => {
|
|
4394
4442
|
this.loadRequiredBlocks();
|
|
4395
|
-
},
|
|
4443
|
+
}, qi));
|
|
4396
4444
|
}
|
|
4397
4445
|
setDataSource(e) {
|
|
4398
4446
|
this.dataSource = e, this.loadedBlocks.clear(), this.loadingBlocks.clear();
|
|
4399
4447
|
const t = this.config.cacheBlockSize ?? 100;
|
|
4400
|
-
|
|
4448
|
+
Ke(e, 0, t, {}).then((i) => {
|
|
4401
4449
|
this.loadedBlocks.set(0, i.rows), this.totalRowCount = i.totalRowCount, this.requestRender();
|
|
4402
4450
|
});
|
|
4403
4451
|
}
|
|
@@ -4418,7 +4466,7 @@ class an extends R {
|
|
|
4418
4466
|
return this.loadedBlocks.size;
|
|
4419
4467
|
}
|
|
4420
4468
|
}
|
|
4421
|
-
function
|
|
4469
|
+
function je(s, e, t) {
|
|
4422
4470
|
return s.id !== void 0 ? String(s.id) : t ? `${t}-${e}` : String(e);
|
|
4423
4471
|
}
|
|
4424
4472
|
function ee(s, e) {
|
|
@@ -4428,7 +4476,7 @@ function ee(s, e) {
|
|
|
4428
4476
|
function ne(s, e, t = null, i = 0) {
|
|
4429
4477
|
const n = e.childrenField ?? "children", r = /* @__PURE__ */ new Set();
|
|
4430
4478
|
for (let o = 0; o < s.length; o++) {
|
|
4431
|
-
const a = s[o], l =
|
|
4479
|
+
const a = s[o], l = je(a, o, t), d = a[n];
|
|
4432
4480
|
if (Array.isArray(d) && d.length > 0) {
|
|
4433
4481
|
r.add(l);
|
|
4434
4482
|
const c = ne(d, e, l, i + 1);
|
|
@@ -4437,33 +4485,33 @@ function ne(s, e, t = null, i = 0) {
|
|
|
4437
4485
|
}
|
|
4438
4486
|
return r;
|
|
4439
4487
|
}
|
|
4440
|
-
function
|
|
4488
|
+
function Ki() {
|
|
4441
4489
|
return /* @__PURE__ */ new Set();
|
|
4442
4490
|
}
|
|
4443
|
-
function
|
|
4491
|
+
function Ue(s, e, t, i = null, n = 0) {
|
|
4444
4492
|
const r = t.childrenField ?? "children";
|
|
4445
4493
|
for (let o = 0; o < s.length; o++) {
|
|
4446
|
-
const a = s[o], l =
|
|
4494
|
+
const a = s[o], l = je(a, o, i);
|
|
4447
4495
|
if (l === e)
|
|
4448
4496
|
return [l];
|
|
4449
4497
|
const d = a[r];
|
|
4450
4498
|
if (Array.isArray(d) && d.length > 0) {
|
|
4451
|
-
const c =
|
|
4499
|
+
const c = Ue(d, e, t, l, n + 1);
|
|
4452
4500
|
if (c)
|
|
4453
4501
|
return [l, ...c];
|
|
4454
4502
|
}
|
|
4455
4503
|
}
|
|
4456
4504
|
return null;
|
|
4457
4505
|
}
|
|
4458
|
-
function
|
|
4459
|
-
const n =
|
|
4506
|
+
function Hi(s, e, t, i) {
|
|
4507
|
+
const n = Ue(s, e, t);
|
|
4460
4508
|
if (!n) return i;
|
|
4461
4509
|
const r = new Set(i);
|
|
4462
4510
|
for (let o = 0; o < n.length - 1; o++)
|
|
4463
4511
|
r.add(n[o]);
|
|
4464
4512
|
return r;
|
|
4465
4513
|
}
|
|
4466
|
-
function
|
|
4514
|
+
function He(s, e = "children") {
|
|
4467
4515
|
if (!Array.isArray(s) || s.length === 0) return !1;
|
|
4468
4516
|
for (const t of s) {
|
|
4469
4517
|
if (!t) continue;
|
|
@@ -4473,7 +4521,7 @@ function Ke(s, e = "children") {
|
|
|
4473
4521
|
}
|
|
4474
4522
|
return !1;
|
|
4475
4523
|
}
|
|
4476
|
-
function
|
|
4524
|
+
function Ni(s) {
|
|
4477
4525
|
if (!Array.isArray(s) || s.length === 0) return null;
|
|
4478
4526
|
const e = ["children", "items", "nodes", "subRows", "nested"];
|
|
4479
4527
|
for (const t of s)
|
|
@@ -4485,10 +4533,10 @@ function Ki(s) {
|
|
|
4485
4533
|
}
|
|
4486
4534
|
return null;
|
|
4487
4535
|
}
|
|
4488
|
-
const
|
|
4489
|
-
class
|
|
4536
|
+
const zi = "@layer tbw-plugins{tbw-grid{.cell[data-field=__tbw_expander]{border-right:none!important;padding:0;display:flex;align-items:center;justify-content:flex-start}.header-row .cell[data-field=__tbw_expander]{display:none}.header-row .cell[data-field=__tbw_expander]+.cell{grid-column:1 / 3}.tree-cell-wrapper{display:inline-flex;align-items:center;padding-left:calc(var(--tbw-tree-depth, 0) * var(--tbw-tree-indent-width, var(--tbw-tree-toggle-size, 1.25em)))}.tree-expander{display:flex;align-items:center;justify-content:flex-start;width:100%;height:100%;box-sizing:border-box}.tree-toggle{cursor:pointer;user-select:none;display:inline-flex;align-items:center;justify-content:center;width:var(--tbw-tree-toggle-size, 1.25em);height:var(--tbw-tree-toggle-size, 1.25em);flex-shrink:0}.tree-toggle:hover{color:var(--tbw-tree-accent, var(--tbw-color-accent))}.tree-spacer{width:var(--tbw-tree-toggle-size, 1.25em);display:inline-block;flex-shrink:0}.data-grid-row.tbw-tree-slide-in{animation:tbw-tree-slide-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}.data-grid-row.tbw-tree-fade-in{animation:tbw-tree-fade-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}}@keyframes tbw-tree-slide-in{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}@keyframes tbw-tree-fade-in{0%{opacity:0}to{opacity:1}}}";
|
|
4537
|
+
class cn extends R {
|
|
4490
4538
|
name = "tree";
|
|
4491
|
-
styles =
|
|
4539
|
+
styles = zi;
|
|
4492
4540
|
get defaultConfig() {
|
|
4493
4541
|
return {
|
|
4494
4542
|
childrenField: "children",
|
|
@@ -4514,12 +4562,12 @@ class ln extends R {
|
|
|
4514
4562
|
}
|
|
4515
4563
|
detect(e) {
|
|
4516
4564
|
if (!this.config.autoDetect) return !1;
|
|
4517
|
-
const t = e, i = this.config.childrenField ??
|
|
4518
|
-
return
|
|
4565
|
+
const t = e, i = this.config.childrenField ?? Ni(t) ?? "children";
|
|
4566
|
+
return He(t, i);
|
|
4519
4567
|
}
|
|
4520
4568
|
processRows(e) {
|
|
4521
4569
|
const t = this.config.childrenField ?? "children", i = e;
|
|
4522
|
-
if (!
|
|
4570
|
+
if (!He(i, t))
|
|
4523
4571
|
return this.flattenedRows = [], this.rowKeyMap.clear(), this.previousVisibleKeys.clear(), [...e];
|
|
4524
4572
|
let n = this.withStableKeys(i);
|
|
4525
4573
|
this.sortState && (n = this.sortTree(n, this.sortState.field, this.sortState.direction)), this.config.defaultExpanded && !this.initialExpansionDone && (this.expandedKeys = ne(n, this.config), this.initialExpansionDone = !0), this.flattenedRows = this.flattenTree(n, this.expandedKeys), this.rowKeyMap.clear(), this.keysToAnimate.clear();
|
|
@@ -4575,11 +4623,11 @@ class ln extends R {
|
|
|
4575
4623
|
const t = [...e];
|
|
4576
4624
|
if (t.length === 0) return t;
|
|
4577
4625
|
const i = t[0], n = i.viewRenderer, r = () => this.config, o = this.setIcon.bind(this), a = this.resolveIcon.bind(this), l = (d) => {
|
|
4578
|
-
const { row: c, value: u } = d, { showExpandIcons: h = !0, indentWidth:
|
|
4579
|
-
if (m.className = "tree-cell-wrapper", m.style.setProperty("--tbw-tree-depth", String(p)),
|
|
4580
|
-
if (
|
|
4626
|
+
const { row: c, value: u } = d, { showExpandIcons: h = !0, indentWidth: f } = r(), g = c, p = g.__treeDepth ?? 0, m = document.createElement("span");
|
|
4627
|
+
if (m.className = "tree-cell-wrapper", m.style.setProperty("--tbw-tree-depth", String(p)), f !== void 0 && m.style.setProperty("--tbw-tree-indent-width", `${f}px`), h)
|
|
4628
|
+
if (g.__treeHasChildren) {
|
|
4581
4629
|
const b = document.createElement("span");
|
|
4582
|
-
b.className = `tree-toggle${
|
|
4630
|
+
b.className = `tree-toggle${g.__treeExpanded ? " expanded" : ""}`, o(b, a(g.__treeExpanded ? "collapse" : "expand")), b.setAttribute("data-tree-key", String(g.__treeKey ?? "")), m.appendChild(b);
|
|
4583
4631
|
} else {
|
|
4584
4632
|
const b = document.createElement("span");
|
|
4585
4633
|
b.className = "tree-spacer", m.appendChild(b);
|
|
@@ -4650,7 +4698,7 @@ class ln extends R {
|
|
|
4650
4698
|
this.expandedKeys = ne(this.rows, this.config), this.requestRender();
|
|
4651
4699
|
}
|
|
4652
4700
|
collapseAll() {
|
|
4653
|
-
this.expandedKeys =
|
|
4701
|
+
this.expandedKeys = Ki(), this.requestRender();
|
|
4654
4702
|
}
|
|
4655
4703
|
isExpanded(e) {
|
|
4656
4704
|
return this.expandedKeys.has(e);
|
|
@@ -4665,10 +4713,10 @@ class ln extends R {
|
|
|
4665
4713
|
return this.rowKeyMap.get(e)?.data;
|
|
4666
4714
|
}
|
|
4667
4715
|
expandToKey(e) {
|
|
4668
|
-
this.expandedKeys =
|
|
4716
|
+
this.expandedKeys = Hi(this.rows, e, this.config, this.expandedKeys), this.requestRender();
|
|
4669
4717
|
}
|
|
4670
4718
|
}
|
|
4671
|
-
function
|
|
4719
|
+
function Gi(s, e, t) {
|
|
4672
4720
|
const i = [...s.undoStack, e];
|
|
4673
4721
|
for (; i.length > t; )
|
|
4674
4722
|
i.shift();
|
|
@@ -4677,7 +4725,7 @@ function Ni(s, e, t) {
|
|
|
4677
4725
|
redoStack: []
|
|
4678
4726
|
};
|
|
4679
4727
|
}
|
|
4680
|
-
function
|
|
4728
|
+
function Ne(s) {
|
|
4681
4729
|
if (s.undoStack.length === 0)
|
|
4682
4730
|
return { newState: s, action: null };
|
|
4683
4731
|
const e = [...s.undoStack], t = e.pop();
|
|
@@ -4689,7 +4737,7 @@ function He(s) {
|
|
|
4689
4737
|
action: t
|
|
4690
4738
|
} : { newState: s, action: null };
|
|
4691
4739
|
}
|
|
4692
|
-
function
|
|
4740
|
+
function ze(s) {
|
|
4693
4741
|
if (s.redoStack.length === 0)
|
|
4694
4742
|
return { newState: s, action: null };
|
|
4695
4743
|
const e = [...s.redoStack], t = e.pop();
|
|
@@ -4701,16 +4749,16 @@ function Ne(s) {
|
|
|
4701
4749
|
action: t
|
|
4702
4750
|
} : { newState: s, action: null };
|
|
4703
4751
|
}
|
|
4704
|
-
function
|
|
4752
|
+
function Oi(s) {
|
|
4705
4753
|
return s.undoStack.length > 0;
|
|
4706
4754
|
}
|
|
4707
|
-
function
|
|
4755
|
+
function Bi(s) {
|
|
4708
4756
|
return s.redoStack.length > 0;
|
|
4709
4757
|
}
|
|
4710
|
-
function
|
|
4758
|
+
function Vi() {
|
|
4711
4759
|
return { undoStack: [], redoStack: [] };
|
|
4712
4760
|
}
|
|
4713
|
-
function
|
|
4761
|
+
function Wi(s, e, t, i) {
|
|
4714
4762
|
return {
|
|
4715
4763
|
type: "cell-edit",
|
|
4716
4764
|
rowIndex: s,
|
|
@@ -4720,7 +4768,7 @@ function Bi(s, e, t, i) {
|
|
|
4720
4768
|
timestamp: Date.now()
|
|
4721
4769
|
};
|
|
4722
4770
|
}
|
|
4723
|
-
class
|
|
4771
|
+
class un extends R {
|
|
4724
4772
|
static dependencies = [
|
|
4725
4773
|
{ name: "editing", required: !0, reason: "UndoRedoPlugin tracks cell edit history" }
|
|
4726
4774
|
];
|
|
@@ -4738,7 +4786,7 @@ class dn extends R {
|
|
|
4738
4786
|
onKeyDown(e) {
|
|
4739
4787
|
const t = (e.ctrlKey || e.metaKey) && e.key === "z" && !e.shiftKey, i = (e.ctrlKey || e.metaKey) && (e.key === "y" || e.key === "z" && e.shiftKey);
|
|
4740
4788
|
if (t) {
|
|
4741
|
-
const n =
|
|
4789
|
+
const n = Ne({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
4742
4790
|
if (n.action) {
|
|
4743
4791
|
const r = this.rows;
|
|
4744
4792
|
r[n.action.rowIndex] && (r[n.action.rowIndex][n.action.field] = n.action.oldValue), this.undoStack = n.newState.undoStack, this.redoStack = n.newState.redoStack, this.emit("undo", {
|
|
@@ -4749,7 +4797,7 @@ class dn extends R {
|
|
|
4749
4797
|
return !0;
|
|
4750
4798
|
}
|
|
4751
4799
|
if (i) {
|
|
4752
|
-
const n =
|
|
4800
|
+
const n = ze({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
4753
4801
|
if (n.action) {
|
|
4754
4802
|
const r = this.rows;
|
|
4755
4803
|
r[n.action.rowIndex] && (r[n.action.rowIndex][n.action.field] = n.action.newValue), this.undoStack = n.newState.undoStack, this.redoStack = n.newState.redoStack, this.emit("redo", {
|
|
@@ -4762,7 +4810,7 @@ class dn extends R {
|
|
|
4762
4810
|
return !1;
|
|
4763
4811
|
}
|
|
4764
4812
|
recordEdit(e, t, i, n) {
|
|
4765
|
-
const r =
|
|
4813
|
+
const r = Wi(e, t, i, n), o = Gi(
|
|
4766
4814
|
{ undoStack: this.undoStack, redoStack: this.redoStack },
|
|
4767
4815
|
r,
|
|
4768
4816
|
this.config.maxHistorySize ?? 100
|
|
@@ -4770,7 +4818,7 @@ class dn extends R {
|
|
|
4770
4818
|
this.undoStack = o.undoStack, this.redoStack = o.redoStack;
|
|
4771
4819
|
}
|
|
4772
4820
|
undo() {
|
|
4773
|
-
const e =
|
|
4821
|
+
const e = Ne({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
4774
4822
|
if (e.action) {
|
|
4775
4823
|
const t = this.rows;
|
|
4776
4824
|
t[e.action.rowIndex] && (t[e.action.rowIndex][e.action.field] = e.action.oldValue), this.undoStack = e.newState.undoStack, this.redoStack = e.newState.redoStack, this.requestRender();
|
|
@@ -4778,7 +4826,7 @@ class dn extends R {
|
|
|
4778
4826
|
return e.action;
|
|
4779
4827
|
}
|
|
4780
4828
|
redo() {
|
|
4781
|
-
const e =
|
|
4829
|
+
const e = ze({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
4782
4830
|
if (e.action) {
|
|
4783
4831
|
const t = this.rows;
|
|
4784
4832
|
t[e.action.rowIndex] && (t[e.action.rowIndex][e.action.field] = e.action.newValue), this.undoStack = e.newState.undoStack, this.redoStack = e.newState.redoStack, this.requestRender();
|
|
@@ -4786,13 +4834,13 @@ class dn extends R {
|
|
|
4786
4834
|
return e.action;
|
|
4787
4835
|
}
|
|
4788
4836
|
canUndo() {
|
|
4789
|
-
return
|
|
4837
|
+
return Oi({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
4790
4838
|
}
|
|
4791
4839
|
canRedo() {
|
|
4792
|
-
return
|
|
4840
|
+
return Bi({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
4793
4841
|
}
|
|
4794
4842
|
clearHistory() {
|
|
4795
|
-
const e =
|
|
4843
|
+
const e = Vi();
|
|
4796
4844
|
this.undoStack = e.undoStack, this.redoStack = e.redoStack;
|
|
4797
4845
|
}
|
|
4798
4846
|
getUndoStack() {
|
|
@@ -4802,18 +4850,18 @@ class dn extends R {
|
|
|
4802
4850
|
return [...this.redoStack];
|
|
4803
4851
|
}
|
|
4804
4852
|
}
|
|
4805
|
-
const
|
|
4806
|
-
function
|
|
4853
|
+
const $i = '@layer tbw-plugins{.tbw-visibility-content{display:flex;flex-direction:column;height:100%}.tbw-visibility-list{flex:1;overflow-y:auto;padding:var(--tbw-panel-padding, var(--tbw-spacing-md, .5rem))}.tbw-visibility-row{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));padding:var(--tbw-menu-item-padding, .375rem .25rem);cursor:pointer;font-size:var(--tbw-font-size-sm, .8125rem);border-radius:var(--tbw-border-radius, .25rem);position:relative}.tbw-visibility-row:hover{background:var(--tbw-visibility-hover, var(--tbw-color-row-hover, #f3f4f6))}.tbw-visibility-row input[type=checkbox]{cursor:pointer}.tbw-visibility-row.locked span{color:var(--tbw-color-fg-muted, #888)}.tbw-visibility-handle{cursor:grab;color:var(--tbw-color-fg-muted, #888);font-size:var(--tbw-font-size-2xs, .625rem);letter-spacing:-2px;user-select:none;flex-shrink:0}.tbw-visibility-row.reorderable:hover .tbw-visibility-handle{color:var(--tbw-color-fg, #1f2937)}.tbw-visibility-label{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));flex:1;cursor:pointer}.tbw-visibility-row.dragging{opacity:.5;cursor:grabbing}.tbw-visibility-row.drop-before:before{content:"";position:absolute;left:0;right:0;top:0;height:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent, #3b82f6))}.tbw-visibility-row.drop-after:after{content:"";position:absolute;left:0;right:0;bottom:0;height:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent, #3b82f6))}.tbw-visibility-show-all{margin:var(--tbw-panel-padding, var(--tbw-spacing-md, .5rem));padding:var(--tbw-button-padding, .5rem .75rem);border:1px solid var(--tbw-visibility-border, var(--tbw-color-border, #e5e7eb));border-radius:var(--tbw-border-radius, .25rem);background:var(--tbw-visibility-btn-bg, var(--tbw-color-header-bg, #f9fafb));color:var(--tbw-color-fg, #1f2937);cursor:pointer;font-size:var(--tbw-font-size-sm, .8125rem)}.tbw-visibility-show-all:hover{background:var(--tbw-visibility-hover, var(--tbw-color-row-hover, #f3f4f6))}}';
|
|
4854
|
+
function Ge(s) {
|
|
4807
4855
|
const e = s.meta ?? {};
|
|
4808
4856
|
return e.lockPosition !== !0 && e.suppressMovable !== !0;
|
|
4809
4857
|
}
|
|
4810
|
-
class
|
|
4858
|
+
class M extends R {
|
|
4811
4859
|
static dependencies = [
|
|
4812
4860
|
{ name: "reorder", required: !1, reason: "Enables drag-to-reorder columns in visibility panel" }
|
|
4813
4861
|
];
|
|
4814
4862
|
name = "visibility";
|
|
4815
4863
|
static PANEL_ID = "columns";
|
|
4816
|
-
styles =
|
|
4864
|
+
styles = $i;
|
|
4817
4865
|
get defaultConfig() {
|
|
4818
4866
|
return {
|
|
4819
4867
|
allowHideAll: !1
|
|
@@ -4834,7 +4882,7 @@ class P extends R {
|
|
|
4834
4882
|
}
|
|
4835
4883
|
getToolPanel() {
|
|
4836
4884
|
return {
|
|
4837
|
-
id:
|
|
4885
|
+
id: M.PANEL_ID,
|
|
4838
4886
|
title: "Columns",
|
|
4839
4887
|
icon: "☰",
|
|
4840
4888
|
tooltip: "Column visibility",
|
|
@@ -4843,13 +4891,13 @@ class P extends R {
|
|
|
4843
4891
|
};
|
|
4844
4892
|
}
|
|
4845
4893
|
show() {
|
|
4846
|
-
this.grid.openToolPanel(), this.grid.expandedToolPanelSections.includes(
|
|
4894
|
+
this.grid.openToolPanel(), this.grid.expandedToolPanelSections.includes(M.PANEL_ID) || this.grid.toggleToolPanelSection(M.PANEL_ID);
|
|
4847
4895
|
}
|
|
4848
4896
|
hide() {
|
|
4849
4897
|
this.grid.closeToolPanel();
|
|
4850
4898
|
}
|
|
4851
4899
|
toggle() {
|
|
4852
|
-
this.grid.isToolPanelOpen || this.grid.openToolPanel(), this.grid.toggleToolPanelSection(
|
|
4900
|
+
this.grid.isToolPanelOpen || this.grid.openToolPanel(), this.grid.toggleToolPanelSection(M.PANEL_ID);
|
|
4853
4901
|
}
|
|
4854
4902
|
isColumnVisible(e) {
|
|
4855
4903
|
return this.grid.isColumnVisible(e);
|
|
@@ -4879,7 +4927,7 @@ class P extends R {
|
|
|
4879
4927
|
return this.grid.getAllColumns();
|
|
4880
4928
|
}
|
|
4881
4929
|
isPanelVisible() {
|
|
4882
|
-
return this.grid.isToolPanelOpen && this.grid.expandedToolPanelSections.includes(
|
|
4930
|
+
return this.grid.isToolPanelOpen && this.grid.expandedToolPanelSections.includes(M.PANEL_ID);
|
|
4883
4931
|
}
|
|
4884
4932
|
renderPanelContent(e) {
|
|
4885
4933
|
const t = document.createElement("div");
|
|
@@ -4903,7 +4951,7 @@ class P extends R {
|
|
|
4903
4951
|
const i = this.grid.getAllColumns().filter((n) => !n.utility);
|
|
4904
4952
|
for (let n = 0; n < i.length; n++) {
|
|
4905
4953
|
const r = i[n], o = r.header || r.field, a = document.createElement("div");
|
|
4906
|
-
a.className = r.lockVisible ? "tbw-visibility-row locked" : "tbw-visibility-row", a.setAttribute("data-field", r.field), a.setAttribute("data-index", String(n)), t &&
|
|
4954
|
+
a.className = r.lockVisible ? "tbw-visibility-row locked" : "tbw-visibility-row", a.setAttribute("data-field", r.field), a.setAttribute("data-index", String(n)), t && Ge(r) && (a.draggable = !0, a.classList.add("reorderable"), this.setupDragListeners(a, r.field, n, e));
|
|
4907
4955
|
const l = document.createElement("label");
|
|
4908
4956
|
l.className = "tbw-visibility-label";
|
|
4909
4957
|
const d = document.createElement("input");
|
|
@@ -4911,7 +4959,7 @@ class P extends R {
|
|
|
4911
4959
|
this.grid.toggleColumnVisibility(r.field), setTimeout(() => this.rebuildToggles(e), 0);
|
|
4912
4960
|
});
|
|
4913
4961
|
const c = document.createElement("span");
|
|
4914
|
-
if (c.textContent = o, l.appendChild(d), l.appendChild(c), t &&
|
|
4962
|
+
if (c.textContent = o, l.appendChild(d), l.appendChild(c), t && Ge(r)) {
|
|
4915
4963
|
const u = document.createElement("span");
|
|
4916
4964
|
u.className = "tbw-visibility-handle", this.setIcon(u, this.resolveIcon("dragHandle")), u.title = "Drag to reorder", a.appendChild(u);
|
|
4917
4965
|
}
|
|
@@ -4938,12 +4986,12 @@ class P extends R {
|
|
|
4938
4986
|
return;
|
|
4939
4987
|
const d = l > a ? l - 1 : l;
|
|
4940
4988
|
if (d !== a) {
|
|
4941
|
-
const c = this.grid.getAllColumns(), h = c.filter((p) => !p.utility)[d]?.field,
|
|
4989
|
+
const c = this.grid.getAllColumns(), h = c.filter((p) => !p.utility)[d]?.field, f = h ? c.findIndex((p) => p.field === h) : c.length, g = {
|
|
4942
4990
|
field: o,
|
|
4943
4991
|
fromIndex: a,
|
|
4944
|
-
toIndex:
|
|
4992
|
+
toIndex: f
|
|
4945
4993
|
};
|
|
4946
|
-
this.emit("column-reorder-request",
|
|
4994
|
+
this.emit("column-reorder-request", g), setTimeout(() => {
|
|
4947
4995
|
this.rebuildToggles(n);
|
|
4948
4996
|
}, 0);
|
|
4949
4997
|
}
|
|
@@ -4952,47 +5000,47 @@ class P extends R {
|
|
|
4952
5000
|
}
|
|
4953
5001
|
export {
|
|
4954
5002
|
R as BaseGridPlugin,
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
5003
|
+
Ui as ClipboardPlugin,
|
|
5004
|
+
Yi as ColumnVirtualizationPlugin,
|
|
5005
|
+
Xi as ContextMenuPlugin,
|
|
5006
|
+
gn as DEFAULT_ANIMATION_CONFIG,
|
|
5007
|
+
Ye as DEFAULT_GRID_ICONS,
|
|
5008
|
+
pn as DGEvents,
|
|
5009
|
+
mn as DataGridElement,
|
|
5010
|
+
Zi as EditingPlugin,
|
|
5011
|
+
Ji as ExportPlugin,
|
|
5012
|
+
T as FilteringPlugin,
|
|
5013
|
+
wn as FitModeEnum,
|
|
5014
|
+
bn as GridCSSVars,
|
|
5015
|
+
vn as GridClasses,
|
|
5016
|
+
yn as GridDataAttrs,
|
|
5017
|
+
Cn as GridElement,
|
|
5018
|
+
xn as GridSelectors,
|
|
5019
|
+
Qi as GroupingColumnsPlugin,
|
|
5020
|
+
en as GroupingRowsPlugin,
|
|
5021
|
+
Ve as MasterDetailPlugin,
|
|
5022
|
+
tn as MultiSortPlugin,
|
|
5023
|
+
Oe as PLUGIN_QUERIES,
|
|
5024
|
+
nn as PinnedColumnsPlugin,
|
|
5025
|
+
rn as PinnedRowsPlugin,
|
|
5026
|
+
P as PivotPlugin,
|
|
5027
|
+
Rn as PluginEvents,
|
|
5028
|
+
En as PluginManager,
|
|
5029
|
+
ki as ROW_DRAG_HANDLE_FIELD,
|
|
5030
|
+
Sn as RenderPhase,
|
|
5031
|
+
on as ReorderPlugin,
|
|
5032
|
+
sn as ResponsivePlugin,
|
|
5033
|
+
an as RowReorderPlugin,
|
|
5034
|
+
ln as SelectionPlugin,
|
|
5035
|
+
dn as ServerSidePlugin,
|
|
5036
|
+
cn as TreePlugin,
|
|
5037
|
+
un as UndoRedoPlugin,
|
|
5038
|
+
M as VisibilityPlugin,
|
|
5039
|
+
kn as builtInSort,
|
|
5040
|
+
An as createGrid,
|
|
5041
|
+
_n as defaultComparator,
|
|
5042
|
+
wt as defaultEditorFor,
|
|
5043
|
+
ot as defaultPasteHandler,
|
|
5044
|
+
Ln as queryGrid
|
|
4997
5045
|
};
|
|
4998
5046
|
//# sourceMappingURL=all.js.map
|