sparnatural
Version:
Visual client-side SPARQL query builder and knowledge graph exploration tool
42 lines • 3.12 kB
JavaScript
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _DisplayBtn_instances, _DisplayBtn_addClickListener;
import { HTMLComponent } from "../HtmlComponent";
export class DisplayBtn extends HTMLComponent {
constructor(ParentComponent, callBack) {
let widgetHtml = $(`<a class="displayButton">
${"<svg class=\"icon-arrow-bottom\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\" viewBox=\"0 0 14.2 7.5\" style=\"enable-background:new 0 0 14.2 7.5;\" xml:space=\"preserve\"><style type=\"text/css\">.st0{fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;}</style><polyline class=\"st0\" points=\"0.4,0.4 7.1,7.1 13.8,0.4 \"/></svg>" /* UiuxConfig.ICON_ARROW_BOTTOM */}
</a>`);
super("VariableSelectorDisplay", ParentComponent, widgetHtml);
_DisplayBtn_instances.add(this);
this.selected = false;
this.callBack = callBack;
}
render() {
super.render();
__classPrivateFieldGet(this, _DisplayBtn_instances, "m", _DisplayBtn_addClickListener).call(this);
return this;
}
}
_DisplayBtn_instances = new WeakSet(), _DisplayBtn_addClickListener = function _DisplayBtn_addClickListener() {
// add clicklistener
this.widgetHtml.on("click", (e) => {
this.selected = this.selected ? false : true;
if (this.selected) {
this.widgetHtml = $(`<a class="displayButton">
${"<svg class=\"icon-arrow-top\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\" viewBox=\"0 0 14.2 7.5\" style=\"enable-background:new 0 0 14.2 7.5;\" xml:space=\"preserve\"><style type=\"text/css\">.st0{fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;}</style><polyline class=\"st0\" points=\"13.8,7.1 7.1,0.4 0.4,7.1 \"/></svg>" /* UiuxConfig.ICON_ARROW_TOP */}
</a>`);
}
else {
this.widgetHtml = $(`<a class="displayButton">
${"<svg class=\"icon-arrow-bottom\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\" viewBox=\"0 0 14.2 7.5\" style=\"enable-background:new 0 0 14.2 7.5;\" xml:space=\"preserve\"><style type=\"text/css\">.st0{fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;}</style><polyline class=\"st0\" points=\"0.4,0.4 7.1,7.1 13.8,0.4 \"/></svg>" /* UiuxConfig.ICON_ARROW_BOTTOM */}
</a>`);
}
this.callBack(this.selected);
this.render();
});
};
//# sourceMappingURL=DisplayBtn.js.map