6 lines
21 KiB
JavaScript
6 lines
21 KiB
JavaScript
/*!
|
|
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<e;r++)t+='<span class="fc-icon"></span>';return t+='<span class="fc-expander-space"><span class="fc-icon"></span></span>'}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.length;t++){var o=r[t];if(o.group)return!0;if(o.resource&&o.hasChildren)return!0}return!1}var p="default"in r?r["default"]:r,u="default"in o?o["default"]:o,h=function(e,t){return(h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},y=function(){return y=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},y.apply(this,arguments)},f=function(e){function r(t,r,o,i,s){var n=e.call(this,t)||this;return n.isSizeDirty=!1,r.insertBefore(n.spreadsheetTr=document.createElement("tr"),o),i.insertBefore(n.timeAxisTr=document.createElement("tr"),s),n}return i(r,e),r.prototype.destroy=function(){t.removeElement(this.spreadsheetTr),t.removeElement(this.timeAxisTr),e.prototype.destroy.call(this)},r.prototype.updateSize=function(e){this.isSizeDirty=!1},r}(t.Component),m=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r._renderCells=t.memoizeRendering(r.renderCells,r.unrenderCells),r._updateExpanderIcon=t.memoizeRendering(r.updateExpanderIcon,null,[r._renderCells]),r.onExpanderClick=function(e){var t=r.props;r.calendar.dispatch({type:"SET_RESOURCE_ENTITY_EXPANDED",id:t.id,isExpanded:!t.isExpanded})},r}return i(r,e),r.prototype.render=function(e){this._renderCells(e.group,e.spreadsheetColCnt),this._updateExpanderIcon(e.isExpanded),this.isSizeDirty=!0},r.prototype.destroy=function(){e.prototype.destroy.call(this),this._renderCells.unrender()},r.prototype.renderCells=function(e,r){var o=this.renderSpreadsheetContent(e);this.spreadsheetTr.appendChild(t.createElement("td",{className:"fc-divider",colSpan:r},this.spreadsheetHeightEl=t.createElement("div",null,o))),this.expanderIconEl=o.querySelector(".fc-icon"),this.expanderIconEl.parentElement.addEventListener("click",this.onExpanderClick),this.timeAxisTr.appendChild(t.createElement("td",{className:"fc-divider"},this.timeAxisHeightEl=document.createElement("div")))},r.prototype.unrenderCells=function(){this.spreadsheetTr.innerHTML="",this.timeAxisTr.innerHTML=""},r.prototype.renderSpreadsheetContent=function(e){var r=this.renderCellText(e),o=t.htmlToElement('<div class="fc-cell-content"><span class="fc-expander"><span class="fc-icon"></span></span><span class="fc-cell-text">'+(r?t.htmlEscape(r):" ")+"</span></div>"),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<s.length;y++){var f=s[y],m=r[y];if(0!==m){null==m&&(m=1);var g=void 0;g=f.field?h[f.field]:o.buildResourceTextFunc(f.text,p)(e);var v=t.htmlToElement('<div class="fc-cell-content">'+(f.isMain?a(i):"")+'<span class="fc-cell-text">'+(g?t.htmlEscape(g):" ")+"</span></div>");"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<o.length;r++){var i=o[r];i.destroy()}t.removeElement(this.tableEl),e.prototype.destroy.call(this)},r.prototype.render=function(e){var r=this.theme,o=e.colSpecs,i="<colgroup>"+e.colTags+"</colgroup><tbody>";e.superHeaderText&&(i+='<tr class="fc-super"><th class="'+r.getClass("widgetHeader")+'" colspan="'+o.length+'"><div class="fc-cell-content"><span class="fc-cell-text">'+t.htmlEscape(e.superHeaderText)+"</span></div></th></tr>"),i+="<tr>";for(var s=0;s<o.length;s++){var n=o[s],l=s===o.length-1;i+='<th class="'+r.getClass("widgetHeader")+'"><div><div class="fc-cell-content">'+(n.isMain?'<span class="fc-expander-space"><span class="fc-icon"></span></span>':"")+'<span class="fc-cell-text">'+t.htmlEscape(n.labelText||"")+"</span></div>"+(l?"":'<div class="fc-col-resizer"></div>')+"</div></th>"}i+="</tr>",i+="</tbody>",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"},"<table><colgroup /><tbody /></table>")),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<o.length;r++){var i=o[r];t+=i.isMain?'<col class="fc-main-col"/>':"<col/>"}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<C.length;x++){var w=C[x];w.group?m.push(w):f.push(w)}if(f[0].isMain=!0,m.length)g=m,v=!0;else{var b=a.opt("resourceGroupField");b&&(S=!0,g.push({field:b,text:a.opt("resourceGroupText"),render:a.opt("resourceGroupRender")}))}for(var T=t.parseFieldSpecs(a.opt("resourceOrder")),R=[],A=0,H=T;A<H.length;A++){for(var z=H[A],I=!1,D=0,_=g;D<_.length;D++){var q=_[D];if(q.field===z.field){q.order=z.order,I=!0;break}}I||R.push(z)}a.superHeaderText=y,a.isVGrouping=v,a.isHGrouping=S,a.groupSpecs=g,a.colSpecs=m.concat(f),a.orderSpecs=R,a.el.classList.add("fc-timeline"),a.opt("eventOverlap")===!1&&a.el.classList.add("fc-no-overlap"),a.el.innerHTML=a.renderSkeletonHtml(),a.resourceAreaHeadEl=a.el.querySelector("thead .fc-resource-area"),a.setResourceAreaWidth(a.opt("resourceAreaWidth")),a.initResourceAreaWidthDragging(),a.miscHeight=a.el.offsetHeight,a.spreadsheet=new E(a.context,a.resourceAreaHeadEl,a.el.querySelector("tbody .fc-resource-area")),a.timeAxis=new r.TimeAxis(a.context,a.el.querySelector("thead .fc-time-area"),a.el.querySelector("tbody .fc-time-area"));var N=t.createElement("div",{className:"fc-rows"},"<table><tbody /></table>");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'<table class="'+e.getClass("tableGrid")+'"> <thead class="fc-head"> <tr> <td class="fc-resource-area '+e.getClass("widgetHeader")+'"></td> <td class="fc-divider fc-col-resizer '+e.getClass("widgetHeader")+'"></td> <td class="fc-time-area '+e.getClass("widgetHeader")+'"></td> </tr> </thead> <tbody class="fc-body"> <tr> <td class="fc-resource-area '+e.getClass("widgetContent")+'"></td> <td class="fc-divider fc-col-resizer '+e.getClass("widgetHeader")+'"></td> <td class="fc-time-area '+e.getClass("widgetContent")+'"></td> </tr> </tbody> </table>'},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<r;i++)o[t[i].id]=i;for(i=0,s=0;s<e.length;s++){var n=e[s],l=o[n.id];null!=l&&l>=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;n<t;n++){var l=i[e+n];l.destroy(),delete s[r[n].id]}i.splice(e,t)}},s.prototype.buildChildComponent=function(e,t,r,o,i){return e.group?new m(this.context,t,r,o,i):e.resource?new v(this.context,t,r,o,i,this.timeAxis):void 0},s.prototype.renderRows=function(e,t,r){for(var o=this,i=o.rowNodes,s=o.rowComponents,n=0;n<i.length;n++){var l=i[n],a=s[n];if(l.group)a.receiveProps({spreadsheetColCnt:this.colSpecs.length,id:l.id,isExpanded:l.isExpanded,group:l.group});else{var c=l.resource;a.receiveProps(y({},r[c.id],{dateProfile:e,nextDayThreshold:this.nextDayThreshold,businessHours:c.businessHours||t,colSpecs:this.colSpecs,id:l.id,rowSpans:l.rowSpans,depth:l.depth,isExpanded:l.isExpanded,hasChildren:l.hasChildren,resource:l.resource}))}}},s.prototype.updateSize=function(e,r,o){var i=this.calendar,s=e||i.isViewUpdated||i.isDatesUpdated||i.isEventsUpdated;s&&(this.syncHeadHeights(),this.timeAxis.updateSize(e,r-this.miscHeight,o),this.spreadsheet.updateSize(e,r-this.miscHeight,o));var n=this.updateRowSizes(e);this.lane.updateSize(e),(s||n)&&(this.bodyScrollJoiner.update(),this.timeAxis.layout.scrollJoiner.update(),this.rowPositions=new t.PositionCache(this.timeAxis.slats.el,this.rowComponents.map(function(e){return e.timeAxisTr}),(!1),(!0)),this.rowPositions.build(),this.isStickyScrollDirty=!0)},s.prototype.syncHeadHeights=function(){var e=this.spreadsheet.header.tableEl,t=this.timeAxis.header.tableEl;e.style.height="",t.style.height="";var r=Math.max(e.offsetHeight,t.offsetHeight);e.style.height=t.style.height=r+"px"},s.prototype.updateRowSizes=function(e){var t=this.rowComponents;e||(t=t.filter(function(e){return e.isSizeDirty}));for(var r=t.map(function(e){return e.getHeightEls()}),o=0,i=r;o<i.length;o++)for(var s=i[o],n=0,l=s;n<l.length;n++){var a=l[n];a.style.height=""}for(var c=0,d=t;c<d.length;c++){var p=d[c];p.updateSize(e)}for(var u=r.map(function(e){for(var t=null,r=0,o=e;r<o.length;r++){var i=o[r],s=i.getBoundingClientRect().height;(null===t||s>t)&&(t=s)}return t}),h=0;h<r.length;h++)for(var y=0,f=r[h];y<f.length;y++){var a=f[y];a.style.height=u[h]+"px"}return t.length},s.prototype.destroy=function(){for(var t=0,r=this.rowComponents;t<r.length;t++){var o=r[t];o.destroy()}this.rowNodes=[],this.rowComponents=[],this.spreadsheet.destroy(),this.timeAxis.destroy();for(var i=0,s=this.resourceAreaWidthDraggings;i<s.length;i++){var n=s[i];n.destroy()}this.spreadsheetBodyStickyScroller.destroy(),e.prototype.destroy.call(this),this.calendar.unregisterInteractiveComponent(this)},s.prototype.getNowIndicatorUnit=function(e){return this.timeAxis.getNowIndicatorUnit(e)},s.prototype.renderNowIndicator=function(e){this.timeAxis.renderNowIndicator(e)},s.prototype.unrenderNowIndicator=function(){this.timeAxis.unrenderNowIndicator()},s.prototype.queryScroll=function(){var t=e.prototype.queryScroll.call(this);return this.props.resourceStore&&y(t,this.queryResourceScroll()),t},s.prototype.applyScroll=function(t,r){e.prototype.applyScroll.call(this,t,r),this.props.resourceStore&&this.applyResourceScroll(t),(r||this.isStickyScrollDirty)&&(this.isStickyScrollDirty=!1,this.spreadsheetBodyStickyScroller.updateSize(),this.timeAxis.updateStickyScrollers())},s.prototype.computeDateScroll=function(e){return this.timeAxis.computeDateScroll(e)},s.prototype.queryDateScroll=function(){return this.timeAxis.queryDateScroll()},s.prototype.applyDateScroll=function(e){this.timeAxis.applyDateScroll(e)},s.prototype.queryResourceScroll=function(){for(var e=this,t=e.rowComponents,r=e.rowNodes,o={},i=this.timeAxis.layout.bodyScroller.el.getBoundingClientRect().top,s=0;s<t.length;s++){var n=t[s],l=r[s],a=n.timeAxisTr,c=a.getBoundingClientRect().bottom;if(c>i){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})}); |