fix missing fileData
This commit is contained in:
parent
696d35cb65
commit
22c7ec4ce7
@ -1,13 +1,13 @@
|
||||
<div class="content-container">
|
||||
<div *ngIf="references$ | async as references" class="content-container">
|
||||
<div class="dialog references-dialog">
|
||||
<div class="references-header flex">
|
||||
<div class="small-label">
|
||||
{{ annotationReferences.length }}
|
||||
{{ (annotationReferences.length === 1 ? 'references.singular' : 'references.plural') | translate }}
|
||||
{{ references.length }}
|
||||
{{ (references.length === 1 ? 'references.singular' : 'references.plural') | translate }}
|
||||
</div>
|
||||
<iqser-circle-button (action)="annotationReferencesService.hide()" icon="iqser:close"></iqser-circle-button>
|
||||
</div>
|
||||
<div class="annotations-container flex">
|
||||
<div *ngIf="annotationReferencesService.annotation$ | async as annotation" class="annotations-container flex">
|
||||
<div [class.active]="isSelected(annotation.id)" class="annotation-container">
|
||||
<div class="annotation-card-container flex">
|
||||
<redaction-annotation-card [annotation]="annotation" [file]="file"></redaction-annotation-card>
|
||||
@ -18,7 +18,7 @@
|
||||
</div>
|
||||
<div
|
||||
(click)="referenceClicked.emit(reference)"
|
||||
*ngFor="let reference of annotationReferences"
|
||||
*ngFor="let reference of references"
|
||||
[class.active]="isSelected(reference.id)"
|
||||
class="annotation-container"
|
||||
>
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnChanges, Output } from '@angular/core';
|
||||
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core';
|
||||
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
||||
import { AnnotationReferencesService } from '../../services/annotation-references.service';
|
||||
import { File } from '@red/domain';
|
||||
import { FileDataModel } from '@models/file/file-data.model';
|
||||
import { FilePreviewStateService } from '../../services/file-preview-state.service';
|
||||
import { combineLatest, Observable } from 'rxjs';
|
||||
import { filter, map } from 'rxjs/operators';
|
||||
|
||||
@Component({
|
||||
selector: 'redaction-annotation-references-list',
|
||||
@ -10,18 +12,23 @@ import { FileDataModel } from '@models/file/file-data.model';
|
||||
styleUrls: ['./annotation-references-list.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class AnnotationReferencesListComponent implements OnChanges {
|
||||
@Input() annotation: AnnotationWrapper;
|
||||
export class AnnotationReferencesListComponent {
|
||||
@Input() file: File;
|
||||
@Input() fileData: FileDataModel;
|
||||
@Input() selectedAnnotations: AnnotationWrapper[];
|
||||
@Output() readonly referenceClicked = new EventEmitter<AnnotationWrapper>();
|
||||
annotationReferences: AnnotationWrapper[];
|
||||
references$ = this._annotationReferences;
|
||||
|
||||
constructor(readonly annotationReferencesService: AnnotationReferencesService) {}
|
||||
constructor(
|
||||
readonly annotationReferencesService: AnnotationReferencesService,
|
||||
private readonly _filePreviewStateService: FilePreviewStateService,
|
||||
) {}
|
||||
|
||||
ngOnChanges(): void {
|
||||
this.annotationReferences = this.fileData.allAnnotations.filter(a => this.annotation.reference.includes(a.annotationId));
|
||||
private get _annotationReferences(): Observable<AnnotationWrapper[]> {
|
||||
const combination = combineLatest([this.annotationReferencesService.annotation$, this._filePreviewStateService.fileData$]);
|
||||
return combination.pipe(
|
||||
filter(([annotation]) => !!annotation),
|
||||
map(([{ reference }, fileData]) => fileData.allAnnotations.filter(a => reference.includes(a.annotationId))),
|
||||
);
|
||||
}
|
||||
|
||||
isSelected(annotationId: string): boolean {
|
||||
|
||||
@ -44,11 +44,9 @@
|
||||
<redaction-annotation-details [annotation]="annotation" [isSelected]="isSelected(annotation.id)"></redaction-annotation-details>
|
||||
</div>
|
||||
|
||||
<ng-container *ngIf="annotationReferencesService.annotation$ | async as annotation">
|
||||
<ng-container *ngIf="annotationReferencesService.annotation$ | async">
|
||||
<redaction-annotation-references-list
|
||||
(referenceClicked)="referenceClicked($event)"
|
||||
[annotation]="annotation"
|
||||
[fileData]="fileData"
|
||||
[file]="file"
|
||||
[selectedAnnotations]="selectedAnnotations"
|
||||
></redaction-annotation-references-list>
|
||||
|
||||
@ -4,7 +4,6 @@ import { FilterService, HelpModeService, IqserEventTarget } from '@iqser/common-
|
||||
import { File } from '@red/domain';
|
||||
import { MultiSelectService } from '../../services/multi-select.service';
|
||||
import { AnnotationReferencesService } from '../../services/annotation-references.service';
|
||||
import { FileDataModel } from '../../../../../../models/file/file-data.model';
|
||||
|
||||
@Component({
|
||||
selector: 'redaction-annotations-list',
|
||||
@ -14,7 +13,6 @@ import { FileDataModel } from '../../../../../../models/file/file-data.model';
|
||||
})
|
||||
export class AnnotationsListComponent implements OnChanges {
|
||||
@Input() file: File;
|
||||
@Input() fileData: FileDataModel;
|
||||
@Input() annotations: AnnotationWrapper[];
|
||||
@Input() selectedAnnotations: AnnotationWrapper[];
|
||||
@Input() annotationActionsTemplate: TemplateRef<unknown>;
|
||||
|
||||
@ -203,7 +203,6 @@
|
||||
[annotationActionsTemplate]="annotationActionsTemplate"
|
||||
[annotations]="(displayedAnnotations$ | async)?.get(activeViewerPage)"
|
||||
[canMultiSelect]="!isReadOnly"
|
||||
[fileData]="fileData"
|
||||
[file]="file"
|
||||
[selectedAnnotations]="selectedAnnotations"
|
||||
iqserHelpMode="workload-annotations-list"
|
||||
|
||||
@ -33,7 +33,6 @@ import { ExcludedPagesService } from '../../services/excluded-pages.service';
|
||||
import { MultiSelectService } from '../../services/multi-select.service';
|
||||
import { DocumentInfoService } from '../../services/document-info.service';
|
||||
import { SkippedService } from '../../services/skipped.service';
|
||||
import { FileDataModel } from '../../../../../../models/file/file-data.model';
|
||||
|
||||
const COMMAND_KEY_ARRAY = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'Escape'];
|
||||
const ALL_HOTKEY_ARRAY = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown'];
|
||||
@ -56,7 +55,6 @@ export class FileWorkloadComponent {
|
||||
@Input() file!: File;
|
||||
@Input() annotationActionsTemplate: TemplateRef<unknown>;
|
||||
@Input() viewer: WebViewerInstance;
|
||||
@Input() fileData: FileDataModel;
|
||||
@Output() readonly shouldDeselectAnnotationsOnPageChangeChange = new EventEmitter<boolean>();
|
||||
@Output() readonly selectAnnotations = new EventEmitter<AnnotationWrapper[]>();
|
||||
@Output() readonly deselectAnnotations = new EventEmitter<AnnotationWrapper[]>();
|
||||
|
||||
@ -102,7 +102,6 @@
|
||||
[annotationActionsTemplate]="annotationActionsTemplate"
|
||||
[annotations]="visibleAnnotations"
|
||||
[dialogRef]="dialogRef"
|
||||
[fileData]="fileData"
|
||||
[file]="file"
|
||||
[selectedAnnotations]="selectedAnnotations"
|
||||
[viewer]="activeViewer"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user