9 lines
16 KiB
JavaScript
9 lines
16 KiB
JavaScript
/*
|
|
* Kendo UI v2015.3.1111 (http://www.telerik.com/kendo-ui)
|
|
* Copyright 2015 Telerik AD. All rights reserved.
|
|
*
|
|
* Kendo UI 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(e,define){define(["./kendo.core.min"],e)}(function(){return function(e,t){function n(e,t,n,i){var r,o=e.getFullYear(),a=t.getFullYear(),s=n.getFullYear();return o-=o%i,r=o+(i-1),a>o&&(o=a),r>s&&(r=s),o+"-"+r}function i(e){for(var t,n=0,i=e.min,r=e.max,o=e.start,a=e.setter,l=e.build,c=e.cells||12,u=e.perRow||4,d=e.content||R,h=e.empty||I,f=e.html||'<table tabindex="0" role="grid" class="k-content k-meta-view" cellspacing="0"><tbody><tr role="row">';c>n;n++)n>0&&n%u===0&&(f+='</tr><tr role="row">'),o=new pe(o.getFullYear(),o.getMonth(),o.getDate(),0,0,0),S(o,0),t=l(o,n),f+=s(o,i,r)?d(t):h(t),a(o,1);return f+"</tr></tbody></table>"}function r(e,t,n){var i=e.getFullYear(),r=t.getFullYear(),o=r,a=0;return n&&(r-=r%n,o=r-r%n+n-1),i>o?a=1:r>i&&(a=-1),a}function o(){var e=new pe;return new pe(e.getFullYear(),e.getMonth(),e.getDate())}function a(e,t,n){var i=o();return e&&(i=new pe(+e)),t>i?i=new pe(+t):i>n&&(i=new pe(+n)),i}function s(e,t,n){return+e>=+t&&+n>=+e}function l(e,t){return e.slice(t).concat(e.slice(0,t))}function c(e,t,n){t=t instanceof pe?t.getFullYear():e.getFullYear()+n*t,e.setFullYear(t)}function u(t){e(this).toggleClass($,ie.indexOf(t.type)>-1||t.type==te)}function d(e){e.preventDefault()}function h(e){return A(e).calendars.standard}function f(e){var n=ge[e.start],i=ge[e.depth],r=A(e.culture);e.format=T(e.format||r.calendars.standard.patterns.d),isNaN(n)&&(n=0,e.start=U),(i===t||i>n)&&(e.depth=U),e.dates||(e.dates=[])}function p(e){P&&e.find("*").attr("unselectable","on")}function g(e,t){for(var n=0,i=t.length;i>n;n++)if(e===+t[n])return!0;return!1}function m(e,t){return e?e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate():!1}function v(e,t){return e?e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth():!1}var _,b=window.kendo,w=b.support,y=b.ui,k=y.Widget,x=b.keys,C=b.parseDate,S=b.date.adjustDST,T=b._extractFormat,D=b.template,A=b.getCulture,E=b.support.transitions,M=E?E.css+"transform-origin":"",R=D('<td#=data.cssClass# role="gridcell"><a tabindex="-1" class="k-link" href="\\#" data-#=data.ns#value="#=data.dateString#">#=data.value#</a></td>',{useWithBlock:!1}),I=D('<td role="gridcell"> </td>',{useWithBlock:!1}),F=b.support.browser,P=F.msie&&9>F.version,z=".kendoCalendar",B="click"+z,L="keydown"+z,H="id",N="min",O="left",V="slideIn",U="month",W="century",j="change",q="navigate",G="value",$="k-state-hover",Y="k-state-disabled",K="k-state-focused",Q="k-other-month",X=' class="'+Q+'"',J="k-nav-today",Z="td:has(.k-link)",ee="blur"+z,te="focus",ne=te+z,ie=w.touch?"touchstart":"mouseenter",re=w.touch?"touchstart"+z:"mouseenter"+z,oe=w.touch?"touchend"+z+" touchmove"+z:"mouseleave"+z,ae=6e4,se=864e5,le="_prevArrow",ce="_nextArrow",ue="aria-disabled",de="aria-selected",he=e.proxy,fe=e.extend,pe=Date,ge={month:0,year:1,decade:2,century:3},me=k.extend({init:function(t,n){var i,r,o=this;k.fn.init.call(o,t,n),t=o.wrapper=o.element,n=o.options,n.url=window.unescape(n.url),o._templates(),o._header(),o._footer(o.footer),r=t.addClass("k-widget k-calendar").on(re+" "+oe,Z,u).on(L,"table.k-content",he(o._move,o)).on(B,Z,function(t){var n=t.currentTarget.firstChild;-1!=n.href.indexOf("#")&&t.preventDefault(),o._click(e(n))}).on("mouseup"+z,"table.k-content, .k-footer",function(){o._focusView(o.options.focusOnNav!==!1)}).attr(H),r&&(o._cellID=r+"_cell_selected"),f(n),i=C(n.value,n.format,n.culture),o._index=ge[n.start],o._current=new pe(+a(i,n.min,n.max)),o._addClassProxy=function(){o._active=!0,o._cell.addClass(K)},o._removeClassProxy=function(){o._active=!1,o._cell.removeClass(K)},o.value(i),b.notify(o)},options:{name:"Calendar",value:null,min:new pe(1900,0,1),max:new pe(2099,11,31),dates:[],url:"",culture:"",footer:"",format:"",month:{},start:U,depth:U,animation:{horizontal:{effects:V,reverse:!0,duration:500,divisor:2},vertical:{effects:"zoomIn",duration:400}}},events:[j,q],setOptions:function(e){var t=this;f(e),e.dates[0]||(e.dates=t.options.dates),k.fn.setOptions.call(t,e),t._templates(),t._footer(t.footer),t._index=ge[t.options.start],t.navigate()},destroy:function(){var e=this,t=e._today;e.element.off(z),e._title.off(z),e[le].off(z),e[ce].off(z),b.destroy(e._table),t&&b.destroy(t.off(z)),k.fn.destroy.call(e)},current:function(){return this._current},view:function(){return this._view},focus:function(e){e=e||this._table,this._bindTable(e),e.focus()},min:function(e){return this._option(N,e)},max:function(e){return this._option("max",e)},navigateToPast:function(){this._navigate(le,-1)},navigateToFuture:function(){this._navigate(ce,1)},navigateUp:function(){var e=this,t=e._index;e._title.hasClass(Y)||e.navigate(e._current,++t)},navigateDown:function(e){var n=this,i=n._index,r=n.options.depth;if(e)return i===ge[r]?(+n._value!=+e&&(n.value(e),n.trigger(j)),t):(n.navigate(e,--i),t)},navigate:function(n,i){i=isNaN(i)?ge[i]:i;var r,o,s,l,c=this,u=c.options,d=u.culture,h=u.min,f=u.max,g=c._title,m=c._table,v=c._oldTable,b=c._value,w=c._current,y=n&&+n>+w,k=i!==t&&i!==c._index;n||(n=w),c._current=n=new pe(+a(n,h,f)),i===t?i=c._index:c._index=i,c._view=o=_.views[i],s=o.compare,l=i===ge[W],g.toggleClass(Y,l).attr(ue,l),l=s(n,h)<1,c[le].toggleClass(Y,l).attr(ue,l),l=s(n,f)>-1,c[ce].toggleClass(Y,l).attr(ue,l),m&&v&&v.data("animating")&&(v.kendoStop(!0,!0),m.kendoStop(!0,!0)),c._oldTable=m,(!m||c._changeView)&&(g.html(o.title(n,h,f,d)),c._table=r=e(o.content(fe({min:h,max:f,date:n,url:u.url,dates:u.dates,format:u.format,culture:d},c[o.name]))),p(r),c._animate({from:m,to:r,vertical:k,future:y}),c._focus(n),c.trigger(q)),i===ge[u.depth]&&b&&c._class("k-state-selected",o.toDateString(b)),c._class(K,o.toDateString(n)),!m&&c._cell&&c._cell.removeClass(K),c._changeView=!0},value:function(e){var n=this,i=n._view,r=n.options,o=n._view,a=r.min,l=r.max;return e===t?n._value:(e=C(e,r.format,r.culture),null!==e&&(e=new pe(+e),s(e,a,l)||(e=null)),n._value=e,o&&null===e&&n._cell?n._cell.removeClass("k-state-selected"):(n._changeView=!e||i&&0!==i.compare(e,n._current),n.navigate(e)),t)},_move:function(t){var n,i,r,o,s=this,l=s.options,c=t.keyCode,u=s._view,d=s._index,h=new pe(+s._current),f=b.support.isRtl(s.wrapper);return t.target===s._table[0]&&(s._active=!0),t.ctrlKey?c==x.RIGHT&&!f||c==x.LEFT&&f?(s.navigateToFuture(),i=!0):c==x.LEFT&&!f||c==x.RIGHT&&f?(s.navigateToPast(),i=!0):c==x.UP?(s.navigateUp(),i=!0):c==x.DOWN&&(s._click(e(s._cell[0].firstChild)),i=!0):(c==x.RIGHT&&!f||c==x.LEFT&&f?(n=1,i=!0):c==x.LEFT&&!f||c==x.RIGHT&&f?(n=-1,i=!0):c==x.UP?(n=0===d?-7:-4,i=!0):c==x.DOWN?(n=0===d?7:4,i=!0):c==x.ENTER?(s._click(e(s._cell[0].firstChild)),i=!0):c==x.HOME||c==x.END?(r=c==x.HOME?"first":"last",o=u[r](h),h=new pe(o.getFullYear(),o.getMonth(),o.getDate(),h.getHours(),h.getMinutes(),h.getSeconds(),h.getMilliseconds()),i=!0):c==x.PAGEUP?(i=!0,s.navigateToPast()):c==x.PAGEDOWN&&(i=!0,s.navigateToFuture()),(n||r)&&(r||u.setDate(h,n),s._focus(a(h,l.min,l.max)))),i&&t.preventDefault(),s._current},_animate:function(e){var t=this,n=e.from,i=e.to,r=t._active;n?n.parent().data("animating")?(n.off(z),n.parent().kendoStop(!0,!0).remove(),n.remove(),i.insertAfter(t.element[0].firstChild),t._focusView(r)):n.is(":visible")&&t.options.animation!==!1?t[e.vertical?"_vertical":"_horizontal"](n,i,e.future):(i.insertAfter(n),n.off(z).remove(),t._focusView(r)):(i.insertAfter(t.element[0].firstChild),t._bindTable(i))},_horizontal:function(e,t,n){var i=this,r=i._active,o=i.options.animation.horizontal,a=o.effects,s=e.outerWidth();a&&-1!=a.indexOf(V)&&(e.add(t).css({width:s}),e.wrap("<div/>"),i._focusView(r,e),e.parent().css({position:"relative",width:2*s,"float":O,"margin-left":n?0:-s}),t[n?"insertAfter":"insertBefore"](e),fe(o,{effects:V+":"+(n?"right":O),complete:function(){e.off(z).remove(),i._oldTable=null,t.unwrap(),i._focusView(r)}}),e.parent().kendoStop(!0,!0).kendoAnimate(o))},_vertical:function(e,t){var n,i,r=this,o=r.options.animation.vertical,a=o.effects,s=r._active;a&&-1!=a.indexOf("zoom")&&(t.css({position:"absolute",top:e.prev().outerHeight(),left:0}).insertBefore(e),M&&(n=r._cellByDate(r._view.toDateString(r._current)),i=n.position(),i=i.left+parseInt(n.width()/2,10)+"px "+(i.top+parseInt(n.height()/2,10)+"px"),t.css(M,i)),e.kendoStop(!0,!0).kendoAnimate({effects:"fadeOut",duration:600,complete:function(){e.off(z).remove(),r._oldTable=null,t.css({position:"static",top:0,left:0}),r._focusView(s)}}),t.kendoStop(!0,!0).kendoAnimate(o))},_cellByDate:function(t){return this._table.find("td:not(."+Q+")").filter(function(){return e(this.firstChild).attr(b.attr(G))===t})},_class:function(t,n){var i=this,r=i._cellID,o=i._cell;o&&o.removeAttr(de).removeAttr("aria-label").removeAttr(H),o=i._table.find("td:not(."+Q+")").removeClass(t).filter(function(){return e(this.firstChild).attr(b.attr(G))===n}).attr(de,!0),t!==K||i._active||i.options.focusOnNav===!1||(t=""),o.addClass(t),o[0]&&(i._cell=o),r&&(o.attr(H,r),i._table.removeAttr("aria-activedescendant").attr("aria-activedescendant",r))},_bindTable:function(e){e.on(ne,this._addClassProxy).on(ee,this._removeClassProxy)},_click:function(e){var t=this,n=t.options,i=new Date(+t._current),r=e.attr(b.attr(G)).split("/");r=new pe(r[0],r[1],r[2]),S(r,0),t._view.setDate(i,r),t.navigateDown(a(i,n.min,n.max))},_focus:function(e){var t=this,n=t._view;0!==n.compare(e,t._current)?t.navigate(e):(t._current=e,t._class(K,n.toDateString(e)))},_focusView:function(e,t){e&&this.focus(t)},_footer:function(n){var i=this,r=o(),a=i.element,s=a.find(".k-footer");return n?(s[0]||(s=e('<div class="k-footer"><a href="#" class="k-link k-nav-today"></a></div>').appendTo(a)),i._today=s.show().find(".k-link").html(n(r)).attr("title",b.toString(r,"D",i.options.culture)),i._toggle(),t):(i._toggle(!1),s.hide(),t)},_header:function(){var e,t=this,n=t.element;n.find(".k-header")[0]||n.html('<div class="k-header"><a href="#" role="button" class="k-link k-nav-prev"><span class="k-icon k-i-arrow-w"></span></a><a href="#" role="button" aria-live="assertive" aria-atomic="true" class="k-link k-nav-fast"></a><a href="#" role="button" class="k-link k-nav-next"><span class="k-icon k-i-arrow-e"></span></a></div>'),e=n.find(".k-link").on(re+" "+oe+" "+ne+" "+ee,u).click(!1),t._title=e.eq(1).on(B,function(){t._active=t.options.focusOnNav!==!1,t.navigateUp()}),t[le]=e.eq(0).on(B,function(){t._active=t.options.focusOnNav!==!1,t.navigateToPast()}),t[ce]=e.eq(2).on(B,function(){t._active=t.options.focusOnNav!==!1,t.navigateToFuture()})},_navigate:function(e,t){var n=this,i=n._index+1,r=new pe(+n._current);e=n[e],e.hasClass(Y)||(i>3?r.setFullYear(r.getFullYear()+100*t):_.views[i].setDate(r,t),n.navigate(r))},_option:function(e,n){var i,r=this,o=r.options,a=r._value||r._current;return n===t?o[e]:(n=C(n,o.format,o.culture),n&&(o[e]=new pe(+n),i=e===N?n>a:a>n,(i||v(a,n))&&(i&&(r._value=null),r._changeView=!0),r._changeView||(r._changeView=!(!o.month.content&&!o.month.empty)),r.navigate(r._value),r._toggle()),t)},_toggle:function(e){var n=this,i=n.options,r=n._today;e===t&&(e=s(o(),i.min,i.max)),r&&(r.off(B),e?r.addClass(J).removeClass(Y).on(B,he(n._todayClick,n)):r.removeClass(J).addClass(Y).on(B,d))},_todayClick:function(e){var t=this,n=ge[t.options.depth],i=o();e.preventDefault(),0===t._view.compare(t._current,i)&&t._index==n&&(t._changeView=!1),t._value=i,t.navigate(i,n),t.trigger(j)},_templates:function(){var e=this,t=e.options,n=t.footer,i=t.month,r=i.content,o=i.empty;e.month={content:D('<td#=data.cssClass# role="gridcell"><a tabindex="-1" class="k-link#=data.linkClass#" href="#=data.url#" '+b.attr("value")+'="#=data.dateString#" title="#=data.title#">'+(r||"#=data.value#")+"</a></td>",{useWithBlock:!!r}),empty:D('<td role="gridcell">'+(o||" ")+"</td>",{useWithBlock:!!o})},e.footer=n!==!1?D(n||'#= kendo.toString(data,"D","'+t.culture+'") #',{useWithBlock:!1}):null}});y.plugin(me),_={firstDayOfMonth:function(e){return new pe(e.getFullYear(),e.getMonth(),1)},firstVisibleDay:function(e,t){t=t||b.culture().calendar;for(var n=t.firstDay,i=new pe(e.getFullYear(),e.getMonth(),0,e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds());i.getDay()!=n;)_.setTime(i,-1*se);return i},setTime:function(e,t){var n=e.getTimezoneOffset(),i=new pe(e.getTime()+t),r=i.getTimezoneOffset()-n;e.setTime(i.getTime()+r*ae)},views:[{name:U,title:function(e,t,n,i){return h(i).months.names[e.getMonth()]+" "+e.getFullYear()},content:function(e){for(var t=this,n=0,r=e.min,o=e.max,a=e.date,s=e.dates,c=e.format,u=e.culture,d=e.url,f=d&&s[0],p=h(u),m=p.firstDay,v=p.days,w=l(v.names,m),y=l(v.namesShort,m),k=_.firstVisibleDay(a,p),x=t.first(a),C=t.last(a),T=t.toDateString,D=new pe,A='<table tabindex="0" role="grid" class="k-content" cellspacing="0"><thead><tr role="row">';7>n;n++)A+='<th scope="col" title="'+w[n]+'">'+y[n]+"</th>";return D=new pe(D.getFullYear(),D.getMonth(),D.getDate()),S(D,0),D=+D,i({cells:42,perRow:7,html:A+='</tr></thead><tbody><tr role="row">',start:k,min:new pe(r.getFullYear(),r.getMonth(),r.getDate()),max:new pe(o.getFullYear(),o.getMonth(),o.getDate()),content:e.content,empty:e.empty,setter:t.setDate,build:function(e){var t=[],n=e.getDay(),i="",r="#";return(x>e||e>C)&&t.push(Q),+e===D&&t.push("k-today"),(0===n||6===n)&&t.push("k-weekend"),f&&g(+e,s)&&(r=d.replace("{0}",b.toString(e,c,u)),i=" k-action-link"),{date:e,dates:s,ns:b.ns,title:b.toString(e,"D",u),value:e.getDate(),dateString:T(e),cssClass:t[0]?' class="'+t.join(" ")+'"':"",linkClass:i,url:r}}})},first:function(e){return _.firstDayOfMonth(e)},last:function(e){var t=new pe(e.getFullYear(),e.getMonth()+1,0),n=_.firstDayOfMonth(e),i=Math.abs(t.getTimezoneOffset()-n.getTimezoneOffset());return i&&t.setHours(n.getHours()+i/60),t},compare:function(e,t){var n,i=e.getMonth(),r=e.getFullYear(),o=t.getMonth(),a=t.getFullYear();return n=r>a?1:a>r?-1:i==o?0:i>o?1:-1},setDate:function(e,t){var n=e.getHours();t instanceof pe?e.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()):_.setTime(e,t*se),S(e,n)},toDateString:function(e){return e.getFullYear()+"/"+e.getMonth()+"/"+e.getDate()}},{name:"year",title:function(e){return e.getFullYear()},content:function(e){var t=h(e.culture).months.namesAbbr,n=this.toDateString,r=e.min,o=e.max;return i({min:new pe(r.getFullYear(),r.getMonth(),1),max:new pe(o.getFullYear(),o.getMonth(),1),start:new pe(e.date.getFullYear(),0,1),setter:this.setDate,build:function(e){return{value:t[e.getMonth()],ns:b.ns,dateString:n(e),cssClass:""}}})},first:function(e){return new pe(e.getFullYear(),0,e.getDate())},last:function(e){return new pe(e.getFullYear(),11,e.getDate())},compare:function(e,t){return r(e,t)},setDate:function(e,t){var n,i=e.getHours();t instanceof pe?(n=t.getMonth(),e.setFullYear(t.getFullYear(),n,e.getDate()),n!==e.getMonth()&&e.setDate(0)):(n=e.getMonth()+t,e.setMonth(n),n>11&&(n-=12),n>0&&e.getMonth()!=n&&e.setDate(0)),S(e,i)},toDateString:function(e){return e.getFullYear()+"/"+e.getMonth()+"/1"}},{name:"decade",title:function(e,t,i){return n(e,t,i,10)},content:function(e){var t=e.date.getFullYear(),n=this.toDateString;return i({start:new pe(t-t%10-1,0,1),min:new pe(e.min.getFullYear(),0,1),max:new pe(e.max.getFullYear(),0,1),setter:this.setDate,build:function(e,t){return{value:e.getFullYear(),ns:b.ns,dateString:n(e),cssClass:0===t||11==t?X:""}}})},first:function(e){var t=e.getFullYear();return new pe(t-t%10,e.getMonth(),e.getDate())},last:function(e){var t=e.getFullYear();return new pe(t-t%10+9,e.getMonth(),e.getDate())},compare:function(e,t){return r(e,t,10)},setDate:function(e,t){c(e,t,1)},toDateString:function(e){return e.getFullYear()+"/0/1"}},{name:W,title:function(e,t,i){return n(e,t,i,100)},content:function(e){var t=e.date.getFullYear(),n=e.min.getFullYear(),r=e.max.getFullYear(),o=this.toDateString,a=n,s=r;return a-=a%10,s-=s%10,10>s-a&&(s=a+9),i({start:new pe(t-t%100-10,0,1),min:new pe(a,0,1),max:new pe(s,0,1),setter:this.setDate,build:function(e,t){var i=e.getFullYear(),a=i+9;return n>i&&(i=n),a>r&&(a=r),{ns:b.ns,value:i+" - "+a,dateString:o(e),cssClass:0===t||11==t?X:""}}})},first:function(e){var t=e.getFullYear();return new pe(t-t%100,e.getMonth(),e.getDate())},last:function(e){var t=e.getFullYear();return new pe(t-t%100+99,e.getMonth(),e.getDate())},compare:function(e,t){return r(e,t,100)},setDate:function(e,t){c(e,t,10)},toDateString:function(e){var t=e.getFullYear();return t-t%10+"/0/1"}}]},_.isEqualDatePart=m,_.makeUnselectable=p,_.restrictValue=a,_.isInRange=s,_.normalize=f,_.viewsEnum=ge,b.calendar=_}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(e,t){t()}); |