@underverse-ui/underverse 0.2.9 → 0.2.10
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 +48 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +53 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1405,6 +1405,7 @@ interface DataTableProps<T> {
|
|
|
1405
1405
|
toolbar?: React__default.ReactNode;
|
|
1406
1406
|
enableColumnVisibilityToggle?: boolean;
|
|
1407
1407
|
enableDensityToggle?: boolean;
|
|
1408
|
+
enableHeaderAlignToggle?: boolean;
|
|
1408
1409
|
striped?: boolean;
|
|
1409
1410
|
/** Hiển thị đường kẻ dọc ngăn cách giữa các cột */
|
|
1410
1411
|
columnDividers?: boolean;
|
|
@@ -1415,9 +1416,13 @@ interface DataTableProps<T> {
|
|
|
1415
1416
|
compact?: string;
|
|
1416
1417
|
normal?: string;
|
|
1417
1418
|
comfortable?: string;
|
|
1419
|
+
headerAlign?: string;
|
|
1420
|
+
alignLeft?: string;
|
|
1421
|
+
alignCenter?: string;
|
|
1422
|
+
alignRight?: string;
|
|
1418
1423
|
};
|
|
1419
1424
|
}
|
|
1420
|
-
declare function DataTable<T extends Record<string, any>>({ columns, data, rowKey, loading, total, page, pageSize, pageSizeOptions, onQueryChange, caption, toolbar, enableColumnVisibilityToggle, enableDensityToggle, striped, // Mặc định bật màu nền sẽn kẽ cho các dòng
|
|
1425
|
+
declare function DataTable<T extends Record<string, any>>({ columns, data, rowKey, loading, total, page, pageSize, pageSizeOptions, onQueryChange, caption, toolbar, enableColumnVisibilityToggle, enableDensityToggle, enableHeaderAlignToggle, striped, // Mặc định bật màu nền sẽn kẽ cho các dòng
|
|
1421
1426
|
columnDividers, className, labels, }: DataTableProps<T>): react_jsx_runtime.JSX.Element;
|
|
1422
1427
|
|
|
1423
1428
|
interface TableProps extends React__default.HTMLAttributes<HTMLTableElement> {
|
package/dist/index.d.ts
CHANGED
|
@@ -1405,6 +1405,7 @@ interface DataTableProps<T> {
|
|
|
1405
1405
|
toolbar?: React__default.ReactNode;
|
|
1406
1406
|
enableColumnVisibilityToggle?: boolean;
|
|
1407
1407
|
enableDensityToggle?: boolean;
|
|
1408
|
+
enableHeaderAlignToggle?: boolean;
|
|
1408
1409
|
striped?: boolean;
|
|
1409
1410
|
/** Hiển thị đường kẻ dọc ngăn cách giữa các cột */
|
|
1410
1411
|
columnDividers?: boolean;
|
|
@@ -1415,9 +1416,13 @@ interface DataTableProps<T> {
|
|
|
1415
1416
|
compact?: string;
|
|
1416
1417
|
normal?: string;
|
|
1417
1418
|
comfortable?: string;
|
|
1419
|
+
headerAlign?: string;
|
|
1420
|
+
alignLeft?: string;
|
|
1421
|
+
alignCenter?: string;
|
|
1422
|
+
alignRight?: string;
|
|
1418
1423
|
};
|
|
1419
1424
|
}
|
|
1420
|
-
declare function DataTable<T extends Record<string, any>>({ columns, data, rowKey, loading, total, page, pageSize, pageSizeOptions, onQueryChange, caption, toolbar, enableColumnVisibilityToggle, enableDensityToggle, striped, // Mặc định bật màu nền sẽn kẽ cho các dòng
|
|
1425
|
+
declare function DataTable<T extends Record<string, any>>({ columns, data, rowKey, loading, total, page, pageSize, pageSizeOptions, onQueryChange, caption, toolbar, enableColumnVisibilityToggle, enableDensityToggle, enableHeaderAlignToggle, striped, // Mặc định bật màu nền sẽn kẽ cho các dòng
|
|
1421
1426
|
columnDividers, className, labels, }: DataTableProps<T>): react_jsx_runtime.JSX.Element;
|
|
1422
1427
|
|
|
1423
1428
|
interface TableProps extends React__default.HTMLAttributes<HTMLTableElement> {
|
package/dist/index.js
CHANGED
|
@@ -9880,7 +9880,7 @@ TableCaption.displayName = "TableCaption";
|
|
|
9880
9880
|
import { Filter as FilterIcon } from "lucide-react";
|
|
9881
9881
|
import React37 from "react";
|
|
9882
9882
|
import { useTranslations as useTranslations7 } from "next-intl";
|
|
9883
|
-
import { jsx as jsx47, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
9883
|
+
import { Fragment as Fragment17, jsx as jsx47, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
9884
9884
|
function useDebounced(value, delay = 300) {
|
|
9885
9885
|
const [debounced, setDebounced] = React37.useState(value);
|
|
9886
9886
|
React37.useEffect(() => {
|
|
@@ -9903,6 +9903,7 @@ function DataTable({
|
|
|
9903
9903
|
toolbar,
|
|
9904
9904
|
enableColumnVisibilityToggle = true,
|
|
9905
9905
|
enableDensityToggle = true,
|
|
9906
|
+
enableHeaderAlignToggle = false,
|
|
9906
9907
|
striped = true,
|
|
9907
9908
|
// Mặc định bật màu nền sẽn kẽ cho các dòng
|
|
9908
9909
|
columnDividers = false,
|
|
@@ -9910,6 +9911,7 @@ function DataTable({
|
|
|
9910
9911
|
labels
|
|
9911
9912
|
}) {
|
|
9912
9913
|
const t = useTranslations7("Common");
|
|
9914
|
+
const [headerAlign, setHeaderAlign] = React37.useState("left");
|
|
9913
9915
|
const [visibleCols, setVisibleCols] = React37.useState(() => columns.filter((c) => c.visible !== false).map((c) => c.key));
|
|
9914
9916
|
const [filters, setFilters] = React37.useState({});
|
|
9915
9917
|
const [sort, setSort] = React37.useState(null);
|
|
@@ -9992,18 +9994,21 @@ function DataTable({
|
|
|
9992
9994
|
{
|
|
9993
9995
|
style: { width: col.width },
|
|
9994
9996
|
className: cn(
|
|
9995
|
-
|
|
9996
|
-
col.align === "
|
|
9997
|
+
// Use column-specific align if defined, otherwise use global headerAlign
|
|
9998
|
+
(col.align === "right" || !col.align && headerAlign === "right") && "text-right",
|
|
9999
|
+
(col.align === "center" || !col.align && headerAlign === "center") && "text-center",
|
|
9997
10000
|
columnDividers && colIdx > 0 && "border-l border-border/60"
|
|
9998
10001
|
),
|
|
9999
|
-
children:
|
|
10000
|
-
|
|
10002
|
+
children: (() => {
|
|
10003
|
+
const isRightAlign = col.align === "right" || !col.align && headerAlign === "right";
|
|
10004
|
+
const isCenterAlign = col.align === "center" || !col.align && headerAlign === "center";
|
|
10005
|
+
const titleContent = /* @__PURE__ */ jsxs41("div", { className: "flex items-center gap-1 min-w-0 flex-shrink", children: [
|
|
10001
10006
|
/* @__PURE__ */ jsx47("span", { className: "truncate font-medium text-sm", children: col.title }),
|
|
10002
10007
|
col.sortable && /* @__PURE__ */ jsx47(
|
|
10003
10008
|
"button",
|
|
10004
10009
|
{
|
|
10005
10010
|
className: cn(
|
|
10006
|
-
"
|
|
10011
|
+
"p-1 rounded-sm transition-all duration-200 hover:bg-accent",
|
|
10007
10012
|
sort?.key === col.key ? "opacity-100 bg-accent" : "opacity-60 hover:opacity-100"
|
|
10008
10013
|
),
|
|
10009
10014
|
onClick: () => {
|
|
@@ -10042,11 +10047,11 @@ function DataTable({
|
|
|
10042
10047
|
] })
|
|
10043
10048
|
}
|
|
10044
10049
|
)
|
|
10045
|
-
] })
|
|
10046
|
-
col.filter && /* @__PURE__ */ jsx47(
|
|
10050
|
+
] });
|
|
10051
|
+
const filterContent = col.filter && /* @__PURE__ */ jsx47(
|
|
10047
10052
|
Popover,
|
|
10048
10053
|
{
|
|
10049
|
-
placement: "bottom-start",
|
|
10054
|
+
placement: isRightAlign ? "bottom-end" : "bottom-start",
|
|
10050
10055
|
trigger: /* @__PURE__ */ jsx47(
|
|
10051
10056
|
"button",
|
|
10052
10057
|
{
|
|
@@ -10077,14 +10082,32 @@ function DataTable({
|
|
|
10077
10082
|
return newFilters;
|
|
10078
10083
|
});
|
|
10079
10084
|
},
|
|
10080
|
-
className: "text-xs text-
|
|
10085
|
+
className: "text-xs text-destructive hover:underline",
|
|
10081
10086
|
children: "Clear filter"
|
|
10082
10087
|
}
|
|
10083
10088
|
)
|
|
10084
10089
|
] })
|
|
10085
10090
|
}
|
|
10086
|
-
)
|
|
10087
|
-
|
|
10091
|
+
);
|
|
10092
|
+
return /* @__PURE__ */ jsx47(
|
|
10093
|
+
"div",
|
|
10094
|
+
{
|
|
10095
|
+
className: cn(
|
|
10096
|
+
"flex items-center gap-2 select-none min-h-[2.5rem]",
|
|
10097
|
+
isRightAlign && "justify-end",
|
|
10098
|
+
isCenterAlign && "justify-center",
|
|
10099
|
+
!isRightAlign && !isCenterAlign && "justify-between"
|
|
10100
|
+
),
|
|
10101
|
+
children: isRightAlign ? /* @__PURE__ */ jsxs41(Fragment17, { children: [
|
|
10102
|
+
filterContent,
|
|
10103
|
+
titleContent
|
|
10104
|
+
] }) : /* @__PURE__ */ jsxs41(Fragment17, { children: [
|
|
10105
|
+
titleContent,
|
|
10106
|
+
filterContent
|
|
10107
|
+
] })
|
|
10108
|
+
}
|
|
10109
|
+
);
|
|
10110
|
+
})()
|
|
10088
10111
|
},
|
|
10089
10112
|
col.key
|
|
10090
10113
|
)) });
|
|
@@ -10175,6 +10198,20 @@ function DataTable({
|
|
|
10175
10198
|
))
|
|
10176
10199
|
}
|
|
10177
10200
|
),
|
|
10201
|
+
enableHeaderAlignToggle && /* @__PURE__ */ jsx47(
|
|
10202
|
+
DropdownMenu_default,
|
|
10203
|
+
{
|
|
10204
|
+
trigger: /* @__PURE__ */ jsxs41(Button_default, { variant: "ghost", size: "sm", className: "h-8 px-2", children: [
|
|
10205
|
+
/* @__PURE__ */ jsx47("svg", { className: "w-4 h-4 mr-1", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx47("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 6h16M4 12h10M4 18h16" }) }),
|
|
10206
|
+
labels?.headerAlign || t("headerAlign")
|
|
10207
|
+
] }),
|
|
10208
|
+
items: [
|
|
10209
|
+
{ label: labels?.alignLeft || t("alignLeft"), onClick: () => setHeaderAlign("left") },
|
|
10210
|
+
{ label: labels?.alignCenter || t("alignCenter"), onClick: () => setHeaderAlign("center") },
|
|
10211
|
+
{ label: labels?.alignRight || t("alignRight"), onClick: () => setHeaderAlign("right") }
|
|
10212
|
+
]
|
|
10213
|
+
}
|
|
10214
|
+
),
|
|
10178
10215
|
toolbar
|
|
10179
10216
|
] })
|
|
10180
10217
|
] }),
|
|
@@ -12491,7 +12528,7 @@ function AccessDenied({
|
|
|
12491
12528
|
import { Moon, Sun, Monitor } from "lucide-react";
|
|
12492
12529
|
import { useEffect as useEffect20, useRef as useRef12, useState as useState32 } from "react";
|
|
12493
12530
|
import { createPortal as createPortal10 } from "react-dom";
|
|
12494
|
-
import { Fragment as
|
|
12531
|
+
import { Fragment as Fragment18, jsx as jsx52, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
12495
12532
|
function ThemeToggleHeadless({
|
|
12496
12533
|
theme,
|
|
12497
12534
|
onChange,
|
|
@@ -12542,7 +12579,7 @@ function ThemeToggleHeadless({
|
|
|
12542
12579
|
children: /* @__PURE__ */ jsx52(CurrentIcon, { className: "h-5 w-5" })
|
|
12543
12580
|
}
|
|
12544
12581
|
),
|
|
12545
|
-
isOpen && /* @__PURE__ */ jsxs46(
|
|
12582
|
+
isOpen && /* @__PURE__ */ jsxs46(Fragment18, { children: [
|
|
12546
12583
|
typeof window !== "undefined" && createPortal10(/* @__PURE__ */ jsx52("div", { className: "fixed inset-0 z-[9998]", onClick: () => setIsOpen(false) }), document.body),
|
|
12547
12584
|
typeof window !== "undefined" && dropdownPosition && createPortal10(
|
|
12548
12585
|
/* @__PURE__ */ jsx52(
|
|
@@ -12594,7 +12631,7 @@ function ThemeToggleHeadless({
|
|
|
12594
12631
|
import { useRef as useRef13, useState as useState33 } from "react";
|
|
12595
12632
|
import { createPortal as createPortal11 } from "react-dom";
|
|
12596
12633
|
import { Globe } from "lucide-react";
|
|
12597
|
-
import { Fragment as
|
|
12634
|
+
import { Fragment as Fragment19, jsx as jsx53, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
12598
12635
|
function LanguageSwitcherHeadless({
|
|
12599
12636
|
locales,
|
|
12600
12637
|
currentLocale,
|
|
@@ -12639,7 +12676,7 @@ function LanguageSwitcherHeadless({
|
|
|
12639
12676
|
children: /* @__PURE__ */ jsx53(Globe, { className: "h-5 w-5" })
|
|
12640
12677
|
}
|
|
12641
12678
|
),
|
|
12642
|
-
isOpen && /* @__PURE__ */ jsxs47(
|
|
12679
|
+
isOpen && /* @__PURE__ */ jsxs47(Fragment19, { children: [
|
|
12643
12680
|
typeof window !== "undefined" && createPortal11(/* @__PURE__ */ jsx53("div", { className: "fixed inset-0 z-[9998]", onClick: () => setIsOpen(false) }), document.body),
|
|
12644
12681
|
typeof window !== "undefined" && dropdownPosition && createPortal11(
|
|
12645
12682
|
/* @__PURE__ */ jsx53(
|