@arco-design/mobile-react 2.29.0 → 2.29.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,29 @@
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.29.2](https://github.com/arco-design/arco-design-mobile/compare/@arco-design/mobile-react@2.29.1...@arco-design/mobile-react@2.29.2) (2023-08-28)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * `LoadMore` support the prop "disabled" ([b1881b2](https://github.com/arco-design/arco-design-mobile/commit/b1881b2821debb3b94c66285d712e8f7522e6be7))
12
+ * `Tabs` the prop "tabBarFixed" supports passing in specific fixed values ([ae3158f](https://github.com/arco-design/arco-design-mobile/commit/ae3158f7f7d5d1eebca8921d6d4802aa53b31fbe))
13
+
14
+
15
+
16
+
17
+
18
+ ## [2.29.1](https://github.com/arco-design/arco-design-mobile/compare/@arco-design/mobile-react@2.29.0...@arco-design/mobile-react@2.29.1) (2023-08-21)
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+ * fix wrong logic after click clear icon of `Input`, `Textarea` and `SearchBar` ([#156](https://github.com/arco-design/arco-design-mobile/issues/156)) ([b741263](https://github.com/arco-design/arco-design-mobile/commit/b741263fd1a1b9c3da9c106f7487714e33e042f2))
24
+
25
+
26
+
27
+
28
+
6
29
  # [2.29.0](https://github.com/arco-design/arco-design-mobile/compare/@arco-design/mobile-react@2.28.2...@arco-design/mobile-react@2.29.0) (2023-08-17)
7
30
 
8
31
 
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.28.2/dist/style.min.css">
63
- <script src="https://unpkg.com/@arco-design/mobile-react@2.28.2/dist/index.min.js"></script>
62
+ <link ref="stylesheet" href="https://unpkg.com/@arco-design/mobile-react@2.29.1/dist/style.min.css">
63
+ <script src="https://unpkg.com/@arco-design/mobile-react@2.29.1/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.28.2/dist/style.min.css">
63
- <script src="https://unpkg.com/@arco-design/mobile-react@2.28.2/dist/index.min.js"></script>
62
+ <link ref="stylesheet" href="https://unpkg.com/@arco-design/mobile-react@2.29.1/dist/style.min.css">
63
+ <script src="https://unpkg.com/@arco-design/mobile-react@2.29.1/dist/index.min.js"></script>
64
64
  ```
65
65
 
66
66
  ## 引入全部
@@ -5,6 +5,8 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  exports.__esModule = true;
6
6
  exports.useInputLogic = useInputLogic;
7
7
 
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+
8
10
  var _react = _interopRequireWildcard(require("react"));
9
11
 
10
12
  var _mobileUtils = require("@arco-design/mobile-utils");
@@ -62,23 +64,6 @@ function useInputLogic(props, inputRef) {
62
64
  toggleClear = _useState2[1];
63
65
 
64
66
  var compositingRef = (0, _react.useRef)(false);
65
- /**
66
- * clear相关问题背景
67
- * 如果点击clear按钮之前已经是focusing状态了,那么在点完clear按钮之后会手动聚焦一下
68
- * 该行为将导致onClear事件触发时,也会触发一次onBlur和onFocus事件,可能影响一些组件外的代码逻辑
69
- *
70
- * e.g. 假设input按钮右侧有一个按钮仅在聚焦时展示
71
- * 实现代码大致是:onBlur设置其visible为false,onFocus设置其visible为true
72
- * 那么这个按钮就会因为clear的点击造成一瞬的闪烁
73
- *
74
- * 解决思路
75
- * 先来看一下,在输入框已激活的状态时,点击清除按钮后,组件的一些事件的触发顺序
76
- * handleBlur -> handleClear -> handleFocus -> onBlur(外部回调) -> onFocus(外部回调)
77
- * 可以看到外部的onBlur和onFocus回调都是在handleClear函数之后被调用
78
- * 因此可以在handleClear中设置一个shouldPreventEvent的boolean标志
79
- * 如果这个标志为true,则跳过调用外部的onBlur和onFocus,并在最后再将标志置回false
80
- *
81
- */
82
67
 
83
68
  var _useState3 = (0, _react.useState)(false),
84
69
  isFocusing = _useState3[0],
@@ -178,28 +163,24 @@ function useInputLogic(props, inputRef) {
178
163
  }
179
164
 
180
165
  function handleFocus(e) {
181
- (0, _mobileUtils.nextTick)(function () {
182
- if (preventEventWhenClearing && shouldPreventEvent.current) {
183
- shouldPreventEvent.current = false;
184
- return;
185
- }
166
+ if (preventEventWhenClearing && shouldPreventEvent.current) {
167
+ shouldPreventEvent.current = false;
168
+ return;
169
+ }
186
170
 
187
- setIsFocusing(true);
188
- clearShowType === 'focus' && toggleClear(true);
189
- onFocus && onFocus(e);
190
- });
171
+ setIsFocusing(true);
172
+ clearShowType === 'focus' && toggleClear(true);
173
+ onFocus && onFocus(e);
191
174
  }
192
175
 
193
176
  function handleBlur(e) {
194
- (0, _mobileUtils.nextTick)(function () {
195
- if (preventEventWhenClearing && shouldPreventEvent.current) {
196
- return;
197
- }
177
+ if (preventEventWhenClearing && shouldPreventEvent.current) {
178
+ return;
179
+ }
198
180
 
199
- setIsFocusing(false);
200
- clearShowType === 'focus' && toggleClear(false);
201
- onBlur && onBlur(e);
202
- });
181
+ setIsFocusing(false);
182
+ clearShowType === 'focus' && toggleClear(false);
183
+ onBlur && onBlur(e);
203
184
  }
204
185
 
205
186
  function handleClick(e) {
@@ -230,10 +211,17 @@ function useInputLogic(props, inputRef) {
230
211
 
231
212
  if (isFocusing) {
232
213
  if (preventEventWhenClearing) {
233
- shouldPreventEvent.current = true;
214
+ shouldPreventEvent.current = true; // 一段时间未执行blur或focus则重置,避免对下次事件循环造成影响
215
+ // @en If blur or focus is not executed for a period of time, it will be reset to avoid affecting the next event loop
216
+
217
+ setTimeout(function () {
218
+ shouldPreventEvent.current = false;
219
+ }, 200);
234
220
  }
235
221
 
236
- inputRef.current && inputRef.current.focus();
222
+ (0, _mobileUtils.nextTick)(function () {
223
+ inputRef.current && inputRef.current.focus();
224
+ });
237
225
  }
238
226
  });
239
227
  }
@@ -243,6 +231,12 @@ function useInputLogic(props, inputRef) {
243
231
  }
244
232
 
245
233
  function renderWrapper(prefixCls, type, children) {
234
+ var _clearEvent;
235
+
236
+ // handleClear必须早于handleBlur执行,pc端仅mousedown事件触发早于blur,移动端touch相关事件均早于blur
237
+ // @en handleClear must be executed earlier than handleBlur
238
+ // @en only the mousedown event on the PC side is triggered earlier than blur, and the touch-related events on the mobile side are all earlier than blur
239
+ var clearEvent = (_clearEvent = {}, _clearEvent[system === 'pc' ? 'onMouseDown' : 'onTouchEnd'] = handleClear, _clearEvent);
246
240
  return /*#__PURE__*/_react.default.createElement("div", {
247
241
  role: "search",
248
242
  className: prefixCls + "-container all-border-box " + (className || ''),
@@ -262,10 +256,9 @@ function useInputLogic(props, inputRef) {
262
256
  className: (0, _mobileUtils.cls)(prefixCls + "-label", {
263
257
  required: required
264
258
  })
265
- }, label) : prefix) : null, children, clearable && showClear ? /*#__PURE__*/_react.default.createElement("div", {
266
- className: prefixCls + "-clear",
267
- onClick: handleClear
268
- }, clearIcon) : null, suffix ? /*#__PURE__*/_react.default.createElement("div", {
259
+ }, label) : prefix) : null, children, clearable && showClear ? /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({
260
+ className: prefixCls + "-clear"
261
+ }, clearEvent), clearIcon) : null, suffix ? /*#__PURE__*/_react.default.createElement("div", {
269
262
  className: prefixCls + "-suffix"
270
263
  }, suffix) : null), renderPendNode(append));
271
264
  }
@@ -124,7 +124,7 @@ export interface BasicInputProps<T = HTMLInputElement> {
124
124
  * 按下清除按钮回调
125
125
  * @en Callback when clear button is pressed
126
126
  */
127
- onClear?: (e: React.MouseEvent<HTMLElement, MouseEvent>) => void;
127
+ onClear?: (e: React.TouchEvent<HTMLElement>) => void;
128
128
  /**
129
129
  * 输入框前置内容,在输入框内部,也可自定义
130
130
  * @en The prefix of the input box, inside the input box, can also be customized
@@ -11,6 +11,11 @@ export interface LoadMoreProps {
11
11
  * @en Custom classname
12
12
  */
13
13
  className?: string;
14
+ /**
15
+ * 是否禁用加载能力
16
+ * @en Whether to disable the loading capability
17
+ */
18
+ disabled?: boolean;
14
19
  /**
15
20
  * 组件加载但尚未启用状态下的内容
16
21
  * @en Content when the component is loaded but not yet enabled
@@ -31,6 +31,7 @@ var LoadMore = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
31
31
  var _props$className = props.className,
32
32
  className = _props$className === void 0 ? '' : _props$className,
33
33
  style = props.style,
34
+ disabled = props.disabled,
34
35
  beforeReadyArea = props.beforeReadyArea,
35
36
  loadingArea = props.loadingArea,
36
37
  noMoreArea = props.noMoreArea,
@@ -65,11 +66,16 @@ var LoadMore = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
65
66
  var lastScrollEndRef = (0, _react.useRef)(false);
66
67
  var nowStatus = status || innerStatus;
67
68
  var statusRef = (0, _react.useRef)(nowStatus);
69
+ var disabledRef = (0, _helpers.useLatestRef)(disabled);
68
70
  var changeStatus = (0, _react.useCallback)(function (st, scene) {
69
71
  setInnerStatus(st);
70
72
  onStatusChange && onStatusChange(st, scene);
71
73
  }, [onStatusChange]);
72
74
  var triggerGetData = (0, _react.useCallback)(function (scene) {
75
+ if (disabledRef.current) {
76
+ return;
77
+ }
78
+
73
79
  if (blockWhenLoading && statusRef.current === 'loading') {
74
80
  return;
75
81
  }
@@ -94,12 +100,12 @@ var LoadMore = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
94
100
  }
95
101
  }, [nowStatus]);
96
102
  (0, _react.useEffect)(function () {
97
- if (requestAtFirst) {
103
+ if (requestAtFirst && !disabled) {
98
104
  if (statusRef.current === 'prepare') {
99
105
  triggerGetData('requestAtFirst');
100
106
  }
101
107
  }
102
- }, [trigger]);
108
+ }, [trigger, disabled]);
103
109
  var handleContainerScroll = (0, _react.useCallback)(function () {
104
110
  var scrollTop = (0, _mobileUtils.getScrollContainerAttribute)('scrollTop', getScrollContainer);
105
111
 
@@ -120,7 +126,7 @@ var LoadMore = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
120
126
  var binded = null;
121
127
  var scrollFunc = throttle ? (0, _lodash.default)(handleContainerScroll, throttle) : handleContainerScroll;
122
128
 
123
- if (trigger === 'scroll') {
129
+ if (trigger === 'scroll' && !disabled) {
124
130
  var container = (0, _mobileUtils.getValidScrollContainer)(getScrollContainer);
125
131
 
126
132
  if (container) {
@@ -134,7 +140,7 @@ var LoadMore = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
134
140
  binded.removeEventListener('scroll', scrollFunc);
135
141
  }
136
142
  };
137
- }, [trigger, getScrollContainer, handleContainerScroll, throttle]);
143
+ }, [trigger, disabled, getScrollContainer, handleContainerScroll, throttle]);
138
144
  (0, _react.useImperativeHandle)(ref, function () {
139
145
  return {
140
146
  dom: domRef.current,
@@ -187,11 +193,13 @@ var LoadMore = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
187
193
  }
188
194
 
189
195
  return /*#__PURE__*/_react.default.createElement(_contextProvider.ContextLayout, null, function (_ref) {
196
+ var _cls;
197
+
190
198
  var prefixCls = _ref.prefixCls,
191
199
  _ref$locale = _ref.locale,
192
200
  locale = _ref$locale === void 0 ? _mobileUtils.defaultLocale : _ref$locale;
193
201
  return /*#__PURE__*/_react.default.createElement("div", {
194
- className: prefixCls + "-load-more status-" + nowStatus + " " + className,
202
+ className: (0, _mobileUtils.cls)(prefixCls + "-load-more status-" + nowStatus, className, (_cls = {}, _cls[prefixCls + "-load-more-disabled"] = disabled, _cls)),
195
203
  ref: domRef,
196
204
  style: style,
197
205
  onClick: handleClick
@@ -378,7 +378,8 @@ var TabCell = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
378
378
  fixed: tabBarFixed
379
379
  }, {
380
380
  'has-divider': hasDivider
381
- })
381
+ }),
382
+ style: typeof tabBarFixed === 'object' ? tabBarFixed : {}
382
383
  }, /*#__PURE__*/_react.default.createElement("div", {
383
384
  className: (0, _mobileUtils.cls)(prefix + "-container", tabDirection, "pos-" + tabBarPosition, "arrange-" + (originArrange || tabBarArrange), "type-" + type, {
384
385
  overflow: hasOverflow
@@ -1,4 +1,4 @@
1
- import { ReactNode, ReactNodeArray } from 'react';
1
+ import { CSSProperties, ReactNode, ReactNodeArray } from 'react';
2
2
  export declare type TabData = string | {
3
3
  title: ReactNode;
4
4
  [x: string]: any;
@@ -71,10 +71,10 @@ export interface TabsProps {
71
71
  */
72
72
  tabBarScroll?: boolean;
73
73
  /**
74
- * TabBar是否顶部固定
75
- * @en Whether the TabBar is fixed on the top
74
+ * TabBar是否顶部/底部固定(含 placeholder),可传入具体固定的值
75
+ * @en Whether the TabBar is fixed on the top or bottom (including placeholder), a specific fixed value can be passed in
76
76
  */
77
- tabBarFixed?: boolean;
77
+ tabBarFixed?: boolean | Pick<CSSProperties, 'top' | 'bottom'>;
78
78
  /**
79
79
  * tabBar额外渲染内容
80
80
  * @en TabBar extra render content
package/dist/index.js CHANGED
@@ -941,7 +941,7 @@
941
941
  try {
942
942
  var u = navigator.userAgent;
943
943
  var android = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1;
944
- var ios = u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/) || u.indexOf('Mac OS X') > -1;
944
+ var ios = u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
945
945
  var pc = !android && !ios;
946
946
  var system = android ? 'android' : 'ios';
947
947
  return pc ? 'pc' : system;
@@ -4307,7 +4307,8 @@
4307
4307
  fixed: tabBarFixed
4308
4308
  }, {
4309
4309
  'has-divider': hasDivider
4310
- })
4310
+ }),
4311
+ style: typeof tabBarFixed === 'object' ? tabBarFixed : {}
4311
4312
  }, /*#__PURE__*/React__default["default"].createElement("div", {
4312
4313
  className: cls(prefix + "-container", tabDirection, "pos-" + tabBarPosition, "arrange-" + (originArrange || tabBarArrange), "type-" + type, {
4313
4314
  overflow: hasOverflow
@@ -5842,6 +5843,7 @@
5842
5843
  var _a = props.className,
5843
5844
  className = _a === void 0 ? '' : _a,
5844
5845
  style = props.style,
5846
+ disabled = props.disabled,
5845
5847
  beforeReadyArea = props.beforeReadyArea,
5846
5848
  loadingArea = props.loadingArea,
5847
5849
  noMoreArea = props.noMoreArea,
@@ -5876,11 +5878,16 @@
5876
5878
  var lastScrollEndRef = React.useRef(false);
5877
5879
  var nowStatus = status || innerStatus;
5878
5880
  var statusRef = React.useRef(nowStatus);
5881
+ var disabledRef = useLatestRef(disabled);
5879
5882
  var changeStatus = React.useCallback(function (st, scene) {
5880
5883
  setInnerStatus(st);
5881
5884
  onStatusChange && onStatusChange(st, scene);
5882
5885
  }, [onStatusChange]);
5883
5886
  var triggerGetData = React.useCallback(function (scene) {
5887
+ if (disabledRef.current) {
5888
+ return;
5889
+ }
5890
+
5884
5891
  if (blockWhenLoading && statusRef.current === 'loading') {
5885
5892
  return;
5886
5893
  }
@@ -5905,12 +5912,12 @@
5905
5912
  }
5906
5913
  }, [nowStatus]);
5907
5914
  React.useEffect(function () {
5908
- if (requestAtFirst) {
5915
+ if (requestAtFirst && !disabled) {
5909
5916
  if (statusRef.current === 'prepare') {
5910
5917
  triggerGetData('requestAtFirst');
5911
5918
  }
5912
5919
  }
5913
- }, [trigger]);
5920
+ }, [trigger, disabled]);
5914
5921
  var handleContainerScroll = React.useCallback(function () {
5915
5922
  var scrollTop = getScrollContainerAttribute('scrollTop', getScrollContainer);
5916
5923
 
@@ -5931,7 +5938,7 @@
5931
5938
  var binded = null;
5932
5939
  var scrollFunc = throttle ? lodash_throttle(handleContainerScroll, throttle) : handleContainerScroll;
5933
5940
 
5934
- if (trigger === 'scroll') {
5941
+ if (trigger === 'scroll' && !disabled) {
5935
5942
  var container = getValidScrollContainer(getScrollContainer);
5936
5943
 
5937
5944
  if (container) {
@@ -5945,7 +5952,7 @@
5945
5952
  binded.removeEventListener('scroll', scrollFunc);
5946
5953
  }
5947
5954
  };
5948
- }, [trigger, getScrollContainer, handleContainerScroll, throttle]);
5955
+ }, [trigger, disabled, getScrollContainer, handleContainerScroll, throttle]);
5949
5956
  React.useImperativeHandle(ref, function () {
5950
5957
  return {
5951
5958
  dom: domRef.current,
@@ -5998,11 +6005,13 @@
5998
6005
  }
5999
6006
 
6000
6007
  return /*#__PURE__*/React__default["default"].createElement(ContextLayout, null, function (_a) {
6008
+ var _b;
6009
+
6001
6010
  var prefixCls = _a.prefixCls,
6002
- _b = _a.locale,
6003
- locale = _b === void 0 ? defaultLocale : _b;
6011
+ _c = _a.locale,
6012
+ locale = _c === void 0 ? defaultLocale : _c;
6004
6013
  return /*#__PURE__*/React__default["default"].createElement("div", {
6005
- className: prefixCls + "-load-more status-" + nowStatus + " " + className,
6014
+ className: cls(prefixCls + "-load-more status-" + nowStatus, className, (_b = {}, _b[prefixCls + "-load-more-disabled"] = disabled, _b)),
6006
6015
  ref: domRef,
6007
6016
  style: style,
6008
6017
  onClick: handleClick
@@ -17316,7 +17325,7 @@
17316
17325
  var index$h = componentWrapper(ImagePicker, 'ImagePicker');
17317
17326
 
17318
17327
  /*!
17319
- * @arco-design/transformable v1.0.2
17328
+ * @arco-design/transformable v1.0.1
17320
17329
  * (c) 2022 ludan.kibbon
17321
17330
  */
17322
17331
  function _defineProperty(obj, key, value) {
@@ -21029,23 +21038,6 @@
21029
21038
  toggleClear = _f[1];
21030
21039
 
21031
21040
  var compositingRef = React.useRef(false);
21032
- /**
21033
- * clear相关问题背景
21034
- * 如果点击clear按钮之前已经是focusing状态了,那么在点完clear按钮之后会手动聚焦一下
21035
- * 该行为将导致onClear事件触发时,也会触发一次onBlur和onFocus事件,可能影响一些组件外的代码逻辑
21036
- *
21037
- * e.g. 假设input按钮右侧有一个按钮仅在聚焦时展示
21038
- * 实现代码大致是:onBlur设置其visible为false,onFocus设置其visible为true
21039
- * 那么这个按钮就会因为clear的点击造成一瞬的闪烁
21040
- *
21041
- * 解决思路
21042
- * 先来看一下,在输入框已激活的状态时,点击清除按钮后,组件的一些事件的触发顺序
21043
- * handleBlur -> handleClear -> handleFocus -> onBlur(外部回调) -> onFocus(外部回调)
21044
- * 可以看到外部的onBlur和onFocus回调都是在handleClear函数之后被调用
21045
- * 因此可以在handleClear中设置一个shouldPreventEvent的boolean标志
21046
- * 如果这个标志为true,则跳过调用外部的onBlur和onFocus,并在最后再将标志置回false
21047
- *
21048
- */
21049
21041
 
21050
21042
  var _g = React.useState(false),
21051
21043
  isFocusing = _g[0],
@@ -21145,28 +21137,24 @@
21145
21137
  }
21146
21138
 
21147
21139
  function handleFocus(e) {
21148
- nextTick(function () {
21149
- if (preventEventWhenClearing && shouldPreventEvent.current) {
21150
- shouldPreventEvent.current = false;
21151
- return;
21152
- }
21140
+ if (preventEventWhenClearing && shouldPreventEvent.current) {
21141
+ shouldPreventEvent.current = false;
21142
+ return;
21143
+ }
21153
21144
 
21154
- setIsFocusing(true);
21155
- clearShowType === 'focus' && toggleClear(true);
21156
- onFocus && onFocus(e);
21157
- });
21145
+ setIsFocusing(true);
21146
+ clearShowType === 'focus' && toggleClear(true);
21147
+ onFocus && onFocus(e);
21158
21148
  }
21159
21149
 
21160
21150
  function handleBlur(e) {
21161
- nextTick(function () {
21162
- if (preventEventWhenClearing && shouldPreventEvent.current) {
21163
- return;
21164
- }
21151
+ if (preventEventWhenClearing && shouldPreventEvent.current) {
21152
+ return;
21153
+ }
21165
21154
 
21166
- setIsFocusing(false);
21167
- clearShowType === 'focus' && toggleClear(false);
21168
- onBlur && onBlur(e);
21169
- });
21155
+ setIsFocusing(false);
21156
+ clearShowType === 'focus' && toggleClear(false);
21157
+ onBlur && onBlur(e);
21170
21158
  }
21171
21159
 
21172
21160
  function handleClick(e) {
@@ -21197,10 +21185,17 @@
21197
21185
 
21198
21186
  if (isFocusing) {
21199
21187
  if (preventEventWhenClearing) {
21200
- shouldPreventEvent.current = true;
21188
+ shouldPreventEvent.current = true; // 一段时间未执行blur或focus则重置,避免对下次事件循环造成影响
21189
+ // @en If blur or focus is not executed for a period of time, it will be reset to avoid affecting the next event loop
21190
+
21191
+ setTimeout(function () {
21192
+ shouldPreventEvent.current = false;
21193
+ }, 200);
21201
21194
  }
21202
21195
 
21203
- inputRef.current && inputRef.current.focus();
21196
+ nextTick(function () {
21197
+ inputRef.current && inputRef.current.focus();
21198
+ });
21204
21199
  }
21205
21200
  });
21206
21201
  }
@@ -21210,6 +21205,12 @@
21210
21205
  }
21211
21206
 
21212
21207
  function renderWrapper(prefixCls, type, children) {
21208
+ var _a; // handleClear必须早于handleBlur执行,pc端仅mousedown事件触发早于blur,移动端touch相关事件均早于blur
21209
+ // @en handleClear must be executed earlier than handleBlur
21210
+ // @en only the mousedown event on the PC side is triggered earlier than blur, and the touch-related events on the mobile side are all earlier than blur
21211
+
21212
+
21213
+ var clearEvent = (_a = {}, _a[system === 'pc' ? 'onMouseDown' : 'onTouchEnd'] = handleClear, _a);
21213
21214
  return /*#__PURE__*/React__default["default"].createElement("div", {
21214
21215
  role: "search",
21215
21216
  className: prefixCls + "-container all-border-box " + (className || ''),
@@ -21229,10 +21230,9 @@
21229
21230
  className: cls(prefixCls + "-label", {
21230
21231
  required: required
21231
21232
  })
21232
- }, label) : prefix) : null, children, clearable && showClear ? /*#__PURE__*/React__default["default"].createElement("div", {
21233
- className: prefixCls + "-clear",
21234
- onClick: handleClear
21235
- }, clearIcon) : null, suffix ? /*#__PURE__*/React__default["default"].createElement("div", {
21233
+ }, label) : prefix) : null, children, clearable && showClear ? /*#__PURE__*/React__default["default"].createElement("div", __assign$2({
21234
+ className: prefixCls + "-clear"
21235
+ }, clearEvent), clearIcon) : null, suffix ? /*#__PURE__*/React__default["default"].createElement("div", {
21236
21236
  className: prefixCls + "-suffix"
21237
21237
  }, suffix) : null), renderPendNode(append));
21238
21238
  }