1 | import { Toolbar } from '@jupyterlab/apputils';
|
2 | import { Contents } from '@jupyterlab/services';
|
3 | import { ITranslator } from '@jupyterlab/translation';
|
4 | import { IIterator } from '@lumino/algorithm';
|
5 | import { PanelLayout, Widget } from '@lumino/widgets';
|
6 | import { BreadCrumbs } from './crumbs';
|
7 | import { DirListing } from './listing';
|
8 | import { FilterFileBrowserModel } from './model';
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 | export declare class FileBrowser extends Widget {
|
17 | |
18 |
|
19 |
|
20 |
|
21 |
|
22 | constructor(options: FileBrowser.IOptions);
|
23 | /**
|
24 | * The model used by the file browser.
|
25 | */
|
26 | readonly model: FilterFileBrowserModel;
|
27 | /**
|
28 | * The toolbar used by the file browser.
|
29 | */
|
30 | readonly toolbar: Toolbar<Widget>;
|
31 | /**
|
32 | * Override Widget.layout with a more specific PanelLayout type.
|
33 | */
|
34 | layout: PanelLayout;
|
35 | /**
|
36 | * Whether to show active file in file browser
|
37 | */
|
38 | get navigateToCurrentDirectory(): boolean;
|
39 | set navigateToCurrentDirectory(value: boolean);
|
40 | /**
|
41 | * Whether to show the last modified column
|
42 | */
|
43 | get showLastModifiedColumn(): boolean;
|
44 | set showLastModifiedColumn(value: boolean);
|
45 | /**
|
46 | * Whether to use fuzzy filtering on file names.
|
47 | */
|
48 | set useFuzzyFilter(value: boolean);
|
49 | /**
|
50 | * Whether to show hidden files
|
51 | */
|
52 | get showHiddenFiles(): boolean;
|
53 | set showHiddenFiles(value: boolean);
|
54 | /**
|
55 | * Create an iterator over the listing's selected items.
|
56 | *
|
57 | * @returns A new iterator over the listing's selected items.
|
58 | */
|
59 | selectedItems(): IIterator<Contents.IModel>;
|
60 | /**
|
61 | * Select an item by name.
|
62 | *
|
63 | * @param name - The name of the item to select.
|
64 | */
|
65 | selectItemByName(name: string): Promise<void>;
|
66 | clearSelectedItems(): void;
|
67 | /**
|
68 | * Rename the first currently selected item.
|
69 | *
|
70 | * @returns A promise that resolves with the new name of the item.
|
71 | */
|
72 | rename(): Promise<string>;
|
73 | /**
|
74 | * Cut the selected items.
|
75 | */
|
76 | cut(): void;
|
77 | /**
|
78 | * Copy the selected items.
|
79 | */
|
80 | copy(): void;
|
81 | /**
|
82 | * Paste the items from the clipboard.
|
83 | *
|
84 | * @returns A promise that resolves when the operation is complete.
|
85 | */
|
86 | paste(): Promise<void>;
|
87 | /**
|
88 | * Create a new directory
|
89 | */
|
90 | createNewDirectory(): void;
|
91 | /**
|
92 | * Create a new file
|
93 | */
|
94 | createNewFile(options: FileBrowser.IFileOptions): void;
|
95 | /**
|
96 | * Delete the currently selected item(s).
|
97 | *
|
98 | * @returns A promise that resolves when the operation is complete.
|
99 | */
|
100 | delete(): Promise<void>;
|
101 | /**
|
102 | * Duplicate the currently selected item(s).
|
103 | *
|
104 | * @returns A promise that resolves when the operation is complete.
|
105 | */
|
106 | duplicate(): Promise<void>;
|
107 | /**
|
108 | * Download the currently selected item(s).
|
109 | */
|
110 | download(): Promise<void>;
|
111 | /**
|
112 | * Shut down kernels on the applicable currently selected items.
|
113 | *
|
114 | * @returns A promise that resolves when the operation is complete.
|
115 | */
|
116 | shutdownKernels(): Promise<void>;
|
117 | /**
|
118 | * Select next item.
|
119 | */
|
120 | selectNext(): void;
|
121 | /**
|
122 | * Select previous item.
|
123 | */
|
124 | selectPrevious(): void;
|
125 | /**
|
126 | * Find a model given a click.
|
127 | *
|
128 | * @param event - The mouse event.
|
129 | *
|
130 | * @returns The model for the selected file.
|
131 | */
|
132 | modelForClick(event: MouseEvent): Contents.IModel | undefined;
|
133 | /**
|
134 | * Create the underlying DirListing instance.
|
135 | *
|
136 | * @param options - The DirListing constructor options.
|
137 | *
|
138 | * @returns The created DirListing instance.
|
139 | */
|
140 | protected createDirListing(options: DirListing.IOptions): DirListing;
|
141 | protected translator: ITranslator;
|
142 | /**
|
143 | * Handle a connection lost signal from the model.
|
144 | */
|
145 | private _onConnectionFailure;
|
146 | protected listing: DirListing;
|
147 | protected crumbs: BreadCrumbs;
|
148 | private _trans;
|
149 | private _filenameSearcher;
|
150 | private _manager;
|
151 | private _directoryPending;
|
152 | private _filePending;
|
153 | private _navigateToCurrentDirectory;
|
154 | private _showLastModifiedColumn;
|
155 | private _useFuzzyFilter;
|
156 | private _showHiddenFiles;
|
157 | }
|
158 | /**
|
159 | * The namespace for the `FileBrowser` class statics.
|
160 | */
|
161 | export declare namespace FileBrowser {
|
162 | /**
|
163 | * An options object for initializing a file browser widget.
|
164 | */
|
165 | interface IOptions {
|
166 | |
167 |
|
168 |
|
169 | id: string;
|
170 | |
171 |
|
172 |
|
173 | model: FilterFileBrowserModel;
|
174 | |
175 |
|
176 |
|
177 |
|
178 |
|
179 | renderer?: DirListing.IRenderer;
|
180 | |
181 |
|
182 |
|
183 |
|
184 |
|
185 |
|
186 |
|
187 |
|
188 | restore?: boolean;
|
189 | |
190 |
|
191 |
|
192 | translator?: ITranslator;
|
193 | }
|
194 | |
195 |
|
196 |
|
197 | interface IFileOptions {
|
198 | |
199 |
|
200 |
|
201 | ext: string;
|
202 | }
|
203 | }
|