@toolbox-web/grid 1.2.0 → 1.3.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/README.md +80 -22
- package/all.js +619 -571
- package/all.js.map +1 -1
- package/index.js +362 -302
- package/index.js.map +1 -1
- package/lib/core/grid.d.ts +64 -1
- package/lib/core/grid.d.ts.map +1 -1
- package/lib/core/internal/row-animation.d.ts +37 -0
- package/lib/core/internal/row-animation.d.ts.map +1 -0
- package/lib/core/types.d.ts +17 -0
- package/lib/core/types.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.js +82 -76
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/clipboard/types.d.ts +1 -0
- package/lib/plugins/clipboard/types.d.ts.map +1 -1
- package/lib/plugins/column-virtualization/index.js +43 -41
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/context-menu/index.js +24 -22
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
- package/lib/plugins/editing/index.js +83 -52
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/export/index.js +22 -20
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/FilteringPlugin.d.ts +11 -1
- package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -1
- package/lib/plugins/filtering/index.js +160 -125
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/index.js +20 -18
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/index.js +66 -64
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/master-detail/index.js +51 -49
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/multi-sort/index.js +17 -15
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/index.js +24 -22
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-rows/index.js +25 -23
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pivot/index.js +49 -47
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/reorder/index.js +24 -22
- package/lib/plugins/reorder/index.js.map +1 -1
- package/lib/plugins/responsive/index.js +19 -17
- package/lib/plugins/responsive/index.js.map +1 -1
- package/lib/plugins/row-reorder/index.js +38 -36
- package/lib/plugins/row-reorder/index.js.map +1 -1
- package/lib/plugins/selection/SelectionPlugin.d.ts +13 -0
- package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
- package/lib/plugins/selection/index.d.ts +1 -1
- package/lib/plugins/selection/index.d.ts.map +1 -1
- package/lib/plugins/selection/index.js +118 -85
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/selection/types.d.ts +50 -6
- package/lib/plugins/selection/types.d.ts.map +1 -1
- package/lib/plugins/server-side/index.js +34 -32
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/tree/index.js +25 -23
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/undo-redo/index.js +22 -20
- package/lib/plugins/undo-redo/index.js.map +1 -1
- package/lib/plugins/visibility/index.js +21 -19
- package/lib/plugins/visibility/index.js.map +1 -1
- package/package.json +21 -4
- package/public.d.ts +1 -1
- package/public.d.ts.map +1 -1
- package/umd/grid.all.umd.js +19 -19
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +9 -9
- package/umd/grid.umd.js.map +1 -1
- package/umd/plugins/clipboard.umd.js +5 -5
- package/umd/plugins/clipboard.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 R = /{{\s*([^}]+)\s*}}/g, u = "__DG_EMPTY__", E = /^[\w$. '?+\-*/%:()!<>=,&|]+$/, v = /__(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/, y = /* @__PURE__ */ new Set([
|
|
2
2
|
"script",
|
|
3
3
|
"iframe",
|
|
4
4
|
"object",
|
|
@@ -23,23 +23,23 @@ const x = /{{\s*([^}]+)\s*}}/g, u = "__DG_EMPTY__", R = /^[\w$. '?+\-*/%:()!<>=,
|
|
|
23
23
|
"plaintext",
|
|
24
24
|
"xmp",
|
|
25
25
|
"listing"
|
|
26
|
-
]),
|
|
27
|
-
function
|
|
26
|
+
]), h = /^on\w+$/i, C = /* @__PURE__ */ new Set(["href", "src", "action", "formaction", "data", "srcdoc", "xlink:href", "poster", "srcset"]), _ = /^\s*(javascript|vbscript|data|blob):/i;
|
|
27
|
+
function A(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, D(e.content), e.innerHTML;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function D(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 (y.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
|
-
(r) =>
|
|
42
|
+
(r) => h.test(r.name) || r.name === "href" || r.name === "xlink:href"
|
|
43
43
|
)) {
|
|
44
44
|
e.push(i);
|
|
45
45
|
continue;
|
|
@@ -47,11 +47,11 @@ function A(n) {
|
|
|
47
47
|
const l = [];
|
|
48
48
|
for (const o of i.attributes) {
|
|
49
49
|
const r = o.name.toLowerCase();
|
|
50
|
-
if (
|
|
50
|
+
if (h.test(r)) {
|
|
51
51
|
l.push(o.name);
|
|
52
52
|
continue;
|
|
53
53
|
}
|
|
54
|
-
if (
|
|
54
|
+
if (C.has(r) && _.test(o.value)) {
|
|
55
55
|
l.push(o.name);
|
|
56
56
|
continue;
|
|
57
57
|
}
|
|
@@ -64,22 +64,22 @@ function A(n) {
|
|
|
64
64
|
}
|
|
65
65
|
e.forEach((i) => i.remove());
|
|
66
66
|
}
|
|
67
|
-
function
|
|
67
|
+
function S(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(R, (r, a) => {
|
|
70
|
+
const d = L(a, e);
|
|
71
71
|
return t.push({ expr: a.trim(), result: d }), d;
|
|
72
|
-
}), s =
|
|
72
|
+
}), s = I(i), l = t.length && t.every((r) => r.result === "" || r.result === u);
|
|
73
73
|
return /Reflect\.|\bProxy\b|ownKeys\(/.test(n) || l ? "" : s;
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function L(n, e) {
|
|
76
76
|
if (n = (n || "").trim(), !n || /\b(Reflect|Proxy|ownKeys)\b/.test(n)) return u;
|
|
77
77
|
if (n === "value") return e.value == null ? u : 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 ? u : String(s);
|
|
81
81
|
}
|
|
82
|
-
if (n.length > 80 || !
|
|
82
|
+
if (n.length > 80 || !E.test(n) || v.test(n)) return u;
|
|
83
83
|
const t = n.match(/\./g);
|
|
84
84
|
if (t && t.length > 1) return u;
|
|
85
85
|
try {
|
|
@@ -89,10 +89,10 @@ function S(n, e) {
|
|
|
89
89
|
return u;
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
-
function
|
|
92
|
+
function I(n) {
|
|
93
93
|
return n && n.replace(new RegExp(u, "g"), "").replace(/Reflect\.[^<>{}\s]+/g, "").replace(/\bProxy\b/g, "").replace(/ownKeys\([^)]*\)/g, "");
|
|
94
94
|
}
|
|
95
|
-
const
|
|
95
|
+
const g = '<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>', T = {
|
|
96
96
|
expand: "▶",
|
|
97
97
|
collapse: "▼",
|
|
98
98
|
sortAsc: "▲",
|
|
@@ -100,9 +100,11 @@ const I = {
|
|
|
100
100
|
sortNone: "⇅",
|
|
101
101
|
submenuArrow: "▶",
|
|
102
102
|
dragHandle: "⋮⋮",
|
|
103
|
-
toolPanel: "☰"
|
|
103
|
+
toolPanel: "☰",
|
|
104
|
+
filter: g,
|
|
105
|
+
filterActive: g
|
|
104
106
|
};
|
|
105
|
-
class
|
|
107
|
+
class H {
|
|
106
108
|
/**
|
|
107
109
|
* Plugin dependencies - declare other plugins this one requires.
|
|
108
110
|
*
|
|
@@ -326,7 +328,7 @@ class T {
|
|
|
326
328
|
*/
|
|
327
329
|
get gridIcons() {
|
|
328
330
|
const e = this.grid?.gridConfig?.icons ?? {};
|
|
329
|
-
return { ...
|
|
331
|
+
return { ...T, ...e };
|
|
330
332
|
}
|
|
331
333
|
// #region Animation Helpers
|
|
332
334
|
/**
|
|
@@ -402,19 +404,19 @@ class T {
|
|
|
402
404
|
}
|
|
403
405
|
// #endregion
|
|
404
406
|
}
|
|
405
|
-
const
|
|
406
|
-
function
|
|
407
|
-
return n.field ===
|
|
408
|
-
}
|
|
409
|
-
function k(n) {
|
|
410
|
-
return n.find(m);
|
|
407
|
+
const m = "__tbw_expander", k = 32;
|
|
408
|
+
function w(n) {
|
|
409
|
+
return n.field === m;
|
|
411
410
|
}
|
|
412
411
|
function O(n) {
|
|
412
|
+
return n.find(w);
|
|
413
|
+
}
|
|
414
|
+
function N(n) {
|
|
413
415
|
return {
|
|
414
|
-
field:
|
|
416
|
+
field: m,
|
|
415
417
|
header: "",
|
|
416
418
|
// No header text - visually merges with next column
|
|
417
|
-
width:
|
|
419
|
+
width: k,
|
|
418
420
|
resizable: !1,
|
|
419
421
|
sortable: !1,
|
|
420
422
|
filterable: !1,
|
|
@@ -429,22 +431,22 @@ function O(n) {
|
|
|
429
431
|
}
|
|
430
432
|
};
|
|
431
433
|
}
|
|
432
|
-
function
|
|
434
|
+
function p(n, e) {
|
|
433
435
|
const t = new Set(n);
|
|
434
436
|
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
435
437
|
}
|
|
436
|
-
function
|
|
438
|
+
function q(n, e) {
|
|
437
439
|
const t = new Set(n);
|
|
438
440
|
return t.add(e), t;
|
|
439
441
|
}
|
|
440
|
-
function
|
|
442
|
+
function P(n, e) {
|
|
441
443
|
const t = new Set(n);
|
|
442
444
|
return t.delete(e), t;
|
|
443
445
|
}
|
|
444
|
-
function
|
|
446
|
+
function M(n, e) {
|
|
445
447
|
return n.has(e);
|
|
446
448
|
}
|
|
447
|
-
function
|
|
449
|
+
function F(n, e, t, i) {
|
|
448
450
|
const s = document.createElement("div");
|
|
449
451
|
s.className = "master-detail-row", s.setAttribute("data-detail-for", String(e)), s.setAttribute("role", "row");
|
|
450
452
|
const l = document.createElement("div");
|
|
@@ -452,12 +454,12 @@ function M(n, e, t, i) {
|
|
|
452
454
|
const o = t(n, e);
|
|
453
455
|
return typeof o == "string" ? l.innerHTML = o : o instanceof HTMLElement && l.appendChild(o), s.appendChild(l), s;
|
|
454
456
|
}
|
|
455
|
-
const
|
|
456
|
-
class
|
|
457
|
+
const U = "@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}}}";
|
|
458
|
+
class b extends H {
|
|
457
459
|
/** @internal */
|
|
458
460
|
name = "masterDetail";
|
|
459
461
|
/** @internal */
|
|
460
|
-
styles =
|
|
462
|
+
styles = U;
|
|
461
463
|
/** @internal */
|
|
462
464
|
get defaultConfig() {
|
|
463
465
|
return {
|
|
@@ -519,8 +521,8 @@ class w extends T {
|
|
|
519
521
|
s !== null && (d.animation = s === "false" ? !1 : s), l !== null && (d.showExpandColumn = l !== "false"), o !== null && (d.expandOnRowClick = o === "true"), r !== null && (d.collapseOnClickOutside = r === "true"), a !== null && (d.detailHeight = a === "auto" ? "auto" : parseInt(a, 10));
|
|
520
522
|
const c = t.innerHTML.trim();
|
|
521
523
|
c && !this.config.detailRenderer && (d.detailRenderer = (f, G) => {
|
|
522
|
-
const
|
|
523
|
-
return
|
|
524
|
+
const x = S(c, { value: f, row: f });
|
|
525
|
+
return A(x);
|
|
524
526
|
}), Object.keys(d).length > 0 && (this.config = { ...this.config, ...d });
|
|
525
527
|
}
|
|
526
528
|
// #endregion
|
|
@@ -569,13 +571,13 @@ class w extends T {
|
|
|
569
571
|
*/
|
|
570
572
|
getDetailHeight(e) {
|
|
571
573
|
const t = this.detailElements.get(e);
|
|
572
|
-
return t ? t.offsetHeight : typeof this.config?.detailHeight == "number" ? this.config.detailHeight :
|
|
574
|
+
return t ? t.offsetHeight : typeof this.config?.detailHeight == "number" ? this.config.detailHeight : b.DEFAULT_DETAIL_HEIGHT;
|
|
573
575
|
}
|
|
574
576
|
/**
|
|
575
577
|
* Toggle a row's detail and emit event.
|
|
576
578
|
*/
|
|
577
579
|
toggleAndEmit(e, t) {
|
|
578
|
-
this.expandedRows =
|
|
580
|
+
this.expandedRows = p(this.expandedRows, e), this.emit("detail-expand", {
|
|
579
581
|
rowIndex: t,
|
|
580
582
|
row: e,
|
|
581
583
|
expanded: this.expandedRows.has(e)
|
|
@@ -594,9 +596,9 @@ class w extends T {
|
|
|
594
596
|
if (!(this.config.showExpandColumn === !0 || this.config.showExpandColumn !== !1 && !!this.config.detailRenderer))
|
|
595
597
|
return [...e];
|
|
596
598
|
const i = [...e];
|
|
597
|
-
if (
|
|
599
|
+
if (O(i))
|
|
598
600
|
return i;
|
|
599
|
-
const l =
|
|
601
|
+
const l = N(this.name);
|
|
600
602
|
return l.viewRenderer = (o) => {
|
|
601
603
|
const { row: r } = o, a = this.expandedRows.has(r), d = document.createElement("span");
|
|
602
604
|
d.className = "master-detail-expander expander-cell";
|
|
@@ -619,7 +621,7 @@ class w extends T {
|
|
|
619
621
|
onKeyDown(e) {
|
|
620
622
|
if (e.key !== " ") return;
|
|
621
623
|
const t = this.grid._focusCol, i = this.grid._focusRow, s = this.columns[t];
|
|
622
|
-
if (!s || !
|
|
624
|
+
if (!s || !w(s)) return;
|
|
623
625
|
const l = this.rows[i];
|
|
624
626
|
if (l)
|
|
625
627
|
return e.preventDefault(), this.toggleAndEmit(l, i), this.requestRenderWithFocus(), !0;
|
|
@@ -662,7 +664,7 @@ class w extends T {
|
|
|
662
664
|
d.previousElementSibling !== r && r.after(d);
|
|
663
665
|
continue;
|
|
664
666
|
}
|
|
665
|
-
const c =
|
|
667
|
+
const c = F(a, o, this.config.detailRenderer, s);
|
|
666
668
|
typeof this.config.detailHeight == "number" && (c.style.height = `${this.config.detailHeight}px`), r.after(c), this.detailElements.set(a, c), this.animateExpand(c);
|
|
667
669
|
}
|
|
668
670
|
}
|
|
@@ -715,7 +717,7 @@ class w extends T {
|
|
|
715
717
|
*/
|
|
716
718
|
expand(e) {
|
|
717
719
|
const t = this.rows[e];
|
|
718
|
-
t && (this.expandedRows =
|
|
720
|
+
t && (this.expandedRows = q(this.expandedRows, t), this.requestRender());
|
|
719
721
|
}
|
|
720
722
|
/**
|
|
721
723
|
* Collapse the detail row at the given index.
|
|
@@ -723,7 +725,7 @@ class w extends T {
|
|
|
723
725
|
*/
|
|
724
726
|
collapse(e) {
|
|
725
727
|
const t = this.rows[e];
|
|
726
|
-
t && (this.expandedRows =
|
|
728
|
+
t && (this.expandedRows = P(this.expandedRows, t), this.requestRender());
|
|
727
729
|
}
|
|
728
730
|
/**
|
|
729
731
|
* Toggle the detail row at the given index.
|
|
@@ -731,7 +733,7 @@ class w extends T {
|
|
|
731
733
|
*/
|
|
732
734
|
toggle(e) {
|
|
733
735
|
const t = this.rows[e];
|
|
734
|
-
t && (this.expandedRows =
|
|
736
|
+
t && (this.expandedRows = p(this.expandedRows, t), this.requestRender());
|
|
735
737
|
}
|
|
736
738
|
/**
|
|
737
739
|
* Check if the detail row at the given index is expanded.
|
|
@@ -740,7 +742,7 @@ class w extends T {
|
|
|
740
742
|
*/
|
|
741
743
|
isExpanded(e) {
|
|
742
744
|
const t = this.rows[e];
|
|
743
|
-
return t ?
|
|
745
|
+
return t ? M(this.expandedRows, t) : !1;
|
|
744
746
|
}
|
|
745
747
|
/**
|
|
746
748
|
* Expand all detail rows.
|
|
@@ -794,6 +796,6 @@ class w extends T {
|
|
|
794
796
|
// #endregion
|
|
795
797
|
}
|
|
796
798
|
export {
|
|
797
|
-
|
|
799
|
+
b as MasterDetailPlugin
|
|
798
800
|
};
|
|
799
801
|
//# sourceMappingURL=index.js.map
|