antd-mobile 5.17.1 → 5.19.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/bundle/antd-mobile.cjs.js +47 -19173
- package/2x/bundle/antd-mobile.compatible.umd.js +25752 -0
- package/2x/bundle/antd-mobile.es.js +16416 -17055
- package/2x/bundle/antd-mobile.umd.js +64 -0
- package/2x/bundle/style.css +240 -277
- package/2x/cjs/components/action-sheet/action-sheet.d.ts +1 -1
- package/2x/cjs/components/button/button.js +1 -1
- package/2x/cjs/components/calendar/calendar.d.ts +3 -3
- package/2x/cjs/components/calendar/index.d.ts +1 -1
- package/2x/cjs/components/cascader/cascader.d.ts +2 -0
- package/2x/cjs/components/cascader/index.d.ts +1 -0
- package/2x/cjs/components/cascader-view/cascader-view.d.ts +2 -1
- package/2x/cjs/components/cascader-view/cascader-view.js +2 -1
- package/2x/cjs/components/dialog/show.d.ts +1 -1
- package/2x/cjs/components/floating-panel/floating-panel.css +4 -4
- package/2x/cjs/components/form/form-item.js +6 -4
- package/2x/cjs/components/image-viewer/slide.js +75 -56
- package/2x/cjs/components/input/input.js +9 -2
- package/2x/cjs/components/modal/show.d.ts +1 -1
- package/2x/cjs/components/notice-bar/notice-bar.css +9 -0
- package/2x/cjs/components/notice-bar/notice-bar.js +5 -3
- package/2x/cjs/components/number-keyboard/number-keyboard.css +11 -15
- package/2x/cjs/components/number-keyboard/number-keyboard.d.ts +1 -1
- package/2x/cjs/components/number-keyboard/number-keyboard.js +19 -17
- package/2x/cjs/components/passcode-input/index.d.ts +1 -1
- package/2x/cjs/components/passcode-input/passcode-input.css +12 -12
- package/2x/cjs/components/passcode-input/passcode-input.js +16 -8
- package/2x/cjs/components/picker-view/wheel.js +1 -1
- package/2x/cjs/components/rate/rate.js +7 -2
- package/2x/cjs/components/rate/star.js +0 -10
- package/2x/cjs/components/result/result.d.ts +1 -1
- package/2x/cjs/components/result/result.js +7 -1
- package/2x/cjs/components/search-bar/search-bar.js +12 -2
- package/2x/cjs/components/switch/switch.d.ts +2 -1
- package/2x/cjs/components/switch/switch.js +16 -3
- package/2x/cjs/components/text-area/text-area.js +1 -0
- package/2x/cjs/locales/base.d.ts +9 -0
- package/2x/cjs/locales/base.js +9 -0
- package/2x/cjs/locales/en-US.d.ts +9 -0
- package/2x/cjs/locales/es-ES.d.ts +9 -0
- package/2x/cjs/locales/fa-IR.d.ts +9 -0
- package/2x/cjs/locales/fr-FR.d.ts +9 -0
- package/2x/cjs/locales/id-ID.d.ts +9 -0
- package/2x/cjs/locales/kk-KZ.d.ts +9 -0
- package/2x/cjs/locales/ko-KR.d.ts +9 -0
- package/2x/cjs/locales/zh-CN.d.ts +9 -0
- package/2x/cjs/locales/zh-CN.js +9 -0
- package/2x/cjs/locales/zh-HK.d.ts +9 -0
- package/2x/cjs/locales/zh-TW.d.ts +9 -0
- package/2x/cjs/utils/matrix.d.ts +10 -0
- package/2x/cjs/utils/matrix.js +60 -0
- package/2x/cjs/utils/merge-locale.d.ts +1 -1
- package/2x/cjs/utils/merge-locale.js +15 -5
- package/2x/cjs/utils/use-drag-and-pinch.d.ts +1 -1
- package/2x/cjs/utils/use-props-value.js +1 -1
- package/2x/cjs/utils/with-default-props.js +2 -6
- package/2x/es/components/action-sheet/action-sheet.d.ts +1 -1
- package/2x/es/components/button/button.js +1 -1
- package/2x/es/components/calendar/calendar.d.ts +3 -3
- package/2x/es/components/calendar/index.d.ts +1 -1
- package/2x/es/components/cascader/cascader.d.ts +2 -0
- package/2x/es/components/cascader/index.d.ts +1 -0
- package/2x/es/components/cascader-view/cascader-view.d.ts +2 -1
- package/2x/es/components/cascader-view/cascader-view.js +2 -1
- package/2x/es/components/dialog/show.d.ts +1 -1
- package/2x/es/components/floating-panel/floating-panel.css +4 -4
- package/2x/es/components/form/form-item.js +5 -4
- package/2x/es/components/image-viewer/slide.js +73 -56
- package/2x/es/components/input/input.js +8 -2
- package/2x/es/components/modal/show.d.ts +1 -1
- package/2x/es/components/notice-bar/notice-bar.css +9 -0
- package/2x/es/components/notice-bar/notice-bar.js +5 -3
- package/2x/es/components/number-keyboard/number-keyboard.css +11 -15
- package/2x/es/components/number-keyboard/number-keyboard.d.ts +1 -1
- package/2x/es/components/number-keyboard/number-keyboard.js +19 -17
- package/2x/es/components/passcode-input/index.d.ts +1 -1
- package/2x/es/components/passcode-input/passcode-input.css +12 -12
- package/2x/es/components/passcode-input/passcode-input.js +15 -8
- package/2x/es/components/picker-view/wheel.js +1 -1
- package/2x/es/components/rate/rate.js +7 -2
- package/2x/es/components/rate/star.js +0 -10
- package/2x/es/components/result/result.d.ts +1 -1
- package/2x/es/components/result/result.js +6 -1
- package/2x/es/components/search-bar/search-bar.js +12 -2
- package/2x/es/components/switch/switch.d.ts +2 -1
- package/2x/es/components/switch/switch.js +15 -3
- package/2x/es/components/text-area/text-area.js +1 -0
- package/2x/es/locales/base.d.ts +9 -0
- package/2x/es/locales/base.js +9 -0
- package/2x/es/locales/en-US.d.ts +9 -0
- package/2x/es/locales/es-ES.d.ts +9 -0
- package/2x/es/locales/fa-IR.d.ts +9 -0
- package/2x/es/locales/fr-FR.d.ts +9 -0
- package/2x/es/locales/id-ID.d.ts +9 -0
- package/2x/es/locales/kk-KZ.d.ts +9 -0
- package/2x/es/locales/ko-KR.d.ts +9 -0
- package/2x/es/locales/zh-CN.d.ts +9 -0
- package/2x/es/locales/zh-CN.js +9 -0
- package/2x/es/locales/zh-HK.d.ts +9 -0
- package/2x/es/locales/zh-TW.d.ts +9 -0
- package/2x/es/utils/matrix.d.ts +10 -0
- package/2x/es/utils/matrix.js +27 -0
- package/2x/es/utils/merge-locale.d.ts +1 -1
- package/2x/es/utils/merge-locale.js +17 -3
- package/2x/es/utils/use-drag-and-pinch.d.ts +1 -1
- package/2x/es/utils/use-props-value.js +1 -1
- package/2x/es/utils/with-default-props.js +2 -4
- package/2x/package.json +4 -4
- package/2x/umd/antd-mobile.js +25752 -2
- package/bundle/antd-mobile.cjs.js +47 -19173
- package/bundle/antd-mobile.compatible.umd.js +25752 -0
- package/bundle/antd-mobile.es.js +16416 -17055
- package/bundle/antd-mobile.umd.js +64 -0
- package/bundle/style.css +1 -4080
- package/cjs/components/action-sheet/action-sheet.d.ts +1 -1
- package/cjs/components/button/button.js +1 -1
- package/cjs/components/calendar/calendar.d.ts +3 -3
- package/cjs/components/calendar/index.d.ts +1 -1
- package/cjs/components/cascader/cascader.d.ts +2 -0
- package/cjs/components/cascader/index.d.ts +1 -0
- package/cjs/components/cascader-view/cascader-view.d.ts +2 -1
- package/cjs/components/cascader-view/cascader-view.js +2 -1
- package/cjs/components/dialog/show.d.ts +1 -1
- package/cjs/components/floating-panel/floating-panel.css +4 -4
- package/cjs/components/form/form-item.js +6 -4
- package/cjs/components/image-viewer/slide.js +75 -56
- package/cjs/components/input/input.js +9 -2
- package/cjs/components/modal/show.d.ts +1 -1
- package/cjs/components/notice-bar/notice-bar.css +8 -0
- package/cjs/components/notice-bar/notice-bar.js +5 -3
- package/cjs/components/number-keyboard/number-keyboard.css +11 -14
- package/cjs/components/number-keyboard/number-keyboard.d.ts +1 -1
- package/cjs/components/number-keyboard/number-keyboard.js +19 -17
- package/cjs/components/passcode-input/index.d.ts +1 -1
- package/cjs/components/passcode-input/passcode-input.css +12 -12
- package/cjs/components/passcode-input/passcode-input.js +16 -8
- package/cjs/components/picker-view/wheel.js +1 -1
- package/cjs/components/rate/rate.js +7 -2
- package/cjs/components/rate/star.js +0 -10
- package/cjs/components/result/result.d.ts +1 -1
- package/cjs/components/result/result.js +7 -1
- package/cjs/components/search-bar/search-bar.js +12 -2
- package/cjs/components/switch/switch.d.ts +2 -1
- package/cjs/components/switch/switch.js +16 -3
- package/cjs/components/text-area/text-area.js +1 -0
- package/cjs/locales/base.d.ts +9 -0
- package/cjs/locales/base.js +9 -0
- package/cjs/locales/en-US.d.ts +9 -0
- package/cjs/locales/es-ES.d.ts +9 -0
- package/cjs/locales/fa-IR.d.ts +9 -0
- package/cjs/locales/fr-FR.d.ts +9 -0
- package/cjs/locales/id-ID.d.ts +9 -0
- package/cjs/locales/kk-KZ.d.ts +9 -0
- package/cjs/locales/ko-KR.d.ts +9 -0
- package/cjs/locales/zh-CN.d.ts +9 -0
- package/cjs/locales/zh-CN.js +9 -0
- package/cjs/locales/zh-HK.d.ts +9 -0
- package/cjs/locales/zh-TW.d.ts +9 -0
- package/cjs/utils/matrix.d.ts +10 -0
- package/cjs/utils/matrix.js +60 -0
- package/cjs/utils/merge-locale.d.ts +1 -1
- package/cjs/utils/merge-locale.js +15 -5
- package/cjs/utils/use-drag-and-pinch.d.ts +1 -1
- package/cjs/utils/use-props-value.js +1 -1
- package/cjs/utils/with-default-props.js +2 -6
- package/es/components/action-sheet/action-sheet.d.ts +1 -1
- package/es/components/button/button.js +1 -1
- package/es/components/calendar/calendar.d.ts +3 -3
- package/es/components/calendar/index.d.ts +1 -1
- package/es/components/cascader/cascader.d.ts +2 -0
- package/es/components/cascader/index.d.ts +1 -0
- package/es/components/cascader-view/cascader-view.d.ts +2 -1
- package/es/components/cascader-view/cascader-view.js +2 -1
- package/es/components/dialog/show.d.ts +1 -1
- package/es/components/floating-panel/floating-panel.css +4 -4
- package/es/components/form/form-item.js +5 -4
- package/es/components/image-viewer/slide.js +73 -56
- package/es/components/input/input.js +8 -2
- package/es/components/modal/show.d.ts +1 -1
- package/es/components/notice-bar/notice-bar.css +8 -0
- package/es/components/notice-bar/notice-bar.js +5 -3
- package/es/components/number-keyboard/number-keyboard.css +11 -14
- package/es/components/number-keyboard/number-keyboard.d.ts +1 -1
- package/es/components/number-keyboard/number-keyboard.js +19 -17
- package/es/components/passcode-input/index.d.ts +1 -1
- package/es/components/passcode-input/passcode-input.css +12 -12
- package/es/components/passcode-input/passcode-input.js +15 -8
- package/es/components/picker-view/wheel.js +1 -1
- package/es/components/rate/rate.js +7 -2
- package/es/components/rate/star.js +0 -10
- package/es/components/result/result.d.ts +1 -1
- package/es/components/result/result.js +6 -1
- package/es/components/search-bar/search-bar.js +12 -2
- package/es/components/switch/switch.d.ts +2 -1
- package/es/components/switch/switch.js +15 -3
- package/es/components/text-area/text-area.js +1 -0
- package/es/locales/base.d.ts +9 -0
- package/es/locales/base.js +9 -0
- package/es/locales/en-US.d.ts +9 -0
- package/es/locales/es-ES.d.ts +9 -0
- package/es/locales/fa-IR.d.ts +9 -0
- package/es/locales/fr-FR.d.ts +9 -0
- package/es/locales/id-ID.d.ts +9 -0
- package/es/locales/kk-KZ.d.ts +9 -0
- package/es/locales/ko-KR.d.ts +9 -0
- package/es/locales/zh-CN.d.ts +9 -0
- package/es/locales/zh-CN.js +9 -0
- package/es/locales/zh-HK.d.ts +9 -0
- package/es/locales/zh-TW.d.ts +9 -0
- package/es/utils/matrix.d.ts +10 -0
- package/es/utils/matrix.js +27 -0
- package/es/utils/merge-locale.d.ts +1 -1
- package/es/utils/merge-locale.js +17 -3
- package/es/utils/use-drag-and-pinch.d.ts +1 -1
- package/es/utils/use-props-value.js +1 -1
- package/es/utils/with-default-props.js +2 -4
- package/package.json +4 -4
- package/umd/antd-mobile.js +1 -1
- package/2x/umd/antd-mobile.js.LICENSE.txt +0 -35
|
@@ -7,6 +7,7 @@ import classNames from 'classnames';
|
|
|
7
7
|
import { useIsomorphicLayoutEffect } from 'ahooks';
|
|
8
8
|
import { bound } from '../../utils/bound';
|
|
9
9
|
import { isIOS } from '../../utils/validate';
|
|
10
|
+
import { useConfig } from '../config-provider';
|
|
10
11
|
const classPrefix = `adm-input`;
|
|
11
12
|
const defaultProps = {
|
|
12
13
|
defaultValue: '',
|
|
@@ -18,6 +19,9 @@ export const Input = forwardRef((p, ref) => {
|
|
|
18
19
|
const [hasFocus, setHasFocus] = useState(false);
|
|
19
20
|
const compositionStartRef = useRef(false);
|
|
20
21
|
const nativeInputRef = useRef(null);
|
|
22
|
+
const {
|
|
23
|
+
locale
|
|
24
|
+
} = useConfig();
|
|
21
25
|
useImperativeHandle(ref, () => ({
|
|
22
26
|
clear: () => {
|
|
23
27
|
setValue('');
|
|
@@ -139,7 +143,8 @@ export const Input = forwardRef((p, ref) => {
|
|
|
139
143
|
role: props.role,
|
|
140
144
|
"aria-valuenow": props['aria-valuenow'],
|
|
141
145
|
"aria-valuemax": props['aria-valuemax'],
|
|
142
|
-
"aria-valuemin": props['aria-valuemin']
|
|
146
|
+
"aria-valuemin": props['aria-valuemin'],
|
|
147
|
+
"aria-label": props['aria-label']
|
|
143
148
|
}), shouldShowClear && React.createElement("div", {
|
|
144
149
|
className: `${classPrefix}-clear`,
|
|
145
150
|
onMouseDown: e => {
|
|
@@ -155,6 +160,7 @@ export const Input = forwardRef((p, ref) => {
|
|
|
155
160
|
compositionStartRef.current = false;
|
|
156
161
|
(_b = nativeInputRef.current) === null || _b === void 0 ? void 0 : _b.blur();
|
|
157
162
|
}
|
|
158
|
-
}
|
|
163
|
+
},
|
|
164
|
+
"aria-label": locale.Input.clear
|
|
159
165
|
}, React.createElement(CloseCircleFill, null))));
|
|
160
166
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ModalProps } from './modal';
|
|
2
|
-
export declare type ModalShowProps = Omit<ModalProps, 'visible'>;
|
|
2
|
+
export declare type ModalShowProps = Omit<ModalProps, 'visible' | 'destroyOnClose' | 'forceRender'>;
|
|
3
3
|
export declare type ModalShowHandler = {
|
|
4
4
|
close: () => void;
|
|
5
5
|
};
|
|
@@ -70,6 +70,15 @@
|
|
|
70
70
|
margin-left: 24px;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
.adm-notice-bar-close {
|
|
74
|
+
width: 48px;
|
|
75
|
+
height: 48px;
|
|
76
|
+
margin-right: -6px;
|
|
77
|
+
display: flex;
|
|
78
|
+
align-items: center;
|
|
79
|
+
justify-content: center;
|
|
80
|
+
}
|
|
81
|
+
|
|
73
82
|
.adm-notice-bar-close-icon {
|
|
74
83
|
font-size: var(--adm-font-size-10);
|
|
75
84
|
}
|
|
@@ -82,13 +82,15 @@ export const NoticeBar = memo(p => {
|
|
|
82
82
|
className: `${classPrefix}-content-inner`
|
|
83
83
|
}, props.content)), (props.closeable || props.extra) && React.createElement("span", {
|
|
84
84
|
className: `${classPrefix}-right`
|
|
85
|
-
}, props.extra, props.closeable && React.createElement(
|
|
86
|
-
className: `${classPrefix}-close
|
|
85
|
+
}, props.extra, props.closeable && React.createElement("div", {
|
|
86
|
+
className: `${classPrefix}-close`,
|
|
87
87
|
onClick: () => {
|
|
88
88
|
var _a;
|
|
89
89
|
|
|
90
90
|
setVisible(false);
|
|
91
91
|
(_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
92
92
|
}
|
|
93
|
-
}
|
|
93
|
+
}, React.createElement(CloseOutline, {
|
|
94
|
+
className: `${classPrefix}-close-icon`
|
|
95
|
+
})))));
|
|
94
96
|
});
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
flex: 1;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
.adm-number-keyboard-main.confirmed-style .
|
|
7
|
+
.adm-number-keyboard-main.adm-number-keyboard-main-confirmed-style .adm-number-keyboard-key-sign {
|
|
8
8
|
background-color: var(--adm-color-white);
|
|
9
9
|
}
|
|
10
10
|
|
|
@@ -40,11 +40,11 @@
|
|
|
40
40
|
font-size: 32px;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
.adm-number-keyboard-header.with-title {
|
|
43
|
+
.adm-number-keyboard-header.adm-number-keyboard-header-with-title {
|
|
44
44
|
justify-content: space-between;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
.adm-number-keyboard-header.with-title .adm-number-keyboard-header-close-button {
|
|
47
|
+
.adm-number-keyboard-header.adm-number-keyboard-header-with-title .adm-number-keyboard-header-close-button {
|
|
48
48
|
padding-right: 0;
|
|
49
49
|
}
|
|
50
50
|
|
|
@@ -97,37 +97,33 @@
|
|
|
97
97
|
box-sizing: content-box;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
.adm-number-keyboard-key.
|
|
100
|
+
.adm-number-keyboard-key.adm-number-keyboard-key-mid {
|
|
101
101
|
flex-basis: 66.67%;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
.adm-number-keyboard-key.
|
|
104
|
+
.adm-number-keyboard-key.adm-number-keyboard-key-sign:active::before {
|
|
105
105
|
opacity: 0.1;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
.adm-number-keyboard-key.
|
|
108
|
+
.adm-number-keyboard-key.adm-number-keyboard-key-extra {
|
|
109
109
|
border-left: solid 2px var(--adm-color-border);
|
|
110
110
|
border-right: none;
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
.adm-number-keyboard-key.
|
|
114
|
-
.adm-number-keyboard-key.number-key {
|
|
113
|
+
.adm-number-keyboard-key.adm-number-keyboard-key-extra,
|
|
114
|
+
.adm-number-keyboard-key.adm-number-keyboard-key-number {
|
|
115
115
|
background-color: var(--adm-color-background);
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
.adm-number-keyboard-key.
|
|
119
|
-
.adm-number-keyboard-key.number-key:active::before {
|
|
118
|
+
.adm-number-keyboard-key.adm-number-keyboard-key-extra:active::before,
|
|
119
|
+
.adm-number-keyboard-key.adm-number-keyboard-key-number:active::before {
|
|
120
120
|
opacity: 0.1;
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
.adm-number-keyboard-key.
|
|
123
|
+
.adm-number-keyboard-key.adm-number-keyboard-key-ok {
|
|
124
124
|
background-color: var(--adm-color-primary);
|
|
125
125
|
color: var(--adm-color-white);
|
|
126
126
|
height: 288px;
|
|
127
127
|
font-size: 32px;
|
|
128
128
|
border: none;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
.adm-number-keyboard-bs-key {
|
|
132
|
-
height: 40px;
|
|
133
129
|
}
|
|
@@ -5,7 +5,7 @@ export declare type NumberKeyboardProps = {
|
|
|
5
5
|
visible?: boolean;
|
|
6
6
|
title?: string;
|
|
7
7
|
confirmText?: string | null;
|
|
8
|
-
customKey?:
|
|
8
|
+
customKey?: string | [string, string];
|
|
9
9
|
randomOrder?: boolean;
|
|
10
10
|
showCloseButton?: boolean;
|
|
11
11
|
onInput?: (v: string) => void;
|
|
@@ -34,13 +34,18 @@ export const NumberKeyboard = p => {
|
|
|
34
34
|
const keys = useMemo(() => {
|
|
35
35
|
const defaultKeys = ['1', '2', '3', '4', '5', '6', '7', '8', '9'];
|
|
36
36
|
const keyList = randomOrder ? shuffle(defaultKeys) : defaultKeys;
|
|
37
|
+
const customKeys = Array.isArray(customKey) ? customKey : [customKey];
|
|
37
38
|
keyList.push('0');
|
|
38
39
|
|
|
39
40
|
if (confirmText) {
|
|
40
|
-
|
|
41
|
+
if (customKeys.length === 2) {
|
|
42
|
+
keyList.splice(9, 0, customKeys.pop());
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
keyList.push(customKeys[0] || '');
|
|
41
46
|
} else {
|
|
42
|
-
keyList.splice(9, 0,
|
|
43
|
-
keyList.push('BACKSPACE');
|
|
47
|
+
keyList.splice(9, 0, customKeys[0] || '');
|
|
48
|
+
keyList.push(customKeys[1] || 'BACKSPACE');
|
|
44
49
|
}
|
|
45
50
|
|
|
46
51
|
return keyList;
|
|
@@ -63,8 +68,7 @@ export const NumberKeyboard = p => {
|
|
|
63
68
|
const onBackspacePressEnd = () => {
|
|
64
69
|
clearTimeout(timeoutRef.current);
|
|
65
70
|
clearInterval(intervalRef.current);
|
|
66
|
-
};
|
|
67
|
-
|
|
71
|
+
};
|
|
68
72
|
|
|
69
73
|
const onKeyPress = (e, key) => {
|
|
70
74
|
var _a, _b;
|
|
@@ -86,18 +90,17 @@ export const NumberKeyboard = p => {
|
|
|
86
90
|
break;
|
|
87
91
|
|
|
88
92
|
default:
|
|
89
|
-
//
|
|
93
|
+
// onInput should't be called when customKey doesn't exist
|
|
90
94
|
if (key !== '') onInput === null || onInput === void 0 ? void 0 : onInput(key);
|
|
91
95
|
break;
|
|
92
96
|
}
|
|
93
|
-
};
|
|
94
|
-
|
|
97
|
+
};
|
|
95
98
|
|
|
96
99
|
const renderHeader = () => {
|
|
97
100
|
if (!showCloseButton && !title) return null;
|
|
98
101
|
return React.createElement("div", {
|
|
99
102
|
className: classNames(`${classPrefix}-header`, {
|
|
100
|
-
|
|
103
|
+
[`${classPrefix}-header-with-title`]: !!title
|
|
101
104
|
})
|
|
102
105
|
}, title && React.createElement("div", {
|
|
103
106
|
className: `${classPrefix}-title`
|
|
@@ -111,15 +114,14 @@ export const NumberKeyboard = p => {
|
|
|
111
114
|
role: 'button',
|
|
112
115
|
title: 'CLOSE'
|
|
113
116
|
}, React.createElement(DownOutline, null)));
|
|
114
|
-
};
|
|
115
|
-
|
|
117
|
+
};
|
|
116
118
|
|
|
117
119
|
const renderKey = (key, index) => {
|
|
118
120
|
const isNumberKey = /^\d$/.test(key);
|
|
119
121
|
const className = classNames(`${classPrefix}-key`, {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
122
|
+
[`${classPrefix}-key-number`]: isNumberKey,
|
|
123
|
+
[`${classPrefix}-key-sign`]: !isNumberKey && key,
|
|
124
|
+
[`${classPrefix}-key-mid`]: index === 9 && !!confirmText && keys.length < 12
|
|
123
125
|
});
|
|
124
126
|
const ariaProps = key ? {
|
|
125
127
|
role: 'button',
|
|
@@ -163,12 +165,12 @@ export const NumberKeyboard = p => {
|
|
|
163
165
|
className: `${classPrefix}-wrapper`
|
|
164
166
|
}, React.createElement("div", {
|
|
165
167
|
className: classNames(`${classPrefix}-main`, {
|
|
166
|
-
|
|
168
|
+
[`${classPrefix}-main-confirmed-style`]: !!confirmText
|
|
167
169
|
})
|
|
168
170
|
}, keys.map(renderKey)), !!confirmText && React.createElement("div", {
|
|
169
171
|
className: `${classPrefix}-confirm`
|
|
170
172
|
}, React.createElement("div", {
|
|
171
|
-
className: `${classPrefix}-key
|
|
173
|
+
className: `${classPrefix}-key ${classPrefix}-key-extra ${classPrefix}-key-bs`,
|
|
172
174
|
onTouchStart: () => {
|
|
173
175
|
onBackspacePressStart();
|
|
174
176
|
},
|
|
@@ -179,7 +181,7 @@ export const NumberKeyboard = p => {
|
|
|
179
181
|
title: 'BACKSPACE',
|
|
180
182
|
role: 'button'
|
|
181
183
|
}, React.createElement(TextDeletionOutline, null)), React.createElement("div", {
|
|
182
|
-
className: `${classPrefix}-key
|
|
184
|
+
className: `${classPrefix}-key ${classPrefix}-key-extra ${classPrefix}-key-ok`,
|
|
183
185
|
onTouchEnd: e => onKeyPress(e, 'OK'),
|
|
184
186
|
role: 'button'
|
|
185
187
|
}, confirmText))), props.safeArea && React.createElement("div", {
|
|
@@ -25,56 +25,56 @@
|
|
|
25
25
|
background: var(--adm-color-background);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
.adm-passcode-input:not(.seperated) {
|
|
28
|
+
.adm-passcode-input:not(.adm-passcode-input-seperated) {
|
|
29
29
|
border-radius: var(--border-radius);
|
|
30
30
|
overflow: hidden;
|
|
31
31
|
border: 2px solid var(--border-color);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
.adm-passcode-input:not(.seperated) .adm-passcode-input-cell:not(:last-child) {
|
|
34
|
+
.adm-passcode-input:not(.adm-passcode-input-seperated) .adm-passcode-input-cell:not(:last-child) {
|
|
35
35
|
border-right: 2px solid var(--border-color);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
.adm-passcode-input:not(.seperated).focused {
|
|
38
|
+
.adm-passcode-input:not(.adm-passcode-input-seperated).adm-passcode-input-focused {
|
|
39
39
|
border-color: var(--adm-color-primary);
|
|
40
40
|
box-shadow: 0 0 4px 0 var(--adm-color-primary);
|
|
41
41
|
outline: none;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
.adm-passcode-input:not(.seperated).error {
|
|
44
|
+
.adm-passcode-input:not(.adm-passcode-input-seperated).adm-passcode-input-error {
|
|
45
45
|
border-color: var(--adm-color-danger);
|
|
46
46
|
box-shadow: 0 0 4px 0 var(--adm-color-danger);
|
|
47
47
|
animation: 100ms ease-in-out 0s 3 normal none running adm-shake-horizontal;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
.adm-passcode-input.seperated .adm-passcode-input-cell {
|
|
50
|
+
.adm-passcode-input.adm-passcode-input-seperated .adm-passcode-input-cell {
|
|
51
51
|
border-radius: var(--border-radius);
|
|
52
52
|
border: 2px solid var(--border-color);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
.adm-passcode-input.seperated .adm-passcode-input-cell:not(:last-child) {
|
|
55
|
+
.adm-passcode-input.adm-passcode-input-seperated .adm-passcode-input-cell:not(:last-child) {
|
|
56
56
|
margin-right: var(--cell-gap);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
.adm-passcode-input.seperated .adm-passcode-input-cell
|
|
59
|
+
.adm-passcode-input.adm-passcode-input-seperated .adm-passcode-input-cell-focused {
|
|
60
60
|
border-color: var(--adm-color-primary);
|
|
61
61
|
box-shadow: 0 0 4px 0 var(--adm-color-primary);
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
.adm-passcode-input
|
|
64
|
+
.adm-passcode-input-seperated.adm-passcode-input-focused {
|
|
65
65
|
outline: none;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
.adm-passcode-input.seperated.error {
|
|
68
|
+
.adm-passcode-input.adm-passcode-input-seperated.adm-passcode-input-error {
|
|
69
69
|
animation: 100ms ease-in-out 0s 3 normal none running adm-shake-horizontal;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
.adm-passcode-input.seperated.error .adm-passcode-input-cell {
|
|
72
|
+
.adm-passcode-input.adm-passcode-input-seperated.adm-passcode-input-error .adm-passcode-input-cell {
|
|
73
73
|
border-color: var(--adm-color-danger);
|
|
74
74
|
box-shadow: 0 0 4px 0 var(--adm-color-danger);
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
.adm-passcode-input-cell
|
|
77
|
+
.adm-passcode-input-cell-dot::before {
|
|
78
78
|
content: '';
|
|
79
79
|
width: var(--dot-size);
|
|
80
80
|
height: var(--dot-size);
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
background: var(--adm-color-text);
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
.adm-passcode-input-cell
|
|
85
|
+
.adm-passcode-input-cell-caret::after {
|
|
86
86
|
content: '';
|
|
87
87
|
width: 4px;
|
|
88
88
|
height: 1.1em;
|
|
@@ -4,6 +4,7 @@ import { withNativeProps } from '../../utils/native-props';
|
|
|
4
4
|
import classNames from 'classnames';
|
|
5
5
|
import { bound } from '../../utils/bound';
|
|
6
6
|
import { usePropsValue } from '../../utils/use-props-value';
|
|
7
|
+
import { useConfig } from '../config-provider';
|
|
7
8
|
const classPrefix = 'adm-passcode-input';
|
|
8
9
|
const defaultProps = {
|
|
9
10
|
defaultValue: '',
|
|
@@ -17,6 +18,9 @@ export const PasscodeInput = forwardRef((p, ref) => {
|
|
|
17
18
|
const props = mergeProps(defaultProps, p); // 防止 length 值不合法
|
|
18
19
|
|
|
19
20
|
const cellLength = props.length > 0 && props.length < Infinity ? Math.floor(props.length) : defaultProps.length;
|
|
21
|
+
const {
|
|
22
|
+
locale
|
|
23
|
+
} = useConfig();
|
|
20
24
|
const [focused, setFocused] = useState(false);
|
|
21
25
|
const [value, setValue] = usePropsValue(props);
|
|
22
26
|
const rootRef = useRef(null);
|
|
@@ -87,9 +91,9 @@ export const PasscodeInput = forwardRef((p, ref) => {
|
|
|
87
91
|
for (let i = 0; i < cellLength; i++) {
|
|
88
92
|
cells.push(React.createElement("div", {
|
|
89
93
|
className: classNames(`${classPrefix}-cell`, {
|
|
90
|
-
caret: props.caret && caretIndex === i && focused,
|
|
91
|
-
focused: focusedIndex === i && focused,
|
|
92
|
-
dot: !props.plain && chars[i]
|
|
94
|
+
[`${classPrefix}-cell-caret`]: props.caret && caretIndex === i && focused,
|
|
95
|
+
[`${classPrefix}-cell-focused`]: focusedIndex === i && focused,
|
|
96
|
+
[`${classPrefix}-cell-dot`]: !props.plain && chars[i]
|
|
93
97
|
}),
|
|
94
98
|
key: i
|
|
95
99
|
}, chars[i] && props.plain ? chars[i] : ''));
|
|
@@ -99,16 +103,18 @@ export const PasscodeInput = forwardRef((p, ref) => {
|
|
|
99
103
|
};
|
|
100
104
|
|
|
101
105
|
const cls = classNames(classPrefix, {
|
|
102
|
-
focused: focused,
|
|
103
|
-
error: props.error,
|
|
104
|
-
seperated: props.seperated
|
|
106
|
+
[`${classPrefix}-focused`]: focused,
|
|
107
|
+
[`${classPrefix}-error`]: props.error,
|
|
108
|
+
[`${classPrefix}-seperated`]: props.seperated
|
|
105
109
|
});
|
|
106
110
|
return React.createElement(React.Fragment, null, withNativeProps(props, React.createElement("div", {
|
|
107
111
|
ref: rootRef,
|
|
108
112
|
tabIndex: 0,
|
|
109
113
|
className: cls,
|
|
110
114
|
onFocus: onFocus,
|
|
111
|
-
onBlur: onBlur
|
|
115
|
+
onBlur: onBlur,
|
|
116
|
+
role: 'button',
|
|
117
|
+
"aria-label": locale.PasscodeInput.name
|
|
112
118
|
}, React.createElement("div", {
|
|
113
119
|
className: `${classPrefix}-cell-container`
|
|
114
120
|
}, renderCells()), React.createElement("input", {
|
|
@@ -120,7 +126,8 @@ export const PasscodeInput = forwardRef((p, ref) => {
|
|
|
120
126
|
inputMode: 'numeric',
|
|
121
127
|
onChange: e => {
|
|
122
128
|
setValue(e.target.value.slice(0, props.length));
|
|
123
|
-
}
|
|
129
|
+
},
|
|
130
|
+
"aria-hidden": true
|
|
124
131
|
}))), props.keyboard && React.cloneElement(props.keyboard, {
|
|
125
132
|
visible: focused,
|
|
126
133
|
onInput: v => {
|
|
@@ -40,7 +40,7 @@ export const Wheel = memo(props => {
|
|
|
40
40
|
});
|
|
41
41
|
useIsomorphicLayoutEffect(() => {
|
|
42
42
|
if (draggingRef.current) return;
|
|
43
|
-
if (
|
|
43
|
+
if (value === null) return;
|
|
44
44
|
const targetIndex = column.findIndex(item => item.value === value);
|
|
45
45
|
if (targetIndex < 0) return;
|
|
46
46
|
const finalPosition = targetIndex * -itemHeight.current;
|
|
@@ -33,12 +33,17 @@ export const Rate = p => {
|
|
|
33
33
|
} else {
|
|
34
34
|
setValue(v);
|
|
35
35
|
}
|
|
36
|
-
}
|
|
36
|
+
},
|
|
37
|
+
role: 'radio',
|
|
38
|
+
"aria-checked": value >= v,
|
|
39
|
+
"aria-label": '' + v
|
|
37
40
|
}, props.character);
|
|
38
41
|
}
|
|
39
42
|
|
|
40
43
|
return withNativeProps(props, React.createElement("div", {
|
|
41
|
-
className: classPrefix
|
|
44
|
+
className: classPrefix,
|
|
45
|
+
role: 'radiogroup',
|
|
46
|
+
"aria-readonly": props.readOnly
|
|
42
47
|
}, starList.map((_, i) => React.createElement("div", {
|
|
43
48
|
key: i,
|
|
44
49
|
className: classNames(`${classPrefix}-box`)
|
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export const Star = () => {
|
|
3
|
-
// return (
|
|
4
|
-
// <svg height='1em' viewBox='0 0 48 48' xmlns='http://www.w3.org/2000/svg'>
|
|
5
|
-
// <title>{'star-fill\u5907\u4EFD 71'}</title>
|
|
6
|
-
// <path
|
|
7
|
-
// d='m24 36-10.52 5.53a2 2 0 0 1-2.902-2.108l2.01-11.714-8.511-8.296a2 2 0 0 1 1.108-3.411l11.762-1.71 5.26-10.657a2 2 0 0 1 3.586 0l5.26 10.658L42.815 16a2 2 0 0 1 1.108 3.411l-8.51 8.296 2.009 11.714a2 2 0 0 1-2.902 2.109L24 36Z'
|
|
8
|
-
// fill='#E5E5E5'
|
|
9
|
-
// fillRule='evenodd'
|
|
10
|
-
// />
|
|
11
|
-
// </svg>
|
|
12
|
-
// )
|
|
13
3
|
return React.createElement("svg", {
|
|
14
4
|
viewBox: '0 0 42 40',
|
|
15
5
|
height: '1em',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FC, ReactNode } from 'react';
|
|
2
2
|
import { NativeProps } from '../../utils/native-props';
|
|
3
3
|
export declare type ResultProps = {
|
|
4
|
-
status
|
|
4
|
+
status?: 'success' | 'error' | 'info' | 'waiting' | 'warning';
|
|
5
5
|
title: ReactNode;
|
|
6
6
|
description?: ReactNode;
|
|
7
7
|
icon?: ReactNode;
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import { CheckCircleFill, CloseCircleFill, InformationCircleFill, ClockCircleFill, ExclamationCircleFill } from 'antd-mobile-icons';
|
|
4
4
|
import { withNativeProps } from '../../utils/native-props';
|
|
5
|
+
import { mergeProps } from '../../utils/with-default-props';
|
|
5
6
|
const classPrefix = `adm-result`;
|
|
6
7
|
const iconRecord = {
|
|
7
8
|
success: CheckCircleFill,
|
|
@@ -10,7 +11,11 @@ const iconRecord = {
|
|
|
10
11
|
waiting: ClockCircleFill,
|
|
11
12
|
warning: ExclamationCircleFill
|
|
12
13
|
};
|
|
13
|
-
|
|
14
|
+
const defaultProps = {
|
|
15
|
+
status: 'info'
|
|
16
|
+
};
|
|
17
|
+
export const Result = p => {
|
|
18
|
+
const props = mergeProps(defaultProps, p);
|
|
14
19
|
const {
|
|
15
20
|
status,
|
|
16
21
|
title,
|
|
@@ -26,6 +26,7 @@ export const SearchBar = forwardRef((p, ref) => {
|
|
|
26
26
|
const [value, setValue] = usePropsValue(props);
|
|
27
27
|
const [hasFocus, setHasFocus] = useState(false);
|
|
28
28
|
const inputRef = useRef(null);
|
|
29
|
+
const composingRef = useRef(false);
|
|
29
30
|
useImperativeHandle(ref, () => ({
|
|
30
31
|
clear: () => {
|
|
31
32
|
var _a;
|
|
@@ -118,8 +119,17 @@ export const SearchBar = forwardRef((p, ref) => {
|
|
|
118
119
|
onEnterPress: () => {
|
|
119
120
|
var _a, _b;
|
|
120
121
|
|
|
121
|
-
(
|
|
122
|
-
|
|
122
|
+
if (!composingRef.current) {
|
|
123
|
+
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.blur();
|
|
124
|
+
(_b = props.onSearch) === null || _b === void 0 ? void 0 : _b.call(props, value);
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
"aria-label": locale.SearchBar.name,
|
|
128
|
+
onCompositionStart: () => {
|
|
129
|
+
composingRef.current = true;
|
|
130
|
+
},
|
|
131
|
+
onCompositionEnd: () => {
|
|
132
|
+
composingRef.current = false;
|
|
123
133
|
}
|
|
124
134
|
})), renderCancelButton()));
|
|
125
135
|
});
|
|
@@ -5,8 +5,9 @@ export declare type SwitchProps = {
|
|
|
5
5
|
disabled?: boolean;
|
|
6
6
|
checked?: boolean;
|
|
7
7
|
defaultChecked?: boolean;
|
|
8
|
+
/** @deprecated use `onChange` instead */
|
|
8
9
|
beforeChange?: (val: boolean) => Promise<void>;
|
|
9
|
-
onChange?: (checked: boolean) => void
|
|
10
|
+
onChange?: (checked: boolean) => void | Promise<void>;
|
|
10
11
|
checkedText?: ReactNode;
|
|
11
12
|
uncheckedText?: ReactNode;
|
|
12
13
|
} & NativeProps<'--checked-color' | '--width' | '--height' | '--border-width'>;
|
|
@@ -6,6 +6,7 @@ import { usePropsValue } from '../../utils/use-props-value';
|
|
|
6
6
|
import { mergeProps } from '../../utils/with-default-props';
|
|
7
7
|
import { SpinIcon } from './spin-icon';
|
|
8
8
|
import { useConfig } from '../config-provider';
|
|
9
|
+
import { isPromise } from '../../utils/validate';
|
|
9
10
|
const classPrefix = `adm-switch`;
|
|
10
11
|
const defaultProps = {
|
|
11
12
|
defaultChecked: false
|
|
@@ -36,14 +37,25 @@ export const Switch = p => {
|
|
|
36
37
|
|
|
37
38
|
try {
|
|
38
39
|
yield props.beforeChange(nextChecked);
|
|
39
|
-
setChecked(nextChecked);
|
|
40
40
|
setChanging(false);
|
|
41
41
|
} catch (e) {
|
|
42
42
|
setChanging(false);
|
|
43
43
|
throw e;
|
|
44
44
|
}
|
|
45
|
-
}
|
|
46
|
-
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const result = setChecked(nextChecked);
|
|
48
|
+
|
|
49
|
+
if (isPromise(result)) {
|
|
50
|
+
setChanging(true);
|
|
51
|
+
|
|
52
|
+
try {
|
|
53
|
+
yield result;
|
|
54
|
+
setChanging(false);
|
|
55
|
+
} catch (e) {
|
|
56
|
+
setChanging(false);
|
|
57
|
+
throw e;
|
|
58
|
+
}
|
|
47
59
|
}
|
|
48
60
|
});
|
|
49
61
|
}
|
|
@@ -51,6 +51,7 @@ export const TextArea = forwardRef((p, ref) => {
|
|
|
51
51
|
if (!autoSize) return;
|
|
52
52
|
const textArea = nativeTextAreaRef.current;
|
|
53
53
|
if (!textArea) return;
|
|
54
|
+
textArea.style.height = 'auto';
|
|
54
55
|
let height = textArea.scrollHeight;
|
|
55
56
|
|
|
56
57
|
if (typeof autoSize === 'object') {
|
package/2x/es/locales/base.d.ts
CHANGED
|
@@ -93,17 +93,26 @@ export declare const base: {
|
|
|
93
93
|
failedToLoad: string;
|
|
94
94
|
retry: string;
|
|
95
95
|
};
|
|
96
|
+
Input: {
|
|
97
|
+
clear: string;
|
|
98
|
+
};
|
|
96
99
|
Mask: {
|
|
97
100
|
name: string;
|
|
98
101
|
};
|
|
99
102
|
Modal: {
|
|
100
103
|
ok: string;
|
|
101
104
|
};
|
|
105
|
+
PasscodeInput: {
|
|
106
|
+
name: string;
|
|
107
|
+
};
|
|
102
108
|
PullToRefresh: {
|
|
103
109
|
pulling: string;
|
|
104
110
|
canRelease: string;
|
|
105
111
|
complete: string;
|
|
106
112
|
};
|
|
113
|
+
SearchBar: {
|
|
114
|
+
name: string;
|
|
115
|
+
};
|
|
107
116
|
Slider: {
|
|
108
117
|
name: string;
|
|
109
118
|
};
|
package/2x/es/locales/base.js
CHANGED
|
@@ -94,17 +94,26 @@ export const base = {
|
|
|
94
94
|
failedToLoad: 'Failed to load',
|
|
95
95
|
retry: 'Retry'
|
|
96
96
|
},
|
|
97
|
+
Input: {
|
|
98
|
+
clear: 'clear'
|
|
99
|
+
},
|
|
97
100
|
Mask: {
|
|
98
101
|
name: 'Mask'
|
|
99
102
|
},
|
|
100
103
|
Modal: {
|
|
101
104
|
ok: 'OK'
|
|
102
105
|
},
|
|
106
|
+
PasscodeInput: {
|
|
107
|
+
name: 'Passcode Input'
|
|
108
|
+
},
|
|
103
109
|
PullToRefresh: {
|
|
104
110
|
pulling: 'Scroll down to refresh',
|
|
105
111
|
canRelease: 'Release to refresh immediately',
|
|
106
112
|
complete: 'Refresh successful'
|
|
107
113
|
},
|
|
114
|
+
SearchBar: {
|
|
115
|
+
name: 'Search Bar'
|
|
116
|
+
},
|
|
108
117
|
Slider: {
|
|
109
118
|
name: 'Slider'
|
|
110
119
|
},
|
package/2x/es/locales/en-US.d.ts
CHANGED
|
@@ -93,17 +93,26 @@ declare const enUS: {
|
|
|
93
93
|
failedToLoad: string;
|
|
94
94
|
retry: string;
|
|
95
95
|
};
|
|
96
|
+
Input: {
|
|
97
|
+
clear: string;
|
|
98
|
+
};
|
|
96
99
|
Mask: {
|
|
97
100
|
name: string;
|
|
98
101
|
};
|
|
99
102
|
Modal: {
|
|
100
103
|
ok: string;
|
|
101
104
|
};
|
|
105
|
+
PasscodeInput: {
|
|
106
|
+
name: string;
|
|
107
|
+
};
|
|
102
108
|
PullToRefresh: {
|
|
103
109
|
pulling: string;
|
|
104
110
|
canRelease: string;
|
|
105
111
|
complete: string;
|
|
106
112
|
};
|
|
113
|
+
SearchBar: {
|
|
114
|
+
name: string;
|
|
115
|
+
};
|
|
107
116
|
Slider: {
|
|
108
117
|
name: string;
|
|
109
118
|
};
|