Added close on background click for dates and export popup

This commit is contained in:
l_samenv
2024-08-30 11:47:51 +02:00
parent 924a6a8d1d
commit a78bbfb80d
2 changed files with 16 additions and 0 deletions

View File

@ -51,10 +51,18 @@ class DatesPopup extends HTMLElement{
hide(){
this.style.visibility = "hidden";
window.removeEventListener("click", this.backgroundClickCallback);
}
backgroundClickCallback = ({target}) => {
if(target.id == "dates-popup"){
this.hide();
}
}
show(){
this.setMaxInputDate();
window.addEventListener("click", this.backgroundClickCallback);
this.style.visibility = "visible";
}

View File

@ -131,11 +131,19 @@ class ExportPopup extends HTMLElement{
hide(){
this.style.visibility = "hidden";
window.removeEventListener("click", this.backgroundClickCallback);
}
backgroundClickCallback = ({target}) => {
if(target.id == "export-popup"){
this.hide();
}
}
show(variables, startTime, endTime){
this.style.visibility = "visible";
this.updateValuesOnOpen(variables, startTime, endTime);
window.addEventListener("click", this.backgroundClickCallback);
}
connectedCallback(){