Some refactor

This commit is contained in:
Dan Percic 2021-04-20 22:43:14 +03:00
parent a4308c654d
commit f502cda56b
3 changed files with 10 additions and 11 deletions

View File

@ -153,8 +153,8 @@
</div>
<ng-template #annotationFilterTemplate let-filter="filter">
<redaction-type-filter *ngIf="filter.topLevelFilter" [filter]="filter"></redaction-type-filter>
<ng-container *ngIf="!filter.topLevelFilter">
<redaction-type-filter *ngIf="_(filter).topLevelFilter" [filter]="filter"></redaction-type-filter>
<ng-container *ngIf="!_(filter).topLevelFilter">
<redaction-dictionary-annotation-icon [dictionaryKey]="filter.key"></redaction-dictionary-annotation-icon>
{{ filter.key | humanize: false }}
</ng-container>

View File

@ -28,13 +28,13 @@ export class FileWorkloadComponent {
@Input() selectedAnnotations: AnnotationWrapper[];
@Input() activeViewerPage: number;
@Input() shouldDeselectAnnotationsOnPageChange: boolean;
@Output() shouldDeselectAnnotationsOnPageChangeChange = new EventEmitter<boolean>();
@Input() dialogRef: MatDialogRef<any>;
@Input() annotationFilters: FilterModel[];
@Input() fileData: FileDataModel;
@Input() hideSkipped: boolean;
@Input() annotationActionsTemplate: TemplateRef<any>;
@Output() shouldDeselectAnnotationsOnPageChangeChange = new EventEmitter<boolean>();
@Output() selectAnnotations = new EventEmitter<AnnotationWrapper[] | { annotations: AnnotationWrapper[]; multiSelect: boolean }>();
@Output() deselectAnnotations = new EventEmitter<AnnotationWrapper[]>();
@Output() selectPage = new EventEmitter<number>();
@ -66,11 +66,7 @@ export class FileWorkloadComponent {
}
}
constructor(
private _changeDetectorRef: ChangeDetectorRef,
private _annotationProcessingService: AnnotationProcessingService,
private readonly _permissionsService: PermissionsService
) {}
constructor(private readonly _changeDetectorRef: ChangeDetectorRef, private readonly _annotationProcessingService: AnnotationProcessingService) {}
private get firstSelectedAnnotation() {
return this.selectedAnnotations?.length ? this.selectedAnnotations[0] : null;
@ -345,4 +341,8 @@ export class FileWorkloadComponent {
const elements: any[] = this._quickNavigationElement.nativeElement.querySelectorAll(`#quick-nav-page-${page}`);
FileWorkloadComponent._scrollToFirstElement(elements);
}
_(filter): FilterModel {
return filter as FilterModel;
}
}

View File

@ -29,7 +29,6 @@ export class FilterComponent implements OnChanges {
@Input() enableFilterOptions = false;
@Input() icon: string;
@Input() chevron = false;
@ViewChild(MatMenuTrigger) trigger: MatMenuTrigger;
mouseOver = true;
@ -76,11 +75,11 @@ export class FilterComponent implements OnChanges {
this._setAllFilters(true);
}
public deactivateAllFilters() {
deactivateAllFilters() {
this._setAllFilters(false);
}
public get hasActiveFilters(): boolean {
get hasActiveFilters(): boolean {
for (const filter of this.filters ? this.filters : []) {
if (filter.checked || filter.indeterminate) {
return true;