import { INode } from '@nextcloud/files'; import { IFilePickerButton, IFilePickerButtonFactory, IFilePickerCanPick, IFilePickerFilter } from './components/types.ts'; /** * @deprecated */ export declare enum FilePickerType { Choose = 1, Move = 2, Copy = 3, CopyMove = 4, Custom = 5 } /** * Error that is thrown in the rejected promise when the FilePicker was closed */ export declare class FilePickerClosed extends Error { } export declare class FilePicker { private title; private multiSelect; private mimeTypeFilter; private directoriesAllowed; private noMenu; private buttons; private path?; private filter?; private canPick?; private container?; private disabledNavigation; constructor(title: string, multiSelect: IsMultiSelect, mimeTypeFilter: string[], directoriesAllowed: boolean, noMenu: boolean, buttons: IFilePickerButton[] | IFilePickerButtonFactory, path?: string, filter?: IFilePickerFilter, canPick?: IFilePickerCanPick, container?: string, disabledNavigation?: boolean); /** * Pick files using the FilePicker. * * @return Promise with array of picked files or rejected promise on close without picking */ pickNodes(): Promise; /** * Pick files using the FilePicker * * @return Promise with array of paths of picked files or rejected promise on close without picking */ pick(): Promise; } export declare class FilePickerBuilder { private title; private multiSelect; private mimeTypeFilter; private directoriesAllowed; private noMenu; private path?; private filter?; private canPick?; private buttons; private container?; private disabledNavigation; /** * Construct a new FilePicker * * @param title Title of the FilePicker */ constructor(title: string); /** * Set the container where the FilePicker will be mounted * By default 'body' is used * * @param container The dialog container */ setContainer(container: string): this; /** * Enable or disable picking multiple files * * @param ms True to enable picking multiple files, false otherwise */ setMultiSelect(ms: T): FilePickerBuilder; /** * Add allowed MIME type * * @param filter MIME type to allow */ addMimeTypeFilter(filter: string): this; /** * Set allowed MIME types * * @param filter Array of allowed MIME types */ setMimeTypeFilter(filter: string[]): this; /** * Add a button to the FilePicker * Note: This overrides any previous `setButtonFactory` call * * @param button The button */ addButton(button: IFilePickerButton): this; /** * Set the button factory which is used to generate buttons from current view, path and selected nodes * Note: This overrides any previous `addButton` call * * @param factory The button factory */ setButtonFactory(factory: IFilePickerButtonFactory): this; /** * Set FilePicker type based on legacy file picker types * * @param type The legacy filepicker type to emulate * @deprecated Use `addButton` or `setButtonFactory` instead as with setType you do not know which button was pressed */ setType(type: FilePickerType): this; /** * Allow to pick directories besides files * * @param allow True to allow picking directories */ allowDirectories(allow?: boolean): this; /** * Allow to create New folders * * @param noMenu True to hide menu */ setNoMenu(noMenu?: boolean): this; /** * Set starting path of the FilePicker * * @param path Path to start from picking */ startAt(path: string): this; /** * Add filter function to filter file list of FilePicker * * @param filter Filter function to apply */ setFilter(filter: IFilePickerFilter): this; /** * Add function to allow or not picking a node * * @param canPick Function to decide if a node can be picked */ setCanPick(canPick: IFilePickerCanPick): this; /** * Disable navigation (view selection) */ disableNavigation(): this; /** * Construct the configured FilePicker */ build(): FilePicker; } /** * * @param title Title of the file picker */ export declare function getFilePickerBuilder(title: string): FilePickerBuilder;