@arcgis/map-components
Version:
ArcGIS Map Components
40 lines (39 loc) • 2.14 kB
JavaScript
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
import { c as n } from "./runtime.js";
import { html as o } from "lit";
import { whenOnce as m } from "@arcgis/core/core/reactiveUtils.js";
import { LitElement as p } from "@arcgis/lumina";
import { createRef as v, ref as h } from "lit/directives/ref.js";
function d(i, t) {
return !i || i === "all" || !!(t && i.includes(t));
}
class f extends p {
static {
this.properties = { showSaveAs: 5, viewModel: 0, messages: 0, allowedFormatsForSaving: 1, arcgisSaveAs: 0, exportedLink: 0 };
}
#e = v();
_closePopover() {
this.#e.value && (this.#e.value.open = !1);
}
render() {
const t = this.messages, e = this.exportedLink, a = e.formattedName ?? "", { state: c } = e, r = this.showSaveAs && c !== "error" && d(this.allowedFormatsForSaving, e.extension);
return c !== "pending" && r ? o`<calcite-popover auto-close label=Popover offset-distance=1 overlay-positioning=fixed pointer-disabled .referenceElement=${`${a}-popover-button`} scale=s ${h(this.#e)}><calcite-list label>${e.portalItem ? o`<calcite-list-item .label=${t.openItem} @calciteListItemSelect=${() => {
const l = e.portalItem;
if (!l?.itemPageUrl)
return;
const s = document.createElement("a");
s.target = "_blank", s.href = l.itemPageUrl, s.rel = "noreferrer", s.click(), this._closePopover();
}}><calcite-icon icon=launch2 scale=s slot=content-start></calcite-icon></calcite-list-item>` : o`<calcite-list-item .label=${t.saveAs} @calciteListItemSelect=${async () => {
m(() => e.portalItem).then(() => {
this.requestUpdate();
}), this.arcgisSaveAs.emit(e), this._closePopover();
}}><calcite-icon icon=save scale=s slot=content-start></calcite-icon></calcite-list-item>`}<calcite-list-item .label=${t.delete} @calciteListItemSelect=${() => {
this.viewModel.exportedLinks.remove(e), this._closePopover();
}}><calcite-icon icon=trash scale=s slot=content-start></calcite-icon></calcite-list-item></calcite-list></calcite-popover>` : null;
}
}
n("arcgis-print-exports-panel-item-popover", f);
export {
f as P,
d as i
};