@toolbox-web/grid-react 1.4.0 → 1.5.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 +1 -1
- package/chunks/grid-detail-panel-CR7YUhdN.js +52 -0
- package/chunks/grid-responsive-card-BB28Zl2O.js +45 -0
- package/chunks/portal-bridge-DLA6Zs11.js +51 -0
- package/chunks/react-column-config-Sb-U7Bq3.js +109 -0
- package/chunks/react-grid-adapter-CzByOnua.js +416 -0
- package/features/editing.js +5 -0
- package/features/filtering.d.ts.map +1 -1
- package/features/filtering.js +55 -45
- package/features/grouping-columns.js +18 -23
- package/features/grouping-rows.js +11 -16
- package/features/index.js +3 -3
- package/features/master-detail.js +18 -0
- package/features/pinned-rows.d.ts.map +1 -1
- package/features/pinned-rows.js +24 -17
- package/features/responsive.js +18 -0
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +422 -1000
- package/lib/column-shorthand.d.ts +22 -1
- package/lib/column-shorthand.d.ts.map +1 -1
- package/lib/data-grid.d.ts.map +1 -1
- package/lib/editor-mount-hooks.d.ts +39 -0
- package/lib/editor-mount-hooks.d.ts.map +1 -0
- package/lib/event-props.d.ts +132 -6
- package/lib/event-props.d.ts.map +1 -1
- package/lib/feature-props.d.ts +17 -2
- package/lib/feature-props.d.ts.map +1 -1
- package/lib/portal-bridge.d.ts +11 -0
- package/lib/portal-bridge.d.ts.map +1 -1
- package/lib/react-column-config.d.ts +10 -0
- package/lib/react-column-config.d.ts.map +1 -1
- package/lib/react-grid-adapter.d.ts +60 -11
- package/lib/react-grid-adapter.d.ts.map +1 -1
- package/package.json +1 -1
- package/chunks/portal-bridge-DZ4yQkmm.js +0 -42
package/index.js
CHANGED
|
@@ -1,49 +1,68 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { DataGridElement as
|
|
3
|
-
import { createContext as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
import { jsx as w, Fragment as V, jsxs as le } from "react/jsx-runtime";
|
|
2
|
+
import { DataGridElement as fe } from "@toolbox-web/grid";
|
|
3
|
+
import { createContext as ie, useContext as F, forwardRef as se, useRef as b, useReducer as de, useImperativeHandle as ce, Component as ge, useMemo as E, useEffect as v, useLayoutEffect as pe, Children as me, isValidElement as Ce, useCallback as x, useState as X } from "react";
|
|
4
|
+
import { g as ye } from "./chunks/grid-responsive-card-BB28Zl2O.js";
|
|
5
|
+
import { G as ur } from "./chunks/grid-responsive-card-BB28Zl2O.js";
|
|
6
|
+
import { s as ee } from "./chunks/portal-bridge-DLA6Zs11.js";
|
|
7
|
+
import { flushSync as re, createPortal as he } from "react-dom";
|
|
8
|
+
import { p as ve } from "./chunks/react-column-config-Sb-U7Bq3.js";
|
|
9
|
+
import { G as we, c as Re, d as Pe } from "./chunks/react-grid-adapter-CzByOnua.js";
|
|
10
|
+
import { e as fr } from "./chunks/react-grid-adapter-CzByOnua.js";
|
|
11
|
+
import { createPluginsFromFeatures as be } from "@toolbox-web/grid/features/registry";
|
|
12
|
+
import { G as ae } from "./chunks/grid-element-context-BU3WvNtM.js";
|
|
13
|
+
import { G as gr } from "./chunks/grid-detail-panel-CR7YUhdN.js";
|
|
14
|
+
function Se(r) {
|
|
15
|
+
return r.charAt(0).toUpperCase() + r.slice(1);
|
|
16
|
+
}
|
|
17
|
+
function te(r) {
|
|
18
|
+
return r.toLowerCase() === "id" ? "ID" : r.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[_-]/g, " ").split(" ").filter(Boolean).map(Se).join(" ");
|
|
19
|
+
}
|
|
20
|
+
const Ge = /* @__PURE__ */ new Set(["string", "number", "boolean", "date", "datetime", "currency"]);
|
|
21
|
+
function xe(r) {
|
|
22
|
+
const t = r.lastIndexOf(":");
|
|
23
|
+
if (t > 0) {
|
|
24
|
+
const i = r.slice(t + 1).toLowerCase();
|
|
25
|
+
if (Ge.has(i)) {
|
|
26
|
+
const o = r.slice(0, t);
|
|
21
27
|
return {
|
|
22
|
-
field:
|
|
23
|
-
header:
|
|
24
|
-
type:
|
|
28
|
+
field: o,
|
|
29
|
+
header: te(o),
|
|
30
|
+
type: i
|
|
25
31
|
};
|
|
26
32
|
}
|
|
27
33
|
}
|
|
28
34
|
return {
|
|
29
|
-
field:
|
|
30
|
-
header:
|
|
35
|
+
field: r,
|
|
36
|
+
header: te(r)
|
|
31
37
|
};
|
|
32
38
|
}
|
|
33
|
-
function
|
|
34
|
-
return
|
|
39
|
+
function Ee(r) {
|
|
40
|
+
return r.map((t) => typeof t == "string" ? xe(t) : t);
|
|
41
|
+
}
|
|
42
|
+
function De(r, t) {
|
|
43
|
+
return t ? r.map((i) => ({ ...t, ...i })) : r;
|
|
44
|
+
}
|
|
45
|
+
function Ze(r) {
|
|
46
|
+
return r.some((t) => typeof t == "string");
|
|
35
47
|
}
|
|
36
|
-
const
|
|
48
|
+
const B = {
|
|
37
49
|
onCellClick: "cell-click",
|
|
38
50
|
onRowClick: "row-click",
|
|
39
51
|
onCellActivate: "cell-activate",
|
|
40
52
|
onCellChange: "cell-change",
|
|
41
53
|
onCellCommit: "cell-commit",
|
|
54
|
+
onCellCancel: "cell-cancel",
|
|
42
55
|
onRowCommit: "row-commit",
|
|
43
56
|
onChangedRowsReset: "changed-rows-reset",
|
|
57
|
+
onEditOpen: "edit-open",
|
|
58
|
+
onBeforeEditClose: "before-edit-close",
|
|
59
|
+
onEditClose: "edit-close",
|
|
60
|
+
onDirtyChange: "dirty-change",
|
|
61
|
+
onDataChange: "data-change",
|
|
44
62
|
onSortChange: "sort-change",
|
|
45
63
|
onFilterChange: "filter-change",
|
|
46
64
|
onColumnResize: "column-resize",
|
|
65
|
+
onColumnResizeReset: "column-resize-reset",
|
|
47
66
|
onColumnMove: "column-move",
|
|
48
67
|
onColumnVisibility: "column-visibility",
|
|
49
68
|
onColumnStateChange: "column-state-change",
|
|
@@ -54,1114 +73,517 @@ const _ = {
|
|
|
54
73
|
onRowDrop: "row-drop",
|
|
55
74
|
onRowTransfer: "row-transfer",
|
|
56
75
|
onGroupToggle: "group-toggle",
|
|
76
|
+
onGroupExpand: "group-expand",
|
|
77
|
+
onGroupCollapse: "group-collapse",
|
|
57
78
|
onTreeExpand: "tree-expand",
|
|
58
79
|
onDetailExpand: "detail-expand",
|
|
59
80
|
onResponsiveChange: "responsive-change",
|
|
81
|
+
onContextMenuOpen: "context-menu-open",
|
|
60
82
|
onCopy: "copy",
|
|
61
83
|
onPaste: "paste",
|
|
62
|
-
|
|
84
|
+
onUndo: "undo",
|
|
85
|
+
onRedo: "redo",
|
|
63
86
|
onExportComplete: "export-complete",
|
|
64
87
|
onPrintStart: "print-start",
|
|
65
88
|
onPrintComplete: "print-complete",
|
|
66
89
|
onTbwScroll: "tbw-scroll"
|
|
67
|
-
},
|
|
68
|
-
function
|
|
69
|
-
return
|
|
70
|
-
}
|
|
71
|
-
const Ie = ne, J = /* @__PURE__ */ new WeakMap(), Y = /* @__PURE__ */ new Map();
|
|
72
|
-
function Re(n) {
|
|
73
|
-
const e = n.querySelector("tbw-grid-responsive-card");
|
|
74
|
-
if (e) {
|
|
75
|
-
const r = J.get(e);
|
|
76
|
-
if (r) return r;
|
|
77
|
-
}
|
|
78
|
-
const t = n.id || n.getAttribute("data-grid-id");
|
|
79
|
-
if (t)
|
|
80
|
-
return Y.get(t);
|
|
81
|
-
}
|
|
82
|
-
function He(n) {
|
|
83
|
-
const { children: e, cardRowHeight: t = "auto" } = n, r = k(null), o = S(
|
|
84
|
-
(i) => {
|
|
85
|
-
if (r.current = i, !i) return;
|
|
86
|
-
J.set(i, e);
|
|
87
|
-
const c = i.closest("tbw-grid");
|
|
88
|
-
if (c) {
|
|
89
|
-
const g = c.id || c.getAttribute("data-grid-id");
|
|
90
|
-
g && Y.set(g, e);
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
[e]
|
|
94
|
-
);
|
|
95
|
-
P(() => () => {
|
|
96
|
-
const i = r.current;
|
|
97
|
-
if (i) {
|
|
98
|
-
J.delete(i);
|
|
99
|
-
const c = i.closest("tbw-grid");
|
|
100
|
-
if (c) {
|
|
101
|
-
const g = c.id || c.getAttribute("data-grid-id");
|
|
102
|
-
g && Y.delete(g);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}, []);
|
|
106
|
-
const s = t === "auto" ? "auto" : String(t);
|
|
107
|
-
return /* @__PURE__ */ E("tbw-grid-responsive-card", { ref: o, cardRowHeight: s });
|
|
90
|
+
}, H = ie(null), Fe = ({ icons: r, children: t }) => /* @__PURE__ */ w(H.Provider, { value: r, children: t });
|
|
91
|
+
function Qe() {
|
|
92
|
+
return F(H);
|
|
108
93
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
return L(O);
|
|
94
|
+
const Le = H, N = ie(null), Ae = ({ defaults: r, children: t }) => /* @__PURE__ */ w(N.Provider, { value: r, children: t });
|
|
95
|
+
function Xe() {
|
|
96
|
+
return F(N);
|
|
113
97
|
}
|
|
114
|
-
function
|
|
115
|
-
return
|
|
98
|
+
function er(r) {
|
|
99
|
+
return F(N)?.[r];
|
|
116
100
|
}
|
|
117
|
-
const
|
|
118
|
-
class
|
|
101
|
+
const ke = N;
|
|
102
|
+
class Ie extends ge {
|
|
119
103
|
state = { failed: !1 };
|
|
120
104
|
static getDerivedStateFromError() {
|
|
121
105
|
return { failed: !0 };
|
|
122
106
|
}
|
|
123
|
-
componentDidCatch(
|
|
124
|
-
this.props.onError(this.props.portalKey,
|
|
107
|
+
componentDidCatch(t) {
|
|
108
|
+
this.props.onError(this.props.portalKey, t);
|
|
125
109
|
}
|
|
126
110
|
render() {
|
|
127
111
|
return this.state.failed ? null : this.props.children;
|
|
128
112
|
}
|
|
129
113
|
}
|
|
130
|
-
const
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
|
|
114
|
+
const Te = se(function(t, i) {
|
|
115
|
+
const o = b(/* @__PURE__ */ new Map()), [, d] = de((l) => l + 1, 0), g = b(!1), p = b(0), u = () => {
|
|
116
|
+
g.current || (g.current = !0, queueMicrotask(() => {
|
|
117
|
+
g.current = !1, re(d), R();
|
|
134
118
|
}));
|
|
135
|
-
},
|
|
136
|
-
|
|
137
|
-
|
|
119
|
+
}, R = () => {
|
|
120
|
+
p.current || (p.current = requestAnimationFrame(() => {
|
|
121
|
+
p.current = 0, d();
|
|
138
122
|
}));
|
|
139
|
-
},
|
|
140
|
-
console.error(`[grid-react] Portal "${
|
|
123
|
+
}, S = (l, y) => {
|
|
124
|
+
console.error(`[grid-react] Portal "${l}" crashed; dropping.`, y), o.current.delete(l), R();
|
|
141
125
|
};
|
|
142
|
-
|
|
143
|
-
|
|
126
|
+
ce(
|
|
127
|
+
i,
|
|
144
128
|
() => ({
|
|
145
|
-
renderPortal(
|
|
146
|
-
|
|
129
|
+
renderPortal(l, y, G) {
|
|
130
|
+
o.current.set(l, { container: y, element: G }), u();
|
|
147
131
|
},
|
|
148
|
-
removePortal(
|
|
149
|
-
|
|
132
|
+
removePortal(l, y) {
|
|
133
|
+
o.current.delete(l) && (y ? re(d) : u());
|
|
150
134
|
},
|
|
151
135
|
clear() {
|
|
152
|
-
|
|
136
|
+
o.current.size > 0 && (o.current.clear(), p.current && (cancelAnimationFrame(p.current), p.current = 0), u());
|
|
153
137
|
}
|
|
154
138
|
}),
|
|
155
139
|
// forceRender is stable (useReducer dispatch), refs are stable
|
|
156
140
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
157
141
|
[]
|
|
158
142
|
);
|
|
159
|
-
const
|
|
160
|
-
let
|
|
161
|
-
for (const [
|
|
162
|
-
if (!
|
|
163
|
-
(
|
|
143
|
+
const P = [];
|
|
144
|
+
let h = null;
|
|
145
|
+
for (const [l, { container: y, element: G }] of o.current) {
|
|
146
|
+
if (!y.isConnected) {
|
|
147
|
+
(h ??= []).push(l);
|
|
164
148
|
continue;
|
|
165
149
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
/* @__PURE__ */
|
|
169
|
-
|
|
170
|
-
|
|
150
|
+
P.push(
|
|
151
|
+
he(
|
|
152
|
+
/* @__PURE__ */ w(Ie, { portalKey: l, onError: S, children: G }),
|
|
153
|
+
y,
|
|
154
|
+
l
|
|
171
155
|
)
|
|
172
156
|
);
|
|
173
157
|
}
|
|
174
|
-
if (
|
|
175
|
-
const
|
|
158
|
+
if (h) {
|
|
159
|
+
const l = h;
|
|
176
160
|
queueMicrotask(() => {
|
|
177
|
-
for (const
|
|
161
|
+
for (const y of l) o.current.delete(y);
|
|
178
162
|
});
|
|
179
163
|
}
|
|
180
|
-
return /* @__PURE__ */
|
|
181
|
-
}),
|
|
182
|
-
function ze(n) {
|
|
183
|
-
const e = n.querySelectorAll(".react-cell-editor, .react-cell-renderer");
|
|
184
|
-
for (const t of e) {
|
|
185
|
-
const r = M.get(t);
|
|
186
|
-
r && (r.unsub?.(), A(r.key, { sync: !0 }), M.delete(t));
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
function $e(n) {
|
|
190
|
-
const e = /* @__PURE__ */ new WeakMap();
|
|
191
|
-
return (t) => {
|
|
192
|
-
const r = t.cellEl;
|
|
193
|
-
if (r) {
|
|
194
|
-
const i = e.get(r);
|
|
195
|
-
if (i) {
|
|
196
|
-
if (r.contains(i.container))
|
|
197
|
-
return b(i.container, n(t), i.portalKey), i.container;
|
|
198
|
-
A(i.portalKey, { sync: !0 }), e.delete(r);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
const o = document.createElement("div");
|
|
202
|
-
o.className = "react-cell-renderer", o.style.display = "contents";
|
|
203
|
-
const s = b(o, n(t));
|
|
204
|
-
return r && e.set(r, { portalKey: s, container: o }), M.set(o, { key: s }), o;
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
function Ue(n) {
|
|
208
|
-
return (e) => {
|
|
209
|
-
const t = document.createElement("div");
|
|
210
|
-
t.className = "react-cell-editor", t.style.display = "contents";
|
|
211
|
-
const o = { key: b(t, n(e)) };
|
|
212
|
-
return M.set(t, o), queueMicrotask(() => {
|
|
213
|
-
const s = t.closest("tbw-grid");
|
|
214
|
-
if (!s) return;
|
|
215
|
-
const i = () => {
|
|
216
|
-
const c = t.ownerDocument.activeElement;
|
|
217
|
-
c && t.contains(c) && (c instanceof HTMLInputElement || c instanceof HTMLTextAreaElement || c instanceof HTMLSelectElement) && c.blur();
|
|
218
|
-
};
|
|
219
|
-
s.addEventListener("before-edit-close", i), o.unsub = () => {
|
|
220
|
-
s.removeEventListener("before-edit-close", i);
|
|
221
|
-
};
|
|
222
|
-
}), t;
|
|
223
|
-
};
|
|
224
|
-
}
|
|
225
|
-
function _e(n) {
|
|
226
|
-
return (e) => {
|
|
227
|
-
const t = document.createElement("div");
|
|
228
|
-
t.className = "react-header-renderer", t.style.display = "contents";
|
|
229
|
-
const r = b(t, n(e));
|
|
230
|
-
return M.set(t, { key: r }), t;
|
|
231
|
-
};
|
|
232
|
-
}
|
|
233
|
-
function We(n) {
|
|
234
|
-
return (e) => {
|
|
235
|
-
const t = document.createElement("div");
|
|
236
|
-
t.className = "react-header-label-renderer", t.style.display = "contents";
|
|
237
|
-
const r = b(t, n(e));
|
|
238
|
-
return M.set(t, { key: r }), t;
|
|
239
|
-
};
|
|
240
|
-
}
|
|
241
|
-
function Ve(n) {
|
|
242
|
-
return (e) => {
|
|
243
|
-
const t = n(e);
|
|
244
|
-
if (t instanceof HTMLElement || typeof t == "string")
|
|
245
|
-
return t;
|
|
246
|
-
const r = document.createElement("div");
|
|
247
|
-
r.className = "react-loading-renderer", r.style.display = "contents";
|
|
248
|
-
const o = b(r, t);
|
|
249
|
-
return M.set(r, { key: o }), r;
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
function we(n) {
|
|
253
|
-
if (!n) return;
|
|
254
|
-
if (n[W]) return n;
|
|
255
|
-
if (n.loadingRenderer && typeof n.loadingRenderer == "function") {
|
|
256
|
-
const r = n.loadingRenderer;
|
|
257
|
-
n = {
|
|
258
|
-
...n,
|
|
259
|
-
loadingRenderer: Ve(r)
|
|
260
|
-
};
|
|
261
|
-
}
|
|
262
|
-
if (!n.columns) {
|
|
263
|
-
const r = n;
|
|
264
|
-
return r[W] = !0, r;
|
|
265
|
-
}
|
|
266
|
-
const e = n.columns.map((r) => {
|
|
267
|
-
const { renderer: o, editor: s, headerRenderer: i, headerLabelRenderer: c, ...g } = r, l = { ...g };
|
|
268
|
-
return o && (l.renderer = $e(o)), s && (l.editor = Ue(s)), i && (l.headerRenderer = _e(i)), c && (l.headerLabelRenderer = We(c)), l;
|
|
269
|
-
}), t = {
|
|
270
|
-
...n,
|
|
271
|
-
columns: e
|
|
272
|
-
};
|
|
273
|
-
return t[W] = !0, t;
|
|
274
|
-
}
|
|
275
|
-
const Z = /* @__PURE__ */ new WeakMap(), Q = /* @__PURE__ */ new Map();
|
|
276
|
-
function Je(n) {
|
|
277
|
-
const e = n.querySelector("tbw-grid-detail");
|
|
278
|
-
if (e) {
|
|
279
|
-
const r = Z.get(e);
|
|
280
|
-
if (r) return r;
|
|
281
|
-
}
|
|
282
|
-
const t = n.id || n.getAttribute("data-grid-id");
|
|
283
|
-
if (t)
|
|
284
|
-
return Q.get(t);
|
|
285
|
-
}
|
|
286
|
-
function Ye(n) {
|
|
287
|
-
const { children: e, showExpandColumn: t = !0, animation: r = "slide" } = n, o = k(null), s = S(
|
|
288
|
-
(c) => {
|
|
289
|
-
if (o.current = c, !c) return;
|
|
290
|
-
Z.set(c, e);
|
|
291
|
-
const g = c.closest("tbw-grid");
|
|
292
|
-
if (g) {
|
|
293
|
-
const l = g.id || g.getAttribute("data-grid-id");
|
|
294
|
-
l && Q.set(l, e);
|
|
295
|
-
}
|
|
296
|
-
},
|
|
297
|
-
[e]
|
|
298
|
-
);
|
|
299
|
-
return P(() => () => {
|
|
300
|
-
const c = o.current;
|
|
301
|
-
if (c) {
|
|
302
|
-
Z.delete(c);
|
|
303
|
-
const g = c.closest("tbw-grid");
|
|
304
|
-
if (g) {
|
|
305
|
-
const C = g.id || g.getAttribute("data-grid-id");
|
|
306
|
-
C && Q.delete(C);
|
|
307
|
-
}
|
|
308
|
-
const l = c.parentNode;
|
|
309
|
-
l && l.contains(c);
|
|
310
|
-
}
|
|
311
|
-
}, []), /* @__PURE__ */ E(
|
|
312
|
-
"tbw-grid-detail",
|
|
313
|
-
{
|
|
314
|
-
ref: s,
|
|
315
|
-
showExpandColumn: t ? void 0 : "false",
|
|
316
|
-
animation: r === !1 ? "false" : r
|
|
317
|
-
}
|
|
318
|
-
);
|
|
319
|
-
}
|
|
320
|
-
Ye.displayName = "GridDetailPanel";
|
|
321
|
-
const X = /* @__PURE__ */ new WeakMap(), ee = /* @__PURE__ */ new Map();
|
|
322
|
-
function Ze(n) {
|
|
323
|
-
const e = X.get(n);
|
|
324
|
-
if (e) return e;
|
|
325
|
-
const t = n.id;
|
|
326
|
-
if (t)
|
|
327
|
-
return ee.get(t);
|
|
328
|
-
}
|
|
329
|
-
function Ct(n) {
|
|
330
|
-
const { id: e, title: t, icon: r, tooltip: o, order: s = 100, children: i } = n, c = k(null), g = S(
|
|
331
|
-
(l) => {
|
|
332
|
-
c.current = l, l && (X.set(l, i), e && ee.set(e, i));
|
|
333
|
-
},
|
|
334
|
-
[i, e]
|
|
335
|
-
);
|
|
336
|
-
return P(() => () => {
|
|
337
|
-
const l = c.current;
|
|
338
|
-
l && (X.delete(l), e && ee.delete(e));
|
|
339
|
-
}, [e]), /* @__PURE__ */ E(
|
|
340
|
-
"tbw-grid-tool-panel",
|
|
341
|
-
{
|
|
342
|
-
ref: g,
|
|
343
|
-
id: e,
|
|
344
|
-
title: t,
|
|
345
|
-
icon: r,
|
|
346
|
-
tooltip: o,
|
|
347
|
-
order: s?.toString()
|
|
348
|
-
}
|
|
349
|
-
);
|
|
350
|
-
}
|
|
351
|
-
const G = /* @__PURE__ */ new WeakMap(), K = /* @__PURE__ */ new Map();
|
|
352
|
-
function Qe(n, e) {
|
|
353
|
-
const t = n.getAttribute("field"), r = G.get(n) ?? {};
|
|
354
|
-
if (r.renderer = e, G.set(n, r), t) {
|
|
355
|
-
const o = K.get(t) ?? {};
|
|
356
|
-
o.renderer = e, K.set(t, o);
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
function Xe(n, e) {
|
|
360
|
-
const t = n.getAttribute("field"), r = G.get(n) ?? {};
|
|
361
|
-
if (r.editor = e, G.set(n, r), t) {
|
|
362
|
-
const o = K.get(t) ?? {};
|
|
363
|
-
o.editor = e, K.set(t, o);
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
function et(n) {
|
|
367
|
-
let e = G.get(n)?.renderer;
|
|
368
|
-
if (!e) {
|
|
369
|
-
const t = n.getAttribute("field");
|
|
370
|
-
t && (e = K.get(t)?.renderer);
|
|
371
|
-
}
|
|
372
|
-
return e;
|
|
373
|
-
}
|
|
374
|
-
function tt(n) {
|
|
375
|
-
let e = G.get(n)?.editor;
|
|
376
|
-
if (!e) {
|
|
377
|
-
const t = n.getAttribute("field");
|
|
378
|
-
t && (e = K.get(t)?.editor);
|
|
379
|
-
}
|
|
380
|
-
return e;
|
|
381
|
-
}
|
|
382
|
-
class rt {
|
|
383
|
-
/** Portal keys for all managed portals (for cleanup on destroy). */
|
|
384
|
-
allPortalKeys = /* @__PURE__ */ new Set();
|
|
385
|
-
/** Portal keys for editor-specific portals (for per-cell cleanup via releaseCell). */
|
|
386
|
-
editorPortalKeys = /* @__PURE__ */ new Set();
|
|
387
|
-
/** Maps portal keys to their containers (for container-based lookups in releaseCell/unmount). */
|
|
388
|
-
keyToContainer = /* @__PURE__ */ new Map();
|
|
389
|
-
/**
|
|
390
|
-
* Reverse index: container element → portal key. Maintained alongside
|
|
391
|
-
* `keyToContainer` so `releaseCell` can resolve only the containers
|
|
392
|
-
* actually inside the released cell (via `cellEl.querySelectorAll`)
|
|
393
|
-
* instead of scanning every tracked portal — important for grids with
|
|
394
|
-
* many cells, where `releaseCell` runs on every cell teardown.
|
|
395
|
-
*/
|
|
396
|
-
containerToKey = /* @__PURE__ */ new WeakMap();
|
|
397
|
-
/**
|
|
398
|
-
* Per-editor `before-edit-close` listener teardown functions, keyed by portal key.
|
|
399
|
-
*
|
|
400
|
-
* The grid's editing plugin emits `before-edit-close` on the host `<tbw-grid>`
|
|
401
|
-
* before tearing down a row's managed editors. React editors commonly write
|
|
402
|
-
* `onBlur={commit}` to flush local state on click-away, but Tab / programmatic
|
|
403
|
-
* row exit rebuilds the cell DOM synchronously without giving the focused
|
|
404
|
-
* input a chance to fire `blur` first.
|
|
405
|
-
*
|
|
406
|
-
* To bridge that gap we call `.blur()` on the focused input inside the editor
|
|
407
|
-
* container as soon as `before-edit-close` fires. The native `.blur()` method
|
|
408
|
-
* is what React's event system actually observes — React 17+ delegates focus
|
|
409
|
-
* events at the root by listening to `focusout` (bubbling) and mapping it to
|
|
410
|
-
* `onBlur`. A bare `dispatchEvent(new FocusEvent('blur'))` would be ignored
|
|
411
|
-
* by React because `blur` does not bubble. Calling the native `.blur()`
|
|
412
|
-
* dispatches the full focus-loss chain (`blur` + `focusout`) and also moves
|
|
413
|
-
* focus off the input — both desirable here since the editor DOM is about to
|
|
414
|
-
* be torn down anyway.
|
|
415
|
-
*
|
|
416
|
-
* Mirrors the Angular adapter's `BaseGridEditor.onBeforeEditClose()` hook.
|
|
417
|
-
* Requires zero per-editor code: any editor with `onBlur={commit}` is
|
|
418
|
-
* automatically covered for Tab commits and programmatic row exit.
|
|
419
|
-
*/
|
|
420
|
-
editorBeforeCloseUnsubs = /* @__PURE__ */ new Map();
|
|
421
|
-
typeDefaults = null;
|
|
422
|
-
/**
|
|
423
|
-
* Sets the type defaults map for this adapter.
|
|
424
|
-
* Called by DataGrid when it receives type defaults from context.
|
|
425
|
-
*
|
|
426
|
-
* @internal
|
|
427
|
-
*/
|
|
428
|
-
setTypeDefaults(e) {
|
|
429
|
-
this.typeDefaults = e;
|
|
430
|
-
}
|
|
431
|
-
/**
|
|
432
|
-
* FrameworkAdapter.processConfig implementation.
|
|
433
|
-
* Called automatically by the grid's `set gridConfig` setter.
|
|
434
|
-
* Converts React renderer/editor functions to DOM-returning functions.
|
|
435
|
-
*/
|
|
436
|
-
processConfig(e) {
|
|
437
|
-
return we(e) ?? e;
|
|
438
|
-
}
|
|
439
|
-
/**
|
|
440
|
-
* Determines if this adapter can handle the given element.
|
|
441
|
-
* Checks if a renderer or editor is registered for this element.
|
|
442
|
-
*/
|
|
443
|
-
canHandle(e) {
|
|
444
|
-
const t = e.getAttribute("field");
|
|
445
|
-
let r = G.get(e);
|
|
446
|
-
if (!r && t) {
|
|
447
|
-
const i = K.get(t);
|
|
448
|
-
i && (i.renderer || i.editor) && (r = i, G.set(e, r));
|
|
449
|
-
}
|
|
450
|
-
const o = r?.renderer !== void 0, s = r?.editor !== void 0;
|
|
451
|
-
return r !== void 0 && (o || s);
|
|
452
|
-
}
|
|
453
|
-
/**
|
|
454
|
-
* Creates a view renderer function that renders a React component
|
|
455
|
-
* and returns its container DOM element.
|
|
456
|
-
*
|
|
457
|
-
* Uses a cell cache to reuse portals for performance - instead of
|
|
458
|
-
* creating new portals on each render, we reuse existing ones and
|
|
459
|
-
* update their content.
|
|
460
|
-
*
|
|
461
|
-
* Returns undefined if no renderer is registered for this element,
|
|
462
|
-
* allowing the grid to use its default rendering.
|
|
463
|
-
*/
|
|
464
|
-
createRenderer(e) {
|
|
465
|
-
const t = et(e);
|
|
466
|
-
if (!t)
|
|
467
|
-
return;
|
|
468
|
-
const r = e.closest("tbw-grid"), o = /* @__PURE__ */ new WeakMap();
|
|
469
|
-
return (s) => {
|
|
470
|
-
const i = s.cellEl;
|
|
471
|
-
if (i) {
|
|
472
|
-
const l = o.get(i);
|
|
473
|
-
if (l) {
|
|
474
|
-
if (i.contains(l.container))
|
|
475
|
-
return b(l.container, t(s), l.portalKey), l.container;
|
|
476
|
-
A(l.portalKey, { sync: !0 }), this.untrackPortal(l.portalKey), o.delete(i);
|
|
477
|
-
}
|
|
478
|
-
const C = document.createElement("div");
|
|
479
|
-
C.className = "react-cell-renderer", C.style.display = "contents";
|
|
480
|
-
const R = b(
|
|
481
|
-
C,
|
|
482
|
-
t(s),
|
|
483
|
-
void 0,
|
|
484
|
-
r ?? void 0
|
|
485
|
-
);
|
|
486
|
-
return o.set(i, { portalKey: R, container: C }), this.trackPortal(R, C, !1), C;
|
|
487
|
-
}
|
|
488
|
-
const c = document.createElement("div");
|
|
489
|
-
c.className = "react-cell-renderer", c.style.display = "contents";
|
|
490
|
-
const g = b(
|
|
491
|
-
c,
|
|
492
|
-
t(s),
|
|
493
|
-
void 0,
|
|
494
|
-
r ?? void 0
|
|
495
|
-
);
|
|
496
|
-
return this.trackPortal(g, c, !1), c;
|
|
497
|
-
};
|
|
498
|
-
}
|
|
499
|
-
/**
|
|
500
|
-
* Creates an editor spec that renders a React component
|
|
501
|
-
* with commit/cancel callbacks passed as props.
|
|
502
|
-
*/
|
|
503
|
-
createEditor(e) {
|
|
504
|
-
const t = tt(e);
|
|
505
|
-
if (!t)
|
|
506
|
-
return () => document.createElement("div");
|
|
507
|
-
const r = e.closest("tbw-grid") ?? void 0;
|
|
508
|
-
return (o) => {
|
|
509
|
-
const s = document.createElement("div");
|
|
510
|
-
s.className = "react-cell-editor", s.style.display = "contents";
|
|
511
|
-
const i = b(
|
|
512
|
-
s,
|
|
513
|
-
t(o),
|
|
514
|
-
void 0,
|
|
515
|
-
r
|
|
516
|
-
);
|
|
517
|
-
if (this.trackPortal(i, s, !0), r) {
|
|
518
|
-
const c = () => {
|
|
519
|
-
const l = s.ownerDocument.activeElement;
|
|
520
|
-
l && s.contains(l) && (l instanceof HTMLInputElement || l instanceof HTMLTextAreaElement || l instanceof HTMLSelectElement) && l.blur();
|
|
521
|
-
};
|
|
522
|
-
r.addEventListener("before-edit-close", c), this.editorBeforeCloseUnsubs.set(i, () => {
|
|
523
|
-
r.removeEventListener("before-edit-close", c);
|
|
524
|
-
});
|
|
525
|
-
}
|
|
526
|
-
return s;
|
|
527
|
-
};
|
|
528
|
-
}
|
|
529
|
-
/**
|
|
530
|
-
* Creates a detail renderer function for MasterDetailPlugin.
|
|
531
|
-
* Renders React components for expandable detail rows.
|
|
532
|
-
*/
|
|
533
|
-
createDetailRenderer(e) {
|
|
534
|
-
const t = Je(e);
|
|
535
|
-
if (t)
|
|
536
|
-
return (r, o) => {
|
|
537
|
-
const s = document.createElement("div");
|
|
538
|
-
s.className = "react-detail-panel";
|
|
539
|
-
const c = b(
|
|
540
|
-
s,
|
|
541
|
-
t({ row: r, rowIndex: o }),
|
|
542
|
-
void 0,
|
|
543
|
-
e
|
|
544
|
-
);
|
|
545
|
-
return this.trackPortal(c, s, !1), s;
|
|
546
|
-
};
|
|
547
|
-
}
|
|
548
|
-
/**
|
|
549
|
-
* Framework adapter hook called by MasterDetailPlugin during attach().
|
|
550
|
-
* Parses the <tbw-grid-detail> element and returns a React-based renderer.
|
|
551
|
-
*/
|
|
552
|
-
parseDetailElement(e) {
|
|
553
|
-
const t = e.closest("tbw-grid");
|
|
554
|
-
if (t)
|
|
555
|
-
return this.createDetailRenderer(t);
|
|
556
|
-
}
|
|
557
|
-
/**
|
|
558
|
-
* Creates a responsive card renderer function for ResponsivePlugin.
|
|
559
|
-
* Renders React components for card layout in responsive mode.
|
|
560
|
-
*/
|
|
561
|
-
createResponsiveCardRenderer(e) {
|
|
562
|
-
const t = Re(e);
|
|
563
|
-
if (t)
|
|
564
|
-
return (r, o) => {
|
|
565
|
-
const s = document.createElement("div");
|
|
566
|
-
s.className = "react-responsive-card";
|
|
567
|
-
const c = b(
|
|
568
|
-
s,
|
|
569
|
-
t({ row: r, index: o }),
|
|
570
|
-
void 0,
|
|
571
|
-
e
|
|
572
|
-
);
|
|
573
|
-
return this.trackPortal(c, s, !1), s;
|
|
574
|
-
};
|
|
575
|
-
}
|
|
576
|
-
/**
|
|
577
|
-
* FrameworkAdapter hook called by ResponsivePlugin during attach().
|
|
578
|
-
* Parses the `<tbw-grid-responsive-card>` element and delegates to
|
|
579
|
-
* {@link createResponsiveCardRenderer}. Needed for parity with the Vue
|
|
580
|
-
* and Angular adapters so ResponsivePlugin's standard lookup path works
|
|
581
|
-
* for React users as well, not just via the imperative
|
|
582
|
-
* `refreshResponsiveCardRenderer` hook in DataGrid.
|
|
583
|
-
*/
|
|
584
|
-
parseResponsiveCardElement(e) {
|
|
585
|
-
const t = e.closest("tbw-grid");
|
|
586
|
-
if (t)
|
|
587
|
-
return this.createResponsiveCardRenderer(t);
|
|
588
|
-
}
|
|
589
|
-
/**
|
|
590
|
-
* Creates a tool panel renderer from a light DOM element.
|
|
591
|
-
* Renders React components into tool panel containers.
|
|
592
|
-
*/
|
|
593
|
-
createToolPanelRenderer(e) {
|
|
594
|
-
const t = Ze(e);
|
|
595
|
-
if (!t)
|
|
596
|
-
return;
|
|
597
|
-
const r = e.closest("tbw-grid");
|
|
598
|
-
return (o) => {
|
|
599
|
-
const i = b(o, t({
|
|
600
|
-
grid: r ?? o
|
|
601
|
-
}), void 0, r ?? void 0);
|
|
602
|
-
return this.trackPortal(i, o, !1), () => {
|
|
603
|
-
A(i, { sync: !0 }), this.untrackPortal(i);
|
|
604
|
-
};
|
|
605
|
-
};
|
|
606
|
-
}
|
|
607
|
-
/**
|
|
608
|
-
* Gets type-level defaults from the type defaults map.
|
|
609
|
-
*
|
|
610
|
-
* This enables application-wide type defaults configured via GridTypeProvider.
|
|
611
|
-
* The returned TypeDefault contains renderer/editor functions that render
|
|
612
|
-
* React components into the grid's cells.
|
|
613
|
-
*
|
|
614
|
-
* @example
|
|
615
|
-
* ```tsx
|
|
616
|
-
* // App.tsx
|
|
617
|
-
* const typeDefaults = {
|
|
618
|
-
* country: {
|
|
619
|
-
* renderer: (ctx) => <CountryBadge code={ctx.value} />,
|
|
620
|
-
* editor: (ctx) => <CountrySelect value={ctx.value} onCommit={ctx.commit} />
|
|
621
|
-
* }
|
|
622
|
-
* };
|
|
623
|
-
*
|
|
624
|
-
* <GridTypeProvider defaults={typeDefaults}>
|
|
625
|
-
* <App />
|
|
626
|
-
* </GridTypeProvider>
|
|
627
|
-
*
|
|
628
|
-
* // Any grid with type: 'country' columns will use these components
|
|
629
|
-
* ```
|
|
630
|
-
*/
|
|
631
|
-
getTypeDefault(e, t) {
|
|
632
|
-
if (!this.typeDefaults)
|
|
633
|
-
return;
|
|
634
|
-
const r = this.typeDefaults[e];
|
|
635
|
-
if (!r)
|
|
636
|
-
return;
|
|
637
|
-
const o = {
|
|
638
|
-
editorParams: r.editorParams
|
|
639
|
-
};
|
|
640
|
-
return r.renderer && (o.renderer = this.createTypeRenderer(r.renderer, t)), r.editor && (o.editor = this.createTypeEditor(r.editor, t)), r.filterPanelRenderer && (o.filterPanelRenderer = this.createFilterPanelRenderer(r.filterPanelRenderer, t)), o;
|
|
641
|
-
}
|
|
642
|
-
/**
|
|
643
|
-
* Creates a renderer function from a React render function for type defaults.
|
|
644
|
-
* @internal
|
|
645
|
-
*/
|
|
646
|
-
createTypeRenderer(e, t) {
|
|
647
|
-
return (r) => {
|
|
648
|
-
const o = document.createElement("span");
|
|
649
|
-
o.style.display = "contents";
|
|
650
|
-
const s = r.cellEl?.closest("tbw-grid") ?? t, i = b(o, e(r), void 0, s);
|
|
651
|
-
return this.trackPortal(i, o, !1), o;
|
|
652
|
-
};
|
|
653
|
-
}
|
|
654
|
-
/**
|
|
655
|
-
* Creates an editor function from a React render function for type defaults.
|
|
656
|
-
* @internal
|
|
657
|
-
*/
|
|
658
|
-
createTypeEditor(e, t) {
|
|
659
|
-
return (r) => {
|
|
660
|
-
const o = document.createElement("span");
|
|
661
|
-
o.style.display = "contents";
|
|
662
|
-
const s = b(o, e(r), void 0, t);
|
|
663
|
-
return this.trackPortal(s, o, !0), o;
|
|
664
|
-
};
|
|
665
|
-
}
|
|
666
|
-
/**
|
|
667
|
-
* Creates a filter panel renderer that mounts React content into the filter panel container.
|
|
668
|
-
* @internal
|
|
669
|
-
*/
|
|
670
|
-
createFilterPanelRenderer(e, t) {
|
|
671
|
-
return (r, o) => {
|
|
672
|
-
const s = document.createElement("div");
|
|
673
|
-
s.style.display = "contents";
|
|
674
|
-
const i = r.closest("tbw-grid") ?? t, c = b(s, e(o), void 0, i);
|
|
675
|
-
this.trackPortal(c, s, !1), r.appendChild(s);
|
|
676
|
-
};
|
|
677
|
-
}
|
|
678
|
-
// #region Portal tracking helpers
|
|
679
|
-
/** Register a portal key for lifecycle tracking. */
|
|
680
|
-
trackPortal(e, t, r) {
|
|
681
|
-
this.allPortalKeys.add(e), this.keyToContainer.set(e, t), this.containerToKey.set(t, e), r && this.editorPortalKeys.add(e);
|
|
682
|
-
}
|
|
683
|
-
/** Unregister a portal key from all tracking sets. */
|
|
684
|
-
untrackPortal(e) {
|
|
685
|
-
this.allPortalKeys.delete(e), this.editorPortalKeys.delete(e);
|
|
686
|
-
const t = this.keyToContainer.get(e);
|
|
687
|
-
this.keyToContainer.delete(e), t && this.containerToKey.delete(t);
|
|
688
|
-
const r = this.editorBeforeCloseUnsubs.get(e);
|
|
689
|
-
r && (r(), this.editorBeforeCloseUnsubs.delete(e));
|
|
690
|
-
}
|
|
691
|
-
// #endregion
|
|
692
|
-
/**
|
|
693
|
-
* Clean up all mounted portals.
|
|
694
|
-
* Call this when the grid is unmounted.
|
|
695
|
-
*/
|
|
696
|
-
destroy() {
|
|
697
|
-
for (const e of this.allPortalKeys)
|
|
698
|
-
A(e);
|
|
699
|
-
this.allPortalKeys.clear(), this.editorPortalKeys.clear(), this.keyToContainer.clear();
|
|
700
|
-
for (const e of this.editorBeforeCloseUnsubs.values()) e();
|
|
701
|
-
this.editorBeforeCloseUnsubs.clear(), K.clear();
|
|
702
|
-
}
|
|
703
|
-
/**
|
|
704
|
-
* Called when a cell's content is about to be wiped.
|
|
705
|
-
*
|
|
706
|
-
* Destroys editor portals AND renderer portals whose container is inside
|
|
707
|
-
* the cell. Releasing renderers here is critical: the editing pipeline
|
|
708
|
-
* runs `cell.innerHTML = ''` immediately after this returns, which
|
|
709
|
-
* silently detaches React-managed renderer containers from the DOM.
|
|
710
|
-
* If we leave the React root mounted, its fiber tree still believes
|
|
711
|
-
* the now-orphaned children are present — a subsequent React commit
|
|
712
|
-
* (e.g. the user's `onCellCommit` → `setRows`) tries to `removeChild`
|
|
713
|
-
* those gone nodes and throws `NotFoundError` (issue #250).
|
|
714
|
-
*
|
|
715
|
-
* Calling this BEFORE the wipe lets React unmount cleanly while DOM
|
|
716
|
-
* still matches its fiber tree. The `wrapReactRenderer` cache will
|
|
717
|
-
* detect the missing entry on the next render and create a fresh
|
|
718
|
-
* container — see the cache-validation defense in `createRenderer`
|
|
719
|
-
* and `wrapReactRenderer` (`react-column-config.ts`).
|
|
720
|
-
*
|
|
721
|
-
* Also cleans up config-based editor and renderer roots
|
|
722
|
-
* (from processGridConfig/wrapReactEditor/wrapReactRenderer) that
|
|
723
|
-
* bypass the adapter's own portal tracking.
|
|
724
|
-
*/
|
|
725
|
-
releaseCell(e) {
|
|
726
|
-
const t = e.querySelectorAll(".react-cell-renderer, .react-cell-editor");
|
|
727
|
-
for (const r of t) {
|
|
728
|
-
const o = this.containerToKey.get(r);
|
|
729
|
-
o && (A(o, { sync: !0 }), this.untrackPortal(o));
|
|
730
|
-
}
|
|
731
|
-
ze(e);
|
|
732
|
-
}
|
|
733
|
-
/**
|
|
734
|
-
* Unmount a specific container (called when cell is recycled).
|
|
735
|
-
*/
|
|
736
|
-
unmount(e) {
|
|
737
|
-
const t = this.containerToKey.get(e);
|
|
738
|
-
t && (A(t), this.untrackPortal(t));
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
const nt = {
|
|
164
|
+
return /* @__PURE__ */ w(V, { children: P });
|
|
165
|
+
}), Me = {
|
|
742
166
|
undoRedo: ["editing"],
|
|
743
167
|
clipboard: ["selection"]
|
|
744
168
|
};
|
|
745
|
-
function
|
|
746
|
-
const
|
|
747
|
-
for (const
|
|
748
|
-
const
|
|
749
|
-
if (
|
|
750
|
-
for (const
|
|
751
|
-
|
|
752
|
-
`[DataGrid] Feature "${
|
|
169
|
+
function Ne(r) {
|
|
170
|
+
const t = new Set(r);
|
|
171
|
+
for (const i of r) {
|
|
172
|
+
const o = Me[i];
|
|
173
|
+
if (o)
|
|
174
|
+
for (const d of o)
|
|
175
|
+
t.has(d) || console.warn(
|
|
176
|
+
`[DataGrid] Feature "${i}" requires "${d}" to be enabled. Add the "${d}" prop to your DataGrid.`
|
|
753
177
|
);
|
|
754
178
|
}
|
|
755
179
|
}
|
|
756
|
-
function
|
|
757
|
-
const
|
|
758
|
-
for (const [
|
|
759
|
-
|
|
760
|
-
return
|
|
761
|
-
}
|
|
762
|
-
let
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
180
|
+
function Oe(r) {
|
|
181
|
+
const t = [];
|
|
182
|
+
for (const [i, o] of Object.entries(r))
|
|
183
|
+
o === void 0 || o === !1 || t.push(i);
|
|
184
|
+
return Ne(t), be(r);
|
|
185
|
+
}
|
|
186
|
+
let ne = !1, _ = null;
|
|
187
|
+
const oe = [
|
|
188
|
+
"selection",
|
|
189
|
+
"editing",
|
|
190
|
+
"filtering",
|
|
191
|
+
"multiSort",
|
|
192
|
+
"clipboard",
|
|
193
|
+
"contextMenu",
|
|
194
|
+
"reorderColumns",
|
|
195
|
+
"reorderRows",
|
|
196
|
+
"rowDragDrop",
|
|
197
|
+
"visibility",
|
|
198
|
+
"undoRedo",
|
|
199
|
+
"tree",
|
|
200
|
+
"groupingRows",
|
|
201
|
+
"groupingColumns",
|
|
202
|
+
"pinnedColumns",
|
|
203
|
+
"pinnedRows",
|
|
204
|
+
"masterDetail",
|
|
205
|
+
"responsive",
|
|
206
|
+
"columnVirtualization",
|
|
207
|
+
"export",
|
|
208
|
+
"print",
|
|
209
|
+
"pivot",
|
|
210
|
+
"serverSide",
|
|
211
|
+
"tooltip"
|
|
212
|
+
];
|
|
213
|
+
function q() {
|
|
214
|
+
return ne || (_ = new we(), fe.registerAdapter(_), ne = !0), _;
|
|
215
|
+
}
|
|
216
|
+
q();
|
|
217
|
+
function ze(r) {
|
|
218
|
+
const i = r.getPluginByName?.("masterDetail");
|
|
219
|
+
i && typeof i.refreshDetailRenderer == "function" && i.refreshDetailRenderer();
|
|
220
|
+
}
|
|
221
|
+
function je(r, t) {
|
|
222
|
+
const i = r;
|
|
223
|
+
if (!r.querySelector("tbw-grid-responsive-card") || !ye(r)) return;
|
|
224
|
+
const g = i.getPluginByName?.("responsive");
|
|
225
|
+
if (g && typeof g.setCardRenderer == "function") {
|
|
226
|
+
const p = t.createResponsiveCardRenderer(r);
|
|
227
|
+
p && g.setCardRenderer(p);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
function $e(r) {
|
|
231
|
+
const t = {};
|
|
232
|
+
return me.forEach(r, (i) => {
|
|
233
|
+
if (Ce(i)) {
|
|
234
|
+
if (i.type && i.type.displayName === "GridDetailPanel") {
|
|
235
|
+
const o = i.props;
|
|
236
|
+
t.masterDetail = {
|
|
787
237
|
// Use props from the child component for configuration
|
|
788
|
-
showExpandColumn:
|
|
789
|
-
animation:
|
|
238
|
+
showExpandColumn: o.showExpandColumn ?? !0,
|
|
239
|
+
animation: o.animation ?? "slide"
|
|
790
240
|
// detailRenderer will be wired up by refreshMasterDetailRenderer after mount
|
|
791
241
|
};
|
|
792
242
|
}
|
|
793
|
-
|
|
243
|
+
i.type && i.type.displayName === "GridResponsiveCard" && (t.responsive = !0);
|
|
794
244
|
}
|
|
795
|
-
}),
|
|
245
|
+
}), t;
|
|
796
246
|
}
|
|
797
|
-
const
|
|
247
|
+
const rr = se(function(t, i) {
|
|
798
248
|
const {
|
|
799
249
|
// Core props
|
|
800
|
-
rows:
|
|
801
|
-
gridConfig:
|
|
802
|
-
columns:
|
|
803
|
-
columnDefaults:
|
|
804
|
-
fitMode:
|
|
805
|
-
sortable:
|
|
806
|
-
filterable:
|
|
807
|
-
selectable:
|
|
808
|
-
loading:
|
|
809
|
-
customStyles:
|
|
810
|
-
className:
|
|
811
|
-
style:
|
|
812
|
-
children:
|
|
250
|
+
rows: o,
|
|
251
|
+
gridConfig: d,
|
|
252
|
+
columns: g,
|
|
253
|
+
columnDefaults: p,
|
|
254
|
+
fitMode: u,
|
|
255
|
+
sortable: R,
|
|
256
|
+
filterable: S,
|
|
257
|
+
selectable: P,
|
|
258
|
+
loading: h,
|
|
259
|
+
customStyles: l,
|
|
260
|
+
className: y,
|
|
261
|
+
style: G,
|
|
262
|
+
children: D,
|
|
813
263
|
// Plugin props
|
|
814
|
-
plugins:
|
|
815
|
-
// SSR mode
|
|
816
|
-
ssr:
|
|
264
|
+
plugins: s,
|
|
265
|
+
// SSR mode (deprecated - see SSRProps)
|
|
266
|
+
ssr: m,
|
|
817
267
|
// Legacy event handlers
|
|
818
|
-
onRowsChange:
|
|
268
|
+
onRowsChange: C,
|
|
819
269
|
// Feature props and event props are in ...rest
|
|
820
|
-
...
|
|
821
|
-
} =
|
|
822
|
-
|
|
823
|
-
"
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
"tree",
|
|
834
|
-
"groupingRows",
|
|
835
|
-
"groupingColumns",
|
|
836
|
-
"pinnedColumns",
|
|
837
|
-
"pinnedRows",
|
|
838
|
-
"masterDetail",
|
|
839
|
-
"responsive",
|
|
840
|
-
"columnVirtualization",
|
|
841
|
-
"export",
|
|
842
|
-
"print",
|
|
843
|
-
"pivot",
|
|
844
|
-
"serverSide",
|
|
845
|
-
"tooltip"
|
|
846
|
-
], be = T(() => ie.map((a) => {
|
|
847
|
-
const d = p[a];
|
|
848
|
-
return d !== void 0 ? `${a}:${JSON.stringify(d)}` : "";
|
|
849
|
-
}).filter(Boolean).join("|"), [p]), se = T(() => {
|
|
850
|
-
const a = {};
|
|
851
|
-
for (const d of ie)
|
|
852
|
-
d in p && p[d] !== void 0 && (a[d] = p[d]);
|
|
853
|
-
return a;
|
|
854
|
-
}, [be]), ce = T(() => at(x), [x]), ae = T(() => ({ ...ce, ...se }), [se, ce]), z = T(() => u || h ? [] : it(ae), [ae, u, h]), F = T(() => {
|
|
855
|
-
if (u) {
|
|
856
|
-
const a = new Set(u.map((y) => y.name)), d = z.filter((y) => !a.has(y.name));
|
|
857
|
-
return [...u, ...d];
|
|
270
|
+
...a
|
|
271
|
+
} = t, c = b(null), M = b(null), K = b(!1), U = F(ke), O = F(Le), ue = E(() => oe.map((e) => {
|
|
272
|
+
const n = a[e];
|
|
273
|
+
return n !== void 0 ? `${e}:${JSON.stringify(n)}` : "";
|
|
274
|
+
}).filter(Boolean).join("|"), [a]), Y = E(() => {
|
|
275
|
+
const e = {};
|
|
276
|
+
for (const n of oe)
|
|
277
|
+
n in a && a[n] !== void 0 && (e[n] = a[n]);
|
|
278
|
+
return e;
|
|
279
|
+
}, [ue]), J = E(() => $e(D), [D]), W = E(() => ({ ...J, ...Y }), [Y, J]), z = E(() => s || m ? [] : Oe(W), [W, s, m]), L = E(() => {
|
|
280
|
+
if (s) {
|
|
281
|
+
const e = new Set(s.map((f) => f.name)), n = z.filter((f) => !e.has(f.name));
|
|
282
|
+
return [...s, ...n];
|
|
858
283
|
}
|
|
859
284
|
return z;
|
|
860
|
-
}, [
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
...
|
|
865
|
-
...d
|
|
866
|
-
// Individual column props override defaults
|
|
867
|
-
})) : a;
|
|
868
|
-
}, [s, i]), I = T(() => {
|
|
869
|
-
const a = we(o), d = {};
|
|
870
|
-
if (g !== void 0 && (d.sortable = g), l !== void 0 && (d.filterable = l), C !== void 0 && (d.selectable = C), j) {
|
|
871
|
-
const y = a?.icons || o?.icons || {};
|
|
872
|
-
d.icons = { ...j, ...y };
|
|
285
|
+
}, [s, z]), A = E(() => g && De(Ee(g), p), [g, p]), k = E(() => {
|
|
286
|
+
const e = ve(d), n = {};
|
|
287
|
+
if (R !== void 0 && (n.sortable = R), S !== void 0 && (n.filterable = S), P !== void 0 && (n.selectable = P), O) {
|
|
288
|
+
const f = e?.icons || d?.icons || {};
|
|
289
|
+
n.icons = { ...O, ...f };
|
|
873
290
|
}
|
|
874
|
-
if (
|
|
875
|
-
const
|
|
291
|
+
if (L.length > 0 && e) {
|
|
292
|
+
const f = e.plugins || [], I = new Set(f.map((T) => T.name)), $ = L.filter((T) => !I.has(T.name));
|
|
876
293
|
return {
|
|
877
|
-
...
|
|
878
|
-
...
|
|
879
|
-
plugins: [...
|
|
294
|
+
...e,
|
|
295
|
+
...n,
|
|
296
|
+
plugins: [...f, ...$]
|
|
880
297
|
};
|
|
881
298
|
}
|
|
882
|
-
return
|
|
883
|
-
}, [
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
}, [
|
|
887
|
-
|
|
888
|
-
}, [
|
|
889
|
-
|
|
890
|
-
}, [
|
|
891
|
-
|
|
892
|
-
}, [
|
|
893
|
-
|
|
894
|
-
}, [
|
|
895
|
-
|
|
896
|
-
}, [
|
|
897
|
-
const
|
|
898
|
-
if (!
|
|
899
|
-
const
|
|
900
|
-
|
|
901
|
-
let
|
|
902
|
-
const
|
|
903
|
-
|
|
299
|
+
return L.length > 0 && !e ? { ...n, plugins: L } : Object.keys(n).length > 0 ? { ...e, ...n } : e;
|
|
300
|
+
}, [d, L, R, S, P, O]);
|
|
301
|
+
v(() => {
|
|
302
|
+
q().setTypeDefaults(U);
|
|
303
|
+
}, [U]), v(() => {
|
|
304
|
+
c.current && (c.current.rows = o);
|
|
305
|
+
}, [o]), v(() => {
|
|
306
|
+
c.current && k && (c.current.gridConfig = k);
|
|
307
|
+
}, [k]), v(() => {
|
|
308
|
+
c.current && A && (c.current.columns = A);
|
|
309
|
+
}, [A]), v(() => {
|
|
310
|
+
c.current && u !== void 0 && (c.current.fitMode = u);
|
|
311
|
+
}, [u]), v(() => {
|
|
312
|
+
c.current && h !== void 0 && (c.current.loading = h);
|
|
313
|
+
}, [h]), v(() => {
|
|
314
|
+
const e = c.current;
|
|
315
|
+
if (!e) return;
|
|
316
|
+
const n = q();
|
|
317
|
+
e.__frameworkAdapter = n, ze(e), je(e, n);
|
|
318
|
+
let f = !1;
|
|
319
|
+
const I = requestAnimationFrame(() => {
|
|
320
|
+
f || (typeof e.refreshColumns == "function" && e.refreshColumns(), typeof e.refreshShellHeader == "function" && e.refreshShellHeader());
|
|
904
321
|
});
|
|
905
322
|
return () => {
|
|
906
|
-
|
|
323
|
+
f = !0, cancelAnimationFrame(I);
|
|
907
324
|
};
|
|
908
|
-
}, []),
|
|
909
|
-
if (!
|
|
910
|
-
const
|
|
911
|
-
let
|
|
912
|
-
return
|
|
913
|
-
|
|
325
|
+
}, []), v(() => {
|
|
326
|
+
if (!c.current || !l) return;
|
|
327
|
+
const e = c.current, n = "react-custom-styles";
|
|
328
|
+
let f = !0;
|
|
329
|
+
return e.ready?.().then(() => {
|
|
330
|
+
f && l && (e.registerStyles?.(n, l), M.current = n);
|
|
914
331
|
}), () => {
|
|
915
|
-
|
|
332
|
+
f = !1, M.current && (e.unregisterStyles?.(M.current), M.current = null);
|
|
916
333
|
};
|
|
917
|
-
}, [
|
|
918
|
-
const
|
|
919
|
-
if (!
|
|
920
|
-
const
|
|
921
|
-
return
|
|
922
|
-
|
|
334
|
+
}, [l]), v(() => {
|
|
335
|
+
const e = c.current;
|
|
336
|
+
if (!e) return;
|
|
337
|
+
const n = [];
|
|
338
|
+
return C && n.push(e.on("rows-change", (f) => C(f.rows))), () => {
|
|
339
|
+
n.forEach((f) => f());
|
|
923
340
|
};
|
|
924
|
-
}, [
|
|
925
|
-
const
|
|
926
|
-
for (const
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
const
|
|
930
|
-
if (!
|
|
931
|
-
const
|
|
932
|
-
for (const [
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
341
|
+
}, [C]);
|
|
342
|
+
const Z = E(() => Object.keys(B).filter((e) => typeof a[e] == "function").sort().join("|"), [a]), Q = b({});
|
|
343
|
+
for (const e of Object.keys(B))
|
|
344
|
+
Q.current[e] = a[e];
|
|
345
|
+
v(() => {
|
|
346
|
+
const e = c.current;
|
|
347
|
+
if (!e) return;
|
|
348
|
+
const n = [];
|
|
349
|
+
for (const [f, I] of Object.entries(B))
|
|
350
|
+
Z.includes(f) && n.push(
|
|
351
|
+
e.on(I, ($, T) => {
|
|
352
|
+
Q.current[f]?.($, T);
|
|
936
353
|
})
|
|
937
354
|
);
|
|
938
355
|
return () => {
|
|
939
|
-
|
|
356
|
+
n.forEach((f) => f());
|
|
940
357
|
};
|
|
941
|
-
}, [
|
|
942
|
-
|
|
358
|
+
}, [Z]), ce(
|
|
359
|
+
i,
|
|
943
360
|
() => ({
|
|
944
361
|
get element() {
|
|
945
|
-
return
|
|
362
|
+
return c.current;
|
|
946
363
|
},
|
|
947
364
|
async getConfig() {
|
|
948
|
-
return
|
|
365
|
+
return c.current?.getConfig?.() ?? {};
|
|
949
366
|
},
|
|
950
367
|
async ready() {
|
|
951
|
-
return
|
|
368
|
+
return c.current?.ready?.();
|
|
952
369
|
},
|
|
953
370
|
async forceLayout() {
|
|
954
|
-
return
|
|
371
|
+
return c.current?.forceLayout?.();
|
|
955
372
|
},
|
|
956
|
-
async toggleGroup(
|
|
957
|
-
return
|
|
373
|
+
async toggleGroup(e) {
|
|
374
|
+
return c.current?.toggleGroup?.(e);
|
|
958
375
|
},
|
|
959
|
-
registerStyles(
|
|
960
|
-
|
|
376
|
+
registerStyles(e, n) {
|
|
377
|
+
c.current?.registerStyles?.(e, n);
|
|
961
378
|
},
|
|
962
|
-
unregisterStyles(
|
|
963
|
-
|
|
379
|
+
unregisterStyles(e) {
|
|
380
|
+
c.current?.unregisterStyles?.(e);
|
|
964
381
|
},
|
|
965
|
-
setRowLoading(
|
|
966
|
-
|
|
382
|
+
setRowLoading(e, n) {
|
|
383
|
+
c.current?.setRowLoading?.(e, n);
|
|
967
384
|
},
|
|
968
|
-
setCellLoading(
|
|
969
|
-
|
|
385
|
+
setCellLoading(e, n, f) {
|
|
386
|
+
c.current?.setCellLoading?.(e, n, f);
|
|
970
387
|
},
|
|
971
|
-
isRowLoading(
|
|
972
|
-
return
|
|
388
|
+
isRowLoading(e) {
|
|
389
|
+
return c.current?.isRowLoading?.(e) ?? !1;
|
|
973
390
|
},
|
|
974
|
-
isCellLoading(
|
|
975
|
-
return
|
|
391
|
+
isCellLoading(e, n) {
|
|
392
|
+
return c.current?.isCellLoading?.(e, n) ?? !1;
|
|
976
393
|
},
|
|
977
394
|
clearAllLoading() {
|
|
978
|
-
|
|
395
|
+
c.current?.clearAllLoading?.();
|
|
979
396
|
}
|
|
980
397
|
}),
|
|
981
398
|
[]
|
|
982
399
|
);
|
|
983
|
-
const
|
|
984
|
-
return
|
|
985
|
-
const
|
|
986
|
-
return
|
|
987
|
-
|
|
400
|
+
const j = b(null);
|
|
401
|
+
return pe(() => {
|
|
402
|
+
const e = c.current;
|
|
403
|
+
return e && j.current && ee(e, j.current), () => {
|
|
404
|
+
e && ee(e, null);
|
|
988
405
|
};
|
|
989
|
-
}, []), /* @__PURE__ */
|
|
990
|
-
/* @__PURE__ */
|
|
991
|
-
/* @__PURE__ */
|
|
406
|
+
}, []), /* @__PURE__ */ le(V, { children: [
|
|
407
|
+
/* @__PURE__ */ w(Te, { ref: j }),
|
|
408
|
+
/* @__PURE__ */ w(
|
|
992
409
|
"tbw-grid",
|
|
993
410
|
{
|
|
994
|
-
ref: (
|
|
995
|
-
if (
|
|
996
|
-
|
|
997
|
-
|
|
411
|
+
ref: (e) => {
|
|
412
|
+
if (c.current = e, e && !K.current) {
|
|
413
|
+
K.current = !0;
|
|
414
|
+
const n = e;
|
|
415
|
+
k && (n.gridConfig = k), o && (n.rows = o), A && (n.columns = A);
|
|
998
416
|
}
|
|
999
417
|
},
|
|
1000
|
-
class:
|
|
1001
|
-
style:
|
|
1002
|
-
children: /* @__PURE__ */
|
|
418
|
+
class: y,
|
|
419
|
+
style: G,
|
|
420
|
+
children: /* @__PURE__ */ w(ae.Provider, { value: c, children: D })
|
|
1003
421
|
}
|
|
1004
422
|
)
|
|
1005
423
|
] });
|
|
1006
424
|
});
|
|
1007
|
-
function
|
|
425
|
+
function tr(r) {
|
|
1008
426
|
const {
|
|
1009
|
-
field:
|
|
1010
|
-
header:
|
|
1011
|
-
type:
|
|
1012
|
-
editable:
|
|
1013
|
-
sortable:
|
|
1014
|
-
resizable:
|
|
1015
|
-
width:
|
|
1016
|
-
minWidth:
|
|
1017
|
-
hidden:
|
|
1018
|
-
lockVisible:
|
|
1019
|
-
children:
|
|
1020
|
-
editor:
|
|
1021
|
-
options:
|
|
1022
|
-
multi:
|
|
1023
|
-
format:
|
|
1024
|
-
} =
|
|
1025
|
-
(
|
|
1026
|
-
|
|
427
|
+
field: t,
|
|
428
|
+
header: i,
|
|
429
|
+
type: o,
|
|
430
|
+
editable: d,
|
|
431
|
+
sortable: g,
|
|
432
|
+
resizable: p,
|
|
433
|
+
width: u,
|
|
434
|
+
minWidth: R,
|
|
435
|
+
hidden: S,
|
|
436
|
+
lockVisible: P,
|
|
437
|
+
children: h,
|
|
438
|
+
editor: l,
|
|
439
|
+
options: y,
|
|
440
|
+
multi: G,
|
|
441
|
+
format: D
|
|
442
|
+
} = r, s = b(null), m = x(
|
|
443
|
+
(c) => {
|
|
444
|
+
s.current = c, c && (h && Re(c, h), l && Pe(c, l));
|
|
1027
445
|
},
|
|
1028
|
-
[
|
|
1029
|
-
),
|
|
1030
|
-
field:
|
|
1031
|
-
ref:
|
|
446
|
+
[h, l, t]
|
|
447
|
+
), C = typeof u == "number" ? `${u}px` : u, a = {
|
|
448
|
+
field: t,
|
|
449
|
+
ref: m
|
|
1032
450
|
};
|
|
1033
|
-
return
|
|
451
|
+
return i !== void 0 && (a.header = i), o !== void 0 && (a.type = o), d !== void 0 && (a.editable = d), g !== void 0 && (a.sortable = g), p !== void 0 && (a.resizable = p), C !== void 0 && (a.width = C), R !== void 0 && (a["min-width"] = R), S !== void 0 && (a.hidden = S), P !== void 0 && (a["lock-visible"] = P), G !== void 0 && (a.multi = G), D && (a["data-has-format"] = "true"), y && (a["data-has-options"] = "true"), /* @__PURE__ */ w("tbw-grid-column", { ...a });
|
|
1034
452
|
}
|
|
1035
|
-
function
|
|
1036
|
-
return /* @__PURE__ */
|
|
453
|
+
function nr({ children: r }) {
|
|
454
|
+
return /* @__PURE__ */ w("tbw-grid-tool-buttons", { children: r });
|
|
1037
455
|
}
|
|
1038
|
-
const
|
|
1039
|
-
let
|
|
1040
|
-
return
|
|
456
|
+
const or = ({ icons: r, defaults: t, children: i }) => {
|
|
457
|
+
let o = i;
|
|
458
|
+
return t && (o = /* @__PURE__ */ w(Ae, { defaults: t, children: o })), r && (o = /* @__PURE__ */ w(Fe, { icons: r, children: o })), /* @__PURE__ */ w(V, { children: o });
|
|
1041
459
|
};
|
|
1042
|
-
function
|
|
1043
|
-
const
|
|
1044
|
-
|
|
1045
|
-
let
|
|
460
|
+
function ir(r) {
|
|
461
|
+
const t = b(null), [i, o] = X(!1), [d, g] = X(null), p = b(null), u = x(() => r ? (p.current ??= document.querySelector(r), p.current) : t.current?.element ?? null, [r]);
|
|
462
|
+
v(() => {
|
|
463
|
+
let s = !0;
|
|
1046
464
|
return (async () => {
|
|
1047
465
|
try {
|
|
1048
|
-
if (
|
|
1049
|
-
const
|
|
1050
|
-
if (!
|
|
1051
|
-
if (
|
|
1052
|
-
|
|
1053
|
-
const
|
|
1054
|
-
|
|
466
|
+
if (r) {
|
|
467
|
+
const C = document.querySelector(r);
|
|
468
|
+
if (!C) return;
|
|
469
|
+
if (p.current = C, await C.ready?.(), s) {
|
|
470
|
+
o(!0);
|
|
471
|
+
const a = await C.getConfig?.();
|
|
472
|
+
s && a && g(a);
|
|
1055
473
|
}
|
|
1056
474
|
} else {
|
|
1057
|
-
const
|
|
1058
|
-
if (!
|
|
1059
|
-
if (await
|
|
1060
|
-
|
|
1061
|
-
const
|
|
1062
|
-
|
|
475
|
+
const C = t.current;
|
|
476
|
+
if (!C) return;
|
|
477
|
+
if (await C.ready?.(), s) {
|
|
478
|
+
o(!0);
|
|
479
|
+
const a = await C.getConfig?.();
|
|
480
|
+
s && a && g(a);
|
|
1063
481
|
}
|
|
1064
482
|
}
|
|
1065
483
|
} catch {
|
|
1066
484
|
}
|
|
1067
485
|
})(), () => {
|
|
1068
|
-
|
|
486
|
+
s = !1;
|
|
1069
487
|
};
|
|
1070
|
-
}, [
|
|
1071
|
-
const
|
|
1072
|
-
const
|
|
1073
|
-
if (
|
|
1074
|
-
return await
|
|
1075
|
-
const
|
|
1076
|
-
return
|
|
1077
|
-
}, [
|
|
1078
|
-
const
|
|
1079
|
-
if (
|
|
1080
|
-
await
|
|
488
|
+
}, [r]);
|
|
489
|
+
const R = x(async () => {
|
|
490
|
+
const s = u();
|
|
491
|
+
if (s)
|
|
492
|
+
return await s.getConfig?.() ?? null;
|
|
493
|
+
const m = t.current;
|
|
494
|
+
return m ? await m.getConfig?.() ?? null : null;
|
|
495
|
+
}, [u]), S = x(async () => {
|
|
496
|
+
const s = u();
|
|
497
|
+
if (s) {
|
|
498
|
+
await s.forceLayout?.();
|
|
1081
499
|
return;
|
|
1082
500
|
}
|
|
1083
|
-
const
|
|
1084
|
-
|
|
1085
|
-
}, [
|
|
1086
|
-
async (
|
|
1087
|
-
const
|
|
1088
|
-
if (
|
|
1089
|
-
await
|
|
501
|
+
const m = t.current;
|
|
502
|
+
m && await m.forceLayout?.();
|
|
503
|
+
}, [u]), P = x(
|
|
504
|
+
async (s) => {
|
|
505
|
+
const m = u();
|
|
506
|
+
if (m) {
|
|
507
|
+
await m.toggleGroup?.(s);
|
|
1090
508
|
return;
|
|
1091
509
|
}
|
|
1092
|
-
const
|
|
1093
|
-
|
|
510
|
+
const C = t.current;
|
|
511
|
+
C && await C.toggleGroup?.(s);
|
|
1094
512
|
},
|
|
1095
|
-
[
|
|
1096
|
-
),
|
|
1097
|
-
(
|
|
1098
|
-
[
|
|
1099
|
-
),
|
|
1100
|
-
((
|
|
1101
|
-
[
|
|
1102
|
-
),
|
|
1103
|
-
(
|
|
1104
|
-
const
|
|
1105
|
-
if (
|
|
1106
|
-
|
|
513
|
+
[u]
|
|
514
|
+
), h = x(
|
|
515
|
+
(s) => u()?.getPlugin?.(s),
|
|
516
|
+
[u]
|
|
517
|
+
), l = x(
|
|
518
|
+
((s) => u()?.getPluginByName?.(s)),
|
|
519
|
+
[u]
|
|
520
|
+
), y = x(
|
|
521
|
+
(s, m) => {
|
|
522
|
+
const C = u();
|
|
523
|
+
if (C) {
|
|
524
|
+
C.registerStyles?.(s, m);
|
|
1107
525
|
return;
|
|
1108
526
|
}
|
|
1109
|
-
|
|
527
|
+
t.current?.registerStyles?.(s, m);
|
|
1110
528
|
},
|
|
1111
|
-
[
|
|
1112
|
-
),
|
|
1113
|
-
(
|
|
1114
|
-
const
|
|
1115
|
-
if (
|
|
1116
|
-
|
|
529
|
+
[u]
|
|
530
|
+
), G = x(
|
|
531
|
+
(s) => {
|
|
532
|
+
const m = u();
|
|
533
|
+
if (m) {
|
|
534
|
+
m.unregisterStyles?.(s);
|
|
1117
535
|
return;
|
|
1118
536
|
}
|
|
1119
|
-
|
|
537
|
+
t.current?.unregisterStyles?.(s);
|
|
1120
538
|
},
|
|
1121
|
-
[
|
|
1122
|
-
),
|
|
539
|
+
[u]
|
|
540
|
+
), D = x(() => d?.columns ? d.columns.filter((s) => !s.hidden) : [], [d]);
|
|
1123
541
|
return {
|
|
1124
|
-
ref:
|
|
1125
|
-
element:
|
|
1126
|
-
isReady:
|
|
1127
|
-
config:
|
|
1128
|
-
getConfig:
|
|
1129
|
-
forceLayout:
|
|
1130
|
-
toggleGroup:
|
|
1131
|
-
getPlugin:
|
|
1132
|
-
getPluginByName:
|
|
1133
|
-
registerStyles:
|
|
1134
|
-
unregisterStyles:
|
|
1135
|
-
getVisibleColumns:
|
|
542
|
+
ref: t,
|
|
543
|
+
element: u(),
|
|
544
|
+
isReady: i,
|
|
545
|
+
config: d,
|
|
546
|
+
getConfig: R,
|
|
547
|
+
forceLayout: S,
|
|
548
|
+
toggleGroup: P,
|
|
549
|
+
getPlugin: h,
|
|
550
|
+
getPluginByName: l,
|
|
551
|
+
registerStyles: y,
|
|
552
|
+
unregisterStyles: G,
|
|
553
|
+
getVisibleColumns: D
|
|
1136
554
|
};
|
|
1137
555
|
}
|
|
1138
|
-
function
|
|
1139
|
-
const { open:
|
|
1140
|
-
|
|
1141
|
-
if (!
|
|
1142
|
-
const
|
|
1143
|
-
if (!
|
|
1144
|
-
const
|
|
1145
|
-
if (
|
|
1146
|
-
return
|
|
1147
|
-
|
|
556
|
+
function sr(r, t = {}) {
|
|
557
|
+
const { open: i = !0, gridElement: o } = t, d = F(ae);
|
|
558
|
+
v(() => {
|
|
559
|
+
if (!i) return;
|
|
560
|
+
const g = r.current;
|
|
561
|
+
if (!g) return;
|
|
562
|
+
const p = o ?? g.closest("tbw-grid") ?? d?.current ?? null;
|
|
563
|
+
if (p)
|
|
564
|
+
return p.registerExternalFocusContainer?.(g), () => {
|
|
565
|
+
p.unregisterExternalFocusContainer?.(g);
|
|
1148
566
|
};
|
|
1149
|
-
}, [
|
|
567
|
+
}, [i, o, d, r]);
|
|
1150
568
|
}
|
|
1151
569
|
export {
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
570
|
+
rr as DataGrid,
|
|
571
|
+
we as GridAdapter,
|
|
572
|
+
tr as GridColumn,
|
|
573
|
+
gr as GridDetailPanel,
|
|
574
|
+
Fe as GridIconProvider,
|
|
575
|
+
or as GridProvider,
|
|
576
|
+
ur as GridResponsiveCard,
|
|
577
|
+
nr as GridToolButtons,
|
|
578
|
+
fr as GridToolPanel,
|
|
579
|
+
Ae as GridTypeProvider,
|
|
580
|
+
De as applyColumnDefaults,
|
|
581
|
+
Ze as hasColumnShorthands,
|
|
582
|
+
Ee as normalizeColumns,
|
|
583
|
+
xe as parseColumnShorthand,
|
|
584
|
+
ir as useGrid,
|
|
585
|
+
Qe as useGridIcons,
|
|
586
|
+
sr as useGridOverlay,
|
|
587
|
+
Xe as useGridTypeDefaults,
|
|
588
|
+
er as useTypeDefault
|
|
1167
589
|
};
|