@arcgis/portal-components 4.34.0-next.168 → 4.34.1
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/{IEXXVF7X.js → 447LB6SY.js} +1 -1
- package/dist/cdn/AZPDCCI4.js +4 -0
- package/dist/cdn/{EUSFMCP3.js → IO3YO6WN.js} +2 -2
- package/dist/cdn/{NMPILHJJ.js → KDCSZXS2.js} +2 -2
- package/dist/cdn/{SPZX2LEF.js → KW4CUOXF.js} +1 -1
- package/dist/cdn/{JJZ5KY2U.js → NP2UWFQZ.js} +2 -2
- package/dist/cdn/{TE4RGDVF.js → NZIN3FEB.js} +2 -2
- package/dist/cdn/{Y3RWHTRX.js → P2HEPBK4.js} +2 -2
- package/dist/cdn/{6OQGQGSG.js → QCCGAFGO.js} +2 -2
- package/dist/cdn/{LOEOB6D3.js → T3SIDJUH.js} +2 -2
- package/dist/cdn/{CE6NLETM.js → VWZ3KF24.js} +2 -2
- package/dist/cdn/{4CFMBQ2W.js → YTYDTI2B.js} +2 -2
- package/dist/cdn/index.js +2 -2
- package/dist/chunks/common.js +1 -1
- package/dist/chunks/fieldAddDelete.js +60 -56
- package/dist/chunks/loadClassificationData.js +1 -1
- package/dist/chunks/requests.js +1 -1
- package/dist/chunks/runtime.js +4 -4
- package/dist/chunks/useT9n.js +1 -1
- package/dist/components/arcgis-portal-classification-banner/customElement.js +1 -1
- package/dist/components/arcgis-portal-classification-config/customElement.js +1 -1
- package/dist/components/arcgis-portal-classification-favorite/customElement.js +1 -1
- package/dist/components/arcgis-portal-classification-form-element/customElement.js +1 -1
- package/dist/components/arcgis-portal-field-delete/customElement.js +17 -17
- package/dist/docs/api.json +2 -2
- package/dist/docs/docs.json +2 -2
- package/dist/docs/web-types.json +1 -1
- package/dist/index.js +1 -1
- package/dist/loader.js +1 -1
- package/dist/utils/commonFunctions.d.ts +2 -1
- package/package.json +4 -4
- package/dist/cdn/5SEAUGGG.js +0 -4
|
@@ -2,24 +2,27 @@ import * as I from "@arcgis/core/layers/support/fieldUtils.js";
|
|
|
2
2
|
import Q from "@arcgis/core/layers/support/FeatureReductionBinning.js";
|
|
3
3
|
import K from "@arcgis/core/layers/support/FeatureReductionCluster.js";
|
|
4
4
|
import * as T from "@arcgis/core/renderers/support/jsonUtils.js";
|
|
5
|
-
import
|
|
6
|
-
import * as
|
|
5
|
+
import L from "@arcgis/core/request.js";
|
|
6
|
+
import * as v from "@arcgis/core/core/sql.js";
|
|
7
7
|
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
8
8
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
9
|
-
v4.34.
|
|
9
|
+
v4.34.1 */
|
|
10
10
|
var b = /* @__PURE__ */ ((e) => (e.expression = "expression/", e.raster = "Raster.", e.relationship = "relationships/", e))(b || {});
|
|
11
|
+
const _ = ["feature"];
|
|
12
|
+
function H(e) {
|
|
13
|
+
return "fieldConfigurations" in e && _.includes(e.type);
|
|
14
|
+
}
|
|
11
15
|
function x(e) {
|
|
12
16
|
return e != null;
|
|
13
17
|
}
|
|
14
|
-
function ge(e, t) {
|
|
15
|
-
const r = e.fieldName;
|
|
16
|
-
if (r.includes(b.expression)) {
|
|
17
|
-
const i = t.get(r);
|
|
18
|
-
return i?.title ? i.title : r;
|
|
19
|
-
} else
|
|
20
|
-
return e.label ? e.label : r;
|
|
21
|
-
}
|
|
22
18
|
function ve(e, t, r) {
|
|
19
|
+
const i = t.fieldName;
|
|
20
|
+
if (i.includes(b.expression)) {
|
|
21
|
+
const s = r.get(i);
|
|
22
|
+
return s?.title ? s.title : i;
|
|
23
|
+
} else return H(e) && e.getFieldConfiguration(i) ? e.getFieldAlias(i) || i : t.label || i;
|
|
24
|
+
}
|
|
25
|
+
function Oe(e, t, r) {
|
|
23
26
|
let i = "";
|
|
24
27
|
if (/^raster.(?:item|service)pixelvalue/iu.test(e))
|
|
25
28
|
i = "number";
|
|
@@ -33,19 +36,19 @@ function ve(e, t, r) {
|
|
|
33
36
|
i = "number";
|
|
34
37
|
return i;
|
|
35
38
|
}
|
|
36
|
-
async function
|
|
39
|
+
async function be(e) {
|
|
37
40
|
return new Map(
|
|
38
|
-
(await
|
|
41
|
+
(await z(e)).filter((t) => t.visible).map((t) => [t.name, t])
|
|
39
42
|
);
|
|
40
43
|
}
|
|
41
|
-
function
|
|
44
|
+
function Re(e) {
|
|
42
45
|
const t = /* @__PURE__ */ new Map();
|
|
43
46
|
return e?.expressionInfos && e.expressionInfos.forEach((r) => {
|
|
44
47
|
const i = `${b.expression}${r.name}`;
|
|
45
48
|
t.set(i, r);
|
|
46
49
|
}), t;
|
|
47
50
|
}
|
|
48
|
-
async function
|
|
51
|
+
async function z(e) {
|
|
49
52
|
return await new Promise((t, r) => {
|
|
50
53
|
switch (e.type) {
|
|
51
54
|
case "feature":
|
|
@@ -80,22 +83,22 @@ async function _(e) {
|
|
|
80
83
|
}
|
|
81
84
|
});
|
|
82
85
|
}
|
|
83
|
-
const
|
|
86
|
+
const X = (e) => e && !e.endsWith("/") ? `${e}/` : e;
|
|
84
87
|
function O(e) {
|
|
85
|
-
return
|
|
88
|
+
return X(e.restUrl);
|
|
86
89
|
}
|
|
87
90
|
function P(e, t) {
|
|
88
|
-
return J(e, t) ||
|
|
91
|
+
return J(e, t) || Y(e, t);
|
|
89
92
|
}
|
|
90
93
|
function J(e, t) {
|
|
91
94
|
return e.owner === t.username;
|
|
92
95
|
}
|
|
93
|
-
function
|
|
96
|
+
function Y(e, t) {
|
|
94
97
|
const r = e.owner, i = e.itemControl === "admin", s = ["esri_livingatlas", "esri_demographics", "esri_boundaries"];
|
|
95
98
|
return e.portal?.isPortal && !J(e, t) && i && r?.includes("esri_") && // portal incorrectly returns "itemControl="admin" for esri owned items
|
|
96
99
|
!s.includes(r) ? !1 : i;
|
|
97
100
|
}
|
|
98
|
-
function
|
|
101
|
+
function Z(e) {
|
|
99
102
|
return e.typeKeywords?.includes("Spatiotemporal");
|
|
100
103
|
}
|
|
101
104
|
function N(e) {
|
|
@@ -117,7 +120,7 @@ async function G(e) {
|
|
|
117
120
|
const r = t.portal;
|
|
118
121
|
if (r?.user) {
|
|
119
122
|
const i = `${O(r)}community/users/${r.user.username}`;
|
|
120
|
-
return await
|
|
123
|
+
return await L(i, {
|
|
121
124
|
query: {
|
|
122
125
|
f: "json",
|
|
123
126
|
token: t.portal.credential?.token
|
|
@@ -138,7 +141,7 @@ async function k(e) {
|
|
|
138
141
|
if (!t)
|
|
139
142
|
return await Promise.resolve(null);
|
|
140
143
|
const r = t.portal, i = `${O(r)}content/items/${t.id}/groups`;
|
|
141
|
-
return await
|
|
144
|
+
return await L(i, {
|
|
142
145
|
query: {
|
|
143
146
|
f: "json",
|
|
144
147
|
token: t.portal.credential?.token
|
|
@@ -152,9 +155,9 @@ async function k(e) {
|
|
|
152
155
|
async () => await Promise.reject(new Error("Failed to fetch item groups"))
|
|
153
156
|
);
|
|
154
157
|
}
|
|
155
|
-
async function
|
|
158
|
+
async function C(e, t, { relationshipType: r, direction: i }) {
|
|
156
159
|
const s = `${O(t)}content/items/${e}/relatedItems`;
|
|
157
|
-
return await
|
|
160
|
+
return await L(s, {
|
|
158
161
|
query: { f: "json", relationshipType: r, direction: i },
|
|
159
162
|
responseType: "json"
|
|
160
163
|
});
|
|
@@ -169,7 +172,7 @@ function A(e, t) {
|
|
|
169
172
|
function o(e, t) {
|
|
170
173
|
return !e || !t ? !1 : e.toLocaleLowerCase() === t.toLocaleLowerCase();
|
|
171
174
|
}
|
|
172
|
-
async function
|
|
175
|
+
async function xe(e) {
|
|
173
176
|
const t = ["feature", "oriented-imagery"].includes(e.type), r = e?.portalItem, i = e.sourceJSON;
|
|
174
177
|
if (!t || !r)
|
|
175
178
|
return !1;
|
|
@@ -179,18 +182,18 @@ async function be(e) {
|
|
|
179
182
|
const l = P(r, s.user), w = await G(e) ?? [], F = await k(e) ?? [], f = A(w, F);
|
|
180
183
|
if (!l && !f)
|
|
181
184
|
return !1;
|
|
182
|
-
const m = await
|
|
185
|
+
const m = await C(r.id, s, {
|
|
183
186
|
relationshipType: "Service2Service"
|
|
184
187
|
});
|
|
185
188
|
return !(m?.data?.relatedItems && m.data.relatedItems.some(
|
|
186
189
|
(S) => ["WMTS", "Map Service", "Vector Tile Service"].includes(S.type)
|
|
187
190
|
));
|
|
188
191
|
}
|
|
189
|
-
async function
|
|
192
|
+
async function Te(e, t, r, i) {
|
|
190
193
|
if (!r)
|
|
191
194
|
return !1;
|
|
192
195
|
const s = ["feature", "oriented-imagery"].includes(t.type), n = i?.item ?? t.portalItem, a = t.sourceJSON;
|
|
193
|
-
if (!s || !n || !n.portal.user || !E(n) || N(n) || V(n) || D(a) || n.portal.isPortal &&
|
|
196
|
+
if (!s || !n || !n.portal.user || !E(n) || N(n) || V(n) || D(a) || n.portal.isPortal && Z(n) || ["oid", "global-id", "geometry"].includes(r.type))
|
|
194
197
|
return !1;
|
|
195
198
|
const m = t.sourceJSON.geometryProperties, y = m?.shapeLengthFieldName, S = m?.shapeAreaFieldName;
|
|
196
199
|
if (o(y, r.name) || o(S, r.name))
|
|
@@ -215,28 +218,28 @@ async function Re(e, t, r, i) {
|
|
|
215
218
|
const d = t.labelingInfo?.map(
|
|
216
219
|
(p) => p.labelExpressionInfo?.expression
|
|
217
220
|
);
|
|
218
|
-
if (d && ((await I.getExpressionFields(t, d)).some((q) => o(q, r.name)) || await
|
|
221
|
+
if (d && ((await I.getExpressionFields(t, d)).some((q) => o(q, r.name)) || await j(t, r, "layer")))
|
|
219
222
|
return !1;
|
|
220
223
|
}
|
|
221
|
-
if (!i?.ignoreLayerDefinitionExpression && t.definitionExpression && (await
|
|
224
|
+
if (!i?.ignoreLayerDefinitionExpression && t.definitionExpression && (await v.parseWhereClause(t.definitionExpression, t.fieldsIndex)).fieldNames.some((h) => o(h, r.name)) || await te(t, r, i) || await re(t, r))
|
|
222
225
|
return !1;
|
|
223
|
-
if (await
|
|
226
|
+
if (await ie(t, r))
|
|
224
227
|
return await Promise.resolve(!1);
|
|
225
|
-
if (await
|
|
228
|
+
if (await se(t, r))
|
|
226
229
|
return await Promise.resolve(!1);
|
|
227
|
-
if (
|
|
230
|
+
if (ee(e, t, r) || t.relationships?.map((d) => d.keyField)?.some((d) => o(d, r.name)))
|
|
228
231
|
return !1;
|
|
229
|
-
const
|
|
230
|
-
if (!
|
|
232
|
+
const M = P(n, n.portal.user), $ = i?.userItemInfo?.userGroups ?? await G(t) ?? [], W = i?.userItemInfo?.itemGroups ?? await k(t) ?? [], B = A($, W);
|
|
233
|
+
if (!M && !B)
|
|
231
234
|
return !1;
|
|
232
|
-
const R = i?.userItemInfo?.relatedItems ?? await
|
|
235
|
+
const R = i?.userItemInfo?.relatedItems ?? await C(n.id, n.portal, {
|
|
233
236
|
relationshipType: "Service2Service"
|
|
234
237
|
});
|
|
235
238
|
return !(R?.data?.relatedItems && R.data.relatedItems.some(
|
|
236
239
|
(p) => ["WMTS", "Map Service", "Vector Tile Service"].includes(p.type)
|
|
237
240
|
));
|
|
238
241
|
}
|
|
239
|
-
function
|
|
242
|
+
function ee(e, t, r) {
|
|
240
243
|
if (!e)
|
|
241
244
|
return !1;
|
|
242
245
|
const i = e.map?.applicationProperties?.viewing?.search;
|
|
@@ -250,14 +253,14 @@ function Y(e, t, r) {
|
|
|
250
253
|
}
|
|
251
254
|
return !1;
|
|
252
255
|
}
|
|
253
|
-
async function
|
|
256
|
+
async function j(e, t, r) {
|
|
254
257
|
const i = r === "layer" ? e.labelingInfo?.filter((a) => x(a.where)) : e.sourceJSON?.drawingInfo?.labelingInfo?.filter((a) => x(a.where));
|
|
255
258
|
if (!i?.length)
|
|
256
259
|
return !1;
|
|
257
260
|
const s = [
|
|
258
261
|
...await Promise.all(
|
|
259
262
|
i.map(
|
|
260
|
-
async (a) => await
|
|
263
|
+
async (a) => await v.parseWhereClause(a.where, e.fieldsIndex)
|
|
261
264
|
)
|
|
262
265
|
)
|
|
263
266
|
];
|
|
@@ -271,11 +274,11 @@ async function U(e, t, r) {
|
|
|
271
274
|
}
|
|
272
275
|
return await Promise.resolve(n);
|
|
273
276
|
}
|
|
274
|
-
async function
|
|
277
|
+
async function te(e, t, r) {
|
|
275
278
|
const i = e.portalItem;
|
|
276
279
|
if (!i)
|
|
277
280
|
return !1;
|
|
278
|
-
const s = `${O(i.portal)}content/items/${i.id}/data`, a = (r?.userItemInfo?.itemData ?? await
|
|
281
|
+
const s = `${O(i.portal)}content/items/${i.id}/data`, a = (r?.userItemInfo?.itemData ?? await L(s, {
|
|
279
282
|
query: { f: "json" },
|
|
280
283
|
responseType: "json"
|
|
281
284
|
}))?.data;
|
|
@@ -290,12 +293,12 @@ async function Z(e, t, r) {
|
|
|
290
293
|
if ((await I.getRendererFields(f, e.fieldsIndex)).some((S) => o(S, t.name)))
|
|
291
294
|
return !0;
|
|
292
295
|
}
|
|
293
|
-
if (!r?.ignoreItemFeatureReduction && w && await
|
|
296
|
+
if (!r?.ignoreItemFeatureReduction && w && await U(e, t, w) || F && (await v.parseWhereClause(F, e.fieldsIndex)).fieldNames.some((y) => o(y, t.name)))
|
|
294
297
|
return !0;
|
|
295
298
|
}
|
|
296
299
|
return !1;
|
|
297
300
|
}
|
|
298
|
-
async function
|
|
301
|
+
async function re(e, t) {
|
|
299
302
|
const r = e.sourceJSON, i = r?.drawingInfo?.renderer, s = r?.featureReduction;
|
|
300
303
|
if (!i && !s)
|
|
301
304
|
return !1;
|
|
@@ -304,13 +307,13 @@ async function ee(e, t) {
|
|
|
304
307
|
if ((await I.getRendererFields(n, e.fieldsIndex)).some((c) => o(c, t.name)))
|
|
305
308
|
return !0;
|
|
306
309
|
}
|
|
307
|
-
return !!(s && await
|
|
310
|
+
return !!(s && await U(
|
|
308
311
|
e,
|
|
309
312
|
t,
|
|
310
313
|
s
|
|
311
314
|
));
|
|
312
315
|
}
|
|
313
|
-
async function
|
|
316
|
+
async function ie(e, t) {
|
|
314
317
|
const i = e.sourceJSON?.drawingInfo?.labelingInfo;
|
|
315
318
|
if (!i)
|
|
316
319
|
return await Promise.resolve(!1);
|
|
@@ -320,28 +323,29 @@ async function te(e, t) {
|
|
|
320
323
|
if (s) {
|
|
321
324
|
if ((await I.getExpressionFields(e, s)).some((c) => o(c, t.name)))
|
|
322
325
|
return await Promise.resolve(!0);
|
|
323
|
-
if (await
|
|
326
|
+
if (await j(e, t, "service"))
|
|
324
327
|
return await Promise.resolve(!0);
|
|
325
328
|
}
|
|
326
329
|
return await Promise.resolve(!1);
|
|
327
330
|
}
|
|
328
|
-
async function
|
|
331
|
+
async function se(e, t) {
|
|
329
332
|
const i = e.sourceJSON?.definitionQuery;
|
|
330
|
-
return i ? (await
|
|
333
|
+
return i ? (await v.parseWhereClause(i, e.fieldsIndex)).fieldNames.some((a) => o(a, t.name)) ? await Promise.resolve(!0) : await Promise.resolve(!1) : await Promise.resolve(!1);
|
|
331
334
|
}
|
|
332
|
-
async function
|
|
335
|
+
async function U(e, t, r) {
|
|
333
336
|
const i = r.type === "binning" ? Q.fromJSON(r) : K.fromJSON(r), s = /* @__PURE__ */ new Set();
|
|
334
337
|
return await I.collectFeatureReductionFields(s, e, i), !!Array.from(s).some(
|
|
335
338
|
(a) => o(a, t.name)
|
|
336
339
|
);
|
|
337
340
|
}
|
|
338
341
|
export {
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
342
|
+
Te as a,
|
|
343
|
+
Re as b,
|
|
344
|
+
xe as c,
|
|
345
|
+
ve as d,
|
|
343
346
|
O as e,
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
x as i
|
|
347
|
+
Oe as f,
|
|
348
|
+
be as g,
|
|
349
|
+
x as i,
|
|
350
|
+
H as s
|
|
347
351
|
};
|
|
@@ -6,7 +6,7 @@ import { makeAccessorController as C } from "@arcgis/lumina/controllers/accessor
|
|
|
6
6
|
import { Task as v } from "@lit/task";
|
|
7
7
|
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
8
8
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
9
|
-
v4.34.
|
|
9
|
+
v4.34.1 */
|
|
10
10
|
var w = Object.defineProperty, g = Object.getOwnPropertyDescriptor, e = (i, a, s, t) => {
|
|
11
11
|
for (var r = t > 1 ? void 0 : t ? g(a, s) : a, l = i.length - 1, c; l >= 0; l--)
|
|
12
12
|
(c = i[l]) && (r = (t ? c(a, s, r) : c(r)) || r);
|
package/dist/chunks/requests.js
CHANGED
|
@@ -2,7 +2,7 @@ import n from "@arcgis/core/request.js";
|
|
|
2
2
|
import { once as c } from "@arcgis/core/core/reactiveUtils.js";
|
|
3
3
|
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
4
4
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
5
|
-
v4.34.
|
|
5
|
+
v4.34.1 */
|
|
6
6
|
async function f(s, t) {
|
|
7
7
|
const i = `${s}/portals/self/classification/classificationSchema`, e = {};
|
|
8
8
|
try {
|
package/dist/chunks/runtime.js
CHANGED
|
@@ -3,15 +3,15 @@ import { makeRuntime as e } from "@arcgis/lumina";
|
|
|
3
3
|
import { trackAccess as s, createObservable as r, createTrackingTarget as a, runTracked as c } from "@arcgis/core/applications/Components/reactiveUtils.js";
|
|
4
4
|
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
5
5
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
6
|
-
v4.34.
|
|
7
|
-
const t = e({ defaultAssetPath: "https://
|
|
6
|
+
v4.34.1 */
|
|
7
|
+
const t = e({ defaultAssetPath: "https://js.arcgis.com/4.34/portal-components/", hydratedAttribute: "hydrated" }), { customElement: n, getAssetPath: i, setAssetPath: d } = t;
|
|
8
8
|
t.t = s;
|
|
9
9
|
t.o = r;
|
|
10
10
|
t.c = a;
|
|
11
11
|
t.r = c;
|
|
12
12
|
export {
|
|
13
13
|
n as c,
|
|
14
|
-
|
|
14
|
+
i as g,
|
|
15
15
|
t as r,
|
|
16
|
-
|
|
16
|
+
d as s
|
|
17
17
|
};
|
package/dist/chunks/useT9n.js
CHANGED
|
@@ -2,7 +2,7 @@ import { makeT9nController as o } from "@arcgis/lumina/controllers";
|
|
|
2
2
|
import { g as t } from "./runtime.js";
|
|
3
3
|
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
4
4
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
5
|
-
v4.34.
|
|
5
|
+
v4.34.1 */
|
|
6
6
|
const s = o(t);
|
|
7
7
|
export {
|
|
8
8
|
s as u
|
|
@@ -5,7 +5,7 @@ import { u as f } from "../../chunks/useT9n.js";
|
|
|
5
5
|
import { css as d, html as t } from "lit";
|
|
6
6
|
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
7
7
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
8
|
-
v4.34.
|
|
8
|
+
v4.34.1 */
|
|
9
9
|
const m = d`.banner{box-sizing:border-box;width:100%;left:0;text-align:center;font-family:var(--calcite-font-family);background-color:#fff;color:#000;padding:var(--calcite-spacing-sm);font-size:var(--calcite-font-size);text-transform:uppercase;overflow-wrap:break-word}.invalid-container{background-color:#fff;color:#000;display:flex;align-items:center;justify-content:center;gap:8px}.invalid-icon{--calcite-icon-color: var(--calcite-color-status-danger)}.invalid-message{text-align:center;font-family:var(--calcite-font-family);background-color:#fff;color:#000;padding:var(--calcite-spacing-sm);font-size:var(--calcite-font-size);overflow-wrap:break-word}`;
|
|
10
10
|
class h extends r {
|
|
11
11
|
constructor() {
|
|
@@ -13,7 +13,7 @@ import { watch as F } from "@arcgis/core/core/reactiveUtils.js";
|
|
|
13
13
|
import { r as D } from "../../chunks/requests.js";
|
|
14
14
|
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
15
15
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
16
|
-
v4.34.
|
|
16
|
+
v4.34.1 */
|
|
17
17
|
async function T({
|
|
18
18
|
portalClassificationSchema: s,
|
|
19
19
|
itemClassification: t
|
|
@@ -7,7 +7,7 @@ import { u as d, r as v } from "../../chunks/requests.js";
|
|
|
7
7
|
import { g as h } from "../../chunks/common.js";
|
|
8
8
|
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
9
9
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
10
|
-
v4.34.
|
|
10
|
+
v4.34.1 */
|
|
11
11
|
const m = r`.select-favorite-label{display:flex;justify-content:space-between;align-items:center}.favorite-actions{display:flex;justify-content:flex-end;gap:1.5rem;align-items:center}.classification-favorite-dialog{--calcite-dialog-content-space: 0;--calcite-dialog-background-color: "var(--calcite-color-foreground-2)"}.save-new-favorite-button{display:flex;justify-content:flex-end;margin-top:.25rem;margin-bottom:1rem}.classification-favorite-item{display:flex;justify-content:space-between;padding-top:.5rem;padding-bottom:.5rem;border-bottom:1px solid var(--calcite-color-border-1)}.classification-favorite-list,.classification-favorite-input-section{margin:1.75rem 1rem}`;
|
|
12
12
|
class C extends n {
|
|
13
13
|
constructor() {
|
|
@@ -5,7 +5,7 @@ import { css as d, html as i } from "lit";
|
|
|
5
5
|
import { u as h } from "../../chunks/useT9n.js";
|
|
6
6
|
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
7
7
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
8
|
-
v4.34.
|
|
8
|
+
v4.34.1 */
|
|
9
9
|
const m = d`.spacing-y{margin:var(--calcite-spacing-md) 0}.portal-classification-form-element-tooltip{display:flex;justify-content:space-between;align-items:center}`;
|
|
10
10
|
function l(n, e) {
|
|
11
11
|
return n.uiElement === e;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { c as k } from "../../chunks/runtime.js";
|
|
2
2
|
import { html as p, css as M } from "lit";
|
|
3
|
-
import { LitElement as O, createEvent as
|
|
3
|
+
import { LitElement as O, createEvent as v, renderElement as T } from "@arcgis/lumina";
|
|
4
4
|
import { createRef as I, ref as N } from "lit/directives/ref.js";
|
|
5
5
|
import { Task as P } from "@lit/task";
|
|
6
6
|
import * as x from "@arcgis/core/core/lang.js";
|
|
@@ -8,11 +8,11 @@ import L from "@arcgis/core/layers/support/FeatureTemplate.js";
|
|
|
8
8
|
import S from "@arcgis/core/Graphic.js";
|
|
9
9
|
import j from "@arcgis/core/identity/IdentityManager.js";
|
|
10
10
|
import y from "@arcgis/core/request.js";
|
|
11
|
-
import { a as B, g as U, b as q, d as R, e as w, f as
|
|
12
|
-
import { u as
|
|
11
|
+
import { a as B, g as U, b as q, d as R, s as J, e as w, f as z, i as D } from "../../chunks/fieldAddDelete.js";
|
|
12
|
+
import { u as W } from "../../chunks/useT9n.js";
|
|
13
13
|
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
14
14
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
15
|
-
v4.34.
|
|
15
|
+
v4.34.1 */
|
|
16
16
|
const n = /* @__PURE__ */ new Map();
|
|
17
17
|
n.set("oid", "key");
|
|
18
18
|
n.set("guid", "key");
|
|
@@ -30,23 +30,23 @@ n.set("date-only", "calendar");
|
|
|
30
30
|
n.set("time-only", "clock");
|
|
31
31
|
n.set("timestamp-offset", "time-zone");
|
|
32
32
|
n.set("string", "string");
|
|
33
|
-
const
|
|
34
|
-
class
|
|
33
|
+
const _ = ({ fieldType: $ }) => p`<calcite-icon scale=s .icon=${n.get($)}></calcite-icon>`, V = M`.dialog{--calcite-dialog-max-size-y: 60%}.dialog-content-wrapper{position:relative;min-height:100px}.hide-overflow{overflow:hidden}.field-icons{padding:0 var(--calcite-spacing-lg);display:flex;align-items:center}.warning{border-bottom:var(--calcite-border-width-sm) solid var(--calcite-color-border-3);margin-bottom:var(--calcite-spacing-md)}.warning-message{font-size:var(--calcite-font-size--1);font-weight:var(--calcite-font-weight-bold)}.loader-container{position:absolute;height:100%;width:100%;top:0;right:0;display:none;z-index:40;overflow:hidden;background:#fffffff2;padding:0}.active{display:flex;flex-direction:column;align-items:center;justify-content:center}.loader{padding:0}.loader-text{font-weight:var(--calcite-font-weight-medium);text-align:center;margin-right:6.25rem;margin-left:6.25rem}`;
|
|
34
|
+
class G extends O {
|
|
35
35
|
constructor() {
|
|
36
|
-
super(...arguments), this.arcadeExpMap = /* @__PURE__ */ new Map(), this.cancelNode = I(), this.dialogNode = I(), this.layerFields = [], this.layerFieldsMap = /* @__PURE__ */ new Map(), this.messages =
|
|
36
|
+
super(...arguments), this.arcadeExpMap = /* @__PURE__ */ new Map(), this.cancelNode = I(), this.dialogNode = I(), this.layerFields = [], this.layerFieldsMap = /* @__PURE__ */ new Map(), this.messages = W({ blocking: !0 }), this.deleteInProgress = !1, this.fieldsAreDeletable = !1, this._propWatcherTask = new P(this, {
|
|
37
37
|
task: async ([e, t]) => {
|
|
38
38
|
if (!(D(e) && D(t)))
|
|
39
39
|
throw console.error("Required properties are missing."), new Error();
|
|
40
40
|
this._propWatcherTask.autoRun = !1, await this.processProps();
|
|
41
41
|
},
|
|
42
42
|
args: () => [this.layer, this.fieldNames]
|
|
43
|
-
}), this.arcgisBeforeModalClose =
|
|
43
|
+
}), this.arcgisBeforeModalClose = v(), this.arcgisClose = v(), this.arcgisFieldsDeleted = v();
|
|
44
44
|
}
|
|
45
45
|
static {
|
|
46
46
|
this.properties = { config: 0, fieldNames: 0, layer: 0, mapView: 0, options: 0 };
|
|
47
47
|
}
|
|
48
48
|
static {
|
|
49
|
-
this.styles =
|
|
49
|
+
this.styles = V;
|
|
50
50
|
}
|
|
51
51
|
async processProps() {
|
|
52
52
|
const { layer: e, mapView: t, fieldNames: s } = this;
|
|
@@ -75,12 +75,12 @@ class V extends O {
|
|
|
75
75
|
return this.getFieldDisplayNameFromLayerFields(e);
|
|
76
76
|
{
|
|
77
77
|
const o = (t.popupTemplate ?? t.createPopupTemplate()).fieldInfos?.find((r) => r.fieldName === e);
|
|
78
|
-
return o ? R(o, s) : this.getFieldDisplayNameFromLayerFields(e);
|
|
78
|
+
return o ? R(t, o, s) : this.getFieldDisplayNameFromLayerFields(e);
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
getFieldDisplayNameFromLayerFields(e) {
|
|
82
|
-
const t = this.layerFieldsMap.get(e);
|
|
83
|
-
return t.alias ??
|
|
82
|
+
const { layer: t } = this, s = this.layerFieldsMap.get(e);
|
|
83
|
+
return J(t) ? t.getFieldAlias(e) : s.alias ?? s.name;
|
|
84
84
|
}
|
|
85
85
|
async deleteFields() {
|
|
86
86
|
const { layer: e, fieldNames: t } = this, s = `${e.url.replace("/rest/services", "/rest/admin/services")}/${e.layerId}/deleteFromDefinition`, a = {
|
|
@@ -185,8 +185,8 @@ class V extends O {
|
|
|
185
185
|
c?.attributeTableInfo?.attributeTableElements && (c.attributeTableInfo.attributeTableElements = c.attributeTableInfo.attributeTableElements.filter((f) => !(f.type === "field" && f.fieldName === g)), c.attributeTableInfo.orderByFields = c.attributeTableInfo.orderByFields.filter((f) => f.field !== g));
|
|
186
186
|
}), c?.layerDefinition?.fieldConfigurations && (c.layerDefinition.fieldConfigurations = c.layerDefinition.fieldConfigurations.filter((g) => !s.includes(g.name))), c?.popupInfo) {
|
|
187
187
|
s.forEach((b) => {
|
|
188
|
-
c.popupInfo.fieldInfos = c.popupInfo.fieldInfos.filter((
|
|
189
|
-
|
|
188
|
+
c.popupInfo.fieldInfos = c.popupInfo.fieldInfos.filter((F) => F.fieldName !== b), c.popupInfo.popupElements?.forEach((F, E) => {
|
|
189
|
+
F.type === "fields" && F.fieldInfos && (c.popupInfo.popupElements[E].fieldInfos = c.popupInfo.popupElements[E].fieldInfos.filter((C) => C.fieldName !== b));
|
|
190
190
|
});
|
|
191
191
|
});
|
|
192
192
|
const g = `${w(this.portal)}content/users/${this.item.owner}/items/${this.item.id}/update`, f = {};
|
|
@@ -247,7 +247,7 @@ class V extends O {
|
|
|
247
247
|
const { fieldNames: e, layerFields: t, layerFieldsMap: s, arcadeExpMap: a, messages: o } = this;
|
|
248
248
|
return p`<calcite-list .label=${o.fields}>${e.map((r) => {
|
|
249
249
|
const h = t.find((u) => u.name === r);
|
|
250
|
-
return p`<calcite-list-item .label=${this.getFieldLabel(r)} .description=${`{${r}}`} .value=${r} .disabled=${!h.editable}><div slot=actions-end class="field-icons">${
|
|
250
|
+
return p`<calcite-list-item .label=${this.getFieldLabel(r)} .description=${`{${r}}`} .value=${r} .disabled=${!h.editable}><div slot=actions-end class="field-icons">${_({ fieldType: z(r, s, a) })}</div></calcite-list-item>`;
|
|
251
251
|
})}</calcite-list>`;
|
|
252
252
|
}
|
|
253
253
|
renderCancelButton() {
|
|
@@ -262,7 +262,7 @@ class V extends O {
|
|
|
262
262
|
}}>${t.length === 1 ? e.deleteField : e.deleteFieldsWithNumber.replace("${number}", `${t.length}`)}</calcite-button>`;
|
|
263
263
|
}
|
|
264
264
|
}
|
|
265
|
-
k("arcgis-portal-field-delete",
|
|
265
|
+
k("arcgis-portal-field-delete", G);
|
|
266
266
|
export {
|
|
267
|
-
|
|
267
|
+
G as ArcgisPortalFieldDelete
|
|
268
268
|
};
|
package/dist/docs/api.json
CHANGED
package/dist/docs/docs.json
CHANGED
package/dist/docs/web-types.json
CHANGED
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { g as a, s as t } from "./chunks/runtime.js";
|
|
|
2
2
|
import { c as o, a as r } from "./chunks/fieldAddDelete.js";
|
|
3
3
|
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
4
4
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
5
|
-
v4.34.
|
|
5
|
+
v4.34.1 */
|
|
6
6
|
export {
|
|
7
7
|
o as canAddField,
|
|
8
8
|
r as canDeleteField,
|
package/dist/loader.js
CHANGED
|
@@ -2,7 +2,7 @@ import { r as i } from "./chunks/runtime.js";
|
|
|
2
2
|
import { makeDefineCustomElements as t } from "@arcgis/lumina";
|
|
3
3
|
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
4
4
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
5
|
-
v4.34.
|
|
5
|
+
v4.34.1 */
|
|
6
6
|
const s = t(i, {
|
|
7
7
|
"arcgis-portal-classification-banner": [() => import("./components/arcgis-portal-classification-banner/customElement.js"), "autoDestroyDisabled,missingExistingClassification,portalItem:,validationErrors,variant;destroy"],
|
|
8
8
|
"arcgis-portal-classification-config": [() => import("./components/arcgis-portal-classification-config/customElement.js"), "autoDestroyDisabled,portalItem:,status,valid,values;destroy,resetForm,validateForm"],
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/// <reference types="@arcgis/core/interfaces.d.ts" />
|
|
2
|
+
export declare function supportsFieldConfigurations(layer: any): boolean;
|
|
2
3
|
/**
|
|
3
4
|
* Returns true if the value is defined
|
|
4
5
|
* @param value - value to check
|
|
5
6
|
*/
|
|
6
7
|
export declare function isDefined<T>(value?: T | null): value is T;
|
|
7
|
-
export declare function getFieldDisplayName(field: __esri.FieldInfo, arcadeMap: Map<string, __esri.ExpressionInfo>): string;
|
|
8
|
+
export declare function getFieldDisplayName(layer: any, field: __esri.FieldInfo, arcadeMap: Map<string, __esri.ExpressionInfo>): string;
|
|
8
9
|
export declare function getFieldType(fieldName: string, layerFieldsMap: Map<string, __esri.Field>, arcadeExpMap: Map<string, __esri.ExpressionInfo>): string;
|
|
9
10
|
export declare function generateLayerFieldsMap(layer: any): Promise<Map<string, __esri.Field>>;
|
|
10
11
|
export declare function generateArcadeExpressionMap(popupTemplate: __esri.PopupTemplate): Map<string, __esri.ExpressionInfo>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/portal-components",
|
|
3
|
-
"version": "4.34.
|
|
3
|
+
"version": "4.34.1",
|
|
4
4
|
"description": "ArcGIS Portal Components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ArcGIS",
|
|
@@ -38,14 +38,14 @@
|
|
|
38
38
|
],
|
|
39
39
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@arcgis/lumina": "4.34.
|
|
42
|
-
"@arcgis/toolkit": "4.34.
|
|
41
|
+
"@arcgis/lumina": "4.34.1",
|
|
42
|
+
"@arcgis/toolkit": "4.34.1",
|
|
43
43
|
"@lit/task": "^1.0.2",
|
|
44
44
|
"lit": "^3.3.0",
|
|
45
45
|
"tslib": "^2.8.1"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@arcgis/core": "
|
|
48
|
+
"@arcgis/core": "~4.34.0",
|
|
49
49
|
"@esri/calcite-components": "^3.3.2"
|
|
50
50
|
},
|
|
51
51
|
"css.customData": [
|
package/dist/cdn/5SEAUGGG.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
2
|
-
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
3
|
-
v4.34.0-next.168 */
|
|
4
|
-
import{b as J}from"./JJZ5KY2U.js";import{d as B}from"./TE4RGDVF.js";import{B as P,C as A,D as j,G as D,I as R,h as M,j as y,p as x}from"./NMPILHJJ.js";export default $arcgis.t(([H,ge,we,be,$,I,Y,X,k,S,T])=>{var C=(i=>(i.expression="expression/",i.raster="Raster.",i.relationship="relationships/",i))(C||{});function N(i){return i!=null}function W(i,e){let t=i.fieldName;if(t.includes(C.expression)){let s=e.get(t);return s?.title?s.title:t}else return i.label?i.label:t}function q(i,e,t){let s="";if(/^raster.(?:item|service)pixelvalue/iu.test(i))s="number";else if(e.has(i)){let r=e.get(i);s=r.type?r.type.toLowerCase():""}else if(t.has(i)){let r=t.get(i);s=r.returnType?r.returnType.toLowerCase():""}else s="number";return s}async function _(i){return new Map((await Z(i)).filter(e=>e.visible).map(e=>[e.name,e]))}function V(i){let e=new Map;return i?.expressionInfos&&i.expressionInfos.forEach(t=>{let s=`${C.expression}${t.name}`;e.set(s,t)}),e}async function Z(i){return await new Promise((e,t)=>{switch(i.type){case"feature":case"ogc-feature":case"stream":e(i.fields);break;case"sublayer":{let s=i,r=s?.layer;r?.portalItem&&r.url.includes("https://demographics")&&r.url.includes(".arcgis.com")?r.portalItem?.fetchData().then(a=>{if(a?.thematicGroup){let n=new Map(s.fields.map(o=>[o.name,o])),c=a.thematicGroup.fieldNames,p=[];c.forEach(o=>{n.has(o)&&p.push(n.get(o))}),e(p)}else e(s.fields)}).catch(a=>{t(new Error(a))}):e(s.fields);break}case"imagery":case"imagery-tile":case"wcs":e(i.rasterFields);break;default:e("fields"in i?i.fields??[]:[])}})}var ee=i=>i&&!i.endsWith("/")?`${i}/`:i;function F(i){return ee(i.restUrl)}function te(i,e){return z(i,e)||ie(i,e)}function z(i,e){return i.owner===e.username}function ie(i,e){let t=i.owner,s=i.itemControl==="admin",r=["esri_livingatlas","esri_demographics","esri_boundaries"];return i.portal?.isPortal&&!z(i,e)&&s&&t?.includes("esri_")&&!r.includes(t)?!1:s}function se(i){return i.typeKeywords?.includes("Spatiotemporal")}function re(i){return i.typeKeywords?.includes("View Service")}function ae(i){return i.typeKeywords?.includes("Hosted Service")}function ne(i){return i.typeKeywords?.includes("Multi Services View")}function oe(i){return i?.hasViews&&!i.sourceSchemaChangesAllowed}async function le(i){let e=i?.portalItem;if(!e)return await Promise.resolve(null);let t=e.portal;if(t?.user){let s=`${F(t)}community/users/${t.user.username}`;return await S(s,{query:{f:"json",token:e.portal.credential?.token},responseType:"json"}).then(async r=>{let a=r.data?.groups??[];return await Promise.resolve(a)},async()=>await Promise.reject(new Error("Failed to fetch user groups")))}return await Promise.resolve(null)}async function de(i){let e=i?.portalItem;if(!e)return await Promise.resolve(null);let t=e.portal,s=`${F(t)}content/items/${e.id}/groups`;return await S(s,{query:{f:"json",token:e.portal.credential?.token},responseType:"json"}).then(async r=>{let a=r.data?.admin??[],n=r.data?.member??[],c=r.data?.other??[],p=[...a,...n,...c];return await Promise.resolve(p)},async()=>await Promise.reject(new Error("Failed to fetch item groups")))}async function ce(i,e,{relationshipType:t,direction:s}){let r=`${F(e)}content/items/${i}/relatedItems`;return await S(r,{query:{f:"json",relationshipType:t,direction:s},responseType:"json"})}function pe(i,e){return i?.some(t=>e?.some(s=>t.id===s.id&&t.capabilities.includes("updateitemcontrol")))}function d(i,e){return!i||!e?!1:i.toLocaleLowerCase()===e.toLocaleLowerCase()}async function U(i,e,t,s){if(!t)return!1;let r=["feature","oriented-imagery"].includes(e.type),a=s?.item??e.portalItem,n=e.sourceJSON;if(!r||!a||!a.portal.user||!ae(a)||re(a)||ne(a)||oe(n)||a.portal.isPortal&&se(a)||["oid","global-id","geometry"].includes(t.type))return!1;let c=e.sourceJSON.geometryProperties,p=c?.shapeLengthFieldName,o=c?.shapeAreaFieldName;if(d(p,t.name)||d(o,t.name))return!1;let l=e.editFieldsInfo;if(l&&(d(l.creationDateField,t.name)||d(l.creatorField,t.name)||d(l.editDateField,t.name)||d(l.editorField,t.name))||d(e.objectIdField,t.name)||d(e.displayField,t.name)||d(e.typeIdField,t.name)||d(e.subtypeField,t.name)||e.timeInfo&&(d(e.timeInfo.startField,t.name)||d(e.timeInfo.endField,t.name)||d(e.timeInfo.trackIdField,t.name)))return!1;if(!s?.ignoreLayerRenderer&&e.featureReduction){let u=new Set;if(await I.collectFeatureReductionFields(u,e,e.featureReduction),Array.from(u).some(b=>d(b,t.name)))return!1}if(!s?.ignoreLayerRenderer&&(await I.getRendererFields(e.renderer,e.fieldsIndex)).some(u=>d(u,t.name)))return!1;if(!s?.ignoreLayerLabelingInfo){let u=e.labelingInfo?.map(b=>b.labelExpressionInfo?.expression);if(u&&((await I.getExpressionFields(e,u)).some(b=>d(b,t.name))||await G(e,t,"layer")))return!1}if(!s?.ignoreLayerDefinitionExpression&&e.definitionExpression&&(await T.parseWhereClause(e.definitionExpression,e.fieldsIndex)).fieldNames.some(u=>d(u,t.name))||await ue(e,t,s)||await me(e,t))return!1;if(await he(e,t))return await Promise.resolve(!1);if(await ye(e,t))return await Promise.resolve(!1);if(fe(i,e,t)||e.relationships?.map(u=>u.keyField)?.some(u=>d(u,t.name)))return!1;let f=te(a,a.portal.user),v=s?.userItemInfo?.userGroups??await le(e)??[],h=s?.userItemInfo?.itemGroups??await de(e)??[],w=pe(v,h);if(!f&&!w)return!1;let g=s?.userItemInfo?.relatedItems??await ce(a.id,a.portal,{relationshipType:"Service2Service"});return!(g?.data?.relatedItems&&g.data.relatedItems.some(u=>["WMTS","Map Service","Vector Tile Service"].includes(u.type)))}function fe(i,e,t){if(!i)return!1;let s=i.map?.applicationProperties?.viewing?.search;if(s){let r=s.layers?.find(a=>a.id===e.id);if(r){let a=r?.field?.name;if(a)return d(a,t.name)}}return!1}async function G(i,e,t){let s=t==="layer"?i.labelingInfo?.filter(n=>N(n.where)):i.sourceJSON?.drawingInfo?.labelingInfo?.filter(n=>N(n.where));if(!s?.length)return!1;let r=[...await Promise.all(s.map(async n=>await T.parseWhereClause(n.where,i.fieldsIndex)))],a=!1;for(let n=0;n<r.length;n++){let c=r[n].fieldNames?.some(p=>d(p,e.name));if(!a&&c){a=!0;break}}return await Promise.resolve(a)}async function ue(i,e,t){let s=i.portalItem;if(!s)return!1;let r=`${F(s.portal)}content/items/${s.id}/data`,a=(t?.userItemInfo?.itemData??await S(r,{query:{f:"json"},responseType:"json"}))?.data;if(!a)return!1;if(a?.layers){let n=a.layers.find(l=>l.id===i.layerId),c=n?.layerDefinition?.drawingInfo?.renderer,p=n?.layerDefinition?.featureReduction,o=n?.layerDefinition?.definitionExpression;if(!c&&!p&&!o)return!1;if(!t?.ignoreItemRenderer&&c){let l=k.fromJSON(c);if((await I.getRendererFields(l,i.fieldsIndex)).some(f=>d(f,e.name)))return!0}if(!t?.ignoreItemFeatureReduction&&p&&await K(i,e,p)||o&&(await T.parseWhereClause(o,i.fieldsIndex)).fieldNames.some(l=>d(l,e.name)))return!0}return!1}async function me(i,e){let t=i.sourceJSON,s=t?.drawingInfo?.renderer,r=t?.featureReduction;if(!s&&!r)return!1;if(s){let a=k.fromJSON(s);if((await I.getRendererFields(a,i.fieldsIndex)).some(n=>d(n,e.name)))return!0}return!!(r&&await K(i,e,r))}async function he(i,e){let t=i.sourceJSON?.drawingInfo?.labelingInfo;if(!t)return await Promise.resolve(!1);let s=t?.map(r=>r.labelExpressionInfo?.expression);if(s){if((await I.getExpressionFields(i,s)).some(r=>d(r,e.name)))return await Promise.resolve(!0);if(await G(i,e,"service"))return await Promise.resolve(!0)}return await Promise.resolve(!1)}async function ye(i,e){let t=i.sourceJSON?.definitionQuery;return t?(await T.parseWhereClause(t,i.fieldsIndex)).fieldNames.some(s=>d(s,e.name))?await Promise.resolve(!0):await Promise.resolve(!1):await Promise.resolve(!1)}async function K(i,e,t){let s=t.type==="binning"?Y.fromJSON(t):X.fromJSON(t),r=new Set;return await I.collectFeatureReductionFields(r,i,s),!!Array.from(r).some(a=>d(a,e.name))}var m=new Map;m.set("oid","key");m.set("guid","key");m.set("global-id","key");m.set("blob","binary");m.set("integer","integer");m.set("small-integer","integer");m.set("big-integer","integer");m.set("single","number");m.set("double","number");m.set("long","number");m.set("number","number");m.set("date","date-time");m.set("date-only","calendar");m.set("time-only","clock");m.set("timestamp-offset","time-zone");m.set("string","string");var Ie=({fieldType:i})=>y`<calcite-icon scale=s .icon=${m.get(i)}></calcite-icon>`,ve=M`.dialog{--calcite-dialog-max-size-y: 60%}.dialog-content-wrapper{position:relative;min-height:100px}.hide-overflow{overflow:hidden}.field-icons{padding:0 var(--calcite-spacing-lg);display:flex;align-items:center}.warning{border-bottom:var(--calcite-border-width-sm) solid var(--calcite-color-border-3);margin-bottom:var(--calcite-spacing-md)}.warning-message{font-size:var(--calcite-font-size--1);font-weight:var(--calcite-font-weight-bold)}.loader-container{position:absolute;height:100%;width:100%;top:0;right:0;display:none;z-index:40;overflow:hidden;background:#fffffff2;padding:0}.active{display:flex;flex-direction:column;align-items:center;justify-content:center}.loader{padding:0}.loader-text{font-weight:var(--calcite-font-weight-medium);text-align:center;margin-right:6.25rem;margin-left:6.25rem}`,L=class extends j{constructor(){super(...arguments),this.arcadeExpMap=new Map,this.cancelNode=P(),this.dialogNode=P(),this.layerFields=[],this.layerFieldsMap=new Map,this.messages=B({blocking:!0}),this.deleteInProgress=!1,this.fieldsAreDeletable=!1,this._propWatcherTask=new J(this,{task:async([e,t])=>{if(!(N(e)&&N(t)))throw console.error("Required properties are missing."),new Error;this._propWatcherTask.autoRun=!1,await this.processProps()},args:()=>[this.layer,this.fieldNames]}),this.arcgisBeforeModalClose=x(),this.arcgisClose=x(),this.arcgisFieldsDeleted=x()}static{this.properties={config:0,fieldNames:0,layer:0,mapView:0,options:0}}static{this.styles=ve}async processProps(){let{layer:e,mapView:t,fieldNames:s}=this;if(!e||!s){this.fieldsAreDeletable=!1;return}e.loaded||await e.load(),this.layerFields=e.fields.filter(a=>s.includes(a.name));let r=s.some(a=>!e.fields.find(n=>n.name===a));if(!this.layerFields?.length||r)this.fieldsAreDeletable=!1;else{let a=await Promise.all(this.layerFields.map(async n=>await U(t,e,n,this.options)));if(this.fieldsAreDeletable=a.every(n=>n),!this.fieldsAreDeletable)return}if(this.layerFieldsMap=await _(e),this.options?.ignorePopupTemplate||(this.arcadeExpMap=V(e.popupTemplate)),this.portal=e.portalItem?.portal??this.options?.portal,this.item=e.portalItem??this.options?.item,!this.item){this.fieldsAreDeletable=!1;return}await be.getCredential(this.item.url.replace("rest/services","rest/admin/services"))}getFieldLabel(e){let{layer:t,arcadeExpMap:s}=this;if(this.options?.ignorePopupTemplate)return this.getFieldDisplayNameFromLayerFields(e);{let r=(t.popupTemplate??t.createPopupTemplate()).fieldInfos?.find(a=>a.fieldName===e);return r?W(r,s):this.getFieldDisplayNameFromLayerFields(e)}}getFieldDisplayNameFromLayerFields(e){let t=this.layerFieldsMap.get(e);return t.alias??t.name}async deleteFields(){let{layer:e,fieldNames:t}=this,s=`${e.url.replace("/rest/services","/rest/admin/services")}/${e.layerId}/deleteFromDefinition`,r={fields:t.map(n=>({name:n}))},a={deleteFromDefinition:JSON.stringify(r)};await $(s,{query:{...a,f:"json",async:!1},method:"post",responseType:"json"}).then(async n=>{if(n.data?.success){let c=`${e.url}/${e.layerId}`;t.forEach(o=>{e.type==="feature"&&e.floorInfo?.floorField===o&&(e.floorInfo=null)});let p=await $(c,{query:{f:"json"},responseType:"json"});if(p){let o=p.data;this.currentLayerInfo=p.data,o&&(this.updateTypesAndTemplatesOnLayer(),t.forEach(l=>{o.templates?.length?o.templates.forEach(f=>delete f.prototype.attributes[l]):o.types?.forEach(f=>{f.templates.forEach(v=>delete v.prototype.attributes[l])})}),this.updateFeatureService(o))}else this.handleError()}},()=>this.handleError())}updateTypesAndTemplatesOnLayer(){let{currentLayerInfo:e}=this,t=e;if(t.templates?.length){let s=this.updateTemplatesList(t.templates);t.templates=s}else if(t.types){let s=t.types;t.types=[],s.forEach(r=>{r.templates=this.updateTemplatesList(r.templates),this.addType(t,r)})}}updateTemplatesList(e){let{currentLayerInfo:t,messages:s}=this,r=[];return(e??[]).forEach(a=>{let n=new ge;n.description=a.description??"",n.name=a.name||s.newFeature,n.drawingTool=a.drawingTool||"point";let c={};t.fields.forEach(o=>{let l=!1;for(let f=0;f<a.prototype.attributes.length;f++)if(a.prototype.attributes[f]===o.name){l=!0,c[o.name]=a.prototype.attributes[o.name];break}!l&&o.editable&&(c[o.name]=o.defaultValue||null)});let p=new we({attributes:c});n.prototype=p,r.push(n)}),r}addType(e,t){e.types?e.types.some(s=>s.id===t.id)||e.types.push(t):e.types=[t]}async updateFeatureService(e){let{layer:t,fieldNames:s}=this,r={templates:e.templates,types:e.types},a=`${t.url.replace("/rest/services","/rest/admin/services")}/${t.layerId}/updateDefinition`,n={f:"json",updateDefinition:JSON.stringify(r)};await $(a,{query:{...n,f:"json"},method:"post",responseType:"json"}).then(async c=>{if(c.data?.success){let p=`${F(this.portal)}content/items/${this.item.id}/data`;if(this.options?.ignorePopupTemplate||s.forEach(o=>{t.popupTemplate?.fieldInfos&&(t.popupTemplate.fieldInfos=t.popupTemplate.fieldInfos.filter(l=>l.fieldName!==o)),t.popupTemplate?.content?.forEach((l,f)=>{l.type==="fields"&&l.fieldInfos&&((t.popupTemplate?.content)[f].fieldInfos=(t.popupTemplate?.content)[f].fieldInfos?.filter(v=>v.fieldName!==o))})}),t.attributeTableTemplate){let o=t.attributeTableTemplate.clone();o.elements=o.elements.filter(l=>!(l.type==="field"&&s.includes(l.fieldName))),o.orderByFields=o.orderByFields.filter(l=>!s.includes(l.field)),t.attributeTableTemplate=o}if(t.fieldConfigurations?.length){let o=H.clone(t.fieldConfigurations).filter(l=>!s.includes(l.name));t.fieldConfigurations=o}await $(p,{query:{f:"json"},responseType:"json"}).then(async o=>{let l=o.data;if(l?.layers||l?.tables){let f=t.isTable,v=f?l.tables:l.layers,h=v?.find(w=>w.id===t.layerId);if(s.forEach(w=>{h?.attributeTableInfo?.attributeTableElements&&(h.attributeTableInfo.attributeTableElements=h.attributeTableInfo.attributeTableElements.filter(g=>!(g.type==="field"&&g.fieldName===w)),h.attributeTableInfo.orderByFields=h.attributeTableInfo.orderByFields.filter(g=>g.field!==w))}),h?.layerDefinition?.fieldConfigurations&&(h.layerDefinition.fieldConfigurations=h.layerDefinition.fieldConfigurations.filter(w=>!s.includes(w.name))),h?.popupInfo){s.forEach(b=>{h.popupInfo.fieldInfos=h.popupInfo.fieldInfos.filter(E=>E.fieldName!==b),h.popupInfo.popupElements?.forEach((E,O)=>{E.type==="fields"&&E.fieldInfos&&(h.popupInfo.popupElements[O].fieldInfos=h.popupInfo.popupElements[O].fieldInfos.filter(Q=>Q.fieldName!==b))})});let w=`${F(this.portal)}content/users/${this.item.owner}/items/${this.item.id}/update`,g={};f?(g.tables=v,l.layers&&(g.layers=l.layers)):(g.layers=v,l.tables&&(g.tables=l.tables));let u={f:"json",text:JSON.stringify(g)};await $(w,{query:{...u},method:"post",responseType:"json"}).then(b=>{b.data?.success?this.handleSuccess():this.handleError()},()=>this.handleError())}else this.handleSuccess()}else o.httpStatus===200&&(!o.data||JSON.stringify(o.data)==="{}")?this.handleSuccess():this.handleError()},()=>this.handleError())}},()=>this.handleError())}handleSuccess(){this.arcgisFieldsDeleted.emit(),this.dialogNode?.value&&(this.dialogNode.value.open=!1),this.options?.handleCloseOnConsumer?this.arcgisBeforeModalClose.emit("success"):this.displaySuccessAlert()}handleError(e){this.dialogNode?.value&&(this.dialogNode.value.open=!1),e?this.options?.handleCloseOnConsumer?this.arcgisBeforeModalClose.emit("read-only-error"):this.displayReadOnlyErrorAlert():this.options?.handleCloseOnConsumer?this.arcgisBeforeModalClose.emit("error"):this.displayErrorAlert()}displaySuccessAlert(){let{messages:e,fieldNames:t}=this;this.successAlertNode&&(this.successAlertNode.parentElement?.removeChild(this.successAlertNode),this.successAlertNode=void 0),this.successAlertNode=D(y`<calcite-alert .label=${t.length===1?e.fieldDeleted:e.fieldsDeleted} kind=success icon=check-circle auto-close open><div slot=message>${t.length===1?e.fieldDeleted:e.fieldsDeleted}</div></calcite-alert>`),document.body.append(this.successAlertNode)}displayErrorAlert(){let{messages:e}=this;this.errorAlertNode&&(this.errorAlertNode.parentElement?.removeChild(this.errorAlertNode),this.errorAlertNode=void 0),this.errorAlertNode=D(y`<calcite-alert .label=${e.fieldDeletionUnsuccessful} kind=danger icon=exclamation-mark-triangle auto-close open><div slot=message>${e.fieldDeletionUnsuccessful}</div></calcite-alert>`),document.body.append(this.errorAlertNode)}displayReadOnlyErrorAlert(){let{messages:e,portal:t}=this;this.errorAlertNode&&(this.errorAlertNode.parentElement?.removeChild(this.errorAlertNode),this.errorAlertNode=void 0),this.errorAlertNode=D(y`<calcite-alert .label=${e.fieldDeletionUnsuccessful} kind=danger icon=exclamation-mark-triangle auto-close auto-close-duration=slow open><div slot=title>${e.error}</div><div slot=message>${t.isPortal?e.readOnlyErrorMessageEnterprise:e.readOnlyErrorMessage}</div>${!t.isPortal&&y`<calcite-link slot=link target=_blank href=https://status.arcgis.com>${e.healthDashboard}</calcite-link>`||""}</calcite-alert>`),document.body.append(this.errorAlertNode)}render(){let{messages:e,fieldsAreDeletable:t,fieldNames:s,deleteInProgress:r}=this;return this._propWatcherTask.render({complete:()=>(t||(s?.length?s?.length===1?console.error("Field cannot be deleted"):console.error("One or more fields cannot be deleted"):console.error("You must select at least one field.")),y`<calcite-dialog class="dialog" width=s open modal outside-close-disabled escape-disabled @calciteDialogClose=${()=>this.arcgisClose.emit()} .heading=${s?.length===1?e.deleteField:e.deleteFields} ${A(this.dialogNode)}>${t?y`<div class=${`dialog-content-wrapper ${r?"hide-overflow":""}`}>${this.renderDeleteLoader()}<calcite-label>${s.length===1?e.deletePrompt:e.deleteMultiplePrompt}</calcite-label>${this.renderFieldsPreview()}</div>${this.renderCancelButton()}${this.renderDeleteButton()}`:this.renderError()}</calcite-dialog>`)})}renderError(){let{messages:e}=this;return y`<div class="loader-container active"><div class="loader-text">${e.errorOccurred}</div></div>`}renderDeleteLoader(){let{messages:e,fieldNames:t,deleteInProgress:s}=this;return y`<div class=${`loader-container ${s?"active":""}`}><calcite-loader class="loader" .label=${t.length===1?e.deletingField:e.deletingFields} .hidden=${!s}></calcite-loader><div class="loader-text">${t.length===1?e.deletingField:e.deletingFields}</div></div>`}renderFieldsPreview(){let{fieldNames:e,layerFields:t,layerFieldsMap:s,arcadeExpMap:r,messages:a}=this;return y`<calcite-list .label=${a.fields}>${e.map(n=>{let c=t.find(p=>p.name===n);return y`<calcite-list-item .label=${this.getFieldLabel(n)} .description=${`{${n}}`} .value=${n} .disabled=${!c.editable}><div slot=actions-end class="field-icons">${Ie({fieldType:q(n,s,r)})}</div></calcite-list-item>`})}</calcite-list>`}renderCancelButton(){let{messages:e}=this;return y`<calcite-button @click=${()=>this.dialogNode.value.open=!1} slot=footer-end appearance=outline ${A(this.cancelNode)}>${e.cancel}</calcite-button>`}renderDeleteButton(){let{messages:e,fieldNames:t}=this;return y`<calcite-button kind=danger slot=footer-end @click=${async s=>{let{portal:r}=this;s.currentTarget.disabled=!0,this.cancelNode.value.disabled=!0,this.dialogNode.value.closeDisabled=!0,r.sourceJSON?.isReadOnly?this.handleError(!0):(this.deleteInProgress=!0,this.requestUpdate(),await this.deleteFields())}}>${t.length===1?e.deleteField:e.deleteFieldsWithNumber.replace("${number}",`${t.length}`)}</calcite-button>`}};R("arcgis-portal-field-delete",L);return L},"core/lang","layers/support/FeatureTemplate","Graphic","identity/IdentityManager","request","layers/support/fieldUtils","layers/support/FeatureReductionBinning","layers/support/FeatureReductionCluster","renderers/support/jsonUtils","request","core/sql")
|