@arco-design/mobile-react 2.30.10 → 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 (142) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.en-US.md +2 -2
  3. package/README.md +2 -2
  4. package/cjs/form/form-item.d.ts +3 -0
  5. package/cjs/form/form-item.js +38 -10
  6. package/cjs/form/style/css/index.css +13 -0
  7. package/cjs/form/style/index.less +18 -0
  8. package/cjs/icon/IconCheck/index.js +1 -2
  9. package/cjs/icon/IconDownload/index.d.ts +7 -0
  10. package/cjs/icon/IconDownload/index.js +41 -0
  11. package/cjs/icon/IconFile/index.d.ts +7 -0
  12. package/cjs/icon/IconFile/index.js +41 -0
  13. package/cjs/icon/IconKeyboard/index.js +1 -0
  14. package/cjs/icon/IconQuestionCircle/index.js +1 -2
  15. package/cjs/icon/IconUpload/index.js +6 -4
  16. package/cjs/icon/IconUserFill/index.js +1 -2
  17. package/cjs/icon/index.d.ts +3 -1
  18. package/cjs/icon/index.js +17 -7
  19. package/cjs/icon/type.d.ts +3 -1
  20. package/cjs/image-picker/index.js +15 -161
  21. package/cjs/image-picker/type.d.ts +4 -73
  22. package/cjs/index.d.ts +1 -0
  23. package/cjs/index.js +6 -2
  24. package/cjs/input/hooks.js +2 -2
  25. package/cjs/input/props.d.ts +2 -2
  26. package/cjs/picker/index.js +59 -19
  27. package/cjs/picker/type.d.ts +6 -1
  28. package/cjs/style.d.ts +1 -0
  29. package/cjs/style.js +3 -1
  30. package/cjs/tabs/tab-cell.js +1 -1
  31. package/cjs/uploader/index.d.ts +16 -0
  32. package/cjs/uploader/index.js +180 -0
  33. package/cjs/uploader/style/css/index.css +650 -0
  34. package/cjs/uploader/style/css/index.d.ts +4 -0
  35. package/cjs/uploader/style/css/index.js +9 -0
  36. package/cjs/uploader/style/index.d.ts +4 -0
  37. package/cjs/uploader/style/index.js +9 -0
  38. package/cjs/uploader/style/index.less +161 -0
  39. package/cjs/uploader/type.d.ts +108 -0
  40. package/cjs/uploader/type.js +3 -0
  41. package/cjs/uploader/upload/index.d.ts +2 -0
  42. package/cjs/uploader/upload/index.js +19 -0
  43. package/cjs/uploader/upload/type.d.ts +107 -0
  44. package/cjs/uploader/upload/type.js +3 -0
  45. package/cjs/uploader/upload/upload.d.ts +20 -0
  46. package/cjs/uploader/upload/upload.js +189 -0
  47. package/dist/index.js +580 -265
  48. package/dist/index.min.js +4 -4
  49. package/dist/style.css +593 -0
  50. package/dist/style.min.css +1 -1
  51. package/esm/form/form-item.d.ts +3 -0
  52. package/esm/form/form-item.js +36 -10
  53. package/esm/form/style/css/index.css +13 -0
  54. package/esm/form/style/index.less +18 -0
  55. package/esm/icon/IconCheck/index.js +1 -2
  56. package/esm/icon/IconDownload/index.d.ts +7 -0
  57. package/esm/icon/IconDownload/index.js +30 -0
  58. package/esm/icon/IconFile/index.d.ts +7 -0
  59. package/esm/icon/IconFile/index.js +30 -0
  60. package/esm/icon/IconKeyboard/index.js +1 -0
  61. package/esm/icon/IconQuestionCircle/index.js +1 -2
  62. package/esm/icon/IconUpload/index.js +6 -4
  63. package/esm/icon/IconUserFill/index.js +1 -2
  64. package/esm/icon/index.d.ts +3 -1
  65. package/esm/icon/index.js +3 -1
  66. package/esm/icon/type.d.ts +3 -1
  67. package/esm/image-picker/index.js +14 -160
  68. package/esm/image-picker/type.d.ts +4 -73
  69. package/esm/index.d.ts +1 -0
  70. package/esm/index.js +2 -1
  71. package/esm/input/hooks.js +2 -2
  72. package/esm/input/props.d.ts +2 -2
  73. package/esm/picker/index.js +60 -20
  74. package/esm/picker/type.d.ts +6 -1
  75. package/esm/style.d.ts +1 -0
  76. package/esm/style.js +2 -1
  77. package/esm/tabs/tab-cell.js +2 -2
  78. package/esm/uploader/index.d.ts +16 -0
  79. package/esm/uploader/index.js +150 -0
  80. package/esm/uploader/style/css/index.css +650 -0
  81. package/esm/uploader/style/css/index.d.ts +4 -0
  82. package/esm/uploader/style/css/index.js +4 -0
  83. package/esm/uploader/style/index.d.ts +4 -0
  84. package/esm/uploader/style/index.js +4 -0
  85. package/esm/uploader/style/index.less +161 -0
  86. package/esm/uploader/type.d.ts +108 -0
  87. package/esm/uploader/type.js +1 -0
  88. package/esm/uploader/upload/index.d.ts +2 -0
  89. package/esm/uploader/upload/index.js +2 -0
  90. package/esm/uploader/upload/type.d.ts +107 -0
  91. package/esm/uploader/upload/type.js +1 -0
  92. package/esm/uploader/upload/upload.d.ts +20 -0
  93. package/esm/uploader/upload/upload.js +175 -0
  94. package/package.json +3 -3
  95. package/tokens/app/arcodesign/default/css-variables.less +27 -0
  96. package/tokens/app/arcodesign/default/index.d.ts +27 -0
  97. package/tokens/app/arcodesign/default/index.js +28 -1
  98. package/tokens/app/arcodesign/default/index.json +292 -0
  99. package/tokens/app/arcodesign/default/index.less +27 -0
  100. package/umd/form/form-item.d.ts +3 -0
  101. package/umd/form/form-item.js +38 -10
  102. package/umd/form/style/css/index.css +13 -0
  103. package/umd/form/style/index.less +18 -0
  104. package/umd/icon/IconCheck/index.js +1 -2
  105. package/umd/icon/IconDownload/index.d.ts +7 -0
  106. package/umd/icon/IconDownload/index.js +49 -0
  107. package/umd/icon/IconFile/index.d.ts +7 -0
  108. package/umd/icon/IconFile/index.js +49 -0
  109. package/umd/icon/IconKeyboard/index.js +1 -0
  110. package/umd/icon/IconQuestionCircle/index.js +1 -2
  111. package/umd/icon/IconUpload/index.js +6 -4
  112. package/umd/icon/IconUserFill/index.js +1 -2
  113. package/umd/icon/index.d.ts +3 -1
  114. package/umd/icon/index.js +15 -9
  115. package/umd/icon/type.d.ts +3 -1
  116. package/umd/image-picker/index.js +17 -163
  117. package/umd/image-picker/type.d.ts +4 -73
  118. package/umd/index.d.ts +1 -0
  119. package/umd/index.js +7 -5
  120. package/umd/input/hooks.js +2 -2
  121. package/umd/input/props.d.ts +2 -2
  122. package/umd/picker/index.js +59 -19
  123. package/umd/picker/type.d.ts +6 -1
  124. package/umd/style.d.ts +1 -0
  125. package/umd/style.js +4 -4
  126. package/umd/tabs/tab-cell.js +1 -1
  127. package/umd/uploader/index.d.ts +16 -0
  128. package/umd/uploader/index.js +178 -0
  129. package/umd/uploader/style/css/index.css +650 -0
  130. package/umd/uploader/style/css/index.d.ts +4 -0
  131. package/umd/uploader/style/css/index.js +15 -0
  132. package/umd/uploader/style/index.d.ts +4 -0
  133. package/umd/uploader/style/index.js +15 -0
  134. package/umd/uploader/style/index.less +161 -0
  135. package/umd/uploader/type.d.ts +108 -0
  136. package/umd/uploader/type.js +17 -0
  137. package/umd/uploader/upload/index.d.ts +2 -0
  138. package/umd/uploader/upload/index.js +27 -0
  139. package/umd/uploader/upload/type.d.ts +107 -0
  140. package/umd/uploader/upload/type.js +17 -0
  141. package/umd/uploader/upload/upload.d.ts +20 -0
  142. package/umd/uploader/upload/upload.js +200 -0
@@ -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,26 +125,49 @@
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, _pickerViewRef$curren8;
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 || [];
133
- var selectedData = ((_pickerViewRef$curren8 = pickerViewRef.current) == null ? void 0 : _pickerViewRef$curren8.getAllColumnData()) || [];
167
+ setLinkArgs({
168
+ value: val,
169
+ data: selectedData
170
+ });
134
171
 
135
172
  if (onOk) {
136
173
  onOk(val, selectedData);
@@ -140,11 +177,9 @@
140
177
  onChange(val);
141
178
  }
142
179
 
143
- if (onHide) {
144
- onHide('confirm');
145
- }
180
+ hidePicker('confirm');
146
181
  });
147
- };
182
+ }
148
183
 
149
184
  (0, _helpers.useListenResize)(updateLayoutByVisible, [visible]); // 每次visible从false变为true时需要重新设置scrollValue的值为当前value的值(初始值)
150
185
 
@@ -160,11 +195,16 @@
160
195
  return /*#__PURE__*/_react.default.createElement(_contextProvider.ContextLayout, null, function (_ref) {
161
196
  var prefixCls = _ref.prefixCls,
162
197
  locale = _ref.locale;
163
- 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)({
164
204
  visible: visible,
165
205
  className: (0, _mobileUtils.cls)(className, prefixCls + "-picker all-border-box"),
166
206
  close: function close() {
167
- return onHide == null ? void 0 : onHide('mask');
207
+ return hidePicker('mask');
168
208
  },
169
209
  direction: "bottom",
170
210
  maskClosable: maskClosable,
@@ -196,7 +236,7 @@
196
236
  clickable: clickable,
197
237
  hideEmptyCols: hideEmptyCols,
198
238
  touchToStop: touchToStop
199
- })));
239
+ }))));
200
240
  });
201
241
  });
202
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[][];
@@ -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
  }
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
  });
@@ -151,7 +151,7 @@
151
151
  (0, _react.useEffect)(function () {
152
152
  updateScrollPosition();
153
153
  }, [activeIndex, wrapSize]);
154
- (0, _react.useEffect)(function () {
154
+ (0, _helpers.useUpdateEffect)(function () {
155
155
  var _underlineRef$current2;
156
156
 
157
157
  setCellOverflow();
@@ -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;
@@ -0,0 +1,178 @@
1
+ (function (global, factory) {
2
+ if (typeof define === "function" && define.amd) {
3
+ define(["exports", "react", "@arco-design/mobile-utils", "../context-provider", "../button", "../_helpers", "../icon", "../loading", "./upload", "./type"], factory);
4
+ } else if (typeof exports !== "undefined") {
5
+ factory(exports, require("react"), require("@arco-design/mobile-utils"), require("../context-provider"), require("../button"), require("../_helpers"), require("../icon"), require("../loading"), require("./upload"), require("./type"));
6
+ } else {
7
+ var mod = {
8
+ exports: {}
9
+ };
10
+ factory(mod.exports, global.react, global.mobileUtils, global.contextProvider, global.button, global._helpers, global.icon, global.loading, global.upload, global.type);
11
+ global.index = mod.exports;
12
+ }
13
+ })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _react, _mobileUtils, _contextProvider, _button, _helpers, _icon, _loading, _upload, _type) {
14
+ "use strict";
15
+
16
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
17
+
18
+ _exports.__esModule = true;
19
+ var _exportNames = {};
20
+ _exports.default = void 0;
21
+ _react = _interopRequireWildcard(_react);
22
+ _button = _interopRequireDefault(_button);
23
+ _loading = _interopRequireDefault(_loading);
24
+ Object.keys(_type).forEach(function (key) {
25
+ if (key === "default" || key === "__esModule") return;
26
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
27
+ if (key in _exports && _exports[key] === _type[key]) return;
28
+ _exports[key] = _type[key];
29
+ });
30
+
31
+ 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); }
32
+
33
+ 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; }
34
+
35
+ var Uploader = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
36
+ var _props$className = props.className,
37
+ className = _props$className === void 0 ? '' : _props$className,
38
+ style = props.style,
39
+ _props$files = props.files,
40
+ files = _props$files === void 0 ? [] : _props$files,
41
+ _props$accept = props.accept,
42
+ accept = _props$accept === void 0 ? undefined : _props$accept,
43
+ _props$multiple = props.multiple,
44
+ multiple = _props$multiple === void 0 ? false : _props$multiple,
45
+ capture = props.capture,
46
+ _props$limit = props.limit,
47
+ limit = _props$limit === void 0 ? 0 : _props$limit,
48
+ _props$hideStatus = props.hideStatus,
49
+ hideStatus = _props$hideStatus === void 0 ? false : _props$hideStatus,
50
+ _props$alwaysShowSele = props.alwaysShowSelect,
51
+ alwaysShowSelect = _props$alwaysShowSele === void 0 ? false : _props$alwaysShowSele,
52
+ disabled = props.disabled,
53
+ renderDeleteArea = props.renderDeleteArea,
54
+ renderLoadedArea = props.renderLoadedArea,
55
+ renderLoadingArea = props.renderLoadingArea,
56
+ renderErrorArea = props.renderErrorArea,
57
+ renderFileIndexArea = props.renderFileIndexArea,
58
+ renderUploadArea = props.renderUploadArea,
59
+ renderFileList = props.renderFileList;
60
+ var domRef = (0, _react.useRef)(null);
61
+ var fileRef = (0, _react.useRef)(null);
62
+ var cacheRef = (0, _helpers.useLatestRef)(files);
63
+ var uploadFunc = new _upload.Upload(props, fileRef, cacheRef);
64
+ (0, _react.useImperativeHandle)(ref, function () {
65
+ return {
66
+ dom: domRef.current
67
+ };
68
+ });
69
+
70
+ var uploaderSelect = function uploaderSelect(prefixCls, locale) {
71
+ var showSelect = files.length < (limit || Infinity);
72
+ return (showSelect || alwaysShowSelect) && /*#__PURE__*/_react.default.createElement("div", {
73
+ className: prefixCls + "-uploader-add",
74
+ onClick: uploadFunc.handleSelect
75
+ }, /*#__PURE__*/_react.default.createElement("input", {
76
+ type: "file",
77
+ accept: accept,
78
+ capture: capture,
79
+ onChange: function onChange(e) {
80
+ return uploadFunc.handleChange(e);
81
+ },
82
+ multiple: multiple,
83
+ ref: fileRef
84
+ }), renderUploadArea && renderUploadArea() || /*#__PURE__*/_react.default.createElement(_button.default, {
85
+ className: prefixCls + "-uploader-add-button",
86
+ size: "medium",
87
+ icon: /*#__PURE__*/_react.default.createElement(_icon.IconUpload, null),
88
+ disabled: disabled
89
+ }, locale.Uploader.uploadBtn));
90
+ };
91
+
92
+ var getUploadList = function getUploadList(prefixCls, locale) {
93
+ var generateItemArea = function generateItemArea(fileItem, index, render, part, defaultArea) {
94
+ if (render) {
95
+ var node = render(fileItem, index);
96
+ return node ? /*#__PURE__*/_react.default.createElement("div", {
97
+ className: prefixCls + "-uploader-list-item-" + part
98
+ }, node) : node;
99
+ }
100
+
101
+ return /*#__PURE__*/_react.default.createElement("div", {
102
+ className: prefixCls + "-uploader-list-item-" + part
103
+ }, defaultArea);
104
+ };
105
+
106
+ return renderFileList && renderFileList({
107
+ retryUpload: uploadFunc.retryUpload,
108
+ deleteFile: uploadFunc.deleteFile
109
+ }) || /*#__PURE__*/_react.default.createElement("div", {
110
+ className: prefixCls + "-uploader-list"
111
+ }, (limit && limit < files.length ? files.slice(0, limit) : files).map(function (fileItem, index) {
112
+ var _cls, _cls2;
113
+
114
+ var file = fileItem.file,
115
+ status = fileItem.status;
116
+ return /*#__PURE__*/_react.default.createElement("div", {
117
+ className: prefixCls + "-uploader-list-item",
118
+ key: index,
119
+ onClick: function onClick(e) {
120
+ return uploadFunc.handleClick(e, fileItem, index);
121
+ }
122
+ }, /*#__PURE__*/_react.default.createElement("div", {
123
+ className: prefixCls + "-uploader-list-item-container"
124
+ }, /*#__PURE__*/_react.default.createElement("div", {
125
+ className: prefixCls + "-uploader-list-item-wrapper"
126
+ }, generateItemArea(fileItem, index, renderFileIndexArea, 'file', /*#__PURE__*/_react.default.createElement(_icon.IconFile, {
127
+ className: prefixCls + "-uploader-list-item-file-icon"
128
+ })), /*#__PURE__*/_react.default.createElement("div", {
129
+ className: (0, _mobileUtils.cls)(prefixCls + "-uploader-list-item-text", (_cls = {}, _cls[prefixCls + "-uploader-list-item-text-error"] = status === 'error', _cls))
130
+ }, file.name)), !hideStatus && /*#__PURE__*/_react.default.createElement("div", {
131
+ className: prefixCls + "-uploader-list-item-status"
132
+ }, status === 'loaded' && generateItemArea(fileItem, index, renderLoadedArea, 'loaded', /*#__PURE__*/_react.default.createElement(_icon.IconCheck, null)), status === 'loading' && generateItemArea(fileItem, index, renderLoadingArea, 'loading', /*#__PURE__*/_react.default.createElement(_loading.default, {
133
+ type: "circle",
134
+ radius: 7
135
+ })), status === 'error' && /*#__PURE__*/_react.default.createElement("div", {
136
+ onClick: function onClick() {
137
+ return uploadFunc.retryUpload(index);
138
+ }
139
+ }, generateItemArea(fileItem, index, renderErrorArea, 'error', /*#__PURE__*/_react.default.createElement("span", null, locale.Uploader.retryUpload))))), /*#__PURE__*/_react.default.createElement("div", {
140
+ className: prefixCls + "-uploader-list-item-delete",
141
+ onClick: function onClick() {
142
+ return uploadFunc.deleteFile(index);
143
+ }
144
+ }, renderDeleteArea && renderDeleteArea(fileItem, index) || /*#__PURE__*/_react.default.createElement(_icon.IconDelete, {
145
+ className: (0, _mobileUtils.cls)(prefixCls + "-uploader-list-item-delete-icon", (_cls2 = {}, _cls2[prefixCls + "-uploader-list-item-delete-icon-disabled"] = disabled, _cls2))
146
+ })));
147
+ }));
148
+ };
149
+
150
+ return /*#__PURE__*/_react.default.createElement(_contextProvider.ContextLayout, null, function (_ref) {
151
+ var _cls3;
152
+
153
+ var prefixCls = _ref.prefixCls,
154
+ _ref$locale = _ref.locale,
155
+ locale = _ref$locale === void 0 ? _mobileUtils.defaultLocale : _ref$locale;
156
+ return /*#__PURE__*/_react.default.createElement("div", {
157
+ className: (0, _mobileUtils.cls)(prefixCls + "-uploader", className, (_cls3 = {}, _cls3[prefixCls + "-uploader-disabled"] = disabled, _cls3)),
158
+ style: style,
159
+ ref: domRef
160
+ }, /*#__PURE__*/_react.default.createElement("div", {
161
+ className: prefixCls + "-uploader-container"
162
+ }, uploaderSelect(prefixCls, locale), getUploadList(prefixCls, locale)));
163
+ });
164
+ });
165
+ /**
166
+ * 文件上传组件
167
+ * @en Uploader Component
168
+ * @type 数据录入
169
+ * @type_en Data Entry
170
+ * @name 文件上传
171
+ * @name_en Uploader
172
+ * @displayName Uploader
173
+ */
174
+
175
+ var _default = (0, _mobileUtils.componentWrapper)(Uploader, 'Uploader');
176
+
177
+ _exports.default = _default;
178
+ });