UNPKG

dockview

Version:

Zero dependency layout manager supporting tabs, grids and splitviews with ReactJS support

141 lines 5.4 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.PanelApiImpl = void 0; var events_1 = require("../events"); var lifecycle_1 = require("../lifecycle"); /** * A core api implementation that should be used across all panel-like objects */ var PanelApiImpl = /** @class */ (function (_super) { __extends(PanelApiImpl, _super); function PanelApiImpl(id) { var _this = _super.call(this) || this; _this.id = id; _this._state = {}; _this._isFocused = false; _this._isActive = false; _this._isVisible = true; _this._width = 0; _this._height = 0; _this._onDidStateChange = new events_1.Emitter(); _this.onDidStateChange = _this._onDidStateChange.event; // _this._onDidPanelDimensionChange = new events_1.Emitter({ replay: true, }); _this.onDidDimensionsChange = _this._onDidPanelDimensionChange.event; // _this._onDidChangeFocus = new events_1.Emitter({ replay: true, }); _this.onDidFocusChange = _this._onDidChangeFocus.event; // _this._onFocusEvent = new events_1.Emitter(); _this.onFocusEvent = _this._onFocusEvent.event; // _this._onDidVisibilityChange = new events_1.Emitter({ replay: true, }); _this.onDidVisibilityChange = _this._onDidVisibilityChange.event; // _this._onVisibilityChange = new events_1.Emitter(); _this.onVisibilityChange = _this._onVisibilityChange.event; // _this._onDidActiveChange = new events_1.Emitter({ replay: true, }); _this.onDidActiveChange = _this._onDidActiveChange.event; // _this._onActiveChange = new events_1.Emitter(); _this.onActiveChange = _this._onActiveChange.event; _this.addDisposables(_this._onDidStateChange, _this._onDidPanelDimensionChange, _this._onDidChangeFocus, _this._onDidVisibilityChange, _this._onDidActiveChange, _this._onFocusEvent, _this.onDidFocusChange(function (event) { _this._isFocused = event.isFocused; }), _this.onDidActiveChange(function (event) { _this._isActive = event.isActive; }), _this.onDidVisibilityChange(function (event) { _this._isVisible = event.isVisible; }), _this.onDidDimensionsChange(function (event) { _this._width = event.width; _this._height = event.height; })); return _this; } Object.defineProperty(PanelApiImpl.prototype, "isFocused", { // get: function () { return this._isFocused; }, enumerable: false, configurable: true }); Object.defineProperty(PanelApiImpl.prototype, "isActive", { get: function () { return this._isActive; }, enumerable: false, configurable: true }); Object.defineProperty(PanelApiImpl.prototype, "isVisible", { get: function () { return this._isVisible; }, enumerable: false, configurable: true }); Object.defineProperty(PanelApiImpl.prototype, "width", { get: function () { return this._width; }, enumerable: false, configurable: true }); Object.defineProperty(PanelApiImpl.prototype, "height", { get: function () { return this._height; }, enumerable: false, configurable: true }); PanelApiImpl.prototype.setVisible = function (isVisible) { this._onVisibilityChange.fire({ isVisible: isVisible }); }; PanelApiImpl.prototype.setActive = function () { this._onActiveChange.fire(); }; PanelApiImpl.prototype.setState = function (key, value) { if (typeof key === 'object') { this._state = key; } else if (typeof value !== undefined) { this._state[key] = value; } this._onDidStateChange.fire(undefined); }; PanelApiImpl.prototype.getState = function () { return this._state; }; PanelApiImpl.prototype.getStateKey = function (key) { return this._state[key]; }; PanelApiImpl.prototype.dispose = function () { _super.prototype.dispose.call(this); }; return PanelApiImpl; }(lifecycle_1.CompositeDisposable)); exports.PanelApiImpl = PanelApiImpl; //# sourceMappingURL=panelApi.js.map