ant-design/components/upload/interface.tsx

78 lines
1.9 KiB
TypeScript
Raw Normal View History

2016-09-21 11:54:53 +08:00
import React from 'react';
export type UploadFileStatus = 'error' | 'success' | 'done' | 'uploading' | 'removed';
export interface HttpRequestHeader {
[key: string]: string;
}
export interface File {
uid: number;
size: number;
name: string;
lastModifiedDate?: Date;
url?: string;
status?: UploadFileStatus;
percent?: number;
thumbUrl?: string;
originFileObj?: File;
response?: string;
error?: any;
}
2016-09-13 15:31:29 +08:00
export interface UploadChangeParam {
file: File;
fileList: Array<File>;
event?: { percent: number };
}
export interface ShowUploadListInterface {
showRemoveIcon?: boolean;
showPreviewIcon?: boolean;
}
2017-02-28 18:43:22 +08:00
export interface UploadLocale {
uploading?: string;
removeFile?: string;
uploadError?: string;
previewFile?: string;
}
export interface UploadProps {
type?: 'drag' | 'select';
name?: string;
defaultFileList?: Array<File>;
fileList?: Array<File>;
action?: string;
data?: Object | ((file: File) => any);
headers?: HttpRequestHeader;
showUploadList?: boolean | ShowUploadListInterface;
multiple?: boolean;
accept?: string;
beforeUpload?: (file: File, FileList: File[]) => boolean | PromiseLike<any>;
onChange?: (info: UploadChangeParam) => void;
listType?: 'text' | 'picture' | 'picture-card';
className?: string;
onPreview?: (file: File) => void;
onRemove?: (file: File) => void | boolean;
supportServerRender?: boolean;
style?: React.CSSProperties;
2016-08-16 18:07:37 +08:00
disabled?: boolean;
prefixCls?: string;
customRequest?: (option: any) => void;
withCredentials?: boolean;
2017-02-28 18:43:22 +08:00
locale?: UploadLocale;
}
export interface UploadListProps {
listType?: 'text' | 'picture' | 'picture-card';
onPreview?: (file: File) => void;
onRemove?: (file: File) => void | boolean;
items?: Array<File>;
progressAttr?: Object;
prefixCls?: string;
showRemoveIcon?: boolean;
showPreviewIcon?: boolean;
2017-02-28 18:43:22 +08:00
locale: UploadLocale;
}