@arco-design/mobile-react 2.27.1 → 2.27.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.
Files changed (59) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.en-US.md +2 -2
  3. package/README.md +2 -2
  4. package/cjs/_helpers/index.d.ts +1 -0
  5. package/cjs/_helpers/index.js +10 -0
  6. package/cjs/index-bar/type.d.ts +3 -3
  7. package/cjs/load-more/index.js +4 -1
  8. package/cjs/nav-bar/index.js +2 -2
  9. package/cjs/show-monitor/index.js +112 -38
  10. package/cjs/swipe-load/demo/style/css/mobile.css +3 -0
  11. package/cjs/swipe-load/demo/style/mobile.less +11 -0
  12. package/cjs/swipe-load/index.js +86 -32
  13. package/cjs/swipe-load/style/css/index.css +3 -0
  14. package/cjs/swipe-load/style/index.less +7 -0
  15. package/cjs/swipe-load/type.d.ts +29 -0
  16. package/cjs/tabs/index.js +6 -2
  17. package/cjs/tabs/style/css/index.css +4 -0
  18. package/cjs/tabs/style/index.less +5 -0
  19. package/cjs/tabs/tab-pane.js +49 -12
  20. package/cjs/tabs/type.d.ts +7 -1
  21. package/dist/index.js +297 -119
  22. package/dist/index.min.js +5 -5
  23. package/dist/style.css +7 -0
  24. package/dist/style.min.css +1 -1
  25. package/esm/_helpers/index.d.ts +1 -0
  26. package/esm/_helpers/index.js +7 -0
  27. package/esm/index-bar/type.d.ts +3 -3
  28. package/esm/load-more/index.js +4 -1
  29. package/esm/nav-bar/index.js +2 -2
  30. package/esm/show-monitor/index.js +112 -38
  31. package/esm/swipe-load/demo/style/css/mobile.css +3 -0
  32. package/esm/swipe-load/demo/style/mobile.less +11 -0
  33. package/esm/swipe-load/index.js +85 -32
  34. package/esm/swipe-load/style/css/index.css +3 -0
  35. package/esm/swipe-load/style/index.less +7 -0
  36. package/esm/swipe-load/type.d.ts +29 -0
  37. package/esm/tabs/index.js +6 -2
  38. package/esm/tabs/style/css/index.css +4 -0
  39. package/esm/tabs/style/index.less +5 -0
  40. package/esm/tabs/tab-pane.js +49 -11
  41. package/esm/tabs/type.d.ts +7 -1
  42. package/package.json +3 -3
  43. package/umd/_helpers/index.d.ts +1 -0
  44. package/umd/_helpers/index.js +10 -0
  45. package/umd/index-bar/type.d.ts +3 -3
  46. package/umd/load-more/index.js +4 -1
  47. package/umd/nav-bar/index.js +2 -2
  48. package/umd/show-monitor/index.js +112 -38
  49. package/umd/swipe-load/demo/style/css/mobile.css +3 -0
  50. package/umd/swipe-load/demo/style/mobile.less +11 -0
  51. package/umd/swipe-load/index.js +88 -36
  52. package/umd/swipe-load/style/css/index.css +3 -0
  53. package/umd/swipe-load/style/index.less +7 -0
  54. package/umd/swipe-load/type.d.ts +29 -0
  55. package/umd/tabs/index.js +6 -2
  56. package/umd/tabs/style/css/index.css +4 -0
  57. package/umd/tabs/style/index.less +5 -0
  58. package/umd/tabs/tab-pane.js +49 -12
  59. package/umd/tabs/type.d.ts +7 -1
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
- isVisible.current = false;
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.current && handleCheckChildrenExist() && onCompVisibleChange(curVisible, node);
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.current && compOnce && onOnceEmittedListeners[key].push(component);
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
- var _a;
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
- var isIntersecting = entries[0].isIntersecting;
15414
- /**
15415
- * 当前元素 visible 对比之前发生改变,触发回调函数
15416
- * @en Callback when the visible status of current element changes before the comparison
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
- isIntersecting !== isVisible.current && handleCheckChildrenExist() && onVisibleChange(isIntersecting, domRef.current);
15420
- /**
15421
- * 当前元素不可见 -> 可见,且 once, 触发回调函数
15422
- * @en The current element is invisible -> visible, and once, triggers the callback
15423
- */
15437
+ isIntersecting !== curVisible && handleCheckChildrenExist() && onCompVisibleChange(isIntersecting, target);
15438
+ /**
15439
+ * 当前元素状态由不可见变为可见,且只触发一次
15440
+ * @en The current element is invisible -> visible, and once, triggers the callback
15441
+ */
15442
+
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
+ });
15424
15466
 
15425
- isIntersecting && !isVisible.current && once && domRef.current && ((_a = io.current) === null || _a === void 0 ? void 0 : _a.unobserve(domRef.current));
15426
- isVisible.current = isIntersecting;
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
- if (io.current && domRef.current) {
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
- io.current = new IntersectionObserver(handleObserverStatusChange, {
15590
+ getIOSingleton({
15508
15591
  root: root,
15509
15592
  rootMargin: rootMargin_1,
15510
15593
  threshold: threshold
15511
15594
  });
15512
- !disabled && io.current.observe(domRef.current);
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: 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
- domRef.current && ((_a = io.current) === null || _a === void 0 ? void 0 : _a.unobserve(domRef.current));
15656
+ ioUnobserve();
15576
15657
  } else {
15577
15658
  if (overflow) {
15578
15659
  var parent_3 = domRefParent.current;
@@ -17403,7 +17484,7 @@
17403
17484
  var index$b = componentWrapper(ImagePicker, 'ImagePicker');
17404
17485
 
17405
17486
  /*!
17406
- * @arco-design/transformable v1.0.2
17487
+ * @arco-design/transformable v1.0.1
17407
17488
  * (c) 2022 ludan.kibbon
17408
17489
  */
17409
17490
  function _defineProperty(obj, key, value) {
@@ -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
- var _m = React.useContext(GlobalContext).locale,
25908
- locale = _m === void 0 ? defaultLocale : _m;
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 _o = React.useState(disabled),
25911
- disableState = _o[0],
25912
- setDisableState = _o[1];
26009
+ var _r = React.useState(disabled),
26010
+ disableState = _r[0],
26011
+ setDisableState = _r[1];
25913
26012
 
25914
- var _p = React.useState(0),
25915
- labelOffsetState = _p[0],
25916
- setLabelOffsetState = _p[1];
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', props.onTouchStart);
25927
- useAddListener(wrapperEl, 'touchend', props.onTouchEnd);
25928
- useAddListener(wrapperEl, 'touchcancel', props.onTouchCancel);
25929
- useAddListener(wrapperEl, 'touchmove', props.onTouchMove);
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
- if (props.getScrollContainer) {
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; // 触摸页面确定X起始坐标
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
- startX = e.touches[0].pageX;
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].pageX;
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), props.damping); // 向左滑动到尽头 '更多'标签加载 根据scrollLeft判断 滚动容器到达边缘触发 非滚动容器不判断
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.style.transition = 'all 0.02s';
26023
- loadingCurrent.style.webkitTransform = "translateX(-" + labelRightMargin + "px)";
26024
- loadingCurrent.style.transform = "translateX(-" + labelRightMargin + "px)";
26025
- scrollContainer.style.transition = 'all 0.03s';
26026
- scrollContainer.style.webkitTransform = "translateX(-" + listRightMargin + "px)";
26027
- scrollContainer.style.transform = "translateX(-" + listRightMargin + "px)";
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
- scrollContainer.style.transition = "all " + labelAnimationDuration + "ms " + labelAnimationFunction;
26053
- scrollContainer.style.webkitTransform = 'translateX(0px)';
26054
- scrollContainer.style.transform = 'translateX(0px)';
26055
- loadingCurrent.style.transition = "all " + labelAnimationDuration + "ms " + labelAnimationFunction;
26056
- loadingCurrent.style.webkitTransform = 'translateX(0px)';
26057
- loadingCurrent.style.transform = 'translateX(0px)';
26058
- showLoadMoreRef.current = false;
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), props.renderLabel ? /*#__PURE__*/React__default["default"].createElement("div", {
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
- }, props.renderLabel.length ? props.renderLabel(labelOffsetState) : props.renderLabel()) : /*#__PURE__*/React__default["default"].createElement("div", {
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: {
@@ -27032,6 +27168,7 @@
27032
27168
  translateZ = props.translateZ,
27033
27169
  fullScreen = props.fullScreen,
27034
27170
  autoHeight = props.autoHeight,
27171
+ swipeEnergySaving = props.swipeEnergySaving,
27035
27172
  changeIndex = props.changeIndex,
27036
27173
  onScroll = props.onScroll;
27037
27174
  var domRef = React.useRef(null);
@@ -27043,12 +27180,16 @@
27043
27180
  shownIndexes = _c[0],
27044
27181
  setShownIndexes = _c[1];
27045
27182
 
27183
+ var _d = React.useState(activeIndex),
27184
+ shownActiveIndex = _d[0],
27185
+ setShownActiveIndex = _d[1];
27186
+
27046
27187
  var prefix = prefixCls + "-tab-pane";
27047
27188
  var handleTouchEnd = swipeable ? handlePaneTouchEnd : void 0;
27048
27189
 
27049
- var _d = React.useState('auto'),
27050
- currentPaneHeight = _d[0],
27051
- setCurrentPaneHeight = _d[1];
27190
+ var _e = React.useState('auto'),
27191
+ currentPaneHeight = _e[0],
27192
+ setCurrentPaneHeight = _e[1];
27052
27193
 
27053
27194
  React.useImperativeHandle(ref, function () {
27054
27195
  return {
@@ -27134,6 +27275,8 @@
27134
27275
  }
27135
27276
 
27136
27277
  function calcShownIndexes() {
27278
+ setShownActiveIndex(activeIndex);
27279
+
27137
27280
  if (typeof lazyloadCount === 'number') {
27138
27281
  setShownIndexes([activeIndex - lazyloadCount, activeIndex + lazyloadCount]);
27139
27282
  return;
@@ -27234,11 +27377,35 @@
27234
27377
  var heightStyle = currentPaneHeight && currentPaneHeight !== 'auto' ? {
27235
27378
  height: currentPaneHeight
27236
27379
  } : {};
27237
- return getStyleWithVendor(__assign$2(__assign$2(__assign$2(__assign$2({}, sizeStyle), {
27380
+ return getStyleWithVendor(__assign$2(__assign$2(__assign$2(__assign$2({}, swipeEnergySaving ? {} : sizeStyle), {
27238
27381
  transitionDuration: getTransition() + "ms"
27239
27382
  }), heightStyle), commonStyle));
27240
27383
  }
27241
27384
 
27385
+ function getEnergySavingPaneStyle(index) {
27386
+ if (mode === 'scroll' || !swipeEnergySaving) {
27387
+ return undefined;
27388
+ }
27389
+
27390
+ if (index !== shownActiveIndex) {
27391
+ return {
27392
+ position: 'absolute',
27393
+ left: '-100%',
27394
+ top: '-100%'
27395
+ };
27396
+ }
27397
+
27398
+ var translateStr = translateZ ? ' translateZ(0)' : '';
27399
+ var sizeStyle = tabDirection === 'vertical' ? {
27400
+ transform: "translateX(" + (distance - wrapWidth * (activeIndex - index)) + "px)" + translateStr
27401
+ } : {
27402
+ transform: "translateY(" + (distance - wrapHeight * (activeIndex - index)) + "px)" + translateStr
27403
+ };
27404
+ return getStyleWithVendor(__assign$2(__assign$2({}, sizeStyle), {
27405
+ transitionDuration: getTransition() + "ms"
27406
+ }));
27407
+ }
27408
+
27242
27409
  function renderContent(pane, index) {
27243
27410
  var contentProps = {
27244
27411
  key: index,
@@ -27248,32 +27415,39 @@
27248
27415
  ref: function ref(r) {
27249
27416
  return panesRef.current[index] = r;
27250
27417
  }
27251
- }; // 是滚动模式或在加载范围内,直接渲染
27418
+ };
27419
+ var energySavingStyle = getEnergySavingPaneStyle(index); // 是滚动模式或在加载范围内,直接渲染
27252
27420
  // @en Render directly when in scroll mode or in loading scope
27253
27421
 
27254
27422
  if (mode === 'scroll' || index >= shownIndexes[0] && index <= shownIndexes[1]) {
27255
- return /*#__PURE__*/React__default["default"].createElement("div", __assign$2({}, contentProps), pane);
27256
- } // 不在加载范围内,视renderHideContent和hideContentStyle情况而定
27423
+ return /*#__PURE__*/React__default["default"].createElement("div", __assign$2({}, contentProps, {
27424
+ style: energySavingStyle
27425
+ }), pane);
27426
+ }
27427
+
27428
+ var energySavingHideStyle = __assign$2(__assign$2({}, energySavingStyle), hideContentStyle || {}); // 不在加载范围内,视renderHideContent和hideContentStyle情况而定
27257
27429
  // @en Not in the loading range, depending on renderHideContent and hideContentStyle
27258
27430
 
27259
27431
 
27260
27432
  if (renderHideContent) {
27261
27433
  return /*#__PURE__*/React__default["default"].createElement("div", __assign$2({}, contentProps, {
27262
- style: hideContentStyle || {}
27434
+ style: energySavingHideStyle
27263
27435
  }), renderHideContent(index, pane));
27264
27436
  }
27265
27437
 
27266
27438
  if (hideContentStyle === null) {
27267
- return /*#__PURE__*/React__default["default"].createElement("div", __assign$2({}, contentProps));
27439
+ return /*#__PURE__*/React__default["default"].createElement("div", __assign$2({}, contentProps, {
27440
+ style: energySavingStyle
27441
+ }));
27268
27442
  }
27269
27443
 
27270
27444
  return /*#__PURE__*/React__default["default"].createElement("div", __assign$2({}, contentProps, {
27271
- style: hideContentStyle
27445
+ style: energySavingHideStyle
27272
27446
  }), pane);
27273
27447
  }
27274
27448
 
27275
27449
  return /*#__PURE__*/React__default["default"].createElement("div", {
27276
- className: cls(prefix + "-container", tabDirection, "mode-" + mode, tabPaneClass, {
27450
+ className: cls(prefix + "-container", tabDirection, swipeEnergySaving ? "mode-" + mode + "-energy-saving" : "mode-" + mode, tabPaneClass, {
27277
27451
  'full-screen': fullScreen
27278
27452
  }, (_a = {}, _a["mode-scroll-" + (scrollVertical ? 'vertical' : 'horizontal')] = mode === 'scroll', _a)),
27279
27453
  style: getPaneStyle(),
@@ -27402,44 +27576,46 @@
27402
27576
  fullScreen = props.fullScreen,
27403
27577
  autoHeight = props.autoHeight,
27404
27578
  _6 = props.tabBarStopPropagation,
27405
- tabBarStopPropagation = _6 === void 0 ? true : _6;
27579
+ tabBarStopPropagation = _6 === void 0 ? true : _6,
27580
+ _7 = props.swipeEnergySaving,
27581
+ swipeEnergySaving = _7 === void 0 ? false : _7;
27406
27582
  var domRef = React.useRef(null);
27407
27583
  var cellRef = React.useRef(null);
27408
27584
  var paneRef = React.useRef(null);
27409
27585
 
27410
- var _7 = React.useState(defaultActiveTab),
27411
- innerIndex = _7[0],
27412
- setInnerIndex = _7[1];
27413
-
27414
- var _8 = React.useState(0),
27415
- jumpingDis = _8[0],
27416
- setJumpingDis = _8[1];
27586
+ var _8 = React.useState(defaultActiveTab),
27587
+ innerIndex = _8[0],
27588
+ setInnerIndex = _8[1];
27417
27589
 
27418
27590
  var _9 = React.useState(0),
27419
- wrapWidth = _9[0],
27420
- setWrapWidth = _9[1];
27591
+ jumpingDis = _9[0],
27592
+ setJumpingDis = _9[1];
27421
27593
 
27422
27594
  var _10 = React.useState(0),
27423
- wrapHeight = _10[0],
27424
- setWrapHeight = _10[1];
27595
+ wrapWidth = _10[0],
27596
+ setWrapWidth = _10[1];
27425
27597
 
27426
- var _11 = React.useState(false),
27427
- cellTrans = _11[0],
27428
- setCellTrans = _11[1];
27598
+ var _11 = React.useState(0),
27599
+ wrapHeight = _11[0],
27600
+ setWrapHeight = _11[1];
27429
27601
 
27430
27602
  var _12 = React.useState(false),
27431
- paneTrans = _12[0],
27432
- setPaneTrans = _12[1];
27603
+ cellTrans = _12[0],
27604
+ setCellTrans = _12[1];
27605
+
27606
+ var _13 = React.useState(false),
27607
+ paneTrans = _13[0],
27608
+ setPaneTrans = _13[1];
27433
27609
 
27434
- var _13 = useRefState(activeTab === void 0 ? innerIndex : activeTab),
27435
- activeIndex = _13[0],
27436
- activeIndexRef = _13[1],
27437
- setActiveIndex = _13[2];
27610
+ var _14 = useRefState(activeTab === void 0 ? innerIndex : activeTab),
27611
+ activeIndex = _14[0],
27612
+ activeIndexRef = _14[1],
27613
+ setActiveIndex = _14[2];
27438
27614
 
27439
- var _14 = useRefState(0),
27440
- distance = _14[0],
27441
- distanceRef = _14[1],
27442
- setDistance = _14[2];
27615
+ var _15 = useRefState(0),
27616
+ distance = _15[0],
27617
+ distanceRef = _15[1],
27618
+ setDistance = _15[2];
27443
27619
 
27444
27620
  var posAdjustingRef = React.useRef(false);
27445
27621
  var touchStartedRef = React.useRef(false);
@@ -27501,6 +27677,7 @@
27501
27677
  // 利用受控手动更改index时,给cell line加上动画
27502
27678
  // @en Animate the cell line when changeing the index
27503
27679
  setCellTrans(true);
27680
+ changeFromRef.current = 'manual';
27504
27681
  }, [activeTab]);
27505
27682
  useUpdateEffect(function () {
27506
27683
  onDistanceChange && onDistanceChange(distance, wrapWidth, activeIndex);
@@ -27786,7 +27963,8 @@
27786
27963
  tabPaneClass: tabPaneClass,
27787
27964
  tabPaneExtra: tabPaneExtra,
27788
27965
  autoHeight: autoHeight,
27789
- onScroll: onScroll
27966
+ onScroll: onScroll,
27967
+ swipeEnergySaving: swipeEnergySaving
27790
27968
  }, commonProps)));
27791
27969
  });
27792
27970
  });