@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
|
@@ -8306,6 +8306,12 @@ class AddFormRecordComponent {
|
|
|
8306
8306
|
this.FormScalarTypeEnum = FormScalarTypeEnum;
|
|
8307
8307
|
this.FieldTypeEnum = FieldTypeEnum;
|
|
8308
8308
|
this.visibleActionButtons = new Array();
|
|
8309
|
+
//#region onRecordChange
|
|
8310
|
+
/**
|
|
8311
|
+
* Metodo invocato al cambio del valore di ogni proprietà dell'oggetto record.
|
|
8312
|
+
* Serve ad aggiornare il valore di tutti i campi che hanno una formula.
|
|
8313
|
+
*/
|
|
8314
|
+
this._isInRecordChange = false;
|
|
8309
8315
|
}
|
|
8310
8316
|
ngOnInit() {
|
|
8311
8317
|
injectGoogleFontsFromForm(this.form);
|
|
@@ -8351,31 +8357,37 @@ class AddFormRecordComponent {
|
|
|
8351
8357
|
GlobalService.speechDirective.SpeechToTextToggler();
|
|
8352
8358
|
}
|
|
8353
8359
|
}
|
|
8354
|
-
//#region onRecordChange
|
|
8355
|
-
/**
|
|
8356
|
-
* Metodo invocato al cambio del valore di ogni proprietà dell'oggetto record.
|
|
8357
|
-
* Serve ad aggiornare il valore di tutti i campi che hanno una formula.
|
|
8358
|
-
*/
|
|
8359
8360
|
onRecordChange() {
|
|
8360
8361
|
var _a;
|
|
8361
|
-
|
|
8362
|
-
|
|
8363
|
-
|
|
8364
|
-
|
|
8365
|
-
}
|
|
8366
|
-
});
|
|
8362
|
+
// Guardia di rientranza: setValue sui FormControl può triggerare writeValue sui ControlValueAccessor
|
|
8363
|
+
// (es. mat-datepicker), che emettono (dateChange)/(ngModelChange) → recordChange → loop infinito.
|
|
8364
|
+
if (this._isInRecordChange) {
|
|
8365
|
+
return;
|
|
8367
8366
|
}
|
|
8368
|
-
|
|
8369
|
-
|
|
8370
|
-
|
|
8371
|
-
|
|
8372
|
-
|
|
8373
|
-
|
|
8374
|
-
|
|
8375
|
-
|
|
8376
|
-
|
|
8377
|
-
|
|
8378
|
-
|
|
8367
|
+
this._isInRecordChange = true;
|
|
8368
|
+
try {
|
|
8369
|
+
if (this.fieldTemplate && this.fieldTemplate.length > 0) {
|
|
8370
|
+
this.fieldTemplate.forEach((f) => {
|
|
8371
|
+
if (f != null && typeof f.updateField === 'function') {
|
|
8372
|
+
f.updateField();
|
|
8373
|
+
}
|
|
8374
|
+
});
|
|
8375
|
+
}
|
|
8376
|
+
// Le formule aggiornano record[fieldName] direttamente, senza passare dal FormControl.
|
|
8377
|
+
// Qui risincronizziamo i FormControl il cui valore è cambiato rispetto al record,
|
|
8378
|
+
// altrimenti la validazione required fallisce sui campi valorizzati via formula/ActionButton.
|
|
8379
|
+
if ((_a = this.form) === null || _a === void 0 ? void 0 : _a.Fields) {
|
|
8380
|
+
this.form.Fields.forEach(field => {
|
|
8381
|
+
var _a;
|
|
8382
|
+
const ctrl = (_a = field.FormFormGroup) === null || _a === void 0 ? void 0 : _a.get(field.Name);
|
|
8383
|
+
if (ctrl != null && ctrl.value !== this.record[field.Name]) {
|
|
8384
|
+
ctrl.setValue(this.record[field.Name], { emitEvent: false });
|
|
8385
|
+
}
|
|
8386
|
+
});
|
|
8387
|
+
}
|
|
8388
|
+
}
|
|
8389
|
+
finally {
|
|
8390
|
+
this._isInRecordChange = false;
|
|
8379
8391
|
}
|
|
8380
8392
|
}
|
|
8381
8393
|
//#endregion onRecordChange
|