@toolbox-web/grid-react 1.9.0 → 2.0.0-beta
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 +0 -2
- package/chunks/{react-grid-adapter-LBf2Mqhn.js → react-grid-adapter-C9gIJ33-.js} +2 -4
- package/features/filtering.js +1 -1
- package/features/index.d.ts.map +1 -1
- package/features/index.js +0 -1
- package/features/master-detail.js +1 -1
- package/features/pinned-rows.d.ts.map +1 -1
- package/features/pinned-rows.js +12 -20
- package/features/responsive.js +1 -1
- package/index.d.ts +1 -1
- package/index.d.ts.map +1 -1
- package/index.js +310 -312
- package/lib/data-grid.d.ts +8 -2
- package/lib/data-grid.d.ts.map +1 -1
- package/lib/feature-props.d.ts +5 -50
- package/lib/feature-props.d.ts.map +1 -1
- package/lib/grid-column.d.ts +2 -0
- package/lib/grid-column.d.ts.map +1 -1
- package/lib/grid-header-content.d.ts +1 -1
- package/lib/grid-header-content.d.ts.map +1 -1
- package/lib/grid-toolbar-content.d.ts +1 -1
- package/lib/grid-toolbar-content.d.ts.map +1 -1
- package/lib/internal/feature-augmentations.d.ts +0 -1
- package/lib/internal/feature-augmentations.d.ts.map +1 -1
- package/package.json +2 -2
- package/features/reorder-rows.d.ts +0 -2
- package/features/reorder-rows.d.ts.map +0 -1
- package/features/reorder-rows.js +0 -1
package/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as S, Fragment as U, jsxs as he } from "react/jsx-runtime";
|
|
2
2
|
import { DataGridElement as ue } from "@toolbox-web/grid";
|
|
3
|
-
import { Children as ve, isValidElement as we, createContext as ae, useContext as
|
|
4
|
-
import { g as te, G as Ge, c as Se, d as xe } from "./chunks/react-grid-adapter-
|
|
5
|
-
import { e as hr, f as vr } from "./chunks/react-grid-adapter-
|
|
3
|
+
import { Children as ve, isValidElement as we, createContext as ae, useContext as k, forwardRef as le, useRef as P, useReducer as Re, useImperativeHandle as fe, useLayoutEffect as de, Component as be, useMemo as T, useEffect as R, createElement as Pe, useCallback as E, useId as ge, useState as N } from "react";
|
|
4
|
+
import { g as te, G as Ge, c as Se, d as xe } from "./chunks/react-grid-adapter-C9gIJ33-.js";
|
|
5
|
+
import { e as hr, f as vr } from "./chunks/react-grid-adapter-C9gIJ33-.js";
|
|
6
6
|
import { s as ne, r as pe, a as me } from "./chunks/portal-bridge-CvxNt40O.js";
|
|
7
7
|
import { flushSync as oe, createPortal as Ee } from "react-dom";
|
|
8
8
|
import { n as De } from "./chunks/post-mount-refresh-hooks-Dt7mPoZC.js";
|
|
@@ -14,18 +14,18 @@ import { G as O } from "./chunks/grid-element-context-BU3WvNtM.js";
|
|
|
14
14
|
import { G as Sr } from "./chunks/grid-detail-panel-BZFcujsZ.js";
|
|
15
15
|
import { G as Er } from "./chunks/grid-responsive-card-CSZhDCoN.js";
|
|
16
16
|
const q = /* @__PURE__ */ new Map();
|
|
17
|
-
function
|
|
17
|
+
function ye(t, r) {
|
|
18
18
|
q.set(t, r);
|
|
19
19
|
}
|
|
20
20
|
function ke(t) {
|
|
21
21
|
const r = {};
|
|
22
|
-
return q.size === 0 || ve.forEach(t, (
|
|
23
|
-
if (!we(
|
|
24
|
-
const
|
|
25
|
-
if (typeof
|
|
26
|
-
const
|
|
27
|
-
if (!
|
|
28
|
-
const l =
|
|
22
|
+
return q.size === 0 || ve.forEach(t, (f) => {
|
|
23
|
+
if (!we(f)) return;
|
|
24
|
+
const o = f.type, u = typeof o == "string" ? void 0 : o?.displayName;
|
|
25
|
+
if (typeof u != "string") return;
|
|
26
|
+
const d = q.get(u);
|
|
27
|
+
if (!d) return;
|
|
28
|
+
const l = d(f);
|
|
29
29
|
l && Object.assign(r, l);
|
|
30
30
|
}), r;
|
|
31
31
|
}
|
|
@@ -39,13 +39,13 @@ const Le = /* @__PURE__ */ new Set(["string", "number", "boolean", "date", "date
|
|
|
39
39
|
function Ae(t) {
|
|
40
40
|
const r = t.lastIndexOf(":");
|
|
41
41
|
if (r > 0) {
|
|
42
|
-
const
|
|
43
|
-
if (Le.has(
|
|
44
|
-
const
|
|
42
|
+
const f = t.slice(r + 1).toLowerCase();
|
|
43
|
+
if (Le.has(f)) {
|
|
44
|
+
const o = t.slice(0, r);
|
|
45
45
|
return {
|
|
46
|
-
field:
|
|
47
|
-
header: ie(
|
|
48
|
-
type:
|
|
46
|
+
field: o,
|
|
47
|
+
header: ie(o),
|
|
48
|
+
type: f
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
51
|
}
|
|
@@ -58,7 +58,7 @@ function Me(t) {
|
|
|
58
58
|
return t.map((r) => typeof r == "string" ? Ae(r) : r);
|
|
59
59
|
}
|
|
60
60
|
function Ne(t, r) {
|
|
61
|
-
return r ? t.map((
|
|
61
|
+
return r ? t.map((f) => ({ ...r, ...f })) : t;
|
|
62
62
|
}
|
|
63
63
|
function or(t) {
|
|
64
64
|
return t.some((r) => typeof r == "string");
|
|
@@ -106,19 +106,19 @@ const K = {
|
|
|
106
106
|
onPrintComplete: "print-complete",
|
|
107
107
|
onTbwScroll: "tbw-scroll",
|
|
108
108
|
onRender: "render"
|
|
109
|
-
}, W = ae(null), Oe = ({ icons: t, children: r }) => /* @__PURE__ */
|
|
109
|
+
}, W = ae(null), Oe = ({ icons: t, children: r }) => /* @__PURE__ */ S(W.Provider, { value: t, children: r });
|
|
110
110
|
function ir() {
|
|
111
|
-
return
|
|
111
|
+
return k(W);
|
|
112
112
|
}
|
|
113
|
-
const
|
|
113
|
+
const $e = W, $ = ae(null), je = ({ defaults: t, children: r }) => /* @__PURE__ */ S($.Provider, { value: t, children: r });
|
|
114
114
|
function sr() {
|
|
115
|
-
return
|
|
115
|
+
return k($);
|
|
116
116
|
}
|
|
117
117
|
function cr(t) {
|
|
118
|
-
return
|
|
118
|
+
return k($)?.[t];
|
|
119
119
|
}
|
|
120
|
-
const
|
|
121
|
-
class
|
|
120
|
+
const Be = $;
|
|
121
|
+
class ze extends be {
|
|
122
122
|
state = { failed: !1 };
|
|
123
123
|
static getDerivedStateFromError() {
|
|
124
124
|
return { failed: !0 };
|
|
@@ -130,96 +130,96 @@ class Be extends be {
|
|
|
130
130
|
return this.state.failed ? null : this.props.children;
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
|
-
const
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
|
|
133
|
+
const He = le(function(r, f) {
|
|
134
|
+
const o = P(/* @__PURE__ */ new Map()), [, u] = Re((m) => m + 1, 0), d = P(!1), l = P(0), a = P(0), h = P(!1), g = P(!1), C = () => {
|
|
135
|
+
d.current || (d.current = !0, queueMicrotask(() => {
|
|
136
|
+
d.current = !1, !g.current && (oe(u), v());
|
|
137
137
|
}));
|
|
138
|
-
},
|
|
138
|
+
}, v = () => {
|
|
139
139
|
l.current || (l.current = requestAnimationFrame(() => {
|
|
140
|
-
l.current = 0, !
|
|
140
|
+
l.current = 0, !g.current && u();
|
|
141
141
|
}));
|
|
142
|
-
},
|
|
143
|
-
console.error(`[grid-react] Portal "${
|
|
142
|
+
}, G = (m, s) => {
|
|
143
|
+
console.error(`[grid-react] Portal "${m}" crashed; dropping.`, s), o.current.delete(m), v();
|
|
144
144
|
};
|
|
145
145
|
fe(
|
|
146
|
-
|
|
146
|
+
f,
|
|
147
147
|
() => ({
|
|
148
|
-
renderPortal(
|
|
149
|
-
|
|
148
|
+
renderPortal(m, s, p) {
|
|
149
|
+
g.current || (o.current.set(m, { container: s, element: p }), C());
|
|
150
150
|
},
|
|
151
|
-
removePortal(
|
|
152
|
-
if (
|
|
153
|
-
|
|
151
|
+
removePortal(m, s) {
|
|
152
|
+
if (g.current) {
|
|
153
|
+
o.current.delete(m);
|
|
154
154
|
return;
|
|
155
155
|
}
|
|
156
|
-
|
|
156
|
+
o.current.delete(m) && (a.current > 0 ? h.current = !0 : s ? oe(u) : C());
|
|
157
157
|
},
|
|
158
158
|
beginBatch() {
|
|
159
|
-
|
|
159
|
+
a.current++;
|
|
160
160
|
},
|
|
161
161
|
endBatch() {
|
|
162
|
-
|
|
162
|
+
a.current !== 0 && (a.current--, a.current === 0 && h.current && (h.current = !1, u()));
|
|
163
163
|
},
|
|
164
164
|
clear() {
|
|
165
|
-
if (
|
|
166
|
-
|
|
165
|
+
if (g.current) {
|
|
166
|
+
o.current.clear();
|
|
167
167
|
return;
|
|
168
168
|
}
|
|
169
|
-
|
|
169
|
+
o.current.size > 0 && (o.current.clear(), l.current && (cancelAnimationFrame(l.current), l.current = 0), C());
|
|
170
170
|
}
|
|
171
171
|
}),
|
|
172
172
|
// forceRender is stable (useReducer dispatch), refs are stable
|
|
173
173
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
174
174
|
[]
|
|
175
175
|
), de(() => {
|
|
176
|
-
|
|
177
|
-
const
|
|
176
|
+
g.current = !1;
|
|
177
|
+
const m = o.current;
|
|
178
178
|
return () => {
|
|
179
|
-
|
|
179
|
+
g.current = !0, l.current && (cancelAnimationFrame(l.current), l.current = 0), m.clear();
|
|
180
180
|
};
|
|
181
181
|
}, []);
|
|
182
|
-
const
|
|
183
|
-
let
|
|
184
|
-
for (const [
|
|
185
|
-
if (!
|
|
186
|
-
(
|
|
182
|
+
const w = [];
|
|
183
|
+
let D = null;
|
|
184
|
+
for (const [m, { container: s, element: p }] of o.current) {
|
|
185
|
+
if (!s.isConnected) {
|
|
186
|
+
(D ??= []).push(m);
|
|
187
187
|
continue;
|
|
188
188
|
}
|
|
189
|
-
|
|
189
|
+
w.push(
|
|
190
190
|
Ee(
|
|
191
|
-
/* @__PURE__ */
|
|
192
|
-
|
|
193
|
-
|
|
191
|
+
/* @__PURE__ */ S(ze, { portalKey: m, onError: G, children: p }),
|
|
192
|
+
s,
|
|
193
|
+
m
|
|
194
194
|
)
|
|
195
195
|
);
|
|
196
196
|
}
|
|
197
|
-
if (
|
|
198
|
-
const
|
|
197
|
+
if (D) {
|
|
198
|
+
const m = D;
|
|
199
199
|
queueMicrotask(() => {
|
|
200
|
-
for (const
|
|
200
|
+
for (const s of m) o.current.delete(s);
|
|
201
201
|
});
|
|
202
202
|
}
|
|
203
|
-
return /* @__PURE__ */
|
|
203
|
+
return /* @__PURE__ */ S(U, { children: w });
|
|
204
204
|
}), Ke = {
|
|
205
205
|
undoRedo: ["editing"],
|
|
206
206
|
clipboard: ["selection"]
|
|
207
207
|
};
|
|
208
208
|
function _e(t) {
|
|
209
209
|
const r = new Set(t);
|
|
210
|
-
for (const
|
|
211
|
-
const
|
|
212
|
-
if (
|
|
213
|
-
for (const
|
|
214
|
-
r.has(
|
|
215
|
-
`[DataGrid] Feature "${
|
|
210
|
+
for (const f of t) {
|
|
211
|
+
const o = Ke[f];
|
|
212
|
+
if (o)
|
|
213
|
+
for (const u of o)
|
|
214
|
+
r.has(u) || console.warn(
|
|
215
|
+
`[DataGrid] Feature "${f}" requires "${u}" to be enabled. Add the "${u}" prop to your DataGrid.`
|
|
216
216
|
);
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
219
|
function qe(t) {
|
|
220
220
|
const r = [];
|
|
221
|
-
for (const [
|
|
222
|
-
|
|
221
|
+
for (const [f, o] of Object.entries(t))
|
|
222
|
+
o === void 0 || o === !1 || r.push(f);
|
|
223
223
|
return _e(r), Te(t);
|
|
224
224
|
}
|
|
225
225
|
let se = !1, _ = null;
|
|
@@ -233,7 +233,7 @@ function Ue(t) {
|
|
|
233
233
|
let r = ce.get(t);
|
|
234
234
|
return r === void 0 && (r = ++Ve, ce.set(t, r)), r;
|
|
235
235
|
}
|
|
236
|
-
|
|
236
|
+
ye("GridDetailPanel", (t) => {
|
|
237
237
|
const r = t.props;
|
|
238
238
|
return {
|
|
239
239
|
masterDetail: {
|
|
@@ -243,37 +243,36 @@ Ce("GridDetailPanel", (t) => {
|
|
|
243
243
|
}
|
|
244
244
|
};
|
|
245
245
|
});
|
|
246
|
-
|
|
246
|
+
ye("GridResponsiveCard", () => ({
|
|
247
247
|
// GridResponsiveCard only carries cardRowHeight; breakpoint is set via the
|
|
248
248
|
// responsive prop. Enable the plugin with defaults — user can override.
|
|
249
249
|
responsive: !0
|
|
250
250
|
}));
|
|
251
|
-
const ur = le(function(r,
|
|
251
|
+
const ur = le(function(r, f) {
|
|
252
252
|
const {
|
|
253
253
|
// Core props
|
|
254
|
-
rows:
|
|
255
|
-
gridConfig:
|
|
256
|
-
columns:
|
|
254
|
+
rows: o,
|
|
255
|
+
gridConfig: u,
|
|
256
|
+
columns: d,
|
|
257
257
|
columnDefaults: l,
|
|
258
|
-
fitMode:
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
258
|
+
fitMode: a,
|
|
259
|
+
columnInference: h,
|
|
260
|
+
sortable: g,
|
|
261
|
+
filterable: C,
|
|
262
|
+
selectable: v,
|
|
263
|
+
loading: G,
|
|
264
|
+
customStyles: w,
|
|
265
|
+
className: D,
|
|
266
|
+
style: m,
|
|
267
|
+
children: s,
|
|
267
268
|
// Plugin props
|
|
268
|
-
plugins:
|
|
269
|
-
// SSR mode (deprecated - see SSRProps)
|
|
270
|
-
ssr: m,
|
|
269
|
+
plugins: p,
|
|
271
270
|
// Legacy event handlers
|
|
272
|
-
onRowsChange:
|
|
271
|
+
onRowsChange: y,
|
|
273
272
|
// Feature props and event props are in ...rest
|
|
274
|
-
...
|
|
275
|
-
} = r,
|
|
276
|
-
const i =
|
|
273
|
+
...b
|
|
274
|
+
} = r, n = P(null), F = P(null), J = P(!1), Y = k(Be), j = k($e), Ce = T(() => te().map((e) => {
|
|
275
|
+
const i = b[e];
|
|
277
276
|
if (i === void 0) return "";
|
|
278
277
|
let c;
|
|
279
278
|
try {
|
|
@@ -282,371 +281,370 @@ const ur = le(function(r, d) {
|
|
|
282
281
|
c = typeof i == "object" && i !== null ? `ref#${Ue(i)}` : `prim:${String(i)}`;
|
|
283
282
|
}
|
|
284
283
|
return `${e}:${c}`;
|
|
285
|
-
}).filter(Boolean).join("|"), [
|
|
286
|
-
const e = {}, i =
|
|
284
|
+
}).filter(Boolean).join("|"), [b]), Z = T(() => {
|
|
285
|
+
const e = {}, i = b;
|
|
287
286
|
for (const c of te()) {
|
|
288
|
-
const
|
|
289
|
-
|
|
287
|
+
const x = i[c];
|
|
288
|
+
x !== void 0 && (e[c] = x);
|
|
290
289
|
}
|
|
291
290
|
return e;
|
|
292
|
-
}, [
|
|
293
|
-
const e =
|
|
294
|
-
for (const [c,
|
|
295
|
-
e && c in e && e[c] !== void 0 && e[c] !== !1 || (i[c] =
|
|
291
|
+
}, [Ce]), Q = T(() => ke(s), [s]), X = T(() => {
|
|
292
|
+
const e = u?.features, i = {};
|
|
293
|
+
for (const [c, x] of Object.entries(Q))
|
|
294
|
+
e && c in e && e[c] !== void 0 && e[c] !== !1 || (i[c] = x);
|
|
296
295
|
return { ...i, ...Z };
|
|
297
|
-
}, [Z, Q,
|
|
298
|
-
if (
|
|
299
|
-
const e = new Set(
|
|
300
|
-
return [...
|
|
296
|
+
}, [Z, Q, u]), B = T(() => p ? [] : qe(X), [X, p]), I = T(() => {
|
|
297
|
+
if (p) {
|
|
298
|
+
const e = new Set(p.map((c) => c.name)), i = B.filter((c) => !e.has(c.name));
|
|
299
|
+
return [...p, ...i];
|
|
301
300
|
}
|
|
302
|
-
return
|
|
303
|
-
}, [
|
|
304
|
-
const e = Fe(
|
|
305
|
-
if (
|
|
306
|
-
const c = e?.icons ||
|
|
307
|
-
i.icons = {
|
|
301
|
+
return B;
|
|
302
|
+
}, [p, B]), L = T(() => d && Ne(Me(d), l), [d, l]), A = T(() => {
|
|
303
|
+
const e = Fe(u), i = {};
|
|
304
|
+
if (g !== void 0 && (i.sortable = g), C !== void 0 && (i.filterable = C), v !== void 0 && (i.selectable = v), j) {
|
|
305
|
+
const c = e?.icons || u?.icons || {};
|
|
306
|
+
i.icons = { ...j, ...c };
|
|
308
307
|
}
|
|
309
|
-
if (
|
|
310
|
-
const c = e.plugins || [],
|
|
308
|
+
if (I.length > 0 && e) {
|
|
309
|
+
const c = e.plugins || [], x = new Set(c.map((M) => M.name)), H = I.filter((M) => !x.has(M.name));
|
|
311
310
|
return {
|
|
312
311
|
...e,
|
|
313
312
|
...i,
|
|
314
|
-
plugins: [...c, ...
|
|
313
|
+
plugins: [...c, ...H]
|
|
315
314
|
};
|
|
316
315
|
}
|
|
317
|
-
return
|
|
318
|
-
}, [
|
|
319
|
-
|
|
316
|
+
return I.length > 0 && !e ? { ...i, plugins: I } : Object.keys(i).length > 0 ? { ...e, ...i } : e;
|
|
317
|
+
}, [u, I, g, C, v, j]);
|
|
318
|
+
R(() => {
|
|
320
319
|
V().setTypeDefaults(Y);
|
|
321
|
-
}, [Y]),
|
|
322
|
-
|
|
323
|
-
}, [
|
|
324
|
-
|
|
325
|
-
}, [
|
|
326
|
-
|
|
327
|
-
}, [
|
|
328
|
-
|
|
329
|
-
}, [
|
|
330
|
-
|
|
331
|
-
}, [
|
|
332
|
-
|
|
320
|
+
}, [Y]), R(() => {
|
|
321
|
+
n.current && (n.current.rows = o);
|
|
322
|
+
}, [o]), R(() => {
|
|
323
|
+
n.current && A && (n.current.gridConfig = A);
|
|
324
|
+
}, [A]), R(() => {
|
|
325
|
+
n.current && L && (n.current.columns = L);
|
|
326
|
+
}, [L]), R(() => {
|
|
327
|
+
n.current && a !== void 0 && (n.current.fitMode = a);
|
|
328
|
+
}, [a]), R(() => {
|
|
329
|
+
n.current && (n.current.columnInference = h);
|
|
330
|
+
}, [h]), R(() => {
|
|
331
|
+
n.current && G !== void 0 && (n.current.loading = G);
|
|
332
|
+
}, [G]), R(() => {
|
|
333
|
+
const e = n.current;
|
|
333
334
|
if (!e) return;
|
|
334
335
|
const i = V();
|
|
335
336
|
e.__frameworkAdapter = i, De(e);
|
|
336
337
|
let c = !1;
|
|
337
|
-
const
|
|
338
|
+
const x = requestAnimationFrame(() => {
|
|
338
339
|
c || (typeof e.refreshColumns == "function" && e.refreshColumns(), typeof e.refreshShellHeader == "function" && e.refreshShellHeader());
|
|
339
340
|
});
|
|
340
341
|
return () => {
|
|
341
|
-
c = !0, cancelAnimationFrame(
|
|
342
|
+
c = !0, cancelAnimationFrame(x);
|
|
342
343
|
};
|
|
343
|
-
}, []),
|
|
344
|
-
if (!
|
|
345
|
-
const e =
|
|
344
|
+
}, []), R(() => {
|
|
345
|
+
if (!n.current || !w) return;
|
|
346
|
+
const e = n.current, i = "react-custom-styles";
|
|
346
347
|
let c = !0;
|
|
347
348
|
return e.ready?.().then(() => {
|
|
348
|
-
c &&
|
|
349
|
+
c && w && (e.registerStyles?.(i, w), F.current = i);
|
|
349
350
|
}), () => {
|
|
350
|
-
c = !1,
|
|
351
|
+
c = !1, F.current && (e.unregisterStyles?.(F.current), F.current = null);
|
|
351
352
|
};
|
|
352
|
-
}, [
|
|
353
|
-
const e =
|
|
353
|
+
}, [w]), R(() => {
|
|
354
|
+
const e = n.current;
|
|
354
355
|
if (!e) return;
|
|
355
356
|
const i = [];
|
|
356
|
-
return
|
|
357
|
+
return y && i.push(e.on("rows-change", (c) => y(c.rows))), () => {
|
|
357
358
|
i.forEach((c) => c());
|
|
358
359
|
};
|
|
359
|
-
}, [
|
|
360
|
-
const ee =
|
|
360
|
+
}, [y]);
|
|
361
|
+
const ee = T(() => Object.keys(K).filter((e) => typeof b[e] == "function").sort().join("|"), [b]), re = P({});
|
|
361
362
|
for (const e of Object.keys(K))
|
|
362
|
-
re.current[e] =
|
|
363
|
-
|
|
364
|
-
const e =
|
|
363
|
+
re.current[e] = b[e];
|
|
364
|
+
R(() => {
|
|
365
|
+
const e = n.current;
|
|
365
366
|
if (!e) return;
|
|
366
367
|
const i = [];
|
|
367
|
-
for (const [c,
|
|
368
|
+
for (const [c, x] of Object.entries(K))
|
|
368
369
|
ee.includes(c) && i.push(
|
|
369
|
-
e.on(
|
|
370
|
-
re.current[c]?.(
|
|
370
|
+
e.on(x, (H, M) => {
|
|
371
|
+
re.current[c]?.(H, M);
|
|
371
372
|
})
|
|
372
373
|
);
|
|
373
374
|
return () => {
|
|
374
375
|
i.forEach((c) => c());
|
|
375
376
|
};
|
|
376
377
|
}, [ee]), fe(
|
|
377
|
-
|
|
378
|
+
f,
|
|
378
379
|
() => ({
|
|
379
380
|
get element() {
|
|
380
|
-
return
|
|
381
|
+
return n.current;
|
|
381
382
|
},
|
|
382
383
|
async getConfig() {
|
|
383
|
-
return
|
|
384
|
+
return n.current?.getConfig?.() ?? {};
|
|
384
385
|
},
|
|
385
386
|
async ready() {
|
|
386
|
-
return
|
|
387
|
+
return n.current?.ready?.();
|
|
387
388
|
},
|
|
388
389
|
async forceLayout() {
|
|
389
|
-
return
|
|
390
|
+
return n.current?.forceLayout?.();
|
|
390
391
|
},
|
|
391
392
|
async toggleGroup(e) {
|
|
392
|
-
return
|
|
393
|
+
return n.current?.toggleGroup?.(e);
|
|
393
394
|
},
|
|
394
395
|
registerStyles(e, i) {
|
|
395
|
-
|
|
396
|
+
n.current?.registerStyles?.(e, i);
|
|
396
397
|
},
|
|
397
398
|
unregisterStyles(e) {
|
|
398
|
-
|
|
399
|
+
n.current?.unregisterStyles?.(e);
|
|
399
400
|
},
|
|
400
401
|
setRowLoading(e, i) {
|
|
401
|
-
|
|
402
|
+
n.current?.setRowLoading?.(e, i);
|
|
402
403
|
},
|
|
403
404
|
setCellLoading(e, i, c) {
|
|
404
|
-
|
|
405
|
+
n.current?.setCellLoading?.(e, i, c);
|
|
405
406
|
},
|
|
406
407
|
isRowLoading(e) {
|
|
407
|
-
return
|
|
408
|
+
return n.current?.isRowLoading?.(e) ?? !1;
|
|
408
409
|
},
|
|
409
410
|
isCellLoading(e, i) {
|
|
410
|
-
return
|
|
411
|
+
return n.current?.isCellLoading?.(e, i) ?? !1;
|
|
411
412
|
},
|
|
412
413
|
clearAllLoading() {
|
|
413
|
-
|
|
414
|
+
n.current?.clearAllLoading?.();
|
|
414
415
|
}
|
|
415
416
|
}),
|
|
416
417
|
[]
|
|
417
418
|
);
|
|
418
|
-
const
|
|
419
|
+
const z = P(null);
|
|
419
420
|
return de(() => {
|
|
420
|
-
const e =
|
|
421
|
-
return e &&
|
|
421
|
+
const e = n.current;
|
|
422
|
+
return e && z.current && ne(e, z.current), () => {
|
|
422
423
|
e && ne(e, null);
|
|
423
424
|
};
|
|
424
425
|
}, []), /* @__PURE__ */ he(U, { children: [
|
|
425
|
-
/* @__PURE__ */
|
|
426
|
+
/* @__PURE__ */ S(He, { ref: z }),
|
|
426
427
|
Pe(
|
|
427
428
|
ue.activeTag,
|
|
428
429
|
{
|
|
429
430
|
ref: (e) => {
|
|
430
|
-
if (
|
|
431
|
+
if (n.current = e, e && !J.current) {
|
|
431
432
|
J.current = !0;
|
|
432
433
|
const i = e;
|
|
433
|
-
|
|
434
|
+
A && (i.gridConfig = A), o && (i.rows = o), L && (i.columns = L);
|
|
434
435
|
}
|
|
435
436
|
},
|
|
436
|
-
class:
|
|
437
|
-
style:
|
|
437
|
+
class: D,
|
|
438
|
+
style: m
|
|
438
439
|
},
|
|
439
|
-
/* @__PURE__ */
|
|
440
|
+
/* @__PURE__ */ S(O.Provider, { value: n, children: s })
|
|
440
441
|
)
|
|
441
442
|
] });
|
|
442
443
|
});
|
|
443
444
|
function ar(t) {
|
|
444
445
|
const {
|
|
445
446
|
field: r,
|
|
446
|
-
header:
|
|
447
|
-
type:
|
|
448
|
-
editable:
|
|
449
|
-
sortable:
|
|
447
|
+
header: f,
|
|
448
|
+
type: o,
|
|
449
|
+
editable: u,
|
|
450
|
+
sortable: d,
|
|
450
451
|
resizable: l,
|
|
451
|
-
width:
|
|
452
|
-
minWidth:
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
452
|
+
width: a,
|
|
453
|
+
minWidth: h,
|
|
454
|
+
order: g,
|
|
455
|
+
hidden: C,
|
|
456
|
+
lockVisible: v,
|
|
457
|
+
children: G,
|
|
458
|
+
editor: w,
|
|
459
|
+
options: D,
|
|
460
|
+
multi: m,
|
|
461
|
+
format: s
|
|
462
|
+
} = t, p = P(null), y = E(
|
|
463
|
+
(F) => {
|
|
464
|
+
p.current = F, F && (G && Se(F, G), w && xe(F, w));
|
|
463
465
|
},
|
|
464
|
-
[
|
|
465
|
-
),
|
|
466
|
+
[G, w]
|
|
467
|
+
), b = typeof a == "number" ? `${a}px` : a, n = {
|
|
466
468
|
field: r,
|
|
467
|
-
ref:
|
|
469
|
+
ref: y
|
|
468
470
|
};
|
|
469
|
-
return
|
|
471
|
+
return f !== void 0 && (n.header = f), o !== void 0 && (n.type = o), u !== void 0 && (n.editable = u), d !== void 0 && (n.sortable = d), l !== void 0 && (n.resizable = l), b !== void 0 && (n.width = b), h !== void 0 && (n["min-width"] = h), g !== void 0 && (n.order = g), C !== void 0 && (n.hidden = C), v !== void 0 && (n["lock-visible"] = v), m !== void 0 && (n.multi = m), s && (n["data-has-format"] = "true"), D && (n["data-has-options"] = "true"), /* @__PURE__ */ S("tbw-grid-column", { ...n });
|
|
470
472
|
}
|
|
471
|
-
function lr({ id: t, order: r = 100, children:
|
|
472
|
-
const
|
|
473
|
-
return
|
|
474
|
-
const
|
|
475
|
-
if (!
|
|
476
|
-
const
|
|
477
|
-
let
|
|
473
|
+
function lr({ id: t, order: r = 100, children: f }) {
|
|
474
|
+
const o = ge(), u = t ?? `tbw-header-content-${o}`, d = k(O), [l, a] = N(null), h = P(null);
|
|
475
|
+
return R(() => {
|
|
476
|
+
const g = d?.current;
|
|
477
|
+
if (!g) return;
|
|
478
|
+
const C = h;
|
|
479
|
+
let v = !1;
|
|
478
480
|
return (async () => {
|
|
479
481
|
try {
|
|
480
|
-
await
|
|
482
|
+
await g.ready?.();
|
|
481
483
|
} catch {
|
|
482
484
|
return;
|
|
483
485
|
}
|
|
484
|
-
if (
|
|
485
|
-
const
|
|
486
|
-
id:
|
|
486
|
+
if (v) return;
|
|
487
|
+
const G = {
|
|
488
|
+
id: u,
|
|
487
489
|
order: r,
|
|
488
|
-
render: (
|
|
490
|
+
render: (w) => (a(w), () => {
|
|
489
491
|
})
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
+
};
|
|
493
|
+
g.getPluginByName?.("shell")?.registerHeaderContent(G);
|
|
492
494
|
})(), () => {
|
|
493
|
-
|
|
494
|
-
const y = f.getPluginByName?.("shell");
|
|
495
|
-
y?.unregisterHeaderContent ? y.unregisterHeaderContent(s) : f.unregisterHeaderContent?.(s), w.current && (pe(w.current, { sync: !0 }), w.current = null), u(null);
|
|
495
|
+
v = !0, g.getPluginByName?.("shell")?.unregisterHeaderContent(u), C.current && (pe(C.current, { sync: !0 }), C.current = null), a(null);
|
|
496
496
|
};
|
|
497
|
-
}, [
|
|
497
|
+
}, [d, u, r]), R(() => {
|
|
498
498
|
if (!l) return;
|
|
499
|
-
const
|
|
500
|
-
|
|
501
|
-
}, [
|
|
499
|
+
const g = d?.current ?? void 0;
|
|
500
|
+
h.current = me(l, f, h.current ?? void 0, g);
|
|
501
|
+
}, [f, l, d]), null;
|
|
502
502
|
}
|
|
503
503
|
function fr({ children: t }) {
|
|
504
|
-
return /* @__PURE__ */
|
|
504
|
+
return /* @__PURE__ */ S("tbw-grid-tool-buttons", { children: t });
|
|
505
505
|
}
|
|
506
|
-
function dr({ id: t, order: r = 100, children:
|
|
507
|
-
const
|
|
508
|
-
return
|
|
509
|
-
const
|
|
510
|
-
if (!
|
|
511
|
-
const
|
|
512
|
-
let
|
|
506
|
+
function dr({ id: t, order: r = 100, children: f }) {
|
|
507
|
+
const o = ge(), u = t ?? `tbw-toolbar-content-${o}`, d = k(O), [l, a] = N(null), h = P(null);
|
|
508
|
+
return R(() => {
|
|
509
|
+
const g = d?.current;
|
|
510
|
+
if (!g) return;
|
|
511
|
+
const C = h;
|
|
512
|
+
let v = !1;
|
|
513
513
|
return (async () => {
|
|
514
514
|
try {
|
|
515
|
-
await
|
|
515
|
+
await g.ready?.();
|
|
516
516
|
} catch {
|
|
517
517
|
return;
|
|
518
518
|
}
|
|
519
|
-
if (
|
|
520
|
-
const
|
|
521
|
-
id:
|
|
519
|
+
if (v) return;
|
|
520
|
+
const G = {
|
|
521
|
+
id: u,
|
|
522
522
|
order: r,
|
|
523
|
-
render: (
|
|
523
|
+
render: (w) => (a(w), () => {
|
|
524
524
|
})
|
|
525
|
-
}
|
|
526
|
-
|
|
525
|
+
};
|
|
526
|
+
g.getPluginByName?.("shell")?.registerToolbarContent(G);
|
|
527
527
|
})(), () => {
|
|
528
|
-
|
|
529
|
-
const y = f.getPluginByName?.("shell");
|
|
530
|
-
y?.unregisterToolbarContent ? y.unregisterToolbarContent(s) : f.unregisterToolbarContent?.(s), w.current && (pe(w.current, { sync: !0 }), w.current = null), u(null);
|
|
528
|
+
v = !0, g.getPluginByName?.("shell")?.unregisterToolbarContent(u), C.current && (pe(C.current, { sync: !0 }), C.current = null), a(null);
|
|
531
529
|
};
|
|
532
|
-
}, [
|
|
530
|
+
}, [d, u, r]), R(() => {
|
|
533
531
|
if (!l) return;
|
|
534
|
-
const
|
|
535
|
-
|
|
536
|
-
}, [
|
|
532
|
+
const g = d?.current ?? void 0;
|
|
533
|
+
h.current = me(l, f, h.current ?? void 0, g);
|
|
534
|
+
}, [f, l, d]), null;
|
|
537
535
|
}
|
|
538
|
-
const gr = ({ icons: t, defaults: r, children:
|
|
539
|
-
let
|
|
540
|
-
return r && (
|
|
536
|
+
const gr = ({ icons: t, defaults: r, children: f }) => {
|
|
537
|
+
let o = f;
|
|
538
|
+
return r && (o = /* @__PURE__ */ S(je, { defaults: r, children: o })), t && (o = /* @__PURE__ */ S(Oe, { icons: t, children: o })), /* @__PURE__ */ S(U, { children: o });
|
|
541
539
|
};
|
|
542
540
|
function pr(t) {
|
|
543
|
-
const r = P(null), [
|
|
544
|
-
|
|
545
|
-
let
|
|
541
|
+
const r = P(null), [f, o] = N(!1), [u, d] = N(null), l = P(null), a = E(() => t ? (l.current ??= document.querySelector(t), l.current) : r.current?.element ?? null, [t]);
|
|
542
|
+
R(() => {
|
|
543
|
+
let s = !0;
|
|
546
544
|
return (async () => {
|
|
547
545
|
try {
|
|
548
546
|
if (t) {
|
|
549
|
-
const
|
|
550
|
-
if (!
|
|
551
|
-
if (l.current =
|
|
552
|
-
|
|
553
|
-
const
|
|
554
|
-
|
|
547
|
+
const y = document.querySelector(t);
|
|
548
|
+
if (!y) return;
|
|
549
|
+
if (l.current = y, await y.ready?.(), s) {
|
|
550
|
+
o(!0);
|
|
551
|
+
const b = await y.getConfig?.();
|
|
552
|
+
s && b && d(b);
|
|
555
553
|
}
|
|
556
554
|
} else {
|
|
557
|
-
const
|
|
558
|
-
if (!
|
|
559
|
-
if (await
|
|
560
|
-
|
|
561
|
-
const
|
|
562
|
-
|
|
555
|
+
const y = r.current;
|
|
556
|
+
if (!y) return;
|
|
557
|
+
if (await y.ready?.(), s) {
|
|
558
|
+
o(!0);
|
|
559
|
+
const b = await y.getConfig?.();
|
|
560
|
+
s && b && d(b);
|
|
563
561
|
}
|
|
564
562
|
}
|
|
565
563
|
} catch {
|
|
566
564
|
}
|
|
567
565
|
})(), () => {
|
|
568
|
-
|
|
566
|
+
s = !1;
|
|
569
567
|
};
|
|
570
568
|
}, [t]);
|
|
571
|
-
const
|
|
572
|
-
const
|
|
573
|
-
if (
|
|
574
|
-
return await
|
|
575
|
-
const
|
|
576
|
-
return
|
|
577
|
-
}, [
|
|
578
|
-
const
|
|
579
|
-
if (
|
|
580
|
-
await
|
|
569
|
+
const h = E(async () => {
|
|
570
|
+
const s = a();
|
|
571
|
+
if (s)
|
|
572
|
+
return await s.getConfig?.() ?? null;
|
|
573
|
+
const p = r.current;
|
|
574
|
+
return p ? await p.getConfig?.() ?? null : null;
|
|
575
|
+
}, [a]), g = E(async () => {
|
|
576
|
+
const s = a();
|
|
577
|
+
if (s) {
|
|
578
|
+
await s.forceLayout?.();
|
|
581
579
|
return;
|
|
582
580
|
}
|
|
583
|
-
const
|
|
584
|
-
|
|
585
|
-
}, [
|
|
586
|
-
async (
|
|
587
|
-
const
|
|
588
|
-
if (
|
|
589
|
-
await
|
|
581
|
+
const p = r.current;
|
|
582
|
+
p && await p.forceLayout?.();
|
|
583
|
+
}, [a]), C = E(
|
|
584
|
+
async (s) => {
|
|
585
|
+
const p = a();
|
|
586
|
+
if (p) {
|
|
587
|
+
await p.toggleGroup?.(s);
|
|
590
588
|
return;
|
|
591
589
|
}
|
|
592
|
-
const
|
|
593
|
-
|
|
590
|
+
const y = r.current;
|
|
591
|
+
y && await y.toggleGroup?.(s);
|
|
594
592
|
},
|
|
595
|
-
[
|
|
596
|
-
),
|
|
597
|
-
(
|
|
598
|
-
[
|
|
599
|
-
),
|
|
600
|
-
((
|
|
601
|
-
[
|
|
602
|
-
),
|
|
603
|
-
(
|
|
604
|
-
const
|
|
605
|
-
if (
|
|
606
|
-
|
|
593
|
+
[a]
|
|
594
|
+
), v = E(
|
|
595
|
+
(s) => a()?.getPlugin?.(s),
|
|
596
|
+
[a]
|
|
597
|
+
), G = E(
|
|
598
|
+
((s) => a()?.getPluginByName?.(s)),
|
|
599
|
+
[a]
|
|
600
|
+
), w = E(
|
|
601
|
+
(s, p) => {
|
|
602
|
+
const y = a();
|
|
603
|
+
if (y) {
|
|
604
|
+
y.registerStyles?.(s, p);
|
|
607
605
|
return;
|
|
608
606
|
}
|
|
609
|
-
r.current?.registerStyles?.(
|
|
607
|
+
r.current?.registerStyles?.(s, p);
|
|
610
608
|
},
|
|
611
|
-
[
|
|
612
|
-
),
|
|
613
|
-
(
|
|
614
|
-
const
|
|
615
|
-
if (
|
|
616
|
-
|
|
609
|
+
[a]
|
|
610
|
+
), D = E(
|
|
611
|
+
(s) => {
|
|
612
|
+
const p = a();
|
|
613
|
+
if (p) {
|
|
614
|
+
p.unregisterStyles?.(s);
|
|
617
615
|
return;
|
|
618
616
|
}
|
|
619
|
-
r.current?.unregisterStyles?.(
|
|
617
|
+
r.current?.unregisterStyles?.(s);
|
|
620
618
|
},
|
|
621
|
-
[
|
|
622
|
-
),
|
|
619
|
+
[a]
|
|
620
|
+
), m = E(() => u?.columns ? u.columns.filter((s) => !s.hidden) : [], [u]);
|
|
623
621
|
return {
|
|
624
622
|
ref: r,
|
|
625
|
-
element:
|
|
626
|
-
isReady:
|
|
627
|
-
config:
|
|
628
|
-
getConfig:
|
|
629
|
-
forceLayout:
|
|
630
|
-
toggleGroup:
|
|
631
|
-
getPlugin:
|
|
632
|
-
getPluginByName:
|
|
633
|
-
registerStyles:
|
|
634
|
-
unregisterStyles:
|
|
635
|
-
getVisibleColumns:
|
|
623
|
+
element: a(),
|
|
624
|
+
isReady: f,
|
|
625
|
+
config: u,
|
|
626
|
+
getConfig: h,
|
|
627
|
+
forceLayout: g,
|
|
628
|
+
toggleGroup: C,
|
|
629
|
+
getPlugin: v,
|
|
630
|
+
getPluginByName: G,
|
|
631
|
+
registerStyles: w,
|
|
632
|
+
unregisterStyles: D,
|
|
633
|
+
getVisibleColumns: m
|
|
636
634
|
};
|
|
637
635
|
}
|
|
638
636
|
function mr(t, r = {}) {
|
|
639
|
-
const { open:
|
|
640
|
-
|
|
637
|
+
const { open: f = !0, gridElement: o } = r, u = k(O);
|
|
638
|
+
R(() => {
|
|
639
|
+
if (!f) return;
|
|
640
|
+
const d = t.current;
|
|
641
641
|
if (!d) return;
|
|
642
|
-
const
|
|
643
|
-
if (!g) return;
|
|
644
|
-
const l = n ?? g.closest("tbw-grid, [data-tbw-grid]") ?? s?.current ?? null;
|
|
642
|
+
const l = o ?? d.closest("tbw-grid, [data-tbw-grid]") ?? u?.current ?? null;
|
|
645
643
|
if (l)
|
|
646
|
-
return l.registerExternalFocusContainer?.(
|
|
647
|
-
l.unregisterExternalFocusContainer?.(
|
|
644
|
+
return l.registerExternalFocusContainer?.(d), () => {
|
|
645
|
+
l.unregisterExternalFocusContainer?.(d);
|
|
648
646
|
};
|
|
649
|
-
}, [
|
|
647
|
+
}, [f, o, u, t]);
|
|
650
648
|
}
|
|
651
649
|
export {
|
|
652
650
|
ur as DataGrid,
|
|
@@ -660,12 +658,12 @@ export {
|
|
|
660
658
|
fr as GridToolButtons,
|
|
661
659
|
hr as GridToolPanel,
|
|
662
660
|
dr as GridToolbarContent,
|
|
663
|
-
|
|
661
|
+
je as GridTypeProvider,
|
|
664
662
|
Ne as applyColumnDefaults,
|
|
665
663
|
or as hasColumnShorthands,
|
|
666
664
|
Me as normalizeColumns,
|
|
667
665
|
Ae as parseColumnShorthand,
|
|
668
|
-
|
|
666
|
+
ye as registerChildFeatureDetector,
|
|
669
667
|
Pr as registerEditorMountHook,
|
|
670
668
|
vr as registerFeaturePropKey,
|
|
671
669
|
Rr as registerPostMountRefresh,
|