best-unit 1.2.14 → 1.2.16

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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "best-unit",
3
3
  "private": false,
4
- "version": "1.2.14",
4
+ "version": "1.2.16",
5
5
  "type": "module",
6
6
  "main": "dist/best-unit.cjs",
7
7
  "module": "dist/best-unit.js",
@@ -1,214 +1,221 @@
1
1
  import { Size, Theme, type ThemeConfig } from "@/types";
2
2
  import { getInitParams } from "@/utils/business";
3
- const size = getInitParams<Size>("size");
4
3
 
5
- export const offlineTransferFormThemes = {
6
- white: {
7
- label: {
8
- marginBottom: size === Size.SMALL ? 6 : 8,
9
- fontSize: size === Size.SMALL ? 12 : 14,
10
- color: "#222",
11
- textAlign: "left",
12
- display: "block",
13
- },
14
- input: {
15
- width: "100%",
16
- padding: size === Size.SMALL ? "8px 10px" : "10px 12px",
17
- borderRadius: 6,
18
- boxSizing: "border-box",
19
- border: "1px solid #E5E6EB",
20
- background: "#fff",
21
- color: "#222",
22
- fontSize: size === Size.SMALL ? 12 : 15,
23
- outline: "none",
24
- marginBottom: 0,
25
- },
26
- inputError: {
27
- border: "1px solid #ff4d4f",
28
- },
29
- select: {
30
- width: "100%",
31
- padding: size === Size.SMALL ? "8px 10px" : "10px 12px",
32
- borderRadius: 6,
33
- border: "1px solid #E5E6EB",
34
- background: "#fff",
35
- color: "#222",
36
- fontSize: size === Size.SMALL ? 12 : 15,
37
- outline: "none",
38
- },
39
- selectError: {
40
- border: "1px solid #ff4d4f",
41
- },
42
- upload: {
43
- border: "1px dashed #E5E6EB",
44
- borderRadius: 8,
45
- background: "#FCFCFD",
46
- padding: size === Size.SMALL ? 12 : 24,
47
- textAlign: "center",
48
- cursor: "pointer",
49
- minHeight: size === Size.SMALL ? 80 : 120,
50
- display: "flex",
51
- flexDirection: "column",
52
- alignItems: "center",
53
- justifyContent: "center",
54
- color: "#999",
55
- fontSize: size === Size.SMALL ? 12 : 15,
56
- },
57
- uploadError: {
58
- border: "1px dashed #ff4d4f",
59
- },
60
- fileItem: {
61
- display: "flex",
62
- alignItems: "center",
63
- background: "#F7F8FA",
64
- borderRadius: 8,
65
- padding: size === Size.SMALL ? "8px 10px" : "12px 16px",
66
- marginBottom: size === Size.SMALL ? 6 : 8,
67
- fontSize: size === Size.SMALL ? 12 : 15,
68
- color: "#222",
69
- justifyContent: "space-between",
70
- },
71
- buttonCancel: {
72
- background: "#fff",
73
- color: "#222",
74
- border: "1px solid #E5E6EB",
75
- borderRadius: 6,
76
- padding: size === Size.SMALL ? "6px 18px" : "8px 24px",
77
- cursor: "pointer",
78
- },
79
- buttonSubmit: {
80
- background: "#1890ff",
81
- color: "#fff",
82
- border: "none",
83
- borderRadius: 6,
84
- padding: size === Size.SMALL ? "6px 18px" : "8px 24px",
85
- cursor: "pointer",
86
- fontWeight: 600,
87
- },
88
- removeBtn: {
89
- background: "#FF4D4F",
90
- color: "#fff",
91
- border: "none",
92
- borderRadius: 6,
93
- padding: size === Size.SMALL ? "6px 18px" : "4px 14px",
94
- fontSize: size === Size.SMALL ? 12 : 15,
95
- marginLeft: size === Size.SMALL ? 8 : 16,
96
- cursor: "pointer",
97
- },
98
- error: {
99
- color: "#ff4d4f",
100
- fontSize: size === Size.SMALL ? 12 : 13,
101
- marginTop: size === Size.SMALL ? 2 : 4,
102
- textAlign: "left",
103
- },
104
- },
105
- dark: {
106
- label: {
107
- marginBottom: size === Size.SMALL ? 4 : 8,
108
- fontSize: size === Size.SMALL ? 12 : 14,
109
- color: "#fff",
110
- textAlign: "left",
111
- display: "block",
112
- },
113
- input: {
114
- width: "100%",
115
- padding: size === Size.SMALL ? "8px 10px" : "10px 12px",
116
- borderRadius: 6,
117
- boxSizing: "border-box",
118
- border: "1px solid #374151",
119
- background: "#23262F",
120
- color: "#fff",
121
- fontSize: size === Size.SMALL ? 12 : 15,
122
- outline: "none",
123
- marginBottom: 0,
124
- },
125
- inputError: {
126
- border: "1px solid #ff4d4f",
127
- },
128
- select: {
129
- width: "100%",
130
- padding: size === Size.SMALL ? "8px 10px" : "10px 12px",
131
- borderRadius: 6,
132
- border: "1px solid #374151",
133
- background: "#23262F",
134
- color: "#fff",
135
- fontSize: size === Size.SMALL ? 12 : 15,
136
- outline: "none",
137
- },
138
- selectError: {
139
- border: "1px solid #ff4d4f",
140
- },
141
- upload: {
142
- border: "1px dashed #374151",
143
- borderRadius: 8,
144
- background: "#181A20",
145
- padding: size === Size.SMALL ? 12 : 24,
146
- textAlign: "center",
147
- cursor: "pointer",
148
- minHeight: size === Size.SMALL ? 80 : 120,
149
- display: "flex",
150
- flexDirection: "column",
151
- alignItems: "center",
152
- justifyContent: "center",
153
- color: "#999",
154
- fontSize: size === Size.SMALL ? 12 : 14,
155
- },
156
- uploadError: {
157
- border: "1px dashed #ff4d4f",
158
- },
159
- fileItem: {
160
- display: "flex",
161
- alignItems: "center",
162
- background: "#23262F",
163
- borderRadius: 8,
164
- padding: size === Size.SMALL ? "8px 10px" : "12px 16px",
165
- marginBottom: size === Size.SMALL ? 6 : 8,
166
- fontSize: size === Size.SMALL ? 12 : 15,
167
- color: "#fff",
168
- justifyContent: "space-between",
169
- },
170
- buttonCancel: {
171
- background: "#23262F",
172
- color: "#fff",
173
- border: "none",
174
- borderRadius: 6,
175
- padding: size === Size.SMALL ? "6px 18px" : "8px 24px",
176
- fontSize: size === Size.SMALL ? 12 : 15,
177
- cursor: "pointer",
178
- },
179
- buttonSubmit: {
180
- background: "#00E8C6",
181
- color: "#fff",
182
- border: "none",
183
- borderRadius: 6,
184
- padding: size === Size.SMALL ? "6px 18px" : "8px 24px",
185
- fontSize: size === Size.SMALL ? 12 : 14,
186
- cursor: "pointer",
187
- fontWeight: 600,
188
- },
189
- removeBtn: {
190
- background: "#FF4D4F",
191
- color: "#fff",
192
- border: "none",
193
- borderRadius: 6,
194
- padding: size === Size.SMALL ? "6px 18px" : "4px 14px",
195
- fontSize: size === Size.SMALL ? 12 : 15,
196
- marginLeft: size === Size.SMALL ? 8 : 16,
197
- cursor: "pointer",
198
- },
199
- error: {
200
- color: "#ff4d4f",
201
- fontSize: size === Size.SMALL ? 12 : 13,
202
- marginTop: size === Size.SMALL ? 2 : 4,
203
- textAlign: "left",
204
- },
205
- },
206
- };
4
+ // 动态生成主题配置的函数
5
+ function createOfflineTransferFormThemes() {
6
+ const size = getInitParams<Size>("size"); // 每次调用时重新获取最新值
7
+
8
+ return {
9
+ white: {
10
+ label: {
11
+ marginBottom: size === Size.SMALL ? 6 : 8,
12
+ fontSize: size === Size.SMALL ? 12 : 14,
13
+ color: "#222",
14
+ textAlign: "left",
15
+ display: "block",
16
+ },
17
+ input: {
18
+ width: "100%",
19
+ padding: size === Size.SMALL ? "8px 10px" : "10px 12px",
20
+ borderRadius: 6,
21
+ boxSizing: "border-box",
22
+ border: "1px solid #E5E6EB",
23
+ background: "#fff",
24
+ color: "#222",
25
+ fontSize: size === Size.SMALL ? 12 : 15,
26
+ outline: "none",
27
+ marginBottom: 0,
28
+ },
29
+ inputError: {
30
+ border: "1px solid #ff4d4f",
31
+ },
32
+ select: {
33
+ width: "100%",
34
+ padding: size === Size.SMALL ? "8px 10px" : "10px 12px",
35
+ borderRadius: 6,
36
+ border: "1px solid #E5E6EB",
37
+ background: "#fff",
38
+ color: "#222",
39
+ fontSize: size === Size.SMALL ? 12 : 15,
40
+ outline: "none",
41
+ },
42
+ selectError: {
43
+ border: "1px solid #ff4d4f",
44
+ },
45
+ upload: {
46
+ border: "1px dashed #E5E6EB",
47
+ borderRadius: 8,
48
+ background: "#FCFCFD",
49
+ padding: size === Size.SMALL ? 12 : 24,
50
+ textAlign: "center",
51
+ cursor: "pointer",
52
+ minHeight: size === Size.SMALL ? 80 : 120,
53
+ display: "flex",
54
+ flexDirection: "column",
55
+ alignItems: "center",
56
+ justifyContent: "center",
57
+ color: "#999",
58
+ fontSize: size === Size.SMALL ? 12 : 15,
59
+ },
60
+ uploadError: {
61
+ border: "1px dashed #ff4d4f",
62
+ },
63
+ fileItem: {
64
+ display: "flex",
65
+ alignItems: "center",
66
+ background: "#F7F8FA",
67
+ borderRadius: 8,
68
+ padding: size === Size.SMALL ? "8px 10px" : "12px 16px",
69
+ marginBottom: size === Size.SMALL ? 6 : 8,
70
+ fontSize: size === Size.SMALL ? 12 : 15,
71
+ color: "#222",
72
+ justifyContent: "space-between",
73
+ },
74
+ buttonCancel: {
75
+ background: "#fff",
76
+ color: "#222",
77
+ border: "1px solid #E5E6EB",
78
+ borderRadius: 6,
79
+ padding: size === Size.SMALL ? "6px 18px" : "8px 24px",
80
+ cursor: "pointer",
81
+ },
82
+ buttonSubmit: {
83
+ background: "#1890ff",
84
+ color: "#fff",
85
+ border: "none",
86
+ borderRadius: 6,
87
+ padding: size === Size.SMALL ? "6px 18px" : "8px 24px",
88
+ cursor: "pointer",
89
+ fontWeight: 600,
90
+ },
91
+ removeBtn: {
92
+ background: "#FF4D4F",
93
+ color: "#fff",
94
+ border: "none",
95
+ borderRadius: 6,
96
+ padding: size === Size.SMALL ? "6px 18px" : "4px 14px",
97
+ fontSize: size === Size.SMALL ? 12 : 15,
98
+ marginLeft: size === Size.SMALL ? 8 : 16,
99
+ cursor: "pointer",
100
+ },
101
+ error: {
102
+ color: "#ff4d4f",
103
+ fontSize: size === Size.SMALL ? 12 : 13,
104
+ marginTop: size === Size.SMALL ? 2 : 4,
105
+ textAlign: "left",
106
+ },
107
+ },
108
+ dark: {
109
+ label: {
110
+ marginBottom: size === Size.SMALL ? 4 : 8,
111
+ fontSize: size === Size.SMALL ? 12 : 14,
112
+ color: "#fff",
113
+ textAlign: "left",
114
+ display: "block",
115
+ },
116
+ input: {
117
+ width: "100%",
118
+ padding: size === Size.SMALL ? "8px 10px" : "10px 12px",
119
+ borderRadius: 6,
120
+ boxSizing: "border-box",
121
+ border: "1px solid #374151",
122
+ background: "#23262F",
123
+ color: "#fff",
124
+ fontSize: size === Size.SMALL ? 12 : 15,
125
+ outline: "none",
126
+ marginBottom: 0,
127
+ },
128
+ inputError: {
129
+ border: "1px solid #ff4d4f",
130
+ },
131
+ select: {
132
+ width: "100%",
133
+ padding: size === Size.SMALL ? "8px 10px" : "10px 12px",
134
+ borderRadius: 6,
135
+ border: "1px solid #374151",
136
+ background: "#23262F",
137
+ color: "#fff",
138
+ fontSize: size === Size.SMALL ? 12 : 15,
139
+ outline: "none",
140
+ },
141
+ selectError: {
142
+ border: "1px solid #ff4d4f",
143
+ },
144
+ upload: {
145
+ border: "1px dashed #374151",
146
+ borderRadius: 8,
147
+ background: "#181A20",
148
+ padding: size === Size.SMALL ? 12 : 24,
149
+ textAlign: "center",
150
+ cursor: "pointer",
151
+ minHeight: size === Size.SMALL ? 80 : 120,
152
+ display: "flex",
153
+ flexDirection: "column",
154
+ alignItems: "center",
155
+ justifyContent: "center",
156
+ color: "#999",
157
+ fontSize: size === Size.SMALL ? 12 : 14,
158
+ },
159
+ uploadError: {
160
+ border: "1px dashed #ff4d4f",
161
+ },
162
+ fileItem: {
163
+ display: "flex",
164
+ alignItems: "center",
165
+ background: "#23262F",
166
+ borderRadius: 8,
167
+ padding: size === Size.SMALL ? "8px 10px" : "12px 16px",
168
+ marginBottom: size === Size.SMALL ? 6 : 8,
169
+ fontSize: size === Size.SMALL ? 12 : 15,
170
+ color: "#fff",
171
+ justifyContent: "space-between",
172
+ },
173
+ buttonCancel: {
174
+ background: "#23262F",
175
+ color: "#fff",
176
+ border: "none",
177
+ borderRadius: 6,
178
+ padding: size === Size.SMALL ? "6px 18px" : "8px 24px",
179
+ fontSize: size === Size.SMALL ? 12 : 15,
180
+ cursor: "pointer",
181
+ },
182
+ buttonSubmit: {
183
+ background: "#00E8C6",
184
+ color: "#fff",
185
+ border: "none",
186
+ borderRadius: 6,
187
+ padding: size === Size.SMALL ? "6px 18px" : "8px 24px",
188
+ fontSize: size === Size.SMALL ? 12 : 14,
189
+ cursor: "pointer",
190
+ fontWeight: 600,
191
+ },
192
+ removeBtn: {
193
+ background: "#FF4D4F",
194
+ color: "#fff",
195
+ border: "none",
196
+ borderRadius: 6,
197
+ padding: size === Size.SMALL ? "6px 18px" : "4px 14px",
198
+ fontSize: size === Size.SMALL ? 12 : 15,
199
+ marginLeft: size === Size.SMALL ? 8 : 16,
200
+ cursor: "pointer",
201
+ },
202
+ error: {
203
+ color: "#ff4d4f",
204
+ fontSize: size === Size.SMALL ? 12 : 13,
205
+ marginTop: size === Size.SMALL ? 2 : 4,
206
+ textAlign: "left",
207
+ },
208
+ },
209
+ };
210
+ }
207
211
 
208
212
  export function getOfflineTransferFormTheme() {
209
213
  const theme = getInitParams<Theme>("theme");
210
214
  const themeConfig = getInitParams<ThemeConfig>("themeConfig");
211
215
  const whiteTheme = theme === Theme.WHITE;
216
+
217
+ // 每次调用时重新生成主题配置
218
+ const offlineTransferFormThemes = createOfflineTransferFormThemes();
212
219
  const baseTheme = whiteTheme
213
220
  ? offlineTransferFormThemes.white
214
221
  : offlineTransferFormThemes.dark;