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