@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.
- package/CHANGELOG.md +19 -0
- package/README.en-US.md +2 -2
- package/README.md +2 -2
- package/cjs/form/form-item.d.ts +3 -0
- package/cjs/form/form-item.js +38 -10
- package/cjs/form/style/css/index.css +13 -0
- package/cjs/form/style/index.less +18 -0
- package/cjs/icon/IconCheck/index.js +1 -2
- package/cjs/icon/IconDownload/index.d.ts +7 -0
- package/cjs/icon/IconDownload/index.js +41 -0
- package/cjs/icon/IconFile/index.d.ts +7 -0
- package/cjs/icon/IconFile/index.js +41 -0
- package/cjs/icon/IconKeyboard/index.js +1 -0
- package/cjs/icon/IconQuestionCircle/index.js +1 -2
- package/cjs/icon/IconUpload/index.js +6 -4
- package/cjs/icon/IconUserFill/index.js +1 -2
- package/cjs/icon/index.d.ts +3 -1
- package/cjs/icon/index.js +17 -7
- package/cjs/icon/type.d.ts +3 -1
- package/cjs/image-picker/index.js +15 -161
- package/cjs/image-picker/type.d.ts +4 -73
- package/cjs/index.d.ts +1 -0
- package/cjs/index.js +6 -2
- package/cjs/input/hooks.js +2 -2
- package/cjs/input/props.d.ts +2 -2
- package/cjs/picker/index.js +59 -19
- package/cjs/picker/type.d.ts +6 -1
- package/cjs/style.d.ts +1 -0
- package/cjs/style.js +3 -1
- package/cjs/tabs/tab-cell.js +1 -1
- package/cjs/uploader/index.d.ts +16 -0
- package/cjs/uploader/index.js +180 -0
- package/cjs/uploader/style/css/index.css +650 -0
- package/cjs/uploader/style/css/index.d.ts +4 -0
- package/cjs/uploader/style/css/index.js +9 -0
- package/cjs/uploader/style/index.d.ts +4 -0
- package/cjs/uploader/style/index.js +9 -0
- package/cjs/uploader/style/index.less +161 -0
- package/cjs/uploader/type.d.ts +108 -0
- package/cjs/uploader/type.js +3 -0
- package/cjs/uploader/upload/index.d.ts +2 -0
- package/cjs/uploader/upload/index.js +19 -0
- package/cjs/uploader/upload/type.d.ts +107 -0
- package/cjs/uploader/upload/type.js +3 -0
- package/cjs/uploader/upload/upload.d.ts +20 -0
- package/cjs/uploader/upload/upload.js +189 -0
- package/dist/index.js +580 -265
- package/dist/index.min.js +4 -4
- package/dist/style.css +593 -0
- package/dist/style.min.css +1 -1
- package/esm/form/form-item.d.ts +3 -0
- package/esm/form/form-item.js +36 -10
- package/esm/form/style/css/index.css +13 -0
- package/esm/form/style/index.less +18 -0
- package/esm/icon/IconCheck/index.js +1 -2
- package/esm/icon/IconDownload/index.d.ts +7 -0
- package/esm/icon/IconDownload/index.js +30 -0
- package/esm/icon/IconFile/index.d.ts +7 -0
- package/esm/icon/IconFile/index.js +30 -0
- package/esm/icon/IconKeyboard/index.js +1 -0
- package/esm/icon/IconQuestionCircle/index.js +1 -2
- package/esm/icon/IconUpload/index.js +6 -4
- package/esm/icon/IconUserFill/index.js +1 -2
- package/esm/icon/index.d.ts +3 -1
- package/esm/icon/index.js +3 -1
- package/esm/icon/type.d.ts +3 -1
- package/esm/image-picker/index.js +14 -160
- package/esm/image-picker/type.d.ts +4 -73
- package/esm/index.d.ts +1 -0
- package/esm/index.js +2 -1
- package/esm/input/hooks.js +2 -2
- package/esm/input/props.d.ts +2 -2
- package/esm/picker/index.js +60 -20
- package/esm/picker/type.d.ts +6 -1
- package/esm/style.d.ts +1 -0
- package/esm/style.js +2 -1
- package/esm/tabs/tab-cell.js +2 -2
- package/esm/uploader/index.d.ts +16 -0
- package/esm/uploader/index.js +150 -0
- package/esm/uploader/style/css/index.css +650 -0
- package/esm/uploader/style/css/index.d.ts +4 -0
- package/esm/uploader/style/css/index.js +4 -0
- package/esm/uploader/style/index.d.ts +4 -0
- package/esm/uploader/style/index.js +4 -0
- package/esm/uploader/style/index.less +161 -0
- package/esm/uploader/type.d.ts +108 -0
- package/esm/uploader/type.js +1 -0
- package/esm/uploader/upload/index.d.ts +2 -0
- package/esm/uploader/upload/index.js +2 -0
- package/esm/uploader/upload/type.d.ts +107 -0
- package/esm/uploader/upload/type.js +1 -0
- package/esm/uploader/upload/upload.d.ts +20 -0
- package/esm/uploader/upload/upload.js +175 -0
- package/package.json +3 -3
- package/tokens/app/arcodesign/default/css-variables.less +27 -0
- package/tokens/app/arcodesign/default/index.d.ts +27 -0
- package/tokens/app/arcodesign/default/index.js +28 -1
- package/tokens/app/arcodesign/default/index.json +292 -0
- package/tokens/app/arcodesign/default/index.less +27 -0
- package/umd/form/form-item.d.ts +3 -0
- package/umd/form/form-item.js +38 -10
- package/umd/form/style/css/index.css +13 -0
- package/umd/form/style/index.less +18 -0
- package/umd/icon/IconCheck/index.js +1 -2
- package/umd/icon/IconDownload/index.d.ts +7 -0
- package/umd/icon/IconDownload/index.js +49 -0
- package/umd/icon/IconFile/index.d.ts +7 -0
- package/umd/icon/IconFile/index.js +49 -0
- package/umd/icon/IconKeyboard/index.js +1 -0
- package/umd/icon/IconQuestionCircle/index.js +1 -2
- package/umd/icon/IconUpload/index.js +6 -4
- package/umd/icon/IconUserFill/index.js +1 -2
- package/umd/icon/index.d.ts +3 -1
- package/umd/icon/index.js +15 -9
- package/umd/icon/type.d.ts +3 -1
- package/umd/image-picker/index.js +17 -163
- package/umd/image-picker/type.d.ts +4 -73
- package/umd/index.d.ts +1 -0
- package/umd/index.js +7 -5
- package/umd/input/hooks.js +2 -2
- package/umd/input/props.d.ts +2 -2
- package/umd/picker/index.js +59 -19
- package/umd/picker/type.d.ts +6 -1
- package/umd/style.d.ts +1 -0
- package/umd/style.js +4 -4
- package/umd/tabs/tab-cell.js +1 -1
- package/umd/uploader/index.d.ts +16 -0
- package/umd/uploader/index.js +178 -0
- package/umd/uploader/style/css/index.css +650 -0
- package/umd/uploader/style/css/index.d.ts +4 -0
- package/umd/uploader/style/css/index.js +15 -0
- package/umd/uploader/style/index.d.ts +4 -0
- package/umd/uploader/style/index.js +15 -0
- package/umd/uploader/style/index.less +161 -0
- package/umd/uploader/type.d.ts +108 -0
- package/umd/uploader/type.js +17 -0
- package/umd/uploader/upload/index.d.ts +2 -0
- package/umd/uploader/upload/index.js +27 -0
- package/umd/uploader/upload/type.d.ts +107 -0
- package/umd/uploader/upload/type.js +17 -0
- package/umd/uploader/upload/upload.d.ts +20 -0
- package/umd/uploader/upload/upload.js +200 -0
package/esm/form/form-item.js
CHANGED
@@ -10,6 +10,20 @@ import { FormItemContext } from './form-item-context';
|
|
10
10
|
import { GlobalContext } from '../context-provider';
|
11
11
|
import { FormInternalComponentType } from './type';
|
12
12
|
import { getErrorAndWarnings, isFieldRequired } from './utils';
|
13
|
+
export function DefaultPickerLinkedContainer(_ref) {
|
14
|
+
var value = _ref.value;
|
15
|
+
|
16
|
+
var _useContext = useContext(GlobalContext),
|
17
|
+
prefixCls = _useContext.prefixCls,
|
18
|
+
locale = _useContext.locale;
|
19
|
+
|
20
|
+
var className = prefixCls + "-form-picker-link-container";
|
21
|
+
return /*#__PURE__*/React.createElement("div", {
|
22
|
+
className: className
|
23
|
+
}, value && value.length ? value.join('-') : /*#__PURE__*/React.createElement("span", {
|
24
|
+
className: className + "-placeholder"
|
25
|
+
}, locale == null ? void 0 : locale.Form.pickerDefaultHint));
|
26
|
+
}
|
13
27
|
|
14
28
|
var FormItemInner = /*#__PURE__*/function (_PureComponent) {
|
15
29
|
_inheritsLoose(FormItemInner, _PureComponent);
|
@@ -197,6 +211,8 @@ var FormItemInner = /*#__PURE__*/function (_PureComponent) {
|
|
197
211
|
_proto.renderChildren = function renderChildren() {
|
198
212
|
var _props,
|
199
213
|
_children$type,
|
214
|
+
_children$props7,
|
215
|
+
_children$props8,
|
200
216
|
_this2 = this;
|
201
217
|
|
202
218
|
var _this$props4 = this.props,
|
@@ -237,16 +253,26 @@ var FormItemInner = /*#__PURE__*/function (_PureComponent) {
|
|
237
253
|
case FormInternalComponentType.DatePicker:
|
238
254
|
props = {
|
239
255
|
currentTs: getFieldValue(field),
|
240
|
-
onChange: this.
|
241
|
-
disabled: this.props.disabled
|
256
|
+
onChange: this.innerTriggerFunctionWithValueFirst,
|
257
|
+
disabled: this.props.disabled,
|
258
|
+
renderLinkedContainer: ((_children$props7 = children.props) == null ? void 0 : _children$props7.renderLinkedContainer) || function (val) {
|
259
|
+
return /*#__PURE__*/React.createElement(DefaultPickerLinkedContainer, {
|
260
|
+
value: val
|
261
|
+
});
|
262
|
+
}
|
242
263
|
};
|
243
264
|
break;
|
244
265
|
|
245
266
|
case FormInternalComponentType.Picker:
|
246
267
|
props = {
|
247
|
-
|
248
|
-
|
249
|
-
disabled: this.props.disabled
|
268
|
+
value: getFieldValue(field),
|
269
|
+
onChange: this.innerTriggerFunctionWithValueFirst,
|
270
|
+
disabled: this.props.disabled,
|
271
|
+
renderLinkedContainer: ((_children$props8 = children.props) == null ? void 0 : _children$props8.renderLinkedContainer) || function (val) {
|
272
|
+
return /*#__PURE__*/React.createElement(DefaultPickerLinkedContainer, {
|
273
|
+
value: val
|
274
|
+
});
|
275
|
+
}
|
250
276
|
};
|
251
277
|
break;
|
252
278
|
|
@@ -310,12 +336,12 @@ export default /*#__PURE__*/forwardRef(function (props, ref) {
|
|
310
336
|
className = _props$className === void 0 ? '' : _props$className,
|
311
337
|
rest = _objectWithoutPropertiesLoose(props, _excluded);
|
312
338
|
|
313
|
-
var
|
314
|
-
prefixCls =
|
339
|
+
var _useContext2 = useContext(GlobalContext),
|
340
|
+
prefixCls = _useContext2.prefixCls;
|
315
341
|
|
316
|
-
var
|
317
|
-
layout =
|
318
|
-
propsDisabled =
|
342
|
+
var _useContext3 = useContext(FormItemContext),
|
343
|
+
layout = _useContext3.layout,
|
344
|
+
propsDisabled = _useContext3.disabled;
|
319
345
|
|
320
346
|
var _useState = useState(null),
|
321
347
|
errors = _useState[0],
|
@@ -604,6 +604,13 @@
|
|
604
604
|
height: 0.32rem ;
|
605
605
|
line-height: 0.32rem ;
|
606
606
|
}
|
607
|
+
.arco-form-picker-link-container {
|
608
|
+
font-size: 0.32rem;
|
609
|
+
color: #1d2129 ;
|
610
|
+
}
|
611
|
+
.arco-form-picker-link-container-placeholder {
|
612
|
+
color: #c9cdd4 ;
|
613
|
+
}
|
607
614
|
/***************************************************
|
608
615
|
* *
|
609
616
|
* Arco Theme Style *
|
@@ -638,4 +645,10 @@
|
|
638
645
|
.arco-theme-dark .arco-form-item-warning-message {
|
639
646
|
color: #FF9626 ;
|
640
647
|
}
|
648
|
+
.arco-theme-dark .arco-form-picker-link-container {
|
649
|
+
color: #f6f6f6 ;
|
650
|
+
}
|
651
|
+
.arco-theme-dark .arco-form-picker-link-container-placeholder {
|
652
|
+
color: #5f5f60 ;
|
653
|
+
}
|
641
654
|
/********************* End *************************/
|
@@ -89,6 +89,14 @@
|
|
89
89
|
}
|
90
90
|
}
|
91
91
|
}
|
92
|
+
|
93
|
+
&-picker-link-container {
|
94
|
+
.rem(font-size, 16);
|
95
|
+
.use-var(color, font-color);
|
96
|
+
&-placeholder {
|
97
|
+
.use-var(color, input-placeholder-color);
|
98
|
+
}
|
99
|
+
}
|
92
100
|
}
|
93
101
|
|
94
102
|
/***************************************************
|
@@ -149,6 +157,16 @@
|
|
149
157
|
.use-var(color, dark-form-item-warning-message-color);
|
150
158
|
}
|
151
159
|
}
|
160
|
+
&-picker-link-container {
|
161
|
+
@{arco-dark-mode-selector} & {
|
162
|
+
.use-var(color, dark-font-color);
|
163
|
+
}
|
164
|
+
&-placeholder {
|
165
|
+
@{arco-dark-mode-selector} & {
|
166
|
+
.use-var(color, dark-input-placeholder-color);
|
167
|
+
}
|
168
|
+
}
|
169
|
+
}
|
152
170
|
}
|
153
171
|
}
|
154
172
|
/********************* End *************************/
|
@@ -24,8 +24,7 @@ export default function IconCheck(props) {
|
|
24
24
|
}, other), /*#__PURE__*/React.createElement("path", {
|
25
25
|
fillRule: "evenodd",
|
26
26
|
clipRule: "evenodd",
|
27
|
-
d: "M16.702 4.47a.5.5 0 00-.705.06L8.33 13.596 3.82 9.724a.5.5 0 00-.705.054l-.652.758a.5.5 0 00.054.706L7.361 15.4a.5.5 0 00.054.053l.526.445.22.188a.5.5 0 00.722-.047l8.641-10.218a.5.5 0 00-.059-.705l-.763-.645z"
|
28
|
-
fill: useCurrentColor ? 'currentColor' : '#000'
|
27
|
+
d: "M16.702 4.47a.5.5 0 00-.705.06L8.33 13.596 3.82 9.724a.5.5 0 00-.705.054l-.652.758a.5.5 0 00.054.706L7.361 15.4a.5.5 0 00.054.053l.526.445.22.188a.5.5 0 00.722-.047l8.641-10.218a.5.5 0 00-.059-.705l-.763-.645z"
|
29
28
|
}));
|
30
29
|
});
|
31
30
|
}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { SVGAttributes, CSSProperties } from 'react';
|
2
|
+
export interface IconProps extends SVGAttributes<SVGElement> {
|
3
|
+
className?: string;
|
4
|
+
useCurrentColor?: boolean;
|
5
|
+
style?: CSSProperties;
|
6
|
+
}
|
7
|
+
export default function IconDownload(props: IconProps): JSX.Element;
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
3
|
+
var _excluded = ["className", "useCurrentColor", "style"];
|
4
|
+
import React from 'react';
|
5
|
+
import { ContextLayout } from '../../context-provider';
|
6
|
+
export default function IconDownload(props) {
|
7
|
+
var _props$className = props.className,
|
8
|
+
className = _props$className === void 0 ? '' : _props$className,
|
9
|
+
_props$useCurrentColo = props.useCurrentColor,
|
10
|
+
useCurrentColor = _props$useCurrentColo === void 0 ? true : _props$useCurrentColo,
|
11
|
+
style = props.style,
|
12
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
13
|
+
|
14
|
+
return /*#__PURE__*/React.createElement(ContextLayout, null, function (_ref) {
|
15
|
+
var prefixCls = _ref.prefixCls;
|
16
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
17
|
+
className: prefixCls + "-icon " + prefixCls + "-icon-download " + className,
|
18
|
+
width: "1em",
|
19
|
+
height: "1em",
|
20
|
+
style: style,
|
21
|
+
fill: useCurrentColor ? 'currentColor' : '#000',
|
22
|
+
xmlns: "http://www.w3.org/2000/svg",
|
23
|
+
viewBox: "0 0 16 16"
|
24
|
+
}, other), /*#__PURE__*/React.createElement("path", {
|
25
|
+
d: "M7.3,8.8V1.7h1.3v7.1l1.9-1.9l0.9,0.9L8,11.3L4.5,7.8l0.9-0.9L7.3,8.8z M3.3,13v-1.3H2v2.7h12v-2.7\th-1.3V13H3.3z",
|
26
|
+
fillRule: "evenodd",
|
27
|
+
clipRule: "evenodd"
|
28
|
+
}));
|
29
|
+
});
|
30
|
+
}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
3
|
+
var _excluded = ["className", "useCurrentColor", "style"];
|
4
|
+
import React from 'react';
|
5
|
+
import { ContextLayout } from '../../context-provider';
|
6
|
+
export default function IconFile(props) {
|
7
|
+
var _props$className = props.className,
|
8
|
+
className = _props$className === void 0 ? '' : _props$className,
|
9
|
+
_props$useCurrentColo = props.useCurrentColor,
|
10
|
+
useCurrentColor = _props$useCurrentColo === void 0 ? true : _props$useCurrentColo,
|
11
|
+
style = props.style,
|
12
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
13
|
+
|
14
|
+
return /*#__PURE__*/React.createElement(ContextLayout, null, function (_ref) {
|
15
|
+
var prefixCls = _ref.prefixCls;
|
16
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
17
|
+
className: prefixCls + "-icon " + prefixCls + "-icon-file " + className,
|
18
|
+
width: "1em",
|
19
|
+
height: "1em",
|
20
|
+
style: style,
|
21
|
+
fill: useCurrentColor ? 'currentColor' : '#000',
|
22
|
+
xmlns: "http://www.w3.org/2000/svg",
|
23
|
+
viewBox: "0 0 16 16"
|
24
|
+
}, other), /*#__PURE__*/React.createElement("path", {
|
25
|
+
d: "M2.3,2.7c0-0.7,0.6-1.3,1.3-1.3h7.3l2.7,2.7v9.3c0,0.7-0.6,1.3-1.3,1.3H3.7c-0.7,0-1.3-0.6-1.3-1.3\tV2.7z M10.4,2.7H3.7v10.7h8.7V4.6L10.4,2.7z M10.7,7.7H5.3V6.3h5.3V7.7z M8.7,10.3H5.3V9h3.3V10.3z",
|
26
|
+
fillRule: "evenodd",
|
27
|
+
clipRule: "evenodd"
|
28
|
+
}));
|
29
|
+
});
|
30
|
+
}
|
@@ -24,8 +24,7 @@ export default function IconQuestionCircle(props) {
|
|
24
24
|
}, other), /*#__PURE__*/React.createElement("path", {
|
25
25
|
fillRule: "evenodd",
|
26
26
|
clipRule: "evenodd",
|
27
|
-
d: "M7.982.68a7.312 7.312 0 110 14.625 7.312 7.312 0 010-14.625zm0 1.33a5.983 5.983 0 100 11.965 5.983 5.983 0 000-11.966zm.333 8.641c.183 0 .332.15.332.333v.664a.332.332 0 01-.332.333H7.65a.332.332 0 01-.332-.333v-.664c0-.184.148-.333.332-.333h.665zm-.427-6.647c.79 0 1.447.19 1.97.574.522.382.784.95.784 1.7 0 .461-.114.85-.341 1.165-.133.191-.389.436-.766.733l-.373.293c-.202.16-.337.345-.403.558a1.8 1.8 0 00-.048.323.332.332 0 01-.331.304h-.744a.332.332 0 01-.331-.363c.043-.463.088-.755.137-.878.091-.229.325-.492.703-.79l.383-.302c.126-.096.774-.553.774-.957 0-.405-.07-.553-.273-.775-.203-.222-.66-.294-1.073-.294-.405 0-.752.108-.922.38a1.921 1.921 0 00-.189.4 1.388 1.388 0 00-.048.204.332.332 0 01-.328.276h-.782a.332.332 0 01-.33-.37c.008-.074.017-.136.025-.185.13-.722.458-1.253.985-1.592.413-.27.92-.404 1.521-.404z"
|
28
|
-
fill: useCurrentColor ? 'currentColor' : '#000'
|
27
|
+
d: "M7.982.68a7.312 7.312 0 110 14.625 7.312 7.312 0 010-14.625zm0 1.33a5.983 5.983 0 100 11.965 5.983 5.983 0 000-11.966zm.333 8.641c.183 0 .332.15.332.333v.664a.332.332 0 01-.332.333H7.65a.332.332 0 01-.332-.333v-.664c0-.184.148-.333.332-.333h.665zm-.427-6.647c.79 0 1.447.19 1.97.574.522.382.784.95.784 1.7 0 .461-.114.85-.341 1.165-.133.191-.389.436-.766.733l-.373.293c-.202.16-.337.345-.403.558a1.8 1.8 0 00-.048.323.332.332 0 01-.331.304h-.744a.332.332 0 01-.331-.363c.043-.463.088-.755.137-.878.091-.229.325-.492.703-.79l.383-.302c.126-.096.774-.553.774-.957 0-.405-.07-.553-.273-.775-.203-.222-.66-.294-1.073-.294-.405 0-.752.108-.922.38a1.921 1.921 0 00-.189.4 1.388 1.388 0 00-.048.204.332.332 0 01-.328.276h-.782a.332.332 0 01-.33-.37c.008-.074.017-.136.025-.185.13-.722.458-1.253.985-1.592.413-.27.92-.404 1.521-.404z"
|
29
28
|
}));
|
30
29
|
});
|
31
30
|
}
|
@@ -19,10 +19,12 @@ export default function IconUpload(props) {
|
|
19
19
|
height: "1em",
|
20
20
|
style: style,
|
21
21
|
fill: useCurrentColor ? 'currentColor' : '#000',
|
22
|
-
|
23
|
-
|
24
|
-
}, other), /*#__PURE__*/React.createElement("
|
25
|
-
d: "
|
22
|
+
xmlns: "http://www.w3.org/2000/svg",
|
23
|
+
viewBox: "0 0 14 14"
|
24
|
+
}, other), /*#__PURE__*/React.createElement("path", {
|
25
|
+
d: "M7,1.5l3.1,3.1L9.2,5.4L7.6,3.7v5.9H6.4V3.7L4.8,5.4L3.9,4.6L7,1.5z M2.9,11.4v-1.2H1.8v2.3h10.5\tv-2.3h-1.2v1.2H2.9z",
|
26
|
+
fillRule: "evenodd",
|
27
|
+
clipRule: "evenodd"
|
26
28
|
}));
|
27
29
|
});
|
28
30
|
}
|
@@ -22,8 +22,7 @@ export default function IconUserFill(props) {
|
|
22
22
|
fill: useCurrentColor ? 'currentColor' : '#000',
|
23
23
|
xmlns: "http://www.w3.org/2000/svg"
|
24
24
|
}, other), /*#__PURE__*/React.createElement("path", {
|
25
|
-
d: "M12.5 10.833c2.301 0 5 1.786 5 5v2.5c0 .46-.373.834-.833.834H3.333a.833.833 0 01-.833-.834v-2.5c0-3.211 2.699-5 5-5h5zM10 1.25a4.167 4.167 0 110 8.333 4.167 4.167 0 010-8.333z"
|
26
|
-
fill: useCurrentColor ? 'currentColor' : '#000'
|
25
|
+
d: "M12.5 10.833c2.301 0 5 1.786 5 5v2.5c0 .46-.373.834-.833.834H3.333a.833.833 0 01-.833-.834v-2.5c0-3.211 2.699-5 5-5h5zM10 1.25a4.167 4.167 0 110 8.333 4.167 4.167 0 010-8.333z"
|
27
26
|
}));
|
28
27
|
});
|
29
28
|
}
|
package/esm/icon/index.d.ts
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
export { default as IconUpload } from './IconUpload';
|
2
1
|
export { default as IconSquareChecked } from './IconSquareChecked';
|
3
2
|
export { default as IconTriUp } from './IconTriUp';
|
4
3
|
export { default as IconMore } from './IconMore';
|
@@ -54,4 +53,7 @@ export { default as IconGift } from './IconGift';
|
|
54
53
|
export { default as IconStarHalf } from './IconStarHalf';
|
55
54
|
export { default as IconKeyboard } from './IconKeyboard';
|
56
55
|
export { default as IconKeyboardDelete } from './IconKeyboardDelete';
|
56
|
+
export { default as IconDownload } from './IconDownload';
|
57
|
+
export { default as IconFile } from './IconFile';
|
58
|
+
export { default as IconUpload } from './IconUpload';
|
57
59
|
export * from './type';
|
package/esm/icon/index.js
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
export { default as IconUpload } from './IconUpload';
|
2
1
|
export { default as IconSquareChecked } from './IconSquareChecked';
|
3
2
|
export { default as IconTriUp } from './IconTriUp';
|
4
3
|
export { default as IconMore } from './IconMore';
|
@@ -54,4 +53,7 @@ export { default as IconGift } from './IconGift';
|
|
54
53
|
export { default as IconStarHalf } from './IconStarHalf';
|
55
54
|
export { default as IconKeyboard } from './IconKeyboard';
|
56
55
|
export { default as IconKeyboardDelete } from './IconKeyboardDelete';
|
56
|
+
export { default as IconDownload } from './IconDownload';
|
57
|
+
export { default as IconFile } from './IconFile';
|
58
|
+
export { default as IconUpload } from './IconUpload';
|
57
59
|
export * from './type';
|
package/esm/icon/type.d.ts
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
/// <reference types="react" />
|
2
|
-
export interface
|
2
|
+
export interface OriginIconProps extends React.SVGProps<SVGSVGElement> {
|
3
3
|
className?: string;
|
4
4
|
prefix?: string;
|
5
5
|
width?: string;
|
6
6
|
height?: string;
|
7
7
|
useCurrentColor?: boolean;
|
8
|
+
spin?: boolean;
|
8
9
|
}
|
10
|
+
export declare type IconProps = React.PropsWithoutRef<OriginIconProps> & React.RefAttributes<SVGSVGElement>;
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
2
|
import React, { useRef, forwardRef, useImperativeHandle } from 'react';
|
3
|
-
import { Promise } from 'es6-promise';
|
4
3
|
import { cls, defaultLocale, componentWrapper } from '@arco-design/mobile-utils';
|
5
4
|
import { ContextLayout } from '../context-provider';
|
6
5
|
import { IconClose } from '../icon';
|
@@ -8,6 +7,7 @@ import Image from '../image';
|
|
8
7
|
import Grid from '../grid';
|
9
8
|
import AddIcon from './add-icon';
|
10
9
|
import { useLatestRef } from '../_helpers';
|
10
|
+
import { Upload } from '../uploader/upload';
|
11
11
|
export * from './type';
|
12
12
|
var ImagePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
13
13
|
var _props$className = props.className,
|
@@ -26,7 +26,6 @@ var ImagePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
26
26
|
limit = _props$limit === void 0 ? 0 : _props$limit,
|
27
27
|
_props$images = props.images,
|
28
28
|
images = _props$images === void 0 ? [] : _props$images,
|
29
|
-
maxSize = props.maxSize,
|
30
29
|
disabled = props.disabled,
|
31
30
|
deleteIcon = props.deleteIcon,
|
32
31
|
selectIcon = props.selectIcon,
|
@@ -39,18 +38,7 @@ var ImagePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
39
38
|
imageProps = props.imageProps,
|
40
39
|
renderLoading = props.renderLoading,
|
41
40
|
renderError = props.renderError,
|
42
|
-
|
43
|
-
onClick = props.onClick,
|
44
|
-
_props$onChange = props.onChange,
|
45
|
-
onChange = _props$onChange === void 0 ? function () {
|
46
|
-
return null;
|
47
|
-
} : _props$onChange,
|
48
|
-
onMaxSizeExceed = props.onMaxSizeExceed,
|
49
|
-
onLimitExceed = props.onLimitExceed,
|
50
|
-
upload = props.upload,
|
51
|
-
selectAdapter = props.selectAdapter,
|
52
|
-
onSelectClick = props.onSelectClick,
|
53
|
-
onDeleteClick = props.onDeleteClick;
|
41
|
+
selectAdapter = props.selectAdapter;
|
54
42
|
var domRef = useRef(null);
|
55
43
|
var fileRef = useRef(null);
|
56
44
|
var cacheRef = useLatestRef(images);
|
@@ -59,143 +47,9 @@ var ImagePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
59
47
|
dom: domRef.current
|
60
48
|
};
|
61
49
|
});
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
if (file.url) {
|
66
|
-
resolve(file.url);
|
67
|
-
} else {
|
68
|
-
var reader = new FileReader();
|
69
|
-
|
70
|
-
reader.onload = function (e) {
|
71
|
-
var _e$target;
|
72
|
-
|
73
|
-
var dataURL = (_e$target = e.target) == null ? void 0 : _e$target.result;
|
74
|
-
|
75
|
-
if (!dataURL) {
|
76
|
-
reject(new Error('file parse error'));
|
77
|
-
}
|
78
|
-
|
79
|
-
resolve(dataURL);
|
80
|
-
};
|
81
|
-
|
82
|
-
reader.onerror = function () {
|
83
|
-
reject(new Error('file parse error'));
|
84
|
-
};
|
85
|
-
|
86
|
-
reader.readAsDataURL(file);
|
87
|
-
}
|
88
|
-
});
|
89
|
-
};
|
90
|
-
|
91
|
-
var handleChange = function handleChange(event, fromAdapter) {
|
92
|
-
var files = Array.prototype.filter.call(event.target.files || [], function (file) {
|
93
|
-
// 过滤maxSize
|
94
|
-
if (maxSize && file.size > maxSize * 1024) {
|
95
|
-
onMaxSizeExceed && onMaxSizeExceed(file);
|
96
|
-
return false;
|
97
|
-
}
|
98
|
-
|
99
|
-
return true;
|
100
|
-
}) || [];
|
101
|
-
|
102
|
-
if (!fromAdapter) {
|
103
|
-
event.target.value = '';
|
104
|
-
} // 截断limit
|
105
|
-
|
106
|
-
|
107
|
-
if (limit !== 0 && files.length + images.length > limit) {
|
108
|
-
onLimitExceed && onLimitExceed(files);
|
109
|
-
files.length = limit - images.length;
|
110
|
-
} // 解析文件生成预览
|
111
|
-
|
112
|
-
|
113
|
-
Promise.all(files.map(function (file) {
|
114
|
-
return parseFile(file);
|
115
|
-
})).then(function (parseFiles) {
|
116
|
-
var res = parseFiles.map(function (url, index) {
|
117
|
-
return {
|
118
|
-
url: url,
|
119
|
-
status: typeof upload === 'function' ? 'loading' : 'loaded',
|
120
|
-
file: files[index]
|
121
|
-
};
|
122
|
-
});
|
123
|
-
cacheRef.current = [].concat(cacheRef.current, res);
|
124
|
-
onChange([].concat(cacheRef.current)); // 执行upload
|
125
|
-
|
126
|
-
if (typeof upload === 'function') {
|
127
|
-
files.forEach(function (_file) {
|
128
|
-
upload(cacheRef.current.find(function (_ref) {
|
129
|
-
var file = _ref.file;
|
130
|
-
return file === _file;
|
131
|
-
})).then(function (data) {
|
132
|
-
var index = cacheRef.current.findIndex(function (_ref2) {
|
133
|
-
var file = _ref2.file;
|
134
|
-
return file === _file;
|
135
|
-
});
|
136
|
-
|
137
|
-
if (index !== -1) {
|
138
|
-
cacheRef.current[index] = _extends({}, cacheRef.current[index], data, {
|
139
|
-
status: undefined
|
140
|
-
});
|
141
|
-
}
|
142
|
-
}).catch(function () {
|
143
|
-
var index = cacheRef.current.findIndex(function (_ref3) {
|
144
|
-
var file = _ref3.file;
|
145
|
-
return file === _file;
|
146
|
-
});
|
147
|
-
|
148
|
-
if (index !== -1) {
|
149
|
-
cacheRef.current[index].status = 'error';
|
150
|
-
}
|
151
|
-
}).finally(function () {
|
152
|
-
onChange([].concat(cacheRef.current));
|
153
|
-
});
|
154
|
-
});
|
155
|
-
}
|
156
|
-
});
|
157
|
-
};
|
158
|
-
|
159
|
-
var handleDelete = function handleDelete(index) {
|
160
|
-
onDeleteClick && onDeleteClick(index);
|
161
|
-
onChange(images.filter(function (_i, j) {
|
162
|
-
return j !== index;
|
163
|
-
}));
|
164
|
-
}; // click && longPress
|
165
|
-
|
166
|
-
|
167
|
-
var timeOutEvent;
|
168
|
-
|
169
|
-
var handleTouchStart = function handleTouchStart(e, image, index) {
|
170
|
-
timeOutEvent = setTimeout(function () {
|
171
|
-
timeOutEvent = 0;
|
172
|
-
onLongPress == null ? void 0 : onLongPress(e, image, index);
|
173
|
-
}, 750);
|
174
|
-
};
|
175
|
-
|
176
|
-
var handleClick = function handleClick(e, image, index) {
|
177
|
-
clearTimeout(timeOutEvent);
|
178
|
-
|
179
|
-
if (timeOutEvent !== 0) {
|
180
|
-
onClick == null ? void 0 : onClick(e, image, index);
|
181
|
-
}
|
182
|
-
};
|
183
|
-
|
184
|
-
var handleSelect = function handleSelect(e) {
|
185
|
-
if (e.target !== fileRef.current) {
|
186
|
-
var _fileRef$current;
|
187
|
-
|
188
|
-
onSelectClick && onSelectClick();
|
189
|
-
selectAdapter ? selectAdapter().then(function (_ref4) {
|
190
|
-
var files = _ref4.files;
|
191
|
-
return handleChange({
|
192
|
-
target: {
|
193
|
-
files: files
|
194
|
-
}
|
195
|
-
}, true);
|
196
|
-
}) : (_fileRef$current = fileRef.current) == null ? void 0 : _fileRef$current.click();
|
197
|
-
}
|
198
|
-
};
|
50
|
+
var uploadFunc = new Upload(_extends({}, props, {
|
51
|
+
files: images
|
52
|
+
}), fileRef, cacheRef);
|
199
53
|
|
200
54
|
var getGridData = function getGridData(prefixCls, locale) {
|
201
55
|
var errorNode = function errorNode(index) {
|
@@ -225,10 +79,10 @@ var ImagePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
225
79
|
className: prefixCls + "-image-picker-image"
|
226
80
|
}, /*#__PURE__*/React.createElement("div", {
|
227
81
|
onTouchStart: function onTouchStart(e) {
|
228
|
-
return handleTouchStart(e, image, index);
|
82
|
+
return uploadFunc.handleTouchStart(e, image, index);
|
229
83
|
},
|
230
84
|
onClick: function onClick(e) {
|
231
|
-
return handleClick(e, image, index);
|
85
|
+
return uploadFunc.handleClick(e, image, index);
|
232
86
|
},
|
233
87
|
className: prefixCls + "-image-picker-image-container"
|
234
88
|
}, /*#__PURE__*/React.createElement(Image, _extends({
|
@@ -244,7 +98,7 @@ var ImagePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
244
98
|
})), !hideDelete && /*#__PURE__*/React.createElement("div", {
|
245
99
|
className: prefixCls + "-image-picker-close",
|
246
100
|
onClick: function onClick() {
|
247
|
-
return
|
101
|
+
return uploadFunc.deleteFile(index);
|
248
102
|
}
|
249
103
|
}, deleteIcon || /*#__PURE__*/React.createElement("div", {
|
250
104
|
className: prefixCls + "-image-picker-close-icon"
|
@@ -261,7 +115,7 @@ var ImagePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
261
115
|
data.push({
|
262
116
|
img: /*#__PURE__*/React.createElement("div", {
|
263
117
|
className: cls(prefixCls + "-image-picker-add", (_cls = {}, _cls[prefixCls + "-image-picker-add-disabled"] = disableSelect, _cls)),
|
264
|
-
onClick: handleSelect
|
118
|
+
onClick: uploadFunc.handleSelect
|
265
119
|
}, /*#__PURE__*/React.createElement("div", {
|
266
120
|
className: prefixCls + "-image-picker-add-container"
|
267
121
|
}, selectIcon || /*#__PURE__*/React.createElement("div", {
|
@@ -272,7 +126,7 @@ var ImagePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
272
126
|
multiple: multiple,
|
273
127
|
type: "file",
|
274
128
|
onChange: function onChange(e) {
|
275
|
-
return handleChange(e);
|
129
|
+
return uploadFunc.handleChange(e);
|
276
130
|
},
|
277
131
|
ref: fileRef
|
278
132
|
}) : null)),
|
@@ -283,12 +137,12 @@ var ImagePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
283
137
|
return data;
|
284
138
|
};
|
285
139
|
|
286
|
-
return /*#__PURE__*/React.createElement(ContextLayout, null, function (
|
140
|
+
return /*#__PURE__*/React.createElement(ContextLayout, null, function (_ref) {
|
287
141
|
var _cls2;
|
288
142
|
|
289
|
-
var prefixCls =
|
290
|
-
|
291
|
-
locale =
|
143
|
+
var prefixCls = _ref.prefixCls,
|
144
|
+
_ref$locale = _ref.locale,
|
145
|
+
locale = _ref$locale === void 0 ? defaultLocale : _ref$locale;
|
292
146
|
return /*#__PURE__*/React.createElement("div", {
|
293
147
|
className: cls(prefixCls + "-image-picker", className, (_cls2 = {}, _cls2[prefixCls + "-image-picker-disabled"] = disabled, _cls2)),
|
294
148
|
style: style,
|
@@ -1,33 +1,14 @@
|
|
1
1
|
import { InputHTMLAttributes } from 'react';
|
2
2
|
import { ImageProps } from '../image';
|
3
|
-
|
3
|
+
import { UploadCommonProps, CommonFileItem } from '../uploader/upload/type';
|
4
|
+
export interface ImagePickItem extends CommonFileItem {
|
4
5
|
/**
|
5
6
|
* 图片地址
|
6
7
|
* @en Image Url
|
7
8
|
*/
|
8
9
|
url: string;
|
9
|
-
/**
|
10
|
-
* 图片文件
|
11
|
-
* @en Image File
|
12
|
-
*/
|
13
|
-
file?: File;
|
14
|
-
/**
|
15
|
-
* 图片状态
|
16
|
-
* @en Image Status
|
17
|
-
* @default 以图片自身加载状态而定
|
18
|
-
* @default_en According to inner status of the image
|
19
|
-
*/
|
20
|
-
status?: 'loaded' | 'loading' | 'error';
|
21
10
|
}
|
22
|
-
export interface
|
23
|
-
url?: string;
|
24
|
-
size: number;
|
25
|
-
name: string;
|
26
|
-
}
|
27
|
-
export interface SelectCallback {
|
28
|
-
files: AdapterFile[];
|
29
|
-
}
|
30
|
-
export interface ImagePickerProps {
|
11
|
+
export interface ImagePickerProps extends Omit<UploadCommonProps<ImagePickItem>, 'files'> {
|
31
12
|
/**
|
32
13
|
* 自定义类名
|
33
14
|
* @en Custom className
|
@@ -71,16 +52,6 @@ export interface ImagePickerProps {
|
|
71
52
|
* @default 8
|
72
53
|
*/
|
73
54
|
gutter?: number;
|
74
|
-
/**
|
75
|
-
* 最多选择图片张数,超出数量自动隐藏上传按钮,0表示不做限制
|
76
|
-
* @en max Pictures Can Choose
|
77
|
-
*/
|
78
|
-
limit?: number;
|
79
|
-
/**
|
80
|
-
* 文件大小限制,单位为K
|
81
|
-
* @en File size limit, in K
|
82
|
-
*/
|
83
|
-
maxSize?: number;
|
84
55
|
/**
|
85
56
|
* 是否隐藏删除Icon
|
86
57
|
* @en Whether to hide delete Icon
|
@@ -129,51 +100,11 @@ export interface ImagePickerProps {
|
|
129
100
|
* @en Defined uploading display
|
130
101
|
*/
|
131
102
|
renderLoading?: (index?: number) => React.ReactNode | React.ReactNode;
|
132
|
-
/**
|
133
|
-
* 上传方法
|
134
|
-
* @en upload function
|
135
|
-
*/
|
136
|
-
upload?: (file: ImagePickItem) => Promise<ImagePickItem | null>;
|
137
|
-
/**
|
138
|
-
* 已选图片列表发生变化
|
139
|
-
* @en The list of selected images changes
|
140
|
-
*/
|
141
|
-
onChange?: (fileList: ImagePickItem[]) => void;
|
142
|
-
/**
|
143
|
-
* 图片超过限制大小
|
144
|
-
* @en Image exceeds size limit
|
145
|
-
*/
|
146
|
-
onMaxSizeExceed?: (file: File) => void;
|
147
|
-
/**
|
148
|
-
* 选择张数超过限制
|
149
|
-
* @en The number of pictures exceeds the limit
|
150
|
-
*/
|
151
|
-
onLimitExceed?: (files: File[]) => void;
|
152
|
-
/**
|
153
|
-
* 图片点击
|
154
|
-
* @en click event
|
155
|
-
*/
|
156
|
-
onClick?: (e: React.MouseEvent<HTMLElement, MouseEvent>, image: ImagePickItem, index: number) => void;
|
157
|
-
/**
|
158
|
-
* 图片长按事件
|
159
|
-
* @en long press event
|
160
|
-
*/
|
161
|
-
onLongPress?: (e: React.TouchEvent<HTMLElement>, image: ImagePickItem, index: number) => void;
|
162
|
-
/**
|
163
|
-
* 图片选择适配器
|
164
|
-
* @en Select Adaptor
|
165
|
-
*/
|
166
|
-
selectAdapter?: () => Promise<SelectCallback>;
|
167
103
|
/**
|
168
104
|
* 选图点击事件
|
169
|
-
* @en Select
|
105
|
+
* @en Select icon click event
|
170
106
|
*/
|
171
107
|
onSelectClick?: () => void;
|
172
|
-
/**
|
173
|
-
* 删除点击事件
|
174
|
-
* @en Delete Icon Click Event
|
175
|
-
*/
|
176
|
-
onDeleteClick?: (index: number) => void;
|
177
108
|
}
|
178
109
|
export interface ImagePickerRef {
|
179
110
|
/**
|