@toolbox-web/grid 1.3.0 → 1.4.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.d.ts +1 -0
- package/all.d.ts.map +1 -1
- package/all.js +997 -710
- package/all.js.map +1 -1
- package/index.js +642 -599
- package/index.js.map +1 -1
- package/lib/core/grid.d.ts.map +1 -1
- package/lib/core/internal/header.d.ts +7 -0
- package/lib/core/internal/header.d.ts.map +1 -1
- package/lib/core/types.d.ts +151 -0
- package/lib/core/types.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.js +19 -16
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/column-virtualization/index.js +42 -39
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/context-menu/index.js +25 -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 +53 -48
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/export/index.js +23 -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 +186 -150
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/index.js +21 -18
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/index.js +67 -64
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/master-detail/index.js +52 -49
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/multi-sort/index.js +18 -15
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/index.js +25 -22
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-rows/index.js +26 -23
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pivot/index.js +50 -47
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/print/PrintPlugin.d.ts +98 -0
- package/lib/plugins/print/PrintPlugin.d.ts.map +1 -0
- package/lib/plugins/print/index.d.ts +10 -0
- package/lib/plugins/print/index.d.ts.map +1 -0
- package/lib/plugins/print/index.js +626 -0
- package/lib/plugins/print/index.js.map +1 -0
- package/lib/plugins/print/print-isolated.d.ts +26 -0
- package/lib/plugins/print/print-isolated.d.ts.map +1 -0
- package/lib/plugins/print/types.d.ts +147 -0
- package/lib/plugins/print/types.d.ts.map +1 -0
- package/lib/plugins/reorder/index.js +25 -22
- package/lib/plugins/reorder/index.js.map +1 -1
- package/lib/plugins/responsive/index.js +20 -17
- package/lib/plugins/responsive/index.js.map +1 -1
- package/lib/plugins/row-reorder/index.js +39 -36
- package/lib/plugins/row-reorder/index.js.map +1 -1
- package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
- package/lib/plugins/selection/index.js +115 -101
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/server-side/index.js +35 -32
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/tree/index.js +26 -23
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/undo-redo/index.js +23 -20
- package/lib/plugins/undo-redo/index.js.map +1 -1
- package/lib/plugins/visibility/index.js +22 -19
- package/lib/plugins/visibility/index.js.map +1 -1
- package/package.json +1 -1
- package/public.d.ts +1 -1
- package/public.d.ts.map +1 -1
- package/umd/grid.all.umd.js +98 -24
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +11 -11
- 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/print.umd.js +76 -0
- package/umd/plugins/print.umd.js.map +1 -0
- 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,12 @@ const I = {
|
|
|
100
100
|
sortNone: "⇅",
|
|
101
101
|
submenuArrow: "▶",
|
|
102
102
|
dragHandle: "⋮⋮",
|
|
103
|
-
toolPanel: "☰"
|
|
103
|
+
toolPanel: "☰",
|
|
104
|
+
filter: g,
|
|
105
|
+
filterActive: g,
|
|
106
|
+
print: "🖨️"
|
|
104
107
|
};
|
|
105
|
-
class
|
|
108
|
+
class H {
|
|
106
109
|
/**
|
|
107
110
|
* Plugin dependencies - declare other plugins this one requires.
|
|
108
111
|
*
|
|
@@ -326,7 +329,7 @@ class T {
|
|
|
326
329
|
*/
|
|
327
330
|
get gridIcons() {
|
|
328
331
|
const e = this.grid?.gridConfig?.icons ?? {};
|
|
329
|
-
return { ...
|
|
332
|
+
return { ...T, ...e };
|
|
330
333
|
}
|
|
331
334
|
// #region Animation Helpers
|
|
332
335
|
/**
|
|
@@ -402,19 +405,19 @@ class T {
|
|
|
402
405
|
}
|
|
403
406
|
// #endregion
|
|
404
407
|
}
|
|
405
|
-
const
|
|
406
|
-
function
|
|
407
|
-
return n.field ===
|
|
408
|
-
}
|
|
409
|
-
function k(n) {
|
|
410
|
-
return n.find(m);
|
|
408
|
+
const m = "__tbw_expander", k = 32;
|
|
409
|
+
function w(n) {
|
|
410
|
+
return n.field === m;
|
|
411
411
|
}
|
|
412
412
|
function O(n) {
|
|
413
|
+
return n.find(w);
|
|
414
|
+
}
|
|
415
|
+
function N(n) {
|
|
413
416
|
return {
|
|
414
|
-
field:
|
|
417
|
+
field: m,
|
|
415
418
|
header: "",
|
|
416
419
|
// No header text - visually merges with next column
|
|
417
|
-
width:
|
|
420
|
+
width: k,
|
|
418
421
|
resizable: !1,
|
|
419
422
|
sortable: !1,
|
|
420
423
|
filterable: !1,
|
|
@@ -429,22 +432,22 @@ function O(n) {
|
|
|
429
432
|
}
|
|
430
433
|
};
|
|
431
434
|
}
|
|
432
|
-
function
|
|
435
|
+
function p(n, e) {
|
|
433
436
|
const t = new Set(n);
|
|
434
437
|
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
435
438
|
}
|
|
436
|
-
function
|
|
439
|
+
function q(n, e) {
|
|
437
440
|
const t = new Set(n);
|
|
438
441
|
return t.add(e), t;
|
|
439
442
|
}
|
|
440
|
-
function
|
|
443
|
+
function P(n, e) {
|
|
441
444
|
const t = new Set(n);
|
|
442
445
|
return t.delete(e), t;
|
|
443
446
|
}
|
|
444
|
-
function
|
|
447
|
+
function M(n, e) {
|
|
445
448
|
return n.has(e);
|
|
446
449
|
}
|
|
447
|
-
function
|
|
450
|
+
function F(n, e, t, i) {
|
|
448
451
|
const s = document.createElement("div");
|
|
449
452
|
s.className = "master-detail-row", s.setAttribute("data-detail-for", String(e)), s.setAttribute("role", "row");
|
|
450
453
|
const l = document.createElement("div");
|
|
@@ -452,12 +455,12 @@ function M(n, e, t, i) {
|
|
|
452
455
|
const o = t(n, e);
|
|
453
456
|
return typeof o == "string" ? l.innerHTML = o : o instanceof HTMLElement && l.appendChild(o), s.appendChild(l), s;
|
|
454
457
|
}
|
|
455
|
-
const
|
|
456
|
-
class
|
|
458
|
+
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}}}";
|
|
459
|
+
class b extends H {
|
|
457
460
|
/** @internal */
|
|
458
461
|
name = "masterDetail";
|
|
459
462
|
/** @internal */
|
|
460
|
-
styles =
|
|
463
|
+
styles = U;
|
|
461
464
|
/** @internal */
|
|
462
465
|
get defaultConfig() {
|
|
463
466
|
return {
|
|
@@ -519,8 +522,8 @@ class w extends T {
|
|
|
519
522
|
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
523
|
const c = t.innerHTML.trim();
|
|
521
524
|
c && !this.config.detailRenderer && (d.detailRenderer = (f, G) => {
|
|
522
|
-
const
|
|
523
|
-
return
|
|
525
|
+
const x = S(c, { value: f, row: f });
|
|
526
|
+
return A(x);
|
|
524
527
|
}), Object.keys(d).length > 0 && (this.config = { ...this.config, ...d });
|
|
525
528
|
}
|
|
526
529
|
// #endregion
|
|
@@ -569,13 +572,13 @@ class w extends T {
|
|
|
569
572
|
*/
|
|
570
573
|
getDetailHeight(e) {
|
|
571
574
|
const t = this.detailElements.get(e);
|
|
572
|
-
return t ? t.offsetHeight : typeof this.config?.detailHeight == "number" ? this.config.detailHeight :
|
|
575
|
+
return t ? t.offsetHeight : typeof this.config?.detailHeight == "number" ? this.config.detailHeight : b.DEFAULT_DETAIL_HEIGHT;
|
|
573
576
|
}
|
|
574
577
|
/**
|
|
575
578
|
* Toggle a row's detail and emit event.
|
|
576
579
|
*/
|
|
577
580
|
toggleAndEmit(e, t) {
|
|
578
|
-
this.expandedRows =
|
|
581
|
+
this.expandedRows = p(this.expandedRows, e), this.emit("detail-expand", {
|
|
579
582
|
rowIndex: t,
|
|
580
583
|
row: e,
|
|
581
584
|
expanded: this.expandedRows.has(e)
|
|
@@ -594,9 +597,9 @@ class w extends T {
|
|
|
594
597
|
if (!(this.config.showExpandColumn === !0 || this.config.showExpandColumn !== !1 && !!this.config.detailRenderer))
|
|
595
598
|
return [...e];
|
|
596
599
|
const i = [...e];
|
|
597
|
-
if (
|
|
600
|
+
if (O(i))
|
|
598
601
|
return i;
|
|
599
|
-
const l =
|
|
602
|
+
const l = N(this.name);
|
|
600
603
|
return l.viewRenderer = (o) => {
|
|
601
604
|
const { row: r } = o, a = this.expandedRows.has(r), d = document.createElement("span");
|
|
602
605
|
d.className = "master-detail-expander expander-cell";
|
|
@@ -619,7 +622,7 @@ class w extends T {
|
|
|
619
622
|
onKeyDown(e) {
|
|
620
623
|
if (e.key !== " ") return;
|
|
621
624
|
const t = this.grid._focusCol, i = this.grid._focusRow, s = this.columns[t];
|
|
622
|
-
if (!s || !
|
|
625
|
+
if (!s || !w(s)) return;
|
|
623
626
|
const l = this.rows[i];
|
|
624
627
|
if (l)
|
|
625
628
|
return e.preventDefault(), this.toggleAndEmit(l, i), this.requestRenderWithFocus(), !0;
|
|
@@ -662,7 +665,7 @@ class w extends T {
|
|
|
662
665
|
d.previousElementSibling !== r && r.after(d);
|
|
663
666
|
continue;
|
|
664
667
|
}
|
|
665
|
-
const c =
|
|
668
|
+
const c = F(a, o, this.config.detailRenderer, s);
|
|
666
669
|
typeof this.config.detailHeight == "number" && (c.style.height = `${this.config.detailHeight}px`), r.after(c), this.detailElements.set(a, c), this.animateExpand(c);
|
|
667
670
|
}
|
|
668
671
|
}
|
|
@@ -715,7 +718,7 @@ class w extends T {
|
|
|
715
718
|
*/
|
|
716
719
|
expand(e) {
|
|
717
720
|
const t = this.rows[e];
|
|
718
|
-
t && (this.expandedRows =
|
|
721
|
+
t && (this.expandedRows = q(this.expandedRows, t), this.requestRender());
|
|
719
722
|
}
|
|
720
723
|
/**
|
|
721
724
|
* Collapse the detail row at the given index.
|
|
@@ -723,7 +726,7 @@ class w extends T {
|
|
|
723
726
|
*/
|
|
724
727
|
collapse(e) {
|
|
725
728
|
const t = this.rows[e];
|
|
726
|
-
t && (this.expandedRows =
|
|
729
|
+
t && (this.expandedRows = P(this.expandedRows, t), this.requestRender());
|
|
727
730
|
}
|
|
728
731
|
/**
|
|
729
732
|
* Toggle the detail row at the given index.
|
|
@@ -731,7 +734,7 @@ class w extends T {
|
|
|
731
734
|
*/
|
|
732
735
|
toggle(e) {
|
|
733
736
|
const t = this.rows[e];
|
|
734
|
-
t && (this.expandedRows =
|
|
737
|
+
t && (this.expandedRows = p(this.expandedRows, t), this.requestRender());
|
|
735
738
|
}
|
|
736
739
|
/**
|
|
737
740
|
* Check if the detail row at the given index is expanded.
|
|
@@ -740,7 +743,7 @@ class w extends T {
|
|
|
740
743
|
*/
|
|
741
744
|
isExpanded(e) {
|
|
742
745
|
const t = this.rows[e];
|
|
743
|
-
return t ?
|
|
746
|
+
return t ? M(this.expandedRows, t) : !1;
|
|
744
747
|
}
|
|
745
748
|
/**
|
|
746
749
|
* Expand all detail rows.
|
|
@@ -794,6 +797,6 @@ class w extends T {
|
|
|
794
797
|
// #endregion
|
|
795
798
|
}
|
|
796
799
|
export {
|
|
797
|
-
|
|
800
|
+
b as MasterDetailPlugin
|
|
798
801
|
};
|
|
799
802
|
//# sourceMappingURL=index.js.map
|