@fullcalendar/scrollgrid
Advanced tools
Comparing version 6.0.0-beta.2 to 6.0.0-beta.3
/*! | ||
FullCalendar ScrollGrid Plugin v6.0.0-beta.2 | ||
FullCalendar ScrollGrid Plugin v6.0.0-beta.3 | ||
Docs & License: https://fullcalendar.io/premium | ||
@@ -841,3 +841,3 @@ (c) 2022 Adam Shaw | ||
name: '@fullcalendar/scrollgrid', | ||
premiumReleaseDate: '2022-11-22', | ||
premiumReleaseDate: '2022-12-02', | ||
deps: [premiumCommonPlugin__default["default"]], | ||
@@ -844,0 +844,0 @@ scrollGridImpl: ScrollGrid, |
/*! | ||
FullCalendar ScrollGrid Plugin v6.0.0-beta.2 | ||
FullCalendar ScrollGrid Plugin v6.0.0-beta.3 | ||
Docs & License: https://fullcalendar.io/premium | ||
(c) 2022 Adam Shaw | ||
*/ | ||
FullCalendar.ScrollGrid=function(e,t,l,s,i){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var o=r(s);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}())}class d{constructor(e,l){this.scrollEl=e,this.isRtl=l,this.updateSize=()=>{let{scrollEl:e}=this,l=t.findElements(e,".fc-sticky");!function(e,l,s){e.forEach((e,i)=>{let r,{textAlign:o,elWidth:n,parentBound:h}=l[i],c=h.right-h.left;r="center"===o&&c>s?(s-n)/2:"",t.applyStyle(e,{left:r,right:r,top:0})})}(l,this.queryElGeoms(l),e.clientWidth)}}queryElGeoms(e){let{scrollEl:l,isRtl:s}=this,i=function(e){let l=e.getBoundingClientRect(),s=t.computeEdges(e);return{left:l.left+s.borderLeft+s.scrollbarLeft-n(e),top:l.top+s.borderTop-e.scrollTop}}(l),r=[];for(let l of e){let e=t.translateRect(t.computeInnerRect(l.parentNode,!0,!0),-i.left,-i.top),o=l.getBoundingClientRect(),n=window.getComputedStyle(l),h=window.getComputedStyle(l.parentNode).textAlign,c=null;"start"===h?h=s?"right":"left":"end"===h&&(h=s?"left":"right"),"sticky"!==n.position&&(c=t.translateRect(o,-i.left-(parseFloat(n.left)||0),-i.top-(parseFloat(n.top)||0))),r.push({parentBound:e,naturalBound:c,elWidth:o.width,elHeight:o.height,textAlign:h})}return r}}class u extends t.BaseComponent{constructor(){super(...arguments),this.elRef=i.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:s}=this,r=s.isRtl&&t.getIsRtlScrollbarOnLeft(),o=0,n=0,h=0;return"scroll-hidden"===e.overflowX&&(h=l.xScrollbarWidth),"scroll-hidden"===e.overflowY&&null!=l.yScrollbarWidth&&(r?o=l.yScrollbarWidth:n=l.yScrollbarWidth),i.createElement("div",{ref:this.elRef,className:"fc-scroller-harness"+(e.liquid?" fc-scroller-harness-liquid":"")},i.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:o,overcomeRight:n,overcomeBottom:h,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()}}const f="wheel mousewheel DomMouseScroll MozMousePixelScroll".split(" ");class g{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 f)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 f)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}}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,s=new g(e);return s.emitter.on("scroll",(s,i)=>{if(!this.isPaused&&((!this.masterEl||this.masterEl!==e&&(s||i))&&this.assignMaster(e),this.masterEl===e))for(let s of t)s!==e&&(l?s.scrollTop=e.scrollTop:s.scrollLeft=e.scrollLeft)}),s.emitter.on("scrollEnd",()=>{this.masterEl===e&&(this.masterEl=null)}),s}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}}t.config.SCROLLGRID_RESIZE_INTERVAL=500;class S extends t.BaseComponent{constructor(){super(...arguments),this.compileColGroupStats=t.memoizeArraylike(w,W),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.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:s}=this;if(t){l.delete(e);let t=y(e);s.has(e)&&s.get(e)===t||(s.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:s}=this,{shrinkWidths:r}=l,o=this.compileColGroupStats(e.colGroups.map(e=>[e])),n=this.renderMicroColGroups(o.map((e,t)=>[e.cols,r[t]])),h=t.getScrollGridClassNames(e.liquid,s);this.getDims();let c,a=e.sections,d=a.length,u=0,f=[],g=[],p=[];for(;u<d&&"header"===(c=a[u]).type;)f.push(this.renderSection(c,u,o,n,l.sectionRowMaxHeights,!0)),u+=1;for(;u<d&&"body"===(c=a[u]).type;)g.push(this.renderSection(c,u,o,n,l.sectionRowMaxHeights,!1)),u+=1;for(;u<d&&"footer"===(c=a[u]).type;)p.push(this.renderSection(c,u,o,n,l.sectionRowMaxHeights,!0)),u+=1;const S=!t.getCanVGrowWithinCell(),m={role:"rowgroup"};return i.createElement("table",{ref:e.elRef,role:"grid",className:h.join(" ")},function(e,l){let s=e.map((e,s)=>{let r=e.width;return"shrink"===r&&(r=e.totalColWidth+t.sanitizeShrinkWidth(l[s])+1),i.createElement("col",{style:{width:r}})});return i.createElement("colgroup",{},...s)}(o,r),Boolean(!S&&f.length)&&i.createElement("thead",m,...f),Boolean(!S&&g.length)&&i.createElement("tbody",m,...g),Boolean(!S&&p.length)&&i.createElement("tfoot",m,...p),S&&i.createElement("tbody",m,...f,...g,...p))}renderSection(e,l,s,r,o,n){return"outerContent"in e?i.createElement(i.Fragment,{key:e.key},e.outerContent):i.createElement("tr",{key:e.key,role:"presentation",className:t.getSectionClassNames(e,this.props.liquid).join(" ")},e.chunks.map((t,i)=>this.renderChunk(e,l,s[i],r[i],t,i,(o[l]||[])[i]||[],n)))}renderChunk(e,l,s,r,o,n,h,c){if("outerContent"in o)return i.createElement(i.Fragment,{key:o.key},o.outerContent);let{state:a}=this,{scrollerClientWidths:d,scrollerClientHeights:f}=a,[g,p]=this.getDims(),S=l*p+n,m=n===(!this.context.isRtl||t.getIsRtlScrollbarOnLeft()?p-1:0),y=l===g-1,R=y&&a.forceXScrollbars,w=m&&a.forceYScrollbars,C=s&&s.allowXScrolling,E=t.getAllowYScrolling(this.props,e),W=t.getSectionHasLiquidHeight(this.props,e),b=e.expandRows&&W,M=s&&s.totalColMinWidth||"",k=t.renderChunkContent(e,o,{tableColGroupNode:r,tableMinWidth:M,clientWidth:void 0!==d[S]?d[S]:null,clientHeight:void 0!==f[S]?f[S]:null,expandRows:b,syncRowHeights:Boolean(e.syncRowHeights),rowSyncHeights:h,reportRowHeightChange:this.handleRowHeightChange},c),v=R?y?"scroll":"scroll-hidden":C?y?"auto":"scroll-hidden":"hidden",x=w?m?"scroll":"scroll-hidden":E?m?"auto":"scroll-hidden":"hidden";return k=i.createElement(u,{ref:this.clippedScrollerRefs.createRef(S),scrollerElRef:this.scrollerElRefs.createRef(S),overflowX:v,overflowY:x,liquid:W,maxHeight:e.maxHeight},k),i.createElement(c?"th":"td",{key:o.key,ref:this.chunkElRefs.createRef(S),role:"presentation"},k)}componentDidMount(){this.getStickyScrolling=t.memoizeArraylike(k),this.getScrollSyncersBySection=t.memoizeHashlike(b.bind(this,!0),null,M),this.getScrollSyncersByColumn=t.memoizeHashlike(b.bind(this,!1),null,M),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.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,s]=this.getDims(),i=l*s,r=[];return e.forEach((e,l)=>{if(e.hasShrinkCol){let e=this.chunkElRefs.collect(l,i,s);r[l]=t.computeShrinkWidth(e)}}),r}computeSectionRowMaxHeights(){let e=new Map,[l,s]=this.getDims(),i=[];for(let r=0;r<l;r+=1){let l=this.props.sections[r],o=[];if(l&&l.syncRowHeights){let i=[];for(let l=0;l<s;l+=1){let o=r*s+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}):[],i.push(n)}let n=i[0].length,h=!0;for(let e=1;e<s;e+=1){if(!(l.chunks[e]&&void 0!==l.chunks[e].outerContent)&&i[e].length!==n){h=!1;break}}if(h){for(let e=0;e<s;e+=1)o.push([]);for(let e=0;e<n;e+=1){let t=[];for(let l=0;l<s;l+=1){let s=i[l][e];null!=s&&t.push(s)}let l=Math.max(...t);for(let e=0;e<s;e+=1)o[e].push(l)}}else{let e=[];for(let t=0;t<s;t+=1)e.push(m(i[t])+i[t].length);let t=Math.max(...e);for(let e=0;e<s;e+=1){let l=i[e].length,s=t-l,r=Math.floor(s/l),n=s-r*(l-1),h=[],c=0;for(c<l&&(h.push(n),c+=1);c<l;)h.push(r),c+=1;o.push(h)}}}i.push(o)}return this.rowInnerMaxHeightMap=e,i}computeScrollerDims(){let e=t.getScrollbarWidths(),[l,s]=this.getDims(),i=!this.context.isRtl||t.getIsRtlScrollbarOnLeft()?s-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*s+i];if(t&&t.needsYScrolling()){h=!0;break}}for(let e=0;e<s;e+=1){let t=o[r*s+e];if(t&&t.needsXScrolling()){c=!0;break}}for(let t=0;t<l;t+=1)for(let l=0;l<s;l+=1){let o=t*s+l,u=n[o];if(u){let s=u.parentNode;a[o]=Math.floor(s.getBoundingClientRect().width-(l===i&&h?e.y:0)),d[o]=Math.floor(s.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]);this.getStickyScrolling(t).forEach(e=>e.updateSize())}updateScrollSyncers(){let[e,l]=this.getDims(),s=e*l,i={},r={},o=this.scrollerElRefs.currentMap;for(let s=0;s<e;s+=1){let e=s*l,r=e+l;i[s]=t.collectFromHash(o,e,r,1)}for(let e=0;e<l;e+=1)r[e]=this.scrollerElRefs.collect(e,s,l);this.scrollSyncersBySection=this.getScrollSyncersBySection(i),this.scrollSyncersByColumn=this.getScrollSyncersByColumn(r)}destroyScrollSyncers(){t.mapHash(this.scrollSyncersBySection,M),t.mapHash(this.scrollSyncersByColumn,M)}getChunkConfigByIndex(e){let t=this.getDims()[1],l=Math.floor(e/t),s=e%t,i=this.props.sections[l];return i&&i.chunks[s]}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 s=this.getChunkConfigByIndex(parseInt(l,10));s&&t.setRef(s.elRef,e)}_handleScrollerEl(e,l){let s=this.getChunkConfigByIndex(parseInt(l,10));s&&t.setRef(s.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=C(e.cols,"width"),s=C(e.cols,"minWidth"),i=t.hasShrinkWidth(e.cols);return{hasShrinkCol:i,totalColWidth:l,totalColMinWidth:s,allowXScrolling:"shrink"!==e.width&&Boolean(l||s||i),cols:e.cols,width:e.width}}function C(e,t){let l=0;for(let s of e){let e=s[t];"number"==typeof e&&(l+=e*(s.span||1))}return l}S.addStateEquality({shrinkWidths:t.isArraysEqual,scrollerClientWidths:t.isPropsEqual,scrollerClientHeights:t.isPropsEqual});const E={cols:t.isColPropsEqual};function W(e,l){return t.compareObjs(e,l,E)}function b(e,...t){return new p(e,t)}function M(e){e.destroy()}function k(e,t){return new d(e,t)}var v=l.createPlugin({name:"@fullcalendar/scrollgrid",premiumReleaseDate:"2022-11-22",deps:[o.default],scrollGridImpl:S}),x={__proto__:null,ScrollGrid:S};return t.globalPlugins.push(v),e.Internal=x,e.default=v,Object.defineProperty(e,"__esModule",{value:!0}),e}({},FullCalendar.Internal,FullCalendar,FullCalendar.PremiumCommon,FullCalendar.Preact); | ||
FullCalendar.ScrollGrid=function(e,t,l,s,i){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var o=r(s);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}())}class d{constructor(e,l){this.scrollEl=e,this.isRtl=l,this.updateSize=()=>{let{scrollEl:e}=this,l=t.findElements(e,".fc-sticky");!function(e,l,s){e.forEach((e,i)=>{let r,{textAlign:o,elWidth:n,parentBound:h}=l[i],c=h.right-h.left;r="center"===o&&c>s?(s-n)/2:"",t.applyStyle(e,{left:r,right:r,top:0})})}(l,this.queryElGeoms(l),e.clientWidth)}}queryElGeoms(e){let{scrollEl:l,isRtl:s}=this,i=function(e){let l=e.getBoundingClientRect(),s=t.computeEdges(e);return{left:l.left+s.borderLeft+s.scrollbarLeft-n(e),top:l.top+s.borderTop-e.scrollTop}}(l),r=[];for(let l of e){let e=t.translateRect(t.computeInnerRect(l.parentNode,!0,!0),-i.left,-i.top),o=l.getBoundingClientRect(),n=window.getComputedStyle(l),h=window.getComputedStyle(l.parentNode).textAlign,c=null;"start"===h?h=s?"right":"left":"end"===h&&(h=s?"left":"right"),"sticky"!==n.position&&(c=t.translateRect(o,-i.left-(parseFloat(n.left)||0),-i.top-(parseFloat(n.top)||0))),r.push({parentBound:e,naturalBound:c,elWidth:o.width,elHeight:o.height,textAlign:h})}return r}}class u extends t.BaseComponent{constructor(){super(...arguments),this.elRef=i.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:s}=this,r=s.isRtl&&t.getIsRtlScrollbarOnLeft(),o=0,n=0,h=0;return"scroll-hidden"===e.overflowX&&(h=l.xScrollbarWidth),"scroll-hidden"===e.overflowY&&null!=l.yScrollbarWidth&&(r?o=l.yScrollbarWidth:n=l.yScrollbarWidth),i.createElement("div",{ref:this.elRef,className:"fc-scroller-harness"+(e.liquid?" fc-scroller-harness-liquid":"")},i.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:o,overcomeRight:n,overcomeBottom:h,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()}}const f="wheel mousewheel DomMouseScroll MozMousePixelScroll".split(" ");class g{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 f)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 f)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}}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,s=new g(e);return s.emitter.on("scroll",(s,i)=>{if(!this.isPaused&&((!this.masterEl||this.masterEl!==e&&(s||i))&&this.assignMaster(e),this.masterEl===e))for(let s of t)s!==e&&(l?s.scrollTop=e.scrollTop:s.scrollLeft=e.scrollLeft)}),s.emitter.on("scrollEnd",()=>{this.masterEl===e&&(this.masterEl=null)}),s}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}}t.config.SCROLLGRID_RESIZE_INTERVAL=500;class S extends t.BaseComponent{constructor(){super(...arguments),this.compileColGroupStats=t.memoizeArraylike(w,W),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.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:s}=this;if(t){l.delete(e);let t=y(e);s.has(e)&&s.get(e)===t||(s.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:s}=this,{shrinkWidths:r}=l,o=this.compileColGroupStats(e.colGroups.map(e=>[e])),n=this.renderMicroColGroups(o.map((e,t)=>[e.cols,r[t]])),h=t.getScrollGridClassNames(e.liquid,s);this.getDims();let c,a=e.sections,d=a.length,u=0,f=[],g=[],p=[];for(;u<d&&"header"===(c=a[u]).type;)f.push(this.renderSection(c,u,o,n,l.sectionRowMaxHeights,!0)),u+=1;for(;u<d&&"body"===(c=a[u]).type;)g.push(this.renderSection(c,u,o,n,l.sectionRowMaxHeights,!1)),u+=1;for(;u<d&&"footer"===(c=a[u]).type;)p.push(this.renderSection(c,u,o,n,l.sectionRowMaxHeights,!0)),u+=1;const S=!t.getCanVGrowWithinCell(),m={role:"rowgroup"};return i.createElement("table",{ref:e.elRef,role:"grid",className:h.join(" ")},function(e,l){let s=e.map((e,s)=>{let r=e.width;return"shrink"===r&&(r=e.totalColWidth+t.sanitizeShrinkWidth(l[s])+1),i.createElement("col",{style:{width:r}})});return i.createElement("colgroup",{},...s)}(o,r),Boolean(!S&&f.length)&&i.createElement("thead",m,...f),Boolean(!S&&g.length)&&i.createElement("tbody",m,...g),Boolean(!S&&p.length)&&i.createElement("tfoot",m,...p),S&&i.createElement("tbody",m,...f,...g,...p))}renderSection(e,l,s,r,o,n){return"outerContent"in e?i.createElement(i.Fragment,{key:e.key},e.outerContent):i.createElement("tr",{key:e.key,role:"presentation",className:t.getSectionClassNames(e,this.props.liquid).join(" ")},e.chunks.map((t,i)=>this.renderChunk(e,l,s[i],r[i],t,i,(o[l]||[])[i]||[],n)))}renderChunk(e,l,s,r,o,n,h,c){if("outerContent"in o)return i.createElement(i.Fragment,{key:o.key},o.outerContent);let{state:a}=this,{scrollerClientWidths:d,scrollerClientHeights:f}=a,[g,p]=this.getDims(),S=l*p+n,m=n===(!this.context.isRtl||t.getIsRtlScrollbarOnLeft()?p-1:0),y=l===g-1,R=y&&a.forceXScrollbars,w=m&&a.forceYScrollbars,C=s&&s.allowXScrolling,E=t.getAllowYScrolling(this.props,e),W=t.getSectionHasLiquidHeight(this.props,e),b=e.expandRows&&W,M=s&&s.totalColMinWidth||"",k=t.renderChunkContent(e,o,{tableColGroupNode:r,tableMinWidth:M,clientWidth:void 0!==d[S]?d[S]:null,clientHeight:void 0!==f[S]?f[S]:null,expandRows:b,syncRowHeights:Boolean(e.syncRowHeights),rowSyncHeights:h,reportRowHeightChange:this.handleRowHeightChange},c),v=R?y?"scroll":"scroll-hidden":C?y?"auto":"scroll-hidden":"hidden",x=w?m?"scroll":"scroll-hidden":E?m?"auto":"scroll-hidden":"hidden";return k=i.createElement(u,{ref:this.clippedScrollerRefs.createRef(S),scrollerElRef:this.scrollerElRefs.createRef(S),overflowX:v,overflowY:x,liquid:W,maxHeight:e.maxHeight},k),i.createElement(c?"th":"td",{key:o.key,ref:this.chunkElRefs.createRef(S),role:"presentation"},k)}componentDidMount(){this.getStickyScrolling=t.memoizeArraylike(k),this.getScrollSyncersBySection=t.memoizeHashlike(b.bind(this,!0),null,M),this.getScrollSyncersByColumn=t.memoizeHashlike(b.bind(this,!1),null,M),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.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,s]=this.getDims(),i=l*s,r=[];return e.forEach((e,l)=>{if(e.hasShrinkCol){let e=this.chunkElRefs.collect(l,i,s);r[l]=t.computeShrinkWidth(e)}}),r}computeSectionRowMaxHeights(){let e=new Map,[l,s]=this.getDims(),i=[];for(let r=0;r<l;r+=1){let l=this.props.sections[r],o=[];if(l&&l.syncRowHeights){let i=[];for(let l=0;l<s;l+=1){let o=r*s+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}):[],i.push(n)}let n=i[0].length,h=!0;for(let e=1;e<s;e+=1){if(!(l.chunks[e]&&void 0!==l.chunks[e].outerContent)&&i[e].length!==n){h=!1;break}}if(h){for(let e=0;e<s;e+=1)o.push([]);for(let e=0;e<n;e+=1){let t=[];for(let l=0;l<s;l+=1){let s=i[l][e];null!=s&&t.push(s)}let l=Math.max(...t);for(let e=0;e<s;e+=1)o[e].push(l)}}else{let e=[];for(let t=0;t<s;t+=1)e.push(m(i[t])+i[t].length);let t=Math.max(...e);for(let e=0;e<s;e+=1){let l=i[e].length,s=t-l,r=Math.floor(s/l),n=s-r*(l-1),h=[],c=0;for(c<l&&(h.push(n),c+=1);c<l;)h.push(r),c+=1;o.push(h)}}}i.push(o)}return this.rowInnerMaxHeightMap=e,i}computeScrollerDims(){let e=t.getScrollbarWidths(),[l,s]=this.getDims(),i=!this.context.isRtl||t.getIsRtlScrollbarOnLeft()?s-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*s+i];if(t&&t.needsYScrolling()){h=!0;break}}for(let e=0;e<s;e+=1){let t=o[r*s+e];if(t&&t.needsXScrolling()){c=!0;break}}for(let t=0;t<l;t+=1)for(let l=0;l<s;l+=1){let o=t*s+l,u=n[o];if(u){let s=u.parentNode;a[o]=Math.floor(s.getBoundingClientRect().width-(l===i&&h?e.y:0)),d[o]=Math.floor(s.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]);this.getStickyScrolling(t).forEach(e=>e.updateSize())}updateScrollSyncers(){let[e,l]=this.getDims(),s=e*l,i={},r={},o=this.scrollerElRefs.currentMap;for(let s=0;s<e;s+=1){let e=s*l,r=e+l;i[s]=t.collectFromHash(o,e,r,1)}for(let e=0;e<l;e+=1)r[e]=this.scrollerElRefs.collect(e,s,l);this.scrollSyncersBySection=this.getScrollSyncersBySection(i),this.scrollSyncersByColumn=this.getScrollSyncersByColumn(r)}destroyScrollSyncers(){t.mapHash(this.scrollSyncersBySection,M),t.mapHash(this.scrollSyncersByColumn,M)}getChunkConfigByIndex(e){let t=this.getDims()[1],l=Math.floor(e/t),s=e%t,i=this.props.sections[l];return i&&i.chunks[s]}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 s=this.getChunkConfigByIndex(parseInt(l,10));s&&t.setRef(s.elRef,e)}_handleScrollerEl(e,l){let s=this.getChunkConfigByIndex(parseInt(l,10));s&&t.setRef(s.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=C(e.cols,"width"),s=C(e.cols,"minWidth"),i=t.hasShrinkWidth(e.cols);return{hasShrinkCol:i,totalColWidth:l,totalColMinWidth:s,allowXScrolling:"shrink"!==e.width&&Boolean(l||s||i),cols:e.cols,width:e.width}}function C(e,t){let l=0;for(let s of e){let e=s[t];"number"==typeof e&&(l+=e*(s.span||1))}return l}S.addStateEquality({shrinkWidths:t.isArraysEqual,scrollerClientWidths:t.isPropsEqual,scrollerClientHeights:t.isPropsEqual});const E={cols:t.isColPropsEqual};function W(e,l){return t.compareObjs(e,l,E)}function b(e,...t){return new p(e,t)}function M(e){e.destroy()}function k(e,t){return new d(e,t)}var v=l.createPlugin({name:"@fullcalendar/scrollgrid",premiumReleaseDate:"2022-12-02",deps:[o.default],scrollGridImpl:S}),x={__proto__:null,ScrollGrid:S};return t.globalPlugins.push(v),e.Internal=x,e.default=v,Object.defineProperty(e,"__esModule",{value:!0}),e}({},FullCalendar.Internal,FullCalendar,FullCalendar.PremiumCommon,FullCalendar.Preact); |
@@ -9,3 +9,3 @@ import { createPlugin } from '@fullcalendar/core/index.js'; | ||
name: '@fullcalendar/scrollgrid', | ||
premiumReleaseDate: '2022-11-22', | ||
premiumReleaseDate: '2022-12-02', | ||
deps: [premiumCommonPlugin], | ||
@@ -12,0 +12,0 @@ scrollGridImpl: ScrollGrid, |
@@ -1,2 +0,2 @@ | ||
import { computeEdges, removeElement, findElements, translateRect, computeInnerRect, applyStyle, BaseComponent, setRef, getIsRtlScrollbarOnLeft, Scroller, isPropsEqual, Emitter, DelayedRunner, config, isArraysEqual, memoizeArraylike, renderMicroColGroup, RefMap, getScrollGridClassNames, getCanVGrowWithinCell, getSectionClassNames, getAllowYScrolling, getSectionHasLiquidHeight, renderChunkContent, memoizeHashlike, computeShrinkWidth, getScrollbarWidths, collectFromHash, mapHash, sanitizeShrinkWidth, hasShrinkWidth, compareObjs, isColPropsEqual } from '@fullcalendar/core/internal.js'; | ||
import { computeEdges, removeElement, findElements, translateRect, computeInnerRect, applyStyle, BaseComponent, setRef, getIsRtlScrollbarOnLeft, Scroller, isPropsEqual, Emitter, DelayedRunner, config, memoizeArraylike, renderMicroColGroup, RefMap, getScrollGridClassNames, getCanVGrowWithinCell, getSectionClassNames, getAllowYScrolling, getSectionHasLiquidHeight, renderChunkContent, memoizeHashlike, computeShrinkWidth, getScrollbarWidths, collectFromHash, mapHash, isArraysEqual, sanitizeShrinkWidth, hasShrinkWidth, compareObjs, isColPropsEqual } from '@fullcalendar/core/internal.js'; | ||
import { createRef, createElement, Fragment } from '@fullcalendar/core/preact.js'; | ||
@@ -3,0 +3,0 @@ |
{ | ||
"name": "@fullcalendar/scrollgrid", | ||
"version": "6.0.0-beta.2", | ||
"version": "6.0.0-beta.3", | ||
"keywords": [ | ||
@@ -28,6 +28,6 @@ "calendar", | ||
"dependencies": { | ||
"@fullcalendar/premium-common": "6.0.0-beta.2" | ||
"@fullcalendar/premium-common": "6.0.0-beta.3" | ||
}, | ||
"peerDependencies": { | ||
"@fullcalendar/core": "6.0.0-beta.2" | ||
"@fullcalendar/core": "6.0.0-beta.3" | ||
}, | ||
@@ -45,6 +45,5 @@ "type": "module", | ||
".": { | ||
"types": "./index.d.ts", | ||
"require": "./index.cjs", | ||
"import": "./index.js", | ||
"types": "./index.d.ts", | ||
"default": "./index.global.js" | ||
"import": "./index.js" | ||
}, | ||
@@ -54,7 +53,8 @@ "./internal.cjs": "./internal.cjs", | ||
"./internal": { | ||
"types": "./internal.d.ts", | ||
"require": "./internal.cjs", | ||
"import": "./internal.js", | ||
"types": "./internal.d.ts" | ||
"import": "./internal.js" | ||
} | ||
} | ||
}, | ||
"sideEffects": false | ||
} |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
141293
+ Added@fullcalendar/core@6.0.0-beta.3(transitive)
+ Added@fullcalendar/premium-common@6.0.0-beta.3(transitive)
- Removed@fullcalendar/core@6.0.0-beta.2(transitive)
- Removed@fullcalendar/premium-common@6.0.0-beta.2(transitive)