UNPKG

sparnatural

Version:

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

57 lines 2.41 kB
var _GroupWrapper_isRoot; import CriteriaGroup from "./criteriagroup/CriteriaGroup"; import { HTMLComponent } from "../../HtmlComponent"; import { OptionTypes } from "./criteriagroup/optionsgroup/OptionsGroup"; import GroupWrapperEventStore from "./groupwrapperevents/GroupWrapperEventStore"; import ComponentsList from "../ComponentsList"; /* GroupWrapper class represents a row in Sparnatural. It is the WrapperClass for the CriteriaGroup */ class GroupWrapper extends HTMLComponent { constructor(ParentComponent, specProvider, depth, startOrEndClassVal, renderEyeButtonOnStartClassGroup) { super("groupe", ParentComponent, null); this.optionState = OptionTypes.NONE; _GroupWrapper_isRoot.set(this, false); // Wether this GrpWrapper is the root (first) GrpWrapper this.specProvider = specProvider; this.CriteriaGroup = new CriteriaGroup(this, this.specProvider, startOrEndClassVal, renderEyeButtonOnStartClassGroup); this.depth = depth; } render() { super.render(); this.groupWrapperEventStore = new GroupWrapperEventStore(this); this.CriteriaGroup = this.CriteriaGroup.render(); return this; } isRootGrpWrapper() { return ((this.parentComponent instanceof ComponentsList) && (this.parentComponent.rootGroupWrapper == this)); } // set back state to when objectproperty was selected setObjectPropertySelectedState() { let opVal = this.CriteriaGroup.ObjectPropertyGroup.objectPropVal; //if opVal is null, then temporary lbl is shown an no endclassgroup has been selected if (!opVal) return; this.CriteriaGroup.html[0].dispatchEvent(new CustomEvent("onObjectPropertyGroupSelected", { detail: opVal })); } traversePreOrder(callBack) { callBack(this); if (this.whereChild) this.whereChild.traversePreOrder(callBack); if (this.andSibling) this.andSibling.traversePreOrder(callBack); return; } traversePostOrder(callBack) { if (this.whereChild) this.whereChild.traversePostOrder(callBack); if (this.andSibling) this.andSibling.traversePostOrder(callBack); callBack(this); return; } } _GroupWrapper_isRoot = new WeakMap(); export default GroupWrapper; //# sourceMappingURL=GroupWrapper.js.map