@arcgis/portal-components 5.2.0-next.150 → 5.2.0-next.151

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.
@@ -1,18 +1,18 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import { c as O } from "../../chunks/runtime.js";
2
+ import { c as E } from "../../chunks/runtime.js";
3
3
  import b from "@arcgis/core/portal/PortalItem.js";
4
- import { LitElement as E, createEvent as v, safeClassMap as $, nothing as F } from "@arcgis/lumina";
5
- import { css as H, html as d } from "lit";
4
+ import { LitElement as F, createEvent as v, safeClassMap as $, nothing as H } from "@arcgis/lumina";
5
+ import { css as N, html as d } from "lit";
6
6
  import w from "@arcgis/core/request.js";
7
- import { c as N } from "../../chunks/item2.js";
7
+ import { c as q } from "../../chunks/item2.js";
8
8
  import { r as S } from "../../chunks/request.js";
9
9
  import { a as I } from "../../chunks/item.js";
10
10
  import "../arcgis-portal-review-related-items/customElement.js";
11
11
  import { f as R } from "../../chunks/portal-delete-items-review.js";
12
- import { u as q } from "../../chunks/useT9n.js";
12
+ import { u as B } from "../../chunks/useT9n.js";
13
13
  import { makeController as W } from "@arcgis/lumina/controllers";
14
- import { a as j, e as B } from "../../chunks/portal.js";
15
- import { g as z } from "../../chunks/items.js";
14
+ import { a as z, e as x } from "../../chunks/portal.js";
15
+ import { g as j } from "../../chunks/items.js";
16
16
  import { b as G } from "../../chunks/url.js";
17
17
  async function C(i, t, e = !1) {
18
18
  try {
@@ -24,7 +24,7 @@ async function C(i, t, e = !1) {
24
24
  const n = [];
25
25
  for (const [a, c] of s) {
26
26
  const l = `${t.restUrl}/content/users/${encodeURIComponent(a)}/deleteItems`;
27
- for (const o of N(c, 100)) {
27
+ for (const o of q(c, 100)) {
28
28
  const m = w(l, {
29
29
  method: "post",
30
30
  query: {
@@ -41,7 +41,7 @@ async function C(i, t, e = !1) {
41
41
  return { error: { code: "unhandledError" } };
42
42
  }
43
43
  }
44
- async function x(i) {
44
+ async function _(i) {
45
45
  const { item: t, portal: e, permanentlyDelete: s } = i, { id: n, owner: r } = t;
46
46
  if (!n || !r)
47
47
  return { error: { code: "unhandledError" } };
@@ -72,7 +72,7 @@ async function V(i, t) {
72
72
  return console.error(e), { error: { code: "unhandledError" } };
73
73
  }
74
74
  }
75
- function P(i, t) {
75
+ function M(i, t) {
76
76
  return (i.relatedItems ?? []).map((e) => K(e, t));
77
77
  }
78
78
  function K(i, t) {
@@ -100,7 +100,7 @@ async function g({
100
100
  });
101
101
  return {
102
102
  success: !0,
103
- result: { ...l, relatedItems: P(l, t) }
103
+ result: { ...l, relatedItems: M(l, t) }
104
104
  };
105
105
  } catch (l) {
106
106
  return { success: !1, error: l };
@@ -132,7 +132,7 @@ async function J({
132
132
  });
133
133
  return {
134
134
  success: !0,
135
- result: { ...o, relatedItems: P(o, t) }
135
+ result: { ...o, relatedItems: M(o, t) }
136
136
  };
137
137
  } catch (o) {
138
138
  return { success: !1, error: o };
@@ -242,11 +242,11 @@ function ee(i) {
242
242
  replacementItemFor: n
243
243
  }));
244
244
  }
245
- function M(i, t, e) {
245
+ function U(i, t, e) {
246
246
  return !t && !!e?.length && !I(i);
247
247
  }
248
248
  function te({ item: i, sourceData: t, resultData: e }) {
249
- return !e?.some((s) => !s.inRecycleBin) || M(i, t, e) ? !1 : !U(i, e) && !L(i, e);
249
+ return !e?.some((s) => !s.inRecycleBin) || U(i, t, e) ? !1 : !L(i, e) && !O(i, e);
250
250
  }
251
251
  function se({
252
252
  selectedItems: i
@@ -254,23 +254,23 @@ function se({
254
254
  const t = [];
255
255
  return t.push(
256
256
  ...i.flatMap(({ item: e, sourceData: s, resultData: n, replacementItemFor: r }) => {
257
- const a = M(e, s, n), c = !!(n?.some((l) => !l.inRecycleBin) && !U(e, n) && !L(e, n));
257
+ const a = U(e, s, n), c = !!(n?.some((l) => !l.inRecycleBin) && !L(e, n) && !O(e, n));
258
258
  return a && c ? [{ item: e, reason: "dependent", offendingItems: n ?? void 0 }] : r && r?.length > 0 ? [{ item: e, reason: "replacement", offendingItems: r }] : [];
259
259
  })
260
260
  ), t;
261
261
  }
262
- function U(i, t) {
262
+ function L(i, t) {
263
263
  const e = t[0];
264
264
  return i.type === "Feed" && I(i) && t.length === 1 && e?.type === "Feature Service" && I(e);
265
265
  }
266
- function L(i, t) {
266
+ function O(i, t) {
267
267
  const e = t[0];
268
268
  return i.type === "Feature Service" && I(i) && t.length === 1 && e?.type === "Feed" && I(e);
269
269
  }
270
270
  function k(i) {
271
271
  return i ? i.filter((t) => t.type !== "Code Attachment") : null;
272
272
  }
273
- function _(i) {
273
+ function A(i) {
274
274
  return !!(i && "inRecycleBin" in i && i.inRecycleBin === !0);
275
275
  }
276
276
  function p(i) {
@@ -287,12 +287,12 @@ function ie(i, t) {
287
287
  };
288
288
  }
289
289
  async function ne(i, t) {
290
- const e = await x({ item: i, portal: t, permanentlyDelete: !1 });
290
+ const e = await _({ item: i, portal: t, permanentlyDelete: !1 });
291
291
  if (e.error && e.error.code !== "itemNotSupportedInRecycleBin")
292
292
  return { kind: "cannotDelete", errorCode: e.error.code };
293
293
  if (e.result?.success)
294
294
  return { kind: "recycle" };
295
- const s = await x({ item: i, portal: t, permanentlyDelete: !0 });
295
+ const s = await _({ item: i, portal: t, permanentlyDelete: !0 });
296
296
  return s.result?.success ? { kind: "permanentlyDelete" } : { kind: "cannotDelete", errorCode: s.error?.code ?? "unhandledError" };
297
297
  }
298
298
  function re(i) {
@@ -355,20 +355,20 @@ function ce(i) {
355
355
  function oe(i, t, e = /* @__PURE__ */ new Set()) {
356
356
  if (!i?.length)
357
357
  return [];
358
- const s = i.filter((r) => !_(r)), n = /* @__PURE__ */ new Set();
358
+ const s = i.filter((r) => !A(r)), n = /* @__PURE__ */ new Set();
359
359
  for (; s.length > 0; ) {
360
360
  const a = s.shift().id;
361
361
  if (!a || e.has(a))
362
362
  continue;
363
363
  e.add(a), n.add(a);
364
364
  const l = t.get(a)?.resultData ?? [];
365
- s.push(...l.filter((o) => !_(o)));
365
+ s.push(...l.filter((o) => !A(o)));
366
366
  }
367
367
  return [...n];
368
368
  }
369
- const de = H`: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}`, A = /* @__PURE__ */ new Map();
369
+ const de = N`: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{align-self:flex-start;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-container{width:100%;box-sizing:border-box;background-color:var(--calcite-color-foreground-1)}.panel__checkbox{padding-block:.75rem;padding-inline-start:.75rem}.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}calcite-list{overflow:auto;min-block-size:0;max-height:min(250px,75vh)}.discouraged-items-warning{margin-bottom:.75rem}.header-description{font-size:var(--calcite-font-size--1);font-weight:400}`, T = /* @__PURE__ */ new Map();
370
370
  async function me(i, t) {
371
- const e = j(i), s = JSON.stringify([e, t]), n = A.get(s);
371
+ const e = z(i), s = JSON.stringify([e, t]), n = T.get(s);
372
372
  if (n)
373
373
  return n;
374
374
  try {
@@ -377,7 +377,7 @@ async function me(i, t) {
377
377
  portal: i,
378
378
  params: { culture: t }
379
379
  }))?.helpMap?.m ?? {};
380
- return A.set(s, a), a;
380
+ return T.set(s, a), a;
381
381
  } catch {
382
382
  return {};
383
383
  }
@@ -391,15 +391,15 @@ const ue = (i) => W((t, e) => {
391
391
  }));
392
392
  }), {};
393
393
  });
394
- function T({ id: i, linkText: t, label: e, placement: s, items: n, portal: r, user: a }) {
395
- return d`<calcite-link id=${i ?? F}>${t}</calcite-link><calcite-popover .label=${e} .referenceElement=${i} .placement=${s} auto-close><calcite-list .label=${e} selection-mode=none>${n.map((c) => d`<calcite-list-item .label=${c.title ?? ""} @calciteListItemSelect=${() => {
394
+ function P({ id: i, linkText: t, label: e, placement: s, items: n, portal: r, user: a }) {
395
+ return d`<calcite-link id=${i ?? H}>${t}</calcite-link><calcite-popover .label=${e} .referenceElement=${i} .placement=${s} auto-close><calcite-list .label=${e} selection-mode=none>${n.map((c) => d`<calcite-list-item .label=${c.title ?? ""} @calciteListItemSelect=${() => {
396
396
  const l = c.itemPageUrl;
397
397
  l && window.open(l.replace("sharing/rest/", ""), "_blank", "noopener,noreferrer");
398
398
  }}><span slot=content-start><arcgis-portal-item-type .item=${c} .portal=${r} .user=${a} hide-text></arcgis-portal-item-type></span><span slot=content>${c.title}</span></calcite-list-item>`)}</calcite-list></calcite-popover>`;
399
399
  }
400
- class he extends E {
400
+ class he extends F {
401
401
  constructor() {
402
- super(...arguments), this.deleteStatusRequestId = 0, this.updatedCannotDeleteItemIds = /* @__PURE__ */ new Set(), this.messages = q({ blocking: !0 }), this.helpMap = ue({
402
+ super(...arguments), this.deleteStatusRequestId = 0, this.updatedCannotDeleteItemIds = /* @__PURE__ */ new Set(), this.messages = B({ blocking: !0 }), this.fieldDeleteMessages = B({ name: "portal-field-delete" }), this.helpMap = ue({
403
403
  portal: () => this.portal,
404
404
  language: () => this.messages._t9nLocale
405
405
  }), 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 = v(), this.arcgisConfirm = v(), this.arcgisError = v();
@@ -544,7 +544,7 @@ class he extends E {
544
544
  ].filter((e) => e.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");
545
545
  }
546
546
  getHeaderText() {
547
- 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;
547
+ return this.reviewingDirectlyUsedByItems ? this.messages.reviewItemsCount.replace("{count}", `${this.itemsWithImpactedItems.length}`) : this.isLoading ? "" : this.loadedItems.length > 0 && this.permanentlyDeleteItems.length === this.loadedItems.length ? this.messages.permanentlyDelete : (this.items.length ? this.items : this.itemIds).length === 1 ? this.messages.deleteItem : this.messages.deleteItems;
548
548
  }
549
549
  getHeaderDescription() {
550
550
  return this.loadedItems.length <= 1 ? "" : this.reviewingDirectlyUsedByItems ? this.messages.reviewItemsDescription : this.messages.selectedItems.replace("{count}", `${this.loadedItems.length}`);
@@ -576,7 +576,7 @@ class he extends E {
576
576
  const s = t[0], n = `${G({ portal: this.portal })}/item.html?id=${s.id}`;
577
577
  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>`;
578
578
  }
579
- return T({
579
+ return P({
580
580
  id: e,
581
581
  linkText: t.length,
582
582
  label: this.messages.bucketItems.replace("{count}", String(t.length)),
@@ -588,7 +588,7 @@ class he extends E {
588
588
  }
589
589
  renderRelatedItemsPopover(t) {
590
590
  const e = t.flatMap(({ usedByItems: n }) => n);
591
- return t.length > 1 || e.length === 0 ? null : T({
591
+ return t.length > 1 || e.length === 0 ? null : P({
592
592
  id: "delete-items-directly-used-by",
593
593
  linkText: R(this.messages._t9nLocale, this.messages.usedByOtherItems, e.length),
594
594
  label: this.messages.usedByPopover,
@@ -606,7 +606,7 @@ class he extends E {
606
606
  }), e = this.cannotDeleteItems.find(({ reason: o }) => o === "hasDependentItems"), s = e ? e.resultData ?? [] : t.flatMap(({ usedByItems: o }) => o), n = e ? s.length : t[0]?.usedByItemsCount, r = se({
607
607
  selectedItems: ee(t)
608
608
  }), a = r.find(({ reason: o }) => o === "replacement"), c = a?.offendingItems ?? [], l = R(this.messages._t9nLocale, this.messages.replacementItem.isReplacementFor, c.length, { itemLink: "{itemLink}" });
609
- 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>${a ? l.split("{itemLink}").map((o, m) => d`${m > 0 && this.renderItemLinks(c, "delete-items-replacement-for") || ""}${o}`) : this.messages.deleteDiscouraged}</div>${!a && d`<calcite-link .href=${`${B(this.portal)}${this.helpMap[120001208] || ""}`} icon-end=launch slot=link>${this.messages.learnMoreAboutDeletingSourceItems}</calcite-link>` || ""}</calcite-notice></div>` : null}${!this.cannotDeleteItems.some(({ reason: o }) => o === "deleteProtected") && d`<arcgis-portal-review-related-items .sourceItem=${this.loadedItems[0] ?? null} .relatedItems=${s} .relatedItemsCount=${n} .showDependentItems=${!!e} .portal=${this.portal} .user=${this.user}></arcgis-portal-review-related-items>` || ""}`;
609
+ 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>${a ? l.split("{itemLink}").map((o, m) => d`${m > 0 && this.renderItemLinks(c, "delete-items-replacement-for") || ""}${o}`) : this.messages.deleteDiscouraged}</div>${!a && d`<calcite-link .href=${`${x(this.portal)}${this.helpMap[120001208] || ""}`} icon-end=launch slot=link>${this.messages.learnMoreAboutDeletingSourceItems}</calcite-link>` || ""}</calcite-notice></div>` : null}${!this.cannotDeleteItems.some(({ reason: o }) => o === "deleteProtected") && d`<arcgis-portal-review-related-items .sourceItem=${this.loadedItems[0] ?? null} .relatedItems=${s} .relatedItemsCount=${n} .showDependentItems=${!!e} .portal=${this.portal} .user=${this.user}></arcgis-portal-review-related-items>` || ""}`;
610
610
  }
611
611
  renderDirectlyUsedByItemsNotice() {
612
612
  const t = new Set(this.itemsWithImpactedItems.flatMap(({ usedByItems: s }) => s.map(({ id: n }) => n))), e = this.messages.reviewRelatedItems.multiple.replace("{totalCount}", String(t.size));
@@ -615,9 +615,9 @@ class he extends E {
615
615
  }}>${this.messages.reviewItems}</calcite-button></calcite-notice></div>`;
616
616
  }
617
617
  renderDeleteSummary() {
618
- 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=${(t) => {
618
+ 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`<div slot=content-bottom class="panel__checkbox-container"><calcite-checkbox class="panel__checkbox" .checked=${this.hasConfirmedReview} @calciteCheckboxChange=${(t) => {
619
619
  this.hasConfirmedReview = t.target.checked;
620
- }} .label=${this.messages.proceedWithDeletion} .labelText=${this.messages.proceedWithDeletion} required></calcite-checkbox>` || ""}${!this.isLoading && d`${this.loadedItems.length === 1 && z(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>` || ""}` || ""}`;
620
+ }} .label=${this.messages.proceedWithDeletion} .labelText=${this.messages.proceedWithDeletion} required></calcite-checkbox></div>` || ""}${!this.isLoading && d`${this.loadedItems.length === 1 && j(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>` || ""}` || ""}`;
621
621
  }
622
622
  renderReviewItems() {
623
623
  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>`;
@@ -668,26 +668,26 @@ class he extends E {
668
668
  renderPermanentlyDeleteBucket() {
669
669
  if (!this.permanentlyDeleteItems || this.permanentlyDeleteItems.length === 0)
670
670
  return null;
671
- const t = !this.portal.recycleBinEnabled;
671
+ const t = !this.portal.recycleBinEnabled, e = this.permanentlyDeleteItems.some((s) => this.isPermanentlyDeleteOverrideActive(s));
672
672
  return this.renderBucket({
673
673
  icon: "trash",
674
674
  label: t ? this.messages.summary.permanentDelete.delete : this.messages.summary.permanentlyDelete,
675
- description: t ? this.messages.summary.permanentDelete.default.single : this.permanentlyDeleteItems.some((e) => this.isPermanentlyDeleteOverrideActive(e)) ? null : this.messages.summary.permanentDelete.notSupported.single,
676
- link: {
677
- href: `${B(this.portal)}${this.helpMap[120004692] || ""}`,
678
- text: this.messages.moreInfo
675
+ description: t ? this.messages.summary.permanentDelete.default.single : e ? null : this.messages.summary.permanentDelete.notSupported.single,
676
+ link: e ? void 0 : {
677
+ href: `${x(this.portal)}${this.helpMap[120004692] || ""}`,
678
+ text: this.fieldDeleteMessages.learnMore ?? this.messages.moreInfo
679
679
  },
680
680
  bucket: this.permanentlyDeleteItems,
681
- dangerIcon: this.permanentlyDeleteItems.some((e) => this.isPermanentlyDeleteOverrideActive(e)),
682
- additionalContent: !t && this.permanentlyDeleteItems.some((e) => this.isPermanentlyDeleteOverrideActive(e)) ? d`<calcite-checkbox class="bucket__checkbox" checked .label=${this.messages.permanentlyDeleteInstead} .labelText=${this.messages.permanentlyDeleteInstead} @calciteCheckboxChange=${(e) => this.handlePermanentlyDeleteOverrideChange(e.target.checked)}></calcite-checkbox>` : void 0
681
+ dangerIcon: !t,
682
+ additionalContent: !t && e ? d`<calcite-checkbox class="bucket__checkbox" checked .label=${this.messages.permanentlyDeleteInstead} .labelText=${this.messages.permanentlyDeleteInstead} @calciteCheckboxChange=${(s) => this.handlePermanentlyDeleteOverrideChange(s.target.checked)}></calcite-checkbox>` : void 0
683
683
  });
684
684
  }
685
685
  render() {
686
686
  const { loadedItems: t, portal: e } = this;
687
- return !t || !e ? 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>`;
687
+ return !t || !e ? 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}>${!this.isLoading || this.reviewingDirectlyUsedByItems ? d`<div slot=heading><span>${this.getHeaderText()}</span><br><span class="header-description">${this.getHeaderDescription()}</span></div>` : void 0}${this.reviewingDirectlyUsedByItems ? this.renderReviewItems() : this.renderDeleteSummary()}</calcite-dialog>`;
688
688
  }
689
689
  }
690
- O("arcgis-portal-delete-items", he);
690
+ E("arcgis-portal-delete-items", he);
691
691
  export {
692
692
  he as ArcgisPortalDeleteItems
693
693
  };
@@ -1,48 +1,57 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import { c as d } from "../../chunks/runtime.js";
3
- import { LitElement as p } from "@arcgis/lumina";
4
- import { css as u, html as o } from "lit";
5
- import { f as h } from "../../chunks/user.js";
2
+ import { c as p } from "../../chunks/runtime.js";
3
+ import { LitElement as u } from "@arcgis/lumina";
4
+ import { css as h, html as o } from "lit";
5
+ import { f as d } from "../../chunks/user.js";
6
6
  import { f as g } from "../../chunks/item2.js";
7
7
  import { s as I } from "../../chunks/portal-related-items-list-item.js";
8
- import { u as c } from "../../chunks/useT9n.js";
8
+ import { u as n } from "../../chunks/useT9n.js";
9
9
  import { RelatedItemsListItem as f } from "../portal-related-items-list-item/customElement.js";
10
- import { b } from "../../chunks/url.js";
11
- const w = u`:host{display:block}.items-directly-using{display:flex;justify-content:space-between;align-items:center;padding-block-end:.75rem}.impacted-items-labels{display:flex;flex-direction:column}.impacted-items-title{font-weight:500}.impacted-items-access-count{font-size:var(--calcite-font-size--2)}.view-full-list{margin:.5rem 0}calcite-block{--calcite-block-icon-start-color: var(--calcite-color-status-warning)}calcite-list{max-block-size:250px;overflow-y:auto}`, m = 20;
12
- class v extends p {
10
+ import { b as w } from "../../chunks/url.js";
11
+ const b = h`:host{display:block}.items-directly-using{display:flex;justify-content:space-between;align-items:center;padding-block-end:.75rem}.impacted-items-labels{display:flex;flex-direction:column}.impacted-items-title{font-weight:500}.impacted-items-access-count{font-size:var(--calcite-font-size--2)}.view-full-list{margin:.5rem 0}calcite-block{--calcite-block-icon-start-color: var(--calcite-color-status-warning)}calcite-list{max-block-size:250px;overflow-y:auto}`, c = 20;
12
+ class v extends u {
13
13
  constructor() {
14
- super(...arguments), this.messages = c({ blocking: !0 }), this.browserMessages = c({ name: "portal-browser", blocking: !0 }), this.deleteMessages = c({ name: "portal-delete-items", blocking: !0 }), this.userRequestId = 0, this.itemGroups = {}, this.sourceItem = null, this.relatedItems = [], this.showDependentItems = !1;
14
+ super(...arguments), this.messages = n({ blocking: !0 }), this.browserMessages = n({ name: "portal-browser", blocking: !0 }), this.deleteMessages = n({ name: "portal-delete-items", blocking: !0 }), this.userRequestId = 0, this.itemGroups = {}, this.itemOwners = {}, this.sourceItem = null, this.relatedItems = [], this.showDependentItems = !1;
15
15
  }
16
16
  static {
17
- this.properties = { itemGroups: 16, sourceItem: 0, relatedItems: 0, relatedItemsCount: 9, showDependentItems: 5, portal: 0, user: 0 };
17
+ this.properties = { itemGroups: 16, itemOwners: 16, sourceItem: 0, relatedItems: 0, relatedItemsCount: 9, showDependentItems: 5, portal: 0, user: 0 };
18
18
  }
19
19
  static {
20
- this.styles = [w, I];
20
+ this.styles = [b, I];
21
21
  }
22
22
  willUpdate(e) {
23
- (e.has("relatedItems") || e.has("portal") || e.has("user")) && (this.itemGroups = {}, this.loadGroupSharing(++this.userRequestId));
23
+ (e.has("relatedItems") || e.has("portal") || e.has("user")) && (this.itemGroups = {}, this.itemOwners = {}, this.loadGroupSharing(++this.userRequestId), this.loadItemOwners());
24
+ }
25
+ async loadItemOwners() {
26
+ const { portal: e, relatedItems: s } = this;
27
+ if (!e)
28
+ return;
29
+ const a = [
30
+ ...new Set(s.slice(0, c).map((t) => t.owner).filter((t) => !!t))
31
+ ], i = await Promise.all(a.map(async (t) => [t, await d(t, e)]));
32
+ this.itemOwners = Object.fromEntries(i);
24
33
  }
25
34
  async loadGroupSharing(e) {
26
- const { portal: t, relatedItems: i } = this, s = this.user ?? t?.user;
27
- if (!t || !s?.username || !i.length)
35
+ const { portal: s, relatedItems: a } = this, i = this.user ?? s?.user;
36
+ if (!s || !i?.username || !a.length)
28
37
  return;
29
- const r = await h(s.username, t);
38
+ const t = await d(i.username, s);
30
39
  if (e !== this.userRequestId)
31
40
  return;
32
- const { result: a } = await g(t, r, i);
33
- e === this.userRequestId && (this.itemGroups = a ?? {});
41
+ const { result: r } = await g(s, t, a);
42
+ e === this.userRequestId && (this.itemGroups = r ?? {});
34
43
  }
35
44
  render() {
36
45
  const e = this.relatedItemsCount ?? this.relatedItems.length;
37
46
  if (!e && !this.relatedItems.length)
38
47
  return null;
39
- const t = new Intl.NumberFormat(this.deleteMessages._t9nLocale), i = t.format(e), s = this.showDependentItems ? this.deleteMessages.dependentItems : this.deleteMessages.impactedItems.title, r = this.showDependentItems ? this.deleteMessages.itemsDependingOnThisItem : this.deleteMessages.deletingWillImpactOtherItems, a = this.portal && this.sourceItem ? `${b({ portal: this.portal })}/item.html?id=${this.sourceItem.id}#usage` : void 0, n = () => {
40
- a && window.open(a, "_blank");
48
+ const s = new Intl.NumberFormat(this.deleteMessages._t9nLocale), a = s.format(e), i = this.showDependentItems ? this.deleteMessages.dependentItems : this.deleteMessages.impactedItems.title, t = this.showDependentItems ? this.deleteMessages.itemsDependingOnThisItem : this.deleteMessages.deletingWillImpactOtherItems, r = this.portal && this.sourceItem ? `${w({ portal: this.portal })}/item.html?id=${this.sourceItem.id}#usage` : void 0, m = () => {
49
+ r && window.open(r, "_blank");
41
50
  };
42
- return o`<calcite-block .heading=${r.replace("{count}", i)} collapsible .label=${s} icon-start=exclamation-mark-triangle><div class="items-directly-using"><div class="impacted-items-labels"><span class="impacted-items-title">${s}</span>${!this.showDependentItems && o`<span class="impacted-items-access-count">${this.deleteMessages.impactedItems.itemsYouHaveAccessTo.replace("{accessCount}", t.format(this.relatedItems.length)).replace("{totalCount}", i)}</span>` || ""}</div><calcite-button appearance=transparent icon-end=launch @click=${n}>${this.deleteMessages.impactedItems["View usage"]}</calcite-button></div><calcite-list .label=${s}>${this.relatedItems.slice(0, m).map((l) => f({ item: l, portal: this.portal, user: this.user, lang: this.messages._lang, modifiedLabel: this.browserMessages.filterDate.modified, access: { level: l.access, groupIds: l.id ? this.itemGroups[l.id] : void 0 } }))}</calcite-list>${this.relatedItems.length > m && o`<calcite-button class="view-full-list" appearance=transparent icon-end=launch @click=${n}>${this.deleteMessages.impactedItems["View full list"]}</calcite-button>` || ""}</calcite-block>`;
51
+ return o`<calcite-block .heading=${t.replace("{count}", a)} collapsible .label=${i} icon-start=exclamation-mark-triangle><div class="items-directly-using"><div class="impacted-items-labels"><span class="impacted-items-title">${i}</span>${!this.showDependentItems && o`<span class="impacted-items-access-count">${this.deleteMessages.impactedItems.itemsYouHaveAccessTo.replace("{accessCount}", s.format(this.relatedItems.length)).replace("{totalCount}", a)}</span>` || ""}</div><calcite-button appearance=transparent icon-end=launch @click=${m}>${this.deleteMessages.impactedItems["View usage"]}</calcite-button></div><calcite-list .label=${i}>${this.relatedItems.slice(0, c).map((l) => f({ item: l, owner: this.itemOwners[l.owner], portal: this.portal, user: this.user, lang: this.messages._lang, modifiedLabel: this.browserMessages.filterDate.modified, access: { level: l.access, groupIds: l.id ? this.itemGroups[l.id] : void 0 } }))}</calcite-list>${this.relatedItems.length > c && o`<calcite-button class="view-full-list" appearance=transparent icon-end=launch @click=${m}>${this.deleteMessages.impactedItems["View full list"]}</calcite-button>` || ""}</calcite-block>`;
43
52
  }
44
53
  }
45
- d("arcgis-portal-review-related-items", v);
54
+ p("arcgis-portal-review-related-items", v);
46
55
  export {
47
56
  v as ArcgisPortalReviewRelatedItems
48
57
  };
@@ -1,22 +1,22 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
2
  import { html as i } from "lit";
3
- import { formatDate as u } from "@arcgis/core/intl.js";
4
- import { nothing as y } from "@arcgis/lumina";
5
- import { g as b } from "../../chunks/user2.js";
6
- import { b as I } from "../../chunks/url.js";
7
- function D({ item: e, portal: c, user: t, lang: m, modifiedLabel: o, showAccessInfo: d = !0, access: s = { level: e.access }, relatedItemsCount: _ = 0, relatedItemsCountTitle: a, onRelatedItemsClick: $ }) {
8
- const n = "inRecycleBin" in e && e.inRecycleBin === !0, l = c && !n ? `${I({ portal: c })}/item.html?id=${e.id}` : void 0, r = e.title ?? "", p = u(e.modified ?? void 0, { dateStyle: "medium" }), v = o ? o.replace("${date}", p ?? "") : p ?? "", g = {
3
+ import { formatDate as y } from "@arcgis/core/intl.js";
4
+ import { nothing as b } from "@arcgis/lumina";
5
+ import { g as I } from "../../chunks/user2.js";
6
+ import { b as B } from "../../chunks/url.js";
7
+ function S({ item: e, owner: n, portal: c, user: o, lang: d, modifiedLabel: l, showAccessInfo: _ = !0, access: t = { level: e.access }, relatedItemsCount: $ = 0, relatedItemsCountTitle: s, onRelatedItemsClick: v }) {
8
+ const a = "inRecycleBin" in e && e.inRecycleBin === !0, r = c && !a ? `${B({ portal: c })}/item.html?id=${e.id}` : void 0, p = e.title ?? "", m = y(e.modified ?? void 0, { dateStyle: "medium" }), g = l ? l.replace("${date}", m ?? "") : m ?? "", h = {
9
9
  public: "globe",
10
10
  private: "user",
11
11
  org: "organization",
12
12
  shared: "user"
13
- }[s.level], h = !!s.groupIds?.length || s.level === "shared";
14
- return i`<calcite-list-item .label=${r} @calciteListItemSelect=${() => {
15
- l && window.open(l, "_blank", "noopener,noreferrer");
16
- }}><span slot=content-start><arcgis-portal-item-type .item=${e} .portal=${c} .user=${t} hide-text></arcgis-portal-item-type></span><div slot=content class="item"><div class="item__content"><span class="item__title">${r}</span><div class="item__details"><span class="item__type"><arcgis-portal-item-type .item=${e} .user=${t} .portal=${c} scale=s hide-icon></arcgis-portal-item-type></span>|<span class="item__details-owner">${b(t, m) ?? e.owner}</span>|<span class="item__details-modified">${v}</span></div></div></div><div slot=content-end class="item__content-end">${n && i`<calcite-icon class="item__status-icon" icon=recycle-bin scale=s></calcite-icon>` || ""}${_ > 0 && i`<calcite-chip .label=${a} title=${a ?? y} icon=launch @click=${(f) => {
17
- f.stopPropagation(), $?.();
18
- }}>${a}</calcite-chip>` || ""}${d && !n && i`<span class="item__access"><calcite-icon .icon=${g} scale=s class="item__access-icon"></calcite-icon>${h && i`<calcite-icon icon=plus scale=s></calcite-icon><calcite-icon icon=group scale=s class="item__access-icon"></calcite-icon>` || ""}</span>` || ""}</div></calcite-list-item>`;
13
+ }[t.level], f = !!t.groupIds?.length || t.level === "shared";
14
+ return i`<calcite-list-item .label=${p} @calciteListItemSelect=${() => {
15
+ r && window.open(r, "_blank", "noopener,noreferrer");
16
+ }}><span slot=content-start><arcgis-portal-item-type .item=${e} .portal=${c} .user=${o} hide-text></arcgis-portal-item-type></span><div slot=content class="item"><div class="item__content"><span class="item__title">${p}</span><div class="item__details"><span class="item__type"><arcgis-portal-item-type .item=${e} .user=${o} .portal=${c} scale=s hide-icon></arcgis-portal-item-type></span>|<span class="item__details-owner">${n ? I(n, d) : e.owner}</span>|<span class="item__details-modified">${g}</span></div></div></div><div slot=content-end class="item__content-end">${a && i`<calcite-icon class="item__status-icon" icon=recycle-bin scale=s></calcite-icon>` || ""}${$ > 0 && i`<calcite-chip .label=${s} title=${s ?? b} icon=launch @click=${(u) => {
17
+ u.stopPropagation(), v?.();
18
+ }}>${s}</calcite-chip>` || ""}${_ && !a && i`<span class="item__access"><calcite-icon .icon=${h} scale=s class="item__access-icon"></calcite-icon>${f && i`<calcite-icon icon=plus scale=s></calcite-icon><calcite-icon icon=group scale=s class="item__access-icon"></calcite-icon>` || ""}</span>` || ""}</div></calcite-list-item>`;
19
19
  }
20
20
  export {
21
- D as RelatedItemsListItem
21
+ S as RelatedItemsListItem
22
22
  };