/*! FullCalendar Resource Timeline Plugin v4.1.0 Docs & License: https://fullcalendar.io/scheduler (c) 2019 Adam Shaw */ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@fullcalendar/core"),require("@fullcalendar/timeline"),require("@fullcalendar/resource-common")):"function"==typeof define&&define.amd?define(["exports","@fullcalendar/core","@fullcalendar/timeline","@fullcalendar/resource-common"],t):(e=e||self,t(e.FullCalendarResourceTimeline={},e.FullCalendar,e.FullCalendarTimeline,e.FullCalendarResourceCommon))}(this,function(e,t,r,o){"use strict";function i(e,t){function r(){this.constructor=e}h(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function s(e,t){var r=e.classList;t?(r.remove("fc-icon-plus-square"),r.add("fc-icon-minus-square")):(r.remove("fc-icon-minus-square"),r.add("fc-icon-plus-square"))}function n(e){var t=e.classList;t.remove("fc-icon-minus-square"),t.remove("fc-icon-plus-square")}function l(e,t){e.setAttribute("data-resource-id",t)}function a(e){for(var t="",r=0;r';return t+=''}function c(e){for(var t in e){var r=e[t];if(r.businessHours)return!0}return!1}function d(e){for(var t=0,r=e;t'+(r?t.htmlEscape(r):" ")+""),i=e.spec.render;return"function"==typeof i&&(o=i(o,e.value)||o),o},r.prototype.renderCellText=function(e){var t=e.value||"",r=e.spec.text;return"function"==typeof r&&(t=r(t)||t),t},r.prototype.getHeightEls=function(){return[this.spreadsheetHeightEl,this.timeAxisHeightEl]},r.prototype.updateExpanderIcon=function(e){s(this.expanderIconEl,e)},r}(f);m.addEqualityFuncs({group:o.isGroupsEqual});var g=function(e){function r(r,o){var i=e.call(this,r)||this;return i._renderRow=t.memoizeRendering(i.renderRow,i.unrenderRow),i._updateTrResourceId=t.memoizeRendering(l,null,[i._renderRow]),i._updateExpanderIcon=t.memoizeRendering(i.updateExpanderIcon,null,[i._renderRow]),i.onExpanderClick=function(e){var t=i.props;i.calendar.dispatch({type:"SET_RESOURCE_ENTITY_EXPANDED",id:t.id,isExpanded:!t.isExpanded})},i.tr=o,i}return i(r,e),r.prototype.render=function(e){this._renderRow(e.resource,e.rowSpans,e.depth,e.colSpecs),this._updateTrResourceId(this.tr,e.resource.id),this._updateExpanderIcon(e.hasChildren,e.isExpanded)},r.prototype.destroy=function(){e.prototype.destroy.call(this),this._renderRow.unrender()},r.prototype.renderRow=function(e,r,i,s){for(var n,l=this,c=l.tr,d=l.theme,p=l.calendar,u=l.view,h=o.buildResourceFields(e),y=0;y'+(f.isMain?a(i):"")+''+(g?t.htmlEscape(g):" ")+"");"function"==typeof f.render&&(v=f.render(new o.ResourceApi(p,e),v)||v),m>1&&v.classList.add("fc-sticky");var S=t.createElement("td",{className:d.getClass("widgetContent"),rowspan:m},v);f.isMain&&(S.appendChild(this.heightEl=t.createElement("div",null,S.childNodes)),n=S),c.appendChild(S)}}this.expanderIconEl=c.querySelector(".fc-expander-space .fc-icon"),u.publiclyTrigger("resourceRender",[{resource:new o.ResourceApi(p,e),el:n,view:u}])},r.prototype.unrenderRow=function(){this.tr.innerHTML=""},r.prototype.updateExpanderIcon=function(e,t){var r=this.expanderIconEl,o=r.parentElement;r&&o&&(e?(o.addEventListener("click",this.onExpanderClick),o.classList.add("fc-expander"),s(r,t)):(o.removeEventListener("click",this.onExpanderClick),o.classList.remove("fc-expander"),n(r)))},r}(t.Component),v=function(e){function o(o,i,s,n,a,c){var d=e.call(this,o,i,s,n,a)||this;return d._updateTrResourceId=t.memoizeRendering(l),d.spreadsheetRow=new g(o,d.spreadsheetTr),d.timeAxisTr.appendChild(t.createElement("td",{className:d.theme.getClass("widgetContent")},d.innerContainerEl=document.createElement("div"))),d.lane=new r.TimelineLane(o,d.innerContainerEl,d.innerContainerEl,c),d}return i(o,e),o.prototype.destroy=function(){this.spreadsheetRow.destroy(),this.lane.destroy(),e.prototype.destroy.call(this)},o.prototype.render=function(e){this.spreadsheetRow.receiveProps({colSpecs:e.colSpecs,id:e.id,rowSpans:e.rowSpans,depth:e.depth,isExpanded:e.isExpanded,hasChildren:e.hasChildren,resource:e.resource}),this._updateTrResourceId(this.timeAxisTr,e.resource.id),this.lane.receiveProps({dateProfile:e.dateProfile,nextDayThreshold:e.nextDayThreshold,businessHours:e.businessHours,eventStore:e.eventStore,eventUiBases:e.eventUiBases,dateSelection:e.dateSelection,eventSelection:e.eventSelection,eventDrag:e.eventDrag,eventResize:e.eventResize}),this.isSizeDirty=!0},o.prototype.updateSize=function(t){e.prototype.updateSize.call(this,t),this.lane.updateSize(t)},o.prototype.getHeightEls=function(){return[this.spreadsheetRow.heightEl,this.innerContainerEl]},o}(f);v.addEqualityFuncs({rowSpans:t.isArraysEqual});var S=30,x=function(e){function r(r,o){var i=e.call(this,r)||this;return i.resizables=[],i.colWidths=[],i.emitter=new t.EmitterMixin,o.appendChild(i.tableEl=t.createElement("table",{className:i.theme.getClass("tableGrid")})),i}return i(r,e),r.prototype.destroy=function(){for(var r=0,o=this.resizables;r"+e.colTags+"";e.superHeaderText&&(i+='
'+t.htmlEscape(e.superHeaderText)+"
"),i+="";for(var s=0;s
'+(n.isMain?'':"")+''+t.htmlEscape(n.labelText||"")+"
"+(l?"":'
')+"
"}i+="",i+="",this.tableEl.innerHTML=i,this.thEls=Array.prototype.slice.call(this.tableEl.querySelectorAll("th")),this.colEls=Array.prototype.slice.call(this.tableEl.querySelectorAll("col")),this.resizerEls=Array.prototype.slice.call(this.tableEl.querySelectorAll(".fc-col-resizer")),this.initColResizing()},r.prototype.initColResizing=function(){var e=this,t=this.calendar.pluginSystem.hooks.elementDraggingImpl;t&&(this.resizables=this.resizerEls.map(function(r,o){var i,s=new t(r);return s.emitter.on("dragstart",function(){i=e.colWidths[o],"number"!=typeof i&&(i=e.thEls[o].getBoundingClientRect().width)}),s.emitter.on("dragmove",function(t){e.colWidths[o]=Math.max(i+t.deltaX*(e.isRtl?-1:1),S),e.emitter.trigger("colwidthchange",e.colWidths)}),s.setAutoScrollEnabled(!1),s}))},r}(t.Component),E=function(e){function o(o,i,s){var n=e.call(this,o)||this;n._renderCells=t.memoizeRendering(n.renderCells,n.unrenderCells),n.layout=new r.HeaderBodyLayout(i,s,"clipped-scroll");var l=n.layout.headerScroller.enhancedScroll,a=n.layout.bodyScroller.enhancedScroll;return n.header=new x(o,l.canvas.contentEl),n.header.emitter.on("colwidthchange",function(e){n.applyColWidths(e)}),a.canvas.contentEl.appendChild(n.bodyContainerEl=t.createElement("div",{className:"fc-rows"},"
")),n.bodyColGroup=n.bodyContainerEl.querySelector("colgroup"),n.bodyTbody=n.bodyContainerEl.querySelector("tbody"),n}return i(o,e),o.prototype.destroy=function(){this.header.destroy(),this.layout.destroy(),this._renderCells.unrender(),e.prototype.destroy.call(this)},o.prototype.render=function(e){this._renderCells(e.superHeaderText,e.colSpecs)},o.prototype.renderCells=function(e,t){var r=this.renderColTags(t);this.header.receiveProps({superHeaderText:e,colSpecs:t,colTags:r}),this.bodyColGroup.innerHTML=r,this.bodyColEls=Array.prototype.slice.call(this.bodyColGroup.querySelectorAll("col")),this.applyColWidths(t.map(function(e){return e.width}))},o.prototype.unrenderCells=function(){this.bodyColGroup.innerHTML=""},o.prototype.renderColTags=function(e){for(var t="",r=0,o=e;r':""}return t},o.prototype.updateSize=function(e,t,r){this.layout.setHeight(t,r)},o.prototype.applyColWidths=function(e){var t=this;e.forEach(function(e,r){var o,i=t.header.colEls[r],s=t.bodyColEls[r];"number"==typeof e?o=e+"px":null==typeof e&&(o=""),i.style.width=s.style.width=o})},o}(t.Component),C=30,w=function(e){function s(i,s,n,l){var a=e.call(this,i,s,n,l)||this;a.isStickyScrollDirty=!1,a.rowNodes=[],a.rowComponents=[],a.rowComponentsById={},a.resourceAreaWidthDraggings=[],a.splitter=new o.ResourceSplitter,a.hasResourceBusinessHours=t.memoize(c),a.buildRowNodes=t.memoize(o.buildRowNodes),a.hasNesting=t.memoize(d),a._updateHasNesting=t.memoizeRendering(a.updateHasNesting);var p=a.opt("resourceColumns")||[],u=a.opt("resourceLabelText"),h="Resources",y=null;p.length?y=u:p.push({labelText:u||h,text:o.buildResourceTextFunc(a.opt("resourceText"),a.calendar)});for(var f=[],m=[],g=[],v=!1,S=!1,x=0,C=p;x");return a.timeAxis.layout.bodyScroller.enhancedScroll.canvas.contentEl.appendChild(N),a.timeAxisTbody=N.querySelector("tbody"),a.lane=new r.TimelineLane(a.context,null,a.timeAxis.layout.bodyScroller.enhancedScroll.canvas.bgEl,a.timeAxis),a.bodyScrollJoiner=new r.ScrollJoiner("vertical",[a.spreadsheet.layout.bodyScroller,a.timeAxis.layout.bodyScroller]),a.spreadsheetBodyStickyScroller=new r.StickyScroller(a.spreadsheet.layout.bodyScroller.enhancedScroll,a.isRtl,(!0)),a.spreadsheet.receiveProps({superHeaderText:a.superHeaderText,colSpecs:a.colSpecs}),i.calendar.registerInteractiveComponent(a,{el:a.timeAxis.slats.el}),a}return i(s,e),s.prototype.renderSkeletonHtml=function(){var e=this.theme;return'
'},s.prototype.render=function(t){e.prototype.render.call(this,t);var r=this.splitter.splitProps(t),o=this.hasResourceBusinessHours(t.resourceStore);this.timeAxis.receiveProps({dateProfile:t.dateProfile}),this.lane.receiveProps(y({},r[""],{dateProfile:t.dateProfile,nextDayThreshold:this.nextDayThreshold,businessHours:o?null:t.businessHours}));var i=this.buildRowNodes(t.resourceStore,this.groupSpecs,this.orderSpecs,this.isVGrouping,t.resourceEntityExpansions,this.opt("resourcesInitiallyExpanded"));this._updateHasNesting(this.hasNesting(i)),this.diffRows(i),this.renderRows(t.dateProfile,o?t.businessHours:null,r)},s.prototype.updateHasNesting=function(e){var t=this.el.classList;e?t.remove("fc-flat"):t.add("fc-flat")},s.prototype.diffRows=function(e){var t=this.rowNodes,r=t.length,o={},i=0,s=0;for(i=0;i=i?(this.removeRows(s,l-i,t),i=l+1):this.addRow(s,n)}this.removeRows(s,r-i,t),this.rowNodes=e},s.prototype.addRow=function(e,t){var r=this,o=r.rowComponents,i=r.rowComponentsById,s=o[e],n=this.buildChildComponent(t,this.spreadsheet.bodyTbody,s?s.spreadsheetTr:null,this.timeAxisTbody,s?s.timeAxisTr:null);o.splice(e,0,n),i[t.id]=n},s.prototype.removeRows=function(e,t,r){if(t){for(var o=this,i=o.rowComponents,s=o.rowComponentsById,n=0;nt)&&(t=s)}return t}),h=0;hi){o.rowId=l.id,o.bottom=c-i;break}}return o},s.prototype.applyResourceScroll=function(e){var t=e.forcedRowId||e.rowId;if(t){var r=this.rowComponentsById[t];if(r){var o=r.timeAxisTr;if(o){var i=this.timeAxis.layout.bodyScroller.enhancedScroll.canvas.el.getBoundingClientRect().top,s=o.getBoundingClientRect(),n=(e.forcedRowId?s.top:s.bottom-e.bottom)-i;this.timeAxis.layout.bodyScroller.enhancedScroll.setScrollTop(n),this.spreadsheet.layout.bodyScroller.enhancedScroll.setScrollTop(n)}}}},s.prototype.buildPositionCaches=function(){this.timeAxis.slats.updateSize(),this.rowPositions.build()},s.prototype.queryHit=function(e,t){var r=this.rowPositions,o=this.timeAxis.slats,i=r.topToIndex(t);if(null!=i){var s=this.rowNodes[i].resource;if(s){var n=o.positionToHit(e);if(n)return{component:this,dateSpan:{range:n.dateSpan.range,allDay:n.dateSpan.allDay,resourceId:s.id},rect:{left:n.left,right:n.right,top:r.tops[i],bottom:r.bottoms[i]},dayEl:n.dayEl,layer:0}}}},s.prototype.setResourceAreaWidth=function(e){this.resourceAreaWidth=e,t.applyStyleProp(this.resourceAreaHeadEl,"width",e||"")},s.prototype.initResourceAreaWidthDragging=function(){var e=this,t=Array.prototype.slice.call(this.el.querySelectorAll(".fc-col-resizer")),r=this.calendar.pluginSystem.hooks.elementDraggingImpl;r&&(this.resourceAreaWidthDraggings=t.map(function(t){var o,i,s=new r(t);return s.emitter.on("dragstart",function(){o=e.resourceAreaWidth,"number"!=typeof o&&(o=e.resourceAreaHeadEl.getBoundingClientRect().width),i=e.el.getBoundingClientRect().width}),s.emitter.on("dragmove",function(t){var r=o+t.deltaX*(e.isRtl?-1:1);r=Math.max(r,C),r=Math.min(r,i-C),e.setResourceAreaWidth(r)}),s.setAutoScrollEnabled(!1),s}))},s.needsResourceData=!0,s}(t.View),b=t.createPlugin({deps:[u,p],defaultView:"resourceTimelineDay",views:{resourceTimeline:{"class":w,resourceAreaWidth:"100px",resourcesInitiallyExpanded:!0,eventResizableFromStart:!0},resourceTimelineDay:{type:"resourceTimeline",duration:{days:1}},resourceTimelineWeek:{type:"resourceTimeline",duration:{weeks:1}},resourceTimelineMonth:{type:"resourceTimeline",duration:{months:1}},resourceTimelineYear:{type:"resourceTimeline",duration:{years:1}}}});e.ResourceTimelineView=w,e["default"]=b,Object.defineProperty(e,"__esModule",{value:!0})});