All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.resources.gate.g-time-interval-selector.js Maven / Gradle / Ivy

There is a newer version: 12.3.1
Show newest version
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