@krosoft/react 0.0.381 → 0.0.382
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/_virtual/_rolldown/runtime.js +13 -0
- package/dist/components/core/cards/DashboardCard.js +18 -0
- package/dist/components/core/cards/KpiCard.js +36 -0
- package/dist/components/core/cards/KpiCards.js +29 -0
- package/dist/components/core/cards/MetricCard.js +63 -0
- package/dist/components/core/cards/SkeletonCard.js +13 -0
- package/dist/components/core/cards/SkeletonCards.js +11 -0
- package/dist/components/core/cards/index.js +7 -1
- package/dist/components/core/changelog/AppChangelog.js +123 -0
- package/dist/components/core/changelog/AppChangelogEntry.js +85 -0
- package/dist/components/core/changelog/AppChangelogNav.js +39 -0
- package/dist/components/core/changelog/AppChangelogTagFilter.js +39 -0
- package/dist/components/core/changelog/index.js +1 -1
- package/dist/components/core/charts/BarChartHorizontal.js +80 -0
- package/dist/components/core/charts/BarChartVertical.js +68 -0
- package/dist/components/core/charts/ChartCard.js +44 -0
- package/dist/components/core/charts/CircularGauge.js +58 -0
- package/dist/components/core/charts/LineChart.js +69 -0
- package/dist/components/core/charts/PieChart.js +55 -0
- package/dist/components/core/charts/chartColors.js +10 -0
- package/dist/components/core/charts/chartTooltip.helper.js +15 -0
- package/dist/components/core/charts/index.js +8 -1
- package/dist/components/core/dialogs/AboutDialog.js +59 -0
- package/dist/components/core/dialogs/AppDialog.js +81 -0
- package/dist/components/core/dialogs/ConfirmationDialog.js +42 -0
- package/dist/components/core/dialogs/FormDialog.js +105 -0
- package/dist/components/core/dialogs/index.js +7 -4
- package/dist/components/core/filters/ActiveFilters.js +69 -0
- package/dist/components/core/filters/AdvancedFilters.js +103 -0
- package/dist/components/core/filters/ConditionFilter.js +162 -0
- package/dist/components/core/filters/ConditionFilterGroup.js +44 -0
- package/dist/components/core/filters/FilterField.js +64 -0
- package/dist/components/core/filters/FilterPills.js +13 -0
- package/dist/components/core/filters/FilterPillsGroup.js +39 -0
- package/dist/components/core/filters/FiltersContainer.js +54 -0
- package/dist/components/core/filters/FiltersMobileDrawer.js +57 -0
- package/dist/components/core/filters/TableFilter.js +101 -0
- package/dist/components/core/filters/index.js +11 -645
- package/dist/{GenericForm-Dxd6k7l-.js → components/core/forms/GenericForm.js} +45 -43
- package/dist/components/core/forms/index.js +1 -1
- package/dist/components/core/icons/FlagFrIcon.js +28 -0
- package/dist/{icons-n0m_1w7z.js → components/core/icons/FlagGbIcon.js} +3 -26
- package/dist/components/core/icons/index.js +3 -1
- package/dist/components/core/index.js +71 -27
- package/dist/components/core/inputs/DatePicker.js +46 -0
- package/dist/components/core/inputs/DateRangePicker.js +92 -0
- package/dist/{inputs-CBojnClc.js → components/core/inputs/FileDropzone.js} +8 -37
- package/dist/{ImageInput-BeIOm3GY.js → components/core/inputs/ImageInput.js} +5 -5
- package/dist/components/core/inputs/MultiSelect.js +191 -0
- package/dist/components/core/inputs/RatingInput.js +36 -0
- package/dist/{SearchInput-IT_Rvthr.js → components/core/inputs/SearchInput.js} +4 -4
- package/dist/components/core/inputs/SingleSelect.js +198 -0
- package/dist/components/core/inputs/index.js +9 -6
- package/dist/components/core/inputs/select.helper.js +46 -0
- package/dist/{language-DY0EYabh.js → components/core/language/LanguageSelector.js} +13 -12
- package/dist/components/core/language/index.js +1 -1
- package/dist/{AppActions-8HjAaTQK.js → components/core/layouts/AppActions.js} +19 -19
- package/dist/components/core/layouts/AppPageHeader.js +44 -0
- package/dist/{AppSubTitle-DI62BaaB.js → components/core/layouts/AppSubTitle.js} +3 -3
- package/dist/{AppTitle-BXoTrXQc.js → components/core/layouts/AppTitle.js} +3 -3
- package/dist/components/core/layouts/KpiCardsLayout.js +8 -0
- package/dist/components/core/layouts/index.js +6 -50
- package/dist/components/core/markdown/AppMarkdown.js +134 -0
- package/dist/components/core/markdown/AppMarkdownHeading.js +45 -0
- package/dist/components/core/markdown/index.js +1 -1
- package/dist/components/core/navbar/GlobalSearch.js +128 -0
- package/dist/components/core/navbar/NotificationsBell.js +133 -0
- package/dist/components/core/navbar/Sidebar.js +99 -0
- package/dist/components/core/navbar/SidebarHeader.js +26 -0
- package/dist/components/core/navbar/SidebarNavItem.js +72 -0
- package/dist/components/core/navbar/Topbar.js +25 -0
- package/dist/components/core/navbar/index.js +7 -1
- package/dist/{ErrorAlert-cJnfBL8H.js → components/core/states/ErrorAlert.js} +5 -5
- package/dist/{states-CJ8xE_Nm.js → components/core/states/ErrorState.js} +4 -11
- package/dist/components/core/states/LoadingState.js +12 -0
- package/dist/components/core/states/index.js +3 -2
- package/dist/components/core/table/DataTable.js +108 -0
- package/dist/components/core/table/JsonTableOutput.js +75 -0
- package/dist/components/core/table/TableActions.js +75 -0
- package/dist/components/core/table/TableBody.js +130 -0
- package/dist/components/core/table/TableBulkActions.js +47 -0
- package/dist/components/core/table/TableHeader.js +103 -0
- package/dist/components/core/table/TablePagination.js +102 -0
- package/dist/components/core/table/TableSettings.js +117 -0
- package/dist/components/core/table/index.js +9 -709
- package/dist/components/core/tabs/AppTabContainer.js +17 -0
- package/dist/components/core/tabs/AppTabHeader.js +19 -0
- package/dist/components/core/tabs/AppTabs.js +56 -0
- package/dist/components/core/tabs/AppVerticalTabs.js +105 -0
- package/dist/components/core/tabs/index.js +5 -188
- package/dist/{theme-DSumNHLX.js → components/core/theme/ThemeSelector.js} +13 -12
- package/dist/components/core/theme/index.js +1 -1
- package/dist/components/index.js +117 -34
- package/dist/components/ui/accordion.js +34 -0
- package/dist/components/ui/alert-dialog.js +54 -0
- package/dist/{alert-REQGK9bR.js → components/ui/alert.js} +2 -2
- package/dist/components/ui/aspect-ratio.js +5 -0
- package/dist/components/ui/avatar.js +25 -0
- package/dist/components/ui/badge.js +22 -0
- package/dist/components/ui/breadcrumb.js +60 -0
- package/dist/{tooltip-_geGvbS7.js → components/ui/button.js} +7 -17
- package/dist/components/ui/calendar.js +44 -0
- package/dist/components/ui/card.js +42 -0
- package/dist/components/ui/carousel.js +115 -0
- package/dist/{chart-wW-fwL3s.js → components/ui/chart.js} +51 -89
- package/dist/components/ui/checkbox.js +31 -0
- package/dist/components/ui/collapsible.js +5 -0
- package/dist/components/ui/command.js +84 -0
- package/dist/components/ui/context-menu.js +71 -0
- package/dist/components/ui/control.js +5 -0
- package/dist/components/ui/dialog.js +49 -0
- package/dist/components/ui/drawer.js +47 -0
- package/dist/components/ui/dropdown-menu.js +72 -0
- package/dist/components/ui/form.js +78 -0
- package/dist/components/ui/hover-card.js +15 -0
- package/dist/components/ui/index.js +49 -9
- package/dist/components/ui/input-otp.js +41 -0
- package/dist/components/ui/input.js +14 -0
- package/dist/components/ui/label.js +14 -0
- package/dist/components/ui/menubar.js +86 -0
- package/dist/components/ui/navigation-menu.js +58 -0
- package/dist/components/ui/pagination.js +62 -0
- package/dist/components/ui/popover.js +15 -0
- package/dist/components/ui/progress.js +17 -0
- package/dist/components/ui/radio-group.js +24 -0
- package/dist/components/ui/resizable.js +18 -0
- package/dist/components/ui/scroll-area.js +29 -0
- package/dist/{select-KWMg2_7Z.js → components/ui/select.js} +3 -3
- package/dist/components/ui/separator.js +15 -0
- package/dist/components/ui/sheet.js +58 -0
- package/dist/components/ui/simple-table.js +57 -0
- package/dist/{skeleton-D6Ga4BLw.js → components/ui/skeleton.js} +2 -2
- package/dist/components/ui/slider.js +17 -0
- package/dist/components/ui/sonner.js +23 -0
- package/dist/components/ui/switch.js +14 -0
- package/dist/components/ui/tabs.js +58 -0
- package/dist/components/ui/textarea.js +12 -0
- package/dist/components/ui/toast.js +53 -0
- package/dist/components/ui/toaster.js +22 -0
- package/dist/components/ui/toggle-group.js +37 -0
- package/dist/components/ui/toggle.js +34 -0
- package/dist/components/ui/tooltip.js +14 -0
- package/dist/{datatable-COQcYUrk.js → constants/datatable.js} +1 -1
- package/dist/constants/index.js +3 -5
- package/dist/constants/search.js +4 -0
- package/dist/contexts/index.js +3 -1
- package/dist/{sidebar.context-BahtU6hE.js → contexts/page.context.js} +2 -2
- package/dist/contexts/sidebar.context.js +5 -0
- package/dist/helpers/changelog.helper.js +69 -0
- package/dist/helpers/index.js +6 -166
- package/dist/{markdown.helper-YJE2H5KQ.js → helpers/markdown.helper.js} +1 -1
- package/dist/helpers/supabase.helper.js +41 -0
- package/dist/helpers/table.helper.js +56 -0
- package/dist/{tailwind.helper-CJaRYBmL.js → helpers/tailwind.helper.js} +1 -1
- package/dist/hooks/behavior/index.js +10 -1
- package/dist/hooks/behavior/useConfirmDeleteDialog.js +21 -0
- package/dist/hooks/behavior/useConfirmationDialog.js +23 -0
- package/dist/hooks/behavior/useDebounce.js +14 -0
- package/dist/hooks/behavior/useDebouncedValue.js +15 -0
- package/dist/hooks/behavior/useDialog.js +21 -0
- package/dist/hooks/behavior/usePage.js +10 -0
- package/dist/hooks/behavior/useSidebar.js +10 -0
- package/dist/hooks/behavior/useTable.js +83 -0
- package/dist/hooks/behavior/useUrlState.js +46 -0
- package/dist/hooks/index.js +20 -11
- package/dist/hooks/ui/index.js +11 -10
- package/dist/{useFixedColumns-Bo-Az3Hp.js → hooks/ui/useDataTable.js} +16 -52
- package/dist/{useDocumentTitle-VoQkict_.js → hooks/ui/useDocumentTitle.js} +2 -2
- package/dist/hooks/ui/useFixedColumns.js +38 -0
- package/dist/{useLanguage-DRnSb5H1.js → hooks/ui/useLanguage.js} +3 -3
- package/dist/{useMobile-pTQ8lWvt.js → hooks/ui/useMobile.js} +1 -1
- package/dist/{useNotifications-CyhTruIG.js → hooks/ui/useNotifications.js} +2 -2
- package/dist/{useScrollFade-D9kqJBDh.js → hooks/ui/useScrollFade.js} +1 -1
- package/dist/{ui-nQGnCss1.js → hooks/ui/useServerTable.js} +2 -2
- package/dist/{useTheme-DIZjiF5F.js → hooks/ui/useTheme.js} +3 -3
- package/dist/{useToast-UeDRLovh.js → hooks/ui/useToast.js} +1 -1
- package/dist/i18n/index.js +4 -1
- package/dist/i18n/krosoftLocales.js +13 -0
- package/dist/i18n/useDateFnsLocale.js +13 -0
- package/dist/i18n/useKrosoftTranslation.js +13 -0
- package/dist/locales/en.json.js +174 -0
- package/dist/locales/fr.json.js +174 -0
- package/dist/providers/SidebarProvider.js +42 -0
- package/dist/providers/index.js +1 -42
- package/dist/pwa/PwaUpdater.js +30 -0
- package/dist/pwa/index.js +3 -50
- package/dist/pwa/pwaUpdateToast.js +25 -0
- package/dist/seasonal/EffectSwitch.js +24 -0
- package/dist/seasonal/EmojiSnowfall.js +24 -0
- package/dist/seasonal/HalloweenEffect.js +17 -0
- package/dist/seasonal/SeasonalEffects.js +8 -0
- package/dist/seasonal/SeasonalEffectsSettings.js +35 -0
- package/dist/seasonal/SnowEffect.js +12 -0
- package/dist/seasonal/index.js +7 -120
- package/dist/seasonal/overlayStyle.js +12 -0
- package/dist/seasonal/seasons.js +7 -0
- package/dist/seasonal/useSeasonalEffects.js +20 -0
- package/dist/seasonal/useStoredToggle.js +21 -0
- package/dist/tailwind/index.js +7 -53
- package/dist/tokens/apply.js +16 -0
- package/dist/tokens/index.js +3 -38
- package/dist/tokens/radius.js +26 -0
- package/dist/types/index.js +0 -1
- package/dist/vendor/tailwindcss/lib/public/create-plugin.js +19 -0
- package/dist/vendor/tailwindcss/lib/util/createPlugin.js +30 -0
- package/dist/vendor/tailwindcss/plugin.js +10 -0
- package/package.json +3 -3
- package/dist/AppMarkdown-CAxm82x0.js +0 -171
- package/dist/MultiSelect-DPN046kI.js +0 -228
- package/dist/SingleSelect-DLY5WylQ.js +0 -313
- package/dist/behavior-B0BYivtN.js +0 -201
- package/dist/cards-DPzVebUM.js +0 -132
- package/dist/changelog-DyPFIscf.js +0 -257
- package/dist/charts-C7rKxkli.js +0 -342
- package/dist/dialogs-CG9Q7pqY.js +0 -269
- package/dist/i18n-BhLphJa3.js +0 -364
- package/dist/navbar-DD0V0pNE.js +0 -432
- package/dist/sheet-cWJO_wkT.js +0 -225
- package/dist/switch-DspImmo_.js +0 -24
- package/dist/ui-Fxy95kSJ.js +0 -1163
|
@@ -1,709 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
import { n as F, r as I } from "../../../datatable-COQcYUrk.js";
|
|
11
|
-
import { useMemo as L, useState as R } from "react";
|
|
12
|
-
import { Fragment as z, jsx as B, jsxs as V } from "react/jsx-runtime";
|
|
13
|
-
import { formatJsonValue as H, isRecord as U, tryParseJson as W } from "@krosoft/core/helpers";
|
|
14
|
-
import { AlertTriangleIcon as G, ArrowDownIcon as K, ArrowUpDownIcon as q, ArrowUpIcon as J, ChevronLeftIcon as Y, ChevronRightIcon as ee, GripVerticalIcon as te, Loader2Icon as ne, MoreVerticalIcon as re, SearchIcon as ie, SettingsIcon as ae } from "lucide-react";
|
|
15
|
-
import { useNavigate as oe } from "react-router-dom";
|
|
16
|
-
//#region src/components/core/table/TableActions.tsx
|
|
17
|
-
function X({ actions: e, row: t }) {
|
|
18
|
-
let { t: n } = o(), r = e.filter((e) => e.visible === void 0 || e.visible(t));
|
|
19
|
-
if (r.length === 0) return null;
|
|
20
|
-
let i = r.filter((e) => e.overflow !== !0), a = r.filter((e) => e.overflow === !0);
|
|
21
|
-
return /* @__PURE__ */ B(x, { children: /* @__PURE__ */ V("div", {
|
|
22
|
-
className: "flex items-center justify-end gap-1",
|
|
23
|
-
children: [i.map((e, r) => {
|
|
24
|
-
let i = e.icon, a = n(e.labelKey), o = e.disabled?.(t) ?? !1;
|
|
25
|
-
return e.iconOnly === !0 && i !== void 0 ? /* @__PURE__ */ V(S, { children: [/* @__PURE__ */ B(y, {
|
|
26
|
-
asChild: !0,
|
|
27
|
-
children: /* @__PURE__ */ B("span", {
|
|
28
|
-
className: "inline-flex",
|
|
29
|
-
tabIndex: o ? 0 : void 0,
|
|
30
|
-
children: /* @__PURE__ */ B(v, {
|
|
31
|
-
variant: e.variant ?? "ghost",
|
|
32
|
-
size: "icon",
|
|
33
|
-
disabled: o,
|
|
34
|
-
"aria-label": a,
|
|
35
|
-
className: `h-7 w-7 text-muted-foreground hover:text-foreground ${e.className ?? ""}`,
|
|
36
|
-
onClick: (n) => {
|
|
37
|
-
n.stopPropagation(), e.onClick(t);
|
|
38
|
-
},
|
|
39
|
-
children: /* @__PURE__ */ B(i, { className: "size-3.5" })
|
|
40
|
-
})
|
|
41
|
-
})
|
|
42
|
-
}), /* @__PURE__ */ B(b, { children: a })] }, r) : /* @__PURE__ */ V(v, {
|
|
43
|
-
variant: e.variant ?? "ghost",
|
|
44
|
-
size: "sm",
|
|
45
|
-
disabled: o,
|
|
46
|
-
className: `h-7 px-2 text-muted-foreground hover:text-foreground ${e.className ?? ""}`,
|
|
47
|
-
onClick: (n) => {
|
|
48
|
-
n.stopPropagation(), e.onClick(t);
|
|
49
|
-
},
|
|
50
|
-
children: [i !== void 0 && /* @__PURE__ */ B(i, { className: "size-3.5" }), a]
|
|
51
|
-
}, r);
|
|
52
|
-
}), a.length > 0 && /* @__PURE__ */ V(m, { children: [/* @__PURE__ */ B(f, {
|
|
53
|
-
asChild: !0,
|
|
54
|
-
children: /* @__PURE__ */ B(v, {
|
|
55
|
-
variant: "ghost",
|
|
56
|
-
size: "icon",
|
|
57
|
-
className: "h-7 w-7 text-muted-foreground hover:text-foreground",
|
|
58
|
-
children: /* @__PURE__ */ B(re, { className: "size-3.5" })
|
|
59
|
-
})
|
|
60
|
-
}), /* @__PURE__ */ B(p, {
|
|
61
|
-
align: "end",
|
|
62
|
-
onClick: (e) => {
|
|
63
|
-
e.stopPropagation();
|
|
64
|
-
},
|
|
65
|
-
children: a.map((e, r) => {
|
|
66
|
-
let i = e.icon;
|
|
67
|
-
return /* @__PURE__ */ V(l, {
|
|
68
|
-
disabled: e.disabled?.(t) ?? !1,
|
|
69
|
-
onClick: () => {
|
|
70
|
-
e.onClick(t);
|
|
71
|
-
},
|
|
72
|
-
className: e.className,
|
|
73
|
-
children: [i !== void 0 && /* @__PURE__ */ B("span", {
|
|
74
|
-
className: "mr-2 size-4 flex items-center justify-center",
|
|
75
|
-
children: /* @__PURE__ */ B(i, { className: "size-4" })
|
|
76
|
-
}), n(e.labelKey)]
|
|
77
|
-
}, r);
|
|
78
|
-
})
|
|
79
|
-
})] })]
|
|
80
|
-
}) });
|
|
81
|
-
}
|
|
82
|
-
//#endregion
|
|
83
|
-
//#region src/components/core/table/TableBody.tsx
|
|
84
|
-
function se({ isLoading: e, error: s, colSpanCount: c, messages: l, paginatedData: u, rowKey: d, onRowClick: f, onRowNavigate: p, rowNavigable: m, hasBulkActions: g, rowSelectable: _, selectedKeys: v, toggleRowSelection: y, visibleColumnsArray: b, columnWidths: x, hasActions: S, actions: C, columns: w, bordered: T = !1, dense: E = !1, resizableColumns: D = !1, fixedColumns: O = {} }) {
|
|
85
|
-
let { t: k } = o(), A = k(l?.loadingKey ?? "states.loading"), j = k(l?.emptyKey ?? "states.noResult"), M = oe(), N = (e, t) => {
|
|
86
|
-
let n = w.find((e) => e.key === t);
|
|
87
|
-
if (n?.renderCell !== void 0) return n.renderCell(e);
|
|
88
|
-
let r = e[t];
|
|
89
|
-
return /* @__PURE__ */ B("span", {
|
|
90
|
-
className: "text-sm truncate",
|
|
91
|
-
children: r == null ? "-" : String(r)
|
|
92
|
-
});
|
|
93
|
-
};
|
|
94
|
-
if (e) return /* @__PURE__ */ B("tbody", {
|
|
95
|
-
className: "divide-y divide-border",
|
|
96
|
-
children: /* @__PURE__ */ B("tr", { children: /* @__PURE__ */ B("td", {
|
|
97
|
-
colSpan: c,
|
|
98
|
-
className: "py-8 text-center",
|
|
99
|
-
children: /* @__PURE__ */ V("div", {
|
|
100
|
-
className: "flex flex-col items-center justify-center gap-2 text-muted-foreground",
|
|
101
|
-
children: [/* @__PURE__ */ B(ne, { className: "h-6 w-6 animate-spin text-primary" }), /* @__PURE__ */ B("span", {
|
|
102
|
-
className: "text-sm",
|
|
103
|
-
children: A
|
|
104
|
-
})]
|
|
105
|
-
})
|
|
106
|
-
}) })
|
|
107
|
-
});
|
|
108
|
-
if (s) return /* @__PURE__ */ B("tbody", {
|
|
109
|
-
className: "divide-y divide-border",
|
|
110
|
-
children: /* @__PURE__ */ B("tr", { children: /* @__PURE__ */ B("td", {
|
|
111
|
-
colSpan: c,
|
|
112
|
-
className: "py-8 text-center",
|
|
113
|
-
children: /* @__PURE__ */ V("div", {
|
|
114
|
-
className: "flex flex-col items-center justify-center gap-2 text-destructive",
|
|
115
|
-
children: [/* @__PURE__ */ B(G, { className: "h-6 w-6" }), /* @__PURE__ */ B("span", {
|
|
116
|
-
className: "text-sm",
|
|
117
|
-
children: s
|
|
118
|
-
})]
|
|
119
|
-
})
|
|
120
|
-
}) })
|
|
121
|
-
});
|
|
122
|
-
if (u.length === 0) return /* @__PURE__ */ B("tbody", {
|
|
123
|
-
className: "divide-y divide-border",
|
|
124
|
-
children: /* @__PURE__ */ B("tr", { children: /* @__PURE__ */ B("td", {
|
|
125
|
-
colSpan: c,
|
|
126
|
-
className: "py-8 text-center text-sm text-muted-foreground",
|
|
127
|
-
children: j
|
|
128
|
-
}) })
|
|
129
|
-
});
|
|
130
|
-
let P = a(O[n], "body"), F = a(O[t], "body"), I = g && v.size > 0, L = (e) => {
|
|
131
|
-
if (m === void 0 || m(e)) return p?.(e);
|
|
132
|
-
}, R = (e, t, n) => {
|
|
133
|
-
I ? y(e) : t === void 0 ? f?.(e, n) : n.ctrlKey || n.metaKey ? window.open(t, "_blank") : M(t);
|
|
134
|
-
};
|
|
135
|
-
return /* @__PURE__ */ B("tbody", {
|
|
136
|
-
className: "divide-y divide-border",
|
|
137
|
-
children: u.map((e) => {
|
|
138
|
-
let t = d(e), n = _ === void 0 || _(e), o = L(e);
|
|
139
|
-
return /* @__PURE__ */ V("tr", {
|
|
140
|
-
className: `group hover:bg-muted/50 transition-colors ${I || o !== void 0 || f !== void 0 ? "cursor-pointer" : ""}`,
|
|
141
|
-
onClick: (t) => {
|
|
142
|
-
R(e, o, t);
|
|
143
|
-
},
|
|
144
|
-
children: [
|
|
145
|
-
g ? /* @__PURE__ */ B("td", {
|
|
146
|
-
className: `p-1 text-center align-middle ${P.className}`,
|
|
147
|
-
style: {
|
|
148
|
-
width: "48px",
|
|
149
|
-
minWidth: "48px",
|
|
150
|
-
maxWidth: "48px",
|
|
151
|
-
...P.style
|
|
152
|
-
},
|
|
153
|
-
onClick: (e) => {
|
|
154
|
-
e.stopPropagation();
|
|
155
|
-
},
|
|
156
|
-
children: /* @__PURE__ */ B("div", {
|
|
157
|
-
className: "flex items-center justify-center",
|
|
158
|
-
children: /* @__PURE__ */ B(h, {
|
|
159
|
-
checked: v.has(t),
|
|
160
|
-
disabled: !n,
|
|
161
|
-
onCheckedChange: () => {
|
|
162
|
-
y(e);
|
|
163
|
-
}
|
|
164
|
-
})
|
|
165
|
-
})
|
|
166
|
-
}) : null,
|
|
167
|
-
b.map((t, n) => {
|
|
168
|
-
let o = n === b.length - 1, s = a(O[t.key], "body");
|
|
169
|
-
return /* @__PURE__ */ B("td", {
|
|
170
|
-
className: `${`${n === 0 && !g ? "pl-4" : "pl-2"} ${o && !S ? "pr-4" : "pr-2"}`} ${E ? "py-2" : "py-4"} text-sm ${r(i(t))} ${s.className} ${T && !o ? "border-r border-border" : ""} ${t.className ?? ""}`,
|
|
171
|
-
style: {
|
|
172
|
-
...D ? { width: x[t.key] } : { minWidth: x[t.key] },
|
|
173
|
-
...s.style
|
|
174
|
-
},
|
|
175
|
-
children: /* @__PURE__ */ B("div", {
|
|
176
|
-
className: "w-full h-full",
|
|
177
|
-
children: N(e, t.key)
|
|
178
|
-
})
|
|
179
|
-
}, t.key);
|
|
180
|
-
}),
|
|
181
|
-
S ? /* @__PURE__ */ B("td", {
|
|
182
|
-
className: `py-1 pl-1 pr-4 text-right align-middle whitespace-nowrap ${F.className}`,
|
|
183
|
-
style: {
|
|
184
|
-
minWidth: "32px",
|
|
185
|
-
...F.style
|
|
186
|
-
},
|
|
187
|
-
onClick: (e) => {
|
|
188
|
-
e.stopPropagation();
|
|
189
|
-
},
|
|
190
|
-
children: C !== void 0 && C.length > 0 ? /* @__PURE__ */ B("div", {
|
|
191
|
-
className: "flex items-center justify-end",
|
|
192
|
-
children: /* @__PURE__ */ B(X, {
|
|
193
|
-
actions: C,
|
|
194
|
-
row: e
|
|
195
|
-
})
|
|
196
|
-
}) : null
|
|
197
|
-
}) : null
|
|
198
|
-
]
|
|
199
|
-
}, t);
|
|
200
|
-
})
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
//#endregion
|
|
204
|
-
//#region src/components/core/table/TableBulkActions.tsx
|
|
205
|
-
function ce({ selectedRows: e, setSelectedRows: t, bulkActions: n }) {
|
|
206
|
-
let { t: r } = o();
|
|
207
|
-
return /* @__PURE__ */ V("div", {
|
|
208
|
-
className: "bg-muted/60 border border-border px-3 py-1.5 flex items-center justify-between rounded-surface",
|
|
209
|
-
children: [/* @__PURE__ */ V("div", {
|
|
210
|
-
className: "flex items-center gap-4",
|
|
211
|
-
children: [/* @__PURE__ */ B("span", {
|
|
212
|
-
className: "text-sm font-medium text-primary ml-1",
|
|
213
|
-
children: r("table.selectedCount", { count: e.length })
|
|
214
|
-
}), /* @__PURE__ */ B("div", {
|
|
215
|
-
className: "flex items-center gap-2",
|
|
216
|
-
children: n.map((n, i) => {
|
|
217
|
-
let a = n.icon;
|
|
218
|
-
return /* @__PURE__ */ V(v, {
|
|
219
|
-
variant: "outline",
|
|
220
|
-
size: "sm",
|
|
221
|
-
onClick: () => {
|
|
222
|
-
n.onClick(e, () => {
|
|
223
|
-
t([]);
|
|
224
|
-
});
|
|
225
|
-
},
|
|
226
|
-
className: `h-7 bg-background shadow-sm text-xs px-2.5 ${n.variant === "destructive" ? "text-destructive border-destructive/30 hover:bg-destructive/10 hover:text-destructive" : "text-foreground"}`,
|
|
227
|
-
children: [a !== void 0 && /* @__PURE__ */ B("span", {
|
|
228
|
-
className: "mr-1.5 flex items-center justify-center",
|
|
229
|
-
children: /* @__PURE__ */ B(a, { className: "h-3.5 w-3.5" })
|
|
230
|
-
}), r(n.labelKey)]
|
|
231
|
-
}, i);
|
|
232
|
-
})
|
|
233
|
-
})]
|
|
234
|
-
}), /* @__PURE__ */ B(v, {
|
|
235
|
-
variant: "ghost",
|
|
236
|
-
size: "sm",
|
|
237
|
-
onClick: () => {
|
|
238
|
-
t([]);
|
|
239
|
-
},
|
|
240
|
-
className: "text-xs text-muted-foreground hover:text-foreground h-7 px-2",
|
|
241
|
-
children: r("table.clearSelection")
|
|
242
|
-
})]
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
//#endregion
|
|
246
|
-
//#region src/components/core/table/TableHeader.tsx
|
|
247
|
-
var Z = {
|
|
248
|
-
left: "justify-start",
|
|
249
|
-
center: "justify-center",
|
|
250
|
-
right: "justify-end"
|
|
251
|
-
};
|
|
252
|
-
function le({ hasBulkActions: e, allSelected: s, someSelected: c, toggleSelectAll: l, visibleColumnsArray: u, draggableColumns: d, resizableColumns: f, columnWidths: p, sortColumn: m, sortDirection: g, handleSort: _, handleDragStart: v, handleDragOver: y, handleDrop: b, handleMouseDown: x, hasActions: S, settingsNode: C, bordered: w = !1, dense: T = !1, fixedColumns: E = {}, fixedSelection: D = !1, fixedActions: O = !1 }) {
|
|
253
|
-
let { t: k } = o(), A = !1;
|
|
254
|
-
s ? A = !0 : c && (A = "indeterminate");
|
|
255
|
-
let j = (e) => e.sortable === !0 ? m === e.key ? B(g === "asc" ? J : K, { className: "size-3.5 text-foreground" }) : /* @__PURE__ */ B(q, { className: "size-3.5 text-muted-foreground/50 group-hover:text-muted-foreground transition-colors" }) : null, M = (t, n, o) => {
|
|
256
|
-
let s = o !== !1 && t.fixed === void 0, c = t.sortable === !0, l = a(E[t.key], "header"), d = i(t), m = j(t), h = n === 0 && !e, g = n === u.length - 1 && !(S || C !== void 0), D = `${h ? "pl-4" : "pl-2"} ${g ? "pr-4" : "pr-2"}`;
|
|
257
|
-
return /* @__PURE__ */ V("th", {
|
|
258
|
-
"data-column-key": t.key,
|
|
259
|
-
"data-fixed-side": t.fixed,
|
|
260
|
-
className: [
|
|
261
|
-
`${D} ${T ? "py-2" : "py-4"} text-sm font-medium text-foreground group`,
|
|
262
|
-
r(d),
|
|
263
|
-
l.className,
|
|
264
|
-
w ? "border-r border-border" : "",
|
|
265
|
-
c ? "cursor-pointer select-none" : "",
|
|
266
|
-
t.className ?? ""
|
|
267
|
-
].filter(Boolean).join(" "),
|
|
268
|
-
style: {
|
|
269
|
-
...f ? { width: p[t.key] } : { minWidth: p[t.key] },
|
|
270
|
-
...l.style
|
|
271
|
-
},
|
|
272
|
-
draggable: s,
|
|
273
|
-
onClick: () => {
|
|
274
|
-
_(t.key);
|
|
275
|
-
},
|
|
276
|
-
onDragStart: (e) => {
|
|
277
|
-
s ? v(e, t.key) : e.preventDefault();
|
|
278
|
-
},
|
|
279
|
-
onDragOver: (e) => {
|
|
280
|
-
y(e, t.key);
|
|
281
|
-
},
|
|
282
|
-
onDrop: (e) => {
|
|
283
|
-
b(e, t.key);
|
|
284
|
-
},
|
|
285
|
-
children: [/* @__PURE__ */ V("div", {
|
|
286
|
-
className: `flex items-center gap-1 ${Z[d]} ${f ? "pr-2" : ""}`,
|
|
287
|
-
children: [
|
|
288
|
-
s ? /* @__PURE__ */ B(te, { className: "size-4 text-muted-foreground cursor-grab shrink-0" }) : null,
|
|
289
|
-
/* @__PURE__ */ B("span", {
|
|
290
|
-
className: "truncate",
|
|
291
|
-
children: k(t.headerKey)
|
|
292
|
-
}),
|
|
293
|
-
m === null ? null : /* @__PURE__ */ B("span", {
|
|
294
|
-
className: "ml-1 shrink-0",
|
|
295
|
-
children: m
|
|
296
|
-
})
|
|
297
|
-
]
|
|
298
|
-
}), f ? /* @__PURE__ */ B("div", {
|
|
299
|
-
className: "absolute right-0 top-0 bottom-0 w-2 cursor-col-resize hover:bg-blue-500 opacity-0 group-hover:opacity-50 transition-opacity",
|
|
300
|
-
onMouseDown: (e) => {
|
|
301
|
-
x(e, t.key);
|
|
302
|
-
}
|
|
303
|
-
}) : null]
|
|
304
|
-
}, t.key);
|
|
305
|
-
}, N = a(E[n], "header"), P = a(E[t], "header");
|
|
306
|
-
return /* @__PURE__ */ B("thead", {
|
|
307
|
-
className: "bg-muted/50 border-b border-border",
|
|
308
|
-
children: /* @__PURE__ */ V("tr", { children: [
|
|
309
|
-
e ? /* @__PURE__ */ B("th", {
|
|
310
|
-
"data-column-key": n,
|
|
311
|
-
"data-fixed-side": D ? "left" : void 0,
|
|
312
|
-
className: `p-1 text-center align-middle ${N.className}`,
|
|
313
|
-
style: {
|
|
314
|
-
width: "48px",
|
|
315
|
-
minWidth: "48px",
|
|
316
|
-
maxWidth: "48px",
|
|
317
|
-
...N.style
|
|
318
|
-
},
|
|
319
|
-
children: /* @__PURE__ */ B("div", {
|
|
320
|
-
className: "flex items-center justify-center",
|
|
321
|
-
children: /* @__PURE__ */ B(h, {
|
|
322
|
-
checked: A,
|
|
323
|
-
onCheckedChange: l
|
|
324
|
-
})
|
|
325
|
-
})
|
|
326
|
-
}) : null,
|
|
327
|
-
u.map((e, t) => M(e, t, d)),
|
|
328
|
-
S || C !== void 0 ? /* @__PURE__ */ B("th", {
|
|
329
|
-
"data-column-key": t,
|
|
330
|
-
"data-fixed-side": O ? "right" : void 0,
|
|
331
|
-
className: `py-1 pl-1 pr-4 text-right align-middle ${P.className}`,
|
|
332
|
-
style: {
|
|
333
|
-
minWidth: "32px",
|
|
334
|
-
...P.style
|
|
335
|
-
},
|
|
336
|
-
children: C
|
|
337
|
-
}) : null
|
|
338
|
-
] })
|
|
339
|
-
});
|
|
340
|
-
}
|
|
341
|
-
//#endregion
|
|
342
|
-
//#region src/components/core/table/TablePagination.tsx
|
|
343
|
-
var Q = "…";
|
|
344
|
-
function $(e, t) {
|
|
345
|
-
return Array.from({ length: t - e + 1 }, (t, n) => e + n);
|
|
346
|
-
}
|
|
347
|
-
function ue(e, t, n = 1) {
|
|
348
|
-
if (n * 2 + 5 >= t) return $(1, t);
|
|
349
|
-
let r = Math.max(e - n, 1), i = Math.min(e + n, t), a = r > 2, o = i < t - 1;
|
|
350
|
-
return !a && o ? [
|
|
351
|
-
...$(1, n + 2),
|
|
352
|
-
Q,
|
|
353
|
-
t
|
|
354
|
-
] : a && !o ? [
|
|
355
|
-
1,
|
|
356
|
-
Q,
|
|
357
|
-
...$(t - (n + 2) + 1, t)
|
|
358
|
-
] : [
|
|
359
|
-
1,
|
|
360
|
-
Q,
|
|
361
|
-
...$(r, i),
|
|
362
|
-
Q,
|
|
363
|
-
t
|
|
364
|
-
];
|
|
365
|
-
}
|
|
366
|
-
function de({ totalItems: e, startIndex: t, endIndex: n, pageSize: r, setPageSize: i, currentPage: a, setCurrentPage: s, pageSizeOptions: c, totalPages: l }) {
|
|
367
|
-
let { t: u } = o(), d = ue(a, l);
|
|
368
|
-
return /* @__PURE__ */ V("div", {
|
|
369
|
-
className: "px-4 py-2 border-t border-border flex flex-col sm:grid sm:grid-cols-3 items-center gap-2 bg-muted/50",
|
|
370
|
-
children: [
|
|
371
|
-
/* @__PURE__ */ B("div", {
|
|
372
|
-
className: "text-sm text-muted-foreground justify-self-start",
|
|
373
|
-
children: u("table.rangeOfTotal", {
|
|
374
|
-
range: e === 0 ? "0" : `${String(t + 1)} - ${String(n)}`,
|
|
375
|
-
total: e
|
|
376
|
-
})
|
|
377
|
-
}),
|
|
378
|
-
/* @__PURE__ */ B("div", {
|
|
379
|
-
className: "flex items-center justify-center gap-1",
|
|
380
|
-
children: l > 1 && /* @__PURE__ */ V(z, { children: [
|
|
381
|
-
/* @__PURE__ */ B(v, {
|
|
382
|
-
variant: "ghost",
|
|
383
|
-
size: "icon",
|
|
384
|
-
className: "h-8 w-8 rounded-control",
|
|
385
|
-
onClick: () => {
|
|
386
|
-
s((e) => Math.max(1, e - 1));
|
|
387
|
-
},
|
|
388
|
-
disabled: a === 1,
|
|
389
|
-
"aria-label": u("table.previousPage"),
|
|
390
|
-
children: /* @__PURE__ */ B(Y, { className: "size-4" })
|
|
391
|
-
}),
|
|
392
|
-
d.map((e, t) => e === Q ? /* @__PURE__ */ B("span", {
|
|
393
|
-
className: "flex h-8 w-8 items-center justify-center text-sm text-muted-foreground",
|
|
394
|
-
children: Q
|
|
395
|
-
}, `dots-${String(t)}`) : /* @__PURE__ */ B(v, {
|
|
396
|
-
variant: e === a ? "default" : "ghost",
|
|
397
|
-
className: "h-8 min-w-8 px-2 rounded-control text-sm tabular-nums",
|
|
398
|
-
onClick: () => {
|
|
399
|
-
s(e);
|
|
400
|
-
},
|
|
401
|
-
"aria-current": e === a ? "page" : void 0,
|
|
402
|
-
children: e
|
|
403
|
-
}, e)),
|
|
404
|
-
/* @__PURE__ */ B(v, {
|
|
405
|
-
variant: "ghost",
|
|
406
|
-
size: "icon",
|
|
407
|
-
className: "h-8 w-8 rounded-control",
|
|
408
|
-
onClick: () => {
|
|
409
|
-
s((e) => Math.min(l, e + 1));
|
|
410
|
-
},
|
|
411
|
-
disabled: a === l,
|
|
412
|
-
"aria-label": u("table.nextPage"),
|
|
413
|
-
children: /* @__PURE__ */ B(ee, { className: "size-4" })
|
|
414
|
-
})
|
|
415
|
-
] })
|
|
416
|
-
}),
|
|
417
|
-
/* @__PURE__ */ B("div", {
|
|
418
|
-
className: "justify-self-end",
|
|
419
|
-
children: /* @__PURE__ */ V(j, {
|
|
420
|
-
value: String(r),
|
|
421
|
-
onValueChange: (e) => {
|
|
422
|
-
i(Number(e)), s(1);
|
|
423
|
-
},
|
|
424
|
-
children: [/* @__PURE__ */ B(k, {
|
|
425
|
-
className: "h-8 w-[110px] text-sm",
|
|
426
|
-
children: /* @__PURE__ */ B(M, {})
|
|
427
|
-
}), /* @__PURE__ */ B(A, { children: c.map((e) => /* @__PURE__ */ B(O, {
|
|
428
|
-
value: String(e),
|
|
429
|
-
children: u("table.perPage", { count: e })
|
|
430
|
-
}, e)) })]
|
|
431
|
-
})
|
|
432
|
-
})
|
|
433
|
-
]
|
|
434
|
-
});
|
|
435
|
-
}
|
|
436
|
-
//#endregion
|
|
437
|
-
//#region src/components/core/table/TableSettings.tsx
|
|
438
|
-
function fe({ columns: t, visibleColumns: n, toggleColumnVisibility: r, setColumnsVisibility: i }) {
|
|
439
|
-
let { t: a } = o(), [s, c] = R(""), l = L(() => t.map((e, t) => ({
|
|
440
|
-
key: e.key,
|
|
441
|
-
label: a(e.headerKey),
|
|
442
|
-
locked: t === 0
|
|
443
|
-
})), [t, a]), u = L(() => {
|
|
444
|
-
let e = s.trim().toLowerCase();
|
|
445
|
-
return e === "" ? l : l.filter((t) => t.label.toLowerCase().includes(e));
|
|
446
|
-
}, [l, s]), d = (e) => {
|
|
447
|
-
let t = u.filter((e) => !e.locked).map((e) => e.key).filter((t) => n.has(t) !== e);
|
|
448
|
-
i === void 0 ? t.forEach(r) : i(t, e);
|
|
449
|
-
};
|
|
450
|
-
return /* @__PURE__ */ V(T, {
|
|
451
|
-
onOpenChange: (e) => {
|
|
452
|
-
e || c("");
|
|
453
|
-
},
|
|
454
|
-
children: [/* @__PURE__ */ B(C, {
|
|
455
|
-
asChild: !0,
|
|
456
|
-
children: /* @__PURE__ */ B(v, {
|
|
457
|
-
variant: "outline",
|
|
458
|
-
size: "sm",
|
|
459
|
-
className: "size-7 p-0 bg-background hover:bg-muted shadow-sm border-border",
|
|
460
|
-
children: /* @__PURE__ */ B(ae, { className: "size-3.5 text-muted-foreground" })
|
|
461
|
-
})
|
|
462
|
-
}), /* @__PURE__ */ V(w, {
|
|
463
|
-
align: "end",
|
|
464
|
-
className: "w-64 p-0",
|
|
465
|
-
children: [
|
|
466
|
-
/* @__PURE__ */ V("div", {
|
|
467
|
-
className: "flex items-center justify-between px-3 pt-3 pb-2",
|
|
468
|
-
children: [/* @__PURE__ */ B("span", {
|
|
469
|
-
className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground",
|
|
470
|
-
children: a("table.columnsTitle")
|
|
471
|
-
}), /* @__PURE__ */ V("span", {
|
|
472
|
-
className: "text-xs text-muted-foreground",
|
|
473
|
-
children: [
|
|
474
|
-
n.size,
|
|
475
|
-
" / ",
|
|
476
|
-
t.length
|
|
477
|
-
]
|
|
478
|
-
})]
|
|
479
|
-
}),
|
|
480
|
-
/* @__PURE__ */ B("div", {
|
|
481
|
-
className: "px-2 pb-2",
|
|
482
|
-
children: /* @__PURE__ */ V("div", {
|
|
483
|
-
className: "relative",
|
|
484
|
-
children: [/* @__PURE__ */ B(ie, { className: "absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground" }), /* @__PURE__ */ B("input", {
|
|
485
|
-
value: s,
|
|
486
|
-
onChange: (e) => {
|
|
487
|
-
c(e.target.value);
|
|
488
|
-
},
|
|
489
|
-
placeholder: a("search.placeholder"),
|
|
490
|
-
className: "w-full rounded-control bg-muted/50 py-1.5 pl-7 pr-2 text-sm text-foreground placeholder:text-muted-foreground outline-none focus:ring-1 focus:ring-ring",
|
|
491
|
-
autoFocus: !0
|
|
492
|
-
})]
|
|
493
|
-
})
|
|
494
|
-
}),
|
|
495
|
-
/* @__PURE__ */ V("div", {
|
|
496
|
-
className: "flex max-h-72 flex-col gap-0.5 overflow-y-auto overflow-x-hidden border-t border-border p-1.5 [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-muted-foreground/20 [&::-webkit-scrollbar-track]:bg-transparent",
|
|
497
|
-
children: [u.length === 0 && /* @__PURE__ */ B("p", {
|
|
498
|
-
className: "px-2 py-3 text-center text-xs text-muted-foreground",
|
|
499
|
-
children: a("states.noResult")
|
|
500
|
-
}), u.map((t) => /* @__PURE__ */ V("label", {
|
|
501
|
-
className: e("flex min-w-0 items-center gap-2.5 rounded-md px-2 py-1.5 text-sm transition-colors", t.locked ? "cursor-not-allowed text-muted-foreground" : "cursor-pointer hover:bg-muted"),
|
|
502
|
-
children: [/* @__PURE__ */ B(h, {
|
|
503
|
-
checked: t.locked || n.has(t.key),
|
|
504
|
-
disabled: t.locked,
|
|
505
|
-
onCheckedChange: () => {
|
|
506
|
-
r(t.key);
|
|
507
|
-
}
|
|
508
|
-
}), /* @__PURE__ */ B("span", {
|
|
509
|
-
className: "min-w-0 flex-1 truncate",
|
|
510
|
-
title: t.label,
|
|
511
|
-
children: t.label
|
|
512
|
-
})]
|
|
513
|
-
}, t.key))]
|
|
514
|
-
}),
|
|
515
|
-
u.length > 0 && /* @__PURE__ */ V("div", {
|
|
516
|
-
className: "flex items-center justify-end gap-2 border-t border-border px-3 py-2 text-xs",
|
|
517
|
-
children: [
|
|
518
|
-
/* @__PURE__ */ B("button", {
|
|
519
|
-
type: "button",
|
|
520
|
-
onClick: () => {
|
|
521
|
-
d(!0);
|
|
522
|
-
},
|
|
523
|
-
className: "font-medium text-primary hover:underline",
|
|
524
|
-
children: a("table.showAllColumns")
|
|
525
|
-
}),
|
|
526
|
-
/* @__PURE__ */ B("span", {
|
|
527
|
-
className: "h-3 w-px bg-border",
|
|
528
|
-
"aria-hidden": !0
|
|
529
|
-
}),
|
|
530
|
-
/* @__PURE__ */ B("button", {
|
|
531
|
-
type: "button",
|
|
532
|
-
onClick: () => {
|
|
533
|
-
d(!1);
|
|
534
|
-
},
|
|
535
|
-
className: "font-medium text-primary hover:underline",
|
|
536
|
-
children: a("table.hideAllColumns")
|
|
537
|
-
})
|
|
538
|
-
]
|
|
539
|
-
})
|
|
540
|
-
]
|
|
541
|
-
})]
|
|
542
|
-
});
|
|
543
|
-
}
|
|
544
|
-
//#endregion
|
|
545
|
-
//#region src/components/core/table/DataTable.tsx
|
|
546
|
-
function pe({ data: e, isLoading: t = !1, error: n = null, config: r, server: i }) {
|
|
547
|
-
let { columns: a, rowKey: o, rowSelectable: s, onRowClick: c, onRowNavigate: l, rowNavigable: u, actions: d, bulkActions: f } = r, p = r.pageSizeDefault ?? F, m = r.pageSizeOptions ?? I, h = r.dense ?? !1, g = r.bordered ?? !1, _ = r.draggableColumns ?? !1, v = r.resizableColumns ?? !1, y = r.columnVisibility ?? !1, b = r.fixedActions ?? !1, { sortColumn: x, sortDirection: S, selectedRows: C, setSelectedRows: w, visibleColumns: T, columnWidths: E, safeCurrentPage: D, totalPages: O, startIndex: k, endIndex: A, tableRef: j, hasActions: M, hasBulkActions: R, visibleColumnsArray: z, colSpanCount: H, paginatedData: U, handleSort: W, handleMouseDown: G, handleDragStart: K, handleDragOver: q, handleDrop: J, toggleColumnVisibility: Y, setColumnsVisibility: ee, toggleRowSelection: te, toggleSelectAll: ne, pageSize: re, setPageSize: ie, setCurrentPage: ae } = N({
|
|
548
|
-
data: e,
|
|
549
|
-
columns: a,
|
|
550
|
-
rowKey: o,
|
|
551
|
-
rowSelectable: s,
|
|
552
|
-
pageSizeDefault: p,
|
|
553
|
-
actions: d,
|
|
554
|
-
bulkActions: f,
|
|
555
|
-
columnVisibility: y,
|
|
556
|
-
columnVisibilityState: r.columnVisibilityState,
|
|
557
|
-
onColumnVisibilityChange: r.onColumnVisibilityChange,
|
|
558
|
-
columnVisibilityStorage: r.columnVisibilityStorage,
|
|
559
|
-
server: i
|
|
560
|
-
}), oe = R && z.some((e) => e.fixed === "left"), X = P(j), Z = L(() => new Set(C.map(o)), [C, o]), Q = L(() => s === void 0 ? e : e.filter(s), [e, s]), $ = Q.length > 0 && Q.every((e) => Z.has(o(e))), ue = !$ && Q.some((e) => Z.has(o(e)));
|
|
561
|
-
return /* @__PURE__ */ V("div", {
|
|
562
|
-
className: "space-y-4 [--k-radius-control:var(--k-radius-control-dense,0.5rem)] [--k-radius-surface:var(--k-radius-surface-dense,0.75rem)]",
|
|
563
|
-
children: [C.length > 0 && f !== void 0 && f.length > 0 && /* @__PURE__ */ B(ce, {
|
|
564
|
-
selectedRows: C,
|
|
565
|
-
setSelectedRows: w,
|
|
566
|
-
bulkActions: f
|
|
567
|
-
}), /* @__PURE__ */ V("div", {
|
|
568
|
-
className: "w-full bg-card rounded-surface border border-border overflow-hidden",
|
|
569
|
-
children: [/* @__PURE__ */ B("div", {
|
|
570
|
-
className: "overflow-x-auto",
|
|
571
|
-
children: /* @__PURE__ */ V("table", {
|
|
572
|
-
ref: j,
|
|
573
|
-
className: "w-full",
|
|
574
|
-
children: [/* @__PURE__ */ B(le, {
|
|
575
|
-
hasBulkActions: R,
|
|
576
|
-
allSelected: $,
|
|
577
|
-
someSelected: ue,
|
|
578
|
-
toggleSelectAll: ne,
|
|
579
|
-
visibleColumnsArray: z,
|
|
580
|
-
draggableColumns: _,
|
|
581
|
-
resizableColumns: v,
|
|
582
|
-
columnWidths: E,
|
|
583
|
-
sortColumn: x,
|
|
584
|
-
sortDirection: S,
|
|
585
|
-
handleSort: W,
|
|
586
|
-
handleDragStart: K,
|
|
587
|
-
handleDragOver: q,
|
|
588
|
-
handleDrop: J,
|
|
589
|
-
handleMouseDown: G,
|
|
590
|
-
hasActions: M,
|
|
591
|
-
bordered: g,
|
|
592
|
-
dense: h,
|
|
593
|
-
fixedColumns: X,
|
|
594
|
-
fixedSelection: oe,
|
|
595
|
-
fixedActions: b,
|
|
596
|
-
settingsNode: y ? /* @__PURE__ */ B(fe, {
|
|
597
|
-
columns: a,
|
|
598
|
-
visibleColumns: T,
|
|
599
|
-
toggleColumnVisibility: Y,
|
|
600
|
-
setColumnsVisibility: ee
|
|
601
|
-
}) : void 0
|
|
602
|
-
}), /* @__PURE__ */ B(se, {
|
|
603
|
-
bordered: g,
|
|
604
|
-
dense: h,
|
|
605
|
-
isLoading: t,
|
|
606
|
-
error: n,
|
|
607
|
-
colSpanCount: H,
|
|
608
|
-
messages: r.messages,
|
|
609
|
-
paginatedData: U,
|
|
610
|
-
rowKey: o,
|
|
611
|
-
onRowClick: c,
|
|
612
|
-
onRowNavigate: l,
|
|
613
|
-
rowNavigable: u,
|
|
614
|
-
hasBulkActions: R,
|
|
615
|
-
rowSelectable: s,
|
|
616
|
-
selectedKeys: Z,
|
|
617
|
-
toggleRowSelection: te,
|
|
618
|
-
visibleColumnsArray: z,
|
|
619
|
-
columnWidths: E,
|
|
620
|
-
hasActions: M || y,
|
|
621
|
-
actions: d,
|
|
622
|
-
columns: a,
|
|
623
|
-
resizableColumns: v,
|
|
624
|
-
fixedColumns: X
|
|
625
|
-
})]
|
|
626
|
-
})
|
|
627
|
-
}), /* @__PURE__ */ B(de, {
|
|
628
|
-
totalItems: i?.totalRows ?? e.length,
|
|
629
|
-
startIndex: k,
|
|
630
|
-
endIndex: A,
|
|
631
|
-
pageSize: re,
|
|
632
|
-
setPageSize: ie,
|
|
633
|
-
currentPage: D,
|
|
634
|
-
setCurrentPage: ae,
|
|
635
|
-
pageSizeOptions: m,
|
|
636
|
-
totalPages: O
|
|
637
|
-
})]
|
|
638
|
-
})]
|
|
639
|
-
});
|
|
640
|
-
}
|
|
641
|
-
//#endregion
|
|
642
|
-
//#region src/components/core/table/JsonTableOutput.tsx
|
|
643
|
-
var me = ({ header: e, output: t }) => {
|
|
644
|
-
let { t: n } = o(), [r, i] = R(!0), a = W(t), l = a !== null, f = () => /* @__PURE__ */ V("div", {
|
|
645
|
-
className: "flex items-center justify-between mb-2",
|
|
646
|
-
children: [/* @__PURE__ */ B("span", {
|
|
647
|
-
className: "font-medium text-sm",
|
|
648
|
-
children: e
|
|
649
|
-
}), /* @__PURE__ */ V("div", {
|
|
650
|
-
className: "flex items-center gap-2",
|
|
651
|
-
children: [/* @__PURE__ */ B(D, {
|
|
652
|
-
id: "table-mode",
|
|
653
|
-
checked: r,
|
|
654
|
-
onCheckedChange: i
|
|
655
|
-
}), /* @__PURE__ */ B(E, {
|
|
656
|
-
htmlFor: "table-mode",
|
|
657
|
-
className: "text-xs",
|
|
658
|
-
children: n("table.tableMode")
|
|
659
|
-
})]
|
|
660
|
-
})]
|
|
661
|
-
}), p = ({ children: e }) => /* @__PURE__ */ B("div", {
|
|
662
|
-
className: "border rounded min-w-0 w-full",
|
|
663
|
-
children: /* @__PURE__ */ B(_, { children: e })
|
|
664
|
-
}), m = () => /* @__PURE__ */ B("pre", {
|
|
665
|
-
className: "text-xs bg-muted p-4 rounded overflow-x-auto whitespace-pre-wrap",
|
|
666
|
-
children: l && !r ? JSON.stringify(a, null, 2) : t
|
|
667
|
-
});
|
|
668
|
-
return t ? /* @__PURE__ */ V("div", {
|
|
669
|
-
className: "min-w-0 w-full",
|
|
670
|
-
children: [f(), (() => {
|
|
671
|
-
if (!l || !r) return /* @__PURE__ */ B(m, {});
|
|
672
|
-
if (Array.isArray(a) && a.length > 0 && U(a[0])) {
|
|
673
|
-
let e = a, t = Object.keys(e[0]);
|
|
674
|
-
return /* @__PURE__ */ V(p, { children: [/* @__PURE__ */ B(s, {
|
|
675
|
-
className: "bg-muted/50",
|
|
676
|
-
children: /* @__PURE__ */ B(u, { children: t.map((e) => /* @__PURE__ */ B(c, {
|
|
677
|
-
className: "font-medium",
|
|
678
|
-
children: e
|
|
679
|
-
}, e)) })
|
|
680
|
-
}), /* @__PURE__ */ B(d, { children: e.map((e, n) => /* @__PURE__ */ B(u, { children: t.map((t) => /* @__PURE__ */ B(g, {
|
|
681
|
-
className: "text-sm whitespace-pre-wrap",
|
|
682
|
-
children: H(e[t])
|
|
683
|
-
}, t)) }, n)) })] });
|
|
684
|
-
}
|
|
685
|
-
if (U(a)) {
|
|
686
|
-
let e = Object.entries(a);
|
|
687
|
-
return /* @__PURE__ */ V(p, { children: [/* @__PURE__ */ B(s, {
|
|
688
|
-
className: "bg-muted/50",
|
|
689
|
-
children: /* @__PURE__ */ V(u, { children: [/* @__PURE__ */ B(c, {
|
|
690
|
-
className: "font-medium",
|
|
691
|
-
children: n("table.property")
|
|
692
|
-
}), /* @__PURE__ */ B(c, {
|
|
693
|
-
className: "font-medium",
|
|
694
|
-
children: n("table.value")
|
|
695
|
-
})] })
|
|
696
|
-
}), /* @__PURE__ */ B(d, { children: e.map(([e, t]) => /* @__PURE__ */ V(u, { children: [/* @__PURE__ */ B(g, {
|
|
697
|
-
className: "font-medium text-sm",
|
|
698
|
-
children: e
|
|
699
|
-
}), /* @__PURE__ */ B(g, {
|
|
700
|
-
className: "text-sm whitespace-pre-wrap",
|
|
701
|
-
children: H(t)
|
|
702
|
-
})] }, e)) })] });
|
|
703
|
-
}
|
|
704
|
-
return /* @__PURE__ */ B(m, {});
|
|
705
|
-
})()]
|
|
706
|
-
}) : null;
|
|
707
|
-
};
|
|
708
|
-
//#endregion
|
|
709
|
-
export { pe as DataTable, me as JsonTableOutput, X as TableActions, se as TableBody, ce as TableBulkActions, le as TableHeader, de as TablePagination, fe as TableSettings };
|
|
1
|
+
import { TableActions as e } from "./TableActions.js";
|
|
2
|
+
import { TableBody as t } from "./TableBody.js";
|
|
3
|
+
import { TableBulkActions as n } from "./TableBulkActions.js";
|
|
4
|
+
import { TableHeader as r } from "./TableHeader.js";
|
|
5
|
+
import { TablePagination as i } from "./TablePagination.js";
|
|
6
|
+
import { TableSettings as a } from "./TableSettings.js";
|
|
7
|
+
import { DataTable as o } from "./DataTable.js";
|
|
8
|
+
import { JsonTableOutput as s } from "./JsonTableOutput.js";
|
|
9
|
+
export { o as DataTable, s as JsonTableOutput, e as TableActions, t as TableBody, n as TableBulkActions, r as TableHeader, i as TablePagination, a as TableSettings };
|