import { Feature } from 'oak-frontend-base/es/types/Feature'; import { Cache } from 'oak-frontend-base/es/features/cache'; import { EntityDict } from '../oak-app-domain'; import { Application } from './application'; import { OpSchema } from '../oak-app-domain/ExtraFile/Schema'; import { Cos } from '../types/Cos'; export type FileState = 'local' | 'uploading' | 'uploaded' | 'failed'; export interface ChunkOptions { chunkSize: number; parallelism?: number; retryTimes?: number; retryDelay?: number; } export declare class ExtraFile extends Feature { private cache; private application; private files; private fileUpLoad; private uploadIdToTaskId; constructor(cache: Cache, application: Application); registerCos(clazzes: Array Cos>): void; addLocalFile(id: string, file: File | string): void; removeLocalFiles(ids: string[]): void; upload(id: string): Promise; getUrl(extraFile?: Partial, style?: string): string; getFileState(id: string): { state: FileState; percentage?: number; } | undefined; getFileName(extraFile: ED['extraFile']['OpSchema']): string; formatBytes(size: number): string; autoUpload(options: { extraFile: ED['extraFile']['OpSchema']; file: File | string; style?: string; getPercent?: Function; chunkOptions?: ChunkOptions; }): Promise; /** * 中止上传 * @param extraFileId ExtraFile的ID */ abortUpload(extraFileId: string): void; private doUpload; private uploadToAspect; /** * 生成上传ID列表,请确保在cos实现时,该方法生成的ID与upload方法中调用的上传接口的任务ID一致 */ generateUploadId(extraFile: Partial): string[]; }