mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-25 01:13:25 +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()
|
||||
{
|
||||
super.connectedCallback();
|
||||
|
||||
document.addEventListener("click", this.handleDocumentClick);
|
||||
}
|
||||
|
||||
disconnectedCallback()
|
||||
{
|
||||
super.disconnectedCallback();
|
||||
document.removeEventListener("click", this.handleDocumentClick);
|
||||
}
|
||||
|
||||
updated(changedProperties : PropertyValues)
|
||||
@ -242,6 +239,7 @@ export class Et2TreeDropdown extends SearchMixin<Constructor<any> & Et2InputWidg
|
||||
return undefined;
|
||||
}
|
||||
|
||||
document.addEventListener("click", this.handleDocumentClick);
|
||||
this.open = true;
|
||||
this.requestUpdate("open", false)
|
||||
return this.updateComplete
|
||||
@ -255,6 +253,8 @@ export class Et2TreeDropdown extends SearchMixin<Constructor<any> & Et2InputWidg
|
||||
return undefined;
|
||||
}
|
||||
|
||||
document.removeEventListener("click", this.handleDocumentClick);
|
||||
|
||||
this.open = false;
|
||||
this._popup.active = false;
|
||||
this._searchNode.value = "";
|
||||
@ -510,10 +510,12 @@ export class Et2TreeDropdown extends SearchMixin<Constructor<any> & Et2InputWidg
|
||||
{
|
||||
this._popup.active = false;
|
||||
this._searchNode.value = "";
|
||||
document.removeEventListener("click", this.handleDocumentClick);
|
||||
}
|
||||
else
|
||||
{
|
||||
this._popup.active = true;
|
||||
document.addEventListener("click", this.handleDocumentClick);
|
||||
}
|
||||
this.open = this._popup.active;
|
||||
this.treeOrSearch = "tree";
|
||||
|
Loading…
Reference in New Issue
Block a user