From af9adfd5799e20d8f674a5523ebfeda87897ef97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adina=20=C8=9Aeudan?= Date: Wed, 8 Dec 2021 12:12:37 +0200 Subject: [PATCH] Base dialog updates --- src/lib/dialog/base-dialog.component.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/lib/dialog/base-dialog.component.ts b/src/lib/dialog/base-dialog.component.ts index b54bc32..017173d 100644 --- a/src/lib/dialog/base-dialog.component.ts +++ b/src/lib/dialog/base-dialog.component.ts @@ -1,5 +1,4 @@ import { Directive, HostListener } from '@angular/core'; -import { FormGroup } from '@angular/forms'; import { IqserEventTarget } from '../utils'; @Directive() @@ -14,16 +13,16 @@ import { IqserEventTarget } from '../utils'; * (otherwise the save request will be triggered twice). * */ export abstract class BaseDialogComponent { - abstract form: FormGroup; - - abstract get changed(): boolean; + abstract changed: boolean; + abstract valid: boolean; + abstract disabled: boolean; abstract save(): void; @HostListener('window:keydown.Enter', ['$event']) onEnter(event: KeyboardEvent): void { const node = (event.target as IqserEventTarget).localName; - if (this.form.valid && this.changed && node !== 'textarea') { + if (this.valid && !this.disabled && this.changed && node !== 'textarea') { this.save(); } }