jupyterlab-emrys
Version:
A computational environment for Jupyter. Powered by Emrys
152 lines (151 loc) • 3.76 kB
TypeScript
import { IContents } from 'jupyter-js-services';
import { Message } from 'phosphor-messaging';
import { Widget } from 'phosphor-widget';
import { DocumentManager } from '../docmanager';
import { DirListing } from './listing';
import { FileBrowserModel } from './model';
/**
* An interface for a widget opener.
*/
export interface IWidgetOpener {
open(widget: Widget): void;
}
/**
* A widget which hosts a file browser.
*
* The widget uses the Jupyter Contents API to retreive contents,
* and presents itself as a flat list of files and directories with
* breadcrumbs.
*/
export declare class FileBrowserWidget extends Widget {
/**
* Construct a new file browser.
*
* @param model - The file browser view model.
*/
constructor(options: FileBrowserWidget.IOptions);
/**
* Get the model used by the file browser.
*
* #### Notes
* This is a read-only property.
*/
model: FileBrowserModel;
/**
* Dispose of the resources held by the file browser.
*/
dispose(): void;
/**
* Change directory.
*/
cd(path: string): Promise<void>;
/**
* Open the currently selected item(s).
*
* Changes to the first directory encountered.
*/
open(): void;
/**
* Open a file by path.
*/
openPath(path: string, widgetName?: string): Widget;
/**
* Create a new untitled file in the current directory.
*/
createNew(options: IContents.ICreateOptions): Promise<Widget>;
/**
* Rename the first currently selected item.
*/
rename(): Promise<string>;
/**
* Cut the selected items.
*/
cut(): void;
/**
* Copy the selected items.
*/
copy(): void;
/**
* Paste the items from the clipboard.
*/
paste(): Promise<void>;
/**
* Delete the currently selected item(s).
*/
delete(): Promise<void>;
/**
* Duplicate the currently selected item(s).
*/
duplicate(): Promise<void>;
/**
* Download the currently selected item(s).
*/
download(): Promise<void>;
/**
* Shut down kernels on the applicable currently selected items.
*/
shutdownKernels(): Promise<void>;
/**
* Refresh the current directory.
*/
refresh(): Promise<void>;
/**
* Select next item.
*/
selectNext(): void;
/**
* Select previous item.
*/
selectPrevious(): void;
/**
* Find a path given a click.
*/
pathForClick(event: MouseEvent): string;
/**
* A message handler invoked on an `'after-attach'` message.
*/
protected onAfterAttach(msg: Message): void;
/**
* A message handler invoked on an `'after-show'` message.
*/
protected onAfterShow(msg: Message): void;
/**
* Handle a model refresh.
*/
private _handleRefresh();
private _model;
private _crumbs;
private _buttons;
private _listing;
private _timeoutId;
private _manager;
private _opener;
}
/**
* The namespace for the `FileBrowserWidget` class statics.
*/
export declare namespace FileBrowserWidget {
/**
* An options object for initializing a file browser widget.
*/
interface IOptions {
/**
* A file browser model instance.
*/
model: FileBrowserModel;
/**
* A document manager instance.
*/
manager: DocumentManager;
/**
* A widget opener function.
*/
opener: IWidgetOpener;
/**
* An optional renderer for the directory listing area.
*
* The default is a shared instance of `DirListing.Renderer`.
*/
renderer?: DirListing.IRenderer;
}
}