antd-mobile 5.2.1 → 5.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/2x/cjs/components/avatar/avatar.js +1 -0
  2. package/2x/cjs/components/calendar/calendar.js +23 -20
  3. package/2x/cjs/components/date-picker/date-picker.js +3 -7
  4. package/2x/cjs/components/dialog/dialog.css +27 -18
  5. package/2x/cjs/components/dialog/dialog.js +39 -42
  6. package/2x/cjs/components/dropdown/dropdown.css +2 -1
  7. package/2x/cjs/components/ellipsis/ellipsis.d.ts +2 -0
  8. package/2x/cjs/components/ellipsis/ellipsis.js +8 -5
  9. package/2x/cjs/components/form/context.d.ts +2 -1
  10. package/2x/cjs/components/form/context.js +6 -5
  11. package/2x/cjs/components/form/form-item.css +27 -1
  12. package/2x/cjs/components/form/form-item.d.ts +1 -0
  13. package/2x/cjs/components/form/form-item.js +44 -13
  14. package/2x/cjs/components/form/form.js +18 -9
  15. package/2x/cjs/components/form/index.css +27 -1
  16. package/2x/cjs/components/input/input.js +2 -2
  17. package/2x/cjs/components/modal/modal.css +27 -21
  18. package/2x/cjs/components/modal/modal.js +39 -36
  19. package/2x/cjs/components/popover/arrow.js +1 -2
  20. package/2x/cjs/components/pull-to-refresh/pull-to-refresh.js +1 -1
  21. package/2x/cjs/components/switch/spin-icon.d.ts +3 -0
  22. package/2x/cjs/components/switch/spin-icon.js +37 -0
  23. package/2x/cjs/components/switch/switch.css +1 -1
  24. package/2x/cjs/components/switch/switch.js +4 -6
  25. package/2x/cjs/locales/base.d.ts +51 -0
  26. package/2x/cjs/locales/base.js +52 -0
  27. package/2x/cjs/locales/en-US.d.ts +51 -0
  28. package/2x/cjs/locales/zh-CN.d.ts +51 -0
  29. package/2x/cjs/locales/zh-CN.js +52 -0
  30. package/2x/es/components/avatar/avatar.js +1 -0
  31. package/2x/es/components/calendar/calendar.js +23 -19
  32. package/2x/es/components/date-picker/date-picker.js +3 -7
  33. package/2x/es/components/dialog/dialog.css +27 -18
  34. package/2x/es/components/dialog/dialog.js +37 -41
  35. package/2x/es/components/dropdown/dropdown.css +2 -1
  36. package/2x/es/components/ellipsis/ellipsis.d.ts +2 -0
  37. package/2x/es/components/ellipsis/ellipsis.js +7 -5
  38. package/2x/es/components/form/context.d.ts +2 -1
  39. package/2x/es/components/form/context.js +4 -3
  40. package/2x/es/components/form/form-item.css +27 -1
  41. package/2x/es/components/form/form-item.d.ts +1 -0
  42. package/2x/es/components/form/form-item.js +43 -13
  43. package/2x/es/components/form/form.js +18 -11
  44. package/2x/es/components/form/index.css +27 -1
  45. package/2x/es/components/input/input.js +2 -2
  46. package/2x/es/components/modal/modal.css +27 -21
  47. package/2x/es/components/modal/modal.js +37 -36
  48. package/2x/es/components/popover/arrow.js +1 -2
  49. package/2x/es/components/pull-to-refresh/pull-to-refresh.js +1 -1
  50. package/2x/es/components/switch/spin-icon.d.ts +3 -0
  51. package/2x/es/components/switch/spin-icon.js +23 -0
  52. package/2x/es/components/switch/switch.css +1 -1
  53. package/2x/es/components/switch/switch.js +3 -5
  54. package/2x/es/locales/base.d.ts +51 -0
  55. package/2x/es/locales/base.js +52 -0
  56. package/2x/es/locales/en-US.d.ts +51 -0
  57. package/2x/es/locales/zh-CN.d.ts +51 -0
  58. package/2x/es/locales/zh-CN.js +52 -0
  59. package/2x/package.json +4 -4
  60. package/cjs/components/avatar/avatar.js +1 -0
  61. package/cjs/components/calendar/calendar.js +23 -20
  62. package/cjs/components/date-picker/date-picker.js +3 -7
  63. package/cjs/components/dialog/dialog.css +26 -18
  64. package/cjs/components/dialog/dialog.js +39 -42
  65. package/cjs/components/dropdown/dropdown.css +2 -1
  66. package/cjs/components/ellipsis/ellipsis.d.ts +2 -0
  67. package/cjs/components/ellipsis/ellipsis.js +8 -5
  68. package/cjs/components/form/context.d.ts +2 -1
  69. package/cjs/components/form/context.js +6 -5
  70. package/cjs/components/form/form-item.css +21 -1
  71. package/cjs/components/form/form-item.d.ts +1 -0
  72. package/cjs/components/form/form-item.js +44 -13
  73. package/cjs/components/form/form.js +18 -9
  74. package/cjs/components/form/index.css +21 -1
  75. package/cjs/components/input/input.js +2 -2
  76. package/cjs/components/modal/modal.css +26 -20
  77. package/cjs/components/modal/modal.js +39 -36
  78. package/cjs/components/popover/arrow.js +1 -2
  79. package/cjs/components/pull-to-refresh/pull-to-refresh.js +1 -1
  80. package/cjs/components/switch/spin-icon.d.ts +3 -0
  81. package/cjs/components/switch/spin-icon.js +37 -0
  82. package/cjs/components/switch/switch.css +1 -1
  83. package/cjs/components/switch/switch.js +4 -6
  84. package/cjs/locales/base.d.ts +51 -0
  85. package/cjs/locales/base.js +52 -0
  86. package/cjs/locales/en-US.d.ts +51 -0
  87. package/cjs/locales/zh-CN.d.ts +51 -0
  88. package/cjs/locales/zh-CN.js +52 -0
  89. package/es/components/avatar/avatar.js +1 -0
  90. package/es/components/calendar/calendar.js +23 -19
  91. package/es/components/date-picker/date-picker.js +3 -7
  92. package/es/components/dialog/dialog.css +26 -18
  93. package/es/components/dialog/dialog.js +37 -41
  94. package/es/components/dropdown/dropdown.css +2 -1
  95. package/es/components/ellipsis/ellipsis.d.ts +2 -0
  96. package/es/components/ellipsis/ellipsis.js +7 -5
  97. package/es/components/form/context.d.ts +2 -1
  98. package/es/components/form/context.js +4 -3
  99. package/es/components/form/form-item.css +21 -1
  100. package/es/components/form/form-item.d.ts +1 -0
  101. package/es/components/form/form-item.js +43 -13
  102. package/es/components/form/form.js +18 -11
  103. package/es/components/form/index.css +21 -1
  104. package/es/components/input/input.js +2 -2
  105. package/es/components/modal/modal.css +26 -20
  106. package/es/components/modal/modal.js +37 -36
  107. package/es/components/popover/arrow.js +1 -2
  108. package/es/components/pull-to-refresh/pull-to-refresh.js +1 -1
  109. package/es/components/switch/spin-icon.d.ts +3 -0
  110. package/es/components/switch/spin-icon.js +23 -0
  111. package/es/components/switch/switch.css +1 -1
  112. package/es/components/switch/switch.js +3 -5
  113. package/es/locales/base.d.ts +51 -0
  114. package/es/locales/base.js +52 -0
  115. package/es/locales/en-US.d.ts +51 -0
  116. package/es/locales/zh-CN.d.ts +51 -0
  117. package/es/locales/zh-CN.js +52 -0
  118. package/package.json +4 -4
  119. package/umd/antd-mobile.js +1 -1
  120. package/umd/antd-mobile.js.LICENSE.txt +0 -24
  121. package/2x/assets/spin.svg +0 -12
  122. package/2x/cjs/assets/spin.svg +0 -12
  123. package/2x/es/assets/spin.svg +0 -12
  124. package/assets/spin.svg +0 -12
  125. package/cjs/assets/spin.svg +0 -12
  126. package/es/assets/spin.svg +0 -12
@@ -19,56 +19,61 @@
19
19
  transform: translate(-50%, -50%);
20
20
  }
21
21
 
22
- .adm-modal-main {
22
+ .adm-modal-body {
23
23
  width: 100%;
24
24
  max-height: 70vh;
25
25
  box-sizing: border-box;
26
26
  font-size: 28px;
27
27
  background-color: white;
28
28
  border-radius: 16px;
29
- overflow-x: hidden;
30
- overflow-y: auto;
29
+ overflow: hidden;
31
30
  display: flex;
32
31
  flex-direction: column;
33
32
  }
34
33
 
35
- .adm-modal-main > * {
34
+ .adm-modal-body > * {
36
35
  flex: none;
37
36
  }
38
37
 
39
- .adm-modal-main > .adm-modal-image-container {
38
+ .adm-modal-body > .adm-modal-content {
40
39
  flex: auto;
41
40
  }
42
41
 
43
- .adm-modal-main .adm-modal-body {
44
- padding: 40px 24px 24px;
45
- display: flex;
46
- flex-direction: column;
42
+ .adm-modal-body:not(.adm-modal-with-image) {
43
+ padding-top: 40px;
47
44
  }
48
45
 
49
- .adm-modal-main .adm-modal-body > * + * {
50
- margin-top: 16px;
46
+ .adm-modal-body .adm-modal-image-container {
47
+ margin-bottom: 24px;
48
+ max-height: 40vh;
49
+ overflow-y: scroll;
51
50
  }
52
51
 
53
- .adm-modal-main .adm-modal-body-header-wrapper {
54
- display: flex;
55
- justify-content: center;
52
+ .adm-modal-body .adm-modal-header {
53
+ margin-bottom: 16px;
54
+ padding: 0 24px;
56
55
  }
57
56
 
58
- .adm-modal-main .adm-modal-body-title {
57
+ .adm-modal-body .adm-modal-title {
58
+ margin-bottom: 16px;
59
+ padding: 0 24px;
59
60
  font-weight: bold;
60
61
  font-size: 36px;
61
62
  line-height: 50px;
62
63
  text-align: center;
63
64
  }
64
65
 
65
- .adm-modal-main .adm-modal-body-content {
66
+ .adm-modal-body .adm-modal-content {
67
+ padding: 0 24px 24px;
68
+ max-height: 70vh;
69
+ overflow-x: hidden;
70
+ overflow-y: auto;
66
71
  font-size: 30px;
67
72
  line-height: 1.4;
68
73
  color: #333;
69
74
  }
70
75
 
71
- .adm-modal-main .adm-modal-close {
76
+ .adm-modal-body .adm-modal-close {
72
77
  position: absolute;
73
78
  right: 16px;
74
79
  top: 16px;
@@ -82,6 +87,11 @@
82
87
  padding: 16px 24px 24px;
83
88
  }
84
89
 
90
+ .adm-modal-footer-empty {
91
+ padding: 0;
92
+ height: 16px;
93
+ }
94
+
85
95
  .adm-modal-footer.adm-space {
86
96
  --gap-vertical: 40px;
87
97
  }
@@ -102,8 +112,4 @@
102
112
 
103
113
  .adm-modal-footer .adm-modal-button:not(.adm-modal-button-primary):active {
104
114
  opacity: 0.7;
105
- }
106
-
107
- .adm-modal-image-container {
108
- overflow-y: auto;
109
115
  }
@@ -52,49 +52,28 @@ export const Modal = p => {
52
52
  }
53
53
  });
54
54
  const [active, setActive] = useState(props.visible);
55
- const node = withStopPropagation(props.stopPropagation, withNativeProps(props, React.createElement("div", {
56
- className: classPrefix,
57
- style: {
58
- display: active ? 'unset' : 'none'
59
- }
60
- }, React.createElement(Mask, {
61
- visible: props.visible,
62
- onMaskClick: props.closeOnMaskClick ? props.onClose : undefined,
63
- style: props.maskStyle,
64
- className: classNames(`${classPrefix}-mask`, props.maskClassName)
65
- }), React.createElement("div", {
66
- className: `${classPrefix}-wrap`,
67
- style: {
68
- pointerEvents: props.visible ? 'unset' : 'none'
69
- }
70
- }, React.createElement(animated.div, {
71
- style: Object.assign({}, style),
72
- onClick: e => e.stopPropagation(),
73
- className: `${classPrefix}-main`
55
+ const body = React.createElement("div", {
56
+ className: classNames(cls('body'), props.image && cls('with-image'), props.bodyClassName),
57
+ style: props.bodyStyle
74
58
  }, props.showCloseButton && React.createElement("a", {
75
- className: classNames(`${classPrefix}-close`, 'adm-plain-anchor'),
59
+ className: classNames(cls('close'), 'adm-plain-anchor'),
76
60
  onClick: props.onClose
77
61
  }, React.createElement(CloseOutline, null)), !!props.image && React.createElement("div", {
78
- className: `${classPrefix}-image-container`
62
+ className: cls('image-container')
79
63
  }, React.createElement(Image, {
80
64
  src: props.image,
81
65
  alt: 'modal header image',
82
66
  width: '100%'
83
- })), React.createElement("div", {
84
- style: props.bodyStyle,
85
- className: classNames(`${classPrefix}-body`, props.bodyClassName)
86
- }, !!props.header && React.createElement("div", {
87
- className: `${classPrefix}-body-header-wrapper`
88
- }, React.createElement("div", {
89
- className: `${classPrefix}-body-header`
90
- }, props.header)), !!props.title && React.createElement("div", {
91
- className: `${classPrefix}-body-title`
92
- }, props.title), !!props.content && React.createElement("div", {
93
- className: `${classPrefix}-body-content`
94
- }, typeof props.content === 'string' ? React.createElement(AutoCenter, null, props.content) : props.content)), React.createElement(Space, {
67
+ })), !!props.header && React.createElement("div", {
68
+ className: cls('header')
69
+ }, React.createElement(AutoCenter, null, props.header)), !!props.title && React.createElement("div", {
70
+ className: cls('title')
71
+ }, props.title), React.createElement("div", {
72
+ className: cls('content')
73
+ }, typeof props.content === 'string' ? React.createElement(AutoCenter, null, props.content) : props.content), React.createElement(Space, {
95
74
  direction: 'vertical',
96
75
  block: true,
97
- className: `${classPrefix}-footer`
76
+ className: classNames(cls('footer'), props.actions.length === 0 && cls('footer-empty'))
98
77
  }, props.actions.map((action, index) => {
99
78
  return React.createElement(ModalActionButton, {
100
79
  key: action.key,
@@ -109,6 +88,28 @@ export const Modal = p => {
109
88
  }
110
89
  })
111
90
  });
112
- })))))));
91
+ })));
92
+ const node = withStopPropagation(props.stopPropagation, withNativeProps(props, React.createElement("div", {
93
+ className: cls(),
94
+ style: {
95
+ display: active ? 'unset' : 'none'
96
+ }
97
+ }, React.createElement(Mask, {
98
+ visible: props.visible,
99
+ onMaskClick: props.closeOnMaskClick ? props.onClose : undefined,
100
+ style: props.maskStyle,
101
+ className: classNames(cls('mask'), props.maskClassName)
102
+ }), React.createElement("div", {
103
+ className: cls('wrap'),
104
+ style: {
105
+ pointerEvents: props.visible ? 'unset' : 'none'
106
+ }
107
+ }, React.createElement(animated.div, {
108
+ style: style
109
+ }, body)))));
113
110
  return renderToContainer(props.getContainer, node);
114
- };
111
+ };
112
+
113
+ function cls(name = '') {
114
+ return 'adm-modal' + (name && '-') + name;
115
+ }
@@ -4,9 +4,8 @@ export const Arrow = memo(props => {
4
4
  return withNativeProps(props, React.createElement("svg", {
5
5
  viewBox: '0 0 30 16'
6
6
  }, React.createElement("g", {
7
- transform: 'translate(-1300.000000, -841.000000)',
8
7
  fill: 'currentColor'
9
8
  }, React.createElement("path", {
10
- d: 'M1300,841 L1330,841 L1318.07289,855.312538 C1316.65863,857.009645 1314.13637,857.238942 1312.43926,855.824685 C1312.25341,855.669808 1312.08199,855.49839 1311.92711,855.312538 L1300,841 L1300,841 Z'
9
+ d: 'M0,0 L30,0 L18.07289,14.312538 C16.65863,16.009645 14.13637,16.238942 12.43926,14.824685 C12.25341,14.669808 12.08199,14.49839 11.92711,14.312538 L0,0 L0,0 Z'
11
10
  }))));
12
11
  });
@@ -108,7 +108,7 @@ export const PullToRefresh = p => {
108
108
  if (!element) return;
109
109
  const scrollParent = getScrollParent(element);
110
110
  if (!scrollParent) return;
111
- const top = 'scrollTop' in scrollParent ? scrollParent.scrollTop : scrollParent.pageYOffset;
111
+ const top = 'scrollTop' in scrollParent ? scrollParent.scrollTop : scrollParent.scrollY;
112
112
 
113
113
  if (top <= 0 && y > 0) {
114
114
  pullingRef.current = true;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { NativeProps } from '../../utils/native-props';
3
+ export declare const SpinIcon: React.NamedExoticComponent<NativeProps<never>>;
@@ -0,0 +1,23 @@
1
+ import React, { memo } from 'react';
2
+ import { withNativeProps } from '../../utils/native-props';
3
+ export const SpinIcon = memo(props => {
4
+ return withNativeProps(props, React.createElement("svg", {
5
+ width: '28px',
6
+ height: '28px',
7
+ viewBox: '0 0 28 28'
8
+ }, React.createElement("g", {
9
+ stroke: 'none',
10
+ strokeWidth: '1',
11
+ fill: 'none',
12
+ fillRule: 'evenodd'
13
+ }, React.createElement("g", {
14
+ transform: 'translate(-137.000000, -840.000000)',
15
+ fill: '#1576FE'
16
+ }, React.createElement("g", {
17
+ transform: 'translate(80.000000, 823.000000)'
18
+ }, React.createElement("g", {
19
+ transform: 'translate(53.000000, 13.000000)'
20
+ }, React.createElement("path", {
21
+ d: 'M17.9996753,31.5 C10.5556724,31.5 4.5,25.4443275 4.5,18.0003247 C4.5,10.5563219 10.5556724,4.5 17.9996753,4.5 C18.5355492,4.5 18.9702974,4.93474816 18.9702974,5.47062208 C18.9702974,6.006496 18.5355492,6.44124416 17.9996753,6.44124416 C11.6261524,6.44124416 6.44124416,11.6267709 6.44124416,18.0002938 C6.44124416,24.3738167 11.6261524,29.5587249 17.9996753,29.5587249 C24.3731982,29.5587249 29.5587249,24.3738167 29.5587249,18.0002938 C29.5587249,14.7964616 28.2778291,11.8169616 25.9523687,9.61220279 C25.5637302,9.24317094 25.5473089,8.62893223 25.9157222,8.23967523 C26.2841356,7.84976878 26.8989928,7.83461537 27.2882498,8.20302872 C30.0042351,10.7787368 31.5,14.2580826 31.5,18.0002938 C31.5,25.4443275 25.4436781,31.5 17.9996753,31.5 Z'
22
+ })))))));
23
+ });
@@ -101,7 +101,7 @@
101
101
  opacity: 0.4;
102
102
  }
103
103
 
104
- .adm-switch-icon {
104
+ .adm-switch-spin-icon {
105
105
  width: 28px;
106
106
  height: 28px;
107
107
  animation: loading-rotate 1s linear infinite;
@@ -1,10 +1,10 @@
1
1
  import { __awaiter } from "tslib";
2
2
  import classNames from 'classnames';
3
3
  import React, { useState } from 'react';
4
- import SpinIcon from '../../assets/spin.svg';
5
4
  import { withNativeProps } from '../../utils/native-props';
6
5
  import { usePropsValue } from '../../utils/use-props-value';
7
6
  import { mergeProps } from '../../utils/with-default-props';
7
+ import { SpinIcon } from './spin-icon';
8
8
  const classPrefix = `adm-switch`;
9
9
  const defaultProps = {
10
10
  defaultChecked: false
@@ -54,10 +54,8 @@ export const Switch = p => {
54
54
  className: `${classPrefix}-checkbox`
55
55
  }, React.createElement("div", {
56
56
  className: `${classPrefix}-handle`
57
- }, (props.loading || changing) && React.createElement("img", {
58
- src: SpinIcon,
59
- className: `${classPrefix}-icon`,
60
- alt: 'switch-handle'
57
+ }, (props.loading || changing) && React.createElement(SpinIcon, {
58
+ className: `${classPrefix}-spin-icon`
61
59
  })), React.createElement("div", {
62
60
  className: `${classPrefix}-inner`
63
61
  }, checked ? props.checkedText : props.uncheckedText))));
@@ -31,6 +31,57 @@ export declare const base: {
31
31
  description: string;
32
32
  };
33
33
  };
34
+ Form: {
35
+ required: string;
36
+ optional: string;
37
+ defaultValidateMessages: {
38
+ default: string;
39
+ required: string;
40
+ enum: string;
41
+ whitespace: string;
42
+ date: {
43
+ format: string;
44
+ parse: string;
45
+ invalid: string;
46
+ };
47
+ types: {
48
+ string: string;
49
+ method: string;
50
+ array: string;
51
+ object: string;
52
+ number: string;
53
+ date: string;
54
+ boolean: string;
55
+ integer: string;
56
+ float: string;
57
+ regexp: string;
58
+ email: string;
59
+ url: string;
60
+ hex: string;
61
+ };
62
+ string: {
63
+ len: string;
64
+ min: string;
65
+ max: string;
66
+ range: string;
67
+ };
68
+ number: {
69
+ len: string;
70
+ min: string;
71
+ max: string;
72
+ range: string;
73
+ };
74
+ array: {
75
+ len: string;
76
+ min: string;
77
+ max: string;
78
+ range: string;
79
+ };
80
+ pattern: {
81
+ mismatch: string;
82
+ };
83
+ };
84
+ };
34
85
  ImageUploader: {
35
86
  uploading: string;
36
87
  };
@@ -1,3 +1,4 @@
1
+ const typeTemplate = '${label} is not a valid ${type}';
1
2
  export const base = {
2
3
  common: {
3
4
  confirm: 'Confirm',
@@ -31,6 +32,57 @@ export const base = {
31
32
  description: 'Want to try a new search?'
32
33
  }
33
34
  },
35
+ Form: {
36
+ required: 'Required',
37
+ optional: 'Optional',
38
+ defaultValidateMessages: {
39
+ default: 'Field validation error for ${label}',
40
+ required: 'Please enter ${label}',
41
+ enum: '${label} must be one of [${enum}]',
42
+ whitespace: '${label} cannot be a blank character',
43
+ date: {
44
+ format: '${label} date format is invalid',
45
+ parse: '${label} cannot be converted to a date',
46
+ invalid: '${label} is an invalid date'
47
+ },
48
+ types: {
49
+ string: typeTemplate,
50
+ method: typeTemplate,
51
+ array: typeTemplate,
52
+ object: typeTemplate,
53
+ number: typeTemplate,
54
+ date: typeTemplate,
55
+ boolean: typeTemplate,
56
+ integer: typeTemplate,
57
+ float: typeTemplate,
58
+ regexp: typeTemplate,
59
+ email: typeTemplate,
60
+ url: typeTemplate,
61
+ hex: typeTemplate
62
+ },
63
+ string: {
64
+ len: '${label} must be ${len} characters',
65
+ min: '${label} must be at least ${min} characters',
66
+ max: '${label} must be up to ${max} characters',
67
+ range: '${label} must be between ${min}-${max} characters'
68
+ },
69
+ number: {
70
+ len: '${label} must be equal to ${len}',
71
+ min: '${label} must be minimum ${min}',
72
+ max: '${label} must be maximum ${max}',
73
+ range: '${label} must be between ${min}-${max}'
74
+ },
75
+ array: {
76
+ len: 'Must be ${len} ${label}',
77
+ min: 'At least ${min} ${label}',
78
+ max: 'At most ${max} ${label}',
79
+ range: 'The amount of ${label} must be between ${min}-${max}'
80
+ },
81
+ pattern: {
82
+ mismatch: '${label} does not match the pattern ${pattern}'
83
+ }
84
+ }
85
+ },
34
86
  ImageUploader: {
35
87
  uploading: 'Uploading...'
36
88
  },
@@ -31,6 +31,57 @@ declare const enUS: {
31
31
  description: string;
32
32
  };
33
33
  };
34
+ Form: {
35
+ required: string;
36
+ optional: string;
37
+ defaultValidateMessages: {
38
+ default: string;
39
+ required: string;
40
+ enum: string;
41
+ whitespace: string;
42
+ date: {
43
+ format: string;
44
+ parse: string;
45
+ invalid: string;
46
+ };
47
+ types: {
48
+ string: string;
49
+ method: string;
50
+ array: string;
51
+ object: string;
52
+ number: string;
53
+ date: string;
54
+ boolean: string;
55
+ integer: string;
56
+ float: string;
57
+ regexp: string;
58
+ email: string;
59
+ url: string;
60
+ hex: string;
61
+ };
62
+ string: {
63
+ len: string;
64
+ min: string;
65
+ max: string;
66
+ range: string;
67
+ };
68
+ number: {
69
+ len: string;
70
+ min: string;
71
+ max: string;
72
+ range: string;
73
+ };
74
+ array: {
75
+ len: string;
76
+ min: string;
77
+ max: string;
78
+ range: string;
79
+ };
80
+ pattern: {
81
+ mismatch: string;
82
+ };
83
+ };
84
+ };
34
85
  ImageUploader: {
35
86
  uploading: string;
36
87
  };
@@ -31,6 +31,57 @@ declare const zhCN: {
31
31
  description: string;
32
32
  };
33
33
  };
34
+ Form: {
35
+ required: string;
36
+ optional: string;
37
+ defaultValidateMessages: {
38
+ default: string;
39
+ required: string;
40
+ enum: string;
41
+ whitespace: string;
42
+ date: {
43
+ format: string;
44
+ parse: string;
45
+ invalid: string;
46
+ };
47
+ types: {
48
+ string: string;
49
+ method: string;
50
+ array: string;
51
+ object: string;
52
+ number: string;
53
+ date: string;
54
+ boolean: string;
55
+ integer: string;
56
+ float: string;
57
+ regexp: string;
58
+ email: string;
59
+ url: string;
60
+ hex: string;
61
+ };
62
+ string: {
63
+ len: string;
64
+ min: string;
65
+ max: string;
66
+ range: string;
67
+ };
68
+ number: {
69
+ len: string;
70
+ min: string;
71
+ max: string;
72
+ range: string;
73
+ };
74
+ array: {
75
+ len: string;
76
+ min: string;
77
+ max: string;
78
+ range: string;
79
+ };
80
+ pattern: {
81
+ mismatch: string;
82
+ };
83
+ };
84
+ };
34
85
  ImageUploader: {
35
86
  uploading: string;
36
87
  };
@@ -1,5 +1,6 @@
1
1
  import { mergeLocale } from '../utils/merge-locale';
2
2
  import { base } from './base';
3
+ const typeTemplate = '${label}不是一个有效的${type}';
3
4
  const zhCN = mergeLocale(base, {
4
5
  common: {
5
6
  confirm: '确定',
@@ -33,6 +34,57 @@ const zhCN = mergeLocale(base, {
33
34
  description: '找找其他的吧'
34
35
  }
35
36
  },
37
+ Form: {
38
+ required: '必填',
39
+ optional: '选填',
40
+ defaultValidateMessages: {
41
+ default: '字段验证错误${label}',
42
+ required: '请输入${label}',
43
+ enum: '${label}必须是其中一个[${enum}]',
44
+ whitespace: '${label}不能为空字符',
45
+ date: {
46
+ format: '${label}日期格式无效',
47
+ parse: '${label}不能转换为日期',
48
+ invalid: '${label}是一个无效日期'
49
+ },
50
+ types: {
51
+ string: typeTemplate,
52
+ method: typeTemplate,
53
+ array: typeTemplate,
54
+ object: typeTemplate,
55
+ number: typeTemplate,
56
+ date: typeTemplate,
57
+ boolean: typeTemplate,
58
+ integer: typeTemplate,
59
+ float: typeTemplate,
60
+ regexp: typeTemplate,
61
+ email: typeTemplate,
62
+ url: typeTemplate,
63
+ hex: typeTemplate
64
+ },
65
+ string: {
66
+ len: '${label}须为${len}个字符',
67
+ min: '${label}最少${min}个字符',
68
+ max: '${label}最多${max}个字符',
69
+ range: '${label}须在${min}-${max}字符之间'
70
+ },
71
+ number: {
72
+ len: '${label}必须等于${len}',
73
+ min: '${label}最小值为${min}',
74
+ max: '${label}最大值为${max}',
75
+ range: '${label}须在${min}-${max}之间'
76
+ },
77
+ array: {
78
+ len: '须为${len}个${label}',
79
+ min: '最少${min}个${label}',
80
+ max: '最多${max}个${label}',
81
+ range: '${label}数量须在${min}-${max}之间'
82
+ },
83
+ pattern: {
84
+ mismatch: '${label}与模式不匹配${pattern}'
85
+ }
86
+ }
87
+ },
36
88
  ImageUploader: {
37
89
  uploading: '上传中...'
38
90
  },
package/2x/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "antd-mobile",
3
- "version": "5.2.1",
3
+ "version": "5.3.1",
4
4
  "dependencies": {
5
5
  "@react-spring/web": "^9.4.3",
6
6
  "@types/resize-observer-browser": "^0.1.7",
7
- "@use-gesture/react": "^10.2.6",
7
+ "@use-gesture/react": "^10.2.7",
8
8
  "ahooks": "^3.1.10",
9
9
  "antd-mobile-icons": "^0.2.2",
10
10
  "antd-mobile-v5-count": "^1.0.1",
11
11
  "classnames": "^2.3.1",
12
- "dayjs": "^1.10.7",
12
+ "dayjs": "^1.10.8",
13
13
  "lodash": "^4.17.21",
14
- "rc-field-form": "^1.23.0",
14
+ "rc-field-form": "^1.23.1",
15
15
  "rc-tooltip": "^5.1.1",
16
16
  "staged-components": "^1.1.2",
17
17
  "tslib": "^2.3.1",
@@ -32,6 +32,7 @@ const Avatar = p => {
32
32
  placeholder: props.fallback,
33
33
  alt: props.alt,
34
34
  lazy: props.lazy,
35
+ fit: props.fit,
35
36
  onClick: props.onClick,
36
37
  onError: props.onError
37
38
  }));
@@ -50,7 +50,29 @@ const Calendar = (0, _react.forwardRef)((p, ref) => {
50
50
  if (item) markItems.unshift(item);
51
51
  }
52
52
 
53
- const [current, setCurrent] = (0, _react.useState)(() => (0, _dayjs.default)().date(1));
53
+ const dateRange = (0, _react.useMemo)(() => {
54
+ var _a, _b, _c, _d;
55
+
56
+ if (props.selectionMode === 'single') {
57
+ const value = (_b = (_a = props.value) !== null && _a !== void 0 ? _a : props.defaultValue) !== null && _b !== void 0 ? _b : null;
58
+ return [value, value];
59
+ } else if (props.selectionMode === 'range') {
60
+ return (_d = (_c = props.value) !== null && _c !== void 0 ? _c : props.defaultValue) !== null && _d !== void 0 ? _d : [null, null];
61
+ } else {
62
+ return [null, null];
63
+ }
64
+ }, [props.selectionMode, props.value, props.defaultValue]);
65
+ const [begin, setBegin] = (0, _react.useState)(null);
66
+ const [end, setEnd] = (0, _react.useState)(null);
67
+ (0, _ahooks.useIsomorphicLayoutEffect)(() => {
68
+ setBegin(dateRange[0] ? (0, _dayjs.default)(dateRange[0]) : null);
69
+ setEnd(dateRange[1] ? (0, _dayjs.default)(dateRange[1]) : null);
70
+ }, [dateRange[0], dateRange[1]]);
71
+ const [current, setCurrent] = (0, _react.useState)(() => {
72
+ var _a;
73
+
74
+ return (0, _dayjs.default)((_a = dateRange[0]) !== null && _a !== void 0 ? _a : today).date(1);
75
+ });
54
76
  (0, _ahooks.useUpdateEffect)(() => {
55
77
  var _a;
56
78
 
@@ -102,25 +124,6 @@ const Calendar = (0, _react.forwardRef)((p, ref) => {
102
124
  }
103
125
  }, _react.default.createElement(_arrowLeftDouble.ArrowLeftDouble, null)));
104
126
 
105
- const dateRange = (0, _react.useMemo)(() => {
106
- var _a, _b, _c, _d;
107
-
108
- if (props.selectionMode === 'single') {
109
- const value = (_b = (_a = props.value) !== null && _a !== void 0 ? _a : props.defaultValue) !== null && _b !== void 0 ? _b : null;
110
- return [value, value];
111
- } else if (props.selectionMode === 'range') {
112
- return (_d = (_c = props.value) !== null && _c !== void 0 ? _c : props.defaultValue) !== null && _d !== void 0 ? _d : [null, null];
113
- } else {
114
- return [null, null];
115
- }
116
- }, [props.selectionMode, props.value, props.defaultValue]);
117
- const [begin, setBegin] = (0, _react.useState)(null);
118
- const [end, setEnd] = (0, _react.useState)(null);
119
- (0, _ahooks.useIsomorphicLayoutEffect)(() => {
120
- setBegin(dateRange[0] ? (0, _dayjs.default)(dateRange[0]) : null);
121
- setEnd(dateRange[1] ? (0, _dayjs.default)(dateRange[1]) : null);
122
- }, [dateRange[0], dateRange[1]]);
123
-
124
127
  function renderCells() {
125
128
  var _a;
126
129