@toolbox-web/grid 1.1.0 → 1.1.2
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 +189 -113
- package/all.js.map +1 -1
- package/index.js +757 -716
- package/index.js.map +1 -1
- package/lib/core/grid.d.ts +7 -1
- package/lib/core/grid.d.ts.map +1 -1
- package/lib/core/internal/validate-config.d.ts +10 -0
- package/lib/core/internal/validate-config.d.ts.map +1 -1
- package/lib/core/plugin/base-plugin.d.ts +30 -0
- package/lib/core/plugin/base-plugin.d.ts.map +1 -1
- package/lib/core/plugin/index.d.ts +1 -1
- package/lib/core/plugin/index.d.ts.map +1 -1
- package/lib/core/plugin/plugin-manager.d.ts +6 -0
- package/lib/core/plugin/plugin-manager.d.ts.map +1 -1
- package/lib/core/types.d.ts +1 -1
- package/lib/core/types.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/editing/index.js.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/GroupingRowsPlugin.d.ts.map +1 -1
- package/lib/plugins/grouping-rows/index.js +5 -5
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/reorder/index.js.map +1 -1
- package/lib/plugins/responsive/ResponsivePlugin.d.ts +24 -1
- package/lib/plugins/responsive/ResponsivePlugin.d.ts.map +1 -1
- package/lib/plugins/responsive/index.js +225 -88
- package/lib/plugins/responsive/index.js.map +1 -1
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/undo-redo/index.js.map +1 -1
- package/lib/plugins/visibility/index.js.map +1 -1
- package/package.json +1 -1
- package/umd/grid.all.umd.js +25 -19
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +18 -12
- package/umd/grid.umd.js.map +1 -1
- package/umd/plugins/grouping-rows.umd.js +1 -1
- package/umd/plugins/grouping-rows.umd.js.map +1 -1
- package/umd/plugins/responsive.umd.js +1 -1
- package/umd/plugins/responsive.umd.js.map +1 -1
package/all.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { BaseGridPlugin as R, DEFAULT_GRID_ICONS as Ue, runAggregator as de, e as Ye, s as Xe, PLUGIN_QUERIES as
|
|
1
|
+
import { BaseGridPlugin as R, DEFAULT_GRID_ICONS as Ue, runAggregator as de, e as Ye, s as Xe, PLUGIN_QUERIES as ze, getAggregator as ce, getValueAggregator as Ze, a as I, c as ue, g as Je } from "./index.js";
|
|
2
2
|
import { DEFAULT_ANIMATION_CONFIG as dn, DGEvents as cn, DataGridElement as un, FitModeEnum as hn, GridCSSVars as fn, GridClasses as gn, GridDataAttrs as pn, DataGridElement as mn, GridSelectors as wn, PluginEvents as bn, PluginManager as vn, RenderPhase as yn, builtInSort as xn, createGrid as Cn, defaultComparator as Rn, queryGrid as En } from "./index.js";
|
|
3
|
-
const
|
|
3
|
+
const Oe = "__tbw_expander", Qe = 32;
|
|
4
4
|
function re(s) {
|
|
5
|
-
return s.field ===
|
|
5
|
+
return s.field === Oe;
|
|
6
6
|
}
|
|
7
7
|
function T(s) {
|
|
8
8
|
return s.meta?.utility === !0;
|
|
@@ -12,7 +12,7 @@ function et(s) {
|
|
|
12
12
|
}
|
|
13
13
|
function tt(s) {
|
|
14
14
|
return {
|
|
15
|
-
field:
|
|
15
|
+
field: Oe,
|
|
16
16
|
header: "",
|
|
17
17
|
width: Qe,
|
|
18
18
|
resizable: !1,
|
|
@@ -620,7 +620,7 @@ function wt(s) {
|
|
|
620
620
|
function bt(s) {
|
|
621
621
|
s.__editingCellCount = 0, s.removeAttribute("data-has-editing");
|
|
622
622
|
}
|
|
623
|
-
function
|
|
623
|
+
function N(s, e) {
|
|
624
624
|
return s instanceof HTMLInputElement ? s.type === "checkbox" ? s.checked : s.type === "number" ? s.value === "" ? null : Number(s.value) : s.type === "date" ? s.valueAsDate : s.value : e?.type === "number" && s.value !== "" ? Number(s.value) : s.value;
|
|
625
625
|
}
|
|
626
626
|
function be(s) {
|
|
@@ -628,8 +628,8 @@ function be(s) {
|
|
|
628
628
|
function vt(s, e, t) {
|
|
629
629
|
const i = s.querySelector("input,textarea,select");
|
|
630
630
|
i && (i.addEventListener("blur", () => {
|
|
631
|
-
t(
|
|
632
|
-
}), i instanceof HTMLInputElement && i.type === "checkbox" ? i.addEventListener("change", () => t(i.checked)) : i instanceof HTMLSelectElement && i.addEventListener("change", () => t(
|
|
631
|
+
t(N(i, e));
|
|
632
|
+
}), i instanceof HTMLInputElement && i.type === "checkbox" ? i.addEventListener("change", () => t(i.checked)) : i instanceof HTMLSelectElement && i.addEventListener("change", () => t(N(i, e))));
|
|
633
633
|
}
|
|
634
634
|
class ji extends R {
|
|
635
635
|
static manifest = {
|
|
@@ -778,7 +778,7 @@ class ji extends R {
|
|
|
778
778
|
const l = a.querySelector(`.cell[data-col="${o}"]`);
|
|
779
779
|
if (!l || l.classList.contains("editing")) continue;
|
|
780
780
|
const d = e._rows[r], c = e._visibleColumns[o];
|
|
781
|
-
d && c && this.#
|
|
781
|
+
d && c && this.#p(d, r, c, o, l, !0);
|
|
782
782
|
}
|
|
783
783
|
}
|
|
784
784
|
onScrollRender() {
|
|
@@ -822,7 +822,7 @@ class ji extends R {
|
|
|
822
822
|
}
|
|
823
823
|
resetChangedRows(e) {
|
|
824
824
|
const t = this.changedRows, i = this.changedRowIds;
|
|
825
|
-
this.#i.clear(), this.#
|
|
825
|
+
this.#i.clear(), this.#l(), e || this.emit("changed-rows-reset", { rows: t, ids: i }), this.grid._rowPool?.forEach((r) => r.classList.remove("changed"));
|
|
826
826
|
}
|
|
827
827
|
beginCellEdit(e, t) {
|
|
828
828
|
const i = this.grid, n = i._visibleColumns.findIndex((l) => l.field === t);
|
|
@@ -836,11 +836,11 @@ class ji extends R {
|
|
|
836
836
|
const r = t.findRenderedRowElement?.(e);
|
|
837
837
|
if (!r) return;
|
|
838
838
|
const o = t._rows[e];
|
|
839
|
-
this.#
|
|
839
|
+
this.#d(e, o), Array.from(r.children).forEach((a, l) => {
|
|
840
840
|
const d = t._visibleColumns[l];
|
|
841
841
|
if (d?.editable) {
|
|
842
842
|
const c = a;
|
|
843
|
-
c.classList.contains("editing") || this.#
|
|
843
|
+
c.classList.contains("editing") || this.#p(o, e, d, l, c, !0);
|
|
844
844
|
}
|
|
845
845
|
}), setTimeout(() => {
|
|
846
846
|
let a = r.querySelector(`.cell[data-col="${t._focusCol}"]`);
|
|
@@ -861,14 +861,14 @@ class ji extends R {
|
|
|
861
861
|
}
|
|
862
862
|
#c(e, t, i) {
|
|
863
863
|
const n = this.grid, r = n._rows[e], o = n._visibleColumns[t];
|
|
864
|
-
!r || !o?.editable || i.classList.contains("editing") || (this.#e !== e && this.#
|
|
864
|
+
!r || !o?.editable || i.classList.contains("editing") || (this.#e !== e && this.#d(e, r), this.#t = t, this.#p(r, e, o, t, i, !1));
|
|
865
865
|
}
|
|
866
|
-
#
|
|
866
|
+
#l() {
|
|
867
867
|
const e = this.grid;
|
|
868
868
|
e._activeEditRows = this.#e, e._rowEditSnapshots = this.#o;
|
|
869
869
|
}
|
|
870
|
-
#
|
|
871
|
-
this.#e !== e && (this.#o.set(e, { ...t }), this.#e = e, this.#
|
|
870
|
+
#d(e, t) {
|
|
871
|
+
this.#e !== e && (this.#o.set(e, { ...t }), this.#e = e, this.#l());
|
|
872
872
|
}
|
|
873
873
|
#r(e, t) {
|
|
874
874
|
if (this.#e !== e) return;
|
|
@@ -886,7 +886,7 @@ class ji extends R {
|
|
|
886
886
|
if (!u) return;
|
|
887
887
|
const h = d.querySelector("input,textarea,select");
|
|
888
888
|
if (h) {
|
|
889
|
-
const f =
|
|
889
|
+
const f = N(h, u);
|
|
890
890
|
r[u.field] !== f && this.#u(e, u, f, r);
|
|
891
891
|
}
|
|
892
892
|
}), t && n && r)
|
|
@@ -904,7 +904,7 @@ class ji extends R {
|
|
|
904
904
|
changedRowIds: this.changedRowIds
|
|
905
905
|
});
|
|
906
906
|
}
|
|
907
|
-
this.#o.delete(e), this.#e = -1, this.#t = -1, this.#
|
|
907
|
+
this.#o.delete(e), this.#e = -1, this.#t = -1, this.#l();
|
|
908
908
|
for (const l of this.#n)
|
|
909
909
|
l.startsWith(`${e}:`) && this.#n.delete(l);
|
|
910
910
|
o && (o.querySelectorAll(".cell.editing").forEach((l) => {
|
|
@@ -935,11 +935,11 @@ class ji extends R {
|
|
|
935
935
|
firstTimeForRow: d,
|
|
936
936
|
updateRow: c
|
|
937
937
|
})) return;
|
|
938
|
-
n[r] = i, l && this.#i.add(l), this.#
|
|
938
|
+
n[r] = i, l && this.#i.add(l), this.#l();
|
|
939
939
|
const h = a.findRenderedRowElement?.(e);
|
|
940
940
|
h && h.classList.add("changed");
|
|
941
941
|
}
|
|
942
|
-
#
|
|
942
|
+
#p(e, t, i, n, r, o) {
|
|
943
943
|
if (!i.editable || r.classList.contains("editing")) return;
|
|
944
944
|
let a;
|
|
945
945
|
try {
|
|
@@ -961,7 +961,7 @@ class ji extends R {
|
|
|
961
961
|
});
|
|
962
962
|
const p = i, m = p.__editorTemplate, w = mt(this.grid, p) ?? pt(i), b = d;
|
|
963
963
|
if (w === "template" && m)
|
|
964
|
-
this.#
|
|
964
|
+
this.#a(g, p, e, d, h, f, o, t);
|
|
965
965
|
else if (typeof w == "string") {
|
|
966
966
|
const v = document.createElement(w);
|
|
967
967
|
v.value = b, v.addEventListener("change", () => h(v.value)), g.appendChild(v), o || queueMicrotask(() => {
|
|
@@ -977,14 +977,14 @@ class ji extends R {
|
|
|
977
977
|
commit: h,
|
|
978
978
|
cancel: f,
|
|
979
979
|
updateRow: l
|
|
980
|
-
},
|
|
981
|
-
typeof
|
|
980
|
+
}, S = w(v);
|
|
981
|
+
typeof S == "string" ? (g.innerHTML = S, vt(g, i, h)) : S instanceof Node && g.appendChild(S), o || queueMicrotask(() => {
|
|
982
982
|
g.querySelector(Y)?.focus({ preventScroll: !0 });
|
|
983
983
|
});
|
|
984
984
|
} else if (w && typeof w == "object") {
|
|
985
985
|
const v = document.createElement("div");
|
|
986
986
|
v.setAttribute("data-external-editor", ""), v.setAttribute("data-field", i.field), g.appendChild(v);
|
|
987
|
-
const
|
|
987
|
+
const S = {
|
|
988
988
|
row: e,
|
|
989
989
|
rowId: a ?? "",
|
|
990
990
|
value: b,
|
|
@@ -996,17 +996,17 @@ class ji extends R {
|
|
|
996
996
|
};
|
|
997
997
|
if (w.mount)
|
|
998
998
|
try {
|
|
999
|
-
w.mount({ placeholder: v, context:
|
|
999
|
+
w.mount({ placeholder: v, context: S, spec: w });
|
|
1000
1000
|
} catch (q) {
|
|
1001
1001
|
console.warn(`[tbw-grid] External editor mount error for column '${i.field}':`, q);
|
|
1002
1002
|
}
|
|
1003
1003
|
else
|
|
1004
1004
|
this.grid.dispatchEvent(
|
|
1005
|
-
new CustomEvent("mount-external-editor", { detail: { placeholder: v, spec: w, context:
|
|
1005
|
+
new CustomEvent("mount-external-editor", { detail: { placeholder: v, spec: w, context: S } })
|
|
1006
1006
|
);
|
|
1007
1007
|
}
|
|
1008
1008
|
}
|
|
1009
|
-
#
|
|
1009
|
+
#a(e, t, i, n, r, o, a, l) {
|
|
1010
1010
|
const d = t.__editorTemplate;
|
|
1011
1011
|
if (!d) return;
|
|
1012
1012
|
const c = d.cloneNode(!0), u = t.__compiledEditor;
|
|
@@ -1031,10 +1031,10 @@ class ji extends R {
|
|
|
1031
1031
|
h instanceof HTMLInputElement && h.type === "checkbox" ? h.checked = !!n : h.value = String(n ?? "");
|
|
1032
1032
|
let f = !1;
|
|
1033
1033
|
h.addEventListener("blur", () => {
|
|
1034
|
-
f || r(
|
|
1034
|
+
f || r(N(h, t));
|
|
1035
1035
|
}), h.addEventListener("keydown", (g) => {
|
|
1036
1036
|
const p = g;
|
|
1037
|
-
p.key === "Enter" && (p.stopPropagation(), p.preventDefault(), f = !0, r(
|
|
1037
|
+
p.key === "Enter" && (p.stopPropagation(), p.preventDefault(), f = !0, r(N(h, t)), this.#r(l, !1)), p.key === "Escape" && (p.stopPropagation(), p.preventDefault(), o(), this.#r(l, !0));
|
|
1038
1038
|
}), h instanceof HTMLInputElement && h.type === "checkbox" && h.addEventListener("change", () => r(h.checked)), a || setTimeout(() => h.focus({ preventScroll: !0 }), 0);
|
|
1039
1039
|
}
|
|
1040
1040
|
e.appendChild(c);
|
|
@@ -1237,10 +1237,10 @@ function Et(s) {
|
|
|
1237
1237
|
totalHeight: e * n
|
|
1238
1238
|
};
|
|
1239
1239
|
}
|
|
1240
|
-
function
|
|
1240
|
+
function St(s, e) {
|
|
1241
1241
|
return s <= e;
|
|
1242
1242
|
}
|
|
1243
|
-
function
|
|
1243
|
+
function kt(s, e, t = !1) {
|
|
1244
1244
|
const i = s[e.field];
|
|
1245
1245
|
if (e.operator === "blank")
|
|
1246
1246
|
return i == null || i === "";
|
|
@@ -1280,7 +1280,7 @@ function St(s, e, t = !1) {
|
|
|
1280
1280
|
}
|
|
1281
1281
|
}
|
|
1282
1282
|
function At(s, e, t = !1) {
|
|
1283
|
-
return e.length ? s.filter((i) => e.every((n) =>
|
|
1283
|
+
return e.length ? s.filter((i) => e.every((n) => kt(i, n, t))) : s;
|
|
1284
1284
|
}
|
|
1285
1285
|
function _t(s) {
|
|
1286
1286
|
return JSON.stringify(
|
|
@@ -1536,17 +1536,17 @@ class A extends R {
|
|
|
1536
1536
|
const b = (y, E) => {
|
|
1537
1537
|
const _ = y == null ? "(Blank)" : String(y), x = y == null ? "__null__" : String(y), C = document.createElement("label");
|
|
1538
1538
|
C.className = "tbw-filter-value-item", C.style.position = "absolute", C.style.top = `${E * A.LIST_ITEM_HEIGHT}px`, C.style.left = "0", C.style.right = "0", C.style.height = `${A.LIST_ITEM_HEIGHT}px`, C.style.boxSizing = "border-box";
|
|
1539
|
-
const
|
|
1540
|
-
|
|
1541
|
-
m.set(x,
|
|
1539
|
+
const k = document.createElement("input");
|
|
1540
|
+
k.type = "checkbox", k.className = "tbw-filter-checkbox", k.checked = m.get(x) ?? !0, k.dataset.value = x, k.addEventListener("change", () => {
|
|
1541
|
+
m.set(x, k.checked), h();
|
|
1542
1542
|
});
|
|
1543
1543
|
const le = document.createElement("span");
|
|
1544
|
-
return le.textContent = _, C.appendChild(
|
|
1544
|
+
return le.textContent = _, C.appendChild(k), C.appendChild(le), C;
|
|
1545
1545
|
}, v = () => {
|
|
1546
1546
|
const y = w.length, E = f.clientHeight, _ = f.scrollTop;
|
|
1547
|
-
if (g.style.height = `${y * A.LIST_ITEM_HEIGHT}px`,
|
|
1548
|
-
p.innerHTML = "", p.style.transform = "translateY(0px)", w.forEach((C,
|
|
1549
|
-
p.appendChild(b(C,
|
|
1547
|
+
if (g.style.height = `${y * A.LIST_ITEM_HEIGHT}px`, St(y, A.LIST_BYPASS_THRESHOLD / 3)) {
|
|
1548
|
+
p.innerHTML = "", p.style.transform = "translateY(0px)", w.forEach((C, k) => {
|
|
1549
|
+
p.appendChild(b(C, k));
|
|
1550
1550
|
});
|
|
1551
1551
|
return;
|
|
1552
1552
|
}
|
|
@@ -1560,11 +1560,11 @@ class A extends R {
|
|
|
1560
1560
|
p.style.transform = `translateY(${x.offsetY}px)`, p.innerHTML = "";
|
|
1561
1561
|
for (let C = x.start; C < x.end; C++)
|
|
1562
1562
|
p.appendChild(b(w[C], C - x.start));
|
|
1563
|
-
},
|
|
1563
|
+
}, S = (y) => {
|
|
1564
1564
|
const E = this.config.caseSensitive ?? !1, _ = E ? y : y.toLowerCase();
|
|
1565
1565
|
if (w = i.filter((x) => {
|
|
1566
|
-
const C = x == null ? "(Blank)" : String(x),
|
|
1567
|
-
return !y ||
|
|
1566
|
+
const C = x == null ? "(Blank)" : String(x), k = E ? C : C.toLowerCase();
|
|
1567
|
+
return !y || k.includes(_);
|
|
1568
1568
|
}), w.length === 0) {
|
|
1569
1569
|
g.style.height = "0px", p.innerHTML = "";
|
|
1570
1570
|
const x = document.createElement("div");
|
|
@@ -1579,17 +1579,17 @@ class A extends R {
|
|
|
1579
1579
|
w.length > 0 && v();
|
|
1580
1580
|
},
|
|
1581
1581
|
{ passive: !0 }
|
|
1582
|
-
),
|
|
1582
|
+
), S(a.value), e.appendChild(f);
|
|
1583
1583
|
let q;
|
|
1584
1584
|
a.addEventListener("input", () => {
|
|
1585
1585
|
clearTimeout(q), q = setTimeout(() => {
|
|
1586
|
-
this.searchText.set(r, a.value),
|
|
1586
|
+
this.searchText.set(r, a.value), S(a.value);
|
|
1587
1587
|
}, this.config.debounceMs ?? 150);
|
|
1588
1588
|
});
|
|
1589
|
-
const
|
|
1590
|
-
|
|
1591
|
-
const
|
|
1592
|
-
|
|
1589
|
+
const G = document.createElement("div");
|
|
1590
|
+
G.className = "tbw-filter-buttons";
|
|
1591
|
+
const z = document.createElement("button");
|
|
1592
|
+
z.className = "tbw-filter-apply-btn", z.textContent = "Apply", z.addEventListener("click", () => {
|
|
1593
1593
|
const y = [];
|
|
1594
1594
|
for (const [E, _] of m)
|
|
1595
1595
|
if (!_)
|
|
@@ -1600,11 +1600,11 @@ class A extends R {
|
|
|
1600
1600
|
y.push(x !== void 0 ? x : E);
|
|
1601
1601
|
}
|
|
1602
1602
|
t.applySetFilter(y);
|
|
1603
|
-
}),
|
|
1604
|
-
const
|
|
1605
|
-
|
|
1603
|
+
}), G.appendChild(z);
|
|
1604
|
+
const O = document.createElement("button");
|
|
1605
|
+
O.className = "tbw-filter-clear-btn", O.textContent = "Clear Filter", O.addEventListener("click", () => {
|
|
1606
1606
|
t.clearFilter();
|
|
1607
|
-
}),
|
|
1607
|
+
}), G.appendChild(O), e.appendChild(G);
|
|
1608
1608
|
}
|
|
1609
1609
|
applySetFilter(e, t) {
|
|
1610
1610
|
this.excludedValues.set(e, new Set(t)), t.length === 0 ? this.filters.delete(e) : this.filters.set(e, {
|
|
@@ -1881,16 +1881,16 @@ function Kt(s) {
|
|
|
1881
1881
|
t.kind === "group" && e.add(t.key);
|
|
1882
1882
|
return e;
|
|
1883
1883
|
}
|
|
1884
|
-
function
|
|
1884
|
+
function Ht() {
|
|
1885
1885
|
return /* @__PURE__ */ new Set();
|
|
1886
1886
|
}
|
|
1887
|
-
function
|
|
1887
|
+
function Nt(s) {
|
|
1888
1888
|
return s.kind !== "group" ? 0 : s.rows.length;
|
|
1889
1889
|
}
|
|
1890
|
-
const
|
|
1890
|
+
const Gt = "@layer tbw-plugins{.group-row{display:grid;grid-template-columns:var(--tbw-column-template);background:var(--tbw-grouping-rows-bg, var(--tbw-color-panel-bg));font-weight:500;border-bottom:var(--tbw-row-divider);min-height:var(--tbw-row-height)}.group-row .cell{display:flex;align-items:center;padding:var(--tbw-cell-padding, .125rem .5rem)}.group-row:hover{background:var(--tbw-grouping-rows-bg-hover, var(--tbw-color-row-hover))}.group-toggle{cursor:pointer;user-select:none;display:inline-flex;align-items:center;justify-content:center;width:var(--tbw-toggle-size, 1.25rem);height:var(--tbw-toggle-size, 1.25rem);margin-right:.25rem;background:none;border:0;font:inherit}.group-toggle:hover{background:var(--tbw-grouping-rows-toggle-hover, var(--tbw-color-row-hover));border-radius:var(--tbw-border-radius, .125rem)}.group-label{display:inline-flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.group-count{color:var(--tbw-grouping-rows-count-color, var(--tbw-color-fg-muted));font-size:var(--tbw-font-size-xs, .85em);font-weight:400}.group-row{padding-left:calc(var(--tbw-group-depth, 0) * var(--tbw-group-indent-width, 1.25em))}.data-grid-row.tbw-group-slide-in{animation:tbw-group-slide-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-group-slide-in{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}.data-grid-row.tbw-group-fade-in{animation:tbw-group-fade-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-group-fade-in{0%{opacity:0}to{opacity:1}}}";
|
|
1891
1891
|
class Xi extends R {
|
|
1892
1892
|
name = "groupingRows";
|
|
1893
|
-
styles =
|
|
1893
|
+
styles = Gt;
|
|
1894
1894
|
get defaultConfig() {
|
|
1895
1895
|
return {
|
|
1896
1896
|
defaultExpanded: !1,
|
|
@@ -1939,7 +1939,7 @@ class Xi extends R {
|
|
|
1939
1939
|
__groupDepth: r.depth,
|
|
1940
1940
|
__groupRows: r.rows,
|
|
1941
1941
|
__groupExpanded: r.expanded,
|
|
1942
|
-
__groupRowCount:
|
|
1942
|
+
__groupRowCount: Nt(r)
|
|
1943
1943
|
} : r.row);
|
|
1944
1944
|
}
|
|
1945
1945
|
onCellClick(e) {
|
|
@@ -1974,7 +1974,7 @@ class Xi extends R {
|
|
|
1974
1974
|
const r = () => {
|
|
1975
1975
|
this.toggle(e.__groupKey);
|
|
1976
1976
|
};
|
|
1977
|
-
return t.className = "data-grid-row group-row", t.__isCustomRow = !0, t.setAttribute("data-group-depth", String(e.__groupDepth)), t.setAttribute("role", "row"), t.setAttribute("aria-expanded", String(e.__groupExpanded)), t.style.setProperty("--tbw-group-depth", String(e.__groupDepth || 0)), n.indentWidth !== void 0 && t.style.setProperty("--tbw-group-indent-width", `${n.indentWidth}px`), t.innerHTML = "", n.fullWidth !== !1 ? this.renderFullWidthGroupRow(e, t, r) : this.renderPerColumnGroupRow(e, t, r), !0;
|
|
1977
|
+
return t.className = "data-grid-row group-row", t.__isCustomRow = !0, t.setAttribute("data-group-depth", String(e.__groupDepth)), t.setAttribute("role", "row"), t.setAttribute("aria-expanded", String(e.__groupExpanded)), t.style.setProperty("--tbw-group-depth", String(e.__groupDepth || 0)), n.indentWidth !== void 0 && t.style.setProperty("--tbw-group-indent-width", `${n.indentWidth}px`), t.style.height = "", t.innerHTML = "", n.fullWidth !== !1 ? this.renderFullWidthGroupRow(e, t, r) : this.renderPerColumnGroupRow(e, t, r), !0;
|
|
1978
1978
|
}
|
|
1979
1979
|
afterRender() {
|
|
1980
1980
|
const e = this.animationStyle;
|
|
@@ -2045,7 +2045,7 @@ class Xi extends R {
|
|
|
2045
2045
|
this.expandedKeys = Kt(this.flattenedRows), this.requestRender();
|
|
2046
2046
|
}
|
|
2047
2047
|
collapseAll() {
|
|
2048
|
-
this.expandedKeys =
|
|
2048
|
+
this.expandedKeys = Ht(), this.requestRender();
|
|
2049
2049
|
}
|
|
2050
2050
|
toggle(e) {
|
|
2051
2051
|
this.expandedKeys = qt(this.expandedKeys, e);
|
|
@@ -2101,11 +2101,11 @@ function Re(s, e) {
|
|
|
2101
2101
|
const t = new Set(s);
|
|
2102
2102
|
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
2103
2103
|
}
|
|
2104
|
-
function
|
|
2104
|
+
function zt(s, e) {
|
|
2105
2105
|
const t = new Set(s);
|
|
2106
2106
|
return t.add(e), t;
|
|
2107
2107
|
}
|
|
2108
|
-
function
|
|
2108
|
+
function Ot(s, e) {
|
|
2109
2109
|
const t = new Set(s);
|
|
2110
2110
|
return t.delete(e), t;
|
|
2111
2111
|
}
|
|
@@ -2291,11 +2291,11 @@ class Be extends R {
|
|
|
2291
2291
|
}
|
|
2292
2292
|
expand(e) {
|
|
2293
2293
|
const t = this.rows[e];
|
|
2294
|
-
t && (this.expandedRows =
|
|
2294
|
+
t && (this.expandedRows = zt(this.expandedRows, t), this.requestRender());
|
|
2295
2295
|
}
|
|
2296
2296
|
collapse(e) {
|
|
2297
2297
|
const t = this.rows[e];
|
|
2298
|
-
t && (this.expandedRows =
|
|
2298
|
+
t && (this.expandedRows = Ot(this.expandedRows, t), this.requestRender());
|
|
2299
2299
|
}
|
|
2300
2300
|
toggle(e) {
|
|
2301
2301
|
const t = this.rows[e];
|
|
@@ -2354,7 +2354,7 @@ function Ee(s, e) {
|
|
|
2354
2354
|
const t = s.findIndex((i) => i.field === e);
|
|
2355
2355
|
return t >= 0 ? t + 1 : void 0;
|
|
2356
2356
|
}
|
|
2357
|
-
function
|
|
2357
|
+
function Se(s, e) {
|
|
2358
2358
|
return s.find((t) => t.field === e)?.direction;
|
|
2359
2359
|
}
|
|
2360
2360
|
const Yt = '@layer tbw-plugins{.header-cell[data-sort=asc]:after{content:"↑";margin-left:4px;opacity:.8}.header-cell[data-sort=desc]:after{content:"↓";margin-left:4px;opacity:.8}.sort-indicator{margin-left:4px;opacity:.8}.sort-index{font-size:10px;background:var(--tbw-multi-sort-badge-bg, var(--tbw-color-panel-bg));color:var(--tbw-multi-sort-badge-color, var(--tbw-color-fg));border-radius:50%;width:14px;height:14px;display:inline-flex;align-items:center;justify-content:center;margin-left:2px;font-weight:600}}';
|
|
@@ -2386,7 +2386,7 @@ class Zi extends R {
|
|
|
2386
2386
|
e.querySelectorAll(".header-row .cell[data-field]").forEach((n) => {
|
|
2387
2387
|
const r = n.getAttribute("data-field");
|
|
2388
2388
|
if (!r) return;
|
|
2389
|
-
const o = Ee(this.sortModel, r), a =
|
|
2389
|
+
const o = Ee(this.sortModel, r), a = Se(this.sortModel, r);
|
|
2390
2390
|
if (n.querySelector(".sort-index")?.remove(), a) {
|
|
2391
2391
|
n.querySelector('[part~="sort-indicator"], .sort-indicator')?.remove(), n.setAttribute("data-sort", a);
|
|
2392
2392
|
const c = document.createElement("span");
|
|
@@ -2413,7 +2413,7 @@ class Zi extends R {
|
|
|
2413
2413
|
return Ee(this.sortModel, e);
|
|
2414
2414
|
}
|
|
2415
2415
|
getSortDirection(e) {
|
|
2416
|
-
return
|
|
2416
|
+
return Se(this.sortModel, e);
|
|
2417
2417
|
}
|
|
2418
2418
|
getColumnState(e) {
|
|
2419
2419
|
const t = this.sortModel.findIndex((n) => n.field === e);
|
|
@@ -2445,7 +2445,7 @@ function Zt(s) {
|
|
|
2445
2445
|
function X(s) {
|
|
2446
2446
|
return s.some((e) => e.sticky === "left" || e.sticky === "right");
|
|
2447
2447
|
}
|
|
2448
|
-
function
|
|
2448
|
+
function ke(s, e) {
|
|
2449
2449
|
const t = Array.from(s.querySelectorAll(".header-row .cell"));
|
|
2450
2450
|
if (!t.length) return;
|
|
2451
2451
|
const i = /* @__PURE__ */ new Map();
|
|
@@ -2511,12 +2511,12 @@ class Ji extends R {
|
|
|
2511
2511
|
return;
|
|
2512
2512
|
}
|
|
2513
2513
|
queueMicrotask(() => {
|
|
2514
|
-
|
|
2514
|
+
ke(e, t);
|
|
2515
2515
|
});
|
|
2516
2516
|
}
|
|
2517
2517
|
onPluginQuery(e) {
|
|
2518
2518
|
switch (e.type) {
|
|
2519
|
-
case
|
|
2519
|
+
case ze.CAN_MOVE_COLUMN: {
|
|
2520
2520
|
const t = e.context, i = t.sticky;
|
|
2521
2521
|
if (i === "left" || i === "right")
|
|
2522
2522
|
return !1;
|
|
@@ -2529,7 +2529,7 @@ class Ji extends R {
|
|
|
2529
2529
|
}
|
|
2530
2530
|
refreshStickyOffsets() {
|
|
2531
2531
|
const e = [...this.columns];
|
|
2532
|
-
|
|
2532
|
+
ke(this.grid, e);
|
|
2533
2533
|
}
|
|
2534
2534
|
getLeftPinnedColumns() {
|
|
2535
2535
|
const e = [...this.columns];
|
|
@@ -2895,11 +2895,11 @@ function li(s) {
|
|
|
2895
2895
|
const di = ["sum", "avg", "count", "min", "max", "first", "last"];
|
|
2896
2896
|
function ci(s, e, t, i) {
|
|
2897
2897
|
const n = new AbortController(), r = { config: e, callbacks: i, signal: n.signal }, o = document.createElement("div");
|
|
2898
|
-
return o.className = "tbw-pivot-panel", o.appendChild(
|
|
2898
|
+
return o.className = "tbw-pivot-panel", o.appendChild(H("Options", () => pi(t, r))), o.appendChild(H("Row Groups", () => Pe("rowGroups", r))), o.appendChild(H("Column Groups", () => Pe("columnGroups", r))), o.appendChild(H("Values", () => hi(r))), o.appendChild(H("Available Fields", () => gi(r))), s.appendChild(o), () => {
|
|
2899
2899
|
n.abort(), o.remove();
|
|
2900
2900
|
};
|
|
2901
2901
|
}
|
|
2902
|
-
function
|
|
2902
|
+
function H(s, e) {
|
|
2903
2903
|
const t = document.createElement("div");
|
|
2904
2904
|
t.className = "tbw-pivot-section";
|
|
2905
2905
|
const i = document.createElement("div");
|
|
@@ -3462,7 +3462,7 @@ class en extends R {
|
|
|
3462
3462
|
dropIndex = null;
|
|
3463
3463
|
canMoveColumnWithPlugins(e) {
|
|
3464
3464
|
return !e || !yi(e) ? !1 : !this.grid.queryPlugins({
|
|
3465
|
-
type:
|
|
3465
|
+
type: ze.CAN_MOVE_COLUMN,
|
|
3466
3466
|
context: e
|
|
3467
3467
|
}).includes(!1);
|
|
3468
3468
|
}
|
|
@@ -3637,11 +3637,19 @@ class en extends R {
|
|
|
3637
3637
|
this.grid.requestStateChange?.();
|
|
3638
3638
|
}
|
|
3639
3639
|
}
|
|
3640
|
-
const Ci = '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{display:block!important;grid-template-columns:none!important;padding:var(--tbw-cell-padding);padding-left:var(--tbw-spacing-xl);border-bottom:1px solid var(--tbw-color-border);min-height:auto!important;height:auto!important;contain:none!important;content-visibility:visible!important;background:var(--tbw-color-bg);position:relative;&:nth-child(2n){background:var(--tbw-color-row-alt)}&:hover{background:var(--tbw-color-row-hover)}&[aria-selected=true]{background:var(--tbw-color-selection);&:before{content:"";position:absolute;left:0;top:0;bottom:0;width:4px;background:var(--tbw-color-accent)}}}.data-grid-row>.cell{display:flex!important;justify-content:space-between;align-items:center;padding:var(--tbw-spacing-xs) var(--tbw-spacing-md);width:100%!important;min-width:0!important;min-height:auto!important;height:auto!important;line-height:1.5!important;position:static!important;left:auto!important;right:auto!important;border:none!important;border-bottom:none!important;border-right:none!important;background:transparent!important;white-space:normal!important;overflow:visible!important;&:before{content:attr(data-header) ": ";font-weight:600;color:var(--tbw-color-header-fg);flex-shrink:0;margin-right:var(--tbw-spacing-md);min-width:100px}&:after{content:none}}.cell[data-utility]{display:none!important}
|
|
3640
|
+
const Ci = 'tbw-grid[data-responsive-animate]{.data-grid-row,.data-grid-row>.cell{transition:opacity var(--tbw-responsive-duration, .2s) ease-out,transform var(--tbw-responsive-duration, .2s) ease-out}}tbw-grid[data-responsive][data-responsive-animate]{.data-grid-row{animation:responsive-card-enter var(--tbw-responsive-duration, .2s) ease-out}}@keyframes responsive-card-enter{0%{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}tbw-grid[data-responsive]{.header{display:none!important}.footer-row{display:none}.tbw-scroll-area{overflow-x:hidden;min-width:0!important}.rows-body-wrapper{min-width:0!important}.data-grid-row:not(.group-row){display:block!important;grid-template-columns:none!important;padding:var(--tbw-cell-padding);padding-left:var(--tbw-spacing-xl);border-bottom:1px solid var(--tbw-color-border);min-height:auto!important;height:auto!important;contain:none!important;content-visibility:visible!important;background:var(--tbw-color-bg);position:relative;&:nth-child(2n){background:var(--tbw-color-row-alt)}&:hover{background:var(--tbw-color-row-hover)}&[aria-selected=true]{background:var(--tbw-color-selection);&:before{content:"";position:absolute;left:0;top:0;bottom:0;width:4px;background:var(--tbw-color-accent)}}}.data-grid-row:not(.group-row)>.cell{display:flex!important;justify-content:space-between;align-items:center;padding:var(--tbw-spacing-xs) var(--tbw-spacing-md);width:100%!important;min-width:0!important;min-height:auto!important;height:auto!important;line-height:1.5!important;position:static!important;left:auto!important;right:auto!important;border:none!important;border-bottom:none!important;border-right:none!important;background:transparent!important;white-space:normal!important;overflow:visible!important;&:before{content:attr(data-header) ": ";font-weight:600;color:var(--tbw-color-header-fg);flex-shrink:0;margin-right:var(--tbw-spacing-md);min-width:100px}&:after{content:none}}.cell[data-utility]{display:none!important}}tbw-grid[data-responsive] .cell[data-responsive-hidden]{display:none!important}tbw-grid[data-responsive] .cell[data-responsive-value-only]{&:before{display:none!important}justify-content:flex-start!important;font-weight:500}tbw-grid:not([data-responsive]) .cell[data-responsive-hidden]{display:none!important}tbw-grid[data-responsive]{.tbw-footer,.tbw-pinned-rows,.tbw-aggregation-rows{display:none!important}.tbw-pinned-rows,.tbw-aggregation-rows,.tbw-aggregation-row{min-width:0!important}}tbw-grid[data-responsive] .data-grid-row.responsive-card{display:block!important;padding:var(--tbw-cell-padding);border-bottom:1px solid var(--tbw-color-border);>*{width:100%}.cell:before{display:none}}';
|
|
3641
3641
|
class tn extends R {
|
|
3642
3642
|
name = "responsive";
|
|
3643
3643
|
version = "1.0.0";
|
|
3644
3644
|
styles = Ci;
|
|
3645
|
+
static manifest = {
|
|
3646
|
+
incompatibleWith: [
|
|
3647
|
+
{
|
|
3648
|
+
name: "groupingRows",
|
|
3649
|
+
reason: "Responsive card layout does not yet support row grouping. The variable row heights (cards vs group headers) cause scroll calculation issues."
|
|
3650
|
+
}
|
|
3651
|
+
]
|
|
3652
|
+
};
|
|
3645
3653
|
#e;
|
|
3646
3654
|
#t = !1;
|
|
3647
3655
|
#o;
|
|
@@ -3649,8 +3657,8 @@ class tn extends R {
|
|
|
3649
3657
|
#n = 0;
|
|
3650
3658
|
#s = /* @__PURE__ */ new Set();
|
|
3651
3659
|
#c = /* @__PURE__ */ new Set();
|
|
3652
|
-
#
|
|
3653
|
-
#
|
|
3660
|
+
#l = null;
|
|
3661
|
+
#d = [];
|
|
3654
3662
|
isResponsive() {
|
|
3655
3663
|
return this.#t;
|
|
3656
3664
|
}
|
|
@@ -3671,10 +3679,10 @@ class tn extends R {
|
|
|
3671
3679
|
return this.#n;
|
|
3672
3680
|
}
|
|
3673
3681
|
getActiveBreakpoint() {
|
|
3674
|
-
return this.#
|
|
3682
|
+
return this.#l;
|
|
3675
3683
|
}
|
|
3676
3684
|
attach(e) {
|
|
3677
|
-
super.attach(e), this.#r(this.config.hiddenColumns), this.config.breakpoints?.length && (this.#
|
|
3685
|
+
super.attach(e), this.#r(this.config.hiddenColumns), this.config.breakpoints?.length && (this.#d = [...this.config.breakpoints].sort((t, i) => i.maxWidth - t.maxWidth)), this.#e = new ResizeObserver((t) => {
|
|
3678
3686
|
const i = t[0]?.contentRect.width ?? 0;
|
|
3679
3687
|
this.#n = i, clearTimeout(this.#o), this.#o = setTimeout(() => {
|
|
3680
3688
|
this.#u(i);
|
|
@@ -3690,7 +3698,7 @@ class tn extends R {
|
|
|
3690
3698
|
this.#e?.disconnect(), this.#e = void 0, clearTimeout(this.#o), this.#o = void 0, this.gridElement && this.gridElement.removeAttribute("data-responsive"), super.detach();
|
|
3691
3699
|
}
|
|
3692
3700
|
afterRender() {
|
|
3693
|
-
if (!(this.#
|
|
3701
|
+
if (this.#R(), !(this.#d.length > 0 ? this.#l !== null : this.#t))
|
|
3694
3702
|
return;
|
|
3695
3703
|
const t = this.#s.size > 0, i = this.#c.size > 0;
|
|
3696
3704
|
if (!t && !i)
|
|
@@ -3702,8 +3710,8 @@ class tn extends R {
|
|
|
3702
3710
|
}
|
|
3703
3711
|
}
|
|
3704
3712
|
#u(e) {
|
|
3705
|
-
if (this.#
|
|
3706
|
-
this.#
|
|
3713
|
+
if (this.#d.length > 0) {
|
|
3714
|
+
this.#p(e);
|
|
3707
3715
|
return;
|
|
3708
3716
|
}
|
|
3709
3717
|
const t = this.config.breakpoint ?? 0;
|
|
@@ -3717,12 +3725,12 @@ class tn extends R {
|
|
|
3717
3725
|
breakpoint: t
|
|
3718
3726
|
}), this.requestRender());
|
|
3719
3727
|
}
|
|
3720
|
-
#
|
|
3728
|
+
#p(e) {
|
|
3721
3729
|
let t = null;
|
|
3722
|
-
for (const n of this.#
|
|
3730
|
+
for (const n of this.#d)
|
|
3723
3731
|
e <= n.maxWidth && (t = n);
|
|
3724
|
-
if (t !== this.#
|
|
3725
|
-
this.#
|
|
3732
|
+
if (t !== this.#l) {
|
|
3733
|
+
this.#l = t, t?.hiddenColumns ? this.#r(t.hiddenColumns) : this.#r(this.config.hiddenColumns);
|
|
3726
3734
|
const n = t?.cardLayout === !0;
|
|
3727
3735
|
n !== this.#t && (this.#t = n, this.#h()), this.emit("responsive-change", {
|
|
3728
3736
|
isResponsive: this.#t,
|
|
@@ -3731,29 +3739,29 @@ class tn extends R {
|
|
|
3731
3739
|
}), this.requestRender();
|
|
3732
3740
|
}
|
|
3733
3741
|
}
|
|
3734
|
-
#
|
|
3742
|
+
#a;
|
|
3735
3743
|
#h() {
|
|
3736
3744
|
this.gridElement.toggleAttribute("data-responsive", this.#t);
|
|
3737
3745
|
const e = this.config.animate !== !1;
|
|
3738
3746
|
this.gridElement.toggleAttribute("data-responsive-animate", e), this.config.animationDuration && this.gridElement.style.setProperty("--tbw-responsive-duration", `${this.config.animationDuration}ms`);
|
|
3739
3747
|
const t = this.grid;
|
|
3740
3748
|
if (this.#t) {
|
|
3741
|
-
t._virtualization && (this.#
|
|
3749
|
+
t._virtualization && (this.#a = t._virtualization.rowHeight);
|
|
3742
3750
|
const i = this.gridElement.querySelector(".tbw-scroll-area");
|
|
3743
3751
|
i && (i.scrollLeft = 0);
|
|
3744
3752
|
} else {
|
|
3745
3753
|
const i = this.gridElement.querySelectorAll(".data-grid-row");
|
|
3746
3754
|
for (const n of i)
|
|
3747
3755
|
n.style.height = "", n.classList.remove("responsive-card");
|
|
3748
|
-
this.#
|
|
3756
|
+
this.#a && this.#a > 0 && t._virtualization && (t._virtualization.rowHeight = this.#a, this.#a = void 0), this.#f = void 0, this.#g = void 0, this.#m = void 0;
|
|
3749
3757
|
}
|
|
3750
3758
|
}
|
|
3751
3759
|
renderRow(e, t, i) {
|
|
3752
|
-
if (!this.#t || !this.config.cardRenderer)
|
|
3760
|
+
if (!this.#t || !this.config.cardRenderer || e.__isGroupRow)
|
|
3753
3761
|
return;
|
|
3754
3762
|
t.replaceChildren();
|
|
3755
3763
|
const n = this.config.cardRenderer(e, i);
|
|
3756
|
-
t.
|
|
3764
|
+
t.className = "data-grid-row responsive-card";
|
|
3757
3765
|
const r = this.config.cardRowHeight ?? "auto";
|
|
3758
3766
|
return r !== "auto" ? t.style.height = `${r}px` : t.style.height = "auto", t.appendChild(n), !0;
|
|
3759
3767
|
}
|
|
@@ -3785,6 +3793,74 @@ class tn extends R {
|
|
|
3785
3793
|
}
|
|
3786
3794
|
return !1;
|
|
3787
3795
|
}
|
|
3796
|
+
#f;
|
|
3797
|
+
#g;
|
|
3798
|
+
#m;
|
|
3799
|
+
#v() {
|
|
3800
|
+
if (this.#f && this.#f > 0)
|
|
3801
|
+
return this.#f;
|
|
3802
|
+
const e = this.config.cardRowHeight;
|
|
3803
|
+
return typeof e == "number" && e > 0 ? e : 80;
|
|
3804
|
+
}
|
|
3805
|
+
#y() {
|
|
3806
|
+
return this.#g && this.#g > 0 ? this.#g : this.#a ?? 28;
|
|
3807
|
+
}
|
|
3808
|
+
#w() {
|
|
3809
|
+
for (const e of this.rows)
|
|
3810
|
+
if (e.__isGroupRow)
|
|
3811
|
+
return !0;
|
|
3812
|
+
return !1;
|
|
3813
|
+
}
|
|
3814
|
+
#x() {
|
|
3815
|
+
let e = 0, t = 0;
|
|
3816
|
+
for (const i of this.rows)
|
|
3817
|
+
i.__isGroupRow ? e++ : t++;
|
|
3818
|
+
return { groupCount: e, cardCount: t };
|
|
3819
|
+
}
|
|
3820
|
+
getExtraHeight() {
|
|
3821
|
+
if (!this.#t || !this.config.cardRenderer || !this.#w())
|
|
3822
|
+
return 0;
|
|
3823
|
+
const e = this.#a ?? 28, t = this.#y(), i = this.#v(), { groupCount: n, cardCount: r } = this.#x(), o = n * Math.max(0, t - e), a = r * Math.max(0, i - e);
|
|
3824
|
+
return o + a;
|
|
3825
|
+
}
|
|
3826
|
+
getExtraHeightBefore(e) {
|
|
3827
|
+
if (!this.#t || !this.config.cardRenderer || !this.#w())
|
|
3828
|
+
return 0;
|
|
3829
|
+
const t = this.#a ?? 28, i = this.#y(), n = this.#v(), r = Math.max(0, i - t), o = Math.max(0, n - t);
|
|
3830
|
+
let a = 0, l = 0;
|
|
3831
|
+
const d = this.rows, c = Math.min(e, d.length);
|
|
3832
|
+
for (let u = 0; u < c; u++)
|
|
3833
|
+
d[u].__isGroupRow ? a++ : l++;
|
|
3834
|
+
return a * r + l * o;
|
|
3835
|
+
}
|
|
3836
|
+
#C() {
|
|
3837
|
+
let e = 0;
|
|
3838
|
+
for (const t of this.rows)
|
|
3839
|
+
t.__isGroupRow || e++;
|
|
3840
|
+
return e;
|
|
3841
|
+
}
|
|
3842
|
+
#b = !1;
|
|
3843
|
+
#R() {
|
|
3844
|
+
if (!this.#t || !this.config.cardRenderer)
|
|
3845
|
+
return;
|
|
3846
|
+
let e = !1;
|
|
3847
|
+
const t = this.grid, i = this.#w(), n = this.#C();
|
|
3848
|
+
if (n !== this.#m && (this.#m = n, e = !0), i) {
|
|
3849
|
+
const o = this.gridElement.querySelector(".data-grid-row.group-row");
|
|
3850
|
+
if (o) {
|
|
3851
|
+
const a = o.getBoundingClientRect().height;
|
|
3852
|
+
a > 0 && a !== this.#g && (this.#g = a, e = !0);
|
|
3853
|
+
}
|
|
3854
|
+
}
|
|
3855
|
+
const r = this.gridElement.querySelector(".data-grid-row.responsive-card");
|
|
3856
|
+
if (r) {
|
|
3857
|
+
const o = r.getBoundingClientRect().height;
|
|
3858
|
+
o > 0 && o !== this.#f && (this.#f = o, e = !0, !i && t._virtualization && (t._virtualization.rowHeight = o));
|
|
3859
|
+
}
|
|
3860
|
+
e && !this.#b && (this.#b = !0, queueMicrotask(() => {
|
|
3861
|
+
this.#b = !1, this.grid && this.#t && this.grid.refreshVirtualWindow?.(!0, !0);
|
|
3862
|
+
}));
|
|
3863
|
+
}
|
|
3788
3864
|
}
|
|
3789
3865
|
function V(s) {
|
|
3790
3866
|
return {
|
|
@@ -3811,17 +3887,17 @@ function Ei(s, e, t) {
|
|
|
3811
3887
|
function Me(s, e, t) {
|
|
3812
3888
|
return t.some((i) => Ei(s, e, i));
|
|
3813
3889
|
}
|
|
3814
|
-
function
|
|
3890
|
+
function Si(s) {
|
|
3815
3891
|
const e = [], t = V(s);
|
|
3816
3892
|
for (let i = t.startRow; i <= t.endRow; i++)
|
|
3817
3893
|
for (let n = t.startCol; n <= t.endCol; n++)
|
|
3818
3894
|
e.push({ row: i, col: n });
|
|
3819
3895
|
return e;
|
|
3820
3896
|
}
|
|
3821
|
-
function
|
|
3897
|
+
function ki(s) {
|
|
3822
3898
|
const e = /* @__PURE__ */ new Map();
|
|
3823
3899
|
for (const t of s)
|
|
3824
|
-
for (const i of
|
|
3900
|
+
for (const i of Si(t))
|
|
3825
3901
|
e.set(`${i.row},${i.col}`, i);
|
|
3826
3902
|
return [...e.values()];
|
|
3827
3903
|
}
|
|
@@ -4043,7 +4119,7 @@ class nn extends R {
|
|
|
4043
4119
|
};
|
|
4044
4120
|
}
|
|
4045
4121
|
getSelectedCells() {
|
|
4046
|
-
return
|
|
4122
|
+
return ki(this.ranges);
|
|
4047
4123
|
}
|
|
4048
4124
|
isCellSelected(e, t) {
|
|
4049
4125
|
return Me(e, t, this.ranges);
|
|
@@ -4434,7 +4510,7 @@ function Ki(s, e, t) {
|
|
|
4434
4510
|
redoStack: []
|
|
4435
4511
|
};
|
|
4436
4512
|
}
|
|
4437
|
-
function
|
|
4513
|
+
function He(s) {
|
|
4438
4514
|
if (s.undoStack.length === 0)
|
|
4439
4515
|
return { newState: s, action: null };
|
|
4440
4516
|
const e = [...s.undoStack], t = e.pop();
|
|
@@ -4446,7 +4522,7 @@ function Ne(s) {
|
|
|
4446
4522
|
action: t
|
|
4447
4523
|
} : { newState: s, action: null };
|
|
4448
4524
|
}
|
|
4449
|
-
function
|
|
4525
|
+
function Ne(s) {
|
|
4450
4526
|
if (s.redoStack.length === 0)
|
|
4451
4527
|
return { newState: s, action: null };
|
|
4452
4528
|
const e = [...s.redoStack], t = e.pop();
|
|
@@ -4458,16 +4534,16 @@ function He(s) {
|
|
|
4458
4534
|
action: t
|
|
4459
4535
|
} : { newState: s, action: null };
|
|
4460
4536
|
}
|
|
4461
|
-
function
|
|
4537
|
+
function Hi(s) {
|
|
4462
4538
|
return s.undoStack.length > 0;
|
|
4463
4539
|
}
|
|
4464
|
-
function
|
|
4540
|
+
function Ni(s) {
|
|
4465
4541
|
return s.redoStack.length > 0;
|
|
4466
4542
|
}
|
|
4467
|
-
function
|
|
4543
|
+
function Gi() {
|
|
4468
4544
|
return { undoStack: [], redoStack: [] };
|
|
4469
4545
|
}
|
|
4470
|
-
function
|
|
4546
|
+
function zi(s, e, t, i) {
|
|
4471
4547
|
return {
|
|
4472
4548
|
type: "cell-edit",
|
|
4473
4549
|
rowIndex: s,
|
|
@@ -4495,7 +4571,7 @@ class sn extends R {
|
|
|
4495
4571
|
onKeyDown(e) {
|
|
4496
4572
|
const t = (e.ctrlKey || e.metaKey) && e.key === "z" && !e.shiftKey, i = (e.ctrlKey || e.metaKey) && (e.key === "y" || e.key === "z" && e.shiftKey);
|
|
4497
4573
|
if (t) {
|
|
4498
|
-
const n =
|
|
4574
|
+
const n = He({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
4499
4575
|
if (n.action) {
|
|
4500
4576
|
const r = this.rows;
|
|
4501
4577
|
r[n.action.rowIndex] && (r[n.action.rowIndex][n.action.field] = n.action.oldValue), this.undoStack = n.newState.undoStack, this.redoStack = n.newState.redoStack, this.emit("undo", {
|
|
@@ -4506,7 +4582,7 @@ class sn extends R {
|
|
|
4506
4582
|
return !0;
|
|
4507
4583
|
}
|
|
4508
4584
|
if (i) {
|
|
4509
|
-
const n =
|
|
4585
|
+
const n = Ne({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
4510
4586
|
if (n.action) {
|
|
4511
4587
|
const r = this.rows;
|
|
4512
4588
|
r[n.action.rowIndex] && (r[n.action.rowIndex][n.action.field] = n.action.newValue), this.undoStack = n.newState.undoStack, this.redoStack = n.newState.redoStack, this.emit("redo", {
|
|
@@ -4519,7 +4595,7 @@ class sn extends R {
|
|
|
4519
4595
|
return !1;
|
|
4520
4596
|
}
|
|
4521
4597
|
recordEdit(e, t, i, n) {
|
|
4522
|
-
const r =
|
|
4598
|
+
const r = zi(e, t, i, n), o = Ki(
|
|
4523
4599
|
{ undoStack: this.undoStack, redoStack: this.redoStack },
|
|
4524
4600
|
r,
|
|
4525
4601
|
this.config.maxHistorySize ?? 100
|
|
@@ -4527,7 +4603,7 @@ class sn extends R {
|
|
|
4527
4603
|
this.undoStack = o.undoStack, this.redoStack = o.redoStack;
|
|
4528
4604
|
}
|
|
4529
4605
|
undo() {
|
|
4530
|
-
const e =
|
|
4606
|
+
const e = He({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
4531
4607
|
if (e.action) {
|
|
4532
4608
|
const t = this.rows;
|
|
4533
4609
|
t[e.action.rowIndex] && (t[e.action.rowIndex][e.action.field] = e.action.oldValue), this.undoStack = e.newState.undoStack, this.redoStack = e.newState.redoStack, this.requestRender();
|
|
@@ -4535,7 +4611,7 @@ class sn extends R {
|
|
|
4535
4611
|
return e.action;
|
|
4536
4612
|
}
|
|
4537
4613
|
redo() {
|
|
4538
|
-
const e =
|
|
4614
|
+
const e = Ne({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
4539
4615
|
if (e.action) {
|
|
4540
4616
|
const t = this.rows;
|
|
4541
4617
|
t[e.action.rowIndex] && (t[e.action.rowIndex][e.action.field] = e.action.newValue), this.undoStack = e.newState.undoStack, this.redoStack = e.newState.redoStack, this.requestRender();
|
|
@@ -4543,13 +4619,13 @@ class sn extends R {
|
|
|
4543
4619
|
return e.action;
|
|
4544
4620
|
}
|
|
4545
4621
|
canUndo() {
|
|
4546
|
-
return
|
|
4622
|
+
return Hi({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
4547
4623
|
}
|
|
4548
4624
|
canRedo() {
|
|
4549
|
-
return
|
|
4625
|
+
return Ni({ undoStack: this.undoStack, redoStack: this.redoStack });
|
|
4550
4626
|
}
|
|
4551
4627
|
clearHistory() {
|
|
4552
|
-
const e =
|
|
4628
|
+
const e = Gi();
|
|
4553
4629
|
this.undoStack = e.undoStack, this.redoStack = e.redoStack;
|
|
4554
4630
|
}
|
|
4555
4631
|
getUndoStack() {
|
|
@@ -4559,8 +4635,8 @@ class sn extends R {
|
|
|
4559
4635
|
return [...this.redoStack];
|
|
4560
4636
|
}
|
|
4561
4637
|
}
|
|
4562
|
-
const
|
|
4563
|
-
function
|
|
4638
|
+
const Oi = '@layer tbw-plugins{.tbw-visibility-content{display:flex;flex-direction:column;height:100%}.tbw-visibility-list{flex:1;overflow-y:auto;padding:var(--tbw-panel-padding, var(--tbw-spacing-md, .5rem))}.tbw-visibility-row{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));padding:var(--tbw-menu-item-padding, .375rem .25rem);cursor:pointer;font-size:var(--tbw-font-size-sm, .8125rem);border-radius:var(--tbw-border-radius, .25rem);position:relative}.tbw-visibility-row:hover{background:var(--tbw-visibility-hover, var(--tbw-color-row-hover, #f3f4f6))}.tbw-visibility-row input[type=checkbox]{cursor:pointer}.tbw-visibility-row.locked span{color:var(--tbw-color-fg-muted, #888)}.tbw-visibility-handle{cursor:grab;color:var(--tbw-color-fg-muted, #888);font-size:var(--tbw-font-size-2xs, .625rem);letter-spacing:-2px;user-select:none;flex-shrink:0}.tbw-visibility-row.reorderable:hover .tbw-visibility-handle{color:var(--tbw-color-fg, #1f2937)}.tbw-visibility-label{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));flex:1;cursor:pointer}.tbw-visibility-row.dragging{opacity:.5;cursor:grabbing}.tbw-visibility-row.drop-before:before{content:"";position:absolute;left:0;right:0;top:0;height:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent, #3b82f6))}.tbw-visibility-row.drop-after:after{content:"";position:absolute;left:0;right:0;bottom:0;height:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent, #3b82f6))}.tbw-visibility-show-all{margin:var(--tbw-panel-padding, var(--tbw-spacing-md, .5rem));padding:var(--tbw-button-padding, .5rem .75rem);border:1px solid var(--tbw-visibility-border, var(--tbw-color-border, #e5e7eb));border-radius:var(--tbw-border-radius, .25rem);background:var(--tbw-visibility-btn-bg, var(--tbw-color-header-bg, #f9fafb));color:var(--tbw-color-fg, #1f2937);cursor:pointer;font-size:var(--tbw-font-size-sm, .8125rem)}.tbw-visibility-show-all:hover{background:var(--tbw-visibility-hover, var(--tbw-color-row-hover, #f3f4f6))}}';
|
|
4639
|
+
function Ge(s) {
|
|
4564
4640
|
const e = s.meta ?? {};
|
|
4565
4641
|
return e.lockPosition !== !0 && e.suppressMovable !== !0;
|
|
4566
4642
|
}
|
|
@@ -4570,7 +4646,7 @@ class M extends R {
|
|
|
4570
4646
|
];
|
|
4571
4647
|
name = "visibility";
|
|
4572
4648
|
static PANEL_ID = "columns";
|
|
4573
|
-
styles =
|
|
4649
|
+
styles = Oi;
|
|
4574
4650
|
get defaultConfig() {
|
|
4575
4651
|
return {
|
|
4576
4652
|
allowHideAll: !1
|
|
@@ -4660,7 +4736,7 @@ class M extends R {
|
|
|
4660
4736
|
const i = this.grid.getAllColumns().filter((n) => !n.utility);
|
|
4661
4737
|
for (let n = 0; n < i.length; n++) {
|
|
4662
4738
|
const r = i[n], o = r.header || r.field, a = document.createElement("div");
|
|
4663
|
-
a.className = r.lockVisible ? "tbw-visibility-row locked" : "tbw-visibility-row", a.setAttribute("data-field", r.field), a.setAttribute("data-index", String(n)), t &&
|
|
4739
|
+
a.className = r.lockVisible ? "tbw-visibility-row locked" : "tbw-visibility-row", a.setAttribute("data-field", r.field), a.setAttribute("data-index", String(n)), t && Ge(r) && (a.draggable = !0, a.classList.add("reorderable"), this.setupDragListeners(a, r.field, n, e));
|
|
4664
4740
|
const l = document.createElement("label");
|
|
4665
4741
|
l.className = "tbw-visibility-label";
|
|
4666
4742
|
const d = document.createElement("input");
|
|
@@ -4668,7 +4744,7 @@ class M extends R {
|
|
|
4668
4744
|
this.grid.toggleColumnVisibility(r.field), setTimeout(() => this.rebuildToggles(e), 0);
|
|
4669
4745
|
});
|
|
4670
4746
|
const c = document.createElement("span");
|
|
4671
|
-
if (c.textContent = o, l.appendChild(d), l.appendChild(c), t &&
|
|
4747
|
+
if (c.textContent = o, l.appendChild(d), l.appendChild(c), t && Ge(r)) {
|
|
4672
4748
|
const u = document.createElement("span");
|
|
4673
4749
|
u.className = "tbw-visibility-handle", this.setIcon(u, this.resolveIcon("dragHandle")), u.title = "Drag to reorder", a.appendChild(u);
|
|
4674
4750
|
}
|
|
@@ -4729,7 +4805,7 @@ export {
|
|
|
4729
4805
|
Xi as GroupingRowsPlugin,
|
|
4730
4806
|
Be as MasterDetailPlugin,
|
|
4731
4807
|
Zi as MultiSortPlugin,
|
|
4732
|
-
|
|
4808
|
+
ze as PLUGIN_QUERIES,
|
|
4733
4809
|
Ji as PinnedColumnsPlugin,
|
|
4734
4810
|
Qi as PinnedRowsPlugin,
|
|
4735
4811
|
D as PivotPlugin,
|