mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-28 11:08:30 +08:00
8fc3cb8d24
close #14779 caused by the previous fix in #14298 reverted and change another way to fix #14299
98 lines
2.3 KiB
TypeScript
Executable File
98 lines
2.3 KiB
TypeScript
Executable File
import * as React from 'react';
|
|
|
|
export type UploadFileStatus = 'error' | 'success' | 'done' | 'uploading' | 'removed';
|
|
|
|
export interface HttpRequestHeader {
|
|
[key: string]: string;
|
|
}
|
|
|
|
export interface RcFile extends File {
|
|
uid: string;
|
|
lastModifiedDate: Date;
|
|
}
|
|
|
|
export interface UploadFile {
|
|
uid: string;
|
|
size: number;
|
|
name: string;
|
|
fileName?: string;
|
|
lastModified?: number;
|
|
lastModifiedDate?: Date;
|
|
url?: string;
|
|
status?: UploadFileStatus;
|
|
percent?: number;
|
|
thumbUrl?: string;
|
|
originFileObj?: File;
|
|
response?: any;
|
|
error?: any;
|
|
linkProps?: any;
|
|
type: string;
|
|
}
|
|
|
|
export interface UploadChangeParam {
|
|
file: UploadFile;
|
|
fileList: Array<UploadFile>;
|
|
event?: { percent: number };
|
|
}
|
|
|
|
export interface ShowUploadListInterface {
|
|
showRemoveIcon?: boolean;
|
|
showPreviewIcon?: boolean;
|
|
}
|
|
|
|
export interface UploadLocale {
|
|
uploading?: string;
|
|
removeFile?: string;
|
|
uploadError?: string;
|
|
previewFile?: string;
|
|
}
|
|
|
|
export type UploadType = 'drag' | 'select';
|
|
export type UploadListType = 'text' | 'picture' | 'picture-card';
|
|
|
|
export interface UploadProps {
|
|
type?: UploadType;
|
|
name?: string;
|
|
defaultFileList?: Array<UploadFile>;
|
|
fileList?: Array<UploadFile>;
|
|
action?: string | ((file: UploadFile) => PromiseLike<any>);
|
|
directory?: boolean;
|
|
data?: Object | ((file: UploadFile) => any);
|
|
headers?: HttpRequestHeader;
|
|
showUploadList?: boolean | ShowUploadListInterface;
|
|
multiple?: boolean;
|
|
accept?: string;
|
|
beforeUpload?: (file: RcFile, FileList: RcFile[]) => boolean | PromiseLike<any>;
|
|
onChange?: (info: UploadChangeParam) => void;
|
|
listType?: UploadListType;
|
|
className?: string;
|
|
onPreview?: (file: UploadFile) => void;
|
|
onRemove?: (file: UploadFile) => void | boolean;
|
|
supportServerRender?: boolean;
|
|
style?: React.CSSProperties;
|
|
disabled?: boolean;
|
|
prefixCls?: string;
|
|
customRequest?: (option: any) => void;
|
|
withCredentials?: boolean;
|
|
openFileDialogOnClick?: boolean;
|
|
locale?: UploadLocale;
|
|
id?: string;
|
|
}
|
|
|
|
export interface UploadState {
|
|
fileList: UploadFile[];
|
|
dragState: string;
|
|
}
|
|
|
|
export interface UploadListProps {
|
|
listType?: UploadListType;
|
|
onPreview?: (file: UploadFile) => void;
|
|
onRemove?: (file: UploadFile) => void | boolean;
|
|
items?: Array<UploadFile>;
|
|
progressAttr?: Object;
|
|
prefixCls?: string;
|
|
showRemoveIcon?: boolean;
|
|
showPreviewIcon?: boolean;
|
|
locale: UploadLocale;
|
|
}
|