@toolbox-web/grid-react 2.0.0-beta → 2.0.0-rc.0

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,48 @@
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";
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 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();
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
- q.set(t, r);
18
+ _.set(t, r);
19
19
  }
20
- function ke(t) {
20
+ function Ie(t) {
21
21
  const r = {};
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);
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 l = d(f);
29
- l && Object.assign(r, l);
28
+ const f = d(l);
29
+ f && Object.assign(r, f);
30
30
  }), r;
31
31
  }
32
- function Ie(t) {
33
- return t.charAt(0).toUpperCase() + t.slice(1);
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 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(" ");
36
+ function Ne(t) {
37
+ return t.map((r) => typeof r == "string" ? Le(r) : r);
37
38
  }
38
- const Le = /* @__PURE__ */ new Set(["string", "number", "boolean", "date", "datetime", "currency"]);
39
- function Ae(t) {
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 Me(t) {
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 K = {
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), Oe = ({ icons: t, children: r }) => /* @__PURE__ */ S(W.Provider, { value: t, children: r });
110
- function ir() {
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 $e = W, $ = ae(null), je = ({ defaults: t, children: r }) => /* @__PURE__ */ S($.Provider, { value: t, children: r });
114
- function sr() {
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 cr(t) {
118
- return k($)?.[t];
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 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 = () => {
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(u), v());
115
+ d.current = !1, !g.current && (oe(c), v());
137
116
  }));
138
117
  }, v = () => {
139
- l.current || (l.current = requestAnimationFrame(() => {
140
- l.current = 0, !g.current && u();
118
+ f.current || (f.current = requestAnimationFrame(() => {
119
+ f.current = 0, !g.current && c();
141
120
  }));
142
- }, G = (m, s) => {
143
- console.error(`[grid-react] Portal "${m}" crashed; dropping.`, s), o.current.delete(m), v();
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
- f,
125
+ l,
147
126
  () => ({
148
- renderPortal(m, s, p) {
149
- g.current || (o.current.set(m, { container: s, element: p }), C());
127
+ renderPortal(y, s, p) {
128
+ g.current || (n.current.set(y, { container: s, element: p }), C());
150
129
  },
151
- removePortal(m, s) {
130
+ removePortal(y, s) {
152
131
  if (g.current) {
153
- o.current.delete(m);
132
+ n.current.delete(y);
154
133
  return;
155
134
  }
156
- o.current.delete(m) && (a.current > 0 ? h.current = !0 : s ? oe(u) : C());
135
+ n.current.delete(y) && (u.current > 0 ? m.current = !0 : s ? oe(c) : C());
157
136
  },
158
137
  beginBatch() {
159
- a.current++;
138
+ u.current++;
160
139
  },
161
140
  endBatch() {
162
- a.current !== 0 && (a.current--, a.current === 0 && h.current && (h.current = !1, u()));
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
- o.current.clear();
145
+ n.current.clear();
167
146
  return;
168
147
  }
169
- o.current.size > 0 && (o.current.clear(), l.current && (cancelAnimationFrame(l.current), l.current = 0), C());
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 m = o.current;
156
+ const y = n.current;
178
157
  return () => {
179
- g.current = !0, l.current && (cancelAnimationFrame(l.current), l.current = 0), m.clear();
158
+ g.current = !0, f.current && (cancelAnimationFrame(f.current), f.current = 0), y.clear();
180
159
  };
181
160
  }, []);
182
161
  const w = [];
183
- let D = null;
184
- for (const [m, { container: s, element: p }] of o.current) {
162
+ let F = null;
163
+ for (const [y, { container: s, element: p }] of n.current) {
185
164
  if (!s.isConnected) {
186
- (D ??= []).push(m);
165
+ (F ??= []).push(y);
187
166
  continue;
188
167
  }
189
168
  w.push(
190
- Ee(
191
- /* @__PURE__ */ S(ze, { portalKey: m, onError: G, children: p }),
169
+ De(
170
+ /* @__PURE__ */ S(ze, { portalKey: y, onError: G, children: p }),
192
171
  s,
193
- m
172
+ y
194
173
  )
195
174
  );
196
175
  }
197
- if (D) {
198
- const m = D;
176
+ if (F) {
177
+ const y = F;
199
178
  queueMicrotask(() => {
200
- for (const s of m) o.current.delete(s);
179
+ for (const s of y) n.current.delete(s);
201
180
  });
202
181
  }
203
182
  return /* @__PURE__ */ S(U, { children: w });
204
- }), Ke = {
183
+ }), He = {
205
184
  undoRedo: ["editing"],
206
185
  clipboard: ["selection"]
207
186
  };
208
- function _e(t) {
187
+ function qe(t) {
209
188
  const r = new Set(t);
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.`
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 qe(t) {
198
+ function _e(t) {
220
199
  const r = [];
221
- for (const [f, o] of Object.entries(t))
222
- o === void 0 || o === !1 || r.push(f);
223
- return _e(r), Te(t);
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 se = !1, _ = null;
204
+ let ie = !1, q = null;
226
205
  function V() {
227
- return se || (_ = new Ge(), ue.registerAdapter(_), se = !0), _;
206
+ return ie || (q = new Ge(), ue.registerAdapter(q), ie = !0), q;
228
207
  }
229
208
  V();
230
- const ce = /* @__PURE__ */ new WeakMap();
209
+ const se = /* @__PURE__ */ new WeakMap();
231
210
  let Ve = 0;
232
211
  function Ue(t) {
233
- let r = ce.get(t);
234
- return r === void 0 && (r = ++Ve, ce.set(t, r)), r;
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 ur = le(function(r, f) {
230
+ const ar = le(function(r, l) {
252
231
  const {
253
232
  // Core props
254
- rows: o,
255
- gridConfig: u,
233
+ rows: n,
234
+ gridConfig: c,
256
235
  columns: d,
257
- columnDefaults: l,
258
- fitMode: a,
259
- columnInference: h,
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: D,
266
- style: m,
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: y,
250
+ onRowsChange: h,
272
251
  // Feature props and event props are in ...rest
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];
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 c;
256
+ let a;
278
257
  try {
279
- c = JSON.stringify(i) ?? "undefined";
258
+ a = JSON.stringify(i) ?? "undefined";
280
259
  } catch {
281
- c = typeof i == "object" && i !== null ? `ref#${Ue(i)}` : `prim:${String(i)}`;
260
+ a = typeof i == "object" && i !== null ? `ref#${Ue(i)}` : `prim:${String(i)}`;
282
261
  }
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);
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
- }, [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(() => {
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((c) => c.name)), i = B.filter((c) => !e.has(c.name));
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]), L = T(() => d && Ne(Me(d), l), [d, l]), A = T(() => {
303
- const e = Fe(u), i = {};
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 c = e?.icons || u?.icons || {};
306
- i.icons = { ...j, ...c };
284
+ const a = e?.icons || c?.icons || {};
285
+ i.icons = { ...j, ...a };
307
286
  }
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));
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: [...c, ...H]
292
+ plugins: [...a, ...K]
314
293
  };
315
294
  }
316
- return I.length > 0 && !e ? { ...i, plugins: I } : Object.keys(i).length > 0 ? { ...e, ...i } : e;
317
- }, [u, I, g, C, v, j]);
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(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);
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
- 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);
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 = n.current;
312
+ const e = o.current;
334
313
  if (!e) return;
335
314
  const i = V();
336
- e.__frameworkAdapter = i, De(e);
337
- let c = !1;
315
+ e.__frameworkAdapter = i, Te(e);
316
+ let a = !1;
338
317
  const x = requestAnimationFrame(() => {
339
- c || (typeof e.refreshColumns == "function" && e.refreshColumns(), typeof e.refreshShellHeader == "function" && e.refreshShellHeader());
318
+ a || (typeof e.refreshColumns == "function" && e.refreshColumns(), typeof e.refreshShellHeader == "function" && e.refreshShellHeader());
340
319
  });
341
320
  return () => {
342
- c = !0, cancelAnimationFrame(x);
321
+ a = !0, cancelAnimationFrame(x);
343
322
  };
344
323
  }, []), R(() => {
345
- if (!n.current || !w) return;
346
- const e = n.current, i = "react-custom-styles";
347
- let c = !0;
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
- c && w && (e.registerStyles?.(i, w), F.current = i);
328
+ a && w && (e.registerStyles?.(i, w), D.current = i);
350
329
  }), () => {
351
- c = !1, F.current && (e.unregisterStyles?.(F.current), F.current = null);
330
+ a = !1, D.current && (e.unregisterStyles?.(D.current), D.current = null);
352
331
  };
353
332
  }, [w]), R(() => {
354
- const e = n.current;
333
+ const e = o.current;
355
334
  if (!e) return;
356
335
  const i = [];
357
- return y && i.push(e.on("rows-change", (c) => y(c.rows))), () => {
358
- i.forEach((c) => c());
336
+ return h && i.push(e.on("rows-change", (a) => h(a.rows))), () => {
337
+ i.forEach((a) => a());
359
338
  };
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];
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 = n.current;
344
+ const e = o.current;
366
345
  if (!e) return;
367
346
  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);
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((c) => c());
354
+ i.forEach((a) => a());
376
355
  };
377
356
  }, [ee]), fe(
378
- f,
357
+ l,
379
358
  () => ({
380
359
  get element() {
381
- return n.current;
360
+ return o.current;
382
361
  },
383
362
  async getConfig() {
384
- return n.current?.getConfig?.() ?? {};
363
+ return o.current?.getConfig?.() ?? {};
385
364
  },
386
365
  async ready() {
387
- return n.current?.ready?.();
366
+ return o.current?.ready?.();
388
367
  },
389
368
  async forceLayout() {
390
- return n.current?.forceLayout?.();
369
+ return o.current?.forceLayout?.();
391
370
  },
392
371
  async toggleGroup(e) {
393
- return n.current?.toggleGroup?.(e);
372
+ return o.current?.toggleGroup?.(e);
394
373
  },
395
374
  registerStyles(e, i) {
396
- n.current?.registerStyles?.(e, i);
375
+ o.current?.registerStyles?.(e, i);
397
376
  },
398
377
  unregisterStyles(e) {
399
- n.current?.unregisterStyles?.(e);
378
+ o.current?.unregisterStyles?.(e);
400
379
  },
401
380
  setRowLoading(e, i) {
402
- n.current?.setRowLoading?.(e, i);
381
+ o.current?.setRowLoading?.(e, i);
403
382
  },
404
- setCellLoading(e, i, c) {
405
- n.current?.setCellLoading?.(e, i, c);
383
+ setCellLoading(e, i, a) {
384
+ o.current?.setCellLoading?.(e, i, a);
406
385
  },
407
386
  isRowLoading(e) {
408
- return n.current?.isRowLoading?.(e) ?? !1;
387
+ return o.current?.isRowLoading?.(e) ?? !1;
409
388
  },
410
389
  isCellLoading(e, i) {
411
- return n.current?.isCellLoading?.(e, i) ?? !1;
390
+ return o.current?.isCellLoading?.(e, i) ?? !1;
412
391
  },
413
392
  clearAllLoading() {
414
- n.current?.clearAllLoading?.();
393
+ o.current?.clearAllLoading?.();
415
394
  }
416
395
  }),
417
396
  []
418
397
  );
419
- const z = P(null);
398
+ const z = b(null);
420
399
  return de(() => {
421
- const e = n.current;
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__ */ he(U, { children: [
426
- /* @__PURE__ */ S(He, { ref: z }),
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 (n.current = e, e && !J.current) {
410
+ if (o.current = e, e && !J.current) {
432
411
  J.current = !0;
433
412
  const i = e;
434
- A && (i.gridConfig = A), o && (i.rows = o), L && (i.columns = L);
413
+ L && (i.gridConfig = L), n && (i.rows = n), I && (i.columns = I);
435
414
  }
436
415
  },
437
- class: D,
438
- style: m
416
+ class: F,
417
+ style: y
439
418
  },
440
- /* @__PURE__ */ S(O.Provider, { value: n, children: s })
419
+ /* @__PURE__ */ S($.Provider, { value: o, children: s })
441
420
  )
442
421
  ] });
443
422
  });
444
- function ar(t) {
423
+ function lr(t) {
445
424
  const {
446
425
  field: r,
447
- header: f,
448
- type: o,
449
- editable: u,
426
+ header: l,
427
+ type: n,
428
+ editable: c,
450
429
  sortable: d,
451
- resizable: l,
452
- width: a,
453
- minWidth: h,
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: D,
460
- multi: m,
438
+ options: F,
439
+ multi: y,
461
440
  format: s
462
- } = t, p = P(null), y = E(
463
- (F) => {
464
- p.current = F, F && (G && Se(F, G), w && xe(F, w));
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
- ), b = typeof a == "number" ? `${a}px` : a, n = {
446
+ ), P = typeof u == "number" ? `${u}px` : u, o = {
468
447
  field: r,
469
- ref: y
448
+ ref: h
470
449
  };
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 });
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 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);
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 = h;
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: u,
467
+ id: c,
489
468
  order: r,
490
- render: (w) => (a(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(u), C.current && (pe(C.current, { sync: !0 }), C.current = null), a(null);
474
+ v = !0, g.getPluginByName?.("shell")?.unregisterHeaderContent(c), C.current && (pe(C.current, { sync: !0 }), C.current = null), u(null);
496
475
  };
497
- }, [d, u, r]), R(() => {
498
- if (!l) return;
476
+ }, [d, c, r]), R(() => {
477
+ if (!f) return;
499
478
  const g = d?.current ?? void 0;
500
- h.current = me(l, f, h.current ?? void 0, g);
501
- }, [f, l, d]), null;
479
+ m.current = me(f, l, m.current ?? void 0, g);
480
+ }, [l, f, d]), null;
502
481
  }
503
- function fr({ children: t }) {
482
+ function dr({ children: t }) {
504
483
  return /* @__PURE__ */ S("tbw-grid-tool-buttons", { children: t });
505
484
  }
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);
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 = h;
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: u,
500
+ id: c,
522
501
  order: r,
523
- render: (w) => (a(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(u), C.current && (pe(C.current, { sync: !0 }), C.current = null), a(null);
507
+ v = !0, g.getPluginByName?.("shell")?.unregisterToolbarContent(c), C.current && (pe(C.current, { sync: !0 }), C.current = null), u(null);
529
508
  };
530
- }, [d, u, r]), R(() => {
531
- if (!l) return;
509
+ }, [d, c, r]), R(() => {
510
+ if (!f) return;
532
511
  const g = d?.current ?? void 0;
533
- h.current = me(l, f, h.current ?? void 0, g);
534
- }, [f, l, d]), null;
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 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]);
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 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);
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 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);
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 h = E(async () => {
570
- const s = a();
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
- }, [a]), g = E(async () => {
576
- const s = a();
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
- }, [a]), C = E(
583
+ }, [u]), C = E(
584
584
  async (s) => {
585
- const p = a();
585
+ const p = u();
586
586
  if (p) {
587
587
  await p.toggleGroup?.(s);
588
588
  return;
589
589
  }
590
- const y = r.current;
591
- y && await y.toggleGroup?.(s);
590
+ const h = r.current;
591
+ h && await h.toggleGroup?.(s);
592
592
  },
593
- [a]
593
+ [u]
594
594
  ), v = E(
595
- (s) => a()?.getPlugin?.(s),
596
- [a]
595
+ (s) => u()?.getPlugin?.(s),
596
+ [u]
597
597
  ), G = E(
598
- ((s) => a()?.getPluginByName?.(s)),
599
- [a]
598
+ ((s) => u()?.getPluginByName?.(s)),
599
+ [u]
600
600
  ), w = E(
601
601
  (s, p) => {
602
- const y = a();
603
- if (y) {
604
- y.registerStyles?.(s, p);
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
- [a]
610
- ), D = E(
609
+ [u]
610
+ ), F = E(
611
611
  (s) => {
612
- const p = a();
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
- [a]
620
- ), m = E(() => u?.columns ? u.columns.filter((s) => !s.hidden) : [], [u]);
619
+ [u]
620
+ ), y = E(() => c?.columns ? c.columns.filter((s) => !s.hidden) : [], [c]);
621
621
  return {
622
622
  ref: r,
623
- element: a(),
624
- isReady: f,
625
- config: u,
626
- getConfig: h,
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: D,
633
- getVisibleColumns: m
632
+ unregisterStyles: F,
633
+ getVisibleColumns: y
634
634
  };
635
635
  }
636
- function mr(t, r = {}) {
637
- const { open: f = !0, gridElement: o } = r, u = k(O);
636
+ function hr(t, r = {}) {
637
+ const { open: l = !0, gridElement: n } = r, c = k($);
638
638
  R(() => {
639
- if (!f) return;
639
+ if (!l) return;
640
640
  const d = t.current;
641
641
  if (!d) return;
642
- const l = o ?? d.closest("tbw-grid, [data-tbw-grid]") ?? u?.current ?? null;
643
- if (l)
644
- return l.registerExternalFocusContainer?.(d), () => {
645
- l.unregisterExternalFocusContainer?.(d);
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
- }, [f, o, u, t]);
647
+ }, [l, n, c, t]);
648
648
  }
649
649
  export {
650
- ur as DataGrid,
650
+ ar as DataGrid,
651
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,
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
- Ne as applyColumnDefaults,
663
- or as hasColumnShorthands,
664
- Me as normalizeColumns,
665
- Ae as parseColumnShorthand,
663
+ Ae as applyColumnDefaults,
664
+ ir as hasColumnShorthands,
665
+ Ne as normalizeColumns,
666
+ Le as parseColumnShorthand,
666
667
  ye as registerChildFeatureDetector,
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
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
  };