@arcgis/map-components
Version:
ArcGIS Map Components
44 lines (43 loc) • 3 kB
JavaScript
import { c as o } from "../../chunks/runtime.js";
import { html as t } from "lit-html";
import { keyed as a } from "lit-html/directives/keyed.js";
import { watch as i } from "@arcgis/core/core/reactiveUtils.js";
import { LitElement as n, safeClassMap as l } from "@arcgis/lumina";
import { u as m } from "../../chunks/useHandles.js";
import { g as p, a as d, b as h, c as _ } from "../../chunks/utils.js";
import { css as g } from "@lit/reactive-element/css-tag.js";
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
v4.33.13 */
const u = g`.arcgis-print__template-select-container{border:1px solid var(--calcite-color-border-1);cursor:pointer}.arcgis-print__template-select-container .arcgis-print__template-select-error,.arcgis-print__template-select-container .arcgis-print__template-select-arrow{display:flex;align-self:center;margin-right:var(--calcite-spacing-md)}`, s = "arcgis-print", c = {
templateSelectContainer: `${s}__template-select-container`,
templateSelectError: `${s}__template-select-error`,
templateSelectArrow: `${s}__template-select-arrow`
};
class $ extends n {
constructor() {
super(...arguments), this._handles = m("disconnect"), this._templateState = "not-loaded";
}
static {
this.properties = { _selectedTemplate: 16, _templateState: 16, viewModel: 0, messages: 0, showTemplateSelector: 0 };
}
static {
this.styles = u;
}
loaded() {
this.manager.onLifecycle(() => [
i(() => this.viewModel.templateOptions.id, (e) => {
this._handles.removeHandles("template-handle"), this._selectedTemplate = e ? this.viewModel.getLayoutTemplateById(e) ?? void 0 : void 0, this._handles.addHandles(i(() => this._selectedTemplate?.state, (r) => this._templateState = r ?? "not-loaded", { initial: !0 }), "template-handle");
}, { initial: !0 })
]);
}
render() {
return t`<calcite-block class=${l(c.templateSelectContainer)} .description=${p(this._selectedTemplate)} .heading=${this._selectedTemplate ? d(this._selectedTemplate, this.messages) : this.messages.selectTemplate} .loading=${this._templateState === "loading"} @click=${this.showTemplateSelector} @keydown=${(e) => {
(e.key === "Enter" || e.key === " ") && this.showTemplateSelector();
}} tabindex=0>${a("template-select-icon", t`<calcite-icon .icon=${(this._selectedTemplate?.layout ? h(this._selectedTemplate.layout) : null) || "custom-print"} scale=l slot=content-start></calcite-icon>`)}${this._templateState === "error" ? a("template-select-error", t`<calcite-icon class=${l(c.templateSelectError)} icon=exclamation-mark-circle scale=s slot=actions-end></calcite-icon>`) : null}${a("template-select-arrow", t`<calcite-icon class=${l(c.templateSelectArrow)} .icon=${_() ? "chevron-left" : "chevron-right"} scale=s slot=actions-end></calcite-icon>`)}</calcite-block>`;
}
}
o("arcgis-print-template-select", $);
export {
$ as PrintTemplateSelect
};