best-unit 2.1.9 → 2.1.11
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
|
@@ -20,6 +20,25 @@ function getBizTypeLabel(bizType: string) {
|
|
|
20
20
|
return bizType;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
function getBizTypePlaceholder(bizType: string) {
|
|
24
|
+
const prefix = t("请输入");
|
|
25
|
+
const label = getBizTypeLabel(bizType);
|
|
26
|
+
return /[A-Za-z]$/.test(prefix) ? `${prefix} ${label}` : `${prefix}${label}`;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function formatPercentageInput(value: string) {
|
|
30
|
+
let nextValue = value.replace(/[^\d.]/g, "");
|
|
31
|
+
nextValue = nextValue.replace(/\.(?=.*\.)/g, "");
|
|
32
|
+
nextValue = nextValue.replace(/^(\d+)(\.\d{0,2})?.*$/, "$1$2");
|
|
33
|
+
nextValue = nextValue.replace(/^0+(\d)/, "$1");
|
|
34
|
+
|
|
35
|
+
if (nextValue.startsWith(".")) {
|
|
36
|
+
nextValue = `0${nextValue}`;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return nextValue;
|
|
40
|
+
}
|
|
41
|
+
|
|
23
42
|
export function useFundAllocation() {
|
|
24
43
|
const [subBusinesses, setSubBusinesses] = useState<MerchantBalanceItem[]>([]);
|
|
25
44
|
const [useFundAllocation, setUseFundAllocation] = useState(false);
|
|
@@ -200,16 +219,16 @@ export function FundAllocationSection({
|
|
|
200
219
|
{" (%)"}
|
|
201
220
|
</label>
|
|
202
221
|
<input
|
|
203
|
-
type="
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
step="0.01"
|
|
207
|
-
placeholder="0"
|
|
222
|
+
type="text"
|
|
223
|
+
inputMode="decimal"
|
|
224
|
+
placeholder={getBizTypePlaceholder(item.bizType)}
|
|
208
225
|
value={subBizPercentages[item.bizType] || ""}
|
|
209
226
|
onChange={(e) => {
|
|
210
227
|
onPercentageChange(
|
|
211
228
|
item.bizType,
|
|
212
|
-
(
|
|
229
|
+
formatPercentageInput(
|
|
230
|
+
(e.target as HTMLInputElement).value,
|
|
231
|
+
),
|
|
213
232
|
);
|
|
214
233
|
}}
|
|
215
234
|
style={{
|
package/src/local/en.ts
CHANGED