UNPKG

@voila-dashboards/jupyterlab-gridstack

Version:

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

39 lines (38 loc) 1.02 kB
import { Signal } from '@lumino/signaling'; export var ItemState; (function (ItemState) { ItemState[ItemState["CLOSED"] = 0] = "CLOSED"; ItemState[ItemState["LOCKED"] = 1] = "LOCKED"; ItemState[ItemState["UNLOCKED"] = 2] = "UNLOCKED"; })(ItemState || (ItemState = {})); export class GridStackItemModel { constructor(options) { this._cellId = ''; this._cellId = options.cellId; this._isLocked = options.isLocked; this._stateChanged = new Signal(this); } get cellId() { return this._cellId; } get isLocked() { return this._isLocked; } get stateChanged() { return this._stateChanged; } dispose() { Signal.clearData(this); } close() { this._stateChanged.emit(ItemState.CLOSED); } lock() { this._isLocked = true; this._stateChanged.emit(ItemState.LOCKED); } unlock() { this._isLocked = false; this._stateChanged.emit(ItemState.UNLOCKED); } }