@toolbox-web/grid-react 0.15.1 → 0.17.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.
Files changed (81) hide show
  1. package/chunks/{data-grid-O97pdLCY.js → data-grid-Cpa5kukM.js} +322 -295
  2. package/features/clipboard.d.ts +0 -17
  3. package/features/clipboard.d.ts.map +1 -1
  4. package/features/clipboard.js +1 -6
  5. package/features/column-virtualization.d.ts +0 -15
  6. package/features/column-virtualization.d.ts.map +1 -1
  7. package/features/column-virtualization.js +1 -6
  8. package/features/context-menu.d.ts +0 -15
  9. package/features/context-menu.d.ts.map +1 -1
  10. package/features/context-menu.js +1 -6
  11. package/features/editing.d.ts +0 -15
  12. package/features/editing.d.ts.map +1 -1
  13. package/features/editing.js +1 -3
  14. package/features/export.d.ts.map +1 -1
  15. package/features/export.js +9 -14
  16. package/features/filtering.js +15 -15
  17. package/features/grouping-columns.d.ts +9 -0
  18. package/features/grouping-columns.d.ts.map +1 -1
  19. package/features/grouping-columns.js +19 -4
  20. package/features/grouping-rows.d.ts +9 -0
  21. package/features/grouping-rows.d.ts.map +1 -1
  22. package/features/grouping-rows.js +20 -5
  23. package/features/index.js +18 -18
  24. package/features/master-detail.d.ts +0 -17
  25. package/features/master-detail.d.ts.map +1 -1
  26. package/features/master-detail.js +1 -6
  27. package/features/multi-sort.d.ts +0 -21
  28. package/features/multi-sort.d.ts.map +1 -1
  29. package/features/multi-sort.js +1 -3
  30. package/features/pinned-columns.d.ts +0 -15
  31. package/features/pinned-columns.d.ts.map +1 -1
  32. package/features/pinned-columns.js +1 -6
  33. package/features/pinned-rows.d.ts +0 -15
  34. package/features/pinned-rows.d.ts.map +1 -1
  35. package/features/pinned-rows.js +24 -5
  36. package/features/pivot.d.ts +0 -15
  37. package/features/pivot.d.ts.map +1 -1
  38. package/features/pivot.js +1 -3
  39. package/features/print.d.ts.map +1 -1
  40. package/features/print.js +10 -12
  41. package/features/reorder-columns.d.ts +1 -0
  42. package/features/reorder-columns.d.ts.map +1 -0
  43. package/features/reorder-columns.js +1 -0
  44. package/features/reorder-rows.d.ts +1 -0
  45. package/features/reorder-rows.d.ts.map +1 -0
  46. package/features/reorder-rows.js +1 -0
  47. package/features/reorder.d.ts +3 -13
  48. package/features/reorder.d.ts.map +1 -1
  49. package/features/reorder.js +1 -6
  50. package/features/responsive.d.ts +0 -15
  51. package/features/responsive.d.ts.map +1 -1
  52. package/features/responsive.js +1 -6
  53. package/features/row-reorder.d.ts +3 -13
  54. package/features/row-reorder.d.ts.map +1 -1
  55. package/features/row-reorder.js +1 -3
  56. package/features/selection.d.ts.map +1 -1
  57. package/features/selection.js +26 -28
  58. package/features/server-side.d.ts +0 -15
  59. package/features/server-side.d.ts.map +1 -1
  60. package/features/server-side.js +1 -3
  61. package/features/sorting.js +1 -1
  62. package/features/tree.d.ts +0 -15
  63. package/features/tree.d.ts.map +1 -1
  64. package/features/tree.js +1 -6
  65. package/features/undo-redo.d.ts.map +1 -1
  66. package/features/undo-redo.js +12 -17
  67. package/features/visibility.d.ts +0 -15
  68. package/features/visibility.d.ts.map +1 -1
  69. package/features/visibility.js +1 -6
  70. package/index.js +2 -2
  71. package/lib/data-grid.d.ts.map +1 -1
  72. package/lib/feature-props.d.ts +12 -4
  73. package/lib/feature-props.d.ts.map +1 -1
  74. package/lib/feature-registry.d.ts +13 -47
  75. package/lib/feature-registry.d.ts.map +1 -1
  76. package/lib/react-column-config.d.ts +33 -3
  77. package/lib/react-column-config.d.ts.map +1 -1
  78. package/lib/use-sync-plugins.d.ts +2 -1
  79. package/lib/use-sync-plugins.d.ts.map +1 -1
  80. package/package.json +1 -1
  81. package/chunks/feature-registry-Y3KvnN54.js +0 -26
@@ -1,14 +1,14 @@
1
- import { jsx as b } from "react/jsx-runtime";
1
+ import { jsx as E } from "react/jsx-runtime";
2
2
  import { DataGridElement as me } from "@toolbox-web/grid";
3
- import { createContext as Z, useContext as V, useRef as S, useCallback as Q, useEffect as p, forwardRef as he, useMemo as v, useImperativeHandle as ye, Children as we, isValidElement as ve } from "react";
4
- import { flushSync as m } from "react-dom";
5
- import { createRoot as y } from "react-dom/client";
6
- import { c as Ce } from "./feature-registry-Y3KvnN54.js";
7
- function Re(n) {
3
+ import { createContext as Z, useContext as V, useRef as A, useCallback as Q, useEffect as m, forwardRef as he, useMemo as w, useImperativeHandle as ye, Children as Re, isValidElement as we } from "react";
4
+ import { flushSync as g } from "react-dom";
5
+ import { createRoot as h } from "react-dom/client";
6
+ import { createPluginsFromFeatures as ve } from "@toolbox-web/grid/features/registry";
7
+ function Ce(n) {
8
8
  return n.charAt(0).toUpperCase() + n.slice(1);
9
9
  }
10
10
  function ae(n) {
11
- return n.toLowerCase() === "id" ? "ID" : n.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[_-]/g, " ").split(" ").filter(Boolean).map(Re).join(" ");
11
+ return n.toLowerCase() === "id" ? "ID" : n.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[_-]/g, " ").split(" ").filter(Boolean).map(Ce).join(" ");
12
12
  }
13
13
  const be = /* @__PURE__ */ new Set(["string", "number", "boolean", "date", "datetime", "currency"]);
14
14
  function Ee(n) {
@@ -32,7 +32,7 @@ function Ee(n) {
32
32
  function Pe(n) {
33
33
  return n.map((t) => typeof t == "string" ? Ee(t) : t);
34
34
  }
35
- const _ = {
35
+ const z = {
36
36
  onCellClick: "cell-click",
37
37
  onRowClick: "row-click",
38
38
  onCellActivate: "cell-activate",
@@ -57,8 +57,8 @@ const _ = {
57
57
  onExportComplete: "export-complete",
58
58
  onPrintStart: "print-start",
59
59
  onPrintComplete: "print-complete"
60
- }, X = Z(null), Ye = ({ icons: n, children: t }) => /* @__PURE__ */ b(X.Provider, { value: n, children: t });
61
- function Ze() {
60
+ }, X = Z(null), Xe = ({ icons: n, children: t }) => /* @__PURE__ */ E(X.Provider, { value: n, children: t });
61
+ function et() {
62
62
  return V(X);
63
63
  }
64
64
  const De = X, W = /* @__PURE__ */ new WeakMap(), q = /* @__PURE__ */ new Map();
@@ -72,51 +72,51 @@ function le(n) {
72
72
  if (e)
73
73
  return q.get(e);
74
74
  }
75
- function Se(n) {
76
- const { children: t, cardRowHeight: e = "auto" } = n, r = S(null), o = Q(
77
- (s) => {
78
- if (r.current = s, !s) return;
79
- W.set(s, t);
80
- const a = s.closest("tbw-grid");
81
- if (a) {
82
- const l = a.id || a.getAttribute("data-grid-id");
75
+ function xe(n) {
76
+ const { children: t, cardRowHeight: e = "auto" } = n, r = A(null), o = Q(
77
+ (c) => {
78
+ if (r.current = c, !c) return;
79
+ W.set(c, t);
80
+ const d = c.closest("tbw-grid");
81
+ if (d) {
82
+ const l = d.id || d.getAttribute("data-grid-id");
83
83
  l && q.set(l, t);
84
84
  }
85
85
  },
86
86
  [t]
87
87
  );
88
- p(() => () => {
89
- const s = r.current;
90
- if (s) {
91
- W.delete(s);
92
- const a = s.closest("tbw-grid");
93
- if (a) {
94
- const l = a.id || a.getAttribute("data-grid-id");
88
+ m(() => () => {
89
+ const c = r.current;
90
+ if (c) {
91
+ W.delete(c);
92
+ const d = c.closest("tbw-grid");
93
+ if (d) {
94
+ const l = d.id || d.getAttribute("data-grid-id");
95
95
  l && q.delete(l);
96
96
  }
97
97
  }
98
98
  }, []);
99
- const c = e === "auto" ? "auto" : String(e);
100
- return /* @__PURE__ */ b("tbw-grid-responsive-card", { ref: o, cardRowHeight: c });
99
+ const s = e === "auto" ? "auto" : String(e);
100
+ return /* @__PURE__ */ E("tbw-grid-responsive-card", { ref: o, cardRowHeight: s });
101
101
  }
102
- Se.displayName = "GridResponsiveCard";
103
- const T = Z(null), Qe = ({ defaults: n, children: t }) => /* @__PURE__ */ b(T.Provider, { value: n, children: t });
104
- function Xe() {
102
+ xe.displayName = "GridResponsiveCard";
103
+ const T = Z(null), tt = ({ defaults: n, children: t }) => /* @__PURE__ */ E(T.Provider, { value: n, children: t });
104
+ function rt() {
105
105
  return V(T);
106
106
  }
107
- function et(n) {
107
+ function nt(n) {
108
108
  return V(T)?.[n];
109
109
  }
110
- const xe = T, I = [];
111
- function Ae(n) {
112
- for (let t = I.length - 1; t >= 0; t--) {
113
- const e = I[t];
110
+ const Ae = T, C = [];
111
+ function Se(n) {
112
+ for (let t = C.length - 1; t >= 0; t--) {
113
+ const e = C[t];
114
114
  if (n.contains(e.container) && e.container.classList.contains("react-cell-editor")) {
115
115
  try {
116
116
  e.root.unmount();
117
117
  } catch {
118
118
  }
119
- I.splice(t, 1);
119
+ C.splice(t, 1);
120
120
  }
121
121
  }
122
122
  }
@@ -125,36 +125,76 @@ function Ge(n) {
125
125
  return (e) => {
126
126
  const r = e.cellEl;
127
127
  if (r) {
128
- const s = t.get(r);
129
- if (s)
130
- return m(() => {
131
- s.root.render(n(e));
132
- }), s.container;
128
+ const c = t.get(r);
129
+ if (c)
130
+ return g(() => {
131
+ c.root.render(n(e));
132
+ }), c.container;
133
133
  }
134
134
  const o = document.createElement("div");
135
135
  o.className = "react-cell-renderer", o.style.display = "contents";
136
- const c = y(o);
137
- return m(() => {
138
- c.render(n(e));
139
- }), r && t.set(r, { root: c, container: o }), I.push({ root: c, container: o }), o;
136
+ const s = h(o);
137
+ return g(() => {
138
+ s.render(n(e));
139
+ }), r && t.set(r, { root: s, container: o }), C.push({ root: s, container: o }), o;
140
140
  };
141
141
  }
142
142
  function Ie(n) {
143
143
  return (t) => {
144
144
  const e = document.createElement("div");
145
145
  e.className = "react-cell-editor", e.style.display = "contents";
146
- const r = y(e);
147
- return m(() => {
146
+ const r = h(e);
147
+ return g(() => {
148
148
  r.render(n(t));
149
- }), I.push({ root: r, container: e }), e;
149
+ }), C.push({ root: r, container: e }), e;
150
150
  };
151
151
  }
152
152
  function Ve(n) {
153
+ return (t) => {
154
+ const e = document.createElement("div");
155
+ e.className = "react-header-renderer", e.style.display = "contents";
156
+ const r = h(e);
157
+ return g(() => {
158
+ r.render(n(t));
159
+ }), C.push({ root: r, container: e }), e;
160
+ };
161
+ }
162
+ function Ne(n) {
163
+ return (t) => {
164
+ const e = document.createElement("div");
165
+ e.className = "react-header-label-renderer", e.style.display = "contents";
166
+ const r = h(e);
167
+ return g(() => {
168
+ r.render(n(t));
169
+ }), C.push({ root: r, container: e }), e;
170
+ };
171
+ }
172
+ function Le(n) {
173
+ return (t) => {
174
+ const e = n(t);
175
+ if (e instanceof HTMLElement || typeof e == "string")
176
+ return e;
177
+ const r = document.createElement("div");
178
+ r.className = "react-loading-renderer", r.style.display = "contents";
179
+ const o = h(r);
180
+ return g(() => {
181
+ o.render(e);
182
+ }), C.push({ root: o, container: r }), r;
183
+ };
184
+ }
185
+ function Fe(n) {
153
186
  if (!n) return;
187
+ if (n.loadingRenderer && typeof n.loadingRenderer == "function") {
188
+ const e = n.loadingRenderer;
189
+ n = {
190
+ ...n,
191
+ loadingRenderer: Le(e)
192
+ };
193
+ }
154
194
  if (!n.columns) return n;
155
195
  const t = n.columns.map((e) => {
156
- const { renderer: r, editor: o, ...c } = e, s = { ...c };
157
- return r && (s.renderer = Ge(r)), o && (s.editor = Ie(o)), s;
196
+ const { renderer: r, editor: o, headerRenderer: s, headerLabelRenderer: c, ...d } = e, l = { ...d };
197
+ return r && (l.renderer = Ge(r)), o && (l.editor = Ie(o)), s && (l.headerRenderer = Ve(s)), c && (l.headerLabelRenderer = Ne(c)), l;
158
198
  });
159
199
  return {
160
200
  ...n,
@@ -162,7 +202,7 @@ function Ve(n) {
162
202
  };
163
203
  }
164
204
  const B = /* @__PURE__ */ new WeakMap(), K = /* @__PURE__ */ new Map();
165
- function Ne(n) {
205
+ function Te(n) {
166
206
  const t = n.querySelector("tbw-grid-detail");
167
207
  if (t) {
168
208
  const r = B.get(t);
@@ -172,60 +212,60 @@ function Ne(n) {
172
212
  if (e)
173
213
  return K.get(e);
174
214
  }
175
- function Le(n) {
176
- const { children: t, showExpandColumn: e = !0, animation: r = "slide" } = n, o = S(null), c = Q(
177
- (a) => {
178
- if (o.current = a, !a) return;
179
- B.set(a, t);
180
- const l = a.closest("tbw-grid");
215
+ function ke(n) {
216
+ const { children: t, showExpandColumn: e = !0, animation: r = "slide" } = n, o = A(null), s = Q(
217
+ (d) => {
218
+ if (o.current = d, !d) return;
219
+ B.set(d, t);
220
+ const l = d.closest("tbw-grid");
181
221
  if (l) {
182
- const g = l.id || l.getAttribute("data-grid-id");
183
- g && K.set(g, t);
222
+ const p = l.id || l.getAttribute("data-grid-id");
223
+ p && K.set(p, t);
184
224
  }
185
225
  },
186
226
  [t]
187
227
  );
188
- return p(() => () => {
189
- const a = o.current;
190
- if (a) {
191
- B.delete(a);
192
- const l = a.closest("tbw-grid");
228
+ return m(() => () => {
229
+ const d = o.current;
230
+ if (d) {
231
+ B.delete(d);
232
+ const l = d.closest("tbw-grid");
193
233
  if (l) {
194
- const w = l.id || l.getAttribute("data-grid-id");
195
- w && K.delete(w);
234
+ const R = l.id || l.getAttribute("data-grid-id");
235
+ R && K.delete(R);
196
236
  }
197
- const g = a.parentNode;
198
- g && g.contains(a);
237
+ const p = d.parentNode;
238
+ p && p.contains(d);
199
239
  }
200
- }, []), /* @__PURE__ */ b(
240
+ }, []), /* @__PURE__ */ E(
201
241
  "tbw-grid-detail",
202
242
  {
203
- ref: c,
243
+ ref: s,
204
244
  showExpandColumn: e ? void 0 : "false",
205
245
  animation: r === !1 ? "false" : r
206
246
  }
207
247
  );
208
248
  }
209
- Le.displayName = "GridDetailPanel";
249
+ ke.displayName = "GridDetailPanel";
210
250
  const U = /* @__PURE__ */ new WeakMap(), J = /* @__PURE__ */ new Map();
211
- function Fe(n) {
251
+ function Me(n) {
212
252
  const t = U.get(n);
213
253
  if (t) return t;
214
254
  const e = n.id;
215
255
  if (e)
216
256
  return J.get(e);
217
257
  }
218
- function tt(n) {
219
- const { id: t, title: e, icon: r, tooltip: o, order: c = 100, children: s } = n, a = S(null), l = Q(
220
- (g) => {
221
- a.current = g, g && (U.set(g, s), t && J.set(t, s));
258
+ function ot(n) {
259
+ const { id: t, title: e, icon: r, tooltip: o, order: s = 100, children: c } = n, d = A(null), l = Q(
260
+ (p) => {
261
+ d.current = p, p && (U.set(p, c), t && J.set(t, c));
222
262
  },
223
- [s, t]
263
+ [c, t]
224
264
  );
225
- return p(() => () => {
226
- const g = a.current;
227
- g && (U.delete(g), t && J.delete(t));
228
- }, [t]), /* @__PURE__ */ b(
265
+ return m(() => () => {
266
+ const p = d.current;
267
+ p && (U.delete(p), t && J.delete(t));
268
+ }, [t]), /* @__PURE__ */ E(
229
269
  "tbw-grid-tool-panel",
230
270
  {
231
271
  ref: l,
@@ -233,38 +273,38 @@ function tt(n) {
233
273
  title: e,
234
274
  icon: r,
235
275
  tooltip: o,
236
- order: c?.toString()
276
+ order: s?.toString()
237
277
  }
238
278
  );
239
279
  }
240
- const R = /* @__PURE__ */ new WeakMap(), E = /* @__PURE__ */ new Map();
241
- function rt(n, t) {
242
- const e = n.getAttribute("field"), r = R.get(n) ?? {};
243
- if (r.renderer = t, R.set(n, r), e) {
244
- const o = E.get(e) ?? {};
245
- o.renderer = t, E.set(e, o);
280
+ const b = /* @__PURE__ */ new WeakMap(), P = /* @__PURE__ */ new Map();
281
+ function it(n, t) {
282
+ const e = n.getAttribute("field"), r = b.get(n) ?? {};
283
+ if (r.renderer = t, b.set(n, r), e) {
284
+ const o = P.get(e) ?? {};
285
+ o.renderer = t, P.set(e, o);
246
286
  }
247
287
  }
248
- function nt(n, t) {
249
- const e = n.getAttribute("field"), r = R.get(n) ?? {};
250
- if (r.editor = t, R.set(n, r), e) {
251
- const o = E.get(e) ?? {};
252
- o.editor = t, E.set(e, o);
288
+ function st(n, t) {
289
+ const e = n.getAttribute("field"), r = b.get(n) ?? {};
290
+ if (r.editor = t, b.set(n, r), e) {
291
+ const o = P.get(e) ?? {};
292
+ o.editor = t, P.set(e, o);
253
293
  }
254
294
  }
255
- function Te(n) {
256
- let t = R.get(n)?.renderer;
295
+ function He(n) {
296
+ let t = b.get(n)?.renderer;
257
297
  if (!t) {
258
298
  const e = n.getAttribute("field");
259
- e && (t = E.get(e)?.renderer);
299
+ e && (t = P.get(e)?.renderer);
260
300
  }
261
301
  return t;
262
302
  }
263
- function ke(n) {
264
- let t = R.get(n)?.editor;
303
+ function Oe(n) {
304
+ let t = b.get(n)?.editor;
265
305
  if (!t) {
266
306
  const e = n.getAttribute("field");
267
- e && (t = E.get(e)?.editor);
307
+ e && (t = P.get(e)?.editor);
268
308
  }
269
309
  return t;
270
310
  }
@@ -288,13 +328,13 @@ class ue {
288
328
  */
289
329
  canHandle(t) {
290
330
  const e = t.getAttribute("field");
291
- let r = R.get(t);
331
+ let r = b.get(t);
292
332
  if (!r && e) {
293
- const s = E.get(e);
294
- s && (s.renderer || s.editor) && (r = s, R.set(t, r));
333
+ const c = P.get(e);
334
+ c && (c.renderer || c.editor) && (r = c, b.set(t, r));
295
335
  }
296
- const o = r?.renderer !== void 0, c = r?.editor !== void 0;
297
- return r !== void 0 && (o || c);
336
+ const o = r?.renderer !== void 0, s = r?.editor !== void 0;
337
+ return r !== void 0 && (o || s);
298
338
  }
299
339
  /**
300
340
  * Creates a view renderer function that renders a React component
@@ -308,31 +348,31 @@ class ue {
308
348
  * allowing the grid to use its default rendering.
309
349
  */
310
350
  createRenderer(t) {
311
- const e = Te(t);
351
+ const e = He(t);
312
352
  if (!e)
313
353
  return;
314
354
  const r = /* @__PURE__ */ new WeakMap();
315
355
  return (o) => {
316
- const c = o.cellEl;
317
- if (c) {
318
- const l = r.get(c);
356
+ const s = o.cellEl;
357
+ if (s) {
358
+ const l = r.get(s);
319
359
  if (l)
320
- return m(() => {
360
+ return g(() => {
321
361
  l.root.render(e(o));
322
362
  }), l.container;
323
- const g = document.createElement("div");
324
- g.className = "react-cell-renderer", g.style.display = "contents";
325
- const w = y(g);
326
- return m(() => {
327
- w.render(e(o));
328
- }), r.set(c, { root: w, container: g, lastRowIndex: o.rowIndex ?? -1 }), this.mountedViews.push({ root: w, container: g }), g;
363
+ const p = document.createElement("div");
364
+ p.className = "react-cell-renderer", p.style.display = "contents";
365
+ const R = h(p);
366
+ return g(() => {
367
+ R.render(e(o));
368
+ }), r.set(s, { root: R, container: p, lastRowIndex: o.rowIndex ?? -1 }), this.mountedViews.push({ root: R, container: p }), p;
329
369
  }
330
- const s = document.createElement("div");
331
- s.className = "react-cell-renderer", s.style.display = "contents";
332
- const a = y(s);
333
- return m(() => {
334
- a.render(e(o));
335
- }), this.mountedViews.push({ root: a, container: s }), s;
370
+ const c = document.createElement("div");
371
+ c.className = "react-cell-renderer", c.style.display = "contents";
372
+ const d = h(c);
373
+ return g(() => {
374
+ d.render(e(o));
375
+ }), this.mountedViews.push({ root: d, container: c }), c;
336
376
  };
337
377
  }
338
378
  /**
@@ -340,14 +380,14 @@ class ue {
340
380
  * with commit/cancel callbacks passed as props.
341
381
  */
342
382
  createEditor(t) {
343
- const e = ke(t);
383
+ const e = Oe(t);
344
384
  return e ? (r) => {
345
385
  const o = document.createElement("div");
346
386
  o.className = "react-cell-editor", o.style.display = "contents";
347
- const c = y(o);
348
- return m(() => {
349
- c.render(e(r));
350
- }), this.editorViews.push({ root: c, container: o }), o;
387
+ const s = h(o);
388
+ return g(() => {
389
+ s.render(e(r));
390
+ }), this.editorViews.push({ root: s, container: o }), o;
351
391
  } : () => document.createElement("div");
352
392
  }
353
393
  /**
@@ -355,15 +395,15 @@ class ue {
355
395
  * Renders React components for expandable detail rows.
356
396
  */
357
397
  createDetailRenderer(t) {
358
- const e = Ne(t);
398
+ const e = Te(t);
359
399
  if (e)
360
400
  return (r, o) => {
361
- const c = document.createElement("div");
362
- c.className = "react-detail-panel";
363
- const s = { row: r, rowIndex: o }, a = y(c);
364
- return m(() => {
365
- a.render(e(s));
366
- }), this.mountedViews.push({ root: a, container: c }), c;
401
+ const s = document.createElement("div");
402
+ s.className = "react-detail-panel";
403
+ const c = { row: r, rowIndex: o }, d = h(s);
404
+ return g(() => {
405
+ d.render(e(c));
406
+ }), this.mountedViews.push({ root: d, container: s }), s;
367
407
  };
368
408
  }
369
409
  /**
@@ -383,12 +423,12 @@ class ue {
383
423
  const e = le(t);
384
424
  if (e)
385
425
  return (r, o) => {
386
- const c = document.createElement("div");
387
- c.className = "react-responsive-card";
388
- const s = { row: r, index: o }, a = y(c);
389
- return m(() => {
390
- a.render(e(s));
391
- }), this.mountedViews.push({ root: a, container: c }), c;
426
+ const s = document.createElement("div");
427
+ s.className = "react-responsive-card";
428
+ const c = { row: r, index: o }, d = h(s);
429
+ return g(() => {
430
+ d.render(e(c));
431
+ }), this.mountedViews.push({ root: d, container: s }), s;
392
432
  };
393
433
  }
394
434
  /**
@@ -396,25 +436,25 @@ class ue {
396
436
  * Renders React components into tool panel containers.
397
437
  */
398
438
  createToolPanelRenderer(t) {
399
- const e = Fe(t);
439
+ const e = Me(t);
400
440
  if (!e)
401
441
  return;
402
442
  const r = t.closest("tbw-grid");
403
443
  return (o) => {
404
- const c = {
444
+ const s = {
405
445
  grid: r ?? o
406
- }, s = y(o);
407
- return m(() => {
408
- s.render(e(c));
409
- }), this.mountedViews.push({ root: s, container: o }), () => {
410
- const a = this.mountedViews.findIndex((l) => l.container === o);
411
- if (a !== -1) {
412
- const { root: l } = this.mountedViews[a];
446
+ }, c = h(o);
447
+ return g(() => {
448
+ c.render(e(s));
449
+ }), this.mountedViews.push({ root: c, container: o }), () => {
450
+ const d = this.mountedViews.findIndex((l) => l.container === o);
451
+ if (d !== -1) {
452
+ const { root: l } = this.mountedViews[d];
413
453
  try {
414
454
  l.unmount();
415
455
  } catch {
416
456
  }
417
- this.mountedViews.splice(a, 1);
457
+ this.mountedViews.splice(d, 1);
418
458
  }
419
459
  };
420
460
  };
@@ -462,8 +502,8 @@ class ue {
462
502
  return (e) => {
463
503
  const r = document.createElement("span");
464
504
  r.style.display = "contents";
465
- const o = y(r);
466
- return this.mountedViews.push({ root: o, container: r }), m(() => {
505
+ const o = h(r);
506
+ return this.mountedViews.push({ root: o, container: r }), g(() => {
467
507
  o.render(t(e));
468
508
  }), r;
469
509
  };
@@ -476,8 +516,8 @@ class ue {
476
516
  return (e) => {
477
517
  const r = document.createElement("span");
478
518
  r.style.display = "contents";
479
- const o = y(r);
480
- return this.editorViews.push({ root: o, container: r }), m(() => {
519
+ const o = h(r);
520
+ return this.editorViews.push({ root: o, container: r }), g(() => {
481
521
  o.render(t(e));
482
522
  }), r;
483
523
  };
@@ -490,9 +530,9 @@ class ue {
490
530
  return (e, r) => {
491
531
  const o = document.createElement("div");
492
532
  o.style.display = "contents";
493
- const c = y(o);
494
- this.mountedViews.push({ root: c, container: o }), m(() => {
495
- c.render(t(r));
533
+ const s = h(o);
534
+ this.mountedViews.push({ root: s, container: o }), g(() => {
535
+ s.render(t(r));
496
536
  }), e.appendChild(o);
497
537
  };
498
538
  }
@@ -530,7 +570,7 @@ class ue {
530
570
  this.editorViews.splice(e, 1);
531
571
  }
532
572
  }
533
- Ae(t);
573
+ Se(t);
534
574
  }
535
575
  /**
536
576
  * Unmount a specific container (called when cell is recycled).
@@ -547,14 +587,14 @@ class ue {
547
587
  }
548
588
  }
549
589
  }
550
- const ot = ue, Me = {
590
+ const ct = ue, je = {
551
591
  undoRedo: ["editing"],
552
592
  clipboard: ["selection"]
553
593
  };
554
- function Oe(n) {
594
+ function $e(n) {
555
595
  const t = new Set(n);
556
596
  for (const e of n) {
557
- const r = Me[e];
597
+ const r = je[e];
558
598
  if (r)
559
599
  for (const o of r)
560
600
  t.has(o) || console.warn(
@@ -562,52 +602,35 @@ function Oe(n) {
562
602
  );
563
603
  }
564
604
  }
565
- function je(n) {
566
- const t = [], e = [], r = { ...n };
567
- r.multiSort !== void 0 ? delete r.sorting : r.sorting !== void 0 && (r.multiSort = r.sorting, delete r.sorting);
568
- for (const [s, a] of Object.entries(r)) {
569
- if (a === void 0 || a === !1) continue;
570
- const l = s;
571
- e.push(l);
572
- }
573
- Oe(e);
574
- const o = [
575
- "selection",
576
- "editing",
577
- // Then everything else in the order they were specified
578
- ...e.filter((s) => s !== "selection" && s !== "editing")
579
- ], c = [...new Set(o)].filter((s) => e.includes(s));
580
- for (const s of c) {
581
- const a = n[s];
582
- if (a === void 0 || a === !1) continue;
583
- const l = Ce(s, a);
584
- l && t.push(l);
585
- }
586
- return t;
605
+ function ze(n) {
606
+ const t = [];
607
+ for (const [e, r] of Object.entries(n))
608
+ r === void 0 || r === !1 || t.push(e);
609
+ return $e(t), ve(n);
587
610
  }
588
- let de = !1, $ = null;
611
+ let de = !1, _ = null;
589
612
  function Y() {
590
- return de || ($ = new ue(), me.registerAdapter($), de = !0), $;
613
+ return de || (_ = new ue(), me.registerAdapter(_), de = !0), _;
591
614
  }
592
615
  Y();
593
- const He = Z(null);
594
- function ze(n) {
616
+ const _e = Z(null);
617
+ function We(n) {
595
618
  const e = n.getPluginByName?.("masterDetail");
596
619
  e && typeof e.refreshDetailRenderer == "function" && e.refreshDetailRenderer();
597
620
  }
598
- function _e(n, t) {
621
+ function qe(n, t) {
599
622
  const e = n;
600
623
  if (!n.querySelector("tbw-grid-responsive-card") || !le(n)) return;
601
- const c = e.getPluginByName?.("responsive");
602
- if (c && typeof c.setCardRenderer == "function") {
603
- const s = t.createResponsiveCardRenderer(n);
604
- s && c.setCardRenderer(s);
624
+ const s = e.getPluginByName?.("responsive");
625
+ if (s && typeof s.setCardRenderer == "function") {
626
+ const c = t.createResponsiveCardRenderer(n);
627
+ c && s.setCardRenderer(c);
605
628
  }
606
629
  }
607
- function $e(n) {
630
+ function Be(n) {
608
631
  const t = {};
609
- return we.forEach(n, (e) => {
610
- if (ve(e)) {
632
+ return Re.forEach(n, (e) => {
633
+ if (we(e)) {
611
634
  if (e.type && e.type.displayName === "GridDetailPanel") {
612
635
  const r = e.props;
613
636
  t.masterDetail = {
@@ -621,32 +644,32 @@ function $e(n) {
621
644
  }
622
645
  }), t;
623
646
  }
624
- const it = he(function(t, e) {
647
+ const at = he(function(t, e) {
625
648
  const {
626
649
  // Core props
627
650
  rows: r,
628
651
  gridConfig: o,
629
- columns: c,
630
- columnDefaults: s,
631
- fitMode: a,
652
+ columns: s,
653
+ columnDefaults: c,
654
+ fitMode: d,
632
655
  sortable: l,
633
- filterable: g,
634
- selectable: w,
656
+ filterable: p,
657
+ selectable: R,
635
658
  loading: k,
636
659
  editOn: M,
637
660
  customStyles: N,
638
661
  className: fe,
639
- style: ge,
640
- children: O,
662
+ style: pe,
663
+ children: H,
641
664
  // Plugin props
642
- plugins: P,
665
+ plugins: D,
643
666
  // SSR mode
644
667
  ssr: ee,
645
668
  // Legacy event handlers
646
- onRowsChange: j,
669
+ onRowsChange: O,
647
670
  // Feature props and event props are in ...rest
648
- ...C
649
- } = t, u = S(null), L = S(null), te = V(xe), H = V(De), re = [
671
+ ...v
672
+ } = t, u = A(null), L = A(null), te = V(Ae), j = V(De), re = [
650
673
  "selection",
651
674
  "editing",
652
675
  "filtering",
@@ -655,8 +678,12 @@ const it = he(function(t, e) {
655
678
  // deprecated alias for multiSort
656
679
  "clipboard",
657
680
  "contextMenu",
681
+ "reorderColumns",
658
682
  "reorder",
683
+ // deprecated alias for reorderColumns
659
684
  "rowReorder",
685
+ // deprecated alias for reorderRows
686
+ "reorderRows",
660
687
  "visibility",
661
688
  "undoRedo",
662
689
  "tree",
@@ -671,110 +698,110 @@ const it = he(function(t, e) {
671
698
  "print",
672
699
  "pivot",
673
700
  "serverSide"
674
- ], pe = v(() => re.map((i) => {
675
- const d = C[i];
676
- return d !== void 0 ? `${i}:${JSON.stringify(d)}` : "";
677
- }).filter(Boolean).join("|"), [C]), ne = v(() => {
701
+ ], ge = w(() => re.map((i) => {
702
+ const a = v[i];
703
+ return a !== void 0 ? `${i}:${JSON.stringify(a)}` : "";
704
+ }).filter(Boolean).join("|"), [v]), ne = w(() => {
678
705
  const i = {};
679
- for (const d of re)
680
- d in C && C[d] !== void 0 && (i[d] = C[d]);
706
+ for (const a of re)
707
+ a in v && v[a] !== void 0 && (i[a] = v[a]);
681
708
  return i;
682
- }, [pe]), oe = v(() => $e(O), [O]), ie = v(() => ({ ...oe, ...ne }), [ne, oe]), z = v(() => P || ee ? [] : je(ie), [ie, P, ee]), x = v(() => {
683
- if (P) {
684
- const i = new Set(P.map((f) => f.name)), d = z.filter((f) => !i.has(f.name));
685
- return [...P, ...d];
709
+ }, [ge]), oe = w(() => Be(H), [H]), ie = w(() => ({ ...oe, ...ne }), [ne, oe]), $ = w(() => D || ee ? [] : ze(ie), [ie, D, ee]), S = w(() => {
710
+ if (D) {
711
+ const i = new Set(D.map((f) => f.name)), a = $.filter((f) => !i.has(f.name));
712
+ return [...D, ...a];
686
713
  }
687
- return z;
688
- }, [P, z]), A = v(() => {
689
- if (!c) return c;
690
- const i = Pe(c);
691
- return s ? i.map((d) => ({
692
- ...s,
693
- ...d
714
+ return $;
715
+ }, [D, $]), G = w(() => {
716
+ if (!s) return s;
717
+ const i = Pe(s);
718
+ return c ? i.map((a) => ({
719
+ ...c,
720
+ ...a
694
721
  // Individual column props override defaults
695
722
  })) : i;
696
- }, [c, s]), G = v(() => {
697
- const i = Ve(o), d = {};
698
- if (l !== void 0 && (d.sortable = l), g !== void 0 && (d.filterable = g), w !== void 0 && (d.selectable = w), H) {
723
+ }, [s, c]), I = w(() => {
724
+ const i = Fe(o), a = {};
725
+ if (l !== void 0 && (a.sortable = l), p !== void 0 && (a.filterable = p), R !== void 0 && (a.selectable = R), j) {
699
726
  const f = i?.icons || o?.icons || {};
700
- d.icons = { ...H, ...f };
727
+ a.icons = { ...j, ...f };
701
728
  }
702
- if (x.length > 0 && i) {
703
- const f = i.plugins || [], h = new Set(f.map((D) => D.name)), F = x.filter((D) => !h.has(D.name));
729
+ if (S.length > 0 && i) {
730
+ const f = i.plugins || [], y = new Set(f.map((x) => x.name)), F = S.filter((x) => !y.has(x.name));
704
731
  return {
705
732
  ...i,
706
- ...d,
733
+ ...a,
707
734
  plugins: [...f, ...F]
708
735
  };
709
736
  }
710
- return x.length > 0 && !i ? { ...d, plugins: x } : Object.keys(d).length > 0 ? { ...i, ...d } : i;
711
- }, [o, x, l, g, w, H]);
712
- p(() => {
737
+ return S.length > 0 && !i ? { ...a, plugins: S } : Object.keys(a).length > 0 ? { ...i, ...a } : i;
738
+ }, [o, S, l, p, R, j]);
739
+ m(() => {
713
740
  Y().setTypeDefaults(te);
714
- }, [te]), p(() => {
741
+ }, [te]), m(() => {
715
742
  u.current && (u.current.rows = r);
716
- }, [r]), p(() => {
717
- u.current && G && (u.current.gridConfig = G);
718
- }, [G]), p(() => {
719
- u.current && A && (u.current.columns = A);
720
- }, [A]), p(() => {
721
- u.current && a !== void 0 && (u.current.fitMode = a);
722
- }, [a]), p(() => {
743
+ }, [r]), m(() => {
744
+ u.current && I && (u.current.gridConfig = I);
745
+ }, [I]), m(() => {
746
+ u.current && G && (u.current.columns = G);
747
+ }, [G]), m(() => {
748
+ u.current && d !== void 0 && (u.current.fitMode = d);
749
+ }, [d]), m(() => {
723
750
  u.current && M !== void 0 && (u.current.editOn = M);
724
- }, [M]), p(() => {
751
+ }, [M]), m(() => {
725
752
  u.current && k !== void 0 && (u.current.loading = k);
726
- }, [k]), p(() => {
753
+ }, [k]), m(() => {
727
754
  const i = u.current;
728
755
  if (!i) return;
729
- const d = Y();
730
- i.__frameworkAdapter = d, ze(i), _e(i, d);
756
+ const a = Y();
757
+ i.__frameworkAdapter = a, We(i), qe(i, a);
731
758
  let f = !1;
732
- const h = requestAnimationFrame(() => {
759
+ const y = requestAnimationFrame(() => {
733
760
  f || (typeof i.refreshColumns == "function" && i.refreshColumns(), typeof i.refreshShellHeader == "function" && i.refreshShellHeader());
734
761
  });
735
762
  return () => {
736
- f = !0, cancelAnimationFrame(h);
763
+ f = !0, cancelAnimationFrame(y);
737
764
  };
738
- }, []), p(() => {
765
+ }, []), m(() => {
739
766
  if (!u.current || !N) return;
740
- const i = u.current, d = "react-custom-styles";
767
+ const i = u.current, a = "react-custom-styles";
741
768
  let f = !0;
742
769
  return i.ready?.().then(() => {
743
- f && N && (i.registerStyles?.(d, N), L.current = d);
770
+ f && N && (i.registerStyles?.(a, N), L.current = a);
744
771
  }), () => {
745
772
  f = !1, L.current && (i.unregisterStyles?.(L.current), L.current = null);
746
773
  };
747
- }, [N]), p(() => {
774
+ }, [N]), m(() => {
748
775
  const i = u.current;
749
776
  if (!i) return;
750
- const d = [];
751
- if (j) {
752
- const f = ((h) => j(h.detail.rows));
753
- i.addEventListener("rows-change", f), d.push(["rows-change", f]);
777
+ const a = [];
778
+ if (O) {
779
+ const f = ((y) => O(y.detail.rows));
780
+ i.addEventListener("rows-change", f), a.push(["rows-change", f]);
754
781
  }
755
782
  return () => {
756
- d.forEach(([f, h]) => {
757
- i.removeEventListener(f, h);
783
+ a.forEach(([f, y]) => {
784
+ i.removeEventListener(f, y);
758
785
  });
759
786
  };
760
- }, [j]);
761
- const se = v(() => Object.keys(_).filter((i) => typeof C[i] == "function").sort().join("|"), [C]), ce = S({});
762
- for (const i of Object.keys(_))
763
- ce.current[i] = C[i];
764
- return p(() => {
787
+ }, [O]);
788
+ const se = w(() => Object.keys(z).filter((i) => typeof v[i] == "function").sort().join("|"), [v]), ce = A({});
789
+ for (const i of Object.keys(z))
790
+ ce.current[i] = v[i];
791
+ return m(() => {
765
792
  const i = u.current;
766
793
  if (!i) return;
767
- const d = [];
768
- for (const [f, h] of Object.entries(_))
794
+ const a = [];
795
+ for (const [f, y] of Object.entries(z))
769
796
  if (se.includes(f)) {
770
- const F = ((D) => {
771
- ce.current[f]?.(D.detail, D);
797
+ const F = ((x) => {
798
+ ce.current[f]?.(x.detail, x);
772
799
  });
773
- i.addEventListener(h, F), d.push([h, F]);
800
+ i.addEventListener(y, F), a.push([y, F]);
774
801
  }
775
802
  return () => {
776
- d.forEach(([f, h]) => {
777
- i.removeEventListener(f, h);
803
+ a.forEach(([f, y]) => {
804
+ i.removeEventListener(f, y);
778
805
  });
779
806
  };
780
807
  }, [se]), ye(
@@ -795,57 +822,57 @@ const it = he(function(t, e) {
795
822
  async toggleGroup(i) {
796
823
  return u.current?.toggleGroup?.(i);
797
824
  },
798
- registerStyles(i, d) {
799
- u.current?.registerStyles?.(i, d);
825
+ registerStyles(i, a) {
826
+ u.current?.registerStyles?.(i, a);
800
827
  },
801
828
  unregisterStyles(i) {
802
829
  u.current?.unregisterStyles?.(i);
803
830
  },
804
- setRowLoading(i, d) {
805
- u.current?.setRowLoading?.(i, d);
831
+ setRowLoading(i, a) {
832
+ u.current?.setRowLoading?.(i, a);
806
833
  },
807
- setCellLoading(i, d, f) {
808
- u.current?.setCellLoading?.(i, d, f);
834
+ setCellLoading(i, a, f) {
835
+ u.current?.setCellLoading?.(i, a, f);
809
836
  },
810
837
  isRowLoading(i) {
811
838
  return u.current?.isRowLoading?.(i) ?? !1;
812
839
  },
813
- isCellLoading(i, d) {
814
- return u.current?.isCellLoading?.(i, d) ?? !1;
840
+ isCellLoading(i, a) {
841
+ return u.current?.isCellLoading?.(i, a) ?? !1;
815
842
  },
816
843
  clearAllLoading() {
817
844
  u.current?.clearAllLoading?.();
818
845
  }
819
846
  }),
820
847
  []
821
- ), /* @__PURE__ */ b(
848
+ ), /* @__PURE__ */ E(
822
849
  "tbw-grid",
823
850
  {
824
851
  ref: (i) => {
825
852
  if (u.current = i, i) {
826
- const d = i;
827
- G && (d.gridConfig = G), r && (d.rows = r), A && (d.columns = A);
853
+ const a = i;
854
+ I && (a.gridConfig = I), r && (a.rows = r), G && (a.columns = G);
828
855
  }
829
856
  },
830
857
  class: fe,
831
- style: ge,
832
- children: /* @__PURE__ */ b(He.Provider, { value: u, children: O })
858
+ style: pe,
859
+ children: /* @__PURE__ */ E(_e.Provider, { value: u, children: H })
833
860
  }
834
861
  );
835
862
  });
836
863
  export {
837
- it as D,
838
- He as G,
839
- ot as R,
840
- nt as a,
841
- Qe as b,
842
- Ye as c,
843
- Le as d,
844
- Se as e,
845
- tt as f,
846
- et as g,
847
- Ze as h,
864
+ at as D,
865
+ _e as G,
866
+ ct as R,
867
+ st as a,
868
+ tt as b,
869
+ Xe as c,
870
+ ke as d,
871
+ xe as e,
872
+ ot as f,
873
+ nt as g,
874
+ et as h,
848
875
  ue as i,
849
- rt as r,
850
- Xe as u
876
+ it as r,
877
+ rt as u
851
878
  };