From 211a4c5039048c2e3973161f5f755ca6b78e03c9 Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Tue, 12 May 2020 01:30:15 +0300 Subject: [PATCH] feat(theme-shared): add dismissible property to confirmation options #3686 --- .../components/confirmation/confirmation.component.html | 5 ++++- .../packages/theme-shared/src/lib/models/confirmation.ts | 8 +++++++- .../theme-shared/src/lib/services/confirmation.service.ts | 7 +++++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/confirmation/confirmation.component.html b/npm/ng-packs/packages/theme-shared/src/lib/components/confirmation/confirmation.component.html index 8987cda2f9..47c555a16b 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/confirmation/confirmation.component.html +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/confirmation/confirmation.component.html @@ -1,5 +1,8 @@
-
+
diff --git a/npm/ng-packs/packages/theme-shared/src/lib/models/confirmation.ts b/npm/ng-packs/packages/theme-shared/src/lib/models/confirmation.ts index 815fd65c20..18dceb320d 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/models/confirmation.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/models/confirmation.ts @@ -3,13 +3,19 @@ import { Config } from '@abp/ng.core'; export namespace Confirmation { export interface Options { id?: any; - closable?: boolean; + dismissible?: boolean; messageLocalizationParams?: string[]; titleLocalizationParams?: string[]; hideCancelBtn?: boolean; hideYesBtn?: boolean; cancelText?: Config.LocalizationParam; yesText?: Config.LocalizationParam; + + /** + * + * @deprecated To be deleted in v2.9 + */ + closable?: boolean; } export interface DialogData { diff --git a/npm/ng-packs/packages/theme-shared/src/lib/services/confirmation.service.ts b/npm/ng-packs/packages/theme-shared/src/lib/services/confirmation.service.ts index 2672a93a2a..70ad0d0e2b 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/services/confirmation.service.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/services/confirmation.service.ts @@ -68,7 +68,7 @@ export class ConfirmationService { message: Config.LocalizationParam, title: Config.LocalizationParam, severity?: Confirmation.Severity, - options?: Partial, + options = {} as Partial, ): Observable { if (!this.containerComponentRef) this.setContainer(); @@ -78,8 +78,11 @@ export class ConfirmationService { severity: severity || 'neutral', options, }); + this.status$ = new Subject(); - this.listenToEscape(); + const { dismissible = true } = options; + if (dismissible) this.listenToEscape(); + return this.status$; }