@arcgis/map-components
Version:
ArcGIS Map Components
3 lines (2 loc) • 4.01 kB
JavaScript
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
import{a as o}from"./IGSZABNU.js";import{N as h,O as p,R as a,U as g,a as l,b as i,x as r}from"./WUJCCZQC.js";import"./3TTFCHAA.js";var d=l`:host{--arcgis-unit-select-inline-size: 180px}calcite-popover[calcite-hydrated-hidden]{inset-block-start:-999999px;inset-inline-start:-999999px}.popover-content{display:flex;flex-direction:column;gap:var(--calcite-spacing-md);padding:var(--calcite-spacing-md);max-width:300px}.uniform-chart-scaling-label{--calcite-label-margin-bottom: 0}.uniform-chart-scaling-checkbox-wrapper{width:var(--arcgis-unit-select-inline-size);flex-shrink:0}.slot-content{display:flex;flex-direction:column;gap:var(--calcite-spacing-sm)}.slot-content ::slotted(*){max-inline-size:100%}`,c=class extends p{constructor(){super(...arguments),this._onUniformChartScalingChange=t=>{this.arcgisElevationProfileSettingsUniformChartScalingChange.emit(t.currentTarget.checked)},this._onActionRef=t=>{this._actionElement=t??void 0},this._popoverIsOpen=!1,this.hideDistanceDisplayUnitSelect=!1,this.hideElevationDisplayUnitSelect=!1,this.hideUniformChartScalingToggle=!1,this.hasCustomStartContent=!1,this.hasCustomEndContent=!1,this.arcgisElevationProfileSettingsUniformChartScalingChange=r()}static{this.properties={_popoverIsOpen:16,_actionElement:16,viewModel:0,hideDistanceDisplayUnitSelect:5,hideElevationDisplayUnitSelect:5,hideUniformChartScalingToggle:5,hasCustomStartContent:5,hasCustomEndContent:5,messages:0,uniformChartScaling:5,unitOptionsDistance:0,unitOptionsElevation:0}}static{this.styles=d}async destroy(){await this.manager.destroy()}_onPopoverClose(){this._popoverIsOpen=!1}_onPopoverOpen(){this._popoverIsOpen=!0}render(){let{messages:t}=this;if(!t||!this.hasCustomStartContent&&!this.hasCustomEndContent&&this.hideDistanceDisplayUnitSelect&&this.hideElevationDisplayUnitSelect&&this.hideUniformChartScalingToggle)return;let e=(this._popoverIsOpen?t.hideSettings:t.showSettings)??"";return i`<calcite-action icon=gear .text=${e} title=${e??a} ${h(this._onActionRef)}></calcite-action>${this._actionElement?i`<calcite-popover auto-close .label=${e} placement=bottom-end .referenceElement=${this._actionElement} =${this._onPopoverOpen} =${this._onPopoverClose}><div class="popover-content">${this._renderCustomContent("settings-start",this.hasCustomStartContent)}${this._renderUnitSelector()}${this._renderUniformChartScalingToggle()}${this._renderCustomContent("settings-end",this.hasCustomEndContent)}</div></calcite-popover>`:void 0}`}_renderUnitSelector(){let{viewModel:t,messages:e}=this;if(!t||this.hideDistanceDisplayUnitSelect&&this.hideElevationDisplayUnitSelect)return;let n="inline-space-between";return i`${o({hidden:this.hideDistanceDisplayUnitSelect,children:i`<arcgis-unit-select .options=${this.unitOptionsDistance} .selectLabel=${e.unitDistanceSelectLabel} .value=${t.distanceUnit} .layout=${n} =${s=>{t.distanceUnit=s.detail}}></arcgis-unit-select>`})}${o({hidden:this.hideElevationDisplayUnitSelect,children:i`<arcgis-unit-select .options=${this.unitOptionsElevation} .selectLabel=${e.unitElevationSelectLabel} .value=${t.elevationUnit} .layout=${n} =${s=>{t.elevationUnit=s.detail}}></arcgis-unit-select>`})}`}_renderUniformChartScalingToggle(){let{messages:t,hideUniformChartScalingToggle:e,uniformChartScaling:n}=this;if(e)return;let s=t?.[n?"uniformChartScalingDisable":"uniformChartScalingEnable"]??"";return i`<calcite-label class="uniform-chart-scaling-label" layout=inline-space-between>${t?.uniformChartScalingLabel}<div class="uniform-chart-scaling-checkbox-wrapper"><calcite-checkbox .checked=${n} title=${s??a} =${this._onUniformChartScalingChange}></calcite-checkbox></div></calcite-label>`}_renderCustomContent(t,e){if(e)return i`<div class="slot-content"><slot name=${t??a}></slot></div>`}};g("arcgis-elevation-profile-settings",c);export{c as ArcgisElevationProfileSettings};