META-INF.resources.gate.g-time-interval-selector.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gate Show documentation
Show all versions of gate Show documentation
A multipurpose java library
let template = document.createElement("template");
template.innerHTML = `
`;
/* global customElements, template */
customElements.define('g-time-interval-selector', class extends HTMLElement
{
constructor()
{
super();
this.attachShadow({mode: "open"});
this.shadowRoot.appendChild(template.content.cloneNode(true));
this.shadowRoot.getElementById("min").addEventListener("selected", () => this.dispatchEvent(new CustomEvent('selected', {detail: this.selection})));
this.shadowRoot.getElementById("max").addEventListener("selected", () => this.dispatchEvent(new CustomEvent('selected', {detail: this.selection})));
}
set min(time)
{
this.shadowRoot.getElementById("min").time = time;
}
get min()
{
return this.shadowRoot.getElementById("min").time;
}
set max(time)
{
this.shadowRoot.getElementById("max").time = time;
}
get max()
{
return this.shadowRoot.getElementById("max").time;
}
get selection()
{
let min = this.shadowRoot.getElementById("min").selection;
let max = this.shadowRoot.getElementById("max").selection;
return min && max ? min + " - " + max : null;
}
});
© 2015 - 2024 Weber Informatics LLC | Privacy Policy