@arcgis/map-components 5.2.0-next.114 → 5.2.0-next.115

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.
@@ -4,17 +4,17 @@ import { css as I, html as a } from "lit";
4
4
  import _ from "@arcgis/core/rest/query/support/AttachmentInfo.js";
5
5
  import L from "@arcgis/core/rest/support/AttachmentQuery.js";
6
6
  import z from "@arcgis/core/core/Collection.js";
7
- import b from "@arcgis/core/core/Error.js";
8
- import { LitElement as S, nothing as p, safeClassMap as w, safeStyleMap as v } from "@arcgis/lumina";
7
+ import A from "@arcgis/core/core/Error.js";
8
+ import { LitElement as S, nothing as u, safeClassMap as $, safeStyleMap as w } from "@arcgis/lumina";
9
9
  import { bypassReadOnly as P } from "@arcgis/lumina/controllers";
10
- import { classes as A } from "@arcgis/toolkit/dom";
11
- import { g as u } from "../../chunks/feature-utils.js";
10
+ import { classes as v } from "@arcgis/toolkit/dom";
11
+ import { g as b } from "../../chunks/feature-utils.js";
12
12
  import { watch as C } from "@arcgis/core/core/reactiveUtils.js";
13
- function $(i) {
13
+ function y(i) {
14
14
  const t = i.toLowerCase();
15
15
  return t === "image/bmp" || t === "image/emf" || t === "image/exif" || t === "image/gif" || t === "image/x-icon" || t === "image/jpeg" || t === "image/png" || t === "image/tiff" || t === "image/x-wmf";
16
16
  }
17
- function y(i) {
17
+ function x(i) {
18
18
  return i ? i === "text/plain" ? "file-text" : i === "application/pdf" ? "file-pdf" : i === "text/csv" ? "file-csv" : i === "application/gpx+xml" ? "file-gpx" : i === "application/x-dwf" ? "file-cad" : i === "application/postscript" || i === "application/json" || i === "text/xml" || i === "model/vrml" ? "file-code" : i === "application/x-zip-compressed" || i === "application/x-7z-compressed" || i === "application/x-gzip" || i === "application/x-tar" || i === "application/x-gtar" || i === "application/x-bzip2" || i === "application/gzip" || i === "application/x-compress" || i === "application/x-apple-diskimage" || i === "application/x-rar-compressed" || i === "application/zip" ? "file-zip" : i.includes("image/") ? "file-image" : i.includes("audio/") ? "file-sound" : i.includes("video/") ? "file-video" : i.includes("msexcel") || i.includes("ms-excel") || i.includes("spreadsheetml") ? "file-excel" : i.includes("msword") || i.includes("ms-word") || i.includes("wordprocessingml") ? "file-word" : i.includes("powerpoint") || i.includes("presentationml") ? "file-report" : "file" : "file";
19
19
  }
20
20
  const j = I`:host([empty]){display:none}.item-link{display:flex;flex-grow:1;color:var(--calcite-color-text-3)}.item-link:visited,.item-link:hover,.item-link:focus-visible,.item-link:active{color:var(--calcite-color-text-1)}.item-link img{max-width:100%;max-height:100%;object-fit:contain}.item-link--list{align-items:center;justify-content:center;width:64px;max-height:64px;overflow:hidden;border-radius:var(--calcite-corner-radius-sm)}.item-link--list img{border-radius:var(--calcite-corner-radius-sm)}.item-link--list-icon{border:var(--calcite-border-width-sm) solid var(--calcite-color-border-3)}.item-link--list calcite-icon{margin:var(--calcite-spacing-lg)}.item-link--preview{align-items:center;justify-content:center}.item-link--preview calcite-icon{margin-block:var(--calcite-spacing-lg)}.item-description{text-align:center;word-wrap:break-word;word-break:break-word}calcite-link{--calcite-link-text-color: var(--calcite-color-text-3);padding-inline:var(--calcite-spacing-sm);word-wrap:break-word;word-break:break-word}calcite-card{width:100%}`, E = z.ofType(_);
@@ -32,7 +32,7 @@ class R extends S {
32
32
  const { graphic: t } = this;
33
33
  if (!t)
34
34
  return !1;
35
- const e = u(t);
35
+ const e = b(t);
36
36
  return e?.loaded && "capabilities" in e && e.capabilities && "attachment" in e.capabilities && e.capabilities.attachment && "supportsResize" in e.capabilities.attachment && e.capabilities.attachment.supportsTypeWildcard || !1;
37
37
  }
38
38
  get effectiveDisplayType() {
@@ -40,13 +40,13 @@ class R extends S {
40
40
  return !t || t === "auto" ? this.supportsResizeAttachments ? "preview" : "list" : t;
41
41
  }
42
42
  get _hasContent() {
43
- return this._attachmentInfos.length > 0 || !!this.graphic && this.getAttachmentsPromise !== null;
43
+ return this._attachmentInfos.length > 0 || this.getAttachmentsPromise != null;
44
44
  }
45
45
  get supportsResizeAttachments() {
46
46
  const { graphic: t } = this;
47
47
  if (!t)
48
48
  return !1;
49
- const e = u(t);
49
+ const e = b(t);
50
50
  return e?.loaded && "capabilities" in e && e.capabilities && "attachment" in e.capabilities && e.capabilities.attachment && "supportsResize" in e.capabilities.attachment && e.capabilities.attachment.supportsResize || !1;
51
51
  }
52
52
  loaded() {
@@ -55,28 +55,28 @@ class R extends S {
55
55
  ]);
56
56
  }
57
57
  async getAttachments() {
58
- const { _attachmentLayer: t, _attachmentInfos: e, orderByFields: o, attachmentTypes: m, attachmentKeywords: s, _supportsTypeWildcard: g } = this;
58
+ const { _attachmentLayer: t, _attachmentInfos: e, orderByFields: r, attachmentTypes: c, attachmentKeywords: l, _supportsTypeWildcard: o } = this;
59
59
  if (!t || typeof t.queryAttachments != "function")
60
- throw new b("invalid-layer", "getAttachments(): A valid layer is required.");
61
- const h = this.graphic?.getObjectId();
62
- if (typeof h != "number")
63
- throw new b("invalid-object-id", "getAttachments(): Numeric object id is required");
64
- const r = o?.map((n) => `${n.field} ${n.order === "descending" ? "DESC" : "ASC"}`), f = new L({
65
- objectIds: [h],
60
+ throw new A("invalid-layer", "getAttachments(): A valid layer is required.");
61
+ const m = this.graphic?.getObjectId();
62
+ if (typeof m != "number")
63
+ throw new A("invalid-object-id", "getAttachments(): Numeric object id is required");
64
+ const g = r?.map((s) => `${s.field} ${s.order === "descending" ? "DESC" : "ASC"}`), n = new L({
65
+ objectIds: [m],
66
66
  returnMetadata: !0,
67
- orderByFields: r,
68
- attachmentTypes: g ? m?.filter(Boolean).map((n) => `${n}/*`) : void 0,
69
- keywords: s
70
- }), c = [], d = t.queryAttachments(f).then((n) => n[h] || c).catch(() => c);
71
- this.getAttachmentsPromise = d, this._setEmpty(!1);
72
- const l = await d;
73
- e.destroyAll(), l.length && e.addMany(l), this.getAttachmentsPromise = null, this._setEmpty(!this._hasContent);
67
+ orderByFields: g,
68
+ attachmentTypes: o ? c?.filter(Boolean).map((s) => `${s}/*`) : void 0,
69
+ keywords: l
70
+ }), h = [], p = t.queryAttachments(n).then((s) => s[m] || h).catch(() => h);
71
+ this.getAttachmentsPromise = p, this._setEmpty(!1);
72
+ const d = await p;
73
+ e.destroyAll(), d.length && e.addMany(d), this.getAttachmentsPromise = null, this._setEmpty(!this._hasContent);
74
74
  }
75
75
  _setEmpty(t) {
76
76
  P(() => this.empty = t);
77
77
  }
78
78
  setAttachmentLayer() {
79
- const { graphic: t } = this, e = u(t);
79
+ const { graphic: t } = this, e = b(t);
80
80
  this._attachmentLayer = e ? e.type === "scene" && e.associatedLayer != null ? e.associatedLayer : e : null;
81
81
  }
82
82
  graphicChanged() {
@@ -96,7 +96,7 @@ class R extends S {
96
96
  ].join(" ") : "";
97
97
  }
98
98
  render() {
99
- return a`<div class="root"><arcgis-feature-element-info .heading=${this.heading} .description=${this.description} .headingLevel=${this.headingLevel}></arcgis-feature-element-info>${this.renderAttachments()}</div>`;
99
+ return this.empty ? null : a`<div class="root"><arcgis-feature-element-info .heading=${this.heading} .description=${this.description} .headingLevel=${this.headingLevel}></arcgis-feature-element-info>${this.renderAttachments()}</div>`;
100
100
  }
101
101
  renderAttachmentsList(t) {
102
102
  return a`<calcite-list .loading=${!!this.getAttachmentsPromise} .label=${this.messages?.componentLabel ?? ""} interaction-mode=static selection-mode=none>${t.toArray().filter(Boolean).map((e) => this.renderAttachmentListItem(e))}</calcite-list>`;
@@ -104,19 +104,23 @@ class R extends S {
104
104
  renderAttachmentsPreview(t) {
105
105
  return a`<calcite-card-group .label=${this.messages?.componentLabel ?? ""}>${this.getAttachmentsPromise ? a`<calcite-card loading></calcite-card>` : t.toArray().filter(Boolean).map((e) => this.renderAttachmentPreviewItem(e))}</calcite-card-group>`;
106
106
  }
107
+ renderAttachmentsCarousel(t) {
108
+ const e = t.toArray().filter(Boolean);
109
+ return a`<calcite-carousel .paginationDisabled=${e.length < 2} .label=${this.messages?.componentLabel ?? ""} pagination-position=top>${this.getAttachmentsPromise ? a`<calcite-carousel-item .label=${this.messages?.componentLabel ?? ""}><calcite-card loading></calcite-card></calcite-carousel-item>` : e.map((r) => a`<calcite-carousel-item .label=${r.name || this.messages?.noTitle || ""}>${this.renderAttachmentPreviewItem(r, !0)}</calcite-carousel-item>`)}</calcite-carousel>`;
110
+ }
107
111
  renderAttachments() {
108
112
  const { effectiveDisplayType: t, _attachmentInfos: e } = this;
109
- return t === "preview" ? this.renderAttachmentsPreview(e) : this.renderAttachmentsList(e);
113
+ return t === "carousel" ? this.renderAttachmentsCarousel(e) : t === "preview" ? this.renderAttachmentsPreview(e) : this.renderAttachmentsList(e);
110
114
  }
111
115
  renderAttachmentListItem(t) {
112
- const { supportsResizeAttachments: e } = this, { contentType: o, name: m, url: s, size: g } = t, h = 64, r = m || this.messages?.noTitle, f = y(o), c = this.getCSSTransform(t), d = c ? { transform: c, "image-orientation": "none" } : {}, l = e && $(o), n = a`<a class=${w(A("item-link", "item-link--list", {
113
- "item-link--list-icon": !l
114
- }))} slot=content-start href=${s ?? void 0 ?? p} rel=noreferrer target=_blank>${l ? a`<img alt=${m ?? p} src=${`${s}${s?.includes("?") ? "&" : "?"}w=${h}&s=${g}`} style=${v(d)} title=${m ?? p}>` : a`<calcite-icon .icon=${f}></calcite-icon>`}</a>`, x = a`<calcite-link slot=content .href=${s ?? void 0} rel=noreferrer target=_blank>${r}</calcite-link>`;
115
- return a`<calcite-list-item .label=${r}>${n}${x}</calcite-list-item>`;
116
- }
117
- renderAttachmentPreviewItem(t) {
118
- const { supportsResizeAttachments: e } = this, { contentType: o, name: m, url: s, size: g } = t, h = 225, r = m || this.messages?.noTitle, f = y(o), c = this.getCSSTransform(t), d = c ? { transform: c, "image-orientation": "none" } : {}, l = e && $(o), n = a`<a class=${w(A("item-link", "item-link--preview"))} slot=thumbnail href=${s ?? void 0 ?? p} rel=noreferrer target=_blank aria-label=${r ?? p} title=${r ?? p}>${l ? a`<img alt=${r ?? p} src=${`${s}${s?.includes("?") ? "&" : "?"}w=${h}&s=${g}`} style=${v(d)}>` : a`<calcite-icon scale=l .icon=${f}></calcite-icon>`}</a>`;
119
- return a`<calcite-card .label=${r}>${n}${this.hidePreviewImageAttachmentName && l ? null : a`<span class="item-description" slot=description>${r}</span>`}</calcite-card>`;
116
+ const { supportsResizeAttachments: e } = this, { contentType: r, name: c, url: l, size: o } = t, m = 64, g = c || this.messages?.noTitle, n = x(r), h = this.getCSSTransform(t), p = h ? { transform: h, "image-orientation": "none" } : {}, d = e && y(r), s = a`<a class=${$(v("item-link", "item-link--list", {
117
+ "item-link--list-icon": !d
118
+ }))} slot=content-start href=${l ?? void 0 ?? u} rel=noreferrer target=_blank>${d ? a`<img alt=${c ?? u} src=${`${l}${l?.includes("?") ? "&" : "?"}w=${m}&s=${o}`} style=${w(p)} title=${c ?? u}>` : a`<calcite-icon .icon=${n}></calcite-icon>`}</a>`, f = a`<calcite-link slot=content .href=${l ?? void 0} rel=noreferrer target=_blank>${g}</calcite-link>`;
119
+ return a`<calcite-list-item .label=${g}>${s}${f}</calcite-list-item>`;
120
+ }
121
+ renderAttachmentPreviewItem(t, e = !1) {
122
+ const { supportsResizeAttachments: r } = this, { contentType: c, name: l, url: o, size: m } = t, g = 225, n = l || this.messages?.noTitle, h = x(c), p = this.getCSSTransform(t), d = p ? { transform: p, "image-orientation": "none" } : {}, s = r && y(c), f = a`<a class=${$(v("item-link", "item-link--preview"))} slot=thumbnail href=${o ?? void 0 ?? u} rel=noreferrer target=_blank aria-label=${n ?? u} title=${n ?? u}>${s ? a`<img alt=${n ?? u} src=${`${o}${o?.includes("?") ? "&" : "?"}w=${g}&s=${m}`} style=${w(d)}>` : a`<calcite-icon scale=l .icon=${h}></calcite-icon>`}</a>`;
123
+ return a`<calcite-card .label=${n}>${f}${(e || this.hidePreviewImageAttachmentName) && s ? null : a`<span class="item-description" slot=description>${n}</span>`}</calcite-card>`;
120
124
  }
121
125
  }
122
126
  k("arcgis-feature-attachments", R);
@@ -2,6 +2,8 @@ import "../arcgis-feature-element-info/index.js";
2
2
  import "@esri/calcite-components/components/calcite-list";
3
3
  import "@esri/calcite-components/components/calcite-card-group";
4
4
  import "@esri/calcite-components/components/calcite-card";
5
+ import "@esri/calcite-components/components/calcite-carousel";
6
+ import "@esri/calcite-components/components/calcite-carousel-item";
5
7
  import "@esri/calcite-components/components/calcite-icon";
6
8
  import "@esri/calcite-components/components/calcite-link";
7
9
  import "@esri/calcite-components/components/calcite-list-item";