@abp/ng.theme.shared 5.3.0 → 5.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,7 +14,7 @@ import { NgbInputDatepickerConfig, NgbTypeaheadConfig, NgbDateParserFormatter, N
14
14
  import * as i1$2 from '@swimlane/ngx-datatable';
15
15
  import { ColumnMode, NgxDatatableModule } from '@swimlane/ngx-datatable';
16
16
  import { HttpErrorResponse } from '@angular/common/http';
17
- import { NgxValidateCoreModule, VALIDATION_BLUEPRINTS, VALIDATION_MAP_ERRORS_FN, defaultMapErrorsFn, VALIDATION_VALIDATE_ON_SUBMIT, validatePassword } from '@ngx-validate/core';
17
+ import { NgxValidateCoreModule, VALIDATION_BLUEPRINTS, VALIDATION_MAP_ERRORS_FN, defaultMapErrorsFn, VALIDATION_VALIDATE_ON_SUBMIT, normalizeDiacritics } from '@ngx-validate/core';
18
18
  import { Validators } from '@angular/forms';
19
19
 
20
20
  const bounceIn = animation([
@@ -933,15 +933,19 @@ const DEFAULT_VALIDATION_BLUEPRINTS = {
933
933
  creditCard: 'AbpValidation::ThisFieldIsNotAValidCreditCardNumber.',
934
934
  email: 'AbpValidation::ThisFieldIsNotAValidEmailAddress.',
935
935
  invalid: 'AbpValidation::ThisFieldIsNotValid.',
936
- max: 'AbpValidation::ThisFieldMustBeBetween{0}And{1}[{{ min }},{{ max }}]',
936
+ max: 'AbpValidation::ThisFieldMustBeLessOrEqual{0}[{{ max }}]',
937
937
  maxlength: 'AbpValidation::ThisFieldMustBeAStringOrArrayTypeWithAMaximumLengthOf{0}[{{ requiredLength }}]',
938
- min: 'AbpValidation::ThisFieldMustBeBetween{0}And{1}[{{ min }},{{ max }}]',
938
+ min: 'AbpValidation::ThisFieldMustBeGreaterThanOrEqual{0}[{{ min }}]',
939
939
  minlength: 'AbpValidation::ThisFieldMustBeAStringOrArrayTypeWithAMinimumLengthOf{0}[{{ requiredLength }}]',
940
940
  ngbDate: 'AbpValidation::ThisFieldIsNotValid.',
941
941
  passwordMismatch: 'AbpIdentity::Volo.Abp.Identity:PasswordConfirmationFailed',
942
942
  range: 'AbpValidation::ThisFieldMustBeBetween{0}And{1}[{{ min }},{{ max }}]',
943
943
  required: 'AbpValidation::ThisFieldIsRequired.',
944
944
  url: 'AbpValidation::ThisFieldIsNotAValidFullyQualifiedHttpHttpsOrFtpUrl',
945
+ passwordRequiresLower: 'AbpIdentity::Volo.Abp.Identity:PasswordRequiresLower',
946
+ passwordRequiresUpper: 'AbpIdentity::Volo.Abp.Identity:PasswordRequiresUpper',
947
+ passwordRequiresDigit: 'AbpIdentity::Volo.Abp.Identity:PasswordRequiresDigit',
948
+ passwordRequiresNonAlphanumeric: 'AbpIdentity::Volo.Abp.Identity:PasswordRequiresNonAlphanumeric',
945
949
  };
946
950
 
947
951
  class EllipsisDirective {
@@ -2204,7 +2208,8 @@ function getPasswordValidators(injector) {
2204
2208
  if (Number.isInteger(+getRule('RequiredLength'))) {
2205
2209
  requiredLength = +getRule('RequiredLength');
2206
2210
  }
2207
- return [validatePassword(passwordRulesArr), minLength(requiredLength), maxLength(128)];
2211
+ const passwordValidators = passwordRulesArr.map(rule => validatePassword(rule));
2212
+ return [...passwordValidators, minLength(requiredLength), maxLength(128)];
2208
2213
  }
2209
2214
  function getRuleFn(injector) {
2210
2215
  const configState = injector.get(ConfigStateService);
@@ -2212,6 +2217,34 @@ function getRuleFn(injector) {
2212
2217
  const passwordRules = configState.getSettings('Identity.Password');
2213
2218
  return (passwordRules[`Abp.Identity.Password.${key}`] || '').toLowerCase();
2214
2219
  };
2220
+ }
2221
+ const errorMessageMap = {
2222
+ small: 'passwordRequiresLower',
2223
+ capital: 'passwordRequiresUpper',
2224
+ number: 'passwordRequiresDigit',
2225
+ special: 'passwordRequiresNonAlphanumeric',
2226
+ };
2227
+ function validatePassword(shouldContain) {
2228
+ return (control) => {
2229
+ if (!control.value)
2230
+ return null;
2231
+ const value = normalizeDiacritics(control.value);
2232
+ const regexMap = {
2233
+ small: /.*[a-z].*/,
2234
+ capital: /.*[A-Z].*/,
2235
+ number: /.*[0-9].*/,
2236
+ special: /.*[^0-9a-zA-Z].*/,
2237
+ };
2238
+ const regex = regexMap[shouldContain];
2239
+ const isValid = regex.test(value);
2240
+ if (isValid) {
2241
+ return null;
2242
+ }
2243
+ const error = errorMessageMap[shouldContain];
2244
+ return {
2245
+ [error]: true,
2246
+ };
2247
+ };
2215
2248
  }
2216
2249
 
2217
2250
  /*
@@ -2222,5 +2255,5 @@ function getRuleFn(injector) {
2222
2255
  * Generated bundle index. Do not edit.
2223
2256
  */
2224
2257
 
2225
- export { BaseThemeSharedModule, BreadcrumbComponent, BreadcrumbItemsComponent, ButtonComponent, Confirmation, ConfirmationComponent, ConfirmationService, DEFAULT_ERROR_LOCALIZATIONS, DEFAULT_ERROR_MESSAGES, DEFAULT_VALIDATION_BLUEPRINTS, DateParserFormatter, DocumentDirHandlerService, EllipsisDirective, EllipsisModule, ErrorHandler, HTTP_ERROR_CONFIG, HTTP_ERROR_HANDLER, HttpErrorWrapperComponent, LoaderBarComponent, LoadingComponent, LoadingDirective, ModalCloseDirective, ModalComponent, ModalRefService, NGX_DATATABLE_MESSAGES, NG_BOOTSTRAP_CONFIG_PROVIDERS, NavItem, NavItemsService, NgxDatatableDefaultDirective, NgxDatatableListDirective, PageAlertService, SUPPRESS_UNSAVED_CHANGES_WARNING, THEME_SHARED_APPEND_CONTENT, THEME_SHARED_ROUTE_PROVIDERS, ThemeSharedModule, ToastComponent, ToastContainerComponent, ToasterService, UserMenu, UserMenuService, bounceIn, collapse, collapseLinearWithMargin, collapseWithMargin, collapseX, collapseY, collapseYWithMargin, configureNgBootstrap, configureRoutes, defaultNgxDatatableMessages, dialogAnimation, expandX, expandY, expandYWithMargin, fadeAnimation, fadeIn, fadeInDown, fadeInLeft, fadeInRight, fadeInUp, fadeOut, fadeOutDown, fadeOutLeft, fadeOutRight, fadeOutUp, getPasswordValidators, httpErrorConfigFactory, slideFromBottom, toastInOut };
2258
+ export { BaseThemeSharedModule, BreadcrumbComponent, BreadcrumbItemsComponent, ButtonComponent, Confirmation, ConfirmationComponent, ConfirmationService, DEFAULT_ERROR_LOCALIZATIONS, DEFAULT_ERROR_MESSAGES, DEFAULT_VALIDATION_BLUEPRINTS, DateParserFormatter, DocumentDirHandlerService, EllipsisDirective, EllipsisModule, ErrorHandler, HTTP_ERROR_CONFIG, HTTP_ERROR_HANDLER, HttpErrorWrapperComponent, LoaderBarComponent, LoadingComponent, LoadingDirective, ModalCloseDirective, ModalComponent, ModalRefService, NGX_DATATABLE_MESSAGES, NG_BOOTSTRAP_CONFIG_PROVIDERS, NavItem, NavItemsService, NgxDatatableDefaultDirective, NgxDatatableListDirective, PageAlertService, SUPPRESS_UNSAVED_CHANGES_WARNING, THEME_SHARED_APPEND_CONTENT, THEME_SHARED_ROUTE_PROVIDERS, ThemeSharedModule, ToastComponent, ToastContainerComponent, ToasterService, UserMenu, UserMenuService, bounceIn, collapse, collapseLinearWithMargin, collapseWithMargin, collapseX, collapseY, collapseYWithMargin, configureNgBootstrap, configureRoutes, defaultNgxDatatableMessages, dialogAnimation, expandX, expandY, expandYWithMargin, fadeAnimation, fadeIn, fadeInDown, fadeInLeft, fadeInRight, fadeInUp, fadeOut, fadeOutDown, fadeOutLeft, fadeOutRight, fadeOutUp, getPasswordValidators, httpErrorConfigFactory, slideFromBottom, toastInOut, validatePassword };
2226
2259
  //# sourceMappingURL=abp-ng.theme.shared.mjs.map