@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.8 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("kendo.draganddrop.js"),require("kendo.icons.js")):"function"==typeof define&&define.amd?define(["exports","kendo.draganddrop","kendo.icons"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).kendo=e.kendo||{},e.kendo._globals=e.kendo._globals||{},e.kendo._globals.Slider={}))}(this,(function(e){!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,p=Math,c=n.support,f=c.pointers,v=c.msPointers,_="change",m="slide",h=".slider",g="touchstart"+h+" mousedown"+h,w=f?"pointerdown"+h:v?"MSPointerDown"+h:g,b="touchend"+h+" mouseup"+h,k=f?"pointerup":v?"MSPointerUp"+h:b,S="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-selected",A="k-focus",q="k-disabled",F="disabled",V="tabindex",M=n.getTouches,R="aria-valuetext",P="aria-valuenow",O=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._isRtl?"right":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:W(-1*r*t.smallStep),40:W(-t.smallStep),39:W(1*r*t.smallStep),38:W(+t.smallStep),35:B(t.max),36:B(t.min),33:W(+t.largeStep),34:W(-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 L(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(p.floor(X(t._distance())/X(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=p.floor(L(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,L(i))),i+=t.smallStep},_setItemsLargeTick:function(){var t,n=this,i=n.options,a=n.wrapper.find(z),o=0;if(X(i.largeStep)%X(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=L(X(n._values[o]-this.options.min));l%X(i.smallStep)==0&&l%X(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=X(r)/X(o.smallStep),d=l/X(r);for(s-e>0&&(l-=X(r)%X(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]-p.floor(e[t]),e[t]=p.floor(e[t]);return n=p.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(p.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=p.ceil(X(l)/X(i.smallStep)),s=1;if(r+=X(l)/X(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]=L(a),s++;t=X(l)%X(i.smallStep)==0?r-1:r,n._pixelSteps[t]=n._maxSelection,n._values[t]=i.max}},_getValueFromPosition:function(e,t){var n,i=this,a=i.options,o=p.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(p.abs(i._pixelSteps[n]-l)-1<=r)return L(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",j(i.selectionStart)),a.eq(1).prop("value",j(i.selectionEnd))):n.prop("value",j(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-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(N(i,"increase",e._isHorizontal,e._isRtl)).before(N(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,p=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!==p&&p!==t||(p=l)));var c="<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='"+(p||e.max)+"'></span>":"")+"</div>";return c}(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(A+" "+C),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(A+" "+C),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 N(e,t,i,a){var o="";return o=i?"increase"===t?a?"caret-alt-left":"caret-alt-right":a?"caret-alt-right":"caret-alt-left":"increase"==t?"caret-alt-up":"caret-alt-down","<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-hidden="true" tabindex="-1">'+n.ui.icon({icon:o,iconClass:"k-button-icon"})+"</button>"}function W(e){return function(t){return t+e}}function B(e){return function(){return e}}function j(e){return(e+"").replace(".",n.cultures.current.numberFormat["."])}function L(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=p.pow(10,t||0),p.round(e*n)/n}function Z(e,n){var i=d(e.getAttribute(n));return null===i&&(i=t),i}function U(e){return void 0!==e}function X(e){return 1e4*e}var Y=O.extend({init:function(n,i){var a,o=this;n.type="text",i=r({},{value:Z(n,"value"),min:Z(n,"min"),max:Z(n,"max"),smallStep:Z(n,"step")},i),n=e(n),i&&i.enabled===t&&(i.enabled=!n.is("[disabled]")),O.fn.init.call(o,n,i),U((i=o.options).value)&&null!==i.value||(i.value=i.min,n.prop("value",j(i.min))),i.value=p.max(p.min(i.value,i.max),i.min),a=o.wrapper.find(E),o._selection=new Y.Selection(a,o,i),o._drag=new Y.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;o.disable(),!1!==t&&(o.wrapper.removeClass(q),o.wrapper.find("input").prop(F,!1),i=function(t){var n=M(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(A+" "+C):(o._update(o._getValueFromPosition(i,a)),o._focusWithMouse(t.target),o._drag.dragstart(t),t.preventDefault())}},o.wrapper.find(z+", "+I).on(w,i).end().on(k,(function(){o._drag._end()})),o.wrapper.find(E).attr(V,0).on(b,(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&&o.wrapper.find(".k-button").on(b,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;o._mouseDownHandler(t,n,a)})).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(q),e(t.element).prop(F,F),t.wrapper.find(".k-button").off(g).on(g,(function(t){t.preventDefault(),e(this).addClass("k-active")})).off(b).on(b,(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(z+", "+I).off(w).off(k),t.wrapper.find(E).attr(V,-1).off(b).off(x).off(D).off(T).off(y),t.options.enabled=!1},_mouseDownHandler:function(e,t,n){let i=this;i._clearTooltipTimeout(),(1===e.which||c.touch&&0===e.which)&&(n(t),i.timeout=setTimeout((function(){i.timer=setInterval((function(){n(t)}),60)}),200))},_update:function(e){var t=this,n=t.value()!=e;t.value(e),n&&t.trigger(_,{value:t.options.value})},value:function(e){var t=this,n=t.options;if(e=L(e),isNaN(e))return n.value;e>=n.min&&e<=n.max&&n.value!=e&&(t.element.prop("value",j(e)),n.value=e,t._refreshAriaAttr(e),t._refresh())},_refresh:function(){this.trigger(S,{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(P,e).attr(R,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=L(e),isNaN(e)?t._update(n.min):(e=p.max(p.min(e,n.max),n.min),t._update(e))},_nextValueByIndex:function(e){var t=this._values.length;return this._values[p.max(0,p.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;O.fn.destroy.call(e),e.wrapper.off(h).find(".k-button").off(h).end().find(E).off(h).end().find(z+", "+I).off(h).end(),e._drag.draggable.destroy(),e._drag._removeTooltip(!0)}});Y.Selection=function(e,t,n){function i(i){var a=i-n.min,o=t._valueIndex=p.ceil(L(a/n.smallStep)),l=parseInt(t._pixelSteps[o],10);t._trackDiv.find(".k-slider-selection")[t._sizeFn](l),e.css(t._position,l)}i(n.value),t.bind([m,S],(function(e){i(parseFloat(e.value,10))})),t.bind(_,(function(e){i(parseFloat(e.sender.value(),10))}))},Y.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()}))},Y.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("."+A).removeClass(A+" "+C),n.element.addClass(A+" "+C),e(document.documentElement).css("cursor","pointer"),n.draggableArea=i._getDraggableArea(),n.step=p.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(m,t)),n._updateTooltip(n.val)},_updateTooltip:function(e){var t=this,n="";t.options.tooltip.enabled&&(t.tooltipDiv||t._createTooltip(),n=t.owner._getFormattedValue(L(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,p=0,c=s.element,f=n.getOffset(c),v=e(window),_=s.tooltipDiv.find(".k-callout"),m=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,p=f.left+(i.left-f.left)/2):(u=f.top+(i.top-f.top)/2,p=i.left),r=o(t.eq(0))+16):(u=f.top,p=f.left,r=o(c)+16),d._isHorizontal?(p-=parseInt((m-d._outerSize(c))/2,10),u-=h+8+(_.length?_.height():0)):(u-=parseInt((h-d._outerSize(c))/2,10),p-=m+8+(_.length?_.width():0)),d._isHorizontal?(u+=a=s._flip(u,h,r,l(v)+s._scrollOffset.top),p+=s._fit(p,m,o(v)+s._scrollOffset.left)):(a=s._flip(p,m,r,o(v)+s._scrollOffset.left),u+=s._fit(u,h,l(v)+s._scrollOffset.top),p+=a),a>0&&_&&(_.removeClass(),_.addClass("k-callout k-callout-"+(d._isHorizontal?"n":"w"))),s.tooltipDiv.css({top:u,left:p})},_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(Y);var K=O.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:Z(l,"value"),min:Z(l,"min"),max:Z(l,"max"),smallStep:Z(l,"step")},{selectionEnd:Z(s,"value"),min:Z(s,"min"),max:Z(s,"max"),smallStep:Z(s,"step")},i))&&i.enabled===t&&(i.enabled=!o.is("[disabled]")),O.fn.init.call(a,n,i),U((i=a.options).selectionStart)&&null!==i.selectionStart||(i.selectionStart=i.min,o.eq(0).prop("value",j(i.min))),U(i.selectionEnd)&&null!==i.selectionEnd||(i.selectionEnd=i.max,o.eq(1).prop("value",j(i.max)));var d=a.wrapper.find(E);this._selection=new K.Selection(d,a,i),a._firstHandleDrag=new Y.Drag(d.eq(0),"firstHandle",a,i),a._lastHandleDrag=new Y.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(q),a.wrapper.find("input").prop(F,!1),i=function(t){var n=M(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),p=e(t.target);if(p.hasClass("k-draghandle"))return a.wrapper.find("."+A).removeClass(A+" "+C),void p.addClass(A+" "+C);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(z+", "+I).on(w,i).end().on(k,(function(){a._activeDragHandle&&a._activeDragHandle._end()})),a.wrapper.find(E).attr(V,0).on(b,(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(q),e.wrapper.find("input").prop(F,F),e.wrapper.find(z+", "+I).off(w).off(k),e.wrapper.find(E).attr(V,-1).off(b).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(L(l),L(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(_,{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=L(e),t=L(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",j(e)).end().eq(1).prop("value",j(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(S,{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(P,e),a.eq(1).attr(P,t),a.attr(R,n)},_setValueInRange:function(e,t){var n=this.options;e=p.max(p.min(e,n.max),n.min),t=p.max(p.min(t,n.max),n.min),e==n.max&&t==n.max&&this._setZIndex("firstHandle"),this._update(p.min(e,t),p.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;O.fn.destroy.call(e),e.wrapper.off(h).find(z+", "+I).off(h).end().find(E).off(h),e._firstHandleDrag.draggable.destroy(),e._lastHandleDrag.draggable.destroy()}});K.Selection=function(e,t,n){function i(i){var a=(i=i||[])[0]-n.min,o=i[1]-n.min,l=p.ceil(L(a/n.smallStep)),r=p.ceil(L(o/n.smallStep)),s=t._pixelSteps[l],d=t._pixelSteps[r];e.eq(0).css(t._position,s).end().eq(1).css(t._position,d),function(e,n){var i,a,o=t._trackDiv.find(".k-slider-selection");i=p.abs(e-n),o[t._sizeFn](i),a=p.min(e,n),o.css(t._position,a-1)}(s,d)}i(t.value()),t.bind([_,m,S],(function(e){i(e.values)}))},n.ui.plugin(K)}(window.kendo.jQuery);var t=kendo;e.__meta__={id:"slider",name:"Slider",category:"web",description:"The Slider widget provides a rich input for selecting values or ranges of values.",depends:["draganddrop","icons"]},e.default=t,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=kendo.slider.min.js.map