@toolbox-web/grid 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/all.js +539 -473
- package/all.js.map +1 -1
- package/index.js +2 -2
- package/lib/plugins/export/index.d.ts +1 -1
- package/lib/plugins/export/index.d.ts.map +1 -1
- package/lib/plugins/filtering/index.d.ts +1 -1
- package/lib/plugins/filtering/index.d.ts.map +1 -1
- package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts +12 -3
- package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts.map +1 -1
- package/lib/plugins/grouping-rows/grouping-rows.d.ts +13 -2
- package/lib/plugins/grouping-rows/grouping-rows.d.ts.map +1 -1
- package/lib/plugins/grouping-rows/index.d.ts +1 -1
- package/lib/plugins/grouping-rows/index.d.ts.map +1 -1
- package/lib/plugins/grouping-rows/index.js +199 -125
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/grouping-rows/types.d.ts +24 -2
- package/lib/plugins/grouping-rows/types.d.ts.map +1 -1
- package/lib/plugins/master-detail/index.d.ts +1 -1
- package/lib/plugins/master-detail/index.d.ts.map +1 -1
- package/lib/plugins/pinned-rows/index.js +1 -1
- package/lib/plugins/undo-redo/index.d.ts +1 -1
- package/lib/plugins/undo-redo/index.d.ts.map +1 -1
- package/lib/plugins/visibility/index.d.ts +1 -1
- package/lib/plugins/visibility/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/umd/grid.all.umd.js +23 -20
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/plugins/grouping-rows.umd.js +4 -1
- package/umd/plugins/grouping-rows.umd.js.map +1 -1
- package/umd/plugins/pinned-rows.umd.js +1 -1
- package/umd/plugins/pinned-rows.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
|
|
4
|
-
function
|
|
5
|
-
return s.field ===
|
|
1
|
+
import { BaseGridPlugin as R, DEFAULT_GRID_ICONS as Je, a as Qe, runAggregator as j, e as et, s as tt, PLUGIN_QUERIES as We, getAggregator as ge, getValueAggregator as it, b as _, c as fe, g as nt } from "./index.js";
|
|
2
|
+
import { DEFAULT_ANIMATION_CONFIG as Rn, DGEvents as En, DataGridElement as Sn, FitModeEnum as kn, GridCSSVars as An, GridClasses as _n, GridDataAttrs as Ln, DataGridElement as Tn, GridSelectors as In, PluginEvents as Pn, PluginManager as Dn, RenderPhase as Fn, builtInSort as Mn, createGrid as qn, defaultComparator as Kn, queryGrid as Nn } from "./index.js";
|
|
3
|
+
const $e = "__tbw_expander", rt = 32;
|
|
4
|
+
function ae(s) {
|
|
5
|
+
return s.field === $e;
|
|
6
6
|
}
|
|
7
7
|
function I(s) {
|
|
8
8
|
return s.meta?.utility === !0;
|
|
9
9
|
}
|
|
10
|
-
function rt(s) {
|
|
11
|
-
return s.find(se);
|
|
12
|
-
}
|
|
13
10
|
function ot(s) {
|
|
11
|
+
return s.find(ae);
|
|
12
|
+
}
|
|
13
|
+
function st(s) {
|
|
14
14
|
return {
|
|
15
|
-
field:
|
|
15
|
+
field: $e,
|
|
16
16
|
header: "",
|
|
17
|
-
width:
|
|
17
|
+
width: rt,
|
|
18
18
|
resizable: !1,
|
|
19
19
|
sortable: !1,
|
|
20
20
|
filterable: !1,
|
|
@@ -27,7 +27,7 @@ function ot(s) {
|
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
async function
|
|
30
|
+
async function U(s) {
|
|
31
31
|
try {
|
|
32
32
|
return await navigator.clipboard.writeText(s), !0;
|
|
33
33
|
} catch {
|
|
@@ -49,14 +49,14 @@ function pe(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 at() {
|
|
53
53
|
try {
|
|
54
54
|
return await navigator.clipboard.readText();
|
|
55
55
|
} catch {
|
|
56
56
|
return "";
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function lt(s, e) {
|
|
60
60
|
const { rows: t, target: i, fields: n } = s;
|
|
61
61
|
if (!i) return;
|
|
62
62
|
const r = e.rows, o = e.effectiveConfig.columns ?? [], a = o.map((u) => u.field), l = /* @__PURE__ */ new Map();
|
|
@@ -81,7 +81,7 @@ function at(s, e) {
|
|
|
81
81
|
}
|
|
82
82
|
}), e.rows = d;
|
|
83
83
|
}
|
|
84
|
-
class
|
|
84
|
+
class nn extends R {
|
|
85
85
|
static dependencies = [
|
|
86
86
|
{ name: "selection", required: !1, reason: "Enables copy/paste of selected cells instead of entire grid" }
|
|
87
87
|
];
|
|
@@ -133,7 +133,7 @@ class en extends R {
|
|
|
133
133
|
o = { startRow: l.row, startCol: l.col, endRow: l.row, endCol: l.col };
|
|
134
134
|
}
|
|
135
135
|
const a = this.#i(o);
|
|
136
|
-
|
|
136
|
+
U(a.text).then(() => {
|
|
137
137
|
this.lastCopied = { text: a.text, timestamp: Date.now() }, this.emit("copy", {
|
|
138
138
|
text: a.text,
|
|
139
139
|
rowCount: a.rowCount,
|
|
@@ -157,7 +157,7 @@ class en extends R {
|
|
|
157
157
|
if (!this.grid) return;
|
|
158
158
|
const { pasteHandler: t } = this.config;
|
|
159
159
|
if (t === null) return;
|
|
160
|
-
(t ??
|
|
160
|
+
(t ?? lt)(e, this.grid);
|
|
161
161
|
}
|
|
162
162
|
#n() {
|
|
163
163
|
try {
|
|
@@ -212,7 +212,7 @@ class en extends R {
|
|
|
212
212
|
};
|
|
213
213
|
}
|
|
214
214
|
const r = this.#i(n);
|
|
215
|
-
return await
|
|
215
|
+
return await U(r.text), this.lastCopied = { text: r.text, timestamp: Date.now() }, r.text;
|
|
216
216
|
}
|
|
217
217
|
async copyRows(e) {
|
|
218
218
|
if (e.length === 0) return "";
|
|
@@ -222,10 +222,10 @@ class en extends R {
|
|
|
222
222
|
endRow: t[t.length - 1],
|
|
223
223
|
endCol: i
|
|
224
224
|
}, r = this.#i(n);
|
|
225
|
-
return await
|
|
225
|
+
return await U(r.text), this.lastCopied = { text: r.text, timestamp: Date.now() }, r.text;
|
|
226
226
|
}
|
|
227
227
|
async paste() {
|
|
228
|
-
const e = await
|
|
228
|
+
const e = await at();
|
|
229
229
|
return e ? pe(e, this.config) : null;
|
|
230
230
|
}
|
|
231
231
|
getLastCopied() {
|
|
@@ -233,7 +233,7 @@ class en extends R {
|
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
235
|
const me = 100;
|
|
236
|
-
function
|
|
236
|
+
function le(s) {
|
|
237
237
|
if (s == null)
|
|
238
238
|
return me;
|
|
239
239
|
if (typeof s == "number")
|
|
@@ -242,23 +242,23 @@ function ae(s) {
|
|
|
242
242
|
return isNaN(e) ? me : e;
|
|
243
243
|
}
|
|
244
244
|
function we(s) {
|
|
245
|
-
return s.map((e) =>
|
|
245
|
+
return s.map((e) => le(e.width));
|
|
246
246
|
}
|
|
247
247
|
function be(s) {
|
|
248
248
|
const e = [];
|
|
249
249
|
let t = 0;
|
|
250
250
|
for (const i of s)
|
|
251
|
-
e.push(t), t +=
|
|
251
|
+
e.push(t), t += le(i.width);
|
|
252
252
|
return e;
|
|
253
253
|
}
|
|
254
254
|
function ve(s) {
|
|
255
|
-
return s.reduce((e, t) => e +
|
|
255
|
+
return s.reduce((e, t) => e + le(t.width), 0);
|
|
256
256
|
}
|
|
257
|
-
function
|
|
257
|
+
function dt(s, e, t, i, n) {
|
|
258
258
|
const r = t.length;
|
|
259
259
|
if (r === 0)
|
|
260
260
|
return { startCol: 0, endCol: 0, visibleColumns: [] };
|
|
261
|
-
let o =
|
|
261
|
+
let o = ct(s, t, i);
|
|
262
262
|
o = Math.max(0, o - n);
|
|
263
263
|
const a = s + e;
|
|
264
264
|
let l = o;
|
|
@@ -275,7 +275,7 @@ function lt(s, e, t, i, n) {
|
|
|
275
275
|
d.push(c);
|
|
276
276
|
return { startCol: o, endCol: l, visibleColumns: d };
|
|
277
277
|
}
|
|
278
|
-
function
|
|
278
|
+
function ct(s, e, t) {
|
|
279
279
|
let i = 0, n = e.length - 1;
|
|
280
280
|
for (; i < n; ) {
|
|
281
281
|
const r = Math.floor((i + n) / 2);
|
|
@@ -283,10 +283,10 @@ function dt(s, e, t) {
|
|
|
283
283
|
}
|
|
284
284
|
return i;
|
|
285
285
|
}
|
|
286
|
-
function
|
|
286
|
+
function ut(s, e, t) {
|
|
287
287
|
return t ? s > e : !1;
|
|
288
288
|
}
|
|
289
|
-
class
|
|
289
|
+
class rn extends R {
|
|
290
290
|
name = "columnVirtualization";
|
|
291
291
|
get defaultConfig() {
|
|
292
292
|
return {
|
|
@@ -311,10 +311,10 @@ class tn extends R {
|
|
|
311
311
|
this.columnWidths = [], this.columnOffsets = [], this.isVirtualized = !1, this.startCol = 0, this.endCol = 0, this.scrollLeft = 0, this.totalWidth = 0;
|
|
312
312
|
}
|
|
313
313
|
processColumns(e) {
|
|
314
|
-
const t =
|
|
314
|
+
const t = ut(e.length, this.config.threshold ?? 30, this.config.autoEnable ?? !0);
|
|
315
315
|
if (this.isVirtualized = t ?? !1, this.columnWidths = we(e), this.columnOffsets = be(e), this.totalWidth = ve(e), !t)
|
|
316
316
|
return this.startCol = 0, this.endCol = e.length - 1, [...e];
|
|
317
|
-
const i = this.grid.clientWidth || 800, n =
|
|
317
|
+
const i = this.grid.clientWidth || 800, n = dt(
|
|
318
318
|
this.scrollLeft,
|
|
319
319
|
i,
|
|
320
320
|
this.columnOffsets,
|
|
@@ -354,14 +354,14 @@ class tn extends R {
|
|
|
354
354
|
return this.totalWidth;
|
|
355
355
|
}
|
|
356
356
|
}
|
|
357
|
-
const
|
|
358
|
-
function
|
|
357
|
+
const Y = "@layer tbw-plugins{.tbw-context-menu{position:fixed;background:var(--tbw-context-menu-bg, var(--tbw-color-panel-bg, light-dark(#f5f5f5, #2a2a2a)));color:var(--tbw-context-menu-fg, var(--tbw-color-fg, light-dark(#222, #eee)));border:1px solid var(--tbw-context-menu-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:var(--tbw-border-radius, .25rem);box-shadow:0 2px 10px var(--tbw-color-shadow, rgba(0, 0, 0, .15));min-width:var(--tbw-menu-min-width, 10rem);padding:var(--tbw-spacing-xs, .25rem) 0;z-index:10000;font-size:var(--tbw-font-size-sm, .8125rem);font-family:var(--tbw-font-family, system-ui, sans-serif)}.tbw-context-menu-item{display:flex;align-items:center;padding:var(--tbw-menu-item-padding, .375rem .75rem);cursor:pointer;gap:var(--tbw-menu-item-gap, .5rem)}.tbw-context-menu-item:hover:not(.disabled){background:var(--tbw-context-menu-hover, var(--tbw-color-row-hover, light-dark(#e8e8e8, #3a3a3a)))}.tbw-context-menu-item.disabled{opacity:.5;cursor:default}.tbw-context-menu-item.danger{color:light-dark(#c00,#f66)}.tbw-context-menu-icon{width:var(--tbw-icon-size, 1rem);text-align:center}.tbw-context-menu-label{flex:1}.tbw-context-menu-shortcut{color:var(--tbw-color-fg-muted, light-dark(#888, #888));font-size:var(--tbw-font-size-xs, .6875rem)}.tbw-context-menu-arrow{font-size:var(--tbw-font-size-2xs, .625rem);color:var(--tbw-color-fg-muted, light-dark(#888, #888))}.tbw-context-menu-separator{height:1px;background:var(--tbw-context-menu-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));margin:var(--tbw-spacing-xs, .25rem) 0}}";
|
|
358
|
+
function re(s, e) {
|
|
359
359
|
return (typeof s == "function" ? s(e) : s).filter((i) => !(i.hidden === !0 || typeof i.hidden == "function" && i.hidden(e)));
|
|
360
360
|
}
|
|
361
|
-
function
|
|
361
|
+
function ht(s, e) {
|
|
362
362
|
return s.disabled === !0 ? !0 : typeof s.disabled == "function" ? s.disabled(e) : !1;
|
|
363
363
|
}
|
|
364
|
-
function
|
|
364
|
+
function oe(s, e, t, i = Je.submenuArrow) {
|
|
365
365
|
const n = document.createElement("div");
|
|
366
366
|
n.className = "tbw-context-menu", n.setAttribute("role", "menu");
|
|
367
367
|
for (const r of s) {
|
|
@@ -372,7 +372,7 @@ function re(s, e, t, i = Ze.submenuArrow) {
|
|
|
372
372
|
}
|
|
373
373
|
const o = document.createElement("div");
|
|
374
374
|
o.className = "tbw-context-menu-item", r.cssClass && o.classList.add(r.cssClass), o.setAttribute("role", "menuitem"), o.setAttribute("data-id", r.id);
|
|
375
|
-
const a =
|
|
375
|
+
const a = ht(r, e);
|
|
376
376
|
if (a && (o.classList.add("disabled"), o.setAttribute("aria-disabled", "true")), r.icon) {
|
|
377
377
|
const d = document.createElement("span");
|
|
378
378
|
d.className = "tbw-context-menu-icon", d.innerHTML = r.icon, o.appendChild(d);
|
|
@@ -386,7 +386,7 @@ function re(s, e, t, i = Ze.submenuArrow) {
|
|
|
386
386
|
const d = document.createElement("span");
|
|
387
387
|
d.className = "tbw-context-menu-arrow", typeof i == "string" ? d.innerHTML = i : i instanceof HTMLElement && d.appendChild(i.cloneNode(!0)), o.appendChild(d), o.addEventListener("mouseenter", () => {
|
|
388
388
|
if (o.querySelector(".tbw-context-menu") || !r.subMenu) return;
|
|
389
|
-
const u =
|
|
389
|
+
const u = re(r.subMenu, e), h = oe(u, e, t, i);
|
|
390
390
|
h.classList.add("tbw-context-submenu"), h.style.position = "absolute", h.style.left = "100%", h.style.top = "0", o.style.position = "relative", o.appendChild(h);
|
|
391
391
|
}), o.addEventListener("mouseleave", () => {
|
|
392
392
|
const c = o.querySelector(".tbw-context-menu");
|
|
@@ -405,8 +405,8 @@ function ye(s, e, t) {
|
|
|
405
405
|
let o = e, a = t;
|
|
406
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";
|
|
407
407
|
}
|
|
408
|
-
let P = null,
|
|
409
|
-
const
|
|
408
|
+
let P = null, D = null, L = null, X = 0;
|
|
409
|
+
const Z = [
|
|
410
410
|
{
|
|
411
411
|
id: "copy",
|
|
412
412
|
name: "Copy",
|
|
@@ -424,11 +424,11 @@ const X = [
|
|
|
424
424
|
}
|
|
425
425
|
}
|
|
426
426
|
];
|
|
427
|
-
class
|
|
427
|
+
class on extends R {
|
|
428
428
|
name = "contextMenu";
|
|
429
429
|
get defaultConfig() {
|
|
430
430
|
return {
|
|
431
|
-
items:
|
|
431
|
+
items: Z
|
|
432
432
|
};
|
|
433
433
|
}
|
|
434
434
|
isOpen = !1;
|
|
@@ -436,20 +436,20 @@ class nn extends R {
|
|
|
436
436
|
params = null;
|
|
437
437
|
menuElement = null;
|
|
438
438
|
attach(e) {
|
|
439
|
-
super.attach(e), this.installGlobalHandlers(),
|
|
439
|
+
super.attach(e), this.installGlobalHandlers(), X++;
|
|
440
440
|
}
|
|
441
441
|
detach() {
|
|
442
442
|
this.menuElement && (this.menuElement.remove(), this.menuElement = null), this.isOpen = !1, this.params = null, this.uninstallGlobalHandlers();
|
|
443
443
|
}
|
|
444
444
|
installGlobalHandlers() {
|
|
445
|
-
!L && typeof document < "u" && typeof
|
|
445
|
+
!L && typeof document < "u" && typeof Y == "string" && Y && (L = document.createElement("style"), L.id = "tbw-context-menu-styles", L.textContent = Y, document.head.appendChild(L)), P || (P = () => {
|
|
446
446
|
document.querySelectorAll(".tbw-context-menu").forEach((t) => t.remove());
|
|
447
|
-
}, document.addEventListener("click", P)),
|
|
447
|
+
}, document.addEventListener("click", P)), D || (D = (e) => {
|
|
448
448
|
e.key === "Escape" && document.querySelectorAll(".tbw-context-menu").forEach((i) => i.remove());
|
|
449
|
-
}, document.addEventListener("keydown",
|
|
449
|
+
}, document.addEventListener("keydown", D));
|
|
450
450
|
}
|
|
451
451
|
uninstallGlobalHandlers() {
|
|
452
|
-
|
|
452
|
+
X--, !(X > 0) && (P && (document.removeEventListener("click", P), P = null), D && (document.removeEventListener("keydown", D), D = null), L && (L.remove(), L = null));
|
|
453
453
|
}
|
|
454
454
|
afterRender() {
|
|
455
455
|
const e = this.gridElement;
|
|
@@ -487,8 +487,8 @@ class nn extends R {
|
|
|
487
487
|
} else
|
|
488
488
|
return;
|
|
489
489
|
this.params = l, this.position = { x: n.clientX, y: n.clientY };
|
|
490
|
-
const d =
|
|
491
|
-
d.length && (this.menuElement && this.menuElement.remove(), this.menuElement =
|
|
490
|
+
const d = re(this.config.items ?? Z, l);
|
|
491
|
+
d.length && (this.menuElement && this.menuElement.remove(), this.menuElement = oe(
|
|
492
492
|
d,
|
|
493
493
|
l,
|
|
494
494
|
(c) => {
|
|
@@ -508,8 +508,8 @@ class nn extends R {
|
|
|
508
508
|
value: i.value ?? null,
|
|
509
509
|
isHeader: i.isHeader ?? !1,
|
|
510
510
|
event: i.event ?? new MouseEvent("contextmenu")
|
|
511
|
-
}, r =
|
|
512
|
-
this.menuElement && this.menuElement.remove(), this.menuElement =
|
|
511
|
+
}, r = re(this.config.items ?? Z, n);
|
|
512
|
+
this.menuElement && this.menuElement.remove(), this.menuElement = oe(
|
|
513
513
|
r,
|
|
514
514
|
n,
|
|
515
515
|
(o) => {
|
|
@@ -525,12 +525,12 @@ class nn extends R {
|
|
|
525
525
|
return this.isOpen;
|
|
526
526
|
}
|
|
527
527
|
}
|
|
528
|
-
const
|
|
529
|
-
function
|
|
528
|
+
const gt = "@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 ft(s) {
|
|
530
530
|
const e = s.options;
|
|
531
531
|
return e ? typeof e == "function" ? e() : e : [];
|
|
532
532
|
}
|
|
533
|
-
function
|
|
533
|
+
function pt(s) {
|
|
534
534
|
return (e) => {
|
|
535
535
|
const t = s.editorParams, i = document.createElement("input");
|
|
536
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);
|
|
@@ -540,13 +540,13 @@ function ft(s) {
|
|
|
540
540
|
}), i;
|
|
541
541
|
};
|
|
542
542
|
}
|
|
543
|
-
function
|
|
543
|
+
function mt() {
|
|
544
544
|
return (s) => {
|
|
545
545
|
const e = document.createElement("input");
|
|
546
546
|
return e.type = "checkbox", e.checked = !!s.value, e.addEventListener("change", () => s.commit(e.checked)), e;
|
|
547
547
|
};
|
|
548
548
|
}
|
|
549
|
-
function
|
|
549
|
+
function wt(s) {
|
|
550
550
|
return (e) => {
|
|
551
551
|
const t = s.editorParams, i = document.createElement("input");
|
|
552
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) => {
|
|
@@ -554,14 +554,14 @@ function mt(s) {
|
|
|
554
554
|
}), i;
|
|
555
555
|
};
|
|
556
556
|
}
|
|
557
|
-
function
|
|
557
|
+
function bt(s) {
|
|
558
558
|
return (e) => {
|
|
559
559
|
const t = s.editorParams, i = document.createElement("select");
|
|
560
560
|
if (s.multi && (i.multiple = !0), t?.includeEmpty) {
|
|
561
561
|
const o = document.createElement("option");
|
|
562
562
|
o.value = "", o.textContent = t.emptyLabel ?? "", i.appendChild(o);
|
|
563
563
|
}
|
|
564
|
-
|
|
564
|
+
ft(s).forEach((o) => {
|
|
565
565
|
const a = document.createElement("option");
|
|
566
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);
|
|
567
567
|
});
|
|
@@ -577,7 +577,7 @@ function wt(s) {
|
|
|
577
577
|
}), i;
|
|
578
578
|
};
|
|
579
579
|
}
|
|
580
|
-
function
|
|
580
|
+
function vt(s) {
|
|
581
581
|
return (e) => {
|
|
582
582
|
const t = s.editorParams, i = document.createElement("input");
|
|
583
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) => {
|
|
@@ -585,22 +585,22 @@ function bt(s) {
|
|
|
585
585
|
}), i;
|
|
586
586
|
};
|
|
587
587
|
}
|
|
588
|
-
function
|
|
588
|
+
function yt(s) {
|
|
589
589
|
switch (s.type) {
|
|
590
590
|
case "number":
|
|
591
|
-
return
|
|
591
|
+
return pt(s);
|
|
592
592
|
case "boolean":
|
|
593
|
-
return
|
|
593
|
+
return mt();
|
|
594
594
|
case "date":
|
|
595
|
-
return mt(s);
|
|
596
|
-
case "select":
|
|
597
595
|
return wt(s);
|
|
598
|
-
|
|
596
|
+
case "select":
|
|
599
597
|
return bt(s);
|
|
598
|
+
default:
|
|
599
|
+
return vt(s);
|
|
600
600
|
}
|
|
601
601
|
}
|
|
602
|
-
const
|
|
603
|
-
function
|
|
602
|
+
const J = 'input,select,textarea,[contenteditable="true"],[contenteditable=""],[tabindex]:not([tabindex="-1"])';
|
|
603
|
+
function xt(s, e) {
|
|
604
604
|
if (e.editor) return e.editor;
|
|
605
605
|
if (e.__editorTemplate) return "template";
|
|
606
606
|
if (!e.type) return;
|
|
@@ -614,28 +614,28 @@ function yt(s, e) {
|
|
|
614
614
|
return r.editor;
|
|
615
615
|
}
|
|
616
616
|
}
|
|
617
|
-
function
|
|
617
|
+
function N(s) {
|
|
618
618
|
return !(typeof s != "string" || s === "__proto__" || s === "constructor" || s === "prototype");
|
|
619
619
|
}
|
|
620
620
|
function Ct(s) {
|
|
621
621
|
const e = (s.__editingCellCount ?? 0) + 1;
|
|
622
622
|
s.__editingCellCount = e, s.setAttribute("data-has-editing", "");
|
|
623
623
|
}
|
|
624
|
-
function
|
|
624
|
+
function Rt(s) {
|
|
625
625
|
s.__editingCellCount = 0, s.removeAttribute("data-has-editing");
|
|
626
626
|
}
|
|
627
627
|
function z(s, e) {
|
|
628
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;
|
|
629
629
|
}
|
|
630
|
-
function
|
|
630
|
+
function xe(s) {
|
|
631
631
|
}
|
|
632
|
-
function
|
|
632
|
+
function Et(s, e, t) {
|
|
633
633
|
const i = s.querySelector("input,textarea,select");
|
|
634
634
|
i && (i.addEventListener("blur", () => {
|
|
635
635
|
t(z(i, e));
|
|
636
636
|
}), i instanceof HTMLInputElement && i.type === "checkbox" ? i.addEventListener("change", () => t(i.checked)) : i instanceof HTMLSelectElement && i.addEventListener("change", () => t(z(i, e))));
|
|
637
637
|
}
|
|
638
|
-
class
|
|
638
|
+
class sn extends R {
|
|
639
639
|
static manifest = {
|
|
640
640
|
ownedProperties: [
|
|
641
641
|
{
|
|
@@ -657,7 +657,7 @@ class rn extends R {
|
|
|
657
657
|
]
|
|
658
658
|
};
|
|
659
659
|
name = "editing";
|
|
660
|
-
styles =
|
|
660
|
+
styles = gt;
|
|
661
661
|
get defaultConfig() {
|
|
662
662
|
return {
|
|
663
663
|
editOn: "click"
|
|
@@ -719,7 +719,7 @@ class rn extends R {
|
|
|
719
719
|
const r = t._visibleColumns[n], o = t._rows[i];
|
|
720
720
|
if (r?.editable && r.type === "boolean" && o) {
|
|
721
721
|
const a = r.field;
|
|
722
|
-
if (
|
|
722
|
+
if (N(a)) {
|
|
723
723
|
const d = !o[a];
|
|
724
724
|
return this.#h(i, r, d, o), e.preventDefault(), this.requestRender(), !0;
|
|
725
725
|
}
|
|
@@ -851,7 +851,7 @@ class rn extends R {
|
|
|
851
851
|
}), setTimeout(() => {
|
|
852
852
|
let a = r.querySelector(`.cell[data-col="${t._focusCol}"]`);
|
|
853
853
|
if (a?.classList.contains("editing") || (a = r.querySelector(".cell.editing")), a?.classList.contains("editing")) {
|
|
854
|
-
const l = a.querySelector(
|
|
854
|
+
const l = a.querySelector(J);
|
|
855
855
|
try {
|
|
856
856
|
l?.focus({ preventScroll: !0 });
|
|
857
857
|
} catch {
|
|
@@ -914,12 +914,12 @@ class rn extends R {
|
|
|
914
914
|
for (const l of this.#i)
|
|
915
915
|
l.startsWith(`${e}:`) && this.#i.delete(l);
|
|
916
916
|
o && (o.querySelectorAll(".cell.editing").forEach((l) => {
|
|
917
|
-
l.classList.remove("editing"),
|
|
917
|
+
l.classList.remove("editing"), Rt(l.parentElement);
|
|
918
918
|
}), this.requestRender()), this.#r = !0, o || (this.#g(i), this.#r = !1);
|
|
919
919
|
}
|
|
920
920
|
#h(e, t, i, n) {
|
|
921
921
|
const r = t.field;
|
|
922
|
-
if (!
|
|
922
|
+
if (!N(r)) return;
|
|
923
923
|
const o = n[r];
|
|
924
924
|
if (o === i) return;
|
|
925
925
|
const a = this.grid;
|
|
@@ -928,7 +928,7 @@ class rn extends R {
|
|
|
928
928
|
l = this.grid.getRowId(n);
|
|
929
929
|
} catch {
|
|
930
930
|
}
|
|
931
|
-
const d = l ? !this.#n.has(l) : !0, c = l ? (g) => this.grid.updateRow(l, g, "cascade") :
|
|
931
|
+
const d = l ? !this.#n.has(l) : !0, c = l ? (g) => this.grid.updateRow(l, g, "cascade") : xe;
|
|
932
932
|
if (this.emitCancelable("cell-commit", {
|
|
933
933
|
row: n,
|
|
934
934
|
rowId: l ?? "",
|
|
@@ -943,7 +943,7 @@ class rn extends R {
|
|
|
943
943
|
})) return;
|
|
944
944
|
n[r] = i, l && this.#n.add(l), this.#a();
|
|
945
945
|
const h = a.findRenderedRowElement?.(e);
|
|
946
|
-
h && (h.classList.add("changed"),
|
|
946
|
+
h && (h.classList.add("changed"), Qe(h, "change"));
|
|
947
947
|
}
|
|
948
948
|
#p(e, t, i, n, r, o) {
|
|
949
949
|
if (!i.editable || r.classList.contains("editing")) return;
|
|
@@ -952,7 +952,7 @@ class rn extends R {
|
|
|
952
952
|
a = this.grid.getRowId(e);
|
|
953
953
|
} catch {
|
|
954
954
|
}
|
|
955
|
-
const l = a ? (v) => this.grid.updateRow(a, v, "cascade") :
|
|
955
|
+
const l = a ? (v) => this.grid.updateRow(a, v, "cascade") : xe, d = N(i.field) ? e[i.field] : void 0;
|
|
956
956
|
r.classList.add("editing"), this.#i.add(`${t}:${n}`);
|
|
957
957
|
const c = r.parentElement;
|
|
958
958
|
c && Ct(c);
|
|
@@ -960,18 +960,18 @@ class rn extends R {
|
|
|
960
960
|
const h = (v) => {
|
|
961
961
|
u || this.#e === -1 || this.#h(t, i, v, e);
|
|
962
962
|
}, g = () => {
|
|
963
|
-
u = !0,
|
|
963
|
+
u = !0, N(i.field) && (e[i.field] = d);
|
|
964
964
|
}, f = document.createElement("div");
|
|
965
965
|
f.className = "tbw-editor-host", r.innerHTML = "", r.appendChild(f), f.addEventListener("keydown", (v) => {
|
|
966
966
|
v.key === "Enter" && (v.stopPropagation(), v.preventDefault(), u = !0, this.#s(t, !1)), v.key === "Escape" && (v.stopPropagation(), v.preventDefault(), g(), this.#s(t, !0));
|
|
967
967
|
});
|
|
968
|
-
const p = i, m = p.__editorTemplate, w =
|
|
968
|
+
const p = i, m = p.__editorTemplate, w = xt(this.grid, p) ?? yt(i), b = d;
|
|
969
969
|
if (w === "template" && m)
|
|
970
970
|
this.#l(f, p, e, d, h, g, o, t);
|
|
971
971
|
else if (typeof w == "string") {
|
|
972
972
|
const v = document.createElement(w);
|
|
973
973
|
v.value = b, v.addEventListener("change", () => h(v.value)), f.appendChild(v), o || queueMicrotask(() => {
|
|
974
|
-
f.querySelector(
|
|
974
|
+
f.querySelector(J)?.focus({ preventScroll: !0 });
|
|
975
975
|
});
|
|
976
976
|
} else if (typeof w == "function") {
|
|
977
977
|
const v = {
|
|
@@ -984,8 +984,8 @@ class rn extends R {
|
|
|
984
984
|
cancel: g,
|
|
985
985
|
updateRow: l
|
|
986
986
|
}, S = w(v);
|
|
987
|
-
typeof S == "string" ? (f.innerHTML = S,
|
|
988
|
-
f.querySelector(
|
|
987
|
+
typeof S == "string" ? (f.innerHTML = S, Et(f, i, h)) : S instanceof Node && f.appendChild(S), o || queueMicrotask(() => {
|
|
988
|
+
f.querySelector(J)?.focus({ preventScroll: !0 });
|
|
989
989
|
});
|
|
990
990
|
} else if (w && typeof w == "object") {
|
|
991
991
|
const v = document.createElement("div");
|
|
@@ -1003,8 +1003,8 @@ class rn extends R {
|
|
|
1003
1003
|
if (w.mount)
|
|
1004
1004
|
try {
|
|
1005
1005
|
w.mount({ placeholder: v, context: S, spec: w });
|
|
1006
|
-
} catch (
|
|
1007
|
-
console.warn(`[tbw-grid] External editor mount error for column '${i.field}':`,
|
|
1006
|
+
} catch (K) {
|
|
1007
|
+
console.warn(`[tbw-grid] External editor mount error for column '${i.field}':`, K);
|
|
1008
1008
|
}
|
|
1009
1009
|
else
|
|
1010
1010
|
this.grid.dispatchEvent(
|
|
@@ -1025,7 +1025,7 @@ class rn extends R {
|
|
|
1025
1025
|
cancel: o
|
|
1026
1026
|
}) : c.querySelectorAll("*").forEach((g) => {
|
|
1027
1027
|
g.childNodes.length === 1 && g.firstChild?.nodeType === Node.TEXT_NODE && (g.textContent = g.textContent?.replace(/{{\s*value\s*}}/g, n == null ? "" : String(n)).replace(/{{\s*row\.([a-zA-Z0-9_]+)\s*}}/g, (f, p) => {
|
|
1028
|
-
if (!
|
|
1028
|
+
if (!N(p)) return "";
|
|
1029
1029
|
const m = i[p];
|
|
1030
1030
|
return m == null ? "" : String(m);
|
|
1031
1031
|
}) || "");
|
|
@@ -1061,7 +1061,7 @@ class rn extends R {
|
|
|
1061
1061
|
});
|
|
1062
1062
|
}
|
|
1063
1063
|
}
|
|
1064
|
-
function
|
|
1064
|
+
function Ce(s, e = !0) {
|
|
1065
1065
|
if (s == null) return "";
|
|
1066
1066
|
if (s instanceof Date) return s.toISOString();
|
|
1067
1067
|
if (typeof s == "object") return JSON.stringify(s);
|
|
@@ -1069,37 +1069,37 @@ function xe(s, e = !0) {
|
|
|
1069
1069
|
return e && (t.includes(",") || t.includes('"') || t.includes(`
|
|
1070
1070
|
`) || t.includes("\r")) ? `"${t.replace(/"/g, '""')}"` : t;
|
|
1071
1071
|
}
|
|
1072
|
-
function
|
|
1072
|
+
function St(s, e, t, i = {}) {
|
|
1073
1073
|
const n = i.delimiter ?? ",", r = i.newline ?? `
|
|
1074
1074
|
`, o = [], a = i.bom ? "\uFEFF" : "";
|
|
1075
1075
|
if (t.includeHeaders !== !1) {
|
|
1076
1076
|
const l = e.map((d) => {
|
|
1077
1077
|
const c = d.header || d.field, u = t.processHeader ? t.processHeader(c, d.field) : c;
|
|
1078
|
-
return
|
|
1078
|
+
return Ce(u);
|
|
1079
1079
|
});
|
|
1080
1080
|
o.push(l.join(n));
|
|
1081
1081
|
}
|
|
1082
1082
|
for (const l of s) {
|
|
1083
1083
|
const d = e.map((c) => {
|
|
1084
1084
|
let u = l[c.field];
|
|
1085
|
-
return t.processCell && (u = t.processCell(u, c.field, l)),
|
|
1085
|
+
return t.processCell && (u = t.processCell(u, c.field, l)), Ce(u);
|
|
1086
1086
|
});
|
|
1087
1087
|
o.push(d.join(n));
|
|
1088
1088
|
}
|
|
1089
1089
|
return a + o.join(r);
|
|
1090
1090
|
}
|
|
1091
|
-
function
|
|
1091
|
+
function de(s, e) {
|
|
1092
1092
|
const t = URL.createObjectURL(s), i = document.createElement("a");
|
|
1093
1093
|
i.href = t, i.download = e, i.style.display = "none", document.body.appendChild(i), i.click(), document.body.removeChild(i), URL.revokeObjectURL(t);
|
|
1094
1094
|
}
|
|
1095
|
-
function
|
|
1095
|
+
function kt(s, e) {
|
|
1096
1096
|
const t = new Blob([s], { type: "text/csv;charset=utf-8;" });
|
|
1097
|
-
|
|
1097
|
+
de(t, e);
|
|
1098
1098
|
}
|
|
1099
1099
|
function Re(s) {
|
|
1100
1100
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
1101
1101
|
}
|
|
1102
|
-
function
|
|
1102
|
+
function At(s, e, t) {
|
|
1103
1103
|
let i = `<?xml version="1.0" encoding="UTF-8"?>
|
|
1104
1104
|
<?mso-application progid="Excel.Sheet"?>
|
|
1105
1105
|
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
|
|
@@ -1131,13 +1131,13 @@ function kt(s, e, t) {
|
|
|
1131
1131
|
</Worksheet>
|
|
1132
1132
|
</Workbook>`, i;
|
|
1133
1133
|
}
|
|
1134
|
-
function
|
|
1134
|
+
function _t(s, e) {
|
|
1135
1135
|
const t = e.endsWith(".xls") ? e : `${e}.xls`, i = new Blob([s], {
|
|
1136
1136
|
type: "application/vnd.ms-excel;charset=utf-8;"
|
|
1137
1137
|
});
|
|
1138
|
-
|
|
1138
|
+
de(i, t);
|
|
1139
1139
|
}
|
|
1140
|
-
class
|
|
1140
|
+
class an extends R {
|
|
1141
1141
|
name = "export";
|
|
1142
1142
|
get defaultConfig() {
|
|
1143
1143
|
return {
|
|
@@ -1174,13 +1174,13 @@ class on extends R {
|
|
|
1174
1174
|
try {
|
|
1175
1175
|
switch (e) {
|
|
1176
1176
|
case "csv": {
|
|
1177
|
-
const l =
|
|
1178
|
-
a = a.endsWith(".csv") ? a : `${a}.csv`,
|
|
1177
|
+
const l = St(o, r, n, { bom: !0 });
|
|
1178
|
+
a = a.endsWith(".csv") ? a : `${a}.csv`, kt(l, a);
|
|
1179
1179
|
break;
|
|
1180
1180
|
}
|
|
1181
1181
|
case "excel": {
|
|
1182
|
-
const l =
|
|
1183
|
-
a = a.endsWith(".xls") ? a : `${a}.xls`,
|
|
1182
|
+
const l = At(o, r, n);
|
|
1183
|
+
a = a.endsWith(".xls") ? a : `${a}.xls`, _t(l, a);
|
|
1184
1184
|
break;
|
|
1185
1185
|
}
|
|
1186
1186
|
case "json": {
|
|
@@ -1194,7 +1194,7 @@ class on extends R {
|
|
|
1194
1194
|
}), d = JSON.stringify(l, null, 2);
|
|
1195
1195
|
a = a.endsWith(".json") ? a : `${a}.json`;
|
|
1196
1196
|
const c = new Blob([d], { type: "application/json" });
|
|
1197
|
-
|
|
1197
|
+
de(c, a);
|
|
1198
1198
|
break;
|
|
1199
1199
|
}
|
|
1200
1200
|
}
|
|
@@ -1231,7 +1231,7 @@ class on extends R {
|
|
|
1231
1231
|
return this.lastExportInfo;
|
|
1232
1232
|
}
|
|
1233
1233
|
}
|
|
1234
|
-
function
|
|
1234
|
+
function Lt(s) {
|
|
1235
1235
|
const { totalRows: e, viewportHeight: t, scrollTop: i, rowHeight: n, overscan: r } = s, o = Math.ceil(t / n);
|
|
1236
1236
|
let a = Math.floor(i / n) - r;
|
|
1237
1237
|
a < 0 && (a = 0);
|
|
@@ -1243,10 +1243,10 @@ function _t(s) {
|
|
|
1243
1243
|
totalHeight: e * n
|
|
1244
1244
|
};
|
|
1245
1245
|
}
|
|
1246
|
-
function
|
|
1246
|
+
function Tt(s, e) {
|
|
1247
1247
|
return s <= e;
|
|
1248
1248
|
}
|
|
1249
|
-
function
|
|
1249
|
+
function It(s, e, t = !1) {
|
|
1250
1250
|
const i = s[e.field];
|
|
1251
1251
|
if (e.operator === "blank")
|
|
1252
1252
|
return i == null || i === "";
|
|
@@ -1285,10 +1285,10 @@ function Tt(s, e, t = !1) {
|
|
|
1285
1285
|
return !0;
|
|
1286
1286
|
}
|
|
1287
1287
|
}
|
|
1288
|
-
function
|
|
1289
|
-
return e.length ? s.filter((i) => e.every((n) =>
|
|
1288
|
+
function Pt(s, e, t = !1) {
|
|
1289
|
+
return e.length ? s.filter((i) => e.every((n) => It(i, n, t))) : s;
|
|
1290
1290
|
}
|
|
1291
|
-
function
|
|
1291
|
+
function Dt(s) {
|
|
1292
1292
|
return JSON.stringify(
|
|
1293
1293
|
s.map((e) => ({
|
|
1294
1294
|
field: e.field,
|
|
@@ -1306,7 +1306,7 @@ function Ee(s, e) {
|
|
|
1306
1306
|
}
|
|
1307
1307
|
return [...t].sort((i, n) => typeof i == "number" && typeof n == "number" ? i - n : String(i).localeCompare(String(n)));
|
|
1308
1308
|
}
|
|
1309
|
-
const Ft = '@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,display 0s allow-discrete;color:inherit;vertical-align:middle;transition-behavior:allow-discrete;&:hover,&.active{opacity:1;visibility:visible;display:inline-flex}&.active{color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6))}}.header-row .cell:hover .tbw-filter-btn,.header-row .cell.filtered .tbw-filter-btn{display:inline-flex;visibility:visible}}}',
|
|
1309
|
+
const Ft = '@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,display 0s allow-discrete;color:inherit;vertical-align:middle;transition-behavior:allow-discrete;&:hover,&.active{opacity:1;visibility:visible;display:inline-flex}&.active{color:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6))}}.header-row .cell:hover .tbw-filter-btn,.header-row .cell.filtered .tbw-filter-btn{display:inline-flex;visibility:visible}}}', Mt = "@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)))}}";
|
|
1310
1310
|
class T extends R {
|
|
1311
1311
|
name = "filtering";
|
|
1312
1312
|
styles = Ft;
|
|
@@ -1356,10 +1356,10 @@ class T extends R {
|
|
|
1356
1356
|
if (!t.length) return [...e];
|
|
1357
1357
|
if (this.config.filterHandler)
|
|
1358
1358
|
return this.cachedResult ? this.cachedResult : [...e];
|
|
1359
|
-
const i =
|
|
1359
|
+
const i = Dt(t);
|
|
1360
1360
|
if (this.cacheKey === i && this.cachedResult)
|
|
1361
1361
|
return this.cachedResult;
|
|
1362
|
-
const n =
|
|
1362
|
+
const n = Pt([...e], t, this.config.caseSensitive);
|
|
1363
1363
|
return this.cachedResult = n, this.cacheKey = i, n;
|
|
1364
1364
|
}
|
|
1365
1365
|
afterRender() {
|
|
@@ -1454,7 +1454,7 @@ class T extends R {
|
|
|
1454
1454
|
return;
|
|
1455
1455
|
}
|
|
1456
1456
|
const e = document.createElement("style");
|
|
1457
|
-
e.id = "tbw-filter-panel-styles", e.textContent =
|
|
1457
|
+
e.id = "tbw-filter-panel-styles", e.textContent = Mt, document.head.appendChild(e), this.globalStylesInjected = !0;
|
|
1458
1458
|
}
|
|
1459
1459
|
toggleFilterPanel(e, t, i) {
|
|
1460
1460
|
if (this.openPanelField === e) {
|
|
@@ -1543,7 +1543,7 @@ class T extends R {
|
|
|
1543
1543
|
const h = document.createElement("span");
|
|
1544
1544
|
h.textContent = "Select All", c.appendChild(u), c.appendChild(h), d.appendChild(c);
|
|
1545
1545
|
const g = () => {
|
|
1546
|
-
const y = [...w.values()], E = y.every((
|
|
1546
|
+
const y = [...w.values()], E = y.every((x) => x), A = y.every((x) => !x);
|
|
1547
1547
|
u.checked = E, u.indeterminate = !E && !A;
|
|
1548
1548
|
};
|
|
1549
1549
|
u.addEventListener("change", () => {
|
|
@@ -1565,41 +1565,41 @@ class T extends R {
|
|
|
1565
1565
|
}), g();
|
|
1566
1566
|
let b = [];
|
|
1567
1567
|
const v = (y, E) => {
|
|
1568
|
-
const A = y == null ? "(Blank)" : String(y),
|
|
1569
|
-
|
|
1568
|
+
const A = y == null ? "(Blank)" : String(y), x = y == null ? "__null__" : String(y), C = document.createElement("label");
|
|
1569
|
+
C.className = "tbw-filter-value-item", C.style.position = "absolute", C.style.top = `${E * o}px`, C.style.left = "0", C.style.right = "0", C.style.height = `${o}px`, C.style.boxSizing = "border-box";
|
|
1570
1570
|
const k = document.createElement("input");
|
|
1571
|
-
k.type = "checkbox", k.className = "tbw-filter-checkbox", k.checked = w.get(
|
|
1572
|
-
w.set(
|
|
1571
|
+
k.type = "checkbox", k.className = "tbw-filter-checkbox", k.checked = w.get(x) ?? !0, k.dataset.value = x, k.addEventListener("change", () => {
|
|
1572
|
+
w.set(x, k.checked), g();
|
|
1573
1573
|
});
|
|
1574
|
-
const
|
|
1575
|
-
return
|
|
1574
|
+
const he = document.createElement("span");
|
|
1575
|
+
return he.textContent = A, C.appendChild(k), C.appendChild(he), C;
|
|
1576
1576
|
}, S = () => {
|
|
1577
1577
|
const y = b.length, E = f.clientHeight, A = f.scrollTop;
|
|
1578
|
-
if (p.style.height = `${y * o}px`,
|
|
1579
|
-
m.innerHTML = "", m.style.transform = "translateY(0px)", b.forEach((
|
|
1580
|
-
m.appendChild(v(
|
|
1578
|
+
if (p.style.height = `${y * o}px`, Tt(y, T.LIST_BYPASS_THRESHOLD / 3)) {
|
|
1579
|
+
m.innerHTML = "", m.style.transform = "translateY(0px)", b.forEach((C, k) => {
|
|
1580
|
+
m.appendChild(v(C, k));
|
|
1581
1581
|
});
|
|
1582
1582
|
return;
|
|
1583
1583
|
}
|
|
1584
|
-
const
|
|
1584
|
+
const x = Lt({
|
|
1585
1585
|
totalRows: y,
|
|
1586
1586
|
viewportHeight: E,
|
|
1587
1587
|
scrollTop: A,
|
|
1588
1588
|
rowHeight: o,
|
|
1589
1589
|
overscan: T.LIST_OVERSCAN
|
|
1590
1590
|
});
|
|
1591
|
-
m.style.transform = `translateY(${
|
|
1592
|
-
for (let
|
|
1593
|
-
m.appendChild(v(b[
|
|
1594
|
-
},
|
|
1591
|
+
m.style.transform = `translateY(${x.offsetY}px)`, m.innerHTML = "";
|
|
1592
|
+
for (let C = x.start; C < x.end; C++)
|
|
1593
|
+
m.appendChild(v(b[C], C - x.start));
|
|
1594
|
+
}, K = (y) => {
|
|
1595
1595
|
const E = this.config.caseSensitive ?? !1, A = E ? y : y.toLowerCase();
|
|
1596
|
-
if (b = i.filter((
|
|
1597
|
-
const
|
|
1596
|
+
if (b = i.filter((x) => {
|
|
1597
|
+
const C = x == null ? "(Blank)" : String(x), k = E ? C : C.toLowerCase();
|
|
1598
1598
|
return !y || k.includes(A);
|
|
1599
1599
|
}), b.length === 0) {
|
|
1600
1600
|
p.style.height = "0px", m.innerHTML = "";
|
|
1601
|
-
const
|
|
1602
|
-
|
|
1601
|
+
const x = document.createElement("div");
|
|
1602
|
+
x.className = "tbw-filter-no-match", x.textContent = "No matching values", m.appendChild(x);
|
|
1603
1603
|
return;
|
|
1604
1604
|
}
|
|
1605
1605
|
S();
|
|
@@ -1610,11 +1610,11 @@ class T extends R {
|
|
|
1610
1610
|
b.length > 0 && S();
|
|
1611
1611
|
},
|
|
1612
1612
|
{ passive: !0 }
|
|
1613
|
-
),
|
|
1614
|
-
let
|
|
1613
|
+
), K(l.value), e.appendChild(f);
|
|
1614
|
+
let ue;
|
|
1615
1615
|
l.addEventListener("input", () => {
|
|
1616
|
-
clearTimeout(
|
|
1617
|
-
this.searchText.set(r, l.value),
|
|
1616
|
+
clearTimeout(ue), ue = setTimeout(() => {
|
|
1617
|
+
this.searchText.set(r, l.value), K(l.value);
|
|
1618
1618
|
}, this.config.debounceMs ?? 150);
|
|
1619
1619
|
});
|
|
1620
1620
|
const G = document.createElement("div");
|
|
@@ -1627,8 +1627,8 @@ class T extends R {
|
|
|
1627
1627
|
if (E === "__null__")
|
|
1628
1628
|
y.push(null);
|
|
1629
1629
|
else {
|
|
1630
|
-
const
|
|
1631
|
-
y.push(
|
|
1630
|
+
const x = i.find((C) => String(C) === E);
|
|
1631
|
+
y.push(x !== void 0 ? x : E);
|
|
1632
1632
|
}
|
|
1633
1633
|
t.applySetFilter(y);
|
|
1634
1634
|
}), G.appendChild(O);
|
|
@@ -1736,7 +1736,7 @@ function Se(s) {
|
|
|
1736
1736
|
}, e.set(d, c), t.push(c)), c.columns.push(o);
|
|
1737
1737
|
}), n.length && i(r, n), t.length === 1 && t[0].implicit && t[0].columns.length === s.length ? [] : t;
|
|
1738
1738
|
}
|
|
1739
|
-
function
|
|
1739
|
+
function qt(s, e, t) {
|
|
1740
1740
|
if (!e.length || !s) return;
|
|
1741
1741
|
const i = /* @__PURE__ */ new Map();
|
|
1742
1742
|
for (const r of e)
|
|
@@ -1752,7 +1752,7 @@ function Mt(s, e, t) {
|
|
|
1752
1752
|
a && a.classList.add("group-end");
|
|
1753
1753
|
}
|
|
1754
1754
|
}
|
|
1755
|
-
function
|
|
1755
|
+
function Kt(s, e) {
|
|
1756
1756
|
if (s.length === 0) return null;
|
|
1757
1757
|
const t = document.createElement("div");
|
|
1758
1758
|
t.className = "header-group-row", t.setAttribute("role", "row");
|
|
@@ -1768,7 +1768,7 @@ function Nt(s) {
|
|
|
1768
1768
|
return s.some((e) => e.group != null);
|
|
1769
1769
|
}
|
|
1770
1770
|
const Ht = "@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)}}";
|
|
1771
|
-
class
|
|
1771
|
+
class ln extends R {
|
|
1772
1772
|
static manifest = {
|
|
1773
1773
|
ownedProperties: [
|
|
1774
1774
|
{
|
|
@@ -1831,14 +1831,14 @@ class sn extends R {
|
|
|
1831
1831
|
t && t.remove();
|
|
1832
1832
|
const i = this.columns, n = Se(i);
|
|
1833
1833
|
if (n.length === 0) return;
|
|
1834
|
-
const r =
|
|
1834
|
+
const r = Kt(n, i);
|
|
1835
1835
|
if (r) {
|
|
1836
1836
|
r.classList.toggle("no-borders", !this.config.showGroupBorders);
|
|
1837
1837
|
const a = e.querySelector(".header-row");
|
|
1838
1838
|
a ? e.insertBefore(r, a) : e.appendChild(r);
|
|
1839
1839
|
}
|
|
1840
1840
|
const o = e.querySelector(".header-row");
|
|
1841
|
-
o && (o.classList.toggle("no-group-borders", !this.config.showGroupBorders),
|
|
1841
|
+
o && (o.classList.toggle("no-group-borders", !this.config.showGroupBorders), qt(o, n)), this.#e(n);
|
|
1842
1842
|
}
|
|
1843
1843
|
#e(e) {
|
|
1844
1844
|
if (!this.config.showGroupBorders) return;
|
|
@@ -1869,38 +1869,38 @@ class sn extends R {
|
|
|
1869
1869
|
this.requestRender();
|
|
1870
1870
|
}
|
|
1871
1871
|
}
|
|
1872
|
-
function
|
|
1873
|
-
const
|
|
1874
|
-
if (typeof
|
|
1872
|
+
function ke({ rows: s, config: e, expanded: t, initialExpanded: i }) {
|
|
1873
|
+
const n = e.groupOn;
|
|
1874
|
+
if (typeof n != "function")
|
|
1875
1875
|
return [];
|
|
1876
|
-
const
|
|
1877
|
-
if (s.forEach((
|
|
1878
|
-
let
|
|
1879
|
-
|
|
1880
|
-
let
|
|
1881
|
-
|
|
1882
|
-
const
|
|
1883
|
-
let
|
|
1884
|
-
|
|
1885
|
-
}),
|
|
1886
|
-
}),
|
|
1876
|
+
const r = { key: "__root__", value: null, depth: -1, rows: [], children: /* @__PURE__ */ new Map() };
|
|
1877
|
+
if (s.forEach((d) => {
|
|
1878
|
+
let c = n(d);
|
|
1879
|
+
c == null || c === !1 ? c = ["__ungrouped__"] : Array.isArray(c) || (c = [c]);
|
|
1880
|
+
let u = r;
|
|
1881
|
+
c.forEach((h, g) => {
|
|
1882
|
+
const f = h == null ? "∅" : String(h), p = u.key === "__root__" ? f : u.key + "||" + f;
|
|
1883
|
+
let m = u.children.get(f);
|
|
1884
|
+
m || (m = { key: p, value: h, depth: g, rows: [], children: /* @__PURE__ */ new Map(), parent: u }, u.children.set(f, m)), u = m;
|
|
1885
|
+
}), u.rows.push(d);
|
|
1886
|
+
}), r.children.size === 1 && r.children.has("__ungrouped__") && r.children.get("__ungrouped__").rows.length === s.length)
|
|
1887
1887
|
return [];
|
|
1888
|
-
const
|
|
1889
|
-
if (
|
|
1890
|
-
|
|
1888
|
+
const o = /* @__PURE__ */ new Set([...t, ...i ?? []]), a = [], l = (d) => {
|
|
1889
|
+
if (d === r) {
|
|
1890
|
+
d.children.forEach((u) => l(u));
|
|
1891
1891
|
return;
|
|
1892
1892
|
}
|
|
1893
|
-
const
|
|
1894
|
-
|
|
1893
|
+
const c = o.has(d.key);
|
|
1894
|
+
a.push({
|
|
1895
1895
|
kind: "group",
|
|
1896
|
-
key:
|
|
1897
|
-
value:
|
|
1898
|
-
depth:
|
|
1899
|
-
rows:
|
|
1900
|
-
expanded:
|
|
1901
|
-
}),
|
|
1896
|
+
key: d.key,
|
|
1897
|
+
value: d.value,
|
|
1898
|
+
depth: d.depth,
|
|
1899
|
+
rows: d.rows,
|
|
1900
|
+
expanded: c
|
|
1901
|
+
}), c && (d.children.size ? d.children.forEach((u) => l(u)) : d.rows.forEach((u) => a.push({ kind: "data", row: u, rowIndex: s.indexOf(u) })));
|
|
1902
1902
|
};
|
|
1903
|
-
return
|
|
1903
|
+
return l(r), a;
|
|
1904
1904
|
}
|
|
1905
1905
|
function zt(s, e) {
|
|
1906
1906
|
const t = new Set(s);
|
|
@@ -1915,20 +1915,48 @@ function Gt(s) {
|
|
|
1915
1915
|
function Ot() {
|
|
1916
1916
|
return /* @__PURE__ */ new Set();
|
|
1917
1917
|
}
|
|
1918
|
-
function Bt(s) {
|
|
1918
|
+
function Bt(s, e) {
|
|
1919
|
+
if (s === !0)
|
|
1920
|
+
return new Set(e);
|
|
1921
|
+
if (s === !1 || s == null)
|
|
1922
|
+
return /* @__PURE__ */ new Set();
|
|
1923
|
+
if (typeof s == "number") {
|
|
1924
|
+
const t = e[s];
|
|
1925
|
+
return t ? /* @__PURE__ */ new Set([t]) : /* @__PURE__ */ new Set();
|
|
1926
|
+
}
|
|
1927
|
+
return typeof s == "string" ? /* @__PURE__ */ new Set([s]) : Array.isArray(s) ? new Set(s) : /* @__PURE__ */ new Set();
|
|
1928
|
+
}
|
|
1929
|
+
function Vt(s) {
|
|
1930
|
+
return s.filter((e) => e.kind === "group").map((e) => e.key);
|
|
1931
|
+
}
|
|
1932
|
+
function Wt(s) {
|
|
1919
1933
|
return s.kind !== "group" ? 0 : s.rows.length;
|
|
1920
1934
|
}
|
|
1921
|
-
const
|
|
1922
|
-
class
|
|
1935
|
+
const $t = "@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-aggregates{display:inline-flex;align-items:center;gap:var(--tbw-spacing-lg, 1rem);margin-left:var(--tbw-spacing-lg, 1rem);font-weight:400;font-size:var(--tbw-font-size-sm, .875em);color:var(--tbw-grouping-rows-aggregate-color, var(--tbw-color-fg-muted))}.group-aggregate{white-space:nowrap}.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}}}";
|
|
1936
|
+
class dn extends R {
|
|
1937
|
+
static manifest = {
|
|
1938
|
+
configRules: [
|
|
1939
|
+
{
|
|
1940
|
+
id: "groupingRows/accordion-defaultExpanded",
|
|
1941
|
+
severity: "warn",
|
|
1942
|
+
message: `"accordion: true" and "defaultExpanded" (non-false) are used together.
|
|
1943
|
+
→ In accordion mode, only one group can be open at a time.
|
|
1944
|
+
→ Using defaultExpanded with multiple groups will collapse to one on first toggle.
|
|
1945
|
+
→ Consider using "defaultExpanded: false" or a single group key/index with accordion mode.`,
|
|
1946
|
+
check: (e) => e.accordion === !0 && e.defaultExpanded !== !1 && e.defaultExpanded !== void 0 && typeof e.defaultExpanded != "number" && typeof e.defaultExpanded != "string" && (e.defaultExpanded === !0 || Array.isArray(e.defaultExpanded) && e.defaultExpanded.length > 1)
|
|
1947
|
+
}
|
|
1948
|
+
]
|
|
1949
|
+
};
|
|
1923
1950
|
name = "groupingRows";
|
|
1924
|
-
styles =
|
|
1951
|
+
styles = $t;
|
|
1925
1952
|
get defaultConfig() {
|
|
1926
1953
|
return {
|
|
1927
1954
|
defaultExpanded: !1,
|
|
1928
1955
|
showRowCount: !0,
|
|
1929
1956
|
indentWidth: 20,
|
|
1930
1957
|
aggregators: {},
|
|
1931
|
-
animation: "slide"
|
|
1958
|
+
animation: "slide",
|
|
1959
|
+
accordion: !1
|
|
1932
1960
|
};
|
|
1933
1961
|
}
|
|
1934
1962
|
expandedKeys = /* @__PURE__ */ new Set();
|
|
@@ -1936,11 +1964,12 @@ class an extends R {
|
|
|
1936
1964
|
isActive = !1;
|
|
1937
1965
|
previousVisibleKeys = /* @__PURE__ */ new Set();
|
|
1938
1966
|
keysToAnimate = /* @__PURE__ */ new Set();
|
|
1967
|
+
hasAppliedDefaultExpanded = !1;
|
|
1939
1968
|
get animationStyle() {
|
|
1940
1969
|
return this.isAnimationEnabled ? this.config.animation ?? "slide" : !1;
|
|
1941
1970
|
}
|
|
1942
1971
|
detach() {
|
|
1943
|
-
this.expandedKeys.clear(), this.flattenedRows = [], this.isActive = !1, this.previousVisibleKeys.clear(), this.keysToAnimate.clear();
|
|
1972
|
+
this.expandedKeys.clear(), this.flattenedRows = [], this.isActive = !1, this.previousVisibleKeys.clear(), this.keysToAnimate.clear(), this.hasAppliedDefaultExpanded = !1;
|
|
1944
1973
|
}
|
|
1945
1974
|
static detect(e, t) {
|
|
1946
1975
|
return typeof t?.groupOn == "function" || typeof t?.enableRowGrouping == "boolean";
|
|
@@ -1949,29 +1978,40 @@ class an extends R {
|
|
|
1949
1978
|
const t = this.config;
|
|
1950
1979
|
if (typeof t.groupOn != "function")
|
|
1951
1980
|
return this.isActive = !1, this.flattenedRows = [], [...e];
|
|
1952
|
-
const i =
|
|
1981
|
+
const i = ke({
|
|
1953
1982
|
rows: [...e],
|
|
1954
1983
|
config: t,
|
|
1955
|
-
expanded:
|
|
1984
|
+
expanded: /* @__PURE__ */ new Set()
|
|
1956
1985
|
});
|
|
1957
1986
|
if (i.length === 0)
|
|
1958
1987
|
return this.isActive = !1, this.flattenedRows = [], [...e];
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1988
|
+
let n;
|
|
1989
|
+
if (!this.hasAppliedDefaultExpanded && this.expandedKeys.size === 0 && t.defaultExpanded !== !1) {
|
|
1990
|
+
const a = Vt(i);
|
|
1991
|
+
n = Bt(t.defaultExpanded ?? !1, a), n.size > 0 && (this.expandedKeys = new Set(n), this.hasAppliedDefaultExpanded = !0);
|
|
1992
|
+
}
|
|
1993
|
+
const r = ke({
|
|
1994
|
+
rows: [...e],
|
|
1995
|
+
config: t,
|
|
1996
|
+
expanded: this.expandedKeys,
|
|
1997
|
+
initialExpanded: n
|
|
1998
|
+
});
|
|
1999
|
+
this.isActive = !0, this.flattenedRows = r, this.keysToAnimate.clear();
|
|
2000
|
+
const o = /* @__PURE__ */ new Set();
|
|
2001
|
+
return r.forEach((a, l) => {
|
|
2002
|
+
if (a.kind === "data") {
|
|
2003
|
+
const d = `data-${l}`;
|
|
2004
|
+
o.add(d), this.previousVisibleKeys.has(d) || this.keysToAnimate.add(d);
|
|
1965
2005
|
}
|
|
1966
|
-
}), this.previousVisibleKeys =
|
|
2006
|
+
}), this.previousVisibleKeys = o, r.map((a) => a.kind === "group" ? {
|
|
1967
2007
|
__isGroupRow: !0,
|
|
1968
|
-
__groupKey:
|
|
1969
|
-
__groupValue:
|
|
1970
|
-
__groupDepth:
|
|
1971
|
-
__groupRows:
|
|
1972
|
-
__groupExpanded:
|
|
1973
|
-
__groupRowCount:
|
|
1974
|
-
} :
|
|
2008
|
+
__groupKey: a.key,
|
|
2009
|
+
__groupValue: a.value,
|
|
2010
|
+
__groupDepth: a.depth,
|
|
2011
|
+
__groupRows: a.rows,
|
|
2012
|
+
__groupExpanded: a.expanded,
|
|
2013
|
+
__groupRowCount: Wt(a)
|
|
2014
|
+
} : a.row);
|
|
1975
2015
|
}
|
|
1976
2016
|
onCellClick(e) {
|
|
1977
2017
|
const t = e.row;
|
|
@@ -2030,14 +2070,29 @@ class an extends R {
|
|
|
2030
2070
|
return n.formatLabel ? n.formatLabel(e, t, i) : String(e);
|
|
2031
2071
|
}
|
|
2032
2072
|
renderFullWidthGroupRow(e, t, i) {
|
|
2033
|
-
const n = this.config, r = document.createElement("div");
|
|
2034
|
-
|
|
2035
|
-
const
|
|
2036
|
-
if (
|
|
2037
|
-
const
|
|
2038
|
-
|
|
2073
|
+
const n = this.config, r = n.aggregators ?? {}, o = e.__groupRows ?? [], a = document.createElement("div");
|
|
2074
|
+
a.className = "cell group-full", a.style.gridColumn = "1 / -1", a.setAttribute("role", "gridcell"), a.setAttribute("data-col", "0"), a.appendChild(this.createToggleButton(e.__groupExpanded, i));
|
|
2075
|
+
const l = document.createElement("span");
|
|
2076
|
+
if (l.className = "group-label", l.textContent = this.getGroupLabelText(e.__groupValue, e.__groupDepth || 0, e.__groupKey), a.appendChild(l), n.showRowCount !== !1) {
|
|
2077
|
+
const c = document.createElement("span");
|
|
2078
|
+
c.className = "group-count", c.textContent = `(${e.__groupRowCount ?? e.__groupRows?.length ?? 0})`, a.appendChild(c);
|
|
2039
2079
|
}
|
|
2040
|
-
|
|
2080
|
+
const d = Object.entries(r);
|
|
2081
|
+
if (d.length > 0) {
|
|
2082
|
+
const c = document.createElement("span");
|
|
2083
|
+
c.className = "group-aggregates";
|
|
2084
|
+
for (const [u, h] of d) {
|
|
2085
|
+
const g = this.columns.find((p) => p.field === u), f = j(h, o, u, g);
|
|
2086
|
+
if (f != null) {
|
|
2087
|
+
const p = document.createElement("span");
|
|
2088
|
+
p.className = "group-aggregate", p.setAttribute("data-field", u);
|
|
2089
|
+
const m = g?.header ?? u;
|
|
2090
|
+
p.textContent = `${m}: ${f}`, c.appendChild(p);
|
|
2091
|
+
}
|
|
2092
|
+
}
|
|
2093
|
+
c.children.length > 0 && a.appendChild(c);
|
|
2094
|
+
}
|
|
2095
|
+
t.appendChild(a);
|
|
2041
2096
|
}
|
|
2042
2097
|
renderPerColumnGroupRow(e, t, i) {
|
|
2043
2098
|
const n = this.config, r = n.aggregators ?? {}, o = this.columns, a = e.__groupRows ?? [], d = this.gridElement?.querySelector(".body")?.style.gridTemplateColumns || "";
|
|
@@ -2045,14 +2100,14 @@ class an extends R {
|
|
|
2045
2100
|
let c = !1;
|
|
2046
2101
|
o.forEach((u, h) => {
|
|
2047
2102
|
const g = document.createElement("div");
|
|
2048
|
-
if (g.className = "cell group-cell", g.setAttribute("data-col", String(h)), g.setAttribute("role", "gridcell"),
|
|
2103
|
+
if (g.className = "cell group-cell", g.setAttribute("data-col", String(h)), g.setAttribute("role", "gridcell"), ae(u)) {
|
|
2049
2104
|
g.setAttribute("data-field", u.field), t.appendChild(g);
|
|
2050
2105
|
return;
|
|
2051
2106
|
}
|
|
2052
2107
|
if (c) {
|
|
2053
2108
|
const f = r[u.field];
|
|
2054
2109
|
if (f) {
|
|
2055
|
-
const p =
|
|
2110
|
+
const p = j(f, a, u.field, u);
|
|
2056
2111
|
g.textContent = p != null ? String(p) : "";
|
|
2057
2112
|
} else
|
|
2058
2113
|
g.textContent = "";
|
|
@@ -2060,7 +2115,7 @@ class an extends R {
|
|
|
2060
2115
|
c = !0, g.appendChild(this.createToggleButton(e.__groupExpanded, i));
|
|
2061
2116
|
const f = document.createElement("span"), p = r[u.field];
|
|
2062
2117
|
if (p) {
|
|
2063
|
-
const m =
|
|
2118
|
+
const m = j(p, a, u.field, u);
|
|
2064
2119
|
f.textContent = m != null ? String(m) : String(e.__groupValue);
|
|
2065
2120
|
} else
|
|
2066
2121
|
f.textContent = this.getGroupLabelText(e.__groupValue, e.__groupDepth || 0, e.__groupKey);
|
|
@@ -2079,13 +2134,24 @@ class an extends R {
|
|
|
2079
2134
|
this.expandedKeys = Ot(), this.requestRender();
|
|
2080
2135
|
}
|
|
2081
2136
|
toggle(e) {
|
|
2082
|
-
this.expandedKeys =
|
|
2083
|
-
|
|
2137
|
+
const t = !this.expandedKeys.has(e), i = this.config, n = this.flattenedRows.find((r) => r.kind === "group" && r.key === e);
|
|
2138
|
+
if (i.accordion && t && n) {
|
|
2139
|
+
const r = /* @__PURE__ */ new Set();
|
|
2140
|
+
for (const o of this.expandedKeys)
|
|
2141
|
+
if (e.startsWith(o + "||") || o.startsWith(e + "||"))
|
|
2142
|
+
e.startsWith(o + "||") && r.add(o);
|
|
2143
|
+
else {
|
|
2144
|
+
const a = this.flattenedRows.find((l) => l.kind === "group" && l.key === o);
|
|
2145
|
+
a && a.depth !== n.depth && r.add(o);
|
|
2146
|
+
}
|
|
2147
|
+
r.add(e), this.expandedKeys = r;
|
|
2148
|
+
} else
|
|
2149
|
+
this.expandedKeys = zt(this.expandedKeys, e);
|
|
2084
2150
|
this.emit("group-toggle", {
|
|
2085
2151
|
key: e,
|
|
2086
2152
|
expanded: this.expandedKeys.has(e),
|
|
2087
|
-
value:
|
|
2088
|
-
depth:
|
|
2153
|
+
value: n?.value,
|
|
2154
|
+
depth: n?.depth ?? 0
|
|
2089
2155
|
}), this.requestRender();
|
|
2090
2156
|
}
|
|
2091
2157
|
isExpanded(e) {
|
|
@@ -2128,22 +2194,22 @@ class an extends R {
|
|
|
2128
2194
|
this.config.groupOn = e, this.requestRender();
|
|
2129
2195
|
}
|
|
2130
2196
|
}
|
|
2131
|
-
function
|
|
2197
|
+
function Ae(s, e) {
|
|
2132
2198
|
const t = new Set(s);
|
|
2133
2199
|
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
2134
2200
|
}
|
|
2135
|
-
function
|
|
2201
|
+
function jt(s, e) {
|
|
2136
2202
|
const t = new Set(s);
|
|
2137
2203
|
return t.add(e), t;
|
|
2138
2204
|
}
|
|
2139
|
-
function
|
|
2205
|
+
function Ut(s, e) {
|
|
2140
2206
|
const t = new Set(s);
|
|
2141
2207
|
return t.delete(e), t;
|
|
2142
2208
|
}
|
|
2143
|
-
function
|
|
2209
|
+
function Yt(s, e) {
|
|
2144
2210
|
return s.has(e);
|
|
2145
2211
|
}
|
|
2146
|
-
function
|
|
2212
|
+
function Xt(s, e, t, i) {
|
|
2147
2213
|
const n = document.createElement("div");
|
|
2148
2214
|
n.className = "master-detail-row", n.setAttribute("data-detail-for", String(e)), n.setAttribute("role", "row");
|
|
2149
2215
|
const r = document.createElement("div");
|
|
@@ -2151,10 +2217,10 @@ function Ut(s, e, t, i) {
|
|
|
2151
2217
|
const o = t(s, e);
|
|
2152
2218
|
return typeof o == "string" ? r.innerHTML = o : o instanceof HTMLElement && r.appendChild(o), n.appendChild(r), n;
|
|
2153
2219
|
}
|
|
2154
|
-
const
|
|
2155
|
-
class
|
|
2220
|
+
const Zt = "@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}}}";
|
|
2221
|
+
class je extends R {
|
|
2156
2222
|
name = "masterDetail";
|
|
2157
|
-
styles =
|
|
2223
|
+
styles = Zt;
|
|
2158
2224
|
get defaultConfig() {
|
|
2159
2225
|
return {
|
|
2160
2226
|
detailHeight: "auto",
|
|
@@ -2183,8 +2249,8 @@ class $e extends R {
|
|
|
2183
2249
|
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));
|
|
2184
2250
|
const c = t.innerHTML.trim();
|
|
2185
2251
|
c && !this.config.detailRenderer && (d.detailRenderer = (u, h) => {
|
|
2186
|
-
const g =
|
|
2187
|
-
return
|
|
2252
|
+
const g = et(c, { value: u, row: u });
|
|
2253
|
+
return tt(g);
|
|
2188
2254
|
}), Object.keys(d).length > 0 && (this.config = { ...this.config, ...d });
|
|
2189
2255
|
}
|
|
2190
2256
|
get animationStyle() {
|
|
@@ -2215,10 +2281,10 @@ class $e extends R {
|
|
|
2215
2281
|
static DEFAULT_DETAIL_HEIGHT = 150;
|
|
2216
2282
|
getDetailHeight(e) {
|
|
2217
2283
|
const t = this.detailElements.get(e);
|
|
2218
|
-
return t ? t.offsetHeight : typeof this.config?.detailHeight == "number" ? this.config.detailHeight :
|
|
2284
|
+
return t ? t.offsetHeight : typeof this.config?.detailHeight == "number" ? this.config.detailHeight : je.DEFAULT_DETAIL_HEIGHT;
|
|
2219
2285
|
}
|
|
2220
2286
|
toggleAndEmit(e, t) {
|
|
2221
|
-
this.expandedRows =
|
|
2287
|
+
this.expandedRows = Ae(this.expandedRows, e), this.emit("detail-expand", {
|
|
2222
2288
|
rowIndex: t,
|
|
2223
2289
|
row: e,
|
|
2224
2290
|
expanded: this.expandedRows.has(e)
|
|
@@ -2231,9 +2297,9 @@ class $e extends R {
|
|
|
2231
2297
|
if (!(this.config.showExpandColumn === !0 || this.config.showExpandColumn !== !1 && !!this.config.detailRenderer))
|
|
2232
2298
|
return [...e];
|
|
2233
2299
|
const i = [...e];
|
|
2234
|
-
if (
|
|
2300
|
+
if (ot(i))
|
|
2235
2301
|
return i;
|
|
2236
|
-
const r =
|
|
2302
|
+
const r = st(this.name);
|
|
2237
2303
|
return r.viewRenderer = (o) => {
|
|
2238
2304
|
const { row: a } = o, l = this.expandedRows.has(a), d = document.createElement("span");
|
|
2239
2305
|
d.className = "master-detail-expander expander-cell";
|
|
@@ -2253,7 +2319,7 @@ class $e extends R {
|
|
|
2253
2319
|
onKeyDown(e) {
|
|
2254
2320
|
if (e.key !== " ") return;
|
|
2255
2321
|
const t = this.grid._focusCol, i = this.grid._focusRow, n = this.columns[t];
|
|
2256
|
-
if (!n || !
|
|
2322
|
+
if (!n || !ae(n)) return;
|
|
2257
2323
|
const r = this.rows[i];
|
|
2258
2324
|
if (r)
|
|
2259
2325
|
return e.preventDefault(), this.toggleAndEmit(r, i), this.requestRenderWithFocus(), !0;
|
|
@@ -2286,7 +2352,7 @@ class $e extends R {
|
|
|
2286
2352
|
d.previousElementSibling !== a && a.after(d);
|
|
2287
2353
|
continue;
|
|
2288
2354
|
}
|
|
2289
|
-
const c =
|
|
2355
|
+
const c = Xt(l, o, this.config.detailRenderer, n);
|
|
2290
2356
|
typeof this.config.detailHeight == "number" && (c.style.height = `${this.config.detailHeight}px`), a.after(c), this.detailElements.set(l, c), this.animateExpand(c);
|
|
2291
2357
|
}
|
|
2292
2358
|
}
|
|
@@ -2321,19 +2387,19 @@ class $e extends R {
|
|
|
2321
2387
|
}
|
|
2322
2388
|
expand(e) {
|
|
2323
2389
|
const t = this.rows[e];
|
|
2324
|
-
t && (this.expandedRows =
|
|
2390
|
+
t && (this.expandedRows = jt(this.expandedRows, t), this.requestRender());
|
|
2325
2391
|
}
|
|
2326
2392
|
collapse(e) {
|
|
2327
2393
|
const t = this.rows[e];
|
|
2328
|
-
t && (this.expandedRows =
|
|
2394
|
+
t && (this.expandedRows = Ut(this.expandedRows, t), this.requestRender());
|
|
2329
2395
|
}
|
|
2330
2396
|
toggle(e) {
|
|
2331
2397
|
const t = this.rows[e];
|
|
2332
|
-
t && (this.expandedRows =
|
|
2398
|
+
t && (this.expandedRows = Ae(this.expandedRows, t), this.requestRender());
|
|
2333
2399
|
}
|
|
2334
2400
|
isExpanded(e) {
|
|
2335
2401
|
const t = this.rows[e];
|
|
2336
|
-
return t ?
|
|
2402
|
+
return t ? Yt(this.expandedRows, t) : !1;
|
|
2337
2403
|
}
|
|
2338
2404
|
expandAll() {
|
|
2339
2405
|
for (const e of this.rows)
|
|
@@ -2363,34 +2429,34 @@ class $e extends R {
|
|
|
2363
2429
|
}
|
|
2364
2430
|
}
|
|
2365
2431
|
}
|
|
2366
|
-
function
|
|
2432
|
+
function Jt(s, e, t) {
|
|
2367
2433
|
return e.length ? [...s].sort((i, n) => {
|
|
2368
2434
|
for (const r of e) {
|
|
2369
|
-
const a = t.find((u) => u.field === r.field)?.sortComparator ??
|
|
2435
|
+
const a = t.find((u) => u.field === r.field)?.sortComparator ?? Qt, l = i[r.field], d = n[r.field], c = a(l, d, i, n);
|
|
2370
2436
|
if (c !== 0)
|
|
2371
2437
|
return r.direction === "asc" ? c : -c;
|
|
2372
2438
|
}
|
|
2373
2439
|
return 0;
|
|
2374
2440
|
}) : [...s];
|
|
2375
2441
|
}
|
|
2376
|
-
function
|
|
2442
|
+
function Qt(s, e) {
|
|
2377
2443
|
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));
|
|
2378
2444
|
}
|
|
2379
|
-
function
|
|
2445
|
+
function ei(s, e, t, i) {
|
|
2380
2446
|
const n = s.find((r) => r.field === e);
|
|
2381
2447
|
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" }];
|
|
2382
2448
|
}
|
|
2383
|
-
function
|
|
2449
|
+
function _e(s, e) {
|
|
2384
2450
|
const t = s.findIndex((i) => i.field === e);
|
|
2385
2451
|
return t >= 0 ? t + 1 : void 0;
|
|
2386
2452
|
}
|
|
2387
|
-
function
|
|
2453
|
+
function Le(s, e) {
|
|
2388
2454
|
return s.find((t) => t.field === e)?.direction;
|
|
2389
2455
|
}
|
|
2390
|
-
const
|
|
2391
|
-
class
|
|
2456
|
+
const ti = '@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}}';
|
|
2457
|
+
class cn extends R {
|
|
2392
2458
|
name = "multiSort";
|
|
2393
|
-
styles =
|
|
2459
|
+
styles = ti;
|
|
2394
2460
|
get defaultConfig() {
|
|
2395
2461
|
return {
|
|
2396
2462
|
maxSortColumns: 3,
|
|
@@ -2402,12 +2468,12 @@ class ln extends R {
|
|
|
2402
2468
|
this.sortModel = [];
|
|
2403
2469
|
}
|
|
2404
2470
|
processRows(e) {
|
|
2405
|
-
return this.sortModel.length === 0 ? [...e] :
|
|
2471
|
+
return this.sortModel.length === 0 ? [...e] : Jt([...e], this.sortModel, [...this.columns]);
|
|
2406
2472
|
}
|
|
2407
2473
|
onHeaderClick(e) {
|
|
2408
2474
|
if (!this.columns.find((r) => r.field === e.field)?.sortable) return !1;
|
|
2409
2475
|
const i = e.originalEvent.shiftKey, n = this.config.maxSortColumns ?? 3;
|
|
2410
|
-
return this.sortModel =
|
|
2476
|
+
return this.sortModel = ei(this.sortModel, e.field, i, n), this.emit("sort-change", { sortModel: [...this.sortModel] }), this.requestRender(), !0;
|
|
2411
2477
|
}
|
|
2412
2478
|
afterRender() {
|
|
2413
2479
|
const e = this.gridElement;
|
|
@@ -2416,7 +2482,7 @@ class ln extends R {
|
|
|
2416
2482
|
e.querySelectorAll(".header-row .cell[data-field]").forEach((n) => {
|
|
2417
2483
|
const r = n.getAttribute("data-field");
|
|
2418
2484
|
if (!r) return;
|
|
2419
|
-
const o =
|
|
2485
|
+
const o = _e(this.sortModel, r), a = Le(this.sortModel, r);
|
|
2420
2486
|
if (n.querySelector(".sort-index")?.remove(), a) {
|
|
2421
2487
|
n.querySelector('[part~="sort-indicator"], .sort-indicator')?.remove(), n.setAttribute("data-sort", a);
|
|
2422
2488
|
const c = document.createElement("span");
|
|
@@ -2440,10 +2506,10 @@ class ln extends R {
|
|
|
2440
2506
|
this.sortModel = [], this.emit("sort-change", { sortModel: [] }), this.requestRender();
|
|
2441
2507
|
}
|
|
2442
2508
|
getSortIndex(e) {
|
|
2443
|
-
return
|
|
2509
|
+
return _e(this.sortModel, e);
|
|
2444
2510
|
}
|
|
2445
2511
|
getSortDirection(e) {
|
|
2446
|
-
return
|
|
2512
|
+
return Le(this.sortModel, e);
|
|
2447
2513
|
}
|
|
2448
2514
|
getColumnState(e) {
|
|
2449
2515
|
const t = this.sortModel.findIndex((n) => n.field === e);
|
|
@@ -2466,16 +2532,16 @@ class ln extends R {
|
|
|
2466
2532
|
i !== -1 ? this.sortModel[i] = n : this.sortModel.splice(t.sort.priority, 0, n);
|
|
2467
2533
|
}
|
|
2468
2534
|
}
|
|
2469
|
-
function
|
|
2535
|
+
function ii(s) {
|
|
2470
2536
|
return s.filter((e) => e.sticky === "left");
|
|
2471
2537
|
}
|
|
2472
|
-
function
|
|
2538
|
+
function ni(s) {
|
|
2473
2539
|
return s.filter((e) => e.sticky === "right");
|
|
2474
2540
|
}
|
|
2475
|
-
function
|
|
2541
|
+
function Q(s) {
|
|
2476
2542
|
return s.some((e) => e.sticky === "left" || e.sticky === "right");
|
|
2477
2543
|
}
|
|
2478
|
-
function
|
|
2544
|
+
function Te(s, e) {
|
|
2479
2545
|
const t = Array.from(s.querySelectorAll(".header-row .cell"));
|
|
2480
2546
|
if (!t.length) return;
|
|
2481
2547
|
const i = /* @__PURE__ */ new Map();
|
|
@@ -2499,12 +2565,12 @@ function Le(s, e) {
|
|
|
2499
2565
|
}), r += l.offsetWidth);
|
|
2500
2566
|
}
|
|
2501
2567
|
}
|
|
2502
|
-
function
|
|
2568
|
+
function Ie(s) {
|
|
2503
2569
|
s.querySelectorAll(".sticky-left, .sticky-right").forEach((t) => {
|
|
2504
2570
|
t.classList.remove("sticky-left", "sticky-right"), t.style.position = "", t.style.left = "", t.style.right = "";
|
|
2505
2571
|
});
|
|
2506
2572
|
}
|
|
2507
|
-
class
|
|
2573
|
+
class un extends R {
|
|
2508
2574
|
static manifest = {
|
|
2509
2575
|
ownedProperties: [
|
|
2510
2576
|
{
|
|
@@ -2527,26 +2593,26 @@ class dn extends R {
|
|
|
2527
2593
|
}
|
|
2528
2594
|
static detect(e, t) {
|
|
2529
2595
|
const i = t?.columns;
|
|
2530
|
-
return Array.isArray(i) ?
|
|
2596
|
+
return Array.isArray(i) ? Q(i) : !1;
|
|
2531
2597
|
}
|
|
2532
2598
|
processColumns(e) {
|
|
2533
|
-
return this.isApplied =
|
|
2599
|
+
return this.isApplied = Q([...e]), [...e];
|
|
2534
2600
|
}
|
|
2535
2601
|
afterRender() {
|
|
2536
2602
|
if (!this.isApplied)
|
|
2537
2603
|
return;
|
|
2538
2604
|
const e = this.grid, t = [...this.columns];
|
|
2539
|
-
if (!
|
|
2540
|
-
|
|
2605
|
+
if (!Q(t)) {
|
|
2606
|
+
Ie(e), this.isApplied = !1;
|
|
2541
2607
|
return;
|
|
2542
2608
|
}
|
|
2543
2609
|
queueMicrotask(() => {
|
|
2544
|
-
|
|
2610
|
+
Te(e, t);
|
|
2545
2611
|
});
|
|
2546
2612
|
}
|
|
2547
2613
|
onPluginQuery(e) {
|
|
2548
2614
|
switch (e.type) {
|
|
2549
|
-
case
|
|
2615
|
+
case We.CAN_MOVE_COLUMN: {
|
|
2550
2616
|
const t = e.context, i = t.sticky;
|
|
2551
2617
|
if (i === "left" || i === "right")
|
|
2552
2618
|
return !1;
|
|
@@ -2559,18 +2625,18 @@ class dn extends R {
|
|
|
2559
2625
|
}
|
|
2560
2626
|
refreshStickyOffsets() {
|
|
2561
2627
|
const e = [...this.columns];
|
|
2562
|
-
|
|
2628
|
+
Te(this.grid, e);
|
|
2563
2629
|
}
|
|
2564
2630
|
getLeftPinnedColumns() {
|
|
2565
2631
|
const e = [...this.columns];
|
|
2566
|
-
return
|
|
2632
|
+
return ii(e);
|
|
2567
2633
|
}
|
|
2568
2634
|
getRightPinnedColumns() {
|
|
2569
2635
|
const e = [...this.columns];
|
|
2570
|
-
return
|
|
2636
|
+
return ni(e);
|
|
2571
2637
|
}
|
|
2572
2638
|
clearStickyPositions() {
|
|
2573
|
-
|
|
2639
|
+
Ie(this.grid);
|
|
2574
2640
|
}
|
|
2575
2641
|
getHorizontalScrollOffsets(e, t) {
|
|
2576
2642
|
if (!this.isApplied)
|
|
@@ -2591,10 +2657,10 @@ class dn extends R {
|
|
|
2591
2657
|
return { left: i, right: n, skipScroll: r };
|
|
2592
2658
|
}
|
|
2593
2659
|
}
|
|
2594
|
-
function
|
|
2660
|
+
function ri(s) {
|
|
2595
2661
|
return typeof s == "object" && s !== null && "aggFunc" in s;
|
|
2596
2662
|
}
|
|
2597
|
-
function
|
|
2663
|
+
function ee(s, e) {
|
|
2598
2664
|
const t = document.createElement("div");
|
|
2599
2665
|
t.className = "tbw-pinned-rows", t.setAttribute("role", "presentation"), t.setAttribute("aria-live", "polite");
|
|
2600
2666
|
const i = document.createElement("div");
|
|
@@ -2616,7 +2682,7 @@ function Q(s, e) {
|
|
|
2616
2682
|
}
|
|
2617
2683
|
if (s.customPanels)
|
|
2618
2684
|
for (const o of s.customPanels) {
|
|
2619
|
-
const a =
|
|
2685
|
+
const a = oi(o, e);
|
|
2620
2686
|
switch (o.position) {
|
|
2621
2687
|
case "left":
|
|
2622
2688
|
i.appendChild(a);
|
|
@@ -2631,11 +2697,11 @@ function Q(s, e) {
|
|
|
2631
2697
|
}
|
|
2632
2698
|
return t.appendChild(i), t.appendChild(n), t.appendChild(r), t;
|
|
2633
2699
|
}
|
|
2634
|
-
function
|
|
2700
|
+
function Pe(s) {
|
|
2635
2701
|
const e = document.createElement("div");
|
|
2636
2702
|
return e.className = `tbw-aggregation-rows tbw-aggregation-rows-${s}`, e.setAttribute("role", "presentation"), e;
|
|
2637
2703
|
}
|
|
2638
|
-
function
|
|
2704
|
+
function De(s, e, t, i) {
|
|
2639
2705
|
s.innerHTML = "";
|
|
2640
2706
|
for (const n of e) {
|
|
2641
2707
|
const r = document.createElement("div");
|
|
@@ -2649,7 +2715,7 @@ function Pe(s, e, t, i) {
|
|
|
2649
2715
|
let l, d;
|
|
2650
2716
|
const c = n.aggregators?.[o.field];
|
|
2651
2717
|
if (c)
|
|
2652
|
-
if (
|
|
2718
|
+
if (ri(c)) {
|
|
2653
2719
|
const u = ge(c.aggFunc);
|
|
2654
2720
|
u && (l = u(i, o.field, o)), d = c.formatter;
|
|
2655
2721
|
} else {
|
|
@@ -2665,7 +2731,7 @@ function Pe(s, e, t, i) {
|
|
|
2665
2731
|
s.appendChild(r);
|
|
2666
2732
|
}
|
|
2667
2733
|
}
|
|
2668
|
-
function
|
|
2734
|
+
function oi(s, e) {
|
|
2669
2735
|
const t = document.createElement("div");
|
|
2670
2736
|
t.className = "tbw-status-panel tbw-status-panel-custom", t.id = `status-panel-${s.id}`;
|
|
2671
2737
|
const i = s.render(e);
|
|
@@ -2681,10 +2747,10 @@ function Fe(s, e, t, i, n) {
|
|
|
2681
2747
|
grid: t
|
|
2682
2748
|
};
|
|
2683
2749
|
}
|
|
2684
|
-
const
|
|
2685
|
-
class
|
|
2750
|
+
const si = "@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:block;align-items:center;border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;text-overflow:ellipsis;white-space:var(--tbw-cell-white-space, nowrap)}.tbw-aggregation-cell:last-child{border-right:0}.tbw-aggregation-cell-full{grid-column:1 / -1;border-right:0}}";
|
|
2751
|
+
class hn extends R {
|
|
2686
2752
|
name = "pinnedRows";
|
|
2687
|
-
styles =
|
|
2753
|
+
styles = si;
|
|
2688
2754
|
get defaultConfig() {
|
|
2689
2755
|
return {
|
|
2690
2756
|
position: "bottom",
|
|
@@ -2715,11 +2781,11 @@ class cn extends R {
|
|
|
2715
2781
|
), o = this.config.aggregationRows || [], a = o.filter((h) => h.position === "top"), l = o.filter((h) => h.position !== "top");
|
|
2716
2782
|
if (a.length > 0) {
|
|
2717
2783
|
if (!this.topAggregationContainer) {
|
|
2718
|
-
this.topAggregationContainer =
|
|
2784
|
+
this.topAggregationContainer = Pe("top");
|
|
2719
2785
|
const h = e.querySelector(".header");
|
|
2720
2786
|
h && h.nextSibling ? t.insertBefore(this.topAggregationContainer, h.nextSibling) : t.appendChild(this.topAggregationContainer);
|
|
2721
2787
|
}
|
|
2722
|
-
|
|
2788
|
+
De(
|
|
2723
2789
|
this.topAggregationContainer,
|
|
2724
2790
|
a,
|
|
2725
2791
|
this.visibleColumns,
|
|
@@ -2729,18 +2795,18 @@ class cn extends R {
|
|
|
2729
2795
|
const d = this.config.showRowCount !== !1 || this.config.showSelectedCount && r.selectedRows > 0 || this.config.showFilteredCount && r.filteredRows !== r.totalRows || this.config.customPanels && this.config.customPanels.length > 0, c = d && this.config.position !== "top", u = l.length > 0 || c;
|
|
2730
2796
|
if (d && this.config.position === "top")
|
|
2731
2797
|
if (!this.infoBarElement)
|
|
2732
|
-
this.infoBarElement =
|
|
2798
|
+
this.infoBarElement = ee(this.config, r), t.insertBefore(this.infoBarElement, t.firstChild);
|
|
2733
2799
|
else {
|
|
2734
|
-
const h =
|
|
2800
|
+
const h = ee(this.config, r);
|
|
2735
2801
|
this.infoBarElement.replaceWith(h), this.infoBarElement = h;
|
|
2736
2802
|
}
|
|
2737
2803
|
else this.config.position === "top" && this.infoBarElement && (this.infoBarElement.remove(), this.infoBarElement = null);
|
|
2738
|
-
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 =
|
|
2804
|
+
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 = Pe("bottom")), this.footerWrapper.appendChild(this.bottomAggregationContainer), De(
|
|
2739
2805
|
this.bottomAggregationContainer,
|
|
2740
2806
|
l,
|
|
2741
2807
|
this.visibleColumns,
|
|
2742
2808
|
this.rows
|
|
2743
|
-
)), c && (this.infoBarElement =
|
|
2809
|
+
)), c && (this.infoBarElement = ee(this.config, r), this.footerWrapper.appendChild(this.infoBarElement))) : this.cleanupFooter();
|
|
2744
2810
|
}
|
|
2745
2811
|
cleanup() {
|
|
2746
2812
|
this.infoBarElement && (this.infoBarElement.remove(), this.infoBarElement = null), this.topAggregationContainer && (this.topAggregationContainer.remove(), this.topAggregationContainer = null), this.bottomAggregationContainer && (this.bottomAggregationContainer.remove(), this.bottomAggregationContainer = null), this.footerWrapper && (this.footerWrapper.remove(), this.footerWrapper = null);
|
|
@@ -2788,16 +2854,16 @@ class cn extends R {
|
|
|
2788
2854
|
this.config.aggregationRows && (this.config.aggregationRows = this.config.aggregationRows.filter((t) => t.id !== e), this.requestRender());
|
|
2789
2855
|
}
|
|
2790
2856
|
}
|
|
2791
|
-
const
|
|
2792
|
-
function
|
|
2857
|
+
const ai = it;
|
|
2858
|
+
function li(s) {
|
|
2793
2859
|
const e = [];
|
|
2794
2860
|
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;
|
|
2795
2861
|
}
|
|
2796
|
-
function
|
|
2862
|
+
function ce(s, e) {
|
|
2797
2863
|
return [...s, e].join("|");
|
|
2798
2864
|
}
|
|
2799
|
-
function
|
|
2800
|
-
const t = e.rowGroupFields ?? [], i = e.columnGroupFields ?? [], n = e.valueFields ?? [], r =
|
|
2865
|
+
function di(s, e) {
|
|
2866
|
+
const t = e.rowGroupFields ?? [], i = e.columnGroupFields ?? [], n = e.valueFields ?? [], r = ci(s, i), o = Ue(
|
|
2801
2867
|
s,
|
|
2802
2868
|
t,
|
|
2803
2869
|
i,
|
|
@@ -2805,7 +2871,7 @@ function ai(s, e) {
|
|
|
2805
2871
|
n,
|
|
2806
2872
|
0,
|
|
2807
2873
|
""
|
|
2808
|
-
), a =
|
|
2874
|
+
), a = hi(o, r, n), l = Object.values(a).reduce((d, c) => d + c, 0);
|
|
2809
2875
|
return {
|
|
2810
2876
|
rows: o,
|
|
2811
2877
|
columnKeys: r,
|
|
@@ -2813,7 +2879,7 @@ function ai(s, e) {
|
|
|
2813
2879
|
grandTotal: l
|
|
2814
2880
|
};
|
|
2815
2881
|
}
|
|
2816
|
-
function
|
|
2882
|
+
function ci(s, e) {
|
|
2817
2883
|
if (e.length === 0) return ["value"];
|
|
2818
2884
|
const t = /* @__PURE__ */ new Set();
|
|
2819
2885
|
for (const i of s) {
|
|
@@ -2822,7 +2888,7 @@ function li(s, e) {
|
|
|
2822
2888
|
}
|
|
2823
2889
|
return [...t].sort();
|
|
2824
2890
|
}
|
|
2825
|
-
function
|
|
2891
|
+
function ui(s, e) {
|
|
2826
2892
|
const t = /* @__PURE__ */ new Map();
|
|
2827
2893
|
for (const i of s) {
|
|
2828
2894
|
const n = String(i[e] ?? ""), r = t.get(n);
|
|
@@ -2830,10 +2896,10 @@ function di(s, e) {
|
|
|
2830
2896
|
}
|
|
2831
2897
|
return t;
|
|
2832
2898
|
}
|
|
2833
|
-
function
|
|
2899
|
+
function Ue(s, e, t, i, n, r, o) {
|
|
2834
2900
|
const a = [];
|
|
2835
2901
|
if (e.length === 0) {
|
|
2836
|
-
const h =
|
|
2902
|
+
const h = Me(s, t, i, n), g = qe(h);
|
|
2837
2903
|
return a.push({
|
|
2838
2904
|
rowKey: o || "all",
|
|
2839
2905
|
rowLabel: o || "All",
|
|
@@ -2844,11 +2910,11 @@ function je(s, e, t, i, n, r, o) {
|
|
|
2844
2910
|
rowCount: s.length
|
|
2845
2911
|
}), a;
|
|
2846
2912
|
}
|
|
2847
|
-
const l = e[0], d = e.slice(1), c = d.length > 0, u =
|
|
2913
|
+
const l = e[0], d = e.slice(1), c = d.length > 0, u = ui(s, l);
|
|
2848
2914
|
for (const [h, g] of u) {
|
|
2849
|
-
const f = o ? `${o}|${h}` : h, p =
|
|
2915
|
+
const f = o ? `${o}|${h}` : h, p = Me(g, t, i, n), m = qe(p);
|
|
2850
2916
|
let w;
|
|
2851
|
-
c && (w =
|
|
2917
|
+
c && (w = Ue(
|
|
2852
2918
|
g,
|
|
2853
2919
|
d,
|
|
2854
2920
|
t,
|
|
@@ -2869,36 +2935,36 @@ function je(s, e, t, i, n, r, o) {
|
|
|
2869
2935
|
}
|
|
2870
2936
|
return a;
|
|
2871
2937
|
}
|
|
2872
|
-
function
|
|
2938
|
+
function Me(s, e, t, i) {
|
|
2873
2939
|
const n = {};
|
|
2874
2940
|
for (const r of t)
|
|
2875
2941
|
for (const o of i) {
|
|
2876
|
-
const l = (e.length > 0 ? s.filter((h) => e.map((g) => String(h[g] ?? "")).join("|") === r) : s).map((h) => Number(h[o.field]) || 0), d =
|
|
2942
|
+
const l = (e.length > 0 ? s.filter((h) => e.map((g) => String(h[g] ?? "")).join("|") === r) : s).map((h) => Number(h[o.field]) || 0), d = ai(o.aggFunc), c = l.length > 0 ? d(l) : null, u = ce([r], o.field);
|
|
2877
2943
|
n[u] = c;
|
|
2878
2944
|
}
|
|
2879
2945
|
return n;
|
|
2880
2946
|
}
|
|
2881
|
-
function
|
|
2947
|
+
function qe(s) {
|
|
2882
2948
|
let e = 0;
|
|
2883
2949
|
for (const t of Object.values(s))
|
|
2884
2950
|
e += t ?? 0;
|
|
2885
2951
|
return e;
|
|
2886
2952
|
}
|
|
2887
|
-
function
|
|
2953
|
+
function hi(s, e, t) {
|
|
2888
2954
|
const i = {};
|
|
2889
2955
|
function n(r) {
|
|
2890
2956
|
for (const o of r)
|
|
2891
2957
|
if (!o.isGroup || !o.children?.length)
|
|
2892
2958
|
for (const a of e)
|
|
2893
2959
|
for (const l of t) {
|
|
2894
|
-
const d =
|
|
2960
|
+
const d = ce([a], l.field);
|
|
2895
2961
|
i[d] = (i[d] ?? 0) + (o.values[d] ?? 0);
|
|
2896
2962
|
}
|
|
2897
2963
|
else o.children && n(o.children);
|
|
2898
2964
|
}
|
|
2899
2965
|
return n(s), i;
|
|
2900
2966
|
}
|
|
2901
|
-
function
|
|
2967
|
+
function gi(s, e, t = !0) {
|
|
2902
2968
|
const i = [];
|
|
2903
2969
|
function n(r) {
|
|
2904
2970
|
i.push(r);
|
|
@@ -2911,7 +2977,7 @@ function ui(s, e, t = !0) {
|
|
|
2911
2977
|
n(r);
|
|
2912
2978
|
return i;
|
|
2913
2979
|
}
|
|
2914
|
-
function
|
|
2980
|
+
function fi(s) {
|
|
2915
2981
|
const e = [];
|
|
2916
2982
|
function t(i) {
|
|
2917
2983
|
if (i.isGroup && e.push(i.rowKey), i.children)
|
|
@@ -2922,14 +2988,14 @@ function hi(s) {
|
|
|
2922
2988
|
t(i);
|
|
2923
2989
|
return e;
|
|
2924
2990
|
}
|
|
2925
|
-
const
|
|
2926
|
-
function
|
|
2991
|
+
const pi = ["sum", "avg", "count", "min", "max", "first", "last"];
|
|
2992
|
+
function mi(s, e, t, i) {
|
|
2927
2993
|
const n = new AbortController(), r = { config: e, callbacks: i, signal: n.signal }, o = document.createElement("div");
|
|
2928
|
-
return o.className = "tbw-pivot-panel", o.appendChild(
|
|
2994
|
+
return o.className = "tbw-pivot-panel", o.appendChild(H("Options", () => xi(t, r))), o.appendChild(H("Row Groups", () => Ke("rowGroups", r))), o.appendChild(H("Column Groups", () => Ke("columnGroups", r))), o.appendChild(H("Values", () => bi(r))), o.appendChild(H("Available Fields", () => yi(r))), s.appendChild(o), () => {
|
|
2929
2995
|
n.abort(), o.remove();
|
|
2930
2996
|
};
|
|
2931
2997
|
}
|
|
2932
|
-
function
|
|
2998
|
+
function H(s, e) {
|
|
2933
2999
|
const t = document.createElement("div");
|
|
2934
3000
|
t.className = "tbw-pivot-section";
|
|
2935
3001
|
const i = document.createElement("div");
|
|
@@ -2937,7 +3003,7 @@ function K(s, e) {
|
|
|
2937
3003
|
const n = document.createElement("div");
|
|
2938
3004
|
return n.className = "tbw-pivot-section-content", n.appendChild(e()), t.appendChild(i), t.appendChild(n), t;
|
|
2939
3005
|
}
|
|
2940
|
-
function
|
|
3006
|
+
function Ke(s, e) {
|
|
2941
3007
|
const { config: t, callbacks: i, signal: n } = e, r = document.createElement("div");
|
|
2942
3008
|
r.className = "tbw-pivot-drop-zone", r.setAttribute("data-zone", s);
|
|
2943
3009
|
const o = s === "rowGroups" ? t.rowGroupFields ?? [] : t.columnGroupFields ?? [];
|
|
@@ -2946,7 +3012,7 @@ function qe(s, e) {
|
|
|
2946
3012
|
a.className = "tbw-pivot-placeholder", a.textContent = "Drag fields here or click to add", r.appendChild(a);
|
|
2947
3013
|
} else
|
|
2948
3014
|
for (const a of o)
|
|
2949
|
-
r.appendChild(
|
|
3015
|
+
r.appendChild(wi(a, s, e));
|
|
2950
3016
|
return r.addEventListener(
|
|
2951
3017
|
"dragover",
|
|
2952
3018
|
(a) => {
|
|
@@ -2969,7 +3035,7 @@ function qe(s, e) {
|
|
|
2969
3035
|
{ signal: n }
|
|
2970
3036
|
), r;
|
|
2971
3037
|
}
|
|
2972
|
-
function
|
|
3038
|
+
function wi(s, e, t) {
|
|
2973
3039
|
const { callbacks: i, signal: n } = t, r = document.createElement("div");
|
|
2974
3040
|
r.className = "tbw-pivot-field-chip", r.draggable = !0;
|
|
2975
3041
|
const o = i.getAvailableFields().find((d) => d.field === s), a = document.createElement("span");
|
|
@@ -2995,7 +3061,7 @@ function pi(s, e, t) {
|
|
|
2995
3061
|
{ signal: n }
|
|
2996
3062
|
), r;
|
|
2997
3063
|
}
|
|
2998
|
-
function
|
|
3064
|
+
function bi(s) {
|
|
2999
3065
|
const { config: e, callbacks: t, signal: i } = s, n = document.createElement("div");
|
|
3000
3066
|
n.className = "tbw-pivot-drop-zone tbw-pivot-values-zone", n.setAttribute("data-zone", "values");
|
|
3001
3067
|
const r = e.valueFields ?? [];
|
|
@@ -3004,7 +3070,7 @@ function mi(s) {
|
|
|
3004
3070
|
o.className = "tbw-pivot-placeholder", o.textContent = "Drag numeric fields here for aggregation", n.appendChild(o);
|
|
3005
3071
|
} else
|
|
3006
3072
|
for (const o of r)
|
|
3007
|
-
n.appendChild(
|
|
3073
|
+
n.appendChild(vi(o, s));
|
|
3008
3074
|
return n.addEventListener(
|
|
3009
3075
|
"dragover",
|
|
3010
3076
|
(o) => {
|
|
@@ -3027,7 +3093,7 @@ function mi(s) {
|
|
|
3027
3093
|
{ signal: i }
|
|
3028
3094
|
), n;
|
|
3029
3095
|
}
|
|
3030
|
-
function
|
|
3096
|
+
function vi(s, e) {
|
|
3031
3097
|
const { callbacks: t, signal: i } = e, n = document.createElement("div");
|
|
3032
3098
|
n.className = "tbw-pivot-field-chip tbw-pivot-value-chip";
|
|
3033
3099
|
const r = t.getAvailableFields().find((c) => c.field === s.field), o = document.createElement("div");
|
|
@@ -3036,7 +3102,7 @@ function wi(s, e) {
|
|
|
3036
3102
|
a.className = "tbw-pivot-chip-label", a.textContent = r?.header ?? s.field;
|
|
3037
3103
|
const l = document.createElement("select");
|
|
3038
3104
|
l.className = "tbw-pivot-agg-select", l.title = "Aggregation function";
|
|
3039
|
-
for (const c of
|
|
3105
|
+
for (const c of pi) {
|
|
3040
3106
|
const u = document.createElement("option");
|
|
3041
3107
|
u.value = c, u.textContent = c.toUpperCase(), u.selected = c === s.aggFunc, l.appendChild(u);
|
|
3042
3108
|
}
|
|
@@ -3056,7 +3122,7 @@ function wi(s, e) {
|
|
|
3056
3122
|
{ signal: i }
|
|
3057
3123
|
), o.appendChild(a), o.appendChild(l), n.appendChild(o), n.appendChild(d), n;
|
|
3058
3124
|
}
|
|
3059
|
-
function
|
|
3125
|
+
function yi(s) {
|
|
3060
3126
|
const { config: e, callbacks: t, signal: i } = s, n = document.createElement("div");
|
|
3061
3127
|
n.className = "tbw-pivot-available-fields";
|
|
3062
3128
|
const r = t.getAvailableFields(), o = /* @__PURE__ */ new Set([
|
|
@@ -3086,10 +3152,10 @@ function bi(s) {
|
|
|
3086
3152
|
}
|
|
3087
3153
|
return n;
|
|
3088
3154
|
}
|
|
3089
|
-
function
|
|
3155
|
+
function xi(s, e) {
|
|
3090
3156
|
const { config: t, callbacks: i, signal: n } = e, r = document.createElement("div");
|
|
3091
3157
|
return r.className = "tbw-pivot-options", r.appendChild(
|
|
3092
|
-
|
|
3158
|
+
te(
|
|
3093
3159
|
"Enable Pivot View",
|
|
3094
3160
|
s,
|
|
3095
3161
|
(o) => {
|
|
@@ -3098,7 +3164,7 @@ function vi(s, e) {
|
|
|
3098
3164
|
n
|
|
3099
3165
|
)
|
|
3100
3166
|
), r.appendChild(
|
|
3101
|
-
|
|
3167
|
+
te(
|
|
3102
3168
|
"Show Row Totals",
|
|
3103
3169
|
t.showTotals ?? !0,
|
|
3104
3170
|
(o) => {
|
|
@@ -3107,7 +3173,7 @@ function vi(s, e) {
|
|
|
3107
3173
|
n
|
|
3108
3174
|
)
|
|
3109
3175
|
), r.appendChild(
|
|
3110
|
-
|
|
3176
|
+
te(
|
|
3111
3177
|
"Show Grand Total",
|
|
3112
3178
|
t.showGrandTotal ?? !0,
|
|
3113
3179
|
(o) => {
|
|
@@ -3117,7 +3183,7 @@ function vi(s, e) {
|
|
|
3117
3183
|
)
|
|
3118
3184
|
), r;
|
|
3119
3185
|
}
|
|
3120
|
-
function
|
|
3186
|
+
function te(s, e, t, i) {
|
|
3121
3187
|
const n = document.createElement("label");
|
|
3122
3188
|
n.className = "tbw-pivot-checkbox";
|
|
3123
3189
|
const r = document.createElement("input");
|
|
@@ -3125,7 +3191,7 @@ function ee(s, e, t, i) {
|
|
|
3125
3191
|
const o = document.createElement("span");
|
|
3126
3192
|
return o.textContent = s, n.appendChild(r), n.appendChild(o), n;
|
|
3127
3193
|
}
|
|
3128
|
-
function
|
|
3194
|
+
function Ci(s, e, t) {
|
|
3129
3195
|
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) => {
|
|
3130
3196
|
const r = document.createElement("div");
|
|
3131
3197
|
if (r.className = "cell", r.setAttribute("data-col", String(n)), r.setAttribute("data-row", String(t.rowIndex)), r.setAttribute("role", "gridcell"), n === 0) {
|
|
@@ -3146,7 +3212,7 @@ function yi(s, e, t) {
|
|
|
3146
3212
|
e.appendChild(r);
|
|
3147
3213
|
}), !0;
|
|
3148
3214
|
}
|
|
3149
|
-
function
|
|
3215
|
+
function Ri(s, e, t, i) {
|
|
3150
3216
|
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) => {
|
|
3151
3217
|
const o = document.createElement("div");
|
|
3152
3218
|
if (o.className = "cell", o.setAttribute("data-col", String(r)), o.setAttribute("data-row", String(i)), o.setAttribute("role", "gridcell"), r === 0) {
|
|
@@ -3161,7 +3227,7 @@ function Ci(s, e, t, i) {
|
|
|
3161
3227
|
e.appendChild(o);
|
|
3162
3228
|
}), !0;
|
|
3163
3229
|
}
|
|
3164
|
-
function
|
|
3230
|
+
function Ei(s, e, t) {
|
|
3165
3231
|
return e.className = "pivot-grand-total-row", e.setAttribute("role", "presentation"), e.innerHTML = "", t.forEach((i, n) => {
|
|
3166
3232
|
const r = document.createElement("div");
|
|
3167
3233
|
if (r.className = "cell", r.setAttribute("data-col", String(n)), n === 0) {
|
|
@@ -3174,10 +3240,10 @@ function xi(s, e, t) {
|
|
|
3174
3240
|
e.appendChild(r);
|
|
3175
3241
|
}), !0;
|
|
3176
3242
|
}
|
|
3177
|
-
const
|
|
3178
|
-
class
|
|
3243
|
+
const Si = '@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}}}';
|
|
3244
|
+
class F extends R {
|
|
3179
3245
|
name = "pivot";
|
|
3180
|
-
styles =
|
|
3246
|
+
styles = Si;
|
|
3181
3247
|
static PANEL_ID = "pivot";
|
|
3182
3248
|
get defaultConfig() {
|
|
3183
3249
|
return {
|
|
@@ -3211,7 +3277,7 @@ class D extends R {
|
|
|
3211
3277
|
getToolPanel() {
|
|
3212
3278
|
if ((this.config?.showToolPanel ?? this.userConfig?.showToolPanel ?? !0) !== !1)
|
|
3213
3279
|
return {
|
|
3214
|
-
id:
|
|
3280
|
+
id: F.PANEL_ID,
|
|
3215
3281
|
title: "Pivot",
|
|
3216
3282
|
icon: "⊞",
|
|
3217
3283
|
tooltip: "Configure pivot table",
|
|
@@ -3222,11 +3288,11 @@ class D extends R {
|
|
|
3222
3288
|
processRows(e) {
|
|
3223
3289
|
if (!this.hasInitialized && this.config.active !== !1 && this.hasValidPivotConfig() && (this.hasInitialized = !0, this.isActive = !0), !this.isActive)
|
|
3224
3290
|
return [...e];
|
|
3225
|
-
const t =
|
|
3291
|
+
const t = li(this.config);
|
|
3226
3292
|
if (t.length > 0)
|
|
3227
3293
|
return this.warn(`Config errors: ${t.join(", ")}`), [...e];
|
|
3228
|
-
this.buildFieldHeaderMap(), this.defaultExpanded = this.config.defaultExpanded ?? !0, this.expandedKeys.size === 0 && this.defaultExpanded && this.pivotResult && this.expandAllKeys(), this.pivotResult =
|
|
3229
|
-
const i = this.config.indentWidth ?? 20, n =
|
|
3294
|
+
this.buildFieldHeaderMap(), this.defaultExpanded = this.config.defaultExpanded ?? !0, this.expandedKeys.size === 0 && this.defaultExpanded && this.pivotResult && this.expandAllKeys(), this.pivotResult = di(e, this.config), this.expandedKeys.size === 0 && this.defaultExpanded && this.expandAllKeys();
|
|
3295
|
+
const i = this.config.indentWidth ?? 20, n = gi(
|
|
3230
3296
|
this.pivotResult.rows,
|
|
3231
3297
|
this.expandedKeys,
|
|
3232
3298
|
this.defaultExpanded
|
|
@@ -3261,7 +3327,7 @@ class D extends R {
|
|
|
3261
3327
|
});
|
|
3262
3328
|
for (const n of this.pivotResult.columnKeys)
|
|
3263
3329
|
for (const r of this.config.valueFields ?? []) {
|
|
3264
|
-
const o =
|
|
3330
|
+
const o = ce([n], r.field), a = r.header || this.fieldHeaderMap.get(r.field) || r.field;
|
|
3265
3331
|
t.push({
|
|
3266
3332
|
field: o,
|
|
3267
3333
|
header: `${n} - ${a} (${r.aggFunc})`,
|
|
@@ -3278,13 +3344,13 @@ class D extends R {
|
|
|
3278
3344
|
}
|
|
3279
3345
|
renderRow(e, t, i) {
|
|
3280
3346
|
const n = e;
|
|
3281
|
-
return n.__pivotRowKey && n.__pivotHasChildren ?
|
|
3347
|
+
return n.__pivotRowKey && n.__pivotHasChildren ? Ci(n, t, {
|
|
3282
3348
|
columns: this.gridColumns,
|
|
3283
3349
|
rowIndex: i,
|
|
3284
3350
|
onToggle: (r) => this.toggle(r),
|
|
3285
3351
|
resolveIcon: (r) => this.resolveIcon(r),
|
|
3286
3352
|
setIcon: (r, o) => this.setIcon(r, o)
|
|
3287
|
-
}) : n.__pivotRowKey !== void 0 && this.isActive ?
|
|
3353
|
+
}) : n.__pivotRowKey !== void 0 && this.isActive ? Ri(n, t, this.gridColumns, i) : (this.cleanupPivotStyling(t), !1);
|
|
3288
3354
|
}
|
|
3289
3355
|
cleanupPivotStyling(e) {
|
|
3290
3356
|
(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 = "");
|
|
@@ -3322,7 +3388,7 @@ class D extends R {
|
|
|
3322
3388
|
__pivotTotal: this.pivotResult.grandTotal,
|
|
3323
3389
|
...this.pivotResult.totals
|
|
3324
3390
|
};
|
|
3325
|
-
|
|
3391
|
+
Ei(i, this.grandTotalFooter, this.gridColumns);
|
|
3326
3392
|
}
|
|
3327
3393
|
cleanupGrandTotalFooter() {
|
|
3328
3394
|
this.grandTotalFooter && (this.grandTotalFooter.remove(), this.grandTotalFooter = null);
|
|
@@ -3344,7 +3410,7 @@ class D extends R {
|
|
|
3344
3410
|
}
|
|
3345
3411
|
expandAllKeys() {
|
|
3346
3412
|
if (!this.pivotResult) return;
|
|
3347
|
-
const e =
|
|
3413
|
+
const e = fi(this.pivotResult.rows);
|
|
3348
3414
|
for (const t of e)
|
|
3349
3415
|
this.expandedKeys.add(t);
|
|
3350
3416
|
}
|
|
@@ -3376,16 +3442,16 @@ class D extends R {
|
|
|
3376
3442
|
this.pivotResult = null, this.requestRender();
|
|
3377
3443
|
}
|
|
3378
3444
|
showPanel() {
|
|
3379
|
-
this.grid.openToolPanel(), this.grid.expandedToolPanelSections.includes(
|
|
3445
|
+
this.grid.openToolPanel(), this.grid.expandedToolPanelSections.includes(F.PANEL_ID) || this.grid.toggleToolPanelSection(F.PANEL_ID);
|
|
3380
3446
|
}
|
|
3381
3447
|
hidePanel() {
|
|
3382
3448
|
this.grid.closeToolPanel();
|
|
3383
3449
|
}
|
|
3384
3450
|
togglePanel() {
|
|
3385
|
-
this.grid.isToolPanelOpen || this.grid.openToolPanel(), this.grid.toggleToolPanelSection(
|
|
3451
|
+
this.grid.isToolPanelOpen || this.grid.openToolPanel(), this.grid.toggleToolPanelSection(F.PANEL_ID);
|
|
3386
3452
|
}
|
|
3387
3453
|
isPanelVisible() {
|
|
3388
|
-
return this.grid.isToolPanelOpen && this.grid.expandedToolPanelSections.includes(
|
|
3454
|
+
return this.grid.isToolPanelOpen && this.grid.expandedToolPanelSections.includes(F.PANEL_ID);
|
|
3389
3455
|
}
|
|
3390
3456
|
get gridColumns() {
|
|
3391
3457
|
return this.grid.columns ?? [];
|
|
@@ -3429,7 +3495,7 @@ class D extends R {
|
|
|
3429
3495
|
},
|
|
3430
3496
|
getAvailableFields: () => this.getAvailableFields()
|
|
3431
3497
|
};
|
|
3432
|
-
return
|
|
3498
|
+
return mi(e, this.config, this.isActive, t);
|
|
3433
3499
|
}
|
|
3434
3500
|
refreshPanel() {
|
|
3435
3501
|
this.panelContainer && (this.panelContainer.innerHTML = "", this.renderPanel(this.panelContainer));
|
|
@@ -3463,7 +3529,7 @@ class D extends R {
|
|
|
3463
3529
|
}
|
|
3464
3530
|
}
|
|
3465
3531
|
const W = "tbw-print-isolation-style";
|
|
3466
|
-
function
|
|
3532
|
+
function ki(s, e) {
|
|
3467
3533
|
const t = document.createElement("style");
|
|
3468
3534
|
return t.id = W, t.textContent = `
|
|
3469
3535
|
/* Print isolation: hide everything except the target grid */
|
|
@@ -3537,12 +3603,12 @@ function Ei(s, e) {
|
|
|
3537
3603
|
}
|
|
3538
3604
|
`, t;
|
|
3539
3605
|
}
|
|
3540
|
-
async function
|
|
3606
|
+
async function Ai(s, e = {}) {
|
|
3541
3607
|
const { orientation: t = "landscape" } = e, i = s.id;
|
|
3542
3608
|
document.querySelectorAll(`#${CSS.escape(i)}`).length > 1 && console.warn(
|
|
3543
3609
|
`[tbw-grid:print] Multiple elements found with id="${i}". Print isolation may not work correctly. Ensure each grid has a unique ID.`
|
|
3544
3610
|
), document.getElementById(W)?.remove();
|
|
3545
|
-
const r =
|
|
3611
|
+
const r = ki(i, t);
|
|
3546
3612
|
return document.head.appendChild(r), new Promise((o) => {
|
|
3547
3613
|
const a = () => {
|
|
3548
3614
|
window.removeEventListener("afterprint", a), document.getElementById(W)?.remove(), o();
|
|
@@ -3552,7 +3618,7 @@ async function Si(s, e = {}) {
|
|
|
3552
3618
|
}, 5e3);
|
|
3553
3619
|
});
|
|
3554
3620
|
}
|
|
3555
|
-
const
|
|
3621
|
+
const _i = ".tbw-print-header,.tbw-print-footer{display:none}@media print{tbw-grid{overflow:visible!important;height:auto!important;border:none!important;border-radius:0!important;color-scheme:light only;-webkit-print-color-adjust:exact;print-color-adjust:exact}tbw-grid .tbw-grid-content{overflow:visible!important;height:auto!important;max-height:none!important}tbw-grid .tbw-scroll-area{overflow:visible!important;height:auto!important;max-height:none!important}tbw-grid .rows-body{overflow:visible!important;height:auto!important;max-height:none!important}tbw-grid .rows-container,tbw-grid .rows-viewport,tbw-grid .rows{overflow:visible!important;height:auto!important;max-height:none!important;transform:none!important}tbw-grid .rows-viewport .rows{position:static!important}tbw-grid .resize-handle,tbw-grid [part=sort-indicator],tbw-grid .tbw-filter-btn,tbw-grid .tool-panel,tbw-grid .tool-panel-content,tbw-grid .tbw-shell-header,tbw-grid .shell-toolbar,tbw-grid .tool-panel-toggle,tbw-grid [data-print-hide],tbw-grid .expander-cell,tbw-grid .tree-toggle,tbw-grid .context-menu,tbw-grid .faux-vscroll{display:none!important}tbw-grid .tbw-print-header{display:flex;justify-content:space-between;align-items:baseline;padding:.5em 0;margin-bottom:.5em;border-bottom:2px solid var(--tbw-color-border, #333);font-family:inherit}.tbw-print-header-title{font-size:1.25em;font-weight:700}.tbw-print-header-timestamp{font-size:.875em;color:var(--tbw-color-fg-muted, #666)}tbw-grid .tbw-print-footer{display:block;margin-top:.5em;padding-top:.5em;border-top:1px solid var(--tbw-color-border, #ccc);font-size:.75em;color:var(--tbw-color-fg-muted, #666);text-align:right}tbw-grid .data-grid-row{break-inside:avoid;page-break-inside:avoid}tbw-grid .cell{border:1px solid var(--tbw-color-border, #ddd)!important}tbw-grid .header-row,tbw-grid .data-grid-row{padding-right:1px}tbw-grid .data-grid-row:hover,tbw-grid .cell:hover{background:inherit!important}@page{margin:1cm}tbw-grid.print-landscape{@page{size:landscape}}tbw-grid.print-portrait{@page{size:portrait}}}", Li = {
|
|
3556
3622
|
button: !1,
|
|
3557
3623
|
orientation: "landscape",
|
|
3558
3624
|
warnThreshold: 500,
|
|
@@ -3562,10 +3628,10 @@ const ki = ".tbw-print-header,.tbw-print-footer{display:none}@media print{tbw-gr
|
|
|
3562
3628
|
title: "",
|
|
3563
3629
|
isolate: !1
|
|
3564
3630
|
};
|
|
3565
|
-
class
|
|
3631
|
+
class gn extends R {
|
|
3566
3632
|
name = "print";
|
|
3567
3633
|
version = "1.0.0";
|
|
3568
|
-
styles =
|
|
3634
|
+
styles = _i;
|
|
3569
3635
|
#e = !1;
|
|
3570
3636
|
#t = null;
|
|
3571
3637
|
#o = null;
|
|
@@ -3589,7 +3655,7 @@ class un extends R {
|
|
|
3589
3655
|
console.warn("[PrintPlugin] Grid not available");
|
|
3590
3656
|
return;
|
|
3591
3657
|
}
|
|
3592
|
-
const i = { ...
|
|
3658
|
+
const i = { ...Li, ...this.config, ...e }, r = this.rows.length;
|
|
3593
3659
|
let o = r, a = !1;
|
|
3594
3660
|
if (i.warnThreshold > 0 && r > i.warnThreshold) {
|
|
3595
3661
|
const d = i.maxRows > 0 ? `
|
|
@@ -3660,7 +3726,7 @@ Click OK to continue, or Cancel to abort.`
|
|
|
3660
3726
|
}
|
|
3661
3727
|
async #p(e) {
|
|
3662
3728
|
const t = this.gridElement;
|
|
3663
|
-
t && await
|
|
3729
|
+
t && await Ai(t, {
|
|
3664
3730
|
orientation: e.orientation
|
|
3665
3731
|
});
|
|
3666
3732
|
}
|
|
@@ -3709,7 +3775,7 @@ Click OK to continue, or Cancel to abort.`
|
|
|
3709
3775
|
});
|
|
3710
3776
|
}
|
|
3711
3777
|
}
|
|
3712
|
-
function
|
|
3778
|
+
function Ti(s) {
|
|
3713
3779
|
const e = s.meta ?? {};
|
|
3714
3780
|
return e.lockPosition !== !0 && e.suppressMovable !== !0;
|
|
3715
3781
|
}
|
|
@@ -3718,10 +3784,10 @@ function Ne(s, e, t) {
|
|
|
3718
3784
|
const i = [...s], [n] = i.splice(e, 1);
|
|
3719
3785
|
return i.splice(t, 0, n), i;
|
|
3720
3786
|
}
|
|
3721
|
-
const
|
|
3722
|
-
class
|
|
3787
|
+
const Ii = '@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}}';
|
|
3788
|
+
class fn extends R {
|
|
3723
3789
|
name = "reorder";
|
|
3724
|
-
styles =
|
|
3790
|
+
styles = Ii;
|
|
3725
3791
|
get defaultConfig() {
|
|
3726
3792
|
return {
|
|
3727
3793
|
animation: "flip"
|
|
@@ -3738,8 +3804,8 @@ class hn extends R {
|
|
|
3738
3804
|
draggedIndex = null;
|
|
3739
3805
|
dropIndex = null;
|
|
3740
3806
|
canMoveColumnWithPlugins(e) {
|
|
3741
|
-
return !e || !
|
|
3742
|
-
type:
|
|
3807
|
+
return !e || !Ti(e) ? !1 : !this.grid.queryPlugins({
|
|
3808
|
+
type: We.CAN_MOVE_COLUMN,
|
|
3743
3809
|
context: e
|
|
3744
3810
|
}).includes(!1);
|
|
3745
3811
|
}
|
|
@@ -3914,11 +3980,11 @@ class hn extends R {
|
|
|
3914
3980
|
this.grid.requestStateChange?.();
|
|
3915
3981
|
}
|
|
3916
3982
|
}
|
|
3917
|
-
const
|
|
3918
|
-
class
|
|
3983
|
+
const Pi = '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}}';
|
|
3984
|
+
class pn extends R {
|
|
3919
3985
|
name = "responsive";
|
|
3920
3986
|
version = "1.0.0";
|
|
3921
|
-
styles =
|
|
3987
|
+
styles = Pi;
|
|
3922
3988
|
static manifest = {
|
|
3923
3989
|
incompatibleWith: [
|
|
3924
3990
|
{
|
|
@@ -4088,7 +4154,7 @@ class gn extends R {
|
|
|
4088
4154
|
return !0;
|
|
4089
4155
|
return !1;
|
|
4090
4156
|
}
|
|
4091
|
-
#
|
|
4157
|
+
#x() {
|
|
4092
4158
|
let e = 0, t = 0;
|
|
4093
4159
|
for (const i of this.rows)
|
|
4094
4160
|
i.__isGroupRow ? e++ : t++;
|
|
@@ -4097,7 +4163,7 @@ class gn extends R {
|
|
|
4097
4163
|
getExtraHeight() {
|
|
4098
4164
|
if (!this.#t || !this.config.cardRenderer || !this.#w())
|
|
4099
4165
|
return 0;
|
|
4100
|
-
const e = this.#l ?? 28, t = this.#y(), i = this.#v(), { groupCount: n, cardCount: r } = this.#
|
|
4166
|
+
const e = this.#l ?? 28, t = this.#y(), i = this.#v(), { groupCount: n, cardCount: r } = this.#x(), o = n * Math.max(0, t - e), a = r * Math.max(0, i - e);
|
|
4101
4167
|
return o + a;
|
|
4102
4168
|
}
|
|
4103
4169
|
getExtraHeightBefore(e) {
|
|
@@ -4110,7 +4176,7 @@ class gn extends R {
|
|
|
4110
4176
|
d[u].__isGroupRow ? a++ : l++;
|
|
4111
4177
|
return a * r + l * o;
|
|
4112
4178
|
}
|
|
4113
|
-
#
|
|
4179
|
+
#C() {
|
|
4114
4180
|
let e = 0;
|
|
4115
4181
|
for (const t of this.rows)
|
|
4116
4182
|
t.__isGroupRow || e++;
|
|
@@ -4121,7 +4187,7 @@ class gn extends R {
|
|
|
4121
4187
|
if (!this.#t || !this.config.cardRenderer)
|
|
4122
4188
|
return;
|
|
4123
4189
|
let e = !1;
|
|
4124
|
-
const t = this.grid, i = this.#w(), n = this.#
|
|
4190
|
+
const t = this.grid, i = this.#w(), n = this.#C();
|
|
4125
4191
|
if (n !== this.#m && (this.#m = n, e = !0), i) {
|
|
4126
4192
|
const o = this.gridElement.querySelector(".data-grid-row.group-row");
|
|
4127
4193
|
if (o) {
|
|
@@ -4139,10 +4205,10 @@ class gn extends R {
|
|
|
4139
4205
|
}));
|
|
4140
4206
|
}
|
|
4141
4207
|
}
|
|
4142
|
-
const
|
|
4143
|
-
class
|
|
4208
|
+
const Di = '.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}', Fi = "__tbw_row_drag";
|
|
4209
|
+
class mn extends R {
|
|
4144
4210
|
name = "rowReorder";
|
|
4145
|
-
styles =
|
|
4211
|
+
styles = Di;
|
|
4146
4212
|
get defaultConfig() {
|
|
4147
4213
|
return {
|
|
4148
4214
|
enableKeyboard: !0,
|
|
@@ -4166,7 +4232,7 @@ class fn extends R {
|
|
|
4166
4232
|
if (!this.config.showDragHandle)
|
|
4167
4233
|
return [...e];
|
|
4168
4234
|
const t = {
|
|
4169
|
-
field:
|
|
4235
|
+
field: Fi,
|
|
4170
4236
|
header: "",
|
|
4171
4237
|
width: this.config.dragHandleWidth ?? 40,
|
|
4172
4238
|
resizable: !1,
|
|
@@ -4315,38 +4381,38 @@ function q(s) {
|
|
|
4315
4381
|
endCol: Math.max(s.startCol, s.endCol)
|
|
4316
4382
|
};
|
|
4317
4383
|
}
|
|
4318
|
-
function
|
|
4384
|
+
function Mi(s) {
|
|
4319
4385
|
const e = q(s);
|
|
4320
4386
|
return {
|
|
4321
4387
|
from: { row: e.startRow, col: e.startCol },
|
|
4322
4388
|
to: { row: e.endRow, col: e.endCol }
|
|
4323
4389
|
};
|
|
4324
4390
|
}
|
|
4325
|
-
function
|
|
4326
|
-
return s.map(
|
|
4391
|
+
function Ye(s) {
|
|
4392
|
+
return s.map(Mi);
|
|
4327
4393
|
}
|
|
4328
|
-
function
|
|
4394
|
+
function qi(s, e, t) {
|
|
4329
4395
|
const i = q(t);
|
|
4330
4396
|
return s >= i.startRow && s <= i.endRow && e >= i.startCol && e <= i.endCol;
|
|
4331
4397
|
}
|
|
4332
4398
|
function He(s, e, t) {
|
|
4333
|
-
return t.some((i) =>
|
|
4399
|
+
return t.some((i) => qi(s, e, i));
|
|
4334
4400
|
}
|
|
4335
|
-
function
|
|
4401
|
+
function Ki(s) {
|
|
4336
4402
|
const e = [], t = q(s);
|
|
4337
4403
|
for (let i = t.startRow; i <= t.endRow; i++)
|
|
4338
4404
|
for (let n = t.startCol; n <= t.endCol; n++)
|
|
4339
4405
|
e.push({ row: i, col: n });
|
|
4340
4406
|
return e;
|
|
4341
4407
|
}
|
|
4342
|
-
function
|
|
4408
|
+
function Ni(s) {
|
|
4343
4409
|
const e = /* @__PURE__ */ new Map();
|
|
4344
4410
|
for (const t of s)
|
|
4345
|
-
for (const i of
|
|
4411
|
+
for (const i of Ki(t))
|
|
4346
4412
|
e.set(`${i.row},${i.col}`, i);
|
|
4347
4413
|
return [...e.values()];
|
|
4348
4414
|
}
|
|
4349
|
-
function
|
|
4415
|
+
function ie(s, e) {
|
|
4350
4416
|
return {
|
|
4351
4417
|
startRow: s.row,
|
|
4352
4418
|
startCol: s.col,
|
|
@@ -4358,8 +4424,8 @@ function V(s, e) {
|
|
|
4358
4424
|
const t = q(s), i = q(e);
|
|
4359
4425
|
return t.startRow === i.startRow && t.startCol === i.startCol && t.endRow === i.endRow && t.endCol === i.endCol;
|
|
4360
4426
|
}
|
|
4361
|
-
const
|
|
4362
|
-
function
|
|
4427
|
+
const Hi = "@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}}}";
|
|
4428
|
+
function zi(s, e, t) {
|
|
4363
4429
|
if (s === "cell" && e.selectedCell)
|
|
4364
4430
|
return {
|
|
4365
4431
|
mode: s,
|
|
@@ -4377,9 +4443,9 @@ function Hi(s, e, t) {
|
|
|
4377
4443
|
}));
|
|
4378
4444
|
return { mode: s, ranges: i };
|
|
4379
4445
|
}
|
|
4380
|
-
return s === "range" && e.ranges.length > 0 ? { mode: s, ranges:
|
|
4446
|
+
return s === "range" && e.ranges.length > 0 ? { mode: s, ranges: Ye(e.ranges) } : { mode: s, ranges: [] };
|
|
4381
4447
|
}
|
|
4382
|
-
class
|
|
4448
|
+
class wn extends R {
|
|
4383
4449
|
static manifest = {
|
|
4384
4450
|
configRules: [
|
|
4385
4451
|
{
|
|
@@ -4393,7 +4459,7 @@ class pn extends R {
|
|
|
4393
4459
|
]
|
|
4394
4460
|
};
|
|
4395
4461
|
name = "selection";
|
|
4396
|
-
styles =
|
|
4462
|
+
styles = Hi;
|
|
4397
4463
|
get defaultConfig() {
|
|
4398
4464
|
return {
|
|
4399
4465
|
mode: "cell",
|
|
@@ -4444,7 +4510,7 @@ class pn extends R {
|
|
|
4444
4510
|
return !1;
|
|
4445
4511
|
const d = n.shiftKey, c = n.ctrlKey || n.metaKey;
|
|
4446
4512
|
if (d && this.cellAnchor) {
|
|
4447
|
-
const u =
|
|
4513
|
+
const u = ie(this.cellAnchor, { row: t, col: i }), h = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null;
|
|
4448
4514
|
if (h && V(h, u))
|
|
4449
4515
|
return !1;
|
|
4450
4516
|
c ? this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] = u : this.ranges.push(u) : this.ranges = [u], this.activeRange = u;
|
|
@@ -4526,7 +4592,7 @@ class pn extends R {
|
|
|
4526
4592
|
const o = this.columns.findIndex((a) => !I(a));
|
|
4527
4593
|
o >= 0 && (t = o);
|
|
4528
4594
|
}
|
|
4529
|
-
const n =
|
|
4595
|
+
const n = ie(this.cellAnchor, { row: e.rowIndex, col: t }), r = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null;
|
|
4530
4596
|
return r && V(r, n) || (this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] = n : this.ranges.push(n), this.activeRange = n, this.emit("selection-change", this.#t()), this.requestAfterRender()), !0;
|
|
4531
4597
|
}
|
|
4532
4598
|
onCellMouseUp(e) {
|
|
@@ -4544,7 +4610,7 @@ class pn extends R {
|
|
|
4544
4610
|
if (r.forEach((o) => {
|
|
4545
4611
|
o.classList.remove("selected", "row-focus"), i && o.removeAttribute("data-selectable");
|
|
4546
4612
|
}), t === "row" && (fe(e), r.forEach((o) => {
|
|
4547
|
-
const a = o.querySelector(".cell[data-row]"), l =
|
|
4613
|
+
const a = o.querySelector(".cell[data-row]"), l = nt(a);
|
|
4548
4614
|
l >= 0 && (i && !this.isRowSelectable(l) && o.setAttribute("data-selectable", "false"), this.selected.has(l) && o.classList.add("selected", "row-focus"));
|
|
4549
4615
|
})), (t === "cell" || t === "range") && i && e.querySelectorAll(".cell[data-row][data-col]").forEach((a) => {
|
|
4550
4616
|
const l = parseInt(a.getAttribute("data-row") ?? "-1", 10), d = parseInt(a.getAttribute("data-col") ?? "-1", 10);
|
|
@@ -4576,7 +4642,7 @@ class pn extends R {
|
|
|
4576
4642
|
this.pendingKeyboardUpdate = null;
|
|
4577
4643
|
const r = this.grid._focusRow, o = this.grid._focusCol;
|
|
4578
4644
|
if (n && this.cellAnchor) {
|
|
4579
|
-
const a =
|
|
4645
|
+
const a = ie(this.cellAnchor, { row: r, col: o });
|
|
4580
4646
|
this.ranges = [a], this.activeRange = a;
|
|
4581
4647
|
} else n || (this.ranges = [], this.activeRange = null, this.cellAnchor = { row: r, col: o });
|
|
4582
4648
|
this.emit("selection-change", this.#t());
|
|
@@ -4594,7 +4660,7 @@ class pn extends R {
|
|
|
4594
4660
|
};
|
|
4595
4661
|
}
|
|
4596
4662
|
getSelectedCells() {
|
|
4597
|
-
return
|
|
4663
|
+
return Ni(this.ranges);
|
|
4598
4664
|
}
|
|
4599
4665
|
isCellSelected(e, t) {
|
|
4600
4666
|
return He(e, t, this.ranges);
|
|
@@ -4610,11 +4676,11 @@ class pn extends R {
|
|
|
4610
4676
|
endCol: t.to.col
|
|
4611
4677
|
})), this.activeRange = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null, this.emit("selection-change", {
|
|
4612
4678
|
mode: this.config.mode,
|
|
4613
|
-
ranges:
|
|
4679
|
+
ranges: Ye(this.ranges)
|
|
4614
4680
|
}), this.requestAfterRender();
|
|
4615
4681
|
}
|
|
4616
4682
|
#t() {
|
|
4617
|
-
return
|
|
4683
|
+
return zi(
|
|
4618
4684
|
this.config.mode,
|
|
4619
4685
|
{
|
|
4620
4686
|
selectedCell: this.selectedCell,
|
|
@@ -4628,20 +4694,20 @@ class pn extends R {
|
|
|
4628
4694
|
function $(s, e) {
|
|
4629
4695
|
return Math.floor(s / e);
|
|
4630
4696
|
}
|
|
4631
|
-
function
|
|
4697
|
+
function Gi(s, e) {
|
|
4632
4698
|
return {
|
|
4633
4699
|
start: s * e,
|
|
4634
4700
|
end: (s + 1) * e
|
|
4635
4701
|
};
|
|
4636
4702
|
}
|
|
4637
|
-
function
|
|
4703
|
+
function Oi(s, e, t) {
|
|
4638
4704
|
const i = $(s, t), n = $(e - 1, t), r = [];
|
|
4639
4705
|
for (let o = i; o <= n; o++)
|
|
4640
4706
|
r.push(o);
|
|
4641
4707
|
return r;
|
|
4642
4708
|
}
|
|
4643
|
-
async function
|
|
4644
|
-
const n =
|
|
4709
|
+
async function ze(s, e, t, i) {
|
|
4710
|
+
const n = Gi(e, t);
|
|
4645
4711
|
return s.getRows({
|
|
4646
4712
|
startRow: n.start,
|
|
4647
4713
|
endRow: n.end,
|
|
@@ -4649,14 +4715,14 @@ async function Ke(s, e, t, i) {
|
|
|
4649
4715
|
filterModel: i.filterModel
|
|
4650
4716
|
});
|
|
4651
4717
|
}
|
|
4652
|
-
function
|
|
4718
|
+
function Bi(s, e, t) {
|
|
4653
4719
|
const i = $(s, e), n = t.get(i);
|
|
4654
4720
|
if (!n) return;
|
|
4655
4721
|
const r = s % e;
|
|
4656
4722
|
return n[r];
|
|
4657
4723
|
}
|
|
4658
|
-
const
|
|
4659
|
-
class
|
|
4724
|
+
const Vi = 100;
|
|
4725
|
+
class bn extends R {
|
|
4660
4726
|
name = "serverSide";
|
|
4661
4727
|
get defaultConfig() {
|
|
4662
4728
|
return {
|
|
@@ -4676,12 +4742,12 @@ class mn extends R {
|
|
|
4676
4742
|
}
|
|
4677
4743
|
loadRequiredBlocks() {
|
|
4678
4744
|
if (!this.dataSource) return;
|
|
4679
|
-
const e = this.grid, t = this.config.cacheBlockSize ?? 100, i = { startRow: e._virtualization.start, endRow: e._virtualization.end }, n =
|
|
4745
|
+
const e = this.grid, t = this.config.cacheBlockSize ?? 100, i = { startRow: e._virtualization.start, endRow: e._virtualization.end }, n = Oi(i.startRow, i.endRow, t);
|
|
4680
4746
|
for (const r of n)
|
|
4681
4747
|
if (!(this.loadedBlocks.has(r) || this.loadingBlocks.has(r))) {
|
|
4682
4748
|
if (this.loadingBlocks.size >= (this.config.maxConcurrentRequests ?? 2))
|
|
4683
4749
|
break;
|
|
4684
|
-
this.loadingBlocks.add(r),
|
|
4750
|
+
this.loadingBlocks.add(r), ze(this.dataSource, r, t, {}).then((o) => {
|
|
4685
4751
|
this.loadedBlocks.set(r, o.rows), this.totalRowCount = o.totalRowCount, this.loadingBlocks.delete(r), this.requestRender(), this.loadRequiredBlocks();
|
|
4686
4752
|
}).catch(() => {
|
|
4687
4753
|
this.loadingBlocks.delete(r);
|
|
@@ -4692,7 +4758,7 @@ class mn extends R {
|
|
|
4692
4758
|
if (!this.dataSource) return [...e];
|
|
4693
4759
|
const t = [];
|
|
4694
4760
|
for (let i = 0; i < this.totalRowCount; i++) {
|
|
4695
|
-
const n =
|
|
4761
|
+
const n = Bi(i, this.config.cacheBlockSize ?? 100, this.loadedBlocks);
|
|
4696
4762
|
t.push(n ?? { __loading: !0, __index: i });
|
|
4697
4763
|
}
|
|
4698
4764
|
return t;
|
|
@@ -4700,12 +4766,12 @@ class mn extends R {
|
|
|
4700
4766
|
onScroll(e) {
|
|
4701
4767
|
this.dataSource && (this.loadRequiredBlocks(), this.scrollDebounceTimer && clearTimeout(this.scrollDebounceTimer), this.scrollDebounceTimer = setTimeout(() => {
|
|
4702
4768
|
this.loadRequiredBlocks();
|
|
4703
|
-
},
|
|
4769
|
+
}, Vi));
|
|
4704
4770
|
}
|
|
4705
4771
|
setDataSource(e) {
|
|
4706
4772
|
this.dataSource = e, this.loadedBlocks.clear(), this.loadingBlocks.clear();
|
|
4707
4773
|
const t = this.config.cacheBlockSize ?? 100;
|
|
4708
|
-
|
|
4774
|
+
ze(e, 0, t, {}).then((i) => {
|
|
4709
4775
|
this.loadedBlocks.set(0, i.rows), this.totalRowCount = i.totalRowCount, this.requestRender();
|
|
4710
4776
|
});
|
|
4711
4777
|
}
|
|
@@ -4726,52 +4792,52 @@ class mn extends R {
|
|
|
4726
4792
|
return this.loadedBlocks.size;
|
|
4727
4793
|
}
|
|
4728
4794
|
}
|
|
4729
|
-
function
|
|
4795
|
+
function Xe(s, e, t) {
|
|
4730
4796
|
return s.id !== void 0 ? String(s.id) : t ? `${t}-${e}` : String(e);
|
|
4731
4797
|
}
|
|
4732
|
-
function
|
|
4798
|
+
function ne(s, e) {
|
|
4733
4799
|
const t = new Set(s);
|
|
4734
4800
|
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
4735
4801
|
}
|
|
4736
|
-
function
|
|
4802
|
+
function se(s, e, t = null, i = 0) {
|
|
4737
4803
|
const n = e.childrenField ?? "children", r = /* @__PURE__ */ new Set();
|
|
4738
4804
|
for (let o = 0; o < s.length; o++) {
|
|
4739
|
-
const a = s[o], l =
|
|
4805
|
+
const a = s[o], l = Xe(a, o, t), d = a[n];
|
|
4740
4806
|
if (Array.isArray(d) && d.length > 0) {
|
|
4741
4807
|
r.add(l);
|
|
4742
|
-
const c =
|
|
4808
|
+
const c = se(d, e, l, i + 1);
|
|
4743
4809
|
for (const u of c) r.add(u);
|
|
4744
4810
|
}
|
|
4745
4811
|
}
|
|
4746
4812
|
return r;
|
|
4747
4813
|
}
|
|
4748
|
-
function
|
|
4814
|
+
function Wi() {
|
|
4749
4815
|
return /* @__PURE__ */ new Set();
|
|
4750
4816
|
}
|
|
4751
|
-
function
|
|
4817
|
+
function Ze(s, e, t, i = null, n = 0) {
|
|
4752
4818
|
const r = t.childrenField ?? "children";
|
|
4753
4819
|
for (let o = 0; o < s.length; o++) {
|
|
4754
|
-
const a = s[o], l =
|
|
4820
|
+
const a = s[o], l = Xe(a, o, i);
|
|
4755
4821
|
if (l === e)
|
|
4756
4822
|
return [l];
|
|
4757
4823
|
const d = a[r];
|
|
4758
4824
|
if (Array.isArray(d) && d.length > 0) {
|
|
4759
|
-
const c =
|
|
4825
|
+
const c = Ze(d, e, t, l, n + 1);
|
|
4760
4826
|
if (c)
|
|
4761
4827
|
return [l, ...c];
|
|
4762
4828
|
}
|
|
4763
4829
|
}
|
|
4764
4830
|
return null;
|
|
4765
4831
|
}
|
|
4766
|
-
function
|
|
4767
|
-
const n =
|
|
4832
|
+
function $i(s, e, t, i) {
|
|
4833
|
+
const n = Ze(s, e, t);
|
|
4768
4834
|
if (!n) return i;
|
|
4769
4835
|
const r = new Set(i);
|
|
4770
4836
|
for (let o = 0; o < n.length - 1; o++)
|
|
4771
4837
|
r.add(n[o]);
|
|
4772
4838
|
return r;
|
|
4773
4839
|
}
|
|
4774
|
-
function
|
|
4840
|
+
function Ge(s, e = "children") {
|
|
4775
4841
|
if (!Array.isArray(s) || s.length === 0) return !1;
|
|
4776
4842
|
for (const t of s) {
|
|
4777
4843
|
if (!t) continue;
|
|
@@ -4781,7 +4847,7 @@ function ze(s, e = "children") {
|
|
|
4781
4847
|
}
|
|
4782
4848
|
return !1;
|
|
4783
4849
|
}
|
|
4784
|
-
function
|
|
4850
|
+
function ji(s) {
|
|
4785
4851
|
if (!Array.isArray(s) || s.length === 0) return null;
|
|
4786
4852
|
const e = ["children", "items", "nodes", "subRows", "nested"];
|
|
4787
4853
|
for (const t of s)
|
|
@@ -4793,10 +4859,10 @@ function Wi(s) {
|
|
|
4793
4859
|
}
|
|
4794
4860
|
return null;
|
|
4795
4861
|
}
|
|
4796
|
-
const
|
|
4797
|
-
class
|
|
4862
|
+
const Ui = "@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}}}";
|
|
4863
|
+
class vn extends R {
|
|
4798
4864
|
name = "tree";
|
|
4799
|
-
styles =
|
|
4865
|
+
styles = Ui;
|
|
4800
4866
|
get defaultConfig() {
|
|
4801
4867
|
return {
|
|
4802
4868
|
childrenField: "children",
|
|
@@ -4822,15 +4888,15 @@ class wn extends R {
|
|
|
4822
4888
|
}
|
|
4823
4889
|
detect(e) {
|
|
4824
4890
|
if (!this.config.autoDetect) return !1;
|
|
4825
|
-
const t = e, i = this.config.childrenField ??
|
|
4826
|
-
return
|
|
4891
|
+
const t = e, i = this.config.childrenField ?? ji(t) ?? "children";
|
|
4892
|
+
return Ge(t, i);
|
|
4827
4893
|
}
|
|
4828
4894
|
processRows(e) {
|
|
4829
4895
|
const t = this.config.childrenField ?? "children", i = e;
|
|
4830
|
-
if (!
|
|
4896
|
+
if (!Ge(i, t))
|
|
4831
4897
|
return this.flattenedRows = [], this.rowKeyMap.clear(), this.previousVisibleKeys.clear(), [...e];
|
|
4832
4898
|
let n = this.withStableKeys(i);
|
|
4833
|
-
this.sortState && (n = this.sortTree(n, this.sortState.field, this.sortState.direction)), this.config.defaultExpanded && !this.initialExpansionDone && (this.expandedKeys =
|
|
4899
|
+
this.sortState && (n = this.sortTree(n, this.sortState.field, this.sortState.direction)), this.config.defaultExpanded && !this.initialExpansionDone && (this.expandedKeys = se(n, this.config), this.initialExpansionDone = !0), this.flattenedRows = this.flattenTree(n, this.expandedKeys), this.rowKeyMap.clear(), this.keysToAnimate.clear();
|
|
4834
4900
|
const r = /* @__PURE__ */ new Set();
|
|
4835
4901
|
for (const o of this.flattenedRows)
|
|
4836
4902
|
this.rowKeyMap.set(o.key, o), r.add(o.key), !this.previousVisibleKeys.has(o.key) && o.depth > 0 && this.keysToAnimate.add(o.key);
|
|
@@ -4908,7 +4974,7 @@ class wn extends R {
|
|
|
4908
4974
|
const i = t.getAttribute("data-tree-key");
|
|
4909
4975
|
if (!i) return !1;
|
|
4910
4976
|
const n = this.rowKeyMap.get(i);
|
|
4911
|
-
return n ? (this.expandedKeys =
|
|
4977
|
+
return n ? (this.expandedKeys = ne(this.expandedKeys, i), this.emit("tree-expand", {
|
|
4912
4978
|
key: i,
|
|
4913
4979
|
row: n.data,
|
|
4914
4980
|
expanded: this.expandedKeys.has(i),
|
|
@@ -4919,7 +4985,7 @@ class wn extends R {
|
|
|
4919
4985
|
if (e.key !== " ") return;
|
|
4920
4986
|
const t = this.grid._focusRow, i = this.flattenedRows[t];
|
|
4921
4987
|
if (i?.hasChildren)
|
|
4922
|
-
return e.preventDefault(), this.expandedKeys =
|
|
4988
|
+
return e.preventDefault(), this.expandedKeys = ne(this.expandedKeys, i.key), this.emit("tree-expand", {
|
|
4923
4989
|
key: i.key,
|
|
4924
4990
|
row: i.data,
|
|
4925
4991
|
expanded: this.expandedKeys.has(i.key),
|
|
@@ -4952,13 +5018,13 @@ class wn extends R {
|
|
|
4952
5018
|
this.expandedKeys.delete(e), this.requestRender();
|
|
4953
5019
|
}
|
|
4954
5020
|
toggle(e) {
|
|
4955
|
-
this.expandedKeys =
|
|
5021
|
+
this.expandedKeys = ne(this.expandedKeys, e), this.requestRender();
|
|
4956
5022
|
}
|
|
4957
5023
|
expandAll() {
|
|
4958
|
-
this.expandedKeys =
|
|
5024
|
+
this.expandedKeys = se(this.rows, this.config), this.requestRender();
|
|
4959
5025
|
}
|
|
4960
5026
|
collapseAll() {
|
|
4961
|
-
this.expandedKeys =
|
|
5027
|
+
this.expandedKeys = Wi(), this.requestRender();
|
|
4962
5028
|
}
|
|
4963
5029
|
isExpanded(e) {
|
|
4964
5030
|
return this.expandedKeys.has(e);
|
|
@@ -4973,10 +5039,10 @@ class wn extends R {
|
|
|
4973
5039
|
return this.rowKeyMap.get(e)?.data;
|
|
4974
5040
|
}
|
|
4975
5041
|
expandToKey(e) {
|
|
4976
|
-
this.expandedKeys =
|
|
5042
|
+
this.expandedKeys = $i(this.rows, e, this.config, this.expandedKeys), this.requestRender();
|
|
4977
5043
|
}
|
|
4978
5044
|
}
|
|
4979
|
-
function
|
|
5045
|
+
function Yi(s, e, t) {
|
|
4980
5046
|
const i = [...s.undoStack, e];
|
|
4981
5047
|
for (; i.length > t; )
|
|
4982
5048
|
i.shift();
|
|
@@ -4985,7 +5051,7 @@ function ji(s, e, t) {
|
|
|
4985
5051
|
redoStack: []
|
|
4986
5052
|
};
|
|
4987
5053
|
}
|
|
4988
|
-
function
|
|
5054
|
+
function Oe(s) {
|
|
4989
5055
|
if (s.undoStack.length === 0)
|
|
4990
5056
|
return { newState: s, action: null };
|
|
4991
5057
|
const e = [...s.undoStack], t = e.pop();
|
|
@@ -4997,7 +5063,7 @@ function Ge(s) {
|
|
|
4997
5063
|
action: t
|
|
4998
5064
|
} : { newState: s, action: null };
|
|
4999
5065
|
}
|
|
5000
|
-
function
|
|
5066
|
+
function Be(s) {
|
|
5001
5067
|
if (s.redoStack.length === 0)
|
|
5002
5068
|
return { newState: s, action: null };
|
|
5003
5069
|
const e = [...s.redoStack], t = e.pop();
|
|
@@ -5009,16 +5075,16 @@ function Oe(s) {
|
|
|
5009
5075
|
action: t
|
|
5010
5076
|
} : { newState: s, action: null };
|
|
5011
5077
|
}
|
|
5012
|
-
function
|
|
5078
|
+
function Xi(s) {
|
|
5013
5079
|
return s.undoStack.length > 0;
|
|
5014
5080
|
}
|
|
5015
|
-
function
|
|
5081
|
+
function Zi(s) {
|
|
5016
5082
|
return s.redoStack.length > 0;
|
|
5017
5083
|
}
|
|
5018
|
-
function
|
|
5084
|
+
function Ji() {
|
|
5019
5085
|
return { undoStack: [], redoStack: [] };
|
|
5020
5086
|
}
|
|
5021
|
-
function
|
|
5087
|
+
function Qi(s, e, t, i) {
|
|
5022
5088
|
return {
|
|
5023
5089
|
type: "cell-edit",
|
|
5024
5090
|
rowIndex: s,
|
|
@@ -5028,7 +5094,7 @@ function Zi(s, e, t, i) {
|
|
|
5028
5094
|
timestamp: Date.now()
|
|
5029
5095
|
};
|
|
5030
5096
|
}
|
|
5031
|
-
class
|
|
5097
|
+
class yn extends R {
|
|
5032
5098
|
static dependencies = [
|
|
5033
5099
|
{ name: "editing", required: !0, reason: "UndoRedoPlugin tracks cell edit history" }
|
|
5034
5100
|
];
|
|
@@ -5046,7 +5112,7 @@ class bn extends R {
|
|
|
5046
5112
|
onKeyDown(e) {
|
|
5047
5113
|
const t = (e.ctrlKey || e.metaKey) && e.key === "z" && !e.shiftKey, i = (e.ctrlKey || e.metaKey) && (e.key === "y" || e.key === "z" && e.shiftKey);
|
|
5048
5114
|
if (t) {
|
|
5049
|
-
const n =
|
|
5115
|
+
const n = Oe({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
5050
5116
|
if (n.action) {
|
|
5051
5117
|
const r = this.rows;
|
|
5052
5118
|
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", {
|
|
@@ -5057,7 +5123,7 @@ class bn extends R {
|
|
|
5057
5123
|
return !0;
|
|
5058
5124
|
}
|
|
5059
5125
|
if (i) {
|
|
5060
|
-
const n =
|
|
5126
|
+
const n = Be({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
5061
5127
|
if (n.action) {
|
|
5062
5128
|
const r = this.rows;
|
|
5063
5129
|
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", {
|
|
@@ -5070,7 +5136,7 @@ class bn extends R {
|
|
|
5070
5136
|
return !1;
|
|
5071
5137
|
}
|
|
5072
5138
|
recordEdit(e, t, i, n) {
|
|
5073
|
-
const r =
|
|
5139
|
+
const r = Qi(e, t, i, n), o = Yi(
|
|
5074
5140
|
{ undoStack: this.undoStack, redoStack: this.redoStack },
|
|
5075
5141
|
r,
|
|
5076
5142
|
this.config.maxHistorySize ?? 100
|
|
@@ -5078,7 +5144,7 @@ class bn extends R {
|
|
|
5078
5144
|
this.undoStack = o.undoStack, this.redoStack = o.redoStack;
|
|
5079
5145
|
}
|
|
5080
5146
|
undo() {
|
|
5081
|
-
const e =
|
|
5147
|
+
const e = Oe({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
5082
5148
|
if (e.action) {
|
|
5083
5149
|
const t = this.rows;
|
|
5084
5150
|
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();
|
|
@@ -5086,7 +5152,7 @@ class bn extends R {
|
|
|
5086
5152
|
return e.action;
|
|
5087
5153
|
}
|
|
5088
5154
|
redo() {
|
|
5089
|
-
const e =
|
|
5155
|
+
const e = Be({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
5090
5156
|
if (e.action) {
|
|
5091
5157
|
const t = this.rows;
|
|
5092
5158
|
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();
|
|
@@ -5094,13 +5160,13 @@ class bn extends R {
|
|
|
5094
5160
|
return e.action;
|
|
5095
5161
|
}
|
|
5096
5162
|
canUndo() {
|
|
5097
|
-
return
|
|
5163
|
+
return Xi({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
5098
5164
|
}
|
|
5099
5165
|
canRedo() {
|
|
5100
|
-
return
|
|
5166
|
+
return Zi({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
5101
5167
|
}
|
|
5102
5168
|
clearHistory() {
|
|
5103
|
-
const e =
|
|
5169
|
+
const e = Ji();
|
|
5104
5170
|
this.undoStack = e.undoStack, this.redoStack = e.redoStack;
|
|
5105
5171
|
}
|
|
5106
5172
|
getUndoStack() {
|
|
@@ -5110,8 +5176,8 @@ class bn extends R {
|
|
|
5110
5176
|
return [...this.redoStack];
|
|
5111
5177
|
}
|
|
5112
5178
|
}
|
|
5113
|
-
const
|
|
5114
|
-
function
|
|
5179
|
+
const en = '@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))}}';
|
|
5180
|
+
function Ve(s) {
|
|
5115
5181
|
const e = s.meta ?? {};
|
|
5116
5182
|
return e.lockPosition !== !0 && e.suppressMovable !== !0;
|
|
5117
5183
|
}
|
|
@@ -5121,7 +5187,7 @@ class M extends R {
|
|
|
5121
5187
|
];
|
|
5122
5188
|
name = "visibility";
|
|
5123
5189
|
static PANEL_ID = "columns";
|
|
5124
|
-
styles =
|
|
5190
|
+
styles = en;
|
|
5125
5191
|
get defaultConfig() {
|
|
5126
5192
|
return {
|
|
5127
5193
|
allowHideAll: !1
|
|
@@ -5211,7 +5277,7 @@ class M extends R {
|
|
|
5211
5277
|
const i = this.grid.getAllColumns().filter((n) => !n.utility);
|
|
5212
5278
|
for (let n = 0; n < i.length; n++) {
|
|
5213
5279
|
const r = i[n], o = r.header || r.field, a = document.createElement("div");
|
|
5214
|
-
a.className = r.lockVisible ? "tbw-visibility-row locked" : "tbw-visibility-row", a.setAttribute("data-field", r.field), a.setAttribute("data-index", String(n)), t &&
|
|
5280
|
+
a.className = r.lockVisible ? "tbw-visibility-row locked" : "tbw-visibility-row", a.setAttribute("data-field", r.field), a.setAttribute("data-index", String(n)), t && Ve(r) && (a.draggable = !0, a.classList.add("reorderable"), this.setupDragListeners(a, r.field, n, e));
|
|
5215
5281
|
const l = document.createElement("label");
|
|
5216
5282
|
l.className = "tbw-visibility-label";
|
|
5217
5283
|
const d = document.createElement("input");
|
|
@@ -5219,7 +5285,7 @@ class M extends R {
|
|
|
5219
5285
|
this.grid.toggleColumnVisibility(r.field), setTimeout(() => this.rebuildToggles(e), 0);
|
|
5220
5286
|
});
|
|
5221
5287
|
const c = document.createElement("span");
|
|
5222
|
-
if (c.textContent = o, l.appendChild(d), l.appendChild(c), t &&
|
|
5288
|
+
if (c.textContent = o, l.appendChild(d), l.appendChild(c), t && Ve(r)) {
|
|
5223
5289
|
const u = document.createElement("span");
|
|
5224
5290
|
u.className = "tbw-visibility-handle", this.setIcon(u, this.resolveIcon("dragHandle")), u.title = "Drag to reorder", a.appendChild(u);
|
|
5225
5291
|
}
|
|
@@ -5260,49 +5326,49 @@ class M extends R {
|
|
|
5260
5326
|
}
|
|
5261
5327
|
export {
|
|
5262
5328
|
R as BaseGridPlugin,
|
|
5263
|
-
|
|
5264
|
-
|
|
5265
|
-
|
|
5266
|
-
|
|
5267
|
-
|
|
5268
|
-
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
|
|
5329
|
+
nn as ClipboardPlugin,
|
|
5330
|
+
rn as ColumnVirtualizationPlugin,
|
|
5331
|
+
on as ContextMenuPlugin,
|
|
5332
|
+
Rn as DEFAULT_ANIMATION_CONFIG,
|
|
5333
|
+
Je as DEFAULT_GRID_ICONS,
|
|
5334
|
+
En as DGEvents,
|
|
5335
|
+
Sn as DataGridElement,
|
|
5336
|
+
sn as EditingPlugin,
|
|
5337
|
+
an as ExportPlugin,
|
|
5272
5338
|
T as FilteringPlugin,
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
|
|
5277
|
-
|
|
5278
|
-
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
|
|
5292
|
-
|
|
5293
|
-
|
|
5294
|
-
|
|
5295
|
-
|
|
5296
|
-
|
|
5297
|
-
|
|
5298
|
-
|
|
5339
|
+
kn as FitModeEnum,
|
|
5340
|
+
An as GridCSSVars,
|
|
5341
|
+
_n as GridClasses,
|
|
5342
|
+
Ln as GridDataAttrs,
|
|
5343
|
+
Tn as GridElement,
|
|
5344
|
+
In as GridSelectors,
|
|
5345
|
+
ln as GroupingColumnsPlugin,
|
|
5346
|
+
dn as GroupingRowsPlugin,
|
|
5347
|
+
je as MasterDetailPlugin,
|
|
5348
|
+
cn as MultiSortPlugin,
|
|
5349
|
+
We as PLUGIN_QUERIES,
|
|
5350
|
+
un as PinnedColumnsPlugin,
|
|
5351
|
+
hn as PinnedRowsPlugin,
|
|
5352
|
+
F as PivotPlugin,
|
|
5353
|
+
Pn as PluginEvents,
|
|
5354
|
+
Dn as PluginManager,
|
|
5355
|
+
gn as PrintPlugin,
|
|
5356
|
+
Fi as ROW_DRAG_HANDLE_FIELD,
|
|
5357
|
+
Fn as RenderPhase,
|
|
5358
|
+
fn as ReorderPlugin,
|
|
5359
|
+
pn as ResponsivePlugin,
|
|
5360
|
+
mn as RowReorderPlugin,
|
|
5361
|
+
wn as SelectionPlugin,
|
|
5362
|
+
bn as ServerSidePlugin,
|
|
5363
|
+
vn as TreePlugin,
|
|
5364
|
+
yn as UndoRedoPlugin,
|
|
5299
5365
|
M as VisibilityPlugin,
|
|
5300
|
-
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5366
|
+
Mn as builtInSort,
|
|
5367
|
+
qn as createGrid,
|
|
5368
|
+
Kn as defaultComparator,
|
|
5369
|
+
yt as defaultEditorFor,
|
|
5370
|
+
lt as defaultPasteHandler,
|
|
5371
|
+
Ai as printGridIsolated,
|
|
5372
|
+
Nn as queryGrid
|
|
5307
5373
|
};
|
|
5308
5374
|
//# sourceMappingURL=all.js.map
|