antd-mobile 5.42.0-alpha.0 → 5.42.0-alpha.1
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.development.js +15 -8
- package/2x/bundle/antd-mobile.cjs.js +4 -4
- package/2x/bundle/antd-mobile.es.development.js +15 -8
- package/2x/bundle/antd-mobile.es.js +710 -706
- package/2x/bundle/antd-mobile.umd.development.js +15 -8
- package/2x/bundle/antd-mobile.umd.js +4 -4
- package/2x/cjs/components/number-keyboard/number-keyboard.d.ts +6 -1
- package/2x/cjs/components/number-keyboard/number-keyboard.js +15 -8
- package/2x/es/components/number-keyboard/number-keyboard.d.ts +6 -1
- package/2x/es/components/number-keyboard/number-keyboard.js +15 -8
- package/2x/package.json +1 -1
- package/bundle/antd-mobile.cjs.development.js +15 -8
- package/bundle/antd-mobile.cjs.js +4 -4
- package/bundle/antd-mobile.compatible.umd.js +1 -1
- package/bundle/antd-mobile.es.development.js +15 -8
- package/bundle/antd-mobile.es.js +710 -706
- package/bundle/antd-mobile.umd.development.js +15 -8
- package/bundle/antd-mobile.umd.js +4 -4
- package/cjs/components/number-keyboard/number-keyboard.d.ts +6 -1
- package/cjs/components/number-keyboard/number-keyboard.js +15 -8
- package/es/components/number-keyboard/number-keyboard.d.ts +6 -1
- package/es/components/number-keyboard/number-keyboard.js +15 -8
- package/package.json +1 -1
- package/umd/antd-mobile.js +1 -1
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import type { FC } from 'react';
|
|
2
2
|
import { NativeProps } from '../../utils/native-props';
|
|
3
3
|
import { PopupProps } from '../popup';
|
|
4
|
+
declare type CustomKeyType = string | {
|
|
5
|
+
key: string;
|
|
6
|
+
title: string;
|
|
7
|
+
};
|
|
4
8
|
export declare type NumberKeyboardProps = {
|
|
5
9
|
visible?: boolean;
|
|
6
10
|
title?: string;
|
|
7
11
|
confirmText?: string | null;
|
|
8
|
-
customKey?:
|
|
12
|
+
customKey?: CustomKeyType | CustomKeyType[];
|
|
9
13
|
randomOrder?: boolean;
|
|
10
14
|
showCloseButton?: boolean;
|
|
11
15
|
onInput?: (v: string) => void;
|
|
@@ -16,3 +20,4 @@ export declare type NumberKeyboardProps = {
|
|
|
16
20
|
safeArea?: boolean;
|
|
17
21
|
} & Pick<PopupProps, 'afterClose' | 'afterShow' | 'getContainer' | 'destroyOnClose' | 'forceRender' | 'stopPropagation'> & NativeProps<'--adm-safe-area-multiple'>;
|
|
18
22
|
export declare const NumberKeyboard: FC<NumberKeyboardProps>;
|
|
23
|
+
export {};
|
|
@@ -124,20 +124,27 @@ const NumberKeyboard = p => {
|
|
|
124
124
|
onKeyPress(e, 'BACKSPACE');
|
|
125
125
|
};
|
|
126
126
|
const renderKey = (key, index) => {
|
|
127
|
-
const
|
|
128
|
-
|
|
127
|
+
const keyConfig = typeof key === 'string' ? {
|
|
128
|
+
key,
|
|
129
|
+
title: key
|
|
130
|
+
} : key;
|
|
131
|
+
const realKey = keyConfig.key;
|
|
132
|
+
const isNumberKey = /^\d$/.test(realKey);
|
|
133
|
+
const isBackspace = realKey === 'BACKSPACE';
|
|
134
|
+
const title = isBackspace ? locale.Input.clear : keyConfig.title;
|
|
129
135
|
const className = (0, _classnames.default)(`${classPrefix}-key`, {
|
|
130
136
|
[`${classPrefix}-key-number`]: isNumberKey,
|
|
131
|
-
[`${classPrefix}-key-sign`]: !isNumberKey &&
|
|
137
|
+
[`${classPrefix}-key-sign`]: !isNumberKey && realKey,
|
|
132
138
|
[`${classPrefix}-key-mid`]: index === 9 && !!confirmText && keys.length < 12
|
|
133
139
|
});
|
|
134
|
-
const ariaProps =
|
|
140
|
+
const ariaProps = realKey ? {
|
|
135
141
|
role: 'button',
|
|
136
|
-
title
|
|
142
|
+
title,
|
|
143
|
+
'aria-label': title,
|
|
137
144
|
tabIndex: -1
|
|
138
145
|
} : undefined;
|
|
139
146
|
return _react.default.createElement("div", Object.assign({
|
|
140
|
-
key:
|
|
147
|
+
key: realKey,
|
|
141
148
|
className: className,
|
|
142
149
|
// 仅为 backspace 绑定,支持长按快速删除
|
|
143
150
|
onTouchStart: isBackspace ? onBackspaceTouchStart : undefined,
|
|
@@ -149,9 +156,9 @@ const NumberKeyboard = p => {
|
|
|
149
156
|
// backspace touchend 时会 preventDefault 阻止其后续 click 事件
|
|
150
157
|
onClick: e => {
|
|
151
158
|
stopContinueClear();
|
|
152
|
-
onKeyPress(e,
|
|
159
|
+
onKeyPress(e, realKey);
|
|
153
160
|
}
|
|
154
|
-
}, ariaProps), isBackspace ? _react.default.createElement(_antdMobileIcons.TextDeletionOutline, null) :
|
|
161
|
+
}, ariaProps), isBackspace ? _react.default.createElement(_antdMobileIcons.TextDeletionOutline, null) : realKey);
|
|
155
162
|
};
|
|
156
163
|
return _react.default.createElement(_popup.default, {
|
|
157
164
|
visible: visible,
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import type { FC } from 'react';
|
|
2
2
|
import { NativeProps } from '../../utils/native-props';
|
|
3
3
|
import { PopupProps } from '../popup';
|
|
4
|
+
declare type CustomKeyType = string | {
|
|
5
|
+
key: string;
|
|
6
|
+
title: string;
|
|
7
|
+
};
|
|
4
8
|
export declare type NumberKeyboardProps = {
|
|
5
9
|
visible?: boolean;
|
|
6
10
|
title?: string;
|
|
7
11
|
confirmText?: string | null;
|
|
8
|
-
customKey?:
|
|
12
|
+
customKey?: CustomKeyType | CustomKeyType[];
|
|
9
13
|
randomOrder?: boolean;
|
|
10
14
|
showCloseButton?: boolean;
|
|
11
15
|
onInput?: (v: string) => void;
|
|
@@ -16,3 +20,4 @@ export declare type NumberKeyboardProps = {
|
|
|
16
20
|
safeArea?: boolean;
|
|
17
21
|
} & Pick<PopupProps, 'afterClose' | 'afterShow' | 'getContainer' | 'destroyOnClose' | 'forceRender' | 'stopPropagation'> & NativeProps<'--adm-safe-area-multiple'>;
|
|
18
22
|
export declare const NumberKeyboard: FC<NumberKeyboardProps>;
|
|
23
|
+
export {};
|
|
@@ -115,20 +115,27 @@ export const NumberKeyboard = p => {
|
|
|
115
115
|
onKeyPress(e, 'BACKSPACE');
|
|
116
116
|
};
|
|
117
117
|
const renderKey = (key, index) => {
|
|
118
|
-
const
|
|
119
|
-
|
|
118
|
+
const keyConfig = typeof key === 'string' ? {
|
|
119
|
+
key,
|
|
120
|
+
title: key
|
|
121
|
+
} : key;
|
|
122
|
+
const realKey = keyConfig.key;
|
|
123
|
+
const isNumberKey = /^\d$/.test(realKey);
|
|
124
|
+
const isBackspace = realKey === 'BACKSPACE';
|
|
125
|
+
const title = isBackspace ? locale.Input.clear : keyConfig.title;
|
|
120
126
|
const className = classNames(`${classPrefix}-key`, {
|
|
121
127
|
[`${classPrefix}-key-number`]: isNumberKey,
|
|
122
|
-
[`${classPrefix}-key-sign`]: !isNumberKey &&
|
|
128
|
+
[`${classPrefix}-key-sign`]: !isNumberKey && realKey,
|
|
123
129
|
[`${classPrefix}-key-mid`]: index === 9 && !!confirmText && keys.length < 12
|
|
124
130
|
});
|
|
125
|
-
const ariaProps =
|
|
131
|
+
const ariaProps = realKey ? {
|
|
126
132
|
role: 'button',
|
|
127
|
-
title
|
|
133
|
+
title,
|
|
134
|
+
'aria-label': title,
|
|
128
135
|
tabIndex: -1
|
|
129
136
|
} : undefined;
|
|
130
137
|
return React.createElement("div", Object.assign({
|
|
131
|
-
key:
|
|
138
|
+
key: realKey,
|
|
132
139
|
className: className,
|
|
133
140
|
// 仅为 backspace 绑定,支持长按快速删除
|
|
134
141
|
onTouchStart: isBackspace ? onBackspaceTouchStart : undefined,
|
|
@@ -140,9 +147,9 @@ export const NumberKeyboard = p => {
|
|
|
140
147
|
// backspace touchend 时会 preventDefault 阻止其后续 click 事件
|
|
141
148
|
onClick: e => {
|
|
142
149
|
stopContinueClear();
|
|
143
|
-
onKeyPress(e,
|
|
150
|
+
onKeyPress(e, realKey);
|
|
144
151
|
}
|
|
145
|
-
}, ariaProps), isBackspace ? React.createElement(TextDeletionOutline, null) :
|
|
152
|
+
}, ariaProps), isBackspace ? React.createElement(TextDeletionOutline, null) : realKey);
|
|
146
153
|
};
|
|
147
154
|
return React.createElement(Popup, {
|
|
148
155
|
visible: visible,
|
package/2x/package.json
CHANGED
|
@@ -23254,20 +23254,27 @@ const NumberKeyboard = (p) => {
|
|
|
23254
23254
|
onKeyPress(e2, "BACKSPACE");
|
|
23255
23255
|
};
|
|
23256
23256
|
const renderKey = (key, index2) => {
|
|
23257
|
-
const
|
|
23258
|
-
|
|
23257
|
+
const keyConfig = typeof key === "string" ? {
|
|
23258
|
+
key,
|
|
23259
|
+
title: key
|
|
23260
|
+
} : key;
|
|
23261
|
+
const realKey = keyConfig.key;
|
|
23262
|
+
const isNumberKey = /^\d$/.test(realKey);
|
|
23263
|
+
const isBackspace = realKey === "BACKSPACE";
|
|
23264
|
+
const title2 = isBackspace ? locale.Input.clear : keyConfig.title;
|
|
23259
23265
|
const className = classNames(`${classPrefix$x}-key`, {
|
|
23260
23266
|
[`${classPrefix$x}-key-number`]: isNumberKey,
|
|
23261
|
-
[`${classPrefix$x}-key-sign`]: !isNumberKey &&
|
|
23267
|
+
[`${classPrefix$x}-key-sign`]: !isNumberKey && realKey,
|
|
23262
23268
|
[`${classPrefix$x}-key-mid`]: index2 === 9 && !!confirmText && keys2.length < 12
|
|
23263
23269
|
});
|
|
23264
|
-
const ariaProps =
|
|
23270
|
+
const ariaProps = realKey ? {
|
|
23265
23271
|
role: "button",
|
|
23266
|
-
title:
|
|
23272
|
+
title: title2,
|
|
23273
|
+
"aria-label": title2,
|
|
23267
23274
|
tabIndex: -1
|
|
23268
23275
|
} : void 0;
|
|
23269
23276
|
return React$3.createElement("div", Object.assign({
|
|
23270
|
-
key,
|
|
23277
|
+
key: realKey,
|
|
23271
23278
|
className,
|
|
23272
23279
|
// 仅为 backspace 绑定,支持长按快速删除
|
|
23273
23280
|
onTouchStart: isBackspace ? onBackspaceTouchStart : void 0,
|
|
@@ -23279,9 +23286,9 @@ const NumberKeyboard = (p) => {
|
|
|
23279
23286
|
// backspace touchend 时会 preventDefault 阻止其后续 click 事件
|
|
23280
23287
|
onClick: (e2) => {
|
|
23281
23288
|
stopContinueClear();
|
|
23282
|
-
onKeyPress(e2,
|
|
23289
|
+
onKeyPress(e2, realKey);
|
|
23283
23290
|
}
|
|
23284
|
-
}, ariaProps), isBackspace ? React$3.createElement(TextDeletionOutline, null) :
|
|
23291
|
+
}, ariaProps), isBackspace ? React$3.createElement(TextDeletionOutline, null) : realKey);
|
|
23285
23292
|
};
|
|
23286
23293
|
return React$3.createElement(Popup, {
|
|
23287
23294
|
visible,
|