import { FileListItem, UploadInternalFileDetail, UploadInternalRawFile } from '@wakeadmin/element-adapter'; export interface CommonUploadProps { value?: any[]; onChange?: (value: any[]) => void; /** * 遵循 input#file 规范 https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#accept * * 你也可以传入扩展名数组, 例如 [.jpg, .jpeg, .png]. * * NOTE: 传入扩展名数组,我们才会对文件类型进行校验,否则只是在系统文件选择器中进行筛选 */ accept?: string | string[]; /** * 转换 value 为 upload 能识别的 file-item */ transformToFileListItem?: (value: any) => FileListItem; /** * 转换 file-item 为用户系统要保存的 value */ transformToValue?: (item: FileListItem) => any; /** * 文件过滤。并不是所有上传接口都按照严格的 HTTP code 返回,因此这里可以做一些改写(直接修改 item)和过滤 * * 返回 false 或 抛出异常都会跳过, 抛出异常会跳过 * 执行时机:在 onChange 时调用 */ filter?: (item: UploadInternalFileDetail) => void | boolean | Promise; /** * 文件上传前置检查 */ beforeUpload?: (file: UploadInternalRawFile) => boolean | Promise; /** * 自定义限额提示语, 在尺寸、大小不符合预期的情况下提示 */ limitMessage?: string; /** * 数量限制 */ limit?: number; /** * 大小限制 */ sizeLimit?: number; } export declare function useUpload(props: CommonUploadProps, options: { name: string; defaultAccept?: string; }): { exceeded: import("@wakeadmin/demi").ComputedRef; fileList: import("@wakeadmin/demi").ComputedRef; accept: import("@wakeadmin/demi").ComputedRef; handleExceed: (file: UploadInternalFileDetail, list: UploadInternalFileDetail[]) => void; beforeUpload: (file: UploadInternalRawFile) => Promise; handleChange: (file: UploadInternalFileDetail, list: UploadInternalFileDetail[]) => Promise; }; //# sourceMappingURL=useUpload.d.ts.map