@fullcalendar/scrollgrid 5.11.2 → 6.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/main.cjs.js +373 -403
- package/main.global.js +371 -452
- package/main.global.min.js +2 -2
- package/main.js +374 -404
- package/main.js.map +1 -1
- package/package.json +4 -4
package/main.global.min.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
FullCalendar Scheduler
|
|
2
|
+
FullCalendar Scheduler v6.0.0-beta.1
|
|
3
3
|
Docs & License: https://fullcalendar.io/scheduler
|
|
4
4
|
(c) 2022 Adam Shaw
|
|
5
5
|
*/
|
|
6
|
-
var FullCalendarScrollGrid=function(e,t,r){"use strict";function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=o(FullCalendarPremiumCommon),l=function(e,t){return(l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)};function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}l(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var s=function(){return(s=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)};function c(e,t,r){if(r||2===arguments.length)for(var o,n=0,l=t.length;n<l;n++)!o&&n in t||(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||t)}var a,h="wheel mousewheel DomMouseScroll MozMousePixelScroll".split(" "),u=function(){function e(e){var r=this;this.el=e,this.emitter=new t.Emitter,this.isScrolling=!1,this.isTouching=!1,this.isRecentlyWheeled=!1,this.isRecentlyScrolled=!1,this.wheelWaiter=new t.DelayedRunner(this._handleWheelWaited.bind(this)),this.scrollWaiter=new t.DelayedRunner(this._handleScrollWaited.bind(this)),this.handleScroll=function(){r.startScroll(),r.emitter.trigger("scroll",r.isRecentlyWheeled,r.isTouching),r.isRecentlyScrolled=!0,r.scrollWaiter.request(500)},this.handleWheel=function(){r.isRecentlyWheeled=!0,r.wheelWaiter.request(500)},this.handleTouchStart=function(){r.isTouching=!0},this.handleTouchEnd=function(){r.isTouching=!1,r.isRecentlyScrolled||r.endScroll()},e.addEventListener("scroll",this.handleScroll),e.addEventListener("touchstart",this.handleTouchStart,{passive:!0}),e.addEventListener("touchend",this.handleTouchEnd);for(var o=0,n=h;o<n.length;o++){var l=n[o];e.addEventListener(l,this.handleWheel)}}return e.prototype.destroy=function(){var e=this.el;e.removeEventListener("scroll",this.handleScroll),e.removeEventListener("touchstart",this.handleTouchStart,{passive:!0}),e.removeEventListener("touchend",this.handleTouchEnd);for(var t=0,r=h;t<r.length;t++){var o=r[t];e.removeEventListener(o,this.handleWheel)}},e.prototype.startScroll=function(){this.isScrolling||(this.isScrolling=!0,this.emitter.trigger("scrollStart",this.isRecentlyWheeled,this.isTouching))},e.prototype.endScroll=function(){this.isScrolling&&(this.emitter.trigger("scrollEnd"),this.isScrolling=!1,this.isRecentlyScrolled=!0,this.isRecentlyWheeled=!1,this.scrollWaiter.clear(),this.wheelWaiter.clear())},e.prototype._handleScrollWaited=function(){this.isRecentlyScrolled=!1,this.isTouching||this.endScroll()},e.prototype._handleWheelWaited=function(){this.isRecentlyWheeled=!1},e}();function d(e){var t=e.scrollLeft;if("rtl"===window.getComputedStyle(e).direction)switch(f()){case"negative":t*=-1;case"reverse":t=e.scrollWidth-t-e.clientWidth}return t}function p(e,t){if("rtl"===window.getComputedStyle(e).direction)switch(f()){case"reverse":t=e.scrollWidth-t;break;case"negative":t=-(e.scrollWidth-t)}e.scrollLeft=t}function f(){return a||(a=function(){var e,r=document.createElement("div");r.style.position="absolute",r.style.top="-1000px",r.style.width="1px",r.style.height="1px",r.style.overflow="scroll",r.style.direction="rtl",r.style.fontSize="100px",r.innerHTML="A",document.body.appendChild(r),r.scrollLeft>0?e="positive":(r.scrollLeft=1,e=r.scrollLeft>0?"reverse":"negative");return t.removeElement(r),e}())}var g,y="undefined"!=typeof navigator&&/Edge/.test(navigator.userAgent),S=function(){function e(e,r){var o=this;this.scrollEl=e,this.isRtl=r,this.usingRelative=null,this.updateSize=function(){var e=o.scrollEl,r=t.findElements(e,".fc-sticky"),n=o.queryElGeoms(r),l=e.clientWidth,i=e.clientHeight;o.usingRelative?function(e,r,o,n,l){e.forEach((function(e,i){var s,c,a=r[i],h=a.naturalBound,u=a.parentBound,d=u.right-u.left,p=u.bottom-u.bottom;d>n||p>l?(s=o[i].left-h.left,c=o[i].top-h.top):(s="",c=""),t.applyStyle(e,{position:"relative",left:s,right:-s,top:c})}))}(r,n,o.computeElDestinations(n,l),l,i):function(e,r,o){e.forEach((function(e,n){var l,i=r[n],s=i.textAlign,c=i.elWidth,a=i.parentBound,h=a.right-a.left;l="center"===s&&h>o?(o-c)/2:"",t.applyStyle(e,{left:l,right:l,top:0})}))}(r,n,l)},this.usingRelative=!function(){null==g&&(g=function(){var e=document.createElement("div");e.style.position="sticky",document.body.appendChild(e);var r=window.getComputedStyle(e).position;return t.removeElement(e),"sticky"===r}());return g}()||y&&r,this.usingRelative&&(this.listener=new u(e),this.listener.emitter.on("scrollEnd",this.updateSize))}return e.prototype.destroy=function(){this.listener&&this.listener.destroy()},e.prototype.queryElGeoms=function(e){for(var r=this.scrollEl,o=this.isRtl,n=function(e){var r=e.getBoundingClientRect(),o=t.computeEdges(e);return{left:r.left+o.borderLeft+o.scrollbarLeft-d(e),top:r.top+o.borderTop-e.scrollTop}}(r),l=[],i=0,s=e;i<s.length;i++){var c=s[i],a=t.translateRect(t.computeInnerRect(c.parentNode,!0,!0),-n.left,-n.top),h=c.getBoundingClientRect(),u=window.getComputedStyle(c),p=window.getComputedStyle(c.parentNode).textAlign,f=null;"start"===p?p=o?"right":"left":"end"===p&&(p=o?"left":"right"),"sticky"!==u.position&&(f=t.translateRect(h,-n.left-(parseFloat(u.left)||0),-n.top-(parseFloat(u.top)||0))),l.push({parentBound:a,naturalBound:f,elWidth:h.width,elHeight:h.height,textAlign:p})}return l},e.prototype.computeElDestinations=function(e,t){var r=this.scrollEl,o=r.scrollTop,n=d(r),l=n+t;return e.map((function(e){var t,r,i=e.elWidth,s=e.elHeight,c=e.parentBound,a=e.naturalBound;switch(e.textAlign){case"left":t=n;break;case"right":t=l-i;break;case"center":t=(n+l)/2-i/2}return t=Math.min(t,c.right-i),t=Math.max(t,c.left),r=o,r=Math.min(r,c.bottom-s),{left:t,top:r=Math.max(r,a.top)}}))},e}();var m=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.elRef=t.createRef(),r.state={xScrollbarWidth:0,yScrollbarWidth:0},r.handleScroller=function(e){r.scroller=e,t.setRef(r.props.scrollerRef,e)},r.handleSizing=function(){var e=r.props;"scroll-hidden"===e.overflowY&&r.setState({yScrollbarWidth:r.scroller.getYScrollbarWidth()}),"scroll-hidden"===e.overflowX&&r.setState({xScrollbarWidth:r.scroller.getXScrollbarWidth()})},r}return i(r,e),r.prototype.render=function(){var e=this,r=e.props,o=e.state,n=e.context.isRtl&&t.getIsRtlScrollbarOnLeft(),l=0,i=0,s=0;return"scroll-hidden"===r.overflowX&&(s=o.xScrollbarWidth),"scroll-hidden"===r.overflowY&&null!=o.yScrollbarWidth&&(n?l=o.yScrollbarWidth:i=o.yScrollbarWidth),t.createElement("div",{ref:this.elRef,className:"fc-scroller-harness"+(r.liquid?" fc-scroller-harness-liquid":"")},t.createElement(t.Scroller,{ref:this.handleScroller,elRef:this.props.scrollerElRef,overflowX:"scroll-hidden"===r.overflowX?"scroll":r.overflowX,overflowY:"scroll-hidden"===r.overflowY?"scroll":r.overflowY,overcomeLeft:l,overcomeRight:i,overcomeBottom:s,maxHeight:"number"==typeof r.maxHeight?r.maxHeight+("scroll-hidden"===r.overflowX?o.xScrollbarWidth:0):"",liquid:r.liquid,liquidIsAbsolute:!0},r.children))},r.prototype.componentDidMount=function(){this.handleSizing(),this.context.addResizeHandler(this.handleSizing)},r.prototype.componentDidUpdate=function(e){t.isPropsEqual(e,this.props)||this.handleSizing()},r.prototype.componentWillUnmount=function(){this.context.removeResizeHandler(this.handleSizing)},r.prototype.needsXScrolling=function(){return this.scroller.needsXScrolling()},r.prototype.needsYScrolling=function(){return this.scroller.needsYScrolling()},r}(t.BaseComponent),v=function(){function e(e,t){var r=this;this.isVertical=e,this.scrollEls=t,this.isPaused=!1,this.scrollListeners=t.map((function(e){return r.bindScroller(e)}))}return e.prototype.destroy=function(){for(var e=0,t=this.scrollListeners;e<t.length;e++){t[e].destroy()}},e.prototype.bindScroller=function(e){var t=this,r=this.scrollEls,o=this.isVertical,n=new u(e);return n.emitter.on("scroll",(function(n,l){if(!t.isPaused&&((!t.masterEl||t.masterEl!==e&&(n||l))&&t.assignMaster(e),t.masterEl===e))for(var i=0,s=r;i<s.length;i++){var c=s[i];c!==e&&(o?c.scrollTop=e.scrollTop:c.scrollLeft=e.scrollLeft)}})),n.emitter.on("scrollEnd",(function(){t.masterEl===e&&(t.masterEl=null)})),n},e.prototype.assignMaster=function(e){this.masterEl=e;for(var t=0,r=this.scrollListeners;t<r.length;t++){var o=r[t];o.el!==e&&o.endScroll()}},e.prototype.forceScrollLeft=function(e){this.isPaused=!0;for(var t=0,r=this.scrollListeners;t<r.length;t++){p(r[t].el,e)}this.isPaused=!1},e.prototype.forceScrollTop=function(e){this.isPaused=!0;for(var t=0,r=this.scrollListeners;t<r.length;t++){r[t].el.scrollTop=e}this.isPaused=!1},e}(),R=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.compileColGroupStats=t.memoizeArraylike(b,M),r.renderMicroColGroups=t.memoizeArraylike(t.renderMicroColGroup),r.clippedScrollerRefs=new t.RefMap,r.scrollerElRefs=new t.RefMap(r._handleScrollerEl.bind(r)),r.chunkElRefs=new t.RefMap(r._handleChunkEl.bind(r)),r.stickyScrollings=[],r.scrollSyncersBySection={},r.scrollSyncersByColumn={},r.rowUnstableMap=new Map,r.rowInnerMaxHeightMap=new Map,r.anyRowHeightsChanged=!1,r.recentSizingCnt=0,r.state={shrinkWidths:[],forceYScrollbars:!1,forceXScrollbars:!1,scrollerClientWidths:{},scrollerClientHeights:{},sectionRowMaxHeights:[]},r.handleSizing=function(e,t){if(r.allowSizing()){t||(r.anyRowHeightsChanged=!0);var o={};(e||!t&&!r.rowUnstableMap.size)&&(o.sectionRowMaxHeights=r.computeSectionRowMaxHeights()),r.setState(s(s({shrinkWidths:r.computeShrinkWidths()},r.computeScrollerDims()),o),(function(){r.rowUnstableMap.size||r.updateStickyScrolling()}))}},r.handleRowHeightChange=function(e,t){var o=r,n=o.rowUnstableMap,l=o.rowInnerMaxHeightMap;if(t){n.delete(e);var i=E(e);l.has(e)&&l.get(e)===i||(l.set(e,i),r.anyRowHeightsChanged=!0),!n.size&&r.anyRowHeightsChanged&&(r.anyRowHeightsChanged=!1,r.setState({sectionRowMaxHeights:r.computeSectionRowMaxHeights()}))}else n.set(e,!0)},r}return i(r,e),r.prototype.render=function(){var e=this,r=e.props,o=e.state,n=e.context,l=o.shrinkWidths,i=this.compileColGroupStats(r.colGroups.map((function(e){return[e]}))),s=this.renderMicroColGroups(i.map((function(e,t){return[e.cols,l[t]]}))),a=t.getScrollGridClassNames(r.liquid,n),h=this.getDims();h[0],h[1];for(var u,d=r.sections,p=d.length,f=0,g=[],y=[],S=[];f<p&&"header"===(u=d[f]).type;)g.push(this.renderSection(u,f,i,s,o.sectionRowMaxHeights,!0)),f+=1;for(;f<p&&"body"===(u=d[f]).type;)y.push(this.renderSection(u,f,i,s,o.sectionRowMaxHeights,!1)),f+=1;for(;f<p&&"footer"===(u=d[f]).type;)S.push(this.renderSection(u,f,i,s,o.sectionRowMaxHeights,!0)),f+=1;var m=!t.getCanVGrowWithinCell(),v={role:"rowgroup"};return t.createElement("table",{ref:r.elRef,role:"grid",className:a.join(" ")},function(e,r){var o=e.map((function(e,o){var n=e.width;return"shrink"===n&&(n=e.totalColWidth+t.sanitizeShrinkWidth(r[o])+1),t.createElement("col",{style:{width:n}})}));return t.createElement.apply(void 0,c(["colgroup",{}],o))}(i,l),Boolean(!m&&g.length)&&t.createElement.apply(void 0,c(["thead",v],g)),Boolean(!m&&y.length)&&t.createElement.apply(void 0,c(["tbody",v],y)),Boolean(!m&&S.length)&&t.createElement.apply(void 0,c(["tfoot",v],S)),m&&t.createElement.apply(void 0,c(c(c(["tbody",v],g),y),S)))},r.prototype.renderSection=function(e,r,o,n,l,i){var s=this;return"outerContent"in e?t.createElement(t.Fragment,{key:e.key},e.outerContent):t.createElement("tr",{key:e.key,role:"presentation",className:t.getSectionClassNames(e,this.props.liquid).join(" ")},e.chunks.map((function(t,c){return s.renderChunk(e,r,o[c],n[c],t,c,(l[r]||[])[c]||[],i)})))},r.prototype.renderChunk=function(e,r,o,n,l,i,s,c){if("outerContent"in l)return t.createElement(t.Fragment,{key:l.key},l.outerContent);var a=this.state,h=a.scrollerClientWidths,u=a.scrollerClientHeights,d=this.getDims(),p=d[0],f=d[1],g=r*f+i,y=i===(!this.context.isRtl||t.getIsRtlScrollbarOnLeft()?f-1:0),S=r===p-1,v=S&&a.forceXScrollbars,R=y&&a.forceYScrollbars,w=o&&o.allowXScrolling,E=t.getAllowYScrolling(this.props,e),C=t.getSectionHasLiquidHeight(this.props,e),b=e.expandRows&&C,W=o&&o.totalColMinWidth||"",k=t.renderChunkContent(e,l,{tableColGroupNode:n,tableMinWidth:W,clientWidth:void 0!==h[g]?h[g]:null,clientHeight:void 0!==u[g]?u[g]:null,expandRows:b,syncRowHeights:Boolean(e.syncRowHeights),rowSyncHeights:s,reportRowHeightChange:this.handleRowHeightChange},c),M=v?S?"scroll":"scroll-hidden":w?S?"auto":"scroll-hidden":"hidden",x=R?y?"scroll":"scroll-hidden":E?y?"auto":"scroll-hidden":"hidden";return k=t.createElement(m,{ref:this.clippedScrollerRefs.createRef(g),scrollerElRef:this.scrollerElRefs.createRef(g),overflowX:M,overflowY:x,liquid:C,maxHeight:e.maxHeight},k),t.createElement(c?"th":"td",{key:l.key,ref:this.chunkElRefs.createRef(g),role:"presentation"},k)},r.prototype.componentDidMount=function(){this.getStickyScrolling=t.memoizeArraylike(L,null,z),this.getScrollSyncersBySection=t.memoizeHashlike(x.bind(this,!0),null,H),this.getScrollSyncersByColumn=t.memoizeHashlike(x.bind(this,!1),null,H),this.updateScrollSyncers(),this.handleSizing(!1),this.context.addResizeHandler(this.handleSizing)},r.prototype.componentDidUpdate=function(e,t){this.updateScrollSyncers(),this.handleSizing(!1,t.sectionRowMaxHeights!==this.state.sectionRowMaxHeights)},r.prototype.componentWillUnmount=function(){this.context.removeResizeHandler(this.handleSizing),this.destroyStickyScrolling(),this.destroyScrollSyncers()},r.prototype.allowSizing=function(){var e=new Date;return!this.lastSizingDate||e.valueOf()>this.lastSizingDate.valueOf()+t.config.SCROLLGRID_RESIZE_INTERVAL?(this.lastSizingDate=e,this.recentSizingCnt=0,!0):(this.recentSizingCnt+=1)<=10},r.prototype.computeShrinkWidths=function(){var e=this,r=this.compileColGroupStats(this.props.colGroups.map((function(e){return[e]}))),o=this.getDims(),n=o[0],l=o[1],i=n*l,s=[];return r.forEach((function(r,o){if(r.hasShrinkCol){var n=e.chunkElRefs.collect(o,i,l);s[o]=t.computeShrinkWidth(n)}})),s},r.prototype.computeSectionRowMaxHeights=function(){for(var e=new Map,r=this.getDims(),o=r[0],n=r[1],l=[],i=0;i<o;i+=1){var s=this.props.sections[i],c=[];if(s&&s.syncRowHeights){for(var a=[],h=0;h<n;h+=1){var u=i*n+h,d=[],p=this.chunkElRefs.currentMap[u];d=p?t.findElements(p,".fc-scrollgrid-sync-table tr").map((function(t){var r=E(t);return e.set(t,r),r})):[],a.push(d)}var f=a[0].length,g=!0;for(h=1;h<n;h+=1){if(!(s.chunks[h]&&void 0!==s.chunks[h].outerContent)&&a[h].length!==f){g=!1;break}}if(g){for(h=0;h<n;h+=1)c.push([]);for(C=0;C<f;C+=1){var y=[];for(h=0;h<n;h+=1){var S=a[h][C];null!=S&&y.push(S)}var m=Math.max.apply(Math,y);for(h=0;h<n;h+=1)c[h].push(m)}}else{for(var v=[],h=0;h<n;h+=1)v.push(w(a[h])+a[h].length);for(var R=Math.max.apply(Math,v),h=0;h<n;h+=1){var C,b=a[h].length,W=R-b,k=Math.floor(W/b),M=W-k*(b-1),x=[];for((C=0)<b&&(x.push(M),C+=1);C<b;)x.push(k),C+=1;c.push(x)}}}l.push(c)}return this.rowInnerMaxHeightMap=e,l},r.prototype.computeScrollerDims=function(){for(var e=t.getScrollbarWidths(),r=this.getDims(),o=r[0],n=r[1],l=!this.context.isRtl||t.getIsRtlScrollbarOnLeft()?n-1:0,i=o-1,s=this.clippedScrollerRefs.currentMap,c=this.scrollerElRefs.currentMap,a=!1,h=!1,u={},d={},p=0;p<o;p+=1){if((g=s[y=p*n+l])&&g.needsYScrolling()){a=!0;break}}for(var f=0;f<n;f+=1){var g;if((g=s[y=i*n+f])&&g.needsXScrolling()){h=!0;break}}for(p=0;p<o;p+=1)for(f=0;f<n;f+=1){var y,S=c[y=p*n+f];if(S){var m=S.parentNode;u[y]=Math.floor(m.getBoundingClientRect().width-(f===l&&a?e.y:0)),d[y]=Math.floor(m.getBoundingClientRect().height-(p===i&&h?e.x:0))}}return{forceYScrollbars:a,forceXScrollbars:h,scrollerClientWidths:u,scrollerClientHeights:d}},r.prototype.updateStickyScrolling=function(){var e=this.context.isRtl,t=this.scrollerElRefs.getAll().map((function(t){return[t,e]})),r=this.getStickyScrolling(t);r.forEach((function(e){return e.updateSize()})),this.stickyScrollings=r},r.prototype.destroyStickyScrolling=function(){this.stickyScrollings.forEach(z)},r.prototype.updateScrollSyncers=function(){for(var e=this.getDims(),r=e[0],o=e[1],n=r*o,l={},i={},s=this.scrollerElRefs.currentMap,c=0;c<r;c+=1){var a=c*o,h=a+o;l[c]=t.collectFromHash(s,a,h,1)}for(var u=0;u<o;u+=1)i[u]=this.scrollerElRefs.collect(u,n,o);this.scrollSyncersBySection=this.getScrollSyncersBySection(l),this.scrollSyncersByColumn=this.getScrollSyncersByColumn(i)},r.prototype.destroyScrollSyncers=function(){t.mapHash(this.scrollSyncersBySection,H),t.mapHash(this.scrollSyncersByColumn,H)},r.prototype.getChunkConfigByIndex=function(e){var t=this.getDims()[1],r=Math.floor(e/t),o=e%t,n=this.props.sections[r];return n&&n.chunks[o]},r.prototype.forceScrollLeft=function(e,t){var r=this.scrollSyncersByColumn[e];r&&r.forceScrollLeft(t)},r.prototype.forceScrollTop=function(e,t){var r=this.scrollSyncersBySection[e];r&&r.forceScrollTop(t)},r.prototype._handleChunkEl=function(e,r){var o=this.getChunkConfigByIndex(parseInt(r,10));o&&t.setRef(o.elRef,e)},r.prototype._handleScrollerEl=function(e,r){var o=this.getChunkConfigByIndex(parseInt(r,10));o&&t.setRef(o.scrollerElRef,e)},r.prototype.getDims=function(){var e=this.props.sections.length;return[e,e?this.props.sections[0].chunks.length:0]},r}(t.BaseComponent);function w(e){for(var t=0,r=0,o=e;r<o.length;r++){t+=o[r]}return t}function E(e){var r=t.findElements(e,".fc-scrollgrid-sync-inner").map(C);return r.length?Math.max.apply(Math,r):0}function C(e){return e.offsetHeight}function b(e){var r=W(e.cols,"width"),o=W(e.cols,"minWidth"),n=t.hasShrinkWidth(e.cols);return{hasShrinkCol:n,totalColWidth:r,totalColMinWidth:o,allowXScrolling:"shrink"!==e.width&&Boolean(r||o||n),cols:e.cols,width:e.width}}function W(e,t){for(var r=0,o=0,n=e;o<n.length;o++){var l=n[o],i=l[t];"number"==typeof i&&(r+=i*(l.span||1))}return r}R.addStateEquality({shrinkWidths:t.isArraysEqual,scrollerClientWidths:t.isPropsEqual,scrollerClientHeights:t.isPropsEqual});var k={cols:t.isColPropsEqual};function M(e,r){return t.compareObjs(e,r,k)}function x(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return new v(e,t)}function H(e){e.destroy()}function L(e,t){return new S(e,t)}function z(e){e.destroy()}var B=t.createPlugin({deps:[n.default],scrollGridImpl:R});return t.config.SCROLLGRID_RESIZE_INTERVAL=500,t.globalPlugins.push(B),e.ScrollGrid=R,e.default=B,e.setScrollFromLeftEdge=p,Object.defineProperty(e,"__esModule",{value:!0}),e}({},FullCalendar);
|
|
6
|
+
var FullCalendarScrollGrid=function(e,t,l){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=i(FullCalendarPremiumCommon);const r="wheel mousewheel DomMouseScroll MozMousePixelScroll".split(" ");class o{constructor(e){this.el=e,this.emitter=new t.Emitter,this.isScrolling=!1,this.isTouching=!1,this.isRecentlyWheeled=!1,this.isRecentlyScrolled=!1,this.wheelWaiter=new t.DelayedRunner(this._handleWheelWaited.bind(this)),this.scrollWaiter=new t.DelayedRunner(this._handleScrollWaited.bind(this)),this.handleScroll=()=>{this.startScroll(),this.emitter.trigger("scroll",this.isRecentlyWheeled,this.isTouching),this.isRecentlyScrolled=!0,this.scrollWaiter.request(500)},this.handleWheel=()=>{this.isRecentlyWheeled=!0,this.wheelWaiter.request(500)},this.handleTouchStart=()=>{this.isTouching=!0},this.handleTouchEnd=()=>{this.isTouching=!1,this.isRecentlyScrolled||this.endScroll()},e.addEventListener("scroll",this.handleScroll),e.addEventListener("touchstart",this.handleTouchStart,{passive:!0}),e.addEventListener("touchend",this.handleTouchEnd);for(let t of r)e.addEventListener(t,this.handleWheel)}destroy(){let{el:e}=this;e.removeEventListener("scroll",this.handleScroll),e.removeEventListener("touchstart",this.handleTouchStart,{passive:!0}),e.removeEventListener("touchend",this.handleTouchEnd);for(let t of r)e.removeEventListener(t,this.handleWheel)}startScroll(){this.isScrolling||(this.isScrolling=!0,this.emitter.trigger("scrollStart",this.isRecentlyWheeled,this.isTouching))}endScroll(){this.isScrolling&&(this.emitter.trigger("scrollEnd"),this.isScrolling=!1,this.isRecentlyScrolled=!0,this.isRecentlyWheeled=!1,this.scrollWaiter.clear(),this.wheelWaiter.clear())}_handleScrollWaited(){this.isRecentlyScrolled=!1,this.isTouching||this.endScroll()}_handleWheelWaited(){this.isRecentlyWheeled=!1}}function n(e){let t=e.scrollLeft;if("rtl"===window.getComputedStyle(e).direction)switch(a()){case"negative":t*=-1;case"reverse":t=e.scrollWidth-t-e.clientWidth}return t}function h(e,t){if("rtl"===window.getComputedStyle(e).direction)switch(a()){case"reverse":t=e.scrollWidth-t;break;case"negative":t=-(e.scrollWidth-t)}e.scrollLeft=t}let c;function a(){return c||(c=function(){let e,l=document.createElement("div");l.style.position="absolute",l.style.top="-1000px",l.style.width="1px",l.style.height="1px",l.style.overflow="scroll",l.style.direction="rtl",l.style.fontSize="100px",l.innerHTML="A",document.body.appendChild(l),l.scrollLeft>0?e="positive":(l.scrollLeft=1,e=l.scrollLeft>0?"reverse":"negative");return t.removeElement(l),e}())}const d="undefined"!=typeof navigator&&/Edge/.test(navigator.userAgent);class u{constructor(e,l){this.scrollEl=e,this.isRtl=l,this.usingRelative=null,this.updateSize=()=>{let{scrollEl:e}=this,l=t.findElements(e,".fc-sticky"),i=this.queryElGeoms(l),s=e.clientWidth,r=e.clientHeight;if(this.usingRelative){!function(e,l,i,s,r){e.forEach(((e,o)=>{let n,h,{naturalBound:c,parentBound:a}=l[o],d=a.right-a.left,u=a.bottom-a.bottom;d>s||u>r?(n=i[o].left-c.left,h=i[o].top-c.top):(n="",h=""),t.applyStyle(e,{position:"relative",left:n,right:-n,top:h})}))}(l,i,this.computeElDestinations(i,s),s,r)}else!function(e,l,i){e.forEach(((e,s)=>{let r,{textAlign:o,elWidth:n,parentBound:h}=l[s],c=h.right-h.left;r="center"===o&&c>i?(i-n)/2:"",t.applyStyle(e,{left:r,right:r,top:0})}))}(l,i,s)},this.usingRelative=!function(){null==f&&(f=function(){let e=document.createElement("div");e.style.position="sticky",document.body.appendChild(e);let l=window.getComputedStyle(e).position;return t.removeElement(e),"sticky"===l}());return f}()||d&&l,this.usingRelative&&(this.listener=new o(e),this.listener.emitter.on("scrollEnd",this.updateSize))}destroy(){this.listener&&this.listener.destroy()}queryElGeoms(e){let{scrollEl:l,isRtl:i}=this,s=function(e){let l=e.getBoundingClientRect(),i=t.computeEdges(e);return{left:l.left+i.borderLeft+i.scrollbarLeft-n(e),top:l.top+i.borderTop-e.scrollTop}}(l),r=[];for(let l of e){let e=t.translateRect(t.computeInnerRect(l.parentNode,!0,!0),-s.left,-s.top),o=l.getBoundingClientRect(),n=window.getComputedStyle(l),h=window.getComputedStyle(l.parentNode).textAlign,c=null;"start"===h?h=i?"right":"left":"end"===h&&(h=i?"left":"right"),"sticky"!==n.position&&(c=t.translateRect(o,-s.left-(parseFloat(n.left)||0),-s.top-(parseFloat(n.top)||0))),r.push({parentBound:e,naturalBound:c,elWidth:o.width,elHeight:o.height,textAlign:h})}return r}computeElDestinations(e,t){let{scrollEl:l}=this,i=l.scrollTop,s=n(l),r=s+t;return e.map((e=>{let t,l,{elWidth:o,elHeight:n,parentBound:h,naturalBound:c}=e;switch(e.textAlign){case"left":t=s;break;case"right":t=r-o;break;case"center":t=(s+r)/2-o/2}return t=Math.min(t,h.right-o),t=Math.max(t,h.left),l=i,l=Math.min(l,h.bottom-n),l=Math.max(l,c.top),{left:t,top:l}}))}}let f;class g extends t.BaseComponent{constructor(){super(...arguments),this.elRef=t.createRef(),this.state={xScrollbarWidth:0,yScrollbarWidth:0},this.handleScroller=e=>{this.scroller=e,t.setRef(this.props.scrollerRef,e)},this.handleSizing=()=>{let{props:e}=this;"scroll-hidden"===e.overflowY&&this.setState({yScrollbarWidth:this.scroller.getYScrollbarWidth()}),"scroll-hidden"===e.overflowX&&this.setState({xScrollbarWidth:this.scroller.getXScrollbarWidth()})}}render(){let{props:e,state:l,context:i}=this,s=i.isRtl&&t.getIsRtlScrollbarOnLeft(),r=0,o=0,n=0;return"scroll-hidden"===e.overflowX&&(n=l.xScrollbarWidth),"scroll-hidden"===e.overflowY&&null!=l.yScrollbarWidth&&(s?r=l.yScrollbarWidth:o=l.yScrollbarWidth),t.createElement("div",{ref:this.elRef,className:"fc-scroller-harness"+(e.liquid?" fc-scroller-harness-liquid":"")},t.createElement(t.Scroller,{ref:this.handleScroller,elRef:this.props.scrollerElRef,overflowX:"scroll-hidden"===e.overflowX?"scroll":e.overflowX,overflowY:"scroll-hidden"===e.overflowY?"scroll":e.overflowY,overcomeLeft:r,overcomeRight:o,overcomeBottom:n,maxHeight:"number"==typeof e.maxHeight?e.maxHeight+("scroll-hidden"===e.overflowX?l.xScrollbarWidth:0):"",liquid:e.liquid,liquidIsAbsolute:!0},e.children))}componentDidMount(){this.handleSizing(),this.context.addResizeHandler(this.handleSizing)}componentDidUpdate(e){t.isPropsEqual(e,this.props)||this.handleSizing()}componentWillUnmount(){this.context.removeResizeHandler(this.handleSizing)}needsXScrolling(){return this.scroller.needsXScrolling()}needsYScrolling(){return this.scroller.needsYScrolling()}}class p{constructor(e,t){this.isVertical=e,this.scrollEls=t,this.isPaused=!1,this.scrollListeners=t.map((e=>this.bindScroller(e)))}destroy(){for(let e of this.scrollListeners)e.destroy()}bindScroller(e){let{scrollEls:t,isVertical:l}=this,i=new o(e);return i.emitter.on("scroll",((i,s)=>{if(!this.isPaused&&((!this.masterEl||this.masterEl!==e&&(i||s))&&this.assignMaster(e),this.masterEl===e))for(let i of t)i!==e&&(l?i.scrollTop=e.scrollTop:i.scrollLeft=e.scrollLeft)})),i.emitter.on("scrollEnd",(()=>{this.masterEl===e&&(this.masterEl=null)})),i}assignMaster(e){this.masterEl=e;for(let t of this.scrollListeners)t.el!==e&&t.endScroll()}forceScrollLeft(e){this.isPaused=!0;for(let t of this.scrollListeners)h(t.el,e);this.isPaused=!1}forceScrollTop(e){this.isPaused=!0;for(let t of this.scrollListeners)t.el.scrollTop=e;this.isPaused=!1}}class S extends t.BaseComponent{constructor(){super(...arguments),this.compileColGroupStats=t.memoizeArraylike(w,b),this.renderMicroColGroups=t.memoizeArraylike(t.renderMicroColGroup),this.clippedScrollerRefs=new t.RefMap,this.scrollerElRefs=new t.RefMap(this._handleScrollerEl.bind(this)),this.chunkElRefs=new t.RefMap(this._handleChunkEl.bind(this)),this.stickyScrollings=[],this.scrollSyncersBySection={},this.scrollSyncersByColumn={},this.rowUnstableMap=new Map,this.rowInnerMaxHeightMap=new Map,this.anyRowHeightsChanged=!1,this.recentSizingCnt=0,this.state={shrinkWidths:[],forceYScrollbars:!1,forceXScrollbars:!1,scrollerClientWidths:{},scrollerClientHeights:{},sectionRowMaxHeights:[]},this.handleSizing=(e,t)=>{if(!this.allowSizing())return;t||(this.anyRowHeightsChanged=!0);let l={};(e||!t&&!this.rowUnstableMap.size)&&(l.sectionRowMaxHeights=this.computeSectionRowMaxHeights()),this.setState(Object.assign(Object.assign({shrinkWidths:this.computeShrinkWidths()},this.computeScrollerDims()),l),(()=>{this.rowUnstableMap.size||this.updateStickyScrolling()}))},this.handleRowHeightChange=(e,t)=>{let{rowUnstableMap:l,rowInnerMaxHeightMap:i}=this;if(t){l.delete(e);let t=y(e);i.has(e)&&i.get(e)===t||(i.set(e,t),this.anyRowHeightsChanged=!0),!l.size&&this.anyRowHeightsChanged&&(this.anyRowHeightsChanged=!1,this.setState({sectionRowMaxHeights:this.computeSectionRowMaxHeights()}))}else l.set(e,!0)}}render(){let{props:e,state:l,context:i}=this,{shrinkWidths:s}=l,r=this.compileColGroupStats(e.colGroups.map((e=>[e]))),o=this.renderMicroColGroups(r.map(((e,t)=>[e.cols,s[t]]))),n=t.getScrollGridClassNames(e.liquid,i);this.getDims();let h,c=e.sections,a=c.length,d=0,u=[],f=[],g=[];for(;d<a&&"header"===(h=c[d]).type;)u.push(this.renderSection(h,d,r,o,l.sectionRowMaxHeights,!0)),d+=1;for(;d<a&&"body"===(h=c[d]).type;)f.push(this.renderSection(h,d,r,o,l.sectionRowMaxHeights,!1)),d+=1;for(;d<a&&"footer"===(h=c[d]).type;)g.push(this.renderSection(h,d,r,o,l.sectionRowMaxHeights,!0)),d+=1;const p=!t.getCanVGrowWithinCell(),S={role:"rowgroup"};return t.createElement("table",{ref:e.elRef,role:"grid",className:n.join(" ")},function(e,l){let i=e.map(((e,i)=>{let s=e.width;return"shrink"===s&&(s=e.totalColWidth+t.sanitizeShrinkWidth(l[i])+1),t.createElement("col",{style:{width:s}})}));return t.createElement("colgroup",{},...i)}(r,s),Boolean(!p&&u.length)&&t.createElement("thead",S,...u),Boolean(!p&&f.length)&&t.createElement("tbody",S,...f),Boolean(!p&&g.length)&&t.createElement("tfoot",S,...g),p&&t.createElement("tbody",S,...u,...f,...g))}renderSection(e,l,i,s,r,o){return"outerContent"in e?t.createElement(t.Fragment,{key:e.key},e.outerContent):t.createElement("tr",{key:e.key,role:"presentation",className:t.getSectionClassNames(e,this.props.liquid).join(" ")},e.chunks.map(((t,n)=>this.renderChunk(e,l,i[n],s[n],t,n,(r[l]||[])[n]||[],o))))}renderChunk(e,l,i,s,r,o,n,h){if("outerContent"in r)return t.createElement(t.Fragment,{key:r.key},r.outerContent);let{state:c}=this,{scrollerClientWidths:a,scrollerClientHeights:d}=c,[u,f]=this.getDims(),p=l*f+o,S=o===(!this.context.isRtl||t.getIsRtlScrollbarOnLeft()?f-1:0),m=l===u-1,y=m&&c.forceXScrollbars,R=S&&c.forceYScrollbars,w=i&&i.allowXScrolling,E=t.getAllowYScrolling(this.props,e),C=t.getSectionHasLiquidHeight(this.props,e),b=e.expandRows&&C,W=i&&i.totalColMinWidth||"",k=t.renderChunkContent(e,r,{tableColGroupNode:s,tableMinWidth:W,clientWidth:void 0!==a[p]?a[p]:null,clientHeight:void 0!==d[p]?d[p]:null,expandRows:b,syncRowHeights:Boolean(e.syncRowHeights),rowSyncHeights:n,reportRowHeightChange:this.handleRowHeightChange},h),v=y?m?"scroll":"scroll-hidden":w?m?"auto":"scroll-hidden":"hidden",M=R?S?"scroll":"scroll-hidden":E?S?"auto":"scroll-hidden":"hidden";return k=t.createElement(g,{ref:this.clippedScrollerRefs.createRef(p),scrollerElRef:this.scrollerElRefs.createRef(p),overflowX:v,overflowY:M,liquid:C,maxHeight:e.maxHeight},k),t.createElement(h?"th":"td",{key:r.key,ref:this.chunkElRefs.createRef(p),role:"presentation"},k)}componentDidMount(){this.getStickyScrolling=t.memoizeArraylike(v,null,M),this.getScrollSyncersBySection=t.memoizeHashlike(W.bind(this,!0),null,k),this.getScrollSyncersByColumn=t.memoizeHashlike(W.bind(this,!1),null,k),this.updateScrollSyncers(),this.handleSizing(!1),this.context.addResizeHandler(this.handleSizing)}componentDidUpdate(e,t){this.updateScrollSyncers(),this.handleSizing(!1,t.sectionRowMaxHeights!==this.state.sectionRowMaxHeights)}componentWillUnmount(){this.context.removeResizeHandler(this.handleSizing),this.destroyStickyScrolling(),this.destroyScrollSyncers()}allowSizing(){let e=new Date;return!this.lastSizingDate||e.valueOf()>this.lastSizingDate.valueOf()+t.config.SCROLLGRID_RESIZE_INTERVAL?(this.lastSizingDate=e,this.recentSizingCnt=0,!0):(this.recentSizingCnt+=1)<=10}computeShrinkWidths(){let e=this.compileColGroupStats(this.props.colGroups.map((e=>[e]))),[l,i]=this.getDims(),s=l*i,r=[];return e.forEach(((e,l)=>{if(e.hasShrinkCol){let e=this.chunkElRefs.collect(l,s,i);r[l]=t.computeShrinkWidth(e)}})),r}computeSectionRowMaxHeights(){let e=new Map,[l,i]=this.getDims(),s=[];for(let r=0;r<l;r+=1){let l=this.props.sections[r],o=[];if(l&&l.syncRowHeights){let s=[];for(let l=0;l<i;l+=1){let o=r*i+l,n=[],h=this.chunkElRefs.currentMap[o];n=h?t.findElements(h,".fc-scrollgrid-sync-table tr").map((t=>{let l=y(t);return e.set(t,l),l})):[],s.push(n)}let n=s[0].length,h=!0;for(let e=1;e<i;e+=1){if(!(l.chunks[e]&&void 0!==l.chunks[e].outerContent)&&s[e].length!==n){h=!1;break}}if(h){for(let e=0;e<i;e+=1)o.push([]);for(let e=0;e<n;e+=1){let t=[];for(let l=0;l<i;l+=1){let i=s[l][e];null!=i&&t.push(i)}let l=Math.max(...t);for(let e=0;e<i;e+=1)o[e].push(l)}}else{let e=[];for(let t=0;t<i;t+=1)e.push(m(s[t])+s[t].length);let t=Math.max(...e);for(let e=0;e<i;e+=1){let l=s[e].length,i=t-l,r=Math.floor(i/l),n=i-r*(l-1),h=[],c=0;for(c<l&&(h.push(n),c+=1);c<l;)h.push(r),c+=1;o.push(h)}}}s.push(o)}return this.rowInnerMaxHeightMap=e,s}computeScrollerDims(){let e=t.getScrollbarWidths(),[l,i]=this.getDims(),s=!this.context.isRtl||t.getIsRtlScrollbarOnLeft()?i-1:0,r=l-1,o=this.clippedScrollerRefs.currentMap,n=this.scrollerElRefs.currentMap,h=!1,c=!1,a={},d={};for(let e=0;e<l;e+=1){let t=o[e*i+s];if(t&&t.needsYScrolling()){h=!0;break}}for(let e=0;e<i;e+=1){let t=o[r*i+e];if(t&&t.needsXScrolling()){c=!0;break}}for(let t=0;t<l;t+=1)for(let l=0;l<i;l+=1){let o=t*i+l,u=n[o];if(u){let i=u.parentNode;a[o]=Math.floor(i.getBoundingClientRect().width-(l===s&&h?e.y:0)),d[o]=Math.floor(i.getBoundingClientRect().height-(t===r&&c?e.x:0))}}return{forceYScrollbars:h,forceXScrollbars:c,scrollerClientWidths:a,scrollerClientHeights:d}}updateStickyScrolling(){let{isRtl:e}=this.context,t=this.scrollerElRefs.getAll().map((t=>[t,e])),l=this.getStickyScrolling(t);l.forEach((e=>e.updateSize())),this.stickyScrollings=l}destroyStickyScrolling(){this.stickyScrollings.forEach(M)}updateScrollSyncers(){let[e,l]=this.getDims(),i=e*l,s={},r={},o=this.scrollerElRefs.currentMap;for(let i=0;i<e;i+=1){let e=i*l,r=e+l;s[i]=t.collectFromHash(o,e,r,1)}for(let e=0;e<l;e+=1)r[e]=this.scrollerElRefs.collect(e,i,l);this.scrollSyncersBySection=this.getScrollSyncersBySection(s),this.scrollSyncersByColumn=this.getScrollSyncersByColumn(r)}destroyScrollSyncers(){t.mapHash(this.scrollSyncersBySection,k),t.mapHash(this.scrollSyncersByColumn,k)}getChunkConfigByIndex(e){let t=this.getDims()[1],l=Math.floor(e/t),i=e%t,s=this.props.sections[l];return s&&s.chunks[i]}forceScrollLeft(e,t){let l=this.scrollSyncersByColumn[e];l&&l.forceScrollLeft(t)}forceScrollTop(e,t){let l=this.scrollSyncersBySection[e];l&&l.forceScrollTop(t)}_handleChunkEl(e,l){let i=this.getChunkConfigByIndex(parseInt(l,10));i&&t.setRef(i.elRef,e)}_handleScrollerEl(e,l){let i=this.getChunkConfigByIndex(parseInt(l,10));i&&t.setRef(i.scrollerElRef,e)}getDims(){let e=this.props.sections.length;return[e,e?this.props.sections[0].chunks.length:0]}}function m(e){let t=0;for(let l of e)t+=l;return t}function y(e){let l=t.findElements(e,".fc-scrollgrid-sync-inner").map(R);return l.length?Math.max(...l):0}function R(e){return e.offsetHeight}function w(e){let l=E(e.cols,"width"),i=E(e.cols,"minWidth"),s=t.hasShrinkWidth(e.cols);return{hasShrinkCol:s,totalColWidth:l,totalColMinWidth:i,allowXScrolling:"shrink"!==e.width&&Boolean(l||i||s),cols:e.cols,width:e.width}}function E(e,t){let l=0;for(let i of e){let e=i[t];"number"==typeof e&&(l+=e*(i.span||1))}return l}S.addStateEquality({shrinkWidths:t.isArraysEqual,scrollerClientWidths:t.isPropsEqual,scrollerClientHeights:t.isPropsEqual});const C={cols:t.isColPropsEqual};function b(e,l){return t.compareObjs(e,l,C)}function W(e,...t){return new p(e,t)}function k(e){e.destroy()}function v(e,t){return new u(e,t)}function M(e){e.destroy()}var x=t.createPlugin({deps:[s.default],scrollGridImpl:S});return t.config.SCROLLGRID_RESIZE_INTERVAL=500,t.globalPlugins.push(x),e.ScrollGrid=S,e.default=x,e.setScrollFromLeftEdge=h,Object.defineProperty(e,"__esModule",{value:!0}),e}({},FullCalendar);
|