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 | import { IScore } from '@jupyterlab/ui-components';
|
6 | /**
|
7 | * Namespace for file dialog
|
8 | */
|
9 | export 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 | * Default path to open
|
24 | */
|
25 | defaultPath?: string;
|
26 | }
|
27 | /**
|
28 | * Options for the open file dialog
|
29 | */
|
30 | interface IFileOptions extends IDirectoryOptions {
|
31 | /**
|
32 | * Filter function on file browser item model
|
33 | */
|
34 | filter?: (value: Contents.IModel) => Partial<IScore> | null;
|
35 | /**
|
36 | * The application language translator.
|
37 | */
|
38 | translator?: ITranslator;
|
39 | }
|
40 | /**
|
41 | * Create and show a open files dialog.
|
42 | *
|
43 | * Note: if nothing is selected when `getValue` will return the browser
|
44 | * model current path.
|
45 | *
|
46 | * @param options - The dialog setup options.
|
47 | *
|
48 | * @returns A promise that resolves with whether the dialog was accepted.
|
49 | */
|
50 | function getOpenFiles(options: IFileOptions): Promise<Dialog.IResult<Contents.IModel[]>>;
|
51 | /**
|
52 | * Create and show a open directory dialog.
|
53 | *
|
54 | * Note: if nothing is selected when `getValue` will return the browser
|
55 | * model current path.
|
56 | *
|
57 | * @param options - The dialog setup options.
|
58 | *
|
59 | * @returns A promise that resolves with whether the dialog was accepted.
|
60 | */
|
61 | function getExistingDirectory(options: IDirectoryOptions): Promise<Dialog.IResult<Contents.IModel[]>>;
|
62 | }
|