16 lines
22 KiB
JavaScript
16 lines
22 KiB
JavaScript
|
/**
|
||
|
* Copyright 2014 Telerik AD
|
||
|
*
|
||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
* you may not use this file except in compliance with the License.
|
||
|
* You may obtain a copy of the License at
|
||
|
*
|
||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
*
|
||
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
* See the License for the specific language governing permissions and
|
||
|
* limitations under the License.
|
||
|
*/
|
||
|
!function(e,define){define(["./kendo.draganddrop.min"],e)}(function(){return function(e,t){function n(e,t,n){var i=n?" k-slider-horizontal":" k-slider-vertical",r=e.style?e.style:t.attr("style"),a=t.attr("class")?" "+t.attr("class"):"",o="";return"bottomRight"==e.tickPlacement?o=" k-slider-bottomright":"topLeft"==e.tickPlacement&&(o=" k-slider-topleft"),r=r?" style='"+r+"'":"","<div class='k-widget k-slider"+i+a+"'"+r+"><div class='k-slider-wrap"+(e.showButtons?" k-slider-buttons":"")+o+"'></div></div>"}function i(e,t,n){var i="";return i="increase"==t?n?"k-i-arrow-e":"k-i-arrow-n":n?"k-i-arrow-w":"k-i-arrow-s","<a class='k-button k-button-"+t+"'><span class='k-icon "+i+"' title='"+e[t+"ButtonTitle"]+"'>"+e[t+"ButtonTitle"]+"</span></a>"}function r(e,t){var n,i="<ul class='k-reset k-slider-items'>",r=b.floor(u(t/e.smallStep))+1;for(n=0;r>n;n++)i+="<li class='k-tick' role='presentation'> </li>";return i+="</ul>"}function a(e,t){var n=t.is("input")?1:2,i=2==n?e.leftDragHandleTitle:e.dragHandleTitle;return"<div class='k-slider-track'><div class='k-slider-selection'><!-- --></div><a href='#' class='k-draghandle' title='"+i+"' role='slider' aria-valuemin='"+e.min+"' aria-valuemax='"+e.max+"' aria-valuenow='"+(n>1?e.selectionStart||e.min:e.value||e.min)+"'>Drag</a>"+(n>1?"<a href='#' class='k-draghandle' title='"+e.rightDragHandleTitle+"'role='slider' aria-valuemin='"+e.min+"' aria-valuemax='"+e.max+"' aria-valuenow='"+(e.selectionEnd||e.max)+"'>Drag</a>":"")+"</div>"}function o(e){return function(t){return t+e}}function s(e){return function(){return e}}function l(e){return(e+"").replace(".",p.cultures.current.numberFormat["."])}function u(e){e=parseFloat(e,10);var t=b.pow(10,U||0);return b.round(e*t)/t}function c(e,n){var i=_(e.getAttribute(n));return null===i&&(i=t),i}function d(e){return typeof e!==$}var f,p=window.kendo,h=p.ui.Widget,g=p.ui.Draggable,m=e.extend,v=p.format,_=p.parseFloat,y=e.proxy,w=e.isArray,b=Math,x=p.support,k=x.pointers,C=x.msPointers,T="change",S="slide",D=".slider",F="touchstart"+D+" mousedown"+D,E=k?"pointerdown"+D:C?"MSPointerDown"+D:F,M="touchend"+D+" mouseup"+D,z=k?"pointerup":C?"MSPointerUp"+D:M,A="moveSelection",O="keydown"+D,H="click"+D,I="mouseover"+D,P="focus"+D,N="blur"+D,L=".k-draghandle",R=".k-slider-track",B=".k-tick",W="k-state-selected",q="k-state-focused",V="k-state-default",j="k-state-disabled",U=3,Y="disabled",$="undefined",G="tabindex",Q=p.getTouches,K=h.extend({init:function(e,t){var n,i=this;h.fn.init.call(i,e,t),t=i.options,i._distance=t.max-t.min,i._isHorizontal="horizontal"==t.orientation,i._isRtl=i._isHorizontal&&p.support.isRtl(e),i._position=i._isHorizontal?"left":"bottom",i._sizeFn=i._isHorizontal?"width":"height",i._outerSize=i._isHorizontal?"outerWidth":"outerHeight",t.tooltip.format=t.tooltip.enabled?t.tooltip.format||"{0}":"{0}",i._createHtml(),i.wrapper=i.element.closest(".k-slider"),i._trackDiv=i.wrapper.find(R),i._setTrackDivWidth(),i._maxSelection=i._trackDiv[i._sizeFn](),i._sliderItemsInit(),i._tabindex(i.wrapper.find(L)),i[t.enabled?"enable":"disable"](),n=p.support.isRtl(i.wrapper)?-1:1,i._keyMap={37:o(-1*n*t.smallStep),40:o(-t.smallStep),39:o(1*n*t.smallStep),38:o(+t.smallStep),35:s(t.max),36:s(t.min),33:o(+t.largeStep),34:o(-t.largeStep)},p.notify(i)},events:[T,S],options:{enabled:!0,min:0,max:10,smallStep:1,largeStep:5,orientation:"horizontal",tickPlacement:"both",tooltip:{enabled:!0,format:"{0}"}},_resize:function(){this._setTrackDivWidth(),this.wrapper.find(".k-slider-items").remove(),this._maxSelection=this._trackDiv[this._sizeFn](),this._sliderItemsInit(),this._refresh()},_sliderItemsInit:function(){var e=this,t=e.options,n=e._maxSelection/((t.max-t.min)/t.smallStep),i=e._calculateItemsWidth(b.floor(e._distance/t.smallStep));"none"!=t.tickPlacement&&n>=2&&(e._trackDiv.before(r(t,e._distance)),e._setItemsWidth(i),e._setItemsTitle()),e._calculateSteps(i),"none"!=t.tickPlacement&&n>=2&&t.largeStep>=t.smallStep&&e._setItemsLargeTick()},getSize:function(){return p.dimensions(this.wrapper)},_setTrackDivWidth:function(){var e=this,t=2*parseFloat(e._trackDiv
|