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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
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 { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
import { FileAttributesService } from '@services/entity-services/file-attributes.service';
@ -18,10 +18,10 @@ export class DocumentInfoService {
private readonly _fileAttributesService: FileAttributesService,
private readonly _filesMapService: FilesMapService,
) {
this.shown$ = this._show$.asObservable().pipe(shareDistinctLast());
this.shown$ = this._show$.asObservable().pipe(shareLast());
this.hidden$ = this.shown$.pipe(
map(value => !value),
shareDistinctLast(),
shareLast(),
);
}