@arcgis/portal-components 6.0.0-next.2 → 6.0.0-next.3
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/{46BUEBWS.js → 23NXHNPU.js} +1 -1
- package/dist/cdn/{6F4SJDRR.js → 2CN754CY.js} +1 -1
- package/dist/cdn/{JL52W3Z4.js → 2FQKDFEE.js} +1 -1
- package/dist/cdn/{L64UURQB.js → 2TDHJSMP.js} +1 -1
- package/dist/cdn/3FSPL34I.js +170 -0
- package/dist/cdn/{EITRZQSC.js → BYHX3UWV.js} +1 -1
- package/dist/cdn/CFRJU6VA.js +2 -0
- package/dist/cdn/D2YQWKME.js +135 -0
- package/dist/cdn/{EQDYQOOT.js → EY5S6ICQ.js} +1 -1
- package/dist/cdn/{MLYQGIJU.js → GGDOGNH4.js} +13 -13
- package/dist/cdn/{23FS4XTG.js → HCNTXLUT.js} +1 -1
- package/dist/cdn/{TLM457Z5.js → J5NPDIZM.js} +1 -1
- package/dist/cdn/JE2376SE.js +2 -0
- package/dist/cdn/{CXXV6WJT.js → MQK63FV7.js} +1 -1
- package/dist/cdn/N4VOTJ25.js +1 -1
- package/dist/cdn/{YTODQCOG.js → QROXYP6V.js} +1 -1
- package/dist/cdn/QTAYXO5T.js +2 -0
- package/dist/cdn/{AJQT7UXB.js → QUOLQGKP.js} +1 -1
- package/dist/cdn/{66XWNGQ2.js → QWHGLE3O.js} +1 -1
- package/dist/cdn/R3PK7XOP.js +2 -0
- package/dist/cdn/{WC3FPLYQ.js → REM3KCX6.js} +1 -1
- package/dist/cdn/{4AI52H7C.js → RNWICLRH.js} +1 -1
- package/dist/cdn/S6F7U36E.js +400 -0
- package/dist/cdn/SMX2LEJB.js +2 -0
- package/dist/cdn/{ABORO35R.js → TRMFL7PT.js} +1 -1
- package/dist/cdn/{LWFACY3F.js → UEP2NYJK.js} +1 -1
- package/dist/cdn/{32BWFMTC.js → URQML7KV.js} +1 -1
- package/dist/cdn/{6RZEXOK3.js → UZP4YMTE.js} +1 -1
- package/dist/cdn/VNU4QX7M.js +41 -0
- package/dist/cdn/YB3DR4VO.js +2 -0
- package/dist/cdn/Z3HGPBOR.js +2 -0
- package/dist/cdn/ZXNF77OB.js +2 -0
- package/dist/cdn/index.js +1 -1
- package/dist/components/arcgis-portal-account-switcher/customElement.js +27 -25
- package/dist/components/arcgis-portal-account-switcher-accounts/customElement.d.ts +4 -4
- package/dist/components/arcgis-portal-account-switcher-accounts/customElement.js +8 -8
- package/dist/components/arcgis-portal-account-switcher-list/customElement.d.ts +4 -4
- package/dist/components/arcgis-portal-account-switcher-list/customElement.js +6 -6
- package/dist/components/arcgis-portal-account-switcher-signout/customElement.d.ts +5 -5
- package/dist/components/arcgis-portal-account-switcher-signout/customElement.js +3 -3
- package/dist/components/arcgis-portal-ai-assistant/customElement.d.ts +10 -2
- package/dist/components/arcgis-portal-ai-assistant/customElement.js +1354 -1037
- package/dist/components/arcgis-portal-ai-assistant/data/capability-registries/types.d.ts +1 -1
- package/dist/components/arcgis-portal-ai-assistant/types/assistantTools.d.ts +44 -0
- package/dist/components/arcgis-portal-entity-picker/customElement.d.ts +7 -0
- package/dist/components/arcgis-portal-entity-picker/customElement.js +33 -27
- package/dist/components/arcgis-portal-group-card/customElement.js +16 -16
- package/dist/components/arcgis-portal-item-card/customElement.js +58 -58
- package/dist/components/arcgis-portal-navigation/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/index.d.ts +1 -0
- package/dist/loader.js +7 -7
- package/dist/types/lumina.d.ts +11 -11
- package/dist/types/preact.d.ts +11 -11
- package/dist/types/react.d.ts +11 -11
- package/dist/types/stencil.d.ts +11 -11
- package/package.json +7 -7
- package/dist/cdn/5PPZNVWG.js +0 -2
- package/dist/cdn/APSYZEPP.js +0 -209
- package/dist/cdn/BSTA5KI5.js +0 -2
- package/dist/cdn/GUO7HKSP.js +0 -463
- package/dist/cdn/GX7U3727.js +0 -2
- package/dist/cdn/NRMQDCM3.js +0 -2
- package/dist/cdn/RVYSVTPQ.js +0 -2
- /package/dist/components/arcgis-portal-ai-assistant/{agents/types.d.ts → types/navigation.d.ts} +0 -0
- /package/dist/components/arcgis-portal-ai-assistant/{agents → types}/portalRouteKeys.d.ts +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PortalContentNavigationHash, PortalGroupNavigationHash, PortalGroupsNavigationHash, PortalOrgNavigationHash } from "../../
|
|
1
|
+
import type { PortalContentNavigationHash, PortalGroupNavigationHash, PortalGroupsNavigationHash, PortalOrgNavigationHash } from "../../types/navigation.js";
|
|
2
2
|
|
|
3
3
|
/** Shape exported by a TypeScript module under data/capability-registries/. */
|
|
4
4
|
export interface CapabilityRegistry {
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { FunctionTool, FunctionToolConstructProperties, FunctionToolLike } from "@arcgis/ai-components/agent-utils/tools/FunctionTool.js";
|
|
2
|
+
import type { RunnableConfig } from "@langchain/core/runnables";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Factory that creates tools made available to the Portal assistant.
|
|
6
|
+
*
|
|
7
|
+
* The Portal-provided `tool` and `requestPortalAssistantUiAction` helpers
|
|
8
|
+
* avoid consumer imports for those capabilities.
|
|
9
|
+
*
|
|
10
|
+
* @param context
|
|
11
|
+
*/
|
|
12
|
+
export type PortalAssistantTools = (context: PortalAssistantToolsContext) => readonly FunctionToolLike[];
|
|
13
|
+
|
|
14
|
+
export interface PortalAssistantToolsContext {
|
|
15
|
+
/** Requests a constrained UI action without exposing its callback to the model. */
|
|
16
|
+
requestPortalAssistantUiAction: (action: PortalAssistantUiAction, config?: RunnableConfig) => Promise<boolean>;
|
|
17
|
+
/** Creates a native function tool for use by the Portal assistant. */
|
|
18
|
+
tool: <TInput extends Record<string, unknown>, TOutput = unknown>(properties: FunctionToolConstructProperties<TInput, TOutput>) => FunctionTool<TInput, TOutput>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** UI slot that helps with user actions */
|
|
22
|
+
export type PortalAssistantUiAction = InlineButtonUiAction | SelectionUiAction;
|
|
23
|
+
|
|
24
|
+
/** A user-clickable inline button rendered by the assistant. */
|
|
25
|
+
export interface InlineButtonUiAction {
|
|
26
|
+
/** Runs only after the user clicks the rendered button. */
|
|
27
|
+
callback: UiActionCallback;
|
|
28
|
+
/** Optional supporting text shown below the button. */
|
|
29
|
+
description?: string;
|
|
30
|
+
/** Selects the component-owned renderer for this action. */
|
|
31
|
+
kind: "inline-button";
|
|
32
|
+
/** User-visible button text. */
|
|
33
|
+
label: string;
|
|
34
|
+
/** When true, re-enables the button after a successful callback. */
|
|
35
|
+
repeatable?: boolean;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** ! NOT YET SUPPORTED */
|
|
39
|
+
export interface SelectionUiAction {
|
|
40
|
+
kind: "selection";
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** @param request */
|
|
44
|
+
export type UiActionCallback = (request: { signal: AbortSignal; }) => Promise<void> | void;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import type Portal from "@arcgis/core/portal/Portal.js";
|
|
3
3
|
import type { PublicLitElement as LitElement } from "@arcgis/lumina";
|
|
4
4
|
import type { PortalEntityPickerEntityType, PortalEntityPickerMode, PortalEntityPickerSelection } from "../../types/portalEntityPicker.js";
|
|
5
|
+
import type { ArcgisPortalItemCard } from "../arcgis-portal-item-card/customElement.js";
|
|
5
6
|
import type { T9nMeta } from "@arcgis/lumina/controllers";
|
|
6
7
|
import type { Icon as Icon } from "@esri/calcite-components/components/calcite-icon";
|
|
7
8
|
|
|
@@ -71,6 +72,12 @@ export abstract class ArcgisPortalEntityPicker extends LitElement {
|
|
|
71
72
|
accessor query: string | undefined;
|
|
72
73
|
/** The currently selected entity. The component does not mutate this property. */
|
|
73
74
|
accessor selected: PortalEntityPickerSelection | null;
|
|
75
|
+
/**
|
|
76
|
+
* Controls selection indicators for inline results. `none` keeps click and keyboard selection without controls.
|
|
77
|
+
*
|
|
78
|
+
* @default "single"
|
|
79
|
+
*/
|
|
80
|
+
accessor selectionMode: Exclude<ArcgisPortalItemCard["selection"], "multiple">;
|
|
74
81
|
/** Sets focus on the search input. */
|
|
75
82
|
setFocus(): Promise<void>;
|
|
76
83
|
/**
|
|
@@ -5,15 +5,15 @@ import { keyed as h } from "lit/directives/keyed.js";
|
|
|
5
5
|
import { LitElement as f, createEvent as v, safeStyleMap as g } from "@arcgis/lumina";
|
|
6
6
|
import { createRef as u, ref as d } from "lit/directives/ref.js";
|
|
7
7
|
import { u as $ } from "../../chunks/useT9n.js";
|
|
8
|
-
import { c as
|
|
9
|
-
import { s as
|
|
10
|
-
import { a as
|
|
11
|
-
import { r as
|
|
8
|
+
import { c as T } from "../../chunks/string.js";
|
|
9
|
+
import { s as b } from "../../chunks/dom.js";
|
|
10
|
+
import { a as S } from "../../chunks/portal.js";
|
|
11
|
+
import { r as w } from "../../chunks/request.js";
|
|
12
12
|
import "../arcgis-portal-group-card/customElement.js";
|
|
13
13
|
import "../arcgis-portal-item-card/customElement.js";
|
|
14
|
-
import { S as
|
|
14
|
+
import { S as R } from "../../chunks/utils.js";
|
|
15
15
|
import "../arcgis-portal-user-avatar/customElement.js";
|
|
16
|
-
const
|
|
16
|
+
const k = [
|
|
17
17
|
"esri_livingatlas",
|
|
18
18
|
"esri_boundaries",
|
|
19
19
|
"esri_demographics",
|
|
@@ -21,7 +21,7 @@ const w = [
|
|
|
21
21
|
"esri_webstyles"
|
|
22
22
|
];
|
|
23
23
|
function I(o) {
|
|
24
|
-
return
|
|
24
|
+
return b(o.trim()).replace(/[!*+\-&|()[\]{}^~?:"\\]/gu, "\\$&");
|
|
25
25
|
}
|
|
26
26
|
async function _({
|
|
27
27
|
portal: o,
|
|
@@ -29,10 +29,10 @@ async function _({
|
|
|
29
29
|
num: t = 100,
|
|
30
30
|
query: s
|
|
31
31
|
}) {
|
|
32
|
-
const i = I(e), l = `${
|
|
33
|
-
o.isPortal && r.push(...
|
|
32
|
+
const i = I(e), l = `${S(o)}portals/self/users/search`, r = [i ? `(${i})` : void 0, s?.trim() ? `(${s.trim()})` : void 0];
|
|
33
|
+
o.isPortal && r.push(...k.map((p) => `-username:${p}`));
|
|
34
34
|
const a = l.includes("www.arcgis.com") && o.isPortal ? { disableIdentityLookup: !0, addTokenManually: !1 } : {};
|
|
35
|
-
return await
|
|
35
|
+
return await w({
|
|
36
36
|
url: l,
|
|
37
37
|
portal: o,
|
|
38
38
|
params: {
|
|
@@ -43,10 +43,10 @@ async function _({
|
|
|
43
43
|
options: a
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
|
-
function
|
|
46
|
+
function P(...o) {
|
|
47
47
|
return o.map((e) => e?.trim()).filter((e) => !!e).map((e) => `(${e})`).join(" AND ");
|
|
48
48
|
}
|
|
49
|
-
async function
|
|
49
|
+
async function A(o, e, t, s = {}) {
|
|
50
50
|
const i = Math.min(Math.max(s.num ?? 10, 1), 100);
|
|
51
51
|
if (e === "user")
|
|
52
52
|
try {
|
|
@@ -59,12 +59,12 @@ async function P(o, e, t, s = {}) {
|
|
|
59
59
|
} catch (c) {
|
|
60
60
|
return console.error(c), { error: { code: "unhandledError" } };
|
|
61
61
|
}
|
|
62
|
-
const l =
|
|
62
|
+
const l = T(t);
|
|
63
63
|
if (!l)
|
|
64
64
|
return {};
|
|
65
65
|
const r = {
|
|
66
66
|
num: i,
|
|
67
|
-
query:
|
|
67
|
+
query: P(l, s.query)
|
|
68
68
|
};
|
|
69
69
|
try {
|
|
70
70
|
return e === "group" ? { result: { entityType: e, result: await o.queryGroups(r) } } : { result: { entityType: e, result: await o.queryItems(r) } };
|
|
@@ -72,16 +72,16 @@ async function P(o, e, t, s = {}) {
|
|
|
72
72
|
return console.error(c), { error: { code: "unhandledError" } };
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
const
|
|
76
|
-
class
|
|
75
|
+
const C = y`: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%}`;
|
|
76
|
+
class O extends f {
|
|
77
77
|
constructor() {
|
|
78
|
-
super(...arguments), this._messages = $({ blocking: !0, name: "portal-entity-picker" }), this.inputRef = u(), this.inputContainerRef = u(), this.resizeObserver = null, this.searchId = 0, this.searchTerm = "", this.isSearching = !1, this.searchFailed = !1, this.popoverOpen = !1, this.popoverWidth = 0, this.entityType = "group", this.mode = "inline", this.selected = null, this.num = 10, this.arcgisSelectionChange = v();
|
|
78
|
+
super(...arguments), this._messages = $({ blocking: !0, name: "portal-entity-picker" }), this.inputRef = u(), this.inputContainerRef = u(), this.resizeObserver = null, this.searchId = 0, this.searchTerm = "", this.isSearching = !1, this.searchFailed = !1, this.popoverOpen = !1, this.popoverWidth = 0, this.entityType = "group", this.mode = "inline", this.selectionMode = "single", this.selected = null, this.num = 10, this.arcgisSelectionChange = v();
|
|
79
79
|
}
|
|
80
80
|
static {
|
|
81
|
-
this.properties = { searchTerm: 16, isSearching: 16, searchFailed: 16, searchResult: 16, popoverOpen: 16, popoverWidth: 16, portal: 0, entityType: 1, mode: 1, selected: 0, query: 1, num: 9, icon: 1, messageOverrides: 0 };
|
|
81
|
+
this.properties = { searchTerm: 16, isSearching: 16, searchFailed: 16, searchResult: 16, popoverOpen: 16, popoverWidth: 16, portal: 0, entityType: 1, mode: 1, selectionMode: 1, selected: 0, query: 1, num: 9, icon: 1, messageOverrides: 0 };
|
|
82
82
|
}
|
|
83
83
|
static {
|
|
84
|
-
this.styles =
|
|
84
|
+
this.styles = C;
|
|
85
85
|
}
|
|
86
86
|
get searchLabel() {
|
|
87
87
|
const { entityType: e, _messages: t } = this;
|
|
@@ -126,12 +126,12 @@ class F extends f {
|
|
|
126
126
|
}
|
|
127
127
|
this.isSearching = !0, this.mode === "popover" && (this.popoverOpen = !0), this.debounceId = window.setTimeout(() => {
|
|
128
128
|
this.debounceId = void 0, this.search(t, s);
|
|
129
|
-
},
|
|
129
|
+
}, R);
|
|
130
130
|
}
|
|
131
131
|
async search(e, t) {
|
|
132
132
|
const { entityType: s, num: i, portal: l, query: r } = this;
|
|
133
133
|
try {
|
|
134
|
-
const { error: c, result: a } = await
|
|
134
|
+
const { error: c, result: a } = await A(l, s, e, { num: i, query: r });
|
|
135
135
|
if (t !== this.searchId)
|
|
136
136
|
return;
|
|
137
137
|
this.searchFailed = !!c, this.searchResult = a;
|
|
@@ -173,6 +173,8 @@ class F extends f {
|
|
|
173
173
|
await this.focusResult(t[s]);
|
|
174
174
|
}
|
|
175
175
|
handleResultsKeyDown(e) {
|
|
176
|
+
if (e.defaultPrevented)
|
|
177
|
+
return;
|
|
176
178
|
const t = this.getFocusableResults(), s = e.composedPath(), i = t.findIndex((r) => s.includes(r));
|
|
177
179
|
if (i === -1)
|
|
178
180
|
return;
|
|
@@ -197,13 +199,17 @@ class F extends f {
|
|
|
197
199
|
return h(e.id, n`<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>`);
|
|
198
200
|
}
|
|
199
201
|
renderInlineGroup(e) {
|
|
200
|
-
return h(e.id, n`<arcgis-portal-group-card .group=${e} .portal=${this.portal} .selected=${this.selected?.entityType === "group" && this.selected.entity.id === e.id} selection
|
|
202
|
+
return h(e.id, n`<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 }) => {
|
|
203
|
+
t.selected && this.emitSelection({ entityType: "group", entity: t.group });
|
|
204
|
+
}} .user=${this.portal.user ?? void 0} view=compact></arcgis-portal-group-card>`);
|
|
201
205
|
}
|
|
202
206
|
renderItem(e) {
|
|
203
207
|
return h(e.id, n`<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>`);
|
|
204
208
|
}
|
|
205
209
|
renderInlineItem(e) {
|
|
206
|
-
return h(e.id, n`<arcgis-portal-item-card .item=${e} .portal=${this.portal} .selected=${this.selected?.entityType === "item" && this.selected.entity.id === e.id} selection
|
|
210
|
+
return h(e.id, n`<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 }) => {
|
|
211
|
+
t.selected && this.emitSelection({ entityType: "item", entity: t.item });
|
|
212
|
+
}} .user=${this.portal.user ?? void 0} view=list></arcgis-portal-item-card>`);
|
|
207
213
|
}
|
|
208
214
|
renderUser(e) {
|
|
209
215
|
return h(e.username, n`<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>`);
|
|
@@ -220,10 +226,10 @@ class F extends f {
|
|
|
220
226
|
const a = e === "group" ? r.noGroupsFound : e === "item" ? r.noItemsFound : r.noUsersFound;
|
|
221
227
|
return n`<p class="entity-picker__status" role=status>${a}</p>`;
|
|
222
228
|
}
|
|
223
|
-
return this.mode === "inline" && i?.entityType === "group" ? n`<div class="entity-picker__cards"><slot name=list-start></slot>${i.result.results.map((a) => this.renderInlineGroup(a))}</div>` : this.mode === "inline" && i?.entityType === "item" ? n`<div class="entity-picker__cards"><slot name=list-start></slot>${i.result.results.map((a) => this.renderInlineItem(a))}</div>` : n`<calcite-list interaction-mode=interactive .label=${this.searchLabel}
|
|
229
|
+
return this.mode === "inline" && i?.entityType === "group" ? n`<div class="entity-picker__cards"><slot name=list-start></slot>${i.result.results.map((a) => this.renderInlineGroup(a))}</div>` : this.mode === "inline" && i?.entityType === "item" ? n`<div class="entity-picker__cards"><slot name=list-start></slot>${i.result.results.map((a) => this.renderInlineItem(a))}</div>` : n`<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((a) => this.renderGroup(a)) : i?.entityType === "item" ? i.result.results.map((a) => this.renderItem(a)) : i?.result.results.map((a) => this.renderUser(a))}</calcite-list>`;
|
|
224
230
|
}
|
|
225
231
|
renderPicker(e = !0) {
|
|
226
|
-
return n`<div class="entity-picker">${this.selectedLabel && n`<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>` || ""}<div class="entity-picker__input" ${d(this.inputContainerRef)}><calcite-input .icon=${this.icon} .label=${this.searchLabel} .placeholder=${this.searchLabel} .value=${this.searchTerm} @click=${() => {
|
|
232
|
+
return n`<div class="entity-picker">${this.selectedLabel && n`<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>` || ""}<div class="entity-picker__input" ${d(this.inputContainerRef)}><calcite-input .icon=${this.icon} .clearable=${this.mode === "inline"} .label=${this.searchLabel} .placeholder=${this.searchLabel} .value=${this.searchTerm} @click=${() => {
|
|
227
233
|
this.mode === "popover" && this.searchTerm.trim() && (this.popoverOpen = !0);
|
|
228
234
|
}} @keydown=${(t) => {
|
|
229
235
|
(t.key === "ArrowDown" || t.key === "ArrowUp") && this.searchResult?.result.results.length && (t.preventDefault(), this.focusResultAt(t.key === "ArrowDown" ? 0 : -1));
|
|
@@ -241,7 +247,7 @@ class F extends f {
|
|
|
241
247
|
}}><div class="entity-picker__results" style=${g({ inlineSize: this.popoverWidth ? `${this.popoverWidth}px` : void 0 })}>${this.renderSearchResults()}</div></calcite-popover>`;
|
|
242
248
|
}
|
|
243
249
|
}
|
|
244
|
-
m("arcgis-portal-entity-picker",
|
|
250
|
+
m("arcgis-portal-entity-picker", O);
|
|
245
251
|
export {
|
|
246
|
-
|
|
252
|
+
O as ArcgisPortalEntityPicker
|
|
247
253
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
2
|
import { c as b } from "../../chunks/runtime.js";
|
|
3
3
|
import { substitute as h, formatDate as _ } from "@arcgis/core/intl.js";
|
|
4
|
-
import { LitElement as v, createEvent as m, safeClassMap as g, nothing as
|
|
4
|
+
import { LitElement as v, createEvent as m, safeClassMap as g, nothing as c } from "@arcgis/lumina";
|
|
5
5
|
import { css as w, html as t } from "lit";
|
|
6
6
|
import { createRef as $, ref as f } from "lit/directives/ref.js";
|
|
7
7
|
import { u as x } from "../../chunks/useT9n.js";
|
|
@@ -67,7 +67,7 @@ class S extends v {
|
|
|
67
67
|
const d = Array.from(e.children), o = d.indexOf(r);
|
|
68
68
|
if (o < 0)
|
|
69
69
|
return e.clientWidth;
|
|
70
|
-
const n = Number.parseFloat(i.columnGap || i.gap || "0") || 0, l = d.slice(0, o).reduce((s,
|
|
70
|
+
const n = Number.parseFloat(i.columnGap || i.gap || "0") || 0, l = d.slice(0, o).reduce((s, p) => s + p.getBoundingClientRect().width, 0);
|
|
71
71
|
return e.clientWidth - l - n * o;
|
|
72
72
|
}
|
|
73
73
|
getAccessInfo(e) {
|
|
@@ -136,19 +136,19 @@ class S extends v {
|
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
renderCompactView() {
|
|
139
|
-
const { group: e, selection: r, isLoaded: i, disabled: d, link: o, newTab: n, linkHandler: l, handleCardClick: s, selected:
|
|
139
|
+
const { group: e, selection: r, isLoaded: i, disabled: d, link: o, newTab: n, linkHandler: l, handleCardClick: s, selected: p } = this, a = this.getThumbnailGroup(e);
|
|
140
140
|
return t`<section class=${g({
|
|
141
141
|
"group-card": !0,
|
|
142
142
|
"group-card--hoverable": r !== "none",
|
|
143
|
-
"group-card--selected":
|
|
143
|
+
"group-card--selected": p,
|
|
144
144
|
"group-card--disabled": d,
|
|
145
145
|
"group-card--loaded": i
|
|
146
146
|
})} tabindex=-1 @click=${o ? void 0 : s} @mouseover=${() => {
|
|
147
147
|
this.hover = !0;
|
|
148
148
|
}} @mouseout=${() => {
|
|
149
149
|
this.hover = !1;
|
|
150
|
-
}} ${f(this.sectionEl)}>${o ? t`<a class="group-card__upper group-card__upper--compact group-card__upper--link" href=${o ??
|
|
151
|
-
l && !
|
|
150
|
+
}} ${f(this.sectionEl)}>${o ? t`<a class="group-card__upper group-card__upper--compact group-card__upper--link" href=${o ?? c} target=${(n ? "_blank" : void 0) ?? c} rel=${(n ? "noopener noreferrer" : void 0) ?? c} @click=${(u) => {
|
|
151
|
+
l && !u.ctrlKey && !u.metaKey && (u.preventDefault(), l(this.group));
|
|
152
152
|
}}>${t`${this.renderSelectionInput()}<div class="group-card__thumbnail group-card__thumbnail--compact"><arcgis-portal-group-thumbnail .group=${a} .portal=${this.portal} scale=l></arcgis-portal-group-thumbnail></div><div class="group-card-flex-1"><h3 class="group-card__title group-card__title--compact"><span class="group-card__title__span">${e.title}</span></h3>${this.renderCompactBadges(e)}</div><slot name=content-end></slot>`}</a>` : t`<div class="group-card__upper group-card__upper--compact">${this.renderSelectionInput()}<div class="group-card__thumbnail group-card__thumbnail--compact"><arcgis-portal-group-thumbnail .group=${a} .portal=${this.portal} scale=l></arcgis-portal-group-thumbnail></div><div class="group-card-flex-1"><h3 class="group-card__title group-card__title--compact"><span class="group-card__title__span">${e.title}</span></h3>${this.renderCompactBadges(e)}</div><slot name=content-end></slot></div>`}</section>`;
|
|
153
153
|
}
|
|
154
154
|
render() {
|
|
@@ -157,17 +157,17 @@ class S extends v {
|
|
|
157
157
|
return;
|
|
158
158
|
if (this.view === "compact")
|
|
159
159
|
return this.renderCompactView();
|
|
160
|
-
const n = this.getAccessInfo(e.access ?? "private"), l = this.getThumbnailGroup(e), s = this.preview === "top" && !o,
|
|
160
|
+
const n = this.getAccessInfo(e.access ?? "private"), l = this.getThumbnailGroup(e), s = this.preview === "top" && !o, p = this.previewed;
|
|
161
161
|
return t`<section class=${g({
|
|
162
162
|
"group-card": !0,
|
|
163
163
|
"group-card--hoverable": r !== "none",
|
|
164
164
|
"group-card--selected": this.selected,
|
|
165
165
|
"group-card--disabled": d,
|
|
166
166
|
"group-card--loaded": i,
|
|
167
|
-
"group-card--previewed":
|
|
168
|
-
})} @click=${o ? void 0 : this.handleCardClick} tabindex=${(s ? 0 : void 0) ??
|
|
167
|
+
"group-card--previewed": p
|
|
168
|
+
})} @click=${o ? void 0 : this.handleCardClick} tabindex=${(s ? 0 : void 0) ?? c} .role=${s ? "button" : void 0} aria-haspopup=${(s ? "dialog" : void 0) ?? c} @keydown=${(a) => {
|
|
169
169
|
s && (a.key === "Enter" || a.key === " ") && (a.preventDefault(), this.handleCardClick());
|
|
170
|
-
}} ${f(this.sectionEl)}><slot name=content-top></slot>${o ? t`<a class="group-card__upper group-card__upper--link" href=${this.link ??
|
|
170
|
+
}} ${f(this.sectionEl)}><slot name=content-top></slot>${o ? t`<a class="group-card__upper group-card__upper--link" href=${this.link ?? c} target=${(this.newTab ? "_blank" : void 0) ?? c} rel=${(this.newTab ? "noopener noreferrer" : void 0) ?? c} @mouseover=${() => {
|
|
171
171
|
this.hover = !0;
|
|
172
172
|
}} @mouseout=${() => {
|
|
173
173
|
this.hover = !1;
|
|
@@ -176,17 +176,17 @@ class S extends v {
|
|
|
176
176
|
a.preventDefault(), this.linkHandler(this.group);
|
|
177
177
|
return;
|
|
178
178
|
}
|
|
179
|
-
const
|
|
180
|
-
|
|
179
|
+
const u = a.target;
|
|
180
|
+
u instanceof HTMLElement && u.closest(".group-card__footer") && a.preventDefault();
|
|
181
181
|
}}>${this.renderListContent(e, l, n)}</a>` : t`<div class="group-card__upper" @mouseover=${() => {
|
|
182
182
|
this.hover = !0;
|
|
183
183
|
}} @mouseout=${() => {
|
|
184
184
|
this.hover = !1;
|
|
185
|
-
}}>${this.renderListContent(e, l, n)}</div>`}<div class="group-card__footer"><div class="group-card__footer__start"><slot name=actions-start></slot>${!this.hideOwner && t`<div class="group-card__profile-wrap"><arcgis-portal-user-popup .baseUrl=${this.getResolvedBaseUrl()} class="group-card__owner" .portal=${this.portal} .username=${e.owner ?? void 0} underline @arcgisUserPopupInternalUIAction=${(
|
|
186
|
-
|
|
187
|
-
}}></arcgis-portal-user-popup></div>` || ""}</div><div class="group-card__footer__end">${this.preview === "action" && t`<calcite-button scale=s .appearance=${
|
|
185
|
+
}}>${this.renderListContent(e, l, n)}</div>`}<div class="group-card__footer"><div class="group-card__footer__start"><slot name=actions-start></slot>${!this.hideOwner && t`<div class="group-card__profile-wrap"><arcgis-portal-user-popup .baseUrl=${this.getResolvedBaseUrl()} class="group-card__owner" .portal=${this.portal} .username=${e.owner ?? void 0} underline @arcgisUserPopupInternalUIAction=${(a) => {
|
|
186
|
+
a.stopPropagation(), this.arcgisGroupBrowserInternalUIAction.emit(a.detail);
|
|
187
|
+
}}></arcgis-portal-user-popup></div>` || ""}</div><div class="group-card__footer__end">${this.preview === "action" && t`<calcite-button scale=s .appearance=${p ? "solid" : "outline-fill"} kind=neutral @click=${() => {
|
|
188
188
|
this.arcgisGroupBrowserCardPreview.emit(this.group);
|
|
189
|
-
}}>${
|
|
189
|
+
}}>${p ? this.messages.hidePreview : this.messages.preview}</calcite-button>` || ""}<div @click=${(a) => {
|
|
190
190
|
a.stopPropagation();
|
|
191
191
|
}}><slot name=actions-end></slot></div></div></div></section>`;
|
|
192
192
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
2
|
import { c as S } from "../../chunks/runtime.js";
|
|
3
|
-
import { css as B, html as
|
|
4
|
-
import { formatDate as y, substitute as
|
|
5
|
-
import { LitElement as U, createEvent as
|
|
3
|
+
import { css as B, html as i } from "lit";
|
|
4
|
+
import { formatDate as y, substitute as v } from "@arcgis/core/intl.js";
|
|
5
|
+
import { LitElement as U, createEvent as _, safeClassMap as n, nothing as u } from "@arcgis/lumina";
|
|
6
6
|
import { createRef as k, ref as I } from "lit/directives/ref.js";
|
|
7
|
-
import { u as
|
|
8
|
-
import { a as
|
|
9
|
-
import { g as
|
|
10
|
-
import { g as
|
|
7
|
+
import { u as P } from "../../chunks/useT9n.js";
|
|
8
|
+
import { a as F } from "../../chunks/functionalities.js";
|
|
9
|
+
import { g as z } from "../../chunks/items.js";
|
|
10
|
+
import { g as D } from "../../chunks/url.js";
|
|
11
11
|
const E = B`:host{display:block;min-width:0;container-type:inline-size;container-name:portal-item-card}.item-card{position:relative;display:flex;min-height:100%;flex-direction:column;color:var(--calcite-color-text-1);opacity:0;box-shadow:none;transition-duration:.15s;outline-color:transparent;background-color:var(--calcite-color-foreground-1);transition-property:background-color,outline,outline-offset,opacity;border:1px solid var(--calcite-color-border-3);&:focus{z-index:10;outline:2px solid var(--calcite-color-brand);outline-offset:-2px}}.item-card--loaded{opacity:1}.item-card--selected{border-color:var(--calcite-color-brand)}.item-card--previewed{outline:1px solid var(--calcite-color-brand);outline-offset:-2px}.item-card--hoverable{cursor:pointer}.item-card--disabled{opacity:.5;pointer-events:none}.item-card__upper{flex:1 1 0%;background-color:var(--calcite-color-foreground-1);transition:all var(--calcite-animation-timing) ease-in-out 0s,outline 0s,outline-offset 0s}.item-card__upper:hover{background-color:var(--calcite-color-background)}.item-card__upper--link{color:var(--calcite-color-text-1);text-decoration-line:none;outline-color:transparent;&:focus{z-index:10;outline:2px solid var(--calcite-color-brand);outline-offset:2px}}.item-card__upper:hover .item-card__hover-text,.item-card:focus .item-card__hover-text{opacity:1}.item-card__top{padding:.75rem}.item-card__content{display:flex;min-width:0;flex:1 1 0%;flex-direction:column}.item-card__content-end{min-width:0;margin-block-start:.25rem}.item-card__title{margin:0;overflow-wrap:break-word;padding:0;font-size:.875rem;font-weight:500;line-height:1.375}.item-card__title--grid{font-size:.875rem}.item-card__title--padded{margin-bottom:.25rem}.item-card__title__span{position:relative;display:inline;border-style:none;background-color:transparent;padding:0;transition:all var(--calcite-animation-timing) ease-in-out 0s,outline 0s,outline-offset 0s;background-image:linear-gradient(transparent,transparent);background-position-x:0%,100%;background-position-y:min(1.25em,100%);background-repeat:no-repeat,no-repeat;background-size:100% 1px,100% 1px}.item-card--previewed .item-card__title__span,.item-card__upper--link:hover .item-card__title__span{background-image:linear-gradient(var(--calcite-color-text-3),var(--calcite-color-text-3))}.item-card__summary{margin:0;flex:1 1 0%;color:var(--calcite-color-text-2);display:none;overflow-wrap:break-word;padding:0;font-size:.875rem;line-height:1.25}.item-card__detail--updated-full.item-card__divider{display:none}.item-card__details{margin-block-start:.25rem;display:flex;flex-direction:row}.item-card__detail{font-size:.75rem;line-height:1.35;color:var(--calcite-color-text-2)}.item-card__divider{display:flex;align-items:center;flex:0 0 auto}.item-card__divider:not([empty]):before{content:"";height:1.25rem;width:1px;background-color:var(--calcite-color-border-1);margin-inline:.75rem}.item-card__divider:first-child:before{display:none}.item-card__thumbnail{margin:0;width:5rem;height:3.5rem;margin-inline-start:.5rem;flex:0 0 auto;overflow:hidden;border-radius:.125rem}.item-card__thumbnail--grid{position:relative;width:100%;height:auto;aspect-ratio:16 / 9;margin:0;margin-inline-start:0;border-radius:0;border-bottom:1px solid var(--calcite-color-foreground-2)}.item-card__thumbnail-image{width:100%;height:100%;object-fit:cover;display:block}.item-card__thumbnail-media{display:block;width:100%;height:100%}.item-card__thumbnail-fallback{width:100%;height:100%;background-color:var(--calcite-color-foreground-2);color:var(--calcite-color-text-3);display:flex;align-items:center;justify-content:center}.item-card__hover-text{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;opacity:0;color:var(--calcite-color-foreground-1);background-color:var(--calcite-color-transparent-scrim);font-size:.75rem;font-weight:500;text-align:center;transition:opacity var(--calcite-animation-timing) ease-in-out}.item-card__badges{display:flex;flex-wrap:wrap}.item-card__badges--compact{max-width:100%}.item-card__badges--responsive{display:none}.item-card__footer{margin-top:auto;display:flex;align-items:center;background-color:var(--calcite-color-foreground-1);padding:.25rem .75rem;border-top:1px solid var(--calcite-color-border-3)}.item-card__footer__start{display:flex;min-width:0;flex:1 1 0%;align-items:center;overflow:hidden;width:100%;margin-inline-end:.75rem}.item-card__footer__start--owner{margin-inline-start:-.25rem}.item-card__profile-wrap{max-width:100%;padding:.25rem}.item-card__owner{min-width:0}.item-card__footer-divider{height:1.25rem;width:1px;margin-inline:.75rem;background-color:var(--calcite-color-border-input)}.item-card__preview-button{margin-inline-end:.5rem}.item-card__footer arcgis-portal-item-favorite,.item-card__footer arcgis-portal-item-actions{display:inline-flex;align-items:center}.item-card__access-wrap{display:flex;align-items:center}.item-card__access{display:flex;align-items:center;color:var(--calcite-color-text-2);font-size:.75rem}.item-card__detail__icon{margin-inline-end:.375rem}.item-card-flex{display:flex}.item-card-flex-1{min-width:0;flex:1 1 0%}.item-card__input{margin-inline-end:1rem;margin-top:.125rem}.item-card__title+.item-card__input{margin-inline-start:1rem;margin-inline-end:0}.item-card__input--compact{height:100%;display:flex;align-items:center}.item-card-item-type{min-width:0}.screen-readers-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}@container portal-item-card (max-width: 320px){.item-card__title,.item-card__title--grid{font-size:.75rem}.item-card:not(.item-card--grid) .item-card__thumbnail{width:3.4375rem;margin-inline-start:.75rem}.item-card__footer__start{margin-inline-end:.5rem}.item-card__detail--updated-short{display:none}}@container portal-item-card (min-width: 321px) and (max-width: 480px){.item-card__title{font-size:.875rem}}@container portal-item-card (min-width: 481px){.item-card__top{padding:1rem}.item-card__title{font-size:1.125rem}.item-card__title--padded{margin-bottom:.5rem}.item-card__detail{font-size:.875rem}.item-card__footer{padding:.5rem 1rem}.item-card:not(.item-card--grid) .item-card__thumbnail{width:8rem;margin-inline-start:2rem}.item-card__summary{display:block}}@container portal-item-card (min-width: 641px){.item-card__badges--compact{display:none}.item-card__badges--responsive{display:flex}.item-card__summary{display:block}.item-card__footer{flex-wrap:nowrap;gap:0}.item-card__footer__start{width:auto;margin-inline-end:.75rem}.item-card__detail--updated-short{display:none}.item-card__detail--updated-full.item-card__divider{display:flex}.item-card:not(.item-card--grid) .item-card__thumbnail{height:4rem}}`;
|
|
12
12
|
class O extends U {
|
|
13
13
|
constructor() {
|
|
14
|
-
super(...arguments), this.messages =
|
|
14
|
+
super(...arguments), this.messages = P({ blocking: !0 }), this.sectionEl = k(), this.linkEl = k(), this.handleCardClick = (e) => {
|
|
15
15
|
if (!(this.link || this.disabled || e?.target?.closest(".item-card__footer"))) {
|
|
16
16
|
if (this.preview === "top" && !this.recycleBin) {
|
|
17
17
|
this.arcgisItemBrowserCardPreview.emit(this.item);
|
|
@@ -23,7 +23,7 @@ class O extends U {
|
|
|
23
23
|
}
|
|
24
24
|
this.selection === "multiple" && (this.selected = !this.selected, this.arcgisItemCardSelect.emit({ item: this.item, selected: this.selected }));
|
|
25
25
|
}
|
|
26
|
-
}, this.isLoaded = !1, this.selected = !1, this.selection = "none", this.view = "list", this.previewed = !1, this.showOwner = !0, this.showDateUpdated = !0, this.showItemType = !0, this.showItemTypeHosted = !1, this.showSummary = !1, this.showBadges = !0, this.showBadgeTooltips = !0, this.showFavorite = !1, this.showFavoriteInActionsMenu = !1, this.showAccess = !1, this.showThumbnail = !0, this.newTab = !1, this.disableSelection = !1, this.disabled = !1, this.actions = [], this.recycleBin = !1, this.arcgisItemBrowserCardPreview =
|
|
26
|
+
}, this.isLoaded = !1, this.selected = !1, this.selection = "none", this.view = "list", this.previewed = !1, this.showOwner = !0, this.showDateUpdated = !0, this.showItemType = !0, this.showItemTypeHosted = !1, this.showSummary = !1, this.showBadges = !0, this.showBadgeTooltips = !0, this.showFavorite = !1, this.showFavoriteInActionsMenu = !1, this.showAccess = !1, this.showThumbnail = !0, this.newTab = !1, this.disableSelection = !1, this.disabled = !1, this.actions = [], this.recycleBin = !1, this.arcgisItemBrowserCardPreview = _(), this.arcgisItemCardActionsOpen = _(), this.arcgisItemCardInternalUIAction = _(), this.arcgisItemCardSelect = _();
|
|
27
27
|
}
|
|
28
28
|
static {
|
|
29
29
|
this.properties = { isLoaded: 16, item: 0, user: 0, portal: 0, selected: 7, selection: 1, view: 1, preview: 1, previewed: 5, name: 1, showOwner: 5, showDateUpdated: 5, showItemType: 5, showItemTypeHosted: 5, showSummary: 5, showBadges: 5, showBadgeTooltips: 5, showFavorite: 5, showFavoriteInActionsMenu: 5, showAccess: 5, showThumbnail: 5, link: 1, linkHandler: 0, newTab: 5, disableSelection: 5, disabled: 7, userPopupZIndex: 9, actions: 0, recycleBin: 5, hideActionsStart: 5 };
|
|
@@ -32,7 +32,7 @@ class O extends U {
|
|
|
32
32
|
this.styles = E;
|
|
33
33
|
}
|
|
34
34
|
get sourceJSON() {
|
|
35
|
-
return
|
|
35
|
+
return z(this.item);
|
|
36
36
|
}
|
|
37
37
|
async restoreFocus() {
|
|
38
38
|
if (await this.updateComplete, this.link && this.linkEl.value) {
|
|
@@ -71,109 +71,109 @@ class O extends U {
|
|
|
71
71
|
return typeof s == "string" ? s : a;
|
|
72
72
|
}
|
|
73
73
|
getResolvedBaseUrl() {
|
|
74
|
-
return this.portal ? `${
|
|
74
|
+
return this.portal ? `${D({ portal: this.portal, usePortalHostname: !this.portal.user })}/home` : "";
|
|
75
75
|
}
|
|
76
76
|
renderUpdatedDetails(e) {
|
|
77
|
-
return
|
|
77
|
+
return i`<span class="item-card__detail item-card__detail--updated-short item-card__divider">${y(e, { dateStyle: "medium" })}</span><span class="item-card__detail item-card__detail--updated-full item-card__divider">${v(this.messages.lastUpdated ?? "", {
|
|
78
78
|
date: y(e, { dateStyle: "medium" })
|
|
79
79
|
})}</span>`;
|
|
80
80
|
}
|
|
81
81
|
renderSelectionInput(e, a = !1) {
|
|
82
|
-
const { selection: s, disableSelection:
|
|
82
|
+
const { selection: s, disableSelection: p, name: g, messages: f, item: c } = this, l = {
|
|
83
83
|
"item-card__input": !0,
|
|
84
84
|
"item-card__input--compact": a
|
|
85
85
|
};
|
|
86
86
|
switch (s) {
|
|
87
87
|
case "single":
|
|
88
|
-
return
|
|
89
|
-
|
|
88
|
+
return i`<calcite-radio-button class=${n(l)} .checked=${e} .disabled=${p} .value=${c.title ?? ""} .name=${g} @click=${(r) => {
|
|
89
|
+
r.stopPropagation();
|
|
90
90
|
}} @calciteRadioButtonChange=${() => {
|
|
91
91
|
this.selected = !0, this.arcgisItemCardSelect.emit({ item: c, selected: !0 });
|
|
92
|
-
}}><span class="screen-readers-only">${
|
|
92
|
+
}}><span class="screen-readers-only">${v(f.select ?? "", { title: c.title ?? "" })}</span></calcite-radio-button>`;
|
|
93
93
|
case "multiple":
|
|
94
|
-
return
|
|
95
|
-
|
|
94
|
+
return i`<calcite-checkbox class=${n(l)} .checked=${e} .disabled=${p} @click=${(r) => {
|
|
95
|
+
r.stopPropagation(), r.preventDefault();
|
|
96
96
|
}} @calciteCheckboxChange=${() => {
|
|
97
97
|
this.selected = !e, this.arcgisItemCardSelect.emit({ item: c, selected: !e });
|
|
98
98
|
}}><span class="screen-readers-only">${c.title ?? ""}</span></calcite-checkbox>`;
|
|
99
99
|
case "none":
|
|
100
100
|
return null;
|
|
101
101
|
default:
|
|
102
|
-
return
|
|
102
|
+
return F(s);
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
renderThumbnail(e, a) {
|
|
106
|
-
return this.showThumbnail ? a ?
|
|
106
|
+
return this.showThumbnail ? a ? i`<figure class="item-card__thumbnail item-card__thumbnail--grid"><arcgis-portal-item-thumbnail class="item-card__thumbnail-media" .item=${e} .portal=${this.portal}></arcgis-portal-item-thumbnail>${this.preview === "top" && !this.link && i`<div class="item-card__hover-text">${this.previewed ? this.messages.closePreview : this.messages.preview}</div>` || ""}${this.link?.includes(`item.html?id=${e.id}`) && i`<div class="item-card__hover-text">${this.messages.viewItemDetails}</div>` || ""}</figure>` : i`<figure class="item-card__thumbnail"><arcgis-portal-item-thumbnail class="item-card__thumbnail-media" .item=${e} .portal=${this.portal}></arcgis-portal-item-thumbnail></figure>` : null;
|
|
107
107
|
}
|
|
108
108
|
renderAccess(e) {
|
|
109
|
-
return this.showAccess ?
|
|
109
|
+
return this.showAccess ? i`<div class="item-card__access-wrap" @click=${(a) => {
|
|
110
110
|
a.preventDefault(), a.stopPropagation();
|
|
111
111
|
}}><slot name=sharing-summary><slot name=share-summary><span class="item-card__access"><calcite-icon .icon=${e.icon} scale=s class="item-card__detail__icon"></calcite-icon>${e.text}</span></slot></slot></div>` : null;
|
|
112
112
|
}
|
|
113
113
|
renderBadges() {
|
|
114
|
-
return !this.showBadges || !this.item || !this.portal ? null : this.view === "grid" ?
|
|
114
|
+
return !this.showBadges || !this.item || !this.portal ? null : this.view === "grid" ? i`<arcgis-portal-item-badges class="item-card__badges item-card__divider" .item=${this.item} .portal=${this.portal} .user=${this.user} scale=s appearance=outline-fill .showTooltips=${this.showBadgeTooltips} width=narrow></arcgis-portal-item-badges>` : i`<arcgis-portal-item-badges class="item-card__badges item-card__badges--compact item-card__divider" .item=${this.item} .portal=${this.portal} .user=${this.user} scale=s appearance=outline-fill .showTooltips=${this.showBadgeTooltips} width=narrow></arcgis-portal-item-badges><arcgis-portal-item-badges class="item-card__badges item-card__badges--responsive item-card__divider" .item=${this.item} .portal=${this.portal} .user=${this.user} scale=s appearance=outline-fill .showTooltips=${this.showBadgeTooltips} width=full></arcgis-portal-item-badges>`;
|
|
115
115
|
}
|
|
116
116
|
render() {
|
|
117
|
-
const { item: e, portal: a, user: s, selection:
|
|
117
|
+
const { item: e, portal: a, user: s, selection: p, isLoaded: g, disabled: f, link: c, newTab: l } = this;
|
|
118
118
|
if (!e || !a || !this.messages._lang)
|
|
119
119
|
return;
|
|
120
|
-
const
|
|
121
|
-
return
|
|
120
|
+
const r = this.sourceJSON, h = r.modified || e.modified, C = this.getAccessInfo(r.access), o = this.view === "grid", d = this.selected, w = this.preview === "action" && !this.recycleBin, b = this.actions.length > 0 || this.showFavoriteInActionsMenu, $ = this.showFavorite && !this.showFavoriteInActionsMenu && !!s, T = b || $ || w, A = (this.showAccess || o && this.showOwner) && T, m = this.preview === "top" && !c;
|
|
121
|
+
return i`<section class=${n({
|
|
122
122
|
"item-card": !0,
|
|
123
123
|
"item-card--grid": o,
|
|
124
|
-
"item-card--hoverable":
|
|
125
|
-
"item-card--selected":
|
|
126
|
-
"item-card--disabled":
|
|
127
|
-
"item-card--loaded":
|
|
128
|
-
"item-card--previewed": this.previewed &&
|
|
129
|
-
})} @click=${c ? void 0 : this.handleCardClick} .tabIndex=${
|
|
130
|
-
|
|
131
|
-
}} ${I(this.sectionEl)}><slot name=content-top></slot>${c ?
|
|
132
|
-
if (this.linkHandler && !
|
|
133
|
-
|
|
124
|
+
"item-card--hoverable": p !== "none",
|
|
125
|
+
"item-card--selected": d,
|
|
126
|
+
"item-card--disabled": f,
|
|
127
|
+
"item-card--loaded": g,
|
|
128
|
+
"item-card--previewed": this.previewed && m
|
|
129
|
+
})} @click=${c ? void 0 : this.handleCardClick} .tabIndex=${m ? 0 : -1} .role=${m ? "button" : void 0} aria-haspopup=${(m ? "dialog" : void 0) ?? u} @keydown=${(t) => {
|
|
130
|
+
m && (t.key === "Enter" || t.key === " ") && (t.preventDefault(), this.handleCardClick());
|
|
131
|
+
}} ${I(this.sectionEl)}><slot name=content-top></slot>${c ? i`<a class="item-card__upper item-card__upper--link" href=${c ?? u} target=${(l ? "_blank" : void 0) ?? u} rel=${(l ? "noopener noreferrer" : void 0) ?? u} @click=${(t) => {
|
|
132
|
+
if (this.linkHandler && !t.ctrlKey && !t.metaKey) {
|
|
133
|
+
t.preventDefault(), this.linkHandler(this.item);
|
|
134
134
|
return;
|
|
135
135
|
}
|
|
136
|
-
const
|
|
137
|
-
|
|
138
|
-
}} ${I(this.linkEl)}>${
|
|
136
|
+
const x = t.target;
|
|
137
|
+
x instanceof HTMLElement && x.closest(".item-card__footer") && t.preventDefault();
|
|
138
|
+
}} ${I(this.linkEl)}>${i`${o && this.renderThumbnail(e, !0) || ""}<div class="item-card-flex item-card__top">${!o && this.renderSelectionInput(d, !0) || ""}<div class="item-card-flex-1"><div class="item-card-flex"><div class="item-card__content"><div class="item-card-flex"><h3 class=${n({
|
|
139
139
|
"item-card__title": !0,
|
|
140
140
|
"item-card__title--grid": o,
|
|
141
|
-
"item-card__title--padded": this.showItemType || this.showSummary && !!
|
|
141
|
+
"item-card__title--padded": this.showItemType || this.showSummary && !!r.snippet,
|
|
142
142
|
"item-card-flex-1": !0
|
|
143
|
-
})}><span class="item-card__title__span">${
|
|
143
|
+
})}><span class="item-card__title__span">${r.title ?? e.title ?? ""}</span></h3>${o && this.renderSelectionInput(d) || ""}</div>${this.showSummary && !!r.snippet && i`<p class="item-card__summary">${r.snippet.length > 250 ? `${r.snippet.substring(0, 250)}...` : r.snippet}</p>` || ""}<div class="item-card__details">${this.showItemType && i`<arcgis-portal-item-type class="item-card__divider item-card-item-type" ellipsis .user=${s} .showHosted=${this.showItemTypeHosted} scale=s .item=${e} .portal=${a}></arcgis-portal-item-type>` || ""}${this.showDateUpdated && !!h && this.renderUpdatedDetails(h) || ""}${this.renderBadges()}</div></div>${!o && this.renderThumbnail(e, !1) || ""}</div><div class="item-card__content-end"><slot name=content-end></slot></div></div></div>`}</a>` : i`<div class="item-card__upper">${o && this.renderThumbnail(e, !0) || ""}<div class="item-card-flex item-card__top">${!o && this.renderSelectionInput(d, !0) || ""}<div class="item-card-flex-1"><div class="item-card-flex"><div class="item-card__content"><div class="item-card-flex"><h3 class=${n({
|
|
144
144
|
"item-card__title": !0,
|
|
145
145
|
"item-card__title--grid": o,
|
|
146
|
-
"item-card__title--padded": this.showItemType || this.showSummary && !!
|
|
146
|
+
"item-card__title--padded": this.showItemType || this.showSummary && !!r.snippet,
|
|
147
147
|
"item-card-flex-1": !0
|
|
148
|
-
})}><span class="item-card__title__span">${
|
|
149
|
-
|
|
150
|
-
}}></arcgis-portal-user-popup></div>` || ""}</div>${this.renderAccess(C)}${A &&
|
|
148
|
+
})}><span class="item-card__title__span">${r.title ?? e.title ?? ""}</span></h3>${o && this.renderSelectionInput(d) || ""}</div>${this.showSummary && !!r.snippet && i`<p class="item-card__summary">${r.snippet.length > 250 ? `${r.snippet.substring(0, 250)}...` : r.snippet}</p>` || ""}<div class="item-card__details">${this.showItemType && i`<arcgis-portal-item-type class="item-card__divider item-card-item-type" ellipsis .user=${s} .showHosted=${this.showItemTypeHosted} scale=s .item=${e} .portal=${a}></arcgis-portal-item-type>` || ""}${this.showDateUpdated && !!h && this.renderUpdatedDetails(h) || ""}${this.renderBadges()}</div></div>${!o && this.renderThumbnail(e, !1) || ""}</div><div class="item-card__content-end"><slot name=content-end></slot></div></div></div></div>`}<div class="item-card__footer"><div class=${n({ "item-card__footer__start": !0, "item-card__footer__start--owner": this.showOwner })}>${!this.hideActionsStart && i`<slot name=actions-start></slot>` || ""}${this.showOwner && !!r.owner && i`<div class="item-card__profile-wrap"><arcgis-portal-user-popup class="item-card__owner" .portal=${a} .username=${r.owner} .baseUrl=${this.getResolvedBaseUrl()} underline .zIndex=${this.userPopupZIndex} @arcgisUserPopupInternalUIAction=${(t) => {
|
|
149
|
+
t.stopPropagation(), this.arcgisItemCardInternalUIAction.emit(t.detail);
|
|
150
|
+
}}></arcgis-portal-user-popup></div>` || ""}</div>${this.renderAccess(C)}${A && i`<span class="item-card__footer-divider"></span>` || ""}${$ && i`<slot name=favorite-action><arcgis-portal-item-favorite .item=${e} .portal=${a} .user=${s} icon-only scale=s show-tooltip @arcgisItemFavoriteUpdate=${() => {
|
|
151
151
|
this.arcgisItemCardInternalUIAction.emit({
|
|
152
152
|
category: "card action",
|
|
153
153
|
action: "favorite"
|
|
154
154
|
});
|
|
155
|
-
}}></arcgis-portal-item-favorite></slot>` || ""}${
|
|
156
|
-
|
|
157
|
-
}}>${this.messages.preview}</calcite-button>` || ""}${
|
|
158
|
-
title:
|
|
159
|
-
})} .showFavorite=${this.showFavoriteInActionsMenu && !!s} @arcgisItemActionsOpen=${(
|
|
160
|
-
|
|
155
|
+
}}></arcgis-portal-item-favorite></slot>` || ""}${w && i`<calcite-button scale=s class="item-card__preview-button" .appearance=${this.previewed ? "solid" : "outline"} kind=neutral @click=${(t) => {
|
|
156
|
+
t.preventDefault(), t.stopPropagation(), this.arcgisItemBrowserCardPreview.emit(this.item);
|
|
157
|
+
}}>${this.messages.preview}</calcite-button>` || ""}${b && i`<arcgis-portal-item-actions .item=${e} .portal=${a} .user=${s} .actions=${this.actions} .label=${v(this.getMessage("itemActions", "Item actions for {title}"), {
|
|
158
|
+
title: r.title ?? e.title ?? ""
|
|
159
|
+
})} .showFavorite=${this.showFavoriteInActionsMenu && !!s} @arcgisItemActionsOpen=${(t) => {
|
|
160
|
+
t.stopPropagation(), this.arcgisItemCardActionsOpen.emit({
|
|
161
161
|
actions: this.actions,
|
|
162
|
-
el:
|
|
162
|
+
el: t.detail.el
|
|
163
163
|
});
|
|
164
|
-
}} @arcgisItemActionClick=${(
|
|
165
|
-
|
|
164
|
+
}} @arcgisItemActionClick=${(t) => {
|
|
165
|
+
t.stopPropagation(), this.arcgisItemCardInternalUIAction.emit({
|
|
166
166
|
category: "card action",
|
|
167
167
|
action: "more options",
|
|
168
|
-
attribute:
|
|
168
|
+
attribute: t.detail
|
|
169
169
|
});
|
|
170
|
-
}} @arcgisItemFavoriteUpdate=${(
|
|
171
|
-
|
|
170
|
+
}} @arcgisItemFavoriteUpdate=${(t) => {
|
|
171
|
+
t.stopPropagation(), this.arcgisItemCardInternalUIAction.emit({
|
|
172
172
|
category: "card action",
|
|
173
173
|
action: "favorite"
|
|
174
174
|
});
|
|
175
|
-
}}></arcgis-portal-item-actions>` || ""}<div @click=${(
|
|
176
|
-
|
|
175
|
+
}}></arcgis-portal-item-actions>` || ""}<div @click=${(t) => {
|
|
176
|
+
t.stopPropagation();
|
|
177
177
|
}}><slot name=actions-end></slot></div></div></section>`;
|
|
178
178
|
}
|
|
179
179
|
}
|
|
@@ -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";
|