@arcgis/portal-components 6.0.0-next.26 → 6.0.0-next.28

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.
Files changed (65) hide show
  1. package/dist/cdn/{4ECHLPCD.js → 2IUBTBWG.js} +1 -1
  2. package/dist/cdn/365ICWHN.js +2 -0
  3. package/dist/cdn/{MR5SS4OM.js → 4PL5CXXD.js} +1 -1
  4. package/dist/cdn/5BVGWSPJ.js +2 -0
  5. package/dist/cdn/{QO4PCFMS.js → 5MZ64QM7.js} +1 -1
  6. package/dist/cdn/{TDEWNR3G.js → 76IANSI7.js} +1 -1
  7. package/dist/cdn/{EYT56PJR.js → BBCW2IEJ.js} +1 -1
  8. package/dist/cdn/{BF2UYS7O.js → CFNR4XS2.js} +5 -1
  9. package/dist/cdn/{FPPWQJ3A.js → EQZYUMUN.js} +1 -1
  10. package/dist/cdn/{5ECRUKK7.js → H6OQOEHS.js} +1 -1
  11. package/dist/cdn/{MNVTSX5S.js → ITGOCCZZ.js} +1 -1
  12. package/dist/cdn/{X7FH637G.js → JCB4PVDP.js} +1 -1
  13. package/dist/cdn/{J2NLZZS5.js → JKL64SEU.js} +1 -1
  14. package/dist/cdn/{DL6SZRQF.js → K26H2GTP.js} +1 -1
  15. package/dist/cdn/{3I4FNHJA.js → L3A3L7FY.js} +1 -1
  16. package/dist/cdn/{ZRYIOQ6X.js → OW67EEOH.js} +1 -1
  17. package/dist/cdn/PMYBZS3I.js +2 -0
  18. package/dist/cdn/PU7NVVTN.js +2 -0
  19. package/dist/cdn/{2SKPQQUU.js → R3IQ7OYN.js} +11 -11
  20. package/dist/cdn/R5LNWMD4.js +2 -0
  21. package/dist/cdn/{4PH6HGWP.js → SJEBYKDJ.js} +1 -1
  22. package/dist/cdn/{X4S3XDRU.js → TZD7GAZQ.js} +1 -1
  23. package/dist/cdn/{A7S3QTKE.js → VDBJFYFR.js} +1 -1
  24. package/dist/cdn/{35CVNRRS.js → VZPUDARW.js} +1 -1
  25. package/dist/cdn/{Y5VUMGKH.js → WFPUAEJQ.js} +1 -1
  26. package/dist/cdn/{FZ2JL33P.js → WQYXPOEP.js} +1 -1
  27. package/dist/cdn/{5KVVZFNP.js → X4EHFUD4.js} +1 -1
  28. package/dist/cdn/{RPBDWBVZ.js → XMFA6QY6.js} +1 -1
  29. package/dist/cdn/{GI3M7WJB.js → Z55T6COF.js} +1 -1
  30. package/dist/cdn/ZJQ55GQG.js +2 -0
  31. package/dist/cdn/index.js +1 -1
  32. package/dist/chunks/portalEntitySelection.js +40 -33
  33. package/dist/chunks/string.js +8 -4
  34. package/dist/chunks/user.js +67 -53
  35. package/dist/components/arcgis-portal-ai-assistant/customElement.js +32 -28
  36. package/dist/components/arcgis-portal-ai-assistant/tools/groups.d.ts +28 -0
  37. package/dist/components/arcgis-portal-ai-assistant/tools/users.d.ts +28 -0
  38. package/dist/components/arcgis-portal-ai-assistant/types/portalEntityTools.d.ts +6 -1
  39. package/dist/components/arcgis-portal-ai-assistant-interrupt/customElement.js +16 -12
  40. package/dist/components/arcgis-portal-delete-items/customElement.js +1 -1
  41. package/dist/components/arcgis-portal-entity-picker/customElement.d.ts +25 -8
  42. package/dist/components/arcgis-portal-entity-picker/customElement.js +135 -126
  43. package/dist/components/arcgis-portal-navigation/index.js +1 -1
  44. package/dist/components/arcgis-portal-review-related-items/customElement.js +16 -15
  45. package/dist/docs/api.json +1 -1
  46. package/dist/docs/docs.json +1 -1
  47. package/dist/docs/vscode.html-custom-data.json +1 -1
  48. package/dist/docs/web-types.json +1 -1
  49. package/dist/index.d.ts +2 -0
  50. package/dist/index.js +250 -105
  51. package/dist/loader.js +4 -4
  52. package/dist/services/group.d.ts +17 -0
  53. package/dist/types/item.d.ts +3 -3
  54. package/dist/types/lumina.d.ts +4 -4
  55. package/dist/types/portalEntityPicker.d.ts +3 -0
  56. package/dist/types/preact.d.ts +4 -4
  57. package/dist/types/react.d.ts +4 -4
  58. package/dist/types/stencil.d.ts +4 -4
  59. package/package.json +7 -7
  60. package/dist/cdn/6F7D6KWK.js +0 -2
  61. package/dist/cdn/773J2TPA.js +0 -2
  62. package/dist/cdn/DELNTRCT.js +0 -2
  63. package/dist/cdn/HLTKV7DS.js +0 -2
  64. package/dist/cdn/JZHSNH6C.js +0 -2
  65. package/dist/cdn/TIMYD2HM.js +0 -2
@@ -1,45 +1,45 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
2
  import { c as P } from "../../chunks/runtime.js";
3
3
  import { css as O, html as p } from "lit";
4
- import { keyed as y } from "lit/directives/keyed.js";
5
- import { LitElement as F, createEvent as L, safeStyleMap as E } from "@arcgis/lumina";
6
- import { createRef as T, ref as b } from "lit/directives/ref.js";
7
- import { u as x } from "../../chunks/useT9n.js";
8
- import { isAbortError as k } from "@arcgis/core/core/promiseUtils.js";
9
- import w from "@arcgis/core/portal/PortalQueryResult.js";
10
- import { c as G, a as S } from "../../chunks/string.js";
11
- import { s as M } from "../../chunks/groups2.js";
12
- import { s as z } from "../../chunks/dom.js";
13
- import { g as U } from "../../chunks/portal.js";
14
- import { r as D } from "../../chunks/request.js";
4
+ import { keyed as v } from "lit/directives/keyed.js";
5
+ import { LitElement as D, createEvent as F, safeStyleMap as L } from "@arcgis/lumina";
6
+ import { createRef as k, ref as R } from "lit/directives/ref.js";
7
+ import { u as q } from "../../chunks/useT9n.js";
8
+ import { isAbortError as A } from "@arcgis/core/core/promiseUtils.js";
9
+ import C from "@arcgis/core/portal/PortalQueryResult.js";
10
+ import { c as x, q as T, a as I } from "../../chunks/string.js";
11
+ import { s as E } from "../../chunks/groups2.js";
12
+ import { s as G } from "../../chunks/dom.js";
13
+ import { g as M } from "../../chunks/portal.js";
14
+ import { r as z } from "../../chunks/request.js";
15
15
  import "../arcgis-portal-group-card/customElement.js";
16
16
  import "../arcgis-portal-item-card/customElement.js";
17
- import { makeGenericController as q } from "@arcgis/lumina/controllers";
17
+ import { makeGenericController as U } from "@arcgis/lumina/controllers";
18
18
  import { S as N } from "../../chunks/utils.js";
19
19
  import "../arcgis-portal-user-avatar/customElement.js";
20
- const B = [
20
+ const W = [
21
21
  "esri_livingatlas",
22
22
  "esri_boundaries",
23
23
  "esri_demographics",
24
24
  "esri_nav",
25
25
  "esri_webstyles"
26
26
  ];
27
- function W(a) {
28
- return z(a.trim()).replace(/[!*+\-&|()[\]{}^~?:"\\]/gu, "\\$&");
27
+ function B(n) {
28
+ return G(n.trim()).replace(/[!*+\-&|()[\]{}^~?:"\\]/gu, "\\$&");
29
29
  }
30
30
  async function Q({
31
- portal: a,
31
+ portal: n,
32
32
  searchTerm: e,
33
33
  num: t = 100,
34
- query: i,
34
+ query: r,
35
35
  signal: o
36
36
  }) {
37
- const r = W(e), s = `${U(a)}portals/self/users/search`, c = [r ? `(${r})` : void 0, i?.trim() ? `(${i.trim()})` : void 0];
38
- a.isPortal && c.push(...B.map((d) => `-username:${d}`));
39
- const u = s.includes("www.arcgis.com") && a.isPortal ? { disableIdentityLookup: !0, addTokenManually: !1 } : {};
40
- return await D({
41
- url: s,
42
- portal: a,
37
+ const a = B(e), i = `${M(n)}portals/self/users/search`, c = [a ? `(${a})` : void 0, r?.trim() ? `(${r.trim()})` : void 0];
38
+ n.isPortal && c.push(...W.map((m) => `-username:${m}`));
39
+ const u = i.includes("www.arcgis.com") && n.isPortal ? { disableIdentityLookup: !0, addTokenManually: !1 } : {};
40
+ return await z({
41
+ url: i,
42
+ portal: n,
43
43
  params: {
44
44
  num: Math.min(Math.max(t, 1), 100),
45
45
  q: c.filter(Boolean).join(" AND "),
@@ -48,47 +48,46 @@ async function Q({
48
48
  options: { ...u, ...o ? { signal: o } : {} }
49
49
  });
50
50
  }
51
- function R(a, e) {
51
+ function b(n, e) {
52
52
  const t = ["all"];
53
- return e === "user" || !a.user?.username || (e === "item" && t.push("myContent"), t.push("myGroups"), a.user.orgId && t.push("myOrganization")), t;
53
+ return e === "user" || !n.user?.username || (e === "item" && t.push("myContent"), t.push("myGroups"), n.user.orgId && t.push("myOrganization")), t;
54
54
  }
55
- function v(a) {
56
- return `"${a.replace(/[\\"]/gu, "\\$&")}"`;
57
- }
58
- async function j(a) {
59
- const { portal: e, entityType: t, searchTerm: i, signal: o } = a, r = Math.min(Math.max(a.num ?? 10, 1), 100), s = a.scope ?? "all";
55
+ async function j(n) {
56
+ const { portal: e, entityType: t, searchTerm: r, signal: o } = n, a = Math.min(Math.max(n.num ?? 10, 1), 100), i = n.scope ?? "all";
60
57
  try {
61
- if (o?.throwIfAborted(), !R(e, t).includes(s))
62
- throw new Error(`Search scope "${s}" is unavailable for ${t} searches.`);
58
+ if (o?.throwIfAborted(), !b(e, t).includes(i))
59
+ throw new Error(`Search scope "${i}" is unavailable for ${t} searches.`);
60
+ if (!r.trim() && !n.query?.trim())
61
+ return {};
63
62
  if (t === "user")
64
63
  return {
65
64
  result: {
66
65
  entityType: t,
67
66
  result: await Q({
68
67
  portal: e,
69
- searchTerm: i,
70
- num: r,
71
- query: a.query,
68
+ searchTerm: r,
69
+ num: a,
70
+ query: n.query,
72
71
  ...o ? { signal: o } : {}
73
72
  })
74
73
  }
75
74
  };
76
- const c = G(i);
77
- if (!c)
75
+ const c = x(r);
76
+ if (!c && !n.query?.trim())
78
77
  return {};
79
78
  let l;
80
79
  const u = e.user;
81
- if (s === "myContent" && u)
82
- l = `owner:${v(u.username)}`;
83
- else if (s === "myOrganization" && u?.orgId)
84
- l = `orgid:${v(u.orgId)}`;
85
- else if (s === "myGroups" && u) {
80
+ if (i === "myContent" && u)
81
+ l = `owner:${T(u.username)}`;
82
+ else if (i === "myOrganization" && u?.orgId)
83
+ l = `orgid:${T(u.orgId)}`;
84
+ else if (i === "myGroups" && u) {
86
85
  if (t === "group") {
87
- const n = await M(
86
+ const s = await E(
88
87
  e,
89
88
  {
90
- num: r,
91
- q: S(c, a.query),
89
+ num: a,
90
+ q: I(c, n.query),
92
91
  searchUserAccess: "groupMember",
93
92
  searchUserName: u.username
94
93
  },
@@ -97,88 +96,98 @@ async function j(a) {
97
96
  return {
98
97
  result: {
99
98
  entityType: t,
100
- result: new w({ results: n.results, total: n.total })
99
+ result: new C({ results: s.results, total: s.total })
101
100
  }
102
101
  };
103
102
  }
104
- const m = await u.fetchGroups();
105
- if (o?.throwIfAborted(), !m.length)
103
+ const y = await u.fetchGroups();
104
+ if (o?.throwIfAborted(), !y.length)
106
105
  return {
107
- result: { entityType: t, result: new w({ results: [], total: 0 }) }
106
+ result: { entityType: t, result: new C({ results: [], total: 0 }) }
108
107
  };
109
- l = m.map(({ id: n }) => {
110
- if (!n)
108
+ l = y.map(({ id: s }) => {
109
+ if (!s)
111
110
  throw new Error("A membership group is missing its ID.");
112
- return `group:${v(n)}`;
111
+ return `group:${T(s)}`;
113
112
  }).join(" OR ");
114
113
  }
115
- const d = {
116
- num: r,
117
- query: S(c, a.query, l)
114
+ const m = {
115
+ num: a,
116
+ query: I(c, n.query, l)
118
117
  };
119
- return t === "group" ? { result: { entityType: t, result: await e.queryGroups(d, { signal: o }) } } : { result: { entityType: t, result: await e.queryItems(d, { signal: o }) } };
118
+ return t === "group" ? { result: { entityType: t, result: await e.queryGroups(m, { signal: o }) } } : { result: { entityType: t, result: await e.queryItems(m, { signal: o }) } };
120
119
  } catch (c) {
121
- if (o?.aborted || k(c))
120
+ if (o?.aborted || A(c))
122
121
  throw c;
123
122
  return console.error(c), { error: { code: "unhandledError" } };
124
123
  }
125
124
  }
126
- const H = (a) => q((e, t) => {
127
- let i = {
125
+ const H = (n) => U((e, t) => {
126
+ let r = {
128
127
  searchTerm: "",
129
128
  scope: "all",
129
+ searchActive: !1,
130
130
  isSearching: !1,
131
131
  searchFailed: !1
132
- }, o, r;
133
- const s = (n) => {
134
- i = { ...i, ...n }, t.exports = { ...i, setSearchTerm: d, setScope: m };
132
+ }, o, a;
133
+ const i = (s) => {
134
+ r = { ...r, ...s }, t.exports = { ...r, setSearchTerm: m, setScope: y };
135
135
  }, c = () => {
136
- o !== void 0 && (clearTimeout(o), o = void 0), r?.abort(), r = void 0;
137
- }, l = async (n, h) => {
138
- const { entityType: g, num: C, portal: I, query: _ } = e, { scope: $ } = i;
136
+ o !== void 0 && (clearTimeout(o), o = void 0), a?.abort(), a = void 0;
137
+ }, l = async (s, h) => {
138
+ const { entityType: d, num: f, portal: g, query: S } = e, { scope: w } = r;
139
139
  try {
140
- const { error: f, result: A } = await j({
141
- portal: I,
142
- entityType: g,
143
- searchTerm: n,
144
- num: C,
145
- query: _,
140
+ const { error: $, result: _ } = await j({
141
+ portal: g,
142
+ entityType: d,
143
+ searchTerm: s,
144
+ num: f,
145
+ query: S,
146
146
  signal: h,
147
- ...$ === "all" ? {} : { scope: $ }
147
+ ...w === "all" ? {} : { scope: w }
148
148
  });
149
- h.aborted || s({ searchFailed: !!f, searchResult: A, isSearching: !1 });
150
- } catch (f) {
151
- !h.aborted && !k(f) && (console.error(f), s({ searchFailed: !0, searchResult: void 0, isSearching: !1 }));
149
+ h.aborted || i({ searchFailed: !!$, searchResult: _, isSearching: !1 });
150
+ } catch ($) {
151
+ !h.aborted && !A($) && (console.error($), i({ searchFailed: !0, searchResult: void 0, isSearching: !1 }));
152
152
  }
153
- }, u = (n) => {
154
- const h = n.searchTerm.trim();
155
- if (c(), s({ ...n, searchFailed: !1, searchResult: void 0, isSearching: !!h }), a(!!h), h) {
156
- r = new AbortController();
157
- const { signal: g } = r;
153
+ }, u = (s) => {
154
+ const h = s.searchTerm.trim(), d = b(e.portal, e.entityType).includes(s.scope), f = !!(h || e.query?.trim()), g = !d || f;
155
+ if (c(), i({
156
+ ...s,
157
+ searchActive: g,
158
+ searchFailed: !d,
159
+ searchResult: void 0,
160
+ isSearching: d && f
161
+ }), n(g), d && f) {
162
+ a = new AbortController();
163
+ const { signal: S } = a;
158
164
  o = setTimeout(() => {
159
- o = void 0, l(h, g);
165
+ o = void 0, l(h, S);
160
166
  }, N);
161
167
  }
162
- }, d = (n) => {
163
- u({ searchTerm: n, scope: i.scope });
164
- }, m = (n) => {
165
- n !== i.scope && u({ searchTerm: i.searchTerm, scope: n });
168
+ }, m = (s) => {
169
+ u({ searchTerm: s, scope: r.scope });
170
+ }, y = (s) => {
171
+ !e.scopeSelectionDisabled && s !== r.scope && u({ searchTerm: r.searchTerm, scope: s });
166
172
  };
167
- return t.onUpdate((n) => {
168
- (n.has("portal") || n.has("entityType") || n.has("query") || n.has("num") || n.has("initialSearchTerm")) && u({
169
- searchTerm: e.initialSearchTerm,
170
- scope: n.has("portal") || n.has("entityType") ? "all" : i.scope
173
+ return t.onUpdate((s) => {
174
+ const h = s.has("portal") || s.has("entityType") || s.has("query") || s.has("num") || s.has("initialSearchTerm"), d = s.has("portal") || s.has("entityType") || s.has("initialScope") || s.has("scopeSelectionDisabled");
175
+ (h || d) && u({
176
+ searchTerm: h ? e.initialSearchTerm : r.searchTerm,
177
+ scope: d ? e.initialScope : r.scope
171
178
  });
172
- }), t.onDisconnected(c), { ...i, setSearchTerm: d, setScope: m };
179
+ }), t.onConnected(() => {
180
+ r.isSearching && u({ searchTerm: r.searchTerm, scope: r.scope });
181
+ }), t.onDisconnected(c), { ...r, setSearchTerm: m, setScope: y };
173
182
  }), K = O`:host{display:block;inline-size:100%}.entity-picker{display:flex;flex-direction:column;gap:.5rem;min-inline-size:16rem}.entity-picker__results{max-block-size:var(--arcgis-portal-entity-picker-results-max-block-size, 22rem);overflow-y:auto}.entity-picker__cards{display:flex;flex-direction:column;gap:.5rem}.entity-picker__status{color:var(--calcite-color-text-3);font-size:.875rem;margin:0;padding:.75rem}.entity-picker__selection{align-items:center;display:var(--arcgis-portal-entity-picker-selection-display, flex);gap:.5rem}.entity-picker__selection-label{flex:1;min-inline-size:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.entity-picker__input{inline-size:100%}`;
174
- class V extends F {
183
+ class V extends D {
175
184
  constructor() {
176
- super(...arguments), this._messages = x({ blocking: !0, name: "portal-entity-picker" }), this.inputRef = T(), this.inputContainerRef = T(), this.resizeObserver = null, this.searchController = H((e) => {
185
+ super(...arguments), this._messages = q({ blocking: !0, name: "portal-entity-picker" }), this.inputRef = k(), this.inputContainerRef = k(), this.resizeObserver = null, this.searchController = H((e) => {
177
186
  (!e || this.mode === "popover") && (this.popoverOpen = e);
178
- })(this), this.popoverOpen = !1, this.popoverWidth = 0, this.entityType = "group", this.mode = "inline", this.selectionMode = "single", this.selected = null, this.initialSearchTerm = "", this.num = 10, this.arcgisSelectionChange = L();
187
+ })(this), this.popoverOpen = !1, this.popoverWidth = 0, this.entityType = "group", this.mode = "inline", this.selectionMode = "single", this.selected = null, this.initialScope = "all", this.scopeSelectionDisabled = !1, this.initialSearchTerm = "", this.num = 10, this.arcgisSelectionChange = F();
179
188
  }
180
189
  static {
181
- this.properties = { popoverOpen: 16, popoverWidth: 16, portal: 0, entityType: 1, mode: 1, selectionMode: 1, selected: 0, query: 1, initialSearchTerm: 1, num: 9, icon: 1, messageOverrides: 0 };
190
+ this.properties = { popoverOpen: 16, popoverWidth: 16, portal: 0, entityType: 1, mode: 1, selectionMode: 1, selected: 0, query: 1, initialScope: 1, scopeSelectionDisabled: 5, initialSearchTerm: 1, num: 9, icon: 1, messageOverrides: 0 };
182
191
  }
183
192
  static {
184
193
  this.styles = K;
@@ -202,7 +211,7 @@ class V extends F {
202
211
  this.updatePopoverWidth(), !(typeof ResizeObserver > "u" || !this.inputContainerRef.value) && (this.resizeObserver = new ResizeObserver(() => this.updatePopoverWidth()), this.resizeObserver.observe(this.inputContainerRef.value));
203
212
  }
204
213
  willUpdate(e) {
205
- e.has("mode") && this.mode === "inline" && (this.popoverOpen = !1);
214
+ this.hasUpdated && this.selected && ["portal", "entityType", "query", "initialScope", "scopeSelectionDisabled"].some((t) => e.has(t)) && this.arcgisSelectionChange.emit(null), e.has("mode") && this.mode === "inline" && (this.popoverOpen = !1);
206
215
  }
207
216
  disconnectedCallback() {
208
217
  this.resizeObserver?.disconnect(), this.resizeObserver = null, super.disconnectedCallback();
@@ -216,7 +225,7 @@ class V extends F {
216
225
  this.arcgisSelectionChange.emit(e), this.mode === "popover" && this.togglePicker(!1);
217
226
  }
218
227
  getFocusableResults() {
219
- const e = Array.from(this.renderRoot.querySelector('slot[name="list-start"]')?.assignedElements({ flatten: !0 }) ?? []).filter((i) => i instanceof HTMLElement && (i.tagName === "CALCITE-LIST-ITEM" || i.tabIndex >= 0)), t = Array.from(this.renderRoot.querySelectorAll("calcite-list-item, arcgis-portal-group-card, arcgis-portal-item-card"));
228
+ const e = Array.from(this.renderRoot.querySelector('slot[name="list-start"]')?.assignedElements({ flatten: !0 }) ?? []).filter((r) => r instanceof HTMLElement && (r.tagName === "CALCITE-LIST-ITEM" || r.tabIndex >= 0)), t = Array.from(this.renderRoot.querySelectorAll("calcite-list-item, arcgis-portal-group-card, arcgis-portal-item-card"));
220
229
  return [...e, ...t];
221
230
  }
222
231
  async focusResult(e) {
@@ -238,89 +247,89 @@ class V extends F {
238
247
  const t = this.getFocusableResults();
239
248
  if (!t.length)
240
249
  return;
241
- const i = (e + t.length) % t.length;
242
- await this.focusResult(t[i]);
250
+ const r = (e + t.length) % t.length;
251
+ await this.focusResult(t[r]);
243
252
  }
244
253
  handleResultsKeyDown(e) {
245
254
  if (e.defaultPrevented)
246
255
  return;
247
- const t = this.getFocusableResults(), i = e.composedPath(), o = t.findIndex((s) => i.includes(s));
256
+ const t = this.getFocusableResults(), r = e.composedPath(), o = t.findIndex((i) => r.includes(i));
248
257
  if (o === -1)
249
258
  return;
250
259
  if (this.mode === "inline" && (e.key === "ArrowDown" || e.key === "ArrowUp")) {
251
260
  e.preventDefault(), this.focusResultAt(o + (e.key === "ArrowDown" ? 1 : -1));
252
261
  return;
253
262
  }
254
- const r = t[o];
255
- if (r.tagName === "ARCGIS-PORTAL-GROUP-CARD" && (e.key === "Enter" || e.key === " ")) {
263
+ const a = t[o];
264
+ if (a.tagName === "ARCGIS-PORTAL-GROUP-CARD" && (e.key === "Enter" || e.key === " ")) {
256
265
  e.preventDefault();
257
- const { group: s } = r;
258
- this.emitSelection({ entityType: "group", entity: s });
266
+ const { group: i } = a;
267
+ this.emitSelection({ entityType: "group", entity: i });
259
268
  return;
260
269
  }
261
- if (r.tagName === "ARCGIS-PORTAL-ITEM-CARD" && (e.key === "Enter" || e.key === " ")) {
270
+ if (a.tagName === "ARCGIS-PORTAL-ITEM-CARD" && (e.key === "Enter" || e.key === " ")) {
262
271
  e.preventDefault();
263
- const { item: s } = r;
264
- this.emitSelection({ entityType: "item", entity: s });
272
+ const { item: i } = a;
273
+ this.emitSelection({ entityType: "item", entity: i });
265
274
  }
266
275
  }
267
276
  renderScopeSelector() {
268
- const { entityType: e, portal: t, _messages: i } = this, { scope: o } = this.searchController, r = R(t, e);
269
- return r.length <= 1 ? null : p`<calcite-select .label=${i.searchIn} scale=m @calciteSelectChange=${(s) => {
270
- const c = r.find((l) => l === s.target.value);
277
+ const { entityType: e, portal: t, _messages: r } = this, { scope: o } = this.searchController, a = b(t, e);
278
+ return a.length <= 1 ? null : p`<calcite-select .disabled=${this.scopeSelectionDisabled} .label=${r.searchIn} scale=m @calciteSelectChange=${(i) => {
279
+ const c = a.find((l) => l === i.target.value);
271
280
  c && this.searchController.setScope(c);
272
- }}>${r.map((s) => p`<calcite-option .selected=${s === o} .value=${s}>${s === "all" ? e === "item" ? i.allContent : i.allGroups : i[s]}</calcite-option>`)}</calcite-select>`;
281
+ }}>${a.map((i) => p`<calcite-option .selected=${i === o} .value=${i}>${i === "all" ? e === "item" ? r.allContent : r.allGroups : r[i]}</calcite-option>`)}</calcite-select>`;
273
282
  }
274
283
  renderGroup(e) {
275
- return y(e.id, p`<calcite-list-item .label=${e.title || e.id || ""} .description=${[e.owner, e.access].filter(Boolean).join(" · ")} .selected=${this.selected?.entityType === "group" && this.selected.entity.id === e.id} @calciteListItemSelect=${() => this.emitSelection({ entityType: "group", entity: e })}><calcite-avatar slot=content-start .fullName=${e.title ?? void 0} .thumbnail=${e.thumbnailUrl ?? void 0} scale=m></calcite-avatar></calcite-list-item>`);
284
+ return v(e.id, p`<calcite-list-item .label=${e.title || e.id || ""} .description=${[e.owner, e.access].filter(Boolean).join(" · ")} .selected=${this.selected?.entityType === "group" && this.selected.entity.id === e.id} @calciteListItemSelect=${() => this.emitSelection({ entityType: "group", entity: e })}><calcite-avatar slot=content-start .fullName=${e.title ?? void 0} .thumbnail=${e.thumbnailUrl ?? void 0} scale=m></calcite-avatar></calcite-list-item>`);
276
285
  }
277
286
  renderInlineGroup(e) {
278
- return y(e.id, p`<arcgis-portal-group-card .group=${e} .portal=${this.portal} .preview=${this.selectionMode === "none" ? "top" : void 0} .selected=${this.selected?.entityType === "group" && this.selected.entity.id === e.id} .selection=${this.selectionMode} @arcgisGroupBrowserCardPreview=${() => this.emitSelection({ entityType: "group", entity: e })} @arcgisGroupCardSelect=${({ detail: t }) => {
287
+ return v(e.id, p`<arcgis-portal-group-card .group=${e} .portal=${this.portal} .preview=${this.selectionMode === "none" ? "top" : void 0} .selected=${this.selected?.entityType === "group" && this.selected.entity.id === e.id} .selection=${this.selectionMode} @arcgisGroupBrowserCardPreview=${() => this.emitSelection({ entityType: "group", entity: e })} @arcgisGroupCardSelect=${({ detail: t }) => {
279
288
  t.selected && this.emitSelection({ entityType: "group", entity: t.group });
280
289
  }} .user=${this.portal.user ?? void 0} view=compact></arcgis-portal-group-card>`);
281
290
  }
282
291
  renderItem(e) {
283
- return y(e.id, p`<calcite-list-item .label=${e.title || e.id || ""} .description=${[e.type, e.owner].filter(Boolean).join(" · ")} .selected=${this.selected?.entityType === "item" && this.selected.entity.id === e.id} @calciteListItemSelect=${() => this.emitSelection({ entityType: "item", entity: e })}><calcite-avatar slot=content-start .fullName=${e.title ?? void 0} .thumbnail=${e.thumbnailUrl ?? void 0} scale=m></calcite-avatar></calcite-list-item>`);
292
+ return v(e.id, p`<calcite-list-item .label=${e.title || e.id || ""} .description=${[e.type, e.owner].filter(Boolean).join(" · ")} .selected=${this.selected?.entityType === "item" && this.selected.entity.id === e.id} @calciteListItemSelect=${() => this.emitSelection({ entityType: "item", entity: e })}><calcite-avatar slot=content-start .fullName=${e.title ?? void 0} .thumbnail=${e.thumbnailUrl ?? void 0} scale=m></calcite-avatar></calcite-list-item>`);
284
293
  }
285
294
  renderInlineItem(e) {
286
- return y(e.id, p`<arcgis-portal-item-card .item=${e} .portal=${this.portal} .preview=${this.selectionMode === "none" ? "top" : void 0} .selected=${this.selected?.entityType === "item" && this.selected.entity.id === e.id} .selection=${this.selectionMode} @arcgisItemBrowserCardPreview=${() => this.emitSelection({ entityType: "item", entity: e })} @arcgisItemCardSelect=${({ detail: t }) => {
295
+ return v(e.id, p`<arcgis-portal-item-card .item=${e} .portal=${this.portal} .preview=${this.selectionMode === "none" ? "top" : void 0} .selected=${this.selected?.entityType === "item" && this.selected.entity.id === e.id} .selection=${this.selectionMode} @arcgisItemBrowserCardPreview=${() => this.emitSelection({ entityType: "item", entity: e })} @arcgisItemCardSelect=${({ detail: t }) => {
287
296
  t.selected && this.emitSelection({ entityType: "item", entity: t.item });
288
297
  }} .user=${this.portal.user ?? void 0} view=list></arcgis-portal-item-card>`);
289
298
  }
290
299
  renderUser(e) {
291
- return y(e.username, p`<calcite-list-item .label=${e.fullName || e.username} .description=${e.username} .selected=${this.selected?.entityType === "user" && this.selected.entity.username === e.username} @calciteListItemSelect=${() => this.emitSelection({ entityType: "user", entity: e })}><arcgis-portal-user-avatar slot=content-start .portal=${this.portal} .user=${e} scale=m></arcgis-portal-user-avatar></calcite-list-item>`);
300
+ return v(e.username, p`<calcite-list-item .label=${e.fullName || e.username} .description=${e.username} .selected=${this.selected?.entityType === "user" && this.selected.entity.username === e.username} @calciteListItemSelect=${() => this.emitSelection({ entityType: "user", entity: e })}><arcgis-portal-user-avatar slot=content-start .portal=${this.portal} .user=${e} scale=m></arcgis-portal-user-avatar></calcite-list-item>`);
292
301
  }
293
302
  renderSearchResults() {
294
- const { entityType: e, _messages: t } = this, { isSearching: i, searchFailed: o, searchResult: r, searchTerm: s } = this.searchController;
295
- if (!s.trim())
303
+ const { entityType: e, _messages: t } = this, { isSearching: r, searchActive: o, searchFailed: a, searchResult: i } = this.searchController;
304
+ if (!o)
296
305
  return null;
297
- if (i)
306
+ if (r)
298
307
  return p`<div role=status><calcite-loader .label=${t.searching} scale=s></calcite-loader></div>`;
299
- if (o)
308
+ if (a)
300
309
  return p`<p class="entity-picker__status" role=alert>${t.searchFailed}</p>`;
301
- if (!(r?.result.results ?? []).length) {
310
+ if (!(i?.result.results ?? []).length) {
302
311
  const l = e === "group" ? t.noGroupsFound : e === "item" ? t.noItemsFound : t.noUsersFound;
303
312
  return p`<p class="entity-picker__status" role=status>${l}</p>`;
304
313
  }
305
- return this.mode === "inline" && r?.entityType === "group" ? p`<div class="entity-picker__cards"><slot name=list-start></slot>${r.result.results.map((l) => this.renderInlineGroup(l))}</div>` : this.mode === "inline" && r?.entityType === "item" ? p`<div class="entity-picker__cards"><slot name=list-start></slot>${r.result.results.map((l) => this.renderInlineItem(l))}</div>` : p`<calcite-list interaction-mode=interactive .label=${this.searchLabel} .selectionMode=${this.mode === "inline" && this.selectionMode === "single" ? "single-persist" : "none"}><slot name=list-start></slot>${r?.entityType === "group" ? r.result.results.map((l) => this.renderGroup(l)) : r?.entityType === "item" ? r.result.results.map((l) => this.renderItem(l)) : r?.result.results.map((l) => this.renderUser(l))}</calcite-list>`;
314
+ return this.mode === "inline" && i?.entityType === "group" ? p`<div class="entity-picker__cards"><slot name=list-start></slot>${i.result.results.map((l) => this.renderInlineGroup(l))}</div>` : this.mode === "inline" && i?.entityType === "item" ? p`<div class="entity-picker__cards"><slot name=list-start></slot>${i.result.results.map((l) => this.renderInlineItem(l))}</div>` : p`<calcite-list interaction-mode=interactive .label=${this.searchLabel} .selectionMode=${this.mode === "inline" && this.selectionMode === "single" ? "single-persist" : "none"}><slot name=list-start></slot>${i?.entityType === "group" ? i.result.results.map((l) => this.renderGroup(l)) : i?.entityType === "item" ? i.result.results.map((l) => this.renderItem(l)) : i?.result.results.map((l) => this.renderUser(l))}</calcite-list>`;
306
315
  }
307
316
  renderPicker(e = !0) {
308
- return p`<div class="entity-picker">${this.selectedLabel && p`<div class="entity-picker__selection"><span class="entity-picker__selection-label">${this.selectedLabel}</span><calcite-button appearance=transparent icon-start=x kind=neutral .label=${this._messages.clearSelection} @click=${() => this.arcgisSelectionChange.emit(null)} scale=s></calcite-button></div>` || ""}${this.renderScopeSelector()}<div class="entity-picker__input" ${b(this.inputContainerRef)}><calcite-input .icon=${this.icon} .clearable=${this.mode === "inline"} .label=${this.searchLabel} .placeholder=${this.searchLabel} .value=${this.searchController.searchTerm} @click=${() => {
309
- this.mode === "popover" && this.searchController.searchTerm.trim() && (this.popoverOpen = !0);
317
+ return p`<div class="entity-picker">${this.selectedLabel && p`<div class="entity-picker__selection"><span class="entity-picker__selection-label">${this.selectedLabel}</span><calcite-button appearance=transparent icon-start=x kind=neutral .label=${this._messages.clearSelection} @click=${() => this.arcgisSelectionChange.emit(null)} scale=s></calcite-button></div>` || ""}${this.renderScopeSelector()}<div class="entity-picker__input" ${R(this.inputContainerRef)}><calcite-input .icon=${this.icon} .clearable=${this.mode === "inline"} .label=${this.searchLabel} .placeholder=${this.searchLabel} .value=${this.searchController.searchTerm} @click=${() => {
318
+ this.mode === "popover" && this.searchController.searchActive && (this.popoverOpen = !0);
310
319
  }} @keydown=${(t) => {
311
320
  (t.key === "ArrowDown" || t.key === "ArrowUp") && this.searchController.searchResult?.result.results.length && (t.preventDefault(), this.focusResultAt(t.key === "ArrowDown" ? 0 : -1));
312
321
  }} @focus=${() => {
313
- this.mode === "popover" && this.searchController.searchTerm.trim() && (this.popoverOpen = !0);
322
+ this.mode === "popover" && this.searchController.searchActive && (this.popoverOpen = !0);
314
323
  }} @calciteInputInput=${(t) => {
315
324
  this.searchController.setSearchTerm(t.target.value);
316
- }} ${b(this.inputRef)}></calcite-input></div>${e && p`<div class="entity-picker__results" @keydown=${this.handleResultsKeyDown}>${this.renderSearchResults()}</div>` || ""}</div>`;
325
+ }} ${R(this.inputRef)}></calcite-input></div>${e && p`<div class="entity-picker__results" @keydown=${this.handleResultsKeyDown}>${this.renderSearchResults()}</div>` || ""}</div>`;
317
326
  }
318
327
  render() {
319
328
  return this.mode === "inline" ? this.renderPicker() : p`${this.renderPicker(!1)}<calcite-popover .label=${this.searchLabel} .open=${this.popoverOpen} placement=bottom-start .referenceElement=${this.inputContainerRef.value} trigger-disabled @calcitePopoverClose=${(e) => {
320
329
  !e.target.open && this.popoverOpen && (this.popoverOpen = !1, requestAnimationFrame(() => {
321
330
  this.setFocus();
322
331
  }));
323
- }}><div class="entity-picker__results" style=${E({ inlineSize: this.popoverWidth ? `${this.popoverWidth}px` : void 0 })}>${this.renderSearchResults()}</div></calcite-popover>`;
332
+ }}><div class="entity-picker__results" style=${L({ inlineSize: this.popoverWidth ? `${this.popoverWidth}px` : void 0 })}>${this.renderSearchResults()}</div></calcite-popover>`;
324
333
  }
325
334
  }
326
335
  P("arcgis-portal-entity-picker", V);
@@ -2,13 +2,13 @@ import "@esri/calcite-components/components/calcite-chip";
2
2
  import "@esri/calcite-components/components/calcite-tooltip";
3
3
  import "@esri/calcite-components/components/calcite-list-item";
4
4
  import "@esri/calcite-components/components/calcite-action";
5
- import "@esri/calcite-components/components/calcite-dropdown-item";
6
5
  import "@esri/calcite-components/components/calcite-icon";
7
6
  import "@esri/calcite-components/components/calcite-popover";
8
7
  import "@esri/calcite-components/components/calcite-list";
9
8
  import "../arcgis-portal-item-type/index.js";
10
9
  import "@esri/calcite-components/components/calcite-loader";
11
10
  import "@esri/calcite-components/components/calcite-button";
11
+ import "@esri/calcite-components/components/calcite-dropdown-item";
12
12
  import "@esri/calcite-components/components/calcite-input";
13
13
  import "@esri/calcite-components/components/calcite-dropdown";
14
14
  import "../arcgis-portal-user-avatar/index.js";
@@ -1,15 +1,16 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
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";
2
+ import { c as u } from "../../chunks/runtime.js";
3
+ import { LitElement as h } from "@arcgis/lumina";
4
+ import { css as g, html as o } from "lit";
5
5
  import { f as d } from "../../chunks/user.js";
6
- import { f as g } from "../../chunks/item2.js";
7
- import { s as I } from "../../chunks/portal-related-items-list-item.js";
6
+ import { f as I } from "../../chunks/item2.js";
7
+ import { s as f } from "../../chunks/portal-related-items-list-item.js";
8
8
  import { u as n } from "../../chunks/useT9n.js";
9
- import { RelatedItemsListItem as f } from "../portal-related-items-list-item/customElement.js";
10
- import { g 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}.items-list{max-block-size:250px;overflow-y:auto}calcite-block{--calcite-block-icon-start-color: var(--calcite-color-status-warning)}`, c = 20;
12
- class v extends u {
9
+ import { RelatedItemsListItem as w } from "../portal-related-items-list-item/customElement.js";
10
+ import { g as b } from "../../chunks/url.js";
11
+ import { i as p } from "../../chunks/users.js";
12
+ const v = g`: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}.items-list{max-block-size:250px;overflow-y:auto}calcite-block{--calcite-block-icon-start-color: var(--calcite-color-status-warning)}`, c = 20;
13
+ class $ extends h {
13
14
  constructor() {
14
15
  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
16
  }
@@ -17,7 +18,7 @@ class v extends u {
17
18
  this.properties = { itemGroups: 16, itemOwners: 16, sourceItem: 0, relatedItems: 0, relatedItemsCount: 9, showDependentItems: 5, portal: 0, user: 0 };
18
19
  }
19
20
  static {
20
- this.styles = [b, I];
21
+ this.styles = [v, f];
21
22
  }
22
23
  willUpdate(e) {
23
24
  (e.has("relatedItems") || e.has("portal") || e.has("user")) && (this.itemGroups = {}, this.itemOwners = {}, this.loadGroupSharing(++this.userRequestId), this.loadItemOwners());
@@ -38,20 +39,20 @@ class v extends u {
38
39
  const t = await d(i.username, s);
39
40
  if (e !== this.userRequestId)
40
41
  return;
41
- const { result: r } = await g(s, t, a);
42
+ const { result: r } = await I(s, t, a);
42
43
  e === this.userRequestId && (this.itemGroups = r ?? {});
43
44
  }
44
45
  render() {
45
46
  const e = this.relatedItemsCount ?? this.relatedItems.length;
46
47
  if (!e && !this.relatedItems.length)
47
48
  return null;
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
+ 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 ? `${b({ portal: this.portal })}/item.html?id=${this.sourceItem.id}#usage` : void 0, m = () => {
49
50
  r && window.open(r, "_blank");
50
51
  };
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><div class="items-list"><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>` || ""}</div></calcite-block>`;
52
+ 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>${!p(this.user) && o`<calcite-button appearance=transparent icon-end=launch @click=${m}>${this.deleteMessages.impactedItems["View usage"]}</calcite-button>` || ""}</div><div class="items-list"><calcite-list .label=${i}>${this.relatedItems.slice(0, c).map((l) => w({ 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 && !p(this.user) && o`<calcite-button class="view-full-list" appearance=transparent icon-end=launch @click=${m}>${this.deleteMessages.impactedItems["View full list"]}</calcite-button>` || ""}</div></calcite-block>`;
52
53
  }
53
54
  }
54
- p("arcgis-portal-review-related-items", v);
55
+ u("arcgis-portal-review-related-items", $);
55
56
  export {
56
- v as ArcgisPortalReviewRelatedItems
57
+ $ as ArcgisPortalReviewRelatedItems
57
58
  };