@toolbox-web/grid-react 2.0.0-rc.1 → 2.0.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/chunks/feature-registry-8K2rOVnC.js +2 -0
- package/chunks/grid-detail-panel-CLdX0T_A.js +44 -0
- package/chunks/grid-element-context-DpuQsoie.js +5 -0
- package/chunks/grid-responsive-card-Dx5U6Prm.js +41 -0
- package/chunks/portal-bridge-zxgm_jwK.js +60 -0
- package/chunks/post-mount-refresh-hooks-D7BDK4Kl.js +10 -0
- package/chunks/react-column-config-Cto2WHGC.js +126 -0
- package/chunks/react-grid-adapter-CZfpPJvo.js +308 -0
- package/features/editing.js +6 -4
- package/features/export.js +44 -59
- package/features/filtering.js +82 -132
- package/features/grouping-columns.js +24 -24
- package/features/grouping-rows.js +14 -17
- package/features/index.js +18 -20
- package/features/master-detail.js +48 -63
- package/features/pinned-rows.js +58 -51
- package/features/print.js +18 -23
- package/features/responsive.js +51 -63
- package/features/selection.js +47 -45
- package/features/undo-redo.js +53 -86
- package/index.js +591 -655
- package/package.json +2 -2
- package/chunks/grid-detail-panel-BZFcujsZ.js +0 -52
- package/chunks/grid-element-context-BU3WvNtM.js +0 -5
- package/chunks/grid-responsive-card-CSZhDCoN.js +0 -45
- package/chunks/portal-bridge-CvxNt40O.js +0 -68
- package/chunks/post-mount-refresh-hooks-Dt7mPoZC.js +0 -12
- package/chunks/react-column-config-BOe_PgL1.js +0 -125
- package/chunks/react-grid-adapter-BhC9x425.js +0 -518
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toolbox-web/grid-react",
|
|
3
|
-
"version": "2.0.0
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "React adapter for @toolbox-web/grid data grid component",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -65,6 +65,6 @@
|
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"react": ">=18.0.0",
|
|
67
67
|
"react-dom": ">=18.0.0",
|
|
68
|
-
"@toolbox-web/grid": "^3.0.0
|
|
68
|
+
"@toolbox-web/grid": "^3.0.0"
|
|
69
69
|
}
|
|
70
70
|
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { jsx as g } from "react/jsx-runtime";
|
|
2
|
-
import { useRef as u, useCallback as b, useEffect as m } from "react";
|
|
3
|
-
const o = /* @__PURE__ */ new WeakMap(), s = /* @__PURE__ */ new Map();
|
|
4
|
-
function x(r) {
|
|
5
|
-
const i = r.querySelector("tbw-grid-detail");
|
|
6
|
-
if (i) {
|
|
7
|
-
const n = o.get(i);
|
|
8
|
-
if (n) return n;
|
|
9
|
-
}
|
|
10
|
-
const d = r.id || r.getAttribute("data-grid-id");
|
|
11
|
-
if (d)
|
|
12
|
-
return s.get(d);
|
|
13
|
-
}
|
|
14
|
-
function p(r) {
|
|
15
|
-
const { children: i, showExpandColumn: d = !0, animation: n = "slide" } = r, l = u(null), f = b(
|
|
16
|
-
(t) => {
|
|
17
|
-
if (l.current = t, !t) return;
|
|
18
|
-
o.set(t, i);
|
|
19
|
-
const e = t.closest("tbw-grid, [data-tbw-grid]");
|
|
20
|
-
if (e) {
|
|
21
|
-
const a = e.id || e.getAttribute("data-grid-id");
|
|
22
|
-
a && s.set(a, i);
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
[i]
|
|
26
|
-
);
|
|
27
|
-
return m(() => () => {
|
|
28
|
-
const t = l.current;
|
|
29
|
-
if (t) {
|
|
30
|
-
o.delete(t);
|
|
31
|
-
const e = t.closest("tbw-grid, [data-tbw-grid]");
|
|
32
|
-
if (e) {
|
|
33
|
-
const c = e.id || e.getAttribute("data-grid-id");
|
|
34
|
-
c && s.delete(c);
|
|
35
|
-
}
|
|
36
|
-
const a = t.parentNode;
|
|
37
|
-
a && a.contains(t);
|
|
38
|
-
}
|
|
39
|
-
}, []), /* @__PURE__ */ g(
|
|
40
|
-
"tbw-grid-detail",
|
|
41
|
-
{
|
|
42
|
-
ref: f,
|
|
43
|
-
showExpandColumn: d ? void 0 : "false",
|
|
44
|
-
animation: n === !1 ? "false" : n
|
|
45
|
-
}
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
p.displayName = "GridDetailPanel";
|
|
49
|
-
export {
|
|
50
|
-
p as G,
|
|
51
|
-
x as g
|
|
52
|
-
};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
-
import { useRef as f, useCallback as l, useEffect as p } from "react";
|
|
3
|
-
const o = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new Map();
|
|
4
|
-
function v(i) {
|
|
5
|
-
const r = i.querySelector("tbw-grid-responsive-card");
|
|
6
|
-
if (r) {
|
|
7
|
-
const s = o.get(r);
|
|
8
|
-
if (s) return s;
|
|
9
|
-
}
|
|
10
|
-
const d = i.id || i.getAttribute("data-grid-id");
|
|
11
|
-
if (d)
|
|
12
|
-
return a.get(d);
|
|
13
|
-
}
|
|
14
|
-
function b(i) {
|
|
15
|
-
const { children: r, cardRowHeight: d = "auto" } = i, s = f(null), c = l(
|
|
16
|
-
(t) => {
|
|
17
|
-
if (s.current = t, !t) return;
|
|
18
|
-
o.set(t, r);
|
|
19
|
-
const e = t.closest("tbw-grid, [data-tbw-grid]");
|
|
20
|
-
if (e) {
|
|
21
|
-
const n = e.id || e.getAttribute("data-grid-id");
|
|
22
|
-
n && a.set(n, r);
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
[r]
|
|
26
|
-
);
|
|
27
|
-
p(() => () => {
|
|
28
|
-
const t = s.current;
|
|
29
|
-
if (t) {
|
|
30
|
-
o.delete(t);
|
|
31
|
-
const e = t.closest("tbw-grid, [data-tbw-grid]");
|
|
32
|
-
if (e) {
|
|
33
|
-
const n = e.id || e.getAttribute("data-grid-id");
|
|
34
|
-
n && a.delete(n);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}, []);
|
|
38
|
-
const g = d === "auto" ? "auto" : String(d);
|
|
39
|
-
return /* @__PURE__ */ u("tbw-grid-responsive-card", { ref: c, cardRowHeight: g });
|
|
40
|
-
}
|
|
41
|
-
b.displayName = "GridResponsiveCard";
|
|
42
|
-
export {
|
|
43
|
-
b as G,
|
|
44
|
-
v as g
|
|
45
|
-
};
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { flushSync as d } from "react-dom";
|
|
2
|
-
import { createRoot as p } from "react-dom/client";
|
|
3
|
-
const o = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
|
|
4
|
-
let m = 0;
|
|
5
|
-
function B(t, e) {
|
|
6
|
-
e ? o.set(t, e) : o.delete(t);
|
|
7
|
-
}
|
|
8
|
-
function g(t, e) {
|
|
9
|
-
if (e) return e;
|
|
10
|
-
const n = t.closest("tbw-grid, [data-tbw-grid]");
|
|
11
|
-
if (n) return n;
|
|
12
|
-
if (o.size === 1) return o.keys().next().value;
|
|
13
|
-
}
|
|
14
|
-
function u(t) {
|
|
15
|
-
const e = i.get(t);
|
|
16
|
-
if (e) {
|
|
17
|
-
try {
|
|
18
|
-
e.unmount();
|
|
19
|
-
} catch {
|
|
20
|
-
}
|
|
21
|
-
i.delete(t);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
function v(t, e, n, r) {
|
|
25
|
-
const s = n ?? `p-${m++}`, a = g(t, r), l = a ? o.get(a) : void 0;
|
|
26
|
-
if (l)
|
|
27
|
-
u(s), a && f.set(s, a), l.renderPortal(s, t, e);
|
|
28
|
-
else {
|
|
29
|
-
let c = i.get(s);
|
|
30
|
-
c || (c = p(t), i.set(s, c)), d(() => c.render(e));
|
|
31
|
-
}
|
|
32
|
-
return s;
|
|
33
|
-
}
|
|
34
|
-
function w(t, e) {
|
|
35
|
-
const n = f.get(t);
|
|
36
|
-
(n ? o.get(n) : void 0)?.removePortal(t, e?.sync), f.delete(t), u(t);
|
|
37
|
-
}
|
|
38
|
-
function M(t) {
|
|
39
|
-
if (t) {
|
|
40
|
-
o.get(t)?.beginBatch();
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
for (const e of o.values()) e.beginBatch();
|
|
44
|
-
}
|
|
45
|
-
function y(t) {
|
|
46
|
-
if (t) {
|
|
47
|
-
o.get(t)?.endBatch();
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
for (const e of o.values()) e.endBatch();
|
|
51
|
-
}
|
|
52
|
-
function P(t) {
|
|
53
|
-
return (e) => {
|
|
54
|
-
const n = t(e);
|
|
55
|
-
if (n == null || n === !1) return null;
|
|
56
|
-
if (n instanceof HTMLElement) return n;
|
|
57
|
-
const r = document.createElement("div");
|
|
58
|
-
return r.style.display = "contents", v(r, n), r;
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
export {
|
|
62
|
-
v as a,
|
|
63
|
-
M as b,
|
|
64
|
-
P as c,
|
|
65
|
-
y as e,
|
|
66
|
-
w as r,
|
|
67
|
-
B as s
|
|
68
|
-
};
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import { a as i, r as f } from "./portal-bridge-CvxNt40O.js";
|
|
2
|
-
const y = [];
|
|
3
|
-
function H(e) {
|
|
4
|
-
y.push(e);
|
|
5
|
-
}
|
|
6
|
-
function R(e, n) {
|
|
7
|
-
const r = [];
|
|
8
|
-
for (const t of y) {
|
|
9
|
-
const o = t({ container: e, gridEl: n });
|
|
10
|
-
o && r.push(o);
|
|
11
|
-
}
|
|
12
|
-
return () => {
|
|
13
|
-
for (const t of r) t();
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
const l = /* @__PURE__ */ Symbol("reactProcessed"), s = /* @__PURE__ */ new Map();
|
|
17
|
-
function K(e) {
|
|
18
|
-
const n = e.querySelectorAll(".react-cell-editor, .react-cell-renderer");
|
|
19
|
-
for (const r of n) {
|
|
20
|
-
const t = s.get(r);
|
|
21
|
-
t && (t.unsub?.(), f(t.key, { sync: !0 }), s.delete(r));
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
function u(e) {
|
|
25
|
-
const n = document.createElement("div");
|
|
26
|
-
return n.className = e, n.style.display = "contents", n;
|
|
27
|
-
}
|
|
28
|
-
function L(e) {
|
|
29
|
-
return () => {
|
|
30
|
-
const n = e.ownerDocument.activeElement;
|
|
31
|
-
n && e.contains(n) && (n instanceof HTMLInputElement || n instanceof HTMLTextAreaElement || n instanceof HTMLSelectElement) && n.blur();
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
function E(e) {
|
|
35
|
-
const n = /* @__PURE__ */ new WeakMap();
|
|
36
|
-
return (r) => {
|
|
37
|
-
const t = r.cellEl;
|
|
38
|
-
if (t) {
|
|
39
|
-
const a = n.get(t);
|
|
40
|
-
if (a) {
|
|
41
|
-
if (t.contains(a.container))
|
|
42
|
-
return i(a.container, e(r), a.portalKey), a.container;
|
|
43
|
-
f(a.portalKey, { sync: !0 }), n.delete(t);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
const o = u("react-cell-renderer"), c = i(o, e(r));
|
|
47
|
-
return t && n.set(t, { portalKey: c, container: o }), s.set(o, { key: c }), o;
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
function w(e) {
|
|
51
|
-
return (n) => {
|
|
52
|
-
const r = u("react-cell-editor"), o = { key: i(r, e(n)) };
|
|
53
|
-
return s.set(r, o), queueMicrotask(() => {
|
|
54
|
-
const c = r.closest("tbw-grid, [data-tbw-grid]");
|
|
55
|
-
c && (o.unsub = R(r, c));
|
|
56
|
-
}), r;
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
function k(e) {
|
|
60
|
-
return (n) => {
|
|
61
|
-
const r = u("react-header-renderer"), t = i(r, e(n));
|
|
62
|
-
return s.set(r, { key: t }), r;
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
function h(e) {
|
|
66
|
-
return (n) => {
|
|
67
|
-
const r = u("react-header-label-renderer"), t = i(r, e(n));
|
|
68
|
-
return s.set(r, { key: t }), r;
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
function M(e) {
|
|
72
|
-
return (n) => {
|
|
73
|
-
const r = e(n);
|
|
74
|
-
if (r instanceof HTMLElement || typeof r == "string")
|
|
75
|
-
return r;
|
|
76
|
-
const t = u("react-loading-renderer"), o = i(t, r);
|
|
77
|
-
return s.set(t, { key: o }), t;
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
function b(e) {
|
|
81
|
-
return (n) => {
|
|
82
|
-
const r = e(n);
|
|
83
|
-
if (r instanceof HTMLElement || typeof r == "string")
|
|
84
|
-
return r;
|
|
85
|
-
const t = u("react-empty-renderer"), o = i(t, r);
|
|
86
|
-
return s.set(t, { key: o }), t;
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
function T(e) {
|
|
90
|
-
if (!e) return;
|
|
91
|
-
if (e[l]) return e;
|
|
92
|
-
if (e.loadingRenderer && typeof e.loadingRenderer == "function") {
|
|
93
|
-
const t = e.loadingRenderer;
|
|
94
|
-
e = {
|
|
95
|
-
...e,
|
|
96
|
-
loadingRenderer: M(t)
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
if (e.emptyRenderer && typeof e.emptyRenderer == "function") {
|
|
100
|
-
const t = e.emptyRenderer;
|
|
101
|
-
e = {
|
|
102
|
-
...e,
|
|
103
|
-
emptyRenderer: b(t)
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
if (!e.columns) {
|
|
107
|
-
const t = e;
|
|
108
|
-
return t[l] = !0, t;
|
|
109
|
-
}
|
|
110
|
-
const n = e.columns.map((t) => {
|
|
111
|
-
const { renderer: o, editor: c, headerRenderer: a, headerLabelRenderer: p, ...m } = t, d = { ...m };
|
|
112
|
-
return o && (d.renderer = E(o)), c && (d.editor = w(c)), a && (d.headerRenderer = k(a)), p && (d.headerLabelRenderer = h(p)), d;
|
|
113
|
-
}), r = {
|
|
114
|
-
...e,
|
|
115
|
-
columns: n
|
|
116
|
-
};
|
|
117
|
-
return r[l] = !0, r;
|
|
118
|
-
}
|
|
119
|
-
export {
|
|
120
|
-
K as c,
|
|
121
|
-
L as m,
|
|
122
|
-
R as n,
|
|
123
|
-
T as p,
|
|
124
|
-
H as r
|
|
125
|
-
};
|