import type { RcFile as OriRcFile, UploadRequestOption as RcCustomRequestOptions, UploadProps as RcUploadProps, } from 'rc-upload/lib/interface'; import type * as React from 'react'; import type { ProgressAriaProps, ProgressProps } from '../progress'; export interface RcFile extends OriRcFile { readonly lastModifiedDate: Date; } export type UploadFileStatus = 'error' | 'success' | 'done' | 'uploading' | 'removed'; export interface HttpRequestHeader { [key: string]: string; } export interface UploadFile 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['crossOrigin']; originFileObj?: RcFile; response?: T; error?: any; linkProps?: any; type?: string; xhr?: T; preview?: string; } export interface InternalUploadFile extends UploadFile { originFileObj: RcFile; } export interface UploadChangeParam { // https://github.com/ant-design/ant-design/issues/14420 file: T; fileList: T[]; event?: { percent: number }; } export interface ShowUploadListInterface { showRemoveIcon?: boolean; showPreviewIcon?: boolean; showDownloadIcon?: boolean; removeIcon?: React.ReactNode | ((file: UploadFile) => React.ReactNode); downloadIcon?: React.ReactNode | ((file: UploadFile) => React.ReactNode); previewIcon?: React.ReactNode | ((file: UploadFile) => 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; export type ItemRender = ( originNode: React.ReactElement, file: UploadFile, fileList: Array>, actions: { download: () => void; preview: () => void; remove: () => void; }, ) => React.ReactNode; type PreviewFileHandler = (file: File | Blob) => PromiseLike; type TransformFileHandler = ( file: RcFile, ) => string | Blob | File | PromiseLike; type BeforeUploadValueType = void | boolean | string | Blob | File; export interface UploadProps extends Pick { type?: UploadType; name?: string; defaultFileList?: Array>; fileList?: Array>; action?: string | ((file: RcFile) => string) | ((file: RcFile) => PromiseLike); directory?: boolean; data?: | Record | ((file: UploadFile) => Record | Promise>); method?: 'POST' | 'PUT' | 'PATCH' | 'post' | 'put' | 'patch'; headers?: HttpRequestHeader; showUploadList?: boolean | ShowUploadListInterface; multiple?: boolean; accept?: string; beforeUpload?: ( file: RcFile, FileList: RcFile[], ) => BeforeUploadValueType | Promise; onChange?: (info: UploadChangeParam>) => void; onDrop?: (event: React.DragEvent) => void; listType?: UploadListType; className?: string; onPreview?: (file: UploadFile) => void; onDownload?: (file: UploadFile) => void; onRemove?: (file: UploadFile) => void | boolean | Promise; supportServerRender?: boolean; style?: React.CSSProperties; disabled?: boolean; prefixCls?: string; customRequest?: (options: RcCustomRequestOptions) => void; withCredentials?: boolean; openFileDialogOnClick?: boolean; locale?: UploadLocale; id?: string; previewFile?: PreviewFileHandler; /** @deprecated Please use `beforeUpload` directly */ transformFile?: TransformFileHandler; iconRender?: (file: UploadFile, listType?: UploadListType) => React.ReactNode; isImageUrl?: (file: UploadFile) => boolean; progress?: UploadListProgressProps; itemRender?: ItemRender; /** Config max count of `fileList`. Will replace current one when `maxCount` is 1 */ maxCount?: number; children?: React.ReactNode; } export interface UploadState { fileList: UploadFile[]; dragState: string; } export interface UploadListProps { listType?: UploadListType; onPreview?: (file: UploadFile) => void; onDownload?: (file: UploadFile) => void; onRemove?: (file: UploadFile) => void | boolean; items?: Array>; progress?: UploadListProgressProps; prefixCls?: string; className?: string; showRemoveIcon?: boolean; showDownloadIcon?: boolean; showPreviewIcon?: boolean; removeIcon?: React.ReactNode | ((file: UploadFile) => React.ReactNode); downloadIcon?: React.ReactNode | ((file: UploadFile) => React.ReactNode); previewIcon?: React.ReactNode | ((file: UploadFile) => React.ReactNode); locale: UploadLocale; previewFile?: PreviewFileHandler; iconRender?: (file: UploadFile, listType?: UploadListType) => React.ReactNode; isImageUrl?: (file: UploadFile) => boolean; appendAction?: React.ReactNode; appendActionVisible?: boolean; itemRender?: ItemRender; /** * @internal Only the internal remove button is provided for use */ disabled?: boolean; }