@prediktif/ui 0.1.19 → 0.1.21
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/README.md +21 -3
- package/dist/index.d.mts +20 -42
- package/dist/index.d.ts +20 -42
- package/dist/index.js +183 -206
- package/dist/index.mjs +215 -239
- package/package.json +3 -1
package/dist/index.js
CHANGED
|
@@ -78,6 +78,7 @@ __export(index_exports, {
|
|
|
78
78
|
RowActions: () => RowActions,
|
|
79
79
|
StateEmpty: () => StateEmpty,
|
|
80
80
|
exportToCSV: () => exportToCSV,
|
|
81
|
+
exportToPDF: () => exportToPDF,
|
|
81
82
|
exportToXLSX: () => exportToXLSX,
|
|
82
83
|
features: () => features,
|
|
83
84
|
flexRender: () => import_react_table4.flexRender,
|
|
@@ -773,16 +774,6 @@ function SheetDescription(_a) {
|
|
|
773
774
|
// src/components/ui/skeleton.tsx
|
|
774
775
|
var import_cn9 = require("cn");
|
|
775
776
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
776
|
-
function Skeleton(_a) {
|
|
777
|
-
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
778
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
779
|
-
"div",
|
|
780
|
-
__spreadValues({
|
|
781
|
-
"data-slot": "skeleton",
|
|
782
|
-
className: (0, import_cn9.cn)("animate-pulse rounded-md bg-muted", className)
|
|
783
|
-
}, props)
|
|
784
|
-
);
|
|
785
|
-
}
|
|
786
777
|
|
|
787
778
|
// src/components/ui/tooltip.tsx
|
|
788
779
|
var import_tooltip = require("@base-ui/react/tooltip");
|
|
@@ -1344,9 +1335,10 @@ function formatSegment(segment, subHref, navMainItems = [], navSecondaryItems =
|
|
|
1344
1335
|
}
|
|
1345
1336
|
function isRouteActive(url, pathname) {
|
|
1346
1337
|
if (!pathname) return false;
|
|
1347
|
-
|
|
1348
|
-
const
|
|
1349
|
-
|
|
1338
|
+
const cleanUrl = url.replace(/\/$/, "") || "/";
|
|
1339
|
+
const cleanPath = pathname.replace(/\/$/, "") || "/";
|
|
1340
|
+
if (cleanUrl === "/") return cleanPath === "/";
|
|
1341
|
+
return cleanPath === cleanUrl || cleanPath.startsWith(`${cleanUrl}/`);
|
|
1350
1342
|
}
|
|
1351
1343
|
var AppSidebar = (0, import_react.memo)(function AppSidebar2({
|
|
1352
1344
|
name = "",
|
|
@@ -1540,7 +1532,8 @@ var AppSidebar = (0, import_react.memo)(function AppSidebar2({
|
|
|
1540
1532
|
|
|
1541
1533
|
// src/components/composed/data-table/data-table.tsx
|
|
1542
1534
|
var import_react_table4 = require("@tanstack/react-table");
|
|
1543
|
-
var
|
|
1535
|
+
var import_lucide_react18 = require("lucide-react");
|
|
1536
|
+
var import_navigation3 = require("next/navigation");
|
|
1544
1537
|
var import_react6 = require("react");
|
|
1545
1538
|
|
|
1546
1539
|
// src/components/composed/state-empty.tsx
|
|
@@ -1644,6 +1637,9 @@ function EmptyContent(_a) {
|
|
|
1644
1637
|
);
|
|
1645
1638
|
}
|
|
1646
1639
|
|
|
1640
|
+
// src/lib/utils.ts
|
|
1641
|
+
var import_cn13 = require("cn");
|
|
1642
|
+
|
|
1647
1643
|
// src/components/composed/state-empty.tsx
|
|
1648
1644
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1649
1645
|
function renderStateIcon(icon) {
|
|
@@ -1659,31 +1655,41 @@ var StateEmpty = (0, import_react2.memo)(function StateEmpty2({
|
|
|
1659
1655
|
description,
|
|
1660
1656
|
buttonText,
|
|
1661
1657
|
onClick,
|
|
1662
|
-
render
|
|
1658
|
+
render,
|
|
1659
|
+
state = "default"
|
|
1663
1660
|
}) {
|
|
1661
|
+
const isFunctionAction = typeof render === "function";
|
|
1662
|
+
const actionHandler = isFunctionAction ? render : onClick;
|
|
1663
|
+
const buttonRender = isFunctionAction ? void 0 : render;
|
|
1664
1664
|
const hasAction = Boolean(buttonText || render || onClick);
|
|
1665
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1665
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1666
|
+
Empty,
|
|
1667
|
+
{
|
|
1668
|
+
className: (0, import_cn13.cn)("w-full", state === "outline" && "border border-dashed"),
|
|
1669
|
+
children: [
|
|
1670
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(EmptyHeader, { children: [
|
|
1671
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(EmptyMedia, { variant: "icon", children: renderStateIcon(icon) }),
|
|
1672
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(EmptyTitle, { children: title }),
|
|
1673
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(EmptyDescription, { children: description })
|
|
1674
|
+
] }),
|
|
1675
|
+
hasAction && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(EmptyContent, { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1676
|
+
Button,
|
|
1677
|
+
{
|
|
1678
|
+
variant: "outline",
|
|
1679
|
+
size: "sm",
|
|
1680
|
+
nativeButton: !buttonRender,
|
|
1681
|
+
onClick: actionHandler,
|
|
1682
|
+
render: buttonRender,
|
|
1683
|
+
children: buttonText
|
|
1684
|
+
}
|
|
1685
|
+
) })
|
|
1686
|
+
]
|
|
1687
|
+
}
|
|
1688
|
+
);
|
|
1683
1689
|
});
|
|
1684
1690
|
|
|
1685
1691
|
// src/components/ui/table.tsx
|
|
1686
|
-
var
|
|
1692
|
+
var import_cn14 = require("cn");
|
|
1687
1693
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1688
1694
|
function Table(_a) {
|
|
1689
1695
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
@@ -1696,7 +1702,7 @@ function Table(_a) {
|
|
|
1696
1702
|
"table",
|
|
1697
1703
|
__spreadValues({
|
|
1698
1704
|
"data-slot": "table",
|
|
1699
|
-
className: (0,
|
|
1705
|
+
className: (0, import_cn14.cn)("w-full caption-bottom text-xs", className)
|
|
1700
1706
|
}, props)
|
|
1701
1707
|
)
|
|
1702
1708
|
}
|
|
@@ -1708,7 +1714,7 @@ function TableHeader(_a) {
|
|
|
1708
1714
|
"thead",
|
|
1709
1715
|
__spreadValues({
|
|
1710
1716
|
"data-slot": "table-header",
|
|
1711
|
-
className: (0,
|
|
1717
|
+
className: (0, import_cn14.cn)("[&_tr]:border-b", className)
|
|
1712
1718
|
}, props)
|
|
1713
1719
|
);
|
|
1714
1720
|
}
|
|
@@ -1718,7 +1724,7 @@ function TableBody(_a) {
|
|
|
1718
1724
|
"tbody",
|
|
1719
1725
|
__spreadValues({
|
|
1720
1726
|
"data-slot": "table-body",
|
|
1721
|
-
className: (0,
|
|
1727
|
+
className: (0, import_cn14.cn)("[&_tr:last-child]:border-0", className)
|
|
1722
1728
|
}, props)
|
|
1723
1729
|
);
|
|
1724
1730
|
}
|
|
@@ -1728,7 +1734,7 @@ function TableRow(_a) {
|
|
|
1728
1734
|
"tr",
|
|
1729
1735
|
__spreadValues({
|
|
1730
1736
|
"data-slot": "table-row",
|
|
1731
|
-
className: (0,
|
|
1737
|
+
className: (0, import_cn14.cn)(
|
|
1732
1738
|
"border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",
|
|
1733
1739
|
className
|
|
1734
1740
|
)
|
|
@@ -1741,7 +1747,7 @@ function TableHead(_a) {
|
|
|
1741
1747
|
"th",
|
|
1742
1748
|
__spreadValues({
|
|
1743
1749
|
"data-slot": "table-head",
|
|
1744
|
-
className: (0,
|
|
1750
|
+
className: (0, import_cn14.cn)(
|
|
1745
1751
|
"h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0",
|
|
1746
1752
|
className
|
|
1747
1753
|
)
|
|
@@ -1754,7 +1760,7 @@ function TableCell(_a) {
|
|
|
1754
1760
|
"td",
|
|
1755
1761
|
__spreadValues({
|
|
1756
1762
|
"data-slot": "table-cell",
|
|
1757
|
-
className: (0,
|
|
1763
|
+
className: (0, import_cn14.cn)(
|
|
1758
1764
|
"p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0",
|
|
1759
1765
|
className
|
|
1760
1766
|
)
|
|
@@ -1792,87 +1798,39 @@ var features = (0, import_react_table.tableFeatures)({
|
|
|
1792
1798
|
var import_react_table2 = require("@tanstack/react-table");
|
|
1793
1799
|
var import_lucide_react6 = require("lucide-react");
|
|
1794
1800
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1795
|
-
var SKELETON_ROWS = ["sk-1", "sk-2", "sk-3", "sk-4", "sk-5"];
|
|
1796
1801
|
function DataTableContentBody({
|
|
1797
1802
|
table,
|
|
1798
|
-
columns
|
|
1799
|
-
isLoading
|
|
1803
|
+
columns
|
|
1800
1804
|
}) {
|
|
1801
|
-
if (isLoading) {
|
|
1802
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TableBody, { children: SKELETON_ROWS.map((rowKey) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TableRow, { children: columns.map((col, idx) => {
|
|
1803
|
-
var _a;
|
|
1804
|
-
const colKey = (_a = col.id) != null ? _a : typeof col.accessorKey === "string" ? col.accessorKey : `col-${idx}`;
|
|
1805
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TableCell, { className: "py-3", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Skeleton, { className: "h-4 w-full" }) }, `${rowKey}-${colKey}`);
|
|
1806
|
-
}) }, rowKey)) });
|
|
1807
|
-
}
|
|
1808
1805
|
const rows = table.getRowModel().rows;
|
|
1809
1806
|
if (rows == null ? void 0 : rows.length) {
|
|
1810
1807
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TableBody, { children: rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TableRow, { children: row.getVisibleCells().map((cell) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TableCell, { children: (0, import_react_table2.flexRender)(cell.column.columnDef.cell, cell.getContext()) }, cell.id)) }, row.id)) });
|
|
1811
1808
|
}
|
|
1812
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TableBody, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TableCell, { colSpan: columns.length, className: "h-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
onClick: () => {
|
|
1823
|
-
table.resetGlobalFilter();
|
|
1824
|
-
table.resetColumnFilters();
|
|
1825
|
-
},
|
|
1826
|
-
children: "Clear search & filters"
|
|
1809
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TableBody, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TableCell, { colSpan: columns.length, className: "h-48 text-center", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1810
|
+
StateEmpty,
|
|
1811
|
+
{
|
|
1812
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react6.SearchXIcon, {}),
|
|
1813
|
+
title: "No matching results",
|
|
1814
|
+
description: "No records matched your search query or filter criteria.",
|
|
1815
|
+
buttonText: "Clear search & filters",
|
|
1816
|
+
render: () => {
|
|
1817
|
+
table.setGlobalFilter("");
|
|
1818
|
+
table.resetColumnFilters();
|
|
1827
1819
|
}
|
|
1828
|
-
|
|
1829
|
-
|
|
1820
|
+
}
|
|
1821
|
+
) }) }) });
|
|
1830
1822
|
}
|
|
1831
1823
|
|
|
1832
1824
|
// src/components/composed/data-table/table-content-header.tsx
|
|
1833
1825
|
var import_react_table3 = require("@tanstack/react-table");
|
|
1834
|
-
var import_lucide_react7 = require("lucide-react");
|
|
1835
|
-
|
|
1836
|
-
// src/lib/utils.ts
|
|
1837
|
-
var import_cn14 = require("cn");
|
|
1838
|
-
|
|
1839
|
-
// src/components/composed/data-table/table-content-header.tsx
|
|
1840
1826
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1841
1827
|
function DataTableContentHeader({
|
|
1842
1828
|
table
|
|
1843
1829
|
}) {
|
|
1844
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TableHeader, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TableRow, { children: headerGroup.headers.map((header) => {
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
const canSort = header.column.getCanSort();
|
|
1849
|
-
const isSorted = header.column.getIsSorted();
|
|
1850
|
-
if (!canSort) {
|
|
1851
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TableHead, { children: (0, import_react_table3.flexRender)(
|
|
1852
|
-
header.column.columnDef.header,
|
|
1853
|
-
header.getContext()
|
|
1854
|
-
) }, header.id);
|
|
1855
|
-
}
|
|
1856
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TableHead, { className: "select-none", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
1857
|
-
"button",
|
|
1858
|
-
{
|
|
1859
|
-
type: "button",
|
|
1860
|
-
className: (0, import_cn14.cn)(
|
|
1861
|
-
"flex items-center gap-1.5 -ml-1 px-1 py-1 rounded hover:bg-muted/50 cursor-pointer font-medium text-xs transition-colors",
|
|
1862
|
-
isSorted && "text-foreground font-semibold"
|
|
1863
|
-
),
|
|
1864
|
-
onClick: header.column.getToggleSortingHandler(),
|
|
1865
|
-
"aria-label": `Sort by ${typeof header.column.columnDef.header === "string" ? header.column.columnDef.header : header.id}`,
|
|
1866
|
-
children: [
|
|
1867
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: (0, import_react_table3.flexRender)(
|
|
1868
|
-
header.column.columnDef.header,
|
|
1869
|
-
header.getContext()
|
|
1870
|
-
) }),
|
|
1871
|
-
isSorted === "asc" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react7.ArrowUpIcon, { className: "size-3 text-foreground shrink-0" }) : isSorted === "desc" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react7.ArrowDownIcon, { className: "size-3 text-foreground shrink-0" }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react7.ArrowUpDownIcon, { className: "size-3 text-muted-foreground/40 hover:text-muted-foreground shrink-0" })
|
|
1872
|
-
]
|
|
1873
|
-
}
|
|
1874
|
-
) }, header.id);
|
|
1875
|
-
}) }, headerGroup.id)) });
|
|
1830
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TableHeader, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TableRow, { children: headerGroup.headers.map((header) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TableHead, { children: header.isPlaceholder ? null : (0, import_react_table3.flexRender)(
|
|
1831
|
+
header.column.columnDef.header,
|
|
1832
|
+
header.getContext()
|
|
1833
|
+
) }, header.id)) }, headerGroup.id)) });
|
|
1876
1834
|
}
|
|
1877
1835
|
|
|
1878
1836
|
// src/components/composed/data-table/table-footer-entries.tsx
|
|
@@ -1904,7 +1862,7 @@ function DataTableFooterEntries({
|
|
|
1904
1862
|
}
|
|
1905
1863
|
|
|
1906
1864
|
// src/components/composed/data-table/table-footer-pagination.tsx
|
|
1907
|
-
var
|
|
1865
|
+
var import_lucide_react7 = require("lucide-react");
|
|
1908
1866
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1909
1867
|
function DataTableFooterPagination({
|
|
1910
1868
|
table
|
|
@@ -1921,7 +1879,7 @@ function DataTableFooterPagination({
|
|
|
1921
1879
|
size: "icon-xs",
|
|
1922
1880
|
onClick: () => table.firstPage(),
|
|
1923
1881
|
disabled: !table.getCanPreviousPage(),
|
|
1924
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1882
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react7.ChevronsLeftIcon, {})
|
|
1925
1883
|
}
|
|
1926
1884
|
)
|
|
1927
1885
|
}
|
|
@@ -1939,7 +1897,7 @@ function DataTableFooterPagination({
|
|
|
1939
1897
|
size: "icon-xs",
|
|
1940
1898
|
onClick: () => table.previousPage(),
|
|
1941
1899
|
disabled: !table.getCanPreviousPage(),
|
|
1942
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1900
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react7.ChevronLeftIcon, {})
|
|
1943
1901
|
}
|
|
1944
1902
|
)
|
|
1945
1903
|
}
|
|
@@ -1957,7 +1915,7 @@ function DataTableFooterPagination({
|
|
|
1957
1915
|
size: "icon-xs",
|
|
1958
1916
|
onClick: () => table.nextPage(),
|
|
1959
1917
|
disabled: !table.getCanNextPage(),
|
|
1960
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1918
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react7.ChevronRightIcon, {})
|
|
1961
1919
|
}
|
|
1962
1920
|
)
|
|
1963
1921
|
}
|
|
@@ -1975,7 +1933,7 @@ function DataTableFooterPagination({
|
|
|
1975
1933
|
size: "icon-xs",
|
|
1976
1934
|
onClick: () => table.lastPage(),
|
|
1977
1935
|
disabled: !table.getCanNextPage(),
|
|
1978
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1936
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react7.ChevronsRightIcon, {})
|
|
1979
1937
|
}
|
|
1980
1938
|
)
|
|
1981
1939
|
}
|
|
@@ -1986,7 +1944,7 @@ function DataTableFooterPagination({
|
|
|
1986
1944
|
}
|
|
1987
1945
|
|
|
1988
1946
|
// src/components/composed/data-table/table-header-add.tsx
|
|
1989
|
-
var
|
|
1947
|
+
var import_lucide_react8 = require("lucide-react");
|
|
1990
1948
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1991
1949
|
function DataTableHeaderAdd({
|
|
1992
1950
|
onAdd,
|
|
@@ -1998,20 +1956,20 @@ function DataTableHeaderAdd({
|
|
|
1998
1956
|
TooltipTrigger,
|
|
1999
1957
|
{
|
|
2000
1958
|
className: "flex sm:hidden",
|
|
2001
|
-
render: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Button, { variant: "default", size: "icon", onClick: onAdd, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1959
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Button, { variant: "default", size: "icon", onClick: onAdd, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react8.PlusIcon, {}) })
|
|
2002
1960
|
}
|
|
2003
1961
|
),
|
|
2004
1962
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TooltipContent, { children: addLabel != null ? addLabel : "Add" })
|
|
2005
1963
|
] }),
|
|
2006
1964
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Button, { variant: "default", onClick: onAdd, className: "hidden sm:flex", children: [
|
|
2007
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1965
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react8.PlusIcon, {}),
|
|
2008
1966
|
addLabel != null ? addLabel : "Add"
|
|
2009
1967
|
] })
|
|
2010
1968
|
] });
|
|
2011
1969
|
}
|
|
2012
1970
|
|
|
2013
1971
|
// src/components/composed/data-table/table-header-download.tsx
|
|
2014
|
-
var
|
|
1972
|
+
var import_lucide_react9 = require("lucide-react");
|
|
2015
1973
|
|
|
2016
1974
|
// src/components/composed/data-table/export.ts
|
|
2017
1975
|
var XLSX = __toESM(require("xlsx"));
|
|
@@ -2072,6 +2030,41 @@ function exportToCSV(rows, filename = "data-export") {
|
|
|
2072
2030
|
URL.revokeObjectURL(url);
|
|
2073
2031
|
}, 1e3);
|
|
2074
2032
|
}
|
|
2033
|
+
async function exportToPDF(headers, rows, filename = "data-export", title = "Data Export") {
|
|
2034
|
+
const [{ jsPDF }, autoTableMod] = await Promise.all([
|
|
2035
|
+
import("jspdf"),
|
|
2036
|
+
import("jspdf-autotable")
|
|
2037
|
+
]);
|
|
2038
|
+
const autoTable = autoTableMod.autoTable || autoTableMod.default;
|
|
2039
|
+
const orientation = headers.length > 5 ? "landscape" : "portrait";
|
|
2040
|
+
const doc = new jsPDF({ orientation });
|
|
2041
|
+
doc.setFontSize(14);
|
|
2042
|
+
doc.setFont("helvetica", "bold");
|
|
2043
|
+
doc.text(title, 14, 15);
|
|
2044
|
+
doc.setFontSize(8);
|
|
2045
|
+
doc.setFont("helvetica", "normal");
|
|
2046
|
+
doc.setTextColor(120);
|
|
2047
|
+
doc.text(`Generated on ${(/* @__PURE__ */ new Date()).toLocaleString()}`, 14, 20);
|
|
2048
|
+
autoTable(doc, {
|
|
2049
|
+
head: [headers],
|
|
2050
|
+
body: rows,
|
|
2051
|
+
startY: 24,
|
|
2052
|
+
styles: {
|
|
2053
|
+
fontSize: 8,
|
|
2054
|
+
cellPadding: 2.5
|
|
2055
|
+
},
|
|
2056
|
+
headStyles: {
|
|
2057
|
+
fillColor: [40, 40, 40],
|
|
2058
|
+
textColor: [255, 255, 255],
|
|
2059
|
+
fontStyle: "bold"
|
|
2060
|
+
},
|
|
2061
|
+
alternateRowStyles: {
|
|
2062
|
+
fillColor: [248, 248, 248]
|
|
2063
|
+
}
|
|
2064
|
+
});
|
|
2065
|
+
const finalFilename = filename.endsWith(".pdf") ? filename : `${filename}.pdf`;
|
|
2066
|
+
doc.save(finalFilename);
|
|
2067
|
+
}
|
|
2075
2068
|
function printTable(headers, rows, title = "Data Export") {
|
|
2076
2069
|
let tableHtml = `<table style="width:100%; border-collapse:collapse; font-family:sans-serif; font-size:12px;"><thead><tr>`;
|
|
2077
2070
|
for (const header of headers) {
|
|
@@ -2167,7 +2160,7 @@ function DataTableHeaderDownload({
|
|
|
2167
2160
|
render: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2168
2161
|
TooltipTrigger,
|
|
2169
2162
|
{
|
|
2170
|
-
render: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Button, { variant: "outline", size: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2163
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Button, { variant: "outline", size: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.DownloadIcon, {}) })
|
|
2171
2164
|
}
|
|
2172
2165
|
)
|
|
2173
2166
|
}
|
|
@@ -2181,13 +2174,13 @@ function DataTableHeaderDownload({
|
|
|
2181
2174
|
DropdownMenuItem,
|
|
2182
2175
|
{
|
|
2183
2176
|
className: "hover:cursor-pointer",
|
|
2184
|
-
onClick: () => {
|
|
2177
|
+
onClick: async () => {
|
|
2185
2178
|
const { headers, rows } = getTableExportData(table);
|
|
2186
|
-
|
|
2179
|
+
await exportToPDF(headers, rows, exportFilename);
|
|
2187
2180
|
onDownload == null ? void 0 : onDownload();
|
|
2188
2181
|
},
|
|
2189
2182
|
children: [
|
|
2190
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2183
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.FileTextIcon, {}),
|
|
2191
2184
|
"Download PDF"
|
|
2192
2185
|
]
|
|
2193
2186
|
}
|
|
@@ -2202,7 +2195,7 @@ function DataTableHeaderDownload({
|
|
|
2202
2195
|
onDownload == null ? void 0 : onDownload();
|
|
2203
2196
|
},
|
|
2204
2197
|
children: [
|
|
2205
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2198
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.FileSpreadsheetIcon, {}),
|
|
2206
2199
|
"Download Excel"
|
|
2207
2200
|
]
|
|
2208
2201
|
}
|
|
@@ -2217,7 +2210,7 @@ function DataTableHeaderDownload({
|
|
|
2217
2210
|
onDownload == null ? void 0 : onDownload();
|
|
2218
2211
|
},
|
|
2219
2212
|
children: [
|
|
2220
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2213
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.FileCodeIcon, {}),
|
|
2221
2214
|
"Download CSV"
|
|
2222
2215
|
]
|
|
2223
2216
|
}
|
|
@@ -2232,7 +2225,7 @@ function DataTableHeaderDownload({
|
|
|
2232
2225
|
printTable(headers, rows, exportFilename);
|
|
2233
2226
|
},
|
|
2234
2227
|
children: [
|
|
2235
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2228
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.PrinterIcon, {}),
|
|
2236
2229
|
"Print Table"
|
|
2237
2230
|
]
|
|
2238
2231
|
}
|
|
@@ -2243,12 +2236,12 @@ function DataTableHeaderDownload({
|
|
|
2243
2236
|
|
|
2244
2237
|
// src/components/composed/data-table/table-header-filter.tsx
|
|
2245
2238
|
var import_date_fns = require("date-fns");
|
|
2246
|
-
var
|
|
2239
|
+
var import_lucide_react12 = require("lucide-react");
|
|
2247
2240
|
var import_react3 = require("react");
|
|
2248
2241
|
|
|
2249
2242
|
// src/components/ui/calendar.tsx
|
|
2250
2243
|
var import_cn15 = require("cn");
|
|
2251
|
-
var
|
|
2244
|
+
var import_lucide_react10 = require("lucide-react");
|
|
2252
2245
|
var React3 = __toESM(require("react"));
|
|
2253
2246
|
var import_react_day_picker = require("react-day-picker");
|
|
2254
2247
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
@@ -2388,17 +2381,17 @@ function Calendar(_a) {
|
|
|
2388
2381
|
Chevron: (_c) => {
|
|
2389
2382
|
var _d = _c, { className: className2, orientation } = _d, props2 = __objRest(_d, ["className", "orientation"]);
|
|
2390
2383
|
if (orientation === "left") {
|
|
2391
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2384
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.ChevronLeftIcon, __spreadValues({ className: (0, import_cn15.cn)("size-4", className2) }, props2));
|
|
2392
2385
|
}
|
|
2393
2386
|
if (orientation === "right") {
|
|
2394
2387
|
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2395
|
-
|
|
2388
|
+
import_lucide_react10.ChevronRightIcon,
|
|
2396
2389
|
__spreadValues({
|
|
2397
2390
|
className: (0, import_cn15.cn)("size-4", className2)
|
|
2398
2391
|
}, props2)
|
|
2399
2392
|
);
|
|
2400
2393
|
}
|
|
2401
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2394
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.ChevronDownIcon, __spreadValues({ className: (0, import_cn15.cn)("size-4", className2) }, props2));
|
|
2402
2395
|
},
|
|
2403
2396
|
DayButton: (_e) => {
|
|
2404
2397
|
var props2 = __objRest(_e, []);
|
|
@@ -2500,7 +2493,7 @@ function PopoverContent(_a) {
|
|
|
2500
2493
|
// src/components/ui/select.tsx
|
|
2501
2494
|
var import_select = require("@base-ui/react/select");
|
|
2502
2495
|
var import_cn17 = require("cn");
|
|
2503
|
-
var
|
|
2496
|
+
var import_lucide_react11 = require("lucide-react");
|
|
2504
2497
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2505
2498
|
var Select = import_select.Select.Root;
|
|
2506
2499
|
function SelectValue(_a) {
|
|
@@ -2538,7 +2531,7 @@ function SelectTrigger(_a) {
|
|
|
2538
2531
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2539
2532
|
import_select.Select.Icon,
|
|
2540
2533
|
{
|
|
2541
|
-
render: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2534
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.ChevronDownIcon, { className: "pointer-events-none size-3.5 text-muted-foreground" })
|
|
2542
2535
|
}
|
|
2543
2536
|
)
|
|
2544
2537
|
]
|
|
@@ -2615,7 +2608,7 @@ function SelectItem(_a) {
|
|
|
2615
2608
|
import_select.Select.ItemIndicator,
|
|
2616
2609
|
{
|
|
2617
2610
|
render: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "pointer-events-none absolute right-2 flex items-center justify-center" }),
|
|
2618
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2611
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.CheckIcon, { className: "pointer-events-none" })
|
|
2619
2612
|
}
|
|
2620
2613
|
)
|
|
2621
2614
|
]
|
|
@@ -2637,7 +2630,7 @@ function SelectScrollUpButton(_a) {
|
|
|
2637
2630
|
className
|
|
2638
2631
|
)
|
|
2639
2632
|
}, props), {
|
|
2640
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2633
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.ChevronUpIcon, {})
|
|
2641
2634
|
})
|
|
2642
2635
|
);
|
|
2643
2636
|
}
|
|
@@ -2656,7 +2649,7 @@ function SelectScrollDownButton(_a) {
|
|
|
2656
2649
|
className
|
|
2657
2650
|
)
|
|
2658
2651
|
}, props), {
|
|
2659
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2652
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.ChevronDownIcon, {})
|
|
2660
2653
|
})
|
|
2661
2654
|
);
|
|
2662
2655
|
}
|
|
@@ -2887,14 +2880,14 @@ function ColumnFilterInput({
|
|
|
2887
2880
|
Button,
|
|
2888
2881
|
{
|
|
2889
2882
|
variant: "outline",
|
|
2890
|
-
className: (0,
|
|
2883
|
+
className: (0, import_cn13.cn)(
|
|
2891
2884
|
"w-full justify-start",
|
|
2892
2885
|
!formattedDateLabel && "text-muted-foreground"
|
|
2893
2886
|
),
|
|
2894
2887
|
onKeyDown: (e) => e.stopPropagation(),
|
|
2895
2888
|
onPointerDown: (e) => e.stopPropagation(),
|
|
2896
2889
|
children: [
|
|
2897
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2890
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.CalendarIcon, { className: "mr-1 size-3 shrink-0" }),
|
|
2898
2891
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "truncate", children: formattedDateLabel || `Pick ${headerText.toLowerCase()}...` })
|
|
2899
2892
|
]
|
|
2900
2893
|
}
|
|
@@ -2964,7 +2957,7 @@ function DataTableHeaderFilter({
|
|
|
2964
2957
|
{
|
|
2965
2958
|
variant: columnFilters.length > 0 ? "secondary" : "outline",
|
|
2966
2959
|
size: "icon",
|
|
2967
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2960
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.ListFilterIcon, {})
|
|
2968
2961
|
}
|
|
2969
2962
|
)
|
|
2970
2963
|
}
|
|
@@ -3020,22 +3013,16 @@ function DataTableHeaderFilter({
|
|
|
3020
3013
|
}
|
|
3021
3014
|
|
|
3022
3015
|
// src/components/composed/data-table/table-header-refresh.tsx
|
|
3023
|
-
var
|
|
3016
|
+
var import_lucide_react13 = require("lucide-react");
|
|
3024
3017
|
var import_navigation2 = require("next/navigation");
|
|
3025
3018
|
var import_react4 = require("react");
|
|
3026
3019
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
3027
|
-
function DataTableHeaderRefresh({
|
|
3028
|
-
onRefresh
|
|
3029
|
-
}) {
|
|
3020
|
+
function DataTableHeaderRefresh() {
|
|
3030
3021
|
const router = (0, import_navigation2.useRouter)();
|
|
3031
3022
|
const [isRefreshing, setIsRefreshing] = (0, import_react4.useState)(false);
|
|
3032
3023
|
const handleRefresh = () => {
|
|
3033
3024
|
setIsRefreshing(true);
|
|
3034
|
-
|
|
3035
|
-
onRefresh();
|
|
3036
|
-
} else {
|
|
3037
|
-
router.refresh();
|
|
3038
|
-
}
|
|
3025
|
+
router.refresh();
|
|
3039
3026
|
setTimeout(() => {
|
|
3040
3027
|
setIsRefreshing(false);
|
|
3041
3028
|
}, 750);
|
|
@@ -3052,9 +3039,9 @@ function DataTableHeaderRefresh({
|
|
|
3052
3039
|
onClick: handleRefresh,
|
|
3053
3040
|
disabled: isRefreshing,
|
|
3054
3041
|
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3055
|
-
|
|
3042
|
+
import_lucide_react13.RotateCwIcon,
|
|
3056
3043
|
{
|
|
3057
|
-
className: (0,
|
|
3044
|
+
className: (0, import_cn13.cn)(
|
|
3058
3045
|
"transition-transform duration-750",
|
|
3059
3046
|
isRefreshing && "animate-spin"
|
|
3060
3047
|
)
|
|
@@ -3069,38 +3056,37 @@ function DataTableHeaderRefresh({
|
|
|
3069
3056
|
}
|
|
3070
3057
|
|
|
3071
3058
|
// src/components/composed/data-table/table-header-search.tsx
|
|
3072
|
-
var
|
|
3059
|
+
var import_lucide_react14 = require("lucide-react");
|
|
3073
3060
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
3074
3061
|
function DataTableHeaderSearch({
|
|
3075
|
-
value,
|
|
3076
|
-
onChange
|
|
3077
|
-
placeholder = "Search..."
|
|
3062
|
+
value = "",
|
|
3063
|
+
onChange
|
|
3078
3064
|
}) {
|
|
3079
3065
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "relative flex items-center max-w-sm w-full", children: [
|
|
3080
3066
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3081
3067
|
Input,
|
|
3082
3068
|
{
|
|
3083
|
-
placeholder,
|
|
3084
|
-
value,
|
|
3069
|
+
placeholder: "Search...",
|
|
3070
|
+
value: value != null ? value : "",
|
|
3085
3071
|
onChange: (event) => onChange(event.target.value),
|
|
3086
3072
|
className: "pr-7"
|
|
3087
3073
|
}
|
|
3088
3074
|
),
|
|
3089
|
-
value && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3075
|
+
Boolean(value) && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3090
3076
|
"button",
|
|
3091
3077
|
{
|
|
3092
3078
|
type: "button",
|
|
3093
3079
|
onClick: () => onChange(""),
|
|
3094
3080
|
className: "absolute right-2 text-muted-foreground hover:text-foreground p-0.5 rounded cursor-pointer",
|
|
3095
3081
|
"aria-label": "Clear search text",
|
|
3096
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3082
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react14.XIcon, { className: "size-3.5" })
|
|
3097
3083
|
}
|
|
3098
3084
|
)
|
|
3099
3085
|
] });
|
|
3100
3086
|
}
|
|
3101
3087
|
|
|
3102
3088
|
// src/components/composed/data-table/table-header-sort.tsx
|
|
3103
|
-
var
|
|
3089
|
+
var import_lucide_react15 = require("lucide-react");
|
|
3104
3090
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
3105
3091
|
function DataTableHeaderSort({
|
|
3106
3092
|
table,
|
|
@@ -3120,7 +3106,7 @@ function DataTableHeaderSort({
|
|
|
3120
3106
|
{
|
|
3121
3107
|
variant: sorting.length > 0 ? "secondary" : "outline",
|
|
3122
3108
|
size: "icon",
|
|
3123
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3109
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react15.ArrowUpDownIcon, {})
|
|
3124
3110
|
}
|
|
3125
3111
|
)
|
|
3126
3112
|
}
|
|
@@ -3149,9 +3135,9 @@ function DataTableHeaderSort({
|
|
|
3149
3135
|
}
|
|
3150
3136
|
},
|
|
3151
3137
|
children: [
|
|
3152
|
-
|
|
3153
|
-
isSorted === "asc" && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3154
|
-
isSorted === "desc" && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3138
|
+
headerText,
|
|
3139
|
+
isSorted === "asc" && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react15.ArrowUpIcon, { className: "size-3.5" }),
|
|
3140
|
+
isSorted === "desc" && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react15.ArrowDownIcon, { className: "size-3.5" })
|
|
3155
3141
|
]
|
|
3156
3142
|
},
|
|
3157
3143
|
column.id
|
|
@@ -3164,7 +3150,7 @@ function DataTableHeaderSort({
|
|
|
3164
3150
|
{
|
|
3165
3151
|
className: "hover:cursor-pointer text-destructive focus:text-destructive",
|
|
3166
3152
|
onClick: () => table.resetSorting(),
|
|
3167
|
-
children: "Clear
|
|
3153
|
+
children: "Clear sorting"
|
|
3168
3154
|
}
|
|
3169
3155
|
)
|
|
3170
3156
|
] })
|
|
@@ -3173,7 +3159,7 @@ function DataTableHeaderSort({
|
|
|
3173
3159
|
}
|
|
3174
3160
|
|
|
3175
3161
|
// src/components/composed/data-table/table-header-toggle.tsx
|
|
3176
|
-
var
|
|
3162
|
+
var import_lucide_react16 = require("lucide-react");
|
|
3177
3163
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
3178
3164
|
function DataTableHeaderToggle({
|
|
3179
3165
|
table
|
|
@@ -3186,7 +3172,7 @@ function DataTableHeaderToggle({
|
|
|
3186
3172
|
render: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3187
3173
|
TooltipTrigger,
|
|
3188
3174
|
{
|
|
3189
|
-
render: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Button, { variant: "outline", size: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3175
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Button, { variant: "outline", size: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react16.Columns3CogIcon, {}) })
|
|
3190
3176
|
}
|
|
3191
3177
|
)
|
|
3192
3178
|
}
|
|
@@ -3216,7 +3202,7 @@ function DataTableHeaderToggle({
|
|
|
3216
3202
|
}
|
|
3217
3203
|
|
|
3218
3204
|
// src/components/composed/data-table/data-row-actions.tsx
|
|
3219
|
-
var
|
|
3205
|
+
var import_lucide_react17 = require("lucide-react");
|
|
3220
3206
|
var import_react5 = require("react");
|
|
3221
3207
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
3222
3208
|
function RowActions({
|
|
@@ -3235,19 +3221,19 @@ function RowActions({
|
|
|
3235
3221
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3236
3222
|
"div",
|
|
3237
3223
|
{
|
|
3238
|
-
className: (0,
|
|
3224
|
+
className: (0, import_cn13.cn)("flex items-center justify-end w-full", containerClassName),
|
|
3239
3225
|
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(DropdownMenu, { children: [
|
|
3240
3226
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3241
3227
|
DropdownMenuTrigger,
|
|
3242
3228
|
{
|
|
3243
|
-
render: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Button, { variant: "ghost", size: "icon-xs", "aria-label": triggerLabel, children: triggerIcon != null ? triggerIcon : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3229
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Button, { variant: "ghost", size: "icon-xs", "aria-label": triggerLabel, children: triggerIcon != null ? triggerIcon : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_lucide_react17.MoreHorizontal, { className: "size-4" }) })
|
|
3244
3230
|
}
|
|
3245
3231
|
),
|
|
3246
3232
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3247
3233
|
DropdownMenuContent,
|
|
3248
3234
|
{
|
|
3249
3235
|
align,
|
|
3250
|
-
className: (0,
|
|
3236
|
+
className: (0, import_cn13.cn)("w-40", contentClassName),
|
|
3251
3237
|
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(DropdownMenuGroup, { children: [
|
|
3252
3238
|
label && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
3253
3239
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DropdownMenuLabel, { children: label }),
|
|
@@ -3264,7 +3250,7 @@ function RowActions({
|
|
|
3264
3250
|
{
|
|
3265
3251
|
onClick: item.onClick,
|
|
3266
3252
|
disabled: item.disabled,
|
|
3267
|
-
className: (0,
|
|
3253
|
+
className: (0, import_cn13.cn)(
|
|
3268
3254
|
"hover:cursor-pointer flex items-center gap-2",
|
|
3269
3255
|
isDestructive && "text-destructive focus:text-destructive",
|
|
3270
3256
|
item.className
|
|
@@ -3294,26 +3280,17 @@ function DataTable({
|
|
|
3294
3280
|
initialColumnVisibility,
|
|
3295
3281
|
renderCreateDialog,
|
|
3296
3282
|
addLabel,
|
|
3297
|
-
onRefresh,
|
|
3298
3283
|
onDownload,
|
|
3299
3284
|
exportFilename = "data-export",
|
|
3300
|
-
isLoading = false,
|
|
3301
|
-
searchPlaceholder = "Search...",
|
|
3302
3285
|
showSearchInput = true,
|
|
3303
3286
|
showRefreshButton = true,
|
|
3304
3287
|
showSortButton = true,
|
|
3305
3288
|
showFilterButton = true,
|
|
3306
3289
|
showDownloadButton = true,
|
|
3307
3290
|
showColumnToggleButton = true,
|
|
3308
|
-
showAddButton = true
|
|
3309
|
-
emptyIcon,
|
|
3310
|
-
emptyTitle,
|
|
3311
|
-
emptyDescription,
|
|
3312
|
-
emptyButtonText,
|
|
3313
|
-
emptyRender,
|
|
3314
|
-
onEmptyAction,
|
|
3315
|
-
renderEmptyState
|
|
3291
|
+
showAddButton = true
|
|
3316
3292
|
}) {
|
|
3293
|
+
const router = (0, import_navigation3.useRouter)();
|
|
3317
3294
|
const [createOpen, setCreateOpen] = (0, import_react6.useState)(false);
|
|
3318
3295
|
const [sorting, setSorting] = (0, import_react6.useState)([]);
|
|
3319
3296
|
const [columnFilters, setColumnFilters] = (0, import_react6.useState)([]);
|
|
@@ -3328,30 +3305,37 @@ function DataTable({
|
|
|
3328
3305
|
features,
|
|
3329
3306
|
data,
|
|
3330
3307
|
columns: columnsWithSmartFilters,
|
|
3308
|
+
initialState: {
|
|
3309
|
+
globalFilter: ""
|
|
3310
|
+
},
|
|
3331
3311
|
onSortingChange: setSorting,
|
|
3332
3312
|
onColumnFiltersChange: setColumnFilters,
|
|
3333
3313
|
onColumnVisibilityChange: setColumnVisibility,
|
|
3334
|
-
onGlobalFilterChange:
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3314
|
+
onGlobalFilterChange: (updater) => {
|
|
3315
|
+
setGlobalFilter((prev) => {
|
|
3316
|
+
const next = typeof updater === "function" ? updater(prev) : updater;
|
|
3317
|
+
return next != null ? next : "";
|
|
3318
|
+
});
|
|
3319
|
+
},
|
|
3320
|
+
state: {
|
|
3321
|
+
sorting,
|
|
3322
|
+
columnFilters,
|
|
3323
|
+
columnVisibility,
|
|
3324
|
+
globalFilter: globalFilter != null ? globalFilter : ""
|
|
3343
3325
|
}
|
|
3344
|
-
|
|
3326
|
+
});
|
|
3327
|
+
if (data.length === 0) {
|
|
3328
|
+
const hasCreateAction = Boolean(renderCreateDialog);
|
|
3345
3329
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "space-y-2", children: [
|
|
3346
3330
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3347
3331
|
StateEmpty,
|
|
3348
3332
|
{
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
render:
|
|
3333
|
+
state: "outline",
|
|
3334
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react18.FolderOpenIcon, { className: "size-6 text-muted-foreground" }),
|
|
3335
|
+
title: "No Data Available",
|
|
3336
|
+
description: "There are currently no records to display. Create a new record to get started.",
|
|
3337
|
+
buttonText: hasCreateAction ? addLabel != null ? addLabel : "Add Record" : "Refresh",
|
|
3338
|
+
render: hasCreateAction ? () => setCreateOpen(true) : () => router.refresh()
|
|
3355
3339
|
}
|
|
3356
3340
|
),
|
|
3357
3341
|
renderCreateDialog == null ? void 0 : renderCreateDialog(createOpen, setCreateOpen)
|
|
@@ -3363,12 +3347,11 @@ function DataTable({
|
|
|
3363
3347
|
DataTableHeaderSearch,
|
|
3364
3348
|
{
|
|
3365
3349
|
value: globalFilter,
|
|
3366
|
-
onChange: setGlobalFilter
|
|
3367
|
-
placeholder: searchPlaceholder
|
|
3350
|
+
onChange: setGlobalFilter
|
|
3368
3351
|
}
|
|
3369
3352
|
) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", {}),
|
|
3370
3353
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-row items-center gap-1", children: [
|
|
3371
|
-
showRefreshButton && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(DataTableHeaderRefresh, {
|
|
3354
|
+
showRefreshButton && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(DataTableHeaderRefresh, {}),
|
|
3372
3355
|
showSortButton && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(DataTableHeaderSort, { table, sorting }),
|
|
3373
3356
|
showFilterButton && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3374
3357
|
DataTableHeaderFilter,
|
|
@@ -3398,14 +3381,7 @@ function DataTable({
|
|
|
3398
3381
|
renderCreateDialog == null ? void 0 : renderCreateDialog(createOpen, setCreateOpen),
|
|
3399
3382
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "overflow-hidden rounded-md border [&_[data-slot=table-container]]:no-scrollbar", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(Table, { children: [
|
|
3400
3383
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(DataTableContentHeader, { table }),
|
|
3401
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3402
|
-
DataTableContentBody,
|
|
3403
|
-
{
|
|
3404
|
-
table,
|
|
3405
|
-
columns,
|
|
3406
|
-
isLoading
|
|
3407
|
-
}
|
|
3408
|
-
)
|
|
3384
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(DataTableContentBody, { table, columns })
|
|
3409
3385
|
] }) }),
|
|
3410
3386
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center justify-between px-2", children: [
|
|
3411
3387
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(DataTableFooterEntries, { table }),
|
|
@@ -3416,7 +3392,7 @@ function DataTable({
|
|
|
3416
3392
|
|
|
3417
3393
|
// src/components/composed/header-tabs.tsx
|
|
3418
3394
|
var import_link2 = __toESM(require("next/link"));
|
|
3419
|
-
var
|
|
3395
|
+
var import_navigation4 = require("next/navigation");
|
|
3420
3396
|
var import_react7 = require("react");
|
|
3421
3397
|
|
|
3422
3398
|
// src/components/ui/tabs.tsx
|
|
@@ -3509,7 +3485,7 @@ var HeaderTabs = (0, import_react7.memo)(function HeaderTabs2({
|
|
|
3509
3485
|
children
|
|
3510
3486
|
}) {
|
|
3511
3487
|
var _a, _b;
|
|
3512
|
-
const pathname = (0,
|
|
3488
|
+
const pathname = (0, import_navigation4.usePathname)();
|
|
3513
3489
|
const matchedItem = pathname ? items.find(
|
|
3514
3490
|
(item) => item.url === pathname || pathname.endsWith(item.url) || pathname.split("/").includes(item.value)
|
|
3515
3491
|
) : void 0;
|
|
@@ -3568,6 +3544,7 @@ var HeaderTitle = (0, import_react8.memo)(function HeaderTitle2({
|
|
|
3568
3544
|
RowActions,
|
|
3569
3545
|
StateEmpty,
|
|
3570
3546
|
exportToCSV,
|
|
3547
|
+
exportToPDF,
|
|
3571
3548
|
exportToXLSX,
|
|
3572
3549
|
features,
|
|
3573
3550
|
flexRender,
|