first commit
This commit is contained in:
10
frontend/node_modules/antd/lib/upload/Dragger.d.ts
generated
vendored
Normal file
10
frontend/node_modules/antd/lib/upload/Dragger.d.ts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import * as React from 'react';
|
||||
import type { UploadProps } from './interface';
|
||||
import type { UploadRef } from './Upload';
|
||||
export type DraggerProps<T = any> = UploadProps<T> & {
|
||||
height?: number;
|
||||
};
|
||||
declare const Dragger: React.ForwardRefExoticComponent<UploadProps<any> & {
|
||||
height?: number;
|
||||
} & React.RefAttributes<UploadRef<any>>>;
|
||||
export default Dragger;
|
||||
42
frontend/node_modules/antd/lib/upload/Dragger.js
generated
vendored
Normal file
42
frontend/node_modules/antd/lib/upload/Dragger.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
"use strict";
|
||||
"use client";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
var _Upload = _interopRequireDefault(require("./Upload"));
|
||||
var __rest = void 0 && (void 0).__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((props, ref) => {
|
||||
const {
|
||||
style,
|
||||
height,
|
||||
hasControlInside = false,
|
||||
children
|
||||
} = props,
|
||||
restProps = __rest(props, ["style", "height", "hasControlInside", "children"]);
|
||||
const mergedStyle = Object.assign(Object.assign({}, style), {
|
||||
height
|
||||
});
|
||||
return /*#__PURE__*/React.createElement(_Upload.default, Object.assign({
|
||||
ref: ref,
|
||||
hasControlInside: hasControlInside
|
||||
}, restProps, {
|
||||
style: mergedStyle,
|
||||
type: "drag"
|
||||
}), children);
|
||||
});
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
Dragger.displayName = 'Dragger';
|
||||
}
|
||||
var _default = exports.default = Dragger;
|
||||
23
frontend/node_modules/antd/lib/upload/Upload.d.ts
generated
vendored
Normal file
23
frontend/node_modules/antd/lib/upload/Upload.d.ts
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
import * as React from 'react';
|
||||
import type { UploadProps as RcUploadProps } from 'rc-upload';
|
||||
import RcUpload from 'rc-upload';
|
||||
import type { RcFile, UploadFile, UploadProps } from './interface';
|
||||
export declare const LIST_IGNORE: string;
|
||||
export type { UploadProps };
|
||||
export interface UploadRef<T = any> {
|
||||
onBatchStart: RcUploadProps['onBatchStart'];
|
||||
onSuccess: (response: any, file: RcFile, xhr: any) => void;
|
||||
onProgress: (e: {
|
||||
percent: number;
|
||||
}, file: RcFile) => void;
|
||||
onError: (error: Error, response: any, file: RcFile) => void;
|
||||
fileList: UploadFile<T>[];
|
||||
upload: RcUpload | null;
|
||||
/**
|
||||
* Get native element for wrapping upload
|
||||
* @since 5.17.0
|
||||
*/
|
||||
nativeElement: HTMLSpanElement | null;
|
||||
}
|
||||
declare const Upload: React.ForwardRefExoticComponent<UploadProps<any> & React.RefAttributes<UploadRef<any>>>;
|
||||
export default Upload;
|
||||
431
frontend/node_modules/antd/lib/upload/Upload.js
generated
vendored
Normal file
431
frontend/node_modules/antd/lib/upload/Upload.js
generated
vendored
Normal file
@@ -0,0 +1,431 @@
|
||||
"use strict";
|
||||
"use client";
|
||||
|
||||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = exports.LIST_IGNORE = void 0;
|
||||
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
var _reactDom = require("react-dom");
|
||||
var _classnames = _interopRequireDefault(require("classnames"));
|
||||
var _rcUpload = _interopRequireDefault(require("rc-upload"));
|
||||
var _useMergedState = _interopRequireDefault(require("rc-util/lib/hooks/useMergedState"));
|
||||
var _warning = require("../_util/warning");
|
||||
var _configProvider = require("../config-provider");
|
||||
var _context = require("../config-provider/context");
|
||||
var _DisabledContext = _interopRequireDefault(require("../config-provider/DisabledContext"));
|
||||
var _locale = require("../locale");
|
||||
var _en_US = _interopRequireDefault(require("../locale/en_US"));
|
||||
var _style = _interopRequireDefault(require("./style"));
|
||||
var _UploadList = _interopRequireDefault(require("./UploadList"));
|
||||
var _utils = require("./utils");
|
||||
var __awaiter = void 0 && (void 0).__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 = exports.LIST_IGNORE = `__LIST_IGNORE_${Date.now()}__`;
|
||||
const InternalUpload = (props, ref) => {
|
||||
const config = (0, _context.useComponentConfig)('upload');
|
||||
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,
|
||||
hasControlInside = true,
|
||||
action = '',
|
||||
accept = '',
|
||||
supportServerRender = true,
|
||||
rootClassName
|
||||
} = props;
|
||||
// ===================== Disabled =====================
|
||||
const disabled = React.useContext(_DisabledContext.default);
|
||||
const mergedDisabled = customDisabled !== null && customDisabled !== void 0 ? customDisabled : disabled;
|
||||
const customRequest = props.customRequest || config.customRequest;
|
||||
const [mergedFileList, setMergedFileList] = (0, _useMergedState.default)(defaultFileList || [], {
|
||||
value: fileList,
|
||||
postState: list => list !== null && list !== void 0 ? list : []
|
||||
});
|
||||
const [dragState, setDragState] = React.useState('drop');
|
||||
const upload = React.useRef(null);
|
||||
const wrapRef = React.useRef(null);
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
const warning = (0, _warning.devUseWarning)('Upload');
|
||||
process.env.NODE_ENV !== "production" ? warning('fileList' in props || !('value' in props), 'usage', '`value` is not a valid prop, do you mean `fileList`?') : void 0;
|
||||
warning.deprecated(!('transformFile' in props), 'transformFile', 'beforeUpload');
|
||||
}
|
||||
// Control mode will auto fill file uid if not provided
|
||||
React.useMemo(() => {
|
||||
// eslint-disable-next-line react-hooks/purity
|
||||
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, _toConsumableArray2.default)(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
|
||||
// eslint-disable-next-line react-dom/no-flush-sync
|
||||
(0, _reactDom.flushSync)(() => {
|
||||
setMergedFileList(cloneList);
|
||||
});
|
||||
const changeInfo = {
|
||||
file: file,
|
||||
fileList: cloneList
|
||||
};
|
||||
if (event) {
|
||||
changeInfo.event = event;
|
||||
}
|
||||
if (!exceedMaxCount || file.status === 'removed' ||
|
||||
// We should ignore event if current file is exceed `maxCount`
|
||||
cloneList.some(f => f.uid === file.uid)) {
|
||||
// eslint-disable-next-line react-dom/no-flush-sync
|
||||
(0, _reactDom.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 => (0, _utils.file2Obj)(info.file));
|
||||
// Concat new files with prev files
|
||||
let newFileList = (0, _toConsumableArray2.default)(mergedFileList);
|
||||
objectFileList.forEach(fileObj => {
|
||||
// Replace file if exist
|
||||
newFileList = (0, _utils.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 (_a) {
|
||||
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 (_a) {
|
||||
/* do nothing */
|
||||
}
|
||||
// removed
|
||||
if (!(0, _utils.getFileItem)(file, mergedFileList)) {
|
||||
return;
|
||||
}
|
||||
const targetItem = (0, _utils.file2Obj)(file);
|
||||
targetItem.status = 'done';
|
||||
targetItem.percent = 100;
|
||||
targetItem.response = response;
|
||||
targetItem.xhr = xhr;
|
||||
const nextFileList = (0, _utils.updateFileList)(targetItem, mergedFileList);
|
||||
onInternalChange(targetItem, nextFileList);
|
||||
};
|
||||
const onProgress = (e, file) => {
|
||||
// removed
|
||||
if (!(0, _utils.getFileItem)(file, mergedFileList)) {
|
||||
return;
|
||||
}
|
||||
const targetItem = (0, _utils.file2Obj)(file);
|
||||
targetItem.status = 'uploading';
|
||||
targetItem.percent = e.percent;
|
||||
const nextFileList = (0, _utils.updateFileList)(targetItem, mergedFileList);
|
||||
onInternalChange(targetItem, nextFileList, e);
|
||||
};
|
||||
const onError = (error, response, file) => {
|
||||
// removed
|
||||
if (!(0, _utils.getFileItem)(file, mergedFileList)) {
|
||||
return;
|
||||
}
|
||||
const targetItem = (0, _utils.file2Obj)(file);
|
||||
targetItem.error = error;
|
||||
targetItem.response = response;
|
||||
targetItem.status = 'error';
|
||||
const nextFileList = (0, _utils.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 = (0, _utils.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,
|
||||
nativeElement: wrapRef.current
|
||||
}));
|
||||
const {
|
||||
getPrefixCls,
|
||||
direction,
|
||||
upload: ctxUpload
|
||||
} = React.useContext(_configProvider.ConfigContext);
|
||||
const prefixCls = getPrefixCls('upload', customizePrefixCls);
|
||||
const rcUploadProps = Object.assign(Object.assign({
|
||||
onBatchStart,
|
||||
onError,
|
||||
onProgress,
|
||||
onSuccess
|
||||
}, props), {
|
||||
customRequest,
|
||||
data,
|
||||
multiple,
|
||||
action,
|
||||
accept,
|
||||
supportServerRender,
|
||||
prefixCls,
|
||||
disabled: mergedDisabled,
|
||||
beforeUpload: mergedBeforeUpload,
|
||||
onChange: undefined,
|
||||
hasControlInside
|
||||
});
|
||||
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 wrapperCls = `${prefixCls}-wrapper`;
|
||||
const [wrapCSSVar, hashId, cssVarCls] = (0, _style.default)(prefixCls, wrapperCls);
|
||||
const [contextLocale] = (0, _locale.useLocale)('Upload', _en_US.default.Upload);
|
||||
const {
|
||||
showRemoveIcon,
|
||||
showPreviewIcon,
|
||||
showDownloadIcon,
|
||||
removeIcon,
|
||||
previewIcon,
|
||||
downloadIcon,
|
||||
extra
|
||||
} = typeof showUploadList === 'boolean' ? {} : showUploadList;
|
||||
// use showRemoveIcon if it is specified explicitly
|
||||
const realShowRemoveIcon = typeof showRemoveIcon === 'undefined' ? !mergedDisabled : showRemoveIcon;
|
||||
const renderUploadList = (button, buttonVisible) => {
|
||||
if (!showUploadList) {
|
||||
return button;
|
||||
}
|
||||
return /*#__PURE__*/React.createElement(_UploadList.default, {
|
||||
prefixCls: prefixCls,
|
||||
listType: listType,
|
||||
items: mergedFileList,
|
||||
previewFile: previewFile,
|
||||
onPreview: onPreview,
|
||||
onDownload: onDownload,
|
||||
onRemove: handleRemove,
|
||||
showRemoveIcon: realShowRemoveIcon,
|
||||
showPreviewIcon: showPreviewIcon,
|
||||
showDownloadIcon: showDownloadIcon,
|
||||
removeIcon: removeIcon,
|
||||
previewIcon: previewIcon,
|
||||
downloadIcon: downloadIcon,
|
||||
iconRender: iconRender,
|
||||
extra: extra,
|
||||
locale: Object.assign(Object.assign({}, contextLocale), propLocale),
|
||||
isImageUrl: isImageUrl,
|
||||
progress: progress,
|
||||
appendAction: button,
|
||||
appendActionVisible: buttonVisible,
|
||||
itemRender: itemRender,
|
||||
disabled: mergedDisabled
|
||||
});
|
||||
};
|
||||
const mergedCls = (0, _classnames.default)(wrapperCls, className, rootClassName, hashId, cssVarCls, 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);
|
||||
// ======================== Render ========================
|
||||
if (type === 'drag') {
|
||||
const dragCls = (0, _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 wrapCSSVar(/*#__PURE__*/React.createElement("span", {
|
||||
className: mergedCls,
|
||||
ref: wrapRef
|
||||
}, /*#__PURE__*/React.createElement("div", {
|
||||
className: dragCls,
|
||||
style: mergedStyle,
|
||||
onDrop: onFileDrop,
|
||||
onDragOver: onFileDrop,
|
||||
onDragLeave: onFileDrop
|
||||
}, /*#__PURE__*/React.createElement(_rcUpload.default, Object.assign({}, rcUploadProps, {
|
||||
ref: upload,
|
||||
className: `${prefixCls}-btn`
|
||||
}), /*#__PURE__*/React.createElement("div", {
|
||||
className: `${prefixCls}-drag-container`
|
||||
}, children))), renderUploadList()));
|
||||
}
|
||||
const uploadBtnCls = (0, _classnames.default)(prefixCls, `${prefixCls}-select`, {
|
||||
[`${prefixCls}-disabled`]: mergedDisabled,
|
||||
[`${prefixCls}-hidden`]: !children
|
||||
});
|
||||
const uploadButton = /*#__PURE__*/React.createElement("div", {
|
||||
className: uploadBtnCls,
|
||||
style: mergedStyle
|
||||
}, /*#__PURE__*/React.createElement(_rcUpload.default, Object.assign({}, rcUploadProps, {
|
||||
ref: upload
|
||||
})));
|
||||
if (listType === 'picture-card' || listType === 'picture-circle') {
|
||||
return wrapCSSVar(/*#__PURE__*/React.createElement("span", {
|
||||
className: mergedCls,
|
||||
ref: wrapRef
|
||||
}, renderUploadList(uploadButton, !!children)));
|
||||
}
|
||||
return wrapCSSVar(/*#__PURE__*/React.createElement("span", {
|
||||
className: mergedCls,
|
||||
ref: wrapRef
|
||||
}, uploadButton, renderUploadList()));
|
||||
};
|
||||
const Upload = /*#__PURE__*/React.forwardRef(InternalUpload);
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
Upload.displayName = 'Upload';
|
||||
}
|
||||
var _default = exports.default = Upload;
|
||||
28
frontend/node_modules/antd/lib/upload/UploadList/ListItem.d.ts
generated
vendored
Normal file
28
frontend/node_modules/antd/lib/upload/UploadList/ListItem.d.ts
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
import * as React from 'react';
|
||||
import type { ItemRender, UploadFile, UploadListProgressProps, UploadListType, UploadLocale } from '../interface';
|
||||
export interface ListItemProps {
|
||||
prefixCls: string;
|
||||
className?: string;
|
||||
style?: React.CSSProperties;
|
||||
locale: UploadLocale;
|
||||
file: UploadFile;
|
||||
items: UploadFile[];
|
||||
listType?: UploadListType;
|
||||
isImgUrl?: (file: UploadFile) => boolean;
|
||||
showRemoveIcon?: boolean | ((file: UploadFile) => boolean);
|
||||
showDownloadIcon?: boolean | ((file: UploadFile) => boolean);
|
||||
showPreviewIcon?: boolean | ((file: UploadFile) => boolean);
|
||||
removeIcon?: React.ReactNode | ((file: UploadFile) => React.ReactNode);
|
||||
downloadIcon?: React.ReactNode | ((file: UploadFile) => React.ReactNode);
|
||||
previewIcon?: React.ReactNode | ((file: UploadFile) => React.ReactNode);
|
||||
extra?: React.ReactNode | ((file: UploadFile) => React.ReactNode);
|
||||
iconRender: (file: UploadFile) => React.ReactNode;
|
||||
actionIconRender: (customIcon: React.ReactNode, callback: () => void, prefixCls: string, title?: string, acceptUploadDisabled?: boolean) => React.ReactNode;
|
||||
itemRender?: ItemRender;
|
||||
onPreview: (file: UploadFile, e: React.SyntheticEvent<HTMLElement>) => void;
|
||||
onClose: (file: UploadFile) => void;
|
||||
onDownload: (file: UploadFile) => void;
|
||||
progress?: UploadListProgressProps;
|
||||
}
|
||||
declare const ListItem: React.ForwardRefExoticComponent<ListItemProps & React.RefAttributes<HTMLDivElement>>;
|
||||
export default ListItem;
|
||||
177
frontend/node_modules/antd/lib/upload/UploadList/ListItem.js
generated
vendored
Normal file
177
frontend/node_modules/antd/lib/upload/UploadList/ListItem.js
generated
vendored
Normal file
@@ -0,0 +1,177 @@
|
||||
"use strict";
|
||||
"use client";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
var _DeleteOutlined = _interopRequireDefault(require("@ant-design/icons/DeleteOutlined"));
|
||||
var _DownloadOutlined = _interopRequireDefault(require("@ant-design/icons/DownloadOutlined"));
|
||||
var _EyeOutlined = _interopRequireDefault(require("@ant-design/icons/EyeOutlined"));
|
||||
var _classnames = _interopRequireDefault(require("classnames"));
|
||||
var _rcMotion = _interopRequireDefault(require("rc-motion"));
|
||||
var _configProvider = require("../../config-provider");
|
||||
var _progress = _interopRequireDefault(require("../../progress"));
|
||||
var _tooltip = _interopRequireDefault(require("../../tooltip"));
|
||||
const ListItem = /*#__PURE__*/React.forwardRef(({
|
||||
prefixCls,
|
||||
className,
|
||||
style,
|
||||
locale,
|
||||
listType,
|
||||
file,
|
||||
items,
|
||||
progress: progressProps,
|
||||
iconRender,
|
||||
actionIconRender,
|
||||
itemRender,
|
||||
isImgUrl,
|
||||
showPreviewIcon,
|
||||
showRemoveIcon,
|
||||
showDownloadIcon,
|
||||
previewIcon: customPreviewIcon,
|
||||
removeIcon: customRemoveIcon,
|
||||
downloadIcon: customDownloadIcon,
|
||||
extra: customExtra,
|
||||
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 = (0, _classnames.default)(`${prefixCls}-list-item-thumbnail`, {
|
||||
[`${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 = (0, _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 = (0, _classnames.default)(`${prefixCls}-list-item`, `${prefixCls}-list-item-${mergedStatus}`);
|
||||
const linkProps = typeof file.linkProps === 'string' ? JSON.parse(file.linkProps) : file.linkProps;
|
||||
const removeIcon = (typeof showRemoveIcon === 'function' ? showRemoveIcon(file) : showRemoveIcon) ? actionIconRender((typeof customRemoveIcon === 'function' ? customRemoveIcon(file) : customRemoveIcon) || (/*#__PURE__*/React.createElement(_DeleteOutlined.default, null)), () => onClose(file), prefixCls, locale.removeFile,
|
||||
// acceptUploadDisabled is true, only remove icon will follow Upload disabled prop
|
||||
// https://github.com/ant-design/ant-design/issues/46171
|
||||
true) : null;
|
||||
const downloadIcon = (typeof showDownloadIcon === 'function' ? showDownloadIcon(file) : showDownloadIcon) && mergedStatus === 'done' ? actionIconRender((typeof customDownloadIcon === 'function' ? customDownloadIcon(file) : customDownloadIcon) || /*#__PURE__*/React.createElement(_DownloadOutlined.default, null), () => onDownload(file), prefixCls, locale.downloadFile) : null;
|
||||
const downloadOrDelete = listType !== 'picture-card' && listType !== 'picture-circle' && (/*#__PURE__*/React.createElement("span", {
|
||||
key: "download-delete",
|
||||
className: (0, _classnames.default)(`${prefixCls}-list-item-actions`, {
|
||||
picture: listType === 'picture'
|
||||
})
|
||||
}, downloadIcon, removeIcon));
|
||||
const extraContent = typeof customExtra === 'function' ? customExtra(file) : customExtra;
|
||||
const extra = extraContent && (/*#__PURE__*/React.createElement("span", {
|
||||
className: `${prefixCls}-list-item-extra`
|
||||
}, extraContent));
|
||||
const listItemNameClass = (0, _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, extra)) : (/*#__PURE__*/React.createElement("span", {
|
||||
key: "view",
|
||||
className: listItemNameClass,
|
||||
onClick: e => onPreview(file, e),
|
||||
title: file.name
|
||||
}, file.name, extra));
|
||||
const previewIcon = (typeof showPreviewIcon === 'function' ? showPreviewIcon(file) : showPreviewIcon) && (file.url || file.thumbUrl) ? (/*#__PURE__*/React.createElement("a", {
|
||||
href: file.url || file.thumbUrl,
|
||||
target: "_blank",
|
||||
rel: "noopener noreferrer",
|
||||
onClick: e => onPreview(file, e),
|
||||
title: locale.previewFile
|
||||
}, typeof customPreviewIcon === 'function' ? customPreviewIcon(file) : customPreviewIcon || /*#__PURE__*/React.createElement(_EyeOutlined.default, 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(_configProvider.ConfigContext);
|
||||
const rootPrefixCls = getPrefixCls();
|
||||
const dom = /*#__PURE__*/React.createElement("div", {
|
||||
className: listItemClassName
|
||||
}, icon, fileName, downloadOrDelete, pictureCardActions, showProgress && (/*#__PURE__*/React.createElement(_rcMotion.default, {
|
||||
motionName: `${rootPrefixCls}-fade`,
|
||||
visible: mergedStatus === 'uploading',
|
||||
motionDeadline: 2000
|
||||
}, ({
|
||||
className: motionClassName
|
||||
}) => {
|
||||
// show loading icon if upload progress listener is disabled
|
||||
const loadingProgress = 'percent' in file ? (/*#__PURE__*/React.createElement(_progress.default, Object.assign({
|
||||
type: "line",
|
||||
percent: file.percent,
|
||||
"aria-label": file['aria-label'],
|
||||
"aria-labelledby": file['aria-labelledby']
|
||||
}, progressProps))) : null;
|
||||
return /*#__PURE__*/React.createElement("div", {
|
||||
className: (0, _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, {
|
||||
title: message,
|
||||
getPopupContainer: node => node.parentNode
|
||||
}, dom)) : dom;
|
||||
return /*#__PURE__*/React.createElement("div", {
|
||||
className: (0, _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);
|
||||
});
|
||||
var _default = exports.default = ListItem;
|
||||
8
frontend/node_modules/antd/lib/upload/UploadList/index.d.ts
generated
vendored
Normal file
8
frontend/node_modules/antd/lib/upload/UploadList/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import * as React from 'react';
|
||||
import type { UploadFile, UploadListProps } from '../interface';
|
||||
interface UploadListRef {
|
||||
handlePreview: (file: UploadFile, e: React.SyntheticEvent<HTMLElement>) => void;
|
||||
handleDownload: (file: UploadFile) => void;
|
||||
}
|
||||
declare const UploadList: React.ForwardRefExoticComponent<UploadListProps<any> & React.RefAttributes<UploadListRef>>;
|
||||
export default UploadList;
|
||||
202
frontend/node_modules/antd/lib/upload/UploadList/index.js
generated
vendored
Normal file
202
frontend/node_modules/antd/lib/upload/UploadList/index.js
generated
vendored
Normal file
@@ -0,0 +1,202 @@
|
||||
"use strict";
|
||||
"use client";
|
||||
|
||||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
var _FileTwoTone = _interopRequireDefault(require("@ant-design/icons/FileTwoTone"));
|
||||
var _LoadingOutlined = _interopRequireDefault(require("@ant-design/icons/LoadingOutlined"));
|
||||
var _PaperClipOutlined = _interopRequireDefault(require("@ant-design/icons/PaperClipOutlined"));
|
||||
var _PictureTwoTone = _interopRequireDefault(require("@ant-design/icons/PictureTwoTone"));
|
||||
var _classnames = _interopRequireDefault(require("classnames"));
|
||||
var _rcMotion = _interopRequireWildcard(require("rc-motion"));
|
||||
var _omit = _interopRequireDefault(require("rc-util/lib/omit"));
|
||||
var _hooks = require("../../_util/hooks");
|
||||
var _motion = _interopRequireDefault(require("../../_util/motion"));
|
||||
var _reactNode = require("../../_util/reactNode");
|
||||
var _button = _interopRequireDefault(require("../../button"));
|
||||
var _configProvider = require("../../config-provider");
|
||||
var _utils = require("../utils");
|
||||
var _ListItem = _interopRequireDefault(require("./ListItem"));
|
||||
const InternalUploadList = (props, ref) => {
|
||||
const {
|
||||
listType = 'text',
|
||||
previewFile = _utils.previewImage,
|
||||
onPreview,
|
||||
onDownload,
|
||||
onRemove,
|
||||
locale,
|
||||
iconRender,
|
||||
isImageUrl: isImgUrl = _utils.isImageUrl,
|
||||
prefixCls: customizePrefixCls,
|
||||
items = [],
|
||||
showPreviewIcon = true,
|
||||
showRemoveIcon = true,
|
||||
showDownloadIcon = false,
|
||||
removeIcon,
|
||||
previewIcon,
|
||||
downloadIcon,
|
||||
extra,
|
||||
progress = {
|
||||
size: [-1, 2],
|
||||
showInfo: false
|
||||
},
|
||||
appendAction,
|
||||
appendActionVisible = true,
|
||||
itemRender,
|
||||
disabled
|
||||
} = props;
|
||||
const [, forceUpdate] = (0, _hooks.useForceUpdate)();
|
||||
const [motionAppear, setMotionAppear] = React.useState(false);
|
||||
const isPictureCardOrCirle = ['picture-card', 'picture-circle'].includes(listType);
|
||||
// ============================= Effect =============================
|
||||
React.useEffect(() => {
|
||||
if (!listType.startsWith('picture')) {
|
||||
return;
|
||||
}
|
||||
(items || []).forEach(file => {
|
||||
if (!(file.originFileObj instanceof File || file.originFileObj instanceof Blob) || file.thumbUrl !== undefined) {
|
||||
return;
|
||||
}
|
||||
file.thumbUrl = '';
|
||||
previewFile === null || previewFile === void 0 ? void 0 : 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';
|
||||
if (listType.startsWith('picture')) {
|
||||
const loadingIcon = listType === 'picture' ? /*#__PURE__*/React.createElement(_LoadingOutlined.default, null) : locale.uploading;
|
||||
const fileIcon = (isImgUrl === null || isImgUrl === void 0 ? void 0 : isImgUrl(file)) ? /*#__PURE__*/React.createElement(_PictureTwoTone.default, null) : /*#__PURE__*/React.createElement(_FileTwoTone.default, null);
|
||||
return isLoading ? loadingIcon : fileIcon;
|
||||
}
|
||||
return isLoading ? /*#__PURE__*/React.createElement(_LoadingOutlined.default, null) : /*#__PURE__*/React.createElement(_PaperClipOutlined.default, null);
|
||||
};
|
||||
const actionIconRender = (customIcon, callback, prefixCls, title, acceptUploadDisabled) => {
|
||||
const btnProps = {
|
||||
type: 'text',
|
||||
size: 'small',
|
||||
title,
|
||||
onClick: e => {
|
||||
var _a, _b;
|
||||
callback();
|
||||
if (/*#__PURE__*/React.isValidElement(customIcon)) {
|
||||
(_b = (_a = customIcon.props).onClick) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
||||
}
|
||||
},
|
||||
className: `${prefixCls}-list-item-action`,
|
||||
disabled: acceptUploadDisabled ? disabled : false
|
||||
};
|
||||
return /*#__PURE__*/React.isValidElement(customIcon) ? (/*#__PURE__*/React.createElement(_button.default, Object.assign({}, btnProps, {
|
||||
icon: (0, _reactNode.cloneElement)(customIcon, Object.assign(Object.assign({}, customIcon.props), {
|
||||
onClick: () => {}
|
||||
}))
|
||||
}))) : (/*#__PURE__*/React.createElement(_button.default, Object.assign({}, btnProps), /*#__PURE__*/React.createElement("span", null, customIcon)));
|
||||
};
|
||||
// ============================== Ref ===============================
|
||||
// Test needs
|
||||
React.useImperativeHandle(ref, () => ({
|
||||
handlePreview: onInternalPreview,
|
||||
handleDownload: onInternalDownload
|
||||
}));
|
||||
const {
|
||||
getPrefixCls
|
||||
} = React.useContext(_configProvider.ConfigContext);
|
||||
// ============================= Render =============================
|
||||
const prefixCls = getPrefixCls('upload', customizePrefixCls);
|
||||
const rootPrefixCls = getPrefixCls();
|
||||
const listClassNames = (0, _classnames.default)(`${prefixCls}-list`, `${prefixCls}-list-${listType}`);
|
||||
const listItemMotion = React.useMemo(() => (0, _omit.default)((0, _motion.default)(rootPrefixCls), ['onAppearEnd', 'onEnterEnd', 'onLeaveEnd']), [rootPrefixCls]);
|
||||
const motionConfig = Object.assign(Object.assign({}, isPictureCardOrCirle ? {} : listItemMotion), {
|
||||
motionDeadline: 2000,
|
||||
motionName: `${prefixCls}-${isPictureCardOrCirle ? 'animate-inline' : 'animate'}`,
|
||||
keys: (0, _toConsumableArray2.default)(items.map(file => ({
|
||||
key: file.uid,
|
||||
file
|
||||
}))),
|
||||
motionAppear
|
||||
});
|
||||
return /*#__PURE__*/React.createElement("div", {
|
||||
className: listClassNames
|
||||
}, /*#__PURE__*/React.createElement(_rcMotion.CSSMotionList, Object.assign({}, motionConfig, {
|
||||
component: false
|
||||
}), ({
|
||||
key,
|
||||
file,
|
||||
className: motionClassName,
|
||||
style: motionStyle
|
||||
}) => (/*#__PURE__*/React.createElement(_ListItem.default, {
|
||||
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,
|
||||
extra: extra,
|
||||
iconRender: internalIconRender,
|
||||
actionIconRender: actionIconRender,
|
||||
itemRender: itemRender,
|
||||
onPreview: onInternalPreview,
|
||||
onDownload: onInternalDownload,
|
||||
onClose: onInternalClose
|
||||
}))), appendAction && (/*#__PURE__*/React.createElement(_rcMotion.default, Object.assign({}, motionConfig, {
|
||||
visible: appendActionVisible,
|
||||
forceRender: true
|
||||
}), ({
|
||||
className: motionClassName,
|
||||
style: motionStyle
|
||||
}) => (0, _reactNode.cloneElement)(appendAction, oriProps => ({
|
||||
className: (0, _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 (process.env.NODE_ENV !== 'production') {
|
||||
UploadList.displayName = 'UploadList';
|
||||
}
|
||||
var _default = exports.default = UploadList;
|
||||
13
frontend/node_modules/antd/lib/upload/index.d.ts
generated
vendored
Normal file
13
frontend/node_modules/antd/lib/upload/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
import Dragger from './Dragger';
|
||||
import type { UploadProps } from './Upload';
|
||||
import InternalUpload from './Upload';
|
||||
export type { DraggerProps } from './Dragger';
|
||||
export type { RcFile, UploadChangeParam, UploadFile, UploadListProps, UploadProps, } from './interface';
|
||||
type InternalUploadType = typeof InternalUpload;
|
||||
type CompoundedComponent<T = any> = InternalUploadType & {
|
||||
<U extends T>(props: React.PropsWithChildren<UploadProps<U>> & React.RefAttributes<any>): React.ReactElement;
|
||||
Dragger: typeof Dragger;
|
||||
LIST_IGNORE: string;
|
||||
};
|
||||
declare const Upload: CompoundedComponent;
|
||||
export default Upload;
|
||||
15
frontend/node_modules/antd/lib/upload/index.js
generated
vendored
Normal file
15
frontend/node_modules/antd/lib/upload/index.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
"use client";
|
||||
|
||||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var _Dragger = _interopRequireDefault(require("./Dragger"));
|
||||
var _Upload = _interopRequireWildcard(require("./Upload"));
|
||||
const Upload = _Upload.default;
|
||||
Upload.Dragger = _Dragger.default;
|
||||
Upload.LIST_IGNORE = _Upload.LIST_IGNORE;
|
||||
var _default = exports.default = Upload;
|
||||
143
frontend/node_modules/antd/lib/upload/interface.d.ts
generated
vendored
Normal file
143
frontend/node_modules/antd/lib/upload/interface.d.ts
generated
vendored
Normal file
@@ -0,0 +1,143 @@
|
||||
import type * as React from 'react';
|
||||
import type { RcFile as OriRcFile, UploadRequestOption as RcCustomRequestOptions, UploadProps as RcUploadProps } from 'rc-upload/lib/interface';
|
||||
import type { ProgressAriaProps, ProgressProps } from '../progress';
|
||||
export interface RcFile extends OriRcFile {
|
||||
readonly lastModifiedDate: Date;
|
||||
}
|
||||
export type UploadFileStatus = 'error' | 'done' | 'uploading' | 'removed';
|
||||
export interface HttpRequestHeader {
|
||||
[key: string]: string;
|
||||
}
|
||||
export interface UploadFile<T = any> extends ProgressAriaProps {
|
||||
uid: string;
|
||||
size?: number;
|
||||
name: string;
|
||||
fileName?: string;
|
||||
lastModified?: number;
|
||||
lastModifiedDate?: Date;
|
||||
url?: string;
|
||||
status?: UploadFileStatus;
|
||||
percent?: number;
|
||||
thumbUrl?: string;
|
||||
crossOrigin?: React.ImgHTMLAttributes<HTMLImageElement>['crossOrigin'];
|
||||
originFileObj?: RcFile;
|
||||
response?: T;
|
||||
error?: any;
|
||||
linkProps?: any;
|
||||
type?: string;
|
||||
xhr?: T;
|
||||
preview?: string;
|
||||
}
|
||||
export interface InternalUploadFile<T = any> extends UploadFile<T> {
|
||||
originFileObj: RcFile;
|
||||
}
|
||||
export interface UploadChangeParam<T = UploadFile> {
|
||||
file: T;
|
||||
fileList: T[];
|
||||
event?: {
|
||||
percent: number;
|
||||
};
|
||||
}
|
||||
export interface ShowUploadListInterface<T = any> {
|
||||
extra?: React.ReactNode | ((file: UploadFile<T>) => React.ReactNode);
|
||||
showRemoveIcon?: boolean | ((file: UploadFile<T>) => boolean);
|
||||
showPreviewIcon?: boolean | ((file: UploadFile<T>) => boolean);
|
||||
showDownloadIcon?: boolean | ((file: UploadFile<T>) => boolean);
|
||||
removeIcon?: React.ReactNode | ((file: UploadFile<T>) => React.ReactNode);
|
||||
downloadIcon?: React.ReactNode | ((file: UploadFile<T>) => React.ReactNode);
|
||||
previewIcon?: React.ReactNode | ((file: UploadFile<T>) => React.ReactNode);
|
||||
}
|
||||
export interface UploadLocale {
|
||||
uploading?: string;
|
||||
removeFile?: string;
|
||||
downloadFile?: string;
|
||||
uploadError?: string;
|
||||
previewFile?: string;
|
||||
}
|
||||
export type UploadType = 'drag' | 'select';
|
||||
export type UploadListType = 'text' | 'picture' | 'picture-card' | 'picture-circle';
|
||||
export type UploadListProgressProps = Omit<ProgressProps, 'percent' | 'type'>;
|
||||
export type ItemRender<T = any> = (originNode: React.ReactElement, file: UploadFile<T>, fileList: Array<UploadFile<T>>, actions: {
|
||||
download: () => void;
|
||||
preview: () => void;
|
||||
remove: () => void;
|
||||
}) => React.ReactNode;
|
||||
type PreviewFileHandler = (file: File | Blob) => PromiseLike<string>;
|
||||
type TransformFileHandler = (file: RcFile) => string | Blob | File | PromiseLike<string | Blob | File>;
|
||||
type BeforeUploadValueType = void | boolean | string | Blob | File;
|
||||
export interface UploadProps<T = any> extends Pick<RcUploadProps, 'capture' | 'hasControlInside' | 'pastable'> {
|
||||
type?: UploadType;
|
||||
name?: string;
|
||||
defaultFileList?: Array<UploadFile<T>>;
|
||||
fileList?: Array<UploadFile<T>>;
|
||||
action?: string | ((file: RcFile) => string) | ((file: RcFile) => PromiseLike<string>);
|
||||
directory?: boolean;
|
||||
data?: Record<string, unknown> | ((file: UploadFile<T>) => Record<string, unknown> | Promise<Record<string, unknown>>);
|
||||
method?: 'POST' | 'PUT' | 'PATCH' | 'post' | 'put' | 'patch';
|
||||
headers?: HttpRequestHeader;
|
||||
showUploadList?: boolean | ShowUploadListInterface<T>;
|
||||
multiple?: boolean;
|
||||
accept?: string;
|
||||
beforeUpload?: (file: RcFile, fileList: RcFile[]) => BeforeUploadValueType | Promise<BeforeUploadValueType>;
|
||||
onChange?: (info: UploadChangeParam<UploadFile<T>>) => void;
|
||||
onDrop?: (event: React.DragEvent<HTMLDivElement>) => void;
|
||||
listType?: UploadListType;
|
||||
className?: string;
|
||||
rootClassName?: string;
|
||||
onPreview?: (file: UploadFile<T>) => void;
|
||||
onDownload?: (file: UploadFile<T>) => void;
|
||||
onRemove?: (file: UploadFile<T>) => void | boolean | Promise<void | boolean>;
|
||||
supportServerRender?: boolean;
|
||||
style?: React.CSSProperties;
|
||||
disabled?: boolean;
|
||||
prefixCls?: string;
|
||||
customRequest?: (options: RcCustomRequestOptions<T>, info: {
|
||||
/**
|
||||
* @since 5.28.0
|
||||
*/
|
||||
defaultRequest: (option: RcCustomRequestOptions<T>) => void;
|
||||
}) => void;
|
||||
withCredentials?: boolean;
|
||||
openFileDialogOnClick?: boolean;
|
||||
locale?: UploadLocale;
|
||||
id?: string;
|
||||
previewFile?: PreviewFileHandler;
|
||||
/** @deprecated Please use `beforeUpload` directly */
|
||||
transformFile?: TransformFileHandler;
|
||||
iconRender?: (file: UploadFile<T>, listType?: UploadListType) => React.ReactNode;
|
||||
isImageUrl?: (file: UploadFile<T>) => boolean;
|
||||
progress?: UploadListProgressProps;
|
||||
itemRender?: ItemRender<T>;
|
||||
/** Config max count of `fileList`. Will replace current one when `maxCount` is 1 */
|
||||
maxCount?: number;
|
||||
children?: React.ReactNode;
|
||||
}
|
||||
export interface UploadState<T = any> {
|
||||
fileList: UploadFile<T>[];
|
||||
dragState: string;
|
||||
}
|
||||
export interface UploadListProps<T = any> {
|
||||
listType?: UploadListType;
|
||||
onPreview?: (file: UploadFile<T>) => void;
|
||||
onDownload?: (file: UploadFile<T>) => void;
|
||||
onRemove?: (file: UploadFile<T>) => void | boolean;
|
||||
items?: Array<UploadFile<T>>;
|
||||
progress?: UploadListProgressProps;
|
||||
prefixCls?: string;
|
||||
className?: string;
|
||||
showRemoveIcon?: boolean | ((file: UploadFile<T>) => boolean);
|
||||
showDownloadIcon?: boolean | ((file: UploadFile<T>) => boolean);
|
||||
showPreviewIcon?: boolean | ((file: UploadFile<T>) => boolean);
|
||||
removeIcon?: React.ReactNode | ((file: UploadFile<T>) => React.ReactNode);
|
||||
downloadIcon?: React.ReactNode | ((file: UploadFile<T>) => React.ReactNode);
|
||||
previewIcon?: React.ReactNode | ((file: UploadFile<T>) => React.ReactNode);
|
||||
extra?: React.ReactNode | ((file: UploadFile<T>) => React.ReactNode);
|
||||
locale: UploadLocale;
|
||||
previewFile?: PreviewFileHandler;
|
||||
iconRender?: (file: UploadFile<T>, listType?: UploadListType) => React.ReactNode;
|
||||
isImageUrl?: (file: UploadFile<T>) => boolean;
|
||||
appendAction?: React.ReactNode;
|
||||
appendActionVisible?: boolean;
|
||||
itemRender?: ItemRender<T>;
|
||||
}
|
||||
export {};
|
||||
5
frontend/node_modules/antd/lib/upload/interface.js
generated
vendored
Normal file
5
frontend/node_modules/antd/lib/upload/interface.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
4
frontend/node_modules/antd/lib/upload/style/dragger.d.ts
generated
vendored
Normal file
4
frontend/node_modules/antd/lib/upload/style/dragger.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import type { UploadToken } from '.';
|
||||
import type { GenerateStyle } from '../../theme/internal';
|
||||
declare const genDraggerStyle: GenerateStyle<UploadToken>;
|
||||
export default genDraggerStyle;
|
||||
77
frontend/node_modules/antd/lib/upload/style/dragger.js
generated
vendored
Normal file
77
frontend/node_modules/antd/lib/upload/style/dragger.js
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var _cssinjs = require("@ant-design/cssinjs");
|
||||
const genDraggerStyle = token => {
|
||||
const {
|
||||
componentCls,
|
||||
iconCls
|
||||
} = token;
|
||||
return {
|
||||
[`${componentCls}-wrapper`]: {
|
||||
[`${componentCls}-drag`]: {
|
||||
position: 'relative',
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
textAlign: 'center',
|
||||
background: token.colorFillAlter,
|
||||
border: `${(0, _cssinjs.unit)(token.lineWidth)} dashed ${token.colorBorder}`,
|
||||
borderRadius: token.borderRadiusLG,
|
||||
cursor: 'pointer',
|
||||
transition: `border-color ${token.motionDurationSlow}`,
|
||||
[componentCls]: {
|
||||
padding: token.padding
|
||||
},
|
||||
[`${componentCls}-btn`]: {
|
||||
display: 'table',
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
outline: 'none',
|
||||
borderRadius: token.borderRadiusLG,
|
||||
'&:focus-visible': {
|
||||
outline: `${(0, _cssinjs.unit)(token.lineWidthFocus)} solid ${token.colorPrimaryBorder}`
|
||||
}
|
||||
},
|
||||
[`${componentCls}-drag-container`]: {
|
||||
display: 'table-cell',
|
||||
verticalAlign: 'middle'
|
||||
},
|
||||
[`
|
||||
&:not(${componentCls}-disabled):hover,
|
||||
&-hover:not(${componentCls}-disabled)
|
||||
`]: {
|
||||
borderColor: token.colorPrimaryHover
|
||||
},
|
||||
[`p${componentCls}-drag-icon`]: {
|
||||
marginBottom: token.margin,
|
||||
[iconCls]: {
|
||||
color: token.colorPrimary,
|
||||
fontSize: token.uploadThumbnailSize
|
||||
}
|
||||
},
|
||||
[`p${componentCls}-text`]: {
|
||||
margin: `0 0 ${(0, _cssinjs.unit)(token.marginXXS)}`,
|
||||
color: token.colorTextHeading,
|
||||
fontSize: token.fontSizeLG
|
||||
},
|
||||
[`p${componentCls}-hint`]: {
|
||||
color: token.colorTextDescription,
|
||||
fontSize: token.fontSize
|
||||
},
|
||||
// ===================== Disabled =====================
|
||||
[`&${componentCls}-disabled`]: {
|
||||
[`p${componentCls}-drag-icon ${iconCls},
|
||||
p${componentCls}-text,
|
||||
p${componentCls}-hint
|
||||
`]: {
|
||||
color: token.colorTextDisabled
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
var _default = exports.default = genDraggerStyle;
|
||||
21
frontend/node_modules/antd/lib/upload/style/index.d.ts
generated
vendored
Normal file
21
frontend/node_modules/antd/lib/upload/style/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
import type { FullToken, GetDefaultToken } from '../../theme/internal';
|
||||
export interface ComponentToken {
|
||||
/**
|
||||
* @desc 操作按扭颜色
|
||||
* @descEN Action button color
|
||||
*/
|
||||
actionsColor: string;
|
||||
/**
|
||||
* @desc 卡片类型文件列表项的尺寸(对 picture-card 和 picture-circle 生效)
|
||||
* @descEN Size of list items in card type (affects both picture-card and picture-circle)
|
||||
*/
|
||||
pictureCardSize: number;
|
||||
}
|
||||
export interface UploadToken extends FullToken<'Upload'> {
|
||||
uploadThumbnailSize: number | string;
|
||||
uploadProgressOffset: number | string;
|
||||
uploadPicCardSize: number | string;
|
||||
}
|
||||
export declare const prepareComponentToken: GetDefaultToken<'Upload'>;
|
||||
declare const _default: (prefixCls: string, rootCls?: string) => readonly [(node: React.ReactElement) => React.ReactElement, string, string];
|
||||
export default _default;
|
||||
62
frontend/node_modules/antd/lib/upload/style/index.js
generated
vendored
Normal file
62
frontend/node_modules/antd/lib/upload/style/index.js
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.prepareComponentToken = exports.default = void 0;
|
||||
var _style = require("../../style");
|
||||
var _motion = require("../../style/motion");
|
||||
var _internal = require("../../theme/internal");
|
||||
var _dragger = _interopRequireDefault(require("./dragger"));
|
||||
var _list = _interopRequireDefault(require("./list"));
|
||||
var _motion2 = _interopRequireDefault(require("./motion"));
|
||||
var _picture = require("./picture");
|
||||
var _rtl = _interopRequireDefault(require("./rtl"));
|
||||
const genBaseStyle = token => {
|
||||
const {
|
||||
componentCls,
|
||||
colorTextDisabled
|
||||
} = token;
|
||||
return {
|
||||
[`${componentCls}-wrapper`]: Object.assign(Object.assign({}, (0, _style.resetComponent)(token)), {
|
||||
[componentCls]: {
|
||||
outline: 0,
|
||||
"input[type='file']": {
|
||||
cursor: 'pointer'
|
||||
}
|
||||
},
|
||||
[`${componentCls}-select`]: {
|
||||
display: 'inline-block'
|
||||
},
|
||||
[`${componentCls}-hidden`]: {
|
||||
display: 'none'
|
||||
},
|
||||
[`${componentCls}-disabled`]: {
|
||||
color: colorTextDisabled,
|
||||
cursor: 'not-allowed'
|
||||
}
|
||||
})
|
||||
};
|
||||
};
|
||||
const prepareComponentToken = token => ({
|
||||
actionsColor: token.colorIcon,
|
||||
pictureCardSize: token.controlHeightLG * 2.55
|
||||
});
|
||||
// ============================== Export ==============================
|
||||
exports.prepareComponentToken = prepareComponentToken;
|
||||
var _default = exports.default = (0, _internal.genStyleHooks)('Upload', token => {
|
||||
const {
|
||||
fontSizeHeading3,
|
||||
fontHeight,
|
||||
lineWidth,
|
||||
pictureCardSize,
|
||||
calc
|
||||
} = token;
|
||||
const uploadToken = (0, _internal.mergeToken)(token, {
|
||||
uploadThumbnailSize: calc(fontSizeHeading3).mul(2).equal(),
|
||||
uploadProgressOffset: calc(calc(fontHeight).div(2)).add(lineWidth).equal(),
|
||||
uploadPicCardSize: pictureCardSize
|
||||
});
|
||||
return [genBaseStyle(uploadToken), (0, _dragger.default)(uploadToken), (0, _picture.genPictureStyle)(uploadToken), (0, _picture.genPictureCardStyle)(uploadToken), (0, _list.default)(uploadToken), (0, _motion2.default)(uploadToken), (0, _rtl.default)(uploadToken), (0, _motion.genCollapseMotion)(uploadToken)];
|
||||
}, prepareComponentToken);
|
||||
4
frontend/node_modules/antd/lib/upload/style/list.d.ts
generated
vendored
Normal file
4
frontend/node_modules/antd/lib/upload/style/list.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import type { UploadToken } from '.';
|
||||
import type { GenerateStyle } from '../../theme/internal';
|
||||
declare const genListStyle: GenerateStyle<UploadToken>;
|
||||
export default genListStyle;
|
||||
106
frontend/node_modules/antd/lib/upload/style/list.js
generated
vendored
Normal file
106
frontend/node_modules/antd/lib/upload/style/list.js
generated
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var _cssinjs = require("@ant-design/cssinjs");
|
||||
var _style = require("../../style");
|
||||
const genListStyle = token => {
|
||||
const {
|
||||
componentCls,
|
||||
iconCls,
|
||||
fontSize,
|
||||
lineHeight,
|
||||
calc
|
||||
} = token;
|
||||
const itemCls = `${componentCls}-list-item`;
|
||||
const actionsCls = `${itemCls}-actions`;
|
||||
const actionCls = `${itemCls}-action`;
|
||||
return {
|
||||
[`${componentCls}-wrapper`]: {
|
||||
[`${componentCls}-list`]: Object.assign(Object.assign({}, (0, _style.clearFix)()), {
|
||||
lineHeight: token.lineHeight,
|
||||
[itemCls]: {
|
||||
position: 'relative',
|
||||
height: calc(token.lineHeight).mul(fontSize).equal(),
|
||||
marginTop: token.marginXS,
|
||||
fontSize,
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
transition: `background-color ${token.motionDurationSlow}`,
|
||||
borderRadius: token.borderRadiusSM,
|
||||
'&:hover': {
|
||||
backgroundColor: token.controlItemBgHover
|
||||
},
|
||||
[`${itemCls}-name`]: Object.assign(Object.assign({}, _style.textEllipsis), {
|
||||
padding: `0 ${(0, _cssinjs.unit)(token.paddingXS)}`,
|
||||
lineHeight,
|
||||
flex: 'auto',
|
||||
transition: `all ${token.motionDurationSlow}`
|
||||
}),
|
||||
[actionsCls]: {
|
||||
whiteSpace: 'nowrap',
|
||||
[actionCls]: {
|
||||
opacity: 0
|
||||
},
|
||||
[iconCls]: {
|
||||
color: token.actionsColor,
|
||||
transition: `all ${token.motionDurationSlow}`
|
||||
},
|
||||
[`
|
||||
${actionCls}:focus-visible,
|
||||
&.picture ${actionCls}
|
||||
`]: {
|
||||
opacity: 1
|
||||
}
|
||||
},
|
||||
[`${componentCls}-icon ${iconCls}`]: {
|
||||
color: token.colorIcon,
|
||||
fontSize
|
||||
},
|
||||
[`${itemCls}-progress`]: {
|
||||
position: 'absolute',
|
||||
bottom: token.calc(token.uploadProgressOffset).mul(-1).equal(),
|
||||
width: '100%',
|
||||
paddingInlineStart: calc(fontSize).add(token.paddingXS).equal(),
|
||||
fontSize,
|
||||
lineHeight: 0,
|
||||
pointerEvents: 'none',
|
||||
'> div': {
|
||||
margin: 0
|
||||
}
|
||||
}
|
||||
},
|
||||
[`${itemCls}:hover ${actionCls}`]: {
|
||||
opacity: 1
|
||||
},
|
||||
[`${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: '""'
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
};
|
||||
};
|
||||
var _default = exports.default = genListStyle;
|
||||
4
frontend/node_modules/antd/lib/upload/style/motion.d.ts
generated
vendored
Normal file
4
frontend/node_modules/antd/lib/upload/style/motion.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import type { UploadToken } from '.';
|
||||
import type { GenerateStyle } from '../../theme/internal';
|
||||
declare const genMotionStyle: GenerateStyle<UploadToken>;
|
||||
export default genMotionStyle;
|
||||
51
frontend/node_modules/antd/lib/upload/style/motion.js
generated
vendored
Normal file
51
frontend/node_modules/antd/lib/upload/style/motion.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var _cssinjs = require("@ant-design/cssinjs");
|
||||
var _motion = require("../../style/motion");
|
||||
// =========================== Motion ===========================
|
||||
const genMotionStyle = token => {
|
||||
const {
|
||||
componentCls
|
||||
} = token;
|
||||
const uploadAnimateInlineIn = new _cssinjs.Keyframes('uploadAnimateInlineIn', {
|
||||
from: {
|
||||
width: 0,
|
||||
height: 0,
|
||||
padding: 0,
|
||||
opacity: 0,
|
||||
margin: token.calc(token.marginXS).div(-2).equal()
|
||||
}
|
||||
});
|
||||
const uploadAnimateInlineOut = new _cssinjs.Keyframes('uploadAnimateInlineOut', {
|
||||
to: {
|
||||
width: 0,
|
||||
height: 0,
|
||||
padding: 0,
|
||||
opacity: 0,
|
||||
margin: token.calc(token.marginXS).div(-2).equal()
|
||||
}
|
||||
});
|
||||
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, _motion.initFadeMotion)(token)
|
||||
}, uploadAnimateInlineIn, uploadAnimateInlineOut];
|
||||
};
|
||||
var _default = exports.default = genMotionStyle;
|
||||
5
frontend/node_modules/antd/lib/upload/style/picture.d.ts
generated
vendored
Normal file
5
frontend/node_modules/antd/lib/upload/style/picture.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import type { UploadToken } from '.';
|
||||
import type { GenerateStyle } from '../../theme/internal';
|
||||
declare const genPictureStyle: GenerateStyle<UploadToken>;
|
||||
declare const genPictureCardStyle: GenerateStyle<UploadToken>;
|
||||
export { genPictureStyle, genPictureCardStyle };
|
||||
239
frontend/node_modules/antd/lib/upload/style/picture.js
generated
vendored
Normal file
239
frontend/node_modules/antd/lib/upload/style/picture.js
generated
vendored
Normal file
@@ -0,0 +1,239 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.genPictureStyle = exports.genPictureCardStyle = void 0;
|
||||
var _colors = require("@ant-design/colors");
|
||||
var _cssinjs = require("@ant-design/cssinjs");
|
||||
var _style = require("../../style");
|
||||
const genPictureStyle = token => {
|
||||
const {
|
||||
componentCls,
|
||||
iconCls,
|
||||
uploadThumbnailSize,
|
||||
uploadProgressOffset,
|
||||
calc
|
||||
} = 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: calc(uploadThumbnailSize).add(calc(token.lineWidth).mul(2)).add(calc(token.paddingXS).mul(2)).equal(),
|
||||
padding: token.paddingXS,
|
||||
border: `${(0, _cssinjs.unit)(token.lineWidth)} ${token.lineType} ${token.colorBorder}`,
|
||||
borderRadius: token.borderRadiusLG,
|
||||
'&:hover': {
|
||||
background: 'transparent'
|
||||
},
|
||||
[`${itemCls}-thumbnail`]: Object.assign(Object.assign({}, _style.textEllipsis), {
|
||||
width: uploadThumbnailSize,
|
||||
height: uploadThumbnailSize,
|
||||
lineHeight: (0, _cssinjs.unit)(calc(uploadThumbnailSize).add(token.paddingSM).equal()),
|
||||
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% - ${(0, _cssinjs.unit)(calc(token.paddingSM).mul(2).equal())})`,
|
||||
marginTop: 0,
|
||||
paddingInlineStart: calc(uploadThumbnailSize).add(token.paddingXS).equal()
|
||||
}
|
||||
},
|
||||
[`${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.blue[0]}']`]: {
|
||||
fill: token.colorErrorBg
|
||||
},
|
||||
[`svg path[fill='${_colors.blue.primary}']`]: {
|
||||
fill: token.colorError
|
||||
}
|
||||
}
|
||||
},
|
||||
[`${itemCls}-uploading`]: {
|
||||
borderStyle: 'dashed',
|
||||
[`${itemCls}-name`]: {
|
||||
marginBottom: uploadProgressOffset
|
||||
}
|
||||
}
|
||||
},
|
||||
[`${listCls}${listCls}-picture-circle ${itemCls}`]: {
|
||||
[`&, &::before, ${itemCls}-thumbnail`]: {
|
||||
borderRadius: '50%'
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
exports.genPictureStyle = genPictureStyle;
|
||||
const genPictureCardStyle = token => {
|
||||
const {
|
||||
componentCls,
|
||||
iconCls,
|
||||
fontSizeLG,
|
||||
colorTextLightSolid,
|
||||
calc
|
||||
} = 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)()), {
|
||||
display: 'block',
|
||||
[`${componentCls}${componentCls}-select`]: {
|
||||
width: uploadPictureCardSize,
|
||||
height: uploadPictureCardSize,
|
||||
textAlign: 'center',
|
||||
verticalAlign: 'top',
|
||||
backgroundColor: token.colorFillAlter,
|
||||
border: `${(0, _cssinjs.unit)(token.lineWidth)} 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`]: {
|
||||
display: 'flex',
|
||||
flexWrap: 'wrap',
|
||||
'@supports not (gap: 1px)': {
|
||||
'& > *': {
|
||||
marginBlockEnd: token.marginXS,
|
||||
marginInlineEnd: token.marginXS
|
||||
}
|
||||
},
|
||||
'@supports (gap: 1px)': {
|
||||
gap: token.marginXS
|
||||
},
|
||||
[`${listCls}-item-container`]: {
|
||||
display: 'inline-block',
|
||||
width: uploadPictureCardSize,
|
||||
height: uploadPictureCardSize,
|
||||
verticalAlign: 'top'
|
||||
},
|
||||
'&::after': {
|
||||
display: 'none'
|
||||
},
|
||||
'&::before': {
|
||||
display: 'none'
|
||||
},
|
||||
[itemCls]: {
|
||||
height: '100%',
|
||||
margin: 0,
|
||||
'&::before': {
|
||||
position: 'absolute',
|
||||
zIndex: 1,
|
||||
width: `calc(100% - ${(0, _cssinjs.unit)(calc(token.paddingXS).mul(2).equal())})`,
|
||||
height: `calc(100% - ${(0, _cssinjs.unit)(calc(token.paddingXS).mul(2).equal())})`,
|
||||
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 ${(0, _cssinjs.unit)(token.marginXXS)}`,
|
||||
fontSize: fontSizeLG,
|
||||
cursor: 'pointer',
|
||||
transition: `all ${token.motionDurationSlow}`,
|
||||
color: colorTextLightSolid,
|
||||
'&:hover': {
|
||||
color: colorTextLightSolid
|
||||
},
|
||||
svg: {
|
||||
verticalAlign: 'baseline'
|
||||
}
|
||||
}
|
||||
},
|
||||
[`${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% - ${(0, _cssinjs.unit)(calc(token.paddingXS).mul(2).equal())})`
|
||||
},
|
||||
[`${itemCls}-uploading`]: {
|
||||
[`&${itemCls}`]: {
|
||||
backgroundColor: token.colorFillAlter
|
||||
},
|
||||
[`&::before, ${iconCls}-eye, ${iconCls}-download, ${iconCls}-delete`]: {
|
||||
display: 'none'
|
||||
}
|
||||
},
|
||||
[`${itemCls}-progress`]: {
|
||||
bottom: token.marginXL,
|
||||
width: `calc(100% - ${(0, _cssinjs.unit)(calc(token.paddingXS).mul(2).equal())})`,
|
||||
paddingInlineStart: 0
|
||||
}
|
||||
}
|
||||
}),
|
||||
[`${componentCls}-wrapper${componentCls}-picture-circle-wrapper`]: {
|
||||
[`${componentCls}${componentCls}-select`]: {
|
||||
borderRadius: '50%'
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
exports.genPictureCardStyle = genPictureCardStyle;
|
||||
4
frontend/node_modules/antd/lib/upload/style/rtl.d.ts
generated
vendored
Normal file
4
frontend/node_modules/antd/lib/upload/style/rtl.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import type { UploadToken } from '.';
|
||||
import type { GenerateStyle } from '../../theme/internal';
|
||||
declare const genRtlStyle: GenerateStyle<UploadToken>;
|
||||
export default genRtlStyle;
|
||||
18
frontend/node_modules/antd/lib/upload/style/rtl.js
generated
vendored
Normal file
18
frontend/node_modules/antd/lib/upload/style/rtl.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
// =========================== Motion ===========================
|
||||
const genRtlStyle = token => {
|
||||
const {
|
||||
componentCls
|
||||
} = token;
|
||||
return {
|
||||
[`${componentCls}-rtl`]: {
|
||||
direction: 'rtl'
|
||||
}
|
||||
};
|
||||
};
|
||||
var _default = exports.default = genRtlStyle;
|
||||
8
frontend/node_modules/antd/lib/upload/utils.d.ts
generated
vendored
Normal file
8
frontend/node_modules/antd/lib/upload/utils.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import type { InternalUploadFile, RcFile, UploadFile } from './interface';
|
||||
export declare function file2Obj(file: RcFile): InternalUploadFile;
|
||||
/** Upload fileList. Replace file if exist or just push into it. */
|
||||
export declare function updateFileList(file: UploadFile, fileList: (UploadFile | Readonly<UploadFile>)[]): (UploadFile<any> | Readonly<UploadFile<any>>)[];
|
||||
export declare function getFileItem(file: RcFile, fileList: (UploadFile | Readonly<UploadFile>)[]): UploadFile<any> | Readonly<UploadFile<any>>;
|
||||
export declare function removeFileItem(file: UploadFile, fileList: (UploadFile | Readonly<UploadFile>)[]): (UploadFile<any> | Readonly<UploadFile<any>>)[] | null;
|
||||
export declare const isImageUrl: (file: UploadFile) => boolean;
|
||||
export declare function previewImage(file: File | Blob): Promise<string>;
|
||||
136
frontend/node_modules/antd/lib/upload/utils.js
generated
vendored
Normal file
136
frontend/node_modules/antd/lib/upload/utils.js
generated
vendored
Normal file
@@ -0,0 +1,136 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.file2Obj = file2Obj;
|
||||
exports.getFileItem = getFileItem;
|
||||
exports.isImageUrl = void 0;
|
||||
exports.previewImage = previewImage;
|
||||
exports.removeFileItem = removeFileItem;
|
||||
exports.updateFileList = updateFileList;
|
||||
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
||||
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, _toConsumableArray2.default)(fileList);
|
||||
const fileIndex = nextFileList.findIndex(({
|
||||
uid
|
||||
}) => 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 = (url = '') => {
|
||||
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;
|
||||
};
|
||||
exports.isImageUrl = isImageUrl;
|
||||
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);
|
||||
window.URL.revokeObjectURL(img.src);
|
||||
resolve(dataURL);
|
||||
};
|
||||
img.crossOrigin = 'anonymous';
|
||||
if (file.type.startsWith('image/svg+xml')) {
|
||||
const reader = new FileReader();
|
||||
reader.onload = () => {
|
||||
if (reader.result && typeof reader.result === 'string') {
|
||||
img.src = reader.result;
|
||||
}
|
||||
};
|
||||
reader.readAsDataURL(file);
|
||||
} else if (file.type.startsWith('image/gif')) {
|
||||
const reader = new FileReader();
|
||||
reader.onload = () => {
|
||||
if (reader.result) {
|
||||
resolve(reader.result);
|
||||
}
|
||||
};
|
||||
reader.readAsDataURL(file);
|
||||
} else {
|
||||
img.src = window.URL.createObjectURL(file);
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user