apply filters when reference is clicked

This commit is contained in:
Edi Cziszter 2022-01-14 15:24:04 +02:00
parent 7759cdd018
commit 22b9a51210
3 changed files with 20 additions and 2 deletions

View File

@ -4,6 +4,7 @@
position: fixed;
margin: 0;
width: 280px;
max-height: 380px;
right: 370px;
top: 165px;
@ -15,6 +16,7 @@
.annotations-container {
flex-direction: column;
overflow: auto;
.annotation-container {
width: 100%;

View File

@ -48,5 +48,5 @@
*ngIf="annotationReferencesService.annotation$ | async as annotation"
[annotation]="annotation"
[file]="file"
(referenceClicked)="annotationClicked($event, null)"
(referenceClicked)="referenceClicked($event)"
></redaction-annotation-references-dialog>

View File

@ -1,6 +1,6 @@
import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnChanges, Output, SimpleChanges, TemplateRef } from '@angular/core';
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
import { HelpModeService, IqserEventTarget } from '@iqser/common-ui';
import { FilterService, HelpModeService, IqserEventTarget } from '@iqser/common-ui';
import { File } from '@red/domain';
import { MultiSelectService } from '../../services/multi-select.service';
import { AnnotationReferencesService } from '../../services/annotation-references.service';
@ -27,6 +27,7 @@ export class AnnotationsListComponent implements OnChanges {
readonly multiSelectService: MultiSelectService,
readonly helpModeService: HelpModeService,
readonly annotationReferencesService: AnnotationReferencesService,
private readonly _filterService: FilterService,
) {}
ngOnChanges(changes: SimpleChanges): void {
@ -50,6 +51,21 @@ export class AnnotationsListComponent implements OnChanges {
}
}
referenceClicked(annotation: AnnotationWrapper): void {
this.annotationClicked(annotation, null);
if (this._filterService.filtersEnabled('primaryFilters')) {
this.toggleFilterAndChildren(annotation);
}
}
toggleFilterAndChildren(annotation: AnnotationWrapper): void {
const primaryFilters = this._filterService.getGroup('primaryFilters');
const filter = primaryFilters.filters.find(f => f.id === annotation.superType);
filter.checked = true;
filter.children.forEach(f => (f.checked = true));
this._filterService.refresh();
}
isSelected(annotationId: string): boolean {
return !!this.selectedAnnotations?.find(a => a?.annotationId === annotationId);
}