vendor/assets/javascripts/kendo/kendo.datetimepicker.min.js in kendoui-rails-0.0.9 vs vendor/assets/javascripts/kendo/kendo.datetimepicker.min.js in kendoui-rails-0.1.0

- old
+ new

@@ -1,11 +1,11 @@ /* -* Kendo UI Web v2012.3.1114 (http://kendoui.com) -* Copyright 2012 Telerik AD. All rights reserved. +* Kendo UI Web v2013.1.319 (http://kendoui.com) +* Copyright 2013 Telerik AD. All rights reserved. * * Kendo UI Web commercial licenses may be obtained at * https://www.kendoui.com/purchase/license-agreement/kendo-ui-web-commercial.aspx * If you do not own a commercial license, this file shall be governed by the * GNU General Public License (GPL) version 3. * For GPL requirements, please review: http://www.gnu.org/copyleft/gpl.html */ -(function(e,t){function a(e){e.preventDefault()}function n(e){var t=i.getCulture(e.culture).calendars.standard.patterns;e.format=s(e.format||t.g),e.timeFormat=s(e.timeFormat||t.t),i.DateView.normalize(e),e.parseFormats.splice(1,0,e.timeFormat)}var i=window.kendo,o=i.TimeView,r=i.parseDate,s=i._extractFormat,l=i.calendar,c=l.isInRange,u=l.restrictValue,m=l.isEqualDatePart,d=o.getMilliseconds,p=i.ui,f=p.Widget,v="open",_="close",g="change",h=".kendoDateTimePicker",w="touchend"+h+" click"+h,k="disabled",V="k-state-default",x="k-state-focused",y="k-state-hover",D="k-state-disabled",b="mouseenter"+h+" mouseleave"+h,I="touchstart"+h+" mousedown"+h,A="month",C="<span/>",F="aria-activedescendant",T="aria-expanded",R="aria-hidden",W="aria-owns",H=Date,E=new H(1900,0,1),S=new H(2099,11,31),M={view:"date"},q={view:"time"},B=e.extend,N=f.extend({init:function(t,a){var o=this;f.fn.init.call(o,t,a),t=o.element,a=o.options,n(a),o._wrapper(),o._views(),o._icons(),o._reset(),o._template(),t[0].type="text",t.addClass("k-input").on("keydown"+h,e.proxy(o._keydown,o)).on("focus"+h,function(){o._inputWrapper.addClass(x)}).on("blur"+h,function(){o._inputWrapper.removeClass(x),o._change(t.val()),o.close("date"),o.close("time")}).attr({role:"textbox","aria-haspopup":!0,"aria-expanded":!1}),o._midnight=0===d(a.min)+d(a.max),o.enable(!t.is("[disabled]")),o.value(a.value||t.val()),i.notify(o)},options:{name:"DateTimePicker",value:null,format:"",timeFormat:"",culture:"",parseFormats:[],dates:[],min:new H(E),max:new H(S),interval:30,height:200,footer:"",start:A,depth:A,animation:{},month:{},ARIATemplate:'Current focused date is #=kendo.toString(data.current, "G")#'},events:[v,_,g],setOptions:function(e){var t=this,a=t.dateView.options,i=t.timeView.options;f.fn.setOptions.call(t,e),n(t.options),e=t.options,B(a,e,{change:a.change,close:a.close,open:a.open}),B(i,e,{format:e.timeFormat,active:i.active,change:i.change,close:i.close,open:i.open}),t.timeView.ul[0].innerHTML=""},enable:function(e){var t=this,n=t.element,i=t._dateIcon.off(h),o=t._timeIcon.off(h),r=t._inputWrapper.off(b);e===!1?(r.removeClass(V).addClass(D),n.attr(k,k)):(r.addClass(V).removeClass(D).on(b,t._toggleHover),n.removeAttr(k),i.on(I,a).on(w,function(e){t.toggle("date"),"click"===e.type&&n[0]!==document.activeElement&&n.focus()}),o.on(I,a).on(w,function(e){t.toggle("time"),"click"===e.type&&n[0]!==document.activeElement&&n.focus()}))},destroy:function(){var e=this;f.fn.destroy.call(e),e.dateView.destroy(),e.timeView.destroy(),e.element.off(h),e._dateIcon.off(h),e._timeIcon.off(h),e._inputWrapper.off(h),e._form&&e._form.off("reset",e._resetHandler)},close:function(e){"time"!==e&&(e="date"),this[e+"View"].close()},open:function(e){"time"!==e&&(e="date"),this[e+"View"].open()},min:function(e){return this._option("min",e)},max:function(e){return this._option("max",e)},toggle:function(e){var t="timeView";"time"!==e?e="date":t="dateView",this[e+"View"].toggle(),this[t].close()},value:function(e){var a=this;return e===t?a._value:(a._old=a._update(e),t)},_change:function(e){var t=this;e=t._update(e),+t._old!=+e&&(t._old=e,t.trigger(g),t.element.trigger(g))},_option:function(e,a){var n=this,i=n.options,o=n.timeView,s=o.options,l=n._value||n._old;if(a===t)return i[e];if(a=r(a,i.parseFormats,i.culture)){if(i[e]=new H(+a),n.dateView[e](a),n._midnight=0===d(i.min)+d(i.max),l&&m(a,l)){if(n._midnight&&"max"==e)return s[e]=S,o.dataBind([S]),t;s[e]=a}else s.max=S,s.min=E;o.bind()}},_toggleHover:function(t){e(t.currentTarget).toggleClass(y,"mouseenter"===t.type)},_update:function(t){var a,n,o,s,l,d=this,p=d.options,f=p.min,v=p.max,_=p.dates,g=d.timeView,h=r(t,p.parseFormats,p.culture);return+h===+d._value?(l=i.toString(h,p.format,p.culture),l!==t&&d.element.val(null===h?t:l),h):(null!==h&&m(h,f)?h=u(h,f,v):c(h,f,v)||(h=null),d._value=h,g.value(h),d.dateView.value(h),h&&(o=d._old,n=g.options,_[0]&&(_=e.grep(_,function(e){return m(h,e)}),_[0]&&(g.dataBind(_),s=!0)),s||(m(h,f)&&(n.min=f,n.max=S,a=!0),m(h,v)&&(d._midnight?(g.dataBind([S]),s=!0):(n.max=v,a||(n.min=E),a=!0))),!s&&(!o&&a||o&&!m(o,h))&&(a||(n.max=S,n.min=E),g.bind())),d.element.val(h?i.toString(h,p.format,p.culture):t),d._updateARIA(h),h)},_keydown:function(e){var t=this,a=t.dateView,n=t.timeView,o=a.popup.visible();e.altKey&&e.keyCode===i.keys.DOWN?t.toggle(o?"time":"date"):o?(a.move(e),t._updateARIA(a._current)):n.popup.visible()?n.move(e):e.keyCode===i.keys.ENTER&&t._change(t.element.val())},_views:function(){var e,t,a,n,s,l=this,u=l.element,m=l.options,d=u.attr("id");l.dateView=e=new i.DateView(B({},m,{id:d,anchor:l.wrapper,change:function(){var t,a=e.calendar.value(),n=+a,i=+m.min,o=+m.max;(n===i||n===o)&&(t=new H(+l._value),t.setFullYear(a.getFullYear()),t.setMonth(a.getMonth()),t.setDate(a.getDate()),c(t,i,o)&&(a=t)),l._change(a),l.close("date")},close:function(e){l.trigger(_,M)?e.preventDefault():(u.attr(T,!1),a.attr(R,!0),t.popup.visible()||u.removeAttr(W))},open:function(t){l.trigger(v,M)?t.preventDefault():(s=r(u.val(),m.parseFormats,m.culture),s?(l.dateView._current=s,l.dateView.calendar._focus(s)):l.dateView.value(s),a.attr(R,!1),u.attr(T,!0).attr(W,e._dateViewID))}})),a=e.div,l.timeView=t=new o({id:d,value:m.value,anchor:l.wrapper,animation:m.animation,format:m.timeFormat,culture:m.culture,height:m.height,interval:m.interval,min:new H(E),max:new H(S),parseFormats:m.parseFormats,change:function(a,n){a=t._parse(a),m.min>a?(a=new H(+m.min),t.options.min=a):a>m.max&&(a=new H(+m.max),t.options.max=a),n?(l._timeSelected=!0,l._change(a)):(u.val(i.toString(a,m.format,m.culture)),e.value(a),l._updateARIA(a))},close:function(t){l.trigger(_,q)?t.preventDefault():(n.attr(R,!0),u.attr(T,!1),e.popup.visible()||u.removeAttr(W))},open:function(e){l.trigger(v,q)?e.preventDefault():(n.attr(R,!1),u.attr(T,!0).attr(W,t._timeViewID))},active:function(e){u.removeAttr(F),e&&u.attr(F,t._optionID)}}),n=t.ul},_icons:function(){var t,a=this,n=a.element;t=n.next("span.k-select"),t[0]||(t=e('<span unselectable="on" class="k-select"><span unselectable="on" class="k-icon k-i-calendar">select</span><span unselectable="on" class="k-icon k-i-clock">select</span></span>').insertAfter(n)),t=t.children(),a._dateIcon=t.eq(0).attr({role:"button","aria-controls":a.dateView._dateViewID}),a._timeIcon=t.eq(1).attr({role:"button","aria-controls":a.timeView._timeViewID})},_wrapper:function(){var t,a=this,n=a.element;t=n.parents(".k-datetimepicker"),t[0]||(t=n.wrap(C).parent().addClass("k-picker-wrap k-state-default"),t=t.wrap(C).parent()),t[0].style.cssText=n[0].style.cssText,n.css({width:"100%",height:n[0].style.height}),a.wrapper=t.addClass("k-widget k-datetimepicker k-header").addClass(n[0].className),a._inputWrapper=e(t[0].firstChild)},_reset:function(){var e=this,t=e.element,a=t.closest("form");a[0]&&(e._resetHandler=function(){e.value(t[0].defaultValue)},e._form=a.on("reset",e._resetHandler))},_template:function(){this._ariaTemplate=i.template(this.options.ARIATemplate)},_updateARIA:function(e){this.element.attr("aria-label",this._ariaTemplate({current:e}))}});p.plugin(N)})(window.kendo.jQuery); +("function"==typeof define&&define.amd?define:function(e,t){return t()})(["./kendo.datepicker.min","./kendo.timepicker.min"],function(){(function(e,t){function a(e){e.preventDefault()}function n(t){var a,n=i.getCulture(t.culture).calendars.standard.patterns;t.format=s(t.format||n.g),t.timeFormat=a=s(t.timeFormat||n.t),i.DateView.normalize(t),-1===e.inArray(a,t.parseFormats)&&t.parseFormats.splice(1,0,a)}var i=window.kendo,o=i.TimeView,r=i.parseDate,l=i._activeElement,s=i._extractFormat,d=i.calendar,u=d.isInRange,c=d.restrictValue,m=d.isEqualDatePart,p=o.getMilliseconds,f=i.ui,_=f.Widget,v="open",h="close",g="change",w=".kendoDateTimePicker",k="click"+w,x="disabled",V="readonly",y="k-state-default",b="k-state-focused",D="k-state-hover",A="k-state-disabled",I="mouseenter"+w+" mouseleave"+w,T="mousedown"+w,C="month",F="<span/>",R="aria-activedescendant",W="aria-expanded",H="aria-hidden",S="aria-owns",E="aria-disabled",M="aria-readonly",q=Date,B=new q(1900,0,1),N=new q(2099,11,31),O={view:"date"},P={view:"time"},j=e.extend,L=_.extend({init:function(e,t){var a,o=this;_.fn.init.call(o,e,t),e=o.element,t=o.options,n(t),o._wrapper(),o._views(),o._icons(),o._reset(),o._template(),e[0].type="text",e.addClass("k-input").attr({role:"textbox","aria-haspopup":!0,"aria-expanded":!1}),o._midnight=0===p(t.min)+p(t.max),a=e.is("[disabled]"),a?o.enable(!1):o.readonly(e.is("[readonly]")),o.value(t.value||e.val()),i.notify(o)},options:{name:"DateTimePicker",value:null,format:"",timeFormat:"",culture:"",parseFormats:[],dates:[],min:new q(B),max:new q(N),interval:30,height:200,footer:"",start:C,depth:C,animation:{},month:{},ARIATemplate:'Current focused date is #=kendo.toString(data.current, "G")#'},events:[v,h,g],setOptions:function(e){var t=this,a=t.dateView.options,i=t.timeView.options;_.fn.setOptions.call(t,e),n(t.options),e=t.options,j(a,e,{change:a.change,close:a.close,open:a.open}),j(i,e,{format:e.timeFormat,active:i.active,change:i.change,close:i.close,open:i.open}),t.timeView.ul[0].innerHTML=""},_editable:function(t){var n=this,o=n.element.off(w),r=n._dateIcon.off(w),s=n._timeIcon.off(w),d=n._inputWrapper.off(w),u=t.readonly,c=t.disable;u||c?(d.addClass(c?A:y).removeClass(c?y:A),o.attr(x,c).attr(V,u).attr(E,c).attr(M,u)):(d.addClass(y).removeClass(A).on(I,n._toggleHover),o.removeAttr(x).removeAttr(V).attr(E,!1).attr(M,!1).on("keydown"+w,e.proxy(n._keydown,n)).on("focus"+w,function(){n._inputWrapper.addClass(b)}).on("blur"+w,function(){n._inputWrapper.removeClass(b),o.val()!==n._oldText&&n._change(o.val()),n.close("date"),n.close("time")}),r.on(T,a).on(k,function(){n.toggle("date"),i.support.touch||o[0]===l()||o.focus()}),s.on(T,a).on(k,function(){n.toggle("time"),i.support.touch||o[0]===l()||o.focus()}))},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.dateView.destroy(),e.timeView.destroy(),e.element.off(w),e._dateIcon.off(w),e._timeIcon.off(w),e._inputWrapper.off(w),e._form&&e._form.off("reset",e._resetHandler)},close:function(e){"time"!==e&&(e="date"),this[e+"View"].close()},open:function(e){"time"!==e&&(e="date"),this[e+"View"].open()},min:function(e){return this._option("min",e)},max:function(e){return this._option("max",e)},toggle:function(e){var t="timeView";"time"!==e?e="date":t="dateView",this[e+"View"].toggle(),this[t].close()},value:function(e){var a=this;return e===t?a._value:(a._old=a._update(e),null===a._old&&a.element.val(""),a._oldText=a.element.val(),t)},_change:function(e){var t=this;e=t._update(e),+t._old!=+e&&(t._old=e,t._oldText=t.element.val(),t.trigger(g),t.element.trigger(g))},_option:function(e,a){var n=this,i=n.options,o=n.timeView,l=o.options,s=n._value||n._old;if(a===t)return i[e];if(a=r(a,i.parseFormats,i.culture)){if(i[e]=new q(+a),n.dateView[e](a),n._midnight=0===p(i.min)+p(i.max),s&&m(a,s)){if(n._midnight&&"max"==e)return l[e]=N,o.dataBind([N]),t;l[e]=a}else l.max=N,l.min=B;o.bind()}},_toggleHover:function(t){e(t.currentTarget).toggleClass(D,"mouseenter"===t.type)},_update:function(t){var a,n,o,l,s,d=this,p=d.options,f=p.min,_=p.max,v=p.dates,h=d.timeView,g=r(t,p.parseFormats,p.culture);return+g===+d._value?(s=i.toString(g,p.format,p.culture),s!==t&&d.element.val(null===g?t:s),g):(null!==g&&m(g,f)?g=c(g,f,_):u(g,f,_)||(g=null),d._value=g,h.value(g),d.dateView.value(g),g&&(o=d._old,n=h.options,v[0]&&(v=e.grep(v,function(e){return m(g,e)}),v[0]&&(h.dataBind(v),l=!0)),l||(m(g,f)&&(n.min=f,n.max=N,a=!0),m(g,_)&&(d._midnight?(h.dataBind([N]),l=!0):(n.max=_,a||(n.min=B),a=!0))),!l&&(!o&&a||o&&!m(o,g))&&(a||(n.max=N,n.min=B),h.bind())),d.element.val(g?i.toString(g,p.format,p.culture):t),d._updateARIA(g),g)},_keydown:function(e){var t=this,a=t.dateView,n=t.timeView,o=t.element.val(),r=a.popup.visible();e.altKey&&e.keyCode===i.keys.DOWN?t.toggle(r?"time":"date"):r?(a.move(e),t._updateARIA(a._current)):n.popup.visible()?n.move(e):e.keyCode===i.keys.ENTER&&o!==t._oldText&&t._change(o)},_views:function(){var e,t,a,n,l,s=this,d=s.element,c=s.options,m=d.attr("id");s.dateView=e=new i.DateView(j({},c,{id:m,anchor:s.wrapper,change:function(){var t,a=e.calendar.value(),n=+a,i=+c.min,o=+c.max;(n===i||n===o)&&(t=new q(+s._value),t.setFullYear(a.getFullYear()),t.setMonth(a.getMonth()),t.setDate(a.getDate()),u(t,i,o)&&(a=t)),s._change(a),s.close("date")},close:function(e){s.trigger(h,O)?e.preventDefault():(d.attr(W,!1),a.attr(H,!0),t.popup.visible()||d.removeAttr(S))},open:function(t){s.trigger(v,O)?t.preventDefault():(s.element.val()!==s._oldText&&(l=r(d.val(),c.parseFormats,c.culture),l?(s.dateView._current=l,s.dateView.calendar._focus(l)):s.dateView.value(l)),a.attr(H,!1),d.attr(W,!0).attr(S,e._dateViewID))}})),a=e.div,s.timeView=t=new o({id:m,value:c.value,anchor:s.wrapper,animation:c.animation,format:c.timeFormat,culture:c.culture,height:c.height,interval:c.interval,min:new q(B),max:new q(N),parseFormats:c.parseFormats,change:function(a,n){a=t._parse(a),c.min>a?(a=new q(+c.min),t.options.min=a):a>c.max&&(a=new q(+c.max),t.options.max=a),n?(s._timeSelected=!0,s._change(a)):(d.val(i.toString(a,c.format,c.culture)),e.value(a),s._updateARIA(a))},close:function(t){s.trigger(h,P)?t.preventDefault():(n.attr(H,!0),d.attr(W,!1),e.popup.visible()||d.removeAttr(S))},open:function(e){t._adjustListWidth(),s.trigger(v,P)?e.preventDefault():(n.attr(H,!1),d.attr(W,!0).attr(S,t._timeViewID))},active:function(e){d.removeAttr(R),e&&d.attr(R,t._optionID)}}),n=t.ul},_icons:function(){var t,a=this,n=a.element;t=n.next("span.k-select"),t[0]||(t=e('<span unselectable="on" class="k-select"><span unselectable="on" class="k-icon k-i-calendar">select</span><span unselectable="on" class="k-icon k-i-clock">select</span></span>').insertAfter(n)),t=t.children(),a._dateIcon=t.eq(0).attr({role:"button","aria-controls":a.dateView._dateViewID}),a._timeIcon=t.eq(1).attr({role:"button","aria-controls":a.timeView._timeViewID})},_wrapper:function(){var t,a=this,n=a.element;t=n.parents(".k-datetimepicker"),t[0]||(t=n.wrap(F).parent().addClass("k-picker-wrap k-state-default"),t=t.wrap(F).parent()),t[0].style.cssText=n[0].style.cssText,n.css({width:"100%",height:n[0].style.height}),a.wrapper=t.addClass("k-widget k-datetimepicker k-header").addClass(n[0].className),a._inputWrapper=e(t[0].firstChild)},_reset:function(){var e=this,t=e.element,a=t.closest("form");a[0]&&(e._resetHandler=function(){e.value(t[0].defaultValue)},e._form=a.on("reset",e._resetHandler))},_template:function(){this._ariaTemplate=i.template(this.options.ARIATemplate)},_updateARIA:function(e){this.element.attr("aria-label",this._ariaTemplate({current:e}))}});f.plugin(L)})(window.kendo.jQuery)}); \ No newline at end of file