wip reference service instance for every annotation card

This commit is contained in:
Edi Cziszter 2022-01-18 19:00:07 +02:00
parent 409454972d
commit fb859ece19
8 changed files with 28 additions and 21 deletions

View File

@ -88,7 +88,7 @@
></iqser-circle-button>
<iqser-circle-button
(action)="annotationReferencesService.show()"
(action)="this.annotationReferencesService.show()"
*ngIf="(annotationReferencesService.hasReferences$ | async) && !multiSelectService.isActive"
[tooltipPosition]="tooltipPosition"
[tooltip]="'annotation-actions.see-references.label' | translate"

View File

@ -63,7 +63,6 @@ export class AnnotationActionsComponent implements OnChanges {
@Input()
set annotations(value: AnnotationWrapper[]) {
this._annotations = value.filter(a => a !== undefined);
this.annotationReferencesService.setAnnotation(this._annotations);
}
get viewerAnnotations() {

View File

@ -20,3 +20,13 @@
<iqser-round-checkbox *ngIf="(multiSelectService.active$ | async) && isSelected" [active]="true"></iqser-round-checkbox>
</div>
</div>
<ng-container *ngIf="annotationReferencesService.showReferences$ | async">
<redaction-annotation-references-dialog
(referenceClicked)="referenceClicked($event)"
*ngIf="annotationReferencesService.hasReferences$ | async"
[annotation]="annotationReferencesService.annotation$ | async"
[fileData]="fileData"
[file]="file"
></redaction-annotation-references-dialog>
</ng-container>

View File

@ -2,17 +2,31 @@ import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
import { AnnotationWrapper } from '../../../../../../models/file/annotation.wrapper';
import { File } from '@red/domain';
import { MultiSelectService } from '../../services/multi-select.service';
import { AnnotationReferencesService } from '../../services/annotation-references.service';
@Component({
selector: 'redaction-annotation-card',
templateUrl: './annotation-card.component.html',
styleUrls: ['./annotation-card.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
providers: [AnnotationReferencesService],
})
export class AnnotationCardComponent {
@Input() annotation: AnnotationWrapper;
@Input() file: File;
@Input() isSelected = false;
constructor(readonly multiSelectService: MultiSelectService) {}
constructor(
readonly multiSelectService: MultiSelectService,
private readonly _annotationReferenceService: AnnotationReferencesService,
) {
this._annotationReferenceService.setAnnotation([this.annotation]);
}
/*referenceClicked(annotation: AnnotationWrapper): void {
this.annotationClicked(annotation, null);
if (this._filterService.filtersEnabled('primaryFilters')) {
this._filterService.toggleFilter('primaryFilters', annotation.superType, true);
}
}*/
}

View File

@ -43,13 +43,3 @@
<redaction-annotation-details [annotation]="annotation"></redaction-annotation-details>
</div>
<ng-container *ngIf="annotationReferencesService.showReferences$ | async">
<redaction-annotation-references-dialog
(referenceClicked)="referenceClicked($event)"
*ngIf="annotationReferencesService.hasReferences$ | async"
[annotation]="annotationReferencesService.annotation$ | async"
[fileData]="fileData"
[file]="file"
></redaction-annotation-references-dialog>
</ng-container>

View File

@ -53,13 +53,6 @@ export class AnnotationsListComponent implements OnChanges {
}
}
referenceClicked(annotation: AnnotationWrapper): void {
this.annotationClicked(annotation, null);
if (this._filterService.filtersEnabled('primaryFilters')) {
this._filterService.toggleFilter('primaryFilters', annotation.superType, true);
}
}
isSelected(annotationId: string): boolean {
return !!this.selectedAnnotations?.find(a => a?.annotationId === annotationId);
}

View File

@ -33,6 +33,7 @@ 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'];
@ -55,6 +56,7 @@ 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[]>();

View File

@ -51,7 +51,6 @@ import { FilePreviewStateService } from './services/file-preview-state.service';
import { FileDataModel } from '../../../../models/file/file-data.model';
import Annotation = Core.Annotations.Annotation;
import PDFNet = Core.PDFNet;
import { AnnotationReferencesService } from './services/annotation-references.service';
const ALL_HOTKEY_ARRAY = ['Escape', 'F', 'f', 'ArrowUp', 'ArrowDown'];