@voila-dashboards/jupyterlab-gridstack
Version:
A gridstack-based template for [](https://github.com/voila-dashboards/voila).
193 lines (192 loc) • 5.27 kB
TypeScript
import { CellList, INotebookModel, NotebookPanel, StaticNotebook } from '@jupyterlab/notebook';
import { ICellModel } from '@jupyterlab/cells';
import { IRenderMimeRegistry } from '@jupyterlab/rendermime';
import { IEditorMimeTypeService } from '@jupyterlab/codeeditor';
import { DocumentRegistry } from '@jupyterlab/docregistry';
import { ISignal } from '@lumino/signaling';
import { GridStackItemWidget } from '../item';
import { DashboardView, DashboardCellView, CellChange } from '../format';
export declare const VIEW = "grid_default";
/**
* A gridstack model to keep the state.
*/
export declare class GridStackModel {
/**
* Construct a `GridStackModel`.
*
* @param options - The options to construct a new `GridStackModel`.
*/
constructor(options: GridStackModel.IOptions);
/**
* A signal emitted when the model is ready.
*/
get ready(): ISignal<this, null>;
/**
* A signal emitted when a cell is removed.
*/
get cellRemoved(): ISignal<this, CellChange>;
/**
* A signal emitted when a cell pinned.
*/
get cellPinned(): ISignal<this, CellChange>;
/**
* A signal emitted when the model state changes.
*/
get stateChanged(): ISignal<this, null>;
/**
* A signal emitted when the model content changes.
*/
get contentChanged(): ISignal<this, null>;
/**
* The rendermime instance for this context.
*/
readonly rendermime: IRenderMimeRegistry;
/**
* A notebook panel content factory.
*/
readonly contentFactory: NotebookPanel.IContentFactory;
/**
* The service used to look up mime types.
*/
readonly mimeTypeService: IEditorMimeTypeService;
/**
* A config object for cell editors.
*/
get editorConfig(): StaticNotebook.IEditorConfig;
/**
* A config object for cell editors.
*
* @param value - A `StaticNotebook.IEditorConfig`.
*/
set editorConfig(value: StaticNotebook.IEditorConfig);
/**
* A config object for notebook widget.
*/
get notebookConfig(): StaticNotebook.INotebookConfig;
/**
* A config object for notebook widget.
*
* @param value - A `StaticNotebook.INotebookConfig`.
*/
set notebookConfig(value: StaticNotebook.INotebookConfig);
set executed(value: boolean);
/**
* Getter for the dashboard metadata info.
*/
get info(): DashboardView;
/**
* Setter for the dashboard metadata info.
*
* @param value - The new `DashboardView` metadata info.
*/
set info(info: DashboardView);
/**
* The Notebook's cells.
*/
get cells(): CellList;
/**
* Ids of the notebooks's deleted cells.
*/
get deletedCells(): string[];
/**
* Get the dashboard cell's metadata.
*
* @param id - Cell id.
*/
getCellInfo(id: string): DashboardCellView | undefined;
/**
* Set the dashboard cell's metadata.
*
* @param id - Cell id.
* @param info - DashboardCellView.
*/
setCellInfo(id: string, info: DashboardCellView): void;
/**
* Hide a cell.
*
* @param id - Cell id.
*/
hideCell(id: string): void;
/**
* Lock/unlock a cell.
*
* @param id - Cell id.
*/
lockCell(id: string, lock: boolean): void;
/**
* Create a new cell widget from a `CellModel`.
*
* @param cellModel - `ICellModel`.
*/
createCell(cellModel: ICellModel, locked: boolean): GridStackItemWidget;
/**
* Execute a CodeCell.
*
* @param cell - `ICellModel`.
*/
execute(cell: ICellModel): void;
private readonly _mutex;
/**
* Update cells.
*/
private _updateCells;
/**
* Check the dashboard notebook's metadata.
*/
private _checkMetadata;
/**
* Check the dashboard cell's metadata.
*/
private _checkCellsMetadata;
private _itemChanged;
/**
* Check the dashboard cell metadata.
*
* @param cell - `ICellModel`.
*/
private _checkCellMetadata;
private _context;
private _editorConfig;
private _notebookConfig;
private _info;
private _ystate;
private _ready;
private _cellRemoved;
private _cellPinned;
private _stateChanged;
private _contentChanged;
}
/**
* A namespace for GridStackModel statics.
*/
export declare namespace GridStackModel {
/**
* Notebook config interface for GridStackModel
*/
interface IOptions {
/**
* The Notebook context.
*/
context: DocumentRegistry.IContext<INotebookModel>;
/**
* The rendermime instance for this context.
*/
rendermime: IRenderMimeRegistry;
/**
* A notebook panel content factory.
*/
contentFactory: NotebookPanel.IContentFactory;
/**
* The service used to look up mime types.
*/
mimeTypeService: IEditorMimeTypeService;
/**
* A config object for cell editors
*/
editorConfig: StaticNotebook.IEditorConfig;
/**
* A config object for notebook widget
*/
notebookConfig: StaticNotebook.INotebookConfig;
}
}