@underverse-ui/underverse 1.0.20 → 1.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +158 -118
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +158 -118
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -10496,7 +10496,7 @@ function useTimelineSlots(args) {
|
|
|
10496
10496
|
return React32.createElement(
|
|
10497
10497
|
"span",
|
|
10498
10498
|
{ className: "inline-flex flex-col items-center leading-tight" },
|
|
10499
|
-
React32.createElement("span", { className: "text-[11px] font-semibold text-foreground truncate max-w-
|
|
10499
|
+
React32.createElement("span", { className: "text-[11px] font-semibold text-foreground truncate max-w-32" }, match.title),
|
|
10500
10500
|
React32.createElement("span", { className: "text-[10px] font-medium text-muted-foreground/70" }, rangeText)
|
|
10501
10501
|
);
|
|
10502
10502
|
}
|
|
@@ -11961,7 +11961,7 @@ function CalendarTimeline({
|
|
|
11961
11961
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
11962
11962
|
"div",
|
|
11963
11963
|
{
|
|
11964
|
-
className: cn("text-xs font-semibold leading-snug min-w-0 overflow-hidden", isPlainTitle ? "break-
|
|
11964
|
+
className: cn("text-xs font-semibold leading-snug min-w-0 overflow-hidden", isPlainTitle ? "wrap-break-word" : ""),
|
|
11965
11965
|
style: isPlainTitle ? {
|
|
11966
11966
|
display: "-webkit-box",
|
|
11967
11967
|
WebkitBoxOrient: "vertical",
|
|
@@ -18998,19 +18998,24 @@ var LoadingBar = ({
|
|
|
18998
18998
|
// ../../components/ui/Table.tsx
|
|
18999
18999
|
var import_react33 = __toESM(require("react"), 1);
|
|
19000
19000
|
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
19001
|
-
var Table = import_react33.default.forwardRef(({ className, containerClassName, ...props }, ref) =>
|
|
19002
|
-
|
|
19003
|
-
|
|
19004
|
-
className: cn(
|
|
19005
|
-
"relative w-full overflow-auto",
|
|
19006
|
-
"rounded-2xl md:rounded-3xl border border-border",
|
|
19007
|
-
"bg-card text-card-foreground shadow-sm",
|
|
19008
|
-
"backdrop-blur-sm transition-all duration-300",
|
|
19009
|
-
containerClassName
|
|
19010
|
-
),
|
|
19011
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("table", { ref, className: cn("w-full caption-bottom text-sm", className), ...props })
|
|
19001
|
+
var Table = import_react33.default.forwardRef(({ className, containerClassName, disableContainer = false, ...props }, ref) => {
|
|
19002
|
+
if (disableContainer) {
|
|
19003
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("table", { ref, className: cn("w-full caption-bottom text-sm", className), ...props });
|
|
19012
19004
|
}
|
|
19013
|
-
)
|
|
19005
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
19006
|
+
"div",
|
|
19007
|
+
{
|
|
19008
|
+
className: cn(
|
|
19009
|
+
"relative w-full overflow-auto",
|
|
19010
|
+
"rounded-2xl md:rounded-3xl border border-border",
|
|
19011
|
+
"bg-card text-card-foreground shadow-sm",
|
|
19012
|
+
"backdrop-blur-sm transition-all duration-300",
|
|
19013
|
+
containerClassName
|
|
19014
|
+
),
|
|
19015
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("table", { ref, className: cn("w-full caption-bottom text-sm", className), ...props })
|
|
19016
|
+
}
|
|
19017
|
+
);
|
|
19018
|
+
});
|
|
19014
19019
|
Table.displayName = "Table";
|
|
19015
19020
|
var TableHeader = import_react33.default.forwardRef(({ className, children, filterRow, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("thead", { ref, className: cn("[&_tr]:border-b [&_tr]:border-border", "bg-muted", className), ...props, children: [
|
|
19016
19021
|
children,
|
|
@@ -19061,11 +19066,18 @@ function DataTablePagination({
|
|
|
19061
19066
|
curPageSize,
|
|
19062
19067
|
setCurPage,
|
|
19063
19068
|
pageSizeOptions,
|
|
19064
|
-
setCurPageSize
|
|
19069
|
+
setCurPageSize,
|
|
19070
|
+
size
|
|
19065
19071
|
}) {
|
|
19066
19072
|
const totalPages = Math.ceil(totalItems / curPageSize);
|
|
19067
19073
|
if (!(totalItems > 0 && totalPages > 1)) return null;
|
|
19068
|
-
|
|
19074
|
+
const controlButtonSize = size === "lg" ? "md" : "sm";
|
|
19075
|
+
const navBtnClass = size === "sm" ? "h-6 w-6 p-0 rounded-full" : size === "lg" ? "h-8 w-8 p-0 rounded-full" : "h-7 w-7 p-0 rounded-full";
|
|
19076
|
+
const navIconClass = size === "sm" ? "h-3.5 w-3.5" : size === "lg" ? "h-5 w-5" : "h-4 w-4";
|
|
19077
|
+
const pageBtnClass = size === "sm" ? "h-6 min-w-6 px-1.5 rounded-full text-[11px] font-medium transition-colors" : size === "lg" ? "h-8 min-w-8 px-2.5 rounded-full text-sm font-medium transition-colors" : "h-7 min-w-7 px-2 rounded-full text-xs font-medium transition-colors";
|
|
19078
|
+
const containerTextClass = size === "sm" ? "text-[11px]" : size === "lg" ? "text-sm" : "text-xs";
|
|
19079
|
+
const pageSizeClass = size === "sm" ? "w-16" : size === "lg" ? "w-24" : "w-20";
|
|
19080
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: cn("flex items-center justify-between gap-2 px-1 pt-3 text-muted-foreground", containerTextClass), children: [
|
|
19069
19081
|
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "tabular-nums", children: [
|
|
19070
19082
|
(curPage - 1) * curPageSize + 1,
|
|
19071
19083
|
"-",
|
|
@@ -19078,11 +19090,11 @@ function DataTablePagination({
|
|
|
19078
19090
|
Button_default,
|
|
19079
19091
|
{
|
|
19080
19092
|
variant: "ghost",
|
|
19081
|
-
size:
|
|
19082
|
-
className:
|
|
19093
|
+
size: controlButtonSize,
|
|
19094
|
+
className: navBtnClass,
|
|
19083
19095
|
onClick: () => setCurPage(Math.max(1, curPage - 1)),
|
|
19084
19096
|
disabled: curPage === 1,
|
|
19085
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("svg", { className:
|
|
19097
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("svg", { className: navIconClass, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 19l-7-7 7-7" }) })
|
|
19086
19098
|
}
|
|
19087
19099
|
),
|
|
19088
19100
|
(() => {
|
|
@@ -19104,7 +19116,7 @@ function DataTablePagination({
|
|
|
19104
19116
|
{
|
|
19105
19117
|
onClick: () => setCurPage(p),
|
|
19106
19118
|
className: cn(
|
|
19107
|
-
|
|
19119
|
+
pageBtnClass,
|
|
19108
19120
|
curPage === p ? "bg-primary text-primary-foreground" : "hover:bg-accent hover:text-accent-foreground"
|
|
19109
19121
|
),
|
|
19110
19122
|
children: p
|
|
@@ -19117,11 +19129,11 @@ function DataTablePagination({
|
|
|
19117
19129
|
Button_default,
|
|
19118
19130
|
{
|
|
19119
19131
|
variant: "ghost",
|
|
19120
|
-
size:
|
|
19121
|
-
className:
|
|
19132
|
+
size: controlButtonSize,
|
|
19133
|
+
className: navBtnClass,
|
|
19122
19134
|
onClick: () => setCurPage(Math.min(totalPages, curPage + 1)),
|
|
19123
19135
|
disabled: curPage === totalPages,
|
|
19124
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("svg", { className:
|
|
19136
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("svg", { className: navIconClass, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5l7 7-7 7" }) })
|
|
19125
19137
|
}
|
|
19126
19138
|
)
|
|
19127
19139
|
] }),
|
|
@@ -19134,8 +19146,8 @@ function DataTablePagination({
|
|
|
19134
19146
|
setCurPage(1);
|
|
19135
19147
|
setCurPageSize(Number(v));
|
|
19136
19148
|
},
|
|
19137
|
-
size
|
|
19138
|
-
className:
|
|
19149
|
+
size,
|
|
19150
|
+
className: pageSizeClass
|
|
19139
19151
|
}
|
|
19140
19152
|
)
|
|
19141
19153
|
] });
|
|
@@ -19249,20 +19261,25 @@ function DataTableToolbar({
|
|
|
19249
19261
|
enableDensityToggle,
|
|
19250
19262
|
enableColumnVisibilityToggle,
|
|
19251
19263
|
enableHeaderAlignToggle,
|
|
19264
|
+
size,
|
|
19252
19265
|
density,
|
|
19253
19266
|
setDensity,
|
|
19254
19267
|
setHeaderAlign,
|
|
19255
19268
|
labels,
|
|
19256
19269
|
t
|
|
19257
19270
|
}) {
|
|
19271
|
+
const controlButtonSize = size === "lg" ? "md" : "sm";
|
|
19272
|
+
const controlButtonClass = size === "sm" ? "h-7 px-2 text-xs" : size === "lg" ? "h-9 px-3 text-sm" : "h-8 px-2";
|
|
19273
|
+
const iconClass = size === "sm" ? "w-3.5 h-3.5 mr-1" : "w-4 h-4 mr-1";
|
|
19274
|
+
const captionClass = size === "sm" ? "text-xs" : size === "lg" ? "text-sm" : "text-sm";
|
|
19258
19275
|
return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex items-center justify-between gap-4 mb-1", children: [
|
|
19259
|
-
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: "
|
|
19276
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: captionClass + " text-muted-foreground", children: caption }),
|
|
19260
19277
|
/* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
19261
19278
|
enableDensityToggle && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
19262
19279
|
DropdownMenu_default,
|
|
19263
19280
|
{
|
|
19264
|
-
trigger: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(Button_default, { variant: "ghost", size:
|
|
19265
|
-
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("svg", { className:
|
|
19281
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(Button_default, { variant: "ghost", size: controlButtonSize, className: controlButtonClass, children: [
|
|
19282
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("svg", { className: iconClass, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 6h16M4 10h16M4 14h16M4 18h16" }) }),
|
|
19266
19283
|
labels?.density || t("density")
|
|
19267
19284
|
] }),
|
|
19268
19285
|
items: [
|
|
@@ -19277,8 +19294,8 @@ function DataTableToolbar({
|
|
|
19277
19294
|
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
19278
19295
|
DropdownMenu_default,
|
|
19279
19296
|
{
|
|
19280
|
-
trigger: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(Button_default, { variant: "ghost", size:
|
|
19281
|
-
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("svg", { className:
|
|
19297
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(Button_default, { variant: "ghost", size: controlButtonSize, className: controlButtonClass, children: [
|
|
19298
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("svg", { className: iconClass, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
19282
19299
|
"path",
|
|
19283
19300
|
{
|
|
19284
19301
|
strokeLinecap: "round",
|
|
@@ -19308,8 +19325,8 @@ function DataTableToolbar({
|
|
|
19308
19325
|
enableHeaderAlignToggle && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
19309
19326
|
DropdownMenu_default,
|
|
19310
19327
|
{
|
|
19311
|
-
trigger: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(Button_default, { variant: "ghost", size:
|
|
19312
|
-
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("svg", { className:
|
|
19328
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(Button_default, { variant: "ghost", size: controlButtonSize, className: controlButtonClass, children: [
|
|
19329
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("svg", { className: iconClass, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 6h16M4 12h10M4 18h16" }) }),
|
|
19313
19330
|
labels?.headerAlign || t("headerAlign")
|
|
19314
19331
|
] }),
|
|
19315
19332
|
items: [
|
|
@@ -19428,8 +19445,8 @@ function useStickyColumns(columns, visibleKeys) {
|
|
|
19428
19445
|
if (!col.fixed) return "";
|
|
19429
19446
|
return cn(
|
|
19430
19447
|
"sticky",
|
|
19431
|
-
col.fixed === "left" && "left-0 shadow-[
|
|
19432
|
-
col.fixed === "right" && "right-0 shadow-[-
|
|
19448
|
+
col.fixed === "left" && "left-0 shadow-[2px_0_6px_-3px_rgba(0,0,0,0.08)]",
|
|
19449
|
+
col.fixed === "right" && "right-0 shadow-[-2px_0_6px_-3px_rgba(0,0,0,0.08)]",
|
|
19433
19450
|
"z-50 bg-muted!"
|
|
19434
19451
|
);
|
|
19435
19452
|
}, []);
|
|
@@ -19437,9 +19454,9 @@ function useStickyColumns(columns, visibleKeys) {
|
|
|
19437
19454
|
if (!col.fixed) return "";
|
|
19438
19455
|
return cn(
|
|
19439
19456
|
"sticky z-10",
|
|
19440
|
-
col.fixed === "left" && "left-0 shadow-[
|
|
19441
|
-
col.fixed === "right" && "right-0 shadow-[-
|
|
19442
|
-
isStripedRow ? "bg-
|
|
19457
|
+
col.fixed === "left" && "left-0 shadow-[2px_0_6px_-3px_rgba(0,0,0,0.08)]",
|
|
19458
|
+
col.fixed === "right" && "right-0 shadow-[-2px_0_6px_-3px_rgba(0,0,0,0.08)]",
|
|
19459
|
+
isStripedRow ? "bg-(--surface-1)!" : "bg-(--surface-0)!"
|
|
19443
19460
|
);
|
|
19444
19461
|
}, []);
|
|
19445
19462
|
const getStickyHeaderCellStyle = import_react36.default.useCallback(
|
|
@@ -19549,6 +19566,11 @@ function validateColumns(columns) {
|
|
|
19549
19566
|
|
|
19550
19567
|
// ../../components/ui/DataTable/DataTable.tsx
|
|
19551
19568
|
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
19569
|
+
var SIZE_TO_DENSITY = {
|
|
19570
|
+
sm: "compact",
|
|
19571
|
+
md: "normal",
|
|
19572
|
+
lg: "comfortable"
|
|
19573
|
+
};
|
|
19552
19574
|
function DataTable({
|
|
19553
19575
|
columns,
|
|
19554
19576
|
data,
|
|
@@ -19561,6 +19583,7 @@ function DataTable({
|
|
|
19561
19583
|
onQueryChange,
|
|
19562
19584
|
caption,
|
|
19563
19585
|
toolbar,
|
|
19586
|
+
size = "md",
|
|
19564
19587
|
enableColumnVisibilityToggle = true,
|
|
19565
19588
|
enableDensityToggle = true,
|
|
19566
19589
|
enableHeaderAlignToggle = false,
|
|
@@ -19577,7 +19600,7 @@ function DataTable({
|
|
|
19577
19600
|
const [visibleCols, setVisibleCols] = import_react37.default.useState(() => columns.filter((c) => c.visible !== false).map((c) => c.key));
|
|
19578
19601
|
const [filters, setFilters] = import_react37.default.useState({});
|
|
19579
19602
|
const [sort, setSort] = import_react37.default.useState(null);
|
|
19580
|
-
const [density, setDensity] = import_react37.default.useState(
|
|
19603
|
+
const [density, setDensity] = import_react37.default.useState(() => SIZE_TO_DENSITY[size]);
|
|
19581
19604
|
const [curPage, setCurPage] = import_react37.default.useState(page);
|
|
19582
19605
|
const { curPageSize, setCurPageSize } = usePageSizeStorage({ pageSize, storageKey });
|
|
19583
19606
|
import_react37.default.useEffect(() => {
|
|
@@ -19597,6 +19620,9 @@ function DataTable({
|
|
|
19597
19620
|
import_react37.default.useEffect(() => {
|
|
19598
19621
|
setCurPage(page);
|
|
19599
19622
|
}, [page]);
|
|
19623
|
+
import_react37.default.useEffect(() => {
|
|
19624
|
+
setDensity(SIZE_TO_DENSITY[size]);
|
|
19625
|
+
}, [size]);
|
|
19600
19626
|
const isServerMode = Boolean(onQueryChange);
|
|
19601
19627
|
const hasEmittedQuery = import_react37.default.useRef(false);
|
|
19602
19628
|
import_react37.default.useEffect(() => {
|
|
@@ -19609,6 +19635,9 @@ function DataTable({
|
|
|
19609
19635
|
}, [debouncedFilters, sort, curPage, curPageSize, onQueryChange]);
|
|
19610
19636
|
const densityRowClass = density === "compact" ? "h-9" : density === "comfortable" ? "h-14" : "h-12";
|
|
19611
19637
|
const cellPadding = density === "compact" ? "py-1.5 px-3" : density === "comfortable" ? "py-3 px-4" : "py-2.5 px-4";
|
|
19638
|
+
const headerTitleClass = size === "sm" ? "text-xs" : size === "lg" ? "text-[15px]" : "text-sm";
|
|
19639
|
+
const headerMinHeightClass = size === "sm" ? "min-h-9" : size === "lg" ? "min-h-11" : "min-h-10";
|
|
19640
|
+
const sortIconClass = size === "sm" ? "w-3.5 h-3.5" : size === "lg" ? "w-4 h-4" : "w-3.5 h-3.5";
|
|
19612
19641
|
const visibleColsSet = import_react37.default.useMemo(() => new Set(visibleCols), [visibleCols]);
|
|
19613
19642
|
const visibleColumns = import_react37.default.useMemo(() => {
|
|
19614
19643
|
return filterVisibleColumns(columns, visibleColsSet);
|
|
@@ -19631,7 +19660,7 @@ function DataTable({
|
|
|
19631
19660
|
const renderFilterControl = (col) => {
|
|
19632
19661
|
if (!col.filter) return null;
|
|
19633
19662
|
const k = col.key;
|
|
19634
|
-
const commonProps = { className: "
|
|
19663
|
+
const commonProps = { className: "w-full", size };
|
|
19635
19664
|
if (col.filter.type === "text") {
|
|
19636
19665
|
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
19637
19666
|
Input_default,
|
|
@@ -19652,7 +19681,7 @@ function DataTable({
|
|
|
19652
19681
|
Combobox,
|
|
19653
19682
|
{
|
|
19654
19683
|
options: ["", ...options],
|
|
19655
|
-
size
|
|
19684
|
+
size,
|
|
19656
19685
|
className: "w-full",
|
|
19657
19686
|
value: filters[k] ?? "",
|
|
19658
19687
|
onChange: (v) => {
|
|
@@ -19667,6 +19696,7 @@ function DataTable({
|
|
|
19667
19696
|
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
19668
19697
|
DatePicker,
|
|
19669
19698
|
{
|
|
19699
|
+
size,
|
|
19670
19700
|
placeholder: col.filter.placeholder || `Select ${String(col.title)}`,
|
|
19671
19701
|
value: filters[k] || null,
|
|
19672
19702
|
onChange: (d) => {
|
|
@@ -19685,19 +19715,20 @@ function DataTable({
|
|
|
19685
19715
|
"div",
|
|
19686
19716
|
{
|
|
19687
19717
|
className: cn(
|
|
19688
|
-
"flex items-center gap-1
|
|
19718
|
+
"flex items-center gap-1",
|
|
19719
|
+
headerMinHeightClass,
|
|
19689
19720
|
col.align === "right" && "justify-end",
|
|
19690
19721
|
col.align === "center" && "justify-center",
|
|
19691
19722
|
!col.align && "justify-start"
|
|
19692
19723
|
),
|
|
19693
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "font-medium
|
|
19724
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: cn("font-medium whitespace-nowrap", headerTitleClass), children: col.title })
|
|
19694
19725
|
}
|
|
19695
19726
|
);
|
|
19696
19727
|
}
|
|
19697
19728
|
const isRightAlign = col.align === "right" || !col.align && headerAlign === "right";
|
|
19698
19729
|
const isCenterAlign = col.align === "center" || !col.align && headerAlign === "center";
|
|
19699
19730
|
const titleContent = /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
19700
|
-
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "font-medium
|
|
19731
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: cn("font-medium whitespace-nowrap", headerTitleClass), children: col.title }),
|
|
19701
19732
|
col.sortable && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
19702
19733
|
"button",
|
|
19703
19734
|
{
|
|
@@ -19715,7 +19746,7 @@ function DataTable({
|
|
|
19715
19746
|
},
|
|
19716
19747
|
"aria-label": "Sort",
|
|
19717
19748
|
title: `Sort by ${String(col.title)}`,
|
|
19718
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("svg", {
|
|
19749
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("svg", { viewBox: "0 0 20 20", fill: "none", className: cn("inline-block", sortIconClass), children: [
|
|
19719
19750
|
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
19720
19751
|
"path",
|
|
19721
19752
|
{
|
|
@@ -19781,7 +19812,8 @@ function DataTable({
|
|
|
19781
19812
|
"div",
|
|
19782
19813
|
{
|
|
19783
19814
|
className: cn(
|
|
19784
|
-
"flex items-center gap-2 select-none
|
|
19815
|
+
"flex items-center gap-2 select-none",
|
|
19816
|
+
headerMinHeightClass,
|
|
19785
19817
|
isRightAlign && "justify-end",
|
|
19786
19818
|
isCenterAlign && "justify-center",
|
|
19787
19819
|
!isRightAlign && !isCenterAlign && "justify-start"
|
|
@@ -19854,10 +19886,11 @@ function DataTable({
|
|
|
19854
19886
|
return result;
|
|
19855
19887
|
}, [data, isServerMode, filters, sort, columns]);
|
|
19856
19888
|
const totalItems = isServerMode ? total : processedData.length;
|
|
19857
|
-
const displayedData =
|
|
19889
|
+
const displayedData = import_react37.default.useMemo(() => {
|
|
19890
|
+
if (isServerMode) return data;
|
|
19858
19891
|
const start = (curPage - 1) * curPageSize;
|
|
19859
19892
|
return processedData.slice(start, start + curPageSize);
|
|
19860
|
-
}, [processedData, curPage, curPageSize]);
|
|
19893
|
+
}, [isServerMode, data, processedData, curPage, curPageSize]);
|
|
19861
19894
|
return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: cn("space-y-2", className), children: [
|
|
19862
19895
|
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
19863
19896
|
DataTableToolbar,
|
|
@@ -19870,6 +19903,7 @@ function DataTable({
|
|
|
19870
19903
|
enableDensityToggle,
|
|
19871
19904
|
enableColumnVisibilityToggle,
|
|
19872
19905
|
enableHeaderAlignToggle,
|
|
19906
|
+
size,
|
|
19873
19907
|
density,
|
|
19874
19908
|
setDensity,
|
|
19875
19909
|
setHeaderAlign,
|
|
@@ -19880,79 +19914,84 @@ function DataTable({
|
|
|
19880
19914
|
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
19881
19915
|
"div",
|
|
19882
19916
|
{
|
|
19883
|
-
className: cn(
|
|
19884
|
-
|
|
19885
|
-
|
|
19886
|
-
|
|
19887
|
-
|
|
19888
|
-
|
|
19889
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
|
|
19890
|
-
Table,
|
|
19917
|
+
className: cn(
|
|
19918
|
+
"relative rounded-2xl md:rounded-3xl border border-border/50 bg-card overflow-hidden",
|
|
19919
|
+
loading2 && "opacity-60 pointer-events-none"
|
|
19920
|
+
),
|
|
19921
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
19922
|
+
"div",
|
|
19891
19923
|
{
|
|
19892
|
-
|
|
19893
|
-
|
|
19894
|
-
"
|
|
19895
|
-
|
|
19896
|
-
|
|
19897
|
-
|
|
19898
|
-
children:
|
|
19899
|
-
|
|
19900
|
-
|
|
19901
|
-
|
|
19902
|
-
|
|
19903
|
-
|
|
19904
|
-
|
|
19905
|
-
|
|
19906
|
-
|
|
19907
|
-
|
|
19908
|
-
|
|
19909
|
-
|
|
19910
|
-
|
|
19911
|
-
|
|
19912
|
-
|
|
19913
|
-
|
|
19914
|
-
"\u2026"
|
|
19915
|
-
] })
|
|
19916
|
-
] }) }) }) : !displayedData || displayedData.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(TableCell, { colSpan: leafColumns.length, className: "text-center py-6 text-muted-foreground", children: t("noData") }) }) : displayedData.map((row, idx) => {
|
|
19917
|
-
const isLastRow = idx === displayedData.length - 1;
|
|
19918
|
-
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
19919
|
-
TableRow,
|
|
19920
|
-
{
|
|
19921
|
-
className: cn(densityRowClass),
|
|
19922
|
-
style: {
|
|
19923
|
-
contentVisibility: "auto",
|
|
19924
|
-
containIntrinsicSize: density === "compact" ? "0 36px" : density === "comfortable" ? "0 56px" : "0 48px"
|
|
19925
|
-
},
|
|
19926
|
-
children: leafColumns.map((col, colIdx) => {
|
|
19927
|
-
const value = col.dataIndex ? row[col.dataIndex] : void 0;
|
|
19928
|
-
const isStripedRow = striped && idx % 2 === 0;
|
|
19929
|
-
const prevCol = colIdx > 0 ? leafColumns[colIdx - 1] : null;
|
|
19930
|
-
const isAfterFixedLeft = prevCol?.fixed === "left";
|
|
19931
|
-
const showBorderLeft = columnDividers && colIdx > 0 && !isAfterFixedLeft && !col.fixed;
|
|
19932
|
-
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
19933
|
-
TableCell,
|
|
19924
|
+
className: "thin-scrollbar w-full",
|
|
19925
|
+
style: stickyHeader ? {
|
|
19926
|
+
maxHeight: typeof maxHeight === "number" ? `${maxHeight}px` : maxHeight,
|
|
19927
|
+
overflowY: "auto",
|
|
19928
|
+
overflowX: "auto"
|
|
19929
|
+
} : { overflowX: "auto" },
|
|
19930
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
|
|
19931
|
+
Table,
|
|
19932
|
+
{
|
|
19933
|
+
disableContainer: true,
|
|
19934
|
+
className: cn(
|
|
19935
|
+
"table-fixed",
|
|
19936
|
+
stickyHeader && ["[&_thead]:sticky", "[&_thead]:top-0", "[&_thead]:z-20", "[&_thead]:shadow-[0_1px_3px_rgba(0,0,0,0.1)]"]
|
|
19937
|
+
),
|
|
19938
|
+
style: { minWidth: totalColumnsWidth > 0 ? `${totalColumnsWidth}px` : void 0 },
|
|
19939
|
+
children: [
|
|
19940
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(TableHeader, { children: renderHeader }),
|
|
19941
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(TableBody, { children: loading2 ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(TableCell, { colSpan: leafColumns.length, className: "text-center py-8", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "flex items-center justify-center gap-2 text-muted-foreground", children: [
|
|
19942
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("svg", { className: "animate-spin h-4 w-4", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
|
|
19943
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
19944
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
19945
|
+
"path",
|
|
19934
19946
|
{
|
|
19935
|
-
|
|
19936
|
-
|
|
19937
|
-
|
|
19938
|
-
|
|
19939
|
-
|
|
19940
|
-
|
|
19941
|
-
|
|
19942
|
-
|
|
19943
|
-
|
|
19944
|
-
|
|
19945
|
-
|
|
19946
|
-
|
|
19947
|
+
className: "opacity-75",
|
|
19948
|
+
fill: "currentColor",
|
|
19949
|
+
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
19950
|
+
}
|
|
19951
|
+
)
|
|
19952
|
+
] }),
|
|
19953
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("span", { className: "text-sm", children: [
|
|
19954
|
+
t("loading"),
|
|
19955
|
+
"\u2026"
|
|
19956
|
+
] })
|
|
19957
|
+
] }) }) }) : !displayedData || displayedData.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(TableCell, { colSpan: leafColumns.length, className: "text-center py-6 text-muted-foreground", children: t("noData") }) }) : displayedData.map((row, idx) => {
|
|
19958
|
+
const isStripedRow = striped && idx % 2 === 0;
|
|
19959
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
19960
|
+
TableRow,
|
|
19961
|
+
{
|
|
19962
|
+
className: cn(densityRowClass, isStripedRow ? "bg-surface-1" : "bg-surface-0"),
|
|
19963
|
+
style: {
|
|
19964
|
+
contentVisibility: "auto",
|
|
19965
|
+
containIntrinsicSize: density === "compact" ? "0 36px" : density === "comfortable" ? "0 56px" : "0 48px"
|
|
19947
19966
|
},
|
|
19948
|
-
col
|
|
19949
|
-
|
|
19950
|
-
|
|
19951
|
-
|
|
19952
|
-
|
|
19953
|
-
|
|
19954
|
-
|
|
19955
|
-
|
|
19967
|
+
children: leafColumns.map((col, colIdx) => {
|
|
19968
|
+
const value = col.dataIndex ? row[col.dataIndex] : void 0;
|
|
19969
|
+
const prevCol = colIdx > 0 ? leafColumns[colIdx - 1] : null;
|
|
19970
|
+
const isAfterFixedLeft = prevCol?.fixed === "left";
|
|
19971
|
+
const showBorderLeft = columnDividers && colIdx > 0 && !isAfterFixedLeft && !col.fixed;
|
|
19972
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
19973
|
+
TableCell,
|
|
19974
|
+
{
|
|
19975
|
+
style: getStickyColumnStyle(col),
|
|
19976
|
+
className: cn(
|
|
19977
|
+
cellPadding,
|
|
19978
|
+
col.align === "right" && "text-right",
|
|
19979
|
+
col.align === "center" && "text-center",
|
|
19980
|
+
showBorderLeft && "border-l border-border/60",
|
|
19981
|
+
getStickyCellClass(col, isStripedRow)
|
|
19982
|
+
),
|
|
19983
|
+
children: col.render ? col.render(value, row, idx) : String(value ?? "")
|
|
19984
|
+
},
|
|
19985
|
+
col.key
|
|
19986
|
+
);
|
|
19987
|
+
})
|
|
19988
|
+
},
|
|
19989
|
+
getRowKey(row, idx)
|
|
19990
|
+
);
|
|
19991
|
+
}) })
|
|
19992
|
+
]
|
|
19993
|
+
}
|
|
19994
|
+
)
|
|
19956
19995
|
}
|
|
19957
19996
|
)
|
|
19958
19997
|
}
|
|
@@ -19965,7 +20004,8 @@ function DataTable({
|
|
|
19965
20004
|
curPageSize,
|
|
19966
20005
|
setCurPage,
|
|
19967
20006
|
pageSizeOptions,
|
|
19968
|
-
setCurPageSize
|
|
20007
|
+
setCurPageSize,
|
|
20008
|
+
size
|
|
19969
20009
|
}
|
|
19970
20010
|
)
|
|
19971
20011
|
] });
|