@abp/ng.theme.shared 8.2.1 → 8.3.0-rc.1

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.
@@ -1,15 +1,14 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, Component, Input, ChangeDetectionStrategy, EventEmitter, Output, ViewChild, InjectionToken, Inject, inject, DestroyRef, createComponent, ViewEncapsulation, Optional, ContentChild, Directive, HostListener, forwardRef, HostBinding, NgModule, ChangeDetectorRef, Host, RendererFactory2, Injector, EnvironmentInjector, ApplicationRef, APP_INITIALIZER, LOCALE_ID } from '@angular/core';
2
+ import { Injectable, Component, Input, ChangeDetectionStrategy, EventEmitter, Output, ViewChild, InjectionToken, Inject, inject, DestroyRef, createComponent, ViewEncapsulation, model, input, viewChild, contentChild, output, effect, Directive, Optional, HostListener, forwardRef, HostBinding, NgModule, ChangeDetectorRef, Host, RendererFactory2, Injector, EnvironmentInjector, ApplicationRef, APP_INITIALIZER, LOCALE_ID, makeEnvironmentProviders } from '@angular/core';
3
3
  import * as i1 from '@angular/common';
4
4
  import { formatDate, DOCUMENT, CommonModule, DatePipe } from '@angular/common';
5
- import * as i3 from '@ng-bootstrap/ng-bootstrap';
6
- import { NgbDateAdapter, NgbTimeAdapter, NgbTooltip, NgbInputDatepickerConfig, NgbTypeaheadConfig, NgbDateParserFormatter, NgbPaginationModule } from '@ng-bootstrap/ng-bootstrap';
5
+ import { NgbDateAdapter, NgbTimeAdapter, NgbModal, NgbTooltip, NgbInputDatepickerConfig, NgbTypeaheadConfig, NgbDateParserFormatter, NgbPaginationModule } from '@ng-bootstrap/ng-bootstrap';
7
6
  import { animation, style, animate, keyframes, trigger, state, transition, useAnimation, query } from '@angular/animations';
8
7
  import * as i1$1 from '@angular/router';
9
8
  import { Router, ResolveEnd } from '@angular/router';
10
9
  import * as i2 from '@abp/ng.core';
11
- import { getRoutePath, SubscriptionService, PROJECTION_STRATEGY, uuid, AbstractNgModelComponent, InternetConnectionService, LocalizationModule, LocalizationService, getLocaleDirection, DomInsertionService, CONTENT_STRATEGY, SORT_COMPARE_FUNC, InternalStore, RouterEvents, AuthService, SessionStateService, ConfigStateService, HttpErrorReporterService, RoutesService, TENANT_NOT_FOUND_BY_NAME, CoreModule, noop } from '@abp/ng.core';
12
- import { startWith, map, debounceTime, filter, takeUntil, distinctUntilChanged, take, switchMap } from 'rxjs/operators';
10
+ import { getRoutePath, SubscriptionService, PROJECTION_STRATEGY, uuid, AbstractNgModelComponent, InternetConnectionService, LocalizationModule, LocalizationService, getLocaleDirection, DomInsertionService, CONTENT_STRATEGY, SORT_COMPARE_FUNC, InternalStore, RouterEvents, AuthService, SessionStateService, ConfigStateService, HttpErrorReporterService, RoutesService, TENANT_NOT_FOUND_BY_NAME, noop, CoreModule } from '@abp/ng.core';
11
+ import { startWith, map, debounceTime, filter, takeUntil, take, switchMap } from 'rxjs/operators';
13
12
  import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
14
13
  import { fromEvent, Subscription, combineLatest, timer, ReplaySubject, Subject, of, from, Observable, EMPTY, BehaviorSubject } from 'rxjs';
15
14
  import * as i2$1 from '@angular/forms';
@@ -17,7 +16,7 @@ import { NG_VALUE_ACCESSOR, FormsModule, Validators } from '@angular/forms';
17
16
  import * as i1$2 from '@swimlane/ngx-datatable';
18
17
  import { ColumnMode, DatatableComponent, NgxDatatableModule } from '@swimlane/ngx-datatable';
19
18
  import { HttpErrorResponse } from '@angular/common/http';
20
- import { NgxValidateCoreModule, VALIDATION_BLUEPRINTS, VALIDATION_MAP_ERRORS_FN, defaultMapErrorsFn, VALIDATION_VALIDATE_ON_SUBMIT, normalizeDiacritics } from '@ngx-validate/core';
19
+ import { normalizeDiacritics, VALIDATION_BLUEPRINTS, VALIDATION_MAP_ERRORS_FN, defaultMapErrorsFn, VALIDATION_VALIDATE_ON_SUBMIT, NgxValidateCoreModule } from '@ngx-validate/core';
21
20
 
22
21
  class DateTimeAdapter {
23
22
  fromModel(value) {
@@ -753,50 +752,44 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
753
752
  }] });
754
753
 
755
754
  class ModalComponent {
756
- get visible() {
757
- return this._visible;
758
- }
759
- set visible(value) {
760
- if (typeof value !== 'boolean')
761
- return;
762
- this.toggle$.next(value);
763
- }
764
- get busy() {
765
- return this._busy;
766
- }
767
- set busy(value) {
768
- if (this.abpSubmit && this.abpSubmit instanceof ButtonComponent) {
769
- this.abpSubmit.loading = value;
770
- }
771
- this._busy = value;
772
- }
773
755
  get modalWindowRef() {
774
756
  return document.querySelector(`ngb-modal-window.${this.modalIdentifier}`);
775
757
  }
776
758
  get isFormDirty() {
777
759
  return Boolean(this.modalWindowRef?.querySelector('.ng-dirty'));
778
760
  }
779
- constructor(confirmationService, subscription, suppressUnsavedChangesWarningToken, modal, modalRefService) {
780
- this.confirmationService = confirmationService;
781
- this.subscription = subscription;
782
- this.suppressUnsavedChangesWarningToken = suppressUnsavedChangesWarningToken;
783
- this.modal = modal;
784
- this.modalRefService = modalRefService;
785
- this.options = {
786
- keyboard: true,
787
- };
788
- this.suppressUnsavedChangesWarning = this.suppressUnsavedChangesWarningToken;
789
- this.visibleChange = new EventEmitter();
790
- this.init = new EventEmitter();
791
- this.appear = new EventEmitter();
792
- this.disappear = new EventEmitter();
793
- this._visible = false;
794
- this._busy = false;
761
+ constructor() {
762
+ this.confirmationService = inject(ConfirmationService);
763
+ this.modal = inject(NgbModal);
764
+ this.modalRefService = inject(ModalRefService);
765
+ this.suppressUnsavedChangesWarningToken = inject(SUPPRESS_UNSAVED_CHANGES_WARNING, {
766
+ optional: true,
767
+ });
768
+ this.destroyRef = inject(DestroyRef);
769
+ this.visible = model(false);
770
+ this.busy = input(false, {
771
+ transform: (value) => {
772
+ if (this.abpSubmit() && this.abpSubmit() instanceof ButtonComponent) {
773
+ this.abpSubmit().loading = value;
774
+ }
775
+ return value;
776
+ },
777
+ });
778
+ this.options = input({ keyboard: true });
779
+ this.suppressUnsavedChangesWarning = input(this.suppressUnsavedChangesWarningToken);
780
+ this.modalContent = viewChild('modalContent');
781
+ this.abpHeader = contentChild('abpHeader');
782
+ this.abpBody = contentChild('abpBody');
783
+ this.abpFooter = contentChild('abpFooter');
784
+ this.abpSubmit = contentChild(ButtonComponent, { read: ButtonComponent });
785
+ this.init = output();
786
+ this.appear = output();
787
+ this.disappear = output();
795
788
  this.isConfirmationOpen = false;
796
- this.destroy$ = new Subject();
797
789
  this.modalIdentifier = `modal-${uuid()}`;
798
- this.toggle$ = new Subject();
799
- this.initToggleStream();
790
+ effect(() => {
791
+ this.toggle(this.visible());
792
+ });
800
793
  }
801
794
  ngOnInit() {
802
795
  this.modalRefService.register(this);
@@ -804,7 +797,7 @@ class ModalComponent {
804
797
  dismiss(mode) {
805
798
  switch (mode) {
806
799
  case 'hard':
807
- this.visible = false;
800
+ this.visible.set(false);
808
801
  break;
809
802
  case 'soft':
810
803
  this.close();
@@ -813,118 +806,78 @@ class ModalComponent {
813
806
  break;
814
807
  }
815
808
  }
816
- initToggleStream() {
817
- this.subscription.addOne(this.toggle$.pipe(debounceTime(0), distinctUntilChanged()), value => this.toggle(value));
818
- }
819
809
  toggle(value) {
820
- this._visible = value;
821
- this.visibleChange.emit(value);
810
+ this.visible.set(value);
822
811
  if (!value) {
823
812
  this.modalRef?.dismiss();
824
813
  this.disappear.emit();
825
- this.destroy$.next();
826
814
  return;
827
815
  }
828
816
  setTimeout(() => this.listen(), 0);
829
- this.modalRef = this.modal.open(this.modalContent, {
817
+ this.modalRef = this.modal.open(this.modalContent(), {
830
818
  size: 'md',
831
819
  centered: false,
832
820
  keyboard: false,
833
821
  scrollable: true,
834
822
  beforeDismiss: () => {
835
- if (!this.visible)
823
+ if (!this.visible())
836
824
  return true;
837
825
  this.close();
838
- return !this.visible;
826
+ return !this.visible();
839
827
  },
840
- ...this.options,
841
- windowClass: `${this.options.windowClass || ''} ${this.modalIdentifier}`,
828
+ ...this.options(),
829
+ windowClass: `${this.options().windowClass || ''} ${this.modalIdentifier}`,
842
830
  });
843
831
  this.appear.emit();
844
832
  }
845
833
  ngOnDestroy() {
846
834
  this.modalRefService.unregister(this);
847
835
  this.toggle(false);
848
- this.destroy$.next();
849
836
  }
850
837
  close() {
851
- if (this.busy)
838
+ if (this.busy())
852
839
  return;
853
- if (this.isFormDirty && !this.suppressUnsavedChangesWarning) {
840
+ if (this.isFormDirty && !this.suppressUnsavedChangesWarning()) {
854
841
  if (this.isConfirmationOpen)
855
842
  return;
856
843
  this.isConfirmationOpen = true;
857
844
  this.confirmationService
858
- .warn('AbpUi::AreYouSureYouWantToCancelEditingWarningMessage', 'AbpUi::AreYouSure', { dismissible: false })
845
+ .warn('AbpUi::AreYouSureYouWantToCancelEditingWarningMessage', 'AbpUi::AreYouSure', {
846
+ dismissible: false,
847
+ })
859
848
  .subscribe((status) => {
860
849
  this.isConfirmationOpen = false;
861
850
  if (status === Confirmation.Status.confirm) {
862
- this.visible = false;
851
+ this.visible.set(false);
863
852
  }
864
853
  });
865
854
  }
866
855
  else {
867
- this.visible = false;
856
+ this.visible.set(false);
868
857
  }
869
858
  }
870
859
  listen() {
871
860
  if (this.modalWindowRef) {
872
861
  fromEvent(this.modalWindowRef, 'keyup')
873
- .pipe(takeUntil(this.destroy$), debounceTime(150), filter((key) => key && key.key === 'Escape' && this.options.keyboard))
862
+ .pipe(takeUntilDestroyed(this.destroyRef), debounceTime(150), filter((key) => key && key.key === 'Escape' && this.options().keyboard))
874
863
  .subscribe(() => this.close());
875
864
  }
876
865
  fromEvent(window, 'beforeunload')
877
- .pipe(takeUntil(this.destroy$))
866
+ .pipe(takeUntilDestroyed(this.destroyRef))
878
867
  .subscribe(event => {
879
- if (this.isFormDirty && !this.suppressUnsavedChangesWarning) {
868
+ if (this.isFormDirty && !this.suppressUnsavedChangesWarning()) {
880
869
  event.preventDefault();
881
870
  }
882
871
  });
883
872
  this.init.emit();
884
873
  }
885
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ModalComponent, deps: [{ token: ConfirmationService }, { token: i2.SubscriptionService }, { token: SUPPRESS_UNSAVED_CHANGES_WARNING, optional: true }, { token: i3.NgbModal }, { token: ModalRefService }], target: i0.ɵɵFactoryTarget.Component }); }
886
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: ModalComponent, selector: "abp-modal", inputs: { visible: "visible", busy: "busy", options: "options", suppressUnsavedChangesWarning: "suppressUnsavedChangesWarning" }, outputs: { visibleChange: "visibleChange", init: "init", appear: "appear", disappear: "disappear" }, providers: [SubscriptionService], queries: [{ propertyName: "abpHeader", first: true, predicate: ["abpHeader"], descendants: true }, { propertyName: "abpBody", first: true, predicate: ["abpBody"], descendants: true }, { propertyName: "abpFooter", first: true, predicate: ["abpFooter"], descendants: true }, { propertyName: "abpSubmit", first: true, predicate: ButtonComponent, descendants: true, read: ButtonComponent }], viewQueries: [{ propertyName: "modalContent", first: true, predicate: ["modalContent"], descendants: true }], ngImport: i0, template: "<ng-content></ng-content>\r\n\r\n<ng-template #modalContent let-modal>\r\n @if (abpHeader) {\r\n <div id=\"abp-modal-header\" class=\"modal-header abp-modal-header\">\r\n <ng-container *ngTemplateOutlet=\"abpHeader\"></ng-container>\r\n \u200B\r\n <button\r\n id=\"abp-modal-close-button\"\r\n type=\"button\"\r\n class=\"btn-sm btn-close\"\r\n aria-label=\"Close\"\r\n (click)=\"modal.dismiss()\"\r\n ></button>\r\n </div>\r\n }\r\n @if (abpBody) {\r\n <div id=\"abp-modal-body\" class=\"modal-body\">\r\n <ng-container *ngTemplateOutlet=\"abpBody\"></ng-container>\r\n </div>\r\n }\r\n @if (abpFooter) {\r\n <div id=\"abp-modal-footer\" class=\"modal-footer\">\r\n <ng-container *ngTemplateOutlet=\"abpFooter\"></ng-container>\r\n </div>\r\n }\r\n</ng-template>\r\n", styles: [".modal.show{display:block!important}.modal-backdrop{opacity:.8}.modal::-webkit-scrollbar{width:7px}.modal::-webkit-scrollbar-track{background:#ddd}.modal::-webkit-scrollbar-thumb{background:#8a8686}.modal-dialog{z-index:1050}\n"], dependencies: [{ kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] }); }
874
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ModalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
875
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: ModalComponent, selector: "abp-modal", inputs: { visible: { classPropertyName: "visible", publicName: "visible", isSignal: true, isRequired: false, transformFunction: null }, busy: { classPropertyName: "busy", publicName: "busy", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, suppressUnsavedChangesWarning: { classPropertyName: "suppressUnsavedChangesWarning", publicName: "suppressUnsavedChangesWarning", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { visible: "visibleChange", init: "init", appear: "appear", disappear: "disappear" }, providers: [SubscriptionService], queries: [{ propertyName: "abpHeader", first: true, predicate: ["abpHeader"], descendants: true, isSignal: true }, { propertyName: "abpBody", first: true, predicate: ["abpBody"], descendants: true, isSignal: true }, { propertyName: "abpFooter", first: true, predicate: ["abpFooter"], descendants: true, isSignal: true }, { propertyName: "abpSubmit", first: true, predicate: ButtonComponent, descendants: true, read: ButtonComponent, isSignal: true }], viewQueries: [{ propertyName: "modalContent", first: true, predicate: ["modalContent"], descendants: true, isSignal: true }], ngImport: i0, template: "<ng-content></ng-content>\r\n\r\n<ng-template #modalContent let-modal>\r\n @if (abpHeader()) {\r\n <div id=\"abp-modal-header\" class=\"modal-header abp-modal-header\">\r\n <ng-container *ngTemplateOutlet=\"abpHeader()\"></ng-container>\r\n \u200B\r\n <button\r\n id=\"abp-modal-close-button\"\r\n type=\"button\"\r\n class=\"btn-sm btn-close\"\r\n aria-label=\"Close\"\r\n (click)=\"modal.dismiss()\"\r\n ></button>\r\n </div>\r\n }\r\n @if (abpBody()) {\r\n <div id=\"abp-modal-body\" class=\"modal-body\">\r\n <ng-container *ngTemplateOutlet=\"abpBody()\"></ng-container>\r\n </div>\r\n }\r\n @if (abpFooter()) {\r\n <div id=\"abp-modal-footer\" class=\"modal-footer\">\r\n <ng-container *ngTemplateOutlet=\"abpFooter()\"></ng-container>\r\n </div>\r\n }\r\n</ng-template>\r\n", styles: [".modal.show{display:block!important}.modal-backdrop{opacity:.8}.modal::-webkit-scrollbar{width:7px}.modal::-webkit-scrollbar-track{background:#ddd}.modal::-webkit-scrollbar-thumb{background:#8a8686}.modal-dialog{z-index:1050}\n"], dependencies: [{ kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] }); }
887
876
  }
888
877
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ModalComponent, decorators: [{
889
878
  type: Component,
890
- args: [{ selector: 'abp-modal', providers: [SubscriptionService], template: "<ng-content></ng-content>\r\n\r\n<ng-template #modalContent let-modal>\r\n @if (abpHeader) {\r\n <div id=\"abp-modal-header\" class=\"modal-header abp-modal-header\">\r\n <ng-container *ngTemplateOutlet=\"abpHeader\"></ng-container>\r\n \u200B\r\n <button\r\n id=\"abp-modal-close-button\"\r\n type=\"button\"\r\n class=\"btn-sm btn-close\"\r\n aria-label=\"Close\"\r\n (click)=\"modal.dismiss()\"\r\n ></button>\r\n </div>\r\n }\r\n @if (abpBody) {\r\n <div id=\"abp-modal-body\" class=\"modal-body\">\r\n <ng-container *ngTemplateOutlet=\"abpBody\"></ng-container>\r\n </div>\r\n }\r\n @if (abpFooter) {\r\n <div id=\"abp-modal-footer\" class=\"modal-footer\">\r\n <ng-container *ngTemplateOutlet=\"abpFooter\"></ng-container>\r\n </div>\r\n }\r\n</ng-template>\r\n", styles: [".modal.show{display:block!important}.modal-backdrop{opacity:.8}.modal::-webkit-scrollbar{width:7px}.modal::-webkit-scrollbar-track{background:#ddd}.modal::-webkit-scrollbar-thumb{background:#8a8686}.modal-dialog{z-index:1050}\n"] }]
891
- }], ctorParameters: () => [{ type: ConfirmationService }, { type: i2.SubscriptionService }, { type: undefined, decorators: [{
892
- type: Optional
893
- }, {
894
- type: Inject,
895
- args: [SUPPRESS_UNSAVED_CHANGES_WARNING]
896
- }] }, { type: i3.NgbModal }, { type: ModalRefService }], propDecorators: { visible: [{
897
- type: Input
898
- }], busy: [{
899
- type: Input
900
- }], options: [{
901
- type: Input
902
- }], suppressUnsavedChangesWarning: [{
903
- type: Input
904
- }], modalContent: [{
905
- type: ViewChild,
906
- args: ['modalContent']
907
- }], abpHeader: [{
908
- type: ContentChild,
909
- args: ['abpHeader', { static: false }]
910
- }], abpBody: [{
911
- type: ContentChild,
912
- args: ['abpBody', { static: false }]
913
- }], abpFooter: [{
914
- type: ContentChild,
915
- args: ['abpFooter', { static: false }]
916
- }], abpSubmit: [{
917
- type: ContentChild,
918
- args: [ButtonComponent, { static: false, read: ButtonComponent }]
919
- }], visibleChange: [{
920
- type: Output
921
- }], init: [{
922
- type: Output
923
- }], appear: [{
924
- type: Output
925
- }], disappear: [{
926
- type: Output
927
- }] } });
879
+ args: [{ selector: 'abp-modal', providers: [SubscriptionService], template: "<ng-content></ng-content>\r\n\r\n<ng-template #modalContent let-modal>\r\n @if (abpHeader()) {\r\n <div id=\"abp-modal-header\" class=\"modal-header abp-modal-header\">\r\n <ng-container *ngTemplateOutlet=\"abpHeader()\"></ng-container>\r\n \u200B\r\n <button\r\n id=\"abp-modal-close-button\"\r\n type=\"button\"\r\n class=\"btn-sm btn-close\"\r\n aria-label=\"Close\"\r\n (click)=\"modal.dismiss()\"\r\n ></button>\r\n </div>\r\n }\r\n @if (abpBody()) {\r\n <div id=\"abp-modal-body\" class=\"modal-body\">\r\n <ng-container *ngTemplateOutlet=\"abpBody()\"></ng-container>\r\n </div>\r\n }\r\n @if (abpFooter()) {\r\n <div id=\"abp-modal-footer\" class=\"modal-footer\">\r\n <ng-container *ngTemplateOutlet=\"abpFooter()\"></ng-container>\r\n </div>\r\n }\r\n</ng-template>\r\n", styles: [".modal.show{display:block!important}.modal-backdrop{opacity:.8}.modal::-webkit-scrollbar{width:7px}.modal::-webkit-scrollbar-track{background:#ddd}.modal::-webkit-scrollbar-thumb{background:#8a8686}.modal-dialog{z-index:1050}\n"] }]
880
+ }], ctorParameters: () => [] });
928
881
 
929
882
  class ModalCloseDirective {
930
883
  constructor(modal) {
@@ -2895,6 +2848,8 @@ const DEFAULT_VALIDATION_BLUEPRINTS = {
2895
2848
  customMessage: '{{ customMessage }}'
2896
2849
  };
2897
2850
 
2851
+ var scripts = '';
2852
+
2898
2853
  function isNumber(value) {
2899
2854
  return !isNaN(toInteger(value));
2900
2855
  }
@@ -2947,6 +2902,173 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
2947
2902
  args: [LOCALE_ID]
2948
2903
  }] }] });
2949
2904
 
2905
+ const { minLength, maxLength } = Validators;
2906
+ function getPasswordValidators(injector) {
2907
+ const getRule = getRuleFn(injector);
2908
+ const passwordRulesArr = [];
2909
+ let requiredLength = 1;
2910
+ if (getRule('RequireDigit') === 'true') {
2911
+ passwordRulesArr.push('number');
2912
+ }
2913
+ if (getRule('RequireLowercase') === 'true') {
2914
+ passwordRulesArr.push('small');
2915
+ }
2916
+ if (getRule('RequireUppercase') === 'true') {
2917
+ passwordRulesArr.push('capital');
2918
+ }
2919
+ if (getRule('RequireNonAlphanumeric') === 'true') {
2920
+ passwordRulesArr.push('special');
2921
+ }
2922
+ if (Number.isInteger(+getRule('RequiredLength'))) {
2923
+ requiredLength = +getRule('RequiredLength');
2924
+ }
2925
+ const passwordValidators = passwordRulesArr.map(rule => validatePassword(rule));
2926
+ return [...passwordValidators, minLength(requiredLength), maxLength(128)];
2927
+ }
2928
+ function getRuleFn(injector) {
2929
+ const configState = injector.get(ConfigStateService);
2930
+ return (key) => {
2931
+ const passwordRules = configState.getSettings('Identity.Password');
2932
+ return (passwordRules[`Abp.Identity.Password.${key}`] || '').toLowerCase();
2933
+ };
2934
+ }
2935
+ const errorMessageMap = {
2936
+ small: 'passwordRequiresLower',
2937
+ capital: 'passwordRequiresUpper',
2938
+ number: 'passwordRequiresDigit',
2939
+ special: 'passwordRequiresNonAlphanumeric',
2940
+ };
2941
+ function validatePassword(shouldContain) {
2942
+ return (control) => {
2943
+ if (!control.value)
2944
+ return null;
2945
+ const value = normalizeDiacritics(control.value);
2946
+ const regexMap = {
2947
+ small: /.*[a-z].*/,
2948
+ capital: /.*[A-Z].*/,
2949
+ number: /.*[0-9].*/,
2950
+ special: /.*[^0-9a-zA-Z].*/,
2951
+ };
2952
+ const regex = regexMap[shouldContain];
2953
+ const isValid = regex.test(value);
2954
+ if (isValid) {
2955
+ return null;
2956
+ }
2957
+ const error = errorMessageMap[shouldContain];
2958
+ return {
2959
+ [error]: true,
2960
+ };
2961
+ };
2962
+ }
2963
+
2964
+ var ThemeSharedFeatureKind;
2965
+ (function (ThemeSharedFeatureKind) {
2966
+ ThemeSharedFeatureKind[ThemeSharedFeatureKind["HttpErrorConfig"] = 0] = "HttpErrorConfig";
2967
+ ThemeSharedFeatureKind[ThemeSharedFeatureKind["ValidationBluePrint"] = 1] = "ValidationBluePrint";
2968
+ ThemeSharedFeatureKind[ThemeSharedFeatureKind["ValidationErrorsFn"] = 2] = "ValidationErrorsFn";
2969
+ ThemeSharedFeatureKind[ThemeSharedFeatureKind["ValidateOnSubmit"] = 3] = "ValidateOnSubmit";
2970
+ ThemeSharedFeatureKind[ThemeSharedFeatureKind["Validation"] = 4] = "Validation";
2971
+ ThemeSharedFeatureKind[ThemeSharedFeatureKind["ConfirmationIcons"] = 5] = "ConfirmationIcons";
2972
+ })(ThemeSharedFeatureKind || (ThemeSharedFeatureKind = {}));
2973
+ function makeThemeSharedFeature(kind, providers) {
2974
+ return {
2975
+ ɵkind: kind,
2976
+ ɵproviders: providers,
2977
+ };
2978
+ }
2979
+ function withHttpErrorConfig(httpErrorConfig) {
2980
+ return makeThemeSharedFeature(ThemeSharedFeatureKind.HttpErrorConfig, [
2981
+ {
2982
+ provide: HTTP_ERROR_CONFIG,
2983
+ useValue: httpErrorConfig,
2984
+ },
2985
+ ]);
2986
+ }
2987
+ function withValidationBluePrint(bluePrints) {
2988
+ return makeThemeSharedFeature(ThemeSharedFeatureKind.ValidationBluePrint, [
2989
+ {
2990
+ provide: VALIDATION_BLUEPRINTS,
2991
+ useValue: {
2992
+ ...DEFAULT_VALIDATION_BLUEPRINTS,
2993
+ ...(bluePrints || {}),
2994
+ },
2995
+ },
2996
+ ]);
2997
+ }
2998
+ function withValidationMapErrorsFn(mapErrorsFn) {
2999
+ return makeThemeSharedFeature(ThemeSharedFeatureKind.ValidationErrorsFn, [
3000
+ {
3001
+ provide: VALIDATION_MAP_ERRORS_FN,
3002
+ useValue: mapErrorsFn || defaultMapErrorsFn,
3003
+ },
3004
+ ]);
3005
+ }
3006
+ function withValidateOnSubmit(validateOnSubmit) {
3007
+ return makeThemeSharedFeature(ThemeSharedFeatureKind.ValidateOnSubmit, [
3008
+ {
3009
+ provide: VALIDATION_VALIDATE_ON_SUBMIT,
3010
+ useValue: validateOnSubmit,
3011
+ },
3012
+ ]);
3013
+ }
3014
+ function withConfirmationIcon(confirmationIcons) {
3015
+ return makeThemeSharedFeature(ThemeSharedFeatureKind.HttpErrorConfig, [
3016
+ {
3017
+ provide: CONFIRMATION_ICONS,
3018
+ useValue: { ...DEFAULT_CONFIRMATION_ICONS, ...(confirmationIcons || {}) },
3019
+ },
3020
+ ]);
3021
+ }
3022
+ function provideAbpThemeShared(...features) {
3023
+ const providers = [
3024
+ {
3025
+ provide: APP_INITIALIZER,
3026
+ multi: true,
3027
+ deps: [ErrorHandler],
3028
+ useFactory: noop,
3029
+ },
3030
+ THEME_SHARED_ROUTE_PROVIDERS,
3031
+ {
3032
+ provide: APP_INITIALIZER,
3033
+ multi: true,
3034
+ deps: [THEME_SHARED_APPEND_CONTENT],
3035
+ useFactory: noop,
3036
+ },
3037
+ { provide: HTTP_ERROR_CONFIG, useValue: undefined },
3038
+ { provide: NgbDateParserFormatter, useClass: DateParserFormatter },
3039
+ NG_BOOTSTRAP_CONFIG_PROVIDERS,
3040
+ {
3041
+ provide: VALIDATION_BLUEPRINTS,
3042
+ useValue: { ...DEFAULT_VALIDATION_BLUEPRINTS },
3043
+ },
3044
+ {
3045
+ provide: VALIDATION_MAP_ERRORS_FN,
3046
+ useValue: defaultMapErrorsFn,
3047
+ },
3048
+ {
3049
+ provide: VALIDATION_VALIDATE_ON_SUBMIT,
3050
+ useValue: undefined,
3051
+ },
3052
+ DocumentDirHandlerService,
3053
+ {
3054
+ provide: APP_INITIALIZER,
3055
+ useFactory: noop,
3056
+ multi: true,
3057
+ deps: [DocumentDirHandlerService],
3058
+ },
3059
+ {
3060
+ provide: CONFIRMATION_ICONS,
3061
+ useValue: { ...DEFAULT_CONFIRMATION_ICONS },
3062
+ },
3063
+ tenantNotFoundProvider,
3064
+ DEFAULT_HANDLERS_PROVIDERS,
3065
+ ];
3066
+ for (const feature of features) {
3067
+ providers.push(...feature.ɵproviders);
3068
+ }
3069
+ return makeEnvironmentProviders(providers);
3070
+ }
3071
+
2950
3072
  const declarationsWithExports = [
2951
3073
  BreadcrumbComponent,
2952
3074
  BreadcrumbItemsComponent,
@@ -3047,57 +3169,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
3047
3169
  }]
3048
3170
  }] });
3049
3171
  class ThemeSharedModule {
3172
+ /**
3173
+ * @deprecated forRoot method is deprecated, use `provideAbpThemeShared` *function* for config settings.
3174
+ */
3050
3175
  static forRoot({ httpErrorConfig, validation = {}, confirmationIcons = {} } = {}) {
3051
3176
  return {
3052
3177
  ngModule: ThemeSharedModule,
3053
3178
  providers: [
3054
- {
3055
- provide: APP_INITIALIZER,
3056
- multi: true,
3057
- deps: [ErrorHandler],
3058
- useFactory: noop,
3059
- },
3060
- THEME_SHARED_ROUTE_PROVIDERS,
3061
- {
3062
- provide: APP_INITIALIZER,
3063
- multi: true,
3064
- deps: [THEME_SHARED_APPEND_CONTENT],
3065
- useFactory: noop,
3066
- },
3067
- { provide: HTTP_ERROR_CONFIG, useValue: httpErrorConfig },
3068
- { provide: NgbDateParserFormatter, useClass: DateParserFormatter },
3069
- NG_BOOTSTRAP_CONFIG_PROVIDERS,
3070
- {
3071
- provide: VALIDATION_BLUEPRINTS,
3072
- useValue: {
3073
- ...DEFAULT_VALIDATION_BLUEPRINTS,
3074
- ...(validation.blueprints || {}),
3075
- },
3076
- },
3077
- {
3078
- provide: VALIDATION_MAP_ERRORS_FN,
3079
- useValue: validation.mapErrorsFn || defaultMapErrorsFn,
3080
- },
3081
- {
3082
- provide: VALIDATION_VALIDATE_ON_SUBMIT,
3083
- useValue: validation.validateOnSubmit,
3084
- },
3085
- DocumentDirHandlerService,
3086
- {
3087
- provide: APP_INITIALIZER,
3088
- useFactory: noop,
3089
- multi: true,
3090
- deps: [DocumentDirHandlerService],
3091
- },
3092
- {
3093
- provide: CONFIRMATION_ICONS,
3094
- useValue: {
3095
- ...DEFAULT_CONFIRMATION_ICONS,
3096
- ...(confirmationIcons || {}),
3097
- },
3098
- },
3099
- tenantNotFoundProvider,
3100
- DEFAULT_HANDLERS_PROVIDERS,
3179
+ provideAbpThemeShared(withHttpErrorConfig(httpErrorConfig), withValidationBluePrint(validation.blueprints), withValidationMapErrorsFn(validation.mapErrorsFn), withValidateOnSubmit(validation.validateOnSubmit), withConfirmationIcon(confirmationIcons)),
3101
3180
  ],
3102
3181
  };
3103
3182
  }
@@ -3113,67 +3192,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
3113
3192
  }]
3114
3193
  }] });
3115
3194
 
3116
- const { minLength, maxLength } = Validators;
3117
- function getPasswordValidators(injector) {
3118
- const getRule = getRuleFn(injector);
3119
- const passwordRulesArr = [];
3120
- let requiredLength = 1;
3121
- if (getRule('RequireDigit') === 'true') {
3122
- passwordRulesArr.push('number');
3123
- }
3124
- if (getRule('RequireLowercase') === 'true') {
3125
- passwordRulesArr.push('small');
3126
- }
3127
- if (getRule('RequireUppercase') === 'true') {
3128
- passwordRulesArr.push('capital');
3129
- }
3130
- if (getRule('RequireNonAlphanumeric') === 'true') {
3131
- passwordRulesArr.push('special');
3132
- }
3133
- if (Number.isInteger(+getRule('RequiredLength'))) {
3134
- requiredLength = +getRule('RequiredLength');
3135
- }
3136
- const passwordValidators = passwordRulesArr.map(rule => validatePassword(rule));
3137
- return [...passwordValidators, minLength(requiredLength), maxLength(128)];
3138
- }
3139
- function getRuleFn(injector) {
3140
- const configState = injector.get(ConfigStateService);
3141
- return (key) => {
3142
- const passwordRules = configState.getSettings('Identity.Password');
3143
- return (passwordRules[`Abp.Identity.Password.${key}`] || '').toLowerCase();
3144
- };
3145
- }
3146
- const errorMessageMap = {
3147
- small: 'passwordRequiresLower',
3148
- capital: 'passwordRequiresUpper',
3149
- number: 'passwordRequiresDigit',
3150
- special: 'passwordRequiresNonAlphanumeric',
3151
- };
3152
- function validatePassword(shouldContain) {
3153
- return (control) => {
3154
- if (!control.value)
3155
- return null;
3156
- const value = normalizeDiacritics(control.value);
3157
- const regexMap = {
3158
- small: /.*[a-z].*/,
3159
- capital: /.*[A-Z].*/,
3160
- number: /.*[0-9].*/,
3161
- special: /.*[^0-9a-zA-Z].*/,
3162
- };
3163
- const regex = regexMap[shouldContain];
3164
- const isValid = regex.test(value);
3165
- if (isValid) {
3166
- return null;
3167
- }
3168
- const error = errorMessageMap[shouldContain];
3169
- return {
3170
- [error]: true,
3171
- };
3172
- };
3173
- }
3174
-
3175
- var scripts = '';
3176
-
3177
3195
  /*
3178
3196
  * Public API Surface of theme-shared
3179
3197
  */
@@ -3182,5 +3200,5 @@ var scripts = '';
3182
3200
  * Generated bundle index. Do not edit.
3183
3201
  */
3184
3202
 
3185
- export { AbpAuthenticationErrorHandler, AbpFormatErrorHandlerService, AbpVisibleDirective, BaseThemeSharedModule, BreadcrumbComponent, BreadcrumbItemsComponent, ButtonComponent, CUSTOM_ERROR_HANDLERS, CUSTOM_HTTP_ERROR_HANDLER_PRIORITY, CardBodyComponent, CardComponent, CardFooterComponent, CardHeaderComponent, CardHeaderDirective, CardImgTopDirective, CardModule, CardSubtitleDirective, CardTitleDirective, Confirmation, ConfirmationComponent, ConfirmationService, CreateErrorComponentService, DEFAULT_ERROR_LOCALIZATIONS, DEFAULT_ERROR_MESSAGES, DEFAULT_HANDLERS_PROVIDERS, DEFAULT_VALIDATION_BLUEPRINTS, DateAdapter, DateParserFormatter, DateTimeAdapter, DisabledDirective, DocumentDirHandlerService, EllipsisDirective, ErrorHandler, FormCheckboxComponent, FormInputComponent, HTTP_ERROR_CONFIG, HTTP_ERROR_DETAIL, HTTP_ERROR_HANDLER, HTTP_ERROR_STATUS, HttpErrorWrapperComponent, InternetConnectionStatusComponent, LoaderBarComponent, LoadingComponent, LoadingDirective, ModalCloseDirective, ModalComponent, ModalRefService, NGX_DATATABLE_MESSAGES, NG_BOOTSTRAP_CONFIG_PROVIDERS, NavItem, NavItemsService, NgxDatatableDefaultDirective, NgxDatatableListDirective, PageAlertService, PasswordComponent, RouterErrorHandlerService, SUPPRESS_UNSAVED_CHANGES_WARNING, StatusCodeErrorHandlerService, THEME_SHARED_APPEND_CONTENT, THEME_SHARED_ROUTE_PROVIDERS, TenantResolveErrorHandlerService, ThemeSharedModule, TimeAdapter, ToastComponent, ToastContainerComponent, ToasterService, UnknownStatusCodeErrorHandlerService, UserMenu, UserMenuService, bounceIn, collapse, collapseLinearWithMargin, collapseWithMargin, collapseX, collapseY, collapseYWithMargin, configureNgBootstrap, configureRoutes, defaultNgxDatatableMessages, dialogAnimation, eFormComponets, expandX, expandY, expandYWithMargin, fadeAnimation, fadeIn, fadeInDown, fadeInLeft, fadeInRight, fadeInUp, fadeOut, fadeOutDown, fadeOutLeft, fadeOutRight, fadeOutUp, getErrorFromRequestBody, getPasswordValidators, slideFromBottom, tenantNotFoundProvider, toastInOut, validatePassword };
3203
+ export { AbpAuthenticationErrorHandler, AbpFormatErrorHandlerService, AbpVisibleDirective, BaseThemeSharedModule, BreadcrumbComponent, BreadcrumbItemsComponent, ButtonComponent, CONFIRMATION_ICONS, CUSTOM_ERROR_HANDLERS, CUSTOM_HTTP_ERROR_HANDLER_PRIORITY, CardBodyComponent, CardComponent, CardFooterComponent, CardHeaderComponent, CardHeaderDirective, CardImgTopDirective, CardModule, CardSubtitleDirective, CardTitleDirective, Confirmation, ConfirmationComponent, ConfirmationService, CreateErrorComponentService, DEFAULT_CONFIRMATION_ICONS, DEFAULT_ERROR_LOCALIZATIONS, DEFAULT_ERROR_MESSAGES, DEFAULT_HANDLERS_PROVIDERS, DEFAULT_VALIDATION_BLUEPRINTS, DateAdapter, DateParserFormatter, DateTimeAdapter, DisabledDirective, DocumentDirHandlerService, EllipsisDirective, ErrorHandler, FormCheckboxComponent, FormInputComponent, HTTP_ERROR_CONFIG, HTTP_ERROR_DETAIL, HTTP_ERROR_HANDLER, HTTP_ERROR_STATUS, HttpErrorWrapperComponent, InternetConnectionStatusComponent, LoaderBarComponent, LoadingComponent, LoadingDirective, ModalCloseDirective, ModalComponent, ModalRefService, NGX_DATATABLE_MESSAGES, NG_BOOTSTRAP_CONFIG_PROVIDERS, NavItem, NavItemsService, NgxDatatableDefaultDirective, NgxDatatableListDirective, PageAlertService, PasswordComponent, RouterErrorHandlerService, SUPPRESS_UNSAVED_CHANGES_WARNING, StatusCodeErrorHandlerService, THEME_SHARED_APPEND_CONTENT, THEME_SHARED_ROUTE_PROVIDERS, TenantResolveErrorHandlerService, ThemeSharedFeatureKind, ThemeSharedModule, TimeAdapter, ToastComponent, ToastContainerComponent, ToasterService, UnknownStatusCodeErrorHandlerService, UserMenu, UserMenuService, bounceIn, collapse, collapseLinearWithMargin, collapseWithMargin, collapseX, collapseY, collapseYWithMargin, configureNgBootstrap, configureRoutes, defaultNgxDatatableMessages, dialogAnimation, eFormComponets, expandX, expandY, expandYWithMargin, fadeAnimation, fadeIn, fadeInDown, fadeInLeft, fadeInRight, fadeInUp, fadeOut, fadeOutDown, fadeOutLeft, fadeOutRight, fadeOutUp, getErrorFromRequestBody, getPasswordValidators, provideAbpThemeShared, slideFromBottom, tenantNotFoundProvider, toastInOut, validatePassword, withConfirmationIcon, withHttpErrorConfig, withValidateOnSubmit, withValidationBluePrint, withValidationMapErrorsFn };
3186
3204
  //# sourceMappingURL=abp-ng.theme.shared.mjs.map