dockview
Version:
Zero dependency layout manager supporting tabs, grids and splitviews with ReactJS support
57 lines • 2.31 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.HostedPanel = void 0;
var HostedPanel = /** @class */ (function () {
function HostedPanel(panel, options) {
this.panel = panel;
this.options = options;
if (!options.parent) {
options.parent = document.getElementById('app');
options.parent.style.position = 'relative';
}
this._element = document.createElement('div');
this._element.style.visibility = 'hidden';
this._element.style.overflow = 'hidden';
// this._element.style.pointerEvents = 'none';
this._element.id = "webivew-".concat(options.id);
options.parent.appendChild(this._element);
}
Object.defineProperty(HostedPanel.prototype, "element", {
get: function () {
return this._element;
},
enumerable: false,
configurable: true
});
Object.defineProperty(HostedPanel.prototype, "id", {
get: function () {
return this.panel.id;
},
enumerable: false,
configurable: true
});
HostedPanel.prototype.hide = function () {
this._element.style.visibility = 'hidden';
};
HostedPanel.prototype.show = function () {
this._element.style.visibility = 'visible';
};
HostedPanel.prototype.layout = function (element, dimension) {
if (!this.element || !this.element.parentElement) {
return;
}
var frameRect = element.getBoundingClientRect();
var containerRect = this.element.parentElement.getBoundingClientRect();
this.element.style.position = 'absolute';
this.element.style.top = "".concat(frameRect.top - containerRect.top, "px");
this.element.style.left = "".concat(frameRect.left - containerRect.left, "px");
this.element.style.width = "".concat(dimension ? dimension.width : frameRect.width, "px");
this.element.style.height = "".concat(dimension ? dimension.height : frameRect.height, "px");
};
HostedPanel.prototype.dispose = function () {
this._element.remove();
};
return HostedPanel;
}());
exports.HostedPanel = HostedPanel;
//# sourceMappingURL=hostedPanel.js.map