@toolbox-web/grid 1.6.0 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/all.js +448 -354
- package/all.js.map +1 -1
- package/index.js +3 -3
- package/index.js.map +1 -1
- package/lib/plugins/context-menu/ContextMenuPlugin.d.ts +11 -0
- package/lib/plugins/context-menu/ContextMenuPlugin.d.ts.map +1 -1
- package/lib/plugins/context-menu/index.js +136 -77
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/multi-sort/index.js +11 -11
- package/lib/plugins/pivot/PivotPlugin.d.ts +2 -0
- package/lib/plugins/pivot/PivotPlugin.d.ts.map +1 -1
- package/lib/plugins/pivot/index.js +29 -27
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/print/index.js +1 -1
- package/lib/plugins/print/index.js.map +1 -1
- package/lib/plugins/row-reorder/RowReorderPlugin.d.ts +18 -0
- package/lib/plugins/row-reorder/RowReorderPlugin.d.ts.map +1 -1
- package/lib/plugins/row-reorder/index.js +132 -72
- package/lib/plugins/row-reorder/index.js.map +1 -1
- package/lib/plugins/selection/index.js +1 -1
- package/lib/plugins/visibility/index.js +7 -7
- package/package.json +1 -1
- package/themes/dg-theme-bootstrap.css +60 -33
- package/themes/dg-theme-material.css +83 -52
- package/themes/dg-theme-standard.css +80 -12
- package/themes/dg-theme-vibrant.css +78 -9
- package/umd/grid.all.umd.js +22 -22
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +1 -1
- package/umd/grid.umd.js.map +1 -1
- package/umd/plugins/context-menu.umd.js +1 -1
- package/umd/plugins/context-menu.umd.js.map +1 -1
- package/umd/plugins/multi-sort.umd.js +1 -1
- package/umd/plugins/multi-sort.umd.js.map +1 -1
- package/umd/plugins/pivot.umd.js +1 -1
- package/umd/plugins/pivot.umd.js.map +1 -1
- package/umd/plugins/print.umd.js +1 -1
- package/umd/plugins/print.umd.js.map +1 -1
- package/umd/plugins/row-reorder.umd.js +1 -1
- package/umd/plugins/row-reorder.umd.js.map +1 -1
- package/umd/plugins/selection.umd.js +1 -1
- package/umd/plugins/selection.umd.js.map +1 -1
- package/umd/plugins/visibility.umd.js +1 -1
- package/umd/plugins/visibility.umd.js.map +1 -1
package/all.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { BaseGridPlugin as _, DEFAULT_GRID_ICONS as
|
|
2
|
-
import { DEFAULT_ANIMATION_CONFIG as Fn, DGEvents as In, DataGridElement as Pn, FitModeEnum as Dn, GridCSSVars as Mn, GridClasses as Nn, GridDataAttrs as qn, DataGridElement as
|
|
3
|
-
const Qe = "__tbw_expander",
|
|
1
|
+
import { BaseGridPlugin as _, DEFAULT_GRID_ICONS as at, a as lt, runAggregator as te, e as dt, s as ct, PLUGIN_QUERIES as Je, getAggregator as ye, getValueAggregator as ut, b as D, c as xe, g as ht } from "./index.js";
|
|
2
|
+
import { DEFAULT_ANIMATION_CONFIG as Fn, DGEvents as In, DataGridElement as Pn, FitModeEnum as Dn, GridCSSVars as Mn, GridClasses as Nn, GridDataAttrs as qn, DataGridElement as Hn, GridSelectors as zn, PluginEvents as Kn, PluginManager as On, RenderPhase as Gn, builtInSort as Bn, createGrid as Vn, defaultComparator as Wn, queryGrid as $n } from "./index.js";
|
|
3
|
+
const Qe = "__tbw_expander", gt = 32;
|
|
4
4
|
function pe(s) {
|
|
5
5
|
return s.field === Qe;
|
|
6
6
|
}
|
|
7
|
-
function
|
|
7
|
+
function H(s) {
|
|
8
8
|
return s.meta?.utility === !0;
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function ft(s) {
|
|
11
11
|
return s.find(pe);
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function pt(s) {
|
|
14
14
|
return {
|
|
15
15
|
field: Qe,
|
|
16
16
|
header: "",
|
|
17
|
-
width:
|
|
17
|
+
width: gt,
|
|
18
18
|
resizable: !1,
|
|
19
19
|
sortable: !1,
|
|
20
20
|
filterable: !1,
|
|
@@ -49,14 +49,14 @@ function Ce(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 mt() {
|
|
53
53
|
try {
|
|
54
54
|
return await navigator.clipboard.readText();
|
|
55
55
|
} catch {
|
|
56
56
|
return "";
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function wt(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 mt(s, e) {
|
|
|
81
81
|
}
|
|
82
82
|
}), e.rows = d;
|
|
83
83
|
}
|
|
84
|
-
class
|
|
84
|
+
class hn extends _ {
|
|
85
85
|
static dependencies = [
|
|
86
86
|
{ name: "selection", required: !1, reason: "Enables copy/paste of selected cells instead of entire grid" }
|
|
87
87
|
];
|
|
@@ -157,7 +157,7 @@ class un extends _ {
|
|
|
157
157
|
if (!this.grid) return;
|
|
158
158
|
const { pasteHandler: t } = this.config;
|
|
159
159
|
if (t === null) return;
|
|
160
|
-
(t ??
|
|
160
|
+
(t ?? wt)(e, this.grid);
|
|
161
161
|
}
|
|
162
162
|
#n() {
|
|
163
163
|
try {
|
|
@@ -169,7 +169,7 @@ class un extends _ {
|
|
|
169
169
|
}
|
|
170
170
|
#i(e) {
|
|
171
171
|
const { startRow: t, startCol: i, endRow: n, endCol: r } = e, o = Math.min(t, n), a = Math.max(t, n), l = Math.min(i, r), d = Math.max(i, r), c = this.config.delimiter ?? " ", u = this.config.newline ?? `
|
|
172
|
-
`, h = [], g = this.columns.slice(l, d + 1).filter((f) => !
|
|
172
|
+
`, h = [], g = this.columns.slice(l, d + 1).filter((f) => !H(f));
|
|
173
173
|
if (this.config.includeHeaders) {
|
|
174
174
|
const f = g.map((p) => p.header || p.field);
|
|
175
175
|
h.push(f.join(c));
|
|
@@ -225,23 +225,23 @@ class un extends _ {
|
|
|
225
225
|
return await ie(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 mt();
|
|
229
229
|
return e ? Ce(e, this.config) : null;
|
|
230
230
|
}
|
|
231
231
|
getLastCopied() {
|
|
232
232
|
return this.lastCopied;
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
|
-
const
|
|
235
|
+
const Ee = 100;
|
|
236
236
|
function me(s) {
|
|
237
237
|
if (s == null)
|
|
238
|
-
return
|
|
238
|
+
return Ee;
|
|
239
239
|
if (typeof s == "number")
|
|
240
240
|
return s;
|
|
241
241
|
const e = parseFloat(s);
|
|
242
|
-
return isNaN(e) ?
|
|
242
|
+
return isNaN(e) ? Ee : e;
|
|
243
243
|
}
|
|
244
|
-
function
|
|
244
|
+
function Re(s) {
|
|
245
245
|
return s.map((e) => me(e.width));
|
|
246
246
|
}
|
|
247
247
|
function Se(s) {
|
|
@@ -254,11 +254,11 @@ function Se(s) {
|
|
|
254
254
|
function ke(s) {
|
|
255
255
|
return s.reduce((e, t) => e + me(t.width), 0);
|
|
256
256
|
}
|
|
257
|
-
function
|
|
257
|
+
function bt(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 = vt(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 wt(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 vt(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 bt(s, e, t) {
|
|
|
283
283
|
}
|
|
284
284
|
return i;
|
|
285
285
|
}
|
|
286
|
-
function
|
|
286
|
+
function yt(s, e, t) {
|
|
287
287
|
return t ? s > e : !1;
|
|
288
288
|
}
|
|
289
|
-
class
|
|
289
|
+
class gn extends _ {
|
|
290
290
|
name = "columnVirtualization";
|
|
291
291
|
get defaultConfig() {
|
|
292
292
|
return {
|
|
@@ -305,16 +305,16 @@ class hn extends _ {
|
|
|
305
305
|
attach(e) {
|
|
306
306
|
super.attach(e);
|
|
307
307
|
const t = this.columns;
|
|
308
|
-
this.columnWidths =
|
|
308
|
+
this.columnWidths = Re(t), this.columnOffsets = Se(t), this.totalWidth = ke(t), this.endCol = t.length - 1;
|
|
309
309
|
}
|
|
310
310
|
detach() {
|
|
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 =
|
|
315
|
-
if (this.isVirtualized = t ?? !1, this.columnWidths =
|
|
314
|
+
const t = yt(e.length, this.config.threshold ?? 30, this.config.autoEnable ?? !0);
|
|
315
|
+
if (this.isVirtualized = t ?? !1, this.columnWidths = Re(e), this.columnOffsets = Se(e), this.totalWidth = ke(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 = bt(
|
|
318
318
|
this.scrollLeft,
|
|
319
319
|
i,
|
|
320
320
|
this.columnOffsets,
|
|
@@ -354,14 +354,14 @@ class hn extends _ {
|
|
|
354
354
|
return this.totalWidth;
|
|
355
355
|
}
|
|
356
356
|
}
|
|
357
|
-
const ne = "@layer tbw-plugins{.tbw-context-menu{position:fixed;background:var(--tbw-context-menu-bg, var(--tbw-color-panel-bg
|
|
357
|
+
const ne = "@layer tbw-plugins{.tbw-context-menu{position:fixed;background:var(--tbw-context-menu-bg, var(--tbw-color-panel-bg));color:var(--tbw-context-menu-fg, var(--tbw-color-fg));border:1px solid var(--tbw-context-menu-border, var(--tbw-color-border));border-radius:var(--tbw-context-menu-radius, var(--tbw-border-radius));box-shadow:0 2px 10px var(--tbw-context-menu-shadow, var(--tbw-color-shadow));min-width:var(--tbw-context-menu-min-width, var(--tbw-menu-min-width));padding:var(--tbw-spacing-xs) 0;z-index:10000;font-size:var(--tbw-context-menu-font-size, var(--tbw-font-size-sm));font-family:var(--tbw-context-menu-font-family, var(--tbw-font-family))}.tbw-context-menu-item{display:flex;align-items:center;padding:var(--tbw-context-menu-item-padding, var(--tbw-menu-item-padding));cursor:pointer;gap:var(--tbw-context-menu-item-gap, var(--tbw-menu-item-gap))}.tbw-context-menu-item:hover:not(.disabled){background:var(--tbw-context-menu-hover, var(--tbw-color-row-hover))}.tbw-context-menu-item.disabled{opacity:.5;cursor:default}.tbw-context-menu-item.danger{color:var(--tbw-context-menu-danger, var(--tbw-color-danger))}.tbw-context-menu-icon{width:var(--tbw-context-menu-icon-size, var(--tbw-icon-size));text-align:center}.tbw-context-menu-label{flex:1}.tbw-context-menu-shortcut{color:var(--tbw-context-menu-muted, var(--tbw-color-fg-muted));font-size:var(--tbw-context-menu-shortcut-size, var(--tbw-font-size-xs))}.tbw-context-menu-arrow{font-size:var(--tbw-context-menu-arrow-size, var(--tbw-font-size-2xs));color:var(--tbw-context-menu-muted, var(--tbw-color-fg-muted))}.tbw-context-menu-separator{height:1px;background:var(--tbw-context-menu-border, var(--tbw-color-border));margin:var(--tbw-spacing-xs) 0}}";
|
|
358
358
|
function he(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 xt(s, e) {
|
|
362
362
|
return s.disabled === !0 ? !0 : typeof s.disabled == "function" ? s.disabled(e) : !1;
|
|
363
363
|
}
|
|
364
|
-
function ge(s, e, t, i =
|
|
364
|
+
function ge(s, e, t, i = at.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 ge(s, e, t, i = st.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 = xt(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);
|
|
@@ -405,7 +405,7 @@ function Ae(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
|
|
408
|
+
let K = null, O = null, N = null, re = 0;
|
|
409
409
|
const oe = [
|
|
410
410
|
{
|
|
411
411
|
id: "copy",
|
|
@@ -424,7 +424,7 @@ const oe = [
|
|
|
424
424
|
}
|
|
425
425
|
}
|
|
426
426
|
];
|
|
427
|
-
class
|
|
427
|
+
class et extends _ {
|
|
428
428
|
name = "contextMenu";
|
|
429
429
|
get defaultConfig() {
|
|
430
430
|
return {
|
|
@@ -441,15 +441,63 @@ class gn extends _ {
|
|
|
441
441
|
detach() {
|
|
442
442
|
this.menuElement && (this.menuElement.remove(), this.menuElement = null), this.isOpen = !1, this.params = null, this.uninstallGlobalHandlers();
|
|
443
443
|
}
|
|
444
|
+
static CSS_VARS_TO_COPY = [
|
|
445
|
+
"--tbw-color-panel-bg",
|
|
446
|
+
"--tbw-color-fg",
|
|
447
|
+
"--tbw-color-fg-muted",
|
|
448
|
+
"--tbw-color-border",
|
|
449
|
+
"--tbw-color-row-hover",
|
|
450
|
+
"--tbw-color-shadow",
|
|
451
|
+
"--tbw-color-danger",
|
|
452
|
+
"--tbw-border-radius",
|
|
453
|
+
"--tbw-font-family",
|
|
454
|
+
"--tbw-font-size-sm",
|
|
455
|
+
"--tbw-font-size-xs",
|
|
456
|
+
"--tbw-font-size-2xs",
|
|
457
|
+
"--tbw-spacing-xs",
|
|
458
|
+
"--tbw-icon-size",
|
|
459
|
+
"--tbw-menu-min-width",
|
|
460
|
+
"--tbw-menu-item-padding",
|
|
461
|
+
"--tbw-menu-item-gap",
|
|
462
|
+
"--tbw-context-menu-bg",
|
|
463
|
+
"--tbw-context-menu-fg",
|
|
464
|
+
"--tbw-context-menu-border",
|
|
465
|
+
"--tbw-context-menu-radius",
|
|
466
|
+
"--tbw-context-menu-shadow",
|
|
467
|
+
"--tbw-context-menu-hover",
|
|
468
|
+
"--tbw-context-menu-danger",
|
|
469
|
+
"--tbw-context-menu-muted",
|
|
470
|
+
"--tbw-context-menu-min-width",
|
|
471
|
+
"--tbw-context-menu-font-size",
|
|
472
|
+
"--tbw-context-menu-font-family",
|
|
473
|
+
"--tbw-context-menu-item-padding",
|
|
474
|
+
"--tbw-context-menu-item-gap",
|
|
475
|
+
"--tbw-context-menu-icon-size",
|
|
476
|
+
"--tbw-context-menu-shortcut-size",
|
|
477
|
+
"--tbw-context-menu-arrow-size"
|
|
478
|
+
];
|
|
479
|
+
copyGridStyles(e) {
|
|
480
|
+
const t = this.gridElement;
|
|
481
|
+
if (!t) return;
|
|
482
|
+
const i = getComputedStyle(t), n = [];
|
|
483
|
+
for (const r of et.CSS_VARS_TO_COPY) {
|
|
484
|
+
const o = i.getPropertyValue(r).trim();
|
|
485
|
+
o && n.push(`${r}: ${o}`);
|
|
486
|
+
}
|
|
487
|
+
if (n.length > 0) {
|
|
488
|
+
const r = e.getAttribute("style") || "";
|
|
489
|
+
e.setAttribute("style", r + n.join("; ") + ";");
|
|
490
|
+
}
|
|
491
|
+
}
|
|
444
492
|
installGlobalHandlers() {
|
|
445
|
-
!N && typeof document < "u" && typeof ne == "string" && ne && (N = document.createElement("style"), N.id = "tbw-context-menu-styles", N.textContent = ne, document.head.appendChild(N)),
|
|
493
|
+
!N && typeof document < "u" && typeof ne == "string" && ne && (N = document.createElement("style"), N.id = "tbw-context-menu-styles", N.textContent = ne, document.head.appendChild(N)), K || (K = () => {
|
|
446
494
|
document.querySelectorAll(".tbw-context-menu").forEach((t) => t.remove());
|
|
447
|
-
}, document.addEventListener("click",
|
|
495
|
+
}, document.addEventListener("click", K)), O || (O = (e) => {
|
|
448
496
|
e.key === "Escape" && document.querySelectorAll(".tbw-context-menu").forEach((i) => i.remove());
|
|
449
|
-
}, document.addEventListener("keydown",
|
|
497
|
+
}, document.addEventListener("keydown", O));
|
|
450
498
|
}
|
|
451
499
|
uninstallGlobalHandlers() {
|
|
452
|
-
re--, !(re > 0) && (
|
|
500
|
+
re--, !(re > 0) && (K && (document.removeEventListener("click", K), K = null), O && (document.removeEventListener("keydown", O), O = null), N && (N.remove(), N = null));
|
|
453
501
|
}
|
|
454
502
|
afterRender() {
|
|
455
503
|
const e = this.gridElement;
|
|
@@ -495,7 +543,7 @@ class gn extends _ {
|
|
|
495
543
|
c.action && c.action(l), this.menuElement?.remove(), this.menuElement = null, this.isOpen = !1;
|
|
496
544
|
},
|
|
497
545
|
this.gridIcons.submenuArrow
|
|
498
|
-
), document.body.appendChild(this.menuElement), Ae(this.menuElement, n.clientX, n.clientY), this.isOpen = !0, this.emit("context-menu-open", { params: l, items: d }));
|
|
546
|
+
), document.body.appendChild(this.menuElement), this.copyGridStyles(this.menuElement), Ae(this.menuElement, n.clientX, n.clientY), this.isOpen = !0, this.emit("context-menu-open", { params: l, items: d }));
|
|
499
547
|
}));
|
|
500
548
|
}
|
|
501
549
|
showMenu(e, t, i) {
|
|
@@ -516,7 +564,7 @@ class gn extends _ {
|
|
|
516
564
|
o.action && o.action(n), this.menuElement?.remove(), this.menuElement = null, this.isOpen = !1;
|
|
517
565
|
},
|
|
518
566
|
this.gridIcons.submenuArrow
|
|
519
|
-
), document.body.appendChild(this.menuElement), Ae(this.menuElement, e, t), this.isOpen = !0;
|
|
567
|
+
), document.body.appendChild(this.menuElement), this.copyGridStyles(this.menuElement), Ae(this.menuElement, e, t), this.isOpen = !0;
|
|
520
568
|
}
|
|
521
569
|
hideMenu() {
|
|
522
570
|
this.menuElement && (this.menuElement.remove(), this.menuElement = null, this.isOpen = !1);
|
|
@@ -525,8 +573,8 @@ class gn extends _ {
|
|
|
525
573
|
return this.isOpen;
|
|
526
574
|
}
|
|
527
575
|
}
|
|
528
|
-
const
|
|
529
|
-
function
|
|
576
|
+
const Ct = "@layer tbw-plugins{tbw-grid{--tbw-editing-bg: var(--tbw-color-selection);--tbw-editing-row-bg: var(--tbw-editing-bg);--tbw-editing-border: var(--tbw-border-input, 1px solid var(--tbw-color-border-strong));--tbw-padding-editing-input: var(--tbw-cell-padding-input, 2px 6px);--tbw-font-size-editor: inherit;--tbw-editing-row-outline-color: var(--tbw-color-accent);--tbw-editing-row-outline-width: 1px;.data-grid-row:has(.editing){background:var(--tbw-editing-row-bg);outline:var(--tbw-editing-row-outline-width) solid var(--tbw-editing-row-outline-color);outline-offset:calc(-1 * var(--tbw-editing-row-outline-width))}.data-grid-row>.cell.editing{overflow:hidden;padding:0;display:flex;min-height:calc(var(--tbw-row-height) + 2px);align-items:center;justify-content:center}.data-grid-row>.cell.editing input:not([type=checkbox]),.data-grid-row>.cell.editing select,.data-grid-row>.cell.editing textarea{width:100%;height:100%;flex:1 1 auto;min-width:0;border:var(--tbw-editing-border);padding:var(--tbw-padding-editing-input);font-size:var(--tbw-font-size-editor)}.tbw-editor-host{display:contents}}}";
|
|
577
|
+
function Et(s) {
|
|
530
578
|
const e = s.options;
|
|
531
579
|
return e ? typeof e == "function" ? e() : e : [];
|
|
532
580
|
}
|
|
@@ -540,13 +588,13 @@ function Rt(s) {
|
|
|
540
588
|
}), i;
|
|
541
589
|
};
|
|
542
590
|
}
|
|
543
|
-
function
|
|
591
|
+
function St() {
|
|
544
592
|
return (s) => {
|
|
545
593
|
const e = document.createElement("input");
|
|
546
594
|
return e.type = "checkbox", e.checked = !!s.value, e.addEventListener("change", () => s.commit(e.checked)), e;
|
|
547
595
|
};
|
|
548
596
|
}
|
|
549
|
-
function
|
|
597
|
+
function kt(s) {
|
|
550
598
|
return (e) => {
|
|
551
599
|
const t = s.editorParams, i = document.createElement("input");
|
|
552
600
|
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 +602,14 @@ function St(s) {
|
|
|
554
602
|
}), i;
|
|
555
603
|
};
|
|
556
604
|
}
|
|
557
|
-
function
|
|
605
|
+
function At(s) {
|
|
558
606
|
return (e) => {
|
|
559
607
|
const t = s.editorParams, i = document.createElement("select");
|
|
560
608
|
if (s.multi && (i.multiple = !0), t?.includeEmpty) {
|
|
561
609
|
const o = document.createElement("option");
|
|
562
610
|
o.value = "", o.textContent = t.emptyLabel ?? "", i.appendChild(o);
|
|
563
611
|
}
|
|
564
|
-
|
|
612
|
+
Et(s).forEach((o) => {
|
|
565
613
|
const a = document.createElement("option");
|
|
566
614
|
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
615
|
});
|
|
@@ -577,7 +625,7 @@ function kt(s) {
|
|
|
577
625
|
}), i;
|
|
578
626
|
};
|
|
579
627
|
}
|
|
580
|
-
function
|
|
628
|
+
function _t(s) {
|
|
581
629
|
return (e) => {
|
|
582
630
|
const t = s.editorParams, i = document.createElement("input");
|
|
583
631
|
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,18 +633,18 @@ function At(s) {
|
|
|
585
633
|
}), i;
|
|
586
634
|
};
|
|
587
635
|
}
|
|
588
|
-
function
|
|
636
|
+
function Tt(s) {
|
|
589
637
|
switch (s.type) {
|
|
590
638
|
case "number":
|
|
591
639
|
return Rt(s);
|
|
592
640
|
case "boolean":
|
|
593
|
-
return
|
|
641
|
+
return St();
|
|
594
642
|
case "date":
|
|
595
|
-
return St(s);
|
|
596
|
-
case "select":
|
|
597
643
|
return kt(s);
|
|
598
|
-
|
|
644
|
+
case "select":
|
|
599
645
|
return At(s);
|
|
646
|
+
default:
|
|
647
|
+
return _t(s);
|
|
600
648
|
}
|
|
601
649
|
}
|
|
602
650
|
const se = 'input,select,textarea,[contenteditable="true"],[contenteditable=""],[tabindex]:not([tabindex="-1"])';
|
|
@@ -617,11 +665,11 @@ function Lt(s, e) {
|
|
|
617
665
|
function $(s) {
|
|
618
666
|
return !(typeof s != "string" || s === "__proto__" || s === "constructor" || s === "prototype");
|
|
619
667
|
}
|
|
620
|
-
function
|
|
668
|
+
function Ft(s) {
|
|
621
669
|
const e = (s.__editingCellCount ?? 0) + 1;
|
|
622
670
|
s.__editingCellCount = e, s.setAttribute("data-has-editing", "");
|
|
623
671
|
}
|
|
624
|
-
function
|
|
672
|
+
function It(s) {
|
|
625
673
|
s.__editingCellCount = 0, s.removeAttribute("data-has-editing");
|
|
626
674
|
}
|
|
627
675
|
function U(s, e) {
|
|
@@ -629,7 +677,7 @@ function U(s, e) {
|
|
|
629
677
|
}
|
|
630
678
|
function _e(s) {
|
|
631
679
|
}
|
|
632
|
-
function
|
|
680
|
+
function Pt(s, e, t) {
|
|
633
681
|
const i = s.querySelector("input,textarea,select");
|
|
634
682
|
i && (i.addEventListener("blur", () => {
|
|
635
683
|
t(U(i, e));
|
|
@@ -657,7 +705,7 @@ class fn extends _ {
|
|
|
657
705
|
]
|
|
658
706
|
};
|
|
659
707
|
name = "editing";
|
|
660
|
-
styles =
|
|
708
|
+
styles = Ct;
|
|
661
709
|
get defaultConfig() {
|
|
662
710
|
return {
|
|
663
711
|
editOn: "click"
|
|
@@ -914,7 +962,7 @@ class fn extends _ {
|
|
|
914
962
|
for (const l of this.#i)
|
|
915
963
|
l.startsWith(`${e}:`) && this.#i.delete(l);
|
|
916
964
|
o && (o.querySelectorAll(".cell.editing").forEach((l) => {
|
|
917
|
-
l.classList.remove("editing"),
|
|
965
|
+
l.classList.remove("editing"), It(l.parentElement);
|
|
918
966
|
}), this.requestRender()), this.#r = !0, o || (this.#g(i), this.#r = !1);
|
|
919
967
|
}
|
|
920
968
|
#h(e, t, i, n) {
|
|
@@ -943,7 +991,7 @@ class fn extends _ {
|
|
|
943
991
|
})) return;
|
|
944
992
|
n[r] = i, l && this.#n.add(l), this.#a();
|
|
945
993
|
const h = a.findRenderedRowElement?.(e);
|
|
946
|
-
h && (h.classList.add("changed"),
|
|
994
|
+
h && (h.classList.add("changed"), lt(h, "change"));
|
|
947
995
|
}
|
|
948
996
|
#p(e, t, i, n, r, o) {
|
|
949
997
|
if (!i.editable || r.classList.contains("editing")) return;
|
|
@@ -955,7 +1003,7 @@ class fn extends _ {
|
|
|
955
1003
|
const l = a ? (x) => this.grid.updateRow(a, x, "cascade") : _e, d = $(i.field) ? e[i.field] : void 0;
|
|
956
1004
|
r.classList.add("editing"), this.#i.add(`${t}:${n}`);
|
|
957
1005
|
const c = r.parentElement;
|
|
958
|
-
c &&
|
|
1006
|
+
c && Ft(c);
|
|
959
1007
|
let u = !1;
|
|
960
1008
|
const h = (x) => {
|
|
961
1009
|
u || this.#e === -1 || this.#h(t, i, x, e);
|
|
@@ -965,7 +1013,7 @@ class fn extends _ {
|
|
|
965
1013
|
f.className = "tbw-editor-host", r.innerHTML = "", r.appendChild(f), f.addEventListener("keydown", (x) => {
|
|
966
1014
|
x.key === "Enter" && (x.stopPropagation(), x.preventDefault(), u = !0, this.#s(t, !1)), x.key === "Escape" && (x.stopPropagation(), x.preventDefault(), g(), this.#s(t, !0));
|
|
967
1015
|
});
|
|
968
|
-
const p = i, w = p.__editorTemplate, v = Lt(this.grid, p) ??
|
|
1016
|
+
const p = i, w = p.__editorTemplate, v = Lt(this.grid, p) ?? Tt(i), y = d;
|
|
969
1017
|
if (v === "template" && w)
|
|
970
1018
|
this.#l(f, p, e, d, h, g, o, t);
|
|
971
1019
|
else if (typeof v == "string") {
|
|
@@ -984,7 +1032,7 @@ class fn extends _ {
|
|
|
984
1032
|
cancel: g,
|
|
985
1033
|
updateRow: l
|
|
986
1034
|
}, A = v(x);
|
|
987
|
-
typeof A == "string" ? (f.innerHTML = A,
|
|
1035
|
+
typeof A == "string" ? (f.innerHTML = A, Pt(f, i, h)) : A instanceof Node && f.appendChild(A), o || queueMicrotask(() => {
|
|
988
1036
|
f.querySelector(se)?.focus({ preventScroll: !0 });
|
|
989
1037
|
});
|
|
990
1038
|
} else if (v && typeof v == "object") {
|
|
@@ -1061,7 +1109,7 @@ class fn extends _ {
|
|
|
1061
1109
|
});
|
|
1062
1110
|
}
|
|
1063
1111
|
}
|
|
1064
|
-
function
|
|
1112
|
+
function Te(s, e = !0) {
|
|
1065
1113
|
if (s == null) return "";
|
|
1066
1114
|
if (s instanceof Date) return s.toISOString();
|
|
1067
1115
|
if (typeof s == "object") return JSON.stringify(s);
|
|
@@ -1069,20 +1117,20 @@ function Le(s, e = !0) {
|
|
|
1069
1117
|
return e && (t.includes(",") || t.includes('"') || t.includes(`
|
|
1070
1118
|
`) || t.includes("\r")) ? `"${t.replace(/"/g, '""')}"` : t;
|
|
1071
1119
|
}
|
|
1072
|
-
function
|
|
1120
|
+
function Dt(s, e, t, i = {}) {
|
|
1073
1121
|
const n = i.delimiter ?? ",", r = i.newline ?? `
|
|
1074
1122
|
`, o = [], a = i.bom ? "\uFEFF" : "";
|
|
1075
1123
|
if (t.includeHeaders !== !1) {
|
|
1076
1124
|
const l = e.map((d) => {
|
|
1077
1125
|
const c = d.header || d.field, u = t.processHeader ? t.processHeader(c, d.field) : c;
|
|
1078
|
-
return
|
|
1126
|
+
return Te(u);
|
|
1079
1127
|
});
|
|
1080
1128
|
o.push(l.join(n));
|
|
1081
1129
|
}
|
|
1082
1130
|
for (const l of s) {
|
|
1083
1131
|
const d = e.map((c) => {
|
|
1084
1132
|
let u = l[c.field];
|
|
1085
|
-
return t.processCell && (u = t.processCell(u, c.field, l)),
|
|
1133
|
+
return t.processCell && (u = t.processCell(u, c.field, l)), Te(u);
|
|
1086
1134
|
});
|
|
1087
1135
|
o.push(d.join(n));
|
|
1088
1136
|
}
|
|
@@ -1092,14 +1140,14 @@ function we(s, e) {
|
|
|
1092
1140
|
const t = URL.createObjectURL(s), i = document.createElement("a");
|
|
1093
1141
|
i.href = t, i.download = e, i.style.display = "none", document.body.appendChild(i), i.click(), document.body.removeChild(i), URL.revokeObjectURL(t);
|
|
1094
1142
|
}
|
|
1095
|
-
function
|
|
1143
|
+
function Mt(s, e) {
|
|
1096
1144
|
const t = new Blob([s], { type: "text/csv;charset=utf-8;" });
|
|
1097
1145
|
we(t, e);
|
|
1098
1146
|
}
|
|
1099
|
-
function
|
|
1147
|
+
function Le(s) {
|
|
1100
1148
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
1101
1149
|
}
|
|
1102
|
-
function
|
|
1150
|
+
function Nt(s, e, t) {
|
|
1103
1151
|
let i = `<?xml version="1.0" encoding="UTF-8"?>
|
|
1104
1152
|
<?mso-application progid="Excel.Sheet"?>
|
|
1105
1153
|
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
|
|
@@ -1111,7 +1159,7 @@ function Mt(s, e, t) {
|
|
|
1111
1159
|
<Row>`;
|
|
1112
1160
|
for (const n of e) {
|
|
1113
1161
|
const r = n.header || n.field, o = t.processHeader ? t.processHeader(r, n.field) : r;
|
|
1114
|
-
i += `<Cell><Data ss:Type="String">${
|
|
1162
|
+
i += `<Cell><Data ss:Type="String">${Le(o)}</Data></Cell>`;
|
|
1115
1163
|
}
|
|
1116
1164
|
i += "</Row>";
|
|
1117
1165
|
}
|
|
@@ -1122,7 +1170,7 @@ function Mt(s, e, t) {
|
|
|
1122
1170
|
let o = n[r.field];
|
|
1123
1171
|
t.processCell && (o = t.processCell(o, r.field, n));
|
|
1124
1172
|
let a = "String", l = "";
|
|
1125
|
-
o == null ? l = "" : typeof o == "number" && !isNaN(o) ? (a = "Number", l = String(o)) : o instanceof Date ? (a = "DateTime", l = o.toISOString()) : l =
|
|
1173
|
+
o == null ? l = "" : typeof o == "number" && !isNaN(o) ? (a = "Number", l = String(o)) : o instanceof Date ? (a = "DateTime", l = o.toISOString()) : l = Le(String(o)), i += `<Cell><Data ss:Type="${a}">${l}</Data></Cell>`;
|
|
1126
1174
|
}
|
|
1127
1175
|
i += "</Row>";
|
|
1128
1176
|
}
|
|
@@ -1131,7 +1179,7 @@ function Mt(s, e, t) {
|
|
|
1131
1179
|
</Worksheet>
|
|
1132
1180
|
</Workbook>`, i;
|
|
1133
1181
|
}
|
|
1134
|
-
function
|
|
1182
|
+
function qt(s, e) {
|
|
1135
1183
|
const t = e.endsWith(".xls") ? e : `${e}.xls`, i = new Blob([s], {
|
|
1136
1184
|
type: "application/vnd.ms-excel;charset=utf-8;"
|
|
1137
1185
|
});
|
|
@@ -1174,13 +1222,13 @@ class pn extends _ {
|
|
|
1174
1222
|
try {
|
|
1175
1223
|
switch (e) {
|
|
1176
1224
|
case "csv": {
|
|
1177
|
-
const l =
|
|
1178
|
-
a = a.endsWith(".csv") ? a : `${a}.csv`,
|
|
1225
|
+
const l = Dt(o, r, n, { bom: !0 });
|
|
1226
|
+
a = a.endsWith(".csv") ? a : `${a}.csv`, Mt(l, a);
|
|
1179
1227
|
break;
|
|
1180
1228
|
}
|
|
1181
1229
|
case "excel": {
|
|
1182
|
-
const l =
|
|
1183
|
-
a = a.endsWith(".xls") ? a : `${a}.xls`,
|
|
1230
|
+
const l = Nt(o, r, n);
|
|
1231
|
+
a = a.endsWith(".xls") ? a : `${a}.xls`, qt(l, a);
|
|
1184
1232
|
break;
|
|
1185
1233
|
}
|
|
1186
1234
|
case "json": {
|
|
@@ -1231,7 +1279,7 @@ class pn extends _ {
|
|
|
1231
1279
|
return this.lastExportInfo;
|
|
1232
1280
|
}
|
|
1233
1281
|
}
|
|
1234
|
-
function
|
|
1282
|
+
function Ht(s) {
|
|
1235
1283
|
const { totalRows: e, viewportHeight: t, scrollTop: i, rowHeight: n, overscan: r } = s, o = Math.ceil(t / n);
|
|
1236
1284
|
let a = Math.floor(i / n) - r;
|
|
1237
1285
|
a < 0 && (a = 0);
|
|
@@ -1243,10 +1291,10 @@ function qt(s) {
|
|
|
1243
1291
|
totalHeight: e * n
|
|
1244
1292
|
};
|
|
1245
1293
|
}
|
|
1246
|
-
function
|
|
1294
|
+
function zt(s, e) {
|
|
1247
1295
|
return s <= e;
|
|
1248
1296
|
}
|
|
1249
|
-
function
|
|
1297
|
+
function Kt(s, e, t = !1) {
|
|
1250
1298
|
const i = s[e.field];
|
|
1251
1299
|
if (e.operator === "blank")
|
|
1252
1300
|
return i == null || i === "";
|
|
@@ -1285,8 +1333,8 @@ function Ht(s, e, t = !1) {
|
|
|
1285
1333
|
return !0;
|
|
1286
1334
|
}
|
|
1287
1335
|
}
|
|
1288
|
-
function
|
|
1289
|
-
return e.length ? s.filter((i) => e.every((n) =>
|
|
1336
|
+
function Ot(s, e, t = !1) {
|
|
1337
|
+
return e.length ? s.filter((i) => e.every((n) => Kt(i, n, t))) : s;
|
|
1290
1338
|
}
|
|
1291
1339
|
function Gt(s) {
|
|
1292
1340
|
return JSON.stringify(
|
|
@@ -1306,10 +1354,10 @@ function Fe(s, e) {
|
|
|
1306
1354
|
}
|
|
1307
1355
|
return [...t].sort((i, n) => typeof i == "number" && typeof n == "number" ? i - n : String(i).localeCompare(String(n)));
|
|
1308
1356
|
}
|
|
1309
|
-
const
|
|
1357
|
+
const Bt = '@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}}}', Vt = "@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));min-height:var(--tbw-filter-item-height, 28px)}.tbw-filter-search-input{height:var(--tbw-filter-item-height, 28px);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)));min-height:var(--tbw-filter-item-height, 28px)}.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;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)))}.tbw-filter-range-title{font-weight:500;margin-bottom:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));padding-bottom:var(--tbw-spacing-sm, .375rem);border-bottom:1px solid var(--tbw-filter-divider, var(--tbw-color-border, light-dark(#d0d0d4, #454545)))}.tbw-filter-range-inputs,.tbw-filter-date-range{display:flex;align-items:flex-end;gap:var(--tbw-spacing-sm, .375rem);margin-bottom:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.tbw-filter-range-group,.tbw-filter-date-group{display:flex;flex-direction:column;gap:var(--tbw-spacing-xs, .25rem);flex:1}.tbw-filter-range-label{font-size:var(--tbw-font-size-xs, .75rem);color:var(--tbw-filter-muted, var(--tbw-color-fg-muted, light-dark(#555555, #aaaaaa)))}.tbw-filter-range-input,.tbw-filter-date-input{width:100%;height:var(--tbw-filter-item-height, 28px);padding:var(--tbw-spacing-xs, .25rem) var(--tbw-spacing-sm, .375rem);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-range-input:focus,.tbw-filter-date-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-range-separator{color:var(--tbw-filter-muted, var(--tbw-color-fg-muted, light-dark(#555555, #aaaaaa)));padding-bottom:var(--tbw-spacing-xs, .25rem)}.tbw-filter-range-slider{position:relative;height:24px;margin:var(--tbw-spacing-md, .5rem) 0 var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.tbw-filter-range-track{position:absolute;top:50%;left:0;right:0;height:4px;background:var(--tbw-filter-input-border, var(--tbw-color-border, light-dark(#d0d0d4, #454545)));border-radius:2px;transform:translateY(-50%)}.tbw-filter-range-fill{position:absolute;top:50%;height:4px;background:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));border-radius:2px;transform:translateY(-50%)}.tbw-filter-range-thumb{position:absolute;top:0;width:100%;height:100%;background:none;pointer-events:none;-webkit-appearance:none;appearance:none}.tbw-filter-range-thumb::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:16px;height:16px;background:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));border:2px solid var(--tbw-filter-panel-bg, var(--tbw-color-panel-bg, light-dark(#eeeeee, #222222)));border-radius:50%;cursor:pointer;pointer-events:all;box-shadow:0 1px 3px #0003}.tbw-filter-range-thumb::-moz-range-thumb{width:16px;height:16px;background:var(--tbw-filter-accent, var(--tbw-color-accent, #3b82f6));border:2px solid var(--tbw-filter-panel-bg, var(--tbw-color-panel-bg, light-dark(#eeeeee, #222222)));border-radius:50%;cursor:pointer;pointer-events:all;box-shadow:0 1px 3px #0003}.tbw-filter-range-thumb::-webkit-slider-thumb:hover{transform:scale(1.1)}.tbw-filter-range-thumb::-moz-range-thumb:hover{transform:scale(1.1)}}";
|
|
1310
1358
|
class q extends _ {
|
|
1311
1359
|
name = "filtering";
|
|
1312
|
-
styles =
|
|
1360
|
+
styles = Bt;
|
|
1313
1361
|
get defaultConfig() {
|
|
1314
1362
|
return {
|
|
1315
1363
|
debounceMs: 300,
|
|
@@ -1365,7 +1413,7 @@ class q extends _ {
|
|
|
1365
1413
|
const i = Gt(t);
|
|
1366
1414
|
if (this.cacheKey === i && this.cachedResult)
|
|
1367
1415
|
return this.cachedResult;
|
|
1368
|
-
const n =
|
|
1416
|
+
const n = Ot([...e], t, this.config.caseSensitive);
|
|
1369
1417
|
return this.cachedResult = n, this.cacheKey = i, n;
|
|
1370
1418
|
}
|
|
1371
1419
|
afterRender() {
|
|
@@ -1375,7 +1423,7 @@ class q extends _ {
|
|
|
1375
1423
|
const n = i.getAttribute("data-col");
|
|
1376
1424
|
if (n === null) return;
|
|
1377
1425
|
const r = this.visibleColumns[parseInt(n, 10)];
|
|
1378
|
-
if (!r || !this.isColumnFilterable(r) ||
|
|
1426
|
+
if (!r || !this.isColumnFilterable(r) || H(r)) return;
|
|
1379
1427
|
const o = r.field;
|
|
1380
1428
|
if (!o) return;
|
|
1381
1429
|
const a = this.filters.has(o);
|
|
@@ -1460,7 +1508,7 @@ class q extends _ {
|
|
|
1460
1508
|
return;
|
|
1461
1509
|
}
|
|
1462
1510
|
const e = document.createElement("style");
|
|
1463
|
-
e.id = "tbw-filter-panel-styles", e.textContent =
|
|
1511
|
+
e.id = "tbw-filter-panel-styles", e.textContent = Vt, document.head.appendChild(e), this.globalStylesInjected = !0;
|
|
1464
1512
|
}
|
|
1465
1513
|
toggleFilterPanel(e, t, i) {
|
|
1466
1514
|
if (this.openPanelField === e) {
|
|
@@ -1556,13 +1604,13 @@ class q extends _ {
|
|
|
1556
1604
|
const h = document.createElement("span");
|
|
1557
1605
|
h.textContent = "Select All", c.appendChild(u), c.appendChild(h), d.appendChild(c);
|
|
1558
1606
|
const g = () => {
|
|
1559
|
-
const b = [...v.values()],
|
|
1560
|
-
u.checked =
|
|
1607
|
+
const b = [...v.values()], R = b.every((C) => C), T = b.every((C) => !C);
|
|
1608
|
+
u.checked = R, u.indeterminate = !R && !T;
|
|
1561
1609
|
};
|
|
1562
1610
|
u.addEventListener("change", () => {
|
|
1563
1611
|
const b = u.checked;
|
|
1564
|
-
for (const
|
|
1565
|
-
v.set(
|
|
1612
|
+
for (const R of v.keys())
|
|
1613
|
+
v.set(R, b);
|
|
1566
1614
|
g(), A();
|
|
1567
1615
|
}), e.appendChild(d);
|
|
1568
1616
|
const f = document.createElement("div");
|
|
@@ -1573,31 +1621,31 @@ class q extends _ {
|
|
|
1573
1621
|
w.className = "tbw-filter-values-content", f.appendChild(w);
|
|
1574
1622
|
const v = /* @__PURE__ */ new Map();
|
|
1575
1623
|
i.forEach((b) => {
|
|
1576
|
-
const
|
|
1577
|
-
v.set(
|
|
1624
|
+
const R = b == null ? "__null__" : String(b);
|
|
1625
|
+
v.set(R, !n.has(b));
|
|
1578
1626
|
}), g();
|
|
1579
1627
|
let y = [];
|
|
1580
|
-
const x = (b,
|
|
1581
|
-
const
|
|
1582
|
-
m.className = "tbw-filter-value-item", m.style.position = "absolute", m.style.top = `calc(var(--tbw-filter-item-height, 28px) * ${
|
|
1583
|
-
const
|
|
1584
|
-
|
|
1585
|
-
v.set(C,
|
|
1628
|
+
const x = (b, R) => {
|
|
1629
|
+
const T = b == null ? "(Blank)" : String(b), C = b == null ? "__null__" : String(b), m = document.createElement("label");
|
|
1630
|
+
m.className = "tbw-filter-value-item", m.style.position = "absolute", m.style.top = `calc(var(--tbw-filter-item-height, 28px) * ${R})`, m.style.left = "0", m.style.right = "0", m.style.boxSizing = "border-box";
|
|
1631
|
+
const E = document.createElement("input");
|
|
1632
|
+
E.type = "checkbox", E.className = "tbw-filter-checkbox", E.checked = v.get(C) ?? !0, E.dataset.value = C, E.addEventListener("change", () => {
|
|
1633
|
+
v.set(C, E.checked), g();
|
|
1586
1634
|
});
|
|
1587
1635
|
const M = document.createElement("span");
|
|
1588
|
-
return M.textContent =
|
|
1636
|
+
return M.textContent = T, m.appendChild(E), m.appendChild(M), m;
|
|
1589
1637
|
}, A = () => {
|
|
1590
|
-
const b = y.length,
|
|
1591
|
-
if (p.style.height = `${b * o}px`,
|
|
1592
|
-
w.innerHTML = "", w.style.transform = "translateY(0px)", y.forEach((m,
|
|
1593
|
-
w.appendChild(x(m,
|
|
1638
|
+
const b = y.length, R = f.clientHeight, T = f.scrollTop;
|
|
1639
|
+
if (p.style.height = `${b * o}px`, zt(b, q.LIST_BYPASS_THRESHOLD / 3)) {
|
|
1640
|
+
w.innerHTML = "", w.style.transform = "translateY(0px)", y.forEach((m, E) => {
|
|
1641
|
+
w.appendChild(x(m, E));
|
|
1594
1642
|
});
|
|
1595
1643
|
return;
|
|
1596
1644
|
}
|
|
1597
|
-
const C =
|
|
1645
|
+
const C = Ht({
|
|
1598
1646
|
totalRows: b,
|
|
1599
|
-
viewportHeight:
|
|
1600
|
-
scrollTop:
|
|
1647
|
+
viewportHeight: R,
|
|
1648
|
+
scrollTop: T,
|
|
1601
1649
|
rowHeight: o,
|
|
1602
1650
|
overscan: q.LIST_OVERSCAN
|
|
1603
1651
|
});
|
|
@@ -1605,10 +1653,10 @@ class q extends _ {
|
|
|
1605
1653
|
for (let m = C.start; m < C.end; m++)
|
|
1606
1654
|
w.appendChild(x(y[m], m - C.start));
|
|
1607
1655
|
}, F = (b) => {
|
|
1608
|
-
const
|
|
1656
|
+
const R = this.config.caseSensitive ?? !1, T = R ? b : b.toLowerCase();
|
|
1609
1657
|
if (y = i.filter((C) => {
|
|
1610
|
-
const m = C == null ? "(Blank)" : String(C),
|
|
1611
|
-
return !b ||
|
|
1658
|
+
const m = C == null ? "(Blank)" : String(C), E = R ? m : m.toLowerCase();
|
|
1659
|
+
return !b || E.includes(T);
|
|
1612
1660
|
}), y.length === 0) {
|
|
1613
1661
|
p.style.height = "0px", w.innerHTML = "";
|
|
1614
1662
|
const C = document.createElement("div");
|
|
@@ -1632,32 +1680,32 @@ class q extends _ {
|
|
|
1632
1680
|
});
|
|
1633
1681
|
const I = document.createElement("div");
|
|
1634
1682
|
I.className = "tbw-filter-buttons";
|
|
1635
|
-
const
|
|
1636
|
-
|
|
1683
|
+
const L = document.createElement("button");
|
|
1684
|
+
L.className = "tbw-filter-apply-btn", L.textContent = "Apply", L.addEventListener("click", () => {
|
|
1637
1685
|
const b = [];
|
|
1638
|
-
for (const [
|
|
1639
|
-
if (!
|
|
1640
|
-
if (
|
|
1686
|
+
for (const [R, T] of v)
|
|
1687
|
+
if (!T)
|
|
1688
|
+
if (R === "__null__")
|
|
1641
1689
|
b.push(null);
|
|
1642
1690
|
else {
|
|
1643
|
-
const C = i.find((m) => String(m) ===
|
|
1644
|
-
b.push(C !== void 0 ? C :
|
|
1691
|
+
const C = i.find((m) => String(m) === R);
|
|
1692
|
+
b.push(C !== void 0 ? C : R);
|
|
1645
1693
|
}
|
|
1646
1694
|
t.applySetFilter(b);
|
|
1647
|
-
}), I.appendChild(
|
|
1695
|
+
}), I.appendChild(L);
|
|
1648
1696
|
const P = document.createElement("button");
|
|
1649
1697
|
P.className = "tbw-filter-clear-btn", P.textContent = "Clear Filter", P.addEventListener("click", () => {
|
|
1650
1698
|
t.clearFilter();
|
|
1651
1699
|
}), I.appendChild(P), e.appendChild(I);
|
|
1652
1700
|
}
|
|
1653
1701
|
renderNumberFilterPanel(e, t, i) {
|
|
1654
|
-
const { field: n, column: r } = t, o = r.filterParams, a = r.editorParams, l = (S,
|
|
1702
|
+
const { field: n, column: r } = t, o = r.filterParams, a = r.editorParams, l = (S, z) => {
|
|
1655
1703
|
if (typeof S == "number") return S;
|
|
1656
1704
|
if (typeof S == "string") {
|
|
1657
1705
|
const W = parseFloat(S);
|
|
1658
|
-
return isNaN(W) ?
|
|
1706
|
+
return isNaN(W) ? z : W;
|
|
1659
1707
|
}
|
|
1660
|
-
return
|
|
1708
|
+
return z;
|
|
1661
1709
|
}, d = i.filter((S) => typeof S == "number" && !isNaN(S)), c = d.length > 0 ? Math.min(...d) : 0, u = d.length > 0 ? Math.max(...d) : 100, h = l(o?.min ?? a?.min, c), g = l(o?.max ?? a?.max, u), f = o?.step ?? a?.step ?? 1, p = this.filters.get(n);
|
|
1662
1710
|
let w = h, v = g;
|
|
1663
1711
|
p?.operator === "between" ? (w = l(p.value, h), v = l(p.valueTo, g)) : p?.operator === "greaterThanOrEqual" ? w = l(p.value, h) : p?.operator === "lessThanOrEqual" && (v = l(p.value, g));
|
|
@@ -1673,45 +1721,45 @@ class q extends _ {
|
|
|
1673
1721
|
k.type = "number", k.className = "tbw-filter-range-input", k.min = String(h), k.max = String(g), k.step = String(f), k.value = String(w), A.appendChild(F), A.appendChild(k), x.appendChild(A);
|
|
1674
1722
|
const I = document.createElement("span");
|
|
1675
1723
|
I.className = "tbw-filter-range-separator", I.textContent = "–", x.appendChild(I);
|
|
1676
|
-
const
|
|
1677
|
-
|
|
1724
|
+
const L = document.createElement("div");
|
|
1725
|
+
L.className = "tbw-filter-range-group";
|
|
1678
1726
|
const P = document.createElement("label");
|
|
1679
1727
|
P.textContent = "Max", P.className = "tbw-filter-range-label";
|
|
1680
1728
|
const b = document.createElement("input");
|
|
1681
|
-
b.type = "number", b.className = "tbw-filter-range-input", b.min = String(h), b.max = String(g), b.step = String(f), b.value = String(v),
|
|
1682
|
-
const
|
|
1683
|
-
|
|
1684
|
-
const
|
|
1685
|
-
|
|
1729
|
+
b.type = "number", b.className = "tbw-filter-range-input", b.min = String(h), b.max = String(g), b.step = String(f), b.value = String(v), L.appendChild(P), L.appendChild(b), x.appendChild(L), e.appendChild(x);
|
|
1730
|
+
const R = document.createElement("div");
|
|
1731
|
+
R.className = "tbw-filter-range-slider";
|
|
1732
|
+
const T = document.createElement("div");
|
|
1733
|
+
T.className = "tbw-filter-range-track";
|
|
1686
1734
|
const C = document.createElement("div");
|
|
1687
1735
|
C.className = "tbw-filter-range-fill";
|
|
1688
1736
|
const m = document.createElement("input");
|
|
1689
1737
|
m.type = "range", m.className = "tbw-filter-range-thumb tbw-filter-range-thumb-min", m.min = String(h), m.max = String(g), m.step = String(f), m.value = String(w);
|
|
1690
|
-
const
|
|
1691
|
-
|
|
1738
|
+
const E = document.createElement("input");
|
|
1739
|
+
E.type = "range", E.className = "tbw-filter-range-thumb tbw-filter-range-thumb-max", E.min = String(h), E.max = String(g), E.step = String(f), E.value = String(v), R.appendChild(T), R.appendChild(C), R.appendChild(m), R.appendChild(E), e.appendChild(R);
|
|
1692
1740
|
const M = () => {
|
|
1693
|
-
const S = parseFloat(m.value),
|
|
1694
|
-
C.style.left = `${ve}%`, C.style.width = `${
|
|
1741
|
+
const S = parseFloat(m.value), z = parseFloat(E.value), W = g - h, ve = (S - h) / W * 100, st = (z - h) / W * 100;
|
|
1742
|
+
C.style.left = `${ve}%`, C.style.width = `${st - ve}%`;
|
|
1695
1743
|
};
|
|
1696
1744
|
m.addEventListener("input", () => {
|
|
1697
|
-
const S = Math.min(parseFloat(m.value), parseFloat(
|
|
1745
|
+
const S = Math.min(parseFloat(m.value), parseFloat(E.value));
|
|
1698
1746
|
m.value = String(S), k.value = String(S), M();
|
|
1699
|
-
}),
|
|
1700
|
-
const S = Math.max(parseFloat(
|
|
1701
|
-
|
|
1747
|
+
}), E.addEventListener("input", () => {
|
|
1748
|
+
const S = Math.max(parseFloat(E.value), parseFloat(m.value));
|
|
1749
|
+
E.value = String(S), b.value = String(S), M();
|
|
1702
1750
|
}), k.addEventListener("input", () => {
|
|
1703
1751
|
let S = parseFloat(k.value) || h;
|
|
1704
1752
|
S = Math.max(h, Math.min(S, parseFloat(b.value))), m.value = String(S), M();
|
|
1705
1753
|
}), b.addEventListener("input", () => {
|
|
1706
1754
|
let S = parseFloat(b.value) || g;
|
|
1707
|
-
S = Math.min(g, Math.max(S, parseFloat(k.value))),
|
|
1755
|
+
S = Math.min(g, Math.max(S, parseFloat(k.value))), E.value = String(S), M();
|
|
1708
1756
|
}), M();
|
|
1709
1757
|
const Y = document.createElement("div");
|
|
1710
1758
|
Y.className = "tbw-filter-buttons";
|
|
1711
1759
|
const X = document.createElement("button");
|
|
1712
1760
|
X.className = "tbw-filter-apply-btn", X.textContent = "Apply", X.addEventListener("click", () => {
|
|
1713
|
-
const S = parseFloat(k.value),
|
|
1714
|
-
t.applyTextFilter("between", S,
|
|
1761
|
+
const S = parseFloat(k.value), z = parseFloat(b.value);
|
|
1762
|
+
t.applyTextFilter("between", S, z);
|
|
1715
1763
|
}), Y.appendChild(X);
|
|
1716
1764
|
const Z = document.createElement("button");
|
|
1717
1765
|
Z.className = "tbw-filter-clear-btn", Z.textContent = "Clear Filter", Z.addEventListener("click", () => {
|
|
@@ -1734,23 +1782,23 @@ class q extends _ {
|
|
|
1734
1782
|
k.type = "date", k.className = "tbw-filter-date-input", g && (k.min = g), f && (k.max = f), k.value = w, A.appendChild(F), A.appendChild(k), x.appendChild(A);
|
|
1735
1783
|
const I = document.createElement("span");
|
|
1736
1784
|
I.className = "tbw-filter-range-separator", I.textContent = "–", x.appendChild(I);
|
|
1737
|
-
const
|
|
1738
|
-
|
|
1785
|
+
const L = document.createElement("div");
|
|
1786
|
+
L.className = "tbw-filter-date-group";
|
|
1739
1787
|
const P = document.createElement("label");
|
|
1740
1788
|
P.textContent = "To", P.className = "tbw-filter-range-label";
|
|
1741
1789
|
const b = document.createElement("input");
|
|
1742
|
-
b.type = "date", b.className = "tbw-filter-date-input", g && (b.min = g), f && (b.max = f), b.value = v,
|
|
1743
|
-
const
|
|
1744
|
-
|
|
1745
|
-
const
|
|
1746
|
-
|
|
1747
|
-
const m = k.value,
|
|
1748
|
-
m &&
|
|
1749
|
-
}),
|
|
1790
|
+
b.type = "date", b.className = "tbw-filter-date-input", g && (b.min = g), f && (b.max = f), b.value = v, L.appendChild(P), L.appendChild(b), x.appendChild(L), e.appendChild(x);
|
|
1791
|
+
const R = document.createElement("div");
|
|
1792
|
+
R.className = "tbw-filter-buttons";
|
|
1793
|
+
const T = document.createElement("button");
|
|
1794
|
+
T.className = "tbw-filter-apply-btn", T.textContent = "Apply", T.addEventListener("click", () => {
|
|
1795
|
+
const m = k.value, E = b.value;
|
|
1796
|
+
m && E ? t.applyTextFilter("between", m, E) : m ? t.applyTextFilter("greaterThanOrEqual", m) : E ? t.applyTextFilter("lessThanOrEqual", E) : t.clearFilter();
|
|
1797
|
+
}), R.appendChild(T);
|
|
1750
1798
|
const C = document.createElement("button");
|
|
1751
1799
|
C.className = "tbw-filter-clear-btn", C.textContent = "Clear Filter", C.addEventListener("click", () => {
|
|
1752
1800
|
t.clearFilter();
|
|
1753
|
-
}),
|
|
1801
|
+
}), R.appendChild(C), e.appendChild(R);
|
|
1754
1802
|
}
|
|
1755
1803
|
applySetFilter(e, t) {
|
|
1756
1804
|
this.excludedValues.set(e, new Set(t)), t.length === 0 ? this.filters.delete(e) : this.filters.set(e, {
|
|
@@ -1851,7 +1899,7 @@ function Ie(s) {
|
|
|
1851
1899
|
}, e.set(d, c), t.push(c)), c.columns.push(o);
|
|
1852
1900
|
}), n.length && i(r, n), t.length === 1 && t[0].implicit && t[0].columns.length === s.length ? [] : t;
|
|
1853
1901
|
}
|
|
1854
|
-
function
|
|
1902
|
+
function Wt(s, e, t) {
|
|
1855
1903
|
if (!e.length || !s) return;
|
|
1856
1904
|
const i = /* @__PURE__ */ new Map();
|
|
1857
1905
|
for (const r of e)
|
|
@@ -1867,7 +1915,7 @@ function Vt(s, e, t) {
|
|
|
1867
1915
|
a && a.classList.add("group-end");
|
|
1868
1916
|
}
|
|
1869
1917
|
}
|
|
1870
|
-
function
|
|
1918
|
+
function $t(s, e) {
|
|
1871
1919
|
if (s.length === 0) return null;
|
|
1872
1920
|
const t = document.createElement("div");
|
|
1873
1921
|
t.className = "header-group-row", t.setAttribute("role", "row");
|
|
@@ -1879,10 +1927,10 @@ function Wt(s, e) {
|
|
|
1879
1927
|
}
|
|
1880
1928
|
return t;
|
|
1881
1929
|
}
|
|
1882
|
-
function
|
|
1930
|
+
function jt(s) {
|
|
1883
1931
|
return s.some((e) => e.group != null);
|
|
1884
1932
|
}
|
|
1885
|
-
const
|
|
1933
|
+
const Ut = "@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)}}";
|
|
1886
1934
|
class mn extends _ {
|
|
1887
1935
|
static manifest = {
|
|
1888
1936
|
ownedProperties: [
|
|
@@ -1900,7 +1948,7 @@ class mn extends _ {
|
|
|
1900
1948
|
]
|
|
1901
1949
|
};
|
|
1902
1950
|
name = "groupingColumns";
|
|
1903
|
-
styles =
|
|
1951
|
+
styles = Ut;
|
|
1904
1952
|
get defaultConfig() {
|
|
1905
1953
|
return {
|
|
1906
1954
|
showGroupBorders: !0
|
|
@@ -1915,7 +1963,7 @@ class mn extends _ {
|
|
|
1915
1963
|
if (t?.columnGroups && Array.isArray(t.columnGroups) && t.columnGroups.length > 0)
|
|
1916
1964
|
return !0;
|
|
1917
1965
|
const i = t?.columns;
|
|
1918
|
-
return Array.isArray(i) ?
|
|
1966
|
+
return Array.isArray(i) ? jt(i) : !1;
|
|
1919
1967
|
}
|
|
1920
1968
|
processColumns(e) {
|
|
1921
1969
|
const t = this.grid?.gridConfig?.columnGroups;
|
|
@@ -1946,14 +1994,14 @@ class mn extends _ {
|
|
|
1946
1994
|
t && t.remove();
|
|
1947
1995
|
const i = this.columns, n = Ie(i);
|
|
1948
1996
|
if (n.length === 0) return;
|
|
1949
|
-
const r =
|
|
1997
|
+
const r = $t(n, i);
|
|
1950
1998
|
if (r) {
|
|
1951
1999
|
r.classList.toggle("no-borders", !this.config.showGroupBorders);
|
|
1952
2000
|
const a = e.querySelector(".header-row");
|
|
1953
2001
|
a ? e.insertBefore(r, a) : e.appendChild(r);
|
|
1954
2002
|
}
|
|
1955
2003
|
const o = e.querySelector(".header-row");
|
|
1956
|
-
o && (o.classList.toggle("no-group-borders", !this.config.showGroupBorders),
|
|
2004
|
+
o && (o.classList.toggle("no-group-borders", !this.config.showGroupBorders), Wt(o, n)), this.#e(n);
|
|
1957
2005
|
}
|
|
1958
2006
|
#e(e) {
|
|
1959
2007
|
if (!this.config.showGroupBorders) return;
|
|
@@ -2017,20 +2065,20 @@ function Pe({ rows: s, config: e, expanded: t, initialExpanded: i }) {
|
|
|
2017
2065
|
};
|
|
2018
2066
|
return l(r), a;
|
|
2019
2067
|
}
|
|
2020
|
-
function
|
|
2068
|
+
function Yt(s, e) {
|
|
2021
2069
|
const t = new Set(s);
|
|
2022
2070
|
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
2023
2071
|
}
|
|
2024
|
-
function
|
|
2072
|
+
function Xt(s) {
|
|
2025
2073
|
const e = /* @__PURE__ */ new Set();
|
|
2026
2074
|
for (const t of s)
|
|
2027
2075
|
t.kind === "group" && e.add(t.key);
|
|
2028
2076
|
return e;
|
|
2029
2077
|
}
|
|
2030
|
-
function
|
|
2078
|
+
function Zt() {
|
|
2031
2079
|
return /* @__PURE__ */ new Set();
|
|
2032
2080
|
}
|
|
2033
|
-
function
|
|
2081
|
+
function Jt(s, e) {
|
|
2034
2082
|
if (s === !0)
|
|
2035
2083
|
return new Set(e);
|
|
2036
2084
|
if (s === !1 || s == null)
|
|
@@ -2041,13 +2089,13 @@ function Zt(s, e) {
|
|
|
2041
2089
|
}
|
|
2042
2090
|
return typeof s == "string" ? /* @__PURE__ */ new Set([s]) : Array.isArray(s) ? new Set(s) : /* @__PURE__ */ new Set();
|
|
2043
2091
|
}
|
|
2044
|
-
function
|
|
2092
|
+
function Qt(s) {
|
|
2045
2093
|
return s.filter((e) => e.kind === "group").map((e) => e.key);
|
|
2046
2094
|
}
|
|
2047
|
-
function
|
|
2095
|
+
function ei(s) {
|
|
2048
2096
|
return s.kind !== "group" ? 0 : s.rows.length;
|
|
2049
2097
|
}
|
|
2050
|
-
const
|
|
2098
|
+
const ti = "@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}}}";
|
|
2051
2099
|
class wn extends _ {
|
|
2052
2100
|
static manifest = {
|
|
2053
2101
|
configRules: [
|
|
@@ -2063,7 +2111,7 @@ class wn extends _ {
|
|
|
2063
2111
|
]
|
|
2064
2112
|
};
|
|
2065
2113
|
name = "groupingRows";
|
|
2066
|
-
styles =
|
|
2114
|
+
styles = ti;
|
|
2067
2115
|
get defaultConfig() {
|
|
2068
2116
|
return {
|
|
2069
2117
|
defaultExpanded: !1,
|
|
@@ -2102,8 +2150,8 @@ class wn extends _ {
|
|
|
2102
2150
|
return this.isActive = !1, this.flattenedRows = [], [...e];
|
|
2103
2151
|
let n;
|
|
2104
2152
|
if (!this.hasAppliedDefaultExpanded && this.expandedKeys.size === 0 && t.defaultExpanded !== !1) {
|
|
2105
|
-
const a =
|
|
2106
|
-
n =
|
|
2153
|
+
const a = Qt(i);
|
|
2154
|
+
n = Jt(t.defaultExpanded ?? !1, a), n.size > 0 && (this.expandedKeys = new Set(n), this.hasAppliedDefaultExpanded = !0);
|
|
2107
2155
|
}
|
|
2108
2156
|
const r = Pe({
|
|
2109
2157
|
rows: [...e],
|
|
@@ -2125,7 +2173,7 @@ class wn extends _ {
|
|
|
2125
2173
|
__groupDepth: a.depth,
|
|
2126
2174
|
__groupRows: a.rows,
|
|
2127
2175
|
__groupExpanded: a.expanded,
|
|
2128
|
-
__groupRowCount:
|
|
2176
|
+
__groupRowCount: ei(a)
|
|
2129
2177
|
} : a.row);
|
|
2130
2178
|
}
|
|
2131
2179
|
onCellClick(e) {
|
|
@@ -2243,10 +2291,10 @@ class wn extends _ {
|
|
|
2243
2291
|
});
|
|
2244
2292
|
}
|
|
2245
2293
|
expandAll() {
|
|
2246
|
-
this.expandedKeys =
|
|
2294
|
+
this.expandedKeys = Xt(this.flattenedRows), this.requestRender();
|
|
2247
2295
|
}
|
|
2248
2296
|
collapseAll() {
|
|
2249
|
-
this.expandedKeys =
|
|
2297
|
+
this.expandedKeys = Zt(), this.requestRender();
|
|
2250
2298
|
}
|
|
2251
2299
|
toggle(e) {
|
|
2252
2300
|
const t = !this.expandedKeys.has(e), i = this.config, n = this.flattenedRows.find((r) => r.kind === "group" && r.key === e);
|
|
@@ -2261,7 +2309,7 @@ class wn extends _ {
|
|
|
2261
2309
|
}
|
|
2262
2310
|
r.add(e), this.expandedKeys = r;
|
|
2263
2311
|
} else
|
|
2264
|
-
this.expandedKeys =
|
|
2312
|
+
this.expandedKeys = Yt(this.expandedKeys, e);
|
|
2265
2313
|
this.emit("group-toggle", {
|
|
2266
2314
|
key: e,
|
|
2267
2315
|
expanded: this.expandedKeys.has(e),
|
|
@@ -2313,18 +2361,18 @@ function De(s, e) {
|
|
|
2313
2361
|
const t = new Set(s);
|
|
2314
2362
|
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
2315
2363
|
}
|
|
2316
|
-
function
|
|
2364
|
+
function ii(s, e) {
|
|
2317
2365
|
const t = new Set(s);
|
|
2318
2366
|
return t.add(e), t;
|
|
2319
2367
|
}
|
|
2320
|
-
function
|
|
2368
|
+
function ni(s, e) {
|
|
2321
2369
|
const t = new Set(s);
|
|
2322
2370
|
return t.delete(e), t;
|
|
2323
2371
|
}
|
|
2324
|
-
function
|
|
2372
|
+
function ri(s, e) {
|
|
2325
2373
|
return s.has(e);
|
|
2326
2374
|
}
|
|
2327
|
-
function
|
|
2375
|
+
function oi(s, e, t, i) {
|
|
2328
2376
|
const n = document.createElement("div");
|
|
2329
2377
|
n.className = "master-detail-row", n.setAttribute("data-detail-for", String(e)), n.setAttribute("role", "row");
|
|
2330
2378
|
const r = document.createElement("div");
|
|
@@ -2332,10 +2380,10 @@ function ri(s, e, t, i) {
|
|
|
2332
2380
|
const o = t(s, e);
|
|
2333
2381
|
return typeof o == "string" ? r.innerHTML = o : o instanceof HTMLElement && r.appendChild(o), n.appendChild(r), n;
|
|
2334
2382
|
}
|
|
2335
|
-
const
|
|
2336
|
-
class
|
|
2383
|
+
const si = "@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}}}";
|
|
2384
|
+
class tt extends _ {
|
|
2337
2385
|
name = "masterDetail";
|
|
2338
|
-
styles =
|
|
2386
|
+
styles = si;
|
|
2339
2387
|
get defaultConfig() {
|
|
2340
2388
|
return {
|
|
2341
2389
|
detailHeight: "auto",
|
|
@@ -2364,8 +2412,8 @@ class et extends _ {
|
|
|
2364
2412
|
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));
|
|
2365
2413
|
const c = t.innerHTML.trim();
|
|
2366
2414
|
c && !this.config.detailRenderer && (d.detailRenderer = (u, h) => {
|
|
2367
|
-
const g =
|
|
2368
|
-
return
|
|
2415
|
+
const g = dt(c, { value: u, row: u });
|
|
2416
|
+
return ct(g);
|
|
2369
2417
|
}), Object.keys(d).length > 0 && (this.config = { ...this.config, ...d });
|
|
2370
2418
|
}
|
|
2371
2419
|
get animationStyle() {
|
|
@@ -2396,7 +2444,7 @@ class et extends _ {
|
|
|
2396
2444
|
static DEFAULT_DETAIL_HEIGHT = 150;
|
|
2397
2445
|
getDetailHeight(e) {
|
|
2398
2446
|
const t = this.detailElements.get(e);
|
|
2399
|
-
return t ? t.offsetHeight : typeof this.config?.detailHeight == "number" ? this.config.detailHeight :
|
|
2447
|
+
return t ? t.offsetHeight : typeof this.config?.detailHeight == "number" ? this.config.detailHeight : tt.DEFAULT_DETAIL_HEIGHT;
|
|
2400
2448
|
}
|
|
2401
2449
|
toggleAndEmit(e, t) {
|
|
2402
2450
|
this.expandedRows = De(this.expandedRows, e), this.emit("detail-expand", {
|
|
@@ -2412,9 +2460,9 @@ class et extends _ {
|
|
|
2412
2460
|
if (!(this.config.showExpandColumn === !0 || this.config.showExpandColumn !== !1 && !!this.config.detailRenderer))
|
|
2413
2461
|
return [...e];
|
|
2414
2462
|
const i = [...e];
|
|
2415
|
-
if (
|
|
2463
|
+
if (ft(i))
|
|
2416
2464
|
return i;
|
|
2417
|
-
const r =
|
|
2465
|
+
const r = pt(this.name);
|
|
2418
2466
|
return r.viewRenderer = (o) => {
|
|
2419
2467
|
const { row: a } = o, l = this.expandedRows.has(a), d = document.createElement("span");
|
|
2420
2468
|
d.className = "master-detail-expander expander-cell";
|
|
@@ -2467,7 +2515,7 @@ class et extends _ {
|
|
|
2467
2515
|
d.previousElementSibling !== a && a.after(d);
|
|
2468
2516
|
continue;
|
|
2469
2517
|
}
|
|
2470
|
-
const c =
|
|
2518
|
+
const c = oi(l, o, this.config.detailRenderer, n);
|
|
2471
2519
|
typeof this.config.detailHeight == "number" && (c.style.height = `${this.config.detailHeight}px`), a.after(c), this.detailElements.set(l, c), this.animateExpand(c);
|
|
2472
2520
|
}
|
|
2473
2521
|
}
|
|
@@ -2502,11 +2550,11 @@ class et extends _ {
|
|
|
2502
2550
|
}
|
|
2503
2551
|
expand(e) {
|
|
2504
2552
|
const t = this.rows[e];
|
|
2505
|
-
t && (this.expandedRows =
|
|
2553
|
+
t && (this.expandedRows = ii(this.expandedRows, t), this.requestRender());
|
|
2506
2554
|
}
|
|
2507
2555
|
collapse(e) {
|
|
2508
2556
|
const t = this.rows[e];
|
|
2509
|
-
t && (this.expandedRows =
|
|
2557
|
+
t && (this.expandedRows = ni(this.expandedRows, t), this.requestRender());
|
|
2510
2558
|
}
|
|
2511
2559
|
toggle(e) {
|
|
2512
2560
|
const t = this.rows[e];
|
|
@@ -2514,7 +2562,7 @@ class et extends _ {
|
|
|
2514
2562
|
}
|
|
2515
2563
|
isExpanded(e) {
|
|
2516
2564
|
const t = this.rows[e];
|
|
2517
|
-
return t ?
|
|
2565
|
+
return t ? ri(this.expandedRows, t) : !1;
|
|
2518
2566
|
}
|
|
2519
2567
|
expandAll() {
|
|
2520
2568
|
for (const e of this.rows)
|
|
@@ -2544,20 +2592,20 @@ class et extends _ {
|
|
|
2544
2592
|
}
|
|
2545
2593
|
}
|
|
2546
2594
|
}
|
|
2547
|
-
function
|
|
2595
|
+
function ai(s, e, t) {
|
|
2548
2596
|
return e.length ? [...s].sort((i, n) => {
|
|
2549
2597
|
for (const r of e) {
|
|
2550
|
-
const a = t.find((u) => u.field === r.field)?.sortComparator ??
|
|
2598
|
+
const a = t.find((u) => u.field === r.field)?.sortComparator ?? li, l = i[r.field], d = n[r.field], c = a(l, d, i, n);
|
|
2551
2599
|
if (c !== 0)
|
|
2552
2600
|
return r.direction === "asc" ? c : -c;
|
|
2553
2601
|
}
|
|
2554
2602
|
return 0;
|
|
2555
2603
|
}) : [...s];
|
|
2556
2604
|
}
|
|
2557
|
-
function
|
|
2605
|
+
function li(s, e) {
|
|
2558
2606
|
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));
|
|
2559
2607
|
}
|
|
2560
|
-
function
|
|
2608
|
+
function di(s, e, t, i) {
|
|
2561
2609
|
const n = s.find((r) => r.field === e);
|
|
2562
2610
|
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" }];
|
|
2563
2611
|
}
|
|
@@ -2568,10 +2616,10 @@ function Me(s, e) {
|
|
|
2568
2616
|
function Ne(s, e) {
|
|
2569
2617
|
return s.find((t) => t.field === e)?.direction;
|
|
2570
2618
|
}
|
|
2571
|
-
const
|
|
2619
|
+
const ci = '@layer tbw-plugins{.header-cell[data-sort=asc]:after{content:"↑";margin-left:var(--tbw-spacing-xs, .25em);opacity:.8}.header-cell[data-sort=desc]:after{content:"↓";margin-left:var(--tbw-spacing-xs, .25em);opacity:.8}.sort-indicator{margin-left:var(--tbw-spacing-xs, .25em);opacity:.8}.sort-index{font-size:var(--tbw-font-size-2xs, .7em);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:var(--tbw-multi-sort-badge-size, 1em);height:var(--tbw-multi-sort-badge-size, 1em);display:inline-flex;align-items:center;justify-content:center;margin-left:var(--tbw-spacing-xs, .125em);font-weight:600}}';
|
|
2572
2620
|
class bn extends _ {
|
|
2573
2621
|
name = "multiSort";
|
|
2574
|
-
styles =
|
|
2622
|
+
styles = ci;
|
|
2575
2623
|
get defaultConfig() {
|
|
2576
2624
|
return {
|
|
2577
2625
|
maxSortColumns: 3,
|
|
@@ -2583,12 +2631,12 @@ class bn extends _ {
|
|
|
2583
2631
|
this.sortModel = [];
|
|
2584
2632
|
}
|
|
2585
2633
|
processRows(e) {
|
|
2586
|
-
return this.sortModel.length === 0 ? [...e] :
|
|
2634
|
+
return this.sortModel.length === 0 ? [...e] : ai([...e], this.sortModel, [...this.columns]);
|
|
2587
2635
|
}
|
|
2588
2636
|
onHeaderClick(e) {
|
|
2589
2637
|
if (!this.columns.find((r) => r.field === e.field)?.sortable) return !1;
|
|
2590
2638
|
const i = e.originalEvent.shiftKey, n = this.config.maxSortColumns ?? 3;
|
|
2591
|
-
return this.sortModel =
|
|
2639
|
+
return this.sortModel = di(this.sortModel, e.field, i, n), this.emit("sort-change", { sortModel: [...this.sortModel] }), this.requestRender(), !0;
|
|
2592
2640
|
}
|
|
2593
2641
|
afterRender() {
|
|
2594
2642
|
const e = this.gridElement;
|
|
@@ -2647,10 +2695,10 @@ class bn extends _ {
|
|
|
2647
2695
|
i !== -1 ? this.sortModel[i] = n : this.sortModel.splice(t.sort.priority, 0, n);
|
|
2648
2696
|
}
|
|
2649
2697
|
}
|
|
2650
|
-
function
|
|
2698
|
+
function ui(s) {
|
|
2651
2699
|
return s.filter((e) => e.sticky === "left");
|
|
2652
2700
|
}
|
|
2653
|
-
function
|
|
2701
|
+
function hi(s) {
|
|
2654
2702
|
return s.filter((e) => e.sticky === "right");
|
|
2655
2703
|
}
|
|
2656
2704
|
function ae(s) {
|
|
@@ -2680,7 +2728,7 @@ function qe(s, e) {
|
|
|
2680
2728
|
}), r += l.offsetWidth);
|
|
2681
2729
|
}
|
|
2682
2730
|
}
|
|
2683
|
-
function
|
|
2731
|
+
function He(s) {
|
|
2684
2732
|
s.querySelectorAll(".sticky-left, .sticky-right").forEach((t) => {
|
|
2685
2733
|
t.classList.remove("sticky-left", "sticky-right"), t.style.position = "", t.style.left = "", t.style.right = "";
|
|
2686
2734
|
});
|
|
@@ -2718,7 +2766,7 @@ class vn extends _ {
|
|
|
2718
2766
|
return;
|
|
2719
2767
|
const e = this.grid, t = [...this.columns];
|
|
2720
2768
|
if (!ae(t)) {
|
|
2721
|
-
|
|
2769
|
+
He(e), this.isApplied = !1;
|
|
2722
2770
|
return;
|
|
2723
2771
|
}
|
|
2724
2772
|
queueMicrotask(() => {
|
|
@@ -2744,14 +2792,14 @@ class vn extends _ {
|
|
|
2744
2792
|
}
|
|
2745
2793
|
getLeftPinnedColumns() {
|
|
2746
2794
|
const e = [...this.columns];
|
|
2747
|
-
return
|
|
2795
|
+
return ui(e);
|
|
2748
2796
|
}
|
|
2749
2797
|
getRightPinnedColumns() {
|
|
2750
2798
|
const e = [...this.columns];
|
|
2751
|
-
return
|
|
2799
|
+
return hi(e);
|
|
2752
2800
|
}
|
|
2753
2801
|
clearStickyPositions() {
|
|
2754
|
-
|
|
2802
|
+
He(this.grid);
|
|
2755
2803
|
}
|
|
2756
2804
|
getHorizontalScrollOffsets(e, t) {
|
|
2757
2805
|
if (!this.isApplied)
|
|
@@ -2772,7 +2820,7 @@ class vn extends _ {
|
|
|
2772
2820
|
return { left: i, right: n, skipScroll: r };
|
|
2773
2821
|
}
|
|
2774
2822
|
}
|
|
2775
|
-
function
|
|
2823
|
+
function gi(s) {
|
|
2776
2824
|
return typeof s == "object" && s !== null && "aggFunc" in s;
|
|
2777
2825
|
}
|
|
2778
2826
|
function le(s, e) {
|
|
@@ -2797,7 +2845,7 @@ function le(s, e) {
|
|
|
2797
2845
|
}
|
|
2798
2846
|
if (s.customPanels)
|
|
2799
2847
|
for (const o of s.customPanels) {
|
|
2800
|
-
const a =
|
|
2848
|
+
const a = fi(o, e);
|
|
2801
2849
|
switch (o.position) {
|
|
2802
2850
|
case "left":
|
|
2803
2851
|
i.appendChild(a);
|
|
@@ -2812,11 +2860,11 @@ function le(s, e) {
|
|
|
2812
2860
|
}
|
|
2813
2861
|
return t.appendChild(i), t.appendChild(n), t.appendChild(r), t;
|
|
2814
2862
|
}
|
|
2815
|
-
function
|
|
2863
|
+
function ze(s) {
|
|
2816
2864
|
const e = document.createElement("div");
|
|
2817
2865
|
return e.className = `tbw-aggregation-rows tbw-aggregation-rows-${s}`, e.setAttribute("role", "presentation"), e;
|
|
2818
2866
|
}
|
|
2819
|
-
function
|
|
2867
|
+
function Ke(s, e, t, i) {
|
|
2820
2868
|
s.innerHTML = "";
|
|
2821
2869
|
for (const n of e) {
|
|
2822
2870
|
const r = document.createElement("div");
|
|
@@ -2830,7 +2878,7 @@ function ze(s, e, t, i) {
|
|
|
2830
2878
|
let l, d;
|
|
2831
2879
|
const c = n.aggregators?.[o.field];
|
|
2832
2880
|
if (c)
|
|
2833
|
-
if (
|
|
2881
|
+
if (gi(c)) {
|
|
2834
2882
|
const u = ye(c.aggFunc);
|
|
2835
2883
|
u && (l = u(i, o.field, o)), d = c.formatter;
|
|
2836
2884
|
} else {
|
|
@@ -2846,13 +2894,13 @@ function ze(s, e, t, i) {
|
|
|
2846
2894
|
s.appendChild(r);
|
|
2847
2895
|
}
|
|
2848
2896
|
}
|
|
2849
|
-
function
|
|
2897
|
+
function fi(s, e) {
|
|
2850
2898
|
const t = document.createElement("div");
|
|
2851
2899
|
t.className = "tbw-status-panel tbw-status-panel-custom", t.id = `status-panel-${s.id}`;
|
|
2852
2900
|
const i = s.render(e);
|
|
2853
2901
|
return typeof i == "string" ? t.innerHTML = i : t.appendChild(i), t;
|
|
2854
2902
|
}
|
|
2855
|
-
function
|
|
2903
|
+
function Oe(s, e, t, i, n) {
|
|
2856
2904
|
return {
|
|
2857
2905
|
totalRows: s.length,
|
|
2858
2906
|
filteredRows: n?.cachedResult?.length ?? s.length,
|
|
@@ -2862,10 +2910,10 @@ function Ge(s, e, t, i, n) {
|
|
|
2862
2910
|
grid: t
|
|
2863
2911
|
};
|
|
2864
2912
|
}
|
|
2865
|
-
const
|
|
2913
|
+
const pi = "@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}}";
|
|
2866
2914
|
class yn extends _ {
|
|
2867
2915
|
name = "pinnedRows";
|
|
2868
|
-
styles =
|
|
2916
|
+
styles = pi;
|
|
2869
2917
|
get defaultConfig() {
|
|
2870
2918
|
return {
|
|
2871
2919
|
position: "bottom",
|
|
@@ -2887,7 +2935,7 @@ class yn extends _ {
|
|
|
2887
2935
|
const t = e.querySelector(".tbw-scroll-area") ?? e.querySelector(".tbw-grid-content") ?? e.children[0];
|
|
2888
2936
|
if (!t) return;
|
|
2889
2937
|
this.footerWrapper && !t.contains(this.footerWrapper) && (this.footerWrapper = null, this.bottomAggregationContainer = null, this.infoBarElement = null), this.topAggregationContainer && !t.contains(this.topAggregationContainer) && (this.topAggregationContainer = null), this.infoBarElement && !t.contains(this.infoBarElement) && (this.infoBarElement = null);
|
|
2890
|
-
const i = this.getSelectionState(), n = this.getFilterState(), r =
|
|
2938
|
+
const i = this.getSelectionState(), n = this.getFilterState(), r = Oe(
|
|
2891
2939
|
this.rows,
|
|
2892
2940
|
this.columns,
|
|
2893
2941
|
this.grid,
|
|
@@ -2896,11 +2944,11 @@ class yn extends _ {
|
|
|
2896
2944
|
), o = this.config.aggregationRows || [], a = o.filter((h) => h.position === "top"), l = o.filter((h) => h.position !== "top");
|
|
2897
2945
|
if (a.length > 0) {
|
|
2898
2946
|
if (!this.topAggregationContainer) {
|
|
2899
|
-
this.topAggregationContainer =
|
|
2947
|
+
this.topAggregationContainer = ze("top");
|
|
2900
2948
|
const h = e.querySelector(".header");
|
|
2901
2949
|
h && h.nextSibling ? t.insertBefore(this.topAggregationContainer, h.nextSibling) : t.appendChild(this.topAggregationContainer);
|
|
2902
2950
|
}
|
|
2903
|
-
|
|
2951
|
+
Ke(
|
|
2904
2952
|
this.topAggregationContainer,
|
|
2905
2953
|
a,
|
|
2906
2954
|
this.visibleColumns,
|
|
@@ -2916,7 +2964,7 @@ class yn extends _ {
|
|
|
2916
2964
|
this.infoBarElement.replaceWith(h), this.infoBarElement = h;
|
|
2917
2965
|
}
|
|
2918
2966
|
else this.config.position === "top" && this.infoBarElement && (this.infoBarElement.remove(), this.infoBarElement = null);
|
|
2919
|
-
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 =
|
|
2967
|
+
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 = ze("bottom")), this.footerWrapper.appendChild(this.bottomAggregationContainer), Ke(
|
|
2920
2968
|
this.bottomAggregationContainer,
|
|
2921
2969
|
l,
|
|
2922
2970
|
this.visibleColumns,
|
|
@@ -2948,7 +2996,7 @@ class yn extends _ {
|
|
|
2948
2996
|
}
|
|
2949
2997
|
getContext() {
|
|
2950
2998
|
const e = this.getSelectionState(), t = this.getFilterState();
|
|
2951
|
-
return
|
|
2999
|
+
return Oe(
|
|
2952
3000
|
this.rows,
|
|
2953
3001
|
this.columns,
|
|
2954
3002
|
this.grid,
|
|
@@ -2969,16 +3017,16 @@ class yn extends _ {
|
|
|
2969
3017
|
this.config.aggregationRows && (this.config.aggregationRows = this.config.aggregationRows.filter((t) => t.id !== e), this.requestRender());
|
|
2970
3018
|
}
|
|
2971
3019
|
}
|
|
2972
|
-
const
|
|
2973
|
-
function
|
|
3020
|
+
const mi = ut;
|
|
3021
|
+
function wi(s) {
|
|
2974
3022
|
const e = [];
|
|
2975
3023
|
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;
|
|
2976
3024
|
}
|
|
2977
3025
|
function be(s, e) {
|
|
2978
3026
|
return [...s, e].join("|");
|
|
2979
3027
|
}
|
|
2980
|
-
function
|
|
2981
|
-
const t = e.rowGroupFields ?? [], i = e.columnGroupFields ?? [], n = e.valueFields ?? [], r =
|
|
3028
|
+
function bi(s, e) {
|
|
3029
|
+
const t = e.rowGroupFields ?? [], i = e.columnGroupFields ?? [], n = e.valueFields ?? [], r = vi(s, i), o = it(
|
|
2982
3030
|
s,
|
|
2983
3031
|
t,
|
|
2984
3032
|
i,
|
|
@@ -2986,7 +3034,7 @@ function wi(s, e) {
|
|
|
2986
3034
|
n,
|
|
2987
3035
|
0,
|
|
2988
3036
|
""
|
|
2989
|
-
), a =
|
|
3037
|
+
), a = xi(o, r, n), l = Object.values(a).reduce((d, c) => d + c, 0);
|
|
2990
3038
|
return {
|
|
2991
3039
|
rows: o,
|
|
2992
3040
|
columnKeys: r,
|
|
@@ -2994,7 +3042,7 @@ function wi(s, e) {
|
|
|
2994
3042
|
grandTotal: l
|
|
2995
3043
|
};
|
|
2996
3044
|
}
|
|
2997
|
-
function
|
|
3045
|
+
function vi(s, e) {
|
|
2998
3046
|
if (e.length === 0) return ["value"];
|
|
2999
3047
|
const t = /* @__PURE__ */ new Set();
|
|
3000
3048
|
for (const i of s) {
|
|
@@ -3003,7 +3051,7 @@ function bi(s, e) {
|
|
|
3003
3051
|
}
|
|
3004
3052
|
return [...t].sort();
|
|
3005
3053
|
}
|
|
3006
|
-
function
|
|
3054
|
+
function yi(s, e) {
|
|
3007
3055
|
const t = /* @__PURE__ */ new Map();
|
|
3008
3056
|
for (const i of s) {
|
|
3009
3057
|
const n = String(i[e] ?? ""), r = t.get(n);
|
|
@@ -3011,10 +3059,10 @@ function vi(s, e) {
|
|
|
3011
3059
|
}
|
|
3012
3060
|
return t;
|
|
3013
3061
|
}
|
|
3014
|
-
function
|
|
3062
|
+
function it(s, e, t, i, n, r, o) {
|
|
3015
3063
|
const a = [];
|
|
3016
3064
|
if (e.length === 0) {
|
|
3017
|
-
const h =
|
|
3065
|
+
const h = Ge(s, t, i, n), g = Be(h);
|
|
3018
3066
|
return a.push({
|
|
3019
3067
|
rowKey: o || "all",
|
|
3020
3068
|
rowLabel: o || "All",
|
|
@@ -3025,11 +3073,11 @@ function tt(s, e, t, i, n, r, o) {
|
|
|
3025
3073
|
rowCount: s.length
|
|
3026
3074
|
}), a;
|
|
3027
3075
|
}
|
|
3028
|
-
const l = e[0], d = e.slice(1), c = d.length > 0, u =
|
|
3076
|
+
const l = e[0], d = e.slice(1), c = d.length > 0, u = yi(s, l);
|
|
3029
3077
|
for (const [h, g] of u) {
|
|
3030
|
-
const f = o ? `${o}|${h}` : h, p =
|
|
3078
|
+
const f = o ? `${o}|${h}` : h, p = Ge(g, t, i, n), w = Be(p);
|
|
3031
3079
|
let v;
|
|
3032
|
-
c && (v =
|
|
3080
|
+
c && (v = it(
|
|
3033
3081
|
g,
|
|
3034
3082
|
d,
|
|
3035
3083
|
t,
|
|
@@ -3050,11 +3098,11 @@ function tt(s, e, t, i, n, r, o) {
|
|
|
3050
3098
|
}
|
|
3051
3099
|
return a;
|
|
3052
3100
|
}
|
|
3053
|
-
function
|
|
3101
|
+
function Ge(s, e, t, i) {
|
|
3054
3102
|
const n = {};
|
|
3055
3103
|
for (const r of t)
|
|
3056
3104
|
for (const o of i) {
|
|
3057
|
-
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 =
|
|
3105
|
+
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 = mi(o.aggFunc), c = l.length > 0 ? d(l) : null, u = be([r], o.field);
|
|
3058
3106
|
n[u] = c;
|
|
3059
3107
|
}
|
|
3060
3108
|
return n;
|
|
@@ -3065,7 +3113,7 @@ function Be(s) {
|
|
|
3065
3113
|
e += t ?? 0;
|
|
3066
3114
|
return e;
|
|
3067
3115
|
}
|
|
3068
|
-
function
|
|
3116
|
+
function xi(s, e, t) {
|
|
3069
3117
|
const i = {};
|
|
3070
3118
|
function n(r) {
|
|
3071
3119
|
for (const o of r)
|
|
@@ -3079,7 +3127,7 @@ function yi(s, e, t) {
|
|
|
3079
3127
|
}
|
|
3080
3128
|
return n(s), i;
|
|
3081
3129
|
}
|
|
3082
|
-
function
|
|
3130
|
+
function Ci(s, e, t = !0) {
|
|
3083
3131
|
const i = [];
|
|
3084
3132
|
function n(r) {
|
|
3085
3133
|
i.push(r);
|
|
@@ -3092,7 +3140,7 @@ function xi(s, e, t = !0) {
|
|
|
3092
3140
|
n(r);
|
|
3093
3141
|
return i;
|
|
3094
3142
|
}
|
|
3095
|
-
function
|
|
3143
|
+
function Ei(s) {
|
|
3096
3144
|
const e = [];
|
|
3097
3145
|
function t(i) {
|
|
3098
3146
|
if (i.isGroup && e.push(i.rowKey), i.children)
|
|
@@ -3104,9 +3152,9 @@ function Ci(s) {
|
|
|
3104
3152
|
return e;
|
|
3105
3153
|
}
|
|
3106
3154
|
const Ri = ["sum", "avg", "count", "min", "max", "first", "last"];
|
|
3107
|
-
function
|
|
3155
|
+
function Si(s, e, t, i) {
|
|
3108
3156
|
const n = new AbortController(), r = { config: e, callbacks: i, signal: n.signal }, o = document.createElement("div");
|
|
3109
|
-
return o.className = "tbw-pivot-panel", o.appendChild(j("Options", () => Li(t, r))), o.appendChild(j("Row Groups", () => Ve("rowGroups", r))), o.appendChild(j("Column Groups", () => Ve("columnGroups", r))), o.appendChild(j("Values", () =>
|
|
3157
|
+
return o.className = "tbw-pivot-panel", o.appendChild(j("Options", () => Li(t, r))), o.appendChild(j("Row Groups", () => Ve("rowGroups", r))), o.appendChild(j("Column Groups", () => Ve("columnGroups", r))), o.appendChild(j("Values", () => Ai(r))), o.appendChild(j("Available Fields", () => Ti(r))), s.appendChild(o), () => {
|
|
3110
3158
|
n.abort(), o.remove();
|
|
3111
3159
|
};
|
|
3112
3160
|
}
|
|
@@ -3127,7 +3175,7 @@ function Ve(s, e) {
|
|
|
3127
3175
|
a.className = "tbw-pivot-placeholder", a.textContent = "Drag fields here or click to add", r.appendChild(a);
|
|
3128
3176
|
} else
|
|
3129
3177
|
for (const a of o)
|
|
3130
|
-
r.appendChild(
|
|
3178
|
+
r.appendChild(ki(a, s, e));
|
|
3131
3179
|
return r.addEventListener(
|
|
3132
3180
|
"dragover",
|
|
3133
3181
|
(a) => {
|
|
@@ -3150,7 +3198,7 @@ function Ve(s, e) {
|
|
|
3150
3198
|
{ signal: n }
|
|
3151
3199
|
), r;
|
|
3152
3200
|
}
|
|
3153
|
-
function
|
|
3201
|
+
function ki(s, e, t) {
|
|
3154
3202
|
const { callbacks: i, signal: n } = t, r = document.createElement("div");
|
|
3155
3203
|
r.className = "tbw-pivot-field-chip", r.draggable = !0;
|
|
3156
3204
|
const o = i.getAvailableFields().find((d) => d.field === s), a = document.createElement("span");
|
|
@@ -3176,7 +3224,7 @@ function Si(s, e, t) {
|
|
|
3176
3224
|
{ signal: n }
|
|
3177
3225
|
), r;
|
|
3178
3226
|
}
|
|
3179
|
-
function
|
|
3227
|
+
function Ai(s) {
|
|
3180
3228
|
const { config: e, callbacks: t, signal: i } = s, n = document.createElement("div");
|
|
3181
3229
|
n.className = "tbw-pivot-drop-zone tbw-pivot-values-zone", n.setAttribute("data-zone", "values");
|
|
3182
3230
|
const r = e.valueFields ?? [];
|
|
@@ -3185,7 +3233,7 @@ function ki(s) {
|
|
|
3185
3233
|
o.className = "tbw-pivot-placeholder", o.textContent = "Drag numeric fields here for aggregation", n.appendChild(o);
|
|
3186
3234
|
} else
|
|
3187
3235
|
for (const o of r)
|
|
3188
|
-
n.appendChild(
|
|
3236
|
+
n.appendChild(_i(o, s));
|
|
3189
3237
|
return n.addEventListener(
|
|
3190
3238
|
"dragover",
|
|
3191
3239
|
(o) => {
|
|
@@ -3208,7 +3256,7 @@ function ki(s) {
|
|
|
3208
3256
|
{ signal: i }
|
|
3209
3257
|
), n;
|
|
3210
3258
|
}
|
|
3211
|
-
function
|
|
3259
|
+
function _i(s, e) {
|
|
3212
3260
|
const { callbacks: t, signal: i } = e, n = document.createElement("div");
|
|
3213
3261
|
n.className = "tbw-pivot-field-chip tbw-pivot-value-chip";
|
|
3214
3262
|
const r = t.getAvailableFields().find((c) => c.field === s.field), o = document.createElement("div");
|
|
@@ -3237,7 +3285,7 @@ function Ai(s, e) {
|
|
|
3237
3285
|
{ signal: i }
|
|
3238
3286
|
), o.appendChild(a), o.appendChild(l), n.appendChild(o), n.appendChild(d), n;
|
|
3239
3287
|
}
|
|
3240
|
-
function
|
|
3288
|
+
function Ti(s) {
|
|
3241
3289
|
const { config: e, callbacks: t, signal: i } = s, n = document.createElement("div");
|
|
3242
3290
|
n.className = "tbw-pivot-available-fields";
|
|
3243
3291
|
const r = t.getAvailableFields(), o = /* @__PURE__ */ new Set([
|
|
@@ -3306,7 +3354,7 @@ function de(s, e, t, i) {
|
|
|
3306
3354
|
const o = document.createElement("span");
|
|
3307
3355
|
return o.textContent = s, n.appendChild(r), n.appendChild(o), n;
|
|
3308
3356
|
}
|
|
3309
|
-
function
|
|
3357
|
+
function Fi(s, e, t) {
|
|
3310
3358
|
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) => {
|
|
3311
3359
|
const r = document.createElement("div");
|
|
3312
3360
|
if (r.className = "cell", r.setAttribute("data-col", String(n)), r.setAttribute("data-row", String(t.rowIndex)), r.setAttribute("role", "gridcell"), n === 0) {
|
|
@@ -3327,7 +3375,7 @@ function Ti(s, e, t) {
|
|
|
3327
3375
|
e.appendChild(r);
|
|
3328
3376
|
}), !0;
|
|
3329
3377
|
}
|
|
3330
|
-
function
|
|
3378
|
+
function Ii(s, e, t, i) {
|
|
3331
3379
|
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) => {
|
|
3332
3380
|
const o = document.createElement("div");
|
|
3333
3381
|
if (o.className = "cell", o.setAttribute("data-col", String(r)), o.setAttribute("data-row", String(i)), o.setAttribute("role", "gridcell"), r === 0) {
|
|
@@ -3342,7 +3390,7 @@ function Fi(s, e, t, i) {
|
|
|
3342
3390
|
e.appendChild(o);
|
|
3343
3391
|
}), !0;
|
|
3344
3392
|
}
|
|
3345
|
-
function
|
|
3393
|
+
function Pi(s, e, t) {
|
|
3346
3394
|
return e.className = "pivot-grand-total-row", e.setAttribute("role", "presentation"), e.innerHTML = "", t.forEach((i, n) => {
|
|
3347
3395
|
const r = document.createElement("div");
|
|
3348
3396
|
if (r.className = "cell", r.setAttribute("data-col", String(n)), n === 0) {
|
|
@@ -3355,10 +3403,10 @@ function Ii(s, e, t) {
|
|
|
3355
3403
|
e.appendChild(r);
|
|
3356
3404
|
}), !0;
|
|
3357
3405
|
}
|
|
3358
|
-
const
|
|
3359
|
-
class
|
|
3406
|
+
const Di = '@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:var(--tbw-pivot-toggle-size, var(--tbw-toggle-size, 1.25em));height:var(--tbw-pivot-toggle-size, var(--tbw-toggle-size, 1.25em));margin-right:var(--tbw-spacing-sm, .375em);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 var(--tbw-transition-duration, .12s) var(--tbw-transition-ease, ease),color var(--tbw-transition-duration, .12s) var(--tbw-transition-ease, ease)}.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}}}';
|
|
3407
|
+
class G extends _ {
|
|
3360
3408
|
name = "pivot";
|
|
3361
|
-
styles =
|
|
3409
|
+
styles = Di;
|
|
3362
3410
|
static PANEL_ID = "pivot";
|
|
3363
3411
|
get defaultConfig() {
|
|
3364
3412
|
return {
|
|
@@ -3375,6 +3423,7 @@ class O extends _ {
|
|
|
3375
3423
|
fieldHeaderMap = /* @__PURE__ */ new Map();
|
|
3376
3424
|
expandedKeys = /* @__PURE__ */ new Set();
|
|
3377
3425
|
defaultExpanded = !0;
|
|
3426
|
+
userHasToggledExpand = !1;
|
|
3378
3427
|
originalColumns = [];
|
|
3379
3428
|
panelContainer = null;
|
|
3380
3429
|
grandTotalFooter = null;
|
|
@@ -3387,12 +3436,12 @@ class O extends _ {
|
|
|
3387
3436
|
return this.isAnimationEnabled ? this.config.animation ?? "slide" : !1;
|
|
3388
3437
|
}
|
|
3389
3438
|
detach() {
|
|
3390
|
-
this.isActive = !1, this.hasInitialized = !1, this.pivotResult = null, this.fieldHeaderMap.clear(), this.originalColumns = [], this.panelContainer = null, this.cleanupGrandTotalFooter(), this.previousVisibleKeys.clear(), this.keysToAnimate.clear();
|
|
3439
|
+
this.isActive = !1, this.hasInitialized = !1, this.pivotResult = null, this.fieldHeaderMap.clear(), this.originalColumns = [], this.panelContainer = null, this.cleanupGrandTotalFooter(), this.previousVisibleKeys.clear(), this.keysToAnimate.clear(), this.userHasToggledExpand = !1;
|
|
3391
3440
|
}
|
|
3392
3441
|
getToolPanel() {
|
|
3393
3442
|
if ((this.config?.showToolPanel ?? this.userConfig?.showToolPanel ?? !0) !== !1)
|
|
3394
3443
|
return {
|
|
3395
|
-
id:
|
|
3444
|
+
id: G.PANEL_ID,
|
|
3396
3445
|
title: "Pivot",
|
|
3397
3446
|
icon: "⊞",
|
|
3398
3447
|
tooltip: "Configure pivot table",
|
|
@@ -3403,11 +3452,11 @@ class O extends _ {
|
|
|
3403
3452
|
processRows(e) {
|
|
3404
3453
|
if (!this.hasInitialized && this.config.active !== !1 && this.hasValidPivotConfig() && (this.hasInitialized = !0, this.isActive = !0), !this.isActive)
|
|
3405
3454
|
return [...e];
|
|
3406
|
-
const t =
|
|
3455
|
+
const t = wi(this.config);
|
|
3407
3456
|
if (t.length > 0)
|
|
3408
3457
|
return this.warn(`Config errors: ${t.join(", ")}`), [...e];
|
|
3409
|
-
this.buildFieldHeaderMap(), this.defaultExpanded = this.config.defaultExpanded ?? !0, this.
|
|
3410
|
-
const i = this.config.indentWidth ?? 20, n =
|
|
3458
|
+
this.buildFieldHeaderMap(), this.defaultExpanded = this.config.defaultExpanded ?? !0, this.pivotResult = bi(e, this.config), this.expandedKeys.size === 0 && this.defaultExpanded && !this.userHasToggledExpand && this.expandAllKeys();
|
|
3459
|
+
const i = this.config.indentWidth ?? 20, n = Ci(
|
|
3411
3460
|
this.pivotResult.rows,
|
|
3412
3461
|
this.expandedKeys,
|
|
3413
3462
|
this.defaultExpanded
|
|
@@ -3459,13 +3508,13 @@ class O extends _ {
|
|
|
3459
3508
|
}
|
|
3460
3509
|
renderRow(e, t, i) {
|
|
3461
3510
|
const n = e;
|
|
3462
|
-
return n.__pivotRowKey && n.__pivotHasChildren ?
|
|
3511
|
+
return n.__pivotRowKey && n.__pivotHasChildren ? Fi(n, t, {
|
|
3463
3512
|
columns: this.gridColumns,
|
|
3464
3513
|
rowIndex: i,
|
|
3465
3514
|
onToggle: (r) => this.toggle(r),
|
|
3466
3515
|
resolveIcon: (r) => this.resolveIcon(r),
|
|
3467
3516
|
setIcon: (r, o) => this.setIcon(r, o)
|
|
3468
|
-
}) : n.__pivotRowKey !== void 0 && this.isActive ?
|
|
3517
|
+
}) : n.__pivotRowKey !== void 0 && this.isActive ? Ii(n, t, this.gridColumns, i) : (this.cleanupPivotStyling(t), !1);
|
|
3469
3518
|
}
|
|
3470
3519
|
cleanupPivotStyling(e) {
|
|
3471
3520
|
(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 = "");
|
|
@@ -3503,29 +3552,29 @@ class O extends _ {
|
|
|
3503
3552
|
__pivotTotal: this.pivotResult.grandTotal,
|
|
3504
3553
|
...this.pivotResult.totals
|
|
3505
3554
|
};
|
|
3506
|
-
|
|
3555
|
+
Pi(i, this.grandTotalFooter, this.gridColumns);
|
|
3507
3556
|
}
|
|
3508
3557
|
cleanupGrandTotalFooter() {
|
|
3509
3558
|
this.grandTotalFooter && (this.grandTotalFooter.remove(), this.grandTotalFooter = null);
|
|
3510
3559
|
}
|
|
3511
3560
|
toggle(e) {
|
|
3512
|
-
this.expandedKeys.has(e) ? this.expandedKeys.delete(e) : this.expandedKeys.add(e), this.requestRender();
|
|
3561
|
+
this.userHasToggledExpand = !0, this.expandedKeys.has(e) ? this.expandedKeys.delete(e) : this.expandedKeys.add(e), this.requestRender();
|
|
3513
3562
|
}
|
|
3514
3563
|
expand(e) {
|
|
3515
|
-
this.expandedKeys.add(e), this.requestRender();
|
|
3564
|
+
this.userHasToggledExpand = !0, this.expandedKeys.add(e), this.requestRender();
|
|
3516
3565
|
}
|
|
3517
3566
|
collapse(e) {
|
|
3518
|
-
this.expandedKeys.delete(e), this.requestRender();
|
|
3567
|
+
this.userHasToggledExpand = !0, this.expandedKeys.delete(e), this.requestRender();
|
|
3519
3568
|
}
|
|
3520
3569
|
expandAll() {
|
|
3521
|
-
this.expandAllKeys(), this.requestRender();
|
|
3570
|
+
this.userHasToggledExpand = !0, this.expandAllKeys(), this.requestRender();
|
|
3522
3571
|
}
|
|
3523
3572
|
collapseAll() {
|
|
3524
|
-
this.expandedKeys.clear(), this.requestRender();
|
|
3573
|
+
this.userHasToggledExpand = !0, this.expandedKeys.clear(), this.requestRender();
|
|
3525
3574
|
}
|
|
3526
3575
|
expandAllKeys() {
|
|
3527
3576
|
if (!this.pivotResult) return;
|
|
3528
|
-
const e =
|
|
3577
|
+
const e = Ei(this.pivotResult.rows);
|
|
3529
3578
|
for (const t of e)
|
|
3530
3579
|
this.expandedKeys.add(t);
|
|
3531
3580
|
}
|
|
@@ -3557,16 +3606,16 @@ class O extends _ {
|
|
|
3557
3606
|
this.pivotResult = null, this.requestRender();
|
|
3558
3607
|
}
|
|
3559
3608
|
showPanel() {
|
|
3560
|
-
this.grid.openToolPanel(), this.grid.expandedToolPanelSections.includes(
|
|
3609
|
+
this.grid.openToolPanel(), this.grid.expandedToolPanelSections.includes(G.PANEL_ID) || this.grid.toggleToolPanelSection(G.PANEL_ID);
|
|
3561
3610
|
}
|
|
3562
3611
|
hidePanel() {
|
|
3563
3612
|
this.grid.closeToolPanel();
|
|
3564
3613
|
}
|
|
3565
3614
|
togglePanel() {
|
|
3566
|
-
this.grid.isToolPanelOpen || this.grid.openToolPanel(), this.grid.toggleToolPanelSection(
|
|
3615
|
+
this.grid.isToolPanelOpen || this.grid.openToolPanel(), this.grid.toggleToolPanelSection(G.PANEL_ID);
|
|
3567
3616
|
}
|
|
3568
3617
|
isPanelVisible() {
|
|
3569
|
-
return this.grid.isToolPanelOpen && this.grid.expandedToolPanelSections.includes(
|
|
3618
|
+
return this.grid.isToolPanelOpen && this.grid.expandedToolPanelSections.includes(G.PANEL_ID);
|
|
3570
3619
|
}
|
|
3571
3620
|
get gridColumns() {
|
|
3572
3621
|
return this.grid.columns ?? [];
|
|
@@ -3610,7 +3659,7 @@ class O extends _ {
|
|
|
3610
3659
|
},
|
|
3611
3660
|
getAvailableFields: () => this.getAvailableFields()
|
|
3612
3661
|
};
|
|
3613
|
-
return
|
|
3662
|
+
return Si(e, this.config, this.isActive, t);
|
|
3614
3663
|
}
|
|
3615
3664
|
refreshPanel() {
|
|
3616
3665
|
this.panelContainer && (this.panelContainer.innerHTML = "", this.renderPanel(this.panelContainer));
|
|
@@ -3644,7 +3693,7 @@ class O extends _ {
|
|
|
3644
3693
|
}
|
|
3645
3694
|
}
|
|
3646
3695
|
const Q = "tbw-print-isolation-style";
|
|
3647
|
-
function
|
|
3696
|
+
function Mi(s, e) {
|
|
3648
3697
|
const t = document.createElement("style");
|
|
3649
3698
|
return t.id = Q, t.textContent = `
|
|
3650
3699
|
/* Print isolation: hide everything except the target grid */
|
|
@@ -3718,12 +3767,12 @@ function Di(s, e) {
|
|
|
3718
3767
|
}
|
|
3719
3768
|
`, t;
|
|
3720
3769
|
}
|
|
3721
|
-
async function
|
|
3770
|
+
async function Ni(s, e = {}) {
|
|
3722
3771
|
const { orientation: t = "landscape" } = e, i = s.id;
|
|
3723
3772
|
document.querySelectorAll(`#${CSS.escape(i)}`).length > 1 && console.warn(
|
|
3724
3773
|
`[tbw-grid:print] Multiple elements found with id="${i}". Print isolation may not work correctly. Ensure each grid has a unique ID.`
|
|
3725
3774
|
), document.getElementById(Q)?.remove();
|
|
3726
|
-
const r =
|
|
3775
|
+
const r = Mi(i, t);
|
|
3727
3776
|
return document.head.appendChild(r), new Promise((o) => {
|
|
3728
3777
|
const a = () => {
|
|
3729
3778
|
window.removeEventListener("afterprint", a), document.getElementById(Q)?.remove(), o();
|
|
@@ -3733,7 +3782,7 @@ async function Mi(s, e = {}) {
|
|
|
3733
3782
|
}, 5e3);
|
|
3734
3783
|
});
|
|
3735
3784
|
}
|
|
3736
|
-
const
|
|
3785
|
+
const qi = ".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:var(--tbw-spacing-md, .5em) 0;margin-bottom:var(--tbw-spacing-md, .5em);border-bottom:2px solid var(--tbw-print-border, var(--tbw-color-border-strong));font-family:inherit}.tbw-print-header-title{font-size:1.25em;font-weight:700}.tbw-print-header-timestamp{font-size:var(--tbw-font-size-sm, .875em);color:var(--tbw-print-muted, var(--tbw-color-fg-muted))}tbw-grid .tbw-print-footer{display:block;margin-top:var(--tbw-spacing-md, .5em);padding-top:var(--tbw-spacing-md, .5em);border-top:1px solid var(--tbw-print-border, var(--tbw-color-border));font-size:var(--tbw-font-size-xs, .75em);color:var(--tbw-print-muted, var(--tbw-color-fg-muted));text-align:right}tbw-grid .data-grid-row{break-inside:avoid;page-break-inside:avoid}tbw-grid .cell{border:1px solid var(--tbw-print-cell-border, var(--tbw-color-border))!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}}}", Hi = {
|
|
3737
3786
|
button: !1,
|
|
3738
3787
|
orientation: "landscape",
|
|
3739
3788
|
warnThreshold: 500,
|
|
@@ -3746,7 +3795,7 @@ const Ni = ".tbw-print-header,.tbw-print-footer{display:none}@media print{tbw-gr
|
|
|
3746
3795
|
class xn extends _ {
|
|
3747
3796
|
name = "print";
|
|
3748
3797
|
version = "1.0.0";
|
|
3749
|
-
styles =
|
|
3798
|
+
styles = qi;
|
|
3750
3799
|
#e = !1;
|
|
3751
3800
|
#t = null;
|
|
3752
3801
|
#o = null;
|
|
@@ -3770,7 +3819,7 @@ class xn extends _ {
|
|
|
3770
3819
|
console.warn("[PrintPlugin] Grid not available");
|
|
3771
3820
|
return;
|
|
3772
3821
|
}
|
|
3773
|
-
const i = { ...
|
|
3822
|
+
const i = { ...Hi, ...this.config, ...e }, r = this.rows.length;
|
|
3774
3823
|
let o = r, a = !1;
|
|
3775
3824
|
if (i.warnThreshold > 0 && r > i.warnThreshold) {
|
|
3776
3825
|
const d = i.maxRows > 0 ? `
|
|
@@ -3841,7 +3890,7 @@ Click OK to continue, or Cancel to abort.`
|
|
|
3841
3890
|
}
|
|
3842
3891
|
async #p(e) {
|
|
3843
3892
|
const t = this.gridElement;
|
|
3844
|
-
t && await
|
|
3893
|
+
t && await Ni(t, {
|
|
3845
3894
|
orientation: e.orientation
|
|
3846
3895
|
});
|
|
3847
3896
|
}
|
|
@@ -3890,7 +3939,7 @@ Click OK to continue, or Cancel to abort.`
|
|
|
3890
3939
|
});
|
|
3891
3940
|
}
|
|
3892
3941
|
}
|
|
3893
|
-
function
|
|
3942
|
+
function zi(s) {
|
|
3894
3943
|
const e = s.meta ?? {};
|
|
3895
3944
|
return e.lockPosition !== !0 && e.suppressMovable !== !0;
|
|
3896
3945
|
}
|
|
@@ -3899,10 +3948,10 @@ function We(s, e, t) {
|
|
|
3899
3948
|
const i = [...s], [n] = i.splice(e, 1);
|
|
3900
3949
|
return i.splice(t, 0, n), i;
|
|
3901
3950
|
}
|
|
3902
|
-
const
|
|
3951
|
+
const Ki = '@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}}';
|
|
3903
3952
|
class Cn extends _ {
|
|
3904
3953
|
name = "reorder";
|
|
3905
|
-
styles =
|
|
3954
|
+
styles = Ki;
|
|
3906
3955
|
get defaultConfig() {
|
|
3907
3956
|
return {
|
|
3908
3957
|
animation: "flip"
|
|
@@ -3919,7 +3968,7 @@ class Cn extends _ {
|
|
|
3919
3968
|
draggedIndex = null;
|
|
3920
3969
|
dropIndex = null;
|
|
3921
3970
|
canMoveColumnWithPlugins(e) {
|
|
3922
|
-
return !e || !
|
|
3971
|
+
return !e || !zi(e) ? !1 : !this.grid.queryPlugins({
|
|
3923
3972
|
type: Je.CAN_MOVE_COLUMN,
|
|
3924
3973
|
context: e
|
|
3925
3974
|
}).includes(!1);
|
|
@@ -4095,11 +4144,11 @@ class Cn extends _ {
|
|
|
4095
4144
|
this.grid.requestStateChange?.();
|
|
4096
4145
|
}
|
|
4097
4146
|
}
|
|
4098
|
-
const
|
|
4099
|
-
class
|
|
4147
|
+
const Oi = '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}}';
|
|
4148
|
+
class En extends _ {
|
|
4100
4149
|
name = "responsive";
|
|
4101
4150
|
version = "1.0.0";
|
|
4102
|
-
styles =
|
|
4151
|
+
styles = Oi;
|
|
4103
4152
|
static manifest = {
|
|
4104
4153
|
incompatibleWith: [
|
|
4105
4154
|
{
|
|
@@ -4156,7 +4205,7 @@ class Rn extends _ {
|
|
|
4156
4205
|
this.#e?.disconnect(), this.#e = void 0, clearTimeout(this.#o), this.#o = void 0, this.gridElement && this.gridElement.removeAttribute("data-responsive"), super.detach();
|
|
4157
4206
|
}
|
|
4158
4207
|
afterRender() {
|
|
4159
|
-
if (this.#
|
|
4208
|
+
if (this.#E(), !(this.#c.length > 0 ? this.#a !== null : this.#t))
|
|
4160
4209
|
return;
|
|
4161
4210
|
const t = this.#r.size > 0, i = this.#d.size > 0;
|
|
4162
4211
|
if (!t && !i)
|
|
@@ -4298,7 +4347,7 @@ class Rn extends _ {
|
|
|
4298
4347
|
return e;
|
|
4299
4348
|
}
|
|
4300
4349
|
#b = !1;
|
|
4301
|
-
#
|
|
4350
|
+
#E() {
|
|
4302
4351
|
if (!this.#t || !this.config.cardRenderer)
|
|
4303
4352
|
return;
|
|
4304
4353
|
let e = !1;
|
|
@@ -4320,8 +4369,8 @@ class Rn extends _ {
|
|
|
4320
4369
|
}));
|
|
4321
4370
|
}
|
|
4322
4371
|
}
|
|
4323
|
-
const Gi = '.dg-row-drag-handle{display:flex;align-items:center;justify-content:center;cursor:grab;user-select:none;color:var(--tbw-color-fg-muted
|
|
4324
|
-
class
|
|
4372
|
+
const Gi = '@layer tbw-plugins{.dg-row-drag-handle{display:flex;align-items:center;justify-content:center;cursor:grab;user-select:none;color:var(--tbw-row-reorder-handle-color, var(--tbw-color-fg-muted));transition:color var(--tbw-transition-duration, .12s) var(--tbw-transition-ease, ease);font-size:var(--tbw-font-size, 1em);letter-spacing:-2px;&:hover{color:var(--tbw-row-reorder-handle-hover, var(--tbw-color-fg))}&: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-row-reorder-indicator, var(--tbw-color-accent));z-index:10}&.drop-after:after{content:"";position:absolute;bottom:0;left:0;right:0;height:2px;background-color:var(--tbw-row-reorder-indicator, var(--tbw-color-accent));z-index:10}}.data-grid-row.keyboard-moving{background-color:var(--tbw-row-reorder-moving-bg, var(--tbw-focus-background));box-shadow:0 0 0 1px var(--tbw-row-reorder-moving-border, var(--tbw-color-accent)) inset}.data-grid-row.flip-animating{transition:transform var(--tbw-animation-duration, .2s) ease-out;will-change:transform;z-index:1}}', Bi = "__tbw_row_drag";
|
|
4373
|
+
class Rn extends _ {
|
|
4325
4374
|
name = "rowReorder";
|
|
4326
4375
|
styles = Gi;
|
|
4327
4376
|
get defaultConfig() {
|
|
@@ -4334,6 +4383,9 @@ class En extends _ {
|
|
|
4334
4383
|
animation: "flip"
|
|
4335
4384
|
};
|
|
4336
4385
|
}
|
|
4386
|
+
get animationType() {
|
|
4387
|
+
return this.isAnimationEnabled ? this.config.animation !== void 0 ? this.config.animation : "flip" : !1;
|
|
4388
|
+
}
|
|
4337
4389
|
isDragging = !1;
|
|
4338
4390
|
draggedRowIndex = null;
|
|
4339
4391
|
dropRowIndex = null;
|
|
@@ -4347,7 +4399,7 @@ class En extends _ {
|
|
|
4347
4399
|
if (!this.config.showDragHandle)
|
|
4348
4400
|
return [...e];
|
|
4349
4401
|
const t = {
|
|
4350
|
-
field:
|
|
4402
|
+
field: Bi,
|
|
4351
4403
|
header: "",
|
|
4352
4404
|
width: this.config.dragHandleWidth ?? 40,
|
|
4353
4405
|
resizable: !1,
|
|
@@ -4473,7 +4525,49 @@ class En extends _ {
|
|
|
4473
4525
|
rows: r,
|
|
4474
4526
|
source: n
|
|
4475
4527
|
};
|
|
4476
|
-
this.emitCancelable("row-move", a)
|
|
4528
|
+
if (!this.emitCancelable("row-move", a))
|
|
4529
|
+
if (this.animationType === "flip" && this.gridElement) {
|
|
4530
|
+
const d = this.captureRowPositions();
|
|
4531
|
+
this.grid.rows = r, requestAnimationFrame(() => {
|
|
4532
|
+
this.gridElement.offsetHeight, this.animateFLIP(d, t, i);
|
|
4533
|
+
});
|
|
4534
|
+
} else
|
|
4535
|
+
this.grid.rows = r;
|
|
4536
|
+
}
|
|
4537
|
+
captureRowPositions() {
|
|
4538
|
+
const e = /* @__PURE__ */ new Map();
|
|
4539
|
+
return this.gridElement?.querySelectorAll(".data-grid-row").forEach((t) => {
|
|
4540
|
+
const i = this.getRowIndex(t);
|
|
4541
|
+
i >= 0 && e.set(i, t.getBoundingClientRect().top);
|
|
4542
|
+
}), e;
|
|
4543
|
+
}
|
|
4544
|
+
animateFLIP(e, t, i) {
|
|
4545
|
+
const n = this.gridElement;
|
|
4546
|
+
if (!n || e.size === 0) return;
|
|
4547
|
+
const r = Math.min(t, i), o = Math.max(t, i), a = [];
|
|
4548
|
+
if (n.querySelectorAll(".data-grid-row").forEach((d) => {
|
|
4549
|
+
const c = d, u = this.getRowIndex(c);
|
|
4550
|
+
if (u < 0 || u < r || u > o) return;
|
|
4551
|
+
let h;
|
|
4552
|
+
u === i ? h = t : t < i ? h = u + 1 : h = u - 1;
|
|
4553
|
+
const g = e.get(h);
|
|
4554
|
+
if (g === void 0) return;
|
|
4555
|
+
const f = c.getBoundingClientRect().top, p = g - f;
|
|
4556
|
+
Math.abs(p) > 1 && a.push({ el: c, deltaY: p });
|
|
4557
|
+
}), a.length === 0) return;
|
|
4558
|
+
a.forEach(({ el: d, deltaY: c }) => {
|
|
4559
|
+
d.style.transform = `translateY(${c}px)`;
|
|
4560
|
+
}), n.offsetHeight;
|
|
4561
|
+
const l = this.animationDuration;
|
|
4562
|
+
requestAnimationFrame(() => {
|
|
4563
|
+
a.forEach(({ el: d }) => {
|
|
4564
|
+
d.classList.add("flip-animating"), d.style.transform = "";
|
|
4565
|
+
}), setTimeout(() => {
|
|
4566
|
+
a.forEach(({ el: d }) => {
|
|
4567
|
+
d.style.transform = "", d.classList.remove("flip-animating");
|
|
4568
|
+
});
|
|
4569
|
+
}, l + 50);
|
|
4570
|
+
});
|
|
4477
4571
|
}
|
|
4478
4572
|
getRowIndex(e) {
|
|
4479
4573
|
const t = e.querySelector(".cell[data-row]");
|
|
@@ -4496,34 +4590,34 @@ function V(s) {
|
|
|
4496
4590
|
endCol: Math.max(s.startCol, s.endCol)
|
|
4497
4591
|
};
|
|
4498
4592
|
}
|
|
4499
|
-
function
|
|
4593
|
+
function Vi(s) {
|
|
4500
4594
|
const e = V(s);
|
|
4501
4595
|
return {
|
|
4502
4596
|
from: { row: e.startRow, col: e.startCol },
|
|
4503
4597
|
to: { row: e.endRow, col: e.endCol }
|
|
4504
4598
|
};
|
|
4505
4599
|
}
|
|
4506
|
-
function
|
|
4507
|
-
return s.map(
|
|
4600
|
+
function nt(s) {
|
|
4601
|
+
return s.map(Vi);
|
|
4508
4602
|
}
|
|
4509
|
-
function
|
|
4603
|
+
function Wi(s, e, t) {
|
|
4510
4604
|
const i = V(t);
|
|
4511
4605
|
return s >= i.startRow && s <= i.endRow && e >= i.startCol && e <= i.endCol;
|
|
4512
4606
|
}
|
|
4513
4607
|
function $e(s, e, t) {
|
|
4514
|
-
return t.some((i) =>
|
|
4608
|
+
return t.some((i) => Wi(s, e, i));
|
|
4515
4609
|
}
|
|
4516
|
-
function
|
|
4610
|
+
function $i(s) {
|
|
4517
4611
|
const e = [], t = V(s);
|
|
4518
4612
|
for (let i = t.startRow; i <= t.endRow; i++)
|
|
4519
4613
|
for (let n = t.startCol; n <= t.endCol; n++)
|
|
4520
4614
|
e.push({ row: i, col: n });
|
|
4521
4615
|
return e;
|
|
4522
4616
|
}
|
|
4523
|
-
function
|
|
4617
|
+
function ji(s) {
|
|
4524
4618
|
const e = /* @__PURE__ */ new Map();
|
|
4525
4619
|
for (const t of s)
|
|
4526
|
-
for (const i of
|
|
4620
|
+
for (const i of $i(t))
|
|
4527
4621
|
e.set(`${i.row},${i.col}`, i);
|
|
4528
4622
|
return [...e.values()];
|
|
4529
4623
|
}
|
|
@@ -4539,8 +4633,8 @@ function J(s, e) {
|
|
|
4539
4633
|
const t = V(s), i = V(e);
|
|
4540
4634
|
return t.startRow === i.startRow && t.startCol === i.startCol && t.endRow === i.endRow && t.endCol === i.endCol;
|
|
4541
4635
|
}
|
|
4542
|
-
const
|
|
4543
|
-
function
|
|
4636
|
+
const Ui = "@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-selection-warning-bg, rgba(from var(--tbw-color-error) r g b / 50%))}}.tbw-selection-summary{font-size:var(--tbw-font-size-sm, .8125rem);color:var(--tbw-color-fg-muted);white-space:nowrap}}}";
|
|
4637
|
+
function Yi(s, e, t) {
|
|
4544
4638
|
if (s === "cell" && e.selectedCell)
|
|
4545
4639
|
return {
|
|
4546
4640
|
mode: s,
|
|
@@ -4558,7 +4652,7 @@ function Ui(s, e, t) {
|
|
|
4558
4652
|
}));
|
|
4559
4653
|
return { mode: s, ranges: i };
|
|
4560
4654
|
}
|
|
4561
|
-
return s === "range" && e.ranges.length > 0 ? { mode: s, ranges:
|
|
4655
|
+
return s === "range" && e.ranges.length > 0 ? { mode: s, ranges: nt(e.ranges) } : { mode: s, ranges: [] };
|
|
4562
4656
|
}
|
|
4563
4657
|
class Sn extends _ {
|
|
4564
4658
|
static manifest = {
|
|
@@ -4574,7 +4668,7 @@ class Sn extends _ {
|
|
|
4574
4668
|
]
|
|
4575
4669
|
};
|
|
4576
4670
|
name = "selection";
|
|
4577
|
-
styles =
|
|
4671
|
+
styles = Ui;
|
|
4578
4672
|
get defaultConfig() {
|
|
4579
4673
|
return {
|
|
4580
4674
|
mode: "cell",
|
|
@@ -4616,7 +4710,7 @@ class Sn extends _ {
|
|
|
4616
4710
|
const { rowIndex: t, colIndex: i, originalEvent: n } = e, { mode: r, triggerOn: o = "click" } = this.config;
|
|
4617
4711
|
if (n.type !== o)
|
|
4618
4712
|
return !1;
|
|
4619
|
-
const a = this.columns[i], l = a &&
|
|
4713
|
+
const a = this.columns[i], l = a && H(a);
|
|
4620
4714
|
if (r === "cell") {
|
|
4621
4715
|
if (l || !this.isCellSelectable(t, i))
|
|
4622
4716
|
return !1;
|
|
@@ -4694,7 +4788,7 @@ class Sn extends _ {
|
|
|
4694
4788
|
onCellMouseDown(e) {
|
|
4695
4789
|
if (!this.isSelectionEnabled() || this.config.mode !== "range" || e.rowIndex === void 0 || e.colIndex === void 0 || e.rowIndex < 0) return;
|
|
4696
4790
|
const t = this.columns[e.colIndex];
|
|
4697
|
-
if (t &&
|
|
4791
|
+
if (t && H(t) || !this.isCellSelectable(e.rowIndex, e.colIndex) || e.originalEvent.shiftKey && this.cellAnchor)
|
|
4698
4792
|
return;
|
|
4699
4793
|
this.isDragging = !0;
|
|
4700
4794
|
const i = e.rowIndex, n = e.colIndex, r = e.originalEvent.ctrlKey || e.originalEvent.metaKey, o = {
|
|
@@ -4709,8 +4803,8 @@ class Sn extends _ {
|
|
|
4709
4803
|
if (!this.isSelectionEnabled() || this.config.mode !== "range" || !this.isDragging || !this.cellAnchor || e.rowIndex === void 0 || e.colIndex === void 0 || e.rowIndex < 0) return;
|
|
4710
4804
|
let t = e.colIndex;
|
|
4711
4805
|
const i = this.columns[t];
|
|
4712
|
-
if (i &&
|
|
4713
|
-
const o = this.columns.findIndex((a) => !
|
|
4806
|
+
if (i && H(i)) {
|
|
4807
|
+
const o = this.columns.findIndex((a) => !H(a));
|
|
4714
4808
|
o >= 0 && (t = o);
|
|
4715
4809
|
}
|
|
4716
4810
|
const n = ce(this.cellAnchor, { row: e.rowIndex, col: t }), r = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null;
|
|
@@ -4731,19 +4825,19 @@ class Sn extends _ {
|
|
|
4731
4825
|
if (r.forEach((o) => {
|
|
4732
4826
|
o.classList.remove("selected", "row-focus"), i && o.removeAttribute("data-selectable");
|
|
4733
4827
|
}), t === "row" && (xe(e), r.forEach((o) => {
|
|
4734
|
-
const a = o.querySelector(".cell[data-row]"), l =
|
|
4828
|
+
const a = o.querySelector(".cell[data-row]"), l = ht(a);
|
|
4735
4829
|
l >= 0 && (i && !this.isRowSelectable(l) && o.setAttribute("data-selectable", "false"), this.selected.has(l) && o.classList.add("selected", "row-focus"));
|
|
4736
4830
|
})), (t === "cell" || t === "range") && i && e.querySelectorAll(".cell[data-row][data-col]").forEach((a) => {
|
|
4737
4831
|
const l = parseInt(a.getAttribute("data-row") ?? "-1", 10), d = parseInt(a.getAttribute("data-col") ?? "-1", 10);
|
|
4738
4832
|
l >= 0 && d >= 0 && (this.isCellSelectable(l, d) || a.setAttribute("data-selectable", "false"));
|
|
4739
4833
|
}), t === "range" && this.ranges.length > 0) {
|
|
4740
4834
|
xe(e);
|
|
4741
|
-
const o = this.activeRange ? V(this.activeRange) : null, a = this.columns.findIndex((d) => !
|
|
4835
|
+
const o = this.activeRange ? V(this.activeRange) : null, a = this.columns.findIndex((d) => !H(d));
|
|
4742
4836
|
this.columns.length - 1, e.querySelectorAll(".cell[data-row][data-col]").forEach((d) => {
|
|
4743
4837
|
const c = parseInt(d.getAttribute("data-row") ?? "-1", 10), u = parseInt(d.getAttribute("data-col") ?? "-1", 10);
|
|
4744
4838
|
if (c >= 0 && u >= 0) {
|
|
4745
4839
|
const h = this.columns[u];
|
|
4746
|
-
if (h &&
|
|
4840
|
+
if (h && H(h))
|
|
4747
4841
|
return;
|
|
4748
4842
|
if ($e(c, u, this.ranges) && (d.classList.add("selected"), o)) {
|
|
4749
4843
|
c === o.startRow && d.classList.add("top"), c === o.endRow && d.classList.add("bottom");
|
|
@@ -4782,7 +4876,7 @@ class Sn extends _ {
|
|
|
4782
4876
|
};
|
|
4783
4877
|
}
|
|
4784
4878
|
getSelectedCells() {
|
|
4785
|
-
return
|
|
4879
|
+
return ji(this.ranges);
|
|
4786
4880
|
}
|
|
4787
4881
|
isCellSelected(e, t) {
|
|
4788
4882
|
return $e(e, t, this.ranges);
|
|
@@ -4798,11 +4892,11 @@ class Sn extends _ {
|
|
|
4798
4892
|
endCol: t.to.col
|
|
4799
4893
|
})), this.activeRange = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null, this.emit("selection-change", {
|
|
4800
4894
|
mode: this.config.mode,
|
|
4801
|
-
ranges:
|
|
4895
|
+
ranges: nt(this.ranges)
|
|
4802
4896
|
}), this.requestAfterRender();
|
|
4803
4897
|
}
|
|
4804
4898
|
#t() {
|
|
4805
|
-
return
|
|
4899
|
+
return Yi(
|
|
4806
4900
|
this.config.mode,
|
|
4807
4901
|
{
|
|
4808
4902
|
selectedCell: this.selectedCell,
|
|
@@ -4816,20 +4910,20 @@ class Sn extends _ {
|
|
|
4816
4910
|
function ee(s, e) {
|
|
4817
4911
|
return Math.floor(s / e);
|
|
4818
4912
|
}
|
|
4819
|
-
function
|
|
4913
|
+
function Xi(s, e) {
|
|
4820
4914
|
return {
|
|
4821
4915
|
start: s * e,
|
|
4822
4916
|
end: (s + 1) * e
|
|
4823
4917
|
};
|
|
4824
4918
|
}
|
|
4825
|
-
function
|
|
4919
|
+
function Zi(s, e, t) {
|
|
4826
4920
|
const i = ee(s, t), n = ee(e - 1, t), r = [];
|
|
4827
4921
|
for (let o = i; o <= n; o++)
|
|
4828
4922
|
r.push(o);
|
|
4829
4923
|
return r;
|
|
4830
4924
|
}
|
|
4831
4925
|
async function je(s, e, t, i) {
|
|
4832
|
-
const n =
|
|
4926
|
+
const n = Xi(e, t);
|
|
4833
4927
|
return s.getRows({
|
|
4834
4928
|
startRow: n.start,
|
|
4835
4929
|
endRow: n.end,
|
|
@@ -4837,13 +4931,13 @@ async function je(s, e, t, i) {
|
|
|
4837
4931
|
filterModel: i.filterModel
|
|
4838
4932
|
});
|
|
4839
4933
|
}
|
|
4840
|
-
function
|
|
4934
|
+
function Ji(s, e, t) {
|
|
4841
4935
|
const i = ee(s, e), n = t.get(i);
|
|
4842
4936
|
if (!n) return;
|
|
4843
4937
|
const r = s % e;
|
|
4844
4938
|
return n[r];
|
|
4845
4939
|
}
|
|
4846
|
-
const
|
|
4940
|
+
const Qi = 100;
|
|
4847
4941
|
class kn extends _ {
|
|
4848
4942
|
name = "serverSide";
|
|
4849
4943
|
get defaultConfig() {
|
|
@@ -4864,7 +4958,7 @@ class kn extends _ {
|
|
|
4864
4958
|
}
|
|
4865
4959
|
loadRequiredBlocks() {
|
|
4866
4960
|
if (!this.dataSource) return;
|
|
4867
|
-
const e = this.grid, t = this.config.cacheBlockSize ?? 100, i = { startRow: e._virtualization.start, endRow: e._virtualization.end }, n =
|
|
4961
|
+
const e = this.grid, t = this.config.cacheBlockSize ?? 100, i = { startRow: e._virtualization.start, endRow: e._virtualization.end }, n = Zi(i.startRow, i.endRow, t);
|
|
4868
4962
|
for (const r of n)
|
|
4869
4963
|
if (!(this.loadedBlocks.has(r) || this.loadingBlocks.has(r))) {
|
|
4870
4964
|
if (this.loadingBlocks.size >= (this.config.maxConcurrentRequests ?? 2))
|
|
@@ -4880,7 +4974,7 @@ class kn extends _ {
|
|
|
4880
4974
|
if (!this.dataSource) return [...e];
|
|
4881
4975
|
const t = [];
|
|
4882
4976
|
for (let i = 0; i < this.totalRowCount; i++) {
|
|
4883
|
-
const n =
|
|
4977
|
+
const n = Ji(i, this.config.cacheBlockSize ?? 100, this.loadedBlocks);
|
|
4884
4978
|
t.push(n ?? { __loading: !0, __index: i });
|
|
4885
4979
|
}
|
|
4886
4980
|
return t;
|
|
@@ -4888,7 +4982,7 @@ class kn extends _ {
|
|
|
4888
4982
|
onScroll(e) {
|
|
4889
4983
|
this.dataSource && (this.loadRequiredBlocks(), this.scrollDebounceTimer && clearTimeout(this.scrollDebounceTimer), this.scrollDebounceTimer = setTimeout(() => {
|
|
4890
4984
|
this.loadRequiredBlocks();
|
|
4891
|
-
},
|
|
4985
|
+
}, Qi));
|
|
4892
4986
|
}
|
|
4893
4987
|
setDataSource(e) {
|
|
4894
4988
|
this.dataSource = e, this.loadedBlocks.clear(), this.loadingBlocks.clear();
|
|
@@ -4914,7 +5008,7 @@ class kn extends _ {
|
|
|
4914
5008
|
return this.loadedBlocks.size;
|
|
4915
5009
|
}
|
|
4916
5010
|
}
|
|
4917
|
-
function
|
|
5011
|
+
function rt(s, e, t) {
|
|
4918
5012
|
return s.id !== void 0 ? String(s.id) : t ? `${t}-${e}` : String(e);
|
|
4919
5013
|
}
|
|
4920
5014
|
function ue(s, e) {
|
|
@@ -4924,7 +5018,7 @@ function ue(s, e) {
|
|
|
4924
5018
|
function fe(s, e, t = null, i = 0) {
|
|
4925
5019
|
const n = e.childrenField ?? "children", r = /* @__PURE__ */ new Set();
|
|
4926
5020
|
for (let o = 0; o < s.length; o++) {
|
|
4927
|
-
const a = s[o], l =
|
|
5021
|
+
const a = s[o], l = rt(a, o, t), d = a[n];
|
|
4928
5022
|
if (Array.isArray(d) && d.length > 0) {
|
|
4929
5023
|
r.add(l);
|
|
4930
5024
|
const c = fe(d, e, l, i + 1);
|
|
@@ -4933,26 +5027,26 @@ function fe(s, e, t = null, i = 0) {
|
|
|
4933
5027
|
}
|
|
4934
5028
|
return r;
|
|
4935
5029
|
}
|
|
4936
|
-
function
|
|
5030
|
+
function en() {
|
|
4937
5031
|
return /* @__PURE__ */ new Set();
|
|
4938
5032
|
}
|
|
4939
|
-
function
|
|
5033
|
+
function ot(s, e, t, i = null, n = 0) {
|
|
4940
5034
|
const r = t.childrenField ?? "children";
|
|
4941
5035
|
for (let o = 0; o < s.length; o++) {
|
|
4942
|
-
const a = s[o], l =
|
|
5036
|
+
const a = s[o], l = rt(a, o, i);
|
|
4943
5037
|
if (l === e)
|
|
4944
5038
|
return [l];
|
|
4945
5039
|
const d = a[r];
|
|
4946
5040
|
if (Array.isArray(d) && d.length > 0) {
|
|
4947
|
-
const c =
|
|
5041
|
+
const c = ot(d, e, t, l, n + 1);
|
|
4948
5042
|
if (c)
|
|
4949
5043
|
return [l, ...c];
|
|
4950
5044
|
}
|
|
4951
5045
|
}
|
|
4952
5046
|
return null;
|
|
4953
5047
|
}
|
|
4954
|
-
function
|
|
4955
|
-
const n =
|
|
5048
|
+
function tn(s, e, t, i) {
|
|
5049
|
+
const n = ot(s, e, t);
|
|
4956
5050
|
if (!n) return i;
|
|
4957
5051
|
const r = new Set(i);
|
|
4958
5052
|
for (let o = 0; o < n.length - 1; o++)
|
|
@@ -4969,7 +5063,7 @@ function Ue(s, e = "children") {
|
|
|
4969
5063
|
}
|
|
4970
5064
|
return !1;
|
|
4971
5065
|
}
|
|
4972
|
-
function
|
|
5066
|
+
function nn(s) {
|
|
4973
5067
|
if (!Array.isArray(s) || s.length === 0) return null;
|
|
4974
5068
|
const e = ["children", "items", "nodes", "subRows", "nested"];
|
|
4975
5069
|
for (const t of s)
|
|
@@ -4981,10 +5075,10 @@ function tn(s) {
|
|
|
4981
5075
|
}
|
|
4982
5076
|
return null;
|
|
4983
5077
|
}
|
|
4984
|
-
const
|
|
5078
|
+
const rn = "@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}}}";
|
|
4985
5079
|
class An extends _ {
|
|
4986
5080
|
name = "tree";
|
|
4987
|
-
styles =
|
|
5081
|
+
styles = rn;
|
|
4988
5082
|
get defaultConfig() {
|
|
4989
5083
|
return {
|
|
4990
5084
|
childrenField: "children",
|
|
@@ -5010,7 +5104,7 @@ class An extends _ {
|
|
|
5010
5104
|
}
|
|
5011
5105
|
detect(e) {
|
|
5012
5106
|
if (!this.config.autoDetect) return !1;
|
|
5013
|
-
const t = e, i = this.config.childrenField ??
|
|
5107
|
+
const t = e, i = this.config.childrenField ?? nn(t) ?? "children";
|
|
5014
5108
|
return Ue(t, i);
|
|
5015
5109
|
}
|
|
5016
5110
|
processRows(e) {
|
|
@@ -5146,7 +5240,7 @@ class An extends _ {
|
|
|
5146
5240
|
this.expandedKeys = fe(this.rows, this.config), this.requestRender();
|
|
5147
5241
|
}
|
|
5148
5242
|
collapseAll() {
|
|
5149
|
-
this.expandedKeys =
|
|
5243
|
+
this.expandedKeys = en(), this.requestRender();
|
|
5150
5244
|
}
|
|
5151
5245
|
isExpanded(e) {
|
|
5152
5246
|
return this.expandedKeys.has(e);
|
|
@@ -5161,10 +5255,10 @@ class An extends _ {
|
|
|
5161
5255
|
return this.rowKeyMap.get(e)?.data;
|
|
5162
5256
|
}
|
|
5163
5257
|
expandToKey(e) {
|
|
5164
|
-
this.expandedKeys =
|
|
5258
|
+
this.expandedKeys = tn(this.rows, e, this.config, this.expandedKeys), this.requestRender();
|
|
5165
5259
|
}
|
|
5166
5260
|
}
|
|
5167
|
-
function
|
|
5261
|
+
function on(s, e, t) {
|
|
5168
5262
|
const i = [...s.undoStack, e];
|
|
5169
5263
|
for (; i.length > t; )
|
|
5170
5264
|
i.shift();
|
|
@@ -5197,16 +5291,16 @@ function Xe(s) {
|
|
|
5197
5291
|
action: t
|
|
5198
5292
|
} : { newState: s, action: null };
|
|
5199
5293
|
}
|
|
5200
|
-
function
|
|
5294
|
+
function sn(s) {
|
|
5201
5295
|
return s.undoStack.length > 0;
|
|
5202
5296
|
}
|
|
5203
|
-
function
|
|
5297
|
+
function an(s) {
|
|
5204
5298
|
return s.redoStack.length > 0;
|
|
5205
5299
|
}
|
|
5206
|
-
function
|
|
5300
|
+
function ln() {
|
|
5207
5301
|
return { undoStack: [], redoStack: [] };
|
|
5208
5302
|
}
|
|
5209
|
-
function
|
|
5303
|
+
function dn(s, e, t, i) {
|
|
5210
5304
|
return {
|
|
5211
5305
|
type: "cell-edit",
|
|
5212
5306
|
rowIndex: s,
|
|
@@ -5258,7 +5352,7 @@ class _n extends _ {
|
|
|
5258
5352
|
return !1;
|
|
5259
5353
|
}
|
|
5260
5354
|
recordEdit(e, t, i, n) {
|
|
5261
|
-
const r =
|
|
5355
|
+
const r = dn(e, t, i, n), o = on(
|
|
5262
5356
|
{ undoStack: this.undoStack, redoStack: this.redoStack },
|
|
5263
5357
|
r,
|
|
5264
5358
|
this.config.maxHistorySize ?? 100
|
|
@@ -5282,13 +5376,13 @@ class _n extends _ {
|
|
|
5282
5376
|
return e.action;
|
|
5283
5377
|
}
|
|
5284
5378
|
canUndo() {
|
|
5285
|
-
return
|
|
5379
|
+
return sn({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
5286
5380
|
}
|
|
5287
5381
|
canRedo() {
|
|
5288
|
-
return
|
|
5382
|
+
return an({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
5289
5383
|
}
|
|
5290
5384
|
clearHistory() {
|
|
5291
|
-
const e =
|
|
5385
|
+
const e = ln();
|
|
5292
5386
|
this.undoStack = e.undoStack, this.redoStack = e.redoStack;
|
|
5293
5387
|
}
|
|
5294
5388
|
getUndoStack() {
|
|
@@ -5298,7 +5392,7 @@ class _n extends _ {
|
|
|
5298
5392
|
return [...this.redoStack];
|
|
5299
5393
|
}
|
|
5300
5394
|
}
|
|
5301
|
-
const
|
|
5395
|
+
const cn = '@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))}.tbw-visibility-row input[type=checkbox]{cursor:pointer}.tbw-visibility-row.locked span{color:var(--tbw-color-fg-muted)}.tbw-visibility-handle{cursor:grab;color:var(--tbw-color-fg-muted);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)}.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-visibility-indicator, var(--tbw-color-accent))}.tbw-visibility-row.drop-after:after{content:"";position:absolute;left:0;right:0;bottom:0;height:2px;background:var(--tbw-visibility-indicator, var(--tbw-color-accent))}.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));border-radius:var(--tbw-border-radius, .25rem);background:var(--tbw-visibility-btn-bg, var(--tbw-color-header-bg));color:var(--tbw-color-fg);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))}}';
|
|
5302
5396
|
function Ze(s) {
|
|
5303
5397
|
const e = s.meta ?? {};
|
|
5304
5398
|
return e.lockPosition !== !0 && e.suppressMovable !== !0;
|
|
@@ -5309,7 +5403,7 @@ class B extends _ {
|
|
|
5309
5403
|
];
|
|
5310
5404
|
name = "visibility";
|
|
5311
5405
|
static PANEL_ID = "columns";
|
|
5312
|
-
styles =
|
|
5406
|
+
styles = cn;
|
|
5313
5407
|
get defaultConfig() {
|
|
5314
5408
|
return {
|
|
5315
5409
|
allowHideAll: !1
|
|
@@ -5448,11 +5542,11 @@ class B extends _ {
|
|
|
5448
5542
|
}
|
|
5449
5543
|
export {
|
|
5450
5544
|
_ as BaseGridPlugin,
|
|
5451
|
-
|
|
5452
|
-
|
|
5453
|
-
|
|
5545
|
+
hn as ClipboardPlugin,
|
|
5546
|
+
gn as ColumnVirtualizationPlugin,
|
|
5547
|
+
et as ContextMenuPlugin,
|
|
5454
5548
|
Fn as DEFAULT_ANIMATION_CONFIG,
|
|
5455
|
-
|
|
5549
|
+
at as DEFAULT_GRID_ICONS,
|
|
5456
5550
|
In as DGEvents,
|
|
5457
5551
|
Pn as DataGridElement,
|
|
5458
5552
|
fn as EditingPlugin,
|
|
@@ -5462,24 +5556,24 @@ export {
|
|
|
5462
5556
|
Mn as GridCSSVars,
|
|
5463
5557
|
Nn as GridClasses,
|
|
5464
5558
|
qn as GridDataAttrs,
|
|
5465
|
-
|
|
5466
|
-
|
|
5559
|
+
Hn as GridElement,
|
|
5560
|
+
zn as GridSelectors,
|
|
5467
5561
|
mn as GroupingColumnsPlugin,
|
|
5468
5562
|
wn as GroupingRowsPlugin,
|
|
5469
|
-
|
|
5563
|
+
tt as MasterDetailPlugin,
|
|
5470
5564
|
bn as MultiSortPlugin,
|
|
5471
5565
|
Je as PLUGIN_QUERIES,
|
|
5472
5566
|
vn as PinnedColumnsPlugin,
|
|
5473
5567
|
yn as PinnedRowsPlugin,
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
|
|
5568
|
+
G as PivotPlugin,
|
|
5569
|
+
Kn as PluginEvents,
|
|
5570
|
+
On as PluginManager,
|
|
5477
5571
|
xn as PrintPlugin,
|
|
5478
|
-
|
|
5479
|
-
|
|
5572
|
+
Bi as ROW_DRAG_HANDLE_FIELD,
|
|
5573
|
+
Gn as RenderPhase,
|
|
5480
5574
|
Cn as ReorderPlugin,
|
|
5481
|
-
|
|
5482
|
-
|
|
5575
|
+
En as ResponsivePlugin,
|
|
5576
|
+
Rn as RowReorderPlugin,
|
|
5483
5577
|
Sn as SelectionPlugin,
|
|
5484
5578
|
kn as ServerSidePlugin,
|
|
5485
5579
|
An as TreePlugin,
|
|
@@ -5488,9 +5582,9 @@ export {
|
|
|
5488
5582
|
Bn as builtInSort,
|
|
5489
5583
|
Vn as createGrid,
|
|
5490
5584
|
Wn as defaultComparator,
|
|
5491
|
-
|
|
5492
|
-
|
|
5493
|
-
|
|
5585
|
+
Tt as defaultEditorFor,
|
|
5586
|
+
wt as defaultPasteHandler,
|
|
5587
|
+
Ni as printGridIsolated,
|
|
5494
5588
|
$n as queryGrid
|
|
5495
5589
|
};
|
|
5496
5590
|
//# sourceMappingURL=all.js.map
|