import { IFolder, INode } from '../../node/index.ts'; import { IColumn } from './column.ts'; export type ContentsWithRoot = { folder: IFolder; contents: INode[]; }; export interface IGetContentsOptions { /** * Abort signal to be able to cancel the request. * *@see https://developer.mozilla.org/en-US/docs/Web/API/AbortController */ signal: AbortSignal; } export interface IView { /** Unique view ID */ id: string; /** Translated view name */ name: string; /** Translated accessible description of the view */ caption?: string; /** Translated title of the empty view */ emptyTitle?: string; /** Translated description of the empty view */ emptyCaption?: string; /** * Custom implementation of the empty view. * If set and no content is found for the current view, * then this method is called with the container element * where to render your empty view implementation. * * @param div - The container element to render into */ emptyView?: (div: HTMLDivElement) => void; /** * Method return the content of the provided path. * * This method _must_ also return the current directory * information alongside with its content. * * An [abort signal](https://developer.mozilla.org/en-US/docs/Web/API/AbortController) is provided * to be able to cancel the request if the user change directory. */ getContents(path: string, options: IGetContentsOptions): Promise; /** * If set then the view will be hidden from the navigation unless its the active view. */ hidden?: true; /** The view icon as an inline svg */ icon: string; /** * The view order. * If not set will be natural sorted by view name. */ order?: number; /** * Custom params to give to the router on click * If defined, will be treated as a dummy view and * will just redirect and not fetch any contents. */ params?: Record; /** * This view column(s). Name and actions are * by default always included */ columns?: IColumn[]; /** The parent unique ID */ parent?: string; /** This view is sticky (sent at the bottom) */ sticky?: boolean; /** * This view has children and is expanded (by default) * or not. This will be overridden by user config. */ expanded?: boolean; /** * Will be used as default if the user * haven't customized their sorting column */ defaultSortKey?: string; /** * Method called to load child views if any */ loadChildViews?: (view: IView) => Promise; } export declare class View implements IView { private _view; constructor(view: IView); get id(): string; get name(): string; get caption(): string | undefined; get emptyTitle(): string | undefined; get emptyCaption(): string | undefined; get getContents(): (path: string, options: IGetContentsOptions) => Promise; get hidden(): true | undefined; get icon(): string; set icon(icon: string); get order(): number | undefined; set order(order: number | undefined); get params(): Record | undefined; set params(params: Record | undefined); get columns(): IColumn[] | undefined; get emptyView(): ((div: HTMLDivElement) => void) | undefined; get parent(): string | undefined; get sticky(): boolean | undefined; get expanded(): boolean | undefined; set expanded(expanded: boolean | undefined); get defaultSortKey(): string | undefined; get loadChildViews(): ((view: IView) => Promise) | undefined; } /** * Validate a view interface to check all required properties are satisfied. * * @param view the view to check * @throws {Error} if the view is not valid */ export declare function validateView(view: IView): void;