@toolbox-web/grid 1.15.0 → 1.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/all.js +45 -23
- package/all.js.map +1 -1
- package/index.js +883 -865
- package/index.js.map +1 -1
- package/lib/core/internal/columns.d.ts +0 -5
- package/lib/core/internal/columns.d.ts.map +1 -1
- package/lib/core/internal/event-delegation.d.ts.map +1 -1
- package/lib/core/internal/rows.d.ts.map +1 -1
- package/lib/core/types.d.ts +12 -0
- package/lib/core/types.d.ts.map +1 -1
- package/lib/plugins/clipboard/ClipboardPlugin.d.ts.map +1 -1
- package/lib/plugins/clipboard/copy.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.js +55 -55
- 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 +59 -49
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/context-menu/menu.d.ts.map +1 -1
- package/lib/plugins/context-menu/types.d.ts +4 -4
- package/lib/plugins/context-menu/types.d.ts.map +1 -1
- package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
- package/lib/plugins/editing/index.js +228 -216
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/filter-model.d.ts.map +1 -1
- package/lib/plugins/filtering/index.js +4 -5
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/print/index.js.map +1 -1
- package/lib/plugins/reorder/index.js.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/umd/grid.all.umd.js +26 -26
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +21 -21
- package/umd/grid.umd.js.map +1 -1
- package/umd/plugins/clipboard.umd.js +4 -4
- package/umd/plugins/clipboard.umd.js.map +1 -1
- package/umd/plugins/context-menu.umd.js +1 -1
- package/umd/plugins/context-menu.umd.js.map +1 -1
- package/umd/plugins/editing.umd.js +1 -1
- package/umd/plugins/editing.umd.js.map +1 -1
- package/umd/plugins/filtering.umd.js +1 -1
- package/umd/plugins/filtering.umd.js.map +1 -1
package/all.js
CHANGED
|
@@ -17,11 +17,12 @@ function Rt(a) {
|
|
|
17
17
|
async function St(a) {
|
|
18
18
|
try {
|
|
19
19
|
return await navigator.clipboard.writeText(a), !0;
|
|
20
|
-
} catch {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
} catch (e) {
|
|
21
|
+
console.warn("[copyToClipboard] Clipboard API failed:", e);
|
|
22
|
+
const t = document.createElement("textarea");
|
|
23
|
+
t.value = a, t.style.position = "fixed", t.style.opacity = "0", t.style.pointerEvents = "none", document.body.appendChild(t), t.select();
|
|
24
|
+
const i = document.execCommand("copy");
|
|
25
|
+
return document.body.removeChild(t), i;
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
28
|
function Ae(a, e) {
|
|
@@ -84,17 +85,15 @@ class _n extends I {
|
|
|
84
85
|
}
|
|
85
86
|
lastCopied = null;
|
|
86
87
|
attach(e) {
|
|
87
|
-
super.attach(e), e.addEventListener(
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
{ signal: this.disconnectSignal }
|
|
91
|
-
);
|
|
88
|
+
super.attach(e), e.addEventListener("paste", (i) => this.#e(i), {
|
|
89
|
+
signal: this.disconnectSignal
|
|
90
|
+
});
|
|
92
91
|
}
|
|
93
92
|
detach() {
|
|
94
93
|
this.lastCopied = null;
|
|
95
94
|
}
|
|
96
95
|
onKeyDown(e) {
|
|
97
|
-
return (e.ctrlKey || e.metaKey) && e.key === "c" ? (this.#t(e.target), !0) : !1;
|
|
96
|
+
return (e.ctrlKey || e.metaKey) && e.key === "c" ? (e.preventDefault(), this.#t(e.target), !0) : !1;
|
|
98
97
|
}
|
|
99
98
|
#t(e) {
|
|
100
99
|
const t = this.#r();
|
|
@@ -182,7 +181,8 @@ class _n extends I {
|
|
|
182
181
|
}
|
|
183
182
|
async copy(e) {
|
|
184
183
|
const { columns: t, rows: i } = this.#i(e);
|
|
185
|
-
if (t.length === 0 || i.length === 0)
|
|
184
|
+
if (t.length === 0 || i.length === 0)
|
|
185
|
+
return "";
|
|
186
186
|
const n = this.#n(t, i, e);
|
|
187
187
|
return await St(n), this.lastCopied = { text: n, timestamp: Date.now() }, this.emit("copy", {
|
|
188
188
|
text: n,
|
|
@@ -343,7 +343,7 @@ class Ln extends I {
|
|
|
343
343
|
return this.totalWidth;
|
|
344
344
|
}
|
|
345
345
|
}
|
|
346
|
-
const ae = "@layer tbw-plugins{.tbw-context-menu{position:fixed;background:var(--tbw-context-menu-bg, var(--tbw-color-panel-bg));color:var(--tbw-context-menu-fg, var(--tbw-color-fg));border:1px solid var(--tbw-context-menu-border, var(--tbw-color-border));border-radius:var(--tbw-context-menu-radius, var(--tbw-border-radius));box-shadow:var(--tbw-context-menu-shadow, 0 2px 10px var(--tbw-color-shadow));min-width:var(--tbw-context-menu-min-width, var(--tbw-menu-min-width));padding:var(--tbw-spacing-xs) 0;z-index:10000;font-size:var(--tbw-context-menu-font-size, var(--tbw-font-size-sm));font-family:var(--tbw-context-menu-font-family, var(--tbw-font-family))}.tbw-context-menu-item{display:flex;align-items:center;padding:var(--tbw-context-menu-item-padding, var(--tbw-menu-item-padding));cursor:pointer;gap:var(--tbw-context-menu-item-gap, var(--tbw-menu-item-gap))}.tbw-context-menu-item:hover:not(.disabled){background:var(--tbw-context-menu-hover, var(--tbw-color-row-hover))}.tbw-context-menu-item.disabled{opacity:.5;cursor:default}.tbw-context-menu-item.danger{color:var(--tbw-context-menu-danger, var(--tbw-color-danger))}.tbw-context-menu-icon{width:var(--tbw-context-menu-icon-size, var(--tbw-icon-size));text-align:center}.tbw-context-menu-label{flex:1}.tbw-context-menu-shortcut{color:var(--tbw-context-menu-muted, var(--tbw-color-fg-muted));font-size:var(--tbw-context-menu-shortcut-size, var(--tbw-font-size-xs))}.tbw-context-menu-arrow{font-size:var(--tbw-context-menu-arrow-size, var(--tbw-font-size-2xs));color:var(--tbw-context-menu-muted, var(--tbw-color-fg-muted))}.tbw-context-menu-separator{height:1px;background:var(--tbw-context-menu-border, var(--tbw-color-border));margin:var(--tbw-spacing-xs) 0}}";
|
|
346
|
+
const ae = "@layer tbw-plugins{.tbw-context-menu{position:fixed;background:var(--tbw-context-menu-bg, var(--tbw-color-panel-bg));color:var(--tbw-context-menu-fg, var(--tbw-color-fg));border:1px solid var(--tbw-context-menu-border, var(--tbw-color-border));border-radius:var(--tbw-context-menu-radius, var(--tbw-border-radius));box-shadow:var(--tbw-context-menu-shadow, 0 2px 10px var(--tbw-color-shadow));min-width:var(--tbw-context-menu-min-width, var(--tbw-menu-min-width));padding:var(--tbw-spacing-xs) 0;z-index:10000;font-size:var(--tbw-context-menu-font-size, var(--tbw-font-size-sm));font-family:var(--tbw-context-menu-font-family, var(--tbw-font-family))}.tbw-context-menu-item{display:flex;align-items:center;padding:var(--tbw-context-menu-item-padding, var(--tbw-menu-item-padding));cursor:pointer;gap:var(--tbw-context-menu-item-gap, var(--tbw-menu-item-gap))}.tbw-context-menu-item:hover:not(.disabled){background:var(--tbw-context-menu-hover, var(--tbw-color-row-hover))}.tbw-context-menu-item.disabled{opacity:.5;cursor:default}.tbw-context-menu-item.danger{color:var(--tbw-context-menu-danger, var(--tbw-color-danger))}.tbw-context-menu-icon{width:var(--tbw-context-menu-icon-size, var(--tbw-icon-size));text-align:center}.tbw-context-menu-label{flex:1}.tbw-context-menu-shortcut kbd{color:var(--tbw-context-menu-muted, var(--tbw-color-fg-muted));font-size:var(--tbw-context-menu-shortcut-size, var(--tbw-font-size-xs))}.tbw-context-menu-arrow{font-size:var(--tbw-context-menu-arrow-size, var(--tbw-font-size-2xs));color:var(--tbw-context-menu-muted, var(--tbw-color-fg-muted))}.tbw-context-menu-separator{height:1px;background:var(--tbw-context-menu-border, var(--tbw-color-border));margin:var(--tbw-spacing-xs) 0}}";
|
|
347
347
|
function me(a, e) {
|
|
348
348
|
return (typeof a == "function" ? a(e) : a).filter((i) => !(i.hidden === !0 || typeof i.hidden == "function" && i.hidden(e)));
|
|
349
349
|
}
|
|
@@ -379,7 +379,17 @@ function be(a, e, t, i = vt.submenuArrow) {
|
|
|
379
379
|
const d = document.createElement("span");
|
|
380
380
|
if (d.className = "tbw-context-menu-label", d.textContent = o.name, s.appendChild(d), o.shortcut) {
|
|
381
381
|
const c = document.createElement("span");
|
|
382
|
-
c.className = "tbw-context-menu-shortcut",
|
|
382
|
+
if (c.className = "tbw-context-menu-shortcut", Array.isArray(o.shortcut))
|
|
383
|
+
o.shortcut.forEach((u, h) => {
|
|
384
|
+
h > 0 && c.appendChild(document.createTextNode("+"));
|
|
385
|
+
const f = document.createElement("kbd");
|
|
386
|
+
f.textContent = u, c.appendChild(f);
|
|
387
|
+
});
|
|
388
|
+
else {
|
|
389
|
+
const u = document.createElement("kbd");
|
|
390
|
+
u.textContent = o.shortcut, c.appendChild(u);
|
|
391
|
+
}
|
|
392
|
+
s.appendChild(c);
|
|
383
393
|
}
|
|
384
394
|
if (o.subMenu?.length) {
|
|
385
395
|
const c = document.createElement("span");
|
|
@@ -853,7 +863,7 @@ class Tn extends I {
|
|
|
853
863
|
s && s(r.newValue);
|
|
854
864
|
},
|
|
855
865
|
{ signal: t }
|
|
856
|
-
), this.#t && (this.gridElement.classList.add("tbw-grid-mode"), this.requestRender(), this.gridElement.addEventListener(
|
|
866
|
+
), this.#t && (i._isGridEditMode = !0, this.gridElement.classList.add("tbw-grid-mode"), this.requestRender(), this.gridElement.addEventListener(
|
|
857
867
|
"focusin",
|
|
858
868
|
(n) => {
|
|
859
869
|
const r = n.target;
|
|
@@ -877,6 +887,8 @@ class Tn extends I {
|
|
|
877
887
|
"keydown",
|
|
878
888
|
(n) => {
|
|
879
889
|
if (n.key === "Escape" && this.#l) {
|
|
890
|
+
if (this.config.onBeforeEditClose && this.config.onBeforeEditClose(n) === !1)
|
|
891
|
+
return;
|
|
880
892
|
const r = document.activeElement;
|
|
881
893
|
r && this.gridElement.contains(r) && (r.blur(), this.gridElement.focus()), this.#l = !1, this.#g = !0, n.preventDefault(), n.stopPropagation();
|
|
882
894
|
}
|
|
@@ -891,7 +903,8 @@ class Tn extends I {
|
|
|
891
903
|
));
|
|
892
904
|
}
|
|
893
905
|
detach() {
|
|
894
|
-
|
|
906
|
+
const e = this.gridElement;
|
|
907
|
+
e._isGridEditMode = !1, this.gridElement.classList.remove("tbw-grid-mode"), this.#e = -1, this.#o = -1, this.#r.clear(), this.#i.clear(), this.#n.clear(), this.#s.clear(), this.#l = !1, this.#g = !1, this.#m = !1, super.detach();
|
|
895
908
|
}
|
|
896
909
|
handleQuery(e) {
|
|
897
910
|
if (e.type === "isEditing")
|
|
@@ -910,6 +923,8 @@ class Tn extends I {
|
|
|
910
923
|
const t = this.grid;
|
|
911
924
|
if (e.key === "Escape") {
|
|
912
925
|
if (this.#t && this.#l) {
|
|
926
|
+
if (this.config.onBeforeEditClose && this.config.onBeforeEditClose(e) === !1)
|
|
927
|
+
return !0;
|
|
913
928
|
const i = document.activeElement;
|
|
914
929
|
return i && this.gridElement.contains(i) && i.blur(), this.#l = !1, this.requestAfterRender(), !0;
|
|
915
930
|
}
|
|
@@ -918,6 +933,8 @@ class Tn extends I {
|
|
|
918
933
|
}
|
|
919
934
|
if (this.#t && !this.#l && (e.key === "ArrowUp" || e.key === "ArrowDown" || e.key === "ArrowLeft" || e.key === "ArrowRight"))
|
|
920
935
|
return !1;
|
|
936
|
+
if (this.#t && this.#l && (e.key === "ArrowUp" || e.key === "ArrowDown"))
|
|
937
|
+
return !0;
|
|
921
938
|
if ((e.key === "ArrowUp" || e.key === "ArrowDown") && this.#e !== -1 && !this.#t) {
|
|
922
939
|
if (this.config.onBeforeEditClose && this.config.onBeforeEditClose(e) === !1)
|
|
923
940
|
return !0;
|
|
@@ -946,7 +963,7 @@ class Tn extends I {
|
|
|
946
963
|
}
|
|
947
964
|
return !1;
|
|
948
965
|
}
|
|
949
|
-
if (e.key === "Enter" && !e.shiftKey) {
|
|
966
|
+
if (e.key === "Enter" && !e.shiftKey && !e.ctrlKey && !e.altKey && !e.metaKey) {
|
|
950
967
|
if (this.#t && !this.#l)
|
|
951
968
|
return this.#f(), !0;
|
|
952
969
|
if (this.#e !== -1)
|
|
@@ -1313,9 +1330,14 @@ class Tn extends I {
|
|
|
1313
1330
|
c && zt(c);
|
|
1314
1331
|
let u = !1;
|
|
1315
1332
|
const h = (b) => {
|
|
1316
|
-
u || !this.#t && this.#e === -1
|
|
1333
|
+
if (u || !this.#t && this.#e === -1) return;
|
|
1334
|
+
const w = this.grid._rows[t] ?? e;
|
|
1335
|
+
this.#v(t, i, b, w);
|
|
1317
1336
|
}, f = () => {
|
|
1318
|
-
u = !0, Z(i.field)
|
|
1337
|
+
if (u = !0, Z(i.field)) {
|
|
1338
|
+
const b = this.grid._rows[t] ?? e;
|
|
1339
|
+
b[i.field] = d;
|
|
1340
|
+
}
|
|
1319
1341
|
}, g = document.createElement("div");
|
|
1320
1342
|
g.className = "tbw-editor-host", r.innerHTML = "", r.appendChild(g), g.addEventListener("keydown", (b) => {
|
|
1321
1343
|
if (b.key === "Enter") {
|
|
@@ -1680,6 +1702,10 @@ function Qt(a, e, t = !1) {
|
|
|
1680
1702
|
return i == null || i === "";
|
|
1681
1703
|
if (e.operator === "notBlank")
|
|
1682
1704
|
return i != null && i !== "";
|
|
1705
|
+
if (e.operator === "notIn")
|
|
1706
|
+
return i == null ? !0 : Array.isArray(e.value) && !e.value.includes(i);
|
|
1707
|
+
if (e.operator === "in")
|
|
1708
|
+
return Array.isArray(e.value) && e.value.includes(i);
|
|
1683
1709
|
if (i == null) return !1;
|
|
1684
1710
|
const n = String(i), r = t ? n : n.toLowerCase(), o = t ? String(e.value) : String(e.value).toLowerCase();
|
|
1685
1711
|
switch (e.operator) {
|
|
@@ -1705,10 +1731,6 @@ function Qt(a, e, t = !1) {
|
|
|
1705
1731
|
return N(i) >= N(e.value);
|
|
1706
1732
|
case "between":
|
|
1707
1733
|
return N(i) >= N(e.value) && N(i) <= N(e.valueTo);
|
|
1708
|
-
case "in":
|
|
1709
|
-
return Array.isArray(e.value) && e.value.includes(i);
|
|
1710
|
-
case "notIn":
|
|
1711
|
-
return Array.isArray(e.value) && !e.value.includes(i);
|
|
1712
1734
|
default:
|
|
1713
1735
|
return !0;
|
|
1714
1736
|
}
|