@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/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import { jsx as x, Fragment as U, jsxs as he } from "react/jsx-runtime";
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 T, forwardRef as le, useRef as P, useReducer as Re, useImperativeHandle as fe, useLayoutEffect as de, Component as be, useMemo as F, useEffect as b, createElement as Pe, useCallback as D, 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-LBf2Mqhn.js";
5
- import { e as hr, f as vr } from "./chunks/react-grid-adapter-LBf2Mqhn.js";
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 Ce(t, r) {
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, (d) => {
23
- if (!we(d)) return;
24
- const n = d.type, s = typeof n == "string" ? void 0 : n?.displayName;
25
- if (typeof s != "string") return;
26
- const g = q.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
  }
@@ -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 d = t.slice(r + 1).toLowerCase();
43
- if (Le.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: ie(n),
48
- type: d
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((d) => ({ ...r, ...d })) : t;
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__ */ x(W.Provider, { value: t, children: r });
109
+ }, W = ae(null), Oe = ({ icons: t, children: r }) => /* @__PURE__ */ S(W.Provider, { value: t, children: r });
110
110
  function ir() {
111
- return T(W);
111
+ return k(W);
112
112
  }
113
- const He = W, H = ae(null), $e = ({ defaults: t, children: r }) => /* @__PURE__ */ x(H.Provider, { value: t, children: r });
113
+ const $e = W, $ = ae(null), je = ({ defaults: t, children: r }) => /* @__PURE__ */ S($.Provider, { value: t, children: r });
114
114
  function sr() {
115
- return T(H);
115
+ return k($);
116
116
  }
117
117
  function cr(t) {
118
- return T(H)?.[t];
118
+ return k($)?.[t];
119
119
  }
120
- const je = H;
121
- class Be extends be {
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 ze = le(function(r, d) {
134
- const n = P(/* @__PURE__ */ new Map()), [, s] = Re((C) => C + 1, 0), g = P(!1), l = P(0), u = P(0), v = P(!1), f = P(!1), w = () => {
135
- g.current || (g.current = !0, queueMicrotask(() => {
136
- g.current = !1, !f.current && (oe(s), R());
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
- }, R = () => {
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
- }, y = (C, o) => {
143
- console.error(`[grid-react] Portal "${C}" crashed; dropping.`, o), n.current.delete(C), R();
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
- d,
146
+ f,
147
147
  () => ({
148
- renderPortal(C, o, m) {
149
- f.current || (n.current.set(C, { container: o, element: m }), w());
148
+ renderPortal(m, s, p) {
149
+ g.current || (o.current.set(m, { container: s, element: p }), C());
150
150
  },
151
- removePortal(C, o) {
152
- if (f.current) {
153
- n.current.delete(C);
151
+ removePortal(m, s) {
152
+ if (g.current) {
153
+ o.current.delete(m);
154
154
  return;
155
155
  }
156
- n.current.delete(C) && (u.current > 0 ? v.current = !0 : o ? oe(s) : w());
156
+ o.current.delete(m) && (a.current > 0 ? h.current = !0 : s ? oe(u) : C());
157
157
  },
158
158
  beginBatch() {
159
- u.current++;
159
+ a.current++;
160
160
  },
161
161
  endBatch() {
162
- u.current !== 0 && (u.current--, u.current === 0 && v.current && (v.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), w());
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
- f.current = !1;
177
- const C = n.current;
176
+ g.current = !1;
177
+ const m = o.current;
178
178
  return () => {
179
- f.current = !0, l.current && (cancelAnimationFrame(l.current), l.current = 0), C.clear();
179
+ g.current = !0, l.current && (cancelAnimationFrame(l.current), l.current = 0), m.clear();
180
180
  };
181
181
  }, []);
182
- const G = [];
183
- let S = null;
184
- for (const [C, { container: o, element: m }] of n.current) {
185
- if (!o.isConnected) {
186
- (S ??= []).push(C);
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
- G.push(
189
+ w.push(
190
190
  Ee(
191
- /* @__PURE__ */ x(Be, { portalKey: C, onError: y, children: m }),
192
- o,
193
- C
191
+ /* @__PURE__ */ S(ze, { portalKey: m, onError: G, children: p }),
192
+ s,
193
+ m
194
194
  )
195
195
  );
196
196
  }
197
- if (S) {
198
- const C = S;
197
+ if (D) {
198
+ const m = D;
199
199
  queueMicrotask(() => {
200
- for (const o of C) n.current.delete(o);
200
+ for (const s of m) o.current.delete(s);
201
201
  });
202
202
  }
203
- return /* @__PURE__ */ x(U, { children: G });
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 d of t) {
211
- const n = Ke[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
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);
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
- Ce("GridDetailPanel", (t) => {
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
- Ce("GridResponsiveCard", () => ({
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, 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
- fitMode: u,
259
- sortable: v,
260
- filterable: f,
261
- selectable: w,
262
- loading: R,
263
- customStyles: y,
264
- className: G,
265
- style: S,
266
- children: C,
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: o,
269
- // SSR mode (deprecated - see SSRProps)
270
- ssr: m,
269
+ plugins: p,
271
270
  // Legacy event handlers
272
- onRowsChange: h,
271
+ onRowsChange: y,
273
272
  // Feature props and event props are in ...rest
274
- ...p
275
- } = r, a = P(null), M = P(null), J = P(!1), Y = T(je), $ = T(He), ye = F(() => te().map((e) => {
276
- const i = p[e];
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("|"), [p]), Z = F(() => {
286
- const e = {}, i = p;
284
+ }).filter(Boolean).join("|"), [b]), Z = T(() => {
285
+ const e = {}, i = b;
287
286
  for (const c of te()) {
288
- const E = i[c];
289
- E !== void 0 && (e[c] = E);
287
+ const x = i[c];
288
+ x !== void 0 && (e[c] = x);
290
289
  }
291
290
  return e;
292
- }, [ye]), Q = F(() => ke(C), [C]), X = F(() => {
293
- const e = s?.features, i = {};
294
- for (const [c, E] of Object.entries(Q))
295
- e && c in e && e[c] !== void 0 && e[c] !== !1 || (i[c] = E);
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, s]), j = F(() => o || m ? [] : qe(X), [X, o, m]), k = F(() => {
298
- if (o) {
299
- const e = new Set(o.map((c) => c.name)), i = j.filter((c) => !e.has(c.name));
300
- return [...o, ...i];
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 j;
303
- }, [o, j]), I = F(() => g && Ne(Me(g), l), [g, l]), L = F(() => {
304
- const e = Fe(s), i = {};
305
- if (v !== void 0 && (i.sortable = v), f !== void 0 && (i.filterable = f), w !== void 0 && (i.selectable = w), $) {
306
- const c = e?.icons || s?.icons || {};
307
- i.icons = { ...$, ...c };
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 (k.length > 0 && e) {
310
- const c = e.plugins || [], E = new Set(c.map((A) => A.name)), z = k.filter((A) => !E.has(A.name));
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, ...z]
313
+ plugins: [...c, ...H]
315
314
  };
316
315
  }
317
- return k.length > 0 && !e ? { ...i, plugins: k } : Object.keys(i).length > 0 ? { ...e, ...i } : e;
318
- }, [s, k, v, f, w, $]);
319
- b(() => {
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]), b(() => {
322
- a.current && (a.current.rows = n);
323
- }, [n]), b(() => {
324
- a.current && L && (a.current.gridConfig = L);
325
- }, [L]), b(() => {
326
- a.current && I && (a.current.columns = I);
327
- }, [I]), b(() => {
328
- a.current && u !== void 0 && (a.current.fitMode = u);
329
- }, [u]), b(() => {
330
- a.current && R !== void 0 && (a.current.loading = R);
331
- }, [R]), b(() => {
332
- const e = a.current;
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 E = requestAnimationFrame(() => {
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(E);
342
+ c = !0, cancelAnimationFrame(x);
342
343
  };
343
- }, []), b(() => {
344
- if (!a.current || !y) return;
345
- const e = a.current, i = "react-custom-styles";
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 && y && (e.registerStyles?.(i, y), M.current = i);
349
+ c && w && (e.registerStyles?.(i, w), F.current = i);
349
350
  }), () => {
350
- c = !1, M.current && (e.unregisterStyles?.(M.current), M.current = null);
351
+ c = !1, F.current && (e.unregisterStyles?.(F.current), F.current = null);
351
352
  };
352
- }, [y]), b(() => {
353
- const e = a.current;
353
+ }, [w]), R(() => {
354
+ const e = n.current;
354
355
  if (!e) return;
355
356
  const i = [];
356
- return h && i.push(e.on("rows-change", (c) => h(c.rows))), () => {
357
+ return y && i.push(e.on("rows-change", (c) => y(c.rows))), () => {
357
358
  i.forEach((c) => c());
358
359
  };
359
- }, [h]);
360
- const ee = F(() => Object.keys(K).filter((e) => typeof p[e] == "function").sort().join("|"), [p]), re = P({});
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] = p[e];
363
- b(() => {
364
- const e = a.current;
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, E] of Object.entries(K))
368
+ for (const [c, x] of Object.entries(K))
368
369
  ee.includes(c) && i.push(
369
- e.on(E, (z, A) => {
370
- re.current[c]?.(z, A);
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
- d,
378
+ f,
378
379
  () => ({
379
380
  get element() {
380
- return a.current;
381
+ return n.current;
381
382
  },
382
383
  async getConfig() {
383
- return a.current?.getConfig?.() ?? {};
384
+ return n.current?.getConfig?.() ?? {};
384
385
  },
385
386
  async ready() {
386
- return a.current?.ready?.();
387
+ return n.current?.ready?.();
387
388
  },
388
389
  async forceLayout() {
389
- return a.current?.forceLayout?.();
390
+ return n.current?.forceLayout?.();
390
391
  },
391
392
  async toggleGroup(e) {
392
- return a.current?.toggleGroup?.(e);
393
+ return n.current?.toggleGroup?.(e);
393
394
  },
394
395
  registerStyles(e, i) {
395
- a.current?.registerStyles?.(e, i);
396
+ n.current?.registerStyles?.(e, i);
396
397
  },
397
398
  unregisterStyles(e) {
398
- a.current?.unregisterStyles?.(e);
399
+ n.current?.unregisterStyles?.(e);
399
400
  },
400
401
  setRowLoading(e, i) {
401
- a.current?.setRowLoading?.(e, i);
402
+ n.current?.setRowLoading?.(e, i);
402
403
  },
403
404
  setCellLoading(e, i, c) {
404
- a.current?.setCellLoading?.(e, i, c);
405
+ n.current?.setCellLoading?.(e, i, c);
405
406
  },
406
407
  isRowLoading(e) {
407
- return a.current?.isRowLoading?.(e) ?? !1;
408
+ return n.current?.isRowLoading?.(e) ?? !1;
408
409
  },
409
410
  isCellLoading(e, i) {
410
- return a.current?.isCellLoading?.(e, i) ?? !1;
411
+ return n.current?.isCellLoading?.(e, i) ?? !1;
411
412
  },
412
413
  clearAllLoading() {
413
- a.current?.clearAllLoading?.();
414
+ n.current?.clearAllLoading?.();
414
415
  }
415
416
  }),
416
417
  []
417
418
  );
418
- const B = P(null);
419
+ const z = P(null);
419
420
  return de(() => {
420
- const e = a.current;
421
- return e && B.current && ne(e, B.current), () => {
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__ */ x(ze, { ref: B }),
426
+ /* @__PURE__ */ S(He, { ref: z }),
426
427
  Pe(
427
428
  ue.activeTag,
428
429
  {
429
430
  ref: (e) => {
430
- if (a.current = e, e && !J.current) {
431
+ if (n.current = e, e && !J.current) {
431
432
  J.current = !0;
432
433
  const i = e;
433
- L && (i.gridConfig = L), n && (i.rows = n), I && (i.columns = I);
434
+ A && (i.gridConfig = A), o && (i.rows = o), L && (i.columns = L);
434
435
  }
435
436
  },
436
- class: G,
437
- style: S
437
+ class: D,
438
+ style: m
438
439
  },
439
- /* @__PURE__ */ x(O.Provider, { value: a, children: C })
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: d,
447
- type: n,
448
- editable: s,
449
- sortable: g,
447
+ header: f,
448
+ type: o,
449
+ editable: u,
450
+ sortable: d,
450
451
  resizable: l,
451
- width: u,
452
- minWidth: v,
453
- hidden: f,
454
- lockVisible: w,
455
- children: R,
456
- editor: y,
457
- options: G,
458
- multi: S,
459
- format: C
460
- } = t, o = P(null), m = D(
461
- (a) => {
462
- o.current = a, a && (R && Se(a, R), y && xe(a, y));
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
- [R, y]
465
- ), h = typeof u == "number" ? `${u}px` : u, p = {
466
+ [G, w]
467
+ ), b = typeof a == "number" ? `${a}px` : a, n = {
466
468
  field: r,
467
- ref: m
469
+ ref: y
468
470
  };
469
- return d !== void 0 && (p.header = d), n !== void 0 && (p.type = n), s !== void 0 && (p.editable = s), g !== void 0 && (p.sortable = g), l !== void 0 && (p.resizable = l), h !== void 0 && (p.width = h), v !== void 0 && (p["min-width"] = v), f !== void 0 && (p.hidden = f), w !== void 0 && (p["lock-visible"] = w), S !== void 0 && (p.multi = S), C && (p["data-has-format"] = "true"), G && (p["data-has-options"] = "true"), /* @__PURE__ */ x("tbw-grid-column", { ...p });
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: d }) {
472
- const n = ge(), s = t ?? `tbw-header-content-${n}`, g = T(O), [l, u] = N(null), v = P(null);
473
- return b(() => {
474
- const f = g?.current;
475
- if (!f) return;
476
- const w = v;
477
- let R = !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;
478
480
  return (async () => {
479
481
  try {
480
- await f.ready?.();
482
+ await g.ready?.();
481
483
  } catch {
482
484
  return;
483
485
  }
484
- if (R) return;
485
- const y = {
486
- id: s,
486
+ if (v) return;
487
+ const G = {
488
+ id: u,
487
489
  order: r,
488
- render: (S) => (u(S), () => {
490
+ render: (w) => (a(w), () => {
489
491
  })
490
- }, G = f.getPluginByName?.("shell");
491
- G?.registerHeaderContent ? G.registerHeaderContent(y) : f.registerHeaderContent?.(y);
492
+ };
493
+ g.getPluginByName?.("shell")?.registerHeaderContent(G);
492
494
  })(), () => {
493
- R = !0;
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
- }, [g, s, r]), b(() => {
497
+ }, [d, u, r]), R(() => {
498
498
  if (!l) return;
499
- const f = g?.current ?? void 0;
500
- v.current = me(l, d, v.current ?? void 0, f);
501
- }, [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;
502
502
  }
503
503
  function fr({ children: t }) {
504
- return /* @__PURE__ */ x("tbw-grid-tool-buttons", { children: t });
504
+ return /* @__PURE__ */ S("tbw-grid-tool-buttons", { children: t });
505
505
  }
506
- function dr({ id: t, order: r = 100, children: d }) {
507
- const n = ge(), s = t ?? `tbw-toolbar-content-${n}`, g = T(O), [l, u] = N(null), v = P(null);
508
- return b(() => {
509
- const f = g?.current;
510
- if (!f) return;
511
- const w = v;
512
- let R = !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;
513
513
  return (async () => {
514
514
  try {
515
- await f.ready?.();
515
+ await g.ready?.();
516
516
  } catch {
517
517
  return;
518
518
  }
519
- if (R) return;
520
- const y = {
521
- id: s,
519
+ if (v) return;
520
+ const G = {
521
+ id: u,
522
522
  order: r,
523
- render: (S) => (u(S), () => {
523
+ render: (w) => (a(w), () => {
524
524
  })
525
- }, G = f.getPluginByName?.("shell");
526
- G?.registerToolbarContent ? G.registerToolbarContent(y) : f.registerToolbarContent?.(y);
525
+ };
526
+ g.getPluginByName?.("shell")?.registerToolbarContent(G);
527
527
  })(), () => {
528
- R = !0;
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
- }, [g, s, r]), b(() => {
530
+ }, [d, u, r]), R(() => {
533
531
  if (!l) return;
534
- const f = g?.current ?? void 0;
535
- v.current = me(l, d, v.current ?? void 0, f);
536
- }, [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;
537
535
  }
538
- const gr = ({ icons: t, defaults: r, children: d }) => {
539
- let n = d;
540
- return r && (n = /* @__PURE__ */ x($e, { defaults: r, children: n })), t && (n = /* @__PURE__ */ x(Oe, { icons: t, children: n })), /* @__PURE__ */ x(U, { 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 });
541
539
  };
542
540
  function pr(t) {
543
- const r = P(null), [d, n] = N(!1), [s, g] = N(null), l = P(null), u = D(() => t ? (l.current ??= document.querySelector(t), l.current) : r.current?.element ?? null, [t]);
544
- b(() => {
545
- let o = !0;
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 h = document.querySelector(t);
550
- if (!h) return;
551
- if (l.current = h, await h.ready?.(), o) {
552
- n(!0);
553
- const p = await h.getConfig?.();
554
- o && p && g(p);
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 h = r.current;
558
- if (!h) return;
559
- if (await h.ready?.(), o) {
560
- n(!0);
561
- const p = await h.getConfig?.();
562
- o && p && g(p);
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
- o = !1;
566
+ s = !1;
569
567
  };
570
568
  }, [t]);
571
- const v = D(async () => {
572
- const o = u();
573
- if (o)
574
- return await o.getConfig?.() ?? null;
575
- const m = r.current;
576
- return m ? await m.getConfig?.() ?? null : null;
577
- }, [u]), f = D(async () => {
578
- const o = u();
579
- if (o) {
580
- await o.forceLayout?.();
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 m = r.current;
584
- m && await m.forceLayout?.();
585
- }, [u]), w = D(
586
- async (o) => {
587
- const m = u();
588
- if (m) {
589
- await m.toggleGroup?.(o);
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 h = r.current;
593
- h && await h.toggleGroup?.(o);
590
+ const y = r.current;
591
+ y && await y.toggleGroup?.(s);
594
592
  },
595
- [u]
596
- ), R = D(
597
- (o) => u()?.getPlugin?.(o),
598
- [u]
599
- ), y = D(
600
- ((o) => u()?.getPluginByName?.(o)),
601
- [u]
602
- ), G = D(
603
- (o, m) => {
604
- const h = u();
605
- if (h) {
606
- h.registerStyles?.(o, m);
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?.(o, m);
607
+ r.current?.registerStyles?.(s, p);
610
608
  },
611
- [u]
612
- ), S = D(
613
- (o) => {
614
- const m = u();
615
- if (m) {
616
- m.unregisterStyles?.(o);
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?.(o);
617
+ r.current?.unregisterStyles?.(s);
620
618
  },
621
- [u]
622
- ), C = D(() => s?.columns ? s.columns.filter((o) => !o.hidden) : [], [s]);
619
+ [a]
620
+ ), m = E(() => u?.columns ? u.columns.filter((s) => !s.hidden) : [], [u]);
623
621
  return {
624
622
  ref: r,
625
- element: u(),
626
- isReady: d,
627
- config: s,
628
- getConfig: v,
629
- forceLayout: f,
630
- toggleGroup: w,
631
- getPlugin: R,
632
- getPluginByName: y,
633
- registerStyles: G,
634
- unregisterStyles: S,
635
- getVisibleColumns: C
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: d = !0, gridElement: n } = r, s = T(O);
640
- b(() => {
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 g = t.current;
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?.(g), () => {
647
- l.unregisterExternalFocusContainer?.(g);
644
+ return l.registerExternalFocusContainer?.(d), () => {
645
+ l.unregisterExternalFocusContainer?.(d);
648
646
  };
649
- }, [d, n, s, t]);
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
- $e as GridTypeProvider,
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
- Ce as registerChildFeatureDetector,
666
+ ye as registerChildFeatureDetector,
669
667
  Pr as registerEditorMountHook,
670
668
  vr as registerFeaturePropKey,
671
669
  Rr as registerPostMountRefresh,