sparnatural
Version:
Visual client-side SPARQL query builder and knowledge graph exploration tool
29 lines • 1.92 kB
JavaScript
import CriteriaGroup from "../../criteriagroup/CriteriaGroup";
import { OptionTypes } from "../../criteriagroup/optionsgroup/OptionsGroup";
// Remove the EndClass and rerender from the point where the startClassVal got selected
export function removeEndClass(grpWrapper) {
// first delete the whereChild classes
if (grpWrapper.whereChild)
grpWrapper.whereChild.html[0].dispatchEvent(new CustomEvent("onRemoveGrp"));
// notify it is incomplete - it will become higher and remove the "completed" class
grpWrapper.criteriaGroup.endClassGroup.html[0].dispatchEvent(new CustomEvent("onGrpInputNotCompleted", { bubbles: true }));
let startVal = grpWrapper.criteriaGroup.startClassGroup.startClassVal;
grpWrapper.criteriaGroup.html.empty();
grpWrapper.criteriaGroup.html.remove();
grpWrapper.criteriaGroup = new CriteriaGroup(grpWrapper, grpWrapper.specProvider, startVal, grpWrapper.isRootGrpWrapper()).render();
// Set option state back to NONE
grpWrapper.explicitOptionState = OptionTypes.NONE;
// re-force current option state so that we get the HTML style applied
let tmpOptionState = grpWrapper.currentOptionState;
grpWrapper.setCurrentOptionState(tmpOptionState);
// set StartClassVal back to its original value
grpWrapper.criteriaGroup.startClassGroup.startClassVal = startVal;
let inputSelector = grpWrapper.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");
// there might have been variables in the variable section which now got deleted
grpWrapper.html[0].dispatchEvent(new CustomEvent("updateVarList", { bubbles: true }));
grpWrapper.html[0].dispatchEvent(new CustomEvent("generateQuery", { bubbles: true }));
}
//# sourceMappingURL=RemoveEndClass.js.map