[AAE-849] improve search component (#5245)

This commit is contained in:
Silviu Popa
2019-11-14 01:50:29 +02:00
committed by Eugenio Romano
parent c0c7f0cc1c
commit adbee04c2c
2 changed files with 8 additions and 3 deletions

View File

@@ -65,6 +65,9 @@ export class SearchTextInputComponent implements OnInit, OnDestroy {
@Input()
focusListener: Observable<FocusEvent>;
@Input()
collapseOnSubmit: boolean = true;
@Input()
defaultState: SearchTextStateEnum = SearchTextStateEnum.collapsed;
@@ -147,7 +150,7 @@ export class SearchTextInputComponent implements OnInit, OnDestroy {
}
applySearchFocus(animationDoneEvent) {
if (animationDoneEvent.toState === 'active') {
if (animationDoneEvent.toState === 'active' && this.defaultState !== SearchTextStateEnum.expanded) {
this.searchInput.nativeElement.focus();
}
}
@@ -238,7 +241,9 @@ export class SearchTextInputComponent implements OnInit, OnDestroy {
searchSubmit(event: any) {
this.submit.emit(event);
this.toggleSearchBar();
if (this.collapseOnSubmit) {
this.toggleSearchBar();
}
}
activateToolbar(): boolean {