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,
|
|
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
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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 `${
|
|
29
|
+
return `${s} === ${l}`;
|
|
22
30
|
case "GT":
|
|
23
|
-
return `${
|
|
31
|
+
return `${s} > ${l}`;
|
|
24
32
|
case "LT":
|
|
25
|
-
return `${
|
|
33
|
+
return `${s} < ${l}`;
|
|
26
34
|
case "GET":
|
|
27
|
-
return `${
|
|
35
|
+
return `${s} >= ${l}`;
|
|
28
36
|
case "LET":
|
|
29
|
-
return `${
|
|
37
|
+
return `${s} <= ${l}`;
|
|
30
38
|
case "NET":
|
|
31
|
-
return `${
|
|
39
|
+
return `${s} !== ${l}`;
|
|
32
40
|
case "CONTAIN":
|
|
33
|
-
return `${
|
|
41
|
+
return `${s}.includes(${l})`;
|
|
34
42
|
case "NOT_CONTAIN":
|
|
35
|
-
return `!${
|
|
43
|
+
return `!${s}.includes(${l})`;
|
|
36
44
|
case "IS_NULL":
|
|
37
|
-
return `${
|
|
45
|
+
return `${s} === null`;
|
|
38
46
|
case "IS_NOT_NULL":
|
|
39
|
-
return `${
|
|
47
|
+
return `${s} !== null`;
|
|
40
48
|
case "IN":
|
|
41
49
|
if ("TEXT" === o) {
|
|
42
|
-
return `${
|
|
50
|
+
return `${l.split(",")}.includes(${s})`;
|
|
43
51
|
}
|
|
44
|
-
return `[${
|
|
52
|
+
return `[${l}].includes(${s})`;
|
|
45
53
|
default:
|
|
46
|
-
throw new Error(`比较符号不匹配: ${
|
|
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
|
|
68
|
+
if (t = this.changeDataType(t), null == e) return null;
|
|
61
69
|
switch (t) {
|
|
62
70
|
case "number":
|
|
63
71
|
return getNumberValue(e);
|