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