@arcgis/portal-components 6.0.0-next.5 → 6.0.0-next.6
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/26PILQCA.js +2 -0
- package/dist/cdn/2RDQX6UR.js +2 -0
- package/dist/cdn/MRJO2LXU.js +2 -0
- package/dist/cdn/RDXUP624.js +2 -0
- package/dist/cdn/ULFFGJXZ.js +2 -0
- package/dist/cdn/WWEK2CFY.js +2 -0
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/portal-related-items-list-item.js +1 -1
- package/dist/components/arcgis-portal-delete-items/customElement.d.ts +7 -3
- package/dist/components/arcgis-portal-delete-items/customElement.js +334 -258
- package/dist/components/arcgis-portal-delete-items/index.js +0 -1
- package/dist/components/arcgis-portal-delete-items/types.d.ts +1 -0
- package/dist/components/arcgis-portal-navigation/index.js +4 -4
- package/dist/components/arcgis-portal-review-related-items/customElement.d.ts +333 -0
- package/dist/components/arcgis-portal-review-related-items/customElement.js +21 -18
- package/dist/components/arcgis-portal-review-related-items/index.js +2 -0
- package/dist/components/portal-related-items-list-item/customElement.js +15 -13
- package/dist/components/portal-related-items-list-item/index.js +1 -1
- 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/loader.js +2 -2
- package/dist/types/lumina.d.ts +3 -3
- package/dist/types/preact.d.ts +3 -3
- package/dist/types/react.d.ts +3 -3
- package/dist/types/stencil.d.ts +3 -3
- package/dist/utils/types.d.ts +10 -0
- package/package.json +7 -7
- package/dist/cdn/3CQKCUM5.js +0 -2
- package/dist/cdn/CD5UWSCP.js +0 -2
- package/dist/cdn/DYO5P3F2.js +0 -2
- package/dist/cdn/FIBQAMJ3.js +0 -2
- package/dist/cdn/N5QLV56W.js +0 -2
- package/dist/cdn/TOTWYGB3.js +0 -2
|
@@ -1,53 +1,54 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import { c as
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { r as
|
|
2
|
+
import { c as P } from "../../chunks/runtime.js";
|
|
3
|
+
import b from "@arcgis/core/portal/PortalItem.js";
|
|
4
|
+
import { LitElement as U, createEvent as D, safeClassMap as S, nothing as L } from "@arcgis/lumina";
|
|
5
|
+
import { css as M, html as d } from "lit";
|
|
6
|
+
import k from "@arcgis/core/request.js";
|
|
7
|
+
import { c as O } from "../../chunks/functional.js";
|
|
8
|
+
import { r as _ } from "../../chunks/request.js";
|
|
9
9
|
import "../arcgis-portal-review-related-items/customElement.js";
|
|
10
|
-
import { f as
|
|
11
|
-
import { a as
|
|
12
|
-
import { u as
|
|
13
|
-
import {
|
|
14
|
-
|
|
10
|
+
import { f as $ } from "../../chunks/portal-delete-items-review.js";
|
|
11
|
+
import { a as y } from "../../chunks/item2.js";
|
|
12
|
+
import { u as E } from "../../chunks/useT9n.js";
|
|
13
|
+
import { g as F } from "../../chunks/items.js";
|
|
14
|
+
import { b as H } from "../../chunks/url.js";
|
|
15
|
+
async function R(i, e, t = !1) {
|
|
15
16
|
try {
|
|
16
|
-
const
|
|
17
|
-
for (const
|
|
18
|
-
const { id:
|
|
19
|
-
|
|
17
|
+
const s = /* @__PURE__ */ new Map();
|
|
18
|
+
for (const l of i) {
|
|
19
|
+
const { id: o, owner: a } = l, c = s.get(a) ?? [];
|
|
20
|
+
c.push(o), s.set(a, c);
|
|
20
21
|
}
|
|
21
|
-
const
|
|
22
|
-
for (const [
|
|
23
|
-
const
|
|
24
|
-
for (const
|
|
25
|
-
const m =
|
|
22
|
+
const n = [];
|
|
23
|
+
for (const [l, o] of s) {
|
|
24
|
+
const a = `${e.restUrl}/content/users/${encodeURIComponent(l)}/deleteItems`;
|
|
25
|
+
for (const c of O(o, 100)) {
|
|
26
|
+
const m = k(a, {
|
|
26
27
|
method: "post",
|
|
27
28
|
query: {
|
|
28
29
|
f: "json",
|
|
29
|
-
items:
|
|
30
|
+
items: c.join(","),
|
|
30
31
|
permanentDelete: t
|
|
31
32
|
}
|
|
32
33
|
});
|
|
33
|
-
|
|
34
|
+
n.push(m.then(({ data: h }) => h));
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
|
-
return { result: (await Promise.all(
|
|
37
|
+
return { result: (await Promise.all(n)).flatMap(({ results: l }) => l) };
|
|
37
38
|
} catch {
|
|
38
39
|
return { error: { code: "unhandledError" } };
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
|
-
async function
|
|
42
|
-
const { item: e, portal: t, permanentlyDelete:
|
|
43
|
-
if (!
|
|
42
|
+
async function B(i) {
|
|
43
|
+
const { item: e, portal: t, permanentlyDelete: s } = i, { id: n, owner: r } = e;
|
|
44
|
+
if (!n || !r)
|
|
44
45
|
return { error: { code: "unhandledError" } };
|
|
45
|
-
const
|
|
46
|
+
const l = t.recycleBinEnabled && !s ? "/canRecycle" : "/canDelete", o = `${t.restUrl}/content/users/${encodeURIComponent(r)}/items/${n}${l}`;
|
|
46
47
|
try {
|
|
47
|
-
return { result: (await
|
|
48
|
-
} catch (
|
|
49
|
-
const
|
|
50
|
-
switch (
|
|
48
|
+
return { result: (await k(o, { query: { f: "json" } })).data };
|
|
49
|
+
} catch (a) {
|
|
50
|
+
const c = a.details?.raw;
|
|
51
|
+
switch (c?.messageCode) {
|
|
51
52
|
case "CONT_00481":
|
|
52
53
|
case "CONT_00483":
|
|
53
54
|
case "CONT_00484":
|
|
@@ -55,387 +56,451 @@ async function w(s) {
|
|
|
55
56
|
case "CONT_0048":
|
|
56
57
|
return { error: { code: "itemDeleteProtected" } };
|
|
57
58
|
default:
|
|
58
|
-
return { error: { code: "unhandledError", message:
|
|
59
|
+
return { error: { code: "unhandledError", message: c?.message } };
|
|
59
60
|
}
|
|
60
61
|
}
|
|
61
62
|
}
|
|
62
|
-
function
|
|
63
|
-
|
|
63
|
+
async function q(i, e) {
|
|
64
|
+
try {
|
|
65
|
+
const t = `${i.itemUrl}/setContentStatus`;
|
|
66
|
+
return { result: (await k(t, { query: { status: e ?? "", clearEmptyFields: !e, f: "json" }, method: "post" })).data };
|
|
67
|
+
} catch (t) {
|
|
68
|
+
return console.error(t), { error: { code: "unhandledError" } };
|
|
69
|
+
}
|
|
64
70
|
}
|
|
65
|
-
function
|
|
66
|
-
return
|
|
71
|
+
function A(i, e) {
|
|
72
|
+
return (i.relatedItems ?? []).map((t) => N(t, e));
|
|
67
73
|
}
|
|
68
|
-
|
|
69
|
-
|
|
74
|
+
function N(i, e) {
|
|
75
|
+
return i instanceof b ? i : new b({ ...i, portal: e });
|
|
76
|
+
}
|
|
77
|
+
async function I({
|
|
78
|
+
itemId: i,
|
|
70
79
|
portal: e,
|
|
71
80
|
relationship: t,
|
|
72
|
-
includeRecycleBin:
|
|
73
|
-
nextkey:
|
|
81
|
+
includeRecycleBin: s,
|
|
82
|
+
nextkey: n
|
|
74
83
|
}) {
|
|
75
|
-
const { relationshipType:
|
|
84
|
+
const { relationshipType: r, direction: l } = t, o = `${e.restUrl}/content/items/${i}/relatedItems`;
|
|
76
85
|
try {
|
|
77
|
-
const
|
|
78
|
-
url:
|
|
86
|
+
const a = await _({
|
|
87
|
+
url: o,
|
|
79
88
|
portal: e,
|
|
80
89
|
params: {
|
|
81
|
-
includeRecycleBin:
|
|
90
|
+
includeRecycleBin: s,
|
|
82
91
|
f: "json",
|
|
83
|
-
relationshipType:
|
|
84
|
-
direction:
|
|
85
|
-
nextkey:
|
|
92
|
+
relationshipType: r ? Array.isArray(r) ? r.join(",") : r : void 0,
|
|
93
|
+
direction: l,
|
|
94
|
+
nextkey: n
|
|
86
95
|
}
|
|
87
96
|
});
|
|
88
97
|
return {
|
|
89
98
|
success: !0,
|
|
90
|
-
result: { ...
|
|
99
|
+
result: { ...a, relatedItems: A(a, e) }
|
|
91
100
|
};
|
|
92
|
-
} catch (
|
|
93
|
-
return { success: !1, error:
|
|
101
|
+
} catch (a) {
|
|
102
|
+
return { success: !1, error: a };
|
|
94
103
|
}
|
|
95
104
|
}
|
|
96
|
-
async function
|
|
97
|
-
itemId:
|
|
105
|
+
async function W({
|
|
106
|
+
itemId: i,
|
|
98
107
|
portal: e,
|
|
99
108
|
relationship: t,
|
|
100
|
-
includeRecycleBin:
|
|
101
|
-
num:
|
|
102
|
-
nextkey:
|
|
109
|
+
includeRecycleBin: s,
|
|
110
|
+
num: n,
|
|
111
|
+
nextkey: r
|
|
103
112
|
}) {
|
|
104
|
-
const { relationshipRules:
|
|
113
|
+
const { relationshipRules: l, direction: o } = t, a = `${e.restUrl}/content/items/${i}/relatedItems`;
|
|
105
114
|
try {
|
|
106
|
-
const
|
|
107
|
-
url:
|
|
115
|
+
const c = await _({
|
|
116
|
+
url: a,
|
|
108
117
|
portal: e,
|
|
109
118
|
params: {
|
|
110
|
-
includeRecycleBin:
|
|
119
|
+
includeRecycleBin: s,
|
|
111
120
|
f: "json",
|
|
112
|
-
...
|
|
121
|
+
...l?.length ? { relationshipRules: l.join(",") } : {},
|
|
113
122
|
includeSystemManaged: "true",
|
|
114
123
|
excludedFlags: "legacy,exclude",
|
|
115
|
-
num:
|
|
116
|
-
direction:
|
|
117
|
-
nextkey:
|
|
124
|
+
num: n,
|
|
125
|
+
direction: o,
|
|
126
|
+
nextkey: r
|
|
118
127
|
}
|
|
119
128
|
});
|
|
120
129
|
return {
|
|
121
130
|
success: !0,
|
|
122
|
-
result: { ...
|
|
131
|
+
result: { ...c, relatedItems: A(c, e) }
|
|
123
132
|
};
|
|
124
|
-
} catch (
|
|
125
|
-
return { success: !1, error:
|
|
133
|
+
} catch (c) {
|
|
134
|
+
return { success: !1, error: c };
|
|
126
135
|
}
|
|
127
136
|
}
|
|
128
|
-
async function
|
|
129
|
-
const { id: t, type:
|
|
137
|
+
async function j(i, e) {
|
|
138
|
+
const { id: t, type: s, typeKeywords: n = [] } = i;
|
|
130
139
|
if (!t)
|
|
131
140
|
return null;
|
|
132
|
-
const
|
|
141
|
+
const r = [
|
|
133
142
|
"Scene Service",
|
|
134
143
|
"Map Service",
|
|
135
144
|
"WFS",
|
|
136
145
|
"OGCFeatureServer",
|
|
137
146
|
"Vector Tile Service",
|
|
138
147
|
"3DTiles Service"
|
|
139
|
-
].includes(
|
|
148
|
+
].includes(s), l = ["Map Service", "Vector Tile Service"].includes(s), o = (c) => c?.typeKeywords?.includes("View Service") ?? !1, a = () => r ? [
|
|
140
149
|
{ relationshipType: ["Service2Service"], direction: "reverse" },
|
|
141
150
|
{ relationshipType: ["Service2Data"], direction: "forward" }
|
|
142
|
-
] :
|
|
151
|
+
] : n.includes("Bulk Published Service") ? { relationshipType: ["DataStore2BPService"], direction: "reverse" } : s === "Geoprocessing Service" && n.includes("Notebook Web Tool") ? { relationshipType: ["Notebook2WebTool"], direction: "reverse" } : n.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" } : n.includes("Document") ? { relationshipType: ["Item2Attachment"], direction: "reverse" } : s === "Application Configuration" ? { relationshipType: ["Map2AppConfig"], direction: "reverse" } : { relationshipType: ["Service2Data"], direction: "forward" };
|
|
143
152
|
try {
|
|
144
|
-
const
|
|
145
|
-
if (!
|
|
153
|
+
const c = a();
|
|
154
|
+
if (!c)
|
|
146
155
|
return null;
|
|
147
|
-
if (!Array.isArray(
|
|
156
|
+
if (!Array.isArray(c))
|
|
148
157
|
return {
|
|
149
|
-
sourceData: (await
|
|
158
|
+
sourceData: (await I({
|
|
150
159
|
itemId: t,
|
|
151
160
|
portal: e,
|
|
152
|
-
relationship:
|
|
161
|
+
relationship: c
|
|
153
162
|
})).result?.relatedItems?.[0] ?? null,
|
|
154
|
-
relationship:
|
|
163
|
+
relationship: c
|
|
155
164
|
};
|
|
156
|
-
if (
|
|
165
|
+
if (r) {
|
|
157
166
|
let m = { relationshipType: ["Service2Service"], direction: "reverse" };
|
|
158
|
-
const
|
|
167
|
+
const h = await I({
|
|
159
168
|
itemId: t,
|
|
160
169
|
portal: e,
|
|
161
170
|
relationship: m
|
|
162
|
-
}),
|
|
163
|
-
if (
|
|
171
|
+
}), u = h.result?.total ? h.result.relatedItems.shift() ?? null : null;
|
|
172
|
+
if (l && !o(u) || !u) {
|
|
164
173
|
m = { relationshipType: ["Service2Data"], direction: "forward" };
|
|
165
|
-
const
|
|
174
|
+
const f = await I({
|
|
166
175
|
itemId: t,
|
|
167
176
|
portal: e,
|
|
168
177
|
relationship: m
|
|
169
178
|
});
|
|
170
179
|
return {
|
|
171
|
-
sourceData:
|
|
180
|
+
sourceData: f.result?.total ? f.result.relatedItems.shift() ?? u : u,
|
|
172
181
|
relationship: m
|
|
173
182
|
};
|
|
174
183
|
}
|
|
175
|
-
return { sourceData:
|
|
184
|
+
return { sourceData: u, relationship: m };
|
|
176
185
|
}
|
|
177
186
|
return null;
|
|
178
|
-
} catch (
|
|
179
|
-
return console.error(
|
|
187
|
+
} catch (c) {
|
|
188
|
+
return console.error(c), { sourceData: null, relationship: { direction: "forward" } };
|
|
180
189
|
}
|
|
181
190
|
}
|
|
182
|
-
async function
|
|
183
|
-
const { id: t, type:
|
|
191
|
+
async function z(i, e) {
|
|
192
|
+
const { id: t, type: s, typeKeywords: n = [] } = i;
|
|
184
193
|
try {
|
|
185
|
-
const
|
|
194
|
+
const l = s === "Notebook" ? { relationshipType: ["Notebook2WebTool"], direction: "forward" } : n.includes("Has Related Route Layers") ? { relationshipType: ["Service2Route"], direction: "forward" } : n.includes("Hosted Service") || s === "Feature Service" ? { relationshipType: ["Service2Service"], direction: s === "Feed" ? "reverse" : "forward" } : s === "Data Store" || n.includes("ArcGIS Server") ? { relationshipType: ["DataStore2BPService"], direction: "forward" } : { relationshipType: ["Service2Data"], direction: "reverse" }, o = await I({
|
|
186
195
|
itemId: t,
|
|
187
196
|
portal: e,
|
|
188
|
-
relationship:
|
|
197
|
+
relationship: l,
|
|
198
|
+
includeRecycleBin: !0
|
|
189
199
|
});
|
|
190
200
|
return {
|
|
191
201
|
resultData: {
|
|
192
|
-
items:
|
|
193
|
-
count:
|
|
202
|
+
items: o.result?.total ? o.result.relatedItems : null,
|
|
203
|
+
count: o.result?.total ?? 0
|
|
194
204
|
},
|
|
195
|
-
relationship:
|
|
205
|
+
relationship: l
|
|
196
206
|
};
|
|
197
|
-
} catch (
|
|
198
|
-
return console.error(
|
|
207
|
+
} catch (r) {
|
|
208
|
+
return console.error(r), {
|
|
199
209
|
resultData: { items: null, count: 0 },
|
|
200
210
|
relationship: { direction: "forward" }
|
|
201
211
|
};
|
|
202
212
|
}
|
|
203
213
|
}
|
|
204
|
-
async function
|
|
205
|
-
const { id: t } =
|
|
214
|
+
async function G(i, e) {
|
|
215
|
+
const { id: t } = i;
|
|
206
216
|
try {
|
|
207
|
-
return (await
|
|
217
|
+
return (await I({
|
|
208
218
|
itemId: t,
|
|
209
219
|
portal: e,
|
|
210
220
|
relationship: { relationshipType: ["ReplacementItem2Item"], direction: "forward" }
|
|
211
221
|
})).result?.relatedItems ?? [];
|
|
212
|
-
} catch (
|
|
213
|
-
return console.error(
|
|
222
|
+
} catch (s) {
|
|
223
|
+
return console.error(s), [];
|
|
214
224
|
}
|
|
215
225
|
}
|
|
216
|
-
function
|
|
217
|
-
return
|
|
226
|
+
function v(i) {
|
|
227
|
+
return i ? i.filter((e) => e.type !== "Code Attachment") : null;
|
|
218
228
|
}
|
|
219
|
-
function
|
|
220
|
-
return
|
|
229
|
+
function x(i) {
|
|
230
|
+
return !!(i && "inRecycleBin" in i && i.inRecycleBin === !0);
|
|
221
231
|
}
|
|
222
|
-
function
|
|
223
|
-
return
|
|
232
|
+
function p(i) {
|
|
233
|
+
return i.updatedStatus ?? i.kind;
|
|
224
234
|
}
|
|
225
|
-
function
|
|
235
|
+
function g(i) {
|
|
236
|
+
return { ...i, originalStatus: i.originalStatus ?? i.kind };
|
|
237
|
+
}
|
|
238
|
+
function V(i, e) {
|
|
226
239
|
return {
|
|
227
|
-
...
|
|
240
|
+
...i,
|
|
228
241
|
kind: e,
|
|
229
|
-
originalStatus:
|
|
242
|
+
originalStatus: i.originalStatus ?? i.kind
|
|
230
243
|
};
|
|
231
244
|
}
|
|
232
|
-
async function
|
|
233
|
-
const t = await
|
|
234
|
-
itemId:
|
|
245
|
+
async function K(i, e) {
|
|
246
|
+
const t = await W({
|
|
247
|
+
itemId: i.id,
|
|
235
248
|
portal: e,
|
|
236
249
|
relationship: { direction: "forward" }
|
|
237
|
-
}),
|
|
238
|
-
usedByItems:
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
250
|
+
}), s = await j(i, e), n = await z(i, e), r = await G(i, e), l = t.result?.relatedItems ?? [], o = v(l) ?? [], a = t.result?.aggregations?.total?.count, c = v(n.resultData.items), m = v(r), h = s?.sourceData, u = {
|
|
251
|
+
usedByItems: o,
|
|
252
|
+
usedByItemsCount: a == null ? o.length : Math.max(0, a - (l.length - o.length)),
|
|
253
|
+
sourceData: h?.type === "Code Attachment" ? null : h ?? null,
|
|
254
|
+
resultData: c,
|
|
255
|
+
replacementItemFor: m?.length ? m : null
|
|
256
|
+
}, { result: f, error: w } = await B({
|
|
257
|
+
item: i,
|
|
244
258
|
portal: e,
|
|
245
259
|
permanentlyDelete: !1
|
|
246
260
|
});
|
|
247
|
-
if (
|
|
248
|
-
switch (
|
|
261
|
+
if (w)
|
|
262
|
+
switch (w.code) {
|
|
249
263
|
case "itemHasDependentItems":
|
|
250
|
-
return
|
|
251
|
-
item:
|
|
252
|
-
...
|
|
264
|
+
return g({
|
|
265
|
+
item: i,
|
|
266
|
+
...u,
|
|
253
267
|
kind: "cannotDelete",
|
|
254
268
|
reason: "hasDependentItems"
|
|
255
269
|
});
|
|
256
270
|
case "itemDeleteProtected":
|
|
257
|
-
return
|
|
258
|
-
item:
|
|
259
|
-
...
|
|
271
|
+
return g({
|
|
272
|
+
item: i,
|
|
273
|
+
...u,
|
|
260
274
|
kind: "cannotDelete",
|
|
261
275
|
reason: "deleteProtected"
|
|
262
276
|
});
|
|
263
277
|
default:
|
|
264
|
-
return
|
|
265
|
-
item:
|
|
266
|
-
...
|
|
278
|
+
return g({
|
|
279
|
+
item: i,
|
|
280
|
+
...u,
|
|
267
281
|
kind: "cannotDelete",
|
|
268
282
|
reason: "uncaught"
|
|
269
283
|
});
|
|
270
284
|
}
|
|
271
|
-
if (!
|
|
272
|
-
const { result:
|
|
273
|
-
item:
|
|
285
|
+
if (!f?.success) {
|
|
286
|
+
const { result: T } = await B({
|
|
287
|
+
item: i,
|
|
274
288
|
portal: e,
|
|
275
289
|
permanentlyDelete: !0
|
|
276
290
|
});
|
|
277
|
-
return
|
|
278
|
-
item:
|
|
279
|
-
...
|
|
291
|
+
return T?.success ? g({
|
|
292
|
+
item: i,
|
|
293
|
+
...u,
|
|
280
294
|
kind: "permanentlyDelete",
|
|
281
295
|
reason: "notSupported"
|
|
282
|
-
}) :
|
|
283
|
-
item:
|
|
284
|
-
...
|
|
296
|
+
}) : g({
|
|
297
|
+
item: i,
|
|
298
|
+
...u,
|
|
285
299
|
kind: "cannotDelete",
|
|
286
300
|
reason: "uncaught"
|
|
287
301
|
});
|
|
288
302
|
}
|
|
289
|
-
return
|
|
303
|
+
return g({ item: i, ...u, kind: "recycle" });
|
|
290
304
|
}
|
|
291
|
-
async function
|
|
292
|
-
const t = await Promise.all(
|
|
293
|
-
return
|
|
305
|
+
async function J(i, e) {
|
|
306
|
+
const t = await Promise.all(i.map(async (s) => await K(s, e)));
|
|
307
|
+
return Q(t);
|
|
294
308
|
}
|
|
295
|
-
function
|
|
309
|
+
function Q(i) {
|
|
296
310
|
const e = /* @__PURE__ */ new Map();
|
|
297
|
-
for (const t of
|
|
311
|
+
for (const t of i)
|
|
298
312
|
t.item.id && e.set(t.item.id, t);
|
|
299
|
-
return
|
|
313
|
+
return i.map((t) => {
|
|
300
314
|
if (t.kind !== "cannotDelete" || t.reason !== "hasDependentItems" || !t.item.id)
|
|
301
315
|
return t;
|
|
302
|
-
const
|
|
303
|
-
if (
|
|
316
|
+
const n = X(t.resultData, e);
|
|
317
|
+
if (n.length === 0)
|
|
304
318
|
return t;
|
|
305
|
-
const
|
|
306
|
-
return
|
|
319
|
+
const r = n.every((o) => e.has(o)), l = n.every((o) => !e.get(o)?.item.protected);
|
|
320
|
+
return r && l ? V(t, "recycle") : t;
|
|
307
321
|
});
|
|
308
322
|
}
|
|
309
|
-
function
|
|
310
|
-
if (!
|
|
323
|
+
function X(i, e, t = /* @__PURE__ */ new Set()) {
|
|
324
|
+
if (!i?.length)
|
|
311
325
|
return [];
|
|
312
|
-
const
|
|
313
|
-
for (;
|
|
314
|
-
const
|
|
315
|
-
if (!
|
|
326
|
+
const s = i.filter((r) => !x(r)), n = /* @__PURE__ */ new Set();
|
|
327
|
+
for (; s.length > 0; ) {
|
|
328
|
+
const l = s.shift().id;
|
|
329
|
+
if (!l || t.has(l))
|
|
316
330
|
continue;
|
|
317
|
-
t.add(
|
|
318
|
-
const
|
|
319
|
-
|
|
331
|
+
t.add(l), n.add(l);
|
|
332
|
+
const a = e.get(l)?.resultData ?? [];
|
|
333
|
+
s.push(...a.filter((c) => !x(c)));
|
|
320
334
|
}
|
|
321
|
-
return [...
|
|
335
|
+
return [...n];
|
|
322
336
|
}
|
|
323
|
-
const
|
|
324
|
-
function
|
|
325
|
-
recycleItems:
|
|
337
|
+
const Y = M`: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}.single-item-bucket{--calcite-block-background-color: transparent;--calcite-block-border-color: transparent}.bucket__content{display:flex;align-items:flex-start;gap:.75rem;width:100%}.bucket__icon{flex-shrink:0}.bucket__icon--danger{color:var(--calcite-color-status-danger)}.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__checkbox{margin-top:.5rem}.bucket__description{line-height:1.35;font-size:var(--calcite-font-size--1)}.bucket__link{display:flex;align-items:center;min-height:1.5rem}.item-link-content{position:relative;>arcgis-portal-item-type{margin-inline-end:.25rem;vertical-align:middle}}.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}.header-description{font-size:var(--calcite-font-size--1);font-weight:400}`;
|
|
338
|
+
function Z({
|
|
339
|
+
recycleItems: i,
|
|
326
340
|
cannotDeleteItems: e,
|
|
327
341
|
permanentlyDeleteItems: t
|
|
328
342
|
}) {
|
|
329
|
-
return [...
|
|
343
|
+
return [...i, ...e, ...t];
|
|
330
344
|
}
|
|
331
|
-
function
|
|
332
|
-
return
|
|
345
|
+
function ee(i) {
|
|
346
|
+
return i.map(({ item: e, sourceData: t, resultData: s, replacementItemFor: n }) => ({
|
|
333
347
|
item: e,
|
|
334
348
|
sourceData: t,
|
|
335
|
-
resultData:
|
|
336
|
-
replacementItemFor:
|
|
349
|
+
resultData: s,
|
|
350
|
+
replacementItemFor: n
|
|
337
351
|
}));
|
|
338
352
|
}
|
|
339
|
-
function
|
|
340
|
-
return !e && !!t?.length && !
|
|
353
|
+
function te(i, e, t) {
|
|
354
|
+
return !e && !!t?.length && !y(i);
|
|
341
355
|
}
|
|
342
|
-
function
|
|
343
|
-
selectedItems:
|
|
356
|
+
function se({
|
|
357
|
+
selectedItems: i
|
|
344
358
|
}) {
|
|
345
359
|
const e = [];
|
|
346
360
|
return e.push(
|
|
347
|
-
...
|
|
348
|
-
const
|
|
349
|
-
return
|
|
361
|
+
...i.flatMap(({ item: t, sourceData: s, resultData: n, replacementItemFor: r }) => {
|
|
362
|
+
const l = te(t, s, n), o = !!(n?.some((a) => !a.inRecycleBin) && !ie(t, n) && !ne(t, n));
|
|
363
|
+
return l && o ? [{ item: t, reason: "dependent", offendingItems: n ?? void 0 }] : r && r?.length > 0 ? [{ item: t, reason: "replacement", offendingItems: r }] : [];
|
|
350
364
|
})
|
|
351
365
|
), e;
|
|
352
366
|
}
|
|
353
|
-
function
|
|
367
|
+
function ie(i, e) {
|
|
354
368
|
const t = e[0];
|
|
355
|
-
return
|
|
369
|
+
return i.type === "Feed" && y(i) && e.length === 1 && t?.type === "Feature Service" && y(t);
|
|
356
370
|
}
|
|
357
|
-
function
|
|
371
|
+
function ne(i, e) {
|
|
358
372
|
const t = e[0];
|
|
359
|
-
return
|
|
373
|
+
return i.type === "Feature Service" && y(i) && e.length === 1 && t?.type === "Feed" && y(t);
|
|
360
374
|
}
|
|
361
|
-
function
|
|
362
|
-
return d`<calcite-link id=${
|
|
363
|
-
const
|
|
364
|
-
|
|
365
|
-
}}><span slot=content-start><arcgis-portal-item-type .item=${
|
|
375
|
+
function C({ id: i, linkText: e, label: t, placement: s, items: n, portal: r, user: l }) {
|
|
376
|
+
return d`<calcite-link id=${i ?? L}>${e}</calcite-link><calcite-popover .label=${t} .referenceElement=${i} .placement=${s} auto-close><calcite-list .label=${t} selection-mode=none>${n.map((o) => d`<calcite-list-item .label=${o.title ?? ""} @calciteListItemSelect=${() => {
|
|
377
|
+
const a = o.itemPageUrl;
|
|
378
|
+
a && window.open(a.replace("sharing/rest/", ""), "_blank", "noopener,noreferrer");
|
|
379
|
+
}}><span slot=content-start><arcgis-portal-item-type .item=${o} .portal=${r} .user=${l} hide-text></arcgis-portal-item-type></span><span slot=content>${o.title}</span></calcite-list-item>`)}</calcite-list></calcite-popover>`;
|
|
366
380
|
}
|
|
367
|
-
class
|
|
381
|
+
class re extends U {
|
|
368
382
|
constructor() {
|
|
369
|
-
super(...arguments), this.deleteStatusRequestId = 0, this.updatedCannotDeleteItemIds = /* @__PURE__ */ new Set(), this.messages =
|
|
383
|
+
super(...arguments), this.deleteStatusRequestId = 0, this.updatedCannotDeleteItemIds = /* @__PURE__ */ new Set(), this.messages = E({ blocking: !0 }), this.isLoading = !0, this.submittingAction = null, this.loadedItems = [], this.hasConfirmedReview = !1, this.hasReviewedSelectedItems = !1, this.cannotDeleteItems = [], this.recycleItems = [], this.permanentlyDeleteItems = [], this.deprecateItems = [], this.excludeItems = [], this.reviewingDirectlyUsedByItems = !1, this.reviewDecision = null, this.active = !0, this.items = [], this.itemIds = [], this.user = null, this.disableLinks = !1, this.arcgisClose = D(), this.arcgisConfirm = D(), this.arcgisError = D();
|
|
370
384
|
}
|
|
371
385
|
static {
|
|
372
|
-
this.properties = { isLoading: 16, hasConfirmedReview: 16, hasReviewedSelectedItems: 16, cannotDeleteItems: 16, recycleItems: 16, permanentlyDeleteItems: 16, deprecateItems: 16, excludeItems: 16, reviewingDirectlyUsedByItems: 16, reviewDecision: 16, active: 5, items: 0, portal: 0, user: 0, disableLinks: 5 };
|
|
386
|
+
this.properties = { isLoading: 16, submittingAction: 16, loadedItems: 16, hasConfirmedReview: 16, hasReviewedSelectedItems: 16, cannotDeleteItems: 16, recycleItems: 16, permanentlyDeleteItems: 16, deprecateItems: 16, excludeItems: 16, reviewingDirectlyUsedByItems: 16, reviewDecision: 16, active: 5, items: 0, itemIds: 0, portal: 0, user: 0, disableLinks: 5 };
|
|
373
387
|
}
|
|
374
388
|
static {
|
|
375
|
-
this.styles =
|
|
389
|
+
this.styles = Y;
|
|
376
390
|
}
|
|
377
391
|
willUpdate(e) {
|
|
378
|
-
const t = e.has("items") || e.has("portal") || e.has("user") || e.has("active");
|
|
379
|
-
this.active && t && (this.user ??= this.portal?.user || null, this.resetState(), this.
|
|
392
|
+
const t = e.has("items") || e.has("itemIds") || e.has("portal") || e.has("user") || e.has("active");
|
|
393
|
+
this.active && t && (this.user ??= this.portal?.user || null, this.resetState(), this.initializeItems(++this.deleteStatusRequestId));
|
|
394
|
+
}
|
|
395
|
+
async initializeItems(e) {
|
|
396
|
+
const { items: t, itemIds: s, portal: n } = this, r = t.length ? t : await Promise.all(s.map(async (l) => await new b({ id: l, portal: n }).load()));
|
|
397
|
+
e === this.deleteStatusRequestId && (this.loadedItems = r, await this.determineDeleteStatus(e));
|
|
380
398
|
}
|
|
381
399
|
async handleReviewDecision(e) {
|
|
382
|
-
const t = this.itemsWithImpactedItems.map(({ item:
|
|
383
|
-
|
|
384
|
-
|
|
400
|
+
const t = this.itemsWithImpactedItems.map(({ item: a }) => a), s = e === "delete" ? "recycle" : e === "deprecate" ? "deprecate" : "exclude", n = this.permanentlyDeleteItems.filter((a) => this.isPermanentlyDeleteOverrideActive(a)), r = this.permanentlyDeleteItems.filter((a) => !this.isPermanentlyDeleteOverrideActive(a)), l = [
|
|
401
|
+
...this.recycleItems,
|
|
402
|
+
...this.deprecateItems,
|
|
403
|
+
...this.excludeItems,
|
|
404
|
+
...n
|
|
405
|
+
], o = e === "delete" && l.some((a) => p(a) !== "recycle" && t.some(({ id: c }) => c === a.item.id));
|
|
406
|
+
for (const a of l) {
|
|
407
|
+
if (!t.some(({ id: h }) => h === a.item.id))
|
|
385
408
|
continue;
|
|
386
|
-
const
|
|
387
|
-
|
|
409
|
+
const m = a.originalStatus ?? a.kind;
|
|
410
|
+
a.originalStatus = m, a.updatedStatus = s;
|
|
388
411
|
}
|
|
389
412
|
if (this.reviewDecision = {
|
|
390
413
|
action: e,
|
|
391
414
|
items: t
|
|
392
|
-
}, this.hasConfirmedReview = !0, this.reviewingDirectlyUsedByItems = !1, this.recycleItems =
|
|
415
|
+
}, this.hasConfirmedReview = !0, this.reviewingDirectlyUsedByItems = !1, this.recycleItems = l.filter((a) => p(a) === "recycle"), this.deprecateItems = l.filter((a) => p(a) === "deprecate"), this.excludeItems = l.filter((a) => p(a) === "exclude"), this.permanentlyDeleteItems = r, e !== "delete" || o) {
|
|
393
416
|
this.isLoading = !0;
|
|
394
|
-
const
|
|
395
|
-
await this.determineDeleteStatus(++this.deleteStatusRequestId,
|
|
417
|
+
const a = [...this.cannotDeleteItems, ...this.recycleItems, ...this.permanentlyDeleteItems].map(({ item: c }) => c);
|
|
418
|
+
await this.determineDeleteStatus(++this.deleteStatusRequestId, a);
|
|
396
419
|
}
|
|
397
420
|
}
|
|
421
|
+
async updateAllContentStatus(e, t) {
|
|
422
|
+
return (await Promise.all(e.map(async (n) => await q(n, t)))).flatMap(({ result: n }) => n ? [n] : []);
|
|
423
|
+
}
|
|
398
424
|
async handleDelete() {
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
this.
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
425
|
+
if (!this.active || this.submittingAction)
|
|
426
|
+
return;
|
|
427
|
+
this.submittingAction = "delete";
|
|
428
|
+
const e = { restUrl: this.portal.restUrl }, { result: t = [] } = this.recycleItems.length ? await R(this.recycleItems.map(({ item: r }) => r), e) : { result: [] }, { result: s = [] } = this.permanentlyDeleteItems.length ? await R(this.permanentlyDeleteItems.map(({ item: r }) => r), e, !0) : { result: [] }, n = this.deprecateItems.length ? await this.updateAllContentStatus(this.deprecateItems.map(({ item: r }) => r), "deprecated") : null;
|
|
429
|
+
this.arcgisConfirm.emit({
|
|
430
|
+
deletedItems: t,
|
|
431
|
+
permanentlyDeletedItems: s,
|
|
432
|
+
deletedItemsCount: t.length,
|
|
433
|
+
permanentlyDeletedItemsCount: s.length,
|
|
434
|
+
deprecatedItems: n
|
|
435
|
+
}), this.closeDialog();
|
|
436
|
+
}
|
|
437
|
+
async handleDeprecate() {
|
|
438
|
+
if (!this.active || this.submittingAction)
|
|
439
|
+
return;
|
|
440
|
+
this.submittingAction = "deprecate";
|
|
441
|
+
const e = [...this.deprecateItems, ...this.recycleItems, ...this.permanentlyDeleteItems], t = e.length ? await this.updateAllContentStatus(e.map(({ item: s }) => s), "deprecated") : null;
|
|
442
|
+
this.arcgisConfirm.emit({
|
|
443
|
+
deletedItems: null,
|
|
444
|
+
permanentlyDeletedItems: null,
|
|
445
|
+
deletedItemsCount: 0,
|
|
446
|
+
permanentlyDeletedItemsCount: 0,
|
|
447
|
+
deprecatedItems: t
|
|
448
|
+
}), this.closeDialog();
|
|
408
449
|
}
|
|
409
450
|
handleDialogClose() {
|
|
410
|
-
this.active &&
|
|
451
|
+
this.active && this.closeDialog();
|
|
411
452
|
}
|
|
412
453
|
closeDialog() {
|
|
413
|
-
this.active = !1, this.resetState();
|
|
454
|
+
this.active = !1, this.resetState(), this.arcgisClose.emit();
|
|
414
455
|
}
|
|
415
456
|
resetState() {
|
|
416
|
-
this.isLoading = !0, this.hasConfirmedReview = !1, this.hasReviewedSelectedItems = !1, this.cannotDeleteItems = [], this.recycleItems = [], this.permanentlyDeleteItems = [], this.deprecateItems = [], this.excludeItems = [], this.reviewingDirectlyUsedByItems = !1, this.reviewDecision = null, this.updatedCannotDeleteItemIds.clear(), ++this.deleteStatusRequestId;
|
|
457
|
+
this.isLoading = !0, this.submittingAction = null, this.loadedItems = [], this.hasConfirmedReview = !1, this.hasReviewedSelectedItems = !1, this.cannotDeleteItems = [], this.recycleItems = [], this.permanentlyDeleteItems = [], this.deprecateItems = [], this.excludeItems = [], this.reviewingDirectlyUsedByItems = !1, this.reviewDecision = null, this.updatedCannotDeleteItemIds.clear(), ++this.deleteStatusRequestId;
|
|
417
458
|
}
|
|
418
|
-
async determineDeleteStatus(e, t = this.
|
|
419
|
-
const
|
|
459
|
+
async determineDeleteStatus(e, t = this.loadedItems) {
|
|
460
|
+
const s = new Set(this.recycleItems.map(({ item: r }) => r.id).filter((r) => !!r)), n = await J(t, this.portal);
|
|
420
461
|
if (e === this.deleteStatusRequestId) {
|
|
421
|
-
this.cannotDeleteItems =
|
|
422
|
-
for (const
|
|
423
|
-
|
|
424
|
-
this.recycleItems =
|
|
462
|
+
this.cannotDeleteItems = n.filter((r) => p(r) === "cannotDelete");
|
|
463
|
+
for (const r of this.cannotDeleteItems)
|
|
464
|
+
r.item.id && s.has(r.item.id) && this.updatedCannotDeleteItemIds.add(r.item.id);
|
|
465
|
+
this.recycleItems = n.filter((r) => p(r) === "recycle"), this.permanentlyDeleteItems = n.filter((r) => p(r) === "permanentlyDelete"), this.isLoading = !1;
|
|
425
466
|
}
|
|
426
467
|
}
|
|
427
468
|
get itemsWithImpactedItems() {
|
|
428
|
-
const e = new Set(this.
|
|
429
|
-
return [
|
|
469
|
+
const e = new Set(this.loadedItems.map(({ id: t }) => t));
|
|
470
|
+
return [
|
|
471
|
+
...this.recycleItems,
|
|
472
|
+
...this.deprecateItems,
|
|
473
|
+
...this.excludeItems,
|
|
474
|
+
...this.permanentlyDeleteItems.filter((t) => this.isPermanentlyDeleteOverrideActive(t))
|
|
475
|
+
].map((t) => ({
|
|
430
476
|
...t,
|
|
431
|
-
usedByItems: t.usedByItems.filter(({ id:
|
|
477
|
+
usedByItems: t.usedByItems.filter(({ id: s }) => !e.has(s))
|
|
432
478
|
})).filter(({ usedByItems: t }) => t.length > 0);
|
|
433
479
|
}
|
|
434
480
|
get itemsHaveImpactedItems() {
|
|
435
481
|
return this.itemsWithImpactedItems.length > 0;
|
|
436
482
|
}
|
|
437
483
|
get itemsNeedReview() {
|
|
438
|
-
return this.itemsWithImpactedItems.some((e) =>
|
|
484
|
+
return this.itemsWithImpactedItems.some((e) => ["recycle", "permanentlyDelete"].includes(p(e)));
|
|
485
|
+
}
|
|
486
|
+
isPermanentlyDeleteOverrideActive(e) {
|
|
487
|
+
return e.kind === "recycle" && e.updatedStatus === "permanentlyDelete";
|
|
488
|
+
}
|
|
489
|
+
handlePermanentlyDeleteOverrideChange(e) {
|
|
490
|
+
if (e) {
|
|
491
|
+
const s = this.recycleItems.map((n) => ({
|
|
492
|
+
...n,
|
|
493
|
+
originalStatus: n.originalStatus ?? n.kind,
|
|
494
|
+
updatedStatus: "permanentlyDelete"
|
|
495
|
+
}));
|
|
496
|
+
this.recycleItems = [], this.permanentlyDeleteItems = [...this.permanentlyDeleteItems, ...s];
|
|
497
|
+
return;
|
|
498
|
+
}
|
|
499
|
+
const t = this.permanentlyDeleteItems.filter((s) => this.isPermanentlyDeleteOverrideActive(s));
|
|
500
|
+
this.permanentlyDeleteItems = this.permanentlyDeleteItems.filter((s) => !this.isPermanentlyDeleteOverrideActive(s)), this.recycleItems = [
|
|
501
|
+
...this.recycleItems,
|
|
502
|
+
...t.map((s) => ({ ...s, updatedStatus: "recycle" }))
|
|
503
|
+
];
|
|
439
504
|
}
|
|
440
505
|
get deleteButtonEnabled() {
|
|
441
506
|
return !this.isLoading && (!this.itemsNeedReview || this.hasConfirmedReview);
|
|
@@ -452,10 +517,10 @@ class Z extends x {
|
|
|
452
517
|
].filter((t) => t.length > 0).length > 1 ? "mixed" : this.markedForDeprecation.length > 0 ? "deprecate" : this.permanentlyDeleteItems.length > 0 ? "permanentlyDelete" : this.recycleItems.length > 0 ? "delete" : (this.cannotDeleteItems.length > 0, "none");
|
|
453
518
|
}
|
|
454
519
|
getHeaderText() {
|
|
455
|
-
return this.reviewingDirectlyUsedByItems ? this.messages.reviewItemsCount.replace("{count}", `${this.itemsWithImpactedItems.length}`) : this.items.length === 1 ? this.messages.deleteItem : this.messages.deleteItems;
|
|
520
|
+
return this.reviewingDirectlyUsedByItems ? this.messages.reviewItemsCount.replace("{count}", `${this.itemsWithImpactedItems.length}`) : (this.items.length ? this.items : this.itemIds).length === 1 ? this.messages.deleteItem : this.messages.deleteItems;
|
|
456
521
|
}
|
|
457
522
|
getHeaderDescription() {
|
|
458
|
-
return this.
|
|
523
|
+
return this.loadedItems.length <= 1 ? "" : this.reviewingDirectlyUsedByItems ? this.messages.reviewItemsDescription : this.messages.selectedItems.replace("{count}", `${this.loadedItems.length}`);
|
|
459
524
|
}
|
|
460
525
|
getConfirmButtonText() {
|
|
461
526
|
switch (this.deleteMode) {
|
|
@@ -464,39 +529,41 @@ class Z extends x {
|
|
|
464
529
|
case "deprecate":
|
|
465
530
|
return this.messages.deprecate;
|
|
466
531
|
case "permanentlyDelete":
|
|
467
|
-
return this.messages.permanentlyDelete;
|
|
532
|
+
return this.portal.recycleBinEnabled ? this.messages.permanentlyDelete : this.messages.delete;
|
|
468
533
|
case "delete":
|
|
469
534
|
return this.messages.delete;
|
|
470
535
|
default:
|
|
471
536
|
return this.messages.delete;
|
|
472
537
|
}
|
|
473
538
|
}
|
|
474
|
-
renderBucket({ icon: e, label: t, description:
|
|
475
|
-
return d`<calcite-block scale=l expanded><div class="bucket__content"><calcite-icon class
|
|
539
|
+
renderBucket({ icon: e, label: t, description: s, link: n, additionalContent: r, dangerIcon: l = !1, bucket: o }) {
|
|
540
|
+
return d`<calcite-block class=${S({ "single-item-bucket": (this.items.length ? this.items : this.itemIds).length === 1 })} scale=l expanded><div class="bucket__content"><calcite-icon class=${S({ bucket__icon: !0, "bucket__icon--danger": l })} scale=l .icon=${e}></calcite-icon><div class="bucket__details"><div class="bucket__header"><span class="bucket__label">${t}</span><span>${this.renderBucketItems(o)}</span></div>${s && d`<span class="bucket__description">${s}</span>` || ""}${n && d`<div class="bucket__link"><calcite-link .href=${n.href} target=_blank icon-start=launch>${n.text ?? this.messages.moreInfo}</calcite-link></div>` || ""}${r}</div></div></calcite-block>`;
|
|
476
541
|
}
|
|
477
542
|
renderBucketItems(e = []) {
|
|
543
|
+
return this.renderItemLinks(e.map(({ item: t }) => t));
|
|
544
|
+
}
|
|
545
|
+
renderItemLinks(e, t = `delete-items-bucket-${e.map(({ id: s }) => s).join("-")}`) {
|
|
478
546
|
if (e.length === 0)
|
|
479
547
|
return null;
|
|
480
548
|
if (e.length === 1) {
|
|
481
|
-
const
|
|
482
|
-
return d`<calcite-link .href=${
|
|
549
|
+
const s = e[0], n = `${H({ portal: this.portal })}/item.html?id=${s.id}`;
|
|
550
|
+
return d`<calcite-link .href=${n} target=_blank><span class="item-link-content"><arcgis-portal-item-type .item=${s} .portal=${this.portal} .user=${this.user} hide-text></arcgis-portal-item-type><span>${s.title}</span></span></calcite-link>`;
|
|
483
551
|
}
|
|
484
|
-
|
|
485
|
-
return S({
|
|
552
|
+
return C({
|
|
486
553
|
id: t,
|
|
487
554
|
linkText: e.length,
|
|
488
555
|
label: this.messages.bucketItems.replace("{count}", String(e.length)),
|
|
489
556
|
placement: "bottom-start",
|
|
490
|
-
items:
|
|
557
|
+
items: e,
|
|
491
558
|
portal: this.portal,
|
|
492
559
|
user: this.user
|
|
493
560
|
});
|
|
494
561
|
}
|
|
495
562
|
renderRelatedItemsPopover(e) {
|
|
496
|
-
const t = e.flatMap(({ usedByItems:
|
|
497
|
-
return e.length > 1 || t.length === 0 ? null :
|
|
563
|
+
const t = e.flatMap(({ usedByItems: n }) => n);
|
|
564
|
+
return e.length > 1 || t.length === 0 ? null : C({
|
|
498
565
|
id: "delete-items-directly-used-by",
|
|
499
|
-
linkText:
|
|
566
|
+
linkText: $(this.messages._t9nLocale, this.messages.usedByOtherItems, t.length),
|
|
500
567
|
label: this.messages.usedByPopover,
|
|
501
568
|
placement: "auto",
|
|
502
569
|
items: t,
|
|
@@ -505,36 +572,40 @@ class Z extends x {
|
|
|
505
572
|
});
|
|
506
573
|
}
|
|
507
574
|
renderDirectlyUsedByItems() {
|
|
508
|
-
const e =
|
|
575
|
+
const e = Z({
|
|
509
576
|
recycleItems: this.recycleItems,
|
|
510
577
|
cannotDeleteItems: this.cannotDeleteItems,
|
|
511
578
|
permanentlyDeleteItems: this.permanentlyDeleteItems
|
|
512
|
-
}), t = e.flatMap(({ usedByItems:
|
|
513
|
-
selectedItems:
|
|
514
|
-
});
|
|
515
|
-
return d`${this.
|
|
579
|
+
}), t = this.cannotDeleteItems.find(({ reason: c }) => c === "hasDependentItems"), s = t ? t.resultData ?? [] : e.flatMap(({ usedByItems: c }) => c), n = t ? s.length : e[0]?.usedByItemsCount, r = se({
|
|
580
|
+
selectedItems: ee(e)
|
|
581
|
+
}), l = r.find(({ reason: c }) => c === "replacement"), o = l?.offendingItems ?? [], a = $(this.messages._t9nLocale, this.messages.replacementItem.isReplacementFor, o.length, { itemLink: "{itemLink}" });
|
|
582
|
+
return d`${this.loadedItems.length === 1 && ["delete", "permanentlyDelete"].includes(this.deleteMode) && r.length > 0 ? d`<div class="discouraged-items-warning"><calcite-notice kind=warning open><div slot=message>${l ? a.split("{itemLink}").map((c, m) => d`${m > 0 && this.renderItemLinks(o, "delete-items-replacement-for") || ""}${c}`) : this.messages.deleteDiscouraged}</div>${!l && d`<calcite-link icon-end=launch slot=link>${this.messages.learnMoreAboutDeletingSourceItems}</calcite-link>` || ""}</calcite-notice></div>` : null}${!this.cannotDeleteItems.some(({ reason: c }) => c === "deleteProtected") && d`<arcgis-portal-review-related-items .sourceItem=${this.loadedItems[0] ?? null} .relatedItems=${s} .relatedItemsCount=${n} .showDependentItems=${!!t} .portal=${this.portal} .user=${this.user}></arcgis-portal-review-related-items>` || ""}`;
|
|
516
583
|
}
|
|
517
584
|
renderDirectlyUsedByItemsNotice() {
|
|
518
|
-
const e = new Set(this.itemsWithImpactedItems.flatMap(({ usedByItems:
|
|
585
|
+
const e = new Set(this.itemsWithImpactedItems.flatMap(({ usedByItems: s }) => s.map(({ id: n }) => n))), t = this.messages.reviewRelatedItems.multiple.replace("{totalCount}", String(e.size));
|
|
519
586
|
return d`<div class="panel__related-items-notice"><calcite-notice .kind=${this.reviewDecision ? "brand" : "warning"} icon open><div slot=message>${this.reviewDecision ? this.messages.relatedItemsReviewed : t}</div><calcite-button appearance=transparent slot=actions-end @click=${() => {
|
|
520
587
|
this.hasReviewedSelectedItems = !0, this.reviewingDirectlyUsedByItems = !0;
|
|
521
588
|
}}>${this.messages.reviewItems}</calcite-button></calcite-notice></div>`;
|
|
522
589
|
}
|
|
523
590
|
renderDeleteSummary() {
|
|
524
|
-
return d`<div class="panel__content">${this.isLoading ? d`<calcite-scrim loading></calcite-scrim>` : d`<calcite-panel>${this.renderRecycleBucket()}${this.renderDeprecateBucket()}${this.renderExcludeBucket()}${this.renderCannotDeleteBucket()}${this.renderPermanentlyDeleteBucket()}${this.
|
|
591
|
+
return d`<div class="panel__content">${this.isLoading ? d`<calcite-scrim loading></calcite-scrim>` : d`<calcite-panel>${this.renderRecycleBucket()}${this.renderDeprecateBucket()}${this.renderExcludeBucket()}${this.renderCannotDeleteBucket()}${this.renderPermanentlyDeleteBucket()}${this.loadedItems.length === 1 && this.renderDirectlyUsedByItems() || ""}${this.itemsHaveImpactedItems && d`<div>${this.loadedItems.length > 1 ? this.renderDirectlyUsedByItemsNotice() : null}</div>` || ""}</calcite-panel>`}</div>${this.itemsNeedReview && !this.hasReviewedSelectedItems && d`<calcite-checkbox slot=content-bottom class="panel__checkbox" .checked=${this.hasConfirmedReview} @calciteCheckboxChange=${(e) => {
|
|
525
592
|
this.hasConfirmedReview = e.target.checked;
|
|
526
|
-
}} .labelText=${this.messages.
|
|
593
|
+
}} .label=${this.messages.proceedWithDeletion} .labelText=${this.messages.proceedWithDeletion} required></calcite-checkbox>` || ""}${!this.isLoading && d`${this.loadedItems.length === 1 && F(this.loadedItems[0]).contentStatus !== "deprecated" && d`<calcite-button slot=footer-start kind=danger appearance=outline-fill .disabled=${!!this.submittingAction} .loading=${this.submittingAction === "deprecate"} @click=${this.handleDeprecate}>${this.messages.deprecateInstead}</calcite-button>` || ""}<calcite-button slot=footer-end appearance=outline-fill @click=${this.handleDialogClose}>${this.messages.cancel}</calcite-button>${this.deleteMode !== "none" && d`<calcite-button .disabled=${!this.deleteButtonEnabled || !!this.submittingAction} .loading=${this.submittingAction === "delete"} kind=danger slot=footer-end @click=${async () => await this.handleDelete()}>${this.getConfirmButtonText()}</calcite-button>` || ""}` || ""}`;
|
|
527
594
|
}
|
|
528
595
|
renderReviewItems() {
|
|
529
596
|
return d`<div class="panel__content"><calcite-panel><arcgis-portal-delete-items-review .items=${this.itemsWithImpactedItems} .portal=${this.portal} .user=${this.user}></arcgis-portal-delete-items-review></calcite-panel></div><calcite-button slot=footer-start appearance=solid kind=neutral @click=${async () => await this.handleReviewDecision("exclude")}>${this.messages.exclude}</calcite-button><calcite-button slot=footer-end appearance=outline-fill kind=danger @click=${async () => await this.handleReviewDecision("deprecate")}>${this.messages.deprecateInstead}</calcite-button><calcite-button slot=footer-end appearance=solid kind=danger @click=${async () => await this.handleReviewDecision("delete")}>${this.messages.proceedToDelete}</calcite-button>`;
|
|
530
597
|
}
|
|
531
598
|
renderRecycleBucket() {
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
599
|
+
if (!this.recycleItems || this.recycleItems.length === 0)
|
|
600
|
+
return null;
|
|
601
|
+
const e = !this.portal.recycleBinEnabled;
|
|
602
|
+
return this.renderBucket({
|
|
603
|
+
icon: e ? "trash" : "recycle-bin",
|
|
604
|
+
label: e ? this.messages.summary.permanentDelete.delete : this.messages.summary.willBeRecycled,
|
|
605
|
+
description: e ? this.messages.summary.permanentDelete.default.single : this.messages.summary.canBeRecovered.single.replace("{days}", "14"),
|
|
606
|
+
updated: this.recycleItems.some(({ kind: t, updatedStatus: s }) => s === "recycle" && s !== t),
|
|
607
|
+
bucket: this.recycleItems,
|
|
608
|
+
additionalContent: e ? void 0 : d`<calcite-checkbox class="bucket__checkbox" .label=${this.messages.permanentlyDeleteInstead} .labelText=${this.messages.permanentlyDeleteInstead} @calciteCheckboxChange=${(t) => this.handlePermanentlyDeleteOverrideChange(t.target.checked)}></calcite-checkbox>`
|
|
538
609
|
});
|
|
539
610
|
}
|
|
540
611
|
renderDeprecateBucket() {
|
|
@@ -558,29 +629,34 @@ class Z extends x {
|
|
|
558
629
|
renderCannotDeleteBucket() {
|
|
559
630
|
if (!this.cannotDeleteItems || this.cannotDeleteItems.length === 0)
|
|
560
631
|
return null;
|
|
561
|
-
const e = this.cannotDeleteItems?.[0]?.reason;
|
|
632
|
+
const e = this.cannotDeleteItems?.[0]?.reason, t = this.cannotDeleteItems[0]?.resultData?.length ?? 0, s = this.messages.summary.protectedGroup.hasDependentItemsDescription;
|
|
562
633
|
return this.renderBucket({
|
|
563
634
|
icon: "security",
|
|
564
635
|
label: this.messages.summary.cannotDelete,
|
|
565
|
-
description: e === "hasDependentItems" ?
|
|
636
|
+
description: e === "hasDependentItems" ? t > 1 ? s.singleMultipleDependentItems : s.singleOneDependentItem : this.messages.summary.protectedGroup.deleteProtectedDescription,
|
|
566
637
|
bucket: this.cannotDeleteItems,
|
|
567
|
-
updated: this.cannotDeleteItems.some(({ item:
|
|
638
|
+
updated: this.cannotDeleteItems.some(({ item: n }) => n.id && this.updatedCannotDeleteItemIds.has(n.id))
|
|
568
639
|
});
|
|
569
640
|
}
|
|
570
641
|
renderPermanentlyDeleteBucket() {
|
|
571
|
-
|
|
642
|
+
if (!this.permanentlyDeleteItems || this.permanentlyDeleteItems.length === 0)
|
|
643
|
+
return null;
|
|
644
|
+
const e = !this.portal.recycleBinEnabled;
|
|
645
|
+
return this.renderBucket({
|
|
572
646
|
icon: "trash",
|
|
573
|
-
label: this.messages.summary.permanentlyDelete,
|
|
574
|
-
description: this.messages.summary.permanentDelete.notSupported.single,
|
|
575
|
-
bucket: this.permanentlyDeleteItems
|
|
647
|
+
label: e ? this.messages.summary.permanentDelete.delete : this.messages.summary.permanentlyDelete,
|
|
648
|
+
description: e ? this.messages.summary.permanentDelete.default.single : this.permanentlyDeleteItems.some((t) => this.isPermanentlyDeleteOverrideActive(t)) ? null : this.messages.summary.permanentDelete.notSupported.single,
|
|
649
|
+
bucket: this.permanentlyDeleteItems,
|
|
650
|
+
dangerIcon: this.permanentlyDeleteItems.some((t) => this.isPermanentlyDeleteOverrideActive(t)),
|
|
651
|
+
additionalContent: !e && this.permanentlyDeleteItems.some((t) => this.isPermanentlyDeleteOverrideActive(t)) ? d`<calcite-checkbox class="bucket__checkbox" checked .label=${this.messages.permanentlyDeleteInstead} .labelText=${this.messages.permanentlyDeleteInstead} @calciteCheckboxChange=${(t) => this.handlePermanentlyDeleteOverrideChange(t.target.checked)}></calcite-checkbox>` : void 0
|
|
576
652
|
});
|
|
577
653
|
}
|
|
578
654
|
render() {
|
|
579
|
-
const {
|
|
655
|
+
const { loadedItems: e, portal: t } = this;
|
|
580
656
|
return !e || !t ? null : 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 slot=heading><span>${this.getHeaderText()}</span><br><span class="header-description">${this.getHeaderDescription()}</span></div>${this.reviewingDirectlyUsedByItems ? this.renderReviewItems() : this.renderDeleteSummary()}</calcite-dialog>`;
|
|
581
657
|
}
|
|
582
658
|
}
|
|
583
|
-
|
|
659
|
+
P("arcgis-portal-delete-items", re);
|
|
584
660
|
export {
|
|
585
|
-
|
|
661
|
+
re as ArcgisPortalDeleteItems
|
|
586
662
|
};
|