@envisiongroup/porygon 1.0.2 → 1.0.4

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 (22) hide show
  1. package/dist/index.js +72 -69
  2. package/dist/react-components/fields/TagPicker/EFWTagPicker.js +130 -126
  3. package/dist/react-components/fields/TagPicker/EFWTagPicker.types.d.ts +11 -6
  4. package/dist/react-components/forms/EFWForm/EFWForm.js +284 -290
  5. package/dist/react-components/forms/EFWForm/EFWForm.utils.d.ts +26 -1
  6. package/dist/react-components/forms/EFWForm/EFWForm.utils.js +94 -65
  7. package/dist/react-components/forms/EFWForm/index.d.ts +4 -3
  8. package/dist/react-components/forms/EFWForm/index.js +10 -7
  9. package/dist/react-components/tables/EFWTable/EFWTable.js +767 -747
  10. package/dist/react-components/tables/EFWTable/EFWTable.types.d.ts +10 -1
  11. package/dist/react-components/tables/EFWTable/components/EFWTableCommandBar/EFWTableCommandBar.js +31 -9
  12. package/dist/react-components/tables/EFWTable/components/EFWTableCommandBar/EFWTableCommandBar.types.d.ts +39 -4
  13. package/dist/react-components/tables/EFWTable/components/EFWTableCommandBar/EFWTableCommandBar.utils.d.ts +8 -3
  14. package/dist/react-components/tables/EFWTable/components/EFWTableCommandBar/EFWTableCommandBar.utils.js +4 -1
  15. package/dist/react-components/tables/EFWTable/hooks/useDefaultAddButton/useDefaultAddButton.d.ts +1 -1
  16. package/dist/react-components/tables/EFWTable/hooks/useDefaultAddButton/useDefaultAddButton.js +47 -15
  17. package/dist/react-components/tables/EFWTable/hooks/useDefaultUpdateButton/useDefaultUpdateButton.js +52 -21
  18. package/dist/react-components/tables/EFWTable/utils/index.d.ts +2 -1
  19. package/dist/react-components/tables/EFWTable/utils/index.js +19 -17
  20. package/dist/react-components/tables/EFWTable/utils/itemCompletion.d.ts +32 -0
  21. package/dist/react-components/tables/EFWTable/utils/itemCompletion.js +23 -0
  22. package/package.json +2 -2
@@ -1,87 +1,88 @@
1
- import { jsx as D, jsxs as ct } from "react/jsx-runtime";
2
- import * as fr from "react";
3
- import { useMemo as se, useRef as w, useState as te, useCallback as f, useEffect as oe, useLayoutEffect as kn } from "react";
4
- import { useReactTable as mr, getSortedRowModel as hr, getFilteredRowModel as pr, getCoreRowModel as gr } from "@tanstack/react-table";
5
- import { makeStyles as Sr, tokens as $, mergeClasses as wr, Card as xr, Checkbox as Hn, Spinner as Ir } from "@fluentui/react-components";
6
- import { useTableSelection as br } from "./hooks/useTableSelection/useTableSelection.js";
7
- import { renderCellContent as yr } from "./utils/index.js";
8
- import { useDefaultAddButton as Rr } from "./hooks/useDefaultAddButton/useDefaultAddButton.js";
9
- import { useDefaultUpdateButton as vr } from "./hooks/useDefaultUpdateButton/useDefaultUpdateButton.js";
10
- import { useDefaultDeleteButton as Cr } from "./hooks/useDefaultDeleteButton/useDefaultDeleteButton.js";
11
- import { useDefaultFilterButton as Tr } from "./hooks/useDefaultFilterButton/useDefaultFilterButton.js";
12
- import { useStableColumnRenderers as Er } from "./hooks/useStableColumnRenderers/useStableColumnRenderers.js";
13
- import { getFilterFn as zr, isEmptyFilterValue as Fr } from "./utils/filterFunctions.js";
14
- import { useTableLocaleText as Mr, PorygonI18nProvider as Ar } from "../../i18n/PorygonI18nProvider.js";
15
- import { generateId as it } from "./utils/general.js";
16
- import { addRowId as We, ensureItemRowId as Ln } from "./utils/typeHelpers.js";
17
- import { EFWTableCommandBar as Nr } from "./components/EFWTableCommandBar/EFWTableCommandBar.js";
18
- import { EFWTableOverlay as _n } from "./components/EFWTableOverlay/EFWTableOverlay.js";
19
- import { EFWTableHeader as kr } from "./components/EFWTableHeader/EFWTableHeader.js";
20
- import { EFWTableBody as Lr } from "./components/EFWTableBody/EFWTableBody.js";
21
- const de = {}, _r = /* @__PURE__ */ new Set(), Wn = [], Be = [], Wr = {}, De = (g) => g, Br = (g) => Object.entries(g).filter(([, p]) => !Fr(p)).map(([p, y]) => ({ id: p, value: y })), Oe = (g) => Object.fromEntries(
22
- g.map((p) => [p.id, p.value])
23
- ), Bn = (g) => g.map(({ id: p, desc: y }) => ({ id: p, desc: y })), Me = (g) => g.map(({ id: p, desc: y }) => ({ id: p, desc: y })), O = 121, Ae = 40, he = 120, Pe = 2500, Dn = 500, Dr = 20, Or = (g) => {
24
- switch (g) {
1
+ import { jsx as D, jsxs as lt } from "react/jsx-runtime";
2
+ import * as hr from "react";
3
+ import { useMemo as ce, useRef as x, useState as te, useCallback as m, useEffect as ne, useLayoutEffect as _n } from "react";
4
+ import { useReactTable as pr, getSortedRowModel as gr, getFilteredRowModel as Sr, getCoreRowModel as wr } from "@tanstack/react-table";
5
+ import { makeStyles as xr, tokens as $, mergeClasses as Ir, Card as br, Checkbox as Vn, Spinner as yr } from "@fluentui/react-components";
6
+ import { useTableSelection as Rr } from "./hooks/useTableSelection/useTableSelection.js";
7
+ import { renderCellContent as vr } from "./utils/index.js";
8
+ import { useDefaultAddButton as Cr } from "./hooks/useDefaultAddButton/useDefaultAddButton.js";
9
+ import { useDefaultUpdateButton as Tr } from "./hooks/useDefaultUpdateButton/useDefaultUpdateButton.js";
10
+ import { useDefaultDeleteButton as Er } from "./hooks/useDefaultDeleteButton/useDefaultDeleteButton.js";
11
+ import { useDefaultFilterButton as zr } from "./hooks/useDefaultFilterButton/useDefaultFilterButton.js";
12
+ import { useStableColumnRenderers as Fr } from "./hooks/useStableColumnRenderers/useStableColumnRenderers.js";
13
+ import { getFilterFn as Mr, isEmptyFilterValue as Ar } from "./utils/filterFunctions.js";
14
+ import { useTableLocaleText as Nr, PorygonI18nProvider as kr } from "../../i18n/PorygonI18nProvider.js";
15
+ import { generateId as at } from "./utils/general.js";
16
+ import { addRowId as De, ensureItemRowId as Wn } from "./utils/typeHelpers.js";
17
+ import { completeItemWithEmptyValues as fe } from "./utils/itemCompletion.js";
18
+ import { EFWTableCommandBar as Lr } from "./components/EFWTableCommandBar/EFWTableCommandBar.js";
19
+ import { EFWTableOverlay as Bn } from "./components/EFWTableOverlay/EFWTableOverlay.js";
20
+ import { EFWTableHeader as _r } from "./components/EFWTableHeader/EFWTableHeader.js";
21
+ import { EFWTableBody as Wr } from "./components/EFWTableBody/EFWTableBody.js";
22
+ const me = {}, Br = /* @__PURE__ */ new Set(), Dn = [], Oe = [], Dr = {}, Pe = (w) => w, Or = (w) => Object.entries(w).filter(([, g]) => !Ar(g)).map(([g, y]) => ({ id: g, value: y })), He = (w) => Object.fromEntries(
23
+ w.map((g) => [g.id, g.value])
24
+ ), On = (w) => w.map(({ id: g, desc: y }) => ({ id: g, desc: y })), Ne = (w) => w.map(({ id: g, desc: y }) => ({ id: g, desc: y })), O = 121, ke = 40, ge = 120, je = 2500, Pn = 500, Pr = 20, Hr = (w) => {
25
+ switch (w) {
25
26
  case "Date":
26
- return (p, y, a) => {
27
- const C = p.getValue(a), v = y.getValue(a), M = C?.[0] ? new Date(C[0]).getTime() : 0, z = v?.[0] ? new Date(v[0]).getTime() : 0;
27
+ return (g, y, i) => {
28
+ const T = g.getValue(i), C = y.getValue(i), M = T?.[0] ? new Date(T[0]).getTime() : 0, z = C?.[0] ? new Date(C[0]).getTime() : 0;
28
29
  return M < z ? -1 : M > z ? 1 : 0;
29
30
  };
30
31
  case "Choice":
31
- return (p, y, a) => {
32
- const C = p.getValue(a), v = y.getValue(a), M = C?.map((k) => k.text).join(", ") ?? "", z = v?.map((k) => k.text).join(", ") ?? "";
32
+ return (g, y, i) => {
33
+ const T = g.getValue(i), C = y.getValue(i), M = T?.map((k) => k.text).join(", ") ?? "", z = C?.map((k) => k.text).join(", ") ?? "";
33
34
  return M.localeCompare(z);
34
35
  };
35
36
  case "Number":
36
37
  return "basic";
37
38
  case "Boolean":
38
- return (p, y, a) => {
39
- const C = p.getValue(a), v = y.getValue(a);
40
- return (C ? 1 : 0) - (v ? 1 : 0);
39
+ return (g, y, i) => {
40
+ const T = g.getValue(i), C = y.getValue(i);
41
+ return (T ? 1 : 0) - (C ? 1 : 0);
41
42
  };
42
43
  default:
43
44
  return "alphanumeric";
44
45
  }
45
46
  };
46
- function fe(g, p, y) {
47
- return p.length === 0 ? g : y === "start" ? [...p, ...g] : [...g, ...p];
47
+ function he(w, g, y) {
48
+ return g.length === 0 ? w : y === "start" ? [...g, ...w] : [...w, ...g];
48
49
  }
49
- function me(g, p, y) {
50
- const a = y === "start" ? 0 : p;
51
- return g.map((C, v) => ({
52
- index: a + v,
53
- item: C
50
+ function pe(w, g, y) {
51
+ const i = y === "start" ? 0 : g;
52
+ return w.map((T, C) => ({
53
+ index: i + C,
54
+ item: T
54
55
  }));
55
56
  }
56
- const Pr = ({
57
- table: g,
58
- dense: p
57
+ const jr = ({
58
+ table: w,
59
+ dense: g
59
60
  }) => /* @__PURE__ */ D(
60
- Hn,
61
+ Vn,
61
62
  {
62
63
  shape: "circular",
63
- checked: g.getIsAllRowsSelected(),
64
- onChange: g.getToggleAllRowsSelectedHandler(),
65
- style: p ? void 0 : { marginTop: "4px" },
64
+ checked: w.getIsAllRowsSelected(),
65
+ onChange: w.getToggleAllRowsSelectedHandler(),
66
+ style: g ? void 0 : { marginTop: "4px" },
66
67
  "data-checkbox": "true"
67
68
  }
68
- ), Hr = ({
69
- row: g,
70
- toggleMultiple: p,
69
+ ), Vr = ({
70
+ row: w,
71
+ toggleMultiple: g,
71
72
  dense: y
72
73
  }) => /* @__PURE__ */ D(
73
- Hn,
74
+ Vn,
74
75
  {
75
76
  shape: "circular",
76
- checked: g.getIsSelected(),
77
- onChange: (a) => {
78
- a.stopPropagation(), p(g.index);
77
+ checked: w.getIsSelected(),
78
+ onChange: (i) => {
79
+ i.stopPropagation(), g(w.index);
79
80
  },
80
- onClick: (a) => a.stopPropagation(),
81
+ onClick: (i) => i.stopPropagation(),
81
82
  style: y ? void 0 : { marginTop: "6px" },
82
83
  "data-checkbox": "true"
83
84
  }
84
- ), jr = Sr({
85
+ ), Ur = xr({
85
86
  "efw-table": {},
86
87
  /* Transición suave para el box-shadow en las celdas y cabeceras fijas */
87
88
  "efw-table-scroll-container": {
@@ -126,425 +127,429 @@ const Pr = ({
126
127
  }
127
128
  }
128
129
  });
129
- function On(g, p, y, a) {
130
- let C = 0, v = 0;
130
+ function Hn(w, g, y, i) {
131
+ let T = 0, C = 0;
131
132
  const M = [];
132
- if (p.forEach((I) => {
133
- const G = y.find((T) => T.internalName === I.id)?.typeAsString === "Note" ? O * 2 : O, U = a[I.id] || (typeof I.size == "number" ? I.size : G);
134
- I.id === "select" ? C += U : (v += U, M.push(I));
133
+ if (g.forEach((I) => {
134
+ const G = y.find((E) => E.internalName === I.id)?.typeAsString === "Note" ? O * 2 : O, V = i[I.id] || (typeof I.size == "number" ? I.size : G);
135
+ I.id === "select" ? T += V : (C += V, M.push(I));
135
136
  }), M.length === 0) return null;
136
- const z = C + v;
137
- if (Math.abs(z - g) < 1) return null;
138
- const k = g - C, q = k / v, ne = { ...a };
139
- let ce = 0;
137
+ const z = T + C;
138
+ if (Math.abs(z - w) < 1) return null;
139
+ const k = w - T, q = k / C, re = { ...i };
140
+ let ie = 0;
140
141
  return M.forEach((I, Y) => {
141
- const G = a[I.id] || (typeof I.size == "number" ? I.size : O), U = I.minSize || he;
142
- let T;
143
- Y === M.length - 1 ? T = k - ce : T = Math.round(G * q), T = Math.max(U, T), ne[I.id] = T, ce += T;
144
- }), ne;
142
+ const G = i[I.id] || (typeof I.size == "number" ? I.size : O), V = I.minSize || ge;
143
+ let E;
144
+ Y === M.length - 1 ? E = k - ie : E = Math.round(G * q), E = Math.max(V, E), re[I.id] = E, ie += E;
145
+ }), re;
145
146
  }
146
- function Pn(g, p, y, a, C) {
147
- const v = g - C;
148
- if (Math.abs(v) < 1) return null;
149
- const M = p.filter((T) => T.id && T.id !== "select");
147
+ function jn(w, g, y, i, T) {
148
+ const C = w - T;
149
+ if (Math.abs(C) < 1) return null;
150
+ const M = g.filter((E) => E.id && E.id !== "select");
150
151
  if (M.length === 0) return null;
151
- const z = M[M.length - 1], k = z.id, ne = y.find((T) => T.internalName === k)?.typeAsString === "Note" ? O * 2 : O, I = (a[k] || (typeof z.size == "number" ? z.size : ne)) + v, Y = z.minSize || he, G = Math.max(Y, I), U = a[k];
152
- return U !== void 0 && Math.abs(U - G) < 1 ? null : { [k]: G };
152
+ const z = M[M.length - 1], k = z.id, re = y.find((E) => E.internalName === k)?.typeAsString === "Note" ? O * 2 : O, I = (i[k] || (typeof z.size == "number" ? z.size : re)) + C, Y = z.minSize || ge, G = Math.max(Y, I), V = i[k];
153
+ return V !== void 0 && Math.abs(V - G) < 1 ? null : { [k]: G };
153
154
  }
154
- const ls = ({
155
- appearance: g = "outline",
156
- style: p = de,
155
+ const ds = ({
156
+ appearance: w = "outline",
157
+ style: g = me,
157
158
  className: y = "",
158
- fields: a,
159
- localeText: C,
160
- items: v,
159
+ fields: i,
160
+ localeText: T,
161
+ items: C,
161
162
  defaultItems: M,
162
163
  height: z,
163
164
  itemSize: k,
164
165
  dense: q = !0,
165
- rowAnimationConfig: ne = Wr,
166
- cellLineClamp: ce,
166
+ rowAnimationConfig: re = Dr,
167
+ cellLineClamp: ie,
167
168
  // tableStyle = 'row',
168
169
  enableSelection: I = !0,
169
170
  enableCommandBar: Y = !0,
170
- defaultSelectedItems: G = _r,
171
- onSelectionChange: U,
172
- onRowClick: T,
173
- onRowDoubleClick: He,
174
- resizableColumns: je = !1,
175
- columnConfig: P = de,
176
- useVirtualization: lt = !1,
177
- autoSizeColumns: ie = !1,
178
- tableRef: jn,
179
- onItemsChange: at,
180
- onScroll: ut,
181
- onScrollEnd: dt,
182
- scrollEndThreshold: ft = Dn,
183
- loadingMore: pe = !1,
184
- addButtonConfig: Un = de,
185
- updateButtonConfig: Vn = de,
186
- deleteButtonConfig: $n = de,
187
- filterButtonConfig: qn = de,
188
- alwaysButtons: mt = Be,
189
- noSelectionButtons: Yn = Be,
190
- singleSelectionButtons: ht = Be,
191
- multiSelectionButtons: pt = Be,
192
- beforeAddItems: gt,
193
- beforeUpdateItems: St,
194
- beforeDeleteItems: wt,
195
- defaultSorting: Gn,
196
- onSortChange: Ue,
197
- onFilterChange: Ve,
198
- columnRenderers: Kn,
199
- useDefaultRendererAsFallback: xt = !0,
171
+ defaultSelectedItems: G = Br,
172
+ onSelectionChange: V,
173
+ onRowClick: E,
174
+ onRowDoubleClick: Ve,
175
+ resizableColumns: Ue = !1,
176
+ columnConfig: P = me,
177
+ useVirtualization: ut = !1,
178
+ autoSizeColumns: le = !1,
179
+ tableRef: Un,
180
+ onItemsChange: dt,
181
+ onScroll: ft,
182
+ onScrollEnd: mt,
183
+ scrollEndThreshold: ht = Pn,
184
+ loadingMore: Se = !1,
185
+ addButtonConfig: $n = me,
186
+ updateButtonConfig: qn = me,
187
+ deleteButtonConfig: Yn = me,
188
+ filterButtonConfig: Gn = me,
189
+ alwaysButtons: pt = Oe,
190
+ noSelectionButtons: Kn = Oe,
191
+ singleSelectionButtons: gt = Oe,
192
+ multiSelectionButtons: St = Oe,
193
+ beforeAddItems: wt,
194
+ beforeUpdateItems: xt,
195
+ beforeDeleteItems: It,
196
+ defaultSorting: Xn,
197
+ onSortChange: $e,
198
+ onFilterChange: qe,
199
+ columnRenderers: Jn,
200
+ useDefaultRendererAsFallback: bt = !0,
200
201
  // Overlay state props
201
- overlayState: It,
202
- defaultOverlayState: Xn,
202
+ overlayState: yt,
203
+ defaultOverlayState: Zn,
203
204
  onOverlayStateChange: j,
204
- overlayCustomization: le,
205
- overlayHeight: $e = 200
205
+ overlayCustomization: ae,
206
+ overlayHeight: Ye = 200
206
207
  }) => {
207
- const bt = se(() => {
208
+ const Rt = ce(() => {
208
209
  const {
209
210
  form: e,
210
211
  fields: t,
211
212
  buttons: n,
212
213
  ...r
213
- } = C ?? {}, o = Object.keys(r).length > 0 ? r : void 0, c = e || t || n ? {
214
+ } = T ?? {}, s = Object.keys(r).length > 0 ? r : void 0, c = e || t || n ? {
214
215
  ...e ? { form: e } : {},
215
216
  ...t ? { fields: t } : {},
216
217
  ...n ? { buttons: n } : {}
217
218
  } : void 0;
218
219
  return {
219
- tableOverrides: o,
220
+ tableOverrides: s,
220
221
  i18nProviderLocale: c
221
222
  };
222
- }, [C]), W = Mr(bt.tableOverrides), yt = bt.i18nProviderLocale, Rt = Er(Kn);
223
- lt && z === void 0 && console.warn(
223
+ }, [T]), W = Nr(Rt.tableOverrides), vt = Rt.i18nProviderLocale, Ct = Fr(Jn);
224
+ ut && z === void 0 && console.warn(
224
225
  '[EFWTable] La prop "height" es requerida cuando "useVirtualization" está habilitado. La virtualización necesita una altura fija para calcular las filas visibles.'
225
226
  );
226
- const ge = z !== void 0 ? Y ? z - 40 : z : void 0, qe = k ?? (q ? 32 : 44), vt = jr(), Jn = wr(
227
+ const we = z !== void 0 ? Y ? z - 40 : z : void 0, Ge = k ?? (q ? 32 : 44), Tt = Ur(), Qn = Ir(
227
228
  y,
228
229
  "efw-table",
229
- vt["efw-table"]
230
- ), K = w(!1), Se = w(
230
+ Tt["efw-table"]
231
+ ), K = x(!1), xe = x(
231
232
  null
232
- ), we = w(null), Ye = v !== void 0, H = It !== void 0, [Zn, xe] = te(
233
- () => Xn || { state: "none" }
234
- ), Ne = H ? It : Zn, [Qn, er] = te(() => (M || Wn).map((t) => ({
233
+ ), Ie = x(null), Ke = C !== void 0, H = yt !== void 0, [er, be] = te(
234
+ () => Zn || { state: "none" }
235
+ ), Le = H ? yt : er, [tr, nr] = te(() => (M || Dn).map((t) => ({
235
236
  ...t,
236
- _rowId: t._rowId || it()
237
- }))), X = Ye ? v || Wn : Qn, Ct = w(/* @__PURE__ */ new WeakMap()), ke = f(
237
+ _rowId: t._rowId || at()
238
+ }))), X = Ke ? C || Dn : tr, Et = x(/* @__PURE__ */ new WeakMap()), _e = m(
238
239
  (e, t) => {
239
240
  if (e._rowId)
240
241
  return String(e._rowId);
241
- const n = Ct.current.get(e);
242
+ const n = Et.current.get(e);
242
243
  if (n)
243
244
  return n;
244
- const r = it();
245
- return Ct.current.set(e, r), r;
245
+ const r = at();
246
+ return Et.current.set(e, r), r;
246
247
  },
247
248
  []
248
- ), [L, Ie] = te(() => {
249
+ ), [L, ye] = te(() => {
249
250
  const e = {};
250
- return a.forEach((t) => {
251
+ return i.forEach((t) => {
251
252
  const n = P[t.internalName];
252
253
  if (n?.width) {
253
- const r = n.minWidth ?? he, o = n.maxWidth ?? Pe;
254
+ const r = n.minWidth ?? ge, s = n.maxWidth ?? je;
254
255
  e[t.internalName] = Math.min(
255
256
  Math.max(n.width ?? 0, r),
256
- o
257
+ s
257
258
  );
258
259
  }
259
260
  }), e;
260
- }), Tt = w(P), [J, Ge] = te(
261
- () => Bn(Gn ?? [])
262
- ), [Z, Ke] = te(
261
+ }), zt = x(P), [J, Xe] = te(
262
+ () => On(Xn ?? [])
263
+ ), [Z, Je] = te(
263
264
  []
264
- ), Et = w(Z);
265
- Et.current = Z;
266
- const [Q, zt] = te(0), [tr, nr] = te({}), Xe = w(ne);
267
- Xe.current = ne;
265
+ ), Ft = x(Z);
266
+ Ft.current = Z;
267
+ const [Q, Mt] = te(0), [rr, sr] = te({}), Ze = x(re);
268
+ Ze.current = re;
268
269
  const {
269
- rowSelection: ae,
270
- setRowSelection: Ft,
270
+ rowSelection: ue,
271
+ setRowSelection: At,
271
272
  // selectedIndexes,
272
- deselectAll: Mt,
273
- selectSingle: At,
274
- toggleMultiple: Nt,
273
+ deselectAll: Nt,
274
+ selectSingle: kt,
275
+ toggleMultiple: Lt,
275
276
  // selectMultiple,
276
- getSelectedItems: kt,
277
- getSelectedRows: Lt
278
- } = br({
277
+ getSelectedItems: _t,
278
+ getSelectedRows: Wt
279
+ } = Rr({
279
280
  initialSelection: G,
280
- onSelectionChange: U,
281
+ onSelectionChange: V,
281
282
  enableSelection: I,
282
283
  items: X,
283
- getRowId: ke
284
- }), re = w(null), ue = w(
284
+ getRowId: _e
285
+ }), se = x(null), de = x(
285
286
  null
286
- ), [Je, rr] = te(null), sr = f((e) => {
287
- re.current = e, rr(e);
288
- }, []), ee = f(() => {
289
- if (Qe.current && !be.current) {
290
- ue.current = null;
287
+ ), [Qe, or] = te(null), cr = m((e) => {
288
+ se.current = e, or(e);
289
+ }, []), ee = m(() => {
290
+ if (tt.current && !Re.current) {
291
+ de.current = null;
291
292
  return;
292
293
  }
293
- const e = re.current;
294
+ const e = se.current;
294
295
  if (!e) {
295
- ue.current = null;
296
+ de.current = null;
296
297
  return;
297
298
  }
298
- ue.current = {
299
+ de.current = {
299
300
  top: e.scrollTop,
300
301
  left: e.scrollLeft
301
302
  };
302
- }, []), Ze = f(
303
+ }, []), et = m(
303
304
  (e, t) => {
304
305
  e.scrollTop !== t.top && (e.scrollTop = t.top), e.scrollLeft !== t.left && (e.scrollLeft = t.left);
305
306
  },
306
307
  []
307
- ), A = f(
308
+ ), A = m(
308
309
  (e, t, n) => {
309
- !(n?.animateRows ?? (t === "add" ? Xe.current.addRows : Xe.current.updateRows)) || e.length === 0 || nr((o) => {
310
- const c = { ...o };
311
- return e.forEach(({ item: u }, s) => {
310
+ !(n?.animateRows ?? (t === "add" ? Ze.current.addRows : Ze.current.updateRows)) || e.length === 0 || sr((s) => {
311
+ const c = { ...s };
312
+ return e.forEach(({ item: u }, o) => {
312
313
  if (!u._rowId)
313
314
  return;
314
- const i = String(u._rowId);
315
- c[i] = {
316
- delay: s * Dr,
317
- token: (c[i]?.token ?? 0) + 1
315
+ const l = String(u._rowId);
316
+ c[l] = {
317
+ delay: o * Pr,
318
+ token: (c[l]?.token ?? 0) + 1
318
319
  };
319
320
  }), c;
320
321
  });
321
322
  },
322
323
  []
323
- ), R = w(X), Le = w(/* @__PURE__ */ new Map()), Qe = w(Ye);
324
- Qe.current = Ye;
325
- const be = w(at);
326
- be.current = at;
327
- const ye = w(gt);
328
- ye.current = gt;
329
- const Re = w(St);
330
- Re.current = St;
331
- const ve = w(wt);
324
+ ), v = x(X), We = x(/* @__PURE__ */ new Map()), tt = x(Ke);
325
+ tt.current = Ke;
326
+ const Re = x(dt);
327
+ Re.current = dt;
328
+ const ve = x(wt);
332
329
  ve.current = wt;
333
- const _ = w(
330
+ const Ce = x(xt);
331
+ Ce.current = xt;
332
+ const Te = x(It);
333
+ Te.current = It;
334
+ const oe = x(i);
335
+ ne(() => {
336
+ oe.current = i;
337
+ }, [i]);
338
+ const _ = x(
334
339
  null
335
- ), _t = w(pe);
336
- _t.current = pe;
337
- const Wt = w(ut);
338
- Wt.current = ut;
339
- const et = w(dt);
340
- et.current = dt;
341
- const tt = w(ft);
342
- tt.current = ft, oe(() => {
343
- R.current = X;
340
+ ), Bt = x(Se);
341
+ Bt.current = Se;
342
+ const Dt = x(ft);
343
+ Dt.current = ft;
344
+ const nt = x(mt);
345
+ nt.current = mt;
346
+ const rt = x(ht);
347
+ rt.current = ht, ne(() => {
348
+ v.current = X;
344
349
  const e = /* @__PURE__ */ new Map();
345
350
  X.forEach((t, n) => {
346
351
  t._rowId && e.set(String(t._rowId), n);
347
- }), Le.current = e;
348
- }, [X]), kn(() => {
349
- const e = ue.current;
352
+ }), We.current = e;
353
+ }, [X]), _n(() => {
354
+ const e = de.current;
350
355
  if (!e)
351
356
  return;
352
- ue.current = null;
353
- const t = re.current;
357
+ de.current = null;
358
+ const t = se.current;
354
359
  if (!t)
355
360
  return;
356
- Ze(t, e);
361
+ et(t, e);
357
362
  const n = requestAnimationFrame(() => {
358
- const r = re.current;
359
- r && Ze(r, e);
363
+ const r = se.current;
364
+ r && et(r, e);
360
365
  });
361
366
  return () => {
362
367
  cancelAnimationFrame(n);
363
368
  };
364
- }, [X, Ze]);
365
- const nt = w(/* @__PURE__ */ new Set()), Ce = w(!1), Bt = w(0), Dt = w(0), Ot = w(!1);
366
- oe(() => {
367
- pe || (re.current?.scrollHeight ?? 0) > Dt.current && (Ce.current = !1);
368
- }, [pe]);
369
- const Pt = se(() => {
369
+ }, [X, et]);
370
+ const st = x(/* @__PURE__ */ new Set()), Ee = x(!1), Ot = x(0), Pt = x(0), Ht = x(!1);
371
+ ne(() => {
372
+ Se || (se.current?.scrollHeight ?? 0) > Pt.current && (Ee.current = !1);
373
+ }, [Se]);
374
+ const jt = ce(() => {
370
375
  const e = [], t = {};
371
376
  let n = 0;
372
- return I && (e.push("select"), t.select = n, n += Ae), a.forEach((r) => {
373
- const o = P[r.internalName] || {};
374
- if (!o.hidden && o.sticky) {
377
+ return I && (e.push("select"), t.select = n, n += ke), i.forEach((r) => {
378
+ const s = P[r.internalName] || {};
379
+ if (!s.hidden && s.sticky) {
375
380
  e.push(r.internalName), t[r.internalName] = n;
376
- const c = L[r.internalName] || o.width || O;
381
+ const c = L[r.internalName] || s.width || O;
377
382
  n += c;
378
383
  }
379
384
  }), { stickyColumns: e, stickyPositions: t };
380
- }, [a, I, P, L]), B = se(() => {
385
+ }, [i, I, P, L]), B = ce(() => {
381
386
  const e = [];
382
387
  return I && e.push({
383
388
  id: "select",
384
- header: ({ table: t }) => /* @__PURE__ */ D(Pr, { table: t, dense: q }),
389
+ header: ({ table: t }) => /* @__PURE__ */ D(jr, { table: t, dense: q }),
385
390
  cell: ({ row: t }) => /* @__PURE__ */ D(
386
- Hr,
391
+ Vr,
387
392
  {
388
393
  row: t,
389
- toggleMultiple: Nt,
394
+ toggleMultiple: Lt,
390
395
  dense: q
391
396
  }
392
397
  ),
393
- size: Ae,
394
- minSize: Ae,
395
- maxSize: Ae,
398
+ size: ke,
399
+ minSize: ke,
400
+ maxSize: ke,
396
401
  enableResizing: !1
397
- }), a.forEach((t) => {
402
+ }), i.forEach((t) => {
398
403
  const n = P[t.internalName] || {};
399
404
  if (n.hidden)
400
405
  return;
401
- const r = t.typeAsString === "Note" ? O * 2 : O, o = n.width || r, c = n.minWidth || he, u = n.maxWidth || Pe;
406
+ const r = t.typeAsString === "Note" ? O * 2 : O, s = n.width || r, c = n.minWidth || ge, u = n.maxWidth || je;
402
407
  e.push({
403
408
  id: t.internalName,
404
409
  accessorKey: t.internalName,
405
410
  header: t.title || t.internalName,
406
- cell: ({ row: s }) => yr(
411
+ cell: ({ row: o }) => vr(
407
412
  t,
408
- s.original[t.internalName],
409
- s.original,
410
- s.index,
411
- Rt,
412
- xt
413
+ o.original[t.internalName],
414
+ o.original,
415
+ o.index,
416
+ Ct,
417
+ bt
413
418
  ),
414
- size: Math.min(Math.max(o, c), u),
419
+ size: Math.min(Math.max(s, c), u),
415
420
  minSize: c,
416
421
  maxSize: u,
417
- enableResizing: je,
422
+ enableResizing: Ue,
418
423
  enableSorting: n.sortable !== !1,
419
- sortingFn: Or(t.typeAsString),
420
- filterFn: zr(t.typeAsString),
424
+ sortingFn: Hr(t.typeAsString),
425
+ filterFn: Mr(t.typeAsString),
421
426
  meta: {
422
427
  typeAsString: t.typeAsString,
423
- cellLineClamp: n.cellLineClamp ?? ce
428
+ cellLineClamp: n.cellLineClamp ?? ie
424
429
  }
425
430
  });
426
431
  }), e;
427
432
  }, [
428
- a,
433
+ i,
429
434
  I,
430
- je,
435
+ Ue,
431
436
  P,
432
- ce,
433
- Rt,
434
- xt,
435
- Nt
437
+ ie,
438
+ Ct,
439
+ bt,
440
+ Lt
436
441
  ]);
437
- oe(() => {
438
- const e = Tt.current;
439
- Ie((t) => {
442
+ ne(() => {
443
+ const e = zt.current;
444
+ ye((t) => {
440
445
  let n = !1;
441
- const r = { ...t }, o = new Set(a.map((c) => c.internalName));
446
+ const r = { ...t }, s = new Set(i.map((c) => c.internalName));
442
447
  return Object.keys(r).forEach((c) => {
443
- o.has(c) || (delete r[c], n = !0);
444
- }), a.forEach((c) => {
445
- const u = c.internalName, s = P[u], i = e[u];
446
- if (s?.width !== void 0) {
447
- const S = s.minWidth ?? he, x = s.maxWidth ?? Pe, l = Math.min(
448
- Math.max(s.width, S),
449
- x
448
+ s.has(c) || (delete r[c], n = !0);
449
+ }), i.forEach((c) => {
450
+ const u = c.internalName, o = P[u], l = e[u];
451
+ if (o?.width !== void 0) {
452
+ const p = o.minWidth ?? ge, h = o.maxWidth ?? je, d = Math.min(
453
+ Math.max(o.width, p),
454
+ h
450
455
  );
451
- r[u] !== l && (r[u] = l, n = !0);
452
- } else i?.width !== void 0 && r[u] !== void 0 && (delete r[u], n = !0);
456
+ r[u] !== d && (r[u] = d, n = !0);
457
+ } else l?.width !== void 0 && r[u] !== void 0 && (delete r[u], n = !0);
453
458
  }), n ? r : t;
454
- }), Tt.current = P;
455
- }, [P, a]);
456
- const Te = se(() => B.reduce((e, t) => {
457
- const r = a.find((c) => c.internalName === t.id)?.typeAsString === "Note" ? O * 2 : O, o = L[t.id] || (typeof t.size == "number" ? t.size : r);
458
- return e + o;
459
- }, 0), [B, L, a]), or = se(
460
- () => Math.max(Te, Q || 0, 300),
461
- [Te, Q]
462
- ), Ee = w(Ue);
463
- Ee.current = Ue;
464
- const ze = w(Ve);
465
- ze.current = Ve;
466
- const rt = mr({
459
+ }), zt.current = P;
460
+ }, [P, i]);
461
+ const ze = ce(() => B.reduce((e, t) => {
462
+ const r = i.find((c) => c.internalName === t.id)?.typeAsString === "Note" ? O * 2 : O, s = L[t.id] || (typeof t.size == "number" ? t.size : r);
463
+ return e + s;
464
+ }, 0), [B, L, i]), ir = ce(
465
+ () => Math.max(ze, Q || 0, 300),
466
+ [ze, Q]
467
+ ), Fe = x($e);
468
+ Fe.current = $e;
469
+ const Me = x(qe);
470
+ Me.current = qe;
471
+ const ot = pr({
467
472
  data: X,
468
473
  columns: B,
469
474
  state: {
470
- rowSelection: ae,
475
+ rowSelection: ue,
471
476
  columnSizing: L,
472
477
  sorting: J,
473
478
  columnFilters: Z
474
479
  },
475
- onRowSelectionChange: Ft,
480
+ onRowSelectionChange: At,
476
481
  onSortingChange: (e) => {
477
482
  const t = typeof e == "function" ? e(J) : e;
478
- Ge(t), Ee.current && Ee.current(
479
- Me(t),
483
+ Xe(t), Fe.current && Fe.current(
484
+ Ne(t),
480
485
  _.current
481
486
  );
482
487
  },
483
488
  onColumnFiltersChange: (e) => {
484
- const t = typeof e == "function" ? e(Et.current) : e;
485
- Ke(t), ze.current && ze.current(
486
- Oe(t),
489
+ const t = typeof e == "function" ? e(Ft.current) : e;
490
+ Je(t), Me.current && Me.current(
491
+ He(t),
487
492
  _.current
488
493
  );
489
494
  },
490
495
  onColumnSizingChange: (e) => {
491
- Ie((t) => {
496
+ ye((t) => {
492
497
  const n = typeof e == "function" ? e(t) : e, r = {};
493
- return Object.keys(n).forEach((o) => {
494
- const c = B.find((u) => u.id === o);
498
+ return Object.keys(n).forEach((s) => {
499
+ const c = B.find((u) => u.id === s);
495
500
  if (c) {
496
- const u = c.minSize || he, s = c.maxSize || Pe;
497
- K.current ? r[o] = Math.max(n[o], u) : r[o] = Math.min(
498
- Math.max(n[o], u),
499
- s
501
+ const u = c.minSize || ge, o = c.maxSize || je;
502
+ K.current ? r[s] = Math.max(n[s], u) : r[s] = Math.min(
503
+ Math.max(n[s], u),
504
+ o
500
505
  );
501
506
  }
502
507
  }), { ...t, ...r };
503
508
  });
504
509
  },
505
- getRowId: (e, t) => ke(e, t),
506
- getCoreRowModel: gr(),
507
- getFilteredRowModel: pr(),
508
- getSortedRowModel: hr(),
509
- manualSorting: !!Ue,
510
- manualFiltering: !!Ve,
510
+ getRowId: (e, t) => _e(e, t),
511
+ getCoreRowModel: wr(),
512
+ getFilteredRowModel: Sr(),
513
+ getSortedRowModel: gr(),
514
+ manualSorting: !!$e,
515
+ manualFiltering: !!qe,
511
516
  columnResizeMode: "onChange",
512
517
  enableRowSelection: !0,
513
518
  enableMultiRowSelection: I
514
519
  });
515
- oe(() => {
520
+ ne(() => {
516
521
  const e = /* @__PURE__ */ new Set();
517
- Object.keys(ae).forEach((t) => {
518
- ae[t] && e.add(t);
519
- }), nt.current = e;
520
- }, [ae]);
521
- const cr = f(
522
+ Object.keys(ue).forEach((t) => {
523
+ ue[t] && e.add(t);
524
+ }), st.current = e;
525
+ }, [ue]);
526
+ const lr = m(
522
527
  (e) => {
523
- if (Wt.current?.(e), !et.current || _t.current)
528
+ if (Dt.current?.(e), !nt.current || Bt.current)
524
529
  return;
525
- const t = e.currentTarget, n = Number.isFinite(tt.current) ? Math.max(0, tt.current) : Dn, { scrollTop: r, scrollHeight: o, clientHeight: c } = t, s = o - r - c <= n, i = Bt.current;
526
- if (Bt.current = o, o > i && !s) {
527
- Ce.current = !1;
530
+ const t = e.currentTarget, n = Number.isFinite(rt.current) ? Math.max(0, rt.current) : Pn, { scrollTop: r, scrollHeight: s, clientHeight: c } = t, o = s - r - c <= n, l = Ot.current;
531
+ if (Ot.current = s, s > l && !o) {
532
+ Ee.current = !1;
528
533
  return;
529
534
  }
530
- if (!s) {
531
- Ce.current = !1;
535
+ if (!o) {
536
+ Ee.current = !1;
532
537
  return;
533
538
  }
534
- Ce.current || (Ce.current = !0, Dt.current = o, et.current());
539
+ Ee.current || (Ee.current = !0, Pt.current = s, nt.current());
535
540
  },
536
541
  []
537
- ), Ht = (e) => {
538
- const t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), o = new Set(
539
- Object.keys(ae).filter((s) => ae[s])
542
+ ), Vt = (e) => {
543
+ const t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), s = new Set(
544
+ Object.keys(ue).filter((o) => ue[o])
540
545
  ), c = e.map(
541
- (s, i) => s ? ke(s, i) : ""
546
+ (o, l) => o ? _e(o, l) : ""
542
547
  ), u = new Set(c.filter(Boolean));
543
- return e.forEach((s, i) => {
544
- if (!s)
548
+ return e.forEach((o, l) => {
549
+ if (!o)
545
550
  return;
546
- const S = c[i], x = o.has(S), l = i.toString(), m = !u.has(l) && o.has(l);
547
- !x && !m || (r.add(i), t.add(S), n.add(s));
551
+ const p = c[l], h = s.has(p), d = l.toString(), S = !u.has(d) && s.has(d);
552
+ !h && !S || (r.add(l), t.add(p), n.add(o));
548
553
  }), {
549
554
  hasSelection: t.size > 0 || n.size > 0 || r.size > 0,
550
555
  selectedIds: t,
@@ -552,126 +557,134 @@ const ls = ({
552
557
  selectedIndexes: r,
553
558
  sourceLength: e.length
554
559
  };
555
- }, jt = (e, t) => {
560
+ }, Ut = (e, t) => {
556
561
  if (!t.hasSelection)
557
562
  return;
558
563
  const n = t.sourceLength !== e.length, r = {};
559
- e.forEach((o, c) => {
560
- if (!o)
564
+ e.forEach((s, c) => {
565
+ if (!s)
561
566
  return;
562
- const u = ke(o, c), s = t.selectedIds.has(u), i = t.selectedRefs.has(o), S = !n && t.selectedIndexes.has(c);
563
- (s || i || S) && (r[u] = !0);
564
- }), Ft(r);
565
- }, b = f(
567
+ const u = _e(s, c), o = t.selectedIds.has(u), l = t.selectedRefs.has(s), p = !n && t.selectedIndexes.has(c);
568
+ (o || l || p) && (r[u] = !0);
569
+ }), At(r);
570
+ }, b = m(
566
571
  (e) => {
567
- if (Qe.current) {
568
- if (!be.current)
569
- return ue.current = null, Ot.current || (console.warn(
572
+ if (tt.current) {
573
+ if (!Re.current)
574
+ return de.current = null, Ht.current || (console.warn(
570
575
  "[EFWTable] Modo controlled detectado sin onItemsChange. Las operaciones CRUD locales no se aplicarán."
571
- ), Ot.current = !0), !1;
572
- const t = R.current, n = typeof e == "function" ? e(t) : e;
573
- R.current = n;
574
- const r = Ht(t);
575
- return nt.current = r.selectedIds, jt(n, r), be.current(n), !0;
576
+ ), Ht.current = !0), !1;
577
+ const t = v.current, n = typeof e == "function" ? e(t) : e;
578
+ v.current = n;
579
+ const r = Vt(t);
580
+ return st.current = r.selectedIds, Ut(n, r), Re.current(n), !0;
576
581
  }
577
- return er((t) => {
582
+ return nr((t) => {
578
583
  const n = typeof e == "function" ? e(t) : e;
579
- R.current = n;
580
- const r = Ht(t);
581
- return nt.current = r.selectedIds, jt(n, r), be.current?.(n), n;
584
+ v.current = n;
585
+ const r = Vt(t);
586
+ return st.current = r.selectedIds, Ut(n, r), Re.current?.(n), n;
582
587
  }), !0;
583
588
  },
584
589
  []
585
- ), Ut = f(() => a, [a]), Vt = f(() => Me(J), [J]), $t = f(() => Me(J)[0] ?? null, [J]), qt = f(() => J.length > 0, [J]), Yt = f((e) => {
586
- const t = Bn(e);
587
- Ge(t), Ee.current?.(
588
- Me(t),
590
+ ), $t = m(() => i, [i]), qt = m(() => Ne(J), [J]), Yt = m(() => Ne(J)[0] ?? null, [J]), Gt = m(() => J.length > 0, [J]), Kt = m((e) => {
591
+ const t = On(e);
592
+ Xe(t), Fe.current?.(
593
+ Ne(t),
589
594
  _.current
590
595
  );
591
- }, []), Gt = f(() => {
596
+ }, []), Xt = m(() => {
592
597
  const e = [];
593
- Ge(e), Ee.current?.(
594
- Me(e),
598
+ Xe(e), Fe.current?.(
599
+ Ne(e),
595
600
  _.current
596
601
  );
597
- }, []), Kt = f(() => a.filter(
602
+ }, []), Jt = m(() => i.filter(
598
603
  (e) => e.typeAsString !== "Attachments" && P?.[e.internalName]?.filterable !== !1
599
- ), [a, P]), Xt = f(() => Oe(Z), [Z]), Jt = f(() => Z.length > 0, [Z]), Zt = f((e) => {
600
- const t = Br(e);
601
- Ke(t), ze.current?.(
602
- Oe(t),
604
+ ), [i, P]), Zt = m(() => He(Z), [Z]), Qt = m(() => Z.length > 0, [Z]), en = m((e) => {
605
+ const t = Or(e);
606
+ Je(t), Me.current?.(
607
+ He(t),
603
608
  _.current
604
609
  );
605
- }, []), Qt = f(() => {
610
+ }, []), tn = m(() => {
606
611
  const e = [];
607
- Ke(e), ze.current?.(
608
- Oe(e),
612
+ Je(e), Me.current?.(
613
+ He(e),
609
614
  _.current
610
615
  );
611
- }, []), en = f(
616
+ }, []), nn = m(
612
617
  async (e, t = {}) => {
613
618
  const { position: n = "end" } = t;
614
619
  try {
615
- if (ye.current) {
616
- const r = We(e), o = await ye.current(
620
+ if (ve.current) {
621
+ const r = De(e), s = await ve.current(
617
622
  [r],
618
623
  _.current
619
624
  );
620
- if (o) {
621
- if (o.successful.length > 0) {
622
- const i = R.current.length, S = o.successful.map(
623
- (m) => Ln(m.item)
625
+ if (s) {
626
+ if (s.successful.length > 0) {
627
+ const p = v.current.length, h = s.successful.map(
628
+ (a) => fe(
629
+ oe.current,
630
+ Wn(a.item)
631
+ )
624
632
  );
625
633
  if (ee(), !b(
626
- (m) => fe(m, S, n)
634
+ (a) => he(a, h, n)
627
635
  ))
628
636
  return {
629
637
  successful: [],
630
- failed: S.map((m, h) => ({
631
- index: h,
632
- item: m,
638
+ failed: h.map((a, R) => ({
639
+ index: R,
640
+ item: a,
633
641
  error: "Controlled mode without onItemsChange"
634
642
  }))
635
643
  };
636
- const l = me(
637
- S,
638
- i,
644
+ const S = pe(
645
+ h,
646
+ p,
639
647
  n
640
648
  );
641
- return A(l, "add", t), {
642
- ...o,
643
- successful: l
649
+ return A(S, "add", t), {
650
+ ...s,
651
+ successful: S
644
652
  };
645
653
  }
646
- return { ...o, successful: [] };
654
+ return { ...s, successful: [] };
647
655
  }
648
- const c = R.current.length;
656
+ const c = fe(
657
+ oe.current,
658
+ r
659
+ ), u = v.current.length;
649
660
  if (ee(), !b(
650
- (i) => fe(i, [r], n)
661
+ (p) => he(p, [c], n)
651
662
  ))
652
663
  return {
653
664
  successful: [],
654
665
  failed: [
655
666
  {
656
667
  index: -1,
657
- item: r,
668
+ item: c,
658
669
  error: "Controlled mode without onItemsChange"
659
670
  }
660
671
  ]
661
672
  };
662
- const s = me(
663
- [r],
664
- c,
673
+ const l = pe(
674
+ [c],
675
+ u,
665
676
  n
666
677
  );
667
- return A(s, "add", t), {
668
- successful: s,
678
+ return A(l, "add", t), {
679
+ successful: l,
669
680
  failed: []
670
681
  };
671
682
  } else {
672
- const r = We(e), o = R.current.length;
683
+ const r = De(
684
+ fe(oe.current, e)
685
+ ), s = v.current.length;
673
686
  if (ee(), !b(
674
- (s) => fe(s, [r], n)
687
+ (o) => he(o, [r], n)
675
688
  ))
676
689
  return {
677
690
  successful: [],
@@ -683,9 +696,9 @@ const ls = ({
683
696
  }
684
697
  ]
685
698
  };
686
- const u = me(
699
+ const u = pe(
687
700
  [r],
688
- o,
701
+ s,
689
702
  n
690
703
  );
691
704
  return A(u, "add", t), {
@@ -707,7 +720,7 @@ const ls = ({
707
720
  }
708
721
  },
709
722
  [b, ee, A]
710
- ), tn = f(
723
+ ), rn = m(
711
724
  async (e, t = {}) => {
712
725
  const { position: n = "end" } = t;
713
726
  if (e.length === 0)
@@ -716,80 +729,87 @@ const ls = ({
716
729
  failed: []
717
730
  };
718
731
  try {
719
- if (ye.current) {
732
+ if (ve.current) {
720
733
  const r = e.map(
721
- (i) => We(i)
722
- ), o = await ye.current(
734
+ (p) => De(p)
735
+ ), s = await ve.current(
723
736
  r,
724
737
  _.current
725
738
  );
726
- if (o) {
727
- if (o.successful.length > 0) {
728
- const i = R.current.length, S = o.successful.map(
729
- (m) => Ln(m.item)
739
+ if (s) {
740
+ if (s.successful.length > 0) {
741
+ const p = v.current.length, h = s.successful.map(
742
+ (a) => fe(
743
+ oe.current,
744
+ Wn(a.item)
745
+ )
730
746
  );
731
747
  if (ee(), !b(
732
- (m) => fe(m, S, n)
748
+ (a) => he(a, h, n)
733
749
  ))
734
750
  return {
735
751
  successful: [],
736
- failed: S.map((m, h) => ({
737
- index: h,
738
- item: m,
752
+ failed: h.map((a, R) => ({
753
+ index: R,
754
+ item: a,
739
755
  error: "Controlled mode without onItemsChange"
740
756
  }))
741
757
  };
742
- const l = me(
743
- S,
744
- i,
758
+ const S = pe(
759
+ h,
760
+ p,
745
761
  n
746
762
  );
747
- return A(l, "add", t), {
748
- ...o,
749
- successful: l
763
+ return A(S, "add", t), {
764
+ ...s,
765
+ successful: S
750
766
  };
751
767
  }
752
- return { ...o, successful: [] };
768
+ return { ...s, successful: [] };
753
769
  }
754
- const c = R.current.length;
770
+ const c = r.map(
771
+ (p) => fe(oe.current, p)
772
+ ), u = v.current.length;
755
773
  if (ee(), !b(
756
- (i) => fe(i, r, n)
774
+ (p) => he(p, c, n)
757
775
  ))
758
776
  return {
759
777
  successful: [],
760
- failed: r.map((i, S) => ({
761
- index: S,
762
- item: i,
778
+ failed: c.map((p, h) => ({
779
+ index: h,
780
+ item: p,
763
781
  error: "Controlled mode without onItemsChange"
764
782
  }))
765
783
  };
766
- const s = me(
767
- r,
784
+ const l = pe(
768
785
  c,
786
+ u,
769
787
  n
770
788
  );
771
- return A(s, "add", t), {
772
- successful: s,
789
+ return A(l, "add", t), {
790
+ successful: l,
773
791
  failed: []
774
792
  };
775
793
  } else {
776
794
  const r = e.map(
777
- (s) => We(s)
778
- ), o = R.current.length;
795
+ (o) => De(
796
+ fe(oe.current, o)
797
+ )
798
+ ), s = v.current.length;
779
799
  if (ee(), !b(
780
- (s) => fe(s, r, n)
800
+ (o) => he(o, r, n)
781
801
  ))
782
802
  return {
783
803
  successful: [],
784
- failed: r.map((s, i) => ({
785
- index: i,
786
- item: s,
804
+ failed: r.map((o, l) => ({
805
+ index: l,
806
+ item: o,
787
807
  error: "Controlled mode without onItemsChange"
788
808
  }))
789
809
  };
790
- const u = me(
810
+ const u = pe(
791
811
  r,
792
- o,
812
+ s,
793
813
  n
794
814
  );
795
815
  return A(u, "add", t), {
@@ -800,79 +820,79 @@ const ls = ({
800
820
  } catch (r) {
801
821
  return {
802
822
  successful: [],
803
- failed: e.map((o, c) => ({
823
+ failed: e.map((s, c) => ({
804
824
  index: c,
805
- item: o,
825
+ item: s,
806
826
  error: String(r)
807
827
  }))
808
828
  };
809
829
  }
810
830
  },
811
831
  [b, ee, A]
812
- ), nn = f(
832
+ ), sn = m(
813
833
  async (e, t, n = {}) => {
814
- const r = R.current;
834
+ const r = v.current;
815
835
  if (e < 0 || e >= r.length)
816
836
  return {
817
837
  successful: [],
818
838
  failed: [{ index: e, item: t, error: "Invalid index" }]
819
839
  };
820
840
  try {
821
- if (Re.current) {
822
- const s = await Re.current(
841
+ if (Ce.current) {
842
+ const o = await Ce.current(
823
843
  [{ index: e, item: t }],
824
844
  _.current
825
845
  );
826
- if (s) {
827
- const S = s.successful.filter(
828
- ({ index: h }) => h >= 0 && h < r.length
829
- ).map(({ index: h, item: E }) => {
830
- const V = sn(
846
+ if (o) {
847
+ const p = o.successful.filter(
848
+ ({ index: a }) => a >= 0 && a < r.length
849
+ ).map(({ index: a, item: R }) => {
850
+ const U = cn(
831
851
  r,
832
- h,
833
- E,
834
- h === e ? t : void 0
852
+ a,
853
+ R,
854
+ a === e ? t : void 0
835
855
  );
836
- return V ? { index: h, item: V } : null;
856
+ return U ? { index: a, item: U } : null;
837
857
  }).filter(
838
- (h) => h !== null
858
+ (a) => a !== null
839
859
  );
840
- if (S.length) {
841
- if (!b((E) => {
842
- const V = [...E];
843
- return S.forEach(({ index: d, item: N }) => {
844
- V[d] = N;
845
- }), V;
860
+ if (p.length) {
861
+ if (!b((R) => {
862
+ const U = [...R];
863
+ return p.forEach(({ index: f, item: N }) => {
864
+ U[f] = N;
865
+ }), U;
846
866
  }))
847
867
  return {
848
868
  successful: [],
849
- failed: S.map(({ index: E, item: V }) => ({
850
- index: E,
851
- item: V,
869
+ failed: p.map(({ index: R, item: U }) => ({
870
+ index: R,
871
+ item: U,
852
872
  error: "Controlled mode without onItemsChange"
853
873
  }))
854
874
  };
855
- A(S, "update", n);
875
+ A(p, "update", n);
856
876
  }
857
- const x = new Set(
858
- s.failed.map((h) => h.index)
859
- ), l = [...s.failed];
860
- return s.successful.filter(
861
- ({ index: h }) => h < 0 || h >= r.length
862
- ).map(({ index: h, item: E }) => ({
863
- index: h,
864
- item: E,
877
+ const h = new Set(
878
+ o.failed.map((a) => a.index)
879
+ ), d = [...o.failed];
880
+ return o.successful.filter(
881
+ ({ index: a }) => a < 0 || a >= r.length
882
+ ).map(({ index: a, item: R }) => ({
883
+ index: a,
884
+ item: R,
865
885
  error: "Invalid index"
866
- })).forEach((h) => {
867
- x.has(h.index) || l.push(h);
868
- }), { successful: S, failed: l };
886
+ })).forEach((a) => {
887
+ h.has(a.index) || d.push(a);
888
+ }), { successful: p, failed: d };
869
889
  }
870
890
  }
871
- let o;
872
- if (!b((s) => {
873
- o = { ...s[e], ...t };
874
- const i = [...s];
875
- return i[e] = o, i;
891
+ let s;
892
+ if (!b((o) => {
893
+ s = { ...o[e], ...t };
894
+ const l = [...o];
895
+ return l[e] = s, l;
876
896
  }))
877
897
  return {
878
898
  successful: [],
@@ -884,146 +904,146 @@ const ls = ({
884
904
  }
885
905
  ]
886
906
  };
887
- const u = [{ index: e, item: o }];
907
+ const u = [{ index: e, item: s }];
888
908
  return A(u, "update", n), { successful: u, failed: [] };
889
- } catch (o) {
909
+ } catch (s) {
890
910
  return {
891
911
  successful: [],
892
- failed: [{ index: e, item: t, error: String(o) }]
912
+ failed: [{ index: e, item: t, error: String(s) }]
893
913
  };
894
914
  }
895
915
  },
896
916
  [b, A]
897
- ), rn = f(
917
+ ), on = m(
898
918
  async (e, t = {}) => {
899
919
  if (!e.length) return { successful: [], failed: [] };
900
- const n = R.current, r = (s) => s >= 0 && s < n.length, o = e.filter(({ index: s }) => !r(s)).map(({ index: s, item: i }) => ({ index: s, item: i, error: "Invalid index" })), c = e.filter(
901
- ({ index: s }) => r(s)
920
+ const n = v.current, r = (o) => o >= 0 && o < n.length, s = e.filter(({ index: o }) => !r(o)).map(({ index: o, item: l }) => ({ index: o, item: l, error: "Invalid index" })), c = e.filter(
921
+ ({ index: o }) => r(o)
902
922
  ), u = /* @__PURE__ */ new Map();
903
- c.forEach(({ index: s, item: i }) => {
904
- u.set(s, i);
923
+ c.forEach(({ index: o, item: l }) => {
924
+ u.set(o, l);
905
925
  });
906
926
  try {
907
- if (Re.current) {
908
- const x = await Re.current(
927
+ if (Ce.current) {
928
+ const h = await Ce.current(
909
929
  e,
910
930
  _.current
911
931
  );
912
- if (x) {
913
- const m = x.successful.filter(
914
- ({ index: d }) => r(d)
915
- ).map(({ index: d, item: N }) => {
916
- const F = sn(
932
+ if (h) {
933
+ const S = h.successful.filter(
934
+ ({ index: f }) => r(f)
935
+ ).map(({ index: f, item: N }) => {
936
+ const F = cn(
917
937
  n,
918
- d,
938
+ f,
919
939
  N,
920
- u.get(d)
940
+ u.get(f)
921
941
  );
922
- return F ? { index: d, item: F } : null;
942
+ return F ? { index: f, item: F } : null;
923
943
  }).filter(
924
- (d) => d !== null
944
+ (f) => f !== null
925
945
  );
926
- if (m.length) {
946
+ if (S.length) {
927
947
  if (!b((N) => {
928
948
  const F = [...N];
929
- return m.forEach(({ index: Nn, item: ot }) => {
930
- F[Nn] = ot;
949
+ return S.forEach(({ index: Ln, item: it }) => {
950
+ F[Ln] = it;
931
951
  }), F;
932
952
  }))
933
953
  return {
934
954
  successful: [],
935
- failed: m.map(({ index: N, item: F }) => ({
955
+ failed: S.map(({ index: N, item: F }) => ({
936
956
  index: N,
937
957
  item: F,
938
958
  error: "Controlled mode without onItemsChange"
939
959
  }))
940
960
  };
941
- A(m, "update", t);
961
+ A(S, "update", t);
942
962
  }
943
- const h = new Set(x.failed.map((d) => d.index)), E = [...x.failed];
944
- return o.forEach((d) => {
945
- h.has(d.index) || E.push(d);
946
- }), x.successful.filter(({ index: d }) => !r(d)).map(({ index: d, item: N }) => ({
947
- index: d,
963
+ const a = new Set(h.failed.map((f) => f.index)), R = [...h.failed];
964
+ return s.forEach((f) => {
965
+ a.has(f.index) || R.push(f);
966
+ }), h.successful.filter(({ index: f }) => !r(f)).map(({ index: f, item: N }) => ({
967
+ index: f,
948
968
  item: N,
949
969
  error: "Invalid index"
950
- })).forEach((d) => {
951
- h.has(d.index) || E.push(d);
952
- }), { successful: m, failed: E };
970
+ })).forEach((f) => {
971
+ a.has(f.index) || R.push(f);
972
+ }), { successful: S, failed: R };
953
973
  }
954
974
  }
955
- const s = [], i = [...o];
956
- return b((x) => {
957
- const l = [...x];
958
- return c.forEach(({ index: m, item: h }) => {
959
- l[m] = { ...l[m], ...h }, s.push({ index: m, item: l[m] });
960
- }), l;
961
- }) ? (A(s, "update", t), { successful: s, failed: i }) : {
975
+ const o = [], l = [...s];
976
+ return b((h) => {
977
+ const d = [...h];
978
+ return c.forEach(({ index: S, item: a }) => {
979
+ d[S] = { ...d[S], ...a }, o.push({ index: S, item: d[S] });
980
+ }), d;
981
+ }) ? (A(o, "update", t), { successful: o, failed: l }) : {
962
982
  successful: [],
963
- failed: c.map(({ index: x, item: l }) => ({
964
- index: x,
965
- item: l,
983
+ failed: c.map(({ index: h, item: d }) => ({
984
+ index: h,
985
+ item: d,
966
986
  error: "Controlled mode without onItemsChange"
967
987
  }))
968
988
  };
969
- } catch (s) {
989
+ } catch (o) {
970
990
  return {
971
991
  successful: [],
972
- failed: e.map(({ index: i, item: S }) => ({
973
- index: i,
974
- item: S,
975
- error: String(s)
992
+ failed: e.map(({ index: l, item: p }) => ({
993
+ index: l,
994
+ item: p,
995
+ error: String(o)
976
996
  }))
977
997
  };
978
998
  }
979
999
  },
980
1000
  [b, A]
981
- ), sn = (e, t, n, r) => {
982
- const o = e[t];
983
- if (!o)
1001
+ ), cn = (e, t, n, r) => {
1002
+ const s = e[t];
1003
+ if (!s)
984
1004
  return null;
985
1005
  const c = n ?? r;
986
1006
  return c ? {
987
- ...o,
1007
+ ...s,
988
1008
  ...c,
989
- _rowId: c._rowId ?? o._rowId
990
- } : o;
991
- }, on = (e, t, n) => {
1009
+ _rowId: c._rowId ?? s._rowId
1010
+ } : s;
1011
+ }, ln = (e, t, n) => {
992
1012
  const r = e[t];
993
1013
  return r ? n ? {
994
1014
  ...r,
995
1015
  ...n,
996
1016
  _rowId: n._rowId ?? r._rowId
997
1017
  } : r : null;
998
- }, cn = f(
1018
+ }, an = m(
999
1019
  async (e) => {
1000
- const t = R.current;
1020
+ const t = v.current;
1001
1021
  if (e < 0 || e >= t.length)
1002
1022
  return {
1003
1023
  successful: [],
1004
1024
  failed: [{ index: e, error: "Invalid index" }]
1005
1025
  };
1006
1026
  try {
1007
- if (ve.current) {
1008
- const o = t[e], c = await ve.current(
1009
- [{ index: e, item: o }],
1027
+ if (Te.current) {
1028
+ const s = t[e], c = await Te.current(
1029
+ [{ index: e, item: s }],
1010
1030
  _.current
1011
1031
  );
1012
1032
  if (c) {
1013
- const s = c.successful.filter(
1014
- ({ index: l }) => l >= 0 && l < t.length
1015
- ).map(({ index: l, item: m }) => {
1016
- const h = on(
1033
+ const o = c.successful.filter(
1034
+ ({ index: d }) => d >= 0 && d < t.length
1035
+ ).map(({ index: d, item: S }) => {
1036
+ const a = ln(
1017
1037
  t,
1018
- l,
1019
- m
1038
+ d,
1039
+ S
1020
1040
  );
1021
- return h ? { index: l, item: h } : null;
1041
+ return a ? { index: d, item: a } : null;
1022
1042
  }).filter(
1023
- (l) => l !== null
1043
+ (d) => d !== null
1024
1044
  );
1025
- if (s.length && !b(
1026
- (m) => m.filter((h, E) => E !== e)
1045
+ if (o.length && !b(
1046
+ (S) => S.filter((a, R) => R !== e)
1027
1047
  ))
1028
1048
  return {
1029
1049
  successful: [],
@@ -1031,22 +1051,22 @@ const ls = ({
1031
1051
  { index: e, error: "Controlled mode without onItemsChange" }
1032
1052
  ]
1033
1053
  };
1034
- const i = new Set(
1035
- c.failed.map((l) => l.index)
1036
- ), S = [...c.failed];
1054
+ const l = new Set(
1055
+ c.failed.map((d) => d.index)
1056
+ ), p = [...c.failed];
1037
1057
  return c.successful.filter(
1038
- ({ index: l }) => l < 0 || l >= t.length
1039
- ).map(({ index: l, item: m }) => ({
1040
- index: l,
1041
- item: m,
1058
+ ({ index: d }) => d < 0 || d >= t.length
1059
+ ).map(({ index: d, item: S }) => ({
1060
+ index: d,
1061
+ item: S,
1042
1062
  error: "Invalid index"
1043
- })).forEach((l) => {
1044
- i.has(l.index) || S.push(l);
1045
- }), { successful: s, failed: S };
1063
+ })).forEach((d) => {
1064
+ l.has(d.index) || p.push(d);
1065
+ }), { successful: o, failed: p };
1046
1066
  }
1047
1067
  }
1048
1068
  let n;
1049
- return b((o) => (n = o[e], o.filter((c, u) => u !== e))) ? { successful: [{ index: e, item: n }], failed: [] } : {
1069
+ return b((s) => (n = s[e], s.filter((c, u) => u !== e))) ? { successful: [{ index: e, item: n }], failed: [] } : {
1050
1070
  successful: [],
1051
1071
  failed: [{ index: e, error: "Controlled mode without onItemsChange" }]
1052
1072
  };
@@ -1058,110 +1078,110 @@ const ls = ({
1058
1078
  }
1059
1079
  },
1060
1080
  [b]
1061
- ), ln = f(
1081
+ ), un = m(
1062
1082
  async (e) => {
1063
1083
  if (!e.length) return { successful: [], failed: [] };
1064
- const t = R.current, n = Array.from(new Set(e)), { validIndexes: r, invalidFailures: o } = n.reduce(
1065
- (s, i) => (i >= 0 && i < t.length ? s.validIndexes.push(i) : s.invalidFailures.push({ index: i, error: "Invalid index" }), s),
1084
+ const t = v.current, n = Array.from(new Set(e)), { validIndexes: r, invalidFailures: s } = n.reduce(
1085
+ (o, l) => (l >= 0 && l < t.length ? o.validIndexes.push(l) : o.invalidFailures.push({ index: l, error: "Invalid index" }), o),
1066
1086
  {
1067
1087
  validIndexes: [],
1068
1088
  invalidFailures: []
1069
1089
  }
1070
- ), c = n.map((s) => ({
1071
- index: s,
1072
- item: t[s]
1090
+ ), c = n.map((o) => ({
1091
+ index: o,
1092
+ item: t[o]
1073
1093
  })), u = new Set(r);
1074
1094
  try {
1075
- if (ve.current) {
1076
- const x = await ve.current(
1095
+ if (Te.current) {
1096
+ const h = await Te.current(
1077
1097
  c,
1078
1098
  _.current
1079
1099
  );
1080
- if (x) {
1081
- const l = x.successful.filter(
1082
- ({ index: d }) => u.has(d)
1083
- ), m = l.map(({ index: d, item: N }) => {
1084
- const F = on(
1100
+ if (h) {
1101
+ const d = h.successful.filter(
1102
+ ({ index: f }) => u.has(f)
1103
+ ), S = d.map(({ index: f, item: N }) => {
1104
+ const F = ln(
1085
1105
  t,
1086
- d,
1106
+ f,
1087
1107
  N
1088
1108
  );
1089
- return F ? { index: d, item: F } : null;
1109
+ return F ? { index: f, item: F } : null;
1090
1110
  }).filter(
1091
- (d) => d !== null
1111
+ (f) => f !== null
1092
1112
  );
1093
- if (l.length) {
1094
- const d = new Set(m.map((F) => F.index));
1113
+ if (d.length) {
1114
+ const f = new Set(S.map((F) => F.index));
1095
1115
  if (!b(
1096
- (F) => F.filter((Nn, ot) => !d.has(ot))
1116
+ (F) => F.filter((Ln, it) => !f.has(it))
1097
1117
  ))
1098
1118
  return {
1099
1119
  successful: [],
1100
- failed: m.map(({ index: F }) => ({
1120
+ failed: S.map(({ index: F }) => ({
1101
1121
  index: F,
1102
1122
  error: "Controlled mode without onItemsChange"
1103
1123
  }))
1104
1124
  };
1105
1125
  }
1106
- const h = new Set(x.failed.map((d) => d.index)), E = [...x.failed];
1107
- return o.forEach((d) => {
1108
- h.has(d.index) || E.push(d);
1109
- }), x.successful.filter(({ index: d }) => !u.has(d)).map(({ index: d, item: N }) => ({
1110
- index: d,
1126
+ const a = new Set(h.failed.map((f) => f.index)), R = [...h.failed];
1127
+ return s.forEach((f) => {
1128
+ a.has(f.index) || R.push(f);
1129
+ }), h.successful.filter(({ index: f }) => !u.has(f)).map(({ index: f, item: N }) => ({
1130
+ index: f,
1111
1131
  item: N,
1112
1132
  error: "Invalid index"
1113
- })).forEach((d) => {
1114
- h.has(d.index) || E.push(d);
1115
- }), { successful: m, failed: E };
1133
+ })).forEach((f) => {
1134
+ a.has(f.index) || R.push(f);
1135
+ }), { successful: S, failed: R };
1116
1136
  }
1117
1137
  }
1118
- const s = new Set(r), i = [];
1119
- return b((x) => {
1120
- const l = [];
1121
- return x.forEach((m, h) => {
1122
- s.has(h) ? i.push({ index: h, item: m }) : l.push(m);
1123
- }), l;
1124
- }) ? { successful: i, failed: o } : {
1138
+ const o = new Set(r), l = [];
1139
+ return b((h) => {
1140
+ const d = [];
1141
+ return h.forEach((S, a) => {
1142
+ o.has(a) ? l.push({ index: a, item: S }) : d.push(S);
1143
+ }), d;
1144
+ }) ? { successful: l, failed: s } : {
1125
1145
  successful: [],
1126
- failed: r.map((x) => ({
1127
- index: x,
1146
+ failed: r.map((h) => ({
1147
+ index: h,
1128
1148
  error: "Controlled mode without onItemsChange"
1129
1149
  }))
1130
1150
  };
1131
- } catch (s) {
1151
+ } catch (o) {
1132
1152
  return {
1133
1153
  successful: [],
1134
- failed: n.map((i) => ({
1135
- index: i,
1136
- error: String(s)
1154
+ failed: n.map((l) => ({
1155
+ index: l,
1156
+ error: String(o)
1137
1157
  }))
1138
1158
  };
1139
1159
  }
1140
1160
  },
1141
1161
  [b]
1142
- ), an = f((e) => {
1143
- const t = Le.current.get(String(e));
1144
- return t !== void 0 ? R.current[t] : void 0;
1145
- }, []), un = f((e) => R.current[e], []), dn = f(
1162
+ ), dn = m((e) => {
1163
+ const t = We.current.get(String(e));
1164
+ return t !== void 0 ? v.current[t] : void 0;
1165
+ }, []), fn = m((e) => v.current[e], []), mn = m(
1146
1166
  (e) => {
1147
1167
  b(
1148
- e.map((t) => ({ ...t, _rowId: t._rowId ?? it() }))
1168
+ e.map((t) => ({ ...t, _rowId: t._rowId ?? at() }))
1149
1169
  );
1150
1170
  },
1151
1171
  [b]
1152
- ), fn = f(() => {
1172
+ ), hn = m(() => {
1153
1173
  b([]);
1154
- }, [b]), mn = f((e) => Le.current.get(String(e)) ?? -1, []), hn = f((e) => Le.current.has(String(e)), []), pn = f(() => R.current.length, []), gn = f(() => [...R.current], []), Sn = f(() => kt(R.current), [kt]), wn = f(() => Lt(R.current), [Lt]), xn = f(
1174
+ }, [b]), pn = m((e) => We.current.get(String(e)) ?? -1, []), gn = m((e) => We.current.has(String(e)), []), Sn = m(() => v.current.length, []), wn = m(() => [...v.current], []), xn = m(() => _t(v.current), [_t]), In = m(() => Wt(v.current), [Wt]), bn = m(
1155
1175
  (e, t) => {
1156
1176
  const n = e ? {
1157
1177
  state: "loading",
1158
1178
  message: t?.title,
1159
1179
  description: t?.description
1160
1180
  } : { state: "none" };
1161
- H || xe(n), j?.(n);
1181
+ H || be(n), j?.(n);
1162
1182
  },
1163
1183
  [H, j]
1164
- ), In = f(
1184
+ ), yn = m(
1165
1185
  (e, t) => {
1166
1186
  const n = e ? {
1167
1187
  state: "error",
@@ -1170,20 +1190,20 @@ const ls = ({
1170
1190
  onRetry: t?.onRetry,
1171
1191
  retryButtonText: t?.retryButtonText
1172
1192
  } : { state: "none" };
1173
- H || xe(n), j?.(n);
1193
+ H || be(n), j?.(n);
1174
1194
  },
1175
1195
  [H, j]
1176
- ), bn = f(
1196
+ ), Rn = m(
1177
1197
  (e, t) => {
1178
1198
  const n = e ? {
1179
1199
  state: "partial-loading",
1180
1200
  message: t?.title,
1181
1201
  description: t?.description
1182
1202
  } : { state: "none" };
1183
- H || xe(n), j?.(n);
1203
+ H || be(n), j?.(n);
1184
1204
  },
1185
1205
  [H, j]
1186
- ), yn = f(
1206
+ ), vn = m(
1187
1207
  (e, t) => {
1188
1208
  const n = e ? {
1189
1209
  state: "empty",
@@ -1191,284 +1211,284 @@ const ls = ({
1191
1211
  description: t?.description,
1192
1212
  imageUrl: t?.imageUrl
1193
1213
  } : { state: "none" };
1194
- H || xe(n), j?.(n);
1214
+ H || be(n), j?.(n);
1195
1215
  },
1196
1216
  [H, j]
1197
- ), Rn = f(() => {
1217
+ ), Cn = m(() => {
1198
1218
  const e = { state: "none" };
1199
- H || xe(e), j?.(e);
1200
- }, [H, j]), vn = f(() => Ne.state, [Ne.state]), Fe = se(
1219
+ H || be(e), j?.(e);
1220
+ }, [H, j]), Tn = m(() => Le.state, [Le.state]), Ae = ce(
1201
1221
  () => ({
1202
- getFields: Ut,
1203
- addItem: en,
1204
- addItems: tn,
1205
- updateItem: nn,
1206
- updateItems: rn,
1207
- deleteItem: cn,
1208
- deleteItems: ln,
1209
- getItem: an,
1210
- getItemByIndex: un,
1211
- getItems: gn,
1212
- getItemsCount: pn,
1213
- itemExists: hn,
1214
- getItemIndex: mn,
1215
- replaceAllItems: dn,
1216
- clearItems: fn,
1217
- deselectAllRows: Mt,
1218
- getSelectedItems: Sn,
1219
- getSelectedRows: wn,
1222
+ getFields: $t,
1223
+ addItem: nn,
1224
+ addItems: rn,
1225
+ updateItem: sn,
1226
+ updateItems: on,
1227
+ deleteItem: an,
1228
+ deleteItems: un,
1229
+ getItem: dn,
1230
+ getItemByIndex: fn,
1231
+ getItems: wn,
1232
+ getItemsCount: Sn,
1233
+ itemExists: gn,
1234
+ getItemIndex: pn,
1235
+ replaceAllItems: mn,
1236
+ clearItems: hn,
1237
+ deselectAllRows: Nt,
1238
+ getSelectedItems: xn,
1239
+ getSelectedRows: In,
1220
1240
  // Overlay methods
1221
- setLoading: xn,
1222
- setError: In,
1223
- setPartialLoading: bn,
1224
- setEmpty: yn,
1225
- clearOverlay: Rn,
1226
- getOverlayState: vn,
1241
+ setLoading: bn,
1242
+ setError: yn,
1243
+ setPartialLoading: Rn,
1244
+ setEmpty: vn,
1245
+ clearOverlay: Cn,
1246
+ getOverlayState: Tn,
1227
1247
  // Sorting methods
1228
- getSortingState: Vt,
1229
- getPrimarySortedColumn: $t,
1230
- hasActiveSorting: qt,
1231
- setSortingState: Yt,
1232
- clearSorting: Gt,
1248
+ getSortingState: qt,
1249
+ getPrimarySortedColumn: Yt,
1250
+ hasActiveSorting: Gt,
1251
+ setSortingState: Kt,
1252
+ clearSorting: Xt,
1233
1253
  // Filter methods
1234
- getFilterableFields: Kt,
1235
- getColumnFilters: Xt,
1236
- hasActiveFilters: Jt,
1237
- setColumnFilters: Zt,
1238
- clearColumnFilters: Qt
1254
+ getFilterableFields: Jt,
1255
+ getColumnFilters: Zt,
1256
+ hasActiveFilters: Qt,
1257
+ setColumnFilters: en,
1258
+ clearColumnFilters: tn
1239
1259
  }),
1240
1260
  [
1241
- en,
1242
- tn,
1243
- fn,
1244
- Rn,
1245
- cn,
1246
- ln,
1247
- Mt,
1248
- a,
1249
- Ut,
1261
+ nn,
1262
+ rn,
1263
+ hn,
1264
+ Cn,
1250
1265
  an,
1251
1266
  un,
1252
- mn,
1253
- gn,
1267
+ Nt,
1268
+ i,
1269
+ $t,
1270
+ dn,
1271
+ fn,
1254
1272
  pn,
1255
- vn,
1256
- Sn,
1257
1273
  wn,
1258
- Vt,
1259
- $t,
1274
+ Sn,
1275
+ Tn,
1276
+ xn,
1277
+ In,
1260
1278
  qt,
1261
- hn,
1262
- dn,
1279
+ Yt,
1263
1280
  Gt,
1281
+ gn,
1282
+ mn,
1283
+ Xt,
1284
+ vn,
1264
1285
  yn,
1265
- In,
1266
- xn,
1267
- Yt,
1268
1286
  bn,
1269
- nn,
1270
- rn,
1271
- // Filter methods
1272
- Qt,
1273
- Xt,
1274
1287
  Kt,
1288
+ Rn,
1289
+ sn,
1290
+ on,
1291
+ // Filter methods
1292
+ tn,
1293
+ Zt,
1275
1294
  Jt,
1276
- Zt
1295
+ Qt,
1296
+ en
1277
1297
  ]
1278
1298
  );
1279
- _.current = Fe, fr.useImperativeHandle(jn, () => Fe, [
1280
- Fe
1299
+ _.current = Ae, hr.useImperativeHandle(Un, () => Ae, [
1300
+ Ae
1281
1301
  ]);
1282
- const ir = f(
1302
+ const ar = m(
1283
1303
  (e, t) => {
1284
- t?.target && t.target.closest('[data-checkbox="true"]') || (I && At(e.index), T && T(e.original, e.index));
1304
+ t?.target && t.target.closest('[data-checkbox="true"]') || (I && kt(e.index), E && E(e.original, e.index));
1285
1305
  },
1286
- [I, T, At]
1287
- ), lr = f(
1306
+ [I, E, kt]
1307
+ ), ur = m(
1288
1308
  (e, t) => {
1289
- t?.target && t.target.closest('[data-checkbox="true"]') || He && He(e.original, e.index);
1309
+ t?.target && t.target.closest('[data-checkbox="true"]') || Ve && Ve(e.original, e.index);
1290
1310
  },
1291
- [He]
1292
- ), Cn = se(() => B.map((e) => {
1293
- const n = a.find((o) => o.internalName === e.id)?.typeAsString === "Note" ? O * 2 : O, r = L[e.id] || (typeof e.size == "number" ? e.size : n);
1294
- return e.id === "select" ? `${Ae}px` : `${r}px`;
1295
- }).join(" "), [B, L, a]), Tn = w(!1);
1296
- kn(() => {
1297
- if (Tn.current) return;
1298
- const e = re.current;
1311
+ [Ve]
1312
+ ), En = ce(() => B.map((e) => {
1313
+ const n = i.find((s) => s.internalName === e.id)?.typeAsString === "Note" ? O * 2 : O, r = L[e.id] || (typeof e.size == "number" ? e.size : n);
1314
+ return e.id === "select" ? `${ke}px` : `${r}px`;
1315
+ }).join(" "), [B, L, i]), zn = x(!1);
1316
+ _n(() => {
1317
+ if (zn.current) return;
1318
+ const e = se.current;
1299
1319
  if (!e) return;
1300
1320
  const t = e.clientWidth;
1301
1321
  if (t <= 0) return;
1302
- Tn.current = !0, zt(t);
1303
- const n = ie ? On(t, B, a, L) : Pn(
1322
+ zn.current = !0, Mt(t);
1323
+ const n = le ? Hn(t, B, i, L) : jn(
1304
1324
  t,
1305
1325
  B,
1306
- a,
1326
+ i,
1307
1327
  L,
1308
- Te
1328
+ ze
1309
1329
  );
1310
- n && (K.current = !0, Ie(
1311
- (r) => ie ? n : { ...r, ...n }
1330
+ n && (K.current = !0, ye(
1331
+ (r) => le ? n : { ...r, ...n }
1312
1332
  ), requestAnimationFrame(() => {
1313
1333
  K.current = !1;
1314
1334
  }));
1315
- }), oe(() => {
1316
- if (!Je) return;
1335
+ }), ne(() => {
1336
+ if (!Qe) return;
1317
1337
  const e = new ResizeObserver((t) => {
1318
1338
  for (const n of t)
1319
- zt(n.contentRect.width);
1339
+ Mt(n.contentRect.width);
1320
1340
  });
1321
- return e.observe(Je), () => e.disconnect();
1322
- }, [Je]), oe(() => {
1323
- if (!(!ie || Q <= 0) && !K.current)
1324
- return Se.current && clearTimeout(Se.current), Se.current = setTimeout(() => {
1325
- const e = On(
1341
+ return e.observe(Qe), () => e.disconnect();
1342
+ }, [Qe]), ne(() => {
1343
+ if (!(!le || Q <= 0) && !K.current)
1344
+ return xe.current && clearTimeout(xe.current), xe.current = setTimeout(() => {
1345
+ const e = Hn(
1326
1346
  Q,
1327
1347
  B,
1328
- a,
1348
+ i,
1329
1349
  L
1330
1350
  );
1331
- e && (K.current = !0, Ie(e), requestAnimationFrame(() => {
1351
+ e && (K.current = !0, ye(e), requestAnimationFrame(() => {
1332
1352
  K.current = !1;
1333
1353
  }));
1334
1354
  }, 50), () => {
1335
- Se.current && clearTimeout(Se.current);
1355
+ xe.current && clearTimeout(xe.current);
1336
1356
  };
1337
- }, [ie, Q, B, a]), oe(() => {
1338
- if (!(ie || Q <= 0))
1339
- return we.current && clearTimeout(we.current), we.current = setTimeout(() => {
1340
- const e = Pn(
1357
+ }, [le, Q, B, i]), ne(() => {
1358
+ if (!(le || Q <= 0))
1359
+ return Ie.current && clearTimeout(Ie.current), Ie.current = setTimeout(() => {
1360
+ const e = jn(
1341
1361
  Q,
1342
1362
  B,
1343
- a,
1363
+ i,
1344
1364
  L,
1345
- Te
1365
+ ze
1346
1366
  );
1347
- e && (K.current = !0, Ie((t) => ({ ...t, ...e })), requestAnimationFrame(() => {
1367
+ e && (K.current = !0, ye((t) => ({ ...t, ...e })), requestAnimationFrame(() => {
1348
1368
  K.current = !1;
1349
1369
  }));
1350
1370
  }, 50), () => {
1351
- we.current && clearTimeout(we.current);
1371
+ Ie.current && clearTimeout(Ie.current);
1352
1372
  };
1353
- }, [ie, Q, Te, B, a]);
1354
- const En = Rr(Un, W), zn = vr(
1355
- Vn,
1373
+ }, [le, Q, ze, B, i]);
1374
+ const Fn = Cr($n, W), Mn = Tr(
1375
+ qn,
1356
1376
  W
1357
- ), _e = Cr(
1358
- $n,
1377
+ ), Be = Er(
1378
+ Yn,
1359
1379
  W
1360
- ), Fn = Tr(
1361
- qn,
1380
+ ), An = zr(
1381
+ Gn,
1362
1382
  W
1363
- ), Mn = Fn ? [...mt, Fn] : mt, ar = En ? [...Mn, En] : Mn, st = [];
1364
- zn && st.push(zn);
1365
- const ur = _e ? [...st, ...ht, _e] : [...st, ...ht], dr = _e ? [...pt, _e] : pt, An = /* @__PURE__ */ ct(
1366
- xr,
1383
+ ), Nn = An ? [...pt, An] : pt, dr = Fn ? [Fn, ...Nn] : Nn, ct = [];
1384
+ Mn && ct.push(Mn);
1385
+ const fr = Be ? [...ct, ...gt, Be] : [...ct, ...gt], mr = Be ? [...St, Be] : St, kn = /* @__PURE__ */ lt(
1386
+ br,
1367
1387
  {
1368
1388
  size: "small",
1369
- appearance: g,
1370
- className: Jn,
1389
+ appearance: w,
1390
+ className: Qn,
1371
1391
  style: {
1372
1392
  backgroundColor: $.colorNeutralBackground1,
1373
1393
  maxWidth: "100%",
1374
1394
  // margin: "20px 20px",
1375
1395
  padding: "0px",
1376
1396
  gap: "0px",
1377
- ...p
1397
+ ...g
1378
1398
  },
1379
1399
  children: [
1380
1400
  Y && /* @__PURE__ */ D(
1381
- Nr,
1401
+ Lr,
1382
1402
  {
1383
- tableMethods: Fe,
1384
- alwaysButtons: De(ar),
1385
- noSelectionButtons: De(Yn),
1386
- singleSelectionButtons: De(
1387
- ur
1403
+ tableMethods: Ae,
1404
+ alwaysButtons: Pe(dr),
1405
+ noSelectionButtons: Pe(Kn),
1406
+ singleSelectionButtons: Pe(
1407
+ fr
1388
1408
  ),
1389
- multiSelectionButtons: De(
1390
- dr
1409
+ multiSelectionButtons: Pe(
1410
+ mr
1391
1411
  ),
1392
- selectedRows: Fe.getSelectedRows(),
1412
+ selectedRows: Ae.getSelectedRows(),
1393
1413
  localeText: W
1394
1414
  }
1395
1415
  ),
1396
1416
  (() => {
1397
- const e = rt.getRowModel().rows.length, t = Z.length > 0, n = Ne.state !== "none" ? Ne : t && e === 0 ? {
1417
+ const e = ot.getRowModel().rows.length, t = Z.length > 0, n = Le.state !== "none" ? Le : t && e === 0 ? {
1398
1418
  state: "empty",
1399
1419
  message: W.filteredEmptyTitle,
1400
1420
  description: W.filteredEmptyDescription,
1401
- imageUrl: le?.empty?.imageUrl
1421
+ imageUrl: ae?.empty?.imageUrl
1402
1422
  } : X.length === 0 ? {
1403
1423
  state: "empty",
1404
- message: le?.empty?.title,
1405
- description: le?.empty?.description,
1406
- imageUrl: le?.empty?.imageUrl
1407
- } : { state: "none" }, r = /* @__PURE__ */ ct(
1424
+ message: ae?.empty?.title,
1425
+ description: ae?.empty?.description,
1426
+ imageUrl: ae?.empty?.imageUrl
1427
+ } : { state: "none" }, r = /* @__PURE__ */ lt(
1408
1428
  "div",
1409
1429
  {
1410
- ref: sr,
1411
- onScroll: cr,
1412
- className: vt["efw-table-scroll-container"],
1430
+ ref: cr,
1431
+ onScroll: lr,
1432
+ className: Tt["efw-table-scroll-container"],
1413
1433
  style: {
1414
- ...ge !== void 0 && {
1415
- maxHeight: ge
1434
+ ...we !== void 0 && {
1435
+ maxHeight: we
1416
1436
  },
1417
- overflowY: ge !== void 0 ? "auto" : "visible",
1437
+ overflowY: we !== void 0 ? "auto" : "visible",
1418
1438
  overflowX: "auto",
1419
1439
  border: `1px solid ${$.colorNeutralStroke2}`,
1420
1440
  borderTop: Y ? "none" : `1px solid ${$.colorNeutralStroke2}`,
1421
1441
  position: "relative"
1422
1442
  },
1423
1443
  children: [
1424
- /* @__PURE__ */ ct(
1444
+ /* @__PURE__ */ lt(
1425
1445
  "div",
1426
1446
  {
1427
1447
  className: "table-container",
1428
1448
  style: {
1429
1449
  minWidth: "100%",
1430
- width: or
1450
+ width: ir
1431
1451
  },
1432
1452
  children: [
1433
1453
  /* @__PURE__ */ D(
1434
- kr,
1454
+ _r,
1435
1455
  {
1436
- table: rt,
1437
- gridTemplateColumns: Cn,
1456
+ table: ot,
1457
+ gridTemplateColumns: En,
1438
1458
  columnSizing: L,
1439
1459
  dense: q,
1440
- stickyColumnsInfo: Pt,
1441
- resizableColumns: je,
1460
+ stickyColumnsInfo: jt,
1461
+ resizableColumns: Ue,
1442
1462
  localeText: W
1443
1463
  }
1444
1464
  ),
1445
1465
  /* @__PURE__ */ D(
1446
- Lr,
1466
+ Wr,
1447
1467
  {
1448
- table: rt,
1449
- fields: a,
1450
- tableContainerRef: re,
1451
- useVirtualization: lt,
1468
+ table: ot,
1469
+ fields: i,
1470
+ tableContainerRef: se,
1471
+ useVirtualization: ut,
1452
1472
  enableSelection: I,
1453
- itemSize: qe,
1473
+ itemSize: Ge,
1454
1474
  dense: q,
1455
- rowAnimationSignals: tr,
1456
- gridTemplateColumns: Cn,
1475
+ rowAnimationSignals: rr,
1476
+ gridTemplateColumns: En,
1457
1477
  columnSizing: L,
1458
- stickyColumnsInfo: Pt,
1459
- onRowClick: ir,
1460
- onRowDoubleClick: lr
1478
+ stickyColumnsInfo: jt,
1479
+ onRowClick: ar,
1480
+ onRowDoubleClick: ur
1461
1481
  }
1462
1482
  )
1463
1483
  ]
1464
1484
  }
1465
1485
  ),
1466
- pe && /* @__PURE__ */ D(
1486
+ Se && /* @__PURE__ */ D(
1467
1487
  "div",
1468
1488
  {
1469
1489
  style: {
1470
- height: qe,
1471
- minHeight: qe,
1490
+ height: Ge,
1491
+ minHeight: Ge,
1472
1492
  display: "flex",
1473
1493
  alignItems: "center",
1474
1494
  justifyContent: "center",
@@ -1484,7 +1504,7 @@ const ls = ({
1484
1504
  "aria-live": "polite",
1485
1505
  "aria-label": W.loadingMoreAriaLabel,
1486
1506
  children: /* @__PURE__ */ D(
1487
- Ir,
1507
+ yr,
1488
1508
  {
1489
1509
  size: "tiny",
1490
1510
  label: W.loadingMoreSpinnerLabel
@@ -1496,20 +1516,20 @@ const ls = ({
1496
1516
  }
1497
1517
  );
1498
1518
  return n.state === "partial-loading" ? /* @__PURE__ */ D(
1499
- _n,
1519
+ Bn,
1500
1520
  {
1501
1521
  config: n,
1502
- customization: le,
1503
- height: ge !== void 0 ? Math.max($e, ge) : $e,
1522
+ customization: ae,
1523
+ height: we !== void 0 ? Math.max(Ye, we) : Ye,
1504
1524
  localeText: W,
1505
1525
  children: r
1506
1526
  }
1507
1527
  ) : n.state !== "none" ? /* @__PURE__ */ D(
1508
- _n,
1528
+ Bn,
1509
1529
  {
1510
1530
  config: n,
1511
- height: $e,
1512
- customization: le,
1531
+ height: Ye,
1532
+ customization: ae,
1513
1533
  localeText: W
1514
1534
  }
1515
1535
  ) : r;
@@ -1517,10 +1537,10 @@ const ls = ({
1517
1537
  ]
1518
1538
  }
1519
1539
  );
1520
- return yt ? /* @__PURE__ */ D(Ar, { localeText: yt, children: An }) : An;
1540
+ return vt ? /* @__PURE__ */ D(kr, { localeText: vt, children: kn }) : kn;
1521
1541
  };
1522
1542
  export {
1523
- Pe as COLS_MAX_WIDTH,
1524
- he as COLS_MIN_WIDTH,
1525
- ls as EFWTable
1543
+ je as COLS_MAX_WIDTH,
1544
+ ge as COLS_MIN_WIDTH,
1545
+ ds as EFWTable
1526
1546
  };