@arcgis/common-components 5.2.0-next.45 → 5.2.0-next.47
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/cdn/TDGIURLY.js +2 -0
- package/dist/cdn/index.js +1 -1
- package/dist/components/arcgis-field-info/customElement.js +242 -215
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/package.json +3 -3
- package/dist/cdn/XKO6BIJ2.js +0 -2
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import { c as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
2
|
+
import { c as H } from "../../chunks/runtime.js";
|
|
3
|
+
import { keyed as S } from "lit/directives/keyed.js";
|
|
4
|
+
import { ref as b } from "lit/directives/ref.js";
|
|
5
|
+
import { LitElement as Q, createEvent as D, safeClassMap as I } from "@arcgis/lumina";
|
|
6
|
+
import { Task as J } from "@lit/task";
|
|
7
|
+
import { log as C, composeMissingPropertyMessage as L } from "@arcgis/toolkit/log";
|
|
8
|
+
import { css as j, html as c } from "lit";
|
|
9
9
|
import z from "@arcgis/core/config.js";
|
|
10
10
|
import * as x from "@arcgis/core/core/reactiveUtils.js";
|
|
11
11
|
import * as h from "@arcgis/core/intl.js";
|
|
12
|
-
import * as
|
|
13
|
-
import * as
|
|
12
|
+
import * as A from "@arcgis/core/applications/PortalApp/layerUtils.js";
|
|
13
|
+
import * as _ from "@arcgis/core/core/lang.js";
|
|
14
14
|
import B from "@arcgis/core/smartMapping/statistics/summaryStatistics.js";
|
|
15
15
|
import K from "@arcgis/core/smartMapping/statistics/uniqueValues.js";
|
|
16
16
|
import { i as f } from "../../chunks/general.js";
|
|
17
|
-
import
|
|
18
|
-
import { i as y, a as
|
|
17
|
+
import R from "@arcgis/core/layers/support/CodedValue.js";
|
|
18
|
+
import { i as y, a as $, b as w, c as Z, d as V, e as M, f as v, g as F, h as U, j as X, k as Y, l as ee, m as te, n as O, o as ie, p as W, q as se, r as k, s as E } from "../../chunks/layer-utils.js";
|
|
19
19
|
import ae from "@arcgis/core/rest/support/Query.js";
|
|
20
20
|
import { u as re } from "../../chunks/useT9n.js";
|
|
21
|
-
function ne(
|
|
22
|
-
return
|
|
21
|
+
function ne(a) {
|
|
22
|
+
return a.associatedLayer?.url;
|
|
23
23
|
}
|
|
24
24
|
const oe = {
|
|
25
25
|
dateStyle: "short",
|
|
@@ -27,31 +27,31 @@ const oe = {
|
|
|
27
27
|
}, le = {
|
|
28
28
|
timeStyle: "medium"
|
|
29
29
|
};
|
|
30
|
-
function ue(
|
|
31
|
-
const { layer: e, fieldName: t } =
|
|
30
|
+
function ue(a) {
|
|
31
|
+
const { layer: e, fieldName: t } = a;
|
|
32
32
|
let i;
|
|
33
|
-
const
|
|
33
|
+
const r = A.supportsFieldConfiguration(e);
|
|
34
34
|
let s;
|
|
35
35
|
"popupTemplate" in e && (s = e.popupTemplate);
|
|
36
|
-
const
|
|
37
|
-
return
|
|
38
|
-
const
|
|
39
|
-
/^raster.(item|service)pixelvalue/iu.test(t) && (
|
|
36
|
+
const n = s ? s.fieldInfos : [];
|
|
37
|
+
return G(a)?.filter((d) => d.name === t).forEach((d) => {
|
|
38
|
+
const l = !r && n ? n.filter((g) => g.fieldName === d.name) : void 0, o = r ? e.getFieldAlias(t) : l?.length ? l[0].label : d.alias;
|
|
39
|
+
/^raster.(item|service)pixelvalue/iu.test(t) && (d.type = "double");
|
|
40
40
|
const u = {
|
|
41
|
-
layerField:
|
|
42
|
-
label:
|
|
41
|
+
layerField: d,
|
|
42
|
+
label: o || d.name
|
|
43
43
|
};
|
|
44
|
-
u.codedValues = fe(t,
|
|
44
|
+
u.codedValues = fe(t, a), me(u), u.simpleFieldType && (i = u);
|
|
45
45
|
}), i;
|
|
46
46
|
}
|
|
47
|
-
function
|
|
48
|
-
const { layer: e } =
|
|
49
|
-
return y(e) ||
|
|
47
|
+
function G(a) {
|
|
48
|
+
const { layer: e } = a;
|
|
49
|
+
return y(e) || $(e) || V(e) && e.rasterFields.length ? e.rasterFields : e.fields;
|
|
50
50
|
}
|
|
51
|
-
async function
|
|
52
|
-
|
|
53
|
-
const { layer: e, view: t } =
|
|
54
|
-
if (y(e) ||
|
|
51
|
+
async function P(a) {
|
|
52
|
+
a.statisticsStatus = "in-progress";
|
|
53
|
+
const { layer: e, view: t } = a;
|
|
54
|
+
if (y(e) || $(e) || F(e) || w(e))
|
|
55
55
|
throw new Error("could not get feature count");
|
|
56
56
|
try {
|
|
57
57
|
return await ge(e, t);
|
|
@@ -59,12 +59,12 @@ async function A(r) {
|
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
async function
|
|
63
|
-
const { layer: e, view: t, fieldName: i, fieldInfo:
|
|
64
|
-
if (y(e) ||
|
|
62
|
+
async function ce(a) {
|
|
63
|
+
const { layer: e, view: t, fieldName: i, fieldInfo: r } = a;
|
|
64
|
+
if (y(e) || $(e) || w(e))
|
|
65
65
|
throw new Error("could not get statistics for ImageryTileLayer/WCSLayer/VoxelLayer");
|
|
66
|
-
if (!
|
|
67
|
-
return { totalCount: await
|
|
66
|
+
if (!r || r.layerField.type === "oid" || r.layerField.type === "guid" || r.layerField.type === "global-id")
|
|
67
|
+
return { totalCount: await P(a), nullcount: 0 };
|
|
68
68
|
try {
|
|
69
69
|
const s = await B({
|
|
70
70
|
layer: e,
|
|
@@ -74,22 +74,22 @@ async function de(r) {
|
|
|
74
74
|
});
|
|
75
75
|
if (!f(s.count))
|
|
76
76
|
throw new Error("could not get statistics");
|
|
77
|
-
const
|
|
78
|
-
if (f(s.nullcount) && !
|
|
77
|
+
const n = "sourceJSON" in e && e.sourceJSON.maxRecordCount === s.count;
|
|
78
|
+
if (f(s.nullcount) && !n)
|
|
79
79
|
return { ...s, totalCount: s.count + s.nullcount };
|
|
80
80
|
{
|
|
81
|
-
const m = await
|
|
81
|
+
const m = await P(a);
|
|
82
82
|
return { ...s, totalCount: m };
|
|
83
83
|
}
|
|
84
84
|
} catch {
|
|
85
85
|
throw new Error("could not get statistics");
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
async function
|
|
89
|
-
const { layer: e, view: t, fieldName: i } =
|
|
90
|
-
if (y(e) ||
|
|
88
|
+
async function de(a) {
|
|
89
|
+
const { layer: e, view: t, fieldName: i } = a;
|
|
90
|
+
if (y(e) || $(e) || w(e))
|
|
91
91
|
throw new Error("could not get unique values for ImageryLayer/ImageryTileLayer/WCSLayer/VoxelLayer");
|
|
92
|
-
|
|
92
|
+
Z(e) && (e.outFields = ["*"]);
|
|
93
93
|
try {
|
|
94
94
|
return await K({
|
|
95
95
|
layer: e,
|
|
@@ -100,29 +100,29 @@ async function ce(r) {
|
|
|
100
100
|
throw new Error("could not get unique values");
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
-
function me(
|
|
104
|
-
switch (
|
|
103
|
+
function me(a) {
|
|
104
|
+
switch (a.layerField.type) {
|
|
105
105
|
case "string":
|
|
106
|
-
|
|
106
|
+
a.simpleFieldType = "string";
|
|
107
107
|
break;
|
|
108
108
|
case "date":
|
|
109
|
-
|
|
109
|
+
a.simpleFieldType = "date";
|
|
110
110
|
break;
|
|
111
111
|
case "timestamp-offset":
|
|
112
|
-
|
|
112
|
+
a.simpleFieldType = "timestamp-offset";
|
|
113
113
|
break;
|
|
114
114
|
case "date-only":
|
|
115
|
-
|
|
115
|
+
a.simpleFieldType = "date-only";
|
|
116
116
|
break;
|
|
117
117
|
case "time-only":
|
|
118
|
-
|
|
118
|
+
a.simpleFieldType = "time-only";
|
|
119
119
|
break;
|
|
120
120
|
case "oid":
|
|
121
|
-
|
|
121
|
+
a.simpleFieldType = "oid";
|
|
122
122
|
break;
|
|
123
123
|
case "guid":
|
|
124
124
|
case "global-id":
|
|
125
|
-
|
|
125
|
+
a.simpleFieldType = "guid";
|
|
126
126
|
break;
|
|
127
127
|
case "small-integer":
|
|
128
128
|
case "big-integer":
|
|
@@ -130,63 +130,63 @@ function me(r) {
|
|
|
130
130
|
case "single":
|
|
131
131
|
case "double":
|
|
132
132
|
case "long":
|
|
133
|
-
|
|
133
|
+
a.simpleFieldType = "number";
|
|
134
134
|
break;
|
|
135
135
|
default:
|
|
136
|
-
|
|
136
|
+
a.simpleFieldType = "string";
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
-
function fe(
|
|
139
|
+
function fe(a, e) {
|
|
140
140
|
const { layer: t } = e;
|
|
141
|
-
if (M(t) && t.subtypeField ===
|
|
142
|
-
const
|
|
143
|
-
if (
|
|
144
|
-
return [new
|
|
141
|
+
if (M(t) && t.subtypeField === a) {
|
|
142
|
+
const l = t.parent?.subtypes?.find((o) => o.code === t.subtypeCode);
|
|
143
|
+
if (l)
|
|
144
|
+
return [new R({ code: l.code, name: l.name })];
|
|
145
145
|
}
|
|
146
|
-
if (!v(t) && !
|
|
146
|
+
if (!v(t) && !V(t))
|
|
147
147
|
return;
|
|
148
|
-
const i = v(t) ? t.typeIdField : void 0,
|
|
148
|
+
const i = v(t) ? t.typeIdField : void 0, r = v(t) ? t.types : void 0;
|
|
149
149
|
let s;
|
|
150
|
-
const m =
|
|
151
|
-
return v(t) && i &&
|
|
152
|
-
(
|
|
150
|
+
const m = G(e)?.find((l) => l.name === a), d = m?.domain;
|
|
151
|
+
return v(t) && i && r ? (i === a ? s = r.map(
|
|
152
|
+
(l) => (
|
|
153
153
|
// fake coded values
|
|
154
|
-
new
|
|
155
|
-
code:
|
|
156
|
-
name:
|
|
154
|
+
new R({
|
|
155
|
+
code: l.id,
|
|
156
|
+
name: l.name
|
|
157
157
|
})
|
|
158
158
|
)
|
|
159
|
-
) : (s = [],
|
|
160
|
-
if (!
|
|
161
|
-
const
|
|
162
|
-
|
|
159
|
+
) : (s = [], r.forEach((l) => {
|
|
160
|
+
if (!l.domains[a] || l.domains[a].type === "inherited") {
|
|
161
|
+
const o = d;
|
|
162
|
+
o?.codedValues && o.codedValues.forEach((u) => {
|
|
163
163
|
let g = !1;
|
|
164
164
|
s.forEach((p) => {
|
|
165
165
|
p.code === u.code && (g = !0, `, ${p.name},`.includes(`, ${u.name},`) || (p.name += `, ${u.name}`));
|
|
166
|
-
}), g || s.push(
|
|
166
|
+
}), g || s.push(_.clone(u));
|
|
167
167
|
});
|
|
168
|
-
} else
|
|
168
|
+
} else l.domains[a].codedValues && l.domains[a].codedValues.forEach((o) => {
|
|
169
169
|
let u = !1;
|
|
170
170
|
s.forEach((g) => {
|
|
171
|
-
g.code ===
|
|
172
|
-
}), u || s.push(
|
|
171
|
+
g.code === o.code && (u = !0, `, ${g.name},`.includes(`, ${o.name},`) || (g.name += `, ${o.name}`));
|
|
172
|
+
}), u || s.push(_.clone(o));
|
|
173
173
|
});
|
|
174
|
-
})), !s.length &&
|
|
174
|
+
})), !s.length && d?.codedValues && (s = _.clone(d.codedValues))) : d?.codedValues && (s = m?.domain?.codedValues), s?.length ? s : void 0;
|
|
175
175
|
}
|
|
176
|
-
async function pe(
|
|
177
|
-
const { view: e, layer: t } =
|
|
178
|
-
if (
|
|
176
|
+
async function pe(a) {
|
|
177
|
+
const { view: e, layer: t } = a;
|
|
178
|
+
if (V(t) || y(t) || $(t))
|
|
179
179
|
throw new Error("could not get feature");
|
|
180
|
-
if (v(t) && !t.url ||
|
|
180
|
+
if (v(t) && !t.url || U(t)) {
|
|
181
181
|
const i = t.createQuery();
|
|
182
182
|
i.start = 0, i.num = 5, i.outFields = ["*"];
|
|
183
|
-
const
|
|
184
|
-
if (
|
|
185
|
-
return
|
|
183
|
+
const r = await t.queryFeatures(i);
|
|
184
|
+
if (r.features.length)
|
|
185
|
+
return r;
|
|
186
186
|
throw new Error("could not get feature");
|
|
187
187
|
} else {
|
|
188
188
|
if (!e)
|
|
189
|
-
return await
|
|
189
|
+
return await q(a);
|
|
190
190
|
let i;
|
|
191
191
|
if (M(t) || X(t)) {
|
|
192
192
|
let s = t.parent;
|
|
@@ -195,19 +195,19 @@ async function pe(r) {
|
|
|
195
195
|
te(s) && (i = await e.whenLayerView(s));
|
|
196
196
|
} else
|
|
197
197
|
i = await e.whenLayerView(t);
|
|
198
|
-
const
|
|
199
|
-
if (i && (
|
|
198
|
+
const r = i.availableFields.length === t.fields.length;
|
|
199
|
+
if (i && (r || (F(t) || O(t)) && i.availableFields.length > 0)) {
|
|
200
200
|
const s = i.createQuery();
|
|
201
201
|
s.start = 0, s.num = 5, s.outFields = ["*"];
|
|
202
|
-
const
|
|
203
|
-
return
|
|
202
|
+
const n = await i.queryFeatures(s);
|
|
203
|
+
return n.features?.length ? n : await q(a);
|
|
204
204
|
} else
|
|
205
|
-
return await
|
|
205
|
+
return await q(a);
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
|
-
async function
|
|
209
|
-
const { layer: e } =
|
|
210
|
-
if (
|
|
208
|
+
async function q(a) {
|
|
209
|
+
const { layer: e } = a;
|
|
210
|
+
if (V(e) || y(e) || F(e) || O(e))
|
|
211
211
|
throw new Error("cannot get feature from service");
|
|
212
212
|
const t = new ae({
|
|
213
213
|
where: "1=1",
|
|
@@ -216,32 +216,32 @@ async function C(r) {
|
|
|
216
216
|
});
|
|
217
217
|
return "sourceJSON" in e && e.sourceJSON?.advancedQueryCapabilities?.supportsPagination && (t.num = 1), await e.queryFeatures(t);
|
|
218
218
|
}
|
|
219
|
-
async function ge(
|
|
220
|
-
if (
|
|
221
|
-
return await he(
|
|
222
|
-
if (v(
|
|
223
|
-
return await
|
|
224
|
-
if (e && (F(
|
|
225
|
-
return await ve(
|
|
219
|
+
async function ge(a, e) {
|
|
220
|
+
if (Z(a))
|
|
221
|
+
return await he(a);
|
|
222
|
+
if (v(a) || ie(a) || W(a) || U(a) || se(a))
|
|
223
|
+
return await a.queryFeatureCount();
|
|
224
|
+
if (e && (F(a) || O(a)))
|
|
225
|
+
return await ve(a, e);
|
|
226
226
|
}
|
|
227
|
-
async function he(
|
|
228
|
-
const e =
|
|
227
|
+
async function he(a) {
|
|
228
|
+
const e = a.createQuery();
|
|
229
229
|
e.outFields = ["*"];
|
|
230
|
-
const t = await
|
|
230
|
+
const t = await a.queryFeatures(e);
|
|
231
231
|
if (t.features.length)
|
|
232
232
|
return t.features.length;
|
|
233
233
|
throw new Error("could not get feature count");
|
|
234
234
|
}
|
|
235
|
-
async function ve(
|
|
236
|
-
return await (await e.whenLayerView(
|
|
235
|
+
async function ve(a, e) {
|
|
236
|
+
return await (await e.whenLayerView(a)).queryFeatureCount();
|
|
237
237
|
}
|
|
238
|
-
const ye =
|
|
239
|
-
class Fe extends
|
|
238
|
+
const ye = j`:host{height:100%}.container{padding:var(--calcite-space-xs);background-color:var(--calcite-color-surface-2)}.title{font-weight:700;padding:5px 0}.missing,.data{color:#a9a9a9}.count{white-space:nowrap}.section{padding:var(--calcite-space-xs) 0}.statistics-row{border-top:var(--calcite-border-width-sm) solid var(--calcite-color-border-2);padding:var(--calcite-space-xs) 0;display:flex;justify-content:space-between}.statistics-row-top-values{border-top:var(--calcite-border-width-sm) solid var(--calctie-color-border-2);padding:20px 0 var(--calcite-space-xs) 0;display:flex;justify-content:space-between}`;
|
|
239
|
+
class Fe extends Q {
|
|
240
240
|
constructor() {
|
|
241
|
-
super(...arguments), this._messages = re({ blocking: !0 }), this._propWatcherTask = new
|
|
241
|
+
super(...arguments), this._messages = re({ blocking: !0 }), this.initialized = !1, this._propWatcherTask = new J(this, {
|
|
242
242
|
task: async ([e, t]) => {
|
|
243
243
|
const i = f(e) && f(t);
|
|
244
|
-
if (f(e) ||
|
|
244
|
+
if (f(e) || C("error", this, L("layer")), f(t) || C("error", this, L("fieldName")), !i)
|
|
245
245
|
throw new Error();
|
|
246
246
|
await this.processProps(), this._propWatcherTask.autoRun = !1;
|
|
247
247
|
},
|
|
@@ -257,73 +257,88 @@ class Fe extends J {
|
|
|
257
257
|
async refresh() {
|
|
258
258
|
await this.processProps(), this.requestUpdate();
|
|
259
259
|
}
|
|
260
|
+
async willUpdate(e) {
|
|
261
|
+
this.initialized && (e.has("fieldName") || e.has("layer")) && await this.processProps();
|
|
262
|
+
}
|
|
260
263
|
disconnectedCallback() {
|
|
261
264
|
super.disconnectedCallback(), this.timeZoneHandle?.remove();
|
|
262
265
|
}
|
|
263
266
|
async processProps() {
|
|
264
|
-
const { view: e, layer: t, fieldName: i, hideStatistics:
|
|
267
|
+
const { view: e, layer: t, fieldName: i, hideStatistics: r } = this;
|
|
265
268
|
if (!t || !i)
|
|
266
269
|
return;
|
|
267
270
|
let s;
|
|
268
271
|
if (t.declaredClass === "esri.layers.support.Sublayer") {
|
|
269
|
-
const
|
|
270
|
-
e && await x.whenOnce(() => !e.updating), s = await
|
|
272
|
+
const n = t;
|
|
273
|
+
e && await x.whenOnce(() => !e.updating), s = await n.createFeatureLayer(), await s?.load();
|
|
271
274
|
}
|
|
272
|
-
this.props = {
|
|
275
|
+
if (this.oneFeatureResponseStatus = "missing", this.oneFeatureResponse = void 0, this.statisticsStatus = "missing", this.statistics = void 0, this.uniqueValuesStatus = "missing", this.uniqueValues = void 0, this.props = {
|
|
273
276
|
view: e,
|
|
274
277
|
layer: s ?? t,
|
|
275
278
|
fieldName: i,
|
|
276
|
-
hideStatistics:
|
|
277
|
-
}, this.props.fieldInfo = ue(this.props),
|
|
279
|
+
hideStatistics: r
|
|
280
|
+
}, this.props.fieldInfo = ue(this.props), !this.props.fieldInfo) {
|
|
281
|
+
C("error", this, `Field ${i} does not exist in layer.`);
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
W(t) && z.request.interceptors?.push({
|
|
278
285
|
urls: `${ne(t)}/${t.layerId}`,
|
|
279
|
-
before(
|
|
280
|
-
|
|
286
|
+
before(n) {
|
|
287
|
+
n.requestOptions.authMode = "no-prompt";
|
|
281
288
|
}
|
|
282
|
-
}), this.
|
|
289
|
+
}), this.processPropsPart2();
|
|
290
|
+
}
|
|
291
|
+
async processPropsPart2() {
|
|
292
|
+
const { layer: e, hideStatistics: t } = this;
|
|
293
|
+
if (await this.requestOneFeature(), F(e) || k(e) || E(e)) {
|
|
294
|
+
this.uniqueValuesStatus = "failed", this.statisticsStatus = "failed";
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
t ? this.uniqueValuesStatus = "failed" : await this.requestUniqueValues(), t ? this.statisticsStatus = "failed" : await this.requestStatistics(), this.setUpTimeZoneHandle(), this.initialized = !0;
|
|
298
|
+
}
|
|
299
|
+
async requestOneFeature() {
|
|
300
|
+
this.oneFeatureResponseStatus = "in-progress";
|
|
283
301
|
try {
|
|
284
|
-
const
|
|
285
|
-
this.oneFeatureResponse =
|
|
302
|
+
const e = await pe(this.props);
|
|
303
|
+
this.oneFeatureResponse = e, this.oneFeatureResponseStatus = "success";
|
|
286
304
|
} catch {
|
|
287
305
|
this.oneFeatureResponseStatus = "failed";
|
|
288
306
|
}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
}
|
|
293
|
-
if (n)
|
|
294
|
-
this.uniqueValuesStatus = "failed";
|
|
295
|
-
else {
|
|
296
|
-
this.uniqueValuesStatus = "in-progress";
|
|
307
|
+
}
|
|
308
|
+
async requestUniqueValues() {
|
|
309
|
+
return this.uniqueValuesStatus = "in-progress", await new Promise(async (e) => {
|
|
297
310
|
try {
|
|
298
|
-
const
|
|
299
|
-
this.uniqueValues =
|
|
311
|
+
const t = await de(this.props);
|
|
312
|
+
this.uniqueValues = t, t?.uniqueValueInfos?.length ? this.uniqueValuesStatus = "success" : this.uniqueValuesStatus = "failed";
|
|
300
313
|
} catch {
|
|
301
314
|
this.uniqueValuesStatus = "failed";
|
|
315
|
+
} finally {
|
|
316
|
+
e();
|
|
302
317
|
}
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
this.statisticsStatus = "in-progress";
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
async requestStatistics() {
|
|
321
|
+
return await new Promise(async (e) => {
|
|
308
322
|
try {
|
|
309
|
-
const
|
|
310
|
-
if (!f(
|
|
311
|
-
const
|
|
312
|
-
for (let
|
|
313
|
-
const
|
|
314
|
-
if (
|
|
315
|
-
|
|
323
|
+
const t = await ce(this.props);
|
|
324
|
+
if (!f(t.totalCount) && f(t.count) && this.uniqueValuesStatus === "success") {
|
|
325
|
+
const i = this.uniqueValues?.uniqueValueInfos ?? [];
|
|
326
|
+
for (let r = 0; r < i.length; r++) {
|
|
327
|
+
const s = i[r];
|
|
328
|
+
if (s.value === null) {
|
|
329
|
+
t.totalCount = s.count + t.count;
|
|
316
330
|
break;
|
|
317
331
|
}
|
|
318
332
|
}
|
|
319
|
-
|
|
333
|
+
t.totalCount ??= t.count;
|
|
320
334
|
}
|
|
321
|
-
this.statistics =
|
|
335
|
+
this.statistics = t, this.statisticsStatus = "success";
|
|
322
336
|
} catch {
|
|
323
337
|
this.statisticsStatus = "failed";
|
|
338
|
+
} finally {
|
|
339
|
+
e();
|
|
324
340
|
}
|
|
325
|
-
}
|
|
326
|
-
this.setUpTimeZoneHandle();
|
|
341
|
+
});
|
|
327
342
|
}
|
|
328
343
|
setUpTimeZoneHandle() {
|
|
329
344
|
this.timeZoneHandle?.remove();
|
|
@@ -431,8 +446,8 @@ class Fe extends J {
|
|
|
431
446
|
}
|
|
432
447
|
}
|
|
433
448
|
_getDisplayString(e, t) {
|
|
434
|
-
const { props: i } = this, { fieldInfo:
|
|
435
|
-
switch (
|
|
449
|
+
const { props: i } = this, { fieldInfo: r } = i;
|
|
450
|
+
switch (r.simpleFieldType) {
|
|
436
451
|
case "date":
|
|
437
452
|
return this._getDateString(e, t);
|
|
438
453
|
case "date-only":
|
|
@@ -491,8 +506,13 @@ class Fe extends J {
|
|
|
491
506
|
_printNumValue(e, t) {
|
|
492
507
|
return f(e) ? this._getNumberString(e, t) : "--";
|
|
493
508
|
}
|
|
494
|
-
_setCompleteRef() {
|
|
495
|
-
this.
|
|
509
|
+
_setCompleteRef(e) {
|
|
510
|
+
if (this.completeRefHandler && clearInterval(this.completeRefHandler), e) {
|
|
511
|
+
let t = 0;
|
|
512
|
+
this.completeRefHandler = setInterval(() => {
|
|
513
|
+
(t > 130 || this.isFinished(this.uniqueValuesStatus) && this.isFinished(this.statisticsStatus)) && (clearInterval(this.completeRefHandler), this.arcgisComplete.emit(), this.arcgisFieldInfoComplete.emit()), t++;
|
|
514
|
+
}, 1e3);
|
|
515
|
+
}
|
|
496
516
|
}
|
|
497
517
|
getCurrentFieldFormat() {
|
|
498
518
|
const { props: e } = this, { layer: t, fieldName: i } = e;
|
|
@@ -513,17 +533,17 @@ class Fe extends J {
|
|
|
513
533
|
} : void 0;
|
|
514
534
|
if (i)
|
|
515
535
|
return i;
|
|
516
|
-
const
|
|
536
|
+
const r = this.getPopupTemplateFieldInfo();
|
|
517
537
|
return h.convertNumberFormatToIntlOptions({
|
|
518
|
-
digitSeparator:
|
|
519
|
-
places:
|
|
538
|
+
digitSeparator: r?.format?.digitSeparator ?? !0,
|
|
539
|
+
places: r?.format?.places ?? 2
|
|
520
540
|
});
|
|
521
541
|
}
|
|
522
542
|
getIntlDateTimeFormattingOptions(e, t) {
|
|
523
543
|
const i = this.getCurrentFieldFormat();
|
|
524
544
|
if (!t?.useFieldFormatting)
|
|
525
545
|
return i ? t?.isTimeOnly ? le : oe : h.convertDateFormatToIntlOptions(e);
|
|
526
|
-
const
|
|
546
|
+
const r = i ? {
|
|
527
547
|
dateStyle: t?.isTimeOnly ? void 0 : i.dateStyle ?? void 0,
|
|
528
548
|
// year/month is overridden if dateStyle is set
|
|
529
549
|
year: i.dateStyle ? void 0 : i.year ?? void 0,
|
|
@@ -531,43 +551,46 @@ class Fe extends J {
|
|
|
531
551
|
timeStyle: i.timeStyle ?? void 0,
|
|
532
552
|
hourCycle: i.hour12 === "never" ? "h23" : "h11"
|
|
533
553
|
} : void 0;
|
|
534
|
-
if (
|
|
535
|
-
return
|
|
554
|
+
if (r)
|
|
555
|
+
return r;
|
|
536
556
|
const s = this.getPopupTemplateFieldInfo();
|
|
537
557
|
return h.convertDateFormatToIntlOptions(s?.format?.dateFormat ?? e);
|
|
538
558
|
}
|
|
539
559
|
originalLayerSupportsFieldConfigs() {
|
|
540
560
|
const { layer: e } = this;
|
|
541
|
-
return
|
|
561
|
+
return A.supportsFieldConfiguration(e);
|
|
542
562
|
}
|
|
543
563
|
getPopupTemplateFieldInfo() {
|
|
544
564
|
const { props: e } = this, { layer: t, fieldName: i } = e;
|
|
545
565
|
return ("popupTemplate" in t ? t.popupTemplate : void 0)?.fieldInfos?.find((s) => s.fieldName === i);
|
|
546
566
|
}
|
|
567
|
+
isFinished(e) {
|
|
568
|
+
return ["success", "failed"].includes(e);
|
|
569
|
+
}
|
|
547
570
|
render() {
|
|
548
571
|
return this._propWatcherTask.render({
|
|
549
|
-
pending: () =>
|
|
572
|
+
pending: () => c`<calcite-scrim loading></calcite-scrim>`,
|
|
550
573
|
complete: () => {
|
|
551
574
|
const { props: e } = this, { fieldInfo: t } = e;
|
|
552
|
-
return t ?
|
|
575
|
+
return t ? c`<div class="container">${this.renderFieldType()}${this.renderFieldAlias()}${this.renderFieldDescription()}${this.renderFieldValueType()}${this.renderFieldSampleValue()}${this.renderFieldNumericFormat()}${this.renderFieldStatistics()}</div>` : "";
|
|
553
576
|
},
|
|
554
577
|
error: () => ""
|
|
555
578
|
});
|
|
556
579
|
}
|
|
557
580
|
renderFieldType() {
|
|
558
|
-
const { _messages: e, props: t } = this, { fieldInfo: i } = t,
|
|
559
|
-
return
|
|
581
|
+
const { _messages: e, props: t } = this, { fieldInfo: i } = t, r = this._getFieldTypeLabel(i.layerField.type);
|
|
582
|
+
return c`<div class="section"><div class="title">${e.fieldType}</div><div>${r}</div></div>`;
|
|
560
583
|
}
|
|
561
584
|
renderFieldAlias() {
|
|
562
|
-
const { _messages: e, props: t, hideAlias: i } = this, { fieldInfo:
|
|
563
|
-
return i ? "" :
|
|
585
|
+
const { _messages: e, props: t, hideAlias: i } = this, { fieldInfo: r } = t;
|
|
586
|
+
return i ? "" : c`<div class="section"><div class="title">${e.fieldAlias}</div><div>${r.label}</div></div>`;
|
|
564
587
|
}
|
|
565
588
|
renderFieldDescription() {
|
|
566
589
|
const { _messages: e, props: t } = this, { layer: i } = t;
|
|
567
590
|
if (!v(i))
|
|
568
591
|
return "";
|
|
569
|
-
const { fieldInfo:
|
|
570
|
-
return
|
|
592
|
+
const { fieldInfo: r } = t, s = r.layerField.description;
|
|
593
|
+
return c`<div class="section"><div class="title">${e.fieldDescription}</div><div class=${I({
|
|
571
594
|
missing: !s
|
|
572
595
|
})}>${s || e.fieldDescriptionNotSet}</div></div>`;
|
|
573
596
|
}
|
|
@@ -575,49 +598,53 @@ class Fe extends J {
|
|
|
575
598
|
const { _messages: e, props: t } = this, { layer: i } = t;
|
|
576
599
|
if (!v(i))
|
|
577
600
|
return "";
|
|
578
|
-
const { fieldInfo:
|
|
579
|
-
return
|
|
601
|
+
const { fieldInfo: r } = t, s = this._getFieldValueTypeCamelCase(r);
|
|
602
|
+
return c`<div class="section"><div class="title">${e.fieldValueType}</div><div class=${I(s ? "" : "missing")}>${s ? e.fieldValueTypes[s] : e.fieldValueTypeNotSet}</div></div>`;
|
|
580
603
|
}
|
|
581
604
|
renderFieldSampleValue() {
|
|
582
|
-
const { oneFeatureResponse: e, oneFeatureResponseStatus: t, statisticsStatus: i, statistics:
|
|
605
|
+
const { oneFeatureResponse: e, oneFeatureResponseStatus: t, statisticsStatus: i, statistics: r, uniqueValuesStatus: s, uniqueValues: n, _messages: m, props: d } = this, { layer: l, fieldName: o, fieldInfo: u } = d, { statistics: g } = m;
|
|
583
606
|
let p;
|
|
584
|
-
if (y(
|
|
607
|
+
if (y(l) || w(l) || !F(l) && ["string", "oid", "guid"].includes(this._getStatisticsType(u)) && s !== "failed")
|
|
585
608
|
return "";
|
|
586
|
-
t === "success" ? e.features.forEach((
|
|
587
|
-
(p === void 0 || p === null &&
|
|
588
|
-
}) : i === "success" ? p =
|
|
609
|
+
t === "success" ? e.features.forEach((T) => {
|
|
610
|
+
(p === void 0 || p === null && T.attributes[o] !== null) && (p = T.attributes[o]);
|
|
611
|
+
}) : i === "success" ? p = r?.min ?? void 0 : s === "success" && (p = n?.uniqueValueInfos?.[0]?.value ?? n?.uniqueValueInfos?.[1]?.value ?? void 0);
|
|
589
612
|
const N = u.codedValues;
|
|
590
|
-
return f(p) && (N ? p = N.find((
|
|
613
|
+
return f(p) && (N ? p = N.find((T) => p === T.code)?.name || p : p = this._getDisplayString(p, { useFieldFormatting: !0 })), c`<div class="section"><div class="title">${m.fieldSampleValue}</div><div class=${I(t === "failed" && i === "failed" && s === "failed" || !f(p) ? "missing" : "")}>${t === "success" || i === "success" || s === "success" ? p?.toString() ?? g.allNulls : t === "failed" && i === "failed" && s === "failed" ? m.fieldSampleNotAvailable : m.fieldSampleRetrieving}</div></div>`;
|
|
591
614
|
}
|
|
592
615
|
renderFieldNumericFormat() {
|
|
593
|
-
const { _messages: e, props: t, hideNumericFormat: i } = this, { fieldName:
|
|
616
|
+
const { _messages: e, props: t, hideNumericFormat: i } = this, { fieldName: r, fieldInfo: s, layer: n } = t;
|
|
594
617
|
if (i || !["double", "long", "single"].includes(s.layerField.type))
|
|
595
618
|
return "";
|
|
596
|
-
const m = this.originalLayerSupportsFieldConfigs() ?
|
|
619
|
+
const m = this.originalLayerSupportsFieldConfigs() ? n.getFieldConfiguration(r) : void 0;
|
|
597
620
|
if (m?.fieldFormat) {
|
|
598
|
-
const { minimumFractionDigits:
|
|
599
|
-
return
|
|
621
|
+
const { minimumFractionDigits: l, maximumFractionDigits: o } = m.fieldFormat;
|
|
622
|
+
return c`<div class="section"><div class="title">${e.fieldDecimalPlaces}</div><div>${e.fieldMinimumFractionDigits.replace("${number}", l.toString())}</div><div>${e.fieldMaximumFractionDigits.replace("${number}", o.toString())}</div></div>`;
|
|
600
623
|
}
|
|
601
|
-
const
|
|
602
|
-
if (
|
|
603
|
-
const
|
|
604
|
-
if (
|
|
605
|
-
const
|
|
606
|
-
if (f(
|
|
607
|
-
const u =
|
|
608
|
-
return
|
|
624
|
+
const d = "popupTemplate" in n ? n.popupTemplate : void 0;
|
|
625
|
+
if (d?.fieldInfos) {
|
|
626
|
+
const l = d.fieldInfos?.filter((o) => o.fieldName === r);
|
|
627
|
+
if (l?.length) {
|
|
628
|
+
const o = l[0];
|
|
629
|
+
if (f(o?.format?.places)) {
|
|
630
|
+
const u = o.format.places;
|
|
631
|
+
return c`<div class="section"><div class="title">${e.fieldDecimalPlaces}</div><div>${e.fieldNumDecimalPlaces.replace("${number}", u.toString())}</div></div>`;
|
|
609
632
|
}
|
|
610
633
|
}
|
|
611
634
|
}
|
|
612
|
-
return
|
|
635
|
+
return c`<div class="section"><div class="title">${e.fieldDecimalPlaces}</div><div class="missing">${e.fieldDecimalPlacesNotAvailable}</div></div>`;
|
|
613
636
|
}
|
|
614
637
|
renderFieldStatistics() {
|
|
615
|
-
const { statisticsStatus: e, uniqueValuesStatus: t, hideStatistics: i, _messages:
|
|
616
|
-
return i ? (this.arcgisComplete.emit(), this.arcgisFieldInfoComplete.emit(), "") :
|
|
638
|
+
const { statisticsStatus: e, uniqueValuesStatus: t, hideStatistics: i, _messages: r, props: s } = this, { layer: n, fieldInfo: m } = s;
|
|
639
|
+
return i ? (this.arcgisComplete.emit(), this.arcgisFieldInfoComplete.emit(), "") : k(n) || E(n) || F(n) || y(n) || w(n) || ["long"].includes(m.layerField.type) ? (this.arcgisComplete.emit(), this.arcgisFieldInfoComplete.emit(), "") : c`<div class="section"><div class="title">${r.fieldStatistics}</div>${!this.isFinished(t) && !this.isFinished(e) ? this.renderWaitingForStatistics() : e === "failed" && t === "failed" ? this.renderNoStatistics() : this.renderStatistics()}</div>`;
|
|
640
|
+
}
|
|
641
|
+
renderWaitingForStatistics() {
|
|
642
|
+
const { _messages: e } = this;
|
|
643
|
+
return S("field-info-statistics-content", c`<div class="missing">${e.fieldStatisticsRetrieving}</div>`);
|
|
617
644
|
}
|
|
618
645
|
renderNoStatistics() {
|
|
619
646
|
const { _messages: e } = this;
|
|
620
|
-
return
|
|
647
|
+
return S("field-info-statistics-content", c`<div class="missing" ${b(this._setCompleteRef)}>${e.fieldStatisticsNotAvailable}</div>`);
|
|
621
648
|
}
|
|
622
649
|
renderStatistics() {
|
|
623
650
|
const { props: e } = this, { fieldInfo: t } = e;
|
|
@@ -640,58 +667,58 @@ class Fe extends J {
|
|
|
640
667
|
renderNumberStatistics() {
|
|
641
668
|
const { statistics: e, _messages: t } = this;
|
|
642
669
|
if (!e)
|
|
643
|
-
return this.
|
|
670
|
+
return this.renderWaitingForStatistics();
|
|
644
671
|
const { statistics: i } = t;
|
|
645
|
-
return
|
|
672
|
+
return S("field-info-statistics-content", c`<div ${b(this._setCompleteRef)}><div class="statistics-row"><div>${i.numberOfValues}</div><div class="data">${this._printNumValue(e.totalCount)}</div></div>${f(e.sum) ? c`<div class="statistics-row"><div>${i.sumOfValues}</div><div class="data">${this._printNumValue(e.sum)}</div></div>` : null}${f(e.min) ? c`<div class="statistics-row"><div>${i.minimum}</div><div class="data">${this._printNumValue(e.min)}</div></div>` : null}${f(e.max) ? c`<div class="statistics-row"><div>${i.maximum}</div><div class="data">${this._printNumValue(e.max)}</div></div>` : null}${f(e.avg) ? c`<div class="statistics-row"><div>${i.average}</div><div class="data">${this._printNumValue(e.avg)}</div></div>` : null}${f(e.stddev) ? c`<div class="statistics-row"><div>${i.standardDeviation}</div><div class="data">${this._printNumValue(e.stddev)}</div></div>` : null}${this.renderNullValues()}</div>`);
|
|
646
673
|
}
|
|
647
674
|
renderStringStatistics() {
|
|
648
|
-
const { statistics: e, uniqueValuesStatus: t, _messages: i } = this, { statistics:
|
|
649
|
-
return
|
|
675
|
+
const { statistics: e, uniqueValuesStatus: t, _messages: i } = this, { statistics: r } = i;
|
|
676
|
+
return S("field-info-statistics-content", c`<div ${b(this._setCompleteRef)}><div class="statistics-row"><div>${r.numberOfValues}</div>${t !== "success" ? c`<div class="missing">--</div>` : c`<div class="data">${this._printNumValue(e?.totalCount)}</div>`}</div>${this.renderNullValues()}${this.renderTopValues()}</div>`);
|
|
650
677
|
}
|
|
651
678
|
renderDateStatistics() {
|
|
652
|
-
const { statistics: e, view: t, props: i, _messages:
|
|
679
|
+
const { statistics: e, view: t, props: i, _messages: r } = this, { fieldInfo: s } = i;
|
|
653
680
|
if (!e || !f(e.max) || !f(e.min))
|
|
654
|
-
return this.
|
|
655
|
-
const { statistics:
|
|
656
|
-
let
|
|
657
|
-
|
|
658
|
-
let u =
|
|
659
|
-
u +=
|
|
681
|
+
return this.renderWaitingForStatistics();
|
|
682
|
+
const { statistics: n } = r, m = e.max - e.min, d = Math.floor(m / 31536e6);
|
|
683
|
+
let l = Math.floor((m - d * 31536e6) / 2628e6), o = Math.ceil((m - l * 2628e6) / 864e5);
|
|
684
|
+
o >= 30 && (l += 1, o = 0);
|
|
685
|
+
let u = d === 1 ? n.timeSpanOptions.year : d > 1 ? n.timeSpanOptions.years.replace("${years}", d.toString()) : "";
|
|
686
|
+
u += d > 0 && (l > 0 || o > 0) ? ", " : "", u += l === 1 ? n.timeSpanOptions.month : l > 1 ? n.timeSpanOptions.months.replace("${months}", l.toString()) : "", u += l > 0 && o > 0 ? ", " : "", u += o === 1 ? n.timeSpanOptions.day : o > 1 ? n.timeSpanOptions.days.replace("${days}", o.toString()) : "";
|
|
660
687
|
const g = s.simpleFieldType !== "timestamp-offset" || !t || t.timeZone !== "unknown", p = s.simpleFieldType === "time-only";
|
|
661
|
-
return
|
|
688
|
+
return S("field-info-statistics-content", c`<div ${b(this._setCompleteRef)}><div class="statistics-row"><div>${n.numberOfValues}</div><div class="data">${this._printNumValue(e?.totalCount)}</div></div>${g && f(e.min) ? c`<div class="statistics-row"><div>${p ? n.minimumTime : n.minimumDate}</div><div class="data">${this._getDisplayString(e.min)}</div></div>` : null}${g && f(e.max) ? c`<div class="statistics-row"><div>${p ? n.maximumTime : n.maximumDate}</div><div class="data">${this._getDisplayString(e.max)}</div></div>` : null}${g && f(e.avg) ? c`<div class="statistics-row"><div>${p ? n.averageTime : n.averageDate}</div><div class="data">${this._getDisplayString(e.avg)}</div></div>` : null}${g && !p && f(e.min) && f(e.max) && m > 0 ? c`<div class="statistics-row"><div>${n.timespan}</div><div class="data">${u}</div></div>` : null}${this.renderNullValues()}</div>`);
|
|
662
689
|
}
|
|
663
690
|
renderTopValues() {
|
|
664
|
-
const { uniqueValues: e, uniqueValuesStatus: t, _messages: i, props:
|
|
691
|
+
const { uniqueValues: e, uniqueValuesStatus: t, _messages: i, props: r } = this, { fieldInfo: s } = r, { statistics: n } = i;
|
|
665
692
|
if (e?.uniqueValueInfos?.length) {
|
|
666
693
|
const m = e.uniqueValueInfos;
|
|
667
|
-
m.sort((
|
|
668
|
-
const
|
|
669
|
-
let u =
|
|
670
|
-
return
|
|
694
|
+
m.sort((o, u) => o.count < u.count ? 1 : o.count > u.count ? -1 : 0);
|
|
695
|
+
const d = s.codedValues, l = m.filter((o) => o.value !== null).filter((o, u) => o && u < 10).map((o) => {
|
|
696
|
+
let u = o.value;
|
|
697
|
+
return d ? d.forEach((g) => {
|
|
671
698
|
u === g.code && (u = g.name);
|
|
672
|
-
}) : u = this._getDisplayString(u),
|
|
699
|
+
}) : u = this._getDisplayString(u), c`<div class="statistics-row"><div class="data">${`${u}`}</div><div class="count">${this._printNumValue(o.count)}</div></div>`;
|
|
673
700
|
});
|
|
674
|
-
return
|
|
701
|
+
return l.length ? c`<div><div class="statistics-row-top-values"><div>${m.length > 10 ? n.topTenValues : n.topValues}</div><div>${n.count}</div></div>${l}</div>` : "";
|
|
675
702
|
} else
|
|
676
|
-
return
|
|
703
|
+
return c`<div><div class="statistics-row-top-values"><div>${n.topValues}</div><div>${n.count}</div></div><div class="statistics-row"><div class="missing">${t === "failed" ? i.fieldUniqueValuesNotAvailable : i.fieldSampleRetrieving}</div></div></div>`;
|
|
677
704
|
}
|
|
678
705
|
renderNullValues() {
|
|
679
|
-
const { statistics: e, uniqueValues: t, _messages: i } = this, { statistics:
|
|
706
|
+
const { statistics: e, uniqueValues: t, _messages: i } = this, { statistics: r } = i;
|
|
680
707
|
let s = e?.nullcount;
|
|
681
708
|
if (!f(s) && t) {
|
|
682
|
-
const
|
|
683
|
-
for (let m = 0; m <
|
|
684
|
-
const
|
|
685
|
-
if (
|
|
686
|
-
s =
|
|
709
|
+
const n = t.uniqueValueInfos;
|
|
710
|
+
for (let m = 0; m < n.length; m++) {
|
|
711
|
+
const d = n[m];
|
|
712
|
+
if (d.value === null) {
|
|
713
|
+
s = d.count;
|
|
687
714
|
break;
|
|
688
715
|
}
|
|
689
716
|
}
|
|
690
717
|
}
|
|
691
|
-
return
|
|
718
|
+
return c`<div class="statistics-row"><div>${r.numberOfNulls}</div>${f(s) ? c`<div class="data">${this._printNumValue(s)}</div>` : c`<div class="missing">--</div>`}</div>`;
|
|
692
719
|
}
|
|
693
720
|
}
|
|
694
|
-
|
|
721
|
+
H("arcgis-field-info", Fe);
|
|
695
722
|
export {
|
|
696
723
|
Fe as ArcgisFieldInfo
|
|
697
724
|
};
|