|
|
@ -169,6 +169,12 @@ export class GfAssistantComponent implements OnChanges, OnDestroy, OnInit { |
|
|
}; |
|
|
}; |
|
|
public tags: Filter[] = []; |
|
|
public tags: Filter[] = []; |
|
|
|
|
|
|
|
|
|
|
|
private keyManager: FocusKeyManager<GfAssistantListItemComponent>; |
|
|
|
|
|
private preselectionTimeout: ReturnType<typeof setTimeout>; |
|
|
|
|
|
private unsubscribeSubject = new Subject<void>(); |
|
|
|
|
|
|
|
|
|
|
|
private readonly PRESELECTION_DELAY = 100; |
|
|
|
|
|
|
|
|
private filterTypes: Filter['type'][] = [ |
|
|
private filterTypes: Filter['type'][] = [ |
|
|
'ACCOUNT', |
|
|
'ACCOUNT', |
|
|
'ASSET_CLASS', |
|
|
'ASSET_CLASS', |
|
|
@ -176,11 +182,6 @@ export class GfAssistantComponent implements OnChanges, OnDestroy, OnInit { |
|
|
'SYMBOL', |
|
|
'SYMBOL', |
|
|
'TAG' |
|
|
'TAG' |
|
|
]; |
|
|
]; |
|
|
private keyManager: FocusKeyManager<GfAssistantListItemComponent>; |
|
|
|
|
|
private preselectionTimeout: any; |
|
|
|
|
|
private unsubscribeSubject = new Subject<void>(); |
|
|
|
|
|
|
|
|
|
|
|
private readonly PRESELECTION_DELAY = 100; |
|
|
|
|
|
|
|
|
|
|
|
public constructor( |
|
|
public constructor( |
|
|
private adminService: AdminService, |
|
|
private adminService: AdminService, |
|
|
@ -347,10 +348,8 @@ export class GfAssistantComponent implements OnChanges, OnDestroy, OnInit { |
|
|
.subscribe({ |
|
|
.subscribe({ |
|
|
next: (searchResults) => { |
|
|
next: (searchResults) => { |
|
|
this.searchResults = searchResults; |
|
|
this.searchResults = searchResults; |
|
|
this.changeDetectorRef.markForCheck(); |
|
|
|
|
|
|
|
|
|
|
|
// Trigger preselection of first item
|
|
|
|
|
|
this.preselectFirstItem(); |
|
|
this.preselectFirstItem(); |
|
|
|
|
|
this.changeDetectorRef.markForCheck(); |
|
|
}, |
|
|
}, |
|
|
error: (error) => { |
|
|
error: (error) => { |
|
|
console.error('Assistant search stream error:', error); |
|
|
console.error('Assistant search stream error:', error); |
|
|
@ -591,11 +590,9 @@ export class GfAssistantComponent implements OnChanges, OnDestroy, OnInit { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public ngOnDestroy() { |
|
|
public ngOnDestroy() { |
|
|
// Clear preselection timeout
|
|
|
|
|
|
if (this.preselectionTimeout) { |
|
|
if (this.preselectionTimeout) { |
|
|
clearTimeout(this.preselectionTimeout); |
|
|
clearTimeout(this.preselectionTimeout); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
this.unsubscribeSubject.next(); |
|
|
this.unsubscribeSubject.next(); |
|
|
this.unsubscribeSubject.complete(); |
|
|
this.unsubscribeSubject.complete(); |
|
|
} |
|
|
} |
|
|
@ -610,7 +607,7 @@ export class GfAssistantComponent implements OnChanges, OnDestroy, OnInit { |
|
|
* Gets the first search result item based on priority order: |
|
|
* Gets the first search result item based on priority order: |
|
|
* Quick Links → Accounts → Holdings → Asset Profiles |
|
|
* Quick Links → Accounts → Holdings → Asset Profiles |
|
|
*/ |
|
|
*/ |
|
|
private getFirstSearchResultItem(): ISearchResultItem | null { |
|
|
private getFirstSearchResultItem() { |
|
|
// Priority order: Quick Links → Accounts → Holdings → Asset Profiles
|
|
|
// Priority order: Quick Links → Accounts → Holdings → Asset Profiles
|
|
|
if (this.searchResults.quickLinks?.length > 0) { |
|
|
if (this.searchResults.quickLinks?.length > 0) { |
|
|
return this.searchResults.quickLinks[0]; |
|
|
return this.searchResults.quickLinks[0]; |
|
|
@ -624,13 +621,14 @@ export class GfAssistantComponent implements OnChanges, OnDestroy, OnInit { |
|
|
if (this.searchResults.assetProfiles?.length > 0) { |
|
|
if (this.searchResults.assetProfiles?.length > 0) { |
|
|
return this.searchResults.assetProfiles[0]; |
|
|
return this.searchResults.assetProfiles[0]; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return null; |
|
|
return null; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Preselects the first search result item with debouncing |
|
|
* Preselects the first search result item with debouncing |
|
|
*/ |
|
|
*/ |
|
|
private preselectFirstItem(): void { |
|
|
private preselectFirstItem() { |
|
|
// Clear any existing timeout
|
|
|
// Clear any existing timeout
|
|
|
if (this.preselectionTimeout) { |
|
|
if (this.preselectionTimeout) { |
|
|
clearTimeout(this.preselectionTimeout); |
|
|
clearTimeout(this.preselectionTimeout); |
|
|
@ -644,6 +642,7 @@ export class GfAssistantComponent implements OnChanges, OnDestroy, OnInit { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const firstItem = this.getFirstSearchResultItem(); |
|
|
const firstItem = this.getFirstSearchResultItem(); |
|
|
|
|
|
|
|
|
if (!firstItem) { |
|
|
if (!firstItem) { |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
@ -658,6 +657,7 @@ export class GfAssistantComponent implements OnChanges, OnDestroy, OnInit { |
|
|
|
|
|
|
|
|
// Get the currently focused item and apply focus styling
|
|
|
// Get the currently focused item and apply focus styling
|
|
|
const currentFocusedItem = this.getCurrentAssistantListItem(); |
|
|
const currentFocusedItem = this.getCurrentAssistantListItem(); |
|
|
|
|
|
|
|
|
if (currentFocusedItem) { |
|
|
if (currentFocusedItem) { |
|
|
currentFocusedItem.focus(); |
|
|
currentFocusedItem.focus(); |
|
|
} |
|
|
} |
|
|
|