@arco-design/mobile-react 2.21.2 → 2.22.0

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 (96) hide show
  1. package/CHANGELOG.md +30 -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 +9 -0
  6. package/cjs/_helpers/react-dom.d.ts +13 -0
  7. package/cjs/_helpers/react-dom.js +65 -0
  8. package/cjs/_helpers/render.d.ts +10 -0
  9. package/cjs/_helpers/render.js +40 -0
  10. package/cjs/action-sheet/index.d.ts +1 -1
  11. package/cjs/ellipsis/components/js-ellipsis.js +7 -1
  12. package/cjs/image-picker/index.js +0 -1
  13. package/cjs/image-picker/style/css/index.d.ts +1 -0
  14. package/cjs/image-picker/style/css/index.js +2 -0
  15. package/cjs/image-picker/style/index.d.ts +1 -0
  16. package/cjs/image-picker/style/index.js +2 -0
  17. package/cjs/image-preview/index.d.ts +2 -10
  18. package/cjs/image-preview/methods.js +4 -11
  19. package/cjs/masking/index.d.ts +10 -0
  20. package/cjs/masking/methods.js +4 -11
  21. package/cjs/notify/methods.js +6 -9
  22. package/cjs/popover/hooks/useEvent.js +6 -6
  23. package/cjs/swipe-action/index.js +21 -3
  24. package/cjs/tabs/index.d.ts +3 -463
  25. package/cjs/tabs/index.js +15 -2
  26. package/cjs/tabs/tab-cell-underline.d.ts +4 -0
  27. package/cjs/tabs/tab-cell-underline.js +234 -0
  28. package/cjs/tabs/tab-cell.d.ts +1 -85
  29. package/cjs/tabs/tab-cell.js +57 -201
  30. package/cjs/tabs/tab-pane.d.ts +2 -38
  31. package/cjs/tabs/type.d.ts +601 -0
  32. package/cjs/tabs/type.js +3 -0
  33. package/cjs/toast/methods.js +9 -12
  34. package/dist/index.js +439 -271
  35. package/dist/index.min.js +3 -3
  36. package/esm/_helpers/index.d.ts +1 -0
  37. package/esm/_helpers/index.js +1 -0
  38. package/esm/_helpers/react-dom.d.ts +13 -0
  39. package/esm/_helpers/react-dom.js +57 -0
  40. package/esm/_helpers/render.d.ts +10 -0
  41. package/esm/_helpers/render.js +29 -0
  42. package/esm/action-sheet/index.d.ts +1 -1
  43. package/esm/ellipsis/components/js-ellipsis.js +7 -1
  44. package/esm/image-picker/index.js +0 -1
  45. package/esm/image-picker/style/css/index.d.ts +1 -0
  46. package/esm/image-picker/style/css/index.js +1 -0
  47. package/esm/image-picker/style/index.d.ts +1 -0
  48. package/esm/image-picker/style/index.js +1 -0
  49. package/esm/image-preview/index.d.ts +2 -10
  50. package/esm/image-preview/methods.js +3 -9
  51. package/esm/masking/index.d.ts +10 -0
  52. package/esm/masking/methods.js +3 -9
  53. package/esm/notify/methods.js +6 -7
  54. package/esm/popover/hooks/useEvent.js +6 -6
  55. package/esm/swipe-action/index.js +21 -3
  56. package/esm/tabs/index.d.ts +3 -463
  57. package/esm/tabs/index.js +7 -3
  58. package/esm/tabs/tab-cell-underline.d.ts +4 -0
  59. package/esm/tabs/tab-cell-underline.js +218 -0
  60. package/esm/tabs/tab-cell.d.ts +1 -85
  61. package/esm/tabs/tab-cell.js +59 -204
  62. package/esm/tabs/tab-pane.d.ts +2 -38
  63. package/esm/tabs/type.d.ts +601 -0
  64. package/esm/tabs/type.js +1 -0
  65. package/esm/toast/methods.js +8 -9
  66. package/package.json +3 -3
  67. package/umd/_helpers/index.d.ts +1 -0
  68. package/umd/_helpers/index.js +10 -4
  69. package/umd/_helpers/react-dom.d.ts +13 -0
  70. package/umd/_helpers/react-dom.js +78 -0
  71. package/umd/_helpers/render.d.ts +10 -0
  72. package/umd/_helpers/render.js +51 -0
  73. package/umd/action-sheet/index.d.ts +1 -1
  74. package/umd/ellipsis/components/js-ellipsis.js +7 -1
  75. package/umd/image-picker/index.js +0 -1
  76. package/umd/image-picker/style/css/index.d.ts +1 -0
  77. package/umd/image-picker/style/css/index.js +4 -4
  78. package/umd/image-picker/style/index.d.ts +1 -0
  79. package/umd/image-picker/style/index.js +4 -4
  80. package/umd/image-preview/index.d.ts +2 -10
  81. package/umd/image-preview/methods.js +6 -13
  82. package/umd/masking/index.d.ts +10 -0
  83. package/umd/masking/methods.js +6 -13
  84. package/umd/notify/methods.js +9 -12
  85. package/umd/popover/hooks/useEvent.js +6 -6
  86. package/umd/swipe-action/index.js +21 -3
  87. package/umd/tabs/index.d.ts +3 -463
  88. package/umd/tabs/index.js +16 -6
  89. package/umd/tabs/tab-cell-underline.d.ts +4 -0
  90. package/umd/tabs/tab-cell-underline.js +242 -0
  91. package/umd/tabs/tab-cell.d.ts +1 -85
  92. package/umd/tabs/tab-cell.js +60 -205
  93. package/umd/tabs/tab-pane.d.ts +2 -38
  94. package/umd/tabs/type.d.ts +601 -0
  95. package/umd/tabs/type.js +17 -0
  96. package/umd/toast/methods.js +11 -14
package/dist/index.js CHANGED
@@ -60,7 +60,7 @@
60
60
  function isArray(obj) {
61
61
  return opt.call(obj) === '[object Array]';
62
62
  }
63
- function isObject$1(obj) {
63
+ function isObject$2(obj) {
64
64
  return opt.call(obj) === '[object Object]';
65
65
  }
66
66
  function isString(obj) {
@@ -91,7 +91,7 @@
91
91
  classNames.push(v);
92
92
  } else if (isArray(v)) {
93
93
  classNames = classNames.concat(v);
94
- } else if (isObject$1(v)) {
94
+ } else if (isObject$2(v)) {
95
95
  Object.keys(v).forEach(function (k) {
96
96
  if (v[k]) {
97
97
  classNames.push(k);
@@ -2494,6 +2494,64 @@
2494
2494
  };
2495
2495
  }
2496
2496
 
2497
+ var _a;
2498
+
2499
+ function isObject$1(obj) {
2500
+ return Object.prototype.toString.call(obj) === '[object Object]';
2501
+ }
2502
+
2503
+ var __SECRET_INTERNALS__ = '__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED';
2504
+ var CopyReactDOM = ReactDOM__default["default"];
2505
+ var copyRender;
2506
+ var isReact18 = Number((_a = CopyReactDOM.version) === null || _a === void 0 ? void 0 : _a.split('.')[0]) > 17;
2507
+
2508
+ var updateUsingClientEntryPoint = function updateUsingClientEntryPoint(skipWarning) {
2509
+ // https://github.com/facebook/react/blob/17806594cc28284fe195f918e8d77de3516848ec/packages/react-dom/npm/client.js#L10
2510
+ // Avoid console warning
2511
+ if (isObject$1(CopyReactDOM[__SECRET_INTERNALS__])) {
2512
+ CopyReactDOM[__SECRET_INTERNALS__].usingClientEntryPoint = skipWarning;
2513
+ }
2514
+ };
2515
+
2516
+ var createRoot;
2517
+
2518
+ try {
2519
+ createRoot = CopyReactDOM.createRoot;
2520
+ } catch (_) {}
2521
+
2522
+ if (isReact18 && createRoot) {
2523
+ copyRender = function copyRender(app, container) {
2524
+ updateUsingClientEntryPoint(true);
2525
+ var root = createRoot(container);
2526
+ updateUsingClientEntryPoint(false);
2527
+ root.render(app);
2528
+
2529
+ root._unmount = function () {
2530
+ setTimeout(function () {
2531
+ var _a;
2532
+
2533
+ (_a = root === null || root === void 0 ? void 0 : root.unmount) === null || _a === void 0 ? void 0 : _a.call(root);
2534
+ });
2535
+ };
2536
+
2537
+ return root;
2538
+ };
2539
+ } else {
2540
+ copyRender = function copyRender(app, container) {
2541
+ CopyReactDOM.render(app, container);
2542
+ return {
2543
+ render: function render(comment) {
2544
+ CopyReactDOM.render(comment, container);
2545
+ },
2546
+ _unmount: function _unmount() {
2547
+ CopyReactDOM.unmountComponentAtNode(container);
2548
+ }
2549
+ };
2550
+ };
2551
+ }
2552
+
2553
+ var render = copyRender;
2554
+
2497
2555
  function getStyleWithVendor(style) {
2498
2556
  var allowReg = /(transform|transition|animation)/i;
2499
2557
  var newStyle = Object.keys(style).reduce(function (acc, key) {
@@ -2515,6 +2573,36 @@
2515
2573
  return value === void 0 ? defaultValue : value;
2516
2574
  };
2517
2575
 
2576
+ var ReactDOMRender =
2577
+ /** @class */
2578
+ function () {
2579
+ function ReactDOMRender(app, container) {
2580
+ var _this = this;
2581
+
2582
+ this.render = function (props) {
2583
+ var CustomApp = _this.app;
2584
+
2585
+ if (_this.root) {
2586
+ _this.root.render( /*#__PURE__*/React__default["default"].createElement(CustomApp, __assign({}, props)));
2587
+ } else {
2588
+ _this.root = render( /*#__PURE__*/React__default["default"].createElement(CustomApp, __assign({}, props)), _this.container);
2589
+ }
2590
+ };
2591
+
2592
+ this.unmount = function () {
2593
+ var _a;
2594
+
2595
+ (_a = _this.root) === null || _a === void 0 ? void 0 : _a._unmount();
2596
+ _this.root = undefined;
2597
+ };
2598
+
2599
+ this.app = app;
2600
+ this.container = container;
2601
+ }
2602
+
2603
+ return ReactDOMRender;
2604
+ }();
2605
+
2518
2606
  function getOpenMethod(Component, containerId, normalize) {
2519
2607
  if (normalize === void 0) {
2520
2608
  normalize = function normalize(config) {
@@ -2536,14 +2624,7 @@
2536
2624
  var id = "_" + (containerId || 'ARCO_MASKING') + "_DIV_" + (config.key || '') + "_";
2537
2625
  var div = appendElementById(id, baseProps.getContainer).child;
2538
2626
  var leaving = false;
2539
-
2540
- function render(props) {
2541
- ReactDOM__default["default"].render( /*#__PURE__*/React__default["default"].createElement(Component, __assign({}, props, {
2542
- getContainer: function getContainer() {
2543
- return div;
2544
- }
2545
- })), div);
2546
- }
2627
+ var render = new ReactDOMRender(Component, div).render;
2547
2628
 
2548
2629
  function update(newConfig) {
2549
2630
  dynamicProps = __assign(__assign({}, dynamicProps), normalize(newConfig));
@@ -5203,16 +5284,16 @@
5203
5284
  var div = document.createElement('div');
5204
5285
  document.body.appendChild(div);
5205
5286
 
5206
- function render(props) {
5207
- ReactDOM__default["default"].render( /*#__PURE__*/React__default["default"].createElement(Component, __assign({}, props)), div);
5208
- }
5287
+ var _a = new ReactDOMRender(Component, div),
5288
+ render = _a.render,
5289
+ unmount = _a.unmount;
5209
5290
 
5210
- function destory() {
5291
+ function destroy() {
5211
5292
  var onClose = config.onClose;
5212
5293
  onClose && onClose();
5213
- var unmountResult = ReactDOM__default["default"].unmountComponentAtNode(div);
5294
+ unmount();
5214
5295
 
5215
- if (unmountResult && div.parentNode) {
5296
+ if (div.parentNode) {
5216
5297
  div.parentNode.removeChild(div);
5217
5298
  }
5218
5299
  }
@@ -5222,7 +5303,7 @@
5222
5303
  getContainer: function getContainer() {
5223
5304
  return div;
5224
5305
  },
5225
- onClose: destory,
5306
+ onClose: destroy,
5226
5307
  visible: false
5227
5308
  });
5228
5309
 
@@ -6529,6 +6610,220 @@
6529
6610
  Group: Group$1
6530
6611
  });
6531
6612
 
6613
+ var TabCellUnderline = /*#__PURE__*/React.forwardRef(function (props, ref) {
6614
+ var prefix = props.prefix,
6615
+ useCaterpillar = props.useCaterpillar,
6616
+ distance = props.distance,
6617
+ tabDirection = props.tabDirection,
6618
+ underlineInnerStyle = props.underlineInnerStyle,
6619
+ duration = props.duration,
6620
+ cellTrans = props.cellTrans,
6621
+ showLine = props.showLine,
6622
+ activeIndex = props.activeIndex,
6623
+ wrapWidth = props.wrapWidth,
6624
+ wrapHeight = props.wrapHeight,
6625
+ jumpingDis = props.jumpingDis,
6626
+ translateZ = props.translateZ,
6627
+ caterpillarMaxScale = props.caterpillarMaxScale,
6628
+ caterpillarProperty = props.caterpillarProperty,
6629
+ underlineSize = props.underlineSize,
6630
+ underlineThick = props.underlineThick,
6631
+ renderUnderline = props.renderUnderline,
6632
+ getTabCenterLeft = props.getTabCenterLeft;
6633
+
6634
+ var _a = React.useState({}),
6635
+ underlineStyle = _a[0],
6636
+ setUnderlineStyle = _a[1];
6637
+
6638
+ var _b = useRefState(false),
6639
+ caterpillar = _b[0],
6640
+ caterpillarRef = _b[1],
6641
+ setCaterpillar = _b[2];
6642
+
6643
+ var _c = React.useState(0),
6644
+ caterpillarDelay = _c[0],
6645
+ setCaterpillarDelay = _c[1];
6646
+
6647
+ var lineRef = React.useRef(null);
6648
+ var timeRef = React.useRef(0);
6649
+ var system = useSystem();
6650
+ var isVertical = tabDirection === 'vertical';
6651
+ var maxScaleWithDefault = caterpillarMaxScale || 2;
6652
+ var translateZStr = translateZ ? ' translateZ(0)' : '';
6653
+ React.useImperativeHandle(ref, function () {
6654
+ return {
6655
+ setCaterpillarAnimate: setCaterpillarAnimate,
6656
+ resetUnderlineStyle: resetUnderlineStyle
6657
+ };
6658
+ }, [setCaterpillarAnimate, resetUnderlineStyle]);
6659
+ var animationKey = React.useMemo(function () {
6660
+ if (!useCaterpillar) {
6661
+ return '';
6662
+ }
6663
+
6664
+ if (caterpillarProperty === 'size') {
6665
+ return "tabsCaterpillar" + (isVertical ? 'W' : 'H') + maxScaleWithDefault;
6666
+ }
6667
+
6668
+ if (caterpillarMaxScale) {
6669
+ return "tabsCaterpillar" + (isVertical ? 'X' : 'Y') + caterpillarMaxScale;
6670
+ }
6671
+
6672
+ return '';
6673
+ }, [useCaterpillar, isVertical, caterpillarMaxScale, caterpillarProperty]);
6674
+ React.useEffect(function () {
6675
+ if (!animationKey) {
6676
+ return;
6677
+ }
6678
+
6679
+ var dir = isVertical ? 'X' : 'Y';
6680
+
6681
+ if (caterpillarProperty === 'size') {
6682
+ var attr = isVertical ? 'width' : 'height';
6683
+ addCssKeyframes(animationKey, "{\n 0% {\n " + attr + ": 100%;\n }\n 50% {\n " + attr + ": " + 100 * maxScaleWithDefault + "%;\n }\n 100% {\n " + attr + ": 100%;\n }\n }");
6684
+ return;
6685
+ }
6686
+
6687
+ addCssKeyframes(animationKey, "{\n 0% {\n transform: scale" + dir + "(1)" + translateZStr + ";\n -webkit-transform: scale" + dir + "(1)" + translateZStr + ";\n }\n 50% {\n transform: scale" + dir + "(" + caterpillarMaxScale + ")" + translateZStr + ";\n -webkit-transform: scale" + dir + "(" + caterpillarMaxScale + ")" + translateZStr + ";\n }\n 100% {\n transform: scale" + dir + "(1)" + translateZStr + ";\n -webkit-transform: scale" + dir + "(1)" + translateZStr + ";\n }\n }");
6688
+ return function () {
6689
+ removeCssStyleDom(animationKey);
6690
+ };
6691
+ }, [animationKey]);
6692
+ React.useEffect(function () {
6693
+ if (jumpingDis && useCaterpillar && system !== 'ios') {
6694
+ var movedRatio = wrapWidth ? jumpingDis / wrapWidth : 0;
6695
+ setCaterpillarAnimate(movedRatio);
6696
+ }
6697
+ }, [jumpingDis]);
6698
+ React.useEffect(function () {
6699
+ resetUnderlineStyle();
6700
+ }, [useCaterpillar, caterpillar, cellTrans, duration, tabDirection, wrapWidth, wrapHeight, distance, animationKey, caterpillarDelay]);
6701
+
6702
+ function getLineLeft(index) {
6703
+ var _a, _b;
6704
+
6705
+ var offsetSize = isVertical ? (_a = lineRef.current) === null || _a === void 0 ? void 0 : _a.offsetWidth : (_b = lineRef.current) === null || _b === void 0 ? void 0 : _b.offsetHeight;
6706
+ var lineWidth = offsetSize || 0;
6707
+ return getTabCenterLeft(index) - lineWidth / 2;
6708
+ }
6709
+
6710
+ function getDescIndex() {
6711
+ if (distance > 0) {
6712
+ return activeIndex - 1;
6713
+ }
6714
+
6715
+ if (distance < 0) {
6716
+ return activeIndex + 1;
6717
+ }
6718
+
6719
+ return activeIndex;
6720
+ }
6721
+
6722
+ function getLineScale(ratio) {
6723
+ var absRatio = Math.abs(ratio);
6724
+ return absRatio > 0.5 ? (1 - absRatio) * 2 * (maxScaleWithDefault - 1) + 1 : absRatio * 2 * (maxScaleWithDefault - 1) + 1;
6725
+ }
6726
+
6727
+ function getLineStyle() {
6728
+ var _a;
6729
+
6730
+ if (!lineRef.current) {
6731
+ return {};
6732
+ }
6733
+
6734
+ var currentLeft = getLineLeft(activeIndex);
6735
+ var descIndex = getDescIndex();
6736
+ var descLeft = getLineLeft(descIndex);
6737
+ var moveRatio = wrapWidth ? distance / wrapWidth : 0;
6738
+ var leftOffset = moveRatio * (currentLeft - descLeft);
6739
+ var direc = isVertical ? 'X' : 'Y';
6740
+ var transStyle = useCaterpillar && !jumpingDis ? caterpillarProperty === 'size' ? (_a = {}, _a[isVertical ? 'width' : 'height'] = 100 * getLineScale(moveRatio) + "%", _a.willChange = 'width', _a) : {
6741
+ transform: "scale" + direc + "(" + getLineScale(moveRatio) + ")"
6742
+ } : {};
6743
+ var outerSize = isVertical ? {
6744
+ width: underlineSize,
6745
+ height: underlineThick
6746
+ } : {
6747
+ height: underlineSize,
6748
+ width: underlineThick
6749
+ };
6750
+ return {
6751
+ outer: __assign({
6752
+ transform: "translate" + direc + "(" + (distance > 0 ? currentLeft - leftOffset : currentLeft + leftOffset) + "px)" + translateZStr
6753
+ }, outerSize),
6754
+ inner: __assign({}, transStyle)
6755
+ };
6756
+ }
6757
+
6758
+ function getUnderlineStyle() {
6759
+ var transStyle = {};
6760
+
6761
+ if (useCaterpillar) {
6762
+ transStyle.animationDuration = duration + "ms";
6763
+ }
6764
+
6765
+ if (caterpillarRef.current && animationKey) {
6766
+ transStyle.animationName = animationKey;
6767
+ }
6768
+
6769
+ if (caterpillarDelay) {
6770
+ transStyle.animationDelay = "-" + caterpillarDelay + "ms";
6771
+ }
6772
+
6773
+ var lineStyle = getLineStyle();
6774
+ return {
6775
+ outer: getStyleWithVendor(__assign({
6776
+ transitionDuration: cellTrans ? duration + "ms" : '0ms'
6777
+ }, lineStyle.outer || {})),
6778
+ inner: getStyleWithVendor(__assign(__assign({}, transStyle), lineStyle.inner || {}))
6779
+ };
6780
+ }
6781
+
6782
+ function resetUnderlineStyle() {
6783
+ setUnderlineStyle(getUnderlineStyle());
6784
+ }
6785
+
6786
+ function setCaterpillarAnimate(movedRatio) {
6787
+ if (movedRatio === void 0) {
6788
+ movedRatio = 0;
6789
+ }
6790
+
6791
+ if (!duration) {
6792
+ return;
6793
+ }
6794
+
6795
+ var movedTime = (duration || 0) * Math.abs(movedRatio);
6796
+ setCaterpillarDelay(movedTime);
6797
+ nextTick(function () {
6798
+ setCaterpillar(true);
6799
+ });
6800
+
6801
+ if (timeRef.current) {
6802
+ clearTimeout(timeRef.current);
6803
+ }
6804
+
6805
+ timeRef.current = window.setTimeout(function () {
6806
+ setCaterpillar(false);
6807
+ setCaterpillarDelay(0);
6808
+ }, (duration || 0) - movedTime + 20);
6809
+ }
6810
+
6811
+ return renderUnderline ? /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, renderUnderline(underlineStyle, showLine, lineRef)) : /*#__PURE__*/React__default["default"].createElement("div", {
6812
+ className: cls(prefix + "-underline", {
6813
+ show: showLine
6814
+ }),
6815
+ ref: lineRef,
6816
+ style: underlineStyle.outer
6817
+ }, /*#__PURE__*/React__default["default"].createElement("div", {
6818
+ className: cls(prefix + "-underline-inner", {
6819
+ caterpillar: caterpillar,
6820
+ 'custom-animate': animationKey,
6821
+ 'caterpillar-moving': caterpillar || useCaterpillar && distance
6822
+ }, tabDirection),
6823
+ style: __assign(__assign({}, underlineStyle.inner || {}), underlineInnerStyle || {})
6824
+ }));
6825
+ });
6826
+
6532
6827
  var TabCell = /*#__PURE__*/React.forwardRef(function (props, ref) {
6533
6828
  var tabs = props.tabs,
6534
6829
  prefixCls = props.prefixCls,
@@ -6574,46 +6869,33 @@
6574
6869
  renderTabBarInner = props.renderTabBarInner,
6575
6870
  tabBarStyle = props.tabBarStyle,
6576
6871
  tabBarClass = props.tabBarClass,
6577
- translateZ = props.translateZ;
6872
+ translateZ = props.translateZ,
6873
+ tabBarStopPropagation = props.tabBarStopPropagation;
6578
6874
  var prefix = prefixCls + "-tab-cell";
6579
6875
  var domRef = React.useRef(null);
6580
- var lineRef = React.useRef(null);
6581
- var timeRef = React.useRef(0);
6876
+ var underlineRef = React.useRef(null);
6582
6877
  var allCellRectRef = React.useRef([]);
6583
6878
 
6584
- var _b = React.useState({}),
6585
- underlineStyle = _b[0],
6586
- setUnderlineStyle = _b[1];
6587
-
6588
- var _c = useRefState(false),
6589
- caterpillar = _c[0],
6590
- caterpillarRef = _c[1],
6591
- setCaterpillar = _c[2];
6592
-
6593
- var _d = React.useState(0),
6594
- caterpillarDelay = _d[0],
6595
- setCaterpillarDelay = _d[1];
6879
+ var _b = React.useState(false),
6880
+ showLine = _b[0],
6881
+ setShowLine = _b[1];
6596
6882
 
6597
- var _e = React.useState(false),
6598
- hasOverflow = _e[0],
6599
- setHasOverflow = _e[1];
6883
+ var _c = React.useState(false),
6884
+ hasOverflow = _c[0],
6885
+ setHasOverflow = _c[1];
6600
6886
 
6601
- var _f = React.useState(function () {
6887
+ var _d = React.useState(function () {
6602
6888
  return tabs.length < overflowThreshold ? tabBarArrange : 'start';
6603
6889
  }),
6604
- originArrange = _f[0],
6605
- setOriginArrange = _f[1]; // 默认tab小于overflowThreshold个时不开启加载前隐藏,大于overflowThreshold个时开启
6890
+ originArrange = _d[0],
6891
+ setOriginArrange = _d[1]; // 默认tab小于overflowThreshold个时不开启加载前隐藏,大于overflowThreshold个时开启
6606
6892
 
6607
6893
 
6608
- var _g = React.useState(function () {
6894
+ var _e = React.useState(function () {
6609
6895
  return hideTabBarBeforeMounted === void 0 ? tabs.length < overflowThreshold || activeIndex === 0 : !hideTabBarBeforeMounted;
6610
6896
  }),
6611
- showTab = _g[0],
6612
- setShowTab = _g[1];
6613
-
6614
- var _h = React.useState(false),
6615
- showLine = _h[0],
6616
- setShowLine = _h[1];
6897
+ showTab = _e[0],
6898
+ setShowTab = _e[1];
6617
6899
 
6618
6900
  var isVertical = tabDirection === 'vertical';
6619
6901
  var isLine = (type || '').indexOf('line') !== -1;
@@ -6627,42 +6909,7 @@
6627
6909
  var cellGutter = isCard ? void 0 : tabBarGutter;
6628
6910
  var hasDivider = tabBarHasDivider === void 0 ? isLine : tabBarHasDivider;
6629
6911
  var wrapSize = isVertical ? wrapWidth : wrapHeight;
6630
- var translateZStr = translateZ ? ' translateZ(0)' : '';
6631
6912
  var system = useSystem();
6632
- var maxScaleWithDefault = caterpillarMaxScale || 2;
6633
- var animationKey = React.useMemo(function () {
6634
- if (!showUnderline || !useCaterpillar) {
6635
- return '';
6636
- }
6637
-
6638
- if (caterpillarProperty === 'size') {
6639
- return "tabsCaterpillar" + (isVertical ? 'W' : 'H') + maxScaleWithDefault;
6640
- }
6641
-
6642
- if (caterpillarMaxScale) {
6643
- return "tabsCaterpillar" + (isVertical ? 'X' : 'Y') + caterpillarMaxScale;
6644
- }
6645
-
6646
- return '';
6647
- }, [showUnderline, useCaterpillar, isVertical, caterpillarMaxScale, caterpillarProperty]);
6648
- React.useEffect(function () {
6649
- if (!animationKey) {
6650
- return;
6651
- }
6652
-
6653
- var dir = isVertical ? 'X' : 'Y';
6654
-
6655
- if (caterpillarProperty === 'size') {
6656
- var attr = isVertical ? 'width' : 'height';
6657
- addCssKeyframes(animationKey, "{\n 0% {\n " + attr + ": 100%;\n }\n 50% {\n " + attr + ": " + 100 * maxScaleWithDefault + "%;\n }\n 100% {\n " + attr + ": 100%;\n }\n }");
6658
- return;
6659
- }
6660
-
6661
- addCssKeyframes(animationKey, "{\n 0% {\n transform: scale" + dir + "(1)" + translateZStr + ";\n -webkit-transform: scale" + dir + "(1)" + translateZStr + ";\n }\n 50% {\n transform: scale" + dir + "(" + caterpillarMaxScale + ")" + translateZStr + ";\n -webkit-transform: scale" + dir + "(" + caterpillarMaxScale + ")" + translateZStr + ";\n }\n 100% {\n transform: scale" + dir + "(1)" + translateZStr + ";\n -webkit-transform: scale" + dir + "(1)" + translateZStr + ";\n }\n }");
6662
- return function () {
6663
- removeCssStyleDom(animationKey);
6664
- };
6665
- }, [animationKey]);
6666
6913
  React.useEffect(function () {
6667
6914
  nextTick(function () {
6668
6915
  setCellOverflow(); // dom出来之后originArrange置空,交由tabBarArrange控制
@@ -6675,12 +6922,11 @@
6675
6922
  setShowLine(true);
6676
6923
  });
6677
6924
  }, [domRef.current, wrapSize, tabs]);
6678
- React.useEffect(function () {
6679
- resetUnderlineStyle();
6680
- }, [useCaterpillar, caterpillar, cellTrans, duration, tabDirection, wrapWidth, wrapHeight, distance, animationKey, caterpillarDelay]);
6681
6925
  React.useEffect(function () {
6682
6926
  nextTick(function () {
6683
- resetUnderlineStyle();
6927
+ var _a;
6928
+
6929
+ (_a = underlineRef.current) === null || _a === void 0 ? void 0 : _a.resetUnderlineStyle();
6684
6930
  });
6685
6931
  }, [activeIndex, tabs, getCellPadding('left'), getCellPadding('right'), tabBarGutter, tabDirection]);
6686
6932
  React.useImperativeHandle(ref, function () {
@@ -6689,10 +6935,18 @@
6689
6935
  scrollTo: scrollTo,
6690
6936
  scrollToCenter: scrollToCenter,
6691
6937
  hasOverflow: hasOverflow,
6692
- setCaterpillarAnimate: setCaterpillarAnimate,
6693
- resetUnderlineStyle: resetUnderlineStyle
6938
+ setCaterpillarAnimate: function setCaterpillarAnimate(ratio) {
6939
+ var _a;
6940
+
6941
+ return (_a = underlineRef.current) === null || _a === void 0 ? void 0 : _a.setCaterpillarAnimate(ratio);
6942
+ },
6943
+ resetUnderlineStyle: function resetUnderlineStyle() {
6944
+ var _a;
6945
+
6946
+ return (_a = underlineRef.current) === null || _a === void 0 ? void 0 : _a.resetUnderlineStyle();
6947
+ }
6694
6948
  };
6695
- }, [scrollToCenter, scrollTo, hasOverflow, setCaterpillarAnimate, resetUnderlineStyle]);
6949
+ }, [scrollToCenter, scrollTo, hasOverflow]);
6696
6950
  React.useEffect(function () {
6697
6951
  if (wrapSize && tabBarScrollChance !== 'none') {
6698
6952
  setTimeout(function () {
@@ -6708,28 +6962,18 @@
6708
6962
  return e.stopPropagation();
6709
6963
  };
6710
6964
 
6711
- if (isVertical && hasOverflow && domRef.current) {
6965
+ if (isVertical && hasOverflow && domRef.current && tabBarStopPropagation) {
6712
6966
  domRef.current.addEventListener('touchstart', stopFunc);
6713
6967
  domRef.current.addEventListener('touchmove', stopFunc);
6714
6968
  }
6715
6969
 
6716
6970
  return function () {
6717
- if (isVertical && hasOverflow && domRef.current) {
6971
+ if (isVertical && hasOverflow && domRef.current && tabBarStopPropagation) {
6718
6972
  domRef.current.removeEventListener('touchstart', stopFunc);
6719
6973
  domRef.current.removeEventListener('touchmove', stopFunc);
6720
6974
  }
6721
6975
  };
6722
6976
  }, [hasOverflow]);
6723
- React.useEffect(function () {
6724
- if (jumpingDis && useCaterpillar && system !== 'ios') {
6725
- var movedRatio = wrapWidth ? jumpingDis / wrapWidth : 0;
6726
- setCaterpillarAnimate(movedRatio);
6727
- }
6728
- }, [jumpingDis]);
6729
-
6730
- function resetUnderlineStyle() {
6731
- setUnderlineStyle(getUnderlineStyle());
6732
- }
6733
6977
 
6734
6978
  function setCellOverflow() {
6735
6979
  var overflow = false;
@@ -6797,69 +7041,6 @@
6797
7041
  }
6798
7042
  }
6799
7043
 
6800
- function getUnderlineStyle() {
6801
- var transStyle = {};
6802
-
6803
- if (useCaterpillar) {
6804
- transStyle.animationDuration = duration + "ms";
6805
- }
6806
-
6807
- if (caterpillarRef.current && animationKey) {
6808
- transStyle.animationName = animationKey;
6809
- }
6810
-
6811
- if (caterpillarDelay) {
6812
- transStyle.animationDelay = "-" + caterpillarDelay + "ms";
6813
- }
6814
-
6815
- var lineStyle = getLineStyle();
6816
- return {
6817
- outer: getStyleWithVendor(__assign({
6818
- transitionDuration: cellTrans ? duration + "ms" : '0ms'
6819
- }, lineStyle.outer || {})),
6820
- inner: getStyleWithVendor(__assign(__assign({}, transStyle), lineStyle.inner || {}))
6821
- };
6822
- }
6823
-
6824
- function getLineStyle() {
6825
- var _a;
6826
-
6827
- if (!lineRef.current || !domRef.current) {
6828
- return {};
6829
- }
6830
-
6831
- var currentLeft = getLineLeft(activeIndex);
6832
- var descIndex = getDescIndex();
6833
- var descLeft = getLineLeft(descIndex);
6834
- var moveRatio = wrapWidth ? distance / wrapWidth : 0;
6835
- var leftOffset = moveRatio * (currentLeft - descLeft);
6836
- var direc = isVertical ? 'X' : 'Y';
6837
- var transStyle = useCaterpillar && !jumpingDis ? caterpillarProperty === 'size' ? (_a = {}, _a[isVertical ? 'width' : 'height'] = 100 * getLineScale(moveRatio) + "%", _a.willChange = 'width', _a) : {
6838
- transform: "scale" + direc + "(" + getLineScale(moveRatio) + ")"
6839
- } : {};
6840
- var outerSize = isVertical ? {
6841
- width: underlineSize,
6842
- height: underlineThick
6843
- } : {
6844
- height: underlineSize,
6845
- width: underlineThick
6846
- };
6847
- return {
6848
- outer: __assign({
6849
- transform: "translate" + direc + "(" + (distance > 0 ? currentLeft - leftOffset : currentLeft + leftOffset) + "px)" + translateZStr
6850
- }, outerSize),
6851
- inner: __assign({}, transStyle)
6852
- };
6853
- }
6854
-
6855
- function getLineLeft(index) {
6856
- var _a, _b;
6857
-
6858
- var offsetSize = isVertical ? (_a = lineRef.current) === null || _a === void 0 ? void 0 : _a.offsetWidth : (_b = lineRef.current) === null || _b === void 0 ? void 0 : _b.offsetHeight;
6859
- var lineWidth = offsetSize || 0;
6860
- return getTabCenterLeft(index) - lineWidth / 2;
6861
- }
6862
-
6863
7044
  function getTabCenterLeft(index) {
6864
7045
  var currentTab = allCellRectRef.current[index] || {};
6865
7046
  var currentTabWidth = (isVertical ? currentTab.width : currentTab.height) || 0;
@@ -6867,48 +7048,6 @@
6867
7048
  return currentTabLeft + currentTabWidth / 2;
6868
7049
  }
6869
7050
 
6870
- function getLineScale(ratio) {
6871
- var absRatio = Math.abs(ratio);
6872
- return absRatio > 0.5 ? (1 - absRatio) * 2 * (maxScaleWithDefault - 1) + 1 : absRatio * 2 * (maxScaleWithDefault - 1) + 1;
6873
- }
6874
-
6875
- function getDescIndex() {
6876
- if (distance > 0) {
6877
- return activeIndex - 1;
6878
- }
6879
-
6880
- if (distance < 0) {
6881
- return activeIndex + 1;
6882
- }
6883
-
6884
- return activeIndex;
6885
- }
6886
-
6887
- function setCaterpillarAnimate(movedRatio) {
6888
- if (movedRatio === void 0) {
6889
- movedRatio = 0;
6890
- }
6891
-
6892
- if (!duration) {
6893
- return;
6894
- }
6895
-
6896
- var movedTime = (duration || 0) * Math.abs(movedRatio);
6897
- setCaterpillarDelay(movedTime);
6898
- nextTick(function () {
6899
- setCaterpillar(true);
6900
- });
6901
-
6902
- if (timeRef.current) {
6903
- clearTimeout(timeRef.current);
6904
- }
6905
-
6906
- timeRef.current = window.setTimeout(function () {
6907
- setCaterpillar(false);
6908
- setCaterpillarDelay(0);
6909
- }, (duration || 0) - movedTime + 20);
6910
- }
6911
-
6912
7051
  function getCellPadding(pType) {
6913
7052
  if (typeof cellPadding === 'object') {
6914
7053
  return cellPadding[pType];
@@ -6949,20 +7088,30 @@
6949
7088
  return null;
6950
7089
  }
6951
7090
 
6952
- return renderUnderline ? renderUnderline(underlineStyle, showLine, lineRef) : /*#__PURE__*/React__default["default"].createElement("div", {
6953
- className: cls(prefix + "-underline", {
6954
- show: showLine
6955
- }),
6956
- ref: lineRef,
6957
- style: underlineStyle.outer
6958
- }, /*#__PURE__*/React__default["default"].createElement("div", {
6959
- className: cls(prefix + "-underline-inner", {
6960
- caterpillar: caterpillar,
6961
- 'custom-animate': animationKey,
6962
- 'caterpillar-moving': caterpillar || useCaterpillar && distance
6963
- }, tabDirection),
6964
- style: __assign(__assign({}, underlineStyle.inner || {}), underlineInnerStyle || {})
6965
- }));
7091
+ var lineProps = {
7092
+ prefix: prefix,
7093
+ showLine: showLine,
7094
+ useCaterpillar: useCaterpillar,
7095
+ distance: distance,
7096
+ tabDirection: tabDirection,
7097
+ underlineInnerStyle: underlineInnerStyle,
7098
+ cellTrans: cellTrans,
7099
+ duration: duration,
7100
+ activeIndex: activeIndex,
7101
+ wrapWidth: wrapWidth,
7102
+ wrapHeight: wrapHeight,
7103
+ jumpingDis: jumpingDis,
7104
+ caterpillarMaxScale: caterpillarMaxScale,
7105
+ caterpillarProperty: caterpillarProperty,
7106
+ translateZ: translateZ,
7107
+ underlineSize: underlineSize,
7108
+ underlineThick: underlineThick,
7109
+ renderUnderline: renderUnderline
7110
+ };
7111
+ return /*#__PURE__*/React__default["default"].createElement(TabCellUnderline, __assign({
7112
+ ref: underlineRef,
7113
+ getTabCenterLeft: getTabCenterLeft
7114
+ }, lineProps));
6966
7115
  }
6967
7116
 
6968
7117
  var cellInner = /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, tabs.map(function (tab, index) {
@@ -7862,44 +8011,46 @@
7862
8011
  _4 = props.translateZ,
7863
8012
  translateZ = _4 === void 0 ? true : _4,
7864
8013
  fullScreen = props.fullScreen,
7865
- autoHeight = props.autoHeight;
8014
+ autoHeight = props.autoHeight,
8015
+ _5 = props.tabBarStopPropagation,
8016
+ tabBarStopPropagation = _5 === void 0 ? true : _5;
7866
8017
  var domRef = React.useRef(null);
7867
8018
  var cellRef = React.useRef(null);
7868
8019
  var paneRef = React.useRef(null);
7869
8020
 
7870
- var _5 = React.useState(defaultActiveTab),
7871
- innerIndex = _5[0],
7872
- setInnerIndex = _5[1];
7873
-
7874
- var _6 = React.useState(0),
7875
- jumpingDis = _6[0],
7876
- setJumpingDis = _6[1];
8021
+ var _6 = React.useState(defaultActiveTab),
8022
+ innerIndex = _6[0],
8023
+ setInnerIndex = _6[1];
7877
8024
 
7878
8025
  var _7 = React.useState(0),
7879
- wrapWidth = _7[0],
7880
- setWrapWidth = _7[1];
8026
+ jumpingDis = _7[0],
8027
+ setJumpingDis = _7[1];
7881
8028
 
7882
8029
  var _8 = React.useState(0),
7883
- wrapHeight = _8[0],
7884
- setWrapHeight = _8[1];
8030
+ wrapWidth = _8[0],
8031
+ setWrapWidth = _8[1];
7885
8032
 
7886
- var _9 = React.useState(false),
7887
- cellTrans = _9[0],
7888
- setCellTrans = _9[1];
8033
+ var _9 = React.useState(0),
8034
+ wrapHeight = _9[0],
8035
+ setWrapHeight = _9[1];
7889
8036
 
7890
8037
  var _10 = React.useState(false),
7891
- paneTrans = _10[0],
7892
- setPaneTrans = _10[1];
8038
+ cellTrans = _10[0],
8039
+ setCellTrans = _10[1];
8040
+
8041
+ var _11 = React.useState(false),
8042
+ paneTrans = _11[0],
8043
+ setPaneTrans = _11[1];
7893
8044
 
7894
- var _11 = useRefState(activeTab === void 0 ? innerIndex : activeTab),
7895
- activeIndex = _11[0],
7896
- activeIndexRef = _11[1],
7897
- setActiveIndex = _11[2];
8045
+ var _12 = useRefState(activeTab === void 0 ? innerIndex : activeTab),
8046
+ activeIndex = _12[0],
8047
+ activeIndexRef = _12[1],
8048
+ setActiveIndex = _12[2];
7898
8049
 
7899
- var _12 = useRefState(0),
7900
- distance = _12[0],
7901
- distanceRef = _12[1],
7902
- setDistance = _12[2];
8050
+ var _13 = useRefState(0),
8051
+ distance = _13[0],
8052
+ distanceRef = _13[1],
8053
+ setDistance = _13[2];
7903
8054
 
7904
8055
  var posAdjustingRef = React.useRef(false);
7905
8056
  var touchStartedRef = React.useRef(false);
@@ -8215,7 +8366,8 @@
8215
8366
  renderTabBarItem: renderTabBarItem,
8216
8367
  renderTabBarInner: renderTabBarInner,
8217
8368
  tabBarStyle: tabBarStyle,
8218
- tabBarClass: tabBarClass
8369
+ tabBarClass: tabBarClass,
8370
+ tabBarStopPropagation: tabBarStopPropagation
8219
8371
  }, commonProps);
8220
8372
 
8221
8373
  var CellComp = /*#__PURE__*/React__default["default"].createElement(TabCell, __assign({}, cellProps));
@@ -12086,7 +12238,13 @@
12086
12238
  var height = container.getBoundingClientRect().height;
12087
12239
 
12088
12240
  if (height > max) {
12089
- break;
12241
+ if (nodes[i].childNodes && nodes[i].childNodes.length) {
12242
+ break;
12243
+ } else {
12244
+ textContainer.removeChild(nodes[i]);
12245
+ handleOnReflow(true, textContainer.innerHTML);
12246
+ return;
12247
+ }
12090
12248
  }
12091
12249
 
12092
12250
  i++;
@@ -14389,7 +14547,6 @@
14389
14547
  var timeOutEvent;
14390
14548
 
14391
14549
  var handleTouchStart = function handleTouchStart(e, image, index) {
14392
- e.preventDefault();
14393
14550
  timeOutEvent = setTimeout(function () {
14394
14551
  timeOutEvent = 0;
14395
14552
  onLongPress === null || onLongPress === void 0 ? void 0 : onLongPress(e, image, index);
@@ -16695,14 +16852,7 @@
16695
16852
  var id = "_ARCO_IMAGE_PREVIEW_DIV_" + (baseProps.key || '') + "_";
16696
16853
  var div = appendElementById(id, baseProps.getContainer).child;
16697
16854
  var leaving = false;
16698
-
16699
- function render(props) {
16700
- ReactDOM__default["default"].render( /*#__PURE__*/React__default["default"].createElement(Component, __assign({}, props, {
16701
- getContainer: function getContainer() {
16702
- return div;
16703
- }
16704
- })), div);
16705
- }
16855
+ var render = new ReactDOMRender(Component, div).render;
16706
16856
 
16707
16857
  function update(newConfig) {
16708
16858
  dynamicProps = __assign(__assign({}, dynamicProps), newConfig || {});
@@ -18567,16 +18717,16 @@
18567
18717
  document.body.appendChild(div);
18568
18718
  }
18569
18719
 
18570
- function render(props) {
18571
- ReactDOM__default["default"].render( /*#__PURE__*/React__default["default"].createElement(Component, __assign({}, props)), div);
18572
- }
18720
+ var _a = new ReactDOMRender(Component, div),
18721
+ render = _a.render,
18722
+ unmount = _a.unmount;
18573
18723
 
18574
18724
  function destroy() {
18575
18725
  var onClose = config.onClose;
18576
18726
  onClose && onClose();
18577
- var unmountResult = ReactDOM__default["default"].unmountComponentAtNode(div);
18727
+ unmount();
18578
18728
 
18579
- if (unmountResult && div.parentNode) {
18729
+ if (div.parentNode) {
18580
18730
  div.parentNode.removeChild(div);
18581
18731
  }
18582
18732
  }
@@ -19318,10 +19468,10 @@
19318
19468
  setDirectionState = _k[2];
19319
19469
 
19320
19470
  var getOffset = React.useCallback(function (dir) {
19321
- return getDefaultValue(isObject$1(edgeOffset) ? edgeOffset[dir] : edgeOffset, defaultEdgeOffset[dir]);
19471
+ return getDefaultValue(isObject$2(edgeOffset) ? edgeOffset[dir] : edgeOffset, defaultEdgeOffset[dir]);
19322
19472
  }, [edgeOffset]);
19323
19473
  var getAutoDirection = React.useCallback(function (dir) {
19324
- return getDefaultValue(isObject$1(useAutoDirection) ? useAutoDirection[dir] : useAutoDirection, defaultAutoDirection);
19474
+ return getDefaultValue(isObject$2(useAutoDirection) ? useAutoDirection[dir] : useAutoDirection, defaultAutoDirection);
19325
19475
  }, [useAutoDirection]);
19326
19476
  React.useEffect(function () {
19327
19477
  setDirectionState(direction);
@@ -19763,12 +19913,13 @@
19763
19913
  var closeTimer = React.useRef(0);
19764
19914
  /** 垂直方向自适应 */
19765
19915
 
19766
- var autoVerticalDirection = getDefaultValue(isObject$1(useAutoDirection) ? useAutoDirection.vertical : useAutoDirection, defaultAutoDirection);
19916
+ var autoVerticalDirection = getDefaultValue(isObject$2(useAutoDirection) ? useAutoDirection.vertical : useAutoDirection, defaultAutoDirection);
19767
19917
 
19768
19918
  var popoverDisappear = function popoverDisappear() {
19769
19919
  onVisibleChange(false);
19770
19920
  window.clearTimeout(closeTimer.current);
19771
19921
  closeTimer.current = 0;
19922
+ mayRemoveEventListenerOnBody();
19772
19923
  };
19773
19924
 
19774
19925
  var throttleHandleVerticalScroll = React.useMemo(function () {
@@ -19788,7 +19939,7 @@
19788
19939
  };
19789
19940
  }, [throttleHandleVerticalScroll, getVerticalScrollContainer, autoVerticalDirection, visibleRef]);
19790
19941
  var mayRemoveEventListenerOnBody = React.useCallback(function () {
19791
- document.body.removeEventListener('click', handleClickBody);
19942
+ document.body.removeEventListener('click', handleClickBody, true);
19792
19943
  document.body.removeEventListener('touchstart', handleTouchBody);
19793
19944
  var el = getVerticalScrollContainer();
19794
19945
 
@@ -19803,7 +19954,6 @@
19803
19954
 
19804
19955
 
19805
19956
  if (!isContains(wrapperRef.current, e.target) && !isContains(((_a = popoverInnerRef.current) === null || _a === void 0 ? void 0 : _a.dom) || null, e.target)) {
19806
- // TODO: 这里仅阻止了react事件,react 18 将不再在document上挂事件,这里的stop会失效
19807
19957
  if (preventBodyClick) {
19808
19958
  e.stopPropagation();
19809
19959
  e.preventDefault();
@@ -19829,13 +19979,13 @@
19829
19979
  var handle = function handle(e) {
19830
19980
  e.stopPropagation();
19831
19981
  e.preventDefault();
19832
- document.body.removeEventListener('click', handle);
19982
+ document.body.removeEventListener('click', handle, true);
19833
19983
  clearTimeout(preventRecentClickTimer);
19834
19984
  };
19835
19985
 
19836
- document.body.addEventListener('click', handle);
19986
+ document.body.addEventListener('click', handle, true);
19837
19987
  preventRecentClickTimer = window.setTimeout(function () {
19838
- document.body.removeEventListener('click', handle);
19988
+ document.body.removeEventListener('click', handle, true);
19839
19989
  }, 500);
19840
19990
  };
19841
19991
 
@@ -19878,7 +20028,7 @@
19878
20028
  var el = getVerticalScrollContainer();
19879
20029
  el && el.addEventListener('scroll', handleScrollBody);
19880
20030
  } else if (clickOtherToClose) {
19881
- document.body.addEventListener('click', handleClickBody);
20031
+ document.body.addEventListener('click', handleClickBody, true);
19882
20032
  }
19883
20033
  };
19884
20034
  /**
@@ -23019,6 +23169,7 @@
23019
23169
 
23020
23170
  var dampRateRef = useLatestRef(dampRate);
23021
23171
  var forbidClick = React.useRef(false);
23172
+ var scrollingRef = React.useRef(null);
23022
23173
 
23023
23174
  var _j = useRefState(false),
23024
23175
  moving = _j[0],
@@ -23033,6 +23184,7 @@
23033
23184
  var prefixCls = React.useContext(GlobalContext).prefixCls;
23034
23185
  var startRef = React.useRef(0);
23035
23186
  var startX = React.useRef(0);
23187
+ var startY = React.useRef(0);
23036
23188
  var slideX = React.useRef(0);
23037
23189
  var isLayer = openStyleType === 'layer';
23038
23190
  var transitionStyle = React.useMemo(function () {
@@ -23043,6 +23195,7 @@
23043
23195
 
23044
23196
  function resetMoveData() {
23045
23197
  startX.current = 0;
23198
+ startY.current = 0;
23046
23199
  slideX.current = 0;
23047
23200
  }
23048
23201
 
@@ -23054,19 +23207,34 @@
23054
23207
  function touchstart(e) {
23055
23208
  startRef.current = offsetRef.current;
23056
23209
  resetMoveData();
23210
+ scrollingRef.current = null;
23057
23211
  startX.current = e.touches[0].pageX;
23212
+ startY.current = e.touches[0].pageY;
23058
23213
  }
23059
23214
 
23060
23215
  function touchmove(e) {
23061
- e.preventDefault();
23062
- slideX.current = e.touches[0].pageX - startX.current;
23216
+ var x = e.changedTouches[0].pageX - startX.current;
23217
+ var y = e.changedTouches[0].pageY - startY.current;
23218
+
23219
+ if (scrollingRef.current === null) {
23220
+ scrollingRef.current = Math.abs(x) < Math.abs(y);
23221
+ }
23222
+
23223
+ if (scrollingRef.current) {
23224
+ setMoving(false);
23225
+ setOffset(0);
23226
+ return;
23227
+ }
23228
+
23229
+ e.cancelable && e.preventDefault();
23230
+ slideX.current = x;
23063
23231
  forbidClick.current = true;
23064
23232
  setMoving(true);
23065
23233
  setOffset(getMenuCurrentWidth(slideX.current + startRef.current, -rightMenuWidthRef.current, leftMenuWidthRef.current));
23066
23234
  }
23067
23235
 
23068
23236
  function touchend() {
23069
- if (movingRef.current) {
23237
+ if (movingRef.current && !scrollingRef.current) {
23070
23238
  var currentMenu = offsetRef.current > 0 ? 'left' : 'right';
23071
23239
  changeMenu(currentMenu);
23072
23240
  setMoving(false);