dockview-solid
Version:
Zero dependency layout manager supporting tabs, grids and splitviews
52 lines (51 loc) • 2.69 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SolidHeaderActionsRendererPart = void 0;
var dockview_core_1 = require("dockview-core");
var solid_1 = require("../solid");
/**
* SolidJS implementation of IHeaderActionsRenderer: mounts Solid components into group header actions.
*/
var SolidHeaderActionsRendererPart = /** @class */ (function () {
function SolidHeaderActionsRendererPart(component, _group) {
this.component = component;
this._group = _group;
this.mutableDisposable = new dockview_core_1.DockviewMutableDisposable();
this.element = document.createElement('div');
this.element.className = 'dv-solid-part';
this.element.style.height = '100%';
this.element.style.width = '100%';
}
SolidHeaderActionsRendererPart.prototype.init = function (parameters) {
var _this = this;
this.mutableDisposable.value = new dockview_core_1.DockviewCompositeDisposable(this._group.model.onDidAddPanel(function () { return _this.updatePanels(); }), this._group.model.onDidRemovePanel(function () { return _this.updatePanels(); }), this._group.model.onDidActivePanelChange(function () { return _this.updateActivePanel(); }), parameters.api.onDidActiveChange(function () { return _this.updateGroupActive(); }));
this.part = new solid_1.SolidPart(this.element, this.component, {
api: parameters.api,
containerApi: parameters.containerApi,
panels: this._group.model.panels,
activePanel: this._group.model.activePanel,
isGroupActive: this._group.api.isActive,
group: this._group,
});
};
SolidHeaderActionsRendererPart.prototype.update = function (event) {
var _a;
(_a = this.part) === null || _a === void 0 ? void 0 : _a.update(event.params);
};
SolidHeaderActionsRendererPart.prototype.dispose = function () {
var _a;
this.mutableDisposable.dispose();
(_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();
};
SolidHeaderActionsRendererPart.prototype.updatePanels = function () {
this.update({ params: { panels: this._group.model.panels } });
};
SolidHeaderActionsRendererPart.prototype.updateActivePanel = function () {
this.update({ params: { activePanel: this._group.model.activePanel } });
};
SolidHeaderActionsRendererPart.prototype.updateGroupActive = function () {
this.update({ params: { isGroupActive: this._group.api.isActive } });
};
return SolidHeaderActionsRendererPart;
}());
exports.SolidHeaderActionsRendererPart = SolidHeaderActionsRendererPart;