@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.mjs
CHANGED
|
@@ -716,16 +716,6 @@ function SheetDescription(_a) {
|
|
|
716
716
|
// src/components/ui/skeleton.tsx
|
|
717
717
|
import { cn as cn9 } from "cn";
|
|
718
718
|
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
719
|
-
function Skeleton(_a) {
|
|
720
|
-
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
721
|
-
return /* @__PURE__ */ jsx9(
|
|
722
|
-
"div",
|
|
723
|
-
__spreadValues({
|
|
724
|
-
"data-slot": "skeleton",
|
|
725
|
-
className: cn9("animate-pulse rounded-md bg-muted", className)
|
|
726
|
-
}, props)
|
|
727
|
-
);
|
|
728
|
-
}
|
|
729
719
|
|
|
730
720
|
// src/components/ui/tooltip.tsx
|
|
731
721
|
import { Tooltip as TooltipPrimitive } from "@base-ui/react/tooltip";
|
|
@@ -1287,9 +1277,10 @@ function formatSegment(segment, subHref, navMainItems = [], navSecondaryItems =
|
|
|
1287
1277
|
}
|
|
1288
1278
|
function isRouteActive(url, pathname) {
|
|
1289
1279
|
if (!pathname) return false;
|
|
1290
|
-
|
|
1291
|
-
const
|
|
1292
|
-
|
|
1280
|
+
const cleanUrl = url.replace(/\/$/, "") || "/";
|
|
1281
|
+
const cleanPath = pathname.replace(/\/$/, "") || "/";
|
|
1282
|
+
if (cleanUrl === "/") return cleanPath === "/";
|
|
1283
|
+
return cleanPath === cleanUrl || cleanPath.startsWith(`${cleanUrl}/`);
|
|
1293
1284
|
}
|
|
1294
1285
|
var AppSidebar = memo(function AppSidebar2({
|
|
1295
1286
|
name = "",
|
|
@@ -1487,6 +1478,7 @@ import {
|
|
|
1487
1478
|
useTable
|
|
1488
1479
|
} from "@tanstack/react-table";
|
|
1489
1480
|
import { FolderOpenIcon } from "lucide-react";
|
|
1481
|
+
import { useRouter as useRouter2 } from "next/navigation";
|
|
1490
1482
|
import { useMemo as useMemo3, useState as useState5 } from "react";
|
|
1491
1483
|
|
|
1492
1484
|
// src/components/composed/state-empty.tsx
|
|
@@ -1590,6 +1582,9 @@ function EmptyContent(_a) {
|
|
|
1590
1582
|
);
|
|
1591
1583
|
}
|
|
1592
1584
|
|
|
1585
|
+
// src/lib/utils.ts
|
|
1586
|
+
import { cn as cn13 } from "cn";
|
|
1587
|
+
|
|
1593
1588
|
// src/components/composed/state-empty.tsx
|
|
1594
1589
|
import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1595
1590
|
function renderStateIcon(icon) {
|
|
@@ -1605,31 +1600,41 @@ var StateEmpty = memo2(function StateEmpty2({
|
|
|
1605
1600
|
description,
|
|
1606
1601
|
buttonText,
|
|
1607
1602
|
onClick,
|
|
1608
|
-
render
|
|
1603
|
+
render,
|
|
1604
|
+
state = "default"
|
|
1609
1605
|
}) {
|
|
1606
|
+
const isFunctionAction = typeof render === "function";
|
|
1607
|
+
const actionHandler = isFunctionAction ? render : onClick;
|
|
1608
|
+
const buttonRender = isFunctionAction ? void 0 : render;
|
|
1610
1609
|
const hasAction = Boolean(buttonText || render || onClick);
|
|
1611
|
-
return /* @__PURE__ */ jsxs8(
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1610
|
+
return /* @__PURE__ */ jsxs8(
|
|
1611
|
+
Empty,
|
|
1612
|
+
{
|
|
1613
|
+
className: cn13("w-full", state === "outline" && "border border-dashed"),
|
|
1614
|
+
children: [
|
|
1615
|
+
/* @__PURE__ */ jsxs8(EmptyHeader, { children: [
|
|
1616
|
+
/* @__PURE__ */ jsx14(EmptyMedia, { variant: "icon", children: renderStateIcon(icon) }),
|
|
1617
|
+
/* @__PURE__ */ jsx14(EmptyTitle, { children: title }),
|
|
1618
|
+
/* @__PURE__ */ jsx14(EmptyDescription, { children: description })
|
|
1619
|
+
] }),
|
|
1620
|
+
hasAction && /* @__PURE__ */ jsx14(EmptyContent, { children: /* @__PURE__ */ jsx14(
|
|
1621
|
+
Button,
|
|
1622
|
+
{
|
|
1623
|
+
variant: "outline",
|
|
1624
|
+
size: "sm",
|
|
1625
|
+
nativeButton: !buttonRender,
|
|
1626
|
+
onClick: actionHandler,
|
|
1627
|
+
render: buttonRender,
|
|
1628
|
+
children: buttonText
|
|
1629
|
+
}
|
|
1630
|
+
) })
|
|
1631
|
+
]
|
|
1632
|
+
}
|
|
1633
|
+
);
|
|
1629
1634
|
});
|
|
1630
1635
|
|
|
1631
1636
|
// src/components/ui/table.tsx
|
|
1632
|
-
import { cn as
|
|
1637
|
+
import { cn as cn14 } from "cn";
|
|
1633
1638
|
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
1634
1639
|
function Table(_a) {
|
|
1635
1640
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
@@ -1642,7 +1647,7 @@ function Table(_a) {
|
|
|
1642
1647
|
"table",
|
|
1643
1648
|
__spreadValues({
|
|
1644
1649
|
"data-slot": "table",
|
|
1645
|
-
className:
|
|
1650
|
+
className: cn14("w-full caption-bottom text-xs", className)
|
|
1646
1651
|
}, props)
|
|
1647
1652
|
)
|
|
1648
1653
|
}
|
|
@@ -1654,7 +1659,7 @@ function TableHeader(_a) {
|
|
|
1654
1659
|
"thead",
|
|
1655
1660
|
__spreadValues({
|
|
1656
1661
|
"data-slot": "table-header",
|
|
1657
|
-
className:
|
|
1662
|
+
className: cn14("[&_tr]:border-b", className)
|
|
1658
1663
|
}, props)
|
|
1659
1664
|
);
|
|
1660
1665
|
}
|
|
@@ -1664,7 +1669,7 @@ function TableBody(_a) {
|
|
|
1664
1669
|
"tbody",
|
|
1665
1670
|
__spreadValues({
|
|
1666
1671
|
"data-slot": "table-body",
|
|
1667
|
-
className:
|
|
1672
|
+
className: cn14("[&_tr:last-child]:border-0", className)
|
|
1668
1673
|
}, props)
|
|
1669
1674
|
);
|
|
1670
1675
|
}
|
|
@@ -1674,7 +1679,7 @@ function TableRow(_a) {
|
|
|
1674
1679
|
"tr",
|
|
1675
1680
|
__spreadValues({
|
|
1676
1681
|
"data-slot": "table-row",
|
|
1677
|
-
className:
|
|
1682
|
+
className: cn14(
|
|
1678
1683
|
"border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",
|
|
1679
1684
|
className
|
|
1680
1685
|
)
|
|
@@ -1687,7 +1692,7 @@ function TableHead(_a) {
|
|
|
1687
1692
|
"th",
|
|
1688
1693
|
__spreadValues({
|
|
1689
1694
|
"data-slot": "table-head",
|
|
1690
|
-
className:
|
|
1695
|
+
className: cn14(
|
|
1691
1696
|
"h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0",
|
|
1692
1697
|
className
|
|
1693
1698
|
)
|
|
@@ -1700,7 +1705,7 @@ function TableCell(_a) {
|
|
|
1700
1705
|
"td",
|
|
1701
1706
|
__spreadValues({
|
|
1702
1707
|
"data-slot": "table-cell",
|
|
1703
|
-
className:
|
|
1708
|
+
className: cn14(
|
|
1704
1709
|
"p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0",
|
|
1705
1710
|
className
|
|
1706
1711
|
)
|
|
@@ -1753,92 +1758,44 @@ import {
|
|
|
1753
1758
|
flexRender
|
|
1754
1759
|
} from "@tanstack/react-table";
|
|
1755
1760
|
import { SearchXIcon } from "lucide-react";
|
|
1756
|
-
import { jsx as jsx16
|
|
1757
|
-
var SKELETON_ROWS = ["sk-1", "sk-2", "sk-3", "sk-4", "sk-5"];
|
|
1761
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
1758
1762
|
function DataTableContentBody({
|
|
1759
1763
|
table,
|
|
1760
|
-
columns
|
|
1761
|
-
isLoading
|
|
1764
|
+
columns
|
|
1762
1765
|
}) {
|
|
1763
|
-
if (isLoading) {
|
|
1764
|
-
return /* @__PURE__ */ jsx16(TableBody, { children: SKELETON_ROWS.map((rowKey) => /* @__PURE__ */ jsx16(TableRow, { children: columns.map((col, idx) => {
|
|
1765
|
-
var _a;
|
|
1766
|
-
const colKey = (_a = col.id) != null ? _a : typeof col.accessorKey === "string" ? col.accessorKey : `col-${idx}`;
|
|
1767
|
-
return /* @__PURE__ */ jsx16(TableCell, { className: "py-3", children: /* @__PURE__ */ jsx16(Skeleton, { className: "h-4 w-full" }) }, `${rowKey}-${colKey}`);
|
|
1768
|
-
}) }, rowKey)) });
|
|
1769
|
-
}
|
|
1770
1766
|
const rows = table.getRowModel().rows;
|
|
1771
1767
|
if (rows == null ? void 0 : rows.length) {
|
|
1772
1768
|
return /* @__PURE__ */ jsx16(TableBody, { children: rows.map((row) => /* @__PURE__ */ jsx16(TableRow, { children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx16(TableCell, { children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id)) }, row.id)) });
|
|
1773
1769
|
}
|
|
1774
|
-
return /* @__PURE__ */ jsx16(TableBody, { children: /* @__PURE__ */ jsx16(TableRow, { children: /* @__PURE__ */ jsx16(TableCell, { colSpan: columns.length, className: "h-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
onClick: () => {
|
|
1785
|
-
table.resetGlobalFilter();
|
|
1786
|
-
table.resetColumnFilters();
|
|
1787
|
-
},
|
|
1788
|
-
children: "Clear search & filters"
|
|
1770
|
+
return /* @__PURE__ */ jsx16(TableBody, { children: /* @__PURE__ */ jsx16(TableRow, { children: /* @__PURE__ */ jsx16(TableCell, { colSpan: columns.length, className: "h-48 text-center", children: /* @__PURE__ */ jsx16(
|
|
1771
|
+
StateEmpty,
|
|
1772
|
+
{
|
|
1773
|
+
icon: /* @__PURE__ */ jsx16(SearchXIcon, {}),
|
|
1774
|
+
title: "No matching results",
|
|
1775
|
+
description: "No records matched your search query or filter criteria.",
|
|
1776
|
+
buttonText: "Clear search & filters",
|
|
1777
|
+
render: () => {
|
|
1778
|
+
table.setGlobalFilter("");
|
|
1779
|
+
table.resetColumnFilters();
|
|
1789
1780
|
}
|
|
1790
|
-
|
|
1791
|
-
|
|
1781
|
+
}
|
|
1782
|
+
) }) }) });
|
|
1792
1783
|
}
|
|
1793
1784
|
|
|
1794
1785
|
// src/components/composed/data-table/table-content-header.tsx
|
|
1795
1786
|
import { flexRender as flexRender2 } from "@tanstack/react-table";
|
|
1796
|
-
import {
|
|
1797
|
-
|
|
1798
|
-
// src/lib/utils.ts
|
|
1799
|
-
import { cn as cn14 } from "cn";
|
|
1800
|
-
|
|
1801
|
-
// src/components/composed/data-table/table-content-header.tsx
|
|
1802
|
-
import { jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1787
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
1803
1788
|
function DataTableContentHeader({
|
|
1804
1789
|
table
|
|
1805
1790
|
}) {
|
|
1806
|
-
return /* @__PURE__ */ jsx17(TableHeader, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx17(TableRow, { children: headerGroup.headers.map((header) => {
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
const canSort = header.column.getCanSort();
|
|
1811
|
-
const isSorted = header.column.getIsSorted();
|
|
1812
|
-
if (!canSort) {
|
|
1813
|
-
return /* @__PURE__ */ jsx17(TableHead, { children: flexRender2(
|
|
1814
|
-
header.column.columnDef.header,
|
|
1815
|
-
header.getContext()
|
|
1816
|
-
) }, header.id);
|
|
1817
|
-
}
|
|
1818
|
-
return /* @__PURE__ */ jsx17(TableHead, { className: "select-none", children: /* @__PURE__ */ jsxs10(
|
|
1819
|
-
"button",
|
|
1820
|
-
{
|
|
1821
|
-
type: "button",
|
|
1822
|
-
className: cn14(
|
|
1823
|
-
"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",
|
|
1824
|
-
isSorted && "text-foreground font-semibold"
|
|
1825
|
-
),
|
|
1826
|
-
onClick: header.column.getToggleSortingHandler(),
|
|
1827
|
-
"aria-label": `Sort by ${typeof header.column.columnDef.header === "string" ? header.column.columnDef.header : header.id}`,
|
|
1828
|
-
children: [
|
|
1829
|
-
/* @__PURE__ */ jsx17("span", { children: flexRender2(
|
|
1830
|
-
header.column.columnDef.header,
|
|
1831
|
-
header.getContext()
|
|
1832
|
-
) }),
|
|
1833
|
-
isSorted === "asc" ? /* @__PURE__ */ jsx17(ArrowUpIcon, { className: "size-3 text-foreground shrink-0" }) : isSorted === "desc" ? /* @__PURE__ */ jsx17(ArrowDownIcon, { className: "size-3 text-foreground shrink-0" }) : /* @__PURE__ */ jsx17(ArrowUpDownIcon, { className: "size-3 text-muted-foreground/40 hover:text-muted-foreground shrink-0" })
|
|
1834
|
-
]
|
|
1835
|
-
}
|
|
1836
|
-
) }, header.id);
|
|
1837
|
-
}) }, headerGroup.id)) });
|
|
1791
|
+
return /* @__PURE__ */ jsx17(TableHeader, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx17(TableRow, { children: headerGroup.headers.map((header) => /* @__PURE__ */ jsx17(TableHead, { children: header.isPlaceholder ? null : flexRender2(
|
|
1792
|
+
header.column.columnDef.header,
|
|
1793
|
+
header.getContext()
|
|
1794
|
+
) }, header.id)) }, headerGroup.id)) });
|
|
1838
1795
|
}
|
|
1839
1796
|
|
|
1840
1797
|
// src/components/composed/data-table/table-footer-entries.tsx
|
|
1841
|
-
import { jsx as jsx18, jsxs as
|
|
1798
|
+
import { jsx as jsx18, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1842
1799
|
function DataTableFooterEntries({
|
|
1843
1800
|
table
|
|
1844
1801
|
}) {
|
|
@@ -1849,10 +1806,10 @@ function DataTableFooterEntries({
|
|
|
1849
1806
|
const totalRows = table.getFilteredRowModel().rows.length;
|
|
1850
1807
|
const startRow = totalRows === 0 ? 0 : pageIndex * pageSize + 1;
|
|
1851
1808
|
const endRow = Math.min((pageIndex + 1) * pageSize, totalRows);
|
|
1852
|
-
return /* @__PURE__ */
|
|
1809
|
+
return /* @__PURE__ */ jsxs9("div", { className: "flex-1 text-xs text-muted-foreground", children: [
|
|
1853
1810
|
"Showing",
|
|
1854
1811
|
" ",
|
|
1855
|
-
/* @__PURE__ */
|
|
1812
|
+
/* @__PURE__ */ jsxs9("span", { className: "font-medium text-foreground", children: [
|
|
1856
1813
|
startRow,
|
|
1857
1814
|
"-",
|
|
1858
1815
|
endRow
|
|
@@ -1872,12 +1829,12 @@ import {
|
|
|
1872
1829
|
ChevronsLeftIcon,
|
|
1873
1830
|
ChevronsRightIcon
|
|
1874
1831
|
} from "lucide-react";
|
|
1875
|
-
import { jsx as jsx19, jsxs as
|
|
1832
|
+
import { jsx as jsx19, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1876
1833
|
function DataTableFooterPagination({
|
|
1877
1834
|
table
|
|
1878
1835
|
}) {
|
|
1879
|
-
return /* @__PURE__ */
|
|
1880
|
-
/* @__PURE__ */
|
|
1836
|
+
return /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-1", children: [
|
|
1837
|
+
/* @__PURE__ */ jsxs10(Tooltip, { children: [
|
|
1881
1838
|
/* @__PURE__ */ jsx19(
|
|
1882
1839
|
TooltipTrigger,
|
|
1883
1840
|
{
|
|
@@ -1895,7 +1852,7 @@ function DataTableFooterPagination({
|
|
|
1895
1852
|
),
|
|
1896
1853
|
/* @__PURE__ */ jsx19(TooltipContent, { children: "Go to first page" })
|
|
1897
1854
|
] }),
|
|
1898
|
-
/* @__PURE__ */
|
|
1855
|
+
/* @__PURE__ */ jsxs10(Tooltip, { children: [
|
|
1899
1856
|
/* @__PURE__ */ jsx19(
|
|
1900
1857
|
TooltipTrigger,
|
|
1901
1858
|
{
|
|
@@ -1913,7 +1870,7 @@ function DataTableFooterPagination({
|
|
|
1913
1870
|
),
|
|
1914
1871
|
/* @__PURE__ */ jsx19(TooltipContent, { children: "Go to previous page" })
|
|
1915
1872
|
] }),
|
|
1916
|
-
/* @__PURE__ */
|
|
1873
|
+
/* @__PURE__ */ jsxs10(Tooltip, { children: [
|
|
1917
1874
|
/* @__PURE__ */ jsx19(
|
|
1918
1875
|
TooltipTrigger,
|
|
1919
1876
|
{
|
|
@@ -1931,7 +1888,7 @@ function DataTableFooterPagination({
|
|
|
1931
1888
|
),
|
|
1932
1889
|
/* @__PURE__ */ jsx19(TooltipContent, { children: "Go to next page" })
|
|
1933
1890
|
] }),
|
|
1934
|
-
/* @__PURE__ */
|
|
1891
|
+
/* @__PURE__ */ jsxs10(Tooltip, { children: [
|
|
1935
1892
|
/* @__PURE__ */ jsx19(
|
|
1936
1893
|
TooltipTrigger,
|
|
1937
1894
|
{
|
|
@@ -1954,13 +1911,13 @@ function DataTableFooterPagination({
|
|
|
1954
1911
|
|
|
1955
1912
|
// src/components/composed/data-table/table-header-add.tsx
|
|
1956
1913
|
import { PlusIcon } from "lucide-react";
|
|
1957
|
-
import { Fragment, jsx as jsx20, jsxs as
|
|
1914
|
+
import { Fragment, jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1958
1915
|
function DataTableHeaderAdd({
|
|
1959
1916
|
onAdd,
|
|
1960
1917
|
addLabel
|
|
1961
1918
|
}) {
|
|
1962
|
-
return /* @__PURE__ */
|
|
1963
|
-
/* @__PURE__ */
|
|
1919
|
+
return /* @__PURE__ */ jsxs11(Fragment, { children: [
|
|
1920
|
+
/* @__PURE__ */ jsxs11(Tooltip, { children: [
|
|
1964
1921
|
/* @__PURE__ */ jsx20(
|
|
1965
1922
|
TooltipTrigger,
|
|
1966
1923
|
{
|
|
@@ -1970,7 +1927,7 @@ function DataTableHeaderAdd({
|
|
|
1970
1927
|
),
|
|
1971
1928
|
/* @__PURE__ */ jsx20(TooltipContent, { children: addLabel != null ? addLabel : "Add" })
|
|
1972
1929
|
] }),
|
|
1973
|
-
/* @__PURE__ */
|
|
1930
|
+
/* @__PURE__ */ jsxs11(Button, { variant: "default", onClick: onAdd, className: "hidden sm:flex", children: [
|
|
1974
1931
|
/* @__PURE__ */ jsx20(PlusIcon, {}),
|
|
1975
1932
|
addLabel != null ? addLabel : "Add"
|
|
1976
1933
|
] })
|
|
@@ -2045,6 +2002,41 @@ function exportToCSV(rows, filename = "data-export") {
|
|
|
2045
2002
|
URL.revokeObjectURL(url);
|
|
2046
2003
|
}, 1e3);
|
|
2047
2004
|
}
|
|
2005
|
+
async function exportToPDF(headers, rows, filename = "data-export", title = "Data Export") {
|
|
2006
|
+
const [{ jsPDF }, autoTableMod] = await Promise.all([
|
|
2007
|
+
import("jspdf"),
|
|
2008
|
+
import("jspdf-autotable")
|
|
2009
|
+
]);
|
|
2010
|
+
const autoTable = autoTableMod.autoTable || autoTableMod.default;
|
|
2011
|
+
const orientation = headers.length > 5 ? "landscape" : "portrait";
|
|
2012
|
+
const doc = new jsPDF({ orientation });
|
|
2013
|
+
doc.setFontSize(14);
|
|
2014
|
+
doc.setFont("helvetica", "bold");
|
|
2015
|
+
doc.text(title, 14, 15);
|
|
2016
|
+
doc.setFontSize(8);
|
|
2017
|
+
doc.setFont("helvetica", "normal");
|
|
2018
|
+
doc.setTextColor(120);
|
|
2019
|
+
doc.text(`Generated on ${(/* @__PURE__ */ new Date()).toLocaleString()}`, 14, 20);
|
|
2020
|
+
autoTable(doc, {
|
|
2021
|
+
head: [headers],
|
|
2022
|
+
body: rows,
|
|
2023
|
+
startY: 24,
|
|
2024
|
+
styles: {
|
|
2025
|
+
fontSize: 8,
|
|
2026
|
+
cellPadding: 2.5
|
|
2027
|
+
},
|
|
2028
|
+
headStyles: {
|
|
2029
|
+
fillColor: [40, 40, 40],
|
|
2030
|
+
textColor: [255, 255, 255],
|
|
2031
|
+
fontStyle: "bold"
|
|
2032
|
+
},
|
|
2033
|
+
alternateRowStyles: {
|
|
2034
|
+
fillColor: [248, 248, 248]
|
|
2035
|
+
}
|
|
2036
|
+
});
|
|
2037
|
+
const finalFilename = filename.endsWith(".pdf") ? filename : `${filename}.pdf`;
|
|
2038
|
+
doc.save(finalFilename);
|
|
2039
|
+
}
|
|
2048
2040
|
function printTable(headers, rows, title = "Data Export") {
|
|
2049
2041
|
let tableHtml = `<table style="width:100%; border-collapse:collapse; font-family:sans-serif; font-size:12px;"><thead><tr>`;
|
|
2050
2042
|
for (const header of headers) {
|
|
@@ -2089,7 +2081,7 @@ function printTable(headers, rows, title = "Data Export") {
|
|
|
2089
2081
|
}
|
|
2090
2082
|
|
|
2091
2083
|
// src/components/composed/data-table/table-header-download.tsx
|
|
2092
|
-
import { jsx as jsx21, jsxs as
|
|
2084
|
+
import { jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2093
2085
|
function getTableExportData(table) {
|
|
2094
2086
|
const columns = table.getAllColumns().filter(
|
|
2095
2087
|
(col) => typeof col.accessorFn !== "undefined" && col.getIsVisible()
|
|
@@ -2132,8 +2124,8 @@ function DataTableHeaderDownload({
|
|
|
2132
2124
|
exportFilename,
|
|
2133
2125
|
onDownload
|
|
2134
2126
|
}) {
|
|
2135
|
-
return /* @__PURE__ */
|
|
2136
|
-
/* @__PURE__ */
|
|
2127
|
+
return /* @__PURE__ */ jsxs12(DropdownMenu, { children: [
|
|
2128
|
+
/* @__PURE__ */ jsxs12(Tooltip, { children: [
|
|
2137
2129
|
/* @__PURE__ */ jsx21(
|
|
2138
2130
|
DropdownMenuTrigger,
|
|
2139
2131
|
{
|
|
@@ -2147,16 +2139,16 @@ function DataTableHeaderDownload({
|
|
|
2147
2139
|
),
|
|
2148
2140
|
/* @__PURE__ */ jsx21(TooltipContent, { children: "Download options" })
|
|
2149
2141
|
] }),
|
|
2150
|
-
/* @__PURE__ */ jsx21(DropdownMenuContent, { align: "end", className: "w-48", children: /* @__PURE__ */
|
|
2142
|
+
/* @__PURE__ */ jsx21(DropdownMenuContent, { align: "end", className: "w-48", children: /* @__PURE__ */ jsxs12(DropdownMenuGroup, { children: [
|
|
2151
2143
|
/* @__PURE__ */ jsx21(DropdownMenuLabel, { children: "Download data" }),
|
|
2152
2144
|
/* @__PURE__ */ jsx21(DropdownMenuSeparator, {}),
|
|
2153
|
-
/* @__PURE__ */
|
|
2145
|
+
/* @__PURE__ */ jsxs12(
|
|
2154
2146
|
DropdownMenuItem,
|
|
2155
2147
|
{
|
|
2156
2148
|
className: "hover:cursor-pointer",
|
|
2157
|
-
onClick: () => {
|
|
2149
|
+
onClick: async () => {
|
|
2158
2150
|
const { headers, rows } = getTableExportData(table);
|
|
2159
|
-
|
|
2151
|
+
await exportToPDF(headers, rows, exportFilename);
|
|
2160
2152
|
onDownload == null ? void 0 : onDownload();
|
|
2161
2153
|
},
|
|
2162
2154
|
children: [
|
|
@@ -2165,7 +2157,7 @@ function DataTableHeaderDownload({
|
|
|
2165
2157
|
]
|
|
2166
2158
|
}
|
|
2167
2159
|
),
|
|
2168
|
-
/* @__PURE__ */
|
|
2160
|
+
/* @__PURE__ */ jsxs12(
|
|
2169
2161
|
DropdownMenuItem,
|
|
2170
2162
|
{
|
|
2171
2163
|
className: "hover:cursor-pointer",
|
|
@@ -2180,7 +2172,7 @@ function DataTableHeaderDownload({
|
|
|
2180
2172
|
]
|
|
2181
2173
|
}
|
|
2182
2174
|
),
|
|
2183
|
-
/* @__PURE__ */
|
|
2175
|
+
/* @__PURE__ */ jsxs12(
|
|
2184
2176
|
DropdownMenuItem,
|
|
2185
2177
|
{
|
|
2186
2178
|
className: "hover:cursor-pointer",
|
|
@@ -2196,7 +2188,7 @@ function DataTableHeaderDownload({
|
|
|
2196
2188
|
}
|
|
2197
2189
|
),
|
|
2198
2190
|
/* @__PURE__ */ jsx21(DropdownMenuSeparator, {}),
|
|
2199
|
-
/* @__PURE__ */
|
|
2191
|
+
/* @__PURE__ */ jsxs12(
|
|
2200
2192
|
DropdownMenuItem,
|
|
2201
2193
|
{
|
|
2202
2194
|
className: "hover:cursor-pointer",
|
|
@@ -2481,7 +2473,7 @@ function PopoverContent(_a) {
|
|
|
2481
2473
|
import { Select as SelectPrimitive } from "@base-ui/react/select";
|
|
2482
2474
|
import { cn as cn17 } from "cn";
|
|
2483
2475
|
import { CheckIcon as CheckIcon2, ChevronDownIcon as ChevronDownIcon2, ChevronUpIcon } from "lucide-react";
|
|
2484
|
-
import { jsx as jsx24, jsxs as
|
|
2476
|
+
import { jsx as jsx24, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2485
2477
|
var Select = SelectPrimitive.Root;
|
|
2486
2478
|
function SelectValue(_a) {
|
|
2487
2479
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
@@ -2503,7 +2495,7 @@ function SelectTrigger(_a) {
|
|
|
2503
2495
|
"size",
|
|
2504
2496
|
"children"
|
|
2505
2497
|
]);
|
|
2506
|
-
return /* @__PURE__ */
|
|
2498
|
+
return /* @__PURE__ */ jsxs13(
|
|
2507
2499
|
SelectPrimitive.Trigger,
|
|
2508
2500
|
__spreadProps(__spreadValues({
|
|
2509
2501
|
"data-slot": "select-trigger",
|
|
@@ -2552,7 +2544,7 @@ function SelectContent(_a) {
|
|
|
2552
2544
|
alignOffset,
|
|
2553
2545
|
alignItemWithTrigger,
|
|
2554
2546
|
className: "isolate z-50",
|
|
2555
|
-
children: /* @__PURE__ */
|
|
2547
|
+
children: /* @__PURE__ */ jsxs13(
|
|
2556
2548
|
SelectPrimitive.Popup,
|
|
2557
2549
|
__spreadProps(__spreadValues({
|
|
2558
2550
|
"data-slot": "select-content",
|
|
@@ -2580,7 +2572,7 @@ function SelectItem(_a) {
|
|
|
2580
2572
|
"className",
|
|
2581
2573
|
"children"
|
|
2582
2574
|
]);
|
|
2583
|
-
return /* @__PURE__ */
|
|
2575
|
+
return /* @__PURE__ */ jsxs13(
|
|
2584
2576
|
SelectPrimitive.Item,
|
|
2585
2577
|
__spreadProps(__spreadValues({
|
|
2586
2578
|
"data-slot": "select-item",
|
|
@@ -2642,7 +2634,7 @@ function SelectScrollDownButton(_a) {
|
|
|
2642
2634
|
}
|
|
2643
2635
|
|
|
2644
2636
|
// src/components/composed/data-table/table-header-filter.tsx
|
|
2645
|
-
import { Fragment as Fragment2, jsx as jsx25, jsxs as
|
|
2637
|
+
import { Fragment as Fragment2, jsx as jsx25, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2646
2638
|
function smartFilterFn(row, columnId, filterValue) {
|
|
2647
2639
|
var _a, _b, _c;
|
|
2648
2640
|
if (filterValue === void 0 || filterValue === null || filterValue === "" || filterValue === "all") {
|
|
@@ -2803,7 +2795,7 @@ function ColumnFilterInput({
|
|
|
2803
2795
|
}, [column, table, variant]);
|
|
2804
2796
|
if (variant === "boolean" || variant === "select") {
|
|
2805
2797
|
const currentValue = filterValue === void 0 || filterValue === null || filterValue === "" ? "all" : String(filterValue);
|
|
2806
|
-
return /* @__PURE__ */ jsx25("div", { className: "relative flex items-center w-full", children: /* @__PURE__ */
|
|
2798
|
+
return /* @__PURE__ */ jsx25("div", { className: "relative flex items-center w-full", children: /* @__PURE__ */ jsxs14(
|
|
2807
2799
|
Select,
|
|
2808
2800
|
{
|
|
2809
2801
|
value: currentValue,
|
|
@@ -2830,7 +2822,7 @@ function ColumnFilterInput({
|
|
|
2830
2822
|
)
|
|
2831
2823
|
}
|
|
2832
2824
|
),
|
|
2833
|
-
/* @__PURE__ */
|
|
2825
|
+
/* @__PURE__ */ jsxs14(SelectContent, { align: "start", children: [
|
|
2834
2826
|
/* @__PURE__ */ jsx25(SelectItem, { value: "all", children: "All" }),
|
|
2835
2827
|
options.map((opt) => /* @__PURE__ */ jsx25(
|
|
2836
2828
|
SelectItem,
|
|
@@ -2859,15 +2851,15 @@ function ColumnFilterInput({
|
|
|
2859
2851
|
}
|
|
2860
2852
|
}
|
|
2861
2853
|
const formattedDateLabel = dateObj ? format(dateObj, "yyyy-MM-dd") : "";
|
|
2862
|
-
return /* @__PURE__ */ jsx25("div", { className: "relative flex items-center w-full", children: /* @__PURE__ */
|
|
2854
|
+
return /* @__PURE__ */ jsx25("div", { className: "relative flex items-center w-full", children: /* @__PURE__ */ jsxs14(Popover, { open: calendarOpen, onOpenChange: setCalendarOpen, children: [
|
|
2863
2855
|
/* @__PURE__ */ jsx25(
|
|
2864
2856
|
PopoverTrigger,
|
|
2865
2857
|
{
|
|
2866
|
-
render: /* @__PURE__ */
|
|
2858
|
+
render: /* @__PURE__ */ jsxs14(
|
|
2867
2859
|
Button,
|
|
2868
2860
|
{
|
|
2869
2861
|
variant: "outline",
|
|
2870
|
-
className:
|
|
2862
|
+
className: cn13(
|
|
2871
2863
|
"w-full justify-start",
|
|
2872
2864
|
!formattedDateLabel && "text-muted-foreground"
|
|
2873
2865
|
),
|
|
@@ -2931,8 +2923,8 @@ function DataTableHeaderFilter({
|
|
|
2931
2923
|
[table]
|
|
2932
2924
|
);
|
|
2933
2925
|
if (filterableColumns.length === 0) return null;
|
|
2934
|
-
return /* @__PURE__ */
|
|
2935
|
-
/* @__PURE__ */
|
|
2926
|
+
return /* @__PURE__ */ jsxs14(DropdownMenu, { children: [
|
|
2927
|
+
/* @__PURE__ */ jsxs14(Tooltip, { children: [
|
|
2936
2928
|
/* @__PURE__ */ jsx25(
|
|
2937
2929
|
DropdownMenuTrigger,
|
|
2938
2930
|
{
|
|
@@ -2953,12 +2945,12 @@ function DataTableHeaderFilter({
|
|
|
2953
2945
|
),
|
|
2954
2946
|
/* @__PURE__ */ jsx25(TooltipContent, { children: "Filter options" })
|
|
2955
2947
|
] }),
|
|
2956
|
-
/* @__PURE__ */ jsx25(DropdownMenuContent, { align: "end", className: "w-80", children: /* @__PURE__ */
|
|
2948
|
+
/* @__PURE__ */ jsx25(DropdownMenuContent, { align: "end", className: "w-80", children: /* @__PURE__ */ jsxs14(DropdownMenuGroup, { children: [
|
|
2957
2949
|
/* @__PURE__ */ jsx25(DropdownMenuLabel, { children: "Filter by column" }),
|
|
2958
2950
|
/* @__PURE__ */ jsx25(DropdownMenuSeparator, {}),
|
|
2959
2951
|
/* @__PURE__ */ jsx25("div", { className: "max-h-64 overflow-y-auto space-y-2.5 p-1", children: filterableColumns.map((column) => {
|
|
2960
2952
|
const headerText = typeof column.columnDef.header === "string" ? column.columnDef.header : column.id;
|
|
2961
|
-
return /* @__PURE__ */
|
|
2953
|
+
return /* @__PURE__ */ jsxs14(
|
|
2962
2954
|
"div",
|
|
2963
2955
|
{
|
|
2964
2956
|
className: "flex items-center justify-between px-1",
|
|
@@ -2984,7 +2976,7 @@ function DataTableHeaderFilter({
|
|
|
2984
2976
|
column.id
|
|
2985
2977
|
);
|
|
2986
2978
|
}) }),
|
|
2987
|
-
columnFilters.length > 0 && /* @__PURE__ */
|
|
2979
|
+
columnFilters.length > 0 && /* @__PURE__ */ jsxs14(Fragment2, { children: [
|
|
2988
2980
|
/* @__PURE__ */ jsx25(DropdownMenuSeparator, {}),
|
|
2989
2981
|
/* @__PURE__ */ jsx25(
|
|
2990
2982
|
DropdownMenuItem,
|
|
@@ -3003,24 +2995,18 @@ function DataTableHeaderFilter({
|
|
|
3003
2995
|
import { RotateCwIcon } from "lucide-react";
|
|
3004
2996
|
import { useRouter } from "next/navigation";
|
|
3005
2997
|
import { useState as useState4 } from "react";
|
|
3006
|
-
import { jsx as jsx26, jsxs as
|
|
3007
|
-
function DataTableHeaderRefresh({
|
|
3008
|
-
onRefresh
|
|
3009
|
-
}) {
|
|
2998
|
+
import { jsx as jsx26, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2999
|
+
function DataTableHeaderRefresh() {
|
|
3010
3000
|
const router = useRouter();
|
|
3011
3001
|
const [isRefreshing, setIsRefreshing] = useState4(false);
|
|
3012
3002
|
const handleRefresh = () => {
|
|
3013
3003
|
setIsRefreshing(true);
|
|
3014
|
-
|
|
3015
|
-
onRefresh();
|
|
3016
|
-
} else {
|
|
3017
|
-
router.refresh();
|
|
3018
|
-
}
|
|
3004
|
+
router.refresh();
|
|
3019
3005
|
setTimeout(() => {
|
|
3020
3006
|
setIsRefreshing(false);
|
|
3021
3007
|
}, 750);
|
|
3022
3008
|
};
|
|
3023
|
-
return /* @__PURE__ */
|
|
3009
|
+
return /* @__PURE__ */ jsxs15(Tooltip, { children: [
|
|
3024
3010
|
/* @__PURE__ */ jsx26(
|
|
3025
3011
|
TooltipTrigger,
|
|
3026
3012
|
{
|
|
@@ -3034,7 +3020,7 @@ function DataTableHeaderRefresh({
|
|
|
3034
3020
|
children: /* @__PURE__ */ jsx26(
|
|
3035
3021
|
RotateCwIcon,
|
|
3036
3022
|
{
|
|
3037
|
-
className:
|
|
3023
|
+
className: cn13(
|
|
3038
3024
|
"transition-transform duration-750",
|
|
3039
3025
|
isRefreshing && "animate-spin"
|
|
3040
3026
|
)
|
|
@@ -3050,23 +3036,22 @@ function DataTableHeaderRefresh({
|
|
|
3050
3036
|
|
|
3051
3037
|
// src/components/composed/data-table/table-header-search.tsx
|
|
3052
3038
|
import { XIcon as XIcon2 } from "lucide-react";
|
|
3053
|
-
import { jsx as jsx27, jsxs as
|
|
3039
|
+
import { jsx as jsx27, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3054
3040
|
function DataTableHeaderSearch({
|
|
3055
|
-
value,
|
|
3056
|
-
onChange
|
|
3057
|
-
placeholder = "Search..."
|
|
3041
|
+
value = "",
|
|
3042
|
+
onChange
|
|
3058
3043
|
}) {
|
|
3059
|
-
return /* @__PURE__ */
|
|
3044
|
+
return /* @__PURE__ */ jsxs16("div", { className: "relative flex items-center max-w-sm w-full", children: [
|
|
3060
3045
|
/* @__PURE__ */ jsx27(
|
|
3061
3046
|
Input,
|
|
3062
3047
|
{
|
|
3063
|
-
placeholder,
|
|
3064
|
-
value,
|
|
3048
|
+
placeholder: "Search...",
|
|
3049
|
+
value: value != null ? value : "",
|
|
3065
3050
|
onChange: (event) => onChange(event.target.value),
|
|
3066
3051
|
className: "pr-7"
|
|
3067
3052
|
}
|
|
3068
3053
|
),
|
|
3069
|
-
value && /* @__PURE__ */ jsx27(
|
|
3054
|
+
Boolean(value) && /* @__PURE__ */ jsx27(
|
|
3070
3055
|
"button",
|
|
3071
3056
|
{
|
|
3072
3057
|
type: "button",
|
|
@@ -3080,15 +3065,15 @@ function DataTableHeaderSearch({
|
|
|
3080
3065
|
}
|
|
3081
3066
|
|
|
3082
3067
|
// src/components/composed/data-table/table-header-sort.tsx
|
|
3083
|
-
import { ArrowDownIcon
|
|
3084
|
-
import { Fragment as Fragment3, jsx as jsx28, jsxs as
|
|
3068
|
+
import { ArrowDownIcon, ArrowUpDownIcon, ArrowUpIcon } from "lucide-react";
|
|
3069
|
+
import { Fragment as Fragment3, jsx as jsx28, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3085
3070
|
function DataTableHeaderSort({
|
|
3086
3071
|
table,
|
|
3087
3072
|
sorting
|
|
3088
3073
|
}) {
|
|
3089
3074
|
const sortableColumns = table.getAllColumns().filter((column) => column.getCanSort());
|
|
3090
|
-
return /* @__PURE__ */
|
|
3091
|
-
/* @__PURE__ */
|
|
3075
|
+
return /* @__PURE__ */ jsxs17(DropdownMenu, { children: [
|
|
3076
|
+
/* @__PURE__ */ jsxs17(Tooltip, { children: [
|
|
3092
3077
|
/* @__PURE__ */ jsx28(
|
|
3093
3078
|
DropdownMenuTrigger,
|
|
3094
3079
|
{
|
|
@@ -3100,7 +3085,7 @@ function DataTableHeaderSort({
|
|
|
3100
3085
|
{
|
|
3101
3086
|
variant: sorting.length > 0 ? "secondary" : "outline",
|
|
3102
3087
|
size: "icon",
|
|
3103
|
-
children: /* @__PURE__ */ jsx28(
|
|
3088
|
+
children: /* @__PURE__ */ jsx28(ArrowUpDownIcon, {})
|
|
3104
3089
|
}
|
|
3105
3090
|
)
|
|
3106
3091
|
}
|
|
@@ -3109,13 +3094,13 @@ function DataTableHeaderSort({
|
|
|
3109
3094
|
),
|
|
3110
3095
|
/* @__PURE__ */ jsx28(TooltipContent, { children: "Sort options" })
|
|
3111
3096
|
] }),
|
|
3112
|
-
/* @__PURE__ */ jsx28(DropdownMenuContent, { align: "end", className: "w-48", children: /* @__PURE__ */
|
|
3097
|
+
/* @__PURE__ */ jsx28(DropdownMenuContent, { align: "end", className: "w-48", children: /* @__PURE__ */ jsxs17(DropdownMenuGroup, { children: [
|
|
3113
3098
|
/* @__PURE__ */ jsx28(DropdownMenuLabel, { children: "Sort by column" }),
|
|
3114
3099
|
/* @__PURE__ */ jsx28(DropdownMenuSeparator, {}),
|
|
3115
3100
|
sortableColumns.map((column) => {
|
|
3116
3101
|
const isSorted = column.getIsSorted();
|
|
3117
3102
|
const headerText = typeof column.columnDef.header === "string" ? column.columnDef.header : column.id;
|
|
3118
|
-
return /* @__PURE__ */
|
|
3103
|
+
return /* @__PURE__ */ jsxs17(
|
|
3119
3104
|
DropdownMenuItem,
|
|
3120
3105
|
{
|
|
3121
3106
|
className: "flex items-center justify-between hover:cursor-pointer capitalize",
|
|
@@ -3129,22 +3114,22 @@ function DataTableHeaderSort({
|
|
|
3129
3114
|
}
|
|
3130
3115
|
},
|
|
3131
3116
|
children: [
|
|
3132
|
-
|
|
3133
|
-
isSorted === "asc" && /* @__PURE__ */ jsx28(
|
|
3134
|
-
isSorted === "desc" && /* @__PURE__ */ jsx28(
|
|
3117
|
+
headerText,
|
|
3118
|
+
isSorted === "asc" && /* @__PURE__ */ jsx28(ArrowUpIcon, { className: "size-3.5" }),
|
|
3119
|
+
isSorted === "desc" && /* @__PURE__ */ jsx28(ArrowDownIcon, { className: "size-3.5" })
|
|
3135
3120
|
]
|
|
3136
3121
|
},
|
|
3137
3122
|
column.id
|
|
3138
3123
|
);
|
|
3139
3124
|
}),
|
|
3140
|
-
sorting.length > 0 && /* @__PURE__ */
|
|
3125
|
+
sorting.length > 0 && /* @__PURE__ */ jsxs17(Fragment3, { children: [
|
|
3141
3126
|
/* @__PURE__ */ jsx28(DropdownMenuSeparator, {}),
|
|
3142
3127
|
/* @__PURE__ */ jsx28(
|
|
3143
3128
|
DropdownMenuItem,
|
|
3144
3129
|
{
|
|
3145
3130
|
className: "hover:cursor-pointer text-destructive focus:text-destructive",
|
|
3146
3131
|
onClick: () => table.resetSorting(),
|
|
3147
|
-
children: "Clear
|
|
3132
|
+
children: "Clear sorting"
|
|
3148
3133
|
}
|
|
3149
3134
|
)
|
|
3150
3135
|
] })
|
|
@@ -3154,12 +3139,12 @@ function DataTableHeaderSort({
|
|
|
3154
3139
|
|
|
3155
3140
|
// src/components/composed/data-table/table-header-toggle.tsx
|
|
3156
3141
|
import { Columns3CogIcon } from "lucide-react";
|
|
3157
|
-
import { jsx as jsx29, jsxs as
|
|
3142
|
+
import { jsx as jsx29, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3158
3143
|
function DataTableHeaderToggle({
|
|
3159
3144
|
table
|
|
3160
3145
|
}) {
|
|
3161
|
-
return /* @__PURE__ */
|
|
3162
|
-
/* @__PURE__ */
|
|
3146
|
+
return /* @__PURE__ */ jsxs18(DropdownMenu, { children: [
|
|
3147
|
+
/* @__PURE__ */ jsxs18(Tooltip, { children: [
|
|
3163
3148
|
/* @__PURE__ */ jsx29(
|
|
3164
3149
|
DropdownMenuTrigger,
|
|
3165
3150
|
{
|
|
@@ -3173,7 +3158,7 @@ function DataTableHeaderToggle({
|
|
|
3173
3158
|
),
|
|
3174
3159
|
/* @__PURE__ */ jsx29(TooltipContent, { children: "Toggle columns" })
|
|
3175
3160
|
] }),
|
|
3176
|
-
/* @__PURE__ */ jsx29(DropdownMenuContent, { align: "end", className: "w-48", children: /* @__PURE__ */
|
|
3161
|
+
/* @__PURE__ */ jsx29(DropdownMenuContent, { align: "end", className: "w-48", children: /* @__PURE__ */ jsxs18(DropdownMenuGroup, { children: [
|
|
3177
3162
|
/* @__PURE__ */ jsx29(DropdownMenuLabel, { children: "Toggle columns" }),
|
|
3178
3163
|
/* @__PURE__ */ jsx29(DropdownMenuSeparator, {}),
|
|
3179
3164
|
table.getAllColumns().filter(
|
|
@@ -3198,7 +3183,7 @@ function DataTableHeaderToggle({
|
|
|
3198
3183
|
// src/components/composed/data-table/data-row-actions.tsx
|
|
3199
3184
|
import { MoreHorizontal } from "lucide-react";
|
|
3200
3185
|
import { Fragment as Fragment4 } from "react";
|
|
3201
|
-
import { Fragment as Fragment5, jsx as jsx30, jsxs as
|
|
3186
|
+
import { Fragment as Fragment5, jsx as jsx30, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3202
3187
|
function RowActions({
|
|
3203
3188
|
label = "Actions",
|
|
3204
3189
|
items = [],
|
|
@@ -3215,8 +3200,8 @@ function RowActions({
|
|
|
3215
3200
|
return /* @__PURE__ */ jsx30(
|
|
3216
3201
|
"div",
|
|
3217
3202
|
{
|
|
3218
|
-
className:
|
|
3219
|
-
children: /* @__PURE__ */
|
|
3203
|
+
className: cn13("flex items-center justify-end w-full", containerClassName),
|
|
3204
|
+
children: /* @__PURE__ */ jsxs19(DropdownMenu, { children: [
|
|
3220
3205
|
/* @__PURE__ */ jsx30(
|
|
3221
3206
|
DropdownMenuTrigger,
|
|
3222
3207
|
{
|
|
@@ -3227,9 +3212,9 @@ function RowActions({
|
|
|
3227
3212
|
DropdownMenuContent,
|
|
3228
3213
|
{
|
|
3229
3214
|
align,
|
|
3230
|
-
className:
|
|
3231
|
-
children: /* @__PURE__ */
|
|
3232
|
-
label && /* @__PURE__ */
|
|
3215
|
+
className: cn13("w-40", contentClassName),
|
|
3216
|
+
children: /* @__PURE__ */ jsxs19(DropdownMenuGroup, { children: [
|
|
3217
|
+
label && /* @__PURE__ */ jsxs19(Fragment5, { children: [
|
|
3233
3218
|
/* @__PURE__ */ jsx30(DropdownMenuLabel, { children: label }),
|
|
3234
3219
|
/* @__PURE__ */ jsx30(DropdownMenuSeparator, {})
|
|
3235
3220
|
] }),
|
|
@@ -3237,14 +3222,14 @@ function RowActions({
|
|
|
3237
3222
|
var _a;
|
|
3238
3223
|
const itemKey = (_a = item.id) != null ? _a : `${item.label}-${index}`;
|
|
3239
3224
|
const isDestructive = item.variant === "destructive";
|
|
3240
|
-
return /* @__PURE__ */
|
|
3225
|
+
return /* @__PURE__ */ jsxs19(Fragment4, { children: [
|
|
3241
3226
|
item.separatorBefore && /* @__PURE__ */ jsx30(DropdownMenuSeparator, {}),
|
|
3242
|
-
/* @__PURE__ */
|
|
3227
|
+
/* @__PURE__ */ jsxs19(
|
|
3243
3228
|
DropdownMenuItem,
|
|
3244
3229
|
{
|
|
3245
3230
|
onClick: item.onClick,
|
|
3246
3231
|
disabled: item.disabled,
|
|
3247
|
-
className:
|
|
3232
|
+
className: cn13(
|
|
3248
3233
|
"hover:cursor-pointer flex items-center gap-2",
|
|
3249
3234
|
isDestructive && "text-destructive focus:text-destructive",
|
|
3250
3235
|
item.className
|
|
@@ -3267,33 +3252,24 @@ function RowActions({
|
|
|
3267
3252
|
}
|
|
3268
3253
|
|
|
3269
3254
|
// src/components/composed/data-table/data-table.tsx
|
|
3270
|
-
import { jsx as jsx31, jsxs as
|
|
3255
|
+
import { jsx as jsx31, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
3271
3256
|
function DataTable({
|
|
3272
3257
|
columns,
|
|
3273
3258
|
data,
|
|
3274
3259
|
initialColumnVisibility,
|
|
3275
3260
|
renderCreateDialog,
|
|
3276
3261
|
addLabel,
|
|
3277
|
-
onRefresh,
|
|
3278
3262
|
onDownload,
|
|
3279
3263
|
exportFilename = "data-export",
|
|
3280
|
-
isLoading = false,
|
|
3281
|
-
searchPlaceholder = "Search...",
|
|
3282
3264
|
showSearchInput = true,
|
|
3283
3265
|
showRefreshButton = true,
|
|
3284
3266
|
showSortButton = true,
|
|
3285
3267
|
showFilterButton = true,
|
|
3286
3268
|
showDownloadButton = true,
|
|
3287
3269
|
showColumnToggleButton = true,
|
|
3288
|
-
showAddButton = true
|
|
3289
|
-
emptyIcon,
|
|
3290
|
-
emptyTitle,
|
|
3291
|
-
emptyDescription,
|
|
3292
|
-
emptyButtonText,
|
|
3293
|
-
emptyRender,
|
|
3294
|
-
onEmptyAction,
|
|
3295
|
-
renderEmptyState
|
|
3270
|
+
showAddButton = true
|
|
3296
3271
|
}) {
|
|
3272
|
+
const router = useRouter2();
|
|
3297
3273
|
const [createOpen, setCreateOpen] = useState5(false);
|
|
3298
3274
|
const [sorting, setSorting] = useState5([]);
|
|
3299
3275
|
const [columnFilters, setColumnFilters] = useState5([]);
|
|
@@ -3308,47 +3284,53 @@ function DataTable({
|
|
|
3308
3284
|
features,
|
|
3309
3285
|
data,
|
|
3310
3286
|
columns: columnsWithSmartFilters,
|
|
3287
|
+
initialState: {
|
|
3288
|
+
globalFilter: ""
|
|
3289
|
+
},
|
|
3311
3290
|
onSortingChange: setSorting,
|
|
3312
3291
|
onColumnFiltersChange: setColumnFilters,
|
|
3313
3292
|
onColumnVisibilityChange: setColumnVisibility,
|
|
3314
|
-
onGlobalFilterChange:
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3293
|
+
onGlobalFilterChange: (updater) => {
|
|
3294
|
+
setGlobalFilter((prev) => {
|
|
3295
|
+
const next = typeof updater === "function" ? updater(prev) : updater;
|
|
3296
|
+
return next != null ? next : "";
|
|
3297
|
+
});
|
|
3298
|
+
},
|
|
3299
|
+
state: {
|
|
3300
|
+
sorting,
|
|
3301
|
+
columnFilters,
|
|
3302
|
+
columnVisibility,
|
|
3303
|
+
globalFilter: globalFilter != null ? globalFilter : ""
|
|
3323
3304
|
}
|
|
3324
|
-
|
|
3325
|
-
|
|
3305
|
+
});
|
|
3306
|
+
if (data.length === 0) {
|
|
3307
|
+
const hasCreateAction = Boolean(renderCreateDialog);
|
|
3308
|
+
return /* @__PURE__ */ jsxs20("div", { className: "space-y-2", children: [
|
|
3326
3309
|
/* @__PURE__ */ jsx31(
|
|
3327
3310
|
StateEmpty,
|
|
3328
3311
|
{
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
render:
|
|
3312
|
+
state: "outline",
|
|
3313
|
+
icon: /* @__PURE__ */ jsx31(FolderOpenIcon, { className: "size-6 text-muted-foreground" }),
|
|
3314
|
+
title: "No Data Available",
|
|
3315
|
+
description: "There are currently no records to display. Create a new record to get started.",
|
|
3316
|
+
buttonText: hasCreateAction ? addLabel != null ? addLabel : "Add Record" : "Refresh",
|
|
3317
|
+
render: hasCreateAction ? () => setCreateOpen(true) : () => router.refresh()
|
|
3335
3318
|
}
|
|
3336
3319
|
),
|
|
3337
3320
|
renderCreateDialog == null ? void 0 : renderCreateDialog(createOpen, setCreateOpen)
|
|
3338
3321
|
] });
|
|
3339
3322
|
}
|
|
3340
|
-
return /* @__PURE__ */
|
|
3341
|
-
/* @__PURE__ */
|
|
3323
|
+
return /* @__PURE__ */ jsxs20("div", { className: "space-y-2", children: [
|
|
3324
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex flex-row items-center justify-between gap-1", children: [
|
|
3342
3325
|
showSearchInput ? /* @__PURE__ */ jsx31(
|
|
3343
3326
|
DataTableHeaderSearch,
|
|
3344
3327
|
{
|
|
3345
3328
|
value: globalFilter,
|
|
3346
|
-
onChange: setGlobalFilter
|
|
3347
|
-
placeholder: searchPlaceholder
|
|
3329
|
+
onChange: setGlobalFilter
|
|
3348
3330
|
}
|
|
3349
3331
|
) : /* @__PURE__ */ jsx31("div", {}),
|
|
3350
|
-
/* @__PURE__ */
|
|
3351
|
-
showRefreshButton && /* @__PURE__ */ jsx31(DataTableHeaderRefresh, {
|
|
3332
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex flex-row items-center gap-1", children: [
|
|
3333
|
+
showRefreshButton && /* @__PURE__ */ jsx31(DataTableHeaderRefresh, {}),
|
|
3352
3334
|
showSortButton && /* @__PURE__ */ jsx31(DataTableHeaderSort, { table, sorting }),
|
|
3353
3335
|
showFilterButton && /* @__PURE__ */ jsx31(
|
|
3354
3336
|
DataTableHeaderFilter,
|
|
@@ -3376,18 +3358,11 @@ function DataTable({
|
|
|
3376
3358
|
] })
|
|
3377
3359
|
] }),
|
|
3378
3360
|
renderCreateDialog == null ? void 0 : renderCreateDialog(createOpen, setCreateOpen),
|
|
3379
|
-
/* @__PURE__ */ jsx31("div", { className: "overflow-hidden rounded-md border [&_[data-slot=table-container]]:no-scrollbar", children: /* @__PURE__ */
|
|
3361
|
+
/* @__PURE__ */ jsx31("div", { className: "overflow-hidden rounded-md border [&_[data-slot=table-container]]:no-scrollbar", children: /* @__PURE__ */ jsxs20(Table, { children: [
|
|
3380
3362
|
/* @__PURE__ */ jsx31(DataTableContentHeader, { table }),
|
|
3381
|
-
/* @__PURE__ */ jsx31(
|
|
3382
|
-
DataTableContentBody,
|
|
3383
|
-
{
|
|
3384
|
-
table,
|
|
3385
|
-
columns,
|
|
3386
|
-
isLoading
|
|
3387
|
-
}
|
|
3388
|
-
)
|
|
3363
|
+
/* @__PURE__ */ jsx31(DataTableContentBody, { table, columns })
|
|
3389
3364
|
] }) }),
|
|
3390
|
-
/* @__PURE__ */
|
|
3365
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex items-center justify-between px-2", children: [
|
|
3391
3366
|
/* @__PURE__ */ jsx31(DataTableFooterEntries, { table }),
|
|
3392
3367
|
/* @__PURE__ */ jsx31(DataTableFooterPagination, { table })
|
|
3393
3368
|
] })
|
|
@@ -3473,7 +3448,7 @@ function TabsTrigger(_a) {
|
|
|
3473
3448
|
}
|
|
3474
3449
|
|
|
3475
3450
|
// src/components/composed/header-tabs.tsx
|
|
3476
|
-
import { jsx as jsx33, jsxs as
|
|
3451
|
+
import { jsx as jsx33, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
3477
3452
|
function renderTabIcon(icon) {
|
|
3478
3453
|
if (!icon) return null;
|
|
3479
3454
|
if (typeof icon === "function" || typeof icon === "object" && icon !== null && "render" in icon) {
|
|
@@ -3494,8 +3469,8 @@ var HeaderTabs = memo3(function HeaderTabs2({
|
|
|
3494
3469
|
(item) => item.url === pathname || pathname.endsWith(item.url) || pathname.split("/").includes(item.value)
|
|
3495
3470
|
) : void 0;
|
|
3496
3471
|
const activeTab = (_b = value != null ? value : matchedItem == null ? void 0 : matchedItem.value) != null ? _b : (_a = items[0]) == null ? void 0 : _a.value;
|
|
3497
|
-
return /* @__PURE__ */
|
|
3498
|
-
/* @__PURE__ */ jsx33("div", { className: "w-full overflow-x-auto overflow-y-hidden border-b no-scrollbar", children: /* @__PURE__ */ jsx33(TabsList, { variant: "line", className: "inline-flex w-max justify-start", children: items.map(({ title, value: tabValue, url, icon }) => /* @__PURE__ */
|
|
3472
|
+
return /* @__PURE__ */ jsxs21(Tabs, { value: activeTab, onValueChange, className: "space-y-4", children: [
|
|
3473
|
+
/* @__PURE__ */ jsx33("div", { className: "w-full overflow-x-auto overflow-y-hidden border-b no-scrollbar", children: /* @__PURE__ */ jsx33(TabsList, { variant: "line", className: "inline-flex w-max justify-start", children: items.map(({ title, value: tabValue, url, icon }) => /* @__PURE__ */ jsxs21(
|
|
3499
3474
|
TabsTrigger,
|
|
3500
3475
|
{
|
|
3501
3476
|
nativeButton: false,
|
|
@@ -3514,14 +3489,14 @@ var HeaderTabs = memo3(function HeaderTabs2({
|
|
|
3514
3489
|
|
|
3515
3490
|
// src/components/composed/header-title.tsx
|
|
3516
3491
|
import { memo as memo4 } from "react";
|
|
3517
|
-
import { jsx as jsx34, jsxs as
|
|
3492
|
+
import { jsx as jsx34, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
3518
3493
|
var HeaderTitle = memo4(function HeaderTitle2({
|
|
3519
3494
|
title,
|
|
3520
3495
|
subtitle,
|
|
3521
3496
|
children
|
|
3522
3497
|
}) {
|
|
3523
|
-
return /* @__PURE__ */
|
|
3524
|
-
/* @__PURE__ */
|
|
3498
|
+
return /* @__PURE__ */ jsxs22("div", { className: "w-full space-y-4", children: [
|
|
3499
|
+
/* @__PURE__ */ jsxs22("div", { children: [
|
|
3525
3500
|
/* @__PURE__ */ jsx34("h1", { className: "font-semibold", children: title }),
|
|
3526
3501
|
/* @__PURE__ */ jsx34("p", { className: "text-xs text-muted-foreground", children: subtitle })
|
|
3527
3502
|
] }),
|
|
@@ -3547,6 +3522,7 @@ export {
|
|
|
3547
3522
|
RowActions,
|
|
3548
3523
|
StateEmpty,
|
|
3549
3524
|
exportToCSV,
|
|
3525
|
+
exportToPDF,
|
|
3550
3526
|
exportToXLSX,
|
|
3551
3527
|
features,
|
|
3552
3528
|
flexRender3 as flexRender,
|