kendo.scheduler.view.min.js
31 KB
/**
* Kendo UI v2016.1.112 (http://www.telerik.com/kendo-ui)
* Copyright 2016 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(t,define){define("kendo.scheduler.view.min",["kendo.core.min"],t)}(function(){return function(t){function e(t,e){function n(t,o){var s,r;if(o=o[e])for(s=i[t]=i[t]||[],r=0;o.length>r;r++)s.push(o[r]),n(t+1,o[r])}var i=[];return n(0,t),i}function n(){return T.support.cssBorderSpacing?"":'cellspacing="0"'}function i(e,i){return e.length?"<table "+n()+' class="'+t.trim("k-scheduler-table "+(i||""))+'"><tr>'+e.join("</tr><tr>")+"</tr></table>":""}function o(t,e){return t.length?"<div style='position:relative'>"+i(t,e)+"</div>":""}function s(e,n,o){var s,r=[];if(o>0)for(s=0;e>s;s++)r.push("<th> </th>");return n&&r.push('<th class="k-scheduler-times-all-day">'+n.text+"</th>"),1>o?t():t('<div class="k-scheduler-times">'+i(r)+"</div>")}function r(e,n,s){var r,l,a,u,h,c,f,d,g,p,m=[];for(l=0;e.length>l;l++){for(a=e[l],u=[],h=n/a.length,r=0;a.length>r;r++)c=a[r],u.push('<th colspan="'+(c.colspan||h)+'" class="'+(c.className||"")+'">'+c.text+"</th>");m.push(u.join(""))}if(f=[],s){for(d=e[e.length-1],g=[],p=s.cellContent,r=0;d.length>r;r++)g.push('<td class="'+(d[r].className||"")+'">'+(p?p(r):" ")+"</th>");f.push(g.join(""))}return t('<div class="k-scheduler-header k-state-default"><div class="k-scheduler-header-wrap">'+i(m)+o(f,"k-scheduler-header-all-day")+"</div></div>")}function l(e,n){var o,s,r,l,a,u=Array(n).join().split(","),h=[];for(s=0;e.length>s;s++)for(r=e[s],l=n/r.length,o=0;r.length>o;o++)a=r[o].className||"",r[o].allDay&&(a="k-scheduler-times-all-day"),u[l*o]+='<th class="'+a+'" rowspan="'+l+'">'+r[o].text+"</th>";for(o=0;n>o;o++)h.push(u[o]);return 1>n?t():t('<div class="k-scheduler-times">'+i(h)+"</div>")}function a(){return t('<div class="k-scheduler-content"><table '+n()+' class="k-scheduler-table"/></div>')}function u(){return k=k?k:T.support.scrollbar()}function h(t,e,n){var i,o,s,r,l;for(i=t.length-1;i>=0;i--)o=c(t[i]),s=o.start,l=o.end,r=e>=s&&l>=e,(r||s>=e&&n>=l||s>=e&&n>=s)&&(e>s&&(e=s),l>n&&(n=l));return f(t,e,n)}function c(t){return{start:t.start,end:t.end}}function f(t,e,n){var i,o,s=[];for(i=0;t.length>i;i++)o=c(t[i]),(e>o.start&&o.end>e||o.start>=e&&n>=o.end)&&s.push(t[i]);return s}function d(t){return p(t)}function g(t){return p(t)}function p(t){var e,n,i,o,s,r,l,a=[];for(e=0;t.length>e;e++){for(n=t[e],i=c(n),o=null,s=0,r=a.length;r>s;s++)if(l=i.start>a[s].end,a[s].start>i.start||l){o=a[s],i.end>o.end&&(o.end=i.end);break}o||(o={start:i.start,end:i.end,events:[]},a.push(o)),o.events.push(n)}return a}function m(t,e,n,i){var o,s,r,l,a=e[0];if(a){for(o=[],s=a.dataSource.view(),r=0;s.length>r;r++)l={text:i({text:T.htmlEncode(T.getter(a.dataTextField)(s[r])),color:T.getter(a.dataColorField)(s[r]),field:a.field,title:a.title,name:a.name,value:T.getter(a.dataValueField)(s[r])}),className:"k-slot-cell"},l[t]=m(t,e.slice(1),n,i),o.push(l);return o}return n}function v(e){return function(n){if(t.isArray(n)||n instanceof T.data.ObservableArray){for(var i=0;n.length>i;i++)if(n[i]==e)return!0;return!1}return n==e}}function _(t){t.className=t.className.replace(R,"")+" k-state-selected"}var S,y,C,b,x,H,D,w,k,I,R,T=window.kendo,L=T.ui,z=L.Widget,W=T.keys,E=".kendoSchedulerView",V=Math,A='<div class="k-marquee k-scheduler-marquee"><div class="k-marquee-color"></div><div class="k-marquee-text"><div class="k-label-top"></div><div class="k-label-bottom"></div></div></div>';T.ui.scheduler={},S=T.Class.extend({init:function(t,e){this._index=t,this._timeSlotCollections=[],this._daySlotCollections=[],this._isRtl=e},addTimeSlotCollection:function(t,e){return this._addCollection(t,e,this._timeSlotCollections)},addDaySlotCollection:function(t,e){return this._addCollection(t,e,this._daySlotCollections)},_addCollection:function(t,e,n){var i=new x(t,e,this._index,n.length);return n.push(i),i},timeSlotCollectionCount:function(){return this._timeSlotCollections.length},daySlotCollectionCount:function(){return this._daySlotCollections.length},daySlotByPosition:function(t,e){return this._slotByPosition(t,e,this._daySlotCollections)},timeSlotByPosition:function(t,e){return this._slotByPosition(t,e,this._timeSlotCollections)},_slotByPosition:function(t,e,n){var i,o,s,r,l,a,u,h,c;for(i=0;n.length>i;i++)for(o=n[i],s=0;s<o.count();s++)if(r=o.at(s),l=r.offsetWidth,a=r.offsetHeight,u=r.offsetLeft+l,h=r.offsetTop+a,c=o.at(s+1),c&&(c.offsetLeft!=r.offsetLeft?u=this._isRtl?r.offsetLeft+(r.offsetLeft-c.offsetLeft):c.offsetLeft:h=c.offsetTop),t>=r.offsetLeft&&u>t&&e>=r.offsetTop&&h>e)return r},refresh:function(){var t;for(t=0;this._daySlotCollections.length>t;t++)this._daySlotCollections[t].refresh();for(t=0;this._timeSlotCollections.length>t;t++)this._timeSlotCollections[t].refresh()},timeSlotRanges:function(t,e){var n,i=this._timeSlotCollections,o=this._startSlot(t,i);return!o.inRange&&t>=o.slot.end&&(o=null),n=o,e>t&&(n=this._endSlot(e,i)),n&&!n.inRange&&n.slot.start>=e&&(n=null),null===o&&null===n?[]:(null===o&&(o={inRange:!0,slot:i[n.slot.collectionIndex].first()}),null===n&&(n={inRange:!0,slot:i[o.slot.collectionIndex].last()}),this._continuousRange(C,i,o,n))},daySlotRanges:function(t,e,n){var i,o=this._daySlotCollections,s=this._startSlot(t,o,n);if(!s.inRange&&t>=s.slot.end&&(s=null),i=s,e>t&&(i=this._endSlot(e,o,n)),i&&!i.inRange&&i.slot.start>=e&&(i=null),null===s&&null===i)return[];if(null===s)do t+=T.date.MS_PER_DAY,s=this._startSlot(t,o,n);while(!s.inRange&&t>=s.slot.end);if(null===i)do e-=T.date.MS_PER_DAY,i=this._endSlot(e,o,n);while(!i.inRange&&i.slot.start>=e);return this._continuousRange(b,o,s,i)},_continuousRange:function(t,e,n,i){var o,s,r,l,a,u,h=n.slot,c=i.slot,f=h.collectionIndex,d=c.collectionIndex,g=[];for(o=f;d>=o;o++)s=e[o],r=s.first(),l=s.last(),a=!1,u=!1,o==f&&(u=!n.inRange),o==d&&(a=!i.inRange),h.start>r.start&&(r=h),l.start>c.start&&(l=c),d>f&&(o==f?a=!0:o==d?u=!0:a=u=!0),g.push(new t({start:r,end:l,collection:s,head:a,tail:u}));return g},slotRanges:function(t,e){var n=t._startTime||T.date.toUtcTime(t.start),i=t._endTime||T.date.toUtcTime(t.end);return void 0===e&&(e=t.isMultiDay()),e?this.daySlotRanges(n,i,t.isAllDay):this.timeSlotRanges(n,i)},ranges:function(t,e,n,i){return"number"!=typeof t&&(t=T.date.toUtcTime(t)),"number"!=typeof e&&(e=T.date.toUtcTime(e)),n?this.daySlotRanges(t,e,i):this.timeSlotRanges(t,e)},_startCollection:function(t,e){var n,i;for(n=0;e.length>n;n++)if(i=e[n],i.startInRange(t))return i;return null},_endCollection:function(t,e,n){var i,o;for(i=0;e.length>i;i++)if(o=e[i],o.endInRange(t,n))return o;return null},_getCollections:function(t){return t?this._daySlotCollections:this._timeSlotCollections},continuousSlot:function(t,e){var n=e?-1:1,i=this._getCollections(t.isDaySlot),o=i[t.collectionIndex+n];return o?o[e?"last":"first"]():void 0},firstSlot:function(){var t=this._getCollections(this.daySlotCollectionCount());return t[0].first()},lastSlot:function(){var t=this._getCollections(this.daySlotCollectionCount());return t[t.length-1].last()},upSlot:function(t,e){var n=this,i=function(t,i,o){var s=0===o;return!e&&!t&&s&&n.daySlotCollectionCount()?n._daySlotCollections[0].at(i):void 0};return this.timeSlotCollectionCount()||(e=!0),this._verticalSlot(t,-1,i)},downSlot:function(t,e){var n=this,i=function(t,i,o){return!e&&t&&n.timeSlotCollectionCount()?n._timeSlotCollections[o].at(0):void 0};return this.timeSlotCollectionCount()||(e=!0),this._verticalSlot(t,1,i)},leftSlot:function(t){return this._horizontalSlot(t,-1)},rightSlot:function(t){return this._horizontalSlot(t,1)},_horizontalSlot:function(t,e){var n,i=t.index,o=t.isDaySlot,s=t.collectionIndex,r=this._getCollections(o);return o?i+=e:s+=e,n=r[s],n?n.at(i):void 0},_verticalSlot:function(t,e,n){var i,o=t.index,s=t.isDaySlot,r=t.collectionIndex,l=this._getCollections(s);return(t=n(s,r,o))?t:(s?r+=e:o+=e,i=l[r],i?i.at(o):void 0)},_collection:function(t,e){var n=e?this._daySlotCollections:this._timeSlotCollections;return n[t]},_startSlot:function(t,e,n){var i,o=this._startCollection(t,e),s=!0;return o||(o=e[0],s=!1),i=o.slotByStartDate(t,n),i||(i=o.first(),s=!1),{slot:i,inRange:s}},_endSlot:function(t,e,n){var i,o=this._endCollection(t,e,n),s=!0;return o||(o=e[e.length-1],s=!1),i=o.slotByEndDate(t,n),i||(i=o.last(),s=!1),{slot:i,inRange:s}},getSlotCollection:function(t,e){return this[e?"getDaySlotCollection":"getTimeSlotCollection"](t)},getTimeSlotCollection:function(t){return this._timeSlotCollections[t]},getDaySlotCollection:function(t){return this._daySlotCollections[t]}}),y=T.Class.extend({init:function(e){t.extend(this,e)},innerHeight:function(){var t,e=this.collection,n=this.start.index,i=this.end.index,o=0;for(t=n;i>=t;t++)o+=e.at(t).offsetHeight;return o},events:function(){return this.collection.events()},addEvent:function(t){this.events().push(t)},startSlot:function(){return this.start.offsetLeft>this.end.offsetLeft?this.end:this.start},endSlot:function(){return this.start.offsetLeft>this.end.offsetLeft?this.start:this.end}}),C=y.extend({innerHeight:function(){var t,e=this.collection,n=this.start.index,i=this.end.index,o=0;for(t=n;i>=t;t++)o+=e.at(t).offsetHeight;return o},outerRect:function(t,e,n){return this._rect("offset",t,e,n)},_rect:function(t,e,n,i){var o,s,r,l,a,u,h,c,f=this.start,d=this.end,g=T.support.isRtl(f.element);return"number"!=typeof e&&(e=T.date.toUtcTime(e)),"number"!=typeof n&&(n=T.date.toUtcTime(n)),i?(o=f.offsetTop,s=d.offsetTop+d[t+"Height"],g?(r=d.offsetLeft,l=f.offsetLeft+f[t+"Width"]):(r=f.offsetLeft,l=d.offsetLeft+d[t+"Width"])):(a=e-f.start,0>a&&(a=0),u=f.end-f.start,o=f.offsetTop+f[t+"Height"]*a/u,h=d.end-n,0>h&&(h=0),c=d.end-d.start,s=d.offsetTop+d[t+"Height"]-d[t+"Height"]*h/c,g?(r=Math.round(d.offsetLeft+d[t+"Width"]*h/c),l=Math.round(f.offsetLeft+f[t+"Width"]-f[t+"Width"]*a/u)):(r=Math.round(f.offsetLeft+f[t+"Width"]*a/u),l=Math.round(d.offsetLeft+d[t+"Width"]-d[t+"Width"]*h/c))),{top:o,bottom:s,left:0===r?r:r+1,right:l}},innerRect:function(t,e,n){return this._rect("client",t,e,n)}}),b=y.extend({innerWidth:function(){var t,e=this.collection,n=this.start.index,i=this.end.index,o=0,s=n!==i?"offsetWidth":"clientWidth";for(t=n;i>=t;t++)o+=e.at(t)[s];return o}}),x=T.Class.extend({init:function(t,e,n,i){this._slots=[],this._events=[],this._start=T.date.toUtcTime(t),this._end=T.date.toUtcTime(e),this._groupIndex=n,this._collectionIndex=i},refresh:function(){for(var t=0;this._slots.length>t;t++)this._slots[t].refresh()},startInRange:function(t){return t>=this._start&&this._end>t},endInRange:function(t,e){var n=e?this._end>t:this._end>=t;return t>=this._start&&n},slotByStartDate:function(t){var e,n,i=t;for("number"!=typeof i&&(i=T.date.toUtcTime(t)),e=0;this._slots.length>e;e++)if(n=this._slots[e],n.startInRange(i))return n;return null},slotByEndDate:function(t,e){var n,i,o=t;if("number"!=typeof o&&(o=T.date.toUtcTime(t)),e)return this.slotByStartDate(t,!1);for(n=0;this._slots.length>n;n++)if(i=this._slots[n],i.endInRange(o))return i;return null},count:function(){return this._slots.length},events:function(){return this._events},addTimeSlot:function(t,e,n,i){var o=new D(t,e,n,this._groupIndex,this._collectionIndex,this._slots.length,i);this._slots.push(o)},addDaySlot:function(t,e,n,i){var o=new w(t,e,n,this._groupIndex,this._collectionIndex,this._slots.length,i);this._slots.push(o)},first:function(){return this._slots[0]},last:function(){return this._slots[this._slots.length-1]},at:function(t){return this._slots[t]}}),H=T.Class.extend({init:function(t,e,n,i,o,s){this.element=t,this.clientWidth=t.clientWidth,this.clientHeight=t.clientHeight,this.offsetWidth=t.offsetWidth,this.offsetHeight=t.offsetHeight,this.offsetTop=t.offsetTop,this.offsetLeft=t.offsetLeft,this.start=e,this.end=n,this.element=t,this.groupIndex=i,this.collectionIndex=o,this.index=s,this.isDaySlot=!1},startDate:function(){return T.timezone.toLocalDate(this.start)},endDate:function(){return T.timezone.toLocalDate(this.end)},startInRange:function(t){return t>=this.start&&this.end>t},endInRange:function(t){return t>this.start&&this.end>=t},startOffset:function(){return this.start},endOffset:function(){return this.end}}),D=H.extend({init:function(t,e,n,i,o,s,r){H.fn.init.apply(this,arguments),this.isHorizontal=r?!0:!1},refresh:function(){var t=this.element;this.clientWidth=t.clientWidth,this.clientHeight=t.clientHeight,this.offsetWidth=t.offsetWidth,this.offsetHeight=t.offsetHeight,this.offsetTop=t.offsetTop,this.offsetLeft=t.offsetLeft},offsetX:function(t,e){return t?this.offsetLeft+e:this.offsetLeft+e},startInRange:function(t){return t>=this.start&&this.end>t},endInRange:function(t){return t>this.start&&this.end>=t},startOffset:function(e,n,i){var o,s,r,l,a;if(i)return this.start;if(o=t(this.element).offset(),s=this.end-this.start,this.isHorizontal){if(a=T.support.isRtl(this.element),r=e-o.left,l=Math.floor(s*(r/this.offsetWidth)),a)return this.start+s-l}else r=n-o.top,l=Math.floor(s*(r/this.offsetHeight));return this.start+l},endOffset:function(e,n,i){var o,s,r,l,a;if(i)return this.end;if(o=t(this.element).offset(),s=this.end-this.start,this.isHorizontal){if(a=T.support.isRtl(this.element),r=e-o.left,l=Math.floor(s*(r/this.offsetWidth)),a)return this.start+s-l}else r=n-o.top,l=Math.floor(s*(r/this.offsetHeight));return this.start+l}}),w=H.extend({init:function(t,e,n,i,o,s,r){H.fn.init.apply(this,arguments),this.eventCount=r,this.isDaySlot=!0,this.element.children.length?(this.firstChildHeight=this.element.children[0].offsetHeight+3,this.firstChildTop=this.element.children[0].offsetTop):(this.firstChildHeight=3,this.firstChildTop=0)},refresh:function(){this.clientHeight=this.element.clientHeight,this.offsetTop=this.element.offsetTop},startDate:function(){var t=new Date(this.start);return T.timezone.apply(t,"Etc/UTC")},endDate:function(){var t=new Date(this.end);return T.timezone.apply(t,"Etc/UTC")},startInRange:function(t){return t>=this.start&&this.end>t},endInRange:function(t){return t>this.start&&this.end>=t}}),T.ui.SchedulerView=z.extend({init:function(e,n){z.fn.init.call(this,e,n),this._scrollbar=u(),this._isRtl=T.support.isRtl(e),this._resizeHint=t(),this._moveHint=t(),this._cellId=T.guid(),this._resourcesForGroups(),this._selectedSlots=[]},_isMobile:function(){var t=this.options;return t.mobile===!0&&T.support.mobileOS||"phone"===t.mobile||"tablet"===t.mobile},_isMobilePhoneView:function(){var t=this.options;return t.mobile===!0&&T.support.mobileOS&&!T.support.mobileOS.tablet||"phone"===t.mobile},_addResourceView:function(){var t=new S(this.groups.length,this._isRtl);return this.groups.push(t),t},dateForTitle:function(){return T.format(this.options.selectedDateFormat,this.startDate(),this.endDate())},shortDateForTitle:function(){return T.format(this.options.selectedShortDateFormat,this.startDate(),this.endDate())},_changeGroup:function(t,e){var n=e?"prevGroupSlot":"nextGroupSlot",i=this[n](t.start,t.groupIndex,t.isAllDay);return i&&(t.groupIndex+=e?-1:1),i},_changeGroupContinuously:function(){return null},_changeViewPeriod:function(){return!1},_horizontalSlots:function(t,e,n,i){var o,s,r=i?"leftSlot":"rightSlot",l=e[0].start,a=e[e.length-1].end,u=this.groups[t.groupIndex];return n||(o=this._normalizeHorizontalSelection(t,e,i),o&&(l=a=o)),l=u[r](l),a=u[r](a),n||this._isVerticallyGrouped()||l&&a||(l=a=this._changeGroup(t,i)),l&&a||(s=this._continuousSlot(t,e,i),s=this._changeGroupContinuously(t,s,n,i),s&&(l=a=s)),{startSlot:l,endSlot:a}},_verticalSlots:function(t,e,n,i){var o,s,r=e[0].start,l=e[e.length-1].end,a=this.groups[t.groupIndex];return n||(o=this._normalizeVerticalSelection(t,e,i),o&&(r=l=o)),s=i?"upSlot":"downSlot",r=a[s](r,n),l=a[s](l,n),n||!this._isVerticallyGrouped()||r&&l||(r=l=this._changeGroup(t,i)),{startSlot:r,endSlot:l}},_normalizeHorizontalSelection:function(){return null},_normalizeVerticalSelection:function(t,e,n){var i;return i=n?e[0].start:e[e.length-1].end},_continuousSlot:function(){return null},constrainSelection:function(t){var e,n=this.groups[0];this.inRange(t)?n.daySlotCollectionCount()||(t.isAllDay=!1):(e=n.firstSlot(),t.isAllDay=e.isDaySlot,t.start=e.startDate(),t.end=e.endDate()),this.groups[t.groupIndex]||(t.groupIndex=0)},move:function(t,e,n){var i,o,s,r,l,a,u=!1,h=this.groups[t.groupIndex];if(h.timeSlotCollectionCount()||(t.isAllDay=!0),i=h.ranges(t.start,t.end,t.isAllDay,!1),e===W.DOWN||e===W.UP){if(u=!0,r=e===W.UP,this._updateDirection(t,i,n,r,!0),l=this._verticalSlots(t,i,n,r),!l.startSlot&&!n&&this._changeViewPeriod(t,r,!0))return u}else if((e===W.LEFT||e===W.RIGHT)&&(u=!0,r=e===W.LEFT,this._updateDirection(t,i,n,r,!1),l=this._horizontalSlots(t,i,n,r),!l.startSlot&&!n&&this._changeViewPeriod(t,r,!1)))return u;return u&&(o=l.startSlot,s=l.endSlot,n?(a=t.backward,a&&o?t.start=o.startDate():!a&&s&&(t.end=s.endDate())):o&&s&&(t.isAllDay=o.isDaySlot,t.start=o.startDate(),t.end=s.endDate()),t.events=[]),u},moveToEventInGroup:function(e,n,i,o){for(var s,r,l=e._continuousEvents||[],a=o?-1:1,u=l.length,h=o?u-1:0;u>h&&h>-1;){if(r=l[h],(!o&&r.start.startDate()>=n.startDate()||o&&r.start.startDate()<=n.startDate())&&(i.length&&(r=l[h+a]),r&&-1===t.inArray(r.uid,i))){s=!!r;break}h+=a}return r},moveToEvent:function(t,e){for(var n,i=t.groupIndex,o=this.groups[i],s=o.ranges(t.start,t.end,t.isAllDay,!1)[0].start,r=this.groups.length,l=e?-1:1,a=t.events;r>i&&i>-1&&(n=this.moveToEventInGroup(o,s,a,e),i+=l,o=this.groups[i],o&&!n);)a=[],s=e?o.lastSlot():o.firstSlot(!0);return n&&(t.events=[n.uid],t.start=n.start.startDate(),t.end=n.end.endDate(),t.isAllDay=n.start.isDaySlot,t.groupIndex=n.start.groupIndex),!!n},current:function(t){return void 0===t?this._current:(this._current=t,void(this.content.has(t)&&this._scrollTo(t,this.content[0])))},select:function(t){this.clearSelection(),this._selectEvents(t)||this._selectSlots(t)},_selectSlots:function(t){var e,n,i,o,s,r,l,a=t.isAllDay,u=this.groups[t.groupIndex];for(u.timeSlotCollectionCount()||(a=!0),this._selectedSlots=[],e=u.ranges(t.start,t.end,a,!1),o=0;e.length>o;o++)for(s=e[o],r=s.collection,l=s.start.index;s.end.index>=l;l++)i=r.at(l),n=i.element,n.setAttribute("aria-selected",!0),_(n),this._selectedSlots.push({start:i.startDate(),end:i.endDate(),element:n});t.backward&&(n=e[0].start.element),this.current(n)},_selectEvents:function(e){var n,i,o=!1,s=e.events,r=this.groups[e.groupIndex]._continuousEvents||[],l=r.length;if(!s[0]||!r[0])return o;for(i=t(),e.events=[],n=0;l>n;n++)t.inArray(r[n].uid,s)>-1&&(i=i.add(r[n].element),e.events.push(r[n].uid));return i[0]&&(i.addClass("k-state-selected").attr("aria-selected",!0),this.current(i.last()[0]),this._selectedSlots=[],o=!0),o},inRange:function(t){var e=this.startDate(),n=T.date.addDays(this.endDate(),1),i=t.start,o=t.end;return i>=e&&n>i&&o>e&&n>=o},_resourceValue:function(t,e){return t.valuePrimitive&&(e=T.getter(t.dataValueField)(e)),e},_resourceBySlot:function(t){var e,n,i,o,s,r=this.groupedResources,l={};if(r.length)for(e=t.groupIndex,n=r.length-1;n>=0;n--)i=r[n],o=this._resourceValue(i,i.dataSource.view()[e%i.dataSource.total()]),i.multiple&&(o=[o]),s=T.setter(i.field),s(l,o),e=Math.floor(e/i.dataSource.total());return l},_createResizeHint:function(e,n,i,o){return t(A).css({left:e,top:n,width:i,height:o})},_removeResizeHint:function(){this._resizeHint.remove(),this._resizeHint=t()},_removeMoveHint:function(){this._moveHint.remove(),this._moveHint=t()},_scrollTo:function(t,e){var n=t.offsetTop,i=t.offsetHeight,o=e.scrollTop,s=e.clientHeight,r=n+i,l=0;l=o>n?n:r>o+s?s>=i?r-s:n:o,e.scrollTop=l},_shouldInverseResourceColor:function(t){var e=new I(t.color).isDark(),n=this.element.css("color"),i=new I(n).isDark();return e==i},_eventTmpl:function(e,n){var i,o=this.options,s=t.extend({},T.Template,o.templateSettings),r=s.paramName,l="",a=typeof e,u={storage:{},count:0};return"function"===a?(u.storage["tmpl"+u.count]=e,l+="#=this.tmpl"+u.count+"("+r+")#",u.count++):"string"===a&&(l+=e),i=T.template(T.format(n,l),s),u.count>0&&(i=t.proxy(i,u.storage)),i},eventResources:function(t){var e,n,i,o,s,r,l,a,u,h,c=[],f=this.options;if(!f.resources)return c;for(e=0;f.resources.length>e;e++)if(n=f.resources[e],i=n.field,o=T.getter(i)(t),null!=o)for(n.multiple||(o=[o]),s=n.dataSource.view(),r=0;o.length>r;r++){for(l=null,a=o[r],n.valuePrimitive||(a=T.getter(n.dataValueField)(a)),u=0;s.length>u;u++)if(s[u].get(n.dataValueField)==a){l=s[u];break}null!==l&&(h=T.getter(n.dataColorField)(l),c.push({field:n.field,title:n.title,name:n.name,text:T.getter(n.dataTextField)(l),value:a,color:h}))}return c},createLayout:function(i){var o,s,r,l,a,u=-1;for(i.rows||(i.rows=[]),o=0;i.rows.length>o;o++)if(i.rows[o].allDay){u=o;break}s=i.rows[u],u>=0&&i.rows.splice(u,1),r=this.columnLevels=e(i,"columns"),l=this.rowLevels=e(i,"rows"),this.table=t("<table "+n()+' class="k-scheduler-layout k-scheduler-'+this.name+'view"/>'),a=l[l.length-1].length,this.table.append(this._topSection(r,s,a)),this.table.append(this._bottomSection(r,l,a)),this.element.append(this.table),this._scroller()},refreshLayout:function(){var e,n,i,o,s,r,l=this,a=l.element.find(">.k-scheduler-toolbar"),u=l.element.innerHeight(),h=this._scrollbar,c=0,f=this._isRtl?"left":"right";for(e=0;a.length>e;e++)u-=a.eq(e).outerHeight();l.datesHeader&&(c=l.datesHeader.outerHeight()),l.timesHeader&&l.timesHeader.outerHeight()>c&&(c=l.timesHeader.outerHeight()),l.datesHeader&&l.timesHeader&&(n=l.datesHeader.find("table:first tr"),l.timesHeader.find("tr").height(function(e){t(this).height(n.eq(e).height())})),c&&(u-=c),l.footer&&(u-=l.footer.outerHeight()),i=function(t){var e,n;return t[0].style.height?!0:(e=t.height(),t.height("auto"),n=t.height(),e!=n?(t.height(""),!0):(t.height(""),!1))},o=l.content[0],s=T.support.kineticScrollNeeded?0:h,i(l.element)&&(l.content.height(u>2*h?u:2*h+1),l.times.height(o.clientHeight),r=l.times.find("table"),r.length&&r.height(l.content.find("table")[0].clientHeight)),o.offsetWidth-o.clientWidth>0?(l.table.addClass("k-scrollbar-v"),l.datesHeader.css("padding-"+f,s-parseInt(l.datesHeader.children().css("border-"+f+"-width"),10))):l.datesHeader.css("padding-"+f,""),o.offsetHeight-o.clientHeight>0||o.clientHeight>l.content.children(".k-scheduler-table").height()?l.table.addClass("k-scrollbar-h"):l.table.removeClass("k-scrollbar-h")},_topSection:function(e,n,i){this.timesHeader=s(e.length,n,i);var o=e[e.length-1].length;return this.datesHeader=r(e,o,n),t("<tr>").append(this.timesHeader.add(this.datesHeader).wrap("<td>").parent())},_bottomSection:function(e,n,i){return this.times=l(n,i),this.content=a(e[e.length-1],n[n.length-1]),t("<tr>").append(this.times.add(this.content).wrap("<td>").parent())},_scroller:function(){var e,n=this;this.content.bind("scroll"+E,function(){n.datesHeader.find(">.k-scheduler-header-wrap").scrollLeft(this.scrollLeft),n.times.scrollTop(this.scrollTop)}),e=T.touchScroller(this.content,{avoidScrolling:function(e){return t(e.event.target).closest(".k-event.k-event-active").length>0}}),e&&e.movable&&(this._touchScroller=e,this.content=e.scrollElement,e.movable.bind("change",function(t){n.datesHeader.find(">.k-scheduler-header-wrap").scrollLeft(-t.sender.x),n.times.scrollTop(-t.sender.y)}))},_resourcesForGroups:function(){var t,e,n,i,o=[],s=this.options.group,r=this.options.resources;if(s=s&&s.resources?s.resources:[],r&&s.length)for(t=0,e=r.length;e>t;t++)for(n=0,i=s.length;i>n;n++)r[t].name===s[n]&&o.push(r[t]);this.groupedResources=o},_createColumnsLayout:function(t,e,n){return m("columns",t,e,n)},_groupOrientation:function(){var t=this.options.group;return t&&t.resources?t.orientation:"horizontal"},_isVerticallyGrouped:function(){return this.groupedResources.length&&"vertical"===this._groupOrientation()},_createRowsLayout:function(t,e,n){return m("rows",t,e,n)},selectionByElement:function(){return null},clearSelection:function(){this.content.find(".k-state-selected").removeAttr("id").attr("aria-selected",!1).removeClass("k-state-selected")},destroy:function(){var t=this;z.fn.destroy.call(this),t.table&&(T.destroy(t.table),t.table.remove()),t.groups=null,t.table=null,t.content=null,t.times=null,t.datesHeader=null,t.timesHeader=null,t.footer=null,t._resizeHint=null,t._moveHint=null},calendarInfo:function(){return T.getCulture().calendars.standard},prevGroupSlot:function(t,e,n){var i,o=this.groups[e],s=o.ranges(t,t,n,!1)[0].start;if(!(0>=e))return this._isVerticallyGrouped()?o.timeSlotCollectionCount()?(i=o._collection(n?s.index:s.collectionIndex,!1),i.last()):(i=o._collection(o.daySlotCollectionCount()-1,!0),i.at(s.index)):o.timeSlotCollectionCount()?(i=o._collection(n?0:o.timeSlotCollectionCount()-1,n),n?i.last():i.at(s.index)):(i=o._collection(s.collectionIndex,!0),i.last())},nextGroupSlot:function(t,e,n){var i,o,s=this.groups[e],r=s.ranges(t,t,n,!1)[0].start;if(!(e>=this.groups.length-1))return this._isVerticallyGrouped()?s.timeSlotCollectionCount()?(o=s.daySlotCollectionCount(),i=s._collection(o?0:r.collectionIndex,o),n?i.first():i.at(r.collectionIndex)):(i=s._collection(0,!0),i.at(r.index)):s.timeSlotCollectionCount()?(i=s._collection(0,n),n?i.first():i.at(r.index)):(i=s._collection(r.collectionIndex,!0),i.first())},_eventOptionsForMove:function(){return{}},_updateEventForResize:function(){},_updateEventForSelection:function(t){return t}}),I=function(t){var e,n,i,o,s,r=this,l=I.formats;if(1===arguments.length)for(t=r.resolveColor(t),o=0;l.length>o;o++)e=l[o].re,n=l[o].process,i=e.exec(t),i&&(s=n(i),r.r=s[0],r.g=s[1],r.b=s[2]);else r.r=arguments[0],r.g=arguments[1],r.b=arguments[2];r.r=r.normalizeByte(r.r),r.g=r.normalizeByte(r.g),r.b=r.normalizeByte(r.b)},I.prototype={resolveColor:function(t){return t=t||"#000","#"==t.charAt(0)&&(t=t.substr(1,6)),t=t.replace(/ /g,""),t=t.toLowerCase(),t=I.namedColors[t]||t},normalizeByte:function(t){return 0>t||isNaN(t)?0:t>255?255:t},percBrightness:function(){var t=this;return V.sqrt(.241*t.r*t.r+.691*t.g*t.g+.068*t.b*t.b)},isDark:function(){var t=this,e=t.percBrightness();return 180>e}},I.formats=[{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,process:function(t){return[parseInt(t[1],10),parseInt(t[2],10),parseInt(t[3],10)]}},{re:/^(\w{2})(\w{2})(\w{2})$/,process:function(t){return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,process:function(t){return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)]}}],I.namedColors={aqua:"00ffff",azure:"f0ffff",beige:"f5f5dc",black:"000000",blue:"0000ff",brown:"a52a2a",coral:"ff7f50",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgray:"a9a9a9",darkgreen:"006400",darkorange:"ff8c00",darkred:"8b0000",dimgray:"696969",fuchsia:"ff00ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lightblue:"add8e6",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumblue:"0000cd",navy:"000080",olive:"808000",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",pink:"ffc0cb",plum:"dda0dd",purple:"800080",red:"ff0000",royalblue:"4169e1",salmon:"fa8072",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",steelblue:"4682b4",tan:"d2b48c",teal:"008080",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"},R=/\s*k-state-selected/,t.extend(L.SchedulerView,{createColumns:d,createRows:g,rangeIndex:c,collidingEvents:h,groupEqFilter:v})}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(t,e,n){(n||e)()});
//# sourceMappingURL=kendo.scheduler.view.min.js.map