UNPKG

2 kBTypeScriptView Raw
1import { Dialog } from '@jupyterlab/apputils';
2import { IDocumentManager } from '@jupyterlab/docmanager';
3import { Contents } from '@jupyterlab/services';
4import { ITranslator } from '@jupyterlab/translation';
5import { IScore } from '@jupyterlab/ui-components';
6/**
7 * Namespace for file dialog
8 */
9export declare namespace FileDialog {
10 /**
11 * Options for the open directory dialog
12 */
13 interface IDirectoryOptions extends Partial<Pick<Dialog.IOptions<Promise<Contents.IModel[]>>, Exclude<keyof Dialog.IOptions<Promise<Contents.IModel[]>>, 'body' | 'buttons' | 'defaultButton'>>> {
14 /**
15 * Document manager
16 */
17 manager: IDocumentManager;
18 /**
19 * The application language translator.
20 */
21 translator?: ITranslator;
22 }
23 /**
24 * Options for the open file dialog
25 */
26 interface IFileOptions extends IDirectoryOptions {
27 /**
28 * Filter function on file browser item model
29 */
30 filter?: (value: Contents.IModel) => Partial<IScore> | null;
31 /**
32 * The application language translator.
33 */
34 translator?: ITranslator;
35 }
36 /**
37 * Create and show a open files dialog.
38 *
39 * Note: if nothing is selected when `getValue` will return the browser
40 * model current path.
41 *
42 * @param options - The dialog setup options.
43 *
44 * @returns A promise that resolves with whether the dialog was accepted.
45 */
46 function getOpenFiles(options: IFileOptions): Promise<Dialog.IResult<Contents.IModel[]>>;
47 /**
48 * Create and show a open directory dialog.
49 *
50 * Note: if nothing is selected when `getValue` will return the browser
51 * model current path.
52 *
53 * @param options - The dialog setup options.
54 *
55 * @returns A promise that resolves with whether the dialog was accepted.
56 */
57 function getExistingDirectory(options: IDirectoryOptions): Promise<Dialog.IResult<Contents.IModel[]>>;
58}