@arco-design/mobile-react 2.21.0 → 2.21.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,19 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.21.1](https://github.com/arco-design/arco-design-mobile/compare/@arco-design/mobile-react@2.21.0...@arco-design/mobile-react@2.21.1) (2022-09-01)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * `Ellipsis` duplicate reflow ([41fc0a2](https://github.com/arco-design/arco-design-mobile/commit/41fc0a237c3737e0ad2db09623db3577ca243348))
12
+ * `SearchBar` export type ([5ee5ebf](https://github.com/arco-design/arco-design-mobile/commit/5ee5ebf9923b0d1582a52a646f6daea168b89946))
13
+ * `SwipeAction` import optimize ([5060d25](https://github.com/arco-design/arco-design-mobile/commit/5060d2570e0eb85c6f6b344e9ac9f0b50212f486))
14
+
15
+
16
+
17
+
18
+
6
19
  # [2.21.0](https://github.com/arco-design/arco-design-mobile/compare/@arco-design/mobile-react@2.19.1...@arco-design/mobile-react@2.21.0) (2022-08-29)
7
20
 
8
21
 
package/README.en-US.md CHANGED
@@ -59,8 +59,8 @@ React & ReactDOM: **<a href="https://reactjs.org/docs/cdn-links.html" target="_b
59
59
  React Transition Group: **<a href="https://reactcommunity.org/react-transition-group/" target="_blank">Click here</a>**
60
60
 
61
61
  ```
62
- <link ref="stylesheet" href="https://unpkg.com/@arco-design/mobile-react@2.20.0/dist/style.min.css">
63
- <script src="https://unpkg.com/@arco-design/mobile-react@2.20.0/dist/index.min.js"></script>
62
+ <link ref="stylesheet" href="https://unpkg.com/@arco-design/mobile-react@2.21.0/dist/style.min.css">
63
+ <script src="https://unpkg.com/@arco-design/mobile-react@2.21.0/dist/index.min.js"></script>
64
64
  ```
65
65
 
66
66
  ## Full import
package/README.md CHANGED
@@ -59,8 +59,8 @@ React & ReactDOM: **<a href="https://reactjs.org/docs/cdn-links.html" target="
59
59
  React Transition Group: **<a href="https://reactcommunity.org/react-transition-group/" target="_blank">戳这里获取</a>**
60
60
 
61
61
  ```
62
- <link ref="stylesheet" href="https://unpkg.com/@arco-design/mobile-react@2.20.0/dist/style.min.css">
63
- <script src="https://unpkg.com/@arco-design/mobile-react@2.20.0/dist/index.min.js"></script>
62
+ <link ref="stylesheet" href="https://unpkg.com/@arco-design/mobile-react@2.21.0/dist/style.min.css">
63
+ <script src="https://unpkg.com/@arco-design/mobile-react@2.21.0/dist/index.min.js"></script>
64
64
  ```
65
65
 
66
66
  ## 引入全部
@@ -25,8 +25,7 @@ var JsEllipsis = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
25
25
  maxHeight = props.maxHeight,
26
26
  ellipsisNode = props.ellipsisNode,
27
27
  collapseNode = props.collapseNode,
28
- _props$endExcludes = props.endExcludes,
29
- endExcludes = _props$endExcludes === void 0 ? [] : _props$endExcludes,
28
+ endExcludes = props.endExcludes,
30
29
  reflowOnResize = props.reflowOnResize,
31
30
  onReflow = props.onReflow,
32
31
  onEllipsisNodeClick = props.onEllipsisNodeClick,
@@ -79,7 +78,7 @@ var JsEllipsis = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
79
78
  } // Remove the exclude char at the end of the content.
80
79
 
81
80
 
82
- while (endExcludes.includes(currentText[currentText.length - 1])) {
81
+ while (endExcludes && endExcludes.includes(currentText[currentText.length - 1])) {
83
82
  currentText = currentText.slice(0, -1);
84
83
  } // Callback after reflow.
85
84
 
@@ -53,15 +53,14 @@ var Ellipsis = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
53
53
  _props$collapseNode = props.collapseNode,
54
54
  collapseNode = _props$collapseNode === void 0 ? '' : _props$collapseNode,
55
55
  onCollapseNodeClick = props.onCollapseNodeClick,
56
- _props$endExcludes = props.endExcludes,
57
- endExcludes = _props$endExcludes === void 0 ? [] : _props$endExcludes,
56
+ endExcludes = props.endExcludes,
58
57
  _props$reflowOnResize = props.reflowOnResize,
59
58
  reflowOnResize = _props$reflowOnResize === void 0 ? false : _props$reflowOnResize,
60
59
  onReflow = props.onReflow,
61
60
  onEllipsisNodeClick = props.onEllipsisNodeClick;
62
61
  var domRef = (0, _react.useRef)(null);
63
62
  var jsEllipsisRef = (0, _react.useRef)(null);
64
- var useNativeEllipsis = (0, _is.isSupportWebkitLineClamp)() && maxHeight === void 0 && ellipsisNode === '...' && endExcludes.length === 0 && !onReflow && !onEllipsisNodeClick;
63
+ var useNativeEllipsis = (0, _is.isSupportWebkitLineClamp)() && maxHeight === void 0 && ellipsisNode === '...' && (!endExcludes || endExcludes.length === 0) && !onReflow && !onEllipsisNodeClick;
65
64
  (0, _react.useImperativeHandle)(ref, function () {
66
65
  var _jsEllipsisRef$curren;
67
66
 
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { SearchAssociationBaseItem, SearchBarProps, SearchBarRef } from './type';
3
- export { SearchBarProps, SearchBarRef, SearchAssociationHighlightMode, SearchAssociationItem, SearchAssociationShowType, SearchBarShape, } from './type';
3
+ export type { SearchBarProps, SearchBarRef, SearchAssociationHighlightMode, SearchAssociationItem, SearchAssociationShowType, SearchBarShape, } from './type';
4
4
  /**
5
5
  * 搜索栏组件
6
6
  * @en SearchBar component
@@ -3,7 +3,7 @@
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
4
 
5
5
  exports.__esModule = true;
6
- exports.default = exports.SearchBarShape = exports.SearchBarRef = exports.SearchBarProps = exports.SearchAssociationShowType = exports.SearchAssociationItem = exports.SearchAssociationHighlightMode = void 0;
6
+ exports.default = void 0;
7
7
 
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
9
 
@@ -23,14 +23,6 @@ var _association = require("./association");
23
23
 
24
24
  var _cancelButton = require("./cancel-button");
25
25
 
26
- var _type = require("./type");
27
-
28
- exports.SearchBarProps = _type.SearchBarProps;
29
- exports.SearchBarRef = _type.SearchBarRef;
30
- exports.SearchAssociationHighlightMode = _type.SearchAssociationHighlightMode;
31
- exports.SearchAssociationItem = _type.SearchAssociationItem;
32
- exports.SearchAssociationShowType = _type.SearchAssociationShowType;
33
- exports.SearchBarShape = _type.SearchBarShape;
34
26
  var _excluded = ["inputClass", "inputStyle", "type", "nativeProps", "id", "name", "maxLength", "placeholder", "readOnly", "onKeyUp", "onKeyPress", "disabled", "pattern", "prefix", "append", "textAlign", "actionButton", "clearable", "clearShowType", "shape", "className", "enableAssociation", "associationVisible", "associationShowType", "associationItems", "highlightClassName", "highlightMode", "highlightStyle", "onCancel", "onAssociationClick", "onAssociationItemClick", "renderAssociation", "renderAssociationItem"];
35
27
 
36
28
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -9,8 +9,6 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
9
9
 
10
10
  var _react = _interopRequireWildcard(require("react"));
11
11
 
12
- var _utils = require("@arco-design/mobile-utils/utils");
13
-
14
12
  var _mobileUtils = require("@arco-design/mobile-utils");
15
13
 
16
14
  var _contextProvider = require("../context-provider");
@@ -122,7 +120,7 @@ var SwipeAction = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
122
120
  var currentMenu = offsetRef.current > 0 ? 'left' : 'right';
123
121
  changeMenu(currentMenu);
124
122
  setMoving(false);
125
- (0, _utils.nextTick)(function () {
123
+ (0, _mobileUtils.nextTick)(function () {
126
124
  forbidClick.current = false;
127
125
  });
128
126
  }
package/dist/index.js CHANGED
@@ -1049,7 +1049,7 @@
1049
1049
  * @desc {en} Please ignore this weird function _(:з」∠)_
1050
1050
  */
1051
1051
 
1052
- function nextTick$1(func) {
1052
+ function nextTick(func) {
1053
1053
  setTimeout(func, 20);
1054
1054
  }
1055
1055
  /**
@@ -2567,7 +2567,7 @@
2567
2567
  };
2568
2568
 
2569
2569
  render(dynamicProps);
2570
- nextTick$1(function () {
2570
+ nextTick(function () {
2571
2571
  if (leaving) return;
2572
2572
  dynamicProps.visible = true;
2573
2573
  render(dynamicProps);
@@ -2670,7 +2670,7 @@
2670
2670
 
2671
2671
  if (visible) {
2672
2672
  setOuterVisible(true);
2673
- nextTick$1(function () {
2673
+ nextTick(function () {
2674
2674
  setInnerVisible(true);
2675
2675
  execAfterOpen(function () {
2676
2676
  isAnimating.current = false;
@@ -3612,7 +3612,7 @@
3612
3612
  }
3613
3613
  };
3614
3614
 
3615
- nextTick$1(function () {
3615
+ nextTick(function () {
3616
3616
  image.src = attrs.src;
3617
3617
  image.alt = attrs.alt;
3618
3618
  loadingImageRef.current = image;
@@ -3630,7 +3630,7 @@
3630
3630
  // @en Force refresh <img> to reload
3631
3631
 
3632
3632
  setStaticRetrying(true);
3633
- nextTick$1(function () {
3633
+ nextTick(function () {
3634
3634
  setStaticRetrying(false);
3635
3635
  });
3636
3636
  }
@@ -4530,7 +4530,7 @@
4530
4530
  }
4531
4531
  }, [index, direction, childSize, total]);
4532
4532
  React.useEffect(function () {
4533
- nextTick$1(function () {
4533
+ nextTick(function () {
4534
4534
  updateLayoutData();
4535
4535
  });
4536
4536
  }, [shownIndex, autoHeight, allChildren]);
@@ -4655,7 +4655,7 @@
4655
4655
  onTransitionStart && onTransitionStart();
4656
4656
  setTimeout(function () {
4657
4657
  setPosAdjusting(false);
4658
- nextTick$1(function () {
4658
+ nextTick(function () {
4659
4659
  setDirection(getDefaultDirection());
4660
4660
  var newTransform = transformsRef.current.slice();
4661
4661
  var transChanged = false;
@@ -4678,7 +4678,7 @@
4678
4678
  onAfterChange && onAfterChange(changedIndex, oldIndex);
4679
4679
  }
4680
4680
 
4681
- nextTick$1(function () {
4681
+ nextTick(function () {
4682
4682
  setPlayIntervalRef.current();
4683
4683
  });
4684
4684
  });
@@ -5240,7 +5240,7 @@
5240
5240
  }
5241
5241
 
5242
5242
  render(dynamicProps);
5243
- nextTick$1(function () {
5243
+ nextTick(function () {
5244
5244
  // 在即将打开时发现已经调用了close则取消打开操作
5245
5245
  // @en When it is about to be opened, it is found that close has been called and the open operation is canceled
5246
5246
  if (leaving) return;
@@ -6328,7 +6328,7 @@
6328
6328
 
6329
6329
  var height = getContentHeight();
6330
6330
  contentWrapRef.current.style.height = opened ? contentHeightRef.current + "px" : '0px';
6331
- nextTick$1(function () {
6331
+ nextTick(function () {
6332
6332
  contentHeightRef.current = height;
6333
6333
  resetHeight(opened ? height + "px" : '0px');
6334
6334
  });
@@ -6664,7 +6664,7 @@
6664
6664
  };
6665
6665
  }, [animationKey]);
6666
6666
  React.useEffect(function () {
6667
- nextTick$1(function () {
6667
+ nextTick(function () {
6668
6668
  setCellOverflow(); // dom出来之后originArrange置空,交由tabBarArrange控制
6669
6669
  // @en After the dom comes out, originArrange is left empty and controlled by tabBarArrange
6670
6670
 
@@ -6679,7 +6679,7 @@
6679
6679
  resetUnderlineStyle();
6680
6680
  }, [useCaterpillar, caterpillar, cellTrans, duration, tabDirection, wrapWidth, wrapHeight, distance, animationKey, caterpillarDelay]);
6681
6681
  React.useEffect(function () {
6682
- nextTick$1(function () {
6682
+ nextTick(function () {
6683
6683
  resetUnderlineStyle();
6684
6684
  });
6685
6685
  }, [activeIndex, tabs, getCellPadding('left'), getCellPadding('right'), tabBarGutter, tabDirection]);
@@ -6895,7 +6895,7 @@
6895
6895
 
6896
6896
  var movedTime = (duration || 0) * Math.abs(movedRatio);
6897
6897
  setCaterpillarDelay(movedTime);
6898
- nextTick$1(function () {
6898
+ nextTick(function () {
6899
6899
  setCaterpillar(true);
6900
6900
  });
6901
6901
 
@@ -7977,7 +7977,7 @@
7977
7977
 
7978
7978
  var changeFrom = changeFromRef.current;
7979
7979
  changeFromRef.current = '';
7980
- nextTick$1(function () {
7980
+ nextTick(function () {
7981
7981
  setTimeout(function () {
7982
7982
  onAfterChange && onAfterChange(tabs[activeIndex], activeIndex, changeFrom);
7983
7983
  }, paneRef.current ? paneRef.current.getTransition() : 0);
@@ -8106,7 +8106,7 @@
8106
8106
  newIndex = index + 1;
8107
8107
  }
8108
8108
 
8109
- nextTick$1(function () {
8109
+ nextTick(function () {
8110
8110
  jumpTo(newIndex);
8111
8111
  });
8112
8112
  }
@@ -9723,7 +9723,7 @@
9723
9723
  var _a;
9724
9724
 
9725
9725
  (_a = pickerViewRef.current) === null || _a === void 0 ? void 0 : _a.scrollToCurrentIndex();
9726
- nextTick$1(function () {
9726
+ nextTick(function () {
9727
9727
  var _a;
9728
9728
 
9729
9729
  var val = ((_a = pickerViewRef.current) === null || _a === void 0 ? void 0 : _a.getAllColumnValues()) || scrollValue;
@@ -10491,7 +10491,7 @@
10491
10491
  }
10492
10492
 
10493
10493
  updateDown(wrapperHeight);
10494
- nextTick$1(function () {
10494
+ nextTick(function () {
10495
10495
  setOptionsWrapperHeight(wrapperHeight);
10496
10496
  });
10497
10497
  }, [showDropdown, options.length, height, updateDown]);
@@ -11990,8 +11990,7 @@
11990
11990
  maxHeight = props.maxHeight,
11991
11991
  ellipsisNode = props.ellipsisNode,
11992
11992
  collapseNode = props.collapseNode,
11993
- _b = props.endExcludes,
11994
- endExcludes = _b === void 0 ? [] : _b,
11993
+ endExcludes = props.endExcludes,
11995
11994
  reflowOnResize = props.reflowOnResize,
11996
11995
  onReflow = props.onReflow,
11997
11996
  onEllipsisNodeClick = props.onEllipsisNodeClick,
@@ -12042,7 +12041,7 @@
12042
12041
  } // Remove the exclude char at the end of the content.
12043
12042
 
12044
12043
 
12045
- while (endExcludes.includes(currentText[currentText.length - 1])) {
12044
+ while (endExcludes && endExcludes.includes(currentText[currentText.length - 1])) {
12046
12045
  currentText = currentText.slice(0, -1);
12047
12046
  } // Callback after reflow.
12048
12047
 
@@ -12237,15 +12236,14 @@
12237
12236
  _d = props.collapseNode,
12238
12237
  collapseNode = _d === void 0 ? '' : _d,
12239
12238
  onCollapseNodeClick = props.onCollapseNodeClick,
12240
- _e = props.endExcludes,
12241
- endExcludes = _e === void 0 ? [] : _e,
12242
- _f = props.reflowOnResize,
12243
- reflowOnResize = _f === void 0 ? false : _f,
12239
+ endExcludes = props.endExcludes,
12240
+ _e = props.reflowOnResize,
12241
+ reflowOnResize = _e === void 0 ? false : _e,
12244
12242
  onReflow = props.onReflow,
12245
12243
  onEllipsisNodeClick = props.onEllipsisNodeClick;
12246
12244
  var domRef = React.useRef(null);
12247
12245
  var jsEllipsisRef = React.useRef(null);
12248
- var useNativeEllipsis = isSupportWebkitLineClamp() && maxHeight === void 0 && ellipsisNode === '...' && endExcludes.length === 0 && !onReflow && !onEllipsisNodeClick;
12246
+ var useNativeEllipsis = isSupportWebkitLineClamp() && maxHeight === void 0 && ellipsisNode === '...' && (!endExcludes || endExcludes.length === 0) && !onReflow && !onEllipsisNodeClick;
12249
12247
  React.useImperativeHandle(ref, function () {
12250
12248
  var _a;
12251
12249
 
@@ -12784,7 +12782,7 @@
12784
12782
  }; // 将当前 listener 存入 listeners
12785
12783
 
12786
12784
  !disabled && listeners[curWrapperKey].push(listener.current);
12787
- nextTick$1(function () {
12785
+ nextTick(function () {
12788
12786
  !disabled && _checkVisible(listener.current);
12789
12787
  });
12790
12788
  }
@@ -16898,7 +16896,7 @@
16898
16896
  if (transImageInfo) {
16899
16897
  preventEleScroll();
16900
16898
  } else {
16901
- nextTick$1(function () {
16899
+ nextTick(function () {
16902
16900
  freeEleScroll();
16903
16901
  });
16904
16902
  }
@@ -17415,7 +17413,7 @@
17415
17413
  // @en Transform the small image rect to the large image rect and add transition to make a magnification effect
17416
17414
 
17417
17415
 
17418
- nextTick$1(function () {
17416
+ nextTick(function () {
17419
17417
  transImage.style.opacity = '1';
17420
17418
  setImageBounds(transImage, rect, thumbBounds);
17421
17419
  setTimeout(function () {
@@ -17618,7 +17616,7 @@
17618
17616
  onAfterChange: function onAfterChange(index, oldIndex) {
17619
17617
  _onAfterChange && _onAfterChange(index);
17620
17618
  restoreTransformer(oldIndex);
17621
- nextTick$1(function () {
17619
+ nextTick(function () {
17622
17620
  initTransformer(innerIndexRef.current);
17623
17621
  });
17624
17622
  },
@@ -17852,7 +17850,7 @@
17852
17850
  }
17853
17851
 
17854
17852
  function handleFocus(e) {
17855
- nextTick$1(function () {
17853
+ nextTick(function () {
17856
17854
  if (preventEventWhenClearing && shouldPreventEvent.current) {
17857
17855
  shouldPreventEvent.current = false;
17858
17856
  return;
@@ -17865,7 +17863,7 @@
17865
17863
  }
17866
17864
 
17867
17865
  function handleBlur(e) {
17868
- nextTick$1(function () {
17866
+ nextTick(function () {
17869
17867
  if (preventEventWhenClearing && shouldPreventEvent.current) {
17870
17868
  return;
17871
17869
  }
@@ -17881,7 +17879,7 @@
17881
17879
  // @en Android will have the problem that the keyboard cannot be switched. iOS does not enable this, because it can no longer automatically focus after blur.
17882
17880
  if (blurBeforeFocus && system === 'android' && !isFocusing) {
17883
17881
  inputRef.current && inputRef.current.blur();
17884
- nextTick$1(function () {
17882
+ nextTick(function () {
17885
17883
  inputRef.current && inputRef.current.focus();
17886
17884
  });
17887
17885
  } else {
@@ -18460,7 +18458,7 @@
18460
18458
  }
18461
18459
 
18462
18460
  function updateData() {
18463
- nextTick$1(function () {
18461
+ nextTick(function () {
18464
18462
  setTimeout(function () {
18465
18463
  updateLayoutData();
18466
18464
  }, needMarquee ? 0 : delay);
@@ -18499,7 +18497,7 @@
18499
18497
  contentDom.style.animationDuration = wrapWidth / speed + duration_1 + "s";
18500
18498
  contentDom.style.animationIterationCount = 'infinite';
18501
18499
  contentDom.style.paddingLeft = wrapWidth + "px";
18502
- nextTick$1(function () {
18500
+ nextTick(function () {
18503
18501
  setNeedMarquee(true);
18504
18502
  });
18505
18503
  }, duration_1 * 1000);
@@ -18606,7 +18604,7 @@
18606
18604
  }
18607
18605
 
18608
18606
  render(dynamicProps);
18609
- nextTick$1(function () {
18607
+ nextTick(function () {
18610
18608
  if (leaving) return;
18611
18609
  dynamicProps.visible = true;
18612
18610
  render(dynamicProps);
@@ -18685,7 +18683,7 @@
18685
18683
  }
18686
18684
  }, [visible]);
18687
18685
  React.useEffect(function () {
18688
- nextTick$1(function () {
18686
+ nextTick(function () {
18689
18687
  setHasTrans(true);
18690
18688
  });
18691
18689
  return function () {
@@ -20333,7 +20331,7 @@
20333
20331
  if (per > 0 && per >= percentToClose && Math.abs(value) > distanceToClose || Math.abs(speed) > speedToClose) {
20334
20332
  setHasTrans(false);
20335
20333
  close(e);
20336
- nextTick$1(function () {
20334
+ nextTick(function () {
20337
20335
  setDistance({
20338
20336
  direction: direc,
20339
20337
  value: getDescDisFromDirection(direc, value)
@@ -21034,7 +21032,7 @@
21034
21032
  var refresh = function refresh() {
21035
21033
  return new Promise(function (resolve) {
21036
21034
  setStatus(PullRefreshStatus.Loading);
21037
- nextTick$1(function () {
21035
+ nextTick(function () {
21038
21036
  scroll(tipsHeight, 300);
21039
21037
  handleRefresh().then(function () {
21040
21038
  if (pullTextConfig[PullRefreshStatus.Finish]) {
@@ -22365,7 +22363,7 @@
22365
22363
  onCancel === null || onCancel === void 0 ? void 0 : onCancel(); // 如果不延迟,在聚焦切输入框有值的情况下,点击取消按钮会造成闪烁
22366
22364
  // @en If there is no delay, when the focus cut input box has a value, clicking the cancel button will cause flickering
22367
22365
 
22368
- nextTick$1(function () {
22366
+ nextTick(function () {
22369
22367
  setVisible(false);
22370
22368
  });
22371
22369
  };
@@ -22934,19 +22932,6 @@
22934
22932
  });
22935
22933
  });
22936
22934
 
22937
- /**
22938
- * @type utils
22939
- * @name utils
22940
- */
22941
- /**
22942
- * 历史逻辑问题,轻喷 _(:з」∠)_
22943
- * @desc {en} Please ignore this weird function _(:з」∠)_
22944
- */
22945
-
22946
- function nextTick(func) {
22947
- setTimeout(func, 20);
22948
- }
22949
-
22950
22935
  function renderAction(_a) {
22951
22936
  var action = _a.action,
22952
22937
  prefixCls = _a.prefixCls,