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