@meta-1/design 0.0.204 → 0.0.206
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
|
@@ -358,21 +358,21 @@ export function DataGrid<TData>(props: DataGridProps<TData>) {
|
|
|
358
358
|
sortable: false,
|
|
359
359
|
filter: false,
|
|
360
360
|
headerName: "",
|
|
361
|
-
cellClass: cn("
|
|
361
|
+
cellClass: cn("px-0", actionsCellClassName),
|
|
362
362
|
cellRenderer: (params: any) => {
|
|
363
363
|
let items = rowActions;
|
|
364
364
|
if (isFunction(rowActions)) {
|
|
365
365
|
items = rowActions(params.data);
|
|
366
366
|
}
|
|
367
367
|
return (
|
|
368
|
-
<div className="flex w-full justify-center
|
|
368
|
+
<div className="flex w-full justify-center" onClick={(e) => e.stopPropagation()}>
|
|
369
369
|
<Dropdown
|
|
370
370
|
align="end"
|
|
371
371
|
asChild={true}
|
|
372
372
|
items={items as DropdownMenuItemProps[]}
|
|
373
373
|
onItemClick={(item) => onRowActionClick?.(item, params.data)}
|
|
374
374
|
>
|
|
375
|
-
<Action className="
|
|
375
|
+
<Action className="size-6 p-0">
|
|
376
376
|
<DotsHorizontalIcon />
|
|
377
377
|
</Action>
|
|
378
378
|
</Dropdown>
|
|
@@ -1,6 +1,35 @@
|
|
|
1
1
|
@import "../../../assets/style/theme.css";
|
|
2
2
|
|
|
3
3
|
/* 自定义样式已移除,后续按需添加 */
|
|
4
|
-
.
|
|
5
|
-
|
|
4
|
+
.ag-cell,
|
|
5
|
+
.ag-full-width-row .ag-cell-wrapper.ag-row-group {
|
|
6
|
+
--ag-internal-content-line-height: 24px;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/* 隐藏最后一列后面的分割线 */
|
|
10
|
+
:where(.ag-ltr) .ag-header-cell:last-child:after,
|
|
11
|
+
:where(.ag-ltr)
|
|
12
|
+
.ag-header-group-cell:last-child:where(:not(.ag-header-span-height.ag-header-group-cell-no-group)):after {
|
|
13
|
+
visibility: hidden;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/* 设置 cell 的 padding */
|
|
17
|
+
:where(.ag-ltr) .ag-cell:not(.ag-cell-inline-editing),
|
|
18
|
+
:where(.ag-ltr) .ag-full-width-row .ag-cell-wrapper.ag-row-group {
|
|
19
|
+
padding-left: calc(
|
|
20
|
+
var(--ag-cell-horizontal-padding) -
|
|
21
|
+
1px +
|
|
22
|
+
var(--ag-row-group-indent-size) *
|
|
23
|
+
var(--ag-indentation-level)
|
|
24
|
+
);
|
|
25
|
+
padding-right: calc(var(--ag-cell-horizontal-padding) - 1px);
|
|
26
|
+
padding-top: 4px;
|
|
27
|
+
padding-bottom: 4px;
|
|
28
|
+
font-size: 14px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* 允许 actions 列溢出 */
|
|
32
|
+
.ag-cell[col-id="actions"] .ag-cell-value:not(.ag-allow-overflow),
|
|
33
|
+
.ag-cell[col-id="actions"] .ag-group-value {
|
|
34
|
+
overflow: visible;
|
|
6
35
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { CSSProperties, FC, PropsWithChildren, ReactNode } from "react";
|
|
2
2
|
|
|
3
|
-
import { HoverCard, HoverCardContent, HoverCardTrigger } from "@meta-1/design/components/ui/hover-card";
|
|
4
3
|
import { PopoverContent, PopoverTrigger, Popover as UIPopover } from "@meta-1/design/components/ui/popover";
|
|
5
4
|
import { cn } from "@meta-1/design/lib";
|
|
6
5
|
|
|
@@ -14,47 +13,10 @@ export type PopoverProps = PropsWithChildren<{
|
|
|
14
13
|
align?: "start" | "center" | "end";
|
|
15
14
|
side?: "top" | "right" | "bottom" | "left";
|
|
16
15
|
disabled?: boolean;
|
|
17
|
-
trigger?: "click" | "hover";
|
|
18
16
|
}>;
|
|
19
17
|
|
|
20
18
|
export const Popover: FC<PopoverProps> = (props) => {
|
|
21
|
-
const {
|
|
22
|
-
children,
|
|
23
|
-
content,
|
|
24
|
-
className,
|
|
25
|
-
asChild,
|
|
26
|
-
open,
|
|
27
|
-
onOpenChange,
|
|
28
|
-
style,
|
|
29
|
-
align,
|
|
30
|
-
side,
|
|
31
|
-
disabled,
|
|
32
|
-
trigger = "click",
|
|
33
|
-
} = props;
|
|
34
|
-
|
|
35
|
-
if (trigger === "hover") {
|
|
36
|
-
const handleOpenChange = (newOpen: boolean) => {
|
|
37
|
-
if (disabled && newOpen) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
onOpenChange?.(newOpen);
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
<HoverCard onOpenChange={handleOpenChange} open={disabled ? false : open}>
|
|
45
|
-
<HoverCardTrigger asChild={asChild}>{children}</HoverCardTrigger>
|
|
46
|
-
<HoverCardContent
|
|
47
|
-
align={align}
|
|
48
|
-
className={cn("rounded-popover p-popover", className)}
|
|
49
|
-
side={side}
|
|
50
|
-
style={style}
|
|
51
|
-
>
|
|
52
|
-
{content}
|
|
53
|
-
</HoverCardContent>
|
|
54
|
-
</HoverCard>
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
|
|
19
|
+
const { children, content, className, asChild, open, onOpenChange, style, align, side, disabled } = props;
|
|
58
20
|
return (
|
|
59
21
|
<UIPopover onOpenChange={onOpenChange} open={open}>
|
|
60
22
|
<PopoverTrigger asChild={asChild} disabled={disabled}>
|