import * as React from 'react'; export declare 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; isNotImage?: boolean; originFileObj?: File; response?: any; error?: any; linkProps?: any; type: string; } export interface UploadChangeParam { file: UploadFile; fileList: Array; event?: { percent: number; }; } export interface ShowUploadListInterface { showRemoveIcon?: boolean; showPreviewIcon?: boolean; } export interface UploadLocale { uploading?: string; removeFile?: string; uploadError?: string; previewFile?: string; } export declare type UploadType = 'drag' | 'select'; export declare type UploadListType = 'text' | 'picture' | 'picture-card'; export interface UploadProps { style?: React.CSSProperties; prefixCls?: string; className?: string; defaultFileList?: Array; fileList?: Array; multiple?: boolean; directory?: boolean; accept?: string | string[]; type?: UploadType; showUploadList?: boolean | ShowUploadListInterface; listType?: UploadListType; supportServerRender?: boolean; disabled?: boolean; locale?: UploadLocale; maxFileCount?: number; showDeleteAll?: boolean; tip?: string; name?: string; data?: AjaxUploaderInterface['data']; action?: AjaxUploaderInterface['action']; headers?: HttpRequestHeader; withCredentials?: boolean; customRequest?: AjaxUploaderInterface['customRequest']; beforeUpload?: AjaxUploaderInterface['beforeUpload']; onChange?: (info: UploadChangeParam) => void; onPreview?: (file: UploadFile) => void; onRemove?: (file: UploadFile) => void | boolean; onDeleteAll?: () => void; } export interface UploadState { fileList: UploadFile[]; dragState: string; action: string | ((file: UploadFile) => PromiseLike); } export interface UploadListProps { listType?: UploadListType; onPreview?: (file: UploadFile) => void; onRemove?: (file: UploadFile) => void | boolean; onDeleteAll?: () => void; items?: Array; progressAttr?: Object; prefixCls?: string; showRemoveIcon?: boolean; showPreviewIcon?: boolean; locale: UploadLocale; maxFileCount?: number; showDeleteAll?: boolean; } export interface UploadProgressEvent extends ProgressEvent { percent: number; } export declare type OnProgress = (event: UploadProgressEvent, file: RcFile) => void; export interface UploadRequestOption { onProgress?: (event: UploadProgressEvent, file: RcFile) => void; onError?: (error: UploadRequestError, ret: Record, file: RcFile) => void; onSuccess?: (body: T, xhr?: XMLHttpRequest) => void; data?: Record; filename?: string; file: RcFile; withCredentials?: boolean; action: string; headers?: Record; } export declare type UploadRequestMethod = 'POST' | 'PUT' | 'PATCH' | 'post' | 'put' | 'patch'; export interface UploadRequestError extends Error { status?: number; method?: UploadRequestMethod; url?: string; } export interface RcUploadProps extends AjaxUploaderInterface { onReady?: () => void; supportServerRender?: boolean; } export interface AjaxUploaderInterface { style?: React.CSSProperties; prefixCls?: string; className?: string; multiple?: boolean; directory?: boolean; accept?: string | string[]; component?: React.ElementType; disabled?: boolean; children?: React.ReactNode; name?: string; data?: Record | ((file: string | RcFile | Blob) => Record); action?: string | ((file: RcFile) => string | PromiseLike); headers?: UploadRequestOption['headers']; withCredentials?: boolean; customRequest?: (option: UploadRequestOption) => void; beforeUpload?: (file: RcFile, FileList: RcFile[]) => boolean | Promise; onStart?: (file: RcFile) => void; onError?: UploadRequestOption['onError']; onSuccess?: (response: Record, file: RcFile, xhr: XMLHttpRequest) => void; onProgress?: (event: UploadProgressEvent, file: RcFile) => void; } export declare type AjaxUploaderRef = { fileInput: HTMLInputElement; abort: (file?: any) => void; };