From 8ddb3e80b7674cf7906a21e7ed3cee1fc385ff2a Mon Sep 17 00:00:00 2001 From: Michael Shamoon <4887959+shamoon@users.noreply.github.com> Date: Wed, 24 Mar 2021 12:21:51 -0700 Subject: [PATCH] Add timeout for clearing last search term on select blur --- .../components/common/input/select/select.component.html | 3 ++- .../app/components/common/input/select/select.component.ts | 6 ++++++ .../app/components/common/input/tags/tags.component.html | 3 ++- .../src/app/components/common/input/tags/tags.component.ts | 6 ++++++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src-ui/src/app/components/common/input/select/select.component.html b/src-ui/src/app/components/common/input/select/select.component.html index 59d0f9ca3..a2834a1c9 100644 --- a/src-ui/src/app/components/common/input/select/select.component.html +++ b/src-ui/src/app/components/common/input/select/select.component.html @@ -11,7 +11,8 @@ bindValue="id" (change)="onChange(value)" (search)="onSearch($event)" - (focus)="onFocus()"> + (focus)="onFocus()" + (blur)="onBlur()">
diff --git a/src-ui/src/app/components/common/input/select/select.component.ts b/src-ui/src/app/components/common/input/select/select.component.ts index 6eaf7795f..438925d32 100644 --- a/src-ui/src/app/components/common/input/select/select.component.ts +++ b/src-ui/src/app/components/common/input/select/select.component.ts @@ -63,4 +63,10 @@ export class SelectComponent extends AbstractInputComponent { this._lastSearchTerm = $event.term } + onBlur() { + setTimeout(() => { + this._lastSearchTerm = null + }, 3000); + } + } diff --git a/src-ui/src/app/components/common/input/tags/tags.component.html b/src-ui/src/app/components/common/input/tags/tags.component.html index 5500930bb..df6621fb0 100644 --- a/src-ui/src/app/components/common/input/tags/tags.component.html +++ b/src-ui/src/app/components/common/input/tags/tags.component.html @@ -9,7 +9,8 @@ [hideSelected]="true" (change)="onChange(value)" (search)="onSearch($event)" - (focus)="onFocus()"> + (focus)="onFocus()" + (blur)="onBlur()"> diff --git a/src-ui/src/app/components/common/input/tags/tags.component.ts b/src-ui/src/app/components/common/input/tags/tags.component.ts index 336341bc3..a1a803b61 100644 --- a/src-ui/src/app/components/common/input/tags/tags.component.ts +++ b/src-ui/src/app/components/common/input/tags/tags.component.ts @@ -113,4 +113,10 @@ export class TagsComponent implements OnInit, ControlValueAccessor { this._lastSearchTerm = $event.term } + onBlur() { + setTimeout(() => { + this._lastSearchTerm = null + }, 3000); + } + }