@arcgis/common-components 4.29.0-beta.46 → 4.29.0-beta.48
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/dist/arcgis-common-components/arcgis-common-components.esm.js +1 -1
- package/dist/arcgis-common-components/p-6c7d2684.js +1 -0
- package/dist/arcgis-common-components/p-7318a1d1.entry.js +1 -0
- package/dist/arcgis-common-components/p-77e17376.entry.js +1 -0
- package/dist/arcgis-common-components/p-a91ab432.js +2 -0
- package/dist/cjs/arcgis-common-components.cjs.js +3 -3
- package/dist/cjs/arcgis-field-info.cjs.entry.js +902 -903
- package/dist/cjs/arcgis-field-pick-list.cjs.entry.js +228 -229
- package/dist/cjs/{index-2e4fbd31.js → index-5ec7f592.js} +5 -20
- package/dist/cjs/{index-ab5f2576.js → index-e0422bc8.js} +72 -77
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/components/arcgis-field-info.d.ts +2 -2
- package/dist/components/arcgis-field-pick-list.d.ts +2 -2
- package/dist/components/arcgis-field-pick-list.js +271 -272
- package/dist/components/field-info.js +955 -900
- package/dist/esm/arcgis-common-components.js +4 -4
- package/dist/esm/arcgis-field-info.entry.js +902 -903
- package/dist/esm/arcgis-field-pick-list.entry.js +228 -229
- package/dist/esm/{index-74897166.js → index-0c129ec4.js} +73 -78
- package/dist/esm/index-ba4fe890.js +59 -0
- package/dist/esm/loader.js +3 -3
- package/dist/types/components/field-info/field-info.d.ts +61 -61
- package/dist/types/components/field-info/t9n-types.d.ts +72 -72
- package/dist/types/components/field-info/utils/basic.d.ts +24 -24
- package/dist/types/components/field-info/utils/field.d.ts +1 -1
- package/dist/types/components/field-pick-list/field-pick-list.d.ts +115 -115
- package/dist/types/components/field-pick-list/t9n-types.d.ts +15 -15
- package/dist/types/components/field-pick-list/utils/types.d.ts +14 -14
- package/dist/types/components.d.ts +0 -86
- package/dist/types/stencil-public-runtime.d.ts +8 -0
- package/package.json +7 -7
- package/dist/arcgis-common-components/p-0be8fd4c.entry.js +0 -1
- package/dist/arcgis-common-components/p-164eb24e.entry.js +0 -1
- package/dist/arcgis-common-components/p-5ecf6396.js +0 -1
- package/dist/arcgis-common-components/p-97c7ac8d.entry.js +0 -1
- package/dist/arcgis-common-components/p-b23318c8.js +0 -1
- package/dist/arcgis-common-components/p-d66b011b.entry.js +0 -1
- package/dist/arcgis-common-components/p-f27af39c.js +0 -2
- package/dist/cjs/arcgis-api-key.cjs.entry.js +0 -51
- package/dist/cjs/arcgis-identity.cjs.entry.js +0 -139
- package/dist/cjs/index-f8bf4df6.js +0 -7
- package/dist/components/arcgis-api-key.d.ts +0 -11
- package/dist/components/arcgis-api-key.js +0 -69
- package/dist/components/arcgis-identity.d.ts +0 -11
- package/dist/components/arcgis-identity.js +0 -167
- package/dist/components/index2.js +0 -75
- package/dist/esm/arcgis-api-key.entry.js +0 -47
- package/dist/esm/arcgis-identity.entry.js +0 -135
- package/dist/esm/index-3d9bb67e.js +0 -75
- package/dist/esm/index-e7244815.js +0 -3
- package/dist/types/components/api-key/api-key.d.ts +0 -9
- package/dist/types/components/identity/identity.d.ts +0 -31
- package/dist/types/components/types.d.ts +0 -10
|
@@ -2,35 +2,34 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
6
|
-
const index$
|
|
7
|
-
const index$1 = require('./index-f8bf4df6.js');
|
|
5
|
+
const index = require('./index-e0422bc8.js');
|
|
6
|
+
const index$1 = require('./index-5ec7f592.js');
|
|
8
7
|
|
|
9
8
|
var Status;
|
|
10
9
|
(function (Status) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
Status["MISSING"] = "missing";
|
|
11
|
+
Status["IN_PROGRESS"] = "inProgress";
|
|
12
|
+
Status["SUCCESS"] = "success";
|
|
13
|
+
Status["FAILED"] = "failed";
|
|
15
14
|
})(Status || (Status = {}));
|
|
16
15
|
var SimpleFieldTypes;
|
|
17
16
|
(function (SimpleFieldTypes) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
17
|
+
SimpleFieldTypes["NUMBER"] = "number";
|
|
18
|
+
SimpleFieldTypes["STRING"] = "string";
|
|
19
|
+
SimpleFieldTypes["DATE"] = "date";
|
|
20
|
+
SimpleFieldTypes["DATE_ONLY"] = "date-only";
|
|
21
|
+
SimpleFieldTypes["TIME_ONLY"] = "time-only";
|
|
22
|
+
SimpleFieldTypes["TIMESTAMP_OFFSET"] = "timestamp-offset";
|
|
23
|
+
SimpleFieldTypes["OID"] = "oid";
|
|
24
|
+
SimpleFieldTypes["GUID"] = "guid";
|
|
25
|
+
SimpleFieldTypes["UNKNOWN"] = "unknown";
|
|
27
26
|
})(SimpleFieldTypes || (SimpleFieldTypes = {}));
|
|
28
27
|
/**
|
|
29
28
|
* Returns true if the value is defined
|
|
30
29
|
* @param value - value to check
|
|
31
30
|
*/
|
|
32
31
|
function isDefined(value) {
|
|
33
|
-
|
|
32
|
+
return value !== undefined && value !== null;
|
|
34
33
|
}
|
|
35
34
|
/**
|
|
36
35
|
* Returns the URL used for queries.
|
|
@@ -38,10 +37,10 @@ function isDefined(value) {
|
|
|
38
37
|
* @param value - value to check
|
|
39
38
|
*/
|
|
40
39
|
function getQueryURL(layer) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
if (layer.type === "scene") {
|
|
41
|
+
return layer.associatedLayer?.url;
|
|
42
|
+
}
|
|
43
|
+
return layer.url;
|
|
45
44
|
}
|
|
46
45
|
|
|
47
46
|
/**
|
|
@@ -49,231 +48,231 @@ function getQueryURL(layer) {
|
|
|
49
48
|
* @param props - properties containing layer and fieldName
|
|
50
49
|
*/
|
|
51
50
|
function getFieldInfo(props) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
51
|
+
const { layer, fieldName } = props;
|
|
52
|
+
let fieldInfo = undefined;
|
|
53
|
+
const { popupTemplate } = layer;
|
|
54
|
+
const popupFieldInfos = popupTemplate ? popupTemplate.fieldInfos : [];
|
|
55
|
+
(layer.type === "imagery-tile"
|
|
56
|
+
? layer.rasterFields
|
|
57
|
+
: layer.type === "imagery" && layer.rasterFields?.length
|
|
58
|
+
? layer.rasterFields
|
|
59
|
+
: layer.fields)
|
|
60
|
+
.filter((layerField) => layerField.name === fieldName)
|
|
61
|
+
.forEach((layerField) => {
|
|
62
|
+
const list = popupFieldInfos
|
|
63
|
+
? popupFieldInfos.filter((fInfo) => fInfo.fieldName === layerField.name)
|
|
64
|
+
: null;
|
|
65
|
+
const label = list?.length ? list[0].label : null;
|
|
66
|
+
if (/^raster.(item|service)pixelvalue/i.test(fieldName)) {
|
|
67
|
+
// e.g. "Raster.ServicePixelValue" | "Raster.ItemPixelValue" | "Raster.ServicePixelValue.Raw"
|
|
68
|
+
// layer.rasterFields reports them as type "string"
|
|
69
|
+
layerField.type = "double";
|
|
70
|
+
}
|
|
71
|
+
const featureFilterField = {
|
|
72
|
+
layerField: layerField,
|
|
73
|
+
label: label || layerField.alias || layerField.name
|
|
74
|
+
};
|
|
75
|
+
featureFilterField.codedValues = getCodedValues(fieldName, props);
|
|
76
|
+
_getSimpleFieldType(featureFilterField);
|
|
77
|
+
if (featureFilterField.simpleFieldType) {
|
|
78
|
+
fieldInfo = featureFilterField;
|
|
79
|
+
} // else can't use field
|
|
80
|
+
});
|
|
81
|
+
return fieldInfo;
|
|
83
82
|
}
|
|
84
83
|
/**
|
|
85
84
|
* Returns feature count in layer
|
|
86
85
|
* @param props - properties containing layer and fieldName
|
|
87
86
|
*/
|
|
88
87
|
async function getFeatureCount(props) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
88
|
+
props.statisticsStatus = Status.IN_PROGRESS;
|
|
89
|
+
const { layer, view } = props;
|
|
90
|
+
if (layer.type === "imagery" || layer.type === "imagery-tile" || layer.type === "stream") {
|
|
91
|
+
throw new Error("could not get feature count");
|
|
92
|
+
}
|
|
93
|
+
try {
|
|
94
|
+
return await getFeatureCountCommon(layer, view);
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
100
99
|
}
|
|
101
100
|
/**
|
|
102
101
|
* Returns summary statistics
|
|
103
102
|
* @param props - properties containing layer and fieldName
|
|
104
103
|
*/
|
|
105
104
|
async function getStatistics(props) {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
105
|
+
const { layer, view, fieldName, fieldInfo, modules } = props;
|
|
106
|
+
if (layer.type === "imagery" || layer.type === "imagery-tile") {
|
|
107
|
+
throw new Error("could not get statistics for ImageryLayer/ImageryTileLayer");
|
|
108
|
+
}
|
|
109
|
+
if (!fieldInfo ||
|
|
110
|
+
fieldInfo.layerField.type === "oid" ||
|
|
111
|
+
fieldInfo.layerField.type === "guid" ||
|
|
112
|
+
fieldInfo.layerField.type === "global-id") {
|
|
113
|
+
const count = await getFeatureCount(props);
|
|
114
|
+
return Promise.resolve({ totalCount: count, nullcount: 0 } /*StatisticsResult*/);
|
|
115
|
+
}
|
|
116
|
+
try {
|
|
117
|
+
const result = await modules.summaryStatistics({
|
|
118
|
+
layer,
|
|
119
|
+
view,
|
|
120
|
+
field: fieldName
|
|
121
|
+
});
|
|
122
|
+
if (!isDefined(result.count)) {
|
|
123
|
+
// statistics is unusable
|
|
124
|
+
throw new Error("could not get statistics");
|
|
125
|
+
}
|
|
126
|
+
// if we hit maxRecordCount other stats values are probably not correct either
|
|
127
|
+
const hitMaxRecordCount = "sourceJSON" in layer && layer.sourceJSON.maxRecordCount === result.count;
|
|
128
|
+
// count only contains features with a value (!= null)
|
|
129
|
+
if (isDefined(result.nullcount) && !hitMaxRecordCount) {
|
|
130
|
+
// we can add the feature count without null and the count of nulls
|
|
131
|
+
const stats /*StatisticsResult*/ = { ...result, totalCount: result.count + result.nullcount };
|
|
132
|
+
return stats;
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
// we want the total feature count
|
|
136
|
+
// happens e.g. for SceneLayers with older stats cache
|
|
137
|
+
const count = await getFeatureCount(props);
|
|
138
|
+
const stats = { ...result, totalCount: count };
|
|
139
|
+
return stats;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
catch (error) {
|
|
143
|
+
throw new Error("could not get statistics");
|
|
134
144
|
}
|
|
135
|
-
else {
|
|
136
|
-
// we want the total feature count
|
|
137
|
-
// happens e.g. for SceneLayers with older stats cache
|
|
138
|
-
const count = await getFeatureCount(props);
|
|
139
|
-
const stats = { ...result, totalCount: count };
|
|
140
|
-
return stats;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
catch (error) {
|
|
144
|
-
throw new Error("could not get statistics");
|
|
145
|
-
}
|
|
146
145
|
}
|
|
147
146
|
/**
|
|
148
147
|
* Returns unique values
|
|
149
148
|
* @param props - properties containing layer and fieldName
|
|
150
149
|
*/
|
|
151
150
|
async function getUniqueValues(props) {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
151
|
+
const { layer, view, fieldName, modules } = props;
|
|
152
|
+
if (layer.type === "imagery" || layer.type === "imagery-tile") {
|
|
153
|
+
throw new Error("could not get unique values for ImageryLayer/ImageryTileLayer");
|
|
154
|
+
}
|
|
155
|
+
if (layer.type === "feature" && !layer.url) {
|
|
156
|
+
layer.outFields = ["*"];
|
|
157
|
+
}
|
|
158
|
+
try {
|
|
159
|
+
const result = await modules.uniqueValues({
|
|
160
|
+
layer,
|
|
161
|
+
view,
|
|
162
|
+
field: fieldName
|
|
163
|
+
});
|
|
164
|
+
return result;
|
|
165
|
+
}
|
|
166
|
+
catch (error) {
|
|
167
|
+
throw new Error("could not get unique values");
|
|
168
|
+
}
|
|
170
169
|
}
|
|
171
170
|
function _getSimpleFieldType(featureFilterField) {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
171
|
+
switch (featureFilterField.layerField.type) {
|
|
172
|
+
case "string":
|
|
173
|
+
featureFilterField.simpleFieldType = SimpleFieldTypes.STRING;
|
|
174
|
+
break;
|
|
175
|
+
case "date":
|
|
176
|
+
featureFilterField.simpleFieldType = SimpleFieldTypes.DATE;
|
|
177
|
+
break;
|
|
178
|
+
case "timestamp-offset":
|
|
179
|
+
featureFilterField.simpleFieldType = SimpleFieldTypes.TIMESTAMP_OFFSET;
|
|
180
|
+
break;
|
|
181
|
+
case "date-only":
|
|
182
|
+
featureFilterField.simpleFieldType = SimpleFieldTypes.DATE_ONLY;
|
|
183
|
+
break;
|
|
184
|
+
case "time-only":
|
|
185
|
+
featureFilterField.simpleFieldType = SimpleFieldTypes.TIME_ONLY;
|
|
186
|
+
break;
|
|
187
|
+
case "oid":
|
|
188
|
+
featureFilterField.simpleFieldType = SimpleFieldTypes.OID;
|
|
189
|
+
break;
|
|
190
|
+
case "guid":
|
|
191
|
+
case "global-id":
|
|
192
|
+
featureFilterField.simpleFieldType = SimpleFieldTypes.GUID;
|
|
193
|
+
break;
|
|
194
|
+
case "small-integer":
|
|
195
|
+
case "big-integer":
|
|
196
|
+
case "integer":
|
|
197
|
+
case "single":
|
|
198
|
+
case "double":
|
|
199
|
+
case "long":
|
|
200
|
+
featureFilterField.simpleFieldType = SimpleFieldTypes.NUMBER;
|
|
201
|
+
break;
|
|
202
|
+
}
|
|
204
203
|
}
|
|
205
204
|
function getCodedValues(fieldName, props) {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
else {
|
|
228
|
-
// field does not have types; look farther inside the types
|
|
229
|
-
fieldDomains = [];
|
|
230
|
-
types.forEach((type) => {
|
|
231
|
-
if (!type.domains || !type.domains[fieldName] || type.domains[fieldName].type === "inherited") {
|
|
232
|
-
const domain = fieldDomain;
|
|
233
|
-
if (domain?.codedValues) {
|
|
234
|
-
domain.codedValues.forEach(async (codedValue) => {
|
|
235
|
-
let found = false;
|
|
236
|
-
fieldDomains.forEach((codedVal) => {
|
|
237
|
-
if (codedVal.code === codedValue.code) {
|
|
238
|
-
found = true;
|
|
239
|
-
if (`, ${codedVal.name},`.indexOf(`, ${codedValue.name},`) === -1) {
|
|
240
|
-
codedVal.name += `, ${codedValue.name}`;
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
});
|
|
244
|
-
if (!found) {
|
|
245
|
-
fieldDomains.push(modules.esriLang.clone(codedValue));
|
|
246
|
-
}
|
|
205
|
+
const { layer, modules } = props;
|
|
206
|
+
if (layer.type !== "feature") {
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
const typeIdField = layer.typeIdField;
|
|
210
|
+
const types = layer.types;
|
|
211
|
+
let fieldDomains = undefined;
|
|
212
|
+
const field = layer.fields.find((field) => field.name === fieldName);
|
|
213
|
+
const fieldDomain = field.domain;
|
|
214
|
+
if (typeIdField && types) {
|
|
215
|
+
// layer has types
|
|
216
|
+
if (typeIdField === fieldName) {
|
|
217
|
+
// this is the field with the types
|
|
218
|
+
fieldDomains = types.map((type) => {
|
|
219
|
+
// fake coded Values
|
|
220
|
+
return {
|
|
221
|
+
code: type.id,
|
|
222
|
+
name: type.name
|
|
223
|
+
};
|
|
247
224
|
});
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
// field does not have types; look farther inside the types
|
|
228
|
+
fieldDomains = [];
|
|
229
|
+
types.forEach((type) => {
|
|
230
|
+
if (!type.domains || !type.domains[fieldName] || type.domains[fieldName].type === "inherited") {
|
|
231
|
+
const domain = fieldDomain;
|
|
232
|
+
if (domain?.codedValues) {
|
|
233
|
+
domain.codedValues.forEach(async (codedValue) => {
|
|
234
|
+
let found = false;
|
|
235
|
+
fieldDomains.forEach((codedVal) => {
|
|
236
|
+
if (codedVal.code === codedValue.code) {
|
|
237
|
+
found = true;
|
|
238
|
+
if (`, ${codedVal.name},`.indexOf(`, ${codedValue.name},`) === -1) {
|
|
239
|
+
codedVal.name += `, ${codedValue.name}`;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
if (!found) {
|
|
244
|
+
fieldDomains.push(modules.esriLang.clone(codedValue));
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
else if (type.domains?.[fieldName]?.codedValues) {
|
|
250
|
+
type.domains[fieldName].codedValues.forEach(async (codedValue) => {
|
|
251
|
+
let found = false;
|
|
252
|
+
fieldDomains.forEach((codedVal) => {
|
|
253
|
+
if (codedVal.code === codedValue.code) {
|
|
254
|
+
found = true;
|
|
255
|
+
if (`, ${codedVal.name},`.indexOf(`, ${codedValue.name},`) === -1) {
|
|
256
|
+
codedVal.name += `, ${codedValue.name}`;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
if (!found) {
|
|
261
|
+
fieldDomains.push(modules.esriLang.clone(codedValue));
|
|
262
|
+
}
|
|
263
|
+
});
|
|
258
264
|
}
|
|
259
|
-
}
|
|
260
265
|
});
|
|
261
|
-
if (!found) {
|
|
262
|
-
fieldDomains.push(modules.esriLang.clone(codedValue));
|
|
263
|
-
}
|
|
264
|
-
});
|
|
265
266
|
}
|
|
266
|
-
|
|
267
|
+
if (!fieldDomains?.length && fieldDomain?.codedValues) {
|
|
268
|
+
fieldDomains = modules.esriLang.clone(fieldDomain.codedValues);
|
|
269
|
+
}
|
|
267
270
|
}
|
|
268
|
-
if (
|
|
269
|
-
|
|
271
|
+
else if (fieldDomain?.codedValues) {
|
|
272
|
+
// domains directly on the layer field
|
|
273
|
+
fieldDomains = field.domain.codedValues;
|
|
270
274
|
}
|
|
271
|
-
|
|
272
|
-
else if (fieldDomain?.codedValues) {
|
|
273
|
-
// domains directly on the layer field
|
|
274
|
-
fieldDomains = field.domain.codedValues;
|
|
275
|
-
}
|
|
276
|
-
return fieldDomains?.length ? fieldDomains : null;
|
|
275
|
+
return fieldDomains?.length ? fieldDomains : null;
|
|
277
276
|
}
|
|
278
277
|
|
|
279
278
|
/**
|
|
@@ -281,66 +280,66 @@ function getCodedValues(fieldName, props) {
|
|
|
281
280
|
* @param props - properties containing layer and view
|
|
282
281
|
*/
|
|
283
282
|
async function getOneFeature(props) {
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
}
|
|
302
|
-
else {
|
|
303
|
-
// service
|
|
304
|
-
if (!view) {
|
|
305
|
-
// get feature from service directly
|
|
306
|
-
return _queryOneFeature(props);
|
|
307
|
-
}
|
|
308
|
-
const layerView = (await view.whenLayerView(layer));
|
|
309
|
-
const hasAllFields = layerView.availableFields.length === layer.fields.length;
|
|
310
|
-
if (hasAllFields || (["stream", "ogc-feature"].indexOf(layer.type) > -1 && layerView.availableFields.length > 0)) {
|
|
311
|
-
// features on client have all fields
|
|
312
|
-
// or we can't make a server query, so we take what we can get
|
|
313
|
-
const query = layer.createQuery();
|
|
314
|
-
query.start = 0;
|
|
315
|
-
query.num = 5;
|
|
316
|
-
query.outFields = ["*"];
|
|
317
|
-
const result = await layerView.queryFeatures(query);
|
|
318
|
-
if (result.features?.length) {
|
|
319
|
-
// client side features
|
|
320
|
-
return result;
|
|
321
|
-
}
|
|
322
|
-
else {
|
|
323
|
-
// get feature from service
|
|
324
|
-
return _queryOneFeature(props);
|
|
325
|
-
}
|
|
283
|
+
const { view, layer } = props;
|
|
284
|
+
if (layer.type === "imagery" || layer.type === "imagery-tile") {
|
|
285
|
+
throw new Error("could not get feature");
|
|
286
|
+
}
|
|
287
|
+
if ((layer.type === "feature" && !layer.url) || layer.type === "wfs") {
|
|
288
|
+
// feature collection or wfs
|
|
289
|
+
const query = layer.createQuery();
|
|
290
|
+
query.start = 0;
|
|
291
|
+
query.num = 5;
|
|
292
|
+
query.outFields = ["*"];
|
|
293
|
+
const result = await layer.queryFeatures(query);
|
|
294
|
+
if (result.features?.length) {
|
|
295
|
+
return result;
|
|
296
|
+
}
|
|
297
|
+
else {
|
|
298
|
+
throw new Error("could not get feature");
|
|
299
|
+
}
|
|
326
300
|
}
|
|
327
301
|
else {
|
|
328
|
-
|
|
329
|
-
|
|
302
|
+
// service
|
|
303
|
+
if (!view) {
|
|
304
|
+
// get feature from service directly
|
|
305
|
+
return _queryOneFeature(props);
|
|
306
|
+
}
|
|
307
|
+
const layerView = (await view.whenLayerView(layer));
|
|
308
|
+
const hasAllFields = layerView.availableFields.length === layer.fields.length;
|
|
309
|
+
if (hasAllFields || (["stream", "ogc-feature"].indexOf(layer.type) > -1 && layerView.availableFields.length > 0)) {
|
|
310
|
+
// features on client have all fields
|
|
311
|
+
// or we can't make a server query, so we take what we can get
|
|
312
|
+
const query = layer.createQuery();
|
|
313
|
+
query.start = 0;
|
|
314
|
+
query.num = 5;
|
|
315
|
+
query.outFields = ["*"];
|
|
316
|
+
const result = await layerView.queryFeatures(query);
|
|
317
|
+
if (result.features?.length) {
|
|
318
|
+
// client side features
|
|
319
|
+
return result;
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
// get feature from service
|
|
323
|
+
return _queryOneFeature(props);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
else {
|
|
327
|
+
// get feature from service
|
|
328
|
+
return _queryOneFeature(props);
|
|
329
|
+
}
|
|
330
330
|
}
|
|
331
|
-
}
|
|
332
331
|
}
|
|
333
332
|
async function _queryOneFeature(props) {
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
333
|
+
const { layer, modules } = props;
|
|
334
|
+
if (["imagery", "imagery-tile", "stream", "ogc-feature"].indexOf(layer.type) > -1) {
|
|
335
|
+
throw new Error("cannot get feature from service");
|
|
336
|
+
}
|
|
337
|
+
const query = new modules.Query({
|
|
338
|
+
where: "1=1",
|
|
339
|
+
outFields: ["*"],
|
|
340
|
+
returnGeometry: false
|
|
341
|
+
});
|
|
342
|
+
return layer.queryFeatures(query);
|
|
344
343
|
}
|
|
345
344
|
/**
|
|
346
345
|
* Returns feature count of layer
|
|
@@ -348,673 +347,673 @@ async function _queryOneFeature(props) {
|
|
|
348
347
|
* @param mapView - View
|
|
349
348
|
*/
|
|
350
349
|
async function getFeatureCountCommon(layer, view) {
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
350
|
+
if (layer.type === "feature" && !layer.url) {
|
|
351
|
+
return getFeatureCountForCollection(layer);
|
|
352
|
+
}
|
|
353
|
+
else if (layer.type === "feature" ||
|
|
354
|
+
layer.type === "csv" ||
|
|
355
|
+
layer.type === "scene" ||
|
|
356
|
+
layer.type === "wfs" ||
|
|
357
|
+
layer.type === "geojson") {
|
|
358
|
+
return await layer.queryFeatureCount();
|
|
359
|
+
}
|
|
360
|
+
else if (view && (layer.type === "stream" || layer.type === "ogc-feature")) {
|
|
361
|
+
return getFeatureCountFromView(layer, view);
|
|
362
|
+
}
|
|
363
|
+
return undefined;
|
|
365
364
|
}
|
|
366
365
|
/**
|
|
367
366
|
* Returns feature count of feature collection layer
|
|
368
367
|
* @param layer - FeatureLayer
|
|
369
368
|
*/
|
|
370
369
|
async function getFeatureCountForCollection(layer) {
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
370
|
+
const query = layer.createQuery();
|
|
371
|
+
query.outFields = ["*"];
|
|
372
|
+
const result = await layer.queryFeatures(query);
|
|
373
|
+
if (result.features?.length) {
|
|
374
|
+
return result.features.length;
|
|
375
|
+
}
|
|
376
|
+
else {
|
|
377
|
+
throw new Error("could not get feature count");
|
|
378
|
+
}
|
|
380
379
|
}
|
|
381
380
|
/**
|
|
382
381
|
* Returns feature count of feature collection layer
|
|
383
382
|
* @param layer - StreamLayer | OGCFeatureLayer
|
|
384
383
|
*/
|
|
385
384
|
async function getFeatureCountFromView(layer, view) {
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
385
|
+
// we can only get the features from the map
|
|
386
|
+
const layerView = (await view.whenLayerView(layer));
|
|
387
|
+
return layerView.queryFeatureCount();
|
|
389
388
|
}
|
|
390
389
|
|
|
391
390
|
const fieldInfoScss = ":host{height:100%}.container{padding:6px;background-color:white}.title{font-weight:bold;padding:5px 0}.missing{color:#a9a9a9}.data{color:#a9a9a9}.count{white-space:nowrap}.section{padding:6px 0}.statistics-row{border-top:1px solid #e0e0e0;padding:6px 0;display:flex;justify-content:space-between}.statistics-row-top-values{border-top:1px solid #e0e0e0;padding:20px 0 6px 0;display:flex;justify-content:space-between}";
|
|
392
391
|
|
|
393
392
|
const ArcgisFieldInfo = class {
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
393
|
+
constructor(hostRef) {
|
|
394
|
+
index.registerInstance(this, hostRef);
|
|
395
|
+
this.arcgisFieldInfoComplete = index.createEvent(this, "arcgisFieldInfoComplete", 7);
|
|
396
|
+
this.view = undefined;
|
|
397
|
+
this.layer = undefined;
|
|
398
|
+
this.fieldName = undefined;
|
|
399
|
+
this.hideStatistics = false;
|
|
400
|
+
this.oneFeatureResponse = undefined;
|
|
401
|
+
this.oneFeatureResponseStatus = Status.MISSING;
|
|
402
|
+
this.statistics = undefined;
|
|
403
|
+
this.statisticsStatus = Status.MISSING;
|
|
404
|
+
this.uniqueValues = undefined;
|
|
405
|
+
this.uniqueValuesStatus = Status.MISSING;
|
|
406
|
+
this._lang = "";
|
|
407
|
+
this._t9nLocale = "";
|
|
408
|
+
this._t9nStrings = undefined;
|
|
409
|
+
}
|
|
410
|
+
//--------------------------------------------------------------------------
|
|
411
|
+
//
|
|
412
|
+
// Lifecycle
|
|
413
|
+
//
|
|
414
|
+
//--------------------------------------------------------------------------
|
|
415
|
+
async componentWillLoad() {
|
|
416
|
+
await index$1.F(this, index.getAssetPath("./assets"));
|
|
417
|
+
const esriLang = await index$1.importCoreLang();
|
|
418
|
+
const esriConfig = await index$1.importConfig();
|
|
419
|
+
const intl = await index$1.importIntl();
|
|
420
|
+
const Query = await index$1.importRestSupportQuery();
|
|
421
|
+
const summaryStatistics = await index$1.importSmartMappingStatisticsSummaryStatistics();
|
|
422
|
+
const uniqueValues = await index$1.importSmartMappingStatisticsUniqueValues();
|
|
423
|
+
const { view, layer, fieldName, hideStatistics } = this;
|
|
424
|
+
let sublayerFL;
|
|
425
|
+
if (layer.declaredClass === "esri.layers.support.Sublayer") {
|
|
426
|
+
// need to create a FeatureLayer
|
|
427
|
+
const sublayer = layer;
|
|
428
|
+
const { whenOnce } = await index$1.importCoreReactiveUtils();
|
|
429
|
+
view && (await whenOnce(() => !view.updating));
|
|
430
|
+
sublayerFL = await sublayer.createFeatureLayer();
|
|
431
|
+
await sublayerFL.load();
|
|
432
|
+
}
|
|
433
|
+
this.props = {
|
|
434
|
+
view,
|
|
435
|
+
layer: sublayerFL || layer,
|
|
436
|
+
fieldName,
|
|
437
|
+
hideStatistics,
|
|
438
|
+
modules: { esriLang, esriConfig, intl, Query, summaryStatistics, uniqueValues }
|
|
439
|
+
};
|
|
440
|
+
// required for initial load
|
|
441
|
+
this.props.fieldInfo = getFieldInfo(this.props);
|
|
442
|
+
// we don't know if the SceneLayer has an associated FL
|
|
443
|
+
// don't prompt for a login if it's not accessible
|
|
444
|
+
if (layer.type === "scene") {
|
|
445
|
+
esriConfig.request.interceptors?.push({
|
|
446
|
+
urls: getQueryURL(layer) + "/" + layer.layerId,
|
|
447
|
+
before: function (params) {
|
|
448
|
+
params.requestOptions.authMode = "no-prompt";
|
|
449
|
+
}
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
this.oneFeatureResponseStatus = Status.IN_PROGRESS;
|
|
453
|
+
try {
|
|
454
|
+
const result = await getOneFeature(this.props);
|
|
455
|
+
this.oneFeatureResponse = result;
|
|
456
|
+
this.oneFeatureResponseStatus = Status.SUCCESS;
|
|
457
|
+
}
|
|
458
|
+
catch (error) {
|
|
459
|
+
this.oneFeatureResponseStatus = Status.FAILED;
|
|
460
|
+
}
|
|
461
|
+
if (layer.type === "stream") {
|
|
462
|
+
this.uniqueValuesStatus = Status.FAILED;
|
|
463
|
+
this.statisticsStatus = Status.FAILED;
|
|
464
|
+
return;
|
|
465
|
+
}
|
|
466
|
+
if (hideStatistics) {
|
|
467
|
+
this.uniqueValuesStatus = Status.FAILED;
|
|
468
|
+
}
|
|
469
|
+
else {
|
|
470
|
+
this.uniqueValuesStatus = Status.IN_PROGRESS;
|
|
471
|
+
try {
|
|
472
|
+
const uniqueValues = await getUniqueValues(this.props);
|
|
473
|
+
this.uniqueValues = uniqueValues;
|
|
474
|
+
if (uniqueValues?.uniqueValueInfos?.length) {
|
|
475
|
+
this.uniqueValuesStatus = Status.SUCCESS;
|
|
476
|
+
}
|
|
477
|
+
else {
|
|
478
|
+
this.uniqueValuesStatus = Status.FAILED;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
catch (error) {
|
|
482
|
+
this.uniqueValuesStatus = Status.FAILED;
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
if (hideStatistics) {
|
|
486
|
+
this.statisticsStatus = Status.FAILED;
|
|
487
|
+
}
|
|
488
|
+
else {
|
|
489
|
+
this.statisticsStatus = Status.IN_PROGRESS;
|
|
490
|
+
try {
|
|
491
|
+
const statistics = await getStatistics(this.props);
|
|
492
|
+
if (!isDefined(statistics.totalCount) &&
|
|
493
|
+
isDefined(statistics.count) &&
|
|
494
|
+
this.uniqueValuesStatus === Status.SUCCESS) {
|
|
495
|
+
// take null values count from unique values and add with non-null count from statistics
|
|
496
|
+
const infos = this.uniqueValues.uniqueValueInfos;
|
|
497
|
+
for (let i = 0; i < infos.length; i++) {
|
|
498
|
+
const info = infos[i];
|
|
499
|
+
if (info.value === null) {
|
|
500
|
+
statistics.totalCount = info.count + statistics.count;
|
|
501
|
+
break;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
if (!isDefined(statistics.totalCount)) {
|
|
505
|
+
// no null values
|
|
506
|
+
statistics.totalCount = statistics.count;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
this.statistics = statistics;
|
|
510
|
+
this.statisticsStatus = Status.SUCCESS;
|
|
511
|
+
}
|
|
512
|
+
catch (error) {
|
|
513
|
+
this.statisticsStatus = Status.FAILED;
|
|
514
|
+
}
|
|
450
515
|
}
|
|
451
|
-
});
|
|
452
516
|
}
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
517
|
+
async componentDidLoad() {
|
|
518
|
+
// once component is visible make other calls
|
|
519
|
+
const { props } = this;
|
|
520
|
+
const { modules } = props;
|
|
521
|
+
modules.intl.setLocale(this._lang);
|
|
522
|
+
// modules.intl.setLocale(this.locale) not returning the correct formatting for e.g. it-ch
|
|
523
|
+
}
|
|
524
|
+
disconnectedCallback() {
|
|
525
|
+
index$1.U(this);
|
|
526
|
+
}
|
|
527
|
+
// --------------------------------------------------------------------------
|
|
528
|
+
//
|
|
529
|
+
// Render Methods
|
|
530
|
+
//
|
|
531
|
+
//--------------------------------------------------------------------------
|
|
532
|
+
render() {
|
|
533
|
+
const { props } = this;
|
|
534
|
+
const { fieldInfo } = props;
|
|
535
|
+
if (!fieldInfo) {
|
|
536
|
+
return index.h(index.Fragment, null);
|
|
537
|
+
}
|
|
538
|
+
return (index.h(index.Host, null, index.h("div", { class: "container" }, this.renderFieldType(), this.renderFieldAlias(), this.renderFieldDescription(), this.renderFieldValueType(), this.renderFieldSampleValue(), this.renderFieldFormat(), this.renderFieldStatistics())));
|
|
539
|
+
}
|
|
540
|
+
renderFieldType() {
|
|
541
|
+
const { _t9nStrings, props } = this;
|
|
542
|
+
const { fieldInfo } = props;
|
|
543
|
+
const fieldType = this._getFieldTypeLabel(fieldInfo.layerField.type);
|
|
544
|
+
return (index.h("div", { class: "section" }, index.h("div", { class: "title" }, _t9nStrings.fieldType), index.h("div", null, fieldType)));
|
|
545
|
+
}
|
|
546
|
+
renderFieldAlias() {
|
|
547
|
+
const { _t9nStrings, props } = this;
|
|
548
|
+
const { fieldInfo } = props;
|
|
549
|
+
return (index.h("div", { class: "section" }, index.h("div", { class: "title" }, _t9nStrings.fieldAlias), index.h("div", null, fieldInfo.label)));
|
|
550
|
+
}
|
|
551
|
+
renderFieldDescription() {
|
|
552
|
+
const { _t9nStrings, props } = this;
|
|
553
|
+
const { layer } = props;
|
|
554
|
+
if (layer.type !== "feature") {
|
|
555
|
+
return index.h(index.Fragment, null);
|
|
556
|
+
}
|
|
557
|
+
const { fieldInfo } = props;
|
|
558
|
+
const description = fieldInfo.layerField.description;
|
|
559
|
+
return (index.h("div", { class: "section" }, index.h("div", { class: "title" }, _t9nStrings.fieldDescription), index.h("div", { class: {
|
|
560
|
+
missing: !description
|
|
561
|
+
} }, description || _t9nStrings.fieldDescriptionNotSet)));
|
|
562
|
+
}
|
|
563
|
+
renderFieldValueType() {
|
|
564
|
+
const { _t9nStrings, props } = this;
|
|
565
|
+
const { layer } = props;
|
|
566
|
+
if (layer.type !== "feature") {
|
|
567
|
+
return index.h(index.Fragment, null);
|
|
568
|
+
}
|
|
569
|
+
const { fieldInfo } = props;
|
|
570
|
+
const fieldValueType = this._getFieldValueTypeCamelCase(fieldInfo);
|
|
571
|
+
return (index.h("div", { class: "section" }, index.h("div", { class: "title" }, _t9nStrings.fieldValueType), index.h("div", { class: !fieldValueType ? "missing" : "" }, fieldValueType
|
|
572
|
+
? _t9nStrings.fieldValueTypes[fieldValueType]
|
|
573
|
+
: _t9nStrings.fieldValueTypeNotSet)));
|
|
574
|
+
}
|
|
575
|
+
renderFieldSampleValue() {
|
|
576
|
+
const { oneFeatureResponse, oneFeatureResponseStatus, statisticsStatus, statistics, uniqueValuesStatus, uniqueValues, _t9nStrings, props } = this;
|
|
577
|
+
const { layer, fieldName, fieldInfo } = props;
|
|
578
|
+
const { statistics: statStrings } = _t9nStrings;
|
|
579
|
+
let value;
|
|
580
|
+
if (["imagery", "imagery-tile"].indexOf(layer.type) > -1) {
|
|
581
|
+
return index.h(index.Fragment, null);
|
|
582
|
+
}
|
|
583
|
+
if (layer.type !== "stream" &&
|
|
584
|
+
[SimpleFieldTypes.STRING, SimpleFieldTypes.OID, SimpleFieldTypes.GUID].indexOf(this._getStatisticsType(fieldInfo)) > -1 &&
|
|
585
|
+
uniqueValuesStatus !== Status.FAILED) {
|
|
586
|
+
// we show top values
|
|
587
|
+
return index.h(index.Fragment, null);
|
|
588
|
+
}
|
|
589
|
+
if (oneFeatureResponseStatus === Status.SUCCESS) {
|
|
590
|
+
// find first valid value entry
|
|
591
|
+
oneFeatureResponse.features.forEach((feature) => {
|
|
592
|
+
if (value === undefined || (value === null && feature.attributes[fieldName] !== null)) {
|
|
593
|
+
value = feature.attributes[fieldName];
|
|
594
|
+
}
|
|
595
|
+
});
|
|
596
|
+
}
|
|
597
|
+
else if (statisticsStatus === Status.SUCCESS) {
|
|
598
|
+
// use statistics min value
|
|
599
|
+
value = statistics.min;
|
|
600
|
+
}
|
|
601
|
+
else if (uniqueValuesStatus === Status.SUCCESS) {
|
|
602
|
+
// use a non-null value
|
|
603
|
+
value = uniqueValues.uniqueValueInfos?.[0]?.value || uniqueValues.uniqueValueInfos?.[1]?.value;
|
|
604
|
+
}
|
|
605
|
+
const codedValues = fieldInfo.codedValues;
|
|
606
|
+
if (isDefined(value)) {
|
|
607
|
+
if (codedValues) {
|
|
608
|
+
value = codedValues.find((codedValue) => value === codedValue.code)?.name || value;
|
|
609
|
+
}
|
|
610
|
+
else {
|
|
611
|
+
value = this._getDisplayString(value);
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
return (index.h("div", { class: "section" }, index.h("div", { class: "title" }, _t9nStrings.fieldSampleValue), index.h("div", { class: (oneFeatureResponseStatus === Status.FAILED &&
|
|
615
|
+
statisticsStatus === Status.FAILED &&
|
|
616
|
+
uniqueValuesStatus === Status.FAILED) ||
|
|
617
|
+
!isDefined(value)
|
|
618
|
+
? "missing"
|
|
619
|
+
: "" }, oneFeatureResponseStatus === Status.SUCCESS ||
|
|
620
|
+
statisticsStatus === Status.SUCCESS ||
|
|
621
|
+
uniqueValuesStatus === Status.SUCCESS
|
|
622
|
+
? !isDefined(value)
|
|
623
|
+
? statStrings.allNulls
|
|
624
|
+
: `${value}`
|
|
625
|
+
: oneFeatureResponseStatus === Status.FAILED &&
|
|
626
|
+
statisticsStatus === Status.FAILED &&
|
|
627
|
+
uniqueValuesStatus === Status.FAILED
|
|
628
|
+
? _t9nStrings.fieldSampleNotAvailable
|
|
629
|
+
: _t9nStrings.fieldSampleRetrieving)));
|
|
630
|
+
}
|
|
631
|
+
renderFieldFormat() {
|
|
632
|
+
const { _t9nStrings, props } = this;
|
|
633
|
+
const { fieldName, fieldInfo, layer } = props;
|
|
634
|
+
if (["single", "double", "long"].indexOf(fieldInfo.layerField.type) === -1) {
|
|
635
|
+
return index.h(index.Fragment, null);
|
|
636
|
+
}
|
|
637
|
+
const popupTemplate = layer.popupTemplate;
|
|
638
|
+
if (popupTemplate?.fieldInfos) {
|
|
639
|
+
const popFieldInfos = popupTemplate.fieldInfos?.filter((fieldInfo) => fieldInfo.fieldName === fieldName);
|
|
640
|
+
if (popFieldInfos?.length) {
|
|
641
|
+
const popFieldInfo = popFieldInfos[0];
|
|
642
|
+
if (isDefined(popFieldInfo?.format?.places)) {
|
|
643
|
+
const num = popFieldInfo.format.places;
|
|
644
|
+
return (index.h("div", { class: "section" }, index.h("div", { class: "title" }, _t9nStrings.fieldDecimalPlaces), index.h("div", null, _t9nStrings.fieldNumDecimalPlaces.replace("${number}", num.toString()))));
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
return (index.h("div", { class: "section" }, index.h("div", { class: "title" }, _t9nStrings.fieldDecimalPlaces), index.h("div", { class: "missing" }, _t9nStrings.fieldDecimalPlacesNotAvailable)));
|
|
649
|
+
}
|
|
650
|
+
renderFieldStatistics() {
|
|
651
|
+
const { statisticsStatus, uniqueValuesStatus, hideStatistics, _t9nStrings, props } = this;
|
|
652
|
+
const { layer, fieldInfo } = props;
|
|
653
|
+
if (hideStatistics) {
|
|
654
|
+
this.arcgisFieldInfoComplete.emit();
|
|
655
|
+
return index.h(index.Fragment, null);
|
|
656
|
+
}
|
|
657
|
+
if (["stream", "imagery", "imagery-tile"].indexOf(layer.type) > -1 ||
|
|
658
|
+
["long"].indexOf(fieldInfo.layerField.type) > -1) {
|
|
659
|
+
// can't get statistics
|
|
660
|
+
this.arcgisFieldInfoComplete.emit();
|
|
661
|
+
return index.h(index.Fragment, null);
|
|
662
|
+
}
|
|
663
|
+
return (index.h("div", { class: "section" }, index.h("div", { class: "title" }, _t9nStrings.fieldStatistics), !statisticsStatus || statisticsStatus === Status.MISSING || statisticsStatus === Status.IN_PROGRESS ? (index.h("div", { key: "field-info-statistics-content", class: "missing" }, _t9nStrings.fieldStatisticsRetrieving)) : statisticsStatus === Status.FAILED && uniqueValuesStatus !== Status.SUCCESS ? (this.renderNoStatistics()) : (index.h("div", { key: "field-info-statistics-content", ref: () => this.arcgisFieldInfoComplete.emit() }, this.renderStatistics()))));
|
|
664
|
+
}
|
|
665
|
+
renderNoStatistics() {
|
|
666
|
+
const { _t9nStrings } = this;
|
|
667
|
+
return (index.h("div", { key: "field-info-statistics-content", ref: () => this.arcgisFieldInfoComplete.emit(), class: "missing" }, _t9nStrings.fieldStatisticsNotAvailable));
|
|
668
|
+
}
|
|
669
|
+
renderStatistics() {
|
|
670
|
+
const { props } = this;
|
|
671
|
+
const { fieldInfo } = props;
|
|
672
|
+
switch (this._getStatisticsType(fieldInfo)) {
|
|
673
|
+
case SimpleFieldTypes.NUMBER:
|
|
674
|
+
return this.renderNumberStatistics();
|
|
675
|
+
case SimpleFieldTypes.STRING:
|
|
676
|
+
case SimpleFieldTypes.OID:
|
|
677
|
+
case SimpleFieldTypes.GUID:
|
|
678
|
+
return this.renderStringStatistics();
|
|
679
|
+
case SimpleFieldTypes.DATE:
|
|
680
|
+
case SimpleFieldTypes.DATE_ONLY:
|
|
681
|
+
case SimpleFieldTypes.TIME_ONLY:
|
|
682
|
+
case SimpleFieldTypes.TIMESTAMP_OFFSET:
|
|
683
|
+
return this.renderDateStatistics();
|
|
684
|
+
default:
|
|
685
|
+
return index.h(index.Fragment, null);
|
|
686
|
+
}
|
|
458
687
|
}
|
|
459
|
-
|
|
460
|
-
|
|
688
|
+
renderNumberStatistics() {
|
|
689
|
+
const { statistics, _t9nStrings } = this;
|
|
690
|
+
if (!statistics) {
|
|
691
|
+
return this.renderNoStatistics();
|
|
692
|
+
}
|
|
693
|
+
const { statistics: statStrings } = _t9nStrings;
|
|
694
|
+
return (index.h("div", null, index.h("div", { class: "statistics-row" }, index.h("div", null, statStrings.numberOfValues), index.h("div", { class: "data" }, this._printNumValue(statistics.totalCount))), isDefined(statistics.sum) ? (index.h("div", { class: "statistics-row" }, index.h("div", null, statStrings.sumOfValues), index.h("div", { class: "data" }, this._printNumValue(statistics.sum)))) : null, isDefined(statistics.min) ? (index.h("div", { class: "statistics-row" }, index.h("div", null, statStrings.minimum), index.h("div", { class: "data" }, this._printNumValue(statistics.min)))) : null, isDefined(statistics.max) ? (index.h("div", { class: "statistics-row" }, index.h("div", null, statStrings.maximum), index.h("div", { class: "data" }, this._printNumValue(statistics.max)))) : null, isDefined(statistics.avg) ? (index.h("div", { class: "statistics-row" }, index.h("div", null, statStrings.average), index.h("div", { class: "data" }, this._printNumValue(statistics.avg)))) : null, isDefined(statistics.stddev) ? (index.h("div", { class: "statistics-row" }, index.h("div", null, statStrings.standardDeviation), index.h("div", { class: "data" }, this._printNumValue(statistics.stddev)))) : null, this.renderNullValues()));
|
|
695
|
+
}
|
|
696
|
+
renderStringStatistics() {
|
|
697
|
+
const { statistics, uniqueValuesStatus, _t9nStrings } = this;
|
|
698
|
+
const { statistics: statStrings } = _t9nStrings;
|
|
699
|
+
return (index.h("div", null, index.h("div", { class: "statistics-row" }, index.h("div", null, statStrings.numberOfValues), uniqueValuesStatus !== Status.SUCCESS ? (index.h("div", { class: "missing" }, "--")) : (index.h("div", { class: "data" }, this._printNumValue(statistics?.totalCount)))), this.renderNullValues(), this.renderTopValues()));
|
|
700
|
+
}
|
|
701
|
+
renderDateStatistics() {
|
|
702
|
+
// TODO UTC offset
|
|
703
|
+
const { statistics, view, props, _t9nStrings } = this;
|
|
704
|
+
const { fieldInfo } = props;
|
|
705
|
+
if (!statistics) {
|
|
706
|
+
return this.renderNoStatistics();
|
|
707
|
+
}
|
|
708
|
+
const { statistics: statStrings } = _t9nStrings;
|
|
709
|
+
const dateRange = statistics.max - statistics.min;
|
|
710
|
+
const years = Math.floor(dateRange / 31536000000);
|
|
711
|
+
let months = Math.floor((dateRange - years * 31536000000) / 2628000000);
|
|
712
|
+
let days = Math.ceil((dateRange - months * 2628000000) / 86400000);
|
|
713
|
+
if (days >= 30) {
|
|
714
|
+
months += 1;
|
|
715
|
+
days = 0;
|
|
716
|
+
}
|
|
717
|
+
let timeSpan = years === 1
|
|
718
|
+
? statStrings.timeSpanOptions.year
|
|
719
|
+
: years > 1
|
|
720
|
+
? statStrings.timeSpanOptions.years.replace("${years}", years.toString())
|
|
721
|
+
: "";
|
|
722
|
+
timeSpan += years > 0 && (months > 0 || days > 0) ? ", " : "";
|
|
723
|
+
timeSpan +=
|
|
724
|
+
months === 1
|
|
725
|
+
? statStrings.timeSpanOptions.month
|
|
726
|
+
: months > 1
|
|
727
|
+
? statStrings.timeSpanOptions.months.replace("${months}", months.toString())
|
|
728
|
+
: "";
|
|
729
|
+
timeSpan += months > 0 && days > 0 ? ", " : "";
|
|
730
|
+
timeSpan +=
|
|
731
|
+
days === 1
|
|
732
|
+
? statStrings.timeSpanOptions.day
|
|
733
|
+
: days > 1
|
|
734
|
+
? statStrings.timeSpanOptions.days.replace("${days}", days.toString())
|
|
735
|
+
: "";
|
|
736
|
+
const showStats = fieldInfo.simpleFieldType !== SimpleFieldTypes.TIMESTAMP_OFFSET ||
|
|
737
|
+
!view ||
|
|
738
|
+
view.timeZone !== "unknown";
|
|
739
|
+
const isTimeOnly = fieldInfo.simpleFieldType === SimpleFieldTypes.TIME_ONLY;
|
|
740
|
+
return (index.h("div", null, index.h("div", { class: "statistics-row" }, index.h("div", null, statStrings.numberOfValues), index.h("div", { class: "data" }, this._printNumValue(statistics?.totalCount))), showStats && isDefined(statistics.min) ? (index.h("div", { class: "statistics-row" }, index.h("div", null, isTimeOnly ? statStrings.minimumTime : statStrings.minimumDate), index.h("div", { class: "data" }, `${this._getDisplayString(statistics.min)}`))) : null, showStats && isDefined(statistics.max) ? (index.h("div", { class: "statistics-row" }, index.h("div", null, isTimeOnly ? statStrings.maximumTime : statStrings.maximumDate), index.h("div", { class: "data" }, `${this._getDisplayString(statistics.max)}`))) : null, showStats && isDefined(statistics.avg) ? (index.h("div", { class: "statistics-row" }, index.h("div", null, isTimeOnly ? statStrings.averageTime : statStrings.averageDate), index.h("div", { class: "data" }, `${this._getDisplayString(statistics.avg)}`))) : null, showStats && !isTimeOnly && isDefined(statistics.min) && isDefined(statistics.max) && dateRange > 0 ? (index.h("div", { class: "statistics-row" }, index.h("div", null, statStrings.timespan), index.h("div", { class: "data" }, timeSpan))) : null, this.renderNullValues()));
|
|
741
|
+
}
|
|
742
|
+
renderTopValues() {
|
|
743
|
+
const { uniqueValues, uniqueValuesStatus, _t9nStrings, props } = this;
|
|
744
|
+
const { fieldInfo } = props;
|
|
745
|
+
const { statistics: statStrings } = _t9nStrings;
|
|
746
|
+
if (uniqueValues?.uniqueValueInfos?.length) {
|
|
747
|
+
const infos = uniqueValues.uniqueValueInfos;
|
|
748
|
+
infos.sort((a, b) => (a.count < b.count ? 1 : a.count > b.count ? -1 : 0));
|
|
749
|
+
const codedValues = fieldInfo.codedValues;
|
|
750
|
+
const values = infos
|
|
751
|
+
.filter((info) => info.value !== null)
|
|
752
|
+
.filter((info, idx) => info && idx < 10)
|
|
753
|
+
.map((info) => {
|
|
754
|
+
let value = info.value;
|
|
755
|
+
if (codedValues) {
|
|
756
|
+
codedValues.forEach((codeValue) => {
|
|
757
|
+
if (value === codeValue.code) {
|
|
758
|
+
value = codeValue.name;
|
|
759
|
+
}
|
|
760
|
+
});
|
|
761
|
+
}
|
|
762
|
+
else {
|
|
763
|
+
value = this._getDisplayString(value);
|
|
764
|
+
}
|
|
765
|
+
return (index.h("div", { class: "statistics-row" }, index.h("div", { class: "data" }, `${value}`), index.h("div", { class: `$"data" $"count"` }, this._printNumValue(info.count))));
|
|
766
|
+
});
|
|
767
|
+
if (!values.length) {
|
|
768
|
+
return index.h(index.Fragment, null);
|
|
769
|
+
}
|
|
770
|
+
return (index.h("div", null, index.h("div", { class: "statistics-row-top-values" }, index.h("div", null, infos.length > 10 ? statStrings.topTenValues : statStrings.topValues), index.h("div", null, statStrings.count)), values));
|
|
771
|
+
}
|
|
772
|
+
else {
|
|
773
|
+
return (index.h("div", null, index.h("div", { class: "statistics-row-top-values" }, index.h("div", null, statStrings.topValues), index.h("div", null, statStrings.count)), index.h("div", { class: "statistics-row" }, index.h("div", { class: "missing" }, uniqueValuesStatus === Status.FAILED
|
|
774
|
+
? _t9nStrings.fieldUniqueValuesNotAvailable
|
|
775
|
+
: _t9nStrings.fieldSampleRetrieving))));
|
|
776
|
+
}
|
|
461
777
|
}
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
778
|
+
renderNullValues() {
|
|
779
|
+
const { statistics, uniqueValues, _t9nStrings } = this;
|
|
780
|
+
const { statistics: statStrings } = _t9nStrings;
|
|
781
|
+
let count = statistics?.nullcount;
|
|
782
|
+
if (!isDefined(count) && uniqueValues) {
|
|
783
|
+
const infos = uniqueValues.uniqueValueInfos;
|
|
784
|
+
for (let i = 0; i < infos.length; i++) {
|
|
785
|
+
const info = infos[i];
|
|
786
|
+
if (info.value === null) {
|
|
787
|
+
count = info.count;
|
|
788
|
+
break;
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
return (index.h("div", { class: "statistics-row" }, index.h("div", null, statStrings.numberOfNulls), !isDefined(count) ? (index.h("div", { class: "missing" }, "--")) : (index.h("div", { class: "data" }, `${new Number(count).toLocaleString()}`))));
|
|
793
|
+
}
|
|
794
|
+
// --------------------------------------------------------------------------
|
|
795
|
+
//
|
|
796
|
+
// Private methods
|
|
797
|
+
//
|
|
798
|
+
// --------------------------------------------------------------------------
|
|
799
|
+
_getFieldTypeLabel(fieldType) {
|
|
800
|
+
const { _t9nStrings } = this;
|
|
801
|
+
const fieldTypes = _t9nStrings.fieldTypes;
|
|
802
|
+
switch (fieldType) {
|
|
803
|
+
case "small-integer":
|
|
804
|
+
return fieldTypes.smallInteger;
|
|
805
|
+
case "big-integer":
|
|
806
|
+
return fieldTypes.bigInteger;
|
|
807
|
+
case "integer":
|
|
808
|
+
return fieldTypes.integer;
|
|
809
|
+
case "single":
|
|
810
|
+
return fieldTypes.single;
|
|
811
|
+
case "double":
|
|
812
|
+
return fieldTypes.double;
|
|
813
|
+
case "long":
|
|
814
|
+
return fieldTypes.long;
|
|
815
|
+
case "string":
|
|
816
|
+
return fieldTypes.string;
|
|
817
|
+
case "date":
|
|
818
|
+
return fieldTypes.date;
|
|
819
|
+
case "date-only":
|
|
820
|
+
return fieldTypes.dateOnly;
|
|
821
|
+
case "time-only":
|
|
822
|
+
return fieldTypes.timeOnly;
|
|
823
|
+
case "timestamp-offset":
|
|
824
|
+
return fieldTypes.timestampOffset;
|
|
825
|
+
case "oid":
|
|
826
|
+
return fieldTypes.oid;
|
|
827
|
+
case "guid":
|
|
828
|
+
return fieldTypes.guid;
|
|
829
|
+
case "global-id":
|
|
830
|
+
return fieldTypes.globalId;
|
|
831
|
+
default:
|
|
832
|
+
return fieldTypes.string;
|
|
833
|
+
}
|
|
466
834
|
}
|
|
467
|
-
|
|
468
|
-
|
|
835
|
+
_getStatisticsType(fieldInfo) {
|
|
836
|
+
// "count-or-amount","percentage-or-ratio","measurement","unique-identifier","coordinate","binary"
|
|
837
|
+
// "name-or-title","type-or-category","description","location-or-place-name","ordered-or-ranked","date-and-time"
|
|
838
|
+
switch (fieldInfo.layerField.type) {
|
|
839
|
+
case "small-integer":
|
|
840
|
+
case "big-integer":
|
|
841
|
+
case "integer":
|
|
842
|
+
case "single":
|
|
843
|
+
case "double": {
|
|
844
|
+
if (fieldInfo.codedValues) {
|
|
845
|
+
return SimpleFieldTypes.STRING;
|
|
846
|
+
}
|
|
847
|
+
switch (fieldInfo.layerField.valueType) {
|
|
848
|
+
case "name-or-title":
|
|
849
|
+
case "type-or-category":
|
|
850
|
+
case "description":
|
|
851
|
+
case "location-or-place-name":
|
|
852
|
+
case "ordered-or-ranked":
|
|
853
|
+
case "binary":
|
|
854
|
+
//case "date-and-time":
|
|
855
|
+
return SimpleFieldTypes.STRING;
|
|
856
|
+
default:
|
|
857
|
+
return SimpleFieldTypes.NUMBER;
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
case "string":
|
|
861
|
+
return SimpleFieldTypes.STRING;
|
|
862
|
+
case "date":
|
|
863
|
+
return SimpleFieldTypes.DATE;
|
|
864
|
+
case "timestamp-offset":
|
|
865
|
+
return SimpleFieldTypes.TIMESTAMP_OFFSET;
|
|
866
|
+
case "date-only":
|
|
867
|
+
return SimpleFieldTypes.DATE_ONLY;
|
|
868
|
+
case "time-only":
|
|
869
|
+
return SimpleFieldTypes.TIME_ONLY;
|
|
870
|
+
default:
|
|
871
|
+
return SimpleFieldTypes.STRING;
|
|
872
|
+
}
|
|
469
873
|
}
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
874
|
+
_getFieldValueTypeCamelCase(field) {
|
|
875
|
+
switch (field.layerField.valueType) {
|
|
876
|
+
case "count-or-amount":
|
|
877
|
+
return "countOrAmount";
|
|
878
|
+
case "percentage-or-ratio":
|
|
879
|
+
return "percentageOrRatio";
|
|
880
|
+
case "unique-identifier":
|
|
881
|
+
return "uniqueIdentifier";
|
|
882
|
+
case "name-or-title":
|
|
883
|
+
return "nameOrTitle";
|
|
884
|
+
case "type-or-category":
|
|
885
|
+
return "typeOrCategory";
|
|
886
|
+
case "location-or-place-name":
|
|
887
|
+
return "locationOrPlaceName";
|
|
888
|
+
case "ordered-or-ranked":
|
|
889
|
+
return "orderedOrRanked";
|
|
890
|
+
case "date-and-time":
|
|
891
|
+
return "dateAndTime";
|
|
892
|
+
default:
|
|
893
|
+
return field.layerField.valueType;
|
|
477
894
|
}
|
|
478
|
-
|
|
479
|
-
|
|
895
|
+
}
|
|
896
|
+
_getDisplayString(value) {
|
|
897
|
+
const { props } = this;
|
|
898
|
+
const { fieldInfo } = props;
|
|
899
|
+
switch (fieldInfo.simpleFieldType) {
|
|
900
|
+
case SimpleFieldTypes.DATE:
|
|
901
|
+
return this._getDateString(value);
|
|
902
|
+
case SimpleFieldTypes.TIMESTAMP_OFFSET:
|
|
903
|
+
return this._getTimestampOffsetString(value);
|
|
904
|
+
case SimpleFieldTypes.DATE_ONLY:
|
|
905
|
+
return this._getDateOnlyString(value);
|
|
906
|
+
case SimpleFieldTypes.TIME_ONLY:
|
|
907
|
+
return this._getTimeOnlyString(value);
|
|
908
|
+
case SimpleFieldTypes.NUMBER:
|
|
909
|
+
return this._getNumberString(value);
|
|
910
|
+
case SimpleFieldTypes.GUID:
|
|
911
|
+
return this._getGuidString(value);
|
|
912
|
+
default:
|
|
913
|
+
// string, oid, global-id
|
|
914
|
+
return `${value}`;
|
|
480
915
|
}
|
|
481
|
-
}
|
|
482
|
-
catch (error) {
|
|
483
|
-
this.uniqueValuesStatus = Status.FAILED;
|
|
484
|
-
}
|
|
485
916
|
}
|
|
486
|
-
|
|
487
|
-
|
|
917
|
+
_getDateString(value) {
|
|
918
|
+
const { modules, view } = this.props;
|
|
919
|
+
if (view && view.timeZone === "unknown") {
|
|
920
|
+
return modules.intl.formatDate(value, {
|
|
921
|
+
...modules.intl.convertDateFormatToIntlOptions("short-date-short-time"),
|
|
922
|
+
timeZone: "utc",
|
|
923
|
+
timeZoneName: "shortOffset"
|
|
924
|
+
});
|
|
925
|
+
}
|
|
926
|
+
else {
|
|
927
|
+
// known issues with formatting it-CH
|
|
928
|
+
return modules.intl.formatDate(value, {
|
|
929
|
+
...modules.intl.convertDateFormatToIntlOptions("short-date-short-time"),
|
|
930
|
+
timeZone: view?.timeZone || "system"
|
|
931
|
+
});
|
|
932
|
+
}
|
|
488
933
|
}
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
934
|
+
_getTimestampOffsetString(value) {
|
|
935
|
+
/*
|
|
936
|
+
const timestamp = "2023-03-19T16:00:00.123-01:00";
|
|
937
|
+
console.log("timestamp", timestamp);
|
|
938
|
+
console.log(
|
|
939
|
+
"local Time",
|
|
940
|
+
intl.formatTimestamp(timestamp, intl.convertDateFormatToIntlOptions("short-date-short-time"))
|
|
941
|
+
);
|
|
942
|
+
console.log(
|
|
943
|
+
"mapView Time (except unknown)",
|
|
944
|
+
intl.formatTimestamp(timestamp, {
|
|
945
|
+
...intl.convertDateFormatToIntlOptions("short-date-short-time"),
|
|
946
|
+
timeZone: view.timeZone,
|
|
947
|
+
})
|
|
948
|
+
);
|
|
949
|
+
console.log(
|
|
950
|
+
"UTC Time (mapView time unknown)",
|
|
951
|
+
intl.formatTimestamp(timestamp, {
|
|
952
|
+
...intl.convertDateFormatToIntlOptions("short-date-short-time"),
|
|
953
|
+
timeZone: "utc",
|
|
954
|
+
timeZoneName: "shortOffset"
|
|
955
|
+
})
|
|
956
|
+
);
|
|
957
|
+
console.log(
|
|
958
|
+
"Raw",
|
|
959
|
+
intl.formatTimestamp(timestamp, {
|
|
960
|
+
...intl.convertDateFormatToIntlOptions("short-date-short-time"),
|
|
961
|
+
timeZoneName: "shortOffset"
|
|
962
|
+
})
|
|
963
|
+
);
|
|
964
|
+
*/
|
|
965
|
+
const { modules, view } = this.props;
|
|
966
|
+
if (typeof value === "string") {
|
|
967
|
+
// raw value from layer
|
|
968
|
+
if (view && view.timeZone === "unknown") {
|
|
969
|
+
return modules.intl.formatTimestamp(value, {
|
|
970
|
+
...modules.intl.convertDateFormatToIntlOptions("short-date-short-time"),
|
|
971
|
+
timeZone: "utc",
|
|
972
|
+
timeZoneName: "shortOffset"
|
|
973
|
+
});
|
|
503
974
|
}
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
}
|
|
510
|
-
this.statistics = statistics;
|
|
511
|
-
this.statisticsStatus = Status.SUCCESS;
|
|
512
|
-
}
|
|
513
|
-
catch (error) {
|
|
514
|
-
this.statisticsStatus = Status.FAILED;
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
async componentDidLoad() {
|
|
519
|
-
// once component is visible make other calls
|
|
520
|
-
const { props } = this;
|
|
521
|
-
const { modules } = props;
|
|
522
|
-
modules.intl.setLocale(this._lang);
|
|
523
|
-
// modules.intl.setLocale(this.locale) not returning the correct formatting for e.g. it-ch
|
|
524
|
-
}
|
|
525
|
-
disconnectedCallback() {
|
|
526
|
-
index$1.U(this);
|
|
527
|
-
}
|
|
528
|
-
// --------------------------------------------------------------------------
|
|
529
|
-
//
|
|
530
|
-
// Render Methods
|
|
531
|
-
//
|
|
532
|
-
//--------------------------------------------------------------------------
|
|
533
|
-
render() {
|
|
534
|
-
const { props } = this;
|
|
535
|
-
const { fieldInfo } = props;
|
|
536
|
-
if (!fieldInfo) {
|
|
537
|
-
return index.h(index.Fragment, null);
|
|
538
|
-
}
|
|
539
|
-
return (index.h(index.Host, null, index.h("div", { class: "container" }, this.renderFieldType(), this.renderFieldAlias(), this.renderFieldDescription(), this.renderFieldValueType(), this.renderFieldSampleValue(), this.renderFieldFormat(), this.renderFieldStatistics())));
|
|
540
|
-
}
|
|
541
|
-
renderFieldType() {
|
|
542
|
-
const { _t9nStrings, props } = this;
|
|
543
|
-
const { fieldInfo } = props;
|
|
544
|
-
const fieldType = this._getFieldTypeLabel(fieldInfo.layerField.type);
|
|
545
|
-
return (index.h("div", { class: "section" }, index.h("div", { class: "title" }, _t9nStrings.fieldType), index.h("div", null, fieldType)));
|
|
546
|
-
}
|
|
547
|
-
renderFieldAlias() {
|
|
548
|
-
const { _t9nStrings, props } = this;
|
|
549
|
-
const { fieldInfo } = props;
|
|
550
|
-
return (index.h("div", { class: "section" }, index.h("div", { class: "title" }, _t9nStrings.fieldAlias), index.h("div", null, fieldInfo.label)));
|
|
551
|
-
}
|
|
552
|
-
renderFieldDescription() {
|
|
553
|
-
const { _t9nStrings, props } = this;
|
|
554
|
-
const { layer } = props;
|
|
555
|
-
if (layer.type !== "feature") {
|
|
556
|
-
return index.h(index.Fragment, null);
|
|
557
|
-
}
|
|
558
|
-
const { fieldInfo } = props;
|
|
559
|
-
const description = fieldInfo.layerField.description;
|
|
560
|
-
return (index.h("div", { class: "section" }, index.h("div", { class: "title" }, _t9nStrings.fieldDescription), index.h("div", { class: {
|
|
561
|
-
missing: !description
|
|
562
|
-
} }, description || _t9nStrings.fieldDescriptionNotSet)));
|
|
563
|
-
}
|
|
564
|
-
renderFieldValueType() {
|
|
565
|
-
const { _t9nStrings, props } = this;
|
|
566
|
-
const { layer } = props;
|
|
567
|
-
if (layer.type !== "feature") {
|
|
568
|
-
return index.h(index.Fragment, null);
|
|
569
|
-
}
|
|
570
|
-
const { fieldInfo } = props;
|
|
571
|
-
const fieldValueType = this._getFieldValueTypeCamelCase(fieldInfo);
|
|
572
|
-
return (index.h("div", { class: "section" }, index.h("div", { class: "title" }, _t9nStrings.fieldValueType), index.h("div", { class: !fieldValueType ? "missing" : "" }, fieldValueType
|
|
573
|
-
? _t9nStrings.fieldValueTypes[fieldValueType]
|
|
574
|
-
: _t9nStrings.fieldValueTypeNotSet)));
|
|
575
|
-
}
|
|
576
|
-
renderFieldSampleValue() {
|
|
577
|
-
const { oneFeatureResponse, oneFeatureResponseStatus, statisticsStatus, statistics, uniqueValuesStatus, uniqueValues, _t9nStrings, props } = this;
|
|
578
|
-
const { layer, fieldName, fieldInfo } = props;
|
|
579
|
-
const { statistics: statStrings } = _t9nStrings;
|
|
580
|
-
let value;
|
|
581
|
-
if (["imagery", "imagery-tile"].indexOf(layer.type) > -1) {
|
|
582
|
-
return index.h(index.Fragment, null);
|
|
583
|
-
}
|
|
584
|
-
if (layer.type !== "stream" &&
|
|
585
|
-
[SimpleFieldTypes.STRING, SimpleFieldTypes.OID, SimpleFieldTypes.GUID].indexOf(this._getStatisticsType(fieldInfo)) > -1 &&
|
|
586
|
-
uniqueValuesStatus !== Status.FAILED) {
|
|
587
|
-
// we show top values
|
|
588
|
-
return index.h(index.Fragment, null);
|
|
589
|
-
}
|
|
590
|
-
if (oneFeatureResponseStatus === Status.SUCCESS) {
|
|
591
|
-
// find first valid value entry
|
|
592
|
-
oneFeatureResponse.features.forEach((feature) => {
|
|
593
|
-
if (value === undefined || (value === null && feature.attributes[fieldName] !== null)) {
|
|
594
|
-
value = feature.attributes[fieldName];
|
|
595
|
-
}
|
|
596
|
-
});
|
|
597
|
-
}
|
|
598
|
-
else if (statisticsStatus === Status.SUCCESS) {
|
|
599
|
-
// use statistics min value
|
|
600
|
-
value = statistics.min;
|
|
601
|
-
}
|
|
602
|
-
else if (uniqueValuesStatus === Status.SUCCESS) {
|
|
603
|
-
// use a non-null value
|
|
604
|
-
value = uniqueValues.uniqueValueInfos?.[0]?.value || uniqueValues.uniqueValueInfos?.[1]?.value;
|
|
605
|
-
}
|
|
606
|
-
const codedValues = fieldInfo.codedValues;
|
|
607
|
-
if (isDefined(value)) {
|
|
608
|
-
if (codedValues) {
|
|
609
|
-
value = codedValues.find((codedValue) => value === codedValue.code)?.name || value;
|
|
610
|
-
}
|
|
611
|
-
else {
|
|
612
|
-
value = this._getDisplayString(value);
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
return (index.h("div", { class: "section" }, index.h("div", { class: "title" }, _t9nStrings.fieldSampleValue), index.h("div", { class: (oneFeatureResponseStatus === Status.FAILED &&
|
|
616
|
-
statisticsStatus === Status.FAILED &&
|
|
617
|
-
uniqueValuesStatus === Status.FAILED) ||
|
|
618
|
-
!isDefined(value)
|
|
619
|
-
? "missing"
|
|
620
|
-
: "" }, oneFeatureResponseStatus === Status.SUCCESS ||
|
|
621
|
-
statisticsStatus === Status.SUCCESS ||
|
|
622
|
-
uniqueValuesStatus === Status.SUCCESS
|
|
623
|
-
? !isDefined(value)
|
|
624
|
-
? statStrings.allNulls
|
|
625
|
-
: `${value}`
|
|
626
|
-
: oneFeatureResponseStatus === Status.FAILED &&
|
|
627
|
-
statisticsStatus === Status.FAILED &&
|
|
628
|
-
uniqueValuesStatus === Status.FAILED
|
|
629
|
-
? _t9nStrings.fieldSampleNotAvailable
|
|
630
|
-
: _t9nStrings.fieldSampleRetrieving)));
|
|
631
|
-
}
|
|
632
|
-
renderFieldFormat() {
|
|
633
|
-
const { _t9nStrings, props } = this;
|
|
634
|
-
const { fieldName, fieldInfo, layer } = props;
|
|
635
|
-
if (["single", "double", "long"].indexOf(fieldInfo.layerField.type) === -1) {
|
|
636
|
-
return index.h(index.Fragment, null);
|
|
637
|
-
}
|
|
638
|
-
const popupTemplate = layer.popupTemplate;
|
|
639
|
-
if (popupTemplate?.fieldInfos) {
|
|
640
|
-
const popFieldInfos = popupTemplate.fieldInfos?.filter((fieldInfo) => fieldInfo.fieldName === fieldName);
|
|
641
|
-
if (popFieldInfos?.length) {
|
|
642
|
-
const popFieldInfo = popFieldInfos[0];
|
|
643
|
-
if (isDefined(popFieldInfo?.format?.places)) {
|
|
644
|
-
const num = popFieldInfo.format.places;
|
|
645
|
-
return (index.h("div", { class: "section" }, index.h("div", { class: "title" }, _t9nStrings.fieldDecimalPlaces), index.h("div", null, _t9nStrings.fieldNumDecimalPlaces.replace("${number}", num.toString()))));
|
|
646
|
-
}
|
|
647
|
-
}
|
|
648
|
-
}
|
|
649
|
-
return (index.h("div", { class: "section" }, index.h("div", { class: "title" }, _t9nStrings.fieldDecimalPlaces), index.h("div", { class: "missing" }, _t9nStrings.fieldDecimalPlacesNotAvailable)));
|
|
650
|
-
}
|
|
651
|
-
renderFieldStatistics() {
|
|
652
|
-
const { statisticsStatus, uniqueValuesStatus, hideStatistics, _t9nStrings, props } = this;
|
|
653
|
-
const { layer, fieldInfo } = props;
|
|
654
|
-
if (hideStatistics) {
|
|
655
|
-
this.arcgisFieldInfoComplete.emit();
|
|
656
|
-
return index.h(index.Fragment, null);
|
|
657
|
-
}
|
|
658
|
-
if (["stream", "imagery", "imagery-tile"].indexOf(layer.type) > -1 ||
|
|
659
|
-
["long"].indexOf(fieldInfo.layerField.type) > -1) {
|
|
660
|
-
// can't get statistics
|
|
661
|
-
this.arcgisFieldInfoComplete.emit();
|
|
662
|
-
return index.h(index.Fragment, null);
|
|
663
|
-
}
|
|
664
|
-
return (index.h("div", { class: "section" }, index.h("div", { class: "title" }, _t9nStrings.fieldStatistics), !statisticsStatus || statisticsStatus === Status.MISSING || statisticsStatus === Status.IN_PROGRESS ? (index.h("div", { key: "field-info-statistics-content", class: "missing" }, _t9nStrings.fieldStatisticsRetrieving)) : statisticsStatus === Status.FAILED && uniqueValuesStatus !== Status.SUCCESS ? (this.renderNoStatistics()) : (index.h("div", { key: "field-info-statistics-content", ref: () => this.arcgisFieldInfoComplete.emit() }, this.renderStatistics()))));
|
|
665
|
-
}
|
|
666
|
-
renderNoStatistics() {
|
|
667
|
-
const { _t9nStrings } = this;
|
|
668
|
-
return (index.h("div", { key: "field-info-statistics-content", ref: () => this.arcgisFieldInfoComplete.emit(), class: "missing" }, _t9nStrings.fieldStatisticsNotAvailable));
|
|
669
|
-
}
|
|
670
|
-
renderStatistics() {
|
|
671
|
-
const { props } = this;
|
|
672
|
-
const { fieldInfo } = props;
|
|
673
|
-
switch (this._getStatisticsType(fieldInfo)) {
|
|
674
|
-
case SimpleFieldTypes.NUMBER:
|
|
675
|
-
return this.renderNumberStatistics();
|
|
676
|
-
case SimpleFieldTypes.STRING:
|
|
677
|
-
case SimpleFieldTypes.OID:
|
|
678
|
-
case SimpleFieldTypes.GUID:
|
|
679
|
-
return this.renderStringStatistics();
|
|
680
|
-
case SimpleFieldTypes.DATE:
|
|
681
|
-
case SimpleFieldTypes.DATE_ONLY:
|
|
682
|
-
case SimpleFieldTypes.TIME_ONLY:
|
|
683
|
-
case SimpleFieldTypes.TIMESTAMP_OFFSET:
|
|
684
|
-
return this.renderDateStatistics();
|
|
685
|
-
default:
|
|
686
|
-
return index.h(index.Fragment, null);
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
renderNumberStatistics() {
|
|
690
|
-
const { statistics, _t9nStrings } = this;
|
|
691
|
-
if (!statistics) {
|
|
692
|
-
return this.renderNoStatistics();
|
|
693
|
-
}
|
|
694
|
-
const { statistics: statStrings } = _t9nStrings;
|
|
695
|
-
return (index.h("div", null, index.h("div", { class: "statistics-row" }, index.h("div", null, statStrings.numberOfValues), index.h("div", { class: "data" }, this._printNumValue(statistics.totalCount))), isDefined(statistics.sum) ? (index.h("div", { class: "statistics-row" }, index.h("div", null, statStrings.sumOfValues), index.h("div", { class: "data" }, this._printNumValue(statistics.sum)))) : null, isDefined(statistics.min) ? (index.h("div", { class: "statistics-row" }, index.h("div", null, statStrings.minimum), index.h("div", { class: "data" }, this._printNumValue(statistics.min)))) : null, isDefined(statistics.max) ? (index.h("div", { class: "statistics-row" }, index.h("div", null, statStrings.maximum), index.h("div", { class: "data" }, this._printNumValue(statistics.max)))) : null, isDefined(statistics.avg) ? (index.h("div", { class: "statistics-row" }, index.h("div", null, statStrings.average), index.h("div", { class: "data" }, this._printNumValue(statistics.avg)))) : null, isDefined(statistics.stddev) ? (index.h("div", { class: "statistics-row" }, index.h("div", null, statStrings.standardDeviation), index.h("div", { class: "data" }, this._printNumValue(statistics.stddev)))) : null, this.renderNullValues()));
|
|
696
|
-
}
|
|
697
|
-
renderStringStatistics() {
|
|
698
|
-
const { statistics, uniqueValuesStatus, _t9nStrings } = this;
|
|
699
|
-
const { statistics: statStrings } = _t9nStrings;
|
|
700
|
-
return (index.h("div", null, index.h("div", { class: "statistics-row" }, index.h("div", null, statStrings.numberOfValues), uniqueValuesStatus !== Status.SUCCESS ? (index.h("div", { class: "missing" }, "--")) : (index.h("div", { class: "data" }, this._printNumValue(statistics?.totalCount)))), this.renderNullValues(), this.renderTopValues()));
|
|
701
|
-
}
|
|
702
|
-
renderDateStatistics() {
|
|
703
|
-
// TODO UTC offset
|
|
704
|
-
const { statistics, view, props, _t9nStrings } = this;
|
|
705
|
-
const { fieldInfo } = props;
|
|
706
|
-
if (!statistics) {
|
|
707
|
-
return this.renderNoStatistics();
|
|
708
|
-
}
|
|
709
|
-
const { statistics: statStrings } = _t9nStrings;
|
|
710
|
-
const dateRange = statistics.max - statistics.min;
|
|
711
|
-
const years = Math.floor(dateRange / 31536000000);
|
|
712
|
-
let months = Math.floor((dateRange - years * 31536000000) / 2628000000);
|
|
713
|
-
let days = Math.ceil((dateRange - months * 2628000000) / 86400000);
|
|
714
|
-
if (days >= 30) {
|
|
715
|
-
months += 1;
|
|
716
|
-
days = 0;
|
|
717
|
-
}
|
|
718
|
-
let timeSpan = years === 1
|
|
719
|
-
? statStrings.timeSpanOptions.year
|
|
720
|
-
: years > 1
|
|
721
|
-
? statStrings.timeSpanOptions.years.replace("${years}", years.toString())
|
|
722
|
-
: "";
|
|
723
|
-
timeSpan += years > 0 && (months > 0 || days > 0) ? ", " : "";
|
|
724
|
-
timeSpan +=
|
|
725
|
-
months === 1
|
|
726
|
-
? statStrings.timeSpanOptions.month
|
|
727
|
-
: months > 1
|
|
728
|
-
? statStrings.timeSpanOptions.months.replace("${months}", months.toString())
|
|
729
|
-
: "";
|
|
730
|
-
timeSpan += months > 0 && days > 0 ? ", " : "";
|
|
731
|
-
timeSpan +=
|
|
732
|
-
days === 1
|
|
733
|
-
? statStrings.timeSpanOptions.day
|
|
734
|
-
: days > 1
|
|
735
|
-
? statStrings.timeSpanOptions.days.replace("${days}", days.toString())
|
|
736
|
-
: "";
|
|
737
|
-
const showStats = fieldInfo.simpleFieldType !== SimpleFieldTypes.TIMESTAMP_OFFSET ||
|
|
738
|
-
!view ||
|
|
739
|
-
view.timeZone !== "unknown";
|
|
740
|
-
const isTimeOnly = fieldInfo.simpleFieldType === SimpleFieldTypes.TIME_ONLY;
|
|
741
|
-
return (index.h("div", null, index.h("div", { class: "statistics-row" }, index.h("div", null, statStrings.numberOfValues), index.h("div", { class: "data" }, this._printNumValue(statistics?.totalCount))), showStats && isDefined(statistics.min) ? (index.h("div", { class: "statistics-row" }, index.h("div", null, isTimeOnly ? statStrings.minimumTime : statStrings.minimumDate), index.h("div", { class: "data" }, `${this._getDisplayString(statistics.min)}`))) : null, showStats && isDefined(statistics.max) ? (index.h("div", { class: "statistics-row" }, index.h("div", null, isTimeOnly ? statStrings.maximumTime : statStrings.maximumDate), index.h("div", { class: "data" }, `${this._getDisplayString(statistics.max)}`))) : null, showStats && isDefined(statistics.avg) ? (index.h("div", { class: "statistics-row" }, index.h("div", null, isTimeOnly ? statStrings.averageTime : statStrings.averageDate), index.h("div", { class: "data" }, `${this._getDisplayString(statistics.avg)}`))) : null, showStats && !isTimeOnly && isDefined(statistics.min) && isDefined(statistics.max) && dateRange > 0 ? (index.h("div", { class: "statistics-row" }, index.h("div", null, statStrings.timespan), index.h("div", { class: "data" }, timeSpan))) : null, this.renderNullValues()));
|
|
742
|
-
}
|
|
743
|
-
renderTopValues() {
|
|
744
|
-
const { uniqueValues, uniqueValuesStatus, _t9nStrings, props } = this;
|
|
745
|
-
const { fieldInfo } = props;
|
|
746
|
-
const { statistics: statStrings } = _t9nStrings;
|
|
747
|
-
if (uniqueValues?.uniqueValueInfos?.length) {
|
|
748
|
-
const infos = uniqueValues.uniqueValueInfos;
|
|
749
|
-
infos.sort((a, b) => (a.count < b.count ? 1 : a.count > b.count ? -1 : 0));
|
|
750
|
-
const codedValues = fieldInfo.codedValues;
|
|
751
|
-
const values = infos
|
|
752
|
-
.filter((info) => info.value !== null)
|
|
753
|
-
.filter((info, idx) => info && idx < 10)
|
|
754
|
-
.map((info) => {
|
|
755
|
-
let value = info.value;
|
|
756
|
-
if (codedValues) {
|
|
757
|
-
codedValues.forEach((codeValue) => {
|
|
758
|
-
if (value === codeValue.code) {
|
|
759
|
-
value = codeValue.name;
|
|
975
|
+
else {
|
|
976
|
+
return modules.intl.formatTimestamp(value, {
|
|
977
|
+
...modules.intl.convertDateFormatToIntlOptions("short-date-short-time"),
|
|
978
|
+
timeZone: view?.timeZone || "system"
|
|
979
|
+
});
|
|
760
980
|
}
|
|
761
|
-
});
|
|
762
981
|
}
|
|
763
982
|
else {
|
|
764
|
-
|
|
983
|
+
// e.g. UNIX timestamp from statistics call
|
|
984
|
+
return this._getDateString(value);
|
|
765
985
|
}
|
|
766
|
-
return (index.h("div", { class: "statistics-row" }, index.h("div", { class: "data" }, `${value}`), index.h("div", { class: `$"data" $"count"` }, this._printNumValue(info.count))));
|
|
767
|
-
});
|
|
768
|
-
if (!values.length) {
|
|
769
|
-
return index.h(index.Fragment, null);
|
|
770
|
-
}
|
|
771
|
-
return (index.h("div", null, index.h("div", { class: "statistics-row-top-values" }, index.h("div", null, infos.length > 10 ? statStrings.topTenValues : statStrings.topValues), index.h("div", null, statStrings.count)), values));
|
|
772
986
|
}
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
}
|
|
778
|
-
}
|
|
779
|
-
renderNullValues() {
|
|
780
|
-
const { statistics, uniqueValues, _t9nStrings } = this;
|
|
781
|
-
const { statistics: statStrings } = _t9nStrings;
|
|
782
|
-
let count = statistics?.nullcount;
|
|
783
|
-
if (!isDefined(count) && uniqueValues) {
|
|
784
|
-
const infos = uniqueValues.uniqueValueInfos;
|
|
785
|
-
for (let i = 0; i < infos.length; i++) {
|
|
786
|
-
const info = infos[i];
|
|
787
|
-
if (info.value === null) {
|
|
788
|
-
count = info.count;
|
|
789
|
-
break;
|
|
790
|
-
}
|
|
791
|
-
}
|
|
792
|
-
}
|
|
793
|
-
return (index.h("div", { class: "statistics-row" }, index.h("div", null, statStrings.numberOfNulls), !isDefined(count) ? (index.h("div", { class: "missing" }, "--")) : (index.h("div", { class: "data" }, `${new Number(count).toLocaleString()}`))));
|
|
794
|
-
}
|
|
795
|
-
// --------------------------------------------------------------------------
|
|
796
|
-
//
|
|
797
|
-
// Private methods
|
|
798
|
-
//
|
|
799
|
-
// --------------------------------------------------------------------------
|
|
800
|
-
_getFieldTypeLabel(fieldType) {
|
|
801
|
-
const { _t9nStrings } = this;
|
|
802
|
-
const fieldTypes = _t9nStrings.fieldTypes;
|
|
803
|
-
switch (fieldType) {
|
|
804
|
-
case "small-integer":
|
|
805
|
-
return fieldTypes.smallInteger;
|
|
806
|
-
case "big-integer":
|
|
807
|
-
return fieldTypes.bigInteger;
|
|
808
|
-
case "integer":
|
|
809
|
-
return fieldTypes.integer;
|
|
810
|
-
case "single":
|
|
811
|
-
return fieldTypes.single;
|
|
812
|
-
case "double":
|
|
813
|
-
return fieldTypes.double;
|
|
814
|
-
case "long":
|
|
815
|
-
return fieldTypes.long;
|
|
816
|
-
case "string":
|
|
817
|
-
return fieldTypes.string;
|
|
818
|
-
case "date":
|
|
819
|
-
return fieldTypes.date;
|
|
820
|
-
case "date-only":
|
|
821
|
-
return fieldTypes.dateOnly;
|
|
822
|
-
case "time-only":
|
|
823
|
-
return fieldTypes.timeOnly;
|
|
824
|
-
case "timestamp-offset":
|
|
825
|
-
return fieldTypes.timestampOffset;
|
|
826
|
-
case "oid":
|
|
827
|
-
return fieldTypes.oid;
|
|
828
|
-
case "guid":
|
|
829
|
-
return fieldTypes.guid;
|
|
830
|
-
case "global-id":
|
|
831
|
-
return fieldTypes.globalId;
|
|
832
|
-
default:
|
|
833
|
-
return fieldTypes.string;
|
|
834
|
-
}
|
|
835
|
-
}
|
|
836
|
-
_getStatisticsType(fieldInfo) {
|
|
837
|
-
// "count-or-amount","percentage-or-ratio","measurement","unique-identifier","coordinate","binary"
|
|
838
|
-
// "name-or-title","type-or-category","description","location-or-place-name","ordered-or-ranked","date-and-time"
|
|
839
|
-
switch (fieldInfo.layerField.type) {
|
|
840
|
-
case "small-integer":
|
|
841
|
-
case "big-integer":
|
|
842
|
-
case "integer":
|
|
843
|
-
case "single":
|
|
844
|
-
case "double": {
|
|
845
|
-
if (fieldInfo.codedValues) {
|
|
846
|
-
return SimpleFieldTypes.STRING;
|
|
847
|
-
}
|
|
848
|
-
switch (fieldInfo.layerField.valueType) {
|
|
849
|
-
case "name-or-title":
|
|
850
|
-
case "type-or-category":
|
|
851
|
-
case "description":
|
|
852
|
-
case "location-or-place-name":
|
|
853
|
-
case "ordered-or-ranked":
|
|
854
|
-
case "binary":
|
|
855
|
-
//case "date-and-time":
|
|
856
|
-
return SimpleFieldTypes.STRING;
|
|
857
|
-
default:
|
|
858
|
-
return SimpleFieldTypes.NUMBER;
|
|
859
|
-
}
|
|
860
|
-
}
|
|
861
|
-
case "string":
|
|
862
|
-
return SimpleFieldTypes.STRING;
|
|
863
|
-
case "date":
|
|
864
|
-
return SimpleFieldTypes.DATE;
|
|
865
|
-
case "timestamp-offset":
|
|
866
|
-
return SimpleFieldTypes.TIMESTAMP_OFFSET;
|
|
867
|
-
case "date-only":
|
|
868
|
-
return SimpleFieldTypes.DATE_ONLY;
|
|
869
|
-
case "time-only":
|
|
870
|
-
return SimpleFieldTypes.TIME_ONLY;
|
|
871
|
-
default:
|
|
872
|
-
return SimpleFieldTypes.STRING;
|
|
873
|
-
}
|
|
874
|
-
}
|
|
875
|
-
_getFieldValueTypeCamelCase(field) {
|
|
876
|
-
switch (field.layerField.valueType) {
|
|
877
|
-
case "count-or-amount":
|
|
878
|
-
return "countOrAmount";
|
|
879
|
-
case "percentage-or-ratio":
|
|
880
|
-
return "percentageOrRatio";
|
|
881
|
-
case "unique-identifier":
|
|
882
|
-
return "uniqueIdentifier";
|
|
883
|
-
case "name-or-title":
|
|
884
|
-
return "nameOrTitle";
|
|
885
|
-
case "type-or-category":
|
|
886
|
-
return "typeOrCategory";
|
|
887
|
-
case "location-or-place-name":
|
|
888
|
-
return "locationOrPlaceName";
|
|
889
|
-
case "ordered-or-ranked":
|
|
890
|
-
return "orderedOrRanked";
|
|
891
|
-
case "date-and-time":
|
|
892
|
-
return "dateAndTime";
|
|
893
|
-
default:
|
|
894
|
-
return field.layerField.valueType;
|
|
895
|
-
}
|
|
896
|
-
}
|
|
897
|
-
_getDisplayString(value) {
|
|
898
|
-
const { props } = this;
|
|
899
|
-
const { fieldInfo } = props;
|
|
900
|
-
switch (fieldInfo.simpleFieldType) {
|
|
901
|
-
case SimpleFieldTypes.DATE:
|
|
902
|
-
return this._getDateString(value);
|
|
903
|
-
case SimpleFieldTypes.TIMESTAMP_OFFSET:
|
|
904
|
-
return this._getTimestampOffsetString(value);
|
|
905
|
-
case SimpleFieldTypes.DATE_ONLY:
|
|
906
|
-
return this._getDateOnlyString(value);
|
|
907
|
-
case SimpleFieldTypes.TIME_ONLY:
|
|
908
|
-
return this._getTimeOnlyString(value);
|
|
909
|
-
case SimpleFieldTypes.NUMBER:
|
|
910
|
-
return this._getNumberString(value);
|
|
911
|
-
case SimpleFieldTypes.GUID:
|
|
912
|
-
return this._getGuidString(value);
|
|
913
|
-
default:
|
|
914
|
-
// string, oid, global-id
|
|
915
|
-
return `${value}`;
|
|
916
|
-
}
|
|
917
|
-
}
|
|
918
|
-
_getDateString(value) {
|
|
919
|
-
const { modules, view } = this.props;
|
|
920
|
-
if (view && view.timeZone === "unknown") {
|
|
921
|
-
return modules.intl.formatDate(value, {
|
|
922
|
-
...modules.intl.convertDateFormatToIntlOptions("short-date-short-time"),
|
|
923
|
-
timeZone: "utc",
|
|
924
|
-
timeZoneName: "shortOffset"
|
|
925
|
-
});
|
|
987
|
+
_getDateOnlyString(value) {
|
|
988
|
+
const { props } = this;
|
|
989
|
+
const { modules } = props;
|
|
990
|
+
return modules.intl.formatDateOnly(value, modules.intl.convertDateFormatToIntlOptions("short-date"));
|
|
926
991
|
}
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
"local Time",
|
|
941
|
-
intl.formatTimestamp(timestamp, intl.convertDateFormatToIntlOptions("short-date-short-time"))
|
|
942
|
-
);
|
|
943
|
-
console.log(
|
|
944
|
-
"mapView Time (except unknown)",
|
|
945
|
-
intl.formatTimestamp(timestamp, {
|
|
946
|
-
...intl.convertDateFormatToIntlOptions("short-date-short-time"),
|
|
947
|
-
timeZone: view.timeZone,
|
|
948
|
-
})
|
|
949
|
-
);
|
|
950
|
-
console.log(
|
|
951
|
-
"UTC Time (mapView time unknown)",
|
|
952
|
-
intl.formatTimestamp(timestamp, {
|
|
953
|
-
...intl.convertDateFormatToIntlOptions("short-date-short-time"),
|
|
954
|
-
timeZone: "utc",
|
|
955
|
-
timeZoneName: "shortOffset"
|
|
956
|
-
})
|
|
957
|
-
);
|
|
958
|
-
console.log(
|
|
959
|
-
"Raw",
|
|
960
|
-
intl.formatTimestamp(timestamp, {
|
|
961
|
-
...intl.convertDateFormatToIntlOptions("short-date-short-time"),
|
|
962
|
-
timeZoneName: "shortOffset"
|
|
963
|
-
})
|
|
964
|
-
);
|
|
965
|
-
*/
|
|
966
|
-
const { modules, view } = this.props;
|
|
967
|
-
if (typeof value === "string") {
|
|
968
|
-
// raw value from layer
|
|
969
|
-
if (view && view.timeZone === "unknown") {
|
|
970
|
-
return modules.intl.formatTimestamp(value, {
|
|
971
|
-
...modules.intl.convertDateFormatToIntlOptions("short-date-short-time"),
|
|
972
|
-
timeZone: "utc",
|
|
973
|
-
timeZoneName: "shortOffset"
|
|
974
|
-
});
|
|
975
|
-
}
|
|
976
|
-
else {
|
|
977
|
-
return modules.intl.formatTimestamp(value, {
|
|
978
|
-
...modules.intl.convertDateFormatToIntlOptions("short-date-short-time"),
|
|
979
|
-
timeZone: view?.timeZone || "system"
|
|
980
|
-
});
|
|
981
|
-
}
|
|
992
|
+
_getTimeOnlyString(value) {
|
|
993
|
+
const { props } = this;
|
|
994
|
+
const { modules } = props;
|
|
995
|
+
if (typeof value === "string") {
|
|
996
|
+
return modules.intl.formatTimeOnly(value, modules.intl.convertDateFormatToIntlOptions("short-date-long-time"));
|
|
997
|
+
}
|
|
998
|
+
else {
|
|
999
|
+
// UNIX timestamp
|
|
1000
|
+
return modules.intl.formatDate(value, {
|
|
1001
|
+
...modules.intl.convertDateFormatToIntlOptions("long-time"),
|
|
1002
|
+
timeZone: "utc"
|
|
1003
|
+
});
|
|
1004
|
+
}
|
|
982
1005
|
}
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
return this._getDateString(value);
|
|
986
|
-
}
|
|
987
|
-
}
|
|
988
|
-
_getDateOnlyString(value) {
|
|
989
|
-
const { props } = this;
|
|
990
|
-
const { modules } = props;
|
|
991
|
-
return modules.intl.formatDateOnly(value, modules.intl.convertDateFormatToIntlOptions("short-date"));
|
|
992
|
-
}
|
|
993
|
-
_getTimeOnlyString(value) {
|
|
994
|
-
const { props } = this;
|
|
995
|
-
const { modules } = props;
|
|
996
|
-
if (typeof value === "string") {
|
|
997
|
-
return modules.intl.formatTimeOnly(value, modules.intl.convertDateFormatToIntlOptions("short-date-long-time"));
|
|
1006
|
+
_getGuidString(value) {
|
|
1007
|
+
return value.startsWith("{") ? value : `{${value}}`;
|
|
998
1008
|
}
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
}
|
|
1006
|
-
|
|
1007
|
-
_getGuidString(value) {
|
|
1008
|
-
return value.startsWith("{") ? value : `{${value}}`;
|
|
1009
|
-
}
|
|
1010
|
-
_getNumberString(value) {
|
|
1011
|
-
return this.props.modules.intl.formatNumber(value);
|
|
1012
|
-
}
|
|
1013
|
-
_printNumValue(value) {
|
|
1014
|
-
return isDefined(value) ? this._getNumberString(Math.round(value * 100) / 100) : `--`;
|
|
1015
|
-
}
|
|
1016
|
-
static get assetsDirs() { return ["assets"]; }
|
|
1017
|
-
get _hostElement() { return index.getElement(this); }
|
|
1009
|
+
_getNumberString(value) {
|
|
1010
|
+
return this.props.modules.intl.formatNumber(value);
|
|
1011
|
+
}
|
|
1012
|
+
_printNumValue(value) {
|
|
1013
|
+
return isDefined(value) ? this._getNumberString(Math.round(value * 100) / 100) : `--`;
|
|
1014
|
+
}
|
|
1015
|
+
static get assetsDirs() { return ["assets"]; }
|
|
1016
|
+
get _hostElement() { return index.getElement(this); }
|
|
1018
1017
|
};
|
|
1019
1018
|
ArcgisFieldInfo.style = fieldInfoScss;
|
|
1020
1019
|
|