stored initial form as a simple object instead of a form

This commit is contained in:
Valentin 2022-01-12 10:38:07 +02:00
parent afe0eaff79
commit 3f847c21a6
5 changed files with 6 additions and 6 deletions

View File

@ -46,7 +46,7 @@ export class AddEditDictionaryDialogComponent extends BaseDialogComponent {
) {
super(_injector, _dialogRef);
this.form = this._getForm(this.dictionary);
this.initialForm = this._getForm(this.dictionary);
this.initialFormValue = this.form.getRawValue();
this.hasColor$ = this._colorEmpty$;
this.technicalName$ = this.form.get('label').valueChanges.pipe(map(value => this._toTechnicalName(value)));
}

View File

@ -42,7 +42,7 @@ export class AddEditDossierTemplateDialogComponent extends BaseDialogComponent {
) {
super(_injector, _dialogRef);
this.form = this._getForm();
this.initialForm = this._getForm();
this.initialFormValue = this.form.getRawValue();
this.hasValidFrom = !!this.dossierTemplate?.validFrom;
this.hasValidTo = !!this.dossierTemplate?.validTo;

View File

@ -39,7 +39,7 @@ export class AddEditFileAttributeDialogComponent extends BaseDialogComponent {
this.canSetDisplayed = data.numberOfDisplayedAttrs < this.DISPLAYED_FILTERABLE_LIMIT || data.fileAttribute?.displayedInFileList;
this.canSetFilterable = data.numberOfFilterableAttrs < this.DISPLAYED_FILTERABLE_LIMIT || data.fileAttribute?.filterable;
this.form = this._getForm(this.fileAttribute);
this.initialForm = this._getForm(this.fileAttribute);
this.initialFormValue = this.form.getRawValue();
}
save() {

View File

@ -38,7 +38,7 @@ export class EditColorDialogComponent extends BaseDialogComponent {
this._dossierTemplateId = data.dossierTemplateId;
this.form = this._getForm();
this.initialForm = this._getForm();
this.initialFormValue = this.form.getRawValue();
}
async save() {

View File

@ -23,7 +23,7 @@ export abstract class BaseDialogComponent extends AutoUnsubscribe implements OnI
protected _waitingForConfirmation = false;
form!: FormGroup;
initialForm!: FormGroup;
initialFormValue;
constructor(protected readonly _injector: Injector, protected readonly _dialogRef: MatDialogRef<BaseDialogComponent>) {
super();
@ -43,7 +43,7 @@ export abstract class BaseDialogComponent extends AutoUnsubscribe implements OnI
get changed(): boolean {
for (const key of Object.keys(this.form.getRawValue())) {
const initialValue = this.initialForm.get(key).value;
const initialValue = this.initialFormValue[key];
const updatedValue = this.form.get(key).value;
if (initialValue == null && updatedValue != null) {