RED-8183: fixed not closing upon click on viewer.
This commit is contained in:
parent
bd7662d746
commit
0fd56e7329
@ -1,4 +1,4 @@
|
||||
import { Component, computed, HostListener } from '@angular/core';
|
||||
import { Component, computed, HostListener, NgZone, OnDestroy, OnInit } from '@angular/core';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { LoadingService, Toaster } from '@iqser/common-ui';
|
||||
import { getCurrentUser } from '@iqser/common-ui/lib/users';
|
||||
@ -10,13 +10,15 @@ import { UserService } from '@users/user.service';
|
||||
import { moveElementInArray } from '@utils/functions';
|
||||
import { FileAssignService } from '../../../shared-dossiers/services/file-assign.service';
|
||||
import { FilePreviewStateService } from '../../services/file-preview-state.service';
|
||||
import { PdfViewer } from '../../../pdf-viewer/services/pdf-viewer.service';
|
||||
import { Bind } from '@common-ui/utils';
|
||||
|
||||
@Component({
|
||||
selector: 'redaction-user-management',
|
||||
templateUrl: './user-management.component.html',
|
||||
styleUrls: ['./user-management.component.scss'],
|
||||
})
|
||||
export class UserManagementComponent {
|
||||
export class UserManagementComponent implements OnInit, OnDestroy {
|
||||
protected readonly _canAssignToSelf = computed(() => this.permissionsService.canAssignToSelf(this.state.file(), this.state.dossier()));
|
||||
protected readonly _canAssignUser = computed(() => this.permissionsService.canAssignUser(this.state.file(), this.state.dossier()));
|
||||
protected readonly _canUnassignUser = computed(() => this.permissionsService.canUnassignUser(this.state.file(), this.state.dossier()));
|
||||
@ -53,6 +55,8 @@ export class UserManagementComponent {
|
||||
readonly toaster: Toaster,
|
||||
readonly loadingService: LoadingService,
|
||||
readonly state: FilePreviewStateService,
|
||||
readonly pdf: PdfViewer,
|
||||
readonly ngZone: NgZone,
|
||||
) {}
|
||||
|
||||
async assignReviewer(file: File, user: User | string) {
|
||||
@ -75,8 +79,23 @@ export class UserManagementComponent {
|
||||
this.editingReviewer = false;
|
||||
}
|
||||
|
||||
@HostListener('document:click', ['$event'])
|
||||
clickOutside($event: MouseEvent) {
|
||||
ngOnInit() {
|
||||
this.pdf.instance.UI.iframeWindow.document.addEventListener('click', this.handleViewerClick);
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.pdf.instance.UI.iframeWindow.document.removeEventListener('click', this.handleViewerClick);
|
||||
}
|
||||
|
||||
@Bind()
|
||||
handleViewerClick() {
|
||||
this.ngZone.run(() => {
|
||||
this.editingReviewer = false;
|
||||
});
|
||||
}
|
||||
|
||||
@HostListener('document:click')
|
||||
clickOutside() {
|
||||
if (this.editingReviewer) {
|
||||
this.editingReviewer = false;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user