You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
9.8 KiB
22 lines
9.8 KiB
// All material copyright Esri, All Rights Reserved, unless otherwise specified. |
|
// See https://js.arcgis.com/4.30/esri/copyright.txt for details. |
|
//>>built |
|
define("exports ../../chunks/tslib.es6 ../../Color ../../core/reactiveUtils ../../core/accessorSupport/decorators/property ../../core/accessorSupport/decorators/cast ../../core/RandomLCG ../../core/has ../../core/accessorSupport/decorators/subclass ../Histogram ../Slider ../Widget ./support/utils ../support/widgetUtils ../support/jsxFactory".split(" "),function(e,f,r,q,g,u,B,C,v,w,x,y,z,D,k){const t={interactiveTrack:!1};e.SmartMappingSliderBase=class extends y{constructor(a,d){super(a,d);this.histogram= |
|
new w({layout:"vertical"});this.histogramConfig=null;this.slider=new x({syncedSegmentsEnabled:!0,thumbsConstrained:!1,layout:"vertical",visibleElements:{labels:!0,rangeLabels:!0},labelInputsEnabled:!0,rangeLabelInputsEnabled:!0});this.viewModel=null;this.visibleElements={...t};const c=this.slider;!a?.hasTimeData||a?.inputParseFunction||a?.inputFormatFunction||c.set({labelInputsEnabled:!1,rangeLabelInputsEnabled:!1});c.draggableSegmentsEnabled=!!a?.visibleElements?.interactiveTrack;this.addHandles([c.on("max-change", |
|
b=>this.emit("max-change",b)),c.on("max-click",b=>this.emit("max-click",b)),c.on("min-change",b=>this.emit("min-change",b)),c.on("min-click",b=>this.emit("min-click",b)),c.on("segment-click",b=>this.emit("segment-click",b)),c.on("segment-drag",b=>this.emit("segment-drag",b)),c.on("thumb-change",b=>this.emit("thumb-change",b)),c.on("thumb-click",b=>this.emit("thumb-click",b)),c.on("thumb-drag",b=>this.emit("thumb-drag",b)),c.on("track-click",b=>this.emit("track-click",b)),q.watch(()=>[this.histogramConfig, |
|
this.max,this.min,this.zoomOptions],()=>{const {histogram:b,histogramConfig:h,viewModel:{max:l,min:m}}=this,n=this.getParamsFromHistogramConfig(h);b.set({...n,max:l,min:m})}),q.watch(()=>this.labelFormatFunction,()=>{const {histogram:b,labelFormatFunction:h}=this;b.set({labelFormatFunction:h})}),q.watch(()=>this.hasTimeData,b=>{const {labelInputsEnabled:h,rangeLabelInputsEnabled:l}=this.slider;b=!b||this.inputFormatFunction&&this.inputParseFunction;c.set({labelInputsEnabled:h&&b,rangeLabelInputsEnabled:l&& |
|
b})}),q.watch(()=>this.visibleElements?.interactiveTrack,b=>{c.draggableSegmentsEnabled=!!b})]);this._onMaxZoomCapPointerDown=this._onMaxZoomCapPointerDown.bind(this);this._onMinZoomCapPointerDown=this._onMinZoomCapPointerDown.bind(this)}initialize(){const {histogramConfig:a={},viewModel:d}=this,{labelFormatFunction:c,max:b,min:h}=d,l=this.getParamsFromHistogramConfig(a);this.histogram.set({labelFormatFunction:c,...l,max:b,min:h});this.slider.set({viewModel:d})}get hasTimeData(){return this.viewModel?.hasTimeData?? |
|
!1}set hasTimeData(a){this.viewModel&&(this.viewModel.hasTimeData=a)}get inputFormatFunction(){return this.viewModel?.inputFormatFunction}set inputFormatFunction(a){this.viewModel&&(this.viewModel.inputFormatFunction=a)}get inputParseFunction(){return this.viewModel?.inputParseFunction}set inputParseFunction(a){this.viewModel&&(this.viewModel.inputParseFunction=a)}get labelFormatFunction(){return this.viewModel?.labelFormatFunction}set labelFormatFunction(a){this.viewModel&&(this.viewModel.labelFormatFunction= |
|
a)}get max(){return this.viewModel?.getUnzoomedMax()??this._get("max")??null}set max(a){this.viewModel?this.viewModel.max=a:this._set("max",a)}get min(){return this.viewModel?.getUnzoomedMin()??this._get("min")??null}set min(a){this.viewModel?this.viewModel.min=a:this._set("min",a)}get precision(){return this.viewModel?.precision??4}set precision(a){this.viewModel&&(this.viewModel.precision=a)}get state(){return this.viewModel?.state??"disabled"}get syncedSegmentsEnabled(){return this.slider?.syncedSegmentsEnabled}set syncedSegmentsEnabled(a){this.slider&& |
|
(this.slider.syncedSegmentsEnabled=a)}get values(){return this.viewModel?.values??[]}castVisibleElements(a){return{...t,...a}}get zoomOptions(){return this.viewModel?.zoomOptions}set zoomOptions(a){this.viewModel&&(this.viewModel.zoomOptions=a)}renderContent(a,d,c){this.slider.extraNodes=[a,this.renderHistogram(c)];return k.tsx("div",{class:d},this.slider.render())}renderHistogram(a){return this.histogramConfig?k.tsx("div",{class:a??void 0,key:"histogram"},this.histogram.render()):null}renderBackgroundFillDefinition(a){return k.tsx("pattern", |
|
{height:"15",id:a,patternUnits:"userSpaceOnUse",width:"15",x:"0",y:"0"},k.tsx("image",{height:"15",href:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgaGVpZ2h0PSIxNiIgd2lkdGg9IjE2Ij48cGF0aCBkPSJNMCAwIEw4IDAgTDggOCBMMCA4IFoiIGZpbGw9IiNjY2MiIC8+PHBhdGggZD0iTTAgMCBMOCAwIEw4IDggTDAgOCBaIiBmaWxsPSIjZmZmIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgwLDgpIiAvPjxwYXRoIGQ9Ik0wIDAgTDggMCBMOCA4IEwwIDggWiIgZmlsbD0iI2NjYyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoOCw4KSIgLz48cGF0aCBkPSJNMCAwIEw4IDAgTDggOCBMMCA4IFoiIGZpbGw9IiNmZmYiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDgsMCkiIC8+PC9zdmc+", |
|
width:"15",x:"0",y:"0"}))}renderRampFillDefinition(a,d){return k.tsx("linearGradient",{id:a,x1:"0",x2:"0",y1:"0",y2:"1"},this.renderRampFillStops(d))}renderRampFillStops(a){return a.reverse().map((d,c)=>this.renderStop(d,c))}renderStop(a,d){const {color:c,offset:b,opacity:h}=this.getPropsForStop(a);return k.tsx("stop",{key:`${d}-stop`,offset:b,"stop-color":c,"stop-opacity":h})}renderZoomCaps(){return[this.renderMaxZoomCap(),this.renderMinZoomCap()]}renderMinZoomCap(){if(null!=this.zoomOptions?.min)return k.tsx("svg", |
|
{class:this.classes("zoom-cap","zoom-cap--min"),key:"bottom",onpointerdown:this._onMinZoomCapPointerDown,viewBox:"0 0 30 11",xmlns:"http://www.w3.org/2000/svg"},k.tsx("polygon",{class:"zoom-cap--mask",fill:"#1B8617",key:"mask",points:"0 11.3846154 30 11.3846154 30 1 25 5.38461538 20 1 15 5.38461538 10 1 5 5.38461538 0 1"}),k.tsx("polygon",{class:"zoom-cap--underline",fill:"#69DCFF",key:"underline",points:"0 0 5 4.38461538 10 0 15 4.38461538 20 0 25 4.38461538 30 0 30 4.61538462 25 9 20 4.61538462 15 9 10 4.61538462 5 9 0 4.61538462"}), |
|
k.tsx("polygon",{class:"zoom-cap--line",fill:"#DA5656",key:"line",points:"0 1 5 5.38461538 10 1 15 5.38461538 20 1 25 5.38461538 30 1 30 5.61538462 25 10 20 5.61538462 15 10 10 5.61538462 5 10 0 5.61538462"}))}renderMaxZoomCap(){if(null!=this.zoomOptions?.max)return k.tsx("svg",{class:this.classes("zoom-cap","zoom-cap--max"),key:"top",onpointerdown:this._onMaxZoomCapPointerDown,viewBox:"0 0 30 11",xmlns:"http://www.w3.org/2000/svg"},k.tsx("polygon",{class:"zoom-cap--mask",key:"mask",points:"0 -1.81994377e-12 30 -1.81994377e-12 30 8.23076923 25 3.61538462 20 8.23076923 15 3.61538462 10 8.23076923 5 3.61538462 0 8.23076923"}), |
|
k.tsx("polygon",{class:"zoom-cap--underline",key:"underline",points:"0 5.61538462 5 1 10 5.61538462 15 1 20 5.61538462 25 1 30 5.61538462 30 10.2307692 25 5.61538462 20 10.2307692 15 5.61538462 10 10.2307692 5 5.61538462 0 10.2307692"}),k.tsx("polygon",{class:"zoom-cap--line",key:"line",points:"0 4.61538462 5 -1.87329639e-12 10 4.61538462 15 -1.87329639e-12 20 4.61538462 25 -1.87329639e-12 30 4.61538462 30 9.23076923 25 4.61538462 20 9.23076923 15 4.61538462 10 9.23076923 5 4.61538462 0 9.23076923"}))}getPropsForStop(a){const {color:d, |
|
offset:c}=a;return{color:d instanceof r?d.toCss(!0):r.fromString(d).toCss(!0),offset:(100*c).toFixed(2)+"%",opacity:d instanceof r?d.toRgba()[3]:null}}getParamsFromHistogramConfig(a){if(!a)return null;const {average:d,barCreatedFunction:c,bins:b,dataLineCreatedFunction:h,dataLineUpdatedFunction:l}=a;return{average:d,barCreatedFunction:c,bins:b,dataLineCreatedFunction:h,dataLineUpdatedFunction:l,dataLines:this._getDataLines(a)}}_onMaxZoomCapPointerDown(){var {zoomOptions:a}=this;null!=a?.max&&({min:a}= |
|
a,this.zoomOptions=null!=a?{min:a}:null)}_onMinZoomCapPointerDown(){var {zoomOptions:a}=this;null!=a?.min&&({max:a}=a,this.zoomOptions=null!=a?{max:a}:null)}_getDataLines(a){const {average:d,standardDeviation:c,standardDeviationCount:b}=a,{max:h,min:l}=this.viewModel.getBounds();return[...this._getStandardDeviationDataLines(c,d,b||1),...(a.dataLines||[])].filter(({value:m})=>m<=h&&m>=l)}_getStandardDeviationDataLines(a,d,c){const {max:b,min:h}=this.viewModel,l=.06*(b-h);return z.getDeviationValues(a, |
|
d,c).filter(m=>Math.abs(d-m)>l).map((m,n,p)=>{const A=this.labelFormatFunction?this.labelFormatFunction(m):m;p=p.length/2;n=n>=p?n-p+1:p-n;return{value:m,label:`${m>d?"+":"-"}${1===n?"":n}\u03c3 ${A}`}})}};f.__decorate([g.property()],e.SmartMappingSliderBase.prototype,"hasTimeData",null);f.__decorate([g.property()],e.SmartMappingSliderBase.prototype,"histogram",void 0);f.__decorate([g.property()],e.SmartMappingSliderBase.prototype,"histogramConfig",void 0);f.__decorate([g.property()],e.SmartMappingSliderBase.prototype, |
|
"inputFormatFunction",null);f.__decorate([g.property()],e.SmartMappingSliderBase.prototype,"inputParseFunction",null);f.__decorate([g.property()],e.SmartMappingSliderBase.prototype,"labelFormatFunction",null);f.__decorate([g.property()],e.SmartMappingSliderBase.prototype,"max",null);f.__decorate([g.property()],e.SmartMappingSliderBase.prototype,"min",null);f.__decorate([g.property()],e.SmartMappingSliderBase.prototype,"precision",null);f.__decorate([g.property()],e.SmartMappingSliderBase.prototype, |
|
"slider",void 0);f.__decorate([g.property({readOnly:!0})],e.SmartMappingSliderBase.prototype,"state",null);f.__decorate([g.property()],e.SmartMappingSliderBase.prototype,"syncedSegmentsEnabled",null);f.__decorate([g.property({readOnly:!0})],e.SmartMappingSliderBase.prototype,"values",null);f.__decorate([g.property()],e.SmartMappingSliderBase.prototype,"viewModel",void 0);f.__decorate([g.property()],e.SmartMappingSliderBase.prototype,"visibleElements",void 0);f.__decorate([u.cast("visibleElements")], |
|
e.SmartMappingSliderBase.prototype,"castVisibleElements",null);f.__decorate([g.property()],e.SmartMappingSliderBase.prototype,"zoomOptions",null);e.SmartMappingSliderBase=f.__decorate([v.subclass("esri.widgets.smartMapping.SmartMappingSliderBase")],e.SmartMappingSliderBase);Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}); |