Search input: search on enter
This commit is contained in:
parent
ad20ad1ea9
commit
95e382fc62
|
@ -53,6 +53,16 @@ export class SearchInputComponent implements OnInit {
|
|||
constructor(private cdr: ChangeDetectorRef) {
|
||||
}
|
||||
|
||||
@HostListener('window:keydown', ['$event'])
|
||||
keyEvent(event: KeyboardEvent) {
|
||||
if(this.input.focused) {
|
||||
if(event.code === 'Enter') {
|
||||
event.preventDefault();
|
||||
this.search(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@HostListener('document:click', ['$event'])
|
||||
click(event) {
|
||||
if(event.isTrusted && this.expandable && !this.disabled) {
|
||||
|
@ -72,7 +82,7 @@ export class SearchInputComponent implements OnInit {
|
|||
}
|
||||
}
|
||||
|
||||
public search(event) {
|
||||
public search(event) {
|
||||
if(!this.disabled) {
|
||||
if (this.expandable) {
|
||||
this.expand(!this.expanded);
|
||||
|
|
Loading…
Reference in New Issue