Skipped service
This commit is contained in:
parent
6c047d9884
commit
4235e3cdbc
@ -10,10 +10,8 @@ import { SharedModule } from '@shared/shared.module';
|
||||
import { DossiersRoutingModule } from './dossiers-routing.module';
|
||||
import { FileUploadDownloadModule } from '@upload-download/file-upload-download.module';
|
||||
import { DossiersDialogService } from './services/dossiers-dialog.service';
|
||||
import { AnnotationActionsService } from './services/annotation-actions.service';
|
||||
import { PdfViewerDataService } from './services/pdf-viewer-data.service';
|
||||
import { ManualAnnotationService } from './services/manual-annotation.service';
|
||||
import { AnnotationDrawService } from './services/annotation-draw.service';
|
||||
import { AnnotationProcessingService } from './services/annotation-processing.service';
|
||||
import { EditDossierDialogComponent } from './dialogs/edit-dossier-dialog/edit-dossier-dialog.component';
|
||||
import { EditDossierGeneralInfoComponent } from './dialogs/edit-dossier-dialog/general-info/edit-dossier-general-info.component';
|
||||
@ -56,14 +54,7 @@ const components = [
|
||||
...dialogs,
|
||||
];
|
||||
|
||||
const services = [
|
||||
DossiersDialogService,
|
||||
AnnotationActionsService,
|
||||
ManualAnnotationService,
|
||||
PdfViewerDataService,
|
||||
AnnotationDrawService,
|
||||
AnnotationProcessingService,
|
||||
];
|
||||
const services = [DossiersDialogService, ManualAnnotationService, PdfViewerDataService, AnnotationProcessingService];
|
||||
|
||||
@NgModule({
|
||||
declarations: [...components],
|
||||
|
||||
@ -2,7 +2,7 @@ import { Component, EventEmitter, Input, OnChanges, Output } from '@angular/core
|
||||
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
||||
import { PermissionsService } from '@services/permissions.service';
|
||||
import { AnnotationPermissions } from '@models/file/annotation.permissions';
|
||||
import { AnnotationActionsService } from '../../../../services/annotation-actions.service';
|
||||
import { AnnotationActionsService } from '../../services/annotation-actions.service';
|
||||
import { WebViewerInstance } from '@pdftron/webviewer';
|
||||
import { UserService } from '@services/user.service';
|
||||
import { Dossier, File } from '@red/domain';
|
||||
|
||||
@ -217,9 +217,9 @@
|
||||
|
||||
<ng-template #annotationFilterActionTemplate let-filter="filter">
|
||||
<iqser-circle-button
|
||||
(action)="toggleSkipped.emit($event)"
|
||||
(action)="skippedService.toggleSkipped($event)"
|
||||
*ngIf="filter.id === 'skipped'"
|
||||
[icon]="hideSkipped ? 'red:visibility-off' : 'red:visibility'"
|
||||
[icon]="(skippedService.hideSkipped$ | async) ? 'red:visibility-off' : 'red:visibility'"
|
||||
[type]="circleButtonTypes.dark"
|
||||
></iqser-circle-button>
|
||||
</ng-template>
|
||||
|
||||
@ -32,6 +32,7 @@ import { File, IViewedPage } from '@red/domain';
|
||||
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';
|
||||
|
||||
const COMMAND_KEY_ARRAY = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'Escape'];
|
||||
const ALL_HOTKEY_ARRAY = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown'];
|
||||
@ -53,14 +54,12 @@ export class FileWorkloadComponent {
|
||||
@Input() dialogRef: MatDialogRef<unknown>;
|
||||
@Input() viewedPages: IViewedPage[];
|
||||
@Input() file!: File;
|
||||
@Input() hideSkipped: boolean;
|
||||
@Input() annotationActionsTemplate: TemplateRef<unknown>;
|
||||
@Input() viewer: WebViewerInstance;
|
||||
@Output() readonly shouldDeselectAnnotationsOnPageChangeChange = new EventEmitter<boolean>();
|
||||
@Output() readonly selectAnnotations = new EventEmitter<AnnotationWrapper[]>();
|
||||
@Output() readonly deselectAnnotations = new EventEmitter<AnnotationWrapper[]>();
|
||||
@Output() readonly selectPage = new EventEmitter<number>();
|
||||
@Output() readonly toggleSkipped = new EventEmitter<MouseEvent>();
|
||||
@Output() readonly annotationsChanged = new EventEmitter<AnnotationWrapper>();
|
||||
displayedPages: number[] = [];
|
||||
pagesPanelActive = true;
|
||||
@ -76,6 +75,7 @@ export class FileWorkloadComponent {
|
||||
readonly excludedPagesService: ExcludedPagesService,
|
||||
readonly multiSelectService: MultiSelectService,
|
||||
readonly documentInfoService: DocumentInfoService,
|
||||
readonly skippedService: SkippedService,
|
||||
private readonly _permissionsService: PermissionsService,
|
||||
private readonly _changeDetectorRef: ChangeDetectorRef,
|
||||
private readonly _filterService: FilterService,
|
||||
|
||||
@ -22,8 +22,8 @@ import {
|
||||
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
||||
import { ManualAnnotationService } from '../../../../services/manual-annotation.service';
|
||||
import { environment } from '@environments/environment';
|
||||
import { AnnotationDrawService } from '../../../../services/annotation-draw.service';
|
||||
import { AnnotationActionsService } from '../../../../services/annotation-actions.service';
|
||||
import { AnnotationDrawService } from '../../services/annotation-draw.service';
|
||||
import { AnnotationActionsService } from '../../services/annotation-actions.service';
|
||||
import { UserPreferenceService } from '@services/user-preference.service';
|
||||
import { BASE_HREF } from '../../../../../../tokens';
|
||||
import { ConfigService } from '@services/config.service';
|
||||
|
||||
@ -102,7 +102,6 @@
|
||||
(deselectAnnotations)="deselectAnnotations($event)"
|
||||
(selectAnnotations)="selectAnnotations($event)"
|
||||
(selectPage)="selectPage($event)"
|
||||
(toggleSkipped)="toggleSkipped($event)"
|
||||
*ngIf="!file.excluded"
|
||||
[(shouldDeselectAnnotationsOnPageChange)]="shouldDeselectAnnotationsOnPageChange"
|
||||
[activeViewerPage]="activeViewerPage"
|
||||
@ -110,7 +109,6 @@
|
||||
[annotations]="visibleAnnotations"
|
||||
[dialogRef]="dialogRef"
|
||||
[file]="file"
|
||||
[hideSkipped]="hideSkipped"
|
||||
[selectedAnnotations]="selectedAnnotations"
|
||||
[viewedPages]="fileData?.viewedPages"
|
||||
[viewer]="activeViewer"
|
||||
|
||||
@ -21,7 +21,7 @@ import { ManualRedactionEntryWrapper } from '@models/file/manual-redaction-entry
|
||||
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
||||
import { ManualAnnotationResponse } from '@models/file/manual-annotation-response';
|
||||
import { FileDataModel } from '@models/file/file-data.model';
|
||||
import { AnnotationDrawService } from '../../services/annotation-draw.service';
|
||||
import { AnnotationDrawService } from './services/annotation-draw.service';
|
||||
import { AnnotationProcessingService } from '../../services/annotation-processing.service';
|
||||
import { Dossier, File, ViewMode } from '@red/domain';
|
||||
import { PermissionsService } from '@services/permissions.service';
|
||||
@ -47,6 +47,8 @@ import { DocumentInfoService } from './services/document-info.service';
|
||||
import { ReanalysisService } from '../../../../services/reanalysis.service';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { CommentingService } from './services/commenting.service';
|
||||
import { SkippedService } from './services/skipped.service';
|
||||
import { AnnotationActionsService } from './services/annotation-actions.service';
|
||||
import Annotation = Core.Annotations.Annotation;
|
||||
import PDFNet = Core.PDFNet;
|
||||
|
||||
@ -55,7 +57,17 @@ const ALL_HOTKEY_ARRAY = ['Escape', 'F', 'f', 'ArrowUp', 'ArrowDown'];
|
||||
@Component({
|
||||
templateUrl: './file-preview-screen.component.html',
|
||||
styleUrls: ['./file-preview-screen.component.scss'],
|
||||
providers: [FilterService, ExcludedPagesService, ViewModeService, MultiSelectService, DocumentInfoService, CommentingService],
|
||||
providers: [
|
||||
FilterService,
|
||||
ExcludedPagesService,
|
||||
ViewModeService,
|
||||
MultiSelectService,
|
||||
DocumentInfoService,
|
||||
CommentingService,
|
||||
SkippedService,
|
||||
AnnotationDrawService,
|
||||
AnnotationActionsService,
|
||||
],
|
||||
})
|
||||
export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnInit, OnDestroy, OnAttach, OnDetach {
|
||||
readonly circleButtonTypes = CircleButtonTypes;
|
||||
@ -65,7 +77,6 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
|
||||
shouldDeselectAnnotationsOnPageChange = true;
|
||||
fileData: FileDataModel;
|
||||
selectedAnnotations: AnnotationWrapper[] = [];
|
||||
hideSkipped = false;
|
||||
displayPdfViewer = false;
|
||||
activeViewerPage: number = null;
|
||||
@ViewChild(PdfViewerComponent) readonly viewerComponent: PdfViewerComponent;
|
||||
@ -105,6 +116,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
|
||||
private readonly _dossiersService: DossiersService,
|
||||
private readonly _reanalysisService: ReanalysisService,
|
||||
private readonly _errorService: ErrorService,
|
||||
private readonly _skippedService: SkippedService,
|
||||
readonly excludedPagesService: ExcludedPagesService,
|
||||
readonly viewModeService: ViewModeService,
|
||||
readonly multiSelectService: MultiSelectService,
|
||||
@ -422,16 +434,6 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
|
||||
download(data, file.filename);
|
||||
}
|
||||
|
||||
toggleSkipped($event) {
|
||||
$event.stopPropagation();
|
||||
$event.preventDefault();
|
||||
this.hideSkipped = !this.hideSkipped;
|
||||
|
||||
this._handleIgnoreAnnotationsDrawing();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private _setActiveViewerPage() {
|
||||
const currentPage = this._instance?.Core.documentViewer?.getCurrentPage();
|
||||
if (!currentPage) {
|
||||
@ -548,6 +550,10 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
|
||||
.watchDeleted$(this.fileId)
|
||||
.pipe(tap(() => this._handleDeletedFile()))
|
||||
.subscribe();
|
||||
|
||||
this.addActiveScreenSubscription = this._skippedService.hideSkipped$
|
||||
.pipe(tap(hideSkipped => this._handleIgnoreAnnotationsDrawing(hideSkipped)))
|
||||
.subscribe();
|
||||
}
|
||||
|
||||
private _handleDeletedDossier(): void {
|
||||
@ -632,7 +638,6 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
|
||||
annotations,
|
||||
this.fileId,
|
||||
this.dossierId,
|
||||
this.hideSkipped,
|
||||
!!this.viewModeService.isCompare,
|
||||
);
|
||||
}
|
||||
@ -674,9 +679,13 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
|
||||
}
|
||||
}
|
||||
|
||||
private _handleIgnoreAnnotationsDrawing() {
|
||||
private _handleIgnoreAnnotationsDrawing(hideSkipped: boolean): void {
|
||||
const ignored = this._getAnnotations(a => a.getCustomData('skipped'));
|
||||
return this.hideSkipped ? this._hide(ignored) : this._show(ignored);
|
||||
if (hideSkipped) {
|
||||
this._hide(ignored);
|
||||
} else {
|
||||
this._show(ignored);
|
||||
}
|
||||
}
|
||||
|
||||
private _getAnnotations(predicate: (value) => unknown) {
|
||||
|
||||
@ -1,19 +1,19 @@
|
||||
import { EventEmitter, Inject, Injectable, NgZone } from '@angular/core';
|
||||
import { PermissionsService } from '@services/permissions.service';
|
||||
import { ManualAnnotationService } from './manual-annotation.service';
|
||||
import { ManualAnnotationService } from '../../../services/manual-annotation.service';
|
||||
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
||||
import { Observable } from 'rxjs';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { getFirstRelevantTextPart } from '@utils/functions';
|
||||
import { AnnotationPermissions } from '@models/file/annotation.permissions';
|
||||
import { DossiersDialogService } from './dossiers-dialog.service';
|
||||
import { BASE_HREF } from '../../../tokens';
|
||||
import { DossiersDialogService } from '../../../services/dossiers-dialog.service';
|
||||
import { BASE_HREF } from '../../../../../tokens';
|
||||
import { UserService } from '@services/user.service';
|
||||
import { Core, WebViewerInstance } from '@pdftron/webviewer';
|
||||
import { Dossier, File, IAddRedactionRequest, ILegalBasisChangeRequest, IRectangle, IResizeRequest } from '@red/domain';
|
||||
import { toPosition } from '../utils/pdf-calculation.utils';
|
||||
import { toPosition } from '../../../utils/pdf-calculation.utils';
|
||||
import { AnnotationDrawService } from './annotation-draw.service';
|
||||
import { translateQuads } from '../../../utils';
|
||||
import { translateQuads } from '@utils/pdf-coordinates';
|
||||
import { DossiersService } from '@services/entity-services/dossiers.service';
|
||||
import Annotation = Core.Annotations.Annotation;
|
||||
|
||||
@ -5,10 +5,11 @@ import { AppStateService } from '@state/app-state.service';
|
||||
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
||||
import { UserPreferenceService } from '@services/user-preference.service';
|
||||
import { DossiersService } from '@services/entity-services/dossiers.service';
|
||||
import { RedactionLogService } from './redaction-log.service';
|
||||
import { RedactionLogService } from '../../../services/redaction-log.service';
|
||||
import { environment } from '@environments/environment';
|
||||
|
||||
import { IRectangle, ISectionGrid, ISectionRectangle } from '@red/domain';
|
||||
import { SkippedService } from './skipped.service';
|
||||
import Annotation = Core.Annotations.Annotation;
|
||||
|
||||
@Injectable()
|
||||
@ -18,6 +19,7 @@ export class AnnotationDrawService {
|
||||
private readonly _dossiersService: DossiersService,
|
||||
private readonly _redactionLogService: RedactionLogService,
|
||||
private readonly _userPreferenceService: UserPreferenceService,
|
||||
private readonly _skippedService: SkippedService,
|
||||
) {}
|
||||
|
||||
async drawAnnotations(
|
||||
@ -25,7 +27,6 @@ export class AnnotationDrawService {
|
||||
annotationWrappers: AnnotationWrapper[],
|
||||
fileId: string,
|
||||
dossierId: string,
|
||||
hideSkipped = false,
|
||||
compareMode = false,
|
||||
) {
|
||||
if (!activeViewer) {
|
||||
@ -36,7 +37,7 @@ export class AnnotationDrawService {
|
||||
|
||||
await pdfNet.runWithCleanup(
|
||||
async () => {
|
||||
await this._drawAnnotations(activeViewer, annotationWrappers, fileId, dossierId, hideSkipped, compareMode);
|
||||
await this._drawAnnotations(activeViewer, annotationWrappers, fileId, dossierId, compareMode);
|
||||
},
|
||||
environment.licenseKey ? atob(environment.licenseKey) : null,
|
||||
);
|
||||
@ -82,12 +83,9 @@ export class AnnotationDrawService {
|
||||
annotationWrappers: AnnotationWrapper[],
|
||||
fileId: string,
|
||||
dossierId: string,
|
||||
hideSkipped: boolean,
|
||||
compareMode: boolean,
|
||||
) {
|
||||
const annotations = annotationWrappers.map(annotation =>
|
||||
this._computeAnnotation(activeViewer, annotation, dossierId, hideSkipped, compareMode),
|
||||
);
|
||||
const annotations = annotationWrappers.map(annotation => this._computeAnnotation(activeViewer, annotation, dossierId, compareMode));
|
||||
const annotationManager = activeViewer.Core.annotationManager;
|
||||
annotationManager.addAnnotations(annotations, { imported: true });
|
||||
await annotationManager.drawAnnotationsFromList(annotations);
|
||||
@ -143,7 +141,6 @@ export class AnnotationDrawService {
|
||||
activeViewer: WebViewerInstance,
|
||||
annotationWrapper: AnnotationWrapper,
|
||||
dossierId: string,
|
||||
hideSkipped: boolean,
|
||||
compareMode: boolean,
|
||||
) {
|
||||
const pageNumber = compareMode ? annotationWrapper.pageNumber * 2 - 1 : annotationWrapper.pageNumber;
|
||||
@ -177,7 +174,7 @@ export class AnnotationDrawService {
|
||||
|
||||
annotation.Hidden =
|
||||
annotationWrapper.isChangeLogRemoved ||
|
||||
(hideSkipped && annotationWrapper.isSkipped) ||
|
||||
(this._skippedService.hideSkipped && annotationWrapper.isSkipped) ||
|
||||
annotationWrapper.isOCR ||
|
||||
annotationWrapper.hidden;
|
||||
annotation.setCustomData('redact-manager', 'true');
|
||||
@ -0,0 +1,24 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { BehaviorSubject, Observable } from 'rxjs';
|
||||
import { skip } from 'rxjs/operators';
|
||||
import { shareDistinctLast } from '@iqser/common-ui';
|
||||
|
||||
@Injectable()
|
||||
export class SkippedService {
|
||||
readonly hideSkipped$: Observable<boolean>;
|
||||
private readonly _hideSkipped$ = new BehaviorSubject(false);
|
||||
|
||||
constructor() {
|
||||
this.hideSkipped$ = this._hideSkipped$.pipe(shareDistinctLast(), skip(1));
|
||||
}
|
||||
|
||||
get hideSkipped(): boolean {
|
||||
return this._hideSkipped$.value;
|
||||
}
|
||||
|
||||
toggleSkipped($event): void {
|
||||
$event.stopPropagation();
|
||||
$event.preventDefault();
|
||||
this._hideSkipped$.next(!this.hideSkipped);
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user