12345 |
- /*
- All material copyright ESRI, All Rights Reserved, unless otherwise specified.
- See https://js.arcgis.com/4.24/esri/copyright.txt for details.
- */
- import{_ as e}from"../../chunks/tslib.es6.js";import{isSome as o}from"../../core/maybe.js";import{watch as t}from"../../core/reactiveUtils.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import r from"../Widget.js";import"../support/widgetUtils.js";import{tsx as a}from"../support/jsxFactory.js";import{LABELED_SLIDER_CSS as n}from"./css.js";let c=class extends r{constructor(e){super(e),this.debounceDelay=200,this._onChangeTimeout=null,this._onChangeDebounced=e=>{const o=e.target.value;this._cancelChange(),this._onChangeTimeout=setTimeout((()=>this.onChange(o)),this.debounceDelay)},this._cancelChange=()=>{o(this._onChangeTimeout)&&(clearTimeout(this._onChangeTimeout),this._onChangeTimeout=null)}}initialize(){this.own([t((()=>this.onChange),(()=>{this._cancelChange()}))])}render(){const{label:e,disabled:o}=this;return a("div",{class:n.base},a("calcite-label",{scale:"s",disabled:o},e,a("calcite-slider",{"aria-label":e,disabled:this.disabled,max:1,min:0,step:.01,value:this.value,onCalciteSliderInput:this._onChangeDebounced,onCalciteSliderChange:this._onChangeDebounced})))}destroy(){this._cancelChange()}async loadDependencies(){await import("@esri/calcite-components/dist/components/calcite-slider.js")}};e([s()],c.prototype,"value",void 0),e([s()],c.prototype,"onChange",void 0),e([s()],c.prototype,"disabled",void 0),e([s()],c.prototype,"debounceDelay",void 0),c=e([i("esri.widgets.Weather.LabeledSlider")],c);export{c as LabeledSlider};
|