@rockshin/tao-ui 0.0.45 → 0.0.46
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/README.md +3 -1
- package/component-manifest.json +32 -3
- package/dist/components/alert/alert.js +20 -17
- package/dist/components/avatar/avatar.js +2 -1
- package/dist/components/breadcrumb/breadcrumb.js +81 -77
- package/dist/components/calendar/calendar.d.ts +0 -1
- package/dist/components/calendar/calendar.js +41 -30
- package/dist/components/color-picker/color-picker.js +273 -269
- package/dist/components/date-picker/calendar/calendar-grid.js +10 -4
- package/dist/components/date-picker/calendar/use-calendar.d.ts +2 -2
- package/dist/components/date-picker/calendar/use-calendar.js +2 -3
- package/dist/components/date-picker/date-localization.d.ts +3 -0
- package/dist/components/date-picker/date-localization.js +76 -0
- package/dist/components/date-picker/date-picker.js +35 -27
- package/dist/components/date-picker/range-picker.js +28 -20
- package/dist/components/dropdown/dropdown.js +21 -20
- package/dist/components/float-button/float-button.js +3 -2
- package/dist/components/form/form.js +88 -103
- package/dist/components/image/image.js +202 -137
- package/dist/components/list/list-pagination.js +148 -147
- package/dist/components/modal/confirm-dialog.js +4 -2
- package/dist/components/modal/modal.js +385 -383
- package/dist/components/pagination/pagination.js +115 -110
- package/dist/components/popconfirm/popconfirm.js +109 -107
- package/dist/components/qr-code/qr-code.js +22 -21
- package/dist/components/scroll-area/scroll-area.js +41 -38
- package/dist/components/select/mobile-select.d.ts +1 -1
- package/dist/components/select/mobile-select.js +2 -1
- package/dist/components/sonner/sonner.js +10 -10
- package/dist/components/spinner/spinner.js +1 -1
- package/dist/components/splitter/splitter.js +24 -21
- package/dist/components/statistic/statistic.d.ts +2 -0
- package/dist/components/statistic/statistic.js +203 -187
- package/dist/components/table/table-filter.js +61 -52
- package/dist/components/table/table-icons.js +3 -1
- package/dist/components/table/table.d.ts +1 -1
- package/dist/components/table/table.js +5 -4
- package/dist/components/tag/tag.js +22 -19
- package/dist/components/time-picker/time-picker.d.ts +0 -1
- package/dist/components/time-picker/time-picker.js +139 -96
- package/dist/components/transfer/transfer-list.js +224 -488
- package/dist/components/transfer/transfer-parts.js +2 -2
- package/dist/components/transfer/transfer-types.d.ts +1 -0
- package/dist/components/transfer/transfer.js +13 -16
- package/dist/components/upload/upload.js +30 -26
- package/dist/docs/component-docs.d.ts +13 -2
- package/dist/docs/components/headless-input-number.doc.d.ts +5 -0
- package/dist/docs/components/headless-input-number.doc.js +7 -0
- package/dist/docs/components/input-number.doc.d.ts +5 -0
- package/dist/docs/components/input-number.doc.js +7 -0
- package/dist/docs/components/statistic.doc.d.ts +5 -0
- package/dist/docs/components/statistic.doc.js +7 -0
- package/dist/docs/components/tao-provider.doc.d.ts +8 -2
- package/dist/docs/components/tao-provider.doc.js +10 -2
- package/dist/docs/components/tooltip.doc.d.ts +2 -2
- package/dist/entries/provider.d.ts +1 -0
- package/dist/entries/provider.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/locales/ar-EG.d.ts +3 -0
- package/dist/locales/ar-EG.js +199 -0
- package/dist/locales/create-locale.d.ts +41 -0
- package/dist/locales/create-locale.js +88 -0
- package/dist/locales/de-DE.d.ts +3 -0
- package/dist/locales/de-DE.js +195 -0
- package/dist/locales/en-US.d.ts +2 -0
- package/dist/locales/en-US.js +194 -0
- package/dist/locales/es-ES.d.ts +3 -0
- package/dist/locales/es-ES.js +195 -0
- package/dist/locales/fr-FR.d.ts +3 -0
- package/dist/locales/fr-FR.js +195 -0
- package/dist/locales/hi-IN.d.ts +3 -0
- package/dist/locales/hi-IN.js +194 -0
- package/dist/locales/id-ID.d.ts +3 -0
- package/dist/locales/id-ID.js +194 -0
- package/dist/locales/index.d.ts +18 -0
- package/dist/locales/index.js +17 -0
- package/dist/locales/it-IT.d.ts +3 -0
- package/dist/locales/it-IT.js +195 -0
- package/dist/locales/ja-JP.d.ts +3 -0
- package/dist/locales/ja-JP.js +194 -0
- package/dist/locales/ko-KR.d.ts +3 -0
- package/dist/locales/ko-KR.js +194 -0
- package/dist/locales/pt-BR.d.ts +3 -0
- package/dist/locales/pt-BR.js +195 -0
- package/dist/locales/ru-RU.d.ts +3 -0
- package/dist/locales/ru-RU.js +197 -0
- package/dist/locales/th-TH.d.ts +3 -0
- package/dist/locales/th-TH.js +194 -0
- package/dist/locales/tr-TR.d.ts +3 -0
- package/dist/locales/tr-TR.js +194 -0
- package/dist/locales/types.d.ts +176 -0
- package/dist/locales/types.js +0 -0
- package/dist/locales/vi-VN.d.ts +3 -0
- package/dist/locales/vi-VN.js +194 -0
- package/dist/locales/zh-CN.d.ts +3 -0
- package/dist/locales/zh-CN.js +194 -0
- package/dist/locales/zh-TW.d.ts +3 -0
- package/dist/locales/zh-TW.js +194 -0
- package/dist/number-input/format.d.ts +4 -3
- package/dist/number-input/format.js +9 -7
- package/dist/number-input/locale.d.ts +19 -0
- package/dist/number-input/locale.js +44 -0
- package/dist/number-input/number-input.js +1 -0
- package/dist/number-input/use-number-input.d.ts +2 -0
- package/dist/number-input/use-number-input.js +180 -176
- package/dist/provider/locale.d.ts +3 -65
- package/dist/provider/locale.js +2 -146
- package/dist/provider/merge-locale.d.ts +8 -0
- package/dist/provider/merge-locale.js +53 -0
- package/dist/provider/tao-provider.d.ts +6 -2
- package/dist/provider/tao-provider.js +2 -4
- package/llms.txt +1 -1
- package/package.json +5 -1
|
@@ -1,76 +1,80 @@
|
|
|
1
1
|
import { c } from "react-compiler-runtime";
|
|
2
2
|
import { useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
3
|
+
import { useTaoConfig } from "../provider/tao-provider.js";
|
|
3
4
|
import { countAnchored, findCursorAt, isThousandSepBeforeCursor, reposition } from "./cursor.js";
|
|
4
5
|
import { format, padOnBlur, parse, truncateDecimals } from "./format.js";
|
|
6
|
+
import { resolveNumberFormat } from "./locale.js";
|
|
5
7
|
import { fromPercent, toPercent } from "./percentage.js";
|
|
6
8
|
import { clampToRange, isValidCanonical, stripDisallowedSign } from "./validate.js";
|
|
7
9
|
function useNumberInput(opts) {
|
|
8
|
-
const $ = c(
|
|
9
|
-
const { value, defaultValue, onChange, onBlur,
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
let
|
|
17
|
-
if ($[0] !== decimalSeparator || $[1] !==
|
|
18
|
-
|
|
10
|
+
const $ = c(85);
|
|
11
|
+
const { value, defaultValue, onChange, onBlur, locale: localeProp, decimalSeparator, thousandsSeparator: thousandsSeparatorProp, decimalPlaces: t0, padDecimalsOnBlur: t1, isPercentage: t2, allowNegative: t3, min, max } = opts;
|
|
12
|
+
const decimalPlaces = void 0 === t0 ? 2 : t0;
|
|
13
|
+
const padMode = void 0 === t1 ? "never" : t1;
|
|
14
|
+
const isPercentage = void 0 === t2 ? false : t2;
|
|
15
|
+
const allowNegative = void 0 === t3 ? false : t3;
|
|
16
|
+
const config = useTaoConfig();
|
|
17
|
+
const locale = localeProp ?? config.locale.numberLocale;
|
|
18
|
+
let t4;
|
|
19
|
+
if ($[0] !== decimalSeparator || $[1] !== locale || $[2] !== thousandsSeparatorProp) {
|
|
20
|
+
t4 = resolveNumberFormat(locale, {
|
|
19
21
|
decimalSeparator,
|
|
20
|
-
thousandsSeparator
|
|
21
|
-
};
|
|
22
|
+
thousandsSeparator: thousandsSeparatorProp
|
|
23
|
+
});
|
|
22
24
|
$[0] = decimalSeparator;
|
|
23
|
-
$[1] =
|
|
24
|
-
$[2] =
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
$[1] = locale;
|
|
26
|
+
$[2] = thousandsSeparatorProp;
|
|
27
|
+
$[3] = t4;
|
|
28
|
+
} else t4 = $[3];
|
|
29
|
+
const fmtOpts = t4;
|
|
30
|
+
const thousandsSeparator = fmtOpts.thousandsSeparator;
|
|
31
|
+
let t5;
|
|
32
|
+
if ($[4] !== fmtOpts || $[5] !== isPercentage) {
|
|
33
|
+
t5 = (actual)=>{
|
|
30
34
|
const canonical = isPercentage ? toPercent(actual) : actual;
|
|
31
35
|
return format(canonical, fmtOpts);
|
|
32
36
|
};
|
|
33
|
-
$[
|
|
34
|
-
$[
|
|
35
|
-
$[
|
|
36
|
-
} else
|
|
37
|
-
const canonicalToDisplay =
|
|
37
|
+
$[4] = fmtOpts;
|
|
38
|
+
$[5] = isPercentage;
|
|
39
|
+
$[6] = t5;
|
|
40
|
+
} else t5 = $[6];
|
|
41
|
+
const canonicalToDisplay = t5;
|
|
38
42
|
const isValueControlled = "value" in opts;
|
|
39
|
-
let
|
|
40
|
-
if ($[
|
|
41
|
-
|
|
43
|
+
let t6;
|
|
44
|
+
if ($[7] !== canonicalToDisplay || $[8] !== defaultValue || $[9] !== fmtOpts || $[10] !== isPercentage || $[11] !== isValueControlled || $[12] !== value) {
|
|
45
|
+
t6 = ()=>({
|
|
42
46
|
display: canonicalToDisplay(isValueControlled ? value ?? "" : defaultValue ?? ""),
|
|
43
47
|
format: fmtOpts,
|
|
44
48
|
isPercentage
|
|
45
49
|
});
|
|
46
|
-
$[
|
|
47
|
-
$[
|
|
48
|
-
$[
|
|
49
|
-
$[
|
|
50
|
-
$[
|
|
51
|
-
$[
|
|
52
|
-
$[
|
|
53
|
-
} else
|
|
54
|
-
const [buffer, setBuffer] = useState(
|
|
50
|
+
$[7] = canonicalToDisplay;
|
|
51
|
+
$[8] = defaultValue;
|
|
52
|
+
$[9] = fmtOpts;
|
|
53
|
+
$[10] = isPercentage;
|
|
54
|
+
$[11] = isValueControlled;
|
|
55
|
+
$[12] = value;
|
|
56
|
+
$[13] = t6;
|
|
57
|
+
} else t6 = $[13];
|
|
58
|
+
const [buffer, setBuffer] = useState(t6);
|
|
55
59
|
const displayBuffer = buffer.display;
|
|
56
|
-
let
|
|
57
|
-
if ($[
|
|
58
|
-
|
|
60
|
+
let t7;
|
|
61
|
+
if ($[14] !== fmtOpts || $[15] !== isPercentage) {
|
|
62
|
+
t7 = (display)=>setBuffer({
|
|
59
63
|
display,
|
|
60
64
|
format: fmtOpts,
|
|
61
65
|
isPercentage
|
|
62
66
|
});
|
|
63
|
-
$[
|
|
64
|
-
$[
|
|
65
|
-
$[
|
|
66
|
-
} else
|
|
67
|
-
const setDisplayBuffer =
|
|
67
|
+
$[14] = fmtOpts;
|
|
68
|
+
$[15] = isPercentage;
|
|
69
|
+
$[16] = t7;
|
|
70
|
+
} else t7 = $[16];
|
|
71
|
+
const setDisplayBuffer = t7;
|
|
68
72
|
const isFocusedRef = useRef(false);
|
|
69
73
|
const inputRef = useRef(null);
|
|
70
74
|
const pendingCursorRef = useRef(null);
|
|
71
|
-
let
|
|
72
|
-
if ($[
|
|
73
|
-
|
|
75
|
+
let t8;
|
|
76
|
+
if ($[17] !== buffer.display || $[18] !== buffer.format || $[19] !== buffer.isPercentage || $[20] !== fmtOpts || $[21] !== isPercentage || $[22] !== isValueControlled || $[23] !== thousandsSeparator || $[24] !== value) {
|
|
77
|
+
t8 = ()=>{
|
|
74
78
|
if (buffer.format === fmtOpts && buffer.isPercentage === isPercentage) return;
|
|
75
79
|
const previousCanonical = parse(buffer.display, buffer.format);
|
|
76
80
|
const useExternalValue = isValueControlled && !isFocusedRef.current;
|
|
@@ -95,19 +99,19 @@ function useNumberInput(opts) {
|
|
|
95
99
|
isPercentage
|
|
96
100
|
});
|
|
97
101
|
};
|
|
98
|
-
$[
|
|
99
|
-
$[
|
|
100
|
-
$[
|
|
101
|
-
$[
|
|
102
|
-
$[
|
|
103
|
-
$[
|
|
104
|
-
$[
|
|
105
|
-
$[
|
|
106
|
-
$[
|
|
107
|
-
} else
|
|
108
|
-
let
|
|
109
|
-
if ($[
|
|
110
|
-
|
|
102
|
+
$[17] = buffer.display;
|
|
103
|
+
$[18] = buffer.format;
|
|
104
|
+
$[19] = buffer.isPercentage;
|
|
105
|
+
$[20] = fmtOpts;
|
|
106
|
+
$[21] = isPercentage;
|
|
107
|
+
$[22] = isValueControlled;
|
|
108
|
+
$[23] = thousandsSeparator;
|
|
109
|
+
$[24] = value;
|
|
110
|
+
$[25] = t8;
|
|
111
|
+
} else t8 = $[25];
|
|
112
|
+
let t9;
|
|
113
|
+
if ($[26] !== buffer || $[27] !== fmtOpts || $[28] !== isPercentage || $[29] !== isValueControlled || $[30] !== thousandsSeparator || $[31] !== value) {
|
|
114
|
+
t9 = [
|
|
111
115
|
buffer,
|
|
112
116
|
fmtOpts,
|
|
113
117
|
isPercentage,
|
|
@@ -115,64 +119,64 @@ function useNumberInput(opts) {
|
|
|
115
119
|
value,
|
|
116
120
|
thousandsSeparator
|
|
117
121
|
];
|
|
118
|
-
$[
|
|
119
|
-
$[
|
|
120
|
-
$[
|
|
121
|
-
$[
|
|
122
|
-
$[
|
|
123
|
-
$[
|
|
124
|
-
$[
|
|
125
|
-
} else
|
|
126
|
-
useLayoutEffect(
|
|
127
|
-
let
|
|
128
|
-
if ($[
|
|
129
|
-
|
|
122
|
+
$[26] = buffer;
|
|
123
|
+
$[27] = fmtOpts;
|
|
124
|
+
$[28] = isPercentage;
|
|
125
|
+
$[29] = isValueControlled;
|
|
126
|
+
$[30] = thousandsSeparator;
|
|
127
|
+
$[31] = value;
|
|
128
|
+
$[32] = t9;
|
|
129
|
+
} else t9 = $[32];
|
|
130
|
+
useLayoutEffect(t8, t9);
|
|
131
|
+
let t10;
|
|
132
|
+
if ($[33] !== canonicalToDisplay || $[34] !== displayBuffer || $[35] !== isValueControlled || $[36] !== setDisplayBuffer || $[37] !== value) {
|
|
133
|
+
t10 = ()=>{
|
|
130
134
|
if (!isValueControlled) return;
|
|
131
135
|
if (isFocusedRef.current) return;
|
|
132
136
|
const display_1 = canonicalToDisplay(value ?? "");
|
|
133
137
|
if (displayBuffer !== display_1) setDisplayBuffer(display_1);
|
|
134
138
|
};
|
|
135
|
-
$[
|
|
136
|
-
$[
|
|
137
|
-
$[
|
|
138
|
-
$[
|
|
139
|
-
$[
|
|
140
|
-
$[
|
|
141
|
-
} else
|
|
142
|
-
let
|
|
143
|
-
if ($[
|
|
144
|
-
|
|
139
|
+
$[33] = canonicalToDisplay;
|
|
140
|
+
$[34] = displayBuffer;
|
|
141
|
+
$[35] = isValueControlled;
|
|
142
|
+
$[36] = setDisplayBuffer;
|
|
143
|
+
$[37] = value;
|
|
144
|
+
$[38] = t10;
|
|
145
|
+
} else t10 = $[38];
|
|
146
|
+
let t11;
|
|
147
|
+
if ($[39] !== isValueControlled || $[40] !== value) {
|
|
148
|
+
t11 = [
|
|
145
149
|
value,
|
|
146
150
|
isValueControlled
|
|
147
151
|
];
|
|
148
|
-
$[
|
|
149
|
-
$[
|
|
150
|
-
$[
|
|
151
|
-
} else
|
|
152
|
-
useEffect(
|
|
153
|
-
let
|
|
154
|
-
let
|
|
155
|
-
if ($[
|
|
156
|
-
|
|
152
|
+
$[39] = isValueControlled;
|
|
153
|
+
$[40] = value;
|
|
154
|
+
$[41] = t11;
|
|
155
|
+
} else t11 = $[41];
|
|
156
|
+
useEffect(t10, t11);
|
|
157
|
+
let t12;
|
|
158
|
+
let t13;
|
|
159
|
+
if ($[42] !== displayBuffer) {
|
|
160
|
+
t12 = ()=>{
|
|
157
161
|
const pending = pendingCursorRef.current;
|
|
158
162
|
if (pending?.display !== displayBuffer) return;
|
|
159
163
|
inputRef.current?.setSelectionRange(pending.start, pending.end);
|
|
160
164
|
pendingCursorRef.current = null;
|
|
161
165
|
};
|
|
162
|
-
|
|
166
|
+
t13 = [
|
|
163
167
|
displayBuffer
|
|
164
168
|
];
|
|
165
|
-
$[
|
|
166
|
-
$[
|
|
167
|
-
$[
|
|
169
|
+
$[42] = displayBuffer;
|
|
170
|
+
$[43] = t12;
|
|
171
|
+
$[44] = t13;
|
|
168
172
|
} else {
|
|
169
|
-
|
|
170
|
-
|
|
173
|
+
t12 = $[43];
|
|
174
|
+
t13 = $[44];
|
|
171
175
|
}
|
|
172
|
-
useLayoutEffect(
|
|
173
|
-
let
|
|
174
|
-
if ($[
|
|
175
|
-
|
|
176
|
+
useLayoutEffect(t12, t13);
|
|
177
|
+
let t14;
|
|
178
|
+
if ($[45] !== allowNegative || $[46] !== decimalPlaces || $[47] !== fmtOpts || $[48] !== isPercentage || $[49] !== onChange || $[50] !== setDisplayBuffer || $[51] !== thousandsSeparator) {
|
|
179
|
+
t14 = (e)=>{
|
|
176
180
|
const raw = e.target.value;
|
|
177
181
|
const cursor = e.target.selectionStart ?? raw.length;
|
|
178
182
|
let canonical_1 = parse(raw, fmtOpts);
|
|
@@ -195,19 +199,19 @@ function useNumberInput(opts) {
|
|
|
195
199
|
const actual_1 = isPercentage ? fromPercent(canonical_1) : canonical_1;
|
|
196
200
|
onChange?.(actual_1);
|
|
197
201
|
};
|
|
198
|
-
$[
|
|
199
|
-
$[
|
|
200
|
-
$[
|
|
201
|
-
$[
|
|
202
|
-
$[
|
|
203
|
-
$[
|
|
204
|
-
$[
|
|
205
|
-
$[
|
|
206
|
-
} else
|
|
207
|
-
const handleChange =
|
|
208
|
-
let
|
|
209
|
-
if ($[
|
|
210
|
-
|
|
202
|
+
$[45] = allowNegative;
|
|
203
|
+
$[46] = decimalPlaces;
|
|
204
|
+
$[47] = fmtOpts;
|
|
205
|
+
$[48] = isPercentage;
|
|
206
|
+
$[49] = onChange;
|
|
207
|
+
$[50] = setDisplayBuffer;
|
|
208
|
+
$[51] = thousandsSeparator;
|
|
209
|
+
$[52] = t14;
|
|
210
|
+
} else t14 = $[52];
|
|
211
|
+
const handleChange = t14;
|
|
212
|
+
let t15;
|
|
213
|
+
if ($[53] !== canonicalToDisplay || $[54] !== decimalPlaces || $[55] !== displayBuffer || $[56] !== fmtOpts || $[57] !== isPercentage || $[58] !== isValueControlled || $[59] !== max || $[60] !== min || $[61] !== onBlur || $[62] !== onChange || $[63] !== padMode || $[64] !== setDisplayBuffer || $[65] !== value) {
|
|
214
|
+
t15 = ()=>{
|
|
211
215
|
isFocusedRef.current = false;
|
|
212
216
|
const raw_0 = isValueControlled ? canonicalToDisplay(value ?? "") : inputRef.current?.value ?? displayBuffer;
|
|
213
217
|
let canonical_2 = parse(raw_0, fmtOpts);
|
|
@@ -220,85 +224,85 @@ function useNumberInput(opts) {
|
|
|
220
224
|
onChange?.(actual_2);
|
|
221
225
|
onBlur?.(actual_2);
|
|
222
226
|
};
|
|
223
|
-
$[
|
|
224
|
-
$[
|
|
225
|
-
$[
|
|
226
|
-
$[
|
|
227
|
-
$[
|
|
228
|
-
$[
|
|
229
|
-
$[
|
|
230
|
-
$[
|
|
231
|
-
$[
|
|
232
|
-
$[
|
|
233
|
-
$[
|
|
234
|
-
$[
|
|
235
|
-
$[
|
|
236
|
-
$[
|
|
237
|
-
} else
|
|
238
|
-
const handleBlur =
|
|
239
|
-
let
|
|
240
|
-
if ($[
|
|
241
|
-
|
|
227
|
+
$[53] = canonicalToDisplay;
|
|
228
|
+
$[54] = decimalPlaces;
|
|
229
|
+
$[55] = displayBuffer;
|
|
230
|
+
$[56] = fmtOpts;
|
|
231
|
+
$[57] = isPercentage;
|
|
232
|
+
$[58] = isValueControlled;
|
|
233
|
+
$[59] = max;
|
|
234
|
+
$[60] = min;
|
|
235
|
+
$[61] = onBlur;
|
|
236
|
+
$[62] = onChange;
|
|
237
|
+
$[63] = padMode;
|
|
238
|
+
$[64] = setDisplayBuffer;
|
|
239
|
+
$[65] = value;
|
|
240
|
+
$[66] = t15;
|
|
241
|
+
} else t15 = $[66];
|
|
242
|
+
const handleBlur = t15;
|
|
243
|
+
let t16;
|
|
244
|
+
if ($[67] === Symbol.for("react.memo_cache_sentinel")) {
|
|
245
|
+
t16 = ()=>{
|
|
242
246
|
isFocusedRef.current = true;
|
|
243
247
|
};
|
|
244
|
-
$[
|
|
245
|
-
} else
|
|
246
|
-
const handleFocus =
|
|
247
|
-
let
|
|
248
|
-
if ($[
|
|
249
|
-
|
|
248
|
+
$[67] = t16;
|
|
249
|
+
} else t16 = $[67];
|
|
250
|
+
const handleFocus = t16;
|
|
251
|
+
let t17;
|
|
252
|
+
if ($[68] !== displayBuffer || $[69] !== thousandsSeparator) {
|
|
253
|
+
t17 = (e_0)=>{
|
|
250
254
|
if ("Backspace" !== e_0.key) return;
|
|
251
255
|
const el = inputRef.current;
|
|
252
256
|
if (!el) return;
|
|
253
257
|
const cursor_0 = el.selectionStart ?? 0;
|
|
254
258
|
if (cursor_0 > 0 && isThousandSepBeforeCursor(displayBuffer, cursor_0, thousandsSeparator)) el.setSelectionRange(cursor_0 - 1, cursor_0 - 1);
|
|
255
259
|
};
|
|
256
|
-
$[
|
|
257
|
-
$[
|
|
258
|
-
$[
|
|
259
|
-
} else
|
|
260
|
-
const handleKeyDown =
|
|
261
|
-
let
|
|
262
|
-
if ($[
|
|
260
|
+
$[68] = displayBuffer;
|
|
261
|
+
$[69] = thousandsSeparator;
|
|
262
|
+
$[70] = t17;
|
|
263
|
+
} else t17 = $[70];
|
|
264
|
+
const handleKeyDown = t17;
|
|
265
|
+
let t18;
|
|
266
|
+
if ($[71] !== buffer.display || $[72] !== buffer.format || $[73] !== buffer.isPercentage) {
|
|
263
267
|
const canonical_3 = parse(buffer.display, buffer.format);
|
|
264
|
-
|
|
265
|
-
$[
|
|
266
|
-
$[
|
|
267
|
-
$[
|
|
268
|
-
$[
|
|
269
|
-
} else
|
|
270
|
-
const derivedActual =
|
|
271
|
-
const
|
|
272
|
-
let
|
|
273
|
-
if ($[
|
|
274
|
-
|
|
268
|
+
t18 = buffer.isPercentage ? fromPercent(canonical_3) : canonical_3;
|
|
269
|
+
$[71] = buffer.display;
|
|
270
|
+
$[72] = buffer.format;
|
|
271
|
+
$[73] = buffer.isPercentage;
|
|
272
|
+
$[74] = t18;
|
|
273
|
+
} else t18 = $[74];
|
|
274
|
+
const derivedActual = t18;
|
|
275
|
+
const t19 = decimalPlaces > 0 ? "decimal" : "numeric";
|
|
276
|
+
let t20;
|
|
277
|
+
if ($[75] !== displayBuffer || $[76] !== handleBlur || $[77] !== handleChange || $[78] !== handleKeyDown || $[79] !== t19) {
|
|
278
|
+
t20 = {
|
|
275
279
|
value: displayBuffer,
|
|
276
280
|
onChange: handleChange,
|
|
277
281
|
onBlur: handleBlur,
|
|
278
282
|
onFocus: handleFocus,
|
|
279
283
|
onKeyDown: handleKeyDown,
|
|
280
284
|
ref: inputRef,
|
|
281
|
-
inputMode:
|
|
285
|
+
inputMode: t19
|
|
282
286
|
};
|
|
283
|
-
$[
|
|
284
|
-
$[
|
|
285
|
-
$[
|
|
286
|
-
$[
|
|
287
|
-
$[
|
|
288
|
-
$[
|
|
289
|
-
} else
|
|
290
|
-
let
|
|
291
|
-
if ($[
|
|
292
|
-
|
|
293
|
-
inputProps:
|
|
287
|
+
$[75] = displayBuffer;
|
|
288
|
+
$[76] = handleBlur;
|
|
289
|
+
$[77] = handleChange;
|
|
290
|
+
$[78] = handleKeyDown;
|
|
291
|
+
$[79] = t19;
|
|
292
|
+
$[80] = t20;
|
|
293
|
+
} else t20 = $[80];
|
|
294
|
+
let t21;
|
|
295
|
+
if ($[81] !== derivedActual || $[82] !== displayBuffer || $[83] !== t20) {
|
|
296
|
+
t21 = {
|
|
297
|
+
inputProps: t20,
|
|
294
298
|
value: derivedActual,
|
|
295
299
|
displayValue: displayBuffer
|
|
296
300
|
};
|
|
297
|
-
$[
|
|
298
|
-
$[
|
|
299
|
-
$[
|
|
300
|
-
$[
|
|
301
|
-
} else
|
|
302
|
-
return
|
|
301
|
+
$[81] = derivedActual;
|
|
302
|
+
$[82] = displayBuffer;
|
|
303
|
+
$[83] = t20;
|
|
304
|
+
$[84] = t21;
|
|
305
|
+
} else t21 = $[84];
|
|
306
|
+
return t21;
|
|
303
307
|
}
|
|
304
308
|
export { useNumberInput };
|
|
@@ -1,65 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
searchPlaceholder: string;
|
|
5
|
-
search?: string;
|
|
6
|
-
showPassword?: string;
|
|
7
|
-
hidePassword?: string;
|
|
8
|
-
otpLabel?: (index: number, length: number) => string;
|
|
9
|
-
searchOptions: string;
|
|
10
|
-
noResults: string;
|
|
11
|
-
/** Empty-state text. Omitted custom locales use the built-in English text. */
|
|
12
|
-
emptyDescription?: string;
|
|
13
|
-
/** BCP 47 / picker locale identifier; omitted custom locales use en_US. */
|
|
14
|
-
locale?: string;
|
|
15
|
-
done: string;
|
|
16
|
-
clear: string;
|
|
17
|
-
close: string;
|
|
18
|
-
remove: (label: string) => string;
|
|
19
|
-
dateTime: string;
|
|
20
|
-
/** Date-only picker title. Omitted custom locales use the built-in English text. */
|
|
21
|
-
selectDate?: string;
|
|
22
|
-
selectTime?: string;
|
|
23
|
-
startTime?: string;
|
|
24
|
-
endTime?: string;
|
|
25
|
-
qrCode?: {
|
|
26
|
-
expired: string;
|
|
27
|
-
refresh: string;
|
|
28
|
-
scanned: string;
|
|
29
|
-
};
|
|
30
|
-
dateRange: string;
|
|
31
|
-
startDate: string;
|
|
32
|
-
endDate: string;
|
|
33
|
-
now: string;
|
|
34
|
-
ok: string;
|
|
35
|
-
/** Cancel text. Omitted custom locales use the built-in English text. */
|
|
36
|
-
cancel?: string;
|
|
37
|
-
previous: string;
|
|
38
|
-
next: string;
|
|
39
|
-
previousMonth: string;
|
|
40
|
-
nextMonth: string;
|
|
41
|
-
previousYear: string;
|
|
42
|
-
nextYear: string;
|
|
43
|
-
hour: string;
|
|
44
|
-
minute: string;
|
|
45
|
-
second: string;
|
|
46
|
-
weekdays: readonly [string, string, string, string, string, string, string];
|
|
47
|
-
months: readonly [
|
|
48
|
-
string,
|
|
49
|
-
string,
|
|
50
|
-
string,
|
|
51
|
-
string,
|
|
52
|
-
string,
|
|
53
|
-
string,
|
|
54
|
-
string,
|
|
55
|
-
string,
|
|
56
|
-
string,
|
|
57
|
-
string,
|
|
58
|
-
string,
|
|
59
|
-
string
|
|
60
|
-
];
|
|
61
|
-
monthTitle: (month: number, year: number) => string;
|
|
62
|
-
calendarTitle: (month: number, year: number) => string;
|
|
63
|
-
}
|
|
64
|
-
export declare const enUS: TaoLocale;
|
|
65
|
-
export declare const zhCN: TaoLocale;
|
|
1
|
+
export type { BuiltinTaoLocale, TaoLocale, TaoMessages, } from '../locales/types.js';
|
|
2
|
+
export { enUS } from '../locales/en-US.js';
|
|
3
|
+
export { zhCN } from '../locales/zh-CN.js';
|
package/dist/provider/locale.js
CHANGED
|
@@ -1,146 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
select: 'Select',
|
|
4
|
-
searchPlaceholder: 'Search...',
|
|
5
|
-
search: 'Search',
|
|
6
|
-
showPassword: 'Show password',
|
|
7
|
-
hidePassword: 'Hide password',
|
|
8
|
-
otpLabel: (index, length)=>`Character ${index} of ${length}`,
|
|
9
|
-
searchOptions: 'Search options',
|
|
10
|
-
noResults: 'No results',
|
|
11
|
-
emptyDescription: 'No data',
|
|
12
|
-
done: 'Done',
|
|
13
|
-
clear: 'Clear',
|
|
14
|
-
close: 'Close',
|
|
15
|
-
remove: (label)=>`Remove ${label}`,
|
|
16
|
-
dateTime: 'Date & Time',
|
|
17
|
-
selectDate: 'Select date',
|
|
18
|
-
selectTime: 'Select time',
|
|
19
|
-
startTime: 'Start time',
|
|
20
|
-
endTime: 'End time',
|
|
21
|
-
qrCode: {
|
|
22
|
-
expired: 'QR code expired',
|
|
23
|
-
refresh: 'Refresh',
|
|
24
|
-
scanned: 'Scanned'
|
|
25
|
-
},
|
|
26
|
-
dateRange: 'Select date range',
|
|
27
|
-
startDate: 'Start date',
|
|
28
|
-
endDate: 'End date',
|
|
29
|
-
now: 'Now',
|
|
30
|
-
ok: 'OK',
|
|
31
|
-
cancel: 'Cancel',
|
|
32
|
-
previous: 'Previous',
|
|
33
|
-
next: 'Next',
|
|
34
|
-
previousMonth: 'Previous month',
|
|
35
|
-
nextMonth: 'Next month',
|
|
36
|
-
previousYear: 'Previous year',
|
|
37
|
-
nextYear: 'Next year',
|
|
38
|
-
hour: 'Hour',
|
|
39
|
-
minute: 'Minute',
|
|
40
|
-
second: 'Second',
|
|
41
|
-
weekdays: [
|
|
42
|
-
'Mo',
|
|
43
|
-
'Tu',
|
|
44
|
-
'We',
|
|
45
|
-
'Th',
|
|
46
|
-
'Fr',
|
|
47
|
-
'Sa',
|
|
48
|
-
'Su'
|
|
49
|
-
],
|
|
50
|
-
months: [
|
|
51
|
-
'Jan',
|
|
52
|
-
'Feb',
|
|
53
|
-
'Mar',
|
|
54
|
-
'Apr',
|
|
55
|
-
'May',
|
|
56
|
-
'Jun',
|
|
57
|
-
'Jul',
|
|
58
|
-
'Aug',
|
|
59
|
-
'Sep',
|
|
60
|
-
'Oct',
|
|
61
|
-
'Nov',
|
|
62
|
-
'Dec'
|
|
63
|
-
],
|
|
64
|
-
monthTitle: (month, year)=>`${enUS.months[month]} ${year}`,
|
|
65
|
-
calendarTitle: (month, year)=>`${[
|
|
66
|
-
'January',
|
|
67
|
-
'February',
|
|
68
|
-
'March',
|
|
69
|
-
'April',
|
|
70
|
-
'May',
|
|
71
|
-
'June',
|
|
72
|
-
'July',
|
|
73
|
-
'August',
|
|
74
|
-
'September',
|
|
75
|
-
'October',
|
|
76
|
-
'November',
|
|
77
|
-
'December'
|
|
78
|
-
][month]} ${year}`
|
|
79
|
-
};
|
|
80
|
-
const zhCN = {
|
|
81
|
-
locale: 'zh_CN',
|
|
82
|
-
select: '选择',
|
|
83
|
-
searchPlaceholder: '搜索…',
|
|
84
|
-
search: '搜索',
|
|
85
|
-
showPassword: '显示密码',
|
|
86
|
-
hidePassword: '隐藏密码',
|
|
87
|
-
otpLabel: (index, length)=>`第 ${index} 位,共 ${length} 位`,
|
|
88
|
-
searchOptions: '搜索选项',
|
|
89
|
-
noResults: '暂无结果',
|
|
90
|
-
emptyDescription: '暂无数据',
|
|
91
|
-
done: '完成',
|
|
92
|
-
clear: '清除',
|
|
93
|
-
close: '关闭',
|
|
94
|
-
remove: (label)=>`移除${label}`,
|
|
95
|
-
dateTime: '选择日期和时间',
|
|
96
|
-
selectDate: '选择日期',
|
|
97
|
-
selectTime: '选择时间',
|
|
98
|
-
startTime: '开始时间',
|
|
99
|
-
endTime: '结束时间',
|
|
100
|
-
qrCode: {
|
|
101
|
-
expired: '二维码已过期',
|
|
102
|
-
refresh: '刷新',
|
|
103
|
-
scanned: '已扫描'
|
|
104
|
-
},
|
|
105
|
-
dateRange: '选择日期范围',
|
|
106
|
-
startDate: '开始日期',
|
|
107
|
-
endDate: '结束日期',
|
|
108
|
-
now: '此刻',
|
|
109
|
-
ok: '确定',
|
|
110
|
-
cancel: '取消',
|
|
111
|
-
previous: '上一页',
|
|
112
|
-
next: '下一页',
|
|
113
|
-
previousMonth: '上个月',
|
|
114
|
-
nextMonth: '下个月',
|
|
115
|
-
previousYear: '上一年',
|
|
116
|
-
nextYear: '下一年',
|
|
117
|
-
hour: '时',
|
|
118
|
-
minute: '分',
|
|
119
|
-
second: '秒',
|
|
120
|
-
weekdays: [
|
|
121
|
-
'一',
|
|
122
|
-
'二',
|
|
123
|
-
'三',
|
|
124
|
-
'四',
|
|
125
|
-
'五',
|
|
126
|
-
'六',
|
|
127
|
-
'日'
|
|
128
|
-
],
|
|
129
|
-
months: [
|
|
130
|
-
'1月',
|
|
131
|
-
'2月',
|
|
132
|
-
'3月',
|
|
133
|
-
'4月',
|
|
134
|
-
'5月',
|
|
135
|
-
'6月',
|
|
136
|
-
'7月',
|
|
137
|
-
'8月',
|
|
138
|
-
'9月',
|
|
139
|
-
'10月',
|
|
140
|
-
'11月',
|
|
141
|
-
'12月'
|
|
142
|
-
],
|
|
143
|
-
monthTitle: (month, year)=>`${year}年${month + 1}月`,
|
|
144
|
-
calendarTitle: (month, year)=>`${year}年${month + 1}月`
|
|
145
|
-
};
|
|
146
|
-
export { enUS, zhCN };
|
|
1
|
+
export { enUS } from "../locales/en-US.js";
|
|
2
|
+
export { zhCN } from "../locales/zh-CN.js";
|