antd-mobile 0.0.0-dev-626cbf51f → 0.0.0-dev.fc623d614

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 (228) hide show
  1. package/2x/README.md +10 -8
  2. package/2x/cjs/components/action-sheet/action-sheet.css +22 -7
  3. package/2x/cjs/components/action-sheet/action-sheet.js +8 -16
  4. package/2x/cjs/components/badge/badge.d.ts +1 -1
  5. package/2x/cjs/components/badge/badge.js +3 -1
  6. package/2x/cjs/components/badge/index.d.ts +1 -1
  7. package/2x/cjs/components/button/button.d.ts +6 -4
  8. package/2x/cjs/components/button/button.js +5 -1
  9. package/2x/cjs/components/calendar/calendar.css +4 -0
  10. package/2x/cjs/components/calendar/calendar.d.ts +1 -0
  11. package/2x/cjs/components/calendar/calendar.js +2 -2
  12. package/2x/cjs/components/dialog/dialog.d.ts +4 -1
  13. package/2x/cjs/components/dialog/dialog.js +24 -13
  14. package/2x/cjs/components/dropdown/dropdown.css +1 -1
  15. package/2x/cjs/components/error-block/images/busy.d.ts +1 -0
  16. package/2x/cjs/components/error-block/images/default.d.ts +1 -0
  17. package/2x/cjs/components/error-block/images/disconnected.d.ts +1 -0
  18. package/2x/cjs/components/error-block/images/empty.d.ts +1 -0
  19. package/2x/cjs/components/form/form-item.js +1 -4
  20. package/2x/cjs/components/image/broken-image-icon.d.ts +1 -0
  21. package/2x/cjs/components/image/broken-image-icon.js +21 -0
  22. package/2x/cjs/components/image/image-icon.d.ts +1 -0
  23. package/2x/cjs/components/image/image-icon.js +21 -0
  24. package/2x/cjs/components/image/image.css +4 -2
  25. package/2x/cjs/components/image/image.d.ts +2 -1
  26. package/2x/cjs/components/image/image.js +10 -6
  27. package/2x/cjs/components/image-uploader/image-uploader.js +1 -4
  28. package/2x/cjs/components/image-viewer/image-viewer.css +7 -1
  29. package/2x/cjs/components/image-viewer/image-viewer.d.ts +5 -2
  30. package/2x/cjs/components/image-viewer/image-viewer.js +24 -4
  31. package/2x/cjs/components/image-viewer/index.d.ts +2 -1
  32. package/2x/cjs/components/index-bar/index-bar.d.ts +2 -0
  33. package/2x/cjs/components/index-bar/index-bar.js +6 -0
  34. package/2x/cjs/components/index-bar/index.d.ts +1 -0
  35. package/2x/cjs/components/infinite-scroll/infinite-scroll.js +8 -6
  36. package/2x/cjs/components/mask/mask.js +9 -7
  37. package/2x/cjs/components/modal/modal.d.ts +4 -1
  38. package/2x/cjs/components/modal/modal.js +24 -11
  39. package/2x/cjs/components/popover/popover.css +1 -0
  40. package/2x/cjs/components/popup/popup.d.ts +2 -1
  41. package/2x/cjs/components/search-bar/search-bar.d.ts +1 -1
  42. package/2x/cjs/components/search-bar/search-bar.js +5 -8
  43. package/2x/cjs/components/side-bar/side-bar.d.ts +2 -1
  44. package/2x/cjs/components/swiper/index.d.ts +1 -1
  45. package/2x/cjs/components/swiper/swiper.d.ts +1 -1
  46. package/2x/cjs/components/tabs/tabs.css +4 -3
  47. package/2x/cjs/components/tabs/tabs.d.ts +1 -1
  48. package/2x/cjs/components/text-area/text-area.js +2 -1
  49. package/2x/cjs/components/toast/toast.css +1 -1
  50. package/2x/cjs/components/toast/toast.d.ts +2 -1
  51. package/2x/cjs/locales/fr-FR.d.ts +106 -0
  52. package/2x/cjs/locales/fr-FR.js +119 -0
  53. package/2x/cjs/utils/get-scroll-parent.js +1 -1
  54. package/2x/cjs/utils/render.js +14 -2
  55. package/2x/cjs/utils/use-inner-visible.d.ts +1 -0
  56. package/2x/cjs/utils/use-inner-visible.js +18 -0
  57. package/2x/es/components/action-sheet/action-sheet.css +22 -7
  58. package/2x/es/components/action-sheet/action-sheet.js +8 -15
  59. package/2x/es/components/badge/badge.d.ts +1 -1
  60. package/2x/es/components/badge/badge.js +1 -1
  61. package/2x/es/components/badge/index.d.ts +1 -1
  62. package/2x/es/components/button/button.d.ts +6 -4
  63. package/2x/es/components/button/button.js +5 -1
  64. package/2x/es/components/calendar/calendar.css +4 -0
  65. package/2x/es/components/calendar/calendar.d.ts +1 -0
  66. package/2x/es/components/calendar/calendar.js +2 -2
  67. package/2x/es/components/dialog/dialog.d.ts +4 -1
  68. package/2x/es/components/dialog/dialog.js +23 -14
  69. package/2x/es/components/dropdown/dropdown.css +1 -1
  70. package/2x/es/components/error-block/images/busy.d.ts +1 -0
  71. package/2x/es/components/error-block/images/default.d.ts +1 -0
  72. package/2x/es/components/error-block/images/disconnected.d.ts +1 -0
  73. package/2x/es/components/error-block/images/empty.d.ts +1 -0
  74. package/2x/es/components/form/form-item.js +1 -4
  75. package/2x/es/components/image/broken-image-icon.d.ts +1 -0
  76. package/2x/es/components/image/broken-image-icon.js +9 -0
  77. package/2x/es/components/image/image-icon.d.ts +1 -0
  78. package/2x/es/components/image/image-icon.js +9 -0
  79. package/2x/es/components/image/image.css +4 -2
  80. package/2x/es/components/image/image.d.ts +2 -1
  81. package/2x/es/components/image/image.js +8 -5
  82. package/2x/es/components/image-uploader/image-uploader.js +2 -5
  83. package/2x/es/components/image-viewer/image-viewer.css +7 -1
  84. package/2x/es/components/image-viewer/image-viewer.d.ts +5 -2
  85. package/2x/es/components/image-viewer/image-viewer.js +24 -5
  86. package/2x/es/components/image-viewer/index.d.ts +2 -1
  87. package/2x/es/components/index-bar/index-bar.d.ts +2 -0
  88. package/2x/es/components/index-bar/index-bar.js +6 -0
  89. package/2x/es/components/index-bar/index.d.ts +1 -0
  90. package/2x/es/components/infinite-scroll/infinite-scroll.js +8 -6
  91. package/2x/es/components/mask/mask.js +10 -8
  92. package/2x/es/components/modal/modal.d.ts +4 -1
  93. package/2x/es/components/modal/modal.js +23 -12
  94. package/2x/es/components/popover/popover.css +1 -0
  95. package/2x/es/components/popup/popup.d.ts +2 -1
  96. package/2x/es/components/search-bar/search-bar.d.ts +1 -1
  97. package/2x/es/components/search-bar/search-bar.js +5 -8
  98. package/2x/es/components/side-bar/side-bar.d.ts +2 -1
  99. package/2x/es/components/swiper/index.d.ts +1 -1
  100. package/2x/es/components/swiper/swiper.d.ts +1 -1
  101. package/2x/es/components/tabs/tabs.css +4 -3
  102. package/2x/es/components/tabs/tabs.d.ts +1 -1
  103. package/2x/es/components/text-area/text-area.js +2 -1
  104. package/2x/es/components/toast/toast.css +1 -1
  105. package/2x/es/components/toast/toast.d.ts +2 -1
  106. package/2x/es/locales/fr-FR.d.ts +106 -0
  107. package/2x/es/locales/fr-FR.js +109 -0
  108. package/2x/es/utils/get-scroll-parent.js +1 -1
  109. package/2x/es/utils/render.js +14 -2
  110. package/2x/es/utils/use-inner-visible.d.ts +1 -0
  111. package/2x/es/utils/use-inner-visible.js +9 -0
  112. package/2x/package.json +6 -11
  113. package/README.md +10 -8
  114. package/bundle/antd-mobile.cjs.js +293 -229
  115. package/bundle/antd-mobile.es.js +295 -231
  116. package/bundle/style.css +110 -86
  117. package/cjs/components/action-sheet/action-sheet.css +19 -7
  118. package/cjs/components/action-sheet/action-sheet.js +8 -16
  119. package/cjs/components/badge/badge.d.ts +1 -1
  120. package/cjs/components/badge/badge.js +3 -1
  121. package/cjs/components/badge/index.d.ts +1 -1
  122. package/cjs/components/button/button.d.ts +6 -4
  123. package/cjs/components/button/button.js +5 -1
  124. package/cjs/components/calendar/calendar.css +3 -0
  125. package/cjs/components/calendar/calendar.d.ts +1 -0
  126. package/cjs/components/calendar/calendar.js +2 -2
  127. package/cjs/components/dialog/dialog.d.ts +4 -1
  128. package/cjs/components/dialog/dialog.js +24 -13
  129. package/cjs/components/dropdown/dropdown.css +1 -1
  130. package/cjs/components/error-block/images/busy.d.ts +1 -0
  131. package/cjs/components/error-block/images/default.d.ts +1 -0
  132. package/cjs/components/error-block/images/disconnected.d.ts +1 -0
  133. package/cjs/components/error-block/images/empty.d.ts +1 -0
  134. package/cjs/components/form/form-item.js +1 -4
  135. package/cjs/components/image/broken-image-icon.d.ts +1 -0
  136. package/cjs/components/image/broken-image-icon.js +21 -0
  137. package/cjs/components/image/image-icon.d.ts +1 -0
  138. package/cjs/components/image/image-icon.js +21 -0
  139. package/cjs/components/image/image.css +4 -2
  140. package/cjs/components/image/image.d.ts +2 -1
  141. package/cjs/components/image/image.js +10 -6
  142. package/cjs/components/image-uploader/image-uploader.js +1 -4
  143. package/cjs/components/image-viewer/image-viewer.css +6 -1
  144. package/cjs/components/image-viewer/image-viewer.d.ts +5 -2
  145. package/cjs/components/image-viewer/image-viewer.js +24 -4
  146. package/cjs/components/image-viewer/index.d.ts +2 -1
  147. package/cjs/components/index-bar/index-bar.d.ts +2 -0
  148. package/cjs/components/index-bar/index-bar.js +6 -0
  149. package/cjs/components/index-bar/index.d.ts +1 -0
  150. package/cjs/components/infinite-scroll/infinite-scroll.js +8 -6
  151. package/cjs/components/mask/mask.js +9 -7
  152. package/cjs/components/modal/modal.d.ts +4 -1
  153. package/cjs/components/modal/modal.js +24 -11
  154. package/cjs/components/popover/popover.css +1 -0
  155. package/cjs/components/popup/popup.d.ts +2 -1
  156. package/cjs/components/search-bar/search-bar.d.ts +1 -1
  157. package/cjs/components/search-bar/search-bar.js +5 -8
  158. package/cjs/components/side-bar/side-bar.d.ts +2 -1
  159. package/cjs/components/swiper/index.d.ts +1 -1
  160. package/cjs/components/swiper/swiper.d.ts +1 -1
  161. package/cjs/components/tabs/tabs.css +4 -3
  162. package/cjs/components/tabs/tabs.d.ts +1 -1
  163. package/cjs/components/text-area/text-area.js +2 -1
  164. package/cjs/components/toast/toast.css +1 -1
  165. package/cjs/components/toast/toast.d.ts +2 -1
  166. package/cjs/locales/fr-FR.d.ts +106 -0
  167. package/cjs/locales/fr-FR.js +119 -0
  168. package/cjs/utils/get-scroll-parent.js +1 -1
  169. package/cjs/utils/render.js +14 -2
  170. package/cjs/utils/use-inner-visible.d.ts +1 -0
  171. package/cjs/utils/use-inner-visible.js +18 -0
  172. package/es/components/action-sheet/action-sheet.css +19 -7
  173. package/es/components/action-sheet/action-sheet.js +8 -15
  174. package/es/components/badge/badge.d.ts +1 -1
  175. package/es/components/badge/badge.js +1 -1
  176. package/es/components/badge/index.d.ts +1 -1
  177. package/es/components/button/button.d.ts +6 -4
  178. package/es/components/button/button.js +5 -1
  179. package/es/components/calendar/calendar.css +3 -0
  180. package/es/components/calendar/calendar.d.ts +1 -0
  181. package/es/components/calendar/calendar.js +2 -2
  182. package/es/components/dialog/dialog.d.ts +4 -1
  183. package/es/components/dialog/dialog.js +23 -14
  184. package/es/components/dropdown/dropdown.css +1 -1
  185. package/es/components/error-block/images/busy.d.ts +1 -0
  186. package/es/components/error-block/images/default.d.ts +1 -0
  187. package/es/components/error-block/images/disconnected.d.ts +1 -0
  188. package/es/components/error-block/images/empty.d.ts +1 -0
  189. package/es/components/form/form-item.js +1 -4
  190. package/es/components/image/broken-image-icon.d.ts +1 -0
  191. package/es/components/image/broken-image-icon.js +9 -0
  192. package/es/components/image/image-icon.d.ts +1 -0
  193. package/es/components/image/image-icon.js +9 -0
  194. package/es/components/image/image.css +4 -2
  195. package/es/components/image/image.d.ts +2 -1
  196. package/es/components/image/image.js +8 -5
  197. package/es/components/image-uploader/image-uploader.js +2 -5
  198. package/es/components/image-viewer/image-viewer.css +6 -1
  199. package/es/components/image-viewer/image-viewer.d.ts +5 -2
  200. package/es/components/image-viewer/image-viewer.js +24 -5
  201. package/es/components/image-viewer/index.d.ts +2 -1
  202. package/es/components/index-bar/index-bar.d.ts +2 -0
  203. package/es/components/index-bar/index-bar.js +6 -0
  204. package/es/components/index-bar/index.d.ts +1 -0
  205. package/es/components/infinite-scroll/infinite-scroll.js +8 -6
  206. package/es/components/mask/mask.js +10 -8
  207. package/es/components/modal/modal.d.ts +4 -1
  208. package/es/components/modal/modal.js +23 -12
  209. package/es/components/popover/popover.css +1 -0
  210. package/es/components/popup/popup.d.ts +2 -1
  211. package/es/components/search-bar/search-bar.d.ts +1 -1
  212. package/es/components/search-bar/search-bar.js +5 -8
  213. package/es/components/side-bar/side-bar.d.ts +2 -1
  214. package/es/components/swiper/index.d.ts +1 -1
  215. package/es/components/swiper/swiper.d.ts +1 -1
  216. package/es/components/tabs/tabs.css +4 -3
  217. package/es/components/tabs/tabs.d.ts +1 -1
  218. package/es/components/text-area/text-area.js +2 -1
  219. package/es/components/toast/toast.css +1 -1
  220. package/es/components/toast/toast.d.ts +2 -1
  221. package/es/locales/fr-FR.d.ts +106 -0
  222. package/es/locales/fr-FR.js +109 -0
  223. package/es/utils/get-scroll-parent.js +1 -1
  224. package/es/utils/render.js +14 -2
  225. package/es/utils/use-inner-visible.d.ts +1 -0
  226. package/es/utils/use-inner-visible.js +9 -0
  227. package/package.json +6 -11
  228. package/umd/antd-mobile.js +1 -1
@@ -13,6 +13,8 @@ var _renderToContainer = require("../../utils/render-to-container");
13
13
 
14
14
  var _mask = _interopRequireDefault(require("../mask"));
15
15
 
16
+ var _safeArea = _interopRequireDefault(require("../safe-area"));
17
+
16
18
  var _slide = require("./slide");
17
19
 
18
20
  var _slides = require("./slides");
@@ -31,6 +33,8 @@ const defaultProps = {
31
33
  };
32
34
 
33
35
  const ImageViewer = p => {
36
+ var _a;
37
+
34
38
  const props = (0, _withDefaultProps.mergeProps)(defaultProps, p);
35
39
 
36
40
  const node = _react.default.createElement(_mask.default, {
@@ -48,6 +52,10 @@ const ImageViewer = p => {
48
52
  (_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props);
49
53
  },
50
54
  maxZoom: props.maxZoom
55
+ })), props.image && _react.default.createElement("div", {
56
+ className: `${classPrefix}-footer`
57
+ }, (_a = props.renderFooter) === null || _a === void 0 ? void 0 : _a.call(props, props.image), _react.default.createElement(_safeArea.default, {
58
+ position: 'bottom'
51
59
  })));
52
60
 
53
61
  return (0, _renderToContainer.renderToContainer)(props.getContainer, node);
@@ -58,17 +66,25 @@ const multiDefaultProps = Object.assign(Object.assign({}, defaultProps), {
58
66
  defaultIndex: 0
59
67
  });
60
68
  const MultiImageViewer = (0, _react.forwardRef)((p, ref) => {
69
+ var _a;
70
+
61
71
  const props = (0, _withDefaultProps.mergeProps)(multiDefaultProps, p);
62
- const [defaultIndex, setDefaultIndex] = (0, _react.useState)(props.defaultIndex);
72
+ const [index, setIndex] = (0, _react.useState)(props.defaultIndex);
63
73
  const slidesRef = (0, _react.useRef)(null);
64
74
  (0, _react.useImperativeHandle)(ref, () => ({
65
75
  swipeTo: (index, immediate) => {
66
76
  var _a;
67
77
 
68
- setDefaultIndex(index);
78
+ setIndex(index);
69
79
  (_a = slidesRef.current) === null || _a === void 0 ? void 0 : _a.swipeTo(index, immediate);
70
80
  }
71
81
  }));
82
+ const onSlideChange = (0, _react.useCallback)(index => {
83
+ var _a;
84
+
85
+ setIndex(index);
86
+ (_a = props.onIndexChange) === null || _a === void 0 ? void 0 : _a.call(props, index);
87
+ }, [props.onIndexChange]);
72
88
 
73
89
  const node = _react.default.createElement(_mask.default, {
74
90
  visible: props.visible,
@@ -79,8 +95,8 @@ const MultiImageViewer = (0, _react.forwardRef)((p, ref) => {
79
95
  className: `${classPrefix}-content`
80
96
  }, props.images && _react.default.createElement(_slides.Slides, {
81
97
  ref: slidesRef,
82
- defaultIndex: defaultIndex,
83
- onIndexChange: props.onIndexChange,
98
+ defaultIndex: index,
99
+ onIndexChange: onSlideChange,
84
100
  images: props.images,
85
101
  onTap: () => {
86
102
  var _a;
@@ -88,6 +104,10 @@ const MultiImageViewer = (0, _react.forwardRef)((p, ref) => {
88
104
  (_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props);
89
105
  },
90
106
  maxZoom: props.maxZoom
107
+ })), props.images && _react.default.createElement("div", {
108
+ className: `${classPrefix}-footer`
109
+ }, (_a = props.renderFooter) === null || _a === void 0 ? void 0 : _a.call(props, props.images[index], index), _react.default.createElement(_safeArea.default, {
110
+ position: 'bottom'
91
111
  })));
92
112
 
93
113
  return (0, _renderToContainer.renderToContainer)(props.getContainer, node);
@@ -4,10 +4,11 @@ import { showMultiImageViewer, showImageViewer, clearImageViewer } from './metho
4
4
  export type { ImageViewerProps, MultiImageViewerProps, MultiImageViewerRef, } from './image-viewer';
5
5
  export type { ImageViewerShowHandler } from './methods';
6
6
  declare const _default: import("react").FC<import("./image-viewer").ImageViewerProps> & {
7
- Multi: import("react").ForwardRefExoticComponent<Omit<import("./image-viewer").ImageViewerProps, "image"> & {
7
+ Multi: import("react").ForwardRefExoticComponent<Omit<import("./image-viewer").ImageViewerProps, "image" | "renderFooter"> & {
8
8
  images?: string[] | undefined;
9
9
  defaultIndex?: number | undefined;
10
10
  onIndexChange?: ((index: number) => void) | undefined;
11
+ renderFooter?: ((image: string, index: number) => import("react").ReactNode) | undefined;
11
12
  } & import("react").RefAttributes<import("./slides").SlidesRef>> & {
12
13
  show: typeof showMultiImageViewer;
13
14
  };
@@ -2,6 +2,7 @@ import React, { ReactNode } from 'react';
2
2
  import { NativeProps } from '../../utils/native-props';
3
3
  export declare type IndexBarProps = {
4
4
  sticky?: boolean;
5
+ onIndexChange?: (index: string) => void;
5
6
  children?: React.ReactNode;
6
7
  } & NativeProps<'--sticky-offset-top'>;
7
8
  export declare type IndexBarRef = {
@@ -9,5 +10,6 @@ export declare type IndexBarRef = {
9
10
  };
10
11
  export declare const IndexBar: React.ForwardRefExoticComponent<{
11
12
  sticky?: boolean | undefined;
13
+ onIndexChange?: ((index: string) => void) | undefined;
12
14
  children?: React.ReactNode;
13
15
  } & NativeProps<"--sticky-offset-top"> & React.RefAttributes<IndexBarRef>>;
@@ -72,6 +72,8 @@ const IndexBar = (0, _react.forwardRef)((p, ref) => {
72
72
  }));
73
73
 
74
74
  function scrollTo(index) {
75
+ var _a;
76
+
75
77
  const body = bodyRef.current;
76
78
  if (!body) return;
77
79
  const children = body.children;
@@ -84,6 +86,7 @@ const IndexBar = (0, _react.forwardRef)((p, ref) => {
84
86
  if (panelIndex === index) {
85
87
  body.scrollTop = panel.offsetTop;
86
88
  setActiveIndex(index);
89
+ activeIndex !== index && ((_a = props.onIndexChange) === null || _a === void 0 ? void 0 : _a.call(props, index));
87
90
  return;
88
91
  }
89
92
  }
@@ -92,6 +95,8 @@ const IndexBar = (0, _react.forwardRef)((p, ref) => {
92
95
  const {
93
96
  run: checkActiveIndex
94
97
  } = (0, _ahooks.useThrottleFn)(() => {
98
+ var _a;
99
+
95
100
  const body = bodyRef.current;
96
101
  if (!body) return;
97
102
  const scrollTop = body.scrollTop;
@@ -105,6 +110,7 @@ const IndexBar = (0, _react.forwardRef)((p, ref) => {
105
110
 
106
111
  if (panel.offsetTop + panel.clientHeight - titleHeight > scrollTop) {
107
112
  setActiveIndex(panelIndex);
113
+ activeIndex !== panelIndex && ((_a = props.onIndexChange) === null || _a === void 0 ? void 0 : _a.call(props, panelIndex));
108
114
  return;
109
115
  }
110
116
  }
@@ -4,6 +4,7 @@ export type { IndexBarProps, IndexBarRef } from './index-bar';
4
4
  export type { IndexBarPanelProps } from './panel';
5
5
  declare const _default: import("react").ForwardRefExoticComponent<{
6
6
  sticky?: boolean | undefined;
7
+ onIndexChange?: ((index: string) => void) | undefined;
7
8
  children?: import("react").ReactNode;
8
9
  } & import("../../utils/native-props").NativeProps<"--sticky-offset-top"> & import("react").RefAttributes<import("./index-bar").IndexBarRef>> & {
9
10
  Panel: import("react").FC<import("./panel").IndexBarPanelProps>;
@@ -47,9 +47,11 @@ const InfiniteScroll = p => {
47
47
  threshold: 250
48
48
  }, p);
49
49
  const doLoadMore = (0, _ahooks.useLockFn)(() => props.loadMore());
50
- const elementRef = (0, _react.useRef)(null);
50
+ const elementRef = (0, _react.useRef)(null); // Prevent duplicated trigger of `check` function
51
+
51
52
  const [flag, setFlag] = (0, _react.useState)({});
52
53
  const nextFlagRef = (0, _react.useRef)(flag);
54
+ const [scrollParent, setScrollParent] = (0, _react.useState)();
53
55
  const check = (0, _ahooks.useMemoizedFn)(() => (0, _tslib.__awaiter)(void 0, void 0, void 0, function* () {
54
56
  if (nextFlagRef.current !== flag) return;
55
57
  if (!props.hasMore) return;
@@ -57,6 +59,7 @@ const InfiniteScroll = p => {
57
59
  if (!element) return;
58
60
  if (!element.offsetParent) return;
59
61
  const parent = (0, _getScrollParent.getScrollParent)(element);
62
+ setScrollParent(parent);
60
63
  if (!parent) return;
61
64
  const rect = element.getBoundingClientRect();
62
65
  const elementTop = rect.top;
@@ -76,18 +79,17 @@ const InfiniteScroll = p => {
76
79
  (0, _react.useEffect)(() => {
77
80
  const element = elementRef.current;
78
81
  if (!element) return;
79
- const parent = (0, _getScrollParent.getScrollParent)(element);
80
- if (!parent) return;
82
+ if (!scrollParent) return;
81
83
 
82
84
  function onScroll() {
83
85
  check();
84
86
  }
85
87
 
86
- parent.addEventListener('scroll', onScroll);
88
+ scrollParent.addEventListener('scroll', onScroll);
87
89
  return () => {
88
- parent.removeEventListener('scroll', onScroll);
90
+ scrollParent.removeEventListener('scroll', onScroll);
89
91
  };
90
- }, []);
92
+ }, [scrollParent]);
91
93
  return (0, _nativeProps.withNativeProps)(props, _react.default.createElement("div", {
92
94
  className: classPrefix,
93
95
  ref: elementRef
@@ -69,7 +69,7 @@ const Mask = p => {
69
69
  config: {
70
70
  precision: 0.01,
71
71
  mass: 1,
72
- tension: 200,
72
+ tension: 250,
73
73
  friction: 30,
74
74
  clamp: true
75
75
  },
@@ -89,14 +89,12 @@ const Mask = p => {
89
89
  }
90
90
  }
91
91
  });
92
- const shouldRender = (0, _shouldRender.useShouldRender)(active, props.forceRender, props.destroyOnClose);
93
92
  const node = (0, _withStopPropagation.withStopPropagation)(props.stopPropagation, (0, _nativeProps.withNativeProps)(props, _react.default.createElement(_web.animated.div, {
94
93
  className: classPrefix,
95
94
  ref: ref,
96
- style: Object.assign(Object.assign({
95
+ style: Object.assign(Object.assign({}, props.style), {
97
96
  background,
98
- opacity
99
- }, props.style), {
97
+ opacity,
100
98
  display: active ? undefined : 'none'
101
99
  }),
102
100
  onClick: e => {
@@ -113,8 +111,12 @@ const Mask = p => {
113
111
  onClick: props.onMaskClick
114
112
  }), _react.default.createElement("div", {
115
113
  className: `${classPrefix}-content`
116
- }, shouldRender && props.children))));
117
- return (0, _renderToContainer.renderToContainer)(props.getContainer, node);
114
+ }, props.children))));
115
+ return _react.default.createElement(_shouldRender.ShouldRender, {
116
+ active: active,
117
+ forceRender: props.forceRender,
118
+ destroyOnClose: props.destroyOnClose
119
+ }, (0, _renderToContainer.renderToContainer)(props.getContainer, node));
118
120
  };
119
121
 
120
122
  exports.Mask = Mask;
@@ -1,4 +1,5 @@
1
1
  import React, { FC, ReactNode } from 'react';
2
+ import type { MaskProps } from '../mask';
2
3
  import { Action } from './modal-action-button';
3
4
  import { GetContainer } from '../../utils/render-to-container';
4
5
  import { PropagationEvent } from '../../utils/with-stop-propagation';
@@ -19,10 +20,12 @@ export declare type ModalProps = {
19
20
  getContainer?: GetContainer;
20
21
  bodyStyle?: React.CSSProperties;
21
22
  bodyClassName?: string;
22
- maskStyle?: React.CSSProperties;
23
+ maskStyle?: MaskProps['style'];
23
24
  maskClassName?: string;
24
25
  stopPropagation?: PropagationEvent[];
25
26
  showCloseButton?: boolean;
26
27
  disableBodyScroll?: boolean;
28
+ destroyOnClose?: boolean;
29
+ forceRender?: boolean;
27
30
  } & NativeProps;
28
31
  export declare const Modal: FC<ModalProps>;
@@ -35,6 +35,10 @@ var _nativeProps = require("../../utils/native-props");
35
35
 
36
36
  var _antdMobileIcons = require("antd-mobile-icons");
37
37
 
38
+ var _shouldRender = require("../../utils/should-render");
39
+
40
+ var _useInnerVisible = require("../../utils/use-inner-visible");
41
+
38
42
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
39
43
 
40
44
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -49,7 +53,9 @@ const defaultProps = {
49
53
  stopPropagation: ['click'],
50
54
  showCloseButton: false,
51
55
  getContainer: null,
52
- disableBodyScroll: true
56
+ disableBodyScroll: true,
57
+ destroyOnClose: false,
58
+ forceRender: false
53
59
  };
54
60
 
55
61
  const Modal = p => {
@@ -64,9 +70,6 @@ const Modal = p => {
64
70
  friction: 25,
65
71
  clamp: true
66
72
  },
67
- onStart: () => {
68
- setActive(true);
69
- },
70
73
  onRest: () => {
71
74
  var _a, _b;
72
75
 
@@ -81,6 +84,12 @@ const Modal = p => {
81
84
  }
82
85
  });
83
86
  const [active, setActive] = (0, _react.useState)(props.visible);
87
+ (0, _ahooks.useIsomorphicLayoutEffect)(() => {
88
+ if (props.visible) {
89
+ setActive(true);
90
+ }
91
+ }, [props.visible]);
92
+ const maskVisible = (0, _useInnerVisible.useInnerVisible)(active && props.visible);
84
93
 
85
94
  const body = _react.default.createElement("div", {
86
95
  className: (0, _classnames.default)(cls('body'), props.image && cls('with-image'), props.bodyClassName),
@@ -123,23 +132,27 @@ const Modal = p => {
123
132
  const node = (0, _withStopPropagation.withStopPropagation)(props.stopPropagation, (0, _nativeProps.withNativeProps)(props, _react.default.createElement("div", {
124
133
  className: cls(),
125
134
  style: {
126
- display: active ? undefined : 'none'
135
+ display: active ? undefined : 'none',
136
+ pointerEvents: active ? undefined : 'none'
127
137
  }
128
138
  }, _react.default.createElement(_mask.default, {
129
- visible: props.visible,
139
+ visible: maskVisible,
140
+ forceRender: props.forceRender,
141
+ destroyOnClose: props.destroyOnClose,
130
142
  onMaskClick: props.closeOnMaskClick ? props.onClose : undefined,
131
143
  style: props.maskStyle,
132
144
  className: (0, _classnames.default)(cls('mask'), props.maskClassName),
133
145
  disableBodyScroll: props.disableBodyScroll
134
146
  }), _react.default.createElement("div", {
135
- className: cls('wrap'),
136
- style: {
137
- pointerEvents: props.visible ? undefined : 'none'
138
- }
147
+ className: cls('wrap')
139
148
  }, _react.default.createElement(_web.animated.div, {
140
149
  style: style
141
150
  }, body)))));
142
- return (0, _renderToContainer.renderToContainer)(props.getContainer, node);
151
+ return _react.default.createElement(_shouldRender.ShouldRender, {
152
+ active: active,
153
+ forceRender: props.forceRender,
154
+ destroyOnClose: props.destroyOnClose
155
+ }, (0, _renderToContainer.renderToContainer)(props.getContainer, node));
143
156
  };
144
157
 
145
158
  exports.Modal = Modal;
@@ -40,6 +40,7 @@
40
40
  border-radius: 16px;
41
41
  box-shadow: 0 0 60px 0 rgba(51, 51, 51, 0.2);
42
42
  font-size: 30px;
43
+ width: max-content;
43
44
  min-width: 64px;
44
45
  max-width: calc(100vw - 48px);
45
46
  overflow-y: hidden;
@@ -1,5 +1,6 @@
1
1
  import React, { FC } from 'react';
2
2
  import { NativeProps } from '../../utils/native-props';
3
+ import type { MaskProps } from '../mask';
3
4
  import { GetContainer } from '../../utils/render-to-container';
4
5
  import { PropagationEvent } from '../../utils/with-stop-propagation';
5
6
  export declare type PopupProps = {
@@ -15,7 +16,7 @@ export declare type PopupProps = {
15
16
  bodyClassName?: string;
16
17
  bodyStyle?: React.CSSProperties;
17
18
  maskClassName?: string;
18
- maskStyle?: React.CSSProperties;
19
+ maskStyle?: MaskProps['style'];
19
20
  onClick?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
20
21
  stopPropagation?: PropagationEvent[];
21
22
  children?: React.ReactNode;
@@ -31,4 +31,4 @@ export declare const SearchBar: React.ForwardRefExoticComponent<Pick<InputProps,
31
31
  onSearch?: ((val: string) => void) | undefined;
32
32
  onChange?: ((val: string) => void) | undefined;
33
33
  onCancel?: (() => void) | undefined;
34
- } & NativeProps<"--border-radius" | "--height" | "--padding-left" | "--background" | "--placeholder-color"> & React.RefAttributes<InputRef>>;
34
+ } & NativeProps<"--height" | "--border-radius" | "--padding-left" | "--background" | "--placeholder-color"> & React.RefAttributes<InputRef>>;
@@ -74,7 +74,7 @@ const SearchBar = (0, _react.forwardRef)((p, ref) => {
74
74
  }));
75
75
 
76
76
  const renderCancelButton = () => {
77
- let isShowCancel = false;
77
+ let isShowCancel;
78
78
 
79
79
  if (typeof props.showCancelButton === 'function') {
80
80
  isShowCancel = props.showCancelButton(hasFocus, value);
@@ -83,13 +83,7 @@ const SearchBar = (0, _react.forwardRef)((p, ref) => {
83
83
  }
84
84
 
85
85
  return isShowCancel && _react.default.createElement("div", {
86
- className: `${classPrefix}-suffix`,
87
- onMouseDown: e => {
88
- e.preventDefault();
89
- },
90
- onTouchStart: e => {
91
- e.preventDefault();
92
- }
86
+ className: `${classPrefix}-suffix`
93
87
  }, _react.default.createElement(_button.default, {
94
88
  fill: 'none',
95
89
  className: `${classPrefix}-cancel-button`,
@@ -102,6 +96,9 @@ const SearchBar = (0, _react.forwardRef)((p, ref) => {
102
96
 
103
97
  (_b = inputRef.current) === null || _b === void 0 ? void 0 : _b.blur();
104
98
  (_c = props.onCancel) === null || _c === void 0 ? void 0 : _c.call(props);
99
+ },
100
+ onMouseDown: e => {
101
+ e.preventDefault();
105
102
  }
106
103
  }, props.cancelText));
107
104
  };
@@ -1,10 +1,11 @@
1
1
  import { FC, ReactNode } from 'react';
2
2
  import React from 'react';
3
+ import { BadgeProps } from '../badge';
3
4
  import { NativeProps } from '../../utils/native-props';
4
5
  export declare type SideBarItemProps = {
5
6
  title?: ReactNode;
6
7
  disabled?: boolean;
7
- badge?: ReactNode;
8
+ badge?: BadgeProps['content'];
8
9
  } & NativeProps;
9
10
  export declare const SideBarItem: FC<SideBarItemProps>;
10
11
  export declare type SideBarProps = {
@@ -16,7 +16,7 @@ declare const _default: import("react").ForwardRefExoticComponent<{
16
16
  stuckAtBoundary?: boolean | undefined;
17
17
  rubberband?: boolean | undefined;
18
18
  children?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>[] | undefined;
19
- } & import("../../utils/native-props").NativeProps<"--border-radius" | "--width" | "--height" | "--track-padding"> & import("react").RefAttributes<import("./swiper").SwiperRef>> & {
19
+ } & import("../../utils/native-props").NativeProps<"--width" | "--height" | "--border-radius" | "--track-padding"> & import("react").RefAttributes<import("./swiper").SwiperRef>> & {
20
20
  Item: import("react").FC<{
21
21
  onClick?: ((e: import("react").MouseEvent<HTMLDivElement, MouseEvent>) => void) | undefined;
22
22
  children?: import("react").ReactNode;
@@ -37,4 +37,4 @@ export declare const Swiper: React.ForwardRefExoticComponent<{
37
37
  stuckAtBoundary?: boolean | undefined;
38
38
  rubberband?: boolean | undefined;
39
39
  children?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactElement<any, string | React.JSXElementConstructor<any>>[] | undefined;
40
- } & NativeProps<"--border-radius" | "--width" | "--height" | "--track-padding"> & React.RefAttributes<SwiperRef>>;
40
+ } & NativeProps<"--width" | "--height" | "--border-radius" | "--track-padding"> & React.RefAttributes<SwiperRef>>;
@@ -3,6 +3,8 @@
3
3
  --content-padding: 24px;
4
4
  --active-line-height: 4px;
5
5
  --active-line-border-radius: var(--active-line-height);
6
+ --active-line-color: var(--adm-color-primary);
7
+ --active-title-color: var(--adm-color-primary);
6
8
  position: relative;
7
9
  min-width: 0;
8
10
  }
@@ -45,7 +47,7 @@
45
47
  }
46
48
 
47
49
  .adm-tabs-tab-active {
48
- color: var(--adm-color-primary);
50
+ color: var(--active-title-color);
49
51
  }
50
52
 
51
53
  .adm-tabs-tab-disabled {
@@ -57,8 +59,7 @@
57
59
  position: absolute;
58
60
  bottom: 0;
59
61
  height: var(--active-line-height);
60
- color: var(--adm-color-primary);
61
- background: var(--adm-color-primary);
62
+ background: var(--active-line-color);
62
63
  border-radius: var(--active-line-border-radius);
63
64
  }
64
65
 
@@ -15,5 +15,5 @@ export declare type TabsProps = {
15
15
  stretch?: boolean;
16
16
  onChange?: (key: string) => void;
17
17
  children?: React.ReactNode;
18
- } & NativeProps<'--fixed-active-line-width' | '--active-line-height' | '--active-line-border-radius' | '--title-font-size' | '--content-padding'>;
18
+ } & NativeProps<'--fixed-active-line-width' | '--active-line-height' | '--active-line-border-radius' | '--title-font-size' | '--content-padding' | '--active-title-color' | '--active-line-color'>;
19
19
  export declare const Tabs: FC<TabsProps>;
@@ -123,7 +123,8 @@ const TextArea = (0, _react.forwardRef)((p, ref) => {
123
123
  compositingRef.current = false;
124
124
 
125
125
  if (maxLength) {
126
- setValue([...value].slice(0, maxLength).join(''));
126
+ const v = e.target.value;
127
+ setValue([...v].slice(0, maxLength).join(''));
127
128
  }
128
129
 
129
130
  (_a = props.onCompositionEnd) === null || _a === void 0 ? void 0 : _a.call(props, e);
@@ -14,7 +14,7 @@
14
14
  transform: translate(-50%, -50%);
15
15
  width: auto;
16
16
  min-width: 192px;
17
- max-width: 70%;
17
+ max-width: 400px;
18
18
  max-height: 70%;
19
19
  overflow: auto;
20
20
  color: white;
@@ -1,9 +1,10 @@
1
1
  import React, { ReactNode } from 'react';
2
+ import type { MaskProps } from '../mask';
2
3
  import { PropagationEvent } from '../../utils/with-stop-propagation';
3
4
  import { GetContainer } from '../../utils/render-to-container';
4
5
  export interface ToastProps {
5
6
  afterClose?: () => void;
6
- maskStyle?: React.CSSProperties;
7
+ maskStyle?: MaskProps['style'];
7
8
  maskClassName?: string;
8
9
  maskClickable?: boolean;
9
10
  content?: ReactNode;
@@ -0,0 +1,106 @@
1
+ declare const frFR: {
2
+ locale: string;
3
+ common: {
4
+ confirm: string;
5
+ cancel: string;
6
+ loading: string;
7
+ };
8
+ Calendar: {
9
+ markItems: string[];
10
+ renderYearAndMonth: (year: number, month: number) => string;
11
+ };
12
+ Cascader: {
13
+ placeholder: string;
14
+ };
15
+ Dialog: {
16
+ ok: string;
17
+ };
18
+ ErrorBlock: {
19
+ default: {
20
+ title: string;
21
+ description: string;
22
+ };
23
+ busy: {
24
+ title: string;
25
+ description: string;
26
+ };
27
+ disconnected: {
28
+ title: string;
29
+ description: string;
30
+ };
31
+ empty: {
32
+ title: string;
33
+ description: string;
34
+ };
35
+ };
36
+ Form: {
37
+ required: string;
38
+ optional: string;
39
+ defaultValidateMessages: {
40
+ default: string;
41
+ required: string;
42
+ enum: string;
43
+ whitespace: string;
44
+ date: {
45
+ format: string;
46
+ parse: string;
47
+ invalid: string;
48
+ };
49
+ types: {
50
+ string: string;
51
+ method: string;
52
+ array: string;
53
+ object: string;
54
+ number: string;
55
+ date: string;
56
+ boolean: string;
57
+ integer: string;
58
+ float: string;
59
+ regexp: string;
60
+ email: string;
61
+ url: string;
62
+ hex: string;
63
+ };
64
+ string: {
65
+ len: string;
66
+ min: string;
67
+ max: string;
68
+ range: string;
69
+ };
70
+ number: {
71
+ len: string;
72
+ min: string;
73
+ max: string;
74
+ range: string;
75
+ };
76
+ array: {
77
+ len: string;
78
+ min: string;
79
+ max: string;
80
+ range: string;
81
+ };
82
+ pattern: {
83
+ mismatch: string;
84
+ };
85
+ };
86
+ };
87
+ ImageUploader: {
88
+ uploading: string;
89
+ upload: string;
90
+ };
91
+ InfiniteScroll: {
92
+ noMore: string;
93
+ };
94
+ Mask: {
95
+ name: string;
96
+ };
97
+ Modal: {
98
+ ok: string;
99
+ };
100
+ PullToRefresh: {
101
+ pulling: string;
102
+ canRelease: string;
103
+ complete: string;
104
+ };
105
+ };
106
+ export default frFR;