@rockshin/tao-ui 0.0.57 → 0.0.59
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/components/affix/affix.js +38 -4
- package/dist/components/app/app-modals.js +11 -6
- package/dist/components/app/app-notices.js +112 -47
- package/dist/components/auto-complete/auto-complete.js +9 -2
- package/dist/components/avatar/avatar.js +1 -1
- package/dist/components/badge/badge.js +2 -2
- package/dist/components/breadcrumb/breadcrumb.js +5 -1
- package/dist/components/calendar/calendar.js +24 -17
- package/dist/components/carousel/carousel.js +35 -16
- package/dist/components/cascader/cascader.js +17 -12
- package/dist/components/checkbox/checkbox.d.ts +3 -1
- package/dist/components/checkbox/checkbox.js +65 -58
- package/dist/components/collapse/collapse-panels.js +68 -67
- package/dist/components/color-picker/color-picker.js +383 -360
- package/dist/components/date-picker/calendar/calendar-grid.d.ts +5 -3
- package/dist/components/date-picker/calendar/calendar-grid.js +9 -4
- package/dist/components/date-picker/calendar/month-grid.d.ts +2 -1
- package/dist/components/date-picker/calendar/month-grid.js +61 -45
- package/dist/components/date-picker/calendar/time-panel.d.ts +8 -1
- package/dist/components/date-picker/calendar/time-panel.js +89 -88
- package/dist/components/date-picker/calendar/year-grid.d.ts +2 -1
- package/dist/components/date-picker/calendar/year-grid.js +60 -44
- package/dist/components/date-picker/date-localization.js +12 -14
- package/dist/components/date-picker/date-picker.css +9 -0
- package/dist/components/date-picker/date-picker.js +22 -13
- package/dist/components/date-picker/range-picker.d.ts +2 -0
- package/dist/components/date-picker/range-picker.js +127 -70
- package/dist/components/date-picker/types.js +1 -1
- package/dist/components/divider/divider.js +1 -1
- package/dist/components/drawer/drawer.d.ts +1 -1
- package/dist/components/drawer/drawer.js +4 -3
- package/dist/components/dropdown/dropdown.js +11 -9
- package/dist/components/float-button/float-button.js +11 -9
- package/dist/components/form/form-item.d.ts +1 -1
- package/dist/components/form/form-item.js +160 -120
- package/dist/components/form-field/form-field-view.d.ts +2 -1
- package/dist/components/form-field/form-field-view.js +173 -108
- package/dist/components/image/image.js +135 -143
- package/dist/components/input/input-shared.js +3 -2
- package/dist/components/input/otp.js +120 -110
- package/dist/components/input/password.js +55 -61
- package/dist/components/input/search.js +13 -7
- package/dist/components/list/list.js +106 -105
- package/dist/components/masonry/masonry.js +1 -1
- package/dist/components/mentions/mentions.js +1 -0
- package/dist/components/menu/menu-render.js +1 -0
- package/dist/components/modal/confirm-dialog.js +11 -4
- package/dist/components/modal/modal.js +320 -315
- package/dist/components/pagination/pagination.d.ts +3 -0
- package/dist/components/pagination/pagination.js +5 -0
- package/dist/components/popover/popover.js +325 -289
- package/dist/components/qr-code/qr-code.js +157 -150
- package/dist/components/radio/radio.d.ts +3 -1
- package/dist/components/radio/radio.js +73 -64
- package/dist/components/rate/rate.js +83 -72
- package/dist/components/scroll-area/scroll-area.css +1 -1
- package/dist/components/scroll-area/scroll-area.js +294 -222
- package/dist/components/select/mobile-select.js +6 -3
- package/dist/components/select/select-model.js +2 -2
- package/dist/components/select/select.js +78 -39
- package/dist/components/select/use-select-selection.d.ts +1 -1
- package/dist/components/select/use-select-selection.js +91 -84
- package/dist/components/slider/slider.d.ts +2 -2
- package/dist/components/slider/slider.js +13 -2
- package/dist/components/sonner/sonner.js +2 -2
- package/dist/components/splitter/splitter.css +1 -0
- package/dist/components/splitter/splitter.js +152 -126
- package/dist/components/statistic/statistic.js +84 -78
- package/dist/components/steps/steps.js +1 -1
- package/dist/components/switch/switch.js +45 -39
- package/dist/components/table/table.js +5 -1
- package/dist/components/table/use-table-data.js +2 -2
- package/dist/components/time-picker/time-picker.js +31 -1
- package/dist/components/tooltip/tooltip.js +237 -99
- package/dist/components/tree/tree.js +31 -3
- package/dist/components/tree-select/tree-select.js +1 -1
- package/dist/components/upload/upload.js +69 -42
- package/dist/locales/ar-EG.js +2 -0
- package/dist/locales/de-DE.js +2 -0
- package/dist/locales/en-US.js +2 -0
- package/dist/locales/es-ES.js +2 -0
- package/dist/locales/fr-FR.js +2 -0
- package/dist/locales/hi-IN.js +2 -0
- package/dist/locales/id-ID.js +2 -0
- package/dist/locales/it-IT.js +2 -0
- package/dist/locales/ja-JP.js +2 -0
- package/dist/locales/ko-KR.js +2 -0
- package/dist/locales/pt-BR.js +2 -0
- package/dist/locales/ru-RU.js +2 -0
- package/dist/locales/th-TH.js +2 -0
- package/dist/locales/tr-TR.js +2 -0
- package/dist/locales/types.d.ts +2 -0
- package/dist/locales/vi-VN.js +2 -0
- package/dist/locales/zh-CN.js +2 -0
- package/dist/locales/zh-TW.js +2 -0
- package/dist/number-input/cursor.js +20 -8
- package/dist/number-input/format.js +13 -5
- package/dist/number-input/use-number-input.js +166 -318
- package/dist/number-input/validate.d.ts +1 -0
- package/dist/number-input/validate.js +1 -1
- package/dist/provider/tao-provider.d.ts +2 -2
- package/dist/provider/tao-provider.js +49 -49
- package/dist/utils/composed-parent.d.ts +1 -0
- package/dist/utils/composed-parent.js +7 -0
- package/dist/utils/portal.d.ts +5 -0
- package/dist/utils/portal.js +7 -1
- package/dist/utils/refs.d.ts +3 -1
- package/dist/utils/refs.js +25 -1
- package/package.json +1 -1
|
@@ -4,6 +4,7 @@ import upload from "@rc-component/upload";
|
|
|
4
4
|
import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from "react";
|
|
5
5
|
import { flushSync } from "react-dom";
|
|
6
6
|
import { useTaoConfig } from "../../provider/tao-provider.js";
|
|
7
|
+
import { useCommittedRef } from "../../utils/refs.js";
|
|
7
8
|
import { cx } from "../../utils/semantic.js";
|
|
8
9
|
import { Button } from "../button/button.js";
|
|
9
10
|
import { Modal } from "../modal/modal.js";
|
|
@@ -54,19 +55,22 @@ function FilePreview(t0) {
|
|
|
54
55
|
const $ = c(13);
|
|
55
56
|
const { file, previewFile } = t0;
|
|
56
57
|
const { locale } = useTaoConfig();
|
|
58
|
+
const source = file.originFileObj;
|
|
57
59
|
const [preview, setPreview] = useState();
|
|
58
60
|
const [error, setError] = useState();
|
|
59
61
|
let t1;
|
|
60
62
|
let t2;
|
|
61
|
-
if ($[0] !== file.
|
|
63
|
+
if ($[0] !== file.thumbUrl || $[1] !== file.url || $[2] !== locale.messages.previewUnavailable || $[3] !== locale.messages.readFileError || $[4] !== previewFile || $[5] !== source) {
|
|
62
64
|
t1 = ()=>{
|
|
63
|
-
setPreview(void 0);
|
|
64
65
|
setError(void 0);
|
|
65
|
-
if (file.thumbUrl || file.url || !
|
|
66
|
+
if (file.thumbUrl || file.url || !source) return void setPreview(void 0);
|
|
66
67
|
let active = true;
|
|
67
|
-
const load = async (
|
|
68
|
-
load(
|
|
69
|
-
if (active) setPreview(
|
|
68
|
+
const load = async (source_0)=>previewFile ? previewFile(source_0) : readPreview(source_0, locale.messages.readFileError);
|
|
69
|
+
load(source).then((value)=>{
|
|
70
|
+
if (active) setPreview({
|
|
71
|
+
source,
|
|
72
|
+
url: value
|
|
73
|
+
});
|
|
70
74
|
}, (reason)=>{
|
|
71
75
|
if (active) setError(reason instanceof Error ? reason.message : locale.messages.previewUnavailable);
|
|
72
76
|
});
|
|
@@ -75,19 +79,19 @@ function FilePreview(t0) {
|
|
|
75
79
|
};
|
|
76
80
|
};
|
|
77
81
|
t2 = [
|
|
78
|
-
|
|
82
|
+
source,
|
|
79
83
|
file.thumbUrl,
|
|
80
84
|
file.url,
|
|
81
85
|
previewFile,
|
|
82
86
|
locale.messages.readFileError,
|
|
83
87
|
locale.messages.previewUnavailable
|
|
84
88
|
];
|
|
85
|
-
$[0] = file.
|
|
86
|
-
$[1] = file.
|
|
87
|
-
$[2] =
|
|
88
|
-
$[3] = locale.messages.
|
|
89
|
-
$[4] =
|
|
90
|
-
$[5] =
|
|
89
|
+
$[0] = file.thumbUrl;
|
|
90
|
+
$[1] = file.url;
|
|
91
|
+
$[2] = locale.messages.previewUnavailable;
|
|
92
|
+
$[3] = locale.messages.readFileError;
|
|
93
|
+
$[4] = previewFile;
|
|
94
|
+
$[5] = source;
|
|
91
95
|
$[6] = t1;
|
|
92
96
|
$[7] = t2;
|
|
93
97
|
} else {
|
|
@@ -95,7 +99,7 @@ function FilePreview(t0) {
|
|
|
95
99
|
t2 = $[7];
|
|
96
100
|
}
|
|
97
101
|
useEffect(t1, t2);
|
|
98
|
-
const src = file.thumbUrl
|
|
102
|
+
const src = file.thumbUrl || file.url || preview?.source === source && preview?.url;
|
|
99
103
|
let t3;
|
|
100
104
|
if ($[8] !== error || $[9] !== file.crossOrigin || $[10] !== file.name || $[11] !== src) {
|
|
101
105
|
t3 = error ? /*#__PURE__*/ jsx("span", {
|
|
@@ -208,12 +212,11 @@ const UploadRoot = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
208
212
|
const config = useTaoConfig();
|
|
209
213
|
const [localFiles, setFiles] = useState(props.defaultFileList ?? []);
|
|
210
214
|
const files = 'fileList' in props ? props.fileList ?? [] : localFiles;
|
|
211
|
-
const filesRef =
|
|
212
|
-
|
|
213
|
-
const propsRef = useRef(props);
|
|
214
|
-
propsRef.current = props;
|
|
215
|
+
const filesRef = useCommittedRef(files);
|
|
216
|
+
const propsRef = useCommittedRef(props);
|
|
215
217
|
const root = useRef(null), uploader = useRef(null);
|
|
216
218
|
const ignored = useRef(new Set());
|
|
219
|
+
const normalizedBatches = useRef(new WeakSet());
|
|
217
220
|
const preparations = useRef(new WeakMap());
|
|
218
221
|
const requestOrigins = useRef(new WeakMap());
|
|
219
222
|
const settledRequests = useRef(new WeakSet());
|
|
@@ -258,29 +261,35 @@ const UploadRoot = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
258
261
|
filesRef.current = limited;
|
|
259
262
|
setFiles(limited);
|
|
260
263
|
}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
...
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
264
|
+
const onChange = propsRef.current.onChange;
|
|
265
|
+
if (onChange && ('removed' === file.status || limited.some((item_0)=>item_0.uid === file.uid))) {
|
|
266
|
+
const changed = {
|
|
267
|
+
...file
|
|
268
|
+
};
|
|
269
|
+
onChange({
|
|
270
|
+
file: changed,
|
|
271
|
+
fileList: limited.map((item)=>item === file ? changed : {
|
|
272
|
+
...item
|
|
273
|
+
}),
|
|
274
|
+
...event ? {
|
|
275
|
+
event
|
|
276
|
+
} : {}
|
|
277
|
+
});
|
|
278
|
+
}
|
|
270
279
|
});
|
|
271
280
|
};
|
|
272
281
|
const update = (file_0, patch, event_0)=>{
|
|
273
282
|
if (settledRequests.current.has(file_0)) return;
|
|
274
|
-
const items = current(), found = items.find((
|
|
283
|
+
const items = current(), found = items.find((item_1)=>item_1.uid === file_0.uid);
|
|
275
284
|
if (!found) return;
|
|
276
285
|
const origin = requestOrigins.current.get(file_0);
|
|
277
286
|
if (origin && found.originFileObj && found.originFileObj !== origin) return;
|
|
278
287
|
if ('done' === patch.status || 'error' === patch.status) settledRequests.current.add(file_0);
|
|
279
|
-
const
|
|
288
|
+
const changed_0 = {
|
|
280
289
|
...found,
|
|
281
290
|
...patch
|
|
282
291
|
};
|
|
283
|
-
emit(
|
|
292
|
+
emit(changed_0, items.map((item_2)=>item_2.uid === file_0.uid ? changed_0 : item_2), event_0);
|
|
284
293
|
};
|
|
285
294
|
const onSuccess = (response, file_1, xhr)=>update(file_1, {
|
|
286
295
|
status: 'done',
|
|
@@ -299,10 +308,22 @@ const UploadRoot = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
299
308
|
});
|
|
300
309
|
const customRequest = props.customRequest;
|
|
301
310
|
const request = customRequest ? (options, info)=>{
|
|
311
|
+
let finished = false;
|
|
302
312
|
try {
|
|
303
|
-
|
|
313
|
+
const handle = customRequest({
|
|
314
|
+
...options,
|
|
315
|
+
onSuccess: (...args)=>{
|
|
316
|
+
finished = true;
|
|
317
|
+
options.onSuccess?.(...args);
|
|
318
|
+
},
|
|
319
|
+
onError: (...args_0)=>{
|
|
320
|
+
finished = true;
|
|
321
|
+
options.onError?.(...args_0);
|
|
322
|
+
}
|
|
323
|
+
}, info);
|
|
324
|
+
return finished ? void 0 : handle;
|
|
304
325
|
} catch (reason) {
|
|
305
|
-
if (
|
|
326
|
+
if (finished) throw reason;
|
|
306
327
|
options.onError?.(asError(reason));
|
|
307
328
|
}
|
|
308
329
|
} : void 0;
|
|
@@ -327,11 +348,11 @@ const UploadRoot = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
327
348
|
} : {}
|
|
328
349
|
};
|
|
329
350
|
});
|
|
330
|
-
for (const
|
|
331
|
-
...next_0.filter((old)=>old.uid !==
|
|
332
|
-
|
|
351
|
+
for (const item_3 of additions)next_0 = [
|
|
352
|
+
...next_0.filter((old)=>old.uid !== item_3.uid),
|
|
353
|
+
item_3
|
|
333
354
|
];
|
|
334
|
-
for (const
|
|
355
|
+
for (const item_4 of additions)emit(item_4, next_0);
|
|
335
356
|
};
|
|
336
357
|
useImperativeHandle(ref, ()=>({
|
|
337
358
|
onBatchStart,
|
|
@@ -351,16 +372,16 @@ const UploadRoot = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
351
372
|
try {
|
|
352
373
|
if (await propsRef.current.onRemove?.(file_7) === false) return;
|
|
353
374
|
const items_0 = current();
|
|
354
|
-
const latest = items_0.find((
|
|
375
|
+
const latest = items_0.find((item_6)=>item_6.uid === file_7.uid);
|
|
355
376
|
if (!latest || !isCurrent(latest)) return;
|
|
356
377
|
uploader.current?.abort(file_7);
|
|
357
378
|
emit({
|
|
358
379
|
...latest,
|
|
359
380
|
status: 'removed'
|
|
360
|
-
}, items_0.filter((
|
|
381
|
+
}, items_0.filter((item_7)=>item_7.uid !== file_7.uid));
|
|
361
382
|
setRemoveError(void 0);
|
|
362
383
|
} catch (error_1) {
|
|
363
|
-
if (!isCurrent(current().find((
|
|
384
|
+
if (!isCurrent(current().find((item_5)=>item_5.uid === file_7.uid))) return;
|
|
364
385
|
setRemoveError(error_1 instanceof Error ? error_1.message : config.locale.messages.removeFileError);
|
|
365
386
|
} finally{
|
|
366
387
|
if (pending.get(file_7.uid) === file_7) pending.delete(file_7.uid);
|
|
@@ -409,6 +430,12 @@ const UploadRoot = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
409
430
|
openFileDialogOnClick: props.openFileDialogOnClick,
|
|
410
431
|
hasControlInside: props.hasControlInside ?? (!!props.children || !isCard && 'drag' !== type),
|
|
411
432
|
beforeUpload: async (file_13, list)=>{
|
|
433
|
+
if (!normalizedBatches.current.has(list)) {
|
|
434
|
+
for (const item_8 of list)if (!('lastModifiedDate' in item_8)) Object.assign(item_8, {
|
|
435
|
+
lastModifiedDate: new Date(item_8.lastModified)
|
|
436
|
+
});
|
|
437
|
+
normalizedBatches.current.add(list);
|
|
438
|
+
}
|
|
412
439
|
preparations.current.delete(file_13);
|
|
413
440
|
const result = await props.beforeUpload?.(file_13, list);
|
|
414
441
|
if (result === LIST_IGNORE) {
|
|
@@ -495,7 +522,7 @@ const UploadRoot = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
495
522
|
size: "small"
|
|
496
523
|
}) : /*#__PURE__*/ jsx(FileIcon, {}));
|
|
497
524
|
const localPreview = image && !!file_15.originFileObj;
|
|
498
|
-
const previewUrl = file_15.url
|
|
525
|
+
const previewUrl = file_15.url || file_15.thumbUrl;
|
|
499
526
|
const actions = {
|
|
500
527
|
preview: ()=>{
|
|
501
528
|
if (props.onPreview) props.onPreview(file_15);
|
|
@@ -572,8 +599,8 @@ const UploadRoot = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
572
599
|
showInfo: false,
|
|
573
600
|
...props.progress,
|
|
574
601
|
percent: file_15.percent ?? 0,
|
|
575
|
-
"aria-label": file_15['aria-label'] ?? file_15.name,
|
|
576
|
-
"aria-labelledby": file_15['aria-labelledby']
|
|
602
|
+
"aria-label": file_15['aria-label'] ?? props.progress?.['aria-label'] ?? file_15.name,
|
|
603
|
+
"aria-labelledby": file_15['aria-labelledby'] ?? props.progress?.['aria-labelledby']
|
|
577
604
|
}),
|
|
578
605
|
null != listConfig.extra && /*#__PURE__*/ jsx("span", {
|
|
579
606
|
"data-tao-upload-extra": "",
|
package/dist/locales/ar-EG.js
CHANGED
package/dist/locales/de-DE.js
CHANGED
|
@@ -28,6 +28,8 @@ const deDE = createLocale({
|
|
|
28
28
|
dateRange: 'Zeitraum auswählen',
|
|
29
29
|
startDate: 'Startdatum',
|
|
30
30
|
endDate: 'Enddatum',
|
|
31
|
+
selectStartDate: 'Wählen Sie ein Startdatum.',
|
|
32
|
+
selectEndDate: 'Wählen Sie ein Enddatum.',
|
|
31
33
|
now: 'Jetzt',
|
|
32
34
|
ok: 'OK',
|
|
33
35
|
cancel: 'Abbrechen',
|
package/dist/locales/en-US.js
CHANGED
package/dist/locales/es-ES.js
CHANGED
|
@@ -28,6 +28,8 @@ const esES = createLocale({
|
|
|
28
28
|
dateRange: 'Seleccionar intervalo de fechas',
|
|
29
29
|
startDate: 'Fecha de inicio',
|
|
30
30
|
endDate: 'Fecha de fin',
|
|
31
|
+
selectStartDate: 'Selecciona una fecha de inicio.',
|
|
32
|
+
selectEndDate: 'Selecciona una fecha de fin.',
|
|
31
33
|
now: 'Ahora',
|
|
32
34
|
ok: 'Aceptar',
|
|
33
35
|
cancel: 'Cancelar',
|
package/dist/locales/fr-FR.js
CHANGED
|
@@ -28,6 +28,8 @@ const frFR = createLocale({
|
|
|
28
28
|
dateRange: 'Sélectionner une période',
|
|
29
29
|
startDate: 'Date de début',
|
|
30
30
|
endDate: 'Date de fin',
|
|
31
|
+
selectStartDate: 'Sélectionnez une date de début.',
|
|
32
|
+
selectEndDate: 'Sélectionnez une date de fin.',
|
|
31
33
|
now: 'Maintenant',
|
|
32
34
|
ok: 'OK',
|
|
33
35
|
cancel: 'Annuler',
|
package/dist/locales/hi-IN.js
CHANGED
|
@@ -28,6 +28,8 @@ const hiIN = createLocale({
|
|
|
28
28
|
dateRange: 'दिनांक सीमा चुनें',
|
|
29
29
|
startDate: 'प्रारंभ दिनांक',
|
|
30
30
|
endDate: 'समाप्ति दिनांक',
|
|
31
|
+
selectStartDate: 'प्रारंभ दिनांक चुनें।',
|
|
32
|
+
selectEndDate: 'समाप्ति दिनांक चुनें।',
|
|
31
33
|
now: 'अभी',
|
|
32
34
|
ok: 'ठीक है',
|
|
33
35
|
cancel: 'रद्द करें',
|
package/dist/locales/id-ID.js
CHANGED
|
@@ -28,6 +28,8 @@ const idID = createLocale({
|
|
|
28
28
|
dateRange: 'Pilih rentang tanggal',
|
|
29
29
|
startDate: 'Tanggal mulai',
|
|
30
30
|
endDate: 'Tanggal selesai',
|
|
31
|
+
selectStartDate: 'Pilih tanggal mulai.',
|
|
32
|
+
selectEndDate: 'Pilih tanggal selesai.',
|
|
31
33
|
now: 'Sekarang',
|
|
32
34
|
ok: 'OK',
|
|
33
35
|
cancel: 'Batal',
|
package/dist/locales/it-IT.js
CHANGED
|
@@ -28,6 +28,8 @@ const itIT = createLocale({
|
|
|
28
28
|
dateRange: 'Seleziona intervallo di date',
|
|
29
29
|
startDate: 'Data di inizio',
|
|
30
30
|
endDate: 'Data di fine',
|
|
31
|
+
selectStartDate: 'Seleziona una data di inizio.',
|
|
32
|
+
selectEndDate: 'Seleziona una data di fine.',
|
|
31
33
|
now: 'Adesso',
|
|
32
34
|
ok: 'OK',
|
|
33
35
|
cancel: 'Annulla',
|
package/dist/locales/ja-JP.js
CHANGED
package/dist/locales/ko-KR.js
CHANGED
package/dist/locales/pt-BR.js
CHANGED
|
@@ -28,6 +28,8 @@ const ptBR = createLocale({
|
|
|
28
28
|
dateRange: 'Selecionar período',
|
|
29
29
|
startDate: 'Data inicial',
|
|
30
30
|
endDate: 'Data final',
|
|
31
|
+
selectStartDate: 'Selecione uma data inicial.',
|
|
32
|
+
selectEndDate: 'Selecione uma data final.',
|
|
31
33
|
now: 'Agora',
|
|
32
34
|
ok: 'OK',
|
|
33
35
|
cancel: 'Cancelar',
|
package/dist/locales/ru-RU.js
CHANGED
|
@@ -28,6 +28,8 @@ const ruRU = createLocale({
|
|
|
28
28
|
dateRange: 'Выбрать диапазон дат',
|
|
29
29
|
startDate: 'Дата начала',
|
|
30
30
|
endDate: 'Дата окончания',
|
|
31
|
+
selectStartDate: 'Выберите дату начала.',
|
|
32
|
+
selectEndDate: 'Выберите дату окончания.',
|
|
31
33
|
now: 'Сейчас',
|
|
32
34
|
ok: 'ОК',
|
|
33
35
|
cancel: 'Отмена',
|
package/dist/locales/th-TH.js
CHANGED
package/dist/locales/tr-TR.js
CHANGED
|
@@ -28,6 +28,8 @@ const trTR = createLocale({
|
|
|
28
28
|
dateRange: 'Tarih aralığı seç',
|
|
29
29
|
startDate: 'Başlangıç tarihi',
|
|
30
30
|
endDate: 'Bitiş tarihi',
|
|
31
|
+
selectStartDate: 'Başlangıç tarihi seçin.',
|
|
32
|
+
selectEndDate: 'Bitiş tarihi seçin.',
|
|
31
33
|
now: 'Şimdi',
|
|
32
34
|
ok: 'Tamam',
|
|
33
35
|
cancel: 'İptal',
|
package/dist/locales/types.d.ts
CHANGED
package/dist/locales/vi-VN.js
CHANGED
package/dist/locales/zh-CN.js
CHANGED
package/dist/locales/zh-TW.js
CHANGED
|
@@ -2,16 +2,22 @@ function countAnchored(display, upTo, thousandsSeparator) {
|
|
|
2
2
|
const limit = Math.min(upTo, display.length);
|
|
3
3
|
if (!thousandsSeparator) return Math.max(0, limit);
|
|
4
4
|
let count = 0;
|
|
5
|
-
for(let i = 0; i < limit;
|
|
5
|
+
for(let i = 0; i < limit;)if (display.startsWith(thousandsSeparator, i)) i += thousandsSeparator.length;
|
|
6
|
+
else {
|
|
7
|
+
count++;
|
|
8
|
+
i++;
|
|
9
|
+
}
|
|
6
10
|
return count;
|
|
7
11
|
}
|
|
8
12
|
function findCursorAt(display, anchorCount, thousandsSeparator) {
|
|
9
13
|
if (anchorCount <= 0) return 0;
|
|
10
14
|
if (!thousandsSeparator) return Math.min(anchorCount, display.length);
|
|
11
15
|
let count = 0;
|
|
12
|
-
for(let i = 0; i < display.length; i
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
for(let i = 0; i < display.length;)if (display.startsWith(thousandsSeparator, i)) i += thousandsSeparator.length;
|
|
17
|
+
else {
|
|
18
|
+
count++;
|
|
19
|
+
i++;
|
|
20
|
+
if (count === anchorCount) return i;
|
|
15
21
|
}
|
|
16
22
|
return display.length;
|
|
17
23
|
}
|
|
@@ -19,15 +25,21 @@ function countAnchoredFromEnd(display, fromPos, thousandsSeparator) {
|
|
|
19
25
|
if (fromPos >= display.length) return 0;
|
|
20
26
|
if (!thousandsSeparator) return display.length - Math.max(0, fromPos);
|
|
21
27
|
let count = 0;
|
|
22
|
-
for(let i = Math.max(0, fromPos);
|
|
28
|
+
for(let i = display.length; i > Math.max(0, fromPos);)if (display.endsWith(thousandsSeparator, i)) i -= thousandsSeparator.length;
|
|
29
|
+
else {
|
|
30
|
+
count++;
|
|
31
|
+
i--;
|
|
32
|
+
}
|
|
23
33
|
return count;
|
|
24
34
|
}
|
|
25
35
|
function findCursorFromEnd(display, anchoredFromEnd, thousandsSeparator) {
|
|
26
36
|
if (anchoredFromEnd <= 0) return display.length;
|
|
27
37
|
if (!thousandsSeparator) return Math.max(0, display.length - anchoredFromEnd);
|
|
28
38
|
let count = 0;
|
|
29
|
-
for(let i = display.length
|
|
30
|
-
|
|
39
|
+
for(let i = display.length; i > 0;)if (display.endsWith(thousandsSeparator, i)) i -= thousandsSeparator.length;
|
|
40
|
+
else {
|
|
41
|
+
count++;
|
|
42
|
+
i--;
|
|
31
43
|
if (count === anchoredFromEnd) return i;
|
|
32
44
|
}
|
|
33
45
|
return 0;
|
|
@@ -39,6 +51,6 @@ function reposition(args) {
|
|
|
39
51
|
}
|
|
40
52
|
function isThousandSepBeforeCursor(display, cursor, thousandsSeparator) {
|
|
41
53
|
if (!thousandsSeparator || cursor <= 0) return false;
|
|
42
|
-
return display
|
|
54
|
+
return display.endsWith(thousandsSeparator, cursor);
|
|
43
55
|
}
|
|
44
56
|
export { countAnchored, findCursorAt, isThousandSepBeforeCursor, reposition };
|
|
@@ -14,15 +14,23 @@ function format(canonical, opts) {
|
|
|
14
14
|
}
|
|
15
15
|
function parse(display, opts) {
|
|
16
16
|
if (!display) return '';
|
|
17
|
-
const text = normalizeDigits(display, opts).replace(/[\u061c\u200e\u200f\u202a-\u202e\u2066-\u2069]/g, '');
|
|
17
|
+
const text = normalizeDigits(display, opts).replace(/[0-9]/g, (digit)=>String(digit.charCodeAt(0) - 0xff10)).replace(/[\u061c\u200e\u200f\u202a-\u202e\u2066-\u2069]/g, '');
|
|
18
18
|
const negative = text.startsWith('-') || text.startsWith(opts.minusSign ?? '-');
|
|
19
19
|
const body = negative ? text.slice(1) : text;
|
|
20
20
|
let cleaned = '';
|
|
21
21
|
let seenDecimal = false;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
const { decimalSeparator } = opts;
|
|
23
|
+
for(let index = 0; index < body.length; index++){
|
|
24
|
+
const ch = body[index];
|
|
25
|
+
if (decimalSeparator && body.startsWith(decimalSeparator, index)) {
|
|
26
|
+
if (!seenDecimal) cleaned += '.';
|
|
27
|
+
seenDecimal = true;
|
|
28
|
+
index += decimalSeparator.length - 1;
|
|
29
|
+
} else if (ch >= '0' && ch <= '9') cleaned += ch;
|
|
30
|
+
else if (!seenDecimal && opts.allowAsciiDecimal && '.' === ch && '.' !== opts.thousandsSeparator) {
|
|
31
|
+
cleaned += '.';
|
|
32
|
+
seenDecimal = true;
|
|
33
|
+
}
|
|
26
34
|
}
|
|
27
35
|
if (cleaned.startsWith('.')) cleaned = `0${cleaned}`;
|
|
28
36
|
return (negative ? '-' : '') + cleaned;
|