@toolbox-web/grid 1.9.2 → 1.10.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 +489 -402
- package/all.js.map +1 -1
- package/index.js +11 -6
- package/index.js.map +1 -1
- package/lib/core/grid.d.ts +31 -1
- package/lib/core/grid.d.ts.map +1 -1
- package/lib/core/types.d.ts +0 -64
- 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 +69 -0
- package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
- package/lib/plugins/editing/editors.d.ts.map +1 -1
- package/lib/plugins/editing/index.d.ts +1 -1
- package/lib/plugins/editing/index.d.ts.map +1 -1
- package/lib/plugins/editing/index.js +426 -293
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/editing/types.d.ts +117 -1
- 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 +7 -7
- 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.map +1 -1
- package/lib/plugins/responsive/index.js.map +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/public.d.ts +1 -1
- package/public.d.ts.map +1 -1
- package/umd/grid.all.umd.js +21 -21
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +2 -2
- 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/umd/plugins/pinned-rows.umd.js +1 -1
- package/umd/plugins/pinned-rows.umd.js.map +1 -1
package/all.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { BaseGridPlugin as A, DEFAULT_GRID_ICONS as ht,
|
|
2
|
-
import { DEFAULT_ANIMATION_CONFIG as
|
|
3
|
-
const tt = "__tbw_expander",
|
|
1
|
+
import { BaseGridPlugin as A, DEFAULT_GRID_ICONS as ht, runAggregator as ee, e as Je, s as et, g as ue, r as gt, getAggregator as ye, getValueAggregator as ft, a as D, c as xe, b as pt } from "./index.js";
|
|
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
|
+
const tt = "__tbw_expander", mt = 32;
|
|
4
4
|
function pe(a) {
|
|
5
5
|
return a.field === tt;
|
|
6
6
|
}
|
|
7
7
|
function q(a) {
|
|
8
8
|
return a.meta?.utility === !0;
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function wt(a) {
|
|
11
11
|
return a.find(pe);
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function bt(a) {
|
|
14
14
|
return {
|
|
15
15
|
field: tt,
|
|
16
16
|
header: "",
|
|
17
|
-
width:
|
|
17
|
+
width: mt,
|
|
18
18
|
resizable: !1,
|
|
19
19
|
sortable: !1,
|
|
20
20
|
filterable: !1,
|
|
@@ -49,14 +49,14 @@ function Ce(a, e) {
|
|
|
49
49
|
}
|
|
50
50
|
return o.push(s), (o.length > 1 || o.some((d) => d.trim() !== "")) && r.push(o), r;
|
|
51
51
|
}
|
|
52
|
-
async function
|
|
52
|
+
async function vt() {
|
|
53
53
|
try {
|
|
54
54
|
return await navigator.clipboard.readText();
|
|
55
55
|
} catch {
|
|
56
56
|
return "";
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function yt(a, e) {
|
|
60
60
|
const { rows: t, target: i, fields: n } = a;
|
|
61
61
|
if (!i) return;
|
|
62
62
|
const r = e.rows, o = e.effectiveConfig.columns ?? [], s = o.map((u) => u.field), l = /* @__PURE__ */ new Map();
|
|
@@ -81,7 +81,7 @@ function xt(a, e) {
|
|
|
81
81
|
}
|
|
82
82
|
}), e.rows = d;
|
|
83
83
|
}
|
|
84
|
-
class
|
|
84
|
+
class pn extends A {
|
|
85
85
|
static dependencies = [
|
|
86
86
|
{ name: "selection", required: !1, reason: "Enables copy/paste of selected cells instead of entire grid" }
|
|
87
87
|
];
|
|
@@ -128,7 +128,7 @@ class mn 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.#o(e);
|
|
132
132
|
if (!s) return;
|
|
133
133
|
r = { startRow: s.row, startCol: s.col, endRow: s.row, endCol: s.col };
|
|
134
134
|
}
|
|
@@ -151,13 +151,13 @@ class mn extends A {
|
|
|
151
151
|
b && !b.hidden && g.push(b.field);
|
|
152
152
|
}
|
|
153
153
|
const p = { rows: i, text: t, target: h, fields: g };
|
|
154
|
-
this.emit("paste", p), this.#
|
|
154
|
+
this.emit("paste", p), this.#s(p);
|
|
155
155
|
}
|
|
156
|
-
#
|
|
156
|
+
#s(e) {
|
|
157
157
|
if (!this.grid) return;
|
|
158
158
|
const { pasteHandler: t } = this.config;
|
|
159
159
|
if (t === null) return;
|
|
160
|
-
(t ??
|
|
160
|
+
(t ?? yt)(e, this.grid);
|
|
161
161
|
}
|
|
162
162
|
#n() {
|
|
163
163
|
return this.grid?.query("getSelection", void 0)?.[0];
|
|
@@ -184,7 +184,7 @@ class mn extends A {
|
|
|
184
184
|
columnCount: d - l + 1
|
|
185
185
|
};
|
|
186
186
|
}
|
|
187
|
-
#
|
|
187
|
+
#o(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;
|
|
@@ -220,7 +220,7 @@ class mn extends A {
|
|
|
220
220
|
return await te(r.text), this.lastCopied = { text: r.text, timestamp: Date.now() }, r.text;
|
|
221
221
|
}
|
|
222
222
|
async paste() {
|
|
223
|
-
const e = await
|
|
223
|
+
const e = await vt();
|
|
224
224
|
return e ? Ce(e, this.config) : null;
|
|
225
225
|
}
|
|
226
226
|
getLastCopied() {
|
|
@@ -249,11 +249,11 @@ function Se(a) {
|
|
|
249
249
|
function ke(a) {
|
|
250
250
|
return a.reduce((e, t) => e + me(t.width), 0);
|
|
251
251
|
}
|
|
252
|
-
function
|
|
252
|
+
function xt(a, e, t, i, n) {
|
|
253
253
|
const r = t.length;
|
|
254
254
|
if (r === 0)
|
|
255
255
|
return { startCol: 0, endCol: 0, visibleColumns: [] };
|
|
256
|
-
let o =
|
|
256
|
+
let o = Ct(a, t, i);
|
|
257
257
|
o = Math.max(0, o - n);
|
|
258
258
|
const s = a + e;
|
|
259
259
|
let l = o;
|
|
@@ -270,7 +270,7 @@ function Ct(a, e, t, i, n) {
|
|
|
270
270
|
d.push(c);
|
|
271
271
|
return { startCol: o, endCol: l, visibleColumns: d };
|
|
272
272
|
}
|
|
273
|
-
function
|
|
273
|
+
function Ct(a, e, t) {
|
|
274
274
|
let i = 0, n = e.length - 1;
|
|
275
275
|
for (; i < n; ) {
|
|
276
276
|
const r = Math.floor((i + n) / 2);
|
|
@@ -278,10 +278,10 @@ function Et(a, e, t) {
|
|
|
278
278
|
}
|
|
279
279
|
return i;
|
|
280
280
|
}
|
|
281
|
-
function
|
|
281
|
+
function Et(a, e, t) {
|
|
282
282
|
return t ? a > e : !1;
|
|
283
283
|
}
|
|
284
|
-
class
|
|
284
|
+
class mn extends A {
|
|
285
285
|
name = "columnVirtualization";
|
|
286
286
|
get defaultConfig() {
|
|
287
287
|
return {
|
|
@@ -320,14 +320,14 @@ class wn extends A {
|
|
|
320
320
|
}
|
|
321
321
|
processColumns(e) {
|
|
322
322
|
(this.originalColumns.length === 0 || e.length > this.originalColumns.length) && (this.originalColumns = e, this.columnWidths = Re(e), this.columnOffsets = Se(e), this.totalWidth = ke(e));
|
|
323
|
-
const i = this.originalColumns, n =
|
|
323
|
+
const i = this.originalColumns, n = Et(
|
|
324
324
|
i.length,
|
|
325
325
|
this.config.threshold ?? 30,
|
|
326
326
|
this.config.autoEnable ?? !0
|
|
327
327
|
);
|
|
328
328
|
if (this.isVirtualized = n ?? !1, !n)
|
|
329
329
|
return this.startCol = 0, this.endCol = i.length - 1, [...i];
|
|
330
|
-
const r = this.grid.clientWidth || 800, o =
|
|
330
|
+
const r = this.grid.clientWidth || 800, o = xt(
|
|
331
331
|
this.scrollLeft,
|
|
332
332
|
r,
|
|
333
333
|
this.columnOffsets,
|
|
@@ -373,7 +373,7 @@ const ie = "@layer tbw-plugins{.tbw-context-menu{position:fixed;background:var(-
|
|
|
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
|
-
function
|
|
376
|
+
function Rt(a, e) {
|
|
377
377
|
return a.disabled === !0 ? !0 : typeof a.disabled == "function" ? a.disabled(e) : !1;
|
|
378
378
|
}
|
|
379
379
|
function ge(a, e, t, i = ht.submenuArrow) {
|
|
@@ -387,7 +387,7 @@ function ge(a, e, t, i = ht.submenuArrow) {
|
|
|
387
387
|
}
|
|
388
388
|
const o = document.createElement("div");
|
|
389
389
|
o.className = "tbw-context-menu-item", r.cssClass && o.classList.add(r.cssClass), o.setAttribute("role", "menuitem"), o.setAttribute("data-id", r.id);
|
|
390
|
-
const s =
|
|
390
|
+
const s = Rt(r, e);
|
|
391
391
|
if (s && (o.classList.add("disabled"), o.setAttribute("aria-disabled", "true")), r.icon) {
|
|
392
392
|
const d = document.createElement("span");
|
|
393
393
|
d.className = "tbw-context-menu-icon", d.innerHTML = r.icon, o.appendChild(d);
|
|
@@ -589,12 +589,12 @@ class it extends A {
|
|
|
589
589
|
return this.isOpen;
|
|
590
590
|
}
|
|
591
591
|
}
|
|
592
|
-
const
|
|
593
|
-
function
|
|
592
|
+
const St = "@layer tbw-plugins{tbw-grid{--tbw-editing-bg: var(--tbw-color-selection);--tbw-editing-row-bg: var(--tbw-editing-bg);--tbw-editing-border: var(--tbw-border-input, 1px solid var(--tbw-color-border-strong));--tbw-padding-editing-input: var(--tbw-cell-padding-input, 2px 6px);--tbw-font-size-editor: inherit;--tbw-editing-row-outline-color: var(--tbw-color-accent);--tbw-editing-row-outline-width: 1px;.data-grid-row:has(.editing){background:var(--tbw-editing-row-bg);outline:var(--tbw-editing-row-outline-width) solid var(--tbw-editing-row-outline-color);outline-offset:calc(-1 * var(--tbw-editing-row-outline-width))}.data-grid-row>.cell.editing{overflow:hidden;padding:0;display:flex;min-height:calc(var(--tbw-row-height) + 2px);align-items:center;justify-content:center}.data-grid-row>.cell.editing input:not([type=checkbox]),.data-grid-row>.cell.editing select,.data-grid-row>.cell.editing textarea{width:100%;height:100%;flex:1 1 auto;min-width:0;border:var(--tbw-editing-border);padding:var(--tbw-padding-editing-input);font-size:var(--tbw-font-size-editor)}.tbw-editor-host{display:contents}--tbw-invalid-bg: light-dark(#fef2f2, #450a0a);--tbw-invalid-border-color: light-dark(#ef4444, #f87171);.data-grid-row>.cell[data-invalid=true]{background:var(--tbw-invalid-bg);outline:1px solid var(--tbw-invalid-border-color);outline-offset:-1px}}}";
|
|
593
|
+
function kt(a) {
|
|
594
594
|
const e = a.options;
|
|
595
595
|
return e ? typeof e == "function" ? e() : e : [];
|
|
596
596
|
}
|
|
597
|
-
function
|
|
597
|
+
function At(a) {
|
|
598
598
|
return (e) => {
|
|
599
599
|
const t = a.editorParams, i = document.createElement("input");
|
|
600
600
|
i.type = "number", i.value = e.value != null ? String(e.value) : "", t?.min !== void 0 && (i.min = String(t.min)), t?.max !== void 0 && (i.max = String(t.max)), t?.step !== void 0 && (i.step = String(t.step)), t?.placeholder && (i.placeholder = t.placeholder);
|
|
@@ -604,28 +604,32 @@ function _t(a) {
|
|
|
604
604
|
}), i;
|
|
605
605
|
};
|
|
606
606
|
}
|
|
607
|
-
function
|
|
607
|
+
function _t() {
|
|
608
608
|
return (a) => {
|
|
609
609
|
const e = document.createElement("input");
|
|
610
610
|
return e.type = "checkbox", e.checked = !!a.value, e.addEventListener("change", () => a.commit(e.checked)), e;
|
|
611
611
|
};
|
|
612
612
|
}
|
|
613
|
-
function
|
|
613
|
+
function Tt(a) {
|
|
614
614
|
return (e) => {
|
|
615
615
|
const t = a.editorParams, i = document.createElement("input");
|
|
616
|
-
|
|
617
|
-
|
|
616
|
+
i.type = "date", e.value instanceof Date ? i.valueAsDate = e.value : typeof e.value == "string" && e.value && (i.value = e.value.split("T")[0]), t?.min && (i.min = t.min), t?.max && (i.max = t.max), t?.placeholder && (i.placeholder = t.placeholder);
|
|
617
|
+
const n = () => {
|
|
618
|
+
typeof e.value == "string" ? e.commit(i.value) : e.commit(i.valueAsDate);
|
|
619
|
+
};
|
|
620
|
+
return i.addEventListener("change", n), i.addEventListener("keydown", (r) => {
|
|
621
|
+
r.key === "Escape" && e.cancel();
|
|
618
622
|
}), i;
|
|
619
623
|
};
|
|
620
624
|
}
|
|
621
|
-
function
|
|
625
|
+
function Lt(a) {
|
|
622
626
|
return (e) => {
|
|
623
627
|
const t = a.editorParams, i = document.createElement("select");
|
|
624
628
|
if (a.multi && (i.multiple = !0), t?.includeEmpty) {
|
|
625
629
|
const o = document.createElement("option");
|
|
626
630
|
o.value = "", o.textContent = t.emptyLabel ?? "", i.appendChild(o);
|
|
627
631
|
}
|
|
628
|
-
|
|
632
|
+
kt(a).forEach((o) => {
|
|
629
633
|
const s = document.createElement("option");
|
|
630
634
|
s.value = String(o.value), s.textContent = o.label, (a.multi && Array.isArray(e.value) && e.value.includes(o.value) || !a.multi && e.value === o.value) && (s.selected = !0), i.appendChild(s);
|
|
631
635
|
});
|
|
@@ -644,27 +648,32 @@ function Ft(a) {
|
|
|
644
648
|
function It(a) {
|
|
645
649
|
return (e) => {
|
|
646
650
|
const t = a.editorParams, i = document.createElement("input");
|
|
647
|
-
|
|
648
|
-
|
|
651
|
+
i.type = "text", i.value = e.value != null ? String(e.value) : "", t?.maxLength !== void 0 && (i.maxLength = t.maxLength), t?.pattern && (i.pattern = t.pattern), t?.placeholder && (i.placeholder = t.placeholder);
|
|
652
|
+
const n = () => {
|
|
653
|
+
const r = i.value;
|
|
654
|
+
typeof e.value == "number" && r !== "" ? e.commit(Number(r)) : e.commit(r);
|
|
655
|
+
};
|
|
656
|
+
return i.addEventListener("blur", n), i.addEventListener("keydown", (r) => {
|
|
657
|
+
r.key === "Enter" && n(), r.key === "Escape" && e.cancel();
|
|
649
658
|
}), i;
|
|
650
659
|
};
|
|
651
660
|
}
|
|
652
|
-
function
|
|
661
|
+
function Ft(a) {
|
|
653
662
|
switch (a.type) {
|
|
654
663
|
case "number":
|
|
655
|
-
return
|
|
664
|
+
return At(a);
|
|
656
665
|
case "boolean":
|
|
657
|
-
return
|
|
666
|
+
return _t();
|
|
658
667
|
case "date":
|
|
659
|
-
return
|
|
668
|
+
return Tt(a);
|
|
660
669
|
case "select":
|
|
661
|
-
return
|
|
670
|
+
return Lt(a);
|
|
662
671
|
default:
|
|
663
672
|
return It(a);
|
|
664
673
|
}
|
|
665
674
|
}
|
|
666
675
|
const oe = 'input,select,textarea,[contenteditable="true"],[contenteditable=""],[tabindex]:not([tabindex="-1"])';
|
|
667
|
-
function
|
|
676
|
+
function Pt(a, e) {
|
|
668
677
|
if (e.editor) return e.editor;
|
|
669
678
|
if (e.__editorTemplate) return "template";
|
|
670
679
|
if (!e.type) return;
|
|
@@ -681,25 +690,25 @@ function Dt(a, e) {
|
|
|
681
690
|
function $(a) {
|
|
682
691
|
return !(typeof a != "string" || a === "__proto__" || a === "constructor" || a === "prototype");
|
|
683
692
|
}
|
|
684
|
-
function
|
|
693
|
+
function Dt(a) {
|
|
685
694
|
const e = (a.__editingCellCount ?? 0) + 1;
|
|
686
695
|
a.__editingCellCount = e, a.setAttribute("data-has-editing", "");
|
|
687
696
|
}
|
|
688
|
-
function
|
|
697
|
+
function Mt(a) {
|
|
689
698
|
a.__editingCellCount = 0, a.removeAttribute("data-has-editing");
|
|
690
699
|
}
|
|
691
|
-
function U(a, e) {
|
|
692
|
-
return a instanceof HTMLInputElement ? a.type === "checkbox" ? a.checked : a.type === "number" ? a.value === "" ? null : Number(a.value) : a.type === "date" ? a.valueAsDate : a.value : e?.type === "number" && a.value !== "" ? Number(a.value) : a.value;
|
|
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;
|
|
693
702
|
}
|
|
694
703
|
function _e(a) {
|
|
695
704
|
}
|
|
696
|
-
function
|
|
697
|
-
const
|
|
698
|
-
|
|
699
|
-
t(U(
|
|
700
|
-
}),
|
|
705
|
+
function Nt(a, e, t, i) {
|
|
706
|
+
const n = a.querySelector("input,textarea,select");
|
|
707
|
+
n && (n.addEventListener("blur", () => {
|
|
708
|
+
t(U(n, e, i));
|
|
709
|
+
}), n instanceof HTMLInputElement && n.type === "checkbox" ? n.addEventListener("change", () => t(n.checked)) : n instanceof HTMLSelectElement && n.addEventListener("change", () => t(U(n, e, i))));
|
|
701
710
|
}
|
|
702
|
-
class
|
|
711
|
+
class wn extends A {
|
|
703
712
|
static manifest = {
|
|
704
713
|
ownedProperties: [
|
|
705
714
|
{
|
|
@@ -733,7 +742,7 @@ class bn extends A {
|
|
|
733
742
|
]
|
|
734
743
|
};
|
|
735
744
|
name = "editing";
|
|
736
|
-
styles =
|
|
745
|
+
styles = St;
|
|
737
746
|
get defaultConfig() {
|
|
738
747
|
return {
|
|
739
748
|
editOn: "click"
|
|
@@ -741,10 +750,12 @@ class bn extends A {
|
|
|
741
750
|
}
|
|
742
751
|
#e = -1;
|
|
743
752
|
#t = -1;
|
|
744
|
-
#
|
|
753
|
+
#s = /* @__PURE__ */ new Map();
|
|
745
754
|
#n = /* @__PURE__ */ new Set();
|
|
746
755
|
#i = /* @__PURE__ */ new Set();
|
|
747
|
-
#
|
|
756
|
+
#o = !1;
|
|
757
|
+
#d = -1;
|
|
758
|
+
#r = /* @__PURE__ */ new Map();
|
|
748
759
|
attach(e) {
|
|
749
760
|
super.attach(e);
|
|
750
761
|
const t = this.disconnectSignal, i = e;
|
|
@@ -759,7 +770,7 @@ class bn extends A {
|
|
|
759
770
|
}, document.addEventListener(
|
|
760
771
|
"keydown",
|
|
761
772
|
(n) => {
|
|
762
|
-
n.key === "Escape" && this.#e !== -1 && this.#
|
|
773
|
+
n.key === "Escape" && this.#e !== -1 && this.#l(this.#e, !0);
|
|
763
774
|
},
|
|
764
775
|
{ capture: !0, signal: t }
|
|
765
776
|
), document.addEventListener(
|
|
@@ -768,14 +779,14 @@ class bn extends A {
|
|
|
768
779
|
if (this.#e === -1) return;
|
|
769
780
|
const r = i.findRenderedRowElement?.(this.#e);
|
|
770
781
|
!r || (n.composedPath && n.composedPath() || []).includes(r) || queueMicrotask(() => {
|
|
771
|
-
this.#e !== -1 && this.#
|
|
782
|
+
this.#e !== -1 && this.#l(this.#e, !1);
|
|
772
783
|
});
|
|
773
784
|
},
|
|
774
785
|
{ signal: t }
|
|
775
786
|
);
|
|
776
787
|
}
|
|
777
788
|
detach() {
|
|
778
|
-
this.#e = -1, this.#t = -1, this.#
|
|
789
|
+
this.#e = -1, this.#t = -1, this.#s.clear(), this.#n.clear(), this.#i.clear(), super.detach();
|
|
779
790
|
}
|
|
780
791
|
handleQuery(e) {
|
|
781
792
|
if (e.type === "isEditing")
|
|
@@ -792,7 +803,7 @@ class bn extends A {
|
|
|
792
803
|
onKeyDown(e) {
|
|
793
804
|
const t = this.grid;
|
|
794
805
|
if (e.key === "Escape" && this.#e !== -1)
|
|
795
|
-
return this.#
|
|
806
|
+
return this.#l(this.#e, !0), !0;
|
|
796
807
|
if (e.key === " " || e.key === "Spacebar") {
|
|
797
808
|
const i = t._focusRow, n = t._focusCol;
|
|
798
809
|
if (i >= 0 && n >= 0) {
|
|
@@ -801,7 +812,7 @@ class bn extends A {
|
|
|
801
812
|
const s = r.field;
|
|
802
813
|
if ($(s)) {
|
|
803
814
|
const d = !o[s];
|
|
804
|
-
return this.#
|
|
815
|
+
return this.#a(i, r, d, o), e.preventDefault(), this.requestRender(), !0;
|
|
805
816
|
}
|
|
806
817
|
}
|
|
807
818
|
}
|
|
@@ -857,14 +868,18 @@ class bn extends A {
|
|
|
857
868
|
}
|
|
858
869
|
afterRender() {
|
|
859
870
|
const e = this.grid;
|
|
860
|
-
if (this.#
|
|
871
|
+
if (this.#o && (this.#o = !1, this.#m(e)), this.#d !== -1) {
|
|
872
|
+
const t = this.#d;
|
|
873
|
+
this.#d = -1, e.animateRow?.(t, "change");
|
|
874
|
+
}
|
|
875
|
+
if (this.#i.size !== 0)
|
|
861
876
|
for (const t of this.#i) {
|
|
862
877
|
const [i, n] = t.split(":"), r = parseInt(i, 10), o = parseInt(n, 10), s = e.findRenderedRowElement?.(r);
|
|
863
878
|
if (!s) continue;
|
|
864
879
|
const l = s.querySelector(`.cell[data-col="${o}"]`);
|
|
865
880
|
if (!l || l.classList.contains("editing")) continue;
|
|
866
881
|
const d = e._rows[r], c = e._visibleColumns[o];
|
|
867
|
-
d && c && this.#
|
|
882
|
+
d && c && this.#f(d, r, c, o, l, !0);
|
|
868
883
|
}
|
|
869
884
|
}
|
|
870
885
|
onScrollRender() {
|
|
@@ -906,15 +921,69 @@ class bn extends A {
|
|
|
906
921
|
isRowChangedById(e) {
|
|
907
922
|
return this.#n.has(e);
|
|
908
923
|
}
|
|
924
|
+
setInvalid(e, t, i = "") {
|
|
925
|
+
let n = this.#r.get(e);
|
|
926
|
+
n || (n = /* @__PURE__ */ new Map(), this.#r.set(e, n)), n.set(t, i), this.#c(e, t, !0);
|
|
927
|
+
}
|
|
928
|
+
clearInvalid(e, t) {
|
|
929
|
+
const i = this.#r.get(e);
|
|
930
|
+
i && (i.delete(t), i.size === 0 && this.#r.delete(e)), this.#c(e, t, !1);
|
|
931
|
+
}
|
|
932
|
+
clearRowInvalid(e) {
|
|
933
|
+
const t = this.#r.get(e);
|
|
934
|
+
if (t) {
|
|
935
|
+
const i = Array.from(t.keys());
|
|
936
|
+
this.#r.delete(e), i.forEach((n) => this.#c(e, n, !1));
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
clearAllInvalid() {
|
|
940
|
+
const e = Array.from(this.#r.entries());
|
|
941
|
+
this.#r.clear(), e.forEach(([t, i]) => {
|
|
942
|
+
i.forEach((n, r) => this.#c(t, r, !1));
|
|
943
|
+
});
|
|
944
|
+
}
|
|
945
|
+
isCellInvalid(e, t) {
|
|
946
|
+
return this.#r.get(e)?.has(t) ?? !1;
|
|
947
|
+
}
|
|
948
|
+
getInvalidMessage(e, t) {
|
|
949
|
+
return this.#r.get(e)?.get(t);
|
|
950
|
+
}
|
|
951
|
+
hasInvalidCells(e) {
|
|
952
|
+
const t = this.#r.get(e);
|
|
953
|
+
return t ? t.size > 0 : !1;
|
|
954
|
+
}
|
|
955
|
+
getInvalidFields(e) {
|
|
956
|
+
return new Map(this.#r.get(e) ?? []);
|
|
957
|
+
}
|
|
958
|
+
#c(e, t, i) {
|
|
959
|
+
const n = this.grid, r = n._visibleColumns?.findIndex((c) => c.field === t);
|
|
960
|
+
if (r === -1 || r === void 0) return;
|
|
961
|
+
const s = n._rows?.findIndex((c) => {
|
|
962
|
+
try {
|
|
963
|
+
return n.getRowId?.(c) === e;
|
|
964
|
+
} catch {
|
|
965
|
+
return !1;
|
|
966
|
+
}
|
|
967
|
+
});
|
|
968
|
+
if (s === -1 || s === void 0) return;
|
|
969
|
+
const d = n.findRenderedRowElement?.(s)?.querySelector(`.cell[data-col="${r}"]`);
|
|
970
|
+
if (d)
|
|
971
|
+
if (i) {
|
|
972
|
+
d.setAttribute("data-invalid", "true");
|
|
973
|
+
const c = this.#r.get(e)?.get(t);
|
|
974
|
+
c && d.setAttribute("title", c);
|
|
975
|
+
} else
|
|
976
|
+
d.removeAttribute("data-invalid"), d.removeAttribute("title");
|
|
977
|
+
}
|
|
909
978
|
resetChangedRows(e) {
|
|
910
979
|
const t = this.changedRows, i = this.changedRowIds;
|
|
911
|
-
this.#n.clear(), this.#
|
|
980
|
+
this.#n.clear(), this.#h(), e || this.emit("changed-rows-reset", { rows: t, ids: i }), this.grid._rowPool?.forEach((r) => r.classList.remove("changed"));
|
|
912
981
|
}
|
|
913
982
|
beginCellEdit(e, t) {
|
|
914
983
|
const i = this.grid, n = i._visibleColumns.findIndex((l) => l.field === t);
|
|
915
984
|
if (n === -1 || !i._visibleColumns[n]?.editable) return;
|
|
916
985
|
const s = i.findRenderedRowElement?.(e)?.querySelector(`.cell[data-col="${n}"]`);
|
|
917
|
-
s && this.#
|
|
986
|
+
s && this.#w(e, n, s);
|
|
918
987
|
}
|
|
919
988
|
beginBulkEdit(e) {
|
|
920
989
|
const t = this.grid;
|
|
@@ -922,11 +991,11 @@ class bn extends A {
|
|
|
922
991
|
const r = t.findRenderedRowElement?.(e);
|
|
923
992
|
if (!r) return;
|
|
924
993
|
const o = t._rows[e];
|
|
925
|
-
this.#
|
|
994
|
+
this.#p(e, o), Array.from(r.children).forEach((s, l) => {
|
|
926
995
|
const d = t._visibleColumns[l];
|
|
927
996
|
if (d?.editable) {
|
|
928
997
|
const c = s;
|
|
929
|
-
c.classList.contains("editing") || this.#
|
|
998
|
+
c.classList.contains("editing") || this.#f(o, e, d, l, c, !0);
|
|
930
999
|
}
|
|
931
1000
|
}), setTimeout(() => {
|
|
932
1001
|
let s = r.querySelector(`.cell[data-col="${t._focusCol}"]`);
|
|
@@ -940,25 +1009,25 @@ class bn extends A {
|
|
|
940
1009
|
}, 0);
|
|
941
1010
|
}
|
|
942
1011
|
commitActiveRowEdit() {
|
|
943
|
-
this.#e !== -1 && this.#
|
|
1012
|
+
this.#e !== -1 && this.#l(this.#e, !1);
|
|
944
1013
|
}
|
|
945
1014
|
cancelActiveRowEdit() {
|
|
946
|
-
this.#e !== -1 && this.#
|
|
1015
|
+
this.#e !== -1 && this.#l(this.#e, !0);
|
|
947
1016
|
}
|
|
948
|
-
#
|
|
1017
|
+
#w(e, t, i) {
|
|
949
1018
|
const n = this.grid, r = n._rows[e], o = n._visibleColumns[t];
|
|
950
|
-
!r || !o?.editable || i.classList.contains("editing") || (this.#e !== e && this.#
|
|
1019
|
+
!r || !o?.editable || i.classList.contains("editing") || (this.#e !== e && this.#p(e, r), this.#t = t, this.#f(r, e, o, t, i, !1));
|
|
951
1020
|
}
|
|
952
|
-
#
|
|
1021
|
+
#h() {
|
|
953
1022
|
const e = this.grid;
|
|
954
|
-
e._activeEditRows = this.#e, e._rowEditSnapshots = this.#
|
|
1023
|
+
e._activeEditRows = this.#e, e._rowEditSnapshots = this.#s;
|
|
955
1024
|
}
|
|
956
|
-
#
|
|
957
|
-
this.#e !== e && (this.#
|
|
1025
|
+
#p(e, t) {
|
|
1026
|
+
this.#e !== e && (this.#s.set(e, { ...t }), this.#e = e, this.#h());
|
|
958
1027
|
}
|
|
959
|
-
#
|
|
1028
|
+
#l(e, t) {
|
|
960
1029
|
if (this.#e !== e) return;
|
|
961
|
-
const i = this.grid, n = this.#
|
|
1030
|
+
const i = this.grid, n = this.#s.get(e), r = i._rows[e], o = i.findRenderedRowElement?.(e);
|
|
962
1031
|
let s;
|
|
963
1032
|
if (r)
|
|
964
1033
|
try {
|
|
@@ -972,32 +1041,36 @@ class bn extends A {
|
|
|
972
1041
|
if (!u) return;
|
|
973
1042
|
const h = d.querySelector("input,textarea,select");
|
|
974
1043
|
if (h) {
|
|
975
|
-
const g = U(h, u);
|
|
976
|
-
|
|
1044
|
+
const g = u.field, f = r[g], p = U(h, u, f);
|
|
1045
|
+
f !== p && this.#a(e, u, p, r);
|
|
977
1046
|
}
|
|
978
1047
|
}), t && n && r)
|
|
979
1048
|
Object.keys(n).forEach((l) => {
|
|
980
1049
|
r[l] = n[l];
|
|
981
|
-
}), s && this.#n.delete(s);
|
|
1050
|
+
}), s && (this.#n.delete(s), this.clearRowInvalid(s));
|
|
982
1051
|
else if (!t && r) {
|
|
983
|
-
const l = s ? this.#n.has(s) :
|
|
984
|
-
this.emit("row-commit", {
|
|
1052
|
+
const l = this.#g(n, r), d = s ? this.#n.has(s) : l, c = this.emitCancelable("row-commit", {
|
|
985
1053
|
rowIndex: e,
|
|
986
1054
|
rowId: s ?? "",
|
|
987
1055
|
row: r,
|
|
988
|
-
|
|
1056
|
+
oldValue: n,
|
|
1057
|
+
newValue: r,
|
|
1058
|
+
changed: d,
|
|
989
1059
|
changedRows: this.changedRows,
|
|
990
1060
|
changedRowIds: this.changedRowIds
|
|
991
|
-
})
|
|
1061
|
+
});
|
|
1062
|
+
c && n ? (Object.keys(n).forEach((u) => {
|
|
1063
|
+
r[u] = n[u];
|
|
1064
|
+
}), s && (this.#n.delete(s), this.clearRowInvalid(s))) : !c && l && this.isAnimationEnabled && (this.#d = e);
|
|
992
1065
|
}
|
|
993
|
-
this.#
|
|
1066
|
+
this.#s.delete(e), this.#e = -1, this.#t = -1, this.#h();
|
|
994
1067
|
for (const l of this.#i)
|
|
995
1068
|
l.startsWith(`${e}:`) && this.#i.delete(l);
|
|
996
1069
|
o && (o.querySelectorAll(".cell.editing").forEach((l) => {
|
|
997
|
-
l.classList.remove("editing"),
|
|
998
|
-
}), this.requestRender()), this.#
|
|
1070
|
+
l.classList.remove("editing"), Mt(l.parentElement);
|
|
1071
|
+
}), this.requestRender()), this.#o = !0, o || (this.#m(i), this.#o = !1);
|
|
999
1072
|
}
|
|
1000
|
-
#
|
|
1073
|
+
#a(e, t, i, n) {
|
|
1001
1074
|
const r = t.field;
|
|
1002
1075
|
if (!$(r)) return;
|
|
1003
1076
|
const o = n[r];
|
|
@@ -1008,7 +1081,12 @@ class bn extends A {
|
|
|
1008
1081
|
l = this.grid.getRowId(n);
|
|
1009
1082
|
} catch {
|
|
1010
1083
|
}
|
|
1011
|
-
const d = l ? !this.#n.has(l) : !0, c = l ? (
|
|
1084
|
+
const d = l ? !this.#n.has(l) : !0, c = l ? (p) => this.grid.updateRow(l, p, "cascade") : _e;
|
|
1085
|
+
let u = !1;
|
|
1086
|
+
const h = l ? (p) => {
|
|
1087
|
+
u = !0, this.setInvalid(l, r, p ?? "");
|
|
1088
|
+
} : () => {
|
|
1089
|
+
};
|
|
1012
1090
|
if (this.emitCancelable("cell-commit", {
|
|
1013
1091
|
row: n,
|
|
1014
1092
|
rowId: l ?? "",
|
|
@@ -1019,18 +1097,19 @@ class bn extends A {
|
|
|
1019
1097
|
changedRows: this.changedRows,
|
|
1020
1098
|
changedRowIds: this.changedRowIds,
|
|
1021
1099
|
firstTimeForRow: d,
|
|
1022
|
-
updateRow: c
|
|
1100
|
+
updateRow: c,
|
|
1101
|
+
setInvalid: h
|
|
1023
1102
|
})) return;
|
|
1024
|
-
n[r] = i, l && this.#n.add(l), this.#
|
|
1103
|
+
l && !u && this.isCellInvalid(l, r) && this.clearInvalid(l, r), n[r] = i, l && this.#n.add(l), this.#h(), this.emitPluginEvent("cell-edit-committed", {
|
|
1025
1104
|
rowIndex: e,
|
|
1026
1105
|
field: r,
|
|
1027
1106
|
oldValue: o,
|
|
1028
1107
|
newValue: i
|
|
1029
1108
|
});
|
|
1030
|
-
const
|
|
1031
|
-
|
|
1109
|
+
const f = s.findRenderedRowElement?.(e);
|
|
1110
|
+
f && f.classList.add("changed");
|
|
1032
1111
|
}
|
|
1033
|
-
#
|
|
1112
|
+
#f(e, t, i, n, r, o) {
|
|
1034
1113
|
if (!i.editable || r.classList.contains("editing")) return;
|
|
1035
1114
|
let s;
|
|
1036
1115
|
try {
|
|
@@ -1040,19 +1119,19 @@ class bn extends A {
|
|
|
1040
1119
|
const l = s ? (C) => this.grid.updateRow(s, C, "cascade") : _e, d = $(i.field) ? e[i.field] : void 0;
|
|
1041
1120
|
r.classList.add("editing"), this.#i.add(`${t}:${n}`);
|
|
1042
1121
|
const c = r.parentElement;
|
|
1043
|
-
c &&
|
|
1122
|
+
c && Dt(c);
|
|
1044
1123
|
let u = !1;
|
|
1045
1124
|
const h = (C) => {
|
|
1046
|
-
u || this.#e === -1 || this.#
|
|
1125
|
+
u || this.#e === -1 || this.#a(t, i, C, e);
|
|
1047
1126
|
}, g = () => {
|
|
1048
1127
|
u = !0, $(i.field) && (e[i.field] = d);
|
|
1049
1128
|
}, f = document.createElement("div");
|
|
1050
1129
|
f.className = "tbw-editor-host", r.innerHTML = "", r.appendChild(f), f.addEventListener("keydown", (C) => {
|
|
1051
|
-
C.key === "Enter" && (C.stopPropagation(), C.preventDefault(), u = !0, this.#
|
|
1130
|
+
C.key === "Enter" && (C.stopPropagation(), C.preventDefault(), u = !0, this.#l(t, !1)), C.key === "Escape" && (C.stopPropagation(), C.preventDefault(), g(), this.#l(t, !0));
|
|
1052
1131
|
});
|
|
1053
|
-
const p = i, w = p.__editorTemplate, b =
|
|
1132
|
+
const p = i, w = p.__editorTemplate, b = Pt(this.grid, p) ?? Ft(i), v = d;
|
|
1054
1133
|
if (b === "template" && w)
|
|
1055
|
-
this.#
|
|
1134
|
+
this.#u(f, p, e, d, h, g, o, t);
|
|
1056
1135
|
else if (typeof b == "string") {
|
|
1057
1136
|
const C = document.createElement(b);
|
|
1058
1137
|
C.value = v, C.addEventListener("change", () => h(C.value)), f.appendChild(C), o || queueMicrotask(() => {
|
|
@@ -1069,7 +1148,7 @@ class bn extends A {
|
|
|
1069
1148
|
cancel: g,
|
|
1070
1149
|
updateRow: l
|
|
1071
1150
|
}, _ = b(C);
|
|
1072
|
-
typeof _ == "string" ? (f.innerHTML = _,
|
|
1151
|
+
typeof _ == "string" ? (f.innerHTML = _, Nt(f, i, h, d)) : _ instanceof Node && f.appendChild(_), o || queueMicrotask(() => {
|
|
1073
1152
|
f.querySelector(oe)?.focus({ preventScroll: !0 });
|
|
1074
1153
|
});
|
|
1075
1154
|
} else if (b && typeof b == "object") {
|
|
@@ -1097,7 +1176,7 @@ class bn extends A {
|
|
|
1097
1176
|
);
|
|
1098
1177
|
}
|
|
1099
1178
|
}
|
|
1100
|
-
#
|
|
1179
|
+
#u(e, t, i, n, r, o, s, l) {
|
|
1101
1180
|
const d = t.__editorTemplate;
|
|
1102
1181
|
if (!d) return;
|
|
1103
1182
|
const c = d.cloneNode(!0), u = t.__compiledEditor;
|
|
@@ -1122,15 +1201,23 @@ class bn extends A {
|
|
|
1122
1201
|
h instanceof HTMLInputElement && h.type === "checkbox" ? h.checked = !!n : h.value = String(n ?? "");
|
|
1123
1202
|
let g = !1;
|
|
1124
1203
|
h.addEventListener("blur", () => {
|
|
1125
|
-
g || r(U(h, t));
|
|
1204
|
+
g || r(U(h, t, n));
|
|
1126
1205
|
}), h.addEventListener("keydown", (f) => {
|
|
1127
1206
|
const p = f;
|
|
1128
|
-
p.key === "Enter" && (p.stopPropagation(), p.preventDefault(), g = !0, r(U(h, t)), this.#
|
|
1207
|
+
p.key === "Enter" && (p.stopPropagation(), p.preventDefault(), g = !0, r(U(h, t, n)), this.#l(l, !1)), p.key === "Escape" && (p.stopPropagation(), p.preventDefault(), o(), this.#l(l, !0));
|
|
1129
1208
|
}), h instanceof HTMLInputElement && h.type === "checkbox" && h.addEventListener("change", () => r(h.checked)), s || setTimeout(() => h.focus({ preventScroll: !0 }), 0);
|
|
1130
1209
|
}
|
|
1131
1210
|
e.appendChild(c);
|
|
1132
1211
|
}
|
|
1133
|
-
#
|
|
1212
|
+
#g(e, t) {
|
|
1213
|
+
if (!e) return !1;
|
|
1214
|
+
const i = e, n = t, r = /* @__PURE__ */ new Set([...Object.keys(i), ...Object.keys(n)]);
|
|
1215
|
+
for (const o of r)
|
|
1216
|
+
if (i[o] !== n[o])
|
|
1217
|
+
return !0;
|
|
1218
|
+
return !1;
|
|
1219
|
+
}
|
|
1220
|
+
#m(e) {
|
|
1134
1221
|
queueMicrotask(() => {
|
|
1135
1222
|
try {
|
|
1136
1223
|
const t = e._focusRow, i = e._focusCol, n = e.findRenderedRowElement?.(t);
|
|
@@ -1154,7 +1241,7 @@ function Te(a, e = !0) {
|
|
|
1154
1241
|
return e && (t.includes(",") || t.includes('"') || t.includes(`
|
|
1155
1242
|
`) || t.includes("\r")) ? `"${t.replace(/"/g, '""')}"` : t;
|
|
1156
1243
|
}
|
|
1157
|
-
function
|
|
1244
|
+
function qt(a, e, t, i = {}) {
|
|
1158
1245
|
const n = i.delimiter ?? ",", r = i.newline ?? `
|
|
1159
1246
|
`, o = [], s = i.bom ? "\uFEFF" : "";
|
|
1160
1247
|
if (t.includeHeaders !== !1) {
|
|
@@ -1177,14 +1264,14 @@ function we(a, e) {
|
|
|
1177
1264
|
const t = URL.createObjectURL(a), i = document.createElement("a");
|
|
1178
1265
|
i.href = t, i.download = e, i.style.display = "none", document.body.appendChild(i), i.click(), document.body.removeChild(i), URL.revokeObjectURL(t);
|
|
1179
1266
|
}
|
|
1180
|
-
function
|
|
1267
|
+
function Ht(a, e) {
|
|
1181
1268
|
const t = new Blob([a], { type: "text/csv;charset=utf-8;" });
|
|
1182
1269
|
we(t, e);
|
|
1183
1270
|
}
|
|
1184
1271
|
function Le(a) {
|
|
1185
1272
|
return a.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
1186
1273
|
}
|
|
1187
|
-
function
|
|
1274
|
+
function Kt(a, e, t) {
|
|
1188
1275
|
let i = `<?xml version="1.0" encoding="UTF-8"?>
|
|
1189
1276
|
<?mso-application progid="Excel.Sheet"?>
|
|
1190
1277
|
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
|
|
@@ -1216,13 +1303,13 @@ function zt(a, e, t) {
|
|
|
1216
1303
|
</Worksheet>
|
|
1217
1304
|
</Workbook>`, i;
|
|
1218
1305
|
}
|
|
1219
|
-
function
|
|
1306
|
+
function zt(a, e) {
|
|
1220
1307
|
const t = e.endsWith(".xls") ? e : `${e}.xls`, i = new Blob([a], {
|
|
1221
1308
|
type: "application/vnd.ms-excel;charset=utf-8;"
|
|
1222
1309
|
});
|
|
1223
1310
|
we(i, t);
|
|
1224
1311
|
}
|
|
1225
|
-
class
|
|
1312
|
+
class bn extends A {
|
|
1226
1313
|
name = "export";
|
|
1227
1314
|
get defaultConfig() {
|
|
1228
1315
|
return {
|
|
@@ -1259,13 +1346,13 @@ class vn extends A {
|
|
|
1259
1346
|
try {
|
|
1260
1347
|
switch (e) {
|
|
1261
1348
|
case "csv": {
|
|
1262
|
-
const l =
|
|
1263
|
-
s = s.endsWith(".csv") ? s : `${s}.csv`,
|
|
1349
|
+
const l = qt(o, r, n, { bom: !0 });
|
|
1350
|
+
s = s.endsWith(".csv") ? s : `${s}.csv`, Ht(l, s);
|
|
1264
1351
|
break;
|
|
1265
1352
|
}
|
|
1266
1353
|
case "excel": {
|
|
1267
|
-
const l =
|
|
1268
|
-
s = s.endsWith(".xls") ? s : `${s}.xls`,
|
|
1354
|
+
const l = Kt(o, r, n);
|
|
1355
|
+
s = s.endsWith(".xls") ? s : `${s}.xls`, zt(l, s);
|
|
1269
1356
|
break;
|
|
1270
1357
|
}
|
|
1271
1358
|
case "json": {
|
|
@@ -1316,7 +1403,7 @@ class vn extends A {
|
|
|
1316
1403
|
return this.lastExportInfo;
|
|
1317
1404
|
}
|
|
1318
1405
|
}
|
|
1319
|
-
function
|
|
1406
|
+
function Ot(a) {
|
|
1320
1407
|
const { totalRows: e, viewportHeight: t, scrollTop: i, rowHeight: n, overscan: r } = a, o = Math.ceil(t / n);
|
|
1321
1408
|
let s = Math.floor(i / n) - r;
|
|
1322
1409
|
s < 0 && (s = 0);
|
|
@@ -1328,10 +1415,10 @@ function Gt(a) {
|
|
|
1328
1415
|
totalHeight: e * n
|
|
1329
1416
|
};
|
|
1330
1417
|
}
|
|
1331
|
-
function
|
|
1418
|
+
function Gt(a, e) {
|
|
1332
1419
|
return a <= e;
|
|
1333
1420
|
}
|
|
1334
|
-
function
|
|
1421
|
+
function Bt(a, e, t = !1) {
|
|
1335
1422
|
const i = a[e.field];
|
|
1336
1423
|
if (e.operator === "blank")
|
|
1337
1424
|
return i == null || i === "";
|
|
@@ -1370,10 +1457,10 @@ function Vt(a, e, t = !1) {
|
|
|
1370
1457
|
return !0;
|
|
1371
1458
|
}
|
|
1372
1459
|
}
|
|
1373
|
-
function
|
|
1374
|
-
return e.length ? a.filter((i) => e.every((n) =>
|
|
1460
|
+
function Vt(a, e, t = !1) {
|
|
1461
|
+
return e.length ? a.filter((i) => e.every((n) => Bt(i, n, t))) : a;
|
|
1375
1462
|
}
|
|
1376
|
-
function
|
|
1463
|
+
function Wt(a) {
|
|
1377
1464
|
return JSON.stringify(
|
|
1378
1465
|
a.map((e) => ({
|
|
1379
1466
|
field: e.field,
|
|
@@ -1383,7 +1470,7 @@ function $t(a) {
|
|
|
1383
1470
|
}))
|
|
1384
1471
|
);
|
|
1385
1472
|
}
|
|
1386
|
-
function
|
|
1473
|
+
function Ie(a, e) {
|
|
1387
1474
|
const t = /* @__PURE__ */ new Set();
|
|
1388
1475
|
for (const i of a) {
|
|
1389
1476
|
const n = i[e];
|
|
@@ -1391,7 +1478,7 @@ function Fe(a, e) {
|
|
|
1391
1478
|
}
|
|
1392
1479
|
return [...t].sort((i, n) => typeof i == "number" && typeof n == "number" ? i - n : String(i).localeCompare(String(n)));
|
|
1393
1480
|
}
|
|
1394
|
-
const
|
|
1481
|
+
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)}}";
|
|
1395
1482
|
class N extends A {
|
|
1396
1483
|
static manifest = {
|
|
1397
1484
|
events: [
|
|
@@ -1402,7 +1489,7 @@ class N extends A {
|
|
|
1402
1489
|
]
|
|
1403
1490
|
};
|
|
1404
1491
|
name = "filtering";
|
|
1405
|
-
styles =
|
|
1492
|
+
styles = $t;
|
|
1406
1493
|
get defaultConfig() {
|
|
1407
1494
|
return {
|
|
1408
1495
|
debounceMs: 300,
|
|
@@ -1455,10 +1542,10 @@ class N extends A {
|
|
|
1455
1542
|
if (!t.length) return [...e];
|
|
1456
1543
|
if (this.config.filterHandler)
|
|
1457
1544
|
return this.cachedResult ? this.cachedResult : [...e];
|
|
1458
|
-
const i =
|
|
1545
|
+
const i = Wt(t);
|
|
1459
1546
|
if (this.cacheKey === i && this.cachedResult)
|
|
1460
1547
|
return this.cachedResult;
|
|
1461
|
-
const n =
|
|
1548
|
+
const n = Vt([...e], t, this.config.caseSensitive);
|
|
1462
1549
|
return this.cachedResult = n, this.cacheKey = i, n;
|
|
1463
1550
|
}
|
|
1464
1551
|
afterRender() {
|
|
@@ -1536,7 +1623,7 @@ class N extends A {
|
|
|
1536
1623
|
return this.getFilters();
|
|
1537
1624
|
}
|
|
1538
1625
|
getUniqueValues(e) {
|
|
1539
|
-
return
|
|
1626
|
+
return Ie(this.sourceRows, e);
|
|
1540
1627
|
}
|
|
1541
1628
|
copyGridThemeContext(e) {
|
|
1542
1629
|
const t = this.gridElement;
|
|
@@ -1553,7 +1640,7 @@ class N extends A {
|
|
|
1553
1640
|
return;
|
|
1554
1641
|
}
|
|
1555
1642
|
const e = document.createElement("style");
|
|
1556
|
-
e.id = "tbw-filter-panel-styles", e.textContent =
|
|
1643
|
+
e.id = "tbw-filter-panel-styles", e.textContent = jt, document.head.appendChild(e), this.globalStylesInjected = !0;
|
|
1557
1644
|
}
|
|
1558
1645
|
toggleFilterPanel(e, t, i) {
|
|
1559
1646
|
if (this.openPanelField === e) {
|
|
@@ -1568,7 +1655,7 @@ class N extends A {
|
|
|
1568
1655
|
});
|
|
1569
1656
|
return;
|
|
1570
1657
|
}
|
|
1571
|
-
const r =
|
|
1658
|
+
const r = Ie(this.sourceRows, e);
|
|
1572
1659
|
document.body.appendChild(n), this.positionPanel(n, i), this.renderPanelContent(e, t, n, r), this.setupPanelCloseHandler(n, i);
|
|
1573
1660
|
}
|
|
1574
1661
|
renderPanelContent(e, t, i, n) {
|
|
@@ -1681,13 +1768,13 @@ class N extends A {
|
|
|
1681
1768
|
return H.textContent = T, y.appendChild(L), y.appendChild(H), y;
|
|
1682
1769
|
}, _ = () => {
|
|
1683
1770
|
const x = v.length, S = f.clientHeight, T = f.scrollTop;
|
|
1684
|
-
if (p.style.height = `${x * o}px`,
|
|
1771
|
+
if (p.style.height = `${x * o}px`, Gt(x, N.LIST_BYPASS_THRESHOLD / 3)) {
|
|
1685
1772
|
w.innerHTML = "", w.style.transform = "translateY(0px)", v.forEach((y, L) => {
|
|
1686
1773
|
w.appendChild(C(y, L));
|
|
1687
1774
|
});
|
|
1688
1775
|
return;
|
|
1689
1776
|
}
|
|
1690
|
-
const m =
|
|
1777
|
+
const m = Ot({
|
|
1691
1778
|
totalRows: x,
|
|
1692
1779
|
viewportHeight: S,
|
|
1693
1780
|
scrollTop: T,
|
|
@@ -1723,10 +1810,10 @@ class N extends A {
|
|
|
1723
1810
|
this.searchText.set(r, l.value), E(l.value);
|
|
1724
1811
|
}, this.config.debounceMs ?? 150);
|
|
1725
1812
|
});
|
|
1726
|
-
const
|
|
1727
|
-
|
|
1728
|
-
const
|
|
1729
|
-
|
|
1813
|
+
const I = document.createElement("div");
|
|
1814
|
+
I.className = "tbw-filter-buttons";
|
|
1815
|
+
const F = document.createElement("button");
|
|
1816
|
+
F.className = "tbw-filter-apply-btn", F.textContent = "Apply", F.addEventListener("click", () => {
|
|
1730
1817
|
const x = [];
|
|
1731
1818
|
for (const [S, T] of b)
|
|
1732
1819
|
if (!T)
|
|
@@ -1737,11 +1824,11 @@ class N extends A {
|
|
|
1737
1824
|
x.push(m !== void 0 ? m : S);
|
|
1738
1825
|
}
|
|
1739
1826
|
t.applySetFilter(x);
|
|
1740
|
-
}),
|
|
1827
|
+
}), I.appendChild(F);
|
|
1741
1828
|
const R = document.createElement("button");
|
|
1742
1829
|
R.className = "tbw-filter-clear-btn", R.textContent = "Clear Filter", R.addEventListener("click", () => {
|
|
1743
1830
|
t.clearFilter();
|
|
1744
|
-
}),
|
|
1831
|
+
}), I.appendChild(R), e.appendChild(I);
|
|
1745
1832
|
}
|
|
1746
1833
|
renderNumberFilterPanel(e, t, i) {
|
|
1747
1834
|
const { field: n, column: r } = t, o = r.filterParams, s = r.editorParams, l = (k, K) => {
|
|
@@ -1764,12 +1851,12 @@ class N extends A {
|
|
|
1764
1851
|
E.type = "number", E.className = "tbw-filter-range-input", E.min = String(h), E.max = String(g), E.step = String(f), E.value = String(w), C.appendChild(_), C.appendChild(E), v.appendChild(C);
|
|
1765
1852
|
const P = document.createElement("span");
|
|
1766
1853
|
P.className = "tbw-filter-range-separator", P.textContent = "–", v.appendChild(P);
|
|
1767
|
-
const
|
|
1768
|
-
|
|
1769
|
-
const
|
|
1770
|
-
|
|
1854
|
+
const I = document.createElement("div");
|
|
1855
|
+
I.className = "tbw-filter-range-group";
|
|
1856
|
+
const F = document.createElement("label");
|
|
1857
|
+
F.textContent = "Max", F.className = "tbw-filter-range-label";
|
|
1771
1858
|
const R = document.createElement("input");
|
|
1772
|
-
R.type = "number", R.className = "tbw-filter-range-input", R.min = String(h), R.max = String(g), R.step = String(f), R.value = String(b),
|
|
1859
|
+
R.type = "number", R.className = "tbw-filter-range-input", R.min = String(h), R.max = String(g), R.step = String(f), R.value = String(b), I.appendChild(F), I.appendChild(R), v.appendChild(I), e.appendChild(v);
|
|
1773
1860
|
const x = document.createElement("div");
|
|
1774
1861
|
x.className = "tbw-filter-range-slider";
|
|
1775
1862
|
const S = document.createElement("div");
|
|
@@ -1823,12 +1910,12 @@ class N extends A {
|
|
|
1823
1910
|
E.type = "date", E.className = "tbw-filter-date-input", g && (E.min = g), f && (E.max = f), E.value = w, C.appendChild(_), C.appendChild(E), v.appendChild(C);
|
|
1824
1911
|
const P = document.createElement("span");
|
|
1825
1912
|
P.className = "tbw-filter-range-separator", P.textContent = "–", v.appendChild(P);
|
|
1826
|
-
const
|
|
1827
|
-
|
|
1828
|
-
const
|
|
1829
|
-
|
|
1913
|
+
const I = document.createElement("div");
|
|
1914
|
+
I.className = "tbw-filter-date-group";
|
|
1915
|
+
const F = document.createElement("label");
|
|
1916
|
+
F.textContent = "To", F.className = "tbw-filter-range-label";
|
|
1830
1917
|
const R = document.createElement("input");
|
|
1831
|
-
R.type = "date", R.className = "tbw-filter-date-input", g && (R.min = g), f && (R.max = f), R.value = b,
|
|
1918
|
+
R.type = "date", R.className = "tbw-filter-date-input", g && (R.min = g), f && (R.max = f), R.value = b, I.appendChild(F), I.appendChild(R), v.appendChild(I), e.appendChild(v);
|
|
1832
1919
|
const x = document.createElement("div");
|
|
1833
1920
|
x.className = "tbw-filter-buttons";
|
|
1834
1921
|
const S = document.createElement("button");
|
|
@@ -1905,7 +1992,7 @@ class N extends A {
|
|
|
1905
1992
|
this.filters.set(e, i), this.cachedResult = null, this.cacheKey = null;
|
|
1906
1993
|
}
|
|
1907
1994
|
}
|
|
1908
|
-
function
|
|
1995
|
+
function Fe(a) {
|
|
1909
1996
|
if (!a.length) return [];
|
|
1910
1997
|
const e = /* @__PURE__ */ new Map(), t = [], i = (o, s) => {
|
|
1911
1998
|
if (!s.length) return;
|
|
@@ -1940,7 +2027,7 @@ function Ie(a) {
|
|
|
1940
2027
|
}, e.set(d, c), t.push(c)), c.columns.push(o);
|
|
1941
2028
|
}), n.length && i(r, n), t.length === 1 && t[0].implicit && t[0].columns.length === a.length ? [] : t;
|
|
1942
2029
|
}
|
|
1943
|
-
function
|
|
2030
|
+
function Ut(a, e, t) {
|
|
1944
2031
|
if (!e.length || !a) return;
|
|
1945
2032
|
const i = /* @__PURE__ */ new Map();
|
|
1946
2033
|
for (const r of e)
|
|
@@ -1956,7 +2043,7 @@ function Yt(a, e, t) {
|
|
|
1956
2043
|
s && s.classList.add("group-end");
|
|
1957
2044
|
}
|
|
1958
2045
|
}
|
|
1959
|
-
function
|
|
2046
|
+
function Yt(a, e) {
|
|
1960
2047
|
if (a.length === 0) return null;
|
|
1961
2048
|
const t = document.createElement("div");
|
|
1962
2049
|
t.className = "header-group-row", t.setAttribute("role", "row");
|
|
@@ -1968,11 +2055,11 @@ function Xt(a, e) {
|
|
|
1968
2055
|
}
|
|
1969
2056
|
return t;
|
|
1970
2057
|
}
|
|
1971
|
-
function
|
|
2058
|
+
function Xt(a) {
|
|
1972
2059
|
return a.some((e) => e.group != null);
|
|
1973
2060
|
}
|
|
1974
|
-
const
|
|
1975
|
-
class
|
|
2061
|
+
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 A {
|
|
1976
2063
|
static manifest = {
|
|
1977
2064
|
ownedProperties: [
|
|
1978
2065
|
{
|
|
@@ -1989,7 +2076,7 @@ class yn extends A {
|
|
|
1989
2076
|
]
|
|
1990
2077
|
};
|
|
1991
2078
|
name = "groupingColumns";
|
|
1992
|
-
styles =
|
|
2079
|
+
styles = Zt;
|
|
1993
2080
|
get defaultConfig() {
|
|
1994
2081
|
return {
|
|
1995
2082
|
showGroupBorders: !0
|
|
@@ -2004,7 +2091,7 @@ class yn extends A {
|
|
|
2004
2091
|
if (t?.columnGroups && Array.isArray(t.columnGroups) && t.columnGroups.length > 0)
|
|
2005
2092
|
return !0;
|
|
2006
2093
|
const i = t?.columns;
|
|
2007
|
-
return Array.isArray(i) ?
|
|
2094
|
+
return Array.isArray(i) ? Xt(i) : !1;
|
|
2008
2095
|
}
|
|
2009
2096
|
processColumns(e) {
|
|
2010
2097
|
const t = this.grid?.gridConfig?.columnGroups;
|
|
@@ -2020,7 +2107,7 @@ class yn extends A {
|
|
|
2020
2107
|
});
|
|
2021
2108
|
} else
|
|
2022
2109
|
i = [...e];
|
|
2023
|
-
const n =
|
|
2110
|
+
const n = Fe(i);
|
|
2024
2111
|
return n.length === 0 ? (this.isActive = !1, this.groups = [], i) : (this.isActive = !0, this.groups = n, i);
|
|
2025
2112
|
}
|
|
2026
2113
|
afterRender() {
|
|
@@ -2033,16 +2120,16 @@ class yn extends A {
|
|
|
2033
2120
|
if (!e) return;
|
|
2034
2121
|
const t = e.querySelector(".header-group-row");
|
|
2035
2122
|
t && t.remove();
|
|
2036
|
-
const i = this.columns, n =
|
|
2123
|
+
const i = this.columns, n = Fe(i);
|
|
2037
2124
|
if (n.length === 0) return;
|
|
2038
|
-
const r =
|
|
2125
|
+
const r = Yt(n, i);
|
|
2039
2126
|
if (r) {
|
|
2040
2127
|
r.classList.toggle("no-borders", !this.config.showGroupBorders);
|
|
2041
2128
|
const s = e.querySelector(".header-row");
|
|
2042
2129
|
s ? e.insertBefore(r, s) : e.appendChild(r);
|
|
2043
2130
|
}
|
|
2044
2131
|
const o = e.querySelector(".header-row");
|
|
2045
|
-
o && (o.classList.toggle("no-group-borders", !this.config.showGroupBorders),
|
|
2132
|
+
o && (o.classList.toggle("no-group-borders", !this.config.showGroupBorders), Ut(o, n)), this.#e(n);
|
|
2046
2133
|
}
|
|
2047
2134
|
#e(e) {
|
|
2048
2135
|
if (!this.config.showGroupBorders) return;
|
|
@@ -2106,20 +2193,20 @@ function Pe({ rows: a, config: e, expanded: t, initialExpanded: i }) {
|
|
|
2106
2193
|
};
|
|
2107
2194
|
return l(r), s;
|
|
2108
2195
|
}
|
|
2109
|
-
function
|
|
2196
|
+
function Qt(a, e) {
|
|
2110
2197
|
const t = new Set(a);
|
|
2111
2198
|
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
2112
2199
|
}
|
|
2113
|
-
function
|
|
2200
|
+
function Jt(a) {
|
|
2114
2201
|
const e = /* @__PURE__ */ new Set();
|
|
2115
2202
|
for (const t of a)
|
|
2116
2203
|
t.kind === "group" && e.add(t.key);
|
|
2117
2204
|
return e;
|
|
2118
2205
|
}
|
|
2119
|
-
function
|
|
2206
|
+
function ei() {
|
|
2120
2207
|
return /* @__PURE__ */ new Set();
|
|
2121
2208
|
}
|
|
2122
|
-
function
|
|
2209
|
+
function ti(a, e) {
|
|
2123
2210
|
if (a === !0)
|
|
2124
2211
|
return new Set(e);
|
|
2125
2212
|
if (a === !1 || a == null)
|
|
@@ -2130,14 +2217,14 @@ function ii(a, e) {
|
|
|
2130
2217
|
}
|
|
2131
2218
|
return typeof a == "string" ? /* @__PURE__ */ new Set([a]) : Array.isArray(a) ? new Set(a) : /* @__PURE__ */ new Set();
|
|
2132
2219
|
}
|
|
2133
|
-
function
|
|
2220
|
+
function ii(a) {
|
|
2134
2221
|
return a.filter((e) => e.kind === "group").map((e) => e.key);
|
|
2135
2222
|
}
|
|
2136
|
-
function
|
|
2223
|
+
function ni(a) {
|
|
2137
2224
|
return a.kind !== "group" ? 0 : a.rows.length;
|
|
2138
2225
|
}
|
|
2139
|
-
const
|
|
2140
|
-
class
|
|
2226
|
+
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 A {
|
|
2141
2228
|
static manifest = {
|
|
2142
2229
|
events: [
|
|
2143
2230
|
{
|
|
@@ -2164,7 +2251,7 @@ class xn extends A {
|
|
|
2164
2251
|
]
|
|
2165
2252
|
};
|
|
2166
2253
|
name = "groupingRows";
|
|
2167
|
-
styles =
|
|
2254
|
+
styles = ri;
|
|
2168
2255
|
get defaultConfig() {
|
|
2169
2256
|
return {
|
|
2170
2257
|
defaultExpanded: !1,
|
|
@@ -2207,8 +2294,8 @@ class xn extends A {
|
|
|
2207
2294
|
return this.isActive = !1, this.flattenedRows = [], [...e];
|
|
2208
2295
|
let n;
|
|
2209
2296
|
if (!this.hasAppliedDefaultExpanded && this.expandedKeys.size === 0 && t.defaultExpanded !== !1) {
|
|
2210
|
-
const s =
|
|
2211
|
-
n =
|
|
2297
|
+
const s = ii(i);
|
|
2298
|
+
n = ti(t.defaultExpanded ?? !1, s), n.size > 0 && (this.expandedKeys = new Set(n), this.hasAppliedDefaultExpanded = !0);
|
|
2212
2299
|
}
|
|
2213
2300
|
const r = Pe({
|
|
2214
2301
|
rows: [...e],
|
|
@@ -2230,7 +2317,7 @@ class xn extends A {
|
|
|
2230
2317
|
__groupDepth: s.depth,
|
|
2231
2318
|
__groupRows: s.rows,
|
|
2232
2319
|
__groupExpanded: s.expanded,
|
|
2233
|
-
__groupRowCount:
|
|
2320
|
+
__groupRowCount: ni(s)
|
|
2234
2321
|
} : s.row);
|
|
2235
2322
|
}
|
|
2236
2323
|
onCellClick(e) {
|
|
@@ -2348,10 +2435,10 @@ class xn extends A {
|
|
|
2348
2435
|
});
|
|
2349
2436
|
}
|
|
2350
2437
|
expandAll() {
|
|
2351
|
-
this.expandedKeys =
|
|
2438
|
+
this.expandedKeys = Jt(this.flattenedRows), this.emitPluginEvent("grouping-state-change", { expandedKeys: [...this.expandedKeys] }), this.requestRender();
|
|
2352
2439
|
}
|
|
2353
2440
|
collapseAll() {
|
|
2354
|
-
this.expandedKeys =
|
|
2441
|
+
this.expandedKeys = ei(), this.emitPluginEvent("grouping-state-change", { expandedKeys: [...this.expandedKeys] }), this.requestRender();
|
|
2355
2442
|
}
|
|
2356
2443
|
toggle(e) {
|
|
2357
2444
|
const t = !this.expandedKeys.has(e), i = this.config, n = this.flattenedRows.find((r) => r.kind === "group" && r.key === e);
|
|
@@ -2366,7 +2453,7 @@ class xn extends A {
|
|
|
2366
2453
|
}
|
|
2367
2454
|
r.add(e), this.expandedKeys = r;
|
|
2368
2455
|
} else
|
|
2369
|
-
this.expandedKeys =
|
|
2456
|
+
this.expandedKeys = Qt(this.expandedKeys, e);
|
|
2370
2457
|
this.emit("group-toggle", {
|
|
2371
2458
|
key: e,
|
|
2372
2459
|
expanded: this.expandedKeys.has(e),
|
|
@@ -2420,18 +2507,18 @@ function De(a, e) {
|
|
|
2420
2507
|
const t = new Set(a);
|
|
2421
2508
|
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
2422
2509
|
}
|
|
2423
|
-
function
|
|
2510
|
+
function oi(a, e) {
|
|
2424
2511
|
const t = new Set(a);
|
|
2425
2512
|
return t.add(e), t;
|
|
2426
2513
|
}
|
|
2427
|
-
function
|
|
2514
|
+
function si(a, e) {
|
|
2428
2515
|
const t = new Set(a);
|
|
2429
2516
|
return t.delete(e), t;
|
|
2430
2517
|
}
|
|
2431
|
-
function
|
|
2518
|
+
function ai(a, e) {
|
|
2432
2519
|
return a.has(e);
|
|
2433
2520
|
}
|
|
2434
|
-
function
|
|
2521
|
+
function li(a, e, t, i) {
|
|
2435
2522
|
const n = document.createElement("div");
|
|
2436
2523
|
n.className = "master-detail-row", n.setAttribute("data-detail-for", String(e)), n.setAttribute("role", "row");
|
|
2437
2524
|
const r = document.createElement("div");
|
|
@@ -2439,10 +2526,10 @@ function di(a, e, t, i) {
|
|
|
2439
2526
|
const o = t(a, e);
|
|
2440
2527
|
return typeof o == "string" ? r.innerHTML = o : o instanceof HTMLElement && r.appendChild(o), n.appendChild(r), n;
|
|
2441
2528
|
}
|
|
2442
|
-
const
|
|
2529
|
+
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}}}";
|
|
2443
2530
|
class nt extends A {
|
|
2444
2531
|
name = "masterDetail";
|
|
2445
|
-
styles =
|
|
2532
|
+
styles = di;
|
|
2446
2533
|
get defaultConfig() {
|
|
2447
2534
|
return {
|
|
2448
2535
|
detailHeight: "auto",
|
|
@@ -2519,9 +2606,9 @@ class nt extends A {
|
|
|
2519
2606
|
if (!(this.config.showExpandColumn === !0 || this.config.showExpandColumn !== !1 && !!this.config.detailRenderer))
|
|
2520
2607
|
return [...e];
|
|
2521
2608
|
const i = [...e];
|
|
2522
|
-
if (
|
|
2609
|
+
if (wt(i))
|
|
2523
2610
|
return i;
|
|
2524
|
-
const r =
|
|
2611
|
+
const r = bt(this.name);
|
|
2525
2612
|
return r.viewRenderer = (o) => {
|
|
2526
2613
|
const { row: s } = o, l = this.expandedRows.has(s), d = document.createElement("span");
|
|
2527
2614
|
d.className = "master-detail-expander expander-cell";
|
|
@@ -2574,7 +2661,7 @@ class nt extends A {
|
|
|
2574
2661
|
d.previousElementSibling !== s && s.after(d);
|
|
2575
2662
|
continue;
|
|
2576
2663
|
}
|
|
2577
|
-
const c =
|
|
2664
|
+
const c = li(l, o, this.config.detailRenderer, n);
|
|
2578
2665
|
typeof this.config.detailHeight == "number" && (c.style.height = `${this.config.detailHeight}px`), s.after(c), this.detailElements.set(l, c), this.animateExpand(c);
|
|
2579
2666
|
}
|
|
2580
2667
|
}
|
|
@@ -2609,11 +2696,11 @@ class nt extends A {
|
|
|
2609
2696
|
}
|
|
2610
2697
|
expand(e) {
|
|
2611
2698
|
const t = this.rows[e];
|
|
2612
|
-
t && (this.expandedRows =
|
|
2699
|
+
t && (this.expandedRows = oi(this.expandedRows, t), this.requestRender());
|
|
2613
2700
|
}
|
|
2614
2701
|
collapse(e) {
|
|
2615
2702
|
const t = this.rows[e];
|
|
2616
|
-
t && (this.expandedRows =
|
|
2703
|
+
t && (this.expandedRows = si(this.expandedRows, t), this.requestRender());
|
|
2617
2704
|
}
|
|
2618
2705
|
toggle(e) {
|
|
2619
2706
|
const t = this.rows[e];
|
|
@@ -2621,7 +2708,7 @@ class nt extends A {
|
|
|
2621
2708
|
}
|
|
2622
2709
|
isExpanded(e) {
|
|
2623
2710
|
const t = this.rows[e];
|
|
2624
|
-
return t ?
|
|
2711
|
+
return t ? ai(this.expandedRows, t) : !1;
|
|
2625
2712
|
}
|
|
2626
2713
|
expandAll() {
|
|
2627
2714
|
for (const e of this.rows)
|
|
@@ -2651,20 +2738,20 @@ class nt extends A {
|
|
|
2651
2738
|
}
|
|
2652
2739
|
}
|
|
2653
2740
|
}
|
|
2654
|
-
function
|
|
2741
|
+
function ci(a, e, t) {
|
|
2655
2742
|
return e.length ? [...a].sort((i, n) => {
|
|
2656
2743
|
for (const r of e) {
|
|
2657
|
-
const s = t.find((u) => u.field === r.field)?.sortComparator ??
|
|
2744
|
+
const s = t.find((u) => u.field === r.field)?.sortComparator ?? ui, l = i[r.field], d = n[r.field], c = s(l, d, i, n);
|
|
2658
2745
|
if (c !== 0)
|
|
2659
2746
|
return r.direction === "asc" ? c : -c;
|
|
2660
2747
|
}
|
|
2661
2748
|
return 0;
|
|
2662
2749
|
}) : [...a];
|
|
2663
2750
|
}
|
|
2664
|
-
function
|
|
2751
|
+
function ui(a, e) {
|
|
2665
2752
|
return a == null && e == null ? 0 : a == null ? 1 : e == null ? -1 : typeof a == "number" && typeof e == "number" ? a - e : a instanceof Date && e instanceof Date ? a.getTime() - e.getTime() : typeof a == "boolean" && typeof e == "boolean" ? a === e ? 0 : a ? -1 : 1 : String(a).localeCompare(String(e));
|
|
2666
2753
|
}
|
|
2667
|
-
function
|
|
2754
|
+
function hi(a, e, t, i) {
|
|
2668
2755
|
const n = a.find((r) => r.field === e);
|
|
2669
2756
|
return t ? n ? n.direction === "asc" ? a.map((r) => r.field === e ? { ...r, direction: "desc" } : r) : a.filter((r) => r.field !== e) : a.length < i ? [...a, { field: e, direction: "asc" }] : a : n?.direction === "asc" ? [{ field: e, direction: "desc" }] : n?.direction === "desc" ? [] : [{ field: e, direction: "asc" }];
|
|
2670
2757
|
}
|
|
@@ -2675,10 +2762,10 @@ function Me(a, e) {
|
|
|
2675
2762
|
function Ne(a, e) {
|
|
2676
2763
|
return a.find((t) => t.field === e)?.direction;
|
|
2677
2764
|
}
|
|
2678
|
-
const
|
|
2679
|
-
class
|
|
2765
|
+
const gi = '@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}}';
|
|
2766
|
+
class xn extends A {
|
|
2680
2767
|
name = "multiSort";
|
|
2681
|
-
styles =
|
|
2768
|
+
styles = gi;
|
|
2682
2769
|
get defaultConfig() {
|
|
2683
2770
|
return {
|
|
2684
2771
|
maxSortColumns: 3,
|
|
@@ -2690,12 +2777,12 @@ class Cn extends A {
|
|
|
2690
2777
|
this.sortModel = [];
|
|
2691
2778
|
}
|
|
2692
2779
|
processRows(e) {
|
|
2693
|
-
return this.sortModel.length === 0 ? [...e] :
|
|
2780
|
+
return this.sortModel.length === 0 ? [...e] : ci([...e], this.sortModel, [...this.columns]);
|
|
2694
2781
|
}
|
|
2695
2782
|
onHeaderClick(e) {
|
|
2696
2783
|
if (!this.columns.find((r) => r.field === e.field)?.sortable) return !1;
|
|
2697
2784
|
const i = e.originalEvent.shiftKey, n = this.config.maxSortColumns ?? 3;
|
|
2698
|
-
return this.sortModel =
|
|
2785
|
+
return this.sortModel = hi(this.sortModel, e.field, i, n), this.emit("sort-change", { sortModel: [...this.sortModel] }), this.requestRender(), !0;
|
|
2699
2786
|
}
|
|
2700
2787
|
afterRender() {
|
|
2701
2788
|
const e = this.gridElement;
|
|
@@ -2755,7 +2842,7 @@ class Cn extends A {
|
|
|
2755
2842
|
}
|
|
2756
2843
|
}
|
|
2757
2844
|
function rt(a, e) {
|
|
2758
|
-
return
|
|
2845
|
+
return gt(a, e);
|
|
2759
2846
|
}
|
|
2760
2847
|
function ot(a, e) {
|
|
2761
2848
|
const t = a.sticky;
|
|
@@ -2765,10 +2852,10 @@ function st(a, e) {
|
|
|
2765
2852
|
const t = a.sticky;
|
|
2766
2853
|
return t ? rt(t, e) === "right" : !1;
|
|
2767
2854
|
}
|
|
2768
|
-
function
|
|
2855
|
+
function fi(a, e = "ltr") {
|
|
2769
2856
|
return a.filter((t) => ot(t, e));
|
|
2770
2857
|
}
|
|
2771
|
-
function
|
|
2858
|
+
function pi(a, e = "ltr") {
|
|
2772
2859
|
return a.filter((t) => st(t, e));
|
|
2773
2860
|
}
|
|
2774
2861
|
function se(a) {
|
|
@@ -2806,7 +2893,7 @@ function He(a) {
|
|
|
2806
2893
|
});
|
|
2807
2894
|
}
|
|
2808
2895
|
const Ke = "canMoveColumn";
|
|
2809
|
-
class
|
|
2896
|
+
class Cn extends A {
|
|
2810
2897
|
static manifest = {
|
|
2811
2898
|
ownedProperties: [
|
|
2812
2899
|
{
|
|
@@ -2880,11 +2967,11 @@ class En extends A {
|
|
|
2880
2967
|
}
|
|
2881
2968
|
getLeftPinnedColumns() {
|
|
2882
2969
|
const e = [...this.columns], t = ue(this.grid);
|
|
2883
|
-
return
|
|
2970
|
+
return fi(e, t);
|
|
2884
2971
|
}
|
|
2885
2972
|
getRightPinnedColumns() {
|
|
2886
2973
|
const e = [...this.columns], t = ue(this.grid);
|
|
2887
|
-
return
|
|
2974
|
+
return pi(e, t);
|
|
2888
2975
|
}
|
|
2889
2976
|
clearStickyPositions() {
|
|
2890
2977
|
He(this.grid);
|
|
@@ -2908,7 +2995,7 @@ class En extends A {
|
|
|
2908
2995
|
return { left: i, right: n, skipScroll: r };
|
|
2909
2996
|
}
|
|
2910
2997
|
}
|
|
2911
|
-
function
|
|
2998
|
+
function mi(a) {
|
|
2912
2999
|
return typeof a == "object" && a !== null && "aggFunc" in a;
|
|
2913
3000
|
}
|
|
2914
3001
|
function ae(a, e) {
|
|
@@ -2933,7 +3020,7 @@ function ae(a, e) {
|
|
|
2933
3020
|
}
|
|
2934
3021
|
if (a.customPanels)
|
|
2935
3022
|
for (const o of a.customPanels) {
|
|
2936
|
-
const s =
|
|
3023
|
+
const s = wi(o, e);
|
|
2937
3024
|
switch (o.position) {
|
|
2938
3025
|
case "left":
|
|
2939
3026
|
i.appendChild(s);
|
|
@@ -2966,7 +3053,7 @@ function Oe(a, e, t, i) {
|
|
|
2966
3053
|
let l, d;
|
|
2967
3054
|
const c = n.aggregators?.[o.field];
|
|
2968
3055
|
if (c)
|
|
2969
|
-
if (
|
|
3056
|
+
if (mi(c)) {
|
|
2970
3057
|
const u = ye(c.aggFunc);
|
|
2971
3058
|
u && (l = u(i, o.field, o)), d = c.formatter;
|
|
2972
3059
|
} else {
|
|
@@ -2982,7 +3069,7 @@ function Oe(a, e, t, i) {
|
|
|
2982
3069
|
a.appendChild(r);
|
|
2983
3070
|
}
|
|
2984
3071
|
}
|
|
2985
|
-
function
|
|
3072
|
+
function wi(a, e) {
|
|
2986
3073
|
const t = document.createElement("div");
|
|
2987
3074
|
t.className = "tbw-status-panel tbw-status-panel-custom", t.id = `status-panel-${a.id}`;
|
|
2988
3075
|
const i = a.render(e);
|
|
@@ -2998,10 +3085,10 @@ function Ge(a, e, t, i, n) {
|
|
|
2998
3085
|
grid: t
|
|
2999
3086
|
};
|
|
3000
3087
|
}
|
|
3001
|
-
const
|
|
3002
|
-
class
|
|
3088
|
+
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 A {
|
|
3003
3090
|
name = "pinnedRows";
|
|
3004
|
-
styles =
|
|
3091
|
+
styles = bi;
|
|
3005
3092
|
get defaultConfig() {
|
|
3006
3093
|
return {
|
|
3007
3094
|
position: "bottom",
|
|
@@ -3024,7 +3111,7 @@ class Rn extends A {
|
|
|
3024
3111
|
if (!t) return;
|
|
3025
3112
|
this.footerWrapper && !t.contains(this.footerWrapper) && (this.footerWrapper = null, this.bottomAggregationContainer = null, this.infoBarElement = null), this.topAggregationContainer && !t.contains(this.topAggregationContainer) && (this.topAggregationContainer = null), this.infoBarElement && !t.contains(this.infoBarElement) && (this.infoBarElement = null);
|
|
3026
3113
|
const i = this.getSelectionState(), n = this.getFilterState(), r = Ge(
|
|
3027
|
-
this.
|
|
3114
|
+
this.sourceRows,
|
|
3028
3115
|
this.columns,
|
|
3029
3116
|
this.grid,
|
|
3030
3117
|
i,
|
|
@@ -3040,7 +3127,7 @@ class Rn extends A {
|
|
|
3040
3127
|
this.topAggregationContainer,
|
|
3041
3128
|
s,
|
|
3042
3129
|
this.visibleColumns,
|
|
3043
|
-
this.
|
|
3130
|
+
this.sourceRows
|
|
3044
3131
|
);
|
|
3045
3132
|
} else this.topAggregationContainer && (this.topAggregationContainer.remove(), this.topAggregationContainer = null);
|
|
3046
3133
|
const d = this.config.showRowCount !== !1 || this.config.showSelectedCount && r.selectedRows > 0 || this.config.showFilteredCount && r.filteredRows !== r.totalRows || this.config.customPanels && this.config.customPanels.length > 0, c = d && this.config.position !== "top", u = l.length > 0 || c;
|
|
@@ -3056,7 +3143,7 @@ class Rn extends A {
|
|
|
3056
3143
|
this.bottomAggregationContainer,
|
|
3057
3144
|
l,
|
|
3058
3145
|
this.visibleColumns,
|
|
3059
|
-
this.
|
|
3146
|
+
this.sourceRows
|
|
3060
3147
|
)), c && (this.infoBarElement = ae(this.config, r), this.footerWrapper.appendChild(this.infoBarElement))) : this.cleanupFooter();
|
|
3061
3148
|
}
|
|
3062
3149
|
cleanup() {
|
|
@@ -3105,16 +3192,16 @@ class Rn extends A {
|
|
|
3105
3192
|
this.config.aggregationRows && (this.config.aggregationRows = this.config.aggregationRows.filter((t) => t.id !== e), this.requestRender());
|
|
3106
3193
|
}
|
|
3107
3194
|
}
|
|
3108
|
-
const
|
|
3109
|
-
function
|
|
3195
|
+
const vi = ft;
|
|
3196
|
+
function yi(a) {
|
|
3110
3197
|
const e = [];
|
|
3111
3198
|
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;
|
|
3112
3199
|
}
|
|
3113
3200
|
function be(a, e) {
|
|
3114
3201
|
return [...a, e].join("|");
|
|
3115
3202
|
}
|
|
3116
|
-
function
|
|
3117
|
-
const t = e.rowGroupFields ?? [], i = e.columnGroupFields ?? [], n = e.valueFields ?? [], r =
|
|
3203
|
+
function xi(a, e) {
|
|
3204
|
+
const t = e.rowGroupFields ?? [], i = e.columnGroupFields ?? [], n = e.valueFields ?? [], r = Ci(a, i), o = at(
|
|
3118
3205
|
a,
|
|
3119
3206
|
t,
|
|
3120
3207
|
i,
|
|
@@ -3122,7 +3209,7 @@ function Ci(a, e) {
|
|
|
3122
3209
|
n,
|
|
3123
3210
|
0,
|
|
3124
3211
|
""
|
|
3125
|
-
), s =
|
|
3212
|
+
), s = Ri(o, r, n), l = Object.values(s).reduce((d, c) => d + c, 0);
|
|
3126
3213
|
return {
|
|
3127
3214
|
rows: o,
|
|
3128
3215
|
columnKeys: r,
|
|
@@ -3130,7 +3217,7 @@ function Ci(a, e) {
|
|
|
3130
3217
|
grandTotal: l
|
|
3131
3218
|
};
|
|
3132
3219
|
}
|
|
3133
|
-
function
|
|
3220
|
+
function Ci(a, e) {
|
|
3134
3221
|
if (e.length === 0) return ["value"];
|
|
3135
3222
|
const t = /* @__PURE__ */ new Set();
|
|
3136
3223
|
for (const i of a) {
|
|
@@ -3139,7 +3226,7 @@ function Ei(a, e) {
|
|
|
3139
3226
|
}
|
|
3140
3227
|
return [...t].sort();
|
|
3141
3228
|
}
|
|
3142
|
-
function
|
|
3229
|
+
function Ei(a, e) {
|
|
3143
3230
|
const t = /* @__PURE__ */ new Map();
|
|
3144
3231
|
for (const i of a) {
|
|
3145
3232
|
const n = String(i[e] ?? ""), r = t.get(n);
|
|
@@ -3161,7 +3248,7 @@ function at(a, e, t, i, n, r, o) {
|
|
|
3161
3248
|
rowCount: a.length
|
|
3162
3249
|
}), s;
|
|
3163
3250
|
}
|
|
3164
|
-
const l = e[0], d = e.slice(1), c = d.length > 0, u =
|
|
3251
|
+
const l = e[0], d = e.slice(1), c = d.length > 0, u = Ei(a, l);
|
|
3165
3252
|
for (const [h, g] of u) {
|
|
3166
3253
|
const f = o ? `${o}|${h}` : h, p = Be(g, t, i, n), w = Ve(p);
|
|
3167
3254
|
let b;
|
|
@@ -3190,7 +3277,7 @@ function Be(a, e, t, i) {
|
|
|
3190
3277
|
const n = {};
|
|
3191
3278
|
for (const r of t)
|
|
3192
3279
|
for (const o of i) {
|
|
3193
|
-
const l = (e.length > 0 ? a.filter((h) => e.map((g) => String(h[g] ?? "")).join("|") === r) : a).map((h) => Number(h[o.field]) || 0), d =
|
|
3280
|
+
const l = (e.length > 0 ? a.filter((h) => e.map((g) => String(h[g] ?? "")).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);
|
|
3194
3281
|
n[u] = c;
|
|
3195
3282
|
}
|
|
3196
3283
|
return n;
|
|
@@ -3201,7 +3288,7 @@ function Ve(a) {
|
|
|
3201
3288
|
e += t ?? 0;
|
|
3202
3289
|
return e;
|
|
3203
3290
|
}
|
|
3204
|
-
function
|
|
3291
|
+
function Ri(a, e, t) {
|
|
3205
3292
|
const i = {};
|
|
3206
3293
|
function n(r) {
|
|
3207
3294
|
for (const o of r)
|
|
@@ -3215,7 +3302,7 @@ function Si(a, e, t) {
|
|
|
3215
3302
|
}
|
|
3216
3303
|
return n(a), i;
|
|
3217
3304
|
}
|
|
3218
|
-
function
|
|
3305
|
+
function Si(a, e, t = !0) {
|
|
3219
3306
|
const i = [];
|
|
3220
3307
|
function n(r) {
|
|
3221
3308
|
i.push(r);
|
|
@@ -3228,7 +3315,7 @@ function ki(a, e, t = !0) {
|
|
|
3228
3315
|
n(r);
|
|
3229
3316
|
return i;
|
|
3230
3317
|
}
|
|
3231
|
-
function
|
|
3318
|
+
function ki(a) {
|
|
3232
3319
|
const e = [];
|
|
3233
3320
|
function t(i) {
|
|
3234
3321
|
if (i.isGroup && e.push(i.rowKey), i.children)
|
|
@@ -3239,10 +3326,10 @@ function Ai(a) {
|
|
|
3239
3326
|
t(i);
|
|
3240
3327
|
return e;
|
|
3241
3328
|
}
|
|
3242
|
-
const
|
|
3243
|
-
function
|
|
3329
|
+
const Ai = ["sum", "avg", "count", "min", "max", "first", "last"];
|
|
3330
|
+
function _i(a, e, t, i) {
|
|
3244
3331
|
const n = new AbortController(), r = { config: e, callbacks: i, signal: n.signal }, o = document.createElement("div");
|
|
3245
|
-
return o.className = "tbw-pivot-panel", o.appendChild(j("Options", () =>
|
|
3332
|
+
return o.className = "tbw-pivot-panel", o.appendChild(j("Options", () => Pi(t, r))), o.appendChild(j("Row Groups", () => We("rowGroups", r))), o.appendChild(j("Column Groups", () => We("columnGroups", r))), o.appendChild(j("Values", () => Li(r))), o.appendChild(j("Available Fields", () => Fi(r))), a.appendChild(o), () => {
|
|
3246
3333
|
n.abort(), o.remove();
|
|
3247
3334
|
};
|
|
3248
3335
|
}
|
|
@@ -3263,7 +3350,7 @@ function We(a, e) {
|
|
|
3263
3350
|
s.className = "tbw-pivot-placeholder", s.textContent = "Drag fields here or click to add", r.appendChild(s);
|
|
3264
3351
|
} else
|
|
3265
3352
|
for (const s of o)
|
|
3266
|
-
r.appendChild(
|
|
3353
|
+
r.appendChild(Ti(s, a, e));
|
|
3267
3354
|
return r.addEventListener(
|
|
3268
3355
|
"dragover",
|
|
3269
3356
|
(s) => {
|
|
@@ -3286,7 +3373,7 @@ function We(a, e) {
|
|
|
3286
3373
|
{ signal: n }
|
|
3287
3374
|
), r;
|
|
3288
3375
|
}
|
|
3289
|
-
function
|
|
3376
|
+
function Ti(a, e, t) {
|
|
3290
3377
|
const { callbacks: i, signal: n } = t, r = document.createElement("div");
|
|
3291
3378
|
r.className = "tbw-pivot-field-chip", r.draggable = !0;
|
|
3292
3379
|
const o = i.getAvailableFields().find((d) => d.field === a), s = document.createElement("span");
|
|
@@ -3312,7 +3399,7 @@ function Li(a, e, t) {
|
|
|
3312
3399
|
{ signal: n }
|
|
3313
3400
|
), r;
|
|
3314
3401
|
}
|
|
3315
|
-
function
|
|
3402
|
+
function Li(a) {
|
|
3316
3403
|
const { config: e, callbacks: t, signal: i } = a, n = document.createElement("div");
|
|
3317
3404
|
n.className = "tbw-pivot-drop-zone tbw-pivot-values-zone", n.setAttribute("data-zone", "values");
|
|
3318
3405
|
const r = e.valueFields ?? [];
|
|
@@ -3353,7 +3440,7 @@ function Ii(a, e) {
|
|
|
3353
3440
|
s.className = "tbw-pivot-chip-label", s.textContent = r?.header ?? a.field;
|
|
3354
3441
|
const l = document.createElement("select");
|
|
3355
3442
|
l.className = "tbw-pivot-agg-select", l.title = "Aggregation function";
|
|
3356
|
-
for (const c of
|
|
3443
|
+
for (const c of Ai) {
|
|
3357
3444
|
const u = document.createElement("option");
|
|
3358
3445
|
u.value = c, u.textContent = c.toUpperCase(), u.selected = c === a.aggFunc, l.appendChild(u);
|
|
3359
3446
|
}
|
|
@@ -3373,7 +3460,7 @@ function Ii(a, e) {
|
|
|
3373
3460
|
{ signal: i }
|
|
3374
3461
|
), o.appendChild(s), o.appendChild(l), n.appendChild(o), n.appendChild(d), n;
|
|
3375
3462
|
}
|
|
3376
|
-
function
|
|
3463
|
+
function Fi(a) {
|
|
3377
3464
|
const { config: e, callbacks: t, signal: i } = a, n = document.createElement("div");
|
|
3378
3465
|
n.className = "tbw-pivot-available-fields";
|
|
3379
3466
|
const r = t.getAvailableFields(), o = /* @__PURE__ */ new Set([
|
|
@@ -3403,7 +3490,7 @@ function Pi(a) {
|
|
|
3403
3490
|
}
|
|
3404
3491
|
return n;
|
|
3405
3492
|
}
|
|
3406
|
-
function
|
|
3493
|
+
function Pi(a, e) {
|
|
3407
3494
|
const { config: t, callbacks: i, signal: n } = e, r = document.createElement("div");
|
|
3408
3495
|
return r.className = "tbw-pivot-options", r.appendChild(
|
|
3409
3496
|
le(
|
|
@@ -3442,7 +3529,7 @@ function le(a, e, t, i) {
|
|
|
3442
3529
|
const o = document.createElement("span");
|
|
3443
3530
|
return o.textContent = a, n.appendChild(r), n.appendChild(o), n;
|
|
3444
3531
|
}
|
|
3445
|
-
function
|
|
3532
|
+
function Di(a, e, t) {
|
|
3446
3533
|
return e.className = "data-grid-row pivot-group-row", e.setAttribute("data-pivot-depth", String(a.__pivotDepth ?? 0)), e.setAttribute("data-pivot-key", String(a.__pivotRowKey ?? "")), e.setAttribute("role", "row"), e.innerHTML = "", t.columns.forEach((i, n) => {
|
|
3447
3534
|
const r = document.createElement("div");
|
|
3448
3535
|
if (r.className = "cell", r.setAttribute("data-col", String(n)), r.setAttribute("data-row", String(t.rowIndex)), r.setAttribute("role", "gridcell"), n === 0) {
|
|
@@ -3463,7 +3550,7 @@ function Mi(a, e, t) {
|
|
|
3463
3550
|
e.appendChild(r);
|
|
3464
3551
|
}), !0;
|
|
3465
3552
|
}
|
|
3466
|
-
function
|
|
3553
|
+
function Mi(a, e, t, i) {
|
|
3467
3554
|
return e.className = "data-grid-row pivot-leaf-row", e.setAttribute("data-pivot-depth", String(a.__pivotDepth ?? 0)), e.setAttribute("data-pivot-key", String(a.__pivotRowKey ?? "")), e.innerHTML = "", t.forEach((n, r) => {
|
|
3468
3555
|
const o = document.createElement("div");
|
|
3469
3556
|
if (o.className = "cell", o.setAttribute("data-col", String(r)), o.setAttribute("data-row", String(i)), o.setAttribute("role", "gridcell"), r === 0) {
|
|
@@ -3478,7 +3565,7 @@ function Ni(a, e, t, i) {
|
|
|
3478
3565
|
e.appendChild(o);
|
|
3479
3566
|
}), !0;
|
|
3480
3567
|
}
|
|
3481
|
-
function
|
|
3568
|
+
function Ni(a, e, t) {
|
|
3482
3569
|
return e.className = "pivot-grand-total-row", e.setAttribute("role", "presentation"), e.innerHTML = "", t.forEach((i, n) => {
|
|
3483
3570
|
const r = document.createElement("div");
|
|
3484
3571
|
if (r.className = "cell", r.setAttribute("data-col", String(n)), n === 0) {
|
|
@@ -3491,10 +3578,10 @@ function qi(a, e, t) {
|
|
|
3491
3578
|
e.appendChild(r);
|
|
3492
3579
|
}), !0;
|
|
3493
3580
|
}
|
|
3494
|
-
const
|
|
3581
|
+
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}}}';
|
|
3495
3582
|
class G extends A {
|
|
3496
3583
|
name = "pivot";
|
|
3497
|
-
styles =
|
|
3584
|
+
styles = qi;
|
|
3498
3585
|
static PANEL_ID = "pivot";
|
|
3499
3586
|
get defaultConfig() {
|
|
3500
3587
|
return {
|
|
@@ -3540,11 +3627,11 @@ class G extends A {
|
|
|
3540
3627
|
processRows(e) {
|
|
3541
3628
|
if (!this.hasInitialized && this.config.active !== !1 && this.hasValidPivotConfig() && (this.hasInitialized = !0, this.isActive = !0), !this.isActive)
|
|
3542
3629
|
return [...e];
|
|
3543
|
-
const t =
|
|
3630
|
+
const t = yi(this.config);
|
|
3544
3631
|
if (t.length > 0)
|
|
3545
3632
|
return this.warn(`Config errors: ${t.join(", ")}`), [...e];
|
|
3546
|
-
this.buildFieldHeaderMap(), this.defaultExpanded = this.config.defaultExpanded ?? !0, this.pivotResult =
|
|
3547
|
-
const i = this.config.indentWidth ?? 20, n =
|
|
3633
|
+
this.buildFieldHeaderMap(), this.defaultExpanded = this.config.defaultExpanded ?? !0, this.pivotResult = xi(e, this.config), this.expandedKeys.size === 0 && this.defaultExpanded && !this.userHasToggledExpand && this.expandAllKeys();
|
|
3634
|
+
const i = this.config.indentWidth ?? 20, n = Si(
|
|
3548
3635
|
this.pivotResult.rows,
|
|
3549
3636
|
this.expandedKeys,
|
|
3550
3637
|
this.defaultExpanded
|
|
@@ -3596,13 +3683,13 @@ class G extends A {
|
|
|
3596
3683
|
}
|
|
3597
3684
|
renderRow(e, t, i) {
|
|
3598
3685
|
const n = e;
|
|
3599
|
-
return n.__pivotRowKey && n.__pivotHasChildren ?
|
|
3686
|
+
return n.__pivotRowKey && n.__pivotHasChildren ? Di(n, t, {
|
|
3600
3687
|
columns: this.gridColumns,
|
|
3601
3688
|
rowIndex: i,
|
|
3602
3689
|
onToggle: (r) => this.toggle(r),
|
|
3603
3690
|
resolveIcon: (r) => this.resolveIcon(r),
|
|
3604
3691
|
setIcon: (r, o) => this.setIcon(r, o)
|
|
3605
|
-
}) : n.__pivotRowKey !== void 0 && this.isActive ?
|
|
3692
|
+
}) : n.__pivotRowKey !== void 0 && this.isActive ? Mi(n, t, this.gridColumns, i) : (this.cleanupPivotStyling(t), !1);
|
|
3606
3693
|
}
|
|
3607
3694
|
cleanupPivotStyling(e) {
|
|
3608
3695
|
(e.classList.contains("pivot-group-row") || e.classList.contains("pivot-leaf-row") || e.classList.contains("pivot-grand-total-row")) && (e.classList.remove("pivot-group-row", "pivot-leaf-row", "pivot-grand-total-row"), e.classList.add("data-grid-row"), e.removeAttribute("data-pivot-depth"), e.innerHTML = "");
|
|
@@ -3640,7 +3727,7 @@ class G extends A {
|
|
|
3640
3727
|
__pivotTotal: this.pivotResult.grandTotal,
|
|
3641
3728
|
...this.pivotResult.totals
|
|
3642
3729
|
};
|
|
3643
|
-
|
|
3730
|
+
Ni(i, this.grandTotalFooter, this.gridColumns);
|
|
3644
3731
|
}
|
|
3645
3732
|
cleanupGrandTotalFooter() {
|
|
3646
3733
|
this.grandTotalFooter && (this.grandTotalFooter.remove(), this.grandTotalFooter = null);
|
|
@@ -3662,7 +3749,7 @@ class G extends A {
|
|
|
3662
3749
|
}
|
|
3663
3750
|
expandAllKeys() {
|
|
3664
3751
|
if (!this.pivotResult) return;
|
|
3665
|
-
const e =
|
|
3752
|
+
const e = ki(this.pivotResult.rows);
|
|
3666
3753
|
for (const t of e)
|
|
3667
3754
|
this.expandedKeys.add(t);
|
|
3668
3755
|
}
|
|
@@ -3747,7 +3834,7 @@ class G extends A {
|
|
|
3747
3834
|
},
|
|
3748
3835
|
getAvailableFields: () => this.getAvailableFields()
|
|
3749
3836
|
};
|
|
3750
|
-
return
|
|
3837
|
+
return _i(e, this.config, this.isActive, t);
|
|
3751
3838
|
}
|
|
3752
3839
|
refreshPanel() {
|
|
3753
3840
|
this.panelContainer && (this.panelContainer.innerHTML = "", this.renderPanel(this.panelContainer));
|
|
@@ -3781,7 +3868,7 @@ class G extends A {
|
|
|
3781
3868
|
}
|
|
3782
3869
|
}
|
|
3783
3870
|
const Q = "tbw-print-isolation-style";
|
|
3784
|
-
function
|
|
3871
|
+
function Hi(a, e) {
|
|
3785
3872
|
const t = document.createElement("style");
|
|
3786
3873
|
return t.id = Q, t.textContent = `
|
|
3787
3874
|
/* Print isolation: hide everything except the target grid */
|
|
@@ -3855,12 +3942,12 @@ function Ki(a, e) {
|
|
|
3855
3942
|
}
|
|
3856
3943
|
`, t;
|
|
3857
3944
|
}
|
|
3858
|
-
async function
|
|
3945
|
+
async function Ki(a, e = {}) {
|
|
3859
3946
|
const { orientation: t = "landscape" } = e, i = a.id;
|
|
3860
3947
|
document.querySelectorAll(`#${CSS.escape(i)}`).length > 1 && console.warn(
|
|
3861
3948
|
`[tbw-grid:print] Multiple elements found with id="${i}". Print isolation may not work correctly. Ensure each grid has a unique ID.`
|
|
3862
3949
|
), document.getElementById(Q)?.remove();
|
|
3863
|
-
const r =
|
|
3950
|
+
const r = Hi(i, t);
|
|
3864
3951
|
return document.head.appendChild(r), new Promise((o) => {
|
|
3865
3952
|
const s = () => {
|
|
3866
3953
|
window.removeEventListener("afterprint", s), document.getElementById(Q)?.remove(), o();
|
|
@@ -3870,7 +3957,7 @@ async function zi(a, e = {}) {
|
|
|
3870
3957
|
}, 5e3);
|
|
3871
3958
|
});
|
|
3872
3959
|
}
|
|
3873
|
-
const
|
|
3960
|
+
const zi = ".tbw-print-header,.tbw-print-footer{display:none}@media print{tbw-grid{overflow:visible!important;height:auto!important;border:none!important;border-radius:0!important;color-scheme:light only;-webkit-print-color-adjust:exact;print-color-adjust:exact}tbw-grid .tbw-grid-content{overflow:visible!important;height:auto!important;max-height:none!important}tbw-grid .tbw-scroll-area{overflow:visible!important;height:auto!important;max-height:none!important}tbw-grid .rows-body{overflow:visible!important;height:auto!important;max-height:none!important}tbw-grid .rows-container,tbw-grid .rows-viewport,tbw-grid .rows{overflow:visible!important;height:auto!important;max-height:none!important;transform:none!important}tbw-grid .rows-viewport .rows{position:static!important}tbw-grid .resize-handle,tbw-grid [part=sort-indicator],tbw-grid .tbw-filter-btn,tbw-grid .tool-panel,tbw-grid .tool-panel-content,tbw-grid .tbw-shell-header,tbw-grid .shell-toolbar,tbw-grid .tool-panel-toggle,tbw-grid [data-print-hide],tbw-grid .expander-cell,tbw-grid .tree-toggle,tbw-grid .context-menu,tbw-grid .faux-vscroll{display:none!important}tbw-grid .tbw-print-header{display:flex;justify-content:space-between;align-items:baseline;padding:var(--tbw-spacing-md, .5em) 0;margin-bottom:var(--tbw-spacing-md, .5em);border-bottom:2px solid var(--tbw-print-border, var(--tbw-color-border-strong));font-family:inherit}.tbw-print-header-title{font-size:1.25em;font-weight:700}.tbw-print-header-timestamp{font-size:var(--tbw-font-size-sm, .875em);color:var(--tbw-print-muted, var(--tbw-color-fg-muted))}tbw-grid .tbw-print-footer{display:block;margin-top:var(--tbw-spacing-md, .5em);padding-top:var(--tbw-spacing-md, .5em);border-top:1px solid var(--tbw-print-border, var(--tbw-color-border));font-size:var(--tbw-font-size-xs, .75em);color:var(--tbw-print-muted, var(--tbw-color-fg-muted));text-align:end}tbw-grid .data-grid-row{break-inside:avoid;page-break-inside:avoid}tbw-grid .cell{border:1px solid var(--tbw-print-cell-border, var(--tbw-color-border))!important}tbw-grid .header-row,tbw-grid .data-grid-row{padding-inline-end:1px}tbw-grid .data-grid-row:hover,tbw-grid .cell:hover{background:inherit!important}@page{margin:1cm}tbw-grid.print-landscape{@page{size:landscape}}tbw-grid.print-portrait{@page{size:portrait}}}", Oi = {
|
|
3874
3961
|
button: !1,
|
|
3875
3962
|
orientation: "landscape",
|
|
3876
3963
|
warnThreshold: 500,
|
|
@@ -3880,18 +3967,18 @@ const Oi = ".tbw-print-header,.tbw-print-footer{display:none}@media print{tbw-gr
|
|
|
3880
3967
|
title: "",
|
|
3881
3968
|
isolate: !1
|
|
3882
3969
|
};
|
|
3883
|
-
class
|
|
3970
|
+
class Rn extends A {
|
|
3884
3971
|
name = "print";
|
|
3885
3972
|
version = "1.0.0";
|
|
3886
|
-
styles =
|
|
3973
|
+
styles = zi;
|
|
3887
3974
|
#e = !1;
|
|
3888
3975
|
#t = null;
|
|
3889
|
-
#
|
|
3976
|
+
#s = null;
|
|
3890
3977
|
#n = null;
|
|
3891
3978
|
#i = null;
|
|
3892
|
-
#
|
|
3979
|
+
#o = null;
|
|
3893
3980
|
#d = null;
|
|
3894
|
-
get #
|
|
3981
|
+
get #r() {
|
|
3895
3982
|
return this.grid;
|
|
3896
3983
|
}
|
|
3897
3984
|
isPrinting() {
|
|
@@ -3907,7 +3994,7 @@ class Sn extends A {
|
|
|
3907
3994
|
console.warn("[PrintPlugin] Grid not available");
|
|
3908
3995
|
return;
|
|
3909
3996
|
}
|
|
3910
|
-
const i = { ...
|
|
3997
|
+
const i = { ...Oi, ...this.config, ...e }, r = this.rows.length;
|
|
3911
3998
|
let o = r, s = !1;
|
|
3912
3999
|
if (i.warnThreshold > 0 && r > i.warnThreshold) {
|
|
3913
4000
|
const d = i.maxRows > 0 ? `
|
|
@@ -3928,10 +4015,10 @@ Click OK to continue, or Cancel to abort.`
|
|
|
3928
4015
|
originalRowCount: r
|
|
3929
4016
|
});
|
|
3930
4017
|
try {
|
|
3931
|
-
const d = this.#
|
|
3932
|
-
this.#
|
|
4018
|
+
const d = this.#r;
|
|
4019
|
+
this.#s = {
|
|
3933
4020
|
bypassThreshold: d._virtualization?.bypassThreshold ?? 24
|
|
3934
|
-
}, this.#
|
|
4021
|
+
}, this.#l(), 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.#w(), 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.#p(i) : await this.#h(), this.emit("print-complete", {
|
|
3935
4022
|
success: !0,
|
|
3936
4023
|
rowCount: o,
|
|
3937
4024
|
duration: Math.round(performance.now() - l)
|
|
@@ -3943,7 +4030,7 @@ Click OK to continue, or Cancel to abort.`
|
|
|
3943
4030
|
duration: Math.round(performance.now() - l)
|
|
3944
4031
|
});
|
|
3945
4032
|
} finally {
|
|
3946
|
-
this.#
|
|
4033
|
+
this.#f(), this.#e = !1;
|
|
3947
4034
|
}
|
|
3948
4035
|
}
|
|
3949
4036
|
#c(e) {
|
|
@@ -3957,16 +4044,16 @@ Click OK to continue, or Cancel to abort.`
|
|
|
3957
4044
|
const i = document.createElement("div");
|
|
3958
4045
|
i.className = "tbw-print-header-timestamp", i.textContent = `Printed: ${(/* @__PURE__ */ new Date()).toLocaleString()}`, this.#i.appendChild(i);
|
|
3959
4046
|
}
|
|
3960
|
-
t.insertBefore(this.#i, t.firstChild), this.#
|
|
4047
|
+
t.insertBefore(this.#i, t.firstChild), this.#o = document.createElement("div"), this.#o.className = "tbw-print-footer", this.#o.textContent = `Page generated from ${window.location.hostname}`, t.appendChild(this.#o);
|
|
3961
4048
|
}
|
|
3962
4049
|
}
|
|
3963
|
-
async #
|
|
3964
|
-
const e = this.#
|
|
4050
|
+
async #w() {
|
|
4051
|
+
const e = this.#r;
|
|
3965
4052
|
if (!e._virtualization) return;
|
|
3966
4053
|
const t = this.rows.length;
|
|
3967
4054
|
e._virtualization.bypassThreshold = t + 100, e.refreshVirtualWindow(!0), await new Promise((i) => setTimeout(i, 100));
|
|
3968
4055
|
}
|
|
3969
|
-
async #
|
|
4056
|
+
async #h() {
|
|
3970
4057
|
return new Promise((e) => {
|
|
3971
4058
|
const t = () => {
|
|
3972
4059
|
window.removeEventListener("afterprint", t), e();
|
|
@@ -3976,13 +4063,13 @@ Click OK to continue, or Cancel to abort.`
|
|
|
3976
4063
|
}, 1e3);
|
|
3977
4064
|
});
|
|
3978
4065
|
}
|
|
3979
|
-
async #
|
|
4066
|
+
async #p(e) {
|
|
3980
4067
|
const t = this.gridElement;
|
|
3981
|
-
t && await
|
|
4068
|
+
t && await Ki(t, {
|
|
3982
4069
|
orientation: e.orientation
|
|
3983
4070
|
});
|
|
3984
4071
|
}
|
|
3985
|
-
#
|
|
4072
|
+
#l() {
|
|
3986
4073
|
const e = this.columns;
|
|
3987
4074
|
if (e) {
|
|
3988
4075
|
this.#t = /* @__PURE__ */ new Map();
|
|
@@ -3990,26 +4077,26 @@ Click OK to continue, or Cancel to abort.`
|
|
|
3990
4077
|
t.printHidden && t.field && (this.#t.set(t.field, !t.hidden), this.grid.setColumnVisible(t.field, !1));
|
|
3991
4078
|
}
|
|
3992
4079
|
}
|
|
3993
|
-
#
|
|
4080
|
+
#a() {
|
|
3994
4081
|
if (this.#t) {
|
|
3995
4082
|
for (const [e, t] of this.#t)
|
|
3996
4083
|
this.grid.setColumnVisible(e, t);
|
|
3997
4084
|
this.#t = null;
|
|
3998
4085
|
}
|
|
3999
4086
|
}
|
|
4000
|
-
#
|
|
4087
|
+
#f() {
|
|
4001
4088
|
const e = this.gridElement;
|
|
4002
4089
|
if (!e) return;
|
|
4003
|
-
this.#
|
|
4004
|
-
const t = this.#
|
|
4005
|
-
this.#
|
|
4090
|
+
this.#a(), 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.#o && (this.#o.remove(), this.#o = null);
|
|
4091
|
+
const t = this.#r;
|
|
4092
|
+
this.#s && t._virtualization && (t._virtualization.bypassThreshold = this.#s.bypassThreshold, t.refreshVirtualWindow(!0), this.#s = null), this.#n !== null && (this.grid.rows = this.#n, this.#n = null);
|
|
4006
4093
|
}
|
|
4007
4094
|
afterRender() {
|
|
4008
|
-
this.config?.button && !this.#
|
|
4095
|
+
this.config?.button && !this.#u && (this.#g(), this.#u = !0);
|
|
4009
4096
|
}
|
|
4010
|
-
#
|
|
4011
|
-
#
|
|
4012
|
-
this.#
|
|
4097
|
+
#u = !1;
|
|
4098
|
+
#g() {
|
|
4099
|
+
this.#r.registerToolbarContent?.({
|
|
4013
4100
|
id: "print-button",
|
|
4014
4101
|
order: 900,
|
|
4015
4102
|
render: (t) => {
|
|
@@ -4027,7 +4114,7 @@ Click OK to continue, or Cancel to abort.`
|
|
|
4027
4114
|
});
|
|
4028
4115
|
}
|
|
4029
4116
|
}
|
|
4030
|
-
function
|
|
4117
|
+
function Gi(a) {
|
|
4031
4118
|
const e = a.meta ?? {};
|
|
4032
4119
|
return e.lockPosition !== !0 && e.suppressMovable !== !0;
|
|
4033
4120
|
}
|
|
@@ -4036,10 +4123,10 @@ function $e(a, e, t) {
|
|
|
4036
4123
|
const i = [...a], [n] = i.splice(e, 1);
|
|
4037
4124
|
return i.splice(t, 0, n), i;
|
|
4038
4125
|
}
|
|
4039
|
-
const
|
|
4040
|
-
class
|
|
4126
|
+
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 A {
|
|
4041
4128
|
name = "reorder";
|
|
4042
|
-
styles =
|
|
4129
|
+
styles = Bi;
|
|
4043
4130
|
get defaultConfig() {
|
|
4044
4131
|
return {
|
|
4045
4132
|
animation: "flip"
|
|
@@ -4056,7 +4143,7 @@ class kn extends A {
|
|
|
4056
4143
|
draggedIndex = null;
|
|
4057
4144
|
dropIndex = null;
|
|
4058
4145
|
canMoveColumnWithPlugins(e) {
|
|
4059
|
-
return !e || !
|
|
4146
|
+
return !e || !Gi(e) ? !1 : !this.grid.query("canMoveColumn", e).includes(!1);
|
|
4060
4147
|
}
|
|
4061
4148
|
clearDragClasses() {
|
|
4062
4149
|
this.gridElement?.querySelectorAll(".header-row > .cell").forEach((e) => {
|
|
@@ -4229,11 +4316,11 @@ class kn extends A {
|
|
|
4229
4316
|
this.grid.requestStateChange?.();
|
|
4230
4317
|
}
|
|
4231
4318
|
}
|
|
4232
|
-
const
|
|
4233
|
-
class
|
|
4319
|
+
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 A {
|
|
4234
4321
|
name = "responsive";
|
|
4235
4322
|
version = "1.0.0";
|
|
4236
|
-
styles =
|
|
4323
|
+
styles = Vi;
|
|
4237
4324
|
static manifest = {
|
|
4238
4325
|
incompatibleWith: [
|
|
4239
4326
|
{
|
|
@@ -4250,25 +4337,25 @@ class An extends A {
|
|
|
4250
4337
|
};
|
|
4251
4338
|
#e;
|
|
4252
4339
|
#t = !1;
|
|
4253
|
-
#
|
|
4340
|
+
#s;
|
|
4254
4341
|
#n = !1;
|
|
4255
4342
|
#i = 0;
|
|
4256
|
-
#
|
|
4343
|
+
#o = /* @__PURE__ */ new Set();
|
|
4257
4344
|
#d = /* @__PURE__ */ new Set();
|
|
4258
|
-
#
|
|
4345
|
+
#r = null;
|
|
4259
4346
|
#c = [];
|
|
4260
4347
|
isResponsive() {
|
|
4261
4348
|
return this.#t;
|
|
4262
4349
|
}
|
|
4263
4350
|
setResponsive(e) {
|
|
4264
|
-
e !== this.#t && (this.#t = e, this.#
|
|
4351
|
+
e !== this.#t && (this.#t = e, this.#f(), this.emit("responsive-change", {
|
|
4265
4352
|
isResponsive: e,
|
|
4266
4353
|
width: this.#i,
|
|
4267
4354
|
breakpoint: this.config.breakpoint ?? 0
|
|
4268
4355
|
}));
|
|
4269
4356
|
}
|
|
4270
4357
|
setBreakpoint(e) {
|
|
4271
|
-
this.config.breakpoint = e, this.#
|
|
4358
|
+
this.config.breakpoint = e, this.#p(this.#i);
|
|
4272
4359
|
}
|
|
4273
4360
|
setCardRenderer(e) {
|
|
4274
4361
|
this.config.cardRenderer = e, this.#t && this.requestRender();
|
|
@@ -4277,17 +4364,17 @@ class An extends A {
|
|
|
4277
4364
|
return this.#i;
|
|
4278
4365
|
}
|
|
4279
4366
|
getActiveBreakpoint() {
|
|
4280
|
-
return this.#
|
|
4367
|
+
return this.#r;
|
|
4281
4368
|
}
|
|
4282
4369
|
attach(e) {
|
|
4283
|
-
super.attach(e), this.#
|
|
4370
|
+
super.attach(e), this.#w(), this.#h(this.config.hiddenColumns), this.config.breakpoints?.length && (this.#c = [...this.config.breakpoints].sort((t, i) => i.maxWidth - t.maxWidth)), this.#e = new ResizeObserver((t) => {
|
|
4284
4371
|
const i = t[0]?.contentRect.width ?? 0;
|
|
4285
|
-
this.#i = i, clearTimeout(this.#
|
|
4286
|
-
this.#
|
|
4372
|
+
this.#i = i, clearTimeout(this.#s), this.#s = setTimeout(() => {
|
|
4373
|
+
this.#p(i);
|
|
4287
4374
|
}, this.config.debounceMs ?? 100);
|
|
4288
4375
|
}), this.#e.observe(this.gridElement);
|
|
4289
4376
|
}
|
|
4290
|
-
#
|
|
4377
|
+
#w() {
|
|
4291
4378
|
const e = this.grid;
|
|
4292
4379
|
if (!e || typeof e.querySelector != "function") return;
|
|
4293
4380
|
const t = e.querySelector("tbw-grid-responsive-card");
|
|
@@ -4312,33 +4399,33 @@ class An extends A {
|
|
|
4312
4399
|
return f.className = "tbw-responsive-card-content", f.innerHTML = g, f;
|
|
4313
4400
|
}), Object.keys(d).length > 0 && (this.config = { ...this.config, ...d });
|
|
4314
4401
|
}
|
|
4315
|
-
#
|
|
4316
|
-
if (this.#
|
|
4402
|
+
#h(e) {
|
|
4403
|
+
if (this.#o.clear(), this.#d.clear(), !!e)
|
|
4317
4404
|
for (const t of e)
|
|
4318
|
-
typeof t == "string" ? this.#
|
|
4405
|
+
typeof t == "string" ? this.#o.add(t) : t.showValue ? this.#d.add(t.field) : this.#o.add(t.field);
|
|
4319
4406
|
}
|
|
4320
4407
|
detach() {
|
|
4321
|
-
this.#e?.disconnect(), this.#e = void 0, clearTimeout(this.#
|
|
4408
|
+
this.#e?.disconnect(), this.#e = void 0, clearTimeout(this.#s), this.#s = void 0, this.gridElement && this.gridElement.removeAttribute("data-responsive"), super.detach();
|
|
4322
4409
|
}
|
|
4323
4410
|
handleQuery(e) {
|
|
4324
4411
|
if (e.type === "isCardMode")
|
|
4325
4412
|
return this.#t;
|
|
4326
4413
|
}
|
|
4327
4414
|
afterRender() {
|
|
4328
|
-
if (this.#R(), !(this.#c.length > 0 ? this.#
|
|
4415
|
+
if (this.#R(), !(this.#c.length > 0 ? this.#r !== null : this.#t))
|
|
4329
4416
|
return;
|
|
4330
|
-
const t = this.#
|
|
4417
|
+
const t = this.#o.size > 0, i = this.#d.size > 0;
|
|
4331
4418
|
if (!t && !i)
|
|
4332
4419
|
return;
|
|
4333
4420
|
const n = this.gridElement.querySelectorAll(".cell[data-field]");
|
|
4334
4421
|
for (const r of n) {
|
|
4335
4422
|
const o = r.getAttribute("data-field");
|
|
4336
|
-
o && (this.#
|
|
4423
|
+
o && (this.#o.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")));
|
|
4337
4424
|
}
|
|
4338
4425
|
}
|
|
4339
|
-
#
|
|
4426
|
+
#p(e) {
|
|
4340
4427
|
if (this.#c.length > 0) {
|
|
4341
|
-
this.#
|
|
4428
|
+
this.#l(e);
|
|
4342
4429
|
return;
|
|
4343
4430
|
}
|
|
4344
4431
|
const t = this.config.breakpoint ?? 0;
|
|
@@ -4346,41 +4433,41 @@ class An extends A {
|
|
|
4346
4433
|
"[tbw-grid:ResponsivePlugin] No breakpoint configured. Responsive mode is disabled. Set a breakpoint based on your grid's column count."
|
|
4347
4434
|
));
|
|
4348
4435
|
const i = t > 0 && e < t;
|
|
4349
|
-
i !== this.#t && (this.#t = i, this.#
|
|
4436
|
+
i !== this.#t && (this.#t = i, this.#f(), this.emit("responsive-change", {
|
|
4350
4437
|
isResponsive: i,
|
|
4351
4438
|
width: e,
|
|
4352
4439
|
breakpoint: t
|
|
4353
4440
|
}), this.requestRender());
|
|
4354
4441
|
}
|
|
4355
|
-
#
|
|
4442
|
+
#l(e) {
|
|
4356
4443
|
let t = null;
|
|
4357
4444
|
for (const n of this.#c)
|
|
4358
4445
|
e <= n.maxWidth && (t = n);
|
|
4359
|
-
if (t !== this.#
|
|
4360
|
-
this.#
|
|
4446
|
+
if (t !== this.#r) {
|
|
4447
|
+
this.#r = t, t?.hiddenColumns ? this.#h(t.hiddenColumns) : this.#h(this.config.hiddenColumns);
|
|
4361
4448
|
const n = t?.cardLayout === !0;
|
|
4362
|
-
n !== this.#t && (this.#t = n, this.#
|
|
4449
|
+
n !== this.#t && (this.#t = n, this.#f()), this.emit("responsive-change", {
|
|
4363
4450
|
isResponsive: this.#t,
|
|
4364
4451
|
width: e,
|
|
4365
4452
|
breakpoint: t?.maxWidth ?? 0
|
|
4366
4453
|
}), this.requestRender();
|
|
4367
4454
|
}
|
|
4368
4455
|
}
|
|
4369
|
-
#
|
|
4370
|
-
#
|
|
4456
|
+
#a;
|
|
4457
|
+
#f() {
|
|
4371
4458
|
this.gridElement.toggleAttribute("data-responsive", this.#t);
|
|
4372
4459
|
const e = this.config.animate !== !1;
|
|
4373
4460
|
this.gridElement.toggleAttribute("data-responsive-animate", e), this.config.animationDuration && this.gridElement.style.setProperty("--tbw-responsive-duration", `${this.config.animationDuration}ms`);
|
|
4374
4461
|
const t = this.grid;
|
|
4375
4462
|
if (this.#t) {
|
|
4376
|
-
t._virtualization && (this.#
|
|
4463
|
+
t._virtualization && (this.#a = t._virtualization.rowHeight);
|
|
4377
4464
|
const i = this.gridElement.querySelector(".tbw-scroll-area");
|
|
4378
4465
|
i && (i.scrollLeft = 0);
|
|
4379
4466
|
} else {
|
|
4380
4467
|
const i = this.gridElement.querySelectorAll(".data-grid-row");
|
|
4381
4468
|
for (const n of i)
|
|
4382
4469
|
n.style.height = "", n.classList.remove("responsive-card");
|
|
4383
|
-
this.#
|
|
4470
|
+
this.#a && this.#a > 0 && t._virtualization && (t._virtualization.rowHeight = this.#a, this.#a = void 0), this.#u = void 0, this.#g = void 0, this.#m = void 0;
|
|
4384
4471
|
}
|
|
4385
4472
|
}
|
|
4386
4473
|
renderRow(e, t, i) {
|
|
@@ -4420,17 +4507,17 @@ class An extends A {
|
|
|
4420
4507
|
}
|
|
4421
4508
|
return !1;
|
|
4422
4509
|
}
|
|
4423
|
-
#
|
|
4424
|
-
#
|
|
4425
|
-
#
|
|
4510
|
+
#u;
|
|
4511
|
+
#g;
|
|
4512
|
+
#m;
|
|
4426
4513
|
#y() {
|
|
4427
|
-
if (this.#
|
|
4428
|
-
return this.#
|
|
4514
|
+
if (this.#u && this.#u > 0)
|
|
4515
|
+
return this.#u;
|
|
4429
4516
|
const e = this.config.cardRowHeight;
|
|
4430
4517
|
return typeof e == "number" && e > 0 ? e : 80;
|
|
4431
4518
|
}
|
|
4432
4519
|
#x() {
|
|
4433
|
-
return this.#
|
|
4520
|
+
return this.#g && this.#g > 0 ? this.#g : this.#a ?? 28;
|
|
4434
4521
|
}
|
|
4435
4522
|
#b() {
|
|
4436
4523
|
for (const e of this.rows)
|
|
@@ -4447,13 +4534,13 @@ class An extends A {
|
|
|
4447
4534
|
getExtraHeight() {
|
|
4448
4535
|
if (!this.#t || !this.config.cardRenderer || !this.#b())
|
|
4449
4536
|
return 0;
|
|
4450
|
-
const e = this.#
|
|
4537
|
+
const e = this.#a ?? 28, t = this.#x(), i = this.#y(), { groupCount: n, cardCount: r } = this.#C(), o = n * Math.max(0, t - e), s = r * Math.max(0, i - e);
|
|
4451
4538
|
return o + s;
|
|
4452
4539
|
}
|
|
4453
4540
|
getExtraHeightBefore(e) {
|
|
4454
4541
|
if (!this.#t || !this.config.cardRenderer || !this.#b())
|
|
4455
4542
|
return 0;
|
|
4456
|
-
const t = this.#
|
|
4543
|
+
const t = this.#a ?? 28, i = this.#x(), n = this.#y(), r = Math.max(0, i - t), o = Math.max(0, n - t);
|
|
4457
4544
|
let s = 0, l = 0;
|
|
4458
4545
|
const d = this.rows, c = Math.min(e, d.length);
|
|
4459
4546
|
for (let u = 0; u < c; u++)
|
|
@@ -4472,27 +4559,27 @@ class An extends A {
|
|
|
4472
4559
|
return;
|
|
4473
4560
|
let e = !1;
|
|
4474
4561
|
const t = this.grid, i = this.#b(), n = this.#E();
|
|
4475
|
-
if (n !== this.#
|
|
4562
|
+
if (n !== this.#m && (this.#m = n, e = !0), i) {
|
|
4476
4563
|
const o = this.gridElement.querySelector(".data-grid-row.group-row");
|
|
4477
4564
|
if (o) {
|
|
4478
4565
|
const s = o.getBoundingClientRect().height;
|
|
4479
|
-
s > 0 && s !== this.#
|
|
4566
|
+
s > 0 && s !== this.#g && (this.#g = s, e = !0);
|
|
4480
4567
|
}
|
|
4481
4568
|
}
|
|
4482
4569
|
const r = this.gridElement.querySelector(".data-grid-row.responsive-card");
|
|
4483
4570
|
if (r) {
|
|
4484
4571
|
const o = r.getBoundingClientRect().height;
|
|
4485
|
-
o > 0 && o !== this.#
|
|
4572
|
+
o > 0 && o !== this.#u && (this.#u = o, e = !0, !i && t._virtualization && (t._virtualization.rowHeight = o));
|
|
4486
4573
|
}
|
|
4487
4574
|
e && !this.#v && (this.#v = !0, queueMicrotask(() => {
|
|
4488
4575
|
this.#v = !1, this.grid && this.#t && this.grid.refreshVirtualWindow?.(!0, !0);
|
|
4489
4576
|
}));
|
|
4490
4577
|
}
|
|
4491
4578
|
}
|
|
4492
|
-
const
|
|
4493
|
-
class
|
|
4579
|
+
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 A {
|
|
4494
4581
|
name = "rowReorder";
|
|
4495
|
-
styles =
|
|
4582
|
+
styles = Wi;
|
|
4496
4583
|
get defaultConfig() {
|
|
4497
4584
|
return {
|
|
4498
4585
|
enableKeyboard: !0,
|
|
@@ -4519,7 +4606,7 @@ class _n extends A {
|
|
|
4519
4606
|
if (!this.config.showDragHandle)
|
|
4520
4607
|
return [...e];
|
|
4521
4608
|
const t = {
|
|
4522
|
-
field:
|
|
4609
|
+
field: $i,
|
|
4523
4610
|
header: "",
|
|
4524
4611
|
width: this.config.dragHandleWidth ?? 40,
|
|
4525
4612
|
resizable: !1,
|
|
@@ -4710,7 +4797,7 @@ function V(a) {
|
|
|
4710
4797
|
endCol: Math.max(a.startCol, a.endCol)
|
|
4711
4798
|
};
|
|
4712
4799
|
}
|
|
4713
|
-
function
|
|
4800
|
+
function ji(a) {
|
|
4714
4801
|
const e = V(a);
|
|
4715
4802
|
return {
|
|
4716
4803
|
from: { row: e.startRow, col: e.startCol },
|
|
@@ -4718,26 +4805,26 @@ function Ui(a) {
|
|
|
4718
4805
|
};
|
|
4719
4806
|
}
|
|
4720
4807
|
function lt(a) {
|
|
4721
|
-
return a.map(
|
|
4808
|
+
return a.map(ji);
|
|
4722
4809
|
}
|
|
4723
|
-
function
|
|
4810
|
+
function Ui(a, e, t) {
|
|
4724
4811
|
const i = V(t);
|
|
4725
4812
|
return a >= i.startRow && a <= i.endRow && e >= i.startCol && e <= i.endCol;
|
|
4726
4813
|
}
|
|
4727
4814
|
function je(a, e, t) {
|
|
4728
|
-
return t.some((i) =>
|
|
4815
|
+
return t.some((i) => Ui(a, e, i));
|
|
4729
4816
|
}
|
|
4730
|
-
function
|
|
4817
|
+
function Yi(a) {
|
|
4731
4818
|
const e = [], t = V(a);
|
|
4732
4819
|
for (let i = t.startRow; i <= t.endRow; i++)
|
|
4733
4820
|
for (let n = t.startCol; n <= t.endCol; n++)
|
|
4734
4821
|
e.push({ row: i, col: n });
|
|
4735
4822
|
return e;
|
|
4736
4823
|
}
|
|
4737
|
-
function
|
|
4824
|
+
function Xi(a) {
|
|
4738
4825
|
const e = /* @__PURE__ */ new Map();
|
|
4739
4826
|
for (const t of a)
|
|
4740
|
-
for (const i of
|
|
4827
|
+
for (const i of Yi(t))
|
|
4741
4828
|
e.set(`${i.row},${i.col}`, i);
|
|
4742
4829
|
return [...e.values()];
|
|
4743
4830
|
}
|
|
@@ -4753,8 +4840,8 @@ function Z(a, e) {
|
|
|
4753
4840
|
const t = V(a), i = V(e);
|
|
4754
4841
|
return t.startRow === i.startRow && t.startCol === i.startCol && t.endRow === i.endRow && t.endCol === i.endCol;
|
|
4755
4842
|
}
|
|
4756
|
-
const
|
|
4757
|
-
function
|
|
4843
|
+
const Zi = "@layer tbw-plugins{tbw-grid{&.selecting .data-grid-row>.cell{user-select:none}&:has(.selection){user-select:none}&[data-has-focus] .data-grid-row.row-focus{background-color:var(--tbw-focus-background, rgba(from var(--tbw-color-accent) r g b / 12%))}&[data-selection-mode=row] .cell-focus{outline:none}.data-grid-row>.cell.selected{background-color:var(--tbw-range-selection-bg);&.top{border-top:2px solid var(--tbw-range-border-color)}&.bottom{border-bottom:2px solid var(--tbw-range-border-color)}&.first{border-left:2px solid var(--tbw-range-border-color)}&.last{border-right:2px solid var(--tbw-range-border-color)}}.data-grid-row[data-selectable=false]{cursor:not-allowed;opacity:.6;&.row-focus{background-color:var(--tbw-color-row-alt)}}.data-grid-row>.cell[data-selectable=false]{cursor:not-allowed;opacity:.6;&.selected{background-color:var(--tbw-selection-warning-bg, rgba(from var(--tbw-color-error) r g b / 50%))}}.tbw-selection-summary{font-size:var(--tbw-font-size-sm, .8125rem);color:var(--tbw-color-fg-muted);white-space:nowrap}}}";
|
|
4844
|
+
function Qi(a, e, t) {
|
|
4758
4845
|
if (a === "cell" && e.selectedCell)
|
|
4759
4846
|
return {
|
|
4760
4847
|
mode: a,
|
|
@@ -4774,7 +4861,7 @@ function Ji(a, e, t) {
|
|
|
4774
4861
|
}
|
|
4775
4862
|
return a === "range" && e.ranges.length > 0 ? { mode: a, ranges: lt(e.ranges) } : { mode: a, ranges: [] };
|
|
4776
4863
|
}
|
|
4777
|
-
class
|
|
4864
|
+
class _n extends A {
|
|
4778
4865
|
static manifest = {
|
|
4779
4866
|
queries: [{ type: "getSelection", description: "Get the current selection state" }],
|
|
4780
4867
|
configRules: [
|
|
@@ -4789,7 +4876,7 @@ class Tn extends A {
|
|
|
4789
4876
|
]
|
|
4790
4877
|
};
|
|
4791
4878
|
name = "selection";
|
|
4792
|
-
styles =
|
|
4879
|
+
styles = Zi;
|
|
4793
4880
|
get defaultConfig() {
|
|
4794
4881
|
return {
|
|
4795
4882
|
mode: "cell",
|
|
@@ -4956,7 +5043,7 @@ class Tn extends A {
|
|
|
4956
5043
|
if (r.forEach((o) => {
|
|
4957
5044
|
o.classList.remove("selected", "row-focus"), i && o.removeAttribute("data-selectable");
|
|
4958
5045
|
}), t === "row" && (xe(e), r.forEach((o) => {
|
|
4959
|
-
const s = o.querySelector(".cell[data-row]"), l =
|
|
5046
|
+
const s = o.querySelector(".cell[data-row]"), l = pt(s);
|
|
4960
5047
|
l >= 0 && (i && !this.isRowSelectable(l) && o.setAttribute("data-selectable", "false"), this.selected.has(l) && o.classList.add("selected", "row-focus"));
|
|
4961
5048
|
})), (t === "cell" || t === "range") && i && e.querySelectorAll(".cell[data-row][data-col]").forEach((s) => {
|
|
4962
5049
|
const l = parseInt(s.getAttribute("data-row") ?? "-1", 10), d = parseInt(s.getAttribute("data-col") ?? "-1", 10);
|
|
@@ -5007,7 +5094,7 @@ class Tn extends A {
|
|
|
5007
5094
|
};
|
|
5008
5095
|
}
|
|
5009
5096
|
getSelectedCells() {
|
|
5010
|
-
return
|
|
5097
|
+
return Xi(this.ranges);
|
|
5011
5098
|
}
|
|
5012
5099
|
isCellSelected(e, t) {
|
|
5013
5100
|
return je(e, t, this.ranges);
|
|
@@ -5027,7 +5114,7 @@ class Tn extends A {
|
|
|
5027
5114
|
}), this.requestAfterRender();
|
|
5028
5115
|
}
|
|
5029
5116
|
#t() {
|
|
5030
|
-
return
|
|
5117
|
+
return Qi(
|
|
5031
5118
|
this.config.mode,
|
|
5032
5119
|
{
|
|
5033
5120
|
selectedCell: this.selectedCell,
|
|
@@ -5041,20 +5128,20 @@ class Tn extends A {
|
|
|
5041
5128
|
function J(a, e) {
|
|
5042
5129
|
return Math.floor(a / e);
|
|
5043
5130
|
}
|
|
5044
|
-
function
|
|
5131
|
+
function Ji(a, e) {
|
|
5045
5132
|
return {
|
|
5046
5133
|
start: a * e,
|
|
5047
5134
|
end: (a + 1) * e
|
|
5048
5135
|
};
|
|
5049
5136
|
}
|
|
5050
|
-
function
|
|
5137
|
+
function en(a, e, t) {
|
|
5051
5138
|
const i = J(a, t), n = J(e - 1, t), r = [];
|
|
5052
5139
|
for (let o = i; o <= n; o++)
|
|
5053
5140
|
r.push(o);
|
|
5054
5141
|
return r;
|
|
5055
5142
|
}
|
|
5056
5143
|
async function Ue(a, e, t, i) {
|
|
5057
|
-
const n =
|
|
5144
|
+
const n = Ji(e, t);
|
|
5058
5145
|
return a.getRows({
|
|
5059
5146
|
startRow: n.start,
|
|
5060
5147
|
endRow: n.end,
|
|
@@ -5062,14 +5149,14 @@ async function Ue(a, e, t, i) {
|
|
|
5062
5149
|
filterModel: i.filterModel
|
|
5063
5150
|
});
|
|
5064
5151
|
}
|
|
5065
|
-
function
|
|
5152
|
+
function tn(a, e, t) {
|
|
5066
5153
|
const i = J(a, e), n = t.get(i);
|
|
5067
5154
|
if (!n) return;
|
|
5068
5155
|
const r = a % e;
|
|
5069
5156
|
return n[r];
|
|
5070
5157
|
}
|
|
5071
|
-
const
|
|
5072
|
-
class
|
|
5158
|
+
const nn = 100;
|
|
5159
|
+
class Tn extends A {
|
|
5073
5160
|
name = "serverSide";
|
|
5074
5161
|
get defaultConfig() {
|
|
5075
5162
|
return {
|
|
@@ -5089,7 +5176,7 @@ class Ln extends A {
|
|
|
5089
5176
|
}
|
|
5090
5177
|
loadRequiredBlocks() {
|
|
5091
5178
|
if (!this.dataSource) return;
|
|
5092
|
-
const e = this.grid, t = this.config.cacheBlockSize ?? 100, i = { startRow: e._virtualization.start, endRow: e._virtualization.end }, n =
|
|
5179
|
+
const e = this.grid, t = this.config.cacheBlockSize ?? 100, i = { startRow: e._virtualization.start, endRow: e._virtualization.end }, n = en(i.startRow, i.endRow, t);
|
|
5093
5180
|
for (const r of n)
|
|
5094
5181
|
if (!(this.loadedBlocks.has(r) || this.loadingBlocks.has(r))) {
|
|
5095
5182
|
if (this.loadingBlocks.size >= (this.config.maxConcurrentRequests ?? 2))
|
|
@@ -5105,7 +5192,7 @@ class Ln extends A {
|
|
|
5105
5192
|
if (!this.dataSource) return [...e];
|
|
5106
5193
|
const t = [];
|
|
5107
5194
|
for (let i = 0; i < this.totalRowCount; i++) {
|
|
5108
|
-
const n =
|
|
5195
|
+
const n = tn(i, this.config.cacheBlockSize ?? 100, this.loadedBlocks);
|
|
5109
5196
|
t.push(n ?? { __loading: !0, __index: i });
|
|
5110
5197
|
}
|
|
5111
5198
|
return t;
|
|
@@ -5113,7 +5200,7 @@ class Ln extends A {
|
|
|
5113
5200
|
onScroll(e) {
|
|
5114
5201
|
this.dataSource && (this.loadRequiredBlocks(), this.scrollDebounceTimer && clearTimeout(this.scrollDebounceTimer), this.scrollDebounceTimer = setTimeout(() => {
|
|
5115
5202
|
this.loadRequiredBlocks();
|
|
5116
|
-
},
|
|
5203
|
+
}, nn));
|
|
5117
5204
|
}
|
|
5118
5205
|
setDataSource(e) {
|
|
5119
5206
|
this.dataSource = e, this.loadedBlocks.clear(), this.loadingBlocks.clear();
|
|
@@ -5158,7 +5245,7 @@ function fe(a, e, t = null, i = 0) {
|
|
|
5158
5245
|
}
|
|
5159
5246
|
return r;
|
|
5160
5247
|
}
|
|
5161
|
-
function
|
|
5248
|
+
function rn() {
|
|
5162
5249
|
return /* @__PURE__ */ new Set();
|
|
5163
5250
|
}
|
|
5164
5251
|
function ct(a, e, t, i = null, n = 0) {
|
|
@@ -5176,7 +5263,7 @@ function ct(a, e, t, i = null, n = 0) {
|
|
|
5176
5263
|
}
|
|
5177
5264
|
return null;
|
|
5178
5265
|
}
|
|
5179
|
-
function
|
|
5266
|
+
function on(a, e, t, i) {
|
|
5180
5267
|
const n = ct(a, e, t);
|
|
5181
5268
|
if (!n) return i;
|
|
5182
5269
|
const r = new Set(i);
|
|
@@ -5194,7 +5281,7 @@ function Ye(a, e = "children") {
|
|
|
5194
5281
|
}
|
|
5195
5282
|
return !1;
|
|
5196
5283
|
}
|
|
5197
|
-
function
|
|
5284
|
+
function sn(a) {
|
|
5198
5285
|
if (!Array.isArray(a) || a.length === 0) return null;
|
|
5199
5286
|
const e = ["children", "items", "nodes", "subRows", "nested"];
|
|
5200
5287
|
for (const t of a)
|
|
@@ -5206,8 +5293,8 @@ function an(a) {
|
|
|
5206
5293
|
}
|
|
5207
5294
|
return null;
|
|
5208
5295
|
}
|
|
5209
|
-
const
|
|
5210
|
-
class
|
|
5296
|
+
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 A {
|
|
5211
5298
|
static manifest = {
|
|
5212
5299
|
events: [
|
|
5213
5300
|
{
|
|
@@ -5223,7 +5310,7 @@ class Fn extends A {
|
|
|
5223
5310
|
]
|
|
5224
5311
|
};
|
|
5225
5312
|
name = "tree";
|
|
5226
|
-
styles =
|
|
5313
|
+
styles = an;
|
|
5227
5314
|
get defaultConfig() {
|
|
5228
5315
|
return {
|
|
5229
5316
|
childrenField: "children",
|
|
@@ -5256,7 +5343,7 @@ class Fn extends A {
|
|
|
5256
5343
|
}
|
|
5257
5344
|
detect(e) {
|
|
5258
5345
|
if (!this.config.autoDetect) return !1;
|
|
5259
|
-
const t = e, i = this.config.childrenField ??
|
|
5346
|
+
const t = e, i = this.config.childrenField ?? sn(t) ?? "children";
|
|
5260
5347
|
return Ye(t, i);
|
|
5261
5348
|
}
|
|
5262
5349
|
processRows(e) {
|
|
@@ -5392,7 +5479,7 @@ class Fn extends A {
|
|
|
5392
5479
|
this.expandedKeys = fe(this.rows, this.config), this.emitPluginEvent("tree-state-change", { expandedKeys: [...this.expandedKeys] }), this.requestRender();
|
|
5393
5480
|
}
|
|
5394
5481
|
collapseAll() {
|
|
5395
|
-
this.expandedKeys =
|
|
5482
|
+
this.expandedKeys = rn(), this.emitPluginEvent("tree-state-change", { expandedKeys: [...this.expandedKeys] }), this.requestRender();
|
|
5396
5483
|
}
|
|
5397
5484
|
isExpanded(e) {
|
|
5398
5485
|
return this.expandedKeys.has(e);
|
|
@@ -5407,10 +5494,10 @@ class Fn extends A {
|
|
|
5407
5494
|
return this.rowKeyMap.get(e)?.data;
|
|
5408
5495
|
}
|
|
5409
5496
|
expandToKey(e) {
|
|
5410
|
-
this.expandedKeys =
|
|
5497
|
+
this.expandedKeys = on(this.rows, e, this.config, this.expandedKeys), this.requestRender();
|
|
5411
5498
|
}
|
|
5412
5499
|
}
|
|
5413
|
-
function
|
|
5500
|
+
function ln(a, e, t) {
|
|
5414
5501
|
const i = [...a.undoStack, e];
|
|
5415
5502
|
for (; i.length > t; )
|
|
5416
5503
|
i.shift();
|
|
@@ -5443,16 +5530,16 @@ function Ze(a) {
|
|
|
5443
5530
|
action: t
|
|
5444
5531
|
} : { newState: a, action: null };
|
|
5445
5532
|
}
|
|
5446
|
-
function
|
|
5533
|
+
function dn(a) {
|
|
5447
5534
|
return a.undoStack.length > 0;
|
|
5448
5535
|
}
|
|
5449
|
-
function
|
|
5536
|
+
function cn(a) {
|
|
5450
5537
|
return a.redoStack.length > 0;
|
|
5451
5538
|
}
|
|
5452
|
-
function
|
|
5539
|
+
function un() {
|
|
5453
5540
|
return { undoStack: [], redoStack: [] };
|
|
5454
5541
|
}
|
|
5455
|
-
function
|
|
5542
|
+
function hn(a, e, t, i) {
|
|
5456
5543
|
return {
|
|
5457
5544
|
type: "cell-edit",
|
|
5458
5545
|
rowIndex: a,
|
|
@@ -5512,7 +5599,7 @@ class In extends A {
|
|
|
5512
5599
|
return !1;
|
|
5513
5600
|
}
|
|
5514
5601
|
recordEdit(e, t, i, n) {
|
|
5515
|
-
const r =
|
|
5602
|
+
const r = hn(e, t, i, n), o = ln(
|
|
5516
5603
|
{ undoStack: this.undoStack, redoStack: this.redoStack },
|
|
5517
5604
|
r,
|
|
5518
5605
|
this.config.maxHistorySize ?? 100
|
|
@@ -5536,13 +5623,13 @@ class In extends A {
|
|
|
5536
5623
|
return e.action;
|
|
5537
5624
|
}
|
|
5538
5625
|
canUndo() {
|
|
5539
|
-
return
|
|
5626
|
+
return dn({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
5540
5627
|
}
|
|
5541
5628
|
canRedo() {
|
|
5542
|
-
return
|
|
5629
|
+
return cn({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
5543
5630
|
}
|
|
5544
5631
|
clearHistory() {
|
|
5545
|
-
const e =
|
|
5632
|
+
const e = un();
|
|
5546
5633
|
this.undoStack = e.undoStack, this.redoStack = e.redoStack;
|
|
5547
5634
|
}
|
|
5548
5635
|
getUndoStack() {
|
|
@@ -5552,7 +5639,7 @@ class In extends A {
|
|
|
5552
5639
|
return [...this.redoStack];
|
|
5553
5640
|
}
|
|
5554
5641
|
}
|
|
5555
|
-
const
|
|
5642
|
+
const gn = '@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))}}';
|
|
5556
5643
|
function Qe(a) {
|
|
5557
5644
|
const e = a.meta ?? {};
|
|
5558
5645
|
return e.lockPosition !== !0 && e.suppressMovable !== !0;
|
|
@@ -5563,7 +5650,7 @@ class B extends A {
|
|
|
5563
5650
|
];
|
|
5564
5651
|
name = "visibility";
|
|
5565
5652
|
static PANEL_ID = "columns";
|
|
5566
|
-
styles =
|
|
5653
|
+
styles = gn;
|
|
5567
5654
|
get defaultConfig() {
|
|
5568
5655
|
return {
|
|
5569
5656
|
allowHideAll: !1
|
|
@@ -5702,49 +5789,49 @@ class B extends A {
|
|
|
5702
5789
|
}
|
|
5703
5790
|
export {
|
|
5704
5791
|
A as BaseGridPlugin,
|
|
5705
|
-
|
|
5706
|
-
|
|
5792
|
+
pn as ClipboardPlugin,
|
|
5793
|
+
mn as ColumnVirtualizationPlugin,
|
|
5707
5794
|
it as ContextMenuPlugin,
|
|
5708
|
-
|
|
5795
|
+
Dn as DEFAULT_ANIMATION_CONFIG,
|
|
5709
5796
|
ht as DEFAULT_GRID_ICONS,
|
|
5710
|
-
|
|
5711
|
-
|
|
5712
|
-
|
|
5713
|
-
|
|
5797
|
+
Mn as DGEvents,
|
|
5798
|
+
Nn as DataGridElement,
|
|
5799
|
+
wn as EditingPlugin,
|
|
5800
|
+
bn as ExportPlugin,
|
|
5714
5801
|
N as FilteringPlugin,
|
|
5715
|
-
|
|
5716
|
-
|
|
5717
|
-
|
|
5718
|
-
|
|
5719
|
-
|
|
5720
|
-
|
|
5721
|
-
|
|
5722
|
-
|
|
5802
|
+
qn as FitModeEnum,
|
|
5803
|
+
Hn as GridCSSVars,
|
|
5804
|
+
Kn as GridClasses,
|
|
5805
|
+
zn as GridDataAttrs,
|
|
5806
|
+
On as GridElement,
|
|
5807
|
+
Gn as GridSelectors,
|
|
5808
|
+
vn as GroupingColumnsPlugin,
|
|
5809
|
+
yn as GroupingRowsPlugin,
|
|
5723
5810
|
nt as MasterDetailPlugin,
|
|
5724
|
-
|
|
5725
|
-
|
|
5726
|
-
|
|
5727
|
-
|
|
5811
|
+
xn as MultiSortPlugin,
|
|
5812
|
+
Bn as PLUGIN_QUERIES,
|
|
5813
|
+
Cn as PinnedColumnsPlugin,
|
|
5814
|
+
En as PinnedRowsPlugin,
|
|
5728
5815
|
G as PivotPlugin,
|
|
5729
|
-
|
|
5730
|
-
|
|
5731
|
-
|
|
5732
|
-
|
|
5733
|
-
|
|
5734
|
-
|
|
5735
|
-
|
|
5736
|
-
|
|
5737
|
-
|
|
5738
|
-
|
|
5739
|
-
|
|
5816
|
+
Vn as PluginEvents,
|
|
5817
|
+
Wn as PluginManager,
|
|
5818
|
+
Rn as PrintPlugin,
|
|
5819
|
+
$i as ROW_DRAG_HANDLE_FIELD,
|
|
5820
|
+
$n as RenderPhase,
|
|
5821
|
+
Sn as ReorderPlugin,
|
|
5822
|
+
kn as ResponsivePlugin,
|
|
5823
|
+
An as RowReorderPlugin,
|
|
5824
|
+
_n as SelectionPlugin,
|
|
5825
|
+
Tn as ServerSidePlugin,
|
|
5826
|
+
Ln as TreePlugin,
|
|
5740
5827
|
In as UndoRedoPlugin,
|
|
5741
5828
|
B as VisibilityPlugin,
|
|
5742
|
-
|
|
5743
|
-
|
|
5744
|
-
|
|
5745
|
-
|
|
5746
|
-
|
|
5747
|
-
|
|
5748
|
-
|
|
5829
|
+
jn as builtInSort,
|
|
5830
|
+
Un as createGrid,
|
|
5831
|
+
Yn as defaultComparator,
|
|
5832
|
+
Ft as defaultEditorFor,
|
|
5833
|
+
yt as defaultPasteHandler,
|
|
5834
|
+
Ki as printGridIsolated,
|
|
5835
|
+
Xn as queryGrid
|
|
5749
5836
|
};
|
|
5750
5837
|
//# sourceMappingURL=all.js.map
|