feat(ui): show topic hierarchy in tooltips
This commit is contained in:
@@ -7,6 +7,7 @@ import {
|
||||
} from '@angular/core';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import { buildTopicHierarchyTooltip } from '../../utils/topic-tooltip';
|
||||
|
||||
export const TOPIC_CHIP_PALETTE = [
|
||||
'purple',
|
||||
@@ -66,6 +67,9 @@ export class TopicChipComponent {
|
||||
@Input() label = '';
|
||||
@Input() count: number | string | null | undefined;
|
||||
@Input() description: string | null | undefined = '';
|
||||
@Input() subfieldName: string | null | undefined = '';
|
||||
@Input() fieldName: string | null | undefined = '';
|
||||
@Input() domainName: string | null | undefined = '';
|
||||
@Input() countTooltip: string | null | undefined = '';
|
||||
@Input() countIcon: string | null | undefined;
|
||||
@Input() color: TopicChipColor = 'purple';
|
||||
@@ -119,15 +123,11 @@ export class TopicChipComponent {
|
||||
}
|
||||
|
||||
get labelTooltip(): string {
|
||||
return this.descriptionTooltipTarget === 'label'
|
||||
? this.normalizedDescription
|
||||
: '';
|
||||
return this.descriptionTooltipTarget === 'label' ? this.topicTooltip : '';
|
||||
}
|
||||
|
||||
get buttonTooltip(): string {
|
||||
return this.descriptionTooltipTarget === 'button'
|
||||
? this.normalizedDescription
|
||||
: '';
|
||||
return this.descriptionTooltipTarget === 'button' ? this.topicTooltip : '';
|
||||
}
|
||||
|
||||
get normalizedCountTooltip(): string {
|
||||
@@ -150,6 +150,16 @@ export class TopicChipComponent {
|
||||
return (this.description ?? '').trim();
|
||||
}
|
||||
|
||||
private get topicTooltip(): string {
|
||||
return buildTopicHierarchyTooltip({
|
||||
topicName: this.label,
|
||||
description: this.description,
|
||||
subfieldName: this.subfieldName,
|
||||
fieldName: this.fieldName,
|
||||
domainName: this.domainName,
|
||||
});
|
||||
}
|
||||
|
||||
private get colorTokens(): TopicChipColorTokens | undefined {
|
||||
return TOPIC_CHIP_COLORS[this.color as TopicChipPaletteColor];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user