stored initial form as a simple object instead of a form
This commit is contained in:
parent
afe0eaff79
commit
3f847c21a6
@ -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)));
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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() {
|
||||
|
||||
@ -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() {
|
||||
|
||||
@ -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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user