@eqproject/eqp-dynamic-module 2.10.84 → 2.10.86

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.
@@ -1188,10 +1188,22 @@ class UtilityHelperService {
1188
1188
  * In nuovo FormControl avrà il nome del campo passato e verranno impostati i Validators in base al tipo del campo stesso.
1189
1189
  * @param field BaseField per cui creare il FormControl da inserire nel FormGroup dela form.
1190
1190
  */
1191
+ /**
1192
+ * Validator "required" che legge dal record invece che da control.value.
1193
+ * Serve per far funzionare la validazione quando il valore viene impostato via formula/ActionButton
1194
+ * (che aggiornano record[fieldName] direttamente senza passare dal FormControl).
1195
+ */
1196
+ createRecordRequiredValidator(record, fieldName) {
1197
+ return () => {
1198
+ const v = record[fieldName];
1199
+ const isEmpty = v == null || ((typeof v === 'string' || Array.isArray(v)) && v.length === 0);
1200
+ return isEmpty ? { required: true } : null;
1201
+ };
1202
+ }
1191
1203
  createFieldFormControl(field, record) {
1192
1204
  const validators = [];
1193
1205
  if (field.Required)
1194
- validators.push(Validators.required);
1206
+ validators.push(this.createRecordRequiredValidator(record, field.Name));
1195
1207
  switch (field.FieldType) {
1196
1208
  case FieldTypeEnum["Campo di testo"]:
1197
1209
  if (field.MaxLenght) {
@@ -5008,12 +5020,24 @@ class ListValueFieldTemplateComponent {
5008
5020
  GlobalService.debugLog("list-value-field updateField", this.field);
5009
5021
  if (this.field.Formula) {
5010
5022
  GlobalService.debugLog("list-value-field - updateField - Formula", "formula");
5011
- const tempValuePairs = this.field.ValuePairs;
5012
- this.field.ValuePairs = {};
5013
- const temp = UtilityHelperService.EvaluateFieldFormula(this.field.Formula, this.record, this.formulaObject);
5014
- this.field.ValuePairs = GlobalService.stringToValuePairs(temp);
5015
- if (!(JSON.stringify(tempValuePairs) === JSON.stringify(this.field.ValuePairs))) {
5016
- this.resetArrayData();
5023
+ if (this.field.DataGetter?.DataGetterType === DataGetterTypeEnum.Formula) {
5024
+ // La formula calcola il VALORE SELEZIONATO (non le opzioni): comportamento analogo al campo numerico.
5025
+ // Le opzioni vengono da ValueString/ValuePairs. Non si chiama resetArrayData() per evitare loop.
5026
+ const newValue = UtilityHelperService.EvaluateFieldFormula(this.field.Formula, this.record, this.formulaObject);
5027
+ if (this.record[this.field.Name] !== newValue) {
5028
+ this.record[this.field.Name] = newValue;
5029
+ this.setFormControlValue();
5030
+ }
5031
+ }
5032
+ else {
5033
+ // La formula calcola le OPZIONI (ValuePairs) — caso d'uso originale
5034
+ const tempValuePairs = this.field.ValuePairs;
5035
+ this.field.ValuePairs = {};
5036
+ const temp = UtilityHelperService.EvaluateFieldFormula(this.field.Formula, this.record, this.formulaObject);
5037
+ this.field.ValuePairs = GlobalService.stringToValuePairs(temp);
5038
+ if (!(JSON.stringify(tempValuePairs) === JSON.stringify(this.field.ValuePairs))) {
5039
+ this.resetArrayData();
5040
+ }
5017
5041
  }
5018
5042
  }
5019
5043
  else if (this.field.ValuePairs != null && this.field.ValuePairs.lenght > 0) {
@@ -5047,7 +5071,13 @@ class ListValueFieldTemplateComponent {
5047
5071
  this.onRecordValueChange();
5048
5072
  }
5049
5073
  updateSelected(emitChange = true) {
5050
- this.record[this.field.Name] = this.arrayData.filter(data => data.Selected).map(data => data.Value);
5074
+ const selectedValues = this.arrayData.filter(data => data.Selected).map(data => data.Value);
5075
+ // Single-choice: usa null (non []) quando nessun valore è selezionato.
5076
+ // [] !== [] in JS (confronto per referenza): mat-select._assignValue vede sempre un "cambio"
5077
+ // su ogni cycle di CD e scatena _onChange → ngModelChange → loop infinito.
5078
+ this.record[this.field.Name] = this.field.IsMultiChoiche
5079
+ ? selectedValues
5080
+ : (selectedValues.length > 0 ? selectedValues[0] : null);
5051
5081
  this.setFormControlValue();
5052
5082
  if (emitChange) {
5053
5083
  this.onRecordValueChange();
@@ -5058,7 +5088,7 @@ class ListValueFieldTemplateComponent {
5058
5088
  }
5059
5089
  resetArrayData() {
5060
5090
  this.arrayData = [];
5061
- this.updateSelected(true);
5091
+ this.updateSelected(false);
5062
5092
  this.setArrayData();
5063
5093
  }
5064
5094
  reloadArrayData() {
@@ -5096,7 +5126,10 @@ class ListValueFieldTemplateComponent {
5096
5126
  this.arrayData.push({ Key: key, Value: value, Selected: isOptionSelected, ImgUrl: imgUrl });
5097
5127
  }
5098
5128
  setFormControlValue() {
5099
- this.field.FormFormGroup.controls[this.field.Name].setValue(this.record[this.field.Name]);
5129
+ // emitModelToViewChange:false impedisce che FormControl.setValue() notifichi i callback
5130
+ // _onChange registrati da NgModel (via [formControlName] sul mat-checkbox), evitando che
5131
+ // NgModel emetta ngModelChange → updateSelected() → setFormControlValue() ricorsivamente.
5132
+ this.field.FormFormGroup.controls[this.field.Name].setValue(this.record[this.field.Name], { emitEvent: false, emitModelToViewChange: false });
5100
5133
  }
5101
5134
  }
5102
5135
  ListValueFieldTemplateComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ListValueFieldTemplateComponent, deps: [{ token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
@@ -6041,10 +6074,10 @@ class ImageFieldTemplateComponent {
6041
6074
  }
6042
6075
  }
6043
6076
  ImageFieldTemplateComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ImageFieldTemplateComponent, deps: [{ token: i1$3.MatDialog }, { token: UtilityHelperService }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
6044
- ImageFieldTemplateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: ImageFieldTemplateComponent, selector: "image-field-template", inputs: { endPointConfiguration: "endPointConfiguration", record: "record", formulaObject: "formulaObject", field: "field", inConfig: "inConfig", styleVersion: "styleVersion", forceState: "forceState" }, outputs: { recordChange: "recordChange", imageDraw: "imageDraw" }, viewQueries: [{ propertyName: "dialogImageDrawing", first: true, predicate: ["dialogImageDrawing"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<div id=\"{{fieldUid}}\">\r\n <div class=\"row imageContainer\">\r\n <div class=\"row\">\r\n <div class=\"col-12 image-label\">{{field.Description}}</div>\r\n <div class=\"col-12\">\r\n <img *ngIf=\"field.DynAttachment\"\r\n src=\"data:{{field.DynAttachment.FileContentType}};base64,{{FileDataBase64}}\"\r\n [height]=\"field.DynAttachment.ResizedImageHeightPx != null ? field.DynAttachment.ResizedImageHeightPx : 128\"\r\n class=\"singleImage\">\r\n </div>\r\n <div *ngIf=\"field.EnableDrawing\" class=\"col-12 drawButton\">\r\n <button class=\"btn btn-primary btn-w100\" (click)=\"openDraw()\">Disegna</button>\r\n </div>\r\n <div *ngIf=\"field.DynAttachment.ButtonKey != null && field.DynAttachment.ButtonKey != ''\"\r\n class=\"col-12 flex justify-content-around buttonkey\">\r\n <div>Etichetta</div>\r\n <div>{{field.DynAttachment.ButtonKey}}</div>\r\n </div>\r\n <div *ngIf=\"field.DynAttachment.ButtonValue != null && field.DynAttachment.ButtonValue != ''\"\r\n class=\"col-12 flex justify-content-around buttonvalue\">\r\n <div>Valore</div>\r\n <div>{{field.DynAttachment.ButtonValue}}</div>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n<!-- DIALOG PER DISEGNARE SUL NUOVO ALLEGATO CARICATO -->\r\n<ng-template #dialogImageDrawing>\r\n <div class=\"padder\">\r\n <div class=\"row\">\r\n <div class=\"col-sm-12 col-md-12\">\r\n <tmw-image-drawer *ngIf=\"drawingLoaded\"\r\n [src]=\"'data:'+ field.DynAttachment.FileContentType + ';base64,'+ FileBase64\"\r\n [inConfig]=\"inConfig\" [showCancelButton]=\"false\" [enableLoadAnotherImage]=\"false\"\r\n [enableRemoveImage]=\"false\" [width]=\"field.DynAttachment.ImageWidthPx\"\r\n [height]=\"field.DynAttachment.ImageHeightPx\" [i18n]=\"i18n\" [showCancelButton]=\"true\"\r\n (save)=\"saveDraw($event)\" (loadOriginal)=\"loadOriginal()\"\r\n (closeDialog)=\"closeImageDrowingDialog()\">\r\n </tmw-image-drawer>\r\n </div>\r\n </div>\r\n </div>\r\n</ng-template>", styles: ["::ng-deep image-drawing>button{background-color:var(--primary)!important;color:#fff!important}.imageContainer .singleImage{margin-top:5px;display:block}.drawButton{margin:5px 0}.buttonkey{border-top:1px solid black;padding-top:10px}\n"], dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: TmwImageDrawerComponent, selector: "tmw-image-drawer", inputs: ["src", "width", "height", "forceSizeCanvas", "forceSizeExport", "enableRemoveImage", "enableLoadAnotherImage", "enableTooltip", "showCancelButton", "inConfig", "i18n", "locale", "loadingTemplate", "errorTemplate", "outputMimeType", "outputQuality", "borderCss", "drawingSizes", "colors"], outputs: ["closeDialog", "save", "loadOriginal"] }] });
6077
+ ImageFieldTemplateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: ImageFieldTemplateComponent, selector: "image-field-template", inputs: { endPointConfiguration: "endPointConfiguration", record: "record", formulaObject: "formulaObject", field: "field", inConfig: "inConfig", styleVersion: "styleVersion", forceState: "forceState" }, outputs: { recordChange: "recordChange", imageDraw: "imageDraw" }, viewQueries: [{ propertyName: "dialogImageDrawing", first: true, predicate: ["dialogImageDrawing"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<div id=\"{{fieldUid}}\">\r\n <div class=\"row imageContainer\">\r\n <div class=\"row\">\r\n <div class=\"col-12 image-label\">{{field.Description}}</div>\r\n <div class=\"col-12\">\r\n <img *ngIf=\"field.DynAttachment\"\r\n src=\"data:{{field.DynAttachment.FileContentType}};base64,{{FileDataBase64}}\"\r\n [height]=\"field.DynAttachment.ResizedImageHeightPx != null ? field.DynAttachment.ResizedImageHeightPx : 128\"\r\n class=\"singleImage\">\r\n </div>\r\n <div *ngIf=\"field.EnableDrawing\" class=\"col-12 drawButton\">\r\n <button class=\"btn btn-primary btn-w100\" (click)=\"openDraw()\">Disegna</button>\r\n </div>\r\n <div *ngIf=\"field.DynAttachment?.ButtonKey != null && field.DynAttachment?.ButtonKey != ''\"\r\n class=\"col-12 flex justify-content-around buttonkey\">\r\n <div>Etichetta</div>\r\n <div>{{field.DynAttachment.ButtonKey}}</div>\r\n </div>\r\n <div *ngIf=\"field.DynAttachment?.ButtonValue != null && field.DynAttachment?.ButtonValue != ''\"\r\n class=\"col-12 flex justify-content-around buttonvalue\">\r\n <div>Valore</div>\r\n <div>{{field.DynAttachment.ButtonValue}}</div>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n<!-- DIALOG PER DISEGNARE SUL NUOVO ALLEGATO CARICATO -->\r\n<ng-template #dialogImageDrawing>\r\n <div class=\"padder\">\r\n <div class=\"row\">\r\n <div class=\"col-sm-12 col-md-12\">\r\n <tmw-image-drawer *ngIf=\"drawingLoaded\"\r\n [src]=\"'data:'+ field.DynAttachment.FileContentType + ';base64,'+ FileBase64\"\r\n [inConfig]=\"inConfig\" [showCancelButton]=\"false\" [enableLoadAnotherImage]=\"false\"\r\n [enableRemoveImage]=\"false\" [width]=\"field.DynAttachment.ImageWidthPx\"\r\n [height]=\"field.DynAttachment.ImageHeightPx\" [i18n]=\"i18n\" [showCancelButton]=\"true\"\r\n (save)=\"saveDraw($event)\" (loadOriginal)=\"loadOriginal()\"\r\n (closeDialog)=\"closeImageDrowingDialog()\">\r\n </tmw-image-drawer>\r\n </div>\r\n </div>\r\n </div>\r\n</ng-template>", styles: ["::ng-deep image-drawing>button{background-color:var(--primary)!important;color:#fff!important}.imageContainer .singleImage{margin-top:5px;display:block}.drawButton{margin:5px 0}.buttonkey{border-top:1px solid black;padding-top:10px}\n"], dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: TmwImageDrawerComponent, selector: "tmw-image-drawer", inputs: ["src", "width", "height", "forceSizeCanvas", "forceSizeExport", "enableRemoveImage", "enableLoadAnotherImage", "enableTooltip", "showCancelButton", "inConfig", "i18n", "locale", "loadingTemplate", "errorTemplate", "outputMimeType", "outputQuality", "borderCss", "drawingSizes", "colors"], outputs: ["closeDialog", "save", "loadOriginal"] }] });
6045
6078
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ImageFieldTemplateComponent, decorators: [{
6046
6079
  type: Component,
6047
- args: [{ selector: 'image-field-template', template: "<div id=\"{{fieldUid}}\">\r\n <div class=\"row imageContainer\">\r\n <div class=\"row\">\r\n <div class=\"col-12 image-label\">{{field.Description}}</div>\r\n <div class=\"col-12\">\r\n <img *ngIf=\"field.DynAttachment\"\r\n src=\"data:{{field.DynAttachment.FileContentType}};base64,{{FileDataBase64}}\"\r\n [height]=\"field.DynAttachment.ResizedImageHeightPx != null ? field.DynAttachment.ResizedImageHeightPx : 128\"\r\n class=\"singleImage\">\r\n </div>\r\n <div *ngIf=\"field.EnableDrawing\" class=\"col-12 drawButton\">\r\n <button class=\"btn btn-primary btn-w100\" (click)=\"openDraw()\">Disegna</button>\r\n </div>\r\n <div *ngIf=\"field.DynAttachment.ButtonKey != null && field.DynAttachment.ButtonKey != ''\"\r\n class=\"col-12 flex justify-content-around buttonkey\">\r\n <div>Etichetta</div>\r\n <div>{{field.DynAttachment.ButtonKey}}</div>\r\n </div>\r\n <div *ngIf=\"field.DynAttachment.ButtonValue != null && field.DynAttachment.ButtonValue != ''\"\r\n class=\"col-12 flex justify-content-around buttonvalue\">\r\n <div>Valore</div>\r\n <div>{{field.DynAttachment.ButtonValue}}</div>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n<!-- DIALOG PER DISEGNARE SUL NUOVO ALLEGATO CARICATO -->\r\n<ng-template #dialogImageDrawing>\r\n <div class=\"padder\">\r\n <div class=\"row\">\r\n <div class=\"col-sm-12 col-md-12\">\r\n <tmw-image-drawer *ngIf=\"drawingLoaded\"\r\n [src]=\"'data:'+ field.DynAttachment.FileContentType + ';base64,'+ FileBase64\"\r\n [inConfig]=\"inConfig\" [showCancelButton]=\"false\" [enableLoadAnotherImage]=\"false\"\r\n [enableRemoveImage]=\"false\" [width]=\"field.DynAttachment.ImageWidthPx\"\r\n [height]=\"field.DynAttachment.ImageHeightPx\" [i18n]=\"i18n\" [showCancelButton]=\"true\"\r\n (save)=\"saveDraw($event)\" (loadOriginal)=\"loadOriginal()\"\r\n (closeDialog)=\"closeImageDrowingDialog()\">\r\n </tmw-image-drawer>\r\n </div>\r\n </div>\r\n </div>\r\n</ng-template>", styles: ["::ng-deep image-drawing>button{background-color:var(--primary)!important;color:#fff!important}.imageContainer .singleImage{margin-top:5px;display:block}.drawButton{margin:5px 0}.buttonkey{border-top:1px solid black;padding-top:10px}\n"] }]
6080
+ args: [{ selector: 'image-field-template', template: "<div id=\"{{fieldUid}}\">\r\n <div class=\"row imageContainer\">\r\n <div class=\"row\">\r\n <div class=\"col-12 image-label\">{{field.Description}}</div>\r\n <div class=\"col-12\">\r\n <img *ngIf=\"field.DynAttachment\"\r\n src=\"data:{{field.DynAttachment.FileContentType}};base64,{{FileDataBase64}}\"\r\n [height]=\"field.DynAttachment.ResizedImageHeightPx != null ? field.DynAttachment.ResizedImageHeightPx : 128\"\r\n class=\"singleImage\">\r\n </div>\r\n <div *ngIf=\"field.EnableDrawing\" class=\"col-12 drawButton\">\r\n <button class=\"btn btn-primary btn-w100\" (click)=\"openDraw()\">Disegna</button>\r\n </div>\r\n <div *ngIf=\"field.DynAttachment?.ButtonKey != null && field.DynAttachment?.ButtonKey != ''\"\r\n class=\"col-12 flex justify-content-around buttonkey\">\r\n <div>Etichetta</div>\r\n <div>{{field.DynAttachment.ButtonKey}}</div>\r\n </div>\r\n <div *ngIf=\"field.DynAttachment?.ButtonValue != null && field.DynAttachment?.ButtonValue != ''\"\r\n class=\"col-12 flex justify-content-around buttonvalue\">\r\n <div>Valore</div>\r\n <div>{{field.DynAttachment.ButtonValue}}</div>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n<!-- DIALOG PER DISEGNARE SUL NUOVO ALLEGATO CARICATO -->\r\n<ng-template #dialogImageDrawing>\r\n <div class=\"padder\">\r\n <div class=\"row\">\r\n <div class=\"col-sm-12 col-md-12\">\r\n <tmw-image-drawer *ngIf=\"drawingLoaded\"\r\n [src]=\"'data:'+ field.DynAttachment.FileContentType + ';base64,'+ FileBase64\"\r\n [inConfig]=\"inConfig\" [showCancelButton]=\"false\" [enableLoadAnotherImage]=\"false\"\r\n [enableRemoveImage]=\"false\" [width]=\"field.DynAttachment.ImageWidthPx\"\r\n [height]=\"field.DynAttachment.ImageHeightPx\" [i18n]=\"i18n\" [showCancelButton]=\"true\"\r\n (save)=\"saveDraw($event)\" (loadOriginal)=\"loadOriginal()\"\r\n (closeDialog)=\"closeImageDrowingDialog()\">\r\n </tmw-image-drawer>\r\n </div>\r\n </div>\r\n </div>\r\n</ng-template>", styles: ["::ng-deep image-drawing>button{background-color:var(--primary)!important;color:#fff!important}.imageContainer .singleImage{margin-top:5px;display:block}.drawButton{margin:5px 0}.buttonkey{border-top:1px solid black;padding-top:10px}\n"] }]
6048
6081
  }], ctorParameters: function () { return [{ type: i1$3.MatDialog }, { type: UtilityHelperService }, { type: i0.Renderer2 }]; }, propDecorators: { endPointConfiguration: [{
6049
6082
  type: Input
6050
6083
  }], record: [{
@@ -7054,10 +7087,10 @@ class ImageWithMarkersFieldTemplateComponent {
7054
7087
  }
7055
7088
  }
7056
7089
  ImageWithMarkersFieldTemplateComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ImageWithMarkersFieldTemplateComponent, deps: [{ token: i1$3.MatDialog }, { token: UtilityHelperService }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
7057
- ImageWithMarkersFieldTemplateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: ImageWithMarkersFieldTemplateComponent, selector: "image-with-markers-field-template", inputs: { endPointConfiguration: "endPointConfiguration", record: "record", formulaObject: "formulaObject", field: "field", inConfig: "inConfig", styleVersion: "styleVersion", forceState: "forceState" }, outputs: { recordChange: "recordChange", imageMark: "imageMark" }, viewQueries: [{ propertyName: "dialogImageMarking", first: true, predicate: ["dialogImageMarking"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<div id=\"{{fieldUid}}\">\r\n <div class=\"row imageContainer\">\r\n <div class=\"row\">\r\n <div class=\"col-12 image-label\">{{field.Description}}</div>\r\n <div class=\"col-12\">\r\n <img *ngIf=\"field.DynAttachment\"\r\n src=\"data:{{field.DynAttachment.FileContentType}};base64,{{FileDataBase64}}\"\r\n [height]=\"field.DynAttachment.ResizedImageHeightPx != null ? field.DynAttachment.ResizedImageHeightPx : 128\"\r\n class=\"singleImage\"\r\n >\r\n </div>\r\n <div class=\"col-12 markButton\">\r\n <button class=\"btn btn-primary btn-w100\" (click)=\"openMark()\">Marca</button>\r\n </div>\r\n <div *ngIf=\"field.DynAttachment.ButtonKey != null && field.DynAttachment.ButtonKey != ''\" class=\"col-12 flex justify-content-around buttonkey\">\r\n <div>Etichetta</div><div>{{field.DynAttachment.ButtonKey}}</div>\r\n </div>\r\n <div *ngIf=\"field.DynAttachment.ButtonValue != null && field.DynAttachment.ButtonValue != ''\" class=\"col-12 flex justify-content-around buttonvalue\">\r\n <div>Valore</div>\r\n <div>{{field.DynAttachment.ButtonValue}}</div>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n<!-- DIALOG PER MARCATURA -->\r\n<ng-template #dialogImageMarking>\r\n <tmw-image-marker *ngIf=\"MarkingLoaded\"\r\n [src]=\"'data:'+ field.DynAttachment.FileContentType + ';base64,'+ FileBase64\"\r\n [inConfig]=\"inConfig\"\r\n [savedMarkers]=\"extraJSON\"\r\n (save)=\"saveMark($event)\"\r\n (closeDialog)=\"closeDialog()\"\r\n [width]=\"field.DynAttachment.ImageWidthPx\"\r\n [height]=\"field.DynAttachment.ImageHeightPx\"\r\n >\r\n </tmw-image-marker>\r\n</ng-template>\r\n", styles: ["::ng-deep image-drawing>button{background-color:var(--primary)!important;color:#fff!important}.imageContainer .singleImage{margin-top:5px;display:block}.drawButton{margin:5px 0}.buttonkey{border-top:1px solid black;padding-top:10px}\n"], dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: TmwImageMarkerComponent, selector: "tmw-image-marker", inputs: ["src", "width", "height", "inConfig", "savedMarkers", "outputMimeType", "outputQuality", "forceSizeCanvas"], outputs: ["closeDialog", "save"] }] });
7090
+ ImageWithMarkersFieldTemplateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: ImageWithMarkersFieldTemplateComponent, selector: "image-with-markers-field-template", inputs: { endPointConfiguration: "endPointConfiguration", record: "record", formulaObject: "formulaObject", field: "field", inConfig: "inConfig", styleVersion: "styleVersion", forceState: "forceState" }, outputs: { recordChange: "recordChange", imageMark: "imageMark" }, viewQueries: [{ propertyName: "dialogImageMarking", first: true, predicate: ["dialogImageMarking"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<div id=\"{{fieldUid}}\">\r\n <div class=\"row imageContainer\">\r\n <div class=\"row\">\r\n <div class=\"col-12 image-label\">{{field.Description}}</div>\r\n <div class=\"col-12\">\r\n <img *ngIf=\"field.DynAttachment\"\r\n src=\"data:{{field.DynAttachment.FileContentType}};base64,{{FileDataBase64}}\"\r\n [height]=\"field.DynAttachment.ResizedImageHeightPx != null ? field.DynAttachment.ResizedImageHeightPx : 128\"\r\n class=\"singleImage\"\r\n >\r\n </div>\r\n <div class=\"col-12 markButton\">\r\n <button class=\"btn btn-primary btn-w100\" (click)=\"openMark()\">Marca</button>\r\n </div>\r\n <div *ngIf=\"field.DynAttachment?.ButtonKey != null && field.DynAttachment?.ButtonKey != ''\" class=\"col-12 flex justify-content-around buttonkey\">\r\n <div>Etichetta</div><div>{{field.DynAttachment.ButtonKey}}</div>\r\n </div>\r\n <div *ngIf=\"field.DynAttachment?.ButtonValue != null && field.DynAttachment?.ButtonValue != ''\" class=\"col-12 flex justify-content-around buttonvalue\">\r\n <div>Valore</div>\r\n <div>{{field.DynAttachment.ButtonValue}}</div>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n<!-- DIALOG PER MARCATURA -->\r\n<ng-template #dialogImageMarking>\r\n <tmw-image-marker *ngIf=\"MarkingLoaded\"\r\n [src]=\"'data:'+ field.DynAttachment.FileContentType + ';base64,'+ FileBase64\"\r\n [inConfig]=\"inConfig\"\r\n [savedMarkers]=\"extraJSON\"\r\n (save)=\"saveMark($event)\"\r\n (closeDialog)=\"closeDialog()\"\r\n [width]=\"field.DynAttachment.ImageWidthPx\"\r\n [height]=\"field.DynAttachment.ImageHeightPx\"\r\n >\r\n </tmw-image-marker>\r\n</ng-template>\r\n", styles: ["::ng-deep image-drawing>button{background-color:var(--primary)!important;color:#fff!important}.imageContainer .singleImage{margin-top:5px;display:block}.drawButton{margin:5px 0}.buttonkey{border-top:1px solid black;padding-top:10px}\n"], dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: TmwImageMarkerComponent, selector: "tmw-image-marker", inputs: ["src", "width", "height", "inConfig", "savedMarkers", "outputMimeType", "outputQuality", "forceSizeCanvas"], outputs: ["closeDialog", "save"] }] });
7058
7091
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ImageWithMarkersFieldTemplateComponent, decorators: [{
7059
7092
  type: Component,
7060
- args: [{ selector: 'image-with-markers-field-template', template: "<div id=\"{{fieldUid}}\">\r\n <div class=\"row imageContainer\">\r\n <div class=\"row\">\r\n <div class=\"col-12 image-label\">{{field.Description}}</div>\r\n <div class=\"col-12\">\r\n <img *ngIf=\"field.DynAttachment\"\r\n src=\"data:{{field.DynAttachment.FileContentType}};base64,{{FileDataBase64}}\"\r\n [height]=\"field.DynAttachment.ResizedImageHeightPx != null ? field.DynAttachment.ResizedImageHeightPx : 128\"\r\n class=\"singleImage\"\r\n >\r\n </div>\r\n <div class=\"col-12 markButton\">\r\n <button class=\"btn btn-primary btn-w100\" (click)=\"openMark()\">Marca</button>\r\n </div>\r\n <div *ngIf=\"field.DynAttachment.ButtonKey != null && field.DynAttachment.ButtonKey != ''\" class=\"col-12 flex justify-content-around buttonkey\">\r\n <div>Etichetta</div><div>{{field.DynAttachment.ButtonKey}}</div>\r\n </div>\r\n <div *ngIf=\"field.DynAttachment.ButtonValue != null && field.DynAttachment.ButtonValue != ''\" class=\"col-12 flex justify-content-around buttonvalue\">\r\n <div>Valore</div>\r\n <div>{{field.DynAttachment.ButtonValue}}</div>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n<!-- DIALOG PER MARCATURA -->\r\n<ng-template #dialogImageMarking>\r\n <tmw-image-marker *ngIf=\"MarkingLoaded\"\r\n [src]=\"'data:'+ field.DynAttachment.FileContentType + ';base64,'+ FileBase64\"\r\n [inConfig]=\"inConfig\"\r\n [savedMarkers]=\"extraJSON\"\r\n (save)=\"saveMark($event)\"\r\n (closeDialog)=\"closeDialog()\"\r\n [width]=\"field.DynAttachment.ImageWidthPx\"\r\n [height]=\"field.DynAttachment.ImageHeightPx\"\r\n >\r\n </tmw-image-marker>\r\n</ng-template>\r\n", styles: ["::ng-deep image-drawing>button{background-color:var(--primary)!important;color:#fff!important}.imageContainer .singleImage{margin-top:5px;display:block}.drawButton{margin:5px 0}.buttonkey{border-top:1px solid black;padding-top:10px}\n"] }]
7093
+ args: [{ selector: 'image-with-markers-field-template', template: "<div id=\"{{fieldUid}}\">\r\n <div class=\"row imageContainer\">\r\n <div class=\"row\">\r\n <div class=\"col-12 image-label\">{{field.Description}}</div>\r\n <div class=\"col-12\">\r\n <img *ngIf=\"field.DynAttachment\"\r\n src=\"data:{{field.DynAttachment.FileContentType}};base64,{{FileDataBase64}}\"\r\n [height]=\"field.DynAttachment.ResizedImageHeightPx != null ? field.DynAttachment.ResizedImageHeightPx : 128\"\r\n class=\"singleImage\"\r\n >\r\n </div>\r\n <div class=\"col-12 markButton\">\r\n <button class=\"btn btn-primary btn-w100\" (click)=\"openMark()\">Marca</button>\r\n </div>\r\n <div *ngIf=\"field.DynAttachment?.ButtonKey != null && field.DynAttachment?.ButtonKey != ''\" class=\"col-12 flex justify-content-around buttonkey\">\r\n <div>Etichetta</div><div>{{field.DynAttachment.ButtonKey}}</div>\r\n </div>\r\n <div *ngIf=\"field.DynAttachment?.ButtonValue != null && field.DynAttachment?.ButtonValue != ''\" class=\"col-12 flex justify-content-around buttonvalue\">\r\n <div>Valore</div>\r\n <div>{{field.DynAttachment.ButtonValue}}</div>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n<!-- DIALOG PER MARCATURA -->\r\n<ng-template #dialogImageMarking>\r\n <tmw-image-marker *ngIf=\"MarkingLoaded\"\r\n [src]=\"'data:'+ field.DynAttachment.FileContentType + ';base64,'+ FileBase64\"\r\n [inConfig]=\"inConfig\"\r\n [savedMarkers]=\"extraJSON\"\r\n (save)=\"saveMark($event)\"\r\n (closeDialog)=\"closeDialog()\"\r\n [width]=\"field.DynAttachment.ImageWidthPx\"\r\n [height]=\"field.DynAttachment.ImageHeightPx\"\r\n >\r\n </tmw-image-marker>\r\n</ng-template>\r\n", styles: ["::ng-deep image-drawing>button{background-color:var(--primary)!important;color:#fff!important}.imageContainer .singleImage{margin-top:5px;display:block}.drawButton{margin:5px 0}.buttonkey{border-top:1px solid black;padding-top:10px}\n"] }]
7061
7094
  }], ctorParameters: function () { return [{ type: i1$3.MatDialog }, { type: UtilityHelperService }, { type: i0.Renderer2 }]; }, propDecorators: { endPointConfiguration: [{
7062
7095
  type: Input
7063
7096
  }], record: [{
@@ -8233,16 +8266,11 @@ class AddFormRecordComponent {
8233
8266
  this.loader = false;
8234
8267
  this.isSaving = false;
8235
8268
  this.formloaded = false;
8269
+ this._recordChanging = false;
8236
8270
  this.fieldGroups = {};
8237
8271
  this.FormScalarTypeEnum = FormScalarTypeEnum;
8238
8272
  this.FieldTypeEnum = FieldTypeEnum;
8239
8273
  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;
8246
8274
  }
8247
8275
  ngOnInit() {
8248
8276
  injectGoogleFontsFromForm(this.form);
@@ -8288,33 +8316,34 @@ class AddFormRecordComponent {
8288
8316
  GlobalService.speechDirective.SpeechToTextToggler();
8289
8317
  }
8290
8318
  }
8319
+ //#region onRecordChange
8320
+ /**
8321
+ * Metodo invocato al cambio del valore di ogni proprietà dell'oggetto record.
8322
+ * Serve ad aggiornare il valore di tutti i campi che hanno una formula.
8323
+ * Il guard _recordChanging previene la rientranza: i campi formula aggiornano
8324
+ * record[name] e ciò riemette recordChange; senza guard si genera un loop infinito.
8325
+ */
8291
8326
  onRecordChange() {
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) {
8327
+ if (this._recordChanging)
8295
8328
  return;
8296
- }
8297
- this._isInRecordChange = true;
8329
+ this._recordChanging = true;
8298
8330
  try {
8299
8331
  if (this.fieldTemplate && this.fieldTemplate.length > 0) {
8300
8332
  this.fieldTemplate.forEach((f) => { if (f != null && typeof f.updateField === 'function') {
8301
8333
  f.updateField();
8302
8334
  } });
8303
8335
  }
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.
8336
+ // I validator required leggono da record[field.Name] (closure su record), quindi basta
8337
+ // chiamare updateValueAndValidity per far rileggere il valore aggiornato dalla formula/ActionButton.
8338
+ // Non si usa setValue per evitare che writeValue sui ControlValueAccessor scateni eventi → loop.
8307
8339
  if (this.form?.Fields) {
8308
8340
  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
- }
8341
+ field.FormFormGroup?.get(field.Name)?.updateValueAndValidity({ emitEvent: false });
8313
8342
  });
8314
8343
  }
8315
8344
  }
8316
8345
  finally {
8317
- this._isInRecordChange = false;
8346
+ this._recordChanging = false;
8318
8347
  }
8319
8348
  }
8320
8349
  //#endregion onRecordChange
@@ -15773,7 +15802,9 @@ class AddFormFieldComponent {
15773
15802
  disableClose: true,
15774
15803
  hasBackdrop: true,
15775
15804
  panelClass: 'query-editor-modal',
15776
- width: '90%'
15805
+ width: '90%',
15806
+ maxHeight: '90vh',
15807
+ position: { top: '20px' },
15777
15808
  });
15778
15809
  }
15779
15810
  else {