@toolbox-web/grid 1.12.0 → 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 +694 -525
- package/all.js.map +1 -1
- package/index.js +1468 -1449
- package/index.js.map +1 -1
- package/lib/core/grid.d.ts +2 -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 +9 -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/ContextMenuPlugin.d.ts.map +1 -1
- package/lib/plugins/context-menu/index.js +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/GroupingColumnsPlugin.d.ts +8 -1
- package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts.map +1 -1
- package/lib/plugins/grouping-columns/index.js +59 -60
- 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/MasterDetailPlugin.d.ts +7 -0
- package/lib/plugins/master-detail/MasterDetailPlugin.d.ts.map +1 -1
- package/lib/plugins/master-detail/index.js +185 -145
- 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 +43 -43
- 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/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/umd/plugins/grouping-columns.umd.js +1 -1
- package/umd/plugins/grouping-columns.umd.js.map +1 -1
- package/umd/plugins/master-detail.umd.js +1 -1
- package/umd/plugins/master-detail.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 y = /{{\s*([^}]+)\s*}}/g, u = "__DG_EMPTY__", _ = /^[\w$. '?+\-*/%:()!<>=,&|]+$/, C = /__(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/, E = /* @__PURE__ */ new Set([
|
|
2
2
|
"script",
|
|
3
3
|
"iframe",
|
|
4
4
|
"object",
|
|
@@ -23,23 +23,23 @@ const R = /{{\s*([^}]+)\s*}}/g, u = "__DG_EMPTY__", y = /^[\w$. '?+\-*/%:()!<>=,
|
|
|
23
23
|
"plaintext",
|
|
24
24
|
"xmp",
|
|
25
25
|
"listing"
|
|
26
|
-
]),
|
|
27
|
-
function
|
|
26
|
+
]), v = /^on\w+$/i, A = /* @__PURE__ */ new Set(["href", "src", "action", "formaction", "data", "srcdoc", "xlink:href", "poster", "srcset"]), S = /^\s*(javascript|vbscript|data|blob):/i;
|
|
27
|
+
function k(r) {
|
|
28
28
|
if (!r || typeof r != "string") return "";
|
|
29
29
|
if (r.indexOf("<") === -1) return r;
|
|
30
30
|
const t = document.createElement("template");
|
|
31
|
-
return t.innerHTML = r,
|
|
31
|
+
return t.innerHTML = r, H(t.content), t.innerHTML;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function H(r) {
|
|
34
34
|
const t = [], e = r.querySelectorAll("*");
|
|
35
35
|
for (const i of e) {
|
|
36
36
|
const n = i.tagName.toLowerCase();
|
|
37
|
-
if (
|
|
37
|
+
if (E.has(n)) {
|
|
38
38
|
t.push(i);
|
|
39
39
|
continue;
|
|
40
40
|
}
|
|
41
41
|
if ((n === "svg" || i.namespaceURI === "http://www.w3.org/2000/svg") && Array.from(i.attributes).some(
|
|
42
|
-
(o) =>
|
|
42
|
+
(o) => v.test(o.name) || o.name === "href" || o.name === "xlink:href"
|
|
43
43
|
)) {
|
|
44
44
|
t.push(i);
|
|
45
45
|
continue;
|
|
@@ -47,11 +47,11 @@ function k(r) {
|
|
|
47
47
|
const a = [];
|
|
48
48
|
for (const s of i.attributes) {
|
|
49
49
|
const o = s.name.toLowerCase();
|
|
50
|
-
if (
|
|
50
|
+
if (v.test(o)) {
|
|
51
51
|
a.push(s.name);
|
|
52
52
|
continue;
|
|
53
53
|
}
|
|
54
|
-
if (
|
|
54
|
+
if (A.has(o) && S.test(s.value)) {
|
|
55
55
|
a.push(s.name);
|
|
56
56
|
continue;
|
|
57
57
|
}
|
|
@@ -64,41 +64,42 @@ function k(r) {
|
|
|
64
64
|
}
|
|
65
65
|
t.forEach((i) => i.remove());
|
|
66
66
|
}
|
|
67
|
-
function
|
|
67
|
+
function T(r, t) {
|
|
68
68
|
if (!r || r.indexOf("{{") === -1) return r;
|
|
69
|
-
const e = [], i = r.replace(
|
|
70
|
-
const l =
|
|
69
|
+
const e = [], i = r.replace(y, (o, c) => {
|
|
70
|
+
const l = L(c, t);
|
|
71
71
|
return e.push({ expr: c.trim(), result: l }), l;
|
|
72
|
-
}), n =
|
|
73
|
-
return
|
|
72
|
+
}), n = x(i), a = e.length && e.every((o) => o.result === "" || o.result === u);
|
|
73
|
+
return m.test(r) || a ? "" : n;
|
|
74
74
|
}
|
|
75
|
-
function
|
|
76
|
-
if (r = (r || "").trim(), !r ||
|
|
75
|
+
function L(r, t) {
|
|
76
|
+
if (r = (r || "").trim(), !r || m.test(r)) return u;
|
|
77
77
|
if (r === "value") return t.value == null ? u : String(t.value);
|
|
78
78
|
if (r.startsWith("row.") && !/[()?]/.test(r) && !r.includes(":")) {
|
|
79
79
|
const i = r.slice(4), n = t.row ? t.row[i] : void 0;
|
|
80
80
|
return n == null ? u : String(n);
|
|
81
81
|
}
|
|
82
|
-
if (r.length > 80 || !
|
|
82
|
+
if (r.length > 80 || !_.test(r) || C.test(r)) return u;
|
|
83
83
|
const e = r.match(/\./g);
|
|
84
84
|
if (e && e.length > 1) return u;
|
|
85
85
|
try {
|
|
86
86
|
const n = new Function("value", "row", `return (${r});`)(t.value, t.row), a = n == null ? "" : String(n);
|
|
87
|
-
return
|
|
87
|
+
return m.test(a) ? u : a || u;
|
|
88
88
|
} catch {
|
|
89
89
|
return u;
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
-
|
|
93
|
-
return r && r.replace(new RegExp(u, "g"), "").replace(/Reflect\.[^<>{}\s]+/g, "").replace(/\bProxy\b/g, "").replace(/ownKeys\([^)]*\)/g, "");
|
|
94
|
-
}
|
|
92
|
+
const m = /Reflect|Proxy|ownKeys/;
|
|
95
93
|
function x(r) {
|
|
94
|
+
return r && r.replace(new RegExp(u, "g"), "").replace(/Reflect\.[^<>{}\s]+|\bProxy\b|ownKeys\([^)]*\)/g, "");
|
|
95
|
+
}
|
|
96
|
+
function M(r) {
|
|
96
97
|
r && r.querySelectorAll(".cell-focus").forEach((t) => t.classList.remove("cell-focus"));
|
|
97
98
|
}
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
const
|
|
101
|
-
|
|
99
|
+
const D = 'input,select,textarea,[contenteditable="true"],[contenteditable=""],[tabindex]:not([tabindex="-1"])', q = document.createElement("template");
|
|
100
|
+
q.innerHTML = '<div class="cell" role="gridcell" part="cell"></div>';
|
|
101
|
+
const N = document.createElement("template");
|
|
102
|
+
N.innerHTML = '<div class="data-grid-row" role="row" part="row"></div>';
|
|
102
103
|
function g(r, t) {
|
|
103
104
|
if (r._virtualization?.enabled) {
|
|
104
105
|
const { rowHeight: s, container: o, viewportEl: c } = r._virtualization, l = o, h = c?.clientHeight ?? l?.clientHeight ?? 0;
|
|
@@ -108,7 +109,7 @@ function g(r, t) {
|
|
|
108
109
|
}
|
|
109
110
|
}
|
|
110
111
|
const e = r._activeEditRows !== void 0 && r._activeEditRows !== -1;
|
|
111
|
-
e || r.refreshVirtualWindow(!1),
|
|
112
|
+
e || r.refreshVirtualWindow(!1), M(r._bodyEl), Array.from(r._bodyEl.querySelectorAll('[aria-selected="true"]')).forEach((s) => {
|
|
112
113
|
s.setAttribute("aria-selected", "false");
|
|
113
114
|
});
|
|
114
115
|
const i = r._focusRow, n = r._virtualization.start ?? 0, a = r._virtualization.end ?? r._rows.length;
|
|
@@ -121,12 +122,12 @@ function g(r, t) {
|
|
|
121
122
|
if (c && o && (!e || t?.forceHorizontalScroll)) {
|
|
122
123
|
const l = r._getHorizontalScrollOffsets?.(s ?? void 0, o) ?? { left: 0, right: 0 };
|
|
123
124
|
if (!l.skipScroll) {
|
|
124
|
-
const h = o.getBoundingClientRect(), d = c.getBoundingClientRect(), f = h.left - d.left + c.scrollLeft, w = f + h.width, p = c.scrollLeft + l.left,
|
|
125
|
-
f < p ? c.scrollLeft = f - l.left : w >
|
|
125
|
+
const h = o.getBoundingClientRect(), d = c.getBoundingClientRect(), f = h.left - d.left + c.scrollLeft, w = f + h.width, p = c.scrollLeft + l.left, R = c.scrollLeft + c.clientWidth - l.right;
|
|
126
|
+
f < p ? c.scrollLeft = f - l.left : w > R && (c.scrollLeft = w - c.clientWidth + l.right);
|
|
126
127
|
}
|
|
127
128
|
}
|
|
128
129
|
if (r._activeEditRows !== void 0 && r._activeEditRows !== -1 && o.classList.contains("editing")) {
|
|
129
|
-
const l = o.querySelector(
|
|
130
|
+
const l = o.querySelector(D);
|
|
130
131
|
if (l && document.activeElement !== l)
|
|
131
132
|
try {
|
|
132
133
|
l.focus({ preventScroll: !0 });
|
|
@@ -142,7 +143,7 @@ function g(r, t) {
|
|
|
142
143
|
}
|
|
143
144
|
}
|
|
144
145
|
}
|
|
145
|
-
const
|
|
146
|
+
const b = '<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>', I = {
|
|
146
147
|
expand: "▶",
|
|
147
148
|
collapse: "▼",
|
|
148
149
|
sortAsc: "▲",
|
|
@@ -151,11 +152,11 @@ const v = '<svg viewBox="0 0 16 16" width="12" height="12"><path fill="currentCo
|
|
|
151
152
|
submenuArrow: "▶",
|
|
152
153
|
dragHandle: "⋮⋮",
|
|
153
154
|
toolPanel: "☰",
|
|
154
|
-
filter:
|
|
155
|
-
filterActive:
|
|
155
|
+
filter: b,
|
|
156
|
+
filterActive: b,
|
|
156
157
|
print: "🖨️"
|
|
157
158
|
};
|
|
158
|
-
class
|
|
159
|
+
class z {
|
|
159
160
|
/**
|
|
160
161
|
* Plugin dependencies - declare other plugins this one requires.
|
|
161
162
|
*
|
|
@@ -445,7 +446,7 @@ class P {
|
|
|
445
446
|
*/
|
|
446
447
|
get gridIcons() {
|
|
447
448
|
const t = this.grid?.gridConfig?.icons ?? {};
|
|
448
|
-
return { ...
|
|
449
|
+
return { ...I, ...t };
|
|
449
450
|
}
|
|
450
451
|
// #region Animation Helpers
|
|
451
452
|
/**
|
|
@@ -521,11 +522,11 @@ class P {
|
|
|
521
522
|
}
|
|
522
523
|
// #endregion
|
|
523
524
|
}
|
|
524
|
-
const
|
|
525
|
-
class
|
|
525
|
+
const B = 'tbw-grid[data-responsive-animate] .data-grid-row,tbw-grid[data-responsive-animate] .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}tbw-grid[data-responsive] .footer-row{display:none}tbw-grid[data-responsive] .tbw-scroll-area{overflow-x:hidden;min-width:0!important}tbw-grid[data-responsive] .rows-body-wrapper{min-width:0!important}tbw-grid[data-responsive] .data-grid-row:not(.group-row){display:block!important;grid-template-columns:none!important;padding:var(--tbw-cell-padding);padding-inline-start: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}tbw-grid[data-responsive] .data-grid-row:not(.group-row):nth-child(2n){background:var(--tbw-color-row-alt)}tbw-grid[data-responsive] .data-grid-row:not(.group-row):hover{background:var(--tbw-color-row-hover)}tbw-grid[data-responsive] .data-grid-row:not(.group-row)[aria-selected=true]{background:var(--tbw-color-selection)}tbw-grid[data-responsive] .data-grid-row:not(.group-row)[aria-selected=true]:before{content:"";position:absolute;inset-inline-start:0;top:0;bottom:0;width:4px;background:var(--tbw-color-accent)}tbw-grid[data-responsive] .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-inline-end:none!important;background:transparent!important;white-space:normal!important;overflow:visible!important}tbw-grid[data-responsive] .data-grid-row:not(.group-row)>.cell:before{content:attr(data-header) ": ";font-weight:600;color:var(--tbw-color-header-fg);flex-shrink:0;margin-inline-end:var(--tbw-spacing-md);min-width:100px}tbw-grid[data-responsive] .data-grid-row:not(.group-row)>.cell:after{content:none}tbw-grid[data-responsive] .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]{justify-content:flex-start!important;font-weight:500}tbw-grid[data-responsive] .cell[data-responsive-value-only]:before{display:none!important}tbw-grid:not([data-responsive]) .cell[data-responsive-hidden]{display:none!important}tbw-grid[data-responsive] .tbw-footer,tbw-grid[data-responsive] .tbw-pinned-rows,tbw-grid[data-responsive] .tbw-aggregation-rows{display:none!important}tbw-grid[data-responsive] .tbw-pinned-rows,tbw-grid[data-responsive] .tbw-aggregation-rows,tbw-grid[data-responsive] .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)}tbw-grid[data-responsive] .data-grid-row.responsive-card>*{width:100%}tbw-grid[data-responsive] .data-grid-row.responsive-card .cell:before{display:none}';
|
|
526
|
+
class G extends z {
|
|
526
527
|
name = "responsive";
|
|
527
528
|
version = "1.0.0";
|
|
528
|
-
styles =
|
|
529
|
+
styles = B;
|
|
529
530
|
/**
|
|
530
531
|
* Plugin manifest declaring incompatibilities with other plugins.
|
|
531
532
|
*/
|
|
@@ -656,7 +657,7 @@ class z extends P {
|
|
|
656
657
|
}
|
|
657
658
|
const h = e.innerHTML.trim();
|
|
658
659
|
h && !this.config.cardRenderer && !i.__frameworkAdapter?.parseResponsiveCardElement && (l.cardRenderer = (d) => {
|
|
659
|
-
const f =
|
|
660
|
+
const f = T(h, { value: d, row: d }), w = k(f), p = document.createElement("div");
|
|
660
661
|
return p.className = "tbw-responsive-card-content", p.innerHTML = w, p;
|
|
661
662
|
}), Object.keys(l).length > 0 && (this.config = { ...this.config, ...l });
|
|
662
663
|
}
|
|
@@ -963,6 +964,6 @@ class z extends P {
|
|
|
963
964
|
}
|
|
964
965
|
}
|
|
965
966
|
export {
|
|
966
|
-
|
|
967
|
+
G as ResponsivePlugin
|
|
967
968
|
};
|
|
968
969
|
//# sourceMappingURL=index.js.map
|