@toolbox-web/grid-react 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,11 +7,11 @@ function w(t, e) {
7
7
  }
8
8
  function g(t, e) {
9
9
  if (e) return e;
10
- const n = t.closest("tbw-grid");
11
- if (n) return n;
10
+ const o = t.closest("tbw-grid");
11
+ if (o) return o;
12
12
  if (r.size === 1) return r.keys().next().value;
13
13
  }
14
- function f(t) {
14
+ function u(t) {
15
15
  const e = c.get(t);
16
16
  if (e) {
17
17
  try {
@@ -21,19 +21,19 @@ function f(t) {
21
21
  c.delete(t);
22
22
  }
23
23
  }
24
- function b(t, e, n, u) {
25
- const o = n ?? `p-${m++}`, s = g(t, u), l = s ? r.get(s) : void 0;
26
- if (l)
27
- f(o), s && i.set(o, s), l.renderPortal(o, t, e);
24
+ function b(t, e, o, l) {
25
+ const n = o ?? `p-${m++}`, s = g(t, l), f = s ? r.get(s) : void 0;
26
+ if (f)
27
+ u(n), s && i.set(n, s), f.renderPortal(n, t, e);
28
28
  else {
29
- let a = c.get(o);
30
- a || (a = p(t), c.set(o, a)), d(() => a.render(e));
29
+ let a = c.get(n);
30
+ a || (a = p(t), c.set(n, a)), d(() => a.render(e));
31
31
  }
32
- return o;
32
+ return n;
33
33
  }
34
- function x(t) {
35
- const e = i.get(t);
36
- (e ? r.get(e) : void 0)?.removePortal(t), i.delete(t), f(t);
34
+ function x(t, e) {
35
+ const o = i.get(t);
36
+ (o ? r.get(o) : void 0)?.removePortal(t, e?.sync), i.delete(t), u(t);
37
37
  }
38
38
  export {
39
39
  b as a,
@@ -1,6 +1,6 @@
1
1
  import { FilteringPlugin as F } from "@toolbox-web/grid/plugins/filtering";
2
2
  import { useContext as G, useCallback as n } from "react";
3
- import { r as h, a as k } from "../chunks/portal-bridge-B0mjqzak.js";
3
+ import { r as h, a as k } from "../chunks/portal-bridge-DZ4yQkmm.js";
4
4
  import { registerFeature as E } from "@toolbox-web/grid/features/registry";
5
5
  import { G as R } from "../chunks/grid-element-context-BU3WvNtM.js";
6
6
  E("filtering", (l) => {
@@ -1,5 +1,5 @@
1
1
  import { GroupingColumnsPlugin as u } from "@toolbox-web/grid/plugins/grouping-columns";
2
- import { a as s } from "../chunks/portal-bridge-B0mjqzak.js";
2
+ import { a as s } from "../chunks/portal-bridge-DZ4yQkmm.js";
3
3
  import { registerFeature as i } from "@toolbox-web/grid/features/registry";
4
4
  function p(n) {
5
5
  const e = /* @__PURE__ */ new WeakMap();
@@ -1,5 +1,5 @@
1
1
  import { GroupingRowsPlugin as n } from "@toolbox-web/grid/plugins/grouping-rows";
2
- import { a as c } from "../chunks/portal-bridge-B0mjqzak.js";
2
+ import { a as c } from "../chunks/portal-bridge-DZ4yQkmm.js";
3
3
  import { registerFeature as a } from "@toolbox-web/grid/features/registry";
4
4
  a("groupingRows", (r) => {
5
5
  if (typeof r == "boolean") return new n();
@@ -1,6 +1,6 @@
1
1
  import "@toolbox-web/grid/features/pinned-rows";
2
2
  import { PinnedRowsPlugin as o } from "@toolbox-web/grid/plugins/pinned-rows";
3
- import { a as u } from "../chunks/portal-bridge-B0mjqzak.js";
3
+ import { a as u } from "../chunks/portal-bridge-DZ4yQkmm.js";
4
4
  import { registerFeature as p } from "@toolbox-web/grid/features/registry";
5
5
  p("pinnedRows", (n) => {
6
6
  if (typeof n == "boolean") return new o();
package/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import { jsx as b, Fragment as re, jsxs as Pe } from "react/jsx-runtime";
1
+ import { jsx as b, Fragment as ne, jsxs as Pe } from "react/jsx-runtime";
2
2
  import { DataGridElement as be } from "@toolbox-web/grid";
3
- import { createContext as ye, useContext as O, useRef as E, useCallback as S, useEffect as P, forwardRef as he, useReducer as Ee, useImperativeHandle as ve, useMemo as D, useLayoutEffect as ke, Children as Se, isValidElement as De, useState as ue } from "react";
4
- import { a as w, r as H, s as fe } from "./chunks/portal-bridge-B0mjqzak.js";
5
- import { createPortal as Ge, flushSync as ge } from "react-dom";
3
+ import { createContext as me, useContext as O, useRef as E, useCallback as S, useEffect as P, forwardRef as he, useReducer as Ee, useImperativeHandle as ve, useMemo as D, useLayoutEffect as ke, Children as Se, isValidElement as De, useState as fe } from "react";
4
+ import { a as w, r as H, s as ge } from "./chunks/portal-bridge-DZ4yQkmm.js";
5
+ import { flushSync as W, createPortal as Ge } from "react-dom";
6
6
  import { createPluginsFromFeatures as Ae } from "@toolbox-web/grid/features/registry";
7
7
  import { G as Te } from "./chunks/grid-element-context-BU3WvNtM.js";
8
8
  function xe(n) {
@@ -33,7 +33,7 @@ function Ne(n) {
33
33
  function Fe(n) {
34
34
  return n.map((e) => typeof e == "string" ? Ne(e) : e);
35
35
  }
36
- const W = {
36
+ const B = {
37
37
  onCellClick: "cell-click",
38
38
  onRowClick: "row-click",
39
39
  onCellActivate: "cell-activate",
@@ -60,30 +60,30 @@ const W = {
60
60
  onPrintStart: "print-start",
61
61
  onPrintComplete: "print-complete",
62
62
  onTbwScroll: "tbw-scroll"
63
- }, ne = ye(null), Ie = ({ icons: n, children: e }) => /* @__PURE__ */ b(ne.Provider, { value: n, children: e });
63
+ }, oe = me(null), Ie = ({ icons: n, children: e }) => /* @__PURE__ */ b(oe.Provider, { value: n, children: e });
64
64
  function pt() {
65
- return O(ne);
65
+ return O(oe);
66
66
  }
67
- const Le = ne, J = /* @__PURE__ */ new WeakMap(), Y = /* @__PURE__ */ new Map();
67
+ const Le = oe, Y = /* @__PURE__ */ new WeakMap(), Z = /* @__PURE__ */ new Map();
68
68
  function Ce(n) {
69
69
  const e = n.querySelector("tbw-grid-responsive-card");
70
70
  if (e) {
71
- const r = J.get(e);
71
+ const r = Y.get(e);
72
72
  if (r) return r;
73
73
  }
74
74
  const t = n.id || n.getAttribute("data-grid-id");
75
75
  if (t)
76
- return Y.get(t);
76
+ return Z.get(t);
77
77
  }
78
78
  function Me(n) {
79
79
  const { children: e, cardRowHeight: t = "auto" } = n, r = E(null), o = S(
80
80
  (c) => {
81
81
  if (r.current = c, !c) return;
82
- J.set(c, e);
82
+ Y.set(c, e);
83
83
  const a = c.closest("tbw-grid");
84
84
  if (a) {
85
85
  const f = a.id || a.getAttribute("data-grid-id");
86
- f && Y.set(f, e);
86
+ f && Z.set(f, e);
87
87
  }
88
88
  },
89
89
  [e]
@@ -91,11 +91,11 @@ function Me(n) {
91
91
  P(() => () => {
92
92
  const c = r.current;
93
93
  if (c) {
94
- J.delete(c);
94
+ Y.delete(c);
95
95
  const a = c.closest("tbw-grid");
96
96
  if (a) {
97
97
  const f = a.id || a.getAttribute("data-grid-id");
98
- f && Y.delete(f);
98
+ f && Z.delete(f);
99
99
  }
100
100
  }
101
101
  }, []);
@@ -103,17 +103,17 @@ function Me(n) {
103
103
  return /* @__PURE__ */ b("tbw-grid-responsive-card", { ref: o, cardRowHeight: s });
104
104
  }
105
105
  Me.displayName = "GridResponsiveCard";
106
- const z = ye(null), He = ({ defaults: n, children: e }) => /* @__PURE__ */ b(z.Provider, { value: n, children: e });
107
- function mt() {
106
+ const z = me(null), He = ({ defaults: n, children: e }) => /* @__PURE__ */ b(z.Provider, { value: n, children: e });
107
+ function yt() {
108
108
  return O(z);
109
109
  }
110
- function yt(n) {
110
+ function mt(n) {
111
111
  return O(z)?.[n];
112
112
  }
113
113
  const Oe = z, je = he(function(e, t) {
114
114
  const r = E(/* @__PURE__ */ new Map()), [, o] = Ee((g) => g + 1, 0), s = E(!1), c = E(0), a = () => {
115
115
  s.current || (s.current = !0, queueMicrotask(() => {
116
- s.current = !1, ge(o), f();
116
+ s.current = !1, W(o), f();
117
117
  }));
118
118
  }, f = () => {
119
119
  c.current || (c.current = requestAnimationFrame(() => {
@@ -121,7 +121,7 @@ const Oe = z, je = he(function(e, t) {
121
121
  let g = !1;
122
122
  for (const [C, R] of r.current)
123
123
  R.container.isConnected || (r.current.delete(C), g = !0);
124
- g && ge(o);
124
+ g && W(o);
125
125
  }));
126
126
  };
127
127
  ve(
@@ -130,8 +130,8 @@ const Oe = z, je = he(function(e, t) {
130
130
  renderPortal(g, C, R) {
131
131
  r.current.set(g, { container: C, element: R }), a();
132
132
  },
133
- removePortal(g) {
134
- r.current.delete(g) && a();
133
+ removePortal(g, C) {
134
+ r.current.delete(g) && (C ? W(o) : a());
135
135
  },
136
136
  clear() {
137
137
  r.current.size > 0 && (r.current.clear(), c.current && (cancelAnimationFrame(c.current), c.current = 0), a());
@@ -144,8 +144,8 @@ const Oe = z, je = he(function(e, t) {
144
144
  const d = [];
145
145
  for (const [g, { container: C, element: R }] of r.current)
146
146
  d.push(Ge(R, C, g));
147
- return /* @__PURE__ */ b(re, { children: d });
148
- }), B = /* @__PURE__ */ Symbol("reactProcessed"), G = [];
147
+ return /* @__PURE__ */ b(ne, { children: d });
148
+ }), U = /* @__PURE__ */ Symbol("reactProcessed"), G = [];
149
149
  function ze(n) {
150
150
  for (let e = G.length - 1; e >= 0; e--) {
151
151
  const t = G[e];
@@ -204,7 +204,7 @@ function We(n) {
204
204
  }
205
205
  function Re(n) {
206
206
  if (!n) return;
207
- if (n[B]) return n;
207
+ if (n[U]) return n;
208
208
  if (n.loadingRenderer && typeof n.loadingRenderer == "function") {
209
209
  const r = n.loadingRenderer;
210
210
  n = {
@@ -214,7 +214,7 @@ function Re(n) {
214
214
  }
215
215
  if (!n.columns) {
216
216
  const r = n;
217
- return r[B] = !0, r;
217
+ return r[U] = !0, r;
218
218
  }
219
219
  const e = n.columns.map((r) => {
220
220
  const { renderer: o, editor: s, headerRenderer: c, headerLabelRenderer: a, ...f } = r, d = { ...f };
@@ -223,28 +223,28 @@ function Re(n) {
223
223
  ...n,
224
224
  columns: e
225
225
  };
226
- return t[B] = !0, t;
226
+ return t[U] = !0, t;
227
227
  }
228
- const Z = /* @__PURE__ */ new WeakMap(), Q = /* @__PURE__ */ new Map();
228
+ const Q = /* @__PURE__ */ new WeakMap(), X = /* @__PURE__ */ new Map();
229
229
  function Be(n) {
230
230
  const e = n.querySelector("tbw-grid-detail");
231
231
  if (e) {
232
- const r = Z.get(e);
232
+ const r = Q.get(e);
233
233
  if (r) return r;
234
234
  }
235
235
  const t = n.id || n.getAttribute("data-grid-id");
236
236
  if (t)
237
- return Q.get(t);
237
+ return X.get(t);
238
238
  }
239
239
  function Ue(n) {
240
240
  const { children: e, showExpandColumn: t = !0, animation: r = "slide" } = n, o = E(null), s = S(
241
241
  (a) => {
242
242
  if (o.current = a, !a) return;
243
- Z.set(a, e);
243
+ Q.set(a, e);
244
244
  const f = a.closest("tbw-grid");
245
245
  if (f) {
246
246
  const d = f.id || f.getAttribute("data-grid-id");
247
- d && Q.set(d, e);
247
+ d && X.set(d, e);
248
248
  }
249
249
  },
250
250
  [e]
@@ -252,11 +252,11 @@ function Ue(n) {
252
252
  return P(() => () => {
253
253
  const a = o.current;
254
254
  if (a) {
255
- Z.delete(a);
255
+ Q.delete(a);
256
256
  const f = a.closest("tbw-grid");
257
257
  if (f) {
258
258
  const g = f.id || f.getAttribute("data-grid-id");
259
- g && Q.delete(g);
259
+ g && X.delete(g);
260
260
  }
261
261
  const d = a.parentNode;
262
262
  d && d.contains(a);
@@ -271,24 +271,24 @@ function Ue(n) {
271
271
  );
272
272
  }
273
273
  Ue.displayName = "GridDetailPanel";
274
- const X = /* @__PURE__ */ new WeakMap(), ee = /* @__PURE__ */ new Map();
274
+ const ee = /* @__PURE__ */ new WeakMap(), te = /* @__PURE__ */ new Map();
275
275
  function Je(n) {
276
- const e = X.get(n);
276
+ const e = ee.get(n);
277
277
  if (e) return e;
278
278
  const t = n.id;
279
279
  if (t)
280
- return ee.get(t);
280
+ return te.get(t);
281
281
  }
282
282
  function ht(n) {
283
283
  const { id: e, title: t, icon: r, tooltip: o, order: s = 100, children: c } = n, a = E(null), f = S(
284
284
  (d) => {
285
- a.current = d, d && (X.set(d, c), e && ee.set(e, c));
285
+ a.current = d, d && (ee.set(d, c), e && te.set(e, c));
286
286
  },
287
287
  [c, e]
288
288
  );
289
289
  return P(() => () => {
290
290
  const d = a.current;
291
- d && (X.delete(d), e && ee.delete(e));
291
+ d && (ee.delete(d), e && te.delete(e));
292
292
  }, [e]), /* @__PURE__ */ b(
293
293
  "tbw-grid-tool-panel",
294
294
  {
@@ -496,7 +496,7 @@ class et {
496
496
  grid: r ?? o
497
497
  }), void 0, r ?? void 0);
498
498
  return this.trackPortal(c, o, !1), () => {
499
- H(c), this.untrackPortal(c);
499
+ H(c, { sync: !0 }), this.untrackPortal(c);
500
500
  };
501
501
  };
502
502
  }
@@ -635,11 +635,11 @@ function nt(n) {
635
635
  r === void 0 || r === !1 || e.push(t);
636
636
  return rt(e), Ae(n);
637
637
  }
638
- let me = !1, U = null;
639
- function te() {
640
- return me || (U = new et(), be.registerAdapter(U), me = !0), U;
638
+ let ye = !1, J = null;
639
+ function re() {
640
+ return ye || (J = new et(), be.registerAdapter(J), ye = !0), J;
641
641
  }
642
- te();
642
+ re();
643
643
  function ot(n) {
644
644
  const t = n.getPluginByName?.("masterDetail");
645
645
  t && typeof t.refreshDetailRenderer == "function" && t.refreshDetailRenderer();
@@ -687,14 +687,14 @@ const vt = he(function(e, t) {
687
687
  style: p,
688
688
  children: v,
689
689
  // Plugin props
690
- plugins: y,
690
+ plugins: m,
691
691
  // SSR mode
692
692
  ssr: k,
693
693
  // Legacy event handlers
694
694
  onRowsChange: x,
695
695
  // Feature props and event props are in ...rest
696
696
  ...h
697
- } = e, u = E(null), j = E(null), oe = O(Oe), q = O(Le), ie = [
697
+ } = e, u = E(null), j = E(null), ie = O(Oe), q = O(Le), se = [
698
698
  "selection",
699
699
  "editing",
700
700
  "filtering",
@@ -718,21 +718,21 @@ const vt = he(function(e, t) {
718
718
  "pivot",
719
719
  "serverSide",
720
720
  "tooltip"
721
- ], we = D(() => ie.map((i) => {
721
+ ], we = D(() => se.map((i) => {
722
722
  const l = h[i];
723
723
  return l !== void 0 ? `${i}:${JSON.stringify(l)}` : "";
724
- }).filter(Boolean).join("|"), [h]), se = D(() => {
724
+ }).filter(Boolean).join("|"), [h]), ce = D(() => {
725
725
  const i = {};
726
- for (const l of ie)
726
+ for (const l of se)
727
727
  l in h && h[l] !== void 0 && (i[l] = h[l]);
728
728
  return i;
729
- }, [we]), ce = D(() => st(v), [v]), ae = D(() => ({ ...ce, ...se }), [se, ce]), _ = D(() => y || k ? [] : nt(ae), [ae, y, k]), N = D(() => {
730
- if (y) {
731
- const i = new Set(y.map((m) => m.name)), l = _.filter((m) => !i.has(m.name));
732
- return [...y, ...l];
729
+ }, [we]), ae = D(() => st(v), [v]), le = D(() => ({ ...ae, ...ce }), [ce, ae]), _ = D(() => m || k ? [] : nt(le), [le, m, k]), N = D(() => {
730
+ if (m) {
731
+ const i = new Set(m.map((y) => y.name)), l = _.filter((y) => !i.has(y.name));
732
+ return [...m, ...l];
733
733
  }
734
734
  return _;
735
- }, [y, _]), F = D(() => {
735
+ }, [m, _]), F = D(() => {
736
736
  if (!s) return s;
737
737
  const i = Fe(s);
738
738
  return c ? i.map((l) => ({
@@ -743,22 +743,22 @@ const vt = he(function(e, t) {
743
743
  }, [s, c]), I = D(() => {
744
744
  const i = Re(o), l = {};
745
745
  if (f !== void 0 && (l.sortable = f), d !== void 0 && (l.filterable = d), g !== void 0 && (l.selectable = g), q) {
746
- const m = i?.icons || o?.icons || {};
747
- l.icons = { ...q, ...m };
746
+ const y = i?.icons || o?.icons || {};
747
+ l.icons = { ...q, ...y };
748
748
  }
749
749
  if (N.length > 0 && i) {
750
- const m = i.plugins || [], L = new Set(m.map((M) => M.name)), V = N.filter((M) => !L.has(M.name));
750
+ const y = i.plugins || [], L = new Set(y.map((M) => M.name)), V = N.filter((M) => !L.has(M.name));
751
751
  return {
752
752
  ...i,
753
753
  ...l,
754
- plugins: [...m, ...V]
754
+ plugins: [...y, ...V]
755
755
  };
756
756
  }
757
757
  return N.length > 0 && !i ? { ...l, plugins: N } : Object.keys(l).length > 0 ? { ...i, ...l } : i;
758
758
  }, [o, N, f, d, g, q]);
759
759
  P(() => {
760
- te().setTypeDefaults(oe);
761
- }, [oe]), P(() => {
760
+ re().setTypeDefaults(ie);
761
+ }, [ie]), P(() => {
762
762
  u.current && (u.current.rows = r);
763
763
  }, [r]), P(() => {
764
764
  u.current && I && (u.current.gridConfig = I);
@@ -771,49 +771,49 @@ const vt = he(function(e, t) {
771
771
  }, [C]), P(() => {
772
772
  const i = u.current;
773
773
  if (!i) return;
774
- const l = te();
774
+ const l = re();
775
775
  i.__frameworkAdapter = l, ot(i), it(i, l);
776
- let m = !1;
776
+ let y = !1;
777
777
  const L = requestAnimationFrame(() => {
778
- m || (typeof i.refreshColumns == "function" && i.refreshColumns(), typeof i.refreshShellHeader == "function" && i.refreshShellHeader());
778
+ y || (typeof i.refreshColumns == "function" && i.refreshColumns(), typeof i.refreshShellHeader == "function" && i.refreshShellHeader());
779
779
  });
780
780
  return () => {
781
- m = !0, cancelAnimationFrame(L);
781
+ y = !0, cancelAnimationFrame(L);
782
782
  };
783
783
  }, []), P(() => {
784
784
  if (!u.current || !R) return;
785
785
  const i = u.current, l = "react-custom-styles";
786
- let m = !0;
786
+ let y = !0;
787
787
  return i.ready?.().then(() => {
788
- m && R && (i.registerStyles?.(l, R), j.current = l);
788
+ y && R && (i.registerStyles?.(l, R), j.current = l);
789
789
  }), () => {
790
- m = !1, j.current && (i.unregisterStyles?.(j.current), j.current = null);
790
+ y = !1, j.current && (i.unregisterStyles?.(j.current), j.current = null);
791
791
  };
792
792
  }, [R]), P(() => {
793
793
  const i = u.current;
794
794
  if (!i) return;
795
795
  const l = [];
796
- return x && l.push(i.on("rows-change", (m) => x(m.rows))), () => {
797
- l.forEach((m) => m());
796
+ return x && l.push(i.on("rows-change", (y) => x(y.rows))), () => {
797
+ l.forEach((y) => y());
798
798
  };
799
799
  }, [x]);
800
- const le = D(() => Object.keys(W).filter((i) => typeof h[i] == "function").sort().join("|"), [h]), de = E({});
801
- for (const i of Object.keys(W))
802
- de.current[i] = h[i];
800
+ const de = D(() => Object.keys(B).filter((i) => typeof h[i] == "function").sort().join("|"), [h]), ue = E({});
801
+ for (const i of Object.keys(B))
802
+ ue.current[i] = h[i];
803
803
  P(() => {
804
804
  const i = u.current;
805
805
  if (!i) return;
806
806
  const l = [];
807
- for (const [m, L] of Object.entries(W))
808
- le.includes(m) && l.push(
807
+ for (const [y, L] of Object.entries(B))
808
+ de.includes(y) && l.push(
809
809
  i.on(L, (V, M) => {
810
- de.current[m]?.(V, M);
810
+ ue.current[y]?.(V, M);
811
811
  })
812
812
  );
813
813
  return () => {
814
- l.forEach((m) => m());
814
+ l.forEach((y) => y());
815
815
  };
816
- }, [le]), ve(
816
+ }, [de]), ve(
817
817
  t,
818
818
  () => ({
819
819
  get element() {
@@ -840,8 +840,8 @@ const vt = he(function(e, t) {
840
840
  setRowLoading(i, l) {
841
841
  u.current?.setRowLoading?.(i, l);
842
842
  },
843
- setCellLoading(i, l, m) {
844
- u.current?.setCellLoading?.(i, l, m);
843
+ setCellLoading(i, l, y) {
844
+ u.current?.setCellLoading?.(i, l, y);
845
845
  },
846
846
  isRowLoading(i) {
847
847
  return u.current?.isRowLoading?.(i) ?? !1;
@@ -858,10 +858,10 @@ const vt = he(function(e, t) {
858
858
  const $ = E(null);
859
859
  return ke(() => {
860
860
  const i = u.current;
861
- return i && $.current && fe(i, $.current), () => {
862
- i && fe(i, null);
861
+ return i && $.current && ge(i, $.current), () => {
862
+ i && ge(i, null);
863
863
  };
864
- }, []), /* @__PURE__ */ Pe(re, { children: [
864
+ }, []), /* @__PURE__ */ Pe(ne, { children: [
865
865
  /* @__PURE__ */ b(je, { ref: $ }),
866
866
  /* @__PURE__ */ b(
867
867
  "tbw-grid",
@@ -896,9 +896,9 @@ function Ct(n) {
896
896
  options: K,
897
897
  multi: p,
898
898
  format: v
899
- } = n, y = E(null), k = S(
899
+ } = n, m = E(null), k = S(
900
900
  (u) => {
901
- y.current = u, u && (C && Ye(u, C), R && Ze(u, R));
901
+ m.current = u, u && (C && Ye(u, C), R && Ze(u, R));
902
902
  },
903
903
  [C, R, e]
904
904
  ), x = typeof a == "number" ? `${a}px` : a, h = {
@@ -912,28 +912,28 @@ function Rt({ children: n }) {
912
912
  }
913
913
  const wt = ({ icons: n, defaults: e, children: t }) => {
914
914
  let r = t;
915
- return e && (r = /* @__PURE__ */ b(He, { defaults: e, children: r })), n && (r = /* @__PURE__ */ b(Ie, { icons: n, children: r })), /* @__PURE__ */ b(re, { children: r });
915
+ return e && (r = /* @__PURE__ */ b(He, { defaults: e, children: r })), n && (r = /* @__PURE__ */ b(Ie, { icons: n, children: r })), /* @__PURE__ */ b(ne, { children: r });
916
916
  };
917
917
  function Pt(n) {
918
- const e = E(null), [t, r] = ue(!1), [o, s] = ue(null), c = E(null), a = S(() => n ? (c.current ??= document.querySelector(n), c.current) : e.current?.element ?? null, [n]);
918
+ const e = E(null), [t, r] = fe(!1), [o, s] = fe(null), c = E(null), a = S(() => n ? (c.current ??= document.querySelector(n), c.current) : e.current?.element ?? null, [n]);
919
919
  P(() => {
920
920
  let p = !0;
921
921
  return (async () => {
922
922
  try {
923
923
  if (n) {
924
- const y = document.querySelector(n);
925
- if (!y) return;
926
- if (c.current = y, await y.ready?.(), p) {
924
+ const m = document.querySelector(n);
925
+ if (!m) return;
926
+ if (c.current = m, await m.ready?.(), p) {
927
927
  r(!0);
928
- const k = await y.getConfig?.();
928
+ const k = await m.getConfig?.();
929
929
  p && k && s(k);
930
930
  }
931
931
  } else {
932
- const y = e.current;
933
- if (!y) return;
934
- if (await y.ready?.(), p) {
932
+ const m = e.current;
933
+ if (!m) return;
934
+ if (await m.ready?.(), p) {
935
935
  r(!0);
936
- const k = await y.getConfig?.();
936
+ const k = await m.getConfig?.();
937
937
  p && k && s(k);
938
938
  }
939
939
  }
@@ -964,15 +964,15 @@ function Pt(n) {
964
964
  await v.toggleGroup?.(p);
965
965
  return;
966
966
  }
967
- const y = e.current;
968
- y && await y.toggleGroup?.(p);
967
+ const m = e.current;
968
+ m && await m.toggleGroup?.(p);
969
969
  },
970
970
  [a]
971
971
  ), C = S(
972
972
  (p, v) => {
973
- const y = a();
974
- if (y) {
975
- y.registerStyles?.(p, v);
973
+ const m = a();
974
+ if (m) {
975
+ m.registerStyles?.(p, v);
976
976
  return;
977
977
  }
978
978
  e.current?.registerStyles?.(p, v);
@@ -1015,6 +1015,6 @@ export {
1015
1015
  He as GridTypeProvider,
1016
1016
  Pt as useGrid,
1017
1017
  pt as useGridIcons,
1018
- mt as useGridTypeDefaults,
1019
- yt as useTypeDefault
1018
+ yt as useGridTypeDefaults,
1019
+ mt as useTypeDefault
1020
1020
  };
@@ -30,8 +30,14 @@ export declare function getPortalManager(gridEl?: HTMLElement): PortalManagerHan
30
30
  export declare function renderToContainer(container: HTMLElement, element: ReactNode, existingKey?: string, gridEl?: HTMLElement): string;
31
31
  /**
32
32
  * Remove a portal (or fallback root) by key.
33
+ *
34
+ * @param options.sync - When true, flush the removal synchronously so the
35
+ * caller can safely clear the container DOM immediately after (e.g.,
36
+ * tool panel accordion collapse sets `innerHTML = ''`).
33
37
  */
34
- export declare function removeFromContainer(key: string): void;
38
+ export declare function removeFromContainer(key: string, options?: {
39
+ sync?: boolean;
40
+ }): void;
35
41
  /**
36
42
  * Remove all portals and fallback roots for a specific grid.
37
43
  * Preferred over `clearAllContainers()` in multi-grid scenarios.
@@ -1 +1 @@
1
- {"version":3,"file":"portal-bridge.d.ts","sourceRoot":"","sources":["../../../../libs/grid-react/src/lib/portal-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAmB5D;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE,EAAE,mBAAmB,GAAG,IAAI,GAAG,IAAI,CAM1F;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG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CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CAQnF;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAWhE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAczC;AAED;;;GAGG;AACH,wBAAgB,eAAe,IAAI,IAAI,CAEtC;AAED;;;;GAIG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAKlC"}
@@ -9,8 +9,15 @@ export interface PortalManagerHandle {
9
9
  * a single React commit via `flushSync`.
10
10
  */
11
11
  renderPortal(key: string, container: HTMLElement, element: ReactNode): void;
12
- /** Remove a portal by key. */
13
- removePortal(key: string): void;
12
+ /**
13
+ * Remove a portal by key.
14
+ * @param key unique key of the portal to remove
15
+ * @param sync - When true, flush the removal synchronously via `flushSync`
16
+ * so the caller can safely mutate the container DOM immediately after.
17
+ * Use this in cleanup callbacks that precede external DOM clearing
18
+ * (e.g., tool panel accordion collapse sets `innerHTML = ''`).
19
+ */
20
+ removePortal(key: string, sync?: boolean): void;
14
21
  /** Remove all portals. */
15
22
  clear(): void;
16
23
  }
@@ -1 +1 @@
1
- {"version":3,"file":"portal-manager.d.ts","sourceRoot":"","sources":["../../../../libs/grid-react/src/lib/portal-manager.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAuD,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAU5F;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,GAAG,IAAI,CAAC;IAE5E,8BAA8B;IAC9B,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAEhC,0BAA0B;IAC1B,KAAK,IAAI,IAAI,CAAC;CACf;AAMD;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,+FA+ExB,CAAC"}
1
+ {"version":3,"file":"portal-manager.d.ts","sourceRoot":"","sources":["../../../../libs/grid-react/src/lib/portal-manager.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAuD,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAU5F;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,GAAG,IAAI,CAAC;IAE5E;;;;;;;OAOG;IACH,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAEhD,0BAA0B;IAC1B,KAAK,IAAI,IAAI,CAAC;CACf;AAMD;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,+FAsFxB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"react-grid-adapter.d.ts","sourceRoot":"","sources":["../../../../libs/grid-react/src/lib/react-grid-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,UAAU,IAAI,cAAc,EAE5B,gBAAgB,EAChB,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,OAAO,KAAK,EAAmC,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAmB7F;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,CAAC,GAAG,EAAE,iBAAiB,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,SAAS,GAChE,IAAI,CAaN;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,WAAW,EACpB,MAAM,EAAE,CAAC,GAAG,EAAE,mBAAmB,CAAC,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AW,GAAG,IAAI;IAYtC;;OAEG;IACH,OAAO,CAAC,SAAS,EAAE,WAAW,GAAG,IAAI;CAStC"}
1
+ {"version":3,"file":"react-grid-adapter.d.ts","sourceRoot":"","sources":["../../../../libs/grid-react/src/lib/react-grid-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,UAAU,IAAI,cAAc,EAE5B,gBAAgB,EAChB,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,OAAO,KAAK,EAAmC,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAmB7F;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,CAAC,GAAG,EAAE,iBAAiB,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,SAAS,GAChE,IAAI,CAaN;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,WAAW,EACpB,MAAM,EAAE,CAAC,GAAG,EAAE,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,SAAS,GAChE,IAAI,CAYN;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,WAAW,GACnB,CAAC,CAAC,GAAG,EAAE,iBAAiB,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,SAAS,CAAC,GAAG,SAAS,CAYvE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,WAAW,GACnB,CAAC,CAAC,GAAG,EAAE,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,SAAS,CAAC,GAAG,SAAS,CAYzE;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,EAAE,CAE9C;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAE3C;AAW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C,WAAW,EAAE,WAAW,GACvB,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,KAAK,WAAW,CAAC,GAAG,SAAS;IAyB7D;;;OAGG;IACH,uBAAuB,CAAC,OAAO,EAAE,WAAW,GAAG,CAAC,CAAC,SAAS,EAAE,WAAW,KAAK,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC,GAAG,SAAS;IA0B5G;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,cAAc,CAAC,IAAI,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,WAAW,CAAC,IAAI,CAAC,GAAG,SAAS;IAmCjG;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAiB1B;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAiBxB;;;OAGG;IACH,OAAO,CAAC,yBAAyB;IAmBjC,oDAAoD;IACpD,OAAO,CAAC,WAAW;IAQnB,sDAAsD;IACtD,OAAO,CAAC,aAAa;IAQrB;;;OAGG;IACH,OAAO,IAAI,IAAI;IAWf;;;;;OAKG;IACH,WAAW,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI;IAYtC;;OAEG;IACH,OAAO,CAAC,SAAS,EAAE,WAAW,GAAG,IAAI;CAStC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toolbox-web/grid-react",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "React adapter for @toolbox-web/grid data grid component",
5
5
  "type": "module",
6
6
  "main": "./index.js",