UNPKG

flmngr

Version:

Flmngr file manager (Local disk / Amazon S3 / Azure Blob)

148 lines (147 loc) 4.56 kB
interface CSRFTokenResult { headers?: { [key: string]: string; }; params?: { [key: string]: string; }; } declare type FuncGetCSRFToken = (onSuccess: (result: CSRFTokenResult) => void, onError: () => void) => void; interface FlmngrImageFormat { id: string; title: string; suffix: string; maxWidth: number | null; maxHeight: number | null; } export interface FlmngrFile { format: string; url: string; isServerFile: boolean; } export interface FlmngrFileWithFormats extends FlmngrFile { formats: FlmngrFile[]; } interface FlmngrLoadParams { waitForImgPenToo?: boolean; } export declare enum FlmngrUploadMode { AUTORENAME = "AUTORENAME", OVERWRITE = "OVERWRITE" } interface FlmngrCreateParams extends FlmngrLoadParams { apiKey?: string; urlFiles?: string; urlFileManager?: string; urlFileManager__CSRF?: FuncGetCSRFToken | null; urlFileManager__user?: string; urlFileManager__password?: string; accessKey?: string; apiKeyUnsplash?: string; isMaximized?: boolean; showMaximizeButton?: boolean; showCloseButton?: boolean; hideFiles?: string[]; hideDirs?: string[]; defaultUploadDir?: string; uploadThreads?: number; filesPerPortion?: number; imageFormats?: FlmngrImageFormat[]; } export interface FlmngrOpenParams extends FlmngrCreateParams { list?: null | string[]; acceptExtensions?: string[]; isMultiple?: boolean; allowReorder?: boolean; isMaximized?: boolean; showMaximizeButton?: boolean; showCloseButton?: boolean; createImageFormats?: string[]; onFinish?: (files: FlmngrFileWithFormats[]) => void; onCancel?: () => void; } export interface FlmngrServerFile { url: string; name: string; size: number; timestamp: number; blurHash?: string; width?: number; height?: number; formats?: { [key: string]: FlmngrServerFile; }; } interface FlmngrUploadParams extends FlmngrCreateParams { filesOrLinks: (File | string)[]; dirUploads?: string; mode?: FlmngrUploadMode; onFinish?: (files: FlmngrServerFile[]) => void; onFail?: (error: string) => void; } interface FlmngrEditAndUploadParams extends FlmngrCreateParams { url: string; filename?: string; dirUploads?: string; onSave?: (urlNew: string) => void; onCancel?: () => void; } declare enum FlmngrImageFormatCreationMode { ALWAYS = "ALWAYS", IF_EXISTS = "IF_EXISTS", DO_NOT_UPDATE = "DO_NOT_UPDATE" } interface FlmngrCreateImageFormatsParams extends FlmngrCreateParams { urls: string[]; createImageFormats: { [key: string]: FlmngrImageFormatCreationMode; }; showProgress?: boolean; onFinish: (result: { [url: string]: { [formatId: string]: string; }; }) => void; onProgress?: (finished: number, failed: number, total: number) => void; onCancel?: () => void; } interface FlmngrEditParams extends FlmngrCreateParams { url: string; onSave: (onExport: (name: string, ext: string, jpegQuality: number, onExported: (image: File) => void, onFail: () => void) => void, onClose: () => void) => void; onCancel?: () => void; } interface FlmngrSelectUrlsParams { apiKey?: string; isMultiple?: boolean; onFinish: (urls: string[]) => void; onCancel?: () => void; } export declare class Flmngr { private static commonParams; static load(params: Partial<FlmngrCreateParams>, on?: { onFlmngrAndImgPenLoaded?: () => void; onFlmngrLoaded?: () => void; onImgPenLoaded?: () => void; }): void; private static includeJS; static isLoaded(checkImgPenToo: boolean): boolean; static isFlmngrLoaded(): boolean; static isImgPenLoaded(): boolean; private static waitForLoaded; static open(params: FlmngrOpenParams): void; static mount(el: HTMLElement, params: FlmngrOpenParams): void; static upload(params: FlmngrUploadParams): void; static createImageFormats(params: FlmngrCreateImageFormatsParams): void; static edit(params: FlmngrEditParams): void; static editAndUpload(params: FlmngrEditAndUploadParams): void; static getImageExtensions(): string[]; static getNoCacheUrl(url: string): string; static selectFiles(params: { isMultiple: boolean; acceptExtensions: string[]; onFinish: (files: File[]) => void; }): void; static selectUrls(params: FlmngrSelectUrlsParams): void; static getNewAPI(): typeof Flmngr; } export default Flmngr;