From c28f0e65f1228515aa8174c9b7307c046892693b Mon Sep 17 00:00:00 2001 From: Arman Ozak Date: Sat, 2 Jan 2021 20:47:09 +0300 Subject: [PATCH] replace RootThemeBasicModule with individual tokens --- .../theme-basic/src/lib/theme-basic.module.ts | 53 ++++++++----------- 1 file changed, 21 insertions(+), 32 deletions(-) diff --git a/npm/ng-packs/packages/theme-basic/src/lib/theme-basic.module.ts b/npm/ng-packs/packages/theme-basic/src/lib/theme-basic.module.ts index a947809623..ee43ea2d6c 100644 --- a/npm/ng-packs/packages/theme-basic/src/lib/theme-basic.module.ts +++ b/npm/ng-packs/packages/theme-basic/src/lib/theme-basic.module.ts @@ -2,18 +2,22 @@ import { CoreModule } from '@abp/ng.core'; import { ThemeSharedModule } from '@abp/ng.theme.shared'; import { ModuleWithProviders, NgModule } from '@angular/core'; import { NgbCollapseModule, NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap'; -import { NgxValidateCoreModule } from '@ngx-validate/core'; +import { + NgxValidateCoreModule, + VALIDATION_ERROR_TEMPLATE, + VALIDATION_TARGET_SELECTOR, +} from '@ngx-validate/core'; import { AccountLayoutComponent } from './components/account-layout/account-layout.component'; import { ApplicationLayoutComponent } from './components/application-layout/application-layout.component'; import { EmptyLayoutComponent } from './components/empty-layout/empty-layout.component'; import { LogoComponent } from './components/logo/logo.component'; +import { CurrentUserComponent } from './components/nav-items/current-user.component'; +import { LanguagesComponent } from './components/nav-items/languages.component'; import { NavItemsComponent } from './components/nav-items/nav-items.component'; import { RoutesComponent } from './components/routes/routes.component'; import { ValidationErrorComponent } from './components/validation-error/validation-error.component'; -import { CurrentUserComponent } from './components/nav-items/current-user.component'; -import { LanguagesComponent } from './components/nav-items/languages.component'; -import { BASIC_THEME_STYLES_PROVIDERS } from './providers/styles.provider'; import { BASIC_THEME_NAV_ITEM_PROVIDERS } from './providers/nav-item.provider'; +import { BASIC_THEME_STYLES_PROVIDERS } from './providers/styles.provider'; export const LAYOUTS = [ApplicationLayoutComponent, AccountLayoutComponent, EmptyLayoutComponent]; @@ -48,34 +52,19 @@ export const LAYOUTS = [ApplicationLayoutComponent, AccountLayoutComponent, Empt export class ThemeBasicModule { static forRoot(): ModuleWithProviders { return { - ngModule: RootThemeBasicModule, - providers: [BASIC_THEME_NAV_ITEM_PROVIDERS, BASIC_THEME_STYLES_PROVIDERS], + ngModule: ThemeBasicModule, + providers: [ + BASIC_THEME_NAV_ITEM_PROVIDERS, + BASIC_THEME_STYLES_PROVIDERS, + { + provide: VALIDATION_ERROR_TEMPLATE, + useValue: ValidationErrorComponent, + }, + { + provide: VALIDATION_TARGET_SELECTOR, + useValue: '.form-group', + }, + ], }; } } - -@NgModule({ - imports: [ - NgxValidateCoreModule.forRoot({ - targetSelector: '.form-group', - blueprints: { - creditCard: 'AbpValidation::ThisFieldIsNotAValidCreditCardNumber.', - email: 'AbpValidation::ThisFieldIsNotAValidEmailAddress.', - invalid: 'AbpValidation::ThisFieldIsNotValid.', - max: 'AbpValidation::ThisFieldMustBeBetween{0}And{1}[{{ min }},{{ max }}]', - maxlength: - 'AbpValidation::ThisFieldMustBeAStringOrArrayTypeWithAMaximumLengthOf{0}[{{ requiredLength }}]', - min: 'AbpValidation::ThisFieldMustBeBetween{0}And{1}[{{ min }},{{ max }}]', - minlength: - 'AbpValidation::ThisFieldMustBeAStringOrArrayTypeWithAMinimumLengthOf{0}[{{ requiredLength }}]', - ngbDate: 'AbpValidation::ThisFieldIsNotValid.', - passwordMismatch: 'AbpIdentity::Volo.Abp.Identity:PasswordConfirmationFailed', - range: 'AbpValidation::ThisFieldMustBeBetween{0}And{1}[{{ min }},{{ max }}]', - required: 'AbpValidation::ThisFieldIsRequired.', - url: 'AbpValidation::ThisFieldIsNotAValidFullyQualifiedHttpHttpsOrFtpUrl', - }, - errorTemplate: ValidationErrorComponent, - }), - ], -}) -export class RootThemeBasicModule {}