@eqproject/eqp-dynamic-module 2.9.24 → 2.9.26

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.
@@ -5690,10 +5690,14 @@ class ActionButtonFieldTemplateComponent {
5690
5690
  GlobalService.debugLog("checkTriggers - assigned DMMODULE - id/code ", formula);
5691
5691
  }
5692
5692
  else if (formulaObj.type == TriggerPropertyTypeEnum.DROPDOWN_LIST) {
5693
- temp = formulaObj.selectedAllowedValue.key; // nel caso di dropdown gli assegno solo la chiave
5693
+ // se la proprietà non esiste è assegnato value - modifica di una configurazione dichiarata in precedenza come string
5694
+ temp =
5695
+ formulaObj?.selectedAllowedValue?.key ? formulaObj.selectedAllowedValue.key
5696
+ : (UtilityHelperService.EvaluateFieldFormula(formula, this.record, this.formulaObject));
5694
5697
  GlobalService.debugLog("checkTriggers - assigned DROPDOWN_LIST- selectedAllowedValue ", formulaObj.selectedAllowedValue);
5695
5698
  }
5696
- else { // passo all'eval quando è stringa e assegno il valore calcolato
5699
+ else {
5700
+ // passo all'eval quando è stringa e assegno il valore calcolato
5697
5701
  temp = UtilityHelperService.EvaluateFieldFormula(formula, this.record, this.formulaObject);
5698
5702
  GlobalService.debugLog("checkTriggers - assigned - .value formula ", formula);
5699
5703
  GlobalService.debugLog("checkTriggers - assigned > value formulaObj.type ", formulaObj);
@@ -6842,8 +6846,12 @@ class AddFormRecordComponent {
6842
6846
  temp = formula;
6843
6847
  }
6844
6848
  else if (formulas[key].type == TriggerPropertyTypeEnum.DROPDOWN_LIST) {
6845
- temp = formulas[key].selectedAllowedValue.key; // nel caso di dropdown gli assegno solo la chiave
6849
+ // se la proprietà non esiste è assegnato value - modifica di una configurazione dichiarata in precedenza come string
6850
+ //temp = formulas[key].selectedAllowedValue.key // nel caso di dropdown gli assegno solo la chiave
6846
6851
  GlobalService.debugLog("checkTriggers - assigned DROPDOWN_LIST- selectedAllowedValue ", temp);
6852
+ temp =
6853
+ formulas[key]?.selectedAllowedValue?.key ? formulas[key].selectedAllowedValue.key
6854
+ : (UtilityHelperService.EvaluateFieldFormula(formula, record, this.formulaObject));
6847
6855
  }
6848
6856
  else { // passo all'eval quando è stringa e assegno i lvalore calcolato
6849
6857
  temp = UtilityHelperService.EvaluateFieldFormula(formula, record, this.formulaObject);
@@ -13140,8 +13148,13 @@ class TriggerCreatorComponent {
13140
13148
  Object.keys(this.trigger.formulas).forEach((res) => {
13141
13149
  /**qui devono essere messi i campi con valori da visualizzare nei campi dentro il popup
13142
13150
  * (?) altrimenti se si entra in modifica non si vedono anche se presenti */
13143
- this.formulaFieldsStructure.find(x => x.key == res).value = this.trigger.formulas[res].value;
13144
- this.formulaFieldsStructure.find(x => x.key == res).selectedAllowedValue = this.trigger.formulas[res].selectedAllowedValue;
13151
+ const myFormula = this.formulaFieldsStructure.find((x) => x.key == res);
13152
+ myFormula.value = this.trigger.formulas[res].value; // inizializzo valore allo stesso modo per tutti i trigger
13153
+ if (myFormula.type == this.triggerPropertyType.DROPDOWN_LIST) {
13154
+ this.stringToDropDownHandler(myFormula, this.trigger.formulas[res]);
13155
+ // se si toglie l'handler aggiungere
13156
+ // myFormula.selectedAllowedValue = this.trigger.formulas[res].selectedAllowedValue;
13157
+ }
13145
13158
  });
13146
13159
  }
13147
13160
  var executeGetModules = false;
@@ -13156,6 +13169,7 @@ class TriggerCreatorComponent {
13156
13169
  if (executeGetModules) {
13157
13170
  this.getAllModules();
13158
13171
  }
13172
+ GlobalService.debugLog("@@ formulaFieldsStructure", this.formulaFieldsStructure);
13159
13173
  }
13160
13174
  onTriggerChange(outputCondition, TriggerCondition) {
13161
13175
  this.trigger.conditions.find(x => x.CID == TriggerCondition.CID).booleanlogicoperator = outputCondition.booleanlogicoperator;
@@ -13278,6 +13292,74 @@ class TriggerCreatorComponent {
13278
13292
  formulaField.value = "";
13279
13293
  }
13280
13294
  }
13295
+ /**
13296
+ * adatta la compatibilità di proprietà di tipo dropdown dichiarate nel configurator ma create in precedenza come string
13297
+ * nel caso di myFormula.value non presenti negli allowedValues queste saranno aggiunte come selezioni temporanee fino a quando modificate con una scelta ammissibile
13298
+ * @param myFormula elem of formulaFieldsStructure
13299
+ * @param triggerFormula this.trigger.formulas[res]
13300
+ */
13301
+ stringToDropDownHandler(myFormula, triggerFormula) {
13302
+ // 1. se è una dropdown partono i controlli di compatibilità
13303
+ if (myFormula.type == TriggerPropertyTypeEnum.DROPDOWN_LIST) {
13304
+ // inizializzo gli allowedValues se non esistono
13305
+ if (!myFormula.allowedValues) {
13306
+ myFormula.allowedValues = new Array();
13307
+ }
13308
+ // per il controllo sui valori dichiarati in precedenza come string devo escludere gli apici
13309
+ const selectedCleanValue = new KeyValue();
13310
+ if (myFormula.value != null &&
13311
+ ((myFormula.value.startsWith("'") &&
13312
+ myFormula.value.endsWith("'")) ||
13313
+ (myFormula.value.startsWith('"') &&
13314
+ myFormula.value.endsWith('"')))) {
13315
+ selectedCleanValue.key = selectedCleanValue.value = myFormula.value.slice(1, -1);
13316
+ }
13317
+ else if (myFormula.value != null) {
13318
+ selectedCleanValue.key = selectedCleanValue.value = myFormula.value;
13319
+ }
13320
+ // true se esiste una corrispondenza di value in allowedValues
13321
+ const isValueInAllowed = selectedCleanValue != null && myFormula.allowedValues.some(item => item.key === selectedCleanValue.key);
13322
+ /*if (myFormula.key == "destinatario_trigger") {
13323
+ GlobalService.debugLog("@@ -out cycle- myFormula.value",myFormula);
13324
+ GlobalService.debugLog("@@ -out cycle- myFormula?.selectedAllowedValue?.key != myFormula.value",myFormula?.selectedAllowedValue?.key != selectedCleanValue);
13325
+ GlobalService.debugLog("@@ -out cycle- isSelected",selectedCleanValue);
13326
+ GlobalService.debugLog("@@ -out cycle- isValueInAllowed",isValueInAllowed);
13327
+ }*/
13328
+ // nelle dropdown value è nullo, se non lo è significa che la proprietà in precedenza è stata dichiarata diversa da dropdown
13329
+ if (myFormula.value != null) {
13330
+ // se value è presente nella lista dei valori ammessi imposto il corrispondente come selezionato e svuoto value perché gestito da selectedAllowedValue
13331
+ if (isValueInAllowed) {
13332
+ myFormula.selectedAllowedValue = selectedCleanValue;
13333
+ myFormula.value = null;
13334
+ }
13335
+ else {
13336
+ // se non è stato trovato un elemento compatibile con value negli allowed, creo un nuovo elemento nella lista e lo seleziono
13337
+ myFormula.allowedValues.push(selectedCleanValue);
13338
+ myFormula.selectedAllowedValue = selectedCleanValue;
13339
+ myFormula.value = null;
13340
+ /*if (myFormula.key == "destinatario_trigger") {
13341
+ GlobalService.debugLog("@@ il selected non è disponibile nei predisposti allowedValues",myFormula.allowedValues);
13342
+ GlobalService.debugLog("@@ il selected non è disponibile nei predisposti selectedAllowedValue",myFormula.selectedAllowedValue);
13343
+ }*/
13344
+ }
13345
+ }
13346
+ else {
13347
+ /*
13348
+ if (myFormula.key == "destinatario_trigger") {
13349
+ GlobalService.debugLog("@@ default: my formula",myFormula);
13350
+ GlobalService.debugLog("@@ default: this.trigger.formulas[res]",this.trigger.formulas[res]);
13351
+ GlobalService.debugLog("@@ default: è resente? in allowedValues?", myFormula.allowedValues.some(item => item.key == myFormula.selectedAllowedValue.key));
13352
+ }
13353
+ */
13354
+ // Comportamento di default: se myFormula.value ==null verifico che il selected è presente nella lista degli allowed; in caso negativo lo aggiungo
13355
+ myFormula.selectedAllowedValue = triggerFormula.selectedAllowedValue; // aggiorno la selezione corrente
13356
+ if (!myFormula.allowedValues.some(item => item.key == myFormula.selectedAllowedValue.key)) {
13357
+ //GlobalService.debugLog("@@ default: my formula",myFormula);
13358
+ myFormula.allowedValues.push(myFormula.selectedAllowedValue);
13359
+ }
13360
+ }
13361
+ }
13362
+ }
13281
13363
  }
13282
13364
  TriggerCreatorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TriggerCreatorComponent, deps: [{ token: i1$3.MatDialog }, { token: UtilityHelperService }], target: i0.ɵɵFactoryTarget.Component });
13283
13365
  TriggerCreatorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: TriggerCreatorComponent, selector: "trigger-creator", inputs: { form: "form", trigger: "trigger", formulas: "formulas", endPointConfiguration: "endPointConfiguration" }, outputs: { onSaveRecord: "onSaveRecord" }, viewQueries: [{ propertyName: "dialogFormula", first: true, predicate: ["dialogFormula"], descendants: true, static: true }], ngImport: i0, template: "\r\n<mat-card class=\"add-form-field\">\r\n <mat-card-header>\r\n <mat-card-title>\r\n {{trigger != null ? \"Modifica\" : \"Aggiungi\"}} trigger\r\n </mat-card-title>\r\n </mat-card-header>\r\n\r\n <mat-card-content>\r\n\r\n <div class=\"container-fluid containerContent padder\" *ngIf=\"trigger.conditions != null\">\r\n\r\n <div class=\"row\">\r\n <div class=\"col-3\">Descrizione Trigger</div>\r\n <div class=\"col-9\">\r\n <mat-form-field>\r\n <mat-label class=\"pt-1\"> Descrizione </mat-label>\r\n <input matInput [(ngModel)]=\"trigger.description\" [readonly]=\"false\" [required]=\"false\">\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n\r\n <div class=\"row\">\r\n <div class=\"col-3\">Tipo Trigger</div>\r\n <div class=\"col-9\">\r\n <eqp-select [arrayData]=\"formulaKeys\" [(ngModelInput)]=\"selectedFormula\"\r\n [arrayKeyProperty]=\"'key'\" [arrayValueProperty]=\"'key'\" [showCancelButton]=\"false\" (ngModelInputChange)=\"onChangeFormula($event)\">\r\n </eqp-select> \r\n </div>\r\n </div>\r\n\r\n <div class=\"row\" *ngFor=\"let formulaField of formulaFieldsStructure\">\r\n <div class=\"col-3\">{{formulaField.key}}</div>\r\n <div class=\"col-9\" *ngIf=\"formulaField.type == triggerPropertyType.STRING\">\r\n <mat-form-field>\r\n <mat-label class=\"pt-1\"> {{formulaField.key}}</mat-label>\r\n <input matInput [readonly]=\"false\" [required]=\"false\" [matTooltip]=\"formulaField.tooltip\" (click)=\"openFormulaDialog(formulaField)\" [(ngModel)]=\"formulaField.value\" (ngModelChange)=\"onFormulaFieldChange(formulaField)\">\r\n </mat-form-field>\r\n </div>\r\n <div class=\"col-9\" *ngIf=\"formulaField.type == triggerPropertyType.DMMODULE\">\r\n <eqp-select [placeholder]=\"'Seleziona modulo'\" [arrayData]=\"forms\" [(ngModelInput)]=\"formulaField.object\" [isSearchable]=\"true\"\r\n [arrayKeyProperty]=\"'ID'\" [arrayValueProperty]=\"'Name'\" [ngModelOptions]=\"{ standalone: true }\" (ngModelInputChange)=\"onEqpSelectModule($event, formulaField)\">\r\n </eqp-select>\r\n </div>\r\n\r\n <!-- campi con valori vincolati li mostro in una select-->\r\n <div class=\"col-9\" *ngIf=\"formulaField.type == triggerPropertyType.DROPDOWN_LIST\">\r\n <eqp-select\r\n [placeholder]=\"'Seleziona valore'\"\r\n [arrayData]=\"formulaField.allowedValues\"\r\n (ngModelInputChange)=\"onDropDownSelection($event,formulaField)\"\r\n [(ngModelInput)]=\"formulaField.selectedAllowedValue\"\r\n [arrayKeyProperty]=\"'key'\"\r\n [arrayValueProperty]=\"'value'\"\r\n [isRequired]=\"false\"\r\n class=\"eqp-form-field eqp-coloured\">\r\n </eqp-select>\r\n </div>\r\n\r\n </div>\r\n\r\n <button class=\"btn btn-primary\" (click)=\"addCondition()\">Aggiungi condizione</button>\r\n\r\n <div class=\"padder\" *ngFor=\"let condition of trigger.conditions\">\r\n <div class=\"row\" *ngIf=\"condition.Field != null\">\r\n <div class=\"col-1\"><button class=\"btn btn-danger\"><mat-icon (click)=\"deleteCondition(condition)\">delete</mat-icon></button></div>\r\n <div class=\"col-2\">\r\n <eqp-select [arrayData]=\"form.Fields\" [(ngModelInput)]=\"condition.Field\"\r\n [arrayKeyProperty]=\"'Name'\" [arrayValueProperty]=\"'Name'\"\r\n [showCancelButton]=\"false\" (ngModelInputChange)=\"onFieldTypeChange($event, condition)\"\r\n [includeFullObject]=\"true\">\r\n </eqp-select>\r\n </div> \r\n <div class=\"col-9\" *ngIf=\"condition.Field != null\">\r\n <dynamic-module-trigger-fix #fieldTemplate [condition]=\"condition\" [form]=\"form\" (triggerChange)=\"onTriggerChange($event, condition)\"></dynamic-module-trigger-fix>\r\n </div>\r\n </div>\r\n\r\n </div>\r\n\r\n </div>\r\n\r\n </mat-card-content>\r\n <mat-card-footer>\r\n <div class=\"d-flex justify-content-end mt-2 mb-1 me-3\"> \r\n <button class=\"mr-2\" mat-raised-button type=\"button\" (click)=\"saveOrExitForm(true)\">\r\n Annulla\r\n </button>\r\n <button class=\"mr-2\" mat-raised-button color=\"primary\" type=\"button\"\r\n (click)=\"saveOrExitForm(false)\" [disabled]=\"isSaving\">\r\n <span *ngIf=\"!isSaving\">Salva</span>\r\n <span *ngIf=\"isSaving\">Salvataggio in Corso...</span>\r\n </button>\r\n </div>\r\n </mat-card-footer>\r\n\r\n</mat-card>\r\n\r\n<!--DIALOG PER SEMPLIFICARE LA SCRITTURA DEL CAMPO FORMULA-->\r\n<ng-template #dialogFormula>\r\n <eqp-dynamic-module-add-formula-component>\r\n </eqp-dynamic-module-add-formula-component>\r\n</ng-template>", styles: [".padder{padding:15px}\n"], dependencies: [{ kind: "component", type: i2.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: i1$1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i2$2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$2.MatLabel, selector: "mat-label" }, { kind: "component", type: i6.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: i6.MatCardContent, selector: "mat-card-content" }, { kind: "directive", type: i6.MatCardFooter, selector: "mat-card-footer" }, { kind: "component", type: i6.MatCardHeader, selector: "mat-card-header" }, { kind: "directive", type: i6.MatCardTitle, selector: "mat-card-title, [mat-card-title], [matCardTitle]" }, { kind: "component", type: i3$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i3$4.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "directive", type: i3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2$3.EqpSelectComponent, selector: "eqp-select", inputs: ["placeholder", "enumData", "enumDataToExclude", "arrayData", "arrayKeyProperty", "arrayValueProperty", "ngModelOptions", "ngModelInput", "formGroupInput", "formControlNameInput", "isRequired", "isDisabled", "isMultiLanguage", "multilanguagePrefixKey", "isAlphabeticalOrderable", "suffixIcon", "prefixIcon", "isMultiSelect", "includeFullObject", "showCancelButton", "isSearchable", "searchText", "noResultSearchText", "data"], outputs: ["ngModelInputChange"] }, { kind: "component", type: AddFormulaComponent, selector: "eqp-dynamic-module-add-formula-component" }, { kind: "component", type: DynamicModuleTriggerFixComponent, selector: "dynamic-module-trigger-fix", inputs: ["condition", "form"], outputs: ["triggerChange"] }] });