UNPKG

3.43 kBTypeScriptView Raw
1import { WidgetTracker } from '@jupyterlab/apputils';
2import { IStateDB } from '@jupyterlab/statedb';
3import { Token } from '@lumino/coreutils';
4import { FileBrowser } from './browser';
5/**
6 * The path tracker token.
7 */
8export declare const IFileBrowserFactory: Token<IFileBrowserFactory>;
9/**
10 * The file browser factory interface.
11 */
12export interface IFileBrowserFactory {
13 /**
14 * Create a new file browser instance.
15 *
16 * @param id - The widget/DOM id of the file browser.
17 *
18 * @param options - The optional file browser configuration object.
19 *
20 * #### Notes
21 * The ID parameter is used to set the widget ID. It is also used as part of
22 * the unique key necessary to store the file browser's restoration data in
23 * the state database if that functionality is enabled.
24 *
25 * If, after the file browser has been generated by the factory, the ID of the
26 * resulting widget is changed by client code, the restoration functionality
27 * will not be disrupted as long as there are no ID collisions, i.e., as long
28 * as the initial ID passed into the factory is used for only one file browser
29 * instance.
30 */
31 createFileBrowser(id: string, options?: IFileBrowserFactory.IOptions): FileBrowser;
32 /**
33 * The widget tracker used by the factory to track file browsers.
34 */
35 readonly tracker: WidgetTracker<FileBrowser>;
36 /**
37 * The default file browser for the application.
38 */
39 defaultBrowser: FileBrowser;
40}
41/**
42 * A namespace for file browser factory interfaces.
43 */
44export declare namespace IFileBrowserFactory {
45 /**
46 * The options for creating a file browser using a file browser factory.
47 *
48 * #### Notes
49 * In future versions of JupyterLab, some of these options may disappear,
50 * which is a backward-incompatible API change and will necessitate a new
51 * version release. This is because in future versions, there will likely be
52 * an application-wide notion of a singleton command registry and a singleton
53 * state database.
54 */
55 interface IOptions {
56 /**
57 * Whether a file browser automatically loads its initial path.
58 *
59 * #### Notes
60 * The default is `true`.
61 */
62 auto?: boolean;
63 /**
64 * An optional `Contents.IDrive` name for the model.
65 * If given, the model will prepend `driveName:` to
66 * all paths used in file operations.
67 */
68 driveName?: string;
69 /**
70 * The time interval for browser refreshing, in ms.
71 */
72 refreshInterval?: number;
73 /**
74 * Whether a file browser automatically restores state when instantiated.
75 * The default is `true`.
76 *
77 * #### Notes
78 * The file browser model will need to be restored before for the file
79 * browser to start saving its state.
80 */
81 restore?: boolean;
82 /**
83 * The state database to use for saving file browser state and restoring it.
84 *
85 * #### Notes
86 * Unless the value `null` is set for this option, the application state
87 * database will be automatically passed in and used for state restoration.
88 */
89 state?: IStateDB | null;
90 }
91}
92/**
93 * The token that indicates the default file browser commands are loaded.
94 */
95export declare const IFileBrowserCommands: Token<void>;