UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

3 lines (2 loc) 3.01 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */ import{__decorate as e}from"tslib";import{property as t,subclass as o}from"../../../core/accessorSupport/decorators.js";import n from"../../Widget.js";import{settingsCss as i}from"../css.js";import{loadCalciteComponents as r}from"../../support/componentsUtils.js";import{UnitSelect as s}from"../../support/UnitSelect.js";import{tsx as c}from"../../support/widget.js";let l=class extends n{constructor(){super(...arguments),this.messages=null,this._popoverIsOpen=!1,this._referenceElement=null,this._onUniformChartScalingChange=e=>{this.onUniformChartScalingChange(e.currentTarget.checked)}}loadDependencies(){return r({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),checkbox:()=>import("@esri/calcite-components/dist/components/calcite-checkbox"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),popover:()=>import("@esri/calcite-components/dist/components/calcite-popover")})}render(){const{id:e,messages:t,visibleElements:o}=this,{unitSelector:n,uniformChartScalingToggle:r}=o;if(!t||!n&&!r)return c("div",{key:`${e}-empty`});const s=this._popoverIsOpen?t.hideSettings:t.showSettings;return c("div",{class:i.base,key:this},c("calcite-action",{afterCreate:e=>{this._referenceElement=e},"data-testid":"settings-button",icon:"gear",text:s,title:s}),this._referenceElement?c("calcite-popover",{autoClose:!0,label:s,placement:"bottom-end",referenceElement:this._referenceElement,topLayerDisabled:this.topLayerDisabled,onCalcitePopoverClose:()=>{this._popoverIsOpen=!1},onCalcitePopoverOpen:()=>{this._popoverIsOpen=!0}},this._renderPopoverContent()):null)}_renderPopoverContent(){const{unitSelector:e,uniformChartScalingToggle:t}=this.visibleElements;return c("div",{class:i.popoverContent},e?this._renderUnitSelector():null,t?this._renderUniformChartScalingToggle():null)}_renderUnitSelector(){const{messages:e}=this;return c(s,{key:"unit-selector-label",options:this.unitOptions,selectLabel:e?.unitSelectLabel??"",value:this.unit,onChange:this.onUnitChange})}_renderUniformChartScalingToggle(){const{messages:e}=this,t=this.uniformChartScaling,o=e?.[t?"uniformChartScalingDisable":"uniformChartScalingEnable"]??"";return c("calcite-label",{class:i.uniformChartScalingLabel,key:"uniform-chart-scaling-label",layout:"inline"},c("calcite-checkbox",{checked:t,class:i.uniformChartScalingCheckbox,title:o,onCalciteCheckboxChange:this._onUniformChartScalingChange}),e?.uniformChartScalingLabel)}};e([t()],l.prototype,"messages",void 0),e([t()],l.prototype,"onUniformChartScalingChange",void 0),e([t()],l.prototype,"onUnitChange",void 0),e([t()],l.prototype,"uniformChartScaling",void 0),e([t()],l.prototype,"unit",void 0),e([t()],l.prototype,"unitOptions",void 0),e([t()],l.prototype,"visibleElements",void 0),e([t()],l.prototype,"_popoverIsOpen",void 0),e([t()],l.prototype,"_referenceElement",void 0),l=e([o("esri.widgets.ElevationProfile.components.SettingsButton")],l);export{l as SettingsButton};