UNPKG

sparnatural

Version:

Visual client-side SPARQL query builder and knowledge graph exploration tool

43 lines 2.24 kB
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 _ActionsGroup_onAddAnd; import { HTMLComponent } from "../../HtmlComponent"; import ActionAnd from "./actioncomponents/ActionAnd"; /** Groups all the actions on a line/criteria (AND / REMOVE / WHERE) even if they are visually not connected. ActionWhere for example is rendered under EndClassGroup -> EditComponent -> ActionWhere **/ class ActionsGroup extends HTMLComponent { constructor(parentCriteriaGroup, specProvider) { super("ActionsGroup", parentCriteriaGroup, null); // This code should probably be in a higher located component such as criteria group or even higher(might need to introduce one) _ActionsGroup_onAddAnd.set(this, () => { this.actions.actionAnd.html[0].dispatchEvent(new CustomEvent("addAndComponent", { bubbles: true, detail: this.parentCriteriaGroup.startClassGroup.startClassVal, })); }); this.specProvider = specProvider; //TODO refactor is this even necessary this.parentCriteriaGroup = parentCriteriaGroup; } render() { super.render(); return this; } onObjectPropertyGroupSelected() { // this is to prevent some (apprently) race condition where the action AND is recreated while it is still there // see https://github.com/sparna-git/Sparnatural/issues/787 // we destroy any existing actionAnd before rendering a new one this.actions?.actionAnd?.destroy(); this.actions = { actionAnd: new ActionAnd(this, __classPrivateFieldGet(this, _ActionsGroup_onAddAnd, "f")).render(), }; } } _ActionsGroup_onAddAnd = new WeakMap(); export default ActionsGroup; //# sourceMappingURL=ActionsGroup.js.map