ant-design/components/upload/interface.tsx

95 lines
2.2 KiB
TypeScript
Raw Normal View History

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: number;
}
export interface UploadFile {
uid: number;
size: number;
name: string;
2017-11-20 16:43:25 +08:00
filename?: string;
lastModified?: number;
lastModrcFlieifiedDate?: Date;
url?: string;
status?: UploadFileStatus;
percent?: number;
thumbUrl?: string;
isNotImage?: boolean;
originFileObj?: File;
response?: any;
error?: any;
linkProps?: any;
2017-11-20 16:43:25 +08:00
type: string;
}
2016-09-13 15:31:29 +08:00
export interface UploadChangeParam {
file: UploadFile;
fileList: Array<UploadFile>;
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 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;
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;
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;
}
2017-11-20 16:31:41 +08:00
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;
2017-02-28 18:43:22 +08:00
locale: UploadLocale;
}