UNPKG

@arcgis/map-components

Version:
51 lines (50 loc) 2.29 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */ import { c as s } from "../../chunks/runtime.js"; import { css as c, html as n } from "lit"; import { watch as u } from "@arcgis/core/core/reactiveUtils.js"; import o from "@arcgis/core/geometry/SpatialReference.js"; import { LitElement as p } from "@arcgis/lumina"; const d = c`.sr-label{display:flex;gap:var(--calcite-spacing-xs)}.invalid-wkid-text{color:var(--calcite-color-status-danger);font-size:var(--calcite-font-size--0)}`; function f(e) { if (e == null) return !1; const t = e.wkid; return t != null && t >= 2e3 ? !0 : e.wkt2 != null || e.wkt != null; } function m(e) { return e == null ? e : Math.round(Number.parseFloat(e)); } class v extends p { constructor() { super(...arguments), this._isValidSpatialReference = !0; } static { this.properties = { _isValidSpatialReference: 16, _outSpatialReference: 16, templateOptions: 0, viewModel: 0, messages: 0 }; } static { this.styles = d; } loaded() { this.manager.onLifecycle(() => [ u(() => this.viewModel.outSpatialReference, (t) => { this._outSpatialReference = t ?? void 0; }, { initial: !0 }) ]); } render() { const { messages: t } = this; return n`<div><calcite-label><div class="sr-label">${t.outSpatialReference}<calcite-link href=https://developers.arcgis.com/rest/services-reference/enterprise/using-spatial-references/ target=_blank>(WKID)</calcite-link></div><calcite-input-number data-input-name=outSpatialReference integer number-button-type=none .value=${this._outSpatialReference?.wkid?.toString() ?? ""} .max=${Number.MAX_SAFE_INTEGER} @calciteInputNumberInput=${({ currentTarget: r }) => { const a = r.value; if (a === "") { this.viewModel.outSpatialReference = null, this._isValidSpatialReference = !0; return; } const i = m(a), l = Number.isNaN(i) || i == null ? null : new o({ wkid: i }); this.viewModel.outSpatialReference = l, this._isValidSpatialReference = f(l); }}></calcite-input-number>${this._isValidSpatialReference ? null : n`<div class="invalid-wkid-text">${t.invalidWkid}</div>`}</calcite-label></div>`; } } s("arcgis-print-out-spatial-reference-input", v); export { v as PrintOutSpatialReferenceInput };