sparnatural
Version:
Visual client-side SPARQL query builder and knowledge graph exploration tool
47 lines • 2.51 kB
JavaScript
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _BgWrapper_instances, _BgWrapper_renderComponents;
import { ResetBtn } from "../buttons/ResetBtn";
import ComponentsList from "./ComponentsList";
import { HTMLComponent } from "../HtmlComponent";
import { SparnaturalElement } from "../../../SparnaturalElement";
class BgWrapper extends HTMLComponent {
constructor(ParentComponent, specProvider) {
super("builder-section", ParentComponent, null);
_BgWrapper_instances.add(this);
this.resetCallback = () => {
this.componentsList.html.empty();
this.componentsList.html.remove();
this.componentsList = null;
this.resetBtn.html.empty();
this.resetBtn.html.remove();
__classPrivateFieldGet(this, _BgWrapper_instances, "m", _BgWrapper_renderComponents).call(this);
this.html[0].dispatchEvent(new CustomEvent("resetVars", { bubbles: true }));
// redraw background so that background height of first line is recomputed - otherwise it can stay small
this.html[0].dispatchEvent(new CustomEvent("redrawBackgroundAndLinks", { bubbles: true }));
// fire an event to the outside world
this.html[0].dispatchEvent(new CustomEvent(SparnaturalElement.EVENT_RESET, {
bubbles: true,
detail: {
sparnatural: this.ParentSparnatural
}
}));
};
this.specProvider = specProvider;
this.ParentSparnatural = ParentComponent;
}
render() {
super.render();
__classPrivateFieldGet(this, _BgWrapper_instances, "m", _BgWrapper_renderComponents).call(this);
return this;
}
}
_BgWrapper_instances = new WeakSet(), _BgWrapper_renderComponents = function _BgWrapper_renderComponents() {
this.resetBtn = new ResetBtn(this, this.resetCallback).render();
this.componentsList = new ComponentsList(this, this.specProvider).render();
};
export default BgWrapper;
//# sourceMappingURL=BgWrapper.js.map