import { Dispatch, ReactElement, ReactNode, SetStateAction, ComponentProps } from 'react'; import { DivProps } from '../../types'; import { ButtonProps } from '../button'; import { DropArea, DropAreaProps } from './dropArea'; export type UploadStatus = 'default' | 'uploading' | 'success' | 'error'; export interface UploadFile extends File { id: string; progress?: number; status?: UploadStatus; url?: string; upload?(...args: A): Promise; } export interface UploadSharedProps { type?: 'file' | 'image'; onUpload?(files: UploadFile[], setProgress: Dispatch>, ...args: A): Promise; } export interface UploadProps extends UploadSharedProps, Omit { inputProps?: ComponentProps<'input'>; accept?: string; max?: number; /** * 是否显示"选择文件"按钮 * {@link type}为"file"生效 * 默认为true */ showButton?: boolean; buttonProps?: ButtonProps; buttonText?: ReactNode; /** {@link type}为"image"生效 */ variant?: 'square' | 'circular'; size?: number; /** 是否支持“将文件拖拽到此处” */ droppable?: boolean; dropAreaProps?: DropAreaProps; sortable?: boolean; defaultValue?: UploadFile[]; value?: UploadFile[]; onChange?(value: UploadFile[]): void; } export interface UploadRef extends HTMLDivElement { upload(...args: A): Promise; } export declare const Upload: { (props: UploadProps): ReactElement; DropArea: typeof DropArea; };