@para-ui/core 4.0.18 → 4.0.19-aplha2
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/Breadcrumbs/index.js +2 -2
- package/Button/SplitButton.d.ts +1 -1
- package/Button/index.js +2 -2
- package/ButtonGroup/index.js +2 -2
- package/Cascader/OptionList/Column.d.ts +1 -1
- package/Cascader/index.js +4 -4
- package/ColorPicker/chromePicker/index.d.ts +1 -2
- package/ColorPicker/compactPicker/index.d.ts +1 -2
- package/ColorPicker/sketchPicker/index.d.ts +1 -2
- package/ColorPicker/swatchesPicker/index.d.ts +1 -2
- package/ComboSelect/index.js +4 -4
- package/Container/index.d.ts +1 -1
- package/CopyText/index.js +2 -2
- package/CycleSelector/index.js +3 -2
- package/DatePicker/PickerButton.d.ts +1 -2
- package/DatePicker/PickerTag.d.ts +1 -2
- package/DatePicker/index.js +2 -2
- package/Descriptions/index.js +2 -2
- package/Desktop/index.js +3 -3
- package/DragVerify/index.js +3 -2
- package/Drawer/index.js +2 -2
- package/DynamicMultiBox/formItem.d.ts +1 -2
- package/DynamicMultiBox/index.js +4 -4
- package/DynamicMultiBox/interface.d.ts +1 -1
- package/DynamicMultiBox/rowForm.d.ts +1 -1
- package/Empty/images/index.d.ts +2 -3
- package/Empty/index.js +4 -3
- package/Form/index.js +5 -5
- package/FormItem/index.js +5 -5
- package/FunctionModal/index.js +4 -5
- package/FunctionModal/modalContext.d.ts +1 -2
- package/GlobalContext/index.js +3 -39
- package/InputLang/index.js +3 -3
- package/Message/index.d.ts +1 -1
- package/Modal/index.js +3 -4
- package/MultiBox/index.js +3 -3
- package/OperateBtn/index.js +2 -2
- package/PageHeader/index.js +2 -2
- package/Pagination/index.js +4 -4
- package/ParauiProvider/index.d.ts +2 -2
- package/ParauiProvider/index.js +3 -3
- package/PopConfirm/index.js +2 -2
- package/Prompt/index.d.ts +1 -1
- package/Querying/images/index.d.ts +2 -3
- package/Querying/index.js +4 -3
- package/QuickReply/index.js +3 -3
- package/README.md +4 -0
- package/Search/index.js +2 -2
- package/Select/index.js +4 -4
- package/SelectInput/index.js +4 -4
- package/Selector/index.js +328 -5
- package/SelectorPicker/index.js +3 -4
- package/SingleBox/index.js +3 -3
- package/Switch/index.js +3 -2
- package/Table/index.js +3 -3
- package/Tabs/index.js +2 -2
- package/TextEditor/index.js +2 -2
- package/TextField/index.js +2 -2
- package/TimePicker/index.js +2 -2
- package/Timeline/TimelineItem.d.ts +1 -1
- package/ToggleButton/index.js +2 -2
- package/Tooltip/utils.d.ts +1 -1
- package/Transfer/box.d.ts +1 -1
- package/Transfer/index.d.ts +1 -1
- package/Transfer/index.js +3 -3
- package/Tree/index.js +5 -5
- package/Tree/utils/treeUtil.d.ts +1 -1
- package/Upload/index.js +411 -629
- package/_verture/{index-10792f39.js → index-543781c9.js} +1 -1
- package/_verture/{index-02b7a0b7.js → index-c77ccb98.js} +1 -1
- package/_verture/{intl-f2f27722.js → index-ca413216.js} +54 -1
- package/_verture/{index-cc76d8d5.js → index-cb218775.js} +1 -1
- package/_verture/{useFormatMessage-eb13cf56.js → useFormatMessage-1fc7c957.js} +1 -1
- package/_verture/{useGlobalProps-1e416658.js → useGlobalProps-4ae1a007.js} +1 -1
- package/index.js +8 -11
- package/package.json +12 -16
- package/umd/Breadcrumbs.js +7 -7
- package/umd/Button.js +2 -2
- package/umd/ButtonGroup.js +4 -4
- package/umd/Carousel.js +3 -3
- package/umd/Cascader.js +1 -1
- package/umd/ColorPicker.js +1 -1
- package/umd/ComboSelect.js +5 -5
- package/umd/CopyText.js +7 -7
- package/umd/CycleSelector.js +5 -5
- package/umd/DatePicker.js +2 -2
- package/umd/Descriptions.js +7 -7
- package/umd/Desktop.js +2 -2
- package/umd/DragVerify.js +3 -3
- package/umd/Drawer.js +2 -2
- package/umd/DynamicMultiBox.js +3 -3
- package/umd/Empty.js +1 -1
- package/umd/Form.js +3 -3
- package/umd/FormItem.js +3 -3
- package/umd/FunctionModal.js +7 -7
- package/umd/GlobalContext.js +1 -1
- package/umd/InputLang.js +2 -2
- package/umd/Modal.js +2 -2
- package/umd/MultiBox.js +5 -5
- package/umd/OperateBtn.js +2 -2
- package/umd/PageHeader.js +4 -4
- package/umd/Pagination.js +3 -3
- package/umd/ParauiProvider.js +1 -1
- package/umd/PopConfirm.js +5 -5
- package/umd/Querying.js +1 -1
- package/umd/QuickReply.js +2 -2
- package/umd/Search.js +2 -2
- package/umd/Select.js +3 -3
- package/umd/SelectInput.js +3 -3
- package/umd/Selector.js +2 -2
- package/umd/SelectorPicker.js +4 -4
- package/umd/SingleBox.js +2 -2
- package/umd/Switch.js +2 -2
- package/umd/Table.js +5 -5
- package/umd/Tabs.js +2 -2
- package/umd/TextEditor.js +3 -3
- package/umd/TextField.js +2 -2
- package/umd/TimePicker.js +2 -2
- package/umd/ToggleButton.js +2 -2
- package/umd/Transfer.js +8 -8
- package/umd/Tree.js +4 -4
- package/umd/Upload.js +7 -7
- package/_verture/index-287ae1b3.js +0 -327
- package/_verture/index-c568f272.js +0 -18
- /package/_verture/{modalContext-3ba6ca8f.js → modalContext-c8cc3107.js} +0 -0
package/Upload/index.js
CHANGED
|
@@ -4,10 +4,6 @@ import { useState, useEffect, useRef, memo, forwardRef, useCallback, useImperati
|
|
|
4
4
|
import RcUpload from 'rc-upload';
|
|
5
5
|
import UploadIcon from '@para-ui/icons/UploadFile';
|
|
6
6
|
import LoadingIcon from '@para-ui/icons/Loading';
|
|
7
|
-
import { _ as _toConsumableArray } from '../_verture/toConsumableArray-8f4c9589.js';
|
|
8
|
-
import { _ as _typeof } from '../_verture/typeof-adeedc13.js';
|
|
9
|
-
import { _ as _slicedToArray } from '../_verture/slicedToArray-a8206399.js';
|
|
10
|
-
import { r as regenerator } from '../_verture/index-287ae1b3.js';
|
|
11
7
|
import Delete from '@para-ui/icons/Delete';
|
|
12
8
|
import TextIcon from '@para-ui/icons/Text';
|
|
13
9
|
import PhotoIcon from '@para-ui/icons/Photo';
|
|
@@ -15,15 +11,15 @@ import clsx from 'clsx';
|
|
|
15
11
|
import { $ as $prefixCls, a as $rcPrefixCls } from '../_verture/constant-5317fc89.js';
|
|
16
12
|
import { s as styleInject } from '../_verture/style-inject.es-300983ab.js';
|
|
17
13
|
import Forbid from '@para-ui/icons/Forbid';
|
|
18
|
-
import { u as useFormatMessage } from '../_verture/useFormatMessage-
|
|
14
|
+
import { u as useFormatMessage } from '../_verture/useFormatMessage-1fc7c957.js';
|
|
19
15
|
import EditOutline from '@para-ui/icons/EditOutline';
|
|
20
16
|
import { Button } from '../Button/index.js';
|
|
17
|
+
import { _ as _slicedToArray } from '../_verture/slicedToArray-a8206399.js';
|
|
21
18
|
import { Slider } from '../Slider/index.js';
|
|
22
19
|
import Cropper from 'react-easy-crop';
|
|
23
20
|
import { Modal } from '../Modal/index.js';
|
|
24
|
-
import '../_verture/
|
|
25
|
-
import '
|
|
26
|
-
import '@para-ui/core/GlobalContext';
|
|
21
|
+
import '../_verture/index-ca413216.js';
|
|
22
|
+
import '@paraview/lib';
|
|
27
23
|
import '@para-ui/icons/LoadingF';
|
|
28
24
|
import '../Tooltip/index.js';
|
|
29
25
|
import 'rc-tooltip';
|
|
@@ -33,12 +29,11 @@ import '../_verture/index-389675ab.js';
|
|
|
33
29
|
import 'rc-dropdown';
|
|
34
30
|
import '../_verture/usePopupContainer-635f66f4.js';
|
|
35
31
|
import 'dayjs';
|
|
36
|
-
import '@paraview/lib';
|
|
37
32
|
import '../AutoTips/index.js';
|
|
33
|
+
import '../_verture/unsupportedIterableToArray-cb478f24.js';
|
|
38
34
|
import 'rc-slider';
|
|
39
35
|
import 'rc-dialog';
|
|
40
36
|
import '@para-ui/icons/Close';
|
|
41
|
-
import '../_verture/index-c568f272.js';
|
|
42
37
|
import 'react-dom';
|
|
43
38
|
import '@para-ui/icons/CheckCircleF';
|
|
44
39
|
import '@para-ui/icons/WarningCircleF';
|
|
@@ -47,50 +42,41 @@ import '@para-ui/icons/CloseCircleF';
|
|
|
47
42
|
var css_248z$4 = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2021/11/11 下午3:08\n* @description\n*/\n/**\n* @author linhd\n* @date 2023/4/11 14:16\n* @description 最新色卡\n*/\n.paraui-v4-upload-list-text .upload-list-item {\n margin-top: 8px;\n}\n.paraui-v4-upload-list-text .upload-list-item-info {\n display: flex;\n align-items: center;\n padding: 0 8px;\n line-height: 28px;\n font-size: 14px;\n color: rgb(29, 33, 38);\n border-radius: 4px;\n transition: background-color 0.3s;\n}\n.paraui-v4-upload-list-text .upload-list-item-info .upload-list-text {\n position: relative;\n display: inline-flex;\n align-items: center;\n}\n.paraui-v4-upload-list-text .upload-list-item-info .upload-list-text .upload-list-fileicon {\n line-height: 0;\n opacity: 1;\n transition: opacity 0.3s;\n}\n.paraui-v4-upload-list-text .upload-list-item-info .upload-list-text .upload-list-fileicon svg {\n color: inherit;\n font-size: inherit;\n}\n.paraui-v4-upload-list-text .upload-list-item-info .upload-list-text-name {\n margin-left: 10px;\n}\n.paraui-v4-upload-list-text .upload-list-item-info .upload-list-text .upload-list-actions {\n position: absolute;\n left: 0;\n top: 50%;\n transform: translateY(-50%);\n z-index: -1;\n opacity: 0;\n visibility: hidden;\n line-height: 0;\n transition: opacity 0.3s;\n cursor: pointer;\n}\n.paraui-v4-upload-list-text .upload-list-item-info .upload-list-text .upload-list-actions svg {\n color: rgb(244, 66, 66);\n font-size: inherit;\n}\n.paraui-v4-upload-list-text .upload-list-item-info:hover {\n background-color: rgb(247, 248, 250);\n}\n.paraui-v4-upload-list-text .upload-list-item-info:hover .upload-list-text .upload-list-actions {\n visibility: visible;\n opacity: 1;\n z-index: 1;\n}\n.paraui-v4-upload-list-text .upload-list-item-info:hover .upload-list-text .upload-list-fileicon-active {\n opacity: 0;\n}\n.paraui-v4-upload-list-picture {\n display: inline-flex;\n align-items: center;\n}\n.paraui-v4-upload-list-picture .upload-list-picture-item {\n position: relative;\n display: inline-block;\n width: 100px;\n height: 100px;\n margin-right: 16px;\n border-radius: 4px;\n cursor: default;\n}\n.paraui-v4-upload-list-picture .upload-list-picture-item::before {\n content: \" \";\n position: absolute;\n left: 0;\n right: 0;\n bottom: 0;\n top: 0;\n background-color: rgb(29, 33, 38);\n border-radius: 4px;\n opacity: 0;\n transition: 0.3s;\n}\n.paraui-v4-upload-list-picture .upload-list-picture-item img {\n width: 100%;\n height: 100%;\n border-radius: 4px;\n}\n.paraui-v4-upload-list-picture .upload-list-picture-item .upload-list-picture-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: rgb(29, 33, 38);\n border-radius: 0 0 4px 4px;\n color: rgb(255, 255, 255);\n transition: 0.3s;\n}\n.paraui-v4-upload-list-picture .upload-list-picture-item .upload-list-actions {\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-v4-upload-list-picture .upload-list-picture-item .upload-list-actions svg {\n color: rgb(255, 255, 255);\n}\n.paraui-v4-upload-list-picture .upload-list-picture-item:hover:not(.upload-list-picture-item-readonly)::before {\n opacity: 1;\n}\n.paraui-v4-upload-list-picture .upload-list-picture-item:hover:not(.upload-list-picture-item-readonly) .upload-list-actions {\n opacity: 1;\n}\n.paraui-v4-upload-list-picture .upload-list-picture-item:hover:not(.upload-list-picture-item-readonly) .upload-list-picture-name {\n opacity: 0;\n}";
|
|
48
43
|
styleInject(css_248z$4);
|
|
49
44
|
|
|
50
|
-
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; } } }; }
|
|
51
|
-
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
|
-
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; }
|
|
53
45
|
//UploadList
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
listType =
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
var _useState = useState([]),
|
|
66
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
67
|
-
uploadList = _useState2[0],
|
|
68
|
-
setUploadList = _useState2[1];
|
|
46
|
+
const UploadList = props => {
|
|
47
|
+
const {
|
|
48
|
+
listType = 'text',
|
|
49
|
+
items = [],
|
|
50
|
+
onRemove,
|
|
51
|
+
showRemoveIcon = true,
|
|
52
|
+
removeIcon,
|
|
53
|
+
itemRender,
|
|
54
|
+
readonly
|
|
55
|
+
} = props;
|
|
56
|
+
const [uploadList, setUploadList] = useState([]);
|
|
69
57
|
//处理删除
|
|
70
|
-
|
|
58
|
+
const handleRemove = (file, evt) => {
|
|
71
59
|
evt.stopPropagation();
|
|
72
60
|
onRemove === null || onRemove === void 0 ? void 0 : onRemove(file);
|
|
73
61
|
};
|
|
74
62
|
//渲染列表actions
|
|
75
|
-
|
|
63
|
+
const renderActions = file => {
|
|
76
64
|
return showRemoveIcon && !readonly && jsx("span", Object.assign({
|
|
77
65
|
className: 'upload-list-actions',
|
|
78
|
-
onClick:
|
|
79
|
-
return handleRemove(file, evt);
|
|
80
|
-
}
|
|
66
|
+
onClick: evt => handleRemove(file, evt)
|
|
81
67
|
}, {
|
|
82
68
|
children: removeIcon || jsx(Delete, {})
|
|
83
69
|
}));
|
|
84
70
|
};
|
|
85
71
|
//文件列表 text
|
|
86
|
-
|
|
72
|
+
const renderFileListText = () => {
|
|
87
73
|
if (!(uploadList === null || uploadList === void 0 ? void 0 : uploadList.length)) return null;
|
|
88
|
-
return uploadList.map(
|
|
74
|
+
return uploadList.map((file, idx) => {
|
|
89
75
|
var _a;
|
|
90
76
|
if (itemRender)
|
|
91
77
|
//自定义渲染
|
|
92
78
|
return itemRender(file, uploadList);
|
|
93
|
-
|
|
79
|
+
const isImage = !!((_a = file.type) === null || _a === void 0 ? void 0 : _a.includes('image/'));
|
|
94
80
|
return jsx("div", Object.assign({
|
|
95
81
|
className: 'upload-list-item'
|
|
96
82
|
}, {
|
|
@@ -115,9 +101,9 @@ var UploadList = function UploadList(props) {
|
|
|
115
101
|
});
|
|
116
102
|
};
|
|
117
103
|
//文件列表 picture-card
|
|
118
|
-
|
|
104
|
+
const renderFileListPicture = () => {
|
|
119
105
|
if (!(uploadList === null || uploadList === void 0 ? void 0 : uploadList.length)) return null;
|
|
120
|
-
return uploadList.map(
|
|
106
|
+
return uploadList.map((file, idx) => {
|
|
121
107
|
if (itemRender)
|
|
122
108
|
//自定义渲染
|
|
123
109
|
return itemRender(file, uploadList);
|
|
@@ -137,84 +123,31 @@ var UploadList = function UploadList(props) {
|
|
|
137
123
|
});
|
|
138
124
|
};
|
|
139
125
|
//处理文件
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
} else resolve('');
|
|
166
|
-
}));
|
|
167
|
-
case 1:
|
|
168
|
-
case "end":
|
|
169
|
-
return _context.stop();
|
|
170
|
-
}
|
|
171
|
-
}, _callee);
|
|
172
|
-
}));
|
|
173
|
-
};
|
|
174
|
-
_iterator = _createForOfIteratorHelper(items);
|
|
175
|
-
_context2.prev = 4;
|
|
176
|
-
_iterator.s();
|
|
177
|
-
case 6:
|
|
178
|
-
if ((_step = _iterator.n()).done) {
|
|
179
|
-
_context2.next = 15;
|
|
180
|
-
break;
|
|
181
|
-
}
|
|
182
|
-
file = _step.value;
|
|
183
|
-
if (!file.originFileObj) {
|
|
184
|
-
_context2.next = 13;
|
|
185
|
-
break;
|
|
186
|
-
}
|
|
187
|
-
_context2.next = 11;
|
|
188
|
-
return readerFileAsDataUrl(file);
|
|
189
|
-
case 11:
|
|
190
|
-
dataUrl = _context2.sent;
|
|
191
|
-
file.dataUrl = dataUrl;
|
|
192
|
-
case 13:
|
|
193
|
-
_context2.next = 6;
|
|
194
|
-
break;
|
|
195
|
-
case 15:
|
|
196
|
-
_context2.next = 20;
|
|
197
|
-
break;
|
|
198
|
-
case 17:
|
|
199
|
-
_context2.prev = 17;
|
|
200
|
-
_context2.t0 = _context2["catch"](4);
|
|
201
|
-
_iterator.e(_context2.t0);
|
|
202
|
-
case 20:
|
|
203
|
-
_context2.prev = 20;
|
|
204
|
-
_iterator.f();
|
|
205
|
-
return _context2.finish(20);
|
|
206
|
-
case 23:
|
|
207
|
-
setUploadList(_toConsumableArray(items));
|
|
208
|
-
case 24:
|
|
209
|
-
case "end":
|
|
210
|
-
return _context2.stop();
|
|
211
|
-
}
|
|
212
|
-
}, _callee2, null, [[4, 17, 20, 23]]);
|
|
213
|
-
}));
|
|
214
|
-
};
|
|
215
|
-
useEffect(function () {
|
|
216
|
-
if (listType === 'picture-card') handleFileFormat();else setUploadList(function (pre) {
|
|
217
|
-
if (items) return _toConsumableArray(items);
|
|
126
|
+
const handleFileFormat = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
127
|
+
if (!(items === null || items === void 0 ? void 0 : items.length)) return setUploadList([]);
|
|
128
|
+
//读取file as DataUrl
|
|
129
|
+
const readerFileAsDataUrl = file => __awaiter(void 0, void 0, void 0, function* () {
|
|
130
|
+
return new Promise(resolve => {
|
|
131
|
+
const fileReader = new FileReader();
|
|
132
|
+
if (file.originFileObj) {
|
|
133
|
+
fileReader.onload = () => {
|
|
134
|
+
resolve(fileReader.result);
|
|
135
|
+
};
|
|
136
|
+
fileReader.readAsDataURL(file.originFileObj);
|
|
137
|
+
} else resolve('');
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
for (const file of items) {
|
|
141
|
+
if (file.originFileObj) {
|
|
142
|
+
const dataUrl = yield readerFileAsDataUrl(file);
|
|
143
|
+
file.dataUrl = dataUrl;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
setUploadList([...items]);
|
|
147
|
+
});
|
|
148
|
+
useEffect(() => {
|
|
149
|
+
if (listType === 'picture-card') handleFileFormat();else setUploadList(pre => {
|
|
150
|
+
if (items) return [...items];
|
|
218
151
|
return pre;
|
|
219
152
|
});
|
|
220
153
|
}, [items]);
|
|
@@ -235,7 +168,7 @@ var css_248z$3 = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2021/11/15
|
|
|
235
168
|
styleInject(css_248z$3);
|
|
236
169
|
|
|
237
170
|
//error tip
|
|
238
|
-
|
|
171
|
+
const ErrorTip = props => {
|
|
239
172
|
return jsxs("div", Object.assign({
|
|
240
173
|
className: clsx("".concat($prefixCls, "-upload-error"), props.className)
|
|
241
174
|
}, {
|
|
@@ -268,144 +201,99 @@ var zh = {
|
|
|
268
201
|
};
|
|
269
202
|
|
|
270
203
|
var localeJson = {
|
|
271
|
-
zh
|
|
272
|
-
en
|
|
204
|
+
zh,
|
|
205
|
+
en
|
|
273
206
|
};
|
|
274
207
|
|
|
275
208
|
var css_248z$2 = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2021/11/11 下午7:31\n* @description\n*/\n/**\n* @author linhd\n* @date 2023/4/11 14:16\n* @description 最新色卡\n*/\n.paraui-v4-upload-image {\n display: inline-flex;\n align-items: center;\n /* &-border {\n .upload-image-select{\n border: 2px dashed $NA1;\n\n &:hover {\n border: 2px dashed $NPT8;\n }\n }\n } */\n}\n.paraui-v4-upload-image .upload-image-select {\n position: relative;\n width: 100px;\n height: 100px;\n cursor: pointer;\n background-color: rgb(247, 248, 250);\n border-radius: 4px;\n transition: 0.3s;\n}\n.paraui-v4-upload-image .upload-image-select-loading {\n pointer-events: none;\n}\n.paraui-v4-upload-image .upload-image-select .component-upload {\n display: inline-block;\n width: 100%;\n height: 100%;\n}\n.paraui-v4-upload-image .upload-image-select:hover .upload-image-picture-card {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-upload-image .upload-image-picture-card {\n display: inline-flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: 100%;\n font-size: 14px;\n color: rgb(29, 33, 38);\n}\n.paraui-v4-upload-image .upload-image-picture-card .upload-img-wrapper {\n position: relative;\n width: 100%;\n height: 100%;\n cursor: default;\n}\n.paraui-v4-upload-image .upload-image-picture-card .upload-img-wrapper img {\n width: 100%;\n height: 100%;\n border-radius: 4px;\n}\n.paraui-v4-upload-image .upload-image-picture-card .upload-img-wrapper::before {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n content: \" \";\n background-color: rgb(29, 33, 38);\n border-radius: 4px;\n opacity: 0;\n transition: 0.3s;\n}\n.paraui-v4-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 overflow: hidden;\n font-size: 12px;\n line-height: 24px;\n color: rgb(255, 255, 255);\n text-align: center;\n text-overflow: ellipsis;\n white-space: nowrap;\n background-color: rgb(29, 33, 38);\n border-radius: 0 0 4px 4px;\n transition: 0.3s;\n}\n.paraui-v4-upload-image .upload-image-picture-card .upload-img-wrapper-action {\n position: absolute;\n top: 50%;\n left: 50%;\n line-height: 0;\n cursor: pointer;\n opacity: 0;\n transition: 0.3s;\n transform: translate(-50%, -50%);\n}\n.paraui-v4-upload-image .upload-image-picture-card .upload-img-wrapper-action svg {\n color: rgb(255, 255, 255);\n}\n.paraui-v4-upload-image .upload-image-picture-card .upload-img-wrapper:hover::before {\n opacity: 1;\n}\n.paraui-v4-upload-image .upload-image-picture-card .upload-img-wrapper:hover .upload-img-wrapper-name {\n opacity: 0;\n}\n.paraui-v4-upload-image .upload-image-picture-card .upload-img-wrapper:hover .upload-img-wrapper-action {\n opacity: 1;\n}\n.paraui-v4-upload-image .upload-image-picture-card .upload-image-icon {\n font-size: 30px;\n color: rgb(46, 101, 230);\n}\n.paraui-v4-upload-image .upload-image-picture-card .upload-image-loading {\n font-size: 30px;\n color: rgb(46, 101, 230);\n animation: imageLoadingCircle 1s infinite linear;\n}\n.paraui-v4-upload-image .upload-image-picture-card .upload-image-text {\n margin-top: 6px;\n color: inherit;\n text-align: center;\n transition: 0.3s;\n}\n.paraui-v4-upload-image .upload-image-picture-card .upload-image-text-loading {\n color: rgb(46, 101, 230);\n}\n@keyframes imageLoadingCircle {\n 100% {\n transform: rotate(360deg);\n }\n}";
|
|
276
209
|
styleInject(css_248z$2);
|
|
277
210
|
|
|
278
211
|
//ImageUpload
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
_props$loading = props.loading,
|
|
305
|
-
loading = _props$loading === void 0 ? false : _props$loading,
|
|
306
|
-
_props$showLoading = props.showLoading,
|
|
307
|
-
showLoadingProp = _props$showLoading === void 0 ? false : _props$showLoading,
|
|
308
|
-
defaultImage = props.defaultImage,
|
|
309
|
-
readonly = props.readonly,
|
|
212
|
+
const ImageUpload = props => {
|
|
213
|
+
const {
|
|
214
|
+
className,
|
|
215
|
+
style,
|
|
216
|
+
onStart,
|
|
217
|
+
onSuccess,
|
|
218
|
+
onError,
|
|
219
|
+
onProgress,
|
|
220
|
+
onRemove,
|
|
221
|
+
beforeUpload,
|
|
222
|
+
onChange,
|
|
223
|
+
defaultFileList = [],
|
|
224
|
+
fileList,
|
|
225
|
+
showUploadList = true,
|
|
226
|
+
maxCount,
|
|
227
|
+
children = null,
|
|
228
|
+
itemRender,
|
|
229
|
+
showUploadError = true,
|
|
230
|
+
stash = false,
|
|
231
|
+
uploading = true,
|
|
232
|
+
loading = false,
|
|
233
|
+
showLoading: showLoadingProp = false,
|
|
234
|
+
defaultImage,
|
|
235
|
+
readonly
|
|
236
|
+
} = props,
|
|
310
237
|
restProps = __rest(props, ["className", "style", "onStart", "onSuccess", "onError", "onProgress", "onRemove", "beforeUpload", "onChange", "defaultFileList", "fileList", "showUploadList", "maxCount", "children", "itemRender", "showUploadError", "stash", "uploading", "loading", "showLoading", "defaultImage", "readonly"]);
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
var _useState7 = useState({
|
|
325
|
-
imageUrl: ''
|
|
326
|
-
}),
|
|
327
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
328
|
-
avatar = _useState8[0],
|
|
329
|
-
setAvatar = _useState8[1]; //不显示列表时上传头像
|
|
330
|
-
var _ref = typeof showUploadList === 'boolean' ? {} : showUploadList,
|
|
331
|
-
showRemoveIcon = _ref.showRemoveIcon,
|
|
332
|
-
removeIcon = _ref.removeIcon; //显示上传列表
|
|
333
|
-
var _ref2 = typeof showUploadError === 'boolean' ? {} : showUploadError,
|
|
334
|
-
_ref2$uploadErrorMsg = _ref2.uploadErrorMsg,
|
|
335
|
-
uploadErrorMsg = _ref2$uploadErrorMsg === void 0 ? intl({
|
|
238
|
+
const intl = useFormatMessage('Upload', localeJson);
|
|
239
|
+
const [uploadFileList, setUploadFileList] = useState(defaultFileList); //文件列表
|
|
240
|
+
const [showLoading, setShowLoading] = useState(false); //upload loading
|
|
241
|
+
const [errTip, setErrTip] = useState(false); //upload error tip
|
|
242
|
+
const [avatar, setAvatar] = useState({
|
|
243
|
+
imageUrl: ''
|
|
244
|
+
}); //不显示列表时上传头像
|
|
245
|
+
const {
|
|
246
|
+
showRemoveIcon,
|
|
247
|
+
removeIcon
|
|
248
|
+
} = typeof showUploadList === 'boolean' ? {} : showUploadList; //显示上传列表
|
|
249
|
+
const {
|
|
250
|
+
uploadErrorMsg = intl({
|
|
336
251
|
id: 'uploadError'
|
|
337
|
-
})
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
useEffect(
|
|
252
|
+
}),
|
|
253
|
+
leaveDelay = 2000
|
|
254
|
+
} = typeof showUploadError === 'boolean' ? {} : showUploadError; //错误信息提示
|
|
255
|
+
const cropFileRef = useRef(); //裁剪文件
|
|
256
|
+
useEffect(() => {
|
|
342
257
|
setShowLoading(loading);
|
|
343
258
|
}, [loading]);
|
|
344
259
|
//复写属性
|
|
345
|
-
|
|
260
|
+
const overrideProps = Object.assign(Object.assign({
|
|
346
261
|
accept: 'image/*'
|
|
347
262
|
}, restProps), {
|
|
348
|
-
beforeUpload:
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
}
|
|
363
|
-
setShowLoading(false);
|
|
364
|
-
return _context.abrupt("return", false);
|
|
365
|
-
case 9:
|
|
366
|
-
if (!(_typeof(result) === 'object' && result)) {
|
|
367
|
-
_context.next = 16;
|
|
368
|
-
break;
|
|
369
|
-
}
|
|
370
|
-
if (!(result instanceof File || result instanceof Blob)) {
|
|
371
|
-
_context.next = 12;
|
|
372
|
-
break;
|
|
373
|
-
}
|
|
374
|
-
return _context.abrupt("return", result);
|
|
375
|
-
case 12:
|
|
376
|
-
cropFileRef.current = result.cropFile;
|
|
377
|
-
return _context.abrupt("return", result.isUpload);
|
|
378
|
-
case 16:
|
|
379
|
-
return _context.abrupt("return", true);
|
|
380
|
-
case 17:
|
|
381
|
-
case "end":
|
|
382
|
-
return _context.stop();
|
|
383
|
-
}
|
|
384
|
-
}, _callee);
|
|
385
|
-
}));
|
|
386
|
-
},
|
|
387
|
-
onStart: function onStart(file) {
|
|
388
|
-
_onStart === null || _onStart === void 0 ? void 0 : _onStart(file);
|
|
263
|
+
beforeUpload: (file, fileList) => __awaiter(void 0, void 0, void 0, function* () {
|
|
264
|
+
if (restProps.action && showLoadingProp && uploading) setShowLoading(true);
|
|
265
|
+
const result = yield beforeUpload === null || beforeUpload === void 0 ? void 0 : beforeUpload(file, fileList);
|
|
266
|
+
if (result === false) {
|
|
267
|
+
setShowLoading(false);
|
|
268
|
+
return false;
|
|
269
|
+
} else if (typeof result === 'object' && result) {
|
|
270
|
+
if (result instanceof File || result instanceof Blob) return result;
|
|
271
|
+
cropFileRef.current = result.cropFile;
|
|
272
|
+
return result.isUpload;
|
|
273
|
+
} else return true;
|
|
274
|
+
}),
|
|
275
|
+
onStart(file) {
|
|
276
|
+
onStart === null || onStart === void 0 ? void 0 : onStart(file);
|
|
389
277
|
},
|
|
390
|
-
onSuccess
|
|
278
|
+
onSuccess(response, file, xhr) {
|
|
391
279
|
setShowLoading(false);
|
|
392
280
|
errTip && showErrTip(false);
|
|
393
|
-
|
|
281
|
+
const nextFileList = updateFileList(file);
|
|
394
282
|
onInternalChange(nextFileList);
|
|
395
|
-
|
|
283
|
+
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(response, file, xhr);
|
|
396
284
|
},
|
|
397
|
-
onError
|
|
285
|
+
onError(error, response, file) {
|
|
398
286
|
setShowLoading(false);
|
|
399
287
|
showErrTip(!!showUploadError);
|
|
400
|
-
|
|
288
|
+
onError === null || onError === void 0 ? void 0 : onError(error, response, file);
|
|
401
289
|
},
|
|
402
|
-
onProgress
|
|
403
|
-
|
|
290
|
+
onProgress(e, file) {
|
|
291
|
+
onProgress === null || onProgress === void 0 ? void 0 : onProgress(e, file);
|
|
404
292
|
},
|
|
405
|
-
onBatchStart
|
|
293
|
+
onBatchStart(fileList) {
|
|
406
294
|
if (stash) {
|
|
407
295
|
if (cropFileRef.current) {
|
|
408
|
-
|
|
296
|
+
const idx = fileList.findIndex(_ => {
|
|
409
297
|
var _a;
|
|
410
298
|
return _.file.uid === ((_a = cropFileRef.current) === null || _a === void 0 ? void 0 : _a.uid);
|
|
411
299
|
});
|
|
@@ -416,62 +304,40 @@ var ImageUpload = function ImageUpload(props) {
|
|
|
416
304
|
});
|
|
417
305
|
}
|
|
418
306
|
}
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
});
|
|
422
|
-
var mList = mergedFileList(arr);
|
|
307
|
+
const arr = fileList.map(_ => _.parsedFile || _.file);
|
|
308
|
+
const mList = mergedFileList(arr);
|
|
423
309
|
onInternalChange(mList);
|
|
424
310
|
}
|
|
425
311
|
}
|
|
426
312
|
});
|
|
427
313
|
//内部变化
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
avatar.imageName = file.name;
|
|
452
|
-
setAvatar(Object.assign({}, avatar));
|
|
453
|
-
case 11:
|
|
454
|
-
onChange === null || onChange === void 0 ? void 0 : onChange([file]);
|
|
455
|
-
return _context2.abrupt("return");
|
|
456
|
-
case 13:
|
|
457
|
-
if (maxCount === 1) {
|
|
458
|
-
cloneList = cloneList.slice(-1);
|
|
459
|
-
} else if (maxCount) {
|
|
460
|
-
cloneList = cloneList.slice(0, maxCount);
|
|
461
|
-
}
|
|
462
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(cloneList);
|
|
463
|
-
setUploadFileList(cloneList);
|
|
464
|
-
case 16:
|
|
465
|
-
case "end":
|
|
466
|
-
return _context2.stop();
|
|
467
|
-
}
|
|
468
|
-
}, _callee2);
|
|
469
|
-
}));
|
|
470
|
-
};
|
|
314
|
+
const onInternalChange = changedFileList => __awaiter(void 0, void 0, void 0, function* () {
|
|
315
|
+
let cloneList = [...changedFileList];
|
|
316
|
+
if (!showUploadList) {
|
|
317
|
+
//不显示上传列表
|
|
318
|
+
const file = cloneList.slice(-1)[0];
|
|
319
|
+
if (file) {
|
|
320
|
+
const imageUrl = yield readerFileAsDataUrl(file);
|
|
321
|
+
file.dataUrl = imageUrl;
|
|
322
|
+
avatar.imageUrl = imageUrl;
|
|
323
|
+
avatar.imageName = file.name;
|
|
324
|
+
setAvatar(Object.assign({}, avatar));
|
|
325
|
+
}
|
|
326
|
+
onChange === null || onChange === void 0 ? void 0 : onChange([file]);
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
if (maxCount === 1) {
|
|
330
|
+
cloneList = cloneList.slice(-1);
|
|
331
|
+
} else if (maxCount) {
|
|
332
|
+
cloneList = cloneList.slice(0, maxCount);
|
|
333
|
+
}
|
|
334
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(cloneList);
|
|
335
|
+
setUploadFileList(cloneList);
|
|
336
|
+
});
|
|
471
337
|
//更新文件列表
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
338
|
+
const updateFileList = file => {
|
|
339
|
+
const cloneList = [...uploadFileList];
|
|
340
|
+
const fileObj = Object.assign(Object.assign({}, file), {
|
|
475
341
|
lastModified: file.lastModified,
|
|
476
342
|
lastModifiedDate: file.lastModifiedDate,
|
|
477
343
|
name: file.name,
|
|
@@ -483,9 +349,9 @@ var ImageUpload = function ImageUpload(props) {
|
|
|
483
349
|
return cloneList.concat(fileObj);
|
|
484
350
|
};
|
|
485
351
|
//合并文件列表
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
352
|
+
const mergedFileList = fileList => {
|
|
353
|
+
const cloneList = [...uploadFileList];
|
|
354
|
+
const newFileList = fileList.map(file => {
|
|
489
355
|
return Object.assign(Object.assign({}, file), {
|
|
490
356
|
lastModified: file.lastModified,
|
|
491
357
|
lastModifiedDate: file.lastModifiedDate,
|
|
@@ -499,71 +365,57 @@ var ImageUpload = function ImageUpload(props) {
|
|
|
499
365
|
return cloneList.concat(newFileList);
|
|
500
366
|
};
|
|
501
367
|
//删除文件
|
|
502
|
-
|
|
503
|
-
Promise.resolve(typeof onRemove === 'function' ? onRemove(file) : onRemove).then(
|
|
368
|
+
const handleRemove = file => {
|
|
369
|
+
Promise.resolve(typeof onRemove === 'function' ? onRemove(file) : onRemove).then(ret => {
|
|
504
370
|
// Prevent removing file
|
|
505
371
|
if (ret === false) return;
|
|
506
|
-
|
|
507
|
-
return _.uid === file.uid;
|
|
508
|
-
});
|
|
372
|
+
const idx = uploadFileList.findIndex(_ => _.uid === file.uid);
|
|
509
373
|
if (idx > -1) uploadFileList.splice(idx, 1);
|
|
510
374
|
onInternalChange(uploadFileList);
|
|
511
375
|
});
|
|
512
376
|
};
|
|
513
377
|
//读取dataUrl
|
|
514
|
-
|
|
515
|
-
return
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
fileReader.readAsDataURL(file.originFileObj);
|
|
526
|
-
} else resolve('');
|
|
527
|
-
}));
|
|
528
|
-
case 1:
|
|
529
|
-
case "end":
|
|
530
|
-
return _context3.stop();
|
|
531
|
-
}
|
|
532
|
-
}, _callee3);
|
|
533
|
-
}));
|
|
534
|
-
};
|
|
378
|
+
const readerFileAsDataUrl = file => __awaiter(void 0, void 0, void 0, function* () {
|
|
379
|
+
return new Promise(resolve => {
|
|
380
|
+
const fileReader = new FileReader();
|
|
381
|
+
if (file.originFileObj) {
|
|
382
|
+
fileReader.onload = () => {
|
|
383
|
+
resolve(fileReader.result);
|
|
384
|
+
};
|
|
385
|
+
fileReader.readAsDataURL(file.originFileObj);
|
|
386
|
+
} else resolve('');
|
|
387
|
+
});
|
|
388
|
+
});
|
|
535
389
|
//显示错误提示
|
|
536
|
-
|
|
390
|
+
const showErrTip = flag => {
|
|
537
391
|
setErrTip(flag);
|
|
538
392
|
if (leaveDelay < 0) return;
|
|
539
|
-
setTimeout(
|
|
393
|
+
setTimeout(() => {
|
|
540
394
|
setErrTip(false);
|
|
541
395
|
}, leaveDelay);
|
|
542
396
|
};
|
|
543
|
-
useEffect(
|
|
397
|
+
useEffect(() => {
|
|
544
398
|
if (fileList) {
|
|
545
|
-
setUploadFileList(
|
|
399
|
+
setUploadFileList([...fileList]);
|
|
546
400
|
}
|
|
547
401
|
}, [fileList]);
|
|
548
|
-
useEffect(
|
|
402
|
+
useEffect(() => {
|
|
549
403
|
if (defaultImage) {
|
|
550
404
|
setAvatar(Object.assign({}, defaultImage));
|
|
551
405
|
}
|
|
552
406
|
}, [defaultImage]);
|
|
553
407
|
//渲染上传列表
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
});
|
|
564
|
-
};
|
|
408
|
+
const renderUploadList = () => showUploadList && jsx(UploadList, {
|
|
409
|
+
listType: 'picture-card',
|
|
410
|
+
readonly: readonly,
|
|
411
|
+
items: uploadFileList,
|
|
412
|
+
showRemoveIcon: showRemoveIcon,
|
|
413
|
+
removeIcon: removeIcon,
|
|
414
|
+
onRemove: handleRemove,
|
|
415
|
+
itemRender: itemRender
|
|
416
|
+
});
|
|
565
417
|
//渲染内容
|
|
566
|
-
|
|
418
|
+
const renderUploadContent = () => {
|
|
567
419
|
var _a;
|
|
568
420
|
if (!showUploadList && avatar.imageUrl && !showLoading) {
|
|
569
421
|
return jsxs("div", Object.assign({
|
|
@@ -598,7 +450,7 @@ var ImageUpload = function ImageUpload(props) {
|
|
|
598
450
|
});
|
|
599
451
|
};
|
|
600
452
|
//渲染上传控件
|
|
601
|
-
|
|
453
|
+
const renderUploadSelector = () => {
|
|
602
454
|
if (readonly) return null;
|
|
603
455
|
return jsxs("div", Object.assign({
|
|
604
456
|
className: clsx('upload-image-select', showLoading && 'upload-image-select-loading')
|
|
@@ -626,7 +478,7 @@ var ImageUpload = function ImageUpload(props) {
|
|
|
626
478
|
};
|
|
627
479
|
|
|
628
480
|
//Dragger upload
|
|
629
|
-
|
|
481
|
+
const Dragger = props => {
|
|
630
482
|
return jsx(Upload, Object.assign({}, props, {
|
|
631
483
|
type: 'drag'
|
|
632
484
|
}));
|
|
@@ -791,336 +643,266 @@ var css_248z$1 = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2022/4/20
|
|
|
791
643
|
styleInject(css_248z$1);
|
|
792
644
|
|
|
793
645
|
//图片裁剪组件
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
aspect =
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
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 ? {
|
|
646
|
+
const ImgCrop = /*#__PURE__*/forwardRef((props, ref) => {
|
|
647
|
+
const {
|
|
648
|
+
aspect = 1,
|
|
649
|
+
shape = 'rect',
|
|
650
|
+
grid = false,
|
|
651
|
+
quality = 0.4,
|
|
652
|
+
fillColor = 'transparent',
|
|
653
|
+
zoom = true,
|
|
654
|
+
rotate = false,
|
|
655
|
+
minZoom = 1,
|
|
656
|
+
maxZoom = 3,
|
|
657
|
+
modalTitle,
|
|
658
|
+
modalWidth,
|
|
659
|
+
modalOk,
|
|
660
|
+
modalCancel,
|
|
661
|
+
onModalOk,
|
|
662
|
+
onModalCancel,
|
|
663
|
+
beforeCrop,
|
|
664
|
+
onUploadFail,
|
|
665
|
+
cropperProps,
|
|
666
|
+
children,
|
|
667
|
+
fixedCropSize = {
|
|
825
668
|
width: 120,
|
|
826
669
|
height: 120
|
|
827
|
-
}
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
var resolveRef = useRef();
|
|
836
|
-
var rejectRef = useRef();
|
|
670
|
+
}
|
|
671
|
+
} = props;
|
|
672
|
+
const intl = useFormatMessage('Upload', localeJson);
|
|
673
|
+
const [image, setImage] = useState('');
|
|
674
|
+
const fileRef = useRef();
|
|
675
|
+
const beforeUploadRef = useRef();
|
|
676
|
+
const resolveRef = useRef();
|
|
677
|
+
const rejectRef = useRef();
|
|
837
678
|
//存储回调
|
|
838
|
-
|
|
679
|
+
const cbRef = useRef({});
|
|
839
680
|
cbRef.current.onModalOk = onModalOk;
|
|
840
681
|
cbRef.current.onModalCancel = onModalCancel;
|
|
841
682
|
cbRef.current.beforeCrop = beforeCrop;
|
|
842
683
|
cbRef.current.onUploadFail = onUploadFail;
|
|
843
|
-
|
|
684
|
+
const easyCropRef = useRef({});
|
|
844
685
|
//上传组件
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
686
|
+
const uploadComponent = useMemo(() => {
|
|
687
|
+
const upload = Array.isArray(children) ? children[0] : children;
|
|
688
|
+
const _a = upload.props,
|
|
689
|
+
{
|
|
690
|
+
beforeUpload,
|
|
691
|
+
accept
|
|
692
|
+
} = _a,
|
|
850
693
|
restUploadProps = __rest(_a, ["beforeUpload", "accept"]);
|
|
851
694
|
beforeUploadRef.current = beforeUpload;
|
|
852
695
|
return Object.assign(Object.assign({}, upload), {
|
|
853
696
|
props: Object.assign(Object.assign({}, restUploadProps), {
|
|
854
697
|
accept: accept || 'image/*',
|
|
855
|
-
beforeUpload:
|
|
856
|
-
return new Promise(
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
return
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
var flag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
882
|
-
var _a, _b;
|
|
883
|
-
(_b = (_a = cbRef.current).onModalOk) === null || _b === void 0 ? void 0 : _b.call(_a, newFile);
|
|
884
|
-
if (!flag) return resolve({
|
|
885
|
-
cropFile: newFile,
|
|
886
|
-
isUpload: flag
|
|
887
|
-
});
|
|
888
|
-
resolve(newFile);
|
|
889
|
-
};
|
|
890
|
-
rejectRef.current = function (uploadErr) {
|
|
891
|
-
var _a, _b;
|
|
892
|
-
(_b = (_a = cbRef.current).onUploadFail) === null || _b === void 0 ? void 0 : _b.call(_a, uploadErr);
|
|
893
|
-
reject(uploadErr);
|
|
894
|
-
};
|
|
895
|
-
reader = new FileReader();
|
|
896
|
-
reader.addEventListener('load', function () {
|
|
897
|
-
return typeof reader.result === 'string' && setImage(reader.result);
|
|
898
|
-
});
|
|
899
|
-
reader.readAsDataURL(file);
|
|
900
|
-
case 14:
|
|
901
|
-
case "end":
|
|
902
|
-
return _context.stop();
|
|
903
|
-
}
|
|
904
|
-
}, _callee);
|
|
905
|
-
}));
|
|
906
|
-
});
|
|
698
|
+
beforeUpload: (file, fileList) => {
|
|
699
|
+
return new Promise((resolve, reject) => __awaiter(void 0, void 0, void 0, function* () {
|
|
700
|
+
if (cbRef.current.beforeCrop && !(yield cbRef.current.beforeCrop(file, fileList))) {
|
|
701
|
+
reject();
|
|
702
|
+
return;
|
|
703
|
+
}
|
|
704
|
+
fileRef.current = file;
|
|
705
|
+
resolveRef.current = function (newFile) {
|
|
706
|
+
let flag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
707
|
+
var _a, _b;
|
|
708
|
+
(_b = (_a = cbRef.current).onModalOk) === null || _b === void 0 ? void 0 : _b.call(_a, newFile);
|
|
709
|
+
if (!flag) return resolve({
|
|
710
|
+
cropFile: newFile,
|
|
711
|
+
isUpload: flag
|
|
712
|
+
});
|
|
713
|
+
resolve(newFile);
|
|
714
|
+
};
|
|
715
|
+
rejectRef.current = uploadErr => {
|
|
716
|
+
var _a, _b;
|
|
717
|
+
(_b = (_a = cbRef.current).onUploadFail) === null || _b === void 0 ? void 0 : _b.call(_a, uploadErr);
|
|
718
|
+
reject(uploadErr);
|
|
719
|
+
};
|
|
720
|
+
const reader = new FileReader();
|
|
721
|
+
reader.addEventListener('load', () => typeof reader.result === 'string' && setImage(reader.result));
|
|
722
|
+
reader.readAsDataURL(file);
|
|
723
|
+
}));
|
|
907
724
|
}
|
|
908
725
|
})
|
|
909
726
|
});
|
|
910
727
|
}, [children]);
|
|
911
728
|
//modal 关闭后操作
|
|
912
|
-
|
|
729
|
+
const onClose = () => {
|
|
913
730
|
setImage('');
|
|
914
731
|
easyCropRef.current.setZoomVal(INIT_ZOOM);
|
|
915
732
|
easyCropRef.current.setRotateVal(INIT_ROTATE);
|
|
916
733
|
};
|
|
917
734
|
//modal cancel
|
|
918
|
-
|
|
735
|
+
const onCancel = useCallback(() => {
|
|
919
736
|
var _a, _b;
|
|
920
737
|
(_b = (_a = cbRef.current).onModalCancel) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
921
738
|
onClose();
|
|
922
739
|
}, []);
|
|
923
740
|
//modal ok
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
case 14:
|
|
1054
|
-
if (!(res && res instanceof Promise)) {
|
|
1055
|
-
_context2.next = 27;
|
|
1056
|
-
break;
|
|
1057
|
-
}
|
|
1058
|
-
_context2.prev = 15;
|
|
1059
|
-
_context2.next = 18;
|
|
1060
|
-
return res;
|
|
1061
|
-
case 18:
|
|
1062
|
-
passedFile = _context2.sent;
|
|
1063
|
-
if (!(passedFile instanceof File || passedFile instanceof Blob)) {
|
|
1064
|
-
_context2.next = 21;
|
|
1065
|
-
break;
|
|
1066
|
-
}
|
|
1067
|
-
return _context2.abrupt("return", (_d = resolveRef.current) === null || _d === void 0 ? void 0 : _d.call(resolveRef, passedFile));
|
|
1068
|
-
case 21:
|
|
1069
|
-
(_e = resolveRef.current) === null || _e === void 0 ? void 0 : _e.call(resolveRef, changeFile, passedFile);
|
|
1070
|
-
_context2.next = 27;
|
|
1071
|
-
break;
|
|
1072
|
-
case 24:
|
|
1073
|
-
_context2.prev = 24;
|
|
1074
|
-
_context2.t0 = _context2["catch"](15);
|
|
1075
|
-
(_f = rejectRef.current) === null || _f === void 0 ? void 0 : _f.call(rejectRef, _context2.t0);
|
|
1076
|
-
case 27:
|
|
1077
|
-
case "end":
|
|
1078
|
-
return _context2.stop();
|
|
1079
|
-
}
|
|
1080
|
-
}, _callee2, null, [[15, 24]]);
|
|
1081
|
-
}));
|
|
1082
|
-
};
|
|
1083
|
-
canvas.toBlob(onBlob, type, quality);
|
|
1084
|
-
case 11:
|
|
1085
|
-
case "end":
|
|
1086
|
-
return _context3.stop();
|
|
741
|
+
const onOk = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
742
|
+
onClose();
|
|
743
|
+
const canvas = document.createElement('canvas');
|
|
744
|
+
const ctx = canvas.getContext('2d');
|
|
745
|
+
const imgSource = document.querySelector(".".concat(PREFIX, "-media"));
|
|
746
|
+
const {
|
|
747
|
+
width: cropWidth,
|
|
748
|
+
height: cropHeight,
|
|
749
|
+
x: cropX,
|
|
750
|
+
y: cropY
|
|
751
|
+
} = easyCropRef.current.cropPixelsRef.current;
|
|
752
|
+
if (rotate && easyCropRef.current.rotateVal !== INIT_ROTATE) {
|
|
753
|
+
const {
|
|
754
|
+
naturalWidth: imgWidth,
|
|
755
|
+
naturalHeight: imgHeight
|
|
756
|
+
} = imgSource;
|
|
757
|
+
const angle = easyCropRef.current.rotateVal * (Math.PI / 180);
|
|
758
|
+
// get container for rotated image
|
|
759
|
+
const sine = Math.abs(Math.sin(angle));
|
|
760
|
+
const cosine = Math.abs(Math.cos(angle));
|
|
761
|
+
const squareWidth = imgWidth * cosine + imgHeight * sine;
|
|
762
|
+
const squareHeight = imgHeight * cosine + imgWidth * sine;
|
|
763
|
+
canvas.width = squareWidth;
|
|
764
|
+
canvas.height = squareHeight;
|
|
765
|
+
ctx.fillStyle = fillColor;
|
|
766
|
+
ctx.fillRect(0, 0, squareWidth, squareHeight);
|
|
767
|
+
// rotate container
|
|
768
|
+
const squareHalfWidth = squareWidth / 2;
|
|
769
|
+
const squareHalfHeight = squareHeight / 2;
|
|
770
|
+
ctx.translate(squareHalfWidth, squareHalfHeight);
|
|
771
|
+
ctx.rotate(angle);
|
|
772
|
+
ctx.translate(-squareHalfWidth, -squareHalfHeight);
|
|
773
|
+
// draw rotated image
|
|
774
|
+
const imgX = (squareWidth - imgWidth) / 2;
|
|
775
|
+
const imgY = (squareHeight - imgHeight) / 2;
|
|
776
|
+
ctx.drawImage(imgSource, 0, 0, imgWidth, imgHeight, imgX, imgY, imgWidth, imgHeight);
|
|
777
|
+
// crop rotated image
|
|
778
|
+
const imgData = ctx.getImageData(0, 0, squareWidth, squareHeight);
|
|
779
|
+
canvas.width = cropWidth;
|
|
780
|
+
canvas.height = cropHeight;
|
|
781
|
+
ctx.putImageData(imgData, -cropX, -cropY);
|
|
782
|
+
} else {
|
|
783
|
+
canvas.width = cropWidth;
|
|
784
|
+
canvas.height = cropHeight;
|
|
785
|
+
ctx.fillStyle = fillColor;
|
|
786
|
+
ctx.fillRect(0, 0, cropWidth, cropHeight);
|
|
787
|
+
ctx.drawImage(imgSource, cropX, cropY, cropWidth, cropHeight, 0, 0, cropWidth, cropHeight);
|
|
788
|
+
}
|
|
789
|
+
//裁剪之后改变图片大小
|
|
790
|
+
const changeImageSizeAfterCrop = newFile => {
|
|
791
|
+
return new Promise(resolve => {
|
|
792
|
+
const {
|
|
793
|
+
name,
|
|
794
|
+
type,
|
|
795
|
+
uid
|
|
796
|
+
} = newFile;
|
|
797
|
+
const {
|
|
798
|
+
width,
|
|
799
|
+
height
|
|
800
|
+
} = fixedCropSize; //固定裁剪大小
|
|
801
|
+
const changeCanvas = document.createElement('canvas');
|
|
802
|
+
const changeCtx = changeCanvas.getContext('2d');
|
|
803
|
+
const img = new Image();
|
|
804
|
+
img.onload = () => {
|
|
805
|
+
changeCanvas.width = width;
|
|
806
|
+
changeCanvas.height = height;
|
|
807
|
+
changeCtx.drawImage(img, 0, 0, width, height);
|
|
808
|
+
changeCanvas.toBlob(cBlob => {
|
|
809
|
+
const changeFile = Object.assign(new File([cBlob], name, {
|
|
810
|
+
type
|
|
811
|
+
}), {
|
|
812
|
+
uid
|
|
813
|
+
});
|
|
814
|
+
resolve(changeFile);
|
|
815
|
+
}, type, quality);
|
|
816
|
+
};
|
|
817
|
+
img.onerror = () => {
|
|
818
|
+
resolve(newFile);
|
|
819
|
+
};
|
|
820
|
+
const fileReader = new FileReader();
|
|
821
|
+
fileReader.onload = () => {
|
|
822
|
+
img.src = fileReader.result;
|
|
823
|
+
};
|
|
824
|
+
fileReader.onerror = () => {
|
|
825
|
+
resolve(newFile);
|
|
826
|
+
};
|
|
827
|
+
fileReader.readAsDataURL(newFile);
|
|
828
|
+
});
|
|
829
|
+
};
|
|
830
|
+
// get the new image
|
|
831
|
+
let {
|
|
832
|
+
type,
|
|
833
|
+
name,
|
|
834
|
+
uid
|
|
835
|
+
} = fileRef.current;
|
|
836
|
+
if (/svg/gi.test(type)) {
|
|
837
|
+
//svg 转为 png
|
|
838
|
+
type = 'image/png';
|
|
839
|
+
const idx = name.lastIndexOf('.');
|
|
840
|
+
if (idx > -1) name = "".concat(name.substring(0, idx), ".png");
|
|
841
|
+
}
|
|
842
|
+
//转为blob
|
|
843
|
+
const onBlob = blob => __awaiter(void 0, void 0, void 0, function* () {
|
|
844
|
+
var _a, _b, _c, _d, _e, _f;
|
|
845
|
+
const newFile = Object.assign(new File([blob], name, {
|
|
846
|
+
type
|
|
847
|
+
}), {
|
|
848
|
+
uid
|
|
849
|
+
});
|
|
850
|
+
const changeFile = yield changeImageSizeAfterCrop(newFile);
|
|
851
|
+
if (typeof beforeUploadRef.current !== 'function') {
|
|
852
|
+
return (_a = resolveRef.current) === null || _a === void 0 ? void 0 : _a.call(resolveRef, changeFile);
|
|
853
|
+
}
|
|
854
|
+
const res = beforeUploadRef.current(changeFile, [changeFile]);
|
|
855
|
+
if (typeof res !== 'boolean' && !res) {
|
|
856
|
+
console.error('beforeUpload must return a boolean or Promise');
|
|
857
|
+
return;
|
|
858
|
+
}
|
|
859
|
+
if (res === true) return (_b = resolveRef.current) === null || _b === void 0 ? void 0 : _b.call(resolveRef, changeFile);
|
|
860
|
+
if (res === false) return (_c = resolveRef.current) === null || _c === void 0 ? void 0 : _c.call(resolveRef, changeFile, false);
|
|
861
|
+
if (res && res instanceof Promise) {
|
|
862
|
+
try {
|
|
863
|
+
const passedFile = yield res;
|
|
864
|
+
if (passedFile instanceof File || passedFile instanceof Blob) {
|
|
865
|
+
return (_d = resolveRef.current) === null || _d === void 0 ? void 0 : _d.call(resolveRef, passedFile);
|
|
866
|
+
}
|
|
867
|
+
(_e = resolveRef.current) === null || _e === void 0 ? void 0 : _e.call(resolveRef, changeFile, passedFile);
|
|
868
|
+
} catch (err) {
|
|
869
|
+
(_f = rejectRef.current) === null || _f === void 0 ? void 0 : _f.call(rejectRef, err);
|
|
1087
870
|
}
|
|
1088
|
-
}
|
|
1089
|
-
}));
|
|
1090
|
-
}, [fillColor, quality, rotate]);
|
|
1091
|
-
//img crop 组件
|
|
1092
|
-
var getComponent = function getComponent(titleOfModal) {
|
|
1093
|
-
return jsxs(Fragment, {
|
|
1094
|
-
children: [uploadComponent, image && jsx(Modal, Object.assign({
|
|
1095
|
-
open: true,
|
|
1096
|
-
className: "".concat(PREFIX, "-modal"),
|
|
1097
|
-
size: 'md',
|
|
1098
|
-
title: titleOfModal !== null && titleOfModal !== void 0 ? titleOfModal : intl({
|
|
1099
|
-
id: 'editImage'
|
|
1100
|
-
}),
|
|
1101
|
-
onOk: onOk,
|
|
1102
|
-
onCancel: onCancel,
|
|
1103
|
-
okText: modalOk,
|
|
1104
|
-
cancelText: modalCancel,
|
|
1105
|
-
contentWidth: modalWidth
|
|
1106
|
-
}, {
|
|
1107
|
-
children: jsx(EasyCrop$1, {
|
|
1108
|
-
ref: easyCropRef,
|
|
1109
|
-
cropperRef: ref,
|
|
1110
|
-
image: image,
|
|
1111
|
-
aspect: aspect,
|
|
1112
|
-
shape: shape,
|
|
1113
|
-
grid: grid,
|
|
1114
|
-
zoom: zoom,
|
|
1115
|
-
rotate: rotate,
|
|
1116
|
-
minZoom: minZoom,
|
|
1117
|
-
maxZoom: maxZoom,
|
|
1118
|
-
fixedCropSize: fixedCropSize,
|
|
1119
|
-
cropperProps: cropperProps
|
|
1120
|
-
})
|
|
1121
|
-
}))]
|
|
871
|
+
}
|
|
1122
872
|
});
|
|
1123
|
-
|
|
873
|
+
canvas.toBlob(onBlob, type, quality);
|
|
874
|
+
}), [fillColor, quality, rotate]);
|
|
875
|
+
//img crop 组件
|
|
876
|
+
const getComponent = titleOfModal => jsxs(Fragment, {
|
|
877
|
+
children: [uploadComponent, image && jsx(Modal, Object.assign({
|
|
878
|
+
open: true,
|
|
879
|
+
className: "".concat(PREFIX, "-modal"),
|
|
880
|
+
size: 'md',
|
|
881
|
+
title: titleOfModal !== null && titleOfModal !== void 0 ? titleOfModal : intl({
|
|
882
|
+
id: 'editImage'
|
|
883
|
+
}),
|
|
884
|
+
onOk: onOk,
|
|
885
|
+
onCancel: onCancel,
|
|
886
|
+
okText: modalOk,
|
|
887
|
+
cancelText: modalCancel,
|
|
888
|
+
contentWidth: modalWidth
|
|
889
|
+
}, {
|
|
890
|
+
children: jsx(EasyCrop$1, {
|
|
891
|
+
ref: easyCropRef,
|
|
892
|
+
cropperRef: ref,
|
|
893
|
+
image: image,
|
|
894
|
+
aspect: aspect,
|
|
895
|
+
shape: shape,
|
|
896
|
+
grid: grid,
|
|
897
|
+
zoom: zoom,
|
|
898
|
+
rotate: rotate,
|
|
899
|
+
minZoom: minZoom,
|
|
900
|
+
maxZoom: maxZoom,
|
|
901
|
+
fixedCropSize: fixedCropSize,
|
|
902
|
+
cropperProps: cropperProps
|
|
903
|
+
})
|
|
904
|
+
}))]
|
|
905
|
+
});
|
|
1124
906
|
return jsx(Fragment, {
|
|
1125
907
|
children: getComponent(modalTitle)
|
|
1126
908
|
});
|