antd-mobile 5.10.4 → 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/button/button.d.ts +6 -4
- package/2x/cjs/components/button/button.js +31 -7
- package/2x/cjs/components/calendar/calendar.css +2 -2
- package/2x/cjs/components/calendar/calendar.d.ts +2 -0
- package/2x/cjs/components/calendar/calendar.js +6 -1
- package/2x/cjs/components/cascade-picker/cascade-picker-utils.d.ts +2 -2
- package/2x/cjs/components/cascade-picker/cascade-picker-utils.js +37 -16
- package/2x/cjs/components/cascade-picker/cascade-picker.js +2 -7
- package/2x/cjs/components/cascade-picker-view/cascade-picker-view.js +2 -7
- package/2x/cjs/components/date-picker/date-picker.js +1 -0
- package/2x/cjs/components/dialog/dialog-action-button.js +3 -26
- package/2x/cjs/components/floating-panel/floating-panel.js +1 -1
- package/2x/cjs/components/form/context.d.ts +1 -0
- package/2x/cjs/components/form/context.js +2 -1
- package/2x/cjs/components/form/form-item.css +1 -1
- package/2x/cjs/components/form/form-item.js +3 -1
- package/2x/cjs/components/form/form.d.ts +0 -3
- package/2x/cjs/components/form/form.js +4 -2
- package/2x/cjs/components/form/index.css +1 -1
- package/2x/cjs/components/form/index.d.ts +2 -2
- package/2x/cjs/components/form/index.js +2 -1
- package/2x/cjs/components/image-uploader/image-uploader.js +9 -2
- package/2x/cjs/components/index-bar/panel.d.ts +1 -0
- package/2x/cjs/components/input/input.css +4 -0
- package/2x/cjs/components/input/input.d.ts +2 -0
- package/2x/cjs/components/input/input.js +13 -2
- package/2x/cjs/components/list/list-item.js +7 -5
- package/2x/cjs/components/modal/modal-action-button.js +3 -26
- package/2x/cjs/components/search-bar/search-bar.d.ts +2 -0
- package/2x/cjs/components/search-bar/search-bar.js +2 -0
- 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/global/index.js +2 -0
- 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/button/button.d.ts +6 -4
- package/2x/es/components/button/button.js +30 -8
- package/2x/es/components/calendar/calendar.css +2 -2
- package/2x/es/components/calendar/calendar.d.ts +2 -0
- package/2x/es/components/calendar/calendar.js +6 -2
- package/2x/es/components/cascade-picker/cascade-picker-utils.d.ts +2 -2
- package/2x/es/components/cascade-picker/cascade-picker-utils.js +35 -15
- package/2x/es/components/cascade-picker/cascade-picker.js +3 -7
- package/2x/es/components/cascade-picker-view/cascade-picker-view.js +3 -7
- package/2x/es/components/date-picker/date-picker.js +1 -0
- package/2x/es/components/dialog/dialog-action-button.js +3 -21
- package/2x/es/components/floating-panel/floating-panel.js +1 -1
- package/2x/es/components/form/context.d.ts +1 -0
- package/2x/es/components/form/context.js +2 -1
- package/2x/es/components/form/form-item.css +1 -1
- package/2x/es/components/form/form-item.js +3 -1
- package/2x/es/components/form/form.d.ts +0 -3
- package/2x/es/components/form/form.js +4 -2
- package/2x/es/components/form/index.css +1 -1
- package/2x/es/components/form/index.d.ts +2 -2
- package/2x/es/components/form/index.js +3 -2
- package/2x/es/components/image-uploader/image-uploader.js +8 -2
- package/2x/es/components/index-bar/panel.d.ts +1 -0
- package/2x/es/components/input/input.css +4 -0
- package/2x/es/components/input/input.d.ts +2 -0
- package/2x/es/components/input/input.js +13 -2
- package/2x/es/components/list/list-item.js +6 -5
- package/2x/es/components/modal/modal-action-button.js +3 -21
- package/2x/es/components/search-bar/search-bar.d.ts +2 -0
- package/2x/es/components/search-bar/search-bar.js +2 -0
- 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/global/index.js +2 -0
- 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 +2 -2
- package/bundle/antd-mobile.cjs.js +122 -106
- package/bundle/antd-mobile.es.js +124 -108
- package/bundle/style.css +6 -3
- package/cjs/components/button/button.d.ts +6 -4
- package/cjs/components/button/button.js +31 -7
- package/cjs/components/calendar/calendar.css +2 -2
- package/cjs/components/calendar/calendar.d.ts +2 -0
- package/cjs/components/calendar/calendar.js +6 -1
- package/cjs/components/cascade-picker/cascade-picker-utils.d.ts +2 -2
- package/cjs/components/cascade-picker/cascade-picker-utils.js +37 -16
- package/cjs/components/cascade-picker/cascade-picker.js +2 -7
- package/cjs/components/cascade-picker-view/cascade-picker-view.js +2 -7
- package/cjs/components/date-picker/date-picker.js +1 -0
- package/cjs/components/dialog/dialog-action-button.js +3 -26
- package/cjs/components/floating-panel/floating-panel.js +1 -1
- package/cjs/components/form/context.d.ts +1 -0
- package/cjs/components/form/context.js +2 -1
- package/cjs/components/form/form-item.css +1 -1
- package/cjs/components/form/form-item.js +3 -1
- package/cjs/components/form/form.d.ts +0 -3
- package/cjs/components/form/form.js +4 -2
- package/cjs/components/form/index.css +1 -1
- package/cjs/components/form/index.d.ts +2 -2
- package/cjs/components/form/index.js +2 -1
- package/cjs/components/image-uploader/image-uploader.js +9 -2
- package/cjs/components/index-bar/panel.d.ts +1 -0
- package/cjs/components/input/input.css +3 -0
- package/cjs/components/input/input.d.ts +2 -0
- package/cjs/components/input/input.js +13 -2
- package/cjs/components/list/list-item.js +7 -5
- package/cjs/components/modal/modal-action-button.js +3 -26
- package/cjs/components/search-bar/search-bar.d.ts +2 -0
- package/cjs/components/search-bar/search-bar.js +2 -0
- package/cjs/components/text-area/text-area.js +1 -1
- package/cjs/components/virtual-input/virtual-input.js +2 -1
- package/cjs/global/index.js +2 -0
- 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/button/button.d.ts +6 -4
- package/es/components/button/button.js +30 -8
- package/es/components/calendar/calendar.css +2 -2
- package/es/components/calendar/calendar.d.ts +2 -0
- package/es/components/calendar/calendar.js +6 -2
- package/es/components/cascade-picker/cascade-picker-utils.d.ts +2 -2
- package/es/components/cascade-picker/cascade-picker-utils.js +35 -15
- package/es/components/cascade-picker/cascade-picker.js +3 -7
- package/es/components/cascade-picker-view/cascade-picker-view.js +3 -7
- package/es/components/date-picker/date-picker.js +1 -0
- package/es/components/dialog/dialog-action-button.js +3 -21
- package/es/components/floating-panel/floating-panel.js +1 -1
- package/es/components/form/context.d.ts +1 -0
- package/es/components/form/context.js +2 -1
- package/es/components/form/form-item.css +1 -1
- package/es/components/form/form-item.js +3 -1
- package/es/components/form/form.d.ts +0 -3
- package/es/components/form/form.js +4 -2
- package/es/components/form/index.css +1 -1
- package/es/components/form/index.d.ts +2 -2
- package/es/components/form/index.js +3 -2
- package/es/components/image-uploader/image-uploader.js +8 -2
- package/es/components/index-bar/panel.d.ts +1 -0
- package/es/components/input/input.css +3 -0
- package/es/components/input/input.d.ts +2 -0
- package/es/components/input/input.js +13 -2
- package/es/components/list/list-item.js +6 -5
- package/es/components/modal/modal-action-button.js +3 -21
- package/es/components/search-bar/search-bar.d.ts +2 -0
- package/es/components/search-bar/search-bar.js +2 -0
- package/es/components/text-area/text-area.js +2 -2
- package/es/components/virtual-input/virtual-input.js +2 -1
- package/es/global/index.js +2 -0
- 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 +2 -2
- package/umd/antd-mobile.js +1 -1
- package/2x/cjs/components/cascade-picker/use-cascade-picker-options.d.ts +0 -5
- package/2x/cjs/components/cascade-picker/use-cascade-picker-options.js +0 -40
- package/2x/es/components/cascade-picker/use-cascade-picker-options.d.ts +0 -5
- package/2x/es/components/cascade-picker/use-cascade-picker-options.js +0 -32
- package/cjs/components/cascade-picker/use-cascade-picker-options.d.ts +0 -5
- package/cjs/components/cascade-picker/use-cascade-picker-options.js +0 -40
- package/es/components/cascade-picker/use-cascade-picker-options.d.ts +0 -5
- package/es/components/cascade-picker/use-cascade-picker-options.js +0 -32
|
@@ -23,9 +23,10 @@ export const Form = forwardRef((p, ref) => {
|
|
|
23
23
|
layout,
|
|
24
24
|
footer,
|
|
25
25
|
mode,
|
|
26
|
+
disabled,
|
|
26
27
|
requiredMarkStyle
|
|
27
28
|
} = props,
|
|
28
|
-
formProps = __rest(props, ["className", "style", "hasFeedback", "children", "layout", "footer", "mode", "requiredMarkStyle"]);
|
|
29
|
+
formProps = __rest(props, ["className", "style", "hasFeedback", "children", "layout", "footer", "mode", "disabled", "requiredMarkStyle"]);
|
|
29
30
|
|
|
30
31
|
const {
|
|
31
32
|
locale
|
|
@@ -76,7 +77,8 @@ export const Form = forwardRef((p, ref) => {
|
|
|
76
77
|
name: formProps.name,
|
|
77
78
|
hasFeedback,
|
|
78
79
|
layout,
|
|
79
|
-
requiredMarkStyle
|
|
80
|
+
requiredMarkStyle,
|
|
81
|
+
disabled: disabled
|
|
80
82
|
}
|
|
81
83
|
}, lists), footer && React.createElement("div", {
|
|
82
84
|
className: `${classPrefix}-footer`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import './index.less';
|
|
3
|
-
import { useForm } from 'rc-field-form';
|
|
3
|
+
import { useWatch, useForm } from 'rc-field-form';
|
|
4
4
|
export declare type FormLayout = 'vertical' | 'horizontal';
|
|
5
5
|
export type { FormProps, FormInstance } from './form';
|
|
6
6
|
export type { FormItemProps } from './form-item';
|
|
@@ -9,7 +9,6 @@ export type { ValidateMessages, FieldData, NamePath, } from 'rc-field-form/es/in
|
|
|
9
9
|
export type { FormArrayField, FormArrayOperation, FormArrayProps, } from './form-array';
|
|
10
10
|
declare const _default: import("react").ForwardRefExoticComponent<Pick<import("rc-field-form").FormProps<any>, "children" | "form" | "name" | "initialValues" | "preserve" | "validateMessages" | "validateTrigger" | "onFieldsChange" | "onFinish" | "onFinishFailed" | "onValuesChange"> & import("../../utils/native-props").NativeProps<"--border-inner" | "--border-top" | "--border-bottom"> & Partial<import("./context").FormContextType> & {
|
|
11
11
|
footer?: import("react").ReactNode;
|
|
12
|
-
layout?: FormLayout | undefined;
|
|
13
12
|
mode?: "default" | "card" | undefined;
|
|
14
13
|
} & import("react").RefAttributes<import("./form").FormInstance>> & {
|
|
15
14
|
Item: import("react").FC<import("./form-item").FormItemProps>;
|
|
@@ -19,5 +18,6 @@ declare const _default: import("react").ForwardRefExoticComponent<Pick<import("r
|
|
|
19
18
|
}>;
|
|
20
19
|
Array: import("react").FC<import("./form-array").FormArrayProps>;
|
|
21
20
|
useForm: typeof useForm;
|
|
21
|
+
useWatch: typeof useWatch;
|
|
22
22
|
};
|
|
23
23
|
export default _default;
|
|
@@ -3,7 +3,7 @@ import { Form } from './form';
|
|
|
3
3
|
import { attachPropertiesToComponent } from '../../utils/attach-properties-to-component';
|
|
4
4
|
import { FormItem } from './form-item';
|
|
5
5
|
import { Header } from './header';
|
|
6
|
-
import { useForm } from 'rc-field-form';
|
|
6
|
+
import { useWatch, useForm } from 'rc-field-form';
|
|
7
7
|
import { FormSubscribe } from './form-subscribe';
|
|
8
8
|
import { FormArray } from './form-array';
|
|
9
9
|
export default attachPropertiesToComponent(Form, {
|
|
@@ -11,5 +11,6 @@ export default attachPropertiesToComponent(Form, {
|
|
|
11
11
|
Subscribe: FormSubscribe,
|
|
12
12
|
Header,
|
|
13
13
|
Array: FormArray,
|
|
14
|
-
useForm
|
|
14
|
+
useForm,
|
|
15
|
+
useWatch
|
|
15
16
|
});
|
|
@@ -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
|
};
|
|
@@ -9,6 +9,7 @@ export declare type InputProps = Pick<NativeInputProps, 'maxLength' | 'minLength
|
|
|
9
9
|
disabled?: boolean;
|
|
10
10
|
readOnly?: boolean;
|
|
11
11
|
clearable?: boolean;
|
|
12
|
+
onlyShowClearWhenFocus?: boolean;
|
|
12
13
|
onClear?: () => void;
|
|
13
14
|
id?: string;
|
|
14
15
|
onEnterPress?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
@@ -30,6 +31,7 @@ export declare const Input: React.ForwardRefExoticComponent<Pick<NativeInputProp
|
|
|
30
31
|
disabled?: boolean | undefined;
|
|
31
32
|
readOnly?: boolean | undefined;
|
|
32
33
|
clearable?: boolean | undefined;
|
|
34
|
+
onlyShowClearWhenFocus?: boolean | undefined;
|
|
33
35
|
onClear?: (() => void) | undefined;
|
|
34
36
|
id?: string | undefined;
|
|
35
37
|
onEnterPress?: ((e: React.KeyboardEvent<HTMLInputElement>) => void) | undefined;
|
|
@@ -8,7 +8,8 @@ import { useIsomorphicLayoutEffect } from 'ahooks';
|
|
|
8
8
|
import { bound } from '../../utils/bound';
|
|
9
9
|
const classPrefix = `adm-input`;
|
|
10
10
|
const defaultProps = {
|
|
11
|
-
defaultValue: ''
|
|
11
|
+
defaultValue: '',
|
|
12
|
+
onlyShowClearWhenFocus: true
|
|
12
13
|
};
|
|
13
14
|
export const Input = forwardRef((p, ref) => {
|
|
14
15
|
const props = mergeProps(defaultProps, p);
|
|
@@ -70,6 +71,16 @@ export const Input = forwardRef((p, ref) => {
|
|
|
70
71
|
}
|
|
71
72
|
}
|
|
72
73
|
|
|
74
|
+
const shouldShowClear = (() => {
|
|
75
|
+
if (!props.clearable || !value || props.readOnly) return false;
|
|
76
|
+
|
|
77
|
+
if (props.onlyShowClearWhenFocus) {
|
|
78
|
+
return hasFocus;
|
|
79
|
+
} else {
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
})();
|
|
83
|
+
|
|
73
84
|
return withNativeProps(props, React.createElement("div", {
|
|
74
85
|
className: classNames(`${classPrefix}`, props.disabled && `${classPrefix}-disabled`)
|
|
75
86
|
}, React.createElement("input", {
|
|
@@ -112,7 +123,7 @@ export const Input = forwardRef((p, ref) => {
|
|
|
112
123
|
onCompositionStart: props.onCompositionStart,
|
|
113
124
|
onCompositionEnd: props.onCompositionEnd,
|
|
114
125
|
onClick: props.onClick
|
|
115
|
-
}),
|
|
126
|
+
}), shouldShowClear && React.createElement("div", {
|
|
116
127
|
className: `${classPrefix}-clear`,
|
|
117
128
|
onMouseDown: e => {
|
|
118
129
|
e.preventDefault();
|
|
@@ -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,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import React, { useState } from 'react';
|
|
1
|
+
import React from 'react';
|
|
3
2
|
import classNames from 'classnames';
|
|
4
3
|
import Button from '../button';
|
|
5
4
|
import { withNativeProps } from '../../utils/native-props';
|
|
@@ -7,26 +6,9 @@ export const ModalActionButton = props => {
|
|
|
7
6
|
const {
|
|
8
7
|
action
|
|
9
8
|
} = props;
|
|
10
|
-
const [loading, setLoading] = useState(false);
|
|
11
|
-
|
|
12
|
-
function handleClick() {
|
|
13
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
14
|
-
setLoading(true);
|
|
15
|
-
|
|
16
|
-
try {
|
|
17
|
-
const promise = props.onAction();
|
|
18
|
-
yield promise;
|
|
19
|
-
setLoading(false);
|
|
20
|
-
} catch (e) {
|
|
21
|
-
setLoading(false);
|
|
22
|
-
throw e;
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
|
|
27
9
|
return withNativeProps(props.action, React.createElement(Button, {
|
|
28
10
|
key: action.key,
|
|
29
|
-
onClick:
|
|
11
|
+
onClick: props.onAction,
|
|
30
12
|
className: classNames('adm-modal-button', {
|
|
31
13
|
'adm-modal-button-primary': props.action.primary
|
|
32
14
|
}),
|
|
@@ -34,7 +16,7 @@ export const ModalActionButton = props => {
|
|
|
34
16
|
size: props.action.primary ? 'large' : 'middle',
|
|
35
17
|
block: true,
|
|
36
18
|
color: action.danger ? 'danger' : 'primary',
|
|
37
|
-
loading:
|
|
19
|
+
loading: 'auto',
|
|
38
20
|
disabled: action.disabled
|
|
39
21
|
}, action.text));
|
|
40
22
|
};
|
|
@@ -8,6 +8,7 @@ export declare type SearchBarProps = Pick<InputProps, 'onFocus' | 'onBlur' | 'on
|
|
|
8
8
|
maxLength?: number;
|
|
9
9
|
placeholder?: string;
|
|
10
10
|
clearable?: boolean;
|
|
11
|
+
onlyShowClearWhenFocus?: boolean;
|
|
11
12
|
showCancelButton?: boolean | ((focus: boolean, value: string) => boolean);
|
|
12
13
|
cancelText?: string;
|
|
13
14
|
icon?: ReactNode;
|
|
@@ -22,6 +23,7 @@ export declare const SearchBar: React.ForwardRefExoticComponent<Pick<InputProps,
|
|
|
22
23
|
maxLength?: number | undefined;
|
|
23
24
|
placeholder?: string | undefined;
|
|
24
25
|
clearable?: boolean | undefined;
|
|
26
|
+
onlyShowClearWhenFocus?: boolean | undefined;
|
|
25
27
|
showCancelButton?: boolean | ((focus: boolean, value: string) => boolean) | undefined;
|
|
26
28
|
cancelText?: string | undefined;
|
|
27
29
|
icon?: ReactNode;
|
|
@@ -10,6 +10,7 @@ import { useConfig } from '../config-provider';
|
|
|
10
10
|
const classPrefix = `adm-search-bar`;
|
|
11
11
|
const defaultProps = {
|
|
12
12
|
clearable: true,
|
|
13
|
+
onlyShowClearWhenFocus: false,
|
|
13
14
|
showCancelButton: false,
|
|
14
15
|
defaultValue: '',
|
|
15
16
|
clearOnCancel: true,
|
|
@@ -101,6 +102,7 @@ export const SearchBar = forwardRef((p, ref) => {
|
|
|
101
102
|
maxLength: props.maxLength,
|
|
102
103
|
placeholder: props.placeholder,
|
|
103
104
|
clearable: props.clearable,
|
|
105
|
+
onlyShowClearWhenFocus: props.onlyShowClearWhenFocus,
|
|
104
106
|
onFocus: e => {
|
|
105
107
|
var _a;
|
|
106
108
|
|
|
@@ -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/2x/es/global/index.js
CHANGED
|
@@ -2,5 +2,7 @@ import "./global.css";
|
|
|
2
2
|
import { canUseDom } from '../utils/can-use-dom';
|
|
3
3
|
|
|
4
4
|
if (canUseDom) {
|
|
5
|
+
// Make sure the `:active` CSS selector of `button` and `a` take effect
|
|
6
|
+
// See: https://stackoverflow.com/questions/3885018/active-pseudo-class-doesnt-work-in-mobile-safari
|
|
5
7
|
document.addEventListener('touchstart', () => {}, true);
|
|
6
8
|
}
|
package/2x/es/locales/base.d.ts
CHANGED
package/2x/es/locales/base.js
CHANGED
package/2x/es/locales/en-US.d.ts
CHANGED
package/2x/es/locales/es-ES.d.ts
CHANGED
package/2x/es/locales/fa-IR.d.ts
CHANGED
package/2x/es/locales/ko-KR.d.ts
CHANGED
package/2x/es/locales/zh-CN.d.ts
CHANGED
package/2x/es/locales/zh-CN.js
CHANGED
package/2x/es/locales/zh-HK.d.ts
CHANGED
package/2x/es/locales/zh-TW.d.ts
CHANGED
package/2x/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "antd-mobile",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.11.2",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@floating-ui/dom": "^0.4.2",
|
|
6
6
|
"@react-spring/web": "^9.4.4",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"classnames": "^2.3.1",
|
|
17
17
|
"dayjs": "^1.11.0",
|
|
18
18
|
"lodash": "^4.17.21",
|
|
19
|
-
"rc-field-form": "^1.
|
|
19
|
+
"rc-field-form": "^1.26.2",
|
|
20
20
|
"react-is": "^17.0.2",
|
|
21
21
|
"staged-components": "^1.1.2",
|
|
22
22
|
"tslib": "^2.3.1"
|