mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-28 19:03:14 +01:00
Et2TreeDropdown: stop constantly listening for document clicks, only listen when open
This commit is contained in:
parent
1b0f8683bb
commit
b7160e6eaf
@ -133,14 +133,11 @@ export class Et2TreeDropdown extends SearchMixin<Constructor<any> & Et2InputWidg
|
|||||||
connectedCallback()
|
connectedCallback()
|
||||||
{
|
{
|
||||||
super.connectedCallback();
|
super.connectedCallback();
|
||||||
|
|
||||||
document.addEventListener("click", this.handleDocumentClick);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
disconnectedCallback()
|
disconnectedCallback()
|
||||||
{
|
{
|
||||||
super.disconnectedCallback();
|
super.disconnectedCallback();
|
||||||
document.removeEventListener("click", this.handleDocumentClick);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
updated(changedProperties : PropertyValues)
|
updated(changedProperties : PropertyValues)
|
||||||
@ -242,6 +239,7 @@ export class Et2TreeDropdown extends SearchMixin<Constructor<any> & Et2InputWidg
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
document.addEventListener("click", this.handleDocumentClick);
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.requestUpdate("open", false)
|
this.requestUpdate("open", false)
|
||||||
return this.updateComplete
|
return this.updateComplete
|
||||||
@ -255,6 +253,8 @@ export class Et2TreeDropdown extends SearchMixin<Constructor<any> & Et2InputWidg
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
document.removeEventListener("click", this.handleDocumentClick);
|
||||||
|
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this._popup.active = false;
|
this._popup.active = false;
|
||||||
this._searchNode.value = "";
|
this._searchNode.value = "";
|
||||||
@ -510,10 +510,12 @@ export class Et2TreeDropdown extends SearchMixin<Constructor<any> & Et2InputWidg
|
|||||||
{
|
{
|
||||||
this._popup.active = false;
|
this._popup.active = false;
|
||||||
this._searchNode.value = "";
|
this._searchNode.value = "";
|
||||||
|
document.removeEventListener("click", this.handleDocumentClick);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this._popup.active = true;
|
this._popup.active = true;
|
||||||
|
document.addEventListener("click", this.handleDocumentClick);
|
||||||
}
|
}
|
||||||
this.open = this._popup.active;
|
this.open = this._popup.active;
|
||||||
this.treeOrSearch = "tree";
|
this.treeOrSearch = "tree";
|
||||||
|
Loading…
Reference in New Issue
Block a user