9 lines
27 KiB
JavaScript
9 lines
27 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){function t(e,t){function n(e,o){var r,s;if(o=o[t])for(r=i[e]=i[e]||[],s=0;o.length>s;s++)r.push(o[s]),n(e+1,o[s])}var i=[];return n(0,e),i}function n(){return M.support.cssBorderSpacing?"":'cellspacing="0"'}function i(t,i){return t.length?"<table "+n()+' class="'+e.trim("k-scheduler-table "+(i||""))+'"><tr>'+t.join("</tr><tr>")+"</tr></table>":""}function o(e,t){return e.length?"<div style='position:relative'>"+i(e,t)+"</div>":""}function r(t,n,o){var r,s=[];if(o>0)for(r=0;t>r;r++)s.push("<th> </th>");return n&&s.push('<th class="k-scheduler-times-all-day">'+n.text+"</th>"),1>o?e():e('<div class="k-scheduler-times">'+i(s)+"</div>")}function s(t,n,r){var s,a,l,c,u,d,h,f,p,g,m=[];for(a=0;t.length>a;a++){for(l=t[a],c=[],u=n/l.length,s=0;l.length>s;s++)d=l[s],c.push('<th colspan="'+(d.colspan||u)+'" class="'+(d.className||"")+'">'+d.text+"</th>");m.push(c.join(""))}if(h=[],r){for(f=t[t.length-1],p=[],g=r.cellContent,s=0;f.length>s;s++)p.push('<td class="'+(f[s].className||"")+'">'+(g?g(s):" ")+"</th>");h.push(p.join(""))}return e('<div class="k-scheduler-header k-state-default"><div class="k-scheduler-header-wrap">'+i(m)+o(h,"k-scheduler-header-all-day")+"</div></div>")}function a(t,n){var o,r,s,a,l,c=Array(n).join().split(","),u=[];for(r=0;t.length>r;r++)for(s=t[r],a=n/s.length,o=0;s.length>o;o++)l=s[o].className||"",s[o].allDay&&(l="k-scheduler-times-all-day"),c[a*o]+='<th class="'+l+'" rowspan="'+a+'">'+s[o].text+"</th>";for(o=0;n>o;o++)u.push(c[o]);return 1>n?e():e('<div class="k-scheduler-times">'+i(u)+"</div>")}function l(){return e('<div class="k-scheduler-content"><table '+n()+' class="k-scheduler-table"/></div>')}function c(){return D=D?D:M.support.scrollbar()}function u(e,t,n){var i,o,r,s,a;for(i=e.length-1;i>=0;i--)o=d(e[i]),r=o.start,a=o.end,s=t>=r&&a>=t,(s||r>=t&&n>=a||r>=t&&n>=r)&&(t>r&&(t=r),a>n&&(n=a));return h(e,t,n)}function d(e){return{start:e.start,end:e.end}}function h(e,t,n){var i,o,r=[];for(i=0;e.length>i;i++)o=d(e[i]),(t>o.start&&o.end>t||o.start>=t&&n>=o.end)&&r.push(e[i]);return r}function f(e){return g(e)}function p(e){return g(e)}function g(e){var t,n,i,o,r,s,a,l=[];for(t=0;e.length>t;t++){for(n=e[t],i=d(n),o=null,r=0,s=l.length;s>r;r++)if(a=i.start>l[r].end,l[r].start>i.start||a){o=l[r],i.end>o.end&&(o.end=i.end);break}o||(o={start:i.start,end:i.end,events:[]},l.push(o)),o.events.push(n)}return l}function m(e,t,n,i){var o,r,s,a,l=t[0];if(l){for(o=[],r=l.dataSource.view(),s=0;r.length>s;s++)a={text:i({text:M.htmlEncode(M.getter(l.dataTextField)(r[s])),color:M.getter(l.dataColorField)(r[s]),field:l.field,title:l.title,name:l.name,value:M.getter(l.dataValueField)(r[s])}),className:"k-slot-cell"},a[e]=m(e,t.slice(1),n,i),o.push(a);return o}return n}function v(t){return function(n){if(e.isArray(n)||n instanceof M.data.ObservableArray){for(var i=0;n.length>i;i++)if(n[i]==t)return!0;return!1}return n==t}}function _(e){e.className=e.className.replace(E,"")+" k-state-selected"}var w,y,b,x,k,C,S,T,D,A,E,M=window.kendo,P=M.ui,I=P.Widget,R=M.keys,z=".kendoSchedulerView",B=Math,L='<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>';M.ui.scheduler={},w=M.Class.extend({init:function(e,t){this._index=e,this._timeSlotCollections=[],this._daySlotCollections=[],this._isRtl=t},addTimeSlotCollection:function(e,t){return this._addCollection(e,t,this._timeSlotCollections)},addDaySlotCollection:function(e,t){return this._addCollection(e,t,this._daySlotCollections)},_addCollection:function(e,t,n){var i=new k(e,t,this._index,n.length);return n.push(i),i},timeSlotCollectionCount:function(){return this._timeSlotCollections.length},daySlotCollectionCount:function(){return this._daySlotCollections.length},daySlotByPosition:function(e,t){return this._slotByPosition(e,t,this._daySlotCollections)},timeSlotByPosition:function(e,t){return this._slotByPosition(e,t,this._timeSlotCollections)},_slotByPosition:function(e,t,n){var i,o,r,s,a,l,c,u,d;for(i=0;n.length>i;i++)for(o=n[i],r=0;r<o.count();r++)if(s=o.at(r),a=s.offsetWidth,l=s.offsetHeight,c=s.offsetLeft+a,u=s.offsetTop+l,d=o.at(r+1),d&&(d.offsetLeft!=s.offsetLeft?c=this._isRtl?s.offsetLeft+(s.offsetLeft-d.offsetLeft):d.offsetLeft:u=d.offsetTop),e>=s.offsetLeft&&c>e&&t>=s.offsetTop&&u>t)return s},refresh:function(){var e;for(e=0;this._daySlotCollections.length>e;e++)this._daySlotCollections[e].refresh();for(e=0;this._timeSlotCollections.length>e;e++)this._timeSlotCollections[e].refresh()},timeSlotRanges:function(e,t){var n,i=this._timeSlotCollections,o=this._startSlot(e,i);return!o.inRange&&e>=o.slot.end&&(o=null),n=o,t>e&&(n=this._endSlot(t,i)),n&&!n.inRange&&n.slot.start>=t&&(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(b,i,o,n))},daySlotRanges:function(e,t,n){var i,o=this._daySlotCollections,r=this._startSlot(e,o,n);if(!r.inRange&&e>=r.slot.end&&(r=null),i=r,t>e&&(i=this._endSlot(t,o,n)),i&&!i.inRange&&i.slot.start>=t&&(i=null),null===r&&null===i)return[];if(null===r)do e+=M.date.MS_PER_DAY,r=this._startSlot(e,o,n);while(!r.inRange&&e>=r.slot.end);if(null===i)do t-=M.date.MS_PER_DAY,i=this._endSlot(t,o,n);while(!i.inRange&&i.slot.start>=t);return this._continuousRange(x,o,r,i)},_continuousRange:function(e,t,n,i){var o,r,s,a,l,c,u=n.slot,d=i.slot,h=u.collectionIndex,f=d.collectionIndex,p=[];for(o=h;f>=o;o++)r=t[o],s=r.first(),a=r.last(),l=!1,c=!1,o==h&&(c=!n.inRange),o==f&&(l=!i.inRange),u.start>s.start&&(s=u),a.start>d.start&&(a=d),f>h&&(o==h?l=!0:o==f?c=!0:l=c=!0),p.push(new e({start:s,end:a,collection:r,head:l,tail:c}));return p},slotRanges:function(e,t){var n=e._startTime||M.date.toUtcTime(e.start),i=e._endTime||M.date.toUtcTime(e.end);return void 0===t&&(t=e.isMultiDay()),t?this.daySlotRanges(n,i,e.isAllDay):this.timeSlotRanges(n,i)},ranges:function(e,t,n,i){return"number"!=typeof e&&(e=M.date.toUtcTime(e)),"number"!=typeof t&&(t=M.date.toUtcTime(t)),n?this.daySlotRanges(e,t,i):this.timeSlotRanges(e,t)},_startCollection:function(e,t){var n,i;for(n=0;t.length>n;n++)if(i=t[n],i.startInRange(e))return i;return null},_endCollection:function(e,t,n){var i,o;for(i=0;t.length>i;i++)if(o=t[i],o.endInRange(e,n))return o;return null},_getCollections:function(e){return e?this._daySlotCollections:this._timeSlotCollections},continuousSlot:function(e,t){var n=t?-1:1,i=this._getCollections(e.isDaySlot),o=i[e.collectionIndex+n];return o?o[t?"last":"first"]():void 0},firstSlot:function(){var e=this._getCollections(this.daySlotCollectionCount());return e[0].first()},lastSlot:function(){var e=this._getCollections(this.daySlotCollectionCount());return e[e.length-1].last()},upSlot:function(e,t){var n=this,i=function(e,i,o){var r=0===o;return!t&&!e&&r&&n.daySlotCollectionCount()?n._daySlotCollections[0].at(i):void 0};return this.timeSlotCollectionCount()||(t=!0),this._verticalSlot(e,-1,i)},downSlot:function(e,t){var n=this,i=function(e,i,o){return!t&&e&&n.timeSlotCollectionCount()?n._timeSlotCollections[o].at(0):void 0};return this.timeSlotCollectionCount()||(t=!0),this._verticalSlot(e,1,i)},leftSlot:function(e){return this._horizontalSlot(e,-1)},rightSlot:function(e){return this._horizontalSlot(e,1)},_horizontalSlot:function(e,t){var n,i=e.index,o=e.isDaySlot,r=e.collectionIndex,s=this._getCollections(o);return o?i+=t:r+=t,n=s[r],n?n.at(i):void 0},_verticalSlot:function(e,t,n){var i,o=e.index,r=e.isDaySlot,s=e.collectionIndex,a=this._getCollections(r);return(e=n(r,s,o))?e:(r?s+=t:o+=t,i=a[s],i?i.at(o):void 0)},_collection:function(e,t){var n=t?this._daySlotCollections:this._timeSlotCollections;return n[e]},_startSlot:function(e,t,n){var i,o=this._startCollection(e,t),r=!0;return o||(o=t[0],r=!1),i=o.slotByStartDate(e,n),i||(i=o.first(),r=!1),{slot:i,inRange:r}},_endSlot:function(e,t,n){var i,o=this._endCollection(e,t,n),r=!0;return o||(o=t[t.length-1],r=!1),i=o.slotByEndDate(e,n),i||(i=o.last(),r=!1),{slot:i,inRange:r}},getSlotCollection:function(e,t){return this[t?"getDaySlotCollection":"getTimeSlotCollection"](e)},getTimeSlotCollection:function(e){return this._timeSlotCollections[e]},getDaySlotCollection:function(e){return this._daySlotCollections[e]}}),y=M.Class.extend({init:function(t){e.extend(this,t)},innerHeight:function(){var e,t=this.collection,n=this.start.index,i=this.end.index,o=0;for(e=n;i>=e;e++)o+=t.at(e).offsetHeight;return o},events:function(){return this.collection.events()},addEvent:function(e){this.events().push(e)},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}}),b=y.extend({innerHeight:function(){var e,t=this.collection,n=this.start.index,i=this.end.index,o=0;for(e=n;i>=e;e++)o+=t.at(e).offsetHeight;return o},outerRect:function(e,t,n){return this._rect("offset",e,t,n)},_rect:function(e,t,n,i){var o,r,s,a,l,c,u,d,h=this.start,f=this.end,p=M.support.isRtl(h.element);return"number"!=typeof t&&(t=M.date.toUtcTime(t)),"number"!=typeof n&&(n=M.date.toUtcTime(n)),i?(o=h.offsetTop,r=f.offsetTop+f[e+"Height"],p?(s=f.offsetLeft,a=h.offsetLeft+h[e+"Width"]):(s=h.offsetLeft,a=f.offsetLeft+f[e+"Width"])):(l=t-h.start,0>l&&(l=0),c=h.end-h.start,o=h.offsetTop+h[e+"Height"]*l/c,u=f.end-n,0>u&&(u=0),d=f.end-f.start,r=f.offsetTop+f[e+"Height"]-f[e+"Height"]*u/d,p?(s=Math.round(f.offsetLeft+f[e+"Width"]*u/d),a=Math.round(h.offsetLeft+h[e+"Width"]-h[e+"Width"]*l/c)):(s=Math.round(h.offsetLeft+h[e+"Width"]*l/c),a=Math.round(f.offsetLeft+f[e+"Width"]-f[e+"Width"]*u/d))),{top:o,bottom:r,left:0===s?s:s+1,right:a}},innerRect:function(e,t,n){return this._rect("client",e,t,n)}}),x=y.extend({innerWidth:function(){var e,t=this.collection,n=this.start.index,i=this.end.index,o=0,r=n!==i?"offsetWidth":"clientWidth";for(e=n;i>=e;e++)o+=t.at(e)[r];return o}}),k=M.Class.extend({init:function(e,t,n,i){this._slots=[],this._events=[],this._start=M.date.toUtcTime(e),this._end=M.date.toUtcTime(t),this._groupIndex=n,this._collectionIndex=i},refresh:function(){for(var e=0;this._slots.length>e;e++)this._slots[e].refresh()},startInRange:function(e){return e>=this._start&&this._end>e},endInRange:function(e,t){var n=t?this._end>e:this._end>=e;return e>=this._start&&n},slotByStartDate:function(e){var t,n,i=e;for("number"!=typeof i&&(i=M.date.toUtcTime(e)),t=0;this._slots.length>t;t++)if(n=this._slots[t],n.startInRange(i))return n;return null},slotByEndDate:function(e,t){var n,i,o=e;if("number"!=typeof o&&(o=M.date.toUtcTime(e)),t)return this.slotByStartDate(e,!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(e,t,n,i){var o=new S(e,t,n,this._groupIndex,this._collectionIndex,this._slots.length,i);this._slots.push(o)},addDaySlot:function(e,t,n,i){var o=new T(e,t,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(e){return this._slots[e]}}),C=M.Class.extend({init:function(e,t,n,i,o,r){this.element=e,this.clientWidth=e.clientWidth,this.clientHeight=e.clientHeight,this.offsetWidth=e.offsetWidth,this.offsetHeight=e.offsetHeight,this.offsetTop=e.offsetTop,this.offsetLeft=e.offsetLeft,this.start=t,this.end=n,this.element=e,this.groupIndex=i,this.collectionIndex=o,this.index=r,this.isDaySlot=!1},startDate:function(){return M.timezone.toLocalDate(this.start)},endDate:function(){return M.timezone.toLocalDate(this.end)},startInRange:function(e){return e>=this.start&&this.end>e},endInRange:function(e){return e>this.start&&this.end>=e},startOffset:function(){return this.start},endOffset:function(){return this.end}}),S=C.extend({init:function(e,t,n,i,o,r,s){C.fn.init.apply(this,arguments),this.isHorizontal=s?!0:!1},refresh:function(){var e=this.element;this.clientWidth=e.clientWidth,this.clientHeight=e.clientHeight,this.offsetWidth=e.offsetWidth,this.offsetHeight=e.offsetHeight,this.offsetTop=e.offsetTop,this.offsetLeft=e.offsetLeft},offsetX:function(e,t){return e?this.offsetLeft+t:this.offsetLeft+t},startInRange:function(e){return e>=this.start&&this.end>e},endInRange:function(e){return e>this.start&&this.end>=e},startOffset:function(t,n,i){var o,r,s,a,l;if(i)return this.start;if(o=e(this.element).offset(),r=this.end-this.start,this.isHorizontal){if(l=M.support.isRtl(this.element),s=t-o.left,a=Math.floor(r*(s/this.offsetWidth)),l)return this.start+r-a}else s=n-o.top,a=Math.floor(r*(s/this.offsetHeight));return this.start+a},endOffset:function(t,n,i){var o,r,s,a,l;if(i)return this.end;if(o=e(this.element).offset(),r=this.end-this.start,this.isHorizontal){if(l=M.support.isRtl(this.element),s=t-o.left,a=Math.floor(r*(s/this.offsetWidth)),l)return this.start+r-a}else s=n-o.top,a=Math.floor(r*(s/this.offsetHeight));return this.start+a}}),T=C.extend({init:function(e,t,n,i,o,r,s){C.fn.init.apply(this,arguments),this.eventCount=s,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 e=new Date(this.start);return M.timezone.apply(e,"Etc/UTC")},endDate:function(){var e=new Date(this.end);return M.timezone.apply(e,"Etc/UTC")},startInRange:function(e){return e>=this.start&&this.end>e},endInRange:function(e){return e>this.start&&this.end>=e}}),M.ui.SchedulerView=I.extend({init:function(t,n){I.fn.init.call(this,t,n),this._scrollbar=c(),this._isRtl=M.support.isRtl(t),this._resizeHint=e(),this._moveHint=e(),this._cellId=M.guid(),this._resourcesForGroups(),this._selectedSlots=[]},_isMobile:function(){var e=this.options;return e.mobile===!0&&M.support.mobileOS||"phone"===e.mobile||"tablet"===e.mobile},_isMobilePhoneView:function(){var e=this.options;return e.mobile===!0&&M.support.mobileOS&&!M.support.mobileOS.tablet||"phone"===e.mobile},_addResourceView:function(){var e=new w(this.groups.length,this._isRtl);return this.groups.push(e),e},dateForTitle:function(){return M.format(this.options.selectedDateFormat,this.startDate(),this.endDate())},shortDateForTitle:function(){return M.format(this.options.selectedShortDateFormat,this.startDate(),this.endDate())},_changeGroup:function(e,t){var n=t?"prevGroupSlot":"nextGroupSlot",i=this[n](e.start,e.groupIndex,e.isAllDay);return i&&(e.groupIndex+=t?-1:1),i},_changeGroupContinuously:function(){return null},_changeViewPeriod:function(){return!1},_horizontalSlots:function(e,t,n,i){var o,r,s=i?"leftSlot":"rightSlot",a=t[0].start,l=t[t.length-1].end,c=this.groups[e.groupIndex];return n||(o=this._normalizeHorizontalSelection(e,t,i),o&&(a=l=o)),a=c[s](a),l=c[s](l),n||this._isVerticallyGrouped()||a&&l||(a=l=this._changeGroup(e,i)),a&&l||(r=this._continuousSlot(e,t,i),r=this._changeGroupContinuously(e,r,n,i),r&&(a=l=r)),{startSlot:a,endSlot:l}},_verticalSlots:function(e,t,n,i){var o,r,s=t[0].start,a=t[t.length-1].end,l=this.groups[e.groupIndex];return n||(o=this._normalizeVerticalSelection(e,t,i),o&&(s=a=o)),r=i?"upSlot":"downSlot",s=l[r](s,n),a=l[r](a,n),n||!this._isVerticallyGrouped()||s&&a||(s=a=this._changeGroup(e,i)),{startSlot:s,endSlot:a}},_normalizeHorizontalSelection:function(){return null},_normalizeVerticalSelection:function(e,t,n){var i;return i=n?t[0].start:t[t.length-1].end},_continuousSlot:function(){return null},constrainSelection:function(e){var t,n=this.groups[0];this.inRange(e)?n.daySlotCollectionCount()||(e.isAllDay=!1):(t=n.firstSlot(),e.isAllDay=t.isDaySlot,e.start=t.startDate(),e.end=t.endDate()),this.groups[e.groupIndex]||(e.groupIndex=0)},move:function(e,t,n){var i,o,r,s,a,l,c=!1,u=this.groups[e.groupIndex];if(u.timeSlotCollectionCount()||(e.isAllDay=!0),i=u.ranges(e.start,e.end,e.isAllDay,!1),t===R.DOWN||t===R.UP){if(c=!0,s=t===R.UP,this._updateDirection(e,i,n,s,!0),a=this._verticalSlots(e,i,n,s),!a.startSlot&&!n&&this._changeViewPeriod(e,s,!0))return c}else if((t===R.LEFT||t===R.RIGHT)&&(c=!0,s=t===R.LEFT,this._updateDirection(e,i,n,s,!1),a=this._horizontalSlots(e,i,n,s),!a.startSlot&&!n&&this._changeViewPeriod(e,s,!1)))return c;return c&&(o=a.startSlot,r=a.endSlot,n?(l=e.backward,l&&o?e.start=o.startDate():!l&&r&&(e.end=r.endDate())):o&&r&&(e.isAllDay=o.isDaySlot,e.start=o.startDate(),e.end=r.endDate()),e.events=[]),c},moveToEventInGroup:function(t,n,i,o){for(var r,s,a=t._continuousEvents||[],l=o?-1:1,c=a.length,u=o?c-1:0;c>u&&u>-1;){if(s=a[u],(!o&&s.start.startDate()>=n.startDate()||o&&s.start.startDate()<=n.startDate())&&(i.length&&(s=a[u+l]),s&&-1===e.inArray(s.uid,i))){r=!!s;break}u+=l}return s},moveToEvent:function(e,t){for(var n,i=e.groupIndex,o=this.groups[i],r=o.ranges(e.start,e.end,e.isAllDay,!1)[0].start,s=this.groups.length,a=t?-1:1,l=e.events;s>i&&i>-1&&(n=this.moveToEventInGroup(o,r,l,t),i+=a,o=this.groups[i],o&&!n);)l=[],r=t?o.lastSlot():o.firstSlot(!0);return n&&(e.events=[n.uid],e.start=n.start.startDate(),e.end=n.end.endDate(),e.isAllDay=n.start.isDaySlot,e.groupIndex=n.start.groupIndex),!!n},current:function(e){return void 0===e?this._current:(this._current=e,void(this.content.has(e)&&this._scrollTo(e,this.content[0])))},select:function(e){this.clearSelection(),this._selectEvents(e)||this._selectSlots(e)},_selectSlots:function(e){var t,n,i,o,r,s,a,l=e.isAllDay,c=this.groups[e.groupIndex];for(c.timeSlotCollectionCount()||(l=!0),this._selectedSlots=[],t=c.ranges(e.start,e.end,l,!1),o=0;t.length>o;o++)for(r=t[o],s=r.collection,a=r.start.index;r.end.index>=a;a++)i=s.at(a),n=i.element,n.setAttribute("aria-selected",!0),_(n),this._selectedSlots.push({start:i.startDate(),end:i.endDate(),element:n});e.backward&&(n=t[0].start.element),this.current(n)},_selectEvents:function(t){var n,i,o=!1,r=t.events,s=this.groups[t.groupIndex]._continuousEvents||[],a=s.length;if(!r[0]||!s[0])return o;for(i=e(),t.events=[],n=0;a>n;n++)e.inArray(s[n].uid,r)>-1&&(i=i.add(s[n].element),t.events.push(s[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(e){var t=this.startDate(),n=M.date.addDays(this.endDate(),1),i=e.start,o=e.end;return i>=t&&n>i&&o>t&&n>=o},_resourceValue:function(e,t){return e.valuePrimitive&&(t=M.getter(e.dataValueField)(t)),t},_resourceBySlot:function(e){var t,n,i,o,r,s=this.groupedResources,a={};if(s.length)for(t=e.groupIndex,n=s.length-1;n>=0;n--)i=s[n],o=this._resourceValue(i,i.dataSource.view()[t%i.dataSource.total()]),i.multiple&&(o=[o]),r=M.setter(i.field),r(a,o),t=Math.floor(t/i.dataSource.total());return a},_createResizeHint:function(t,n,i,o){return e(L).css({left:t,top:n,width:i,height:o})},_removeResizeHint:function(){this._resizeHint.remove(),this._resizeHint=e()},_removeMoveHint:function(){this._moveHint.remove(),this._moveHint=e()},_scrollTo:function(e,t){var n=e.offsetTop,i=e.offsetHeight,o=t.scrollTop,r=t.clientHeight,s=n+i,a=0;a=o>n?n:s>o+r?r>=i?s-r:n:o,t.scrollTop=a},_shouldInverseResourceColor:function(e){var t=new A(e.color).isDark(),n=this.element.css("color"),i=new A(n).isDark();return t==i},_eventTmpl:function(t,n){var i,o=this.options,r=e.extend({},M.Template,o.templateSettings),s=r.paramName,a="",l=typeof t,c={storage:{},count:0};return"function"===l?(c.storage["tmpl"+c.count]=t,a+="#=this.tmpl"+c.count+"("+s+")#",c.count++):"string"===l&&(a+=t),i=M.template(M.format(n,a),r),c.count>0&&(i=e.proxy(i,c.storage)),i},eventResources:function(e){var t,n,i,o,r,s,a,l,c,u,d=[],h=this.options;if(!h.resources)return d;for(t=0;h.resources.length>t;t++)if(n=h.resources[t],i=n.field,o=M.getter(i)(e),null!=o)for(n.multiple||(o=[o]),r=n.dataSource.view(),s=0;o.length>s;s++){for(a=null,l=o[s],n.valuePrimitive||(l=M.getter(n.dataValueField)(l)),c=0;r.length>c;c++)if(r[c].get(n.dataValueField)==l){a=r[c];break}null!==a&&(u=M.getter(n.dataColorField)(a),d.push({field:n.field,title:n.title,name:n.name,text:M.getter(n.dataTextField)(a),value:l,color:u}))}return d},createLayout:function(i){var o,r,s,a,l,c=-1;for(i.rows||(i.rows=[]),o=0;i.rows.length>o;o++)if(i.rows[o].allDay){c=o;break}r=i.rows[c],c>=0&&i.rows.splice(c,1),s=this.columnLevels=t(i,"columns"),a=this.rowLevels=t(i,"rows"),this.table=e("<table "+n()+' class="k-scheduler-layout k-scheduler-'+this.name+'view"/>'),l=a[a.length-1].length,this.table.append(this._topSection(s,r,l)),this.table.append(this._bottomSection(s,a,l)),this.element.append(this.table),this._scroller()},refreshLayout:function(){var t,n,i,o,r,s,a=this,l=a.element.find(">.k-scheduler-toolbar"),c=a.element.innerHeight(),u=this._scrollbar,d=0,h=this._isRtl?"left":"right";for(t=0;l.length>t;t++)c-=l.eq(t).outerHeight();a.datesHeader&&(d=a.datesHeader.outerHeight()),a.timesHeader&&a.timesHeader.outerHeight()>d&&(d=a.timesHeader.outerHeight()),a.datesHeader&&a.timesHeader&&(n=a.datesHeader.find("table:first tr"),a.timesHeader.find("tr").height(function(t){e(this).height(n.eq(t).height())})),d&&(c-=d),a.footer&&(c-=a.footer.outerHeight()),i=function(e){var t,n;return e[0].style.height?!0:(t=e.height(),e.height("auto"),n=e.height(),t!=n?(e.height(""),!0):(e.height(""),!1))},o=a.content[0],r=M.support.kineticScrollNeeded?0:u,i(a.element)&&(a.content.height(c>2*u?c:2*u+1),a.times.height(o.clientHeight),s=a.times.find("table"),s.length&&s.height(a.content.find("table")[0].clientHeight)),o.offsetWidth-o.clientWidth>0?(a.table.addClass("k-scrollbar-v"),a.datesHeader.css("padding-"+h,r-parseInt(a.datesHeader.children().css("border-"+h+"-width"),10))):a.datesHeader.css("padding-"+h,""),o.offsetHeight-o.clientHeight>0||o.clientHeight>a.content.children(".k-scheduler-table").height()?a.table.addClass("k-scrollbar-h"):a.table.removeClass("k-scrollbar-h")},_topSection:function(t,n,i){this.timesHeader=r(t.length,n,i);var o=t[t.length-1].length;return this.datesHeader=s(t,o,n),e("<tr>").append(this.timesHeader.add(this.datesHeader).wrap("<td>").parent())},_bottomSection:function(t,n,i){return this.times=a(n,i),this.content=l(t[t.length-1],n[n.length-1]),e("<tr>").append(this.times.add(this.content).wrap("<td>").parent())},_scroller:function(){var t,n=this;this.content.bind("scroll"+z,function(){n.datesHeader.find(">.k-scheduler-header-wrap").scrollLeft(this.scrollLeft),n.times.scrollTop(this.scrollTop)}),t=M.touchScroller(this.content,{avoidScrolling:function(t){return e(t.event.target).closest(".k-event.k-event-active").length>0}}),t&&t.movable&&(this._touchScroller=t,this.content=t.scrollElement,t.movable.bind("change",function(e){n.datesHeader.find(">.k-scheduler-header-wrap").scrollLeft(-e.sender.x),n.times.scrollTop(-e.sender.y)}))},_resourcesForGroups:function(){var e,t,n,i,o=[],r=this.options.group,s=this.options.resources;if(r=r&&r.resources?r.resources:[],s&&r.length)for(e=0,t=s.length;t>e;e++)for(n=0,i=r.length;i>n;n++)s[e].name===r[n]&&o.push(s[e]);this.groupedResources=o},_createColumnsLayout:function(e,t,n){return m("columns",e,t,n)},_groupOrientation:function(){var e=this.options.group;return e&&e.resources?e.orientation:"horizontal"},_isVerticallyGrouped:function(){return this.groupedResources.length&&"vertical"===this._groupOrientation()},_createRowsLayout:function(e,t,n){return m("rows",e,t,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 e=this;I.fn.destroy.call(this),e.table&&(M.destroy(e.table),e.table.remove()),e.groups=null,e.table=null,e.content=null,e.times=null,e.datesHeader=null,e.timesHeader=null,e.footer=null,e._resizeHint=null,e._moveHint=null},calendarInfo:function(){return M.getCulture().calendars.standard},prevGroupSlot:function(e,t,n){var i,o=this.groups[t],r=o.ranges(e,e,n,!1)[0].start;if(!(0>=t))return this._isVerticallyGrouped()?o.timeSlotCollectionCount()?(i=o._collection(n?r.index:r.collectionIndex,!1),i.last()):(i=o._collection(o.daySlotCollectionCount()-1,!0),i.at(r.index)):o.timeSlotCollectionCount()?(i=o._collection(n?0:o.timeSlotCollectionCount()-1,n),n?i.last():i.at(r.index)):(i=o._collection(r.collectionIndex,!0),i.last())},nextGroupSlot:function(e,t,n){var i,o,r=this.groups[t],s=r.ranges(e,e,n,!1)[0].start;if(!(t>=this.groups.length-1))return this._isVerticallyGrouped()?r.timeSlotCollectionCount()?(o=r.daySlotCollectionCount(),i=r._collection(o?0:s.collectionIndex,o),n?i.first():i.at(s.collectionIndex)):(i=r._collection(0,!0),i.at(s.index)):r.timeSlotCollectionCount()?(i=r._collection(0,n),n?i.first():i.at(s.index)):(i=r._collection(s.collectionIndex,!0),i.first())},_eventOptionsForMove:function(){return{}},_updateEventForResize:function(){},_updateEventForSelection:function(e){return e}}),A=function(e){var t,n,i,o,r,s=this,a=A.formats;if(1===arguments.length)for(e=s.resolveColor(e),o=0;a.length>o;o++)t=a[o].re,n=a[o].process,i=t.exec(e),i&&(r=n(i),s.r=r[0],s.g=r[1],s.b=r[2]);else s.r=arguments[0],s.g=arguments[1],s.b=arguments[2];s.r=s.normalizeByte(s.r),s.g=s.normalizeByte(s.g),s.b=s.normalizeByte(s.b)},A.prototype={resolveColor:function(e){return e=e||"#000","#"==e.charAt(0)&&(e=e.substr(1,6)),e=e.replace(/ /g,""),e=e.toLowerCase(),e=A.namedColors[e]||e},normalizeByte:function(e){return 0>e||isNaN(e)?0:e>255?255:e},percBrightness:function(){var e=this;return B.sqrt(.241*e.r*e.r+.691*e.g*e.g+.068*e.b*e.b)},isDark:function(){var e=this,t=e.percBrightness();return 180>t}},A.formats=[{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,process:function(e){return[parseInt(e[1],10),parseInt(e[2],10),parseInt(e[3],10)]}},{re:/^(\w{2})(\w{2})(\w{2})$/,process:function(e){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,process:function(e){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}}],A.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"},E=/\s*k-state-selected/,e.extend(P.SchedulerView,{createColumns:f,createRows:p,rangeIndex:d,collidingEvents:u,groupEqFilter:v})}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(e,t){t()}); |