@arco-design/mobile-react 2.30.9 → 2.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.en-US.md +70 -2
  3. package/README.md +69 -2
  4. package/cjs/carousel/index.js +3 -0
  5. package/cjs/form/form-item.d.ts +3 -0
  6. package/cjs/form/form-item.js +38 -10
  7. package/cjs/form/style/css/index.css +13 -0
  8. package/cjs/form/style/index.less +18 -0
  9. package/cjs/icon/IconCheck/index.js +1 -2
  10. package/cjs/icon/IconDownload/index.d.ts +7 -0
  11. package/cjs/icon/IconDownload/index.js +41 -0
  12. package/cjs/icon/IconFile/index.d.ts +7 -0
  13. package/cjs/icon/IconFile/index.js +41 -0
  14. package/cjs/icon/IconKeyboard/index.js +1 -0
  15. package/cjs/icon/IconQuestionCircle/index.js +1 -2
  16. package/cjs/icon/IconUpload/index.js +6 -4
  17. package/cjs/icon/IconUserFill/index.js +1 -2
  18. package/cjs/icon/index.d.ts +3 -1
  19. package/cjs/icon/index.js +17 -7
  20. package/cjs/icon/type.d.ts +3 -1
  21. package/cjs/image-picker/index.js +15 -161
  22. package/cjs/image-picker/type.d.ts +4 -73
  23. package/cjs/index.d.ts +1 -0
  24. package/cjs/index.js +6 -2
  25. package/cjs/input/hooks.js +2 -2
  26. package/cjs/input/props.d.ts +2 -2
  27. package/cjs/picker/index.js +60 -19
  28. package/cjs/picker/type.d.ts +7 -2
  29. package/cjs/picker-view/components/cascader.d.ts +1 -0
  30. package/cjs/picker-view/components/cascader.js +8 -1
  31. package/cjs/picker-view/components/picker-cell.d.ts +1 -0
  32. package/cjs/picker-view/components/picker-cell.js +6 -1
  33. package/cjs/picker-view/index.d.ts +6 -1
  34. package/cjs/picker-view/index.js +25 -13
  35. package/cjs/style.d.ts +1 -0
  36. package/cjs/style.js +3 -1
  37. package/cjs/tabs/tab-cell.js +54 -29
  38. package/cjs/tabs/type.d.ts +5 -0
  39. package/cjs/uploader/index.d.ts +16 -0
  40. package/cjs/uploader/index.js +180 -0
  41. package/cjs/uploader/style/css/index.css +650 -0
  42. package/cjs/uploader/style/css/index.d.ts +4 -0
  43. package/cjs/uploader/style/css/index.js +9 -0
  44. package/cjs/uploader/style/index.d.ts +4 -0
  45. package/cjs/uploader/style/index.js +9 -0
  46. package/cjs/uploader/style/index.less +161 -0
  47. package/cjs/uploader/type.d.ts +108 -0
  48. package/cjs/uploader/type.js +3 -0
  49. package/cjs/uploader/upload/index.d.ts +2 -0
  50. package/cjs/uploader/upload/index.js +19 -0
  51. package/cjs/uploader/upload/type.d.ts +107 -0
  52. package/cjs/uploader/upload/type.js +3 -0
  53. package/cjs/uploader/upload/upload.d.ts +20 -0
  54. package/cjs/uploader/upload/upload.js +189 -0
  55. package/dist/index.js +679 -310
  56. package/dist/index.min.js +4 -4
  57. package/dist/style.css +593 -0
  58. package/dist/style.min.css +1 -1
  59. package/esm/carousel/index.js +3 -0
  60. package/esm/form/form-item.d.ts +3 -0
  61. package/esm/form/form-item.js +36 -10
  62. package/esm/form/style/css/index.css +13 -0
  63. package/esm/form/style/index.less +18 -0
  64. package/esm/icon/IconCheck/index.js +1 -2
  65. package/esm/icon/IconDownload/index.d.ts +7 -0
  66. package/esm/icon/IconDownload/index.js +30 -0
  67. package/esm/icon/IconFile/index.d.ts +7 -0
  68. package/esm/icon/IconFile/index.js +30 -0
  69. package/esm/icon/IconKeyboard/index.js +1 -0
  70. package/esm/icon/IconQuestionCircle/index.js +1 -2
  71. package/esm/icon/IconUpload/index.js +6 -4
  72. package/esm/icon/IconUserFill/index.js +1 -2
  73. package/esm/icon/index.d.ts +3 -1
  74. package/esm/icon/index.js +3 -1
  75. package/esm/icon/type.d.ts +3 -1
  76. package/esm/image-picker/index.js +14 -160
  77. package/esm/image-picker/type.d.ts +4 -73
  78. package/esm/index.d.ts +1 -0
  79. package/esm/index.js +2 -1
  80. package/esm/input/hooks.js +2 -2
  81. package/esm/input/props.d.ts +2 -2
  82. package/esm/picker/index.js +61 -20
  83. package/esm/picker/type.d.ts +7 -2
  84. package/esm/picker-view/components/cascader.d.ts +1 -0
  85. package/esm/picker-view/components/cascader.js +8 -1
  86. package/esm/picker-view/components/picker-cell.d.ts +1 -0
  87. package/esm/picker-view/components/picker-cell.js +6 -1
  88. package/esm/picker-view/index.d.ts +6 -1
  89. package/esm/picker-view/index.js +26 -13
  90. package/esm/style.d.ts +1 -0
  91. package/esm/style.js +2 -1
  92. package/esm/tabs/tab-cell.js +56 -30
  93. package/esm/tabs/type.d.ts +5 -0
  94. package/esm/uploader/index.d.ts +16 -0
  95. package/esm/uploader/index.js +150 -0
  96. package/esm/uploader/style/css/index.css +650 -0
  97. package/esm/uploader/style/css/index.d.ts +4 -0
  98. package/esm/uploader/style/css/index.js +4 -0
  99. package/esm/uploader/style/index.d.ts +4 -0
  100. package/esm/uploader/style/index.js +4 -0
  101. package/esm/uploader/style/index.less +161 -0
  102. package/esm/uploader/type.d.ts +108 -0
  103. package/esm/uploader/type.js +1 -0
  104. package/esm/uploader/upload/index.d.ts +2 -0
  105. package/esm/uploader/upload/index.js +2 -0
  106. package/esm/uploader/upload/type.d.ts +107 -0
  107. package/esm/uploader/upload/type.js +1 -0
  108. package/esm/uploader/upload/upload.d.ts +20 -0
  109. package/esm/uploader/upload/upload.js +175 -0
  110. package/package.json +3 -3
  111. package/tokens/app/arcodesign/default/css-variables.less +27 -0
  112. package/tokens/app/arcodesign/default/index.d.ts +27 -0
  113. package/tokens/app/arcodesign/default/index.js +28 -1
  114. package/tokens/app/arcodesign/default/index.json +292 -0
  115. package/tokens/app/arcodesign/default/index.less +27 -0
  116. package/umd/carousel/index.js +3 -0
  117. package/umd/form/form-item.d.ts +3 -0
  118. package/umd/form/form-item.js +38 -10
  119. package/umd/form/style/css/index.css +13 -0
  120. package/umd/form/style/index.less +18 -0
  121. package/umd/icon/IconCheck/index.js +1 -2
  122. package/umd/icon/IconDownload/index.d.ts +7 -0
  123. package/umd/icon/IconDownload/index.js +49 -0
  124. package/umd/icon/IconFile/index.d.ts +7 -0
  125. package/umd/icon/IconFile/index.js +49 -0
  126. package/umd/icon/IconKeyboard/index.js +1 -0
  127. package/umd/icon/IconQuestionCircle/index.js +1 -2
  128. package/umd/icon/IconUpload/index.js +6 -4
  129. package/umd/icon/IconUserFill/index.js +1 -2
  130. package/umd/icon/index.d.ts +3 -1
  131. package/umd/icon/index.js +15 -9
  132. package/umd/icon/type.d.ts +3 -1
  133. package/umd/image-picker/index.js +17 -163
  134. package/umd/image-picker/type.d.ts +4 -73
  135. package/umd/index.d.ts +1 -0
  136. package/umd/index.js +7 -5
  137. package/umd/input/hooks.js +2 -2
  138. package/umd/input/props.d.ts +2 -2
  139. package/umd/picker/index.js +60 -19
  140. package/umd/picker/type.d.ts +7 -2
  141. package/umd/picker-view/components/cascader.d.ts +1 -0
  142. package/umd/picker-view/components/cascader.js +8 -1
  143. package/umd/picker-view/components/picker-cell.d.ts +1 -0
  144. package/umd/picker-view/components/picker-cell.js +6 -1
  145. package/umd/picker-view/index.d.ts +6 -1
  146. package/umd/picker-view/index.js +25 -13
  147. package/umd/style.d.ts +1 -0
  148. package/umd/style.js +4 -4
  149. package/umd/tabs/tab-cell.js +54 -29
  150. package/umd/tabs/type.d.ts +5 -0
  151. package/umd/uploader/index.d.ts +16 -0
  152. package/umd/uploader/index.js +178 -0
  153. package/umd/uploader/style/css/index.css +650 -0
  154. package/umd/uploader/style/css/index.d.ts +4 -0
  155. package/umd/uploader/style/css/index.js +15 -0
  156. package/umd/uploader/style/index.d.ts +4 -0
  157. package/umd/uploader/style/index.js +15 -0
  158. package/umd/uploader/style/index.less +161 -0
  159. package/umd/uploader/type.d.ts +108 -0
  160. package/umd/uploader/type.js +17 -0
  161. package/umd/uploader/upload/index.d.ts +2 -0
  162. package/umd/uploader/upload/index.js +27 -0
  163. package/umd/uploader/upload/type.d.ts +107 -0
  164. package/umd/uploader/upload/type.js +17 -0
  165. package/umd/uploader/upload/upload.d.ts +20 -0
  166. package/umd/uploader/upload/upload.js +200 -0
@@ -83,8 +83,8 @@
83
83
  (0, _react.useEffect)(function () {
84
84
  if (autoFocus) {
85
85
  setTimeout(function () {
86
- inputRef.current && inputRef.current.focus();
87
- }, 200);
86
+ inputRef.current && inputRef.current.click();
87
+ }, 100);
88
88
  }
89
89
  }, []);
90
90
  (0, _react.useEffect)(function () {
@@ -57,8 +57,8 @@ export interface BasicInputProps<T = HTMLInputElement> {
57
57
  */
58
58
  readOnly?: boolean;
59
59
  /**
60
- * 是否自动获取焦点
61
- * @en Whether to automatically get the focus
60
+ * 是否自动获取焦点,开启后会触发一次onClick事件
61
+ * @en Whether to automatically get the focus, it will trigger an onClick event once after being enabled
62
62
  */
63
63
  autoFocus?: boolean;
64
64
  /**
@@ -36,7 +36,7 @@
36
36
  if (key in _exports && _exports[key] === _type[key]) return;
37
37
  _exports[key] = _type[key];
38
38
  });
39
- 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"];
39
+ 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", "renderLinkedContainer"];
40
40
 
41
41
  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); }
42
42
 
@@ -62,8 +62,7 @@
62
62
  hideEmptyCols = _props$hideEmptyCols === void 0 ? false : _props$hideEmptyCols,
63
63
  _props$title = props.title,
64
64
  title = _props$title === void 0 ? '' : _props$title,
65
- _props$visible = props.visible,
66
- visible = _props$visible === void 0 ? false : _props$visible,
65
+ userSetVisible = props.visible,
67
66
  value = props.value,
68
67
  _props$needBottomOffs = props.needBottomOffset,
69
68
  needBottomOffset = _props$needBottomOffs === void 0 ? false : _props$needBottomOffs,
@@ -77,10 +76,25 @@
77
76
  touchToStop = props.touchToStop,
78
77
  _props$gestureOutOfCo = props.gestureOutOfControl,
79
78
  gestureOutOfControl = _props$gestureOutOfCo === void 0 ? true : _props$gestureOutOfCo,
79
+ renderLinkedContainer = props.renderLinkedContainer,
80
80
  otherProps = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
81
81
  var scrollValueRef = (0, _helpers.useLatestRef)(value);
82
82
  var domRef = (0, _react.useRef)(null);
83
83
  var pickerViewRef = (0, _react.useRef)(null);
84
+
85
+ var _useState = (0, _react.useState)(false),
86
+ linkVisible = _useState[0],
87
+ setLinkVisible = _useState[1];
88
+
89
+ var _useState2 = (0, _react.useState)(function () {
90
+ return getCurrentValueData();
91
+ }),
92
+ linkArgs = _useState2[0],
93
+ setLinkArgs = _useState2[1]; // 来自linkedContainer的visible变化,优先级高于受控值
94
+ // @en Visible changes from linkedContainer which have priority over controlled values
95
+
96
+
97
+ var visible = linkVisible || userSetVisible || false;
84
98
  (0, _react.useImperativeHandle)(ref, function () {
85
99
  return {
86
100
  dom: domRef.current,
@@ -111,39 +125,61 @@
111
125
  }
112
126
  };
113
127
  });
128
+ (0, _react.useEffect)(function () {
129
+ (0, _mobileUtils.nextTick)(function () {
130
+ setLinkArgs(getCurrentValueData());
131
+ });
132
+ }, []);
133
+
134
+ function hidePicker(scene) {
135
+ setLinkVisible(false);
136
+ onHide == null ? void 0 : onHide(scene);
137
+ }
114
138
 
115
139
  function handleDismiss() {
116
140
  if (onDismiss) {
117
141
  onDismiss();
118
142
  }
119
143
 
120
- if (onHide) {
121
- onHide('dismiss');
122
- }
144
+ hidePicker('dismiss');
123
145
  }
124
146
 
125
- var handleConfirm = function handleConfirm() {
126
- var _pickerViewRef$curren6;
147
+ function getCurrentValueData() {
148
+ var _pickerViewRef$curren6, _pickerViewRef$curren7;
127
149
 
128
- (_pickerViewRef$curren6 = pickerViewRef.current) == null ? void 0 : _pickerViewRef$curren6.scrollToCurrentIndex();
150
+ var val = ((_pickerViewRef$curren6 = pickerViewRef.current) == null ? void 0 : _pickerViewRef$curren6.getAllColumnValues()) || scrollValueRef.current || [];
151
+ var selectedData = ((_pickerViewRef$curren7 = pickerViewRef.current) == null ? void 0 : _pickerViewRef$curren7.getAllColumnData()) || [];
152
+ return {
153
+ value: val,
154
+ data: selectedData
155
+ };
156
+ }
157
+
158
+ function handleConfirm() {
159
+ var _pickerViewRef$curren8;
160
+
161
+ (_pickerViewRef$curren8 = pickerViewRef.current) == null ? void 0 : _pickerViewRef$curren8.scrollToCurrentIndex();
129
162
  (0, _mobileUtils.nextTick)(function () {
130
- var _pickerViewRef$curren7;
163
+ var _getCurrentValueData = getCurrentValueData(),
164
+ val = _getCurrentValueData.value,
165
+ selectedData = _getCurrentValueData.data;
131
166
 
132
- var val = ((_pickerViewRef$curren7 = pickerViewRef.current) == null ? void 0 : _pickerViewRef$curren7.getAllColumnValues()) || scrollValueRef.current || [];
167
+ setLinkArgs({
168
+ value: val,
169
+ data: selectedData
170
+ });
133
171
 
134
172
  if (onOk) {
135
- onOk(val);
173
+ onOk(val, selectedData);
136
174
  }
137
175
 
138
176
  if (onChange) {
139
177
  onChange(val);
140
178
  }
141
179
 
142
- if (onHide) {
143
- onHide('confirm');
144
- }
180
+ hidePicker('confirm');
145
181
  });
146
- };
182
+ }
147
183
 
148
184
  (0, _helpers.useListenResize)(updateLayoutByVisible, [visible]); // 每次visible从false变为true时需要重新设置scrollValue的值为当前value的值(初始值)
149
185
 
@@ -159,11 +195,16 @@
159
195
  return /*#__PURE__*/_react.default.createElement(_contextProvider.ContextLayout, null, function (_ref) {
160
196
  var prefixCls = _ref.prefixCls,
161
197
  locale = _ref.locale;
162
- return /*#__PURE__*/_react.default.createElement(_popup.default, (0, _extends2.default)({
198
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, renderLinkedContainer ? /*#__PURE__*/_react.default.createElement("div", {
199
+ className: prefixCls + "-picker-linked-container",
200
+ onClick: function onClick() {
201
+ return setLinkVisible(true);
202
+ }
203
+ }, renderLinkedContainer(linkArgs.value, linkArgs.data)) : null, /*#__PURE__*/_react.default.createElement(_popup.default, (0, _extends2.default)({
163
204
  visible: visible,
164
205
  className: (0, _mobileUtils.cls)(className, prefixCls + "-picker all-border-box"),
165
206
  close: function close() {
166
- return onHide == null ? void 0 : onHide('mask');
207
+ return hidePicker('mask');
167
208
  },
168
209
  direction: "bottom",
169
210
  maskClosable: maskClosable,
@@ -195,7 +236,7 @@
195
236
  clickable: clickable,
196
237
  hideEmptyCols: hideEmptyCols,
197
238
  touchToStop: touchToStop
198
- })));
239
+ }))));
199
240
  });
200
241
  });
201
242
  /**
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { ReactNode } from 'react';
2
2
  import { PickerData, ValueType } from '../picker-view/type';
3
3
  import { PopupProps } from '../popup';
4
4
  export declare type DataType = PickerData[] | PickerData[][] | ValueType[][];
@@ -81,7 +81,7 @@ export interface PickerProps extends Omit<PopupProps, 'visible' | 'close' | 'chi
81
81
  * 点击选中时执行的回调
82
82
  * @en Callback when clicking on Ok
83
83
  */
84
- onOk?: (value: ValueType[]) => void;
84
+ onOk?: (value: ValueType[], data: PickerData[]) => void;
85
85
  /**
86
86
  * 点击取消时执行的回调
87
87
  * @en Callback when clicking to cancel
@@ -123,4 +123,9 @@ export interface PickerProps extends Omit<PopupProps, 'visible' | 'close' | 'chi
123
123
  * @default true
124
124
  */
125
125
  gestureOutOfControl?: boolean;
126
+ /**
127
+ * 将选择器的展现隐藏状态及选中值的展示与某个容器关联,传入后将同时渲染该容器和选择器组件,此时选择器组件的 visible 和 onHide 属性可不传,点击该容器会唤起选择器
128
+ * @en Associate the hidden state of the picker and the display of the selected value with a container. After passing it in, the container and the picker component will be rendered at the same time. At this time, the visible and onHide attributes of the picker component are optional values. Clicking the container will evoke the picker
129
+ */
130
+ renderLinkedContainer?: (value: ValueType[], data: PickerData[]) => ReactNode;
126
131
  }
@@ -19,6 +19,7 @@ export interface CascaderRef {
19
19
  getCellMovingStatus: () => PickerCellMovingStatus[];
20
20
  scrollToCurrentIndex: () => void;
21
21
  getAllCellsValue: () => ValueType[];
22
+ getAllCellsData: () => PickerData[];
22
23
  }
23
24
  declare const Cascader: React.ForwardRefExoticComponent<CascaderProps & React.RefAttributes<CascaderRef>>;
24
25
  export default Cascader;
@@ -45,7 +45,8 @@
45
45
  return {
46
46
  getCellMovingStatus: getCellMovingStatus,
47
47
  scrollToCurrentIndex: scrollToCurrentIndex,
48
- getAllCellsValue: getAllCellsValue
48
+ getAllCellsValue: getAllCellsValue,
49
+ getAllCellsData: getAllCellsData
49
50
  };
50
51
  });
51
52
 
@@ -67,6 +68,12 @@
67
68
  });
68
69
  }
69
70
 
71
+ function getAllCellsData() {
72
+ return pickerCellsRef.current.map(function (cell) {
73
+ return cell.getCurrentCellData();
74
+ });
75
+ }
76
+
70
77
  function _onValueChange(value, index, newData) {
71
78
  var children = (0, _mobileUtils.arrayTreeFilter)(data, function (item, level) {
72
79
  return level <= index && item.value === value[level];
@@ -22,6 +22,7 @@ export interface PickerCellRef {
22
22
  movingStatus: PickerCellMovingStatus;
23
23
  scrollToCurrentIndex: () => void;
24
24
  getCurrentCellValue: () => ValueType;
25
+ getCurrentCellData: () => PickerData;
25
26
  }
26
27
  declare const PickerCell: React.ForwardRefExoticComponent<PickerCellProps & React.RefAttributes<PickerCellRef>>;
27
28
  export default PickerCell;
@@ -311,6 +311,10 @@
311
311
  return (_data$currentIndex = data[currentIndex]) == null ? void 0 : _data$currentIndex.value;
312
312
  }
313
313
 
314
+ function getCurrentCellData() {
315
+ return data[currentIndex];
316
+ }
317
+
314
318
  function _clearTimer() {
315
319
  timeRef.current && clearTimeout(timeRef.current);
316
320
  timeRef.current = null;
@@ -376,7 +380,8 @@
376
380
  return {
377
381
  movingStatus: movingStatusRef.current,
378
382
  scrollToCurrentIndex: scrollToCurrentIndex,
379
- getCurrentCellValue: getCurrentCellValue
383
+ getCurrentCellValue: getCurrentCellValue,
384
+ getCurrentCellData: getCurrentCellData
380
385
  };
381
386
  });
382
387
  return !hideEmptyCols || data && data.length ? /*#__PURE__*/_react.default.createElement("div", {
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import MultiPicker from '../picker-view/components/multi-picker';
3
3
  import PickerCell from '../picker-view/components/picker-cell';
4
4
  import Cascader from '../picker-view/components/cascader';
5
- import { PickerViewProps, ValueType, PickerCellMovingStatus } from './type';
5
+ import { PickerViewProps, ValueType, PickerData, PickerCellMovingStatus } from './type';
6
6
  export * from './type';
7
7
  export { MultiPicker, PickerCell, Cascader };
8
8
  export interface PickerViewRef {
@@ -41,6 +41,11 @@ export interface PickerViewRef {
41
41
  * @en Jump directly to the current most recent line (will break scrolling when called)
42
42
  */
43
43
  scrollToCurrentIndex: () => void;
44
+ /**
45
+ * 获取所有列的 data
46
+ * @en Get all column data
47
+ */
48
+ getAllColumnData: () => PickerData[];
44
49
  }
45
50
  declare const _default: React.ForwardRefExoticComponent<PickerViewProps & React.RefAttributes<PickerViewRef>> & {
46
51
  displayName?: string | undefined;
@@ -41,6 +41,14 @@
41
41
 
42
42
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
43
43
 
44
+ var isArray = function isArray(dt) {
45
+ return dt ? Array.isArray(dt[0]) : false;
46
+ };
47
+
48
+ var isStrOrNum = function isStrOrNum(dt) {
49
+ return typeof dt[0][0] === 'string' || typeof dt[0][0] === 'number';
50
+ };
51
+
44
52
  var PickerView = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
45
53
  var _props$className = props.className,
46
54
  className = _props$className === void 0 ? '' : _props$className,
@@ -90,14 +98,6 @@
90
98
  var innerData = (0, _react.useMemo)(function () {
91
99
  var newData;
92
100
 
93
- var isArray = function isArray(dt) {
94
- return dt ? Array.isArray(dt[0]) : false;
95
- };
96
-
97
- var isStrOrNum = function isStrOrNum(dt) {
98
- return typeof dt[0][0] === 'string' || typeof dt[0][0] === 'number';
99
- };
100
-
101
101
  if (isArray(data)) {
102
102
  if (isStrOrNum(data)) {
103
103
  newData = data.map(function (item) {
@@ -131,6 +131,17 @@
131
131
  });
132
132
  };
133
133
 
134
+ var getAllColumnData = function getAllColumnData() {
135
+ var _cascaderRef$current2;
136
+
137
+ var curValues = cascade ? ((_cascaderRef$current2 = cascaderRef.current) == null ? void 0 : _cascaderRef$current2.getAllCellsData()) || [] : pickerCellsRef.current.map(function (cell) {
138
+ return cell.getCurrentCellData();
139
+ });
140
+ return curValues.filter(function (v) {
141
+ return v !== undefined;
142
+ });
143
+ };
144
+
134
145
  function getColumnValue(index) {
135
146
  if (index === void 0) {
136
147
  index = 0;
@@ -140,18 +151,18 @@
140
151
  }
141
152
 
142
153
  function getCellMovingStatus() {
143
- var _cascaderRef$current2;
154
+ var _cascaderRef$current3;
144
155
 
145
- return cascade ? ((_cascaderRef$current2 = cascaderRef.current) == null ? void 0 : _cascaderRef$current2.getCellMovingStatus()) || [] : pickerCellsRef.current.map(function (cell) {
156
+ return cascade ? ((_cascaderRef$current3 = cascaderRef.current) == null ? void 0 : _cascaderRef$current3.getCellMovingStatus()) || [] : pickerCellsRef.current.map(function (cell) {
146
157
  return cell.movingStatus;
147
158
  });
148
159
  }
149
160
 
150
161
  function scrollToCurrentIndex() {
151
162
  if (cascade) {
152
- var _cascaderRef$current3;
163
+ var _cascaderRef$current4;
153
164
 
154
- (_cascaderRef$current3 = cascaderRef.current) == null ? void 0 : _cascaderRef$current3.scrollToCurrentIndex();
165
+ (_cascaderRef$current4 = cascaderRef.current) == null ? void 0 : _cascaderRef$current4.scrollToCurrentIndex();
155
166
  return;
156
167
  }
157
168
 
@@ -168,7 +179,8 @@
168
179
  getColumnValue: getColumnValue,
169
180
  updateLayout: updateLayout,
170
181
  resetValue: resetValue,
171
- scrollToCurrentIndex: scrollToCurrentIndex
182
+ scrollToCurrentIndex: scrollToCurrentIndex,
183
+ getAllColumnData: getAllColumnData
172
184
  };
173
185
  });
174
186
 
package/umd/style.d.ts CHANGED
@@ -57,3 +57,4 @@ import './tag/style';
57
57
  import './textarea/style';
58
58
  import './toast/style';
59
59
  import './transition/style';
60
+ import './uploader/style';
package/umd/style.js CHANGED
@@ -1,15 +1,15 @@
1
1
  (function (global, factory) {
2
2
  if (typeof define === "function" && define.amd) {
3
- define(["../style/public.less", "./tabs/style", "./sticky/style", "./portal/style", "./steps/style", "./action-sheet/style", "./avatar/style", "./badge/style", "./button/style", "./carousel/style", "./cell/style", "./checkbox/style", "./circle-progress/style", "./collapse/style", "./context-provider/style", "./count-down/style", "./date-picker/style", "./dialog/style", "./divider/style", "./dropdown/style", "./dropdown-menu/style", "./ellipsis/style", "./form/style", "./grid/style", "./image/style", "./image-picker/style", "./image-preview/style", "./index-bar/style", "./input/style", "./keyboard/style", "./load-more/style", "./loading/style", "./masking/style", "./nav-bar/style", "./notice-bar/style", "./notify/style", "./pagination/style", "./picker/style", "./picker-view/style", "./popover/style", "./popup/style", "./popup-swiper/style", "./progress/style", "./pull-refresh/style", "./radio/style", "./rate/style", "./search-bar/style", "./show-monitor/style", "./skeleton/style", "./slider/style", "./stepper/style", "./swipe-action/style", "./swipe-load/style", "./switch/style", "./tab-bar/style", "./tag/style", "./textarea/style", "./toast/style", "./transition/style"], factory);
3
+ define(["../style/public.less", "./tabs/style", "./sticky/style", "./portal/style", "./steps/style", "./action-sheet/style", "./avatar/style", "./badge/style", "./button/style", "./carousel/style", "./cell/style", "./checkbox/style", "./circle-progress/style", "./collapse/style", "./context-provider/style", "./count-down/style", "./date-picker/style", "./dialog/style", "./divider/style", "./dropdown/style", "./dropdown-menu/style", "./ellipsis/style", "./form/style", "./grid/style", "./image/style", "./image-picker/style", "./image-preview/style", "./index-bar/style", "./input/style", "./keyboard/style", "./load-more/style", "./loading/style", "./masking/style", "./nav-bar/style", "./notice-bar/style", "./notify/style", "./pagination/style", "./picker/style", "./picker-view/style", "./popover/style", "./popup/style", "./popup-swiper/style", "./progress/style", "./pull-refresh/style", "./radio/style", "./rate/style", "./search-bar/style", "./show-monitor/style", "./skeleton/style", "./slider/style", "./stepper/style", "./swipe-action/style", "./swipe-load/style", "./switch/style", "./tab-bar/style", "./tag/style", "./textarea/style", "./toast/style", "./transition/style", "./uploader/style"], factory);
4
4
  } else if (typeof exports !== "undefined") {
5
- factory(require("../style/public.less"), require("./tabs/style"), require("./sticky/style"), require("./portal/style"), require("./steps/style"), require("./action-sheet/style"), require("./avatar/style"), require("./badge/style"), require("./button/style"), require("./carousel/style"), require("./cell/style"), require("./checkbox/style"), require("./circle-progress/style"), require("./collapse/style"), require("./context-provider/style"), require("./count-down/style"), require("./date-picker/style"), require("./dialog/style"), require("./divider/style"), require("./dropdown/style"), require("./dropdown-menu/style"), require("./ellipsis/style"), require("./form/style"), require("./grid/style"), require("./image/style"), require("./image-picker/style"), require("./image-preview/style"), require("./index-bar/style"), require("./input/style"), require("./keyboard/style"), require("./load-more/style"), require("./loading/style"), require("./masking/style"), require("./nav-bar/style"), require("./notice-bar/style"), require("./notify/style"), require("./pagination/style"), require("./picker/style"), require("./picker-view/style"), require("./popover/style"), require("./popup/style"), require("./popup-swiper/style"), require("./progress/style"), require("./pull-refresh/style"), require("./radio/style"), require("./rate/style"), require("./search-bar/style"), require("./show-monitor/style"), require("./skeleton/style"), require("./slider/style"), require("./stepper/style"), require("./swipe-action/style"), require("./swipe-load/style"), require("./switch/style"), require("./tab-bar/style"), require("./tag/style"), require("./textarea/style"), require("./toast/style"), require("./transition/style"));
5
+ factory(require("../style/public.less"), require("./tabs/style"), require("./sticky/style"), require("./portal/style"), require("./steps/style"), require("./action-sheet/style"), require("./avatar/style"), require("./badge/style"), require("./button/style"), require("./carousel/style"), require("./cell/style"), require("./checkbox/style"), require("./circle-progress/style"), require("./collapse/style"), require("./context-provider/style"), require("./count-down/style"), require("./date-picker/style"), require("./dialog/style"), require("./divider/style"), require("./dropdown/style"), require("./dropdown-menu/style"), require("./ellipsis/style"), require("./form/style"), require("./grid/style"), require("./image/style"), require("./image-picker/style"), require("./image-preview/style"), require("./index-bar/style"), require("./input/style"), require("./keyboard/style"), require("./load-more/style"), require("./loading/style"), require("./masking/style"), require("./nav-bar/style"), require("./notice-bar/style"), require("./notify/style"), require("./pagination/style"), require("./picker/style"), require("./picker-view/style"), require("./popover/style"), require("./popup/style"), require("./popup-swiper/style"), require("./progress/style"), require("./pull-refresh/style"), require("./radio/style"), require("./rate/style"), require("./search-bar/style"), require("./show-monitor/style"), require("./skeleton/style"), require("./slider/style"), require("./stepper/style"), require("./swipe-action/style"), require("./swipe-load/style"), require("./switch/style"), require("./tab-bar/style"), require("./tag/style"), require("./textarea/style"), require("./toast/style"), require("./transition/style"), require("./uploader/style"));
6
6
  } else {
7
7
  var mod = {
8
8
  exports: {}
9
9
  };
10
- factory(global._public, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style);
10
+ factory(global._public, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style);
11
11
  global.style = mod.exports;
12
12
  }
13
- })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_public, _style, _style2, _style3, _style4, _style5, _style6, _style7, _style8, _style9, _style10, _style11, _style12, _style13, _style14, _style15, _style16, _style17, _style18, _style19, _style20, _style21, _style22, _style23, _style24, _style25, _style26, _style27, _style28, _style29, _style30, _style31, _style32, _style33, _style34, _style35, _style36, _style37, _style38, _style39, _style40, _style41, _style42, _style43, _style44, _style45, _style46, _style47, _style48, _style49, _style50, _style51, _style52, _style53, _style54, _style55, _style56, _style57, _style58) {
13
+ })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_public, _style, _style2, _style3, _style4, _style5, _style6, _style7, _style8, _style9, _style10, _style11, _style12, _style13, _style14, _style15, _style16, _style17, _style18, _style19, _style20, _style21, _style22, _style23, _style24, _style25, _style26, _style27, _style28, _style29, _style30, _style31, _style32, _style33, _style34, _style35, _style36, _style37, _style38, _style39, _style40, _style41, _style42, _style43, _style44, _style45, _style46, _style47, _style48, _style49, _style50, _style51, _style52, _style53, _style54, _style55, _style56, _style57, _style58, _style59) {
14
14
  "use strict";
15
15
  });
@@ -94,14 +94,18 @@
94
94
  return tabs.length < overflowThreshold ? tabBarArrange : 'start';
95
95
  }),
96
96
  originArrange = _useState3[0],
97
- setOriginArrange = _useState3[1]; // 默认tab小于overflowThreshold个时不开启加载前隐藏,大于overflowThreshold个时开启
97
+ setOriginArrange = _useState3[1];
98
98
 
99
+ var _useState4 = (0, _react.useState)(false),
100
+ forceUpdate = _useState4[0],
101
+ setForceUpdate = _useState4[1]; // 默认tab小于overflowThreshold个时不开启加载前隐藏,大于overflowThreshold个时开启
99
102
 
100
- var _useState4 = (0, _react.useState)(function () {
103
+
104
+ var _useState5 = (0, _react.useState)(function () {
101
105
  return hideTabBarBeforeMounted === void 0 ? tabs.length < overflowThreshold || activeIndex === 0 : !hideTabBarBeforeMounted;
102
106
  }),
103
- showTab = _useState4[0],
104
- setShowTab = _useState4[1];
107
+ showTab = _useState5[0],
108
+ setShowTab = _useState5[1];
105
109
 
106
110
  var isVertical = tabDirection === 'vertical';
107
111
  var isLine = (type || '').indexOf('line') !== -1;
@@ -116,6 +120,15 @@
116
120
  var hasDivider = tabBarHasDivider === void 0 ? isLine : tabBarHasDivider;
117
121
  var wrapSize = isVertical ? wrapWidth : wrapHeight;
118
122
  var system = (0, _helpers.useSystem)();
123
+
124
+ var updateScrollPosition = function updateScrollPosition() {
125
+ if (wrapSize && tabBarScrollChance !== 'none') {
126
+ setTimeout(function () {
127
+ scrollToCenter();
128
+ }, tabBarScrollChance === 'after-jump' ? Math.max(transitionDuration || 0, duration || 0) : 0);
129
+ }
130
+ };
131
+
119
132
  (0, _react.useEffect)(function () {
120
133
  (0, _mobileUtils.nextTick)(function () {
121
134
  setCellOverflow(); // dom出来之后originArrange置空,交由tabBarArrange控制
@@ -135,31 +148,16 @@
135
148
  (_underlineRef$current = underlineRef.current) == null ? void 0 : _underlineRef$current.resetUnderlineStyle();
136
149
  });
137
150
  }, [activeIndex, tabs, getCellPadding('left'), getCellPadding('right'), tabBarGutter, tabDirection]);
138
- (0, _react.useImperativeHandle)(ref, function () {
139
- return {
140
- dom: domRef.current,
141
- scrollTo: scrollTo,
142
- scrollToCenter: scrollToCenter,
143
- hasOverflow: hasOverflow,
144
- setCaterpillarAnimate: function setCaterpillarAnimate(ratio) {
145
- var _underlineRef$current2;
146
-
147
- return (_underlineRef$current2 = underlineRef.current) == null ? void 0 : _underlineRef$current2.setCaterpillarAnimate(ratio);
148
- },
149
- resetUnderlineStyle: function resetUnderlineStyle() {
150
- var _underlineRef$current3;
151
-
152
- return (_underlineRef$current3 = underlineRef.current) == null ? void 0 : _underlineRef$current3.resetUnderlineStyle();
153
- }
154
- };
155
- }, [scrollToCenter, scrollTo, hasOverflow]);
156
151
  (0, _react.useEffect)(function () {
157
- if (wrapSize && tabBarScrollChance !== 'none') {
158
- setTimeout(function () {
159
- scrollToCenter();
160
- }, tabBarScrollChance === 'after-jump' ? Math.max(transitionDuration || 0, duration || 0) : 0);
161
- }
152
+ updateScrollPosition();
162
153
  }, [activeIndex, wrapSize]);
154
+ (0, _helpers.useUpdateEffect)(function () {
155
+ var _underlineRef$current2;
156
+
157
+ setCellOverflow();
158
+ (_underlineRef$current2 = underlineRef.current) == null ? void 0 : _underlineRef$current2.resetUnderlineStyle();
159
+ updateScrollPosition();
160
+ }, [forceUpdate]);
163
161
  (0, _react.useEffect)(function () {
164
162
  tabBarScrollChance !== 'none' && scrollToCenter(true); // TabCell左右可滚动时,防止触发父级touchmove事件导致滚不动
165
163
  // @en When the TabCell can be scrolled left and right, prevent the parent touchmove event from being triggered which result in inability to scroll
@@ -300,7 +298,7 @@
300
298
  return typeof tab === 'string' ? tab : tab.title;
301
299
  }
302
300
 
303
- function renderTabUnderline() {
301
+ var renderTabUnderline = function renderTabUnderline() {
304
302
  if (!showUnderline || !isLine) {
305
303
  return null;
306
304
  }
@@ -331,7 +329,7 @@
331
329
  getTabCenterLeft: getTabCenterLeft,
332
330
  getTabRect: getTabRect
333
331
  }, lineProps));
334
- }
332
+ };
335
333
 
336
334
  var cellInner = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, tabs.map(function (tab, index) {
337
335
  return /*#__PURE__*/_react.default.createElement("div", {
@@ -374,6 +372,33 @@
374
372
  }
375
373
  }) : null);
376
374
 
375
+ var _updateLayout = function updateLayout() {
376
+ setForceUpdate(function (val) {
377
+ return !val;
378
+ });
379
+ };
380
+
381
+ (0, _react.useImperativeHandle)(ref, function () {
382
+ return {
383
+ dom: domRef.current,
384
+ scrollTo: scrollTo,
385
+ scrollToCenter: scrollToCenter,
386
+ hasOverflow: hasOverflow,
387
+ setCaterpillarAnimate: function setCaterpillarAnimate(ratio) {
388
+ var _underlineRef$current3;
389
+
390
+ return (_underlineRef$current3 = underlineRef.current) == null ? void 0 : _underlineRef$current3.setCaterpillarAnimate(ratio);
391
+ },
392
+ resetUnderlineStyle: function resetUnderlineStyle() {
393
+ var _underlineRef$current4;
394
+
395
+ return (_underlineRef$current4 = underlineRef.current) == null ? void 0 : _underlineRef$current4.resetUnderlineStyle();
396
+ },
397
+ updateLayout: function updateLayout() {
398
+ return _updateLayout();
399
+ }
400
+ };
401
+ }, [scrollToCenter, scrollTo, hasOverflow]);
377
402
  return /*#__PURE__*/_react.default.createElement("div", {
378
403
  className: (0, _mobileUtils.cls)(prefix + "-container-wrap", tabDirection, "type-" + type, tabBarClass, system),
379
404
  style: tabBarStyle
@@ -565,6 +565,11 @@ export interface TabCellRef {
565
565
  * @en Recalculate underline style
566
566
  */
567
567
  resetUnderlineStyle: () => void;
568
+ /**
569
+ * 强制更新 tab-cell
570
+ * @en Force update tab-cell
571
+ */
572
+ updateLayout: () => void;
568
573
  }
569
574
  export interface TabPaneProps extends Pick<TabsProps, 'duration' | 'transitionDuration' | 'lazyloadCount' | 'hideContentStyle' | 'renderHideContent' | 'mode' | 'tabPaneClass' | 'tabPaneStyle' | 'tabPaneExtra' | 'getScrollContainer' | 'scrollThrottle' | 'scrollOffset' | 'goLastWhenScrollBottom' | 'scrollVertical' | 'translateZ' | 'fullScreen' | 'autoHeight' | 'onScroll' | 'swipeEnergySaving'> {
570
575
  prefixCls?: string;
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import { UploaderRef, UploaderProps } from './type';
3
+ export * from './type';
4
+ declare const _default: React.ForwardRefExoticComponent<UploaderProps & React.RefAttributes<UploaderRef>> & {
5
+ displayName?: string | undefined;
6
+ };
7
+ /**
8
+ * 文件上传组件
9
+ * @en Uploader Component
10
+ * @type 数据录入
11
+ * @type_en Data Entry
12
+ * @name 文件上传
13
+ * @name_en Uploader
14
+ * @displayName Uploader
15
+ */
16
+ export default _default;