@eqproject/eqp-dynamic-module 2.10.21 → 2.10.23
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/exported/eqp-dynamic-module-configurator/eqp-dynamic-module-configurator.component.mjs +2 -2
- package/esm2020/lib/components/private/add-formula-field/add-formula-field.component.mjs +10 -3
- package/esm2020/lib/services/utilityHelper.services.mjs +7 -3
- package/fesm2015/eqproject-eqp-dynamic-module.mjs +16 -5
- package/fesm2015/eqproject-eqp-dynamic-module.mjs.map +1 -1
- package/fesm2020/eqproject-eqp-dynamic-module.mjs +16 -5
- package/fesm2020/eqproject-eqp-dynamic-module.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -823,12 +823,16 @@ class UtilityHelperService {
|
|
|
823
823
|
this.spinnerService = spinnerService;
|
|
824
824
|
this.debugMode = false;
|
|
825
825
|
}
|
|
826
|
+
// rec e ctx servono per ambiente di eval()
|
|
826
827
|
static EvaluateFieldFormula(formula, rec, ctx) {
|
|
827
828
|
try {
|
|
829
|
+
//! questo metodo è più sicuro ma richiede di trasformare tutte le vecchie formule in modo da avere un return
|
|
828
830
|
// creo una funzione che accetta rec e ctx
|
|
829
|
-
const fn = new Function("rec", "ctx", `return ${formula};`);
|
|
831
|
+
// const fn = new Function("rec", "ctx", `return ${formula};`);
|
|
830
832
|
// eseguo passando i valori
|
|
831
|
-
const evaluatedValue = fn(rec, ctx);
|
|
833
|
+
// const evaluatedValue = fn(rec, ctx);
|
|
834
|
+
//! questo metodo è poco sicuro ma è nato così
|
|
835
|
+
const evaluatedValue = eval(formula);
|
|
832
836
|
return evaluatedValue ?? null;
|
|
833
837
|
}
|
|
834
838
|
catch (err) {
|
|
@@ -11725,8 +11729,15 @@ class AddFormulaComponent {
|
|
|
11725
11729
|
}
|
|
11726
11730
|
// 2. Controllo runtime
|
|
11727
11731
|
try {
|
|
11728
|
-
|
|
11729
|
-
|
|
11732
|
+
//! questo metodo è più sicuro ma richiede di trasformare tutte le vecchie formule in modo da avere un return
|
|
11733
|
+
// creo una funzione che accetta rec e ctx
|
|
11734
|
+
// const fn = new Function("rec", "ctx", `return ${formula};`);
|
|
11735
|
+
// eseguo passando i valori
|
|
11736
|
+
// fn(this.fullFieldMap.rec, this.formulaObject)
|
|
11737
|
+
//! questo metodo è poco sicuro ma è nato così
|
|
11738
|
+
let rec = this.fullFieldMap.rec;
|
|
11739
|
+
let ctx = this.formulaObject;
|
|
11740
|
+
const evaluatedValue = eval(formula);
|
|
11730
11741
|
}
|
|
11731
11742
|
catch (err) {
|
|
11732
11743
|
console.error("Errore di runtime: " + err.message);
|
|
@@ -15252,7 +15263,7 @@ class EqpDynamicModuleConfiguratorComponent {
|
|
|
15252
15263
|
cloneField.OrdinalPosition = this.form.Fields.length + 1;
|
|
15253
15264
|
this.selectedField = new BaseField();
|
|
15254
15265
|
this.indexSelectedField = null;
|
|
15255
|
-
let cloneFieldStructure = { field:
|
|
15266
|
+
let cloneFieldStructure = { field: cloneField, reopen: 0 };
|
|
15256
15267
|
this.onSaveField(cloneFieldStructure);
|
|
15257
15268
|
}
|
|
15258
15269
|
else {
|