@arco-design/mobile-react 2.21.1 → 2.21.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 (56) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.en-US.md +2 -2
  3. package/README.md +2 -2
  4. package/cjs/button/style/css/index.css +64 -64
  5. package/cjs/button/style/index.less +7 -5
  6. package/cjs/ellipsis/components/js-ellipsis.js +7 -1
  7. package/cjs/image-picker/style/css/index.d.ts +1 -0
  8. package/cjs/image-picker/style/css/index.js +2 -0
  9. package/cjs/image-picker/style/index.d.ts +1 -0
  10. package/cjs/image-picker/style/index.js +2 -0
  11. package/cjs/tabs/index.d.ts +3 -463
  12. package/cjs/tabs/index.js +10 -0
  13. package/cjs/tabs/tab-cell-underline.d.ts +4 -0
  14. package/cjs/tabs/tab-cell-underline.js +234 -0
  15. package/cjs/tabs/tab-cell.d.ts +1 -85
  16. package/cjs/tabs/tab-cell.js +53 -198
  17. package/cjs/tabs/tab-pane.d.ts +2 -38
  18. package/cjs/tabs/type.d.ts +590 -0
  19. package/cjs/tabs/type.js +3 -0
  20. package/dist/index.js +272 -199
  21. package/dist/index.min.js +3 -3
  22. package/dist/style.css +64 -64
  23. package/dist/style.min.css +1 -1
  24. package/esm/button/style/css/index.css +64 -64
  25. package/esm/button/style/index.less +7 -5
  26. package/esm/ellipsis/components/js-ellipsis.js +7 -1
  27. package/esm/image-picker/style/css/index.d.ts +1 -0
  28. package/esm/image-picker/style/css/index.js +1 -0
  29. package/esm/image-picker/style/index.d.ts +1 -0
  30. package/esm/image-picker/style/index.js +1 -0
  31. package/esm/tabs/index.d.ts +3 -463
  32. package/esm/tabs/index.js +2 -1
  33. package/esm/tabs/tab-cell-underline.d.ts +4 -0
  34. package/esm/tabs/tab-cell-underline.js +218 -0
  35. package/esm/tabs/tab-cell.d.ts +1 -85
  36. package/esm/tabs/tab-cell.js +55 -201
  37. package/esm/tabs/tab-pane.d.ts +2 -38
  38. package/esm/tabs/type.d.ts +590 -0
  39. package/esm/tabs/type.js +1 -0
  40. package/package.json +3 -3
  41. package/umd/button/style/css/index.css +64 -64
  42. package/umd/button/style/index.less +7 -5
  43. package/umd/ellipsis/components/js-ellipsis.js +7 -1
  44. package/umd/image-picker/style/css/index.d.ts +1 -0
  45. package/umd/image-picker/style/css/index.js +4 -4
  46. package/umd/image-picker/style/index.d.ts +1 -0
  47. package/umd/image-picker/style/index.js +4 -4
  48. package/umd/tabs/index.d.ts +3 -463
  49. package/umd/tabs/index.js +11 -4
  50. package/umd/tabs/tab-cell-underline.d.ts +4 -0
  51. package/umd/tabs/tab-cell-underline.js +242 -0
  52. package/umd/tabs/tab-cell.d.ts +1 -85
  53. package/umd/tabs/tab-cell.js +56 -202
  54. package/umd/tabs/tab-pane.d.ts +2 -38
  55. package/umd/tabs/type.d.ts +590 -0
  56. package/umd/tabs/type.js +17 -0
package/dist/index.js CHANGED
@@ -6529,6 +6529,220 @@
6529
6529
  Group: Group$1
6530
6530
  });
6531
6531
 
6532
+ var TabCellUnderline = /*#__PURE__*/React.forwardRef(function (props, ref) {
6533
+ var prefix = props.prefix,
6534
+ useCaterpillar = props.useCaterpillar,
6535
+ distance = props.distance,
6536
+ tabDirection = props.tabDirection,
6537
+ underlineInnerStyle = props.underlineInnerStyle,
6538
+ duration = props.duration,
6539
+ cellTrans = props.cellTrans,
6540
+ showLine = props.showLine,
6541
+ activeIndex = props.activeIndex,
6542
+ wrapWidth = props.wrapWidth,
6543
+ wrapHeight = props.wrapHeight,
6544
+ jumpingDis = props.jumpingDis,
6545
+ translateZ = props.translateZ,
6546
+ caterpillarMaxScale = props.caterpillarMaxScale,
6547
+ caterpillarProperty = props.caterpillarProperty,
6548
+ underlineSize = props.underlineSize,
6549
+ underlineThick = props.underlineThick,
6550
+ renderUnderline = props.renderUnderline,
6551
+ getTabCenterLeft = props.getTabCenterLeft;
6552
+
6553
+ var _a = React.useState({}),
6554
+ underlineStyle = _a[0],
6555
+ setUnderlineStyle = _a[1];
6556
+
6557
+ var _b = useRefState(false),
6558
+ caterpillar = _b[0],
6559
+ caterpillarRef = _b[1],
6560
+ setCaterpillar = _b[2];
6561
+
6562
+ var _c = React.useState(0),
6563
+ caterpillarDelay = _c[0],
6564
+ setCaterpillarDelay = _c[1];
6565
+
6566
+ var lineRef = React.useRef(null);
6567
+ var timeRef = React.useRef(0);
6568
+ var system = useSystem();
6569
+ var isVertical = tabDirection === 'vertical';
6570
+ var maxScaleWithDefault = caterpillarMaxScale || 2;
6571
+ var translateZStr = translateZ ? ' translateZ(0)' : '';
6572
+ React.useImperativeHandle(ref, function () {
6573
+ return {
6574
+ setCaterpillarAnimate: setCaterpillarAnimate,
6575
+ resetUnderlineStyle: resetUnderlineStyle
6576
+ };
6577
+ }, [setCaterpillarAnimate, resetUnderlineStyle]);
6578
+ var animationKey = React.useMemo(function () {
6579
+ if (!useCaterpillar) {
6580
+ return '';
6581
+ }
6582
+
6583
+ if (caterpillarProperty === 'size') {
6584
+ return "tabsCaterpillar" + (isVertical ? 'W' : 'H') + maxScaleWithDefault;
6585
+ }
6586
+
6587
+ if (caterpillarMaxScale) {
6588
+ return "tabsCaterpillar" + (isVertical ? 'X' : 'Y') + caterpillarMaxScale;
6589
+ }
6590
+
6591
+ return '';
6592
+ }, [useCaterpillar, isVertical, caterpillarMaxScale, caterpillarProperty]);
6593
+ React.useEffect(function () {
6594
+ if (!animationKey) {
6595
+ return;
6596
+ }
6597
+
6598
+ var dir = isVertical ? 'X' : 'Y';
6599
+
6600
+ if (caterpillarProperty === 'size') {
6601
+ var attr = isVertical ? 'width' : 'height';
6602
+ addCssKeyframes(animationKey, "{\n 0% {\n " + attr + ": 100%;\n }\n 50% {\n " + attr + ": " + 100 * maxScaleWithDefault + "%;\n }\n 100% {\n " + attr + ": 100%;\n }\n }");
6603
+ return;
6604
+ }
6605
+
6606
+ 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 }");
6607
+ return function () {
6608
+ removeCssStyleDom(animationKey);
6609
+ };
6610
+ }, [animationKey]);
6611
+ React.useEffect(function () {
6612
+ if (jumpingDis && useCaterpillar && system !== 'ios') {
6613
+ var movedRatio = wrapWidth ? jumpingDis / wrapWidth : 0;
6614
+ setCaterpillarAnimate(movedRatio);
6615
+ }
6616
+ }, [jumpingDis]);
6617
+ React.useEffect(function () {
6618
+ resetUnderlineStyle();
6619
+ }, [useCaterpillar, caterpillar, cellTrans, duration, tabDirection, wrapWidth, wrapHeight, distance, animationKey, caterpillarDelay]);
6620
+
6621
+ function getLineLeft(index) {
6622
+ var _a, _b;
6623
+
6624
+ 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;
6625
+ var lineWidth = offsetSize || 0;
6626
+ return getTabCenterLeft(index) - lineWidth / 2;
6627
+ }
6628
+
6629
+ function getDescIndex() {
6630
+ if (distance > 0) {
6631
+ return activeIndex - 1;
6632
+ }
6633
+
6634
+ if (distance < 0) {
6635
+ return activeIndex + 1;
6636
+ }
6637
+
6638
+ return activeIndex;
6639
+ }
6640
+
6641
+ function getLineScale(ratio) {
6642
+ var absRatio = Math.abs(ratio);
6643
+ return absRatio > 0.5 ? (1 - absRatio) * 2 * (maxScaleWithDefault - 1) + 1 : absRatio * 2 * (maxScaleWithDefault - 1) + 1;
6644
+ }
6645
+
6646
+ function getLineStyle() {
6647
+ var _a;
6648
+
6649
+ if (!lineRef.current) {
6650
+ return {};
6651
+ }
6652
+
6653
+ var currentLeft = getLineLeft(activeIndex);
6654
+ var descIndex = getDescIndex();
6655
+ var descLeft = getLineLeft(descIndex);
6656
+ var moveRatio = wrapWidth ? distance / wrapWidth : 0;
6657
+ var leftOffset = moveRatio * (currentLeft - descLeft);
6658
+ var direc = isVertical ? 'X' : 'Y';
6659
+ var transStyle = useCaterpillar && !jumpingDis ? caterpillarProperty === 'size' ? (_a = {}, _a[isVertical ? 'width' : 'height'] = 100 * getLineScale(moveRatio) + "%", _a.willChange = 'width', _a) : {
6660
+ transform: "scale" + direc + "(" + getLineScale(moveRatio) + ")"
6661
+ } : {};
6662
+ var outerSize = isVertical ? {
6663
+ width: underlineSize,
6664
+ height: underlineThick
6665
+ } : {
6666
+ height: underlineSize,
6667
+ width: underlineThick
6668
+ };
6669
+ return {
6670
+ outer: __assign({
6671
+ transform: "translate" + direc + "(" + (distance > 0 ? currentLeft - leftOffset : currentLeft + leftOffset) + "px)" + translateZStr
6672
+ }, outerSize),
6673
+ inner: __assign({}, transStyle)
6674
+ };
6675
+ }
6676
+
6677
+ function getUnderlineStyle() {
6678
+ var transStyle = {};
6679
+
6680
+ if (useCaterpillar) {
6681
+ transStyle.animationDuration = duration + "ms";
6682
+ }
6683
+
6684
+ if (caterpillarRef.current && animationKey) {
6685
+ transStyle.animationName = animationKey;
6686
+ }
6687
+
6688
+ if (caterpillarDelay) {
6689
+ transStyle.animationDelay = "-" + caterpillarDelay + "ms";
6690
+ }
6691
+
6692
+ var lineStyle = getLineStyle();
6693
+ return {
6694
+ outer: getStyleWithVendor(__assign({
6695
+ transitionDuration: cellTrans ? duration + "ms" : '0ms'
6696
+ }, lineStyle.outer || {})),
6697
+ inner: getStyleWithVendor(__assign(__assign({}, transStyle), lineStyle.inner || {}))
6698
+ };
6699
+ }
6700
+
6701
+ function resetUnderlineStyle() {
6702
+ setUnderlineStyle(getUnderlineStyle());
6703
+ }
6704
+
6705
+ function setCaterpillarAnimate(movedRatio) {
6706
+ if (movedRatio === void 0) {
6707
+ movedRatio = 0;
6708
+ }
6709
+
6710
+ if (!duration) {
6711
+ return;
6712
+ }
6713
+
6714
+ var movedTime = (duration || 0) * Math.abs(movedRatio);
6715
+ setCaterpillarDelay(movedTime);
6716
+ nextTick(function () {
6717
+ setCaterpillar(true);
6718
+ });
6719
+
6720
+ if (timeRef.current) {
6721
+ clearTimeout(timeRef.current);
6722
+ }
6723
+
6724
+ timeRef.current = window.setTimeout(function () {
6725
+ setCaterpillar(false);
6726
+ setCaterpillarDelay(0);
6727
+ }, (duration || 0) - movedTime + 20);
6728
+ }
6729
+
6730
+ return renderUnderline ? /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, renderUnderline(underlineStyle, showLine, lineRef)) : /*#__PURE__*/React__default["default"].createElement("div", {
6731
+ className: cls(prefix + "-underline", {
6732
+ show: showLine
6733
+ }),
6734
+ ref: lineRef,
6735
+ style: underlineStyle.outer
6736
+ }, /*#__PURE__*/React__default["default"].createElement("div", {
6737
+ className: cls(prefix + "-underline-inner", {
6738
+ caterpillar: caterpillar,
6739
+ 'custom-animate': animationKey,
6740
+ 'caterpillar-moving': caterpillar || useCaterpillar && distance
6741
+ }, tabDirection),
6742
+ style: __assign(__assign({}, underlineStyle.inner || {}), underlineInnerStyle || {})
6743
+ }));
6744
+ });
6745
+
6532
6746
  var TabCell = /*#__PURE__*/React.forwardRef(function (props, ref) {
6533
6747
  var tabs = props.tabs,
6534
6748
  prefixCls = props.prefixCls,
@@ -6577,43 +6791,29 @@
6577
6791
  translateZ = props.translateZ;
6578
6792
  var prefix = prefixCls + "-tab-cell";
6579
6793
  var domRef = React.useRef(null);
6580
- var lineRef = React.useRef(null);
6581
- var timeRef = React.useRef(0);
6794
+ var underlineRef = React.useRef(null);
6582
6795
  var allCellRectRef = React.useRef([]);
6583
6796
 
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];
6797
+ var _b = React.useState(false),
6798
+ showLine = _b[0],
6799
+ setShowLine = _b[1];
6596
6800
 
6597
- var _e = React.useState(false),
6598
- hasOverflow = _e[0],
6599
- setHasOverflow = _e[1];
6801
+ var _c = React.useState(false),
6802
+ hasOverflow = _c[0],
6803
+ setHasOverflow = _c[1];
6600
6804
 
6601
- var _f = React.useState(function () {
6805
+ var _d = React.useState(function () {
6602
6806
  return tabs.length < overflowThreshold ? tabBarArrange : 'start';
6603
6807
  }),
6604
- originArrange = _f[0],
6605
- setOriginArrange = _f[1]; // 默认tab小于overflowThreshold个时不开启加载前隐藏,大于overflowThreshold个时开启
6808
+ originArrange = _d[0],
6809
+ setOriginArrange = _d[1]; // 默认tab小于overflowThreshold个时不开启加载前隐藏,大于overflowThreshold个时开启
6606
6810
 
6607
6811
 
6608
- var _g = React.useState(function () {
6812
+ var _e = React.useState(function () {
6609
6813
  return hideTabBarBeforeMounted === void 0 ? tabs.length < overflowThreshold || activeIndex === 0 : !hideTabBarBeforeMounted;
6610
6814
  }),
6611
- showTab = _g[0],
6612
- setShowTab = _g[1];
6613
-
6614
- var _h = React.useState(false),
6615
- showLine = _h[0],
6616
- setShowLine = _h[1];
6815
+ showTab = _e[0],
6816
+ setShowTab = _e[1];
6617
6817
 
6618
6818
  var isVertical = tabDirection === 'vertical';
6619
6819
  var isLine = (type || '').indexOf('line') !== -1;
@@ -6627,42 +6827,7 @@
6627
6827
  var cellGutter = isCard ? void 0 : tabBarGutter;
6628
6828
  var hasDivider = tabBarHasDivider === void 0 ? isLine : tabBarHasDivider;
6629
6829
  var wrapSize = isVertical ? wrapWidth : wrapHeight;
6630
- var translateZStr = translateZ ? ' translateZ(0)' : '';
6631
6830
  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
6831
  React.useEffect(function () {
6667
6832
  nextTick(function () {
6668
6833
  setCellOverflow(); // dom出来之后originArrange置空,交由tabBarArrange控制
@@ -6675,12 +6840,11 @@
6675
6840
  setShowLine(true);
6676
6841
  });
6677
6842
  }, [domRef.current, wrapSize, tabs]);
6678
- React.useEffect(function () {
6679
- resetUnderlineStyle();
6680
- }, [useCaterpillar, caterpillar, cellTrans, duration, tabDirection, wrapWidth, wrapHeight, distance, animationKey, caterpillarDelay]);
6681
6843
  React.useEffect(function () {
6682
6844
  nextTick(function () {
6683
- resetUnderlineStyle();
6845
+ var _a;
6846
+
6847
+ (_a = underlineRef.current) === null || _a === void 0 ? void 0 : _a.resetUnderlineStyle();
6684
6848
  });
6685
6849
  }, [activeIndex, tabs, getCellPadding('left'), getCellPadding('right'), tabBarGutter, tabDirection]);
6686
6850
  React.useImperativeHandle(ref, function () {
@@ -6689,10 +6853,18 @@
6689
6853
  scrollTo: scrollTo,
6690
6854
  scrollToCenter: scrollToCenter,
6691
6855
  hasOverflow: hasOverflow,
6692
- setCaterpillarAnimate: setCaterpillarAnimate,
6693
- resetUnderlineStyle: resetUnderlineStyle
6856
+ setCaterpillarAnimate: function setCaterpillarAnimate(ratio) {
6857
+ var _a;
6858
+
6859
+ return (_a = underlineRef.current) === null || _a === void 0 ? void 0 : _a.setCaterpillarAnimate(ratio);
6860
+ },
6861
+ resetUnderlineStyle: function resetUnderlineStyle() {
6862
+ var _a;
6863
+
6864
+ return (_a = underlineRef.current) === null || _a === void 0 ? void 0 : _a.resetUnderlineStyle();
6865
+ }
6694
6866
  };
6695
- }, [scrollToCenter, scrollTo, hasOverflow, setCaterpillarAnimate, resetUnderlineStyle]);
6867
+ }, [scrollToCenter, scrollTo, hasOverflow]);
6696
6868
  React.useEffect(function () {
6697
6869
  if (wrapSize && tabBarScrollChance !== 'none') {
6698
6870
  setTimeout(function () {
@@ -6720,16 +6892,6 @@
6720
6892
  }
6721
6893
  };
6722
6894
  }, [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
6895
 
6734
6896
  function setCellOverflow() {
6735
6897
  var overflow = false;
@@ -6797,69 +6959,6 @@
6797
6959
  }
6798
6960
  }
6799
6961
 
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
6962
  function getTabCenterLeft(index) {
6864
6963
  var currentTab = allCellRectRef.current[index] || {};
6865
6964
  var currentTabWidth = (isVertical ? currentTab.width : currentTab.height) || 0;
@@ -6867,48 +6966,6 @@
6867
6966
  return currentTabLeft + currentTabWidth / 2;
6868
6967
  }
6869
6968
 
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
6969
  function getCellPadding(pType) {
6913
6970
  if (typeof cellPadding === 'object') {
6914
6971
  return cellPadding[pType];
@@ -6949,20 +7006,30 @@
6949
7006
  return null;
6950
7007
  }
6951
7008
 
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
- }));
7009
+ var lineProps = {
7010
+ prefix: prefix,
7011
+ showLine: showLine,
7012
+ useCaterpillar: useCaterpillar,
7013
+ distance: distance,
7014
+ tabDirection: tabDirection,
7015
+ underlineInnerStyle: underlineInnerStyle,
7016
+ cellTrans: cellTrans,
7017
+ duration: duration,
7018
+ activeIndex: activeIndex,
7019
+ wrapWidth: wrapWidth,
7020
+ wrapHeight: wrapHeight,
7021
+ jumpingDis: jumpingDis,
7022
+ caterpillarMaxScale: caterpillarMaxScale,
7023
+ caterpillarProperty: caterpillarProperty,
7024
+ translateZ: translateZ,
7025
+ underlineSize: underlineSize,
7026
+ underlineThick: underlineThick,
7027
+ renderUnderline: renderUnderline
7028
+ };
7029
+ return /*#__PURE__*/React__default["default"].createElement(TabCellUnderline, __assign({
7030
+ ref: underlineRef,
7031
+ getTabCenterLeft: getTabCenterLeft
7032
+ }, lineProps));
6966
7033
  }
6967
7034
 
6968
7035
  var cellInner = /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, tabs.map(function (tab, index) {
@@ -12086,7 +12153,13 @@
12086
12153
  var height = container.getBoundingClientRect().height;
12087
12154
 
12088
12155
  if (height > max) {
12089
- break;
12156
+ if (nodes[i].childNodes && nodes[i].childNodes.length) {
12157
+ break;
12158
+ } else {
12159
+ textContainer.removeChild(nodes[i]);
12160
+ handleOnReflow(true, textContainer.innerHTML);
12161
+ return;
12162
+ }
12090
12163
  }
12091
12164
 
12092
12165
  i++;