fix RED-3000

This commit is contained in:
Dan Percic 2021-12-08 12:57:13 +02:00
parent 46318357d5
commit e780c683ec
4 changed files with 27 additions and 20 deletions

View File

@ -1,11 +1,7 @@
<div <div *ngIf="showExcludedPages$ | async; else selectAndFilter" class="right-title heading" translate="file-preview.tabs.exclude-pages.label">
*ngIf="excludedPageService.shown$ | async; else selectAndFilter"
class="right-title heading"
translate="file-preview.tabs.exclude-pages.label"
>
<div> <div>
<iqser-circle-button <iqser-circle-button
(action)="excludedPageService.toggle()" (action)="excludedPagesService.toggle()"
[tooltip]="'file-preview.tabs.exclude-pages.close' | translate" [tooltip]="'file-preview.tabs.exclude-pages.close' | translate"
icon="iqser:close" icon="iqser:close"
tooltipPosition="before" tooltipPosition="before"
@ -122,11 +118,11 @@
</div> </div>
<div style="overflow: hidden; width: 100%"> <div style="overflow: hidden; width: 100%">
<ng-container *ngIf="excludedPageService.hidden$ | async"> <ng-container *ngIf="excludedPagesService.hidden$ | async">
<div [attr.anotation-page-header]="activeViewerPage" [class.padding-left-0]="currentPageIsExcluded" class="page-separator"> <div [attr.anotation-page-header]="activeViewerPage" [class.padding-left-0]="currentPageIsExcluded" class="page-separator">
<span *ngIf="!!activeViewerPage" class="flex-align-items-center"> <span *ngIf="!!activeViewerPage" class="flex-align-items-center">
<iqser-circle-button <iqser-circle-button
(action)="excludedPageService.toggle()" (action)="excludedPagesService.toggle()"
*ngIf="currentPageIsExcluded" *ngIf="currentPageIsExcluded"
[tooltip]="'file-preview.excluded-from-redaction' | translate | capitalize" [tooltip]="'file-preview.excluded-from-redaction' | translate | capitalize"
icon="red:exclude-pages" icon="red:exclude-pages"
@ -173,7 +169,7 @@
<ng-container *ngIf="currentPageIsExcluded"> <ng-container *ngIf="currentPageIsExcluded">
{{ 'file-preview.tabs.annotations.page-is' | translate }} {{ 'file-preview.tabs.annotations.page-is' | translate }}
<a <a
(click)="excludedPageService.toggle()" (click)="excludedPagesService.toggle()"
class="with-underline" class="with-underline"
translate="file-preview.excluded-from-redaction" translate="file-preview.excluded-from-redaction"
></a ></a
@ -216,7 +212,7 @@
</div> </div>
</ng-container> </ng-container>
<redaction-page-exclusion *ngIf="excludedPageService.shown$ | async" [file]="file"></redaction-page-exclusion> <redaction-page-exclusion *ngIf="showExcludedPages$ | async" [file]="file"></redaction-page-exclusion>
</div> </div>
</div> </div>
</div> </div>

View File

@ -23,6 +23,7 @@ import {
IqserEventTarget, IqserEventTarget,
Required, Required,
shareDistinctLast, shareDistinctLast,
shareLast,
} from '@iqser/common-ui'; } from '@iqser/common-ui';
import { PermissionsService } from '@services/permissions.service'; import { PermissionsService } from '@services/permissions.service';
import { WebViewerInstance } from '@pdftron/webviewer'; import { WebViewerInstance } from '@pdftron/webviewer';
@ -31,6 +32,7 @@ import { map, tap } from 'rxjs/operators';
import { File, IViewedPage } from '@red/domain'; import { File, IViewedPage } from '@red/domain';
import { ExcludedPagesService } from '../../services/excluded-pages.service'; import { ExcludedPagesService } from '../../services/excluded-pages.service';
import { MultiSelectService } from '../../services/multi-select.service'; import { MultiSelectService } from '../../services/multi-select.service';
import { DocumentInfoService } from '../../services/document-info.service';
const COMMAND_KEY_ARRAY = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'Escape']; const COMMAND_KEY_ARRAY = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'Escape'];
const ALL_HOTKEY_ARRAY = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown']; const ALL_HOTKEY_ARRAY = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown'];
@ -66,13 +68,15 @@ export class FileWorkloadComponent {
readonly displayedAnnotations$: Observable<Map<number, AnnotationWrapper[]>>; readonly displayedAnnotations$: Observable<Map<number, AnnotationWrapper[]>>;
readonly multiSelectActive$: Observable<boolean>; readonly multiSelectActive$: Observable<boolean>;
readonly multiSelectInactive$: Observable<boolean>; readonly multiSelectInactive$: Observable<boolean>;
readonly showExcludedPages$: Observable<boolean>;
private _annotations$ = new BehaviorSubject<AnnotationWrapper[]>([]); private _annotations$ = new BehaviorSubject<AnnotationWrapper[]>([]);
@ViewChild('annotationsElement') private readonly _annotationsElement: ElementRef; @ViewChild('annotationsElement') private readonly _annotationsElement: ElementRef;
@ViewChild('quickNavigation') private readonly _quickNavigationElement: ElementRef; @ViewChild('quickNavigation') private readonly _quickNavigationElement: ElementRef;
constructor( constructor(
readonly excludedPageService: ExcludedPagesService, readonly excludedPagesService: ExcludedPagesService,
readonly multiSelectService: MultiSelectService, readonly multiSelectService: MultiSelectService,
readonly documentInfoService: DocumentInfoService,
private readonly _permissionsService: PermissionsService, private readonly _permissionsService: PermissionsService,
private readonly _changeDetectorRef: ChangeDetectorRef, private readonly _changeDetectorRef: ChangeDetectorRef,
private readonly _filterService: FilterService, private readonly _filterService: FilterService,
@ -81,6 +85,7 @@ export class FileWorkloadComponent {
this.displayedAnnotations$ = this._displayedAnnotations$; this.displayedAnnotations$ = this._displayedAnnotations$;
this.multiSelectActive$ = this._multiSelectActive$; this.multiSelectActive$ = this._multiSelectActive$;
this.multiSelectInactive$ = this._multiSelectInactive$; this.multiSelectInactive$ = this._multiSelectInactive$;
this.showExcludedPages$ = this._showExcludedPages$;
} }
@Input() @Input()
@ -100,6 +105,13 @@ export class FileWorkloadComponent {
return this.file?.excludedPages?.includes(this.activeViewerPage); return this.file?.excludedPages?.includes(this.activeViewerPage);
} }
private get _showExcludedPages$() {
return this.excludedPagesService.shown$.pipe(
tap(() => this._disableMultiSelectAndDocumentInfo()),
shareLast(),
);
}
private get _multiSelectInactive$() { private get _multiSelectInactive$() {
return this.multiSelectService.inactive$.pipe( return this.multiSelectService.inactive$.pipe(
tap(value => { tap(value => {
@ -261,6 +273,11 @@ export class FileWorkloadComponent {
this.selectPage.emit(this._nextPageWithAnnotations()); this.selectPage.emit(this._nextPageWithAnnotations());
} }
private _disableMultiSelectAndDocumentInfo(): void {
this.multiSelectService.deactivate();
this.documentInfoService.hide();
}
private _filterAnnotations( private _filterAnnotations(
annotations: AnnotationWrapper[], annotations: AnnotationWrapper[],
primary: INestedFilter[], primary: INestedFilter[],

View File

@ -81,7 +81,6 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
readonly dossierId: string; readonly dossierId: string;
readonly canPerformAnnotationActions$: Observable<boolean>; readonly canPerformAnnotationActions$: Observable<boolean>;
readonly dossier$: Observable<Dossier>; readonly dossier$: Observable<Dossier>;
readonly showExcludedPages$: Observable<boolean>;
readonly viewDocumentInfo$: Observable<boolean>; readonly viewDocumentInfo$: Observable<boolean>;
readonly file$: Observable<File>; readonly file$: Observable<File>;
readonly fileId: string; readonly fileId: string;
@ -132,7 +131,6 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
}), }),
shareLast(), shareLast(),
); );
this.showExcludedPages$ = this._showExcludedPages$;
this.viewDocumentInfo$ = this._viewDocumentInfo$; this.viewDocumentInfo$ = this._viewDocumentInfo$;
this.canPerformAnnotationActions$ = this._canPerformAnnotationActions$; this.canPerformAnnotationActions$ = this._canPerformAnnotationActions$;
@ -171,10 +169,6 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
); );
} }
private get _showExcludedPages$() {
return this.excludedPagesService.shown$.pipe(tap(() => this._disableMultiSelectAndDocumentInfo()));
}
private get _canPerformAnnotationActions$() { private get _canPerformAnnotationActions$() {
return combineLatest([this.file$, this.viewModeService.viewMode$]).pipe( return combineLatest([this.file$, this.viewModeService.viewMode$]).pipe(
map(([file, viewMode]) => this.permissionsService.canPerformAnnotationActions(file) && viewMode === 'STANDARD'), map(([file, viewMode]) => this.permissionsService.canPerformAnnotationActions(file) && viewMode === 'STANDARD'),

View File

@ -1,6 +1,6 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { BehaviorSubject, merge, Observable } from 'rxjs'; import { BehaviorSubject, merge, Observable } from 'rxjs';
import { shareDistinctLast } from '@iqser/common-ui'; import { shareLast } from '@iqser/common-ui';
import { filter, map, startWith, withLatestFrom } from 'rxjs/operators'; import { filter, map, startWith, withLatestFrom } from 'rxjs/operators';
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service'; import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
import { FileAttributesService } from '@services/entity-services/file-attributes.service'; import { FileAttributesService } from '@services/entity-services/file-attributes.service';
@ -18,10 +18,10 @@ export class DocumentInfoService {
private readonly _fileAttributesService: FileAttributesService, private readonly _fileAttributesService: FileAttributesService,
private readonly _filesMapService: FilesMapService, private readonly _filesMapService: FilesMapService,
) { ) {
this.shown$ = this._show$.asObservable().pipe(shareDistinctLast()); this.shown$ = this._show$.asObservable().pipe(shareLast());
this.hidden$ = this.shown$.pipe( this.hidden$ = this.shown$.pipe(
map(value => !value), map(value => !value),
shareDistinctLast(), shareLast(),
); );
} }