@arco-design/mobile-react 2.29.3 → 2.29.4

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 (46) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.en-US.md +2 -2
  3. package/README.md +2 -2
  4. package/cjs/load-more/index.d.ts +6 -0
  5. package/cjs/load-more/index.js +9 -3
  6. package/cjs/picker/index.js +2 -9
  7. package/cjs/picker-view/components/cascader.d.ts +1 -0
  8. package/cjs/picker-view/components/cascader.js +8 -1
  9. package/cjs/picker-view/components/picker-cell.d.ts +1 -0
  10. package/cjs/picker-view/components/picker-cell.js +8 -1
  11. package/cjs/picker-view/index.js +15 -9
  12. package/cjs/search-bar/style/css/index.css +2 -0
  13. package/cjs/search-bar/style/index.less +93 -91
  14. package/cjs/tabs/index.js +4 -1
  15. package/dist/index.js +46 -23
  16. package/dist/index.min.js +2 -2
  17. package/dist/style.css +2 -0
  18. package/dist/style.min.css +1 -1
  19. package/esm/load-more/index.d.ts +6 -0
  20. package/esm/load-more/index.js +9 -3
  21. package/esm/picker/index.js +4 -10
  22. package/esm/picker-view/components/cascader.d.ts +1 -0
  23. package/esm/picker-view/components/cascader.js +8 -1
  24. package/esm/picker-view/components/picker-cell.d.ts +1 -0
  25. package/esm/picker-view/components/picker-cell.js +8 -1
  26. package/esm/picker-view/index.js +16 -10
  27. package/esm/search-bar/style/css/index.css +2 -0
  28. package/esm/search-bar/style/index.less +93 -91
  29. package/esm/tabs/index.js +4 -1
  30. package/package.json +3 -3
  31. package/tokens/app/arcodesign/default/css-variables.less +2 -0
  32. package/tokens/app/arcodesign/default/index.d.ts +2 -0
  33. package/tokens/app/arcodesign/default/index.js +2 -0
  34. package/tokens/app/arcodesign/default/index.json +24 -0
  35. package/tokens/app/arcodesign/default/index.less +2 -0
  36. package/umd/load-more/index.d.ts +6 -0
  37. package/umd/load-more/index.js +9 -3
  38. package/umd/picker/index.js +2 -9
  39. package/umd/picker-view/components/cascader.d.ts +1 -0
  40. package/umd/picker-view/components/cascader.js +8 -1
  41. package/umd/picker-view/components/picker-cell.d.ts +1 -0
  42. package/umd/picker-view/components/picker-cell.js +8 -1
  43. package/umd/picker-view/index.js +15 -9
  44. package/umd/search-bar/style/css/index.css +2 -0
  45. package/umd/search-bar/style/index.less +93 -91
  46. package/umd/tabs/index.js +4 -1
@@ -1,12 +1,12 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
3
3
  var _excluded = ["className", "itemStyle", "cascade", "cols", "rows", "data", "okText", "dismissText", "disabled", "clickable", "hideEmptyCols", "title", "visible", "value", "needBottomOffset", "onDismiss", "onOk", "onChange", "maskClosable", "onHide", "onPickerChange", "touchToStop", "gestureOutOfControl"];
4
- import React, { useEffect, useState, useRef, forwardRef, useImperativeHandle } from 'react';
4
+ import React, { useEffect, useRef, forwardRef, useImperativeHandle } from 'react';
5
5
  import { cls, componentWrapper, nextTick } from '@arco-design/mobile-utils';
6
6
  import { ContextLayout } from '../context-provider';
7
7
  import Popup from '../popup';
8
8
  import PickerView from '../picker-view';
9
- import { useListenResize } from '../_helpers';
9
+ import { useLatestRef, useListenResize } from '../_helpers';
10
10
  export * from './type';
11
11
  export { MultiPicker, PickerCell, Cascader } from '../picker-view';
12
12
  var Picker = /*#__PURE__*/forwardRef(function (props, ref) {
@@ -46,10 +46,7 @@ var Picker = /*#__PURE__*/forwardRef(function (props, ref) {
46
46
  gestureOutOfControl = _props$gestureOutOfCo === void 0 ? true : _props$gestureOutOfCo,
47
47
  otherProps = _objectWithoutPropertiesLoose(props, _excluded);
48
48
 
49
- var _useState = useState(value),
50
- scrollValue = _useState[0],
51
- setScrollValue = _useState[1];
52
-
49
+ var scrollValueRef = useLatestRef(value);
53
50
  var domRef = useRef(null);
54
51
  var pickerViewRef = useRef(null);
55
52
  useImperativeHandle(ref, function () {
@@ -100,7 +97,7 @@ var Picker = /*#__PURE__*/forwardRef(function (props, ref) {
100
97
  nextTick(function () {
101
98
  var _pickerViewRef$curren7;
102
99
 
103
- var val = ((_pickerViewRef$curren7 = pickerViewRef.current) == null ? void 0 : _pickerViewRef$curren7.getAllColumnValues()) || scrollValue || [];
100
+ var val = ((_pickerViewRef$curren7 = pickerViewRef.current) == null ? void 0 : _pickerViewRef$curren7.getAllColumnValues()) || scrollValueRef.current || [];
104
101
 
105
102
  if (onOk) {
106
103
  onOk(val);
@@ -116,9 +113,6 @@ var Picker = /*#__PURE__*/forwardRef(function (props, ref) {
116
113
  });
117
114
  };
118
115
 
119
- useEffect(function () {
120
- setScrollValue(value);
121
- }, [value, setScrollValue]);
122
116
  useListenResize(updateLayoutByVisible, [visible]); // 每次visible从false变为true时需要重新设置scrollValue的值为当前value的值(初始值)
123
117
 
124
118
  function updateLayoutByVisible() {
@@ -18,6 +18,7 @@ export interface CascaderProps {
18
18
  export interface CascaderRef {
19
19
  getCellMovingStatus: () => PickerCellMovingStatus[];
20
20
  scrollToCurrentIndex: () => void;
21
+ getAllCellsValue: () => ValueType[];
21
22
  }
22
23
  declare const Cascader: React.ForwardRefExoticComponent<CascaderProps & React.RefAttributes<CascaderRef>>;
23
24
  export default Cascader;
@@ -21,7 +21,8 @@ var Cascader = /*#__PURE__*/forwardRef(function (props, ref) {
21
21
  useImperativeHandle(ref, function () {
22
22
  return {
23
23
  getCellMovingStatus: getCellMovingStatus,
24
- scrollToCurrentIndex: scrollToCurrentIndex
24
+ scrollToCurrentIndex: scrollToCurrentIndex,
25
+ getAllCellsValue: getAllCellsValue
25
26
  };
26
27
  });
27
28
 
@@ -37,6 +38,12 @@ var Cascader = /*#__PURE__*/forwardRef(function (props, ref) {
37
38
  });
38
39
  }
39
40
 
41
+ function getAllCellsValue() {
42
+ return pickerCellsRef.current.map(function (cell) {
43
+ return cell.getCurrentCellValue();
44
+ });
45
+ }
46
+
40
47
  function _onValueChange(value, index, newData) {
41
48
  var children = arrayTreeFilter(data, function (item, level) {
42
49
  return level <= index && item.value === value[level];
@@ -21,6 +21,7 @@ export interface PickerCellProps {
21
21
  export interface PickerCellRef {
22
22
  movingStatus: PickerCellMovingStatus;
23
23
  scrollToCurrentIndex: () => void;
24
+ getCurrentCellValue: () => ValueType;
24
25
  }
25
26
  declare const PickerCell: React.ForwardRefExoticComponent<PickerCellProps & React.RefAttributes<PickerCellRef>>;
26
27
  export default PickerCell;
@@ -283,6 +283,12 @@ var PickerCell = /*#__PURE__*/forwardRef(function (props, ref) {
283
283
  _scrollToIndexWithChange(nowIndex, 0);
284
284
  }
285
285
 
286
+ function getCurrentCellValue() {
287
+ var _data$currentIndex;
288
+
289
+ return currentValue || ((_data$currentIndex = data[currentIndex]) == null ? void 0 : _data$currentIndex.value);
290
+ }
291
+
286
292
  function _clearTimer() {
287
293
  timeRef.current && clearTimeout(timeRef.current);
288
294
  timeRef.current = null;
@@ -347,7 +353,8 @@ var PickerCell = /*#__PURE__*/forwardRef(function (props, ref) {
347
353
  useImperativeHandle(ref, function () {
348
354
  return {
349
355
  movingStatus: movingStatusRef.current,
350
- scrollToCurrentIndex: scrollToCurrentIndex
356
+ scrollToCurrentIndex: scrollToCurrentIndex,
357
+ getCurrentCellValue: getCurrentCellValue
351
358
  };
352
359
  });
353
360
  return !hideEmptyCols || data && data.length ? /*#__PURE__*/React.createElement("div", {
@@ -5,7 +5,7 @@ import { ContextLayout } from '../context-provider';
5
5
  import MultiPicker from '../picker-view/components/multi-picker';
6
6
  import PickerCell from '../picker-view/components/picker-cell';
7
7
  import Cascader from '../picker-view/components/cascader';
8
- import { useLatestRef, useMountedState } from '../_helpers';
8
+ import { useMountedState } from '../_helpers';
9
9
  export * from './type';
10
10
  export { MultiPicker, PickerCell, Cascader };
11
11
  var PickerView = /*#__PURE__*/forwardRef(function (props, ref) {
@@ -45,7 +45,6 @@ var PickerView = /*#__PURE__*/forwardRef(function (props, ref) {
45
45
  var wrapperRef = useRef(null);
46
46
  var domRef = useRef(null);
47
47
  var barRef = useRef(null);
48
- var scrollValueRef = useLatestRef(scrollValue);
49
48
  var pickerCellsRef = useRef([]);
50
49
  var cascaderRef = useRef(null); // itemStyle height 同时对 selection-bar 生效,这里不单独抛出 selection-bar 的高度设置属性
51
50
  // @en The height of itemStyle applies to the selection-bar as well, without separately exposing the height setting property for the selection-bar.
@@ -87,32 +86,39 @@ var PickerView = /*#__PURE__*/forwardRef(function (props, ref) {
87
86
  }, [data]);
88
87
 
89
88
  var getAllColumnValues = function getAllColumnValues() {
90
- return scrollValueRef.current || [];
89
+ var _cascaderRef$current;
90
+
91
+ var curValues = cascade ? ((_cascaderRef$current = cascaderRef.current) == null ? void 0 : _cascaderRef$current.getAllCellsValue()) || [] : pickerCellsRef.current.map(function (cell) {
92
+ return cell.getCurrentCellValue();
93
+ }); // 移除级联带来的空列值,理论上非首尾列不会有空值
94
+ // @en Remove empty values from cascader
95
+
96
+ return curValues.filter(function (v) {
97
+ return v;
98
+ });
91
99
  };
92
100
 
93
101
  function getColumnValue(index) {
94
- var _scrollValueRef$curre;
95
-
96
102
  if (index === void 0) {
97
103
  index = 0;
98
104
  }
99
105
 
100
- return (_scrollValueRef$curre = scrollValueRef.current) == null ? void 0 : _scrollValueRef$curre[index];
106
+ return getAllColumnValues()[index];
101
107
  }
102
108
 
103
109
  function getCellMovingStatus() {
104
- var _cascaderRef$current;
110
+ var _cascaderRef$current2;
105
111
 
106
- return cascade ? ((_cascaderRef$current = cascaderRef.current) == null ? void 0 : _cascaderRef$current.getCellMovingStatus()) || [] : pickerCellsRef.current.map(function (cell) {
112
+ return cascade ? ((_cascaderRef$current2 = cascaderRef.current) == null ? void 0 : _cascaderRef$current2.getCellMovingStatus()) || [] : pickerCellsRef.current.map(function (cell) {
107
113
  return cell.movingStatus;
108
114
  });
109
115
  }
110
116
 
111
117
  function scrollToCurrentIndex() {
112
118
  if (cascade) {
113
- var _cascaderRef$current2;
119
+ var _cascaderRef$current3;
114
120
 
115
- (_cascaderRef$current2 = cascaderRef.current) == null ? void 0 : _cascaderRef$current2.scrollToCurrentIndex();
121
+ (_cascaderRef$current3 = cascaderRef.current) == null ? void 0 : _cascaderRef$current3.scrollToCurrentIndex();
116
122
  return;
117
123
  }
118
124
 
@@ -75,6 +75,8 @@
75
75
  }
76
76
  .arco-search-bar-clear {
77
77
  color: #C9CDD4 ;
78
+ font-size: 16PX ;
79
+ padding-left: 0.32rem ;
78
80
  }
79
81
  .arco-search-bar-search-icon {
80
82
  color: #86909C ;
@@ -1,112 +1,114 @@
1
1
  @import '../../../style/mixin.less';
2
2
 
3
3
  .@{prefix}-search-bar {
4
- &-container {
5
- display: flex;
6
- align-items: center;
7
- position: relative;
8
- .use-var(padding, search-bar-padding);
9
- .use-var(background-color, search-bar-background-color);
10
- }
11
- &-square {
12
- .@{prefix}-search-bar-wrap {
13
- .use-var(border-radius, search-bar-square-shape-border-radius);
4
+ &-container {
5
+ display: flex;
6
+ align-items: center;
7
+ position: relative;
8
+ .use-var(padding, search-bar-padding);
9
+ .use-var(background-color, search-bar-background-color);
14
10
  }
15
- }
16
- &-round {
17
- .@{prefix}-search-bar-wrap {
18
- .use-var(border-radius, search-bar-round-shape-border-radius);
11
+ &-square {
12
+ .@{prefix}-search-bar-wrap {
13
+ .use-var(border-radius, search-bar-square-shape-border-radius);
14
+ }
19
15
  }
20
- }
21
- &-wrap {
22
- display: flex;
23
- align-items: center;
24
- flex: 1;
25
- .use-var(height, search-bar-input-wrapper-height);
26
- .use-var(font-size, search-bar-input-wrapper-font-size);
27
- .use-var(padding, search-bar-input-wrapper-padding);
28
- .use-var(background-color, search-bar-input-wrapper-background-color);
29
- }
30
- &-input {
31
- flex: 1;
32
- background-color: transparent;
33
- .use-var(height, search-bar-input-height);
34
- .use-var(caret-color, search-bar-input-caret-color);
35
- &-left {
36
- text-align: left;
16
+ &-round {
17
+ .@{prefix}-search-bar-wrap {
18
+ .use-var(border-radius, search-bar-round-shape-border-radius);
19
+ }
37
20
  }
38
- &-right {
39
- text-align: right;
40
- }
41
- &-center {
42
- text-align: center;
21
+ &-wrap {
22
+ display: flex;
23
+ align-items: center;
24
+ flex: 1;
25
+ .use-var(height, search-bar-input-wrapper-height);
26
+ .use-var(font-size, search-bar-input-wrapper-font-size);
27
+ .use-var(padding, search-bar-input-wrapper-padding);
28
+ .use-var(background-color, search-bar-input-wrapper-background-color);
43
29
  }
30
+ &-input {
31
+ flex: 1;
32
+ background-color: transparent;
33
+ .use-var(height, search-bar-input-height);
34
+ .use-var(caret-color, search-bar-input-caret-color);
35
+ &-left {
36
+ text-align: left;
37
+ }
38
+ &-right {
39
+ text-align: right;
40
+ }
41
+ &-center {
42
+ text-align: center;
43
+ }
44
+
45
+ &::placeholder {
46
+ .use-var(color, search-bar-input-placeholder-color);
47
+ }
44
48
 
45
- &::placeholder {
46
- .use-var(color, search-bar-input-placeholder-color);
49
+ &::-webkit-search-decoration,
50
+ &::-webkit-search-cancel-button {
51
+ display: none;
52
+ }
47
53
  }
48
54
 
49
- &::-webkit-search-decoration,
50
- &::-webkit-search-cancel-button {
51
- display: none;
55
+ &-prefix,
56
+ &-suffix,
57
+ &-clear {
58
+ align-items: center;
59
+ justify-content: center;
60
+ display: flex;
52
61
  }
53
- }
54
62
 
55
- &-prefix,
56
- &-suffix,
57
- &-clear {
58
- align-items: center;
59
- justify-content: center;
60
- display: flex;
61
- }
63
+ &-prefix {
64
+ .use-var(margin-right, search-bar-prefix-margin-right);
65
+ }
62
66
 
63
- &-prefix {
64
- .use-var(margin-right, search-bar-prefix-margin-right);
65
- }
67
+ &-clear {
68
+ .use-var(color, search-bar-clear-icon-color);
69
+ .use-var(font-size, search-bar-clear-icon-font-size);
70
+ .use-var(padding-left, search-bar-clear-icon-padding-left);
71
+ }
66
72
 
67
- &-clear {
68
- .use-var(color, search-bar-clear-icon-color);
69
- }
73
+ &-search-icon {
74
+ .use-var(color, search-bar-search-icon-color);
75
+ .use-var(font-size, search-bar-search-icon-font-size);
76
+ }
70
77
 
71
- &-search-icon {
72
- .use-var(color, search-bar-search-icon-color);
73
- .use-var(font-size, search-bar-search-icon-font-size);
74
- }
78
+ &-cancel-btn {
79
+ .use-var(margin-left, search-bar-cancel-btn-margin-left);
80
+ .use-var(color, search-bar-cancel-btn-color);
81
+ .use-var(font-size, search-bar-cancel-btn-font-size);
82
+ }
75
83
 
76
- &-cancel-btn {
77
- .use-var(margin-left, search-bar-cancel-btn-margin-left);
78
- .use-var(color, search-bar-cancel-btn-color);
79
- .use-var(font-size, search-bar-cancel-btn-font-size);
80
- }
84
+ &-association {
85
+ position: absolute;
86
+ left: 0;
87
+ right: 0;
88
+ .use-var(background-color, search-bar-association-background-color);
89
+ top: 100%;
90
+ display: none;
81
91
 
82
- &-association {
83
- position: absolute;
84
- left: 0;
85
- right: 0;
86
- .use-var(background-color, search-bar-association-background-color);
87
- top: 100%;
88
- display: none;
92
+ &-visible {
93
+ display: block;
94
+ }
89
95
 
90
- &-visible {
91
- display: block;
92
- }
96
+ &-item {
97
+ .use-var(height, search-bar-association-item-height);
98
+ display: flex;
99
+ align-items: center;
100
+ position: relative;
101
+ .use-var(color, search-bar-association-item-color);
102
+ .use-var(padding, search-bar-association-item-padding);
103
+ .use-var(font-size, search-bar-association-item-font-size);
93
104
 
94
- &-item {
95
- .use-var(height, search-bar-association-item-height);
96
- display: flex;
97
- align-items: center;
98
- position: relative;
99
- .use-var(color, search-bar-association-item-color);
100
- .use-var(padding, search-bar-association-item-padding);
101
- .use-var(font-size, search-bar-association-item-font-size);
102
-
103
- &:not(:last-child) {
104
- .onepx-border-var(bottom, line-color);
105
- }
105
+ &:not(:last-child) {
106
+ .onepx-border-var(bottom, line-color);
107
+ }
106
108
 
107
- &-highlight {
108
- .use-var(color, search-bar-association-item-highlight-color)
109
- }
109
+ &-highlight {
110
+ .use-var(color, search-bar-association-item-highlight-color)
111
+ }
112
+ }
110
113
  }
111
- }
112
- }
114
+ }
package/esm/tabs/index.js CHANGED
@@ -171,6 +171,7 @@ var Tabs = /*#__PURE__*/forwardRef(function (props, ref) {
171
171
  var touchStartXRef = useRef(0);
172
172
  var touchStartYRef = useRef(0);
173
173
  var touchStartTimeRef = useRef(0);
174
+ var touchMovedRef = useRef(false);
174
175
  var scrollingRef = useRef(null);
175
176
  var touchStoppedRef = useRef(false);
176
177
  var changeFromRef = useRef('');
@@ -264,6 +265,7 @@ var Tabs = /*#__PURE__*/forwardRef(function (props, ref) {
264
265
  }
265
266
 
266
267
  touchStartedRef.current = true;
268
+ touchMovedRef.current = false;
267
269
  setCellTrans(false);
268
270
  setPaneTrans(false);
269
271
  var evt = e.touches[0];
@@ -291,6 +293,7 @@ var Tabs = /*#__PURE__*/forwardRef(function (props, ref) {
291
293
  return;
292
294
  }
293
295
 
296
+ touchMovedRef.current = true;
294
297
  var evt = e.changedTouches[0];
295
298
  var touchMoveX = evt.clientX || 0;
296
299
  var touchMoveY = evt.clientY || 0; // bugfix: 兼容safari在右滑返回上一页时clientX为负值的情况,安卓有折叠屏,触点会有超出屏幕(clientX < 0)的情况,因此这里限定ios系统
@@ -357,7 +360,7 @@ var Tabs = /*#__PURE__*/forwardRef(function (props, ref) {
357
360
  cellRef.current && cellRef.current.scrollToCenter();
358
361
  }
359
362
 
360
- if (!touchStartedRef.current || posAdjustingRef.current || scrollingRef.current) {
363
+ if (!touchStartedRef.current || posAdjustingRef.current || scrollingRef.current || !touchMovedRef.current) {
361
364
  return;
362
365
  }
363
366
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arco-design/mobile-react",
3
- "version": "2.29.3",
3
+ "version": "2.29.4",
4
4
  "description": "",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",
@@ -15,7 +15,7 @@
15
15
  "author": "taoyiyue@bytedance.com",
16
16
  "license": "ISC",
17
17
  "dependencies": {
18
- "@arco-design/mobile-utils": "2.16.6",
18
+ "@arco-design/mobile-utils": "2.16.7",
19
19
  "@arco-design/transformable": "^1.0.0",
20
20
  "lodash.throttle": "^4.1.1",
21
21
  "resize-observer-polyfill": "^1.5.1"
@@ -49,5 +49,5 @@
49
49
  "publishConfig": {
50
50
  "access": "public"
51
51
  },
52
- "gitHead": "91a7490bc2dd677acfa7c064946ff83dccab4196"
52
+ "gitHead": "102b5dcc89375c9d6d47d230fa1cdd219ca10c19"
53
53
  }
@@ -678,6 +678,8 @@
678
678
  --search-bar-input-placeholder-color: var(--disabled-color);
679
679
  --search-bar-prefix-margin-right: ~`pxtorem(9)`;
680
680
  --search-bar-clear-icon-color: #C9CDD4;
681
+ --search-bar-clear-icon-font-size: 16PX;
682
+ --search-bar-clear-icon-padding-left: ~`pxtorem(16)`;
681
683
  --search-bar-search-icon-color: #86909C;
682
684
  --search-bar-search-icon-font-size: ~`pxtorem(16)`;
683
685
  --search-bar-cancel-btn-color: var(--primary-color);
@@ -677,6 +677,8 @@ export interface ArcodesignToken extends Record<string, string> {
677
677
  'search-bar-input-placeholder-color': string;
678
678
  'search-bar-prefix-margin-right': string;
679
679
  'search-bar-clear-icon-color': string;
680
+ 'search-bar-clear-icon-font-size': string;
681
+ 'search-bar-clear-icon-padding-left': string;
680
682
  'search-bar-search-icon-color': string;
681
683
  'search-bar-search-icon-font-size': string;
682
684
  'search-bar-cancel-btn-color': string;
@@ -689,6 +689,8 @@ var tokens = {
689
689
  "search-bar-input-placeholder-color": "var(--disabled-color)",
690
690
  "search-bar-prefix-margin-right": "0.18rem",
691
691
  "search-bar-clear-icon-color": "#C9CDD4",
692
+ "search-bar-clear-icon-font-size": "16PX",
693
+ "search-bar-clear-icon-padding-left": "0.32rem",
692
694
  "search-bar-search-icon-color": "#86909C",
693
695
  "search-bar-search-icon-font-size": "0.32rem",
694
696
  "search-bar-cancel-btn-color": "var(--primary-color)",
@@ -6473,6 +6473,30 @@
6473
6473
  "en": "Color of SearchBar clear icon"
6474
6474
  }
6475
6475
  },
6476
+ "searchBarClearIconFontSize": {
6477
+ "cssKey": "search-bar-clear-icon-font-size",
6478
+ "desc": "搜索栏清除按钮的大小",
6479
+ "override": "",
6480
+ "value": "16PX",
6481
+ "jsValue": "16PX",
6482
+ "staticValue": "16PX",
6483
+ "localeDesc": {
6484
+ "ch": "搜索栏清除按钮的大小",
6485
+ "en": "Size of SearchBar clear icon"
6486
+ }
6487
+ },
6488
+ "searchBarClearIconPaddingLeft": {
6489
+ "cssKey": "search-bar-clear-icon-padding-left",
6490
+ "desc": "搜索栏清除按钮与输入框间距",
6491
+ "override": "",
6492
+ "value": "~`pxtorem(16)`",
6493
+ "jsValue": "@getRem@16",
6494
+ "staticValue": "0.32rem",
6495
+ "localeDesc": {
6496
+ "ch": "搜索栏清除按钮与输入框间距",
6497
+ "en": "Padding left of SearchBar clear icon"
6498
+ }
6499
+ },
6476
6500
  "searchBarInputCaretColor": {
6477
6501
  "cssKey": "search-bar-input-caret-color",
6478
6502
  "desc": "搜索输入框光标颜色",
@@ -677,6 +677,8 @@
677
677
  @search-bar-input-placeholder-color: @disabled-color;
678
678
  @search-bar-prefix-margin-right: ~`pxtorem(9)`;
679
679
  @search-bar-clear-icon-color: #C9CDD4;
680
+ @search-bar-clear-icon-font-size: 16PX;
681
+ @search-bar-clear-icon-padding-left: ~`pxtorem(16)`;
680
682
  @search-bar-search-icon-color: #86909C;
681
683
  @search-bar-search-icon-font-size: ~`pxtorem(16)`;
682
684
  @search-bar-cancel-btn-color: @primary-color;
@@ -107,6 +107,12 @@ export interface LoadMoreProps {
107
107
  * @default true
108
108
  */
109
109
  getDataAtFirst?: boolean;
110
+ /**
111
+ * 当 getDataAtFirst === false 且数据不满一屏时是否触发一次请求,trigger=scroll时有效
112
+ * @en Whether to trigger a request when getDataAtFirst === false and the data is not full of one screen, valid when trigger=scroll
113
+ * @default false
114
+ */
115
+ getDataWhenNoScrollAtFirst?: boolean;
110
116
  /**
111
117
  * 状态改变时回调
112
118
  * @en Callback when state changes
@@ -60,7 +60,9 @@
60
60
  blockWhenLoading = _props$blockWhenLoadi === void 0 ? true : _props$blockWhenLoadi,
61
61
  onStatusChange = props.onStatusChange,
62
62
  onClick = props.onClick,
63
- onEndReached = props.onEndReached;
63
+ onEndReached = props.onEndReached,
64
+ _props$getDataWhenNoS = props.getDataWhenNoScrollAtFirst,
65
+ getDataWhenNoScrollAtFirst = _props$getDataWhenNoS === void 0 ? false : _props$getDataWhenNoS;
64
66
  var domRef = (0, _react.useRef)(null);
65
67
  var requestAtFirst = trigger === 'scroll' ? getDataAtFirst : false;
66
68
 
@@ -105,10 +107,14 @@
105
107
  }
106
108
  }, [nowStatus]);
107
109
  (0, _react.useEffect)(function () {
108
- if (requestAtFirst && !disabled) {
109
- if (statusRef.current === 'prepare') {
110
+ if (requestAtFirst) {
111
+ if (statusRef.current === 'prepare' && !disabled) {
110
112
  triggerGetData('requestAtFirst');
111
113
  }
114
+ } else {
115
+ if (trigger === 'scroll' && nowStatus === 'prepare' && checkNeedTrigger(0, threshold) && !disabled && getDataWhenNoScrollAtFirst) {
116
+ triggerGetData('pageEnd');
117
+ }
112
118
  }
113
119
  }, [trigger, disabled]);
114
120
  var handleContainerScroll = (0, _react.useCallback)(function () {
@@ -78,11 +78,7 @@
78
78
  _props$gestureOutOfCo = props.gestureOutOfControl,
79
79
  gestureOutOfControl = _props$gestureOutOfCo === void 0 ? true : _props$gestureOutOfCo,
80
80
  otherProps = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
81
-
82
- var _useState = (0, _react.useState)(value),
83
- scrollValue = _useState[0],
84
- setScrollValue = _useState[1];
85
-
81
+ var scrollValueRef = (0, _helpers.useLatestRef)(value);
86
82
  var domRef = (0, _react.useRef)(null);
87
83
  var pickerViewRef = (0, _react.useRef)(null);
88
84
  (0, _react.useImperativeHandle)(ref, function () {
@@ -133,7 +129,7 @@
133
129
  (0, _mobileUtils.nextTick)(function () {
134
130
  var _pickerViewRef$curren7;
135
131
 
136
- var val = ((_pickerViewRef$curren7 = pickerViewRef.current) == null ? void 0 : _pickerViewRef$curren7.getAllColumnValues()) || scrollValue || [];
132
+ var val = ((_pickerViewRef$curren7 = pickerViewRef.current) == null ? void 0 : _pickerViewRef$curren7.getAllColumnValues()) || scrollValueRef.current || [];
137
133
 
138
134
  if (onOk) {
139
135
  onOk(val);
@@ -149,9 +145,6 @@
149
145
  });
150
146
  };
151
147
 
152
- (0, _react.useEffect)(function () {
153
- setScrollValue(value);
154
- }, [value, setScrollValue]);
155
148
  (0, _helpers.useListenResize)(updateLayoutByVisible, [visible]); // 每次visible从false变为true时需要重新设置scrollValue的值为当前value的值(初始值)
156
149
 
157
150
  function updateLayoutByVisible() {
@@ -18,6 +18,7 @@ export interface CascaderProps {
18
18
  export interface CascaderRef {
19
19
  getCellMovingStatus: () => PickerCellMovingStatus[];
20
20
  scrollToCurrentIndex: () => void;
21
+ getAllCellsValue: () => ValueType[];
21
22
  }
22
23
  declare const Cascader: React.ForwardRefExoticComponent<CascaderProps & React.RefAttributes<CascaderRef>>;
23
24
  export default Cascader;
@@ -44,7 +44,8 @@
44
44
  (0, _react.useImperativeHandle)(ref, function () {
45
45
  return {
46
46
  getCellMovingStatus: getCellMovingStatus,
47
- scrollToCurrentIndex: scrollToCurrentIndex
47
+ scrollToCurrentIndex: scrollToCurrentIndex,
48
+ getAllCellsValue: getAllCellsValue
48
49
  };
49
50
  });
50
51
 
@@ -60,6 +61,12 @@
60
61
  });
61
62
  }
62
63
 
64
+ function getAllCellsValue() {
65
+ return pickerCellsRef.current.map(function (cell) {
66
+ return cell.getCurrentCellValue();
67
+ });
68
+ }
69
+
63
70
  function _onValueChange(value, index, newData) {
64
71
  var children = (0, _mobileUtils.arrayTreeFilter)(data, function (item, level) {
65
72
  return level <= index && item.value === value[level];
@@ -21,6 +21,7 @@ export interface PickerCellProps {
21
21
  export interface PickerCellRef {
22
22
  movingStatus: PickerCellMovingStatus;
23
23
  scrollToCurrentIndex: () => void;
24
+ getCurrentCellValue: () => ValueType;
24
25
  }
25
26
  declare const PickerCell: React.ForwardRefExoticComponent<PickerCellProps & React.RefAttributes<PickerCellRef>>;
26
27
  export default PickerCell;
@@ -305,6 +305,12 @@
305
305
  _scrollToIndexWithChange(nowIndex, 0);
306
306
  }
307
307
 
308
+ function getCurrentCellValue() {
309
+ var _data$currentIndex;
310
+
311
+ return currentValue || ((_data$currentIndex = data[currentIndex]) == null ? void 0 : _data$currentIndex.value);
312
+ }
313
+
308
314
  function _clearTimer() {
309
315
  timeRef.current && clearTimeout(timeRef.current);
310
316
  timeRef.current = null;
@@ -369,7 +375,8 @@
369
375
  (0, _react.useImperativeHandle)(ref, function () {
370
376
  return {
371
377
  movingStatus: movingStatusRef.current,
372
- scrollToCurrentIndex: scrollToCurrentIndex
378
+ scrollToCurrentIndex: scrollToCurrentIndex,
379
+ getCurrentCellValue: getCurrentCellValue
373
380
  };
374
381
  });
375
382
  return !hideEmptyCols || data && data.length ? /*#__PURE__*/_react.default.createElement("div", {