antd-mobile 5.11.1 → 5.11.2
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/cjs/components/image-uploader/image-uploader.js +9 -2
- package/2x/cjs/components/list/list-item.js +7 -5
- package/2x/cjs/components/text-area/text-area.js +1 -1
- package/2x/cjs/components/virtual-input/virtual-input.js +2 -1
- package/2x/cjs/locales/base.d.ts +1 -0
- package/2x/cjs/locales/base.js +2 -1
- 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/ko-KR.d.ts +1 -0
- package/2x/cjs/locales/zh-CN.d.ts +1 -0
- package/2x/cjs/locales/zh-CN.js +2 -1
- package/2x/cjs/locales/zh-HK.d.ts +1 -0
- package/2x/cjs/locales/zh-TW.d.ts +1 -0
- package/2x/cjs/utils/is-node-with-content.d.ts +4 -0
- package/2x/cjs/utils/is-node-with-content.js +10 -0
- package/2x/es/components/image-uploader/image-uploader.js +8 -2
- package/2x/es/components/list/list-item.js +6 -5
- package/2x/es/components/text-area/text-area.js +2 -2
- package/2x/es/components/virtual-input/virtual-input.js +2 -1
- package/2x/es/locales/base.d.ts +1 -0
- package/2x/es/locales/base.js +2 -1
- 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/ko-KR.d.ts +1 -0
- package/2x/es/locales/zh-CN.d.ts +1 -0
- package/2x/es/locales/zh-CN.js +2 -1
- package/2x/es/locales/zh-HK.d.ts +1 -0
- package/2x/es/locales/zh-TW.d.ts +1 -0
- package/2x/es/utils/is-node-with-content.d.ts +4 -0
- package/2x/es/utils/is-node-with-content.js +3 -0
- package/2x/package.json +1 -1
- package/bundle/antd-mobile.cjs.js +22 -11
- package/bundle/antd-mobile.es.js +23 -12
- package/cjs/components/image-uploader/image-uploader.js +9 -2
- package/cjs/components/list/list-item.js +7 -5
- package/cjs/components/text-area/text-area.js +1 -1
- package/cjs/components/virtual-input/virtual-input.js +2 -1
- package/cjs/locales/base.d.ts +1 -0
- package/cjs/locales/base.js +2 -1
- 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/ko-KR.d.ts +1 -0
- package/cjs/locales/zh-CN.d.ts +1 -0
- package/cjs/locales/zh-CN.js +2 -1
- package/cjs/locales/zh-HK.d.ts +1 -0
- package/cjs/locales/zh-TW.d.ts +1 -0
- package/cjs/utils/is-node-with-content.d.ts +4 -0
- package/cjs/utils/is-node-with-content.js +10 -0
- package/es/components/image-uploader/image-uploader.js +8 -2
- package/es/components/list/list-item.js +6 -5
- package/es/components/text-area/text-area.js +2 -2
- package/es/components/virtual-input/virtual-input.js +2 -1
- package/es/locales/base.d.ts +1 -0
- package/es/locales/base.js +2 -1
- 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/ko-KR.d.ts +1 -0
- package/es/locales/zh-CN.d.ts +1 -0
- package/es/locales/zh-CN.js +2 -1
- package/es/locales/zh-HK.d.ts +1 -0
- package/es/locales/zh-TW.d.ts +1 -0
- package/es/utils/is-node-with-content.d.ts +4 -0
- package/es/utils/is-node-with-content.js +3 -0
- package/package.json +1 -1
- package/umd/antd-mobile.js +1 -1
|
@@ -25,6 +25,8 @@ var _space = _interopRequireDefault(require("../space"));
|
|
|
25
25
|
|
|
26
26
|
var _nativeProps = require("../../utils/native-props");
|
|
27
27
|
|
|
28
|
+
var _configProvider = require("../config-provider");
|
|
29
|
+
|
|
28
30
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
29
31
|
|
|
30
32
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -46,6 +48,9 @@ const defaultProps = {
|
|
|
46
48
|
};
|
|
47
49
|
|
|
48
50
|
const ImageUploader = p => {
|
|
51
|
+
const {
|
|
52
|
+
locale
|
|
53
|
+
} = (0, _configProvider.useConfig)();
|
|
49
54
|
const props = (0, _withDefaultProps.mergeProps)(defaultProps, p);
|
|
50
55
|
const [value, setValue] = (0, _usePropsValue.usePropsValue)(props);
|
|
51
56
|
const updateValue = (0, _ahooks.useMemoizedFn)(updater => {
|
|
@@ -218,7 +223,8 @@ const ImageUploader = p => {
|
|
|
218
223
|
className: `${classPrefix}-upload-button-wrap`
|
|
219
224
|
}, props.children ? props.children : _react.default.createElement("span", {
|
|
220
225
|
className: `${classPrefix}-cell ${classPrefix}-upload-button`,
|
|
221
|
-
role: 'button'
|
|
226
|
+
role: 'button',
|
|
227
|
+
"aria-label": locale.ImageUploader.upload
|
|
222
228
|
}, _react.default.createElement("span", {
|
|
223
229
|
className: `${classPrefix}-upload-button-icon`
|
|
224
230
|
}, _react.default.createElement(_antdMobileIcons.AddOutline, null))), !props.disableUpload && _react.default.createElement("input", {
|
|
@@ -227,7 +233,8 @@ const ImageUploader = p => {
|
|
|
227
233
|
multiple: props.multiple,
|
|
228
234
|
type: 'file',
|
|
229
235
|
className: `${classPrefix}-input`,
|
|
230
|
-
onChange: onChange
|
|
236
|
+
onChange: onChange,
|
|
237
|
+
"aria-hidden": true
|
|
231
238
|
})))));
|
|
232
239
|
};
|
|
233
240
|
|
|
@@ -13,6 +13,8 @@ var _antdMobileIcons = require("antd-mobile-icons");
|
|
|
13
13
|
|
|
14
14
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
15
|
|
|
16
|
+
var _isNodeWithContent = require("../../utils/is-node-with-content");
|
|
17
|
+
|
|
16
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
19
|
|
|
18
20
|
const classPrefix = `adm-list-item`;
|
|
@@ -25,17 +27,17 @@ const ListItem = props => {
|
|
|
25
27
|
|
|
26
28
|
const content = _react.default.createElement("div", {
|
|
27
29
|
className: `${classPrefix}-content`
|
|
28
|
-
}, props.prefix && _react.default.createElement("div", {
|
|
30
|
+
}, (0, _isNodeWithContent.isNodeWithContent)(props.prefix) && _react.default.createElement("div", {
|
|
29
31
|
className: `${classPrefix}-content-prefix`
|
|
30
32
|
}, props.prefix), _react.default.createElement("div", {
|
|
31
33
|
className: `${classPrefix}-content-main`
|
|
32
|
-
}, props.title && _react.default.createElement("div", {
|
|
34
|
+
}, (0, _isNodeWithContent.isNodeWithContent)(props.title) && _react.default.createElement("div", {
|
|
33
35
|
className: `${classPrefix}-title`
|
|
34
|
-
}, props.title), props.children, props.description && _react.default.createElement("div", {
|
|
36
|
+
}, props.title), props.children, (0, _isNodeWithContent.isNodeWithContent)(props.description) && _react.default.createElement("div", {
|
|
35
37
|
className: `${classPrefix}-description`
|
|
36
|
-
}, props.description)), props.extra && _react.default.createElement("div", {
|
|
38
|
+
}, props.description)), (0, _isNodeWithContent.isNodeWithContent)(props.extra) && _react.default.createElement("div", {
|
|
37
39
|
className: `${classPrefix}-content-extra`
|
|
38
|
-
}, props.extra), arrow && _react.default.createElement("div", {
|
|
40
|
+
}, props.extra), (0, _isNodeWithContent.isNodeWithContent)(arrow) && _react.default.createElement("div", {
|
|
39
41
|
className: `${classPrefix}-content-arrow`
|
|
40
42
|
}, arrow === true ? _react.default.createElement(_antdMobileIcons.RightOutline, null) : arrow));
|
|
41
43
|
|
|
@@ -57,7 +57,7 @@ const TextArea = (0, _react.forwardRef)((p, ref) => {
|
|
|
57
57
|
(_a = nativeTextAreaRef.current) === null || _a === void 0 ? void 0 : _a.blur();
|
|
58
58
|
}
|
|
59
59
|
}));
|
|
60
|
-
(0, _react.
|
|
60
|
+
(0, _react.useLayoutEffect)(() => {
|
|
61
61
|
if (!autoSize) return;
|
|
62
62
|
const textArea = nativeTextAreaRef.current;
|
|
63
63
|
if (!textArea) return;
|
|
@@ -105,7 +105,8 @@ const VirtualInput = (0, _react.forwardRef)((p, ref) => {
|
|
|
105
105
|
|
|
106
106
|
(_a = rootRef.current) === null || _a === void 0 ? void 0 : _a.blur();
|
|
107
107
|
(_c = (_b = keyboard.props).onClose) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
108
|
-
}
|
|
108
|
+
},
|
|
109
|
+
getContainer: null
|
|
109
110
|
});
|
|
110
111
|
|
|
111
112
|
return (0, _nativeProps.withNativeProps)(props, _react.default.createElement("div", {
|
package/cjs/locales/base.d.ts
CHANGED
package/cjs/locales/base.js
CHANGED
package/cjs/locales/en-US.d.ts
CHANGED
package/cjs/locales/es-ES.d.ts
CHANGED
package/cjs/locales/fa-IR.d.ts
CHANGED
package/cjs/locales/ko-KR.d.ts
CHANGED
package/cjs/locales/zh-CN.d.ts
CHANGED
package/cjs/locales/zh-CN.js
CHANGED
package/cjs/locales/zh-HK.d.ts
CHANGED
package/cjs/locales/zh-TW.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { usePropsValue } from '../../utils/use-props-value';
|
|
|
8
8
|
import { useIsomorphicLayoutEffect, useMemoizedFn, useUnmount } from 'ahooks';
|
|
9
9
|
import Space from '../space';
|
|
10
10
|
import { withNativeProps } from '../../utils/native-props';
|
|
11
|
+
import { useConfig } from '../config-provider';
|
|
11
12
|
const classPrefix = `adm-image-uploader`;
|
|
12
13
|
const defaultProps = {
|
|
13
14
|
disableUpload: false,
|
|
@@ -22,6 +23,9 @@ const defaultProps = {
|
|
|
22
23
|
imageFit: 'cover'
|
|
23
24
|
};
|
|
24
25
|
export const ImageUploader = p => {
|
|
26
|
+
const {
|
|
27
|
+
locale
|
|
28
|
+
} = useConfig();
|
|
25
29
|
const props = mergeProps(defaultProps, p);
|
|
26
30
|
const [value, setValue] = usePropsValue(props);
|
|
27
31
|
const updateValue = useMemoizedFn(updater => {
|
|
@@ -194,7 +198,8 @@ export const ImageUploader = p => {
|
|
|
194
198
|
className: `${classPrefix}-upload-button-wrap`
|
|
195
199
|
}, props.children ? props.children : React.createElement("span", {
|
|
196
200
|
className: `${classPrefix}-cell ${classPrefix}-upload-button`,
|
|
197
|
-
role: 'button'
|
|
201
|
+
role: 'button',
|
|
202
|
+
"aria-label": locale.ImageUploader.upload
|
|
198
203
|
}, React.createElement("span", {
|
|
199
204
|
className: `${classPrefix}-upload-button-icon`
|
|
200
205
|
}, React.createElement(AddOutline, null))), !props.disableUpload && React.createElement("input", {
|
|
@@ -203,6 +208,7 @@ export const ImageUploader = p => {
|
|
|
203
208
|
multiple: props.multiple,
|
|
204
209
|
type: 'file',
|
|
205
210
|
className: `${classPrefix}-input`,
|
|
206
|
-
onChange: onChange
|
|
211
|
+
onChange: onChange,
|
|
212
|
+
"aria-hidden": true
|
|
207
213
|
})))));
|
|
208
214
|
};
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { withNativeProps } from '../../utils/native-props';
|
|
3
3
|
import { RightOutline } from 'antd-mobile-icons';
|
|
4
4
|
import classNames from 'classnames';
|
|
5
|
+
import { isNodeWithContent } from '../../utils/is-node-with-content';
|
|
5
6
|
const classPrefix = `adm-list-item`;
|
|
6
7
|
export const ListItem = props => {
|
|
7
8
|
var _a;
|
|
@@ -10,17 +11,17 @@ export const ListItem = props => {
|
|
|
10
11
|
const arrow = props.arrow === undefined ? clickable : props.arrow;
|
|
11
12
|
const content = React.createElement("div", {
|
|
12
13
|
className: `${classPrefix}-content`
|
|
13
|
-
}, props.prefix && React.createElement("div", {
|
|
14
|
+
}, isNodeWithContent(props.prefix) && React.createElement("div", {
|
|
14
15
|
className: `${classPrefix}-content-prefix`
|
|
15
16
|
}, props.prefix), React.createElement("div", {
|
|
16
17
|
className: `${classPrefix}-content-main`
|
|
17
|
-
}, props.title && React.createElement("div", {
|
|
18
|
+
}, isNodeWithContent(props.title) && React.createElement("div", {
|
|
18
19
|
className: `${classPrefix}-title`
|
|
19
|
-
}, props.title), props.children, props.description && React.createElement("div", {
|
|
20
|
+
}, props.title), props.children, isNodeWithContent(props.description) && React.createElement("div", {
|
|
20
21
|
className: `${classPrefix}-description`
|
|
21
|
-
}, props.description)), props.extra && React.createElement("div", {
|
|
22
|
+
}, props.description)), isNodeWithContent(props.extra) && React.createElement("div", {
|
|
22
23
|
className: `${classPrefix}-content-extra`
|
|
23
|
-
}, props.extra), arrow && React.createElement("div", {
|
|
24
|
+
}, props.extra), isNodeWithContent(arrow) && React.createElement("div", {
|
|
24
25
|
className: `${classPrefix}-content-arrow`
|
|
25
26
|
}, arrow === true ? React.createElement(RightOutline, null) : arrow));
|
|
26
27
|
return withNativeProps(props, React.createElement(clickable ? 'a' : 'div', {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { forwardRef,
|
|
1
|
+
import React, { forwardRef, useLayoutEffect, useImperativeHandle, useRef } from 'react';
|
|
2
2
|
import { withNativeProps } from '../../utils/native-props';
|
|
3
3
|
import { usePropsValue } from '../../utils/use-props-value';
|
|
4
4
|
import { mergeProps } from '../../utils/with-default-props';
|
|
@@ -41,7 +41,7 @@ export const TextArea = forwardRef((p, ref) => {
|
|
|
41
41
|
(_a = nativeTextAreaRef.current) === null || _a === void 0 ? void 0 : _a.blur();
|
|
42
42
|
}
|
|
43
43
|
}));
|
|
44
|
-
|
|
44
|
+
useLayoutEffect(() => {
|
|
45
45
|
if (!autoSize) return;
|
|
46
46
|
const textArea = nativeTextAreaRef.current;
|
|
47
47
|
if (!textArea) return;
|
|
@@ -84,7 +84,8 @@ export const VirtualInput = forwardRef((p, ref) => {
|
|
|
84
84
|
|
|
85
85
|
(_a = rootRef.current) === null || _a === void 0 ? void 0 : _a.blur();
|
|
86
86
|
(_c = (_b = keyboard.props).onClose) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
87
|
-
}
|
|
87
|
+
},
|
|
88
|
+
getContainer: null
|
|
88
89
|
});
|
|
89
90
|
return withNativeProps(props, React.createElement("div", {
|
|
90
91
|
ref: rootRef,
|
package/es/locales/base.d.ts
CHANGED
package/es/locales/base.js
CHANGED
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/ko-KR.d.ts
CHANGED
package/es/locales/zh-CN.d.ts
CHANGED
package/es/locales/zh-CN.js
CHANGED
package/es/locales/zh-HK.d.ts
CHANGED
package/es/locales/zh-TW.d.ts
CHANGED