antd-mobile 5.25.1 → 5.26.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.
Files changed (98) hide show
  1. package/2x/bundle/antd-mobile.cjs.development.js +188 -121
  2. package/2x/bundle/antd-mobile.cjs.js +8 -8
  3. package/2x/bundle/antd-mobile.es.development.js +188 -121
  4. package/2x/bundle/antd-mobile.es.js +3936 -3910
  5. package/2x/bundle/antd-mobile.umd.development.js +188 -121
  6. package/2x/bundle/antd-mobile.umd.js +8 -8
  7. package/2x/bundle/style.css +29 -5
  8. package/2x/cjs/components/calendar/calendar.js +9 -1
  9. package/2x/cjs/components/floating-bubble/floating-bubble.d.ts +8 -0
  10. package/2x/cjs/components/floating-bubble/floating-bubble.js +25 -5
  11. package/2x/cjs/components/form/form.d.ts +1 -1
  12. package/2x/cjs/components/image-uploader/image-uploader.css +16 -1
  13. package/2x/cjs/components/image-uploader/image-uploader.d.ts +4 -1
  14. package/2x/cjs/components/image-uploader/image-uploader.js +46 -9
  15. package/2x/cjs/components/image-uploader/preview-item.d.ts +2 -1
  16. package/2x/cjs/components/image-uploader/preview-item.js +5 -7
  17. package/2x/cjs/components/mask/mask.d.ts +1 -1
  18. package/2x/cjs/components/mask/mask.js +6 -2
  19. package/2x/cjs/components/notice-bar/notice-bar.css +13 -4
  20. package/2x/cjs/components/notice-bar/notice-bar.d.ts +10 -8
  21. package/2x/cjs/components/notice-bar/notice-bar.js +5 -2
  22. package/2x/cjs/components/stepper/stepper.d.ts +2 -0
  23. package/2x/cjs/components/stepper/stepper.js +55 -32
  24. package/2x/cjs/components/water-mark/water-mark.d.ts +1 -1
  25. package/2x/cjs/components/water-mark/water-mark.js +5 -1
  26. package/2x/es/components/calendar/calendar.js +9 -1
  27. package/2x/es/components/floating-bubble/floating-bubble.d.ts +8 -0
  28. package/2x/es/components/floating-bubble/floating-bubble.js +26 -6
  29. package/2x/es/components/form/form.d.ts +1 -1
  30. package/2x/es/components/image-uploader/image-uploader.css +16 -1
  31. package/2x/es/components/image-uploader/image-uploader.d.ts +4 -1
  32. package/2x/es/components/image-uploader/image-uploader.js +48 -11
  33. package/2x/es/components/image-uploader/preview-item.d.ts +2 -1
  34. package/2x/es/components/image-uploader/preview-item.js +6 -8
  35. package/2x/es/components/mask/mask.d.ts +1 -1
  36. package/2x/es/components/mask/mask.js +6 -2
  37. package/2x/es/components/notice-bar/notice-bar.css +13 -4
  38. package/2x/es/components/notice-bar/notice-bar.d.ts +10 -8
  39. package/2x/es/components/notice-bar/notice-bar.js +5 -2
  40. package/2x/es/components/stepper/stepper.d.ts +2 -0
  41. package/2x/es/components/stepper/stepper.js +55 -32
  42. package/2x/es/components/water-mark/water-mark.d.ts +1 -1
  43. package/2x/es/components/water-mark/water-mark.js +5 -1
  44. package/2x/package.json +9 -9
  45. package/bundle/antd-mobile.cjs.development.js +188 -121
  46. package/bundle/antd-mobile.cjs.js +8 -8
  47. package/bundle/antd-mobile.compatible.umd.js +1 -1
  48. package/bundle/antd-mobile.es.development.js +188 -121
  49. package/bundle/antd-mobile.es.js +3936 -3910
  50. package/bundle/antd-mobile.umd.development.js +188 -121
  51. package/bundle/antd-mobile.umd.js +8 -8
  52. package/bundle/style.css +1 -1
  53. package/cjs/components/calendar/calendar.js +9 -1
  54. package/cjs/components/floating-bubble/floating-bubble.d.ts +8 -0
  55. package/cjs/components/floating-bubble/floating-bubble.js +25 -5
  56. package/cjs/components/form/form.d.ts +1 -1
  57. package/cjs/components/image-uploader/image-uploader.css +15 -1
  58. package/cjs/components/image-uploader/image-uploader.d.ts +4 -1
  59. package/cjs/components/image-uploader/image-uploader.js +46 -9
  60. package/cjs/components/image-uploader/preview-item.d.ts +2 -1
  61. package/cjs/components/image-uploader/preview-item.js +5 -7
  62. package/cjs/components/mask/mask.d.ts +1 -1
  63. package/cjs/components/mask/mask.js +6 -2
  64. package/cjs/components/notice-bar/notice-bar.css +11 -4
  65. package/cjs/components/notice-bar/notice-bar.d.ts +10 -8
  66. package/cjs/components/notice-bar/notice-bar.js +5 -2
  67. package/cjs/components/stepper/stepper.d.ts +2 -0
  68. package/cjs/components/stepper/stepper.js +55 -32
  69. package/cjs/components/water-mark/water-mark.d.ts +1 -1
  70. package/cjs/components/water-mark/water-mark.js +5 -1
  71. package/es/components/calendar/calendar.js +9 -1
  72. package/es/components/floating-bubble/floating-bubble.d.ts +8 -0
  73. package/es/components/floating-bubble/floating-bubble.js +26 -6
  74. package/es/components/form/form.d.ts +1 -1
  75. package/es/components/image-uploader/image-uploader.css +15 -1
  76. package/es/components/image-uploader/image-uploader.d.ts +4 -1
  77. package/es/components/image-uploader/image-uploader.js +48 -11
  78. package/es/components/image-uploader/preview-item.d.ts +2 -1
  79. package/es/components/image-uploader/preview-item.js +6 -8
  80. package/es/components/mask/mask.d.ts +1 -1
  81. package/es/components/mask/mask.js +6 -2
  82. package/es/components/notice-bar/notice-bar.css +11 -4
  83. package/es/components/notice-bar/notice-bar.d.ts +10 -8
  84. package/es/components/notice-bar/notice-bar.js +5 -2
  85. package/es/components/stepper/stepper.d.ts +2 -0
  86. package/es/components/stepper/stepper.js +55 -32
  87. package/es/components/water-mark/water-mark.d.ts +1 -1
  88. package/es/components/water-mark/water-mark.js +5 -1
  89. package/package.json +9 -9
  90. package/umd/antd-mobile.js +1 -1
  91. package/2x/cjs/components/image/test/image.test.d.ts +0 -1
  92. package/2x/cjs/components/image/test/image.test.js +0 -73
  93. package/2x/es/components/image/test/image.test.d.ts +0 -1
  94. package/2x/es/components/image/test/image.test.js +0 -70
  95. package/cjs/components/image/test/image.test.d.ts +0 -1
  96. package/cjs/components/image/test/image.test.js +0 -73
  97. package/es/components/image/test/image.test.d.ts +0 -1
  98. package/es/components/image/test/image.test.js +0 -70
@@ -1,18 +1,23 @@
1
1
  import { __awaiter } from "tslib";
2
2
  import React, { useRef, useState } from 'react';
3
- import { AddOutline } from 'antd-mobile-icons';
3
+ import { AddOutline, CloseOutline } from 'antd-mobile-icons';
4
4
  import { mergeProps } from '../../utils/with-default-props';
5
5
  import ImageViewer from '../image-viewer';
6
6
  import PreviewItem from './preview-item';
7
7
  import { usePropsValue } from '../../utils/use-props-value';
8
- import { useIsomorphicLayoutEffect, useUnmount } from 'ahooks';
8
+ import { useIsomorphicLayoutEffect, useUnmount, useSize } from 'ahooks';
9
9
  import Space from '../space';
10
10
  import { withNativeProps } from '../../utils/native-props';
11
+ import { measureCSSLength } from '../../utils/measure-css-length';
11
12
  import { useConfig } from '../config-provider';
13
+ import Grid from '../grid';
12
14
  const classPrefix = `adm-image-uploader`;
13
15
  const defaultProps = {
14
16
  disableUpload: false,
15
17
  deletable: true,
18
+ deleteIcon: React.createElement(CloseOutline, {
19
+ className: `${classPrefix}-cell-delete-icon`
20
+ }),
16
21
  showUpload: true,
17
22
  multiple: false,
18
23
  maxCount: 0,
@@ -27,8 +32,26 @@ export const ImageUploader = p => {
27
32
  locale
28
33
  } = useConfig();
29
34
  const props = mergeProps(defaultProps, p);
35
+ const {
36
+ columns
37
+ } = props;
30
38
  const [value, setValue] = usePropsValue(props);
31
39
  const [tasks, setTasks] = useState([]);
40
+ const containerRef = useRef(null);
41
+ const containerSize = useSize(containerRef);
42
+ const gapMeasureRef = useRef(null);
43
+ const [cellSize, setCellSize] = useState(80);
44
+ useIsomorphicLayoutEffect(() => {
45
+ const gapMeasure = gapMeasureRef.current;
46
+ if (columns && containerSize && gapMeasure) {
47
+ const width = containerSize.width;
48
+ const gap = measureCSSLength(window.getComputedStyle(gapMeasure).getPropertyValue('height'));
49
+ setCellSize((width - gap * (columns - 1)) / columns);
50
+ }
51
+ }, [containerSize === null || containerSize === void 0 ? void 0 : containerSize.width]);
52
+ const style = {
53
+ '--cell-size': cellSize + 'px'
54
+ };
32
55
  useIsomorphicLayoutEffect(() => {
33
56
  setTasks(prev => prev.filter(task => {
34
57
  if (task.url === undefined) return true;
@@ -152,6 +175,7 @@ export const ImageUploader = p => {
152
175
  key: (_a = fileItem.key) !== null && _a !== void 0 ? _a : index,
153
176
  url: (_b = fileItem.thumbnailUrl) !== null && _b !== void 0 ? _b : fileItem.url,
154
177
  deletable: props.deletable,
178
+ deleteIcon: props.deleteIcon,
155
179
  imageFit: props.imageFit,
156
180
  onClick: () => {
157
181
  if (props.preview) {
@@ -169,21 +193,19 @@ export const ImageUploader = p => {
169
193
  return renderItem ? renderItem(originNode, fileItem, value) : originNode;
170
194
  });
171
195
  };
172
- return withNativeProps(props, React.createElement("div", {
173
- className: classPrefix
174
- }, React.createElement(Space, {
175
- className: `${classPrefix}-space`,
176
- wrap: true,
177
- block: true
178
- }, renderImages(), finalTasks.map(task => {
196
+ const contentNode = React.createElement(React.Fragment, null, renderImages(), tasks.map(task => {
197
+ if (!props.showFailed && task.status === 'fail') {
198
+ return null;
199
+ }
179
200
  return React.createElement(PreviewItem, {
180
201
  key: task.id,
181
202
  file: task.file,
182
203
  deletable: task.status !== 'pending',
204
+ deleteIcon: props.deleteIcon,
183
205
  status: task.status,
184
206
  imageFit: props.imageFit,
185
207
  onDelete: () => {
186
- setTasks(prev => prev.filter(x => x.id !== task.id));
208
+ setTasks(tasks.filter(x => x.id !== task.id));
187
209
  }
188
210
  });
189
211
  }), showUpload && React.createElement("div", {
@@ -202,5 +224,20 @@ export const ImageUploader = p => {
202
224
  className: `${classPrefix}-input`,
203
225
  onChange: onChange,
204
226
  "aria-hidden": true
205
- })))));
227
+ })));
228
+ return withNativeProps(props, React.createElement("div", {
229
+ className: classPrefix,
230
+ ref: containerRef
231
+ }, columns ? React.createElement(Grid, {
232
+ className: `${classPrefix}-grid`,
233
+ columns: columns,
234
+ style: style
235
+ }, React.createElement("div", {
236
+ className: `${classPrefix}-gap-measure`,
237
+ ref: gapMeasureRef
238
+ }), contentNode.props.children) : React.createElement(Space, {
239
+ className: `${classPrefix}-space`,
240
+ wrap: true,
241
+ block: true
242
+ }, contentNode.props.children)));
206
243
  };
@@ -1,10 +1,11 @@
1
- import { FC } from 'react';
1
+ import React, { FC } from 'react';
2
2
  import { TaskStatus } from './image-uploader';
3
3
  import type { ImageProps } from '../image';
4
4
  declare type Props = {
5
5
  onClick?: () => void;
6
6
  onDelete?: () => void;
7
7
  deletable: boolean;
8
+ deleteIcon: React.ReactNode;
8
9
  url?: string;
9
10
  file?: File;
10
11
  status?: TaskStatus;
@@ -1,5 +1,4 @@
1
- import React, { useLayoutEffect, useMemo } from 'react';
2
- import { CloseOutline } from 'antd-mobile-icons';
1
+ import React, { useEffect, useMemo } from 'react';
3
2
  import classNames from 'classnames';
4
3
  import Image from '../image';
5
4
  import SpinLoading from '../spin-loading';
@@ -13,6 +12,7 @@ const PreviewItem = props => {
13
12
  url,
14
13
  file,
15
14
  deletable,
15
+ deleteIcon,
16
16
  onDelete,
17
17
  imageFit
18
18
  } = props;
@@ -25,11 +25,11 @@ const PreviewItem = props => {
25
25
  }
26
26
  return '';
27
27
  }, [url, file]);
28
- useLayoutEffect(() => {
28
+ useEffect(() => {
29
29
  return () => {
30
- URL.revokeObjectURL(src);
30
+ if (file) URL.revokeObjectURL(src);
31
31
  };
32
- }, [src]);
32
+ }, [src, file]);
33
33
  function renderLoading() {
34
34
  return props.status === 'pending' && React.createElement("div", {
35
35
  className: `${classPrefix}-cell-mask`
@@ -45,9 +45,7 @@ const PreviewItem = props => {
45
45
  return deletable && React.createElement("span", {
46
46
  className: `${classPrefix}-cell-delete`,
47
47
  onClick: onDelete
48
- }, React.createElement(CloseOutline, {
49
- className: `${classPrefix}-cell-delete-icon`
50
- }));
48
+ }, deleteIcon);
51
49
  }
52
50
  return React.createElement("div", {
53
51
  className: classNames(`${classPrefix}-cell`, props.status === 'fail' && `${classPrefix}-cell-fail`)
@@ -8,7 +8,7 @@ export declare type MaskProps = {
8
8
  destroyOnClose?: boolean;
9
9
  forceRender?: boolean;
10
10
  disableBodyScroll?: boolean;
11
- color?: 'black' | 'white';
11
+ color?: 'white' | 'black' | (string & {});
12
12
  opacity?: 'default' | 'thin' | 'thick' | number;
13
13
  getContainer?: GetContainer;
14
14
  afterShow?: () => void;
@@ -14,6 +14,10 @@ const opacityRecord = {
14
14
  thin: 0.35,
15
15
  thick: 0.75
16
16
  };
17
+ const colorRecord = {
18
+ black: '0, 0, 0',
19
+ white: '255, 255, 255'
20
+ };
17
21
  const defaultProps = {
18
22
  visible: true,
19
23
  destroyOnClose: false,
@@ -34,8 +38,8 @@ export const Mask = p => {
34
38
  const background = useMemo(() => {
35
39
  var _a;
36
40
  const opacity = (_a = opacityRecord[props.opacity]) !== null && _a !== void 0 ? _a : props.opacity;
37
- const rgb = props.color === 'white' ? '255, 255, 255' : '0, 0, 0';
38
- return `rgba(${rgb}, ${opacity})`;
41
+ const rgb = colorRecord[props.color];
42
+ return rgb ? `rgba(${rgb}, ${opacity})` : props.color;
39
43
  }, [props.color, props.opacity]);
40
44
  const [active, setActive] = useState(props.visible);
41
45
  const unmountedRef = useUnmountedRef();
@@ -4,11 +4,10 @@
4
4
  --text-color: var(--adm-color-white);
5
5
  --font-size: var(--adm-font-size-7);
6
6
  --icon-font-size: var(--adm-font-size-10);
7
- --height: 38px;
7
+ --height: 40px;
8
8
  height: var(--height);
9
9
  box-sizing: border-box;
10
10
  font-size: var(--font-size);
11
- line-height: var(--height);
12
11
  padding: 0 12px;
13
12
  display: flex;
14
13
  align-items: center;
@@ -41,7 +40,6 @@
41
40
  flex-shrink: 0;
42
41
  margin-right: 8px;
43
42
  font-size: var(--icon-font-size);
44
- line-height: var(--height);
45
43
  }
46
44
  .adm-notice-bar .adm-notice-bar-content {
47
45
  flex: 1;
@@ -54,9 +52,11 @@
54
52
  .adm-notice-bar .adm-notice-bar-content .adm-notice-bar-content-inner {
55
53
  width: auto;
56
54
  transition-timing-function: linear;
57
- position: absolute;
58
55
  white-space: nowrap;
59
56
  }
57
+ .adm-notice-bar-wrap.adm-notice-bar .adm-notice-bar-content .adm-notice-bar-content-inner {
58
+ white-space: normal;
59
+ }
60
60
  .adm-notice-bar .adm-notice-bar-right {
61
61
  flex-shrink: 0;
62
62
  margin-left: 12px;
@@ -72,3 +72,10 @@
72
72
  .adm-notice-bar-close-icon {
73
73
  font-size: var(--adm-font-size-10);
74
74
  }
75
+ .adm-notice-bar-wrap {
76
+ height: auto;
77
+ align-items: flex-start;
78
+ padding-top: 8px;
79
+ padding-bottom: 8px;
80
+ line-height: 22px;
81
+ }
@@ -1,21 +1,23 @@
1
1
  import React from 'react';
2
2
  import { NativeProps } from '../../utils/native-props';
3
3
  export declare type NoticeBarProps = {
4
- /** 通告栏的类型 */
4
+ /** The type of the NoticeBar */
5
5
  color?: 'default' | 'alert' | 'error' | 'info';
6
- /** 开始滚动的延迟,单位 ms */
6
+ /** TDelay to start scrolling, unit ms */
7
7
  delay?: number;
8
- /** 滚动速度,单位 px/s */
8
+ /** Scroll speed, unit px/s */
9
9
  speed?: number;
10
- /** 公告内容 */
10
+ /** The content of the NoticeBar */
11
11
  content: React.ReactNode;
12
- /** 是否可关闭 */
12
+ /** Whether it can be closed */
13
13
  closeable?: boolean;
14
- /** 关闭时的回调 */
14
+ /** Callback when closed */
15
15
  onClose?: () => void;
16
- /** 额外操作区域,显示在关闭按钮左侧 */
16
+ /** Additional operating area, displayed to the left of the close button */
17
17
  extra?: React.ReactNode;
18
- /** 左侧广播图标 */
18
+ /** Radio icon on the left */
19
19
  icon?: React.ReactNode;
20
+ /** Whether to display multiple lines */
21
+ wrap?: boolean;
20
22
  } & NativeProps<'--background-color' | '--border-color' | '--text-color' | '--font-size' | '--icon-font-size' | '--height'>;
21
23
  export declare const NoticeBar: React.NamedExoticComponent<NoticeBarProps>;
@@ -11,6 +11,7 @@ const defaultProps = {
11
11
  color: 'default',
12
12
  delay: 2000,
13
13
  speed: 50,
14
+ wrap: false,
14
15
  icon: React.createElement(SoundOutline, null)
15
16
  };
16
17
  export const NoticeBar = memo(p => {
@@ -22,7 +23,7 @@ export const NoticeBar = memo(p => {
22
23
  const delayLockRef = useRef(true);
23
24
  const animatingRef = useRef(false);
24
25
  function start() {
25
- if (delayLockRef.current) return;
26
+ if (delayLockRef.current || props.wrap) return;
26
27
  const container = containerRef.current;
27
28
  const text = textRef.current;
28
29
  if (!container || !text) return;
@@ -61,7 +62,9 @@ export const NoticeBar = memo(p => {
61
62
  });
62
63
  if (!visible) return null;
63
64
  return withNativeProps(props, React.createElement("div", {
64
- className: classNames(classPrefix, `${classPrefix}-${props.color}`)
65
+ className: classNames(classPrefix, `${classPrefix}-${props.color}`, {
66
+ [`${classPrefix}-wrap`]: props.wrap
67
+ })
65
68
  }, props.icon && React.createElement("span", {
66
69
  className: `${classPrefix}-left`
67
70
  }, props.icon), React.createElement("span", {
@@ -20,6 +20,8 @@ export declare type StepperProps = Pick<InputProps, 'onFocus' | 'onBlur'> & (Val
20
20
  digits?: number;
21
21
  disabled?: boolean;
22
22
  inputReadOnly?: boolean;
23
+ parser?: (text: string) => number;
24
+ formatter?: (value?: number) => string;
23
25
  } & NativeProps<'--height' | '--input-width' | '--input-font-size' | '--input-background-color' | '--border-radius' | '--border' | '--border-inner' | '--active-border' | '--button-font-size' | '--button-background-color' | '--button-width' | '--input-font-color' | '--button-text-color'>;
24
26
  export declare const Stepper: FC<StepperProps>;
25
27
  export {};
@@ -23,35 +23,45 @@ export const Stepper = p => {
23
23
  step,
24
24
  max,
25
25
  min,
26
- inputReadOnly
26
+ inputReadOnly,
27
+ digits,
28
+ formatter,
29
+ parser
27
30
  } = props;
28
31
  const {
29
32
  locale
30
33
  } = useConfig();
34
+ // ========================== Parse / Format ==========================
35
+ const parseValue = text => {
36
+ if (text === '') return null;
37
+ return parser ? parser(text) : parseFloat(text);
38
+ };
39
+ const formatValue = value => {
40
+ if (value === null) return '';
41
+ if (formatter) {
42
+ return formatter(value);
43
+ } else if (digits !== undefined) {
44
+ return value.toFixed(digits);
45
+ } else {
46
+ return value.toString();
47
+ }
48
+ };
49
+ // ======================== Value & InputValue ========================
31
50
  const [value, setValue] = usePropsValue(props);
32
- const [inputValue, setInputValue] = useState(() => convertValueToText(value, props.digits));
51
+ const [inputValue, setInputValue] = useState(() => formatValue(value));
52
+ // >>>>> Value
33
53
  function setValueWithCheck(v) {
34
54
  if (isNaN(v)) return;
35
55
  let target = bound(v, props.min, props.max);
36
- if (props.digits !== undefined) {
37
- target = parseFloat(target.toFixed(props.digits));
56
+ if (digits !== undefined) {
57
+ target = parseFloat(target.toFixed(digits));
38
58
  }
39
59
  setValue(target);
40
60
  }
41
- const [hasFocus, setHasFocus] = useState(false);
42
- useEffect(() => {
43
- if (!hasFocus) {
44
- setInputValue(convertValueToText(value, props.digits));
45
- }
46
- }, [hasFocus]);
47
- useEffect(() => {
48
- if (!hasFocus) {
49
- setInputValue(convertValueToText(value, props.digits));
50
- }
51
- }, [value, props.digits]);
61
+ // >>>>> Input
52
62
  const handleInputChange = v => {
53
63
  setInputValue(v);
54
- const value = convertTextToValue(v);
64
+ const value = parseValue(v);
55
65
  if (value === null) {
56
66
  if (props.allowEmpty) {
57
67
  setValue(null);
@@ -62,6 +72,29 @@ export const Stepper = p => {
62
72
  setValueWithCheck(value);
63
73
  }
64
74
  };
75
+ // ============================== Focus ===============================
76
+ const [focused, setFocused] = useState(false);
77
+ const inputRef = React.useRef(null);
78
+ function triggerFocus(nextFocus) {
79
+ setFocused(nextFocus);
80
+ // We will convert value to original text when focus
81
+ if (nextFocus) {
82
+ setInputValue(typeof value === 'number' ? String(value) : '');
83
+ }
84
+ }
85
+ useEffect(() => {
86
+ var _a, _b, _c;
87
+ if (focused) {
88
+ (_c = (_b = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.nativeElement) === null || _b === void 0 ? void 0 : _b.select) === null || _c === void 0 ? void 0 : _c.call(_b);
89
+ }
90
+ }, [focused]);
91
+ // Focus change to format value
92
+ useEffect(() => {
93
+ if (!focused) {
94
+ setInputValue(formatValue(value));
95
+ }
96
+ }, [focused, value, digits]);
97
+ // ============================ Operations ============================
65
98
  const handleMinus = () => {
66
99
  setValueWithCheck(Big(value !== null && value !== void 0 ? value : 0).minus(step).toNumber());
67
100
  };
@@ -84,9 +117,10 @@ export const Stepper = p => {
84
117
  }
85
118
  return false;
86
119
  };
120
+ // ============================== Render ==============================
87
121
  return withNativeProps(props, React.createElement("div", {
88
122
  className: classNames(classPrefix, {
89
- [`${classPrefix}-active`]: hasFocus
123
+ [`${classPrefix}-active`]: focused
90
124
  })
91
125
  }, React.createElement(Button, {
92
126
  className: `${classPrefix}-minus`,
@@ -99,10 +133,11 @@ export const Stepper = p => {
99
133
  }, React.createElement(MinusOutline, null)), React.createElement("div", {
100
134
  className: `${classPrefix}-middle`
101
135
  }, React.createElement(Input, {
136
+ ref: inputRef,
102
137
  className: `${classPrefix}-input`,
103
138
  onFocus: e => {
104
139
  var _a;
105
- setHasFocus(true);
140
+ triggerFocus(true);
106
141
  (_a = props.onFocus) === null || _a === void 0 ? void 0 : _a.call(props, e);
107
142
  },
108
143
  value: inputValue,
@@ -112,7 +147,7 @@ export const Stepper = p => {
112
147
  disabled: disabled,
113
148
  onBlur: e => {
114
149
  var _a;
115
- setHasFocus(false);
150
+ triggerFocus(false);
116
151
  (_a = props.onBlur) === null || _a === void 0 ? void 0 : _a.call(props, e);
117
152
  },
118
153
  readOnly: inputReadOnly,
@@ -130,16 +165,4 @@ export const Stepper = p => {
130
165
  color: 'primary',
131
166
  "aria-label": locale.Stepper.increase
132
167
  }, React.createElement(AddOutline, null))));
133
- };
134
- function convertValueToText(value, digits) {
135
- if (value === null) return '';
136
- if (digits !== undefined) {
137
- return value.toFixed(digits);
138
- } else {
139
- return value.toString();
140
- }
141
- }
142
- function convertTextToValue(text) {
143
- if (text === '') return null;
144
- return parseFloat(text);
145
- }
168
+ };
@@ -10,7 +10,7 @@ export declare type WaterMarkProps = {
10
10
  image?: string;
11
11
  imageWidth?: number;
12
12
  imageHeight?: number;
13
- content?: string;
13
+ content?: string | string[];
14
14
  fontColor?: string;
15
15
  fontStyle?: 'none' | 'normal' | 'italic' | 'oblique';
16
16
  fontFamily?: string;
@@ -58,7 +58,11 @@ export const WaterMark = p => {
58
58
  const markSize = Number(fontSize) * ratio;
59
59
  ctx.font = `${fontStyle} normal ${fontWeight} ${markSize}px/${markHeight}px ${fontFamily}`;
60
60
  ctx.fillStyle = fontColor;
61
- ctx.fillText(content, 0, 0);
61
+ if (Array.isArray(content)) {
62
+ content.forEach((item, index) => ctx.fillText(item, 0, index * markSize));
63
+ } else {
64
+ ctx.fillText(content, 0, 0);
65
+ }
62
66
  ctx.restore();
63
67
  setBase64Url(canvas.toDataURL());
64
68
  }
package/package.json CHANGED
@@ -1,23 +1,23 @@
1
1
  {
2
2
  "name": "antd-mobile",
3
- "version": "5.25.1",
3
+ "version": "5.26.0",
4
4
  "dependencies": {
5
- "@floating-ui/dom": "^1.0.0",
6
- "@react-spring/web": "^9.4.5",
5
+ "@floating-ui/dom": "^1.0.6",
6
+ "@react-spring/web": "^9.5.5",
7
7
  "@use-gesture/react": "10.2.20",
8
- "ahooks": "^3.7.0",
8
+ "ahooks": "^3.7.2",
9
9
  "antd-mobile-icons": "^0.3.0",
10
10
  "antd-mobile-v5-count": "^1.0.1",
11
11
  "big.js": "^6.2.1",
12
- "classnames": "^2.3.1",
13
- "dayjs": "^1.11.4",
12
+ "classnames": "^2.3.2",
13
+ "dayjs": "^1.11.6",
14
14
  "lodash": "^4.17.21",
15
- "rc-field-form": "~1.27.0",
15
+ "rc-field-form": "~1.27.3",
16
16
  "react-is": "^17.0.2",
17
17
  "runes": "^0.4.3",
18
18
  "staged-components": "^1.1.3",
19
- "tslib": "^2.4.0",
20
- "use-sync-external-store": "^1.1.0"
19
+ "tslib": "^2.4.1",
20
+ "use-sync-external-store": "^1.2.0"
21
21
  },
22
22
  "peerDependencies": {
23
23
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0"