diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/confirmation/confirmation.component.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/confirmation/confirmation.component.ts index afdb024888..92188acb34 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/confirmation/confirmation.component.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/confirmation/confirmation.component.ts @@ -2,7 +2,6 @@ import { Component } from '@angular/core'; import { ConfirmationService } from '../../services/confirmation.service'; import { Confirmation } from '../../models/confirmation'; import { LocalizationService } from '@abp/ng.core'; -import { Toaster } from '../../models/toaster'; @Component({ selector: 'abp-confirmation', @@ -10,9 +9,9 @@ import { Toaster } from '../../models/toaster'; styleUrls: ['./confirmation.component.scss'], }) export class ConfirmationComponent { - confirm = Toaster.Status.confirm; - reject = Toaster.Status.reject; - dismiss = Toaster.Status.dismiss; + confirm = Confirmation.Status.confirm; + reject = Confirmation.Status.reject; + dismiss = Confirmation.Status.dismiss; visible = false; @@ -43,7 +42,7 @@ export class ConfirmationComponent { }); } - close(status: Toaster.Status) { + close(status: Confirmation.Status) { this.confirmationService.clear(status); } } 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 40925c1b2c..815fd65c20 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 @@ -20,4 +20,10 @@ export namespace Confirmation { } export type Severity = 'neutral' | 'success' | 'info' | 'warning' | 'error'; + + export enum Status { + confirm = 'confirm', + reject = 'reject', + dismiss = 'dismiss', + } } 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 f66dfd768d..2db6d38091 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 @@ -2,19 +2,18 @@ import { Injectable } from '@angular/core'; import { Confirmation } from '../models/confirmation'; import { fromEvent, Observable, Subject, ReplaySubject } from 'rxjs'; import { takeUntil, debounceTime, filter } from 'rxjs/operators'; -import { Toaster } from '../models/toaster'; import { Config } from '@abp/ng.core'; @Injectable({ providedIn: 'root' }) export class ConfirmationService { - status$: Subject; + status$: Subject; confirmation$ = new ReplaySubject(1); info( message: Config.LocalizationParam, title: Config.LocalizationParam, options?: Partial, - ): Observable { + ): Observable { return this.show(message, title, 'info', options); } @@ -22,7 +21,7 @@ export class ConfirmationService { message: Config.LocalizationParam, title: Config.LocalizationParam, options?: Partial, - ): Observable { + ): Observable { return this.show(message, title, 'success', options); } @@ -30,7 +29,7 @@ export class ConfirmationService { message: Config.LocalizationParam, title: Config.LocalizationParam, options?: Partial, - ): Observable { + ): Observable { return this.show(message, title, 'warning', options); } @@ -38,16 +37,16 @@ export class ConfirmationService { message: Config.LocalizationParam, title: Config.LocalizationParam, options?: Partial, - ): Observable { + ): Observable { return this.show(message, title, 'error', options); } show( message: Config.LocalizationParam, title: Config.LocalizationParam, - severity?: Toaster.Severity, + severity?: Confirmation.Severity, options?: Partial, - ): Observable { + ): Observable { this.confirmation$.next({ message, title, @@ -59,9 +58,9 @@ export class ConfirmationService { return this.status$; } - clear(status?: Toaster.Status) { + clear(status?: Confirmation.Status) { this.confirmation$.next(); - this.status$.next(status || Toaster.Status.dismiss); + this.status$.next(status || Confirmation.Status.dismiss); } listenToEscape() {