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.
Files changed (194) hide show
  1. package/2x/cjs/components/button/button.d.ts +6 -4
  2. package/2x/cjs/components/button/button.js +31 -7
  3. package/2x/cjs/components/calendar/calendar.css +2 -2
  4. package/2x/cjs/components/calendar/calendar.d.ts +2 -0
  5. package/2x/cjs/components/calendar/calendar.js +6 -1
  6. package/2x/cjs/components/cascade-picker/cascade-picker-utils.d.ts +2 -2
  7. package/2x/cjs/components/cascade-picker/cascade-picker-utils.js +37 -16
  8. package/2x/cjs/components/cascade-picker/cascade-picker.js +2 -7
  9. package/2x/cjs/components/cascade-picker-view/cascade-picker-view.js +2 -7
  10. package/2x/cjs/components/date-picker/date-picker.js +1 -0
  11. package/2x/cjs/components/dialog/dialog-action-button.js +3 -26
  12. package/2x/cjs/components/floating-panel/floating-panel.js +1 -1
  13. package/2x/cjs/components/form/context.d.ts +1 -0
  14. package/2x/cjs/components/form/context.js +2 -1
  15. package/2x/cjs/components/form/form-item.css +1 -1
  16. package/2x/cjs/components/form/form-item.js +3 -1
  17. package/2x/cjs/components/form/form.d.ts +0 -3
  18. package/2x/cjs/components/form/form.js +4 -2
  19. package/2x/cjs/components/form/index.css +1 -1
  20. package/2x/cjs/components/form/index.d.ts +2 -2
  21. package/2x/cjs/components/form/index.js +2 -1
  22. package/2x/cjs/components/image-uploader/image-uploader.js +9 -2
  23. package/2x/cjs/components/index-bar/panel.d.ts +1 -0
  24. package/2x/cjs/components/input/input.css +4 -0
  25. package/2x/cjs/components/input/input.d.ts +2 -0
  26. package/2x/cjs/components/input/input.js +13 -2
  27. package/2x/cjs/components/list/list-item.js +7 -5
  28. package/2x/cjs/components/modal/modal-action-button.js +3 -26
  29. package/2x/cjs/components/search-bar/search-bar.d.ts +2 -0
  30. package/2x/cjs/components/search-bar/search-bar.js +2 -0
  31. package/2x/cjs/components/text-area/text-area.js +1 -1
  32. package/2x/cjs/components/virtual-input/virtual-input.js +2 -1
  33. package/2x/cjs/global/index.js +2 -0
  34. package/2x/cjs/locales/base.d.ts +1 -0
  35. package/2x/cjs/locales/base.js +2 -1
  36. package/2x/cjs/locales/en-US.d.ts +1 -0
  37. package/2x/cjs/locales/es-ES.d.ts +1 -0
  38. package/2x/cjs/locales/fa-IR.d.ts +1 -0
  39. package/2x/cjs/locales/ko-KR.d.ts +1 -0
  40. package/2x/cjs/locales/zh-CN.d.ts +1 -0
  41. package/2x/cjs/locales/zh-CN.js +2 -1
  42. package/2x/cjs/locales/zh-HK.d.ts +1 -0
  43. package/2x/cjs/locales/zh-TW.d.ts +1 -0
  44. package/2x/cjs/utils/is-node-with-content.d.ts +4 -0
  45. package/2x/cjs/utils/is-node-with-content.js +10 -0
  46. package/2x/es/components/button/button.d.ts +6 -4
  47. package/2x/es/components/button/button.js +30 -8
  48. package/2x/es/components/calendar/calendar.css +2 -2
  49. package/2x/es/components/calendar/calendar.d.ts +2 -0
  50. package/2x/es/components/calendar/calendar.js +6 -2
  51. package/2x/es/components/cascade-picker/cascade-picker-utils.d.ts +2 -2
  52. package/2x/es/components/cascade-picker/cascade-picker-utils.js +35 -15
  53. package/2x/es/components/cascade-picker/cascade-picker.js +3 -7
  54. package/2x/es/components/cascade-picker-view/cascade-picker-view.js +3 -7
  55. package/2x/es/components/date-picker/date-picker.js +1 -0
  56. package/2x/es/components/dialog/dialog-action-button.js +3 -21
  57. package/2x/es/components/floating-panel/floating-panel.js +1 -1
  58. package/2x/es/components/form/context.d.ts +1 -0
  59. package/2x/es/components/form/context.js +2 -1
  60. package/2x/es/components/form/form-item.css +1 -1
  61. package/2x/es/components/form/form-item.js +3 -1
  62. package/2x/es/components/form/form.d.ts +0 -3
  63. package/2x/es/components/form/form.js +4 -2
  64. package/2x/es/components/form/index.css +1 -1
  65. package/2x/es/components/form/index.d.ts +2 -2
  66. package/2x/es/components/form/index.js +3 -2
  67. package/2x/es/components/image-uploader/image-uploader.js +8 -2
  68. package/2x/es/components/index-bar/panel.d.ts +1 -0
  69. package/2x/es/components/input/input.css +4 -0
  70. package/2x/es/components/input/input.d.ts +2 -0
  71. package/2x/es/components/input/input.js +13 -2
  72. package/2x/es/components/list/list-item.js +6 -5
  73. package/2x/es/components/modal/modal-action-button.js +3 -21
  74. package/2x/es/components/search-bar/search-bar.d.ts +2 -0
  75. package/2x/es/components/search-bar/search-bar.js +2 -0
  76. package/2x/es/components/text-area/text-area.js +2 -2
  77. package/2x/es/components/virtual-input/virtual-input.js +2 -1
  78. package/2x/es/global/index.js +2 -0
  79. package/2x/es/locales/base.d.ts +1 -0
  80. package/2x/es/locales/base.js +2 -1
  81. package/2x/es/locales/en-US.d.ts +1 -0
  82. package/2x/es/locales/es-ES.d.ts +1 -0
  83. package/2x/es/locales/fa-IR.d.ts +1 -0
  84. package/2x/es/locales/ko-KR.d.ts +1 -0
  85. package/2x/es/locales/zh-CN.d.ts +1 -0
  86. package/2x/es/locales/zh-CN.js +2 -1
  87. package/2x/es/locales/zh-HK.d.ts +1 -0
  88. package/2x/es/locales/zh-TW.d.ts +1 -0
  89. package/2x/es/utils/is-node-with-content.d.ts +4 -0
  90. package/2x/es/utils/is-node-with-content.js +3 -0
  91. package/2x/package.json +2 -2
  92. package/bundle/antd-mobile.cjs.js +122 -106
  93. package/bundle/antd-mobile.es.js +124 -108
  94. package/bundle/style.css +6 -3
  95. package/cjs/components/button/button.d.ts +6 -4
  96. package/cjs/components/button/button.js +31 -7
  97. package/cjs/components/calendar/calendar.css +2 -2
  98. package/cjs/components/calendar/calendar.d.ts +2 -0
  99. package/cjs/components/calendar/calendar.js +6 -1
  100. package/cjs/components/cascade-picker/cascade-picker-utils.d.ts +2 -2
  101. package/cjs/components/cascade-picker/cascade-picker-utils.js +37 -16
  102. package/cjs/components/cascade-picker/cascade-picker.js +2 -7
  103. package/cjs/components/cascade-picker-view/cascade-picker-view.js +2 -7
  104. package/cjs/components/date-picker/date-picker.js +1 -0
  105. package/cjs/components/dialog/dialog-action-button.js +3 -26
  106. package/cjs/components/floating-panel/floating-panel.js +1 -1
  107. package/cjs/components/form/context.d.ts +1 -0
  108. package/cjs/components/form/context.js +2 -1
  109. package/cjs/components/form/form-item.css +1 -1
  110. package/cjs/components/form/form-item.js +3 -1
  111. package/cjs/components/form/form.d.ts +0 -3
  112. package/cjs/components/form/form.js +4 -2
  113. package/cjs/components/form/index.css +1 -1
  114. package/cjs/components/form/index.d.ts +2 -2
  115. package/cjs/components/form/index.js +2 -1
  116. package/cjs/components/image-uploader/image-uploader.js +9 -2
  117. package/cjs/components/index-bar/panel.d.ts +1 -0
  118. package/cjs/components/input/input.css +3 -0
  119. package/cjs/components/input/input.d.ts +2 -0
  120. package/cjs/components/input/input.js +13 -2
  121. package/cjs/components/list/list-item.js +7 -5
  122. package/cjs/components/modal/modal-action-button.js +3 -26
  123. package/cjs/components/search-bar/search-bar.d.ts +2 -0
  124. package/cjs/components/search-bar/search-bar.js +2 -0
  125. package/cjs/components/text-area/text-area.js +1 -1
  126. package/cjs/components/virtual-input/virtual-input.js +2 -1
  127. package/cjs/global/index.js +2 -0
  128. package/cjs/locales/base.d.ts +1 -0
  129. package/cjs/locales/base.js +2 -1
  130. package/cjs/locales/en-US.d.ts +1 -0
  131. package/cjs/locales/es-ES.d.ts +1 -0
  132. package/cjs/locales/fa-IR.d.ts +1 -0
  133. package/cjs/locales/ko-KR.d.ts +1 -0
  134. package/cjs/locales/zh-CN.d.ts +1 -0
  135. package/cjs/locales/zh-CN.js +2 -1
  136. package/cjs/locales/zh-HK.d.ts +1 -0
  137. package/cjs/locales/zh-TW.d.ts +1 -0
  138. package/cjs/utils/is-node-with-content.d.ts +4 -0
  139. package/cjs/utils/is-node-with-content.js +10 -0
  140. package/es/components/button/button.d.ts +6 -4
  141. package/es/components/button/button.js +30 -8
  142. package/es/components/calendar/calendar.css +2 -2
  143. package/es/components/calendar/calendar.d.ts +2 -0
  144. package/es/components/calendar/calendar.js +6 -2
  145. package/es/components/cascade-picker/cascade-picker-utils.d.ts +2 -2
  146. package/es/components/cascade-picker/cascade-picker-utils.js +35 -15
  147. package/es/components/cascade-picker/cascade-picker.js +3 -7
  148. package/es/components/cascade-picker-view/cascade-picker-view.js +3 -7
  149. package/es/components/date-picker/date-picker.js +1 -0
  150. package/es/components/dialog/dialog-action-button.js +3 -21
  151. package/es/components/floating-panel/floating-panel.js +1 -1
  152. package/es/components/form/context.d.ts +1 -0
  153. package/es/components/form/context.js +2 -1
  154. package/es/components/form/form-item.css +1 -1
  155. package/es/components/form/form-item.js +3 -1
  156. package/es/components/form/form.d.ts +0 -3
  157. package/es/components/form/form.js +4 -2
  158. package/es/components/form/index.css +1 -1
  159. package/es/components/form/index.d.ts +2 -2
  160. package/es/components/form/index.js +3 -2
  161. package/es/components/image-uploader/image-uploader.js +8 -2
  162. package/es/components/index-bar/panel.d.ts +1 -0
  163. package/es/components/input/input.css +3 -0
  164. package/es/components/input/input.d.ts +2 -0
  165. package/es/components/input/input.js +13 -2
  166. package/es/components/list/list-item.js +6 -5
  167. package/es/components/modal/modal-action-button.js +3 -21
  168. package/es/components/search-bar/search-bar.d.ts +2 -0
  169. package/es/components/search-bar/search-bar.js +2 -0
  170. package/es/components/text-area/text-area.js +2 -2
  171. package/es/components/virtual-input/virtual-input.js +2 -1
  172. package/es/global/index.js +2 -0
  173. package/es/locales/base.d.ts +1 -0
  174. package/es/locales/base.js +2 -1
  175. package/es/locales/en-US.d.ts +1 -0
  176. package/es/locales/es-ES.d.ts +1 -0
  177. package/es/locales/fa-IR.d.ts +1 -0
  178. package/es/locales/ko-KR.d.ts +1 -0
  179. package/es/locales/zh-CN.d.ts +1 -0
  180. package/es/locales/zh-CN.js +2 -1
  181. package/es/locales/zh-HK.d.ts +1 -0
  182. package/es/locales/zh-TW.d.ts +1 -0
  183. package/es/utils/is-node-with-content.d.ts +4 -0
  184. package/es/utils/is-node-with-content.js +3 -0
  185. package/package.json +2 -2
  186. package/umd/antd-mobile.js +1 -1
  187. package/2x/cjs/components/cascade-picker/use-cascade-picker-options.d.ts +0 -5
  188. package/2x/cjs/components/cascade-picker/use-cascade-picker-options.js +0 -40
  189. package/2x/es/components/cascade-picker/use-cascade-picker-options.d.ts +0 -5
  190. package/2x/es/components/cascade-picker/use-cascade-picker-options.js +0 -32
  191. package/cjs/components/cascade-picker/use-cascade-picker-options.d.ts +0 -5
  192. package/cjs/components/cascade-picker/use-cascade-picker-options.js +0 -40
  193. package/es/components/cascade-picker/use-cascade-picker-options.d.ts +0 -5
  194. 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`
@@ -92,7 +92,7 @@
92
92
 
93
93
  .adm-form-item.adm-form-item-horizontal.adm-list-item {
94
94
  --align-items: stretch;
95
- --prefix-width: 6em;
95
+ --prefix-width: 6.8em;
96
96
  }
97
97
 
98
98
  .adm-form-item.adm-form-item-horizontal .adm-list-item-content-prefix {
@@ -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
  };
@@ -4,5 +4,6 @@ export declare type IndexBarPanelProps = {
4
4
  index: string;
5
5
  title?: ReactNode;
6
6
  brief?: ReactNode;
7
+ children?: ReactNode;
7
8
  } & NativeProps;
8
9
  export declare const Panel: FC<IndexBarPanelProps>;
@@ -68,6 +68,10 @@
68
68
  display: none;
69
69
  }
70
70
 
71
+ .adm-input-element:disabled {
72
+ opacity: 1;
73
+ }
74
+
71
75
  .adm-input-element[type='date'],
72
76
  .adm-input-element[type='time'],
73
77
  .adm-input-element[type='datetime-local'] {
@@ -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
- }), props.clearable && !!value && !props.readOnly && hasFocus && React.createElement("div", {
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 { __awaiter } from "tslib";
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: handleClick,
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: 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, useEffect, useImperativeHandle, useRef } from 'react';
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
- useEffect(() => {
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,
@@ -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
  }
@@ -86,6 +86,7 @@ export declare const base: {
86
86
  };
87
87
  ImageUploader: {
88
88
  uploading: string;
89
+ upload: string;
89
90
  };
90
91
  InfiniteScroll: {
91
92
  noMore: string;
@@ -86,7 +86,8 @@ export const base = {
86
86
  }
87
87
  },
88
88
  ImageUploader: {
89
- uploading: 'Uploading...'
89
+ uploading: 'Uploading...',
90
+ upload: 'Upload'
90
91
  },
91
92
  InfiniteScroll: {
92
93
  noMore: 'No more'
@@ -86,6 +86,7 @@ declare const enUS: {
86
86
  };
87
87
  ImageUploader: {
88
88
  uploading: string;
89
+ upload: string;
89
90
  };
90
91
  InfiniteScroll: {
91
92
  noMore: string;
@@ -86,6 +86,7 @@ declare const esES: {
86
86
  };
87
87
  ImageUploader: {
88
88
  uploading: string;
89
+ upload: string;
89
90
  };
90
91
  InfiniteScroll: {
91
92
  noMore: string;
@@ -86,6 +86,7 @@ declare const faIR: {
86
86
  };
87
87
  ImageUploader: {
88
88
  uploading: string;
89
+ upload: string;
89
90
  };
90
91
  InfiniteScroll: {
91
92
  noMore: string;
@@ -86,6 +86,7 @@ declare const koKR: {
86
86
  };
87
87
  ImageUploader: {
88
88
  uploading: string;
89
+ upload: string;
89
90
  };
90
91
  InfiniteScroll: {
91
92
  noMore: string;
@@ -86,6 +86,7 @@ declare const zhCN: {
86
86
  };
87
87
  ImageUploader: {
88
88
  uploading: string;
89
+ upload: string;
89
90
  };
90
91
  InfiniteScroll: {
91
92
  noMore: string;
@@ -88,7 +88,8 @@ const zhCN = mergeLocale(base, {
88
88
  }
89
89
  },
90
90
  ImageUploader: {
91
- uploading: '上传中...'
91
+ uploading: '上传中...',
92
+ upload: '上传'
92
93
  },
93
94
  InfiniteScroll: {
94
95
  noMore: '没有更多了'
@@ -86,6 +86,7 @@ declare const zhHK: {
86
86
  };
87
87
  ImageUploader: {
88
88
  uploading: string;
89
+ upload: string;
89
90
  };
90
91
  InfiniteScroll: {
91
92
  noMore: string;
@@ -86,6 +86,7 @@ declare const zhTW: {
86
86
  };
87
87
  ImageUploader: {
88
88
  uploading: string;
89
+ upload: string;
89
90
  };
90
91
  InfiniteScroll: {
91
92
  noMore: string;
@@ -0,0 +1,4 @@
1
+ import { ReactNode } from 'react';
2
+ declare type Regulated<T> = T extends null | undefined | false ? never : T;
3
+ export declare function isNodeWithContent(node: ReactNode): node is Regulated<ReactNode>;
4
+ export {};
@@ -0,0 +1,3 @@
1
+ export function isNodeWithContent(node) {
2
+ return node !== undefined && node !== null && node !== false;
3
+ }
package/2x/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "antd-mobile",
3
- "version": "5.10.4",
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.24.0",
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"