UNPKG

@progress/kendo-ui

Version:

This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.

3 lines (2 loc) 23.7 kB
!function(e){"function"==typeof define&&define.amd?define(["kendo.draganddrop.min","kendo.icons.min"],e):e()}((function(){!function(e,t){var n=window.kendo,i=n.ui.Widget,a=n.ui.Draggable,o=n._outerWidth,l=n._outerHeight,r=e.extend,s=n.format,d=n.parseFloat,u=Array.isArray,c=Math,p=n.support,f=p.pointers,v=p.msPointers,m="change",_="slide",h=".slider",g="touchstart"+h+" mousedown"+h,k=f?"pointerdown"+h:v?"MSPointerDown"+h:g,w="touchend"+h+" mouseup"+h,S=f?"pointerup":v?"MSPointerUp"+h:w,b="moveSelection",x="keydown"+h,D="click"+h,H="mouseover"+h,T="focus"+h,y="blur"+h,E=".k-draghandle",I=".k-slider-track",z=".k-tick",C="k-disabled",A="disabled",R="tabindex",F=n.getTouches,V="aria-valuetext",q="aria-valuenow",M=i.extend({init:function(e,t){var a=this;if(i.fn.init.call(a,e,t),t=a.options,a._isHorizontal="horizontal"==t.orientation,a._isRtl=a._isHorizontal&&n.support.isRtl(e),a._position=a._isHorizontal?"left":"bottom",a._sizeFn=a._isHorizontal?"width":"height",a._outerSize=a._isHorizontal?o:l,t.tooltip.format=t.tooltip.enabled&&t.tooltip.format||"{0}",t.smallStep<=0)throw new Error("Kendo UI Slider smallStep must be a positive number.");a._createHtml(),a._trackDiv=a.wrapper.find(I),a._maxSelection=a._trackDiv[a._sizeFn](),a._sliderItemsInit(),a._reset(),a._tabindex(a.wrapper.find(E)),a[t.enabled?"enable":"disable"]();var r=n.support.isRtl(a.wrapper)?-1:1;a._keyMap={37:N(-1*r*t.smallStep),40:N(-t.smallStep),39:N(1*r*t.smallStep),38:N(+t.smallStep),35:O(t.max),36:O(t.min),33:N(+t.largeStep),34:N(-t.largeStep)},a._ariaLabel(a.wrapper.find(E)),n.notify(a)},events:[m,_],options:{enabled:!0,min:0,max:10,smallStep:1,largeStep:5,orientation:"horizontal",tickPlacement:"both",tooltip:{enabled:!0,format:"{0}"}},_distance:function(){return B(this.options.max-this.options.min)},_resize:function(){this.wrapper.find(".k-slider-items").remove(),this._maxSelection=this._trackDiv[this._sizeFn](),this._sliderItemsInit(),this._refresh(),this.options.enabled&&this.enable(!0)},_sliderItemsInit:function(){var t=this,n=t.options,i=(t._maxSelection-2)/((n.max-n.min)/n.smallStep),a=t._calculateItemsWidth(c.floor(U(t._distance())/U(n.smallStep)));"none"!=n.tickPlacement&&i>=2&&(e(this.element).parent().find(".k-slider-items").remove(),t._trackDiv.before(function(e,t){var n,i="<ul class='k-reset k-slider-items' role='presentation'>",a=c.floor(B(t/e.smallStep))+1;for(n=0;n<a;n++)i+="<li class='k-tick'></li>";return i+="</ul>"}(n,t._distance())),t._setItemsTitle()),t._calculateSteps(a),"none"!=n.tickPlacement&&i>=2&&n.largeStep>=n.smallStep&&(t._setItemsLargeTick(),t.wrapper.find(z).first().addClass("k-first"),t.wrapper.find(z).last().addClass("k-last"))},getSize:function(){return n.dimensions(this.wrapper)},_setItemsTitle:function(){for(var t=this.options,n=this.wrapper.find(z),i=t.min,a=n.length,o=0;o<=a;o+=1)e(n[o]).attr("title",s(t.tooltip.format,B(i))),i+=t.smallStep},_setItemsLargeTick:function(){var t,n=this,i=n.options,a=n.wrapper.find(z),o=0;if(U(i.largeStep)%U(i.smallStep)==0||n._distance()/i.largeStep>=3)for(n._isHorizontal||n._isRtl||(a=e.makeArray(a).reverse()),o=0;o<a.length;o++){t=e(a[o]);var l=B(U(n._values[o]-this.options.min));l%U(i.smallStep)==0&&l%U(i.largeStep)==0&&(t.addClass("k-tick-large").html("<span class='k-label'>"+t.attr("title")+"</span>"),0!==o&&o!==a.length-1&&t.css("line-height",t[n._sizeFn]()+"px"))}},_calculateItemsWidth:function(e){var t,n,i,a=this,o=a.options,l=parseFloat(a._trackDiv.css(a._sizeFn))+1,r=a._distance(),s=U(r)/U(o.smallStep),d=l/U(r);for(s-e>0&&(l-=U(r)%U(o.smallStep)*d),t=l/e,n=[],i=0;i<e-1;i++)n[i]=t;return n[e-1]=n[e]=t/2,a._roundWidths(n)},_roundWidths:function(e){var t,n=0,i=e.length;for(t=0;t<i;t++)n+=e[t]-c.floor(e[t]),e[t]=c.floor(e[t]);return n=c.round(n),this._addAdditionalSize(n,e)},_addAdditionalSize:function(e,t){if(0===e)return t;var n,i=parseFloat(t.length-1)/parseFloat(1==e?e:e-1);for(n=0;n<e;n++)t[parseInt(c.round(i*n),10)]+=1;return t},_calculateSteps:function(e){var t,n=this,i=n.options,a=i.min,o=0,l=n._distance(),r=c.ceil(U(l)/U(i.smallStep)),s=1;if(r+=U(l)/U(i.smallStep)%1==0?1:0,e.splice(0,0,2*e[r-2]),e.splice(r-1,1,2*e.pop()),n._pixelSteps=[o],n._values=[a],0!==r){for(;s<r;)o+=(e[s-1]+e[s])/2,n._pixelSteps[s]=o,a+=i.smallStep,n._values[s]=B(a),s++;t=U(l)%U(i.smallStep)==0?r-1:r,n._pixelSteps[t]=n._maxSelection,n._values[t]=i.max,n._isRtl&&(n._pixelSteps.reverse(),n._values.reverse())}},_getValueFromPosition:function(e,t){var n,i=this,a=i.options,o=c.max(a.smallStep*(i._maxSelection/i._distance()),0),l=0,r=o/2;if(i._isHorizontal?(l=e-t.startPoint,i._isRtl&&(l=i._maxSelection-l)):l=t.startPoint-e,i._maxSelection-(parseInt(i._maxSelection%o,10)-3)/2<l)return a.max;for(n=0;n<i._pixelSteps.length;n++)if(c.abs(i._pixelSteps[n]-l)-1<=r)return B(i._values[n])},_getFormattedValue:function(e,t){var i,a,o,l="",r=this.options.tooltip;return u(e)?(a=e[0],o=e[1]):t&&t.type&&(a=t.selectionStart,o=t.selectionEnd),t&&(i=t.tooltipTemplate),!i&&r.template&&(i=n.template(r.template)),u(e)||t&&t.type?l=i?i({selectionStart:a,selectionEnd:o}):(a=s(r.format,a))+" - "+(o=s(r.format,o)):(t&&(t.val=e),l=i?i({value:e}):s(r.format,e)),l},_getDraggableArea:function(){var e=this,t=n.getOffset(e._trackDiv);return{startPoint:e._isHorizontal?t.left:t.top+e._maxSelection,endPoint:e._isHorizontal?t.left+e._maxSelection:t.top}},_createHtml:function(){var e=this,n=e.element,i=e.options,a=n.find("input");2==a.length?(a.eq(0).prop("value",W(i.selectionStart)),a.eq(1).prop("value",W(i.selectionEnd))):n.prop("value",W(i.value)),e.wrapper=n.wrap(function(e,t,n){var i=n?" k-slider-horizontal":" k-slider-vertical",a=e.style?e.style:t.attr("style"),o=t.attr("class")?" "+t.attr("class"):"",l="";"bottomRight"==e.tickPlacement?l=" k-slider-bottomright":"topLeft"==e.tickPlacement&&(l=" k-slider-topleft");return"<div class='k-widget k-slider"+i+o+"'"+(a=a?" style='"+a+"'":"")+"><div class='k-slider-track-wrap"+l+"'></div></div>"}(i,n,e._isHorizontal)).hide().parents(".k-slider"),i.showButtons&&e.wrapper.find(".k-slider-track-wrap").after(P(i,"increase",e._isHorizontal,e._isRtl)).before(P(i,"decrease",e._isHorizontal,e._isRtl)),n.before(function(e,n,i){var a,o,l,r=n.is("input")?1:2,s=2==r?e.leftDragHandleTitle:e.dragHandleTitle,d=e.value,u=e.selectionStart,c=e.selectionEnd;1===r?null!==(a=n.val())&&a!==t&&"null"!==a&&(null!==d&&d!==t||(d=a)):(o=n.find("input").eq(0).val(),l=n.find("input").eq(1).val(),null!==o&&o!==t&&"null"!==o&&(null!==u&&u!==t||(u=o)),null!==l&&l!==t&&"null"!==l&&(null!==c&&c!==t||(c=l)));return"<div class='k-slider-track'><div class='k-slider-selection'>\x3c!-- --\x3e</div><span tabindex='0' class='k-draghandle' title='"+s+"' role='slider' "+(!1===i?"aria-orientation='vertical' ":"")+"aria-valuemin='"+e.min+"' aria-valuemax='"+e.max+"' aria-valuenow='"+(r>1?u||e.min:d||e.min)+"'></span>"+(r>1?"<span tabindex='0' class='k-draghandle' title='"+e.rightDragHandleTitle+"'role='slider' "+(!1===i?"aria-orientation='vertical' ":"")+"aria-valuemin='"+e.min+"' aria-valuemax='"+e.max+"' aria-valuenow='"+(c||e.max)+"'></span>":"")+"</div>"}(i,n,e._isHorizontal))},_focus:function(t){var n=this,i=t.target,a=n.value(),o=n._drag;o||(i==n.wrapper.find(E).eq(0)[0]?(o=n._firstHandleDrag,n._activeHandle=0):(o=n._lastHandleDrag,n._activeHandle=1),a=a[n._activeHandle]),e(i).addClass("k-focus k-selected"),o&&(n._activeHandleDrag=o,o.selectionStart=n.options.selectionStart,o.selectionEnd=n.options.selectionEnd,o._updateTooltip(a))},_focusWithMouse:function(t){t=e(t);var n=this,i=t.is(E)?t.index():0;window.setTimeout((function(){n.wrapper.find(E)[2==i?1:0].focus()}),1),n._setTooltipTimeout()},_blur:function(t){var n=this,i=n._activeHandleDrag;e(t.target).removeClass("k-focus k-selected"),i&&(i._removeTooltip(),delete n._activeHandleDrag,delete n._activeHandle)},_setTooltipTimeout:function(){var e=this;e._tooltipTimeout=window.setTimeout((function(){var t=e._drag||e._activeHandleDrag;t&&t._removeTooltip()}),300)},_clearTooltipTimeout:function(){window.clearTimeout(this._tooltipTimeout);var e=this._drag||this._activeHandleDrag;e&&e.tooltipDiv&&e.tooltipDiv.stop(!0,!1).css("opacity",1)},_reset:function(){var t=this,n=t.element,i=n.attr("form"),a=i?e("#"+i):n.closest("form");a[0]&&(t._form=a.on("reset",t._formResetHandler.bind(t)))},min:function(e){if(!e)return this.options.min;this.setOptions({min:e})},max:function(e){if(!e)return this.options.max;this.setOptions({max:e})},setOptions:function(e){i.fn.setOptions.call(this,e),this._sliderItemsInit(),this._refresh()},destroy:function(){this._form&&this._form.off("reset",this._formResetHandler),i.fn.destroy.call(this)}});function P(e,t,i){var a="";return a=i?"increase"===t?"caret-alt-right":"caret-alt-left":"increase"==t?"caret-alt-up":"caret-alt-down","<a role='button' class='k-button k-button-md k-rounded-full k-button-solid k-button-solid-base k-icon-button k-button-"+t+"' title='"+e[t+"ButtonTitle"]+"' aria-label='"+e[t+"ButtonTitle"]+"'>"+n.ui.icon({icon:a,iconClass:"k-button-icon"})+"</a>"}function N(e){return function(t){return t+e}}function O(e){return function(){return e}}function W(e){return(e+"").replace(".",n.cultures.current.numberFormat["."])}function B(e){var t,n;return t=function(e){var t=e.toString(),n=0;return(t=t.split("."))[1]&&(n=t[1].length),n>10?10:n}(e=parseFloat(e,10)),n=c.pow(10,t||0),c.round(e*n)/n}function L(e,n){var i=d(e.getAttribute(n));return null===i&&(i=t),i}function Z(e){return void 0!==e}function U(e){return 1e4*e}var X=M.extend({init:function(n,i){var a,o=this;n.type="text",i=r({},{value:L(n,"value"),min:L(n,"min"),max:L(n,"max"),smallStep:L(n,"step")},i),n=e(n),i&&i.enabled===t&&(i.enabled=!n.is("[disabled]")),M.fn.init.call(o,n,i),Z((i=o.options).value)&&null!==i.value||(i.value=i.min,n.prop("value",W(i.min))),i.value=c.max(c.min(i.value,i.max),i.min),a=o.wrapper.find(E),o._selection=new X.Selection(a,o,i),o._drag=new X.Drag(a,"",o,i),o._refreshAriaAttr(i.value)},options:{name:"Slider",showButtons:!0,increaseButtonTitle:"Increase",decreaseButtonTitle:"Decrease",dragHandleTitle:"drag",tooltip:{format:"{0:#,#.##}"},value:null},enable:function(t){var i,a,o=this,l=o.options;if(o.disable(),!1!==t){if(o.wrapper.removeClass(C),o.wrapper.find("input").prop(A,!1),i=function(t){var n=F(t)[0];if(n){var i=o._isHorizontal?n.location.pageX:n.location.pageY,a=o._getDraggableArea(),l=e(t.target);l.hasClass("k-draghandle")?l.addClass("k-focus k-selected"):(o._update(o._getValueFromPosition(i,a)),o._focusWithMouse(t.target),o._drag.dragstart(t),t.preventDefault())}},o.wrapper.find(".k-tick, .k-slider-track").on(k,i).end().on(k,(function(){e(document.documentElement).one("selectstart",n.preventDefault)})).on(S,(function(){o._drag._end()})),o.wrapper.find(E).attr(R,0).on(w,(function(){o._setTooltipTimeout()})).on(D,(function(e){o._focusWithMouse(e.target),e.preventDefault()})).on(T,o._focus.bind(o)).on(y,o._blur.bind(o)),a=function(e){var t=o._nextValueByIndex(o._valueIndex+1*e);o._setValueInRange(t),o._drag._updateTooltip(t)},l.showButtons){var r=function(e,t){this._clearTooltipTimeout(),(1===e.which||p.touch&&0===e.which)&&(a(t),this.timeout=setTimeout(function(){this.timer=setInterval((function(){a(t)}),60)}.bind(this),200))}.bind(o);o.wrapper.find(".k-button").on(w,function(e){this._clearTimer(),o._focusWithMouse(e.target)}.bind(o)).on(H,(function(t){e(t.currentTarget).addClass("k-hover")})).on("mouseout"+h,function(t){e(t.currentTarget).removeClass("k-hover"),this._clearTimer()}.bind(o)).on(g,(function(t){var n=e(t.target).closest(".k-button").is(".k-button-increase")?1:-1;r(t,n)})).on("click",n.preventDefault)}o.wrapper.find(E).off(x,!1).on(x,this._keydown.bind(o)),l.enabled=!0}},disable:function(){var t=this;t.wrapper.addClass(C),e(t.element).prop(A,A),t.wrapper.find(".k-button").off(g).on(g,(function(t){t.preventDefault(),e(this).addClass("k-active")})).off(w).on(w,(function(t){t.preventDefault(),e(this).removeClass("k-active")})).off("mouseleave"+h).on("mouseleave"+h,n.preventDefault).off(H).on(H,n.preventDefault),t.wrapper.find(".k-tick, .k-slider-track").off(k).off(S),t.wrapper.find(E).attr(R,-1).off(w).off(x).off(D).off(T).off(y),t.options.enabled=!1},_update:function(e){var t=this,n=t.value()!=e;t.value(e),n&&t.trigger(m,{value:t.options.value})},value:function(e){var t=this,n=t.options;if(e=B(e),isNaN(e))return n.value;e>=n.min&&e<=n.max&&n.value!=e&&(t.element.prop("value",W(e)),n.value=e,t._refreshAriaAttr(e),t._refresh())},_refresh:function(){this.trigger(b,{value:this.options.value})},_refreshAriaAttr:function(e){var t,n=this._drag;t=n&&n._tooltipDiv?n._tooltipDiv.text():this._getFormattedValue(e,null),this.wrapper.find(E).attr(q,e).attr(V,t)},_clearTimer:function(){clearTimeout(this.timeout),clearInterval(this.timer)},_keydown:function(e){var t=this;e.keyCode in t._keyMap&&(t._clearTooltipTimeout(),t._setValueInRange(t._keyMap[e.keyCode](t.options.value)),t._drag._updateTooltip(t.value()),e.preventDefault())},_setValueInRange:function(e){var t=this,n=t.options;e=B(e),isNaN(e)?t._update(n.min):(e=c.max(c.min(e,n.max),n.min),t._update(e))},_nextValueByIndex:function(e){var t=this._values.length;return this._isRtl&&(e=t-1-e),this._values[c.max(0,c.min(e,t-1))]},_formResetHandler:function(){var e=this,t=e.options.min;setTimeout((function(){var n=e.element[0].value;e.value(""===n||isNaN(n)?t:n)}))},destroy:function(){var e=this;M.fn.destroy.call(e),e.wrapper.off(h).find(".k-button").off(h).end().find(E).off(h).end().find(".k-tick, .k-slider-track").off(h).end(),e._drag.draggable.destroy(),e._drag._removeTooltip(!0)}});X.Selection=function(e,t,n){function i(i){var a=i-n.min,o=t._valueIndex=c.ceil(B(a/n.smallStep)),l=parseInt(t._pixelSteps[o],10),r=t._trackDiv.find(".k-slider-selection"),s=t._isRtl?2:0;r[t._sizeFn](t._isRtl?t._maxSelection-l:l),e.css(t._position,l-s)}i(n.value),t.bind([_,b],(function(e){i(parseFloat(e.value,10))})),t.bind(m,(function(e){i(parseFloat(e.sender.value(),10))}))},X.Drag=function(e,t,n,i){var o=this;o.owner=n,o.options=i,o.element=e,o.type=t,o.draggable=new a(e,{distance:0,dragstart:o._dragstart.bind(o),drag:o.drag.bind(o),dragend:o.dragend.bind(o),dragcancel:o.dragcancel.bind(o)}),e.click(!1),e.on("dragstart",(function(e){e.preventDefault()}))},X.Drag.prototype={dragstart:function(e){this.owner._activeDragHandle=this,this.draggable.userEvents.cancel(),this._dragstart(e),this.dragend()},_dragstart:function(t){var n=this,i=n.owner,a=n.options;a.enabled?(this.owner._activeDragHandle=this,i.element.off(H),i.wrapper.find(".k-focus").removeClass("k-focus k-selected"),n.element.addClass("k-focus k-selected"),e(document.documentElement).css("cursor","pointer"),n.draggableArea=i._getDraggableArea(),n.step=c.max(a.smallStep*(i._maxSelection/i._distance()),0),n.type?(n.selectionStart=a.selectionStart,n.selectionEnd=a.selectionEnd,i._setZIndex(n.type)):n.oldVal=n.val=a.value,n._removeTooltip(!0),n._createTooltip()):t.preventDefault()},_createTooltip:function(){var t,i=this,a=i.owner,o=i.options.tooltip,l="",r=e(window);o.enabled&&(o.template&&(i.tooltipTemplate=n.template(o.template)),e(".k-slider-tooltip").remove(),i.tooltipDiv=e("<div role='tooltip' class='k-tooltip k-slider-tooltip'>\x3c!-- --\x3e</div>").appendTo(document.body),l=a._getFormattedValue(i.val||a.value(),i),i.type||(t="k-callout-"+(a._isHorizontal?"s":"e"),i.tooltipInnerDiv="<div class='k-callout "+t+"'>\x3c!-- --\x3e</div>",l+=i.tooltipInnerDiv),i.tooltipDiv.html(l),i._scrollOffset={top:r.scrollTop(),left:n.scrollLeft(r)},i.moveTooltip())},drag:function(e){var t,n=this,i=n.owner,a=e.x.location,o=e.y.location,l=n.draggableArea.startPoint,r=n.draggableArea.endPoint;e.preventDefault(),i._isHorizontal?i._isRtl?n.val=n.constrainValue(a,l,r,a<r):n.val=n.constrainValue(a,l,r,a>=r):n.val=n.constrainValue(o,r,l,o<=r),n.oldVal!=n.val&&(n.oldVal=n.val,n.type?("firstHandle"==n.type?n.val<n.selectionEnd?n.selectionStart=n.val:n.selectionStart=n.selectionEnd=n.val:n.val>n.selectionStart?n.selectionEnd=n.val:n.selectionStart=n.selectionEnd=n.val,t={values:[n.selectionStart,n.selectionEnd],value:[n.selectionStart,n.selectionEnd]}):t={value:n.val},i.trigger(_,t)),n._updateTooltip(n.val)},_updateTooltip:function(e){var t=this,n="";t.options.tooltip.enabled&&(t.tooltipDiv||t._createTooltip(),n=t.owner._getFormattedValue(B(e),t),t.type||(n+=t.tooltipInnerDiv),t.tooltipDiv.html(n),t.moveTooltip())},dragcancel:function(){return this.owner._refresh(),e(document.documentElement).css("cursor",""),this._end()},dragend:function(){var t=this,n=t.owner;return e(document.documentElement).css("cursor",""),t.type?n._update(t.selectionStart,t.selectionEnd):(n._update(t.val),t.draggable.userEvents._disposeAll()),t.draggable.userEvents.cancel(),t._end()},_end:function(){var e=this.owner;return e._focusWithMouse(this.element),e.element.on(H),!1},_removeTooltip:function(t){var n=this,i=n.owner;n.tooltipDiv&&i.options.tooltip.enabled&&i.options.enabled&&(t?(n.tooltipDiv.remove(),n.tooltipDiv=null):n.tooltipDiv.fadeOut("slow",(function(){e(this).remove(),n.tooltipDiv=null})))},moveTooltip:function(){var t,i,a,r,s=this,d=s.owner,u=0,c=0,p=s.element,f=n.getOffset(p),v=e(window),m=s.tooltipDiv.find(".k-callout"),_=o(s.tooltipDiv),h=l(s.tooltipDiv);s.type?(t=d.wrapper.find(E),f=n.getOffset(t.eq(0)),i=n.getOffset(t.eq(1)),d._isHorizontal?(u=i.top,c=f.left+(i.left-f.left)/2):(u=f.top+(i.top-f.top)/2,c=i.left),r=o(t.eq(0))+16):(u=f.top,c=f.left,r=o(p)+16),d._isHorizontal?(c-=parseInt((_-d._outerSize(p))/2,10),u-=h+8+(m.length?m.height():0)):(u-=parseInt((h-d._outerSize(p))/2,10),c-=_+8+(m.length?m.width():0)),d._isHorizontal?(u+=a=s._flip(u,h,r,l(v)+s._scrollOffset.top),c+=s._fit(c,_,o(v)+s._scrollOffset.left)):(a=s._flip(c,_,r,o(v)+s._scrollOffset.left),u+=s._fit(u,h,l(v)+s._scrollOffset.top),c+=a),a>0&&m&&(m.removeClass(),m.addClass("k-callout k-callout-"+(d._isHorizontal?"n":"w"))),s.tooltipDiv.css({top:u,left:c})},_fit:function(e,t,n){var i=0;return e+t>n&&(i=n-(e+t)),e<0&&(i=-e),i},_flip:function(e,t,n,i){var a=0;return e+t>i&&(a+=-(n+t)),e+a<0&&(a+=n+t),a},constrainValue:function(e,t,n,i){var a=this;return t<e&&e<n?a.owner._getValueFromPosition(e,a.draggableArea):i?a.options.max:a.options.min}},n.ui.plugin(X);var Y=M.extend({init:function(n,i){var a=this,o=e(n).find("input"),l=o.eq(0)[0],s=o.eq(1)[0];l.type="text",s.type="text",i&&i.showButtons&&(window.console&&window.console.warn("showbuttons option is not supported for the range slider, ignoring"),i.showButtons=!1),(i=r({},{selectionStart:L(l,"value"),min:L(l,"min"),max:L(l,"max"),smallStep:L(l,"step")},{selectionEnd:L(s,"value"),min:L(s,"min"),max:L(s,"max"),smallStep:L(s,"step")},i))&&i.enabled===t&&(i.enabled=!o.is("[disabled]")),M.fn.init.call(a,n,i),Z((i=a.options).selectionStart)&&null!==i.selectionStart||(i.selectionStart=i.min,o.eq(0).prop("value",W(i.min))),Z(i.selectionEnd)&&null!==i.selectionEnd||(i.selectionEnd=i.max,o.eq(1).prop("value",W(i.max)));var d=a.wrapper.find(E);this._selection=new Y.Selection(d,a,i),a._firstHandleDrag=new X.Drag(d.eq(0),"firstHandle",a,i),a._lastHandleDrag=new X.Drag(d.eq(1),"lastHandle",a,i),a._refreshAriaAttr(i.selectionStart,i.selectionEnd)},options:{name:"RangeSlider",leftDragHandleTitle:"drag",rightDragHandleTitle:"drag",tooltip:{format:"{0:#,#.##}"},selectionStart:null,selectionEnd:null},enable:function(t){var i,a=this,o=a.options;a.disable(),!1!==t&&(a.wrapper.removeClass(C),a.wrapper.find("input").prop(A,!1),i=function(t){var n=F(t)[0];if(n){var i,l,r,s=a._isHorizontal?n.location.pageX:n.location.pageY,d=a._getDraggableArea(),u=a._getValueFromPosition(s,d),c=e(t.target);if(c.hasClass("k-draghandle"))return a.wrapper.find(".k-focus").removeClass("k-focus k-selected"),void c.addClass("k-focus k-selected");u<o.selectionStart?(i=u,l=o.selectionEnd,r=a._firstHandleDrag):u>a.selectionEnd?(i=o.selectionStart,l=u,r=a._lastHandleDrag):u-o.selectionStart<=o.selectionEnd-u?(i=u,l=o.selectionEnd,r=a._firstHandleDrag):(i=o.selectionStart,l=u,r=a._lastHandleDrag),r.dragstart(t),a._setValueInRange(i,l),a._focusWithMouse(r.element)}},a.wrapper.find(".k-tick, .k-slider-track").on(k,i).end().on(k,(function(){e(document.documentElement).one("selectstart",n.preventDefault)})).on(S,(function(){a._activeDragHandle&&a._activeDragHandle._end()})),a.wrapper.find(E).attr(R,0).on(w,(function(){a._setTooltipTimeout()})).on(D,(function(e){a._focusWithMouse(e.target),e.preventDefault()})).on(T,a._focus.bind(a)).on(y,a._blur.bind(a)),a.wrapper.find(E).off(x,n.preventDefault).eq(0).on(x,function(e){this._keydown(e,"firstHandle")}.bind(a)).end().eq(1).on(x,function(e){this._keydown(e,"lastHandle")}.bind(a)),a.options.enabled=!0)},disable:function(){var e=this;e.wrapper.addClass(C),e.wrapper.find("input").prop(A,A),e.wrapper.find(".k-tick, .k-slider-track").off(k).off(S),e.wrapper.find(E).attr(R,-1).off(w).off(x).off(D).off(T).off(y),e.options.enabled=!1},_keydown:function(e,t){var n,i,a,o=this,l=o.options.selectionStart,r=o.options.selectionEnd;e.keyCode in o._keyMap&&(o._clearTooltipTimeout(),"firstHandle"==t?(a=o._activeHandleDrag=o._firstHandleDrag,(l=o._keyMap[e.keyCode](l))>r&&(r=l)):(a=o._activeHandleDrag=o._lastHandleDrag,l>(r=o._keyMap[e.keyCode](r))&&(l=r)),o._setValueInRange(B(l),B(r)),n=Math.max(l,o.options.selectionStart),i=Math.min(r,o.options.selectionEnd),a.selectionEnd=Math.max(i,o.options.selectionStart),a.selectionStart=Math.min(n,o.options.selectionEnd),a._updateTooltip(o.value()[o._activeHandle]),e.preventDefault())},_update:function(e,t){var n=this,i=n.value(),a=i[0]!=e||i[1]!=t;n.value([e,t]),a&&n.trigger(m,{values:[e,t],value:[e,t]})},value:function(e){return e&&e.length?this._value(e[0],e[1]):this._value()},_value:function(e,t){var n=this,i=n.options,a=i.selectionStart,o=i.selectionEnd;if(isNaN(e)&&isNaN(t))return[a,o];e=B(e),t=B(t),e>=i.min&&e<=i.max&&t>=i.min&&t<=i.max&&e<=t&&(a==e&&o==t||(n.element.find("input").eq(0).prop("value",W(e)).end().eq(1).prop("value",W(t)),i.selectionStart=e,i.selectionEnd=t,n._refresh(),n._refreshAriaAttr(e,t)))},values:function(e,t){return u(e)?this._value(e[0],e[1]):this._value(e,t)},_refresh:function(){var e=this,t=e.options;e.trigger(b,{values:[t.selectionStart,t.selectionEnd],value:[t.selectionStart,t.selectionEnd]}),t.selectionStart==t.max&&t.selectionEnd==t.max&&e._setZIndex("firstHandle")},_refreshAriaAttr:function(e,t){var n,i=this,a=i.wrapper.find(E),o=i._activeHandleDrag;n=i._getFormattedValue([e,t],o),a.eq(0).attr(q,e),a.eq(1).attr(q,t),a.attr(V,n)},_setValueInRange:function(e,t){var n=this.options;e=c.max(c.min(e,n.max),n.min),t=c.max(c.min(t,n.max),n.min),e==n.max&&t==n.max&&this._setZIndex("firstHandle"),this._update(c.min(e,t),c.max(e,t))},_setZIndex:function(t){this.wrapper.find(E).each((function(n){e(this).css("z-index","firstHandle"==t?1-n:n)}))},_formResetHandler:function(){var e=this,t=e.options;setTimeout((function(){var n=e.element.find("input"),i=n[0].value,a=n[1].value;e.values(""===i||isNaN(i)?t.min:i,""===a||isNaN(a)?t.max:a)}))},destroy:function(){var e=this;M.fn.destroy.call(e),e.wrapper.off(h).find(".k-tick, .k-slider-track").off(h).end().find(E).off(h),e._firstHandleDrag.draggable.destroy(),e._lastHandleDrag.draggable.destroy()}});Y.Selection=function(e,t,n){function i(i){var a=(i=i||[])[0]-n.min,o=i[1]-n.min,l=c.ceil(B(a/n.smallStep)),r=c.ceil(B(o/n.smallStep)),s=t._pixelSteps[l],d=t._pixelSteps[r],u=t._isRtl?2:0;e.eq(0).css(t._position,s-u).end().eq(1).css(t._position,d-u),function(e,n){var i,a,o=t._trackDiv.find(".k-slider-selection");i=c.abs(e-n),o[t._sizeFn](i),t._isRtl?(a=c.max(e,n),o.css("right",t._maxSelection-a-1)):(a=c.min(e,n),o.css(t._position,a-1))}(s,d)}i(t.value()),t.bind([m,_,b],(function(e){i(e.values)}))},n.ui.plugin(Y)}(window.kendo.jQuery)})); //# sourceMappingURL=kendo.slider.min.js.map