sparnatural
Version:
Visual client-side SPARQL query builder and knowledge graph exploration tool
22 lines • 981 B
JavaScript
// This Action gets called when an SelctViewVar ("eye") Button is clicked
// Is also always called for the first variable added
export function selectViewVar(actionStore, payload, target) {
// delete if unselected OR add if variable was selected
if (!payload.selected)
deleteVariable(actionStore, payload.val);
if (payload.selected)
addVariable(actionStore, payload.val);
}
function addVariable(actionStore, val) {
if (actionStore.sparnatural.variableSection.variableOrderMenu.draggables.find((d) => {
return d.state.selectedVariable.variable === val.variable;
}))
return; // draggable already exists
//add a draggable
actionStore.sparnatural.variableSection.variableOrderMenu.addDraggableComponent(val);
}
function deleteVariable(actionStore, val) {
//remove a draggable
actionStore.sparnatural.variableSection.variableOrderMenu.removeDraggableByVarName(val.variable);
}
//# sourceMappingURL=SelectViewVar.js.map