@toolbox-web/grid 1.12.1 → 1.13.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 +1160 -1012
- package/all.js.map +1 -1
- package/index.js +727 -736
- package/index.js.map +1 -1
- package/lib/core/grid.d.ts.map +1 -1
- package/lib/core/internal/sanitize.d.ts.map +1 -1
- package/lib/core/internal/validate-config.d.ts.map +1 -1
- package/lib/core/types.d.ts +4 -0
- package/lib/core/types.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
- package/lib/plugins/editing/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 +187 -170
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/editing/types.d.ts +44 -0
- 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 +9 -9
- 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 +57 -56
- 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 +40 -39
- package/lib/plugins/responsive/index.js.map +1 -1
- package/lib/plugins/row-reorder/index.js.map +1 -1
- package/lib/plugins/selection/SelectionPlugin.d.ts +51 -0
- package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
- package/lib/plugins/selection/index.js +325 -131
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/selection/types.d.ts +18 -0
- package/lib/plugins/selection/types.d.ts.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 +2 -0
- package/public.d.ts.map +1 -1
- package/themes/dg-theme-bootstrap.css +192 -8
- package/themes/dg-theme-material.css +243 -0
- package/umd/grid.all.umd.js +42 -42
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +19 -19
- 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/filtering.umd.js +1 -1
- package/umd/plugins/filtering.umd.js.map +1 -1
- package/umd/plugins/selection.umd.js +2 -2
- package/umd/plugins/selection.umd.js.map +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const C = /{{\s*([^}]+)\s*}}/g, g = "__DG_EMPTY__", _ = /^[\w$. '?+\-*/%:()!<>=,&|]+$/, y = /__(proto|defineGetter|defineSetter)|constructor|window|globalThis|global|process|Function|import|eval|Reflect|Proxy|Error|arguments|document|location|cookie|localStorage|sessionStorage|indexedDB|fetch|XMLHttpRequest|WebSocket|Worker|SharedWorker|ServiceWorker|opener|parent|top|frames|self|this\b/, D = /* @__PURE__ */ new Set([
|
|
2
2
|
"script",
|
|
3
3
|
"iframe",
|
|
4
4
|
"object",
|
|
@@ -23,23 +23,23 @@ const A = /{{\s*([^}]+)\s*}}/g, g = "__DG_EMPTY__", C = /^[\w$. '?+\-*/%:()!<>=,
|
|
|
23
23
|
"plaintext",
|
|
24
24
|
"xmp",
|
|
25
25
|
"listing"
|
|
26
|
-
]),
|
|
27
|
-
function
|
|
26
|
+
]), b = /^on\w+$/i, S = /* @__PURE__ */ new Set(["href", "src", "action", "formaction", "data", "srcdoc", "xlink:href", "poster", "srcset"]), H = /^\s*(javascript|vbscript|data|blob):/i;
|
|
27
|
+
function T(n) {
|
|
28
28
|
if (!n || typeof n != "string") return "";
|
|
29
29
|
if (n.indexOf("<") === -1) return n;
|
|
30
30
|
const e = document.createElement("template");
|
|
31
|
-
return e.innerHTML = n,
|
|
31
|
+
return e.innerHTML = n, L(e.content), e.innerHTML;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function L(n) {
|
|
34
34
|
const e = [], t = n.querySelectorAll("*");
|
|
35
35
|
for (const i of t) {
|
|
36
36
|
const s = i.tagName.toLowerCase();
|
|
37
|
-
if (
|
|
37
|
+
if (D.has(s)) {
|
|
38
38
|
e.push(i);
|
|
39
39
|
continue;
|
|
40
40
|
}
|
|
41
41
|
if ((s === "svg" || i.namespaceURI === "http://www.w3.org/2000/svg") && Array.from(i.attributes).some(
|
|
42
|
-
(o) =>
|
|
42
|
+
(o) => b.test(o.name) || o.name === "href" || o.name === "xlink:href"
|
|
43
43
|
)) {
|
|
44
44
|
e.push(i);
|
|
45
45
|
continue;
|
|
@@ -47,11 +47,11 @@ function T(n) {
|
|
|
47
47
|
const r = [];
|
|
48
48
|
for (const a of i.attributes) {
|
|
49
49
|
const o = a.name.toLowerCase();
|
|
50
|
-
if (
|
|
50
|
+
if (b.test(o)) {
|
|
51
51
|
r.push(a.name);
|
|
52
52
|
continue;
|
|
53
53
|
}
|
|
54
|
-
if (
|
|
54
|
+
if (S.has(o) && H.test(a.value)) {
|
|
55
55
|
r.push(a.name);
|
|
56
56
|
continue;
|
|
57
57
|
}
|
|
@@ -64,35 +64,36 @@ function T(n) {
|
|
|
64
64
|
}
|
|
65
65
|
e.forEach((i) => i.remove());
|
|
66
66
|
}
|
|
67
|
-
function
|
|
67
|
+
function I(n, e) {
|
|
68
68
|
if (!n || n.indexOf("{{") === -1) return n;
|
|
69
|
-
const t = [], i = n.replace(
|
|
70
|
-
const d =
|
|
69
|
+
const t = [], i = n.replace(C, (o, c) => {
|
|
70
|
+
const d = O(c, e);
|
|
71
71
|
return t.push({ expr: c.trim(), result: d }), d;
|
|
72
|
-
}), s =
|
|
73
|
-
return
|
|
72
|
+
}), s = k(i), r = t.length && t.every((o) => o.result === "" || o.result === g);
|
|
73
|
+
return p.test(n) || r ? "" : s;
|
|
74
74
|
}
|
|
75
|
-
function
|
|
76
|
-
if (n = (n || "").trim(), !n ||
|
|
75
|
+
function O(n, e) {
|
|
76
|
+
if (n = (n || "").trim(), !n || p.test(n)) return g;
|
|
77
77
|
if (n === "value") return e.value == null ? g : String(e.value);
|
|
78
78
|
if (n.startsWith("row.") && !/[()?]/.test(n) && !n.includes(":")) {
|
|
79
79
|
const i = n.slice(4), s = e.row ? e.row[i] : void 0;
|
|
80
80
|
return s == null ? g : String(s);
|
|
81
81
|
}
|
|
82
|
-
if (n.length > 80 || !
|
|
82
|
+
if (n.length > 80 || !_.test(n) || y.test(n)) return g;
|
|
83
83
|
const t = n.match(/\./g);
|
|
84
84
|
if (t && t.length > 1) return g;
|
|
85
85
|
try {
|
|
86
86
|
const s = new Function("value", "row", `return (${n});`)(e.value, e.row), r = s == null ? "" : String(s);
|
|
87
|
-
return
|
|
87
|
+
return p.test(r) ? g : r || g;
|
|
88
88
|
} catch {
|
|
89
89
|
return g;
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
const p = /Reflect|Proxy|ownKeys/;
|
|
93
|
+
function k(n) {
|
|
94
|
+
return n && n.replace(new RegExp(g, "g"), "").replace(/Reflect\.[^<>{}\s]+|\bProxy\b|ownKeys\([^)]*\)/g, "");
|
|
94
95
|
}
|
|
95
|
-
const
|
|
96
|
+
const x = '<svg viewBox="0 0 16 16" width="12" height="12"><path fill="currentColor" d="M6 10.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5z"/></svg>', N = {
|
|
96
97
|
expand: "▶",
|
|
97
98
|
collapse: "▼",
|
|
98
99
|
sortAsc: "▲",
|
|
@@ -101,11 +102,11 @@ const b = '<svg viewBox="0 0 16 16" width="12" height="12"><path fill="currentCo
|
|
|
101
102
|
submenuArrow: "▶",
|
|
102
103
|
dragHandle: "⋮⋮",
|
|
103
104
|
toolPanel: "☰",
|
|
104
|
-
filter:
|
|
105
|
-
filterActive:
|
|
105
|
+
filter: x,
|
|
106
|
+
filterActive: x,
|
|
106
107
|
print: "🖨️"
|
|
107
108
|
};
|
|
108
|
-
class
|
|
109
|
+
class M {
|
|
109
110
|
/**
|
|
110
111
|
* Plugin dependencies - declare other plugins this one requires.
|
|
111
112
|
*
|
|
@@ -395,7 +396,7 @@ class N {
|
|
|
395
396
|
*/
|
|
396
397
|
get gridIcons() {
|
|
397
398
|
const e = this.grid?.gridConfig?.icons ?? {};
|
|
398
|
-
return { ...
|
|
399
|
+
return { ...N, ...e };
|
|
399
400
|
}
|
|
400
401
|
// #region Animation Helpers
|
|
401
402
|
/**
|
|
@@ -471,19 +472,19 @@ class N {
|
|
|
471
472
|
}
|
|
472
473
|
// #endregion
|
|
473
474
|
}
|
|
474
|
-
const
|
|
475
|
-
function
|
|
476
|
-
return n.field ===
|
|
475
|
+
const E = "__tbw_expander", q = 32;
|
|
476
|
+
function v(n) {
|
|
477
|
+
return n.field === E;
|
|
477
478
|
}
|
|
478
|
-
function
|
|
479
|
-
return n.find(
|
|
479
|
+
function P(n) {
|
|
480
|
+
return n.find(v);
|
|
480
481
|
}
|
|
481
|
-
function
|
|
482
|
+
function F(n) {
|
|
482
483
|
return {
|
|
483
|
-
field:
|
|
484
|
+
field: E,
|
|
484
485
|
header: "",
|
|
485
486
|
// No header text - visually merges with next column
|
|
486
|
-
width:
|
|
487
|
+
width: q,
|
|
487
488
|
resizable: !1,
|
|
488
489
|
sortable: !1,
|
|
489
490
|
filterable: !1,
|
|
@@ -498,22 +499,22 @@ function q(n) {
|
|
|
498
499
|
}
|
|
499
500
|
};
|
|
500
501
|
}
|
|
501
|
-
function
|
|
502
|
+
function R(n, e) {
|
|
502
503
|
const t = new Set(n);
|
|
503
504
|
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
504
505
|
}
|
|
505
|
-
function
|
|
506
|
+
function U(n, e) {
|
|
506
507
|
const t = new Set(n);
|
|
507
508
|
return t.add(e), t;
|
|
508
509
|
}
|
|
509
|
-
function
|
|
510
|
+
function z(n, e) {
|
|
510
511
|
const t = new Set(n);
|
|
511
512
|
return t.delete(e), t;
|
|
512
513
|
}
|
|
513
|
-
function
|
|
514
|
+
function G(n, e) {
|
|
514
515
|
return n.has(e);
|
|
515
516
|
}
|
|
516
|
-
function
|
|
517
|
+
function W(n, e, t, i) {
|
|
517
518
|
const s = document.createElement("div");
|
|
518
519
|
s.className = "master-detail-row", s.setAttribute("data-detail-for", String(e)), s.setAttribute("role", "row");
|
|
519
520
|
const r = document.createElement("div");
|
|
@@ -521,12 +522,12 @@ function G(n, e, t, i) {
|
|
|
521
522
|
const a = t(n, e);
|
|
522
523
|
return typeof a == "string" ? r.innerHTML = a : a instanceof HTMLElement && r.appendChild(a), s.appendChild(r), s;
|
|
523
524
|
}
|
|
524
|
-
const
|
|
525
|
-
class
|
|
525
|
+
const $ = "@layer tbw-plugins{tbw-grid .cell[data-field=__tbw_expander]{border-right:none!important;padding:0;display:flex;align-items:center;justify-content:center}tbw-grid .header-row .cell[data-field=__tbw_expander]{display:none}tbw-grid .header-row .cell[data-field=__tbw_expander]+.cell{grid-column:1 / 3}tbw-grid .master-detail-expander{display:flex;align-items:center;justify-content:center;width:100%;height:100%}tbw-grid .master-detail-toggle{cursor:pointer;opacity:.7;-webkit-user-select:none;user-select:none;display:inline-flex;align-items:center;justify-content:center}tbw-grid .master-detail-toggle:hover{opacity:1}tbw-grid .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}tbw-grid .master-detail-cell{padding:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem));overflow:auto}tbw-grid .master-detail-row.tbw-expanding{animation:tbw-detail-expand var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}tbw-grid .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}}}";
|
|
526
|
+
class A extends M {
|
|
526
527
|
/** @internal */
|
|
527
528
|
name = "masterDetail";
|
|
528
529
|
/** @internal */
|
|
529
|
-
styles =
|
|
530
|
+
styles = $;
|
|
530
531
|
/** @internal */
|
|
531
532
|
get defaultConfig() {
|
|
532
533
|
return {
|
|
@@ -588,8 +589,8 @@ class v extends N {
|
|
|
588
589
|
s !== null && (d.animation = s === "false" ? !1 : s), r !== null && (d.showExpandColumn = r !== "false"), a !== null && (d.expandOnRowClick = a === "true"), o !== null && (d.collapseOnClickOutside = o === "true"), c !== null && (d.detailHeight = c === "auto" ? "auto" : parseInt(c, 10));
|
|
589
590
|
const l = t.innerHTML.trim();
|
|
590
591
|
l && !this.config.detailRenderer && (d.detailRenderer = (u, h) => {
|
|
591
|
-
const f =
|
|
592
|
-
return
|
|
592
|
+
const f = I(l, { value: u, row: u });
|
|
593
|
+
return T(f);
|
|
593
594
|
}), Object.keys(d).length > 0 && (this.config = { ...this.config, ...d });
|
|
594
595
|
}
|
|
595
596
|
// #endregion
|
|
@@ -666,13 +667,13 @@ class v extends N {
|
|
|
666
667
|
return this.measuredDetailHeights.set(e, r), r;
|
|
667
668
|
}
|
|
668
669
|
const i = this.measuredDetailHeights.get(e);
|
|
669
|
-
return i && i > 0 ? i : typeof this.config?.detailHeight == "number" ? this.config.detailHeight :
|
|
670
|
+
return i && i > 0 ? i : typeof this.config?.detailHeight == "number" ? this.config.detailHeight : A.DEFAULT_DETAIL_HEIGHT;
|
|
670
671
|
}
|
|
671
672
|
/**
|
|
672
673
|
* Toggle a row's detail and emit event.
|
|
673
674
|
*/
|
|
674
675
|
toggleAndEmit(e, t) {
|
|
675
|
-
this.expandedRows =
|
|
676
|
+
this.expandedRows = R(this.expandedRows, e);
|
|
676
677
|
const i = this.expandedRows.has(e);
|
|
677
678
|
i && this.rowsToAnimate.add(e), this.emit("detail-expand", {
|
|
678
679
|
rowIndex: t,
|
|
@@ -693,9 +694,9 @@ class v extends N {
|
|
|
693
694
|
if (!(this.config.showExpandColumn === !0 || this.config.showExpandColumn !== !1 && !!this.config.detailRenderer))
|
|
694
695
|
return [...e];
|
|
695
696
|
const i = [...e];
|
|
696
|
-
if (
|
|
697
|
+
if (P(i))
|
|
697
698
|
return i;
|
|
698
|
-
const r =
|
|
699
|
+
const r = F(this.name);
|
|
699
700
|
return r.viewRenderer = (a) => {
|
|
700
701
|
const { row: o } = a, c = this.expandedRows.has(o), d = document.createElement("span");
|
|
701
702
|
d.className = "master-detail-expander expander-cell";
|
|
@@ -718,7 +719,7 @@ class v extends N {
|
|
|
718
719
|
onKeyDown(e) {
|
|
719
720
|
if (e.key !== " ") return;
|
|
720
721
|
const t = this.grid._focusCol, i = this.grid._focusRow, s = this.columns[t];
|
|
721
|
-
if (!s || !
|
|
722
|
+
if (!s || !v(s)) return;
|
|
722
723
|
const r = this.rows[i];
|
|
723
724
|
if (r)
|
|
724
725
|
return e.preventDefault(), this.toggleAndEmit(r, i), this.requestRenderWithFocus(), !0;
|
|
@@ -773,10 +774,10 @@ class v extends N {
|
|
|
773
774
|
f.previousElementSibling !== u && u.after(f);
|
|
774
775
|
continue;
|
|
775
776
|
}
|
|
776
|
-
const m =
|
|
777
|
+
const m = W(h, l, this.config.detailRenderer, a);
|
|
777
778
|
typeof this.config.detailHeight == "number" && (m.style.height = `${this.config.detailHeight}px`), u.after(m), this.detailElements.set(h, m);
|
|
778
|
-
const
|
|
779
|
-
|
|
779
|
+
const w = this.rowsToAnimate.has(h);
|
|
780
|
+
w && this.rowsToAnimate.delete(h), w && this.animateExpand(m, h, l) || requestAnimationFrame(() => {
|
|
780
781
|
this.#e(m, h, l);
|
|
781
782
|
});
|
|
782
783
|
}
|
|
@@ -859,7 +860,7 @@ class v extends N {
|
|
|
859
860
|
*/
|
|
860
861
|
expand(e) {
|
|
861
862
|
const t = this.rows[e];
|
|
862
|
-
t && (this.rowsToAnimate.add(t), this.expandedRows =
|
|
863
|
+
t && (this.rowsToAnimate.add(t), this.expandedRows = U(this.expandedRows, t), this.requestRender());
|
|
863
864
|
}
|
|
864
865
|
/**
|
|
865
866
|
* Collapse the detail row at the given index.
|
|
@@ -867,7 +868,7 @@ class v extends N {
|
|
|
867
868
|
*/
|
|
868
869
|
collapse(e) {
|
|
869
870
|
const t = this.rows[e];
|
|
870
|
-
t && (this.expandedRows =
|
|
871
|
+
t && (this.expandedRows = z(this.expandedRows, t), this.requestRender());
|
|
871
872
|
}
|
|
872
873
|
/**
|
|
873
874
|
* Toggle the detail row at the given index.
|
|
@@ -875,7 +876,7 @@ class v extends N {
|
|
|
875
876
|
*/
|
|
876
877
|
toggle(e) {
|
|
877
878
|
const t = this.rows[e];
|
|
878
|
-
t && (this.expandedRows =
|
|
879
|
+
t && (this.expandedRows = R(this.expandedRows, t), this.expandedRows.has(t) && this.rowsToAnimate.add(t), this.requestRender());
|
|
879
880
|
}
|
|
880
881
|
/**
|
|
881
882
|
* Check if the detail row at the given index is expanded.
|
|
@@ -884,7 +885,7 @@ class v extends N {
|
|
|
884
885
|
*/
|
|
885
886
|
isExpanded(e) {
|
|
886
887
|
const t = this.rows[e];
|
|
887
|
-
return t ?
|
|
888
|
+
return t ? G(this.expandedRows, t) : !1;
|
|
888
889
|
}
|
|
889
890
|
/**
|
|
890
891
|
* Expand all detail rows.
|
|
@@ -938,6 +939,6 @@ class v extends N {
|
|
|
938
939
|
// #endregion
|
|
939
940
|
}
|
|
940
941
|
export {
|
|
941
|
-
|
|
942
|
+
A as MasterDetailPlugin
|
|
942
943
|
};
|
|
943
944
|
//# sourceMappingURL=index.js.map
|