|
|
|
@ -49,6 +49,7 @@ import { PageLink } from '@shared/models/page/page-link'; |
|
|
|
import { Direction } from '@shared/models/page/sort-order'; |
|
|
|
import { emptyPageData, PageData } from '@shared/models/page/page-data'; |
|
|
|
import { deepClone } from '@core/utils'; |
|
|
|
import { CustomTranslatePipe } from '@shared/pipe/custom-translate.pipe'; |
|
|
|
|
|
|
|
@Component({ |
|
|
|
selector: 'tb-quick-link', |
|
|
|
@ -114,6 +115,7 @@ export class QuickLinkComponent extends PageComponent implements OnInit, Control |
|
|
|
private fb: UntypedFormBuilder, |
|
|
|
private menuService: MenuService, |
|
|
|
public translate: TranslateService, |
|
|
|
private customTranslate: CustomTranslatePipe, |
|
|
|
@SkipSelf() private errorStateMatcher: ErrorStateMatcher) { |
|
|
|
super(store); |
|
|
|
} |
|
|
|
@ -135,7 +137,7 @@ export class QuickLinkComponent extends PageComponent implements OnInit, Control |
|
|
|
this.updateView(modelValue); |
|
|
|
}), |
|
|
|
map(value => value ? (typeof value === 'string' ? value : |
|
|
|
((value as any).translated ? value.name : this.translate.instant(value.name))) : ''), |
|
|
|
((value as any).translated ? value.name : this.customTranslate.transform(value.name))) : ''), |
|
|
|
distinctUntilChanged(), |
|
|
|
switchMap(name => this.fetchLinks(name) ), |
|
|
|
share() |
|
|
|
@ -202,7 +204,7 @@ export class QuickLinkComponent extends PageComponent implements OnInit, Control |
|
|
|
} |
|
|
|
|
|
|
|
displayLinkFn = (link?: MenuSection): string | undefined => |
|
|
|
link ? ((link as any).translated ? link.name : this.translate.instant(link.fullName || link.name)) : undefined; |
|
|
|
link ? ((link as any).translated ? link.name : this.customTranslate.transform(link.fullName || link.name)) : undefined; |
|
|
|
|
|
|
|
fetchLinks(searchText?: string): Observable<Array<MenuSection>> { |
|
|
|
this.searchText = searchText; |
|
|
|
@ -228,7 +230,7 @@ export class QuickLinkComponent extends PageComponent implements OnInit, Control |
|
|
|
map((links) => { |
|
|
|
const result = deepClone(links); |
|
|
|
for (const link of result) { |
|
|
|
link.name = this.translate.instant(link.fullName || link.name); |
|
|
|
link.name = this.customTranslate.transform(link.fullName || link.name); |
|
|
|
(link as any).translated = true; |
|
|
|
} |
|
|
|
return result; |
|
|
|
|