diff --git a/CHANGELOG.md b/CHANGELOG.md index bfe140e03..3ec1d6060 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog - 6.5.1 - Fix missing config file in antd moment date widgets (PR #1046) (issue #1048) + - Fix SpEL import not_between (PR #1050) (issue #1047) - 6.5.0 - Breaking: `Utils.validateTree` returns array of errors (PR #1034) - Breaking: `removeIncompleteRulesOnLoad` by default is false diff --git a/packages/core/modules/import/spel.js b/packages/core/modules/import/spel.js index 64817cae2..159595915 100644 --- a/packages/core/modules/import/spel.js +++ b/packages/core/modules/import/spel.js @@ -495,7 +495,8 @@ const convertOp = (spel, conv, config, meta, parentSpel = null) => { left, from, to - ] + ], + not: isBetweenRev, }; return convertOp(oneSpel, conv, config, meta, parentSpel); } diff --git a/packages/tests/specs/Basic.test.ts b/packages/tests/specs/Basic.test.ts index dd93875cb..38bb5a6c1 100644 --- a/packages/tests/specs/Basic.test.ts +++ b/packages/tests/specs/Basic.test.ts @@ -106,6 +106,25 @@ describe("basic query", () => { }, []); }); + describe("should work with not_between op in SpEL format", () => { + export_checks(configs.simple_with_number, inits.spel_with_not_between, "SpEL", { + logic: { + "and": [ + { + "!": { + "<=": [ + 1, + { "var": "num" }, + 2 + ] + } + } + ] + }, + spel: "(num < 1 || num > 2)" + }, []); + }); + describe("should work with simple value in JsonLogic format not in group", () => { export_checks(configs.simple_with_number, inits.with_number_not_in_group, "JsonLogic", { query: "num == 2", diff --git a/packages/tests/support/inits.js b/packages/tests/support/inits.js index dc720cb4d..a5647aeaa 100644 --- a/packages/tests/support/inits.js +++ b/packages/tests/support/inits.js @@ -1476,6 +1476,7 @@ export const with_groupVarKey = { export const spel_with_number = "num == 2"; export const spel_with_between = "num >= 1 && num <= 2"; +export const spel_with_not_between = "(num < 1 || num > 2)"; export const spel_with_not = "!(num == 2)"; export const spel_with_not_not = "!(num == 2 || !(num == 3))"; export const spel_with_cases = "(str == '222' ? is_string : (num == 4 ? is_number : unknown))";