dockview
Version:
Zero dependency layout manager supporting tabs, grids and splitviews with ReactJS support
57 lines (56 loc) • 1.76 kB
JavaScript
import { ReactPart } from '../react';
export class ReactWatermarkPart {
constructor(id, component, reactPortalStore) {
this.id = id;
this.component = component;
this.reactPortalStore = reactPortalStore;
this._groupRef = {
value: undefined,
};
this._element = document.createElement('div');
this._element.style.height = '100%';
this._element.style.width = '100%';
}
get element() {
return this._element;
}
init(parameters) {
this.parameters = parameters;
this.part = new ReactPart(this.element, this.reactPortalStore, this.component, {
params: parameters.params,
api: parameters.api,
containerApi: parameters.containerApi,
close: () => {
if (this._groupRef.value) {
parameters.containerApi.removeGroup(this._groupRef.value);
}
},
});
}
focus() {
// noop
}
update(params) {
var _a, _b;
if (this.parameters) {
this.parameters.params = params.params;
}
(_a = this.part) === null || _a === void 0 ? void 0 : _a.update({ params: ((_b = this.parameters) === null || _b === void 0 ? void 0 : _b.params) || {} });
}
toJSON() {
return {
id: this.id,
};
}
layout(width, height) {
// noop - retrieval from api
}
updateParentGroup(group, isPanelVisible) {
// noop - retrieval from api
this._groupRef.value = group;
}
dispose() {
var _a;
(_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();
}
}