query-layers-expression 1.0.8 → 1.0.9

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