antd-mobile 5.1.0 → 5.2.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 (299) hide show
  1. package/2x/README.md +9 -1
  2. package/2x/cjs/components/calendar/calendar.d.ts +11 -2
  3. package/2x/cjs/components/calendar/calendar.js +32 -10
  4. package/2x/cjs/components/calendar/index.d.ts +1 -1
  5. package/2x/cjs/components/capsule-tabs/capsule-tabs.d.ts +1 -0
  6. package/2x/cjs/components/capsule-tabs/capsule-tabs.js +14 -17
  7. package/2x/cjs/components/cascade-picker/prompt.d.ts +2 -1
  8. package/2x/cjs/components/collapse/collapse.js +5 -3
  9. package/2x/cjs/components/date-picker/date-picker.js +11 -1
  10. package/2x/cjs/components/dialog/clear.d.ts +1 -0
  11. package/2x/cjs/components/dialog/clear.js +14 -0
  12. package/2x/cjs/components/dialog/dialog.css +27 -18
  13. package/2x/cjs/components/dialog/dialog.js +39 -42
  14. package/2x/cjs/components/dialog/index.d.ts +2 -0
  15. package/2x/cjs/components/dialog/index.js +4 -1
  16. package/2x/cjs/components/dialog/show.d.ts +1 -0
  17. package/2x/cjs/components/dialog/show.js +23 -11
  18. package/2x/cjs/components/dropdown/dropdown.css +2 -1
  19. package/2x/cjs/components/dropdown/item.js +2 -2
  20. package/2x/cjs/components/form/form.css +12 -0
  21. package/2x/cjs/components/form/form.d.ts +4 -4
  22. package/2x/cjs/components/form/index.css +12 -0
  23. package/2x/cjs/components/form/index.d.ts +3 -3
  24. package/2x/cjs/components/image-viewer/image-viewer.d.ts +1 -1
  25. package/2x/cjs/components/image-viewer/index.d.ts +1 -1
  26. package/2x/cjs/components/input/input.d.ts +2 -2
  27. package/2x/cjs/components/jumbo-tabs/jumbo-tabs.d.ts +1 -0
  28. package/2x/cjs/components/jumbo-tabs/jumbo-tabs.js +14 -17
  29. package/2x/cjs/components/mask/mask.js +2 -2
  30. package/2x/cjs/components/modal/clear.d.ts +1 -0
  31. package/2x/cjs/components/modal/clear.js +14 -0
  32. package/2x/cjs/components/modal/index.d.ts +2 -0
  33. package/2x/cjs/components/modal/index.js +4 -1
  34. package/2x/cjs/components/modal/modal.css +27 -21
  35. package/2x/cjs/components/modal/modal.js +39 -36
  36. package/2x/cjs/components/modal/show.d.ts +1 -0
  37. package/2x/cjs/components/modal/show.js +23 -11
  38. package/2x/cjs/components/passcode-input/passcode-input.d.ts +1 -1
  39. package/2x/cjs/components/picker/prompt.d.ts +2 -2
  40. package/2x/cjs/components/picker-view/picker-view.css +0 -10
  41. package/2x/cjs/components/picker-view/wheel.js +7 -14
  42. package/2x/cjs/components/popover/arrow.js +1 -2
  43. package/2x/cjs/components/popover/index.d.ts +3 -3
  44. package/2x/cjs/components/popover/popover-menu.d.ts +1 -1
  45. package/2x/cjs/components/popover/popover.d.ts +1 -1
  46. package/2x/cjs/components/popup/popup.js +2 -2
  47. package/2x/cjs/components/search-bar/search-bar.js +1 -0
  48. package/2x/cjs/components/selector/selector.d.ts +3 -1
  49. package/2x/cjs/components/stepper/stepper.d.ts +12 -2
  50. package/2x/cjs/components/stepper/stepper.js +43 -16
  51. package/2x/cjs/components/swiper/index.d.ts +3 -3
  52. package/2x/cjs/components/swiper/swiper.d.ts +3 -3
  53. package/2x/cjs/components/switch/spin-icon.d.ts +3 -0
  54. package/2x/cjs/components/switch/spin-icon.js +37 -0
  55. package/2x/cjs/components/switch/switch.css +1 -1
  56. package/2x/cjs/components/switch/switch.js +4 -6
  57. package/2x/cjs/components/tabs/tabs.d.ts +1 -0
  58. package/2x/cjs/components/tabs/tabs.js +17 -19
  59. package/2x/cjs/components/virtual-input/virtual-input.d.ts +2 -2
  60. package/2x/cjs/utils/measure-css-length.d.ts +1 -0
  61. package/2x/cjs/utils/measure-css-length.js +28 -0
  62. package/2x/cjs/utils/native-props.d.ts +1 -1
  63. package/2x/cjs/utils/render-to-container.d.ts +1 -1
  64. package/2x/cjs/utils/should-render.d.ts +10 -0
  65. package/{cjs/utils/use-should-render.js → 2x/cjs/utils/should-render.js} +8 -0
  66. package/2x/cjs/utils/use-drag-and-pinch.d.ts +1 -2
  67. package/2x/cjs/utils/use-isomorphic-update-layout-effect.js +1 -3
  68. package/2x/cjs/utils/use-props-value.d.ts +1 -1
  69. package/2x/cjs/utils/use-tab-list-scroll.js +3 -1
  70. package/2x/cjs/utils/use-touch.d.ts +0 -1
  71. package/2x/cjs/utils/validate.js +1 -1
  72. package/2x/cjs/utils/with-stop-propagation.d.ts +1 -1
  73. package/2x/es/components/calendar/calendar.d.ts +11 -2
  74. package/2x/es/components/calendar/calendar.js +33 -9
  75. package/2x/es/components/calendar/index.d.ts +1 -1
  76. package/2x/es/components/capsule-tabs/capsule-tabs.d.ts +1 -0
  77. package/2x/es/components/capsule-tabs/capsule-tabs.js +13 -17
  78. package/2x/es/components/cascade-picker/prompt.d.ts +2 -1
  79. package/2x/es/components/collapse/collapse.js +4 -3
  80. package/2x/es/components/date-picker/date-picker.js +10 -1
  81. package/2x/es/components/dialog/clear.d.ts +1 -0
  82. package/2x/es/components/dialog/clear.js +6 -0
  83. package/2x/es/components/dialog/dialog.css +27 -18
  84. package/2x/es/components/dialog/dialog.js +37 -41
  85. package/2x/es/components/dialog/index.d.ts +2 -0
  86. package/2x/es/components/dialog/index.js +3 -1
  87. package/2x/es/components/dialog/show.d.ts +1 -0
  88. package/2x/es/components/dialog/show.js +20 -11
  89. package/2x/es/components/dropdown/dropdown.css +2 -1
  90. package/2x/es/components/dropdown/item.js +1 -1
  91. package/2x/es/components/form/form.css +12 -0
  92. package/2x/es/components/form/form.d.ts +4 -4
  93. package/2x/es/components/form/index.css +12 -0
  94. package/2x/es/components/form/index.d.ts +3 -3
  95. package/2x/es/components/image-viewer/image-viewer.d.ts +1 -1
  96. package/2x/es/components/image-viewer/index.d.ts +1 -1
  97. package/2x/es/components/input/input.d.ts +2 -2
  98. package/2x/es/components/jumbo-tabs/jumbo-tabs.d.ts +1 -0
  99. package/2x/es/components/jumbo-tabs/jumbo-tabs.js +13 -17
  100. package/2x/es/components/mask/mask.js +1 -1
  101. package/2x/es/components/modal/clear.d.ts +1 -0
  102. package/2x/es/components/modal/clear.js +6 -0
  103. package/2x/es/components/modal/index.d.ts +2 -0
  104. package/2x/es/components/modal/index.js +3 -1
  105. package/2x/es/components/modal/modal.css +27 -21
  106. package/2x/es/components/modal/modal.js +37 -36
  107. package/2x/es/components/modal/show.d.ts +1 -0
  108. package/2x/es/components/modal/show.js +20 -11
  109. package/2x/es/components/passcode-input/passcode-input.d.ts +1 -1
  110. package/2x/es/components/picker/prompt.d.ts +2 -2
  111. package/2x/es/components/picker-view/picker-view.css +0 -10
  112. package/2x/es/components/picker-view/wheel.js +7 -14
  113. package/2x/es/components/popover/arrow.js +1 -2
  114. package/2x/es/components/popover/index.d.ts +3 -3
  115. package/2x/es/components/popover/popover-menu.d.ts +1 -1
  116. package/2x/es/components/popover/popover.d.ts +1 -1
  117. package/2x/es/components/popup/popup.js +1 -1
  118. package/2x/es/components/search-bar/search-bar.js +1 -0
  119. package/2x/es/components/selector/selector.d.ts +3 -1
  120. package/2x/es/components/stepper/stepper.d.ts +12 -2
  121. package/2x/es/components/stepper/stepper.js +43 -16
  122. package/2x/es/components/swiper/index.d.ts +3 -3
  123. package/2x/es/components/swiper/swiper.d.ts +3 -3
  124. package/2x/es/components/switch/spin-icon.d.ts +3 -0
  125. package/2x/es/components/switch/spin-icon.js +23 -0
  126. package/2x/es/components/switch/switch.css +1 -1
  127. package/2x/es/components/switch/switch.js +3 -5
  128. package/2x/es/components/tabs/tabs.d.ts +1 -0
  129. package/2x/es/components/tabs/tabs.js +16 -20
  130. package/2x/es/components/virtual-input/virtual-input.d.ts +2 -2
  131. package/2x/es/utils/measure-css-length.d.ts +1 -0
  132. package/2x/es/utils/measure-css-length.js +19 -0
  133. package/2x/es/utils/native-props.d.ts +1 -1
  134. package/2x/es/utils/render-to-container.d.ts +1 -1
  135. package/2x/es/utils/should-render.d.ts +10 -0
  136. package/2x/es/utils/{use-should-render.js → should-render.js} +4 -0
  137. package/2x/es/utils/use-drag-and-pinch.d.ts +1 -2
  138. package/2x/es/utils/use-isomorphic-update-layout-effect.js +1 -2
  139. package/2x/es/utils/use-props-value.d.ts +1 -1
  140. package/2x/es/utils/use-tab-list-scroll.js +3 -2
  141. package/2x/es/utils/use-touch.d.ts +0 -1
  142. package/2x/es/utils/validate.js +1 -1
  143. package/2x/es/utils/with-stop-propagation.d.ts +1 -1
  144. package/2x/package.json +4 -4
  145. package/README.md +9 -1
  146. package/cjs/components/calendar/calendar.d.ts +11 -2
  147. package/cjs/components/calendar/calendar.js +32 -10
  148. package/cjs/components/calendar/index.d.ts +1 -1
  149. package/cjs/components/capsule-tabs/capsule-tabs.d.ts +1 -0
  150. package/cjs/components/capsule-tabs/capsule-tabs.js +14 -17
  151. package/cjs/components/cascade-picker/prompt.d.ts +2 -1
  152. package/cjs/components/collapse/collapse.js +5 -3
  153. package/cjs/components/date-picker/date-picker.js +11 -1
  154. package/cjs/components/dialog/clear.d.ts +1 -0
  155. package/cjs/components/dialog/clear.js +14 -0
  156. package/cjs/components/dialog/dialog.css +26 -18
  157. package/cjs/components/dialog/dialog.js +39 -42
  158. package/cjs/components/dialog/index.d.ts +2 -0
  159. package/cjs/components/dialog/index.js +4 -1
  160. package/cjs/components/dialog/show.d.ts +1 -0
  161. package/cjs/components/dialog/show.js +23 -11
  162. package/cjs/components/dropdown/dropdown.css +2 -1
  163. package/cjs/components/dropdown/item.js +2 -2
  164. package/cjs/components/form/form.css +11 -0
  165. package/cjs/components/form/form.d.ts +4 -4
  166. package/cjs/components/form/index.css +11 -0
  167. package/cjs/components/form/index.d.ts +3 -3
  168. package/cjs/components/image-viewer/image-viewer.d.ts +1 -1
  169. package/cjs/components/image-viewer/index.d.ts +1 -1
  170. package/cjs/components/input/input.d.ts +2 -2
  171. package/cjs/components/jumbo-tabs/jumbo-tabs.d.ts +1 -0
  172. package/cjs/components/jumbo-tabs/jumbo-tabs.js +14 -17
  173. package/cjs/components/mask/mask.js +2 -2
  174. package/cjs/components/modal/clear.d.ts +1 -0
  175. package/cjs/components/modal/clear.js +14 -0
  176. package/cjs/components/modal/index.d.ts +2 -0
  177. package/cjs/components/modal/index.js +4 -1
  178. package/cjs/components/modal/modal.css +26 -20
  179. package/cjs/components/modal/modal.js +39 -36
  180. package/cjs/components/modal/show.d.ts +1 -0
  181. package/cjs/components/modal/show.js +23 -11
  182. package/cjs/components/passcode-input/passcode-input.d.ts +1 -1
  183. package/cjs/components/picker/prompt.d.ts +2 -2
  184. package/cjs/components/picker-view/picker-view.css +0 -9
  185. package/cjs/components/picker-view/wheel.js +7 -14
  186. package/cjs/components/popover/arrow.js +1 -2
  187. package/cjs/components/popover/index.d.ts +3 -3
  188. package/cjs/components/popover/popover-menu.d.ts +1 -1
  189. package/cjs/components/popover/popover.d.ts +1 -1
  190. package/cjs/components/popup/popup.js +2 -2
  191. package/cjs/components/search-bar/search-bar.js +1 -0
  192. package/cjs/components/selector/selector.d.ts +3 -1
  193. package/cjs/components/stepper/stepper.d.ts +12 -2
  194. package/cjs/components/stepper/stepper.js +43 -16
  195. package/cjs/components/swiper/index.d.ts +3 -3
  196. package/cjs/components/swiper/swiper.d.ts +3 -3
  197. package/cjs/components/switch/spin-icon.d.ts +3 -0
  198. package/cjs/components/switch/spin-icon.js +37 -0
  199. package/cjs/components/switch/switch.css +1 -1
  200. package/cjs/components/switch/switch.js +4 -6
  201. package/cjs/components/tabs/tabs.d.ts +1 -0
  202. package/cjs/components/tabs/tabs.js +17 -19
  203. package/cjs/components/virtual-input/virtual-input.d.ts +2 -2
  204. package/cjs/utils/measure-css-length.d.ts +1 -0
  205. package/cjs/utils/measure-css-length.js +28 -0
  206. package/cjs/utils/native-props.d.ts +1 -1
  207. package/cjs/utils/render-to-container.d.ts +1 -1
  208. package/cjs/utils/should-render.d.ts +10 -0
  209. package/{2x/cjs/utils/use-should-render.js → cjs/utils/should-render.js} +8 -0
  210. package/cjs/utils/use-drag-and-pinch.d.ts +1 -2
  211. package/cjs/utils/use-isomorphic-update-layout-effect.js +1 -3
  212. package/cjs/utils/use-props-value.d.ts +1 -1
  213. package/cjs/utils/use-tab-list-scroll.js +3 -1
  214. package/cjs/utils/use-touch.d.ts +0 -1
  215. package/cjs/utils/validate.js +1 -1
  216. package/cjs/utils/with-stop-propagation.d.ts +1 -1
  217. package/es/components/calendar/calendar.d.ts +11 -2
  218. package/es/components/calendar/calendar.js +33 -9
  219. package/es/components/calendar/index.d.ts +1 -1
  220. package/es/components/capsule-tabs/capsule-tabs.d.ts +1 -0
  221. package/es/components/capsule-tabs/capsule-tabs.js +13 -17
  222. package/es/components/cascade-picker/prompt.d.ts +2 -1
  223. package/es/components/collapse/collapse.js +4 -3
  224. package/es/components/date-picker/date-picker.js +10 -1
  225. package/es/components/dialog/clear.d.ts +1 -0
  226. package/es/components/dialog/clear.js +6 -0
  227. package/es/components/dialog/dialog.css +26 -18
  228. package/es/components/dialog/dialog.js +37 -41
  229. package/es/components/dialog/index.d.ts +2 -0
  230. package/es/components/dialog/index.js +3 -1
  231. package/es/components/dialog/show.d.ts +1 -0
  232. package/es/components/dialog/show.js +20 -11
  233. package/es/components/dropdown/dropdown.css +2 -1
  234. package/es/components/dropdown/item.js +1 -1
  235. package/es/components/form/form.css +11 -0
  236. package/es/components/form/form.d.ts +4 -4
  237. package/es/components/form/index.css +11 -0
  238. package/es/components/form/index.d.ts +3 -3
  239. package/es/components/image-viewer/image-viewer.d.ts +1 -1
  240. package/es/components/image-viewer/index.d.ts +1 -1
  241. package/es/components/input/input.d.ts +2 -2
  242. package/es/components/jumbo-tabs/jumbo-tabs.d.ts +1 -0
  243. package/es/components/jumbo-tabs/jumbo-tabs.js +13 -17
  244. package/es/components/mask/mask.js +1 -1
  245. package/es/components/modal/clear.d.ts +1 -0
  246. package/es/components/modal/clear.js +6 -0
  247. package/es/components/modal/index.d.ts +2 -0
  248. package/es/components/modal/index.js +3 -1
  249. package/es/components/modal/modal.css +26 -20
  250. package/es/components/modal/modal.js +37 -36
  251. package/es/components/modal/show.d.ts +1 -0
  252. package/es/components/modal/show.js +20 -11
  253. package/es/components/passcode-input/passcode-input.d.ts +1 -1
  254. package/es/components/picker/prompt.d.ts +2 -2
  255. package/es/components/picker-view/picker-view.css +0 -9
  256. package/es/components/picker-view/wheel.js +7 -14
  257. package/es/components/popover/arrow.js +1 -2
  258. package/es/components/popover/index.d.ts +3 -3
  259. package/es/components/popover/popover-menu.d.ts +1 -1
  260. package/es/components/popover/popover.d.ts +1 -1
  261. package/es/components/popup/popup.js +1 -1
  262. package/es/components/search-bar/search-bar.js +1 -0
  263. package/es/components/selector/selector.d.ts +3 -1
  264. package/es/components/stepper/stepper.d.ts +12 -2
  265. package/es/components/stepper/stepper.js +43 -16
  266. package/es/components/swiper/index.d.ts +3 -3
  267. package/es/components/swiper/swiper.d.ts +3 -3
  268. package/es/components/switch/spin-icon.d.ts +3 -0
  269. package/es/components/switch/spin-icon.js +23 -0
  270. package/es/components/switch/switch.css +1 -1
  271. package/es/components/switch/switch.js +3 -5
  272. package/es/components/tabs/tabs.d.ts +1 -0
  273. package/es/components/tabs/tabs.js +16 -20
  274. package/es/components/virtual-input/virtual-input.d.ts +2 -2
  275. package/es/utils/measure-css-length.d.ts +1 -0
  276. package/es/utils/measure-css-length.js +19 -0
  277. package/es/utils/native-props.d.ts +1 -1
  278. package/es/utils/render-to-container.d.ts +1 -1
  279. package/es/utils/should-render.d.ts +10 -0
  280. package/es/utils/{use-should-render.js → should-render.js} +4 -0
  281. package/es/utils/use-drag-and-pinch.d.ts +1 -2
  282. package/es/utils/use-isomorphic-update-layout-effect.js +1 -2
  283. package/es/utils/use-props-value.d.ts +1 -1
  284. package/es/utils/use-tab-list-scroll.js +3 -2
  285. package/es/utils/use-touch.d.ts +0 -1
  286. package/es/utils/validate.js +1 -1
  287. package/es/utils/with-stop-propagation.d.ts +1 -1
  288. package/package.json +4 -4
  289. package/umd/antd-mobile.js +1 -1
  290. package/2x/assets/spin.svg +0 -12
  291. package/2x/cjs/assets/spin.svg +0 -12
  292. package/2x/cjs/utils/use-should-render.d.ts +0 -1
  293. package/2x/es/assets/spin.svg +0 -12
  294. package/2x/es/utils/use-should-render.d.ts +0 -1
  295. package/assets/spin.svg +0 -12
  296. package/cjs/assets/spin.svg +0 -12
  297. package/cjs/utils/use-should-render.d.ts +0 -1
  298. package/es/assets/spin.svg +0 -12
  299. package/es/utils/use-should-render.d.ts +0 -1
@@ -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))));
@@ -4,6 +4,7 @@ export declare type TabProps = {
4
4
  title: ReactNode;
5
5
  disabled?: boolean;
6
6
  forceRender?: boolean;
7
+ destroyOnClose?: boolean;
7
8
  } & NativeProps;
8
9
  export declare const Tab: FC<TabProps>;
9
10
  export declare type TabsProps = {
@@ -4,10 +4,12 @@ import { useSpring, animated } from '@react-spring/web';
4
4
  import { withNativeProps } from '../../utils/native-props';
5
5
  import { usePropsValue } from '../../utils/use-props-value';
6
6
  import { bound } from '../../utils/bound';
7
- import { useUpdateLayoutEffect, useThrottleFn, useIsomorphicLayoutEffect } from 'ahooks';
7
+ import { useThrottleFn, useIsomorphicLayoutEffect } from 'ahooks';
8
8
  import { useMutationEffect } from '../../utils/use-mutation-effect';
9
9
  import { useResizeEffect } from '../../utils/use-resize-effect';
10
10
  import { mergeProps } from '../../utils/with-default-props';
11
+ import { useIsomorphicUpdateLayoutEffect } from '../../utils/use-isomorphic-update-layout-effect';
12
+ import { ShouldRender } from '../../utils/should-render';
11
13
  const classPrefix = `adm-tabs`;
12
14
  export const Tab = () => {
13
15
  return null;
@@ -137,7 +139,7 @@ export const Tabs = p => {
137
139
  useIsomorphicLayoutEffect(() => {
138
140
  animate(!x.isAnimating);
139
141
  }, []);
140
- useUpdateLayoutEffect(() => {
142
+ useIsomorphicUpdateLayoutEffect(() => {
141
143
  animate();
142
144
  }, [activeKey]);
143
145
  useResizeEffect(() => {
@@ -224,23 +226,17 @@ export const Tabs = p => {
224
226
  return null;
225
227
  }
226
228
 
227
- if (pane.key === activeKey) {
228
- return React.createElement("div", {
229
- key: pane.key,
230
- className: `${classPrefix}-content`
231
- }, pane.props.children);
232
- }
233
-
234
- if (pane.props.forceRender) {
235
- return React.createElement("div", {
236
- key: pane.key,
237
- className: `${classPrefix}-content`,
238
- style: {
239
- display: 'none'
240
- }
241
- }, pane.props.children);
242
- }
243
-
244
- return null;
229
+ const active = pane.key === activeKey;
230
+ return React.createElement(ShouldRender, {
231
+ key: pane.key,
232
+ active: active,
233
+ forceRender: pane.props.forceRender,
234
+ destroyOnClose: pane.props.destroyOnClose
235
+ }, React.createElement("div", {
236
+ className: `${classPrefix}-content`,
237
+ style: {
238
+ display: active ? 'block' : 'none'
239
+ }
240
+ }, pane.props.children));
245
241
  })));
246
242
  };
@@ -18,7 +18,7 @@ export declare const VirtualInput: React.ForwardRefExoticComponent<{
18
18
  onFocus?: (() => void) | undefined;
19
19
  onBlur?: (() => void) | undefined;
20
20
  onClick?: ((e: React.MouseEvent<HTMLDivElement>) => void) | undefined;
21
- keyboard?: React.ReactElement<NumberKeyboardProps, string | ((props: any) => React.ReactElement<any, any> | null) | (new (props: any) => React.Component<any, any, any>)> | undefined;
21
+ keyboard?: React.ReactElement<NumberKeyboardProps, string | React.JSXElementConstructor<any>> | undefined;
22
22
  clearable?: boolean | undefined;
23
23
  onClear?: (() => void) | undefined;
24
- } & Pick<InputProps, "value" | "disabled" | "onChange" | "placeholder"> & NativeProps<"--color" | "--font-size" | "--placeholder-color" | "--text-align" | "--disabled-color" | "--caret-width" | "--caret-color"> & React.RefAttributes<VirtualInputRef>>;
24
+ } & Pick<InputProps, "value" | "onChange" | "disabled" | "placeholder"> & NativeProps<"--color" | "--font-size" | "--placeholder-color" | "--text-align" | "--disabled-color" | "--caret-width" | "--caret-color"> & React.RefAttributes<VirtualInputRef>>;
@@ -0,0 +1 @@
1
+ export declare function measureCSSLength(raw: string): number;
@@ -0,0 +1,19 @@
1
+ import { isDev } from './is-dev';
2
+ import { devError } from './dev-log';
3
+ export function measureCSSLength(raw) {
4
+ const withUnit = raw.trim();
5
+
6
+ if (withUnit.endsWith('px')) {
7
+ return parseFloat(withUnit);
8
+ } else if (withUnit.endsWith('rem')) {
9
+ return parseFloat(withUnit) * parseFloat(window.getComputedStyle(document.documentElement).fontSize);
10
+ } else if (withUnit.endsWith('vw')) {
11
+ return parseFloat(withUnit) * window.innerWidth / 100;
12
+ } else {
13
+ if (isDev) {
14
+ devError('Global', 'You are using a not supported CSS unit. Only `px` `rem` and `vw` are supported.');
15
+ }
16
+
17
+ return 0;
18
+ }
19
+ }
@@ -5,4 +5,4 @@ export interface NativeProps<S extends string = never> {
5
5
  style?: CSSProperties & Partial<Record<S, string>>;
6
6
  tabIndex?: number;
7
7
  }
8
- export declare function withNativeProps<P extends NativeProps>(props: P, element: ReactElement): React.ReactElement<any, string | ((props: any) => React.ReactElement<any, any> | null) | (new (props: any) => React.Component<any, any, any>)>;
8
+ export declare function withNativeProps<P extends NativeProps>(props: P, element: ReactElement): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
@@ -1,3 +1,3 @@
1
1
  import { ReactElement } from 'react';
2
2
  export declare type GetContainer = HTMLElement | (() => HTMLElement) | null;
3
- export declare function renderToContainer(getContainer: GetContainer, node: ReactElement): ReactElement<any, string | ((props: any) => ReactElement<any, any> | null) | (new (props: any) => import("react").Component<any, any, any>)>;
3
+ export declare function renderToContainer(getContainer: GetContainer, node: ReactElement): ReactElement<any, string | import("react").JSXElementConstructor<any>>;
@@ -0,0 +1,10 @@
1
+ import { FC, ReactElement } from 'react';
2
+ interface Props {
3
+ active: boolean;
4
+ forceRender?: boolean;
5
+ destroyOnClose?: boolean;
6
+ children: ReactElement;
7
+ }
8
+ export declare const ShouldRender: FC<Props>;
9
+ export declare function useShouldRender(active: boolean, forceRender?: boolean, destroyOnClose?: boolean): boolean;
10
+ export {};
@@ -1,4 +1,8 @@
1
1
  import { useInitialized } from './use-initialized';
2
+ export const ShouldRender = props => {
3
+ const shouldRender = useShouldRender(props.active, props.forceRender, props.destroyOnClose);
4
+ return shouldRender ? props.children : null;
5
+ };
2
6
  export function useShouldRender(active, forceRender, destroyOnClose) {
3
7
  const initialized = useInitialized(active);
4
8
  if (forceRender) return true;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
- export declare const useDragAndPinch: <Config extends import("@use-gesture/react").UserGestureConfig = import("@use-gesture/react").UserGestureConfig>(_handlers: Partial<import("@use-gesture/react").NativeHandlers<import("@use-gesture/react").EventTypes> & import("@use-gesture/react").UserHandlers<import("@use-gesture/react").EventTypes>>, _config?: {} | Config | undefined) => Config["target"] extends object ? void : (...args: any[]) => Pick<import("react").DOMAttributes<EventTarget>, "onClick" | "onChange" | "onPause" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDragCapture" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScrollCapture" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture">;
1
+ export declare const useDragAndPinch: <Config extends import("@use-gesture/react").UserGestureConfig = import("@use-gesture/react").UserGestureConfig>(_handlers: Partial<import("@use-gesture/react").NativeHandlers<import("@use-gesture/react").EventTypes> & import("@use-gesture/react").UserHandlers<import("@use-gesture/react").EventTypes>>, _config?: {} | Config | undefined) => Config["target"] extends object ? void : (...args: any[]) => import("@use-gesture/react").ReactDOMAttributes;
@@ -1,3 +1,2 @@
1
- import { createUpdateEffect } from 'ahooks/lib/createUpdateEffect';
2
- import { useIsomorphicLayoutEffect } from 'ahooks';
1
+ import { createUpdateEffect, useIsomorphicLayoutEffect } from 'ahooks';
3
2
  export const useIsomorphicUpdateLayoutEffect = createUpdateEffect(useIsomorphicLayoutEffect);
@@ -3,5 +3,5 @@ declare type Options<T> = {
3
3
  defaultValue: T;
4
4
  onChange?: (v: T) => void;
5
5
  };
6
- export declare function usePropsValue<T>(options: Options<T>): readonly [T, (v: T) => void];
6
+ export declare function usePropsValue<T>(options: Options<T>): readonly [T, (this: unknown, v: T) => void];
7
7
  export {};
@@ -1,7 +1,8 @@
1
1
  import { useSpring } from '@react-spring/web';
2
2
  import { useMutationEffect } from './use-mutation-effect';
3
3
  import { bound } from './bound';
4
- import { useIsomorphicLayoutEffect, useUpdateLayoutEffect } from 'ahooks';
4
+ import { useIsomorphicLayoutEffect } from 'ahooks';
5
+ import { useIsomorphicUpdateLayoutEffect } from './use-isomorphic-update-layout-effect';
5
6
  export const useTabListScroll = (targetRef, activeIndex) => {
6
7
  const [{
7
8
  scrollLeft
@@ -39,7 +40,7 @@ export const useTabListScroll = (targetRef, activeIndex) => {
39
40
  useIsomorphicLayoutEffect(() => {
40
41
  animate(true);
41
42
  }, []);
42
- useUpdateLayoutEffect(() => {
43
+ useIsomorphicUpdateLayoutEffect(() => {
43
44
  animate();
44
45
  }, [activeIndex]);
45
46
  useMutationEffect(() => {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  declare type Direction = '' | 'vertical' | 'horizontal';
3
2
  export declare function useTouch(): {
4
3
  move: EventListener;
@@ -6,7 +6,7 @@ export function isObject(val) {
6
6
  return val !== null && typeof val === 'object';
7
7
  }
8
8
  export function isPromise(obj) {
9
- return obj && typeof obj === 'object' && typeof obj.then === 'function';
9
+ return !!obj && typeof obj === 'object' && typeof obj.then === 'function';
10
10
  }
11
11
  export function isDate(val) {
12
12
  return Object.prototype.toString.call(val) === '[object Date]' && !Number.isNaN(val.getTime());
@@ -1,3 +1,3 @@
1
1
  import React, { ReactElement } from 'react';
2
2
  export declare type PropagationEvent = 'click';
3
- export declare function withStopPropagation(events: PropagationEvent[], element: ReactElement): React.ReactElement<any, string | ((props: any) => React.ReactElement<any, any> | null) | (new (props: any) => React.Component<any, any, any>)>;
3
+ export declare function withStopPropagation(events: PropagationEvent[], element: ReactElement): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
package/2x/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "antd-mobile",
3
- "version": "5.1.0",
3
+ "version": "5.2.2",
4
4
  "dependencies": {
5
5
  "@react-spring/web": "^9.4.3",
6
6
  "@types/resize-observer-browser": "^0.1.7",
7
7
  "@use-gesture/react": "^10.2.6",
8
- "ahooks": "^3.1.9",
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
12
  "dayjs": "^1.10.7",
13
13
  "lodash": "^4.17.21",
14
- "rc-field-form": "^1.22.1",
14
+ "rc-field-form": "^1.23.0",
15
15
  "rc-tooltip": "^5.1.1",
16
16
  "staged-components": "^1.1.2",
17
- "tslib": "^1.14.1",
17
+ "tslib": "^2.3.1",
18
18
  "use-async-memo": "^1.2.3"
19
19
  },
20
20
  "peerDependencies": {
package/README.md CHANGED
@@ -1,6 +1,14 @@
1
1
  <img src="https://gw.alipayobjects.com/mdn/rms_ee68a8/afts/img/A*hjjDS5Yy-ooAAAAAAAAAAAAAARQnAQ" alt="logo" width="100%" />
2
2
 
3
- [English Doc](https://mobile.ant.design) | [中文文档](https://mobile.ant.design/zh) | [Discord](https://discord.gg/jmNvw4WFYn) | [钉钉](https://gw.alipayobjects.com/mdn/rms_25513e/afts/img/A*hBjlR4nUWjkAAAAAAAAAAAAAARQnAQ)
3
+ <p align="center">
4
+ <a href="https://mobile.ant.design">English Doc</a>
5
+ |
6
+ <a href="https://mobile.ant.design/zh">中文文档</a>
7
+ |
8
+ <a href="https://discord.gg/jmNvw4WFYn">Discord</a>
9
+ |
10
+ <a href="https://gw.alipayobjects.com/mdn/rms_25513e/afts/img/A*hBjlR4nUWjkAAAAAAAAAAAAAARQnAQ">钉钉</a>
11
+ </p>
4
12
 
5
13
  ![npm (tag)](https://img.shields.io/npm/v/antd-mobile)
6
14
  ![GitHub Release Date](https://img.shields.io/github/release-date/ant-design/ant-design-mobile)
@@ -1,5 +1,13 @@
1
- import { FC } from 'react';
1
+ import React from 'react';
2
2
  import { NativeProps } from '../../utils/native-props';
3
+ declare type Page = {
4
+ month: number;
5
+ year: number;
6
+ };
7
+ export declare type CalenderRef = {
8
+ jumpTo: (page: Page | ((page: Page) => Page)) => void;
9
+ jumpToToday: () => void;
10
+ };
3
11
  export declare type CalendarProps = {
4
12
  weekStartsOn?: 'Monday' | 'Sunday';
5
13
  renderLabel?: (date: Date) => string | null | undefined;
@@ -20,4 +28,5 @@ export declare type CalendarProps = {
20
28
  defaultValue?: [Date, Date] | null;
21
29
  onChange?: (val: [Date, Date]) => void;
22
30
  }) & NativeProps;
23
- export declare const Calendar: FC<CalendarProps>;
31
+ export declare const Calendar: React.ForwardRefExoticComponent<CalendarProps & React.RefAttributes<CalenderRef>>;
32
+ export {};
@@ -37,8 +37,7 @@ const classPrefix = 'adm-calendar';
37
37
  const defaultProps = {
38
38
  weekStartsOn: 'Sunday'
39
39
  };
40
-
41
- const Calendar = p => {
40
+ const Calendar = (0, _react.forwardRef)((p, ref) => {
42
41
  const today = (0, _dayjs.default)();
43
42
  const props = (0, _withDefaultProps.mergeProps)(defaultProps, p);
44
43
  const {
@@ -57,6 +56,25 @@ const Calendar = p => {
57
56
 
58
57
  (_a = props.onPageChange) === null || _a === void 0 ? void 0 : _a.call(props, current.year(), current.month() + 1);
59
58
  }, [current]);
59
+ (0, _react.useImperativeHandle)(ref, () => ({
60
+ jumpTo: pageOrPageGenerator => {
61
+ let page;
62
+
63
+ if (typeof pageOrPageGenerator === 'function') {
64
+ page = pageOrPageGenerator({
65
+ year: current.year(),
66
+ month: current.month() + 1
67
+ });
68
+ } else {
69
+ page = pageOrPageGenerator;
70
+ }
71
+
72
+ setCurrent((0, _dayjs.default)().year(page.year).month(page.month - 1));
73
+ },
74
+ jumpToToday: () => {
75
+ setCurrent((0, _dayjs.default)().date(1));
76
+ }
77
+ }));
60
78
 
61
79
  const header = _react.default.createElement("div", {
62
80
  className: `${classPrefix}-header`
@@ -144,13 +162,18 @@ const Calendar = p => {
144
162
  (_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, d.toDate());
145
163
  } else if (props.selectionMode === 'range') {
146
164
  if (begin !== null && end === null) {
147
- if (d.isBefore(begin)) {
148
- setEnd(begin);
149
- setBegin(d);
150
- (_b = props.onChange) === null || _b === void 0 ? void 0 : _b.call(props, [d.toDate(), begin.toDate()]);
165
+ if (begin.isSame(d.toDate())) {
166
+ setBegin(null);
167
+ setEnd(null);
151
168
  } else {
152
- setEnd(d);
153
- (_c = props.onChange) === null || _c === void 0 ? void 0 : _c.call(props, [begin.toDate(), d.toDate()]);
169
+ if (d.isBefore(begin)) {
170
+ setEnd(begin);
171
+ setBegin(d);
172
+ (_b = props.onChange) === null || _b === void 0 ? void 0 : _b.call(props, [d.toDate(), begin.toDate()]);
173
+ } else {
174
+ setEnd(d);
175
+ (_c = props.onChange) === null || _c === void 0 ? void 0 : _c.call(props, [begin.toDate(), d.toDate()]);
176
+ }
154
177
  }
155
178
  } else {
156
179
  setBegin(d);
@@ -187,6 +210,5 @@ const Calendar = p => {
187
210
  return (0, _nativeProps.withNativeProps)(props, _react.default.createElement("div", {
188
211
  className: classPrefix
189
212
  }, header, mark, body));
190
- };
191
-
213
+ });
192
214
  exports.Calendar = Calendar;
@@ -1,4 +1,4 @@
1
1
  import './calendar.less';
2
2
  import { Calendar } from './calendar';
3
- export type { CalendarProps } from './calendar';
3
+ export type { CalendarProps, CalenderRef } from './calendar';
4
4
  export default Calendar;
@@ -4,6 +4,7 @@ export declare type CapsuleTabProps = {
4
4
  title: ReactNode;
5
5
  disabled?: boolean;
6
6
  forceRender?: boolean;
7
+ destroyOnClose?: boolean;
7
8
  } & NativeProps;
8
9
  export declare const CapsuleTab: FC<CapsuleTabProps>;
9
10
  export declare type CapsuleTabsProps = {
@@ -21,6 +21,8 @@ var _useTabListScroll = require("../../utils/use-tab-list-scroll");
21
21
 
22
22
  var _scrollMask = _interopRequireDefault(require("../scroll-mask"));
23
23
 
24
+ var _shouldRender = require("../../utils/should-render");
25
+
24
26
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
27
 
26
28
  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); }
@@ -110,23 +112,18 @@ const CapsuleTabs = props => {
110
112
  return null;
111
113
  }
112
114
 
113
- if (pane.key === activeKey) {
114
- return _react.default.createElement("div", {
115
- key: pane.key,
116
- className: `${classPrefix}-content`
117
- }, pane.props.children);
118
- }
119
-
120
- if (pane.props.forceRender) {
121
- return _react.default.createElement("div", {
122
- key: pane.key,
123
- style: {
124
- display: 'none'
125
- }
126
- }, pane.props.children);
127
- }
128
-
129
- return null;
115
+ const active = pane.key === activeKey;
116
+ return _react.default.createElement(_shouldRender.ShouldRender, {
117
+ key: pane.key,
118
+ active: active,
119
+ forceRender: pane.props.forceRender,
120
+ destroyOnClose: pane.props.destroyOnClose
121
+ }, _react.default.createElement("div", {
122
+ className: `${classPrefix}-content`,
123
+ style: {
124
+ display: active ? 'block' : 'none'
125
+ }
126
+ }, pane.props.children));
130
127
  })));
131
128
  };
132
129
 
@@ -1,2 +1,3 @@
1
1
  import { CascadePickerProps } from './cascade-picker';
2
- export declare function prompt(props: Omit<CascadePickerProps, 'value' | 'visible' | 'children'>): Promise<(string | null)[] | null>;
2
+ import type { PickerValue } from '../picker';
3
+ export declare function prompt(props: Omit<CascadePickerProps, 'value' | 'visible' | 'children'>): Promise<PickerValue[] | null>;
@@ -21,7 +21,9 @@ var _usePropsValue = require("../../utils/use-props-value");
21
21
 
22
22
  var _ahooks = require("ahooks");
23
23
 
24
- var _useShouldRender = require("../../utils/use-should-render");
24
+ var _shouldRender = require("../../utils/should-render");
25
+
26
+ var _useIsomorphicUpdateLayoutEffect = require("../../utils/use-isomorphic-update-layout-effect");
25
27
 
26
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
29
 
@@ -42,7 +44,7 @@ const CollapsePanelContent = props => {
42
44
  visible
43
45
  } = props;
44
46
  const innerRef = (0, _react.useRef)(null);
45
- const shouldRender = (0, _useShouldRender.useShouldRender)(visible, props.forceRender, props.destroyOnClose);
47
+ const shouldRender = (0, _shouldRender.useShouldRender)(visible, props.forceRender, props.destroyOnClose);
46
48
  const [{
47
49
  height
48
50
  }, api] = (0, _web.useSpring)(() => ({
@@ -59,7 +61,7 @@ const CollapsePanelContent = props => {
59
61
  immediate: true
60
62
  });
61
63
  });
62
- (0, _ahooks.useUpdateLayoutEffect)(() => {
64
+ (0, _useIsomorphicUpdateLayoutEffect.useIsomorphicUpdateLayoutEffect)(() => {
63
65
  const inner = innerRef.current;
64
66
  if (!inner) return;
65
67
 
@@ -19,6 +19,8 @@ var _usePropsValue = require("../../utils/use-props-value");
19
19
 
20
20
  var _datePickerUtils = require("./date-picker-utils");
21
21
 
22
+ var _bound = require("../../utils/bound");
23
+
22
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
25
 
24
26
  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); }
@@ -47,7 +49,15 @@ const DatePicker = p => {
47
49
  }
48
50
  });
49
51
  const now = (0, _react.useMemo)(() => new Date(), []);
50
- const pickerValue = (0, _react.useMemo)(() => (0, _datePickerUtils.convertDateToStringArray)(value !== null && value !== void 0 ? value : now, props.precision), [value, props.precision]);
52
+ const pickerValue = (0, _react.useMemo)(() => {
53
+ let date = value;
54
+
55
+ if (date === null) {
56
+ date = new Date((0, _bound.bound)(now.getTime(), props.min.getTime(), props.max.getTime()));
57
+ }
58
+
59
+ return (0, _datePickerUtils.convertDateToStringArray)(date, props.precision);
60
+ }, [value, props.precision]);
51
61
  const onConfirm = (0, _react.useCallback)(val => {
52
62
  setValue((0, _datePickerUtils.convertStringArrayToDate)(val, props.precision));
53
63
  }, [setValue, props.precision]);
@@ -0,0 +1 @@
1
+ export declare function clear(): void;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.clear = clear;
7
+
8
+ var _show = require("./show");
9
+
10
+ function clear() {
11
+ _show.closeFnSet.forEach(close => {
12
+ close();
13
+ });
14
+ }
@@ -15,7 +15,7 @@
15
15
  max-width: 500px;
16
16
  transform: translate(-50%, -50%);
17
17
  }
18
- .adm-dialog-main {
18
+ .adm-dialog-body {
19
19
  width: 100%;
20
20
  max-height: 70vh;
21
21
  font-size: 14px;
@@ -25,29 +25,33 @@
25
25
  display: flex;
26
26
  flex-direction: column;
27
27
  }
28
- .adm-dialog-main > * {
28
+ .adm-dialog-body > * {
29
29
  flex: none;
30
30
  }
31
- .adm-dialog-main > .adm-dialog-image-container {
31
+ .adm-dialog-body > .adm-dialog-content {
32
32
  flex: auto;
33
33
  }
34
- .adm-dialog-main > .adm-dialog-image-container + .adm-dialog-body {
35
- padding-top: 12px;
34
+ .adm-dialog-body:not(.adm-dialog-with-image) {
35
+ padding-top: 20px;
36
36
  }
37
- .adm-dialog-main .adm-dialog-body {
38
- padding: 20px 12px;
37
+ .adm-dialog-body .adm-dialog-image-container {
38
+ margin-bottom: 12px;
39
+ max-height: 40vh;
39
40
  }
40
- .adm-dialog-main .adm-dialog-body-header-wrapper {
41
- display: flex;
42
- justify-content: center;
41
+ .adm-dialog-body .adm-dialog-header {
42
+ margin-bottom: 8px;
43
+ padding: 0 12px;
43
44
  }
44
- .adm-dialog-main .adm-dialog-body-title {
45
+ .adm-dialog-body .adm-dialog-title {
46
+ margin-bottom: 8px;
47
+ padding: 0 12px;
45
48
  font-weight: bold;
46
49
  font-size: 18px;
47
50
  line-height: 25px;
48
51
  text-align: center;
49
52
  }
50
- .adm-dialog-main .adm-dialog-body-content {
53
+ .adm-dialog-body .adm-dialog-content {
54
+ padding: 0 12px 20px;
51
55
  max-height: 70vh;
52
56
  overflow-x: hidden;
53
57
  overflow-y: auto;
@@ -55,28 +59,32 @@
55
59
  line-height: 1.4;
56
60
  color: #333;
57
61
  }
58
- .adm-dialog-main .adm-dialog-footer {
62
+ .adm-dialog-body .adm-dialog-content-empty {
63
+ padding: 0;
64
+ height: 12px;
65
+ }
66
+ .adm-dialog-body .adm-dialog-footer {
59
67
  user-select: none;
60
68
  }
61
- .adm-dialog-main .adm-dialog-footer .adm-dialog-action-row {
69
+ .adm-dialog-body .adm-dialog-footer .adm-dialog-action-row {
62
70
  display: flex;
63
71
  align-items: stretch;
64
72
  border-top: 0.5px solid var(--adm-border-color);
65
73
  }
66
- .adm-dialog-main .adm-dialog-footer .adm-dialog-action-row > * {
74
+ .adm-dialog-body .adm-dialog-footer .adm-dialog-action-row > * {
67
75
  flex: 1;
68
76
  }
69
- .adm-dialog-main .adm-dialog-footer .adm-dialog-action-row > .adm-dialog-button {
77
+ .adm-dialog-body .adm-dialog-footer .adm-dialog-action-row > .adm-dialog-button {
70
78
  padding: 10px;
71
79
  font-size: 18px;
72
80
  line-height: 25px;
73
81
  border-radius: 0;
74
82
  border-right: solid 0.5px var(--adm-border-color);
75
83
  }
76
- .adm-dialog-main .adm-dialog-footer .adm-dialog-action-row > .adm-dialog-button-bold {
84
+ .adm-dialog-body .adm-dialog-footer .adm-dialog-action-row > .adm-dialog-button-bold {
77
85
  font-weight: bold;
78
86
  }
79
- .adm-dialog-main .adm-dialog-footer .adm-dialog-action-row > .adm-dialog-button:last-child {
87
+ .adm-dialog-body .adm-dialog-footer .adm-dialog-action-row > .adm-dialog-button:last-child {
80
88
  border-right: none;
81
89
  }
82
90
  .adm-dialog-image-container {