@chaoswise/ui 3.0.8 → 3.0.10

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.
@@ -190,7 +190,8 @@ var genCardStyle = function genCardStyle(token) {
190
190
  background: token.colorBgContainer,
191
191
  borderRadius: token.borderRadiusLG
192
192
  }, "&:not(".concat(componentCls, "-bordered)"), {
193
- boxShadow: boxShadowTertiary
193
+ // boxShadow: boxShadowTertiary,
194
+ boxShadow: "none"
194
195
  }), "".concat(componentCls, "-head"), genCardHeadStyle(token)), "".concat(componentCls, "-extra"), {
195
196
  // https://stackoverflow.com/a/22429853/3040605
196
197
  marginInlineStart: 'auto',
@@ -1,10 +1,7 @@
1
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
1
  var _excluded = ["prefixCls", "className", "type", "icon", "content"];
2
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
3
3
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
4
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
6
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
7
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
5
  function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
9
6
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
10
7
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
@@ -13,18 +10,22 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
13
10
  function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
14
11
  function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
15
12
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
16
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
17
- import * as React from 'react';
18
- import CheckCircleFilled from '@ant-design/icons/CheckCircleFilled';
19
- import CloseCircleFilled from '@ant-design/icons/CloseCircleFilled';
20
- import ExclamationCircleFilled from '@ant-design/icons/ExclamationCircleFilled';
21
- import InfoCircleFilled from '@ant-design/icons/InfoCircleFilled';
22
- import LoadingOutlined from '@ant-design/icons/LoadingOutlined';
23
- import classNames from 'classnames';
24
- import { Notice } from 'rc-notification';
25
- import { ConfigContext } from '../config-provider';
26
- import useCSSVarCls from '../config-provider/hooks/useCSSVarCls';
27
- import useStyle from './style';
13
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
14
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
15
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
16
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
17
+ import * as React from "react";
18
+ import CheckCircleFilled from "@ant-design/icons/CheckCircleFilled";
19
+ import CloseCircleFilled from "@ant-design/icons/CloseCircleFilled";
20
+ import ExclamationCircleFilled from "@ant-design/icons/ExclamationCircleFilled";
21
+ import InfoCircleFilled from "@ant-design/icons/InfoCircleFilled";
22
+ import LoadingOutlined from "@ant-design/icons/LoadingOutlined";
23
+ import classNames from "classnames";
24
+ import { Notice } from "rc-notification";
25
+ import { ConfigContext } from "../config-provider";
26
+ import useCSSVarCls from "../config-provider/hooks/useCSSVarCls";
27
+ import useStyle from "./style";
28
+ import CloseSvg from "./assets/Close";
28
29
  export var TypeIcon = {
29
30
  info: _jsx(InfoCircleFilled, {}),
30
31
  success: _jsx(CheckCircleFilled, {}),
@@ -36,11 +37,28 @@ export var PureContent = function PureContent(_ref) {
36
37
  var prefixCls = _ref.prefixCls,
37
38
  type = _ref.type,
38
39
  icon = _ref.icon,
39
- children = _ref.children;
40
- return _jsxs("div", {
41
- className: classNames("".concat(prefixCls, "-custom-content"), "".concat(prefixCls, "-").concat(type)),
42
- children: [icon || TypeIcon[type], _jsx("span", {
43
- children: children
40
+ children = _ref.children,
41
+ onClose = _ref.onClose,
42
+ closable = _ref.closable,
43
+ dec = _ref.dec;
44
+ return _jsxs(_Fragment, {
45
+ children: [_jsxs("div", {
46
+ className: classNames("".concat(prefixCls, "-custom-content"), "".concat(prefixCls, "-").concat(type), _defineProperty({}, "".concat(prefixCls, "-custom-content-has-dec"), dec)),
47
+ children: [icon || TypeIcon[type], _jsx("span", {
48
+ className: "".concat(prefixCls, "-custom-header-content"),
49
+ children: children
50
+ }), closable && _jsx("span", {
51
+ onClick: function onClick() {
52
+ onClose === null || onClose === void 0 || onClose();
53
+ },
54
+ className: "".concat(prefixCls, "-custom-header-close-wrapper"),
55
+ children: _jsx(CloseSvg, {
56
+ className: "".concat(prefixCls, "-custom-header-close")
57
+ })
58
+ })]
59
+ }), dec && _jsx("div", {
60
+ className: classNames(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-custom-dec-wrapper"), true), "".concat(prefixCls, "-custom-dec-not-closable"), !closable)),
61
+ children: dec
44
62
  })]
45
63
  });
46
64
  };
@@ -54,7 +72,7 @@ var PurePanel = function PurePanel(props) {
54
72
  restProps = _objectWithoutProperties(props, _excluded);
55
73
  var _React$useContext = React.useContext(ConfigContext),
56
74
  getPrefixCls = _React$useContext.getPrefixCls;
57
- var prefixCls = staticPrefixCls || getPrefixCls('message');
75
+ var prefixCls = staticPrefixCls || getPrefixCls("message");
58
76
  var rootCls = useCSSVarCls(prefixCls);
59
77
  var _useStyle = useStyle(prefixCls, rootCls),
60
78
  _useStyle2 = _slicedToArray(_useStyle, 3),
@@ -0,0 +1,22 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
+ import { jsx as _jsx } from "react/jsx-runtime";
8
+ import * as React from "react";
9
+ var SvgClose = function SvgClose(props) {
10
+ return _jsx("svg", _objectSpread(_objectSpread({
11
+ width: 8,
12
+ height: 8,
13
+ xmlns: "http://www.w3.org/2000/svg"
14
+ }, props), {}, {
15
+ children: _jsx("path", {
16
+ d: "M7.535 7.41a.5.5 0 0 1-.707 0L4 4.582 1.172 7.41a.5.5 0 1 1-.707-.707l2.828-2.828L.465 1.047A.5.5 0 0 1 1.172.34L4 3.168 6.828.34a.5.5 0 0 1 .707.707L4.707 3.875l2.828 2.828a.5.5 0 0 1 0 .707Z",
17
+ fill: "currentColor",
18
+ fillRule: "evenodd"
19
+ })
20
+ }));
21
+ };
22
+ export default SvgClose;
@@ -59,14 +59,55 @@ var genMessageStyle = function genMessageStyle(token) {
59
59
  marginInlineEnd: marginXS,
60
60
  // affected by ltr or rtl
61
61
  fontSize: fontSizeLG
62
- }), "".concat(noticeCls, "-content"), {
62
+ }), "".concat(noticeCls, "-content"), _defineProperty(_defineProperty(_defineProperty({
63
63
  display: 'inline-block',
64
64
  padding: contentPadding,
65
65
  background: contentBg,
66
66
  borderRadius: borderRadiusLG,
67
67
  boxShadow: boxShadow,
68
- pointerEvents: 'all'
69
- }), "".concat(componentCls, "-success > ").concat(iconCls), {
68
+ pointerEvents: 'all',
69
+ maxWidth: "400px"
70
+ }, "&:has(".concat(componentCls, "-custom-dec-wrapper)"), {
71
+ paddingBottom: "12px",
72
+ width: "400px"
73
+ }), "".concat(componentCls, "-custom-content"), _defineProperty(_defineProperty(_defineProperty(_defineProperty({
74
+ display: "flex",
75
+ lineHeight: "22px"
76
+ }, "> ".concat(iconCls), {
77
+ fontSize: "16px",
78
+ width: "16px",
79
+ height: "16px",
80
+ transform: "translateY(3px)"
81
+ }), "".concat(componentCls, "-custom-header-content"), {
82
+ display: "inline-block",
83
+ fontSize: "14px",
84
+ lineHeight: "22px",
85
+ flex: "1",
86
+ flexBasis: "auto",
87
+ textAlign: "left",
88
+ marginRight: "16px",
89
+ wordBreak: "break-all"
90
+ }), "".concat(componentCls, "-custom-header-close-wrapper"), {
91
+ display: "inline-block",
92
+ height: "22px",
93
+ lineHeight: "22px",
94
+ cursor: "pointer",
95
+ "&:hover": {
96
+ color: token.colorPrimaryHover
97
+ }
98
+ }), "&".concat(componentCls, "-custom-content-has-dec"), _defineProperty({}, "".concat(componentCls, "-custom-header-content"), {
99
+ fontWeight: "500"
100
+ }))), "".concat(componentCls, "-custom-dec-wrapper"), _defineProperty({
101
+ textAlign: "left",
102
+ paddingLeft: "24px",
103
+ paddingRight: "32px",
104
+ marginTop: "6px",
105
+ fontSize: "14px",
106
+ lineHeight: "22px",
107
+ wordBreak: "break-all"
108
+ }, "&".concat(componentCls, "-custom-dec-not-closable"), {
109
+ paddingRight: "16px"
110
+ }))), "".concat(componentCls, "-success > ").concat(iconCls), {
70
111
  color: colorSuccess
71
112
  }), "".concat(componentCls, "-error > ").concat(iconCls), {
72
113
  color: colorError
@@ -1,4 +1,4 @@
1
- var _excluded = ["content", "icon", "type", "key", "className", "style", "onClose"];
1
+ var _excluded = ["content", "icon", "type", "key", "className", "style", "onClose", "closable", "dec"];
2
2
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
3
3
  function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
4
4
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
@@ -151,12 +151,18 @@ export function useInternalMessage(messageConfig) {
151
151
  className = config.className,
152
152
  style = config.style,
153
153
  _onClose = config.onClose,
154
+ _config$closable = config.closable,
155
+ closable = _config$closable === void 0 ? true : _config$closable,
156
+ dec = config.dec,
154
157
  restConfig = _objectWithoutProperties(config, _excluded);
155
158
  var mergedKey = key;
156
159
  if (mergedKey === undefined || mergedKey === null) {
157
160
  keyIndex += 1;
158
161
  mergedKey = "antd-message-".concat(keyIndex);
159
162
  }
163
+ var onCloseCustom = function onCloseCustom() {
164
+ close(mergedKey);
165
+ };
160
166
  return wrapPromiseFn(function (resolve) {
161
167
  originOpen(_objectSpread(_objectSpread({}, restConfig), {}, {
162
168
  key: mergedKey,
@@ -164,6 +170,9 @@ export function useInternalMessage(messageConfig) {
164
170
  prefixCls: prefixCls,
165
171
  type: type,
166
172
  icon: icon,
173
+ onClose: onCloseCustom,
174
+ closable: closable,
175
+ dec: dec,
167
176
  children: content
168
177
  }),
169
178
  placement: 'top',
@@ -195,7 +204,8 @@ export function useInternalMessage(messageConfig) {
195
204
  };
196
205
  var keys = ['info', 'success', 'warning', 'error', 'loading'];
197
206
  keys.forEach(function (type) {
198
- var typeOpen = function typeOpen(jointContent, duration, onClose) {
207
+ var typeOpen = function typeOpen(jointContent, duration, onClose, dec) {
208
+ var closable = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
199
209
  var config;
200
210
  if (jointContent && _typeof(jointContent) === 'object' && 'content' in jointContent) {
201
211
  config = jointContent;
@@ -215,7 +225,9 @@ export function useInternalMessage(messageConfig) {
215
225
  }
216
226
  var mergedConfig = _objectSpread(_objectSpread({
217
227
  onClose: mergedOnClose,
218
- duration: mergedDuration
228
+ duration: mergedDuration,
229
+ dec: dec,
230
+ closable: closable
219
231
  }, config), {}, {
220
232
  type: type
221
233
  });
@@ -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 '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';
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("5b800d91-5cf8-448b-baaa-4722482d07e4").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 ? 'text' : _props$listType,
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 ? 'select' : _props$type,
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 ? '' : _props$action,
90
+ action = _props$action === void 0 ? "" : _props$action,
69
91
  _props$accept = props.accept,
70
- accept = _props$accept === void 0 ? '' : _props$accept,
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('drop'),
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 !== 'production') {
93
- var warning = devUseWarning('Upload');
94
- warning('fileList' in props || !('value' in props), 'usage', '`value` is not a valid prop, do you mean `fileList`?');
95
- warning.deprecated(!('transformFile' in props), 'transformFile', 'beforeUpload');
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 === 'removed' ||
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) === 'object' && result) {
197
+ if (_typeof(result) === "object" && result) {
173
198
  parsedFile = result;
174
199
  }
175
200
  case 13:
@@ -234,14 +259,14 @@ var InternalUpload = function InternalUpload(props, ref) {
234
259
  triggerFileObj = clone;
235
260
  } else {
236
261
  // Inject `uploading` status
237
- fileObj.status = 'uploading';
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 === 'string') {
269
+ if (typeof response === "string") {
245
270
  response = JSON.parse(response);
246
271
  }
247
272
  } catch (e) {
@@ -252,7 +277,7 @@ var InternalUpload = function InternalUpload(props, ref) {
252
277
  return;
253
278
  }
254
279
  var targetItem = file2Obj(file);
255
- targetItem.status = 'done';
280
+ targetItem.status = "done";
256
281
  targetItem.percent = 100;
257
282
  targetItem.response = response;
258
283
  targetItem.xhr = xhr;
@@ -265,7 +290,7 @@ var InternalUpload = function InternalUpload(props, ref) {
265
290
  return;
266
291
  }
267
292
  var targetItem = file2Obj(file);
268
- targetItem.status = 'uploading';
293
+ targetItem.status = "uploading";
269
294
  targetItem.percent = e.percent;
270
295
  var nextFileList = updateFileList(targetItem, mergedFileList);
271
296
  onInternalChange(targetItem, nextFileList, e);
@@ -278,13 +303,13 @@ var InternalUpload = function InternalUpload(props, ref) {
278
303
  var targetItem = file2Obj(file);
279
304
  targetItem.error = error;
280
305
  targetItem.response = response;
281
- targetItem.status = 'error';
306
+ targetItem.status = "error";
282
307
  var nextFileList = updateFileList(targetItem, mergedFileList);
283
308
  onInternalChange(targetItem, nextFileList);
284
309
  };
285
310
  var handleRemove = function handleRemove(file) {
286
311
  var currentFile;
287
- Promise.resolve(typeof onRemove === 'function' ? onRemove(file) : onRemove).then(function (ret) {
312
+ Promise.resolve(typeof onRemove === "function" ? onRemove(file) : onRemove).then(function (ret) {
288
313
  // Prevent removing file
289
314
  if (ret === false) {
290
315
  return;
@@ -293,12 +318,12 @@ var InternalUpload = function InternalUpload(props, ref) {
293
318
  if (removedFileList) {
294
319
  var _upload$current;
295
320
  currentFile = _objectSpread(_objectSpread({}, file), {}, {
296
- status: 'removed'
321
+ status: "removed"
297
322
  });
298
323
  mergedFileList === null || mergedFileList === void 0 || mergedFileList.forEach(function (item) {
299
- var matchKey = currentFile.uid !== undefined ? 'uid' : 'name';
324
+ var matchKey = currentFile.uid !== undefined ? "uid" : "name";
300
325
  if (item[matchKey] === currentFile[matchKey] && !Object.isFrozen(item)) {
301
- item.status = 'removed';
326
+ item.status = "removed";
302
327
  }
303
328
  });
304
329
  (_upload$current = upload.current) === null || _upload$current === void 0 || _upload$current.abort(currentFile);
@@ -308,7 +333,7 @@ var InternalUpload = function InternalUpload(props, ref) {
308
333
  };
309
334
  var onFileDrop = function onFileDrop(e) {
310
335
  setDragState(e.type);
311
- if (e.type === 'drop') {
336
+ if (e.type === "drop") {
312
337
  onDrop === null || onDrop === void 0 || onDrop(e);
313
338
  }
314
339
  };
@@ -328,7 +353,7 @@ var InternalUpload = function InternalUpload(props, ref) {
328
353
  getPrefixCls = _React$useContext.getPrefixCls,
329
354
  direction = _React$useContext.direction,
330
355
  ctxUpload = _React$useContext.upload;
331
- var prefixCls = getPrefixCls('upload', customizePrefixCls);
356
+ var prefixCls = getPrefixCls("upload", customizePrefixCls);
332
357
  var rcUploadProps = _objectSpread(_objectSpread({
333
358
  onBatchStart: onBatchStart,
334
359
  onError: onError,
@@ -348,6 +373,8 @@ var InternalUpload = function InternalUpload(props, ref) {
348
373
  });
349
374
  delete rcUploadProps.className;
350
375
  delete rcUploadProps.style;
376
+ rcUploadProps === null || rcUploadProps === void 0 || delete rcUploadProps.title;
377
+ rcUploadProps === null || rcUploadProps === void 0 || delete rcUploadProps.description;
351
378
  // Remove id to avoid open by label when trigger is hidden
352
379
  // !children: https://github.com/ant-design/ant-design/issues/14298
353
380
  // disabled: https://github.com/ant-design/ant-design/issues/16478
@@ -361,10 +388,10 @@ var InternalUpload = function InternalUpload(props, ref) {
361
388
  wrapCSSVar = _useStyle2[0],
362
389
  hashId = _useStyle2[1],
363
390
  cssVarCls = _useStyle2[2];
364
- var _useLocale = useLocale('Upload', defaultLocale.Upload),
391
+ var _useLocale = useLocale("Upload", defaultLocale.Upload),
365
392
  _useLocale2 = _slicedToArray(_useLocale, 1),
366
393
  contextLocale = _useLocale2[0];
367
- var _ref2 = typeof showUploadList === 'boolean' ? {} : showUploadList,
394
+ var _ref2 = typeof showUploadList === "boolean" ? {} : showUploadList,
368
395
  showRemoveIcon = _ref2.showRemoveIcon,
369
396
  showPreviewIcon = _ref2.showPreviewIcon,
370
397
  showDownloadIcon = _ref2.showDownloadIcon,
@@ -372,7 +399,7 @@ var InternalUpload = function InternalUpload(props, ref) {
372
399
  previewIcon = _ref2.previewIcon,
373
400
  downloadIcon = _ref2.downloadIcon;
374
401
  // use showRemoveIcon if it is specified explicitly
375
- var realShowRemoveIcon = typeof showRemoveIcon === 'undefined' ? !mergedDisabled : !!showRemoveIcon;
402
+ var realShowRemoveIcon = typeof showRemoveIcon === "undefined" ? !mergedDisabled : !!showRemoveIcon;
376
403
  var renderUploadList = function renderUploadList(button, buttonVisible) {
377
404
  if (!showUploadList) {
378
405
  return button;
@@ -401,13 +428,13 @@ var InternalUpload = function InternalUpload(props, ref) {
401
428
  disabled: mergedDisabled
402
429
  });
403
430
  };
404
- 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'));
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"));
405
432
  var mergedStyle = _objectSpread(_objectSpread({}, ctxUpload === null || ctxUpload === void 0 ? void 0 : ctxUpload.style), style);
406
433
  // ======================== Render ========================
407
- if (type === 'drag') {
434
+ if (type === "drag") {
408
435
  var dragCls = classNames(hashId, prefixCls, "".concat(prefixCls, "-drag"), _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-drag-uploading"), mergedFileList.some(function (file) {
409
- return file.status === 'uploading';
410
- })), "".concat(prefixCls, "-drag-hover"), dragState === 'dragover'), "".concat(prefixCls, "-disabled"), mergedDisabled), "".concat(prefixCls, "-rtl"), direction === 'rtl'));
436
+ return file.status === "uploading";
437
+ })), "".concat(prefixCls, "-drag-hover"), dragState === "dragover"), "".concat(prefixCls, "-disabled"), mergedDisabled), "".concat(prefixCls, "-rtl"), direction === "rtl"));
411
438
  return wrapCSSVar(_jsxs("span", {
412
439
  className: mergedCls,
413
440
  ref: wrapRef,
@@ -422,7 +449,11 @@ var InternalUpload = function InternalUpload(props, ref) {
422
449
  className: "".concat(prefixCls, "-btn"),
423
450
  children: _jsx("div", {
424
451
  className: "".concat(prefixCls, "-drag-container"),
425
- children: children
452
+ children: children ? children : _jsx(DefaultChildren, {
453
+ title: title,
454
+ description: description,
455
+ prefixCls: prefixCls
456
+ })
426
457
  })
427
458
  }))
428
459
  }), renderUploadList()]
@@ -432,13 +463,13 @@ var InternalUpload = function InternalUpload(props, ref) {
432
463
  var uploadButton = _jsx("div", {
433
464
  className: uploadButtonCls,
434
465
  style: children ? undefined : {
435
- display: 'none'
466
+ display: "none"
436
467
  },
437
468
  children: _jsx(RcUpload, _objectSpread(_objectSpread({}, rcUploadProps), {}, {
438
469
  ref: upload
439
470
  }))
440
471
  });
441
- if (listType === 'picture-card' || listType === 'picture-circle') {
472
+ if (listType === "picture-card" || listType === "picture-circle") {
442
473
  return wrapCSSVar(_jsx("span", {
443
474
  className: mergedCls,
444
475
  ref: wrapRef,
@@ -452,7 +483,7 @@ var InternalUpload = function InternalUpload(props, ref) {
452
483
  }));
453
484
  };
454
485
  var Upload = /*#__PURE__*/React.forwardRef(InternalUpload);
455
- if (process.env.NODE_ENV !== 'production') {
456
- Upload.displayName = 'Upload';
486
+ if (process.env.NODE_ENV !== "production") {
487
+ Upload.displayName = "Upload";
457
488
  }
458
489
  export default Upload;
@@ -17,7 +17,7 @@ var genDraggerStyle = function genDraggerStyle(token) {
17
17
  cursor: 'pointer',
18
18
  transition: "border-color ".concat(token.motionDurationSlow)
19
19
  }, componentCls, {
20
- padding: token.padding
20
+ // padding: token.padding, // 删除符合UI规范
21
21
  }), "".concat(componentCls, "-btn"), {
22
22
  display: 'table',
23
23
  width: '100%',
@@ -27,10 +27,23 @@ var genDraggerStyle = function genDraggerStyle(token) {
27
27
  '&:focus-visible': {
28
28
  outline: "".concat(unit(token.lineWidthFocus), " solid ").concat(token.colorPrimaryBorder)
29
29
  }
30
- }), "".concat(componentCls, "-drag-container"), {
30
+ }), "".concat(componentCls, "-drag-container"), _defineProperty({
31
31
  display: 'table-cell',
32
32
  verticalAlign: 'middle'
33
- }), "\n &:not(".concat(componentCls, "-disabled):hover,\n &-hover:not(").concat(componentCls, "-disabled)\n "), {
33
+ }, "".concat(componentCls, "-drag-wrapper"), _defineProperty(_defineProperty(_defineProperty({
34
+ padding: "39px 0"
35
+ }, "".concat(componentCls, "-drag-icon-wrapper"), _defineProperty({
36
+ marginBottom: "8px"
37
+ }, iconCls, {
38
+ color: token.colorPrimaryHover,
39
+ fontSize: "48px"
40
+ })), "".concat(componentCls, "-drag-text"), {
41
+ lineHeight: "20px"
42
+ }), "".concat(componentCls, "-drag-desc"), {
43
+ color: token.colorTextTertiary,
44
+ marginTop: "8px",
45
+ lineHeight: "20px"
46
+ }))), "\n &:not(".concat(componentCls, "-disabled):hover,\n &-hover:not(").concat(componentCls, "-disabled)\n "), {
34
47
  borderColor: token.colorPrimaryHover
35
48
  }), "p".concat(componentCls, "-drag-icon"), _defineProperty({
36
49
  marginBottom: token.margin
@@ -44,8 +57,16 @@ var genDraggerStyle = function genDraggerStyle(token) {
44
57
  }), "p".concat(componentCls, "-hint"), {
45
58
  color: token.colorTextDescription,
46
59
  fontSize: token.fontSize
47
- }), "&".concat(componentCls, "-disabled"), _defineProperty({}, "p".concat(componentCls, "-drag-icon ").concat(iconCls, ",\n p").concat(componentCls, "-text,\n p").concat(componentCls, "-hint\n "), {
60
+ }), "&".concat(componentCls, "-disabled"), _defineProperty(_defineProperty({
61
+ background: token.colorBgContainerDisabled
62
+ }, "p".concat(componentCls, "-drag-icon ").concat(iconCls, ",\n p").concat(componentCls, "-text,\n p").concat(componentCls, "-hint,\n "), {
63
+ color: token.colorTextDisabled
64
+ }), "".concat(componentCls, "-drag-wrapper"), _defineProperty(_defineProperty(_defineProperty({}, "".concat(componentCls, "-drag-icon-wrapper"), _defineProperty({}, iconCls, {
65
+ color: token.colorTextDisabled
66
+ })), "".concat(componentCls, "-drag-text"), {
67
+ color: token.colorTextDisabled
68
+ }), "".concat(componentCls, "-drag-desc"), {
48
69
  color: token.colorTextDisabled
49
- }))));
70
+ })))));
50
71
  };
51
72
  export default genDraggerStyle;
@@ -45,10 +45,12 @@ var genCustomBadgeStyle = function genCustomBadgeStyle(token) {
45
45
  display: "inline-block",
46
46
  height: "20px",
47
47
  lineHeight: "20px"
48
- })), "".concat(badgePrefix).concat(badgePrefix, "-wrapper"), _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(badgePrefix, "-multiple-words"), {
48
+ })), "".concat(badgePrefix).concat(badgePrefix, "-wrapper"), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(badgePrefix, "-multiple-words"), {
49
49
  padding: "0 6px"
50
50
  }), "".concat(badgePrefix, "-count"), {
51
51
  boxShadow: "none !important"
52
+ }), "".concat(badgePrefix, "-status-dot:only-child"), {
53
+ marginRight: "8px"
52
54
  }), "".concat(badgePrefix, "-dot"), {
53
55
  boxShadow: "none !important"
54
56
  }), "".concat(badgePrefix, "-scroll-number"), {