diff --git a/docs/en/UI/Angular/Confirmation-Service.md b/docs/en/UI/Angular/Confirmation-Service.md index 2d1c5c1843..16dfa9fd94 100644 --- a/docs/en/UI/Angular/Confirmation-Service.md +++ b/docs/en/UI/Angular/Confirmation-Service.md @@ -53,7 +53,7 @@ this.confirmation - `Confirmation.Status` is an enum and has three properties; - `Confirmation.Status.confirm` is a closing event value that will be emitted when the popup is closed by the confirm button. - `Confirmation.Status.reject` is a closing event value that will be emitted when the popup is closed by the cancel button. - - `Confirmation.Status.dismiss` is a closing event value that will be emitted when the popup is closed by pressing the escape. + - `Confirmation.Status.dismiss` is a closing event value that will be emitted when the popup is closed by pressing the escape or clicking the backdrop. If you are not interested in the confirmation status, you do not have to subscribe to the returned observable: @@ -70,6 +70,7 @@ Options can be passed as the third parameter to `success`, `warn`, `error`, and const options: Partial = { hideCancelBtn: false, hideYesBtn: false, + dismissible: false, cancelText: 'Close', yesText: 'Confirm', messageLocalizationParams: ['Demo'], @@ -83,10 +84,11 @@ this.confirmation.warn( ); ``` -- `hideCancelBtn` option hides the cancellation button when `true`. Default value is `false` -- `hideYesBtn` option hides the confirmation button when `true`. Default value is `false` -- `cancelText` is the text of the cancellation button. A localization key or localization object can be passed. Default value is `AbpUi::Cancel` -- `yesText` is the text of the confirmation button. A localization key or localization object can be passed. Default value is `AbpUi::Yes` +- `hideCancelBtn` option hides the cancellation button when `true`. Default value is `false`. +- `hideYesBtn` option hides the confirmation button when `true`. Default value is `false`. +- `dismissible` option allows dismissing the confirmation popup by pressing escape or clicking the backdrop. Default value is `true`. +- `cancelText` is the text of the cancellation button. A localization key or localization object can be passed. Default value is `AbpUi::Cancel`. +- `yesText` is the text of the confirmation button. A localization key or localization object can be passed. Default value is `AbpUi::Yes`. - `messageLocalizationParams` is the interpolation parameters for the localization of the message. - `titleLocalizationParams` is the interpolation parameters for the localization of the title. diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Pagination/PagerModel.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Pagination/PagerModel.cs index db74266f38..980aacee8a 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Pagination/PagerModel.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Pagination/PagerModel.cs @@ -54,8 +54,8 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Pagination CurrentPage = currentPage; } - ShowingFrom = totalCount == 0 ? 0 : CurrentPage * PageSize; - ShowingTo = totalCount == 0 ? 0 : ShowingFrom + PageSize; + ShowingFrom = totalCount == 0 ? 0 : (CurrentPage - 1) * PageSize + 1; + ShowingTo = totalCount == 0 ? 0 : (int)Math.Min(ShowingFrom + PageSize - 1 , totalCount); PreviousPage = CurrentPage <= 1 ? 1 : CurrentPage - 1; NextPage = CurrentPage >= TotalPageCount ? CurrentPage : CurrentPage + 1; Pages = CalculatePageNumbers(); diff --git a/npm/ng-packs/packages/core/src/lib/tests/config.state.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/config.state.spec.ts index e823328f73..189a9ab6d9 100644 --- a/npm/ng-packs/packages/core/src/lib/tests/config.state.spec.ts +++ b/npm/ng-packs/packages/core/src/lib/tests/config.state.spec.ts @@ -306,6 +306,7 @@ describe('ConfigState', () => { const configuration = { setting: { values: { 'Abp.Localization.DefaultLanguage': 'tr;TR' } }, + localization: { currentCulture: {} }, }; const res$ = new ReplaySubject(1); @@ -324,7 +325,7 @@ describe('ConfigState', () => { timer(0).subscribe(() => { expect(patchStateArg).toEqual(configuration); expect(dispatchArg instanceof SetLanguage).toBeTruthy(); - expect(dispatchArg).toEqual({ payload: 'tr' }); + expect(dispatchArg).toEqual({ payload: 'tr', dispatchAppConfiguration: false }); done(); }); }); 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$; } diff --git a/npm/ng-packs/packages/theme-shared/src/lib/tests/confirmation.service.spec.ts b/npm/ng-packs/packages/theme-shared/src/lib/tests/confirmation.service.spec.ts index e70b88061f..3cbdcbd7de 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/tests/confirmation.service.spec.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/tests/confirmation.service.spec.ts @@ -105,6 +105,21 @@ describe('ConfirmationService', () => { selectConfirmationElement('button#cancel').click(); }); + + test.each` + dismissible | count + ${true} | ${1} + ${false} | ${0} + `( + 'should call the listenToEscape method $count times when dismissible is $dismissible', + ({ dismissible, count }) => { + const spy = spyOn(service as any, 'listenToEscape'); + + service.info('', '', { dismissible }); + + expect(spy).toHaveBeenCalledTimes(count); + }, + ); }); function clearElements(selector = '.confirmation') {