@toolbox-web/grid 1.10.1 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/all.js +426 -377
- package/all.js.map +1 -1
- package/index.js +575 -532
- package/index.js.map +1 -1
- package/lib/core/grid.d.ts.map +1 -1
- package/lib/core/internal/columns.d.ts.map +1 -1
- package/lib/core/internal/config-manager.d.ts.map +1 -1
- package/lib/core/internal/dom-builder.d.ts.map +1 -1
- package/lib/core/internal/event-delegation.d.ts.map +1 -1
- package/lib/core/internal/header.d.ts.map +1 -1
- package/lib/core/internal/keyboard.d.ts +2 -0
- package/lib/core/internal/keyboard.d.ts.map +1 -1
- package/lib/core/internal/loading.d.ts +79 -0
- package/lib/core/internal/loading.d.ts.map +1 -0
- package/lib/core/internal/render-scheduler.d.ts.map +1 -1
- package/lib/core/internal/rows.d.ts.map +1 -1
- package/lib/core/internal/sanitize.d.ts.map +1 -1
- package/lib/core/internal/shell.d.ts.map +1 -1
- package/lib/core/internal/style-injector.d.ts +43 -0
- package/lib/core/internal/style-injector.d.ts.map +1 -0
- package/lib/core/internal/touch-scroll.d.ts.map +1 -1
- package/lib/core/internal/validate-config.d.ts.map +1 -1
- package/lib/core/plugin/plugin-manager.d.ts.map +1 -1
- package/lib/core/plugin/types.d.ts.map +1 -1
- package/lib/core/styles/index.d.ts +32 -0
- package/lib/core/styles/index.d.ts.map +1 -0
- package/lib/core/types.d.ts +44 -1
- package/lib/core/types.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
- package/lib/plugins/editing/index.js +322 -213
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/editing/types.d.ts +44 -2
- package/lib/plugins/editing/types.d.ts.map +1 -1
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/print/index.js.map +1 -1
- package/lib/plugins/reorder/index.js +1 -1
- package/lib/plugins/reorder/index.js.map +1 -1
- package/lib/plugins/responsive/index.js +35 -35
- package/lib/plugins/responsive/index.js.map +1 -1
- package/lib/plugins/row-reorder/index.js +1 -1
- package/lib/plugins/row-reorder/index.js.map +1 -1
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/undo-redo/index.js.map +1 -1
- package/lib/plugins/visibility/index.js.map +1 -1
- package/package.json +1 -1
- package/umd/grid.all.umd.js +61 -33
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +40 -12
- package/umd/grid.umd.js.map +1 -1
- package/umd/plugins/editing.umd.js +1 -1
- package/umd/plugins/editing.umd.js.map +1 -1
package/all.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseGridPlugin as
|
|
1
|
+
import { BaseGridPlugin as _, DEFAULT_GRID_ICONS as ht, e as P, runAggregator as te, a as Je, s as et, g as ue, r as ft, getAggregator as ye, getValueAggregator as gt, c as xe, b as pt } from "./index.js";
|
|
2
2
|
import { DEFAULT_ANIMATION_CONFIG as Dn, DGEvents as Mn, DataGridElement as Nn, FitModeEnum as qn, GridCSSVars as Hn, GridClasses as Kn, GridDataAttrs as zn, DataGridElement as On, GridSelectors as Gn, PLUGIN_QUERIES as Bn, PluginEvents as Vn, PluginManager as Wn, RenderPhase as $n, builtInSort as jn, createGrid as Un, defaultComparator as Yn, queryGrid as Xn } from "./index.js";
|
|
3
3
|
const tt = "__tbw_expander", mt = 32;
|
|
4
4
|
function pe(a) {
|
|
@@ -27,7 +27,7 @@ function bt(a) {
|
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
async function
|
|
30
|
+
async function ie(a) {
|
|
31
31
|
try {
|
|
32
32
|
return await navigator.clipboard.writeText(a), !0;
|
|
33
33
|
} catch {
|
|
@@ -65,23 +65,23 @@ function yt(a, e) {
|
|
|
65
65
|
});
|
|
66
66
|
const d = [...r], c = i.bounds ? i.bounds.endRow : 1 / 0;
|
|
67
67
|
t.forEach((u, h) => {
|
|
68
|
-
const
|
|
69
|
-
if (!(
|
|
68
|
+
const f = i.row + h;
|
|
69
|
+
if (!(f > c)) {
|
|
70
70
|
if (i.bounds) {
|
|
71
|
-
if (
|
|
71
|
+
if (f >= d.length)
|
|
72
72
|
return;
|
|
73
|
-
} else for (;
|
|
74
|
-
const
|
|
75
|
-
s.forEach((p) =>
|
|
73
|
+
} else for (; f >= d.length; ) {
|
|
74
|
+
const g = {};
|
|
75
|
+
s.forEach((p) => g[p] = ""), d.push(g);
|
|
76
76
|
}
|
|
77
|
-
d[
|
|
77
|
+
d[f] = { ...d[f] }, u.forEach((g, p) => {
|
|
78
78
|
const w = n[p];
|
|
79
|
-
w && l.get(w) && (d[
|
|
79
|
+
w && l.get(w) && (d[f][w] = g);
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
82
|
}), e.rows = d;
|
|
83
83
|
}
|
|
84
|
-
class pn extends
|
|
84
|
+
class pn extends _ {
|
|
85
85
|
static dependencies = [
|
|
86
86
|
{ name: "selection", required: !1, reason: "Enables copy/paste of selected cells instead of entire grid" }
|
|
87
87
|
];
|
|
@@ -128,12 +128,12 @@ class pn extends A {
|
|
|
128
128
|
} else if (!t)
|
|
129
129
|
r = { startRow: 0, startCol: 0, endRow: n, endCol: i };
|
|
130
130
|
else {
|
|
131
|
-
const s = this.#
|
|
131
|
+
const s = this.#s(e);
|
|
132
132
|
if (!s) return;
|
|
133
133
|
r = { startRow: s.row, startCol: s.col, endRow: s.row, endCol: s.col };
|
|
134
134
|
}
|
|
135
135
|
const o = this.#i(r);
|
|
136
|
-
|
|
136
|
+
ie(o.text).then(() => {
|
|
137
137
|
this.lastCopied = { text: o.text, timestamp: Date.now() }, this.emit("copy", {
|
|
138
138
|
text: o.text,
|
|
139
139
|
rowCount: o.rowCount,
|
|
@@ -145,15 +145,15 @@ class pn extends A {
|
|
|
145
145
|
const t = e.clipboardData?.getData("text/plain");
|
|
146
146
|
if (!t) return;
|
|
147
147
|
e.preventDefault();
|
|
148
|
-
const i = Ce(t, this.config), n = this.#n(), r = n?.ranges?.[0], o = r?.from.row ?? 0, s = r?.from.col ?? 0, d = r && (n?.mode === "range" || n?.mode === "row") && (r.from.row !== r.to.row || r.from.col !== r.to.col) ? { endRow: r.to.row, endCol: r.to.col } : null, c = d?.endCol ?? this.columns.length - 1, u = this.columns[s], h = u ? { row: o, col: s, field: u.field, bounds: d } : null,
|
|
149
|
-
for (let w = 0; w <
|
|
148
|
+
const i = Ce(t, this.config), n = this.#n(), r = n?.ranges?.[0], o = r?.from.row ?? 0, s = r?.from.col ?? 0, d = r && (n?.mode === "range" || n?.mode === "row") && (r.from.row !== r.to.row || r.from.col !== r.to.col) ? { endRow: r.to.row, endCol: r.to.col } : null, c = d?.endCol ?? this.columns.length - 1, u = this.columns[s], h = u ? { row: o, col: s, field: u.field, bounds: d } : null, f = [], g = i[0]?.length ?? 0;
|
|
149
|
+
for (let w = 0; w < g && s + w <= c; w++) {
|
|
150
150
|
const b = this.columns[s + w];
|
|
151
|
-
b && !b.hidden &&
|
|
151
|
+
b && !b.hidden && f.push(b.field);
|
|
152
152
|
}
|
|
153
|
-
const p = { rows: i, text: t, target: h, fields:
|
|
154
|
-
this.emit("paste", p), this.#
|
|
153
|
+
const p = { rows: i, text: t, target: h, fields: f };
|
|
154
|
+
this.emit("paste", p), this.#a(p);
|
|
155
155
|
}
|
|
156
|
-
#
|
|
156
|
+
#a(e) {
|
|
157
157
|
if (!this.grid) return;
|
|
158
158
|
const { pasteHandler: t } = this.config;
|
|
159
159
|
if (t === null) return;
|
|
@@ -164,15 +164,15 @@ class pn extends A {
|
|
|
164
164
|
}
|
|
165
165
|
#i(e) {
|
|
166
166
|
const { startRow: t, startCol: i, endRow: n, endCol: r } = e, o = Math.min(t, n), s = Math.max(t, n), l = Math.min(i, r), d = Math.max(i, r), c = this.config.delimiter ?? " ", u = this.config.newline ?? `
|
|
167
|
-
`, h = [],
|
|
167
|
+
`, h = [], f = this.columns.slice(l, d + 1).filter((g) => !q(g));
|
|
168
168
|
if (this.config.includeHeaders) {
|
|
169
|
-
const
|
|
170
|
-
h.push(
|
|
169
|
+
const g = f.map((p) => p.header || p.field);
|
|
170
|
+
h.push(g.join(c));
|
|
171
171
|
}
|
|
172
|
-
for (let
|
|
173
|
-
const p = this.rows[
|
|
172
|
+
for (let g = o; g <= s; g++) {
|
|
173
|
+
const p = this.rows[g];
|
|
174
174
|
if (!p) continue;
|
|
175
|
-
const w =
|
|
175
|
+
const w = f.map((b) => {
|
|
176
176
|
const v = p[b.field];
|
|
177
177
|
return v == null ? "" : v instanceof Date ? v.toISOString() : String(v);
|
|
178
178
|
});
|
|
@@ -184,7 +184,7 @@ class pn extends A {
|
|
|
184
184
|
columnCount: d - l + 1
|
|
185
185
|
};
|
|
186
186
|
}
|
|
187
|
-
#
|
|
187
|
+
#s(e) {
|
|
188
188
|
const t = e.closest("[data-field-cache]");
|
|
189
189
|
if (!t) return null;
|
|
190
190
|
const i = t.dataset.fieldCache, n = t.dataset.row;
|
|
@@ -207,7 +207,7 @@ class pn extends A {
|
|
|
207
207
|
};
|
|
208
208
|
}
|
|
209
209
|
const n = this.#i(i);
|
|
210
|
-
return await
|
|
210
|
+
return await ie(n.text), this.lastCopied = { text: n.text, timestamp: Date.now() }, n.text;
|
|
211
211
|
}
|
|
212
212
|
async copyRows(e) {
|
|
213
213
|
if (e.length === 0) return "";
|
|
@@ -217,7 +217,7 @@ class pn extends A {
|
|
|
217
217
|
endRow: t[t.length - 1],
|
|
218
218
|
endCol: i
|
|
219
219
|
}, r = this.#i(n);
|
|
220
|
-
return await
|
|
220
|
+
return await ie(r.text), this.lastCopied = { text: r.text, timestamp: Date.now() }, r.text;
|
|
221
221
|
}
|
|
222
222
|
async paste() {
|
|
223
223
|
const e = await vt();
|
|
@@ -281,7 +281,7 @@ function Ct(a, e, t) {
|
|
|
281
281
|
function Et(a, e, t) {
|
|
282
282
|
return t ? a > e : !1;
|
|
283
283
|
}
|
|
284
|
-
class mn extends
|
|
284
|
+
class mn extends _ {
|
|
285
285
|
name = "columnVirtualization";
|
|
286
286
|
get defaultConfig() {
|
|
287
287
|
return {
|
|
@@ -369,14 +369,14 @@ class mn extends A {
|
|
|
369
369
|
return this.totalWidth;
|
|
370
370
|
}
|
|
371
371
|
}
|
|
372
|
-
const
|
|
372
|
+
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:var(--tbw-context-menu-shadow, 0 2px 10px 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}}";
|
|
373
373
|
function he(a, e) {
|
|
374
374
|
return (typeof a == "function" ? a(e) : a).filter((i) => !(i.hidden === !0 || typeof i.hidden == "function" && i.hidden(e)));
|
|
375
375
|
}
|
|
376
376
|
function Rt(a, e) {
|
|
377
377
|
return a.disabled === !0 ? !0 : typeof a.disabled == "function" ? a.disabled(e) : !1;
|
|
378
378
|
}
|
|
379
|
-
function
|
|
379
|
+
function fe(a, e, t, i = ht.submenuArrow) {
|
|
380
380
|
const n = document.createElement("div");
|
|
381
381
|
n.className = "tbw-context-menu", n.setAttribute("role", "menu");
|
|
382
382
|
for (const r of a) {
|
|
@@ -401,7 +401,7 @@ function ge(a, e, t, i = ht.submenuArrow) {
|
|
|
401
401
|
const d = document.createElement("span");
|
|
402
402
|
d.className = "tbw-context-menu-arrow", typeof i == "string" ? d.innerHTML = i : i instanceof HTMLElement && d.appendChild(i.cloneNode(!0)), o.appendChild(d), o.addEventListener("mouseenter", () => {
|
|
403
403
|
if (o.querySelector(".tbw-context-menu") || !r.subMenu) return;
|
|
404
|
-
const u = he(r.subMenu, e), h =
|
|
404
|
+
const u = he(r.subMenu, e), h = fe(u, e, t, i);
|
|
405
405
|
h.classList.add("tbw-context-submenu"), h.style.position = "absolute", h.style.left = "100%", h.style.top = "0", o.style.position = "relative", o.appendChild(h);
|
|
406
406
|
}), o.addEventListener("mouseleave", () => {
|
|
407
407
|
const c = o.querySelector(".tbw-context-menu");
|
|
@@ -420,8 +420,8 @@ function Ae(a, e, t) {
|
|
|
420
420
|
let o = e, s = t;
|
|
421
421
|
e + i.width > n && (o = e - i.width), t + i.height > r && (s = t - i.height), o = Math.max(0, o), s = Math.max(0, s), a.style.left = `${o}px`, a.style.top = `${s}px`, a.style.visibility = "visible";
|
|
422
422
|
}
|
|
423
|
-
let z = null, O = null, M = null,
|
|
424
|
-
const
|
|
423
|
+
let z = null, O = null, M = null, re = 0;
|
|
424
|
+
const oe = [
|
|
425
425
|
{
|
|
426
426
|
id: "copy",
|
|
427
427
|
name: "Copy",
|
|
@@ -439,11 +439,11 @@ const re = [
|
|
|
439
439
|
}
|
|
440
440
|
}
|
|
441
441
|
];
|
|
442
|
-
class it extends
|
|
442
|
+
class it extends _ {
|
|
443
443
|
name = "contextMenu";
|
|
444
444
|
get defaultConfig() {
|
|
445
445
|
return {
|
|
446
|
-
items:
|
|
446
|
+
items: oe
|
|
447
447
|
};
|
|
448
448
|
}
|
|
449
449
|
isOpen = !1;
|
|
@@ -451,7 +451,7 @@ class it extends A {
|
|
|
451
451
|
params = null;
|
|
452
452
|
menuElement = null;
|
|
453
453
|
attach(e) {
|
|
454
|
-
super.attach(e), this.installGlobalHandlers(),
|
|
454
|
+
super.attach(e), this.installGlobalHandlers(), re++;
|
|
455
455
|
}
|
|
456
456
|
detach() {
|
|
457
457
|
this.menuElement && (this.menuElement.remove(), this.menuElement = null), this.isOpen = !1, this.params = null, this.uninstallGlobalHandlers();
|
|
@@ -506,14 +506,14 @@ class it extends A {
|
|
|
506
506
|
}
|
|
507
507
|
}
|
|
508
508
|
installGlobalHandlers() {
|
|
509
|
-
!M && typeof document < "u" && typeof
|
|
509
|
+
!M && typeof document < "u" && typeof ne == "string" && ne && (M = document.createElement("style"), M.id = "tbw-context-menu-styles", M.textContent = ne, document.head.appendChild(M)), z || (z = () => {
|
|
510
510
|
document.querySelectorAll(".tbw-context-menu").forEach((t) => t.remove());
|
|
511
511
|
}, document.addEventListener("click", z)), O || (O = (e) => {
|
|
512
512
|
e.key === "Escape" && document.querySelectorAll(".tbw-context-menu").forEach((i) => i.remove());
|
|
513
513
|
}, document.addEventListener("keydown", O));
|
|
514
514
|
}
|
|
515
515
|
uninstallGlobalHandlers() {
|
|
516
|
-
|
|
516
|
+
re--, !(re > 0) && (z && (document.removeEventListener("click", z), z = null), O && (document.removeEventListener("keydown", O), O = null), M && (M.remove(), M = null));
|
|
517
517
|
}
|
|
518
518
|
afterRender() {
|
|
519
519
|
const e = this.gridElement;
|
|
@@ -525,14 +525,14 @@ class it extends A {
|
|
|
525
525
|
const r = n.target, o = r.closest("[data-row][data-col]"), s = r.closest(".header-cell");
|
|
526
526
|
let l;
|
|
527
527
|
if (o) {
|
|
528
|
-
const c = parseInt(o.getAttribute("data-row") ?? "-1", 10), u = parseInt(o.getAttribute("data-col") ?? "-1", 10), h = this.columns[u],
|
|
528
|
+
const c = parseInt(o.getAttribute("data-row") ?? "-1", 10), u = parseInt(o.getAttribute("data-col") ?? "-1", 10), h = this.columns[u], f = this.rows[c];
|
|
529
529
|
l = {
|
|
530
|
-
row:
|
|
530
|
+
row: f,
|
|
531
531
|
rowIndex: c,
|
|
532
532
|
column: h,
|
|
533
533
|
columnIndex: u,
|
|
534
534
|
field: h?.field ?? "",
|
|
535
|
-
value:
|
|
535
|
+
value: f?.[h?.field] ?? null,
|
|
536
536
|
isHeader: !1,
|
|
537
537
|
event: n
|
|
538
538
|
};
|
|
@@ -551,8 +551,8 @@ class it extends A {
|
|
|
551
551
|
} else
|
|
552
552
|
return;
|
|
553
553
|
this.params = l, this.position = { x: n.clientX, y: n.clientY };
|
|
554
|
-
const d = he(this.config.items ??
|
|
555
|
-
d.length && (this.menuElement && this.menuElement.remove(), this.menuElement =
|
|
554
|
+
const d = he(this.config.items ?? oe, l);
|
|
555
|
+
d.length && (this.menuElement && this.menuElement.remove(), this.menuElement = fe(
|
|
556
556
|
d,
|
|
557
557
|
l,
|
|
558
558
|
(c) => {
|
|
@@ -572,8 +572,8 @@ class it extends A {
|
|
|
572
572
|
value: i.value ?? null,
|
|
573
573
|
isHeader: i.isHeader ?? !1,
|
|
574
574
|
event: i.event ?? new MouseEvent("contextmenu")
|
|
575
|
-
}, r = he(this.config.items ??
|
|
576
|
-
this.menuElement && this.menuElement.remove(), this.menuElement =
|
|
575
|
+
}, r = he(this.config.items ?? oe, n);
|
|
576
|
+
this.menuElement && this.menuElement.remove(), this.menuElement = fe(
|
|
577
577
|
r,
|
|
578
578
|
n,
|
|
579
579
|
(o) => {
|
|
@@ -672,7 +672,7 @@ function Ft(a) {
|
|
|
672
672
|
return It(a);
|
|
673
673
|
}
|
|
674
674
|
}
|
|
675
|
-
const
|
|
675
|
+
const Z = 'input,select,textarea,[contenteditable="true"],[contenteditable=""],[tabindex]:not([tabindex="-1"])';
|
|
676
676
|
function Pt(a, e) {
|
|
677
677
|
if (e.editor) return e.editor;
|
|
678
678
|
if (e.__editorTemplate) return "template";
|
|
@@ -698,7 +698,7 @@ function Mt(a) {
|
|
|
698
698
|
a.__editingCellCount = 0, a.removeAttribute("data-has-editing");
|
|
699
699
|
}
|
|
700
700
|
function U(a, e, t) {
|
|
701
|
-
return a instanceof HTMLInputElement ? a.type === "checkbox" ? a.checked : a.type === "number" ? a.value === "" ? null : Number(a.value) : a.type === "date" ? typeof t == "string" ? a.value : a.valueAsDate : typeof t == "number" ? a.value === "" ? null : Number(a.value) : a.value : e?.type === "number" && a.value !== "" || typeof t == "number" && a.value !== "" ? Number(a.value) : a.value;
|
|
701
|
+
return a instanceof HTMLInputElement ? a.type === "checkbox" ? a.checked : a.type === "number" ? a.value === "" ? null : Number(a.value) : a.type === "date" ? typeof t == "string" ? a.value : a.valueAsDate : typeof t == "number" ? a.value === "" ? null : Number(a.value) : t == null && a.value === "" ? t : a.value : e?.type === "number" && a.value !== "" || typeof t == "number" && a.value !== "" ? Number(a.value) : t == null && a.value === "" ? t : a.value;
|
|
702
702
|
}
|
|
703
703
|
function _e(a) {
|
|
704
704
|
}
|
|
@@ -708,7 +708,7 @@ function Nt(a, e, t, i) {
|
|
|
708
708
|
t(U(n, e, i));
|
|
709
709
|
}), n instanceof HTMLInputElement && n.type === "checkbox" ? n.addEventListener("change", () => t(n.checked)) : n instanceof HTMLSelectElement && n.addEventListener("change", () => t(U(n, e, i))));
|
|
710
710
|
}
|
|
711
|
-
class wn extends
|
|
711
|
+
class wn extends _ {
|
|
712
712
|
static manifest = {
|
|
713
713
|
ownedProperties: [
|
|
714
714
|
{
|
|
@@ -750,10 +750,10 @@ class wn extends A {
|
|
|
750
750
|
}
|
|
751
751
|
#e = -1;
|
|
752
752
|
#t = -1;
|
|
753
|
-
#
|
|
753
|
+
#a = /* @__PURE__ */ new Map();
|
|
754
754
|
#n = /* @__PURE__ */ new Set();
|
|
755
755
|
#i = /* @__PURE__ */ new Set();
|
|
756
|
-
#
|
|
756
|
+
#s = !1;
|
|
757
757
|
#d = -1;
|
|
758
758
|
#r = /* @__PURE__ */ new Map();
|
|
759
759
|
attach(e) {
|
|
@@ -770,7 +770,11 @@ class wn extends A {
|
|
|
770
770
|
}, document.addEventListener(
|
|
771
771
|
"keydown",
|
|
772
772
|
(n) => {
|
|
773
|
-
n.key === "Escape" && this.#e !== -1
|
|
773
|
+
if (n.key === "Escape" && this.#e !== -1) {
|
|
774
|
+
if (this.config.onBeforeEditClose && this.config.onBeforeEditClose(n) === !1)
|
|
775
|
+
return;
|
|
776
|
+
this.#o(this.#e, !0);
|
|
777
|
+
}
|
|
774
778
|
},
|
|
775
779
|
{ capture: !0, signal: t }
|
|
776
780
|
), document.addEventListener(
|
|
@@ -778,15 +782,15 @@ class wn extends A {
|
|
|
778
782
|
(n) => {
|
|
779
783
|
if (this.#e === -1) return;
|
|
780
784
|
const r = i.findRenderedRowElement?.(this.#e);
|
|
781
|
-
!r || (n.composedPath && n.composedPath() || []).includes(r) || queueMicrotask(() => {
|
|
782
|
-
this.#e !== -1 && this.#
|
|
785
|
+
!r || (n.composedPath && n.composedPath() || []).includes(r) || this.config.onBeforeEditClose && this.config.onBeforeEditClose(n) === !1 || queueMicrotask(() => {
|
|
786
|
+
this.#e !== -1 && this.#o(this.#e, !1);
|
|
783
787
|
});
|
|
784
788
|
},
|
|
785
789
|
{ signal: t }
|
|
786
790
|
);
|
|
787
791
|
}
|
|
788
792
|
detach() {
|
|
789
|
-
this.#e = -1, this.#t = -1, this.#
|
|
793
|
+
this.#e = -1, this.#t = -1, this.#a.clear(), this.#n.clear(), this.#i.clear(), super.detach();
|
|
790
794
|
}
|
|
791
795
|
handleQuery(e) {
|
|
792
796
|
if (e.type === "isEditing")
|
|
@@ -803,8 +807,21 @@ class wn extends A {
|
|
|
803
807
|
onKeyDown(e) {
|
|
804
808
|
const t = this.grid;
|
|
805
809
|
if (e.key === "Escape" && this.#e !== -1)
|
|
806
|
-
return this.#
|
|
810
|
+
return this.config.onBeforeEditClose && this.config.onBeforeEditClose(e) === !1 || this.#o(this.#e, !0), !0;
|
|
811
|
+
if ((e.key === "ArrowUp" || e.key === "ArrowDown") && this.#e !== -1) {
|
|
812
|
+
if (this.config.onBeforeEditClose && this.config.onBeforeEditClose(e) === !1)
|
|
813
|
+
return !0;
|
|
814
|
+
const i = t._rows.length - 1, n = this.#e;
|
|
815
|
+
return this.#o(n, !1), e.key === "ArrowDown" ? t._focusRow = Math.min(i, t._focusRow + 1) : t._focusRow = Math.max(0, t._focusRow - 1), e.preventDefault(), P(t), this.requestAfterRender(), !0;
|
|
816
|
+
}
|
|
817
|
+
if (e.key === "Tab" && this.#e !== -1) {
|
|
818
|
+
e.preventDefault();
|
|
819
|
+
const i = !e.shiftKey;
|
|
820
|
+
return this.#g(i), !0;
|
|
821
|
+
}
|
|
807
822
|
if (e.key === " " || e.key === "Spacebar") {
|
|
823
|
+
if (this.#e !== -1)
|
|
824
|
+
return !1;
|
|
808
825
|
const i = t._focusRow, n = t._focusCol;
|
|
809
826
|
if (i >= 0 && n >= 0) {
|
|
810
827
|
const r = t._visibleColumns[n], o = t._rows[i];
|
|
@@ -812,7 +829,7 @@ class wn extends A {
|
|
|
812
829
|
const s = r.field;
|
|
813
830
|
if ($(s)) {
|
|
814
831
|
const d = !o[s];
|
|
815
|
-
return this.#
|
|
832
|
+
return this.#f(i, r, d, o), e.preventDefault(), this.requestRender(), !0;
|
|
816
833
|
}
|
|
817
834
|
}
|
|
818
835
|
}
|
|
@@ -820,7 +837,7 @@ class wn extends A {
|
|
|
820
837
|
}
|
|
821
838
|
if (e.key === "Enter" && !e.shiftKey) {
|
|
822
839
|
if (this.#e !== -1)
|
|
823
|
-
return !1;
|
|
840
|
+
return !!(this.config.onBeforeEditClose && this.config.onBeforeEditClose(e) === !1);
|
|
824
841
|
const i = this.config.editOn ?? t.effectiveConfig?.editOn;
|
|
825
842
|
if (i === !1 || i === "manual") return !1;
|
|
826
843
|
const n = t._focusRow, r = t._focusCol;
|
|
@@ -840,12 +857,12 @@ class wn extends A {
|
|
|
840
857
|
}
|
|
841
858
|
});
|
|
842
859
|
this.gridElement.dispatchEvent(h);
|
|
843
|
-
const
|
|
860
|
+
const f = new CustomEvent("activate-cell", {
|
|
844
861
|
cancelable: !0,
|
|
845
862
|
bubbles: !0,
|
|
846
863
|
detail: { row: n, col: r }
|
|
847
864
|
});
|
|
848
|
-
return this.gridElement.dispatchEvent(
|
|
865
|
+
return this.gridElement.dispatchEvent(f), h.defaultPrevented || f.defaultPrevented ? (e.preventDefault(), !0) : (this.beginBulkEdit(n), !0);
|
|
849
866
|
}
|
|
850
867
|
return !1;
|
|
851
868
|
}
|
|
@@ -868,7 +885,7 @@ class wn extends A {
|
|
|
868
885
|
}
|
|
869
886
|
afterRender() {
|
|
870
887
|
const e = this.grid;
|
|
871
|
-
if (this.#
|
|
888
|
+
if (this.#s && (this.#s = !1, this.#b(e)), this.#d !== -1) {
|
|
872
889
|
const t = this.#d;
|
|
873
890
|
this.#d = -1, e.animateRow?.(t, "change");
|
|
874
891
|
}
|
|
@@ -879,7 +896,7 @@ class wn extends A {
|
|
|
879
896
|
const l = s.querySelector(`.cell[data-col="${o}"]`);
|
|
880
897
|
if (!l || l.classList.contains("editing")) continue;
|
|
881
898
|
const d = e._rows[r], c = e._visibleColumns[o];
|
|
882
|
-
d && c && this.#
|
|
899
|
+
d && c && this.#l(d, r, c, o, l, !0);
|
|
883
900
|
}
|
|
884
901
|
}
|
|
885
902
|
onScrollRender() {
|
|
@@ -983,7 +1000,7 @@ class wn extends A {
|
|
|
983
1000
|
const i = this.grid, n = i._visibleColumns.findIndex((l) => l.field === t);
|
|
984
1001
|
if (n === -1 || !i._visibleColumns[n]?.editable) return;
|
|
985
1002
|
const s = i.findRenderedRowElement?.(e)?.querySelector(`.cell[data-col="${n}"]`);
|
|
986
|
-
s && this.#
|
|
1003
|
+
s && this.#m(e, n, s);
|
|
987
1004
|
}
|
|
988
1005
|
beginBulkEdit(e) {
|
|
989
1006
|
const t = this.grid;
|
|
@@ -995,12 +1012,12 @@ class wn extends A {
|
|
|
995
1012
|
const d = t._visibleColumns[l];
|
|
996
1013
|
if (d?.editable) {
|
|
997
1014
|
const c = s;
|
|
998
|
-
c.classList.contains("editing") || this.#
|
|
1015
|
+
c.classList.contains("editing") || this.#l(o, e, d, l, c, !0);
|
|
999
1016
|
}
|
|
1000
1017
|
}), setTimeout(() => {
|
|
1001
1018
|
let s = r.querySelector(`.cell[data-col="${t._focusCol}"]`);
|
|
1002
1019
|
if (s?.classList.contains("editing") || (s = r.querySelector(".cell.editing")), s?.classList.contains("editing")) {
|
|
1003
|
-
const l = s.querySelector(
|
|
1020
|
+
const l = s.querySelector(Z);
|
|
1004
1021
|
try {
|
|
1005
1022
|
l?.focus({ preventScroll: !0 });
|
|
1006
1023
|
} catch {
|
|
@@ -1009,25 +1026,38 @@ class wn extends A {
|
|
|
1009
1026
|
}, 0);
|
|
1010
1027
|
}
|
|
1011
1028
|
commitActiveRowEdit() {
|
|
1012
|
-
this.#e !== -1 && this.#
|
|
1029
|
+
this.#e !== -1 && this.#o(this.#e, !1);
|
|
1013
1030
|
}
|
|
1014
1031
|
cancelActiveRowEdit() {
|
|
1015
|
-
this.#e !== -1 && this.#
|
|
1032
|
+
this.#e !== -1 && this.#o(this.#e, !0);
|
|
1016
1033
|
}
|
|
1017
|
-
#
|
|
1034
|
+
#m(e, t, i) {
|
|
1018
1035
|
const n = this.grid, r = n._rows[e], o = n._visibleColumns[t];
|
|
1019
|
-
!r || !o?.editable || i.classList.contains("editing") || (this.#e !== e && this.#p(e, r), this.#t = t, this.#
|
|
1036
|
+
!r || !o?.editable || i.classList.contains("editing") || (this.#e !== e && this.#p(e, r), this.#t = t, this.#l(r, e, o, t, i, !1));
|
|
1037
|
+
}
|
|
1038
|
+
#g(e) {
|
|
1039
|
+
const t = this.grid, i = t._rows, n = this.#e, r = t._visibleColumns.map((d, c) => d.editable ? c : -1).filter((d) => d >= 0);
|
|
1040
|
+
if (r.length === 0) return;
|
|
1041
|
+
const s = r.indexOf(t._focusCol) + (e ? 1 : -1);
|
|
1042
|
+
if (s >= 0 && s < r.length) {
|
|
1043
|
+
t._focusCol = r[s];
|
|
1044
|
+
const c = t.findRenderedRowElement?.(n)?.querySelector(`.cell[data-col="${r[s]}"]`);
|
|
1045
|
+
c?.classList.contains("editing") && c.querySelector(Z)?.focus({ preventScroll: !0 }), P(t, { forceHorizontalScroll: !0 });
|
|
1046
|
+
return;
|
|
1047
|
+
}
|
|
1048
|
+
const l = n + (e ? 1 : -1);
|
|
1049
|
+
l >= 0 && l < i.length && (this.#o(n, !1), t._focusRow = l, t._focusCol = e ? r[0] : r[r.length - 1], this.beginBulkEdit(l), P(t, { forceHorizontalScroll: !0 }));
|
|
1020
1050
|
}
|
|
1021
1051
|
#h() {
|
|
1022
1052
|
const e = this.grid;
|
|
1023
|
-
e._activeEditRows = this.#e, e._rowEditSnapshots = this.#
|
|
1053
|
+
e._activeEditRows = this.#e, e._rowEditSnapshots = this.#a;
|
|
1024
1054
|
}
|
|
1025
1055
|
#p(e, t) {
|
|
1026
|
-
this.#e !== e && (this.#
|
|
1056
|
+
this.#e !== e && (this.#a.set(e, { ...t }), this.#e = e, this.#h());
|
|
1027
1057
|
}
|
|
1028
|
-
#
|
|
1058
|
+
#o(e, t) {
|
|
1029
1059
|
if (this.#e !== e) return;
|
|
1030
|
-
const i = this.grid, n = this.#
|
|
1060
|
+
const i = this.grid, n = this.#a.get(e), r = i._rows[e], o = i.findRenderedRowElement?.(e);
|
|
1031
1061
|
let s;
|
|
1032
1062
|
if (r)
|
|
1033
1063
|
try {
|
|
@@ -1038,18 +1068,19 @@ class wn extends A {
|
|
|
1038
1068
|
const c = Number(d.getAttribute("data-col"));
|
|
1039
1069
|
if (isNaN(c)) return;
|
|
1040
1070
|
const u = i._visibleColumns[c];
|
|
1041
|
-
if (!u)
|
|
1071
|
+
if (!u || d.hasAttribute("data-editor-managed"))
|
|
1072
|
+
return;
|
|
1042
1073
|
const h = d.querySelector("input,textarea,select");
|
|
1043
1074
|
if (h) {
|
|
1044
|
-
const
|
|
1045
|
-
|
|
1075
|
+
const f = u.field, g = r[f], p = U(h, u, g);
|
|
1076
|
+
g !== p && this.#f(e, u, p, r);
|
|
1046
1077
|
}
|
|
1047
1078
|
}), t && n && r)
|
|
1048
1079
|
Object.keys(n).forEach((l) => {
|
|
1049
1080
|
r[l] = n[l];
|
|
1050
1081
|
}), s && (this.#n.delete(s), this.clearRowInvalid(s));
|
|
1051
1082
|
else if (!t && r) {
|
|
1052
|
-
const l = this.#
|
|
1083
|
+
const l = this.#w(n, r), d = s ? this.#n.has(s) : l, c = this.emitCancelable("row-commit", {
|
|
1053
1084
|
rowIndex: e,
|
|
1054
1085
|
rowId: s ?? "",
|
|
1055
1086
|
row: r,
|
|
@@ -1063,14 +1094,14 @@ class wn extends A {
|
|
|
1063
1094
|
r[u] = n[u];
|
|
1064
1095
|
}), s && (this.#n.delete(s), this.clearRowInvalid(s))) : !c && l && this.isAnimationEnabled && (this.#d = e);
|
|
1065
1096
|
}
|
|
1066
|
-
this.#
|
|
1097
|
+
this.#a.delete(e), this.#e = -1, this.#t = -1, this.#h();
|
|
1067
1098
|
for (const l of this.#i)
|
|
1068
1099
|
l.startsWith(`${e}:`) && this.#i.delete(l);
|
|
1069
1100
|
o && (o.querySelectorAll(".cell.editing").forEach((l) => {
|
|
1070
1101
|
l.classList.remove("editing"), Mt(l.parentElement);
|
|
1071
|
-
}), this.requestRender()), this.#
|
|
1102
|
+
}), this.requestRender()), this.#s = !0, o || (this.#b(i), this.#s = !1);
|
|
1072
1103
|
}
|
|
1073
|
-
#
|
|
1104
|
+
#f(e, t, i, n) {
|
|
1074
1105
|
const r = t.field;
|
|
1075
1106
|
if (!$(r)) return;
|
|
1076
1107
|
const o = n[r];
|
|
@@ -1106,73 +1137,82 @@ class wn extends A {
|
|
|
1106
1137
|
oldValue: o,
|
|
1107
1138
|
newValue: i
|
|
1108
1139
|
});
|
|
1109
|
-
const
|
|
1110
|
-
|
|
1140
|
+
const g = s.findRenderedRowElement?.(e);
|
|
1141
|
+
g && g.classList.add("changed");
|
|
1111
1142
|
}
|
|
1112
|
-
#
|
|
1143
|
+
#l(e, t, i, n, r, o) {
|
|
1113
1144
|
if (!i.editable || r.classList.contains("editing")) return;
|
|
1114
1145
|
let s;
|
|
1115
1146
|
try {
|
|
1116
1147
|
s = this.grid.getRowId(e);
|
|
1117
1148
|
} catch {
|
|
1118
1149
|
}
|
|
1119
|
-
const l = s ? (
|
|
1150
|
+
const l = s ? (x) => this.grid.updateRow(s, x, "cascade") : _e, d = $(i.field) ? e[i.field] : void 0;
|
|
1120
1151
|
r.classList.add("editing"), this.#i.add(`${t}:${n}`);
|
|
1121
1152
|
const c = r.parentElement;
|
|
1122
1153
|
c && Dt(c);
|
|
1123
1154
|
let u = !1;
|
|
1124
|
-
const h = (
|
|
1125
|
-
u || this.#e === -1 || this.#
|
|
1126
|
-
},
|
|
1155
|
+
const h = (x) => {
|
|
1156
|
+
u || this.#e === -1 || this.#f(t, i, x, e);
|
|
1157
|
+
}, f = () => {
|
|
1127
1158
|
u = !0, $(i.field) && (e[i.field] = d);
|
|
1128
|
-
},
|
|
1129
|
-
|
|
1130
|
-
|
|
1159
|
+
}, g = document.createElement("div");
|
|
1160
|
+
g.className = "tbw-editor-host", r.innerHTML = "", r.appendChild(g), g.addEventListener("keydown", (x) => {
|
|
1161
|
+
if (x.key === "Enter") {
|
|
1162
|
+
if (this.config.onBeforeEditClose && this.config.onBeforeEditClose(x) === !1)
|
|
1163
|
+
return;
|
|
1164
|
+
x.stopPropagation(), x.preventDefault(), u = !0, this.#o(t, !1);
|
|
1165
|
+
}
|
|
1166
|
+
if (x.key === "Escape") {
|
|
1167
|
+
if (this.config.onBeforeEditClose && this.config.onBeforeEditClose(x) === !1)
|
|
1168
|
+
return;
|
|
1169
|
+
x.stopPropagation(), x.preventDefault(), f(), this.#o(t, !0);
|
|
1170
|
+
}
|
|
1131
1171
|
});
|
|
1132
1172
|
const p = i, w = p.__editorTemplate, b = Pt(this.grid, p) ?? Ft(i), v = d;
|
|
1133
1173
|
if (b === "template" && w)
|
|
1134
|
-
this.#u(
|
|
1174
|
+
this.#u(g, p, e, d, h, f, o, t);
|
|
1135
1175
|
else if (typeof b == "string") {
|
|
1136
|
-
const
|
|
1137
|
-
|
|
1138
|
-
|
|
1176
|
+
const x = document.createElement(b);
|
|
1177
|
+
x.value = v, x.addEventListener("change", () => h(x.value)), g.appendChild(x), o || queueMicrotask(() => {
|
|
1178
|
+
g.querySelector(Z)?.focus({ preventScroll: !0 });
|
|
1139
1179
|
});
|
|
1140
1180
|
} else if (typeof b == "function") {
|
|
1141
|
-
const
|
|
1181
|
+
const x = {
|
|
1142
1182
|
row: e,
|
|
1143
1183
|
rowId: s ?? "",
|
|
1144
1184
|
value: v,
|
|
1145
1185
|
field: i.field,
|
|
1146
1186
|
column: i,
|
|
1147
1187
|
commit: h,
|
|
1148
|
-
cancel:
|
|
1188
|
+
cancel: f,
|
|
1149
1189
|
updateRow: l
|
|
1150
|
-
},
|
|
1151
|
-
typeof
|
|
1152
|
-
|
|
1190
|
+
}, R = b(x);
|
|
1191
|
+
typeof R == "string" ? (g.innerHTML = R, Nt(g, i, h, d)) : R instanceof Node && (g.appendChild(R), R instanceof HTMLInputElement || R instanceof HTMLSelectElement || R instanceof HTMLTextAreaElement || r.setAttribute("data-editor-managed", "")), o || queueMicrotask(() => {
|
|
1192
|
+
g.querySelector(Z)?.focus({ preventScroll: !0 });
|
|
1153
1193
|
});
|
|
1154
1194
|
} else if (b && typeof b == "object") {
|
|
1155
|
-
const
|
|
1156
|
-
|
|
1157
|
-
const
|
|
1195
|
+
const x = document.createElement("div");
|
|
1196
|
+
x.setAttribute("data-external-editor", ""), x.setAttribute("data-field", i.field), g.appendChild(x), r.setAttribute("data-editor-managed", "");
|
|
1197
|
+
const R = {
|
|
1158
1198
|
row: e,
|
|
1159
1199
|
rowId: s ?? "",
|
|
1160
1200
|
value: v,
|
|
1161
1201
|
field: i.field,
|
|
1162
1202
|
column: i,
|
|
1163
1203
|
commit: h,
|
|
1164
|
-
cancel:
|
|
1204
|
+
cancel: f,
|
|
1165
1205
|
updateRow: l
|
|
1166
1206
|
};
|
|
1167
1207
|
if (b.mount)
|
|
1168
1208
|
try {
|
|
1169
|
-
b.mount({ placeholder:
|
|
1209
|
+
b.mount({ placeholder: x, context: R, spec: b });
|
|
1170
1210
|
} catch (E) {
|
|
1171
1211
|
console.warn(`[tbw-grid] External editor mount error for column '${i.field}':`, E);
|
|
1172
1212
|
}
|
|
1173
1213
|
else
|
|
1174
1214
|
this.grid.dispatchEvent(
|
|
1175
|
-
new CustomEvent("mount-external-editor", { detail: { placeholder:
|
|
1215
|
+
new CustomEvent("mount-external-editor", { detail: { placeholder: x, spec: b, context: R } })
|
|
1176
1216
|
);
|
|
1177
1217
|
}
|
|
1178
1218
|
}
|
|
@@ -1187,8 +1227,8 @@ class wn extends A {
|
|
|
1187
1227
|
column: t,
|
|
1188
1228
|
commit: r,
|
|
1189
1229
|
cancel: o
|
|
1190
|
-
}) : c.querySelectorAll("*").forEach((
|
|
1191
|
-
|
|
1230
|
+
}) : c.querySelectorAll("*").forEach((f) => {
|
|
1231
|
+
f.childNodes.length === 1 && f.firstChild?.nodeType === Node.TEXT_NODE && (f.textContent = f.textContent?.replace(/{{\s*value\s*}}/g, n == null ? "" : String(n)).replace(/{{\s*row\.([a-zA-Z0-9_]+)\s*}}/g, (g, p) => {
|
|
1192
1232
|
if (!$(p)) return "";
|
|
1193
1233
|
const w = i[p];
|
|
1194
1234
|
return w == null ? "" : String(w);
|
|
@@ -1199,17 +1239,26 @@ class wn extends A {
|
|
|
1199
1239
|
);
|
|
1200
1240
|
if (h) {
|
|
1201
1241
|
h instanceof HTMLInputElement && h.type === "checkbox" ? h.checked = !!n : h.value = String(n ?? "");
|
|
1202
|
-
let
|
|
1242
|
+
let f = !1;
|
|
1203
1243
|
h.addEventListener("blur", () => {
|
|
1204
|
-
|
|
1205
|
-
}), h.addEventListener("keydown", (
|
|
1206
|
-
const p =
|
|
1207
|
-
|
|
1244
|
+
f || r(U(h, t, n));
|
|
1245
|
+
}), h.addEventListener("keydown", (g) => {
|
|
1246
|
+
const p = g;
|
|
1247
|
+
if (p.key === "Enter") {
|
|
1248
|
+
if (this.config.onBeforeEditClose && this.config.onBeforeEditClose(p) === !1)
|
|
1249
|
+
return;
|
|
1250
|
+
p.stopPropagation(), p.preventDefault(), f = !0, r(U(h, t, n)), this.#o(l, !1);
|
|
1251
|
+
}
|
|
1252
|
+
if (p.key === "Escape") {
|
|
1253
|
+
if (this.config.onBeforeEditClose && this.config.onBeforeEditClose(p) === !1)
|
|
1254
|
+
return;
|
|
1255
|
+
p.stopPropagation(), p.preventDefault(), o(), this.#o(l, !0);
|
|
1256
|
+
}
|
|
1208
1257
|
}), h instanceof HTMLInputElement && h.type === "checkbox" && h.addEventListener("change", () => r(h.checked)), s || setTimeout(() => h.focus({ preventScroll: !0 }), 0);
|
|
1209
1258
|
}
|
|
1210
1259
|
e.appendChild(c);
|
|
1211
1260
|
}
|
|
1212
|
-
#
|
|
1261
|
+
#w(e, t) {
|
|
1213
1262
|
if (!e) return !1;
|
|
1214
1263
|
const i = e, n = t, r = /* @__PURE__ */ new Set([...Object.keys(i), ...Object.keys(n)]);
|
|
1215
1264
|
for (const o of r)
|
|
@@ -1217,7 +1266,7 @@ class wn extends A {
|
|
|
1217
1266
|
return !0;
|
|
1218
1267
|
return !1;
|
|
1219
1268
|
}
|
|
1220
|
-
#
|
|
1269
|
+
#b(e) {
|
|
1221
1270
|
queueMicrotask(() => {
|
|
1222
1271
|
try {
|
|
1223
1272
|
const t = e._focusRow, i = e._focusCol, n = e.findRenderedRowElement?.(t);
|
|
@@ -1309,7 +1358,7 @@ function zt(a, e) {
|
|
|
1309
1358
|
});
|
|
1310
1359
|
we(i, t);
|
|
1311
1360
|
}
|
|
1312
|
-
class bn extends
|
|
1361
|
+
class bn extends _ {
|
|
1313
1362
|
name = "export";
|
|
1314
1363
|
get defaultConfig() {
|
|
1315
1364
|
return {
|
|
@@ -1358,9 +1407,9 @@ class bn extends A {
|
|
|
1358
1407
|
case "json": {
|
|
1359
1408
|
const l = o.map((u) => {
|
|
1360
1409
|
const h = {};
|
|
1361
|
-
for (const
|
|
1362
|
-
let
|
|
1363
|
-
n.processCell && (
|
|
1410
|
+
for (const f of r) {
|
|
1411
|
+
let g = u[f.field];
|
|
1412
|
+
n.processCell && (g = n.processCell(g, f.field, u)), h[f.field] = g;
|
|
1364
1413
|
}
|
|
1365
1414
|
return h;
|
|
1366
1415
|
}), d = JSON.stringify(l, null, 2);
|
|
@@ -1479,7 +1528,7 @@ function Ie(a, e) {
|
|
|
1479
1528
|
return [...t].sort((i, n) => typeof i == "number" && typeof n == "number" ? i - n : String(i).localeCompare(String(n)));
|
|
1480
1529
|
}
|
|
1481
1530
|
const $t = '@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}}}', jt = "@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-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)}}";
|
|
1482
|
-
class N extends
|
|
1531
|
+
class N extends _ {
|
|
1483
1532
|
static manifest = {
|
|
1484
1533
|
events: [
|
|
1485
1534
|
{
|
|
@@ -1735,78 +1784,78 @@ class N extends A {
|
|
|
1735
1784
|
u.type = "checkbox", u.className = "tbw-filter-checkbox";
|
|
1736
1785
|
const h = document.createElement("span");
|
|
1737
1786
|
h.textContent = "Select All", c.appendChild(u), c.appendChild(h), d.appendChild(c);
|
|
1738
|
-
const
|
|
1739
|
-
const
|
|
1740
|
-
u.checked =
|
|
1787
|
+
const f = () => {
|
|
1788
|
+
const C = [...b.values()], k = C.every((m) => m), T = C.every((m) => !m);
|
|
1789
|
+
u.checked = k, u.indeterminate = !k && !T;
|
|
1741
1790
|
};
|
|
1742
1791
|
u.addEventListener("change", () => {
|
|
1743
|
-
const
|
|
1744
|
-
for (const
|
|
1745
|
-
b.set(
|
|
1746
|
-
|
|
1792
|
+
const C = u.checked;
|
|
1793
|
+
for (const k of b.keys())
|
|
1794
|
+
b.set(k, C);
|
|
1795
|
+
f(), R();
|
|
1747
1796
|
}), e.appendChild(d);
|
|
1748
|
-
const
|
|
1749
|
-
|
|
1797
|
+
const g = document.createElement("div");
|
|
1798
|
+
g.className = "tbw-filter-values";
|
|
1750
1799
|
const p = document.createElement("div");
|
|
1751
|
-
p.className = "tbw-filter-values-spacer",
|
|
1800
|
+
p.className = "tbw-filter-values-spacer", g.appendChild(p);
|
|
1752
1801
|
const w = document.createElement("div");
|
|
1753
|
-
w.className = "tbw-filter-values-content",
|
|
1802
|
+
w.className = "tbw-filter-values-content", g.appendChild(w);
|
|
1754
1803
|
const b = /* @__PURE__ */ new Map();
|
|
1755
|
-
i.forEach((
|
|
1756
|
-
const
|
|
1757
|
-
b.set(
|
|
1758
|
-
}),
|
|
1804
|
+
i.forEach((C) => {
|
|
1805
|
+
const k = C == null ? "__null__" : String(C);
|
|
1806
|
+
b.set(k, !n.has(C));
|
|
1807
|
+
}), f();
|
|
1759
1808
|
let v = [];
|
|
1760
|
-
const
|
|
1761
|
-
const T =
|
|
1762
|
-
y.className = "tbw-filter-value-item", y.style.position = "absolute", y.style.top = `calc(var(--tbw-filter-item-height, 28px) * ${
|
|
1809
|
+
const x = (C, k) => {
|
|
1810
|
+
const T = C == null ? "(Blank)" : String(C), m = C == null ? "__null__" : String(C), y = document.createElement("label");
|
|
1811
|
+
y.className = "tbw-filter-value-item", y.style.position = "absolute", y.style.top = `calc(var(--tbw-filter-item-height, 28px) * ${k})`, y.style.left = "0", y.style.right = "0", y.style.boxSizing = "border-box";
|
|
1763
1812
|
const L = document.createElement("input");
|
|
1764
1813
|
L.type = "checkbox", L.className = "tbw-filter-checkbox", L.checked = b.get(m) ?? !0, L.dataset.value = m, L.addEventListener("change", () => {
|
|
1765
|
-
b.set(m, L.checked),
|
|
1814
|
+
b.set(m, L.checked), f();
|
|
1766
1815
|
});
|
|
1767
1816
|
const H = document.createElement("span");
|
|
1768
1817
|
return H.textContent = T, y.appendChild(L), y.appendChild(H), y;
|
|
1769
|
-
},
|
|
1770
|
-
const
|
|
1771
|
-
if (p.style.height = `${
|
|
1818
|
+
}, R = () => {
|
|
1819
|
+
const C = v.length, k = g.clientHeight, T = g.scrollTop;
|
|
1820
|
+
if (p.style.height = `${C * o}px`, Gt(C, N.LIST_BYPASS_THRESHOLD / 3)) {
|
|
1772
1821
|
w.innerHTML = "", w.style.transform = "translateY(0px)", v.forEach((y, L) => {
|
|
1773
|
-
w.appendChild(
|
|
1822
|
+
w.appendChild(x(y, L));
|
|
1774
1823
|
});
|
|
1775
1824
|
return;
|
|
1776
1825
|
}
|
|
1777
1826
|
const m = Ot({
|
|
1778
|
-
totalRows:
|
|
1779
|
-
viewportHeight:
|
|
1827
|
+
totalRows: C,
|
|
1828
|
+
viewportHeight: k,
|
|
1780
1829
|
scrollTop: T,
|
|
1781
1830
|
rowHeight: o,
|
|
1782
1831
|
overscan: N.LIST_OVERSCAN
|
|
1783
1832
|
});
|
|
1784
1833
|
w.style.transform = `translateY(${m.offsetY}px)`, w.innerHTML = "";
|
|
1785
1834
|
for (let y = m.start; y < m.end; y++)
|
|
1786
|
-
w.appendChild(
|
|
1787
|
-
}, E = (
|
|
1788
|
-
const
|
|
1835
|
+
w.appendChild(x(v[y], y - m.start));
|
|
1836
|
+
}, E = (C) => {
|
|
1837
|
+
const k = this.config.caseSensitive ?? !1, T = k ? C : C.toLowerCase();
|
|
1789
1838
|
if (v = i.filter((m) => {
|
|
1790
|
-
const y = m == null ? "(Blank)" : String(m), L =
|
|
1791
|
-
return !
|
|
1839
|
+
const y = m == null ? "(Blank)" : String(m), L = k ? y : y.toLowerCase();
|
|
1840
|
+
return !C || L.includes(T);
|
|
1792
1841
|
}), v.length === 0) {
|
|
1793
1842
|
p.style.height = "0px", w.innerHTML = "";
|
|
1794
1843
|
const m = document.createElement("div");
|
|
1795
1844
|
m.className = "tbw-filter-no-match", m.textContent = "No matching values", w.appendChild(m);
|
|
1796
1845
|
return;
|
|
1797
1846
|
}
|
|
1798
|
-
|
|
1847
|
+
R();
|
|
1799
1848
|
};
|
|
1800
|
-
|
|
1849
|
+
g.addEventListener(
|
|
1801
1850
|
"scroll",
|
|
1802
1851
|
() => {
|
|
1803
|
-
v.length > 0 &&
|
|
1852
|
+
v.length > 0 && R();
|
|
1804
1853
|
},
|
|
1805
1854
|
{ passive: !0 }
|
|
1806
|
-
), E(l.value), e.appendChild(
|
|
1807
|
-
let
|
|
1855
|
+
), E(l.value), e.appendChild(g);
|
|
1856
|
+
let D;
|
|
1808
1857
|
l.addEventListener("input", () => {
|
|
1809
|
-
clearTimeout(
|
|
1858
|
+
clearTimeout(D), D = setTimeout(() => {
|
|
1810
1859
|
this.searchText.set(r, l.value), E(l.value);
|
|
1811
1860
|
}, this.config.debounceMs ?? 150);
|
|
1812
1861
|
});
|
|
@@ -1814,82 +1863,82 @@ class N extends A {
|
|
|
1814
1863
|
I.className = "tbw-filter-buttons";
|
|
1815
1864
|
const F = document.createElement("button");
|
|
1816
1865
|
F.className = "tbw-filter-apply-btn", F.textContent = "Apply", F.addEventListener("click", () => {
|
|
1817
|
-
const
|
|
1818
|
-
for (const [
|
|
1866
|
+
const C = [];
|
|
1867
|
+
for (const [k, T] of b)
|
|
1819
1868
|
if (!T)
|
|
1820
|
-
if (
|
|
1821
|
-
|
|
1869
|
+
if (k === "__null__")
|
|
1870
|
+
C.push(null);
|
|
1822
1871
|
else {
|
|
1823
|
-
const m = i.find((y) => String(y) ===
|
|
1824
|
-
|
|
1872
|
+
const m = i.find((y) => String(y) === k);
|
|
1873
|
+
C.push(m !== void 0 ? m : k);
|
|
1825
1874
|
}
|
|
1826
|
-
t.applySetFilter(
|
|
1875
|
+
t.applySetFilter(C);
|
|
1827
1876
|
}), I.appendChild(F);
|
|
1828
|
-
const
|
|
1829
|
-
|
|
1877
|
+
const S = document.createElement("button");
|
|
1878
|
+
S.className = "tbw-filter-clear-btn", S.textContent = "Clear Filter", S.addEventListener("click", () => {
|
|
1830
1879
|
t.clearFilter();
|
|
1831
|
-
}), I.appendChild(
|
|
1880
|
+
}), I.appendChild(S), e.appendChild(I);
|
|
1832
1881
|
}
|
|
1833
1882
|
renderNumberFilterPanel(e, t, i) {
|
|
1834
|
-
const { field: n, column: r } = t, o = r.filterParams, s = r.editorParams, l = (
|
|
1835
|
-
if (typeof
|
|
1836
|
-
if (typeof
|
|
1837
|
-
const W = parseFloat(
|
|
1883
|
+
const { field: n, column: r } = t, o = r.filterParams, s = r.editorParams, l = (A, K) => {
|
|
1884
|
+
if (typeof A == "number") return A;
|
|
1885
|
+
if (typeof A == "string") {
|
|
1886
|
+
const W = parseFloat(A);
|
|
1838
1887
|
return isNaN(W) ? K : W;
|
|
1839
1888
|
}
|
|
1840
1889
|
return K;
|
|
1841
|
-
}, d = i.filter((
|
|
1842
|
-
let w = h, b =
|
|
1843
|
-
p?.operator === "between" ? (w = l(p.value, h), b = l(p.valueTo,
|
|
1890
|
+
}, d = i.filter((A) => typeof A == "number" && !isNaN(A)), c = d.length > 0 ? Math.min(...d) : 0, u = d.length > 0 ? Math.max(...d) : 100, h = l(o?.min ?? s?.min, c), f = l(o?.max ?? s?.max, u), g = o?.step ?? s?.step ?? 1, p = this.filters.get(n);
|
|
1891
|
+
let w = h, b = f;
|
|
1892
|
+
p?.operator === "between" ? (w = l(p.value, h), b = l(p.valueTo, f)) : p?.operator === "greaterThanOrEqual" ? w = l(p.value, h) : p?.operator === "lessThanOrEqual" && (b = l(p.value, f));
|
|
1844
1893
|
const v = document.createElement("div");
|
|
1845
1894
|
v.className = "tbw-filter-range-inputs";
|
|
1846
|
-
const
|
|
1847
|
-
|
|
1848
|
-
const
|
|
1849
|
-
|
|
1895
|
+
const x = document.createElement("div");
|
|
1896
|
+
x.className = "tbw-filter-range-group";
|
|
1897
|
+
const R = document.createElement("label");
|
|
1898
|
+
R.textContent = "Min", R.className = "tbw-filter-range-label";
|
|
1850
1899
|
const E = document.createElement("input");
|
|
1851
|
-
E.type = "number", E.className = "tbw-filter-range-input", E.min = String(h), E.max = String(
|
|
1852
|
-
const
|
|
1853
|
-
|
|
1900
|
+
E.type = "number", E.className = "tbw-filter-range-input", E.min = String(h), E.max = String(f), E.step = String(g), E.value = String(w), x.appendChild(R), x.appendChild(E), v.appendChild(x);
|
|
1901
|
+
const D = document.createElement("span");
|
|
1902
|
+
D.className = "tbw-filter-range-separator", D.textContent = "–", v.appendChild(D);
|
|
1854
1903
|
const I = document.createElement("div");
|
|
1855
1904
|
I.className = "tbw-filter-range-group";
|
|
1856
1905
|
const F = document.createElement("label");
|
|
1857
1906
|
F.textContent = "Max", F.className = "tbw-filter-range-label";
|
|
1858
|
-
const
|
|
1859
|
-
|
|
1860
|
-
const
|
|
1861
|
-
|
|
1862
|
-
const
|
|
1863
|
-
|
|
1907
|
+
const S = document.createElement("input");
|
|
1908
|
+
S.type = "number", S.className = "tbw-filter-range-input", S.min = String(h), S.max = String(f), S.step = String(g), S.value = String(b), I.appendChild(F), I.appendChild(S), v.appendChild(I), e.appendChild(v);
|
|
1909
|
+
const C = document.createElement("div");
|
|
1910
|
+
C.className = "tbw-filter-range-slider";
|
|
1911
|
+
const k = document.createElement("div");
|
|
1912
|
+
k.className = "tbw-filter-range-track";
|
|
1864
1913
|
const T = document.createElement("div");
|
|
1865
1914
|
T.className = "tbw-filter-range-fill";
|
|
1866
1915
|
const m = document.createElement("input");
|
|
1867
|
-
m.type = "range", m.className = "tbw-filter-range-thumb tbw-filter-range-thumb-min", m.min = String(h), m.max = String(
|
|
1916
|
+
m.type = "range", m.className = "tbw-filter-range-thumb tbw-filter-range-thumb-min", m.min = String(h), m.max = String(f), m.step = String(g), m.value = String(w);
|
|
1868
1917
|
const y = document.createElement("input");
|
|
1869
|
-
y.type = "range", y.className = "tbw-filter-range-thumb tbw-filter-range-thumb-max", y.min = String(h), y.max = String(
|
|
1918
|
+
y.type = "range", y.className = "tbw-filter-range-thumb tbw-filter-range-thumb-max", y.min = String(h), y.max = String(f), y.step = String(g), y.value = String(b), C.appendChild(k), C.appendChild(T), C.appendChild(m), C.appendChild(y), e.appendChild(C);
|
|
1870
1919
|
const L = () => {
|
|
1871
|
-
const
|
|
1920
|
+
const A = parseFloat(m.value), K = parseFloat(y.value), W = f - h, ve = (A - h) / W * 100, ut = (K - h) / W * 100;
|
|
1872
1921
|
T.style.left = `${ve}%`, T.style.width = `${ut - ve}%`;
|
|
1873
1922
|
};
|
|
1874
1923
|
m.addEventListener("input", () => {
|
|
1875
|
-
const
|
|
1876
|
-
m.value = String(
|
|
1924
|
+
const A = Math.min(parseFloat(m.value), parseFloat(y.value));
|
|
1925
|
+
m.value = String(A), E.value = String(A), L();
|
|
1877
1926
|
}), y.addEventListener("input", () => {
|
|
1878
|
-
const
|
|
1879
|
-
y.value = String(
|
|
1927
|
+
const A = Math.max(parseFloat(y.value), parseFloat(m.value));
|
|
1928
|
+
y.value = String(A), S.value = String(A), L();
|
|
1880
1929
|
}), E.addEventListener("input", () => {
|
|
1881
|
-
let
|
|
1882
|
-
|
|
1883
|
-
}),
|
|
1884
|
-
let
|
|
1885
|
-
|
|
1930
|
+
let A = parseFloat(E.value) || h;
|
|
1931
|
+
A = Math.max(h, Math.min(A, parseFloat(S.value))), m.value = String(A), L();
|
|
1932
|
+
}), S.addEventListener("input", () => {
|
|
1933
|
+
let A = parseFloat(S.value) || f;
|
|
1934
|
+
A = Math.min(f, Math.max(A, parseFloat(E.value))), y.value = String(A), L();
|
|
1886
1935
|
}), L();
|
|
1887
1936
|
const H = document.createElement("div");
|
|
1888
1937
|
H.className = "tbw-filter-buttons";
|
|
1889
1938
|
const Y = document.createElement("button");
|
|
1890
1939
|
Y.className = "tbw-filter-apply-btn", Y.textContent = "Apply", Y.addEventListener("click", () => {
|
|
1891
|
-
const
|
|
1892
|
-
t.applyTextFilter("between",
|
|
1940
|
+
const A = parseFloat(E.value), K = parseFloat(S.value);
|
|
1941
|
+
t.applyTextFilter("between", A, K);
|
|
1893
1942
|
}), H.appendChild(Y);
|
|
1894
1943
|
const X = document.createElement("button");
|
|
1895
1944
|
X.className = "tbw-filter-clear-btn", X.textContent = "Clear Filter", X.addEventListener("click", () => {
|
|
@@ -1897,36 +1946,36 @@ class N extends A {
|
|
|
1897
1946
|
}), H.appendChild(X), e.appendChild(H);
|
|
1898
1947
|
}
|
|
1899
1948
|
renderDateFilterPanel(e, t, i) {
|
|
1900
|
-
const { field: n, column: r } = t, o = r.filterParams, s = r.editorParams, l = i.filter((m) => m instanceof Date || typeof m == "string" && !isNaN(Date.parse(m))).map((m) => m instanceof Date ? m : new Date(m)).filter((m) => !isNaN(m.getTime())), d = l.length > 0 ? new Date(Math.min(...l.map((m) => m.getTime()))) : null, c = l.length > 0 ? new Date(Math.max(...l.map((m) => m.getTime()))) : null, u = (m) => m ? m.toISOString().split("T")[0] : "", h = (m) => m ? typeof m == "string" ? m : typeof m == "number" ? u(new Date(m)) : "" : "",
|
|
1949
|
+
const { field: n, column: r } = t, o = r.filterParams, s = r.editorParams, l = i.filter((m) => m instanceof Date || typeof m == "string" && !isNaN(Date.parse(m))).map((m) => m instanceof Date ? m : new Date(m)).filter((m) => !isNaN(m.getTime())), d = l.length > 0 ? new Date(Math.min(...l.map((m) => m.getTime()))) : null, c = l.length > 0 ? new Date(Math.max(...l.map((m) => m.getTime()))) : null, u = (m) => m ? m.toISOString().split("T")[0] : "", h = (m) => m ? typeof m == "string" ? m : typeof m == "number" ? u(new Date(m)) : "" : "", f = h(o?.min) || h(s?.min) || u(d), g = h(o?.max) || h(s?.max) || u(c), p = this.filters.get(n);
|
|
1901
1950
|
let w = "", b = "";
|
|
1902
1951
|
p?.operator === "between" ? (w = h(p.value) || "", b = h(p.valueTo) || "") : p?.operator === "greaterThanOrEqual" ? w = h(p.value) || "" : p?.operator === "lessThanOrEqual" && (b = h(p.value) || "");
|
|
1903
1952
|
const v = document.createElement("div");
|
|
1904
1953
|
v.className = "tbw-filter-date-range";
|
|
1905
|
-
const
|
|
1906
|
-
|
|
1907
|
-
const
|
|
1908
|
-
|
|
1954
|
+
const x = document.createElement("div");
|
|
1955
|
+
x.className = "tbw-filter-date-group";
|
|
1956
|
+
const R = document.createElement("label");
|
|
1957
|
+
R.textContent = "From", R.className = "tbw-filter-range-label";
|
|
1909
1958
|
const E = document.createElement("input");
|
|
1910
|
-
E.type = "date", E.className = "tbw-filter-date-input",
|
|
1911
|
-
const
|
|
1912
|
-
|
|
1959
|
+
E.type = "date", E.className = "tbw-filter-date-input", f && (E.min = f), g && (E.max = g), E.value = w, x.appendChild(R), x.appendChild(E), v.appendChild(x);
|
|
1960
|
+
const D = document.createElement("span");
|
|
1961
|
+
D.className = "tbw-filter-range-separator", D.textContent = "–", v.appendChild(D);
|
|
1913
1962
|
const I = document.createElement("div");
|
|
1914
1963
|
I.className = "tbw-filter-date-group";
|
|
1915
1964
|
const F = document.createElement("label");
|
|
1916
1965
|
F.textContent = "To", F.className = "tbw-filter-range-label";
|
|
1917
|
-
const
|
|
1918
|
-
|
|
1919
|
-
const
|
|
1920
|
-
|
|
1921
|
-
const
|
|
1922
|
-
|
|
1923
|
-
const m = E.value, y =
|
|
1966
|
+
const S = document.createElement("input");
|
|
1967
|
+
S.type = "date", S.className = "tbw-filter-date-input", f && (S.min = f), g && (S.max = g), S.value = b, I.appendChild(F), I.appendChild(S), v.appendChild(I), e.appendChild(v);
|
|
1968
|
+
const C = document.createElement("div");
|
|
1969
|
+
C.className = "tbw-filter-buttons";
|
|
1970
|
+
const k = document.createElement("button");
|
|
1971
|
+
k.className = "tbw-filter-apply-btn", k.textContent = "Apply", k.addEventListener("click", () => {
|
|
1972
|
+
const m = E.value, y = S.value;
|
|
1924
1973
|
m && y ? t.applyTextFilter("between", m, y) : m ? t.applyTextFilter("greaterThanOrEqual", m) : y ? t.applyTextFilter("lessThanOrEqual", y) : t.clearFilter();
|
|
1925
|
-
}),
|
|
1974
|
+
}), C.appendChild(k);
|
|
1926
1975
|
const T = document.createElement("button");
|
|
1927
1976
|
T.className = "tbw-filter-clear-btn", T.textContent = "Clear Filter", T.addEventListener("click", () => {
|
|
1928
1977
|
t.clearFilter();
|
|
1929
|
-
}),
|
|
1978
|
+
}), C.appendChild(T), e.appendChild(C);
|
|
1930
1979
|
}
|
|
1931
1980
|
applySetFilter(e, t) {
|
|
1932
1981
|
this.excludedValues.set(e, new Set(t)), t.length === 0 ? this.filters.delete(e) : this.filters.set(e, {
|
|
@@ -2059,7 +2108,7 @@ function Xt(a) {
|
|
|
2059
2108
|
return a.some((e) => e.group != null);
|
|
2060
2109
|
}
|
|
2061
2110
|
const Zt = "@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)}}";
|
|
2062
|
-
class vn extends
|
|
2111
|
+
class vn extends _ {
|
|
2063
2112
|
static manifest = {
|
|
2064
2113
|
ownedProperties: [
|
|
2065
2114
|
{
|
|
@@ -2169,10 +2218,10 @@ function Pe({ rows: a, config: e, expanded: t, initialExpanded: i }) {
|
|
|
2169
2218
|
let c = n(d);
|
|
2170
2219
|
c == null || c === !1 ? c = ["__ungrouped__"] : Array.isArray(c) || (c = [c]);
|
|
2171
2220
|
let u = r;
|
|
2172
|
-
c.forEach((h,
|
|
2173
|
-
const
|
|
2174
|
-
let w = u.children.get(
|
|
2175
|
-
w || (w = { key: p, value: h, depth:
|
|
2221
|
+
c.forEach((h, f) => {
|
|
2222
|
+
const g = h == null ? "∅" : String(h), p = u.key === "__root__" ? g : u.key + "||" + g;
|
|
2223
|
+
let w = u.children.get(g);
|
|
2224
|
+
w || (w = { key: p, value: h, depth: f, rows: [], children: /* @__PURE__ */ new Map(), parent: u }, u.children.set(g, w)), u = w;
|
|
2176
2225
|
}), u.rows.push(d);
|
|
2177
2226
|
}), r.children.size === 1 && r.children.has("__ungrouped__") && r.children.get("__ungrouped__").rows.length === a.length)
|
|
2178
2227
|
return [];
|
|
@@ -2224,7 +2273,7 @@ function ni(a) {
|
|
|
2224
2273
|
return a.kind !== "group" ? 0 : a.rows.length;
|
|
2225
2274
|
}
|
|
2226
2275
|
const ri = "@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}}}";
|
|
2227
|
-
class yn extends
|
|
2276
|
+
class yn extends _ {
|
|
2228
2277
|
static manifest = {
|
|
2229
2278
|
events: [
|
|
2230
2279
|
{
|
|
@@ -2389,12 +2438,12 @@ class yn extends A {
|
|
|
2389
2438
|
const c = document.createElement("span");
|
|
2390
2439
|
c.className = "group-aggregates";
|
|
2391
2440
|
for (const [u, h] of d) {
|
|
2392
|
-
const
|
|
2393
|
-
if (
|
|
2441
|
+
const f = this.columns.find((p) => p.field === u), g = te(h, o, u, f);
|
|
2442
|
+
if (g != null) {
|
|
2394
2443
|
const p = document.createElement("span");
|
|
2395
2444
|
p.className = "group-aggregate", p.setAttribute("data-field", u);
|
|
2396
|
-
const w =
|
|
2397
|
-
p.textContent = `${w}: ${
|
|
2445
|
+
const w = f?.header ?? u;
|
|
2446
|
+
p.textContent = `${w}: ${g}`, c.appendChild(p);
|
|
2398
2447
|
}
|
|
2399
2448
|
}
|
|
2400
2449
|
c.children.length > 0 && s.appendChild(c);
|
|
@@ -2406,32 +2455,32 @@ class yn extends A {
|
|
|
2406
2455
|
d && (t.style.display = "grid", t.style.gridTemplateColumns = d);
|
|
2407
2456
|
let c = !1;
|
|
2408
2457
|
o.forEach((u, h) => {
|
|
2409
|
-
const
|
|
2410
|
-
if (
|
|
2411
|
-
|
|
2458
|
+
const f = document.createElement("div");
|
|
2459
|
+
if (f.className = "cell group-cell", f.setAttribute("data-col", String(h)), f.setAttribute("role", "gridcell"), pe(u)) {
|
|
2460
|
+
f.setAttribute("data-field", u.field), t.appendChild(f);
|
|
2412
2461
|
return;
|
|
2413
2462
|
}
|
|
2414
2463
|
if (c) {
|
|
2415
|
-
const
|
|
2416
|
-
if (
|
|
2417
|
-
const p =
|
|
2418
|
-
|
|
2464
|
+
const g = r[u.field];
|
|
2465
|
+
if (g) {
|
|
2466
|
+
const p = te(g, s, u.field, u);
|
|
2467
|
+
f.textContent = p != null ? String(p) : "";
|
|
2419
2468
|
} else
|
|
2420
|
-
|
|
2469
|
+
f.textContent = "";
|
|
2421
2470
|
} else {
|
|
2422
|
-
c = !0,
|
|
2423
|
-
const
|
|
2471
|
+
c = !0, f.appendChild(this.createToggleButton(e.__groupExpanded, i));
|
|
2472
|
+
const g = document.createElement("span"), p = r[u.field];
|
|
2424
2473
|
if (p) {
|
|
2425
|
-
const w =
|
|
2426
|
-
|
|
2474
|
+
const w = te(p, s, u.field, u);
|
|
2475
|
+
g.textContent = w != null ? String(w) : String(e.__groupValue);
|
|
2427
2476
|
} else
|
|
2428
|
-
|
|
2429
|
-
if (
|
|
2477
|
+
g.textContent = this.getGroupLabelText(e.__groupValue, e.__groupDepth || 0, e.__groupKey);
|
|
2478
|
+
if (f.appendChild(g), n.showRowCount !== !1) {
|
|
2430
2479
|
const w = document.createElement("span");
|
|
2431
|
-
w.className = "group-count", w.textContent = ` (${s.length})`,
|
|
2480
|
+
w.className = "group-count", w.textContent = ` (${s.length})`, f.appendChild(w);
|
|
2432
2481
|
}
|
|
2433
2482
|
}
|
|
2434
|
-
t.appendChild(
|
|
2483
|
+
t.appendChild(f);
|
|
2435
2484
|
});
|
|
2436
2485
|
}
|
|
2437
2486
|
expandAll() {
|
|
@@ -2527,7 +2576,7 @@ function li(a, e, t, i) {
|
|
|
2527
2576
|
return typeof o == "string" ? r.innerHTML = o : o instanceof HTMLElement && r.appendChild(o), n.appendChild(r), n;
|
|
2528
2577
|
}
|
|
2529
2578
|
const di = "@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}}}";
|
|
2530
|
-
class nt extends
|
|
2579
|
+
class nt extends _ {
|
|
2531
2580
|
name = "masterDetail";
|
|
2532
2581
|
styles = di;
|
|
2533
2582
|
get defaultConfig() {
|
|
@@ -2558,8 +2607,8 @@ class nt extends A {
|
|
|
2558
2607
|
n !== null && (d.animation = n === "false" ? !1 : n), r !== null && (d.showExpandColumn = r !== "false"), o !== null && (d.expandOnRowClick = o === "true"), s !== null && (d.collapseOnClickOutside = s === "true"), l !== null && (d.detailHeight = l === "auto" ? "auto" : parseInt(l, 10));
|
|
2559
2608
|
const c = t.innerHTML.trim();
|
|
2560
2609
|
c && !this.config.detailRenderer && (d.detailRenderer = (u, h) => {
|
|
2561
|
-
const
|
|
2562
|
-
return et(
|
|
2610
|
+
const f = Je(c, { value: u, row: u });
|
|
2611
|
+
return et(f);
|
|
2563
2612
|
}), Object.keys(d).length > 0 && (this.config = { ...this.config, ...d });
|
|
2564
2613
|
}
|
|
2565
2614
|
get animationStyle() {
|
|
@@ -2762,10 +2811,10 @@ function Me(a, e) {
|
|
|
2762
2811
|
function Ne(a, e) {
|
|
2763
2812
|
return a.find((t) => t.field === e)?.direction;
|
|
2764
2813
|
}
|
|
2765
|
-
const
|
|
2766
|
-
class xn extends
|
|
2814
|
+
const fi = '@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}}';
|
|
2815
|
+
class xn extends _ {
|
|
2767
2816
|
name = "multiSort";
|
|
2768
|
-
styles =
|
|
2817
|
+
styles = fi;
|
|
2769
2818
|
get defaultConfig() {
|
|
2770
2819
|
return {
|
|
2771
2820
|
maxSortColumns: 3,
|
|
@@ -2796,10 +2845,10 @@ class xn extends A {
|
|
|
2796
2845
|
n.querySelector('[part~="sort-indicator"], .sort-indicator')?.remove(), n.setAttribute("data-sort", s);
|
|
2797
2846
|
const c = document.createElement("span");
|
|
2798
2847
|
c.className = "sort-indicator", this.setIcon(c, this.resolveIcon(s === "asc" ? "sortAsc" : "sortDesc"));
|
|
2799
|
-
const u = n.querySelector(".tbw-filter-btn"), h = n.querySelector(".resize-handle"),
|
|
2800
|
-
if (
|
|
2801
|
-
const
|
|
2802
|
-
|
|
2848
|
+
const u = n.querySelector(".tbw-filter-btn"), h = n.querySelector(".resize-handle"), f = u ?? h;
|
|
2849
|
+
if (f ? n.insertBefore(c, f) : n.appendChild(c), t && this.sortModel.length > 1 && o !== void 0) {
|
|
2850
|
+
const g = document.createElement("span");
|
|
2851
|
+
g.className = "sort-index", g.textContent = String(o), c.nextSibling ? n.insertBefore(g, c.nextSibling) : n.appendChild(g);
|
|
2803
2852
|
}
|
|
2804
2853
|
} else
|
|
2805
2854
|
n.removeAttribute("data-sort");
|
|
@@ -2842,7 +2891,7 @@ class xn extends A {
|
|
|
2842
2891
|
}
|
|
2843
2892
|
}
|
|
2844
2893
|
function rt(a, e) {
|
|
2845
|
-
return
|
|
2894
|
+
return ft(a, e);
|
|
2846
2895
|
}
|
|
2847
2896
|
function ot(a, e) {
|
|
2848
2897
|
const t = a.sticky;
|
|
@@ -2852,7 +2901,7 @@ function st(a, e) {
|
|
|
2852
2901
|
const t = a.sticky;
|
|
2853
2902
|
return t ? rt(t, e) === "right" : !1;
|
|
2854
2903
|
}
|
|
2855
|
-
function
|
|
2904
|
+
function gi(a, e = "ltr") {
|
|
2856
2905
|
return a.filter((t) => ot(t, e));
|
|
2857
2906
|
}
|
|
2858
2907
|
function pi(a, e = "ltr") {
|
|
@@ -2893,7 +2942,7 @@ function He(a) {
|
|
|
2893
2942
|
});
|
|
2894
2943
|
}
|
|
2895
2944
|
const Ke = "canMoveColumn";
|
|
2896
|
-
class Cn extends
|
|
2945
|
+
class Cn extends _ {
|
|
2897
2946
|
static manifest = {
|
|
2898
2947
|
ownedProperties: [
|
|
2899
2948
|
{
|
|
@@ -2967,7 +3016,7 @@ class Cn extends A {
|
|
|
2967
3016
|
}
|
|
2968
3017
|
getLeftPinnedColumns() {
|
|
2969
3018
|
const e = [...this.columns], t = ue(this.grid);
|
|
2970
|
-
return
|
|
3019
|
+
return gi(e, t);
|
|
2971
3020
|
}
|
|
2972
3021
|
getRightPinnedColumns() {
|
|
2973
3022
|
const e = [...this.columns], t = ue(this.grid);
|
|
@@ -3086,7 +3135,7 @@ function Ge(a, e, t, i, n) {
|
|
|
3086
3135
|
};
|
|
3087
3136
|
}
|
|
3088
3137
|
const bi = "@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}}";
|
|
3089
|
-
class En extends
|
|
3138
|
+
class En extends _ {
|
|
3090
3139
|
name = "pinnedRows";
|
|
3091
3140
|
styles = bi;
|
|
3092
3141
|
get defaultConfig() {
|
|
@@ -3192,7 +3241,7 @@ class En extends A {
|
|
|
3192
3241
|
this.config.aggregationRows && (this.config.aggregationRows = this.config.aggregationRows.filter((t) => t.id !== e), this.requestRender());
|
|
3193
3242
|
}
|
|
3194
3243
|
}
|
|
3195
|
-
const vi =
|
|
3244
|
+
const vi = gt;
|
|
3196
3245
|
function yi(a) {
|
|
3197
3246
|
const e = [];
|
|
3198
3247
|
return !a.rowGroupFields?.length && !a.columnGroupFields?.length && e.push("At least one row or column group field is required"), a.valueFields?.length || e.push("At least one value field is required"), e;
|
|
@@ -3237,38 +3286,38 @@ function Ei(a, e) {
|
|
|
3237
3286
|
function at(a, e, t, i, n, r, o) {
|
|
3238
3287
|
const s = [];
|
|
3239
3288
|
if (e.length === 0) {
|
|
3240
|
-
const h = Be(a, t, i, n),
|
|
3289
|
+
const h = Be(a, t, i, n), f = Ve(h);
|
|
3241
3290
|
return s.push({
|
|
3242
3291
|
rowKey: o || "all",
|
|
3243
3292
|
rowLabel: o || "All",
|
|
3244
3293
|
depth: r,
|
|
3245
3294
|
values: h,
|
|
3246
|
-
total:
|
|
3295
|
+
total: f,
|
|
3247
3296
|
isGroup: !1,
|
|
3248
3297
|
rowCount: a.length
|
|
3249
3298
|
}), s;
|
|
3250
3299
|
}
|
|
3251
3300
|
const l = e[0], d = e.slice(1), c = d.length > 0, u = Ei(a, l);
|
|
3252
|
-
for (const [h,
|
|
3253
|
-
const
|
|
3301
|
+
for (const [h, f] of u) {
|
|
3302
|
+
const g = o ? `${o}|${h}` : h, p = Be(f, t, i, n), w = Ve(p);
|
|
3254
3303
|
let b;
|
|
3255
3304
|
c && (b = at(
|
|
3256
|
-
|
|
3305
|
+
f,
|
|
3257
3306
|
d,
|
|
3258
3307
|
t,
|
|
3259
3308
|
i,
|
|
3260
3309
|
n,
|
|
3261
3310
|
r + 1,
|
|
3262
|
-
|
|
3311
|
+
g
|
|
3263
3312
|
)), s.push({
|
|
3264
|
-
rowKey:
|
|
3313
|
+
rowKey: g,
|
|
3265
3314
|
rowLabel: h || "(blank)",
|
|
3266
3315
|
depth: r,
|
|
3267
3316
|
values: p,
|
|
3268
3317
|
total: w,
|
|
3269
3318
|
isGroup: c,
|
|
3270
3319
|
children: b,
|
|
3271
|
-
rowCount:
|
|
3320
|
+
rowCount: f.length
|
|
3272
3321
|
});
|
|
3273
3322
|
}
|
|
3274
3323
|
return s;
|
|
@@ -3277,7 +3326,7 @@ function Be(a, e, t, i) {
|
|
|
3277
3326
|
const n = {};
|
|
3278
3327
|
for (const r of t)
|
|
3279
3328
|
for (const o of i) {
|
|
3280
|
-
const l = (e.length > 0 ? a.filter((h) => e.map((
|
|
3329
|
+
const l = (e.length > 0 ? a.filter((h) => e.map((f) => String(h[f] ?? "")).join("|") === r) : a).map((h) => Number(h[o.field]) || 0), d = vi(o.aggFunc), c = l.length > 0 ? d(l) : null, u = be([r], o.field);
|
|
3281
3330
|
n[u] = c;
|
|
3282
3331
|
}
|
|
3283
3332
|
return n;
|
|
@@ -3579,7 +3628,7 @@ function Ni(a, e, t) {
|
|
|
3579
3628
|
}), !0;
|
|
3580
3629
|
}
|
|
3581
3630
|
const qi = '@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}}}';
|
|
3582
|
-
class G extends
|
|
3631
|
+
class G extends _ {
|
|
3583
3632
|
name = "pivot";
|
|
3584
3633
|
styles = qi;
|
|
3585
3634
|
static PANEL_ID = "pivot";
|
|
@@ -3867,10 +3916,10 @@ class G extends A {
|
|
|
3867
3916
|
n >= 0 && (i[n] = { ...i[n], aggFunc: t }, this.config.valueFields = [...i]), this.isActive && this.refresh();
|
|
3868
3917
|
}
|
|
3869
3918
|
}
|
|
3870
|
-
const
|
|
3919
|
+
const J = "tbw-print-isolation-style";
|
|
3871
3920
|
function Hi(a, e) {
|
|
3872
3921
|
const t = document.createElement("style");
|
|
3873
|
-
return t.id =
|
|
3922
|
+
return t.id = J, t.textContent = `
|
|
3874
3923
|
/* Print isolation: hide everything except the target grid */
|
|
3875
3924
|
@media print {
|
|
3876
3925
|
/* Hide all body children by default */
|
|
@@ -3946,14 +3995,14 @@ async function Ki(a, e = {}) {
|
|
|
3946
3995
|
const { orientation: t = "landscape" } = e, i = a.id;
|
|
3947
3996
|
document.querySelectorAll(`#${CSS.escape(i)}`).length > 1 && console.warn(
|
|
3948
3997
|
`[tbw-grid:print] Multiple elements found with id="${i}". Print isolation may not work correctly. Ensure each grid has a unique ID.`
|
|
3949
|
-
), document.getElementById(
|
|
3998
|
+
), document.getElementById(J)?.remove();
|
|
3950
3999
|
const r = Hi(i, t);
|
|
3951
4000
|
return document.head.appendChild(r), new Promise((o) => {
|
|
3952
4001
|
const s = () => {
|
|
3953
|
-
window.removeEventListener("afterprint", s), document.getElementById(
|
|
4002
|
+
window.removeEventListener("afterprint", s), document.getElementById(J)?.remove(), o();
|
|
3954
4003
|
};
|
|
3955
4004
|
window.addEventListener("afterprint", s), window.print(), setTimeout(() => {
|
|
3956
|
-
window.removeEventListener("afterprint", s), document.getElementById(
|
|
4005
|
+
window.removeEventListener("afterprint", s), document.getElementById(J)?.remove(), o();
|
|
3957
4006
|
}, 5e3);
|
|
3958
4007
|
});
|
|
3959
4008
|
}
|
|
@@ -3967,16 +4016,16 @@ const zi = ".tbw-print-header,.tbw-print-footer{display:none}@media print{tbw-gr
|
|
|
3967
4016
|
title: "",
|
|
3968
4017
|
isolate: !1
|
|
3969
4018
|
};
|
|
3970
|
-
class Rn extends
|
|
4019
|
+
class Rn extends _ {
|
|
3971
4020
|
name = "print";
|
|
3972
4021
|
version = "1.0.0";
|
|
3973
4022
|
styles = zi;
|
|
3974
4023
|
#e = !1;
|
|
3975
4024
|
#t = null;
|
|
3976
|
-
#
|
|
4025
|
+
#a = null;
|
|
3977
4026
|
#n = null;
|
|
3978
4027
|
#i = null;
|
|
3979
|
-
#
|
|
4028
|
+
#s = null;
|
|
3980
4029
|
#d = null;
|
|
3981
4030
|
get #r() {
|
|
3982
4031
|
return this.grid;
|
|
@@ -4016,9 +4065,9 @@ Click OK to continue, or Cancel to abort.`
|
|
|
4016
4065
|
});
|
|
4017
4066
|
try {
|
|
4018
4067
|
const d = this.#r;
|
|
4019
|
-
this.#
|
|
4068
|
+
this.#a = {
|
|
4020
4069
|
bypassThreshold: d._virtualization?.bypassThreshold ?? 24
|
|
4021
|
-
}, this.#
|
|
4070
|
+
}, this.#p(), s && (this.#n = this.sourceRows, this.grid.rows = this.sourceRows.slice(0, o), await new Promise((c) => setTimeout(c, 50))), (i.includeTitle || i.includeTimestamp) && this.#c(i), await this.#m(), await new Promise((c) => requestAnimationFrame(c)), await new Promise((c) => requestAnimationFrame(c)), t.classList.add(`print-${i.orientation}`), await new Promise((c) => requestAnimationFrame(c)), await new Promise((c) => requestAnimationFrame(c)), i.isolate ? await this.#h(i) : await this.#g(), this.emit("print-complete", {
|
|
4022
4071
|
success: !0,
|
|
4023
4072
|
rowCount: o,
|
|
4024
4073
|
duration: Math.round(performance.now() - l)
|
|
@@ -4044,16 +4093,16 @@ Click OK to continue, or Cancel to abort.`
|
|
|
4044
4093
|
const i = document.createElement("div");
|
|
4045
4094
|
i.className = "tbw-print-header-timestamp", i.textContent = `Printed: ${(/* @__PURE__ */ new Date()).toLocaleString()}`, this.#i.appendChild(i);
|
|
4046
4095
|
}
|
|
4047
|
-
t.insertBefore(this.#i, t.firstChild), this.#
|
|
4096
|
+
t.insertBefore(this.#i, t.firstChild), this.#s = document.createElement("div"), this.#s.className = "tbw-print-footer", this.#s.textContent = `Page generated from ${window.location.hostname}`, t.appendChild(this.#s);
|
|
4048
4097
|
}
|
|
4049
4098
|
}
|
|
4050
|
-
async #
|
|
4099
|
+
async #m() {
|
|
4051
4100
|
const e = this.#r;
|
|
4052
4101
|
if (!e._virtualization) return;
|
|
4053
4102
|
const t = this.rows.length;
|
|
4054
4103
|
e._virtualization.bypassThreshold = t + 100, e.refreshVirtualWindow(!0), await new Promise((i) => setTimeout(i, 100));
|
|
4055
4104
|
}
|
|
4056
|
-
async #
|
|
4105
|
+
async #g() {
|
|
4057
4106
|
return new Promise((e) => {
|
|
4058
4107
|
const t = () => {
|
|
4059
4108
|
window.removeEventListener("afterprint", t), e();
|
|
@@ -4063,13 +4112,13 @@ Click OK to continue, or Cancel to abort.`
|
|
|
4063
4112
|
}, 1e3);
|
|
4064
4113
|
});
|
|
4065
4114
|
}
|
|
4066
|
-
async #
|
|
4115
|
+
async #h(e) {
|
|
4067
4116
|
const t = this.gridElement;
|
|
4068
4117
|
t && await Ki(t, {
|
|
4069
4118
|
orientation: e.orientation
|
|
4070
4119
|
});
|
|
4071
4120
|
}
|
|
4072
|
-
#
|
|
4121
|
+
#p() {
|
|
4073
4122
|
const e = this.columns;
|
|
4074
4123
|
if (e) {
|
|
4075
4124
|
this.#t = /* @__PURE__ */ new Map();
|
|
@@ -4077,7 +4126,7 @@ Click OK to continue, or Cancel to abort.`
|
|
|
4077
4126
|
t.printHidden && t.field && (this.#t.set(t.field, !t.hidden), this.grid.setColumnVisible(t.field, !1));
|
|
4078
4127
|
}
|
|
4079
4128
|
}
|
|
4080
|
-
#
|
|
4129
|
+
#o() {
|
|
4081
4130
|
if (this.#t) {
|
|
4082
4131
|
for (const [e, t] of this.#t)
|
|
4083
4132
|
this.grid.setColumnVisible(e, t);
|
|
@@ -4087,15 +4136,15 @@ Click OK to continue, or Cancel to abort.`
|
|
|
4087
4136
|
#f() {
|
|
4088
4137
|
const e = this.gridElement;
|
|
4089
4138
|
if (!e) return;
|
|
4090
|
-
this.#
|
|
4139
|
+
this.#o(), e.classList.remove("print-portrait", "print-landscape"), this.#d !== null && (e.style.transform = "", e.style.transformOrigin = "", e.style.width = "", this.#d = null), this.#i && (this.#i.remove(), this.#i = null), this.#s && (this.#s.remove(), this.#s = null);
|
|
4091
4140
|
const t = this.#r;
|
|
4092
|
-
this.#
|
|
4141
|
+
this.#a && t._virtualization && (t._virtualization.bypassThreshold = this.#a.bypassThreshold, t.refreshVirtualWindow(!0), this.#a = null), this.#n !== null && (this.grid.rows = this.#n, this.#n = null);
|
|
4093
4142
|
}
|
|
4094
4143
|
afterRender() {
|
|
4095
|
-
this.config?.button && !this.#
|
|
4144
|
+
this.config?.button && !this.#l && (this.#u(), this.#l = !0);
|
|
4096
4145
|
}
|
|
4097
|
-
#
|
|
4098
|
-
#
|
|
4146
|
+
#l = !1;
|
|
4147
|
+
#u() {
|
|
4099
4148
|
this.#r.registerToolbarContent?.({
|
|
4100
4149
|
id: "print-button",
|
|
4101
4150
|
order: 900,
|
|
@@ -4124,7 +4173,7 @@ function $e(a, e, t) {
|
|
|
4124
4173
|
return i.splice(t, 0, n), i;
|
|
4125
4174
|
}
|
|
4126
4175
|
const Bi = '@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}}';
|
|
4127
|
-
class Sn extends
|
|
4176
|
+
class Sn extends _ {
|
|
4128
4177
|
name = "reorder";
|
|
4129
4178
|
styles = Bi;
|
|
4130
4179
|
get defaultConfig() {
|
|
@@ -4190,13 +4239,13 @@ class Sn extends A {
|
|
|
4190
4239
|
const l = this.draggedField, d = this.draggedIndex, c = this.dropIndex;
|
|
4191
4240
|
if (!this.isDragging || l === null || d === null || c === null)
|
|
4192
4241
|
return;
|
|
4193
|
-
const u = c > d ? c - 1 : c, h = this.getColumnOrder(),
|
|
4242
|
+
const u = c > d ? c - 1 : c, h = this.getColumnOrder(), f = $e(h, d, u), g = {
|
|
4194
4243
|
field: l,
|
|
4195
4244
|
fromIndex: d,
|
|
4196
4245
|
toIndex: u,
|
|
4197
|
-
columnOrder:
|
|
4246
|
+
columnOrder: f
|
|
4198
4247
|
};
|
|
4199
|
-
this.emitCancelable("column-move",
|
|
4248
|
+
this.emitCancelable("column-move", g) || this.updateColumnOrder(f);
|
|
4200
4249
|
}));
|
|
4201
4250
|
});
|
|
4202
4251
|
}
|
|
@@ -4213,7 +4262,7 @@ class Sn extends A {
|
|
|
4213
4262
|
if (l < 0 || l >= o.length) return;
|
|
4214
4263
|
const d = n.find((c) => c.field === o[l]);
|
|
4215
4264
|
if (this.canMoveColumnWithPlugins(d))
|
|
4216
|
-
return this.moveColumn(r.field, l), t._focusCol = l,
|
|
4265
|
+
return this.moveColumn(r.field, l), t._focusCol = l, P(this.grid), e.preventDefault(), e.stopPropagation(), !0;
|
|
4217
4266
|
}
|
|
4218
4267
|
getColumnOrder() {
|
|
4219
4268
|
return this.grid.getColumnOrder();
|
|
@@ -4317,7 +4366,7 @@ class Sn extends A {
|
|
|
4317
4366
|
}
|
|
4318
4367
|
}
|
|
4319
4368
|
const Vi = '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-inline-start: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;inset-inline-start: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-inline-end: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-inline-end: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}}';
|
|
4320
|
-
class kn extends
|
|
4369
|
+
class kn extends _ {
|
|
4321
4370
|
name = "responsive";
|
|
4322
4371
|
version = "1.0.0";
|
|
4323
4372
|
styles = Vi;
|
|
@@ -4337,10 +4386,10 @@ class kn extends A {
|
|
|
4337
4386
|
};
|
|
4338
4387
|
#e;
|
|
4339
4388
|
#t = !1;
|
|
4340
|
-
#
|
|
4389
|
+
#a;
|
|
4341
4390
|
#n = !1;
|
|
4342
4391
|
#i = 0;
|
|
4343
|
-
#
|
|
4392
|
+
#s = /* @__PURE__ */ new Set();
|
|
4344
4393
|
#d = /* @__PURE__ */ new Set();
|
|
4345
4394
|
#r = null;
|
|
4346
4395
|
#c = [];
|
|
@@ -4355,7 +4404,7 @@ class kn extends A {
|
|
|
4355
4404
|
}));
|
|
4356
4405
|
}
|
|
4357
4406
|
setBreakpoint(e) {
|
|
4358
|
-
this.config.breakpoint = e, this.#
|
|
4407
|
+
this.config.breakpoint = e, this.#h(this.#i);
|
|
4359
4408
|
}
|
|
4360
4409
|
setCardRenderer(e) {
|
|
4361
4410
|
this.config.cardRenderer = e, this.#t && this.requestRender();
|
|
@@ -4367,14 +4416,14 @@ class kn extends A {
|
|
|
4367
4416
|
return this.#r;
|
|
4368
4417
|
}
|
|
4369
4418
|
attach(e) {
|
|
4370
|
-
super.attach(e), this.#
|
|
4419
|
+
super.attach(e), this.#m(), this.#g(this.config.hiddenColumns), this.config.breakpoints?.length && (this.#c = [...this.config.breakpoints].sort((t, i) => i.maxWidth - t.maxWidth)), this.#e = new ResizeObserver((t) => {
|
|
4371
4420
|
const i = t[0]?.contentRect.width ?? 0;
|
|
4372
|
-
this.#i = i, clearTimeout(this.#
|
|
4373
|
-
this.#
|
|
4421
|
+
this.#i = i, clearTimeout(this.#a), this.#a = setTimeout(() => {
|
|
4422
|
+
this.#h(i);
|
|
4374
4423
|
}, this.config.debounceMs ?? 100);
|
|
4375
4424
|
}), this.#e.observe(this.gridElement);
|
|
4376
4425
|
}
|
|
4377
|
-
#
|
|
4426
|
+
#m() {
|
|
4378
4427
|
const e = this.grid;
|
|
4379
4428
|
if (!e || typeof e.querySelector != "function") return;
|
|
4380
4429
|
const t = e.querySelector("tbw-grid-responsive-card");
|
|
@@ -4395,17 +4444,17 @@ class kn extends A {
|
|
|
4395
4444
|
}
|
|
4396
4445
|
const c = t.innerHTML.trim();
|
|
4397
4446
|
c && !this.config.cardRenderer && !i.__frameworkAdapter?.parseResponsiveCardElement && (d.cardRenderer = (u) => {
|
|
4398
|
-
const h = Je(c, { value: u, row: u }),
|
|
4399
|
-
return
|
|
4447
|
+
const h = Je(c, { value: u, row: u }), f = et(h), g = document.createElement("div");
|
|
4448
|
+
return g.className = "tbw-responsive-card-content", g.innerHTML = f, g;
|
|
4400
4449
|
}), Object.keys(d).length > 0 && (this.config = { ...this.config, ...d });
|
|
4401
4450
|
}
|
|
4402
|
-
#
|
|
4403
|
-
if (this.#
|
|
4451
|
+
#g(e) {
|
|
4452
|
+
if (this.#s.clear(), this.#d.clear(), !!e)
|
|
4404
4453
|
for (const t of e)
|
|
4405
|
-
typeof t == "string" ? this.#
|
|
4454
|
+
typeof t == "string" ? this.#s.add(t) : t.showValue ? this.#d.add(t.field) : this.#s.add(t.field);
|
|
4406
4455
|
}
|
|
4407
4456
|
detach() {
|
|
4408
|
-
this.#e?.disconnect(), this.#e = void 0, clearTimeout(this.#
|
|
4457
|
+
this.#e?.disconnect(), this.#e = void 0, clearTimeout(this.#a), this.#a = void 0, this.gridElement && this.gridElement.removeAttribute("data-responsive"), super.detach();
|
|
4409
4458
|
}
|
|
4410
4459
|
handleQuery(e) {
|
|
4411
4460
|
if (e.type === "isCardMode")
|
|
@@ -4414,18 +4463,18 @@ class kn extends A {
|
|
|
4414
4463
|
afterRender() {
|
|
4415
4464
|
if (this.#R(), !(this.#c.length > 0 ? this.#r !== null : this.#t))
|
|
4416
4465
|
return;
|
|
4417
|
-
const t = this.#
|
|
4466
|
+
const t = this.#s.size > 0, i = this.#d.size > 0;
|
|
4418
4467
|
if (!t && !i)
|
|
4419
4468
|
return;
|
|
4420
4469
|
const n = this.gridElement.querySelectorAll(".cell[data-field]");
|
|
4421
4470
|
for (const r of n) {
|
|
4422
4471
|
const o = r.getAttribute("data-field");
|
|
4423
|
-
o && (this.#
|
|
4472
|
+
o && (this.#s.has(o) ? (r.setAttribute("data-responsive-hidden", ""), r.removeAttribute("data-responsive-value-only")) : this.#d.has(o) ? (r.setAttribute("data-responsive-value-only", ""), r.removeAttribute("data-responsive-hidden")) : (r.removeAttribute("data-responsive-hidden"), r.removeAttribute("data-responsive-value-only")));
|
|
4424
4473
|
}
|
|
4425
4474
|
}
|
|
4426
|
-
#
|
|
4475
|
+
#h(e) {
|
|
4427
4476
|
if (this.#c.length > 0) {
|
|
4428
|
-
this.#
|
|
4477
|
+
this.#p(e);
|
|
4429
4478
|
return;
|
|
4430
4479
|
}
|
|
4431
4480
|
const t = this.config.breakpoint ?? 0;
|
|
@@ -4439,12 +4488,12 @@ class kn extends A {
|
|
|
4439
4488
|
breakpoint: t
|
|
4440
4489
|
}), this.requestRender());
|
|
4441
4490
|
}
|
|
4442
|
-
#
|
|
4491
|
+
#p(e) {
|
|
4443
4492
|
let t = null;
|
|
4444
4493
|
for (const n of this.#c)
|
|
4445
4494
|
e <= n.maxWidth && (t = n);
|
|
4446
4495
|
if (t !== this.#r) {
|
|
4447
|
-
this.#r = t, t?.hiddenColumns ? this.#
|
|
4496
|
+
this.#r = t, t?.hiddenColumns ? this.#g(t.hiddenColumns) : this.#g(this.config.hiddenColumns);
|
|
4448
4497
|
const n = t?.cardLayout === !0;
|
|
4449
4498
|
n !== this.#t && (this.#t = n, this.#f()), this.emit("responsive-change", {
|
|
4450
4499
|
isResponsive: this.#t,
|
|
@@ -4453,21 +4502,21 @@ class kn extends A {
|
|
|
4453
4502
|
}), this.requestRender();
|
|
4454
4503
|
}
|
|
4455
4504
|
}
|
|
4456
|
-
#
|
|
4505
|
+
#o;
|
|
4457
4506
|
#f() {
|
|
4458
4507
|
this.gridElement.toggleAttribute("data-responsive", this.#t);
|
|
4459
4508
|
const e = this.config.animate !== !1;
|
|
4460
4509
|
this.gridElement.toggleAttribute("data-responsive-animate", e), this.config.animationDuration && this.gridElement.style.setProperty("--tbw-responsive-duration", `${this.config.animationDuration}ms`);
|
|
4461
4510
|
const t = this.grid;
|
|
4462
4511
|
if (this.#t) {
|
|
4463
|
-
t._virtualization && (this.#
|
|
4512
|
+
t._virtualization && (this.#o = t._virtualization.rowHeight);
|
|
4464
4513
|
const i = this.gridElement.querySelector(".tbw-scroll-area");
|
|
4465
4514
|
i && (i.scrollLeft = 0);
|
|
4466
4515
|
} else {
|
|
4467
4516
|
const i = this.gridElement.querySelectorAll(".data-grid-row");
|
|
4468
4517
|
for (const n of i)
|
|
4469
4518
|
n.style.height = "", n.classList.remove("responsive-card");
|
|
4470
|
-
this.#
|
|
4519
|
+
this.#o && this.#o > 0 && t._virtualization && (t._virtualization.rowHeight = this.#o, this.#o = void 0), this.#l = void 0, this.#u = void 0, this.#w = void 0;
|
|
4471
4520
|
}
|
|
4472
4521
|
}
|
|
4473
4522
|
renderRow(e, t, i) {
|
|
@@ -4486,40 +4535,40 @@ class kn extends A {
|
|
|
4486
4535
|
switch (e.key) {
|
|
4487
4536
|
case "ArrowDown":
|
|
4488
4537
|
if (this.grid._focusCol < i)
|
|
4489
|
-
return this.grid._focusCol += 1, e.preventDefault(),
|
|
4538
|
+
return this.grid._focusCol += 1, e.preventDefault(), P(this.grid), !0;
|
|
4490
4539
|
if (this.grid._focusRow < t)
|
|
4491
|
-
return this.grid._focusRow += 1, this.grid._focusCol = 0, e.preventDefault(),
|
|
4540
|
+
return this.grid._focusRow += 1, this.grid._focusCol = 0, e.preventDefault(), P(this.grid), !0;
|
|
4492
4541
|
break;
|
|
4493
4542
|
case "ArrowUp":
|
|
4494
4543
|
if (this.grid._focusCol > 0)
|
|
4495
|
-
return this.grid._focusCol -= 1, e.preventDefault(),
|
|
4544
|
+
return this.grid._focusCol -= 1, e.preventDefault(), P(this.grid), !0;
|
|
4496
4545
|
if (this.grid._focusRow > 0)
|
|
4497
|
-
return this.grid._focusRow -= 1, this.grid._focusCol = i, e.preventDefault(),
|
|
4546
|
+
return this.grid._focusRow -= 1, this.grid._focusCol = i, e.preventDefault(), P(this.grid), !0;
|
|
4498
4547
|
break;
|
|
4499
4548
|
case "ArrowRight":
|
|
4500
4549
|
if (this.grid._focusRow < t)
|
|
4501
|
-
return this.grid._focusRow += 1, e.preventDefault(),
|
|
4550
|
+
return this.grid._focusRow += 1, e.preventDefault(), P(this.grid), !0;
|
|
4502
4551
|
break;
|
|
4503
4552
|
case "ArrowLeft":
|
|
4504
4553
|
if (this.grid._focusRow > 0)
|
|
4505
|
-
return this.grid._focusRow -= 1, e.preventDefault(),
|
|
4554
|
+
return this.grid._focusRow -= 1, e.preventDefault(), P(this.grid), !0;
|
|
4506
4555
|
break;
|
|
4507
4556
|
}
|
|
4508
4557
|
return !1;
|
|
4509
4558
|
}
|
|
4559
|
+
#l;
|
|
4510
4560
|
#u;
|
|
4511
|
-
#
|
|
4512
|
-
#
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
return this.#u;
|
|
4561
|
+
#w;
|
|
4562
|
+
#b() {
|
|
4563
|
+
if (this.#l && this.#l > 0)
|
|
4564
|
+
return this.#l;
|
|
4516
4565
|
const e = this.config.cardRowHeight;
|
|
4517
4566
|
return typeof e == "number" && e > 0 ? e : 80;
|
|
4518
4567
|
}
|
|
4519
4568
|
#x() {
|
|
4520
|
-
return this.#
|
|
4569
|
+
return this.#u && this.#u > 0 ? this.#u : this.#o ?? 28;
|
|
4521
4570
|
}
|
|
4522
|
-
#
|
|
4571
|
+
#v() {
|
|
4523
4572
|
for (const e of this.rows)
|
|
4524
4573
|
if (e.__isGroupRow)
|
|
4525
4574
|
return !0;
|
|
@@ -4532,15 +4581,15 @@ class kn extends A {
|
|
|
4532
4581
|
return { groupCount: e, cardCount: t };
|
|
4533
4582
|
}
|
|
4534
4583
|
getExtraHeight() {
|
|
4535
|
-
if (!this.#t || !this.config.cardRenderer || !this.#
|
|
4584
|
+
if (!this.#t || !this.config.cardRenderer || !this.#v())
|
|
4536
4585
|
return 0;
|
|
4537
|
-
const e = this.#
|
|
4586
|
+
const e = this.#o ?? 28, t = this.#x(), i = this.#b(), { groupCount: n, cardCount: r } = this.#C(), o = n * Math.max(0, t - e), s = r * Math.max(0, i - e);
|
|
4538
4587
|
return o + s;
|
|
4539
4588
|
}
|
|
4540
4589
|
getExtraHeightBefore(e) {
|
|
4541
|
-
if (!this.#t || !this.config.cardRenderer || !this.#
|
|
4590
|
+
if (!this.#t || !this.config.cardRenderer || !this.#v())
|
|
4542
4591
|
return 0;
|
|
4543
|
-
const t = this.#
|
|
4592
|
+
const t = this.#o ?? 28, i = this.#x(), n = this.#b(), r = Math.max(0, i - t), o = Math.max(0, n - t);
|
|
4544
4593
|
let s = 0, l = 0;
|
|
4545
4594
|
const d = this.rows, c = Math.min(e, d.length);
|
|
4546
4595
|
for (let u = 0; u < c; u++)
|
|
@@ -4553,31 +4602,31 @@ class kn extends A {
|
|
|
4553
4602
|
t.__isGroupRow || e++;
|
|
4554
4603
|
return e;
|
|
4555
4604
|
}
|
|
4556
|
-
#
|
|
4605
|
+
#y = !1;
|
|
4557
4606
|
#R() {
|
|
4558
4607
|
if (!this.#t || !this.config.cardRenderer)
|
|
4559
4608
|
return;
|
|
4560
4609
|
let e = !1;
|
|
4561
|
-
const t = this.grid, i = this.#
|
|
4562
|
-
if (n !== this.#
|
|
4610
|
+
const t = this.grid, i = this.#v(), n = this.#E();
|
|
4611
|
+
if (n !== this.#w && (this.#w = n, e = !0), i) {
|
|
4563
4612
|
const o = this.gridElement.querySelector(".data-grid-row.group-row");
|
|
4564
4613
|
if (o) {
|
|
4565
4614
|
const s = o.getBoundingClientRect().height;
|
|
4566
|
-
s > 0 && s !== this.#
|
|
4615
|
+
s > 0 && s !== this.#u && (this.#u = s, e = !0);
|
|
4567
4616
|
}
|
|
4568
4617
|
}
|
|
4569
4618
|
const r = this.gridElement.querySelector(".data-grid-row.responsive-card");
|
|
4570
4619
|
if (r) {
|
|
4571
4620
|
const o = r.getBoundingClientRect().height;
|
|
4572
|
-
o > 0 && o !== this.#
|
|
4621
|
+
o > 0 && o !== this.#l && (this.#l = o, e = !0, !i && t._virtualization && (t._virtualization.rowHeight = o));
|
|
4573
4622
|
}
|
|
4574
|
-
e && !this.#
|
|
4575
|
-
this.#
|
|
4623
|
+
e && !this.#y && (this.#y = !0, queueMicrotask(() => {
|
|
4624
|
+
this.#y = !1, this.grid && this.#t && this.grid.refreshVirtualWindow?.(!0, !0);
|
|
4576
4625
|
}));
|
|
4577
4626
|
}
|
|
4578
4627
|
}
|
|
4579
4628
|
const Wi = '@layer tbw-plugins{[data-field=__tbw_row_drag]{display:flex;align-items:center;justify-content:center}.dg-row-drag-handle{display:flex;align-items:center;justify-content:center;min-width:1em;min-height:1em;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}}', $i = "__tbw_row_drag";
|
|
4580
|
-
class An extends
|
|
4629
|
+
class An extends _ {
|
|
4581
4630
|
name = "rowReorder";
|
|
4582
4631
|
styles = Wi;
|
|
4583
4632
|
get defaultConfig() {
|
|
@@ -4700,7 +4749,7 @@ class An extends A {
|
|
|
4700
4749
|
row: e
|
|
4701
4750
|
}, this.lastFocusCol = r;
|
|
4702
4751
|
const o = this.grid, s = [...o._rows ?? this.sourceRows], [l] = s.splice(t, 1);
|
|
4703
|
-
s.splice(i, 0, l), o._rows = s, o._focusRow = i, o._focusCol = r, o.refreshVirtualWindow(!0),
|
|
4752
|
+
s.splice(i, 0, l), o._rows = s, o._focusRow = i, o._focusCol = r, o.refreshVirtualWindow(!0), P(o), this.clearDebounceTimer(), this.debounceTimer = setTimeout(() => {
|
|
4704
4753
|
this.flushPendingMove();
|
|
4705
4754
|
}, this.config.debounceMs ?? 300);
|
|
4706
4755
|
}
|
|
@@ -4719,7 +4768,7 @@ class An extends A {
|
|
|
4719
4768
|
const o = [...this.sourceRows], [s] = o.splice(t, 1);
|
|
4720
4769
|
o.splice(e, 0, s);
|
|
4721
4770
|
const l = this.grid;
|
|
4722
|
-
l._rows = o, l._focusRow = e, l._focusCol = this.lastFocusCol, l.refreshVirtualWindow(!0),
|
|
4771
|
+
l._rows = o, l._focusRow = e, l._focusCol = this.lastFocusCol, l.refreshVirtualWindow(!0), P(l);
|
|
4723
4772
|
}
|
|
4724
4773
|
}
|
|
4725
4774
|
executeMove(e, t, i, n) {
|
|
@@ -4757,9 +4806,9 @@ class An extends A {
|
|
|
4757
4806
|
if (u < 0 || u < r || u > o) return;
|
|
4758
4807
|
let h;
|
|
4759
4808
|
u === i ? h = t : t < i ? h = u + 1 : h = u - 1;
|
|
4760
|
-
const
|
|
4761
|
-
if (
|
|
4762
|
-
const
|
|
4809
|
+
const f = e.get(h);
|
|
4810
|
+
if (f === void 0) return;
|
|
4811
|
+
const g = c.getBoundingClientRect().top, p = f - g;
|
|
4763
4812
|
Math.abs(p) > 1 && s.push({ el: c, deltaY: p });
|
|
4764
4813
|
}), s.length === 0) return;
|
|
4765
4814
|
s.forEach(({ el: d, deltaY: c }) => {
|
|
@@ -4836,7 +4885,7 @@ function de(a, e) {
|
|
|
4836
4885
|
endCol: e.col
|
|
4837
4886
|
};
|
|
4838
4887
|
}
|
|
4839
|
-
function
|
|
4888
|
+
function Q(a, e) {
|
|
4840
4889
|
const t = V(a), i = V(e);
|
|
4841
4890
|
return t.startRow === i.startRow && t.startCol === i.startCol && t.endRow === i.endRow && t.endCol === i.endCol;
|
|
4842
4891
|
}
|
|
@@ -4861,7 +4910,7 @@ function Qi(a, e, t) {
|
|
|
4861
4910
|
}
|
|
4862
4911
|
return a === "range" && e.ranges.length > 0 ? { mode: a, ranges: lt(e.ranges) } : { mode: a, ranges: [] };
|
|
4863
4912
|
}
|
|
4864
|
-
class _n extends
|
|
4913
|
+
class _n extends _ {
|
|
4865
4914
|
static manifest = {
|
|
4866
4915
|
queries: [{ type: "getSelection", description: "Get the current selection state" }],
|
|
4867
4916
|
configRules: [
|
|
@@ -4943,7 +4992,7 @@ class _n extends A {
|
|
|
4943
4992
|
const d = n.shiftKey, c = n.ctrlKey || n.metaKey;
|
|
4944
4993
|
if (d && this.cellAnchor) {
|
|
4945
4994
|
const u = de(this.cellAnchor, { row: t, col: i }), h = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null;
|
|
4946
|
-
if (h &&
|
|
4995
|
+
if (h && Q(h, u))
|
|
4947
4996
|
return !1;
|
|
4948
4997
|
c ? this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] = u : this.ranges.push(u) : this.ranges = [u], this.activeRange = u;
|
|
4949
4998
|
} else if (c) {
|
|
@@ -4961,7 +5010,7 @@ class _n extends A {
|
|
|
4961
5010
|
endRow: t,
|
|
4962
5011
|
endCol: i
|
|
4963
5012
|
};
|
|
4964
|
-
if (this.ranges.length === 1 &&
|
|
5013
|
+
if (this.ranges.length === 1 && Q(this.ranges[0], u))
|
|
4965
5014
|
return !1;
|
|
4966
5015
|
this.ranges = [u], this.activeRange = u, this.cellAnchor = { row: t, col: i };
|
|
4967
5016
|
}
|
|
@@ -5015,7 +5064,7 @@ class _n extends A {
|
|
|
5015
5064
|
endRow: i,
|
|
5016
5065
|
endCol: n
|
|
5017
5066
|
};
|
|
5018
|
-
return !r && this.ranges.length === 1 &&
|
|
5067
|
+
return !r && this.ranges.length === 1 && Q(this.ranges[0], o) ? (this.cellAnchor = { row: i, col: n }, !0) : (this.cellAnchor = { row: i, col: n }, r || (this.ranges = []), this.ranges.push(o), this.activeRange = o, this.emit("selection-change", this.#t()), this.requestAfterRender(), !0);
|
|
5019
5068
|
}
|
|
5020
5069
|
onCellMouseMove(e) {
|
|
5021
5070
|
if (!this.isSelectionEnabled() || this.config.mode !== "range" || !this.isDragging || !this.cellAnchor || e.rowIndex === void 0 || e.colIndex === void 0 || e.rowIndex < 0) return;
|
|
@@ -5026,7 +5075,7 @@ class _n extends A {
|
|
|
5026
5075
|
o >= 0 && (t = o);
|
|
5027
5076
|
}
|
|
5028
5077
|
const n = de(this.cellAnchor, { row: e.rowIndex, col: t }), r = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null;
|
|
5029
|
-
return r &&
|
|
5078
|
+
return r && Q(r, n) || (this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] = n : this.ranges.push(n), this.activeRange = n, this.emit("selection-change", this.#t()), this.requestAfterRender()), !0;
|
|
5030
5079
|
}
|
|
5031
5080
|
onCellMouseUp(e) {
|
|
5032
5081
|
if (this.isSelectionEnabled() && this.config.mode === "range" && this.isDragging)
|
|
@@ -5059,8 +5108,8 @@ class _n extends A {
|
|
|
5059
5108
|
return;
|
|
5060
5109
|
if (je(c, u, this.ranges) && (d.classList.add("selected"), o)) {
|
|
5061
5110
|
c === o.startRow && d.classList.add("top"), c === o.endRow && d.classList.add("bottom");
|
|
5062
|
-
const
|
|
5063
|
-
u ===
|
|
5111
|
+
const g = Math.max(o.startCol, s);
|
|
5112
|
+
u === g && d.classList.add("first"), u === o.endCol && d.classList.add("last");
|
|
5064
5113
|
}
|
|
5065
5114
|
}
|
|
5066
5115
|
});
|
|
@@ -5125,7 +5174,7 @@ class _n extends A {
|
|
|
5125
5174
|
);
|
|
5126
5175
|
}
|
|
5127
5176
|
}
|
|
5128
|
-
function
|
|
5177
|
+
function ee(a, e) {
|
|
5129
5178
|
return Math.floor(a / e);
|
|
5130
5179
|
}
|
|
5131
5180
|
function Ji(a, e) {
|
|
@@ -5135,7 +5184,7 @@ function Ji(a, e) {
|
|
|
5135
5184
|
};
|
|
5136
5185
|
}
|
|
5137
5186
|
function en(a, e, t) {
|
|
5138
|
-
const i =
|
|
5187
|
+
const i = ee(a, t), n = ee(e - 1, t), r = [];
|
|
5139
5188
|
for (let o = i; o <= n; o++)
|
|
5140
5189
|
r.push(o);
|
|
5141
5190
|
return r;
|
|
@@ -5150,13 +5199,13 @@ async function Ue(a, e, t, i) {
|
|
|
5150
5199
|
});
|
|
5151
5200
|
}
|
|
5152
5201
|
function tn(a, e, t) {
|
|
5153
|
-
const i =
|
|
5202
|
+
const i = ee(a, e), n = t.get(i);
|
|
5154
5203
|
if (!n) return;
|
|
5155
5204
|
const r = a % e;
|
|
5156
5205
|
return n[r];
|
|
5157
5206
|
}
|
|
5158
5207
|
const nn = 100;
|
|
5159
|
-
class Tn extends
|
|
5208
|
+
class Tn extends _ {
|
|
5160
5209
|
name = "serverSide";
|
|
5161
5210
|
get defaultConfig() {
|
|
5162
5211
|
return {
|
|
@@ -5219,7 +5268,7 @@ class Tn extends A {
|
|
|
5219
5268
|
return this.totalRowCount;
|
|
5220
5269
|
}
|
|
5221
5270
|
isRowLoaded(e) {
|
|
5222
|
-
const t = this.config.cacheBlockSize ?? 100, i =
|
|
5271
|
+
const t = this.config.cacheBlockSize ?? 100, i = ee(e, t);
|
|
5223
5272
|
return this.loadedBlocks.has(i);
|
|
5224
5273
|
}
|
|
5225
5274
|
getLoadedBlockCount() {
|
|
@@ -5233,13 +5282,13 @@ function ce(a, e) {
|
|
|
5233
5282
|
const t = new Set(a);
|
|
5234
5283
|
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
5235
5284
|
}
|
|
5236
|
-
function
|
|
5285
|
+
function ge(a, e, t = null, i = 0) {
|
|
5237
5286
|
const n = e.childrenField ?? "children", r = /* @__PURE__ */ new Set();
|
|
5238
5287
|
for (let o = 0; o < a.length; o++) {
|
|
5239
5288
|
const s = a[o], l = dt(s, o, t), d = s[n];
|
|
5240
5289
|
if (Array.isArray(d) && d.length > 0) {
|
|
5241
5290
|
r.add(l);
|
|
5242
|
-
const c =
|
|
5291
|
+
const c = ge(d, e, l, i + 1);
|
|
5243
5292
|
for (const u of c) r.add(u);
|
|
5244
5293
|
}
|
|
5245
5294
|
}
|
|
@@ -5294,7 +5343,7 @@ function sn(a) {
|
|
|
5294
5343
|
return null;
|
|
5295
5344
|
}
|
|
5296
5345
|
const an = "@layer tbw-plugins{tbw-grid{.cell[data-field=__tbw_expander]{border-inline-end: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-inline-start: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}}}";
|
|
5297
|
-
class Ln extends
|
|
5346
|
+
class Ln extends _ {
|
|
5298
5347
|
static manifest = {
|
|
5299
5348
|
events: [
|
|
5300
5349
|
{
|
|
@@ -5351,7 +5400,7 @@ class Ln extends A {
|
|
|
5351
5400
|
if (!Ye(i, t))
|
|
5352
5401
|
return this.flattenedRows = [], this.rowKeyMap.clear(), this.previousVisibleKeys.clear(), [...e];
|
|
5353
5402
|
let n = this.withStableKeys(i);
|
|
5354
|
-
this.sortState && (n = this.sortTree(n, this.sortState.field, this.sortState.direction)), this.config.defaultExpanded && !this.initialExpansionDone && (this.expandedKeys =
|
|
5403
|
+
this.sortState && (n = this.sortTree(n, this.sortState.field, this.sortState.direction)), this.config.defaultExpanded && !this.initialExpansionDone && (this.expandedKeys = ge(n, this.config), this.initialExpansionDone = !0), this.flattenedRows = this.flattenTree(n, this.expandedKeys), this.rowKeyMap.clear(), this.keysToAnimate.clear();
|
|
5355
5404
|
const r = /* @__PURE__ */ new Set();
|
|
5356
5405
|
for (const o of this.flattenedRows)
|
|
5357
5406
|
this.rowKeyMap.set(o.key, o), r.add(o.key), !this.previousVisibleKeys.has(o.key) && o.depth > 0 && this.keysToAnimate.add(o.key);
|
|
@@ -5404,11 +5453,11 @@ class Ln extends A {
|
|
|
5404
5453
|
const t = [...e];
|
|
5405
5454
|
if (t.length === 0) return t;
|
|
5406
5455
|
const i = t[0], n = i.viewRenderer, r = () => this.config, o = this.setIcon.bind(this), s = this.resolveIcon.bind(this), l = (d) => {
|
|
5407
|
-
const { row: c, value: u } = d, { showExpandIcons: h = !0, indentWidth:
|
|
5408
|
-
if (w.className = "tree-cell-wrapper", w.style.setProperty("--tbw-tree-depth", String(p)),
|
|
5409
|
-
if (
|
|
5456
|
+
const { row: c, value: u } = d, { showExpandIcons: h = !0, indentWidth: f } = r(), g = c, p = g.__treeDepth ?? 0, w = document.createElement("span");
|
|
5457
|
+
if (w.className = "tree-cell-wrapper", w.style.setProperty("--tbw-tree-depth", String(p)), f !== void 0 && w.style.setProperty("--tbw-tree-indent-width", `${f}px`), h)
|
|
5458
|
+
if (g.__treeHasChildren) {
|
|
5410
5459
|
const v = document.createElement("span");
|
|
5411
|
-
v.className = `tree-toggle${
|
|
5460
|
+
v.className = `tree-toggle${g.__treeExpanded ? " expanded" : ""}`, o(v, s(g.__treeExpanded ? "collapse" : "expand")), v.setAttribute("data-tree-key", String(g.__treeKey ?? "")), w.appendChild(v);
|
|
5412
5461
|
} else {
|
|
5413
5462
|
const v = document.createElement("span");
|
|
5414
5463
|
v.className = "tree-spacer", w.appendChild(v);
|
|
@@ -5476,7 +5525,7 @@ class Ln extends A {
|
|
|
5476
5525
|
this.expandedKeys = ce(this.expandedKeys, e), this.emitPluginEvent("tree-state-change", { expandedKeys: [...this.expandedKeys] }), this.requestRender();
|
|
5477
5526
|
}
|
|
5478
5527
|
expandAll() {
|
|
5479
|
-
this.expandedKeys =
|
|
5528
|
+
this.expandedKeys = ge(this.rows, this.config), this.emitPluginEvent("tree-state-change", { expandedKeys: [...this.expandedKeys] }), this.requestRender();
|
|
5480
5529
|
}
|
|
5481
5530
|
collapseAll() {
|
|
5482
5531
|
this.expandedKeys = rn(), this.emitPluginEvent("tree-state-change", { expandedKeys: [...this.expandedKeys] }), this.requestRender();
|
|
@@ -5549,7 +5598,7 @@ function hn(a, e, t, i) {
|
|
|
5549
5598
|
timestamp: Date.now()
|
|
5550
5599
|
};
|
|
5551
5600
|
}
|
|
5552
|
-
class In extends
|
|
5601
|
+
class In extends _ {
|
|
5553
5602
|
static dependencies = [
|
|
5554
5603
|
{ name: "editing", required: !0, reason: "UndoRedoPlugin tracks cell edit history" }
|
|
5555
5604
|
];
|
|
@@ -5639,18 +5688,18 @@ class In extends A {
|
|
|
5639
5688
|
return [...this.redoStack];
|
|
5640
5689
|
}
|
|
5641
5690
|
}
|
|
5642
|
-
const
|
|
5691
|
+
const fn = '@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))}}';
|
|
5643
5692
|
function Qe(a) {
|
|
5644
5693
|
const e = a.meta ?? {};
|
|
5645
5694
|
return e.lockPosition !== !0 && e.suppressMovable !== !0;
|
|
5646
5695
|
}
|
|
5647
|
-
class B extends
|
|
5696
|
+
class B extends _ {
|
|
5648
5697
|
static dependencies = [
|
|
5649
5698
|
{ name: "reorder", required: !1, reason: "Enables drag-to-reorder columns in visibility panel" }
|
|
5650
5699
|
];
|
|
5651
5700
|
name = "visibility";
|
|
5652
5701
|
static PANEL_ID = "columns";
|
|
5653
|
-
styles =
|
|
5702
|
+
styles = fn;
|
|
5654
5703
|
get defaultConfig() {
|
|
5655
5704
|
return {
|
|
5656
5705
|
allowHideAll: !1
|
|
@@ -5775,12 +5824,12 @@ class B extends A {
|
|
|
5775
5824
|
return;
|
|
5776
5825
|
const d = l > s ? l - 1 : l;
|
|
5777
5826
|
if (d !== s) {
|
|
5778
|
-
const c = this.grid.getAllColumns(), h = c.filter((p) => !p.utility)[d]?.field,
|
|
5827
|
+
const c = this.grid.getAllColumns(), h = c.filter((p) => !p.utility)[d]?.field, f = h ? c.findIndex((p) => p.field === h) : c.length, g = {
|
|
5779
5828
|
field: o,
|
|
5780
5829
|
fromIndex: s,
|
|
5781
|
-
toIndex:
|
|
5830
|
+
toIndex: f
|
|
5782
5831
|
};
|
|
5783
|
-
this.emit("column-reorder-request",
|
|
5832
|
+
this.emit("column-reorder-request", g), setTimeout(() => {
|
|
5784
5833
|
this.rebuildToggles(n);
|
|
5785
5834
|
}, 0);
|
|
5786
5835
|
}
|
|
@@ -5788,7 +5837,7 @@ class B extends A {
|
|
|
5788
5837
|
}
|
|
5789
5838
|
}
|
|
5790
5839
|
export {
|
|
5791
|
-
|
|
5840
|
+
_ as BaseGridPlugin,
|
|
5792
5841
|
pn as ClipboardPlugin,
|
|
5793
5842
|
mn as ColumnVirtualizationPlugin,
|
|
5794
5843
|
it as ContextMenuPlugin,
|