-
diff --git a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/file-workload/file-workload.component.ts b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/file-workload/file-workload.component.ts
index 4cbf24a2e..507f275d1 100644
--- a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/file-workload/file-workload.component.ts
+++ b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/file-workload/file-workload.component.ts
@@ -14,13 +14,23 @@ import { AnnotationWrapper } from '@models/file/annotation.wrapper';
import { AnnotationProcessingService } from '../../../../services/annotation-processing.service';
import { MatDialogRef, MatDialogState } from '@angular/material/dialog';
import scrollIntoView from 'scroll-into-view-if-needed';
-import { CircleButtonTypes, Debounce, FilterService, IconButtonTypes, INestedFilter, IqserEventTarget, Required } from '@iqser/common-ui';
+import {
+ CircleButtonTypes,
+ Debounce,
+ FilterService,
+ IconButtonTypes,
+ INestedFilter,
+ IqserEventTarget,
+ Required,
+ shareDistinctLast,
+} from '@iqser/common-ui';
import { PermissionsService } from '@services/permissions.service';
import { WebViewerInstance } from '@pdftron/webviewer';
import { BehaviorSubject, combineLatest, Observable } from 'rxjs';
-import { map } from 'rxjs/operators';
+import { map, tap } from 'rxjs/operators';
import { File, IViewedPage } from '@red/domain';
import { ExcludedPagesService } from '../../services/excluded-pages.service';
+import { MultiSelectService } from '../../services/multi-select.service';
const COMMAND_KEY_ARRAY = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'Escape'];
const ALL_HOTKEY_ARRAY = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown'];
@@ -46,9 +56,7 @@ export class FileWorkloadComponent {
@Input() annotationActionsTemplate: TemplateRef
;
@Input() viewer: WebViewerInstance;
@Output() readonly shouldDeselectAnnotationsOnPageChangeChange = new EventEmitter();
- @Output() readonly selectAnnotations = new EventEmitter<
- AnnotationWrapper[] | { annotations: AnnotationWrapper[]; multiSelect: boolean }
- >();
+ @Output() readonly selectAnnotations = new EventEmitter();
@Output() readonly deselectAnnotations = new EventEmitter();
@Output() readonly selectPage = new EventEmitter();
@Output() readonly toggleSkipped = new EventEmitter();
@@ -56,18 +64,23 @@ export class FileWorkloadComponent {
displayedPages: number[] = [];
pagesPanelActive = true;
readonly displayedAnnotations$: Observable
diff --git a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/file-preview-screen.component.ts b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/file-preview-screen.component.ts
index 2177ccd43..052ddc0fb 100644
--- a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/file-preview-screen.component.ts
+++ b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/file-preview-screen.component.ts
@@ -23,6 +23,7 @@ import {
OnDetach,
processFilters,
shareDistinctLast,
+ shareLast,
} from '@iqser/common-ui';
import { MatDialogRef, MatDialogState } from '@angular/material/dialog';
import { ManualRedactionEntryWrapper } from '@models/file/manual-redaction-entry.wrapper';
@@ -52,6 +53,7 @@ import { FilesMapService } from '@services/entity-services/files-map.service';
import { WatermarkService } from '@shared/services/watermark.service';
import { ExcludedPagesService } from './services/excluded-pages.service';
import { ViewModeService } from './services/view-mode.service';
+import { MultiSelectService } from './services/multi-select.service';
import Annotation = Core.Annotations.Annotation;
import PDFNet = Core.PDFNet;
@@ -60,7 +62,7 @@ const ALL_HOTKEY_ARRAY = ['Escape', 'F', 'f'];
@Component({
templateUrl: './file-preview-screen.component.html',
styleUrls: ['./file-preview-screen.component.scss'],
- providers: [FilterService, ExcludedPagesService, ViewModeService],
+ providers: [FilterService, ExcludedPagesService, ViewModeService, MultiSelectService],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnInit, OnDestroy, OnAttach, OnDetach {
@@ -116,6 +118,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
private readonly _dossiersService: DossiersService,
readonly excludedPagesService: ExcludedPagesService,
readonly viewModeService: ViewModeService,
+ readonly multiSelectService: MultiSelectService,
) {
super();
this.dossierId = _activatedRoute.snapshot.paramMap.get('dossierId');
@@ -125,6 +128,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
tap(async file => {
await this._reloadFile(file);
}),
+ shareLast(),
);
this.showExcludedPages$ = this._showExcludedPages$;
this.canPerformAnnotationActions$ = this._canPerformAnnotationActions$;
@@ -152,16 +156,8 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
return this.viewModeService.isStandard ? currentPage : currentPage % 2 === 0 ? currentPage / 2 : (currentPage + 1) / 2;
}
- get displayData(): Blob {
- return this.fileData?.fileData;
- }
-
- get multiSelectActive(): boolean {
- return !!this._workloadComponent?.multiSelectActive;
- }
-
private get _showExcludedPages$() {
- return this.excludedPagesService.show$.pipe(tap(() => this._disableMultiSelectAndDocumentInfo()));
+ return this.excludedPagesService.shown$.pipe(tap(() => this._disableMultiSelectAndDocumentInfo()));
}
private get _canPerformAnnotationActions$() {
@@ -288,17 +284,17 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
.map(id => this.annotations.find(annotationWrapper => annotationWrapper.id === id))
.filter(ann => ann !== undefined);
if (this.selectedAnnotations.length > 1) {
- this._workloadComponent.multiSelectActive = true;
+ this.multiSelectService.activate();
}
this._workloadComponent.scrollToSelectedAnnotation();
this._changeDetectorRef.markForCheck();
}
- selectAnnotations(annotations?: AnnotationWrapper[] | { annotations: AnnotationWrapper[]; multiSelect: boolean }) {
+ selectAnnotations(annotations?: AnnotationWrapper[]) {
if (annotations) {
- this.viewerComponent.utils.selectAnnotations(annotations);
+ this.viewerComponent?.utils.selectAnnotations(annotations, this.multiSelectService.isActive);
} else {
- this.viewerComponent.utils.deselectAllAnnotations();
+ this.viewerComponent?.utils.deselectAllAnnotations();
}
}
@@ -379,7 +375,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
}
this._scrollViews();
- if (!this._workloadComponent.multiSelectActive) {
+ if (!this.multiSelectService.isActive) {
this.shouldDeselectAnnotationsOnPageChange = true;
}
@@ -420,8 +416,8 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
}
toggleViewDocumentInfo(): void {
- this.viewDocumentInfo = !this.viewDocumentInfo;
- this._workloadComponent.multiSelectActive = false;
+ this.viewDocumentInfo = true;
+ this.multiSelectService.deactivate();
this.excludedPagesService.hide();
}
@@ -455,15 +451,13 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
}
private async _reloadFile(file: File): Promise {
- this._loadingService.start();
await this._loadFileData(file, true);
await this._cleanupAndRedrawManualAnnotations$().toPromise();
await this._stampPDF();
- this._loadingService.stop();
}
private _disableMultiSelectAndDocumentInfo(): void {
- this._workloadComponent.multiSelectActive = false;
+ this.multiSelectService.deactivate();
this.viewDocumentInfo = false;
}
@@ -551,12 +545,11 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
if (performUpdate && !!this.fileData) {
this.fileData.redactionLog = fileData.redactionLog;
this.fileData.viewedPages = fileData.viewedPages;
- this.rebuildFilters(true);
} else {
this.fileData = fileData;
- this.rebuildFilters();
}
+ this.rebuildFilters();
return;
}
diff --git a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/services/excluded-pages.service.ts b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/services/excluded-pages.service.ts
index 8285eeefc..72089416c 100644
--- a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/services/excluded-pages.service.ts
+++ b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/services/excluded-pages.service.ts
@@ -1,14 +1,17 @@
import { Injectable } from '@angular/core';
import { BehaviorSubject, Observable } from 'rxjs';
import { shareDistinctLast } from '@iqser/common-ui';
+import { map } from 'rxjs/operators';
@Injectable()
export class ExcludedPagesService {
- readonly show$: Observable;
+ readonly shown$: Observable;
+ readonly hidden$: Observable;
private readonly _show$ = new BehaviorSubject(false);
constructor() {
- this.show$ = this._show$.asObservable().pipe(shareDistinctLast());
+ this.shown$ = this._show$.asObservable().pipe(shareDistinctLast());
+ this.hidden$ = this.shown$.pipe(map(value => !value));
}
show() {
diff --git a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/services/multi-select.service.ts b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/services/multi-select.service.ts
new file mode 100644
index 000000000..60e990157
--- /dev/null
+++ b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/services/multi-select.service.ts
@@ -0,0 +1,32 @@
+import { Injectable } from '@angular/core';
+import { BehaviorSubject, Observable } from 'rxjs';
+import { shareDistinctLast } from '@iqser/common-ui';
+import { map } from 'rxjs/operators';
+
+@Injectable()
+export class MultiSelectService {
+ readonly active$: Observable;
+ readonly inactive$: Observable;
+ private readonly _active$ = new BehaviorSubject(false);
+
+ constructor() {
+ this.active$ = this._active$.asObservable().pipe(shareDistinctLast());
+ this.inactive$ = this.active$.pipe(map(value => !value));
+ }
+
+ get isActive() {
+ return this._active$.value;
+ }
+
+ activate() {
+ this._active$.next(true);
+ }
+
+ deactivate() {
+ this._active$.next(false);
+ }
+
+ toggle() {
+ this._active$.next(!this._active$.value);
+ }
+}
diff --git a/apps/red-ui/src/app/modules/dossier/shared/components/file-actions/file-actions.component.html b/apps/red-ui/src/app/modules/dossier/shared/components/file-actions/file-actions.component.html
index f477b0970..766eac5a7 100644
--- a/apps/red-ui/src/app/modules/dossier/shared/components/file-actions/file-actions.component.html
+++ b/apps/red-ui/src/app/modules/dossier/shared/components/file-actions/file-actions.component.html
@@ -73,7 +73,7 @@