UNPKG

@arcgis/core

Version:

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

3 lines (2 loc) 2 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */ import{__decorate as e}from"tslib";import{property as o,subclass as t}from"../../../core/accessorSupport/decorators.js";import i from"../../Slider.js";import{SliderWithDropdownViewModel as s}from"./SliderWithDropdownViewModel.js";import{TimezonePicker as r}from"../../support/TimezonePicker.js";import{tsx as n}from"../../support/widget.js";import{onResize as l}from"../../support/widgetUtils.js";const p="esri-slider-with-dropdown",d={label:"esri-slider__label",box:`${p}__box`,boxDropDownOn:`${p}__box--drop-down-on`,boxDropDownOff:`${p}__box--drop-down-off`};let h=class extends i{constructor(e,o){super({...e,suppressDeprecationWarning:!0},o),this.viewModel=new s,this.showDropDown=!0,this._labelWidth=0,this._onLabelAfterCreate=e=>{const o="label-size-observer";this.removeHandles(o),this.addHandles(l(e,({contentRect:e})=>{this._labelWidth=e.width}),o)},this._getLabelStyles=()=>{if(!this.trackElement)return;const e=this._trackWidth,o=this._labelWidth/2,t=this.getCurrentPosition(),i=t-o,s=t+o;let r=-o;return i<0?r+=-i:s>e&&(r+=e-s),{left:`${r}px`}},this._onTimezoneChange=e=>{this.viewModel.utcOffset=e},this._onTimezonePickerOpen=()=>{this.viewModel.timezonePickerOpen=!0},this._onTimezonePickerClose=()=>{this.viewModel.timezonePickerOpen=!1}}renderThumbLabel(e){const{showDropDown:o,viewModel:t}=this;return n("div",{afterCreate:this._onLabelAfterCreate,class:this.classes({[d.box]:!0,[d.label]:!0,[d.boxDropDownOn]:o,[d.boxDropDownOff]:!o}),key:"thumb-label",styles:this._getLabelStyles()},super.renderThumbLabel(e),o?n(r,{disabled:this.disabled,open:t.timezonePickerOpen,value:t.utcOffset,onChange:this._onTimezoneChange,onClose:this._onTimezonePickerClose,onOpen:this._onTimezonePickerOpen}):null)}};e([o()],h.prototype,"viewModel",void 0),e([o()],h.prototype,"showDropDown",void 0),e([o()],h.prototype,"_labelWidth",void 0),h=e([t("esri.widgets.Daylight.support.SliderWithDropdown")],h);const a=h;export{a as default};