@arco-design/mobile-react 2.29.1 → 2.29.3

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.
@@ -139,6 +139,11 @@ export interface ImagePreviewProps extends Pick<CarouselProps, 'animateDurationS
139
139
  * @default "start"
140
140
  */
141
141
  indicatorPos?: CarouselProps['indicatorPos'];
142
+ /**
143
+ * 渲染自定义元素,如自定义关闭按钮
144
+ * @en Render custom elements such as custom close buttons
145
+ */
146
+ extra?: ReactNode;
142
147
  /**
143
148
  * 图片捏合时最小缩放倍数,松手后仍会恢复到1的状态,默认为0.7
144
149
  * @en The minimum zoom factor when the image is pinched, it will still return to the state of 1 after letting go, the default is 0.7
@@ -269,9 +274,9 @@ declare const _default: React.ForwardRefExoticComponent<ImagePreviewProps & Reac
269
274
  * @param {ImagePreviewProps} config configuration
270
275
  * @returns {{ close: () => void; update: (newConfig: ImagePreviewProps) => void; }}
271
276
  */
272
- 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" | "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" | "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) => {
273
278
  close: () => void;
274
- 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" | "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" | "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;
275
280
  };
276
281
  };
277
282
  /**
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
3
- var _excluded = ["style", "className", "images", "loop", "openIndex", "fit", "noselect", "displayDuration", "spaceBetween", "showLoading", "loadingArea", "errorArea", "showError", "retryTime", "staticLabel", "replaceFallbackWhenLoaded", "scrollBezier", "lazyloadCount", "swipeToClose", "getMinScale", "getMaxScale", "getDoubleClickScale", "getContainer", "getThumbBounds", "renderIndicator", "onChange", "onAfterChange", "onImageClick", "onImageDoubleClick", "onImageLongTap", "close", "onClose", "onTouchStart", "onTouchMove", "onTouchEnd", "indicatorPos"];
3
+ var _excluded = ["style", "className", "images", "loop", "openIndex", "fit", "noselect", "displayDuration", "spaceBetween", "showLoading", "loadingArea", "errorArea", "showError", "retryTime", "staticLabel", "replaceFallbackWhenLoaded", "scrollBezier", "lazyloadCount", "swipeToClose", "extra", "getMinScale", "getMaxScale", "getDoubleClickScale", "getContainer", "getThumbBounds", "renderIndicator", "onChange", "onAfterChange", "onImageClick", "onImageDoubleClick", "onImageLongTap", "close", "onClose", "onTouchStart", "onTouchMove", "onTouchEnd", "indicatorPos"];
4
4
  import React, { useRef, forwardRef, useImperativeHandle, useEffect, useState } from 'react';
5
5
  import { nextTick, componentWrapper, preventEleScroll, freeEleScroll, cls } from '@arco-design/mobile-utils';
6
6
  import TransformAble from '@arco-design/transformable';
@@ -45,6 +45,7 @@ var ImagePreview = /*#__PURE__*/forwardRef(function (props, ref) {
45
45
  lazyloadCount = _props$lazyloadCount === void 0 ? 1 : _props$lazyloadCount,
46
46
  _props$swipeToClose = props.swipeToClose,
47
47
  swipeToClose = _props$swipeToClose === void 0 ? true : _props$swipeToClose,
48
+ extra = props.extra,
48
49
  getMinScale = props.getMinScale,
49
50
  getMaxScale = props.getMaxScale,
50
51
  getDoubleClickScale = props.getDoubleClickScale,
@@ -70,7 +71,6 @@ var ImagePreview = /*#__PURE__*/forwardRef(function (props, ref) {
70
71
  var imagesRef = useRef([]);
71
72
  var carouselRef = useRef(null);
72
73
  var transformersRef = useRef([]);
73
- var dblTimerRef = useRef(null);
74
74
  var longTimerRef = useRef(null);
75
75
  var transImageRef = useRef(null);
76
76
  var imageDomsRef = useRef([]);
@@ -554,17 +554,15 @@ var ImagePreview = /*#__PURE__*/forwardRef(function (props, ref) {
554
554
  function handleImageClick(e) {
555
555
  if (movedRef.current) {
556
556
  return;
557
- } // 300ms内再次点击则触发doubleClick,否则触发click
558
- // @en Click again within 300ms to trigger doubleClick, otherwise trigger click
557
+ } // 如果正在触发doubleClick就不触发click
558
+ // @en If doubleClick is being triggered, click will not be triggered
559
559
 
560
560
 
561
- dblTimerRef.current = window.setTimeout(function () {
562
- if (!dblClickingRef.current) {
563
- if (!onImageClick || !onImageClick(innerIndexRef.current, e)) {
564
- goClose(e);
565
- }
561
+ if (!dblClickingRef.current) {
562
+ if (!onImageClick || !onImageClick(innerIndexRef.current, e)) {
563
+ goClose(e);
566
564
  }
567
- }, 300);
565
+ }
568
566
  }
569
567
 
570
568
  function handleImageDoubleClick(e) {
@@ -574,12 +572,6 @@ var ImagePreview = /*#__PURE__*/forwardRef(function (props, ref) {
574
572
  }
575
573
 
576
574
  dblClickingRef.current = true;
577
-
578
- if (dblTimerRef.current) {
579
- clearTimeout(dblTimerRef.current);
580
- dblTimerRef.current = null;
581
- }
582
-
583
575
  var index = innerIndexRef.current;
584
576
  onImageDoubleClick && onImageDoubleClick(index, e); // 双击时根据配置放大或缩小
585
577
  // @en Zoom in or out according to configuration when double-clicking
@@ -972,7 +964,7 @@ var ImagePreview = /*#__PURE__*/forwardRef(function (props, ref) {
972
964
  onLoad: transImageInfo.onLoad,
973
965
  onError: transImageInfo.onError
974
966
  };
975
- })) : null)), transImageInfo ? /*#__PURE__*/React.createElement("div", {
967
+ })) : null, extra)), transImageInfo ? /*#__PURE__*/React.createElement("div", {
976
968
  className: "image-preview-lock-modal",
977
969
  onClick: goClose
978
970
  }) : null);
@@ -11,6 +11,11 @@ export interface LoadMoreProps {
11
11
  * @en Custom classname
12
12
  */
13
13
  className?: string;
14
+ /**
15
+ * 是否禁用加载能力
16
+ * @en Whether to disable the loading capability
17
+ */
18
+ disabled?: boolean;
14
19
  /**
15
20
  * 组件加载但尚未启用状态下的内容
16
21
  * @en Content when the component is loaded but not yet enabled
@@ -1,8 +1,8 @@
1
1
  import React, { useRef, forwardRef, useImperativeHandle, useEffect, useCallback, useState } from 'react';
2
2
  import lodashThrottle from 'lodash.throttle';
3
- import { getScrollContainerAttribute, getValidScrollContainer, defaultLocale } from '@arco-design/mobile-utils';
3
+ import { getScrollContainerAttribute, getValidScrollContainer, defaultLocale, cls } from '@arco-design/mobile-utils';
4
4
  import { ContextLayout } from '../context-provider';
5
- import { useUpdateEffect } from '../_helpers';
5
+ import { useLatestRef, useUpdateEffect } from '../_helpers';
6
6
 
7
7
  /**
8
8
  * 上拉加载组件,支持`scroll`和`click`两种触发加载方式,支持滚动监听。支持受控与不受控两种形式。<br>如果引入组件后发现仅触发了初始的`getData`,请确认是否在`getData`方法内没有调用`callback`移除 loading 状态,且未设置`blockWhenLoading`属性为 false。
@@ -16,6 +16,7 @@ var LoadMore = /*#__PURE__*/forwardRef(function (props, ref) {
16
16
  var _props$className = props.className,
17
17
  className = _props$className === void 0 ? '' : _props$className,
18
18
  style = props.style,
19
+ disabled = props.disabled,
19
20
  beforeReadyArea = props.beforeReadyArea,
20
21
  loadingArea = props.loadingArea,
21
22
  noMoreArea = props.noMoreArea,
@@ -50,11 +51,16 @@ var LoadMore = /*#__PURE__*/forwardRef(function (props, ref) {
50
51
  var lastScrollEndRef = useRef(false);
51
52
  var nowStatus = status || innerStatus;
52
53
  var statusRef = useRef(nowStatus);
54
+ var disabledRef = useLatestRef(disabled);
53
55
  var changeStatus = useCallback(function (st, scene) {
54
56
  setInnerStatus(st);
55
57
  onStatusChange && onStatusChange(st, scene);
56
58
  }, [onStatusChange]);
57
59
  var triggerGetData = useCallback(function (scene) {
60
+ if (disabledRef.current) {
61
+ return;
62
+ }
63
+
58
64
  if (blockWhenLoading && statusRef.current === 'loading') {
59
65
  return;
60
66
  }
@@ -79,12 +85,12 @@ var LoadMore = /*#__PURE__*/forwardRef(function (props, ref) {
79
85
  }
80
86
  }, [nowStatus]);
81
87
  useEffect(function () {
82
- if (requestAtFirst) {
88
+ if (requestAtFirst && !disabled) {
83
89
  if (statusRef.current === 'prepare') {
84
90
  triggerGetData('requestAtFirst');
85
91
  }
86
92
  }
87
- }, [trigger]);
93
+ }, [trigger, disabled]);
88
94
  var handleContainerScroll = useCallback(function () {
89
95
  var scrollTop = getScrollContainerAttribute('scrollTop', getScrollContainer);
90
96
 
@@ -105,7 +111,7 @@ var LoadMore = /*#__PURE__*/forwardRef(function (props, ref) {
105
111
  var binded = null;
106
112
  var scrollFunc = throttle ? lodashThrottle(handleContainerScroll, throttle) : handleContainerScroll;
107
113
 
108
- if (trigger === 'scroll') {
114
+ if (trigger === 'scroll' && !disabled) {
109
115
  var container = getValidScrollContainer(getScrollContainer);
110
116
 
111
117
  if (container) {
@@ -119,7 +125,7 @@ var LoadMore = /*#__PURE__*/forwardRef(function (props, ref) {
119
125
  binded.removeEventListener('scroll', scrollFunc);
120
126
  }
121
127
  };
122
- }, [trigger, getScrollContainer, handleContainerScroll, throttle]);
128
+ }, [trigger, disabled, getScrollContainer, handleContainerScroll, throttle]);
123
129
  useImperativeHandle(ref, function () {
124
130
  return {
125
131
  dom: domRef.current,
@@ -172,11 +178,13 @@ var LoadMore = /*#__PURE__*/forwardRef(function (props, ref) {
172
178
  }
173
179
 
174
180
  return /*#__PURE__*/React.createElement(ContextLayout, null, function (_ref) {
181
+ var _cls;
182
+
175
183
  var prefixCls = _ref.prefixCls,
176
184
  _ref$locale = _ref.locale,
177
185
  locale = _ref$locale === void 0 ? defaultLocale : _ref$locale;
178
186
  return /*#__PURE__*/React.createElement("div", {
179
- className: prefixCls + "-load-more status-" + nowStatus + " " + className,
187
+ className: cls(prefixCls + "-load-more status-" + nowStatus, className, (_cls = {}, _cls[prefixCls + "-load-more-disabled"] = disabled, _cls)),
180
188
  ref: domRef,
181
189
  style: style,
182
190
  onClick: handleClick
@@ -193,9 +193,9 @@ var PickerCell = /*#__PURE__*/forwardRef(function (props, ref) {
193
193
 
194
194
  function momentum(current, start, duration, minY, maxY) {
195
195
  var durationMap = {
196
- noBounce: 2000,
197
- weekBounce: 500,
198
- strongBounce: 300
196
+ noBounce: 400,
197
+ weekBounce: 100,
198
+ strongBounce: 75
199
199
  };
200
200
  var bezierMap = {
201
201
  noBounce: 'cubic-bezier(.17, .89, .45, 1)',
@@ -254,7 +254,7 @@ var PickerCell = /*#__PURE__*/forwardRef(function (props, ref) {
254
254
  var absDistY = Math.abs(transformY - lastTransformY); // 计算动量,保证滚动顺畅,条件:手势时间小于300ms && 移动距离绝对值大于30时
255
255
  // @en Calculate the momentum to ensure smooth scrolling, condition: the gesture time is less than 300ms && the absolute value of the moving distance is greater than 30
256
256
 
257
- if (duration < 300 && absDistY > 30) {
257
+ if (duration < 300 && absDistY > 90) {
258
258
  var momentumY = momentum(transformY, lastTransformY, duration, wrapperHeight - scrollerHeight, 0);
259
259
  var newItemIndex = Math.max(0, Math.min(data.length - 1, Math.round(-1 * momentumY.destination / itemHeight)));
260
260
  setBezier(momentumY.bezier);
@@ -47,7 +47,14 @@ var PickerView = /*#__PURE__*/forwardRef(function (props, ref) {
47
47
  var barRef = useRef(null);
48
48
  var scrollValueRef = useLatestRef(scrollValue);
49
49
  var pickerCellsRef = useRef([]);
50
- var cascaderRef = useRef(null);
50
+ var cascaderRef = useRef(null); // itemStyle height 同时对 selection-bar 生效,这里不单独抛出 selection-bar 的高度设置属性
51
+ // @en The height of itemStyle applies to the selection-bar as well, without separately exposing the height setting property for the selection-bar.
52
+
53
+ var selectionBarHeight = useMemo(function () {
54
+ return itemStyle != null && itemStyle.height ? {
55
+ height: itemStyle.height
56
+ } : {};
57
+ }, [itemStyle]);
51
58
  var innerData = useMemo(function () {
52
59
  var newData;
53
60
 
@@ -218,7 +225,8 @@ var PickerView = /*#__PURE__*/forwardRef(function (props, ref) {
218
225
  className: prefixCls + "-picker-selection-mask " + prefixCls + "-picker-selection-mask-top"
219
226
  }), /*#__PURE__*/React.createElement("div", {
220
227
  ref: barRef,
221
- className: prefixCls + "-picker-selection-bar"
228
+ className: prefixCls + "-picker-selection-bar",
229
+ style: selectionBarHeight
222
230
  }), /*#__PURE__*/React.createElement("div", {
223
231
  className: prefixCls + "-picker-selection-mask " + prefixCls + "-picker-selection-mask-bottom"
224
232
  })));
@@ -2,8 +2,9 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
3
3
  var _excluded = ["menu", "menuLayout", "onSelect", "onClickMenuItem", "className", "useClickStatus", "clickStatusDuration", "clickSelfToClose", "touchSelfToClose", "defaultVisible", "visible", "onChange"];
4
4
  import { cls } from '@arco-design/mobile-utils';
5
- import React, { useContext, useMemo, useState, useRef, useEffect, forwardRef, useImperativeHandle } from 'react';
5
+ import React, { useContext, useMemo, useState, useRef, forwardRef, useImperativeHandle } from 'react';
6
6
  import { GlobalContext } from '../context-provider';
7
+ import { useUpdateEffect } from '../_helpers';
7
8
  export function componentGenerator(Comp) {
8
9
  return /*#__PURE__*/forwardRef(function (props, ref) {
9
10
  var menu = props.menu,
@@ -51,7 +52,7 @@ export function componentGenerator(Comp) {
51
52
  visibleState = _useState2[0],
52
53
  setVisibleState = _useState2[1];
53
54
 
54
- useEffect(function () {
55
+ useUpdateEffect(function () {
55
56
  setVisibleState(Boolean(visible));
56
57
  }, [visible]);
57
58
  var popoverRef = useRef(null);
@@ -360,7 +360,8 @@ var TabCell = /*#__PURE__*/forwardRef(function (props, ref) {
360
360
  fixed: tabBarFixed
361
361
  }, {
362
362
  'has-divider': hasDivider
363
- })
363
+ }),
364
+ style: typeof tabBarFixed === 'object' ? tabBarFixed : {}
364
365
  }, /*#__PURE__*/React.createElement("div", {
365
366
  className: cls(prefix + "-container", tabDirection, "pos-" + tabBarPosition, "arrange-" + (originArrange || tabBarArrange), "type-" + type, {
366
367
  overflow: hasOverflow
@@ -1,4 +1,4 @@
1
- import { ReactNode, ReactNodeArray } from 'react';
1
+ import { CSSProperties, ReactNode, ReactNodeArray } from 'react';
2
2
  export declare type TabData = string | {
3
3
  title: ReactNode;
4
4
  [x: string]: any;
@@ -71,10 +71,10 @@ export interface TabsProps {
71
71
  */
72
72
  tabBarScroll?: boolean;
73
73
  /**
74
- * TabBar是否顶部固定
75
- * @en Whether the TabBar is fixed on the top
74
+ * TabBar是否顶部/底部固定(含 placeholder),可传入具体固定的值
75
+ * @en Whether the TabBar is fixed on the top or bottom (including placeholder), a specific fixed value can be passed in
76
76
  */
77
- tabBarFixed?: boolean;
77
+ tabBarFixed?: boolean | Pick<CSSProperties, 'top' | 'bottom'>;
78
78
  /**
79
79
  * tabBar额外渲染内容
80
80
  * @en TabBar extra render content
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arco-design/mobile-react",
3
- "version": "2.29.1",
3
+ "version": "2.29.3",
4
4
  "description": "",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",
@@ -15,7 +15,7 @@
15
15
  "author": "taoyiyue@bytedance.com",
16
16
  "license": "ISC",
17
17
  "dependencies": {
18
- "@arco-design/mobile-utils": "2.16.4",
18
+ "@arco-design/mobile-utils": "2.16.6",
19
19
  "@arco-design/transformable": "^1.0.0",
20
20
  "lodash.throttle": "^4.1.1",
21
21
  "resize-observer-polyfill": "^1.5.1"
@@ -49,5 +49,5 @@
49
49
  "publishConfig": {
50
50
  "access": "public"
51
51
  },
52
- "gitHead": "4feb5984a8951d9d65662c069b2e2c3a61c81014"
52
+ "gitHead": "91a7490bc2dd677acfa7c064946ff83dccab4196"
53
53
  }
@@ -139,6 +139,11 @@ export interface ImagePreviewProps extends Pick<CarouselProps, 'animateDurationS
139
139
  * @default "start"
140
140
  */
141
141
  indicatorPos?: CarouselProps['indicatorPos'];
142
+ /**
143
+ * 渲染自定义元素,如自定义关闭按钮
144
+ * @en Render custom elements such as custom close buttons
145
+ */
146
+ extra?: ReactNode;
142
147
  /**
143
148
  * 图片捏合时最小缩放倍数,松手后仍会恢复到1的状态,默认为0.7
144
149
  * @en The minimum zoom factor when the image is pinched, it will still return to the state of 1 after letting go, the default is 0.7
@@ -269,9 +274,9 @@ declare const _default: React.ForwardRefExoticComponent<ImagePreviewProps & Reac
269
274
  * @param {ImagePreviewProps} config configuration
270
275
  * @returns {{ close: () => void; update: (newConfig: ImagePreviewProps) => void; }}
271
276
  */
272
- 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" | "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" | "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) => {
273
278
  close: () => void;
274
- 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" | "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" | "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;
275
280
  };
276
281
  };
277
282
  /**
@@ -36,7 +36,7 @@
36
36
  _exports[key] = _methods[key];
37
37
  });
38
38
  _loading = _interopRequireDefault(_loading);
39
- var _excluded = ["style", "className", "images", "loop", "openIndex", "fit", "noselect", "displayDuration", "spaceBetween", "showLoading", "loadingArea", "errorArea", "showError", "retryTime", "staticLabel", "replaceFallbackWhenLoaded", "scrollBezier", "lazyloadCount", "swipeToClose", "getMinScale", "getMaxScale", "getDoubleClickScale", "getContainer", "getThumbBounds", "renderIndicator", "onChange", "onAfterChange", "onImageClick", "onImageDoubleClick", "onImageLongTap", "close", "onClose", "onTouchStart", "onTouchMove", "onTouchEnd", "indicatorPos"];
39
+ var _excluded = ["style", "className", "images", "loop", "openIndex", "fit", "noselect", "displayDuration", "spaceBetween", "showLoading", "loadingArea", "errorArea", "showError", "retryTime", "staticLabel", "replaceFallbackWhenLoaded", "scrollBezier", "lazyloadCount", "swipeToClose", "extra", "getMinScale", "getMaxScale", "getDoubleClickScale", "getContainer", "getThumbBounds", "renderIndicator", "onChange", "onAfterChange", "onImageClick", "onImageDoubleClick", "onImageLongTap", "close", "onClose", "onTouchStart", "onTouchMove", "onTouchEnd", "indicatorPos"];
40
40
 
41
41
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
42
42
 
@@ -74,6 +74,7 @@
74
74
  lazyloadCount = _props$lazyloadCount === void 0 ? 1 : _props$lazyloadCount,
75
75
  _props$swipeToClose = props.swipeToClose,
76
76
  swipeToClose = _props$swipeToClose === void 0 ? true : _props$swipeToClose,
77
+ extra = props.extra,
77
78
  getMinScale = props.getMinScale,
78
79
  getMaxScale = props.getMaxScale,
79
80
  getDoubleClickScale = props.getDoubleClickScale,
@@ -98,7 +99,6 @@
98
99
  var imagesRef = (0, _react.useRef)([]);
99
100
  var carouselRef = (0, _react.useRef)(null);
100
101
  var transformersRef = (0, _react.useRef)([]);
101
- var dblTimerRef = (0, _react.useRef)(null);
102
102
  var longTimerRef = (0, _react.useRef)(null);
103
103
  var transImageRef = (0, _react.useRef)(null);
104
104
  var imageDomsRef = (0, _react.useRef)([]);
@@ -582,17 +582,15 @@
582
582
  function handleImageClick(e) {
583
583
  if (movedRef.current) {
584
584
  return;
585
- } // 300ms内再次点击则触发doubleClick,否则触发click
586
- // @en Click again within 300ms to trigger doubleClick, otherwise trigger click
585
+ } // 如果正在触发doubleClick就不触发click
586
+ // @en If doubleClick is being triggered, click will not be triggered
587
587
 
588
588
 
589
- dblTimerRef.current = window.setTimeout(function () {
590
- if (!dblClickingRef.current) {
591
- if (!onImageClick || !onImageClick(innerIndexRef.current, e)) {
592
- goClose(e);
593
- }
589
+ if (!dblClickingRef.current) {
590
+ if (!onImageClick || !onImageClick(innerIndexRef.current, e)) {
591
+ goClose(e);
594
592
  }
595
- }, 300);
593
+ }
596
594
  }
597
595
 
598
596
  function handleImageDoubleClick(e) {
@@ -602,12 +600,6 @@
602
600
  }
603
601
 
604
602
  dblClickingRef.current = true;
605
-
606
- if (dblTimerRef.current) {
607
- clearTimeout(dblTimerRef.current);
608
- dblTimerRef.current = null;
609
- }
610
-
611
603
  var index = innerIndexRef.current;
612
604
  onImageDoubleClick && onImageDoubleClick(index, e); // 双击时根据配置放大或缩小
613
605
  // @en Zoom in or out according to configuration when double-clicking
@@ -1001,7 +993,7 @@
1001
993
  onLoad: transImageInfo.onLoad,
1002
994
  onError: transImageInfo.onError
1003
995
  };
1004
- })) : null)), transImageInfo ? /*#__PURE__*/_react.default.createElement("div", {
996
+ })) : null, extra)), transImageInfo ? /*#__PURE__*/_react.default.createElement("div", {
1005
997
  className: "image-preview-lock-modal",
1006
998
  onClick: goClose
1007
999
  }) : null);
@@ -11,6 +11,11 @@ export interface LoadMoreProps {
11
11
  * @en Custom classname
12
12
  */
13
13
  className?: string;
14
+ /**
15
+ * 是否禁用加载能力
16
+ * @en Whether to disable the loading capability
17
+ */
18
+ disabled?: boolean;
14
19
  /**
15
20
  * 组件加载但尚未启用状态下的内容
16
21
  * @en Content when the component is loaded but not yet enabled
@@ -36,6 +36,7 @@
36
36
  var _props$className = props.className,
37
37
  className = _props$className === void 0 ? '' : _props$className,
38
38
  style = props.style,
39
+ disabled = props.disabled,
39
40
  beforeReadyArea = props.beforeReadyArea,
40
41
  loadingArea = props.loadingArea,
41
42
  noMoreArea = props.noMoreArea,
@@ -70,11 +71,16 @@
70
71
  var lastScrollEndRef = (0, _react.useRef)(false);
71
72
  var nowStatus = status || innerStatus;
72
73
  var statusRef = (0, _react.useRef)(nowStatus);
74
+ var disabledRef = (0, _helpers.useLatestRef)(disabled);
73
75
  var changeStatus = (0, _react.useCallback)(function (st, scene) {
74
76
  setInnerStatus(st);
75
77
  onStatusChange && onStatusChange(st, scene);
76
78
  }, [onStatusChange]);
77
79
  var triggerGetData = (0, _react.useCallback)(function (scene) {
80
+ if (disabledRef.current) {
81
+ return;
82
+ }
83
+
78
84
  if (blockWhenLoading && statusRef.current === 'loading') {
79
85
  return;
80
86
  }
@@ -99,12 +105,12 @@
99
105
  }
100
106
  }, [nowStatus]);
101
107
  (0, _react.useEffect)(function () {
102
- if (requestAtFirst) {
108
+ if (requestAtFirst && !disabled) {
103
109
  if (statusRef.current === 'prepare') {
104
110
  triggerGetData('requestAtFirst');
105
111
  }
106
112
  }
107
- }, [trigger]);
113
+ }, [trigger, disabled]);
108
114
  var handleContainerScroll = (0, _react.useCallback)(function () {
109
115
  var scrollTop = (0, _mobileUtils.getScrollContainerAttribute)('scrollTop', getScrollContainer);
110
116
 
@@ -125,7 +131,7 @@
125
131
  var binded = null;
126
132
  var scrollFunc = throttle ? (0, _lodash.default)(handleContainerScroll, throttle) : handleContainerScroll;
127
133
 
128
- if (trigger === 'scroll') {
134
+ if (trigger === 'scroll' && !disabled) {
129
135
  var container = (0, _mobileUtils.getValidScrollContainer)(getScrollContainer);
130
136
 
131
137
  if (container) {
@@ -139,7 +145,7 @@
139
145
  binded.removeEventListener('scroll', scrollFunc);
140
146
  }
141
147
  };
142
- }, [trigger, getScrollContainer, handleContainerScroll, throttle]);
148
+ }, [trigger, disabled, getScrollContainer, handleContainerScroll, throttle]);
143
149
  (0, _react.useImperativeHandle)(ref, function () {
144
150
  return {
145
151
  dom: domRef.current,
@@ -192,11 +198,13 @@
192
198
  }
193
199
 
194
200
  return /*#__PURE__*/_react.default.createElement(_contextProvider.ContextLayout, null, function (_ref) {
201
+ var _cls;
202
+
195
203
  var prefixCls = _ref.prefixCls,
196
204
  _ref$locale = _ref.locale,
197
205
  locale = _ref$locale === void 0 ? _mobileUtils.defaultLocale : _ref$locale;
198
206
  return /*#__PURE__*/_react.default.createElement("div", {
199
- className: prefixCls + "-load-more status-" + nowStatus + " " + className,
207
+ className: (0, _mobileUtils.cls)(prefixCls + "-load-more status-" + nowStatus, className, (_cls = {}, _cls[prefixCls + "-load-more-disabled"] = disabled, _cls)),
200
208
  ref: domRef,
201
209
  style: style,
202
210
  onClick: handleClick
@@ -215,9 +215,9 @@
215
215
 
216
216
  function momentum(current, start, duration, minY, maxY) {
217
217
  var durationMap = {
218
- noBounce: 2000,
219
- weekBounce: 500,
220
- strongBounce: 300
218
+ noBounce: 400,
219
+ weekBounce: 100,
220
+ strongBounce: 75
221
221
  };
222
222
  var bezierMap = {
223
223
  noBounce: 'cubic-bezier(.17, .89, .45, 1)',
@@ -276,7 +276,7 @@
276
276
  var absDistY = Math.abs(transformY - lastTransformY); // 计算动量,保证滚动顺畅,条件:手势时间小于300ms && 移动距离绝对值大于30时
277
277
  // @en Calculate the momentum to ensure smooth scrolling, condition: the gesture time is less than 300ms && the absolute value of the moving distance is greater than 30
278
278
 
279
- if (duration < 300 && absDistY > 30) {
279
+ if (duration < 300 && absDistY > 90) {
280
280
  var momentumY = momentum(transformY, lastTransformY, duration, wrapperHeight - scrollerHeight, 0);
281
281
  var newItemIndex = Math.max(0, Math.min(data.length - 1, Math.round(-1 * momentumY.destination / itemHeight)));
282
282
  setBezier(momentumY.bezier);
@@ -80,7 +80,14 @@
80
80
  var barRef = (0, _react.useRef)(null);
81
81
  var scrollValueRef = (0, _helpers.useLatestRef)(scrollValue);
82
82
  var pickerCellsRef = (0, _react.useRef)([]);
83
- var cascaderRef = (0, _react.useRef)(null);
83
+ var cascaderRef = (0, _react.useRef)(null); // itemStyle height 同时对 selection-bar 生效,这里不单独抛出 selection-bar 的高度设置属性
84
+ // @en The height of itemStyle applies to the selection-bar as well, without separately exposing the height setting property for the selection-bar.
85
+
86
+ var selectionBarHeight = (0, _react.useMemo)(function () {
87
+ return itemStyle != null && itemStyle.height ? {
88
+ height: itemStyle.height
89
+ } : {};
90
+ }, [itemStyle]);
84
91
  var innerData = (0, _react.useMemo)(function () {
85
92
  var newData;
86
93
 
@@ -250,7 +257,8 @@
250
257
  className: prefixCls + "-picker-selection-mask " + prefixCls + "-picker-selection-mask-top"
251
258
  }), /*#__PURE__*/_react.default.createElement("div", {
252
259
  ref: barRef,
253
- className: prefixCls + "-picker-selection-bar"
260
+ className: prefixCls + "-picker-selection-bar",
261
+ style: selectionBarHeight
254
262
  }), /*#__PURE__*/_react.default.createElement("div", {
255
263
  className: prefixCls + "-picker-selection-mask " + prefixCls + "-picker-selection-mask-bottom"
256
264
  })));
@@ -1,16 +1,16 @@
1
1
  (function (global, factory) {
2
2
  if (typeof define === "function" && define.amd) {
3
- define(["exports", "@babel/runtime/helpers/extends", "@babel/runtime/helpers/objectWithoutPropertiesLoose", "@arco-design/mobile-utils", "react", "../context-provider"], factory);
3
+ define(["exports", "@babel/runtime/helpers/extends", "@babel/runtime/helpers/objectWithoutPropertiesLoose", "@arco-design/mobile-utils", "react", "../context-provider", "../_helpers"], factory);
4
4
  } else if (typeof exports !== "undefined") {
5
- factory(exports, require("@babel/runtime/helpers/extends"), require("@babel/runtime/helpers/objectWithoutPropertiesLoose"), require("@arco-design/mobile-utils"), require("react"), require("../context-provider"));
5
+ factory(exports, require("@babel/runtime/helpers/extends"), require("@babel/runtime/helpers/objectWithoutPropertiesLoose"), require("@arco-design/mobile-utils"), require("react"), require("../context-provider"), require("../_helpers"));
6
6
  } else {
7
7
  var mod = {
8
8
  exports: {}
9
9
  };
10
- factory(mod.exports, global._extends, global.objectWithoutPropertiesLoose, global.mobileUtils, global.react, global.contextProvider);
10
+ factory(mod.exports, global._extends, global.objectWithoutPropertiesLoose, global.mobileUtils, global.react, global.contextProvider, global._helpers);
11
11
  global.menu = mod.exports;
12
12
  }
13
- })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _extends2, _objectWithoutPropertiesLoose2, _mobileUtils, _react, _contextProvider) {
13
+ })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _extends2, _objectWithoutPropertiesLoose2, _mobileUtils, _react, _contextProvider, _helpers) {
14
14
  "use strict";
15
15
 
16
16
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
@@ -73,7 +73,7 @@
73
73
  visibleState = _useState2[0],
74
74
  setVisibleState = _useState2[1];
75
75
 
76
- (0, _react.useEffect)(function () {
76
+ (0, _helpers.useUpdateEffect)(function () {
77
77
  setVisibleState(Boolean(visible));
78
78
  }, [visible]);
79
79
  var popoverRef = (0, _react.useRef)(null);
@@ -382,7 +382,8 @@
382
382
  fixed: tabBarFixed
383
383
  }, {
384
384
  'has-divider': hasDivider
385
- })
385
+ }),
386
+ style: typeof tabBarFixed === 'object' ? tabBarFixed : {}
386
387
  }, /*#__PURE__*/_react.default.createElement("div", {
387
388
  className: (0, _mobileUtils.cls)(prefix + "-container", tabDirection, "pos-" + tabBarPosition, "arrange-" + (originArrange || tabBarArrange), "type-" + type, {
388
389
  overflow: hasOverflow
@@ -1,4 +1,4 @@
1
- import { ReactNode, ReactNodeArray } from 'react';
1
+ import { CSSProperties, ReactNode, ReactNodeArray } from 'react';
2
2
  export declare type TabData = string | {
3
3
  title: ReactNode;
4
4
  [x: string]: any;
@@ -71,10 +71,10 @@ export interface TabsProps {
71
71
  */
72
72
  tabBarScroll?: boolean;
73
73
  /**
74
- * TabBar是否顶部固定
75
- * @en Whether the TabBar is fixed on the top
74
+ * TabBar是否顶部/底部固定(含 placeholder),可传入具体固定的值
75
+ * @en Whether the TabBar is fixed on the top or bottom (including placeholder), a specific fixed value can be passed in
76
76
  */
77
- tabBarFixed?: boolean;
77
+ tabBarFixed?: boolean | Pick<CSSProperties, 'top' | 'bottom'>;
78
78
  /**
79
79
  * tabBar额外渲染内容
80
80
  * @en TabBar extra render content