11 lines
9.9 KiB
JavaScript
11 lines
9.9 KiB
JavaScript
/*
|
|
* Kendo UI Complete v2013.3.1324 (http://kendoui.com)
|
|
* Copyright 2014 Telerik AD. All rights reserved.
|
|
*
|
|
* Kendo UI Complete commercial licenses may be obtained at
|
|
* http://www.telerik.com/purchase/license-agreement/kendo-ui-complete
|
|
* If you do not own a commercial license, this file shall be governed by the trial license terms.
|
|
*/
|
|
!function(define){return define(["./kendo.popup.min"],function(){!function(e,t){function n(e,t,n){var i,o=e.getTimezoneOffset();e.setTime(e.getTime()+t),n||(i=e.getTimezoneOffset()-o,e.setTime(e.getTime()+i*M))}function i(){var e=new Q,t=new Q(e.getFullYear(),e.getMonth(),e.getDate(),0,0,0),n=new Q(e.getFullYear(),e.getMonth(),e.getDate(),12,0,0);return-1*(t.getTimezoneOffset()-n.getTimezoneOffset())}function o(e){return 60*e.getHours()*M+e.getMinutes()*M+1e3*e.getSeconds()+e.getMilliseconds()}function r(e,t,n){var i,r=o(t),a=o(n);return e&&r!=a?(i=o(e),r>i&&(i+=A),r>a&&(a+=A),i>=r&&a>=i):!0}function a(e){var t=e.parseFormats;e.format=f(e.format||c.getCulture(e.culture).calendars.standard.patterns.t),t=Y(t)?t:[t],t.splice(0,0,e.format),e.parseFormats=t}function s(e){e.preventDefault()}var l,u,c=window.kendo,p=c.keys,d=c._activeElement,f=c._extractFormat,h=c.support,m=h.browser,v=c.ui,_=v.Widget,g="open",w="close",k="change",y=".kendoTimePicker",b="click"+y,x="k-state-default",T="disabled",C="readonly",D="li",V="<span/>",S="k-state-focused",F="k-state-hover",W="mouseenter"+y+" mouseleave"+y,H="mousedown"+y,M=6e4,A=864e5,O="k-state-selected",I="k-state-disabled",B="aria-selected",E="aria-expanded",N="aria-hidden",R="aria-disabled",z="aria-readonly",L="aria-activedescendant",P="id",Y=e.isArray,j=e.extend,K=e.proxy,Q=Date,U=new Q;U=new Q(U.getFullYear(),U.getMonth(),U.getDate(),0,0,0),l=function(t){var n=this,i=t.id;n.options=t,n.ul=e('<ul tabindex="-1" role="listbox" aria-hidden="true" unselectable="on" class="k-list k-reset"/>').css({overflow:h.kineticScrollNeeded?"":"auto"}).on(b,D,K(n._click,n)).on("mouseenter"+y,D,function(){e(this).addClass(F)}).on("mouseleave"+y,D,function(){e(this).removeClass(F)}),n.list=e("<div class='k-list-container'/>").append(n.ul).on(H,s),i&&(n._timeViewID=i+"_timeview",n._optionID=i+"_option_selected",n.ul.attr(P,n._timeViewID)),n._popup(),n.template=c.template('<li tabindex="-1" role="option" class="k-item" unselectable="on">#=data#</li>',{useWithBlock:!1})},l.prototype={current:function(n){var i=this,o=i.options.active;return n===t?i._current:(i._current&&i._current.removeClass(O).removeAttr(B).removeAttr(P),n&&(n=e(n).addClass(O).attr(P,i._optionID).attr(B,!0),i.scroll(n[0])),i._current=n,o&&o(n),t)},close:function(){this.popup.close()},destroy:function(){var e=this;e.ul.off(y),e.list.off(y),e._touchScroller&&e._touchScroller.destroy(),e.popup.destroy()},open:function(){var e=this;e.ul[0].firstChild||e.bind(),e.popup.open(),e._current&&e.scroll(e._current[0])},dataBind:function(e){for(var t,n=this,i=n.options,o=i.format,a=c.toString,s=n.template,l=e.length,u=0,p="";l>u;u++)t=e[u],r(t,i.min,i.max)&&(p+=s(a(t,o,i.culture)));n._html(p,l)},refresh:function(){var e,t,r,a=this,s=a.options,l=s.format,u=i(),p=0>u,d=s.min,f=s.max,h=o(d),m=o(f),v=s.interval*M,_=c.toString,g=a.template,w=new Q(+d),k=w.getDate(),y=0,b="";for(r=p?(A+u*M)/v:A/v,h!=m&&(h>m&&(m+=A),r=(m-h)/v+1),t=parseInt(r,10);r>y;y++)y&&n(w,v,p),m&&t==y&&(e=o(w),k<w.getDate()&&(e+=A),e>m&&(w=new Q(+f))),b+=g(_(w,l,s.culture));a._html(b,r)},bind:function(){var e=this,t=e.options.dates;t&&t[0]?e.dataBind(t):e.refresh()},_html:function(e,t){var n=this;n.ul[0].innerHTML=e,n._height(t),n.current(null),n.select(n._value)},scroll:function(e){if(e){var t,n=this.ul[0],i=e.offsetTop,o=e.offsetHeight,r=n.scrollTop,a=n.clientHeight,s=i+o,l=this._touchScroller;l?(t=this.list.height(),i>t&&(i=i-t+o),l.scrollTo(0,-i)):n.scrollTop=r>i?i:s>r+a?s-a:r}},select:function(t){var n=this,i=n.options,o=n._current;t instanceof Date&&(t=c.toString(t,i.format,i.culture)),"string"==typeof t&&(o&&o.text()===t?t=o:(t=e.grep(n.ul[0].childNodes,function(e){return(e.textContent||e.innerText)==t}),t=t[0]?t:null)),n.current(t)},setOptions:function(e){var t=this.options;this.options=j(t,e,{active:t.active,change:t.change,close:t.close,open:t.open}),this.bind()},toggle:function(){var e=this;e.popup.visible()?e.close():e.open()},value:function(e){var t=this;t._value=e,t.ul[0].firstChild&&t.select(e)},_click:function(t){var n=this,i=e(t.currentTarget);t.isDefaultPrevented()||(n.select(i),n.options.change(i.text(),!0),n.close())},_height:function(e){if(e){var t=this,n=t.list,i=n.parent(".k-animation-container"),o=t.options.height;n.add(i).show().height(t.ul[0].scrollHeight>o?o:"auto").hide()}},_parse:function(e){var t=this,n=t.options,i=t._value||U;return e instanceof Q?e:(e=c.parseDate(e,n.parseFormats,n.culture),e&&(e=new Q(i.getFullYear(),i.getMonth(),i.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())),e)},_adjustListWidth:function(){var e,t,n=this.list,i=n[0].style.width,o=this.options.anchor;(n.data("width")||!i)&&(e=window.getComputedStyle?window.getComputedStyle(o[0],null):0,t=e?parseFloat(e.width):o.outerWidth(),e&&(m.mozilla||m.msie)&&(t+=parseFloat(e.paddingLeft)+parseFloat(e.paddingRight)+parseFloat(e.borderLeftWidth)+parseFloat(e.borderRightWidth)),i=t-(n.outerWidth()-n.width()),n.css({fontFamily:o.css("font-family"),width:i}).data("width",i))},_popup:function(){var e=this,t=e.list,n=e.options,i=n.anchor;e.popup=new v.Popup(t,j(n.popup,{anchor:i,open:n.open,close:n.close,animation:n.animation,isRtl:h.isRtl(n.anchor)})),e._touchScroller=c.touchScroller(e.popup.element)},move:function(e){var n=this,i=e.keyCode,o=n.ul[0],r=n._current,a=i===p.DOWN;if(i===p.UP||a){if(e.altKey)return n.toggle(a),t;r=a?r?r[0].nextSibling:o.firstChild:r?r[0].previousSibling:o.lastChild,r&&n.select(r),n.options.change(n._current.text()),e.preventDefault()}else(i===p.ENTER||i===p.TAB||i===p.ESC)&&(e.preventDefault(),r&&n.options.change(r.text(),!0),n.close())}},l.getMilliseconds=o,c.TimeView=l,u=_.extend({init:function(e,t){var n,i,o,r=this;_.fn.init.call(r,e,t),e=r.element,t=r.options,a(t),r._wrapper(),r.timeView=i=new l(j({},t,{id:e.attr(P),anchor:r.wrapper,format:t.format,change:function(t,n){n?r._change(t):e.val(t)},open:function(t){r.timeView._adjustListWidth(),r.trigger(g)?t.preventDefault():(e.attr(E,!0),n.attr(N,!1))},close:function(t){r.trigger(w)?t.preventDefault():(e.attr(E,!1),n.attr(N,!0))},active:function(t){e.removeAttr(L),t&&e.attr(L,i._optionID)}})),n=i.ul,r._icon(),r._reset();try{e[0].setAttribute("type","text")}catch(s){e[0].type="text"}e.addClass("k-input").attr({role:"combobox","aria-expanded":!1,"aria-owns":i._timeViewID}),o=e.is("[disabled]"),o?r.enable(!1):r.readonly(e.is("[readonly]")),r._old=r._update(t.value||r.element.val()),r._oldText=e.val(),c.notify(r)},options:{name:"TimePicker",min:U,max:U,format:"",dates:[],parseFormats:[],value:null,interval:30,height:200,animation:{}},events:[g,w,k],setOptions:function(e){var t=this,n=t._value;_.fn.setOptions.call(t,e),e=t.options,a(e),t.timeView.setOptions(e),n&&t.element.val(c.toString(n,e.format,e.culture))},dataBind:function(e){Y(e)&&this.timeView.dataBind(e)},_editable:function(e){var t=this,n=e.disable,i=e.readonly,o=t._arrow.off(y),r=t.element.off(y),a=t._inputWrapper.off(y);i||n?(a.addClass(n?I:x).removeClass(n?x:I),r.attr(T,n).attr(C,i).attr(R,n).attr(z,i)):(a.addClass(x).removeClass(I).on(W,t._toggleHover),r.removeAttr(T).removeAttr(C).attr(R,!1).attr(z,!1).on("keydown"+y,K(t._keydown,t)).on("blur"+y,K(t._blur,t)).on("focus"+y,function(){t._inputWrapper.addClass(S)}),o.on(b,K(t._click,t)).on(H,s))},readonly:function(e){this._editable({readonly:e===t?!0:e,disable:!1})},enable:function(e){this._editable({readonly:!1,disable:!(e=e===t?!0:e)})},destroy:function(){var e=this;_.fn.destroy.call(e),e.timeView.destroy(),e.element.off(y),e._arrow.off(y),e._inputWrapper.off(y),e._form&&e._form.off("reset",e._resetHandler)},close:function(){this.timeView.close()},open:function(){this.timeView.open()},min:function(e){return this._option("min",e)},max:function(e){return this._option("max",e)},value:function(e){var n=this;return e===t?n._value:(n._old=n._update(e),null===n._old&&n.element.val(""),n._oldText=n.element.val(),t)},_blur:function(){var e=this,t=e.element.val();e.close(),t!==e._oldText&&e._change(t),e._inputWrapper.removeClass(S)},_click:function(){var e=this,t=e.element;e.timeView.toggle(),h.touch||t[0]===d()||t.focus()},_change:function(e){var t=this;e=t._update(e),+t._old!=+e&&(t._old=e,t._oldText=t.element.val(),t.trigger(k),t.element.trigger(k))},_icon:function(){var t,n=this,i=n.element;t=i.next("span.k-select"),t[0]||(t=e('<span unselectable="on" class="k-select"><span unselectable="on" class="k-icon k-i-clock">select</span></span>').insertAfter(i)),n._arrow=t.attr({role:"button","aria-controls":n.timeView._timeViewID})},_keydown:function(e){var t=this,n=e.keyCode,i=t.timeView,o=t.element.val();i.popup.visible()||e.altKey?i.move(e):n===p.ENTER&&o!==t._oldText&&t._change(o)},_option:function(e,n){var i=this,o=i.options;return n===t?o[e]:(n=i.timeView._parse(n),n&&(n=new Q(+n),o[e]=n,i.timeView.options[e]=n,i.timeView.bind()),t)},_toggleHover:function(t){e(t.currentTarget).toggleClass(F,"mouseenter"===t.type)},_update:function(e){var t=this,n=t.options,i=t.timeView,o=i._parse(e);return r(o,n.min,n.max)||(o=null),t._value=o,t.element.val(o?c.toString(o,n.format,n.culture):e),i.value(o),o},_wrapper:function(){var t,n=this,i=n.element;t=i.parents(".k-timepicker"),t[0]||(t=i.wrap(V).parent().addClass("k-picker-wrap k-state-default"),t=t.wrap(V).parent()),t[0].style.cssText=i[0].style.cssText,n.wrapper=t.addClass("k-widget k-timepicker k-header").addClass(i[0].className),i.css({width:"100%",height:i[0].style.height}),n._inputWrapper=e(t[0].firstChild)},_reset:function(){var t=this,n=t.element,i=n.attr("form"),o=i?e("#"+i):n.closest("form");o[0]&&(t._resetHandler=function(){t.value(n[0].defaultValue)},t._form=o.on("reset",t._resetHandler))}}),v.plugin(u)}(window.kendo.jQuery)})}("function"==typeof define&&define.amd?define:function(e,t){return t()});/*
|
|
//@ sourceMappingURL=kendo.timepicker.min.js.map
|
|
*/ |