@para-ui/core 3.0.28 → 3.0.30
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/AutoBox/index.js +48 -88
- package/AutoTips/index.js +25 -32
- package/Breadcrumbs/index.js +43 -63
- package/Button/SplitButton.d.ts +1 -1
- package/Button/index.d.ts +1 -1
- package/Button/index.js +88 -118
- package/ButtonGroup/index.js +27 -36
- package/Carousel/index.d.ts +2 -2
- package/Carousel/index.js +27 -28
- package/Cascader/index.js +52 -64
- package/Checkbox/index.js +23 -39
- package/CheckboxGroup/index.js +31 -48
- package/Collapse/collapsePanel.d.ts +1 -1
- package/Collapse/index.d.ts +1 -1
- package/Collapse/index.js +9 -29
- package/Collapse/util.d.ts +2 -2
- package/CollapseBox/index.js +45 -56
- package/CollapseLayout/index.js +35 -54
- package/ComboSelect/index.js +222 -349
- package/ComboSelect/interface.d.ts +3 -3
- package/Container/index.js +17 -20
- package/DatePicker/generatePicker/index.d.ts +17 -17
- package/DatePicker/index.d.ts +4 -4
- package/DatePicker/index.js +111 -167
- package/Desktop/index.js +62 -173
- package/Drawer/index.js +65 -58
- package/Drawer/interface.d.ts +7 -3
- package/Dropdown/index.d.ts +1 -1
- package/Dropdown/index.js +3 -3
- package/Empty/index.js +17 -22
- package/Form/index.d.ts +1 -1
- package/Form/index.js +38 -80
- package/FormItem/index.d.ts +1 -1
- package/FormItem/index.js +11 -11
- package/FormItem/validateFunction.d.ts +1 -1
- package/FunctionModal/index.js +11 -11
- package/GlobalContext/index.js +3 -3
- package/GlobalContext/usePopupContainer.d.ts +1 -1
- package/Help/index.js +11 -11
- package/HelperText/index.js +11 -12
- package/InputLang/index.js +47 -80
- package/InputNumber/index.js +65 -100
- package/Label/index.js +15 -16
- package/Loading/index.js +6 -7
- package/Menu/index.js +148 -328
- package/Menu/interface.d.ts +2 -2
- package/Menu/verticalMenuList.d.ts +1 -1
- package/Message/index.d.ts +1 -1
- package/Message/index.js +45 -64
- package/Modal/Confirm/index.d.ts +2 -2
- package/Modal/index.d.ts +1 -1
- package/Modal/index.js +119 -152
- package/MultiBox/index.js +44 -76
- package/Notification/index.d.ts +2 -2
- package/Notification/index.js +51 -72
- package/OperateBtn/index.js +42 -70
- package/PageHeader/index.js +120 -286
- package/PageHeader/interface.d.ts +1 -1
- package/Pagination/index.d.ts +2 -2
- package/Pagination/index.js +79 -131
- package/ParauiProvider/index.js +2 -3
- package/PasswordRules/index.js +12 -30
- package/PopConfirm/index.d.ts +1 -1
- package/PopConfirm/index.js +52 -59
- package/Popover/index.js +8 -9
- package/Progress/index.d.ts +6 -6
- package/Progress/index.js +50 -89
- package/Querying/index.js +14 -17
- package/README.md +813 -800
- package/Radio/index.js +21 -33
- package/RadioGroup/index.js +32 -47
- package/Search/index.js +44 -66
- package/Select/index.js +176 -343
- package/SelectInput/index.js +8 -9
- package/Selector/index.js +285 -681
- package/SelectorPicker/index.js +62 -97
- package/SingleBox/index.js +30 -55
- package/Slider/index.d.ts +1 -1
- package/Slider/index.js +29 -41
- package/Slider/interface.d.ts +2 -2
- package/Split/index.js +10 -23
- package/Status/index.js +8 -7
- package/Stepper/index.d.ts +1 -1
- package/Stepper/index.js +20 -25
- package/Styles/form.scss +5 -5
- package/Styles/index.scss +37 -37
- package/Styles/normalize.scss +348 -348
- package/Styles/scrollbar.scss +223 -223
- package/Styles/theme.scss +74 -74
- package/Switch/index.d.ts +2 -2
- package/Switch/index.js +19 -20
- package/Table/index.js +568 -1019
- package/Table/interface.d.ts +5 -5
- package/Tabs/index.d.ts +3 -3
- package/Tabs/index.js +47 -65
- package/Tag/TagGroup.d.ts +1 -1
- package/Tag/index.d.ts +2 -2
- package/Tag/index.js +72 -107
- package/TextEditor/index.d.ts +2 -2
- package/TextEditor/index.js +81 -105
- package/TextField/index.js +141 -220
- package/TimePicker/index.d.ts +1 -1
- package/TimePicker/index.js +12 -15
- package/Timeline/index.js +42 -52
- package/Title/index.js +10 -9
- package/ToggleButton/ToggleButtonGroup.d.ts +1 -1
- package/ToggleButton/index.js +50 -70
- package/Tooltip/index.js +64 -98
- package/Tooltip/interface.d.ts +1 -1
- package/Transfer/index.d.ts +1 -1
- package/Transfer/index.js +114 -137
- package/Transfer/useClick.d.ts +1 -1
- package/Tree/index.js +10 -10
- package/Tree/interface.d.ts +6 -6
- package/Upload/Dragger/index.d.ts +1 -1
- package/Upload/ImageUpload/index.d.ts +1 -1
- package/Upload/ImgCrop/EasyCrop.d.ts +1 -1
- package/Upload/index.d.ts +1 -1
- package/Upload/index.js +283 -475
- package/Upload/interface.d.ts +2 -2
- package/_verture/{constant-bf34e6fa.js → constant-66aa48a1.js} +0 -1
- package/_verture/defineProperty-62acccfc.js +34 -0
- package/_verture/{index-342379c6.js → index-06fea29b.js} +79 -124
- package/_verture/{index-48875ffd.js → index-131f8fe5.js} +80 -181
- package/_verture/{index-31ce5a11.js → index-92144ad3.js} +238 -445
- package/_verture/{index-bbed73a3.js → index-be4faaee.js} +19 -61
- package/_verture/{intl-336570e4.js → intl-5cbb940c.js} +4 -12
- package/_verture/{modalContext-d646d9db.js → modalContext-c749e1c6.js} +18 -43
- package/_verture/{slicedToArray-d7722f4b.js → slicedToArray-77980792.js} +23 -25
- package/_verture/{toConsumableArray-f8047a75.js → toConsumableArray-87c7d895.js} +1 -1
- package/_verture/{useFormatMessage-f4452258.js → useFormatMessage-703f8b20.js} +1 -3
- package/_verture/{useGlobalProps-af9a2af6.js → useGlobalProps-1b846a65.js} +1 -2
- package/_verture/{usePopupContainer-b8ab7cab.js → usePopupContainer-87febeb9.js} +10 -25
- package/_verture/{util-a77b261e.js → util-7e1fb1e2.js} +2 -3
- package/index.d.ts +2 -4
- package/index.js +15 -16
- package/package.json +167 -168
- package/Test/index.d.ts +0 -3
- package/Test/index.js +0 -9
- package/_verture/defineProperty-0590dc61.js +0 -16
package/Upload/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { _ as _defineProperty } from '../_verture/defineProperty-
|
|
2
|
-
import { _ as _toConsumableArray } from '../_verture/toConsumableArray-
|
|
3
|
-
import { _ as _slicedToArray } from '../_verture/slicedToArray-
|
|
1
|
+
import { _ as _defineProperty } from '../_verture/defineProperty-62acccfc.js';
|
|
2
|
+
import { _ as _toConsumableArray } from '../_verture/toConsumableArray-87c7d895.js';
|
|
3
|
+
import { _ as _slicedToArray } from '../_verture/slicedToArray-77980792.js';
|
|
4
4
|
import { a as __awaiter, _ as __rest } from '../_verture/tslib.es6-55ed4bd2.js';
|
|
5
5
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
6
6
|
import { useState, useEffect, useRef, memo, forwardRef, useCallback, useImperativeHandle, useMemo } from 'react';
|
|
@@ -8,15 +8,15 @@ import RcUpload from 'rc-upload';
|
|
|
8
8
|
import UploadIcon from '@para-ui/icons/UploadFile';
|
|
9
9
|
import LoadingIcon from '@para-ui/icons/Loading';
|
|
10
10
|
import { _ as _typeof } from '../_verture/typeof-498dd2b1.js';
|
|
11
|
-
import { r as regenerator } from '../_verture/index-
|
|
11
|
+
import { r as regenerator } from '../_verture/index-06fea29b.js';
|
|
12
12
|
import Delete from '@para-ui/icons/Delete';
|
|
13
13
|
import TextIcon from '@para-ui/icons/Text';
|
|
14
14
|
import PhotoIcon from '@para-ui/icons/Photo';
|
|
15
15
|
import clsx from 'clsx';
|
|
16
|
-
import { $ as $prefixCls, a as $rcPrefixCls } from '../_verture/constant-
|
|
16
|
+
import { $ as $prefixCls, a as $rcPrefixCls } from '../_verture/constant-66aa48a1.js';
|
|
17
17
|
import { s as styleInject } from '../_verture/style-inject.es-300983ab.js';
|
|
18
18
|
import Forbid from '@para-ui/icons/Forbid';
|
|
19
|
-
import { u as useFormatMessage } from '../_verture/useFormatMessage-
|
|
19
|
+
import { u as useFormatMessage } from '../_verture/useFormatMessage-703f8b20.js';
|
|
20
20
|
import EditOutline from '@para-ui/icons/EditOutline';
|
|
21
21
|
import { Button } from '../Button/index.js';
|
|
22
22
|
import { Slider } from '../Slider/index.js';
|
|
@@ -28,9 +28,9 @@ import '../Tooltip/index.js';
|
|
|
28
28
|
import 'rc-tooltip';
|
|
29
29
|
import 'rc-tooltip/lib/placements';
|
|
30
30
|
import '@para-ui/icons/Down';
|
|
31
|
-
import '../_verture/index-
|
|
31
|
+
import '../_verture/index-be4faaee.js';
|
|
32
32
|
import 'rc-dropdown';
|
|
33
|
-
import '../_verture/usePopupContainer-
|
|
33
|
+
import '../_verture/usePopupContainer-87febeb9.js';
|
|
34
34
|
import 'dayjs';
|
|
35
35
|
import '@paraview/lib';
|
|
36
36
|
import 'rc-slider';
|
|
@@ -47,34 +47,29 @@ var css_248z$4 = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2021/11/11
|
|
|
47
47
|
styleInject(css_248z$4);
|
|
48
48
|
|
|
49
49
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
50
|
-
|
|
51
50
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
52
|
-
|
|
53
51
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
54
|
-
|
|
52
|
+
//UploadList
|
|
55
53
|
var UploadList = function UploadList(props) {
|
|
56
54
|
var _props$listType = props.listType,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
55
|
+
listType = _props$listType === void 0 ? 'text' : _props$listType,
|
|
56
|
+
_props$items = props.items,
|
|
57
|
+
items = _props$items === void 0 ? [] : _props$items,
|
|
58
|
+
onRemove = props.onRemove,
|
|
59
|
+
_props$showRemoveIcon = props.showRemoveIcon,
|
|
60
|
+
showRemoveIcon = _props$showRemoveIcon === void 0 ? true : _props$showRemoveIcon,
|
|
61
|
+
removeIcon = props.removeIcon,
|
|
62
|
+
itemRender = props.itemRender;
|
|
66
63
|
var _useState = useState([]),
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
64
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
65
|
+
uploadList = _useState2[0],
|
|
66
|
+
setUploadList = _useState2[1];
|
|
67
|
+
//处理删除
|
|
72
68
|
var handleRemove = function handleRemove(file, evt) {
|
|
73
69
|
evt.stopPropagation();
|
|
74
70
|
onRemove === null || onRemove === void 0 ? void 0 : onRemove(file);
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
|
|
71
|
+
};
|
|
72
|
+
//渲染列表actions
|
|
78
73
|
var renderActions = function renderActions(file) {
|
|
79
74
|
return showRemoveIcon && jsx("span", Object.assign({
|
|
80
75
|
className: 'upload-list-actions',
|
|
@@ -84,15 +79,14 @@ var UploadList = function UploadList(props) {
|
|
|
84
79
|
}, {
|
|
85
80
|
children: removeIcon || jsx(Delete, {})
|
|
86
81
|
}));
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
|
|
82
|
+
};
|
|
83
|
+
//文件列表 text
|
|
90
84
|
var renderFileListText = function renderFileListText() {
|
|
91
85
|
if (!(uploadList === null || uploadList === void 0 ? void 0 : uploadList.length)) return null;
|
|
92
86
|
return uploadList.map(function (file, idx) {
|
|
93
87
|
var _a;
|
|
94
|
-
|
|
95
|
-
|
|
88
|
+
if (itemRender)
|
|
89
|
+
//自定义渲染
|
|
96
90
|
return itemRender(file, uploadList);
|
|
97
91
|
var isImage = !!((_a = file.type) === null || _a === void 0 ? void 0 : _a.includes('image/'));
|
|
98
92
|
return jsx("div", Object.assign({
|
|
@@ -117,13 +111,13 @@ var UploadList = function UploadList(props) {
|
|
|
117
111
|
}))
|
|
118
112
|
}), idx);
|
|
119
113
|
});
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
|
|
114
|
+
};
|
|
115
|
+
//文件列表 picture-card
|
|
123
116
|
var renderFileListPicture = function renderFileListPicture() {
|
|
124
117
|
if (!(uploadList === null || uploadList === void 0 ? void 0 : uploadList.length)) return null;
|
|
125
118
|
return uploadList.map(function (file, idx) {
|
|
126
|
-
if (itemRender)
|
|
119
|
+
if (itemRender)
|
|
120
|
+
//自定义渲染
|
|
127
121
|
return itemRender(file, uploadList);
|
|
128
122
|
return jsxs("div", Object.assign({
|
|
129
123
|
className: 'upload-list-picture-item'
|
|
@@ -139,13 +133,11 @@ var UploadList = function UploadList(props) {
|
|
|
139
133
|
})), renderActions(file)]
|
|
140
134
|
}), idx);
|
|
141
135
|
});
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
|
|
136
|
+
};
|
|
137
|
+
//处理文件
|
|
145
138
|
var handleFileFormat = function handleFileFormat() {
|
|
146
139
|
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee2() {
|
|
147
140
|
var readerFileAsDataUrl, _iterator, _step, file, dataUrl;
|
|
148
|
-
|
|
149
141
|
return regenerator.wrap(function _callee2$(_context2) {
|
|
150
142
|
while (1) {
|
|
151
143
|
switch (_context2.prev = _context2.next) {
|
|
@@ -154,9 +146,7 @@ var UploadList = function UploadList(props) {
|
|
|
154
146
|
_context2.next = 2;
|
|
155
147
|
break;
|
|
156
148
|
}
|
|
157
|
-
|
|
158
149
|
return _context2.abrupt("return", setUploadList([]));
|
|
159
|
-
|
|
160
150
|
case 2:
|
|
161
151
|
//读取file as DataUrl
|
|
162
152
|
readerFileAsDataUrl = function readerFileAsDataUrl(file) {
|
|
@@ -167,16 +157,13 @@ var UploadList = function UploadList(props) {
|
|
|
167
157
|
case 0:
|
|
168
158
|
return _context.abrupt("return", new Promise(function (resolve) {
|
|
169
159
|
var fileReader = new FileReader();
|
|
170
|
-
|
|
171
160
|
if (file.originFileObj) {
|
|
172
161
|
fileReader.onload = function () {
|
|
173
162
|
resolve(fileReader.result);
|
|
174
163
|
};
|
|
175
|
-
|
|
176
164
|
fileReader.readAsDataURL(file.originFileObj);
|
|
177
165
|
} else resolve('');
|
|
178
166
|
}));
|
|
179
|
-
|
|
180
167
|
case 1:
|
|
181
168
|
case "end":
|
|
182
169
|
return _context.stop();
|
|
@@ -185,56 +172,40 @@ var UploadList = function UploadList(props) {
|
|
|
185
172
|
}, _callee);
|
|
186
173
|
}));
|
|
187
174
|
};
|
|
188
|
-
|
|
189
175
|
_iterator = _createForOfIteratorHelper(items);
|
|
190
176
|
_context2.prev = 4;
|
|
191
|
-
|
|
192
177
|
_iterator.s();
|
|
193
|
-
|
|
194
178
|
case 6:
|
|
195
179
|
if ((_step = _iterator.n()).done) {
|
|
196
180
|
_context2.next = 15;
|
|
197
181
|
break;
|
|
198
182
|
}
|
|
199
|
-
|
|
200
183
|
file = _step.value;
|
|
201
|
-
|
|
202
184
|
if (!file.originFileObj) {
|
|
203
185
|
_context2.next = 13;
|
|
204
186
|
break;
|
|
205
187
|
}
|
|
206
|
-
|
|
207
188
|
_context2.next = 11;
|
|
208
189
|
return readerFileAsDataUrl(file);
|
|
209
|
-
|
|
210
190
|
case 11:
|
|
211
191
|
dataUrl = _context2.sent;
|
|
212
192
|
file.dataUrl = dataUrl;
|
|
213
|
-
|
|
214
193
|
case 13:
|
|
215
194
|
_context2.next = 6;
|
|
216
195
|
break;
|
|
217
|
-
|
|
218
196
|
case 15:
|
|
219
197
|
_context2.next = 20;
|
|
220
198
|
break;
|
|
221
|
-
|
|
222
199
|
case 17:
|
|
223
200
|
_context2.prev = 17;
|
|
224
201
|
_context2.t0 = _context2["catch"](4);
|
|
225
|
-
|
|
226
202
|
_iterator.e(_context2.t0);
|
|
227
|
-
|
|
228
203
|
case 20:
|
|
229
204
|
_context2.prev = 20;
|
|
230
|
-
|
|
231
205
|
_iterator.f();
|
|
232
|
-
|
|
233
206
|
return _context2.finish(20);
|
|
234
|
-
|
|
235
207
|
case 23:
|
|
236
208
|
setUploadList(_toConsumableArray(items));
|
|
237
|
-
|
|
238
209
|
case 24:
|
|
239
210
|
case "end":
|
|
240
211
|
return _context2.stop();
|
|
@@ -243,7 +214,6 @@ var UploadList = function UploadList(props) {
|
|
|
243
214
|
}, _callee2, null, [[4, 17, 20, 23]]);
|
|
244
215
|
}));
|
|
245
216
|
};
|
|
246
|
-
|
|
247
217
|
useEffect(function () {
|
|
248
218
|
if (listType === 'picture-card') handleFileFormat();else setUploadList(function (pre) {
|
|
249
219
|
if (items) return _toConsumableArray(items);
|
|
@@ -266,6 +236,7 @@ var UploadList = function UploadList(props) {
|
|
|
266
236
|
var css_248z$3 = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2021/11/15 下午7:12\n* @description\n*/\n/**\n* @author Hanz\n* @date 2021/10/20 下午2:08\n* @description color\n*/\n.paraui-v3-upload-error {\n position: absolute;\n left: 0;\n top: 100%;\n margin-top: 12px;\n display: inline-flex;\n align-items: center;\n padding: 0 12px;\n line-height: 28px;\n background-color: #FDF6F5;\n color: rgb(235, 96, 84);\n font-size: 14px;\n white-space: nowrap;\n border-radius: 4px;\n z-index: 1;\n}\n.paraui-v3-upload-error svg {\n margin-right: 4px;\n font-size: inherit;\n color: inherit;\n}\n.paraui-v3-upload-error-image {\n margin-top: 8px;\n}\n.paraui-v3-upload-error-drag {\n top: 20px;\n left: 50%;\n margin-top: 0;\n transform: translateX(-50%);\n}";
|
|
267
237
|
styleInject(css_248z$3);
|
|
268
238
|
|
|
239
|
+
//error tip
|
|
269
240
|
var ErrorTip = function ErrorTip(props) {
|
|
270
241
|
return jsxs("div", Object.assign({
|
|
271
242
|
className: clsx("".concat($prefixCls, "-upload-error"), props.className)
|
|
@@ -306,81 +277,67 @@ var localeJson = {
|
|
|
306
277
|
var css_248z$2 = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2021/11/11 下午7:31\n* @description\n*/\n/**\n* @author Hanz\n* @date 2021/10/20 下午2:08\n* @description color\n*/\n.paraui-v3-upload-image {\n display: inline-flex;\n align-items: center;\n}\n.paraui-v3-upload-image .upload-image-select {\n position: relative;\n width: 100px;\n height: 100px;\n background-color: rgba(171, 176, 185, 0.12);\n border-radius: 4px;\n cursor: pointer;\n transition: 0.3s;\n}\n.paraui-v3-upload-image .upload-image-select-loading {\n pointer-events: none;\n}\n.paraui-v3-upload-image .upload-image-select .component-upload {\n display: inline-block;\n width: 100%;\n height: 100%;\n}\n.paraui-v3-upload-image .upload-image-select:hover {\n background-color: rgba(54, 102, 214, 0.05);\n}\n.paraui-v3-upload-image .upload-image-select:hover .upload-image-picture-card {\n color: rgb(54, 102, 214);\n}\n.paraui-v3-upload-image .upload-image-picture-card {\n display: inline-flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n align-items: center;\n justify-content: center;\n color: rgb(46, 55, 67);\n font-size: 14px;\n}\n.paraui-v3-upload-image .upload-image-picture-card .upload-img-wrapper {\n position: relative;\n width: 100%;\n height: 100%;\n cursor: default;\n}\n.paraui-v3-upload-image .upload-image-picture-card .upload-img-wrapper img {\n width: 100%;\n height: 100%;\n border-radius: 4px;\n}\n.paraui-v3-upload-image .upload-image-picture-card .upload-img-wrapper::before {\n content: \" \";\n position: absolute;\n left: 0;\n right: 0;\n bottom: 0;\n top: 0;\n background-color: rgba(46, 55, 67, 0.7);\n border-radius: 4px;\n opacity: 0;\n transition: 0.3s;\n}\n.paraui-v3-upload-image .upload-image-picture-card .upload-img-wrapper-name {\n position: absolute;\n bottom: 0;\n left: 0;\n width: 100%;\n padding: 0 10px;\n font-size: 12px;\n line-height: 24px;\n text-align: center;\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n background-color: rgba(46, 55, 67, 0.7);\n border-radius: 0 0 4px 4px;\n color: rgb(255, 255, 255);\n transition: 0.3s;\n}\n.paraui-v3-upload-image .upload-image-picture-card .upload-img-wrapper-action {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n opacity: 0;\n line-height: 0;\n cursor: pointer;\n transition: 0.3s;\n}\n.paraui-v3-upload-image .upload-image-picture-card .upload-img-wrapper-action svg {\n color: rgb(255, 255, 255);\n}\n.paraui-v3-upload-image .upload-image-picture-card .upload-img-wrapper:hover::before {\n opacity: 1;\n}\n.paraui-v3-upload-image .upload-image-picture-card .upload-img-wrapper:hover .upload-img-wrapper-name {\n opacity: 0;\n}\n.paraui-v3-upload-image .upload-image-picture-card .upload-img-wrapper:hover .upload-img-wrapper-action {\n opacity: 1;\n}\n.paraui-v3-upload-image .upload-image-picture-card .upload-image-icon {\n color: rgb(54, 102, 214);\n font-size: 30px;\n}\n.paraui-v3-upload-image .upload-image-picture-card .upload-image-loading {\n color: rgb(54, 102, 214);\n font-size: 30px;\n animation: imageLoadingCircle 1s infinite linear;\n}\n.paraui-v3-upload-image .upload-image-picture-card .upload-image-text {\n margin-top: 6px;\n color: inherit;\n transition: 0.3s;\n}\n.paraui-v3-upload-image .upload-image-picture-card .upload-image-text-loading {\n color: rgb(54, 102, 214);\n}\n@keyframes imageLoadingCircle {\n 100% {\n transform: rotate(360deg);\n }\n}";
|
|
307
278
|
styleInject(css_248z$2);
|
|
308
279
|
|
|
280
|
+
//ImageUpload
|
|
309
281
|
var ImageUpload = function ImageUpload(props) {
|
|
310
282
|
var className = props.className,
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
283
|
+
style = props.style,
|
|
284
|
+
_onStart = props.onStart,
|
|
285
|
+
_onSuccess = props.onSuccess,
|
|
286
|
+
_onError = props.onError,
|
|
287
|
+
_onProgress = props.onProgress,
|
|
288
|
+
onRemove = props.onRemove,
|
|
289
|
+
_beforeUpload = props.beforeUpload,
|
|
290
|
+
onChange = props.onChange,
|
|
291
|
+
_props$defaultFileLis = props.defaultFileList,
|
|
292
|
+
defaultFileList = _props$defaultFileLis === void 0 ? [] : _props$defaultFileLis,
|
|
293
|
+
fileList = props.fileList,
|
|
294
|
+
_props$showUploadList = props.showUploadList,
|
|
295
|
+
showUploadList = _props$showUploadList === void 0 ? true : _props$showUploadList,
|
|
296
|
+
maxCount = props.maxCount,
|
|
297
|
+
_props$children = props.children,
|
|
298
|
+
children = _props$children === void 0 ? null : _props$children,
|
|
299
|
+
itemRender = props.itemRender,
|
|
300
|
+
_props$showUploadErro = props.showUploadError,
|
|
301
|
+
showUploadError = _props$showUploadErro === void 0 ? true : _props$showUploadErro,
|
|
302
|
+
_props$stash = props.stash,
|
|
303
|
+
stash = _props$stash === void 0 ? false : _props$stash,
|
|
304
|
+
_props$uploading = props.uploading,
|
|
305
|
+
uploading = _props$uploading === void 0 ? true : _props$uploading,
|
|
306
|
+
_props$showLoading = props.showLoading,
|
|
307
|
+
loading = _props$showLoading === void 0 ? true : _props$showLoading,
|
|
308
|
+
defaultImage = props.defaultImage,
|
|
309
|
+
restProps = __rest(props, ["className", "style", "onStart", "onSuccess", "onError", "onProgress", "onRemove", "beforeUpload", "onChange", "defaultFileList", "fileList", "showUploadList", "maxCount", "children", "itemRender", "showUploadError", "stash", "uploading", "showLoading", "defaultImage"]);
|
|
339
310
|
var intl = useFormatMessage('Upload', localeJson);
|
|
340
|
-
|
|
341
311
|
var _useState = useState(defaultFileList),
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
312
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
313
|
+
uploadFileList = _useState2[0],
|
|
314
|
+
setUploadFileList = _useState2[1]; //文件列表
|
|
347
315
|
var _useState3 = useState(false),
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
316
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
317
|
+
showLoading = _useState4[0],
|
|
318
|
+
setShowLoading = _useState4[1]; //upload loading
|
|
353
319
|
var _useState5 = useState(false),
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
320
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
321
|
+
errTip = _useState6[0],
|
|
322
|
+
setErrTip = _useState6[1]; //upload error tip
|
|
359
323
|
var _useState7 = useState({
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
324
|
+
imageUrl: ''
|
|
325
|
+
}),
|
|
326
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
327
|
+
avatar = _useState8[0],
|
|
328
|
+
setAvatar = _useState8[1]; //不显示列表时上传头像
|
|
367
329
|
var _ref = typeof showUploadList === 'boolean' ? {} : showUploadList,
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
330
|
+
showRemoveIcon = _ref.showRemoveIcon,
|
|
331
|
+
removeIcon = _ref.removeIcon; //显示上传列表
|
|
372
332
|
var _ref2 = typeof showUploadError === 'boolean' ? {} : showUploadError,
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
333
|
+
_ref2$uploadErrorMsg = _ref2.uploadErrorMsg,
|
|
334
|
+
uploadErrorMsg = _ref2$uploadErrorMsg === void 0 ? intl({
|
|
335
|
+
id: 'uploadError'
|
|
336
|
+
}) : _ref2$uploadErrorMsg,
|
|
337
|
+
_ref2$leaveDelay = _ref2.leaveDelay,
|
|
338
|
+
leaveDelay = _ref2$leaveDelay === void 0 ? 2000 : _ref2$leaveDelay; //错误信息提示
|
|
381
339
|
var cropFileRef = useRef(); //裁剪文件
|
|
382
340
|
//复写属性
|
|
383
|
-
|
|
384
341
|
var overrideProps = Object.assign(Object.assign({
|
|
385
342
|
accept: 'image/*'
|
|
386
343
|
}, restProps), {
|
|
@@ -394,38 +351,29 @@ var ImageUpload = function ImageUpload(props) {
|
|
|
394
351
|
if (restProps.action && loading && uploading) setShowLoading(true);
|
|
395
352
|
_context.next = 3;
|
|
396
353
|
return _beforeUpload === null || _beforeUpload === void 0 ? void 0 : _beforeUpload(file, fileList);
|
|
397
|
-
|
|
398
354
|
case 3:
|
|
399
355
|
result = _context.sent;
|
|
400
|
-
|
|
401
356
|
if (!(result === false)) {
|
|
402
357
|
_context.next = 9;
|
|
403
358
|
break;
|
|
404
359
|
}
|
|
405
|
-
|
|
406
360
|
setShowLoading(false);
|
|
407
361
|
return _context.abrupt("return", false);
|
|
408
|
-
|
|
409
362
|
case 9:
|
|
410
363
|
if (!(_typeof(result) === 'object' && result)) {
|
|
411
364
|
_context.next = 16;
|
|
412
365
|
break;
|
|
413
366
|
}
|
|
414
|
-
|
|
415
367
|
if (!(result instanceof File || result instanceof Blob)) {
|
|
416
368
|
_context.next = 12;
|
|
417
369
|
break;
|
|
418
370
|
}
|
|
419
|
-
|
|
420
371
|
return _context.abrupt("return", result);
|
|
421
|
-
|
|
422
372
|
case 12:
|
|
423
373
|
cropFileRef.current = result.cropFile;
|
|
424
374
|
return _context.abrupt("return", result.isUpload);
|
|
425
|
-
|
|
426
375
|
case 16:
|
|
427
376
|
return _context.abrupt("return", true);
|
|
428
|
-
|
|
429
377
|
case 17:
|
|
430
378
|
case "end":
|
|
431
379
|
return _context.stop();
|
|
@@ -457,10 +405,8 @@ var ImageUpload = function ImageUpload(props) {
|
|
|
457
405
|
if (cropFileRef.current) {
|
|
458
406
|
var idx = fileList.findIndex(function (_) {
|
|
459
407
|
var _a;
|
|
460
|
-
|
|
461
408
|
return _.file.uid === ((_a = cropFileRef.current) === null || _a === void 0 ? void 0 : _a.uid);
|
|
462
409
|
});
|
|
463
|
-
|
|
464
410
|
if (idx > -1) {
|
|
465
411
|
fileList.splice(idx, 1, {
|
|
466
412
|
file: cropFileRef.current,
|
|
@@ -468,7 +414,6 @@ var ImageUpload = function ImageUpload(props) {
|
|
|
468
414
|
});
|
|
469
415
|
}
|
|
470
416
|
}
|
|
471
|
-
|
|
472
417
|
var arr = fileList.map(function (_) {
|
|
473
418
|
return _.parsedFile || _.file;
|
|
474
419
|
});
|
|
@@ -476,8 +421,8 @@ var ImageUpload = function ImageUpload(props) {
|
|
|
476
421
|
onInternalChange(mList);
|
|
477
422
|
}
|
|
478
423
|
}
|
|
479
|
-
});
|
|
480
|
-
|
|
424
|
+
});
|
|
425
|
+
//内部变化
|
|
481
426
|
var onInternalChange = function onInternalChange(changedFileList) {
|
|
482
427
|
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee2() {
|
|
483
428
|
var cloneList, file, imageUrl;
|
|
@@ -486,44 +431,35 @@ var ImageUpload = function ImageUpload(props) {
|
|
|
486
431
|
switch (_context2.prev = _context2.next) {
|
|
487
432
|
case 0:
|
|
488
433
|
cloneList = _toConsumableArray(changedFileList);
|
|
489
|
-
|
|
490
434
|
if (showUploadList) {
|
|
491
435
|
_context2.next = 13;
|
|
492
436
|
break;
|
|
493
437
|
}
|
|
494
|
-
|
|
495
438
|
//不显示上传列表
|
|
496
439
|
file = cloneList.slice(-1)[0];
|
|
497
|
-
|
|
498
440
|
if (!file) {
|
|
499
441
|
_context2.next = 11;
|
|
500
442
|
break;
|
|
501
443
|
}
|
|
502
|
-
|
|
503
444
|
_context2.next = 6;
|
|
504
445
|
return readerFileAsDataUrl(file);
|
|
505
|
-
|
|
506
446
|
case 6:
|
|
507
447
|
imageUrl = _context2.sent;
|
|
508
448
|
file.dataUrl = imageUrl;
|
|
509
449
|
avatar.imageUrl = imageUrl;
|
|
510
450
|
avatar.imageName = file.name;
|
|
511
451
|
setAvatar(Object.assign({}, avatar));
|
|
512
|
-
|
|
513
452
|
case 11:
|
|
514
453
|
onChange === null || onChange === void 0 ? void 0 : onChange([file]);
|
|
515
454
|
return _context2.abrupt("return");
|
|
516
|
-
|
|
517
455
|
case 13:
|
|
518
456
|
if (maxCount === 1) {
|
|
519
457
|
cloneList = cloneList.slice(-1);
|
|
520
458
|
} else if (maxCount) {
|
|
521
459
|
cloneList = cloneList.slice(0, maxCount);
|
|
522
460
|
}
|
|
523
|
-
|
|
524
461
|
onChange === null || onChange === void 0 ? void 0 : onChange(cloneList);
|
|
525
462
|
setUploadFileList(cloneList);
|
|
526
|
-
|
|
527
463
|
case 16:
|
|
528
464
|
case "end":
|
|
529
465
|
return _context2.stop();
|
|
@@ -531,12 +467,10 @@ var ImageUpload = function ImageUpload(props) {
|
|
|
531
467
|
}
|
|
532
468
|
}, _callee2);
|
|
533
469
|
}));
|
|
534
|
-
};
|
|
535
|
-
|
|
536
|
-
|
|
470
|
+
};
|
|
471
|
+
//更新文件列表
|
|
537
472
|
var updateFileList = function updateFileList(file) {
|
|
538
473
|
var cloneList = _toConsumableArray(uploadFileList);
|
|
539
|
-
|
|
540
474
|
var fileObj = Object.assign(Object.assign({}, file), {
|
|
541
475
|
lastModified: file.lastModified,
|
|
542
476
|
lastModifiedDate: file.lastModifiedDate,
|
|
@@ -547,12 +481,10 @@ var ImageUpload = function ImageUpload(props) {
|
|
|
547
481
|
originFileObj: file
|
|
548
482
|
});
|
|
549
483
|
return cloneList.concat(fileObj);
|
|
550
|
-
};
|
|
551
|
-
|
|
552
|
-
|
|
484
|
+
};
|
|
485
|
+
//合并文件列表
|
|
553
486
|
var mergedFileList = function mergedFileList(fileList) {
|
|
554
487
|
var cloneList = _toConsumableArray(uploadFileList);
|
|
555
|
-
|
|
556
488
|
var newFileList = fileList.map(function (file) {
|
|
557
489
|
return Object.assign(Object.assign({}, file), {
|
|
558
490
|
lastModified: file.lastModified,
|
|
@@ -565,9 +497,8 @@ var ImageUpload = function ImageUpload(props) {
|
|
|
565
497
|
});
|
|
566
498
|
});
|
|
567
499
|
return cloneList.concat(newFileList);
|
|
568
|
-
};
|
|
569
|
-
|
|
570
|
-
|
|
500
|
+
};
|
|
501
|
+
//删除文件
|
|
571
502
|
var handleRemove = function handleRemove(file) {
|
|
572
503
|
Promise.resolve(typeof onRemove === 'function' ? onRemove(file) : onRemove).then(function (ret) {
|
|
573
504
|
// Prevent removing file
|
|
@@ -578,9 +509,8 @@ var ImageUpload = function ImageUpload(props) {
|
|
|
578
509
|
if (idx > -1) uploadFileList.splice(idx, 1);
|
|
579
510
|
onInternalChange(uploadFileList);
|
|
580
511
|
});
|
|
581
|
-
};
|
|
582
|
-
|
|
583
|
-
|
|
512
|
+
};
|
|
513
|
+
//读取dataUrl
|
|
584
514
|
var readerFileAsDataUrl = function readerFileAsDataUrl(file) {
|
|
585
515
|
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee3() {
|
|
586
516
|
return regenerator.wrap(function _callee3$(_context3) {
|
|
@@ -589,16 +519,13 @@ var ImageUpload = function ImageUpload(props) {
|
|
|
589
519
|
case 0:
|
|
590
520
|
return _context3.abrupt("return", new Promise(function (resolve) {
|
|
591
521
|
var fileReader = new FileReader();
|
|
592
|
-
|
|
593
522
|
if (file.originFileObj) {
|
|
594
523
|
fileReader.onload = function () {
|
|
595
524
|
resolve(fileReader.result);
|
|
596
525
|
};
|
|
597
|
-
|
|
598
526
|
fileReader.readAsDataURL(file.originFileObj);
|
|
599
527
|
} else resolve('');
|
|
600
528
|
}));
|
|
601
|
-
|
|
602
529
|
case 1:
|
|
603
530
|
case "end":
|
|
604
531
|
return _context3.stop();
|
|
@@ -606,9 +533,8 @@ var ImageUpload = function ImageUpload(props) {
|
|
|
606
533
|
}
|
|
607
534
|
}, _callee3);
|
|
608
535
|
}));
|
|
609
|
-
};
|
|
610
|
-
|
|
611
|
-
|
|
536
|
+
};
|
|
537
|
+
//显示错误提示
|
|
612
538
|
var showErrTip = function showErrTip(flag) {
|
|
613
539
|
setErrTip(flag);
|
|
614
540
|
if (leaveDelay < 0) return;
|
|
@@ -616,7 +542,6 @@ var ImageUpload = function ImageUpload(props) {
|
|
|
616
542
|
setErrTip(false);
|
|
617
543
|
}, leaveDelay);
|
|
618
544
|
};
|
|
619
|
-
|
|
620
545
|
useEffect(function () {
|
|
621
546
|
if (fileList) {
|
|
622
547
|
setUploadFileList(_toConsumableArray(fileList));
|
|
@@ -626,8 +551,8 @@ var ImageUpload = function ImageUpload(props) {
|
|
|
626
551
|
if (defaultImage) {
|
|
627
552
|
setAvatar(Object.assign({}, defaultImage));
|
|
628
553
|
}
|
|
629
|
-
}, [defaultImage]);
|
|
630
|
-
|
|
554
|
+
}, [defaultImage]);
|
|
555
|
+
//渲染上传列表
|
|
631
556
|
var renderUploadList = function renderUploadList() {
|
|
632
557
|
return showUploadList && jsx(UploadList, {
|
|
633
558
|
listType: 'picture-card',
|
|
@@ -637,12 +562,10 @@ var ImageUpload = function ImageUpload(props) {
|
|
|
637
562
|
onRemove: handleRemove,
|
|
638
563
|
itemRender: itemRender
|
|
639
564
|
});
|
|
640
|
-
};
|
|
641
|
-
|
|
642
|
-
|
|
565
|
+
};
|
|
566
|
+
//渲染内容
|
|
643
567
|
var renderUploadContent = function renderUploadContent() {
|
|
644
568
|
var _a;
|
|
645
|
-
|
|
646
569
|
if (!showUploadList && avatar.imageUrl && !showLoading) {
|
|
647
570
|
return jsxs("div", Object.assign({
|
|
648
571
|
className: 'upload-img-wrapper'
|
|
@@ -661,7 +584,6 @@ var ImageUpload = function ImageUpload(props) {
|
|
|
661
584
|
}))]
|
|
662
585
|
}));
|
|
663
586
|
}
|
|
664
|
-
|
|
665
587
|
return jsxs(Fragment, {
|
|
666
588
|
children: [showLoading ? jsx(LoadingIcon, {
|
|
667
589
|
className: 'upload-image-loading'
|
|
@@ -675,9 +597,8 @@ var ImageUpload = function ImageUpload(props) {
|
|
|
675
597
|
}) : children
|
|
676
598
|
}))]
|
|
677
599
|
});
|
|
678
|
-
};
|
|
679
|
-
|
|
680
|
-
|
|
600
|
+
};
|
|
601
|
+
//渲染上传控件
|
|
681
602
|
var renderUploadSelector = function renderUploadSelector() {
|
|
682
603
|
return jsxs("div", Object.assign({
|
|
683
604
|
className: clsx('upload-image-select', showLoading && 'upload-image-select-loading')
|
|
@@ -696,7 +617,6 @@ var ImageUpload = function ImageUpload(props) {
|
|
|
696
617
|
})]
|
|
697
618
|
}));
|
|
698
619
|
};
|
|
699
|
-
|
|
700
620
|
return jsxs("div", Object.assign({
|
|
701
621
|
className: clsx("".concat($prefixCls, "-upload-image"), className),
|
|
702
622
|
style: style
|
|
@@ -705,6 +625,7 @@ var ImageUpload = function ImageUpload(props) {
|
|
|
705
625
|
}));
|
|
706
626
|
};
|
|
707
627
|
|
|
628
|
+
//Dragger upload
|
|
708
629
|
var Dragger = function Dragger(props) {
|
|
709
630
|
return jsx(Upload, Object.assign({}, props, {
|
|
710
631
|
type: 'drag'
|
|
@@ -721,47 +642,38 @@ var MAX_ROTATE = 180;
|
|
|
721
642
|
|
|
722
643
|
var EasyCrop = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
723
644
|
var cropperRef = props.cropperRef,
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
645
|
+
image = props.image,
|
|
646
|
+
aspect = props.aspect,
|
|
647
|
+
shape = props.shape,
|
|
648
|
+
grid = props.grid,
|
|
649
|
+
zoom = props.zoom,
|
|
650
|
+
rotate = props.rotate,
|
|
651
|
+
minZoom = props.minZoom,
|
|
652
|
+
maxZoom = props.maxZoom,
|
|
653
|
+
fixedCropSize = props.fixedCropSize,
|
|
654
|
+
cropperProps = props.cropperProps;
|
|
735
655
|
var _useState = useState({
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
656
|
+
x: 0,
|
|
657
|
+
y: 0
|
|
658
|
+
}),
|
|
659
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
660
|
+
crop = _useState2[0],
|
|
661
|
+
onCropChange = _useState2[1]; //裁剪变化
|
|
744
662
|
var _useState3 = useState({
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
663
|
+
width: 0,
|
|
664
|
+
height: 0
|
|
665
|
+
}),
|
|
666
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
667
|
+
cropSize = _useState4[0],
|
|
668
|
+
setCropSize = _useState4[1]; //裁剪大小
|
|
753
669
|
var _useState5 = useState(INIT_ZOOM),
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
670
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
671
|
+
zoomVal = _useState6[0],
|
|
672
|
+
setZoomVal = _useState6[1]; //缩放值
|
|
759
673
|
var _useState7 = useState(INIT_ROTATE),
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
674
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
675
|
+
rotateVal = _useState8[0],
|
|
676
|
+
setRotateVal = _useState8[1]; //旋转值
|
|
765
677
|
var cropPixelsRef = useRef({
|
|
766
678
|
width: 0,
|
|
767
679
|
height: 0,
|
|
@@ -769,13 +681,11 @@ var EasyCrop = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
769
681
|
y: 0
|
|
770
682
|
}); //裁剪区域
|
|
771
683
|
//media 加载完成回调
|
|
772
|
-
|
|
773
684
|
var onMediaLoaded = useCallback(function (mediaSize) {
|
|
774
685
|
if (fixedCropSize) return;
|
|
775
686
|
var width = mediaSize.width,
|
|
776
|
-
|
|
687
|
+
height = mediaSize.height;
|
|
777
688
|
var ratioWidth = height * aspect;
|
|
778
|
-
|
|
779
689
|
if (width > ratioWidth) {
|
|
780
690
|
setCropSize({
|
|
781
691
|
width: ratioWidth,
|
|
@@ -787,12 +697,12 @@ var EasyCrop = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
787
697
|
height: width / aspect
|
|
788
698
|
});
|
|
789
699
|
}
|
|
790
|
-
}, [aspect]);
|
|
791
|
-
|
|
700
|
+
}, [aspect]);
|
|
701
|
+
//裁剪完成回调
|
|
792
702
|
var onCropComplete = useCallback(function (croppedArea, croppedAreaPixels) {
|
|
793
703
|
cropPixelsRef.current = croppedAreaPixels;
|
|
794
|
-
}, []);
|
|
795
|
-
|
|
704
|
+
}, []);
|
|
705
|
+
//ref 暴露方法
|
|
796
706
|
useImperativeHandle(ref, function () {
|
|
797
707
|
return {
|
|
798
708
|
rotateVal: rotateVal,
|
|
@@ -880,67 +790,64 @@ var EasyCrop$1 = /*#__PURE__*/memo(EasyCrop);
|
|
|
880
790
|
var css_248z$1 = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2022/4/20 下午4:44\n* @description\n*/\n/**\n* @author Hanz\n* @date 2021/10/20 下午2:08\n* @description color\n*/\n.paraui-v3-img-crop-modal .paraui-v3-img-crop-container {\n position: relative;\n width: 100%;\n height: 40vh;\n}\n.paraui-v3-img-crop-modal .paraui-v3-img-crop-control {\n display: flex;\n align-items: center;\n width: 60%;\n margin-left: auto;\n margin-right: auto;\n}\n.paraui-v3-img-crop-modal .paraui-v3-img-crop-control:first-of-type {\n margin-top: 16px;\n}\n.paraui-v3-img-crop-modal .paraui-v3-img-crop-control:last-of-type {\n margin-bottom: -8px;\n}\n.paraui-v3-img-crop-modal .paraui-v3-img-crop-control button {\n display: flex;\n justify-content: center;\n align-items: center;\n width: 34px;\n height: 34px;\n padding: 0;\n font-style: normal;\n background: transparent;\n border: 0;\n outline: 0;\n cursor: pointer;\n}\n.paraui-v3-img-crop-modal .paraui-v3-img-crop-control button[disabled] {\n cursor: default;\n}\n.paraui-v3-img-crop-modal .paraui-v3-img-crop-control button + div:only-of-type {\n flex: 1;\n margin: 0 8px;\n}\n.paraui-v3-img-crop-modal .paraui-v3-img-crop-control-zoom button {\n font-size: 18px;\n}\n.paraui-v3-img-crop-modal .paraui-v3-img-crop-control-rotate button {\n font-size: 16px;\n}\n.paraui-v3-img-crop-modal .paraui-v3-img-crop-control-rotate button:first-of-type {\n transform: rotate(-20deg);\n}\n.paraui-v3-img-crop-modal .paraui-v3-img-crop-control-rotate button:last-of-type {\n transform: rotate(20deg);\n}";
|
|
881
791
|
styleInject(css_248z$1);
|
|
882
792
|
|
|
793
|
+
//图片裁剪组件
|
|
883
794
|
var ImgCrop = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
884
795
|
var _props$aspect = props.aspect,
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
796
|
+
aspect = _props$aspect === void 0 ? 1 : _props$aspect,
|
|
797
|
+
_props$shape = props.shape,
|
|
798
|
+
shape = _props$shape === void 0 ? 'rect' : _props$shape,
|
|
799
|
+
_props$grid = props.grid,
|
|
800
|
+
grid = _props$grid === void 0 ? false : _props$grid,
|
|
801
|
+
_props$quality = props.quality,
|
|
802
|
+
quality = _props$quality === void 0 ? 0.4 : _props$quality,
|
|
803
|
+
_props$fillColor = props.fillColor,
|
|
804
|
+
fillColor = _props$fillColor === void 0 ? 'transparent' : _props$fillColor,
|
|
805
|
+
_props$zoom = props.zoom,
|
|
806
|
+
zoom = _props$zoom === void 0 ? true : _props$zoom,
|
|
807
|
+
_props$rotate = props.rotate,
|
|
808
|
+
rotate = _props$rotate === void 0 ? false : _props$rotate,
|
|
809
|
+
_props$minZoom = props.minZoom,
|
|
810
|
+
minZoom = _props$minZoom === void 0 ? 1 : _props$minZoom,
|
|
811
|
+
_props$maxZoom = props.maxZoom,
|
|
812
|
+
maxZoom = _props$maxZoom === void 0 ? 3 : _props$maxZoom,
|
|
813
|
+
modalTitle = props.modalTitle,
|
|
814
|
+
modalWidth = props.modalWidth,
|
|
815
|
+
modalOk = props.modalOk,
|
|
816
|
+
modalCancel = props.modalCancel,
|
|
817
|
+
onModalOk = props.onModalOk,
|
|
818
|
+
onModalCancel = props.onModalCancel,
|
|
819
|
+
beforeCrop = props.beforeCrop,
|
|
820
|
+
onUploadFail = props.onUploadFail,
|
|
821
|
+
cropperProps = props.cropperProps,
|
|
822
|
+
children = props.children,
|
|
823
|
+
_props$fixedCropSize = props.fixedCropSize,
|
|
824
|
+
fixedCropSize = _props$fixedCropSize === void 0 ? {
|
|
825
|
+
width: 120,
|
|
826
|
+
height: 120
|
|
827
|
+
} : _props$fixedCropSize;
|
|
917
828
|
var intl = useFormatMessage('Upload', localeJson);
|
|
918
|
-
|
|
919
829
|
var _useState = useState(''),
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
830
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
831
|
+
image = _useState2[0],
|
|
832
|
+
setImage = _useState2[1];
|
|
924
833
|
var fileRef = useRef();
|
|
925
834
|
var beforeUploadRef = useRef();
|
|
926
835
|
var resolveRef = useRef();
|
|
927
|
-
var rejectRef = useRef();
|
|
928
|
-
|
|
836
|
+
var rejectRef = useRef();
|
|
837
|
+
//存储回调
|
|
929
838
|
var cbRef = useRef({});
|
|
930
839
|
cbRef.current.onModalOk = onModalOk;
|
|
931
840
|
cbRef.current.onModalCancel = onModalCancel;
|
|
932
841
|
cbRef.current.beforeCrop = beforeCrop;
|
|
933
842
|
cbRef.current.onUploadFail = onUploadFail;
|
|
934
|
-
var easyCropRef = useRef({});
|
|
935
|
-
|
|
843
|
+
var easyCropRef = useRef({});
|
|
844
|
+
//上传组件
|
|
936
845
|
var uploadComponent = useMemo(function () {
|
|
937
846
|
var upload = Array.isArray(children) ? children[0] : children;
|
|
938
|
-
|
|
939
847
|
var _a = upload.props,
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
848
|
+
beforeUpload = _a.beforeUpload,
|
|
849
|
+
accept = _a.accept,
|
|
850
|
+
restUploadProps = __rest(_a, ["beforeUpload", "accept"]);
|
|
944
851
|
beforeUploadRef.current = beforeUpload;
|
|
945
852
|
return Object.assign(Object.assign({}, upload), {
|
|
946
853
|
props: Object.assign(Object.assign({}, restUploadProps), {
|
|
@@ -954,35 +861,26 @@ var ImgCrop = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
954
861
|
switch (_context.prev = _context.next) {
|
|
955
862
|
case 0:
|
|
956
863
|
_context.t0 = cbRef.current.beforeCrop;
|
|
957
|
-
|
|
958
864
|
if (!_context.t0) {
|
|
959
865
|
_context.next = 5;
|
|
960
866
|
break;
|
|
961
867
|
}
|
|
962
|
-
|
|
963
868
|
_context.next = 4;
|
|
964
869
|
return cbRef.current.beforeCrop(file, fileList);
|
|
965
|
-
|
|
966
870
|
case 4:
|
|
967
871
|
_context.t0 = !_context.sent;
|
|
968
|
-
|
|
969
872
|
case 5:
|
|
970
873
|
if (!_context.t0) {
|
|
971
874
|
_context.next = 8;
|
|
972
875
|
break;
|
|
973
876
|
}
|
|
974
|
-
|
|
975
877
|
reject();
|
|
976
878
|
return _context.abrupt("return");
|
|
977
|
-
|
|
978
879
|
case 8:
|
|
979
880
|
fileRef.current = file;
|
|
980
|
-
|
|
981
881
|
resolveRef.current = function (newFile) {
|
|
982
882
|
var flag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
983
|
-
|
|
984
883
|
var _a, _b;
|
|
985
|
-
|
|
986
884
|
(_b = (_a = cbRef.current).onModalOk) === null || _b === void 0 ? void 0 : _b.call(_a, newFile);
|
|
987
885
|
if (!flag) return resolve({
|
|
988
886
|
cropFile: newFile,
|
|
@@ -990,20 +888,16 @@ var ImgCrop = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
990
888
|
});
|
|
991
889
|
resolve(newFile);
|
|
992
890
|
};
|
|
993
|
-
|
|
994
891
|
rejectRef.current = function (uploadErr) {
|
|
995
892
|
var _a, _b;
|
|
996
|
-
|
|
997
893
|
(_b = (_a = cbRef.current).onUploadFail) === null || _b === void 0 ? void 0 : _b.call(_a, uploadErr);
|
|
998
894
|
reject(uploadErr);
|
|
999
895
|
};
|
|
1000
|
-
|
|
1001
896
|
reader = new FileReader();
|
|
1002
897
|
reader.addEventListener('load', function () {
|
|
1003
898
|
return typeof reader.result === 'string' && setImage(reader.result);
|
|
1004
899
|
});
|
|
1005
900
|
reader.readAsDataURL(file);
|
|
1006
|
-
|
|
1007
901
|
case 14:
|
|
1008
902
|
case "end":
|
|
1009
903
|
return _context.stop();
|
|
@@ -1015,26 +909,23 @@ var ImgCrop = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1015
909
|
}
|
|
1016
910
|
})
|
|
1017
911
|
});
|
|
1018
|
-
}, [children]);
|
|
1019
|
-
|
|
912
|
+
}, [children]);
|
|
913
|
+
//modal 关闭后操作
|
|
1020
914
|
var onClose = function onClose() {
|
|
1021
915
|
setImage('');
|
|
1022
916
|
easyCropRef.current.setZoomVal(INIT_ZOOM);
|
|
1023
917
|
easyCropRef.current.setRotateVal(INIT_ROTATE);
|
|
1024
|
-
};
|
|
1025
|
-
|
|
1026
|
-
|
|
918
|
+
};
|
|
919
|
+
//modal cancel
|
|
1027
920
|
var onCancel = useCallback(function () {
|
|
1028
921
|
var _a, _b;
|
|
1029
|
-
|
|
1030
922
|
(_b = (_a = cbRef.current).onModalCancel) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
1031
923
|
onClose();
|
|
1032
|
-
}, []);
|
|
1033
|
-
|
|
924
|
+
}, []);
|
|
925
|
+
//modal ok
|
|
1034
926
|
var onOk = useCallback(function () {
|
|
1035
927
|
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee3() {
|
|
1036
928
|
var canvas, ctx, imgSource, _easyCropRef$current$, cropWidth, cropHeight, cropX, cropY, imgWidth, imgHeight, angle, sine, cosine, squareWidth, squareHeight, squareHalfWidth, squareHalfHeight, imgX, imgY, imgData, changeImageSizeAfterCrop, _fileRef$current, type, name, uid, idx, onBlob;
|
|
1037
|
-
|
|
1038
929
|
return regenerator.wrap(function _callee3$(_context3) {
|
|
1039
930
|
while (1) {
|
|
1040
931
|
switch (_context3.prev = _context3.next) {
|
|
@@ -1044,11 +935,9 @@ var ImgCrop = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1044
935
|
ctx = canvas.getContext('2d');
|
|
1045
936
|
imgSource = document.querySelector(".".concat(PREFIX, "-media"));
|
|
1046
937
|
_easyCropRef$current$ = easyCropRef.current.cropPixelsRef.current, cropWidth = _easyCropRef$current$.width, cropHeight = _easyCropRef$current$.height, cropX = _easyCropRef$current$.x, cropY = _easyCropRef$current$.y;
|
|
1047
|
-
|
|
1048
938
|
if (rotate && easyCropRef.current.rotateVal !== INIT_ROTATE) {
|
|
1049
939
|
imgWidth = imgSource.naturalWidth, imgHeight = imgSource.naturalHeight;
|
|
1050
940
|
angle = easyCropRef.current.rotateVal * (Math.PI / 180); // get container for rotated image
|
|
1051
|
-
|
|
1052
941
|
sine = Math.abs(Math.sin(angle));
|
|
1053
942
|
cosine = Math.abs(Math.cos(angle));
|
|
1054
943
|
squareWidth = imgWidth * cosine + imgHeight * sine;
|
|
@@ -1056,18 +945,18 @@ var ImgCrop = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1056
945
|
canvas.width = squareWidth;
|
|
1057
946
|
canvas.height = squareHeight;
|
|
1058
947
|
ctx.fillStyle = fillColor;
|
|
1059
|
-
ctx.fillRect(0, 0, squareWidth, squareHeight);
|
|
1060
|
-
|
|
948
|
+
ctx.fillRect(0, 0, squareWidth, squareHeight);
|
|
949
|
+
// rotate container
|
|
1061
950
|
squareHalfWidth = squareWidth / 2;
|
|
1062
951
|
squareHalfHeight = squareHeight / 2;
|
|
1063
952
|
ctx.translate(squareHalfWidth, squareHalfHeight);
|
|
1064
953
|
ctx.rotate(angle);
|
|
1065
|
-
ctx.translate(-squareHalfWidth, -squareHalfHeight);
|
|
1066
|
-
|
|
954
|
+
ctx.translate(-squareHalfWidth, -squareHalfHeight);
|
|
955
|
+
// draw rotated image
|
|
1067
956
|
imgX = (squareWidth - imgWidth) / 2;
|
|
1068
957
|
imgY = (squareHeight - imgHeight) / 2;
|
|
1069
|
-
ctx.drawImage(imgSource, 0, 0, imgWidth, imgHeight, imgX, imgY, imgWidth, imgHeight);
|
|
1070
|
-
|
|
958
|
+
ctx.drawImage(imgSource, 0, 0, imgWidth, imgHeight, imgX, imgY, imgWidth, imgHeight);
|
|
959
|
+
// crop rotated image
|
|
1071
960
|
imgData = ctx.getImageData(0, 0, squareWidth, squareHeight);
|
|
1072
961
|
canvas.width = cropWidth;
|
|
1073
962
|
canvas.height = cropHeight;
|
|
@@ -1078,21 +967,18 @@ var ImgCrop = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1078
967
|
ctx.fillStyle = fillColor;
|
|
1079
968
|
ctx.fillRect(0, 0, cropWidth, cropHeight);
|
|
1080
969
|
ctx.drawImage(imgSource, cropX, cropY, cropWidth, cropHeight, 0, 0, cropWidth, cropHeight);
|
|
1081
|
-
}
|
|
1082
|
-
|
|
1083
|
-
|
|
970
|
+
}
|
|
971
|
+
//裁剪之后改变图片大小
|
|
1084
972
|
changeImageSizeAfterCrop = function changeImageSizeAfterCrop(newFile) {
|
|
1085
973
|
return new Promise(function (resolve) {
|
|
1086
974
|
var name = newFile.name,
|
|
1087
|
-
|
|
1088
|
-
|
|
975
|
+
type = newFile.type,
|
|
976
|
+
uid = newFile.uid;
|
|
1089
977
|
var width = fixedCropSize.width,
|
|
1090
|
-
|
|
1091
|
-
|
|
978
|
+
height = fixedCropSize.height; //固定裁剪大小
|
|
1092
979
|
var changeCanvas = document.createElement('canvas');
|
|
1093
980
|
var changeCtx = changeCanvas.getContext('2d');
|
|
1094
981
|
var img = new Image();
|
|
1095
|
-
|
|
1096
982
|
img.onload = function () {
|
|
1097
983
|
changeCanvas.width = width;
|
|
1098
984
|
changeCanvas.height = height;
|
|
@@ -1106,40 +992,30 @@ var ImgCrop = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1106
992
|
resolve(changeFile);
|
|
1107
993
|
}, type, quality);
|
|
1108
994
|
};
|
|
1109
|
-
|
|
1110
995
|
img.onerror = function () {
|
|
1111
996
|
resolve(newFile);
|
|
1112
997
|
};
|
|
1113
|
-
|
|
1114
998
|
var fileReader = new FileReader();
|
|
1115
|
-
|
|
1116
999
|
fileReader.onload = function () {
|
|
1117
1000
|
img.src = fileReader.result;
|
|
1118
1001
|
};
|
|
1119
|
-
|
|
1120
1002
|
fileReader.onerror = function () {
|
|
1121
1003
|
resolve(newFile);
|
|
1122
1004
|
};
|
|
1123
|
-
|
|
1124
1005
|
fileReader.readAsDataURL(newFile);
|
|
1125
1006
|
});
|
|
1126
1007
|
}; // get the new image
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
1008
|
_fileRef$current = fileRef.current, type = _fileRef$current.type, name = _fileRef$current.name, uid = _fileRef$current.uid;
|
|
1130
|
-
|
|
1131
1009
|
if (/svg/ig.test(type)) {
|
|
1132
1010
|
//svg 转为 png
|
|
1133
1011
|
type = 'image/png';
|
|
1134
1012
|
idx = name.lastIndexOf('.');
|
|
1135
1013
|
if (idx > -1) name = name.substring(0, idx) + '.png';
|
|
1136
|
-
}
|
|
1137
|
-
|
|
1138
|
-
|
|
1014
|
+
}
|
|
1015
|
+
//转为blob
|
|
1139
1016
|
onBlob = function onBlob(blob) {
|
|
1140
1017
|
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee2() {
|
|
1141
1018
|
var _a, _b, _c, _d, _e, _f, newFile, changeFile, res, passedFile;
|
|
1142
|
-
|
|
1143
1019
|
return regenerator.wrap(function _callee2$(_context2) {
|
|
1144
1020
|
while (1) {
|
|
1145
1021
|
switch (_context2.prev = _context2.next) {
|
|
@@ -1151,74 +1027,56 @@ var ImgCrop = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1151
1027
|
});
|
|
1152
1028
|
_context2.next = 3;
|
|
1153
1029
|
return changeImageSizeAfterCrop(newFile);
|
|
1154
|
-
|
|
1155
1030
|
case 3:
|
|
1156
1031
|
changeFile = _context2.sent;
|
|
1157
|
-
|
|
1158
1032
|
if (!(typeof beforeUploadRef.current !== 'function')) {
|
|
1159
1033
|
_context2.next = 6;
|
|
1160
1034
|
break;
|
|
1161
1035
|
}
|
|
1162
|
-
|
|
1163
1036
|
return _context2.abrupt("return", (_a = resolveRef.current) === null || _a === void 0 ? void 0 : _a.call(resolveRef, changeFile));
|
|
1164
|
-
|
|
1165
1037
|
case 6:
|
|
1166
1038
|
res = beforeUploadRef.current(changeFile, [changeFile]);
|
|
1167
|
-
|
|
1168
1039
|
if (!(typeof res !== 'boolean' && !res)) {
|
|
1169
1040
|
_context2.next = 10;
|
|
1170
1041
|
break;
|
|
1171
1042
|
}
|
|
1172
|
-
|
|
1173
1043
|
console.error('beforeUpload must return a boolean or Promise');
|
|
1174
1044
|
return _context2.abrupt("return");
|
|
1175
|
-
|
|
1176
1045
|
case 10:
|
|
1177
1046
|
if (!(res === true)) {
|
|
1178
1047
|
_context2.next = 12;
|
|
1179
1048
|
break;
|
|
1180
1049
|
}
|
|
1181
|
-
|
|
1182
1050
|
return _context2.abrupt("return", (_b = resolveRef.current) === null || _b === void 0 ? void 0 : _b.call(resolveRef, changeFile));
|
|
1183
|
-
|
|
1184
1051
|
case 12:
|
|
1185
1052
|
if (!(res === false)) {
|
|
1186
1053
|
_context2.next = 14;
|
|
1187
1054
|
break;
|
|
1188
1055
|
}
|
|
1189
|
-
|
|
1190
1056
|
return _context2.abrupt("return", (_c = resolveRef.current) === null || _c === void 0 ? void 0 : _c.call(resolveRef, changeFile, false));
|
|
1191
|
-
|
|
1192
1057
|
case 14:
|
|
1193
1058
|
if (!(res && res instanceof Promise)) {
|
|
1194
1059
|
_context2.next = 27;
|
|
1195
1060
|
break;
|
|
1196
1061
|
}
|
|
1197
|
-
|
|
1198
1062
|
_context2.prev = 15;
|
|
1199
1063
|
_context2.next = 18;
|
|
1200
1064
|
return res;
|
|
1201
|
-
|
|
1202
1065
|
case 18:
|
|
1203
1066
|
passedFile = _context2.sent;
|
|
1204
|
-
|
|
1205
1067
|
if (!(passedFile instanceof File || passedFile instanceof Blob)) {
|
|
1206
1068
|
_context2.next = 21;
|
|
1207
1069
|
break;
|
|
1208
1070
|
}
|
|
1209
|
-
|
|
1210
1071
|
return _context2.abrupt("return", (_d = resolveRef.current) === null || _d === void 0 ? void 0 : _d.call(resolveRef, passedFile));
|
|
1211
|
-
|
|
1212
1072
|
case 21:
|
|
1213
1073
|
(_e = resolveRef.current) === null || _e === void 0 ? void 0 : _e.call(resolveRef, changeFile, passedFile);
|
|
1214
1074
|
_context2.next = 27;
|
|
1215
1075
|
break;
|
|
1216
|
-
|
|
1217
1076
|
case 24:
|
|
1218
1077
|
_context2.prev = 24;
|
|
1219
1078
|
_context2.t0 = _context2["catch"](15);
|
|
1220
1079
|
(_f = rejectRef.current) === null || _f === void 0 ? void 0 : _f.call(rejectRef, _context2.t0);
|
|
1221
|
-
|
|
1222
1080
|
case 27:
|
|
1223
1081
|
case "end":
|
|
1224
1082
|
return _context2.stop();
|
|
@@ -1227,9 +1085,7 @@ var ImgCrop = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1227
1085
|
}, _callee2, null, [[15, 24]]);
|
|
1228
1086
|
}));
|
|
1229
1087
|
};
|
|
1230
|
-
|
|
1231
1088
|
canvas.toBlob(onBlob, type, quality);
|
|
1232
|
-
|
|
1233
1089
|
case 11:
|
|
1234
1090
|
case "end":
|
|
1235
1091
|
return _context3.stop();
|
|
@@ -1237,8 +1093,8 @@ var ImgCrop = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1237
1093
|
}
|
|
1238
1094
|
}, _callee3);
|
|
1239
1095
|
}));
|
|
1240
|
-
}, [fillColor, quality, rotate]);
|
|
1241
|
-
|
|
1096
|
+
}, [fillColor, quality, rotate]);
|
|
1097
|
+
//img crop 组件
|
|
1242
1098
|
var getComponent = function getComponent(titleOfModal) {
|
|
1243
1099
|
return jsxs(Fragment, {
|
|
1244
1100
|
children: [uploadComponent, image && jsx(Modal, Object.assign({
|
|
@@ -1271,7 +1127,6 @@ var ImgCrop = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1271
1127
|
}))]
|
|
1272
1128
|
});
|
|
1273
1129
|
};
|
|
1274
|
-
|
|
1275
1130
|
return jsx(Fragment, {
|
|
1276
1131
|
children: getComponent(modalTitle)
|
|
1277
1132
|
});
|
|
@@ -1280,95 +1135,78 @@ var ImgCrop = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1280
1135
|
var css_248z = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2021/11/11 下午1:40\n* @description\n*/\n/**\n* @author Hanz\n* @date 2021/10/20 下午2:08\n* @description color\n*/\n.paraui-v3-upload .component-upload {\n position: relative;\n display: inline-block;\n}\n.paraui-v3-upload-loading {\n pointer-events: none;\n}\n.paraui-v3-upload .paraui-v3-button {\n color: rgb(54, 102, 214);\n border-color: rgb(54, 102, 214);\n}\n.paraui-v3-upload .paraui-v3-button:hover {\n border-color: rgba(54, 102, 214, 0.8);\n color: rgba(54, 102, 214, 0.8);\n}\n.paraui-v3-upload .paraui-v3-button-loading .button-icon {\n animation: uploadLoadingCircle 1s infinite linear;\n}\n.paraui-v3-upload-drag {\n position: relative;\n}\n.paraui-v3-upload-drag .component-upload {\n display: block;\n}\n.paraui-v3-upload-drag-loading {\n pointer-events: none;\n}\n.paraui-v3-upload-drag-hover .upload-drag-container {\n border-color: rgba(54, 102, 214, 0.4);\n background-color: rgba(54, 102, 214, 0.05);\n}\n.paraui-v3-upload-drag .upload-drag-container {\n display: inline-flex;\n width: 100%;\n max-width: 960px;\n height: 220px;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n font-size: 14px;\n line-height: 1;\n border: 2px dashed rgba(171, 176, 185, 0.4);\n background-color: rgba(171, 176, 185, 0.12);\n border-radius: 4px;\n cursor: pointer;\n transition: 0.3s;\n}\n.paraui-v3-upload-drag .upload-drag-container:hover {\n border-color: rgba(54, 102, 214, 0.4);\n background-color: rgba(54, 102, 214, 0.05);\n}\n.paraui-v3-upload-drag .upload-drag-container .upload-drag-icon {\n line-height: 0;\n}\n.paraui-v3-upload-drag .upload-drag-container .upload-drag-icon svg {\n font-size: 48px;\n color: rgb(54, 102, 214);\n}\n.paraui-v3-upload-drag .upload-drag-container .upload-drag-icon .upload-drag-loading {\n animation: uploadLoadingCircle 1s infinite linear;\n}\n.paraui-v3-upload-drag .upload-drag-container .upload-drag-text {\n margin: 20px 0 12px 0;\n color: rgb(46, 55, 67);\n}\n.paraui-v3-upload-drag .upload-drag-container .upload-drag-text-loading {\n color: rgb(54, 102, 214);\n}\n.paraui-v3-upload-drag .upload-drag-container .upload-drag-text-filename {\n margin-right: 5px;\n color: rgb(46, 55, 67);\n}\n.paraui-v3-upload-drag .upload-drag-container .upload-drag-hint {\n color: rgba(46, 55, 67, 0.7);\n padding: 0 20px;\n text-align: center;\n}\n@keyframes uploadLoadingCircle {\n 100% {\n transform: rotate(360deg);\n }\n}";
|
|
1281
1136
|
styleInject(css_248z);
|
|
1282
1137
|
|
|
1138
|
+
//upload
|
|
1283
1139
|
var InternalUpload = function InternalUpload(props) {
|
|
1284
1140
|
var _props$type = props.type,
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1141
|
+
type = _props$type === void 0 ? 'select' : _props$type,
|
|
1142
|
+
className = props.className,
|
|
1143
|
+
style = props.style,
|
|
1144
|
+
_onStart = props.onStart,
|
|
1145
|
+
_onSuccess = props.onSuccess,
|
|
1146
|
+
_onError = props.onError,
|
|
1147
|
+
_onProgress = props.onProgress,
|
|
1148
|
+
onRemove = props.onRemove,
|
|
1149
|
+
_beforeUpload = props.beforeUpload,
|
|
1150
|
+
onChange = props.onChange,
|
|
1151
|
+
onDrop = props.onDrop,
|
|
1152
|
+
_props$defaultFileLis = props.defaultFileList,
|
|
1153
|
+
defaultFileList = _props$defaultFileLis === void 0 ? [] : _props$defaultFileLis,
|
|
1154
|
+
fileList = props.fileList,
|
|
1155
|
+
_props$showUploadList = props.showUploadList,
|
|
1156
|
+
showUploadList = _props$showUploadList === void 0 ? true : _props$showUploadList,
|
|
1157
|
+
maxCount = props.maxCount,
|
|
1158
|
+
_props$children = props.children,
|
|
1159
|
+
children = _props$children === void 0 ? null : _props$children,
|
|
1160
|
+
itemRender = props.itemRender,
|
|
1161
|
+
_props$showUploadErro = props.showUploadError,
|
|
1162
|
+
showUploadError = _props$showUploadErro === void 0 ? true : _props$showUploadErro,
|
|
1163
|
+
_props$size = props.size,
|
|
1164
|
+
size = _props$size === void 0 ? 'large' : _props$size,
|
|
1165
|
+
_props$stash = props.stash,
|
|
1166
|
+
stash = _props$stash === void 0 ? false : _props$stash,
|
|
1167
|
+
_props$uploading = props.uploading,
|
|
1168
|
+
uploading = _props$uploading === void 0 ? true : _props$uploading,
|
|
1169
|
+
_props$showLoading = props.showLoading,
|
|
1170
|
+
loading = _props$showLoading === void 0 ? true : _props$showLoading,
|
|
1171
|
+
dragArea = props.dragArea,
|
|
1172
|
+
restProps = __rest(props, ["type", "className", "style", "onStart", "onSuccess", "onError", "onProgress", "onRemove", "beforeUpload", "onChange", "onDrop", "defaultFileList", "fileList", "showUploadList", "maxCount", "children", "itemRender", "showUploadError", "size", "stash", "uploading", "showLoading", "dragArea"]);
|
|
1318
1173
|
var intl = useFormatMessage('Upload', localeJson);
|
|
1319
|
-
|
|
1320
1174
|
var _useState = useState(defaultFileList),
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1175
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1176
|
+
uploadFileList = _useState2[0],
|
|
1177
|
+
setUploadFileList = _useState2[1]; //文件列表
|
|
1326
1178
|
var _useState3 = useState(false),
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1179
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
1180
|
+
showLoading = _useState4[0],
|
|
1181
|
+
setShowLoading = _useState4[1]; //upload loading
|
|
1332
1182
|
var _useState5 = useState(false),
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1183
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
1184
|
+
errTip = _useState6[0],
|
|
1185
|
+
setErrTip = _useState6[1]; //upload error tip
|
|
1338
1186
|
var _ref = typeof showUploadList === 'boolean' ? {} : showUploadList,
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1187
|
+
showRemoveIcon = _ref.showRemoveIcon,
|
|
1188
|
+
removeIcon = _ref.removeIcon; //显示上传列表
|
|
1343
1189
|
var _ref2 = typeof showUploadError === 'boolean' ? {} : showUploadError,
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1190
|
+
_ref2$uploadErrorMsg = _ref2.uploadErrorMsg,
|
|
1191
|
+
uploadErrorMsg = _ref2$uploadErrorMsg === void 0 ? intl({
|
|
1192
|
+
id: 'uploadError'
|
|
1193
|
+
}) : _ref2$uploadErrorMsg,
|
|
1194
|
+
_ref2$leaveDelay = _ref2.leaveDelay,
|
|
1195
|
+
leaveDelay = _ref2$leaveDelay === void 0 ? 3000 : _ref2$leaveDelay; //错误信息提示
|
|
1352
1196
|
var _useState7 = useState('drop'),
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1197
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
1198
|
+
dragState = _useState8[0],
|
|
1199
|
+
setDragState = _useState8[1]; //拖拽状态
|
|
1358
1200
|
var curFileRef = useRef(); //正上传文件
|
|
1359
|
-
|
|
1360
1201
|
var recordNonAcceptFileRef = useRef(); //记录非accept推荐文件
|
|
1361
1202
|
//复写属性
|
|
1362
|
-
|
|
1363
1203
|
var overrideProps = Object.assign(Object.assign({}, restProps), {
|
|
1364
1204
|
beforeUpload: function beforeUpload(file, fileList) {
|
|
1365
1205
|
if (restProps.action && loading && uploading) {
|
|
1366
1206
|
setShowLoading(true);
|
|
1367
1207
|
curFileRef.current = file;
|
|
1368
1208
|
}
|
|
1369
|
-
|
|
1370
1209
|
var val = _beforeUpload === null || _beforeUpload === void 0 ? void 0 : _beforeUpload(file, fileList);
|
|
1371
|
-
|
|
1372
1210
|
if (val === false) {
|
|
1373
1211
|
setShowLoading(false);
|
|
1374
1212
|
curFileRef.current = null;
|
|
@@ -1400,36 +1238,30 @@ var InternalUpload = function InternalUpload(props) {
|
|
|
1400
1238
|
var arr = fileList.map(function (_) {
|
|
1401
1239
|
return _.file;
|
|
1402
1240
|
});
|
|
1403
|
-
|
|
1404
1241
|
if (type === 'drag' && restProps.accept && recordNonAcceptFileRef.current) {
|
|
1405
1242
|
arr.push(recordNonAcceptFileRef.current);
|
|
1406
1243
|
recordNonAcceptFileRef.current = null;
|
|
1407
1244
|
}
|
|
1408
|
-
|
|
1409
1245
|
var mList = mergedFileList(arr);
|
|
1410
1246
|
onInternalChange(mList);
|
|
1411
1247
|
}
|
|
1412
1248
|
}
|
|
1413
|
-
});
|
|
1414
|
-
|
|
1249
|
+
});
|
|
1250
|
+
//内部变化
|
|
1415
1251
|
var onInternalChange = function onInternalChange(changedFileList) {
|
|
1416
|
-
var cloneList = _toConsumableArray(changedFileList);
|
|
1417
|
-
|
|
1418
|
-
|
|
1252
|
+
var cloneList = _toConsumableArray(changedFileList);
|
|
1253
|
+
// Cut to match count
|
|
1419
1254
|
if (maxCount === 1) {
|
|
1420
1255
|
cloneList = cloneList.slice(-1);
|
|
1421
1256
|
} else if (maxCount) {
|
|
1422
1257
|
cloneList = cloneList.slice(0, maxCount);
|
|
1423
1258
|
}
|
|
1424
|
-
|
|
1425
1259
|
onChange === null || onChange === void 0 ? void 0 : onChange(cloneList);
|
|
1426
1260
|
setUploadFileList(cloneList);
|
|
1427
|
-
};
|
|
1428
|
-
|
|
1429
|
-
|
|
1261
|
+
};
|
|
1262
|
+
//更新文件列表
|
|
1430
1263
|
var updateFileList = function updateFileList(file) {
|
|
1431
1264
|
var cloneList = _toConsumableArray(uploadFileList);
|
|
1432
|
-
|
|
1433
1265
|
var fileObj = Object.assign(Object.assign({}, file), {
|
|
1434
1266
|
lastModified: file.lastModified,
|
|
1435
1267
|
lastModifiedDate: file.lastModifiedDate,
|
|
@@ -1440,12 +1272,10 @@ var InternalUpload = function InternalUpload(props) {
|
|
|
1440
1272
|
originFileObj: file
|
|
1441
1273
|
});
|
|
1442
1274
|
return cloneList.concat(fileObj);
|
|
1443
|
-
};
|
|
1444
|
-
|
|
1445
|
-
|
|
1275
|
+
};
|
|
1276
|
+
//合并文件列表
|
|
1446
1277
|
var mergedFileList = function mergedFileList(fileList) {
|
|
1447
1278
|
var cloneList = _toConsumableArray(uploadFileList);
|
|
1448
|
-
|
|
1449
1279
|
var newFileList = fileList.map(function (file) {
|
|
1450
1280
|
return Object.assign(Object.assign({}, file), {
|
|
1451
1281
|
lastModified: file.lastModified,
|
|
@@ -1458,9 +1288,8 @@ var InternalUpload = function InternalUpload(props) {
|
|
|
1458
1288
|
});
|
|
1459
1289
|
});
|
|
1460
1290
|
return cloneList.concat(newFileList);
|
|
1461
|
-
};
|
|
1462
|
-
|
|
1463
|
-
|
|
1291
|
+
};
|
|
1292
|
+
//删除文件
|
|
1464
1293
|
var handleRemove = function handleRemove(file) {
|
|
1465
1294
|
Promise.resolve(typeof onRemove === 'function' ? onRemove(file) : onRemove).then(function (ret) {
|
|
1466
1295
|
// Prevent removing file
|
|
@@ -1471,32 +1300,26 @@ var InternalUpload = function InternalUpload(props) {
|
|
|
1471
1300
|
if (idx > -1) uploadFileList.splice(idx, 1);
|
|
1472
1301
|
onInternalChange(uploadFileList);
|
|
1473
1302
|
});
|
|
1474
|
-
};
|
|
1475
|
-
|
|
1476
|
-
|
|
1303
|
+
};
|
|
1304
|
+
//拖拽区域
|
|
1477
1305
|
var onFileDrop = function onFileDrop(e) {
|
|
1478
1306
|
var _a, _b;
|
|
1479
|
-
|
|
1480
1307
|
setDragState(e.type);
|
|
1481
|
-
|
|
1482
1308
|
if (e.type === 'drop') {
|
|
1483
|
-
onDrop === null || onDrop === void 0 ? void 0 : onDrop(e);
|
|
1484
|
-
|
|
1309
|
+
onDrop === null || onDrop === void 0 ? void 0 : onDrop(e);
|
|
1310
|
+
//拖拽且设置accept
|
|
1485
1311
|
if (type === 'drag' && restProps.accept) {
|
|
1486
1312
|
var dropFile = (_b = (_a = e.dataTransfer) === null || _a === void 0 ? void 0 : _a.files) === null || _b === void 0 ? void 0 : _b[0];
|
|
1487
|
-
|
|
1488
1313
|
if (dropFile) {
|
|
1489
1314
|
var reg = new RegExp(restProps.accept, 'ig');
|
|
1490
|
-
|
|
1491
1315
|
if (!reg.test(dropFile.type)) {
|
|
1492
1316
|
recordNonAcceptFileRef.current = dropFile;
|
|
1493
1317
|
}
|
|
1494
1318
|
}
|
|
1495
1319
|
}
|
|
1496
1320
|
}
|
|
1497
|
-
};
|
|
1498
|
-
|
|
1499
|
-
|
|
1321
|
+
};
|
|
1322
|
+
//显示错误提示
|
|
1500
1323
|
var showErrTip = function showErrTip(flag) {
|
|
1501
1324
|
setErrTip(flag);
|
|
1502
1325
|
if (leaveDelay < 0) return;
|
|
@@ -1504,13 +1327,12 @@ var InternalUpload = function InternalUpload(props) {
|
|
|
1504
1327
|
setErrTip(false);
|
|
1505
1328
|
}, leaveDelay);
|
|
1506
1329
|
};
|
|
1507
|
-
|
|
1508
1330
|
useEffect(function () {
|
|
1509
1331
|
if (fileList) {
|
|
1510
1332
|
setUploadFileList(_toConsumableArray(fileList));
|
|
1511
1333
|
}
|
|
1512
|
-
}, [fileList]);
|
|
1513
|
-
|
|
1334
|
+
}, [fileList]);
|
|
1335
|
+
//渲染上传列表
|
|
1514
1336
|
var renderUploadList = function renderUploadList() {
|
|
1515
1337
|
return showUploadList && jsx(UploadList, {
|
|
1516
1338
|
listType: 'text',
|
|
@@ -1520,21 +1342,17 @@ var InternalUpload = function InternalUpload(props) {
|
|
|
1520
1342
|
onRemove: handleRemove,
|
|
1521
1343
|
itemRender: itemRender
|
|
1522
1344
|
});
|
|
1523
|
-
};
|
|
1524
|
-
|
|
1525
|
-
|
|
1345
|
+
};
|
|
1346
|
+
//渲染上传按钮
|
|
1526
1347
|
var renderButton = function renderButton() {
|
|
1527
1348
|
var icon = jsx(UploadIcon, {});
|
|
1528
|
-
|
|
1529
1349
|
var text = children;
|
|
1530
|
-
|
|
1531
1350
|
if (showLoading) {
|
|
1532
1351
|
icon = jsx(LoadingIcon, {});
|
|
1533
1352
|
text = intl({
|
|
1534
1353
|
id: 'uploading'
|
|
1535
1354
|
});
|
|
1536
1355
|
}
|
|
1537
|
-
|
|
1538
1356
|
return jsx(Button, Object.assign({
|
|
1539
1357
|
variant: 'outlined',
|
|
1540
1358
|
size: size,
|
|
@@ -1543,29 +1361,24 @@ var InternalUpload = function InternalUpload(props) {
|
|
|
1543
1361
|
}, {
|
|
1544
1362
|
children: text
|
|
1545
1363
|
}));
|
|
1546
|
-
};
|
|
1547
|
-
|
|
1548
|
-
|
|
1364
|
+
};
|
|
1365
|
+
//渲染拖拽区域
|
|
1549
1366
|
var renderDragArea = function renderDragArea() {
|
|
1550
1367
|
var _a;
|
|
1551
|
-
|
|
1552
1368
|
var icon = jsx(UploadIcon, {});
|
|
1553
|
-
|
|
1554
1369
|
var text = intl({
|
|
1555
1370
|
id: 'clickUploadFile'
|
|
1556
1371
|
});
|
|
1557
1372
|
var hint = intl({
|
|
1558
1373
|
id: 'dragFileUpload'
|
|
1559
1374
|
});
|
|
1560
|
-
|
|
1561
1375
|
var _ref3 = dragArea !== null && dragArea !== void 0 ? dragArea : {},
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1376
|
+
_ref3$areaIcon = _ref3.areaIcon,
|
|
1377
|
+
areaIcon = _ref3$areaIcon === void 0 ? icon : _ref3$areaIcon,
|
|
1378
|
+
_ref3$areaText = _ref3.areaText,
|
|
1379
|
+
areaText = _ref3$areaText === void 0 ? text : _ref3$areaText,
|
|
1380
|
+
_ref3$areaDesc = _ref3.areaDesc,
|
|
1381
|
+
areaDesc = _ref3$areaDesc === void 0 ? hint : _ref3$areaDesc;
|
|
1569
1382
|
if (showLoading) {
|
|
1570
1383
|
areaIcon = jsx(LoadingIcon, {
|
|
1571
1384
|
className: 'upload-drag-loading'
|
|
@@ -1582,7 +1395,6 @@ var InternalUpload = function InternalUpload(props) {
|
|
|
1582
1395
|
}), "..."]
|
|
1583
1396
|
}));
|
|
1584
1397
|
}
|
|
1585
|
-
|
|
1586
1398
|
return jsx("div", Object.assign({
|
|
1587
1399
|
className: 'upload-drag-container'
|
|
1588
1400
|
}, {
|
|
@@ -1602,12 +1414,10 @@ var InternalUpload = function InternalUpload(props) {
|
|
|
1602
1414
|
}))]
|
|
1603
1415
|
})
|
|
1604
1416
|
}));
|
|
1605
|
-
};
|
|
1606
|
-
|
|
1607
|
-
|
|
1417
|
+
};
|
|
1418
|
+
//拖拽上传
|
|
1608
1419
|
if (type === 'drag') {
|
|
1609
1420
|
var _clsx;
|
|
1610
|
-
|
|
1611
1421
|
var dragCls = clsx("".concat($prefixCls, "-upload-drag"), className, (_clsx = {}, _defineProperty(_clsx, "".concat($prefixCls, "-upload-drag-loading"), showLoading), _defineProperty(_clsx, "".concat($prefixCls, "-upload-drag-hover"), dragState === 'dragover'), _clsx));
|
|
1612
1422
|
return jsxs("div", Object.assign({
|
|
1613
1423
|
className: dragCls,
|
|
@@ -1625,7 +1435,6 @@ var InternalUpload = function InternalUpload(props) {
|
|
|
1625
1435
|
})]
|
|
1626
1436
|
}));
|
|
1627
1437
|
}
|
|
1628
|
-
|
|
1629
1438
|
var makeCls = clsx("".concat($prefixCls, "-upload"), className, showLoading && "".concat($prefixCls, "-upload-loading"));
|
|
1630
1439
|
return jsxs("div", Object.assign({
|
|
1631
1440
|
className: makeCls,
|
|
@@ -1640,7 +1449,6 @@ var InternalUpload = function InternalUpload(props) {
|
|
|
1640
1449
|
})), renderUploadList()]
|
|
1641
1450
|
}));
|
|
1642
1451
|
};
|
|
1643
|
-
|
|
1644
1452
|
var Upload = InternalUpload;
|
|
1645
1453
|
Upload.ImageUpload = ImageUpload;
|
|
1646
1454
|
Upload.Dragger = Dragger;
|