diff --git a/npm/ng-packs/packages/account/src/lib/account.module.ts b/npm/ng-packs/packages/account/src/lib/account.module.ts index 74310ce1bd..bdf3c39792 100644 --- a/npm/ng-packs/packages/account/src/lib/account.module.ts +++ b/npm/ng-packs/packages/account/src/lib/account.module.ts @@ -1,24 +1,24 @@ -import {CoreModule, LazyModuleFactory} from '@abp/ng.core'; -import {ThemeSharedModule} from '@abp/ng.theme.shared'; -import {ModuleWithProviders, NgModule, NgModuleFactory} from '@angular/core'; -import {NgbDropdownModule} from '@ng-bootstrap/ng-bootstrap'; -import {NgxValidateCoreModule} from '@ngx-validate/core'; -import {AccountRoutingModule} from './account-routing.module'; -import {ChangePasswordComponent} from './components/change-password/change-password.component'; -import {LoginComponent} from './components/login/login.component'; -import {ManageProfileComponent} from './components/manage-profile/manage-profile.component'; -import {PersonalSettingsComponent} from './components/personal-settings/personal-settings.component'; -import {RegisterComponent} from './components/register/register.component'; -import {AccountConfigOptions} from './models/config-options'; -import {ACCOUNT_CONFIG_OPTIONS} from './tokens/config-options.token'; -import {accountConfigOptionsFactory} from './utils/factory-utils'; -import {AuthenticationFlowGuard} from './guards/authentication-flow.guard'; -import {ForgotPasswordComponent} from './components/forgot-password/forgot-password.component'; -import {ResetPasswordComponent} from './components/reset-password/reset-password.component'; -import {UiExtensionsModule} from '@abp/ng.theme.shared/extensions'; -import {ACCOUNT_EDIT_FORM_PROP_CONTRIBUTORS} from './tokens/extensions.token'; -import {AccountExtensionsGuard} from './guards/extensions.guard'; -import {PersonalSettingsHalfRowComponent} from './components/personal-settings/personal-settings-half-row.component'; +import { CoreModule, LazyModuleFactory } from '@abp/ng.core'; +import { ThemeSharedModule } from '@abp/ng.theme.shared'; +import { ModuleWithProviders, NgModule, NgModuleFactory } from '@angular/core'; +import { NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap'; +import { NgxValidateCoreModule } from '@ngx-validate/core'; +import { AccountRoutingModule } from './account-routing.module'; +import { ChangePasswordComponent } from './components/change-password/change-password.component'; +import { LoginComponent } from './components/login/login.component'; +import { ManageProfileComponent } from './components/manage-profile/manage-profile.component'; +import { PersonalSettingsComponent } from './components/personal-settings/personal-settings.component'; +import { RegisterComponent } from './components/register/register.component'; +import { AccountConfigOptions } from './models/config-options'; +import { ACCOUNT_CONFIG_OPTIONS } from './tokens/config-options.token'; +import { accountConfigOptionsFactory } from './utils/factory-utils'; +import { AuthenticationFlowGuard } from './guards/authentication-flow.guard'; +import { ForgotPasswordComponent } from './components/forgot-password/forgot-password.component'; +import { ResetPasswordComponent } from './components/reset-password/reset-password.component'; +import { UiExtensionsModule } from '@abp/ng.theme.shared/extensions'; +import { ACCOUNT_EDIT_FORM_PROP_CONTRIBUTORS } from './tokens/extensions.token'; +import { AccountExtensionsGuard } from './guards/extensions.guard'; +import { PersonalSettingsHalfRowComponent } from './components/personal-settings/personal-settings-half-row.component'; const declarations = [ LoginComponent, @@ -49,7 +49,7 @@ export class AccountModule { ngModule: AccountModule, providers: [ AuthenticationFlowGuard, - {provide: ACCOUNT_CONFIG_OPTIONS, useValue: options}, + { provide: ACCOUNT_CONFIG_OPTIONS, useValue: options }, { provide: 'ACCOUNT_OPTIONS', useFactory: accountConfigOptionsFactory, diff --git a/npm/ng-packs/packages/account/src/lib/components/personal-settings/personal-settings-half-row.component.ts b/npm/ng-packs/packages/account/src/lib/components/personal-settings/personal-settings-half-row.component.ts index c0069ecd9e..a000e353d6 100644 --- a/npm/ng-packs/packages/account/src/lib/components/personal-settings/personal-settings-half-row.component.ts +++ b/npm/ng-packs/packages/account/src/lib/components/personal-settings/personal-settings-half-row.component.ts @@ -1,31 +1,37 @@ -import {Component, Inject} from '@angular/core'; -import {EXTENSIONS_FORM_PROP, FormProp, EXTENSIBLE_FORM_VIEW_PROVIDER} from "@abp/ng.theme.shared/extensions"; -import {FormGroup} from "@angular/forms"; +import { Component, Inject } from '@angular/core'; +import { + EXTENSIONS_FORM_PROP, + FormProp, + EXTENSIBLE_FORM_VIEW_PROVIDER, +} from '@abp/ng.theme.shared/extensions'; +import { FormGroup } from '@angular/forms'; @Component({ selector: 'abp-personal-settings-half-row', - template: ` -
-
- - -
-
`, + template: `
+
+ + +
+
`, styles: [], - viewProviders: [EXTENSIBLE_FORM_VIEW_PROVIDER] + viewProviders: [EXTENSIBLE_FORM_VIEW_PROVIDER], }) export class PersonalSettingsHalfRowComponent { public displayName: string; public name: string; public id: string; - public formGroup: FormGroup + public formGroup: FormGroup; constructor(@Inject(EXTENSIONS_FORM_PROP) private propData: FormProp) { - this.displayName = propData.displayName - this.name = propData.name - this.id = propData.id + this.displayName = propData.displayName; + this.name = propData.name; + this.id = propData.id; } } diff --git a/npm/ng-packs/packages/account/src/lib/components/personal-settings/personal-settings.component.ts b/npm/ng-packs/packages/account/src/lib/components/personal-settings/personal-settings.component.ts index c4a8422291..1688ef5741 100644 --- a/npm/ng-packs/packages/account/src/lib/components/personal-settings/personal-settings.component.ts +++ b/npm/ng-packs/packages/account/src/lib/components/personal-settings/personal-settings.component.ts @@ -1,24 +1,27 @@ -import {ProfileDto, ProfileService} from '@abp/ng.account.core/proxy'; -import {ToasterService} from '@abp/ng.theme.shared'; -import {Component, Injector, OnInit, ViewEncapsulation} from '@angular/core'; -import {FormBuilder, FormGroup} from '@angular/forms'; -import {finalize} from 'rxjs/operators'; -import {Account} from '../../models/account'; -import {ManageProfileStateService} from '../../services/manage-profile.state.service'; -import {EXTENSIONS_IDENTIFIER, FormPropData, generateFormFromProps} from "@abp/ng.theme.shared/extensions"; -import {eAccountComponents} from "../../enums"; - +import { ProfileDto, ProfileService } from '@abp/ng.account.core/proxy'; +import { ToasterService } from '@abp/ng.theme.shared'; +import { Component, Injector, OnInit, ViewEncapsulation } from '@angular/core'; +import { FormBuilder, FormGroup } from '@angular/forms'; +import { finalize } from 'rxjs/operators'; +import { Account } from '../../models/account'; +import { ManageProfileStateService } from '../../services/manage-profile.state.service'; +import { + EXTENSIONS_IDENTIFIER, + FormPropData, + generateFormFromProps, +} from '@abp/ng.theme.shared/extensions'; +import { eAccountComponents } from '../../enums'; @Component({ selector: 'abp-personal-settings-form', templateUrl: './personal-settings.component.html', exportAs: 'abpPersonalSettingsForm', - providers:[ + providers: [ { provide: EXTENSIONS_IDENTIFIER, useValue: eAccountComponents.PersonalSettings, }, - ] + ], }) export class PersonalSettingsComponent implements @@ -26,7 +29,7 @@ export class PersonalSettingsComponent Account.PersonalSettingsComponentInputs, Account.PersonalSettingsComponentOutputs { - selected:ProfileDto + selected: ProfileDto; form: FormGroup; @@ -40,18 +43,17 @@ export class PersonalSettingsComponent protected injector: Injector, ) {} - buildForm() { this.selected = this.manageProfileState.getProfile(); - if(!this.selected){ - return + if (!this.selected) { + return; } const data = new FormPropData(this.injector, this.selected); this.form = generateFormFromProps(data); } ngOnInit(): void { - this.buildForm() + this.buildForm(); } submit() { diff --git a/npm/ng-packs/packages/account/src/lib/defaults/default-personal-settings-form-props.ts b/npm/ng-packs/packages/account/src/lib/defaults/default-personal-settings-form-props.ts index 325c25010f..59c196f2bd 100644 --- a/npm/ng-packs/packages/account/src/lib/defaults/default-personal-settings-form-props.ts +++ b/npm/ng-packs/packages/account/src/lib/defaults/default-personal-settings-form-props.ts @@ -1,7 +1,7 @@ -import {ePropType, FormProp} from "@abp/ng.theme.shared/extensions"; -import {UpdateProfileDto} from "@abp/ng.account.core/proxy"; -import {Validators} from "@angular/forms"; -import {PersonalSettingsHalfRowComponent} from "../components/personal-settings/personal-settings-half-row.component"; +import { ePropType, FormProp } from '@abp/ng.theme.shared/extensions'; +import { UpdateProfileDto } from '@abp/ng.account.core/proxy'; +import { Validators } from '@angular/forms'; +import { PersonalSettingsHalfRowComponent } from '../components/personal-settings/personal-settings-half-row.component'; const { maxLength, required, email } = Validators; export const DEFAULT_PERSONAL_SETTINGS_UPDATE_FORM_PROPS = FormProp.createMany([ @@ -10,7 +10,7 @@ export const DEFAULT_PERSONAL_SETTINGS_UPDATE_FORM_PROPS = FormProp.createMany [required,maxLength(256)], + validators: () => [required, maxLength(256)], }, { type: ePropType.String, @@ -18,8 +18,8 @@ export const DEFAULT_PERSONAL_SETTINGS_UPDATE_FORM_PROPS = FormProp.createMany [maxLength(64)], - template:PersonalSettingsHalfRowComponent, - className:"d-inline-block w-50" + template: PersonalSettingsHalfRowComponent, + className: 'd-inline-block w-50', }, { type: ePropType.String, @@ -27,15 +27,15 @@ export const DEFAULT_PERSONAL_SETTINGS_UPDATE_FORM_PROPS = FormProp.createMany [maxLength(64)], - className:"d-inline-block w-50 ps-4", - template:PersonalSettingsHalfRowComponent + className: 'd-inline-block w-50 ps-4', + template: PersonalSettingsHalfRowComponent, }, { type: ePropType.String, name: 'email', displayName: 'AbpIdentity::DisplayName:Email', id: 'email-address', - validators: () => [required, email, maxLength(256)], + validators: () => [required, email, maxLength(256)], }, { type: ePropType.String, @@ -44,4 +44,4 @@ export const DEFAULT_PERSONAL_SETTINGS_UPDATE_FORM_PROPS = FormProp.createMany [maxLength(16)], }, -]) +]); diff --git a/npm/ng-packs/packages/account/src/lib/models/config-options.ts b/npm/ng-packs/packages/account/src/lib/models/config-options.ts index c3bbb6cb1b..f3af14a71e 100644 --- a/npm/ng-packs/packages/account/src/lib/models/config-options.ts +++ b/npm/ng-packs/packages/account/src/lib/models/config-options.ts @@ -1,11 +1,11 @@ -import {eAccountComponents} from "../enums"; +import { eAccountComponents } from '../enums'; import { EditFormPropContributorCallback } from '@abp/ng.theme.shared/extensions'; -import {UpdateProfileDto} from "@abp/ng.account.core/proxy"; +import { UpdateProfileDto } from '@abp/ng.account.core/proxy'; export interface AccountConfigOptions { redirectUrl?: string; editFormPropContributors?: AccountEditFormPropContributors; } export type AccountEditFormPropContributors = Partial<{ - [eAccountComponents.PersonalSettings]: EditFormPropContributorCallback[]; -}>; + [eAccountComponents.PersonalSettings]: EditFormPropContributorCallback[]; +}>; \ No newline at end of file diff --git a/npm/ng-packs/packages/account/src/lib/tokens/extensions.token.ts b/npm/ng-packs/packages/account/src/lib/tokens/extensions.token.ts index 6d95db8b6d..78acb7feaa 100644 --- a/npm/ng-packs/packages/account/src/lib/tokens/extensions.token.ts +++ b/npm/ng-packs/packages/account/src/lib/tokens/extensions.token.ts @@ -1,8 +1,8 @@ -import {eAccountComponents} from "../enums"; -import {DEFAULT_PERSONAL_SETTINGS_UPDATE_FORM_PROPS} from "../defaults/default-personal-settings-form-props"; -import {InjectionToken} from "@angular/core"; -import {EditFormPropContributorCallback} from "@abp/ng.theme.shared/extensions"; -import {UpdateProfileDto} from "@abp/ng.account.core/proxy"; +import { eAccountComponents } from '../enums'; +import { DEFAULT_PERSONAL_SETTINGS_UPDATE_FORM_PROPS } from '../defaults/default-personal-settings-form-props'; +import { InjectionToken } from '@angular/core'; +import { EditFormPropContributorCallback } from '@abp/ng.theme.shared/extensions'; +import { UpdateProfileDto } from '@abp/ng.account.core/proxy'; export const DEFAULT_ACCOUNT_FORM_PROPS = { [eAccountComponents.PersonalSettings]: DEFAULT_PERSONAL_SETTINGS_UPDATE_FORM_PROPS, diff --git a/npm/ng-packs/packages/core/src/lib/validators/required.validator.ts b/npm/ng-packs/packages/core/src/lib/validators/required.validator.ts index 68ad0e8a85..4e2b1931db 100644 --- a/npm/ng-packs/packages/core/src/lib/validators/required.validator.ts +++ b/npm/ng-packs/packages/core/src/lib/validators/required.validator.ts @@ -9,6 +9,7 @@ export interface RequiredOptions { } export function validateRequired({ allowEmptyStrings }: RequiredOptions = {}): ValidatorFn { + // note: please do not remove name of the function, it is used in function compare with type 'RequiredError' const required = (control: AbstractControl): RequiredError | null => { return isValidRequired(control.value, allowEmptyStrings) ? null : { required: true }; };