antd-mobile 5.0.0-rc.25 → 5.0.0-rc.26

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 (91) hide show
  1. package/2x/cjs/components/button/button.css +2 -2
  2. package/2x/cjs/components/calendar/calendar.js +3 -1
  3. package/2x/cjs/components/ellipsis/ellipsis.js +3 -1
  4. package/2x/cjs/components/floating-panel/floating-panel.d.ts +7 -5
  5. package/2x/cjs/components/floating-panel/floating-panel.js +11 -1
  6. package/2x/cjs/components/form/form-item.d.ts +1 -1
  7. package/2x/cjs/components/image-uploader/image-uploader.js +1 -1
  8. package/2x/cjs/components/image-viewer/image-viewer.js +12 -2
  9. package/2x/cjs/components/image-viewer/slide.js +2 -1
  10. package/2x/cjs/components/image-viewer/slides.d.ts +1 -1
  11. package/2x/cjs/components/input/input.js +4 -2
  12. package/2x/cjs/components/picker-view/wheel.js +4 -2
  13. package/2x/cjs/components/selector/selector.css +14 -6
  14. package/2x/cjs/components/selector/selector.d.ts +2 -1
  15. package/2x/cjs/components/selector/selector.js +3 -2
  16. package/2x/cjs/components/swiper/swiper.js +1 -1
  17. package/2x/cjs/components/tabs/tabs.js +2 -2
  18. package/2x/cjs/components/virtual-input/virtual-input.js +3 -1
  19. package/2x/cjs/utils/get-scroll-parent.js +1 -1
  20. package/2x/cjs/utils/use-ref-state.js +1 -1
  21. package/2x/cjs/utils/use-resize-effect.js +1 -3
  22. package/2x/cjs/utils/use-tab-list-scroll.js +1 -3
  23. package/2x/es/components/button/button.css +2 -2
  24. package/2x/es/components/calendar/calendar.js +3 -2
  25. package/2x/es/components/ellipsis/ellipsis.js +3 -2
  26. package/2x/es/components/floating-panel/floating-panel.d.ts +7 -5
  27. package/2x/es/components/floating-panel/floating-panel.js +9 -1
  28. package/2x/es/components/form/form-item.d.ts +1 -1
  29. package/2x/es/components/image-uploader/image-uploader.js +3 -3
  30. package/2x/es/components/image-viewer/image-viewer.js +13 -3
  31. package/2x/es/components/image-viewer/slide.js +2 -1
  32. package/2x/es/components/image-viewer/slides.d.ts +1 -1
  33. package/2x/es/components/input/input.js +4 -3
  34. package/2x/es/components/picker-view/wheel.js +4 -3
  35. package/2x/es/components/selector/selector.css +14 -6
  36. package/2x/es/components/selector/selector.d.ts +2 -1
  37. package/2x/es/components/selector/selector.js +3 -2
  38. package/2x/es/components/swiper/swiper.js +3 -3
  39. package/2x/es/components/tabs/tabs.js +4 -4
  40. package/2x/es/components/virtual-input/virtual-input.js +3 -2
  41. package/2x/es/utils/get-scroll-parent.js +1 -1
  42. package/2x/es/utils/use-ref-state.js +2 -2
  43. package/2x/es/utils/use-resize-effect.js +2 -3
  44. package/2x/es/utils/use-tab-list-scroll.js +2 -3
  45. package/2x/package.json +3 -3
  46. package/cjs/components/button/button.css +2 -2
  47. package/cjs/components/calendar/calendar.js +3 -1
  48. package/cjs/components/ellipsis/ellipsis.js +3 -1
  49. package/cjs/components/floating-panel/floating-panel.d.ts +7 -5
  50. package/cjs/components/floating-panel/floating-panel.js +11 -1
  51. package/cjs/components/form/form-item.d.ts +1 -1
  52. package/cjs/components/image-uploader/image-uploader.js +1 -1
  53. package/cjs/components/image-viewer/image-viewer.js +12 -2
  54. package/cjs/components/image-viewer/slide.js +2 -1
  55. package/cjs/components/image-viewer/slides.d.ts +1 -1
  56. package/cjs/components/input/input.js +4 -2
  57. package/cjs/components/picker-view/wheel.js +4 -2
  58. package/cjs/components/selector/selector.css +14 -6
  59. package/cjs/components/selector/selector.d.ts +2 -1
  60. package/cjs/components/selector/selector.js +3 -2
  61. package/cjs/components/swiper/swiper.js +1 -1
  62. package/cjs/components/tabs/tabs.js +2 -2
  63. package/cjs/components/virtual-input/virtual-input.js +3 -1
  64. package/cjs/utils/get-scroll-parent.js +1 -1
  65. package/cjs/utils/use-ref-state.js +1 -1
  66. package/cjs/utils/use-resize-effect.js +1 -3
  67. package/cjs/utils/use-tab-list-scroll.js +1 -3
  68. package/es/components/button/button.css +2 -2
  69. package/es/components/calendar/calendar.js +3 -2
  70. package/es/components/ellipsis/ellipsis.js +3 -2
  71. package/es/components/floating-panel/floating-panel.d.ts +7 -5
  72. package/es/components/floating-panel/floating-panel.js +9 -1
  73. package/es/components/form/form-item.d.ts +1 -1
  74. package/es/components/image-uploader/image-uploader.js +3 -3
  75. package/es/components/image-viewer/image-viewer.js +13 -3
  76. package/es/components/image-viewer/slide.js +2 -1
  77. package/es/components/image-viewer/slides.d.ts +1 -1
  78. package/es/components/input/input.js +4 -3
  79. package/es/components/picker-view/wheel.js +4 -3
  80. package/es/components/selector/selector.css +14 -6
  81. package/es/components/selector/selector.d.ts +2 -1
  82. package/es/components/selector/selector.js +3 -2
  83. package/es/components/swiper/swiper.js +3 -3
  84. package/es/components/tabs/tabs.js +4 -4
  85. package/es/components/virtual-input/virtual-input.js +3 -2
  86. package/es/utils/get-scroll-parent.js +1 -1
  87. package/es/utils/use-ref-state.js +2 -2
  88. package/es/utils/use-resize-effect.js +2 -3
  89. package/es/utils/use-tab-list-scroll.js +2 -3
  90. package/package.json +3 -3
  91. package/umd/antd-mobile.js +1 -1
@@ -12,9 +12,9 @@
12
12
  display: inline-block;
13
13
  box-sizing: border-box;
14
14
  height: auto;
15
- padding: 16px 24px;
15
+ padding: 14px 24px;
16
16
  margin: 0;
17
- font-size: 30px;
17
+ font-size: 34px;
18
18
  line-height: 1.4;
19
19
  text-align: center;
20
20
  border: var(--border-width) var(--border-style) var(--border-color);
@@ -23,6 +23,8 @@ var _configProvider = require("../config-provider");
23
23
 
24
24
  var _isoWeek = _interopRequireDefault(require("dayjs/plugin/isoWeek"));
25
25
 
26
+ var _ahooks = require("ahooks");
27
+
26
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
29
 
28
30
  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); }
@@ -91,7 +93,7 @@ const Calendar = p => {
91
93
  }, [props.selectionMode, props.value, props.defaultValue]);
92
94
  const [begin, setBegin] = (0, _react.useState)(null);
93
95
  const [end, setEnd] = (0, _react.useState)(null);
94
- (0, _react.useLayoutEffect)(() => {
96
+ (0, _ahooks.useIsomorphicLayoutEffect)(() => {
95
97
  setBegin(dateRange[0] ? (0, _dayjs.default)(dateRange[0]) : null);
96
98
  setEnd(dateRange[1] ? (0, _dayjs.default)(dateRange[1]) : null);
97
99
  }, [dateRange[0], dateRange[1]]);
@@ -13,6 +13,8 @@ var _nativeProps = require("../../utils/native-props");
13
13
 
14
14
  var _useResizeEffect = require("../../utils/use-resize-effect");
15
15
 
16
+ var _ahooks = require("ahooks");
17
+
16
18
  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); }
17
19
 
18
20
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -129,7 +131,7 @@ const Ellipsis = p => {
129
131
  }
130
132
 
131
133
  (0, _useResizeEffect.useResizeEffect)(calcEllipsised, rootRef);
132
- (0, _react.useLayoutEffect)(() => {
134
+ (0, _ahooks.useIsomorphicLayoutEffect)(() => {
133
135
  calcEllipsised();
134
136
  }, [props.content, props.direction, props.rows, props.expandText, props.collapseText]);
135
137
  const expandActionElement = exceeded && props.expandText ? _react.default.createElement("a", {
@@ -1,17 +1,19 @@
1
1
  import React, { ReactNode } from 'react';
2
2
  import { NativeProps } from '../../utils/native-props';
3
- export declare type FloatingPanelProps = {
4
- anchors: number[];
5
- children: ReactNode;
6
- onHeightChange?: (height: number, animating: boolean) => void;
7
- } & NativeProps<'--border-radius' | '--z-index'>;
8
3
  export declare type FloatingPanelRef = {
9
4
  setHeight: (height: number, options?: {
10
5
  immediate?: boolean;
11
6
  }) => void;
12
7
  };
8
+ export declare type FloatingPanelProps = {
9
+ anchors: number[];
10
+ children: ReactNode;
11
+ onHeightChange?: (height: number, animating: boolean) => void;
12
+ handleDraggingOfContent?: boolean;
13
+ } & NativeProps<'--border-radius' | '--z-index'>;
13
14
  export declare const FloatingPanel: React.ForwardRefExoticComponent<{
14
15
  anchors: number[];
15
16
  children: ReactNode;
16
17
  onHeightChange?: ((height: number, animating: boolean) => void) | undefined;
18
+ handleDraggingOfContent?: boolean | undefined;
17
19
  } & NativeProps<"--z-index" | "--border-radius"> & React.RefAttributes<FloatingPanelRef>>;
@@ -17,13 +17,21 @@ var _supportsPassive = require("../../utils/supports-passive");
17
17
 
18
18
  var _nearest = require("../../utils/nearest");
19
19
 
20
+ var _withDefaultProps = require("../../utils/with-default-props");
21
+
22
+ var _useLockScroll = require("../../utils/use-lock-scroll");
23
+
20
24
  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); }
21
25
 
22
26
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
27
 
24
- const FloatingPanel = (0, _react.forwardRef)((props, ref) => {
28
+ const defaultProps = {
29
+ handleDraggingOfContent: true
30
+ };
31
+ const FloatingPanel = (0, _react.forwardRef)((p, ref) => {
25
32
  var _a;
26
33
 
34
+ const props = (0, _withDefaultProps.mergeProps)(defaultProps, p);
27
35
  const {
28
36
  anchors
29
37
  } = props;
@@ -61,6 +69,7 @@ const FloatingPanel = (0, _react.forwardRef)((props, ref) => {
61
69
  if (header === target || (header === null || header === void 0 ? void 0 : header.contains(target))) {
62
70
  pullingRef.current = true;
63
71
  } else {
72
+ if (!props.handleDraggingOfContent) return;
64
73
  const reachedTop = y.goal <= bounds.top;
65
74
  const content = contentRef.current;
66
75
  if (!content) return;
@@ -118,6 +127,7 @@ const FloatingPanel = (0, _react.forwardRef)((props, ref) => {
118
127
  });
119
128
  }
120
129
  }), [api]);
130
+ (0, _useLockScroll.useLockScroll)(elementRef, true);
121
131
  return (0, _nativeProps.withNativeProps)(props, _react.default.createElement(_web.animated.div, {
122
132
  ref: elementRef,
123
133
  className: 'adm-floating-panel',
@@ -7,7 +7,7 @@ import type { FormLayout } from './index';
7
7
  declare type RenderChildren<Values = any> = (form: FormInstance<Values>) => React.ReactNode;
8
8
  declare type ChildrenType<Values = any> = RenderChildren<Values> | React.ReactNode;
9
9
  declare type RcFieldProps = Omit<FieldProps, 'children'>;
10
- export declare type FormItemProps = Pick<RcFieldProps, 'dependencies' | 'valuePropName' | 'name' | 'rules' | 'messageVariables' | 'trigger' | 'validateTrigger' | 'shouldUpdate'> & Pick<ListItemProps, 'style' | 'onClick' | 'extra' | 'arrow'> & {
10
+ export declare type FormItemProps = Pick<RcFieldProps, 'dependencies' | 'valuePropName' | 'name' | 'rules' | 'messageVariables' | 'trigger' | 'validateTrigger' | 'shouldUpdate' | 'initialValue'> & Pick<ListItemProps, 'style' | 'onClick' | 'extra' | 'arrow'> & {
11
11
  label?: React.ReactNode;
12
12
  help?: React.ReactNode;
13
13
  hasFeedback?: boolean;
@@ -50,7 +50,7 @@ const ImageUploader = p => {
50
50
  setValue(updater(value));
51
51
  });
52
52
  const [tasks, setTasks] = (0, _react.useState)([]);
53
- (0, _react.useLayoutEffect)(() => {
53
+ (0, _ahooks.useIsomorphicLayoutEffect)(() => {
54
54
  setTasks(prev => prev.filter(task => {
55
55
  if (task.url === undefined) return true;
56
56
  return !value.some(fileItem => fileItem.url === task.url);
@@ -59,6 +59,16 @@ const multiDefaultProps = Object.assign(Object.assign({}, defaultProps), {
59
59
  });
60
60
  const MultiImageViewer = (0, _react.forwardRef)((p, ref) => {
61
61
  const props = (0, _withDefaultProps.mergeProps)(multiDefaultProps, p);
62
+ const [defaultIndex, setDefaultIndex] = (0, _react.useState)(props.defaultIndex);
63
+ const slidesRef = (0, _react.useRef)(null);
64
+ (0, _react.useImperativeHandle)(ref, () => ({
65
+ swipeTo: (index, immediate) => {
66
+ var _a;
67
+
68
+ setDefaultIndex(index);
69
+ (_a = slidesRef.current) === null || _a === void 0 ? void 0 : _a.swipeTo(index, immediate);
70
+ }
71
+ }));
62
72
 
63
73
  const node = _react.default.createElement(_mask.default, {
64
74
  visible: props.visible,
@@ -68,8 +78,8 @@ const MultiImageViewer = (0, _react.forwardRef)((p, ref) => {
68
78
  }, _react.default.createElement("div", {
69
79
  className: `${classPrefix}-content`
70
80
  }, props.images && _react.default.createElement(_slides.Slides, {
71
- ref: ref,
72
- defaultIndex: props.defaultIndex,
81
+ ref: slidesRef,
82
+ defaultIndex: defaultIndex,
73
83
  onIndexChange: props.onIndexChange,
74
84
  images: props.images,
75
85
  onTap: () => {
@@ -124,7 +124,8 @@ const Slide = props => {
124
124
  }
125
125
  }, _react.default.createElement("img", {
126
126
  src: props.image,
127
- draggable: false
127
+ draggable: false,
128
+ alt: props.image
128
129
  }))));
129
130
  };
130
131
 
@@ -7,6 +7,6 @@ export declare type SlidesType = {
7
7
  onIndexChange?: (index: number) => void;
8
8
  };
9
9
  export declare type SlidesRef = {
10
- swipeTo: (index: number, immediate: boolean) => void;
10
+ swipeTo: (index: number, immediate?: boolean) => void;
11
11
  };
12
12
  export declare const Slides: React.ForwardRefExoticComponent<SlidesType & React.RefAttributes<SlidesRef>>;
@@ -17,6 +17,8 @@ var _withDefaultProps = require("../../utils/with-default-props");
17
17
 
18
18
  var _classnames = _interopRequireDefault(require("classnames"));
19
19
 
20
+ var _ahooks = require("ahooks");
21
+
20
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
23
 
22
24
  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); }
@@ -58,7 +60,7 @@ const Input = (0, _react.forwardRef)((p, ref) => {
58
60
  (_a = props.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(props, e);
59
61
  };
60
62
 
61
- (0, _react.useLayoutEffect)(() => {
63
+ (0, _ahooks.useIsomorphicLayoutEffect)(() => {
62
64
  var _a;
63
65
 
64
66
  if (!props.enterKeyHint) return;
@@ -108,7 +110,7 @@ const Input = (0, _react.forwardRef)((p, ref) => {
108
110
  onKeyUp: props.onKeyUp,
109
111
  onCompositionStart: props.onCompositionStart,
110
112
  onCompositionEnd: props.onCompositionEnd
111
- }), props.clearable && !!value && _react.default.createElement("div", {
113
+ }), props.clearable && !!value && !props.readOnly && _react.default.createElement("div", {
112
114
  className: `${classPrefix}-clear`,
113
115
  onMouseDown: e => {
114
116
  e.preventDefault();
@@ -19,6 +19,8 @@ var _bound = require("../../utils/bound");
19
19
 
20
20
  var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
21
21
 
22
+ var _ahooks = require("ahooks");
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); }
@@ -49,7 +51,7 @@ const Wheel = (0, _react.memo)(props => {
49
51
  }
50
52
  }));
51
53
  const draggingRef = (0, _react.useRef)(false);
52
- (0, _react.useLayoutEffect)(() => {
54
+ (0, _ahooks.useIsomorphicLayoutEffect)(() => {
53
55
  if (draggingRef.current) return;
54
56
  if (!value) return;
55
57
  const targetIndex = column.findIndex(item => item.value === value);
@@ -60,7 +62,7 @@ const Wheel = (0, _react.memo)(props => {
60
62
  immediate: y.goal !== finalPosition
61
63
  });
62
64
  }, [value, column]);
63
- (0, _react.useLayoutEffect)(() => {
65
+ (0, _ahooks.useIsomorphicLayoutEffect)(() => {
64
66
  if (column.length === 0) {
65
67
  if (value !== null) {
66
68
  onSelect(null);
@@ -1,6 +1,12 @@
1
1
  .adm-selector {
2
- --color: var(--adm-color-text);
2
+ --color: #f5f5f5;
3
3
  --checked-color: #e7f1ff;
4
+ --text-color: var(--adm-color-text);
5
+ --checked-text-color: var(--adm-color-primary);
6
+ --border: none;
7
+ --checked-border: none;
8
+ --border-radius: 4px;
9
+ --padding: 16px 32px;
4
10
  overflow: hidden;
5
11
  font-size: 30px;
6
12
  line-height: 1.4;
@@ -11,11 +17,12 @@
11
17
  }
12
18
 
13
19
  .adm-selector-item {
14
- padding: 16px 32px;
20
+ padding: var(--padding);
15
21
  position: relative;
16
- background-color: #f5f5f5;
17
- border-radius: 4px;
18
- color: #333;
22
+ background-color: var(--color);
23
+ border: var(--border);
24
+ border-radius: var(--border-radius);
25
+ color: var(--text-color);
19
26
  opacity: 1;
20
27
  cursor: pointer;
21
28
  display: inline-block;
@@ -31,8 +38,9 @@
31
38
 
32
39
  .adm-selector-item-active,
33
40
  .adm-selector-item-multiple-active {
34
- color: var(--adm-color-primary);
41
+ color: var(--checked-text-color);
35
42
  background-color: var(--checked-color);
43
+ border: var(--checked-border);
36
44
  }
37
45
 
38
46
  .adm-selector-item .adm-selector-check-mark-wrapper {
@@ -16,5 +16,6 @@ export declare type SelectorProps<V> = {
16
16
  onChange?: (v: V[], extend: {
17
17
  items: SelectorOption<V>[];
18
18
  }) => void;
19
- } & NativeProps<'--checked-color'>;
19
+ showCheckMark?: boolean;
20
+ } & NativeProps<'--color' | '--checked-color' | '--text-color' | '--checked-text-color' | '--border' | '--checked-border' | '--border-radius' | '--padding'>;
20
21
  export declare const Selector: <V extends string | number>(p: SelectorProps<V>) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, any> | null) | (new (props: any) => React.Component<any, any, any>)>;
@@ -28,7 +28,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
28
28
  const classPrefix = `adm-selector`;
29
29
  const defaultProps = {
30
30
  multiple: false,
31
- defaultValue: []
31
+ defaultValue: [],
32
+ showCheckMark: true
32
33
  };
33
34
 
34
35
  const Selector = p => {
@@ -74,7 +75,7 @@ const Selector = p => {
74
75
  }
75
76
  }, option.label, option.description && _react.default.createElement("div", {
76
77
  className: `${classPrefix}-item-description`
77
- }, option.description), active && _react.default.createElement("div", {
78
+ }, option.description), active && props.showCheckMark && _react.default.createElement("div", {
78
79
  className: `${classPrefix}-check-mark-wrapper`
79
80
  }, _react.default.createElement(_checkMark.CheckMark, null)));
80
81
  });
@@ -212,7 +212,7 @@ const Swiper = (0, _react.forwardRef)((0, _stagedComponents.staged)((p, ref) =>
212
212
  swipeNext,
213
213
  swipePrev
214
214
  }));
215
- (0, _react.useLayoutEffect)(() => {
215
+ (0, _ahooks.useIsomorphicLayoutEffect)(() => {
216
216
  const maxIndex = validChildren.length - 1;
217
217
 
218
218
  if (current > maxIndex) {
@@ -163,7 +163,7 @@ const Tabs = p => {
163
163
  });
164
164
  }
165
165
 
166
- (0, _react.useLayoutEffect)(() => {
166
+ (0, _ahooks.useIsomorphicLayoutEffect)(() => {
167
167
  animate(true);
168
168
  }, []);
169
169
  (0, _ahooks.useUpdateLayoutEffect)(() => {
@@ -197,7 +197,7 @@ const Tabs = p => {
197
197
  trailing: true,
198
198
  leading: true
199
199
  });
200
- (0, _react.useLayoutEffect)(() => {
200
+ (0, _ahooks.useIsomorphicLayoutEffect)(() => {
201
201
  updateMask(true);
202
202
  }, []);
203
203
  return (0, _nativeProps.withNativeProps)(props, _react.default.createElement("div", {
@@ -17,6 +17,8 @@ var _classnames = _interopRequireDefault(require("classnames"));
17
17
 
18
18
  var _antdMobileIcons = require("antd-mobile-icons");
19
19
 
20
+ var _ahooks = require("ahooks");
21
+
20
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
23
 
22
24
  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,7 @@ const VirtualInput = (0, _react.forwardRef)((p, ref) => {
47
49
  content.scrollLeft = content.clientWidth;
48
50
  }
49
51
 
50
- (0, _react.useLayoutEffect)(() => {
52
+ (0, _ahooks.useIsomorphicLayoutEffect)(() => {
51
53
  scrollToEnd();
52
54
  }, [value]);
53
55
  (0, _react.useEffect)(() => {
@@ -12,7 +12,7 @@ const defaultRoot = _canUseDom.canUseDom ? window : undefined;
12
12
 
13
13
  function isElement(node) {
14
14
  const ELEMENT_NODE_TYPE = 1;
15
- return node.tagName !== 'HTML' && node.tagName !== 'BODY' && node.nodeType === ELEMENT_NODE_TYPE;
15
+ return node.nodeType === ELEMENT_NODE_TYPE;
16
16
  } // https://github.com/youzan/vant/issues/3823
17
17
 
18
18
 
@@ -10,7 +10,7 @@ var _react = require("react");
10
10
  function useRefState(initialState) {
11
11
  const [state, setState] = (0, _react.useState)(initialState);
12
12
  const ref = (0, _react.useRef)(state);
13
- (0, _react.useLayoutEffect)(() => {
13
+ (0, _react.useEffect)(() => {
14
14
  ref.current = state;
15
15
  }, [state]);
16
16
  return [state, setState, ref];
@@ -5,13 +5,11 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.useResizeEffect = useResizeEffect;
7
7
 
8
- var _react = require("react");
9
-
10
8
  var _ahooks = require("ahooks");
11
9
 
12
10
  function useResizeEffect(effect, targetRef) {
13
11
  const fn = (0, _ahooks.useMemoizedFn)(effect);
14
- (0, _react.useLayoutEffect)(() => {
12
+ (0, _ahooks.useIsomorphicLayoutEffect)(() => {
15
13
  const target = targetRef.current;
16
14
  if (!target) return;
17
15
 
@@ -5,8 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.useTabListScroll = void 0;
7
7
 
8
- var _react = require("react");
9
-
10
8
  var _web = require("@react-spring/web");
11
9
 
12
10
  var _useMutationEffect = require("./use-mutation-effect");
@@ -49,7 +47,7 @@ const useTabListScroll = (targetRef, activeIndex) => {
49
47
  });
50
48
  }
51
49
 
52
- (0, _react.useLayoutEffect)(() => {
50
+ (0, _ahooks.useIsomorphicLayoutEffect)(() => {
53
51
  animate(true);
54
52
  }, []);
55
53
  (0, _ahooks.useUpdateLayoutEffect)(() => {
@@ -12,9 +12,9 @@
12
12
  display: inline-block;
13
13
  box-sizing: border-box;
14
14
  height: auto;
15
- padding: 16px 24px;
15
+ padding: 14px 24px;
16
16
  margin: 0;
17
- font-size: 30px;
17
+ font-size: 34px;
18
18
  line-height: 1.4;
19
19
  text-align: center;
20
20
  border: var(--border-width) var(--border-style) var(--border-color);
@@ -1,4 +1,4 @@
1
- import React, { useLayoutEffect, useMemo, useState } from 'react';
1
+ import React, { useMemo, useState } from 'react';
2
2
  import { withNativeProps } from '../../utils/native-props';
3
3
  import dayjs from 'dayjs';
4
4
  import classNames from 'classnames';
@@ -7,6 +7,7 @@ import { ArrowLeft } from './arrow-left';
7
7
  import { ArrowLeftDouble } from './arrow-left-double';
8
8
  import { useConfig } from '../config-provider';
9
9
  import isoWeek from 'dayjs/plugin/isoWeek';
10
+ import { useIsomorphicLayoutEffect } from 'ahooks';
10
11
  dayjs.extend(isoWeek);
11
12
  const classPrefix = 'adm-calendar';
12
13
  const defaultProps = {
@@ -65,7 +66,7 @@ export const Calendar = p => {
65
66
  }, [props.selectionMode, props.value, props.defaultValue]);
66
67
  const [begin, setBegin] = useState(null);
67
68
  const [end, setEnd] = useState(null);
68
- useLayoutEffect(() => {
69
+ useIsomorphicLayoutEffect(() => {
69
70
  setBegin(dateRange[0] ? dayjs(dateRange[0]) : null);
70
71
  setEnd(dateRange[1] ? dayjs(dateRange[1]) : null);
71
72
  }, [dateRange[0], dateRange[1]]);
@@ -1,7 +1,8 @@
1
- import React, { useLayoutEffect, useRef, useState } from 'react';
1
+ import React, { useRef, useState } from 'react';
2
2
  import { mergeProps } from '../../utils/with-default-props';
3
3
  import { withNativeProps } from '../../utils/native-props';
4
4
  import { useResizeEffect } from '../../utils/use-resize-effect';
5
+ import { useIsomorphicLayoutEffect } from 'ahooks';
5
6
  const classPrefix = `adm-ellipsis`;
6
7
  const defaultProps = {
7
8
  direction: 'end',
@@ -113,7 +114,7 @@ export const Ellipsis = p => {
113
114
  }
114
115
 
115
116
  useResizeEffect(calcEllipsised, rootRef);
116
- useLayoutEffect(() => {
117
+ useIsomorphicLayoutEffect(() => {
117
118
  calcEllipsised();
118
119
  }, [props.content, props.direction, props.rows, props.expandText, props.collapseText]);
119
120
  const expandActionElement = exceeded && props.expandText ? React.createElement("a", {
@@ -1,17 +1,19 @@
1
1
  import React, { ReactNode } from 'react';
2
2
  import { NativeProps } from '../../utils/native-props';
3
- export declare type FloatingPanelProps = {
4
- anchors: number[];
5
- children: ReactNode;
6
- onHeightChange?: (height: number, animating: boolean) => void;
7
- } & NativeProps<'--border-radius' | '--z-index'>;
8
3
  export declare type FloatingPanelRef = {
9
4
  setHeight: (height: number, options?: {
10
5
  immediate?: boolean;
11
6
  }) => void;
12
7
  };
8
+ export declare type FloatingPanelProps = {
9
+ anchors: number[];
10
+ children: ReactNode;
11
+ onHeightChange?: (height: number, animating: boolean) => void;
12
+ handleDraggingOfContent?: boolean;
13
+ } & NativeProps<'--border-radius' | '--z-index'>;
13
14
  export declare const FloatingPanel: React.ForwardRefExoticComponent<{
14
15
  anchors: number[];
15
16
  children: ReactNode;
16
17
  onHeightChange?: ((height: number, animating: boolean) => void) | undefined;
18
+ handleDraggingOfContent?: boolean | undefined;
17
19
  } & NativeProps<"--z-index" | "--border-radius"> & React.RefAttributes<FloatingPanelRef>>;
@@ -4,9 +4,15 @@ import { useDrag } from '@use-gesture/react';
4
4
  import { useSpring, animated } from '@react-spring/web';
5
5
  import { supportsPassive } from '../../utils/supports-passive';
6
6
  import { nearest } from '../../utils/nearest';
7
- export const FloatingPanel = forwardRef((props, ref) => {
7
+ import { mergeProps } from '../../utils/with-default-props';
8
+ import { useLockScroll } from '../../utils/use-lock-scroll';
9
+ const defaultProps = {
10
+ handleDraggingOfContent: true
11
+ };
12
+ export const FloatingPanel = forwardRef((p, ref) => {
8
13
  var _a;
9
14
 
15
+ const props = mergeProps(defaultProps, p);
10
16
  const {
11
17
  anchors
12
18
  } = props;
@@ -44,6 +50,7 @@ export const FloatingPanel = forwardRef((props, ref) => {
44
50
  if (header === target || (header === null || header === void 0 ? void 0 : header.contains(target))) {
45
51
  pullingRef.current = true;
46
52
  } else {
53
+ if (!props.handleDraggingOfContent) return;
47
54
  const reachedTop = y.goal <= bounds.top;
48
55
  const content = contentRef.current;
49
56
  if (!content) return;
@@ -101,6 +108,7 @@ export const FloatingPanel = forwardRef((props, ref) => {
101
108
  });
102
109
  }
103
110
  }), [api]);
111
+ useLockScroll(elementRef, true);
104
112
  return withNativeProps(props, React.createElement(animated.div, {
105
113
  ref: elementRef,
106
114
  className: 'adm-floating-panel',
@@ -7,7 +7,7 @@ import type { FormLayout } from './index';
7
7
  declare type RenderChildren<Values = any> = (form: FormInstance<Values>) => React.ReactNode;
8
8
  declare type ChildrenType<Values = any> = RenderChildren<Values> | React.ReactNode;
9
9
  declare type RcFieldProps = Omit<FieldProps, 'children'>;
10
- export declare type FormItemProps = Pick<RcFieldProps, 'dependencies' | 'valuePropName' | 'name' | 'rules' | 'messageVariables' | 'trigger' | 'validateTrigger' | 'shouldUpdate'> & Pick<ListItemProps, 'style' | 'onClick' | 'extra' | 'arrow'> & {
10
+ export declare type FormItemProps = Pick<RcFieldProps, 'dependencies' | 'valuePropName' | 'name' | 'rules' | 'messageVariables' | 'trigger' | 'validateTrigger' | 'shouldUpdate' | 'initialValue'> & Pick<ListItemProps, 'style' | 'onClick' | 'extra' | 'arrow'> & {
11
11
  label?: React.ReactNode;
12
12
  help?: React.ReactNode;
13
13
  hasFeedback?: boolean;
@@ -1,11 +1,11 @@
1
1
  import { __awaiter } from "tslib";
2
- import React, { useLayoutEffect, useRef, useState } from 'react';
2
+ import React, { useRef, useState } from 'react';
3
3
  import { AddOutline } from 'antd-mobile-icons';
4
4
  import { mergeProps } from '../../utils/with-default-props';
5
5
  import ImageViewer from '../image-viewer';
6
6
  import PreviewItem from './preview-item';
7
7
  import { usePropsValue } from '../../utils/use-props-value';
8
- import { useMemoizedFn, useUnmount } from 'ahooks';
8
+ import { useIsomorphicLayoutEffect, useMemoizedFn, useUnmount } from 'ahooks';
9
9
  import Space from '../space';
10
10
  import { withNativeProps } from '../../utils/native-props';
11
11
  const classPrefix = `adm-image-uploader`;
@@ -26,7 +26,7 @@ export const ImageUploader = p => {
26
26
  setValue(updater(value));
27
27
  });
28
28
  const [tasks, setTasks] = useState([]);
29
- useLayoutEffect(() => {
29
+ useIsomorphicLayoutEffect(() => {
30
30
  setTasks(prev => prev.filter(task => {
31
31
  if (task.url === undefined) return true;
32
32
  return !value.some(fileItem => fileItem.url === task.url);
@@ -1,4 +1,4 @@
1
- import React, { forwardRef } from 'react';
1
+ import React, { forwardRef, useImperativeHandle, useRef, useState } from 'react';
2
2
  import { mergeProps } from '../../utils/with-default-props';
3
3
  import { renderToContainer } from '../../utils/render-to-container';
4
4
  import Mask from '../mask';
@@ -35,6 +35,16 @@ const multiDefaultProps = Object.assign(Object.assign({}, defaultProps), {
35
35
  });
36
36
  export const MultiImageViewer = forwardRef((p, ref) => {
37
37
  const props = mergeProps(multiDefaultProps, p);
38
+ const [defaultIndex, setDefaultIndex] = useState(props.defaultIndex);
39
+ const slidesRef = useRef(null);
40
+ useImperativeHandle(ref, () => ({
41
+ swipeTo: (index, immediate) => {
42
+ var _a;
43
+
44
+ setDefaultIndex(index);
45
+ (_a = slidesRef.current) === null || _a === void 0 ? void 0 : _a.swipeTo(index, immediate);
46
+ }
47
+ }));
38
48
  const node = React.createElement(Mask, {
39
49
  visible: props.visible,
40
50
  disableBodyScroll: false,
@@ -43,8 +53,8 @@ export const MultiImageViewer = forwardRef((p, ref) => {
43
53
  }, React.createElement("div", {
44
54
  className: `${classPrefix}-content`
45
55
  }, props.images && React.createElement(Slides, {
46
- ref: ref,
47
- defaultIndex: props.defaultIndex,
56
+ ref: slidesRef,
57
+ defaultIndex: defaultIndex,
48
58
  onIndexChange: props.onIndexChange,
49
59
  images: props.images,
50
60
  onTap: () => {
@@ -109,6 +109,7 @@ export const Slide = props => {
109
109
  }
110
110
  }, React.createElement("img", {
111
111
  src: props.image,
112
- draggable: false
112
+ draggable: false,
113
+ alt: props.image
113
114
  }))));
114
115
  };
@@ -7,6 +7,6 @@ export declare type SlidesType = {
7
7
  onIndexChange?: (index: number) => void;
8
8
  };
9
9
  export declare type SlidesRef = {
10
- swipeTo: (index: number, immediate: boolean) => void;
10
+ swipeTo: (index: number, immediate?: boolean) => void;
11
11
  };
12
12
  export declare const Slides: React.ForwardRefExoticComponent<SlidesType & React.RefAttributes<SlidesRef>>;