@arcgis/common-components 4.29.0-beta.47 → 4.29.0-beta.49
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-a91ab432.js +2 -0
- package/dist/arcgis-common-components/p-d3d1695f.entry.js +1 -0
- package/dist/cjs/arcgis-common-components.cjs.js +3 -3
- package/dist/cjs/arcgis-field-info.cjs.entry.js +903 -899
- package/dist/cjs/arcgis-field-pick-list.cjs.entry.js +216 -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 +259 -272
- package/dist/components/field-info.js +961 -901
- package/dist/esm/arcgis-common-components.js +4 -4
- package/dist/esm/arcgis-field-info.entry.js +907 -903
- package/dist/esm/arcgis-field-pick-list.entry.js +216 -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,230 @@ 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/iu.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,
|
|
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
|
-
const typeIdField = layer.typeIdField;
|
|
211
|
-
const types = layer.types;
|
|
212
|
-
let fieldDomains = undefined;
|
|
213
|
-
const field = layer.fields.find((field) => field.name === fieldName);
|
|
214
|
-
const fieldDomain = field.domain;
|
|
215
|
-
if (typeIdField && types) {
|
|
216
|
-
// layer has types
|
|
217
|
-
if (typeIdField === fieldName) {
|
|
218
|
-
// this is the field with the types
|
|
219
|
-
fieldDomains = types.map((type) => {
|
|
220
|
-
// fake coded Values
|
|
221
|
-
return {
|
|
222
|
-
code: type.id,
|
|
223
|
-
name: type.name
|
|
224
|
-
};
|
|
225
|
-
});
|
|
205
|
+
const { layer, modules } = props;
|
|
206
|
+
if (layer.type !== "feature") {
|
|
207
|
+
return;
|
|
226
208
|
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
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
|
+
({
|
|
221
|
+
code: type.id,
|
|
222
|
+
name: type.name
|
|
223
|
+
}));
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
// field does not have types; look farther inside the types
|
|
227
|
+
fieldDomains = [];
|
|
228
|
+
types.forEach((type) => {
|
|
229
|
+
if (!type.domains || !type.domains[fieldName] || type.domains[fieldName].type === "inherited") {
|
|
230
|
+
const domain = fieldDomain;
|
|
231
|
+
if (domain?.codedValues) {
|
|
232
|
+
domain.codedValues.forEach(async (codedValue) => {
|
|
233
|
+
let found = false;
|
|
234
|
+
fieldDomains.forEach((codedVal) => {
|
|
235
|
+
if (codedVal.code === codedValue.code) {
|
|
236
|
+
found = true;
|
|
237
|
+
if (`, ${codedVal.name},`.indexOf(`, ${codedValue.name},`) === -1) {
|
|
238
|
+
codedVal.name += `, ${codedValue.name}`;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
if (!found) {
|
|
243
|
+
fieldDomains.push(modules.esriLang.clone(codedValue));
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
}
|
|
242
247
|
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
248
|
+
else if (type.domains?.[fieldName]?.codedValues) {
|
|
249
|
+
type.domains[fieldName].codedValues.forEach(async (codedValue) => {
|
|
250
|
+
let found = false;
|
|
251
|
+
fieldDomains.forEach((codedVal) => {
|
|
252
|
+
if (codedVal.code === codedValue.code) {
|
|
253
|
+
found = true;
|
|
254
|
+
if (`, ${codedVal.name},`.indexOf(`, ${codedValue.name},`) === -1) {
|
|
255
|
+
codedVal.name += `, ${codedValue.name}`;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
if (!found) {
|
|
260
|
+
fieldDomains.push(modules.esriLang.clone(codedValue));
|
|
261
|
+
}
|
|
262
|
+
});
|
|
258
263
|
}
|
|
259
|
-
}
|
|
260
264
|
});
|
|
261
|
-
if (!found) {
|
|
262
|
-
fieldDomains.push(modules.esriLang.clone(codedValue));
|
|
263
|
-
}
|
|
264
|
-
});
|
|
265
265
|
}
|
|
266
|
-
|
|
266
|
+
if (!fieldDomains?.length && fieldDomain?.codedValues) {
|
|
267
|
+
fieldDomains = modules.esriLang.clone(fieldDomain.codedValues);
|
|
268
|
+
}
|
|
267
269
|
}
|
|
268
|
-
if (
|
|
269
|
-
|
|
270
|
+
else if (fieldDomain?.codedValues) {
|
|
271
|
+
// domains directly on the layer field
|
|
272
|
+
fieldDomains = field.domain.codedValues;
|
|
270
273
|
}
|
|
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;
|
|
274
|
+
return fieldDomains?.length ? fieldDomains : null;
|
|
277
275
|
}
|
|
278
276
|
|
|
279
277
|
/**
|
|
@@ -281,66 +279,66 @@ function getCodedValues(fieldName, props) {
|
|
|
281
279
|
* @param props - properties containing layer and view
|
|
282
280
|
*/
|
|
283
281
|
async function getOneFeature(props) {
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
}
|
|
288
|
-
if ((layer.type === "feature" && !layer.url) || layer.type === "wfs") {
|
|
289
|
-
// feature collection or wfs
|
|
290
|
-
const query = layer.createQuery();
|
|
291
|
-
query.start = 0;
|
|
292
|
-
query.num = 5;
|
|
293
|
-
query.outFields = ["*"];
|
|
294
|
-
const result = await layer.queryFeatures(query);
|
|
295
|
-
if (result.features?.length) {
|
|
296
|
-
return result;
|
|
297
|
-
}
|
|
298
|
-
else {
|
|
299
|
-
throw new Error("could not get feature");
|
|
282
|
+
const { view, layer } = props;
|
|
283
|
+
if (layer.type === "imagery" || layer.type === "imagery-tile") {
|
|
284
|
+
throw new Error("could not get feature");
|
|
300
285
|
}
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
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
|
-
}
|
|
286
|
+
if ((layer.type === "feature" && !layer.url) || layer.type === "wfs") {
|
|
287
|
+
// feature collection or wfs
|
|
288
|
+
const query = layer.createQuery();
|
|
289
|
+
query.start = 0;
|
|
290
|
+
query.num = 5;
|
|
291
|
+
query.outFields = ["*"];
|
|
292
|
+
const result = await layer.queryFeatures(query);
|
|
293
|
+
if (result.features?.length) {
|
|
294
|
+
return result;
|
|
295
|
+
}
|
|
296
|
+
else {
|
|
297
|
+
throw new Error("could not get feature");
|
|
298
|
+
}
|
|
326
299
|
}
|
|
327
300
|
else {
|
|
328
|
-
|
|
329
|
-
|
|
301
|
+
// service
|
|
302
|
+
if (!view) {
|
|
303
|
+
// get feature from service directly
|
|
304
|
+
return _queryOneFeature(props);
|
|
305
|
+
}
|
|
306
|
+
const layerView = (await view.whenLayerView(layer));
|
|
307
|
+
const hasAllFields = layerView.availableFields.length === layer.fields.length;
|
|
308
|
+
if (hasAllFields || (["stream", "ogc-feature"].indexOf(layer.type) > -1 && layerView.availableFields.length > 0)) {
|
|
309
|
+
// features on client have all fields
|
|
310
|
+
// or we can't make a server query, so we take what we can get
|
|
311
|
+
const query = layer.createQuery();
|
|
312
|
+
query.start = 0;
|
|
313
|
+
query.num = 5;
|
|
314
|
+
query.outFields = ["*"];
|
|
315
|
+
const result = await layerView.queryFeatures(query);
|
|
316
|
+
if (result.features?.length) {
|
|
317
|
+
// client side features
|
|
318
|
+
return result;
|
|
319
|
+
}
|
|
320
|
+
else {
|
|
321
|
+
// get feature from service
|
|
322
|
+
return _queryOneFeature(props);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
else {
|
|
326
|
+
// get feature from service
|
|
327
|
+
return _queryOneFeature(props);
|
|
328
|
+
}
|
|
330
329
|
}
|
|
331
|
-
}
|
|
332
330
|
}
|
|
333
331
|
async function _queryOneFeature(props) {
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
332
|
+
const { layer, modules } = props;
|
|
333
|
+
if (["imagery", "imagery-tile", "stream", "ogc-feature"].indexOf(layer.type) > -1) {
|
|
334
|
+
throw new Error("cannot get feature from service");
|
|
335
|
+
}
|
|
336
|
+
const query = new modules.Query({
|
|
337
|
+
where: "1=1",
|
|
338
|
+
outFields: ["*"],
|
|
339
|
+
returnGeometry: false
|
|
340
|
+
});
|
|
341
|
+
return layer.queryFeatures(query);
|
|
344
342
|
}
|
|
345
343
|
/**
|
|
346
344
|
* Returns feature count of layer
|
|
@@ -348,673 +346,679 @@ async function _queryOneFeature(props) {
|
|
|
348
346
|
* @param mapView - View
|
|
349
347
|
*/
|
|
350
348
|
async function getFeatureCountCommon(layer, view) {
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
349
|
+
if (layer.type === "feature" && !layer.url) {
|
|
350
|
+
return getFeatureCountForCollection(layer);
|
|
351
|
+
}
|
|
352
|
+
else if (layer.type === "feature" ||
|
|
353
|
+
layer.type === "csv" ||
|
|
354
|
+
layer.type === "scene" ||
|
|
355
|
+
layer.type === "wfs" ||
|
|
356
|
+
layer.type === "geojson") {
|
|
357
|
+
return await layer.queryFeatureCount();
|
|
358
|
+
}
|
|
359
|
+
else if (view && (layer.type === "stream" || layer.type === "ogc-feature")) {
|
|
360
|
+
return getFeatureCountFromView(layer, view);
|
|
361
|
+
}
|
|
362
|
+
return undefined;
|
|
365
363
|
}
|
|
366
364
|
/**
|
|
367
365
|
* Returns feature count of feature collection layer
|
|
368
366
|
* @param layer - FeatureLayer
|
|
369
367
|
*/
|
|
370
368
|
async function getFeatureCountForCollection(layer) {
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
369
|
+
const query = layer.createQuery();
|
|
370
|
+
query.outFields = ["*"];
|
|
371
|
+
const result = await layer.queryFeatures(query);
|
|
372
|
+
if (result.features?.length) {
|
|
373
|
+
return result.features.length;
|
|
374
|
+
}
|
|
375
|
+
else {
|
|
376
|
+
throw new Error("could not get feature count");
|
|
377
|
+
}
|
|
380
378
|
}
|
|
381
379
|
/**
|
|
382
380
|
* Returns feature count of feature collection layer
|
|
383
381
|
* @param layer - StreamLayer | OGCFeatureLayer
|
|
384
382
|
*/
|
|
385
383
|
async function getFeatureCountFromView(layer, view) {
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
384
|
+
// we can only get the features from the map
|
|
385
|
+
const layerView = (await view.whenLayerView(layer));
|
|
386
|
+
return layerView.queryFeatureCount();
|
|
389
387
|
}
|
|
390
388
|
|
|
391
389
|
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
390
|
|
|
393
391
|
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
|
-
|
|
392
|
+
constructor(hostRef) {
|
|
393
|
+
index.registerInstance(this, hostRef);
|
|
394
|
+
this.arcgisFieldInfoComplete = index.createEvent(this, "arcgisFieldInfoComplete", 7);
|
|
395
|
+
this.view = undefined;
|
|
396
|
+
this.layer = undefined;
|
|
397
|
+
this.fieldName = undefined;
|
|
398
|
+
this.hideStatistics = false;
|
|
399
|
+
this.oneFeatureResponse = undefined;
|
|
400
|
+
this.oneFeatureResponseStatus = Status.MISSING;
|
|
401
|
+
this.statistics = undefined;
|
|
402
|
+
this.statisticsStatus = Status.MISSING;
|
|
403
|
+
this.uniqueValues = undefined;
|
|
404
|
+
this.uniqueValuesStatus = Status.MISSING;
|
|
405
|
+
this._lang = "";
|
|
406
|
+
this._t9nLocale = "";
|
|
407
|
+
this._t9nStrings = undefined;
|
|
408
|
+
}
|
|
409
|
+
//--------------------------------------------------------------------------
|
|
410
|
+
//
|
|
411
|
+
// Lifecycle
|
|
412
|
+
//
|
|
413
|
+
//--------------------------------------------------------------------------
|
|
414
|
+
async componentWillLoad() {
|
|
415
|
+
await index$1.F(this, index.getAssetPath("./assets"));
|
|
416
|
+
const esriLang = await index$1.importCoreLang();
|
|
417
|
+
const esriConfig = await index$1.importConfig();
|
|
418
|
+
const intl = await index$1.importIntl();
|
|
419
|
+
const Query = await index$1.importRestSupportQuery();
|
|
420
|
+
const summaryStatistics = await index$1.importSmartMappingStatisticsSummaryStatistics();
|
|
421
|
+
const uniqueValues = await index$1.importSmartMappingStatisticsUniqueValues();
|
|
422
|
+
const { view, layer, fieldName, hideStatistics } = this;
|
|
423
|
+
let sublayerFL;
|
|
424
|
+
if (layer.declaredClass === "esri.layers.support.Sublayer") {
|
|
425
|
+
// need to create a FeatureLayer
|
|
426
|
+
const sublayer = layer;
|
|
427
|
+
const { whenOnce } = await index$1.importCoreReactiveUtils();
|
|
428
|
+
if (view)
|
|
429
|
+
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(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 += 1) {
|
|
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
|
|
458
523
|
}
|
|
459
|
-
|
|
460
|
-
|
|
524
|
+
disconnectedCallback() {
|
|
525
|
+
index$1.U(this);
|
|
461
526
|
}
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
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())));
|
|
466
539
|
}
|
|
467
|
-
|
|
468
|
-
|
|
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)));
|
|
469
545
|
}
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
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,
|
|
645
|
+
// eslint-disable-next-line no-template-curly-in-string
|
|
646
|
+
_t9nStrings.fieldNumDecimalPlaces.replace("${number}", num.toString()))));
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
return (index.h("div", { class: "section" }, index.h("div", { class: "title" }, _t9nStrings.fieldDecimalPlaces), index.h("div", { class: "missing" }, _t9nStrings.fieldDecimalPlacesNotAvailable)));
|
|
651
|
+
}
|
|
652
|
+
renderFieldStatistics() {
|
|
653
|
+
const { statisticsStatus, uniqueValuesStatus, hideStatistics, _t9nStrings, props } = this;
|
|
654
|
+
const { layer, fieldInfo } = props;
|
|
655
|
+
if (hideStatistics) {
|
|
656
|
+
this.arcgisFieldInfoComplete.emit();
|
|
657
|
+
return index.h(index.Fragment, null);
|
|
658
|
+
}
|
|
659
|
+
if (["stream", "imagery", "imagery-tile"].indexOf(layer.type) > -1 ||
|
|
660
|
+
["long"].indexOf(fieldInfo.layerField.type) > -1) {
|
|
661
|
+
// can't get statistics
|
|
662
|
+
this.arcgisFieldInfoComplete.emit();
|
|
663
|
+
return index.h(index.Fragment, null);
|
|
664
|
+
}
|
|
665
|
+
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()))));
|
|
666
|
+
}
|
|
667
|
+
renderNoStatistics() {
|
|
668
|
+
const { _t9nStrings } = this;
|
|
669
|
+
return (index.h("div", { key: "field-info-statistics-content", ref: () => this.arcgisFieldInfoComplete.emit(), class: "missing" }, _t9nStrings.fieldStatisticsNotAvailable));
|
|
670
|
+
}
|
|
671
|
+
renderStatistics() {
|
|
672
|
+
const { props } = this;
|
|
673
|
+
const { fieldInfo } = props;
|
|
674
|
+
switch (this._getStatisticsType(fieldInfo)) {
|
|
675
|
+
case SimpleFieldTypes.NUMBER:
|
|
676
|
+
return this.renderNumberStatistics();
|
|
677
|
+
case SimpleFieldTypes.STRING:
|
|
678
|
+
case SimpleFieldTypes.OID:
|
|
679
|
+
case SimpleFieldTypes.GUID:
|
|
680
|
+
return this.renderStringStatistics();
|
|
681
|
+
case SimpleFieldTypes.DATE:
|
|
682
|
+
case SimpleFieldTypes.DATE_ONLY:
|
|
683
|
+
case SimpleFieldTypes.TIME_ONLY:
|
|
684
|
+
case SimpleFieldTypes.TIMESTAMP_OFFSET:
|
|
685
|
+
return this.renderDateStatistics();
|
|
686
|
+
default:
|
|
687
|
+
return index.h(index.Fragment, null);
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
renderNumberStatistics() {
|
|
691
|
+
const { statistics, _t9nStrings } = this;
|
|
692
|
+
if (!statistics) {
|
|
693
|
+
return this.renderNoStatistics();
|
|
694
|
+
}
|
|
695
|
+
const { statistics: statStrings } = _t9nStrings;
|
|
696
|
+
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()));
|
|
697
|
+
}
|
|
698
|
+
renderStringStatistics() {
|
|
699
|
+
const { statistics, uniqueValuesStatus, _t9nStrings } = this;
|
|
700
|
+
const { statistics: statStrings } = _t9nStrings;
|
|
701
|
+
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()));
|
|
702
|
+
}
|
|
703
|
+
renderDateStatistics() {
|
|
704
|
+
// TODO UTC offset
|
|
705
|
+
const { statistics, view, props, _t9nStrings } = this;
|
|
706
|
+
const { fieldInfo } = props;
|
|
707
|
+
if (!statistics) {
|
|
708
|
+
return this.renderNoStatistics();
|
|
709
|
+
}
|
|
710
|
+
const { statistics: statStrings } = _t9nStrings;
|
|
711
|
+
const dateRange = statistics.max - statistics.min;
|
|
712
|
+
const years = Math.floor(dateRange / 31536000000);
|
|
713
|
+
let months = Math.floor((dateRange - years * 31536000000) / 2628000000);
|
|
714
|
+
let days = Math.ceil((dateRange - months * 2628000000) / 86400000);
|
|
715
|
+
if (days >= 30) {
|
|
716
|
+
months += 1;
|
|
717
|
+
days = 0;
|
|
718
|
+
}
|
|
719
|
+
let timeSpan = years === 1
|
|
720
|
+
? statStrings.timeSpanOptions.year
|
|
721
|
+
: years > 1
|
|
722
|
+
? // eslint-disable-next-line no-template-curly-in-string
|
|
723
|
+
statStrings.timeSpanOptions.years.replace("${years}", years.toString())
|
|
724
|
+
: "";
|
|
725
|
+
timeSpan += years > 0 && (months > 0 || days > 0) ? ", " : "";
|
|
726
|
+
timeSpan +=
|
|
727
|
+
months === 1
|
|
728
|
+
? statStrings.timeSpanOptions.month
|
|
729
|
+
: months > 1
|
|
730
|
+
? // eslint-disable-next-line no-template-curly-in-string
|
|
731
|
+
statStrings.timeSpanOptions.months.replace("${months}", months.toString())
|
|
732
|
+
: "";
|
|
733
|
+
timeSpan += months > 0 && days > 0 ? ", " : "";
|
|
734
|
+
timeSpan +=
|
|
735
|
+
days === 1
|
|
736
|
+
? statStrings.timeSpanOptions.day
|
|
737
|
+
: days > 1
|
|
738
|
+
? // eslint-disable-next-line no-template-curly-in-string
|
|
739
|
+
statStrings.timeSpanOptions.days.replace("${days}", days.toString())
|
|
740
|
+
: "";
|
|
741
|
+
const showStats = fieldInfo.simpleFieldType !== SimpleFieldTypes.TIMESTAMP_OFFSET ||
|
|
742
|
+
!view ||
|
|
743
|
+
view.timeZone !== "unknown";
|
|
744
|
+
const isTimeOnly = fieldInfo.simpleFieldType === SimpleFieldTypes.TIME_ONLY;
|
|
745
|
+
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()));
|
|
746
|
+
}
|
|
747
|
+
renderTopValues() {
|
|
748
|
+
const { uniqueValues, uniqueValuesStatus, _t9nStrings, props } = this;
|
|
749
|
+
const { fieldInfo } = props;
|
|
750
|
+
const { statistics: statStrings } = _t9nStrings;
|
|
475
751
|
if (uniqueValues?.uniqueValueInfos?.length) {
|
|
476
|
-
|
|
752
|
+
const infos = uniqueValues.uniqueValueInfos;
|
|
753
|
+
infos.sort((a, b) => (a.count < b.count ? 1 : a.count > b.count ? -1 : 0));
|
|
754
|
+
const codedValues = fieldInfo.codedValues;
|
|
755
|
+
const values = infos
|
|
756
|
+
.filter((info) => info.value !== null)
|
|
757
|
+
.filter((info, idx) => info && idx < 10)
|
|
758
|
+
.map((info) => {
|
|
759
|
+
let value = info.value;
|
|
760
|
+
if (codedValues) {
|
|
761
|
+
codedValues.forEach((codeValue) => {
|
|
762
|
+
if (value === codeValue.code) {
|
|
763
|
+
value = codeValue.name;
|
|
764
|
+
}
|
|
765
|
+
});
|
|
766
|
+
}
|
|
767
|
+
else {
|
|
768
|
+
value = this._getDisplayString(value);
|
|
769
|
+
}
|
|
770
|
+
return (index.h("div", { class: "statistics-row" }, index.h("div", { class: "data" }, `${value}`), index.h("div", { class: `$"data" $"count"` }, this._printNumValue(info.count))));
|
|
771
|
+
});
|
|
772
|
+
if (!values.length) {
|
|
773
|
+
return index.h(index.Fragment, null);
|
|
774
|
+
}
|
|
775
|
+
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));
|
|
477
776
|
}
|
|
478
777
|
else {
|
|
479
|
-
|
|
778
|
+
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
|
|
779
|
+
? _t9nStrings.fieldUniqueValuesNotAvailable
|
|
780
|
+
: _t9nStrings.fieldSampleRetrieving))));
|
|
480
781
|
}
|
|
481
|
-
}
|
|
482
|
-
catch (error) {
|
|
483
|
-
this.uniqueValuesStatus = Status.FAILED;
|
|
484
|
-
}
|
|
485
782
|
}
|
|
486
|
-
|
|
487
|
-
|
|
783
|
+
renderNullValues() {
|
|
784
|
+
const { statistics, uniqueValues, _t9nStrings } = this;
|
|
785
|
+
const { statistics: statStrings } = _t9nStrings;
|
|
786
|
+
let count = statistics?.nullcount;
|
|
787
|
+
if (!isDefined(count) && uniqueValues) {
|
|
788
|
+
const infos = uniqueValues.uniqueValueInfos;
|
|
789
|
+
for (let i = 0; i < infos.length; i += 1) {
|
|
790
|
+
const info = infos[i];
|
|
791
|
+
if (info.value === null) {
|
|
792
|
+
count = info.count;
|
|
793
|
+
break;
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
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" }, `${Number.parseInt(count).toLocaleString()}`))));
|
|
488
798
|
}
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
799
|
+
// --------------------------------------------------------------------------
|
|
800
|
+
//
|
|
801
|
+
// Private methods
|
|
802
|
+
//
|
|
803
|
+
// --------------------------------------------------------------------------
|
|
804
|
+
_getFieldTypeLabel(fieldType) {
|
|
805
|
+
const { _t9nStrings } = this;
|
|
806
|
+
const fieldTypes = _t9nStrings.fieldTypes;
|
|
807
|
+
switch (fieldType) {
|
|
808
|
+
case "small-integer":
|
|
809
|
+
return fieldTypes.smallInteger;
|
|
810
|
+
case "big-integer":
|
|
811
|
+
return fieldTypes.bigInteger;
|
|
812
|
+
case "integer":
|
|
813
|
+
return fieldTypes.integer;
|
|
814
|
+
case "single":
|
|
815
|
+
return fieldTypes.single;
|
|
816
|
+
case "double":
|
|
817
|
+
return fieldTypes.double;
|
|
818
|
+
case "long":
|
|
819
|
+
return fieldTypes.long;
|
|
820
|
+
case "string":
|
|
821
|
+
return fieldTypes.string;
|
|
822
|
+
case "date":
|
|
823
|
+
return fieldTypes.date;
|
|
824
|
+
case "date-only":
|
|
825
|
+
return fieldTypes.dateOnly;
|
|
826
|
+
case "time-only":
|
|
827
|
+
return fieldTypes.timeOnly;
|
|
828
|
+
case "timestamp-offset":
|
|
829
|
+
return fieldTypes.timestampOffset;
|
|
830
|
+
case "oid":
|
|
831
|
+
return fieldTypes.oid;
|
|
832
|
+
case "guid":
|
|
833
|
+
return fieldTypes.guid;
|
|
834
|
+
case "global-id":
|
|
835
|
+
return fieldTypes.globalId;
|
|
836
|
+
default:
|
|
837
|
+
return fieldTypes.string;
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
_getStatisticsType(fieldInfo) {
|
|
841
|
+
// "count-or-amount","percentage-or-ratio","measurement","unique-identifier","coordinate","binary"
|
|
842
|
+
// "name-or-title","type-or-category","description","location-or-place-name","ordered-or-ranked","date-and-time"
|
|
843
|
+
switch (fieldInfo.layerField.type) {
|
|
844
|
+
case "small-integer":
|
|
845
|
+
case "big-integer":
|
|
846
|
+
case "integer":
|
|
847
|
+
case "single":
|
|
848
|
+
case "double": {
|
|
849
|
+
if (fieldInfo.codedValues) {
|
|
850
|
+
return SimpleFieldTypes.STRING;
|
|
851
|
+
}
|
|
852
|
+
switch (fieldInfo.layerField.valueType) {
|
|
853
|
+
case "name-or-title":
|
|
854
|
+
case "type-or-category":
|
|
855
|
+
case "description":
|
|
856
|
+
case "location-or-place-name":
|
|
857
|
+
case "ordered-or-ranked":
|
|
858
|
+
case "binary":
|
|
859
|
+
//case "date-and-time":
|
|
860
|
+
return SimpleFieldTypes.STRING;
|
|
861
|
+
default:
|
|
862
|
+
return SimpleFieldTypes.NUMBER;
|
|
863
|
+
}
|
|
503
864
|
}
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
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;
|
|
865
|
+
case "string":
|
|
866
|
+
return SimpleFieldTypes.STRING;
|
|
867
|
+
case "date":
|
|
868
|
+
return SimpleFieldTypes.DATE;
|
|
869
|
+
case "timestamp-offset":
|
|
870
|
+
return SimpleFieldTypes.TIMESTAMP_OFFSET;
|
|
871
|
+
case "date-only":
|
|
872
|
+
return SimpleFieldTypes.DATE_ONLY;
|
|
873
|
+
case "time-only":
|
|
874
|
+
return SimpleFieldTypes.TIME_ONLY;
|
|
875
|
+
default:
|
|
876
|
+
return SimpleFieldTypes.STRING;
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
_getFieldValueTypeCamelCase(field) {
|
|
880
|
+
switch (field.layerField.valueType) {
|
|
881
|
+
case "count-or-amount":
|
|
882
|
+
return "countOrAmount";
|
|
883
|
+
case "percentage-or-ratio":
|
|
884
|
+
return "percentageOrRatio";
|
|
885
|
+
case "unique-identifier":
|
|
886
|
+
return "uniqueIdentifier";
|
|
887
|
+
case "name-or-title":
|
|
888
|
+
return "nameOrTitle";
|
|
889
|
+
case "type-or-category":
|
|
890
|
+
return "typeOrCategory";
|
|
891
|
+
case "location-or-place-name":
|
|
892
|
+
return "locationOrPlaceName";
|
|
893
|
+
case "ordered-or-ranked":
|
|
894
|
+
return "orderedOrRanked";
|
|
895
|
+
case "date-and-time":
|
|
896
|
+
return "dateAndTime";
|
|
897
|
+
default:
|
|
898
|
+
return field.layerField.valueType;
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
_getDisplayString(value) {
|
|
902
|
+
const { props } = this;
|
|
903
|
+
const { fieldInfo } = props;
|
|
904
|
+
switch (fieldInfo.simpleFieldType) {
|
|
905
|
+
case SimpleFieldTypes.DATE:
|
|
906
|
+
return this._getDateString(value);
|
|
907
|
+
case SimpleFieldTypes.TIMESTAMP_OFFSET:
|
|
908
|
+
return this._getTimestampOffsetString(value);
|
|
909
|
+
case SimpleFieldTypes.DATE_ONLY:
|
|
910
|
+
return this._getDateOnlyString(value);
|
|
911
|
+
case SimpleFieldTypes.TIME_ONLY:
|
|
912
|
+
return this._getTimeOnlyString(value);
|
|
913
|
+
case SimpleFieldTypes.NUMBER:
|
|
914
|
+
return this._getNumberString(value);
|
|
915
|
+
case SimpleFieldTypes.GUID:
|
|
916
|
+
return this._getGuidString(value);
|
|
917
|
+
default:
|
|
918
|
+
// string, oid, global-id
|
|
919
|
+
return `${value}`;
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
_getDateString(value) {
|
|
923
|
+
const { modules, view } = this.props;
|
|
924
|
+
if (view && view.timeZone === "unknown") {
|
|
925
|
+
return modules.intl.formatDate(value, {
|
|
926
|
+
...modules.intl.convertDateFormatToIntlOptions("short-date-short-time"),
|
|
927
|
+
timeZone: "utc",
|
|
928
|
+
timeZoneName: "shortOffset"
|
|
929
|
+
});
|
|
930
|
+
}
|
|
931
|
+
else {
|
|
932
|
+
// known issues with formatting it-CH
|
|
933
|
+
return modules.intl.formatDate(value, {
|
|
934
|
+
...modules.intl.convertDateFormatToIntlOptions("short-date-short-time"),
|
|
935
|
+
timeZone: view?.timeZone || "system"
|
|
936
|
+
});
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
_getTimestampOffsetString(value) {
|
|
940
|
+
/*
|
|
941
|
+
const timestamp = "2023-03-19T16:00:00.123-01:00";
|
|
942
|
+
console.log("timestamp", timestamp);
|
|
943
|
+
console.log(
|
|
944
|
+
"local Time",
|
|
945
|
+
intl.formatTimestamp(timestamp, intl.convertDateFormatToIntlOptions("short-date-short-time"))
|
|
946
|
+
);
|
|
947
|
+
console.log(
|
|
948
|
+
"mapView Time (except unknown)",
|
|
949
|
+
intl.formatTimestamp(timestamp, {
|
|
950
|
+
...intl.convertDateFormatToIntlOptions("short-date-short-time"),
|
|
951
|
+
timeZone: view.timeZone,
|
|
952
|
+
})
|
|
953
|
+
);
|
|
954
|
+
console.log(
|
|
955
|
+
"UTC Time (mapView time unknown)",
|
|
956
|
+
intl.formatTimestamp(timestamp, {
|
|
957
|
+
...intl.convertDateFormatToIntlOptions("short-date-short-time"),
|
|
958
|
+
timeZone: "utc",
|
|
959
|
+
timeZoneName: "shortOffset"
|
|
960
|
+
})
|
|
961
|
+
);
|
|
962
|
+
console.log(
|
|
963
|
+
"Raw",
|
|
964
|
+
intl.formatTimestamp(timestamp, {
|
|
965
|
+
...intl.convertDateFormatToIntlOptions("short-date-short-time"),
|
|
966
|
+
timeZoneName: "shortOffset"
|
|
967
|
+
})
|
|
968
|
+
);
|
|
969
|
+
*/
|
|
970
|
+
const { modules, view } = this.props;
|
|
971
|
+
if (typeof value === "string") {
|
|
972
|
+
// raw value from layer
|
|
973
|
+
if (view && view.timeZone === "unknown") {
|
|
974
|
+
return modules.intl.formatTimestamp(value, {
|
|
975
|
+
...modules.intl.convertDateFormatToIntlOptions("short-date-short-time"),
|
|
976
|
+
timeZone: "utc",
|
|
977
|
+
timeZoneName: "shortOffset"
|
|
978
|
+
});
|
|
979
|
+
}
|
|
980
|
+
else {
|
|
981
|
+
return modules.intl.formatTimestamp(value, {
|
|
982
|
+
...modules.intl.convertDateFormatToIntlOptions("short-date-short-time"),
|
|
983
|
+
timeZone: view?.timeZone || "system"
|
|
984
|
+
});
|
|
760
985
|
}
|
|
761
|
-
});
|
|
762
986
|
}
|
|
763
987
|
else {
|
|
764
|
-
|
|
988
|
+
// e.g. UNIX timestamp from statistics call
|
|
989
|
+
return this._getDateString(value);
|
|
765
990
|
}
|
|
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
991
|
}
|
|
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
|
-
});
|
|
992
|
+
_getDateOnlyString(value) {
|
|
993
|
+
const { props } = this;
|
|
994
|
+
const { modules } = props;
|
|
995
|
+
return modules.intl.formatDateOnly(value, modules.intl.convertDateFormatToIntlOptions("short-date"));
|
|
926
996
|
}
|
|
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
|
-
}
|
|
997
|
+
_getTimeOnlyString(value) {
|
|
998
|
+
const { props } = this;
|
|
999
|
+
const { modules } = props;
|
|
1000
|
+
if (typeof value === "string") {
|
|
1001
|
+
return modules.intl.formatTimeOnly(value, modules.intl.convertDateFormatToIntlOptions("short-date-long-time"));
|
|
1002
|
+
}
|
|
1003
|
+
else {
|
|
1004
|
+
// UNIX timestamp
|
|
1005
|
+
return modules.intl.formatDate(value, {
|
|
1006
|
+
...modules.intl.convertDateFormatToIntlOptions("long-time"),
|
|
1007
|
+
timeZone: "utc"
|
|
1008
|
+
});
|
|
1009
|
+
}
|
|
982
1010
|
}
|
|
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"));
|
|
1011
|
+
_getGuidString(value) {
|
|
1012
|
+
return value.startsWith("{") ? value : `{${value}}`;
|
|
998
1013
|
}
|
|
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); }
|
|
1014
|
+
_getNumberString(value) {
|
|
1015
|
+
return this.props.modules.intl.formatNumber(value);
|
|
1016
|
+
}
|
|
1017
|
+
_printNumValue(value) {
|
|
1018
|
+
return isDefined(value) ? this._getNumberString(Math.round(value * 100) / 100) : `--`;
|
|
1019
|
+
}
|
|
1020
|
+
static get assetsDirs() { return ["assets"]; }
|
|
1021
|
+
get _hostElement() { return index.getElement(this); }
|
|
1018
1022
|
};
|
|
1019
1023
|
ArcgisFieldInfo.style = fieldInfoScss;
|
|
1020
1024
|
|