dockview
Version:
Zero dependency layout manager supporting tabs, grids and splitviews with ReactJS support
91 lines • 3.38 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ReactContentRenderer = void 0;
var hostedContainer_1 = require("../../../hostedContainer");
var react_1 = require("../../react");
var ReactContentRenderer = /** @class */ (function () {
function ReactContentRenderer(id, component, reactPortalStore) {
this.id = id;
this.component = component;
this.reactPortalStore = reactPortalStore;
this._hostedContainer = new hostedContainer_1.HostedContainer({
id: id,
parent: document
.getElementsByClassName('dockview')
.item(0),
});
this._element = document.createElement('div');
this._element.style.height = '100%';
this._element.style.width = '100%';
}
Object.defineProperty(ReactContentRenderer.prototype, "element", {
get: function () {
return this._element;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ReactContentRenderer.prototype, "onDidBlur", {
get: function () {
return this._hostedContainer.onDidBlur;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ReactContentRenderer.prototype, "onDidFocus", {
get: function () {
return this._hostedContainer.onDidFocus;
},
enumerable: false,
configurable: true
});
ReactContentRenderer.prototype.focus = function () {
// noop
};
ReactContentRenderer.prototype.init = function (parameters) {
var _this = this;
this.parameters = parameters;
parameters.api.onDidVisibilityChange(function (event) {
if (event.isVisible) {
_this._hostedContainer.show();
_this._hostedContainer.layout(_this.element);
}
else {
_this._hostedContainer.hide();
}
});
this.part = new react_1.ReactPart(this._hostedContainer.element, this.reactPortalStore, this.component, {
params: parameters.params,
api: parameters.api,
containerApi: parameters.containerApi,
});
};
ReactContentRenderer.prototype.toJSON = function () {
return {
id: this.id,
};
};
ReactContentRenderer.prototype.update = function (params) {
var _a;
if (this.parameters) {
this.parameters.params = params.params;
}
(_a = this.part) === null || _a === void 0 ? void 0 : _a.update(params.params);
};
ReactContentRenderer.prototype.updateParentGroup = function (group, isPanelVisible) {
this._group = group;
};
ReactContentRenderer.prototype.layout = function (width, height) {
this._hostedContainer.layout(this.element);
};
ReactContentRenderer.prototype.close = function () {
return Promise.resolve(true);
};
ReactContentRenderer.prototype.dispose = function () {
var _a;
(_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();
};
return ReactContentRenderer;
}());
exports.ReactContentRenderer = ReactContentRenderer;
//# sourceMappingURL=reactContentRenderer.js.map