sparnatural
Version:
Visual client-side SPARQL query builder and knowledge graph exploration tool
35 lines • 1.3 kB
JavaScript
import { I18n } from "../../settings/I18n";
import { HTMLComponent } from "../HtmlComponent";
export class VariableOptionsSelectBtn extends HTMLComponent {
constructor(ParentComponent, callBack) {
let input = $(`
<input type="checkbox">
<span class="slider round">
</span>
</input>
`);
let swithHtml = $(`<label class="switch"> </label>`).append(input);
let labelName = $(`<p>${I18n.labels.SwitchVariablesNames} </p>`);
let widgetHtml =
//$(`<label class="switch">
// </label>
// `).append(input).prepend($(`<p>${getSettings().langSearch.SwitchVariablesNames}</p>`))
$(labelName).append(swithHtml);
super("variablesOptionsSelect", ParentComponent, widgetHtml);
this.selected = false;
// add clicklistener
input[0].addEventListener("change", (e) => {
this.selected = this.selected ? false : true;
this.selected
? this.html.addClass("selected")
: this.html.removeClass("selected");
callBack(this.selected);
});
}
render() {
this.htmlParent = this.parentComponent.htmlParent;
super.render();
return this;
}
}
//# sourceMappingURL=VariableOptionsSelectBtn.js.map