@toolbox-web/grid-react 0.18.4 → 0.18.5
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/portal-bridge-B0mjqzak.js +42 -0
- package/features/filtering.d.ts.map +1 -1
- package/features/filtering.js +32 -33
- package/features/grouping-columns.js +19 -21
- package/features/grouping-rows.js +15 -18
- package/features/pinned-rows.js +14 -17
- package/index.js +646 -624
- package/lib/data-grid.d.ts.map +1 -1
- package/lib/portal-bridge.d.ts +56 -0
- package/lib/portal-bridge.d.ts.map +1 -0
- package/lib/portal-manager.d.ts +26 -0
- package/lib/portal-manager.d.ts.map +1 -0
- package/lib/react-column-config.d.ts +2 -2
- package/lib/react-column-config.d.ts.map +1 -1
- package/lib/react-grid-adapter.d.ts +17 -10
- package/lib/react-grid-adapter.d.ts.map +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import { jsx as E, Fragment as
|
|
2
|
-
import { DataGridElement as
|
|
3
|
-
import { createContext as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { createPluginsFromFeatures as
|
|
7
|
-
import { G as
|
|
8
|
-
function
|
|
1
|
+
import { jsx as E, Fragment as ie, jsxs as Se } from "react/jsx-runtime";
|
|
2
|
+
import { DataGridElement as ke } from "@toolbox-web/grid";
|
|
3
|
+
import { createContext as ve, useContext as z, useRef as b, useCallback as C, useEffect as R, forwardRef as Ce, useReducer as xe, useImperativeHandle as Re, useMemo as x, useLayoutEffect as Ge, Children as De, isValidElement as Ae, useState as fe } from "react";
|
|
4
|
+
import { a as w, r as _, s as ge } from "./chunks/portal-bridge-B0mjqzak.js";
|
|
5
|
+
import { createPortal as Te, flushSync as pe } from "react-dom";
|
|
6
|
+
import { createPluginsFromFeatures as Ne } from "@toolbox-web/grid/features/registry";
|
|
7
|
+
import { G as Ke } from "./chunks/grid-element-context-BU3WvNtM.js";
|
|
8
|
+
function Ie(n) {
|
|
9
9
|
return n.charAt(0).toUpperCase() + n.slice(1);
|
|
10
10
|
}
|
|
11
|
-
function
|
|
12
|
-
return n.toLowerCase() === "id" ? "ID" : n.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[_-]/g, " ").split(" ").filter(Boolean).map(
|
|
11
|
+
function me(n) {
|
|
12
|
+
return n.toLowerCase() === "id" ? "ID" : n.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[_-]/g, " ").split(" ").filter(Boolean).map(Ie).join(" ");
|
|
13
13
|
}
|
|
14
|
-
const
|
|
15
|
-
function
|
|
16
|
-
const
|
|
17
|
-
if (
|
|
18
|
-
const
|
|
19
|
-
if (
|
|
20
|
-
const r = n.slice(0,
|
|
14
|
+
const Le = /* @__PURE__ */ new Set(["string", "number", "boolean", "date", "datetime", "currency"]);
|
|
15
|
+
function Fe(n) {
|
|
16
|
+
const e = n.lastIndexOf(":");
|
|
17
|
+
if (e > 0) {
|
|
18
|
+
const t = n.slice(e + 1).toLowerCase();
|
|
19
|
+
if (Le.has(t)) {
|
|
20
|
+
const r = n.slice(0, e);
|
|
21
21
|
return {
|
|
22
22
|
field: r,
|
|
23
|
-
header:
|
|
24
|
-
type:
|
|
23
|
+
header: me(r),
|
|
24
|
+
type: t
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
return {
|
|
29
29
|
field: n,
|
|
30
|
-
header:
|
|
30
|
+
header: me(n)
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
return n.map((
|
|
33
|
+
function Me(n) {
|
|
34
|
+
return n.map((e) => typeof e == "string" ? Fe(e) : e);
|
|
35
35
|
}
|
|
36
36
|
const U = {
|
|
37
37
|
onCellClick: "cell-click",
|
|
@@ -59,265 +59,285 @@ const U = {
|
|
|
59
59
|
onExportComplete: "export-complete",
|
|
60
60
|
onPrintStart: "print-start",
|
|
61
61
|
onPrintComplete: "print-complete"
|
|
62
|
-
},
|
|
63
|
-
function
|
|
64
|
-
return z(
|
|
62
|
+
}, se = ve(null), qe = ({ icons: n, children: e }) => /* @__PURE__ */ E(se.Provider, { value: n, children: e });
|
|
63
|
+
function yt() {
|
|
64
|
+
return z(se);
|
|
65
65
|
}
|
|
66
|
-
const
|
|
67
|
-
function
|
|
68
|
-
const
|
|
69
|
-
if (
|
|
70
|
-
const r =
|
|
66
|
+
const He = se, Q = /* @__PURE__ */ new WeakMap(), X = /* @__PURE__ */ new Map();
|
|
67
|
+
function we(n) {
|
|
68
|
+
const e = n.querySelector("tbw-grid-responsive-card");
|
|
69
|
+
if (e) {
|
|
70
|
+
const r = Q.get(e);
|
|
71
71
|
if (r) return r;
|
|
72
72
|
}
|
|
73
|
-
const
|
|
74
|
-
if (
|
|
75
|
-
return
|
|
73
|
+
const t = n.id || n.getAttribute("data-grid-id");
|
|
74
|
+
if (t)
|
|
75
|
+
return X.get(t);
|
|
76
76
|
}
|
|
77
|
-
function
|
|
78
|
-
const { children:
|
|
79
|
-
(
|
|
80
|
-
if (r.current =
|
|
81
|
-
|
|
82
|
-
const i =
|
|
77
|
+
function Oe(n) {
|
|
78
|
+
const { children: e, cardRowHeight: t = "auto" } = n, r = b(null), o = C(
|
|
79
|
+
(c) => {
|
|
80
|
+
if (r.current = c, !c) return;
|
|
81
|
+
Q.set(c, e);
|
|
82
|
+
const i = c.closest("tbw-grid");
|
|
83
83
|
if (i) {
|
|
84
|
-
const
|
|
85
|
-
|
|
84
|
+
const g = i.id || i.getAttribute("data-grid-id");
|
|
85
|
+
g && X.set(g, e);
|
|
86
86
|
}
|
|
87
87
|
},
|
|
88
|
-
[
|
|
88
|
+
[e]
|
|
89
89
|
);
|
|
90
|
-
|
|
91
|
-
const
|
|
92
|
-
if (
|
|
93
|
-
|
|
94
|
-
const i =
|
|
90
|
+
R(() => () => {
|
|
91
|
+
const c = r.current;
|
|
92
|
+
if (c) {
|
|
93
|
+
Q.delete(c);
|
|
94
|
+
const i = c.closest("tbw-grid");
|
|
95
95
|
if (i) {
|
|
96
|
-
const
|
|
97
|
-
|
|
96
|
+
const g = i.id || i.getAttribute("data-grid-id");
|
|
97
|
+
g && X.delete(g);
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
}, []);
|
|
101
|
-
const
|
|
102
|
-
return /* @__PURE__ */ E("tbw-grid-responsive-card", { ref: o, cardRowHeight:
|
|
101
|
+
const s = t === "auto" ? "auto" : String(t);
|
|
102
|
+
return /* @__PURE__ */ E("tbw-grid-responsive-card", { ref: o, cardRowHeight: s });
|
|
103
103
|
}
|
|
104
|
-
|
|
105
|
-
const $ =
|
|
106
|
-
function
|
|
104
|
+
Oe.displayName = "GridResponsiveCard";
|
|
105
|
+
const $ = ve(null), je = ({ defaults: n, children: e }) => /* @__PURE__ */ E($.Provider, { value: n, children: e });
|
|
106
|
+
function ht() {
|
|
107
107
|
return z($);
|
|
108
108
|
}
|
|
109
|
-
function
|
|
109
|
+
function vt(n) {
|
|
110
110
|
return z($)?.[n];
|
|
111
111
|
}
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
112
|
+
const Be = $, _e = Ce(function(e, t) {
|
|
113
|
+
const r = b(/* @__PURE__ */ new Map()), [, o] = xe((m) => m + 1, 0), s = b(!1), c = b(0), i = () => {
|
|
114
|
+
s.current || (s.current = !0, queueMicrotask(() => {
|
|
115
|
+
s.current = !1, pe(o), g();
|
|
116
|
+
}));
|
|
117
|
+
}, g = () => {
|
|
118
|
+
c.current || (c.current = requestAnimationFrame(() => {
|
|
119
|
+
c.current = 0;
|
|
120
|
+
let m = !1;
|
|
121
|
+
for (const [v, P] of r.current)
|
|
122
|
+
P.container.isConnected || (r.current.delete(v), m = !0);
|
|
123
|
+
m && pe(o);
|
|
124
|
+
}));
|
|
125
|
+
};
|
|
126
|
+
Re(
|
|
127
|
+
t,
|
|
128
|
+
() => ({
|
|
129
|
+
renderPortal(m, v, P) {
|
|
130
|
+
r.current.set(m, { container: v, element: P }), i();
|
|
131
|
+
},
|
|
132
|
+
removePortal(m) {
|
|
133
|
+
r.current.delete(m) && i();
|
|
134
|
+
},
|
|
135
|
+
clear() {
|
|
136
|
+
r.current.size > 0 && (r.current.clear(), c.current && (cancelAnimationFrame(c.current), c.current = 0), i());
|
|
120
137
|
}
|
|
121
|
-
|
|
122
|
-
|
|
138
|
+
}),
|
|
139
|
+
// forceRender is stable (useReducer dispatch), refs are stable
|
|
140
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
141
|
+
[]
|
|
142
|
+
);
|
|
143
|
+
const f = [];
|
|
144
|
+
for (const [m, { container: v, element: P }] of r.current)
|
|
145
|
+
f.push(Te(P, v, m));
|
|
146
|
+
return /* @__PURE__ */ E(ie, { children: f });
|
|
147
|
+
}), Y = /* @__PURE__ */ Symbol("reactProcessed"), D = [];
|
|
148
|
+
function ze(n) {
|
|
149
|
+
for (let e = D.length - 1; e >= 0; e--) {
|
|
150
|
+
const t = D[e];
|
|
151
|
+
n.contains(t.container) && t.container.classList.contains("react-cell-editor") && (_(t.key), D.splice(e, 1));
|
|
123
152
|
}
|
|
124
153
|
}
|
|
125
|
-
function
|
|
126
|
-
const
|
|
127
|
-
return (
|
|
128
|
-
const r =
|
|
154
|
+
function $e(n) {
|
|
155
|
+
const e = /* @__PURE__ */ new WeakMap();
|
|
156
|
+
return (t) => {
|
|
157
|
+
const r = t.cellEl;
|
|
129
158
|
if (r) {
|
|
130
|
-
const
|
|
131
|
-
if (
|
|
132
|
-
return
|
|
133
|
-
l.root.render(n(e));
|
|
134
|
-
}), l.container;
|
|
159
|
+
const c = e.get(r);
|
|
160
|
+
if (c)
|
|
161
|
+
return w(c.container, n(t), c.portalKey), c.container;
|
|
135
162
|
}
|
|
136
163
|
const o = document.createElement("div");
|
|
137
164
|
o.className = "react-cell-renderer", o.style.display = "contents";
|
|
138
|
-
const
|
|
139
|
-
return
|
|
140
|
-
a.render(n(e));
|
|
141
|
-
}), r && t.set(r, { root: a, container: o }), I.push({ root: a, container: o }), o;
|
|
165
|
+
const s = w(o, n(t));
|
|
166
|
+
return r && e.set(r, { portalKey: s, container: o }), D.push({ key: s, container: o }), o;
|
|
142
167
|
};
|
|
143
168
|
}
|
|
144
|
-
function
|
|
145
|
-
return (
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
const r =
|
|
149
|
-
return
|
|
150
|
-
r.render(n(t));
|
|
151
|
-
}), I.push({ root: r, container: e }), e;
|
|
169
|
+
function Ve(n) {
|
|
170
|
+
return (e) => {
|
|
171
|
+
const t = document.createElement("div");
|
|
172
|
+
t.className = "react-cell-editor", t.style.display = "contents";
|
|
173
|
+
const r = w(t, n(e));
|
|
174
|
+
return D.push({ key: r, container: t }), t;
|
|
152
175
|
};
|
|
153
176
|
}
|
|
154
|
-
function
|
|
155
|
-
return (
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
const r =
|
|
159
|
-
return
|
|
160
|
-
r.render(n(t));
|
|
161
|
-
}), I.push({ root: r, container: e }), e;
|
|
177
|
+
function We(n) {
|
|
178
|
+
return (e) => {
|
|
179
|
+
const t = document.createElement("div");
|
|
180
|
+
t.className = "react-header-renderer", t.style.display = "contents";
|
|
181
|
+
const r = w(t, n(e));
|
|
182
|
+
return D.push({ key: r, container: t }), t;
|
|
162
183
|
};
|
|
163
184
|
}
|
|
164
|
-
function
|
|
165
|
-
return (
|
|
166
|
-
const
|
|
167
|
-
|
|
168
|
-
const r =
|
|
169
|
-
return
|
|
170
|
-
r.render(n(t));
|
|
171
|
-
}), I.push({ root: r, container: e }), e;
|
|
185
|
+
function Je(n) {
|
|
186
|
+
return (e) => {
|
|
187
|
+
const t = document.createElement("div");
|
|
188
|
+
t.className = "react-header-label-renderer", t.style.display = "contents";
|
|
189
|
+
const r = w(t, n(e));
|
|
190
|
+
return D.push({ key: r, container: t }), t;
|
|
172
191
|
};
|
|
173
192
|
}
|
|
174
|
-
function
|
|
175
|
-
return (
|
|
176
|
-
const
|
|
177
|
-
if (
|
|
178
|
-
return
|
|
193
|
+
function Ue(n) {
|
|
194
|
+
return (e) => {
|
|
195
|
+
const t = n(e);
|
|
196
|
+
if (t instanceof HTMLElement || typeof t == "string")
|
|
197
|
+
return t;
|
|
179
198
|
const r = document.createElement("div");
|
|
180
199
|
r.className = "react-loading-renderer", r.style.display = "contents";
|
|
181
|
-
const o =
|
|
182
|
-
return
|
|
183
|
-
o.render(e);
|
|
184
|
-
}), I.push({ root: o, container: r }), r;
|
|
200
|
+
const o = w(r, t);
|
|
201
|
+
return D.push({ key: o, container: r }), r;
|
|
185
202
|
};
|
|
186
203
|
}
|
|
187
|
-
function
|
|
204
|
+
function Pe(n) {
|
|
188
205
|
if (!n) return;
|
|
189
|
-
if (n[
|
|
206
|
+
if (n[Y]) return n;
|
|
190
207
|
if (n.loadingRenderer && typeof n.loadingRenderer == "function") {
|
|
191
208
|
const r = n.loadingRenderer;
|
|
192
209
|
n = {
|
|
193
210
|
...n,
|
|
194
|
-
loadingRenderer:
|
|
211
|
+
loadingRenderer: Ue(r)
|
|
195
212
|
};
|
|
196
213
|
}
|
|
197
214
|
if (!n.columns) {
|
|
198
215
|
const r = n;
|
|
199
|
-
return r[
|
|
216
|
+
return r[Y] = !0, r;
|
|
200
217
|
}
|
|
201
|
-
const
|
|
202
|
-
const { renderer: o, editor:
|
|
203
|
-
return o && (
|
|
204
|
-
}),
|
|
218
|
+
const e = n.columns.map((r) => {
|
|
219
|
+
const { renderer: o, editor: s, headerRenderer: c, headerLabelRenderer: i, ...g } = r, f = { ...g };
|
|
220
|
+
return o && (f.renderer = $e(o)), s && (f.editor = Ve(s)), c && (f.headerRenderer = We(c)), i && (f.headerLabelRenderer = Je(i)), f;
|
|
221
|
+
}), t = {
|
|
205
222
|
...n,
|
|
206
|
-
columns:
|
|
223
|
+
columns: e
|
|
207
224
|
};
|
|
208
|
-
return
|
|
225
|
+
return t[Y] = !0, t;
|
|
209
226
|
}
|
|
210
|
-
const
|
|
211
|
-
function
|
|
212
|
-
const
|
|
213
|
-
if (
|
|
214
|
-
const r =
|
|
227
|
+
const ee = /* @__PURE__ */ new WeakMap(), te = /* @__PURE__ */ new Map();
|
|
228
|
+
function Ye(n) {
|
|
229
|
+
const e = n.querySelector("tbw-grid-detail");
|
|
230
|
+
if (e) {
|
|
231
|
+
const r = ee.get(e);
|
|
215
232
|
if (r) return r;
|
|
216
233
|
}
|
|
217
|
-
const
|
|
218
|
-
if (
|
|
219
|
-
return
|
|
234
|
+
const t = n.id || n.getAttribute("data-grid-id");
|
|
235
|
+
if (t)
|
|
236
|
+
return te.get(t);
|
|
220
237
|
}
|
|
221
|
-
function
|
|
222
|
-
const { children:
|
|
238
|
+
function Ze(n) {
|
|
239
|
+
const { children: e, showExpandColumn: t = !0, animation: r = "slide" } = n, o = b(null), s = C(
|
|
223
240
|
(i) => {
|
|
224
241
|
if (o.current = i, !i) return;
|
|
225
|
-
|
|
226
|
-
const
|
|
227
|
-
if (
|
|
228
|
-
const
|
|
229
|
-
|
|
242
|
+
ee.set(i, e);
|
|
243
|
+
const g = i.closest("tbw-grid");
|
|
244
|
+
if (g) {
|
|
245
|
+
const f = g.id || g.getAttribute("data-grid-id");
|
|
246
|
+
f && te.set(f, e);
|
|
230
247
|
}
|
|
231
248
|
},
|
|
232
|
-
[
|
|
249
|
+
[e]
|
|
233
250
|
);
|
|
234
|
-
return
|
|
251
|
+
return R(() => () => {
|
|
235
252
|
const i = o.current;
|
|
236
253
|
if (i) {
|
|
237
|
-
|
|
238
|
-
const
|
|
239
|
-
if (
|
|
240
|
-
const
|
|
241
|
-
|
|
254
|
+
ee.delete(i);
|
|
255
|
+
const g = i.closest("tbw-grid");
|
|
256
|
+
if (g) {
|
|
257
|
+
const m = g.id || g.getAttribute("data-grid-id");
|
|
258
|
+
m && te.delete(m);
|
|
242
259
|
}
|
|
243
|
-
const
|
|
244
|
-
|
|
260
|
+
const f = i.parentNode;
|
|
261
|
+
f && f.contains(i);
|
|
245
262
|
}
|
|
246
263
|
}, []), /* @__PURE__ */ E(
|
|
247
264
|
"tbw-grid-detail",
|
|
248
265
|
{
|
|
249
|
-
ref:
|
|
250
|
-
showExpandColumn:
|
|
266
|
+
ref: s,
|
|
267
|
+
showExpandColumn: t ? void 0 : "false",
|
|
251
268
|
animation: r === !1 ? "false" : r
|
|
252
269
|
}
|
|
253
270
|
);
|
|
254
271
|
}
|
|
255
|
-
|
|
256
|
-
const
|
|
257
|
-
function
|
|
258
|
-
const
|
|
259
|
-
if (
|
|
260
|
-
const
|
|
261
|
-
if (
|
|
262
|
-
return
|
|
272
|
+
Ze.displayName = "GridDetailPanel";
|
|
273
|
+
const re = /* @__PURE__ */ new WeakMap(), ne = /* @__PURE__ */ new Map();
|
|
274
|
+
function Qe(n) {
|
|
275
|
+
const e = re.get(n);
|
|
276
|
+
if (e) return e;
|
|
277
|
+
const t = n.id;
|
|
278
|
+
if (t)
|
|
279
|
+
return ne.get(t);
|
|
263
280
|
}
|
|
264
|
-
function
|
|
265
|
-
const { id:
|
|
266
|
-
(
|
|
267
|
-
i.current =
|
|
281
|
+
function Ct(n) {
|
|
282
|
+
const { id: e, title: t, icon: r, tooltip: o, order: s = 100, children: c } = n, i = b(null), g = C(
|
|
283
|
+
(f) => {
|
|
284
|
+
i.current = f, f && (re.set(f, c), e && ne.set(e, c));
|
|
268
285
|
},
|
|
269
|
-
[
|
|
286
|
+
[c, e]
|
|
270
287
|
);
|
|
271
|
-
return
|
|
272
|
-
const
|
|
273
|
-
|
|
274
|
-
}, [
|
|
288
|
+
return R(() => () => {
|
|
289
|
+
const f = i.current;
|
|
290
|
+
f && (re.delete(f), e && ne.delete(e));
|
|
291
|
+
}, [e]), /* @__PURE__ */ E(
|
|
275
292
|
"tbw-grid-tool-panel",
|
|
276
293
|
{
|
|
277
|
-
ref:
|
|
278
|
-
id:
|
|
279
|
-
title:
|
|
294
|
+
ref: g,
|
|
295
|
+
id: e,
|
|
296
|
+
title: t,
|
|
280
297
|
icon: r,
|
|
281
298
|
tooltip: o,
|
|
282
|
-
order:
|
|
299
|
+
order: s?.toString()
|
|
283
300
|
}
|
|
284
301
|
);
|
|
285
302
|
}
|
|
286
|
-
const
|
|
287
|
-
function
|
|
288
|
-
const
|
|
289
|
-
if (r.renderer =
|
|
290
|
-
const o =
|
|
291
|
-
o.renderer =
|
|
303
|
+
const A = /* @__PURE__ */ new WeakMap(), T = /* @__PURE__ */ new Map();
|
|
304
|
+
function Xe(n, e) {
|
|
305
|
+
const t = n.getAttribute("field"), r = A.get(n) ?? {};
|
|
306
|
+
if (r.renderer = e, A.set(n, r), t) {
|
|
307
|
+
const o = T.get(t) ?? {};
|
|
308
|
+
o.renderer = e, T.set(t, o);
|
|
292
309
|
}
|
|
293
310
|
}
|
|
294
|
-
function
|
|
295
|
-
const
|
|
296
|
-
if (r.editor =
|
|
297
|
-
const o =
|
|
298
|
-
o.editor =
|
|
311
|
+
function et(n, e) {
|
|
312
|
+
const t = n.getAttribute("field"), r = A.get(n) ?? {};
|
|
313
|
+
if (r.editor = e, A.set(n, r), t) {
|
|
314
|
+
const o = T.get(t) ?? {};
|
|
315
|
+
o.editor = e, T.set(t, o);
|
|
299
316
|
}
|
|
300
317
|
}
|
|
301
|
-
function
|
|
302
|
-
let
|
|
303
|
-
if (!
|
|
304
|
-
const
|
|
305
|
-
|
|
318
|
+
function tt(n) {
|
|
319
|
+
let e = A.get(n)?.renderer;
|
|
320
|
+
if (!e) {
|
|
321
|
+
const t = n.getAttribute("field");
|
|
322
|
+
t && (e = T.get(t)?.renderer);
|
|
306
323
|
}
|
|
307
|
-
return
|
|
324
|
+
return e;
|
|
308
325
|
}
|
|
309
|
-
function
|
|
310
|
-
let
|
|
311
|
-
if (!
|
|
312
|
-
const
|
|
313
|
-
|
|
326
|
+
function rt(n) {
|
|
327
|
+
let e = A.get(n)?.editor;
|
|
328
|
+
if (!e) {
|
|
329
|
+
const t = n.getAttribute("field");
|
|
330
|
+
t && (e = T.get(t)?.editor);
|
|
314
331
|
}
|
|
315
|
-
return
|
|
332
|
+
return e;
|
|
316
333
|
}
|
|
317
|
-
class
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
334
|
+
class be {
|
|
335
|
+
/** Portal keys for all managed portals (for cleanup on destroy). */
|
|
336
|
+
allPortalKeys = /* @__PURE__ */ new Set();
|
|
337
|
+
/** Portal keys for editor-specific portals (for per-cell cleanup via releaseCell). */
|
|
338
|
+
editorPortalKeys = /* @__PURE__ */ new Set();
|
|
339
|
+
/** Maps portal keys to their containers (for container-based lookups in releaseCell/unmount). */
|
|
340
|
+
keyToContainer = /* @__PURE__ */ new Map();
|
|
321
341
|
typeDefaults = null;
|
|
322
342
|
/**
|
|
323
343
|
* Sets the type defaults map for this adapter.
|
|
@@ -325,151 +345,157 @@ class he {
|
|
|
325
345
|
*
|
|
326
346
|
* @internal
|
|
327
347
|
*/
|
|
328
|
-
setTypeDefaults(
|
|
329
|
-
this.typeDefaults =
|
|
348
|
+
setTypeDefaults(e) {
|
|
349
|
+
this.typeDefaults = e;
|
|
330
350
|
}
|
|
331
351
|
/**
|
|
332
352
|
* FrameworkAdapter.processConfig implementation.
|
|
333
353
|
* Called automatically by the grid's `set gridConfig` setter.
|
|
334
354
|
* Converts React renderer/editor functions to DOM-returning functions.
|
|
335
355
|
*/
|
|
336
|
-
processConfig(
|
|
337
|
-
return
|
|
356
|
+
processConfig(e) {
|
|
357
|
+
return Pe(e) ?? e;
|
|
338
358
|
}
|
|
339
359
|
/**
|
|
340
360
|
* Determines if this adapter can handle the given element.
|
|
341
361
|
* Checks if a renderer or editor is registered for this element.
|
|
342
362
|
*/
|
|
343
|
-
canHandle(
|
|
344
|
-
const
|
|
345
|
-
let r =
|
|
346
|
-
if (!r &&
|
|
347
|
-
const
|
|
348
|
-
|
|
363
|
+
canHandle(e) {
|
|
364
|
+
const t = e.getAttribute("field");
|
|
365
|
+
let r = A.get(e);
|
|
366
|
+
if (!r && t) {
|
|
367
|
+
const c = T.get(t);
|
|
368
|
+
c && (c.renderer || c.editor) && (r = c, A.set(e, r));
|
|
349
369
|
}
|
|
350
|
-
const o = r?.renderer !== void 0,
|
|
351
|
-
return r !== void 0 && (o ||
|
|
370
|
+
const o = r?.renderer !== void 0, s = r?.editor !== void 0;
|
|
371
|
+
return r !== void 0 && (o || s);
|
|
352
372
|
}
|
|
353
373
|
/**
|
|
354
374
|
* Creates a view renderer function that renders a React component
|
|
355
375
|
* and returns its container DOM element.
|
|
356
376
|
*
|
|
357
|
-
* Uses a cell cache to reuse
|
|
358
|
-
* creating new
|
|
359
|
-
*
|
|
377
|
+
* Uses a cell cache to reuse portals for performance - instead of
|
|
378
|
+
* creating new portals on each render, we reuse existing ones and
|
|
379
|
+
* update their content.
|
|
360
380
|
*
|
|
361
381
|
* Returns undefined if no renderer is registered for this element,
|
|
362
382
|
* allowing the grid to use its default rendering.
|
|
363
383
|
*/
|
|
364
|
-
createRenderer(
|
|
365
|
-
const
|
|
366
|
-
if (!
|
|
384
|
+
createRenderer(e) {
|
|
385
|
+
const t = tt(e);
|
|
386
|
+
if (!t)
|
|
367
387
|
return;
|
|
368
|
-
const r = /* @__PURE__ */ new WeakMap();
|
|
369
|
-
return (
|
|
370
|
-
const
|
|
371
|
-
if (
|
|
372
|
-
const f =
|
|
388
|
+
const r = e.closest("tbw-grid"), o = /* @__PURE__ */ new WeakMap();
|
|
389
|
+
return (s) => {
|
|
390
|
+
const c = s.cellEl;
|
|
391
|
+
if (c) {
|
|
392
|
+
const f = o.get(c);
|
|
373
393
|
if (f)
|
|
374
|
-
return
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
const
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
394
|
+
return w(f.container, t(s), f.portalKey), f.container;
|
|
395
|
+
const m = document.createElement("div");
|
|
396
|
+
m.className = "react-cell-renderer", m.style.display = "contents";
|
|
397
|
+
const v = w(
|
|
398
|
+
m,
|
|
399
|
+
t(s),
|
|
400
|
+
void 0,
|
|
401
|
+
r ?? void 0
|
|
402
|
+
);
|
|
403
|
+
return o.set(c, { portalKey: v, container: m }), this.trackPortal(v, m, !1), m;
|
|
383
404
|
}
|
|
384
|
-
const
|
|
385
|
-
|
|
386
|
-
const
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
405
|
+
const i = document.createElement("div");
|
|
406
|
+
i.className = "react-cell-renderer", i.style.display = "contents";
|
|
407
|
+
const g = w(
|
|
408
|
+
i,
|
|
409
|
+
t(s),
|
|
410
|
+
void 0,
|
|
411
|
+
r ?? void 0
|
|
412
|
+
);
|
|
413
|
+
return this.trackPortal(g, i, !1), i;
|
|
390
414
|
};
|
|
391
415
|
}
|
|
392
416
|
/**
|
|
393
417
|
* Creates an editor spec that renders a React component
|
|
394
418
|
* with commit/cancel callbacks passed as props.
|
|
395
419
|
*/
|
|
396
|
-
createEditor(
|
|
397
|
-
const
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
420
|
+
createEditor(e) {
|
|
421
|
+
const t = rt(e);
|
|
422
|
+
if (!t)
|
|
423
|
+
return () => document.createElement("div");
|
|
424
|
+
const r = e.closest("tbw-grid") ?? void 0;
|
|
425
|
+
return (o) => {
|
|
426
|
+
const s = document.createElement("div");
|
|
427
|
+
s.className = "react-cell-editor", s.style.display = "contents";
|
|
428
|
+
const c = w(
|
|
429
|
+
s,
|
|
430
|
+
t(o),
|
|
431
|
+
void 0,
|
|
432
|
+
r
|
|
433
|
+
);
|
|
434
|
+
return this.trackPortal(c, s, !0), s;
|
|
435
|
+
};
|
|
406
436
|
}
|
|
407
437
|
/**
|
|
408
438
|
* Creates a detail renderer function for MasterDetailPlugin.
|
|
409
439
|
* Renders React components for expandable detail rows.
|
|
410
440
|
*/
|
|
411
|
-
createDetailRenderer(
|
|
412
|
-
const
|
|
413
|
-
if (
|
|
441
|
+
createDetailRenderer(e) {
|
|
442
|
+
const t = Ye(e);
|
|
443
|
+
if (t)
|
|
414
444
|
return (r, o) => {
|
|
415
|
-
const
|
|
416
|
-
|
|
417
|
-
const
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
445
|
+
const s = document.createElement("div");
|
|
446
|
+
s.className = "react-detail-panel";
|
|
447
|
+
const i = w(
|
|
448
|
+
s,
|
|
449
|
+
t({ row: r, rowIndex: o }),
|
|
450
|
+
void 0,
|
|
451
|
+
e
|
|
452
|
+
);
|
|
453
|
+
return this.trackPortal(i, s, !1), s;
|
|
421
454
|
};
|
|
422
455
|
}
|
|
423
456
|
/**
|
|
424
457
|
* Framework adapter hook called by MasterDetailPlugin during attach().
|
|
425
458
|
* Parses the <tbw-grid-detail> element and returns a React-based renderer.
|
|
426
459
|
*/
|
|
427
|
-
parseDetailElement(
|
|
428
|
-
const
|
|
429
|
-
if (
|
|
430
|
-
return this.createDetailRenderer(
|
|
460
|
+
parseDetailElement(e) {
|
|
461
|
+
const t = e.closest("tbw-grid");
|
|
462
|
+
if (t)
|
|
463
|
+
return this.createDetailRenderer(t);
|
|
431
464
|
}
|
|
432
465
|
/**
|
|
433
466
|
* Creates a responsive card renderer function for ResponsivePlugin.
|
|
434
467
|
* Renders React components for card layout in responsive mode.
|
|
435
468
|
*/
|
|
436
|
-
createResponsiveCardRenderer(
|
|
437
|
-
const
|
|
438
|
-
if (
|
|
469
|
+
createResponsiveCardRenderer(e) {
|
|
470
|
+
const t = we(e);
|
|
471
|
+
if (t)
|
|
439
472
|
return (r, o) => {
|
|
440
|
-
const
|
|
441
|
-
|
|
442
|
-
const
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
473
|
+
const s = document.createElement("div");
|
|
474
|
+
s.className = "react-responsive-card";
|
|
475
|
+
const i = w(
|
|
476
|
+
s,
|
|
477
|
+
t({ row: r, index: o }),
|
|
478
|
+
void 0,
|
|
479
|
+
e
|
|
480
|
+
);
|
|
481
|
+
return this.trackPortal(i, s, !1), s;
|
|
446
482
|
};
|
|
447
483
|
}
|
|
448
484
|
/**
|
|
449
485
|
* Creates a tool panel renderer from a light DOM element.
|
|
450
486
|
* Renders React components into tool panel containers.
|
|
451
487
|
*/
|
|
452
|
-
createToolPanelRenderer(
|
|
453
|
-
const
|
|
454
|
-
if (!
|
|
488
|
+
createToolPanelRenderer(e) {
|
|
489
|
+
const t = Qe(e);
|
|
490
|
+
if (!t)
|
|
455
491
|
return;
|
|
456
|
-
const r =
|
|
492
|
+
const r = e.closest("tbw-grid");
|
|
457
493
|
return (o) => {
|
|
458
|
-
const
|
|
494
|
+
const c = w(o, t({
|
|
459
495
|
grid: r ?? o
|
|
460
|
-
},
|
|
461
|
-
return
|
|
462
|
-
|
|
463
|
-
}), this.mountedViews.push({ root: l, container: o }), () => {
|
|
464
|
-
const i = this.mountedViews.findIndex((f) => f.container === o);
|
|
465
|
-
if (i !== -1) {
|
|
466
|
-
const { root: f } = this.mountedViews[i];
|
|
467
|
-
try {
|
|
468
|
-
f.unmount();
|
|
469
|
-
} catch {
|
|
470
|
-
}
|
|
471
|
-
this.mountedViews.splice(i, 1);
|
|
472
|
-
}
|
|
496
|
+
}), void 0, r ?? void 0);
|
|
497
|
+
return this.trackPortal(c, o, !1), () => {
|
|
498
|
+
_(c), this.untrackPortal(c);
|
|
473
499
|
};
|
|
474
500
|
};
|
|
475
501
|
}
|
|
@@ -497,192 +523,178 @@ class he {
|
|
|
497
523
|
* // Any grid with type: 'country' columns will use these components
|
|
498
524
|
* ```
|
|
499
525
|
*/
|
|
500
|
-
getTypeDefault(t) {
|
|
526
|
+
getTypeDefault(e, t) {
|
|
501
527
|
if (!this.typeDefaults)
|
|
502
528
|
return;
|
|
503
|
-
const
|
|
504
|
-
if (!
|
|
529
|
+
const r = this.typeDefaults[e];
|
|
530
|
+
if (!r)
|
|
505
531
|
return;
|
|
506
|
-
const
|
|
507
|
-
editorParams:
|
|
532
|
+
const o = {
|
|
533
|
+
editorParams: r.editorParams
|
|
508
534
|
};
|
|
509
|
-
return
|
|
535
|
+
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;
|
|
510
536
|
}
|
|
511
537
|
/**
|
|
512
538
|
* Creates a renderer function from a React render function for type defaults.
|
|
513
539
|
* @internal
|
|
514
540
|
*/
|
|
515
|
-
createTypeRenderer(t) {
|
|
516
|
-
return (
|
|
517
|
-
const
|
|
518
|
-
|
|
519
|
-
const
|
|
520
|
-
return this.
|
|
521
|
-
o.render(t(e));
|
|
522
|
-
}), r;
|
|
541
|
+
createTypeRenderer(e, t) {
|
|
542
|
+
return (r) => {
|
|
543
|
+
const o = document.createElement("span");
|
|
544
|
+
o.style.display = "contents";
|
|
545
|
+
const s = r.cellEl?.closest("tbw-grid") ?? t, c = w(o, e(r), void 0, s);
|
|
546
|
+
return this.trackPortal(c, o, !1), o;
|
|
523
547
|
};
|
|
524
548
|
}
|
|
525
549
|
/**
|
|
526
550
|
* Creates an editor function from a React render function for type defaults.
|
|
527
551
|
* @internal
|
|
528
552
|
*/
|
|
529
|
-
createTypeEditor(t) {
|
|
530
|
-
return (
|
|
531
|
-
const
|
|
532
|
-
|
|
533
|
-
const
|
|
534
|
-
return this.
|
|
535
|
-
o.render(t(e));
|
|
536
|
-
}), r;
|
|
553
|
+
createTypeEditor(e, t) {
|
|
554
|
+
return (r) => {
|
|
555
|
+
const o = document.createElement("span");
|
|
556
|
+
o.style.display = "contents";
|
|
557
|
+
const s = w(o, e(r), void 0, t);
|
|
558
|
+
return this.trackPortal(s, o, !0), o;
|
|
537
559
|
};
|
|
538
560
|
}
|
|
539
561
|
/**
|
|
540
562
|
* Creates a filter panel renderer that mounts React content into the filter panel container.
|
|
541
563
|
* @internal
|
|
542
564
|
*/
|
|
543
|
-
createFilterPanelRenderer(t) {
|
|
544
|
-
return (
|
|
545
|
-
const
|
|
546
|
-
|
|
547
|
-
const
|
|
548
|
-
this.
|
|
549
|
-
a.render(t(r));
|
|
550
|
-
}), e.appendChild(o);
|
|
565
|
+
createFilterPanelRenderer(e, t) {
|
|
566
|
+
return (r, o) => {
|
|
567
|
+
const s = document.createElement("div");
|
|
568
|
+
s.style.display = "contents";
|
|
569
|
+
const c = r.closest("tbw-grid") ?? t, i = w(s, e(o), void 0, c);
|
|
570
|
+
this.trackPortal(i, s, !1), r.appendChild(s);
|
|
551
571
|
};
|
|
552
572
|
}
|
|
573
|
+
// #region Portal tracking helpers
|
|
574
|
+
/** Register a portal key for lifecycle tracking. */
|
|
575
|
+
trackPortal(e, t, r) {
|
|
576
|
+
this.allPortalKeys.add(e), this.keyToContainer.set(e, t), r && this.editorPortalKeys.add(e);
|
|
577
|
+
}
|
|
578
|
+
/** Unregister a portal key from all tracking sets. */
|
|
579
|
+
untrackPortal(e) {
|
|
580
|
+
this.allPortalKeys.delete(e), this.editorPortalKeys.delete(e), this.keyToContainer.delete(e);
|
|
581
|
+
}
|
|
582
|
+
// #endregion
|
|
553
583
|
/**
|
|
554
|
-
* Clean up all mounted
|
|
584
|
+
* Clean up all mounted portals.
|
|
555
585
|
* Call this when the grid is unmounted.
|
|
556
586
|
*/
|
|
557
587
|
destroy() {
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
} catch {
|
|
562
|
-
}
|
|
563
|
-
}), this.mountedViews = [], this.editorViews.forEach(({ root: t }) => {
|
|
564
|
-
try {
|
|
565
|
-
t.unmount();
|
|
566
|
-
} catch {
|
|
567
|
-
}
|
|
568
|
-
}), this.editorViews = [], N.clear();
|
|
588
|
+
for (const e of this.allPortalKeys)
|
|
589
|
+
_(e);
|
|
590
|
+
this.allPortalKeys.clear(), this.editorPortalKeys.clear(), this.keyToContainer.clear(), T.clear();
|
|
569
591
|
}
|
|
570
592
|
/**
|
|
571
593
|
* Called when a cell's content is about to be wiped.
|
|
572
|
-
* Destroys editor
|
|
594
|
+
* Destroys editor portals whose container is inside the cell.
|
|
573
595
|
* Also cleans up config-based editor roots (from processGridConfig/wrapReactEditor)
|
|
574
|
-
* that bypass the adapter's tracking
|
|
596
|
+
* that bypass the adapter's tracking.
|
|
575
597
|
*/
|
|
576
|
-
releaseCell(
|
|
577
|
-
for (
|
|
578
|
-
const
|
|
579
|
-
|
|
580
|
-
try {
|
|
581
|
-
r.unmount();
|
|
582
|
-
} catch {
|
|
583
|
-
}
|
|
584
|
-
this.editorViews.splice(e, 1);
|
|
585
|
-
}
|
|
598
|
+
releaseCell(e) {
|
|
599
|
+
for (const t of this.editorPortalKeys) {
|
|
600
|
+
const r = this.keyToContainer.get(t);
|
|
601
|
+
r && e.contains(r) && (_(t), this.untrackPortal(t));
|
|
586
602
|
}
|
|
587
|
-
|
|
603
|
+
ze(e);
|
|
588
604
|
}
|
|
589
605
|
/**
|
|
590
606
|
* Unmount a specific container (called when cell is recycled).
|
|
591
607
|
*/
|
|
592
|
-
unmount(
|
|
593
|
-
const
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
r.unmount();
|
|
598
|
-
} catch {
|
|
608
|
+
unmount(e) {
|
|
609
|
+
for (const [t, r] of this.keyToContainer)
|
|
610
|
+
if (r === e) {
|
|
611
|
+
_(t), this.untrackPortal(t);
|
|
612
|
+
return;
|
|
599
613
|
}
|
|
600
|
-
this.mountedViews.splice(e, 1);
|
|
601
|
-
}
|
|
602
614
|
}
|
|
603
615
|
}
|
|
604
|
-
const
|
|
616
|
+
const Rt = be, nt = {
|
|
605
617
|
undoRedo: ["editing"],
|
|
606
618
|
clipboard: ["selection"]
|
|
607
619
|
};
|
|
608
|
-
function
|
|
609
|
-
const
|
|
610
|
-
for (const
|
|
611
|
-
const r =
|
|
620
|
+
function ot(n) {
|
|
621
|
+
const e = new Set(n);
|
|
622
|
+
for (const t of n) {
|
|
623
|
+
const r = nt[t];
|
|
612
624
|
if (r)
|
|
613
625
|
for (const o of r)
|
|
614
|
-
|
|
615
|
-
`[DataGrid] Feature "${
|
|
626
|
+
e.has(o) || console.warn(
|
|
627
|
+
`[DataGrid] Feature "${t}" requires "${o}" to be enabled. Add the "${o}" prop to your DataGrid.`
|
|
616
628
|
);
|
|
617
629
|
}
|
|
618
630
|
}
|
|
619
|
-
function
|
|
620
|
-
const
|
|
621
|
-
for (const [
|
|
622
|
-
r === void 0 || r === !1 ||
|
|
623
|
-
return
|
|
631
|
+
function it(n) {
|
|
632
|
+
const e = [];
|
|
633
|
+
for (const [t, r] of Object.entries(n))
|
|
634
|
+
r === void 0 || r === !1 || e.push(t);
|
|
635
|
+
return ot(e), Ne(n);
|
|
624
636
|
}
|
|
625
|
-
let
|
|
626
|
-
function
|
|
627
|
-
return
|
|
637
|
+
let ye = !1, Z = null;
|
|
638
|
+
function oe() {
|
|
639
|
+
return ye || (Z = new be(), ke.registerAdapter(Z), ye = !0), Z;
|
|
628
640
|
}
|
|
629
|
-
|
|
630
|
-
function
|
|
631
|
-
const
|
|
632
|
-
|
|
641
|
+
oe();
|
|
642
|
+
function st(n) {
|
|
643
|
+
const t = n.getPluginByName?.("masterDetail");
|
|
644
|
+
t && typeof t.refreshDetailRenderer == "function" && t.refreshDetailRenderer();
|
|
633
645
|
}
|
|
634
|
-
function
|
|
635
|
-
const
|
|
636
|
-
if (!n.querySelector("tbw-grid-responsive-card") || !
|
|
637
|
-
const
|
|
638
|
-
if (
|
|
639
|
-
const
|
|
640
|
-
|
|
646
|
+
function ct(n, e) {
|
|
647
|
+
const t = n;
|
|
648
|
+
if (!n.querySelector("tbw-grid-responsive-card") || !we(n)) return;
|
|
649
|
+
const s = t.getPluginByName?.("responsive");
|
|
650
|
+
if (s && typeof s.setCardRenderer == "function") {
|
|
651
|
+
const c = e.createResponsiveCardRenderer(n);
|
|
652
|
+
c && s.setCardRenderer(c);
|
|
641
653
|
}
|
|
642
654
|
}
|
|
643
|
-
function
|
|
644
|
-
const
|
|
645
|
-
return
|
|
646
|
-
if (
|
|
647
|
-
if (
|
|
648
|
-
const r =
|
|
649
|
-
|
|
655
|
+
function at(n) {
|
|
656
|
+
const e = {};
|
|
657
|
+
return De.forEach(n, (t) => {
|
|
658
|
+
if (Ae(t)) {
|
|
659
|
+
if (t.type && t.type.displayName === "GridDetailPanel") {
|
|
660
|
+
const r = t.props;
|
|
661
|
+
e.masterDetail = {
|
|
650
662
|
// Use props from the child component for configuration
|
|
651
663
|
showExpandColumn: r.showExpandColumn ?? !0,
|
|
652
664
|
animation: r.animation ?? "slide"
|
|
653
665
|
// detailRenderer will be wired up by refreshMasterDetailRenderer after mount
|
|
654
666
|
};
|
|
655
667
|
}
|
|
656
|
-
|
|
668
|
+
t.type && t.type.displayName === "GridResponsiveCard" && (e.responsive = !0);
|
|
657
669
|
}
|
|
658
|
-
}),
|
|
670
|
+
}), e;
|
|
659
671
|
}
|
|
660
|
-
const
|
|
672
|
+
const wt = Ce(function(e, t) {
|
|
661
673
|
const {
|
|
662
674
|
// Core props
|
|
663
675
|
rows: r,
|
|
664
676
|
gridConfig: o,
|
|
665
|
-
columns:
|
|
666
|
-
columnDefaults:
|
|
677
|
+
columns: s,
|
|
678
|
+
columnDefaults: c,
|
|
667
679
|
fitMode: i,
|
|
668
|
-
sortable:
|
|
669
|
-
filterable:
|
|
670
|
-
selectable:
|
|
671
|
-
loading:
|
|
672
|
-
editOn:
|
|
673
|
-
customStyles:
|
|
674
|
-
className:
|
|
675
|
-
style:
|
|
676
|
-
children:
|
|
680
|
+
sortable: g,
|
|
681
|
+
filterable: f,
|
|
682
|
+
selectable: m,
|
|
683
|
+
loading: v,
|
|
684
|
+
editOn: P,
|
|
685
|
+
customStyles: G,
|
|
686
|
+
className: I,
|
|
687
|
+
style: F,
|
|
688
|
+
children: N,
|
|
677
689
|
// Plugin props
|
|
678
|
-
plugins:
|
|
690
|
+
plugins: k,
|
|
679
691
|
// SSR mode
|
|
680
|
-
ssr:
|
|
692
|
+
ssr: K,
|
|
681
693
|
// Legacy event handlers
|
|
682
|
-
onRowsChange:
|
|
694
|
+
onRowsChange: h,
|
|
683
695
|
// Feature props and event props are in ...rest
|
|
684
696
|
...d
|
|
685
|
-
} =
|
|
697
|
+
} = e, l = b(null), p = b(null), S = z(Be), M = z(He), L = [
|
|
686
698
|
"selection",
|
|
687
699
|
"editing",
|
|
688
700
|
"filtering",
|
|
@@ -712,215 +724,225 @@ const gt = Ce(function(t, e) {
|
|
|
712
724
|
"pivot",
|
|
713
725
|
"serverSide",
|
|
714
726
|
"tooltip"
|
|
715
|
-
],
|
|
716
|
-
const u = d[
|
|
717
|
-
return u !== void 0 ? `${
|
|
718
|
-
}).filter(Boolean).join("|"), [d]),
|
|
719
|
-
const
|
|
720
|
-
for (const u of
|
|
721
|
-
u in d && d[u] !== void 0 && (
|
|
722
|
-
return
|
|
723
|
-
}, [
|
|
724
|
-
if (
|
|
725
|
-
const
|
|
726
|
-
return [...
|
|
727
|
+
], Ee = x(() => L.map((a) => {
|
|
728
|
+
const u = d[a];
|
|
729
|
+
return u !== void 0 ? `${a}:${JSON.stringify(u)}` : "";
|
|
730
|
+
}).filter(Boolean).join("|"), [d]), ce = x(() => {
|
|
731
|
+
const a = {};
|
|
732
|
+
for (const u of L)
|
|
733
|
+
u in d && d[u] !== void 0 && (a[u] = d[u]);
|
|
734
|
+
return a;
|
|
735
|
+
}, [Ee]), ae = x(() => at(N), [N]), le = x(() => ({ ...ae, ...ce }), [ce, ae]), V = x(() => k || K ? [] : it(le), [le, k, K]), q = x(() => {
|
|
736
|
+
if (k) {
|
|
737
|
+
const a = new Set(k.map((y) => y.name)), u = V.filter((y) => !a.has(y.name));
|
|
738
|
+
return [...k, ...u];
|
|
727
739
|
}
|
|
728
|
-
return
|
|
729
|
-
}, [
|
|
730
|
-
if (!
|
|
731
|
-
const
|
|
732
|
-
return
|
|
733
|
-
...
|
|
740
|
+
return V;
|
|
741
|
+
}, [k, V]), H = x(() => {
|
|
742
|
+
if (!s) return s;
|
|
743
|
+
const a = Me(s);
|
|
744
|
+
return c ? a.map((u) => ({
|
|
745
|
+
...c,
|
|
734
746
|
...u
|
|
735
747
|
// Individual column props override defaults
|
|
736
|
-
})) :
|
|
737
|
-
}, [
|
|
738
|
-
const
|
|
739
|
-
if (
|
|
740
|
-
const
|
|
741
|
-
u.icons = { ...
|
|
748
|
+
})) : a;
|
|
749
|
+
}, [s, c]), O = x(() => {
|
|
750
|
+
const a = Pe(o), u = {};
|
|
751
|
+
if (g !== void 0 && (u.sortable = g), f !== void 0 && (u.filterable = f), m !== void 0 && (u.selectable = m), M) {
|
|
752
|
+
const y = a?.icons || o?.icons || {};
|
|
753
|
+
u.icons = { ...M, ...y };
|
|
742
754
|
}
|
|
743
|
-
if (
|
|
744
|
-
const
|
|
755
|
+
if (q.length > 0 && a) {
|
|
756
|
+
const y = a.plugins || [], j = new Set(y.map((B) => B.name)), J = q.filter((B) => !j.has(B.name));
|
|
745
757
|
return {
|
|
746
|
-
...
|
|
758
|
+
...a,
|
|
747
759
|
...u,
|
|
748
|
-
plugins: [...
|
|
760
|
+
plugins: [...y, ...J]
|
|
749
761
|
};
|
|
750
762
|
}
|
|
751
|
-
return
|
|
752
|
-
}, [o,
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
}, [
|
|
756
|
-
|
|
757
|
-
}, [r]),
|
|
758
|
-
|
|
759
|
-
}, [
|
|
760
|
-
|
|
761
|
-
}, [
|
|
762
|
-
|
|
763
|
-
}, [i]),
|
|
764
|
-
|
|
765
|
-
}, [
|
|
766
|
-
|
|
767
|
-
}, [
|
|
768
|
-
const
|
|
769
|
-
if (!
|
|
770
|
-
const u =
|
|
771
|
-
|
|
772
|
-
let
|
|
763
|
+
return q.length > 0 && !a ? { ...u, plugins: q } : Object.keys(u).length > 0 ? { ...a, ...u } : a;
|
|
764
|
+
}, [o, q, g, f, m, M]);
|
|
765
|
+
R(() => {
|
|
766
|
+
oe().setTypeDefaults(S);
|
|
767
|
+
}, [S]), R(() => {
|
|
768
|
+
l.current && (l.current.rows = r);
|
|
769
|
+
}, [r]), R(() => {
|
|
770
|
+
l.current && O && (l.current.gridConfig = O);
|
|
771
|
+
}, [O]), R(() => {
|
|
772
|
+
l.current && H && (l.current.columns = H);
|
|
773
|
+
}, [H]), R(() => {
|
|
774
|
+
l.current && i !== void 0 && (l.current.fitMode = i);
|
|
775
|
+
}, [i]), R(() => {
|
|
776
|
+
l.current && P !== void 0 && (l.current.editOn = P);
|
|
777
|
+
}, [P]), R(() => {
|
|
778
|
+
l.current && v !== void 0 && (l.current.loading = v);
|
|
779
|
+
}, [v]), R(() => {
|
|
780
|
+
const a = l.current;
|
|
781
|
+
if (!a) return;
|
|
782
|
+
const u = oe();
|
|
783
|
+
a.__frameworkAdapter = u, st(a), ct(a, u);
|
|
784
|
+
let y = !1;
|
|
773
785
|
const j = requestAnimationFrame(() => {
|
|
774
|
-
|
|
786
|
+
y || (typeof a.refreshColumns == "function" && a.refreshColumns(), typeof a.refreshShellHeader == "function" && a.refreshShellHeader());
|
|
775
787
|
});
|
|
776
788
|
return () => {
|
|
777
|
-
|
|
789
|
+
y = !0, cancelAnimationFrame(j);
|
|
778
790
|
};
|
|
779
|
-
}, []),
|
|
780
|
-
if (!
|
|
781
|
-
const
|
|
782
|
-
let
|
|
783
|
-
return
|
|
784
|
-
|
|
791
|
+
}, []), R(() => {
|
|
792
|
+
if (!l.current || !G) return;
|
|
793
|
+
const a = l.current, u = "react-custom-styles";
|
|
794
|
+
let y = !0;
|
|
795
|
+
return a.ready?.().then(() => {
|
|
796
|
+
y && G && (a.registerStyles?.(u, G), p.current = u);
|
|
785
797
|
}), () => {
|
|
786
|
-
|
|
798
|
+
y = !1, p.current && (a.unregisterStyles?.(p.current), p.current = null);
|
|
787
799
|
};
|
|
788
|
-
}, [
|
|
789
|
-
const
|
|
790
|
-
if (!
|
|
800
|
+
}, [G]), R(() => {
|
|
801
|
+
const a = l.current;
|
|
802
|
+
if (!a) return;
|
|
791
803
|
const u = [];
|
|
792
|
-
return
|
|
793
|
-
u.forEach((
|
|
804
|
+
return h && u.push(a.on("rows-change", (y) => h(y.rows))), () => {
|
|
805
|
+
u.forEach((y) => y());
|
|
794
806
|
};
|
|
795
|
-
}, [
|
|
796
|
-
const
|
|
797
|
-
for (const
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
const
|
|
801
|
-
if (!
|
|
807
|
+
}, [h]);
|
|
808
|
+
const de = x(() => Object.keys(U).filter((a) => typeof d[a] == "function").sort().join("|"), [d]), ue = b({});
|
|
809
|
+
for (const a of Object.keys(U))
|
|
810
|
+
ue.current[a] = d[a];
|
|
811
|
+
R(() => {
|
|
812
|
+
const a = l.current;
|
|
813
|
+
if (!a) return;
|
|
802
814
|
const u = [];
|
|
803
|
-
for (const [
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
815
|
+
for (const [y, j] of Object.entries(U))
|
|
816
|
+
de.includes(y) && u.push(
|
|
817
|
+
a.on(j, (J, B) => {
|
|
818
|
+
ue.current[y]?.(J, B);
|
|
807
819
|
})
|
|
808
820
|
);
|
|
809
821
|
return () => {
|
|
810
|
-
u.forEach((
|
|
822
|
+
u.forEach((y) => y());
|
|
811
823
|
};
|
|
812
|
-
}, [
|
|
813
|
-
|
|
824
|
+
}, [de]), Re(
|
|
825
|
+
t,
|
|
814
826
|
() => ({
|
|
815
827
|
get element() {
|
|
816
|
-
return
|
|
828
|
+
return l.current;
|
|
817
829
|
},
|
|
818
830
|
async getConfig() {
|
|
819
|
-
return
|
|
831
|
+
return l.current?.getConfig?.() ?? {};
|
|
820
832
|
},
|
|
821
833
|
async ready() {
|
|
822
|
-
return
|
|
834
|
+
return l.current?.ready?.();
|
|
823
835
|
},
|
|
824
836
|
async forceLayout() {
|
|
825
|
-
return
|
|
837
|
+
return l.current?.forceLayout?.();
|
|
826
838
|
},
|
|
827
|
-
async toggleGroup(
|
|
828
|
-
return
|
|
839
|
+
async toggleGroup(a) {
|
|
840
|
+
return l.current?.toggleGroup?.(a);
|
|
829
841
|
},
|
|
830
|
-
registerStyles(
|
|
831
|
-
|
|
842
|
+
registerStyles(a, u) {
|
|
843
|
+
l.current?.registerStyles?.(a, u);
|
|
832
844
|
},
|
|
833
|
-
unregisterStyles(
|
|
834
|
-
|
|
845
|
+
unregisterStyles(a) {
|
|
846
|
+
l.current?.unregisterStyles?.(a);
|
|
835
847
|
},
|
|
836
|
-
setRowLoading(
|
|
837
|
-
|
|
848
|
+
setRowLoading(a, u) {
|
|
849
|
+
l.current?.setRowLoading?.(a, u);
|
|
838
850
|
},
|
|
839
|
-
setCellLoading(
|
|
840
|
-
|
|
851
|
+
setCellLoading(a, u, y) {
|
|
852
|
+
l.current?.setCellLoading?.(a, u, y);
|
|
841
853
|
},
|
|
842
|
-
isRowLoading(
|
|
843
|
-
return
|
|
854
|
+
isRowLoading(a) {
|
|
855
|
+
return l.current?.isRowLoading?.(a) ?? !1;
|
|
844
856
|
},
|
|
845
|
-
isCellLoading(
|
|
846
|
-
return
|
|
857
|
+
isCellLoading(a, u) {
|
|
858
|
+
return l.current?.isCellLoading?.(a, u) ?? !1;
|
|
847
859
|
},
|
|
848
860
|
clearAllLoading() {
|
|
849
|
-
|
|
861
|
+
l.current?.clearAllLoading?.();
|
|
850
862
|
}
|
|
851
863
|
}),
|
|
852
864
|
[]
|
|
853
|
-
), /* @__PURE__ */ E(
|
|
854
|
-
"tbw-grid",
|
|
855
|
-
{
|
|
856
|
-
ref: (c) => {
|
|
857
|
-
if (s.current = c, c) {
|
|
858
|
-
const u = c;
|
|
859
|
-
B && (u.gridConfig = B), r && (u.rows = r), q && (u.columns = q);
|
|
860
|
-
}
|
|
861
|
-
},
|
|
862
|
-
class: k,
|
|
863
|
-
style: M,
|
|
864
|
-
children: /* @__PURE__ */ E(xe.Provider, { value: s, children: L })
|
|
865
|
-
}
|
|
866
865
|
);
|
|
866
|
+
const W = b(null);
|
|
867
|
+
return Ge(() => {
|
|
868
|
+
const a = l.current;
|
|
869
|
+
return a && W.current && ge(a, W.current), () => {
|
|
870
|
+
a && ge(a, null);
|
|
871
|
+
};
|
|
872
|
+
}, []), /* @__PURE__ */ Se(ie, { children: [
|
|
873
|
+
/* @__PURE__ */ E(_e, { ref: W }),
|
|
874
|
+
/* @__PURE__ */ E(
|
|
875
|
+
"tbw-grid",
|
|
876
|
+
{
|
|
877
|
+
ref: (a) => {
|
|
878
|
+
if (l.current = a, a) {
|
|
879
|
+
const u = a;
|
|
880
|
+
O && (u.gridConfig = O), r && (u.rows = r), H && (u.columns = H);
|
|
881
|
+
}
|
|
882
|
+
},
|
|
883
|
+
class: I,
|
|
884
|
+
style: F,
|
|
885
|
+
children: /* @__PURE__ */ E(Ke.Provider, { value: l, children: N })
|
|
886
|
+
}
|
|
887
|
+
)
|
|
888
|
+
] });
|
|
867
889
|
});
|
|
868
|
-
function
|
|
890
|
+
function Pt(n) {
|
|
869
891
|
const {
|
|
870
|
-
field:
|
|
871
|
-
header:
|
|
892
|
+
field: e,
|
|
893
|
+
header: t,
|
|
872
894
|
type: r,
|
|
873
895
|
editable: o,
|
|
874
|
-
sortable:
|
|
875
|
-
resizable:
|
|
896
|
+
sortable: s,
|
|
897
|
+
resizable: c,
|
|
876
898
|
width: i,
|
|
877
|
-
minWidth:
|
|
878
|
-
hidden:
|
|
879
|
-
lockVisible:
|
|
880
|
-
children:
|
|
881
|
-
editor:
|
|
882
|
-
options:
|
|
883
|
-
multi:
|
|
884
|
-
format:
|
|
885
|
-
} = n,
|
|
899
|
+
minWidth: g,
|
|
900
|
+
hidden: f,
|
|
901
|
+
lockVisible: m,
|
|
902
|
+
children: v,
|
|
903
|
+
editor: P,
|
|
904
|
+
options: G,
|
|
905
|
+
multi: I,
|
|
906
|
+
format: F
|
|
907
|
+
} = n, N = b(null), k = C(
|
|
886
908
|
(d) => {
|
|
887
|
-
|
|
909
|
+
N.current = d, d && (v && Xe(d, v), P && et(d, P));
|
|
888
910
|
},
|
|
889
|
-
[
|
|
890
|
-
),
|
|
891
|
-
field:
|
|
892
|
-
ref:
|
|
911
|
+
[v, P, e]
|
|
912
|
+
), K = typeof i == "number" ? `${i}px` : i, h = {
|
|
913
|
+
field: e,
|
|
914
|
+
ref: k
|
|
893
915
|
};
|
|
894
|
-
return
|
|
916
|
+
return t !== void 0 && (h.header = t), r !== void 0 && (h.type = r), o !== void 0 && (h.editable = o), s !== void 0 && (h.sortable = s), c !== void 0 && (h.resizable = c), K !== void 0 && (h.width = K), g !== void 0 && (h["min-width"] = g), f !== void 0 && (h.hidden = f), m !== void 0 && (h["lock-visible"] = m), I !== void 0 && (h.multi = I), F && (h["data-has-format"] = "true"), G && (h["data-has-options"] = "true"), /* @__PURE__ */ E("tbw-grid-column", { ...h });
|
|
895
917
|
}
|
|
896
|
-
function
|
|
918
|
+
function bt({ children: n }) {
|
|
897
919
|
return /* @__PURE__ */ E("tbw-grid-tool-buttons", { children: n });
|
|
898
920
|
}
|
|
899
|
-
const
|
|
900
|
-
let r =
|
|
901
|
-
return
|
|
921
|
+
const Et = ({ icons: n, defaults: e, children: t }) => {
|
|
922
|
+
let r = t;
|
|
923
|
+
return e && (r = /* @__PURE__ */ E(je, { defaults: e, children: r })), n && (r = /* @__PURE__ */ E(qe, { icons: n, children: r })), /* @__PURE__ */ E(ie, { children: r });
|
|
902
924
|
};
|
|
903
|
-
function
|
|
904
|
-
const
|
|
905
|
-
|
|
925
|
+
function St(n) {
|
|
926
|
+
const e = b(null), [t, r] = fe(!1), [o, s] = fe(null), c = b(null), i = C(() => n ? (c.current ??= document.querySelector(n), c.current) : e.current?.element ?? null, [n]);
|
|
927
|
+
R(() => {
|
|
906
928
|
let d = !0;
|
|
907
929
|
return (async () => {
|
|
908
930
|
try {
|
|
909
931
|
if (n) {
|
|
910
932
|
const p = document.querySelector(n);
|
|
911
933
|
if (!p) return;
|
|
912
|
-
if (
|
|
934
|
+
if (c.current = p, await p.ready?.(), d) {
|
|
913
935
|
r(!0);
|
|
914
|
-
const
|
|
915
|
-
d &&
|
|
936
|
+
const S = await p.getConfig?.();
|
|
937
|
+
d && S && s(S);
|
|
916
938
|
}
|
|
917
939
|
} else {
|
|
918
|
-
const p =
|
|
940
|
+
const p = e.current;
|
|
919
941
|
if (!p) return;
|
|
920
942
|
if (await p.ready?.(), d) {
|
|
921
943
|
r(!0);
|
|
922
|
-
const
|
|
923
|
-
d &&
|
|
944
|
+
const S = await p.getConfig?.();
|
|
945
|
+
d && S && s(S);
|
|
924
946
|
}
|
|
925
947
|
}
|
|
926
948
|
} catch {
|
|
@@ -929,73 +951,73 @@ function ht(n) {
|
|
|
929
951
|
d = !1;
|
|
930
952
|
};
|
|
931
953
|
}, [n]);
|
|
932
|
-
const
|
|
954
|
+
const g = C(async () => {
|
|
933
955
|
const d = i();
|
|
934
956
|
if (d)
|
|
935
957
|
return await d.getConfig?.() ?? null;
|
|
936
|
-
const
|
|
937
|
-
return
|
|
938
|
-
}, [i]),
|
|
958
|
+
const l = e.current;
|
|
959
|
+
return l ? await l.getConfig?.() ?? null : null;
|
|
960
|
+
}, [i]), f = C(async () => {
|
|
939
961
|
const d = i();
|
|
940
962
|
if (d) {
|
|
941
963
|
await d.forceLayout?.();
|
|
942
964
|
return;
|
|
943
965
|
}
|
|
944
|
-
const
|
|
945
|
-
|
|
946
|
-
}, [i]),
|
|
966
|
+
const l = e.current;
|
|
967
|
+
l && await l.forceLayout?.();
|
|
968
|
+
}, [i]), m = C(
|
|
947
969
|
async (d) => {
|
|
948
|
-
const
|
|
949
|
-
if (
|
|
950
|
-
await
|
|
970
|
+
const l = i();
|
|
971
|
+
if (l) {
|
|
972
|
+
await l.toggleGroup?.(d);
|
|
951
973
|
return;
|
|
952
974
|
}
|
|
953
|
-
const p =
|
|
975
|
+
const p = e.current;
|
|
954
976
|
p && await p.toggleGroup?.(d);
|
|
955
977
|
},
|
|
956
978
|
[i]
|
|
957
|
-
),
|
|
958
|
-
(d,
|
|
979
|
+
), v = C(
|
|
980
|
+
(d, l) => {
|
|
959
981
|
const p = i();
|
|
960
982
|
if (p) {
|
|
961
|
-
p.registerStyles?.(d,
|
|
983
|
+
p.registerStyles?.(d, l);
|
|
962
984
|
return;
|
|
963
985
|
}
|
|
964
|
-
|
|
986
|
+
e.current?.registerStyles?.(d, l);
|
|
965
987
|
},
|
|
966
988
|
[i]
|
|
967
|
-
),
|
|
989
|
+
), P = C(
|
|
968
990
|
(d) => {
|
|
969
|
-
const
|
|
970
|
-
if (
|
|
971
|
-
|
|
991
|
+
const l = i();
|
|
992
|
+
if (l) {
|
|
993
|
+
l.unregisterStyles?.(d);
|
|
972
994
|
return;
|
|
973
995
|
}
|
|
974
|
-
|
|
996
|
+
e.current?.unregisterStyles?.(d);
|
|
975
997
|
},
|
|
976
998
|
[i]
|
|
977
|
-
),
|
|
978
|
-
const d = i(),
|
|
979
|
-
if (!
|
|
999
|
+
), G = C(() => o?.columns ? o.columns.filter((d) => !d.hidden) : [], [o]), I = C(() => {
|
|
1000
|
+
const d = i(), l = d?.getPluginByName?.("selection");
|
|
1001
|
+
if (!l) {
|
|
980
1002
|
console.warn("[useGrid] selectAll requires SelectionPlugin");
|
|
981
1003
|
return;
|
|
982
1004
|
}
|
|
983
|
-
if (
|
|
984
|
-
const p = d?.rows ?? [],
|
|
985
|
-
|
|
1005
|
+
if (l.config?.mode === "row") {
|
|
1006
|
+
const p = d?.rows ?? [], S = new Set(p.map((M, L) => L));
|
|
1007
|
+
l.selected = S, l.requestAfterRender?.();
|
|
986
1008
|
}
|
|
987
|
-
}, [i]),
|
|
988
|
-
const
|
|
989
|
-
|
|
990
|
-
}, [i]),
|
|
991
|
-
const
|
|
992
|
-
return
|
|
993
|
-
}, [i]),
|
|
994
|
-
const d = i(),
|
|
995
|
-
if (!
|
|
996
|
-
const p = d?.rows ?? [],
|
|
997
|
-
return p.filter((
|
|
998
|
-
}, [i]),
|
|
1009
|
+
}, [i]), F = C(() => {
|
|
1010
|
+
const l = i()?.getPluginByName?.("selection");
|
|
1011
|
+
l && l.clearSelection?.();
|
|
1012
|
+
}, [i]), N = C(() => {
|
|
1013
|
+
const l = i()?.getPluginByName?.("selection");
|
|
1014
|
+
return l ? new Set(l.selected ?? []) : /* @__PURE__ */ new Set();
|
|
1015
|
+
}, [i]), k = C(() => {
|
|
1016
|
+
const d = i(), l = d?.getPluginByName?.("selection");
|
|
1017
|
+
if (!l) return [];
|
|
1018
|
+
const p = d?.rows ?? [], S = l.selected ?? /* @__PURE__ */ new Set();
|
|
1019
|
+
return p.filter((M, L) => S.has(L));
|
|
1020
|
+
}, [i]), K = C(
|
|
999
1021
|
(d) => {
|
|
1000
1022
|
const p = i()?.getPluginByName?.("export");
|
|
1001
1023
|
if (!p) {
|
|
@@ -1005,7 +1027,7 @@ function ht(n) {
|
|
|
1005
1027
|
p.exportCsv?.({ filename: d ?? "export.csv" });
|
|
1006
1028
|
},
|
|
1007
1029
|
[i]
|
|
1008
|
-
),
|
|
1030
|
+
), h = C(
|
|
1009
1031
|
(d) => {
|
|
1010
1032
|
const p = i()?.getPluginByName?.("export");
|
|
1011
1033
|
if (!p) {
|
|
@@ -1017,62 +1039,62 @@ function ht(n) {
|
|
|
1017
1039
|
[i]
|
|
1018
1040
|
);
|
|
1019
1041
|
return {
|
|
1020
|
-
ref:
|
|
1042
|
+
ref: e,
|
|
1021
1043
|
element: i(),
|
|
1022
|
-
isReady:
|
|
1044
|
+
isReady: t,
|
|
1023
1045
|
config: o,
|
|
1024
|
-
getConfig:
|
|
1025
|
-
forceLayout:
|
|
1026
|
-
toggleGroup:
|
|
1027
|
-
registerStyles:
|
|
1028
|
-
unregisterStyles:
|
|
1029
|
-
getVisibleColumns:
|
|
1046
|
+
getConfig: g,
|
|
1047
|
+
forceLayout: f,
|
|
1048
|
+
toggleGroup: m,
|
|
1049
|
+
registerStyles: v,
|
|
1050
|
+
unregisterStyles: P,
|
|
1051
|
+
getVisibleColumns: G,
|
|
1030
1052
|
// Selection methods
|
|
1031
|
-
selectAll:
|
|
1032
|
-
clearSelection:
|
|
1033
|
-
getSelectedIndices:
|
|
1034
|
-
getSelectedRows:
|
|
1053
|
+
selectAll: I,
|
|
1054
|
+
clearSelection: F,
|
|
1055
|
+
getSelectedIndices: N,
|
|
1056
|
+
getSelectedRows: k,
|
|
1035
1057
|
// Export methods
|
|
1036
|
-
exportToCsv:
|
|
1037
|
-
exportToJson:
|
|
1058
|
+
exportToCsv: K,
|
|
1059
|
+
exportToJson: h
|
|
1038
1060
|
};
|
|
1039
1061
|
}
|
|
1040
|
-
let
|
|
1041
|
-
function
|
|
1042
|
-
!
|
|
1062
|
+
let he = !1;
|
|
1063
|
+
function kt(n, e, t, r = []) {
|
|
1064
|
+
!he && typeof window < "u" && (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1" || window.location.hostname.includes(".local")) && (he = !0, console.warn(
|
|
1043
1065
|
`[useGridEvent] Deprecated: Use event props directly on DataGrid instead.
|
|
1044
1066
|
Example: <DataGrid onSelectionChange={(e) => ...} />
|
|
1045
1067
|
See migration guide: https://toolbox-web.dev/grid-react/migration`
|
|
1046
1068
|
));
|
|
1047
|
-
const o =
|
|
1048
|
-
|
|
1049
|
-
o.current =
|
|
1050
|
-
}, [
|
|
1051
|
-
const
|
|
1052
|
-
if (!
|
|
1053
|
-
const i = ((
|
|
1054
|
-
o.current(
|
|
1069
|
+
const o = b(t);
|
|
1070
|
+
R(() => {
|
|
1071
|
+
o.current = t;
|
|
1072
|
+
}, [t, ...r]), R(() => {
|
|
1073
|
+
const s = n.current, c = s && "element" in s ? s.element : s;
|
|
1074
|
+
if (!c) return;
|
|
1075
|
+
const i = ((g) => {
|
|
1076
|
+
o.current(g);
|
|
1055
1077
|
});
|
|
1056
|
-
return
|
|
1057
|
-
|
|
1078
|
+
return c.addEventListener(e, i), () => {
|
|
1079
|
+
c.removeEventListener(e, i);
|
|
1058
1080
|
};
|
|
1059
|
-
}, [n,
|
|
1081
|
+
}, [n, e]);
|
|
1060
1082
|
}
|
|
1061
1083
|
export {
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1084
|
+
wt as DataGrid,
|
|
1085
|
+
be as GridAdapter,
|
|
1086
|
+
Pt as GridColumn,
|
|
1087
|
+
Ze as GridDetailPanel,
|
|
1088
|
+
qe as GridIconProvider,
|
|
1089
|
+
Et as GridProvider,
|
|
1090
|
+
Oe as GridResponsiveCard,
|
|
1091
|
+
bt as GridToolButtons,
|
|
1092
|
+
Ct as GridToolPanel,
|
|
1093
|
+
je as GridTypeProvider,
|
|
1094
|
+
Rt as ReactGridAdapter,
|
|
1095
|
+
St as useGrid,
|
|
1096
|
+
kt as useGridEvent,
|
|
1097
|
+
yt as useGridIcons,
|
|
1098
|
+
ht as useGridTypeDefaults,
|
|
1099
|
+
vt as useTypeDefault
|
|
1078
1100
|
};
|