@eqproject/eqp-dynamic-module 2.9.25 → 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.
- package/esm2020/lib/components/private/trigger-creator/trigger-creator.component.mjs +74 -38
- package/fesm2015/eqproject-eqp-dynamic-module.mjs +73 -38
- package/fesm2015/eqproject-eqp-dynamic-module.mjs.map +1 -1
- package/fesm2020/eqproject-eqp-dynamic-module.mjs +73 -37
- package/fesm2020/eqproject-eqp-dynamic-module.mjs.map +1 -1
- package/lib/components/private/trigger-creator/trigger-creator.component.d.ts +7 -0
- package/package.json +1 -1
|
@@ -13148,44 +13148,12 @@ class TriggerCreatorComponent {
|
|
|
13148
13148
|
Object.keys(this.trigger.formulas).forEach((res) => {
|
|
13149
13149
|
/**qui devono essere messi i campi con valori da visualizzare nei campi dentro il popup
|
|
13150
13150
|
* (?) altrimenti se si entra in modifica non si vedono anche se presenti */
|
|
13151
|
-
const myFormula = this.formulaFieldsStructure.find(x => x.key == res);
|
|
13151
|
+
const myFormula = this.formulaFieldsStructure.find((x) => x.key == res);
|
|
13152
13152
|
myFormula.value = this.trigger.formulas[res].value; // inizializzo valore allo stesso modo per tutti i trigger
|
|
13153
|
-
|
|
13154
|
-
|
|
13155
|
-
//
|
|
13156
|
-
//
|
|
13157
|
-
if (!myFormula.allowedValues) { // se non è presente una lista di valori di default la creo per inserirci il nuovo elemento che sarà mostrato come selezionato
|
|
13158
|
-
myFormula.allowedValues = new Array;
|
|
13159
|
-
}
|
|
13160
|
-
// controllo se il valore ha una corrispondenza nella lista dei valori ammissibili
|
|
13161
|
-
// toglo gli apici perché le formule per come sono configurate li contengono
|
|
13162
|
-
let cleanValue;
|
|
13163
|
-
if ((myFormula.value.startsWith("'") && myFormula.value.endsWith("'")) ||
|
|
13164
|
-
(myFormula.value.startsWith('"') && myFormula.value.endsWith('"'))) {
|
|
13165
|
-
cleanValue = myFormula.value.slice(1, -1);
|
|
13166
|
-
}
|
|
13167
|
-
else {
|
|
13168
|
-
cleanValue = myFormula.value;
|
|
13169
|
-
}
|
|
13170
|
-
let newValueToShow = new KeyValue;
|
|
13171
|
-
newValueToShow.key = myFormula.value;
|
|
13172
|
-
newValueToShow.value = myFormula.value;
|
|
13173
|
-
const alreadyExist = myFormula.allowedValues.find(item => item.key == cleanValue || item.key == myFormula.value);
|
|
13174
|
-
// - se value è presente e diverso dal selettore nella dropdown lo ricerco tra i valori ammissibili; se non lo trovo lo aggiungo come nuova voce nella select
|
|
13175
|
-
if (alreadyExist) {
|
|
13176
|
-
GlobalService.debugLog("@@ IS found alreadyExist", alreadyExist);
|
|
13177
|
-
myFormula.selectedAllowedValue = alreadyExist;
|
|
13178
|
-
}
|
|
13179
|
-
else {
|
|
13180
|
-
GlobalService.debugLog("@@ NOT found alreadyExist", alreadyExist);
|
|
13181
|
-
let newValueToShow = new KeyValue;
|
|
13182
|
-
newValueToShow.key = newValueToShow.value = cleanValue;
|
|
13183
|
-
myFormula.allowedValues.push(newValueToShow);
|
|
13184
|
-
myFormula.selectedAllowedValue = newValueToShow;
|
|
13185
|
-
}
|
|
13186
|
-
}
|
|
13187
|
-
else {
|
|
13188
|
-
myFormula.selectedAllowedValue = this.trigger.formulas[res].selectedAllowedValue;
|
|
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;
|
|
13189
13157
|
}
|
|
13190
13158
|
});
|
|
13191
13159
|
}
|
|
@@ -13324,6 +13292,74 @@ class TriggerCreatorComponent {
|
|
|
13324
13292
|
formulaField.value = "";
|
|
13325
13293
|
}
|
|
13326
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
|
+
}
|
|
13327
13363
|
}
|
|
13328
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 });
|
|
13329
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"] }] });
|