26 lines
1.2 KiB
TypeScript
26 lines
1.2 KiB
TypeScript
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 { Cos } from '../types/Cos';
|
|
export type FileState = 'local' | 'uploading' | 'uploaded' | 'failed';
|
|
export declare class ExtraFile<ED extends EntityDict> extends Feature {
|
|
private cache;
|
|
private application;
|
|
private files;
|
|
constructor(cache: Cache<ED>, application: Application<ED>);
|
|
registerCos(clazzes: Array<new () => Cos<ED>>): void;
|
|
addLocalFile(id: string, file: File | string): void;
|
|
removeLocalFiles(ids: string[]): void;
|
|
upload(id: string): Promise<void>;
|
|
getUrl(extraFile?: Partial<EntityDict['extraFile']['OpSchema']>, style?: string): string;
|
|
getFileState(id: string): {
|
|
state: FileState;
|
|
percentage?: number;
|
|
} | undefined;
|
|
getFileName(extraFile: ED['extraFile']['OpSchema']): string;
|
|
formatBytes(size: number): string;
|
|
autoUpload(extraFile: ED['extraFile']['OpSchema'], file: File | string, style?: string, getPercent?: Function): Promise<string>;
|
|
private uploadToAspect;
|
|
}
|