sparnatural
Version:
Visual client-side SPARQL query builder and knowledge graph exploration tool
28 lines • 1.59 kB
JavaScript
import GroupWrapper from "../../GroupWrapper";
import LinkWhereBottom from "../../LinkWhereBottom";
let removeEditComponents = (grpWrapper) => {
grpWrapper.criteriaGroup.endClassGroup.html[0].dispatchEvent(new CustomEvent("removeEditComponents", { bubbles: true }));
grpWrapper.criteriaGroup.endClassGroup.editComponents = null;
};
//give it additional class childsList
export function addWhereComponent(grpWrapper, endClassVal) {
removeEditComponents(grpWrapper);
//provide endclassval as startvalue for the new group
grpWrapper.whereChild = new GroupWrapper(grpWrapper, grpWrapper, grpWrapper.specProvider,
// depth = parent depth + 1
grpWrapper.depth + 1,
// order = 1, it will be the first sibling
0, endClassVal).render();
// inherits the option state on where children
// grpWrapper.whereChild.currentOptionState = grpWrapper.currentOptionState;
grpWrapper.whereChild.setCurrentOptionState(grpWrapper.currentOptionState);
//endClassVal is new startClassVal and trigger 'change' event on ClassTypeId
let inputSelector = grpWrapper.whereChild.criteriaGroup.startClassGroup.inputSelector;
inputSelector.submitSelected();
// nice-select is 2nd place in childrenslist. move away from nice-select...
//inputSelector.html[0].children[1].classList.add("disabled");
// render the link where
grpWrapper.linkWhereBottom = new LinkWhereBottom(grpWrapper).render();
grpWrapper.html[0].dispatchEvent(new CustomEvent("redrawBackgroundAndLinks", { bubbles: true }));
}
//# sourceMappingURL=AddWhereComponent.js.map