update documentInfoService
This commit is contained in:
parent
d593a01162
commit
4fca8621fa
@ -95,7 +95,11 @@
|
||||
icon="red:needs-work"
|
||||
></iqser-empty-state>
|
||||
|
||||
<redaction-document-info *ngIf="viewDocumentInfo$ | async" [dossier]="dossier" [file]="file"></redaction-document-info>
|
||||
<redaction-document-info
|
||||
*ngIf="documentInfoService.shown$ | async"
|
||||
[dossier]="dossier"
|
||||
[file]="file"
|
||||
></redaction-document-info>
|
||||
|
||||
<redaction-file-workload
|
||||
#fileWorkloadComponent
|
||||
|
||||
@ -70,7 +70,6 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
|
||||
readonly dossierId: string;
|
||||
readonly canPerformAnnotationActions$: Observable<boolean>;
|
||||
readonly dossier$: Observable<Dossier>;
|
||||
readonly viewDocumentInfo$: Observable<boolean>;
|
||||
readonly file$: Observable<File>;
|
||||
readonly fileId: string;
|
||||
ready = false;
|
||||
@ -121,7 +120,6 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
|
||||
}),
|
||||
shareLast(),
|
||||
);
|
||||
this.viewDocumentInfo$ = this._viewDocumentInfo$;
|
||||
this.canPerformAnnotationActions$ = this._canPerformAnnotationActions$;
|
||||
|
||||
document.documentElement.addEventListener('fullscreenchange', () => {
|
||||
@ -147,18 +145,6 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
|
||||
return this.viewModeService.isStandard ? currentPage : currentPage % 2 === 0 ? currentPage / 2 : (currentPage + 1) / 2;
|
||||
}
|
||||
|
||||
private get _viewDocumentInfo$() {
|
||||
return this.documentInfoService.shown$.pipe(
|
||||
tap(value => {
|
||||
if (value) {
|
||||
this.multiSelectService.deactivate();
|
||||
this.excludedPagesService.hide();
|
||||
}
|
||||
}),
|
||||
shareDistinctLast(),
|
||||
);
|
||||
}
|
||||
|
||||
private get _canPerformAnnotationActions$() {
|
||||
return combineLatest([this.file$, this.viewModeService.viewMode$]).pipe(
|
||||
map(([file, viewMode]) => this.permissionsService.canPerformAnnotationActions(file) && viewMode === 'STANDARD'),
|
||||
|
||||
@ -1,11 +1,13 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { BehaviorSubject, merge, Observable } from 'rxjs';
|
||||
import { shareLast } from '@iqser/common-ui';
|
||||
import { filter, map, startWith, withLatestFrom } from 'rxjs/operators';
|
||||
import { filter, map, startWith, tap, withLatestFrom } from 'rxjs/operators';
|
||||
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
|
||||
import { FileAttributesService } from '@services/entity-services/file-attributes.service';
|
||||
import { FilesMapService } from '@services/entity-services/files-map.service';
|
||||
import { File, IFileAttributeConfig } from '@red/domain';
|
||||
import { MultiSelectService } from './multi-select.service';
|
||||
import { ExcludedPagesService } from './excluded-pages.service';
|
||||
|
||||
@Injectable()
|
||||
export class DocumentInfoService {
|
||||
@ -17,8 +19,18 @@ export class DocumentInfoService {
|
||||
private readonly _dossierTemplatesService: DossierTemplatesService,
|
||||
private readonly _fileAttributesService: FileAttributesService,
|
||||
private readonly _filesMapService: FilesMapService,
|
||||
private readonly _multiSelectService: MultiSelectService,
|
||||
private readonly _excludedPagesService: ExcludedPagesService,
|
||||
) {
|
||||
this.shown$ = this._show$.asObservable().pipe(shareLast());
|
||||
this.shown$ = this._show$.asObservable().pipe(
|
||||
tap(show => {
|
||||
if (show) {
|
||||
this._multiSelectService.deactivate();
|
||||
this._excludedPagesService.hide();
|
||||
}
|
||||
}),
|
||||
shareLast(),
|
||||
);
|
||||
this.hidden$ = this.shown$.pipe(
|
||||
map(value => !value),
|
||||
shareLast(),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user