@techzyapp/ui-library 1.0.19 → 1.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Table-Dvna5_TR.cjs → Table--pDmXYad.cjs} +2 -2
- package/dist/{Table-Dvna5_TR.cjs.map → Table--pDmXYad.cjs.map} +1 -1
- package/dist/{Table-tPOJ9umi.js → Table-CNjnvZ-k.js} +128 -128
- package/dist/{Table-tPOJ9umi.js.map → Table-CNjnvZ-k.js.map} +1 -1
- package/dist/components/Table/index.cjs +1 -1
- package/dist/components/Table/index.js +1 -1
- package/dist/entries/components.cjs +1 -1
- package/dist/entries/components.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as y, Fragment as Nt, jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import { useState as
|
|
3
|
-
import { clsx as
|
|
2
|
+
import { useState as P, useId as ln, forwardRef as cn, useRef as Y, useMemo as q, useEffect as O, useCallback as dn } from "react";
|
|
3
|
+
import { clsx as W } from "clsx";
|
|
4
4
|
import { useReactTable as mn, getSortedRowModel as un, getFilteredRowModel as fn, getPaginationRowModel as pn, getCoreRowModel as gn } from "@tanstack/react-table";
|
|
5
5
|
import { useSensors as hn, useSensor as pt, PointerSensor as yn, KeyboardSensor as _n, DndContext as bn, closestCenter as Sn } from "@dnd-kit/core";
|
|
6
6
|
import { sortableKeyboardCoordinates as xn, SortableContext as wn, verticalListSortingStrategy as vn, arrayMove as kn, useSortable as Nn } from "@dnd-kit/sortable";
|
|
@@ -10,7 +10,7 @@ import { B as Tt } from "./Badge-DSWigoGC.js";
|
|
|
10
10
|
import { B as yt } from "./Button-BkjZ7wEu.js";
|
|
11
11
|
import { D as Pe } from "./DatePicker-pz634ktl.js";
|
|
12
12
|
import { D as $e } from "./DateTimePicker-BJLq9Fud.js";
|
|
13
|
-
import { I as
|
|
13
|
+
import { I as B } from "./Icon-CophpkHo.js";
|
|
14
14
|
import { I as He } from "./IconButton-DpTxmj3d.js";
|
|
15
15
|
import { M as Mn } from "./Modal-Us_E-lb2.js";
|
|
16
16
|
import { M as Rn } from "./MultiSelect-sKk2KzOd.js";
|
|
@@ -20,7 +20,7 @@ import { S as Mt } from "./Select-UygxT1Ry.js";
|
|
|
20
20
|
import { S as Cn } from "./Slider-oGXd5e9X.js";
|
|
21
21
|
import { T as Rt } from "./TextField-CRCYLPpr.js";
|
|
22
22
|
import { T as Ae } from "./TimePicker-D51QkQYy.js";
|
|
23
|
-
import { T as
|
|
23
|
+
import { T as G } from "./Typography-Cta6Rg4L.js";
|
|
24
24
|
import { a as ue, k as zn } from "./ConfigProvider-DDuIJSM7.js";
|
|
25
25
|
import { D as _t } from "./Dropdown-FfkmluRu.js";
|
|
26
26
|
import { E as In } from "./EmptyState-B2QPNhWW.js";
|
|
@@ -192,7 +192,7 @@ function wt(t, n, r = {}) {
|
|
|
192
192
|
}
|
|
193
193
|
return p;
|
|
194
194
|
}
|
|
195
|
-
const On = "_fields_xa8i1_2", Wn = "_field_xa8i1_2", Hn = "_rangeLabel_xa8i1_15", Bn = "_row_xa8i1_20", Qn = "_rangeSep_xa8i1_30", Un = "_stack_xa8i1_36", qn = "_footer_xa8i1_43", Gn = "_footerEnd_xa8i1_50",
|
|
195
|
+
const On = "_fields_xa8i1_2", Wn = "_field_xa8i1_2", Hn = "_rangeLabel_xa8i1_15", Bn = "_row_xa8i1_20", Qn = "_rangeSep_xa8i1_30", Un = "_stack_xa8i1_36", qn = "_footer_xa8i1_43", Gn = "_footerEnd_xa8i1_50", H = {
|
|
196
196
|
fields: On,
|
|
197
197
|
field: Wn,
|
|
198
198
|
rangeLabel: Hn,
|
|
@@ -212,14 +212,14 @@ function de({
|
|
|
212
212
|
to: r,
|
|
213
213
|
stacked: o
|
|
214
214
|
}) {
|
|
215
|
-
return /* @__PURE__ */ y("div", { className:
|
|
216
|
-
/* @__PURE__ */ a(
|
|
217
|
-
o ? /* @__PURE__ */ y("div", { className:
|
|
215
|
+
return /* @__PURE__ */ y("div", { className: H.field, children: [
|
|
216
|
+
/* @__PURE__ */ a(G, { variant: "bodySmall", className: H.rangeLabel, children: t }),
|
|
217
|
+
o ? /* @__PURE__ */ y("div", { className: H.stack, children: [
|
|
218
218
|
n,
|
|
219
219
|
r
|
|
220
|
-
] }) : /* @__PURE__ */ y("div", { className:
|
|
220
|
+
] }) : /* @__PURE__ */ y("div", { className: H.row, children: [
|
|
221
221
|
n,
|
|
222
|
-
/* @__PURE__ */ a("span", { className:
|
|
222
|
+
/* @__PURE__ */ a("span", { className: H.rangeSep, "aria-hidden": !0, children: "–" }),
|
|
223
223
|
r
|
|
224
224
|
] })
|
|
225
225
|
] });
|
|
@@ -288,12 +288,12 @@ function Vn({
|
|
|
288
288
|
step: t.step ?? 1,
|
|
289
289
|
value: [c ?? s, _ ?? l],
|
|
290
290
|
valueLabel: (S) => {
|
|
291
|
-
const [
|
|
292
|
-
return `${
|
|
291
|
+
const [R, F] = S;
|
|
292
|
+
return `${R} – ${F}`;
|
|
293
293
|
},
|
|
294
294
|
onChange: (S) => {
|
|
295
|
-
const [
|
|
296
|
-
r([
|
|
295
|
+
const [R, F] = S;
|
|
296
|
+
r([R <= s ? null : R, F >= l ? null : F]);
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
299
|
);
|
|
@@ -439,13 +439,13 @@ function Vn({
|
|
|
439
439
|
}
|
|
440
440
|
}
|
|
441
441
|
function Yn({ filters: t, value: n, onChange: r }) {
|
|
442
|
-
const o = ue(), [g, m] =
|
|
442
|
+
const o = ue(), [g, m] = P(!1), [p, f] = P(n), s = Pn(t, n), l = ln(), c = () => {
|
|
443
443
|
f(n), m(!0);
|
|
444
444
|
}, _ = () => {
|
|
445
445
|
r(p), m(!1);
|
|
446
446
|
};
|
|
447
447
|
return /* @__PURE__ */ y(Nt, { children: [
|
|
448
|
-
/* @__PURE__ */ a(Tt, { content: s, color: "primary", children: /* @__PURE__ */ a(He, { variant: "filled", size: "sm", "aria-label": o("table.filters"), onClick: c, children: /* @__PURE__ */ a(
|
|
448
|
+
/* @__PURE__ */ a(Tt, { content: s, color: "primary", children: /* @__PURE__ */ a(He, { variant: "filled", size: "sm", "aria-label": o("table.filters"), onClick: c, children: /* @__PURE__ */ a(B, { name: "Filter" }) }) }),
|
|
449
449
|
/* @__PURE__ */ a(
|
|
450
450
|
Mn,
|
|
451
451
|
{
|
|
@@ -459,16 +459,16 @@ function Yn({ filters: t, value: n, onChange: r }) {
|
|
|
459
459
|
footer: (
|
|
460
460
|
// right-aligned: Clear (reset the draft fields) + Apply (commit). No Cancel — the Modal's × /
|
|
461
461
|
// Escape / backdrop dismiss the drawer, discarding the uncommitted draft.
|
|
462
|
-
/* @__PURE__ */ a("div", { className:
|
|
463
|
-
/* @__PURE__ */ a(yt, { variant: "text", startIcon: /* @__PURE__ */ a(
|
|
464
|
-
/* @__PURE__ */ a(yt, { type: "submit", form: l, startIcon: /* @__PURE__ */ a(
|
|
462
|
+
/* @__PURE__ */ a("div", { className: H.footer, children: /* @__PURE__ */ y("div", { className: H.footerEnd, children: [
|
|
463
|
+
/* @__PURE__ */ a(yt, { variant: "text", startIcon: /* @__PURE__ */ a(B, { name: "Trash" }), onClick: () => f({}), children: o("common.clear") }),
|
|
464
|
+
/* @__PURE__ */ a(yt, { type: "submit", form: l, startIcon: /* @__PURE__ */ a(B, { name: "Filter" }), children: o("common.apply") })
|
|
465
465
|
] }) })
|
|
466
466
|
),
|
|
467
467
|
children: /* @__PURE__ */ a(
|
|
468
468
|
"form",
|
|
469
469
|
{
|
|
470
470
|
id: l,
|
|
471
|
-
className:
|
|
471
|
+
className: H.fields,
|
|
472
472
|
onSubmit: (S) => {
|
|
473
473
|
S.preventDefault(), _();
|
|
474
474
|
},
|
|
@@ -477,7 +477,7 @@ function Yn({ filters: t, value: n, onChange: r }) {
|
|
|
477
477
|
{
|
|
478
478
|
filter: S,
|
|
479
479
|
value: p[S.key],
|
|
480
|
-
onChange: (
|
|
480
|
+
onChange: (R) => f((F) => ({ ...F, [S.key]: R }))
|
|
481
481
|
},
|
|
482
482
|
S.key
|
|
483
483
|
))
|
|
@@ -554,7 +554,7 @@ function Ar({
|
|
|
554
554
|
"tr",
|
|
555
555
|
{
|
|
556
556
|
ref: m,
|
|
557
|
-
className:
|
|
557
|
+
className: W(u.tr, r && u.clickable, s && u.dragging),
|
|
558
558
|
style: {
|
|
559
559
|
// Translate (not Transform) — skip dnd-kit's scaleX/scaleY, which would squish/stretch the
|
|
560
560
|
// dragged row to the target's size when rows have different heights; keep the row's own size
|
|
@@ -565,7 +565,7 @@ function Ar({
|
|
|
565
565
|
},
|
|
566
566
|
onClick: o,
|
|
567
567
|
children: [
|
|
568
|
-
/* @__PURE__ */ a("td", { className:
|
|
568
|
+
/* @__PURE__ */ a("td", { className: W(u.td, u.dragHandleCell), children: /* @__PURE__ */ a(
|
|
569
569
|
"button",
|
|
570
570
|
{
|
|
571
571
|
type: "button",
|
|
@@ -574,7 +574,7 @@ function Ar({
|
|
|
574
574
|
...l,
|
|
575
575
|
...c,
|
|
576
576
|
onClick: (_) => _.stopPropagation(),
|
|
577
|
-
children: /* @__PURE__ */ a(
|
|
577
|
+
children: /* @__PURE__ */ a(B, { name: "Menu", size: "sm" })
|
|
578
578
|
}
|
|
579
579
|
) }),
|
|
580
580
|
n
|
|
@@ -612,8 +612,8 @@ const pa = cn(function({
|
|
|
612
612
|
defaultPage: c = 1,
|
|
613
613
|
defaultPageSize: _ = 10,
|
|
614
614
|
pageSizeOptions: S = [10, 20, 50, 100, 200],
|
|
615
|
-
allowAllRows:
|
|
616
|
-
showPageSize:
|
|
615
|
+
allowAllRows: R = !0,
|
|
616
|
+
showPageSize: F = !0,
|
|
617
617
|
showFirstButton: Ct = !1,
|
|
618
618
|
showLastButton: zt = !1,
|
|
619
619
|
manualPagination: It = !1,
|
|
@@ -624,7 +624,7 @@ const pa = cn(function({
|
|
|
624
624
|
onExportToEmail: oe,
|
|
625
625
|
filters: b,
|
|
626
626
|
defaultFilters: Pt,
|
|
627
|
-
onRowClick:
|
|
627
|
+
onRowClick: Q,
|
|
628
628
|
actions: ie,
|
|
629
629
|
reorderable: Z = !1,
|
|
630
630
|
onReorder: Ge,
|
|
@@ -647,17 +647,17 @@ const pa = cn(function({
|
|
|
647
647
|
className: Ot,
|
|
648
648
|
...Wt
|
|
649
649
|
}, Ht) {
|
|
650
|
-
const k = ue(), Bt = zn(),
|
|
651
|
-
|
|
650
|
+
const k = ue(), Bt = zn(), U = Y({});
|
|
651
|
+
U.current = { ...Bt, ...Lt };
|
|
652
652
|
const se = Y(qe);
|
|
653
653
|
se.current = qe;
|
|
654
654
|
const xe = Y(b);
|
|
655
655
|
xe.current = b;
|
|
656
|
-
const Xe = Y(null), we = Y(null), [Ve, Qt] =
|
|
656
|
+
const Xe = Y(null), we = Y(null), [Ve, Qt] = P({ start: !1, end: !1 }), [$] = P(() => {
|
|
657
657
|
const e = ee && typeof window < "u" ? new URLSearchParams(window.location.search) : null;
|
|
658
658
|
return e ? {
|
|
659
|
-
...gt(e,
|
|
660
|
-
filters: b != null && b.length ? wt(b, e,
|
|
659
|
+
...gt(e, U.current),
|
|
660
|
+
filters: b != null && b.length ? wt(b, e, U.current) : {}
|
|
661
661
|
} : {
|
|
662
662
|
page: null,
|
|
663
663
|
size: null,
|
|
@@ -665,48 +665,48 @@ const pa = cn(function({
|
|
|
665
665
|
sort: null,
|
|
666
666
|
filters: {}
|
|
667
667
|
};
|
|
668
|
-
}), [Ye, Ut] =
|
|
669
|
-
pageIndex: (
|
|
670
|
-
pageSize:
|
|
671
|
-
})), [le, ve] =
|
|
668
|
+
}), [Ye, Ut] = P(() => ({
|
|
669
|
+
pageIndex: ($.page ?? c) - 1,
|
|
670
|
+
pageSize: $.size ?? _
|
|
671
|
+
})), [le, ve] = P($.search || s), [qt, Gt] = P($.search || s), [Je, Kt] = P(() => $.sort ? [{ id: $.sort.key, desc: $.sort.direction === "desc" }] : fe ? [{ id: fe.key, desc: fe.direction === "desc" }] : []), [Ze, jt] = P(() => ({
|
|
672
672
|
...Pt,
|
|
673
|
-
|
|
674
|
-
})),
|
|
673
|
+
...$.filters
|
|
674
|
+
})), N = It, et = Ke !== void 0, tt = je !== void 0, nt = te !== void 0, ke = ne !== void 0, Ne = be !== void 0, Te = {
|
|
675
675
|
pageIndex: et ? Ke - 1 : Ye.pageIndex,
|
|
676
676
|
pageSize: tt ? je : Ye.pageSize
|
|
677
|
-
},
|
|
677
|
+
}, C = nt ? te : qt, D = q(
|
|
678
678
|
() => ke ? ne ? [{ id: ne.key, desc: ne.direction === "desc" }] : [] : Je,
|
|
679
679
|
[ke, ne, Je]
|
|
680
|
-
), A =
|
|
680
|
+
), A = q(
|
|
681
681
|
() => Ne ? be : Ze,
|
|
682
682
|
[Ne, be, Ze]
|
|
683
|
-
),
|
|
683
|
+
), K = (e) => {
|
|
684
684
|
const i = Te, d = We(e, i);
|
|
685
685
|
d.pageIndex !== i.pageIndex && (ge == null || ge(d.pageIndex + 1)), d.pageSize !== i.pageSize && (he == null || he(d.pageSize)), Ut((h) => ({
|
|
686
686
|
pageIndex: et ? h.pageIndex : d.pageIndex,
|
|
687
687
|
pageSize: tt ? h.pageSize : d.pageSize
|
|
688
688
|
}));
|
|
689
|
-
}, Me = () =>
|
|
689
|
+
}, Me = () => K((e) => e.pageIndex === 0 ? e : { ...e, pageIndex: 0 }), Re = (e, i = !0) => {
|
|
690
690
|
nt || Gt(e), ye == null || ye(e), i && Me();
|
|
691
691
|
}, Fe = (e, i = !0) => {
|
|
692
692
|
const d = We(e, D);
|
|
693
693
|
ke || Kt(d), _e == null || _e(d[0] ? { key: d[0].id, direction: d[0].desc ? "desc" : "asc" } : null), i && Me();
|
|
694
694
|
}, rt = (e, i = !0) => {
|
|
695
695
|
Ne || jt(e), Se == null || Se(e), i && Me();
|
|
696
|
-
}, Xt =
|
|
697
|
-
() => b && b.length > 0 &&
|
|
698
|
-
[b,
|
|
699
|
-
), Vt = rt, Yt =
|
|
696
|
+
}, Xt = q(
|
|
697
|
+
() => b && b.length > 0 && !N ? En(r, b, A) : r,
|
|
698
|
+
[b, N, r, A]
|
|
699
|
+
), Vt = rt, Yt = q(
|
|
700
700
|
() => n.map((e) => ({
|
|
701
701
|
id: e.key,
|
|
702
702
|
accessorFn: (i) => i[e.key],
|
|
703
703
|
enableSorting: !!e.sortable
|
|
704
704
|
})),
|
|
705
705
|
[n]
|
|
706
|
-
), Jt =
|
|
706
|
+
), Jt = q(() => {
|
|
707
707
|
const e = S.map((i) => ({ value: String(i), label: String(i) }));
|
|
708
|
-
return
|
|
709
|
-
}, [S,
|
|
708
|
+
return R ? [...e, { value: "all", label: k("common.all") }] : e;
|
|
709
|
+
}, [S, R]), Ce = q(() => {
|
|
710
710
|
if (!ie) return n;
|
|
711
711
|
const e = {
|
|
712
712
|
key: "__actions",
|
|
@@ -718,7 +718,7 @@ const pa = cn(function({
|
|
|
718
718
|
cell: (i, d) => /* @__PURE__ */ a("div", { className: u.rowActions, onClick: (h) => h.stopPropagation(), children: ie(i, d) })
|
|
719
719
|
};
|
|
720
720
|
return [...n, e];
|
|
721
|
-
}, [n, ie]), ze =
|
|
721
|
+
}, [n, ie]), ze = q(() => n.filter((e) => e.sortable), [n]), Zt = (e) => Fe((i) => {
|
|
722
722
|
const d = i[0];
|
|
723
723
|
return !d || d.id !== e ? [{ id: e, desc: !1 }] : d.desc ? [] : [{ id: e, desc: !0 }];
|
|
724
724
|
}), Ie = mn({
|
|
@@ -726,69 +726,69 @@ const pa = cn(function({
|
|
|
726
726
|
columns: Yt,
|
|
727
727
|
state: {
|
|
728
728
|
pagination: Te,
|
|
729
|
-
globalFilter:
|
|
729
|
+
globalFilter: C,
|
|
730
730
|
sorting: D
|
|
731
731
|
},
|
|
732
|
-
onPaginationChange:
|
|
733
|
-
onGlobalFilterChange: (e) => Re(We(e,
|
|
732
|
+
onPaginationChange: K,
|
|
733
|
+
onGlobalFilterChange: (e) => Re(We(e, C)),
|
|
734
734
|
onSortingChange: Fe,
|
|
735
735
|
globalFilterFn: "includesString",
|
|
736
736
|
// first click always sorts ascending (A→Z / 0→9), for every column type — the intuitive default
|
|
737
737
|
sortDescFirst: !1,
|
|
738
738
|
getCoreRowModel: gn(),
|
|
739
739
|
getRowId: o,
|
|
740
|
-
manualPagination:
|
|
741
|
-
manualFiltering:
|
|
742
|
-
manualSorting:
|
|
743
|
-
|
|
740
|
+
manualPagination: N,
|
|
741
|
+
manualFiltering: N,
|
|
742
|
+
manualSorting: N,
|
|
743
|
+
...N ? { rowCount: Ue ?? r.length } : {
|
|
744
744
|
getPaginationRowModel: pn(),
|
|
745
745
|
getFilteredRowModel: fn(),
|
|
746
746
|
getSortedRowModel: un()
|
|
747
747
|
}
|
|
748
|
-
}),
|
|
748
|
+
}), j = Ie.getRowModel().rows, en = hn(
|
|
749
749
|
pt(yn, { activationConstraint: { distance: 5 } }),
|
|
750
750
|
pt(_n, { coordinateGetter: xn })
|
|
751
751
|
), at = (e, i) => o ? o(e, i) : String(i), tn = (e) => {
|
|
752
752
|
const { active: i, over: d } = e;
|
|
753
753
|
if (!d || i.id === d.id || !Ge) return;
|
|
754
|
-
const h = r.findIndex((v, x) => at(v, x) === i.id),
|
|
755
|
-
h < 0 ||
|
|
756
|
-
},
|
|
757
|
-
|
|
754
|
+
const h = r.findIndex((v, x) => at(v, x) === i.id), I = r.findIndex((v, x) => at(v, x) === d.id);
|
|
755
|
+
h < 0 || I < 0 || Ge(kn(r, h, I), { id: String(i.id), from: h, to: I });
|
|
756
|
+
}, E = N ? Ue ?? r.length : Ie.getFilteredRowModel().rows.length, { pageIndex: T, pageSize: w } = Te, X = Math.max(1, Math.ceil(E / w)), ot = T + 1, nn = E === 0 ? 0 : T * w + 1, rn = N ? Math.min(E, T * w + j.length) : Math.min(E, ot * w);
|
|
757
|
+
O(() => {
|
|
758
758
|
te !== void 0 && ve(te);
|
|
759
|
-
}, [te]),
|
|
760
|
-
if (le ===
|
|
759
|
+
}, [te]), O(() => {
|
|
760
|
+
if (le === C) return;
|
|
761
761
|
const e = setTimeout(() => Re(le), l);
|
|
762
762
|
return () => clearTimeout(e);
|
|
763
|
-
}, [le,
|
|
764
|
-
N > 0 &&
|
|
765
|
-
}, [X, N]);
|
|
766
|
-
const
|
|
767
|
-
const e =
|
|
768
|
-
{ page: e, size: i, search:
|
|
769
|
-
|
|
763
|
+
}, [le, C, l]), O(() => {
|
|
764
|
+
N && E === 0 || T > 0 && T >= X && K((e) => ({ ...e, pageIndex: X - 1 }));
|
|
765
|
+
}, [X, T, N, E]);
|
|
766
|
+
const z = D[0] ? { key: D[0].id, direction: D[0].desc ? "desc" : "asc" } : null, it = () => {
|
|
767
|
+
const e = T + 1, i = w, d = ht(
|
|
768
|
+
{ page: e, size: i, search: C, sort: z },
|
|
769
|
+
U.current
|
|
770
770
|
);
|
|
771
|
-
return b != null && b.length && xt(b, A,
|
|
772
|
-
(h,
|
|
771
|
+
return b != null && b.length && xt(b, A, U.current).forEach(
|
|
772
|
+
(h, I) => d.append(I, h)
|
|
773
773
|
), {
|
|
774
774
|
page: e,
|
|
775
775
|
size: i,
|
|
776
|
-
search:
|
|
777
|
-
sort:
|
|
776
|
+
search: C,
|
|
777
|
+
sort: z,
|
|
778
778
|
filters: A,
|
|
779
779
|
params: d,
|
|
780
780
|
query: kt(d)
|
|
781
781
|
};
|
|
782
782
|
};
|
|
783
|
-
|
|
783
|
+
O(() => {
|
|
784
784
|
var e;
|
|
785
785
|
(e = se.current) == null || e.call(se, it());
|
|
786
|
-
}, [
|
|
786
|
+
}, [T, w, C, D, A]);
|
|
787
787
|
const st = oe != null, lt = b != null && b.length > 0, ct = dn(
|
|
788
|
-
(e, i, d, h,
|
|
788
|
+
(e, i, d, h, I) => {
|
|
789
789
|
if (typeof window > "u" || !ee) return;
|
|
790
|
-
const v =
|
|
791
|
-
x != null && x.length && xt(x,
|
|
790
|
+
const v = U.current, x = xe.current, V = ht({ page: e, size: i, search: d, sort: h }, v);
|
|
791
|
+
x != null && x.length && xt(x, I, v).forEach((M, L) => V.append(L, M));
|
|
792
792
|
const re = {
|
|
793
793
|
pageParam: "page",
|
|
794
794
|
sizeParam: "size",
|
|
@@ -797,31 +797,31 @@ const pa = cn(function({
|
|
|
797
797
|
sortOrderParam: "order",
|
|
798
798
|
...v
|
|
799
799
|
}, on = v.rangeMinSuffix ?? "Min", sn = v.rangeMaxSuffix ?? "Max", Le = [re.pageParam, re.sizeParam, re.searchParam, re.sortParam, re.sortOrderParam];
|
|
800
|
-
for (const
|
|
801
|
-
const
|
|
802
|
-
Le.push(
|
|
800
|
+
for (const M of x ?? []) {
|
|
801
|
+
const L = M.queryKey ?? M.key;
|
|
802
|
+
Le.push(L, L + on, L + sn);
|
|
803
803
|
}
|
|
804
804
|
const ce = new URLSearchParams(window.location.search);
|
|
805
|
-
for (const
|
|
806
|
-
(Le.includes(
|
|
807
|
-
V.forEach((
|
|
805
|
+
for (const M of [...ce.keys()])
|
|
806
|
+
(Le.includes(M) || Le.some((L) => M.startsWith(`${L}[`))) && ce.delete(M);
|
|
807
|
+
V.forEach((M, L) => ce.append(L, M));
|
|
808
808
|
const ut = kt(ce), ft = `${window.location.pathname}${ut ? `?${ut}` : ""}${window.location.hash}`;
|
|
809
809
|
ft !== `${window.location.pathname}${window.location.search}${window.location.hash}` && window.history.replaceState(window.history.state, "", ft);
|
|
810
810
|
},
|
|
811
811
|
[ee]
|
|
812
812
|
);
|
|
813
|
-
|
|
813
|
+
O(() => {
|
|
814
814
|
ct(
|
|
815
|
-
|
|
815
|
+
T + 1,
|
|
816
816
|
w,
|
|
817
|
-
F,
|
|
818
817
|
C,
|
|
818
|
+
z,
|
|
819
819
|
A
|
|
820
820
|
);
|
|
821
821
|
}, [
|
|
822
|
-
|
|
822
|
+
T,
|
|
823
823
|
w,
|
|
824
|
-
|
|
824
|
+
C,
|
|
825
825
|
D,
|
|
826
826
|
A,
|
|
827
827
|
ct
|
|
@@ -829,8 +829,8 @@ const pa = cn(function({
|
|
|
829
829
|
const dt = Y(() => {
|
|
830
830
|
});
|
|
831
831
|
dt.current = () => {
|
|
832
|
-
const e = new URLSearchParams(window.location.search), i =
|
|
833
|
-
|
|
832
|
+
const e = new URLSearchParams(window.location.search), i = U.current, d = gt(e, i);
|
|
833
|
+
K(() => ({
|
|
834
834
|
pageIndex: (d.page ?? c) - 1,
|
|
835
835
|
pageSize: d.size ?? w
|
|
836
836
|
})), ve(d.search), Re(d.search, !1), Fe(
|
|
@@ -839,19 +839,19 @@ const pa = cn(function({
|
|
|
839
839
|
);
|
|
840
840
|
const h = xe.current;
|
|
841
841
|
h != null && h.length && rt(wt(h, e, i), !1);
|
|
842
|
-
},
|
|
842
|
+
}, O(() => {
|
|
843
843
|
if (typeof window > "u" || !ee) return;
|
|
844
844
|
const e = () => dt.current();
|
|
845
845
|
return window.addEventListener("popstate", e), () => window.removeEventListener("popstate", e);
|
|
846
|
-
}, [ee]),
|
|
847
|
-
typeof process < "u" && process.env.NODE_ENV !== "production" && !o && (
|
|
846
|
+
}, [ee]), O(() => {
|
|
847
|
+
typeof process < "u" && process.env.NODE_ENV !== "production" && !o && (Q != null || ie != null || Z) && console.warn(
|
|
848
848
|
"[Table] No `getRowId` provided, so the row index is used as the React key. For a table with row interactions or changing / paged data, pass `getRowId` (e.g. `(row) => row.id`) so each row keeps its identity across sort / filter / refetch."
|
|
849
849
|
);
|
|
850
|
-
}, []),
|
|
850
|
+
}, []), O(() => {
|
|
851
851
|
const e = Xe.current;
|
|
852
852
|
if (!e) return;
|
|
853
853
|
const i = () => {
|
|
854
|
-
const h = e.scrollWidth > e.clientWidth + 1,
|
|
854
|
+
const h = e.scrollWidth > e.clientWidth + 1, I = e.scrollLeft <= 0, v = e.scrollLeft >= e.scrollWidth - e.clientWidth - 1, x = { start: h && !I, end: h && !v };
|
|
855
855
|
Qt((V) => V.start === x.start && V.end === x.end ? V : x);
|
|
856
856
|
};
|
|
857
857
|
i(), e.addEventListener("scroll", i, { passive: !0 });
|
|
@@ -863,7 +863,7 @@ const pa = cn(function({
|
|
|
863
863
|
const an = g != null || m != null || p || lt || ze.length > 0 || st, mt = (e) => Ce.map((i) => /* @__PURE__ */ a(
|
|
864
864
|
"td",
|
|
865
865
|
{
|
|
866
|
-
className:
|
|
866
|
+
className: W(
|
|
867
867
|
u.td,
|
|
868
868
|
i.pinned === "left" && u.pinnedLeft,
|
|
869
869
|
i.pinned === "right" && u.pinnedRight,
|
|
@@ -880,10 +880,10 @@ const pa = cn(function({
|
|
|
880
880
|
},
|
|
881
881
|
i.key
|
|
882
882
|
));
|
|
883
|
-
return /* @__PURE__ */ y("div", { ref: Ht, className:
|
|
883
|
+
return /* @__PURE__ */ y("div", { ref: Ht, className: W(u.root, Ot), ...Wt, children: [
|
|
884
884
|
an && /* @__PURE__ */ y("div", { className: u.toolbar, children: [
|
|
885
885
|
/* @__PURE__ */ y("div", { className: u.toolbarStart, children: [
|
|
886
|
-
g != null && /* @__PURE__ */ a(
|
|
886
|
+
g != null && /* @__PURE__ */ a(G, { variant: "h4", as: "div", className: u.title, children: g }),
|
|
887
887
|
p && /* @__PURE__ */ a(
|
|
888
888
|
Rt,
|
|
889
889
|
{
|
|
@@ -892,7 +892,7 @@ const pa = cn(function({
|
|
|
892
892
|
value: le,
|
|
893
893
|
onChange: (e) => ve(e.target.value),
|
|
894
894
|
placeholder: f ?? k("common.search"),
|
|
895
|
-
adornment: /* @__PURE__ */ a(
|
|
895
|
+
adornment: /* @__PURE__ */ a(B, { name: "SearchNormal" }),
|
|
896
896
|
"aria-label": k("common.search")
|
|
897
897
|
}
|
|
898
898
|
)
|
|
@@ -904,9 +904,9 @@ const pa = cn(function({
|
|
|
904
904
|
_t,
|
|
905
905
|
{
|
|
906
906
|
placement: "bottom-end",
|
|
907
|
-
trigger: /* @__PURE__ */ a(He, { variant: "filled", size: "sm", "aria-label": k("table.export"), children: /* @__PURE__ */ a(
|
|
907
|
+
trigger: /* @__PURE__ */ a(He, { variant: "filled", size: "sm", "aria-label": k("table.export"), children: /* @__PURE__ */ a(B, { name: "ExportArrow" }) }),
|
|
908
908
|
children: [
|
|
909
|
-
/* @__PURE__ */ a(
|
|
909
|
+
/* @__PURE__ */ a(G, { as: "div", variant: "caption", color: "muted", className: u.menuTitle, children: k("table.export") }),
|
|
910
910
|
/* @__PURE__ */ a(bt, { clickable: !0, icon: "Sms", onClick: () => oe == null ? void 0 : oe(it()), children: k("table.sendOnEmail") })
|
|
911
911
|
]
|
|
912
912
|
}
|
|
@@ -920,17 +920,17 @@ const pa = cn(function({
|
|
|
920
920
|
{
|
|
921
921
|
placement: "bottom-end",
|
|
922
922
|
closeOnSelect: !1,
|
|
923
|
-
trigger: /* @__PURE__ */ a(Tt, { dot: D.length > 0, color: "primary", children: /* @__PURE__ */ a(He, { variant: "filled", size: "sm", "aria-label": k("table.sort"), children: /* @__PURE__ */ a(
|
|
923
|
+
trigger: /* @__PURE__ */ a(Tt, { dot: D.length > 0, color: "primary", children: /* @__PURE__ */ a(He, { variant: "filled", size: "sm", "aria-label": k("table.sort"), children: /* @__PURE__ */ a(B, { name: "Sort" }) }) }),
|
|
924
924
|
children: [
|
|
925
|
-
/* @__PURE__ */ a(
|
|
925
|
+
/* @__PURE__ */ a(G, { as: "div", variant: "caption", color: "muted", className: u.menuTitle, children: k("table.sortBy") }),
|
|
926
926
|
ze.map((e) => {
|
|
927
|
-
const i = (
|
|
927
|
+
const i = (z == null ? void 0 : z.key) === e.key;
|
|
928
928
|
return /* @__PURE__ */ a(
|
|
929
929
|
bt,
|
|
930
930
|
{
|
|
931
931
|
clickable: !0,
|
|
932
932
|
selected: i,
|
|
933
|
-
trailing: i ? /* @__PURE__ */ a(
|
|
933
|
+
trailing: i ? /* @__PURE__ */ a(B, { name: (z == null ? void 0 : z.direction) === "desc" ? "ArrowDown" : "ArrowUp2" }) : void 0,
|
|
934
934
|
onClick: () => Zt(e.key),
|
|
935
935
|
children: e.header
|
|
936
936
|
},
|
|
@@ -962,7 +962,7 @@ const pa = cn(function({
|
|
|
962
962
|
"table",
|
|
963
963
|
{
|
|
964
964
|
ref: we,
|
|
965
|
-
className:
|
|
965
|
+
className: W(
|
|
966
966
|
u.table,
|
|
967
967
|
At && u.striped,
|
|
968
968
|
Et && u.hoverable,
|
|
@@ -970,7 +970,7 @@ const pa = cn(function({
|
|
|
970
970
|
),
|
|
971
971
|
children: [
|
|
972
972
|
/* @__PURE__ */ a("thead", { children: /* @__PURE__ */ y("tr", { children: [
|
|
973
|
-
Z && /* @__PURE__ */ a("th", { className:
|
|
973
|
+
Z && /* @__PURE__ */ a("th", { className: W(u.th, u.dragHandleCell), scope: "col", "aria-hidden": !0 }),
|
|
974
974
|
Ce.map((e) => {
|
|
975
975
|
var d;
|
|
976
976
|
const i = e.sortable && ((d = Ie.getColumn(e.key)) == null ? void 0 : d.getIsSorted()) || !1;
|
|
@@ -978,7 +978,7 @@ const pa = cn(function({
|
|
|
978
978
|
"th",
|
|
979
979
|
{
|
|
980
980
|
scope: "col",
|
|
981
|
-
className:
|
|
981
|
+
className: W(
|
|
982
982
|
u.th,
|
|
983
983
|
e.pinned === "left" && u.pinnedLeft,
|
|
984
984
|
e.pinned === "right" && u.pinnedRight,
|
|
@@ -999,30 +999,30 @@ const pa = cn(function({
|
|
|
999
999
|
);
|
|
1000
1000
|
})
|
|
1001
1001
|
] }) }),
|
|
1002
|
-
/* @__PURE__ */ a("tbody", { children:
|
|
1002
|
+
/* @__PURE__ */ a("tbody", { children: j.length > 0 ? Z ? (
|
|
1003
1003
|
// dnd-kit sortable rows — each `SortableRow` renders a leading drag-handle cell + `rowCells`
|
|
1004
1004
|
/* @__PURE__ */ a(
|
|
1005
1005
|
wn,
|
|
1006
1006
|
{
|
|
1007
|
-
items:
|
|
1007
|
+
items: j.map((e) => e.id),
|
|
1008
1008
|
strategy: vn,
|
|
1009
|
-
children:
|
|
1009
|
+
children: j.map((e) => /* @__PURE__ */ a(
|
|
1010
1010
|
Ar,
|
|
1011
1011
|
{
|
|
1012
1012
|
id: e.id,
|
|
1013
|
-
clickable: !!
|
|
1014
|
-
onClick:
|
|
1013
|
+
clickable: !!Q,
|
|
1014
|
+
onClick: Q ? () => Q(e.original, e.index) : void 0,
|
|
1015
1015
|
cells: mt(e)
|
|
1016
1016
|
},
|
|
1017
1017
|
e.id
|
|
1018
1018
|
))
|
|
1019
1019
|
}
|
|
1020
1020
|
)
|
|
1021
|
-
) :
|
|
1021
|
+
) : j.map((e) => /* @__PURE__ */ a(
|
|
1022
1022
|
"tr",
|
|
1023
1023
|
{
|
|
1024
|
-
className:
|
|
1025
|
-
onClick:
|
|
1024
|
+
className: W(u.tr, Q && u.clickable),
|
|
1025
|
+
onClick: Q ? () => Q(e.original, e.index) : void 0,
|
|
1026
1026
|
children: mt(e)
|
|
1027
1027
|
},
|
|
1028
1028
|
e.id
|
|
@@ -1036,7 +1036,7 @@ const pa = cn(function({
|
|
|
1036
1036
|
className: u.stateCell,
|
|
1037
1037
|
children: pe ? /* @__PURE__ */ y("div", { className: u.loadingState, children: [
|
|
1038
1038
|
/* @__PURE__ */ a(St, { size: "lg" }),
|
|
1039
|
-
/* @__PURE__ */ a(
|
|
1039
|
+
/* @__PURE__ */ a(G, { variant: "bodySmall", color: "muted", as: "span", children: "Loading…" })
|
|
1040
1040
|
] }) : $t ?? /* @__PURE__ */ a(In, {})
|
|
1041
1041
|
}
|
|
1042
1042
|
) })
|
|
@@ -1044,15 +1044,15 @@ const pa = cn(function({
|
|
|
1044
1044
|
]
|
|
1045
1045
|
}
|
|
1046
1046
|
),
|
|
1047
|
-
pe &&
|
|
1047
|
+
pe && j.length > 0 && /* @__PURE__ */ a("div", { className: u.loadingOverlay, children: /* @__PURE__ */ a(St, { size: "lg" }) })
|
|
1048
1048
|
]
|
|
1049
1049
|
}
|
|
1050
1050
|
) }),
|
|
1051
|
-
|
|
1052
|
-
/* @__PURE__ */ a(
|
|
1051
|
+
E > 0 && (F || X > 1) && /* @__PURE__ */ y("div", { className: u.footer, children: [
|
|
1052
|
+
/* @__PURE__ */ a(G, { variant: "bodySmall", color: "muted", as: "span", className: u.rangeText, children: k("table.range", { from: nn, to: rn, total: E }) }),
|
|
1053
1053
|
/* @__PURE__ */ y("div", { className: u.footerMain, children: [
|
|
1054
|
-
|
|
1055
|
-
/* @__PURE__ */ a(
|
|
1054
|
+
F && /* @__PURE__ */ y("div", { className: u.pageSize, children: [
|
|
1055
|
+
/* @__PURE__ */ a(G, { variant: "bodySmall", color: "muted", as: "span", children: k("table.rowsPerPage") }),
|
|
1056
1056
|
/* @__PURE__ */ a(
|
|
1057
1057
|
Mt,
|
|
1058
1058
|
{
|
|
@@ -1061,7 +1061,7 @@ const pa = cn(function({
|
|
|
1061
1061
|
clearable: !1,
|
|
1062
1062
|
showSelectedTick: !1,
|
|
1063
1063
|
value: w >= vt ? "all" : String(w),
|
|
1064
|
-
onChange: (e) =>
|
|
1064
|
+
onChange: (e) => K(() => ({
|
|
1065
1065
|
pageIndex: 0,
|
|
1066
1066
|
pageSize: e === "all" ? vt : Number(e)
|
|
1067
1067
|
})),
|
|
@@ -1074,7 +1074,7 @@ const pa = cn(function({
|
|
|
1074
1074
|
{
|
|
1075
1075
|
count: X,
|
|
1076
1076
|
page: ot,
|
|
1077
|
-
onChange: (e) =>
|
|
1077
|
+
onChange: (e) => K((i) => ({ ...i, pageIndex: e - 1 })),
|
|
1078
1078
|
showFirstButton: Ct,
|
|
1079
1079
|
showLastButton: zt,
|
|
1080
1080
|
disabled: pe
|
|
@@ -1087,4 +1087,4 @@ const pa = cn(function({
|
|
|
1087
1087
|
export {
|
|
1088
1088
|
pa as T
|
|
1089
1089
|
};
|
|
1090
|
-
//# sourceMappingURL=Table-
|
|
1090
|
+
//# sourceMappingURL=Table-CNjnvZ-k.js.map
|