@envisiongroup/porygon 1.0.1 → 1.0.3

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.
@@ -18,7 +18,9 @@ import { EFWTableCommandBar as Nr } from "./components/EFWTableCommandBar/EFWTab
18
18
  import { EFWTableOverlay as _n } from "./components/EFWTableOverlay/EFWTableOverlay.js";
19
19
  import { EFWTableHeader as kr } from "./components/EFWTableHeader/EFWTableHeader.js";
20
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(g.map((p) => [p.id, p.value])), 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 = 120, Ae = 40, he = 120, Pe = 2500, Dn = 500, Dr = 20, Or = (g) => {
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) => {
22
24
  switch (g) {
23
25
  case "Date":
24
26
  return (p, y, a) => {
@@ -221,29 +223,45 @@ const ls = ({
221
223
  lt && z === void 0 && console.warn(
222
224
  '[EFWTable] La prop "height" es requerida cuando "useVirtualization" está habilitado. La virtualización necesita una altura fija para calcular las filas visibles.'
223
225
  );
224
- const ge = z !== void 0 ? Y ? z - 40 : z : void 0, qe = k ?? (q ? 32 : 44), vt = jr(), Jn = wr(y, "efw-table", vt["efw-table"]), K = w(!1), Se = w(null), we = w(null), Ye = v !== void 0, H = It !== void 0, [Zn, xe] = te(
226
+ const ge = z !== void 0 ? Y ? z - 40 : z : void 0, qe = k ?? (q ? 32 : 44), vt = jr(), Jn = wr(
227
+ y,
228
+ "efw-table",
229
+ vt["efw-table"]
230
+ ), K = w(!1), Se = w(
231
+ null
232
+ ), we = w(null), Ye = v !== void 0, H = It !== void 0, [Zn, xe] = te(
225
233
  () => Xn || { state: "none" }
226
234
  ), Ne = H ? It : Zn, [Qn, er] = te(() => (M || Wn).map((t) => ({
227
235
  ...t,
228
236
  _rowId: t._rowId || it()
229
- }))), X = Ye ? v || Wn : Qn, Ct = w(/* @__PURE__ */ new WeakMap()), ke = f((e, t) => {
230
- if (e._rowId)
231
- return String(e._rowId);
232
- const n = Ct.current.get(e);
233
- if (n)
234
- return n;
235
- const r = it();
236
- return Ct.current.set(e, r), r;
237
- }, []), [L, Ie] = te(() => {
237
+ }))), X = Ye ? v || Wn : Qn, Ct = w(/* @__PURE__ */ new WeakMap()), ke = f(
238
+ (e, t) => {
239
+ if (e._rowId)
240
+ return String(e._rowId);
241
+ const n = Ct.current.get(e);
242
+ if (n)
243
+ return n;
244
+ const r = it();
245
+ return Ct.current.set(e, r), r;
246
+ },
247
+ []
248
+ ), [L, Ie] = te(() => {
238
249
  const e = {};
239
250
  return a.forEach((t) => {
240
251
  const n = P[t.internalName];
241
252
  if (n?.width) {
242
253
  const r = n.minWidth ?? he, o = n.maxWidth ?? Pe;
243
- e[t.internalName] = Math.min(Math.max(n.width ?? 0, r), o);
254
+ e[t.internalName] = Math.min(
255
+ Math.max(n.width ?? 0, r),
256
+ o
257
+ );
244
258
  }
245
259
  }), e;
246
- }), Tt = w(P), [J, Ge] = te(() => Bn(Gn ?? [])), [Z, Ke] = te([]), Et = w(Z);
260
+ }), Tt = w(P), [J, Ge] = te(
261
+ () => Bn(Gn ?? [])
262
+ ), [Z, Ke] = te(
263
+ []
264
+ ), Et = w(Z);
247
265
  Et.current = Z;
248
266
  const [Q, zt] = te(0), [tr, nr] = te({}), Xe = w(ne);
249
267
  Xe.current = ne;
@@ -263,7 +281,9 @@ const ls = ({
263
281
  enableSelection: I,
264
282
  items: X,
265
283
  getRowId: ke
266
- }), re = w(null), ue = w(null), [Je, rr] = te(null), sr = f((e) => {
284
+ }), re = w(null), ue = w(
285
+ null
286
+ ), [Je, rr] = te(null), sr = f((e) => {
267
287
  re.current = e, rr(e);
268
288
  }, []), ee = f(() => {
269
289
  if (Qe.current && !be.current) {
@@ -279,22 +299,28 @@ const ls = ({
279
299
  top: e.scrollTop,
280
300
  left: e.scrollLeft
281
301
  };
282
- }, []), Ze = f((e, t) => {
283
- e.scrollTop !== t.top && (e.scrollTop = t.top), e.scrollLeft !== t.left && (e.scrollLeft = t.left);
284
- }, []), A = f((e, t, n) => {
285
- !(n?.animateRows ?? (t === "add" ? Xe.current.addRows : Xe.current.updateRows)) || e.length === 0 || nr((o) => {
286
- const c = { ...o };
287
- return e.forEach(({ item: u }, s) => {
288
- if (!u._rowId)
289
- return;
290
- const i = String(u._rowId);
291
- c[i] = {
292
- delay: s * Dr,
293
- token: (c[i]?.token ?? 0) + 1
294
- };
295
- }), c;
296
- });
297
- }, []), R = w(X), Le = w(/* @__PURE__ */ new Map()), Qe = w(Ye);
302
+ }, []), Ze = f(
303
+ (e, t) => {
304
+ e.scrollTop !== t.top && (e.scrollTop = t.top), e.scrollLeft !== t.left && (e.scrollLeft = t.left);
305
+ },
306
+ []
307
+ ), A = f(
308
+ (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) => {
312
+ if (!u._rowId)
313
+ return;
314
+ const i = String(u._rowId);
315
+ c[i] = {
316
+ delay: s * Dr,
317
+ token: (c[i]?.token ?? 0) + 1
318
+ };
319
+ }), c;
320
+ });
321
+ },
322
+ []
323
+ ), R = w(X), Le = w(/* @__PURE__ */ new Map()), Qe = w(Ye);
298
324
  Qe.current = Ye;
299
325
  const be = w(at);
300
326
  be.current = at;
@@ -304,7 +330,9 @@ const ls = ({
304
330
  Re.current = St;
305
331
  const ve = w(wt);
306
332
  ve.current = wt;
307
- const _ = w(null), _t = w(pe);
333
+ const _ = w(
334
+ null
335
+ ), _t = w(pe);
308
336
  _t.current = pe;
309
337
  const Wt = w(ut);
310
338
  Wt.current = ut;
@@ -354,7 +382,14 @@ const ls = ({
354
382
  return I && e.push({
355
383
  id: "select",
356
384
  header: ({ table: t }) => /* @__PURE__ */ D(Pr, { table: t, dense: q }),
357
- cell: ({ row: t }) => /* @__PURE__ */ D(Hr, { row: t, toggleMultiple: Nt, dense: q }),
385
+ cell: ({ row: t }) => /* @__PURE__ */ D(
386
+ Hr,
387
+ {
388
+ row: t,
389
+ toggleMultiple: Nt,
390
+ dense: q
391
+ }
392
+ ),
358
393
  size: Ae,
359
394
  minSize: Ae,
360
395
  maxSize: Ae,
@@ -409,7 +444,10 @@ const ls = ({
409
444
  }), a.forEach((c) => {
410
445
  const u = c.internalName, s = P[u], i = e[u];
411
446
  if (s?.width !== void 0) {
412
- const S = s.minWidth ?? he, x = s.maxWidth ?? Pe, l = Math.min(Math.max(s.width, S), x);
447
+ const S = s.minWidth ?? he, x = s.maxWidth ?? Pe, l = Math.min(
448
+ Math.max(s.width, S),
449
+ x
450
+ );
413
451
  r[u] !== l && (r[u] = l, n = !0);
414
452
  } else i?.width !== void 0 && r[u] !== void 0 && (delete r[u], n = !0);
415
453
  }), n ? r : t;
@@ -437,11 +475,17 @@ const ls = ({
437
475
  onRowSelectionChange: Ft,
438
476
  onSortingChange: (e) => {
439
477
  const t = typeof e == "function" ? e(J) : e;
440
- Ge(t), Ee.current && Ee.current(Me(t), _.current);
478
+ Ge(t), Ee.current && Ee.current(
479
+ Me(t),
480
+ _.current
481
+ );
441
482
  },
442
483
  onColumnFiltersChange: (e) => {
443
484
  const t = typeof e == "function" ? e(Et.current) : e;
444
- Ke(t), ze.current && ze.current(Oe(t), _.current);
485
+ Ke(t), ze.current && ze.current(
486
+ Oe(t),
487
+ _.current
488
+ );
445
489
  },
446
490
  onColumnSizingChange: (e) => {
447
491
  Ie((t) => {
@@ -450,7 +494,10 @@ const ls = ({
450
494
  const c = B.find((u) => u.id === o);
451
495
  if (c) {
452
496
  const u = c.minSize || he, s = c.maxSize || Pe;
453
- K.current ? r[o] = Math.max(n[o], u) : r[o] = Math.min(Math.max(n[o], u), s);
497
+ K.current ? r[o] = Math.max(n[o], u) : r[o] = Math.min(
498
+ Math.max(n[o], u),
499
+ s
500
+ );
454
501
  }
455
502
  }), { ...t, ...r };
456
503
  });
@@ -471,20 +518,23 @@ const ls = ({
471
518
  ae[t] && e.add(t);
472
519
  }), nt.current = e;
473
520
  }, [ae]);
474
- const cr = f((e) => {
475
- if (Wt.current?.(e), !et.current || _t.current)
476
- return;
477
- 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;
478
- if (Bt.current = o, o > i && !s) {
479
- Ce.current = !1;
480
- return;
481
- }
482
- if (!s) {
483
- Ce.current = !1;
484
- return;
485
- }
486
- Ce.current || (Ce.current = !0, Dt.current = o, et.current());
487
- }, []), Ht = (e) => {
521
+ const cr = f(
522
+ (e) => {
523
+ if (Wt.current?.(e), !et.current || _t.current)
524
+ 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;
528
+ return;
529
+ }
530
+ if (!s) {
531
+ Ce.current = !1;
532
+ return;
533
+ }
534
+ Ce.current || (Ce.current = !0, Dt.current = o, et.current());
535
+ },
536
+ []
537
+ ), Ht = (e) => {
488
538
  const t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), o = new Set(
489
539
  Object.keys(ae).filter((s) => ae[s])
490
540
  ), c = e.map(
@@ -512,244 +562,423 @@ const ls = ({
512
562
  const u = ke(o, c), s = t.selectedIds.has(u), i = t.selectedRefs.has(o), S = !n && t.selectedIndexes.has(c);
513
563
  (s || i || S) && (r[u] = !0);
514
564
  }), Ft(r);
515
- }, b = f((e) => {
516
- if (Qe.current) {
517
- if (!be.current)
518
- return ue.current = null, Ot.current || (console.warn("[EFWTable] Modo controlled detectado sin onItemsChange. Las operaciones CRUD locales no se aplicarán."), Ot.current = !0), !1;
519
- const t = R.current, n = typeof e == "function" ? e(t) : e;
520
- R.current = n;
521
- const r = Ht(t);
522
- return nt.current = r.selectedIds, jt(n, r), be.current(n), !0;
523
- }
524
- return er((t) => {
525
- const n = typeof e == "function" ? e(t) : e;
526
- R.current = n;
527
- const r = Ht(t);
528
- return nt.current = r.selectedIds, jt(n, r), be.current?.(n), n;
529
- }), !0;
530
- }, []), 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) => {
565
+ }, b = f(
566
+ (e) => {
567
+ if (Qe.current) {
568
+ if (!be.current)
569
+ return ue.current = null, Ot.current || (console.warn(
570
+ "[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
+ }
577
+ return er((t) => {
578
+ 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;
582
+ }), !0;
583
+ },
584
+ []
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) => {
531
586
  const t = Bn(e);
532
- Ge(t), Ee.current?.(Me(t), _.current);
587
+ Ge(t), Ee.current?.(
588
+ Me(t),
589
+ _.current
590
+ );
533
591
  }, []), Gt = f(() => {
534
592
  const e = [];
535
- Ge(e), Ee.current?.(Me(e), _.current);
593
+ Ge(e), Ee.current?.(
594
+ Me(e),
595
+ _.current
596
+ );
536
597
  }, []), Kt = f(() => a.filter(
537
598
  (e) => e.typeAsString !== "Attachments" && P?.[e.internalName]?.filterable !== !1
538
599
  ), [a, P]), Xt = f(() => Oe(Z), [Z]), Jt = f(() => Z.length > 0, [Z]), Zt = f((e) => {
539
600
  const t = Br(e);
540
- Ke(t), ze.current?.(Oe(t), _.current);
601
+ Ke(t), ze.current?.(
602
+ Oe(t),
603
+ _.current
604
+ );
541
605
  }, []), Qt = f(() => {
542
606
  const e = [];
543
- Ke(e), ze.current?.(Oe(e), _.current);
544
- }, []), en = f(async (e, t = {}) => {
545
- const { position: n = "end" } = t;
546
- try {
547
- if (ye.current) {
548
- const r = We(e), o = await ye.current([r], _.current);
549
- if (o) {
550
- if (o.successful.length > 0) {
551
- const i = R.current.length, S = o.successful.map(
552
- (m) => Ln(m.item)
553
- );
554
- if (ee(), !b((m) => fe(m, S, n)))
555
- return { successful: [], failed: S.map((m, h) => ({ index: h, item: m, error: "Controlled mode without onItemsChange" })) };
556
- const l = me(S, i, n);
557
- return A(l, "add", t), {
558
- ...o,
559
- successful: l
560
- };
607
+ Ke(e), ze.current?.(
608
+ Oe(e),
609
+ _.current
610
+ );
611
+ }, []), en = f(
612
+ async (e, t = {}) => {
613
+ const { position: n = "end" } = t;
614
+ try {
615
+ if (ye.current) {
616
+ const r = We(e), o = await ye.current(
617
+ [r],
618
+ _.current
619
+ );
620
+ if (o) {
621
+ if (o.successful.length > 0) {
622
+ const i = R.current.length, S = o.successful.map(
623
+ (m) => Ln(m.item)
624
+ );
625
+ if (ee(), !b(
626
+ (m) => fe(m, S, n)
627
+ ))
628
+ return {
629
+ successful: [],
630
+ failed: S.map((m, h) => ({
631
+ index: h,
632
+ item: m,
633
+ error: "Controlled mode without onItemsChange"
634
+ }))
635
+ };
636
+ const l = me(
637
+ S,
638
+ i,
639
+ n
640
+ );
641
+ return A(l, "add", t), {
642
+ ...o,
643
+ successful: l
644
+ };
645
+ }
646
+ return { ...o, successful: [] };
561
647
  }
562
- return { ...o, successful: [] };
648
+ const c = R.current.length;
649
+ if (ee(), !b(
650
+ (i) => fe(i, [r], n)
651
+ ))
652
+ return {
653
+ successful: [],
654
+ failed: [
655
+ {
656
+ index: -1,
657
+ item: r,
658
+ error: "Controlled mode without onItemsChange"
659
+ }
660
+ ]
661
+ };
662
+ const s = me(
663
+ [r],
664
+ c,
665
+ n
666
+ );
667
+ return A(s, "add", t), {
668
+ successful: s,
669
+ failed: []
670
+ };
671
+ } else {
672
+ const r = We(e), o = R.current.length;
673
+ if (ee(), !b(
674
+ (s) => fe(s, [r], n)
675
+ ))
676
+ return {
677
+ successful: [],
678
+ failed: [
679
+ {
680
+ index: -1,
681
+ item: r,
682
+ error: "Controlled mode without onItemsChange"
683
+ }
684
+ ]
685
+ };
686
+ const u = me(
687
+ [r],
688
+ o,
689
+ n
690
+ );
691
+ return A(u, "add", t), {
692
+ successful: u,
693
+ failed: []
694
+ };
563
695
  }
564
- const c = R.current.length;
565
- if (ee(), !b((i) => fe(i, [r], n)))
566
- return { successful: [], failed: [{ index: -1, item: r, error: "Controlled mode without onItemsChange" }] };
567
- const s = me([r], c, n);
568
- return A(s, "add", t), {
569
- successful: s,
570
- failed: []
696
+ } catch (r) {
697
+ return {
698
+ successful: [],
699
+ failed: [
700
+ {
701
+ index: -1,
702
+ item: e,
703
+ error: String(r)
704
+ }
705
+ ]
571
706
  };
572
- } else {
573
- const r = We(e), o = R.current.length;
574
- if (ee(), !b((s) => fe(s, [r], n)))
575
- return { successful: [], failed: [{ index: -1, item: r, error: "Controlled mode without onItemsChange" }] };
576
- const u = me([r], o, n);
577
- return A(u, "add", t), {
578
- successful: u,
707
+ }
708
+ },
709
+ [b, ee, A]
710
+ ), tn = f(
711
+ async (e, t = {}) => {
712
+ const { position: n = "end" } = t;
713
+ if (e.length === 0)
714
+ return {
715
+ successful: [],
579
716
  failed: []
580
717
  };
581
- }
582
- } catch (r) {
583
- return {
584
- successful: [],
585
- failed: [{ index: -1, item: e, error: String(r) }]
586
- };
587
- }
588
- }, [b, ee, A]), tn = f(async (e, t = {}) => {
589
- const { position: n = "end" } = t;
590
- if (e.length === 0)
591
- return {
592
- successful: [],
593
- failed: []
594
- };
595
- try {
596
- if (ye.current) {
597
- const r = e.map((i) => We(i)), o = await ye.current(r, _.current);
598
- if (o) {
599
- if (o.successful.length > 0) {
600
- const i = R.current.length, S = o.successful.map(
601
- (m) => Ln(m.item)
602
- );
603
- if (ee(), !b((m) => fe(m, S, n)))
604
- return { successful: [], failed: S.map((m, h) => ({ index: h, item: m, error: "Controlled mode without onItemsChange" })) };
605
- const l = me(S, i, n);
606
- return A(l, "add", t), {
607
- ...o,
608
- successful: l
609
- };
718
+ try {
719
+ if (ye.current) {
720
+ const r = e.map(
721
+ (i) => We(i)
722
+ ), o = await ye.current(
723
+ r,
724
+ _.current
725
+ );
726
+ if (o) {
727
+ if (o.successful.length > 0) {
728
+ const i = R.current.length, S = o.successful.map(
729
+ (m) => Ln(m.item)
730
+ );
731
+ if (ee(), !b(
732
+ (m) => fe(m, S, n)
733
+ ))
734
+ return {
735
+ successful: [],
736
+ failed: S.map((m, h) => ({
737
+ index: h,
738
+ item: m,
739
+ error: "Controlled mode without onItemsChange"
740
+ }))
741
+ };
742
+ const l = me(
743
+ S,
744
+ i,
745
+ n
746
+ );
747
+ return A(l, "add", t), {
748
+ ...o,
749
+ successful: l
750
+ };
751
+ }
752
+ return { ...o, successful: [] };
610
753
  }
611
- return { ...o, successful: [] };
754
+ const c = R.current.length;
755
+ if (ee(), !b(
756
+ (i) => fe(i, r, n)
757
+ ))
758
+ return {
759
+ successful: [],
760
+ failed: r.map((i, S) => ({
761
+ index: S,
762
+ item: i,
763
+ error: "Controlled mode without onItemsChange"
764
+ }))
765
+ };
766
+ const s = me(
767
+ r,
768
+ c,
769
+ n
770
+ );
771
+ return A(s, "add", t), {
772
+ successful: s,
773
+ failed: []
774
+ };
775
+ } else {
776
+ const r = e.map(
777
+ (s) => We(s)
778
+ ), o = R.current.length;
779
+ if (ee(), !b(
780
+ (s) => fe(s, r, n)
781
+ ))
782
+ return {
783
+ successful: [],
784
+ failed: r.map((s, i) => ({
785
+ index: i,
786
+ item: s,
787
+ error: "Controlled mode without onItemsChange"
788
+ }))
789
+ };
790
+ const u = me(
791
+ r,
792
+ o,
793
+ n
794
+ );
795
+ return A(u, "add", t), {
796
+ successful: u,
797
+ failed: []
798
+ };
612
799
  }
613
- const c = R.current.length;
614
- if (ee(), !b((i) => fe(i, r, n)))
615
- return { successful: [], failed: r.map((i, S) => ({ index: S, item: i, error: "Controlled mode without onItemsChange" })) };
616
- const s = me(r, c, n);
617
- return A(s, "add", t), {
618
- successful: s,
619
- failed: []
620
- };
621
- } else {
622
- const r = e.map((s) => We(s)), o = R.current.length;
623
- if (ee(), !b((s) => fe(s, r, n)))
624
- return { successful: [], failed: r.map((s, i) => ({ index: i, item: s, error: "Controlled mode without onItemsChange" })) };
625
- const u = me(r, o, n);
626
- return A(u, "add", t), {
627
- successful: u,
628
- failed: []
800
+ } catch (r) {
801
+ return {
802
+ successful: [],
803
+ failed: e.map((o, c) => ({
804
+ index: c,
805
+ item: o,
806
+ error: String(r)
807
+ }))
629
808
  };
630
809
  }
631
- } catch (r) {
632
- return {
633
- successful: [],
634
- failed: e.map((o, c) => ({
635
- index: c,
636
- item: o,
637
- error: String(r)
638
- }))
639
- };
640
- }
641
- }, [b, ee, A]), nn = f(async (e, t, n = {}) => {
642
- const r = R.current;
643
- if (e < 0 || e >= r.length)
644
- return {
645
- successful: [],
646
- failed: [{ index: e, item: t, error: "Invalid index" }]
647
- };
648
- try {
649
- if (Re.current) {
650
- const s = await Re.current([{ index: e, item: t }], _.current);
651
- if (s) {
652
- const S = s.successful.filter(
653
- ({ index: h }) => h >= 0 && h < r.length
654
- ).map(({ index: h, item: E }) => {
655
- const V = sn(
656
- r,
657
- h,
658
- E,
659
- h === e ? t : void 0
810
+ },
811
+ [b, ee, A]
812
+ ), nn = f(
813
+ async (e, t, n = {}) => {
814
+ const r = R.current;
815
+ if (e < 0 || e >= r.length)
816
+ return {
817
+ successful: [],
818
+ failed: [{ index: e, item: t, error: "Invalid index" }]
819
+ };
820
+ try {
821
+ if (Re.current) {
822
+ const s = await Re.current(
823
+ [{ index: e, item: t }],
824
+ _.current
825
+ );
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(
831
+ r,
832
+ h,
833
+ E,
834
+ h === e ? t : void 0
835
+ );
836
+ return V ? { index: h, item: V } : null;
837
+ }).filter(
838
+ (h) => h !== null
660
839
  );
661
- return V ? { index: h, item: V } : null;
662
- }).filter((h) => h !== null);
663
- if (S.length) {
664
- if (!b((E) => {
665
- const V = [...E];
666
- return S.forEach(({ index: d, item: N }) => {
667
- V[d] = N;
668
- }), V;
669
- }))
670
- return { successful: [], failed: S.map(({ index: E, item: V }) => ({ index: E, item: V, error: "Controlled mode without onItemsChange" })) };
671
- A(S, "update", n);
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;
846
+ }))
847
+ return {
848
+ successful: [],
849
+ failed: S.map(({ index: E, item: V }) => ({
850
+ index: E,
851
+ item: V,
852
+ error: "Controlled mode without onItemsChange"
853
+ }))
854
+ };
855
+ A(S, "update", n);
856
+ }
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,
865
+ error: "Invalid index"
866
+ })).forEach((h) => {
867
+ x.has(h.index) || l.push(h);
868
+ }), { successful: S, failed: l };
672
869
  }
673
- const x = new Set(s.failed.map((h) => h.index)), l = [...s.failed];
674
- return s.successful.filter(({ index: h }) => h < 0 || h >= r.length).map(({ index: h, item: E }) => ({
675
- index: h,
676
- item: E,
677
- error: "Invalid index"
678
- })).forEach((h) => {
679
- x.has(h.index) || l.push(h);
680
- }), { successful: S, failed: l };
681
870
  }
871
+ let o;
872
+ if (!b((s) => {
873
+ o = { ...s[e], ...t };
874
+ const i = [...s];
875
+ return i[e] = o, i;
876
+ }))
877
+ return {
878
+ successful: [],
879
+ failed: [
880
+ {
881
+ index: e,
882
+ item: t,
883
+ error: "Controlled mode without onItemsChange"
884
+ }
885
+ ]
886
+ };
887
+ const u = [{ index: e, item: o }];
888
+ return A(u, "update", n), { successful: u, failed: [] };
889
+ } catch (o) {
890
+ return {
891
+ successful: [],
892
+ failed: [{ index: e, item: t, error: String(o) }]
893
+ };
682
894
  }
683
- let o;
684
- if (!b((s) => {
685
- o = { ...s[e], ...t };
686
- const i = [...s];
687
- return i[e] = o, i;
688
- }))
689
- return { successful: [], failed: [{ index: e, item: t, error: "Controlled mode without onItemsChange" }] };
690
- const u = [{ index: e, item: o }];
691
- return A(u, "update", n), { successful: u, failed: [] };
692
- } catch (o) {
693
- return {
694
- successful: [],
695
- failed: [{ index: e, item: t, error: String(o) }]
696
- };
697
- }
698
- }, [b, A]), rn = f(async (e, t = {}) => {
699
- if (!e.length) return { successful: [], failed: [] };
700
- 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(({ index: s }) => r(s)), u = /* @__PURE__ */ new Map();
701
- c.forEach(({ index: s, item: i }) => {
702
- u.set(s, i);
703
- });
704
- try {
705
- if (Re.current) {
706
- const x = await Re.current(e, _.current);
707
- if (x) {
708
- const m = x.successful.filter(({ index: d }) => r(d)).map(({ index: d, item: N }) => {
709
- const F = sn(
710
- n,
711
- d,
712
- N,
713
- u.get(d)
895
+ },
896
+ [b, A]
897
+ ), rn = f(
898
+ async (e, t = {}) => {
899
+ 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)
902
+ ), u = /* @__PURE__ */ new Map();
903
+ c.forEach(({ index: s, item: i }) => {
904
+ u.set(s, i);
905
+ });
906
+ try {
907
+ if (Re.current) {
908
+ const x = await Re.current(
909
+ e,
910
+ _.current
911
+ );
912
+ if (x) {
913
+ const m = x.successful.filter(
914
+ ({ index: d }) => r(d)
915
+ ).map(({ index: d, item: N }) => {
916
+ const F = sn(
917
+ n,
918
+ d,
919
+ N,
920
+ u.get(d)
921
+ );
922
+ return F ? { index: d, item: F } : null;
923
+ }).filter(
924
+ (d) => d !== null
714
925
  );
715
- return F ? { index: d, item: F } : null;
716
- }).filter((d) => d !== null);
717
- if (m.length) {
718
- if (!b((N) => {
719
- const F = [...N];
720
- return m.forEach(({ index: Nn, item: ot }) => {
721
- F[Nn] = ot;
722
- }), F;
723
- }))
724
- return { successful: [], failed: m.map(({ index: N, item: F }) => ({ index: N, item: F, error: "Controlled mode without onItemsChange" })) };
725
- A(m, "update", t);
926
+ if (m.length) {
927
+ if (!b((N) => {
928
+ const F = [...N];
929
+ return m.forEach(({ index: Nn, item: ot }) => {
930
+ F[Nn] = ot;
931
+ }), F;
932
+ }))
933
+ return {
934
+ successful: [],
935
+ failed: m.map(({ index: N, item: F }) => ({
936
+ index: N,
937
+ item: F,
938
+ error: "Controlled mode without onItemsChange"
939
+ }))
940
+ };
941
+ A(m, "update", t);
942
+ }
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,
948
+ item: N,
949
+ error: "Invalid index"
950
+ })).forEach((d) => {
951
+ h.has(d.index) || E.push(d);
952
+ }), { successful: m, failed: E };
726
953
  }
727
- const h = new Set(x.failed.map((d) => d.index)), E = [...x.failed];
728
- return o.forEach((d) => {
729
- h.has(d.index) || E.push(d);
730
- }), x.successful.filter(({ index: d }) => !r(d)).map(({ index: d, item: N }) => ({ index: d, item: N, error: "Invalid index" })).forEach((d) => {
731
- h.has(d.index) || E.push(d);
732
- }), { successful: m, failed: E };
733
954
  }
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 }) : {
962
+ successful: [],
963
+ failed: c.map(({ index: x, item: l }) => ({
964
+ index: x,
965
+ item: l,
966
+ error: "Controlled mode without onItemsChange"
967
+ }))
968
+ };
969
+ } catch (s) {
970
+ return {
971
+ successful: [],
972
+ failed: e.map(({ index: i, item: S }) => ({
973
+ index: i,
974
+ item: S,
975
+ error: String(s)
976
+ }))
977
+ };
734
978
  }
735
- const s = [], i = [...o];
736
- return b((x) => {
737
- const l = [...x];
738
- return c.forEach(({ index: m, item: h }) => {
739
- l[m] = { ...l[m], ...h }, s.push({ index: m, item: l[m] });
740
- }), l;
741
- }) ? (A(s, "update", t), { successful: s, failed: i }) : { successful: [], failed: c.map(({ index: x, item: l }) => ({ index: x, item: l, error: "Controlled mode without onItemsChange" })) };
742
- } catch (s) {
743
- return {
744
- successful: [],
745
- failed: e.map(({ index: i, item: S }) => ({
746
- index: i,
747
- item: S,
748
- error: String(s)
749
- }))
750
- };
751
- }
752
- }, [b, A]), sn = (e, t, n, r) => {
979
+ },
980
+ [b, A]
981
+ ), sn = (e, t, n, r) => {
753
982
  const o = e[t];
754
983
  if (!o)
755
984
  return null;
@@ -766,208 +995,301 @@ const ls = ({
766
995
  ...n,
767
996
  _rowId: n._rowId ?? r._rowId
768
997
  } : r : null;
769
- }, cn = f(async (e) => {
770
- const t = R.current;
771
- if (e < 0 || e >= t.length)
772
- return {
773
- successful: [],
774
- failed: [{ index: e, error: "Invalid index" }]
775
- };
776
- try {
777
- if (ve.current) {
778
- const o = t[e], c = await ve.current([{ index: e, item: o }], _.current);
779
- if (c) {
780
- const s = c.successful.filter(
781
- ({ index: l }) => l >= 0 && l < t.length
782
- ).map(({ index: l, item: m }) => {
783
- const h = on(t, l, m);
784
- return h ? { index: l, item: h } : null;
785
- }).filter((l) => l !== null);
786
- if (s.length && !b((m) => m.filter((h, E) => E !== e)))
787
- return { successful: [], failed: [{ index: e, error: "Controlled mode without onItemsChange" }] };
788
- const i = new Set(c.failed.map((l) => l.index)), S = [...c.failed];
789
- return c.successful.filter(({ index: l }) => l < 0 || l >= t.length).map(({ index: l, item: m }) => ({
790
- index: l,
791
- item: m,
792
- error: "Invalid index"
793
- })).forEach((l) => {
794
- i.has(l.index) || S.push(l);
795
- }), { successful: s, failed: S };
998
+ }, cn = f(
999
+ async (e) => {
1000
+ const t = R.current;
1001
+ if (e < 0 || e >= t.length)
1002
+ return {
1003
+ successful: [],
1004
+ failed: [{ index: e, error: "Invalid index" }]
1005
+ };
1006
+ try {
1007
+ if (ve.current) {
1008
+ const o = t[e], c = await ve.current(
1009
+ [{ index: e, item: o }],
1010
+ _.current
1011
+ );
1012
+ 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(
1017
+ t,
1018
+ l,
1019
+ m
1020
+ );
1021
+ return h ? { index: l, item: h } : null;
1022
+ }).filter(
1023
+ (l) => l !== null
1024
+ );
1025
+ if (s.length && !b(
1026
+ (m) => m.filter((h, E) => E !== e)
1027
+ ))
1028
+ return {
1029
+ successful: [],
1030
+ failed: [
1031
+ { index: e, error: "Controlled mode without onItemsChange" }
1032
+ ]
1033
+ };
1034
+ const i = new Set(
1035
+ c.failed.map((l) => l.index)
1036
+ ), S = [...c.failed];
1037
+ return c.successful.filter(
1038
+ ({ index: l }) => l < 0 || l >= t.length
1039
+ ).map(({ index: l, item: m }) => ({
1040
+ index: l,
1041
+ item: m,
1042
+ error: "Invalid index"
1043
+ })).forEach((l) => {
1044
+ i.has(l.index) || S.push(l);
1045
+ }), { successful: s, failed: S };
1046
+ }
796
1047
  }
1048
+ let n;
1049
+ return b((o) => (n = o[e], o.filter((c, u) => u !== e))) ? { successful: [{ index: e, item: n }], failed: [] } : {
1050
+ successful: [],
1051
+ failed: [{ index: e, error: "Controlled mode without onItemsChange" }]
1052
+ };
1053
+ } catch (n) {
1054
+ return {
1055
+ successful: [],
1056
+ failed: [{ index: e, error: String(n) }]
1057
+ };
797
1058
  }
798
- let n;
799
- return b((o) => (n = o[e], o.filter((c, u) => u !== e))) ? { successful: [{ index: e, item: n }], failed: [] } : { successful: [], failed: [{ index: e, error: "Controlled mode without onItemsChange" }] };
800
- } catch (n) {
801
- return {
802
- successful: [],
803
- failed: [{ index: e, error: String(n) }]
804
- };
805
- }
806
- }, [b]), ln = f(async (e) => {
807
- if (!e.length) return { successful: [], failed: [] };
808
- const t = R.current, n = Array.from(new Set(e)), { validIndexes: r, invalidFailures: o } = n.reduce(
809
- (s, i) => (i >= 0 && i < t.length ? s.validIndexes.push(i) : s.invalidFailures.push({ index: i, error: "Invalid index" }), s),
810
- { validIndexes: [], invalidFailures: [] }
811
- ), c = n.map((s) => ({ index: s, item: t[s] })), u = new Set(r);
812
- try {
813
- if (ve.current) {
814
- const x = await ve.current(c, _.current);
815
- if (x) {
816
- const l = x.successful.filter(({ index: d }) => u.has(d)), m = l.map(({ index: d, item: N }) => {
817
- const F = on(t, d, N);
818
- return F ? { index: d, item: F } : null;
819
- }).filter((d) => d !== null);
820
- if (l.length) {
821
- const d = new Set(m.map((F) => F.index));
822
- if (!b((F) => F.filter((Nn, ot) => !d.has(ot))))
823
- return { successful: [], failed: m.map(({ index: F }) => ({ index: F, error: "Controlled mode without onItemsChange" })) };
1059
+ },
1060
+ [b]
1061
+ ), ln = f(
1062
+ async (e) => {
1063
+ 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),
1066
+ {
1067
+ validIndexes: [],
1068
+ invalidFailures: []
1069
+ }
1070
+ ), c = n.map((s) => ({
1071
+ index: s,
1072
+ item: t[s]
1073
+ })), u = new Set(r);
1074
+ try {
1075
+ if (ve.current) {
1076
+ const x = await ve.current(
1077
+ c,
1078
+ _.current
1079
+ );
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(
1085
+ t,
1086
+ d,
1087
+ N
1088
+ );
1089
+ return F ? { index: d, item: F } : null;
1090
+ }).filter(
1091
+ (d) => d !== null
1092
+ );
1093
+ if (l.length) {
1094
+ const d = new Set(m.map((F) => F.index));
1095
+ if (!b(
1096
+ (F) => F.filter((Nn, ot) => !d.has(ot))
1097
+ ))
1098
+ return {
1099
+ successful: [],
1100
+ failed: m.map(({ index: F }) => ({
1101
+ index: F,
1102
+ error: "Controlled mode without onItemsChange"
1103
+ }))
1104
+ };
1105
+ }
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,
1111
+ item: N,
1112
+ error: "Invalid index"
1113
+ })).forEach((d) => {
1114
+ h.has(d.index) || E.push(d);
1115
+ }), { successful: m, failed: E };
824
1116
  }
825
- const h = new Set(x.failed.map((d) => d.index)), E = [...x.failed];
826
- return o.forEach((d) => {
827
- h.has(d.index) || E.push(d);
828
- }), x.successful.filter(({ index: d }) => !u.has(d)).map(({ index: d, item: N }) => ({ index: d, item: N, error: "Invalid index" })).forEach((d) => {
829
- h.has(d.index) || E.push(d);
830
- }), { successful: m, failed: E };
831
1117
  }
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 } : {
1125
+ successful: [],
1126
+ failed: r.map((x) => ({
1127
+ index: x,
1128
+ error: "Controlled mode without onItemsChange"
1129
+ }))
1130
+ };
1131
+ } catch (s) {
1132
+ return {
1133
+ successful: [],
1134
+ failed: n.map((i) => ({
1135
+ index: i,
1136
+ error: String(s)
1137
+ }))
1138
+ };
832
1139
  }
833
- const s = new Set(r), i = [];
834
- return b((x) => {
835
- const l = [];
836
- return x.forEach((m, h) => {
837
- s.has(h) ? i.push({ index: h, item: m }) : l.push(m);
838
- }), l;
839
- }) ? { successful: i, failed: o } : { successful: [], failed: r.map((x) => ({ index: x, error: "Controlled mode without onItemsChange" })) };
840
- } catch (s) {
841
- return {
842
- successful: [],
843
- failed: n.map((i) => ({ index: i, error: String(s) }))
844
- };
845
- }
846
- }, [b]), an = f((e) => {
1140
+ },
1141
+ [b]
1142
+ ), an = f((e) => {
847
1143
  const t = Le.current.get(String(e));
848
1144
  return t !== void 0 ? R.current[t] : void 0;
849
- }, []), un = f((e) => R.current[e], []), dn = f((e) => {
850
- b(
851
- e.map((t) => ({ ...t, _rowId: t._rowId ?? it() }))
852
- );
853
- }, [b]), fn = f(() => {
1145
+ }, []), un = f((e) => R.current[e], []), dn = f(
1146
+ (e) => {
1147
+ b(
1148
+ e.map((t) => ({ ...t, _rowId: t._rowId ?? it() }))
1149
+ );
1150
+ },
1151
+ [b]
1152
+ ), fn = f(() => {
854
1153
  b([]);
855
- }, [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((e, t) => {
856
- const n = e ? {
857
- state: "loading",
858
- message: t?.title,
859
- description: t?.description
860
- } : { state: "none" };
861
- H || xe(n), j?.(n);
862
- }, [H, j]), In = f((e, t) => {
863
- const n = e ? {
864
- state: "error",
865
- message: t?.title,
866
- description: t?.description,
867
- onRetry: t?.onRetry,
868
- retryButtonText: t?.retryButtonText
869
- } : { state: "none" };
870
- H || xe(n), j?.(n);
871
- }, [H, j]), bn = f((e, t) => {
872
- const n = e ? {
873
- state: "partial-loading",
874
- message: t?.title,
875
- description: t?.description
876
- } : { state: "none" };
877
- H || xe(n), j?.(n);
878
- }, [H, j]), yn = f((e, t) => {
879
- const n = e ? {
880
- state: "empty",
881
- message: t?.title,
882
- description: t?.description,
883
- imageUrl: t?.imageUrl
884
- } : { state: "none" };
885
- H || xe(n), j?.(n);
886
- }, [H, j]), Rn = f(() => {
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(
1155
+ (e, t) => {
1156
+ const n = e ? {
1157
+ state: "loading",
1158
+ message: t?.title,
1159
+ description: t?.description
1160
+ } : { state: "none" };
1161
+ H || xe(n), j?.(n);
1162
+ },
1163
+ [H, j]
1164
+ ), In = f(
1165
+ (e, t) => {
1166
+ const n = e ? {
1167
+ state: "error",
1168
+ message: t?.title,
1169
+ description: t?.description,
1170
+ onRetry: t?.onRetry,
1171
+ retryButtonText: t?.retryButtonText
1172
+ } : { state: "none" };
1173
+ H || xe(n), j?.(n);
1174
+ },
1175
+ [H, j]
1176
+ ), bn = f(
1177
+ (e, t) => {
1178
+ const n = e ? {
1179
+ state: "partial-loading",
1180
+ message: t?.title,
1181
+ description: t?.description
1182
+ } : { state: "none" };
1183
+ H || xe(n), j?.(n);
1184
+ },
1185
+ [H, j]
1186
+ ), yn = f(
1187
+ (e, t) => {
1188
+ const n = e ? {
1189
+ state: "empty",
1190
+ message: t?.title,
1191
+ description: t?.description,
1192
+ imageUrl: t?.imageUrl
1193
+ } : { state: "none" };
1194
+ H || xe(n), j?.(n);
1195
+ },
1196
+ [H, j]
1197
+ ), Rn = f(() => {
887
1198
  const e = { state: "none" };
888
1199
  H || xe(e), j?.(e);
889
- }, [H, j]), vn = f(() => Ne.state, [Ne.state]), Fe = se(() => ({
890
- getFields: Ut,
891
- addItem: en,
892
- addItems: tn,
893
- updateItem: nn,
894
- updateItems: rn,
895
- deleteItem: cn,
896
- deleteItems: ln,
897
- getItem: an,
898
- getItemByIndex: un,
899
- getItems: gn,
900
- getItemsCount: pn,
901
- itemExists: hn,
902
- getItemIndex: mn,
903
- replaceAllItems: dn,
904
- clearItems: fn,
905
- deselectAllRows: Mt,
906
- getSelectedItems: Sn,
907
- getSelectedRows: wn,
908
- // Overlay methods
909
- setLoading: xn,
910
- setError: In,
911
- setPartialLoading: bn,
912
- setEmpty: yn,
913
- clearOverlay: Rn,
914
- getOverlayState: vn,
915
- // Sorting methods
916
- getSortingState: Vt,
917
- getPrimarySortedColumn: $t,
918
- hasActiveSorting: qt,
919
- setSortingState: Yt,
920
- clearSorting: Gt,
921
- // Filter methods
922
- getFilterableFields: Kt,
923
- getColumnFilters: Xt,
924
- hasActiveFilters: Jt,
925
- setColumnFilters: Zt,
926
- clearColumnFilters: Qt
927
- }), [
928
- en,
929
- tn,
930
- fn,
931
- Rn,
932
- cn,
933
- ln,
934
- Mt,
935
- a,
936
- Ut,
937
- an,
938
- un,
939
- mn,
940
- gn,
941
- pn,
942
- vn,
943
- Sn,
944
- wn,
945
- Vt,
946
- $t,
947
- qt,
948
- hn,
949
- dn,
950
- Gt,
951
- yn,
952
- In,
953
- xn,
954
- Yt,
955
- bn,
956
- nn,
957
- rn,
958
- // Filter methods
959
- Qt,
960
- Xt,
961
- Kt,
962
- Jt,
963
- Zt
1200
+ }, [H, j]), vn = f(() => Ne.state, [Ne.state]), Fe = se(
1201
+ () => ({
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,
1220
+ // Overlay methods
1221
+ setLoading: xn,
1222
+ setError: In,
1223
+ setPartialLoading: bn,
1224
+ setEmpty: yn,
1225
+ clearOverlay: Rn,
1226
+ getOverlayState: vn,
1227
+ // Sorting methods
1228
+ getSortingState: Vt,
1229
+ getPrimarySortedColumn: $t,
1230
+ hasActiveSorting: qt,
1231
+ setSortingState: Yt,
1232
+ clearSorting: Gt,
1233
+ // Filter methods
1234
+ getFilterableFields: Kt,
1235
+ getColumnFilters: Xt,
1236
+ hasActiveFilters: Jt,
1237
+ setColumnFilters: Zt,
1238
+ clearColumnFilters: Qt
1239
+ }),
1240
+ [
1241
+ en,
1242
+ tn,
1243
+ fn,
1244
+ Rn,
1245
+ cn,
1246
+ ln,
1247
+ Mt,
1248
+ a,
1249
+ Ut,
1250
+ an,
1251
+ un,
1252
+ mn,
1253
+ gn,
1254
+ pn,
1255
+ vn,
1256
+ Sn,
1257
+ wn,
1258
+ Vt,
1259
+ $t,
1260
+ qt,
1261
+ hn,
1262
+ dn,
1263
+ Gt,
1264
+ yn,
1265
+ In,
1266
+ xn,
1267
+ Yt,
1268
+ bn,
1269
+ nn,
1270
+ rn,
1271
+ // Filter methods
1272
+ Qt,
1273
+ Xt,
1274
+ Kt,
1275
+ Jt,
1276
+ Zt
1277
+ ]
1278
+ );
1279
+ _.current = Fe, fr.useImperativeHandle(jn, () => Fe, [
1280
+ Fe
964
1281
  ]);
965
- _.current = Fe, fr.useImperativeHandle(jn, () => Fe, [Fe]);
966
- const ir = f((e, t) => {
967
- t?.target && t.target.closest('[data-checkbox="true"]') || (I && At(e.index), T && T(e.original, e.index));
968
- }, [I, T, At]), lr = f((e, t) => {
969
- t?.target && t.target.closest('[data-checkbox="true"]') || He && He(e.original, e.index);
970
- }, [He]), Cn = se(() => B.map((e) => {
1282
+ const ir = f(
1283
+ (e, t) => {
1284
+ t?.target && t.target.closest('[data-checkbox="true"]') || (I && At(e.index), T && T(e.original, e.index));
1285
+ },
1286
+ [I, T, At]
1287
+ ), lr = f(
1288
+ (e, t) => {
1289
+ t?.target && t.target.closest('[data-checkbox="true"]') || He && He(e.original, e.index);
1290
+ },
1291
+ [He]
1292
+ ), Cn = se(() => B.map((e) => {
971
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);
972
1294
  return e.id === "select" ? `${Ae}px` : `${r}px`;
973
1295
  }).join(" "), [B, L, a]), Tn = w(!1);
@@ -978,8 +1300,16 @@ const ls = ({
978
1300
  const t = e.clientWidth;
979
1301
  if (t <= 0) return;
980
1302
  Tn.current = !0, zt(t);
981
- const n = ie ? On(t, B, a, L) : Pn(t, B, a, L, Te);
982
- n && (K.current = !0, Ie((r) => ie ? n : { ...r, ...n }), requestAnimationFrame(() => {
1303
+ const n = ie ? On(t, B, a, L) : Pn(
1304
+ t,
1305
+ B,
1306
+ a,
1307
+ L,
1308
+ Te
1309
+ );
1310
+ n && (K.current = !0, Ie(
1311
+ (r) => ie ? n : { ...r, ...n }
1312
+ ), requestAnimationFrame(() => {
983
1313
  K.current = !1;
984
1314
  }));
985
1315
  }), oe(() => {
@@ -992,7 +1322,12 @@ const ls = ({
992
1322
  }, [Je]), oe(() => {
993
1323
  if (!(!ie || Q <= 0) && !K.current)
994
1324
  return Se.current && clearTimeout(Se.current), Se.current = setTimeout(() => {
995
- const e = On(Q, B, a, L);
1325
+ const e = On(
1326
+ Q,
1327
+ B,
1328
+ a,
1329
+ L
1330
+ );
996
1331
  e && (K.current = !0, Ie(e), requestAnimationFrame(() => {
997
1332
  K.current = !1;
998
1333
  }));
@@ -1002,7 +1337,13 @@ const ls = ({
1002
1337
  }, [ie, Q, B, a]), oe(() => {
1003
1338
  if (!(ie || Q <= 0))
1004
1339
  return we.current && clearTimeout(we.current), we.current = setTimeout(() => {
1005
- const e = Pn(Q, B, a, L, Te);
1340
+ const e = Pn(
1341
+ Q,
1342
+ B,
1343
+ a,
1344
+ L,
1345
+ Te
1346
+ );
1006
1347
  e && (K.current = !0, Ie((t) => ({ ...t, ...e })), requestAnimationFrame(() => {
1007
1348
  K.current = !1;
1008
1349
  }));
@@ -1010,7 +1351,16 @@ const ls = ({
1010
1351
  we.current && clearTimeout(we.current);
1011
1352
  };
1012
1353
  }, [ie, Q, Te, B, a]);
1013
- const En = Rr(Un, W), zn = vr(Vn, W), _e = Cr($n, W), Fn = Tr(qn, W), Mn = Fn ? [...mt, Fn] : mt, ar = En ? [...Mn, En] : Mn, st = [];
1354
+ const En = Rr(Un, W), zn = vr(
1355
+ Vn,
1356
+ W
1357
+ ), _e = Cr(
1358
+ $n,
1359
+ W
1360
+ ), Fn = Tr(
1361
+ qn,
1362
+ W
1363
+ ), Mn = Fn ? [...mt, Fn] : mt, ar = En ? [...Mn, En] : Mn, st = [];
1014
1364
  zn && st.push(zn);
1015
1365
  const ur = _e ? [...st, ...ht, _e] : [...st, ...ht], dr = _e ? [...pt, _e] : pt, An = /* @__PURE__ */ ct(
1016
1366
  xr,
@@ -1033,8 +1383,12 @@ const ls = ({
1033
1383
  tableMethods: Fe,
1034
1384
  alwaysButtons: De(ar),
1035
1385
  noSelectionButtons: De(Yn),
1036
- singleSelectionButtons: De(ur),
1037
- multiSelectionButtons: De(dr),
1386
+ singleSelectionButtons: De(
1387
+ ur
1388
+ ),
1389
+ multiSelectionButtons: De(
1390
+ dr
1391
+ ),
1038
1392
  selectedRows: Fe.getSelectedRows(),
1039
1393
  localeText: W
1040
1394
  }
@@ -1129,7 +1483,13 @@ const ls = ({
1129
1483
  },
1130
1484
  "aria-live": "polite",
1131
1485
  "aria-label": W.loadingMoreAriaLabel,
1132
- children: /* @__PURE__ */ D(Ir, { size: "tiny", label: W.loadingMoreSpinnerLabel })
1486
+ children: /* @__PURE__ */ D(
1487
+ Ir,
1488
+ {
1489
+ size: "tiny",
1490
+ label: W.loadingMoreSpinnerLabel
1491
+ }
1492
+ )
1133
1493
  }
1134
1494
  )
1135
1495
  ]