UNPKG

@voila-dashboards/jupyterlab-gridstack

Version:

A gridstack-based template for [![voila-gridstack](assets/voila.png)](https://github.com/voila-dashboards/voila).

40 lines (39 loc) 1.14 kB
import { Panel } from '@lumino/widgets'; import { GridStackItemModel } from './model'; import { GridStackItemToolbar } from './toolbar'; /** * A Lumino widget for gridstack items. */ export class GridStackItemWidget extends Panel { constructor(cell, options) { super(); this.removeClass('lm-Widget'); this.removeClass('p-Widget'); this.addClass('grid-stack-item'); this._model = new GridStackItemModel(options); const content = new Panel(); content.addClass('grid-stack-item-content'); this._toolbar = new GridStackItemToolbar(this._model); content.addWidget(this._toolbar); cell.addClass('grid-item-widget'); content.addWidget(cell); this.addWidget(content); } dispose() { if (this.isDisposed) { return; } this._toolbar.dispose(); this._model.dispose(); super.dispose(); } get cellId() { return this._model.cellId; } get isLocked() { return this._model.isLocked; } get stateChanged() { return this._model.stateChanged; } }