@arcgis/portal-components 5.2.0-next.124 → 5.2.0-next.125
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/{XVXUI2NM.js → 2B2T3CO3.js} +1 -1
- package/dist/cdn/2EV6F7V6.js +2 -0
- package/dist/cdn/{PO7ZCHRK.js → 2U2SESKW.js} +69 -69
- package/dist/cdn/{ZRPU3E6I.js → 3TMF6URM.js} +1 -1
- package/dist/cdn/3YJUQ54F.js +2 -0
- package/dist/cdn/{X2YH4HME.js → 5B76NS25.js} +1 -1
- package/dist/cdn/5CFTWDD6.js +2 -0
- package/dist/cdn/5CQ3B6ZW.js +2 -0
- package/dist/cdn/5EFYJYWM.js +2 -0
- package/dist/cdn/5GLUIQ7R.js +2 -0
- package/dist/cdn/{P5T4PK6A.js → 5HP5TLLV.js} +1 -1
- package/dist/cdn/5ZSZI7KG.js +2 -0
- package/dist/cdn/{5SRRBZNT.js → 6JJUORUU.js} +1 -1
- package/dist/cdn/6PTPTTSS.js +2 -0
- package/dist/cdn/6XRVLKAZ.js +2 -0
- package/dist/cdn/{IE57HB42.js → 7QCQNOXB.js} +1 -1
- package/dist/cdn/{FXGAQXNR.js → 7UNUBFFC.js} +1 -1
- package/dist/cdn/{ZHJMS2LV.js → 7WFLPRTI.js} +1 -1
- package/dist/cdn/{YA32NOJY.js → ABIXHCPF.js} +1 -1
- package/dist/cdn/{HKJ5QP62.js → AYOR6D2Z.js} +1 -1
- package/dist/cdn/{6Z2AEG54.js → BPQ6ZBLE.js} +1 -1
- package/dist/cdn/{5R5O2X3M.js → BQKUF5EQ.js} +1 -1
- package/dist/cdn/BYYQOYJS.js +2 -0
- package/dist/cdn/{TD6BN5LE.js → CVUMYWBS.js} +1 -1
- package/dist/cdn/{JADQNA27.js → D4MCG57T.js} +1 -1
- package/dist/cdn/DIOGMUOB.js +2 -0
- package/dist/cdn/{52EHJXE4.js → DZWCWV3A.js} +1 -1
- package/dist/cdn/{35MI6GEH.js → E3XDGNPB.js} +1 -1
- package/dist/cdn/EPURPU4Q.js +2 -0
- package/dist/cdn/{JZID64Z6.js → EXPBHQ4I.js} +1 -1
- package/dist/cdn/{MTJN3KRM.js → FHXIGKK4.js} +1 -1
- package/dist/cdn/{X3WXFI25.js → FJ3PFFCN.js} +1 -1
- package/dist/cdn/{GXOORXRU.js → FKFSGSBA.js} +1 -1
- package/dist/cdn/FPKKNRZY.js +2 -0
- package/dist/cdn/{COXMHAJA.js → GCB5BYDM.js} +1 -1
- package/dist/cdn/{7EM25L56.js → GES5WKJA.js} +1 -1
- package/dist/cdn/{Z44L4BKR.js → GGG3IIFK.js} +1 -1
- package/dist/cdn/{QJCOQ6FY.js → GZU4XZUI.js} +1 -1
- package/dist/cdn/{JEOHKIHK.js → H3CCKTNL.js} +1 -1
- package/dist/cdn/{BZZQOEUP.js → H3PPP7A7.js} +1 -1
- package/dist/cdn/{BYV7M63H.js → HATTAFCL.js} +1 -1
- package/dist/cdn/{5HVUPXCG.js → HPDQHQVC.js} +1 -1
- package/dist/cdn/{L4YVQHX3.js → HWYJF6DJ.js} +1 -1
- package/dist/cdn/{OAVKM5RX.js → I5C4SV6N.js} +1 -1
- package/dist/cdn/{4RPD44KC.js → I64ZE3TR.js} +1 -1
- package/dist/cdn/{7EPXWK4L.js → ICUDZDC6.js} +1 -1
- package/dist/cdn/{625YOS7Q.js → IMIQY3MT.js} +1 -1
- package/dist/cdn/{GC7KNL7Y.js → IWARFJ4I.js} +1 -1
- package/dist/cdn/JB2P4KY4.js +2 -0
- package/dist/cdn/{YASUXORH.js → JGCCJ5PX.js} +1 -1
- package/dist/cdn/JIOUF6RV.js +2 -0
- package/dist/cdn/{6QTLQAJL.js → K25K7FCI.js} +1 -1
- package/dist/cdn/{37HLLREH.js → K4LXMVNH.js} +1 -1
- package/dist/cdn/{6H7CWMFE.js → K64QFEX2.js} +1 -1
- package/dist/cdn/{CFLKHGTI.js → KALKWPUR.js} +1 -1
- package/dist/cdn/KEM54FSC.js +2 -0
- package/dist/cdn/{RCL4QILW.js → KFGCJN3T.js} +1 -1
- package/dist/cdn/{3RGCV53N.js → L46EVYBC.js} +1 -1
- package/dist/cdn/{E3Y3LIHI.js → LFRTGSGI.js} +1 -1
- package/dist/cdn/MA7TVM56.js +2 -0
- package/dist/cdn/MBOTEUCN.js +2 -0
- package/dist/cdn/MC3V6J4M.js +2 -0
- package/dist/cdn/{JGH37RQB.js → MFKSJMJS.js} +1 -1
- package/dist/cdn/{EZIZLWHA.js → MXVFCMBR.js} +1 -1
- package/dist/cdn/{5H6OROJK.js → N4UNPHFQ.js} +1 -1
- package/dist/cdn/{XCFRL5XT.js → NBLJQFA7.js} +1 -1
- package/dist/cdn/{7ZCKR7TW.js → NBU2KMJP.js} +1 -1
- package/dist/cdn/NBX2RCQR.js +2 -0
- package/dist/cdn/NQMXSOYA.js +2 -0
- package/dist/cdn/{DKWAWI4G.js → NXJTHWZ6.js} +1 -1
- package/dist/cdn/{AUBBEYJL.js → OGAJ4WJ7.js} +1 -1
- package/dist/cdn/{M5VLXVNQ.js → OXKHPA3Q.js} +1 -1
- package/dist/cdn/{DWHJ45FR.js → PCFYL72V.js} +1 -1
- package/dist/cdn/{BKACWDST.js → PK7EJW27.js} +1 -1
- package/dist/cdn/{C5SWAPH7.js → PM3ZMOIJ.js} +1 -1
- package/dist/cdn/{H4TRF2G7.js → PWHUWOQ3.js} +1 -1
- package/dist/cdn/PZGMF6VO.js +2 -0
- package/dist/cdn/QNWDRDCX.js +2 -0
- package/dist/cdn/{BQLZPSWJ.js → QPYGIJHQ.js} +1 -1
- package/dist/cdn/{NDHD5H3P.js → QQMRZ2WI.js} +1 -1
- package/dist/cdn/{BV5TOHYG.js → QSWSIFAH.js} +1 -1
- package/dist/cdn/{6XW2ZF24.js → RII2VGVJ.js} +1 -1
- package/dist/cdn/{FQCG2EFI.js → RX7UZ7F5.js} +1 -1
- package/dist/cdn/S772GWA3.js +2 -0
- package/dist/cdn/SGI3WLNF.js +2 -0
- package/dist/cdn/SXQ2TVKW.js +2 -0
- package/dist/cdn/SXSWBX5T.js +2 -0
- package/dist/cdn/TEYNP76W.js +2 -0
- package/dist/cdn/TH6XSIAF.js +2 -0
- package/dist/cdn/{TF3F2YJ6.js → THNBXEBO.js} +1 -1
- package/dist/cdn/{AO7QKC5R.js → TMGE65IV.js} +1 -1
- package/dist/cdn/U6MJCS5P.js +2 -0
- package/dist/cdn/{6F74ZAGM.js → UI3WY3TF.js} +1 -1
- package/dist/cdn/{7NZ3RJFV.js → UXAGLEJM.js} +1 -1
- package/dist/cdn/{64NRJZKN.js → V2WAYK5G.js} +1 -1
- package/dist/cdn/{BLCWXWUR.js → V5BCQN5U.js} +1 -1
- package/dist/cdn/{CGX6YKBP.js → V75YULVA.js} +1 -1
- package/dist/cdn/{5UU2W2M6.js → VKS44KV4.js} +1 -1
- package/dist/cdn/{SHWP2FT2.js → VUBYPGZG.js} +1 -1
- package/dist/cdn/VYGJEX36.js +2 -0
- package/dist/cdn/{VU5VTC5L.js → WKQGRP5P.js} +1 -1
- package/dist/cdn/{FWRSYP3I.js → X4GCKBT2.js} +1 -1
- package/dist/cdn/{7T744GFJ.js → XATZUXUP.js} +1 -1
- package/dist/cdn/XDKRJYZ2.js +2 -0
- package/dist/cdn/YDA23ZS6.js +2 -0
- package/dist/cdn/{5IEUHTZ7.js → YFU47LWN.js} +1 -1
- package/dist/cdn/{GMLGEIYS.js → YXWMVZUC.js} +1 -1
- package/dist/cdn/YYHDUC6G.js +2 -0
- package/dist/cdn/Z7OHVQMR.js +2 -0
- package/dist/cdn/{6L5QFCR6.js → ZY5BJB25.js} +1 -1
- package/dist/cdn/{NF5AJJQU.js → ZZBKWWAW.js} +1 -1
- package/dist/cdn/assets/portal-delete-items/t9n/messages.en.json +1 -0
- package/dist/cdn/assets/portal-review-related-items/t9n/messages.en.json +1 -0
- package/dist/cdn/index.js +1 -1
- package/dist/cdn/main.css +1 -1
- package/dist/chunks/functional.js +9 -0
- package/dist/components/arcgis-portal-account-switcher/customElement.d.ts +1 -0
- package/dist/components/arcgis-portal-account-switcher/customElement.js +117 -116
- package/dist/components/arcgis-portal-delete-items/customElement.d.ts +128 -0
- package/dist/components/arcgis-portal-delete-items/customElement.js +452 -0
- package/dist/components/arcgis-portal-delete-items/index.d.ts +1 -0
- package/dist/components/arcgis-portal-delete-items/index.js +13 -0
- package/dist/components/arcgis-portal-delete-items/services.d.ts +7 -0
- package/dist/components/arcgis-portal-extent-picker/customElement.js +285 -243
- package/dist/components/arcgis-portal-extent-picker/index.js +3 -0
- package/dist/components/arcgis-portal-extent-picker-coord-field/customElement.js +8 -8
- package/dist/components/arcgis-portal-navigation/customElement.js +35 -37
- package/dist/components/arcgis-portal-navigation/index.js +4 -4
- package/dist/components/arcgis-portal-review-related-items/customElement.d.ts +27 -0
- package/dist/components/arcgis-portal-review-related-items/customElement.js +42 -0
- package/dist/components/arcgis-portal-review-related-items/index.d.ts +1 -0
- package/dist/components/arcgis-portal-review-related-items/index.js +5 -0
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/vscode.html-custom-data.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/index.d.ts +14 -0
- package/dist/loader.js +3 -1
- package/dist/types/lumina.d.ts +14 -1
- package/dist/types/preact.d.ts +16 -1
- package/dist/types/react.d.ts +18 -1
- package/dist/types/services.d.ts +9 -0
- package/dist/types/stencil.d.ts +14 -1
- package/package.json +7 -6
- package/dist/cdn/2HI6C3VG.js +0 -2
- package/dist/cdn/3R4I7T7Y.js +0 -2
- package/dist/cdn/465E43FF.js +0 -2
- package/dist/cdn/6PRXL6A7.js +0 -2
- package/dist/cdn/7LIVNXCJ.js +0 -2
- package/dist/cdn/A2OPVUV2.js +0 -2
- package/dist/cdn/BTGSJRJK.js +0 -2
- package/dist/cdn/C7FIYNJZ.js +0 -2
- package/dist/cdn/CK2D7FWY.js +0 -2
- package/dist/cdn/CQYLVRUF.js +0 -2
- package/dist/cdn/GXQMTKYF.js +0 -2
- package/dist/cdn/H2BBKRIY.js +0 -2
- package/dist/cdn/HGKH2F4Y.js +0 -2
- package/dist/cdn/KXSBIXYI.js +0 -2
- package/dist/cdn/L3UUTA7H.js +0 -2
- package/dist/cdn/LD2SO7MK.js +0 -2
- package/dist/cdn/LDY4QCZH.js +0 -2
- package/dist/cdn/LR6IOINV.js +0 -2
- package/dist/cdn/M3PJPM3Q.js +0 -2
- package/dist/cdn/ML2ETZQ5.js +0 -2
- package/dist/cdn/NMMQRFHX.js +0 -2
- package/dist/cdn/OO2IP4WZ.js +0 -2
- package/dist/cdn/PBWAZUZ4.js +0 -2
- package/dist/cdn/QTDRRCS2.js +0 -2
- package/dist/cdn/SXE3WUK6.js +0 -2
- package/dist/cdn/UFEBKEX7.js +0 -2
- package/dist/cdn/VLLPYVQB.js +0 -2
- package/dist/cdn/W47ZH7KA.js +0 -2
- package/dist/cdn/WFTFIAEX.js +0 -2
- package/dist/cdn/WIU3MYUE.js +0 -2
- package/dist/cdn/WKFQOWXJ.js +0 -2
- /package/dist/cdn/{DG6DAKQ2.js → ASDS73QU.js} +0 -0
- /package/dist/cdn/{N5KMTTYL.js → OTMC7MVD.js} +0 -0
|
@@ -0,0 +1,452 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import { c as S } from "../../chunks/runtime.js";
|
|
3
|
+
import { LitElement as $, createEvent as y, nothing as R } from "@arcgis/lumina";
|
|
4
|
+
import { css as _, html as d } from "lit";
|
|
5
|
+
import k from "@arcgis/core/request.js";
|
|
6
|
+
import { c as B } from "../../chunks/functional.js";
|
|
7
|
+
import f from "@arcgis/core/portal/PortalItem.js";
|
|
8
|
+
import { r as w } from "../../chunks/request.js";
|
|
9
|
+
import "../arcgis-portal-review-related-items/customElement.js";
|
|
10
|
+
import { a as p } from "../../chunks/item2.js";
|
|
11
|
+
import { u as T } from "../../chunks/useT9n.js";
|
|
12
|
+
import { substitute as x } from "@arcgis/core/intl.js";
|
|
13
|
+
async function C(r, e, t = !1) {
|
|
14
|
+
try {
|
|
15
|
+
const s = /* @__PURE__ */ new Map();
|
|
16
|
+
for (const a of r) {
|
|
17
|
+
const { id: l, owner: o } = a, c = s.get(o) ?? [];
|
|
18
|
+
c.push(l), s.set(o, c);
|
|
19
|
+
}
|
|
20
|
+
const i = [];
|
|
21
|
+
for (const [a, l] of s) {
|
|
22
|
+
const o = `${e.restUrl}/content/users/${encodeURIComponent(a)}/deleteItems`;
|
|
23
|
+
for (const c of B(l, 100)) {
|
|
24
|
+
const u = k(o, {
|
|
25
|
+
method: "post",
|
|
26
|
+
query: {
|
|
27
|
+
f: "json",
|
|
28
|
+
items: c.join(","),
|
|
29
|
+
permanentDelete: t
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
i.push(u.then(({ data: g }) => g));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return { result: (await Promise.all(i)).flatMap(({ results: a }) => a) };
|
|
36
|
+
} catch {
|
|
37
|
+
return { error: { code: "unhandledError" } };
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
async function v(r) {
|
|
41
|
+
const { item: e, portal: t, permanentlyDelete: s } = r, { id: i, owner: n } = e;
|
|
42
|
+
if (!i || !n)
|
|
43
|
+
return { error: { code: "unhandledError" } };
|
|
44
|
+
const a = t.recycleBinEnabled && !s ? "/canRecycle" : "/canDelete", l = `${t.restUrl}/content/users/${encodeURIComponent(n)}/items/${i}${a}`;
|
|
45
|
+
try {
|
|
46
|
+
return { result: (await k(l, { query: { f: "json" } })).data };
|
|
47
|
+
} catch (o) {
|
|
48
|
+
const c = o.details?.raw;
|
|
49
|
+
switch (c?.messageCode) {
|
|
50
|
+
case "CONT_00481":
|
|
51
|
+
case "CONT_00483":
|
|
52
|
+
case "CONT_00484":
|
|
53
|
+
return { error: { code: "itemHasDependentItems" } };
|
|
54
|
+
case "CONT_0048":
|
|
55
|
+
return { error: { code: "itemDeleteProtected" } };
|
|
56
|
+
default:
|
|
57
|
+
return { error: { code: "unhandledError", message: c?.message } };
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function b(r, e) {
|
|
62
|
+
return (r.relatedItems ?? []).map((t) => P(t, e));
|
|
63
|
+
}
|
|
64
|
+
function P(r, e) {
|
|
65
|
+
return r instanceof f ? r : new f({ ...r, portal: e });
|
|
66
|
+
}
|
|
67
|
+
async function h({
|
|
68
|
+
itemId: r,
|
|
69
|
+
portal: e,
|
|
70
|
+
relationship: t,
|
|
71
|
+
includeRecycleBin: s,
|
|
72
|
+
nextkey: i
|
|
73
|
+
}) {
|
|
74
|
+
const { relationshipType: n, direction: a } = t, l = `${e.restUrl}/content/items/${r}/relatedItems`;
|
|
75
|
+
try {
|
|
76
|
+
const o = await w({
|
|
77
|
+
url: l,
|
|
78
|
+
portal: e,
|
|
79
|
+
params: {
|
|
80
|
+
includeRecycleBin: s,
|
|
81
|
+
f: "json",
|
|
82
|
+
relationshipType: n ? Array.isArray(n) ? n.join(",") : n : void 0,
|
|
83
|
+
direction: a,
|
|
84
|
+
nextkey: i
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
return {
|
|
88
|
+
success: !0,
|
|
89
|
+
result: { ...o, relatedItems: b(o, e) }
|
|
90
|
+
};
|
|
91
|
+
} catch (o) {
|
|
92
|
+
return { success: !1, error: o };
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
async function U({
|
|
96
|
+
itemId: r,
|
|
97
|
+
portal: e,
|
|
98
|
+
relationship: t,
|
|
99
|
+
includeRecycleBin: s,
|
|
100
|
+
num: i,
|
|
101
|
+
nextkey: n
|
|
102
|
+
}) {
|
|
103
|
+
const { relationshipRules: a, direction: l } = t, o = `${e.restUrl}/content/items/${r}/relatedItems`;
|
|
104
|
+
try {
|
|
105
|
+
const c = await w({
|
|
106
|
+
url: o,
|
|
107
|
+
portal: e,
|
|
108
|
+
params: {
|
|
109
|
+
includeRecycleBin: s,
|
|
110
|
+
f: "json",
|
|
111
|
+
...a?.length ? { relationshipRules: a.join(",") } : {},
|
|
112
|
+
includeSystemManaged: "true",
|
|
113
|
+
excludedFlags: "legacy,exclude",
|
|
114
|
+
num: i,
|
|
115
|
+
direction: l,
|
|
116
|
+
nextkey: n
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
return {
|
|
120
|
+
success: !0,
|
|
121
|
+
result: { ...c, relatedItems: b(c, e) }
|
|
122
|
+
};
|
|
123
|
+
} catch (c) {
|
|
124
|
+
return { success: !1, error: c };
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
async function F(r, e) {
|
|
128
|
+
const { id: t, type: s, typeKeywords: i = [] } = r;
|
|
129
|
+
if (!t)
|
|
130
|
+
return null;
|
|
131
|
+
const n = [
|
|
132
|
+
"Scene Service",
|
|
133
|
+
"Map Service",
|
|
134
|
+
"WFS",
|
|
135
|
+
"OGCFeatureServer",
|
|
136
|
+
"Vector Tile Service",
|
|
137
|
+
"3DTiles Service"
|
|
138
|
+
].includes(s), a = ["Map Service", "Vector Tile Service"].includes(s), l = (c) => c?.typeKeywords?.includes("View Service") ?? !1, o = () => n ? [
|
|
139
|
+
{ relationshipType: ["Service2Service"], direction: "reverse" },
|
|
140
|
+
{ relationshipType: ["Service2Data"], direction: "forward" }
|
|
141
|
+
] : i.includes("Bulk Published Service") ? { relationshipType: ["DataStore2BPService"], direction: "reverse" } : s === "Geoprocessing Service" && i.includes("Notebook Web Tool") ? { relationshipType: ["Notebook2WebTool"], direction: "reverse" } : i.includes("Route Layer") ? { relationshipType: ["Service2Route"], direction: "reverse" } : s === "Mobile Application" ? { relationshipType: ["MobileApp2Code"], direction: "reverse" } : s === "Map Package" ? { relationshipType: ["Area2Package"], direction: "reverse" } : s === "Feature Service" ? { relationshipType: ["Service2Layer"], direction: "reverse" } : i.includes("Document") ? { relationshipType: ["Item2Attachment"], direction: "reverse" } : s === "Application Configuration" ? { relationshipType: ["Map2AppConfig"], direction: "reverse" } : { relationshipType: ["Service2Data"], direction: "forward" };
|
|
142
|
+
try {
|
|
143
|
+
const c = o();
|
|
144
|
+
if (!c)
|
|
145
|
+
return null;
|
|
146
|
+
if (!Array.isArray(c))
|
|
147
|
+
return {
|
|
148
|
+
sourceData: (await h({
|
|
149
|
+
itemId: t,
|
|
150
|
+
portal: e,
|
|
151
|
+
relationship: c
|
|
152
|
+
})).result?.relatedItems?.[0] ?? null,
|
|
153
|
+
relationship: c
|
|
154
|
+
};
|
|
155
|
+
if (n) {
|
|
156
|
+
let u = { relationshipType: ["Service2Service"], direction: "reverse" };
|
|
157
|
+
const g = await h({
|
|
158
|
+
itemId: t,
|
|
159
|
+
portal: e,
|
|
160
|
+
relationship: u
|
|
161
|
+
}), m = g.result?.total ? g.result.relatedItems.shift() ?? null : null;
|
|
162
|
+
if (a && !l(m) || !m) {
|
|
163
|
+
u = { relationshipType: ["Service2Data"], direction: "forward" };
|
|
164
|
+
const I = await h({
|
|
165
|
+
itemId: t,
|
|
166
|
+
portal: e,
|
|
167
|
+
relationship: u
|
|
168
|
+
});
|
|
169
|
+
return {
|
|
170
|
+
sourceData: I.result?.total ? I.result.relatedItems.shift() ?? m : m,
|
|
171
|
+
relationship: u
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
return { sourceData: m, relationship: u };
|
|
175
|
+
}
|
|
176
|
+
return null;
|
|
177
|
+
} catch (c) {
|
|
178
|
+
return console.error(c), { sourceData: null, relationship: { direction: "forward" } };
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
async function A(r, e) {
|
|
182
|
+
const { id: t, type: s, typeKeywords: i = [] } = r;
|
|
183
|
+
try {
|
|
184
|
+
const a = s === "Notebook" ? { relationshipType: ["Notebook2WebTool"], direction: "forward" } : i.includes("Has Related Route Layers") ? { relationshipType: ["Service2Route"], direction: "forward" } : i.includes("Hosted Service") || s === "Feature Service" ? { relationshipType: ["Service2Service"], direction: s === "Feed" ? "reverse" : "forward" } : s === "Data Store" || i.includes("ArcGIS Server") ? { relationshipType: ["DataStore2BPService"], direction: "forward" } : { relationshipType: ["Service2Data"], direction: "reverse" }, l = await h({
|
|
185
|
+
itemId: t,
|
|
186
|
+
portal: e,
|
|
187
|
+
relationship: a
|
|
188
|
+
});
|
|
189
|
+
return {
|
|
190
|
+
resultData: {
|
|
191
|
+
items: l.result?.total ? l.result.relatedItems : null,
|
|
192
|
+
count: l.result?.total ?? 0
|
|
193
|
+
},
|
|
194
|
+
relationship: a
|
|
195
|
+
};
|
|
196
|
+
} catch (n) {
|
|
197
|
+
return console.error(n), {
|
|
198
|
+
resultData: { items: null, count: 0 },
|
|
199
|
+
relationship: { direction: "forward" }
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
async function L(r, e) {
|
|
204
|
+
const { id: t } = r;
|
|
205
|
+
try {
|
|
206
|
+
return (await h({
|
|
207
|
+
itemId: t,
|
|
208
|
+
portal: e,
|
|
209
|
+
relationship: { relationshipType: ["ReplacementItem2Item"], direction: "forward" }
|
|
210
|
+
})).result?.relatedItems ?? [];
|
|
211
|
+
} catch (s) {
|
|
212
|
+
return console.error(s), [];
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
async function M(r, e) {
|
|
216
|
+
const t = await U({
|
|
217
|
+
itemId: r.id,
|
|
218
|
+
portal: e,
|
|
219
|
+
relationship: { direction: "forward" }
|
|
220
|
+
}), s = await F(r, e), i = await A(r, e), n = await L(r, e), a = {
|
|
221
|
+
usedByItems: t.result?.relatedItems ?? [],
|
|
222
|
+
sourceData: s?.sourceData ?? null,
|
|
223
|
+
resultData: i.resultData.items,
|
|
224
|
+
replacementItemFor: n.length ? n : null
|
|
225
|
+
}, { result: l, error: o } = await v({
|
|
226
|
+
item: r,
|
|
227
|
+
portal: e,
|
|
228
|
+
permanentlyDelete: !1
|
|
229
|
+
});
|
|
230
|
+
if (o)
|
|
231
|
+
switch (o.code) {
|
|
232
|
+
case "itemHasDependentItems":
|
|
233
|
+
return { item: r, ...a, kind: "cannotDelete", reason: "hasDependentItems" };
|
|
234
|
+
case "itemDeleteProtected":
|
|
235
|
+
return { item: r, ...a, kind: "cannotDelete", reason: "deleteProtected" };
|
|
236
|
+
default:
|
|
237
|
+
return { item: r, ...a, kind: "cannotDelete", reason: "uncaught" };
|
|
238
|
+
}
|
|
239
|
+
if (!l?.success) {
|
|
240
|
+
const { result: c } = await v({
|
|
241
|
+
item: r,
|
|
242
|
+
portal: e,
|
|
243
|
+
permanentlyDelete: !0
|
|
244
|
+
});
|
|
245
|
+
return c?.success ? { item: r, ...a, kind: "permanentlyDelete", reason: "notSupported" } : { item: r, ...a, kind: "cannotDelete", reason: "uncaught" };
|
|
246
|
+
}
|
|
247
|
+
return { item: r, ...a, kind: "recycle" };
|
|
248
|
+
}
|
|
249
|
+
const E = _`:host{display:block}calcite-dialog{--calcite-dialog-content-space: 0;--calcite-dialog-background-color: var(--calcite-color-background)}calcite-panel{display:flex;flex-direction:column;gap:.75rem;>*{margin-inline:.75rem}}.panel__content{width:100%;box-sizing:border-box}.bucket__content{display:flex;align-items:flex-start;gap:.75rem;width:100%}.bucket__icon{flex-shrink:0}.bucket__details{display:flex;flex:1 1 auto;flex-direction:column;min-width:0}.bucket__header{font-weight:500}.bucket__label{margin-inline-end:.25rem}.bucket__description{line-height:1.35;font-size:var(--calcite-font-size--1)}.bucket__link{display:flex;align-items:center;min-height:1.5rem}.panel__checkbox{width:100%;padding-block:.75rem;padding-inline-start:.75rem;background-color:var(--calcite-color-foreground-1)}.panel__related-items{margin-top:1rem;border:1px solid var(--calcite-color-border-2)}.panel__related-items-icon{color:var(--calcite-color-status-warning)}.panel__related-items-notice{padding-bottom:.75rem}arcgis-portal-review-related-items{margin-bottom:.75rem}.discouraged-items-warning{margin-bottom:.75rem}`;
|
|
250
|
+
function N({
|
|
251
|
+
recycleItems: r,
|
|
252
|
+
cannotDeleteItems: e,
|
|
253
|
+
permanentlyDeleteItems: t
|
|
254
|
+
}) {
|
|
255
|
+
return [...r, ...e, ...t];
|
|
256
|
+
}
|
|
257
|
+
function H(r) {
|
|
258
|
+
return r.map(({ item: e, sourceData: t, resultData: s, replacementItemFor: i }) => ({
|
|
259
|
+
item: e,
|
|
260
|
+
sourceData: t,
|
|
261
|
+
resultData: s,
|
|
262
|
+
replacementItemFor: i
|
|
263
|
+
}));
|
|
264
|
+
}
|
|
265
|
+
function q(r, e, t) {
|
|
266
|
+
return !e && !!t?.length && !p(r);
|
|
267
|
+
}
|
|
268
|
+
function j({
|
|
269
|
+
selectedItems: r
|
|
270
|
+
}) {
|
|
271
|
+
const e = [];
|
|
272
|
+
return e.push(
|
|
273
|
+
...r.flatMap(({ item: t, sourceData: s, resultData: i, replacementItemFor: n }) => {
|
|
274
|
+
const a = q(t, s, i), l = !!(i?.some((o) => !o.inRecycleBin) && !z(t, i) && !O(t, i));
|
|
275
|
+
return a && l ? [{ item: t, reason: "dependent", offendingItems: i ?? void 0 }] : n && n?.length > 0 ? [{ item: t, reason: "replacement", offendingItems: n }] : [];
|
|
276
|
+
})
|
|
277
|
+
), e;
|
|
278
|
+
}
|
|
279
|
+
function z(r, e) {
|
|
280
|
+
const t = e[0];
|
|
281
|
+
return r.type === "Feed" && p(r) && e.length === 1 && t?.type === "Feature Service" && p(t);
|
|
282
|
+
}
|
|
283
|
+
function O(r, e) {
|
|
284
|
+
const t = e[0];
|
|
285
|
+
return r.type === "Feature Service" && p(r) && e.length === 1 && t?.type === "Feed" && p(t);
|
|
286
|
+
}
|
|
287
|
+
function W(r, e, t, s) {
|
|
288
|
+
const i = ["id", "ja", "ko", "th", "vi", "zh-cn", "zh-hk", "zh-tw"], n = [
|
|
289
|
+
"en",
|
|
290
|
+
"ca",
|
|
291
|
+
"da",
|
|
292
|
+
"de",
|
|
293
|
+
"el",
|
|
294
|
+
"es",
|
|
295
|
+
"et",
|
|
296
|
+
"fi",
|
|
297
|
+
"hi",
|
|
298
|
+
"hu",
|
|
299
|
+
"it",
|
|
300
|
+
"nb",
|
|
301
|
+
"nl",
|
|
302
|
+
"pt-pt",
|
|
303
|
+
"sv",
|
|
304
|
+
"tr"
|
|
305
|
+
], a = r ?? "en";
|
|
306
|
+
let l = e.unknown;
|
|
307
|
+
return (t === 1 || i.includes(a)) && (l = e.single), t !== 1 && n.includes(a) && (l = e.multiple), x(l, { ...s, number: t });
|
|
308
|
+
}
|
|
309
|
+
function D({ id: r, linkText: e, label: t, placement: s, relatedItems: i, portal: n, user: a }) {
|
|
310
|
+
return d`<calcite-link id=${r ?? R}>${e}</calcite-link><calcite-popover .label=${t} .referenceElement=${r} .placement=${s}><arcgis-portal-review-related-items .relatedItems=${i} .portal=${n} .user=${a}></arcgis-portal-review-related-items></calcite-popover>`;
|
|
311
|
+
}
|
|
312
|
+
class G extends $ {
|
|
313
|
+
constructor() {
|
|
314
|
+
super(...arguments), this.deleteStatusRequestId = 0, this.messages = T({ blocking: !0 }), this.isLoading = !0, this.hasReviewedImpactedItems = !1, this.cannotDeleteItems = [], this.recycleItems = [], this.permanentlyDeleteItems = [], this.reviewingDirectlyUsedByItems = !1, this.markedForDeprecation = [], this.active = !0, this.items = [], this.user = null, this.disableLinks = !1, this.arcgisCancel = y(), this.arcgisConfirm = y(), this.arcgisError = y();
|
|
315
|
+
}
|
|
316
|
+
static {
|
|
317
|
+
this.properties = { isLoading: 16, hasReviewedImpactedItems: 16, cannotDeleteItems: 16, recycleItems: 16, permanentlyDeleteItems: 16, reviewingDirectlyUsedByItems: 16, markedForDeprecation: 16, active: 5, items: 0, portal: 0, user: 0, disableLinks: 5 };
|
|
318
|
+
}
|
|
319
|
+
static {
|
|
320
|
+
this.styles = E;
|
|
321
|
+
}
|
|
322
|
+
willUpdate(e) {
|
|
323
|
+
const t = e.has("items") || e.has("portal") || e.has("user") || e.has("active");
|
|
324
|
+
this.active && t && (this.user ??= this.portal?.user || null, this.resetState(), this.determineDeleteStatus(++this.deleteStatusRequestId));
|
|
325
|
+
}
|
|
326
|
+
async handleDelete() {
|
|
327
|
+
const { result: e = [] } = await C(this.recycleItems.map(({ item: t }) => t), {
|
|
328
|
+
restUrl: this.portal.restUrl
|
|
329
|
+
});
|
|
330
|
+
this.active = !1, this.arcgisConfirm.emit({
|
|
331
|
+
deletedItems: e,
|
|
332
|
+
permanentlyDeletedItems: null,
|
|
333
|
+
deletedItemsCount: e?.length ?? 0,
|
|
334
|
+
permanentlyDeletedItemsCount: 0
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
handleDialogClose() {
|
|
338
|
+
this.active && this.arcgisCancel.emit(), this.active = !1, this.resetState();
|
|
339
|
+
}
|
|
340
|
+
resetState() {
|
|
341
|
+
this.isLoading = !0, this.hasReviewedImpactedItems = !1, this.cannotDeleteItems = [], this.recycleItems = [], this.permanentlyDeleteItems = [], this.reviewingDirectlyUsedByItems = !1, this.markedForDeprecation = [], ++this.deleteStatusRequestId;
|
|
342
|
+
}
|
|
343
|
+
async determineDeleteStatus(e) {
|
|
344
|
+
const t = await Promise.all(this.items.map(async (s) => await M(s, this.portal)));
|
|
345
|
+
e === this.deleteStatusRequestId && (this.cannotDeleteItems = t.filter((s) => s.kind === "cannotDelete"), this.recycleItems = t.filter((s) => s.kind === "recycle"), this.permanentlyDeleteItems = t.filter((s) => s.kind === "permanentlyDelete"), this.isLoading = !1);
|
|
346
|
+
}
|
|
347
|
+
get recyclableItemsHaveImpactedItems() {
|
|
348
|
+
return this.recycleItems.some(({ usedByItems: e }) => e.length > 0);
|
|
349
|
+
}
|
|
350
|
+
get itemsNeedReview() {
|
|
351
|
+
return this.recycleItems.some(({ usedByItems: e }) => e.length > 0);
|
|
352
|
+
}
|
|
353
|
+
get deleteButtonEnabled() {
|
|
354
|
+
return !this.isLoading && (!this.itemsNeedReview || this.hasReviewedImpactedItems);
|
|
355
|
+
}
|
|
356
|
+
get deleteMode() {
|
|
357
|
+
return this.markedForDeprecation.length > 0 ? "deprecate" : this.permanentlyDeleteItems.length > 0 ? "permanentlyDelete" : this.recycleItems.length > 0 && this.cannotDeleteItems.length > 0 ? "mixed" : this.recycleItems.length > 0 ? "delete" : (this.cannotDeleteItems.length > 0, "none");
|
|
358
|
+
}
|
|
359
|
+
getHeaderText() {
|
|
360
|
+
return this.items.length === 1 ? this.messages.deleteItem : this.messages.deleteItems;
|
|
361
|
+
}
|
|
362
|
+
renderBucket({ icon: e, label: t, description: s, link: i, bucket: n }) {
|
|
363
|
+
return d`<calcite-block scale=l expanded><div class="bucket__content"><calcite-icon class="bucket__icon" scale=l .icon=${e}></calcite-icon><div class="bucket__details"><div class="bucket__header"><span class="bucket__label">${t}</span><span>${this.renderBucketItems(n)}</span></div><span class="bucket__description">${s}</span>${i && d`<div class="bucket__link"><calcite-link .href=${i.href} target=_blank icon-start=launch>${i.text ?? this.messages.moreInfo}</calcite-link></div>` || ""}</div></div></calcite-block>`;
|
|
364
|
+
}
|
|
365
|
+
renderBucketItems(e = []) {
|
|
366
|
+
if (e.length === 0)
|
|
367
|
+
return null;
|
|
368
|
+
if (e.length === 1) {
|
|
369
|
+
const i = e[0].item, n = i.itemPageUrl ?? void 0;
|
|
370
|
+
return d`<calcite-link .href=${n} target=_blank><arcgis-portal-item-type .item=${i} .portal=${this.portal} .user=${this.user} hide-text></arcgis-portal-item-type>${i.title}</calcite-link>`;
|
|
371
|
+
}
|
|
372
|
+
const t = `delete-items-bucket-${e.map(({ item: i }) => i.id).join("-")}`, s = e.map(({ item: i }) => i);
|
|
373
|
+
return D({
|
|
374
|
+
id: t,
|
|
375
|
+
linkText: e.length,
|
|
376
|
+
label: this.messages.bucketItems.replace("{count}", String(e.length)),
|
|
377
|
+
placement: "bottom-start",
|
|
378
|
+
relatedItems: s,
|
|
379
|
+
portal: this.portal,
|
|
380
|
+
user: this.user
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
renderRelatedItemsPopover(e) {
|
|
384
|
+
const t = e.flatMap(({ usedByItems: i }) => i);
|
|
385
|
+
return e.length > 1 || t.length === 0 ? null : D({
|
|
386
|
+
id: "delete-items-directly-used-by",
|
|
387
|
+
linkText: W(this.messages._t9nLocale, this.messages.usedByOtherItems, t.length),
|
|
388
|
+
label: this.messages.usedByPopover,
|
|
389
|
+
placement: "auto",
|
|
390
|
+
relatedItems: t,
|
|
391
|
+
portal: this.portal,
|
|
392
|
+
user: this.user
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
renderDirectlyUsedByItems() {
|
|
396
|
+
const e = N({
|
|
397
|
+
recycleItems: this.recycleItems,
|
|
398
|
+
cannotDeleteItems: this.cannotDeleteItems,
|
|
399
|
+
permanentlyDeleteItems: this.permanentlyDeleteItems
|
|
400
|
+
}), t = e.flatMap(({ usedByItems: i }) => i), s = j({
|
|
401
|
+
selectedItems: H(e)
|
|
402
|
+
});
|
|
403
|
+
return d`${this.items.length === 1 && this.deleteMode === "delete" && s.length > 0 ? d`<div class="discouraged-items-warning"><calcite-notice kind=warning open><div slot=message>${this.messages.deleteDiscouraged}</div><calcite-link icon-end=launch slot=link>${this.messages.learnMoreAboutDeletingSourceItems}</calcite-link></calcite-notice></div>` : null}<arcgis-portal-review-related-items .sourceItem=${this.items[0] ?? null} .relatedItems=${t} .portal=${this.portal} .user=${this.user}></arcgis-portal-review-related-items>`;
|
|
404
|
+
}
|
|
405
|
+
renderDirectlyUsedByItemsNotice() {
|
|
406
|
+
const e = this.recycleItems.filter(({ usedByItems: s }) => s.length > 0).length, t = this.messages.reviewRelatedItems[this.items.length === 1 ? "single" : "multiple"].replace("{affectedCount}", String(e)).replace("{totalCount}", String(this.items.length));
|
|
407
|
+
return d`<div class="panel__related-items-notice"><calcite-notice kind=warning icon open><div slot=message>${t}</div><calcite-button appearance=transparent slot=actions-end @click=${() => this.reviewingDirectlyUsedByItems = !0}>${this.messages.reviewItems}</calcite-button></calcite-notice></div>`;
|
|
408
|
+
}
|
|
409
|
+
renderSingleItemDelete() {
|
|
410
|
+
return d`<calcite-panel>${this.renderRecycleBucket()}${this.renderCannotDeleteBucket()}${this.renderPermanentlyDeleteBucket()}${this.renderDirectlyUsedByItems()}${this.recyclableItemsHaveImpactedItems && d`<div>${this.items.length > 1 ? this.renderDirectlyUsedByItemsNotice() : null}</div>` || ""}</calcite-panel>`;
|
|
411
|
+
}
|
|
412
|
+
renderRecycleBucket() {
|
|
413
|
+
return !this.recycleItems || this.recycleItems.length === 0 ? null : this.renderBucket({
|
|
414
|
+
icon: "recycle-bin",
|
|
415
|
+
label: this.messages.summary.willBeRecycled,
|
|
416
|
+
description: this.messages.summary.canBeRecovered.single.replace("{days}", "14"),
|
|
417
|
+
bucket: this.recycleItems
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
renderCannotDeleteBucket() {
|
|
421
|
+
if (!this.cannotDeleteItems || this.cannotDeleteItems.length === 0)
|
|
422
|
+
return null;
|
|
423
|
+
const e = this.cannotDeleteItems?.[0]?.reason;
|
|
424
|
+
return this.renderBucket({
|
|
425
|
+
icon: "security",
|
|
426
|
+
label: this.messages.summary.cannotDelete,
|
|
427
|
+
description: e === "hasDependentItems" ? this.messages.summary.protectedGroup.hasDependentItemsDescription.singleOneDependentItem : this.messages.summary.protectedGroup.deleteProtectedDescription,
|
|
428
|
+
bucket: this.cannotDeleteItems
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
renderPermanentlyDeleteBucket() {
|
|
432
|
+
return !this.permanentlyDeleteItems || this.permanentlyDeleteItems.length === 0 ? null : this.renderBucket({
|
|
433
|
+
icon: "trash",
|
|
434
|
+
label: this.messages.summary.permanentlyDelete,
|
|
435
|
+
description: this.messages.summary.permanentDelete.notSupported.single,
|
|
436
|
+
bucket: this.permanentlyDeleteItems
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
render() {
|
|
440
|
+
const { items: e, portal: t, deleteMode: s } = this;
|
|
441
|
+
if (!(!e || !t))
|
|
442
|
+
return d`<calcite-dialog modal .open=${this.active} width=s .heading=${this.getHeaderText()} heading-level=2 outside-close-disabled escape-disabled kind=danger @calciteDialogClose=${this.handleDialogClose}><div class="panel__content">${this.isLoading ? d`<calcite-scrim loading></calcite-scrim>` : this.renderSingleItemDelete()}</div>${this.itemsNeedReview && d`<calcite-checkbox slot=content-bottom class="panel__checkbox" @calciteCheckboxChange=${(i) => {
|
|
443
|
+
this.hasReviewedImpactedItems = i.target.checked;
|
|
444
|
+
}} .labelText=${this.messages.reviewImpactedItems}></calcite-checkbox>` || ""}<calcite-button slot=footer-end appearance=outline-fill @click=${() => {
|
|
445
|
+
this.active = !1, this.arcgisCancel.emit();
|
|
446
|
+
}}>${this.messages.cancel}</calcite-button>${s !== "none" && d`<calcite-button .disabled=${!this.deleteButtonEnabled} kind=danger slot=footer-end @click=${async () => await this.handleDelete()}>${this.messages.delete}</calcite-button>` || ""}</calcite-dialog>`;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
S("arcgis-portal-delete-items", G);
|
|
450
|
+
export {
|
|
451
|
+
G as ArcgisPortalDeleteItems
|
|
452
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./customElement.js";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import "@esri/calcite-components/components/calcite-link";
|
|
2
|
+
import "@esri/calcite-components/components/calcite-popover";
|
|
3
|
+
import "../arcgis-portal-review-related-items/index.js";
|
|
4
|
+
import "@esri/calcite-components/components/calcite-block";
|
|
5
|
+
import "@esri/calcite-components/components/calcite-icon";
|
|
6
|
+
import "../arcgis-portal-item-type/index.js";
|
|
7
|
+
import "@esri/calcite-components/components/calcite-notice";
|
|
8
|
+
import "@esri/calcite-components/components/calcite-button";
|
|
9
|
+
import "@esri/calcite-components/components/calcite-panel";
|
|
10
|
+
import "@esri/calcite-components/components/calcite-dialog";
|
|
11
|
+
import "@esri/calcite-components/components/calcite-scrim";
|
|
12
|
+
import "@esri/calcite-components/components/calcite-checkbox";
|
|
13
|
+
export * from "./customElement.js";
|