UNPKG

burdy

Version:

Open Source Headless Platform

58 lines (57 loc) 1.88 kB
/// <reference types="react" /> import { UseAsyncReturn } from 'react-async-hook'; import { IAsset } from '@shared/interfaces/model'; import { ModelState } from '@admin/helpers/hooks'; import ExtendedSelection from '@admin/helpers/selection'; declare const FOLDER_MIME_TYPE = "application/vnd.burdy.folder"; declare const IMAGE_MIME_TYPES: string[]; declare type ViewTypes = 'list' | 'tiles'; declare type Arrayable<T> = T | T[]; interface IFileWithData { file: File; data: any; } interface IUpload { status?: 'uploading' | 'done'; name?: string; progress?: number; } interface IUploads { [key: string]: IUpload; } interface IAssetsContext { getAssets: UseAsyncReturn<any, [params?: any]>; getAncestors: UseAsyncReturn<IAsset[], [params?: any]>; createFolder: UseAsyncReturn<any, [data?: any]>; upload: UseAsyncReturn<any, [Arrayable<IFileWithData>]>; del: UseAsyncReturn<any, [ids: any[]]>; update: UseAsyncReturn<any, [ id: number, data: { alt?: string; copyright?: string; tags?: any[]; } ]>; rename: UseAsyncReturn<any, [id: string | number, name: string]>; params: any; setParams: (v: any) => void; selectedAssets: IAsset[]; selection: ExtendedSelection<IAsset>; uploads: IUploads; assets: IAsset[]; assetsState: ModelState<IAsset>; stateData: any; setStateData: (key: string, val: any) => void; openFolderDialog: () => void; openFileDialog: () => void; openItem: (data?: any) => void; view: ViewTypes; setView: (type: ViewTypes) => void; assetSrc: (asset: IAsset) => string; } declare const AssetsContextProvider: ({ children }: { children: any; }) => JSX.Element; declare const useAssets: () => IAssetsContext; export { useAssets, AssetsContextProvider, FOLDER_MIME_TYPE, IMAGE_MIME_TYPES };