//>>built define("dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/_base/window dojo/_base/event dojo/_base/html dojo/sniff dojo/query dojo/dom dojo/dom-style dojo/dom-class dojo/dom-construct dojo/dom-geometry dojo/on dojo/date dojo/date/locale dojo/when dijit/_WidgetBase dojox/widget/_Invalidating dojox/widget/Selection ./time ./StoreMixin ./StoreManager ./RendererManager".split(" "),function(A,h,p,x,B,J,r,K,L,t,C,D,u,M,v,w,E,F,G,H,q,I,y,z){return A("dojox.calendar.ViewBase",[F,I,G,H],{datePackage:v, _calendar:"gregorian",viewKind:null,_layoutStep:1,_layoutUnit:"day",resizeCursor:"n-resize",formatItemTimeFunc:null,_cssDays:"Sun Mon Tue Wed Thu Fri Sat".split(" "),_getFormatItemTimeFuncAttr:function(){if(this.formatItemTimeFunc)return this.formatItemTimeFunc;if(null!=this.owner)return this.owner.get("formatItemTimeFunc")},_viewHandles:null,doubleTapDelay:300,constructor:function(a){a=a||{};this._calendar=a.datePackage?a.datePackage.substr(a.datePackage.lastIndexOf(".")+1):this._calendar;this.dateModule= a.datePackage?h.getObject(a.datePackage,!1):v;this.dateClassObj=this.dateModule.Date||Date;this.dateLocaleModule=a.datePackage?h.getObject(a.datePackage+".locale",!1):w;this._viewHandles=[];this.storeManager=new y({owner:this,_ownerItemsProperty:"items"});this.storeManager.on("layoutInvalidated",h.hitch(this,this._refreshItemsRendering));this.storeManager.on("dataLoaded",h.hitch(this,function(a){this.set("items",a)}));this.storeManager.on("renderersInvalidated",h.hitch(this,function(a){this.updateRenderers(a)})); this.rendererManager=new z({owner:this});this.rendererManager.on("rendererCreated",h.hitch(this,this._onRendererCreated));this.rendererManager.on("rendererReused",h.hitch(this,this._onRendererReused));this.rendererManager.on("rendererRecycled",h.hitch(this,this._onRendererRecycled));this.rendererManager.on("rendererDestroyed",h.hitch(this,this._onRendererDestroyed));this.decorationStoreManager=new y({owner:this,_ownerItemsProperty:"decorationItems"});this.decorationStoreManager.on("layoutInvalidated", h.hitch(this,this._refreshDecorationItemsRendering));this.decorationStoreManager.on("dataLoaded",h.hitch(this,function(a){this.set("decorationItems",a)}));this.decorationRendererManager=new z({owner:this});this._setupDayRefresh()},destroy:function(a){this.rendererManager.destroy();for(this.decorationRendererManager.destroy();0=d||-1==e.compare(c,b))return 0;var n=function(a){return 3600*a.getHours()+60*a.getMinutes()+a.getSeconds()},k=this.floorToDay(b,!1,a);if(c.getDate()!=k.getDate())if(c.getMonth()==k.getMonth()){if(c.getDate()k.getDate()&&24>g)return d}else if(c.getFullYear()==k.getFullYear()){if(c.getMonth() k.getMonth())return d}else{if(c.getFullYear()k.getFullYear())return d}if(this.isSameDay(b,c)||24e)return d;b=d*(f-a)/(e-a)}else{if(c.getDate()a?a=0:a>c&&(a=c);b?this._scrollPos=a:this._hScrollPos=a;var d=!this.isLeftToRight();if(this._domScroll)b?this.scrollContainer.scrollTop=a:p.forEach(this._hScrollNodes,function(b){t.set(b,"left",(d?1:-1)*a+"px")},this);else{this._cssPrefix||(this._cssPrefix=this.getCSSPrefix());var e=this._cssPrefix+"transform";if(b)t.set(this.sheetContainer,e,"translateY(-"+a+"px)");else{var f="translateX("+ (d?"":"-")+a+"px)";p.forEach(this._hScrollNodes,function(a){t.set(a,e,f)},this)}}}},_setScrollPosition:function(a){this._setScrollPositionBase(a,!0)},_getScrollPosition:function(){return this._scrollPos},_setHScrollPosition:function(a){this._setScrollPositionBase(a,!1)},_setHScrollPositionImpl:function(a,b,c){var d=b?null:"translateX(-"+a+"px)";p.forEach(this._hScrollNodes,function(c){b?(c.scrollLeft=a,t.set(c,"left",-a+"px")):t.set(c,cssProp,d)},this)},_hScrollPos:0,_getHScrollPosition:function(){return this._hScrollPos}, scrollView:function(a){},ensureVisibility:function(a,b,c,d,e){},_getStoreAttr:function(){return this.owner?this.owner.get("store"):this.store},_setItemsAttr:function(a){this._set("items",a);this.displayedItemsInvalidated=!0},_refreshItemsRendering:function(){var a=this.renderData;this._computeVisibleItems(a);this._layoutRenderers(a)},_refreshDecorationItemsRendering:function(){var a=this.renderData;this._computeVisibleItems(a);this._layoutDecorationRenderers(a)},invalidateLayout:function(){this._layoutRenderers(this.renderData); this._layoutDecorationRenderers(this.renderData)},_setDecorationItemsAttr:function(a){this._set("decorationItems",a);this.displayedDecorationItemsInvalidated=!0},_getDecorationStoreAttr:function(){return this.owner?this.owner.get("decorationStore"):this.decorationStore},_setDecorationStoreAttr:function(a){this.decorationStore=a;this.decorationStoreManager.set("store",a)},computeOverlapping:function(a,b){if(0==a.length)return{numLanes:0,addedPassRes:[1]};for(var c=[],d=0;da.maxHours&&(l=b.add(e,"day",-1)),l=this.floorToDay(l,!0,a),l.setHours(a.maxHours-(24>a.maxHours?0:24)));n=p.filter(c,function(b){var c=this.isOverlapping(a,b.startTime,b.endTime,f,l);c?(k[b.id]=!0,g.push(b)):k[b.id]?delete k[b.id]:g.push(b);return c},this);c=g;g=[];0c?(a=a.toGregorian(),a=v.add(a,b,c),new this.renderData.dateClassObj(a)): d.add(a,b,c)},_computeItemEditingTimes:function(a,b,c,d,e){c=this.renderData.dateModule;a=this._edProps;"move"==b&&(b=c.difference(a.editingTimeFrom[0],d[0],"millisecond"),d[0]=this._waDojoxAddIssue(a.editingItemRefTime[0],"millisecond",b));return d},_moveOrResizeItemGesture:function(a,b,c,d){if(this._isEditing&&null!=a[0]){var e=this._edProps,f=e.editedItem,g=this.renderData.dateModule,n=e.editKind,k=[a[0]];"resizeBoth"==n&&(k[1]=a[1]);var k=this._computeItemEditingTimes(f,e.editKind,e.rendererKind, k,b),m=k[0],l=!1;a=h.clone(f.startTime);var q=h.clone(f.endTime),r=f.subColumn,p="keyboard"==e.eventSource?!1:this.allowStartEndSwap;if("move"==n)null!=d&&f.subColumn!=d&&this.allowSubColumnMove&&(f.subColumn=d,l=this.get("store"),k=this.renderItemToItem(f,l),h.mixin(f,this.itemToRenderItem(k,l)),l=!0),0!=g.compare(f.startTime,m)&&(l=g.difference(f.startTime,f.endTime,"millisecond"),f.startTime=this.newDate(m),f.endTime=g.add(f.startTime,"millisecond",l),l=!0);else if("resizeStart"==n)0!=g.compare(f.startTime, m)&&(-1!=g.compare(f.endTime,m)?f.startTime=this.newDate(m):p?(f.startTime=this.newDate(f.endTime),f.endTime=this.newDate(m),e.editKind=n="resizeEnd","touch"==b&&(e.resizeEndTouchIndex=e.resizeStartTouchIndex,e.resizeStartTouchIndex=-1)):(f.startTime=this.newDate(f.endTime),f.startTime.setHours(m.getHours()),f.startTime.setMinutes(m.getMinutes()),f.startTime.setSeconds(m.getSeconds())),l=!0);else if("resizeEnd"==n)0!=g.compare(f.endTime,m)&&(1!=g.compare(f.startTime,m)?f.endTime=this.newDate(m):p? (f.endTime=this.newDate(f.startTime),f.startTime=this.newDate(m),e.editKind=n="resizeStart","touch"==b&&(e.resizeStartTouchIndex=e.resizeEndTouchIndex,e.resizeEndTouchIndex=-1)):(f.endTime=this.newDate(f.startTime),f.endTime.setHours(m.getHours()),f.endTime.setMinutes(m.getMinutes()),f.endTime.setSeconds(m.getSeconds())),l=!0);else if("resizeBoth"==n)l=!0,m=this.newDate(m),k=this.newDate(k[1]),-1!=g.compare(m,k)&&(p?(p=m,m=k,k=p):l=!1),l&&(f.startTime=m,f.endTime=k);else return!1;if(!l)return!1;b= h.mixin(this._createItemEditEvent(),{item:f,storeItem:e.storeItem,startTime:f.startTime,endTime:f.endTime,editKind:n,rendererKind:e.rendererKind,triggerEvent:c,eventSource:b});"move"==n?this._onItemEditMoveGesture(b):this._onItemEditResizeGesture(b);1==g.compare(f.startTime,f.endTime)&&(n=f.startTime,f.startTime=f.endTime,f.endTime=n);l=r!=f.subColumn||0!=g.compare(a,f.startTime)||0!=g.compare(q,f.endTime);if(!l)return!1;this._layoutRenderers(this.renderData);e.liveLayout&&null!=e.secItem?(e.secItem.startTime= f.startTime,e.secItem.endTime=f.endTime,this._secondarySheet._layoutRenderers(this._secondarySheet.renderData)):null!=e.ownerItem&&this.owner.liveLayout&&(e.ownerItem.startTime=f.startTime,e.ownerItem.endTime=f.endTime,this.owner._layoutRenderers(this.owner.renderData));return!0}},_findRenderItem:function(a,b){b=b||this.renderData.items;for(var c=0;c=this._DAY_IN_MILLISECONDS&&!this.allowResizeLessThan24H;this.ensureMinimalDuration(this.renderData,a.item,c?"day":this.minDurationUnit,c?1:this.minDurationSteps,a.editKind); b.inViewOnce||(b.inViewOnce=this._isItemInView(a.item));b.inViewOnce&&this.stayInView&&this._ensureItemInView(a.item)}},onItemEditResizeGesture:function(a){},_endItemEditingGesture:function(a,b){if(this._isEditing){this._editingGesture=!1;var c=this._edProps,d=c.editedItem;c.itemBeginDispatched=!1;this._onItemEditEndGesture(h.mixin(this._createItemEditEvent(),{item:d,storeItem:c.storeItem,startTime:d.startTime,endTime:d.endTime,editKind:c.editKind,rendererKind:c.rendererKind,triggerEvent:b,eventSource:a}))}}, _onItemEditEndGesture:function(a){var b=this._edProps;delete b._itemEditBeginSave;delete b._itemEditEndSave;this._dispatchCalendarEvt(a,"onItemEditEndGesture");!a.isDefaultPrevented()&&b.editLayer&&(r("ie")&&(b.editLayer.style.cursor="default"),setTimeout(h.hitch(this,function(){this.domNode&&(this.domNode.focus(),b.editLayer.parentNode.removeChild(b.editLayer),b.editLayer=null)}),10))},onItemEditEndGesture:function(a){},ensureMinimalDuration:function(a,b,c,d,e){a=a.dateModule;"resizeStart"==e?(c= a.add(b.endTime,c,-d),1==a.compare(b.startTime,c)&&(b.startTime=c)):(c=a.add(b.startTime,c,d),-1==a.compare(b.endTime,c)&&(b.endTime=c))},doubleTapDelay:300,snapUnit:"minute",snapSteps:15,minDurationUnit:"hour",minDurationSteps:1,liveLayout:!1,stayInView:!0,allowStartEndSwap:!0,allowResizeLessThan24H:!1,allowSubColumnMove:!0})});