@para-ui/core 4.0.29 → 4.0.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/AutoButton/index.d.ts +41 -0
  2. package/AutoButton/index.js +213 -0
  3. package/AutoButton/lang/en_US.d.ts +4 -0
  4. package/AutoButton/lang/index.d.ts +9 -0
  5. package/AutoButton/lang/zh_CN.d.ts +4 -0
  6. package/Badge/index.d.ts +3 -1
  7. package/Badge/index.js +15 -5
  8. package/Card/index.d.ts +53 -0
  9. package/Card/index.js +218 -0
  10. package/Card/lang/en_US.d.ts +5 -0
  11. package/Card/lang/index.d.ts +11 -0
  12. package/Card/lang/zh_CN.d.ts +5 -0
  13. package/Cascader/index.js +6 -7
  14. package/ComboSelect/index.js +7 -4
  15. package/CycleSelector/index.js +3 -1
  16. package/DatePicker/index.js +3 -1
  17. package/DragVerify/index.js +7 -2
  18. package/DynamicMultiBox/index.js +8 -6
  19. package/Form/index.js +8 -5
  20. package/FormItem/index.js +8 -5
  21. package/Image/index.js +3 -4
  22. package/PopConfirm/index.js +2 -2
  23. package/PopMenu/index.js +16 -5
  24. package/QuickReply/index.js +1 -1
  25. package/README.md +14 -0
  26. package/RangeInput/index.d.ts +59 -0
  27. package/RangeInput/index.js +193 -0
  28. package/Select/index.js +2 -2
  29. package/Selector/index.js +282 -548
  30. package/SelectorPicker/index.js +5 -5
  31. package/SingleBox/index.js +2 -2
  32. package/SortBox/index.d.ts +27 -0
  33. package/SortBox/index.js +64 -0
  34. package/Stepper/index.js +1 -1
  35. package/Switch/index.js +2 -2
  36. package/Table/index.js +471 -409
  37. package/Tabs/index.js +2 -2
  38. package/Tag/index.js +82 -53
  39. package/TextEditor/index.js +3 -3
  40. package/TimePicker/index.js +3 -1
  41. package/Timeline/index.js +14 -20
  42. package/ToggleButton/index.js +25 -26
  43. package/Transfer/index.js +48 -43
  44. package/Tree/index.js +8 -5
  45. package/Upload/ImageUpload/index.d.ts +2 -7
  46. package/Upload/index.js +848 -495
  47. package/Upload/interface.d.ts +18 -0
  48. package/_verture/{Portal-5bd49559.js → Portal-edd94cac.js} +2 -2
  49. package/_verture/{index-15a0b6a6.js → index-3795d730.js} +1 -1
  50. package/_verture/{index-e9405e35.js → index-567b5779.js} +395 -313
  51. package/_verture/{index-68f0506c.js → index-8752ccab.js} +4 -5
  52. package/_verture/index-94e24006.js +327 -0
  53. package/_verture/{slicedToArray-a8206399.js → slicedToArray-75fa4188.js} +15 -2
  54. package/_verture/{toConsumableArray-8f4c9589.js → toConsumableArray-c7a8028f.js} +1 -1
  55. package/index.d.ts +8 -0
  56. package/index.js +16 -11
  57. package/locale/en-US.d.ts +7 -0
  58. package/locale/index.d.ts +14 -0
  59. package/locale/index.js +14 -0
  60. package/locale/zh-CN.d.ts +7 -0
  61. package/package.json +2 -4
  62. package/umd/AutoButton.js +43 -0
  63. package/umd/Badge.js +1 -1
  64. package/umd/Card.js +1 -0
  65. package/umd/DragVerify.js +1 -1
  66. package/umd/FunctionModal.js +3 -3
  67. package/umd/Modal.js +2 -2
  68. package/umd/PopMenu.js +2 -2
  69. package/umd/RangeInput.js +43 -0
  70. package/umd/SortBox.js +41 -0
  71. package/umd/Upload.js +4 -4
  72. package/umd/locale.js +1 -1
  73. package/_verture/unsupportedIterableToArray-cb478f24.js +0 -16
  74. /package/_verture/{index-0f5ee6f7.js → index-c8cb6751.js} +0 -0
  75. /package/_verture/{typeof-6ec38efd.js → typeof-4646b22c.js} +0 -0
package/Upload/index.js CHANGED
@@ -5,7 +5,12 @@ import RcUpload from 'rc-upload';
5
5
  import clsx from 'clsx';
6
6
  import UploadIcon from '@para-ui/icons/UploadFile';
7
7
  import LoadingIcon from '@para-ui/icons/Loading';
8
+ import { _ as _toConsumableArray } from '../_verture/toConsumableArray-c7a8028f.js';
9
+ import { _ as _typeof } from '../_verture/typeof-adeedc13.js';
10
+ import { _ as _slicedToArray } from '../_verture/slicedToArray-75fa4188.js';
11
+ import { r as regenerator } from '../_verture/index-94e24006.js';
8
12
  import EditOutline from '@para-ui/icons/EditOutline';
13
+ import CloseIcon from '@para-ui/icons/Close';
9
14
  import Delete from '@para-ui/icons/Delete';
10
15
  import FileOutlined from '@para-ui/icons/Document';
11
16
  import PhotoIcon from '@para-ui/icons/Photo';
@@ -18,9 +23,8 @@ import OperateBtn from '../OperateBtn/index.js';
18
23
  import { $ as $prefixCls, a as $rcPrefixCls } from '../_verture/constant-5317fc89.js';
19
24
  import { s as styleInject } from '../_verture/style-inject.es-300983ab.js';
20
25
  import Forbid from '@para-ui/icons/Forbid';
21
- import { u as useFormatMessage } from '../_verture/useFormatMessage-1fc7c957.js';
22
26
  import { Button } from '../Button/index.js';
23
- import { _ as _slicedToArray } from '../_verture/slicedToArray-a8206399.js';
27
+ import { u as useFormatMessage } from '../_verture/useFormatMessage-1fc7c957.js';
24
28
  import Cropper from 'react-easy-crop';
25
29
  import PlusCircle from '@para-ui/icons/PlusCircle';
26
30
  import MinusCircle from '@para-ui/icons/MinusCircle';
@@ -28,14 +32,12 @@ import TurnRight from '@para-ui/icons/TurnRight';
28
32
  import TurnLeft from '@para-ui/icons/TurnLeft';
29
33
  import { Slider } from '../Slider/index.js';
30
34
  import { Modal } from '../Modal/index.js';
35
+ import '../_verture/typeof-4646b22c.js';
31
36
  import 'rc-tooltip';
32
37
  import 'rc-tooltip/lib/placements';
33
38
  import '@paraview/lib';
34
- import '../_verture/Portal-5bd49559.js';
39
+ import '../_verture/Portal-edd94cac.js';
35
40
  import 'react-dom';
36
- import '../_verture/typeof-adeedc13.js';
37
- import '../_verture/toConsumableArray-8f4c9589.js';
38
- import '../_verture/unsupportedIterableToArray-cb478f24.js';
39
41
  import '../_verture/defineProperty-6f62bb2a.js';
40
42
  import 'rc-dialog';
41
43
  import 'rc-motion';
@@ -57,7 +59,6 @@ import 'rc-dropdown';
57
59
  import 'dayjs';
58
60
  import '../_verture/index-ca413216.js';
59
61
  import 'rc-slider';
60
- import '@para-ui/icons/Close';
61
62
 
62
63
  var extname = function extname() {
63
64
  var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
@@ -92,7 +93,11 @@ var isImageUrl = function isImageUrl(file) {
92
93
  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: 10px;\n position: relative;\n}\n.paraui-v4-upload-list-text .upload-list-item-info {\n display: flex;\n align-items: center;\n line-height: 30px;\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 width: 440px;\n height: 30px;\n background-color: rgb(247, 248, 250);\n border-radius: 4px;\n}\n.paraui-v4-upload-list-text .upload-list-item-info .upload-list-text .upload-list-text-item {\n display: flex;\n align-items: center;\n flex: 1;\n padding-left: 10px;\n max-width: 76%;\n}\n.paraui-v4-upload-list-text .upload-list-item-info .upload-list-text .upload-list-text-item .upload-list-text-name {\n margin-left: 8px;\n}\n.paraui-v4-upload-list-text .upload-list-item-info .upload-list-text .upload-list-text-item .upload-list-text-name {\n color: rgb(29, 33, 38);\n text-decoration: none;\n}\n.paraui-v4-upload-list-text .upload-list-item-info .upload-list-text .upload-list-text-item .upload-list-text-name:hover {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-upload-list-text .upload-list-item-info .upload-list-text .upload-list-text-item-error {\n color: rgb(244, 66, 66);\n cursor: pointer;\n}\n.paraui-v4-upload-list-text .upload-list-item-info .upload-list-text .upload-list-text-item-error .upload-list-text-name,\n.paraui-v4-upload-list-text .upload-list-item-info .upload-list-text .upload-list-text-item-error .upload-list-text-name:hover {\n color: rgb(244, 66, 66);\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: 18px;\n}\n.paraui-v4-upload-list-text .upload-list-item-info .upload-list-text .upload-list-actions svg {\n font-size: 18px;\n}\n.paraui-v4-upload-list-text .upload-list-item-info .upload-list-text .upload-list-actions svg:hover {\n background-color: rgb(234, 236, 241);\n border-radius: 2px;\n}\n.paraui-v4-upload-list-text .upload-list-item .upload-list-actions {\n margin-left: auto;\n margin-right: 10px;\n}\n.paraui-v4-upload-list-text .upload-list-item .upload-list-actions > span {\n display: flex;\n align-items: center;\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-error {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n background: rgb(247, 248, 250);\n border: 1px dashed rgb(246, 103, 103);\n border-radius: 4px;\n color: rgb(246, 103, 103);\n}\n.paraui-v4-upload-list-picture .upload-list-picture-error > svg {\n font-size: 30px;\n color: rgb(244, 66, 66);\n margin-bottom: 6px;\n}\n.paraui-v4-upload-list-picture .upload-list-picture-error-name {\n font-size: 14px;\n color: rgb(244, 66, 66);\n padding: 0 10px;\n width: 100%;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n text-align: 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 overflow: hidden;\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: rgba(29, 33, 38, 0.9);\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-file {\n font-size: 100px;\n}\n.paraui-v4-upload-list-picture .upload-list-picture-item .upload-list-picture-filea {\n fill: none;\n}\n.paraui-v4-upload-list-picture .upload-list-picture-item .upload-list-picture-fileb {\n opacity: 0.4;\n}\n.paraui-v4-upload-list-picture .upload-list-picture-item .upload-list-picture-filec {\n fill: #2e65e6;\n}\n.paraui-v4-upload-list-picture .upload-list-picture-item .upload-list-picture-filed {\n fill: #5783eb;\n}\n.paraui-v4-upload-list-picture .upload-list-picture-item .upload-list-picture-filee {\n fill: #ffb900;\n}\n.paraui-v4-upload-list-picture .upload-list-picture-item .upload-list-picture-filef {\n fill: #fff;\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: rgba(29, 33, 38, 0.9);\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 transition: all 0.3s;\n}\n.paraui-v4-upload-list-picture .upload-list-picture-item .upload-list-actions svg:hover {\n background-color: rgba(255, 255, 255, 0.3);\n border-radius: 2px;\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}\n\n.paraui-v4-upload-drag .paraui-v4-upload-list-text .upload-list-item-info .upload-list-text {\n width: 590px;\n}";
93
94
  styleInject(css_248z$4);
94
95
 
95
- const FileIcon = props => {
96
+ 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; } } }; }
97
+ 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); }
98
+ 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; }
99
+ var FileIcon = function FileIcon(props) {
100
+ props.className;
96
101
  return jsxs("svg", Object.assign({
97
102
  viewBox: "0 0 180 180",
98
103
  className: 'upload-list-picture-file'
@@ -177,59 +182,104 @@ const FileIcon = props => {
177
182
  }));
178
183
  };
179
184
  //UploadList
180
- const UploadList = props => {
181
- const {
182
- listType = 'text',
183
- items = [],
184
- onRemove,
185
- showRemoveIcon = true,
186
- showPreviewIcon = true,
187
- previewIcon,
188
- removeIcon,
189
- itemRender,
190
- readonly,
191
- operateBtnProps,
192
- actionRender,
193
- onPreview
194
- } = props;
195
- const [uploadList, setUploadList] = useState([]);
196
- const [visible, setVisible] = useState(false);
197
- const [current, setCurrent] = useState(0);
185
+ var UploadList = function UploadList(props) {
186
+ var _props$listType = props.listType,
187
+ listType = _props$listType === void 0 ? 'text' : _props$listType,
188
+ _props$items = props.items,
189
+ items = _props$items === void 0 ? [] : _props$items,
190
+ _onRemove = props.onRemove,
191
+ _props$showRemoveIcon = props.showRemoveIcon,
192
+ showRemoveIcon = _props$showRemoveIcon === void 0 ? true : _props$showRemoveIcon,
193
+ _props$showPreviewIco = props.showPreviewIcon,
194
+ showPreviewIcon = _props$showPreviewIco === void 0 ? true : _props$showPreviewIco,
195
+ previewIcon = props.previewIcon,
196
+ removeIcon = props.removeIcon,
197
+ itemRender = props.itemRender,
198
+ readonly = props.readonly,
199
+ operateBtnProps = props.operateBtnProps,
200
+ actionRender = props.actionRender,
201
+ onPreview = props.onPreview;
202
+ var _useState = useState([]),
203
+ _useState2 = _slicedToArray(_useState, 2),
204
+ uploadList = _useState2[0],
205
+ setUploadList = _useState2[1];
206
+ var _useState3 = useState(false),
207
+ _useState4 = _slicedToArray(_useState3, 2),
208
+ visible = _useState4[0],
209
+ setVisible = _useState4[1];
210
+ var _useState5 = useState(0),
211
+ _useState6 = _slicedToArray(_useState5, 2),
212
+ current = _useState6[0],
213
+ setCurrent = _useState6[1];
198
214
  useRef(null);
199
215
  //处理删除
200
- const handleRemove = (file, evt) => {
216
+ var handleRemove = function handleRemove(file, evt) {
201
217
  evt.stopPropagation();
202
- onRemove === null || onRemove === void 0 ? void 0 : onRemove(file);
218
+ _onRemove === null || _onRemove === void 0 ? void 0 : _onRemove(file);
203
219
  };
204
- const isError = file => file.status === 'error';
205
- const onImageError = file => {
220
+ var isError = function isError(file) {
221
+ return file.status === 'error';
222
+ };
223
+ var onImageError = function onImageError(file) {
206
224
  if (file.status === 'error') return;
207
225
  file.status = 'error';
208
- setUploadList([...uploadList]);
226
+ setUploadList(_toConsumableArray(uploadList));
209
227
  };
210
- const previewItems = useMemo(() => {
228
+ var previewItems = useMemo(function () {
211
229
  var _a;
212
- const originItems = items === null || items === void 0 ? void 0 : items.filter(item => isImageUrl(item) && !isError(item));
230
+ var originItems = items === null || items === void 0 ? void 0 : items.filter(function (item) {
231
+ return isImageUrl(item) && !isError(item);
232
+ });
213
233
  return {
214
- items: ((_a = originItems === null || originItems === void 0 ? void 0 : originItems.map(i => i.url || i.thumbUrl)) === null || _a === void 0 ? void 0 : _a.filter(i => !!i)) || [],
234
+ items: ((_a = originItems === null || originItems === void 0 ? void 0 : originItems.map(function (i) {
235
+ return i.url || i.thumbUrl;
236
+ })) === null || _a === void 0 ? void 0 : _a.filter(function (i) {
237
+ return !!i;
238
+ })) || [],
215
239
  originItems: originItems
216
240
  };
217
241
  }, [items]);
218
- const getCurrent = file => {
219
- return previewItems.originItems.findIndex(i => i.uid === file.uid);
242
+ var getCurrent = function getCurrent(file) {
243
+ return previewItems.originItems.findIndex(function (i) {
244
+ return i.uid === file.uid;
245
+ });
220
246
  };
221
247
  // 处理预览
222
- const handlePreview = (file, e) => __awaiter(void 0, void 0, void 0, function* () {
223
- const shouldPreview = yield onPreview === null || onPreview === void 0 ? void 0 : onPreview(file, e);
224
- if (shouldPreview === false) return;
225
- const currentIndex = getCurrent(file);
226
- if (currentIndex === -1) return;
227
- setCurrent(currentIndex);
228
- setVisible(true);
229
- });
248
+ var handlePreview = function handlePreview(file, e) {
249
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee() {
250
+ var shouldPreview, currentIndex;
251
+ return regenerator.wrap(function _callee$(_context) {
252
+ while (1) switch (_context.prev = _context.next) {
253
+ case 0:
254
+ _context.next = 2;
255
+ return onPreview === null || onPreview === void 0 ? void 0 : onPreview(file, e);
256
+ case 2:
257
+ shouldPreview = _context.sent;
258
+ if (!(shouldPreview === false)) {
259
+ _context.next = 5;
260
+ break;
261
+ }
262
+ return _context.abrupt("return");
263
+ case 5:
264
+ currentIndex = getCurrent(file);
265
+ if (!(currentIndex === -1)) {
266
+ _context.next = 8;
267
+ break;
268
+ }
269
+ return _context.abrupt("return");
270
+ case 8:
271
+ setCurrent(currentIndex);
272
+ setVisible(true);
273
+ case 10:
274
+ case "end":
275
+ return _context.stop();
276
+ }
277
+ }, _callee);
278
+ }));
279
+ };
230
280
  // 图片墙操作按钮
231
- const pictureCardAction = file => {
232
- const list = [];
281
+ var pictureCardAction = function pictureCardAction(file) {
282
+ var list = [];
233
283
  if (isImageUrl(file) && !isError(file) && showPreviewIcon) list.push({
234
284
  icon: previewIcon || jsx(PreviewOpen, {}),
235
285
  key: 'view'
@@ -239,7 +289,7 @@ const UploadList = props => {
239
289
  key: 'delete'
240
290
  });
241
291
  if (!list.length) return null;
242
- const onClick = (item, e) => {
292
+ var onClick = function onClick(item, e) {
243
293
  if (item.key === 'view') handlePreview(file, e);
244
294
  if (item.key === 'delete') handleRemove(file, e);
245
295
  };
@@ -251,10 +301,14 @@ const UploadList = props => {
251
301
  });
252
302
  };
253
303
  //渲染列表actions
254
- const renderActions = file => {
255
- const actions = {
256
- onRemove: () => onRemove === null || onRemove === void 0 ? void 0 : onRemove(file),
257
- onPreview: () => handlePreview(file)
304
+ var renderActions = function renderActions(file) {
305
+ var actions = {
306
+ onRemove: function onRemove() {
307
+ return _onRemove === null || _onRemove === void 0 ? void 0 : _onRemove(file);
308
+ },
309
+ onPreview: function onPreview() {
310
+ return handlePreview(file);
311
+ }
258
312
  };
259
313
  if (actionRender) return actionRender(file, actions);
260
314
  if (operateBtnProps) return jsx(OperateBtn, Object.assign({
@@ -266,37 +320,43 @@ const UploadList = props => {
266
320
  className: 'upload-list-actions'
267
321
  }, {
268
322
  children: showRemoveIcon && jsx("span", Object.assign({
269
- onClick: evt => handleRemove(file, evt)
323
+ onClick: function onClick(evt) {
324
+ return handleRemove(file, evt);
325
+ }
270
326
  }, {
271
327
  children: removeIcon || jsx(Delete, {})
272
328
  }))
273
329
  }));
274
330
  };
275
331
  // 渲染图标
276
- const renderIcon = file => {
277
- const isImage = isImageUrl(file);
332
+ var renderIcon = function renderIcon(file) {
333
+ var isImage = isImageUrl(file);
278
334
  if (file.status === 'error') return jsx(InfoOutlined, {});
279
335
  return isImage ? jsx(PhotoIcon, {}) : jsx(FileOutlined, {});
280
336
  };
281
- const renderTextItem = file => {
282
- const listItemNameClass = 'upload-list-text-name';
283
- const fileName = file.url && !isError(file) ? jsx("a", Object.assign({
337
+ var renderTextItem = function renderTextItem(file) {
338
+ var listItemNameClass = 'upload-list-text-name';
339
+ var fileName = file.url && !isError(file) ? jsx("a", Object.assign({
284
340
  target: "_blank",
285
341
  rel: "noopener noreferrer",
286
342
  className: listItemNameClass,
287
343
  // title={file.name}
288
344
  href: file.url,
289
- onClick: e => onPreview === null || onPreview === void 0 ? void 0 : onPreview(file, e)
345
+ onClick: function onClick(e) {
346
+ return onPreview === null || onPreview === void 0 ? void 0 : onPreview(file, e);
347
+ }
290
348
  }, {
291
349
  children: file.name
292
350
  }), "view") : jsx("div", Object.assign({
293
351
  className: listItemNameClass,
294
- onClick: e => onPreview === null || onPreview === void 0 ? void 0 : onPreview(file, e),
352
+ onClick: function onClick(e) {
353
+ return onPreview === null || onPreview === void 0 ? void 0 : onPreview(file, e);
354
+ },
295
355
  title: file.name
296
356
  }, {
297
357
  children: file.name
298
358
  }), "view");
299
- const listItem = jsxs("div", Object.assign({
359
+ var listItem = jsxs("div", Object.assign({
300
360
  className: clsx('upload-list-text-item', isError(file) && 'upload-list-text-item-error')
301
361
  }, {
302
362
  children: [jsx("div", Object.assign({
@@ -317,9 +377,9 @@ const UploadList = props => {
317
377
  return listItem;
318
378
  };
319
379
  //文件列表 text
320
- const renderFileListText = () => {
380
+ var renderFileListText = function renderFileListText() {
321
381
  if (!(uploadList === null || uploadList === void 0 ? void 0 : uploadList.length)) return null;
322
- return uploadList.map((file, idx) => {
382
+ return uploadList.map(function (file, idx) {
323
383
  var _a;
324
384
  if (itemRender)
325
385
  //自定义渲染
@@ -341,17 +401,19 @@ const UploadList = props => {
341
401
  });
342
402
  };
343
403
  //文件列表 picture-card
344
- const renderFileListPicture = () => {
404
+ var renderFileListPicture = function renderFileListPicture() {
345
405
  if (!(uploadList === null || uploadList === void 0 ? void 0 : uploadList.length)) return null;
346
- return uploadList.map((file, idx) => {
406
+ return uploadList.map(function (file, idx) {
347
407
  /*自定义渲染*/
348
408
  if (itemRender) return itemRender(file, uploadList);
349
- let isImage = isImageUrl(file);
350
- let pictureItem = jsxs(Fragment, {
409
+ var isImage = isImageUrl(file);
410
+ var pictureItem = jsxs(Fragment, {
351
411
  children: [isImage ? jsx("img", {
352
412
  src: file.thumbUrl || file.dataUrl || file.url,
353
413
  alt: file.name,
354
- onError: () => onImageError(file)
414
+ onError: function onError() {
415
+ return onImageError(file);
416
+ }
355
417
  }) : jsx(FileIcon, {
356
418
  className: 'upload-list-picture-file'
357
419
  })
@@ -382,31 +444,84 @@ const UploadList = props => {
382
444
  });
383
445
  };
384
446
  //处理文件
385
- const handleFileFormat = () => __awaiter(void 0, void 0, void 0, function* () {
386
- if (!(items === null || items === void 0 ? void 0 : items.length)) return setUploadList([]);
387
- //读取file as DataUrl
388
- const readerFileAsDataUrl = file => __awaiter(void 0, void 0, void 0, function* () {
389
- return new Promise(resolve => {
390
- const fileReader = new FileReader();
391
- if (file.originFileObj) {
392
- fileReader.onload = () => {
393
- resolve(fileReader.result);
394
- };
395
- fileReader.readAsDataURL(file.originFileObj);
396
- } else resolve('');
397
- });
398
- });
399
- for (const file of items) {
400
- if (file.originFileObj) {
401
- const dataUrl = yield readerFileAsDataUrl(file);
402
- file.dataUrl = dataUrl;
403
- }
404
- }
405
- setUploadList([...items]);
406
- });
407
- useEffect(() => {
408
- if (listType === 'picture-card') handleFileFormat();else setUploadList(pre => {
409
- if (items) return [...items];
447
+ var handleFileFormat = function handleFileFormat() {
448
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee3() {
449
+ var readerFileAsDataUrl, _iterator, _step, file, dataUrl;
450
+ return regenerator.wrap(function _callee3$(_context3) {
451
+ while (1) switch (_context3.prev = _context3.next) {
452
+ case 0:
453
+ if (items === null || items === void 0 ? void 0 : items.length) {
454
+ _context3.next = 2;
455
+ break;
456
+ }
457
+ return _context3.abrupt("return", setUploadList([]));
458
+ case 2:
459
+ //读取file as DataUrl
460
+ readerFileAsDataUrl = function readerFileAsDataUrl(file) {
461
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee2() {
462
+ return regenerator.wrap(function _callee2$(_context2) {
463
+ while (1) switch (_context2.prev = _context2.next) {
464
+ case 0:
465
+ return _context2.abrupt("return", new Promise(function (resolve) {
466
+ var fileReader = new FileReader();
467
+ if (file.originFileObj) {
468
+ fileReader.onload = function () {
469
+ resolve(fileReader.result);
470
+ };
471
+ fileReader.readAsDataURL(file.originFileObj);
472
+ } else resolve('');
473
+ }));
474
+ case 1:
475
+ case "end":
476
+ return _context2.stop();
477
+ }
478
+ }, _callee2);
479
+ }));
480
+ };
481
+ _iterator = _createForOfIteratorHelper(items);
482
+ _context3.prev = 4;
483
+ _iterator.s();
484
+ case 6:
485
+ if ((_step = _iterator.n()).done) {
486
+ _context3.next = 15;
487
+ break;
488
+ }
489
+ file = _step.value;
490
+ if (!file.originFileObj) {
491
+ _context3.next = 13;
492
+ break;
493
+ }
494
+ _context3.next = 11;
495
+ return readerFileAsDataUrl(file);
496
+ case 11:
497
+ dataUrl = _context3.sent;
498
+ file.dataUrl = dataUrl;
499
+ case 13:
500
+ _context3.next = 6;
501
+ break;
502
+ case 15:
503
+ _context3.next = 20;
504
+ break;
505
+ case 17:
506
+ _context3.prev = 17;
507
+ _context3.t0 = _context3["catch"](4);
508
+ _iterator.e(_context3.t0);
509
+ case 20:
510
+ _context3.prev = 20;
511
+ _iterator.f();
512
+ return _context3.finish(20);
513
+ case 23:
514
+ setUploadList(_toConsumableArray(items));
515
+ case 24:
516
+ case "end":
517
+ return _context3.stop();
518
+ }
519
+ }, _callee3, null, [[4, 17, 20, 23]]);
520
+ }));
521
+ };
522
+ useEffect(function () {
523
+ if (listType === 'picture-card') handleFileFormat();else setUploadList(function (pre) {
524
+ if (items) return _toConsumableArray(items);
410
525
  return pre;
411
526
  });
412
527
  }, [items]);
@@ -421,14 +536,14 @@ const UploadList = props => {
421
536
  children: renderFileListPicture()
422
537
  })), jsx(Image$1.PreviewGroup, {
423
538
  preview: {
424
- visible,
425
- onVisibleChange: value => {
539
+ visible: visible,
540
+ onVisibleChange: function onVisibleChange(value) {
426
541
  setVisible(value);
427
542
  },
428
- onChange: value => {
543
+ onChange: function onChange(value) {
429
544
  setCurrent(value);
430
545
  },
431
- current
546
+ current: current
432
547
  },
433
548
  items: previewItems.items
434
549
  })]
@@ -439,7 +554,7 @@ var css_248z$3 = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2021/11/15
439
554
  styleInject(css_248z$3);
440
555
 
441
556
  //error tip
442
- const ErrorTip = props => {
557
+ var ErrorTip = function ErrorTip(props) {
443
558
  return jsxs("div", Object.assign({
444
559
  className: clsx("".concat($prefixCls, "-upload-error"), props.className)
445
560
  }, {
@@ -472,113 +587,210 @@ var zh = {
472
587
  };
473
588
 
474
589
  var localeJson = {
475
- zh,
476
- en
590
+ zh: zh,
591
+ en: en
477
592
  };
478
593
 
479
- 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}\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 .component-upload-disabled {\n color: rgb(92, 101, 115);\n cursor: not-allowed;\n}\n.paraui-v4-upload-image .upload-image-select .component-upload-disabled svg {\n color: rgb(92, 101, 115);\n}\n.paraui-v4-upload-image .upload-image-select .component-upload-disabled .upload-image-picture-card {\n color: rgb(92, 101, 115);\n}\n.paraui-v4-upload-image .upload-image-select:hover .component-upload:not(.component-upload-disabled) .upload-image-picture-card {\n color: rgb(46, 101, 230);\n border-color: rgb(87, 131, 235);\n}\n.paraui-v4-upload-image .upload-image-select:hover .component-upload:not(.component-upload-disabled) .upload-image-picture-card .upload-image-text {\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 border: 1px dashed rgb(212, 218, 227);\n border-radius: 4px;\n}\n.paraui-v4-upload-image .upload-image-picture-card.is-avatar {\n border: none;\n}\n.paraui-v4-upload-image .upload-image-picture-card .upload-image-select-tooltip-wrapper {\n display: inline-flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: 100%;\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}";
594
+ 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}\n.paraui-v4-upload-image .upload-img-wrapper-container {\n position: relative;\n}\n.paraui-v4-upload-image .upload-img-wrapper-container__del-btn {\n display: none;\n position: absolute;\n top: 10px;\n right: 10px;\n margin: 0;\n width: 14px;\n height: 14px;\n text-align: center;\n border-radius: 50%;\n background: #fff;\n box-shadow: 0px 0px 4px 0px rgba(29, 33, 38, 0.4);\n z-index: 1;\n color: rgb(29, 33, 38);\n}\n.paraui-v4-upload-image .upload-img-wrapper-container__del-btn .svg-icon {\n margin-top: 1px;\n vertical-align: top;\n font-size: 12px;\n}\n.paraui-v4-upload-image .upload-img-wrapper-container__del-btn:hover .svg-icon {\n color: rgba(29, 33, 38, 0.4);\n}\n.paraui-v4-upload-image .upload-img-wrapper-container:hover .upload-img-wrapper-container__del-btn {\n display: block;\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 .component-upload-disabled {\n color: rgb(92, 101, 115);\n cursor: not-allowed;\n}\n.paraui-v4-upload-image .upload-image-select .component-upload-disabled svg {\n color: rgb(92, 101, 115);\n}\n.paraui-v4-upload-image .upload-image-select .component-upload-disabled .upload-image-picture-card {\n color: rgb(92, 101, 115);\n}\n.paraui-v4-upload-image .upload-image-select:hover .component-upload:not(.component-upload-disabled) .upload-image-picture-card {\n color: rgb(46, 101, 230);\n border-color: rgb(87, 131, 235);\n}\n.paraui-v4-upload-image .upload-image-select:hover .component-upload:not(.component-upload-disabled) .upload-image-picture-card .upload-image-text {\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 border: 1px dashed rgb(212, 218, 227);\n border-radius: 4px;\n}\n.paraui-v4-upload-image .upload-image-picture-card.is-avatar {\n border: none;\n}\n.paraui-v4-upload-image .upload-image-picture-card .upload-image-select-tooltip-wrapper {\n display: inline-flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: 100%;\n}\n.paraui-v4-upload-image .upload-image-picture-card .upload-img-wrapper {\n position: relative;\n width: 100%;\n height: 100%;\n overflow: hidden;\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}";
480
595
  styleInject(css_248z$2);
481
596
 
482
597
  //ImageUpload
483
- const ImageUpload = props => {
484
- const {
485
- className,
486
- style,
487
- onStart,
488
- onSuccess,
489
- onError,
490
- onProgress,
491
- onRemove,
492
- beforeUpload,
493
- onChange,
494
- defaultFileList = [],
495
- fileList,
496
- showUploadList = true,
497
- maxCount,
498
- children = null,
499
- itemRender,
500
- showUploadError = false,
501
- stash = false,
502
- uploading = true,
503
- loading = false,
504
- showLoading: showLoadingProp = false,
505
- defaultImage,
506
- readonly,
507
- onPreview,
508
- actionRender,
509
- operateBtnProps,
510
- disabledTooltip,
511
- removeErrorTip
512
- } = props,
513
- 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", "onPreview", "actionRender", "operateBtnProps", "disabledTooltip", "removeErrorTip"]);
514
- const intl = useFormatMessage('Upload', localeJson);
515
- const [uploadFileList, setUploadFileList] = useState(defaultFileList); //文件列表
516
- const [showLoading, setShowLoading] = useState(false); //upload loading
517
- const [errTip, setErrTip] = useState(false); //upload error tip
518
- const [avatar, setAvatar] = useState({
519
- imageUrl: ''
520
- }); //不显示列表时上传头像
521
- const {
522
- showRemoveIcon,
523
- removeIcon,
524
- showPreviewIcon,
525
- previewIcon
526
- } = typeof showUploadList === 'boolean' ? {} : showUploadList; //显示上传列表
527
- const {
528
- uploadErrorMsg = intl({
529
- id: 'uploadError'
598
+ var ImageUpload = function ImageUpload(props) {
599
+ var className = props.className,
600
+ style = props.style,
601
+ _onStart = props.onStart,
602
+ _onSuccess = props.onSuccess,
603
+ _onError = props.onError,
604
+ _onProgress = props.onProgress,
605
+ onRemove = props.onRemove,
606
+ _beforeUpload = props.beforeUpload,
607
+ onChange = props.onChange,
608
+ _props$defaultFileLis = props.defaultFileList,
609
+ defaultFileList = _props$defaultFileLis === void 0 ? [] : _props$defaultFileLis,
610
+ fileList = props.fileList,
611
+ _props$showUploadList = props.showUploadList,
612
+ showUploadList = _props$showUploadList === void 0 ? true : _props$showUploadList,
613
+ maxCount = props.maxCount,
614
+ _props$children = props.children,
615
+ children = _props$children === void 0 ? null : _props$children,
616
+ itemRender = props.itemRender,
617
+ _props$showUploadErro = props.showUploadError,
618
+ showUploadError = _props$showUploadErro === void 0 ? false : _props$showUploadErro,
619
+ _props$stash = props.stash,
620
+ stash = _props$stash === void 0 ? false : _props$stash,
621
+ _props$uploading = props.uploading,
622
+ uploading = _props$uploading === void 0 ? true : _props$uploading,
623
+ _props$loading = props.loading,
624
+ loading = _props$loading === void 0 ? false : _props$loading,
625
+ _props$showLoading = props.showLoading,
626
+ showLoadingProp = _props$showLoading === void 0 ? false : _props$showLoading,
627
+ defaultImage = props.defaultImage,
628
+ readonly = props.readonly,
629
+ onPreview = props.onPreview,
630
+ actionRender = props.actionRender,
631
+ operateBtnProps = props.operateBtnProps,
632
+ disabledTooltip = props.disabledTooltip,
633
+ removeErrorTip = props.removeErrorTip,
634
+ avatarProps = props.avatarProps,
635
+ 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", "onPreview", "actionRender", "operateBtnProps", "disabledTooltip", "removeErrorTip", "avatarProps"]);
636
+ var intl = useFormatMessage('Upload', localeJson);
637
+ var _useState = useState(defaultFileList),
638
+ _useState2 = _slicedToArray(_useState, 2),
639
+ uploadFileList = _useState2[0],
640
+ setUploadFileList = _useState2[1]; //文件列表
641
+ var _useState3 = useState(false),
642
+ _useState4 = _slicedToArray(_useState3, 2),
643
+ showResetBtn = _useState4[0],
644
+ setShowResetBtn = _useState4[1]; // 是否展示重置按钮-默认不展示
645
+ var _useState5 = useState(),
646
+ _useState6 = _slicedToArray(_useState5, 2),
647
+ borderRadius = _useState6[0],
648
+ setBorderRadius = _useState6[1]; // border-radius样式
649
+ var _useState7 = useState(false),
650
+ _useState8 = _slicedToArray(_useState7, 2),
651
+ isAvatar = _useState8[0],
652
+ setIsAvatar = _useState8[1]; // 是否为头像组件
653
+ var _useState9 = useState(true),
654
+ _useState10 = _slicedToArray(_useState9, 2),
655
+ showPicName = _useState10[0],
656
+ setShowPicName = _useState10[1]; // 是否展示图片名称
657
+ var _useState11 = useState(false),
658
+ _useState12 = _slicedToArray(_useState11, 2),
659
+ showLoading = _useState12[0],
660
+ setShowLoading = _useState12[1]; //upload loading
661
+ var _useState13 = useState(false),
662
+ _useState14 = _slicedToArray(_useState13, 2),
663
+ errTip = _useState14[0],
664
+ setErrTip = _useState14[1]; //upload error tip
665
+ var _useState15 = useState({
666
+ imageUrl: ''
530
667
  }),
531
- leaveDelay = 2000
532
- } = typeof showUploadError === 'boolean' ? {} : showUploadError; //错误信息提示
533
- const cropFileRef = useRef(); //裁剪文件
534
- const isAvatarMode = useMemo(() => !showUploadList && avatar.imageUrl && !showLoading, [showUploadList, avatar.imageUrl, showLoading]);
535
- useEffect(() => {
668
+ _useState16 = _slicedToArray(_useState15, 2),
669
+ avatar = _useState16[0],
670
+ setAvatar = _useState16[1]; //不显示列表时上传头像
671
+ var _ref = typeof showUploadList === 'boolean' ? {} : showUploadList,
672
+ showRemoveIcon = _ref.showRemoveIcon,
673
+ removeIcon = _ref.removeIcon,
674
+ showPreviewIcon = _ref.showPreviewIcon,
675
+ previewIcon = _ref.previewIcon; //显示上传列表
676
+ var _ref2 = typeof showUploadError === 'boolean' ? {} : showUploadError,
677
+ _ref2$uploadErrorMsg = _ref2.uploadErrorMsg,
678
+ uploadErrorMsg = _ref2$uploadErrorMsg === void 0 ? intl({
679
+ id: 'uploadError'
680
+ }) : _ref2$uploadErrorMsg,
681
+ _ref2$leaveDelay = _ref2.leaveDelay,
682
+ leaveDelay = _ref2$leaveDelay === void 0 ? 2000 : _ref2$leaveDelay; //错误信息提示
683
+ var cropFileRef = useRef(); //裁剪文件
684
+ var isAvatarMode = useMemo(function () {
685
+ return !showUploadList && avatar.imageUrl && !showLoading;
686
+ }, [showUploadList, avatar.imageUrl, showLoading]);
687
+ useEffect(function () {
688
+ if (avatarProps && Object.prototype.toString.call(avatarProps) === '[object Object]' && Object.keys(avatarProps).length > 0) {
689
+ var _ref3 = avatarProps || {},
690
+ _ref3$showReset = _ref3.showReset,
691
+ showReset = _ref3$showReset === void 0 ? false : _ref3$showReset,
692
+ _ref3$borderRadius = _ref3.borderRadius,
693
+ borderRadiusVal = _ref3$borderRadius === void 0 ? '50%' : _ref3$borderRadius,
694
+ avatarDefaultImage = _ref3.defaultImage,
695
+ _ref3$showName = _ref3.showName,
696
+ showName = _ref3$showName === void 0 ? false : _ref3$showName;
697
+ setShowResetBtn(showReset);
698
+ setBorderRadius(String(borderRadiusVal).includes('px') || String(borderRadiusVal).includes('%') ? String(borderRadiusVal) : "".concat(borderRadiusVal, "px"));
699
+ setIsAvatar(true);
700
+ setShowPicName(showName);
701
+ var nextAvatarDefaultImage = avatarDefaultImage || defaultImage || {
702
+ imageUrl: ''
703
+ };
704
+ setAvatar(Object.assign({}, nextAvatarDefaultImage));
705
+ } else if (typeof avatarProps === 'boolean' && avatarProps) {
706
+ setBorderRadius('50%');
707
+ setIsAvatar(true);
708
+ setShowPicName(false);
709
+ if (defaultImage) {
710
+ setAvatar(Object.assign({}, defaultImage));
711
+ }
712
+ } else {
713
+ setIsAvatar(false);
714
+ setShowPicName(true);
715
+ if (defaultImage) {
716
+ setAvatar(Object.assign({}, defaultImage));
717
+ }
718
+ }
719
+ }, [avatarProps, defaultImage]);
720
+ useEffect(function () {
536
721
  setShowLoading(loading);
537
722
  }, [loading]);
538
723
  //复写属性
539
- const overrideProps = Object.assign(Object.assign({
724
+ var overrideProps = Object.assign(Object.assign({
540
725
  accept: 'image/*'
541
726
  }, restProps), {
542
- beforeUpload: (file, fileList) => __awaiter(void 0, void 0, void 0, function* () {
543
- if (restProps.action && showLoadingProp && uploading) setShowLoading(true);
544
- const result = yield beforeUpload === null || beforeUpload === void 0 ? void 0 : beforeUpload(file, fileList);
545
- if (result === false) {
546
- setShowLoading(false);
547
- return false;
548
- } else if (typeof result === 'object' && result) {
549
- if (result instanceof File || result instanceof Blob) return result;
550
- cropFileRef.current = result.cropFile;
551
- return result.isUpload;
552
- } else return true;
553
- }),
554
- onStart(file) {
555
- onStart === null || onStart === void 0 ? void 0 : onStart(file);
727
+ beforeUpload: function beforeUpload(file, fileList) {
728
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee() {
729
+ var result;
730
+ return regenerator.wrap(function _callee$(_context) {
731
+ while (1) switch (_context.prev = _context.next) {
732
+ case 0:
733
+ if (restProps.action && showLoadingProp && uploading) setShowLoading(true);
734
+ _context.next = 3;
735
+ return _beforeUpload === null || _beforeUpload === void 0 ? void 0 : _beforeUpload(file, fileList);
736
+ case 3:
737
+ result = _context.sent;
738
+ if (!(result === false)) {
739
+ _context.next = 9;
740
+ break;
741
+ }
742
+ setShowLoading(false);
743
+ return _context.abrupt("return", false);
744
+ case 9:
745
+ if (!(_typeof(result) === 'object' && result)) {
746
+ _context.next = 16;
747
+ break;
748
+ }
749
+ if (!(result instanceof File || result instanceof Blob)) {
750
+ _context.next = 12;
751
+ break;
752
+ }
753
+ return _context.abrupt("return", result);
754
+ case 12:
755
+ cropFileRef.current = result.cropFile;
756
+ return _context.abrupt("return", result.isUpload);
757
+ case 16:
758
+ return _context.abrupt("return", true);
759
+ case 17:
760
+ case "end":
761
+ return _context.stop();
762
+ }
763
+ }, _callee);
764
+ }));
556
765
  },
557
- onSuccess(response, file, xhr) {
766
+ onStart: function onStart(file) {
767
+ _onStart === null || _onStart === void 0 ? void 0 : _onStart(file);
768
+ },
769
+ onSuccess: function onSuccess(response, file, xhr) {
558
770
  setShowLoading(false);
559
771
  errTip && showErrTip(false);
560
- const nextFileList = updateFileList(file);
772
+ var nextFileList = updateFileList(file);
561
773
  onInternalChange(nextFileList);
562
- onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(response, file, xhr);
774
+ _onSuccess === null || _onSuccess === void 0 ? void 0 : _onSuccess(response, file, xhr);
563
775
  },
564
- onError(error, response, file) {
776
+ onError: function onError(error, response, file) {
565
777
  setShowLoading(false);
566
778
  showErrTip(!!showUploadError);
567
779
  if (!showUploadError) {
568
780
  file.status = 'error';
569
781
  file.response = (error === null || error === void 0 ? void 0 : error.message) || uploadErrorMsg;
570
- const nextFileList = updateFileList(file);
782
+ var nextFileList = updateFileList(file);
571
783
  onInternalChange(nextFileList);
572
784
  }
573
- onError === null || onError === void 0 ? void 0 : onError(error, response, file);
785
+ _onError === null || _onError === void 0 ? void 0 : _onError(error, response, file);
574
786
  },
575
- onProgress(e, file) {
576
- onProgress === null || onProgress === void 0 ? void 0 : onProgress(e, file);
787
+ onProgress: function onProgress(e, file) {
788
+ _onProgress === null || _onProgress === void 0 ? void 0 : _onProgress(e, file);
577
789
  },
578
- onBatchStart(fileList) {
790
+ onBatchStart: function onBatchStart(fileList) {
579
791
  if (stash) {
580
792
  if (cropFileRef.current) {
581
- const idx = fileList.findIndex(_ => {
793
+ var idx = fileList.findIndex(function (_) {
582
794
  var _a;
583
795
  return _.file.uid === ((_a = cropFileRef.current) === null || _a === void 0 ? void 0 : _a.uid);
584
796
  });
@@ -589,40 +801,69 @@ const ImageUpload = props => {
589
801
  });
590
802
  }
591
803
  }
592
- const arr = fileList.map(_ => _.parsedFile || _.file);
593
- const mList = mergedFileList(arr);
804
+ var arr = fileList.map(function (_) {
805
+ return _.parsedFile || _.file;
806
+ });
807
+ var mList = mergedFileList(arr);
594
808
  onInternalChange(mList);
595
809
  }
596
810
  }
597
811
  });
598
812
  //内部变化
599
- const onInternalChange = changedFileList => __awaiter(void 0, void 0, void 0, function* () {
600
- let cloneList = [...changedFileList];
601
- if (!showUploadList) {
602
- //不显示上传列表
603
- const file = cloneList.slice(-1)[0];
604
- if (file) {
605
- const imageUrl = yield readerFileAsDataUrl(file);
606
- file.dataUrl = imageUrl;
607
- avatar.imageUrl = imageUrl;
608
- avatar.imageName = file.name;
609
- setAvatar(Object.assign({}, avatar));
610
- }
611
- onChange === null || onChange === void 0 ? void 0 : onChange([file]);
612
- return;
613
- }
614
- if (maxCount === 1) {
615
- cloneList = cloneList.slice(-1);
616
- } else if (maxCount) {
617
- cloneList = cloneList.slice(0, maxCount);
618
- }
619
- onChange === null || onChange === void 0 ? void 0 : onChange(cloneList);
620
- setUploadFileList(cloneList);
621
- });
813
+ var onInternalChange = function onInternalChange(changedFileList) {
814
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee2() {
815
+ var cloneList, file, imageUrl;
816
+ return regenerator.wrap(function _callee2$(_context2) {
817
+ while (1) switch (_context2.prev = _context2.next) {
818
+ case 0:
819
+ cloneList = _toConsumableArray(changedFileList);
820
+ if (showUploadList) {
821
+ _context2.next = 17;
822
+ break;
823
+ }
824
+ //不显示上传列表
825
+ file = cloneList.slice(-1)[0];
826
+ if (!file) {
827
+ _context2.next = 14;
828
+ break;
829
+ }
830
+ _context2.next = 6;
831
+ return readerFileAsDataUrl(file);
832
+ case 6:
833
+ imageUrl = _context2.sent;
834
+ file.dataUrl = imageUrl;
835
+ avatar.imageUrl = imageUrl;
836
+ avatar.imageName = file.name;
837
+ setAvatar(Object.assign({}, avatar));
838
+ onChange === null || onChange === void 0 ? void 0 : onChange([file]);
839
+ _context2.next = 16;
840
+ break;
841
+ case 14:
842
+ setAvatar({
843
+ imageUrl: ''
844
+ });
845
+ onChange === null || onChange === void 0 ? void 0 : onChange([]);
846
+ case 16:
847
+ return _context2.abrupt("return");
848
+ case 17:
849
+ if (maxCount === 1) {
850
+ cloneList = cloneList.slice(-1);
851
+ } else if (maxCount) {
852
+ cloneList = cloneList.slice(0, maxCount);
853
+ }
854
+ onChange === null || onChange === void 0 ? void 0 : onChange(cloneList);
855
+ setUploadFileList(cloneList);
856
+ case 20:
857
+ case "end":
858
+ return _context2.stop();
859
+ }
860
+ }, _callee2);
861
+ }));
862
+ };
622
863
  //更新文件列表
623
- const updateFileList = file => {
624
- const cloneList = [...uploadFileList];
625
- const fileObj = Object.assign(Object.assign({}, file), {
864
+ var updateFileList = function updateFileList(file) {
865
+ var cloneList = _toConsumableArray(uploadFileList);
866
+ var fileObj = Object.assign(Object.assign({}, file), {
626
867
  lastModified: file.lastModified,
627
868
  lastModifiedDate: file.lastModifiedDate,
628
869
  name: file.name,
@@ -634,9 +875,9 @@ const ImageUpload = props => {
634
875
  return cloneList.concat(fileObj);
635
876
  };
636
877
  //合并文件列表
637
- const mergedFileList = fileList => {
638
- const cloneList = [...uploadFileList];
639
- const newFileList = fileList.map(file => {
878
+ var mergedFileList = function mergedFileList(fileList) {
879
+ var cloneList = _toConsumableArray(uploadFileList);
880
+ var newFileList = fileList.map(function (file) {
640
881
  return Object.assign(Object.assign({}, file), {
641
882
  lastModified: file.lastModified,
642
883
  lastModifiedDate: file.lastModifiedDate,
@@ -650,70 +891,85 @@ const ImageUpload = props => {
650
891
  return cloneList.concat(newFileList);
651
892
  };
652
893
  //删除文件
653
- const handleRemove = file => {
654
- Promise.resolve(typeof onRemove === 'function' ? onRemove(file) : onRemove).then(ret => {
894
+ var handleRemove = function handleRemove(file) {
895
+ Promise.resolve(typeof onRemove === 'function' ? onRemove(file) : onRemove).then(function (ret) {
655
896
  // Prevent removing file
656
897
  if (ret === false) return;
657
- const idx = uploadFileList.findIndex(_ => _.uid === file.uid);
898
+ var idx = uploadFileList.findIndex(function (_) {
899
+ return _.uid === file.uid;
900
+ });
658
901
  if (idx > -1) uploadFileList.splice(idx, 1);
659
902
  onInternalChange(uploadFileList);
660
903
  });
661
904
  };
662
905
  //读取dataUrl
663
- const readerFileAsDataUrl = file => __awaiter(void 0, void 0, void 0, function* () {
664
- return new Promise(resolve => {
665
- const fileReader = new FileReader();
666
- if (file.originFileObj) {
667
- fileReader.onload = () => {
668
- resolve(fileReader.result);
669
- };
670
- fileReader.readAsDataURL(file.originFileObj);
671
- } else resolve('');
672
- });
673
- });
906
+ var readerFileAsDataUrl = function readerFileAsDataUrl(file) {
907
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee3() {
908
+ return regenerator.wrap(function _callee3$(_context3) {
909
+ while (1) switch (_context3.prev = _context3.next) {
910
+ case 0:
911
+ return _context3.abrupt("return", new Promise(function (resolve) {
912
+ var fileReader = new FileReader();
913
+ if (file.originFileObj) {
914
+ fileReader.onload = function () {
915
+ resolve(fileReader.result);
916
+ };
917
+ fileReader.readAsDataURL(file.originFileObj);
918
+ } else resolve('');
919
+ }));
920
+ case 1:
921
+ case "end":
922
+ return _context3.stop();
923
+ }
924
+ }, _callee3);
925
+ }));
926
+ };
674
927
  //显示错误提示
675
- const showErrTip = flag => {
928
+ var showErrTip = function showErrTip(flag) {
676
929
  setErrTip(flag);
677
930
  if (leaveDelay < 0) return;
678
- setTimeout(() => {
931
+ setTimeout(function () {
679
932
  setErrTip(false);
680
933
  }, leaveDelay);
681
934
  };
682
- useEffect(() => {
935
+ useEffect(function () {
683
936
  if (fileList) {
684
- setUploadFileList([...fileList]);
937
+ setUploadFileList(_toConsumableArray(fileList));
685
938
  }
686
939
  }, [fileList]);
687
- useEffect(() => {
688
- if (defaultImage) {
689
- setAvatar(Object.assign({}, defaultImage));
690
- }
691
- }, [defaultImage]);
692
940
  //渲染上传列表
693
- const renderUploadList = () => showUploadList && jsx(UploadList, {
694
- listType: 'picture-card',
695
- readonly: readonly,
696
- items: uploadFileList,
697
- showRemoveIcon: showRemoveIcon,
698
- removeIcon: removeIcon,
699
- showPreviewIcon: showPreviewIcon,
700
- previewIcon: previewIcon,
701
- onRemove: handleRemove,
702
- itemRender: itemRender,
703
- onPreview: onPreview,
704
- actionRender: actionRender,
705
- operateBtnProps: operateBtnProps
706
- });
941
+ var renderUploadList = function renderUploadList() {
942
+ return showUploadList && jsx(UploadList, {
943
+ listType: 'picture-card',
944
+ readonly: readonly,
945
+ items: uploadFileList,
946
+ showRemoveIcon: showRemoveIcon,
947
+ removeIcon: removeIcon,
948
+ showPreviewIcon: showPreviewIcon,
949
+ previewIcon: previewIcon,
950
+ onRemove: handleRemove,
951
+ itemRender: itemRender,
952
+ onPreview: onPreview,
953
+ actionRender: actionRender,
954
+ operateBtnProps: operateBtnProps
955
+ });
956
+ };
707
957
  //渲染内容 avatar
708
- const renderUploadContent = () => {
958
+ var renderUploadContent = function renderUploadContent() {
709
959
  var _a;
710
- const avatarUploadNode = jsxs("div", Object.assign({
711
- className: 'upload-img-wrapper'
960
+ var avatarUploadNode = jsxs("div", Object.assign({
961
+ className: 'upload-img-wrapper',
962
+ style: borderRadius ? {
963
+ borderRadius: borderRadius
964
+ } : {}
712
965
  }, {
713
966
  children: [jsx("img", {
714
967
  src: avatar.imageUrl,
715
- alt: (_a = avatar.imageName) !== null && _a !== void 0 ? _a : ''
716
- }), avatar.imageName && jsx("span", Object.assign({
968
+ alt: (_a = avatar.imageName) !== null && _a !== void 0 ? _a : '',
969
+ style: borderRadius ? {
970
+ borderRadius: borderRadius
971
+ } : {}
972
+ }), avatar.imageName && showPicName && jsx("span", Object.assign({
717
973
  className: 'upload-img-wrapper-name'
718
974
  }, {
719
975
  children: avatar.imageName
@@ -723,7 +979,7 @@ const ImageUpload = props => {
723
979
  children: jsx(EditOutline, {})
724
980
  }))]
725
981
  }));
726
- const uploadNode = jsxs(Fragment, {
982
+ var uploadNode = jsxs(Fragment, {
727
983
  children: [showLoading ? jsx(LoadingIcon, {
728
984
  className: 'upload-image-loading'
729
985
  }) : jsx(UploadIcon, {
@@ -755,16 +1011,21 @@ const ImageUpload = props => {
755
1011
  });
756
1012
  };
757
1013
  //渲染上传控件
758
- const renderUploadSelector = () => {
759
- if (readonly) return null;
1014
+ var renderUploadSelector = function renderUploadSelector() {
760
1015
  return jsxs("div", Object.assign({
761
- className: clsx('upload-image-select', showLoading && 'upload-image-select-loading')
1016
+ className: clsx('upload-image-select', showLoading && 'upload-image-select-loading', isAvatar && 'is-avatar'),
1017
+ style: borderRadius ? {
1018
+ borderRadius: borderRadius
1019
+ } : {}
762
1020
  }, {
763
1021
  children: [jsx(RcUpload, Object.assign({}, overrideProps, {
764
1022
  prefixCls: "".concat($rcPrefixCls, "-upload")
765
1023
  }, {
766
1024
  children: jsx("div", Object.assign({
767
- className: "".concat(isAvatarMode ? 'is-avatar ' : '', "upload-image-picture-card")
1025
+ className: "".concat(isAvatarMode ? 'is-avatar ' : '', "upload-image-picture-card"),
1026
+ style: borderRadius ? {
1027
+ borderRadius: borderRadius
1028
+ } : {}
768
1029
  }, {
769
1030
  children: renderUploadContent()
770
1031
  }))
@@ -774,16 +1035,30 @@ const ImageUpload = props => {
774
1035
  })]
775
1036
  }));
776
1037
  };
1038
+ var handleReset = function handleReset() {
1039
+ handleRemove(uploadFileList[0]);
1040
+ };
777
1041
  return jsxs("div", Object.assign({
778
1042
  className: clsx("".concat($prefixCls, "-upload-image"), className),
779
1043
  style: style
780
1044
  }, {
781
- children: [renderUploadList(), renderUploadSelector()]
1045
+ children: [renderUploadList(), !readonly ? showResetBtn && avatar.imageUrl ? jsxs("div", Object.assign({
1046
+ className: "upload-img-wrapper-container"
1047
+ }, {
1048
+ children: [jsx(Button.IconButton, Object.assign({
1049
+ className: "upload-img-wrapper-container__del-btn",
1050
+ variant: "text",
1051
+ size: "small",
1052
+ onClick: handleReset
1053
+ }, {
1054
+ children: jsx(CloseIcon, {})
1055
+ })), renderUploadSelector()]
1056
+ })) : renderUploadSelector() : jsx(Fragment, {})]
782
1057
  }));
783
1058
  };
784
1059
 
785
1060
  //Dragger upload
786
- const Dragger = props => {
1061
+ var Dragger = function Dragger(props) {
787
1062
  return jsx(Upload, Object.assign({}, props, {
788
1063
  type: 'drag'
789
1064
  }));
@@ -982,274 +1257,352 @@ var css_248z$1 = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2022/4/20
982
1257
  styleInject(css_248z$1);
983
1258
 
984
1259
  //图片裁剪组件
985
- const ImgCrop = /*#__PURE__*/forwardRef((props, ref) => {
986
- const {
987
- aspect = 1,
988
- shape = 'rect',
989
- grid = false,
990
- quality = 0.4,
991
- fillColor = 'transparent',
992
- zoom = true,
993
- rotate = false,
994
- minZoom = 1,
995
- maxZoom = 3,
996
- modalTitle,
997
- modalWidth,
998
- modalOk,
999
- modalCancel,
1000
- onModalOk,
1001
- onModalCancel,
1002
- beforeCrop,
1003
- onUploadFail,
1004
- cropperProps,
1005
- children,
1006
- fixedCropSize = {
1260
+ var ImgCrop = /*#__PURE__*/forwardRef(function (props, ref) {
1261
+ var _props$aspect = props.aspect,
1262
+ aspect = _props$aspect === void 0 ? 1 : _props$aspect,
1263
+ _props$shape = props.shape,
1264
+ shape = _props$shape === void 0 ? 'rect' : _props$shape,
1265
+ _props$grid = props.grid,
1266
+ grid = _props$grid === void 0 ? false : _props$grid,
1267
+ _props$quality = props.quality,
1268
+ quality = _props$quality === void 0 ? 0.4 : _props$quality,
1269
+ _props$fillColor = props.fillColor,
1270
+ fillColor = _props$fillColor === void 0 ? 'transparent' : _props$fillColor,
1271
+ _props$zoom = props.zoom,
1272
+ zoom = _props$zoom === void 0 ? true : _props$zoom,
1273
+ _props$rotate = props.rotate,
1274
+ rotate = _props$rotate === void 0 ? false : _props$rotate,
1275
+ _props$minZoom = props.minZoom,
1276
+ minZoom = _props$minZoom === void 0 ? 1 : _props$minZoom,
1277
+ _props$maxZoom = props.maxZoom,
1278
+ maxZoom = _props$maxZoom === void 0 ? 3 : _props$maxZoom,
1279
+ modalTitle = props.modalTitle,
1280
+ modalWidth = props.modalWidth,
1281
+ modalOk = props.modalOk,
1282
+ modalCancel = props.modalCancel,
1283
+ onModalOk = props.onModalOk,
1284
+ onModalCancel = props.onModalCancel,
1285
+ beforeCrop = props.beforeCrop,
1286
+ onUploadFail = props.onUploadFail,
1287
+ cropperProps = props.cropperProps,
1288
+ children = props.children,
1289
+ _props$fixedCropSize = props.fixedCropSize,
1290
+ fixedCropSize = _props$fixedCropSize === void 0 ? {
1007
1291
  width: 120,
1008
1292
  height: 120
1009
- },
1010
- zoomTipFormatter = val => "".concat(Number(val) * 10 * 10),
1011
- zoomMarks = true,
1012
- rotateMarks = true,
1013
- rotateTipFormatter = val => "".concat(val)
1014
- } = props;
1015
- const intl = useFormatMessage('Upload', localeJson);
1016
- const [image, setImage] = useState('');
1017
- const fileRef = useRef();
1018
- const beforeUploadRef = useRef();
1019
- const resolveRef = useRef();
1020
- const rejectRef = useRef();
1293
+ } : _props$fixedCropSize,
1294
+ _props$zoomTipFormatt = props.zoomTipFormatter,
1295
+ zoomTipFormatter = _props$zoomTipFormatt === void 0 ? function (val) {
1296
+ return "".concat(Number(val) * 10 * 10);
1297
+ } : _props$zoomTipFormatt,
1298
+ _props$zoomMarks = props.zoomMarks,
1299
+ zoomMarks = _props$zoomMarks === void 0 ? true : _props$zoomMarks,
1300
+ _props$rotateMarks = props.rotateMarks,
1301
+ rotateMarks = _props$rotateMarks === void 0 ? true : _props$rotateMarks,
1302
+ _props$rotateTipForma = props.rotateTipFormatter,
1303
+ rotateTipFormatter = _props$rotateTipForma === void 0 ? function (val) {
1304
+ return "".concat(val);
1305
+ } : _props$rotateTipForma;
1306
+ var intl = useFormatMessage('Upload', localeJson);
1307
+ var _useState = useState(''),
1308
+ _useState2 = _slicedToArray(_useState, 2),
1309
+ image = _useState2[0],
1310
+ setImage = _useState2[1];
1311
+ var fileRef = useRef();
1312
+ var beforeUploadRef = useRef();
1313
+ var resolveRef = useRef();
1314
+ var rejectRef = useRef();
1021
1315
  //存储回调
1022
- const cbRef = useRef({});
1316
+ var cbRef = useRef({});
1023
1317
  cbRef.current.onModalOk = onModalOk;
1024
1318
  cbRef.current.onModalCancel = onModalCancel;
1025
1319
  cbRef.current.beforeCrop = beforeCrop;
1026
1320
  cbRef.current.onUploadFail = onUploadFail;
1027
- const easyCropRef = useRef({});
1321
+ var easyCropRef = useRef({});
1028
1322
  //上传组件
1029
- const uploadComponent = useMemo(() => {
1030
- const upload = Array.isArray(children) ? children[0] : children;
1031
- const _a = upload.props,
1032
- {
1033
- beforeUpload,
1034
- accept
1035
- } = _a,
1323
+ var uploadComponent = useMemo(function () {
1324
+ var upload = Array.isArray(children) ? children[0] : children;
1325
+ var _a = upload.props,
1326
+ beforeUpload = _a.beforeUpload,
1327
+ accept = _a.accept,
1036
1328
  restUploadProps = __rest(_a, ["beforeUpload", "accept"]);
1037
1329
  beforeUploadRef.current = beforeUpload;
1038
1330
  return Object.assign(Object.assign({}, upload), {
1039
1331
  props: Object.assign(Object.assign({}, restUploadProps), {
1040
1332
  accept: accept || 'image/*',
1041
- beforeUpload: (file, fileList) => {
1042
- return new Promise((resolve, reject) => __awaiter(void 0, void 0, void 0, function* () {
1043
- if (cbRef.current.beforeCrop && !(yield cbRef.current.beforeCrop(file, fileList))) {
1044
- reject();
1045
- return;
1046
- }
1047
- fileRef.current = file;
1048
- resolveRef.current = function (newFile) {
1049
- let flag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
1050
- var _a, _b;
1051
- (_b = (_a = cbRef.current).onModalOk) === null || _b === void 0 ? void 0 : _b.call(_a, newFile);
1052
- if (!flag) return resolve({
1053
- cropFile: newFile,
1054
- isUpload: flag
1055
- });
1056
- resolve(newFile);
1057
- };
1058
- rejectRef.current = uploadErr => {
1059
- var _a, _b;
1060
- (_b = (_a = cbRef.current).onUploadFail) === null || _b === void 0 ? void 0 : _b.call(_a, uploadErr);
1061
- reject(uploadErr);
1062
- };
1063
- const reader = new FileReader();
1064
- reader.addEventListener('load', () => typeof reader.result === 'string' && setImage(reader.result));
1065
- reader.readAsDataURL(file);
1066
- }));
1333
+ beforeUpload: function beforeUpload(file, fileList) {
1334
+ return new Promise(function (resolve, reject) {
1335
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee() {
1336
+ var reader;
1337
+ return regenerator.wrap(function _callee$(_context) {
1338
+ while (1) switch (_context.prev = _context.next) {
1339
+ case 0:
1340
+ _context.t0 = cbRef.current.beforeCrop;
1341
+ if (!_context.t0) {
1342
+ _context.next = 5;
1343
+ break;
1344
+ }
1345
+ _context.next = 4;
1346
+ return cbRef.current.beforeCrop(file, fileList);
1347
+ case 4:
1348
+ _context.t0 = !_context.sent;
1349
+ case 5:
1350
+ if (!_context.t0) {
1351
+ _context.next = 8;
1352
+ break;
1353
+ }
1354
+ reject();
1355
+ return _context.abrupt("return");
1356
+ case 8:
1357
+ fileRef.current = file;
1358
+ resolveRef.current = function (newFile) {
1359
+ var flag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
1360
+ var _a, _b;
1361
+ (_b = (_a = cbRef.current).onModalOk) === null || _b === void 0 ? void 0 : _b.call(_a, newFile);
1362
+ if (!flag) return resolve({
1363
+ cropFile: newFile,
1364
+ isUpload: flag
1365
+ });
1366
+ resolve(newFile);
1367
+ };
1368
+ rejectRef.current = function (uploadErr) {
1369
+ var _a, _b;
1370
+ (_b = (_a = cbRef.current).onUploadFail) === null || _b === void 0 ? void 0 : _b.call(_a, uploadErr);
1371
+ reject(uploadErr);
1372
+ };
1373
+ reader = new FileReader();
1374
+ reader.addEventListener('load', function () {
1375
+ return typeof reader.result === 'string' && setImage(reader.result);
1376
+ });
1377
+ reader.readAsDataURL(file);
1378
+ case 14:
1379
+ case "end":
1380
+ return _context.stop();
1381
+ }
1382
+ }, _callee);
1383
+ }));
1384
+ });
1067
1385
  }
1068
1386
  })
1069
1387
  });
1070
1388
  }, [children]);
1071
1389
  //modal 关闭后操作
1072
- const onClose = () => {
1390
+ var onClose = function onClose() {
1073
1391
  setImage('');
1074
1392
  easyCropRef.current.setZoomVal(INIT_ZOOM);
1075
1393
  easyCropRef.current.setRotateVal(INIT_ROTATE);
1076
1394
  };
1077
1395
  //modal cancel
1078
- const onCancel = useCallback(() => {
1396
+ var onCancel = useCallback(function () {
1079
1397
  var _a, _b;
1080
1398
  (_b = (_a = cbRef.current).onModalCancel) === null || _b === void 0 ? void 0 : _b.call(_a);
1081
1399
  onClose();
1082
1400
  }, []);
1083
1401
  //modal ok
1084
- const onOk = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
1085
- onClose();
1086
- const canvas = document.createElement('canvas');
1087
- const ctx = canvas.getContext('2d');
1088
- const imgSource = document.querySelector(".".concat(PREFIX, "-media"));
1089
- const {
1090
- width: cropWidth,
1091
- height: cropHeight,
1092
- x: cropX,
1093
- y: cropY
1094
- } = easyCropRef.current.cropPixelsRef.current;
1095
- if (rotate && easyCropRef.current.rotateVal !== INIT_ROTATE) {
1096
- const {
1097
- naturalWidth: imgWidth,
1098
- naturalHeight: imgHeight
1099
- } = imgSource;
1100
- const angle = easyCropRef.current.rotateVal * (Math.PI / 180);
1101
- // get container for rotated image
1102
- const sine = Math.abs(Math.sin(angle));
1103
- const cosine = Math.abs(Math.cos(angle));
1104
- const squareWidth = imgWidth * cosine + imgHeight * sine;
1105
- const squareHeight = imgHeight * cosine + imgWidth * sine;
1106
- canvas.width = squareWidth;
1107
- canvas.height = squareHeight;
1108
- ctx.fillStyle = fillColor;
1109
- ctx.fillRect(0, 0, squareWidth, squareHeight);
1110
- // rotate container
1111
- const squareHalfWidth = squareWidth / 2;
1112
- const squareHalfHeight = squareHeight / 2;
1113
- ctx.translate(squareHalfWidth, squareHalfHeight);
1114
- ctx.rotate(angle);
1115
- ctx.translate(-squareHalfWidth, -squareHalfHeight);
1116
- // draw rotated image
1117
- const imgX = (squareWidth - imgWidth) / 2;
1118
- const imgY = (squareHeight - imgHeight) / 2;
1119
- ctx.drawImage(imgSource, 0, 0, imgWidth, imgHeight, imgX, imgY, imgWidth, imgHeight);
1120
- // crop rotated image
1121
- const imgData = ctx.getImageData(0, 0, squareWidth, squareHeight);
1122
- canvas.width = cropWidth;
1123
- canvas.height = cropHeight;
1124
- ctx.putImageData(imgData, -cropX, -cropY);
1125
- } else {
1126
- canvas.width = cropWidth;
1127
- canvas.height = cropHeight;
1128
- ctx.fillStyle = fillColor;
1129
- ctx.fillRect(0, 0, cropWidth, cropHeight);
1130
- ctx.drawImage(imgSource, cropX, cropY, cropWidth, cropHeight, 0, 0, cropWidth, cropHeight);
1131
- }
1132
- //裁剪之后改变图片大小
1133
- const changeImageSizeAfterCrop = newFile => {
1134
- return new Promise(resolve => {
1135
- const {
1136
- name,
1137
- type,
1138
- uid
1139
- } = newFile;
1140
- const {
1141
- width,
1142
- height
1143
- } = fixedCropSize; //固定裁剪大小
1144
- const changeCanvas = document.createElement('canvas');
1145
- const changeCtx = changeCanvas.getContext('2d');
1146
- const img = new Image();
1147
- img.onload = () => {
1148
- changeCanvas.width = width;
1149
- changeCanvas.height = height;
1150
- changeCtx.drawImage(img, 0, 0, width, height);
1151
- changeCanvas.toBlob(cBlob => {
1152
- const changeFile = Object.assign(new File([cBlob], name, {
1153
- type
1154
- }), {
1155
- uid
1156
- });
1157
- resolve(changeFile);
1158
- }, type, quality);
1159
- };
1160
- img.onerror = () => {
1161
- resolve(newFile);
1162
- };
1163
- const fileReader = new FileReader();
1164
- fileReader.onload = () => {
1165
- img.src = fileReader.result;
1166
- };
1167
- fileReader.onerror = () => {
1168
- resolve(newFile);
1169
- };
1170
- fileReader.readAsDataURL(newFile);
1171
- });
1172
- };
1173
- // get the new image
1174
- let {
1175
- type,
1176
- name,
1177
- uid
1178
- } = fileRef.current;
1179
- if (/svg/gi.test(type)) {
1180
- //svg 转为 png
1181
- type = 'image/png';
1182
- const idx = name.lastIndexOf('.');
1183
- if (idx > -1) name = "".concat(name.substring(0, idx), ".png");
1184
- }
1185
- //转为blob
1186
- const onBlob = blob => __awaiter(void 0, void 0, void 0, function* () {
1187
- var _a, _b, _c, _d, _e, _f;
1188
- const newFile = Object.assign(new File([blob], name, {
1189
- type
1190
- }), {
1191
- uid
1192
- });
1193
- const changeFile = yield changeImageSizeAfterCrop(newFile);
1194
- if (typeof beforeUploadRef.current !== 'function') {
1195
- return (_a = resolveRef.current) === null || _a === void 0 ? void 0 : _a.call(resolveRef, changeFile);
1196
- }
1197
- const res = beforeUploadRef.current(changeFile, [changeFile]);
1198
- if (typeof res !== 'boolean' && !res) {
1199
- console.error('beforeUpload must return a boolean or Promise');
1200
- return;
1201
- }
1202
- if (res === true) return (_b = resolveRef.current) === null || _b === void 0 ? void 0 : _b.call(resolveRef, changeFile);
1203
- if (res === false) return (_c = resolveRef.current) === null || _c === void 0 ? void 0 : _c.call(resolveRef, changeFile, false);
1204
- if (res && res instanceof Promise) {
1205
- try {
1206
- const passedFile = yield res;
1207
- if (passedFile instanceof File || passedFile instanceof Blob) {
1208
- return (_d = resolveRef.current) === null || _d === void 0 ? void 0 : _d.call(resolveRef, passedFile);
1209
- }
1210
- (_e = resolveRef.current) === null || _e === void 0 ? void 0 : _e.call(resolveRef, changeFile, passedFile);
1211
- } catch (err) {
1212
- (_f = rejectRef.current) === null || _f === void 0 ? void 0 : _f.call(rejectRef, err);
1402
+ var onOk = useCallback(function () {
1403
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee3() {
1404
+ 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;
1405
+ return regenerator.wrap(function _callee3$(_context3) {
1406
+ while (1) switch (_context3.prev = _context3.next) {
1407
+ case 0:
1408
+ onClose();
1409
+ canvas = document.createElement('canvas');
1410
+ ctx = canvas.getContext('2d');
1411
+ imgSource = document.querySelector(".".concat(PREFIX, "-media"));
1412
+ _easyCropRef$current$ = easyCropRef.current.cropPixelsRef.current, cropWidth = _easyCropRef$current$.width, cropHeight = _easyCropRef$current$.height, cropX = _easyCropRef$current$.x, cropY = _easyCropRef$current$.y;
1413
+ if (rotate && easyCropRef.current.rotateVal !== INIT_ROTATE) {
1414
+ imgWidth = imgSource.naturalWidth, imgHeight = imgSource.naturalHeight;
1415
+ angle = easyCropRef.current.rotateVal * (Math.PI / 180); // get container for rotated image
1416
+ sine = Math.abs(Math.sin(angle));
1417
+ cosine = Math.abs(Math.cos(angle));
1418
+ squareWidth = imgWidth * cosine + imgHeight * sine;
1419
+ squareHeight = imgHeight * cosine + imgWidth * sine;
1420
+ canvas.width = squareWidth;
1421
+ canvas.height = squareHeight;
1422
+ ctx.fillStyle = fillColor;
1423
+ ctx.fillRect(0, 0, squareWidth, squareHeight);
1424
+ // rotate container
1425
+ squareHalfWidth = squareWidth / 2;
1426
+ squareHalfHeight = squareHeight / 2;
1427
+ ctx.translate(squareHalfWidth, squareHalfHeight);
1428
+ ctx.rotate(angle);
1429
+ ctx.translate(-squareHalfWidth, -squareHalfHeight);
1430
+ // draw rotated image
1431
+ imgX = (squareWidth - imgWidth) / 2;
1432
+ imgY = (squareHeight - imgHeight) / 2;
1433
+ ctx.drawImage(imgSource, 0, 0, imgWidth, imgHeight, imgX, imgY, imgWidth, imgHeight);
1434
+ // crop rotated image
1435
+ imgData = ctx.getImageData(0, 0, squareWidth, squareHeight);
1436
+ canvas.width = cropWidth;
1437
+ canvas.height = cropHeight;
1438
+ ctx.putImageData(imgData, -cropX, -cropY);
1439
+ } else {
1440
+ canvas.width = cropWidth;
1441
+ canvas.height = cropHeight;
1442
+ ctx.fillStyle = fillColor;
1443
+ ctx.fillRect(0, 0, cropWidth, cropHeight);
1444
+ ctx.drawImage(imgSource, cropX, cropY, cropWidth, cropHeight, 0, 0, cropWidth, cropHeight);
1445
+ }
1446
+ //裁剪之后改变图片大小
1447
+ changeImageSizeAfterCrop = function changeImageSizeAfterCrop(newFile) {
1448
+ return new Promise(function (resolve) {
1449
+ var name = newFile.name,
1450
+ type = newFile.type,
1451
+ uid = newFile.uid;
1452
+ var width = fixedCropSize.width,
1453
+ height = fixedCropSize.height; //固定裁剪大小
1454
+ var changeCanvas = document.createElement('canvas');
1455
+ var changeCtx = changeCanvas.getContext('2d');
1456
+ var img = new Image();
1457
+ img.onload = function () {
1458
+ changeCanvas.width = width;
1459
+ changeCanvas.height = height;
1460
+ changeCtx.drawImage(img, 0, 0, width, height);
1461
+ changeCanvas.toBlob(function (cBlob) {
1462
+ var changeFile = Object.assign(new File([cBlob], name, {
1463
+ type: type
1464
+ }), {
1465
+ uid: uid
1466
+ });
1467
+ resolve(changeFile);
1468
+ }, type, quality);
1469
+ };
1470
+ img.onerror = function () {
1471
+ resolve(newFile);
1472
+ };
1473
+ var fileReader = new FileReader();
1474
+ fileReader.onload = function () {
1475
+ img.src = fileReader.result;
1476
+ };
1477
+ fileReader.onerror = function () {
1478
+ resolve(newFile);
1479
+ };
1480
+ fileReader.readAsDataURL(newFile);
1481
+ });
1482
+ }; // get the new image
1483
+ _fileRef$current = fileRef.current, type = _fileRef$current.type, name = _fileRef$current.name, uid = _fileRef$current.uid;
1484
+ if (/svg/gi.test(type)) {
1485
+ //svg 转为 png
1486
+ type = 'image/png';
1487
+ idx = name.lastIndexOf('.');
1488
+ if (idx > -1) name = "".concat(name.substring(0, idx), ".png");
1489
+ }
1490
+ //转为blob
1491
+ onBlob = function onBlob(blob) {
1492
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee2() {
1493
+ var _a, _b, _c, _d, _e, _f, newFile, changeFile, res, passedFile;
1494
+ return regenerator.wrap(function _callee2$(_context2) {
1495
+ while (1) switch (_context2.prev = _context2.next) {
1496
+ case 0:
1497
+ newFile = Object.assign(new File([blob], name, {
1498
+ type: type
1499
+ }), {
1500
+ uid: uid
1501
+ });
1502
+ _context2.next = 3;
1503
+ return changeImageSizeAfterCrop(newFile);
1504
+ case 3:
1505
+ changeFile = _context2.sent;
1506
+ if (!(typeof beforeUploadRef.current !== 'function')) {
1507
+ _context2.next = 6;
1508
+ break;
1509
+ }
1510
+ return _context2.abrupt("return", (_a = resolveRef.current) === null || _a === void 0 ? void 0 : _a.call(resolveRef, changeFile));
1511
+ case 6:
1512
+ res = beforeUploadRef.current(changeFile, [changeFile]);
1513
+ if (!(typeof res !== 'boolean' && !res)) {
1514
+ _context2.next = 10;
1515
+ break;
1516
+ }
1517
+ console.error('beforeUpload must return a boolean or Promise');
1518
+ return _context2.abrupt("return");
1519
+ case 10:
1520
+ if (!(res === true)) {
1521
+ _context2.next = 12;
1522
+ break;
1523
+ }
1524
+ return _context2.abrupt("return", (_b = resolveRef.current) === null || _b === void 0 ? void 0 : _b.call(resolveRef, changeFile));
1525
+ case 12:
1526
+ if (!(res === false)) {
1527
+ _context2.next = 14;
1528
+ break;
1529
+ }
1530
+ return _context2.abrupt("return", (_c = resolveRef.current) === null || _c === void 0 ? void 0 : _c.call(resolveRef, changeFile, false));
1531
+ case 14:
1532
+ if (!(res && res instanceof Promise)) {
1533
+ _context2.next = 27;
1534
+ break;
1535
+ }
1536
+ _context2.prev = 15;
1537
+ _context2.next = 18;
1538
+ return res;
1539
+ case 18:
1540
+ passedFile = _context2.sent;
1541
+ if (!(passedFile instanceof File || passedFile instanceof Blob)) {
1542
+ _context2.next = 21;
1543
+ break;
1544
+ }
1545
+ return _context2.abrupt("return", (_d = resolveRef.current) === null || _d === void 0 ? void 0 : _d.call(resolveRef, passedFile));
1546
+ case 21:
1547
+ (_e = resolveRef.current) === null || _e === void 0 ? void 0 : _e.call(resolveRef, changeFile, passedFile);
1548
+ _context2.next = 27;
1549
+ break;
1550
+ case 24:
1551
+ _context2.prev = 24;
1552
+ _context2.t0 = _context2["catch"](15);
1553
+ (_f = rejectRef.current) === null || _f === void 0 ? void 0 : _f.call(rejectRef, _context2.t0);
1554
+ case 27:
1555
+ case "end":
1556
+ return _context2.stop();
1557
+ }
1558
+ }, _callee2, null, [[15, 24]]);
1559
+ }));
1560
+ };
1561
+ canvas.toBlob(onBlob, type, quality);
1562
+ case 11:
1563
+ case "end":
1564
+ return _context3.stop();
1213
1565
  }
1214
- }
1215
- });
1216
- canvas.toBlob(onBlob, type, quality);
1217
- }), [fillColor, quality, rotate]);
1566
+ }, _callee3);
1567
+ }));
1568
+ }, [fillColor, quality, rotate]);
1218
1569
  //img crop 组件
1219
- const getComponent = titleOfModal => jsxs(Fragment, {
1220
- children: [uploadComponent, image && jsx(Modal, Object.assign({
1221
- open: true,
1222
- className: "".concat(PREFIX, "-modal"),
1223
- size: 'md',
1224
- title: titleOfModal !== null && titleOfModal !== void 0 ? titleOfModal : intl({
1225
- id: 'editImage'
1226
- }),
1227
- onOk: onOk,
1228
- onCancel: onCancel,
1229
- okText: modalOk,
1230
- cancelText: modalCancel,
1231
- contentWidth: modalWidth
1232
- }, {
1233
- children: jsx(EasyCrop$1, {
1234
- ref: easyCropRef,
1235
- cropperRef: ref,
1236
- image: image,
1237
- aspect: aspect,
1238
- shape: shape,
1239
- grid: grid,
1240
- zoom: zoom,
1241
- rotate: rotate,
1242
- minZoom: minZoom,
1243
- maxZoom: maxZoom,
1244
- fixedCropSize: fixedCropSize,
1245
- cropperProps: cropperProps,
1246
- zoomTipFormatter: zoomTipFormatter,
1247
- zoomMarks: zoomMarks,
1248
- rotateMarks: rotateMarks,
1249
- rotateTipFormatter: rotateTipFormatter
1250
- })
1251
- }))]
1252
- });
1570
+ var getComponent = function getComponent(titleOfModal) {
1571
+ return jsxs(Fragment, {
1572
+ children: [uploadComponent, image && jsx(Modal, Object.assign({
1573
+ open: true,
1574
+ className: "".concat(PREFIX, "-modal"),
1575
+ size: 'md',
1576
+ title: titleOfModal !== null && titleOfModal !== void 0 ? titleOfModal : intl({
1577
+ id: 'editImage'
1578
+ }),
1579
+ onOk: onOk,
1580
+ onCancel: onCancel,
1581
+ okText: modalOk,
1582
+ cancelText: modalCancel,
1583
+ contentWidth: modalWidth
1584
+ }, {
1585
+ children: jsx(EasyCrop$1, {
1586
+ ref: easyCropRef,
1587
+ cropperRef: ref,
1588
+ image: image,
1589
+ aspect: aspect,
1590
+ shape: shape,
1591
+ grid: grid,
1592
+ zoom: zoom,
1593
+ rotate: rotate,
1594
+ minZoom: minZoom,
1595
+ maxZoom: maxZoom,
1596
+ fixedCropSize: fixedCropSize,
1597
+ cropperProps: cropperProps,
1598
+ zoomTipFormatter: zoomTipFormatter,
1599
+ zoomMarks: zoomMarks,
1600
+ rotateMarks: rotateMarks,
1601
+ rotateTipFormatter: rotateTipFormatter
1602
+ })
1603
+ }))]
1604
+ });
1605
+ };
1253
1606
  return jsx(Fragment, {
1254
1607
  children: getComponent(modalTitle)
1255
1608
  });