@arco-design/mobile-react 2.29.3 → 2.29.5

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 (100) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.en-US.md +2 -2
  3. package/README.md +2 -2
  4. package/cjs/action-sheet/index.d.ts +2 -2
  5. package/cjs/dialog/index.d.ts +2 -2
  6. package/cjs/image-picker/index.js +14 -6
  7. package/cjs/image-preview/index.d.ts +2 -2
  8. package/cjs/image-preview/index.js +5 -3
  9. package/cjs/index.d.ts +5 -5
  10. package/cjs/index.js +16 -16
  11. package/cjs/load-more/index.d.ts +11 -0
  12. package/cjs/load-more/index.js +18 -4
  13. package/cjs/masking/index.d.ts +2 -2
  14. package/cjs/picker/index.js +2 -9
  15. package/cjs/picker-view/components/cascader.d.ts +1 -0
  16. package/cjs/picker-view/components/cascader.js +8 -1
  17. package/cjs/picker-view/components/picker-cell.d.ts +1 -0
  18. package/cjs/picker-view/components/picker-cell.js +8 -1
  19. package/cjs/picker-view/index.js +15 -9
  20. package/cjs/popup/index.d.ts +2 -2
  21. package/cjs/popup-swiper/index.d.ts +2 -2
  22. package/cjs/pull-refresh/android-pull-refresh.js +12 -20
  23. package/cjs/pull-refresh/hooks.js +2 -2
  24. package/cjs/pull-refresh/style/css/index.css +0 -1
  25. package/cjs/pull-refresh/style/index.less +0 -1
  26. package/cjs/search-bar/style/css/index.css +2 -0
  27. package/cjs/search-bar/style/index.less +93 -91
  28. package/cjs/style.d.ts +5 -5
  29. package/cjs/style.js +8 -8
  30. package/cjs/tabs/index.js +4 -1
  31. package/cjs/tabs/tab-pane.js +5 -2
  32. package/cjs/toast/index.d.ts +12 -12
  33. package/dist/index.js +2454 -2419
  34. package/dist/index.min.js +5 -5
  35. package/dist/style.css +505 -504
  36. package/dist/style.min.css +1 -1
  37. package/esm/action-sheet/index.d.ts +2 -2
  38. package/esm/dialog/index.d.ts +2 -2
  39. package/esm/image-picker/index.js +13 -6
  40. package/esm/image-preview/index.d.ts +2 -2
  41. package/esm/image-preview/index.js +5 -3
  42. package/esm/index.d.ts +5 -5
  43. package/esm/index.js +5 -5
  44. package/esm/load-more/index.d.ts +11 -0
  45. package/esm/load-more/index.js +18 -4
  46. package/esm/masking/index.d.ts +2 -2
  47. package/esm/picker/index.js +4 -10
  48. package/esm/picker-view/components/cascader.d.ts +1 -0
  49. package/esm/picker-view/components/cascader.js +8 -1
  50. package/esm/picker-view/components/picker-cell.d.ts +1 -0
  51. package/esm/picker-view/components/picker-cell.js +8 -1
  52. package/esm/picker-view/index.js +16 -10
  53. package/esm/popup/index.d.ts +2 -2
  54. package/esm/popup-swiper/index.d.ts +2 -2
  55. package/esm/pull-refresh/android-pull-refresh.js +13 -22
  56. package/esm/pull-refresh/hooks.js +2 -2
  57. package/esm/pull-refresh/style/css/index.css +0 -1
  58. package/esm/pull-refresh/style/index.less +0 -1
  59. package/esm/search-bar/style/css/index.css +2 -0
  60. package/esm/search-bar/style/index.less +93 -91
  61. package/esm/style.d.ts +5 -5
  62. package/esm/style.js +5 -5
  63. package/esm/tabs/index.js +4 -1
  64. package/esm/tabs/tab-pane.js +6 -3
  65. package/esm/toast/index.d.ts +12 -12
  66. package/package.json +3 -3
  67. package/tokens/app/arcodesign/default/css-variables.less +2 -0
  68. package/tokens/app/arcodesign/default/index.d.ts +2 -0
  69. package/tokens/app/arcodesign/default/index.js +2 -0
  70. package/tokens/app/arcodesign/default/index.json +24 -0
  71. package/tokens/app/arcodesign/default/index.less +2 -0
  72. package/umd/action-sheet/index.d.ts +2 -2
  73. package/umd/dialog/index.d.ts +2 -2
  74. package/umd/image-picker/index.js +16 -10
  75. package/umd/image-preview/index.d.ts +2 -2
  76. package/umd/image-preview/index.js +5 -3
  77. package/umd/index.d.ts +5 -5
  78. package/umd/index.js +14 -14
  79. package/umd/load-more/index.d.ts +11 -0
  80. package/umd/load-more/index.js +18 -4
  81. package/umd/masking/index.d.ts +2 -2
  82. package/umd/picker/index.js +2 -9
  83. package/umd/picker-view/components/cascader.d.ts +1 -0
  84. package/umd/picker-view/components/cascader.js +8 -1
  85. package/umd/picker-view/components/picker-cell.d.ts +1 -0
  86. package/umd/picker-view/components/picker-cell.js +8 -1
  87. package/umd/picker-view/index.js +15 -9
  88. package/umd/popup/index.d.ts +2 -2
  89. package/umd/popup-swiper/index.d.ts +2 -2
  90. package/umd/pull-refresh/android-pull-refresh.js +15 -24
  91. package/umd/pull-refresh/hooks.js +2 -2
  92. package/umd/pull-refresh/style/css/index.css +0 -1
  93. package/umd/pull-refresh/style/index.less +0 -1
  94. package/umd/search-bar/style/css/index.css +2 -0
  95. package/umd/search-bar/style/index.less +93 -91
  96. package/umd/style.d.ts +5 -5
  97. package/umd/style.js +2 -2
  98. package/umd/tabs/index.js +4 -1
  99. package/umd/tabs/tab-pane.js +5 -2
  100. package/umd/toast/index.d.ts +12 -12
@@ -7,6 +7,7 @@ import { IconClose } from '../icon';
7
7
  import Image from '../image';
8
8
  import Grid from '../grid';
9
9
  import AddIcon from './add-icon';
10
+ import { useLatestRef } from '../_helpers';
10
11
  export * from './type';
11
12
  var ImagePicker = /*#__PURE__*/forwardRef(function (props, ref) {
12
13
  var _props$className = props.className,
@@ -52,7 +53,7 @@ var ImagePicker = /*#__PURE__*/forwardRef(function (props, ref) {
52
53
  onDeleteClick = props.onDeleteClick;
53
54
  var domRef = useRef(null);
54
55
  var fileRef = useRef(null);
55
- var cacheRef = useRef([]);
56
+ var cacheRef = useLatestRef(images);
56
57
  useImperativeHandle(ref, function () {
57
58
  return {
58
59
  dom: domRef.current
@@ -119,7 +120,7 @@ var ImagePicker = /*#__PURE__*/forwardRef(function (props, ref) {
119
120
  file: files[index]
120
121
  };
121
122
  });
122
- cacheRef.current = [].concat(images, res);
123
+ cacheRef.current = [].concat(cacheRef.current, res);
123
124
  onChange([].concat(cacheRef.current)); // 执行upload
124
125
 
125
126
  if (typeof upload === 'function') {
@@ -132,15 +133,21 @@ var ImagePicker = /*#__PURE__*/forwardRef(function (props, ref) {
132
133
  var file = _ref2.file;
133
134
  return file === _file;
134
135
  });
135
- cacheRef.current[index] = _extends({}, cacheRef.current[index], data, {
136
- status: undefined
137
- });
136
+
137
+ if (index !== -1) {
138
+ cacheRef.current[index] = _extends({}, cacheRef.current[index], data, {
139
+ status: undefined
140
+ });
141
+ }
138
142
  }).catch(function () {
139
143
  var index = cacheRef.current.findIndex(function (_ref3) {
140
144
  var file = _ref3.file;
141
145
  return file === _file;
142
146
  });
143
- cacheRef.current[index].status = 'error';
147
+
148
+ if (index !== -1) {
149
+ cacheRef.current[index].status = 'error';
150
+ }
144
151
  }).finally(function () {
145
152
  onChange([].concat(cacheRef.current));
146
153
  });
@@ -274,9 +274,9 @@ declare const _default: React.ForwardRefExoticComponent<ImagePreviewProps & Reac
274
274
  * @param {ImagePreviewProps} config configuration
275
275
  * @returns {{ close: () => void; update: (newConfig: ImagePreviewProps) => void; }}
276
276
  */
277
- open: (config: Pick<import("../context-provider").WithGlobalContext<ImagePreviewProps & React.RefAttributes<ImagePreviewRef>>, "style" | "ref" | "key" | "context" | "className" | "swipeable" | "lazyloadCount" | "onChange" | "onAfterChange" | "onTouchStart" | "onTouchMove" | "onTouchEnd" | "getContainer" | "loadingArea" | "onClose" | "fit" | "errorArea" | "showLoading" | "showError" | "retryTime" | "staticLabel" | "animateDurationSlide" | "loop" | "renderIndicator" | "indicatorPos" | "showIndicator" | "hideSingleIndicator" | "spaceBetween" | "percentToChange" | "distanceToChange" | "speedToChange" | "extra" | "images" | "openIndex" | "displayDuration" | "replaceFallbackWhenLoaded" | "noselect" | "scrollBezier" | "swipeToClose" | "getMinScale" | "getMaxScale" | "getDoubleClickScale" | "getThumbBounds" | "onImageClick" | "onImageDoubleClick" | "onImageLongTap">, context?: import("../context-provider").GlobalContextParams | undefined) => {
277
+ open: (config: Pick<import("../context-provider").WithGlobalContext<ImagePreviewProps & React.RefAttributes<ImagePreviewRef>>, "style" | "ref" | "key" | "context" | "className" | "swipeable" | "lazyloadCount" | "onChange" | "onAfterChange" | "onTouchStart" | "onTouchMove" | "onTouchEnd" | "getContainer" | "onClose" | "fit" | "loadingArea" | "errorArea" | "showLoading" | "showError" | "retryTime" | "staticLabel" | "animateDurationSlide" | "loop" | "renderIndicator" | "indicatorPos" | "showIndicator" | "hideSingleIndicator" | "spaceBetween" | "percentToChange" | "distanceToChange" | "speedToChange" | "extra" | "images" | "openIndex" | "displayDuration" | "replaceFallbackWhenLoaded" | "noselect" | "scrollBezier" | "swipeToClose" | "getMinScale" | "getMaxScale" | "getDoubleClickScale" | "getThumbBounds" | "onImageClick" | "onImageDoubleClick" | "onImageLongTap">, context?: import("../context-provider").GlobalContextParams | undefined) => {
278
278
  close: () => void;
279
- update: (newConfig: Pick<import("../context-provider").WithGlobalContext<ImagePreviewProps & React.RefAttributes<ImagePreviewRef>>, "style" | "ref" | "key" | "context" | "className" | "swipeable" | "lazyloadCount" | "onChange" | "onAfterChange" | "onTouchStart" | "onTouchMove" | "onTouchEnd" | "getContainer" | "loadingArea" | "onClose" | "fit" | "errorArea" | "showLoading" | "showError" | "retryTime" | "staticLabel" | "animateDurationSlide" | "loop" | "renderIndicator" | "indicatorPos" | "showIndicator" | "hideSingleIndicator" | "spaceBetween" | "percentToChange" | "distanceToChange" | "speedToChange" | "extra" | "images" | "openIndex" | "displayDuration" | "replaceFallbackWhenLoaded" | "noselect" | "scrollBezier" | "swipeToClose" | "getMinScale" | "getMaxScale" | "getDoubleClickScale" | "getThumbBounds" | "onImageClick" | "onImageDoubleClick" | "onImageLongTap">) => void;
279
+ update: (newConfig: Pick<import("../context-provider").WithGlobalContext<ImagePreviewProps & React.RefAttributes<ImagePreviewRef>>, "style" | "ref" | "key" | "context" | "className" | "swipeable" | "lazyloadCount" | "onChange" | "onAfterChange" | "onTouchStart" | "onTouchMove" | "onTouchEnd" | "getContainer" | "onClose" | "fit" | "loadingArea" | "errorArea" | "showLoading" | "showError" | "retryTime" | "staticLabel" | "animateDurationSlide" | "loop" | "renderIndicator" | "indicatorPos" | "showIndicator" | "hideSingleIndicator" | "spaceBetween" | "percentToChange" | "distanceToChange" | "speedToChange" | "extra" | "images" | "openIndex" | "displayDuration" | "replaceFallbackWhenLoaded" | "noselect" | "scrollBezier" | "swipeToClose" | "getMinScale" | "getMaxScale" | "getDoubleClickScale" | "getThumbBounds" | "onImageClick" | "onImageDoubleClick" | "onImageLongTap">) => void;
280
280
  };
281
281
  };
282
282
  /**
@@ -624,9 +624,11 @@ var ImagePreview = /*#__PURE__*/forwardRef(function (props, ref) {
624
624
 
625
625
 
626
626
  function setImagesStatusByIndex(index, data) {
627
- var newStatus = imagesStatusRef.current.slice();
628
- newStatus[index] = _extends({}, newStatus[index] || {}, data);
629
- setImagesStatus(newStatus);
627
+ setImagesStatus(function (current) {
628
+ var newStatus = current.slice();
629
+ newStatus[index] = _extends({}, newStatus[index] || {}, data);
630
+ return newStatus;
631
+ });
630
632
  }
631
633
  /**
632
634
  * 缩略图放大过渡动画设置
package/esm/index.d.ts CHANGED
@@ -1,12 +1,13 @@
1
1
  export { default as Tabs } from './tabs';
2
2
  export { default as Sticky } from './sticky';
3
- export { default as LoadMore } from './load-more';
4
- export { default as Cell } from './cell';
3
+ export { default as Portal } from './portal';
4
+ export { default as Toast } from './toast';
5
5
  export { default as ActionSheet } from './action-sheet';
6
6
  export { default as Avatar } from './avatar';
7
7
  export { default as Badge } from './badge';
8
8
  export { default as Button } from './button';
9
9
  export { default as Carousel } from './carousel';
10
+ export { default as Cell } from './cell';
10
11
  export { default as Checkbox } from './checkbox';
11
12
  export { default as CircleProgress } from './circle-progress';
12
13
  export { default as Collapse } from './collapse';
@@ -26,6 +27,7 @@ export { default as ImagePreview } from './image-preview';
26
27
  export { default as IndexBar } from './index-bar';
27
28
  export { default as Input } from './input';
28
29
  export { default as Keyboard } from './keyboard';
30
+ export { default as LoadMore } from './load-more';
29
31
  export { default as Loading } from './loading';
30
32
  export { default as Masking } from './masking';
31
33
  export { default as NavBar } from './nav-bar';
@@ -37,14 +39,13 @@ export { default as PickerView } from './picker-view';
37
39
  export { default as Popover } from './popover';
38
40
  export { default as Popup } from './popup';
39
41
  export { default as PopupSwiper } from './popup-swiper';
40
- export { default as Portal } from './portal';
41
42
  export { default as Progress } from './progress';
42
43
  export { default as PullRefresh } from './pull-refresh';
43
44
  export { default as Radio } from './radio';
44
45
  export { default as Rate } from './rate';
45
46
  export { default as SearchBar } from './search-bar';
46
- export { default as Skeleton } from './skeleton';
47
47
  export { default as ShowMonitor } from './show-monitor';
48
+ export { default as Skeleton } from './skeleton';
48
49
  export { default as Slider } from './slider';
49
50
  export { default as Stepper } from './stepper';
50
51
  export { default as Steps } from './steps';
@@ -54,5 +55,4 @@ export { default as Switch } from './switch';
54
55
  export { default as TabBar } from './tab-bar';
55
56
  export { default as Tag } from './tag';
56
57
  export { default as Textarea } from './textarea';
57
- export { default as Toast } from './toast';
58
58
  export { default as Transition } from './transition';
package/esm/index.js CHANGED
@@ -1,12 +1,13 @@
1
1
  export { default as Tabs } from './tabs';
2
2
  export { default as Sticky } from './sticky';
3
- export { default as LoadMore } from './load-more';
4
- export { default as Cell } from './cell';
3
+ export { default as Portal } from './portal';
4
+ export { default as Toast } from './toast';
5
5
  export { default as ActionSheet } from './action-sheet';
6
6
  export { default as Avatar } from './avatar';
7
7
  export { default as Badge } from './badge';
8
8
  export { default as Button } from './button';
9
9
  export { default as Carousel } from './carousel';
10
+ export { default as Cell } from './cell';
10
11
  export { default as Checkbox } from './checkbox';
11
12
  export { default as CircleProgress } from './circle-progress';
12
13
  export { default as Collapse } from './collapse';
@@ -26,6 +27,7 @@ export { default as ImagePreview } from './image-preview';
26
27
  export { default as IndexBar } from './index-bar';
27
28
  export { default as Input } from './input';
28
29
  export { default as Keyboard } from './keyboard';
30
+ export { default as LoadMore } from './load-more';
29
31
  export { default as Loading } from './loading';
30
32
  export { default as Masking } from './masking';
31
33
  export { default as NavBar } from './nav-bar';
@@ -37,14 +39,13 @@ export { default as PickerView } from './picker-view';
37
39
  export { default as Popover } from './popover';
38
40
  export { default as Popup } from './popup';
39
41
  export { default as PopupSwiper } from './popup-swiper';
40
- export { default as Portal } from './portal';
41
42
  export { default as Progress } from './progress';
42
43
  export { default as PullRefresh } from './pull-refresh';
43
44
  export { default as Radio } from './radio';
44
45
  export { default as Rate } from './rate';
45
46
  export { default as SearchBar } from './search-bar';
46
- export { default as Skeleton } from './skeleton';
47
47
  export { default as ShowMonitor } from './show-monitor';
48
+ export { default as Skeleton } from './skeleton';
48
49
  export { default as Slider } from './slider';
49
50
  export { default as Stepper } from './stepper';
50
51
  export { default as Steps } from './steps';
@@ -54,5 +55,4 @@ export { default as Switch } from './switch';
54
55
  export { default as TabBar } from './tab-bar';
55
56
  export { default as Tag } from './tag';
56
57
  export { default as Textarea } from './textarea';
57
- export { default as Toast } from './toast';
58
58
  export { default as Transition } from './transition';
@@ -107,6 +107,12 @@ export interface LoadMoreProps {
107
107
  * @default true
108
108
  */
109
109
  getDataAtFirst?: boolean;
110
+ /**
111
+ * 当 getDataAtFirst 值为 false 且数据不满一屏时是否触发一次请求,trigger=scroll时有效
112
+ * @en Whether to trigger a request when getDataAtFirst equals false and the data is not full of one screen, valid when trigger=scroll
113
+ * @default false
114
+ */
115
+ getDataWhenNoScrollAtFirst?: boolean;
110
116
  /**
111
117
  * 状态改变时回调
112
118
  * @en Callback when state changes
@@ -134,6 +140,11 @@ export interface LoadMoreRef {
134
140
  * @en Change component state manually
135
141
  */
136
142
  changeStatus: (status: LoadMoreStatus, scene?: string) => void;
143
+ /**
144
+ * 判断是否滚动到底部并手动触发数据获取
145
+ * @en Determine whether to scroll to the bottom and manually trigger data acquisition
146
+ */
147
+ getDataWithEndReachCheck: () => void;
137
148
  }
138
149
  /**
139
150
  * 上拉加载组件,支持`scroll`和`click`两种触发加载方式,支持滚动监听。支持受控与不受控两种形式。<br>如果引入组件后发现仅触发了初始的`getData`,请确认是否在`getData`方法内没有调用`callback`移除 loading 状态,且未设置`blockWhenLoading`属性为 false。
@@ -40,7 +40,9 @@ var LoadMore = /*#__PURE__*/forwardRef(function (props, ref) {
40
40
  blockWhenLoading = _props$blockWhenLoadi === void 0 ? true : _props$blockWhenLoadi,
41
41
  onStatusChange = props.onStatusChange,
42
42
  onClick = props.onClick,
43
- onEndReached = props.onEndReached;
43
+ onEndReached = props.onEndReached,
44
+ _props$getDataWhenNoS = props.getDataWhenNoScrollAtFirst,
45
+ getDataWhenNoScrollAtFirst = _props$getDataWhenNoS === void 0 ? false : _props$getDataWhenNoS;
44
46
  var domRef = useRef(null);
45
47
  var requestAtFirst = trigger === 'scroll' ? getDataAtFirst : false;
46
48
 
@@ -85,10 +87,14 @@ var LoadMore = /*#__PURE__*/forwardRef(function (props, ref) {
85
87
  }
86
88
  }, [nowStatus]);
87
89
  useEffect(function () {
88
- if (requestAtFirst && !disabled) {
89
- if (statusRef.current === 'prepare') {
90
+ if (requestAtFirst) {
91
+ if (statusRef.current === 'prepare' && !disabled) {
90
92
  triggerGetData('requestAtFirst');
91
93
  }
94
+ } else {
95
+ if (trigger === 'scroll' && nowStatus === 'prepare' && checkNeedTrigger(0, threshold) && !disabled && getDataWhenNoScrollAtFirst) {
96
+ triggerGetData('pageEnd');
97
+ }
92
98
  }
93
99
  }, [trigger, disabled]);
94
100
  var handleContainerScroll = useCallback(function () {
@@ -126,10 +132,18 @@ var LoadMore = /*#__PURE__*/forwardRef(function (props, ref) {
126
132
  }
127
133
  };
128
134
  }, [trigger, disabled, getScrollContainer, handleContainerScroll, throttle]);
135
+
136
+ var getDataWithEndReachCheck = function getDataWithEndReachCheck() {
137
+ if (checkNeedTrigger(0, threshold)) {
138
+ triggerGetData('pageEnd');
139
+ }
140
+ };
141
+
129
142
  useImperativeHandle(ref, function () {
130
143
  return {
131
144
  dom: domRef.current,
132
- changeStatus: changeStatus
145
+ changeStatus: changeStatus,
146
+ getDataWithEndReachCheck: getDataWithEndReachCheck
133
147
  };
134
148
  }, [changeStatus]);
135
149
 
@@ -205,11 +205,11 @@ declare const _default: React.ForwardRefExoticComponent<MaskingProps & React.Ref
205
205
  * @param {MaskingProps} config Configuration
206
206
  * @returns {{ close: () => void; update: (newConfig: MaskingProps) => void; }}
207
207
  */
208
- open: (config: Pick<import("../context-provider").WithGlobalContext<MaskingProps & React.RefAttributes<MaskingRef>>, "children" | "ref" | "key" | "context" | "className" | "getScrollContainer" | "onTouchMove" | "getContainer" | "mountOnEnter" | "unmountOnExit" | "onClose" | "contentAtCenter" | "maskClass" | "maskStyle" | "contentClass" | "contentStyle" | "maskTransitionType" | "contentTransitionType" | "maskTransitionTimeout" | "contentTransitionTimeout" | "maskClosable" | "animatingClosable" | "orientationDirection" | "preventBodyScroll" | "initialBodyOverflow" | "gestureOutOfControl" | "onOpen" | "onMaskClick" | "onPreventTouchMove"> & {
208
+ open: (config: Pick<import("../context-provider").WithGlobalContext<MaskingProps & React.RefAttributes<MaskingRef>>, "children" | "ref" | "key" | "context" | "className" | "getScrollContainer" | "onTouchMove" | "getContainer" | "mountOnEnter" | "unmountOnExit" | "onClose" | "initialBodyOverflow" | "contentAtCenter" | "maskClass" | "maskStyle" | "contentClass" | "contentStyle" | "maskTransitionType" | "contentTransitionType" | "maskTransitionTimeout" | "contentTransitionTimeout" | "maskClosable" | "animatingClosable" | "orientationDirection" | "preventBodyScroll" | "gestureOutOfControl" | "onOpen" | "onMaskClick" | "onPreventTouchMove"> & {
209
209
  key?: string | undefined;
210
210
  }, context?: import("../context-provider").GlobalContextParams | undefined) => {
211
211
  close: () => void;
212
- update: (newConfig: Pick<import("../context-provider").WithGlobalContext<MaskingProps & React.RefAttributes<MaskingRef>>, "children" | "ref" | "key" | "context" | "className" | "getScrollContainer" | "onTouchMove" | "getContainer" | "mountOnEnter" | "unmountOnExit" | "onClose" | "contentAtCenter" | "maskClass" | "maskStyle" | "contentClass" | "contentStyle" | "maskTransitionType" | "contentTransitionType" | "maskTransitionTimeout" | "contentTransitionTimeout" | "maskClosable" | "animatingClosable" | "orientationDirection" | "preventBodyScroll" | "initialBodyOverflow" | "gestureOutOfControl" | "onOpen" | "onMaskClick" | "onPreventTouchMove"> & {
212
+ update: (newConfig: Pick<import("../context-provider").WithGlobalContext<MaskingProps & React.RefAttributes<MaskingRef>>, "children" | "ref" | "key" | "context" | "className" | "getScrollContainer" | "onTouchMove" | "getContainer" | "mountOnEnter" | "unmountOnExit" | "onClose" | "initialBodyOverflow" | "contentAtCenter" | "maskClass" | "maskStyle" | "contentClass" | "contentStyle" | "maskTransitionType" | "contentTransitionType" | "maskTransitionTimeout" | "contentTransitionTimeout" | "maskClosable" | "animatingClosable" | "orientationDirection" | "preventBodyScroll" | "gestureOutOfControl" | "onOpen" | "onMaskClick" | "onPreventTouchMove"> & {
213
213
  key?: string | undefined;
214
214
  }) => void;
215
215
  };
@@ -1,12 +1,12 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
3
3
  var _excluded = ["className", "itemStyle", "cascade", "cols", "rows", "data", "okText", "dismissText", "disabled", "clickable", "hideEmptyCols", "title", "visible", "value", "needBottomOffset", "onDismiss", "onOk", "onChange", "maskClosable", "onHide", "onPickerChange", "touchToStop", "gestureOutOfControl"];
4
- import React, { useEffect, useState, useRef, forwardRef, useImperativeHandle } from 'react';
4
+ import React, { useEffect, useRef, forwardRef, useImperativeHandle } from 'react';
5
5
  import { cls, componentWrapper, nextTick } from '@arco-design/mobile-utils';
6
6
  import { ContextLayout } from '../context-provider';
7
7
  import Popup from '../popup';
8
8
  import PickerView from '../picker-view';
9
- import { useListenResize } from '../_helpers';
9
+ import { useLatestRef, useListenResize } from '../_helpers';
10
10
  export * from './type';
11
11
  export { MultiPicker, PickerCell, Cascader } from '../picker-view';
12
12
  var Picker = /*#__PURE__*/forwardRef(function (props, ref) {
@@ -46,10 +46,7 @@ var Picker = /*#__PURE__*/forwardRef(function (props, ref) {
46
46
  gestureOutOfControl = _props$gestureOutOfCo === void 0 ? true : _props$gestureOutOfCo,
47
47
  otherProps = _objectWithoutPropertiesLoose(props, _excluded);
48
48
 
49
- var _useState = useState(value),
50
- scrollValue = _useState[0],
51
- setScrollValue = _useState[1];
52
-
49
+ var scrollValueRef = useLatestRef(value);
53
50
  var domRef = useRef(null);
54
51
  var pickerViewRef = useRef(null);
55
52
  useImperativeHandle(ref, function () {
@@ -100,7 +97,7 @@ var Picker = /*#__PURE__*/forwardRef(function (props, ref) {
100
97
  nextTick(function () {
101
98
  var _pickerViewRef$curren7;
102
99
 
103
- var val = ((_pickerViewRef$curren7 = pickerViewRef.current) == null ? void 0 : _pickerViewRef$curren7.getAllColumnValues()) || scrollValue || [];
100
+ var val = ((_pickerViewRef$curren7 = pickerViewRef.current) == null ? void 0 : _pickerViewRef$curren7.getAllColumnValues()) || scrollValueRef.current || [];
104
101
 
105
102
  if (onOk) {
106
103
  onOk(val);
@@ -116,9 +113,6 @@ var Picker = /*#__PURE__*/forwardRef(function (props, ref) {
116
113
  });
117
114
  };
118
115
 
119
- useEffect(function () {
120
- setScrollValue(value);
121
- }, [value, setScrollValue]);
122
116
  useListenResize(updateLayoutByVisible, [visible]); // 每次visible从false变为true时需要重新设置scrollValue的值为当前value的值(初始值)
123
117
 
124
118
  function updateLayoutByVisible() {
@@ -18,6 +18,7 @@ export interface CascaderProps {
18
18
  export interface CascaderRef {
19
19
  getCellMovingStatus: () => PickerCellMovingStatus[];
20
20
  scrollToCurrentIndex: () => void;
21
+ getAllCellsValue: () => ValueType[];
21
22
  }
22
23
  declare const Cascader: React.ForwardRefExoticComponent<CascaderProps & React.RefAttributes<CascaderRef>>;
23
24
  export default Cascader;
@@ -21,7 +21,8 @@ var Cascader = /*#__PURE__*/forwardRef(function (props, ref) {
21
21
  useImperativeHandle(ref, function () {
22
22
  return {
23
23
  getCellMovingStatus: getCellMovingStatus,
24
- scrollToCurrentIndex: scrollToCurrentIndex
24
+ scrollToCurrentIndex: scrollToCurrentIndex,
25
+ getAllCellsValue: getAllCellsValue
25
26
  };
26
27
  });
27
28
 
@@ -37,6 +38,12 @@ var Cascader = /*#__PURE__*/forwardRef(function (props, ref) {
37
38
  });
38
39
  }
39
40
 
41
+ function getAllCellsValue() {
42
+ return pickerCellsRef.current.map(function (cell) {
43
+ return cell.getCurrentCellValue();
44
+ });
45
+ }
46
+
40
47
  function _onValueChange(value, index, newData) {
41
48
  var children = arrayTreeFilter(data, function (item, level) {
42
49
  return level <= index && item.value === value[level];
@@ -21,6 +21,7 @@ export interface PickerCellProps {
21
21
  export interface PickerCellRef {
22
22
  movingStatus: PickerCellMovingStatus;
23
23
  scrollToCurrentIndex: () => void;
24
+ getCurrentCellValue: () => ValueType;
24
25
  }
25
26
  declare const PickerCell: React.ForwardRefExoticComponent<PickerCellProps & React.RefAttributes<PickerCellRef>>;
26
27
  export default PickerCell;
@@ -283,6 +283,12 @@ var PickerCell = /*#__PURE__*/forwardRef(function (props, ref) {
283
283
  _scrollToIndexWithChange(nowIndex, 0);
284
284
  }
285
285
 
286
+ function getCurrentCellValue() {
287
+ var _data$currentIndex;
288
+
289
+ return currentValue || ((_data$currentIndex = data[currentIndex]) == null ? void 0 : _data$currentIndex.value);
290
+ }
291
+
286
292
  function _clearTimer() {
287
293
  timeRef.current && clearTimeout(timeRef.current);
288
294
  timeRef.current = null;
@@ -347,7 +353,8 @@ var PickerCell = /*#__PURE__*/forwardRef(function (props, ref) {
347
353
  useImperativeHandle(ref, function () {
348
354
  return {
349
355
  movingStatus: movingStatusRef.current,
350
- scrollToCurrentIndex: scrollToCurrentIndex
356
+ scrollToCurrentIndex: scrollToCurrentIndex,
357
+ getCurrentCellValue: getCurrentCellValue
351
358
  };
352
359
  });
353
360
  return !hideEmptyCols || data && data.length ? /*#__PURE__*/React.createElement("div", {
@@ -5,7 +5,7 @@ import { ContextLayout } from '../context-provider';
5
5
  import MultiPicker from '../picker-view/components/multi-picker';
6
6
  import PickerCell from '../picker-view/components/picker-cell';
7
7
  import Cascader from '../picker-view/components/cascader';
8
- import { useLatestRef, useMountedState } from '../_helpers';
8
+ import { useMountedState } from '../_helpers';
9
9
  export * from './type';
10
10
  export { MultiPicker, PickerCell, Cascader };
11
11
  var PickerView = /*#__PURE__*/forwardRef(function (props, ref) {
@@ -45,7 +45,6 @@ var PickerView = /*#__PURE__*/forwardRef(function (props, ref) {
45
45
  var wrapperRef = useRef(null);
46
46
  var domRef = useRef(null);
47
47
  var barRef = useRef(null);
48
- var scrollValueRef = useLatestRef(scrollValue);
49
48
  var pickerCellsRef = useRef([]);
50
49
  var cascaderRef = useRef(null); // itemStyle height 同时对 selection-bar 生效,这里不单独抛出 selection-bar 的高度设置属性
51
50
  // @en The height of itemStyle applies to the selection-bar as well, without separately exposing the height setting property for the selection-bar.
@@ -87,32 +86,39 @@ var PickerView = /*#__PURE__*/forwardRef(function (props, ref) {
87
86
  }, [data]);
88
87
 
89
88
  var getAllColumnValues = function getAllColumnValues() {
90
- return scrollValueRef.current || [];
89
+ var _cascaderRef$current;
90
+
91
+ var curValues = cascade ? ((_cascaderRef$current = cascaderRef.current) == null ? void 0 : _cascaderRef$current.getAllCellsValue()) || [] : pickerCellsRef.current.map(function (cell) {
92
+ return cell.getCurrentCellValue();
93
+ }); // 移除级联带来的空列值,理论上非首尾列不会有空值
94
+ // @en Remove empty values from cascader
95
+
96
+ return curValues.filter(function (v) {
97
+ return v;
98
+ });
91
99
  };
92
100
 
93
101
  function getColumnValue(index) {
94
- var _scrollValueRef$curre;
95
-
96
102
  if (index === void 0) {
97
103
  index = 0;
98
104
  }
99
105
 
100
- return (_scrollValueRef$curre = scrollValueRef.current) == null ? void 0 : _scrollValueRef$curre[index];
106
+ return getAllColumnValues()[index];
101
107
  }
102
108
 
103
109
  function getCellMovingStatus() {
104
- var _cascaderRef$current;
110
+ var _cascaderRef$current2;
105
111
 
106
- return cascade ? ((_cascaderRef$current = cascaderRef.current) == null ? void 0 : _cascaderRef$current.getCellMovingStatus()) || [] : pickerCellsRef.current.map(function (cell) {
112
+ return cascade ? ((_cascaderRef$current2 = cascaderRef.current) == null ? void 0 : _cascaderRef$current2.getCellMovingStatus()) || [] : pickerCellsRef.current.map(function (cell) {
107
113
  return cell.movingStatus;
108
114
  });
109
115
  }
110
116
 
111
117
  function scrollToCurrentIndex() {
112
118
  if (cascade) {
113
- var _cascaderRef$current2;
119
+ var _cascaderRef$current3;
114
120
 
115
- (_cascaderRef$current2 = cascaderRef.current) == null ? void 0 : _cascaderRef$current2.scrollToCurrentIndex();
121
+ (_cascaderRef$current3 = cascaderRef.current) == null ? void 0 : _cascaderRef$current3.scrollToCurrentIndex();
116
122
  return;
117
123
  }
118
124
 
@@ -66,11 +66,11 @@ declare const _default: React.ForwardRefExoticComponent<PopupProps & React.RefAt
66
66
  * @param {PopupProps} config Configuration
67
67
  * @returns {{ close: () => void; update: (newConfig: PopupProps) => void; }}
68
68
  */
69
- open: (config: Pick<import("../context-provider").WithGlobalContext<PopupProps & React.RefAttributes<PopupRef>>, "direction" | "children" | "ref" | "key" | "context" | "translateZ" | "className" | "getScrollContainer" | "onTouchMove" | "getContainer" | "mountOnEnter" | "unmountOnExit" | "onClose" | "maskClass" | "maskStyle" | "contentClass" | "contentStyle" | "maskTransitionType" | "contentTransitionType" | "maskTransitionTimeout" | "contentTransitionTimeout" | "maskClosable" | "animatingClosable" | "orientationDirection" | "preventBodyScroll" | "initialBodyOverflow" | "gestureOutOfControl" | "onOpen" | "onMaskClick" | "onPreventTouchMove" | "needBottomOffset"> & {
69
+ open: (config: Pick<import("../context-provider").WithGlobalContext<PopupProps & React.RefAttributes<PopupRef>>, "direction" | "children" | "ref" | "key" | "context" | "translateZ" | "className" | "getScrollContainer" | "onTouchMove" | "getContainer" | "mountOnEnter" | "unmountOnExit" | "onClose" | "initialBodyOverflow" | "maskClass" | "maskStyle" | "contentClass" | "contentStyle" | "maskTransitionType" | "contentTransitionType" | "maskTransitionTimeout" | "contentTransitionTimeout" | "maskClosable" | "animatingClosable" | "orientationDirection" | "preventBodyScroll" | "gestureOutOfControl" | "onOpen" | "onMaskClick" | "onPreventTouchMove" | "needBottomOffset"> & {
70
70
  key?: string | undefined;
71
71
  }, context?: import("../context-provider").GlobalContextParams | undefined) => {
72
72
  close: () => void;
73
- update: (newConfig: Pick<import("../context-provider").WithGlobalContext<PopupProps & React.RefAttributes<PopupRef>>, "direction" | "children" | "ref" | "key" | "context" | "translateZ" | "className" | "getScrollContainer" | "onTouchMove" | "getContainer" | "mountOnEnter" | "unmountOnExit" | "onClose" | "maskClass" | "maskStyle" | "contentClass" | "contentStyle" | "maskTransitionType" | "contentTransitionType" | "maskTransitionTimeout" | "contentTransitionTimeout" | "maskClosable" | "animatingClosable" | "orientationDirection" | "preventBodyScroll" | "initialBodyOverflow" | "gestureOutOfControl" | "onOpen" | "onMaskClick" | "onPreventTouchMove" | "needBottomOffset"> & {
73
+ update: (newConfig: Pick<import("../context-provider").WithGlobalContext<PopupProps & React.RefAttributes<PopupRef>>, "direction" | "children" | "ref" | "key" | "context" | "translateZ" | "className" | "getScrollContainer" | "onTouchMove" | "getContainer" | "mountOnEnter" | "unmountOnExit" | "onClose" | "initialBodyOverflow" | "maskClass" | "maskStyle" | "contentClass" | "contentStyle" | "maskTransitionType" | "contentTransitionType" | "maskTransitionTimeout" | "contentTransitionTimeout" | "maskClosable" | "animatingClosable" | "orientationDirection" | "preventBodyScroll" | "gestureOutOfControl" | "onOpen" | "onMaskClick" | "onPreventTouchMove" | "needBottomOffset"> & {
74
74
  key?: string | undefined;
75
75
  }) => void;
76
76
  };
@@ -76,11 +76,11 @@ declare const _default: React.ForwardRefExoticComponent<PopupSwiperProps & React
76
76
  * @param {string | PopupSwiperProps} config Configuration
77
77
  * @returns {{ close: () => void; update: (newConfig: PopupSwiperProps) => void; }}
78
78
  */
79
- open: (config: Pick<import("../context-provider").WithGlobalContext<PopupSwiperProps & React.RefAttributes<PopupSwiperRef>>, "direction" | "children" | "ref" | "key" | "context" | "translateZ" | "className" | "getScrollContainer" | "onTouchStart" | "onTouchMove" | "onTouchEnd" | "getContainer" | "mountOnEnter" | "unmountOnExit" | "onClose" | "maskClass" | "maskStyle" | "contentClass" | "contentStyle" | "maskTransitionType" | "contentTransitionType" | "maskTransitionTimeout" | "contentTransitionTimeout" | "maskClosable" | "animatingClosable" | "orientationDirection" | "preventBodyScroll" | "initialBodyOverflow" | "gestureOutOfControl" | "onOpen" | "onMaskClick" | "onPreventTouchMove" | "needBottomOffset" | "percentToClose" | "distanceToClose" | "speedToClose" | "allowSwipeDirections" | "exitDirection"> & {
79
+ open: (config: Pick<import("../context-provider").WithGlobalContext<PopupSwiperProps & React.RefAttributes<PopupSwiperRef>>, "direction" | "children" | "ref" | "key" | "context" | "translateZ" | "className" | "getScrollContainer" | "onTouchStart" | "onTouchMove" | "onTouchEnd" | "getContainer" | "mountOnEnter" | "unmountOnExit" | "onClose" | "initialBodyOverflow" | "maskClass" | "maskStyle" | "contentClass" | "contentStyle" | "maskTransitionType" | "contentTransitionType" | "maskTransitionTimeout" | "contentTransitionTimeout" | "maskClosable" | "animatingClosable" | "orientationDirection" | "preventBodyScroll" | "gestureOutOfControl" | "onOpen" | "onMaskClick" | "onPreventTouchMove" | "needBottomOffset" | "percentToClose" | "distanceToClose" | "speedToClose" | "allowSwipeDirections" | "exitDirection"> & {
80
80
  key?: string | undefined;
81
81
  }, context?: import("../context-provider").GlobalContextParams | undefined) => {
82
82
  close: () => void;
83
- update: (newConfig: Pick<import("../context-provider").WithGlobalContext<PopupSwiperProps & React.RefAttributes<PopupSwiperRef>>, "direction" | "children" | "ref" | "key" | "context" | "translateZ" | "className" | "getScrollContainer" | "onTouchStart" | "onTouchMove" | "onTouchEnd" | "getContainer" | "mountOnEnter" | "unmountOnExit" | "onClose" | "maskClass" | "maskStyle" | "contentClass" | "contentStyle" | "maskTransitionType" | "contentTransitionType" | "maskTransitionTimeout" | "contentTransitionTimeout" | "maskClosable" | "animatingClosable" | "orientationDirection" | "preventBodyScroll" | "initialBodyOverflow" | "gestureOutOfControl" | "onOpen" | "onMaskClick" | "onPreventTouchMove" | "needBottomOffset" | "percentToClose" | "distanceToClose" | "speedToClose" | "allowSwipeDirections" | "exitDirection"> & {
83
+ update: (newConfig: Pick<import("../context-provider").WithGlobalContext<PopupSwiperProps & React.RefAttributes<PopupSwiperRef>>, "direction" | "children" | "ref" | "key" | "context" | "translateZ" | "className" | "getScrollContainer" | "onTouchStart" | "onTouchMove" | "onTouchEnd" | "getContainer" | "mountOnEnter" | "unmountOnExit" | "onClose" | "initialBodyOverflow" | "maskClass" | "maskStyle" | "contentClass" | "contentStyle" | "maskTransitionType" | "contentTransitionType" | "maskTransitionTimeout" | "contentTransitionTimeout" | "maskClosable" | "animatingClosable" | "orientationDirection" | "preventBodyScroll" | "gestureOutOfControl" | "onOpen" | "onMaskClick" | "onPreventTouchMove" | "needBottomOffset" | "percentToClose" | "distanceToClose" | "speedToClose" | "allowSwipeDirections" | "exitDirection"> & {
84
84
  key?: string | undefined;
85
85
  }) => void; /**
86
86
  * 内容面板 touchstart 事件,返回true时表示阻止本组件内部处理事件
@@ -1,10 +1,11 @@
1
- import React, { useState, useRef, forwardRef, useCallback, useMemo, useContext, useEffect, useImperativeHandle } from 'react';
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import React, { useRef, forwardRef, useCallback, useMemo, useContext, useEffect, useImperativeHandle } from 'react';
2
3
  import { cls, nextTick, defaultLocale } from '@arco-design/mobile-utils';
3
4
  import Loading from '../loading';
4
5
  import { GlobalContext } from '../context-provider';
5
6
  import { PullRefreshStatus } from './model';
6
7
  import { useCommonState, useAddScrollEvents, useCheckAsStart } from './hooks';
7
- import { getStyleWithVendor } from '../_helpers';
8
+ import { setStyleWithVendor } from '../_helpers';
8
9
 
9
10
  var dampRateCalculate = function dampRateCalculate(val, tipsHeight, dampRate) {
10
11
  return val > tipsHeight ? tipsHeight + (val - tipsHeight) / dampRate : val;
@@ -53,11 +54,7 @@ export var PullRefresh = /*#__PURE__*/forwardRef(function (props, ref) {
53
54
  onRefresh = props.onRefresh,
54
55
  _props$allowPullWhenN = props.allowPullWhenNotTop,
55
56
  allowPullWhenNotTop = _props$allowPullWhenN === void 0 ? false : _props$allowPullWhenN;
56
-
57
- var _useState = useState({}),
58
- transition = _useState[0],
59
- setTransition = _useState[1];
60
-
57
+ var placeRef = useRef(null);
61
58
  var touchRef = useRef(null);
62
59
  var currentTranslateYRef = useRef(0);
63
60
  var onTouching = useRef(false);
@@ -94,17 +91,7 @@ export var PullRefresh = /*#__PURE__*/forwardRef(function (props, ref) {
94
91
 
95
92
  var scroll = function scroll(y, ms, callback) {
96
93
  if (y < 5) {
97
- if (y < 0) {
98
- currentTranslateYRef.current = 0;
99
- return;
100
- }
101
-
102
- if (ms === 0) {
103
- setTimeout(function () {
104
- setTransition({
105
- transition: 'all 0s'
106
- });
107
- });
94
+ if (y < 0 || ms === 0) {
108
95
  currentTranslateYRef.current = 0;
109
96
  return;
110
97
  }
@@ -112,10 +99,11 @@ export var PullRefresh = /*#__PURE__*/forwardRef(function (props, ref) {
112
99
 
113
100
  var translateY = dampRateCalculate(y, loosingHeight, dampRate);
114
101
  currentTranslateYRef.current = translateY;
115
- setTransition({
116
- transform: translateY ? "translateY(" + translateY + "px)" : '',
102
+ placeRef.current && setStyleWithVendor(placeRef.current, _extends({
103
+ transform: translateY ? "translateY(" + translateY + "px) translateZ(0)" : ''
104
+ }, ms ? {
117
105
  transition: "all " + ms / 1000 + "s"
118
- });
106
+ } : {}));
119
107
  setTimeout(function () {
120
108
  callback == null ? void 0 : callback();
121
109
  }, ms);
@@ -133,6 +121,9 @@ export var PullRefresh = /*#__PURE__*/forwardRef(function (props, ref) {
133
121
 
134
122
  loadingRef.current = false;
135
123
  setStatus(PullRefreshStatus.Static);
124
+ placeRef.current && setStyleWithVendor(placeRef.current, {
125
+ transition: ''
126
+ });
136
127
  callback();
137
128
  });
138
129
  };
@@ -260,7 +251,7 @@ export var PullRefresh = /*#__PURE__*/forwardRef(function (props, ref) {
260
251
  ref: domRef
261
252
  }, /*#__PURE__*/React.createElement("div", {
262
253
  className: cls(prefixCls + "-pull-refresh-place"),
263
- style: getStyleWithVendor(transition)
254
+ ref: placeRef
264
255
  }, /*#__PURE__*/React.createElement("div", {
265
256
  className: cls(prefixCls + "-pull-refresh-label"),
266
257
  ref: labelRef,
@@ -96,9 +96,9 @@ export var useCheckAsStart = function useCheckAsStart(_ref3) {
96
96
  var allowPullWhenNotTop = _ref3.allowPullWhenNotTop,
97
97
  domRef = _ref3.domRef;
98
98
  var ifShouldHandle = useCallback(function () {
99
- var _domRef$current$getBo, _domRef$current9, _domRef$current9$getB;
99
+ var _domRef$current$offse, _domRef$current9;
100
100
 
101
- var domRefHeight = (_domRef$current$getBo = (_domRef$current9 = domRef.current) == null ? void 0 : (_domRef$current9$getB = _domRef$current9.getBoundingClientRect()) == null ? void 0 : _domRef$current9$getB.height) != null ? _domRef$current$getBo : 0;
101
+ var domRefHeight = (_domRef$current$offse = (_domRef$current9 = domRef.current) == null ? void 0 : _domRef$current9.offsetHeight) != null ? _domRef$current$offse : 0;
102
102
  return domRef.current && !(!allowPullWhenNotTop && (domRef.current.scrollTop < 0 || domRef.current.scrollTop > domRef.current.scrollHeight - domRefHeight));
103
103
  }, [allowPullWhenNotTop]);
104
104
  return {
@@ -51,7 +51,6 @@
51
51
  overflow-y: auto;
52
52
  }
53
53
  .arco-pull-refresh-place {
54
- will-change: transform;
55
54
  position: relative;
56
55
  height: 100%;
57
56
  }
@@ -51,7 +51,6 @@
51
51
  }
52
52
 
53
53
  &-place {
54
- will-change: transform;
55
54
  position: relative;
56
55
  height: 100%;
57
56
  }
@@ -75,6 +75,8 @@
75
75
  }
76
76
  .arco-search-bar-clear {
77
77
  color: #C9CDD4 ;
78
+ font-size: 16PX ;
79
+ padding-left: 0.32rem ;
78
80
  }
79
81
  .arco-search-bar-search-icon {
80
82
  color: #86909C ;