@chaoswise/ui 3.1.0 → 3.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Antd5/app/style/index.js +2 -1
- package/lib/Antd5/breadcrumb/style/index.js +1 -1
- package/lib/Antd5/checkbox/Checkbox.js +33 -5
- package/lib/Antd5/checkbox/Group.js +7 -2
- package/lib/Antd5/checkbox/assets/duigou1.js +29 -0
- package/lib/Antd5/checkbox/assets/duigou2.js +29 -0
- package/lib/Antd5/checkbox/style/index.js +106 -3
- package/lib/Antd5/message/PurePanel.js +40 -22
- package/lib/Antd5/message/assets/Close.js +22 -0
- package/lib/Antd5/message/style/index.js +47 -8
- package/lib/Antd5/message/useMessage.js +15 -3
- package/lib/Antd5/radio/radio.js +4 -10
- package/lib/Antd5/radio/style/index.js +65 -80
- package/lib/Antd5/upload/Upload.js +83 -55
- package/lib/Antd5/upload/UploadList/ListItem.js +9 -15
- package/lib/Antd5/upload/UploadList/index.js +47 -33
- package/lib/Antd5/upload/style/dragger.js +26 -5
- package/lib/Antd5/upload/style/list.js +7 -2
- package/lib/AppHolder/index.js +2 -1
- package/lib/CWColorPicker/index.js +8 -4
- package/lib/CWTree/index.js +13 -6
- package/lib/ConfigProvider/ConfigProvider.js +2 -0
- package/lib/ConfigProvider/theme/default.js +9 -2
- package/lib/Header/UserSetting/TenantTree.js +0 -1
- package/lib/Pagination/index.style.js +1 -1
- package/lib/SiderMenu/index.style.js +4 -2
- package/lib/Slider/index.style.js +2 -1
- package/package.json +1 -1
|
@@ -354,31 +354,31 @@ var getRadioCardStyle = function getRadioCardStyle(token) {
|
|
|
354
354
|
display: "flex",
|
|
355
355
|
flexWrap: "wrap"
|
|
356
356
|
}), "".concat(componentCls, "-radio_-wrapper"), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
|
|
357
|
-
cursor:
|
|
358
|
-
boxSizing:
|
|
357
|
+
cursor: "pointer",
|
|
358
|
+
boxSizing: "border-box",
|
|
359
359
|
width: "298px",
|
|
360
|
-
height:
|
|
360
|
+
height: "100%",
|
|
361
361
|
background: colorBgContainer,
|
|
362
|
-
display:
|
|
362
|
+
display: "flex",
|
|
363
363
|
alignItems: "flex-start",
|
|
364
364
|
padding: "15px 23px",
|
|
365
365
|
border: "".concat(unit(lineWidth), " ").concat(lineType, " ").concat(colorBorder),
|
|
366
|
-
whiteSpace:
|
|
366
|
+
whiteSpace: "normal",
|
|
367
367
|
marginRight: "16px",
|
|
368
368
|
marginBottom: "12px",
|
|
369
369
|
borderRadius: borderRadius
|
|
370
370
|
}, "&:hover:not(".concat(componentCls, "-radio_-wrapper-disabled):not(").concat(componentCls, "-radio_-wrapper-checked)"), {
|
|
371
371
|
border: "".concat(unit(lineWidth), " ").concat(lineType, " ").concat(colorPrimaryHover)
|
|
372
372
|
}), "> ".concat(componentCls), _defineProperty({
|
|
373
|
-
display:
|
|
373
|
+
display: "block",
|
|
374
374
|
width: 0,
|
|
375
375
|
height: 0,
|
|
376
|
-
|
|
376
|
+
"&-checked::after": {
|
|
377
377
|
width: 0,
|
|
378
378
|
height: 0,
|
|
379
379
|
border: 0
|
|
380
380
|
},
|
|
381
|
-
|
|
381
|
+
"&+*": {
|
|
382
382
|
padding: 0
|
|
383
383
|
}
|
|
384
384
|
}, "".concat(componentCls, "-inner, input[type='checkbox'], input[type='radio']"), {
|
|
@@ -386,93 +386,78 @@ var getRadioCardStyle = function getRadioCardStyle(token) {
|
|
|
386
386
|
height: 0,
|
|
387
387
|
opacity: 0,
|
|
388
388
|
border: 0,
|
|
389
|
-
pointerEvents:
|
|
390
|
-
})),
|
|
389
|
+
pointerEvents: "none"
|
|
390
|
+
})), "".concat(componentCls, "-icon-wrapper"), _defineProperty(_defineProperty({
|
|
391
391
|
width: "48px",
|
|
392
392
|
height: "48px",
|
|
393
393
|
marginRight: "16px",
|
|
394
394
|
padding: 0,
|
|
395
|
-
display:
|
|
396
|
-
justifyContent:
|
|
397
|
-
alignItems:
|
|
395
|
+
display: "flex",
|
|
396
|
+
justifyContent: "center",
|
|
397
|
+
alignItems: "center",
|
|
398
398
|
background: colorPrimaryBg,
|
|
399
|
-
borderRadius:
|
|
400
|
-
|
|
401
|
-
maxWidth:
|
|
402
|
-
maxHeight:
|
|
403
|
-
display:
|
|
404
|
-
justifyContent:
|
|
405
|
-
alignItems:
|
|
399
|
+
borderRadius: "50%",
|
|
400
|
+
">:nth-child(1)": {
|
|
401
|
+
maxWidth: "100%",
|
|
402
|
+
maxHeight: "100%",
|
|
403
|
+
display: "flex",
|
|
404
|
+
justifyContent: "center",
|
|
405
|
+
alignItems: "center"
|
|
406
406
|
},
|
|
407
407
|
svg: {
|
|
408
408
|
color: colorPrimary
|
|
409
|
-
},
|
|
410
|
-
'&.cw-radio-icon-unchecked-disabled': {
|
|
411
|
-
svg: {
|
|
412
|
-
color: "rgba(0, 0, 0, 0.25)"
|
|
413
|
-
}
|
|
414
|
-
},
|
|
415
|
-
'&.cw-radio-icon-checked-disabled': {
|
|
416
|
-
svg: {
|
|
417
|
-
color: colorPrimaryBorder
|
|
418
|
-
}
|
|
419
409
|
}
|
|
420
|
-
}
|
|
410
|
+
}, "&".concat(componentCls, "-icon-unchecked-disabled"), {
|
|
411
|
+
svg: {
|
|
412
|
+
color: "rgba(0, 0, 0, 0.25)"
|
|
413
|
+
}
|
|
414
|
+
}), "&".concat(componentCls, "-icon-checked-disabled"), {
|
|
415
|
+
svg: {
|
|
416
|
+
color: colorPrimaryBorder
|
|
417
|
+
}
|
|
418
|
+
})), "".concat(componentCls, "-icon-unchecked-disabled"), {
|
|
421
419
|
background: "rgba(0, 0, 0, 0.04)"
|
|
422
|
-
}),
|
|
420
|
+
}), "".concat(componentCls, "-content"), _defineProperty(_defineProperty(_defineProperty({
|
|
423
421
|
flex: 1,
|
|
424
|
-
display:
|
|
425
|
-
flexDirection:
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
},
|
|
446
|
-
'.cw-radio-content-description_': {
|
|
447
|
-
marginTop: 0
|
|
448
|
-
}
|
|
449
|
-
})), "".concat(componentCls, "-radio_-wrapper").concat(componentCls, "-radio_-wrapper-custom"), {
|
|
422
|
+
display: "flex",
|
|
423
|
+
flexDirection: "column"
|
|
424
|
+
}, "".concat(componentCls, "-content-title"), {
|
|
425
|
+
fontSize: "16px",
|
|
426
|
+
height: "24px",
|
|
427
|
+
lineHeight: "24px",
|
|
428
|
+
marginBottom: 0,
|
|
429
|
+
fontWeight: 500,
|
|
430
|
+
color: colorTextSecondary,
|
|
431
|
+
overflow: "hidden"
|
|
432
|
+
}), "".concat(componentCls, "-content-description"), {
|
|
433
|
+
fontSize: "12px",
|
|
434
|
+
color: colorTextDescription,
|
|
435
|
+
marginTop: "8px",
|
|
436
|
+
flex: 1,
|
|
437
|
+
whiteSpace: "normal",
|
|
438
|
+
lineHeight: "20px",
|
|
439
|
+
overflow: "hidden"
|
|
440
|
+
}), "".concat(componentCls, "-content-description_"), {
|
|
441
|
+
marginTop: 0
|
|
442
|
+
}))), "".concat(componentCls, "-radio_-wrapper").concat(componentCls, "-radio_-wrapper-custom"), {
|
|
450
443
|
padding: 0
|
|
451
444
|
}), "".concat(componentCls, "-radio_-wrapper-checked:not(").concat(componentCls, "-radio_-wrapper-disabled)"), {
|
|
452
445
|
border: "".concat(unit(lineWidth), " ").concat(lineType, " ").concat(colorPrimary)
|
|
453
|
-
}), "".concat(componentCls, "-radio_-wrapper-disabled:not(").concat(componentCls, "-radio_-wrapper-checked)"), {
|
|
446
|
+
}), "".concat(componentCls, "-radio_-wrapper-disabled:not(").concat(componentCls, "-radio_-wrapper-checked)"), _defineProperty({
|
|
454
447
|
border: "".concat(unit(lineWidth), " ").concat(lineType, " rgba(0, 0, 0, 0.09)"),
|
|
455
|
-
cursor:
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
'.cw-radio-content-title': {
|
|
469
|
-
color: colorTextDisabled
|
|
470
|
-
},
|
|
471
|
-
'.cw-radio-content-description': {
|
|
472
|
-
color: colorTextDisabled
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
});
|
|
448
|
+
cursor: "not-allowed"
|
|
449
|
+
}, "".concat(componentCls, "-content"), _defineProperty(_defineProperty({}, "".concat(componentCls, "-content-title"), {
|
|
450
|
+
color: colorTextDisabled
|
|
451
|
+
}), "".concat(componentCls, "-content-description"), {
|
|
452
|
+
color: colorTextDisabled
|
|
453
|
+
}))), "".concat(componentCls, "-radio_-wrapper-checked").concat(componentCls, "-radio_-wrapper-disabled"), _defineProperty({
|
|
454
|
+
border: "".concat(unit(lineWidth), " ").concat(lineType, " ").concat(colorPrimaryBorder),
|
|
455
|
+
cursor: "not-allowed"
|
|
456
|
+
}, "".concat(componentCls, "-content"), _defineProperty(_defineProperty({}, "".concat(componentCls, "-content-title"), {
|
|
457
|
+
color: colorTextDisabled
|
|
458
|
+
}), "".concat(componentCls, "-content-description"), {
|
|
459
|
+
color: colorTextDisabled
|
|
460
|
+
})));
|
|
476
461
|
};
|
|
477
462
|
// ============================== Export ==============================
|
|
478
463
|
export var prepareComponentToken = function prepareComponentToken(token) {
|
|
@@ -18,20 +18,42 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
18
18
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
19
19
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
20
20
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
|
-
import * as React from
|
|
22
|
-
import { flushSync } from
|
|
23
|
-
import classNames from
|
|
24
|
-
import RcUpload from
|
|
25
|
-
import useMergedState from
|
|
26
|
-
import { devUseWarning } from
|
|
27
|
-
import { ConfigContext } from
|
|
28
|
-
import DisabledContext from
|
|
29
|
-
import { useLocale } from
|
|
30
|
-
import defaultLocale from
|
|
31
|
-
import useStyle from
|
|
32
|
-
import UploadList from
|
|
33
|
-
import { file2Obj, getFileItem, removeFileItem, updateFileList } from
|
|
21
|
+
import * as React from "react";
|
|
22
|
+
import { flushSync } from "react-dom";
|
|
23
|
+
import classNames from "classnames";
|
|
24
|
+
import RcUpload from "rc-upload";
|
|
25
|
+
import useMergedState from "rc-util/lib/hooks/useMergedState";
|
|
26
|
+
import { devUseWarning } from "../_util/warning";
|
|
27
|
+
import { ConfigContext } from "../config-provider";
|
|
28
|
+
import DisabledContext from "../config-provider/DisabledContext";
|
|
29
|
+
import { useLocale } from "../locale";
|
|
30
|
+
import defaultLocale from "../locale/en_US";
|
|
31
|
+
import useStyle from "./style";
|
|
32
|
+
import UploadList from "./UploadList";
|
|
33
|
+
import { file2Obj, getFileItem, removeFileItem, updateFileList } from "./utils";
|
|
34
|
+
import { CloudUploadOutlined } from "@ant-design/icons";
|
|
35
|
+
// @ts-ignore
|
|
36
|
+
import { useIntl } from "../../locales";
|
|
34
37
|
export var LIST_IGNORE = "__LIST_IGNORE_".concat(Date.now(), "__");
|
|
38
|
+
var DefaultChildren = function DefaultChildren(props) {
|
|
39
|
+
var title = props.title,
|
|
40
|
+
description = props.description,
|
|
41
|
+
prefixCls = props.prefixCls;
|
|
42
|
+
var intl = useIntl();
|
|
43
|
+
return _jsxs("div", {
|
|
44
|
+
className: "".concat(prefixCls, "-drag-wrapper"),
|
|
45
|
+
children: [_jsx("p", {
|
|
46
|
+
className: "".concat(prefixCls, "-drag-icon-wrapper"),
|
|
47
|
+
children: _jsx(CloudUploadOutlined, {})
|
|
48
|
+
}), _jsx("div", {
|
|
49
|
+
className: "".concat(prefixCls, "-drag-text"),
|
|
50
|
+
children: title !== null && title !== void 0 ? title : intl.get("dda16720-d447-4d73-9e71-b5af7b5bbcfd").d("单击或拖动文件到此区域")
|
|
51
|
+
}), description && _jsx("div", {
|
|
52
|
+
className: "".concat(prefixCls, "-drag-desc"),
|
|
53
|
+
children: description
|
|
54
|
+
})]
|
|
55
|
+
});
|
|
56
|
+
};
|
|
35
57
|
var InternalUpload = function InternalUpload(props, ref) {
|
|
36
58
|
var fileList = props.fileList,
|
|
37
59
|
defaultFileList = props.defaultFileList,
|
|
@@ -39,7 +61,7 @@ var InternalUpload = function InternalUpload(props, ref) {
|
|
|
39
61
|
_props$showUploadList = props.showUploadList,
|
|
40
62
|
showUploadList = _props$showUploadList === void 0 ? true : _props$showUploadList,
|
|
41
63
|
_props$listType = props.listType,
|
|
42
|
-
listType = _props$listType === void 0 ?
|
|
64
|
+
listType = _props$listType === void 0 ? "text" : _props$listType,
|
|
43
65
|
onPreview = props.onPreview,
|
|
44
66
|
onDownload = props.onDownload,
|
|
45
67
|
onChange = props.onChange,
|
|
@@ -53,7 +75,7 @@ var InternalUpload = function InternalUpload(props, ref) {
|
|
|
53
75
|
customizePrefixCls = props.prefixCls,
|
|
54
76
|
className = props.className,
|
|
55
77
|
_props$type = props.type,
|
|
56
|
-
type = _props$type === void 0 ?
|
|
78
|
+
type = _props$type === void 0 ? "select" : _props$type,
|
|
57
79
|
children = props.children,
|
|
58
80
|
style = props.style,
|
|
59
81
|
itemRender = props.itemRender,
|
|
@@ -65,12 +87,15 @@ var InternalUpload = function InternalUpload(props, ref) {
|
|
|
65
87
|
_props$hasControlInsi = props.hasControlInside,
|
|
66
88
|
hasControlInside = _props$hasControlInsi === void 0 ? true : _props$hasControlInsi,
|
|
67
89
|
_props$action = props.action,
|
|
68
|
-
action = _props$action === void 0 ?
|
|
90
|
+
action = _props$action === void 0 ? "" : _props$action,
|
|
69
91
|
_props$accept = props.accept,
|
|
70
|
-
accept = _props$accept === void 0 ?
|
|
92
|
+
accept = _props$accept === void 0 ? "" : _props$accept,
|
|
71
93
|
_props$supportServerR = props.supportServerRender,
|
|
72
94
|
supportServerRender = _props$supportServerR === void 0 ? true : _props$supportServerR,
|
|
73
|
-
rootClassName = props.rootClassName
|
|
95
|
+
rootClassName = props.rootClassName,
|
|
96
|
+
title = props.title,
|
|
97
|
+
description = props.description,
|
|
98
|
+
dropSingleFileUpload = props.dropSingleFileUpload;
|
|
74
99
|
// ===================== Disabled =====================
|
|
75
100
|
var disabled = React.useContext(DisabledContext);
|
|
76
101
|
var mergedDisabled = customDisabled !== null && customDisabled !== void 0 ? customDisabled : disabled;
|
|
@@ -83,16 +108,16 @@ var InternalUpload = function InternalUpload(props, ref) {
|
|
|
83
108
|
_useMergedState2 = _slicedToArray(_useMergedState, 2),
|
|
84
109
|
mergedFileList = _useMergedState2[0],
|
|
85
110
|
setMergedFileList = _useMergedState2[1];
|
|
86
|
-
var _React$useState = React.useState(
|
|
111
|
+
var _React$useState = React.useState("drop"),
|
|
87
112
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
88
113
|
dragState = _React$useState2[0],
|
|
89
114
|
setDragState = _React$useState2[1];
|
|
90
115
|
var upload = React.useRef(null);
|
|
91
116
|
var wrapRef = React.useRef(null);
|
|
92
|
-
if (process.env.NODE_ENV !==
|
|
93
|
-
var warning = devUseWarning(
|
|
94
|
-
warning(
|
|
95
|
-
warning.deprecated(!(
|
|
117
|
+
if (process.env.NODE_ENV !== "production") {
|
|
118
|
+
var warning = devUseWarning("Upload");
|
|
119
|
+
warning("fileList" in props || !("value" in props), "usage", "`value` is not a valid prop, do you mean `fileList`?");
|
|
120
|
+
warning.deprecated(!("transformFile" in props), "transformFile", "beforeUpload");
|
|
96
121
|
}
|
|
97
122
|
// Control mode will auto fill file uid if not provided
|
|
98
123
|
React.useMemo(function () {
|
|
@@ -107,7 +132,7 @@ var InternalUpload = function InternalUpload(props, ref) {
|
|
|
107
132
|
var cloneList = _toConsumableArray(changedFileList);
|
|
108
133
|
var exceedMaxCount = false;
|
|
109
134
|
// Cut to match count
|
|
110
|
-
if (maxCount === 1) {
|
|
135
|
+
if (maxCount === 1 || dropSingleFileUpload) {
|
|
111
136
|
cloneList = cloneList.slice(-1);
|
|
112
137
|
} else if (maxCount) {
|
|
113
138
|
exceedMaxCount = cloneList.length > maxCount;
|
|
@@ -125,7 +150,7 @@ var InternalUpload = function InternalUpload(props, ref) {
|
|
|
125
150
|
if (event) {
|
|
126
151
|
changeInfo.event = event;
|
|
127
152
|
}
|
|
128
|
-
if (!exceedMaxCount || file.status ===
|
|
153
|
+
if (!exceedMaxCount || file.status === "removed" ||
|
|
129
154
|
// We should ignore event if current file is exceed `maxCount`
|
|
130
155
|
cloneList.some(function (f) {
|
|
131
156
|
return f.uid === file.uid;
|
|
@@ -169,7 +194,7 @@ var InternalUpload = function InternalUpload(props, ref) {
|
|
|
169
194
|
});
|
|
170
195
|
return _context.abrupt("return", false);
|
|
171
196
|
case 12:
|
|
172
|
-
if (_typeof(result) ===
|
|
197
|
+
if (_typeof(result) === "object" && result) {
|
|
173
198
|
parsedFile = result;
|
|
174
199
|
}
|
|
175
200
|
case 13:
|
|
@@ -222,7 +247,7 @@ var InternalUpload = function InternalUpload(props, ref) {
|
|
|
222
247
|
clone = new File([originFileObj], originFileObj.name, {
|
|
223
248
|
type: originFileObj.type
|
|
224
249
|
});
|
|
225
|
-
} catch (
|
|
250
|
+
} catch (e) {
|
|
226
251
|
clone = new Blob([originFileObj], {
|
|
227
252
|
type: originFileObj.type
|
|
228
253
|
});
|
|
@@ -234,18 +259,17 @@ var InternalUpload = function InternalUpload(props, ref) {
|
|
|
234
259
|
triggerFileObj = clone;
|
|
235
260
|
} else {
|
|
236
261
|
// Inject `uploading` status
|
|
237
|
-
fileObj.status =
|
|
262
|
+
fileObj.status = "uploading";
|
|
238
263
|
}
|
|
239
264
|
onInternalChange(triggerFileObj, newFileList);
|
|
240
265
|
});
|
|
241
266
|
};
|
|
242
267
|
var onSuccess = function onSuccess(response, file, xhr) {
|
|
243
268
|
try {
|
|
244
|
-
if (typeof response ===
|
|
245
|
-
// biome-ignore lint/style/noParameterAssign: we need to modify response
|
|
269
|
+
if (typeof response === "string") {
|
|
246
270
|
response = JSON.parse(response);
|
|
247
271
|
}
|
|
248
|
-
} catch (
|
|
272
|
+
} catch (e) {
|
|
249
273
|
/* do nothing */
|
|
250
274
|
}
|
|
251
275
|
// removed
|
|
@@ -253,7 +277,7 @@ var InternalUpload = function InternalUpload(props, ref) {
|
|
|
253
277
|
return;
|
|
254
278
|
}
|
|
255
279
|
var targetItem = file2Obj(file);
|
|
256
|
-
targetItem.status =
|
|
280
|
+
targetItem.status = "done";
|
|
257
281
|
targetItem.percent = 100;
|
|
258
282
|
targetItem.response = response;
|
|
259
283
|
targetItem.xhr = xhr;
|
|
@@ -266,7 +290,7 @@ var InternalUpload = function InternalUpload(props, ref) {
|
|
|
266
290
|
return;
|
|
267
291
|
}
|
|
268
292
|
var targetItem = file2Obj(file);
|
|
269
|
-
targetItem.status =
|
|
293
|
+
targetItem.status = "uploading";
|
|
270
294
|
targetItem.percent = e.percent;
|
|
271
295
|
var nextFileList = updateFileList(targetItem, mergedFileList);
|
|
272
296
|
onInternalChange(targetItem, nextFileList, e);
|
|
@@ -279,13 +303,13 @@ var InternalUpload = function InternalUpload(props, ref) {
|
|
|
279
303
|
var targetItem = file2Obj(file);
|
|
280
304
|
targetItem.error = error;
|
|
281
305
|
targetItem.response = response;
|
|
282
|
-
targetItem.status =
|
|
306
|
+
targetItem.status = "error";
|
|
283
307
|
var nextFileList = updateFileList(targetItem, mergedFileList);
|
|
284
308
|
onInternalChange(targetItem, nextFileList);
|
|
285
309
|
};
|
|
286
310
|
var handleRemove = function handleRemove(file) {
|
|
287
311
|
var currentFile;
|
|
288
|
-
Promise.resolve(typeof onRemove ===
|
|
312
|
+
Promise.resolve(typeof onRemove === "function" ? onRemove(file) : onRemove).then(function (ret) {
|
|
289
313
|
// Prevent removing file
|
|
290
314
|
if (ret === false) {
|
|
291
315
|
return;
|
|
@@ -294,12 +318,12 @@ var InternalUpload = function InternalUpload(props, ref) {
|
|
|
294
318
|
if (removedFileList) {
|
|
295
319
|
var _upload$current;
|
|
296
320
|
currentFile = _objectSpread(_objectSpread({}, file), {}, {
|
|
297
|
-
status:
|
|
321
|
+
status: "removed"
|
|
298
322
|
});
|
|
299
323
|
mergedFileList === null || mergedFileList === void 0 || mergedFileList.forEach(function (item) {
|
|
300
|
-
var matchKey = currentFile.uid !== undefined ?
|
|
324
|
+
var matchKey = currentFile.uid !== undefined ? "uid" : "name";
|
|
301
325
|
if (item[matchKey] === currentFile[matchKey] && !Object.isFrozen(item)) {
|
|
302
|
-
item.status =
|
|
326
|
+
item.status = "removed";
|
|
303
327
|
}
|
|
304
328
|
});
|
|
305
329
|
(_upload$current = upload.current) === null || _upload$current === void 0 || _upload$current.abort(currentFile);
|
|
@@ -309,7 +333,7 @@ var InternalUpload = function InternalUpload(props, ref) {
|
|
|
309
333
|
};
|
|
310
334
|
var onFileDrop = function onFileDrop(e) {
|
|
311
335
|
setDragState(e.type);
|
|
312
|
-
if (e.type ===
|
|
336
|
+
if (e.type === "drop") {
|
|
313
337
|
onDrop === null || onDrop === void 0 || onDrop(e);
|
|
314
338
|
}
|
|
315
339
|
};
|
|
@@ -329,7 +353,7 @@ var InternalUpload = function InternalUpload(props, ref) {
|
|
|
329
353
|
getPrefixCls = _React$useContext.getPrefixCls,
|
|
330
354
|
direction = _React$useContext.direction,
|
|
331
355
|
ctxUpload = _React$useContext.upload;
|
|
332
|
-
var prefixCls = getPrefixCls(
|
|
356
|
+
var prefixCls = getPrefixCls("upload", customizePrefixCls);
|
|
333
357
|
var rcUploadProps = _objectSpread(_objectSpread({
|
|
334
358
|
onBatchStart: onBatchStart,
|
|
335
359
|
onError: onError,
|
|
@@ -349,6 +373,8 @@ var InternalUpload = function InternalUpload(props, ref) {
|
|
|
349
373
|
});
|
|
350
374
|
delete rcUploadProps.className;
|
|
351
375
|
delete rcUploadProps.style;
|
|
376
|
+
rcUploadProps === null || rcUploadProps === void 0 || delete rcUploadProps.title;
|
|
377
|
+
rcUploadProps === null || rcUploadProps === void 0 || delete rcUploadProps.description;
|
|
352
378
|
// Remove id to avoid open by label when trigger is hidden
|
|
353
379
|
// !children: https://github.com/ant-design/ant-design/issues/14298
|
|
354
380
|
// disabled: https://github.com/ant-design/ant-design/issues/16478
|
|
@@ -362,19 +388,18 @@ var InternalUpload = function InternalUpload(props, ref) {
|
|
|
362
388
|
wrapCSSVar = _useStyle2[0],
|
|
363
389
|
hashId = _useStyle2[1],
|
|
364
390
|
cssVarCls = _useStyle2[2];
|
|
365
|
-
var _useLocale = useLocale(
|
|
391
|
+
var _useLocale = useLocale("Upload", defaultLocale.Upload),
|
|
366
392
|
_useLocale2 = _slicedToArray(_useLocale, 1),
|
|
367
393
|
contextLocale = _useLocale2[0];
|
|
368
|
-
var _ref2 = typeof showUploadList ===
|
|
394
|
+
var _ref2 = typeof showUploadList === "boolean" ? {} : showUploadList,
|
|
369
395
|
showRemoveIcon = _ref2.showRemoveIcon,
|
|
370
396
|
showPreviewIcon = _ref2.showPreviewIcon,
|
|
371
397
|
showDownloadIcon = _ref2.showDownloadIcon,
|
|
372
398
|
removeIcon = _ref2.removeIcon,
|
|
373
399
|
previewIcon = _ref2.previewIcon,
|
|
374
|
-
downloadIcon = _ref2.downloadIcon
|
|
375
|
-
extra = _ref2.extra;
|
|
400
|
+
downloadIcon = _ref2.downloadIcon;
|
|
376
401
|
// use showRemoveIcon if it is specified explicitly
|
|
377
|
-
var realShowRemoveIcon = typeof showRemoveIcon ===
|
|
402
|
+
var realShowRemoveIcon = typeof showRemoveIcon === "undefined" ? !mergedDisabled : !!showRemoveIcon;
|
|
378
403
|
var renderUploadList = function renderUploadList(button, buttonVisible) {
|
|
379
404
|
if (!showUploadList) {
|
|
380
405
|
return button;
|
|
@@ -394,7 +419,6 @@ var InternalUpload = function InternalUpload(props, ref) {
|
|
|
394
419
|
previewIcon: previewIcon,
|
|
395
420
|
downloadIcon: downloadIcon,
|
|
396
421
|
iconRender: iconRender,
|
|
397
|
-
extra: extra,
|
|
398
422
|
locale: _objectSpread(_objectSpread({}, contextLocale), propLocale),
|
|
399
423
|
isImageUrl: isImageUrl,
|
|
400
424
|
progress: progress,
|
|
@@ -404,13 +428,13 @@ var InternalUpload = function InternalUpload(props, ref) {
|
|
|
404
428
|
disabled: mergedDisabled
|
|
405
429
|
});
|
|
406
430
|
};
|
|
407
|
-
var mergedCls = classNames(wrapperCls, className, rootClassName, hashId, cssVarCls, ctxUpload === null || ctxUpload === void 0 ? void 0 : ctxUpload.className, _defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-rtl"), direction ===
|
|
431
|
+
var mergedCls = classNames(wrapperCls, className, rootClassName, hashId, cssVarCls, ctxUpload === null || ctxUpload === void 0 ? void 0 : ctxUpload.className, _defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-rtl"), direction === "rtl"), "".concat(prefixCls, "-picture-card-wrapper"), listType === "picture-card"), "".concat(prefixCls, "-picture-circle-wrapper"), listType === "picture-circle"));
|
|
408
432
|
var mergedStyle = _objectSpread(_objectSpread({}, ctxUpload === null || ctxUpload === void 0 ? void 0 : ctxUpload.style), style);
|
|
409
433
|
// ======================== Render ========================
|
|
410
|
-
if (type ===
|
|
434
|
+
if (type === "drag") {
|
|
411
435
|
var dragCls = classNames(hashId, prefixCls, "".concat(prefixCls, "-drag"), _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-drag-uploading"), mergedFileList.some(function (file) {
|
|
412
|
-
return file.status ===
|
|
413
|
-
})), "".concat(prefixCls, "-drag-hover"), dragState ===
|
|
436
|
+
return file.status === "uploading";
|
|
437
|
+
})), "".concat(prefixCls, "-drag-hover"), dragState === "dragover"), "".concat(prefixCls, "-disabled"), mergedDisabled), "".concat(prefixCls, "-rtl"), direction === "rtl"));
|
|
414
438
|
return wrapCSSVar(_jsxs("span", {
|
|
415
439
|
className: mergedCls,
|
|
416
440
|
ref: wrapRef,
|
|
@@ -425,7 +449,11 @@ var InternalUpload = function InternalUpload(props, ref) {
|
|
|
425
449
|
className: "".concat(prefixCls, "-btn"),
|
|
426
450
|
children: _jsx("div", {
|
|
427
451
|
className: "".concat(prefixCls, "-drag-container"),
|
|
428
|
-
children: children
|
|
452
|
+
children: children ? children : _jsx(DefaultChildren, {
|
|
453
|
+
title: title,
|
|
454
|
+
description: description,
|
|
455
|
+
prefixCls: prefixCls
|
|
456
|
+
})
|
|
429
457
|
})
|
|
430
458
|
}))
|
|
431
459
|
}), renderUploadList()]
|
|
@@ -435,13 +463,13 @@ var InternalUpload = function InternalUpload(props, ref) {
|
|
|
435
463
|
var uploadButton = _jsx("div", {
|
|
436
464
|
className: uploadButtonCls,
|
|
437
465
|
style: children ? undefined : {
|
|
438
|
-
display:
|
|
466
|
+
display: "none"
|
|
439
467
|
},
|
|
440
468
|
children: _jsx(RcUpload, _objectSpread(_objectSpread({}, rcUploadProps), {}, {
|
|
441
469
|
ref: upload
|
|
442
470
|
}))
|
|
443
471
|
});
|
|
444
|
-
if (listType ===
|
|
472
|
+
if (listType === "picture-card" || listType === "picture-circle") {
|
|
445
473
|
return wrapCSSVar(_jsx("span", {
|
|
446
474
|
className: mergedCls,
|
|
447
475
|
ref: wrapRef,
|
|
@@ -455,7 +483,7 @@ var InternalUpload = function InternalUpload(props, ref) {
|
|
|
455
483
|
}));
|
|
456
484
|
};
|
|
457
485
|
var Upload = /*#__PURE__*/React.forwardRef(InternalUpload);
|
|
458
|
-
if (process.env.NODE_ENV !==
|
|
459
|
-
Upload.displayName =
|
|
486
|
+
if (process.env.NODE_ENV !== "production") {
|
|
487
|
+
Upload.displayName = "Upload";
|
|
460
488
|
}
|
|
461
489
|
export default Upload;
|
|
@@ -40,7 +40,6 @@ var ListItem = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
40
40
|
customPreviewIcon = _ref.previewIcon,
|
|
41
41
|
customRemoveIcon = _ref.removeIcon,
|
|
42
42
|
customDownloadIcon = _ref.downloadIcon,
|
|
43
|
-
customExtra = _ref.extra,
|
|
44
43
|
onPreview = _ref.onPreview,
|
|
45
44
|
onDownload = _ref.onDownload,
|
|
46
45
|
onClose = _ref.onClose;
|
|
@@ -102,13 +101,13 @@ var ListItem = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
102
101
|
}
|
|
103
102
|
var listItemClassName = classNames("".concat(prefixCls, "-list-item"), "".concat(prefixCls, "-list-item-").concat(mergedStatus));
|
|
104
103
|
var linkProps = typeof file.linkProps === 'string' ? JSON.parse(file.linkProps) : file.linkProps;
|
|
105
|
-
var removeIcon =
|
|
104
|
+
var removeIcon = showRemoveIcon ? actionIconRender((typeof customRemoveIcon === 'function' ? customRemoveIcon(file) : customRemoveIcon) || _jsx(DeleteOutlined, {}), function () {
|
|
106
105
|
return onClose(file);
|
|
107
106
|
}, prefixCls, locale.removeFile,
|
|
108
107
|
// acceptUploadDisabled is true, only remove icon will follow Upload disabled prop
|
|
109
108
|
// https://github.com/ant-design/ant-design/issues/46171
|
|
110
109
|
true) : null;
|
|
111
|
-
var downloadIcon =
|
|
110
|
+
var downloadIcon = showDownloadIcon && mergedStatus === 'done' ? actionIconRender((typeof customDownloadIcon === 'function' ? customDownloadIcon(file) : customDownloadIcon) || _jsx(DownloadOutlined, {}), function () {
|
|
112
111
|
return onDownload(file);
|
|
113
112
|
}, prefixCls, locale.downloadFile) : null;
|
|
114
113
|
var downloadOrDelete = listType !== 'picture-card' && listType !== 'picture-circle' && _jsxs("span", {
|
|
@@ -117,13 +116,8 @@ var ListItem = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
117
116
|
}),
|
|
118
117
|
children: [downloadIcon, removeIcon]
|
|
119
118
|
}, "download-delete");
|
|
120
|
-
var extraContent = typeof customExtra === 'function' ? customExtra(file) : customExtra;
|
|
121
|
-
var extra = extraContent && _jsx("span", {
|
|
122
|
-
className: "".concat(prefixCls, "-list-item-extra"),
|
|
123
|
-
children: extraContent
|
|
124
|
-
});
|
|
125
119
|
var listItemNameClass = classNames("".concat(prefixCls, "-list-item-name"));
|
|
126
|
-
var fileName = file.url ?
|
|
120
|
+
var fileName = file.url ? [_jsx("a", _objectSpread(_objectSpread({
|
|
127
121
|
target: "_blank",
|
|
128
122
|
rel: "noopener noreferrer",
|
|
129
123
|
className: listItemNameClass,
|
|
@@ -133,16 +127,16 @@ var ListItem = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
133
127
|
onClick: function onClick(e) {
|
|
134
128
|
return onPreview(file, e);
|
|
135
129
|
},
|
|
136
|
-
children:
|
|
137
|
-
}), "view") :
|
|
130
|
+
children: file.name
|
|
131
|
+
}), "view"), downloadOrDelete] : [_jsx("span", {
|
|
138
132
|
className: listItemNameClass,
|
|
139
133
|
onClick: function onClick(e) {
|
|
140
134
|
return onPreview(file, e);
|
|
141
135
|
},
|
|
142
136
|
title: file.name,
|
|
143
|
-
children:
|
|
144
|
-
}, "view");
|
|
145
|
-
var previewIcon =
|
|
137
|
+
children: file.name
|
|
138
|
+
}, "view"), downloadOrDelete];
|
|
139
|
+
var previewIcon = showPreviewIcon && (file.url || file.thumbUrl) ? _jsx("a", {
|
|
146
140
|
href: file.url || file.thumbUrl,
|
|
147
141
|
target: "_blank",
|
|
148
142
|
rel: "noopener noreferrer",
|
|
@@ -161,7 +155,7 @@ var ListItem = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
161
155
|
var rootPrefixCls = getPrefixCls();
|
|
162
156
|
var dom = _jsxs("div", {
|
|
163
157
|
className: listItemClassName,
|
|
164
|
-
children: [icon, fileName,
|
|
158
|
+
children: [icon, fileName, pictureCardActions, showProgress && _jsx(CSSMotion, {
|
|
165
159
|
motionName: "".concat(rootPrefixCls, "-fade"),
|
|
166
160
|
visible: mergedStatus === 'uploading',
|
|
167
161
|
motionDeadline: 2000,
|