@progress/kendo-ui
Version:
This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.
1 lines • 34.2 kB
JavaScript
module.exports=function(a){var r={};function i(e){if(r[e])return r[e].exports;var t=r[e]={exports:{},id:e,loaded:!1};return a[e].call(t.exports,t,t.exports,i),t.loaded=!0,t.exports}return i.m=a,i.c=r,i.p="",i(0)}({0:function(e,t,a){e.exports=a(1427)},3:function(e,t){e.exports=function(){throw Error("define cannot be used indirect")}},1420:function(e,t){e.exports=require("./kendo.scheduler.view")},1427:function(e,t,a){var r;a(3),a=[a(1420)],void 0===(t="function"==typeof(r=function(){var e={id:"scheduler.dayview",name:"Scheduler Day View",category:"web",description:"The Scheduler Day View",depends:["scheduler.view"],hidden:true},T=window.kendo.jQuery,d=void 0,S=window.kendo,t=S.ui,D=S.date.setTime,y=t.SchedulerView,H=S._outerWidth,M=S._outerHeight,w=T.extend,b=S.date.getDate,k=S.date.MS_PER_MINUTE,C=S.date.MS_PER_DAY,R="k-current-time",L="k-current-time-arrow",_="k-event-inverse",W=.8666,x=S.date.getMilliseconds,a=".kendoMultiDayView",r=S.template('<div title="(#=kendo.format("{0:t} - {1:t}", start, end)#): #=title.replace(/"/g,"&\\#34;")#">'+'<div class="k-event-template k-event-time">#:kendo.format("{0:t} - {1:t}", start, end)#</div>'+'<div class="k-event-template">${title}</div>'+"</div>"),i=S.template('<div title="(#=kendo.format("{0:t}", start)#): #=title.replace(/"/g,"&\\#34;")#">'+'<div class="k-event-template">${title}</div>'+"</div>"),s=S.template("#var dateString = isMobile ? kendo.toString(date,'ddd')[0] : kendo.toString(date,'ddd M/dd'); #"+"<span class='k-link k-nav-day'>#=dateString#</span>"),n='<div role="button" '+'aria-label="#: ariaLabel #" '+'data-#=ns#uid="#=uid#"'+"#if (resources[0]) { #"+'style="background-color:#=resources[0].color#; border-color: #=resources[0].color#"'+'class="k-event"'+"#} else {#"+'class="k-event"'+"#}#"+">"+'<span class="k-event-actions">'+"# if(data.tail || data.middle) {#"+'<span class="k-icon k-i-arrow-60-left"></span>'+"#}#"+"# if(data.isException()) {#"+'<span class="k-icon k-i-non-recurrence"></span>'+"# } else if(data.isRecurring()) {#"+'<span class="k-icon k-i-reload"></span>'+"# } #"+"</span>"+"{0}"+'<span class="k-event-actions">'+"#if (showDelete) {#"+'<a href="\\#" class="k-link k-event-delete" title="${data.messages.destroy}" aria-label="${data.messages.destroy}"><span class="k-icon k-i-close"></span></a>'+"#}#"+"# if(data.head || data.middle) {#"+'<span class="k-icon k-i-arrow-60-right"></span>'+"#}#"+"</span>"+"#if(resizable && !singleDay && !data.tail && !data.middle){#"+'<span class="k-resize-handle k-resize-w"></span>'+"#}#"+"#if(resizable && !singleDay && !data.head && !data.middle){#"+'<span class="k-resize-handle k-resize-e"></span>'+"#}#"+"</div>",o='<div role="button" '+'aria-label="#: ariaLabel #" '+'data-#=ns#uid="#=uid#" '+"#if (resources[0]) { #"+'style="background-color:#=resources[0].color #; border-color: #=resources[0].color#"'+'class="k-event"'+"#} else {#"+'class="k-event"'+"#}#"+">"+'<span class="k-event-actions">'+"# if(data.isException()) {#"+'<span class="k-icon k-i-non-recurrence"></span>'+"# } else if(data.isRecurring()) {#"+'<span class="k-icon k-i-reload"></span>'+"# } #"+"</span>"+"{0}"+'<span class="k-event-actions">'+"#if (showDelete) {#"+'<a href="\\#" class="k-link k-event-delete" title="${data.messages.destroy}" aria-label="${data.messages.destroy}"><span class="k-icon k-i-close"></span></a>'+"#}#"+"</span>"+'<span class="k-event-top-actions">'+"# if(data.tail || data.middle) {#"+'<span class="k-icon k-i-arrow-60-up"></span>'+"# } #"+"</span>"+'<span class="k-event-bottom-actions">'+"# if(data.head || data.middle) {#"+'<span class="k-icon k-i-arrow-60-down"></span>'+"# } #"+"</span>"+"# if(resizable && !data.tail && !data.middle) {#"+'<span class="k-resize-handle k-resize-n"></span>'+"# } #"+"# if(resizable && !data.head && !data.middle) {#"+'<span class="k-resize-handle k-resize-s"></span>'+"# } #"+"</div>";function z(e){var t=new Date(1980,1,1,0,0,0);D(t,x(e));return t}function E(e,t,a){return e>=t&&e<=a}function l(e,t,a,r){r=r?e<=a:e<a;return e>t&&r}function A(e,t,a,r){var i=e._continuousEvents;var s=i[i.length-1];var n=b(t.start.startDate()).getTime();if(r&&s&&b(s.start.startDate()).getTime()==n){var o=i.length-1;for(;o>-1;o--)if(i[o].isAllDay||b(i[o].start.startDate()).getTime()<n)break;i.splice(o+1,0,{element:a,isAllDay:true,uid:a.attr(S.attr("uid")),start:t.start,end:t.end})}else i.push({element:a,isAllDay:r,uid:a.attr(S.attr("uid")),start:t.start,end:t.end})}function u(e){if(e.workDays&&e.workDays.length)return e.workDays;var t=[];var a=e.workWeekStart%7;var r=Math.abs(e.workWeekEnd%7);t.push(a);while(r!=a){if(a>6)a-=7;else a++;t.push(a)}return t}var h=y.extend({init:function(e,t){var a=this;y.fn.init.call(a,e,t);a.title=a.options.title||a.options.name;a._workDays=u(a.options);a._templates();a._editable();a.calculateDateRange();a._groups();a._currentTime(true)},_currentTimeMarkerUpdater:function(){this._updateCurrentTimeMarker(new Date)},_updateCurrentTimeMarker:function(e){var t=this.options,a,r,i,s,u="<div class='"+R+"'></div>";if(t.currentTimeMarker.useLocalTimezone===false){var h=t.dataSource.options.schema.timezone;if(t.dataSource&&h){var c=S.timezone.offset(e,h);e=S.timezone.convert(e,e.getTimezoneOffset(),c)}}a=this.times.find("."+R);r=this.content.find("."+R);var f=!t.group||t.group.orientation=="horizontal"?1:this.groups.length;var n=this.times.find("tr").first().find("th").first();var v=this.times.find("tr").first().find("th").last();if(n.length>0&&v.length>0)if(this._isRtl)s=n.position().left+M(n)-M(v);else s=v.position().left;for(var o=0;o<f;o++){var p=this.groups[o];if(!p)return;var m=S.date.toUtcTime(e);var g=p.timeSlotRanges(m,m+1);if(g.length===0)return;var _=g[0].collection;var y=_.slotByStartDate(e);if(y){var l=a[o]?a.eq(o):T(u).prependTo(this.times);var D=Math.round(g[0].innerRect(e,new Date(e.getTime()+1),false).top);var d={};if(this._isRtl){d.right=s;l.addClass(L+"-left")}else{d.left=s;l.addClass(L+"-right")}if(!i)i=H(l)*W/2;d.top=D-i;l.css(d);var k=r[o]?r.eq(o):T(u).prependTo(this.content);k.css({top:D,height:"1px",right:0,left:0})}}},_currentTime:function(e){var t=this;var a=t.options.currentTimeMarker;if(a!==false&&a.updateInterval!==d){t._currentTimeMarkerUpdater();if(e)t._currentTimeUpdateTimer=setInterval(this._currentTimeMarkerUpdater.bind(t),a.updateInterval)}},_updateResizeHint:function(e,u,h,c){var t;if(this.options.enforceAllDaySlot)t=e.isMultiDay();else t=e.isAllDay;var f=this.groups[u];var v=f.ranges(h,c,t,e.isAllDay);var a,r,i,s;this._removeResizeHint();for(var p=0;p<v.length;p++){var n=v[p];var o=n.startSlot();if(this._isGroupedByDate()&&t)for(var m=o.index;m<=n.end.index;m++){var l=n.collection._slots[m];a=l.offsetWidth;r=l.clientHeight;i=l.offsetTop;s=y.fn._createResizeHint.call(this,l.offsetLeft,i,a,r);this._resizeHint=this._resizeHint.add(s)}else{a=o.offsetWidth;r=o.clientHeight;i=o.offsetTop;if(t)a=n.innerWidth();else{var g=n.outerRect(h,c,this.options.snap);i=g.top;r=g.bottom-g.top}s=y.fn._createResizeHint.call(this,o.offsetLeft,i,a,r);this._resizeHint=this._resizeHint.add(s)}}var _="t";var d=this.content;if(t){_="M/dd";d=this.element.find(".k-scheduler-header-wrap:has(.k-scheduler-header-all-day) > div");if(!d.length)d=this.content}this._resizeHint.appendTo(d);this._resizeHint.find(".k-label-top,.k-label-bottom").text("");this._resizeHint.first().addClass("k-first").find(".k-label-top").text(S.toString(S.timezone.toLocalDate(h),_));this._resizeHint.last().addClass("k-last").find(".k-label-bottom").text(S.toString(S.timezone.toLocalDate(c),_))},_updateMoveHint:function(e,u,h){var t;if(this.options.enforceAllDaySlot)t=e.isMultiDay();else t=e.isAllDay;var c=this.groups[u];var a=S.date.toUtcTime(e.start)+h;var r=a+e.duration();var f=c.ranges(a,r,t,e.isAllDay);a=S.timezone.toLocalDate(a);r=S.timezone.toLocalDate(r);this._removeMoveHint(e.uid);if(!t&&x(r)<x(this.startTime())&&r<this._end().getTime()&&x(r)!==0&&f.length>1)f.pop();var i=T();for(var v=0;v<f.length;v++){var s=f[v];var n=s.start;var o;var l={left:n.offsetLeft+2,top:n.offsetTop};if(this._isGroupedByDate()&&t)for(var p=n.index;p<=s.end.index;p++){var d=s.collection._slots[p];l.left=this._isRtl?d.clientWidth*.1+d.offsetLeft+2:d.offsetLeft+2;l.height=d.offsetHeight;l.width=d.clientWidth*.9-2;o=this._createEventElement(e.clone({start:a,end:r}),!t);if(e.inverseColor)o.addClass(_);this._appendMoveHint(o,l);i=i.add(o)}else{if(this._isRtl)l.left=n.clientWidth*.1+n.offsetLeft+2;if(t)l.width=s.innerWidth()-2;else{var m=s.outerRect(a,r,this.options.snap);l.top=m.top;l.height=m.bottom-m.top;l.width=n.clientWidth*.9-2}o=this._createEventElement(e.clone({start:a,end:r}),!t);if(e.inverseColor)o.addClass(_);this._appendMoveHint(o,l);i=i.add(o)}}var g=this.content;if(t){g=this.element.find(".k-scheduler-header-wrap:has(.k-scheduler-header-all-day) > div");if(!g.length)g=this.content}i.appendTo(g)},_appendMoveHint:function(e,t){e.addClass("k-event-drag-hint");e.css(t);this._moveHint=this._moveHint.add(e)},_slotByPosition:function(e,t){var a,r;if(this._isVerticallyGrouped()){r=this.content.offset();t+=this.content[0].scrollTop;e+=this.content[0].scrollLeft}else r=this.element.find(".k-scheduler-header-wrap:has(.k-scheduler-header-all-day)").find(">div").offset();if(r){e-=r.left;t-=r.top}e=Math.ceil(e);t=Math.ceil(t);var i;var s;for(s=0;s<this.groups.length;s++){i=this.groups[s];a=i.daySlotByPosition(e,t,this._isGroupedByDate());if(a)return a}if(r){e+=r.left;t+=r.top}r=this.content.offset();e-=r.left;t-=r.top;if(!this._isVerticallyGrouped()){t+=this.content[0].scrollTop;e+=this.content[0].scrollLeft}e=Math.ceil(e);t=Math.ceil(t);for(s=0;s<this.groups.length;s++){i=this.groups[s];a=i.timeSlotByPosition(e,t);if(a)return a}return null},_groupCount:function(){var e=this.groupedResources;var t=this._isGroupedByDate();if(e.length)if(this._groupOrientation()==="vertical")if(t)return this._columnCountForLevel(e.length-1);else return this._rowCountForLevel(e.length-1);else if(t)return this._columnCountForLevel(e.length)/this._columnCountForLevel(0);else return this._columnCountForLevel(e.length)/this._columnOffsetForResource(e.length);return 1},_columnCountInResourceView:function(){var e=this.groupedResources;var t=this._isGroupedByDate();if(!e.length||this._isVerticallyGrouped())if(t)return this._rowCountForLevel(0);else return this._columnCountForLevel(0);if(t)return this._columnCountForLevel(0);else return this._columnOffsetForResource(e.length)},_timeSlotGroups:function(e,t){var a=this._timeSlotInterval();var u=e;var h=this._isGroupedByDate();var c=this.content.find("tr:not(.k-scheduler-header-all-day)");var r,i,s,n;var o=c.length;if(this._isVerticallyGrouped()){if(h)u=t;o=Math.floor(o/u)}for(var l=0;l<u;l++){var f=0;var d=0;if(this._isVerticallyGrouped())f=l;else d=l;s=f*o;while(s<(f+1)*o){var v=c[s].children;if(s%o===0)i=x(new Date(+this.startTime()));var p=0;if(h)if(this._isVerticallyGrouped())for(n=0;n<e;n++){r=this.groups[n];this._addTimeSlotGroup(r,v,n,i,a,l)}else{r=this.groups[l];for(n=d;n<e*t;n=n+e){this._addTimeSlotGroup(r,v,n,i,a,p);p++}}else{r=this.groups[l];for(n=d*t;n<(d+1)*t;n++){this._addTimeSlotGroup(r,v,n,i,a,p);p++}}i+=a;s++}}},_addTimeSlotGroup:function(e,t,a,r,i,s){var n=t[a];var o=e.getTimeSlotCollection(s);var l=this._dates[s];if(!l||!n)return;var u=Date.UTC(l.getFullYear(),l.getMonth(),l.getDate());var d=u+r;var h=d+i;o.addTimeSlot(n,d,h)},_addDaySlotGroup:function(e,t,a,r,i){var s=t[a];var n=this._dates[i];if(!n)return;var o=Date.UTC(n.getFullYear(),n.getMonth(),n.getDate());e.addDaySlot(s,o,o+S.date.MS_PER_DAY)},_daySlotGroups:function(e,t){var a,r;var u=e;var h=this._isGroupedByDate();if(this._isVerticallyGrouped()){if(h)u=t;a=this.element.find(".k-scheduler-header-all-day")}else a=this.element.find(".k-scheduler-header-all-day tr");for(var i=0;i<u;i++){var c=0;var s,n;if(this._isVerticallyGrouped())c=i;var o=a[c].children;var l=0;if(!this._isVerticallyGrouped())l=i;var d=0;if(h)if(this._isVerticallyGrouped())for(r=0;r<e;r++){s=this.groups[r];n=s.getDaySlotCollection(0);this._addDaySlotGroup(n,o,r,t,i)}else{s=this.groups[i];n=s.getDaySlotCollection(0);for(r=l;r<e*t;r=r+e){this._addDaySlotGroup(n,o,r,t,d);d++}}else{s=this.groups[i];n=s.getDaySlotCollection(0);for(r=l*t;r<(l+1)*t;r++){this._addDaySlotGroup(n,o,r,t,d);d++}}}},_groups:function(){var e=this._groupCount();var t=this._columnCountInResourceView();this.groups=[];for(var a=0;a<e;a++){var r=this._addResourceView(a);for(var i=0;i<t;i++)if(this._dates[i])r.addTimeSlotCollection(this._dates[i],S.date.addDays(this._dates[i],1));if(this.options.allDaySlot)r.addDaySlotCollection(this._dates[0],S.date.addDays(this._dates[this._dates.length-1],1))}this._timeSlotGroups(e,t);if(this.options.allDaySlot)this._daySlotGroups(e,t)},options:{name:"MultiDayView",selectedDateFormat:"{0:D}",selectedShortDateFormat:"{0:d}",selectedMobileDateFormat:"{0:MMM} {0:dd} - {1:dd}",allDaySlot:true,showWorkHours:false,title:"",startTime:S.date.today(),endTime:S.date.today(),minorTickCount:2,majorTick:60,majorTimeHeaderTemplate:"<span>#=kendo.toString(date, 't')#</span>",minorTimeHeaderTemplate:"&\\#8203;",groupHeaderTemplate:"#=text#",slotTemplate:" ",allDaySlotTemplate:" ",eventTemplate:r,allDayEventTemplate:i,dateHeaderTemplate:s,editable:true,workDayStart:new Date(1980,1,1,8,0,0),workDayEnd:new Date(1980,1,1,17,0,0),workWeekStart:1,workWeekEnd:5,footer:{command:"workDay"},messages:{allDay:"all day",showFullDay:"Show full day",showWorkDay:"Show business hours"},currentTimeMarker:{updateInterval:1e4,useLocalTimezone:true},enforceAllDaySlot:false},events:["remove","add","edit"],_templates:function(){var e=this.options,t=w({},S.Template,e.templateSettings);this.eventTemplate=this._eventTmpl(e.eventTemplate,o);this.allDayEventTemplate=this._eventTmpl(e.allDayEventTemplate,n);this.majorTimeHeaderTemplate=S.template(e.majorTimeHeaderTemplate,t);this.minorTimeHeaderTemplate=S.template(e.minorTimeHeaderTemplate,t);this.dateHeaderTemplate=S.template(e.dateHeaderTemplate,t);this.slotTemplate=S.template(e.slotTemplate,t);this.allDaySlotTemplate=S.template(e.allDaySlotTemplate,t);this.groupHeaderTemplate=S.template(e.groupHeaderTemplate,t)},_editable:function(){if(this.options.editable)if(this._isMobile())this._touchEditable();else this._mouseEditable()},_mouseEditable:function(){var r=this;r.element.on("click"+a,".k-event a:has(.k-i-close)",function(e){r.trigger("remove",{uid:T(this).closest(".k-event").attr(S.attr("uid"))});e.preventDefault()});if(r.options.editable.create!==false)r.element.on("dblclick"+a,".k-scheduler-content > table td",function(e){if(!T(this).parent().hasClass("k-scheduler-header-all-day")){var t=r._slotByPosition(e.pageX,e.pageY);if(t){var a=r._resourceBySlot(t);r.trigger("add",{eventInfo:w({start:t.startDate(),end:t.endDate()},a)})}e.preventDefault()}}).on("dblclick"+a,".k-scheduler-header-all-day td",function(e){var t=r._slotByPosition(e.pageX,e.pageY);if(t){var a=r._resourceBySlot(t);r.trigger("add",{eventInfo:w({},{isAllDay:true,start:S.date.getDate(t.startDate()),end:S.date.getDate(t.startDate())},a)})}e.preventDefault()});if(r.options.editable.update!==false)r.element.on("dblclick"+a,".k-event",function(e){r.trigger("edit",{uid:T(this).closest(".k-event").attr(S.attr("uid"))});e.preventDefault()})},_touchEditable:function(){var s=this;var e=0;if(S.support.mobileOS.android)e=5;if(s.options.editable.create!==false){s._addUserEvents=new S.UserEvents(s.element,{threshold:e,filter:".k-scheduler-content td",useClickAsTap:!S.support.browser.edge,tap:function(e){if(s._scrolling)return;if(!T(e.target).parent().hasClass("k-scheduler-header-all-day")){var t=e.x.location!==d?e.x.location:e.x;var a=e.y.location!==d?e.y.location:e.y;var r=s._slotByPosition(t,a);if(r){var i=s._resourceBySlot(r);s.trigger("add",{eventInfo:w({start:r.startDate(),end:r.endDate()},i)})}e.preventDefault()}}});s._allDayUserEvents=new S.UserEvents(s.element,{threshold:e,useClickAsTap:!S.support.browser.edge,filter:".k-scheduler-header-all-day td",tap:function(e){if(s._scrolling)return;var t=e.x.location!==d?e.x.location:e.x;var a=e.y.location!==d?e.y.location:e.y;var r=s._slotByPosition(t,a);if(r){var i=s._resourceBySlot(r);s.trigger("add",{eventInfo:w({},{isAllDay:true,start:S.date.getDate(r.startDate()),end:S.date.getDate(r.startDate())},i)})}e.preventDefault()}})}if(s.options.editable.update!==false)s._editUserEvents=new S.UserEvents(s.element,{threshold:e,useClickAsTap:!S.support.browser.edge,filter:".k-event",tap:function(e){if(s._scrolling)return;var t=T(e.target).closest(".k-event");var a=T(e.touch.initialTouch);if(a.hasClass("k-i-close"))s.trigger("remove",{uid:t.attr(S.attr("uid"))});else if(!t.hasClass("k-event-active"))s.trigger("edit",{uid:t.attr(S.attr("uid"))});e.preventDefault()}})},_layout:function(a){var e=[];var n=[];var t=this.options;var o=this;var r=o._isGroupedByDate();for(var i=0;i<a.length;i++){var s={};s.text=o.dateHeaderTemplate({date:a[i],isMobile:o._isMobile()});if(S.date.isToday(a[i]))s.className="k-today";e.push(s)}var l=this.groupedResources;if(t.allDaySlot)n.push({text:t.messages.allDay,allDay:true,cellContent:function(e){var t=e;e=l.length&&o._groupOrientation()!=="vertical"?e%a.length:e;return o.allDaySlotTemplate({date:a[e],resources:function(){return o._resourceBySlot({groupIndex:t})}})}});this._forTimeRange(this.startTime(),this.endTime(),function(e,t,a,r){var i=t?o.majorTimeHeaderTemplate:o.minorTimeHeaderTemplate;var s={text:i({date:e}),className:r?"k-slot-cell":""};n.push(s)});if(l.length)if(this._groupOrientation()==="vertical")if(r){n=this._createDateLayout(e,n);e=this._createColumnsLayout(l,null,this.groupHeaderTemplate)}else n=this._createRowsLayout(l,n,this.groupHeaderTemplate);else if(r)e=this._createColumnsLayout(l,e,this.groupHeaderTemplate,e);else e=this._createColumnsLayout(l,e,this.groupHeaderTemplate);return{columns:e,rows:n}},toggleFullDay:function(){var e=this.options;this.trigger("navigate",{view:this.name||e.name,date:e.date,isWorkDay:!e.showWorkHours})},_footer:function(){var n=this.options;if(n.footer!==false){var e='<div class="k-scheduler-footer k-toolbar">';var t=n.footer.command;if(this._isMobile()){e+='<span class="k-scheduler-today"><a href="#" tabindex="-1" class="k-link">';e+=n.messages.today+"</a></span>"}if(t&&t==="workDay")if(this._isMobile()){e+='<span class="k-scheduler-fullday"><a href="#" tabindex="-1" class="k-link">';e+=(n.showWorkHours?n.messages.showFullDay:n.messages.showWorkDay)+"</a></span>"}else{e+='<button type="button" tabindex="-1" class="k-button k-button-md k-rounded-md k-button-solid k-button-solid-base k-scheduler-fullday">';e+='<span class="k-button-icon k-icon k-i-clock"></span>';e+='<span class="k-button-text">';e+=n.showWorkHours?n.messages.showFullDay:n.messages.showWorkDay;e+="</span>";e+="</button>"}e+="</div>";this.footer=T(e).appendTo(this.element);var o=this;this.footer.on("click"+a,".k-scheduler-fullday",function(e){e.preventDefault();o.toggleFullDay()});this.footer.on("click"+a,".k-scheduler-today",function(e){e.preventDefault();var t=o.options.timezone;var a="today";var r=new Date;var i;if(t){var s=S.timezone.offset(r,t);i=S.timezone.convert(r,r.getTimezoneOffset(),s)}else i=r;o.trigger("navigate",{view:o.name||n.name,action:a,date:i})})}},_forTimeRange:function(e,t,u,h){e=z(e);t=z(t);var c=this,a=x(e),r=x(t),i=c.options.minorTickCount,f=c.options.majorTick*k,s=f/i||1,n=new Date(+e),v=n.getDate(),o,l=0,d,p="";d=C/s;if(a!=r){if(a>r)r+=C;d=(r-a)/s}d=Math.round(d);for(;l<d;l++){var m=l%(f/s),g=m===0,_=m<i-1,y=m===i-1;p+=u(n,g,_,y);D(n,s,false)}if(r){o=x(n);if(v<n.getDate())o+=C;if(o>r)n=new Date(+t)}if(h)p+=h(n);return p},_content:function(e){var t=this;var a="";a+="<tbody>";a+=t._renderRows(e,t.rowLevels,t.columnLevels);a+="</tbody>";this.content.find("table").append(a)},_virtualContent:function(e,t){var a=this;var r="";var i=a._dates;r+=a._renderRows(i,e,t);a.content.find("table tbody").append(r)},_renderRows:function(l,r,i){var d=this;var u=d._groupOrientation()==="vertical";var p=d._isGroupedByDate();var h=0;var c=l.length;var s=d.options;var n=d.startTime();var o=this.endTime();var f=1;var e=1;var m=this.groupedResources;var t="";if(m.length){var a=d._recalculateLevels(r,i);e=a.rowCount;f=a.groupsCount}var g=function(e,t,a){var r="";var i=0;var s,n;r="<tr"+(a?' class="k-middle-row"':"")+">";if(p)for(s=0,n=c;s<n;s++){for(i=0;i<f;i++){var o=s;if(u)o=h;r=d._addCellsToContent(r,l,e,o,i,v)}if(u)break}else for(;i<f;i++)for(s=0,n=c;s<n;s++)r=d._addCellsToContent(r,l,e,s,i,v);r+="</tr>";return r};for(var v=0;v<e;v++){t+=s.allDaySlot&&u?this._allDayVerticalGroupRow(l,v,f,h):"";t+=this._forTimeRange(n,o,g);if(u)h++}return t},_recalculateLevels:function(e,t){var a=this;var r=a._isGroupedByDate();var i=a._groupOrientation()==="vertical";var s=1;var n=1;if(i){n=a._rowCountForLevel(e.length-2,e);if(r)s=a._columnCountForLevel(t.length-1)}else if(r)s=a._columnCountForLevel(t.length-1)/this._columnCountForLevel(0);else s=a._columnCountForLevel(t.length-2);return{rowCount:n,groupsCount:s}},_allDayVerticalGroupRow:function(e,t,a,u){var r=this;var i='<tr class="k-scheduler-header-all-day">';var s=r._isGroupedByDate();var n=s?0:t;var o=r.allDaySlotTemplate;var l=function(){return r._resourceBySlot({groupIndex:n})};if(s)for(;n<a;n++)i+="<td>"+o({date:e[u],resources:l})+"</td>";else for(var d=0;d<e.length;d++)i+="<td>"+o({date:e[d],resources:l})+"</td>";return i+"</tr>"},_addCellsToContent:function(e,t,a,r,i,s){var n=this;var o="";var l;var d=this.slotTemplate;var u=this._groupOrientation()==="vertical";var h=function(e){return function(){return n._resourceBySlot({groupIndex:e})}};if(S.date.isToday(t[r]))o+="k-today";if(S.date.getMilliseconds(a)<S.date.getMilliseconds(this.options.workDayStart)||S.date.getMilliseconds(a)>=S.date.getMilliseconds(this.options.workDayEnd)||!this._isWorkDay(t[r]))o+=" k-nonwork-hour";e+="<td"+(o!==""?' class="'+o+'"':"")+">";l=S.date.getDate(t[r]);S.date.setTime(l,S.date.getMilliseconds(a));e+=d({date:l,resources:h(u&&!n._isGroupedByDate()?s:i)});e+="</td>";return e},_isWorkDay:function(e){var t=e.getDay();var a=this._workDays;for(var r=0;r<a.length;r++)if(a[r]===t)return true;return false},_render:function(e){var n=this;e=e||[];this._dates=e;this._startDate=e[0];this._endDate=e[e.length-1||0];this.createLayout(this._layout(e));this._content(e);this._footer();this.refreshLayout();if(this._isVirtualized())this._tryRenderContent();var t=this.element.find(".k-scheduler-header-all-day td");if(t.length)this._allDayHeaderHeight=t.first()[0].clientHeight;n.element.on("click"+a,".k-nav-day",function(e){var t=T(e.currentTarget).closest("th");var a=t.offset();var r=0;var i=M(t);if(n._isGroupedByDate())if(n._isVerticallyGrouped()){r=H(n.times);i=0}else i=M(n.datesHeader);var s=n._slotByPosition(a.left+r,a.top+i);n.trigger("navigate",{view:"day",date:s.startDate()})})},startTime:function(){var e=this.options;return e.showWorkHours?e.workDayStart:e.startTime},endTime:function(){var e=this.options;return e.showWorkHours?e.workDayEnd:e.endTime},startDate:function(){return this._startDate},endDate:function(){return this._endDate},_end:function(e){var t=x(this.endTime())||C;if(e)t=0;return new Date(this._endDate.getTime()+t)},nextDate:function(){return S.date.nextDay(this.endDate())},previousDate:function(){return S.date.previousDay(this.startDate())},calculateDateRange:function(){this._render([this.options.date])},destroy:function(){var e=this;if(e._currentTimeUpdateTimer)clearInterval(e._currentTimeUpdateTimer);if(e.datesHeader)e.datesHeader.off(a);if(e.element)e.element.off(a);if(e.footer)e.footer.remove();y.fn.destroy.call(this);if(this._isMobile()&&e.options.editable){if(e.options.editable.create!==false){e._addUserEvents.destroy();e._allDayUserEvents.destroy()}if(e.options.editable.update!==false)e._editUserEvents.destroy()}},inRange:function(e){var t=y.fn.inRange.call(this,e);if(e.isAllDay)return t;var a=x(this.startTime());var r=x(this.endTime())||S.date.MS_PER_DAY;var i=x(e.start);var s=x(e.end)||S.date.MS_PER_DAY;return t&&a<=i&&s<=r},selectionByElement:function(e){var t=e.offset();var a=Math.round(e.innerHeight())-5;return this._slotByPosition(t.left,t.top+a)},_timeSlotInterval:function(){var e=this.options;return e.majorTick/e.minorTickCount*k},_timeSlotIndex:function(e){var t=this.options;var a=x(e);var r=x(this.startTime());var i=t.majorTick/t.minorTickCount*k;return(a-r)/i},_slotIndex:function(e,t){if(t)return this._dateSlotIndex(e);return this._timeSlotIndex(e)},_dateSlotIndex:function(e,t){var a;var r;var i=this._dates||[];var s;var n;var o=1;for(a=0,r=i.length;a<r;a++){s=S.date.getDate(i[a]);n=new Date(S.date.getDate(i[a]).getTime()+C-(t?0:1));if(E(e,s,n))return a*o}return-1},_positionAllDayEvent:function(e,t){var u=t.innerWidth();var a=t.start.index;var r=t.end.index;var i=y.collidingEvents(t.events(),a,r);var h=this._headerColumnCount||0;var c=2;var f=a!==r?3:2;var s=this._allDayHeaderHeight;var v=t.startSlot();e.css({left:v.offsetLeft+c,width:u-f});t.addEvent({slotIndex:a,start:a,end:r,element:e});i.push({slotIndex:a,start:a,end:r,element:e});var n=y.createRows(i);if(n.length&&n.length>h)this._headerColumnCount=n.length;var p=t.start.offsetTop;for(var o=0,m=n.length;o<m;o++){var l=n[o].events;for(var d=0,g=l.length;d<g;d++)T(l[d].element).css({top:p+o*s,height:s-2})}},_arrangeColumns:function(e,u,h,t){var a=t.start;e={element:e,slotIndex:a.index,start:u,end:u+h};var r,c=a.clientWidth,i=c*.1,s,f=t.events(),v=y.collidingEvents(f,e.start,e.end),p=this.table.find(".k-scheduler-content .k-scheduler-table")[0],n=this.table.find(".k-scheduler-content")[0];t.addEvent(e);v.push(e);r=y.createColumns(v);var o=(c-i)/r.length;for(var l=0,m=r.length;l<m;l++){s=r[l].events;for(var d=0,g=s.length;d<g;d++){var _=o-2;s[d].element[0].style.width=(_>0?_:o)+"px";if(this._isRtl&&n.clientWidth<n.scrollWidth)s[d].element[0].style.left=i+a.offsetLeft+l*o-(p.clientWidth-n.clientWidth)+"px";else s[d].element[0].style.left=(this._isRtl?i:0)+a.offsetLeft+l*o+2+"px"}}},_positionEvent:function(e,t,a){var r=e._startTime||e.start;var i=e._endTime||e.end;var s=S.getComputedStyles(a.start.element,["border-top-width","border-bottom-width"]);var n=a.innerRect(r,i,false);var o=n.bottom-n.top-parseFloat(s["border-top-width"])-parseFloat(s["border-bottom-width"]);if(o<0)o=0;t.css({top:n.top,height:o});this._arrangeColumns(t,n.top,t[0].clientHeight,a)},_createEventElement:function(e,t,u,h){var c=t?this.eventTemplate:this.allDayEventTemplate;var f=this.options;var a=f.editable;var v=this._isMobile();var p=a&&a.destroy!==false&&!v;var m=a&&a.resize!==false;var g=b(this.startDate());var r=b(this.endDate());var i=x(this.startTime());var s=x(this.endTime());var n=e._time("start");var o=e._time("end");var _;if(i>=s)s=x(new Date(this.endTime().getTime()+C-1));if(!t&&!e.isAllDay)r=new Date(r.getTime()+C);var l=e.start;var d=e.end;if(e.isAllDay)d=b(e.end);if(!E(b(l),g,r)&&!E(d,g,r)||t&&e.start.getTime()!==e.end.getTime()&&(n<i||n>=s)&&(o>s||o<=i))_=true;else if(b(l)<g||t&&n!==0&&e.start.getTime()!==e.end.getTime()&&(n<i||n>=s))h=true;else if(d>r&&!t||t&&o!==0&&e.start.getTime()!==e.end.getTime()&&(o>s||o<=i))u=true;var y=this.eventResources(e);if(e._startTime&&n!==S.date.getMilliseconds(e.start)){l=new Date(n);l=S.timezone.apply(l,"Etc/UTC")}if(e._endTime&&o!==S.date.getMilliseconds(e.end)){d=new Date(o);d=S.timezone.apply(d,"Etc/UTC")}var D=w({},{ns:S.ns,resizable:m,showDelete:p,middle:_,head:u,tail:h,singleDay:this._dates.length==1,resources:y,inverseColor:false,messages:f.messages,ariaLabel:this._formatEventAriaLabel(e.title,l,d,e.isAllDay)},e,{start:l,end:d});var k=T(c(D));this.angular("compile",function(){return{elements:k,data:[{dataItem:D}]}});return k},_isInTimeSlot:function(e){var t=this.startTime(),a=this.endTime(),r=e._startTime||e.start,i=e._endTime||e.end;if(x(a)===x(S.date.getDate(a))){a=S.date.getDate(a);D(a,C-1)}if(e._date("end")>e._date("start"))i=+e._date("end")+(C-1);i=e._endTime?i-e._date("end"):x(new Date(i));r=e._startTime?r-e._date("start"):x(new Date(r));a=x(a);t=x(t);if(t===r&&r===i)return true;var s=r!==a;return l(r,t,a,s)||l(i,t,a,s)||l(t,r,i)||l(a,r,i)||e.end.getDate()>e.start.getDate()&&i>t},_isInDateSlot:function(e){var t=this.groups[0];var a=t.firstSlot().start;var r=t.lastSlot().end-1;var i=S.date.toUtcTime(e.start);var s=S.date.toUtcTime(e.end);return(E(i,a,r)||E(s,a,r)||E(a,i,s)||E(r,i,s))&&(!E(s,a,a)||E(s,i,i)||e.isAllDay)},_updateAllDayHeaderHeight:function(e){if(this._height!==e){this._height=e;var t=this.element.find(".k-scheduler-header-all-day td");if(t.length){t.parent().add(this.element.find(".k-scheduler-times-all-day").parent()).height(e);for(var a=0;a<this.groups.length;a++)this.groups[a].refresh()}}},_renderEvents:function(u,h){var c=this.datesHeader.find(".k-scheduler-header-wrap > div");var f=this._isGroupedByDate();var e;var t;var v;for(t=0,v=u.length;t<v;t++){e=u[t];if(this._isInDateSlot(e)){var a,p,r,i,s,n,o,l;if(this.options.enforceAllDaySlot)a=e.isAllDay||e.duration()>=C;else a=e.isAllDay;p=a&&!this._isVerticallyGrouped()?c:this.content;if(!a){if(this._isInTimeSlot(e)){l=this.groups[h];if(!l)continue;if(!l._continuousEvents)l._continuousEvents=[];i=l.slotRanges(e);var m=i.length;for(var d=0;d<m;d++){s=i[d];n=e.start;o=e.end;if(m>1)if(d===0)o=s.end.endDate();else if(d==m-1)n=s.start.startDate();else{n=s.start.startDate();o=s.end.endDate()}var g=e.clone({start:n,end:o,_startTime:e._startTime,_endTime:e.endTime});if(this._isInTimeSlot(g)){var _=s.head;r=this._createEventElement(e,!a,_,s.tail);r.appendTo(p);this._inverseEventColor(r);this._positionEvent(g,r,s);A(l,s,r,false)}}}}else if(this.options.allDaySlot){l=this.groups[h];if(!l)continue;if(!l._continuousEvents)l._continuousEvents=[];i=l.slotRanges(e);if(i.length){s=i[0];var y=s.start.index;var D=s.end.index;if(f&&y!==D){n=s.start.start;o=s.end.end;var k=n;var T=n;for(var w=s.start.index;w<=s.end.index;w++){r=this._createEventElement(e,!a,w!==D,w!==y);var b=l.daySlotRanges(k,T,true)[0];k=T+=S.date.MS_PER_DAY;this._positionAllDayEvent(r,b);A(l,b,r,true);r.appendTo(p);this._inverseEventColor(r)}}else{r=this._createEventElement(e,!a);this._positionAllDayEvent(r,i[0]);A(l,i[0],r,true);r.appendTo(p);this._inverseEventColor(r)}}}}}},render:function(e){var a=this;this._headerColumnCount=0;this._cachedEvents=e;this._groups();this.element.find(".k-event").remove();e=new S.data.Query(e).sort([{field:"start",dir:"asc"},{field:"end",dir:"desc"}]).toArray();var r=[];this._eventsByResource(e,this.groupedResources,r);var t=T.map(this._dates,function(t){return Math.max.apply(null,T.map(r,function(e){return T.grep(e,function(e){if(a.options.enforceAllDaySlot)return e.isMultiDay()&&E(t,b(e.start),b(e.end));else return e.isAllDay&&E(t,b(e.start),b(e.end))}).length}))});var i=Math.max.apply(null,t);this._updateAllDayHeaderHeight((i+1)*this._allDayHeaderHeight);for(var s=0;s<r.length;s++)this._renderEvents(r[s],s);this.refreshLayout();this._currentTime(false);this.trigger("activate")},_eventsByResource:function(e,t,a,r){var i=t[0];if(i){var s=i.dataSource.view();s=s.filter(function(e){var t=S.getter(i.dataParentValueField)(e);return t===null||t===d||t===r});for(var n=0;n<s.length;n++){var o=this._resourceValue(i,s[n]);var l=new S.data.Query(e).filter({field:i.field,operator:y.groupEqFilter(o)}).toArray();if(t.length>1)this._eventsByResource(l,t.slice(1),a,o);else a.push(l)}}else a.push(e)},_columnOffsetForResource:function(e){return this._columnCountForLevel(e)/this._columnCountForLevel(e-1)},_columnCountForLevel:function(e){var t=this.columnLevels[e];return t?t.length:0},_rowCountForLevel:function(e,t){t=t||this.rowLevels;var a=t[e];return a?a.length:0},clearSelection:function(){this.content.add(this.datesHeader).find(".k-state-selected").removeAttr("id").removeClass("k-state-selected")},_updateDirection:function(e,t,a,r,i){var s=e.isAllDay;var n=t[0].start;var o=t[t.length-1].end;if(a)if(i){if(!s&&n.index===o.index&&n.collectionIndex===o.collectionIndex)e.backward=r}else if(s&&n.index===o.index||!s&&n.collectionIndex===o.collectionIndex)e.backward=r},_changeViewPeriod:function(e,t,u){if(!u){var a=t?this.previousDate():this.nextDate();var h=e.start;var r=e.end;var c=this._isGroupedByDate()&&this._isVerticallyGrouped();var i=this.groups[e.groupIndex];var s=t?i._timeSlotCollections:i._getCollections(i.daySlotCollectionCount());var n=s[s.length-1]._slots;var f=!t&&!i.daySlotCollectionCount()?0:n.length-1;var o;var l,d;l=new Date(a);d=new Date(a);if(this._isInRange(l,d))return false;e.start=l;e.end=d;if(c){var v=new Date(n[f].startDate());var p=new Date(n[f].endDate());o=x(p)?x(p):C;D(e.start,x(v));D(e.end,o);if(i.daySlotCollectionCount())e.isAllDay=!e.isAllDay}else{o=e.isAllDay||!x(r)?C:x(r);D(e.start,x(h));D(e.end,o)}if(!this._isVerticallyGrouped())e.groupIndex=t?this.groups.length-1:0;e.events=[];return true}}});return w(true,t,{MultiDayView:h,DayView:h.extend({options:{name:"DayView",title:"Day",selectedMobileDateFormat:"{0:MMM d}"},name:"day"}),WeekView:h.extend({options:{name:"WeekView",title:"Week",selectedDateFormat:"{0:D} - {1:D}",selectedShortDateFormat:"{0:d} - {1:d}"},name:"week",calculateDateRange:function(){var e=this.options.date,t=S.date.dayOfWeek(e,this.calendarInfo().firstDay,-1),a,r,i=[];for(a=0,r=7;a<r;a++){i.push(t);t=S.date.nextDay(t)}this._render(i)}}),WorkWeekView:h.extend({options:{name:"WorkWeekView",title:"Work Week",selectedDateFormat:"{0:D} - {1:D}",selectedShortDateFormat:"{0:d} - {1:d}"},name:"workWeek",nextDate:function(){var e=S.date.dayOfWeek(S.date.nextDay(this.startDate()),this.calendarInfo().firstDay,1);return S.date.addDays(e,this._workDays[0])},previousDate:function(){var e=S.date.dayOfWeek(this.startDate(),this.calendarInfo().firstDay,-1);var t=this._workDays;return S.date.addDays(e,t[t.length-1]-7)},calculateDateRange:function(){var e=this.options,t=e.date,a=S.date.dayOfWeek,r=a(t,this.calendarInfo().firstDay,-1),i=a(r,e.workWeekStart,1),s=a(i,e.workWeekEnd,1),n=[],o=e.workDays&&e.workDays.length?e.workDays.map(function(e){return a(r,e,1).getTime()}):null;if(o){i=r;s=a(i,this.calendarInfo().firstDay+6,1)}while(i<=s){if(o&&o.indexOf(i.getTime())>-1)n.push(i);else if(!o)n.push(i);i=S.date.nextDay(i)}this._render(n)}})}),window.kendo})?r.apply(t,a):r)||(e.exports=t)}});