// All material copyright ESRI, All Rights Reserved, unless otherwise specified. // See https://js.arcgis.com/4.7/esri/copyright.txt for details. //>>built require({cache:{"url:esri/widgets/RendererSlider/templates/RendererSlider.html":'\x3cdiv class\x3d"${_css.container}"\x3e\r\n \x3cdiv class\x3d"${_css.topLabelNode} ${_css.topLabelNodeHover}" data-dojo-attach-point\x3d"_topNode"\x3e\r\n \x3cspan data-dojo-attach-point\x3d"_topNodeSpan"\x3e\x3c/span\x3e \r\n \x3c/div\x3e\r\n \x3cdiv class\x3d"${_css.slidernode}" data-dojo-attach-point\x3d"_sliderNode"\x3e\r\n \x3cdiv class\x3d"${_css.sliderarea}" data-dojo-attach-point\x3d"_sliderArea"\x3e\x3c/div\x3e\r\n \x3cdiv class\x3d"${_css.sliderarearight}" data-dojo-attach-point\x3d"_sliderAreaRight"\x3e\x3c/div\x3e\r\n \x3c/div\x3e\r\n \x3cdiv class\x3d"${_css.bottomLabelNode} ${_css.bottomLabelNodeHover}" data-dojo-attach-point\x3d"_botNode"\x3e\r\n \x3cspan data-dojo-attach-point\x3d"_bottomNodeSpan"\x3e\x3c/span\x3e\r\n \x3c/div\x3e\r\n\x3c/div\x3e'}}); define("./Widgette ./DateTimeTextBox ./RendererSlider/sliderUtils ../core/lang ../core/numberUtils ../renderers/support/utils dijit/_TemplatedMixin dijit/form/NumberTextBox dojo/_base/array dojo/_base/lang dojo/dnd/move dojo/dom-construct dojo/dom-style dojo/dom-class dojo/on dojo/text!./RendererSlider/templates/RendererSlider.html".split(" "),function(F,w,v,C,x,D,G,B,t,f,H,u,p,E,q,I){return F.createSubclass([G],{declaredClass:"esri.widgets.RendererSlider",templateString:I,_visibleLabels:["data", "handle"],_roundedDataLabels:[],_roundedHandleLabels:[],_ratioLabels:[],_minRatioLabel:"",_maxRatioLabel:"",_sliderHeight:null,_isZoomed:!1,_minZoomLabel:"",_maxZoomLabel:"",_maximumNumberEditor:null,_minimumNumberEditor:null,_valueDifferenceByIndex:[],_currentTopValue:[],_isLTR:!0,_ctrlDown:!1,_histogramSurface:null,_css:null,_minPrecisionForSmallNumbers:3,_handles:[],properties:{loaded:!1,intermediateChanges:!0,type:null,minimum:0,maximum:100,values:[],precision:2,handles:[],handlesVisible:!0,primaryHandleIndex:null, ticksVisible:!0,labelsVisible:!0,ratioLabelsVisible:null,minLabel:null,maxLabel:null,isDate:!1},constructor:function(a,b){this._css={container:"esri-renderer-slider",slidernode:"esri-slider-node",sliderarea:"esri-slider-area",sliderarearight:"esri-slider-area-right",moveable:"esri-moveable",handler:"esri-handle",handlerSpan:"esri-handle-span",handlerContainer:"esri-handle-container",handlerLabel:"esri-handle-label",handlerLabelSpan:"esri-handle-label-span",topLabelNode:"esri-top-label-node",bottomLabelNode:"esri-bottom-label-node", topLabelNodeHover:"esri-top-label-node-hover",bottomLabelNodeHover:"esri-bottom-label-node-hover",heatmapTick:"esri-heatmap-tick",handlerTick:"esri-handler-tick",handlerTickTop:"esri-handler-tick-top",handlerTickBottom:"esri-handler-tick-bottom"};this.labelsVisible=a.labelsVisible||this._visibleLabels},startup:function(){this.inherited(arguments);var a=p.get(this._sliderArea,"height");this._sliderHeight=a?a:200;this._checkMinMaxDefaults();this._isLTR=this.isLeftToRight();if(!this._isLTR){var a=p.get(this._sliderNode, "padding-left")+p.get(this._sliderNode,"padding-right"),b=Math.round(p.get(this._sliderNode,"width"));this._sliderNodeWidth_RTL=a+b}this._updateRoundedLabels();this._generateMoveables();this._generateMinMaxEditors();this._generateCtrlKeyListener();this.watch("values",this._valuesChange);this.watch("minimum, maximum, ratioLabelsVisible",this._updateTimeout);this.loaded=!0;this.emit("load")},setValue:function(a,b,d){var c=this.get("values"),e=c.slice(0);"object"===typeof c[0]?e[a].value=b:e[a]=b;if(this.intermediateChanges|| d)this.values=e;d?this.emit("stop",{values:this.get("values")}):this.emit("slide",{values:e})},_updateTimeout:function(a,b,d){this._updateSlider()},_updateSlider:function(){this._reset();this._checkMinMaxDefaults();this._updateRoundedLabels();this._generateMoveables();this._generateMinMaxEditors();this._generateCtrlKeyListener()},_checkMinMaxDefaults:function(){var a=this.values,b;this.minimum===this.maximum&&a&&0b&&(this.minimum=b),a=isNaN(a[a.length-1])?a[a.length-1].value:a[a.length-1],this.maximum=b&&-1<=b&&1>=d&&-1<=d||c>=this._minPrecisionForSmallNumbers?(a*(d-b)+b)/e*e:parseFloat((Math.round((a* (d-b)+b)/e)*e).toFixed(c))},_generateMoveables:function(){var a,b=this._sliderNode,d=this._sliderHeight,c=this.get("minimum"),e=this.get("maximum"),r=this.get("labelsVisible"),g=this.get("ticksVisible"),m=f.hitch(this,this.setValue),k=this.get("values");this._updateMinMaxLabels();this.moveables=a=t.map(k,f.hitch(this,function(k,h){var l,y,q,n,A,w;if("object"===typeof k&&k.hidden)return null;"object"===typeof k&&(k=k.value);l=u.create("div",{style:this._getHandleStyleString(k),className:this._css.moveable}, b);l.handleContainer=A=u.create("div",{className:this._css.handlerContainer},l);l.arrowSpan=q=u.create("span",{className:this._css.handlerSpan},A);l.handler=k=u.create("div",{className:this._css.handler},A);"HeatmapSlider"!==this.type&&(!0===r||"object"===typeof r&&-1!==t.indexOf(r,"handles"))&&(y=this._generateHandleLabel(l,h));g&&this._generateHandleTicks(l,h);n=new H.constrainedMoveable(l,{handle:A,within:!0,constraints:f.hitch(this,function(){return{t:0,l:this._isLTR?0:this._sliderNodeWidth_RTL, w:0,h:d}})});n.onMoveStart=f.hitch(this,function(b){var c=this.handles,e=t.indexOf(c,h),z,g;this._currentTopValue[h]=b.node.style.top;w=Number(b.node.style.top.replace("px",""));l.labelNode&&l.labelNode._autoPositioned&&(p.set(l.labelNode,"top","3px"),l.labelNode._autoPositioned=!1);v._autoPositionHandleLabels(this.get("moveables"));l._numberEditor&&(l._numberEditor.destroy(),l._numberEditor=null);h!==this.primaryHandleIndex?(c&&0e||(p.set(a,"top",n+"px"),m(b,k,!1),a.labelNode&&(a.labelNode.spanNode.innerHTML=this.ratioLabelsVisible?this._getLabelValueFromIndex(b):this._formatValue(k.toFixed(6)))))})));g=1-Number(b.node.style.top.replace("px",""))/d;k=this._calculateValueFromHandlePosition(g);h!==this.primaryHandleIndex&& this._ctrlDown&&(r=Number(this._currentTopValue[h].replace("px",""))-Number(b.node.style.top.replace("px","")),this._currentTopValue[h]=b.node.style.top,0===h?(l=Number(a[a.length-1].style.top.replace("px","")),b=l+r,b>d&&(b=d),0>b&&(b=0),p.set(a[a.length-1],"top",b+"px"),b=1-b/d,b=this._calculateValueFromHandlePosition(b),m(a.length-1,b,!1),a[a.length-1].labelNode&&(a[a.length-1].labelNode.spanNode.innerHTML=this._formatValue(b.toFixed(6)))):h===a.length-1&&(l=Number(a[0].style.top.replace("px", "")),b=l+r,b>d&&(b=d),0>b&&(b=0),p.set(a[0],"top",b+"px"),b=1-b/d,b=this._calculateValueFromHandlePosition(b),m(0,b,!1),a[0].labelNode&&(a[0].labelNode.spanNode.innerHTML=this._formatValue(b.toFixed(6)))));m(h,k,!1);this._updateRoundedLabels();y&&(b=this._formatValue(parseFloat(this._roundValue([k,parseFloat(this._getLabelValueFromIndex(h,!0))])[0]).toFixed(this.precision)),y.spanNode.innerHTML=this.ratioLabelsVisible?this._getLabelValueFromIndex(h):b);v._autoPositionHandleLabels(this.get("moveables"))}); n.onMoveStop=f.hitch(this,function(a){a=Number(a.node.style.top.replace("px",""));a===w?w=null:(a=this._calculateValueFromHandlePosition(1-a/d),m(h,a,!0),this._updateRoundedLabels(),y&&(a=x.format(parseFloat(x.round([a,parseFloat(this._getLabelValueFromIndex(h,!0))])[0]).toFixed(this.precision)),y.spanNode.innerHTML=this.ratioLabelsVisible?this._getLabelValueFromIndex(h):a),v._autoPositionHandleLabels(this.get("moveables")))});this.handlesVisible||(p.set(k,"display","none"),p.set(q,"display","none")); return l}));v._autoPositionHandleLabels(this.get("moveables"))},_reset:function(){t.forEach(this.moveables,f.hitch(this,function(a){a&&a.parentElement.removeChild(a)}));this.moveables=[]},_getHandleStyleString:function(a){var b=this.get("minimum"),d=this.get("maximum");return"top: "+Math.round((1-(a-b)/(d-b))*this._sliderHeight)+"px; "+("left: "+(this._isLTR?0:this._sliderNodeWidth_RTL)+"px;")},_generateHandleTicks:function(a,b){var d=this._css,c=d.handlerTick+" "+d.handlerTickTop,e=d.handlerTick+ " "+d.handlerTickBottom;b=0===b?e:c;"HeatmapSlider"===this.type&&(b+=d.heatmapTick);a.tick=u.create("div",{className:b},a)},_updateLabels:function(){this._updateMinMaxLabels();this._updateRoundedLabels()},_resetLabelPositions:function(){t.forEach(this.moveables,function(a){if(a){var b=a.labelNode;b&&(p.set(b,"top","3px"),a.labelNode._autoPositioned=!1)}})},_generateHandleLabel:function(a,b){var d,c;d=u.create("div",{className:this._css.handlerLabel},a);c=u.create("span",{className:this._css.handlerLabelSpan, innerHTML:this._getLabelValueFromIndex(b)},d);d.spanNode=c;a.labelNode=d;q(d,"click",f.hitch(this,function(){this._generateHandleLabelEditor(a,b)}));return d},_updateMinMaxLabels:function(){var a=this.minimum,b=this.maximum,d=this.labelsVisible,c=this.minLabel,e=this.maxLabel,f=this._topNodeSpan,g=this._bottomNodeSpan,m=this._isZoomed,k=this._maxZoomLabel,n=this._minZoomLabel,h=this.ratioLabelsVisible,l=this._maxRatioLabel,q=this._minRatioLabel,p=this._roundedDataLabels;!1===d||"object"===typeof d&& -1===t.indexOf(d,"data")?(f.innerHTML="",g.innerHTML=""):m?h?(f.innerHTML=l,g.innerHTML=q):(f.innerHTML=this._formatValue(k),g.innerHTML=this._formatValue(n)):h?(f.innerHTML=l,g.innerHTML=q):(m=isNaN(c)?c:this._roundValue([c,e])[0],d=isNaN(e)?e:this._roundValue([c,e])[1],c=isNaN(m)||null===m?c:this._formatValue(m),e=isNaN(d)||null===d?e:this._formatValue(d),a=this._formatValue(p[0])||this._formatValue(a),b=this._formatValue(p[1])||this._formatValue(b),f.innerHTML=e||b,g.innerHTML=c||a)},_formatValue:function(a){"string"=== typeof a&&(a=Number(a));return this.isDate?D.formatDate(new Date(a),D.timelineDateFormatOptions):x.format(a)},_roundValue:function(a){return this.isDate?a.slice(0):x.round(a)},_updateRoundedLabels:function(){this._roundedDataLabels=this._roundValue([this.minimum,this.maximum]);switch(this.type){case "SizeSlider":case "ClassedSizeSlider":case "ClassedColorSlider":case "UnivariateColorSizeSlider":this._roundedHandleLabels=this._roundValue(this.values);break;case "ColorSlider":case "OpacitySlider":this._roundedHandleLabels= this._roundValue(this._getValuesFromObject(this.values))}this._updateRatioLabels()},_updateRatioLabels:function(){var a=this.get("ratioLabelsVisible"),b=this.get("minimum"),d=this.get("maximum"),c=this._getValuesFromObject(this.values),e=[],f,g;a&&("percent"!==a&&"percentTotal"!==a?a=null:("percent"===a?(t.forEach(c,function(a){e.push(this._getRatioFromValue(a))},this),f=this._formatValue(this._getRatioFromValue(b).toFixed(2)),g=this._formatValue(this._getRatioFromValue(d).toFixed(2))):"percentTotal"=== a&&(t.forEach(c,function(a){e.push(this._getRatioFromValue(a))},this),f=this._formatValue(this._getRatioFromValue(b).toFixed(2)),g=this._formatValue(this._getRatioFromValue(d).toFixed(2))),this._ratioLabels=e,this._minRatioLabel=f+"%",this._maxRatioLabel=g+"%"))},_generateMinMaxEditors:function(){!this.labelsVisible||"object"===typeof this.labelsVisible&&-1===t.indexOf(this.labelsVisible,"data")||"HeatmapSlider"===this.type?(E.remove(this._topNode,this._css.topLabelNodeHover),E.remove(this._botNode, this._css.bottomLabelNodeHover)):(q(this._topNode,"click",f.hitch(this,this._generateMaxEditor)),q(this._botNode,"click",f.hitch(this,this._generateMinEditor)))},_generateMaxEditor:function(){if(!(this._maximumNumberEditor&&this._topLabelNode||this._isZoomed)){var a=this.get("minLabel"),b=this.get("maxLabel"),d=this.get("maximum"),c=this.handles,e;this._topNodeSpan.innerHTML="";this._topLabelNode=u.create("input",{type:"text"},this._topNode);e=c&&0Number(n))||isNaN(b)||void 0=== b?(b=isNaN(d)?d:this._roundValue([g,m])[f],b=isNaN(b)||null===b?d:this._formatValue(b),c=this._formatValue(this._roundedDataLabels[f])||this._formatValue(c),e.innerHTML=this.ratioLabelsVisible?k:b||c):(k=this.ratioLabelsVisible?this._getValueFromPercent(b):b,e.innerHTML=this.ratioLabelsVisible?k:this._formatValue(b),this.set("\x3c"===a?"maximum":"minimum",k),this._reset(),this._updateRoundedLabels(),this._generateMoveables(),this._generateMinMaxEditors(),this.emit("data-value-change",{min:this.minimum, max:this.maximum,values:C.clone(this.values)}))},_minMaxKeydownDateHandler:function(a,b){13===b.keyCode&&a.editor.isValid()&&setTimeout(f.hitch(this,this._destroyMinMaxHandleEditor,a),0)},_minMaxBlurDateValue:function(a,b){setTimeout(f.hitch(this,this._destroyMinMaxHandleEditor,a),0)},_destroyMinMaxHandleEditor:function(a){a.spanNode.innerHTML=this._formatValue(this.get("\x3c"===a.operator?"maximum":"minimum"));a.editor.destroy();this[a.editorPropName]=null},_minMaxUpdateDateValue:function(a){var b= a.spanNode,d=a.operator;a=a.editor.get("date");var d="\x3c"===d?"maximum":"minimum",c=this.get(d);a=a&&a.getTime();if(c=c!==a)b.innerHTML=this._formatValue(a),this.set(d,a);this._reset();this._updateRoundedLabels();this._generateMoveables();this._generateMinMaxEditors();c&&this.emit("data-value-change",{min:this.minimum,max:this.maximum,values:C.clone(this.values)})},_generateHandleLabelEditor:function(a,b){if(!a._numberEditor){var d=this.get("handles"),c=this.get("maximum"),e=this.get("minimum"), r=this._isZoomed,g=this.get("values"),m=g[b],k=t.indexOf(d,b),n=a.labelNode,h,l,p,v;"object"===typeof m&&(m=m.value);n.spanNode.innerHTML="";v=u.create("input",{type:"text"},n);d&&0=a.constraints.min?a.focusNode.blur():(d=a.validate,a.validate(!1),a.validate=function(){return!1}))}, _blurHandler:function(a,b){b=a.editor;var d=a.editorPropName,c=a.updatedValue,e=a.min,f=a.max,g=a.index,m=a.zoomed,k=a.spanNode;a=a.moveable;isNaN(b.get("value"))&&b.set("value",c);m&&(b.get("value")>f||b.get("value")d.constraints.max||bd||ab.right||a.bottomb.bottom)},_generateCtrlKeyListener:function(){},_valuesChange:function(){this.emit("data-change",{values:this.get("values")})}})});