From 569fbf6b137a79d41e158589e92d8a7cd6d32ab6 Mon Sep 17 00:00:00 2001 From: Valentin Mihai Date: Fri, 17 Mar 2023 12:16:38 +0200 Subject: [PATCH] RED-6375 - Close "download options"-window if user click anywhere outside of the window --- .../download-dialog/download-dialog.component.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/apps/red-ui/src/app/modules/shared/dialogs/download-dialog/download-dialog.component.ts b/apps/red-ui/src/app/modules/shared/dialogs/download-dialog/download-dialog.component.ts index e1826bdc0..d7c98e035 100644 --- a/apps/red-ui/src/app/modules/shared/dialogs/download-dialog/download-dialog.component.ts +++ b/apps/red-ui/src/app/modules/shared/dialogs/download-dialog/download-dialog.component.ts @@ -2,10 +2,10 @@ import { Component, Inject } from '@angular/core'; import { Dossier, DownloadFileType, DownloadFileTypes, IReportTemplate, File, WorkflowFileStatuses } from '@red/domain'; import { downloadTypesForDownloadTranslations } from '@translations/download-types-translations'; import { ReportTemplateService } from '@services/report-template.service'; -import { AbstractControl, FormBuilder } from '@angular/forms'; +import { AbstractControl } from '@angular/forms'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; import { DefaultColorsService } from '@services/entity-services/default-colors.service'; -import { IconButtonTypes, List } from '@iqser/common-ui'; +import { BaseDialogComponent, IconButtonTypes, List } from '@iqser/common-ui'; export interface DownloadDialogData { readonly dossier: Dossier; @@ -23,19 +23,21 @@ export interface DownloadDialogResult { templateUrl: './download-dialog.component.html', styleUrls: ['./download-dialog.component.scss'], }) -export class DownloadDialogComponent { +export class DownloadDialogComponent extends BaseDialogComponent { readonly iconButtonTypes = IconButtonTypes; readonly downloadTypes: { key: DownloadFileType; label: string }[] = this._formDownloadTypes; readonly availableReportTypes = this._availableReportTypes; - readonly form = this._getForm(); constructor( private readonly _defaultColorsService: DefaultColorsService, private readonly _reportTemplateController: ReportTemplateService, - private readonly _formBuilder: FormBuilder, - private readonly _dialogRef: MatDialogRef, + protected readonly _dialogRef: MatDialogRef, @Inject(MAT_DIALOG_DATA) readonly data: DownloadDialogData, - ) {} + ) { + super(_dialogRef); + + this.form = this._getForm(); + } get reportTypesLength() { return this.form.controls.reportTemplateIds?.value?.length || 0;