@meta-1/design 0.0.171 → 0.0.172
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/package.json
CHANGED
|
@@ -52,7 +52,7 @@ function DialogContent({
|
|
|
52
52
|
<DialogOverlay onClick={onOverlayClick} />
|
|
53
53
|
<DialogPrimitive.Content
|
|
54
54
|
className={cn(
|
|
55
|
-
"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 flex flex-col w-full max-w-[calc(100vw-2rem)] max-h-[calc(100vh-2rem)] translate-x-[-50%] translate-y-[-50%] rounded-lg border bg-background shadow-lg duration-200 data-[state=closed]:animate-out data-[state=open]:animate-in sm:max-w-lg",
|
|
55
|
+
"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 flex flex-col gap-4 w-full max-w-[calc(100vw-2rem)] max-h-[calc(100vh-2rem)] translate-x-[-50%] translate-y-[-50%] rounded-lg border bg-background shadow-lg duration-200 data-[state=closed]:animate-out data-[state=open]:animate-in sm:max-w-lg",
|
|
56
56
|
className,
|
|
57
57
|
)}
|
|
58
58
|
data-slot="dialog-content"
|
|
@@ -5,7 +5,7 @@ import { cn } from "@meta-1/design/lib/utils";
|
|
|
5
5
|
|
|
6
6
|
function ScrollArea({ className, children, ...props }: React.ComponentProps<typeof ScrollAreaPrimitive.Root>) {
|
|
7
7
|
return (
|
|
8
|
-
<ScrollAreaPrimitive.Root className={cn("relative", className)} data-slot="scroll-area" {...props}>
|
|
8
|
+
<ScrollAreaPrimitive.Root className={cn("relative overflow-hidden", className)} data-slot="scroll-area" {...props}>
|
|
9
9
|
<ScrollAreaPrimitive.Viewport
|
|
10
10
|
className="size-full rounded-[inherit] outline-none transition-[color,box-shadow] focus-visible:outline-1 focus-visible:ring-[3px] focus-visible:ring-ring/50"
|
|
11
11
|
data-slot="scroll-area-viewport"
|
|
@@ -28,7 +28,6 @@ import {
|
|
|
28
28
|
type PaginationProps,
|
|
29
29
|
Spin,
|
|
30
30
|
} from "@meta-1/design";
|
|
31
|
-
import { ScrollArea } from "@meta-1/design/components/ui/scroll-area";
|
|
32
31
|
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "../../ui/table";
|
|
33
32
|
import "./style.css";
|
|
34
33
|
|
|
@@ -368,10 +367,9 @@ export function DataTable<TData>(props: DataTableProps<TData>) {
|
|
|
368
367
|
}, [pagination, autoHidePagination]);
|
|
369
368
|
|
|
370
369
|
// 渲染表头的通用函数
|
|
371
|
-
const renderTableHeader = (
|
|
372
|
-
const { fixedHeader = false } = options;
|
|
370
|
+
const renderTableHeader = () => {
|
|
373
371
|
return (
|
|
374
|
-
<TableHeader className={cn(!showHeader && "hidden"
|
|
372
|
+
<TableHeader className={cn(!showHeader && "hidden")}>
|
|
375
373
|
{table.getHeaderGroups().map((headerGroup) => (
|
|
376
374
|
<TableRow key={headerGroup.id}>
|
|
377
375
|
{headerGroup.headers.map((header) => {
|
|
@@ -394,7 +392,7 @@ export function DataTable<TData>(props: DataTableProps<TData>) {
|
|
|
394
392
|
style={
|
|
395
393
|
sticky.enable
|
|
396
394
|
? {
|
|
397
|
-
zIndex:
|
|
395
|
+
zIndex: 10,
|
|
398
396
|
minWidth: sticky.width,
|
|
399
397
|
[sticky.position as string]: sticky.offset,
|
|
400
398
|
}
|
|
@@ -491,14 +489,23 @@ export function DataTable<TData>(props: DataTableProps<TData>) {
|
|
|
491
489
|
) : null}
|
|
492
490
|
<div className={cn("relative")}>
|
|
493
491
|
{maxHeight ? (
|
|
494
|
-
//
|
|
495
|
-
<div className={cn("
|
|
496
|
-
<
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
<
|
|
501
|
-
|
|
492
|
+
// 有高度限制时:直接渲染 table 元素,避免 Table 组件自带的 overflow-x-auto 包裹层
|
|
493
|
+
<div className={cn("overflow-x-auto", !mounted && "invisible")}>
|
|
494
|
+
<div
|
|
495
|
+
className="overflow-y-auto"
|
|
496
|
+
style={{ maxHeight: typeof maxHeight === "number" ? `${maxHeight}px` : maxHeight }}
|
|
497
|
+
>
|
|
498
|
+
<table
|
|
499
|
+
className={classNames(
|
|
500
|
+
"data-table data-table-sticky-header w-full caption-bottom text-sm",
|
|
501
|
+
inCard ? "in-card" : null,
|
|
502
|
+
)}
|
|
503
|
+
data-slot="table"
|
|
504
|
+
>
|
|
505
|
+
{renderTableHeader()}
|
|
506
|
+
{renderTableBody()}
|
|
507
|
+
</table>
|
|
508
|
+
</div>
|
|
502
509
|
</div>
|
|
503
510
|
) : (
|
|
504
511
|
// 无高度限制时,使用原有布局
|
|
@@ -38,3 +38,39 @@
|
|
|
38
38
|
.data-table tr[data-state="selected"] td.table-sticky-col .inner {
|
|
39
39
|
@apply bg-[hsl(var(--muted))];
|
|
40
40
|
}
|
|
41
|
+
|
|
42
|
+
.data-table-sticky-header thead {
|
|
43
|
+
position: sticky;
|
|
44
|
+
top: 0;
|
|
45
|
+
z-index: 20;
|
|
46
|
+
@apply bg-background;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.data-table-sticky-header.in-card thead {
|
|
50
|
+
@apply bg-card;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.data-table-sticky-header thead th {
|
|
54
|
+
@apply bg-background;
|
|
55
|
+
z-index: 20;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.data-table-sticky-header.in-card thead th {
|
|
59
|
+
@apply bg-card;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.data-table-sticky-header thead th.table-sticky-col {
|
|
63
|
+
z-index: 30;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.data-table-sticky-header thead th.table-sticky-col.sticky {
|
|
67
|
+
position: sticky !important;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.data-table-sticky-header thead th.table-sticky-col .inner {
|
|
71
|
+
@apply bg-background;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.data-table-sticky-header.in-card thead th.table-sticky-col .inner {
|
|
75
|
+
@apply bg-card;
|
|
76
|
+
}
|
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
DialogTitle,
|
|
10
10
|
Dialog as UIDialog,
|
|
11
11
|
} from "@meta-1/design/components/ui/dialog";
|
|
12
|
-
import { ScrollArea } from "@meta-1/design/components/ui/scroll-area";
|
|
13
12
|
import { Spin } from "@meta-1/design/components/uix/spin";
|
|
14
13
|
import { cn } from "@meta-1/design/lib";
|
|
15
14
|
|
|
@@ -56,7 +55,7 @@ export const Dialog: FC<DialogProps> = (props) => {
|
|
|
56
55
|
<DialogTitle className={cn(!title && "sr-only")}>{title || "Dialog"}</DialogTitle>
|
|
57
56
|
{description ? <DialogDescription>{description}</DialogDescription> : null}
|
|
58
57
|
</DialogHeader>
|
|
59
|
-
<
|
|
58
|
+
<div className="min-h-0 flex-1 overflow-auto px-6">{props.children}</div>
|
|
60
59
|
{footer ? <DialogFooter>{footer}</DialogFooter> : null}
|
|
61
60
|
{loading ? (
|
|
62
61
|
<div className={cn("absolute top-0 right-0 bottom-0 left-0 bg-white/50", "flex items-center justify-center")}>
|