HistogramRangeSliderViewModel.js 1.7 KB

12345
  1. /*
  2. All material copyright ESRI, All Rights Reserved, unless otherwise specified.
  3. See https://js.arcgis.com/4.25/esri/copyright.txt for details.
  4. */
  5. import{_ as e}from"../../chunks/tslib.es6.js";import{isNone as t}from"../../core/maybe.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/accessorSupport/ensureType.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import o from"../Slider/SliderViewModel.js";import{formatDateLabel as a,formatNumberLabel as i}from"../smartMapping/support/utils.js";let n=class extends o{constructor(e){super(e),this.average=null,this.bins=null,this.hasTimeData=!1,this.labelFormatFunction=e=>{if(this.hasTimeData)return a(e);const{max:t,min:r,precision:s}=this,o=t-r>10?2:s;return i(parseFloat(e.toFixed(o)))},this.rangeType="equal",this.standardDeviation=null}generateWhereClause(e){const{rangeType:r,state:s,values:o}=this;if("ready"!==s||!o.length||t(e))return null;const a=o[0],i=o.length>1?o[o.length-1]:null;switch(r){case"equal":return`${e} = ${a}`;case"not-equal":return`${e} <> ${a}`;case"less-than":return`${e} < ${a}`;case"greater-than":return`${e} > ${a}`;case"at-least":return`${e} >= ${a}`;case"at-most":return`${e} <= ${a}`;case"between":return`${e} BETWEEN ${a} AND ${i}`;case"not-between":return`${e} NOT BETWEEN ${a} AND ${i}`;default:return null}}};e([r()],n.prototype,"average",void 0),e([r()],n.prototype,"bins",void 0),e([r()],n.prototype,"hasTimeData",void 0),e([r()],n.prototype,"labelFormatFunction",void 0),e([r()],n.prototype,"rangeType",void 0),e([r()],n.prototype,"standardDeviation",void 0),n=e([s("esri.widgets.HistogramRangeSlider.HistogramRangeSliderViewModel")],n);const l=n;export{l as default};