@arco-design/mobile-react 2.27.1 → 2.27.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/README.en-US.md +2 -2
- package/README.md +2 -2
- package/cjs/_helpers/index.d.ts +1 -0
- package/cjs/_helpers/index.js +10 -0
- package/cjs/index-bar/type.d.ts +3 -3
- package/cjs/load-more/index.js +4 -1
- package/cjs/nav-bar/index.js +2 -2
- package/cjs/show-monitor/index.js +112 -38
- package/cjs/swipe-load/demo/style/css/mobile.css +3 -0
- package/cjs/swipe-load/demo/style/mobile.less +11 -0
- package/cjs/swipe-load/index.js +86 -32
- package/cjs/swipe-load/style/css/index.css +3 -0
- package/cjs/swipe-load/style/index.less +7 -0
- package/cjs/swipe-load/type.d.ts +29 -0
- package/cjs/tabs/index.js +1 -0
- package/dist/index.js +218 -81
- package/dist/index.min.js +4 -4
- package/dist/style.css +3 -0
- package/dist/style.min.css +1 -1
- package/esm/_helpers/index.d.ts +1 -0
- package/esm/_helpers/index.js +7 -0
- package/esm/index-bar/type.d.ts +3 -3
- package/esm/load-more/index.js +4 -1
- package/esm/nav-bar/index.js +2 -2
- package/esm/show-monitor/index.js +112 -38
- package/esm/swipe-load/demo/style/css/mobile.css +3 -0
- package/esm/swipe-load/demo/style/mobile.less +11 -0
- package/esm/swipe-load/index.js +85 -32
- package/esm/swipe-load/style/css/index.css +3 -0
- package/esm/swipe-load/style/index.less +7 -0
- package/esm/swipe-load/type.d.ts +29 -0
- package/esm/tabs/index.js +1 -0
- package/package.json +3 -3
- package/umd/_helpers/index.d.ts +1 -0
- package/umd/_helpers/index.js +10 -0
- package/umd/index-bar/type.d.ts +3 -3
- package/umd/load-more/index.js +4 -1
- package/umd/nav-bar/index.js +2 -2
- package/umd/show-monitor/index.js +112 -38
- package/umd/swipe-load/demo/style/css/mobile.css +3 -0
- package/umd/swipe-load/demo/style/mobile.less +11 -0
- package/umd/swipe-load/index.js +88 -36
- package/umd/swipe-load/style/css/index.css +3 -0
- package/umd/swipe-load/style/index.less +7 -0
- package/umd/swipe-load/type.d.ts +29 -0
- package/umd/tabs/index.js +1 -0
@@ -4,14 +4,21 @@
|
|
4
4
|
position: relative;
|
5
5
|
display: inline-flex;
|
6
6
|
width: 100%;
|
7
|
+
|
7
8
|
.@{prefix}-list-area {
|
8
9
|
position: relative;
|
9
10
|
width: 100%;
|
11
|
+
|
12
|
+
&::-webkit-scrollbar {
|
13
|
+
display: none;
|
14
|
+
}
|
10
15
|
}
|
16
|
+
|
11
17
|
.@{prefix}-loading-area {
|
12
18
|
.use-var(background-color, swipe-load-label-background);
|
13
19
|
margin-top: 0;
|
14
20
|
.use-var(border-radius, swipe-load-label-border-radius);
|
21
|
+
|
15
22
|
.@{prefix}-loading-label {
|
16
23
|
.use-var(margin-left, swipe-load-label-text-margin-left);
|
17
24
|
.use-var(width, swipe-load-label-text-width);
|
package/cjs/swipe-load/type.d.ts
CHANGED
@@ -77,6 +77,35 @@ export interface SwipeLoadProps {
|
|
77
77
|
* @default_en "Release to view"
|
78
78
|
*/
|
79
79
|
activeText?: string;
|
80
|
+
/**
|
81
|
+
* 触碰左侧边界时是否需要回弹效果
|
82
|
+
* @en Whether a bounce effect is required when touching the left boundary
|
83
|
+
* @default false
|
84
|
+
*/
|
85
|
+
bounceWhenBumpBoundary?: boolean;
|
86
|
+
/**
|
87
|
+
* 当开启回弹效果时的阻尼系数
|
88
|
+
* @en Damping coefficient when the rebound effect is turned on
|
89
|
+
* @default 3
|
90
|
+
*/
|
91
|
+
bounceDampRate?: number;
|
92
|
+
/**
|
93
|
+
* 当开启回弹效果时的动画毫秒时间
|
94
|
+
* @en Animation in milliseconds when the bounce effect is turned on
|
95
|
+
* @default 300
|
96
|
+
*/
|
97
|
+
bounceAnimateDuration?: number;
|
98
|
+
/**
|
99
|
+
* 回弹效果开启时需要回弹的容器,默认为 getScrollContainer 返回的容器或容器的一个子元素
|
100
|
+
* @en The container that needs to be rebounded when the rebound effect is enabled, the default is the container returned by getScrollContainer or a child element of the container
|
101
|
+
*/
|
102
|
+
getBounceContainer?: () => HTMLElement | null;
|
103
|
+
/**
|
104
|
+
* 当开启回弹效果时自定义手指滑动跟手的距离计算方式,dis表示touchmove的距离
|
105
|
+
* @en When the rebound effect is turned on, customize the calculation method of the distance between the finger sliding and the hand, and dis indicates the distance of touchmove
|
106
|
+
* @default (dis) => Math.min(dis, bounceScrollContainer.offsetWidth) / bounceDampRate
|
107
|
+
*/
|
108
|
+
bounceDistanceProcessor?: (dis: number) => number;
|
80
109
|
/**
|
81
110
|
* 抛出外层touch事件,便于自定义,常用于阻止划动退出,切换tab等手势冲突
|
82
111
|
* @en Throw the outer touchstart event, which is easy to customize. It is often used to prevent gesture conflicts such as swiping to exit, switching tabs, etc.
|
package/cjs/tabs/index.js
CHANGED
@@ -246,6 +246,7 @@ var Tabs = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
246
246
|
// 利用受控手动更改index时,给cell line加上动画
|
247
247
|
// @en Animate the cell line when changeing the index
|
248
248
|
setCellTrans(true);
|
249
|
+
changeFromRef.current = 'manual';
|
249
250
|
}, [activeTab]);
|
250
251
|
(0, _helpers.useUpdateEffect)(function () {
|
251
252
|
onDistanceChange && onDistanceChange(distance, wrapWidth, activeIndex);
|
package/dist/index.js
CHANGED
@@ -3662,6 +3662,13 @@
|
|
3662
3662
|
}, {});
|
3663
3663
|
return newStyle;
|
3664
3664
|
}
|
3665
|
+
function setStyleWithVendor(dom, style) {
|
3666
|
+
var vendorStyle = getStyleWithVendor(style);
|
3667
|
+
|
3668
|
+
for (var key in vendorStyle) {
|
3669
|
+
dom.style[key] = vendorStyle[key];
|
3670
|
+
}
|
3671
|
+
}
|
3665
3672
|
/**
|
3666
3673
|
* 计算默认值,仅未定义时使用默认值
|
3667
3674
|
* @desc {en} Calculate the default value, use default value only if undefined
|
@@ -15205,6 +15212,18 @@
|
|
15205
15212
|
|
15206
15213
|
var listeners = {};
|
15207
15214
|
var onOnceEmittedListeners = {};
|
15215
|
+
/**
|
15216
|
+
* Intersection Observer 同一 root 节点下的监听队列
|
15217
|
+
* @en Intersection Observer Listening queue under the same root node
|
15218
|
+
*/
|
15219
|
+
|
15220
|
+
var ioListeners = [];
|
15221
|
+
/**
|
15222
|
+
* Intersection Observer 监听 visible 状态队列
|
15223
|
+
* @en Intersection Observer listens to the visible status queue
|
15224
|
+
*/
|
15225
|
+
|
15226
|
+
var ioVisibleList = [];
|
15208
15227
|
var throttlingVisibleChange;
|
15209
15228
|
/**
|
15210
15229
|
* 通过滚动事件监测 children 是否进入视口或离开视口。
|
@@ -15252,12 +15271,6 @@
|
|
15252
15271
|
*/
|
15253
15272
|
|
15254
15273
|
var domRefParent = React.useRef(null);
|
15255
|
-
/**
|
15256
|
-
* 当前元素是否在可视区域内
|
15257
|
-
* @en Whether the current element is in the visible area
|
15258
|
-
*/
|
15259
|
-
|
15260
|
-
var isVisible = React.useRef(false);
|
15261
15274
|
/**
|
15262
15275
|
* 保存当前节点信息,类似于 class component 中 this
|
15263
15276
|
* @en Save current node information, similar to this in class component
|
@@ -15304,10 +15317,8 @@
|
|
15304
15317
|
* @en Reset the initial visible state of the element to false, and re-detect the visibility of the element, the priority is lower than 'disabled'(Usually used to re-listen when elements inside ShowMonitor change)
|
15305
15318
|
*/
|
15306
15319
|
flushVisibleStatus: function flushVisibleStatus() {
|
15307
|
-
|
15308
|
-
|
15309
|
-
if (isSupportNativeApi && io.current && domRef.current) {
|
15310
|
-
disabled ? io.current.unobserve(domRef.current) : io.current.observe(domRef.current);
|
15320
|
+
if (isSupportNativeApi) {
|
15321
|
+
disabled ? ioUnobserve() : ioObserve();
|
15311
15322
|
} else if (listener.current) {
|
15312
15323
|
var key = wrapperKey.current;
|
15313
15324
|
|
@@ -15371,7 +15382,7 @@
|
|
15371
15382
|
*/
|
15372
15383
|
|
15373
15384
|
|
15374
|
-
curVisible !== preVisible
|
15385
|
+
curVisible !== preVisible && handleCheckChildrenExist() && onCompVisibleChange(curVisible, node);
|
15375
15386
|
var key = wrapperKey.current;
|
15376
15387
|
/**
|
15377
15388
|
* 监听一次后加入 pendingList 队列,随后被 listeners 过滤掉
|
@@ -15387,8 +15398,7 @@
|
|
15387
15398
|
*/
|
15388
15399
|
|
15389
15400
|
|
15390
|
-
curVisible && !preVisible
|
15391
|
-
preVisible.current = curVisible;
|
15401
|
+
curVisible && !preVisible && compOnce && onOnceEmittedListeners[key].push(component);
|
15392
15402
|
}
|
15393
15403
|
|
15394
15404
|
var checkVisibleHandler = React.useCallback(function () {
|
@@ -15408,22 +15418,98 @@
|
|
15408
15418
|
}
|
15409
15419
|
|
15410
15420
|
function handleObserverStatusChange(entries) {
|
15411
|
-
|
15421
|
+
entries.forEach(function (entry) {
|
15422
|
+
var isIntersecting = entry.isIntersecting,
|
15423
|
+
target = entry.target;
|
15424
|
+
var visibleItem = ioVisibleList.find(function (item) {
|
15425
|
+
return item.node === target;
|
15426
|
+
});
|
15412
15427
|
|
15413
|
-
|
15414
|
-
|
15415
|
-
|
15416
|
-
|
15417
|
-
|
15428
|
+
if (visibleItem) {
|
15429
|
+
var curVisible = visibleItem.isVisible,
|
15430
|
+
onCompVisibleChange = visibleItem.onVisibleChange,
|
15431
|
+
onceEmit = visibleItem.once;
|
15432
|
+
/**
|
15433
|
+
* 当前元素 visible 对比之前发生改变,触发回调函数
|
15434
|
+
* @en Callback when the visible status of current element changes before the comparison
|
15435
|
+
*/
|
15418
15436
|
|
15419
|
-
|
15420
|
-
|
15421
|
-
|
15422
|
-
|
15423
|
-
|
15437
|
+
isIntersecting !== curVisible && handleCheckChildrenExist() && onCompVisibleChange(isIntersecting, target);
|
15438
|
+
/**
|
15439
|
+
* 当前元素状态由不可见变为可见,且只触发一次
|
15440
|
+
* @en The current element is invisible -> visible, and once, triggers the callback
|
15441
|
+
*/
|
15424
15442
|
|
15425
|
-
|
15426
|
-
|
15443
|
+
isIntersecting && !curVisible && onceEmit && target && ioUnobserve(target);
|
15444
|
+
visibleItem.isVisible = isIntersecting;
|
15445
|
+
}
|
15446
|
+
});
|
15447
|
+
}
|
15448
|
+
/**
|
15449
|
+
* 获取 io 单例
|
15450
|
+
* @en Get the io singleton
|
15451
|
+
*/
|
15452
|
+
|
15453
|
+
|
15454
|
+
function getIOSingleton(ioOptions) {
|
15455
|
+
var root = ioOptions.root,
|
15456
|
+
rootMargin = ioOptions.rootMargin,
|
15457
|
+
ioThreshold = ioOptions.threshold;
|
15458
|
+
var ioKey = JSON.stringify({
|
15459
|
+
rootMargin: rootMargin,
|
15460
|
+
threshold: ioThreshold
|
15461
|
+
});
|
15462
|
+
|
15463
|
+
var _ioListener = ioListeners.find(function (ioListener) {
|
15464
|
+
return ioListener.root === root && ioListener.key === ioKey;
|
15465
|
+
});
|
15466
|
+
|
15467
|
+
if (!_ioListener) {
|
15468
|
+
ioListeners.push({
|
15469
|
+
root: root,
|
15470
|
+
key: ioKey,
|
15471
|
+
listener: io.current = new IntersectionObserver(handleObserverStatusChange, ioOptions)
|
15472
|
+
});
|
15473
|
+
} else {
|
15474
|
+
io.current = _ioListener.listener;
|
15475
|
+
}
|
15476
|
+
}
|
15477
|
+
|
15478
|
+
function ioObserve() {
|
15479
|
+
if (domRef.current && io.current) {
|
15480
|
+
var curIdx = ioVisibleList.findIndex(function (ioVisibleItem) {
|
15481
|
+
return ioVisibleItem.node === domRef.current;
|
15482
|
+
});
|
15483
|
+
|
15484
|
+
if (curIdx !== -1) {
|
15485
|
+
ioVisibleList[curIdx].isVisible = false;
|
15486
|
+
} else {
|
15487
|
+
ioVisibleList.push({
|
15488
|
+
node: domRef.current,
|
15489
|
+
isVisible: false,
|
15490
|
+
once: once,
|
15491
|
+
onVisibleChange: onVisibleChange
|
15492
|
+
});
|
15493
|
+
}
|
15494
|
+
|
15495
|
+
io.current.observe(domRef.current);
|
15496
|
+
}
|
15497
|
+
}
|
15498
|
+
|
15499
|
+
function ioUnobserve(target) {
|
15500
|
+
var targetNode = target || domRef.current;
|
15501
|
+
|
15502
|
+
if (io.current && targetNode) {
|
15503
|
+
var curIdx = ioVisibleList.findIndex(function (ioVisibleItem) {
|
15504
|
+
return ioVisibleItem.node === targetNode;
|
15505
|
+
});
|
15506
|
+
|
15507
|
+
if (curIdx !== -1) {
|
15508
|
+
ioVisibleList.splice(curIdx, 1);
|
15509
|
+
}
|
15510
|
+
|
15511
|
+
io.current.unobserve(targetNode);
|
15512
|
+
}
|
15427
15513
|
}
|
15428
15514
|
/**
|
15429
15515
|
* 非首次下disabled变化时,重新监听元素
|
@@ -15433,14 +15519,11 @@
|
|
15433
15519
|
|
15434
15520
|
React.useEffect(function () {
|
15435
15521
|
if (isSupportNativeApi) {
|
15436
|
-
//
|
15522
|
+
// 非首次 render 下
|
15437
15523
|
// @en Not for the first time
|
15438
|
-
|
15439
|
-
// 禁用监听 || 监听
|
15440
|
-
disabled ? io.current.unobserve(domRef.current) : io.current.observe(domRef.current);
|
15441
|
-
}
|
15524
|
+
disabled ? ioUnobserve() : ioObserve();
|
15442
15525
|
} else {
|
15443
|
-
//
|
15526
|
+
// 非首次 render 下
|
15444
15527
|
// @en Not for the first time
|
15445
15528
|
if (wrapperKey.current !== -1 && listener.current && listeners[wrapperKey.current]) {
|
15446
15529
|
// 禁用监听,找到对应listener并删除
|
@@ -15504,12 +15587,12 @@
|
|
15504
15587
|
rootMargin_1 = offset + "px";
|
15505
15588
|
}
|
15506
15589
|
|
15507
|
-
|
15590
|
+
getIOSingleton({
|
15508
15591
|
root: root,
|
15509
15592
|
rootMargin: rootMargin_1,
|
15510
15593
|
threshold: threshold
|
15511
15594
|
});
|
15512
|
-
!disabled &&
|
15595
|
+
!disabled && ioObserve();
|
15513
15596
|
}
|
15514
15597
|
} else {
|
15515
15598
|
// 节流后回调函数
|
@@ -15553,7 +15636,7 @@
|
|
15553
15636
|
|
15554
15637
|
listener.current = {
|
15555
15638
|
node: domRef.current,
|
15556
|
-
isVisible:
|
15639
|
+
isVisible: false,
|
15557
15640
|
overflow: overflow,
|
15558
15641
|
once: once,
|
15559
15642
|
offset: offset,
|
@@ -15569,10 +15652,8 @@
|
|
15569
15652
|
}, []);
|
15570
15653
|
React.useEffect(function () {
|
15571
15654
|
return function () {
|
15572
|
-
var _a;
|
15573
|
-
|
15574
15655
|
if (isSupportNativeApi) {
|
15575
|
-
|
15656
|
+
ioUnobserve();
|
15576
15657
|
} else {
|
15577
15658
|
if (overflow) {
|
15578
15659
|
var parent_3 = domRefParent.current;
|
@@ -21550,11 +21631,14 @@
|
|
21550
21631
|
|
21551
21632
|
changeStatus('loading', scene);
|
21552
21633
|
getData === null || getData === void 0 ? void 0 : getData(function (st) {
|
21553
|
-
lastScrollEndRef.current = false;
|
21554
21634
|
changeStatus(st, 'manual');
|
21555
21635
|
});
|
21556
21636
|
}, [blockWhenLoading, changeStatus, getData]);
|
21557
21637
|
React.useEffect(function () {
|
21638
|
+
if (!blockWhenLoading || nowStatus !== 'loading') {
|
21639
|
+
lastScrollEndRef.current = false;
|
21640
|
+
}
|
21641
|
+
|
21558
21642
|
statusRef.current = nowStatus;
|
21559
21643
|
}, [nowStatus]);
|
21560
21644
|
useUpdateEffect(function () {
|
@@ -21811,7 +21895,7 @@
|
|
21811
21895
|
ref: navBarRef,
|
21812
21896
|
className: cls(wrapClass, prefixCls + "-nav-bar", (_b = {}, _b[prefixCls + "-nav-bar-fixed"] = fixed, _b[prefixCls + "-nav-bar-float"] = !placeholder, _b[prefixCls + "-nav-bar-hide"] = scrollToggleHide, _b)),
|
21813
21897
|
style: __assign$2(__assign$2({
|
21814
|
-
paddingTop: fixed && statusBarHeight ? statusBarHeight + "px" : ''
|
21898
|
+
paddingTop: fixed && statusBarHeight ? statusBarHeight + "px" : '0px'
|
21815
21899
|
}, style || {}), relBackground ? {
|
21816
21900
|
background: relBackground
|
21817
21901
|
} : {}),
|
@@ -21820,7 +21904,7 @@
|
|
21820
21904
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
21821
21905
|
className: cls(className, system, prefixCls + "-nav-bar-wrapper", (_c = {}, _c[prefixCls + "-nav-bar-wrapper-fixed"] = fixed, _c[prefixCls + "-nav-bar-wrapper-border"] = hasBottomLine, _c)),
|
21822
21906
|
style: __assign$2({
|
21823
|
-
paddingTop: statusBarHeight ? statusBarHeight + "px" : ''
|
21907
|
+
paddingTop: statusBarHeight ? statusBarHeight + "px" : '0px'
|
21824
21908
|
}, customStyle)
|
21825
21909
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
21826
21910
|
className: prefixCls + "-nav-bar-inner all-border-box"
|
@@ -25903,31 +25987,49 @@
|
|
25903
25987
|
_k = props.activeText,
|
25904
25988
|
activeText = _k === void 0 ? '' : _k,
|
25905
25989
|
_l = props.initPos,
|
25906
|
-
initPos = _l === void 0 ? 0 : _l
|
25907
|
-
|
25908
|
-
|
25990
|
+
initPos = _l === void 0 ? 0 : _l,
|
25991
|
+
_m = props.bounceWhenBumpBoundary,
|
25992
|
+
bounceWhenBumpBoundary = _m === void 0 ? false : _m,
|
25993
|
+
_o = props.bounceDampRate,
|
25994
|
+
bounceDampRate = _o === void 0 ? 3 : _o,
|
25995
|
+
_p = props.bounceAnimateDuration,
|
25996
|
+
bounceAnimateDuration = _p === void 0 ? 300 : _p,
|
25997
|
+
damping = props.damping,
|
25998
|
+
bounceDistanceProcessor = props.bounceDistanceProcessor,
|
25999
|
+
getScrollContainer = props.getScrollContainer,
|
26000
|
+
getBounceContainer = props.getBounceContainer,
|
26001
|
+
onTouchStart = props.onTouchStart,
|
26002
|
+
onTouchEnd = props.onTouchEnd,
|
26003
|
+
onTouchCancel = props.onTouchCancel,
|
26004
|
+
onTouchMove = props.onTouchMove,
|
26005
|
+
renderLabel = props.renderLabel;
|
26006
|
+
var _q = React.useContext(GlobalContext).locale,
|
26007
|
+
locale = _q === void 0 ? defaultLocale : _q;
|
25909
26008
|
|
25910
|
-
var
|
25911
|
-
disableState =
|
25912
|
-
setDisableState =
|
26009
|
+
var _r = React.useState(disabled),
|
26010
|
+
disableState = _r[0],
|
26011
|
+
setDisableState = _r[1];
|
25913
26012
|
|
25914
|
-
var
|
25915
|
-
labelOffsetState =
|
25916
|
-
setLabelOffsetState =
|
26013
|
+
var _s = React.useState(0),
|
26014
|
+
labelOffsetState = _s[0],
|
26015
|
+
setLabelOffsetState = _s[1];
|
25917
26016
|
|
25918
26017
|
var containerRef = React.useRef(null);
|
25919
26018
|
var loadingRef = React.useRef(null);
|
25920
26019
|
var loadingLabelRef = React.useRef(null);
|
25921
26020
|
var showLoadMoreRef = React.useRef(false);
|
25922
26021
|
var ifToRightRef = React.useRef(false);
|
26022
|
+
var bouncingRef = React.useRef(false);
|
25923
26023
|
var offsetRef = React.useRef(0);
|
25924
26024
|
var domRef = React.useRef(null);
|
25925
26025
|
var wrapperEl = domRef.current;
|
25926
|
-
useAddListener(wrapperEl, 'touchstart',
|
25927
|
-
useAddListener(wrapperEl, 'touchend',
|
25928
|
-
useAddListener(wrapperEl, 'touchcancel',
|
25929
|
-
useAddListener(wrapperEl, 'touchmove',
|
26026
|
+
useAddListener(wrapperEl, 'touchstart', onTouchStart);
|
26027
|
+
useAddListener(wrapperEl, 'touchend', onTouchEnd);
|
26028
|
+
useAddListener(wrapperEl, 'touchcancel', onTouchCancel);
|
26029
|
+
useAddListener(wrapperEl, 'touchmove', onTouchMove);
|
25930
26030
|
React.useEffect(function () {
|
26031
|
+
var _a;
|
26032
|
+
|
25931
26033
|
if (disabled || !containerRef.current || disableState) {
|
25932
26034
|
return;
|
25933
26035
|
}
|
@@ -25942,11 +26044,7 @@
|
|
25942
26044
|
} else if (containerRef.current.childNodes.length === 1) {
|
25943
26045
|
// 传入一个子元素 滑动单个元素
|
25944
26046
|
// @en Pass in a child element swipe the single element
|
25945
|
-
|
25946
|
-
scrollContainer = props.getScrollContainer();
|
25947
|
-
} else {
|
25948
|
-
scrollContainer = containerRef.current.firstChild;
|
25949
|
-
}
|
26047
|
+
scrollContainer = (_a = getScrollContainer === null || getScrollContainer === void 0 ? void 0 : getScrollContainer()) !== null && _a !== void 0 ? _a : containerRef.current.firstChild;
|
25950
26048
|
} else {
|
25951
26049
|
// 传入多个子元素(列表元素为例) 组件控制自行滑动 不推荐
|
25952
26050
|
// @en Pass in multiple sub-elements (list elements as an example) Component control slides by itself which is not recommended
|
@@ -25966,17 +26064,20 @@
|
|
25966
26064
|
|
25967
26065
|
if (!loadingCurrent) {
|
25968
26066
|
return;
|
25969
|
-
}
|
25970
|
-
// @en Initially no labels are displayed
|
26067
|
+
}
|
25971
26068
|
|
26069
|
+
var bounceScrollContainer = (getBounceContainer === null || getBounceContainer === void 0 ? void 0 : getBounceContainer()) || scrollContainer; // 初始不显示标签
|
26070
|
+
// @en Initially no labels are displayed
|
25972
26071
|
|
25973
26072
|
loadingCurrent.style.display = 'none';
|
25974
26073
|
var startX = 0;
|
25975
|
-
var endX = 0;
|
26074
|
+
var endX = 0;
|
26075
|
+
var bounceDistance = 0; // 触摸页面确定X起始坐标
|
25976
26076
|
// @en Determine the X starting coordinate on touchstart
|
25977
26077
|
|
25978
26078
|
var touchstart = function touchstart(e) {
|
25979
|
-
|
26079
|
+
var evt = e.touches[0];
|
26080
|
+
startX = evt.clientX || 0;
|
25980
26081
|
}; // 页面滑动确定X终止坐标,更新手指的X坐标,改变loading中的文字和大小
|
25981
26082
|
// @en Determine the X end coordinate, update the X coordinate of the finger, change the text and size in the loading on touchmove
|
25982
26083
|
|
@@ -25988,12 +26089,30 @@
|
|
25988
26089
|
scrollContainer.scrollLeft = 1;
|
25989
26090
|
}
|
25990
26091
|
|
25991
|
-
endX = e.touches[0].
|
26092
|
+
endX = e.touches[0].clientX || 0;
|
25992
26093
|
var diff = endX - startX;
|
25993
26094
|
offsetRef.current = diff;
|
25994
|
-
var labelDiff = fingerDisToLabelDis(Math.abs(diff),
|
26095
|
+
var labelDiff = fingerDisToLabelDis(Math.abs(diff), damping); // 滑动到最左侧,处理回弹效果
|
26096
|
+
// @en Swipe to the far left to handle the rebound effect
|
26097
|
+
|
26098
|
+
if (diff > 0 && scrollContainer.scrollLeft <= 1 && bounceWhenBumpBoundary) {
|
26099
|
+
e.stopPropagation();
|
26100
|
+
e.cancelBubble && e.preventDefault();
|
26101
|
+
bouncingRef.current = true;
|
26102
|
+
|
26103
|
+
var processor = bounceDistanceProcessor || function (dis) {
|
26104
|
+
return Math.min(dis, bounceScrollContainer.offsetWidth) / bounceDampRate;
|
26105
|
+
};
|
26106
|
+
|
26107
|
+
bounceDistance = processor(diff);
|
26108
|
+
setStyleWithVendor(bounceScrollContainer, {
|
26109
|
+
transition: 'none',
|
26110
|
+
transform: "translateX(" + bounceDistance + "px) translateZ(0)"
|
26111
|
+
});
|
26112
|
+
} // 向左滑动到尽头 '更多'标签加载 根据scrollLeft判断 滚动容器到达边缘触发 非滚动容器不判断
|
25995
26113
|
// @en Swipe left to the end and the 'more' label is loaded. Judging by scrollLeft, the scroll container reaches the edge and the non-scroll container does not judge
|
25996
26114
|
|
26115
|
+
|
25997
26116
|
if (diff < 0 && (scrollContainer.scrollLeft + scrollContainer.clientWidth >= scrollContainer.scrollWidth - 1 || !scrollContainer.scrollLeft) && !ifToRightRef.current) {
|
25998
26117
|
showLoadMoreRef.current = true;
|
25999
26118
|
loadingCurrent.style.display = 'flex';
|
@@ -26019,12 +26138,14 @@
|
|
26019
26138
|
loadingLabelCurrent.innerHTML = labelDiff >= minConfirmOffset ? activeText || locale.SwipeLoad.activeText : normalText || locale.SwipeLoad.normalText;
|
26020
26139
|
}
|
26021
26140
|
|
26022
|
-
loadingCurrent
|
26023
|
-
|
26024
|
-
|
26025
|
-
|
26026
|
-
scrollContainer
|
26027
|
-
|
26141
|
+
setStyleWithVendor(loadingCurrent, {
|
26142
|
+
transition: 'none',
|
26143
|
+
transform: "translateX(-" + labelRightMargin + "px) translateZ(0)"
|
26144
|
+
});
|
26145
|
+
setStyleWithVendor(scrollContainer, {
|
26146
|
+
transition: 'none',
|
26147
|
+
transform: "translateX(-" + listRightMargin + "px) translateZ(0)"
|
26148
|
+
});
|
26028
26149
|
}
|
26029
26150
|
|
26030
26151
|
if (diff > 0 && scrollContainer.scrollLeft + scrollContainer.clientWidth <= scrollContainer.scrollWidth - 1) {
|
@@ -26049,13 +26170,28 @@
|
|
26049
26170
|
var labelDiff = fingerDisToLabelDis(Math.abs(diff));
|
26050
26171
|
|
26051
26172
|
var resumeAnimation = function resumeAnimation() {
|
26052
|
-
|
26053
|
-
|
26054
|
-
|
26055
|
-
|
26056
|
-
|
26057
|
-
|
26058
|
-
|
26173
|
+
if (showLoadMoreRef.current) {
|
26174
|
+
showLoadMoreRef.current = false;
|
26175
|
+
var scrollTransitionCssStyle = "all " + labelAnimationDuration + "ms " + labelAnimationFunction;
|
26176
|
+
var scrollTransformCssStyle = 'translateX(0px) translateZ(0)';
|
26177
|
+
setStyleWithVendor(scrollContainer, {
|
26178
|
+
transition: scrollTransitionCssStyle,
|
26179
|
+
transform: scrollTransformCssStyle
|
26180
|
+
});
|
26181
|
+
setStyleWithVendor(loadingCurrent, {
|
26182
|
+
transition: scrollTransitionCssStyle,
|
26183
|
+
transform: scrollTransformCssStyle
|
26184
|
+
});
|
26185
|
+
}
|
26186
|
+
|
26187
|
+
if (bouncingRef.current) {
|
26188
|
+
bouncingRef.current = false;
|
26189
|
+
setStyleWithVendor(bounceScrollContainer, {
|
26190
|
+
transition: "all " + bounceAnimateDuration + "ms",
|
26191
|
+
transform: 'translateX(0px) translateZ(0)'
|
26192
|
+
});
|
26193
|
+
}
|
26194
|
+
|
26059
26195
|
ifToRightRef.current = false;
|
26060
26196
|
setTimeout(function () {
|
26061
26197
|
loadingCurrent.style.display = 'none';
|
@@ -26085,7 +26221,7 @@
|
|
26085
26221
|
scrollContainer.removeEventListener('touchmove', touchmove);
|
26086
26222
|
scrollContainer.removeEventListener('touchend', touchend);
|
26087
26223
|
};
|
26088
|
-
}, [disabled]);
|
26224
|
+
}, [disabled, getScrollContainer, getBounceContainer, bounceWhenBumpBoundary, bounceDampRate, bounceAnimateDuration]);
|
26089
26225
|
React.useImperativeHandle(ref, function () {
|
26090
26226
|
return {
|
26091
26227
|
dom: domRef.current
|
@@ -26099,14 +26235,14 @@
|
|
26099
26235
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
26100
26236
|
className: cls(prefixCls + "-list-area"),
|
26101
26237
|
ref: containerRef
|
26102
|
-
}, children),
|
26238
|
+
}, children), renderLabel ? /*#__PURE__*/React__default["default"].createElement("div", {
|
26103
26239
|
className: cls(prefixCls + "-custom-loading-area"),
|
26104
26240
|
ref: loadingRef,
|
26105
26241
|
style: {
|
26106
26242
|
position: 'absolute',
|
26107
26243
|
right: initPos + "px"
|
26108
26244
|
}
|
26109
|
-
},
|
26245
|
+
}, renderLabel.length ? renderLabel(labelOffsetState) : renderLabel()) : /*#__PURE__*/React__default["default"].createElement("div", {
|
26110
26246
|
className: cls(prefixCls + "-loading-area"),
|
26111
26247
|
ref: loadingRef,
|
26112
26248
|
style: {
|
@@ -27501,6 +27637,7 @@
|
|
27501
27637
|
// 利用受控手动更改index时,给cell line加上动画
|
27502
27638
|
// @en Animate the cell line when changeing the index
|
27503
27639
|
setCellTrans(true);
|
27640
|
+
changeFromRef.current = 'manual';
|
27504
27641
|
}, [activeTab]);
|
27505
27642
|
useUpdateEffect(function () {
|
27506
27643
|
onDistanceChange && onDistanceChange(distance, wrapWidth, activeIndex);
|