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