add all frontend files

This commit is contained in:
2026-01-17 15:16:36 -05:00
parent ff16ae7858
commit e40287e4aa
25704 changed files with 1935289 additions and 0 deletions

10
node_modules/antd/es/upload/Dragger.d.ts generated vendored Normal file
View 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;

35
node_modules/antd/es/upload/Dragger.js generated vendored Normal file
View File

@@ -0,0 +1,35 @@
"use client";
var __rest = this && this.__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;
};
import * as React from 'react';
import Upload from './Upload';
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, Object.assign({
ref: ref,
hasControlInside: hasControlInside
}, restProps, {
style: mergedStyle,
type: "drag"
}), children);
});
if (process.env.NODE_ENV !== 'production') {
Dragger.displayName = 'Dragger';
}
export default Dragger;

23
node_modules/antd/es/upload/Upload.d.ts generated vendored Normal file
View 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;

424
node_modules/antd/es/upload/Upload.js generated vendored Normal file
View File

@@ -0,0 +1,424 @@
"use client";
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
var __awaiter = this && this.__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());
});
};
import * as React from 'react';
import { flushSync } from 'react-dom';
import classNames from 'classnames';
import RcUpload from 'rc-upload';
import useMergedState from "rc-util/es/hooks/useMergedState";
import { devUseWarning } from '../_util/warning';
import { ConfigContext } from '../config-provider';
import { useComponentConfig } from '../config-provider/context';
import DisabledContext from '../config-provider/DisabledContext';
import { useLocale } from '../locale';
import defaultLocale from '../locale/en_US';
import useStyle from './style';
import UploadList from './UploadList';
import { file2Obj, getFileItem, removeFileItem, updateFileList } from './utils';
export const LIST_IGNORE = `__LIST_IGNORE_${Date.now()}__`;
const InternalUpload = (props, ref) => {
const config = 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);
const mergedDisabled = customDisabled !== null && customDisabled !== void 0 ? customDisabled : disabled;
const customRequest = props.customRequest || config.customRequest;
const [mergedFileList, setMergedFileList] = useMergedState(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 = 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 = _toConsumableArray(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
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
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 = _toConsumableArray(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 (_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 (!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,
nativeElement: wrapRef.current
}));
const {
getPrefixCls,
direction,
upload: ctxUpload
} = React.useContext(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] = useStyle(prefixCls, wrapperCls);
const [contextLocale] = useLocale('Upload', defaultLocale.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, {
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 = classNames(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 = classNames(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, Object.assign({}, rcUploadProps, {
ref: upload,
className: `${prefixCls}-btn`
}), /*#__PURE__*/React.createElement("div", {
className: `${prefixCls}-drag-container`
}, children))), renderUploadList()));
}
const uploadBtnCls = classNames(prefixCls, `${prefixCls}-select`, {
[`${prefixCls}-disabled`]: mergedDisabled,
[`${prefixCls}-hidden`]: !children
});
const uploadButton = /*#__PURE__*/React.createElement("div", {
className: uploadBtnCls,
style: mergedStyle
}, /*#__PURE__*/React.createElement(RcUpload, 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';
}
export default Upload;

28
node_modules/antd/es/upload/UploadList/ListItem.d.ts generated vendored Normal file
View 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;

170
node_modules/antd/es/upload/UploadList/ListItem.js generated vendored Normal file
View File

@@ -0,0 +1,170 @@
"use client";
import * as React from 'react';
import DeleteOutlined from "@ant-design/icons/es/icons/DeleteOutlined";
import DownloadOutlined from "@ant-design/icons/es/icons/DownloadOutlined";
import EyeOutlined from "@ant-design/icons/es/icons/EyeOutlined";
import classNames from 'classnames';
import CSSMotion from 'rc-motion';
import { ConfigContext } from '../../config-provider';
import Progress from '../../progress';
import Tooltip from '../../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 = classNames(`${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 = classNames(`${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(`${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, 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, null), () => onDownload(file), prefixCls, locale.downloadFile) : null;
const downloadOrDelete = listType !== 'picture-card' && listType !== 'picture-circle' && (/*#__PURE__*/React.createElement("span", {
key: "download-delete",
className: classNames(`${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 = classNames(`${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, 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(ConfigContext);
const rootPrefixCls = getPrefixCls();
const dom = /*#__PURE__*/React.createElement("div", {
className: listItemClassName
}, icon, fileName, downloadOrDelete, pictureCardActions, showProgress && (/*#__PURE__*/React.createElement(CSSMotion, {
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, 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: classNames(`${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, {
title: message,
getPopupContainer: node => node.parentNode
}, dom)) : dom;
return /*#__PURE__*/React.createElement("div", {
className: classNames(`${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);
});
export default ListItem;

8
node_modules/antd/es/upload/UploadList/index.d.ts generated vendored Normal file
View 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;

195
node_modules/antd/es/upload/UploadList/index.js generated vendored Normal file
View File

@@ -0,0 +1,195 @@
"use client";
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
import * as React from 'react';
import FileTwoTone from "@ant-design/icons/es/icons/FileTwoTone";
import LoadingOutlined from "@ant-design/icons/es/icons/LoadingOutlined";
import PaperClipOutlined from "@ant-design/icons/es/icons/PaperClipOutlined";
import PictureTwoTone from "@ant-design/icons/es/icons/PictureTwoTone";
import classNames from 'classnames';
import CSSMotion, { CSSMotionList } from 'rc-motion';
import omit from "rc-util/es/omit";
import { useForceUpdate } from '../../_util/hooks';
import initCollapseMotion from '../../_util/motion';
import { cloneElement } from '../../_util/reactNode';
import Button from '../../button';
import { ConfigContext } from '../../config-provider';
import { isImageUrl, previewImage } from '../utils';
import ListItem from './ListItem';
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,
extra,
progress = {
size: [-1, 2],
showInfo: false
},
appendAction,
appendActionVisible = true,
itemRender,
disabled
} = props;
const [, forceUpdate] = 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, null) : locale.uploading;
const fileIcon = (isImgUrl === null || isImgUrl === void 0 ? void 0 : isImgUrl(file)) ? /*#__PURE__*/React.createElement(PictureTwoTone, null) : /*#__PURE__*/React.createElement(FileTwoTone, null);
return isLoading ? loadingIcon : fileIcon;
}
return isLoading ? /*#__PURE__*/React.createElement(LoadingOutlined, null) : /*#__PURE__*/React.createElement(PaperClipOutlined, 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, Object.assign({}, btnProps, {
icon: cloneElement(customIcon, Object.assign(Object.assign({}, customIcon.props), {
onClick: () => {}
}))
}))) : (/*#__PURE__*/React.createElement(Button, Object.assign({}, btnProps), /*#__PURE__*/React.createElement("span", null, customIcon)));
};
// ============================== Ref ===============================
// Test needs
React.useImperativeHandle(ref, () => ({
handlePreview: onInternalPreview,
handleDownload: onInternalDownload
}));
const {
getPrefixCls
} = React.useContext(ConfigContext);
// ============================= Render =============================
const prefixCls = getPrefixCls('upload', customizePrefixCls);
const rootPrefixCls = getPrefixCls();
const listClassNames = classNames(`${prefixCls}-list`, `${prefixCls}-list-${listType}`);
const listItemMotion = React.useMemo(() => omit(initCollapseMotion(rootPrefixCls), ['onAppearEnd', 'onEnterEnd', 'onLeaveEnd']), [rootPrefixCls]);
const motionConfig = Object.assign(Object.assign({}, isPictureCardOrCirle ? {} : listItemMotion), {
motionDeadline: 2000,
motionName: `${prefixCls}-${isPictureCardOrCirle ? 'animate-inline' : 'animate'}`,
keys: _toConsumableArray(items.map(file => ({
key: file.uid,
file
}))),
motionAppear
});
return /*#__PURE__*/React.createElement("div", {
className: listClassNames
}, /*#__PURE__*/React.createElement(CSSMotionList, Object.assign({}, motionConfig, {
component: false
}), ({
key,
file,
className: motionClassName,
style: motionStyle
}) => (/*#__PURE__*/React.createElement(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,
extra: extra,
iconRender: internalIconRender,
actionIconRender: actionIconRender,
itemRender: itemRender,
onPreview: onInternalPreview,
onDownload: onInternalDownload,
onClose: onInternalClose
}))), appendAction && (/*#__PURE__*/React.createElement(CSSMotion, Object.assign({}, motionConfig, {
visible: appendActionVisible,
forceRender: true
}), ({
className: motionClassName,
style: motionStyle
}) => cloneElement(appendAction, oriProps => ({
className: classNames(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';
}
export default UploadList;

13
node_modules/antd/es/upload/index.d.ts generated vendored Normal file
View 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;

8
node_modules/antd/es/upload/index.js generated vendored Normal file
View File

@@ -0,0 +1,8 @@
"use client";
import Dragger from './Dragger';
import InternalUpload, { LIST_IGNORE } from './Upload';
const Upload = InternalUpload;
Upload.Dragger = Dragger;
Upload.LIST_IGNORE = LIST_IGNORE;
export default Upload;

143
node_modules/antd/es/upload/interface.d.ts generated vendored Normal file
View 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 {};

1
node_modules/antd/es/upload/interface.js generated vendored Normal file
View File

@@ -0,0 +1 @@
export {};

4
node_modules/antd/es/upload/style/dragger.d.ts generated vendored Normal file
View File

@@ -0,0 +1,4 @@
import type { UploadToken } from '.';
import type { GenerateStyle } from '../../theme/internal';
declare const genDraggerStyle: GenerateStyle<UploadToken>;
export default genDraggerStyle;

71
node_modules/antd/es/upload/style/dragger.js generated vendored Normal file
View File

@@ -0,0 +1,71 @@
import { unit } from '@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: `${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: `${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 ${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
}
}
}
}
};
};
export default genDraggerStyle;

21
node_modules/antd/es/upload/style/index.d.ts generated vendored Normal file
View 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;

54
node_modules/antd/es/upload/style/index.js generated vendored Normal file
View File

@@ -0,0 +1,54 @@
import { resetComponent } from '../../style';
import { genCollapseMotion } from '../../style/motion';
import { genStyleHooks, mergeToken } from '../../theme/internal';
import genDraggerStyle from './dragger';
import genListStyle from './list';
import genMotionStyle from './motion';
import { genPictureCardStyle, genPictureStyle } from './picture';
import genRtlStyle from './rtl';
const genBaseStyle = token => {
const {
componentCls,
colorTextDisabled
} = token;
return {
[`${componentCls}-wrapper`]: Object.assign(Object.assign({}, 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'
}
})
};
};
export const prepareComponentToken = token => ({
actionsColor: token.colorIcon,
pictureCardSize: token.controlHeightLG * 2.55
});
// ============================== Export ==============================
export default genStyleHooks('Upload', token => {
const {
fontSizeHeading3,
fontHeight,
lineWidth,
pictureCardSize,
calc
} = token;
const uploadToken = mergeToken(token, {
uploadThumbnailSize: calc(fontSizeHeading3).mul(2).equal(),
uploadProgressOffset: calc(calc(fontHeight).div(2)).add(lineWidth).equal(),
uploadPicCardSize: pictureCardSize
});
return [genBaseStyle(uploadToken), genDraggerStyle(uploadToken), genPictureStyle(uploadToken), genPictureCardStyle(uploadToken), genListStyle(uploadToken), genMotionStyle(uploadToken), genRtlStyle(uploadToken), genCollapseMotion(uploadToken)];
}, prepareComponentToken);

4
node_modules/antd/es/upload/style/list.d.ts generated vendored Normal file
View File

@@ -0,0 +1,4 @@
import type { UploadToken } from '.';
import type { GenerateStyle } from '../../theme/internal';
declare const genListStyle: GenerateStyle<UploadToken>;
export default genListStyle;

100
node_modules/antd/es/upload/style/list.js generated vendored Normal file
View File

@@ -0,0 +1,100 @@
import { unit } from '@ant-design/cssinjs';
import { clearFix, textEllipsis } from '../../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({}, 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({}, textEllipsis), {
padding: `0 ${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: '""'
}
}
})
}
};
};
export default genListStyle;

4
node_modules/antd/es/upload/style/motion.d.ts generated vendored Normal file
View File

@@ -0,0 +1,4 @@
import type { UploadToken } from '.';
import type { GenerateStyle } from '../../theme/internal';
declare const genMotionStyle: GenerateStyle<UploadToken>;
export default genMotionStyle;

45
node_modules/antd/es/upload/style/motion.js generated vendored Normal file
View File

@@ -0,0 +1,45 @@
import { Keyframes } from '@ant-design/cssinjs';
import { initFadeMotion } from '../../style/motion';
// =========================== Motion ===========================
const genMotionStyle = token => {
const {
componentCls
} = token;
const uploadAnimateInlineIn = new Keyframes('uploadAnimateInlineIn', {
from: {
width: 0,
height: 0,
padding: 0,
opacity: 0,
margin: token.calc(token.marginXS).div(-2).equal()
}
});
const uploadAnimateInlineOut = new 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`]: initFadeMotion(token)
}, uploadAnimateInlineIn, uploadAnimateInlineOut];
};
export default genMotionStyle;

5
node_modules/antd/es/upload/style/picture.d.ts generated vendored Normal file
View 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 };

232
node_modules/antd/es/upload/style/picture.js generated vendored Normal file
View File

@@ -0,0 +1,232 @@
import { blue } from '@ant-design/colors';
import { unit } from '@ant-design/cssinjs';
import { clearFix, textEllipsis } from '../../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: `${unit(token.lineWidth)} ${token.lineType} ${token.colorBorder}`,
borderRadius: token.borderRadiusLG,
'&:hover': {
background: 'transparent'
},
[`${itemCls}-thumbnail`]: Object.assign(Object.assign({}, textEllipsis), {
width: uploadThumbnailSize,
height: uploadThumbnailSize,
lineHeight: 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% - ${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='${blue[0]}']`]: {
fill: token.colorErrorBg
},
[`svg path[fill='${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,
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({}, clearFix()), {
display: 'block',
[`${componentCls}${componentCls}-select`]: {
width: uploadPictureCardSize,
height: uploadPictureCardSize,
textAlign: 'center',
verticalAlign: 'top',
backgroundColor: token.colorFillAlter,
border: `${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% - ${unit(calc(token.paddingXS).mul(2).equal())})`,
height: `calc(100% - ${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 ${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% - ${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% - ${unit(calc(token.paddingXS).mul(2).equal())})`,
paddingInlineStart: 0
}
}
}),
[`${componentCls}-wrapper${componentCls}-picture-circle-wrapper`]: {
[`${componentCls}${componentCls}-select`]: {
borderRadius: '50%'
}
}
};
};
export { genPictureStyle, genPictureCardStyle };

4
node_modules/antd/es/upload/style/rtl.d.ts generated vendored Normal file
View File

@@ -0,0 +1,4 @@
import type { UploadToken } from '.';
import type { GenerateStyle } from '../../theme/internal';
declare const genRtlStyle: GenerateStyle<UploadToken>;
export default genRtlStyle;

12
node_modules/antd/es/upload/style/rtl.js generated vendored Normal file
View File

@@ -0,0 +1,12 @@
// =========================== Motion ===========================
const genRtlStyle = token => {
const {
componentCls
} = token;
return {
[`${componentCls}-rtl`]: {
direction: 'rtl'
}
};
};
export default genRtlStyle;

8
node_modules/antd/es/upload/utils.d.ts generated vendored Normal file
View 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>;

123
node_modules/antd/es/upload/utils.js generated vendored Normal file
View File

@@ -0,0 +1,123 @@
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
export 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. */
export function updateFileList(file, fileList) {
const nextFileList = _toConsumableArray(fileList);
const fileIndex = nextFileList.findIndex(({
uid
}) => uid === file.uid);
if (fileIndex === -1) {
nextFileList.push(file);
} else {
nextFileList[fileIndex] = file;
}
return nextFileList;
}
export function getFileItem(file, fileList) {
const matchKey = file.uid !== undefined ? 'uid' : 'name';
return fileList.filter(item => item[matchKey] === file[matchKey])[0];
}
export 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;
export 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;
export 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);
}
});
}