@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
3 lines (2 loc) • 1.47 kB
JavaScript
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */
import{__decorate as e}from"tslib";import{isMeasurementSystem as t}from"../../core/units.js";import{property as o,subclass as s}from"../../core/accessorSupport/decorators.js";import c from"../Widget.js";import{loadCalciteComponents as i}from"./componentsUtils.js";import{messageBundle as l,tsx as r}from"./widget.js";const n="esri-unit-select",a={base:n,label:`${n}__label`,select:`${n}__select`};let p=class extends c{constructor(e,t){super(e,t),this._onSelectChange=e=>{this.onChange(e.currentTarget.value)}}loadDependencies(){return i({label:()=>import("@esri/calcite-components/dist/components/calcite-label"),option:()=>import("@esri/calcite-components/dist/components/calcite-option"),select:()=>import("@esri/calcite-components/dist/components/calcite-select")})}render(){const{messages:e,options:o,selectLabel:s,value:c,_onSelectChange:i}=this;return r("div",{class:a.base,key:"units"},r("calcite-label",{class:a.label},s,r("calcite-select",{class:a.select,label:s,onCalciteSelectChange:i},o.map(o=>r("calcite-option",{key:o,selected:o===c,value:o},t(o)?e.systems[o]:e.units[o]?.pluralCapitalized)))))}};e([o()],p.prototype,"options",void 0),e([o()],p.prototype,"onChange",void 0),e([o()],p.prototype,"selectLabel",void 0),e([o()],p.prototype,"value",void 0),e([o(),l("esri/core/t9n/Units")],p.prototype,"messages",void 0),p=e([s("esri.widgets.support.UnitSelect")],p);export{p as UnitSelect};