Format changes code with prettier

pull/13700/head
Mahmut Gundogdu 3 years ago
parent a582807e07
commit 9cd2027cb0

@ -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,

@ -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: `
<div class="w-50 d-inline">
<div class="mb-3 form-group" >
<label [attr.for]="name" class="form-label">{{
displayName | abpLocalization
}}
</label>
<input type="text" [attr.id]="id" class="form-control" [attr.name]="name" [formControlName]="name"/>
</div>
</div>`,
template: ` <div class="w-50 d-inline">
<div class="mb-3 form-group">
<label [attr.for]="name" class="form-label">{{ displayName | abpLocalization }} </label>
<input
type="text"
[attr.id]="id"
class="form-control"
[attr.name]="name"
[formControlName]="name"
/>
</div>
</div>`,
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;
}
}

@ -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() {

@ -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<UpdateProfileDto>([
@ -10,7 +10,7 @@ export const DEFAULT_PERSONAL_SETTINGS_UPDATE_FORM_PROPS = FormProp.createMany<U
name: 'userName',
displayName: 'AbpIdentity::DisplayName:UserName',
id: 'username',
validators: () => [required,maxLength(256)],
validators: () => [required, maxLength(256)],
},
{
type: ePropType.String,
@ -18,8 +18,8 @@ export const DEFAULT_PERSONAL_SETTINGS_UPDATE_FORM_PROPS = FormProp.createMany<U
displayName: 'AbpIdentity::DisplayName:Name',
id: 'name',
validators: () => [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<U
displayName: 'AbpIdentity::DisplayName:Surname',
id: 'surname',
validators: () => [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<U
id: 'phone-number',
validators: () => [maxLength(16)],
},
])
]);

@ -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<UpdateProfileDto>[];
}>;
[eAccountComponents.PersonalSettings]: EditFormPropContributorCallback<UpdateProfileDto>[];
}>;

@ -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,

@ -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 };
};

Loading…
Cancel
Save