topic-legend: select fields and subfields separately

This commit is contained in:
2026-06-26 14:16:56 +02:00
parent 512356e106
commit f2cf83f63b
5 changed files with 72 additions and 22 deletions
@@ -23,7 +23,8 @@ import {
getTopicLegendSubfieldId,
TopicLegendGroup,
TopicLegendSubfieldSelection,
toggleTopicLegendSelection,
toggleTopicLegendFieldSelection,
toggleTopicLegendSubfieldSelection,
} from '../../shared/utils/topic-legend';
interface InterestTag {
@@ -154,18 +155,25 @@ export class PersonInterestingComponent implements OnInit {
}
onLegendFieldToggle(group: TopicLegendGroup): void {
this.activeLegendFieldIds.set(
toggleTopicLegendSelection(this.activeLegendFieldIds(), group.id),
const selection = toggleTopicLegendFieldSelection(
this.activeLegendFieldIds(),
this.activeLegendSubfieldIds(),
group,
);
this.activeLegendFieldIds.set(selection.fieldIds);
this.activeLegendSubfieldIds.set(selection.subfieldIds);
}
onLegendSubfieldToggle(selection: TopicLegendSubfieldSelection): void {
this.activeLegendSubfieldIds.set(
toggleTopicLegendSelection(
this.activeLegendSubfieldIds(),
selection.item.id,
),
const nextSelection = toggleTopicLegendSubfieldSelection(
this.activeLegendFieldIds(),
this.activeLegendSubfieldIds(),
selection,
);
this.activeLegendFieldIds.set(nextSelection.fieldIds);
this.activeLegendSubfieldIds.set(nextSelection.subfieldIds);
}
isTagActive(tag: InterestTag): boolean {
@@ -21,7 +21,8 @@ import {
getTopicLegendSubfieldId,
TopicLegendGroup,
TopicLegendSubfieldSelection,
toggleTopicLegendSelection,
toggleTopicLegendFieldSelection,
toggleTopicLegendSubfieldSelection,
} from '../../../../shared/utils/topic-legend';
import { buildTopicHierarchyTooltip } from '../../../../shared/utils/topic-tooltip';
@@ -430,17 +431,25 @@ export class ResearchTimelineComponent implements OnChanges, AfterViewChecked {
}
onLegendFieldToggle(group: TopicLegendGroup): void {
this.activeLegendFieldIds = toggleTopicLegendSelection(
const selection = toggleTopicLegendFieldSelection(
this.activeLegendFieldIds,
group.id,
this.activeLegendSubfieldIds,
group,
);
this.activeLegendFieldIds = selection.fieldIds;
this.activeLegendSubfieldIds = selection.subfieldIds;
}
onLegendSubfieldToggle(selection: TopicLegendSubfieldSelection): void {
this.activeLegendSubfieldIds = toggleTopicLegendSelection(
const nextSelection = toggleTopicLegendSubfieldSelection(
this.activeLegendFieldIds,
this.activeLegendSubfieldIds,
selection.item.id,
selection,
);
this.activeLegendFieldIds = nextSelection.fieldIds;
this.activeLegendSubfieldIds = nextSelection.subfieldIds;
}
isTopicActiveByLegend(topic: TopicTimelineTopic): boolean {