@toolbox-web/grid-react 1.6.1 → 1.8.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/README.md +12 -10
- package/chunks/{grid-detail-panel-CR7YUhdN.js → grid-detail-panel-BZFcujsZ.js} +10 -10
- package/chunks/grid-responsive-card-CSZhDCoN.js +45 -0
- package/chunks/portal-bridge-CvxNt40O.js +68 -0
- package/chunks/post-mount-refresh-hooks-Dt7mPoZC.js +12 -0
- package/chunks/{react-column-config-Dz234dN8.js → react-column-config-BOe_PgL1.js} +28 -28
- package/chunks/{react-grid-adapter-KD5roD6F.js → react-grid-adapter-LBf2Mqhn.js} +108 -69
- package/features/editing.js +1 -1
- package/features/filtering.js +3 -3
- package/features/grouping-columns.js +1 -1
- package/features/grouping-rows.js +1 -1
- package/features/index.d.ts.map +1 -1
- package/features/index.js +1 -0
- package/features/master-detail.js +17 -13
- package/features/pinned-rows.d.ts +46 -0
- package/features/pinned-rows.d.ts.map +1 -1
- package/features/pinned-rows.js +49 -20
- package/features/reorder-rows.d.ts.map +1 -1
- package/features/responsive.js +22 -14
- package/features/row-drag-drop.js +1 -0
- package/features/sticky-rows.d.ts +1 -0
- package/features/sticky-rows.d.ts.map +1 -0
- package/features/sticky-rows.js +1 -0
- package/index.d.ts +5 -1
- package/index.d.ts.map +1 -1
- package/index.js +467 -408
- package/lib/child-feature-detector.d.ts +33 -0
- package/lib/child-feature-detector.d.ts.map +1 -0
- package/lib/data-grid.d.ts.map +1 -1
- package/lib/event-props.d.ts +22 -1
- package/lib/event-props.d.ts.map +1 -1
- package/lib/feature-prop-keys.d.ts +27 -0
- package/lib/feature-prop-keys.d.ts.map +1 -0
- package/lib/feature-props.d.ts +52 -3
- package/lib/feature-props.d.ts.map +1 -1
- package/lib/feature-registry.d.ts +3 -3
- package/lib/feature-registry.d.ts.map +1 -1
- package/lib/grid-header-content.d.ts +41 -0
- package/lib/grid-header-content.d.ts.map +1 -0
- package/lib/grid-toolbar-content.d.ts +44 -0
- package/lib/grid-toolbar-content.d.ts.map +1 -0
- package/lib/post-mount-refresh-hooks.d.ts +49 -0
- package/lib/post-mount-refresh-hooks.d.ts.map +1 -0
- package/lib/react-grid-adapter.d.ts +6 -0
- package/lib/react-grid-adapter.d.ts.map +1 -1
- package/lib/use-grid-overlay.d.ts +1 -1
- package/package.json +1 -1
- package/chunks/grid-responsive-card-BB28Zl2O.js +0 -45
- package/chunks/portal-bridge-BydpO5wl.js +0 -68
package/README.md
CHANGED
|
@@ -640,16 +640,18 @@ Inject custom CSS into the grid:
|
|
|
640
640
|
|
|
641
641
|
### Exported Components
|
|
642
642
|
|
|
643
|
-
| Component
|
|
644
|
-
|
|
|
645
|
-
| `DataGrid`
|
|
646
|
-
| `GridColumn`
|
|
647
|
-
| `GridDetailPanel`
|
|
648
|
-
| `GridToolPanel`
|
|
649
|
-
| `
|
|
650
|
-
| `
|
|
651
|
-
| `
|
|
652
|
-
| `
|
|
643
|
+
| Component | Description |
|
|
644
|
+
| -------------------- | -------------------------------------------- |
|
|
645
|
+
| `DataGrid` | Main grid component wrapper |
|
|
646
|
+
| `GridColumn` | Declarative column with render props |
|
|
647
|
+
| `GridDetailPanel` | Master-detail expandable panel |
|
|
648
|
+
| `GridToolPanel` | Custom sidebar panel |
|
|
649
|
+
| `GridHeaderContent` | Inject React content into shell header zone |
|
|
650
|
+
| `GridToolbarContent` | Inject React content into shell toolbar zone |
|
|
651
|
+
| `GridToolButtons` | Toolbar button container |
|
|
652
|
+
| `GridProvider` | Combined provider for icons & type defaults |
|
|
653
|
+
| `GridTypeProvider` | App-level type defaults context |
|
|
654
|
+
| `GridIconProvider` | App-level icon overrides context |
|
|
653
655
|
|
|
654
656
|
### Exported Hooks
|
|
655
657
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useRef as
|
|
1
|
+
import { jsx as g } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as u, useCallback as b, useEffect as m } from "react";
|
|
3
3
|
const o = /* @__PURE__ */ new WeakMap(), s = /* @__PURE__ */ new Map();
|
|
4
4
|
function x(r) {
|
|
5
5
|
const i = r.querySelector("tbw-grid-detail");
|
|
@@ -11,12 +11,12 @@ function x(r) {
|
|
|
11
11
|
if (d)
|
|
12
12
|
return s.get(d);
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
const { children: i, showExpandColumn: d = !0, animation: n = "slide" } = r, l =
|
|
14
|
+
function p(r) {
|
|
15
|
+
const { children: i, showExpandColumn: d = !0, animation: n = "slide" } = r, l = u(null), f = b(
|
|
16
16
|
(t) => {
|
|
17
17
|
if (l.current = t, !t) return;
|
|
18
18
|
o.set(t, i);
|
|
19
|
-
const e = t.closest("tbw-grid");
|
|
19
|
+
const e = t.closest("tbw-grid, [data-tbw-grid]");
|
|
20
20
|
if (e) {
|
|
21
21
|
const a = e.id || e.getAttribute("data-grid-id");
|
|
22
22
|
a && s.set(a, i);
|
|
@@ -24,11 +24,11 @@ function b(r) {
|
|
|
24
24
|
},
|
|
25
25
|
[i]
|
|
26
26
|
);
|
|
27
|
-
return
|
|
27
|
+
return m(() => () => {
|
|
28
28
|
const t = l.current;
|
|
29
29
|
if (t) {
|
|
30
30
|
o.delete(t);
|
|
31
|
-
const e = t.closest("tbw-grid");
|
|
31
|
+
const e = t.closest("tbw-grid, [data-tbw-grid]");
|
|
32
32
|
if (e) {
|
|
33
33
|
const c = e.id || e.getAttribute("data-grid-id");
|
|
34
34
|
c && s.delete(c);
|
|
@@ -36,7 +36,7 @@ function b(r) {
|
|
|
36
36
|
const a = t.parentNode;
|
|
37
37
|
a && a.contains(t);
|
|
38
38
|
}
|
|
39
|
-
}, []), /* @__PURE__ */
|
|
39
|
+
}, []), /* @__PURE__ */ g(
|
|
40
40
|
"tbw-grid-detail",
|
|
41
41
|
{
|
|
42
42
|
ref: f,
|
|
@@ -45,8 +45,8 @@ function b(r) {
|
|
|
45
45
|
}
|
|
46
46
|
);
|
|
47
47
|
}
|
|
48
|
-
|
|
48
|
+
p.displayName = "GridDetailPanel";
|
|
49
49
|
export {
|
|
50
|
-
|
|
50
|
+
p as G,
|
|
51
51
|
x as g
|
|
52
52
|
};
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
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,4 +1,4 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as i, r as f } from "./portal-bridge-CvxNt40O.js";
|
|
2
2
|
const y = [];
|
|
3
3
|
function H(e) {
|
|
4
4
|
y.push(e);
|
|
@@ -13,15 +13,15 @@ function R(e, n) {
|
|
|
13
13
|
for (const t of r) t();
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
|
-
const l = /* @__PURE__ */ Symbol("reactProcessed"),
|
|
16
|
+
const l = /* @__PURE__ */ Symbol("reactProcessed"), s = /* @__PURE__ */ new Map();
|
|
17
17
|
function K(e) {
|
|
18
18
|
const n = e.querySelectorAll(".react-cell-editor, .react-cell-renderer");
|
|
19
19
|
for (const r of n) {
|
|
20
|
-
const t =
|
|
21
|
-
t && (t.unsub?.(), f(t.key, { sync: !0 }),
|
|
20
|
+
const t = s.get(r);
|
|
21
|
+
t && (t.unsub?.(), f(t.key, { sync: !0 }), s.delete(r));
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function u(e) {
|
|
25
25
|
const n = document.createElement("div");
|
|
26
26
|
return n.className = e, n.style.display = "contents", n;
|
|
27
27
|
}
|
|
@@ -36,36 +36,36 @@ function E(e) {
|
|
|
36
36
|
return (r) => {
|
|
37
37
|
const t = r.cellEl;
|
|
38
38
|
if (t) {
|
|
39
|
-
const
|
|
40
|
-
if (
|
|
41
|
-
if (t.contains(
|
|
42
|
-
return
|
|
43
|
-
f(
|
|
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
44
|
}
|
|
45
45
|
}
|
|
46
|
-
const o =
|
|
47
|
-
return t && n.set(t, { portalKey:
|
|
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
48
|
};
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function w(e) {
|
|
51
51
|
return (n) => {
|
|
52
|
-
const r =
|
|
53
|
-
return
|
|
54
|
-
const
|
|
55
|
-
|
|
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
56
|
}), r;
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function k(e) {
|
|
60
60
|
return (n) => {
|
|
61
|
-
const r =
|
|
62
|
-
return
|
|
61
|
+
const r = u("react-header-renderer"), t = i(r, e(n));
|
|
62
|
+
return s.set(r, { key: t }), r;
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
65
|
function h(e) {
|
|
66
66
|
return (n) => {
|
|
67
|
-
const r =
|
|
68
|
-
return
|
|
67
|
+
const r = u("react-header-label-renderer"), t = i(r, e(n));
|
|
68
|
+
return s.set(r, { key: t }), r;
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
71
|
function M(e) {
|
|
@@ -73,8 +73,8 @@ function M(e) {
|
|
|
73
73
|
const r = e(n);
|
|
74
74
|
if (r instanceof HTMLElement || typeof r == "string")
|
|
75
75
|
return r;
|
|
76
|
-
const t =
|
|
77
|
-
return
|
|
76
|
+
const t = u("react-loading-renderer"), o = i(t, r);
|
|
77
|
+
return s.set(t, { key: o }), t;
|
|
78
78
|
};
|
|
79
79
|
}
|
|
80
80
|
function b(e) {
|
|
@@ -82,8 +82,8 @@ function b(e) {
|
|
|
82
82
|
const r = e(n);
|
|
83
83
|
if (r instanceof HTMLElement || typeof r == "string")
|
|
84
84
|
return r;
|
|
85
|
-
const t =
|
|
86
|
-
return
|
|
85
|
+
const t = u("react-empty-renderer"), o = i(t, r);
|
|
86
|
+
return s.set(t, { key: o }), t;
|
|
87
87
|
};
|
|
88
88
|
}
|
|
89
89
|
function T(e) {
|
|
@@ -108,8 +108,8 @@ function T(e) {
|
|
|
108
108
|
return t[l] = !0, t;
|
|
109
109
|
}
|
|
110
110
|
const n = e.columns.map((t) => {
|
|
111
|
-
const { renderer: o, editor:
|
|
112
|
-
return o && (d.renderer = E(o)),
|
|
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
113
|
}), r = {
|
|
114
114
|
...e,
|
|
115
115
|
columns: n
|
|
@@ -1,26 +1,63 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { a as u, r as g, b as
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { useRef as w, useCallback as K, useEffect as T } from "react";
|
|
2
|
+
import { p as E, n as k, c as B } from "./react-column-config-BOe_PgL1.js";
|
|
3
|
+
import { jsx as D } from "react/jsx-runtime";
|
|
4
|
+
import { a as u, r as g, b as M, e as A } from "./portal-bridge-CvxNt40O.js";
|
|
5
|
+
const h = /* @__PURE__ */ new Set();
|
|
6
|
+
let p = null;
|
|
7
|
+
function S(o) {
|
|
8
|
+
h.has(o) || (h.add(o), p = null);
|
|
9
|
+
}
|
|
10
|
+
function j() {
|
|
11
|
+
return p === null && (p = Object.freeze(Array.from(h))), p;
|
|
12
|
+
}
|
|
13
|
+
const F = [
|
|
14
|
+
"selection",
|
|
15
|
+
"editing",
|
|
16
|
+
"filtering",
|
|
17
|
+
"multiSort",
|
|
18
|
+
"clipboard",
|
|
19
|
+
"contextMenu",
|
|
20
|
+
"reorderColumns",
|
|
21
|
+
// @deprecated v1.x — remove in `@toolbox-web/grid-react` 2.0.0 (gh #261 / #263). Superseded by `rowDragDrop`.
|
|
22
|
+
"reorderRows",
|
|
23
|
+
"rowDragDrop",
|
|
24
|
+
"visibility",
|
|
25
|
+
"undoRedo",
|
|
26
|
+
"tree",
|
|
27
|
+
"groupingRows",
|
|
28
|
+
"groupingColumns",
|
|
29
|
+
"pinnedColumns",
|
|
30
|
+
"pinnedRows",
|
|
31
|
+
"masterDetail",
|
|
32
|
+
"responsive",
|
|
33
|
+
"columnVirtualization",
|
|
34
|
+
"export",
|
|
35
|
+
"print",
|
|
36
|
+
"pivot",
|
|
37
|
+
"serverSide",
|
|
38
|
+
"tooltip"
|
|
39
|
+
];
|
|
40
|
+
for (const o of F)
|
|
41
|
+
S(o);
|
|
42
|
+
const P = /* @__PURE__ */ new WeakMap(), b = /* @__PURE__ */ new Map();
|
|
43
|
+
function U(o) {
|
|
44
|
+
const e = P.get(o);
|
|
8
45
|
if (e) return e;
|
|
9
46
|
const t = o.id;
|
|
10
47
|
if (t)
|
|
11
|
-
return
|
|
48
|
+
return b.get(t);
|
|
12
49
|
}
|
|
13
|
-
function
|
|
14
|
-
const { id: e, title: t, icon: r, tooltip: n, order: s = 100, children: i } = o, l =
|
|
50
|
+
function z(o) {
|
|
51
|
+
const { id: e, title: t, icon: r, tooltip: n, order: s = 100, children: i } = o, l = w(null), y = K(
|
|
15
52
|
(a) => {
|
|
16
|
-
l.current = a, a && (
|
|
53
|
+
l.current = a, a && (P.set(a, i), e && b.set(e, i));
|
|
17
54
|
},
|
|
18
55
|
[i, e]
|
|
19
56
|
);
|
|
20
|
-
return
|
|
57
|
+
return T(() => () => {
|
|
21
58
|
const a = l.current;
|
|
22
|
-
a && (
|
|
23
|
-
}, [e]), /* @__PURE__ */
|
|
59
|
+
a && (P.delete(a), e && b.delete(e));
|
|
60
|
+
}, [e]), /* @__PURE__ */ D(
|
|
24
61
|
"tbw-grid-tool-panel",
|
|
25
62
|
{
|
|
26
63
|
ref: y,
|
|
@@ -32,48 +69,48 @@ function W(o) {
|
|
|
32
69
|
}
|
|
33
70
|
);
|
|
34
71
|
}
|
|
35
|
-
let
|
|
36
|
-
function
|
|
37
|
-
|
|
72
|
+
let C = null, m = null, R = null;
|
|
73
|
+
function O(o) {
|
|
74
|
+
C = o;
|
|
38
75
|
}
|
|
39
|
-
function
|
|
40
|
-
|
|
76
|
+
function q(o) {
|
|
77
|
+
m = o;
|
|
41
78
|
}
|
|
42
|
-
function
|
|
43
|
-
|
|
79
|
+
function H(o) {
|
|
80
|
+
R = o;
|
|
44
81
|
}
|
|
45
|
-
const
|
|
46
|
-
function
|
|
47
|
-
const t = o.getAttribute("field"), r =
|
|
48
|
-
if (r.renderer = e,
|
|
49
|
-
const n =
|
|
50
|
-
n.renderer = e,
|
|
82
|
+
const d = /* @__PURE__ */ new WeakMap(), c = /* @__PURE__ */ new Map();
|
|
83
|
+
function L(o, e) {
|
|
84
|
+
const t = o.getAttribute("field"), r = d.get(o) ?? {};
|
|
85
|
+
if (r.renderer = e, d.set(o, r), t) {
|
|
86
|
+
const n = c.get(t) ?? {};
|
|
87
|
+
n.renderer = e, c.set(t, n);
|
|
51
88
|
}
|
|
52
89
|
}
|
|
53
|
-
function
|
|
54
|
-
const t = o.getAttribute("field"), r =
|
|
55
|
-
if (r.editor = e,
|
|
56
|
-
const n =
|
|
57
|
-
n.editor = e,
|
|
90
|
+
function V(o, e) {
|
|
91
|
+
const t = o.getAttribute("field"), r = d.get(o) ?? {};
|
|
92
|
+
if (r.editor = e, d.set(o, r), t) {
|
|
93
|
+
const n = c.get(t) ?? {};
|
|
94
|
+
n.editor = e, c.set(t, n);
|
|
58
95
|
}
|
|
59
96
|
}
|
|
60
|
-
function
|
|
61
|
-
let e =
|
|
97
|
+
function x(o) {
|
|
98
|
+
let e = d.get(o)?.renderer;
|
|
62
99
|
if (!e) {
|
|
63
100
|
const t = o.getAttribute("field");
|
|
64
|
-
t && (e =
|
|
101
|
+
t && (e = c.get(t)?.renderer);
|
|
65
102
|
}
|
|
66
103
|
return e;
|
|
67
104
|
}
|
|
68
|
-
function
|
|
69
|
-
let e =
|
|
105
|
+
function G(o) {
|
|
106
|
+
let e = d.get(o)?.editor;
|
|
70
107
|
if (!e) {
|
|
71
108
|
const t = o.getAttribute("field");
|
|
72
|
-
t && (e =
|
|
109
|
+
t && (e = c.get(t)?.editor);
|
|
73
110
|
}
|
|
74
111
|
return e;
|
|
75
112
|
}
|
|
76
|
-
class
|
|
113
|
+
class Y {
|
|
77
114
|
/** Portal keys for all managed portals (for cleanup on destroy). */
|
|
78
115
|
allPortalKeys = /* @__PURE__ */ new Set();
|
|
79
116
|
/** Portal keys for editor-specific portals (for per-cell cleanup via releaseCell). */
|
|
@@ -128,7 +165,7 @@ class z {
|
|
|
128
165
|
* Converts React renderer/editor functions to DOM-returning functions.
|
|
129
166
|
*/
|
|
130
167
|
processConfig(e) {
|
|
131
|
-
return
|
|
168
|
+
return E(e) ?? e;
|
|
132
169
|
}
|
|
133
170
|
/**
|
|
134
171
|
* Determines if this adapter can handle the given element.
|
|
@@ -136,10 +173,10 @@ class z {
|
|
|
136
173
|
*/
|
|
137
174
|
canHandle(e) {
|
|
138
175
|
const t = e.getAttribute("field");
|
|
139
|
-
let r =
|
|
176
|
+
let r = d.get(e);
|
|
140
177
|
if (!r && t) {
|
|
141
|
-
const i =
|
|
142
|
-
i && (i.renderer || i.editor) && (r = i,
|
|
178
|
+
const i = c.get(t);
|
|
179
|
+
i && (i.renderer || i.editor) && (r = i, d.set(e, r));
|
|
143
180
|
}
|
|
144
181
|
const n = r?.renderer !== void 0, s = r?.editor !== void 0;
|
|
145
182
|
return r !== void 0 && (n || s);
|
|
@@ -156,10 +193,10 @@ class z {
|
|
|
156
193
|
* allowing the grid to use its default rendering.
|
|
157
194
|
*/
|
|
158
195
|
createRenderer(e) {
|
|
159
|
-
const t =
|
|
196
|
+
const t = x(e);
|
|
160
197
|
if (!t)
|
|
161
198
|
return;
|
|
162
|
-
const r = e.closest("tbw-grid"), n = /* @__PURE__ */ new WeakMap();
|
|
199
|
+
const r = e.closest("tbw-grid, [data-tbw-grid]"), n = /* @__PURE__ */ new WeakMap();
|
|
163
200
|
return (s) => {
|
|
164
201
|
const i = s.cellEl;
|
|
165
202
|
if (i) {
|
|
@@ -171,13 +208,13 @@ class z {
|
|
|
171
208
|
}
|
|
172
209
|
const f = document.createElement("div");
|
|
173
210
|
f.className = "react-cell-renderer", f.style.display = "contents";
|
|
174
|
-
const
|
|
211
|
+
const v = u(
|
|
175
212
|
f,
|
|
176
213
|
t(s),
|
|
177
214
|
void 0,
|
|
178
215
|
r ?? void 0
|
|
179
216
|
);
|
|
180
|
-
return n.set(i, { portalKey:
|
|
217
|
+
return n.set(i, { portalKey: v, container: f }), this.trackPortal(v, f, !1), f;
|
|
181
218
|
}
|
|
182
219
|
const l = document.createElement("div");
|
|
183
220
|
l.className = "react-cell-renderer", l.style.display = "contents";
|
|
@@ -195,10 +232,10 @@ class z {
|
|
|
195
232
|
* with commit/cancel callbacks passed as props.
|
|
196
233
|
*/
|
|
197
234
|
createEditor(e) {
|
|
198
|
-
const t =
|
|
235
|
+
const t = G(e);
|
|
199
236
|
if (!t)
|
|
200
237
|
return () => document.createElement("div");
|
|
201
|
-
const r = e.closest("tbw-grid") ?? void 0;
|
|
238
|
+
const r = e.closest("tbw-grid, [data-tbw-grid]") ?? void 0;
|
|
202
239
|
return (n) => {
|
|
203
240
|
const s = document.createElement("div");
|
|
204
241
|
s.className = "react-cell-editor", s.style.display = "contents";
|
|
@@ -208,7 +245,7 @@ class z {
|
|
|
208
245
|
void 0,
|
|
209
246
|
r
|
|
210
247
|
);
|
|
211
|
-
return this.trackPortal(i, s, !0), r && this.editorBeforeCloseUnsubs.set(i,
|
|
248
|
+
return this.trackPortal(i, s, !0), r && this.editorBeforeCloseUnsubs.set(i, k(s, r)), s;
|
|
212
249
|
};
|
|
213
250
|
}
|
|
214
251
|
/**
|
|
@@ -219,14 +256,14 @@ class z {
|
|
|
219
256
|
* was registered for this grid.
|
|
220
257
|
*/
|
|
221
258
|
createDetailRenderer(e) {
|
|
222
|
-
return
|
|
259
|
+
return C?.(e, this.bridgeContext);
|
|
223
260
|
}
|
|
224
261
|
/**
|
|
225
262
|
* Framework adapter hook called by MasterDetailPlugin during attach().
|
|
226
263
|
* Parses the <tbw-grid-detail> element and returns a React-based renderer.
|
|
227
264
|
*/
|
|
228
265
|
parseDetailElement(e) {
|
|
229
|
-
const t = e.closest("tbw-grid");
|
|
266
|
+
const t = e.closest("tbw-grid, [data-tbw-grid]");
|
|
230
267
|
if (t)
|
|
231
268
|
return this.createDetailRenderer(t);
|
|
232
269
|
}
|
|
@@ -238,7 +275,7 @@ class z {
|
|
|
238
275
|
* was registered for this grid.
|
|
239
276
|
*/
|
|
240
277
|
createResponsiveCardRenderer(e) {
|
|
241
|
-
return
|
|
278
|
+
return m?.(e, this.bridgeContext);
|
|
242
279
|
}
|
|
243
280
|
/**
|
|
244
281
|
* FrameworkAdapter hook called by ResponsivePlugin during attach().
|
|
@@ -249,7 +286,7 @@ class z {
|
|
|
249
286
|
* `refreshResponsiveCardRenderer` hook in DataGrid.
|
|
250
287
|
*/
|
|
251
288
|
parseResponsiveCardElement(e) {
|
|
252
|
-
const t = e.closest("tbw-grid");
|
|
289
|
+
const t = e.closest("tbw-grid, [data-tbw-grid]");
|
|
253
290
|
if (t)
|
|
254
291
|
return this.createResponsiveCardRenderer(t);
|
|
255
292
|
}
|
|
@@ -258,10 +295,10 @@ class z {
|
|
|
258
295
|
* Renders React components into tool panel containers.
|
|
259
296
|
*/
|
|
260
297
|
createToolPanelRenderer(e) {
|
|
261
|
-
const t =
|
|
298
|
+
const t = U(e);
|
|
262
299
|
if (!t)
|
|
263
300
|
return;
|
|
264
|
-
const r = e.closest("tbw-grid");
|
|
301
|
+
const r = e.closest("tbw-grid, [data-tbw-grid]");
|
|
265
302
|
return (n) => {
|
|
266
303
|
const i = u(n, t({
|
|
267
304
|
grid: r ?? n
|
|
@@ -304,7 +341,7 @@ class z {
|
|
|
304
341
|
const n = {
|
|
305
342
|
editorParams: r.editorParams
|
|
306
343
|
};
|
|
307
|
-
return r.renderer && (n.renderer = this.createTypeRenderer(r.renderer, t)), r.editor && (n.editor = this.createTypeEditor(r.editor, t)), r.filterPanelRenderer &&
|
|
344
|
+
return r.renderer && (n.renderer = this.createTypeRenderer(r.renderer, t)), r.editor && (n.editor = this.createTypeEditor(r.editor, t)), r.filterPanelRenderer && R && (n.filterPanelRenderer = R(
|
|
308
345
|
r.filterPanelRenderer,
|
|
309
346
|
t,
|
|
310
347
|
this.bridgeContext
|
|
@@ -318,7 +355,7 @@ class z {
|
|
|
318
355
|
return (r) => {
|
|
319
356
|
const n = document.createElement("span");
|
|
320
357
|
n.style.display = "contents";
|
|
321
|
-
const s = r.cellEl?.closest("tbw-grid") ?? t, i = u(n, e(r), void 0, s);
|
|
358
|
+
const s = r.cellEl?.closest("tbw-grid, [data-tbw-grid]") ?? t, i = u(n, e(r), void 0, s);
|
|
322
359
|
return this.trackPortal(i, n, !1), n;
|
|
323
360
|
};
|
|
324
361
|
}
|
|
@@ -365,7 +402,7 @@ class z {
|
|
|
365
402
|
g(e);
|
|
366
403
|
this.allPortalKeys.clear(), this.editorPortalKeys.clear(), this.keyToContainer.clear();
|
|
367
404
|
for (const e of this.editorBeforeCloseUnsubs.values()) e();
|
|
368
|
-
this.editorBeforeCloseUnsubs.clear(),
|
|
405
|
+
this.editorBeforeCloseUnsubs.clear(), c.clear();
|
|
369
406
|
}
|
|
370
407
|
/**
|
|
371
408
|
* Called when a cell's content is about to be wiped.
|
|
@@ -395,7 +432,7 @@ class z {
|
|
|
395
432
|
const n = this.containerToKey.get(r);
|
|
396
433
|
n && (g(n, { sync: !0 }), this.untrackPortal(n));
|
|
397
434
|
}
|
|
398
|
-
|
|
435
|
+
B(e);
|
|
399
436
|
}
|
|
400
437
|
/**
|
|
401
438
|
* Unmount a specific container (called when cell is recycled).
|
|
@@ -413,7 +450,7 @@ class z {
|
|
|
413
450
|
* grouping changes (#330).
|
|
414
451
|
*/
|
|
415
452
|
beginBatch(e) {
|
|
416
|
-
|
|
453
|
+
M(e);
|
|
417
454
|
}
|
|
418
455
|
/**
|
|
419
456
|
* Close a teardown batch opened by {@link beginBatch}. Caller is
|
|
@@ -422,15 +459,17 @@ class z {
|
|
|
422
459
|
* filter then prunes them silently.
|
|
423
460
|
*/
|
|
424
461
|
endBatch(e) {
|
|
425
|
-
|
|
462
|
+
A(e);
|
|
426
463
|
}
|
|
427
464
|
}
|
|
428
465
|
export {
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
466
|
+
Y as G,
|
|
467
|
+
O as a,
|
|
468
|
+
q as b,
|
|
469
|
+
L as c,
|
|
470
|
+
V as d,
|
|
471
|
+
z as e,
|
|
472
|
+
S as f,
|
|
473
|
+
j as g,
|
|
474
|
+
H as r
|
|
436
475
|
};
|
package/features/editing.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "@toolbox-web/grid/features/editing";
|
|
2
|
-
import { r, m as s } from "../chunks/react-column-config-
|
|
2
|
+
import { r, m as s } from "../chunks/react-column-config-BOe_PgL1.js";
|
|
3
3
|
r(({ container: t, gridEl: e }) => {
|
|
4
4
|
const o = s(t);
|
|
5
5
|
return e.addEventListener("before-edit-close", o), () => e.removeEventListener("before-edit-close", o);
|