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