show/hide dialog functionality in separate service
This commit is contained in:
parent
b89f4a3f78
commit
53929c9e3a
@ -88,7 +88,8 @@
|
|||||||
></iqser-circle-button>
|
></iqser-circle-button>
|
||||||
|
|
||||||
<iqser-circle-button
|
<iqser-circle-button
|
||||||
(action)="openAnnotationReferencesDialog()"
|
(action)="annotationReferencesService.show(annotations)"
|
||||||
|
*ngIf="!multiSelectService.isActive"
|
||||||
[tooltipPosition]="tooltipPosition"
|
[tooltipPosition]="tooltipPosition"
|
||||||
[tooltip]="'annotation-actions.see-references.label' | translate"
|
[tooltip]="'annotation-actions.see-references.label' | translate"
|
||||||
[type]="buttonType"
|
[type]="buttonType"
|
||||||
@ -96,7 +97,7 @@
|
|||||||
></iqser-circle-button>
|
></iqser-circle-button>
|
||||||
|
|
||||||
<iqser-circle-button
|
<iqser-circle-button
|
||||||
(action)="annotationActionsService.forceRedaction($event, annotations, file, annotationsChanged)"
|
(action)="annotationActionsService.forceAnnotation($event, annotations, file, annotationsChanged)"
|
||||||
*ngIf="annotationPermissions.canForceRedaction"
|
*ngIf="annotationPermissions.canForceRedaction"
|
||||||
[tooltipPosition]="tooltipPosition"
|
[tooltipPosition]="tooltipPosition"
|
||||||
[tooltip]="'annotation-actions.force-redaction.label' | translate"
|
[tooltip]="'annotation-actions.force-redaction.label' | translate"
|
||||||
|
|||||||
@ -17,6 +17,8 @@ import {
|
|||||||
import { filter } from 'rxjs/operators';
|
import { filter } from 'rxjs/operators';
|
||||||
import { ManualAnnotationService } from '../../../../services/manual-annotation.service';
|
import { ManualAnnotationService } from '../../../../services/manual-annotation.service';
|
||||||
import { DossiersDialogService } from '../../../../services/dossiers-dialog.service';
|
import { DossiersDialogService } from '../../../../services/dossiers-dialog.service';
|
||||||
|
import { AnnotationReferencesService } from '../../services/annotation-references.service';
|
||||||
|
import { MultiSelectService } from '../../services/multi-select.service';
|
||||||
|
|
||||||
export const AnnotationButtonTypes = {
|
export const AnnotationButtonTypes = {
|
||||||
dark: 'dark',
|
dark: 'dark',
|
||||||
@ -38,12 +40,13 @@ export class AnnotationActionsComponent implements OnChanges {
|
|||||||
@Input() alwaysVisible: boolean;
|
@Input() alwaysVisible: boolean;
|
||||||
@Input() @Required() file!: File;
|
@Input() @Required() file!: File;
|
||||||
@Output() annotationsChanged = new EventEmitter<AnnotationWrapper>();
|
@Output() annotationsChanged = new EventEmitter<AnnotationWrapper>();
|
||||||
@Output() seeReferences = new EventEmitter<boolean>();
|
|
||||||
annotationPermissions: AnnotationPermissions;
|
annotationPermissions: AnnotationPermissions;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly _manualAnnotationService: ManualAnnotationService,
|
private readonly _manualAnnotationService: ManualAnnotationService,
|
||||||
readonly annotationActionsService: AnnotationActionsService,
|
readonly annotationActionsService: AnnotationActionsService,
|
||||||
|
readonly annotationReferencesService: AnnotationReferencesService,
|
||||||
|
readonly multiSelectService: MultiSelectService,
|
||||||
private readonly _permissionsService: PermissionsService,
|
private readonly _permissionsService: PermissionsService,
|
||||||
private readonly _dossiersService: DossiersService,
|
private readonly _dossiersService: DossiersService,
|
||||||
private readonly _userService: UserService,
|
private readonly _userService: UserService,
|
||||||
@ -156,8 +159,4 @@ export class AnnotationActionsComponent implements OnChanges {
|
|||||||
this.annotations,
|
this.annotations,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
openAnnotationReferencesDialog(): void {
|
|
||||||
this.seeReferences.emit(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
<div class="dialog references-dialog">
|
<div class="dialog references-dialog">
|
||||||
<div class="references-header flex space-between">
|
<div class="references-header flex space-between">
|
||||||
<div class="small-label">X REFERENCES</div>
|
<div class="small-label">X REFERENCES</div>
|
||||||
<iqser-circle-button (action)="closeDialog.emit(false)" icon="iqser:close"></iqser-circle-button>
|
<iqser-circle-button (action)="annotationReferencesService.hide()" icon="iqser:close"></iqser-circle-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core';
|
import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core';
|
||||||
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
||||||
|
import { AnnotationReferencesService } from '../../services/annotation-references.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-annotation-references-dialog',
|
selector: 'redaction-annotation-references-dialog',
|
||||||
@ -7,10 +8,10 @@ import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
|||||||
styleUrls: ['./annotation-references-dialog.component.scss'],
|
styleUrls: ['./annotation-references-dialog.component.scss'],
|
||||||
})
|
})
|
||||||
export class AnnotationReferencesDialogComponent implements OnInit {
|
export class AnnotationReferencesDialogComponent implements OnInit {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
@Input()
|
||||||
@Input() annotation: AnnotationWrapper;
|
annotation: AnnotationWrapper;
|
||||||
@Output() readonly closeDialog = new EventEmitter<boolean>();
|
|
||||||
constructor() {}
|
constructor(readonly annotationReferencesService: AnnotationReferencesService) {}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
console.log(this.annotation);
|
console.log(this.annotation);
|
||||||
|
|||||||
@ -42,6 +42,9 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<redaction-annotation-details [annotation]="annotation"></redaction-annotation-details>
|
<redaction-annotation-details [annotation]="annotation"></redaction-annotation-details>
|
||||||
|
|
||||||
<ng-container [ngTemplateOutletContext]="{ annotation: annotation }" [ngTemplateOutlet]="annotationReferencesTemplate"></ng-container>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<redaction-annotation-references-dialog
|
||||||
|
*ngIf="annotationReferencesService.annotation$ | async as annotation"
|
||||||
|
[annotation]="annotation"
|
||||||
|
></redaction-annotation-references-dialog>
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
|||||||
import { HelpModeService, IqserEventTarget } from '@iqser/common-ui';
|
import { HelpModeService, IqserEventTarget } from '@iqser/common-ui';
|
||||||
import { File } from '@red/domain';
|
import { File } from '@red/domain';
|
||||||
import { MultiSelectService } from '../../services/multi-select.service';
|
import { MultiSelectService } from '../../services/multi-select.service';
|
||||||
|
import { AnnotationReferencesService } from '../../services/annotation-references.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-annotations-list',
|
selector: 'redaction-annotations-list',
|
||||||
@ -15,7 +16,6 @@ export class AnnotationsListComponent implements OnChanges {
|
|||||||
@Input() annotations: AnnotationWrapper[];
|
@Input() annotations: AnnotationWrapper[];
|
||||||
@Input() selectedAnnotations: AnnotationWrapper[];
|
@Input() selectedAnnotations: AnnotationWrapper[];
|
||||||
@Input() annotationActionsTemplate: TemplateRef<unknown>;
|
@Input() annotationActionsTemplate: TemplateRef<unknown>;
|
||||||
@Input() annotationReferencesTemplate: TemplateRef<unknown>;
|
|
||||||
@Input() activeViewerPage: number;
|
@Input() activeViewerPage: number;
|
||||||
@Input() canMultiSelect = true;
|
@Input() canMultiSelect = true;
|
||||||
|
|
||||||
@ -23,7 +23,11 @@ export class AnnotationsListComponent implements OnChanges {
|
|||||||
@Output() readonly selectAnnotations = new EventEmitter<AnnotationWrapper[]>();
|
@Output() readonly selectAnnotations = new EventEmitter<AnnotationWrapper[]>();
|
||||||
@Output() readonly deselectAnnotations = new EventEmitter<AnnotationWrapper[]>();
|
@Output() readonly deselectAnnotations = new EventEmitter<AnnotationWrapper[]>();
|
||||||
|
|
||||||
constructor(readonly multiSelectService: MultiSelectService, readonly helpModeService: HelpModeService) {}
|
constructor(
|
||||||
|
readonly multiSelectService: MultiSelectService,
|
||||||
|
readonly helpModeService: HelpModeService,
|
||||||
|
readonly annotationReferencesService: AnnotationReferencesService,
|
||||||
|
) {}
|
||||||
|
|
||||||
ngOnChanges(changes: SimpleChanges): void {
|
ngOnChanges(changes: SimpleChanges): void {
|
||||||
if (changes.annotations && this.annotations) {
|
if (changes.annotations && this.annotations) {
|
||||||
|
|||||||
@ -201,7 +201,6 @@
|
|||||||
(selectAnnotations)="selectAnnotations.emit($event)"
|
(selectAnnotations)="selectAnnotations.emit($event)"
|
||||||
[activeViewerPage]="activeViewerPage"
|
[activeViewerPage]="activeViewerPage"
|
||||||
[annotationActionsTemplate]="annotationActionsTemplate"
|
[annotationActionsTemplate]="annotationActionsTemplate"
|
||||||
[annotationReferencesTemplate]="annotationReferencesTemplate"
|
|
||||||
[annotations]="(displayedAnnotations$ | async)?.get(activeViewerPage)"
|
[annotations]="(displayedAnnotations$ | async)?.get(activeViewerPage)"
|
||||||
[canMultiSelect]="!isReadOnly"
|
[canMultiSelect]="!isReadOnly"
|
||||||
[file]="file"
|
[file]="file"
|
||||||
|
|||||||
@ -54,7 +54,6 @@ export class FileWorkloadComponent {
|
|||||||
@Input() dialogRef: MatDialogRef<unknown>;
|
@Input() dialogRef: MatDialogRef<unknown>;
|
||||||
@Input() file!: File;
|
@Input() file!: File;
|
||||||
@Input() annotationActionsTemplate: TemplateRef<unknown>;
|
@Input() annotationActionsTemplate: TemplateRef<unknown>;
|
||||||
@Input() annotationReferencesTemplate: TemplateRef<unknown>;
|
|
||||||
@Input() viewer: WebViewerInstance;
|
@Input() viewer: WebViewerInstance;
|
||||||
@Output() readonly shouldDeselectAnnotationsOnPageChangeChange = new EventEmitter<boolean>();
|
@Output() readonly shouldDeselectAnnotationsOnPageChangeChange = new EventEmitter<boolean>();
|
||||||
@Output() readonly selectAnnotations = new EventEmitter<AnnotationWrapper[]>();
|
@Output() readonly selectAnnotations = new EventEmitter<AnnotationWrapper[]>();
|
||||||
|
|||||||
@ -106,7 +106,6 @@
|
|||||||
[activeViewerPage]="activeViewerPage"
|
[activeViewerPage]="activeViewerPage"
|
||||||
[annotationActionsTemplate]="annotationActionsTemplate"
|
[annotationActionsTemplate]="annotationActionsTemplate"
|
||||||
[annotations]="visibleAnnotations"
|
[annotations]="visibleAnnotations"
|
||||||
[annotationReferencesTemplate]="annotationReferencesTemplate"
|
|
||||||
[dialogRef]="dialogRef"
|
[dialogRef]="dialogRef"
|
||||||
[file]="file"
|
[file]="file"
|
||||||
[selectedAnnotations]="selectedAnnotations"
|
[selectedAnnotations]="selectedAnnotations"
|
||||||
@ -119,7 +118,6 @@
|
|||||||
<ng-template #annotationActionsTemplate let-annotation="annotation">
|
<ng-template #annotationActionsTemplate let-annotation="annotation">
|
||||||
<redaction-annotation-actions
|
<redaction-annotation-actions
|
||||||
(annotationsChanged)="annotationsChangedByReviewAction($event)"
|
(annotationsChanged)="annotationsChangedByReviewAction($event)"
|
||||||
(seeReferences)="seeReferences = $event"
|
|
||||||
[annotations]="[annotation]"
|
[annotations]="[annotation]"
|
||||||
[canPerformAnnotationActions]="canPerformAnnotationActions$ | async"
|
[canPerformAnnotationActions]="canPerformAnnotationActions$ | async"
|
||||||
[file]="file"
|
[file]="file"
|
||||||
@ -127,14 +125,6 @@
|
|||||||
></redaction-annotation-actions>
|
></redaction-annotation-actions>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
|
||||||
<ng-template #annotationReferencesTemplate let-annotation="annotation">
|
|
||||||
<redaction-annotation-references-dialog
|
|
||||||
*ngIf="seeReferences"
|
|
||||||
[annotation]="annotation"
|
|
||||||
(closeDialog)="seeReferences = $event"
|
|
||||||
></redaction-annotation-references-dialog>
|
|
||||||
</ng-template>
|
|
||||||
|
|
||||||
<ng-template #annotationFilterTemplate let-filter="filter">
|
<ng-template #annotationFilterTemplate let-filter="filter">
|
||||||
<redaction-type-filter
|
<redaction-type-filter
|
||||||
*ngIf="filter.topLevelFilter"
|
*ngIf="filter.topLevelFilter"
|
||||||
|
|||||||
@ -51,6 +51,7 @@ import { FilePreviewStateService } from './services/file-preview-state.service';
|
|||||||
import { FileDataModel } from '../../../../models/file/file-data.model';
|
import { FileDataModel } from '../../../../models/file/file-data.model';
|
||||||
import Annotation = Core.Annotations.Annotation;
|
import Annotation = Core.Annotations.Annotation;
|
||||||
import PDFNet = Core.PDFNet;
|
import PDFNet = Core.PDFNet;
|
||||||
|
import { AnnotationReferencesService } from './services/annotation-references.service';
|
||||||
|
|
||||||
const ALL_HOTKEY_ARRAY = ['Escape', 'F', 'f', 'ArrowUp', 'ArrowDown'];
|
const ALL_HOTKEY_ARRAY = ['Escape', 'F', 'f', 'ArrowUp', 'ArrowDown'];
|
||||||
|
|
||||||
@ -88,8 +89,8 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
|
|||||||
ready = false;
|
ready = false;
|
||||||
private _instance: WebViewerInstance;
|
private _instance: WebViewerInstance;
|
||||||
private _lastPage: string;
|
private _lastPage: string;
|
||||||
private _seeReferences = false;
|
|
||||||
private _reloadFileOnReanalysis = false;
|
private _reloadFileOnReanalysis = false;
|
||||||
|
|
||||||
@ViewChild('fileWorkloadComponent') private readonly _workloadComponent: FileWorkloadComponent;
|
@ViewChild('fileWorkloadComponent') private readonly _workloadComponent: FileWorkloadComponent;
|
||||||
@ViewChild('annotationFilterTemplate', {
|
@ViewChild('annotationFilterTemplate', {
|
||||||
read: TemplateRef,
|
read: TemplateRef,
|
||||||
@ -167,14 +168,6 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
set seeReferences(e) {
|
|
||||||
this._seeReferences = e;
|
|
||||||
}
|
|
||||||
|
|
||||||
get seeReferences(): boolean {
|
|
||||||
return this._seeReferences;
|
|
||||||
}
|
|
||||||
|
|
||||||
private get _viewDocumentInfo$() {
|
private get _viewDocumentInfo$() {
|
||||||
return this.documentInfoService.shown$.pipe(
|
return this.documentInfoService.shown$.pipe(
|
||||||
tap(value => {
|
tap(value => {
|
||||||
|
|||||||
@ -0,0 +1,22 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { BehaviorSubject, Observable } from 'rxjs';
|
||||||
|
import { shareDistinctLast } from '@iqser/common-ui';
|
||||||
|
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class AnnotationReferencesService {
|
||||||
|
readonly annotation$: Observable<AnnotationWrapper>;
|
||||||
|
private readonly _annotation$ = new BehaviorSubject(null);
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.annotation$ = this._annotation$.asObservable().pipe(shareDistinctLast());
|
||||||
|
}
|
||||||
|
|
||||||
|
show(annotations: AnnotationWrapper[]) {
|
||||||
|
this._annotation$.next(annotations[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
hide() {
|
||||||
|
this._annotation$.next(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -23,7 +23,7 @@ type DialogType =
|
|||||||
| 'changeLegalBasis'
|
| 'changeLegalBasis'
|
||||||
| 'removeAnnotations'
|
| 'removeAnnotations'
|
||||||
| 'resizeAnnotation'
|
| 'resizeAnnotation'
|
||||||
| 'forceRedaction'
|
| 'forceAnnotation'
|
||||||
| 'manualAnnotation';
|
| 'manualAnnotation';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user