@eqproject/eqp-dynamic-module 2.10.83 → 2.10.84
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.
- package/esm2020/lib/components/private/form-records/add-form-record/add-form-record.component.mjs +32 -20
- package/fesm2015/eqproject-eqp-dynamic-module.mjs +34 -22
- package/fesm2015/eqproject-eqp-dynamic-module.mjs.map +1 -1
- package/fesm2020/eqproject-eqp-dynamic-module.mjs +31 -19
- package/fesm2020/eqproject-eqp-dynamic-module.mjs.map +1 -1
- package/lib/components/private/form-records/add-form-record/add-form-record.component.d.ts +1 -0
- package/package.json +1 -1
|
@@ -8237,6 +8237,12 @@ class AddFormRecordComponent {
|
|
|
8237
8237
|
this.FormScalarTypeEnum = FormScalarTypeEnum;
|
|
8238
8238
|
this.FieldTypeEnum = FieldTypeEnum;
|
|
8239
8239
|
this.visibleActionButtons = new Array();
|
|
8240
|
+
//#region onRecordChange
|
|
8241
|
+
/**
|
|
8242
|
+
* Metodo invocato al cambio del valore di ogni proprietà dell'oggetto record.
|
|
8243
|
+
* Serve ad aggiornare il valore di tutti i campi che hanno una formula.
|
|
8244
|
+
*/
|
|
8245
|
+
this._isInRecordChange = false;
|
|
8240
8246
|
}
|
|
8241
8247
|
ngOnInit() {
|
|
8242
8248
|
injectGoogleFontsFromForm(this.form);
|
|
@@ -8282,27 +8288,33 @@ class AddFormRecordComponent {
|
|
|
8282
8288
|
GlobalService.speechDirective.SpeechToTextToggler();
|
|
8283
8289
|
}
|
|
8284
8290
|
}
|
|
8285
|
-
//#region onRecordChange
|
|
8286
|
-
/**
|
|
8287
|
-
* Metodo invocato al cambio del valore di ogni proprietà dell'oggetto record.
|
|
8288
|
-
* Serve ad aggiornare il valore di tutti i campi che hanno una formula.
|
|
8289
|
-
*/
|
|
8290
8291
|
onRecordChange() {
|
|
8291
|
-
|
|
8292
|
-
|
|
8293
|
-
|
|
8294
|
-
|
|
8292
|
+
// Guardia di rientranza: setValue sui FormControl può triggerare writeValue sui ControlValueAccessor
|
|
8293
|
+
// (es. mat-datepicker), che emettono (dateChange)/(ngModelChange) → recordChange → loop infinito.
|
|
8294
|
+
if (this._isInRecordChange) {
|
|
8295
|
+
return;
|
|
8295
8296
|
}
|
|
8296
|
-
|
|
8297
|
-
|
|
8298
|
-
|
|
8299
|
-
|
|
8300
|
-
|
|
8301
|
-
|
|
8302
|
-
|
|
8303
|
-
|
|
8304
|
-
|
|
8305
|
-
|
|
8297
|
+
this._isInRecordChange = true;
|
|
8298
|
+
try {
|
|
8299
|
+
if (this.fieldTemplate && this.fieldTemplate.length > 0) {
|
|
8300
|
+
this.fieldTemplate.forEach((f) => { if (f != null && typeof f.updateField === 'function') {
|
|
8301
|
+
f.updateField();
|
|
8302
|
+
} });
|
|
8303
|
+
}
|
|
8304
|
+
// Le formule aggiornano record[fieldName] direttamente, senza passare dal FormControl.
|
|
8305
|
+
// Qui risincronizziamo i FormControl il cui valore è cambiato rispetto al record,
|
|
8306
|
+
// altrimenti la validazione required fallisce sui campi valorizzati via formula/ActionButton.
|
|
8307
|
+
if (this.form?.Fields) {
|
|
8308
|
+
this.form.Fields.forEach(field => {
|
|
8309
|
+
const ctrl = field.FormFormGroup?.get(field.Name);
|
|
8310
|
+
if (ctrl != null && ctrl.value !== this.record[field.Name]) {
|
|
8311
|
+
ctrl.setValue(this.record[field.Name], { emitEvent: false });
|
|
8312
|
+
}
|
|
8313
|
+
});
|
|
8314
|
+
}
|
|
8315
|
+
}
|
|
8316
|
+
finally {
|
|
8317
|
+
this._isInRecordChange = false;
|
|
8306
8318
|
}
|
|
8307
8319
|
}
|
|
8308
8320
|
//#endregion onRecordChange
|