best-unit 1.2.21 → 1.2.23
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/best-unit.cjs +10 -10
- package/dist/best-unit.js +1097 -1097
- package/package.json +1 -1
- package/src/components/business/recharge-sdk/components/recharge/theme.tsx +4 -4
- package/src/components/common/hover-popover/index.tsx +18 -11
- package/src/components/common/select/index.tsx +3 -1
- package/src/components/common/upload/index.tsx +3 -1
package/package.json
CHANGED
|
@@ -13,13 +13,13 @@ function createRechargeThemes() {
|
|
|
13
13
|
color: active ? "#1890ff" : "#222",
|
|
14
14
|
border: "1px solid #F0F1F3",
|
|
15
15
|
borderRadius: left ? "8px 0 0 8px" : "0 8px 8px 0",
|
|
16
|
-
fontWeight:
|
|
16
|
+
fontWeight: 500,
|
|
17
17
|
fontSize: size === Size.SMALL ? 12 : 16,
|
|
18
18
|
height: size === Size.SMALL ? 32 : 48,
|
|
19
19
|
boxShadow: active ? "0 2px 8px 0 rgba(20,20,20,0.04)" : "none",
|
|
20
20
|
outline: "none",
|
|
21
21
|
cursor: "pointer",
|
|
22
|
-
transition: "
|
|
22
|
+
// transition: "background-color 0.2s, color 0.2s, box-shadow 0.2s",
|
|
23
23
|
}),
|
|
24
24
|
},
|
|
25
25
|
dark: {
|
|
@@ -29,13 +29,13 @@ function createRechargeThemes() {
|
|
|
29
29
|
color: active ? "#00E8C6" : "#fff",
|
|
30
30
|
border: "1px solid #444C5C",
|
|
31
31
|
borderRadius: left ? "8px 0 0 8px" : "0 8px 8px 0",
|
|
32
|
-
fontWeight:
|
|
32
|
+
fontWeight: 500,
|
|
33
33
|
fontSize: size === Size.SMALL ? 12 : 16,
|
|
34
34
|
height: size === Size.SMALL ? 32 : 48,
|
|
35
35
|
boxShadow: active ? "0 2px 8px 0 rgba(20,20,20,0.10)" : "none",
|
|
36
36
|
outline: "none",
|
|
37
37
|
cursor: "pointer",
|
|
38
|
-
transition: "
|
|
38
|
+
// transition: "background-color 0.2s, color 0.2s, box-shadow 0.2s",
|
|
39
39
|
}),
|
|
40
40
|
},
|
|
41
41
|
};
|
|
@@ -3,8 +3,6 @@ import type { FunctionalComponent, JSX } from "preact";
|
|
|
3
3
|
import { getHoverPopoverTheme } from "./theme";
|
|
4
4
|
import { getInitParams } from "@/utils/business";
|
|
5
5
|
import { Size } from "@/types";
|
|
6
|
-
|
|
7
|
-
const size = getInitParams<Size>("size");
|
|
8
6
|
export type PopoverPosition = "top" | "bottom" | "leftTop" | "rightTop";
|
|
9
7
|
interface HoverPopoverProps {
|
|
10
8
|
popover: JSX.Element;
|
|
@@ -22,12 +20,21 @@ interface HoverPopoverProps {
|
|
|
22
20
|
const HoverPopover: FunctionalComponent<HoverPopoverProps> = ({
|
|
23
21
|
popover,
|
|
24
22
|
children,
|
|
25
|
-
popoverWidth
|
|
26
|
-
popoverMinWidth
|
|
27
|
-
offsetY
|
|
28
|
-
offsetX
|
|
23
|
+
popoverWidth,
|
|
24
|
+
popoverMinWidth,
|
|
25
|
+
offsetY,
|
|
26
|
+
offsetX,
|
|
29
27
|
popoverPosition = "top",
|
|
30
28
|
}) => {
|
|
29
|
+
// 动态获取size配置,确保响应配置变化
|
|
30
|
+
const size = getInitParams<Size>("size");
|
|
31
|
+
|
|
32
|
+
// 动态计算默认值
|
|
33
|
+
const defaultPopoverWidth = popoverWidth ?? (size === Size.SMALL ? 200 : 300);
|
|
34
|
+
const defaultPopoverMinWidth =
|
|
35
|
+
popoverMinWidth ?? (size === Size.SMALL ? 150 : 200);
|
|
36
|
+
const defaultOffsetY = offsetY ?? (size === Size.SMALL ? 8 : 16);
|
|
37
|
+
const defaultOffsetX = offsetX ?? (size === Size.SMALL ? 8 : 16);
|
|
31
38
|
const [show, setShow] = useState(false);
|
|
32
39
|
const [position, setPosition] = useState<
|
|
33
40
|
"top" | "bottom" | "leftTop" | "rightTop"
|
|
@@ -76,8 +83,8 @@ const HoverPopover: FunctionalComponent<HoverPopoverProps> = ({
|
|
|
76
83
|
zIndex: 999,
|
|
77
84
|
borderRadius: 6,
|
|
78
85
|
fontSize: size === Size.SMALL ? 12 : 15,
|
|
79
|
-
minWidth:
|
|
80
|
-
width:
|
|
86
|
+
minWidth: defaultPopoverMinWidth,
|
|
87
|
+
width: defaultPopoverWidth,
|
|
81
88
|
padding: size === Size.SMALL ? "6px 12px" : "8px 14px",
|
|
82
89
|
pointerEvents: "auto",
|
|
83
90
|
textAlign: "center",
|
|
@@ -111,7 +118,7 @@ const HoverPopover: FunctionalComponent<HoverPopoverProps> = ({
|
|
|
111
118
|
...popoverStyle,
|
|
112
119
|
left: "50%",
|
|
113
120
|
top: "100%",
|
|
114
|
-
marginTop:
|
|
121
|
+
marginTop: defaultOffsetY,
|
|
115
122
|
transform: "translateX(-50%)",
|
|
116
123
|
};
|
|
117
124
|
arrowStyle = {
|
|
@@ -128,7 +135,7 @@ const HoverPopover: FunctionalComponent<HoverPopoverProps> = ({
|
|
|
128
135
|
...popoverStyle,
|
|
129
136
|
right: "100%",
|
|
130
137
|
top: 0,
|
|
131
|
-
marginRight:
|
|
138
|
+
marginRight: defaultOffsetX,
|
|
132
139
|
transform: "none",
|
|
133
140
|
};
|
|
134
141
|
arrowStyle = {
|
|
@@ -144,7 +151,7 @@ const HoverPopover: FunctionalComponent<HoverPopoverProps> = ({
|
|
|
144
151
|
...popoverStyle,
|
|
145
152
|
left: "100%",
|
|
146
153
|
top: 0,
|
|
147
|
-
marginLeft:
|
|
154
|
+
marginLeft: defaultOffsetX,
|
|
148
155
|
transform: "translateY(0)", // 右上角对齐
|
|
149
156
|
};
|
|
150
157
|
arrowStyle = {
|
|
@@ -4,7 +4,6 @@ import { t } from "@/local";
|
|
|
4
4
|
import { getSelectTheme } from "./theme";
|
|
5
5
|
import { getInitParams } from "@/utils/business";
|
|
6
6
|
import { Size } from "@/types";
|
|
7
|
-
const size = getInitParams<Size>("size");
|
|
8
7
|
interface Option {
|
|
9
8
|
value: string;
|
|
10
9
|
label: string;
|
|
@@ -43,6 +42,9 @@ export const Select: FunctionalComponent<SelectProps> = ({
|
|
|
43
42
|
const [hoveredIndex, setHoveredIndex] = useState<number | null>(null);
|
|
44
43
|
const theme = getSelectTheme();
|
|
45
44
|
|
|
45
|
+
// 动态获取size配置,确保响应配置变化
|
|
46
|
+
const size = getInitParams<Size>("size");
|
|
47
|
+
|
|
46
48
|
useEffect(() => {
|
|
47
49
|
if (!open) return;
|
|
48
50
|
const handleClick = (e: MouseEvent) => {
|
|
@@ -5,7 +5,7 @@ import { t } from "@/local";
|
|
|
5
5
|
import { getUploadTheme } from "./theme";
|
|
6
6
|
import { getInitParams } from "@/utils/business";
|
|
7
7
|
import { Size } from "@/types";
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
interface UploadProps {
|
|
10
10
|
value?: string[];
|
|
11
11
|
onChange?: (urls: string[]) => void;
|
|
@@ -23,6 +23,8 @@ export const Upload: FunctionalComponent<UploadProps> = ({
|
|
|
23
23
|
multiple = true,
|
|
24
24
|
disabled = false,
|
|
25
25
|
}) => {
|
|
26
|
+
const size = getInitParams<Size>("size");
|
|
27
|
+
|
|
26
28
|
const fileInputRef = useRef<HTMLInputElement>(null);
|
|
27
29
|
const [uploading, setUploading] = useState(false);
|
|
28
30
|
const [progress, setProgress] = useState(0);
|