super-page-runtime 2.3.5-sit2 → 2.3.5-sit3

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.
@@ -106,6 +106,8 @@ function P(e2, t2, s2, i2) {
106
106
  return n2;
107
107
  }
108
108
  function M(e2, t2) {
109
+ var _a, _b;
110
+ if (false === ((_b = (_a = e2.props) == null ? void 0 : _a.base) == null ? void 0 : _b.isPermission)) return "true";
109
111
  const s2 = [];
110
112
  if (e2.autoPermissions) for (const i2 of e2.autoPermissions) s2.push(t2.code + "." + i2.simpleCode);
111
113
  if (e2.functionCodes) {
@@ -3,12 +3,13 @@ import { Component, PageContext } from '../../../../utils/interfaces/page-design
3
3
  type Condition = {
4
4
  propValueType: string;
5
5
  joinSign: string;
6
- dataType: 'number' | 'date' | 'string';
6
+ dataType: 'number' | 'date' | 'string' | 'boolean' | 'TEXT' | 'DATE' | 'TIME' | 'DOUBLE' | 'FLOAT' | 'INTEGER' | 'LONG';
7
7
  rightBracket: string;
8
8
  leftBracket: string;
9
9
  propValue: string;
10
10
  propName: string;
11
11
  operator: 'GT' | 'LT' | 'GET' | 'LET' | 'NET' | 'CONTAIN' | 'NOT_CONTAIN' | 'IS_NULL' | 'IS_NOT_NULL';
12
+ variableIsNull?: string;
12
13
  };
13
14
  type Data = Record<string, any>;
14
15
  export declare class ExpressionEvaluator {
@@ -10,40 +10,48 @@ class ExpressionEvaluator {
10
10
  const { propName: o, operator: a, propValue: n, leftBracket: s, rightBracket: l, joinSign: i, dataType: c } = t;
11
11
  if (!o || "" === o) return "";
12
12
  const u = getValueFromVariable(e.entity, o, r);
13
- let p = `${s} ${this.getComparisonExpression(u, a, getValueFromVariable(e.entity, n, r), c)} ${l}`;
13
+ let p = `${s} ${this.getComparisonExpression(u, t, getValueFromVariable(e.entity, n, r))} ${l}`;
14
14
  return i && ("and" === i || "AND" === i ? p += "&&" : "or" !== i && "OR" !== i || (p += "||")), p.trim();
15
15
  }
16
- static getComparisonExpression(e, t, r, o) {
17
- t || (t = "EQ");
18
- const a = this.parseValue(e, o), n = this.parseValue(r, o);
19
- switch (t) {
16
+ static getComparisonExpression(e, t, r) {
17
+ const { dataType: o, variableIsNull: a } = t;
18
+ let n = t.operator;
19
+ n || (n = "EQ");
20
+ let s = this.parseValue(e, o);
21
+ const l = this.parseValue(r, o);
22
+ if (null == l && a) {
23
+ if (null == s && (s = "null"), "null" === a) return `${s} === null`;
24
+ if ("ignore" === a) return "1=1";
25
+ if ("notequal" === a) return "1!=1";
26
+ }
27
+ switch (n) {
20
28
  case "EQ":
21
- return `${a} === ${n}`;
29
+ return `${s} === ${l}`;
22
30
  case "GT":
23
- return `${a} > ${n}`;
31
+ return `${s} > ${l}`;
24
32
  case "LT":
25
- return `${a} < ${n}`;
33
+ return `${s} < ${l}`;
26
34
  case "GET":
27
- return `${a} >= ${n}`;
35
+ return `${s} >= ${l}`;
28
36
  case "LET":
29
- return `${a} <= ${n}`;
37
+ return `${s} <= ${l}`;
30
38
  case "NET":
31
- return `${a} !== ${n}`;
39
+ return `${s} !== ${l}`;
32
40
  case "CONTAIN":
33
- return `${a}.includes(${n})`;
41
+ return `${s}.includes(${l})`;
34
42
  case "NOT_CONTAIN":
35
- return `!${a}.includes(${n})`;
43
+ return `!${s}.includes(${l})`;
36
44
  case "IS_NULL":
37
- return `${a} === null`;
45
+ return `${s} === null`;
38
46
  case "IS_NOT_NULL":
39
- return `${a} !== null`;
47
+ return `${s} !== null`;
40
48
  case "IN":
41
49
  if ("TEXT" === o) {
42
- return `${n.split(",")}.includes(${a})`;
50
+ return `${l.split(",")}.includes(${s})`;
43
51
  }
44
- return `[${n}].includes(${a})`;
52
+ return `[${l}].includes(${s})`;
45
53
  default:
46
- throw new Error(`比较符号不匹配: ${t}`);
54
+ throw new Error(`比较符号不匹配: ${n}`);
47
55
  }
48
56
  }
49
57
  static changeDataType(e) {
@@ -57,7 +65,7 @@ class ExpressionEvaluator {
57
65
  return t;
58
66
  }
59
67
  static parseValue(e, t) {
60
- if (t = this.changeDataType(t), null == e) return e;
68
+ if (t = this.changeDataType(t), null == e) return null;
61
69
  switch (t) {
62
70
  case "number":
63
71
  return getNumberValue(e);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "super-page-runtime",
3
- "version": "2.3.5-sit2",
3
+ "version": "2.3.5-sit3",
4
4
  "description": "AgileBuilder super page runtime",
5
5
  "license": "ISC",
6
6
  "main": "dist/es/index.js",