query-layers-expression 1.0.6 → 1.0.7

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 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: ({ qValues, qFields, chartCategory, chartCategoryField, status, statusField, qExpression, }: queryExpressionType) => string;
20
+ constructor(qValues: any, qFields: any, chartCategory: any, chartCategoryField: any, chartCategoryType: "number" | "string", status: number, statusField: any, qExpression: any);
21
+ queryExpression: ({ qValues, qFields, chartCategory, chartCategoryField, chartCategoryType, status, statusField, qExpression, }: queryExpressionType) => string;
20
22
  }
21
23
  export default QueryExpressionLayers;
package/build/index.js CHANGED
@@ -1,10 +1,10 @@
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 = ({ qValues, qFields, chartCategory, chartCategoryField, status, statusField, qExpression, }) => {
7
+ this.queryExpression = ({ qValues, qFields, chartCategory, chartCategoryField, chartCategoryType, status, statusField, qExpression, }) => {
8
8
  //--- Basic query expression
9
9
  const query1 = typeof qValues?.[0] === "number"
10
10
  ? `${qFields?.[0]} = ${qValues?.[0]}`
@@ -18,7 +18,9 @@ class QueryExpressionLayers {
18
18
  const query12 = `${query1} AND ${query2}`;
19
19
  const query123 = `${query1} AND ${query2} AND ${query3}`;
20
20
  const q_status = `${statusField} = ${status}`;
21
- const q_chartC = `${chartCategoryField} = '${chartCategory}'`;
21
+ const q_chartC = chartCategoryType === "string"
22
+ ? `${chartCategoryField} = '${chartCategory}'`
23
+ : `${chartCategoryField} = ${chartCategory}`;
22
24
  const q_status_chartC = `${q_status} AND ${q_chartC}`;
23
25
  const query1_chartC = `${query1} AND ${q_chartC}`;
24
26
  const query12_chartC = `${query12} AND ${q_chartC}`;
@@ -176,6 +178,7 @@ class QueryExpressionLayers {
176
178
  this.qFields = qFields;
177
179
  this.chartCategory = chartCategory;
178
180
  this.chartCategoryField = chartCategoryField;
181
+ this.chartCategoryType = chartCategoryType;
179
182
  this.status = status;
180
183
  this.statusField = statusField;
181
184
  this.qExpression = qExpression;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "query-layers-expression",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "",
5
5
  "license": "ISC",
6
6
  "author": "Eiji Matsuzaki",
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;
@@ -44,6 +46,7 @@ class QueryExpressionLayers implements queryExpressionType {
44
46
  qFields,
45
47
  chartCategory,
46
48
  chartCategoryField,
49
+ chartCategoryType,
47
50
  status,
48
51
  statusField,
49
52
  qExpression,
@@ -64,7 +67,10 @@ class QueryExpressionLayers implements queryExpressionType {
64
67
  const query12 = `${query1} AND ${query2}`;
65
68
  const query123 = `${query1} AND ${query2} AND ${query3}`;
66
69
  const q_status = `${statusField} = ${status}`;
67
- const q_chartC = `${chartCategoryField} = '${chartCategory}'`;
70
+ const q_chartC =
71
+ chartCategoryType === "string"
72
+ ? `${chartCategoryField} = '${chartCategory}'`
73
+ : `${chartCategoryField} = ${chartCategory}`;
68
74
  const q_status_chartC = `${q_status} AND ${q_chartC}`;
69
75
  const query1_chartC = `${query1} AND ${q_chartC}`;
70
76
  const query12_chartC = `${query12} AND ${q_chartC}`;