import * as React from 'react'; import { Component } from 'react'; import identity from 'zent/es/utils/identity'; import FileInput from './components/FileInput'; export interface IUploadErrorMessage { overMaxSize?: string | ((data: { maxSize: string; type: string; }) => string); overMaxAmount?: string | ((data: { maxAmount: number; type: string; }) => string); wrongMimeType?: string | ((data: { type: string; }) => string); } export interface IUploadLocalFile { file: File; src: string; __uid: number; } export interface IUploadConfig { categoryId: number; localFiles: IUploadLocalFile[]; onProgress: (progress: number, index: number) => void; } export interface IUploadProps { prefix?: string; className?: string; type?: 'image' | 'video'; triggerClassName?: string; maxSize?: number; maxAmount?: number; accept?: string; tips?: string; localOnly?: boolean; auto?: boolean; filterFiles?: (files: File[]) => File[] | Promise; onFetch?: (networkUrl: string, categoryId: number) => Promise; onUpload?: (localFiles: IUploadLocalFile[], uploadConfig: IUploadConfig) => void | Promise; categoryList?: Array<{ value: any; text: string | number; }>; categoryId?: number; errorMessages?: IUploadErrorMessage; triggerInline?: boolean; silent?: boolean; withoutPopup?: boolean; trigger?: React.ComponentType; } export declare class Upload extends Component { static FileInput: typeof FileInput; static defaultProps: { prefix: string; className: string; triggerClassName: string; maxSize: number; maxAmount: number; tips: string; localOnly: boolean; auto: boolean; type: string; filterFiles: typeof identity; onFetch: () => Promise; onUpload: () => Promise; categoryList: any[]; categoryId: string; triggerInline: boolean; silent: boolean; withoutPopup: boolean; errorMessages: {}; }; isUnmount: boolean; constructor(props: any); componentDidMount(): void; componentWillUnmount(): void; closePopup(): void; render(): JSX.Element; showUpload: (visible?: boolean) => void; } export default Upload;