wg-design 0.7.2 → 0.7.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.
package/dist/index.mjs
CHANGED
|
@@ -20661,39 +20661,75 @@ function ow(e) {
|
|
|
20661
20661
|
})), n.current;
|
|
20662
20662
|
}
|
|
20663
20663
|
//#endregion
|
|
20664
|
+
//#region src/components/WgDesignProvider/WgDesignProvider.tsx
|
|
20665
|
+
var sw = { table: {
|
|
20666
|
+
noResults: "No results found",
|
|
20667
|
+
filters: "Filters",
|
|
20668
|
+
filter: "Filter",
|
|
20669
|
+
dateRange: "Date range",
|
|
20670
|
+
selected: "selected",
|
|
20671
|
+
clear: "Clear",
|
|
20672
|
+
apply: "Apply",
|
|
20673
|
+
clearSearch: "Clear search",
|
|
20674
|
+
previous: "Previous",
|
|
20675
|
+
next: "Next",
|
|
20676
|
+
itemsPerPage: "per page",
|
|
20677
|
+
showingResults: ({ from: e, to: t, total: n }) => `Showing ${e}-${t} of ${n}`,
|
|
20678
|
+
sort: "Sort",
|
|
20679
|
+
sortBy: "Sort by",
|
|
20680
|
+
selectField: "Select field",
|
|
20681
|
+
sortDirection: "Sort direction",
|
|
20682
|
+
ascending: "Ascending",
|
|
20683
|
+
descending: "Descending",
|
|
20684
|
+
filterModalDescription: "Filter and sorting options"
|
|
20685
|
+
} }, cw = p.createContext(sw);
|
|
20686
|
+
function lw({ labels: e, children: t }) {
|
|
20687
|
+
let n = p.useMemo(() => ({ table: {
|
|
20688
|
+
...sw.table,
|
|
20689
|
+
...e?.table
|
|
20690
|
+
} }), [e]);
|
|
20691
|
+
return /* @__PURE__ */ D(cw.Provider, {
|
|
20692
|
+
value: n,
|
|
20693
|
+
children: t
|
|
20694
|
+
});
|
|
20695
|
+
}
|
|
20696
|
+
function uw() {
|
|
20697
|
+
return p.useContext(cw);
|
|
20698
|
+
}
|
|
20699
|
+
//#endregion
|
|
20664
20700
|
//#region src/components/Table/DataTableMobile.tsx
|
|
20665
|
-
var
|
|
20666
|
-
let n = (e) => e.columnDef.meta || {},
|
|
20667
|
-
if (!
|
|
20668
|
-
let t =
|
|
20701
|
+
var dw = ({ table: e, noResultsLabel: t }) => {
|
|
20702
|
+
let n = uw().table, r = (e) => e.columnDef.meta || {}, i = (e) => r(e).mobile || {}, a = e.getAllLeafColumns().find((e) => i(e).cardTitle), o = a ? i(a).cardIcon : void 0, s = (e) => {
|
|
20703
|
+
if (!a) return;
|
|
20704
|
+
let t = i(a).cardTitle;
|
|
20669
20705
|
if (typeof t == "string") return t;
|
|
20670
|
-
let n = e.getVisibleCells().find((e) => e.column.id ===
|
|
20706
|
+
let n = e.getVisibleCells().find((e) => e.column.id === a.id);
|
|
20671
20707
|
if (n) return nw(n.column.columnDef.cell, n.getContext());
|
|
20672
|
-
}, s = (e) => {
|
|
20673
|
-
let t = e.getVisibleCells().find((e) => r(e.column).primary);
|
|
20674
|
-
return t ? nw(t.column.columnDef.cell, t.getContext()) : null;
|
|
20675
20708
|
}, c = (e) => {
|
|
20676
|
-
let t = e.getVisibleCells().find((e) =>
|
|
20709
|
+
let t = e.getVisibleCells().find((e) => i(e.column).primary);
|
|
20710
|
+
return t ? nw(t.column.columnDef.cell, t.getContext()) : null;
|
|
20711
|
+
}, l = (e) => {
|
|
20712
|
+
let t = e.getVisibleCells().find((e) => i(e.column).action);
|
|
20677
20713
|
return t ? nw(t.column.columnDef.cell, t.getContext()) : null;
|
|
20678
|
-
},
|
|
20714
|
+
}, u = (e, t) => {
|
|
20679
20715
|
let n = t.getVisibleCells().find((t) => t.column.id === e)?.column;
|
|
20680
20716
|
if (!n) return !1;
|
|
20681
|
-
let
|
|
20682
|
-
return !!(
|
|
20683
|
-
},
|
|
20717
|
+
let r = i(n);
|
|
20718
|
+
return !!(r.primary || r.action || r.cardTitle || r.hideFromBody);
|
|
20719
|
+
}, d = (e) => {
|
|
20684
20720
|
let t = {};
|
|
20685
20721
|
return e.forEach((e) => {
|
|
20686
|
-
let n =
|
|
20687
|
-
t[
|
|
20722
|
+
let n = i(e.column).group, r = typeof n == "number" && !isNaN(n) ? n : 99;
|
|
20723
|
+
t[r] || (t[r] = []), t[r].push(e);
|
|
20688
20724
|
}), Object.entries(t).sort(([e], [t]) => Number(e) - Number(t)).map(([e, t], n, r) => /* @__PURE__ */ D("div", {
|
|
20689
20725
|
className: W(t.length > 1 ? "flex flex-wrap gap-4 border-b py-2" : "space-y-2 border-b py-2", n === r.length - 1 && "border-b-0"),
|
|
20690
20726
|
children: t.map((e) => /* @__PURE__ */ D("div", {
|
|
20691
20727
|
className: t.length > 1 ? "min-w-0 flex-1" : "",
|
|
20692
|
-
children:
|
|
20728
|
+
children: f(e)
|
|
20693
20729
|
}, e.id))
|
|
20694
20730
|
}, e));
|
|
20695
|
-
},
|
|
20696
|
-
let t = e.column, n =
|
|
20731
|
+
}, f = (e) => {
|
|
20732
|
+
let t = e.column, n = i(t).label || (typeof t.columnDef.header == "function" ? void 0 : t.columnDef.header);
|
|
20697
20733
|
return /* @__PURE__ */ O("dl", {
|
|
20698
20734
|
className: "space-y-1",
|
|
20699
20735
|
children: [n && /* @__PURE__ */ D("dt", {
|
|
@@ -20704,17 +20740,17 @@ var sw = ({ table: e, noResultsLabel: t = "No results found" }) => {
|
|
|
20704
20740
|
children: nw(t.columnDef.cell, e.getContext())
|
|
20705
20741
|
})]
|
|
20706
20742
|
});
|
|
20707
|
-
},
|
|
20743
|
+
}, p = e.getRowModel().rows;
|
|
20708
20744
|
return /* @__PURE__ */ D("div", {
|
|
20709
20745
|
className: "space-y-4",
|
|
20710
|
-
children:
|
|
20746
|
+
children: p.length === 0 ? /* @__PURE__ */ D("div", {
|
|
20711
20747
|
className: "bg-card text-card-foreground rounded-xl border shadow-sm",
|
|
20712
20748
|
children: /* @__PURE__ */ D("div", {
|
|
20713
20749
|
className: "text-muted-foreground px-6 py-12 text-center text-base font-medium",
|
|
20714
|
-
children: t
|
|
20750
|
+
children: t ?? n.noResults
|
|
20715
20751
|
})
|
|
20716
|
-
}) :
|
|
20717
|
-
let t =
|
|
20752
|
+
}) : p.map((e) => {
|
|
20753
|
+
let t = c(e), n = l(e), r = e.getVisibleCells(), a = r.filter((t) => !u(t.column.id, e)), f = s(e), p = r.find((e) => i(e.column).primary)?.column.columnDef.meta?.mobile || {};
|
|
20718
20754
|
return /* @__PURE__ */ O("div", {
|
|
20719
20755
|
className: "bg-card text-card-foreground overflow-hidden rounded-xl border shadow-sm",
|
|
20720
20756
|
"data-testid": `row-${e.id}`,
|
|
@@ -20724,11 +20760,11 @@ var sw = ({ table: e, noResultsLabel: t = "No results found" }) => {
|
|
|
20724
20760
|
className: "flex items-center justify-between gap-3",
|
|
20725
20761
|
children: [/* @__PURE__ */ O("div", {
|
|
20726
20762
|
className: "flex min-w-0 flex-1 items-center gap-3",
|
|
20727
|
-
children: [
|
|
20763
|
+
children: [o && /* @__PURE__ */ D("div", {
|
|
20728
20764
|
className: "flex-shrink-0",
|
|
20729
|
-
children: /* @__PURE__ */ D(
|
|
20765
|
+
children: /* @__PURE__ */ D(o, { className: "text-muted-foreground size-5" })
|
|
20730
20766
|
}), /* @__PURE__ */ O("div", {
|
|
20731
|
-
className: W("min-w-0 flex-1", !
|
|
20767
|
+
className: W("min-w-0 flex-1", !o && "ml-2"),
|
|
20732
20768
|
children: [f && /* @__PURE__ */ D("h3", {
|
|
20733
20769
|
className: "text-foreground text-base leading-tight font-semibold break-words",
|
|
20734
20770
|
children: f
|
|
@@ -20743,7 +20779,7 @@ var sw = ({ table: e, noResultsLabel: t = "No results found" }) => {
|
|
|
20743
20779
|
})]
|
|
20744
20780
|
})
|
|
20745
20781
|
}), /* @__PURE__ */ O("div", {
|
|
20746
|
-
className: W("px-6 pb-6", { "pt-2": !(
|
|
20782
|
+
className: W("px-6 pb-6", { "pt-2": !(o || f || t || n) }),
|
|
20747
20783
|
children: [
|
|
20748
20784
|
p.primaryPosition === "body-highlight" && t && /* @__PURE__ */ D("div", {
|
|
20749
20785
|
className: W("mb-3 border-b pb-3", p.primaryClass),
|
|
@@ -20752,7 +20788,7 @@ var sw = ({ table: e, noResultsLabel: t = "No results found" }) => {
|
|
|
20752
20788
|
children: t
|
|
20753
20789
|
})
|
|
20754
20790
|
}),
|
|
20755
|
-
|
|
20791
|
+
d(a),
|
|
20756
20792
|
n && /* @__PURE__ */ D("div", {
|
|
20757
20793
|
className: "pt-4",
|
|
20758
20794
|
children: /* @__PURE__ */ D("div", {
|
|
@@ -20768,7 +20804,7 @@ var sw = ({ table: e, noResultsLabel: t = "No results found" }) => {
|
|
|
20768
20804
|
};
|
|
20769
20805
|
//#endregion
|
|
20770
20806
|
//#region src/components/Table/hooks.ts
|
|
20771
|
-
function
|
|
20807
|
+
function fw(e) {
|
|
20772
20808
|
return T(v((t) => {
|
|
20773
20809
|
let n = window.matchMedia(e);
|
|
20774
20810
|
return n.addEventListener("change", t), () => {
|
|
@@ -20776,10 +20812,10 @@ function cw(e) {
|
|
|
20776
20812
|
};
|
|
20777
20813
|
}, [e]), () => window.matchMedia(e).matches, () => !1);
|
|
20778
20814
|
}
|
|
20779
|
-
function
|
|
20780
|
-
return
|
|
20815
|
+
function pw() {
|
|
20816
|
+
return fw("only screen and (max-width: 767px)");
|
|
20781
20817
|
}
|
|
20782
|
-
function
|
|
20818
|
+
function mw(e, t) {
|
|
20783
20819
|
let [n, r] = w(e);
|
|
20784
20820
|
return b(() => {
|
|
20785
20821
|
let n = setTimeout(() => r(e), t);
|
|
@@ -20788,7 +20824,7 @@ function uw(e, t) {
|
|
|
20788
20824
|
}
|
|
20789
20825
|
//#endregion
|
|
20790
20826
|
//#region src/components/Table/Table.tsx
|
|
20791
|
-
function
|
|
20827
|
+
function hw({ className: e, ...t }) {
|
|
20792
20828
|
return /* @__PURE__ */ D("div", {
|
|
20793
20829
|
"data-slot": "table-container",
|
|
20794
20830
|
className: "relative w-full overflow-x-auto",
|
|
@@ -20799,49 +20835,49 @@ function dw({ className: e, ...t }) {
|
|
|
20799
20835
|
})
|
|
20800
20836
|
});
|
|
20801
20837
|
}
|
|
20802
|
-
function
|
|
20838
|
+
function gw({ className: e, ...t }) {
|
|
20803
20839
|
return /* @__PURE__ */ D("thead", {
|
|
20804
20840
|
"data-slot": "table-header",
|
|
20805
20841
|
className: W("[&_tr]:border-b", e),
|
|
20806
20842
|
...t
|
|
20807
20843
|
});
|
|
20808
20844
|
}
|
|
20809
|
-
function
|
|
20845
|
+
function _w({ className: e, ...t }) {
|
|
20810
20846
|
return /* @__PURE__ */ D("tbody", {
|
|
20811
20847
|
"data-slot": "table-body",
|
|
20812
20848
|
className: W("[&_tr:last-child]:border-0", e),
|
|
20813
20849
|
...t
|
|
20814
20850
|
});
|
|
20815
20851
|
}
|
|
20816
|
-
function
|
|
20852
|
+
function vw({ className: e, ...t }) {
|
|
20817
20853
|
return /* @__PURE__ */ D("tfoot", {
|
|
20818
20854
|
"data-slot": "table-footer",
|
|
20819
20855
|
className: W("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0", e),
|
|
20820
20856
|
...t
|
|
20821
20857
|
});
|
|
20822
20858
|
}
|
|
20823
|
-
function
|
|
20859
|
+
function yw({ className: e, ...t }) {
|
|
20824
20860
|
return /* @__PURE__ */ D("tr", {
|
|
20825
20861
|
"data-slot": "table-row",
|
|
20826
20862
|
className: W("data-[state=selected]:bg-muted border-b transition-colors", e),
|
|
20827
20863
|
...t
|
|
20828
20864
|
});
|
|
20829
20865
|
}
|
|
20830
|
-
function
|
|
20866
|
+
function bw({ className: e, ...t }) {
|
|
20831
20867
|
return /* @__PURE__ */ D("th", {
|
|
20832
20868
|
"data-slot": "table-head",
|
|
20833
20869
|
className: W("text-foreground h-10 px-3 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", e),
|
|
20834
20870
|
...t
|
|
20835
20871
|
});
|
|
20836
20872
|
}
|
|
20837
|
-
function
|
|
20873
|
+
function xw({ className: e, ...t }) {
|
|
20838
20874
|
return /* @__PURE__ */ D("td", {
|
|
20839
20875
|
"data-slot": "table-cell",
|
|
20840
20876
|
className: W("px-3 py-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", e),
|
|
20841
20877
|
...t
|
|
20842
20878
|
});
|
|
20843
20879
|
}
|
|
20844
|
-
function
|
|
20880
|
+
function Sw({ className: e, ...t }) {
|
|
20845
20881
|
return /* @__PURE__ */ D("caption", {
|
|
20846
20882
|
"data-slot": "table-caption",
|
|
20847
20883
|
className: W("text-muted-foreground mt-4 text-sm", e),
|
|
@@ -20850,30 +20886,30 @@ function vw({ className: e, ...t }) {
|
|
|
20850
20886
|
}
|
|
20851
20887
|
//#endregion
|
|
20852
20888
|
//#region src/components/Table/DataTable.tsx
|
|
20853
|
-
function
|
|
20854
|
-
let p =
|
|
20889
|
+
function Cw({ columns: e, data: r, onRowClick: a, isLoading: o = !1, className: s, disableMobileList: c = !1, sorting: l, onSortingChange: u, skeletonRows: d = 4, noResultsLabel: f }) {
|
|
20890
|
+
let p = uw().table, m = f ?? p.noResults, h = pw(), g = !c && h, [_, v] = w([]), y = !!u, b = y ? l : _, x = y ? u : v, S = ow({
|
|
20855
20891
|
data: r,
|
|
20856
20892
|
columns: e,
|
|
20857
20893
|
getCoreRowModel: ew(),
|
|
20858
|
-
...
|
|
20894
|
+
...y ? {
|
|
20859
20895
|
manualSorting: !0,
|
|
20860
|
-
onSortingChange:
|
|
20861
|
-
state: { sorting:
|
|
20896
|
+
onSortingChange: x,
|
|
20897
|
+
state: { sorting: b }
|
|
20862
20898
|
} : {
|
|
20863
20899
|
getSortedRowModel: tw(),
|
|
20864
|
-
onSortingChange:
|
|
20865
|
-
state: { sorting:
|
|
20900
|
+
onSortingChange: x,
|
|
20901
|
+
state: { sorting: b }
|
|
20866
20902
|
}
|
|
20867
20903
|
});
|
|
20868
|
-
return
|
|
20869
|
-
table:
|
|
20870
|
-
noResultsLabel:
|
|
20904
|
+
return g ? /* @__PURE__ */ D(dw, {
|
|
20905
|
+
table: S,
|
|
20906
|
+
noResultsLabel: m
|
|
20871
20907
|
}) : /* @__PURE__ */ D("div", {
|
|
20872
20908
|
className: W("w-full", s),
|
|
20873
20909
|
children: /* @__PURE__ */ D("div", {
|
|
20874
20910
|
"data-slot": "data-table",
|
|
20875
20911
|
className: "bg-card rounded-md border",
|
|
20876
|
-
children: /* @__PURE__ */ O(
|
|
20912
|
+
children: /* @__PURE__ */ O(hw, { children: [/* @__PURE__ */ D(gw, { children: S.getHeaderGroups().map((e) => /* @__PURE__ */ D(yw, { children: e.headers.filter((e) => !e.column.columnDef.meta?.desktopHidden).map((e) => /* @__PURE__ */ D(bw, { children: e.isPlaceholder ? null : /* @__PURE__ */ O("div", {
|
|
20877
20913
|
className: W(e.column.getCanSort() ? "cursor-pointer select-none" : "", "flex items-center space-x-2"),
|
|
20878
20914
|
onClick: e.column.getToggleSortingHandler(),
|
|
20879
20915
|
children: [/* @__PURE__ */ D("div", { children: nw(e.column.columnDef.header, e.getContext()) }), e.column.getCanSort() && /* @__PURE__ */ D("div", {
|
|
@@ -20883,55 +20919,55 @@ function yw({ columns: e, data: r, onRowClick: a, isLoading: o = !1, className:
|
|
|
20883
20919
|
desc: /* @__PURE__ */ D(i, { className: "size-4" })
|
|
20884
20920
|
}[e.column.getIsSorted()] ?? /* @__PURE__ */ D(n, { className: "text-muted-foreground size-4" })
|
|
20885
20921
|
})]
|
|
20886
|
-
}) }, e.id)) }, e.id)) }), /* @__PURE__ */ D(
|
|
20922
|
+
}) }, e.id)) }, e.id)) }), /* @__PURE__ */ D(_w, { children: o ? /* @__PURE__ */ D(E, { children: Array.from(Array(d)).map((e, t) => /* @__PURE__ */ D(yw, { children: S.getVisibleLeafColumns().filter((e) => !e.columnDef.meta?.desktopHidden).map((e) => /* @__PURE__ */ D(xw, { children: /* @__PURE__ */ D(AS, {
|
|
20887
20923
|
className: "rounded-full",
|
|
20888
20924
|
style: { maxWidth: `${Math.floor(Math.random() * 51) + 150}px` }
|
|
20889
|
-
}) }, e.id)) }, t)) }) :
|
|
20925
|
+
}) }, e.id)) }, t)) }) : S.getRowModel().rows?.length ? S.getRowModel().rows.map((e) => /* @__PURE__ */ D(yw, {
|
|
20890
20926
|
"data-testid": `row-${e.id}`,
|
|
20891
20927
|
"data-state": e.getIsSelected() && "selected",
|
|
20892
20928
|
onClick: () => a?.(e.original),
|
|
20893
20929
|
className: W(a && "hover:bg-muted/50 cursor-pointer"),
|
|
20894
|
-
children: e.getVisibleCells().filter((e) => !e.column.columnDef.meta?.desktopHidden).map((e) => /* @__PURE__ */ D(
|
|
20895
|
-
}, e.id)) : /* @__PURE__ */ D(
|
|
20930
|
+
children: e.getVisibleCells().filter((e) => !e.column.columnDef.meta?.desktopHidden).map((e) => /* @__PURE__ */ D(xw, { children: nw(e.column.columnDef.cell, e.getContext()) }, e.id))
|
|
20931
|
+
}, e.id)) : /* @__PURE__ */ D(yw, { children: /* @__PURE__ */ D(xw, {
|
|
20896
20932
|
colSpan: e.filter((e) => !e.meta?.desktopHidden).length,
|
|
20897
20933
|
className: "text-muted-foreground pointer-events-none h-24 text-center",
|
|
20898
|
-
children:
|
|
20934
|
+
children: m
|
|
20899
20935
|
}) }) })] })
|
|
20900
20936
|
})
|
|
20901
20937
|
});
|
|
20902
20938
|
}
|
|
20903
20939
|
//#endregion
|
|
20904
20940
|
//#region src/components/Table/DataTableFilterHeaderMobileSorting.tsx
|
|
20905
|
-
var
|
|
20906
|
-
let l = e?.[0],
|
|
20907
|
-
|
|
20941
|
+
var ww = ({ sorting: e, onSortingChange: t, sortableColumns: n = [], sortLabel: r, sortByLabel: i, selectFieldLabel: a, sortDirectionLabel: o, ascendingLabel: s, descendingLabel: c }) => {
|
|
20942
|
+
let l = uw().table, u = r ?? l.sort, d = i ?? l.sortBy, f = a ?? l.selectField, p = o ?? l.sortDirection, m = s ?? l.ascending, h = c ?? l.descending, g = e?.[0], _ = g && n.find((e) => e.id === g.id), v = g?.desc ? "desc" : "asc", [y, b] = w(_?.id), [x, S] = w(v), C = (e) => {
|
|
20943
|
+
b(e), t && t([{
|
|
20908
20944
|
id: e,
|
|
20909
|
-
desc:
|
|
20945
|
+
desc: x === "desc"
|
|
20910
20946
|
}]);
|
|
20911
|
-
},
|
|
20912
|
-
|
|
20913
|
-
id:
|
|
20947
|
+
}, T = (e) => {
|
|
20948
|
+
S(e), y && t && t([{
|
|
20949
|
+
id: y,
|
|
20914
20950
|
desc: e === "desc"
|
|
20915
20951
|
}]);
|
|
20916
20952
|
};
|
|
20917
20953
|
return n.length === 0 ? null : /* @__PURE__ */ O("div", { children: [/* @__PURE__ */ D("h3", {
|
|
20918
20954
|
className: "mb-4 text-lg font-semibold",
|
|
20919
|
-
children:
|
|
20955
|
+
children: u
|
|
20920
20956
|
}), /* @__PURE__ */ O("div", {
|
|
20921
20957
|
className: "space-y-4",
|
|
20922
20958
|
children: [/* @__PURE__ */ O("div", {
|
|
20923
20959
|
className: "flex flex-col space-y-2",
|
|
20924
20960
|
children: [/* @__PURE__ */ D("label", {
|
|
20925
20961
|
className: "text-sm font-medium",
|
|
20926
|
-
children:
|
|
20962
|
+
children: d
|
|
20927
20963
|
}), /* @__PURE__ */ O(Ox, {
|
|
20928
20964
|
fullWidth: !0,
|
|
20929
|
-
value:
|
|
20930
|
-
onChange: (e) =>
|
|
20965
|
+
value: y ?? "",
|
|
20966
|
+
onChange: (e) => C(e.target.value),
|
|
20931
20967
|
children: [/* @__PURE__ */ D(kx, {
|
|
20932
20968
|
value: "",
|
|
20933
20969
|
disabled: !0,
|
|
20934
|
-
children:
|
|
20970
|
+
children: f
|
|
20935
20971
|
}), n.map((e) => /* @__PURE__ */ D(kx, {
|
|
20936
20972
|
value: e.id,
|
|
20937
20973
|
children: typeof e.header == "string" ? e.header : e.id
|
|
@@ -20941,18 +20977,18 @@ var bw = ({ sorting: e, onSortingChange: t, sortableColumns: n = [], sortLabel:
|
|
|
20941
20977
|
className: "flex flex-col space-y-2",
|
|
20942
20978
|
children: [/* @__PURE__ */ D("label", {
|
|
20943
20979
|
className: "text-sm font-medium",
|
|
20944
|
-
children:
|
|
20980
|
+
children: p
|
|
20945
20981
|
}), /* @__PURE__ */ O(Ox, {
|
|
20946
20982
|
fullWidth: !0,
|
|
20947
|
-
value:
|
|
20948
|
-
onChange: (e) =>
|
|
20949
|
-
disabled: !
|
|
20983
|
+
value: x,
|
|
20984
|
+
onChange: (e) => T(e.target.value),
|
|
20985
|
+
disabled: !y,
|
|
20950
20986
|
children: [/* @__PURE__ */ D(kx, {
|
|
20951
20987
|
value: "asc",
|
|
20952
|
-
children:
|
|
20988
|
+
children: m
|
|
20953
20989
|
}), /* @__PURE__ */ D(kx, {
|
|
20954
20990
|
value: "desc",
|
|
20955
|
-
children:
|
|
20991
|
+
children: h
|
|
20956
20992
|
})]
|
|
20957
20993
|
})]
|
|
20958
20994
|
})]
|
|
@@ -20960,7 +20996,8 @@ var bw = ({ sorting: e, onSortingChange: t, sortableColumns: n = [], sortLabel:
|
|
|
20960
20996
|
};
|
|
20961
20997
|
//#endregion
|
|
20962
20998
|
//#region src/components/Table/FilterModal.tsx
|
|
20963
|
-
function
|
|
20999
|
+
function Tw({ open: e, onClose: t, title: n, children: r, footer: i, className: a, descriptionLabel: o }) {
|
|
21000
|
+
let s = uw().table;
|
|
20964
21001
|
return /* @__PURE__ */ D(mm, {
|
|
20965
21002
|
open: e,
|
|
20966
21003
|
onOpenChange: (e) => {
|
|
@@ -20973,7 +21010,7 @@ function xw({ open: e, onClose: t, title: n, children: r, footer: i, className:
|
|
|
20973
21010
|
className: "flex-shrink-0",
|
|
20974
21011
|
children: [/* @__PURE__ */ D(bm, { children: n }), /* @__PURE__ */ D(xm, {
|
|
20975
21012
|
className: "sr-only",
|
|
20976
|
-
children: o
|
|
21013
|
+
children: o ?? s.filterModalDescription
|
|
20977
21014
|
})]
|
|
20978
21015
|
}),
|
|
20979
21016
|
/* @__PURE__ */ D("div", {
|
|
@@ -20990,28 +21027,28 @@ function xw({ open: e, onClose: t, title: n, children: r, footer: i, className:
|
|
|
20990
21027
|
}
|
|
20991
21028
|
//#endregion
|
|
20992
21029
|
//#region src/components/Table/DateRangeFilter.tsx
|
|
20993
|
-
var
|
|
20994
|
-
let
|
|
21030
|
+
var Ew = () => /* @__PURE__ */ D("span", { className: "bg-border inline-block h-5 w-px align-middle" }), Dw = ({ from: e, to: t, label: n, onChange: i, filterLabel: a, clearLabel: o, applyLabel: s, formatDate: c = (e) => e.toLocaleDateString() }) => {
|
|
21031
|
+
let l = uw().table, d = a ?? l.dateRange, f = o ?? l.clear, p = s ?? l.apply, [m, h] = w(!1), g = pw(), [_, v] = w({
|
|
20995
21032
|
from: e,
|
|
20996
21033
|
to: t
|
|
20997
|
-
}),
|
|
21034
|
+
}), y = () => {
|
|
20998
21035
|
i({
|
|
20999
|
-
from:
|
|
21000
|
-
to:
|
|
21001
|
-
}),
|
|
21002
|
-
},
|
|
21003
|
-
|
|
21036
|
+
from: _?.from,
|
|
21037
|
+
to: _?.to
|
|
21038
|
+
}), h(!1);
|
|
21039
|
+
}, b = () => {
|
|
21040
|
+
v({
|
|
21004
21041
|
from: void 0,
|
|
21005
21042
|
to: void 0
|
|
21006
21043
|
}), i({
|
|
21007
21044
|
from: void 0,
|
|
21008
21045
|
to: void 0
|
|
21009
|
-
}),
|
|
21010
|
-
},
|
|
21046
|
+
}), h(!1);
|
|
21047
|
+
}, x = /* @__PURE__ */ O(E, { children: [
|
|
21011
21048
|
/* @__PURE__ */ D(u, { className: "size-4" }),
|
|
21012
|
-
n ||
|
|
21049
|
+
n || d,
|
|
21013
21050
|
e && t ? /* @__PURE__ */ O(E, { children: [
|
|
21014
|
-
/* @__PURE__ */ D(
|
|
21051
|
+
/* @__PURE__ */ D(Ew, {}),
|
|
21015
21052
|
/* @__PURE__ */ O("span", { children: [c(e), " "] }),
|
|
21016
21053
|
/* @__PURE__ */ D(r, { className: "size-4" }),
|
|
21017
21054
|
/* @__PURE__ */ O("span", { children: [
|
|
@@ -21020,66 +21057,66 @@ var Sw = () => /* @__PURE__ */ D("span", { className: "bg-border inline-block h-
|
|
|
21020
21057
|
" "
|
|
21021
21058
|
] })
|
|
21022
21059
|
] }) : null
|
|
21023
|
-
] }),
|
|
21060
|
+
] }), S = /* @__PURE__ */ O("div", {
|
|
21024
21061
|
className: "flex justify-end gap-2",
|
|
21025
21062
|
children: [/* @__PURE__ */ D(ar, {
|
|
21026
21063
|
variant: "outline",
|
|
21027
21064
|
size: "sm",
|
|
21028
|
-
onClick:
|
|
21029
|
-
children:
|
|
21065
|
+
onClick: b,
|
|
21066
|
+
children: f
|
|
21030
21067
|
}), /* @__PURE__ */ D(ar, {
|
|
21031
21068
|
size: "sm",
|
|
21032
|
-
onClick:
|
|
21033
|
-
children:
|
|
21069
|
+
onClick: y,
|
|
21070
|
+
children: p
|
|
21034
21071
|
})]
|
|
21035
21072
|
});
|
|
21036
|
-
return
|
|
21073
|
+
return g ? /* @__PURE__ */ O(E, { children: [/* @__PURE__ */ D(ar, {
|
|
21037
21074
|
className: "justify-start",
|
|
21038
21075
|
variant: "outline",
|
|
21039
|
-
onClick: () =>
|
|
21040
|
-
children:
|
|
21041
|
-
}), /* @__PURE__ */ D(
|
|
21042
|
-
open:
|
|
21043
|
-
onClose: () =>
|
|
21044
|
-
title: n ||
|
|
21045
|
-
footer:
|
|
21076
|
+
onClick: () => h(!0),
|
|
21077
|
+
children: x
|
|
21078
|
+
}), /* @__PURE__ */ D(Tw, {
|
|
21079
|
+
open: m,
|
|
21080
|
+
onClose: () => h(!1),
|
|
21081
|
+
title: n || d,
|
|
21082
|
+
footer: S,
|
|
21046
21083
|
children: /* @__PURE__ */ D(ys, {
|
|
21047
21084
|
mode: "range",
|
|
21048
|
-
defaultMonth:
|
|
21085
|
+
defaultMonth: _?.from,
|
|
21049
21086
|
numberOfMonths: 1,
|
|
21050
|
-
selected:
|
|
21051
|
-
onSelect:
|
|
21087
|
+
selected: _,
|
|
21088
|
+
onSelect: v,
|
|
21052
21089
|
className: "bg-transparent p-0",
|
|
21053
21090
|
fullScreen: !0,
|
|
21054
21091
|
buttonVariant: "outline"
|
|
21055
21092
|
})
|
|
21056
21093
|
})] }) : /* @__PURE__ */ O(CS, {
|
|
21057
|
-
open:
|
|
21058
|
-
onOpenChange:
|
|
21094
|
+
open: m,
|
|
21095
|
+
onOpenChange: h,
|
|
21059
21096
|
children: [/* @__PURE__ */ D(wS, {
|
|
21060
21097
|
render: /* @__PURE__ */ D(ar, { variant: "outline" }),
|
|
21061
|
-
children:
|
|
21098
|
+
children: x
|
|
21062
21099
|
}), /* @__PURE__ */ O(TS, {
|
|
21063
21100
|
className: "w-auto p-4",
|
|
21064
21101
|
align: "start",
|
|
21065
21102
|
children: [/* @__PURE__ */ D(ys, {
|
|
21066
21103
|
mode: "range",
|
|
21067
|
-
defaultMonth:
|
|
21104
|
+
defaultMonth: _?.from,
|
|
21068
21105
|
numberOfMonths: 2,
|
|
21069
|
-
selected:
|
|
21070
|
-
onSelect:
|
|
21106
|
+
selected: _,
|
|
21107
|
+
onSelect: v,
|
|
21071
21108
|
className: "bg-transparent p-0"
|
|
21072
21109
|
}), /* @__PURE__ */ D("div", {
|
|
21073
21110
|
className: "mt-4",
|
|
21074
|
-
children:
|
|
21111
|
+
children: S
|
|
21075
21112
|
})]
|
|
21076
21113
|
})]
|
|
21077
21114
|
});
|
|
21078
|
-
},
|
|
21079
|
-
let
|
|
21115
|
+
}, Ow = ({ value: e, onChange: t, className: n, clearLabel: r, ...i }) => {
|
|
21116
|
+
let a = uw().table, [o, s] = w(e || ""), c = mw(o, 300);
|
|
21080
21117
|
return b(() => {
|
|
21081
|
-
t(
|
|
21082
|
-
}, [
|
|
21118
|
+
t(c || void 0);
|
|
21119
|
+
}, [c]), /* @__PURE__ */ O("div", {
|
|
21083
21120
|
className: W("relative", n),
|
|
21084
21121
|
children: [
|
|
21085
21122
|
/* @__PURE__ */ D(d, {
|
|
@@ -21087,57 +21124,57 @@ var Sw = () => /* @__PURE__ */ D("span", { className: "bg-border inline-block h-
|
|
|
21087
21124
|
className: "text-muted-foreground absolute top-1/2 left-2 -translate-y-1/2"
|
|
21088
21125
|
}),
|
|
21089
21126
|
/* @__PURE__ */ D(Dx, {
|
|
21090
|
-
value:
|
|
21091
|
-
onChange: (e) =>
|
|
21127
|
+
value: o,
|
|
21128
|
+
onChange: (e) => s(e.target.value || ""),
|
|
21092
21129
|
...i,
|
|
21093
21130
|
className: W("px-8", n)
|
|
21094
21131
|
}),
|
|
21095
|
-
|
|
21132
|
+
o && /* @__PURE__ */ D("button", {
|
|
21096
21133
|
type: "button",
|
|
21097
|
-
"aria-label": r,
|
|
21134
|
+
"aria-label": r ?? a.clearSearch,
|
|
21098
21135
|
className: "text-muted-foreground hover:text-foreground absolute top-1/2 right-2 -translate-y-1/2 focus:outline-none",
|
|
21099
|
-
onClick: () =>
|
|
21136
|
+
onClick: () => s(""),
|
|
21100
21137
|
children: /* @__PURE__ */ D(f, { size: 16 })
|
|
21101
21138
|
})
|
|
21102
21139
|
]
|
|
21103
21140
|
});
|
|
21104
|
-
},
|
|
21105
|
-
let
|
|
21106
|
-
n(
|
|
21107
|
-
},
|
|
21108
|
-
|
|
21109
|
-
},
|
|
21110
|
-
|
|
21111
|
-
},
|
|
21112
|
-
|
|
21113
|
-
},
|
|
21141
|
+
}, kw = () => /* @__PURE__ */ D("span", { className: "bg-border inline-block h-5 w-px align-middle" }), Aw = ({ value: e = [], options: t, onChange: n, label: r, multiple: i = !0, filterLabel: a, selectedLabel: o, clearLabel: s, applyLabel: c }) => {
|
|
21142
|
+
let l = uw().table, [d, f] = w(!1), [p, m] = w(e), h = pw(), g = a ?? l.filter, _ = o ?? l.selected, v = s ?? l.clear, y = c ?? l.apply, b = () => {
|
|
21143
|
+
n(p), f(!1);
|
|
21144
|
+
}, x = () => {
|
|
21145
|
+
m([]), n([]), f(!1);
|
|
21146
|
+
}, S = (e) => {
|
|
21147
|
+
m([e]), n([e]), f(!1);
|
|
21148
|
+
}, C = (e) => {
|
|
21149
|
+
m((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]);
|
|
21150
|
+
}, T = h && t.length > 1, k = /* @__PURE__ */ O(E, { children: [
|
|
21114
21151
|
/* @__PURE__ */ D(u, { className: "size-4" }),
|
|
21115
|
-
r ||
|
|
21116
|
-
|
|
21152
|
+
r || g,
|
|
21153
|
+
p.length > 0 && /* @__PURE__ */ O(E, { children: [/* @__PURE__ */ D(kw, {}), /* @__PURE__ */ D("span", {
|
|
21117
21154
|
className: "inline-flex align-middle",
|
|
21118
|
-
children:
|
|
21119
|
-
let e = t.find((e) => e.value ===
|
|
21155
|
+
children: p.length === 1 ? (() => {
|
|
21156
|
+
let e = t.find((e) => e.value === p[0]);
|
|
21120
21157
|
return e ? /* @__PURE__ */ D("span", {
|
|
21121
21158
|
className: "inline-flex items-center",
|
|
21122
21159
|
children: e.label
|
|
21123
21160
|
}) : null;
|
|
21124
21161
|
})() : /* @__PURE__ */ O("span", { children: [
|
|
21125
|
-
|
|
21162
|
+
p.length,
|
|
21126
21163
|
"+ ",
|
|
21127
|
-
|
|
21164
|
+
_
|
|
21128
21165
|
] })
|
|
21129
21166
|
})] })
|
|
21130
|
-
] }),
|
|
21131
|
-
className: W("flex cursor-pointer items-center gap-2",
|
|
21167
|
+
] }), A = t.map((e) => /* @__PURE__ */ O("label", {
|
|
21168
|
+
className: W("flex cursor-pointer items-center gap-2", T && "py-2 !text-2xl"),
|
|
21132
21169
|
children: [i ? /* @__PURE__ */ D("input", {
|
|
21133
21170
|
type: "checkbox",
|
|
21134
|
-
checked:
|
|
21135
|
-
onChange: () =>
|
|
21171
|
+
checked: p.includes(e.value),
|
|
21172
|
+
onChange: () => C(e.value),
|
|
21136
21173
|
className: "accent-primary"
|
|
21137
21174
|
}) : /* @__PURE__ */ D("input", {
|
|
21138
21175
|
type: "radio",
|
|
21139
|
-
checked:
|
|
21140
|
-
onChange: () =>
|
|
21176
|
+
checked: p[0] === e.value,
|
|
21177
|
+
onChange: () => S(e.value),
|
|
21141
21178
|
className: "accent-primary",
|
|
21142
21179
|
name: r || "select-filter"
|
|
21143
21180
|
}), /* @__PURE__ */ D("div", {
|
|
@@ -21145,65 +21182,65 @@ var Sw = () => /* @__PURE__ */ D("span", { className: "bg-border inline-block h-
|
|
|
21145
21182
|
children: e.label
|
|
21146
21183
|
})]
|
|
21147
21184
|
}, e.value));
|
|
21148
|
-
return
|
|
21185
|
+
return T ? /* @__PURE__ */ O(E, { children: [/* @__PURE__ */ D(ar, {
|
|
21149
21186
|
variant: "outline",
|
|
21150
21187
|
className: "justify-start",
|
|
21151
|
-
onClick: () =>
|
|
21152
|
-
children:
|
|
21153
|
-
}), /* @__PURE__ */ D(
|
|
21154
|
-
open:
|
|
21155
|
-
onClose: () =>
|
|
21156
|
-
title: r ||
|
|
21188
|
+
onClick: () => f(!0),
|
|
21189
|
+
children: k
|
|
21190
|
+
}), /* @__PURE__ */ D(Tw, {
|
|
21191
|
+
open: d,
|
|
21192
|
+
onClose: () => f(!1),
|
|
21193
|
+
title: r || g,
|
|
21157
21194
|
footer: i ? /* @__PURE__ */ O("div", {
|
|
21158
21195
|
className: "flex justify-end gap-2",
|
|
21159
21196
|
children: [/* @__PURE__ */ D(ar, {
|
|
21160
21197
|
variant: "outline",
|
|
21161
21198
|
size: "sm",
|
|
21162
|
-
onClick:
|
|
21163
|
-
children:
|
|
21199
|
+
onClick: x,
|
|
21200
|
+
children: v
|
|
21164
21201
|
}), /* @__PURE__ */ D(ar, {
|
|
21165
21202
|
size: "sm",
|
|
21166
|
-
onClick:
|
|
21167
|
-
children:
|
|
21203
|
+
onClick: b,
|
|
21204
|
+
children: y
|
|
21168
21205
|
})]
|
|
21169
21206
|
}) : void 0,
|
|
21170
|
-
children:
|
|
21207
|
+
children: A
|
|
21171
21208
|
})] }) : /* @__PURE__ */ O(CS, {
|
|
21172
|
-
open:
|
|
21173
|
-
onOpenChange:
|
|
21209
|
+
open: d,
|
|
21210
|
+
onOpenChange: f,
|
|
21174
21211
|
children: [/* @__PURE__ */ D(wS, {
|
|
21175
21212
|
render: /* @__PURE__ */ D(ar, { variant: "outline" }),
|
|
21176
|
-
children:
|
|
21213
|
+
children: k
|
|
21177
21214
|
}), /* @__PURE__ */ O(TS, {
|
|
21178
21215
|
className: "w-56 p-4",
|
|
21179
21216
|
align: "start",
|
|
21180
21217
|
children: [/* @__PURE__ */ D("div", {
|
|
21181
21218
|
className: "flex max-h-96 flex-col gap-2 overflow-y-auto",
|
|
21182
|
-
children:
|
|
21219
|
+
children: A
|
|
21183
21220
|
}), i && /* @__PURE__ */ O("div", {
|
|
21184
21221
|
className: "mt-4 flex justify-end gap-2",
|
|
21185
21222
|
children: [/* @__PURE__ */ D(ar, {
|
|
21186
21223
|
variant: "outline",
|
|
21187
21224
|
size: "sm",
|
|
21188
|
-
onClick:
|
|
21189
|
-
children:
|
|
21225
|
+
onClick: x,
|
|
21226
|
+
children: v
|
|
21190
21227
|
}), /* @__PURE__ */ D(ar, {
|
|
21191
21228
|
size: "sm",
|
|
21192
|
-
onClick:
|
|
21193
|
-
children:
|
|
21229
|
+
onClick: b,
|
|
21230
|
+
children: y
|
|
21194
21231
|
})]
|
|
21195
21232
|
})]
|
|
21196
21233
|
})]
|
|
21197
21234
|
});
|
|
21198
|
-
},
|
|
21199
|
-
let h =
|
|
21235
|
+
}, jw = _(({ query: e, placeholder: t, handleFilterChange: n, handleResetFilters: r, hasActiveFilters: i, filters: a = [], sorting: o, onSortingChange: s, sortableColumns: c = [], modalTitle: l, filtersLabel: d, clearLabel: f, applyLabel: p }, m) => {
|
|
21236
|
+
let h = uw().table, g = d ?? h.filters, _ = f ?? h.clear, v = p ?? h.apply, y = pw(), [b, x] = w(!1), S = (e, t) => e.type === "select" ? /* @__PURE__ */ D(Aw, {
|
|
21200
21237
|
label: e.label,
|
|
21201
21238
|
value: e.value,
|
|
21202
21239
|
options: e.options,
|
|
21203
21240
|
onChange: e.onChange,
|
|
21204
21241
|
clearLabel: f,
|
|
21205
21242
|
applyLabel: p
|
|
21206
|
-
}, t) : e.type === "dateRange" ? /* @__PURE__ */ D(
|
|
21243
|
+
}, t) : e.type === "dateRange" ? /* @__PURE__ */ D(Dw, {
|
|
21207
21244
|
label: e.label,
|
|
21208
21245
|
from: e.from,
|
|
21209
21246
|
to: e.to,
|
|
@@ -21222,54 +21259,54 @@ var Sw = () => /* @__PURE__ */ D("span", { className: "bg-border inline-block h-
|
|
|
21222
21259
|
className: "flex w-full flex-row flex-wrap items-stretch justify-end gap-2 md:items-center md:justify-between",
|
|
21223
21260
|
children: [/* @__PURE__ */ D("div", {
|
|
21224
21261
|
className: "flex-grow",
|
|
21225
|
-
children: /* @__PURE__ */ D(
|
|
21262
|
+
children: /* @__PURE__ */ D(Ow, {
|
|
21226
21263
|
value: e,
|
|
21227
21264
|
placeholder: t,
|
|
21228
21265
|
onChange: (e) => n("q", e),
|
|
21229
21266
|
className: "w-full max-w-sm"
|
|
21230
21267
|
})
|
|
21231
|
-
}),
|
|
21268
|
+
}), y ? /* @__PURE__ */ D("div", {
|
|
21232
21269
|
className: "flex items-center justify-end gap-2",
|
|
21233
21270
|
children: (a.length > 0 || c.length > 0) && /* @__PURE__ */ O(ar, {
|
|
21234
|
-
onClick: () =>
|
|
21271
|
+
onClick: () => x(!0),
|
|
21235
21272
|
variant: "outline",
|
|
21236
21273
|
size: "sm",
|
|
21237
21274
|
className: "relative flex items-center gap-2",
|
|
21238
21275
|
children: [
|
|
21239
21276
|
/* @__PURE__ */ D(u, { className: "size-4" }),
|
|
21240
21277
|
i && /* @__PURE__ */ D("span", { className: "bg-primary absolute top-2.5 left-6.5 size-2 rounded-full" }),
|
|
21241
|
-
|
|
21278
|
+
g
|
|
21242
21279
|
]
|
|
21243
21280
|
})
|
|
21244
21281
|
}) : a.length > 0 && /* @__PURE__ */ D("div", {
|
|
21245
21282
|
className: "flex flex-0 items-center justify-end gap-2",
|
|
21246
|
-
children: a.map((e, t) =>
|
|
21283
|
+
children: a.map((e, t) => S(e, t))
|
|
21247
21284
|
})]
|
|
21248
|
-
}),
|
|
21249
|
-
open:
|
|
21250
|
-
onClose: () =>
|
|
21251
|
-
title: l ||
|
|
21285
|
+
}), y && (a.length > 0 || c.length > 0) && /* @__PURE__ */ D(Tw, {
|
|
21286
|
+
open: b,
|
|
21287
|
+
onClose: () => x(!1),
|
|
21288
|
+
title: l || g,
|
|
21252
21289
|
footer: /* @__PURE__ */ O("div", {
|
|
21253
21290
|
className: "flex justify-end gap-2",
|
|
21254
21291
|
children: [/* @__PURE__ */ D(ar, {
|
|
21255
21292
|
onClick: () => {
|
|
21256
|
-
r?.(), s?.([]),
|
|
21293
|
+
r?.(), s?.([]), x(!1);
|
|
21257
21294
|
},
|
|
21258
21295
|
variant: "outline",
|
|
21259
21296
|
size: "sm",
|
|
21260
|
-
children:
|
|
21297
|
+
children: _
|
|
21261
21298
|
}), /* @__PURE__ */ D(ar, {
|
|
21262
|
-
onClick: () =>
|
|
21299
|
+
onClick: () => x(!1),
|
|
21263
21300
|
size: "sm",
|
|
21264
|
-
children:
|
|
21301
|
+
children: v
|
|
21265
21302
|
})]
|
|
21266
21303
|
}),
|
|
21267
21304
|
children: /* @__PURE__ */ O("div", {
|
|
21268
21305
|
className: "space-y-8",
|
|
21269
21306
|
children: [a.length > 0 && /* @__PURE__ */ D("div", {
|
|
21270
21307
|
className: "flex flex-col space-y-4",
|
|
21271
|
-
children: a.map((e, t) =>
|
|
21272
|
-
}), /* @__PURE__ */ D(
|
|
21308
|
+
children: a.map((e, t) => S(e, t))
|
|
21309
|
+
}), /* @__PURE__ */ D(ww, {
|
|
21273
21310
|
sorting: o,
|
|
21274
21311
|
onSortingChange: s,
|
|
21275
21312
|
sortableColumns: c
|
|
@@ -21278,22 +21315,22 @@ var Sw = () => /* @__PURE__ */ D("span", { className: "bg-border inline-block h-
|
|
|
21278
21315
|
})]
|
|
21279
21316
|
});
|
|
21280
21317
|
});
|
|
21281
|
-
|
|
21318
|
+
jw.displayName = "DataTableFilterHeader";
|
|
21282
21319
|
//#endregion
|
|
21283
21320
|
//#region src/components/Table/DataTableMobileSorting.tsx
|
|
21284
|
-
var
|
|
21285
|
-
let
|
|
21286
|
-
return
|
|
21287
|
-
open:
|
|
21321
|
+
var Mw = ({ table: e, sortLabel: r, sortByLabel: a, selectFieldLabel: o, sortDirectionLabel: s, ascendingLabel: c, descendingLabel: l, clearLabel: u, applyLabel: d }) => {
|
|
21322
|
+
let f = uw().table, p = r ?? f.sort, m = a ?? f.sortBy, h = o ?? f.selectField, g = s ?? f.sortDirection, _ = c ?? f.ascending, v = l ?? f.descending, y = u ?? f.clear, b = d ?? f.apply, [x, C] = w(!1), T = e.getState().sorting, E = e.options.onSortingChange, k = S(() => e.getAllLeafColumns().filter((e) => e.getCanSort()), [e]), A = T?.[0], j = A && k.find((e) => e.id === A.id), M = A?.desc ? "desc" : "asc", [N, P] = w(j?.id), [F, I] = w(M);
|
|
21323
|
+
return k.length === 0 || !E ? null : /* @__PURE__ */ O(CS, {
|
|
21324
|
+
open: x,
|
|
21288
21325
|
onOpenChange: (e) => {
|
|
21289
|
-
e && (
|
|
21326
|
+
e && (P(j?.id), I(M)), C(e);
|
|
21290
21327
|
},
|
|
21291
21328
|
children: [/* @__PURE__ */ O(wS, {
|
|
21292
21329
|
render: /* @__PURE__ */ D(ar, {
|
|
21293
21330
|
variant: "outline",
|
|
21294
21331
|
className: "flex items-center gap-2"
|
|
21295
21332
|
}),
|
|
21296
|
-
children: [D(
|
|
21333
|
+
children: [D(j ? M === "asc" ? t : i : n, { className: "size-4" }), /* @__PURE__ */ D("span", { children: j ? typeof j.columnDef.header == "function" ? j.id : j.columnDef.header : p })]
|
|
21297
21334
|
}), /* @__PURE__ */ D(TS, {
|
|
21298
21335
|
className: "min-w-64 p-4",
|
|
21299
21336
|
align: "start",
|
|
@@ -21304,16 +21341,16 @@ var Ow = ({ table: e, sortLabel: r = "Sort", sortByLabel: a = "Sort by", selectF
|
|
|
21304
21341
|
className: "flex flex-col space-y-2",
|
|
21305
21342
|
children: [/* @__PURE__ */ D("label", {
|
|
21306
21343
|
className: "text-sm font-medium",
|
|
21307
|
-
children:
|
|
21344
|
+
children: m
|
|
21308
21345
|
}), /* @__PURE__ */ O(Ox, {
|
|
21309
21346
|
fullWidth: !0,
|
|
21310
|
-
value:
|
|
21311
|
-
onChange: (e) =>
|
|
21347
|
+
value: N ?? "",
|
|
21348
|
+
onChange: (e) => P(e.target.value),
|
|
21312
21349
|
children: [/* @__PURE__ */ D(kx, {
|
|
21313
21350
|
value: "",
|
|
21314
21351
|
disabled: !0,
|
|
21315
|
-
children:
|
|
21316
|
-
}),
|
|
21352
|
+
children: h
|
|
21353
|
+
}), k.map((e) => /* @__PURE__ */ D(kx, {
|
|
21317
21354
|
value: e.id,
|
|
21318
21355
|
children: typeof e.columnDef.header == "function" ? e.id : e.columnDef.header
|
|
21319
21356
|
}, e.id))]
|
|
@@ -21323,18 +21360,18 @@ var Ow = ({ table: e, sortLabel: r = "Sort", sortByLabel: a = "Sort by", selectF
|
|
|
21323
21360
|
className: "flex flex-col space-y-2",
|
|
21324
21361
|
children: [/* @__PURE__ */ D("label", {
|
|
21325
21362
|
className: "text-sm font-medium",
|
|
21326
|
-
children:
|
|
21363
|
+
children: g
|
|
21327
21364
|
}), /* @__PURE__ */ O(Ox, {
|
|
21328
21365
|
fullWidth: !0,
|
|
21329
|
-
value:
|
|
21330
|
-
onChange: (e) =>
|
|
21331
|
-
disabled: !
|
|
21366
|
+
value: F,
|
|
21367
|
+
onChange: (e) => I(e.target.value),
|
|
21368
|
+
disabled: !N,
|
|
21332
21369
|
children: [/* @__PURE__ */ D(kx, {
|
|
21333
21370
|
value: "asc",
|
|
21334
|
-
children:
|
|
21371
|
+
children: _
|
|
21335
21372
|
}), /* @__PURE__ */ D(kx, {
|
|
21336
21373
|
value: "desc",
|
|
21337
|
-
children:
|
|
21374
|
+
children: v
|
|
21338
21375
|
})]
|
|
21339
21376
|
})]
|
|
21340
21377
|
}),
|
|
@@ -21344,64 +21381,68 @@ var Ow = ({ table: e, sortLabel: r = "Sort", sortByLabel: a = "Sort by", selectF
|
|
|
21344
21381
|
variant: "outline",
|
|
21345
21382
|
size: "sm",
|
|
21346
21383
|
onClick: () => {
|
|
21347
|
-
|
|
21384
|
+
P(void 0), I("asc"), E([]), C(!1);
|
|
21348
21385
|
},
|
|
21349
|
-
children:
|
|
21386
|
+
children: y
|
|
21350
21387
|
}), /* @__PURE__ */ D(ar, {
|
|
21351
21388
|
size: "sm",
|
|
21352
21389
|
onClick: () => {
|
|
21353
|
-
|
|
21354
|
-
id:
|
|
21355
|
-
desc:
|
|
21356
|
-
}] : []),
|
|
21390
|
+
E(N ? [{
|
|
21391
|
+
id: N,
|
|
21392
|
+
desc: F === "desc"
|
|
21393
|
+
}] : []), C(!1);
|
|
21357
21394
|
},
|
|
21358
|
-
children:
|
|
21395
|
+
children: b
|
|
21359
21396
|
})]
|
|
21360
21397
|
})
|
|
21361
21398
|
]
|
|
21362
21399
|
})
|
|
21363
21400
|
})]
|
|
21364
21401
|
});
|
|
21365
|
-
},
|
|
21402
|
+
}, Nw = [
|
|
21366
21403
|
10,
|
|
21367
21404
|
25,
|
|
21368
21405
|
50,
|
|
21369
21406
|
100
|
|
21370
|
-
],
|
|
21371
|
-
|
|
21372
|
-
|
|
21373
|
-
|
|
21374
|
-
|
|
21375
|
-
children: r.map((e) => /* @__PURE__ */ O(kx, {
|
|
21407
|
+
], Pw = ({ value: e, onValueChange: t, className: n, options: r = Nw, itemsPerPageLabel: i }) => {
|
|
21408
|
+
let a = uw().table, o = i ?? a.itemsPerPage;
|
|
21409
|
+
return /* @__PURE__ */ D(Ox, {
|
|
21410
|
+
size: "sm",
|
|
21411
|
+
className: n,
|
|
21376
21412
|
value: e.toString(),
|
|
21377
|
-
|
|
21378
|
-
|
|
21379
|
-
|
|
21380
|
-
|
|
21381
|
-
|
|
21382
|
-
|
|
21383
|
-
|
|
21413
|
+
onChange: (e) => t(parseInt(e.target.value, 10)),
|
|
21414
|
+
children: r.map((e) => /* @__PURE__ */ O(kx, {
|
|
21415
|
+
value: e.toString(),
|
|
21416
|
+
children: [
|
|
21417
|
+
e,
|
|
21418
|
+
" ",
|
|
21419
|
+
o
|
|
21420
|
+
]
|
|
21421
|
+
}, e))
|
|
21422
|
+
});
|
|
21423
|
+
}, Fw = ({ pagination: e, pageSize: t, className: n, formatLabel: r }) => {
|
|
21424
|
+
let i = uw().table;
|
|
21384
21425
|
if (!e || e.count === 0) return null;
|
|
21385
|
-
let
|
|
21386
|
-
from:
|
|
21387
|
-
to:
|
|
21388
|
-
total:
|
|
21389
|
-
})
|
|
21426
|
+
let a = e.current, o = e.count, s = (a - 1) * t + 1, c = Math.min(a * t, o), l = (r ?? i.showingResults)({
|
|
21427
|
+
from: s,
|
|
21428
|
+
to: c,
|
|
21429
|
+
total: o
|
|
21430
|
+
});
|
|
21390
21431
|
return /* @__PURE__ */ D("div", {
|
|
21391
21432
|
className: W("text-muted-foreground text-sm whitespace-nowrap", n),
|
|
21392
|
-
children:
|
|
21433
|
+
children: l
|
|
21393
21434
|
});
|
|
21394
|
-
},
|
|
21395
|
-
let c =
|
|
21396
|
-
return
|
|
21435
|
+
}, Iw = ({ pagination: e, onPageChange: t, pageSize: n = 10, onPageSizeChange: r, previousLabel: i, nextLabel: a, itemsPerPageLabel: o, formatResultsLabel: s }) => {
|
|
21436
|
+
let c = uw().table, u = pw(), d = e.current, f = e.pages, p = d - 1 > 4 / 2 && f > 4, m = f - d + 1 > 4 / 2 && f > 4;
|
|
21437
|
+
return f <= 1 && e.count <= n ? null : /* @__PURE__ */ O("div", {
|
|
21397
21438
|
className: "flex items-center justify-between",
|
|
21398
|
-
children: [!
|
|
21439
|
+
children: [!u && /* @__PURE__ */ O("div", {
|
|
21399
21440
|
className: "flex flex-shrink-0 items-center gap-4",
|
|
21400
|
-
children: [r && /* @__PURE__ */ D(
|
|
21441
|
+
children: [r && /* @__PURE__ */ D(Pw, {
|
|
21401
21442
|
value: n,
|
|
21402
21443
|
onValueChange: r,
|
|
21403
21444
|
itemsPerPageLabel: o
|
|
21404
|
-
}), /* @__PURE__ */ D(
|
|
21445
|
+
}), /* @__PURE__ */ D(Fw, {
|
|
21405
21446
|
pagination: e,
|
|
21406
21447
|
pageSize: n,
|
|
21407
21448
|
formatLabel: s
|
|
@@ -21410,35 +21451,35 @@ var Ow = ({ table: e, sortLabel: r = "Sort", sortByLabel: a = "Sort by", selectF
|
|
|
21410
21451
|
className: "md:justify-end",
|
|
21411
21452
|
children: /* @__PURE__ */ O(Mx, { children: [
|
|
21412
21453
|
/* @__PURE__ */ D(Nx, { children: /* @__PURE__ */ D(Fx, {
|
|
21413
|
-
label: i,
|
|
21414
|
-
onClick: () =>
|
|
21415
|
-
"aria-disabled":
|
|
21454
|
+
label: i ?? c.previous,
|
|
21455
|
+
onClick: () => d > 1 && t(d - 1),
|
|
21456
|
+
"aria-disabled": d === 1
|
|
21416
21457
|
}) }),
|
|
21417
|
-
|
|
21458
|
+
p && /* @__PURE__ */ O(E, { children: [/* @__PURE__ */ D(Nx, { children: /* @__PURE__ */ D(Px, {
|
|
21418
21459
|
onClick: () => t(1),
|
|
21419
21460
|
children: 1
|
|
21420
|
-
}) }),
|
|
21461
|
+
}) }), d > 2 && /* @__PURE__ */ D(Nx, { children: /* @__PURE__ */ D(l, { className: "size-4" }) })] }),
|
|
21421
21462
|
(() => {
|
|
21422
|
-
if (
|
|
21423
|
-
let e =
|
|
21424
|
-
return e < 1 && (e = 1, t = 4), t >
|
|
21463
|
+
if (f <= 4) return Array.from({ length: f }, (e, t) => t + 1);
|
|
21464
|
+
let e = d - 2, t = d + 2;
|
|
21465
|
+
return e < 1 && (e = 1, t = 4), t > f && (e = f - 4 + 1, t = f), p && e++, m && t--, Array.from({ length: t - e + 1 }, (t, n) => e + n);
|
|
21425
21466
|
})().map((e) => /* @__PURE__ */ D(Nx, { children: /* @__PURE__ */ D(Px, {
|
|
21426
|
-
isActive: e ===
|
|
21467
|
+
isActive: e === d,
|
|
21427
21468
|
onClick: () => t(e),
|
|
21428
21469
|
children: e
|
|
21429
21470
|
}) }, e)),
|
|
21430
|
-
|
|
21431
|
-
onClick: () => t(
|
|
21432
|
-
children:
|
|
21471
|
+
m && /* @__PURE__ */ O(E, { children: [f - d > 2 && /* @__PURE__ */ D(Nx, { children: /* @__PURE__ */ D(l, { className: "size-4" }) }), /* @__PURE__ */ D(Nx, { children: /* @__PURE__ */ D(Px, {
|
|
21472
|
+
onClick: () => t(f),
|
|
21473
|
+
children: f
|
|
21433
21474
|
}) })] }),
|
|
21434
21475
|
/* @__PURE__ */ D(Nx, { children: /* @__PURE__ */ D(Ix, {
|
|
21435
|
-
label: a,
|
|
21436
|
-
onClick: () =>
|
|
21437
|
-
"aria-disabled":
|
|
21476
|
+
label: a ?? c.next,
|
|
21477
|
+
onClick: () => d < f && t(d + 1),
|
|
21478
|
+
"aria-disabled": d === f
|
|
21438
21479
|
}) })
|
|
21439
21480
|
] })
|
|
21440
21481
|
})]
|
|
21441
21482
|
});
|
|
21442
21483
|
};
|
|
21443
21484
|
//#endregion
|
|
21444
|
-
export { hn as Badge, ar as Button, rr as ButtonGroup, ys as Calendar, bs as CalendarDayButton, zS as CheckFilter, Oc as Checkbox,
|
|
21485
|
+
export { hn as Badge, ar as Button, rr as ButtonGroup, ys as Calendar, bs as CalendarDayButton, zS as CheckFilter, Oc as Checkbox, Cw as DataTable, jw as DataTableFilterHeader, ww as DataTableFilterHeaderMobileSorting, dw as DataTableMobile, Mw as DataTableMobileSorting, Iw as DataTablePagination, Dw as DateRangeFilter, Ow as DebouncedSearchInput, mm as Dialog, gm as DialogClose, _m as DialogContent, xm as DialogDescription, ym as DialogFooter, vm as DialogHeader, bm as DialogTitle, hm as DialogTrigger, Tx as DynamicIcon, Tw as FilterModal, Ex as IconButton, Dx as Input, Ox as NativeSelect, Ax as NativeSelectOptGroup, kx as NativeSelectOption, Pw as PageSizeSelector, jx as Pagination, Mx as PaginationContent, Lx as PaginationEllipsis, Nx as PaginationItem, Px as PaginationLink, Ix as PaginationNext, Fx as PaginationPrevious, CS as Popover, ES as PopoverClose, TS as PopoverContent, wS as PopoverTrigger, Fw as ResultsCounter, Aw as SelectFilter, kS as Separator, AS as Skeleton, RS as Switch, hw as Table, _w as TableBody, Sw as TableCaption, xw as TableCell, vw as TableFooter, bw as TableHead, gw as TableHeader, yw as TableRow, lw as WgDesignProvider, mn as badgeVariants, er as buttonGroupVariants, ir as buttonVariants, sw as defaultWgDesignLabels, OS as separatorVariants, nr as useButtonGroup, mw as useDebounce, pw as useIsMobile, fw as useMediaQuery, uw as useWgDesignLabels };
|