best-unit 1.2.22 → 1.2.24
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 +1093 -1093
- package/package.json +1 -1
- package/src/components/business/recharge-sdk/components/offline-transfer-form/index.tsx +1 -1
- 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/src/local/en.ts +1 -1
- package/src/local/zh.ts +1 -1
package/package.json
CHANGED
|
@@ -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);
|
package/src/local/en.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// 英文语言包
|
|
2
2
|
export const en: Record<string, string> = {
|
|
3
3
|
确定: "Confirm",
|
|
4
|
+
提交成功: "Submit Success",
|
|
4
5
|
// 余额相关
|
|
5
6
|
余额详情: "Balance Details",
|
|
6
7
|
真实金额: "Real Balance",
|
|
@@ -35,7 +36,6 @@ export const en: Record<string, string> = {
|
|
|
35
36
|
请输入转账交易ID: "Please enter transfer transaction ID",
|
|
36
37
|
上传文件: "Upload Files",
|
|
37
38
|
请上传转账凭证: "Please upload transfer voucher",
|
|
38
|
-
离线充值创建成功: "Offline recharge created successfully",
|
|
39
39
|
|
|
40
40
|
// 通用
|
|
41
41
|
"加载中...": "Loading...",
|
package/src/local/zh.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// 中文语言包
|
|
2
2
|
export const zh: Record<string, string> = {
|
|
3
3
|
确定: "确定",
|
|
4
|
+
提交成功: "提交成功",
|
|
4
5
|
// 余额相关
|
|
5
6
|
余额详情: "余额详情",
|
|
6
7
|
真实金额: "真实金额",
|
|
@@ -34,7 +35,6 @@ export const zh: Record<string, string> = {
|
|
|
34
35
|
请输入转账交易ID: "请输入转账交易ID",
|
|
35
36
|
上传文件: "上传文件",
|
|
36
37
|
请上传转账凭证: "请上传转账凭证",
|
|
37
|
-
离线充值创建成功: "离线充值创建成功",
|
|
38
38
|
|
|
39
39
|
// 通用
|
|
40
40
|
"加载中...": "加载中...",
|