@arco-design/mobile-react 2.29.2 → 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.
- package/CHANGELOG.md +13 -0
- package/README.en-US.md +2 -2
- package/README.md +2 -2
- package/cjs/image-preview/index.d.ts +7 -2
- package/cjs/image-preview/index.js +9 -17
- package/cjs/picker-view/components/picker-cell.js +4 -4
- package/cjs/picker-view/index.js +10 -2
- package/cjs/popover/menu.js +3 -1
- package/dist/index.js +25 -25
- package/dist/index.min.js +3 -3
- package/esm/image-preview/index.d.ts +7 -2
- package/esm/image-preview/index.js +9 -17
- package/esm/picker-view/components/picker-cell.js +4 -4
- package/esm/picker-view/index.js +10 -2
- package/esm/popover/menu.js +3 -2
- package/package.json +3 -3
- package/umd/image-preview/index.d.ts +7 -2
- package/umd/image-preview/index.js +9 -17
- package/umd/picker-view/components/picker-cell.js +4 -4
- package/umd/picker-view/index.js +10 -2
- package/umd/popover/menu.js +5 -5
@@ -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
|
-
} //
|
558
|
-
// @en
|
557
|
+
} // 如果正在触发doubleClick就不触发click
|
558
|
+
// @en If doubleClick is being triggered, click will not be triggered
|
559
559
|
|
560
560
|
|
561
|
-
|
562
|
-
if (!
|
563
|
-
|
564
|
-
goClose(e);
|
565
|
-
}
|
561
|
+
if (!dblClickingRef.current) {
|
562
|
+
if (!onImageClick || !onImageClick(innerIndexRef.current, e)) {
|
563
|
+
goClose(e);
|
566
564
|
}
|
567
|
-
}
|
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);
|
@@ -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:
|
197
|
-
weekBounce:
|
198
|
-
strongBounce:
|
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 >
|
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);
|
package/esm/picker-view/index.js
CHANGED
@@ -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
|
})));
|
package/esm/popover/menu.js
CHANGED
@@ -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,
|
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
|
-
|
55
|
+
useUpdateEffect(function () {
|
55
56
|
setVisibleState(Boolean(visible));
|
56
57
|
}, [visible]);
|
57
58
|
var popoverRef = useRef(null);
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@arco-design/mobile-react",
|
3
|
-
"version": "2.29.
|
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.
|
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": "
|
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
|
-
} //
|
586
|
-
// @en
|
585
|
+
} // 如果正在触发doubleClick就不触发click
|
586
|
+
// @en If doubleClick is being triggered, click will not be triggered
|
587
587
|
|
588
588
|
|
589
|
-
|
590
|
-
if (!
|
591
|
-
|
592
|
-
goClose(e);
|
593
|
-
}
|
589
|
+
if (!dblClickingRef.current) {
|
590
|
+
if (!onImageClick || !onImageClick(innerIndexRef.current, e)) {
|
591
|
+
goClose(e);
|
594
592
|
}
|
595
|
-
}
|
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);
|
@@ -215,9 +215,9 @@
|
|
215
215
|
|
216
216
|
function momentum(current, start, duration, minY, maxY) {
|
217
217
|
var durationMap = {
|
218
|
-
noBounce:
|
219
|
-
weekBounce:
|
220
|
-
strongBounce:
|
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 >
|
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);
|
package/umd/picker-view/index.js
CHANGED
@@ -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
|
})));
|
package/umd/popover/menu.js
CHANGED
@@ -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,
|
76
|
+
(0, _helpers.useUpdateEffect)(function () {
|
77
77
|
setVisibleState(Boolean(visible));
|
78
78
|
}, [visible]);
|
79
79
|
var popoverRef = (0, _react.useRef)(null);
|