antd-mobile 5.39.0 → 5.40.0
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/2x/README.md +8 -1
- package/2x/bundle/antd-mobile.cjs.development.js +2351 -1604
- package/2x/bundle/antd-mobile.cjs.js +7 -7
- package/2x/bundle/antd-mobile.es.development.js +1385 -638
- package/2x/bundle/antd-mobile.es.js +6070 -5443
- package/2x/bundle/antd-mobile.umd.development.js +2350 -1603
- package/2x/bundle/antd-mobile.umd.js +7 -7
- package/2x/bundle/style.css +7 -4
- package/2x/cjs/components/button/button.d.ts +2 -2
- package/2x/cjs/components/button/button.js +1 -0
- package/2x/cjs/components/calendar-picker-view/calendar-picker-view.js +3 -0
- package/2x/cjs/components/date-picker/date-picker-date-utils.d.ts +1 -1
- package/2x/cjs/components/date-picker/date-picker-date-utils.js +23 -8
- package/2x/cjs/components/date-picker/date-picker-quarter-utils.d.ts +3 -1
- package/2x/cjs/components/date-picker/date-picker-quarter-utils.js +7 -2
- package/2x/cjs/components/date-picker/date-picker-week-utils.d.ts +3 -1
- package/2x/cjs/components/date-picker/date-picker-week-utils.js +10 -3
- package/2x/cjs/components/date-picker-view/date-picker-view.d.ts +5 -3
- package/2x/cjs/components/date-picker-view/date-picker-view.js +3 -3
- package/2x/cjs/components/date-picker-view/useRenderLabel.js +2 -2
- package/2x/cjs/components/number-keyboard/number-keyboard.d.ts +1 -1
- package/2x/cjs/components/popover/wrapper.d.ts +6 -9
- package/2x/cjs/components/popover/wrapper.js +32 -6
- package/2x/cjs/components/space/space.css +4 -4
- package/2x/cjs/components/virtual-input/virtual-input.css +3 -0
- package/2x/cjs/components/virtual-input/virtual-input.js +34 -5
- package/2x/cjs/index.d.ts +1 -0
- package/2x/cjs/index.js +7 -0
- package/2x/cjs/locales/ar-SA.d.ts +1 -0
- package/2x/cjs/locales/ar-SA.js +1 -0
- package/2x/cjs/locales/base.d.ts +1 -0
- package/2x/cjs/locales/base.js +1 -0
- package/2x/cjs/locales/cnr-ME.d.ts +1 -0
- package/2x/cjs/locales/cnr-ME.js +1 -0
- package/2x/cjs/locales/da-DK.d.ts +1 -0
- package/2x/cjs/locales/de-DE.d.ts +1 -0
- package/2x/cjs/locales/de-DE.js +1 -0
- package/2x/cjs/locales/en-US.d.ts +1 -0
- package/2x/cjs/locales/es-ES.d.ts +1 -0
- package/2x/cjs/locales/fa-IR.d.ts +1 -0
- package/2x/cjs/locales/fr-FR.d.ts +1 -0
- package/2x/cjs/locales/hr-HR.d.ts +1 -0
- package/2x/cjs/locales/hr-HR.js +1 -0
- package/2x/cjs/locales/hu-HU.d.ts +1 -0
- package/2x/cjs/locales/id-ID.d.ts +1 -0
- package/2x/cjs/locales/in-ID.d.ts +1 -0
- package/2x/cjs/locales/in-ID.js +1 -0
- package/2x/cjs/locales/it-IT.d.ts +1 -0
- package/2x/cjs/locales/ja-JP.d.ts +1 -0
- package/2x/cjs/locales/kk-KZ.d.ts +1 -0
- package/2x/cjs/locales/ko-KR.d.ts +1 -0
- package/2x/cjs/locales/ms-MY.d.ts +1 -0
- package/2x/cjs/locales/ms-MY.js +1 -0
- package/2x/cjs/locales/nb-NO.d.ts +1 -0
- package/2x/cjs/locales/nl-NL.d.ts +1 -0
- package/2x/cjs/locales/pt-BR.d.ts +1 -0
- package/2x/cjs/locales/ru-RU.d.ts +1 -0
- package/2x/cjs/locales/ru-RU.js +8 -2
- package/2x/cjs/locales/sr-RS.d.ts +1 -0
- package/2x/cjs/locales/sr-RS.js +1 -0
- package/2x/cjs/locales/th-TH.d.ts +1 -0
- package/2x/cjs/locales/th-TH.js +1 -0
- package/2x/cjs/locales/tr-TR.d.ts +1 -0
- package/2x/cjs/locales/vi-VN.d.ts +1 -0
- package/2x/cjs/locales/vi-VN.js +1 -0
- package/2x/cjs/locales/zh-CN.js +1 -0
- package/2x/cjs/locales/zh-HK.d.ts +1 -0
- package/2x/cjs/locales/zh-TW.d.ts +1 -0
- package/2x/cjs/utils/render-to-body.d.ts +1 -1
- package/2x/cjs/utils/render-to-body.js +2 -9
- package/2x/cjs/utils/render.d.ts +1 -9
- package/2x/cjs/utils/render.js +10 -68
- package/2x/cjs/utils/unstable-render.d.ts +9 -0
- package/2x/cjs/utils/unstable-render.js +37 -0
- package/2x/es/components/button/button.d.ts +2 -2
- package/2x/es/components/button/button.js +1 -0
- package/2x/es/components/calendar-picker-view/calendar-picker-view.js +3 -0
- package/2x/es/components/date-picker/date-picker-date-utils.d.ts +1 -1
- package/2x/es/components/date-picker/date-picker-date-utils.js +23 -8
- package/2x/es/components/date-picker/date-picker-quarter-utils.d.ts +3 -1
- package/2x/es/components/date-picker/date-picker-quarter-utils.js +7 -2
- package/2x/es/components/date-picker/date-picker-week-utils.d.ts +3 -1
- package/2x/es/components/date-picker/date-picker-week-utils.js +10 -3
- package/2x/es/components/date-picker-view/date-picker-view.d.ts +5 -3
- package/2x/es/components/date-picker-view/date-picker-view.js +4 -4
- package/2x/es/components/date-picker-view/useRenderLabel.js +2 -2
- package/2x/es/components/number-keyboard/number-keyboard.d.ts +1 -1
- package/2x/es/components/popover/wrapper.d.ts +6 -9
- package/2x/es/components/popover/wrapper.js +30 -5
- package/2x/es/components/space/space.css +4 -4
- package/2x/es/components/virtual-input/virtual-input.css +3 -0
- package/2x/es/components/virtual-input/virtual-input.js +34 -5
- package/2x/es/index.d.ts +1 -0
- package/2x/es/index.js +3 -1
- package/2x/es/locales/ar-SA.d.ts +1 -0
- package/2x/es/locales/ar-SA.js +1 -0
- package/2x/es/locales/base.d.ts +1 -0
- package/2x/es/locales/base.js +1 -0
- package/2x/es/locales/cnr-ME.d.ts +1 -0
- package/2x/es/locales/cnr-ME.js +1 -0
- package/2x/es/locales/da-DK.d.ts +1 -0
- package/2x/es/locales/de-DE.d.ts +1 -0
- package/2x/es/locales/de-DE.js +1 -0
- package/2x/es/locales/en-US.d.ts +1 -0
- package/2x/es/locales/es-ES.d.ts +1 -0
- package/2x/es/locales/fa-IR.d.ts +1 -0
- package/2x/es/locales/fr-FR.d.ts +1 -0
- package/2x/es/locales/hr-HR.d.ts +1 -0
- package/2x/es/locales/hr-HR.js +1 -0
- package/2x/es/locales/hu-HU.d.ts +1 -0
- package/2x/es/locales/id-ID.d.ts +1 -0
- package/2x/es/locales/in-ID.d.ts +1 -0
- package/2x/es/locales/in-ID.js +1 -0
- package/2x/es/locales/it-IT.d.ts +1 -0
- package/2x/es/locales/ja-JP.d.ts +1 -0
- package/2x/es/locales/kk-KZ.d.ts +1 -0
- package/2x/es/locales/ko-KR.d.ts +1 -0
- package/2x/es/locales/ms-MY.d.ts +1 -0
- package/2x/es/locales/ms-MY.js +1 -0
- package/2x/es/locales/nb-NO.d.ts +1 -0
- package/2x/es/locales/nl-NL.d.ts +1 -0
- package/2x/es/locales/pt-BR.d.ts +1 -0
- package/2x/es/locales/ru-RU.d.ts +1 -0
- package/2x/es/locales/ru-RU.js +8 -2
- package/2x/es/locales/sr-RS.d.ts +1 -0
- package/2x/es/locales/sr-RS.js +1 -0
- package/2x/es/locales/th-TH.d.ts +1 -0
- package/2x/es/locales/th-TH.js +1 -0
- package/2x/es/locales/tr-TR.d.ts +1 -0
- package/2x/es/locales/vi-VN.d.ts +1 -0
- package/2x/es/locales/vi-VN.js +1 -0
- package/2x/es/locales/zh-CN.js +1 -0
- package/2x/es/locales/zh-HK.d.ts +1 -0
- package/2x/es/locales/zh-TW.d.ts +1 -0
- package/2x/es/utils/render-to-body.d.ts +1 -1
- package/2x/es/utils/render-to-body.js +2 -9
- package/2x/es/utils/render.d.ts +1 -9
- package/2x/es/utils/render.js +1 -65
- package/2x/es/utils/unstable-render.d.ts +9 -0
- package/2x/es/utils/unstable-render.js +28 -0
- package/2x/package.json +2 -2
- package/README.md +8 -1
- package/bundle/antd-mobile.cjs.development.js +2351 -1604
- package/bundle/antd-mobile.cjs.js +7 -7
- package/bundle/antd-mobile.compatible.umd.js +1 -1
- package/bundle/antd-mobile.es.development.js +1385 -638
- package/bundle/antd-mobile.es.js +6070 -5443
- package/bundle/antd-mobile.umd.development.js +2350 -1603
- package/bundle/antd-mobile.umd.js +7 -7
- package/bundle/style.css +1 -1
- package/cjs/components/button/button.d.ts +2 -2
- package/cjs/components/button/button.js +1 -0
- package/cjs/components/calendar-picker-view/calendar-picker-view.js +3 -0
- package/cjs/components/date-picker/date-picker-date-utils.d.ts +1 -1
- package/cjs/components/date-picker/date-picker-date-utils.js +23 -8
- package/cjs/components/date-picker/date-picker-quarter-utils.d.ts +3 -1
- package/cjs/components/date-picker/date-picker-quarter-utils.js +7 -2
- package/cjs/components/date-picker/date-picker-week-utils.d.ts +3 -1
- package/cjs/components/date-picker/date-picker-week-utils.js +10 -3
- package/cjs/components/date-picker-view/date-picker-view.d.ts +5 -3
- package/cjs/components/date-picker-view/date-picker-view.js +3 -3
- package/cjs/components/date-picker-view/useRenderLabel.js +2 -2
- package/cjs/components/number-keyboard/number-keyboard.d.ts +1 -1
- package/cjs/components/popover/wrapper.d.ts +6 -9
- package/cjs/components/popover/wrapper.js +32 -6
- package/cjs/components/space/space.css +3 -3
- package/cjs/components/virtual-input/virtual-input.css +3 -0
- package/cjs/components/virtual-input/virtual-input.js +34 -5
- package/cjs/index.d.ts +1 -0
- package/cjs/index.js +7 -0
- package/cjs/locales/ar-SA.d.ts +1 -0
- package/cjs/locales/ar-SA.js +1 -0
- package/cjs/locales/base.d.ts +1 -0
- package/cjs/locales/base.js +1 -0
- package/cjs/locales/cnr-ME.d.ts +1 -0
- package/cjs/locales/cnr-ME.js +1 -0
- package/cjs/locales/da-DK.d.ts +1 -0
- package/cjs/locales/de-DE.d.ts +1 -0
- package/cjs/locales/de-DE.js +1 -0
- package/cjs/locales/en-US.d.ts +1 -0
- package/cjs/locales/es-ES.d.ts +1 -0
- package/cjs/locales/fa-IR.d.ts +1 -0
- package/cjs/locales/fr-FR.d.ts +1 -0
- package/cjs/locales/hr-HR.d.ts +1 -0
- package/cjs/locales/hr-HR.js +1 -0
- package/cjs/locales/hu-HU.d.ts +1 -0
- package/cjs/locales/id-ID.d.ts +1 -0
- package/cjs/locales/in-ID.d.ts +1 -0
- package/cjs/locales/in-ID.js +1 -0
- package/cjs/locales/it-IT.d.ts +1 -0
- package/cjs/locales/ja-JP.d.ts +1 -0
- package/cjs/locales/kk-KZ.d.ts +1 -0
- package/cjs/locales/ko-KR.d.ts +1 -0
- package/cjs/locales/ms-MY.d.ts +1 -0
- package/cjs/locales/ms-MY.js +1 -0
- package/cjs/locales/nb-NO.d.ts +1 -0
- package/cjs/locales/nl-NL.d.ts +1 -0
- package/cjs/locales/pt-BR.d.ts +1 -0
- package/cjs/locales/ru-RU.d.ts +1 -0
- package/cjs/locales/ru-RU.js +8 -2
- package/cjs/locales/sr-RS.d.ts +1 -0
- package/cjs/locales/sr-RS.js +1 -0
- package/cjs/locales/th-TH.d.ts +1 -0
- package/cjs/locales/th-TH.js +1 -0
- package/cjs/locales/tr-TR.d.ts +1 -0
- package/cjs/locales/vi-VN.d.ts +1 -0
- package/cjs/locales/vi-VN.js +1 -0
- package/cjs/locales/zh-CN.js +1 -0
- package/cjs/locales/zh-HK.d.ts +1 -0
- package/cjs/locales/zh-TW.d.ts +1 -0
- package/cjs/utils/render-to-body.d.ts +1 -1
- package/cjs/utils/render-to-body.js +2 -9
- package/cjs/utils/render.d.ts +1 -9
- package/cjs/utils/render.js +10 -68
- package/cjs/utils/unstable-render.d.ts +9 -0
- package/cjs/utils/unstable-render.js +37 -0
- package/es/components/button/button.d.ts +2 -2
- package/es/components/button/button.js +1 -0
- package/es/components/calendar-picker-view/calendar-picker-view.js +3 -0
- package/es/components/date-picker/date-picker-date-utils.d.ts +1 -1
- package/es/components/date-picker/date-picker-date-utils.js +23 -8
- package/es/components/date-picker/date-picker-quarter-utils.d.ts +3 -1
- package/es/components/date-picker/date-picker-quarter-utils.js +7 -2
- package/es/components/date-picker/date-picker-week-utils.d.ts +3 -1
- package/es/components/date-picker/date-picker-week-utils.js +10 -3
- package/es/components/date-picker-view/date-picker-view.d.ts +5 -3
- package/es/components/date-picker-view/date-picker-view.js +4 -4
- package/es/components/date-picker-view/useRenderLabel.js +2 -2
- package/es/components/number-keyboard/number-keyboard.d.ts +1 -1
- package/es/components/popover/wrapper.d.ts +6 -9
- package/es/components/popover/wrapper.js +30 -5
- package/es/components/space/space.css +3 -3
- package/es/components/virtual-input/virtual-input.css +3 -0
- package/es/components/virtual-input/virtual-input.js +34 -5
- package/es/index.d.ts +1 -0
- package/es/index.js +3 -1
- package/es/locales/ar-SA.d.ts +1 -0
- package/es/locales/ar-SA.js +1 -0
- package/es/locales/base.d.ts +1 -0
- package/es/locales/base.js +1 -0
- package/es/locales/cnr-ME.d.ts +1 -0
- package/es/locales/cnr-ME.js +1 -0
- package/es/locales/da-DK.d.ts +1 -0
- package/es/locales/de-DE.d.ts +1 -0
- package/es/locales/de-DE.js +1 -0
- package/es/locales/en-US.d.ts +1 -0
- package/es/locales/es-ES.d.ts +1 -0
- package/es/locales/fa-IR.d.ts +1 -0
- package/es/locales/fr-FR.d.ts +1 -0
- package/es/locales/hr-HR.d.ts +1 -0
- package/es/locales/hr-HR.js +1 -0
- package/es/locales/hu-HU.d.ts +1 -0
- package/es/locales/id-ID.d.ts +1 -0
- package/es/locales/in-ID.d.ts +1 -0
- package/es/locales/in-ID.js +1 -0
- package/es/locales/it-IT.d.ts +1 -0
- package/es/locales/ja-JP.d.ts +1 -0
- package/es/locales/kk-KZ.d.ts +1 -0
- package/es/locales/ko-KR.d.ts +1 -0
- package/es/locales/ms-MY.d.ts +1 -0
- package/es/locales/ms-MY.js +1 -0
- package/es/locales/nb-NO.d.ts +1 -0
- package/es/locales/nl-NL.d.ts +1 -0
- package/es/locales/pt-BR.d.ts +1 -0
- package/es/locales/ru-RU.d.ts +1 -0
- package/es/locales/ru-RU.js +8 -2
- package/es/locales/sr-RS.d.ts +1 -0
- package/es/locales/sr-RS.js +1 -0
- package/es/locales/th-TH.d.ts +1 -0
- package/es/locales/th-TH.js +1 -0
- package/es/locales/tr-TR.d.ts +1 -0
- package/es/locales/vi-VN.d.ts +1 -0
- package/es/locales/vi-VN.js +1 -0
- package/es/locales/zh-CN.js +1 -0
- package/es/locales/zh-HK.d.ts +1 -0
- package/es/locales/zh-TW.d.ts +1 -0
- package/es/utils/render-to-body.d.ts +1 -1
- package/es/utils/render-to-body.js +2 -9
- package/es/utils/render.d.ts +1 -9
- package/es/utils/render.js +1 -65
- package/es/utils/unstable-render.d.ts +9 -0
- package/es/utils/unstable-render.js +28 -0
- package/package.json +2 -2
- package/umd/antd-mobile.js +1 -1
|
@@ -25,6 +25,7 @@ export function generateDatePickerColumns(selected, min, max, precision, renderL
|
|
|
25
25
|
const minWeekday = minDay.isoWeekday();
|
|
26
26
|
const maxWeekday = maxDay.isoWeekday();
|
|
27
27
|
const selectedWeek = parseInt(selected[1]);
|
|
28
|
+
const selectedWeekday = parseInt(selected[2]);
|
|
28
29
|
const isInMinWeek = isInMinYear && selectedWeek === minWeek;
|
|
29
30
|
const isInMaxWeek = isInMaxYear && selectedWeek === maxWeek;
|
|
30
31
|
const selectedYearWeeks = dayjs(`${selectedYear}-01-01`).isoWeeksInYear();
|
|
@@ -50,7 +51,9 @@ export function generateDatePickerColumns(selected, min, max, precision, renderL
|
|
|
50
51
|
const upper = maxYear;
|
|
51
52
|
const years = generateColumn(lower, upper, 'year');
|
|
52
53
|
ret.push(years.map(v => ({
|
|
53
|
-
label: renderLabel('year', v
|
|
54
|
+
label: renderLabel('year', v, {
|
|
55
|
+
selected: selectedYear === v
|
|
56
|
+
}),
|
|
54
57
|
value: v.toString()
|
|
55
58
|
})));
|
|
56
59
|
}
|
|
@@ -59,7 +62,9 @@ export function generateDatePickerColumns(selected, min, max, precision, renderL
|
|
|
59
62
|
const upper = isInMaxYear ? maxWeek : selectedYearWeeks;
|
|
60
63
|
const weeks = generateColumn(lower, upper, 'week');
|
|
61
64
|
ret.push(weeks.map(v => ({
|
|
62
|
-
label: renderLabel('week', v
|
|
65
|
+
label: renderLabel('week', v, {
|
|
66
|
+
selected: selectedWeek === v
|
|
67
|
+
}),
|
|
63
68
|
value: v.toString()
|
|
64
69
|
})));
|
|
65
70
|
}
|
|
@@ -68,7 +73,9 @@ export function generateDatePickerColumns(selected, min, max, precision, renderL
|
|
|
68
73
|
const upper = isInMaxWeek ? maxWeekday : 7;
|
|
69
74
|
const weeks = generateColumn(lower, upper, 'week-day');
|
|
70
75
|
ret.push(weeks.map(v => ({
|
|
71
|
-
label: renderLabel('week-day', v
|
|
76
|
+
label: renderLabel('week-day', v, {
|
|
77
|
+
selected: selectedWeekday === v
|
|
78
|
+
}),
|
|
72
79
|
value: v.toString()
|
|
73
80
|
})));
|
|
74
81
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { FC, ReactNode } from 'react';
|
|
2
|
-
import type { PickerViewProps } from '../picker-view';
|
|
3
2
|
import { NativeProps } from '../../utils/native-props';
|
|
4
|
-
import type {
|
|
3
|
+
import type { DatePickerFilter, Precision } from '../date-picker/date-picker-utils';
|
|
5
4
|
import type { PickerDate } from '../date-picker/util';
|
|
6
|
-
|
|
5
|
+
import type { PickerViewProps } from '../picker-view';
|
|
6
|
+
export declare type RenderLabel = (type: Precision | 'now', data: number, info: {
|
|
7
|
+
selected: boolean;
|
|
8
|
+
}) => ReactNode;
|
|
7
9
|
export declare type DatePickerViewProps = Pick<PickerViewProps, 'style' | 'mouseWheel' | 'loading' | 'loadingContent'> & {
|
|
8
10
|
value?: PickerDate;
|
|
9
11
|
defaultValue?: PickerDate;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React, { useCallback, useMemo } from 'react';
|
|
2
|
-
import PickerView from '../picker-view';
|
|
3
2
|
import { withNativeProps } from '../../utils/native-props';
|
|
4
|
-
import { mergeProps } from '../../utils/with-default-props';
|
|
5
3
|
import { usePropsValue } from '../../utils/use-props-value';
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
4
|
+
import { mergeProps } from '../../utils/with-default-props';
|
|
5
|
+
import { convertDateToStringArray, convertStringArrayToDate, generateDatePickerColumns } from '../date-picker/date-picker-utils';
|
|
8
6
|
import { TILL_NOW } from '../date-picker/util';
|
|
7
|
+
import PickerView from '../picker-view';
|
|
8
|
+
import useRenderLabel from './useRenderLabel';
|
|
9
9
|
const thisYear = new Date().getFullYear();
|
|
10
10
|
const defaultProps = {
|
|
11
11
|
min: new Date(new Date().setFullYear(thisYear - 10)),
|
|
@@ -4,9 +4,9 @@ export default function useRenderLabel(renderLabel) {
|
|
|
4
4
|
const {
|
|
5
5
|
locale
|
|
6
6
|
} = useConfig();
|
|
7
|
-
return useCallback((type, data) => {
|
|
7
|
+
return useCallback((type, data, info) => {
|
|
8
8
|
if (renderLabel) {
|
|
9
|
-
return renderLabel(type, data);
|
|
9
|
+
return renderLabel(type, data, info);
|
|
10
10
|
}
|
|
11
11
|
// Default render
|
|
12
12
|
switch (type) {
|
|
@@ -14,5 +14,5 @@ export declare type NumberKeyboardProps = {
|
|
|
14
14
|
onConfirm?: () => void;
|
|
15
15
|
closeOnConfirm?: boolean;
|
|
16
16
|
safeArea?: boolean;
|
|
17
|
-
} & Pick<PopupProps, 'afterClose' | 'afterShow' | 'getContainer' | 'destroyOnClose' | 'forceRender' | 'stopPropagation'> & NativeProps
|
|
17
|
+
} & Pick<PopupProps, 'afterClose' | 'afterShow' | 'getContainer' | 'destroyOnClose' | 'forceRender' | 'stopPropagation'> & NativeProps<'--adm-safe-area-multiple'>;
|
|
18
18
|
export declare const NumberKeyboard: FC<NumberKeyboardProps>;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
children?: ReactNode;
|
|
5
|
-
}, {}> {
|
|
6
|
-
element: Element | null;
|
|
7
|
-
componentDidMount(): void;
|
|
8
|
-
componentDidUpdate(): void;
|
|
9
|
-
render(): React.ReactNode;
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface WrapperRef {
|
|
3
|
+
element: HTMLElement;
|
|
10
4
|
}
|
|
5
|
+
export declare const Wrapper: React.ForwardRefExoticComponent<{
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
} & React.RefAttributes<WrapperRef>>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import findDOMNode, { getDOM } from 'rc-util/lib/Dom/findDOMNode';
|
|
2
|
+
import { composeRef, getNodeRef, supportRef } from 'rc-util/lib/ref';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
class LegacyWrapper extends React.Component {
|
|
4
5
|
constructor() {
|
|
5
6
|
super(...arguments);
|
|
6
7
|
this.element = null;
|
|
@@ -18,6 +19,30 @@ export class Wrapper extends React.Component {
|
|
|
18
19
|
}
|
|
19
20
|
}
|
|
20
21
|
render() {
|
|
21
|
-
return
|
|
22
|
+
return this.props.children;
|
|
22
23
|
}
|
|
23
|
-
}
|
|
24
|
+
}
|
|
25
|
+
export const Wrapper = React.forwardRef(({
|
|
26
|
+
children
|
|
27
|
+
}, ref) => {
|
|
28
|
+
const elementRef = React.useRef(null);
|
|
29
|
+
const legacyWrapperRef = React.createRef();
|
|
30
|
+
const child = React.Children.only(children);
|
|
31
|
+
const canUseRef = supportRef(children);
|
|
32
|
+
const getElement = () => {
|
|
33
|
+
var _a;
|
|
34
|
+
if (canUseRef) {
|
|
35
|
+
return getDOM(elementRef.current);
|
|
36
|
+
}
|
|
37
|
+
return (_a = legacyWrapperRef.current) === null || _a === void 0 ? void 0 : _a.element;
|
|
38
|
+
};
|
|
39
|
+
React.useImperativeHandle(ref, () => ({
|
|
40
|
+
element: getElement()
|
|
41
|
+
}));
|
|
42
|
+
const composedRef = composeRef(elementRef, getNodeRef(child));
|
|
43
|
+
return canUseRef ? React.cloneElement(child, {
|
|
44
|
+
ref: composedRef
|
|
45
|
+
}) : React.createElement(LegacyWrapper, {
|
|
46
|
+
ref: legacyWrapperRef
|
|
47
|
+
}, child);
|
|
48
|
+
});
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
.adm-space-horizontal {
|
|
20
20
|
flex-direction: row;
|
|
21
21
|
}
|
|
22
|
+
.adm-space-horizontal:not(:empty) {
|
|
23
|
+
margin-right: calc(var(--gap-horizontal) * -1);
|
|
24
|
+
}
|
|
22
25
|
.adm-space-horizontal > .adm-space-item {
|
|
23
26
|
margin-right: var(--gap-horizontal);
|
|
24
27
|
}
|
|
25
|
-
.adm-space-horizontal > .adm-space-item:last-child {
|
|
26
|
-
margin-right: 0;
|
|
27
|
-
}
|
|
28
28
|
.adm-space-horizontal.adm-space-wrap {
|
|
29
29
|
flex-wrap: wrap;
|
|
30
30
|
margin-bottom: calc(var(--gap-vertical) * -1);
|
|
@@ -26,8 +26,10 @@
|
|
|
26
26
|
z-index: 1;
|
|
27
27
|
width: 100%;
|
|
28
28
|
max-width: 100%;
|
|
29
|
+
min-height: 1.5em;
|
|
29
30
|
overflow-y: hidden;
|
|
30
31
|
overflow-x: scroll;
|
|
32
|
+
letter-spacing: 1px;
|
|
31
33
|
scrollbar-width: none;
|
|
32
34
|
}
|
|
33
35
|
.adm-virtual-input-content::-webkit-scrollbar {
|
|
@@ -50,6 +52,7 @@
|
|
|
50
52
|
height: 1.3em;
|
|
51
53
|
vertical-align: top;
|
|
52
54
|
margin-right: 1px;
|
|
55
|
+
position: absolute;
|
|
53
56
|
}
|
|
54
57
|
.adm-virtual-input-caret {
|
|
55
58
|
width: 100%;
|
|
@@ -20,6 +20,7 @@ export const VirtualInput = forwardRef((props, ref) => {
|
|
|
20
20
|
const rootRef = useRef(null);
|
|
21
21
|
const contentRef = useRef(null);
|
|
22
22
|
const [hasFocus, setHasFocus] = useState(false);
|
|
23
|
+
const [caretPosition, setCaretPosition] = useState(value.length); // 光标位置,从 0 开始,如值是 2 则表示光标在顺序下标为 2 的数字之前
|
|
23
24
|
const clearIcon = mergeProp(React.createElement(CloseCircleFill, null), componentConfig.clearIcon, props.clearIcon);
|
|
24
25
|
function scrollToEnd() {
|
|
25
26
|
const root = rootRef.current;
|
|
@@ -63,12 +64,17 @@ export const VirtualInput = forwardRef((props, ref) => {
|
|
|
63
64
|
const keyboardElement = keyboard && React.cloneElement(keyboard, {
|
|
64
65
|
onInput: v => {
|
|
65
66
|
var _a, _b;
|
|
66
|
-
|
|
67
|
+
const newValue = value.substring(0, caretPosition) + v + value.substring(caretPosition);
|
|
68
|
+
setValue(newValue);
|
|
69
|
+
setCaretPosition(c => c + 1);
|
|
67
70
|
(_b = (_a = keyboard.props).onInput) === null || _b === void 0 ? void 0 : _b.call(_a, v);
|
|
68
71
|
},
|
|
69
72
|
onDelete: () => {
|
|
70
73
|
var _a, _b;
|
|
71
|
-
|
|
74
|
+
if (caretPosition === 0) return;
|
|
75
|
+
const newValue = value.substring(0, caretPosition - 1) + value.substring(caretPosition);
|
|
76
|
+
setValue(newValue);
|
|
77
|
+
setCaretPosition(caretPosition - 1);
|
|
72
78
|
(_b = (_a = keyboard.props).onDelete) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
73
79
|
},
|
|
74
80
|
visible: hasFocus,
|
|
@@ -86,6 +92,21 @@ export const VirtualInput = forwardRef((props, ref) => {
|
|
|
86
92
|
},
|
|
87
93
|
getContainer: null
|
|
88
94
|
});
|
|
95
|
+
// 点击输入框时,将光标置于最后
|
|
96
|
+
const setCaretPositionToEnd = () => {
|
|
97
|
+
setCaretPosition(value.length);
|
|
98
|
+
};
|
|
99
|
+
// 点击单个字符时,根据点击位置置于字符前或后
|
|
100
|
+
const changeCaretPosition = index => e => {
|
|
101
|
+
e.stopPropagation();
|
|
102
|
+
const rect = e.target.getBoundingClientRect();
|
|
103
|
+
const midX = rect.left + rect.width / 2;
|
|
104
|
+
const clickX = e.clientX;
|
|
105
|
+
// 点击区域是否偏右
|
|
106
|
+
const isRight = clickX > midX;
|
|
107
|
+
setCaretPosition(isRight ? index + 1 : index);
|
|
108
|
+
};
|
|
109
|
+
const chars = (value + '').split('');
|
|
89
110
|
return withNativeProps(mergedProps, React.createElement("div", {
|
|
90
111
|
ref: rootRef,
|
|
91
112
|
className: classNames(classPrefix, {
|
|
@@ -100,17 +121,25 @@ export const VirtualInput = forwardRef((props, ref) => {
|
|
|
100
121
|
className: `${classPrefix}-content`,
|
|
101
122
|
ref: contentRef,
|
|
102
123
|
"aria-disabled": mergedProps.disabled,
|
|
103
|
-
"aria-label": mergedProps.placeholder
|
|
104
|
-
|
|
124
|
+
"aria-label": mergedProps.placeholder,
|
|
125
|
+
onClick: setCaretPositionToEnd
|
|
126
|
+
}, chars.slice(0, caretPosition).map((i, index) => React.createElement("span", {
|
|
127
|
+
key: index,
|
|
128
|
+
onClick: changeCaretPosition(index)
|
|
129
|
+
}, i)), React.createElement("div", {
|
|
105
130
|
className: `${classPrefix}-caret-container`
|
|
106
131
|
}, hasFocus && React.createElement("div", {
|
|
107
132
|
className: `${classPrefix}-caret`
|
|
108
|
-
}))
|
|
133
|
+
})), chars.slice(caretPosition).map((i, index) => React.createElement("span", {
|
|
134
|
+
key: index,
|
|
135
|
+
onClick: changeCaretPosition(index + caretPosition)
|
|
136
|
+
}, i))), mergedProps.clearable && !!value && hasFocus && React.createElement("div", {
|
|
109
137
|
className: `${classPrefix}-clear`,
|
|
110
138
|
onClick: e => {
|
|
111
139
|
var _a;
|
|
112
140
|
e.stopPropagation();
|
|
113
141
|
setValue('');
|
|
142
|
+
setCaretPosition(0);
|
|
114
143
|
(_a = mergedProps.onClear) === null || _a === void 0 ? void 0 : _a.call(mergedProps);
|
|
115
144
|
},
|
|
116
145
|
role: 'button',
|
package/es/index.d.ts
CHANGED
|
@@ -168,3 +168,4 @@ export { default as Footer } from './components/footer';
|
|
|
168
168
|
export type { FooterProps } from './components/footer';
|
|
169
169
|
export { createErrorBlock } from './components/error-block';
|
|
170
170
|
export { reduceMotion, restoreMotion } from './utils/reduce-and-restore-motion';
|
|
171
|
+
export { unstableSetRender } from './utils/unstable-render';
|
package/es/index.js
CHANGED
|
@@ -84,4 +84,6 @@ export { default as VirtualInput } from './components/virtual-input';
|
|
|
84
84
|
export { default as WaterMark } from './components/water-mark';
|
|
85
85
|
export { default as Footer } from './components/footer';
|
|
86
86
|
export { createErrorBlock } from './components/error-block';
|
|
87
|
-
export { reduceMotion, restoreMotion } from './utils/reduce-and-restore-motion';
|
|
87
|
+
export { reduceMotion, restoreMotion } from './utils/reduce-and-restore-motion';
|
|
88
|
+
// compatible
|
|
89
|
+
export { unstableSetRender } from './utils/unstable-render';
|
package/es/locales/ar-SA.d.ts
CHANGED
package/es/locales/ar-SA.js
CHANGED
|
@@ -14,6 +14,7 @@ const arSA = mergeLocale(base, {
|
|
|
14
14
|
'confirm': 'تأكيد',
|
|
15
15
|
'start': 'يبدأ',
|
|
16
16
|
'end': 'ينهي',
|
|
17
|
+
'startAndEnd': 'يبدأ/ينهي',
|
|
17
18
|
'today': 'اليوم',
|
|
18
19
|
'markItems': ['واحد', 'اثنين', 'ثلاثة', 'أربعة', 'خمسة', 'ستة', 'يوم'],
|
|
19
20
|
'yearAndMonth': '${year} سنة ${month} شهر'
|
package/es/locales/base.d.ts
CHANGED
package/es/locales/base.js
CHANGED
package/es/locales/cnr-ME.d.ts
CHANGED
package/es/locales/cnr-ME.js
CHANGED
package/es/locales/da-DK.d.ts
CHANGED
package/es/locales/de-DE.d.ts
CHANGED
package/es/locales/de-DE.js
CHANGED
|
@@ -14,6 +14,7 @@ const deDE = mergeLocale(base, {
|
|
|
14
14
|
'confirm': 'Bestätigen',
|
|
15
15
|
'start': 'Starten',
|
|
16
16
|
'end': 'Beenden',
|
|
17
|
+
'startAndEnd': 'Starten/Beenden',
|
|
17
18
|
'today': 'Heute',
|
|
18
19
|
'markItems': ['I', 'II', 'III', 'IV', 'V', 'Sechs', 'Tag'],
|
|
19
20
|
'yearAndMonth': '${year}Jahr${month}Monat'
|
package/es/locales/en-US.d.ts
CHANGED
package/es/locales/es-ES.d.ts
CHANGED
package/es/locales/fa-IR.d.ts
CHANGED
package/es/locales/fr-FR.d.ts
CHANGED
package/es/locales/hr-HR.d.ts
CHANGED
package/es/locales/hr-HR.js
CHANGED
package/es/locales/hu-HU.d.ts
CHANGED
package/es/locales/id-ID.d.ts
CHANGED
package/es/locales/in-ID.d.ts
CHANGED
package/es/locales/in-ID.js
CHANGED
|
@@ -14,6 +14,7 @@ const inID = mergeLocale(base, {
|
|
|
14
14
|
confirm: 'OK',
|
|
15
15
|
start: 'Mulai',
|
|
16
16
|
end: 'Selesai',
|
|
17
|
+
startAndEnd: 'Mulai/Selesai',
|
|
17
18
|
today: 'Hari Ini',
|
|
18
19
|
markItems: ['Senin', 'Selasa', 'Rabu', 'Kamis', 'Jumat', 'Sabtu', 'Minggu'],
|
|
19
20
|
yearAndMonth: '${year} Tahun ${month} Bulan'
|
package/es/locales/it-IT.d.ts
CHANGED
package/es/locales/ja-JP.d.ts
CHANGED
package/es/locales/kk-KZ.d.ts
CHANGED
package/es/locales/ko-KR.d.ts
CHANGED
package/es/locales/ms-MY.d.ts
CHANGED
package/es/locales/ms-MY.js
CHANGED
|
@@ -14,6 +14,7 @@ const msMY = mergeLocale(base, {
|
|
|
14
14
|
'confirm': 'Ok',
|
|
15
15
|
'start': 'Mula',
|
|
16
16
|
'end': 'Tamat',
|
|
17
|
+
'startAndEnd': 'Mula/Tamat',
|
|
17
18
|
'today': 'Hari ini',
|
|
18
19
|
'markItems': ['Satu', 'Dua', 'Tiga', 'Empat', 'Lima', 'Enam', 'Hari'],
|
|
19
20
|
'yearAndMonth': 'Tahun${year} bulan ${month}'
|
package/es/locales/nb-NO.d.ts
CHANGED
package/es/locales/nl-NL.d.ts
CHANGED
package/es/locales/pt-BR.d.ts
CHANGED
package/es/locales/ru-RU.d.ts
CHANGED
package/es/locales/ru-RU.js
CHANGED
|
@@ -10,6 +10,12 @@ const ruRU = mergeLocale(base, {
|
|
|
10
10
|
close: 'Закрыть'
|
|
11
11
|
},
|
|
12
12
|
Calendar: {
|
|
13
|
+
title: 'Выбор даты',
|
|
14
|
+
confirm: 'Подтвердить',
|
|
15
|
+
start: 'начало',
|
|
16
|
+
end: 'конец',
|
|
17
|
+
startAndEnd: 'начало/конец',
|
|
18
|
+
today: 'сегодня',
|
|
13
19
|
markItems: ['Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб', 'Вс'],
|
|
14
20
|
yearAndMonth: '${year}/${month}'
|
|
15
21
|
},
|
|
@@ -113,9 +119,9 @@ const ruRU = mergeLocale(base, {
|
|
|
113
119
|
name: 'Ввод пароля'
|
|
114
120
|
},
|
|
115
121
|
PullToRefresh: {
|
|
116
|
-
pulling: 'Прокрутите вниз, чтобы
|
|
122
|
+
pulling: 'Прокрутите вниз, чтобы обновить',
|
|
117
123
|
canRelease: 'Отпустите, чтобы немедленно обновить',
|
|
118
|
-
complete: '
|
|
124
|
+
complete: 'Обновлено успешно'
|
|
119
125
|
},
|
|
120
126
|
SearchBar: {
|
|
121
127
|
name: 'Панель поиска'
|
package/es/locales/sr-RS.d.ts
CHANGED
package/es/locales/sr-RS.js
CHANGED
package/es/locales/th-TH.d.ts
CHANGED
package/es/locales/th-TH.js
CHANGED
|
@@ -14,6 +14,7 @@ const thTH = mergeLocale(base, {
|
|
|
14
14
|
confirm: 'ยืนยัน',
|
|
15
15
|
start: 'เริ่ม',
|
|
16
16
|
end: 'เสร็จ',
|
|
17
|
+
startAndEnd: 'เริ่ม/เสร็จ',
|
|
17
18
|
today: 'วันนี้',
|
|
18
19
|
markItems: ['วันจันทร์', 'วันอังคาร', 'วันพุธ', 'วันพฤหัสบดี', 'วันศุกร์', 'วันเสาร์', 'วันอาทิตย์'],
|
|
19
20
|
yearAndMonth: '${year}/${month}'
|
package/es/locales/tr-TR.d.ts
CHANGED
package/es/locales/vi-VN.d.ts
CHANGED
package/es/locales/vi-VN.js
CHANGED
|
@@ -14,6 +14,7 @@ const viVN = mergeLocale(base, {
|
|
|
14
14
|
'confirm': 'Xác nhận',
|
|
15
15
|
'start': 'Bắt đầu',
|
|
16
16
|
'end': 'Kết thúc',
|
|
17
|
+
'startAndEnd': 'Bắt đầu/Kết thúc',
|
|
17
18
|
'today': 'Hôm nay',
|
|
18
19
|
'markItems': ['Một', 'Hai', 'Ba', 'Bốn', 'Năm', 'Sáu', 'Ngày'],
|
|
19
20
|
'yearAndMonth': 'Tháng ${month} năm ${year}'
|