@arcgis/portal-components 5.2.0-next.0 → 5.2.0-next.10
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/{N46PAVP2.js → 3MQIRMUM.js} +10 -7
- package/dist/cdn/{CI5ENGVT.js → 462NPCQK.js} +1 -1
- package/dist/cdn/{G47ZZQYL.js → 46Q4UJRT.js} +1 -1
- package/dist/cdn/{JC2MGN34.js → 53MSUMA3.js} +0 -1
- package/dist/cdn/{4X3AIQJM.js → 546F7RE5.js} +66 -66
- package/dist/cdn/{K3HS2LQ7.js → 5ZNQZDQO.js} +1 -1
- package/dist/cdn/{5DPWJ7DI.js → BEX567FX.js} +1 -1
- package/dist/cdn/BLB544VG.js +3 -0
- package/dist/cdn/{OQDPULPD.js → C4D4PGO3.js} +1 -1
- package/dist/cdn/DFTUMKSN.js +3 -0
- package/dist/cdn/E7DG4PTT.js +2 -0
- package/dist/cdn/{GNOZCQ34.js → IHKNWGHP.js} +1 -1
- package/dist/cdn/{LQ3DMZ3K.js → L46YEW4Y.js} +1 -1
- package/dist/cdn/{TMYTUOSS.js → OLRMKR7F.js} +1 -1
- package/dist/cdn/QB34ACZ2.js +2 -0
- package/dist/cdn/{YMPTDKT6.js → RXSGAKUU.js} +1 -1
- package/dist/cdn/{GHQ3ZW4U.js → SBMN77ZZ.js} +1 -1
- package/dist/cdn/SIN2A4UX.js +65 -0
- package/dist/cdn/{YG5YYL6X.js → SJC3537M.js} +1 -1
- package/dist/cdn/{BEHLBKKM.js → SV2O3ZZ7.js} +1 -1
- package/dist/cdn/T7NAWRYB.js +2 -0
- package/dist/cdn/UFM62DQ3.js +2 -0
- package/dist/cdn/{2UUZHENH.js → UPEVTVNZ.js} +1 -1
- package/dist/cdn/{OLCAIYIA.js → W6PSG4GX.js} +18 -5
- package/dist/cdn/{JNRN6DTV.js → XHASDTZ3.js} +1 -1
- package/dist/cdn/assets/portal-group-badges/t9n/messages.en.json +1 -0
- package/dist/cdn/assets/portal-group-card/t9n/messages.en.json +1 -0
- package/dist/cdn/assets/portal-user-popup/t9n/messages.en.json +1 -0
- package/dist/cdn/index.js +1 -1
- package/dist/cdn/main.css +1 -1
- package/dist/chunks/user2.js +26 -25
- package/dist/components/arcgis-portal-ai-assistant/customElement.js +2 -2
- package/dist/components/arcgis-portal-ai-assistant-interrupt/customElement.js +10 -10
- package/dist/components/arcgis-portal-group-badges/customElement.d.ts +102 -0
- package/dist/components/arcgis-portal-group-badges/customElement.js +58 -0
- package/dist/components/arcgis-portal-group-badges/index.d.ts +1 -0
- package/dist/components/arcgis-portal-group-badges/index.js +3 -0
- package/dist/components/arcgis-portal-group-badges/types.d.ts +3 -0
- package/dist/components/arcgis-portal-group-card/customElement.d.ts +167 -0
- package/dist/components/arcgis-portal-group-card/customElement.js +187 -0
- package/dist/components/arcgis-portal-group-card/index.d.ts +1 -0
- package/dist/components/arcgis-portal-group-card/index.js +8 -0
- package/dist/components/arcgis-portal-group-thumbnail/customElement.d.ts +32 -0
- package/dist/components/arcgis-portal-group-thumbnail/customElement.js +153 -0
- package/dist/components/arcgis-portal-group-thumbnail/index.d.ts +1 -0
- package/dist/components/arcgis-portal-group-thumbnail/index.js +3 -0
- package/dist/components/arcgis-portal-replacement-item-redirect/customElement.js +3 -3
- package/dist/components/arcgis-portal-user-popup/customElement.d.ts +111 -0
- package/dist/components/arcgis-portal-user-popup/customElement.js +231 -0
- package/dist/components/arcgis-portal-user-popup/index.d.ts +1 -0
- package/dist/components/arcgis-portal-user-popup/index.js +5 -0
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/vscode.html-custom-data.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/index.d.ts +30 -2
- package/dist/loader.js +7 -3
- package/dist/types/lumina.d.ts +25 -0
- package/dist/types/preact.d.ts +29 -0
- package/dist/types/react.d.ts +33 -0
- package/dist/types/stencil.d.ts +25 -0
- package/dist/types/tracking.d.ts +10 -0
- package/dist/types/user.d.ts +2 -2
- package/package.json +7 -7
- package/dist/cdn/KEKBRUUC.js +0 -2
- package/dist/cdn/SM4GWLRA.js +0 -66
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import { c as k } from "../../chunks/runtime.js";
|
|
3
|
+
import { css as y, html as r } from "lit";
|
|
4
|
+
import { LitElement as C, createEvent as w, safeClassMap as g, nothing as l } from "@arcgis/lumina";
|
|
5
|
+
import { createRef as F, ref as $ } from "lit/directives/ref.js";
|
|
6
|
+
import { u as z } from "../../chunks/useT9n.js";
|
|
7
|
+
import { a as E } from "../../chunks/functionalities.js";
|
|
8
|
+
const o = {
|
|
9
|
+
md: 840,
|
|
10
|
+
sm: 580,
|
|
11
|
+
xs: 480,
|
|
12
|
+
xxs: 360
|
|
13
|
+
}, B = y`:host{display:block;min-width:0}.group-card{position:relative;display:flex;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}}.group-card--loaded{opacity:1}.group-card--selected{border-color:var(--calcite-color-brand)}.group-card--hoverable{cursor:pointer}.group-card--disabled{opacity:.5}.group-card__top{padding:1rem}.group-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}.group-card__upper:hover{background-color:var(--calcite-color-background)}.group-card__upper--compact{display:flex;align-items:center;padding:.5rem .75rem}.group-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}}.group-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}.group-card--previewed .group-card__title__span{background-image:linear-gradient(var(--calcite-color-text-3),var(--calcite-color-text-3))}.group-card__content{display:flex;min-width:0;flex:1 1 0%;flex-direction:column}.group-card__details{display:flex;flex-direction:row;flex-wrap:wrap}.group-card__details--stacked{flex-direction:column}.group-card__detail{font-size:.875rem;color:var(--calcite-color-text-2)}.group-card__detail__icon{margin-inline-end:.5rem}.group-card__footer{margin-top:auto;display:flex;align-items:center;background-color:var(--calcite-color-foreground-1);padding:.5rem 1rem;border-top:1px solid var(--calcite-color-border-3)}.group-card__footer__start{display:flex;min-width:0;flex:1 1 0%;flex-direction:row;align-items:center;overflow:hidden;margin-inline-end:.75rem}.group-card__profile-wrap{max-width:100%;padding:.25rem}.group-card__divider{display:flex;align-items:center;flex:0 0 auto}.group-card__divider:not([empty]):before{content:"";height:1.25rem;width:1px;background-color:var(--calcite-color-border-1);margin-inline:.75rem}.group-card__details--stacked .group-card__divider:before{display:none}.group-card__divider:first-child:before{display:none}.group-card-flex{display:flex}.group-card-flex-1{min-width:0;flex:1 1 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}.group-card__input{margin-inline-end:1rem;margin-top:.125rem}.group-card__title{margin:0;overflow-wrap:break-word;padding:0;font-size:1rem;font-weight:500;line-height:1.375}.group-card__title--compact{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin-inline-end:1rem}.group-card__summary{margin:.25rem 0;flex:1 1 0%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0;font-size:.875rem;line-height:1.25}.group-card__thumbnail{margin-inline-end:1rem}.group-card__thumbnail--compact{width:2.75rem;height:2.75rem}.group-card__badges{margin-top:.25rem}.group-card__owner{min-width:0}.group-card--xs,.group-card--xxs{.group-card__top{padding:.75rem}.group-card__title--padded{margin-bottom:.25rem}.group-card__footer{padding:.25rem .75rem}.group-card__detail{margin:.25rem 0;font-size:.75rem;line-height:1.35}.group-card__title{font-size:.875rem}}.group-card--xxs{.group-card__thumbnail{padding-inline-start:.75rem;width:4.25rem}}.group-card--xs{.group-card__thumbnail{padding-inline-start:.5rem;width:5rem}}`;
|
|
14
|
+
class D extends C {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments), this.messages = z({ blocking: !0 }), this.sectionEl = F(), this.resizeObserver = null, this.handleCardClick = (e) => {
|
|
17
|
+
if (!(this.link || this.disabled || e?.target?.closest(".group-card__footer"))) {
|
|
18
|
+
if (this.preview === "top") {
|
|
19
|
+
this.arcgisGroupBrowserCardPreview.emit(this.group);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (this.selection === "single") {
|
|
23
|
+
this.selected = !0, this.arcgisGroupCardSelect.emit({ group: this.group, selected: !0 });
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
this.selection === "multiple" && (this.selected = !this.selected, this.arcgisGroupCardSelect.emit({ group: this.group, selected: this.selected }));
|
|
27
|
+
}
|
|
28
|
+
}, this.formFactor = "lg", this.width = 0, this.hover = !1, this.selected = !1, this.indeterminate = !1, this.view = "list", this.selection = "none", this.previewed = !1, this.showOwner = !0, this.showDateUpdated = !0, this.showDateCreated = !1, this.showViewableBy = !0, this.showSummary = !1, this.showBadges = !0, this.newTab = !1, this.disabled = !1, this.arcgisGroupBrowserCardPreview = w(), this.arcgisGroupCardSelect = w(), this.arcgisGroupBrowserInternalUIAction = w(), this.loaded = !1;
|
|
29
|
+
}
|
|
30
|
+
static {
|
|
31
|
+
this.properties = { formFactor: 16, width: 16, hover: 16, group: 0, user: 0, portal: 0, selected: 7, indeterminate: 7, view: 1, selection: 1, preview: 1, previewed: 5, name: 1, showOwner: 5, showDateUpdated: 5, showDateCreated: 5, showViewableBy: 5, showSummary: 5, showBadges: 5, link: 1, linkHandler: 0, newTab: 5, disabled: 7, loaded: 16 };
|
|
32
|
+
}
|
|
33
|
+
static {
|
|
34
|
+
this.styles = B;
|
|
35
|
+
}
|
|
36
|
+
async restoreFocus() {
|
|
37
|
+
if (this.link) {
|
|
38
|
+
this.renderRoot.querySelector(".group-card__upper")?.focus();
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
this.preview === "top" && this.sectionEl.value && this.sectionEl.value.focus();
|
|
42
|
+
}
|
|
43
|
+
connectedCallback() {
|
|
44
|
+
super.connectedCallback(), !(typeof ResizeObserver > "u") && (this.resizeObserver = new ResizeObserver((e) => {
|
|
45
|
+
const t = e[0]?.contentRect.width ?? 0;
|
|
46
|
+
this.updateFormFactor(t);
|
|
47
|
+
}));
|
|
48
|
+
}
|
|
49
|
+
firstUpdated() {
|
|
50
|
+
if (this.sectionEl.value && this.resizeObserver) {
|
|
51
|
+
this.resizeObserver.observe(this.sectionEl.value);
|
|
52
|
+
const e = this.sectionEl.value.getBoundingClientRect().width;
|
|
53
|
+
this.updateFormFactor(e);
|
|
54
|
+
}
|
|
55
|
+
requestAnimationFrame(() => {
|
|
56
|
+
this.loaded = !0;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
disconnectedCallback() {
|
|
60
|
+
this.resizeObserver?.disconnect(), this.resizeObserver = null, super.disconnectedCallback();
|
|
61
|
+
}
|
|
62
|
+
updateFormFactor(e) {
|
|
63
|
+
if (this.width = e, e > o.md) {
|
|
64
|
+
this.formFactor = "lg";
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
if (e > o.sm) {
|
|
68
|
+
this.formFactor = "md";
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
if (e > o.xs) {
|
|
72
|
+
this.formFactor = "sm";
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (e > o.xxs) {
|
|
76
|
+
this.formFactor = "xs";
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
this.formFactor = "xxs";
|
|
80
|
+
}
|
|
81
|
+
getAccessInfo(e) {
|
|
82
|
+
const { messages: t } = this, c = {
|
|
83
|
+
public: {
|
|
84
|
+
icon: "globe",
|
|
85
|
+
text: t.everyone
|
|
86
|
+
},
|
|
87
|
+
private: {
|
|
88
|
+
icon: "lock",
|
|
89
|
+
text: t.groupMembers
|
|
90
|
+
},
|
|
91
|
+
org: {
|
|
92
|
+
icon: "organization",
|
|
93
|
+
text: t.organization
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
return c[e] ?? c.private;
|
|
97
|
+
}
|
|
98
|
+
formatDate(e) {
|
|
99
|
+
return e ? new Intl.DateTimeFormat(void 0, { dateStyle: "medium" }).format(e) : "";
|
|
100
|
+
}
|
|
101
|
+
getThumbnailGroup(e) {
|
|
102
|
+
return {
|
|
103
|
+
id: e.id ?? void 0,
|
|
104
|
+
thumbnailUrl: e.thumbnailUrl ?? void 0,
|
|
105
|
+
title: e.title ?? void 0
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
renderSelectionInput() {
|
|
109
|
+
const { selection: e, selected: t, disabled: c, name: h, messages: _, group: a } = this;
|
|
110
|
+
switch (e) {
|
|
111
|
+
case "single":
|
|
112
|
+
return r`<calcite-radio-button class="group-card__input" .checked=${t} .disabled=${c} .value=${a.title ?? ""} .name=${h} @click=${(s) => s.stopPropagation()} @calciteRadioButtonChange=${() => {
|
|
113
|
+
this.arcgisGroupCardSelect.emit({ group: a, selected: !t });
|
|
114
|
+
}}><span class="screen-readers-only">${(_.select ?? "").replace("${title}", a.title ?? "")}</span></calcite-radio-button>`;
|
|
115
|
+
case "multiple":
|
|
116
|
+
return r`<calcite-checkbox class="group-card__input" .checked=${t} .disabled=${c} .indeterminate=${this.indeterminate} @click=${(s) => s.stopPropagation()} @calciteCheckboxChange=${() => {
|
|
117
|
+
const s = !this.selected;
|
|
118
|
+
this.selected = s, this.arcgisGroupCardSelect.emit({ group: a, selected: s });
|
|
119
|
+
}}><span class="screen-readers-only">${a.title}</span></calcite-checkbox>`;
|
|
120
|
+
case "none":
|
|
121
|
+
return null;
|
|
122
|
+
default:
|
|
123
|
+
return E(e);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
renderCompactView() {
|
|
127
|
+
const { group: e, selection: t, formFactor: c, loaded: h, disabled: _, link: a, showBadges: s, newTab: m, linkHandler: d, handleCardClick: n, selected: p } = this, f = this.getThumbnailGroup(e);
|
|
128
|
+
return r`<section class=${g({
|
|
129
|
+
"group-card": !0,
|
|
130
|
+
"group-card--hoverable": t !== "none",
|
|
131
|
+
"group-card--selected": p,
|
|
132
|
+
"group-card--disabled": _,
|
|
133
|
+
"group-card--loaded": h,
|
|
134
|
+
[`group-card--${c}`]: !0
|
|
135
|
+
})} @click=${a ? void 0 : n} @mouseover=${() => {
|
|
136
|
+
this.hover = !0;
|
|
137
|
+
}} @mouseout=${() => {
|
|
138
|
+
this.hover = !1;
|
|
139
|
+
}} ${$(this.sectionEl)}>${a ? r`<a class="group-card__upper group-card__upper--compact group-card__upper--link" href=${a ?? l} target=${(m ? "_blank" : void 0) ?? l} rel=${(m ? "noopener noreferrer" : void 0) ?? l} @click=${(u) => {
|
|
140
|
+
d && !u.ctrlKey && !u.metaKey && (u.preventDefault(), d(this.group));
|
|
141
|
+
}}>${r`${this.renderSelectionInput()}<div class="group-card__thumbnail group-card__thumbnail--compact"><arcgis-portal-group-thumbnail .group=${f} .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>${s && r`<arcgis-portal-group-badges .group=${e} .portal=${this.portal} class="group-card__badges--compact" scale=s show-tooltips width=narrow></arcgis-portal-group-badges>` || ""}</div><slot name=content-end></slot>`}</a>` : r`<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=${f} .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>${s && r`<arcgis-portal-group-badges .group=${e} .portal=${this.portal} class="group-card__badges--compact" scale=s show-tooltips width=narrow></arcgis-portal-group-badges>` || ""}</div><slot name=content-end></slot></div>`}</section>`;
|
|
142
|
+
}
|
|
143
|
+
render() {
|
|
144
|
+
const { group: e, selection: t, formFactor: c, loaded: h, disabled: _, link: a, showDateCreated: s, showDateUpdated: m, showSummary: d, showBadges: n } = this;
|
|
145
|
+
if (!e || !this.messages._lang)
|
|
146
|
+
return;
|
|
147
|
+
if (this.view === "compact")
|
|
148
|
+
return this.renderCompactView();
|
|
149
|
+
const p = this.getAccessInfo(e.access ?? "private"), f = this.getThumbnailGroup(e), u = this.width < o.sm, v = this.preview === "top" && !a, { previewed: x } = this;
|
|
150
|
+
return r`<section class=${g({
|
|
151
|
+
"group-card": !0,
|
|
152
|
+
"group-card--hoverable": t !== "none",
|
|
153
|
+
"group-card--selected": this.selected,
|
|
154
|
+
"group-card--disabled": _,
|
|
155
|
+
"group-card--loaded": h,
|
|
156
|
+
[`group-card--${c}`]: !0,
|
|
157
|
+
"group-card--previewed": x
|
|
158
|
+
})} @click=${a ? void 0 : this.handleCardClick} tabindex=${(v ? 0 : void 0) ?? l} .role=${v ? "button" : void 0} aria-haspopup=${(v ? "dialog" : void 0) ?? l} @keydown=${(i) => {
|
|
159
|
+
v && (i.key === "Enter" || i.key === " ") && (i.preventDefault(), this.handleCardClick());
|
|
160
|
+
}} ${$(this.sectionEl)}><slot name=content-top></slot>${a ? r`<a class="group-card__upper group-card__upper--link" href=${this.link ?? l} target=${(this.newTab ? "_blank" : void 0) ?? l} rel=${(this.newTab ? "noopener noreferrer" : void 0) ?? l} @mouseover=${() => {
|
|
161
|
+
this.hover = !0;
|
|
162
|
+
}} @mouseout=${() => {
|
|
163
|
+
this.hover = !1;
|
|
164
|
+
}} @click=${(i) => {
|
|
165
|
+
if (this.linkHandler && !i.ctrlKey && !i.metaKey) {
|
|
166
|
+
i.preventDefault(), this.linkHandler(this.group);
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
const b = i.target;
|
|
170
|
+
b instanceof HTMLElement && b.closest(".group-card__footer") && i.preventDefault();
|
|
171
|
+
}}>${r`<div class="group-card-flex group-card__top">${this.renderSelectionInput()}<div class="group-card__thumbnail"><arcgis-portal-group-thumbnail .group=${f} .portal=${this.portal} scale=xl></arcgis-portal-group-thumbnail></div><div class="group-card-flex-1"><div class="group-card-flex"><div class="group-card__content"><h3 class=${g({ "group-card__title": !0, "group-card__title--padded": d && !!e.snippet })}><span class="group-card__title__span">${e.title}</span></h3>${d && !!e.snippet && r`<p class="group-card__summary">${e.snippet.length > 250 ? `${e.snippet.substring(0, 250)}...` : e.snippet}</p>` || ""}<div class=${g({ "group-card__details": !0, "group-card__details--stacked": u })}>${s && !!e.created && r`<span class="group-card__detail group-card__divider">${(this.messages.created ?? "").replace("${date}", this.formatDate(e.created))}</span>` || ""}${m && !!e.modified && r`<span class="group-card__detail group-card__divider">${(this.messages.lastUpdated ?? "").replace("${date}", this.formatDate(e.modified))}</span>` || ""}${this.showViewableBy && r`<span class="group-card__detail group-card__divider"><calcite-icon class="group-card__detail__icon" .icon=${p.icon} scale=s></calcite-icon>${(this.messages.viewableBy ?? "").replace("${level}", p.text)}</span>` || ""}${n && this.width >= o.sm && r`<arcgis-portal-group-badges .appearance=${this.hover ? "outline-fill" : "solid"} .group=${e} .portal=${this.portal} .width=${this.width < o.md ? "narrow" : "full"} class="group-card__badges group-card__detail group-card__divider" scale=s show-tooltips></arcgis-portal-group-badges>` || ""}</div>${n && this.width < o.sm && r`<arcgis-portal-group-badges .appearance=${this.hover ? "outline-fill" : "solid"} .group=${e} .portal=${this.portal} .width=${this.width < o.xxs ? "narrow" : "full"} class="group-card__badges" scale=s show-tooltips></arcgis-portal-group-badges>` || ""}<slot name=content-end></slot></div></div></div></div>`}</a>` : r`<div class="group-card__upper" @mouseover=${() => {
|
|
172
|
+
this.hover = !0;
|
|
173
|
+
}} @mouseout=${() => {
|
|
174
|
+
this.hover = !1;
|
|
175
|
+
}}><div class="group-card-flex group-card__top">${this.renderSelectionInput()}<div class="group-card__thumbnail"><arcgis-portal-group-thumbnail .group=${f} .portal=${this.portal} scale=xl></arcgis-portal-group-thumbnail></div><div class="group-card-flex-1"><div class="group-card-flex"><div class="group-card__content"><h3 class=${g({ "group-card__title": !0, "group-card__title--padded": d && !!e.snippet })}><span class="group-card__title__span">${e.title}</span></h3>${d && !!e.snippet && r`<p class="group-card__summary">${e.snippet.length > 250 ? `${e.snippet.substring(0, 250)}...` : e.snippet}</p>` || ""}<div class=${g({ "group-card__details": !0, "group-card__details--stacked": u })}>${s && !!e.created && r`<span class="group-card__detail group-card__divider">${(this.messages.created ?? "").replace("${date}", this.formatDate(e.created))}</span>` || ""}${m && !!e.modified && r`<span class="group-card__detail group-card__divider">${(this.messages.lastUpdated ?? "").replace("${date}", this.formatDate(e.modified))}</span>` || ""}${this.showViewableBy && r`<span class="group-card__detail group-card__divider"><calcite-icon class="group-card__detail__icon" .icon=${p.icon} scale=s></calcite-icon>${(this.messages.viewableBy ?? "").replace("${level}", p.text)}</span>` || ""}${n && this.width >= o.sm && r`<arcgis-portal-group-badges .appearance=${this.hover ? "outline-fill" : "solid"} .group=${e} .portal=${this.portal} .width=${this.width < o.md ? "narrow" : "full"} class="group-card__badges group-card__detail group-card__divider" scale=s show-tooltips></arcgis-portal-group-badges>` || ""}</div>${n && this.width < o.sm && r`<arcgis-portal-group-badges .appearance=${this.hover ? "outline-fill" : "solid"} .group=${e} .portal=${this.portal} .width=${this.width < o.xxs ? "narrow" : "full"} class="group-card__badges" scale=s show-tooltips></arcgis-portal-group-badges>` || ""}<slot name=content-end></slot></div></div></div></div></div>`}<div class="group-card__footer"><div class="group-card__footer__start"><slot name=actions-start></slot>${this.showOwner && r`<div class="group-card__profile-wrap"><arcgis-portal-user-popup class="group-card__owner" .portal=${this.portal} .username=${e.owner ?? void 0} underline @arcgisUserPopupInternalUIAction=${({ detail: i, stopPropagation: b }) => {
|
|
176
|
+
b(), this.arcgisGroupBrowserInternalUIAction.emit(i);
|
|
177
|
+
}}></arcgis-portal-user-popup></div>` || ""}</div><div>${this.preview === "action" && r`<calcite-button scale=s appearance=outline-fill kind=neutral @click=${() => {
|
|
178
|
+
this.arcgisGroupBrowserCardPreview.emit(this.group);
|
|
179
|
+
}}>${this.previewed ? this.messages.hidePreview : this.messages.preview}</calcite-button>` || ""}<div @click=${(i) => {
|
|
180
|
+
i.stopPropagation();
|
|
181
|
+
}}><slot name=actions-end></slot></div></div></div></section>`;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
k("arcgis-portal-group-card", D);
|
|
185
|
+
export {
|
|
186
|
+
D as ArcgisPortalGroupCard
|
|
187
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./customElement.js";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import "@esri/calcite-components/components/calcite-radio-button";
|
|
2
|
+
import "@esri/calcite-components/components/calcite-checkbox";
|
|
3
|
+
import "../arcgis-portal-group-thumbnail/index.js";
|
|
4
|
+
import "../arcgis-portal-group-badges/index.js";
|
|
5
|
+
import "@esri/calcite-components/components/calcite-icon";
|
|
6
|
+
import "../arcgis-portal-user-popup/index.js";
|
|
7
|
+
import "@esri/calcite-components/components/calcite-button";
|
|
8
|
+
export * from "./customElement.js";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/// <reference path="../../index.d.ts" />
|
|
2
|
+
import type Portal from "@arcgis/core/portal/Portal.js";
|
|
3
|
+
import type { PublicLitElement as LitElement } from "@arcgis/lumina";
|
|
4
|
+
import type { Scale } from "../../types/ui.js";
|
|
5
|
+
|
|
6
|
+
export abstract class ArcgisPortalGroupThumbnail extends LitElement {
|
|
7
|
+
/** Group data used to render thumbnail image or fallback initials. */
|
|
8
|
+
accessor group: GroupThumbnail | undefined;
|
|
9
|
+
/** Current portal instance used for tokenized thumbnail URL generation. */
|
|
10
|
+
accessor portal: Portal | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Component scale.
|
|
13
|
+
*
|
|
14
|
+
* @default "m"
|
|
15
|
+
*/
|
|
16
|
+
accessor scale: GroupThumbnailScale;
|
|
17
|
+
/**
|
|
18
|
+
* Whether to show tooltip on hover/focus.
|
|
19
|
+
*
|
|
20
|
+
* @default false
|
|
21
|
+
*/
|
|
22
|
+
accessor tooltip: boolean;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export type GroupThumbnailScale = Scale | "xl";
|
|
26
|
+
|
|
27
|
+
export type GroupThumbnail = {
|
|
28
|
+
id?: string;
|
|
29
|
+
thumbnail?: string;
|
|
30
|
+
thumbnailUrl?: string;
|
|
31
|
+
title?: string;
|
|
32
|
+
};
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import { c as p } from "../../chunks/runtime.js";
|
|
3
|
+
import { LitElement as m, nothing as f, safeStyleMap as g } from "@arcgis/lumina";
|
|
4
|
+
import { css as d, html as l } from "lit";
|
|
5
|
+
import { createRef as c, ref as h } from "lit/directives/ref.js";
|
|
6
|
+
import { a as $, g as b } from "../../chunks/portal.js";
|
|
7
|
+
const x = /^#[0-9a-f]{3}$/iu, k = /^#[0-9a-f]{6}$/iu;
|
|
8
|
+
function u(r) {
|
|
9
|
+
return E(r) || I(r);
|
|
10
|
+
}
|
|
11
|
+
function E(r) {
|
|
12
|
+
return r?.length === 4 && x.test(r);
|
|
13
|
+
}
|
|
14
|
+
function I(r) {
|
|
15
|
+
return r?.length === 7 && k.test(r);
|
|
16
|
+
}
|
|
17
|
+
function O(r) {
|
|
18
|
+
if (!u(r))
|
|
19
|
+
return null;
|
|
20
|
+
const t = r.replace("#", "");
|
|
21
|
+
if (t.length === 3) {
|
|
22
|
+
const [e, i, o] = t.split("");
|
|
23
|
+
return {
|
|
24
|
+
r: Number.parseInt(`${e}${e}`, 16),
|
|
25
|
+
g: Number.parseInt(`${i}${i}`, 16),
|
|
26
|
+
b: Number.parseInt(`${o}${o}`, 16)
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
r: Number.parseInt(t.slice(0, 2), 16),
|
|
31
|
+
g: Number.parseInt(t.slice(2, 4), 16),
|
|
32
|
+
b: Number.parseInt(t.slice(4, 6), 16)
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function T(r) {
|
|
36
|
+
let t = 0;
|
|
37
|
+
for (let i = 0; i < r.length; i++)
|
|
38
|
+
t = r.charCodeAt(i) + ((t << 5) - t);
|
|
39
|
+
let e = "#";
|
|
40
|
+
for (let i = 0; i < 3; i++) {
|
|
41
|
+
const o = t >> i * 8 & 255;
|
|
42
|
+
e += `00${o.toString(16)}`.slice(-2);
|
|
43
|
+
}
|
|
44
|
+
return e;
|
|
45
|
+
}
|
|
46
|
+
function v(r) {
|
|
47
|
+
let { r: t, g: e, b: i } = r;
|
|
48
|
+
t /= 255, e /= 255, i /= 255;
|
|
49
|
+
const o = Math.max(t, e, i), n = Math.min(t, e, i), s = o - n;
|
|
50
|
+
if (s === 0)
|
|
51
|
+
return 0;
|
|
52
|
+
let a = 0;
|
|
53
|
+
switch (o) {
|
|
54
|
+
case t:
|
|
55
|
+
a = (e - i) / s + (e < i ? 6 : 0);
|
|
56
|
+
break;
|
|
57
|
+
case e:
|
|
58
|
+
a = (i - t) / s + 2;
|
|
59
|
+
break;
|
|
60
|
+
default:
|
|
61
|
+
a = (t - e) / s + 4;
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
return Math.round(a * 60);
|
|
65
|
+
}
|
|
66
|
+
function w(r) {
|
|
67
|
+
const t = O(r);
|
|
68
|
+
return t ? v(t) : 0;
|
|
69
|
+
}
|
|
70
|
+
const H = d`:host{display:inline-block}:host([scale="s"]){height:1.5rem;width:1.5rem;font-size:.625rem}:host([scale="m"]){height:2rem;width:2rem;font-size:.75rem}:host([scale="l"]){font-size:1rem;height:2.75rem;width:2.75rem}:host([scale="xl"]){font-size:1.25rem;height:4rem;width:4rem}.icon{display:flex;color:var(--calcite-color-text-3)}.background{position:relative;display:flex;height:100%;width:100%;align-items:center;justify-content:center}.initials{position:absolute;font-weight:700;text-transform:uppercase;color:var(--calcite-color-text-2)}.thumbnail{height:100%;width:100%}.tooltip-text{margin:0;padding:0;font-size:.75rem;color:var(--calcite-color-text-2)}calcite-tooltip{pointer-events:none}`;
|
|
71
|
+
class y extends m {
|
|
72
|
+
constructor() {
|
|
73
|
+
super(...arguments), this.imageEl = c(), this.fallbackEl = c(), this.tooltipEl = c(), this.imageError = !1, this.tooltipOpen = !1, this.tooltip = !1, this.scale = "m";
|
|
74
|
+
}
|
|
75
|
+
static {
|
|
76
|
+
this.properties = { imageError: 16, tooltipOpen: 16, group: 0, portal: 0, tooltip: 5, scale: 3 };
|
|
77
|
+
}
|
|
78
|
+
static {
|
|
79
|
+
this.styles = H;
|
|
80
|
+
}
|
|
81
|
+
willUpdate(t) {
|
|
82
|
+
t.has("group") && (this.imageError = !1);
|
|
83
|
+
}
|
|
84
|
+
updated() {
|
|
85
|
+
const t = this.tooltipEl.value, e = this.imageEl.value || this.fallbackEl.value;
|
|
86
|
+
t && e && (t.referenceElement = e);
|
|
87
|
+
}
|
|
88
|
+
isDarkMode() {
|
|
89
|
+
return !!this.el.closest(".calcite-mode-dark");
|
|
90
|
+
}
|
|
91
|
+
getThumbnailURI() {
|
|
92
|
+
const { group: t, portal: e } = this;
|
|
93
|
+
if (!t)
|
|
94
|
+
return null;
|
|
95
|
+
if (t.thumbnailUrl)
|
|
96
|
+
return t.thumbnailUrl;
|
|
97
|
+
const i = t.thumbnail;
|
|
98
|
+
if (!i)
|
|
99
|
+
return null;
|
|
100
|
+
if (i.startsWith("http"))
|
|
101
|
+
return i;
|
|
102
|
+
if (!e || !t.id)
|
|
103
|
+
return null;
|
|
104
|
+
const o = $(e), n = o ? `?token=${o}` : "";
|
|
105
|
+
return `${b(e)}community/groups/${t.id}/info/${i}${n}`;
|
|
106
|
+
}
|
|
107
|
+
generateFillColor() {
|
|
108
|
+
const { id: t, title: e } = this.group || {}, i = t ? `#${t.slice(Math.max(0, t.length - 6))}` : "", o = t && u(i) ? i : T(e || "");
|
|
109
|
+
if (!t && !e || !u(o))
|
|
110
|
+
return "var(--calcite-color-foreground-2)";
|
|
111
|
+
const n = w(o), s = this.isDarkMode() ? 20 : 90;
|
|
112
|
+
return `hsl(${n}, 60%, ${s}%)`;
|
|
113
|
+
}
|
|
114
|
+
generateInitials() {
|
|
115
|
+
const t = this.group?.title?.trim().charAt(0);
|
|
116
|
+
return t?.match(/^\w+$/u) ? t : null;
|
|
117
|
+
}
|
|
118
|
+
getIconScale() {
|
|
119
|
+
return this.scale === "xl" ? "l" : this.scale === "xs" ? "s" : this.scale;
|
|
120
|
+
}
|
|
121
|
+
renderTooltip() {
|
|
122
|
+
return !this.tooltip || !this.group?.title ? null : l`<calcite-tooltip .open=${this.tooltipOpen} close-on-click placement=bottom-start offset-distance=6 offset-skidding=0 ${h(this.tooltipEl)}><p class="tooltip-text">${this.group.title}</p></calcite-tooltip>`;
|
|
123
|
+
}
|
|
124
|
+
render() {
|
|
125
|
+
const t = this.getThumbnailURI();
|
|
126
|
+
if (t && !this.imageError)
|
|
127
|
+
return l`<img class="thumbnail" src=${t ?? f} alt @error=${() => {
|
|
128
|
+
this.imageError = !0;
|
|
129
|
+
}} @mouseenter=${() => {
|
|
130
|
+
this.tooltipOpen = !0;
|
|
131
|
+
}} @mouseleave=${() => {
|
|
132
|
+
this.tooltipOpen = !1;
|
|
133
|
+
}} @focusin=${() => {
|
|
134
|
+
this.tooltipOpen = !0;
|
|
135
|
+
}} @focusout=${() => {
|
|
136
|
+
this.tooltipOpen = !1;
|
|
137
|
+
}} ${h(this.imageEl)}>${this.renderTooltip()}`;
|
|
138
|
+
const e = this.generateInitials();
|
|
139
|
+
return l`<span class="background" style=${g({ backgroundColor: this.generateFillColor() })} @mouseenter=${() => {
|
|
140
|
+
this.tooltipOpen = !0;
|
|
141
|
+
}} @mouseleave=${() => {
|
|
142
|
+
this.tooltipOpen = !1;
|
|
143
|
+
}} @focusin=${() => {
|
|
144
|
+
this.tooltipOpen = !0;
|
|
145
|
+
}} @focusout=${() => {
|
|
146
|
+
this.tooltipOpen = !1;
|
|
147
|
+
}} ${h(this.fallbackEl)}>${e ? l`<span aria-hidden=true class="initials">${e}</span>` : l`<calcite-icon class="icon" icon=users .scale=${this.getIconScale()}></calcite-icon>`}</span>${this.renderTooltip()}`;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
p("arcgis-portal-group-thumbnail", y);
|
|
151
|
+
export {
|
|
152
|
+
y as ArcgisPortalGroupThumbnail
|
|
153
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./customElement.js";
|
|
@@ -438,8 +438,8 @@ class H extends g {
|
|
|
438
438
|
await n?.load(), this.replacementItem = n, this.hasInaccessibleReplacementItem = this.replacementItemInRecycleBin || !n && s.data?.aggregations?.total?.count > 0 && s.data?.relatedItems?.length === 0, this.arcgisPortalReplacementItemFetch.emit({
|
|
439
439
|
replacementItem: this.hasInaccessibleReplacementItem ? {} : n || null
|
|
440
440
|
}), this.replacementItem = n;
|
|
441
|
-
const p =
|
|
442
|
-
this.itemOwnerName = p ? T(p, this.messages?._t9nLocale || "en") :
|
|
441
|
+
const p = this.replacementItem?.owner ?? (a?.owner || null);
|
|
442
|
+
this.itemOwnerName = p ? T(await M(p, t), this.messages?._t9nLocale || "en") : "", this.replacementItemSupportsOpenActions = j(n), this.thumbnailUrl = F(t, n ?? this.item), this.supportsReplacement = !!n && this.isItemRetired(a), this.canRedirect = this.supportsReplacement && this.replacementItemSupportsOpenActions, this.replacementId = n?.id || null, this.canRedirect && this.setupTimer({
|
|
443
443
|
onComplete: () => r()
|
|
444
444
|
}), this.open = !0;
|
|
445
445
|
}
|
|
@@ -466,7 +466,7 @@ class H extends g {
|
|
|
466
466
|
this.cancelRedirect();
|
|
467
467
|
}}>${t.cancelRedirection}</calcite-button>` || ""}<calcite-button slot=footer-end @click=${() => {
|
|
468
468
|
this.cancelTimer(), o ? this.performRedirectAction() : this.viewItemDetailsPage();
|
|
469
|
-
}} .iconEnd=${o ? void 0 : "launch"}
|
|
469
|
+
}} .iconEnd=${o ? void 0 : "launch"} ${R(this.primaryActionRef)}>${this.getRedirectActionMessage()}</calcite-button></calcite-dialog>`;
|
|
470
470
|
}
|
|
471
471
|
}
|
|
472
472
|
f("arcgis-portal-replacement-item-redirect", H);
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/// <reference path="../../index.d.ts" />
|
|
2
|
+
import type Portal from "@arcgis/core/portal/Portal.js";
|
|
3
|
+
import type PortalItem from "@arcgis/core/portal/PortalItem.js";
|
|
4
|
+
import type PortalUser from "@arcgis/core/portal/PortalUser.js";
|
|
5
|
+
import type { PublicLitElement as LitElement } from "@arcgis/lumina";
|
|
6
|
+
import type { InternalUIAction } from "../../types/tracking.js";
|
|
7
|
+
import type { Scale } from "../../types/ui.js";
|
|
8
|
+
import type { T9nMeta } from "@arcgis/lumina/controllers";
|
|
9
|
+
|
|
10
|
+
export abstract class ArcgisPortalUserPopup extends LitElement {
|
|
11
|
+
/**
|
|
12
|
+
* Choose outline for a full-width outlined button.
|
|
13
|
+
*
|
|
14
|
+
* @default "transparent"
|
|
15
|
+
*/
|
|
16
|
+
accessor appearance: "outline" | "transparent";
|
|
17
|
+
/**
|
|
18
|
+
* Set to true to hide avatar from screen readers.
|
|
19
|
+
*
|
|
20
|
+
* @default false
|
|
21
|
+
*/
|
|
22
|
+
accessor avatarAriaHidden: boolean | undefined;
|
|
23
|
+
/** Fully qualified path to portal home root. */
|
|
24
|
+
accessor baseUrl: string | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* @default false
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
accessor checkOnline: boolean | undefined;
|
|
30
|
+
/** Optional full name fallback if user information does not include it. */
|
|
31
|
+
accessor fullName: string | undefined;
|
|
32
|
+
/** Passing an item will show org info for publicly verified items, user info for standard items. */
|
|
33
|
+
accessor item: PortalItem | undefined;
|
|
34
|
+
/** @internal */
|
|
35
|
+
protected messages: {
|
|
36
|
+
expand: string;
|
|
37
|
+
showLess: string;
|
|
38
|
+
homepage: string;
|
|
39
|
+
gallery: string;
|
|
40
|
+
profile: string;
|
|
41
|
+
groups: string;
|
|
42
|
+
items: string;
|
|
43
|
+
viewAll: string;
|
|
44
|
+
loadingUserInformation: string;
|
|
45
|
+
itemManagedBy: string;
|
|
46
|
+
} & T9nMeta<{
|
|
47
|
+
expand: string;
|
|
48
|
+
showLess: string;
|
|
49
|
+
homepage: string;
|
|
50
|
+
gallery: string;
|
|
51
|
+
profile: string;
|
|
52
|
+
groups: string;
|
|
53
|
+
items: string;
|
|
54
|
+
viewAll: string;
|
|
55
|
+
loadingUserInformation: string;
|
|
56
|
+
itemManagedBy: string;
|
|
57
|
+
}>;
|
|
58
|
+
/** The current portal instance. */
|
|
59
|
+
accessor portal: Portal;
|
|
60
|
+
/**
|
|
61
|
+
* Scale of the component.
|
|
62
|
+
*
|
|
63
|
+
* @default "m"
|
|
64
|
+
*/
|
|
65
|
+
accessor scale: Scale;
|
|
66
|
+
/**
|
|
67
|
+
* Set to false to hide the avatar and show username only.
|
|
68
|
+
*
|
|
69
|
+
* @default true
|
|
70
|
+
*/
|
|
71
|
+
accessor showAvatar: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Set to false to show only the avatar.
|
|
74
|
+
*
|
|
75
|
+
* @default true
|
|
76
|
+
*/
|
|
77
|
+
accessor showName: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Set to true to show username in description.
|
|
80
|
+
*
|
|
81
|
+
* @default false
|
|
82
|
+
*/
|
|
83
|
+
accessor showUsername: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Set to true to underline the name.
|
|
86
|
+
*
|
|
87
|
+
* @default false
|
|
88
|
+
*/
|
|
89
|
+
accessor underline: boolean | undefined;
|
|
90
|
+
/** Passing a user will always show thumbnail for that user (use either user or item). */
|
|
91
|
+
accessor user: PortalUser | undefined;
|
|
92
|
+
/** Passing a username will perform a fetch for the user information on load. */
|
|
93
|
+
accessor username: string | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* Allow the name to wrap lines (max 2).
|
|
96
|
+
*
|
|
97
|
+
* @default false
|
|
98
|
+
*/
|
|
99
|
+
accessor wrap: boolean | undefined;
|
|
100
|
+
/** The z-index of the popover. */
|
|
101
|
+
accessor zIndex: number | undefined;
|
|
102
|
+
openPopup(): Promise<void>;
|
|
103
|
+
setFocus(): Promise<void>;
|
|
104
|
+
readonly arcgisUserPopupClose: import("@arcgis/lumina").TargetedEvent<this, void>;
|
|
105
|
+
/** Fires on internal component interaction - used by telemetry. */
|
|
106
|
+
readonly arcgisUserPopupInternalUIAction: import("@arcgis/lumina").TargetedEvent<this, InternalUIAction>;
|
|
107
|
+
readonly "@eventTypes": {
|
|
108
|
+
arcgisUserPopupClose: ArcgisPortalUserPopup["arcgisUserPopupClose"]["detail"];
|
|
109
|
+
arcgisUserPopupInternalUIAction: ArcgisPortalUserPopup["arcgisUserPopupInternalUIAction"]["detail"];
|
|
110
|
+
};
|
|
111
|
+
}
|