|
|
@ -85,37 +85,7 @@ import { |
|
|
templateUrl: './assistant.html' |
|
|
templateUrl: './assistant.html' |
|
|
}) |
|
|
}) |
|
|
export class GfAssistantComponent implements OnChanges, OnDestroy, OnInit { |
|
|
export class GfAssistantComponent implements OnChanges, OnDestroy, OnInit { |
|
|
@HostListener('document:keydown', ['$event']) onKeydown( |
|
|
public static readonly SEARCH_RESULTS_DEFAULT_LIMIT = 5; |
|
|
event: KeyboardEvent |
|
|
|
|
|
) { |
|
|
|
|
|
if (!this.isOpen) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (event.key === 'ArrowDown' || event.key === 'ArrowUp') { |
|
|
|
|
|
for (const item of this.assistantListItems) { |
|
|
|
|
|
item.removeFocus(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.keyManager.onKeydown(event); |
|
|
|
|
|
|
|
|
|
|
|
const currentAssistantListItem = this.getCurrentAssistantListItem(); |
|
|
|
|
|
|
|
|
|
|
|
if (currentAssistantListItem?.linkElement) { |
|
|
|
|
|
currentAssistantListItem.linkElement.nativeElement?.scrollIntoView({ |
|
|
|
|
|
behavior: 'smooth', |
|
|
|
|
|
block: 'center' |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
} else if (event.key === 'Enter') { |
|
|
|
|
|
const currentAssistantListItem = this.getCurrentAssistantListItem(); |
|
|
|
|
|
|
|
|
|
|
|
if (currentAssistantListItem?.linkElement) { |
|
|
|
|
|
currentAssistantListItem.linkElement.nativeElement?.click(); |
|
|
|
|
|
event.stopPropagation(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Input() deviceType: string; |
|
|
@Input() deviceType: string; |
|
|
@Input() hasPermissionToAccessAdminControl: boolean; |
|
|
@Input() hasPermissionToAccessAdminControl: boolean; |
|
|
@ -124,13 +94,12 @@ export class GfAssistantComponent implements OnChanges, OnDestroy, OnInit { |
|
|
@Input() user: User; |
|
|
@Input() user: User; |
|
|
|
|
|
|
|
|
@ViewChild('menuTrigger') menuTriggerElement: MatMenuTrigger; |
|
|
@ViewChild('menuTrigger') menuTriggerElement: MatMenuTrigger; |
|
|
@ViewChild('search', { static: true }) searchElement: ElementRef; |
|
|
@ViewChild('search', { static: true }) |
|
|
|
|
|
searchElement: ElementRef<HTMLInputElement>; |
|
|
|
|
|
|
|
|
@ViewChildren(GfAssistantListItemComponent) |
|
|
@ViewChildren(GfAssistantListItemComponent) |
|
|
assistantListItems: QueryList<GfAssistantListItemComponent>; |
|
|
assistantListItems: QueryList<GfAssistantListItemComponent>; |
|
|
|
|
|
|
|
|
public static readonly SEARCH_RESULTS_DEFAULT_LIMIT = 5; |
|
|
|
|
|
|
|
|
|
|
|
public accounts: AccountWithPlatform[] = []; |
|
|
public accounts: AccountWithPlatform[] = []; |
|
|
public assetClasses: Filter[] = []; |
|
|
public assetClasses: Filter[] = []; |
|
|
public dateRangeFormControl = new FormControl<string | null>(null); |
|
|
public dateRangeFormControl = new FormControl<string | null>(null); |
|
|
@ -187,6 +156,37 @@ export class GfAssistantComponent implements OnChanges, OnDestroy, OnInit { |
|
|
addIcons({ closeCircleOutline, closeOutline, searchOutline }); |
|
|
addIcons({ closeCircleOutline, closeOutline, searchOutline }); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@HostListener('document:keydown', ['$event']) |
|
|
|
|
|
public onKeydown(event: KeyboardEvent) { |
|
|
|
|
|
if (!this.isOpen) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (event.key === 'ArrowDown' || event.key === 'ArrowUp') { |
|
|
|
|
|
for (const item of this.assistantListItems) { |
|
|
|
|
|
item.removeFocus(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.keyManager.onKeydown(event); |
|
|
|
|
|
|
|
|
|
|
|
const currentAssistantListItem = this.getCurrentAssistantListItem(); |
|
|
|
|
|
|
|
|
|
|
|
if (currentAssistantListItem?.linkElement) { |
|
|
|
|
|
currentAssistantListItem.linkElement.nativeElement?.scrollIntoView({ |
|
|
|
|
|
behavior: 'smooth', |
|
|
|
|
|
block: 'center' |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
} else if (event.key === 'Enter') { |
|
|
|
|
|
const currentAssistantListItem = this.getCurrentAssistantListItem(); |
|
|
|
|
|
|
|
|
|
|
|
if (currentAssistantListItem?.linkElement) { |
|
|
|
|
|
currentAssistantListItem.linkElement.nativeElement?.click(); |
|
|
|
|
|
event.stopPropagation(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public ngOnInit() { |
|
|
public ngOnInit() { |
|
|
this.assetClasses = Object.keys(AssetClass).map((assetClass) => { |
|
|
this.assetClasses = Object.keys(AssetClass).map((assetClass) => { |
|
|
return { |
|
|
return { |
|
|
|