dialog open on button click and annotation input

This commit is contained in:
Edi Cziszter 2022-01-07 22:25:58 +02:00
parent 7ce34ca329
commit e8e8687ee9
5 changed files with 49 additions and 13 deletions

View File

@ -1,20 +1,17 @@
import { Component } from '@angular/core';
import { BaseDialogComponent } from '@iqser/common-ui';
import { Component, Input, OnDestroy, OnInit } from '@angular/core';
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
@Component({
selector: 'redaction-annotation-references-dialog',
templateUrl: './annotation-references-dialog.component.html',
styleUrls: ['./annotation-references-dialog.component.scss'],
})
export class AnnotationReferencesDialogComponent extends BaseDialogComponent {
export class AnnotationReferencesDialogComponent implements OnInit {
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
constructor() {
super();
@Input() annotation: AnnotationWrapper;
constructor() {}
ngOnInit(): void {
console.log(this.annotation);
}
changed: boolean;
disabled: boolean;
valid: boolean;
save(): void {}
}

View File

@ -50,7 +50,6 @@
<redaction-annotation-actions
(annotationsChanged)="annotationsChanged.emit($event)"
(seeReferences)="seeReferences.emit($event)"
*ngIf="selectedAnnotations?.length > 0"
[alwaysVisible]="true"
[annotations]="selectedAnnotations"

View File

@ -60,7 +60,6 @@ export class FileWorkloadComponent {
@Output() readonly deselectAnnotations = new EventEmitter<AnnotationWrapper[]>();
@Output() readonly selectPage = new EventEmitter<number>();
@Output() readonly annotationsChanged = new EventEmitter<AnnotationWrapper>();
@Output() readonly seeReferences = new EventEmitter<boolean>();
displayedPages: number[] = [];
pagesPanelActive = true;
readonly displayedAnnotations$: Observable<Map<number, AnnotationWrapper[]>>;

View File

@ -118,11 +118,17 @@
<ng-template #annotationActionsTemplate let-annotation="annotation">
<redaction-annotation-actions
(annotationsChanged)="annotationsChangedByReviewAction($event)"
(seeReferences)="seeReferences = $event"
[annotations]="[annotation]"
[canPerformAnnotationActions]="canPerformAnnotationActions$ | async"
[file]="file"
[viewer]="activeViewer"
></redaction-annotation-actions>
<redaction-annotation-references-dialog
*ngIf="seeReferences"
[annotation]="annotation"
></redaction-annotation-references-dialog>
</ng-template>
<ng-template #annotationFilterTemplate let-filter="filter">

View File

@ -88,6 +88,8 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
ready = false;
private _instance: WebViewerInstance;
private _lastPage: string;
private _seeReferences = false;
private _reloadFileOnReanalysis = false;
@ViewChild('fileWorkloadComponent') private readonly _workloadComponent: FileWorkloadComponent;
@ViewChild('annotationFilterTemplate', {
read: TemplateRef,
@ -152,6 +154,39 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
return this._stateService.fileData;
}
private _setActiveViewerPage() {
const currentPage = this._instance?.Core.documentViewer?.getCurrentPage();
if (!currentPage) {
this.activeViewerPage = 1;
} else {
this.activeViewerPage = this.viewModeService.isCompare
? currentPage % 2 === 0
? currentPage / 2
: (currentPage + 1) / 2
: currentPage;
}
}
set seeReferences(e) {
this._seeReferences = e;
}
get seeReferences(): boolean {
return this._seeReferences;
}
private get _viewDocumentInfo$() {
return this.documentInfoService.shown$.pipe(
tap(value => {
if (value) {
this.multiSelectService.deactivate();
this.excludedPagesService.hide();
}
}),
shareDistinctLast(),
);
}
private get _canPerformAnnotationActions$() {
return combineLatest([
this._stateService.fileData$.pipe(switchMap(fileData => fileData.file$)),