@para-ui/core 4.0.22 → 4.0.25

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 (115) hide show
  1. package/AutoTips/index.js +24 -13
  2. package/Button/index.js +1 -1
  3. package/ButtonGroup/index.js +1 -1
  4. package/Cascader/index.js +7 -6
  5. package/ComboSelect/index.js +2 -2
  6. package/CopyText/index.js +1 -1
  7. package/CycleSelector/index.d.ts +14 -2
  8. package/CycleSelector/index.js +43 -4
  9. package/DatePicker/index.js +1 -1
  10. package/Descriptions/index.js +1 -1
  11. package/Desktop/index.js +1 -1
  12. package/Drawer/index.js +1 -1
  13. package/Dropdown/index.js +1 -1
  14. package/DynamicMultiBox/index.js +2 -2
  15. package/Empty/index.js +0 -6
  16. package/Form/index.js +11 -8
  17. package/FormItem/index.js +3 -3
  18. package/FunctionModal/index.js +3 -3
  19. package/Image/PreviewGroup.d.ts +20 -0
  20. package/Image/index.d.ts +10 -0
  21. package/Image/index.js +1485 -0
  22. package/InputLang/index.js +1 -1
  23. package/Modal/index.js +1 -1
  24. package/MultiBox/index.js +1 -1
  25. package/OperateBtn/index.js +1 -1
  26. package/PageHeader/index.js +1 -1
  27. package/Pagination/index.js +3 -3
  28. package/PopConfirm/index.js +1 -1
  29. package/Popover/index.js +1 -1
  30. package/Querying/index.js +0 -12
  31. package/QuickReply/index.js +1 -1
  32. package/README.md +20 -0
  33. package/Search/index.js +1 -1
  34. package/Select/index.d.ts +2 -0
  35. package/Select/index.js +27 -10
  36. package/SelectInput/index.js +1 -1
  37. package/Selector/index.js +1 -1
  38. package/SelectorPicker/index.js +1 -1
  39. package/SingleBox/index.js +1 -1
  40. package/Slider/index.js +29 -14
  41. package/Slider/interface.d.ts +4 -0
  42. package/Table/index.js +9 -3
  43. package/Tabs/index.js +1 -1
  44. package/TextField/index.js +5 -4
  45. package/TimePicker/index.js +1 -1
  46. package/ToggleButton/index.js +1 -1
  47. package/Transfer/index.js +50 -44
  48. package/Tree/index.js +2 -2
  49. package/Upload/ImgCrop/EasyCrop.d.ts +2 -2
  50. package/Upload/ImgCrop/constants.d.ts +12 -0
  51. package/Upload/ImgCrop/interface.d.ts +10 -0
  52. package/Upload/index.js +506 -128
  53. package/Upload/interface.d.ts +43 -0
  54. package/Upload/util.d.ts +7 -0
  55. package/_verture/Portal-5bd49559.js +1698 -0
  56. package/_verture/{index-066d47d4.js → index-5f205d87.js} +38 -1727
  57. package/_verture/{index-b892f976.js → index-93662604.js} +2 -2
  58. package/_verture/{index-389675ab.js → index-bde7aabe.js} +1 -1
  59. package/index.d.ts +2 -0
  60. package/index.js +18 -12
  61. package/locale/index.js +2 -2
  62. package/package.json +3 -2
  63. package/umd/AutoBox.js +1 -1
  64. package/umd/AutoTips.js +1 -1
  65. package/umd/Breadcrumbs.js +2 -2
  66. package/umd/Button.js +2 -2
  67. package/umd/ButtonGroup.js +2 -2
  68. package/umd/Cascader.js +1 -1
  69. package/umd/ComboSelect.js +3 -3
  70. package/umd/CopyText.js +2 -2
  71. package/umd/CycleSelector.js +3 -3
  72. package/umd/DatePicker.js +2 -2
  73. package/umd/Descriptions.js +2 -2
  74. package/umd/Desktop.js +2 -2
  75. package/umd/Drawer.js +2 -2
  76. package/umd/Dropdown.js +1 -1
  77. package/umd/DynamicMultiBox.js +3 -3
  78. package/umd/Empty.js +1 -1
  79. package/umd/Form.js +4 -4
  80. package/umd/FormItem.js +3 -3
  81. package/umd/FunctionModal.js +6 -6
  82. package/umd/Image.js +42 -0
  83. package/umd/InputLang.js +2 -2
  84. package/umd/Menu.js +1 -1
  85. package/umd/Modal.js +5 -5
  86. package/umd/MultiBox.js +2 -2
  87. package/umd/OperateBtn.js +4 -4
  88. package/umd/PageHeader.js +2 -2
  89. package/umd/Pagination.js +2 -2
  90. package/umd/PopConfirm.js +4 -4
  91. package/umd/PopMenu.js +2 -2
  92. package/umd/Popover.js +1 -1
  93. package/umd/Querying.js +1 -1
  94. package/umd/QuickReply.js +4 -4
  95. package/umd/Search.js +2 -2
  96. package/umd/Select.js +3 -3
  97. package/umd/SelectInput.js +2 -2
  98. package/umd/Selector.js +2 -2
  99. package/umd/SelectorPicker.js +5 -5
  100. package/umd/SingleBox.js +2 -2
  101. package/umd/Slider.js +2 -2
  102. package/umd/Stepper.js +1 -1
  103. package/umd/Table.js +6 -6
  104. package/umd/Tabs.js +4 -4
  105. package/umd/Tag.js +1 -1
  106. package/umd/TextField.js +3 -3
  107. package/umd/TimePicker.js +2 -2
  108. package/umd/Title.js +1 -1
  109. package/umd/ToggleButton.js +2 -2
  110. package/umd/Transfer.js +2 -2
  111. package/umd/Tree.js +1 -1
  112. package/umd/Upload.js +6 -6
  113. package/umd/locale.js +1 -1
  114. /package/_verture/{index-4b965dd7.js → index-0eca82dc.js} +0 -0
  115. /package/_verture/{modalContext-c8cc3107.js → modalContext-c57b51b7.js} +0 -0
package/Upload/index.js CHANGED
@@ -1,47 +1,181 @@
1
1
  import { a as __awaiter, _ as __rest } from '../_verture/tslib.es6-55ed4bd2.js';
2
- import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
3
- import { useState, useEffect, useRef, memo, forwardRef, useCallback, useImperativeHandle, useMemo } from 'react';
2
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
3
+ import { useState, useRef, useMemo, useEffect, memo, forwardRef, useCallback, useImperativeHandle } from 'react';
4
4
  import RcUpload from 'rc-upload';
5
+ import clsx from 'clsx';
5
6
  import UploadIcon from '@para-ui/icons/UploadFile';
6
7
  import LoadingIcon from '@para-ui/icons/Loading';
8
+ import EditOutline from '@para-ui/icons/EditOutline';
7
9
  import Delete from '@para-ui/icons/Delete';
8
- import TextIcon from '@para-ui/icons/Text';
10
+ import FileOutlined from '@para-ui/icons/Document';
9
11
  import PhotoIcon from '@para-ui/icons/Photo';
10
- import clsx from 'clsx';
12
+ import PreviewOpen from '@para-ui/icons/PreviewOpen';
13
+ import InfoOutlined from '@para-ui/icons/WarningCircle';
14
+ import { Tooltip } from '../Tooltip/index.js';
15
+ import AutoTips from '../AutoTips/index.js';
16
+ import Image$1 from '../Image/index.js';
17
+ import OperateBtn from '../OperateBtn/index.js';
11
18
  import { $ as $prefixCls, a as $rcPrefixCls } from '../_verture/constant-5317fc89.js';
12
19
  import { s as styleInject } from '../_verture/style-inject.es-300983ab.js';
13
20
  import Forbid from '@para-ui/icons/Forbid';
14
21
  import { u as useFormatMessage } from '../_verture/useFormatMessage-1fc7c957.js';
15
- import EditOutline from '@para-ui/icons/EditOutline';
16
22
  import { Button } from '../Button/index.js';
17
23
  import { _ as _slicedToArray } from '../_verture/slicedToArray-a8206399.js';
18
- import { Slider } from '../Slider/index.js';
19
24
  import Cropper from 'react-easy-crop';
25
+ import PlusCircle from '@para-ui/icons/PlusCircle';
26
+ import MinusCircle from '@para-ui/icons/MinusCircle';
27
+ import TurnRight from '@para-ui/icons/TurnRight';
28
+ import TurnLeft from '@para-ui/icons/TurnLeft';
29
+ import { Slider } from '../Slider/index.js';
20
30
  import { Modal } from '../Modal/index.js';
21
- import '../_verture/index-ca413216.js';
22
- import '@paraview/lib';
23
- import '@para-ui/icons/LoadingF';
24
- import '../Tooltip/index.js';
25
31
  import 'rc-tooltip';
26
32
  import 'rc-tooltip/lib/placements';
33
+ import '@paraview/lib';
34
+ import '../_verture/Portal-5bd49559.js';
35
+ import 'react-dom';
36
+ import '../_verture/typeof-adeedc13.js';
37
+ import '../_verture/toConsumableArray-8f4c9589.js';
38
+ import '../_verture/unsupportedIterableToArray-cb478f24.js';
39
+ import '../_verture/defineProperty-6f62bb2a.js';
40
+ import 'rc-dialog';
41
+ import 'rc-motion';
42
+ import '@para-ui/icons/Sort';
43
+ import '@para-ui/icons/Switch';
44
+ import '@para-ui/icons/LeftCircleF';
45
+ import '@para-ui/icons/RightCircleF';
46
+ import '@para-ui/icons/CloseCircleF';
47
+ import '@para-ui/icons/More';
48
+ import '../Popover/index.js';
49
+ import '../_verture/usePopupContainer-635f66f4.js';
50
+ import '../PopConfirm/index.js';
51
+ import '@para-ui/icons/CheckCircleF';
52
+ import '@para-ui/icons/WarningCircleF';
53
+ import '@para-ui/icons/LoadingF';
27
54
  import '@para-ui/icons/Down';
28
- import '../_verture/index-389675ab.js';
55
+ import '../_verture/index-bde7aabe.js';
29
56
  import 'rc-dropdown';
30
- import '../_verture/usePopupContainer-635f66f4.js';
31
57
  import 'dayjs';
32
- import '../AutoTips/index.js';
33
- import '../_verture/unsupportedIterableToArray-cb478f24.js';
58
+ import '../_verture/index-ca413216.js';
34
59
  import 'rc-slider';
35
- import 'rc-dialog';
36
60
  import '@para-ui/icons/Close';
37
- import 'react-dom';
38
- import '@para-ui/icons/CheckCircleF';
39
- import '@para-ui/icons/WarningCircleF';
40
- import '@para-ui/icons/CloseCircleF';
41
61
 
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}";
62
+ var extname = function extname() {
63
+ var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
64
+ var temp = url.split('/');
65
+ var filename = temp[temp.length - 1];
66
+ var filenameWithoutSuffix = filename.split(/#|\?/)[0];
67
+ return (/\.[^./\\]*$/.exec(filenameWithoutSuffix) || [''])[0];
68
+ };
69
+ var isImageFileType = function isImageFileType(type) {
70
+ return type.indexOf('image/') === 0;
71
+ };
72
+ var isImageUrl = function isImageUrl(file) {
73
+ if (file.type && !file.thumbUrl) {
74
+ return isImageFileType(file.type);
75
+ }
76
+ var url = file.thumbUrl || file.url || '';
77
+ var extension = extname(url);
78
+ if (/^data:image\//.test(url) || /(webp|svg|png|gif|jpg|jpeg|jfif|bmp|dpg|ico|heic|heif)$/i.test(extension)) {
79
+ return true;
80
+ }
81
+ if (/^data:/.test(url)) {
82
+ // other file types of base64
83
+ return false;
84
+ }
85
+ if (extension) {
86
+ // other file types which have extension
87
+ return false;
88
+ }
89
+ return true;
90
+ };
91
+
92
+ 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}";
43
93
  styleInject(css_248z$4);
44
94
 
95
+ const FileIcon = props => {
96
+ return jsxs("svg", Object.assign({
97
+ viewBox: "0 0 180 180",
98
+ className: 'upload-list-picture-file'
99
+ }, {
100
+ children: [jsx("rect", {
101
+ className: "upload-list-picture-filea",
102
+ width: "180",
103
+ height: "180"
104
+ }), jsxs("g", Object.assign({
105
+ className: "upload-list-picture-fileb",
106
+ transform: "matrix(0.985, -0.174, 0.174, 0.985, 10.889, 34.798)"
107
+ }, {
108
+ children: [jsx("path", {
109
+ className: "upload-list-picture-filec",
110
+ d: "M4.016,0h51.2c2.218,0,3.88,1.27,4.671,3.906L63,14.175H0V3.91A3.964,3.964,0,0,1,4.016,0Z",
111
+ transform: "translate(0 0)"
112
+ }), jsx("path", {
113
+ className: "upload-list-picture-filed",
114
+ d: "M0,0H122a4,4,0,0,1,4,4V116.15a4,4,0,0,1-4,4H4a4,4,0,0,1-4-4V0A0,0,0,0,1,0,0Z",
115
+ transform: "translate(0 14.175)"
116
+ }), jsx("rect", {
117
+ className: "upload-list-picture-filee",
118
+ width: "8.825",
119
+ height: "8.825",
120
+ rx: "4",
121
+ transform: "translate(23.533 32.805)"
122
+ }), jsx("rect", {
123
+ className: "upload-list-picture-filef",
124
+ width: "78.934",
125
+ height: "7.875",
126
+ rx: "3.938",
127
+ transform: "translate(23.533 48.984)"
128
+ }), jsx("rect", {
129
+ className: "upload-list-picture-filef",
130
+ width: "25.739",
131
+ height: "7.875",
132
+ rx: "3.938",
133
+ transform: "translate(23.533 65.163)"
134
+ }), jsx("rect", {
135
+ className: "upload-list-picture-filef",
136
+ width: "62.755",
137
+ height: "7.875",
138
+ rx: "3.938",
139
+ transform: "translate(39.712 32.805)"
140
+ })]
141
+ })), jsxs("g", Object.assign({
142
+ transform: "translate(36 23.151)"
143
+ }, {
144
+ children: [jsx("path", {
145
+ className: "upload-list-picture-filec",
146
+ d: "M4.016,0h51.2c2.218,0,3.88,1.27,4.671,3.906L63,14.175H0V3.91A3.964,3.964,0,0,1,4.016,0Z"
147
+ }), jsx("path", {
148
+ className: "upload-list-picture-filed",
149
+ d: "M0,0H122a4,4,0,0,1,4,4V121.55a4,4,0,0,1-4,4H4a4,4,0,0,1-4-4V0A0,0,0,0,1,0,0Z",
150
+ transform: "translate(0 14.175)"
151
+ }), jsx("rect", {
152
+ className: "upload-list-picture-filee",
153
+ width: "8.825",
154
+ height: "8.825",
155
+ rx: "4",
156
+ transform: "translate(23.533 32.805)"
157
+ }), jsx("rect", {
158
+ className: "upload-list-picture-filef",
159
+ width: "78.934",
160
+ height: "7.875",
161
+ rx: "3.938",
162
+ transform: "translate(23.533 48.984)"
163
+ }), jsx("rect", {
164
+ className: "upload-list-picture-filef",
165
+ width: "25.739",
166
+ height: "7.875",
167
+ rx: "3.938",
168
+ transform: "translate(23.533 65.163)"
169
+ }), jsx("rect", {
170
+ className: "upload-list-picture-filef",
171
+ width: "62.755",
172
+ height: "7.875",
173
+ rx: "3.938",
174
+ transform: "translate(39.712 32.805)"
175
+ })]
176
+ }))]
177
+ }));
178
+ };
45
179
  //UploadList
46
180
  const UploadList = props => {
47
181
  const {
@@ -49,25 +183,139 @@ const UploadList = props => {
49
183
  items = [],
50
184
  onRemove,
51
185
  showRemoveIcon = true,
186
+ showPreviewIcon = true,
187
+ previewIcon,
52
188
  removeIcon,
53
189
  itemRender,
54
- readonly
190
+ readonly,
191
+ operateBtnProps,
192
+ actionRender,
193
+ onPreview
55
194
  } = props;
56
195
  const [uploadList, setUploadList] = useState([]);
196
+ const [visible, setVisible] = useState(false);
197
+ const [current, setCurrent] = useState(0);
198
+ useRef(null);
57
199
  //处理删除
58
200
  const handleRemove = (file, evt) => {
59
201
  evt.stopPropagation();
60
202
  onRemove === null || onRemove === void 0 ? void 0 : onRemove(file);
61
203
  };
204
+ const isError = file => file.status === 'error';
205
+ const onImageError = file => {
206
+ if (file.status === 'error') return;
207
+ file.status = 'error';
208
+ setUploadList([...uploadList]);
209
+ };
210
+ const previewItems = useMemo(() => {
211
+ var _a;
212
+ const originItems = items === null || items === void 0 ? void 0 : items.filter(item => isImageUrl(item) && !isError(item));
213
+ 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)) || [],
215
+ originItems: originItems
216
+ };
217
+ }, [items]);
218
+ const getCurrent = file => {
219
+ return previewItems.originItems.findIndex(i => i.uid === file.uid);
220
+ };
221
+ // 处理预览
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
+ });
230
+ // 图片墙操作按钮
231
+ const pictureCardAction = file => {
232
+ const list = [];
233
+ if (isImageUrl(file) && !isError(file) && showPreviewIcon) list.push({
234
+ icon: previewIcon || jsx(PreviewOpen, {}),
235
+ key: 'view'
236
+ });
237
+ if (showRemoveIcon && !readonly) list.push({
238
+ icon: removeIcon || jsx(Delete, {}),
239
+ key: 'delete'
240
+ });
241
+ if (!list.length) return null;
242
+ const onClick = (item, e) => {
243
+ if (item.key === 'view') handlePreview(file, e);
244
+ if (item.key === 'delete') handleRemove(file, e);
245
+ };
246
+ return jsx(OperateBtn, {
247
+ className: 'upload-list-actions',
248
+ showNum: 2,
249
+ list: list,
250
+ onClick: onClick
251
+ });
252
+ };
62
253
  //渲染列表actions
63
254
  const renderActions = file => {
64
- return showRemoveIcon && !readonly && jsx("span", Object.assign({
255
+ const actions = {
256
+ onRemove: () => onRemove === null || onRemove === void 0 ? void 0 : onRemove(file),
257
+ onPreview: () => handlePreview(file)
258
+ };
259
+ if (actionRender) return actionRender(file, actions);
260
+ if (operateBtnProps) return jsx(OperateBtn, Object.assign({
65
261
  className: 'upload-list-actions',
66
- onClick: evt => handleRemove(file, evt)
262
+ showNum: 2
263
+ }, operateBtnProps(file, actions)));
264
+ if (listType === 'picture-card') return pictureCardAction(file);
265
+ return !readonly && jsx("div", Object.assign({
266
+ className: 'upload-list-actions'
67
267
  }, {
68
- children: removeIcon || jsx(Delete, {})
268
+ children: showRemoveIcon && jsx("span", Object.assign({
269
+ onClick: evt => handleRemove(file, evt)
270
+ }, {
271
+ children: removeIcon || jsx(Delete, {})
272
+ }))
69
273
  }));
70
274
  };
275
+ // 渲染图标
276
+ const renderIcon = file => {
277
+ const isImage = isImageUrl(file);
278
+ if (file.status === 'error') return jsx(InfoOutlined, {});
279
+ return isImage ? jsx(PhotoIcon, {}) : jsx(FileOutlined, {});
280
+ };
281
+ const renderTextItem = file => {
282
+ const listItemNameClass = 'upload-list-text-name';
283
+ const fileName = file.url && !isError(file) ? jsx("a", Object.assign({
284
+ target: "_blank",
285
+ rel: "noopener noreferrer",
286
+ className: listItemNameClass,
287
+ // title={file.name}
288
+ href: file.url,
289
+ onClick: e => onPreview === null || onPreview === void 0 ? void 0 : onPreview(file, e)
290
+ }, {
291
+ children: file.name
292
+ }), "view") : jsx("div", Object.assign({
293
+ className: listItemNameClass,
294
+ onClick: e => onPreview === null || onPreview === void 0 ? void 0 : onPreview(file, e),
295
+ title: file.name
296
+ }, {
297
+ children: file.name
298
+ }), "view");
299
+ const listItem = jsxs("div", Object.assign({
300
+ className: clsx('upload-list-text-item', isError(file) && 'upload-list-text-item-error')
301
+ }, {
302
+ children: [jsx("div", Object.assign({
303
+ className: clsx('upload-list-fileicon', showRemoveIcon && 'upload-list-fileicon-active')
304
+ }, {
305
+ children: renderIcon(file)
306
+ })), jsx(AutoTips, Object.assign({
307
+ placement: "top-start"
308
+ }, {
309
+ children: fileName
310
+ }))]
311
+ }));
312
+ if (isError(file) && typeof file.response === 'string') return jsx(Tooltip, Object.assign({
313
+ title: file.response
314
+ }, {
315
+ children: listItem
316
+ }));
317
+ return listItem;
318
+ };
71
319
  //文件列表 text
72
320
  const renderFileListText = () => {
73
321
  if (!(uploadList === null || uploadList === void 0 ? void 0 : uploadList.length)) return null;
@@ -76,25 +324,17 @@ const UploadList = props => {
76
324
  if (itemRender)
77
325
  //自定义渲染
78
326
  return itemRender(file, uploadList);
79
- const isImage = !!((_a = file.type) === null || _a === void 0 ? void 0 : _a.includes('image/'));
327
+ !!((_a = file.type) === null || _a === void 0 ? void 0 : _a.includes('image/'));
80
328
  return jsx("div", Object.assign({
81
329
  className: 'upload-list-item'
82
330
  }, {
83
331
  children: jsx("div", Object.assign({
84
332
  className: 'upload-list-item-info'
85
333
  }, {
86
- children: jsxs("span", Object.assign({
334
+ children: jsxs("div", Object.assign({
87
335
  className: 'upload-list-text'
88
336
  }, {
89
- children: [jsx("span", Object.assign({
90
- className: clsx('upload-list-fileicon', showRemoveIcon && 'upload-list-fileicon-active')
91
- }, {
92
- children: isImage ? jsx(PhotoIcon, {}) : jsx(TextIcon, {})
93
- })), renderActions(file), jsx("span", Object.assign({
94
- className: 'upload-list-text-name'
95
- }, {
96
- children: file.name
97
- }))]
337
+ children: [renderTextItem(file), renderActions(file)]
98
338
  }))
99
339
  }))
100
340
  }), idx);
@@ -104,21 +344,40 @@ const UploadList = props => {
104
344
  const renderFileListPicture = () => {
105
345
  if (!(uploadList === null || uploadList === void 0 ? void 0 : uploadList.length)) return null;
106
346
  return uploadList.map((file, idx) => {
107
- if (itemRender)
108
- //自定义渲染
109
- return itemRender(file, uploadList);
110
- return jsxs("div", Object.assign({
111
- className: "upload-list-picture-item ".concat(readonly ? 'upload-list-picture-item-readonly' : '')
112
- }, {
113
- children: [jsx("img", {
114
- src: file.dataUrl || file.url,
115
- alt: file.name
116
- }), jsx("span", Object.assign({
347
+ /*自定义渲染*/
348
+ if (itemRender) return itemRender(file, uploadList);
349
+ let isImage = isImageUrl(file);
350
+ let pictureItem = jsxs(Fragment, {
351
+ children: [isImage ? jsx("img", {
352
+ src: file.thumbUrl || file.dataUrl || file.url,
353
+ alt: file.name,
354
+ onError: () => onImageError(file)
355
+ }) : jsx(FileIcon, {
356
+ className: 'upload-list-picture-file'
357
+ })
358
+ // <Microsoft className={'upload-list-picture-file'} />
359
+ , jsx("div", Object.assign({
117
360
  className: 'upload-list-picture-name',
118
361
  title: file.name
119
362
  }, {
120
363
  children: file.name
121
364
  })), renderActions(file)]
365
+ });
366
+ if (isError(file)) {
367
+ pictureItem = jsxs("div", Object.assign({
368
+ className: 'upload-list-picture-error'
369
+ }, {
370
+ children: [jsx(PhotoIcon, {}), jsx("div", Object.assign({
371
+ className: 'upload-list-picture-error-name'
372
+ }, {
373
+ children: file.name
374
+ })), renderActions(file)]
375
+ }));
376
+ }
377
+ return jsx("div", Object.assign({
378
+ className: clsx('upload-list-picture-item', !pictureCardAction(file) && 'upload-list-picture-item-readonly')
379
+ }, {
380
+ children: pictureItem
122
381
  }), idx);
123
382
  });
124
383
  };
@@ -151,8 +410,8 @@ const UploadList = props => {
151
410
  return pre;
152
411
  });
153
412
  }, [items]);
154
- return jsx(Fragment, {
155
- children: listType === 'text' ? jsx("section", Object.assign({
413
+ return jsxs(Fragment, {
414
+ children: [listType === 'text' ? jsx("section", Object.assign({
156
415
  className: "".concat($prefixCls, "-upload-list-text")
157
416
  }, {
158
417
  children: renderFileListText()
@@ -160,7 +419,19 @@ const UploadList = props => {
160
419
  className: "".concat($prefixCls, "-upload-list-picture")
161
420
  }, {
162
421
  children: renderFileListPicture()
163
- }))
422
+ })), jsx(Image$1.PreviewGroup, {
423
+ preview: {
424
+ visible,
425
+ onVisibleChange: value => {
426
+ setVisible(value);
427
+ },
428
+ onChange: value => {
429
+ setCurrent(value);
430
+ },
431
+ current
432
+ },
433
+ items: previewItems.items
434
+ })]
164
435
  });
165
436
  };
166
437
 
@@ -180,7 +451,7 @@ var en = {
180
451
  uploadError: 'Upload error',
181
452
  uploading: 'Uploading',
182
453
  clickUploadFile: 'Click to upload file',
183
- dragFileUpload: 'After downloading the template and completing the information, you can directly drag and drop the file here to upload it. Supported formats: XLS, XLSX...',
454
+ dragFileUpload: 'After downloading the template and completing the information, you can directly drag and drop the file here to upload it\nSupported formats: XLS, XLSX',
184
455
  add: 'Add',
185
456
  edit: 'Edit',
186
457
  disabled: 'Disabled',
@@ -192,7 +463,7 @@ var zh = {
192
463
  uploadError: '上传失败',
193
464
  uploading: '正在上传',
194
465
  clickUploadFile: '点击上传文件',
195
- dragFileUpload: '下载模板并完善信息后,可直接将文件拖拽到此处进行上传,支持格式:XLS、XLSX...',
466
+ dragFileUpload: '下载模板并完善信息后,可直接将文件拖拽到此处进行上传\n支持格式:XLS、XLSX',
196
467
  add: '新增',
197
468
  edit: '编辑',
198
469
  disabled: '禁用',
@@ -205,7 +476,7 @@ var localeJson = {
205
476
  en
206
477
  };
207
478
 
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}";
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}";
209
480
  styleInject(css_248z$2);
210
481
 
211
482
  //ImageUpload
@@ -226,15 +497,20 @@ const ImageUpload = props => {
226
497
  maxCount,
227
498
  children = null,
228
499
  itemRender,
229
- showUploadError = true,
500
+ showUploadError = false,
230
501
  stash = false,
231
502
  uploading = true,
232
503
  loading = false,
233
504
  showLoading: showLoadingProp = false,
234
505
  defaultImage,
235
- readonly
506
+ readonly,
507
+ onPreview,
508
+ actionRender,
509
+ operateBtnProps,
510
+ disabledTooltip,
511
+ removeErrorTip
236
512
  } = props,
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"]);
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"]);
238
514
  const intl = useFormatMessage('Upload', localeJson);
239
515
  const [uploadFileList, setUploadFileList] = useState(defaultFileList); //文件列表
240
516
  const [showLoading, setShowLoading] = useState(false); //upload loading
@@ -244,7 +520,9 @@ const ImageUpload = props => {
244
520
  }); //不显示列表时上传头像
245
521
  const {
246
522
  showRemoveIcon,
247
- removeIcon
523
+ removeIcon,
524
+ showPreviewIcon,
525
+ previewIcon
248
526
  } = typeof showUploadList === 'boolean' ? {} : showUploadList; //显示上传列表
249
527
  const {
250
528
  uploadErrorMsg = intl({
@@ -253,6 +531,7 @@ const ImageUpload = props => {
253
531
  leaveDelay = 2000
254
532
  } = typeof showUploadError === 'boolean' ? {} : showUploadError; //错误信息提示
255
533
  const cropFileRef = useRef(); //裁剪文件
534
+ const isAvatarMode = useMemo(() => !showUploadList && avatar.imageUrl && !showLoading, [showUploadList, avatar.imageUrl, showLoading]);
256
535
  useEffect(() => {
257
536
  setShowLoading(loading);
258
537
  }, [loading]);
@@ -285,6 +564,12 @@ const ImageUpload = props => {
285
564
  onError(error, response, file) {
286
565
  setShowLoading(false);
287
566
  showErrTip(!!showUploadError);
567
+ if (!showUploadError) {
568
+ file.status = 'error';
569
+ file.response = (error === null || error === void 0 ? void 0 : error.message) || uploadErrorMsg;
570
+ const nextFileList = updateFileList(file);
571
+ onInternalChange(nextFileList);
572
+ }
288
573
  onError === null || onError === void 0 ? void 0 : onError(error, response, file);
289
574
  },
290
575
  onProgress(e, file) {
@@ -411,31 +696,34 @@ const ImageUpload = props => {
411
696
  items: uploadFileList,
412
697
  showRemoveIcon: showRemoveIcon,
413
698
  removeIcon: removeIcon,
699
+ showPreviewIcon: showPreviewIcon,
700
+ previewIcon: previewIcon,
414
701
  onRemove: handleRemove,
415
- itemRender: itemRender
702
+ itemRender: itemRender,
703
+ onPreview: onPreview,
704
+ actionRender: actionRender,
705
+ operateBtnProps: operateBtnProps
416
706
  });
417
- //渲染内容
707
+ //渲染内容 avatar
418
708
  const renderUploadContent = () => {
419
709
  var _a;
420
- if (!showUploadList && avatar.imageUrl && !showLoading) {
421
- return jsxs("div", Object.assign({
422
- className: 'upload-img-wrapper'
710
+ const avatarUploadNode = jsxs("div", Object.assign({
711
+ className: 'upload-img-wrapper'
712
+ }, {
713
+ children: [jsx("img", {
714
+ src: avatar.imageUrl,
715
+ alt: (_a = avatar.imageName) !== null && _a !== void 0 ? _a : ''
716
+ }), avatar.imageName && jsx("span", Object.assign({
717
+ className: 'upload-img-wrapper-name'
423
718
  }, {
424
- children: [jsx("img", {
425
- src: avatar.imageUrl,
426
- alt: (_a = avatar.imageName) !== null && _a !== void 0 ? _a : ''
427
- }), avatar.imageName && jsx("span", Object.assign({
428
- className: 'upload-img-wrapper-name'
429
- }, {
430
- children: avatar.imageName
431
- })), jsx("span", Object.assign({
432
- className: 'upload-img-wrapper-action'
433
- }, {
434
- children: jsx(EditOutline, {})
435
- }))]
436
- }));
437
- }
438
- return jsxs(Fragment, {
719
+ children: avatar.imageName
720
+ })), jsx("span", Object.assign({
721
+ className: 'upload-img-wrapper-action'
722
+ }, {
723
+ children: jsx(EditOutline, {})
724
+ }))]
725
+ }));
726
+ const uploadNode = jsxs(Fragment, {
439
727
  children: [showLoading ? jsx(LoadingIcon, {
440
728
  className: 'upload-image-loading'
441
729
  }) : jsx(UploadIcon, {
@@ -448,6 +736,23 @@ const ImageUpload = props => {
448
736
  }) : children
449
737
  }))]
450
738
  });
739
+ if (restProps.disabled && disabledTooltip && (disabledTooltip === null || disabledTooltip === void 0 ? void 0 : disabledTooltip.title)) return jsx(Tooltip, Object.assign({
740
+ followCursor: true
741
+ }, disabledTooltip || {}, {
742
+ disabled: true
743
+ }, {
744
+ children: jsx("div", Object.assign({
745
+ className: "upload-image-select-tooltip-wrapper"
746
+ }, {
747
+ children: uploadNode
748
+ }))
749
+ }));
750
+ if (isAvatarMode) {
751
+ return avatarUploadNode;
752
+ }
753
+ return jsx(Fragment, {
754
+ children: uploadNode
755
+ });
451
756
  };
452
757
  //渲染上传控件
453
758
  const renderUploadSelector = () => {
@@ -459,11 +764,11 @@ const ImageUpload = props => {
459
764
  prefixCls: "".concat($rcPrefixCls, "-upload")
460
765
  }, {
461
766
  children: jsx("div", Object.assign({
462
- className: 'upload-image-picture-card'
767
+ className: "".concat(isAvatarMode ? 'is-avatar ' : '', "upload-image-picture-card")
463
768
  }, {
464
769
  children: renderUploadContent()
465
770
  }))
466
- })), errTip && jsx(ErrorTip, {
771
+ })), errTip && !removeErrorTip && jsx(ErrorTip, {
467
772
  message: uploadErrorMsg,
468
773
  className: "".concat($prefixCls, "-upload-error-image")
469
774
  })]
@@ -491,6 +796,18 @@ var INIT_ROTATE = 0;
491
796
  var ROTATE_STEP = 1;
492
797
  var MIN_ROTATE = -180;
493
798
  var MAX_ROTATE = 180;
799
+ var DEFAULT_ZOOM_MARKS = {
800
+ '0.5': '',
801
+ '1': '',
802
+ '1.5': '',
803
+ '2': '',
804
+ '2.5': ''
805
+ };
806
+ var DEFAULT_ROTATE_MARKS = {
807
+ '-90': '',
808
+ '0': '',
809
+ '90': ''
810
+ };
494
811
 
495
812
  var EasyCrop = /*#__PURE__*/forwardRef(function (props, ref) {
496
813
  var cropperRef = props.cropperRef,
@@ -503,7 +820,11 @@ var EasyCrop = /*#__PURE__*/forwardRef(function (props, ref) {
503
820
  minZoom = props.minZoom,
504
821
  maxZoom = props.maxZoom,
505
822
  fixedCropSize = props.fixedCropSize,
506
- cropperProps = props.cropperProps;
823
+ cropperProps = props.cropperProps,
824
+ zoomMarks = props.zoomMarks,
825
+ rotateMarks = props.rotateMarks,
826
+ rotateTipFormatter = props.rotateTipFormatter,
827
+ zoomTipFormatter = props.zoomTipFormatter;
507
828
  var _useState = useState({
508
829
  x: 0,
509
830
  y: 0
@@ -554,6 +875,11 @@ var EasyCrop = /*#__PURE__*/forwardRef(function (props, ref) {
554
875
  var onCropComplete = useCallback(function (croppedArea, croppedAreaPixels) {
555
876
  cropPixelsRef.current = croppedAreaPixels;
556
877
  }, []);
878
+ var genMarks = function genMarks(marks, defaultMarks) {
879
+ if (marks === false || marks === undefined) return;
880
+ if (marks === true) return defaultMarks;
881
+ return marks;
882
+ };
557
883
  //ref 暴露方法
558
884
  useImperativeHandle(ref, function () {
559
885
  return {
@@ -584,62 +910,75 @@ var EasyCrop = /*#__PURE__*/forwardRef(function (props, ref) {
584
910
  onCropComplete: onCropComplete,
585
911
  classes: {
586
912
  containerClassName: "".concat(PREFIX, "-container"),
587
- mediaClassName: "".concat(PREFIX, "-media")
913
+ mediaClassName: "".concat(PREFIX, "-media"),
914
+ cropAreaClassName: "".concat(PREFIX, "-crop")
588
915
  }
589
- })), zoom && jsxs("section", Object.assign({
916
+ })), zoom && jsx("section", Object.assign({
590
917
  className: "".concat(PREFIX, "-control ").concat(PREFIX, "-control-zoom")
591
918
  }, {
592
- children: [jsx("button", Object.assign({
593
- onClick: function onClick() {
594
- return setZoomVal(zoomVal - ZOOM_STEP);
595
- },
596
- disabled: zoomVal - ZOOM_STEP < minZoom
597
- }, {
598
- children: "\uFF0D"
599
- })), jsx(Slider, {
919
+ children: jsx(Slider, {
920
+ marks: genMarks(zoomMarks, DEFAULT_ZOOM_MARKS),
921
+ prefix: jsx(Button.IconButton, Object.assign({
922
+ disabled: zoomVal - ZOOM_STEP < minZoom,
923
+ variant: 'text',
924
+ onClick: function onClick() {
925
+ return setZoomVal(zoomVal - ZOOM_STEP);
926
+ }
927
+ }, {
928
+ children: jsx(MinusCircle, {})
929
+ })),
930
+ suffix: jsx(Button.IconButton, Object.assign({
931
+ variant: 'text',
932
+ onClick: function onClick() {
933
+ return setZoomVal(zoomVal + ZOOM_STEP);
934
+ },
935
+ disabled: zoomVal + ZOOM_STEP > maxZoom
936
+ }, {
937
+ children: jsx(PlusCircle, {})
938
+ })),
600
939
  min: minZoom,
601
940
  max: maxZoom,
602
941
  step: ZOOM_STEP,
603
942
  value: zoomVal,
604
- onChange: setZoomVal
605
- }), jsx("button", Object.assign({
606
- onClick: function onClick() {
607
- return setZoomVal(zoomVal + ZOOM_STEP);
608
- },
609
- disabled: zoomVal + ZOOM_STEP > maxZoom
610
- }, {
611
- children: "\uFF0B"
612
- }))]
613
- })), rotate && jsxs("section", Object.assign({
943
+ onChange: setZoomVal,
944
+ tipFormatter: zoomTipFormatter
945
+ })
946
+ })), rotate && jsx("section", Object.assign({
614
947
  className: "".concat(PREFIX, "-control ").concat(PREFIX, "-control-rotate")
615
948
  }, {
616
- children: [jsx("button", Object.assign({
617
- onClick: function onClick() {
618
- return setRotateVal(rotateVal - ROTATE_STEP);
619
- },
620
- disabled: rotateVal === MIN_ROTATE
621
- }, {
622
- children: "\u21BA"
623
- })), jsx(Slider, {
949
+ children: jsx(Slider, {
950
+ marks: genMarks(rotateMarks, DEFAULT_ROTATE_MARKS),
624
951
  min: MIN_ROTATE,
625
952
  max: MAX_ROTATE,
626
953
  step: ROTATE_STEP,
627
954
  value: rotateVal,
628
- onChange: setRotateVal
629
- }), jsx("button", Object.assign({
630
- onClick: function onClick() {
631
- return setRotateVal(rotateVal + ROTATE_STEP);
632
- },
633
- disabled: rotateVal === MAX_ROTATE
634
- }, {
635
- children: "\u21BB"
636
- }))]
955
+ onChange: setRotateVal,
956
+ tipFormatter: rotateTipFormatter,
957
+ prefix: jsx(Button.IconButton, Object.assign({
958
+ variant: 'text',
959
+ onClick: function onClick() {
960
+ return setRotateVal(rotateVal - ROTATE_STEP);
961
+ },
962
+ disabled: rotateVal === MIN_ROTATE
963
+ }, {
964
+ children: jsx(TurnLeft, {})
965
+ })),
966
+ suffix: jsx(Button.IconButton, Object.assign({
967
+ variant: 'text',
968
+ onClick: function onClick() {
969
+ return setRotateVal(rotateVal + ROTATE_STEP);
970
+ },
971
+ disabled: rotateVal === MAX_ROTATE
972
+ }, {
973
+ children: jsx(TurnRight, {})
974
+ }))
975
+ })
637
976
  }))]
638
977
  });
639
978
  });
640
979
  var EasyCrop$1 = /*#__PURE__*/memo(EasyCrop);
641
980
 
642
- var css_248z$1 = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2022/4/20 下午4:44\n* @description\n*/\n/**\n* @author linhd\n* @date 2023/4/11 14:16\n* @description 最新色卡\n*/\n.paraui-v4-img-crop-modal .paraui-v4-img-crop-container {\n position: relative;\n width: 100%;\n height: 40vh;\n}\n.paraui-v4-img-crop-modal .paraui-v4-img-crop-control {\n display: flex;\n align-items: center;\n width: 60%;\n margin-left: auto;\n margin-right: auto;\n}\n.paraui-v4-img-crop-modal .paraui-v4-img-crop-control:first-of-type {\n margin-top: 16px;\n}\n.paraui-v4-img-crop-modal .paraui-v4-img-crop-control:last-of-type {\n margin-bottom: -8px;\n}\n.paraui-v4-img-crop-modal .paraui-v4-img-crop-control button {\n display: flex;\n justify-content: center;\n align-items: center;\n width: 34px;\n height: 34px;\n padding: 0;\n font-style: normal;\n background: transparent;\n border: 0;\n outline: 0;\n cursor: pointer;\n}\n.paraui-v4-img-crop-modal .paraui-v4-img-crop-control button[disabled] {\n cursor: default;\n}\n.paraui-v4-img-crop-modal .paraui-v4-img-crop-control button + div:only-of-type {\n flex: 1;\n margin: 0 8px;\n}\n.paraui-v4-img-crop-modal .paraui-v4-img-crop-control-zoom button {\n font-size: 18px;\n}\n.paraui-v4-img-crop-modal .paraui-v4-img-crop-control-rotate button {\n font-size: 16px;\n}\n.paraui-v4-img-crop-modal .paraui-v4-img-crop-control-rotate button:first-of-type {\n transform: rotate(-20deg);\n}\n.paraui-v4-img-crop-modal .paraui-v4-img-crop-control-rotate button:last-of-type {\n transform: rotate(20deg);\n}";
981
+ var css_248z$1 = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2022/4/20 下午4:44\n* @description\n*/\n/**\n* @author linhd\n* @date 2023/4/11 14:16\n* @description 最新色卡\n*/\n.paraui-v4-img-crop-modal .paraui-v4-img-crop-container {\n position: relative;\n width: 100%;\n height: 40vh;\n border-radius: 4px;\n}\n.paraui-v4-img-crop-modal .paraui-v4-img-crop-container .paraui-v4-img-crop-crop {\n border-radius: 4px;\n border: none;\n}\n.paraui-v4-img-crop-modal .paraui-v4-img-crop-control {\n display: flex;\n align-items: center;\n width: 60%;\n margin-left: auto;\n margin-right: auto;\n}\n.paraui-v4-img-crop-modal .paraui-v4-img-crop-control:first-of-type {\n margin-top: 10px;\n margin-bottom: 10px;\n}\n.paraui-v4-img-crop-modal .paraui-v4-img-crop-control button {\n display: flex;\n justify-content: center;\n align-items: center;\n padding: 0;\n font-style: normal;\n background: transparent;\n border: 0;\n outline: 0;\n cursor: pointer;\n}\n.paraui-v4-img-crop-modal .paraui-v4-img-crop-control button[disabled] {\n cursor: default;\n}\n.paraui-v4-img-crop-modal .paraui-v4-img-crop-control button + div:only-of-type {\n flex: 1;\n margin: 0 8px;\n}\n.paraui-v4-img-crop-modal .paraui-v4-img-crop-control-zoom, .paraui-v4-img-crop-modal .paraui-v4-img-crop-control-rotate {\n width: 100%;\n background-color: rgb(247, 248, 250);\n border-radius: 4px;\n height: 32px;\n padding: 0 10px;\n}\n.paraui-v4-img-crop-modal .paraui-v4-img-crop-control-zoom button {\n font-size: 18px;\n}\n.paraui-v4-img-crop-modal .paraui-v4-img-crop-control-rotate button {\n font-size: 16px;\n}";
643
982
  styleInject(css_248z$1);
644
983
 
645
984
  //图片裁剪组件
@@ -667,7 +1006,11 @@ const ImgCrop = /*#__PURE__*/forwardRef((props, ref) => {
667
1006
  fixedCropSize = {
668
1007
  width: 120,
669
1008
  height: 120
670
- }
1009
+ },
1010
+ zoomTipFormatter = val => "".concat(Number(val) * 10 * 10),
1011
+ zoomMarks = true,
1012
+ rotateMarks = true,
1013
+ rotateTipFormatter = val => "".concat(val)
671
1014
  } = props;
672
1015
  const intl = useFormatMessage('Upload', localeJson);
673
1016
  const [image, setImage] = useState('');
@@ -899,7 +1242,11 @@ const ImgCrop = /*#__PURE__*/forwardRef((props, ref) => {
899
1242
  minZoom: minZoom,
900
1243
  maxZoom: maxZoom,
901
1244
  fixedCropSize: fixedCropSize,
902
- cropperProps: cropperProps
1245
+ cropperProps: cropperProps,
1246
+ zoomTipFormatter: zoomTipFormatter,
1247
+ zoomMarks: zoomMarks,
1248
+ rotateMarks: rotateMarks,
1249
+ rotateTipFormatter: rotateTipFormatter
903
1250
  })
904
1251
  }))]
905
1252
  });
@@ -908,7 +1255,7 @@ const ImgCrop = /*#__PURE__*/forwardRef((props, ref) => {
908
1255
  });
909
1256
  });
910
1257
 
911
- var css_248z = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2021/11/11 下午1:40\n* @description\n*/\n/**\n* @author linhd\n* @date 2023/4/11 14:16\n* @description 最新色卡\n*/\n.paraui-v4-upload .component-upload {\n position: relative;\n display: inline-block;\n}\n.paraui-v4-upload-loading {\n pointer-events: none;\n}\n.paraui-v4-upload-drag {\n position: relative;\n}\n.paraui-v4-upload-drag .component-upload {\n display: block;\n}\n.paraui-v4-upload-drag-loading {\n pointer-events: none;\n}\n.paraui-v4-upload-drag-hover .upload-drag-container {\n border-color: rgb(87, 131, 235);\n}\n.paraui-v4-upload-drag .upload-drag-container {\n display: inline-flex;\n width: 100%;\n max-width: 590px;\n height: 200px;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n font-size: 14px;\n line-height: 1;\n border: 2px dashed rgb(212, 218, 227);\n background-color: rgb(247, 248, 250);\n border-radius: 4px;\n cursor: pointer;\n transition: 0.3s;\n}\n.paraui-v4-upload-drag .upload-drag-container:hover {\n border-color: rgb(87, 131, 235);\n}\n.paraui-v4-upload-drag .upload-drag-container .upload-drag-icon {\n line-height: 0;\n}\n.paraui-v4-upload-drag .upload-drag-container .upload-drag-icon svg {\n font-size: 48px;\n color: rgb(46, 101, 230);\n}\n.paraui-v4-upload-drag .upload-drag-container .upload-drag-icon .upload-drag-loading {\n animation: uploadLoadingCircle 1s infinite linear;\n}\n.paraui-v4-upload-drag .upload-drag-container .upload-drag-text {\n margin: 20px 0 12px 0;\n color: rgb(29, 33, 38);\n}\n.paraui-v4-upload-drag .upload-drag-container .upload-drag-text-loading {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-upload-drag .upload-drag-container .upload-drag-text-filename {\n margin-right: 5px;\n color: rgb(29, 33, 38);\n}\n.paraui-v4-upload-drag .upload-drag-container .upload-drag-hint {\n color: rgb(92, 101, 115);\n padding: 0 20px;\n text-align: center;\n}\n@keyframes uploadLoadingCircle {\n 100% {\n transform: rotate(360deg);\n }\n}";
1258
+ var css_248z = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2021/11/11 下午1:40\n* @description\n*/\n/**\n* @author linhd\n* @date 2023/4/11 14:16\n* @description 最新色卡\n*/\n.paraui-v4-upload .component-upload {\n position: relative;\n display: inline-block;\n}\n.paraui-v4-upload-loading {\n pointer-events: none;\n}\n.paraui-v4-upload-drag {\n position: relative;\n}\n.paraui-v4-upload-drag-loading {\n pointer-events: none;\n}\n.paraui-v4-upload-drag-hover .upload-drag-container {\n border-color: rgb(87, 131, 235);\n}\n.paraui-v4-upload-drag .upload-drag-container {\n display: inline-flex;\n width: 100%;\n height: 200px;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n font-size: 14px;\n line-height: 1;\n border: 1px dashed rgb(212, 218, 227);\n background-color: rgb(247, 248, 250);\n border-radius: 4px;\n cursor: pointer;\n transition: 0.3s;\n}\n.paraui-v4-upload-drag .upload-drag-container:hover {\n border-color: rgb(87, 131, 235);\n}\n.paraui-v4-upload-drag .upload-drag-container:hover .upload-drag-text {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-upload-drag .upload-drag-container .upload-drag-icon {\n line-height: 0;\n}\n.paraui-v4-upload-drag .upload-drag-container .upload-drag-icon svg {\n font-size: 48px;\n color: rgb(46, 101, 230);\n}\n.paraui-v4-upload-drag .upload-drag-container .upload-drag-icon .upload-drag-loading {\n animation: uploadLoadingCircle 1s infinite linear;\n}\n.paraui-v4-upload-drag .upload-drag-container .upload-drag-text {\n margin: 16px 0 10px 0;\n color: rgb(29, 33, 38);\n padding: 0 20px;\n}\n.paraui-v4-upload-drag .upload-drag-container .upload-drag-text-loading {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-upload-drag .upload-drag-container .upload-drag-text-filename {\n margin-right: 5px;\n color: rgb(29, 33, 38);\n word-break: break-all;\n}\n.paraui-v4-upload-drag .upload-drag-container .upload-drag-hint {\n color: rgb(92, 101, 115);\n padding: 0 20px;\n text-align: center;\n white-space: pre-wrap;\n line-height: 21px;\n}\n.paraui-v4-upload-drag .component-upload {\n display: block;\n max-width: 590px;\n}\n.paraui-v4-upload-drag .component-upload-disabled {\n color: rgb(92, 101, 115);\n cursor: not-allowed;\n}\n.paraui-v4-upload-drag .component-upload-disabled > div {\n width: 100%;\n}\n.paraui-v4-upload-drag .component-upload-disabled .upload-drag-container {\n cursor: not-allowed;\n}\n.paraui-v4-upload-drag .component-upload-disabled .upload-drag-container:hover {\n border-color: rgb(212, 218, 227);\n}\n.paraui-v4-upload-drag .component-upload-disabled .upload-drag-container .upload-drag-icon svg {\n color: rgb(161, 168, 179);\n}\n.paraui-v4-upload-drag .component-upload-disabled .upload-drag-container .upload-drag-text {\n color: rgb(92, 101, 115);\n}\n@keyframes uploadLoadingCircle {\n 100% {\n transform: rotate(360deg);\n }\n}";
912
1259
  styleInject(css_248z);
913
1260
 
914
1261
  //upload
@@ -931,23 +1278,29 @@ const InternalUpload = props => {
931
1278
  maxCount,
932
1279
  children = null,
933
1280
  itemRender,
934
- showUploadError = true,
1281
+ showUploadError = false,
935
1282
  size = 'large',
936
1283
  stash = false,
937
1284
  uploading = true,
938
1285
  showLoading: showLoadingProp = true,
939
1286
  loading = false,
940
1287
  dragArea,
941
- disabledTooltip
1288
+ disabledTooltip,
1289
+ operateBtnProps,
1290
+ actionRender,
1291
+ onPreview,
1292
+ removeErrorTip
942
1293
  } = props,
943
- restProps = __rest(props, ["type", "className", "style", "onStart", "onSuccess", "onError", "onProgress", "onRemove", "beforeUpload", "onChange", "onDrop", "defaultFileList", "fileList", "showUploadList", "maxCount", "children", "itemRender", "showUploadError", "size", "stash", "uploading", "showLoading", "loading", "dragArea", "disabledTooltip"]);
1294
+ restProps = __rest(props, ["type", "className", "style", "onStart", "onSuccess", "onError", "onProgress", "onRemove", "beforeUpload", "onChange", "onDrop", "defaultFileList", "fileList", "showUploadList", "maxCount", "children", "itemRender", "showUploadError", "size", "stash", "uploading", "showLoading", "loading", "dragArea", "disabledTooltip", "operateBtnProps", "actionRender", "onPreview", "removeErrorTip"]);
944
1295
  const intl = useFormatMessage('Upload', localeJson);
945
1296
  const [uploadFileList, setUploadFileList] = useState(defaultFileList); //文件列表
946
1297
  const [showLoading, setShowLoading] = useState(false); //upload loading
947
1298
  const [errTip, setErrTip] = useState(false); //upload error tip
948
1299
  const {
949
1300
  showRemoveIcon,
950
- removeIcon
1301
+ removeIcon,
1302
+ showPreviewIcon,
1303
+ previewIcon
951
1304
  } = typeof showUploadList === 'boolean' ? {} : showUploadList; //显示上传列表
952
1305
  const {
953
1306
  uploadErrorMsg = intl({
@@ -987,6 +1340,12 @@ const InternalUpload = props => {
987
1340
  setShowLoading(false);
988
1341
  curFileRef.current = null;
989
1342
  showErrTip(!!showUploadError);
1343
+ if (!showUploadError) {
1344
+ file.status = 'error';
1345
+ file.response = (error === null || error === void 0 ? void 0 : error.message) || uploadErrorMsg;
1346
+ const nextFileList = updateFileList(file);
1347
+ onInternalChange(nextFileList);
1348
+ }
990
1349
  onError === null || onError === void 0 ? void 0 : onError(error, response, file);
991
1350
  },
992
1351
  onProgress(e, file) {
@@ -1099,7 +1458,12 @@ const InternalUpload = props => {
1099
1458
  showRemoveIcon: showRemoveIcon,
1100
1459
  removeIcon: removeIcon,
1101
1460
  onRemove: handleRemove,
1102
- itemRender: itemRender
1461
+ itemRender: itemRender,
1462
+ operateBtnProps: operateBtnProps,
1463
+ actionRender: actionRender,
1464
+ onPreview: onPreview,
1465
+ showPreviewIcon: showPreviewIcon,
1466
+ previewIcon: previewIcon
1103
1467
  });
1104
1468
  //渲染上传按钮
1105
1469
  const renderButton = () => {
@@ -1153,9 +1517,7 @@ const InternalUpload = props => {
1153
1517
  }), "..."]
1154
1518
  }));
1155
1519
  }
1156
- return jsx("div", Object.assign({
1157
- className: 'upload-drag-container'
1158
- }, {
1520
+ const dragNode = jsx(Fragment, {
1159
1521
  children: children ? children : jsxs(Fragment, {
1160
1522
  children: [jsx("p", Object.assign({
1161
1523
  className: "upload-drag-icon"
@@ -1171,6 +1533,22 @@ const InternalUpload = props => {
1171
1533
  children: areaDesc
1172
1534
  }))]
1173
1535
  })
1536
+ });
1537
+ if (restProps.disabled && disabledTooltip && (disabledTooltip === null || disabledTooltip === void 0 ? void 0 : disabledTooltip.title)) return jsx(Tooltip, Object.assign({
1538
+ followCursor: true
1539
+ }, disabledTooltip || {}, {
1540
+ disabled: true
1541
+ }, {
1542
+ children: jsx("div", Object.assign({
1543
+ className: 'upload-drag-container'
1544
+ }, {
1545
+ children: dragNode
1546
+ }))
1547
+ }));
1548
+ return jsx("div", Object.assign({
1549
+ className: 'upload-drag-container'
1550
+ }, {
1551
+ children: dragNode
1174
1552
  }));
1175
1553
  };
1176
1554
  //拖拽上传
@@ -1189,7 +1567,7 @@ const InternalUpload = props => {
1189
1567
  prefixCls: "".concat($rcPrefixCls, "-upload")
1190
1568
  }, {
1191
1569
  children: renderDragArea()
1192
- })), renderUploadList(), errTip && jsx(ErrorTip, {
1570
+ })), renderUploadList(), errTip && !removeErrorTip && jsx(ErrorTip, {
1193
1571
  message: uploadErrorMsg,
1194
1572
  className: "".concat($prefixCls, "-upload-error-drag")
1195
1573
  })]