query-layers-expression 1.0.6 → 1.0.8
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/build/index.d.ts +4 -2
- package/build/index.js +127 -75
- package/package.json +1 -1
- package/src/index.ts +178 -84
package/build/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ interface queryExpressionType {
|
|
|
3
3
|
qFields?: [any?, any?, any?];
|
|
4
4
|
chartCategory?: any;
|
|
5
5
|
chartCategoryField?: any;
|
|
6
|
+
chartCategoryType?: "number" | "string";
|
|
6
7
|
status?: number | null;
|
|
7
8
|
statusField?: any;
|
|
8
9
|
qExpression?: any;
|
|
@@ -12,10 +13,11 @@ declare class QueryExpressionLayers implements queryExpressionType {
|
|
|
12
13
|
qFields?: [any?, any?, any?] | any;
|
|
13
14
|
chartCategory?: any;
|
|
14
15
|
chartCategoryField?: any;
|
|
16
|
+
chartCategoryType?: "number" | "string";
|
|
15
17
|
status?: number | null;
|
|
16
18
|
statusField?: any;
|
|
17
19
|
qExpression?: any;
|
|
18
|
-
constructor(qValues: any, qFields: any, chartCategory: any, chartCategoryField: any, status: number, statusField: any, qExpression: any);
|
|
19
|
-
queryExpression: (
|
|
20
|
+
constructor(qValues: any, qFields: any, chartCategory: any, chartCategoryField: any, chartCategoryType: "number" | "string", status: number, statusField: any, qExpression: any);
|
|
21
|
+
queryExpression: () => string;
|
|
20
22
|
}
|
|
21
23
|
export default QueryExpressionLayers;
|
package/build/index.js
CHANGED
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
class QueryExpressionLayers {
|
|
4
|
-
constructor(qValues, qFields, chartCategory, chartCategoryField, status, statusField, qExpression) {
|
|
4
|
+
constructor(qValues, qFields, chartCategory, chartCategoryField, chartCategoryType, status, statusField, qExpression) {
|
|
5
5
|
//--- Method ---//
|
|
6
6
|
//--- Query Expression
|
|
7
|
-
this.queryExpression = (
|
|
7
|
+
this.queryExpression = () => {
|
|
8
8
|
//--- Basic query expression
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
this.qValues;
|
|
10
|
+
const query1 = typeof this.qValues?.[0] === "number"
|
|
11
|
+
? `${this.qFields?.[0]} = ${this.qValues?.[0]}`
|
|
12
|
+
: `${this.qFields?.[0]} = '${this.qValues?.[0]}'`;
|
|
13
|
+
const query2 = typeof this.qValues?.[1] === "number"
|
|
14
|
+
? `${this.qFields?.[1]} = ${this.qValues?.[1]}`
|
|
15
|
+
: `${this.qFields?.[1]} = '${this.qValues?.[1]}'`;
|
|
16
|
+
const query3 = typeof this.qValues?.[2] === "number"
|
|
17
|
+
? `${this.qFields?.[2]} = ${this.qValues?.[2]}`
|
|
18
|
+
: `${this.qFields?.[2]} = '${this.qValues?.[2]}'`;
|
|
18
19
|
const query12 = `${query1} AND ${query2}`;
|
|
19
20
|
const query123 = `${query1} AND ${query2} AND ${query3}`;
|
|
20
|
-
const q_status = `${statusField} = ${status}`;
|
|
21
|
-
const q_chartC =
|
|
21
|
+
const q_status = `${this.statusField} = ${this.status}`;
|
|
22
|
+
const q_chartC = this.chartCategoryType === "string"
|
|
23
|
+
? `${this.chartCategoryField} = '${this.chartCategory}'`
|
|
24
|
+
: `${this.chartCategoryField} = ${this.chartCategory}`;
|
|
22
25
|
const q_status_chartC = `${q_status} AND ${q_chartC}`;
|
|
23
26
|
const query1_chartC = `${query1} AND ${q_chartC}`;
|
|
24
27
|
const query12_chartC = `${query12} AND ${q_chartC}`;
|
|
@@ -30,141 +33,189 @@ class QueryExpressionLayers {
|
|
|
30
33
|
const query12_status_chartC = `${query12_status} AND ${q_chartC}`;
|
|
31
34
|
const query123_status_chartC = `${query123_status} AND ${q_chartC}`;
|
|
32
35
|
//--- With qExpression
|
|
33
|
-
const query1_qE = `${query1} AND ${qExpression}`;
|
|
34
|
-
const query12_qE = `${query12} AND ${qExpression}`;
|
|
35
|
-
const query123_qE = `${query123} AND ${qExpression}`;
|
|
36
|
-
const q_status_qE = `${q_status} AND ${qExpression}`;
|
|
37
|
-
const q_chartC_qE = `${q_chartC} AND ${qExpression}`;
|
|
38
|
-
const q_status_chartC_qE = `${q_status_chartC} AND ${qExpression}`;
|
|
39
|
-
const query1_chartC_qE = `${query1_chartC} AND ${qExpression}`;
|
|
40
|
-
const query12_chartC_qE = `${query12_chartC} AND ${qExpression}`;
|
|
41
|
-
const query123_chartC_qE = `${query123_chartC} AND ${qExpression}`;
|
|
42
|
-
const query1_status_qE = `${query1_status} AND ${qExpression}`;
|
|
43
|
-
const query12_status_qE = `${query12_status} AND ${qExpression}`;
|
|
44
|
-
const query123_status_qE = `${query123_status} AND ${qExpression}`;
|
|
45
|
-
const query1_status_chartC_qE = `${query1_status_chartC} AND ${qExpression}`;
|
|
46
|
-
const query12_status_chartC_qE = `${query12_status_chartC} AND ${qExpression}`;
|
|
47
|
-
const query123_status_chartC_qE = `${query123_status_chartC} AND ${qExpression}`;
|
|
36
|
+
const query1_qE = `${query1} AND ${this.qExpression}`;
|
|
37
|
+
const query12_qE = `${query12} AND ${this.qExpression}`;
|
|
38
|
+
const query123_qE = `${query123} AND ${this.qExpression}`;
|
|
39
|
+
const q_status_qE = `${q_status} AND ${this.qExpression}`;
|
|
40
|
+
const q_chartC_qE = `${q_chartC} AND ${this.qExpression}`;
|
|
41
|
+
const q_status_chartC_qE = `${q_status_chartC} AND ${this.qExpression}`;
|
|
42
|
+
const query1_chartC_qE = `${query1_chartC} AND ${this.qExpression}`;
|
|
43
|
+
const query12_chartC_qE = `${query12_chartC} AND ${this.qExpression}`;
|
|
44
|
+
const query123_chartC_qE = `${query123_chartC} AND ${this.qExpression}`;
|
|
45
|
+
const query1_status_qE = `${query1_status} AND ${this.qExpression}`;
|
|
46
|
+
const query12_status_qE = `${query12_status} AND ${this.qExpression}`;
|
|
47
|
+
const query123_status_qE = `${query123_status} AND ${this.qExpression}`;
|
|
48
|
+
const query1_status_chartC_qE = `${query1_status_chartC} AND ${this.qExpression}`;
|
|
49
|
+
const query12_status_chartC_qE = `${query12_status_chartC} AND ${this.qExpression}`;
|
|
50
|
+
const query123_status_chartC_qE = `${query123_status_chartC} AND ${this.qExpression}`;
|
|
48
51
|
let expression = "";
|
|
49
|
-
if (qExpression) {
|
|
50
|
-
if (chartCategoryField) {
|
|
51
|
-
if (statusField) {
|
|
52
|
-
if (!qValues?.[0] && !qValues?.[1] && !qValues?.[2]) {
|
|
52
|
+
if (this.qExpression) {
|
|
53
|
+
if (this.chartCategoryField) {
|
|
54
|
+
if (this.statusField) {
|
|
55
|
+
if (!this.qValues?.[0] && !this.qValues?.[1] && !this.qValues?.[2]) {
|
|
53
56
|
expression = q_status_chartC_qE;
|
|
54
57
|
}
|
|
55
|
-
else if (qValues?.[0] &&
|
|
58
|
+
else if (this.qValues?.[0] &&
|
|
59
|
+
!this.qValues?.[1] &&
|
|
60
|
+
!this.qValues?.[2]) {
|
|
56
61
|
expression = query1_status_chartC_qE;
|
|
57
62
|
}
|
|
58
|
-
else if (qValues?.[0] &&
|
|
63
|
+
else if (this.qValues?.[0] &&
|
|
64
|
+
this.qValues?.[1] &&
|
|
65
|
+
!this.qValues?.[2]) {
|
|
59
66
|
expression = query12_status_chartC_qE;
|
|
60
67
|
}
|
|
61
|
-
else if (qValues?.[0] &&
|
|
68
|
+
else if (this.qValues?.[0] &&
|
|
69
|
+
this.qValues?.[1] &&
|
|
70
|
+
this.qValues?.[2]) {
|
|
62
71
|
expression = query123_status_chartC_qE;
|
|
63
72
|
}
|
|
64
73
|
}
|
|
65
|
-
else if (!statusField) {
|
|
66
|
-
if (!qValues?.[0] && !qValues?.[1] && !qValues?.[2]) {
|
|
74
|
+
else if (!this.statusField) {
|
|
75
|
+
if (!this.qValues?.[0] && !this.qValues?.[1] && !this.qValues?.[2]) {
|
|
67
76
|
expression = q_chartC_qE;
|
|
68
77
|
}
|
|
69
|
-
else if (qValues?.[0] &&
|
|
78
|
+
else if (this.qValues?.[0] &&
|
|
79
|
+
!this.qValues?.[1] &&
|
|
80
|
+
!this.qValues?.[2]) {
|
|
70
81
|
expression = query1_chartC_qE;
|
|
71
82
|
}
|
|
72
|
-
else if (qValues?.[0] &&
|
|
83
|
+
else if (this.qValues?.[0] &&
|
|
84
|
+
this.qValues?.[1] &&
|
|
85
|
+
!this.qValues?.[2]) {
|
|
73
86
|
expression = query12_chartC_qE;
|
|
74
87
|
}
|
|
75
|
-
else if (qValues?.[0] &&
|
|
88
|
+
else if (this.qValues?.[0] &&
|
|
89
|
+
this.qValues?.[1] &&
|
|
90
|
+
this.qValues?.[2]) {
|
|
76
91
|
expression = query123_chartC_qE;
|
|
77
92
|
}
|
|
78
93
|
}
|
|
79
94
|
}
|
|
80
|
-
else if (!chartCategoryField) {
|
|
81
|
-
if (statusField) {
|
|
82
|
-
if (!qValues?.[0] && !qValues?.[1] && !qValues?.[2]) {
|
|
95
|
+
else if (!this.chartCategoryField) {
|
|
96
|
+
if (this.statusField) {
|
|
97
|
+
if (!this.qValues?.[0] && !this.qValues?.[1] && !this.qValues?.[2]) {
|
|
83
98
|
expression = q_status_qE;
|
|
84
99
|
}
|
|
85
|
-
else if (qValues?.[0] &&
|
|
100
|
+
else if (this.qValues?.[0] &&
|
|
101
|
+
!this.qValues?.[1] &&
|
|
102
|
+
!this.qValues?.[2]) {
|
|
86
103
|
expression = query1_status_qE;
|
|
87
104
|
}
|
|
88
|
-
else if (qValues?.[0] &&
|
|
105
|
+
else if (this.qValues?.[0] &&
|
|
106
|
+
this.qValues?.[1] &&
|
|
107
|
+
!this.qValues?.[2]) {
|
|
89
108
|
expression = query12_status_qE;
|
|
90
109
|
}
|
|
91
|
-
else if (qValues?.[0] &&
|
|
110
|
+
else if (this.qValues?.[0] &&
|
|
111
|
+
this.qValues?.[1] &&
|
|
112
|
+
this.qValues?.[2]) {
|
|
92
113
|
expression = query123_status_qE;
|
|
93
114
|
}
|
|
94
115
|
}
|
|
95
|
-
else if (!statusField) {
|
|
96
|
-
if (!qValues?.[0] && !qValues?.[1] && !qValues?.[2]) {
|
|
97
|
-
expression = qExpression;
|
|
116
|
+
else if (!this.statusField) {
|
|
117
|
+
if (!this.qValues?.[0] && !this.qValues?.[1] && !this.qValues?.[2]) {
|
|
118
|
+
expression = this.qExpression;
|
|
98
119
|
}
|
|
99
|
-
else if (qValues?.[0] &&
|
|
120
|
+
else if (this.qValues?.[0] &&
|
|
121
|
+
!this.qValues?.[1] &&
|
|
122
|
+
!this.qValues?.[2]) {
|
|
100
123
|
expression = query1_qE;
|
|
101
124
|
}
|
|
102
|
-
else if (qValues?.[0] &&
|
|
125
|
+
else if (this.qValues?.[0] &&
|
|
126
|
+
this.qValues?.[1] &&
|
|
127
|
+
!this.qValues?.[2]) {
|
|
103
128
|
expression = query12_qE;
|
|
104
129
|
}
|
|
105
|
-
else if (qValues?.[0] &&
|
|
130
|
+
else if (this.qValues?.[0] &&
|
|
131
|
+
this.qValues?.[1] &&
|
|
132
|
+
this.qValues?.[2]) {
|
|
106
133
|
expression = query123_qE;
|
|
107
134
|
}
|
|
108
135
|
}
|
|
109
136
|
}
|
|
110
137
|
}
|
|
111
|
-
else if (!qExpression) {
|
|
112
|
-
if (chartCategoryField) {
|
|
113
|
-
if (statusField) {
|
|
114
|
-
if (!qValues?.[0] && !qValues?.[1] && !qValues?.[2]) {
|
|
138
|
+
else if (!this.qExpression) {
|
|
139
|
+
if (this.chartCategoryField) {
|
|
140
|
+
if (this.statusField) {
|
|
141
|
+
if (!this.qValues?.[0] && !this.qValues?.[1] && !this.qValues?.[2]) {
|
|
115
142
|
expression = q_status_chartC;
|
|
116
143
|
}
|
|
117
|
-
else if (qValues?.[0] &&
|
|
144
|
+
else if (this.qValues?.[0] &&
|
|
145
|
+
!this.qValues?.[1] &&
|
|
146
|
+
!this.qValues?.[2]) {
|
|
118
147
|
expression = query1_status_chartC;
|
|
119
148
|
}
|
|
120
|
-
else if (qValues?.[0] &&
|
|
149
|
+
else if (this.qValues?.[0] &&
|
|
150
|
+
this.qValues?.[1] &&
|
|
151
|
+
!this.qValues?.[2]) {
|
|
121
152
|
expression = query12_status_chartC;
|
|
122
153
|
}
|
|
123
|
-
else if (qValues?.[0] &&
|
|
154
|
+
else if (this.qValues?.[0] &&
|
|
155
|
+
this.qValues?.[1] &&
|
|
156
|
+
this.qValues?.[2]) {
|
|
124
157
|
expression = query123_status_chartC;
|
|
125
158
|
}
|
|
126
159
|
}
|
|
127
|
-
else if (!statusField) {
|
|
128
|
-
if (!qValues?.[0] && !qValues?.[1] && !qValues?.[2]) {
|
|
160
|
+
else if (!this.statusField) {
|
|
161
|
+
if (!this.qValues?.[0] && !this.qValues?.[1] && !this.qValues?.[2]) {
|
|
129
162
|
expression = q_chartC;
|
|
130
163
|
}
|
|
131
|
-
else if (qValues?.[0] &&
|
|
164
|
+
else if (this.qValues?.[0] &&
|
|
165
|
+
!this.qValues?.[1] &&
|
|
166
|
+
!this.qValues?.[2]) {
|
|
132
167
|
expression = query1_chartC;
|
|
133
168
|
}
|
|
134
|
-
else if (qValues?.[0] &&
|
|
169
|
+
else if (this.qValues?.[0] &&
|
|
170
|
+
this.qValues?.[1] &&
|
|
171
|
+
!this.qValues?.[2]) {
|
|
135
172
|
expression = query12_chartC;
|
|
136
173
|
}
|
|
137
|
-
else if (qValues?.[0] &&
|
|
174
|
+
else if (this.qValues?.[0] &&
|
|
175
|
+
this.qValues?.[1] &&
|
|
176
|
+
this.qValues?.[2]) {
|
|
138
177
|
expression = query123_chartC;
|
|
139
178
|
}
|
|
140
179
|
}
|
|
141
180
|
}
|
|
142
|
-
else if (!chartCategoryField) {
|
|
143
|
-
if (statusField) {
|
|
144
|
-
if (!qValues?.[0] && !qValues?.[1] && !qValues?.[2]) {
|
|
181
|
+
else if (!this.chartCategoryField) {
|
|
182
|
+
if (this.statusField) {
|
|
183
|
+
if (!this.qValues?.[0] && !this.qValues?.[1] && !this.qValues?.[2]) {
|
|
145
184
|
expression = q_status;
|
|
146
185
|
}
|
|
147
|
-
else if (qValues?.[0] &&
|
|
186
|
+
else if (this.qValues?.[0] &&
|
|
187
|
+
!this.qValues?.[1] &&
|
|
188
|
+
!this.qValues?.[2]) {
|
|
148
189
|
expression = query1_status;
|
|
149
190
|
}
|
|
150
|
-
else if (qValues?.[0] &&
|
|
191
|
+
else if (this.qValues?.[0] &&
|
|
192
|
+
this.qValues?.[1] &&
|
|
193
|
+
!this.qValues?.[2]) {
|
|
151
194
|
expression = query12_status;
|
|
152
195
|
}
|
|
153
|
-
else if (qValues?.[0] &&
|
|
196
|
+
else if (this.qValues?.[0] &&
|
|
197
|
+
this.qValues?.[1] &&
|
|
198
|
+
this.qValues?.[2]) {
|
|
154
199
|
expression = query123_status;
|
|
155
200
|
}
|
|
156
201
|
}
|
|
157
|
-
else if (!statusField) {
|
|
158
|
-
if (!qValues?.[0] && !qValues?.[1] && !qValues?.[2]) {
|
|
202
|
+
else if (!this.statusField) {
|
|
203
|
+
if (!this.qValues?.[0] && !this.qValues?.[1] && !this.qValues?.[2]) {
|
|
159
204
|
expression = "1=1";
|
|
160
205
|
}
|
|
161
|
-
else if (qValues?.[0] &&
|
|
206
|
+
else if (this.qValues?.[0] &&
|
|
207
|
+
!this.qValues?.[1] &&
|
|
208
|
+
!this.qValues?.[2]) {
|
|
162
209
|
expression = query1;
|
|
163
210
|
}
|
|
164
|
-
else if (qValues?.[0] &&
|
|
211
|
+
else if (this.qValues?.[0] &&
|
|
212
|
+
this.qValues?.[1] &&
|
|
213
|
+
!this.qValues?.[2]) {
|
|
165
214
|
expression = query12;
|
|
166
215
|
}
|
|
167
|
-
else if (qValues?.[0] &&
|
|
216
|
+
else if (this.qValues?.[0] &&
|
|
217
|
+
this.qValues?.[1] &&
|
|
218
|
+
this.qValues?.[2]) {
|
|
168
219
|
expression = query123;
|
|
169
220
|
}
|
|
170
221
|
}
|
|
@@ -176,6 +227,7 @@ class QueryExpressionLayers {
|
|
|
176
227
|
this.qFields = qFields;
|
|
177
228
|
this.chartCategory = chartCategory;
|
|
178
229
|
this.chartCategoryField = chartCategoryField;
|
|
230
|
+
this.chartCategoryType = chartCategoryType;
|
|
179
231
|
this.status = status;
|
|
180
232
|
this.statusField = statusField;
|
|
181
233
|
this.qExpression = qExpression;
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import FeatureLayer from "@arcgis/core/layers/FeatureLayer";
|
|
2
|
-
|
|
3
1
|
interface queryExpressionType {
|
|
4
2
|
qValues?: [any?, any?, any?];
|
|
5
3
|
qFields?: [any?, any?, any?];
|
|
6
4
|
chartCategory?: any;
|
|
7
5
|
chartCategoryField?: any;
|
|
6
|
+
chartCategoryType?: "number" | "string";
|
|
8
7
|
status?: number | null;
|
|
9
8
|
statusField?: any;
|
|
10
9
|
qExpression?: any;
|
|
@@ -15,6 +14,7 @@ class QueryExpressionLayers implements queryExpressionType {
|
|
|
15
14
|
qFields?: [any?, any?, any?] | any;
|
|
16
15
|
chartCategory?: any;
|
|
17
16
|
chartCategoryField?: any;
|
|
17
|
+
chartCategoryType?: "number" | "string";
|
|
18
18
|
status?: number | null;
|
|
19
19
|
statusField?: any;
|
|
20
20
|
qExpression?: any;
|
|
@@ -24,6 +24,7 @@ class QueryExpressionLayers implements queryExpressionType {
|
|
|
24
24
|
qFields: any,
|
|
25
25
|
chartCategory: any,
|
|
26
26
|
chartCategoryField: any,
|
|
27
|
+
chartCategoryType: "number" | "string",
|
|
27
28
|
status: number,
|
|
28
29
|
statusField: any,
|
|
29
30
|
qExpression: any,
|
|
@@ -32,6 +33,7 @@ class QueryExpressionLayers implements queryExpressionType {
|
|
|
32
33
|
this.qFields = qFields;
|
|
33
34
|
this.chartCategory = chartCategory;
|
|
34
35
|
this.chartCategoryField = chartCategoryField;
|
|
36
|
+
this.chartCategoryType = chartCategoryType;
|
|
35
37
|
this.status = status;
|
|
36
38
|
this.statusField = statusField;
|
|
37
39
|
this.qExpression = qExpression;
|
|
@@ -39,32 +41,28 @@ class QueryExpressionLayers implements queryExpressionType {
|
|
|
39
41
|
|
|
40
42
|
//--- Method ---//
|
|
41
43
|
//--- Query Expression
|
|
42
|
-
queryExpression = ({
|
|
43
|
-
qValues,
|
|
44
|
-
qFields,
|
|
45
|
-
chartCategory,
|
|
46
|
-
chartCategoryField,
|
|
47
|
-
status,
|
|
48
|
-
statusField,
|
|
49
|
-
qExpression,
|
|
50
|
-
}: queryExpressionType) => {
|
|
44
|
+
queryExpression = () => {
|
|
51
45
|
//--- Basic query expression
|
|
46
|
+
this.qValues;
|
|
52
47
|
const query1 =
|
|
53
|
-
typeof qValues?.[0] === "number"
|
|
54
|
-
? `${qFields?.[0]} = ${qValues?.[0]}`
|
|
55
|
-
: `${qFields?.[0]} = '${qValues?.[0]}'`;
|
|
48
|
+
typeof this.qValues?.[0] === "number"
|
|
49
|
+
? `${this.qFields?.[0]} = ${this.qValues?.[0]}`
|
|
50
|
+
: `${this.qFields?.[0]} = '${this.qValues?.[0]}'`;
|
|
56
51
|
const query2 =
|
|
57
|
-
typeof qValues?.[1] === "number"
|
|
58
|
-
? `${qFields?.[1]} = ${qValues?.[1]}`
|
|
59
|
-
: `${qFields?.[1]} = '${qValues?.[1]}'`;
|
|
52
|
+
typeof this.qValues?.[1] === "number"
|
|
53
|
+
? `${this.qFields?.[1]} = ${this.qValues?.[1]}`
|
|
54
|
+
: `${this.qFields?.[1]} = '${this.qValues?.[1]}'`;
|
|
60
55
|
const query3 =
|
|
61
|
-
typeof qValues?.[2] === "number"
|
|
62
|
-
? `${qFields?.[2]} = ${qValues?.[2]}`
|
|
63
|
-
: `${qFields?.[2]} = '${qValues?.[2]}'`;
|
|
56
|
+
typeof this.qValues?.[2] === "number"
|
|
57
|
+
? `${this.qFields?.[2]} = ${this.qValues?.[2]}`
|
|
58
|
+
: `${this.qFields?.[2]} = '${this.qValues?.[2]}'`;
|
|
64
59
|
const query12 = `${query1} AND ${query2}`;
|
|
65
60
|
const query123 = `${query1} AND ${query2} AND ${query3}`;
|
|
66
|
-
const q_status = `${statusField} = ${status}`;
|
|
67
|
-
const q_chartC =
|
|
61
|
+
const q_status = `${this.statusField} = ${this.status}`;
|
|
62
|
+
const q_chartC =
|
|
63
|
+
this.chartCategoryType === "string"
|
|
64
|
+
? `${this.chartCategoryField} = '${this.chartCategory}'`
|
|
65
|
+
: `${this.chartCategoryField} = ${this.chartCategory}`;
|
|
68
66
|
const q_status_chartC = `${q_status} AND ${q_chartC}`;
|
|
69
67
|
const query1_chartC = `${query1} AND ${q_chartC}`;
|
|
70
68
|
const query12_chartC = `${query12} AND ${q_chartC}`;
|
|
@@ -77,111 +75,207 @@ class QueryExpressionLayers implements queryExpressionType {
|
|
|
77
75
|
const query123_status_chartC = `${query123_status} AND ${q_chartC}`;
|
|
78
76
|
|
|
79
77
|
//--- With qExpression
|
|
80
|
-
const query1_qE = `${query1} AND ${qExpression}`;
|
|
81
|
-
const query12_qE = `${query12} AND ${qExpression}`;
|
|
82
|
-
const query123_qE = `${query123} AND ${qExpression}`;
|
|
83
|
-
const q_status_qE = `${q_status} AND ${qExpression}`;
|
|
84
|
-
const q_chartC_qE = `${q_chartC} AND ${qExpression}`;
|
|
85
|
-
const q_status_chartC_qE = `${q_status_chartC} AND ${qExpression}`;
|
|
86
|
-
const query1_chartC_qE = `${query1_chartC} AND ${qExpression}`;
|
|
87
|
-
const query12_chartC_qE = `${query12_chartC} AND ${qExpression}`;
|
|
88
|
-
const query123_chartC_qE = `${query123_chartC} AND ${qExpression}`;
|
|
89
|
-
const query1_status_qE = `${query1_status} AND ${qExpression}`;
|
|
90
|
-
const query12_status_qE = `${query12_status} AND ${qExpression}`;
|
|
91
|
-
const query123_status_qE = `${query123_status} AND ${qExpression}`;
|
|
92
|
-
const query1_status_chartC_qE = `${query1_status_chartC} AND ${qExpression}`;
|
|
93
|
-
const query12_status_chartC_qE = `${query12_status_chartC} AND ${qExpression}`;
|
|
94
|
-
const query123_status_chartC_qE = `${query123_status_chartC} AND ${qExpression}`;
|
|
78
|
+
const query1_qE = `${query1} AND ${this.qExpression}`;
|
|
79
|
+
const query12_qE = `${query12} AND ${this.qExpression}`;
|
|
80
|
+
const query123_qE = `${query123} AND ${this.qExpression}`;
|
|
81
|
+
const q_status_qE = `${q_status} AND ${this.qExpression}`;
|
|
82
|
+
const q_chartC_qE = `${q_chartC} AND ${this.qExpression}`;
|
|
83
|
+
const q_status_chartC_qE = `${q_status_chartC} AND ${this.qExpression}`;
|
|
84
|
+
const query1_chartC_qE = `${query1_chartC} AND ${this.qExpression}`;
|
|
85
|
+
const query12_chartC_qE = `${query12_chartC} AND ${this.qExpression}`;
|
|
86
|
+
const query123_chartC_qE = `${query123_chartC} AND ${this.qExpression}`;
|
|
87
|
+
const query1_status_qE = `${query1_status} AND ${this.qExpression}`;
|
|
88
|
+
const query12_status_qE = `${query12_status} AND ${this.qExpression}`;
|
|
89
|
+
const query123_status_qE = `${query123_status} AND ${this.qExpression}`;
|
|
90
|
+
const query1_status_chartC_qE = `${query1_status_chartC} AND ${this.qExpression}`;
|
|
91
|
+
const query12_status_chartC_qE = `${query12_status_chartC} AND ${this.qExpression}`;
|
|
92
|
+
const query123_status_chartC_qE = `${query123_status_chartC} AND ${this.qExpression}`;
|
|
95
93
|
|
|
96
94
|
let expression = "";
|
|
97
|
-
if (qExpression) {
|
|
98
|
-
if (chartCategoryField) {
|
|
99
|
-
if (statusField) {
|
|
100
|
-
if (!qValues?.[0] && !qValues?.[1] && !qValues?.[2]) {
|
|
95
|
+
if (this.qExpression) {
|
|
96
|
+
if (this.chartCategoryField) {
|
|
97
|
+
if (this.statusField) {
|
|
98
|
+
if (!this.qValues?.[0] && !this.qValues?.[1] && !this.qValues?.[2]) {
|
|
101
99
|
expression = q_status_chartC_qE;
|
|
102
|
-
} else if (
|
|
100
|
+
} else if (
|
|
101
|
+
this.qValues?.[0] &&
|
|
102
|
+
!this.qValues?.[1] &&
|
|
103
|
+
!this.qValues?.[2]
|
|
104
|
+
) {
|
|
103
105
|
expression = query1_status_chartC_qE;
|
|
104
|
-
} else if (
|
|
106
|
+
} else if (
|
|
107
|
+
this.qValues?.[0] &&
|
|
108
|
+
this.qValues?.[1] &&
|
|
109
|
+
!this.qValues?.[2]
|
|
110
|
+
) {
|
|
105
111
|
expression = query12_status_chartC_qE;
|
|
106
|
-
} else if (
|
|
112
|
+
} else if (
|
|
113
|
+
this.qValues?.[0] &&
|
|
114
|
+
this.qValues?.[1] &&
|
|
115
|
+
this.qValues?.[2]
|
|
116
|
+
) {
|
|
107
117
|
expression = query123_status_chartC_qE;
|
|
108
118
|
}
|
|
109
|
-
} else if (!statusField) {
|
|
110
|
-
if (!qValues?.[0] && !qValues?.[1] && !qValues?.[2]) {
|
|
119
|
+
} else if (!this.statusField) {
|
|
120
|
+
if (!this.qValues?.[0] && !this.qValues?.[1] && !this.qValues?.[2]) {
|
|
111
121
|
expression = q_chartC_qE;
|
|
112
|
-
} else if (
|
|
122
|
+
} else if (
|
|
123
|
+
this.qValues?.[0] &&
|
|
124
|
+
!this.qValues?.[1] &&
|
|
125
|
+
!this.qValues?.[2]
|
|
126
|
+
) {
|
|
113
127
|
expression = query1_chartC_qE;
|
|
114
|
-
} else if (
|
|
128
|
+
} else if (
|
|
129
|
+
this.qValues?.[0] &&
|
|
130
|
+
this.qValues?.[1] &&
|
|
131
|
+
!this.qValues?.[2]
|
|
132
|
+
) {
|
|
115
133
|
expression = query12_chartC_qE;
|
|
116
|
-
} else if (
|
|
134
|
+
} else if (
|
|
135
|
+
this.qValues?.[0] &&
|
|
136
|
+
this.qValues?.[1] &&
|
|
137
|
+
this.qValues?.[2]
|
|
138
|
+
) {
|
|
117
139
|
expression = query123_chartC_qE;
|
|
118
140
|
}
|
|
119
141
|
}
|
|
120
|
-
} else if (!chartCategoryField) {
|
|
121
|
-
if (statusField) {
|
|
122
|
-
if (!qValues?.[0] && !qValues?.[1] && !qValues?.[2]) {
|
|
142
|
+
} else if (!this.chartCategoryField) {
|
|
143
|
+
if (this.statusField) {
|
|
144
|
+
if (!this.qValues?.[0] && !this.qValues?.[1] && !this.qValues?.[2]) {
|
|
123
145
|
expression = q_status_qE;
|
|
124
|
-
} else if (
|
|
146
|
+
} else if (
|
|
147
|
+
this.qValues?.[0] &&
|
|
148
|
+
!this.qValues?.[1] &&
|
|
149
|
+
!this.qValues?.[2]
|
|
150
|
+
) {
|
|
125
151
|
expression = query1_status_qE;
|
|
126
|
-
} else if (
|
|
152
|
+
} else if (
|
|
153
|
+
this.qValues?.[0] &&
|
|
154
|
+
this.qValues?.[1] &&
|
|
155
|
+
!this.qValues?.[2]
|
|
156
|
+
) {
|
|
127
157
|
expression = query12_status_qE;
|
|
128
|
-
} else if (
|
|
158
|
+
} else if (
|
|
159
|
+
this.qValues?.[0] &&
|
|
160
|
+
this.qValues?.[1] &&
|
|
161
|
+
this.qValues?.[2]
|
|
162
|
+
) {
|
|
129
163
|
expression = query123_status_qE;
|
|
130
164
|
}
|
|
131
|
-
} else if (!statusField) {
|
|
132
|
-
if (!qValues?.[0] && !qValues?.[1] && !qValues?.[2]) {
|
|
133
|
-
expression = qExpression;
|
|
134
|
-
} else if (
|
|
165
|
+
} else if (!this.statusField) {
|
|
166
|
+
if (!this.qValues?.[0] && !this.qValues?.[1] && !this.qValues?.[2]) {
|
|
167
|
+
expression = this.qExpression;
|
|
168
|
+
} else if (
|
|
169
|
+
this.qValues?.[0] &&
|
|
170
|
+
!this.qValues?.[1] &&
|
|
171
|
+
!this.qValues?.[2]
|
|
172
|
+
) {
|
|
135
173
|
expression = query1_qE;
|
|
136
|
-
} else if (
|
|
174
|
+
} else if (
|
|
175
|
+
this.qValues?.[0] &&
|
|
176
|
+
this.qValues?.[1] &&
|
|
177
|
+
!this.qValues?.[2]
|
|
178
|
+
) {
|
|
137
179
|
expression = query12_qE;
|
|
138
|
-
} else if (
|
|
180
|
+
} else if (
|
|
181
|
+
this.qValues?.[0] &&
|
|
182
|
+
this.qValues?.[1] &&
|
|
183
|
+
this.qValues?.[2]
|
|
184
|
+
) {
|
|
139
185
|
expression = query123_qE;
|
|
140
186
|
}
|
|
141
187
|
}
|
|
142
188
|
}
|
|
143
|
-
} else if (!qExpression) {
|
|
144
|
-
if (chartCategoryField) {
|
|
145
|
-
if (statusField) {
|
|
146
|
-
if (!qValues?.[0] && !qValues?.[1] && !qValues?.[2]) {
|
|
189
|
+
} else if (!this.qExpression) {
|
|
190
|
+
if (this.chartCategoryField) {
|
|
191
|
+
if (this.statusField) {
|
|
192
|
+
if (!this.qValues?.[0] && !this.qValues?.[1] && !this.qValues?.[2]) {
|
|
147
193
|
expression = q_status_chartC;
|
|
148
|
-
} else if (
|
|
194
|
+
} else if (
|
|
195
|
+
this.qValues?.[0] &&
|
|
196
|
+
!this.qValues?.[1] &&
|
|
197
|
+
!this.qValues?.[2]
|
|
198
|
+
) {
|
|
149
199
|
expression = query1_status_chartC;
|
|
150
|
-
} else if (
|
|
200
|
+
} else if (
|
|
201
|
+
this.qValues?.[0] &&
|
|
202
|
+
this.qValues?.[1] &&
|
|
203
|
+
!this.qValues?.[2]
|
|
204
|
+
) {
|
|
151
205
|
expression = query12_status_chartC;
|
|
152
|
-
} else if (
|
|
206
|
+
} else if (
|
|
207
|
+
this.qValues?.[0] &&
|
|
208
|
+
this.qValues?.[1] &&
|
|
209
|
+
this.qValues?.[2]
|
|
210
|
+
) {
|
|
153
211
|
expression = query123_status_chartC;
|
|
154
212
|
}
|
|
155
|
-
} else if (!statusField) {
|
|
156
|
-
if (!qValues?.[0] && !qValues?.[1] && !qValues?.[2]) {
|
|
213
|
+
} else if (!this.statusField) {
|
|
214
|
+
if (!this.qValues?.[0] && !this.qValues?.[1] && !this.qValues?.[2]) {
|
|
157
215
|
expression = q_chartC;
|
|
158
|
-
} else if (
|
|
216
|
+
} else if (
|
|
217
|
+
this.qValues?.[0] &&
|
|
218
|
+
!this.qValues?.[1] &&
|
|
219
|
+
!this.qValues?.[2]
|
|
220
|
+
) {
|
|
159
221
|
expression = query1_chartC;
|
|
160
|
-
} else if (
|
|
222
|
+
} else if (
|
|
223
|
+
this.qValues?.[0] &&
|
|
224
|
+
this.qValues?.[1] &&
|
|
225
|
+
!this.qValues?.[2]
|
|
226
|
+
) {
|
|
161
227
|
expression = query12_chartC;
|
|
162
|
-
} else if (
|
|
228
|
+
} else if (
|
|
229
|
+
this.qValues?.[0] &&
|
|
230
|
+
this.qValues?.[1] &&
|
|
231
|
+
this.qValues?.[2]
|
|
232
|
+
) {
|
|
163
233
|
expression = query123_chartC;
|
|
164
234
|
}
|
|
165
235
|
}
|
|
166
|
-
} else if (!chartCategoryField) {
|
|
167
|
-
if (statusField) {
|
|
168
|
-
if (!qValues?.[0] && !qValues?.[1] && !qValues?.[2]) {
|
|
236
|
+
} else if (!this.chartCategoryField) {
|
|
237
|
+
if (this.statusField) {
|
|
238
|
+
if (!this.qValues?.[0] && !this.qValues?.[1] && !this.qValues?.[2]) {
|
|
169
239
|
expression = q_status;
|
|
170
|
-
} else if (
|
|
240
|
+
} else if (
|
|
241
|
+
this.qValues?.[0] &&
|
|
242
|
+
!this.qValues?.[1] &&
|
|
243
|
+
!this.qValues?.[2]
|
|
244
|
+
) {
|
|
171
245
|
expression = query1_status;
|
|
172
|
-
} else if (
|
|
246
|
+
} else if (
|
|
247
|
+
this.qValues?.[0] &&
|
|
248
|
+
this.qValues?.[1] &&
|
|
249
|
+
!this.qValues?.[2]
|
|
250
|
+
) {
|
|
173
251
|
expression = query12_status;
|
|
174
|
-
} else if (
|
|
252
|
+
} else if (
|
|
253
|
+
this.qValues?.[0] &&
|
|
254
|
+
this.qValues?.[1] &&
|
|
255
|
+
this.qValues?.[2]
|
|
256
|
+
) {
|
|
175
257
|
expression = query123_status;
|
|
176
258
|
}
|
|
177
|
-
} else if (!statusField) {
|
|
178
|
-
if (!qValues?.[0] && !qValues?.[1] && !qValues?.[2]) {
|
|
259
|
+
} else if (!this.statusField) {
|
|
260
|
+
if (!this.qValues?.[0] && !this.qValues?.[1] && !this.qValues?.[2]) {
|
|
179
261
|
expression = "1=1";
|
|
180
|
-
} else if (
|
|
262
|
+
} else if (
|
|
263
|
+
this.qValues?.[0] &&
|
|
264
|
+
!this.qValues?.[1] &&
|
|
265
|
+
!this.qValues?.[2]
|
|
266
|
+
) {
|
|
181
267
|
expression = query1;
|
|
182
|
-
} else if (
|
|
268
|
+
} else if (
|
|
269
|
+
this.qValues?.[0] &&
|
|
270
|
+
this.qValues?.[1] &&
|
|
271
|
+
!this.qValues?.[2]
|
|
272
|
+
) {
|
|
183
273
|
expression = query12;
|
|
184
|
-
} else if (
|
|
274
|
+
} else if (
|
|
275
|
+
this.qValues?.[0] &&
|
|
276
|
+
this.qValues?.[1] &&
|
|
277
|
+
this.qValues?.[2]
|
|
278
|
+
) {
|
|
185
279
|
expression = query123;
|
|
186
280
|
}
|
|
187
281
|
}
|