You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
NewEduCoderBuild/31365.async.js

2483 lines
85 KiB

"use strict";
(self["webpackChunk"] = self["webpackChunk"] || []).push([[31365],{
/***/ 48689:
/*!*******************************************************************************!*\
!*** ./node_modules/@ant-design/icons/es/icons/DeleteOutlined.js + 1 modules ***!
\*******************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"Z": function() { return /* binding */ icons_DeleteOutlined; }
});
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
var esm_extends = __webpack_require__(87462);
// EXTERNAL MODULE: ./node_modules/react/index.js
var react = __webpack_require__(67294);
;// CONCATENATED MODULE: ./node_modules/@ant-design/icons-svg/es/asn/DeleteOutlined.js
// This icon file is generated automatically.
var DeleteOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z" } }] }, "name": "delete", "theme": "outlined" };
/* harmony default export */ var asn_DeleteOutlined = (DeleteOutlined);
// EXTERNAL MODULE: ./node_modules/@ant-design/icons/es/components/AntdIcon.js + 8 modules
var AntdIcon = __webpack_require__(74643);
;// CONCATENATED MODULE: ./node_modules/@ant-design/icons/es/icons/DeleteOutlined.js
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
var DeleteOutlined_DeleteOutlined = function DeleteOutlined(props, ref) {
return /*#__PURE__*/react.createElement(AntdIcon/* default */.Z, (0,esm_extends/* default */.Z)({}, props, {
ref: ref,
icon: asn_DeleteOutlined
}));
};
if (false) {}
/* harmony default export */ var icons_DeleteOutlined = (/*#__PURE__*/react.forwardRef(DeleteOutlined_DeleteOutlined));
/***/ }),
/***/ 23430:
/*!*********************************************************************************!*\
!*** ./node_modules/@ant-design/icons/es/icons/DownloadOutlined.js + 1 modules ***!
\*********************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"Z": function() { return /* binding */ icons_DownloadOutlined; }
});
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
var esm_extends = __webpack_require__(87462);
// EXTERNAL MODULE: ./node_modules/react/index.js
var react = __webpack_require__(67294);
;// CONCATENATED MODULE: ./node_modules/@ant-design/icons-svg/es/asn/DownloadOutlined.js
// This icon file is generated automatically.
var DownloadOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M505.7 661a8 8 0 0012.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z" } }] }, "name": "download", "theme": "outlined" };
/* harmony default export */ var asn_DownloadOutlined = (DownloadOutlined);
// EXTERNAL MODULE: ./node_modules/@ant-design/icons/es/components/AntdIcon.js + 8 modules
var AntdIcon = __webpack_require__(74643);
;// CONCATENATED MODULE: ./node_modules/@ant-design/icons/es/icons/DownloadOutlined.js
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
var DownloadOutlined_DownloadOutlined = function DownloadOutlined(props, ref) {
return /*#__PURE__*/react.createElement(AntdIcon/* default */.Z, (0,esm_extends/* default */.Z)({}, props, {
ref: ref,
icon: asn_DownloadOutlined
}));
};
if (false) {}
/* harmony default export */ var icons_DownloadOutlined = (/*#__PURE__*/react.forwardRef(DownloadOutlined_DownloadOutlined));
/***/ }),
/***/ 31365:
/*!***********************************************************!*\
!*** ./node_modules/antd/es/upload/index.js + 24 modules ***!
\***********************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"Z": function() { return /* binding */ es_upload; }
});
// EXTERNAL MODULE: ./node_modules/react/index.js
var react = __webpack_require__(67294);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules
var toConsumableArray = __webpack_require__(74902);
// EXTERNAL MODULE: ./node_modules/classnames/index.js
var classnames = __webpack_require__(94184);
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
var esm_extends = __webpack_require__(87462);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js
var classCallCheck = __webpack_require__(15671);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js
var createClass = __webpack_require__(43144);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js
var inherits = __webpack_require__(60136);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createSuper.js + 1 modules
var createSuper = __webpack_require__(51630);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
var defineProperty = __webpack_require__(4942);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js
var objectWithoutProperties = __webpack_require__(45987);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js
var regeneratorRuntime = __webpack_require__(74165);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js
var esm_typeof = __webpack_require__(71002);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js
var asyncToGenerator = __webpack_require__(15861);
// EXTERNAL MODULE: ./node_modules/rc-util/es/pickAttrs.js
var pickAttrs = __webpack_require__(64217);
;// CONCATENATED MODULE: ./node_modules/rc-upload/es/request.js
function getError(option, xhr) {
var msg = "cannot ".concat(option.method, " ").concat(option.action, " ").concat(xhr.status, "'");
var err = new Error(msg);
err.status = xhr.status;
err.method = option.method;
err.url = option.action;
return err;
}
function getBody(xhr) {
var text = xhr.responseText || xhr.response;
if (!text) {
return text;
}
try {
return JSON.parse(text);
} catch (e) {
return text;
}
}
function upload(option) {
// eslint-disable-next-line no-undef
var xhr = new XMLHttpRequest();
if (option.onProgress && xhr.upload) {
xhr.upload.onprogress = function progress(e) {
if (e.total > 0) {
e.percent = e.loaded / e.total * 100;
}
option.onProgress(e);
};
} // eslint-disable-next-line no-undef
var formData = new FormData();
if (option.data) {
Object.keys(option.data).forEach(function (key) {
var value = option.data[key]; // support key-value array data
if (Array.isArray(value)) {
value.forEach(function (item) {
// { list: [ 11, 22 ] }
// formData.append('list[]', 11);
formData.append("".concat(key, "[]"), item);
});
return;
}
formData.append(key, value);
});
} // eslint-disable-next-line no-undef
if (option.file instanceof Blob) {
formData.append(option.filename, option.file, option.file.name);
} else {
formData.append(option.filename, option.file);
}
xhr.onerror = function error(e) {
option.onError(e);
};
xhr.onload = function onload() {
// allow success when 2xx status
// see https://github.com/react-component/upload/issues/34
if (xhr.status < 200 || xhr.status >= 300) {
return option.onError(getError(option, xhr), getBody(xhr));
}
return option.onSuccess(getBody(xhr), xhr);
};
xhr.open(option.method, option.action, true); // Has to be after `.open()`. See https://github.com/enyo/dropzone/issues/179
if (option.withCredentials && 'withCredentials' in xhr) {
xhr.withCredentials = true;
}
var headers = option.headers || {}; // when set headers['X-Requested-With'] = null , can close default XHR header
// see https://github.com/react-component/upload/issues/33
if (headers['X-Requested-With'] !== null) {
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
}
Object.keys(headers).forEach(function (h) {
if (headers[h] !== null) {
xhr.setRequestHeader(h, headers[h]);
}
});
xhr.send(formData);
return {
abort: function abort() {
xhr.abort();
}
};
}
;// CONCATENATED MODULE: ./node_modules/rc-upload/es/uid.js
var now = +new Date();
var index = 0;
function uid() {
// eslint-disable-next-line no-plusplus
return "rc-upload-".concat(now, "-").concat(++index);
}
// EXTERNAL MODULE: ./node_modules/rc-util/es/warning.js
var warning = __webpack_require__(80334);
;// CONCATENATED MODULE: ./node_modules/rc-upload/es/attr-accept.js
/* harmony default export */ var attr_accept = (function (file, acceptedFiles) {
if (file && acceptedFiles) {
var acceptedFilesArray = Array.isArray(acceptedFiles) ? acceptedFiles : acceptedFiles.split(',');
var fileName = file.name || '';
var mimeType = file.type || '';
var baseMimeType = mimeType.replace(/\/.*$/, '');
return acceptedFilesArray.some(function (type) {
var validType = type.trim(); // This is something like */*,* allow all files
if (/^\*(\/\*)?$/.test(type)) {
return true;
} // like .jpg, .png
if (validType.charAt(0) === '.') {
var lowerFileName = fileName.toLowerCase();
var lowerType = validType.toLowerCase();
var affixList = [lowerType];
if (lowerType === '.jpg' || lowerType === '.jpeg') {
affixList = ['.jpg', '.jpeg'];
}
return affixList.some(function (affix) {
return lowerFileName.endsWith(affix);
});
} // This is something like a image/* mime type
if (/\/\*$/.test(validType)) {
return baseMimeType === validType.replace(/\/.*$/, '');
} // Full match
if (mimeType === validType) {
return true;
} // Invalidate type should skip
if (/^\w+$/.test(validType)) {
(0,warning/* default */.ZP)(false, "Upload takes an invalidate 'accept' type '".concat(validType, "'.Skip for check."));
return true;
}
return false;
});
}
return true;
});
;// CONCATENATED MODULE: ./node_modules/rc-upload/es/traverseFileTree.js
function loopFiles(item, callback) {
var dirReader = item.createReader();
var fileList = [];
function sequence() {
dirReader.readEntries(function (entries) {
var entryList = Array.prototype.slice.apply(entries);
fileList = fileList.concat(entryList); // Check if all the file has been viewed
var isFinished = !entryList.length;
if (isFinished) {
callback(fileList);
} else {
sequence();
}
});
}
sequence();
}
var traverseFileTree = function traverseFileTree(files, callback, isAccepted) {
// eslint-disable-next-line @typescript-eslint/naming-convention
var _traverseFileTree = function _traverseFileTree(item, path) {
// eslint-disable-next-line no-param-reassign
item.path = path || '';
if (item.isFile) {
item.file(function (file) {
if (isAccepted(file)) {
// https://github.com/ant-design/ant-design/issues/16426
if (item.fullPath && !file.webkitRelativePath) {
Object.defineProperties(file, {
webkitRelativePath: {
writable: true
}
}); // eslint-disable-next-line no-param-reassign
file.webkitRelativePath = item.fullPath.replace(/^\//, '');
Object.defineProperties(file, {
webkitRelativePath: {
writable: false
}
});
}
callback([file]);
}
});
} else if (item.isDirectory) {
loopFiles(item, function (entries) {
entries.forEach(function (entryItem) {
_traverseFileTree(entryItem, "".concat(path).concat(item.name, "/"));
});
});
}
};
files.forEach(function (file) {
_traverseFileTree(file.webkitGetAsEntry());
});
};
/* harmony default export */ var es_traverseFileTree = (traverseFileTree);
;// CONCATENATED MODULE: ./node_modules/rc-upload/es/AjaxUploader.js
var _excluded = ["component", "prefixCls", "className", "disabled", "id", "style", "multiple", "accept", "capture", "children", "directory", "openFileDialogOnClick", "onMouseEnter", "onMouseLeave"];
var AjaxUploader = /*#__PURE__*/function (_Component) {
(0,inherits/* default */.Z)(AjaxUploader, _Component);
var _super = (0,createSuper/* default */.Z)(AjaxUploader);
function AjaxUploader() {
var _this;
(0,classCallCheck/* default */.Z)(this, AjaxUploader);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_this.state = {
uid: uid()
};
_this.reqs = {};
_this.fileInput = void 0;
_this._isMounted = void 0;
_this.onChange = function (e) {
var _this$props = _this.props,
accept = _this$props.accept,
directory = _this$props.directory;
var files = e.target.files;
var acceptedFiles = (0,toConsumableArray/* default */.Z)(files).filter(function (file) {
return !directory || attr_accept(file, accept);
});
_this.uploadFiles(acceptedFiles);
_this.reset();
};
_this.onClick = function (e) {
var el = _this.fileInput;
if (!el) {
return;
}
var _this$props2 = _this.props,
children = _this$props2.children,
onClick = _this$props2.onClick;
if (children && children.type === 'button') {
var parent = el.parentNode;
parent.focus();
parent.querySelector('button').blur();
}
el.click();
if (onClick) {
onClick(e);
}
};
_this.onKeyDown = function (e) {
if (e.key === 'Enter') {
_this.onClick(e);
}
};
_this.onFileDrop = function (e) {
var multiple = _this.props.multiple;
e.preventDefault();
if (e.type === 'dragover') {
return;
}
if (_this.props.directory) {
es_traverseFileTree(Array.prototype.slice.call(e.dataTransfer.items), _this.uploadFiles, function (_file) {
return attr_accept(_file, _this.props.accept);
});
} else {
var files = (0,toConsumableArray/* default */.Z)(e.dataTransfer.files).filter(function (file) {
return attr_accept(file, _this.props.accept);
});
if (multiple === false) {
files = files.slice(0, 1);
}
_this.uploadFiles(files);
}
};
_this.uploadFiles = function (files) {
var originFiles = (0,toConsumableArray/* default */.Z)(files);
var postFiles = originFiles.map(function (file) {
// eslint-disable-next-line no-param-reassign
file.uid = uid();
return _this.processFile(file, originFiles);
}); // Batch upload files
Promise.all(postFiles).then(function (fileList) {
var onBatchStart = _this.props.onBatchStart;
onBatchStart === null || onBatchStart === void 0 ? void 0 : onBatchStart(fileList.map(function (_ref) {
var origin = _ref.origin,
parsedFile = _ref.parsedFile;
return {
file: origin,
parsedFile: parsedFile
};
}));
fileList.filter(function (file) {
return file.parsedFile !== null;
}).forEach(function (file) {
_this.post(file);
});
});
};
_this.processFile = /*#__PURE__*/function () {
var _ref2 = (0,asyncToGenerator/* default */.Z)( /*#__PURE__*/(0,regeneratorRuntime/* default */.Z)().mark(function _callee(file, fileList) {
var beforeUpload, transformedFile, action, mergedAction, data, mergedData, parsedData, parsedFile, mergedParsedFile;
return (0,regeneratorRuntime/* default */.Z)().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
beforeUpload = _this.props.beforeUpload;
transformedFile = file;
if (!beforeUpload) {
_context.next = 14;
break;
}
_context.prev = 3;
_context.next = 6;
return beforeUpload(file, fileList);
case 6:
transformedFile = _context.sent;
_context.next = 12;
break;
case 9:
_context.prev = 9;
_context.t0 = _context["catch"](3);
// Rejection will also trade as false
transformedFile = false;
case 12:
if (!(transformedFile === false)) {
_context.next = 14;
break;
}
return _context.abrupt("return", {
origin: file,
parsedFile: null,
action: null,
data: null
});
case 14:
// Get latest action
action = _this.props.action;
if (!(typeof action === 'function')) {
_context.next = 21;
break;
}
_context.next = 18;
return action(file);
case 18:
mergedAction = _context.sent;
_context.next = 22;
break;
case 21:
mergedAction = action;
case 22:
// Get latest data
data = _this.props.data;
if (!(typeof data === 'function')) {
_context.next = 29;
break;
}
_context.next = 26;
return data(file);
case 26:
mergedData = _context.sent;
_context.next = 30;
break;
case 29:
mergedData = data;
case 30:
parsedData = // string type is from legacy `transformFile`.
// Not sure if this will work since no related test case works with it
((0,esm_typeof/* default */.Z)(transformedFile) === 'object' || typeof transformedFile === 'string') && transformedFile ? transformedFile : file;
if (parsedData instanceof File) {
parsedFile = parsedData;
} else {
parsedFile = new File([parsedData], file.name, {
type: file.type
});
}
mergedParsedFile = parsedFile;
mergedParsedFile.uid = file.uid;
return _context.abrupt("return", {
origin: file,
data: mergedData,
parsedFile: mergedParsedFile,
action: mergedAction
});
case 35:
case "end":
return _context.stop();
}
}
}, _callee, null, [[3, 9]]);
}));
return function (_x, _x2) {
return _ref2.apply(this, arguments);
};
}();
_this.saveFileInput = function (node) {
_this.fileInput = node;
};
return _this;
}
(0,createClass/* default */.Z)(AjaxUploader, [{
key: "componentDidMount",
value: function componentDidMount() {
this._isMounted = true;
}
}, {
key: "componentWillUnmount",
value: function componentWillUnmount() {
this._isMounted = false;
this.abort();
}
}, {
key: "post",
value: function post(_ref3) {
var _this2 = this;
var data = _ref3.data,
origin = _ref3.origin,
action = _ref3.action,
parsedFile = _ref3.parsedFile;
if (!this._isMounted) {
return;
}
var _this$props3 = this.props,
onStart = _this$props3.onStart,
customRequest = _this$props3.customRequest,
name = _this$props3.name,
headers = _this$props3.headers,
withCredentials = _this$props3.withCredentials,
method = _this$props3.method;
var uid = origin.uid;
var request = customRequest || upload;
var requestOption = {
action: action,
filename: name,
data: data,
file: parsedFile,
headers: headers,
withCredentials: withCredentials,
method: method || 'post',
onProgress: function onProgress(e) {
var onProgress = _this2.props.onProgress;
onProgress === null || onProgress === void 0 ? void 0 : onProgress(e, parsedFile);
},
onSuccess: function onSuccess(ret, xhr) {
var onSuccess = _this2.props.onSuccess;
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(ret, parsedFile, xhr);
delete _this2.reqs[uid];
},
onError: function onError(err, ret) {
var onError = _this2.props.onError;
onError === null || onError === void 0 ? void 0 : onError(err, ret, parsedFile);
delete _this2.reqs[uid];
}
};
onStart(origin);
this.reqs[uid] = request(requestOption);
}
}, {
key: "reset",
value: function reset() {
this.setState({
uid: uid()
});
}
}, {
key: "abort",
value: function abort(file) {
var reqs = this.reqs;
if (file) {
var uid = file.uid ? file.uid : file;
if (reqs[uid] && reqs[uid].abort) {
reqs[uid].abort();
}
delete reqs[uid];
} else {
Object.keys(reqs).forEach(function (uid) {
if (reqs[uid] && reqs[uid].abort) {
reqs[uid].abort();
}
delete reqs[uid];
});
}
}
}, {
key: "render",
value: function render() {
var _classNames;
var _this$props4 = this.props,
Tag = _this$props4.component,
prefixCls = _this$props4.prefixCls,
className = _this$props4.className,
disabled = _this$props4.disabled,
id = _this$props4.id,
style = _this$props4.style,
multiple = _this$props4.multiple,
accept = _this$props4.accept,
capture = _this$props4.capture,
children = _this$props4.children,
directory = _this$props4.directory,
openFileDialogOnClick = _this$props4.openFileDialogOnClick,
onMouseEnter = _this$props4.onMouseEnter,
onMouseLeave = _this$props4.onMouseLeave,
otherProps = (0,objectWithoutProperties/* default */.Z)(_this$props4, _excluded);
var cls = classnames_default()((_classNames = {}, (0,defineProperty/* default */.Z)(_classNames, prefixCls, true), (0,defineProperty/* default */.Z)(_classNames, "".concat(prefixCls, "-disabled"), disabled), (0,defineProperty/* default */.Z)(_classNames, className, className), _classNames)); // because input don't have directory/webkitdirectory type declaration
var dirProps = directory ? {
directory: 'directory',
webkitdirectory: 'webkitdirectory'
} : {};
var events = disabled ? {} : {
onClick: openFileDialogOnClick ? this.onClick : function () {},
onKeyDown: openFileDialogOnClick ? this.onKeyDown : function () {},
onMouseEnter: onMouseEnter,
onMouseLeave: onMouseLeave,
onDrop: this.onFileDrop,
onDragOver: this.onFileDrop,
tabIndex: '0'
};
return /*#__PURE__*/react.createElement(Tag, (0,esm_extends/* default */.Z)({}, events, {
className: cls,
role: "button",
style: style
}), /*#__PURE__*/react.createElement("input", (0,esm_extends/* default */.Z)({}, (0,pickAttrs/* default */.Z)(otherProps, {
aria: true,
data: true
}), {
id: id,
type: "file",
ref: this.saveFileInput,
onClick: function onClick(e) {
return e.stopPropagation();
} // https://github.com/ant-design/ant-design/issues/19948
,
key: this.state.uid,
style: {
display: 'none'
},
accept: accept
}, dirProps, {
multiple: multiple,
onChange: this.onChange
}, capture != null ? {
capture: capture
} : {})), children);
}
}]);
return AjaxUploader;
}(react.Component);
/* harmony default export */ var es_AjaxUploader = (AjaxUploader);
;// CONCATENATED MODULE: ./node_modules/rc-upload/es/Upload.js
/* eslint react/prop-types:0 */
function empty() {}
var Upload = /*#__PURE__*/function (_Component) {
(0,inherits/* default */.Z)(Upload, _Component);
var _super = (0,createSuper/* default */.Z)(Upload);
function Upload() {
var _this;
(0,classCallCheck/* default */.Z)(this, Upload);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_this.uploader = void 0;
_this.saveUploader = function (node) {
_this.uploader = node;
};
return _this;
}
(0,createClass/* default */.Z)(Upload, [{
key: "abort",
value: function abort(file) {
this.uploader.abort(file);
}
}, {
key: "render",
value: function render() {
return /*#__PURE__*/react.createElement(es_AjaxUploader, (0,esm_extends/* default */.Z)({}, this.props, {
ref: this.saveUploader
}));
}
}]);
return Upload;
}(react.Component);
Upload.defaultProps = {
component: 'span',
prefixCls: 'rc-upload',
data: {},
headers: {},
name: 'file',
multipart: false,
onStart: empty,
onError: empty,
onSuccess: empty,
multiple: false,
beforeUpload: null,
customRequest: null,
withCredentials: false,
openFileDialogOnClick: true
};
/* harmony default export */ var es_Upload = (Upload);
;// CONCATENATED MODULE: ./node_modules/rc-upload/es/index.js
/* harmony default export */ var es = (es_Upload);
// EXTERNAL MODULE: ./node_modules/antd/node_modules/rc-util/es/hooks/useMergedState.js
var useMergedState = __webpack_require__(5663);
// EXTERNAL MODULE: ./node_modules/react-dom/index.js
var react_dom = __webpack_require__(73935);
// EXTERNAL MODULE: ./node_modules/antd/es/config-provider/context.js
var context = __webpack_require__(53124);
// EXTERNAL MODULE: ./node_modules/antd/es/config-provider/DisabledContext.js
var DisabledContext = __webpack_require__(98866);
// EXTERNAL MODULE: ./node_modules/antd/es/locale/useLocale.js
var useLocale = __webpack_require__(10110);
// EXTERNAL MODULE: ./node_modules/antd/es/locale/en_US.js + 1 modules
var en_US = __webpack_require__(24457);
;// CONCATENATED MODULE: ./node_modules/@ant-design/icons-svg/es/asn/FileTwoTone.js
// This icon file is generated automatically.
var FileTwoTone = { "icon": function render(primaryColor, secondaryColor) { return { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M534 352V136H232v752h560V394H576a42 42 0 01-42-42z", "fill": secondaryColor } }, { "tag": "path", "attrs": { "d": "M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM602 137.8L790.2 326H602V137.8zM792 888H232V136h302v216a42 42 0 0042 42h216v494z", "fill": primaryColor } }] }; }, "name": "file", "theme": "twotone" };
/* harmony default export */ var asn_FileTwoTone = (FileTwoTone);
// EXTERNAL MODULE: ./node_modules/@ant-design/icons/es/components/AntdIcon.js + 8 modules
var AntdIcon = __webpack_require__(74643);
;// CONCATENATED MODULE: ./node_modules/@ant-design/icons/es/icons/FileTwoTone.js
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
var FileTwoTone_FileTwoTone = function FileTwoTone(props, ref) {
return /*#__PURE__*/react.createElement(AntdIcon/* default */.Z, (0,esm_extends/* default */.Z)({}, props, {
ref: ref,
icon: asn_FileTwoTone
}));
};
if (false) {}
/* harmony default export */ var icons_FileTwoTone = (/*#__PURE__*/react.forwardRef(FileTwoTone_FileTwoTone));
// EXTERNAL MODULE: ./node_modules/@ant-design/icons/es/icons/LoadingOutlined.js + 1 modules
var LoadingOutlined = __webpack_require__(50888);
;// CONCATENATED MODULE: ./node_modules/@ant-design/icons-svg/es/asn/PaperClipOutlined.js
// This icon file is generated automatically.
var PaperClipOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M779.3 196.6c-94.2-94.2-247.6-94.2-341.7 0l-261 260.8c-1.7 1.7-2.6 4-2.6 6.4s.9 4.7 2.6 6.4l36.9 36.9a9 9 0 0012.7 0l261-260.8c32.4-32.4 75.5-50.2 121.3-50.2s88.9 17.8 121.2 50.2c32.4 32.4 50.2 75.5 50.2 121.2 0 45.8-17.8 88.8-50.2 121.2l-266 265.9-43.1 43.1c-40.3 40.3-105.8 40.3-146.1 0-19.5-19.5-30.2-45.4-30.2-73s10.7-53.5 30.2-73l263.9-263.8c6.7-6.6 15.5-10.3 24.9-10.3h.1c9.4 0 18.1 3.7 24.7 10.3 6.7 6.7 10.3 15.5 10.3 24.9 0 9.3-3.7 18.1-10.3 24.7L372.4 653c-1.7 1.7-2.6 4-2.6 6.4s.9 4.7 2.6 6.4l36.9 36.9a9 9 0 0012.7 0l215.6-215.6c19.9-19.9 30.8-46.3 30.8-74.4s-11-54.6-30.8-74.4c-41.1-41.1-107.9-41-149 0L463 364 224.8 602.1A172.22 172.22 0 00174 724.8c0 46.3 18.1 89.8 50.8 122.5 33.9 33.8 78.3 50.7 122.7 50.7 44.4 0 88.8-16.9 122.6-50.7l309.2-309C824.8 492.7 850 432 850 367.5c.1-64.6-25.1-125.3-70.7-170.9z" } }] }, "name": "paper-clip", "theme": "outlined" };
/* harmony default export */ var asn_PaperClipOutlined = (PaperClipOutlined);
;// CONCATENATED MODULE: ./node_modules/@ant-design/icons/es/icons/PaperClipOutlined.js
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
var PaperClipOutlined_PaperClipOutlined = function PaperClipOutlined(props, ref) {
return /*#__PURE__*/react.createElement(AntdIcon/* default */.Z, (0,esm_extends/* default */.Z)({}, props, {
ref: ref,
icon: asn_PaperClipOutlined
}));
};
if (false) {}
/* harmony default export */ var icons_PaperClipOutlined = (/*#__PURE__*/react.forwardRef(PaperClipOutlined_PaperClipOutlined));
;// CONCATENATED MODULE: ./node_modules/@ant-design/icons-svg/es/asn/PictureTwoTone.js
// This icon file is generated automatically.
var PictureTwoTone = { "icon": function render(primaryColor, secondaryColor) { return { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M928 160H96c-17.7 0-32 14.3-32 32v640c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V192c0-17.7-14.3-32-32-32zm-40 632H136v-39.9l138.5-164.3 150.1 178L658.1 489 888 761.6V792zm0-129.8L664.2 396.8c-3.2-3.8-9-3.8-12.2 0L424.6 666.4l-144-170.7c-3.2-3.8-9-3.8-12.2 0L136 652.7V232h752v430.2z", "fill": primaryColor } }, { "tag": "path", "attrs": { "d": "M424.6 765.8l-150.1-178L136 752.1V792h752v-30.4L658.1 489z", "fill": secondaryColor } }, { "tag": "path", "attrs": { "d": "M136 652.7l132.4-157c3.2-3.8 9-3.8 12.2 0l144 170.7L652 396.8c3.2-3.8 9-3.8 12.2 0L888 662.2V232H136v420.7zM304 280a88 88 0 110 176 88 88 0 010-176z", "fill": secondaryColor } }, { "tag": "path", "attrs": { "d": "M276 368a28 28 0 1056 0 28 28 0 10-56 0z", "fill": secondaryColor } }, { "tag": "path", "attrs": { "d": "M304 456a88 88 0 100-176 88 88 0 000 176zm0-116c15.5 0 28 12.5 28 28s-12.5 28-28 28-28-12.5-28-28 12.5-28 28-28z", "fill": primaryColor } }] }; }, "name": "picture", "theme": "twotone" };
/* harmony default export */ var asn_PictureTwoTone = (PictureTwoTone);
;// CONCATENATED MODULE: ./node_modules/@ant-design/icons/es/icons/PictureTwoTone.js
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
var PictureTwoTone_PictureTwoTone = function PictureTwoTone(props, ref) {
return /*#__PURE__*/react.createElement(AntdIcon/* default */.Z, (0,esm_extends/* default */.Z)({}, props, {
ref: ref,
icon: asn_PictureTwoTone
}));
};
if (false) {}
/* harmony default export */ var icons_PictureTwoTone = (/*#__PURE__*/react.forwardRef(PictureTwoTone_PictureTwoTone));
// EXTERNAL MODULE: ./node_modules/antd/node_modules/rc-motion/es/index.js + 18 modules
var rc_motion_es = __webpack_require__(38379);
// EXTERNAL MODULE: ./node_modules/antd/es/_util/hooks/useForceUpdate.js
var useForceUpdate = __webpack_require__(57838);
// EXTERNAL MODULE: ./node_modules/antd/es/_util/motion.js
var _util_motion = __webpack_require__(33603);
// EXTERNAL MODULE: ./node_modules/antd/es/_util/reactNode.js
var reactNode = __webpack_require__(96159);
// EXTERNAL MODULE: ./node_modules/antd/es/button/index.js
var es_button = __webpack_require__(71577);
;// CONCATENATED MODULE: ./node_modules/antd/es/upload/utils.js
function file2Obj(file) {
return Object.assign(Object.assign({}, file), {
lastModified: file.lastModified,
lastModifiedDate: file.lastModifiedDate,
name: file.name,
size: file.size,
type: file.type,
uid: file.uid,
percent: 0,
originFileObj: file
});
}
/** Upload fileList. Replace file if exist or just push into it. */
function updateFileList(file, fileList) {
const nextFileList = (0,toConsumableArray/* default */.Z)(fileList);
const fileIndex = nextFileList.findIndex(_ref => {
let {
uid
} = _ref;
return uid === file.uid;
});
if (fileIndex === -1) {
nextFileList.push(file);
} else {
nextFileList[fileIndex] = file;
}
return nextFileList;
}
function getFileItem(file, fileList) {
const matchKey = file.uid !== undefined ? 'uid' : 'name';
return fileList.filter(item => item[matchKey] === file[matchKey])[0];
}
function removeFileItem(file, fileList) {
const matchKey = file.uid !== undefined ? 'uid' : 'name';
const removed = fileList.filter(item => item[matchKey] !== file[matchKey]);
if (removed.length === fileList.length) {
return null;
}
return removed;
}
// ==================== Default Image Preview ====================
const extname = function () {
let url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
const temp = url.split('/');
const filename = temp[temp.length - 1];
const filenameWithoutSuffix = filename.split(/#|\?/)[0];
return (/\.[^./\\]*$/.exec(filenameWithoutSuffix) || [''])[0];
};
const isImageFileType = type => type.indexOf('image/') === 0;
const isImageUrl = file => {
if (file.type && !file.thumbUrl) {
return isImageFileType(file.type);
}
const url = file.thumbUrl || file.url || '';
const extension = extname(url);
if (/^data:image\//.test(url) || /(webp|svg|png|gif|jpg|jpeg|jfif|bmp|dpg|ico|heic|heif)$/i.test(extension)) {
return true;
}
if (/^data:/.test(url)) {
// other file types of base64
return false;
}
if (extension) {
// other file types which have extension
return false;
}
return true;
};
const MEASURE_SIZE = 200;
function previewImage(file) {
return new Promise(resolve => {
if (!file.type || !isImageFileType(file.type)) {
resolve('');
return;
}
const canvas = document.createElement('canvas');
canvas.width = MEASURE_SIZE;
canvas.height = MEASURE_SIZE;
canvas.style.cssText = `position: fixed; left: 0; top: 0; width: ${MEASURE_SIZE}px; height: ${MEASURE_SIZE}px; z-index: 9999; display: none;`;
document.body.appendChild(canvas);
const ctx = canvas.getContext('2d');
const img = new Image();
img.onload = () => {
const {
width,
height
} = img;
let drawWidth = MEASURE_SIZE;
let drawHeight = MEASURE_SIZE;
let offsetX = 0;
let offsetY = 0;
if (width > height) {
drawHeight = height * (MEASURE_SIZE / width);
offsetY = -(drawHeight - drawWidth) / 2;
} else {
drawWidth = width * (MEASURE_SIZE / height);
offsetX = -(drawWidth - drawHeight) / 2;
}
ctx.drawImage(img, offsetX, offsetY, drawWidth, drawHeight);
const dataURL = canvas.toDataURL();
document.body.removeChild(canvas);
resolve(dataURL);
};
img.crossOrigin = 'anonymous';
if (file.type.startsWith('image/svg+xml')) {
const reader = new FileReader();
reader.addEventListener('load', () => {
if (reader.result) img.src = reader.result;
});
reader.readAsDataURL(file);
} else {
img.src = window.URL.createObjectURL(file);
}
});
}
// EXTERNAL MODULE: ./node_modules/@ant-design/icons/es/icons/DeleteOutlined.js + 1 modules
var DeleteOutlined = __webpack_require__(48689);
// EXTERNAL MODULE: ./node_modules/@ant-design/icons/es/icons/DownloadOutlined.js + 1 modules
var DownloadOutlined = __webpack_require__(23430);
// EXTERNAL MODULE: ./node_modules/@ant-design/icons/es/icons/EyeOutlined.js + 1 modules
var EyeOutlined = __webpack_require__(99611);
// EXTERNAL MODULE: ./node_modules/antd/es/progress/index.js + 11 modules
var progress = __webpack_require__(69814);
// EXTERNAL MODULE: ./node_modules/antd/es/tooltip/index.js + 3 modules
var tooltip = __webpack_require__(83062);
;// CONCATENATED MODULE: ./node_modules/antd/es/upload/UploadList/ListItem.js
const ListItem = /*#__PURE__*/react.forwardRef((_ref, ref) => {
let {
prefixCls,
className,
style,
locale,
listType,
file,
items,
progress: progressProps,
iconRender,
actionIconRender,
itemRender,
isImgUrl,
showPreviewIcon,
showRemoveIcon,
showDownloadIcon,
previewIcon: customPreviewIcon,
removeIcon: customRemoveIcon,
downloadIcon: customDownloadIcon,
onPreview,
onDownload,
onClose
} = _ref;
var _a, _b;
// Status: which will ignore `removed` status
const {
status
} = file;
const [mergedStatus, setMergedStatus] = react.useState(status);
react.useEffect(() => {
if (status !== 'removed') {
setMergedStatus(status);
}
}, [status]);
// Delay to show the progress bar
const [showProgress, setShowProgress] = react.useState(false);
react.useEffect(() => {
const timer = setTimeout(() => {
setShowProgress(true);
}, 300);
return () => {
clearTimeout(timer);
};
}, []);
const iconNode = iconRender(file);
let icon = /*#__PURE__*/react.createElement("div", {
className: `${prefixCls}-icon`
}, iconNode);
if (listType === 'picture' || listType === 'picture-card' || listType === 'picture-circle') {
if (mergedStatus === 'uploading' || !file.thumbUrl && !file.url) {
const uploadingClassName = classnames_default()({
[`${prefixCls}-list-item-thumbnail`]: true,
[`${prefixCls}-list-item-file`]: mergedStatus !== 'uploading'
});
icon = /*#__PURE__*/react.createElement("div", {
className: uploadingClassName
}, iconNode);
} else {
const thumbnail = (isImgUrl === null || isImgUrl === void 0 ? void 0 : isImgUrl(file)) ? /*#__PURE__*/react.createElement("img", {
src: file.thumbUrl || file.url,
alt: file.name,
className: `${prefixCls}-list-item-image`,
crossOrigin: file.crossOrigin
}) : iconNode;
const aClassName = classnames_default()(`${prefixCls}-list-item-thumbnail`, {
[`${prefixCls}-list-item-file`]: isImgUrl && !isImgUrl(file)
});
icon = /*#__PURE__*/react.createElement("a", {
className: aClassName,
onClick: e => onPreview(file, e),
href: file.url || file.thumbUrl,
target: "_blank",
rel: "noopener noreferrer"
}, thumbnail);
}
}
const listItemClassName = classnames_default()(`${prefixCls}-list-item`, `${prefixCls}-list-item-${mergedStatus}`);
const linkProps = typeof file.linkProps === 'string' ? JSON.parse(file.linkProps) : file.linkProps;
const removeIcon = showRemoveIcon ? actionIconRender((typeof customRemoveIcon === 'function' ? customRemoveIcon(file) : customRemoveIcon) || /*#__PURE__*/react.createElement(DeleteOutlined/* default */.Z, null), () => onClose(file), prefixCls, locale.removeFile) : null;
const downloadIcon = showDownloadIcon && mergedStatus === 'done' ? actionIconRender((typeof customDownloadIcon === 'function' ? customDownloadIcon(file) : customDownloadIcon) || /*#__PURE__*/react.createElement(DownloadOutlined/* default */.Z, null), () => onDownload(file), prefixCls, locale.downloadFile) : null;
const downloadOrDelete = listType !== 'picture-card' && listType !== 'picture-circle' && /*#__PURE__*/react.createElement("span", {
key: "download-delete",
className: classnames_default()(`${prefixCls}-list-item-actions`, {
picture: listType === 'picture'
})
}, downloadIcon, removeIcon);
const listItemNameClass = classnames_default()(`${prefixCls}-list-item-name`);
const fileName = file.url ? [/*#__PURE__*/react.createElement("a", Object.assign({
key: "view",
target: "_blank",
rel: "noopener noreferrer",
className: listItemNameClass,
title: file.name
}, linkProps, {
href: file.url,
onClick: e => onPreview(file, e)
}), file.name), downloadOrDelete] : [/*#__PURE__*/react.createElement("span", {
key: "view",
className: listItemNameClass,
onClick: e => onPreview(file, e),
title: file.name
}, file.name), downloadOrDelete];
const previewStyle = {
pointerEvents: 'none',
opacity: 0.5
};
const previewIcon = showPreviewIcon ? /*#__PURE__*/react.createElement("a", {
href: file.url || file.thumbUrl,
target: "_blank",
rel: "noopener noreferrer",
style: file.url || file.thumbUrl ? undefined : previewStyle,
onClick: e => onPreview(file, e),
title: locale.previewFile
}, typeof customPreviewIcon === 'function' ? customPreviewIcon(file) : customPreviewIcon || /*#__PURE__*/react.createElement(EyeOutlined/* default */.Z, null)) : null;
const pictureCardActions = (listType === 'picture-card' || listType === 'picture-circle') && mergedStatus !== 'uploading' && /*#__PURE__*/react.createElement("span", {
className: `${prefixCls}-list-item-actions`
}, previewIcon, mergedStatus === 'done' && downloadIcon, removeIcon);
const {
getPrefixCls
} = react.useContext(context/* ConfigContext */.E_);
const rootPrefixCls = getPrefixCls();
const dom = /*#__PURE__*/react.createElement("div", {
className: listItemClassName
}, icon, fileName, pictureCardActions, showProgress && /*#__PURE__*/react.createElement(rc_motion_es["default"], {
motionName: `${rootPrefixCls}-fade`,
visible: mergedStatus === 'uploading',
motionDeadline: 2000
}, _ref2 => {
let {
className: motionClassName
} = _ref2;
// show loading icon if upload progress listener is disabled
const loadingProgress = 'percent' in file ? /*#__PURE__*/react.createElement(progress/* default */.Z, Object.assign({}, progressProps, {
type: "line",
percent: file.percent,
"aria-label": file['aria-label'],
"aria-labelledby": file['aria-labelledby']
})) : null;
return /*#__PURE__*/react.createElement("div", {
className: classnames_default()(`${prefixCls}-list-item-progress`, motionClassName)
}, loadingProgress);
}));
const message = file.response && typeof file.response === 'string' ? file.response : ((_a = file.error) === null || _a === void 0 ? void 0 : _a.statusText) || ((_b = file.error) === null || _b === void 0 ? void 0 : _b.message) || locale.uploadError;
const item = mergedStatus === 'error' ? /*#__PURE__*/react.createElement(tooltip/* default */.Z, {
title: message,
getPopupContainer: node => node.parentNode
}, dom) : dom;
return /*#__PURE__*/react.createElement("div", {
className: classnames_default()(`${prefixCls}-list-item-container`, className),
style: style,
ref: ref
}, itemRender ? itemRender(item, file, items, {
download: onDownload.bind(null, file),
preview: onPreview.bind(null, file),
remove: onClose.bind(null, file)
}) : item);
});
/* harmony default export */ var UploadList_ListItem = (ListItem);
;// CONCATENATED MODULE: ./node_modules/antd/es/upload/UploadList/index.js
const InternalUploadList = (props, ref) => {
const {
listType = 'text',
previewFile = previewImage,
onPreview,
onDownload,
onRemove,
locale,
iconRender,
isImageUrl: isImgUrl = isImageUrl,
prefixCls: customizePrefixCls,
items = [],
showPreviewIcon = true,
showRemoveIcon = true,
showDownloadIcon = false,
removeIcon,
previewIcon,
downloadIcon,
progress = {
size: [-1, 2],
showInfo: false
},
appendAction,
appendActionVisible = true,
itemRender,
disabled
} = props;
const forceUpdate = (0,useForceUpdate/* default */.Z)();
const [motionAppear, setMotionAppear] = react.useState(false);
// ============================= Effect =============================
react.useEffect(() => {
if (listType !== 'picture' && listType !== 'picture-card' && listType !== 'picture-circle') {
return;
}
(items || []).forEach(file => {
if (typeof document === 'undefined' || typeof window === 'undefined' || !window.FileReader || !window.File || !(file.originFileObj instanceof File || file.originFileObj instanceof Blob) || file.thumbUrl !== undefined) {
return;
}
file.thumbUrl = '';
if (previewFile) {
previewFile(file.originFileObj).then(previewDataUrl => {
// Need append '' to avoid dead loop
file.thumbUrl = previewDataUrl || '';
forceUpdate();
});
}
});
}, [listType, items, previewFile]);
react.useEffect(() => {
setMotionAppear(true);
}, []);
// ============================= Events =============================
const onInternalPreview = (file, e) => {
if (!onPreview) {
return;
}
e === null || e === void 0 ? void 0 : e.preventDefault();
return onPreview(file);
};
const onInternalDownload = file => {
if (typeof onDownload === 'function') {
onDownload(file);
} else if (file.url) {
window.open(file.url);
}
};
const onInternalClose = file => {
onRemove === null || onRemove === void 0 ? void 0 : onRemove(file);
};
const internalIconRender = file => {
if (iconRender) {
return iconRender(file, listType);
}
const isLoading = file.status === 'uploading';
const fileIcon = isImgUrl && isImgUrl(file) ? /*#__PURE__*/react.createElement(icons_PictureTwoTone, null) : /*#__PURE__*/react.createElement(icons_FileTwoTone, null);
let icon = isLoading ? /*#__PURE__*/react.createElement(LoadingOutlined/* default */.Z, null) : /*#__PURE__*/react.createElement(icons_PaperClipOutlined, null);
if (listType === 'picture') {
icon = isLoading ? /*#__PURE__*/react.createElement(LoadingOutlined/* default */.Z, null) : fileIcon;
} else if (listType === 'picture-card' || listType === 'picture-circle') {
icon = isLoading ? locale.uploading : fileIcon;
}
return icon;
};
const actionIconRender = (customIcon, callback, prefixCls, title) => {
const btnProps = {
type: 'text',
size: 'small',
title,
onClick: e => {
callback();
if ((0,reactNode/* isValidElement */.l$)(customIcon) && customIcon.props.onClick) {
customIcon.props.onClick(e);
}
},
className: `${prefixCls}-list-item-action`,
disabled
};
if ((0,reactNode/* isValidElement */.l$)(customIcon)) {
const btnIcon = (0,reactNode/* cloneElement */.Tm)(customIcon, Object.assign(Object.assign({}, customIcon.props), {
onClick: () => {}
}));
return /*#__PURE__*/react.createElement(es_button/* default */.ZP, Object.assign({}, btnProps, {
icon: btnIcon
}));
}
return /*#__PURE__*/react.createElement(es_button/* default */.ZP, Object.assign({}, btnProps), /*#__PURE__*/react.createElement("span", null, customIcon));
};
// ============================== Ref ===============================
// Test needs
react.useImperativeHandle(ref, () => ({
handlePreview: onInternalPreview,
handleDownload: onInternalDownload
}));
const {
getPrefixCls
} = react.useContext(context/* ConfigContext */.E_);
// ============================= Render =============================
const prefixCls = getPrefixCls('upload', customizePrefixCls);
const rootPrefixCls = getPrefixCls();
const listClassNames = classnames_default()(`${prefixCls}-list`, {
[`${prefixCls}-list-${listType}`]: true
});
// >>> Motion config
const motionKeyList = (0,toConsumableArray/* default */.Z)(items.map(file => ({
key: file.uid,
file
})));
const animationDirection = listType === 'picture-card' || listType === 'picture-circle' ? 'animate-inline' : 'animate';
// const transitionName = list.length === 0 ? '' : `${prefixCls}-${animationDirection}`;
let motionConfig = {
motionDeadline: 2000,
motionName: `${prefixCls}-${animationDirection}`,
keys: motionKeyList,
motionAppear
};
const listItemMotion = react.useMemo(() => {
const motion = Object.assign({}, (0,_util_motion/* default */.ZP)(rootPrefixCls));
delete motion.onAppearEnd;
delete motion.onEnterEnd;
delete motion.onLeaveEnd;
return motion;
}, [rootPrefixCls]);
if (listType !== 'picture-card' && listType !== 'picture-circle') {
motionConfig = Object.assign(Object.assign({}, listItemMotion), motionConfig);
}
return /*#__PURE__*/react.createElement("div", {
className: listClassNames
}, /*#__PURE__*/react.createElement(rc_motion_es.CSSMotionList, Object.assign({}, motionConfig, {
component: false
}), _ref => {
let {
key,
file,
className: motionClassName,
style: motionStyle
} = _ref;
return /*#__PURE__*/react.createElement(UploadList_ListItem, {
key: key,
locale: locale,
prefixCls: prefixCls,
className: motionClassName,
style: motionStyle,
file: file,
items: items,
progress: progress,
listType: listType,
isImgUrl: isImgUrl,
showPreviewIcon: showPreviewIcon,
showRemoveIcon: showRemoveIcon,
showDownloadIcon: showDownloadIcon,
removeIcon: removeIcon,
previewIcon: previewIcon,
downloadIcon: downloadIcon,
iconRender: internalIconRender,
actionIconRender: actionIconRender,
itemRender: itemRender,
onPreview: onInternalPreview,
onDownload: onInternalDownload,
onClose: onInternalClose
});
}), appendAction && /*#__PURE__*/react.createElement(rc_motion_es["default"], Object.assign({}, motionConfig, {
visible: appendActionVisible,
forceRender: true
}), _ref2 => {
let {
className: motionClassName,
style: motionStyle
} = _ref2;
return (0,reactNode/* cloneElement */.Tm)(appendAction, oriProps => ({
className: classnames_default()(oriProps.className, motionClassName),
style: Object.assign(Object.assign(Object.assign({}, motionStyle), {
// prevent the element has hover css pseudo-class that may cause animation to end prematurely.
pointerEvents: motionClassName ? 'none' : undefined
}), oriProps.style)
}));
}));
};
const UploadList = /*#__PURE__*/react.forwardRef(InternalUploadList);
if (false) {}
/* harmony default export */ var upload_UploadList = (UploadList);
// EXTERNAL MODULE: ./node_modules/antd/es/style/index.js
var style = __webpack_require__(14747);
// EXTERNAL MODULE: ./node_modules/antd/es/style/motion/collapse.js
var collapse = __webpack_require__(33507);
// EXTERNAL MODULE: ./node_modules/antd/es/theme/util/genComponentStyleHook.js
var genComponentStyleHook = __webpack_require__(67968);
// EXTERNAL MODULE: ./node_modules/antd/es/theme/util/statistic.js
var statistic = __webpack_require__(45503);
;// CONCATENATED MODULE: ./node_modules/antd/es/upload/style/dragger.js
const genDraggerStyle = token => {
const {
componentCls,
iconCls
} = token;
return {
[`${componentCls}-wrapper`]: {
[`${componentCls}-drag`]: {
position: 'relative',
width: '100%',
height: '100%',
textAlign: 'center',
background: token.colorFillAlter,
border: `${token.lineWidth}px dashed ${token.colorBorder}`,
borderRadius: token.borderRadiusLG,
cursor: 'pointer',
transition: `border-color ${token.motionDurationSlow}`,
[componentCls]: {
padding: `${token.padding}px 0`
},
[`${componentCls}-btn`]: {
display: 'table',
width: '100%',
height: '100%',
outline: 'none'
},
[`${componentCls}-drag-container`]: {
display: 'table-cell',
verticalAlign: 'middle'
},
[`&:not(${componentCls}-disabled):hover`]: {
borderColor: token.colorPrimaryHover
},
[`p${componentCls}-drag-icon`]: {
marginBottom: token.margin,
[iconCls]: {
color: token.colorPrimary,
fontSize: token.uploadThumbnailSize
}
},
[`p${componentCls}-text`]: {
margin: `0 0 ${token.marginXXS}px`,
color: token.colorTextHeading,
fontSize: token.fontSizeLG
},
[`p${componentCls}-hint`]: {
color: token.colorTextDescription,
fontSize: token.fontSize
},
// ===================== Disabled =====================
[`&${componentCls}-disabled`]: {
cursor: 'not-allowed',
[`p${componentCls}-drag-icon ${iconCls},
p${componentCls}-text,
p${componentCls}-hint
`]: {
color: token.colorTextDisabled
}
}
}
}
};
};
/* harmony default export */ var dragger = (genDraggerStyle);
;// CONCATENATED MODULE: ./node_modules/antd/es/upload/style/list.js
const genListStyle = token => {
const {
componentCls,
antCls,
iconCls,
fontSize,
lineHeight
} = token;
const itemCls = `${componentCls}-list-item`;
const actionsCls = `${itemCls}-actions`;
const actionCls = `${itemCls}-action`;
const listItemHeightSM = Math.round(fontSize * lineHeight);
return {
[`${componentCls}-wrapper`]: {
[`${componentCls}-list`]: Object.assign(Object.assign({}, (0,style/* clearFix */.dF)()), {
lineHeight: token.lineHeight,
[itemCls]: {
position: 'relative',
height: token.lineHeight * fontSize,
marginTop: token.marginXS,
fontSize,
display: 'flex',
alignItems: 'center',
transition: `background-color ${token.motionDurationSlow}`,
'&:hover': {
backgroundColor: token.controlItemBgHover
},
[`${itemCls}-name`]: Object.assign(Object.assign({}, style/* textEllipsis */.vS), {
padding: `0 ${token.paddingXS}px`,
lineHeight,
flex: 'auto',
transition: `all ${token.motionDurationSlow}`
}),
[actionsCls]: {
[actionCls]: {
opacity: 0
},
[`${actionCls}${antCls}-btn-sm`]: {
height: listItemHeightSM,
border: 0,
lineHeight: 1,
// FIXME: should not override small button
'> span': {
transform: 'scale(1)'
}
},
[`
${actionCls}:focus,
&.picture ${actionCls}
`]: {
opacity: 1
},
[iconCls]: {
color: token.actionsColor,
transition: `all ${token.motionDurationSlow}`
},
[`&:hover ${iconCls}`]: {
color: token.colorText
}
},
[`${componentCls}-icon ${iconCls}`]: {
color: token.colorTextDescription,
fontSize
},
[`${itemCls}-progress`]: {
position: 'absolute',
bottom: -token.uploadProgressOffset,
width: '100%',
paddingInlineStart: fontSize + token.paddingXS,
fontSize,
lineHeight: 0,
pointerEvents: 'none',
'> div': {
margin: 0
}
}
},
[`${itemCls}:hover ${actionCls}`]: {
opacity: 1,
color: token.colorText
},
[`${itemCls}-error`]: {
color: token.colorError,
[`${itemCls}-name, ${componentCls}-icon ${iconCls}`]: {
color: token.colorError
},
[actionsCls]: {
[`${iconCls}, ${iconCls}:hover`]: {
color: token.colorError
},
[actionCls]: {
opacity: 1
}
}
},
[`${componentCls}-list-item-container`]: {
transition: `opacity ${token.motionDurationSlow}, height ${token.motionDurationSlow}`,
// For smooth removing animation
'&::before': {
display: 'table',
width: 0,
height: 0,
content: '""'
}
}
})
}
};
};
/* harmony default export */ var list = (genListStyle);
// EXTERNAL MODULE: ./node_modules/antd/node_modules/@ant-design/cssinjs/es/index.js + 29 modules
var cssinjs_es = __webpack_require__(73559);
// EXTERNAL MODULE: ./node_modules/antd/es/style/motion/fade.js
var fade = __webpack_require__(16932);
;// CONCATENATED MODULE: ./node_modules/antd/es/upload/style/motion.js
const uploadAnimateInlineIn = new cssinjs_es.Keyframes('uploadAnimateInlineIn', {
from: {
width: 0,
height: 0,
margin: 0,
padding: 0,
opacity: 0
}
});
const uploadAnimateInlineOut = new cssinjs_es.Keyframes('uploadAnimateInlineOut', {
to: {
width: 0,
height: 0,
margin: 0,
padding: 0,
opacity: 0
}
});
// =========================== Motion ===========================
const genMotionStyle = token => {
const {
componentCls
} = token;
const inlineCls = `${componentCls}-animate-inline`;
return [{
[`${componentCls}-wrapper`]: {
[`${inlineCls}-appear, ${inlineCls}-enter, ${inlineCls}-leave`]: {
animationDuration: token.motionDurationSlow,
animationTimingFunction: token.motionEaseInOutCirc,
animationFillMode: 'forwards'
},
[`${inlineCls}-appear, ${inlineCls}-enter`]: {
animationName: uploadAnimateInlineIn
},
[`${inlineCls}-leave`]: {
animationName: uploadAnimateInlineOut
}
}
}, {
[`${componentCls}-wrapper`]: (0,fade/* initFadeMotion */.J$)(token)
}, uploadAnimateInlineIn, uploadAnimateInlineOut];
};
/* harmony default export */ var motion = (genMotionStyle);
// EXTERNAL MODULE: ./node_modules/@ant-design/colors/es/index.js + 1 modules
var colors_es = __webpack_require__(16397);
// EXTERNAL MODULE: ./node_modules/@ctrl/tinycolor/dist/module/index.js
var dist_module = __webpack_require__(10274);
;// CONCATENATED MODULE: ./node_modules/antd/es/upload/style/picture.js
const genPictureStyle = token => {
const {
componentCls,
iconCls,
uploadThumbnailSize,
uploadProgressOffset
} = token;
const listCls = `${componentCls}-list`;
const itemCls = `${listCls}-item`;
return {
[`${componentCls}-wrapper`]: {
// ${listCls} 增加优先级
[`
${listCls}${listCls}-picture,
${listCls}${listCls}-picture-card,
${listCls}${listCls}-picture-circle
`]: {
[itemCls]: {
position: 'relative',
height: uploadThumbnailSize + token.lineWidth * 2 + token.paddingXS * 2,
padding: token.paddingXS,
border: `${token.lineWidth}px ${token.lineType} ${token.colorBorder}`,
borderRadius: token.borderRadiusLG,
'&:hover': {
background: 'transparent'
},
[`${itemCls}-thumbnail`]: Object.assign(Object.assign({}, style/* textEllipsis */.vS), {
width: uploadThumbnailSize,
height: uploadThumbnailSize,
lineHeight: `${uploadThumbnailSize + token.paddingSM}px`,
textAlign: 'center',
flex: 'none',
[iconCls]: {
fontSize: token.fontSizeHeading2,
color: token.colorPrimary
},
img: {
display: 'block',
width: '100%',
height: '100%',
overflow: 'hidden'
}
}),
[`${itemCls}-progress`]: {
bottom: uploadProgressOffset,
width: `calc(100% - ${token.paddingSM * 2}px)`,
marginTop: 0,
paddingInlineStart: uploadThumbnailSize + token.paddingXS
}
},
[`${itemCls}-error`]: {
borderColor: token.colorError,
// Adjust the color of the error icon : https://github.com/ant-design/ant-design/pull/24160
[`${itemCls}-thumbnail ${iconCls}`]: {
[`svg path[fill='${colors_es.blue[0]}']`]: {
fill: token.colorErrorBg
},
[`svg path[fill='${colors_es.blue.primary}']`]: {
fill: token.colorError
}
}
},
[`${itemCls}-uploading`]: {
borderStyle: 'dashed',
[`${itemCls}-name`]: {
marginBottom: uploadProgressOffset
}
}
},
[`${listCls}${listCls}-picture-circle ${itemCls}`]: {
[`&, &::before, ${itemCls}-thumbnail`]: {
borderRadius: '50%'
}
}
}
};
};
const genPictureCardStyle = token => {
const {
componentCls,
iconCls,
fontSizeLG,
colorTextLightSolid
} = token;
const listCls = `${componentCls}-list`;
const itemCls = `${listCls}-item`;
const uploadPictureCardSize = token.uploadPicCardSize;
return {
[`
${componentCls}-wrapper${componentCls}-picture-card-wrapper,
${componentCls}-wrapper${componentCls}-picture-circle-wrapper
`]: Object.assign(Object.assign({}, (0,style/* clearFix */.dF)()), {
display: 'inline-block',
width: '100%',
[`${componentCls}${componentCls}-select`]: {
width: uploadPictureCardSize,
height: uploadPictureCardSize,
marginInlineEnd: token.marginXS,
marginBottom: token.marginXS,
textAlign: 'center',
verticalAlign: 'top',
backgroundColor: token.colorFillAlter,
border: `${token.lineWidth}px dashed ${token.colorBorder}`,
borderRadius: token.borderRadiusLG,
cursor: 'pointer',
transition: `border-color ${token.motionDurationSlow}`,
[`> ${componentCls}`]: {
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
height: '100%',
textAlign: 'center'
},
[`&:not(${componentCls}-disabled):hover`]: {
borderColor: token.colorPrimary
}
},
// list
[`${listCls}${listCls}-picture-card, ${listCls}${listCls}-picture-circle`]: {
[`${listCls}-item-container`]: {
display: 'inline-block',
width: uploadPictureCardSize,
height: uploadPictureCardSize,
marginBlock: `0 ${token.marginXS}px`,
marginInline: `0 ${token.marginXS}px`,
verticalAlign: 'top'
},
'&::after': {
display: 'none'
},
[itemCls]: {
height: '100%',
margin: 0,
'&::before': {
position: 'absolute',
zIndex: 1,
width: `calc(100% - ${token.paddingXS * 2}px)`,
height: `calc(100% - ${token.paddingXS * 2}px)`,
backgroundColor: token.colorBgMask,
opacity: 0,
transition: `all ${token.motionDurationSlow}`,
content: '" "'
}
},
[`${itemCls}:hover`]: {
[`&::before, ${itemCls}-actions`]: {
opacity: 1
}
},
[`${itemCls}-actions`]: {
position: 'absolute',
insetInlineStart: 0,
zIndex: 10,
width: '100%',
whiteSpace: 'nowrap',
textAlign: 'center',
opacity: 0,
transition: `all ${token.motionDurationSlow}`,
[`${iconCls}-eye, ${iconCls}-download, ${iconCls}-delete`]: {
zIndex: 10,
width: fontSizeLG,
margin: `0 ${token.marginXXS}px`,
fontSize: fontSizeLG,
cursor: 'pointer',
transition: `all ${token.motionDurationSlow}`,
svg: {
verticalAlign: 'baseline'
}
}
},
[`${itemCls}-actions, ${itemCls}-actions:hover`]: {
[`${iconCls}-eye, ${iconCls}-download, ${iconCls}-delete`]: {
color: new dist_module/* TinyColor */.C(colorTextLightSolid).setAlpha(0.65).toRgbString(),
'&:hover': {
color: colorTextLightSolid
}
}
},
[`${itemCls}-thumbnail, ${itemCls}-thumbnail img`]: {
position: 'static',
display: 'block',
width: '100%',
height: '100%',
objectFit: 'contain'
},
[`${itemCls}-name`]: {
display: 'none',
textAlign: 'center'
},
[`${itemCls}-file + ${itemCls}-name`]: {
position: 'absolute',
bottom: token.margin,
display: 'block',
width: `calc(100% - ${token.paddingXS * 2}px)`
},
[`${itemCls}-uploading`]: {
[`&${itemCls}`]: {
backgroundColor: token.colorFillAlter
},
[`&::before, ${iconCls}-eye, ${iconCls}-download, ${iconCls}-delete`]: {
display: 'none'
}
},
[`${itemCls}-progress`]: {
bottom: token.marginXL,
width: `calc(100% - ${token.paddingXS * 2}px)`,
paddingInlineStart: 0
}
}
}),
[`${componentCls}-wrapper${componentCls}-picture-circle-wrapper`]: {
[`${componentCls}${componentCls}-select`]: {
borderRadius: '50%'
}
}
};
};
;// CONCATENATED MODULE: ./node_modules/antd/es/upload/style/rtl.js
// =========================== Motion ===========================
const genRtlStyle = token => {
const {
componentCls
} = token;
return {
[`${componentCls}-rtl`]: {
direction: 'rtl'
}
};
};
/* harmony default export */ var rtl = (genRtlStyle);
;// CONCATENATED MODULE: ./node_modules/antd/es/upload/style/index.js
const genBaseStyle = token => {
const {
componentCls,
colorTextDisabled
} = token;
return {
[`${componentCls}-wrapper`]: Object.assign(Object.assign({}, (0,style/* resetComponent */.Wf)(token)), {
[componentCls]: {
outline: 0,
"input[type='file']": {
cursor: 'pointer'
}
},
[`${componentCls}-select`]: {
display: 'inline-block'
},
[`${componentCls}-disabled`]: {
color: colorTextDisabled,
cursor: 'not-allowed'
}
})
};
};
// ============================== Export ==============================
/* harmony default export */ var upload_style = ((0,genComponentStyleHook/* default */.Z)('Upload', token => {
const {
fontSizeHeading3,
fontSize,
lineHeight,
lineWidth,
controlHeightLG
} = token;
const listItemHeightSM = Math.round(fontSize * lineHeight);
const uploadToken = (0,statistic/* merge */.TS)(token, {
uploadThumbnailSize: fontSizeHeading3 * 2,
uploadProgressOffset: listItemHeightSM / 2 + lineWidth,
uploadPicCardSize: controlHeightLG * 2.55
});
return [genBaseStyle(uploadToken), dragger(uploadToken), genPictureStyle(uploadToken), genPictureCardStyle(uploadToken), list(uploadToken), motion(uploadToken), rtl(uploadToken), (0,collapse/* default */.Z)(uploadToken)];
}, token => ({
actionsColor: token.colorTextDescription
})));
;// CONCATENATED MODULE: ./node_modules/antd/es/upload/Upload.js
var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
function adopt(value) {
return value instanceof P ? value : new P(function (resolve) {
resolve(value);
});
}
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
}
function rejected(value) {
try {
step(generator["throw"](value));
} catch (e) {
reject(e);
}
}
function step(result) {
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
}
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
const LIST_IGNORE = `__LIST_IGNORE_${Date.now()}__`;
const InternalUpload = (props, ref) => {
const {
fileList,
defaultFileList,
onRemove,
showUploadList = true,
listType = 'text',
onPreview,
onDownload,
onChange,
onDrop,
previewFile,
disabled: customDisabled,
locale: propLocale,
iconRender,
isImageUrl,
progress,
prefixCls: customizePrefixCls,
className,
type = 'select',
children,
style,
itemRender,
maxCount,
data = {},
multiple = false,
action = '',
accept = '',
supportServerRender = true
} = props;
// ===================== Disabled =====================
const disabled = react.useContext(DisabledContext/* default */.Z);
const mergedDisabled = customDisabled !== null && customDisabled !== void 0 ? customDisabled : disabled;
const [mergedFileList, setMergedFileList] = (0,useMergedState/* default */.Z)(defaultFileList || [], {
value: fileList,
postState: list => list !== null && list !== void 0 ? list : []
});
const [dragState, setDragState] = react.useState('drop');
const upload = react.useRef(null);
false ? 0 : void 0;
false ? 0 : void 0;
// Control mode will auto fill file uid if not provided
react.useMemo(() => {
const timestamp = Date.now();
(fileList || []).forEach((file, index) => {
if (!file.uid && !Object.isFrozen(file)) {
file.uid = `__AUTO__${timestamp}_${index}__`;
}
});
}, [fileList]);
const onInternalChange = (file, changedFileList, event) => {
let cloneList = (0,toConsumableArray/* default */.Z)(changedFileList);
let exceedMaxCount = false;
// Cut to match count
if (maxCount === 1) {
cloneList = cloneList.slice(-1);
} else if (maxCount) {
exceedMaxCount = cloneList.length > maxCount;
cloneList = cloneList.slice(0, maxCount);
}
// Prevent React18 auto batch since input[upload] trigger process at same time
// which makes fileList closure problem
(0,react_dom.flushSync)(() => {
setMergedFileList(cloneList);
});
const changeInfo = {
file: file,
fileList: cloneList
};
if (event) {
changeInfo.event = event;
}
if (!exceedMaxCount ||
// We should ignore event if current file is exceed `maxCount`
cloneList.some(f => f.uid === file.uid)) {
(0,react_dom.flushSync)(() => {
onChange === null || onChange === void 0 ? void 0 : onChange(changeInfo);
});
}
};
const mergedBeforeUpload = (file, fileListArgs) => __awaiter(void 0, void 0, void 0, function* () {
const {
beforeUpload,
transformFile
} = props;
let parsedFile = file;
if (beforeUpload) {
const result = yield beforeUpload(file, fileListArgs);
if (result === false) {
return false;
}
// Hack for LIST_IGNORE, we add additional info to remove from the list
delete file[LIST_IGNORE];
if (result === LIST_IGNORE) {
Object.defineProperty(file, LIST_IGNORE, {
value: true,
configurable: true
});
return false;
}
if (typeof result === 'object' && result) {
parsedFile = result;
}
}
if (transformFile) {
parsedFile = yield transformFile(parsedFile);
}
return parsedFile;
});
const onBatchStart = batchFileInfoList => {
// Skip file which marked as `LIST_IGNORE`, these file will not add to file list
const filteredFileInfoList = batchFileInfoList.filter(info => !info.file[LIST_IGNORE]);
// Nothing to do since no file need upload
if (!filteredFileInfoList.length) {
return;
}
const objectFileList = filteredFileInfoList.map(info => file2Obj(info.file));
// Concat new files with prev files
let newFileList = (0,toConsumableArray/* default */.Z)(mergedFileList);
objectFileList.forEach(fileObj => {
// Replace file if exist
newFileList = updateFileList(fileObj, newFileList);
});
objectFileList.forEach((fileObj, index) => {
// Repeat trigger `onChange` event for compatible
let triggerFileObj = fileObj;
if (!filteredFileInfoList[index].parsedFile) {
// `beforeUpload` return false
const {
originFileObj
} = fileObj;
let clone;
try {
clone = new File([originFileObj], originFileObj.name, {
type: originFileObj.type
});
} catch (e) {
clone = new Blob([originFileObj], {
type: originFileObj.type
});
clone.name = originFileObj.name;
clone.lastModifiedDate = new Date();
clone.lastModified = new Date().getTime();
}
clone.uid = fileObj.uid;
triggerFileObj = clone;
} else {
// Inject `uploading` status
fileObj.status = 'uploading';
}
onInternalChange(triggerFileObj, newFileList);
});
};
const onSuccess = (response, file, xhr) => {
try {
if (typeof response === 'string') {
response = JSON.parse(response);
}
} catch (e) {
/* do nothing */
}
// removed
if (!getFileItem(file, mergedFileList)) {
return;
}
const targetItem = file2Obj(file);
targetItem.status = 'done';
targetItem.percent = 100;
targetItem.response = response;
targetItem.xhr = xhr;
const nextFileList = updateFileList(targetItem, mergedFileList);
onInternalChange(targetItem, nextFileList);
};
const onProgress = (e, file) => {
// removed
if (!getFileItem(file, mergedFileList)) {
return;
}
const targetItem = file2Obj(file);
targetItem.status = 'uploading';
targetItem.percent = e.percent;
const nextFileList = updateFileList(targetItem, mergedFileList);
onInternalChange(targetItem, nextFileList, e);
};
const onError = (error, response, file) => {
// removed
if (!getFileItem(file, mergedFileList)) {
return;
}
const targetItem = file2Obj(file);
targetItem.error = error;
targetItem.response = response;
targetItem.status = 'error';
const nextFileList = updateFileList(targetItem, mergedFileList);
onInternalChange(targetItem, nextFileList);
};
const handleRemove = file => {
let currentFile;
Promise.resolve(typeof onRemove === 'function' ? onRemove(file) : onRemove).then(ret => {
var _a;
// Prevent removing file
if (ret === false) {
return;
}
const removedFileList = removeFileItem(file, mergedFileList);
if (removedFileList) {
currentFile = Object.assign(Object.assign({}, file), {
status: 'removed'
});
mergedFileList === null || mergedFileList === void 0 ? void 0 : mergedFileList.forEach(item => {
const matchKey = currentFile.uid !== undefined ? 'uid' : 'name';
if (item[matchKey] === currentFile[matchKey] && !Object.isFrozen(item)) {
item.status = 'removed';
}
});
(_a = upload.current) === null || _a === void 0 ? void 0 : _a.abort(currentFile);
onInternalChange(currentFile, removedFileList);
}
});
};
const onFileDrop = e => {
setDragState(e.type);
if (e.type === 'drop') {
onDrop === null || onDrop === void 0 ? void 0 : onDrop(e);
}
};
// Test needs
react.useImperativeHandle(ref, () => ({
onBatchStart,
onSuccess,
onProgress,
onError,
fileList: mergedFileList,
upload: upload.current
}));
const {
getPrefixCls,
direction,
upload: ctxUpload
} = react.useContext(context/* ConfigContext */.E_);
const prefixCls = getPrefixCls('upload', customizePrefixCls);
const rcUploadProps = Object.assign(Object.assign({
onBatchStart,
onError,
onProgress,
onSuccess
}, props), {
data,
multiple,
action,
accept,
supportServerRender,
prefixCls,
disabled: mergedDisabled,
beforeUpload: mergedBeforeUpload,
onChange: undefined
});
delete rcUploadProps.className;
delete rcUploadProps.style;
// Remove id to avoid open by label when trigger is hidden
// !children: https://github.com/ant-design/ant-design/issues/14298
// disabled: https://github.com/ant-design/ant-design/issues/16478
// https://github.com/ant-design/ant-design/issues/24197
if (!children || mergedDisabled) {
delete rcUploadProps.id;
}
const [wrapSSR, hashId] = upload_style(prefixCls);
const [contextLocale] = (0,useLocale/* default */.Z)('Upload', en_US/* default.Upload */.Z.Upload);
const {
showRemoveIcon,
showPreviewIcon,
showDownloadIcon,
removeIcon,
previewIcon,
downloadIcon
} = typeof showUploadList === 'boolean' ? {} : showUploadList;
const renderUploadList = (button, buttonVisible) => {
if (!showUploadList) {
return button;
}
return /*#__PURE__*/react.createElement(upload_UploadList, {
prefixCls: prefixCls,
listType: listType,
items: mergedFileList,
previewFile: previewFile,
onPreview: onPreview,
onDownload: onDownload,
onRemove: handleRemove,
showRemoveIcon: !mergedDisabled && showRemoveIcon,
showPreviewIcon: showPreviewIcon,
showDownloadIcon: showDownloadIcon,
removeIcon: removeIcon,
previewIcon: previewIcon,
downloadIcon: downloadIcon,
iconRender: iconRender,
locale: Object.assign(Object.assign({}, contextLocale), propLocale),
isImageUrl: isImageUrl,
progress: progress,
appendAction: button,
appendActionVisible: buttonVisible,
itemRender: itemRender,
disabled: mergedDisabled
});
};
const wrapperCls = classnames_default()(`${prefixCls}-wrapper`, className, hashId, ctxUpload === null || ctxUpload === void 0 ? void 0 : ctxUpload.className, {
[`${prefixCls}-rtl`]: direction === 'rtl',
[`${prefixCls}-picture-card-wrapper`]: listType === 'picture-card',
[`${prefixCls}-picture-circle-wrapper`]: listType === 'picture-circle'
});
const mergedStyle = Object.assign(Object.assign({}, ctxUpload === null || ctxUpload === void 0 ? void 0 : ctxUpload.style), style);
if (type === 'drag') {
const dragCls = classnames_default()(hashId, prefixCls, `${prefixCls}-drag`, {
[`${prefixCls}-drag-uploading`]: mergedFileList.some(file => file.status === 'uploading'),
[`${prefixCls}-drag-hover`]: dragState === 'dragover',
[`${prefixCls}-disabled`]: mergedDisabled,
[`${prefixCls}-rtl`]: direction === 'rtl'
});
return wrapSSR( /*#__PURE__*/react.createElement("span", {
className: wrapperCls
}, /*#__PURE__*/react.createElement("div", {
className: dragCls,
style: mergedStyle,
onDrop: onFileDrop,
onDragOver: onFileDrop,
onDragLeave: onFileDrop
}, /*#__PURE__*/react.createElement(es, Object.assign({}, rcUploadProps, {
ref: upload,
className: `${prefixCls}-btn`
}), /*#__PURE__*/react.createElement("div", {
className: `${prefixCls}-drag-container`
}, children))), renderUploadList()));
}
const uploadButtonCls = classnames_default()(prefixCls, `${prefixCls}-select`, {
[`${prefixCls}-disabled`]: mergedDisabled
});
const renderUploadButton = uploadButtonStyle => /*#__PURE__*/react.createElement("div", {
className: uploadButtonCls,
style: uploadButtonStyle
}, /*#__PURE__*/react.createElement(es, Object.assign({}, rcUploadProps, {
ref: upload
})));
const uploadButton = renderUploadButton(children ? undefined : {
display: 'none'
});
if (listType === 'picture-card' || listType === 'picture-circle') {
return wrapSSR( /*#__PURE__*/react.createElement("span", {
className: wrapperCls
}, renderUploadList(uploadButton, !!children)));
}
return wrapSSR( /*#__PURE__*/react.createElement("span", {
className: wrapperCls
}, uploadButton, renderUploadList()));
};
const Upload_Upload = /*#__PURE__*/react.forwardRef(InternalUpload);
if (false) {}
/* harmony default export */ var upload_Upload = (Upload_Upload);
;// CONCATENATED MODULE: ./node_modules/antd/es/upload/Dragger.js
var __rest = undefined && undefined.__rest || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const Dragger = /*#__PURE__*/react.forwardRef((_a, ref) => {
var {
style,
height
} = _a,
restProps = __rest(_a, ["style", "height"]);
return /*#__PURE__*/react.createElement(upload_Upload, Object.assign({
ref: ref
}, restProps, {
type: "drag",
style: Object.assign(Object.assign({}, style), {
height
})
}));
});
if (false) {}
/* harmony default export */ var upload_Dragger = (Dragger);
;// CONCATENATED MODULE: ./node_modules/antd/es/upload/index.js
'use client';
const es_upload_Upload = upload_Upload;
es_upload_Upload.Dragger = upload_Dragger;
es_upload_Upload.LIST_IGNORE = LIST_IGNORE;
/* harmony default export */ var es_upload = (es_upload_Upload);
/***/ }),
/***/ 64217:
/*!**********************************************!*\
!*** ./node_modules/rc-util/es/pickAttrs.js ***!
\**********************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "Z": function() { return /* binding */ pickAttrs; }
/* harmony export */ });
/* harmony import */ var _babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectSpread2 */ 1413);
var attributes = "accept acceptCharset accessKey action allowFullScreen allowTransparency\n alt async autoComplete autoFocus autoPlay capture cellPadding cellSpacing challenge\n charSet checked classID className colSpan cols content contentEditable contextMenu\n controls coords crossOrigin data dateTime default defer dir disabled download draggable\n encType form formAction formEncType formMethod formNoValidate formTarget frameBorder\n headers height hidden high href hrefLang htmlFor httpEquiv icon id inputMode integrity\n is keyParams keyType kind label lang list loop low manifest marginHeight marginWidth max maxLength media\n mediaGroup method min minLength multiple muted name noValidate nonce open\n optimum pattern placeholder poster preload radioGroup readOnly rel required\n reversed role rowSpan rows sandbox scope scoped scrolling seamless selected\n shape size sizes span spellCheck src srcDoc srcLang srcSet start step style\n summary tabIndex target title type useMap value width wmode wrap";
var eventsName = "onCopy onCut onPaste onCompositionEnd onCompositionStart onCompositionUpdate onKeyDown\n onKeyPress onKeyUp onFocus onBlur onChange onInput onSubmit onClick onContextMenu onDoubleClick\n onDrag onDragEnd onDragEnter onDragExit onDragLeave onDragOver onDragStart onDrop onMouseDown\n onMouseEnter onMouseLeave onMouseMove onMouseOut onMouseOver onMouseUp onSelect onTouchCancel\n onTouchEnd onTouchMove onTouchStart onScroll onWheel onAbort onCanPlay onCanPlayThrough\n onDurationChange onEmptied onEncrypted onEnded onError onLoadedData onLoadedMetadata\n onLoadStart onPause onPlay onPlaying onProgress onRateChange onSeeked onSeeking onStalled onSuspend onTimeUpdate onVolumeChange onWaiting onLoad onError";
var propList = "".concat(attributes, " ").concat(eventsName).split(/[\s\n]+/);
/* eslint-enable max-len */
var ariaPrefix = 'aria-';
var dataPrefix = 'data-';
function match(key, prefix) {
return key.indexOf(prefix) === 0;
}
/**
* Picker props from exist props with filter
* @param props Passed props
* @param ariaOnly boolean | { aria?: boolean; data?: boolean; attr?: boolean; } filter config
*/
function pickAttrs(props) {
var ariaOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
var mergedConfig;
if (ariaOnly === false) {
mergedConfig = {
aria: true,
data: true,
attr: true
};
} else if (ariaOnly === true) {
mergedConfig = {
aria: true
};
} else {
mergedConfig = (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)({}, ariaOnly);
}
var attrs = {};
Object.keys(props).forEach(function (key) {
if (
// Aria
mergedConfig.aria && (key === 'role' || match(key, ariaPrefix)) ||
// Data
mergedConfig.data && match(key, dataPrefix) ||
// Attr
mergedConfig.attr && propList.includes(key)) {
attrs[key] = props[key];
}
});
return attrs;
}
/***/ })
}]);