|
|
@ -7,6 +7,7 @@ import { |
|
|
|
EventEmitter, |
|
|
|
HostListener, |
|
|
|
Input, |
|
|
|
OnChanges, |
|
|
|
OnDestroy, |
|
|
|
OnInit, |
|
|
|
Output, |
|
|
@ -42,7 +43,7 @@ import { ISearchResultItem, ISearchResults } from './interfaces/interfaces'; |
|
|
|
styleUrls: ['./assistant.scss'], |
|
|
|
templateUrl: './assistant.html' |
|
|
|
}) |
|
|
|
export class AssistantComponent implements OnDestroy, OnInit { |
|
|
|
export class AssistantComponent implements OnChanges, OnDestroy, OnInit { |
|
|
|
@HostListener('document:keydown', ['$event']) onKeydown( |
|
|
|
event: KeyboardEvent |
|
|
|
) { |
|
|
@ -81,6 +82,7 @@ export class AssistantComponent implements OnDestroy, OnInit { |
|
|
|
|
|
|
|
@Output() closed = new EventEmitter<void>(); |
|
|
|
@Output() dateRangeChanged = new EventEmitter<DateRange>(); |
|
|
|
@Output() selectedTagChanged = new EventEmitter<Tag>(); |
|
|
|
|
|
|
|
@ViewChild('menuTrigger') menuTriggerElement: MatMenuTrigger; |
|
|
|
@ViewChild('search', { static: true }) searchElement: ElementRef; |
|
|
@ -100,6 +102,7 @@ export class AssistantComponent implements OnDestroy, OnInit { |
|
|
|
holdings: [] |
|
|
|
}; |
|
|
|
public tags: Tag[] = []; |
|
|
|
public tagsFormControl = new FormControl<string>(undefined); |
|
|
|
|
|
|
|
private keyManager: FocusKeyManager<AssistantListItemComponent>; |
|
|
|
private unsubscribeSubject = new Subject<void>(); |
|
|
@ -159,6 +162,12 @@ export class AssistantComponent implements OnDestroy, OnInit { |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
public ngOnChanges() { |
|
|
|
this.tagsFormControl.setValue( |
|
|
|
this.user?.settings?.['filters.tags']?.[0] ?? null |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
public async initialize() { |
|
|
|
this.isLoading = true; |
|
|
|
this.keyManager = new FocusKeyManager(this.assistantListItems).withWrap(); |
|
|
@ -192,8 +201,12 @@ export class AssistantComponent implements OnDestroy, OnInit { |
|
|
|
this.closed.emit(); |
|
|
|
} |
|
|
|
|
|
|
|
public onSelectTag(tag: Tag) { |
|
|
|
console.log(tag); |
|
|
|
public onTagChange() { |
|
|
|
const selectedTag = this.tags.find(({ id }) => { |
|
|
|
return id === this.tagsFormControl.value; |
|
|
|
}); |
|
|
|
|
|
|
|
this.selectedTagChanged.emit(selectedTag); |
|
|
|
|
|
|
|
this.onCloseAssistant(); |
|
|
|
} |
|
|
|