@fullcalendar/scrollgrid 6.1.0 → 6.1.3
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/index.cjs +22 -0
- package/index.global.js +3 -3
- package/index.global.min.js +3 -3
- package/index.js +10 -18
- package/{internal.esm.js → internal.cjs} +66 -62
- package/internal.js +62 -66
- package/package.json +12 -10
- package/index.esm.js +0 -14
package/index.cjs
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var index_cjs = require('@fullcalendar/core/index.cjs');
|
|
6
|
+
var premiumCommonPlugin = require('@fullcalendar/premium-common/index.cjs');
|
|
7
|
+
var internalCommon = require('./internal.cjs');
|
|
8
|
+
require('@fullcalendar/core/internal.cjs');
|
|
9
|
+
require('@fullcalendar/core/preact.cjs');
|
|
10
|
+
|
|
11
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
12
|
+
|
|
13
|
+
var premiumCommonPlugin__default = /*#__PURE__*/_interopDefaultLegacy(premiumCommonPlugin);
|
|
14
|
+
|
|
15
|
+
var index = index_cjs.createPlugin({
|
|
16
|
+
name: '@fullcalendar/scrollgrid',
|
|
17
|
+
premiumReleaseDate: '2023-02-07',
|
|
18
|
+
deps: [premiumCommonPlugin__default["default"]],
|
|
19
|
+
scrollGridImpl: internalCommon.ScrollGrid,
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
exports["default"] = index;
|
package/index.global.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
FullCalendar ScrollGrid Plugin v6.1.
|
|
2
|
+
FullCalendar ScrollGrid Plugin v6.1.3
|
|
3
3
|
Docs & License: https://fullcalendar.io/docs/premium
|
|
4
|
-
(c)
|
|
4
|
+
(c) 2023 Adam Shaw
|
|
5
5
|
*/
|
|
6
6
|
FullCalendar.ScrollGrid = (function (exports, core, premiumCommonPlugin, internal$1, preact) {
|
|
7
7
|
'use strict';
|
|
@@ -838,7 +838,7 @@ FullCalendar.ScrollGrid = (function (exports, core, premiumCommonPlugin, interna
|
|
|
838
838
|
|
|
839
839
|
var plugin = core.createPlugin({
|
|
840
840
|
name: '@fullcalendar/scrollgrid',
|
|
841
|
-
premiumReleaseDate: '2023-
|
|
841
|
+
premiumReleaseDate: '2023-02-07',
|
|
842
842
|
deps: [premiumCommonPlugin__default["default"]],
|
|
843
843
|
scrollGridImpl: ScrollGrid,
|
|
844
844
|
});
|
package/index.global.min.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
FullCalendar ScrollGrid Plugin v6.1.
|
|
2
|
+
FullCalendar ScrollGrid Plugin v6.1.3
|
|
3
3
|
Docs & License: https://fullcalendar.io/docs/premium
|
|
4
|
-
(c)
|
|
4
|
+
(c) 2023 Adam Shaw
|
|
5
5
|
*/
|
|
6
|
-
FullCalendar.ScrollGrid=function(e,t,l,s,i){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var o=r(l);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,t=document.createElement("div");t.style.position="absolute",t.style.top="-1000px",t.style.width="1px",t.style.height="1px",t.style.overflow="scroll",t.style.direction="rtl",t.style.fontSize="100px",t.innerHTML="A",document.body.appendChild(t),t.scrollLeft>0?e="positive":(t.scrollLeft=1,e=t.scrollLeft>0?"reverse":"negative");return s.removeElement(t),e}())}class d{constructor(e,t){this.scrollEl=e,this.isRtl=t,this.updateSize=()=>{let{scrollEl:e}=this,t=s.findElements(e,".fc-sticky");!function(e,t,l){e.forEach((e,i)=>{let r,{textAlign:o,elWidth:n,parentBound:h}=t[i],c=h.right-h.left;r="center"===o&&c>l?(l-n)/2:"",s.applyStyle(e,{left:r,right:r,top:0})})}(t,this.queryElGeoms(t),e.clientWidth)}}queryElGeoms(e){let{scrollEl:t,isRtl:l}=this,i=function(e){let t=e.getBoundingClientRect(),l=s.computeEdges(e);return{left:t.left+l.borderLeft+l.scrollbarLeft-n(e),top:t.top+l.borderTop-e.scrollTop}}(t),r=[];for(let t of e){let e=s.translateRect(s.computeInnerRect(t.parentNode,!0,!0),-i.left,-i.top),o=t.getBoundingClientRect(),n=window.getComputedStyle(t),h=window.getComputedStyle(t.parentNode).textAlign,c=null;"start"===h?h=l?"right":"left":"end"===h&&(h=l?"left":"right"),"sticky"!==n.position&&(c=s.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 s.BaseComponent{constructor(){super(...arguments),this.elRef=i.createRef(),this.state={xScrollbarWidth:0,yScrollbarWidth:0},this.handleScroller=e=>{this.scroller=e,s.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:t,context:l}=this,r=l.isRtl&&s.getIsRtlScrollbarOnLeft(),o=0,n=0,h=0;return"scroll-hidden"===e.overflowX&&(h=t.xScrollbarWidth),"scroll-hidden"===e.overflowY&&null!=t.yScrollbarWidth&&(r?o=t.yScrollbarWidth:n=t.yScrollbarWidth),i.createElement("div",{ref:this.elRef,className:"fc-scroller-harness"+(e.liquid?" fc-scroller-harness-liquid":"")},i.createElement(s.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?t.xScrollbarWidth:0):"",liquid:e.liquid,liquidIsAbsolute:!0},e.children))}componentDidMount(){this.handleSizing(),this.context.addResizeHandler(this.handleSizing)}componentDidUpdate(e){s.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 s.Emitter,this.isScrolling=!1,this.isTouching=!1,this.isRecentlyWheeled=!1,this.isRecentlyScrolled=!1,this.wheelWaiter=new s.DelayedRunner(this._handleWheelWaited.bind(this)),this.scrollWaiter=new s.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}}s.config.SCROLLGRID_RESIZE_INTERVAL=500;class S extends s.BaseComponent{constructor(){super(...arguments),this.compileColGroupStats=s.memoizeArraylike(w,W),this.renderMicroColGroups=s.memoizeArraylike(s.renderMicroColGroup),this.clippedScrollerRefs=new s.RefMap,this.scrollerElRefs=new s.RefMap(this._handleScrollerEl.bind(this)),this.chunkElRefs=new s.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:t,context:l}=this,{shrinkWidths:r}=t,o=this.compileColGroupStats(e.colGroups.map(e=>[e])),n=this.renderMicroColGroups(o.map((e,t)=>[e.cols,r[t]])),h=s.getScrollGridClassNames(e.liquid,l);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,t.sectionRowMaxHeights,!0)),u+=1;for(;u<d&&"body"===(c=a[u]).type;)g.push(this.renderSection(c,u,o,n,t.sectionRowMaxHeights,!1)),u+=1;for(;u<d&&"footer"===(c=a[u]).type;)p.push(this.renderSection(c,u,o,n,t.sectionRowMaxHeights,!0)),u+=1;const S=!s.getCanVGrowWithinCell(),m={role:"rowgroup"};return i.createElement("table",{ref:e.elRef,role:"grid",className:h.join(" ")},function(e,t){let l=e.map((e,l)=>{let r=e.width;return"shrink"===r&&(r=e.totalColWidth+s.sanitizeShrinkWidth(t[l])+1),i.createElement("col",{style:{width:r}})});return i.createElement("colgroup",{},...l)}(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,t,l,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:s.getSectionClassNames(e,this.props.liquid).join(" ")},e.chunks.map((s,i)=>this.renderChunk(e,t,l[i],r[i],s,i,(o[t]||[])[i]||[],n)))}renderChunk(e,t,l,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=t*p+n,m=n===(!this.context.isRtl||s.getIsRtlScrollbarOnLeft()?p-1:0),y=t===g-1,R=y&&a.forceXScrollbars,w=m&&a.forceYScrollbars,C=l&&l.allowXScrolling,E=s.getAllowYScrolling(this.props,e),W=s.getSectionHasLiquidHeight(this.props,e),b=e.expandRows&&W,M=l&&l.totalColMinWidth||"",k=s.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=s.memoizeArraylike(k),this.getScrollSyncersBySection=s.memoizeHashlike(b.bind(this,!0),null,M),this.getScrollSyncersByColumn=s.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()+s.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])),[t,l]=this.getDims(),i=t*l,r=[];return e.forEach((e,t)=>{if(e.hasShrinkCol){let e=this.chunkElRefs.collect(t,i,l);r[t]=s.computeShrinkWidth(e)}}),r}computeSectionRowMaxHeights(){let e=new Map,[t,l]=this.getDims(),i=[];for(let r=0;r<t;r+=1){let t=this.props.sections[r],o=[];if(t&&t.syncRowHeights){let i=[];for(let t=0;t<l;t+=1){let o=r*l+t,n=[],h=this.chunkElRefs.currentMap[o];n=h?s.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<l;e+=1){if(!(t.chunks[e]&&void 0!==t.chunks[e].outerContent)&&i[e].length!==n){h=!1;break}}if(h){for(let e=0;e<l;e+=1)o.push([]);for(let e=0;e<n;e+=1){let t=[];for(let s=0;s<l;s+=1){let l=i[s][e];null!=l&&t.push(l)}let s=Math.max(...t);for(let e=0;e<l;e+=1)o[e].push(s)}}else{let e=[];for(let t=0;t<l;t+=1)e.push(m(i[t])+i[t].length);let t=Math.max(...e);for(let e=0;e<l;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=s.getScrollbarWidths(),[t,l]=this.getDims(),i=!this.context.isRtl||s.getIsRtlScrollbarOnLeft()?l-1:0,r=t-1,o=this.clippedScrollerRefs.currentMap,n=this.scrollerElRefs.currentMap,h=!1,c=!1,a={},d={};for(let e=0;e<t;e+=1){let t=o[e*l+i];if(t&&t.needsYScrolling()){h=!0;break}}for(let e=0;e<l;e+=1){let t=o[r*l+e];if(t&&t.needsXScrolling()){c=!0;break}}for(let s=0;s<t;s+=1)for(let t=0;t<l;t+=1){let o=s*l+t,u=n[o];if(u){let l=u.parentNode;a[o]=Math.floor(l.getBoundingClientRect().width-(t===i&&h?e.y:0)),d[o]=Math.floor(l.getBoundingClientRect().height-(s===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,t]=this.getDims(),l=e*t,i={},r={},o=this.scrollerElRefs.currentMap;for(let l=0;l<e;l+=1){let e=l*t,r=e+t;i[l]=s.collectFromHash(o,e,r,1)}for(let e=0;e<t;e+=1)r[e]=this.scrollerElRefs.collect(e,l,t);this.scrollSyncersBySection=this.getScrollSyncersBySection(i),this.scrollSyncersByColumn=this.getScrollSyncersByColumn(r)}destroyScrollSyncers(){s.mapHash(this.scrollSyncersBySection,M),s.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,t){let l=this.getChunkConfigByIndex(parseInt(t,10));l&&s.setRef(l.elRef,e)}_handleScrollerEl(e,t){let l=this.getChunkConfigByIndex(parseInt(t,10));l&&s.setRef(l.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 t=s.findElements(e,".fc-scrollgrid-sync-inner").map(R);return t.length?Math.max(...t):0}function R(e){return e.offsetHeight}function w(e){let t=C(e.cols,"width"),l=C(e.cols,"minWidth"),i=s.hasShrinkWidth(e.cols);return{hasShrinkCol:i,totalColWidth:t,totalColMinWidth:l,allowXScrolling:"shrink"!==e.width&&Boolean(t||l||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:s.isArraysEqual,scrollerClientWidths:s.isPropsEqual,scrollerClientHeights:s.isPropsEqual});const E={cols:s.isColPropsEqual};function W(e,t){return s.compareObjs(e,t,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=t.createPlugin({name:"@fullcalendar/scrollgrid",premiumReleaseDate:"2023-01-30",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,FullCalendar.PremiumCommon,FullCalendar.Internal,FullCalendar.Preact);
|
|
6
|
+
FullCalendar.ScrollGrid=function(e,t,l,s,i){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var o=r(l);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,t=document.createElement("div");t.style.position="absolute",t.style.top="-1000px",t.style.width="1px",t.style.height="1px",t.style.overflow="scroll",t.style.direction="rtl",t.style.fontSize="100px",t.innerHTML="A",document.body.appendChild(t),t.scrollLeft>0?e="positive":(t.scrollLeft=1,e=t.scrollLeft>0?"reverse":"negative");return s.removeElement(t),e}())}class d{constructor(e,t){this.scrollEl=e,this.isRtl=t,this.updateSize=()=>{let{scrollEl:e}=this,t=s.findElements(e,".fc-sticky");!function(e,t,l){e.forEach((e,i)=>{let r,{textAlign:o,elWidth:n,parentBound:h}=t[i],c=h.right-h.left;r="center"===o&&c>l?(l-n)/2:"",s.applyStyle(e,{left:r,right:r,top:0})})}(t,this.queryElGeoms(t),e.clientWidth)}}queryElGeoms(e){let{scrollEl:t,isRtl:l}=this,i=function(e){let t=e.getBoundingClientRect(),l=s.computeEdges(e);return{left:t.left+l.borderLeft+l.scrollbarLeft-n(e),top:t.top+l.borderTop-e.scrollTop}}(t),r=[];for(let t of e){let e=s.translateRect(s.computeInnerRect(t.parentNode,!0,!0),-i.left,-i.top),o=t.getBoundingClientRect(),n=window.getComputedStyle(t),h=window.getComputedStyle(t.parentNode).textAlign,c=null;"start"===h?h=l?"right":"left":"end"===h&&(h=l?"left":"right"),"sticky"!==n.position&&(c=s.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 s.BaseComponent{constructor(){super(...arguments),this.elRef=i.createRef(),this.state={xScrollbarWidth:0,yScrollbarWidth:0},this.handleScroller=e=>{this.scroller=e,s.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:t,context:l}=this,r=l.isRtl&&s.getIsRtlScrollbarOnLeft(),o=0,n=0,h=0;return"scroll-hidden"===e.overflowX&&(h=t.xScrollbarWidth),"scroll-hidden"===e.overflowY&&null!=t.yScrollbarWidth&&(r?o=t.yScrollbarWidth:n=t.yScrollbarWidth),i.createElement("div",{ref:this.elRef,className:"fc-scroller-harness"+(e.liquid?" fc-scroller-harness-liquid":"")},i.createElement(s.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?t.xScrollbarWidth:0):"",liquid:e.liquid,liquidIsAbsolute:!0},e.children))}componentDidMount(){this.handleSizing(),this.context.addResizeHandler(this.handleSizing)}componentDidUpdate(e){s.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 s.Emitter,this.isScrolling=!1,this.isTouching=!1,this.isRecentlyWheeled=!1,this.isRecentlyScrolled=!1,this.wheelWaiter=new s.DelayedRunner(this._handleWheelWaited.bind(this)),this.scrollWaiter=new s.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}}s.config.SCROLLGRID_RESIZE_INTERVAL=500;class S extends s.BaseComponent{constructor(){super(...arguments),this.compileColGroupStats=s.memoizeArraylike(w,W),this.renderMicroColGroups=s.memoizeArraylike(s.renderMicroColGroup),this.clippedScrollerRefs=new s.RefMap,this.scrollerElRefs=new s.RefMap(this._handleScrollerEl.bind(this)),this.chunkElRefs=new s.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:t,context:l}=this,{shrinkWidths:r}=t,o=this.compileColGroupStats(e.colGroups.map(e=>[e])),n=this.renderMicroColGroups(o.map((e,t)=>[e.cols,r[t]])),h=s.getScrollGridClassNames(e.liquid,l);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,t.sectionRowMaxHeights,!0)),u+=1;for(;u<d&&"body"===(c=a[u]).type;)g.push(this.renderSection(c,u,o,n,t.sectionRowMaxHeights,!1)),u+=1;for(;u<d&&"footer"===(c=a[u]).type;)p.push(this.renderSection(c,u,o,n,t.sectionRowMaxHeights,!0)),u+=1;const S=!s.getCanVGrowWithinCell(),m={role:"rowgroup"};return i.createElement("table",{ref:e.elRef,role:"grid",className:h.join(" ")},function(e,t){let l=e.map((e,l)=>{let r=e.width;return"shrink"===r&&(r=e.totalColWidth+s.sanitizeShrinkWidth(t[l])+1),i.createElement("col",{style:{width:r}})});return i.createElement("colgroup",{},...l)}(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,t,l,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:s.getSectionClassNames(e,this.props.liquid).join(" ")},e.chunks.map((s,i)=>this.renderChunk(e,t,l[i],r[i],s,i,(o[t]||[])[i]||[],n)))}renderChunk(e,t,l,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=t*p+n,m=n===(!this.context.isRtl||s.getIsRtlScrollbarOnLeft()?p-1:0),y=t===g-1,R=y&&a.forceXScrollbars,w=m&&a.forceYScrollbars,C=l&&l.allowXScrolling,E=s.getAllowYScrolling(this.props,e),W=s.getSectionHasLiquidHeight(this.props,e),b=e.expandRows&&W,M=l&&l.totalColMinWidth||"",k=s.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=s.memoizeArraylike(k),this.getScrollSyncersBySection=s.memoizeHashlike(b.bind(this,!0),null,M),this.getScrollSyncersByColumn=s.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()+s.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])),[t,l]=this.getDims(),i=t*l,r=[];return e.forEach((e,t)=>{if(e.hasShrinkCol){let e=this.chunkElRefs.collect(t,i,l);r[t]=s.computeShrinkWidth(e)}}),r}computeSectionRowMaxHeights(){let e=new Map,[t,l]=this.getDims(),i=[];for(let r=0;r<t;r+=1){let t=this.props.sections[r],o=[];if(t&&t.syncRowHeights){let i=[];for(let t=0;t<l;t+=1){let o=r*l+t,n=[],h=this.chunkElRefs.currentMap[o];n=h?s.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<l;e+=1){if(!(t.chunks[e]&&void 0!==t.chunks[e].outerContent)&&i[e].length!==n){h=!1;break}}if(h){for(let e=0;e<l;e+=1)o.push([]);for(let e=0;e<n;e+=1){let t=[];for(let s=0;s<l;s+=1){let l=i[s][e];null!=l&&t.push(l)}let s=Math.max(...t);for(let e=0;e<l;e+=1)o[e].push(s)}}else{let e=[];for(let t=0;t<l;t+=1)e.push(m(i[t])+i[t].length);let t=Math.max(...e);for(let e=0;e<l;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=s.getScrollbarWidths(),[t,l]=this.getDims(),i=!this.context.isRtl||s.getIsRtlScrollbarOnLeft()?l-1:0,r=t-1,o=this.clippedScrollerRefs.currentMap,n=this.scrollerElRefs.currentMap,h=!1,c=!1,a={},d={};for(let e=0;e<t;e+=1){let t=o[e*l+i];if(t&&t.needsYScrolling()){h=!0;break}}for(let e=0;e<l;e+=1){let t=o[r*l+e];if(t&&t.needsXScrolling()){c=!0;break}}for(let s=0;s<t;s+=1)for(let t=0;t<l;t+=1){let o=s*l+t,u=n[o];if(u){let l=u.parentNode;a[o]=Math.floor(l.getBoundingClientRect().width-(t===i&&h?e.y:0)),d[o]=Math.floor(l.getBoundingClientRect().height-(s===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,t]=this.getDims(),l=e*t,i={},r={},o=this.scrollerElRefs.currentMap;for(let l=0;l<e;l+=1){let e=l*t,r=e+t;i[l]=s.collectFromHash(o,e,r,1)}for(let e=0;e<t;e+=1)r[e]=this.scrollerElRefs.collect(e,l,t);this.scrollSyncersBySection=this.getScrollSyncersBySection(i),this.scrollSyncersByColumn=this.getScrollSyncersByColumn(r)}destroyScrollSyncers(){s.mapHash(this.scrollSyncersBySection,M),s.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,t){let l=this.getChunkConfigByIndex(parseInt(t,10));l&&s.setRef(l.elRef,e)}_handleScrollerEl(e,t){let l=this.getChunkConfigByIndex(parseInt(t,10));l&&s.setRef(l.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 t=s.findElements(e,".fc-scrollgrid-sync-inner").map(R);return t.length?Math.max(...t):0}function R(e){return e.offsetHeight}function w(e){let t=C(e.cols,"width"),l=C(e.cols,"minWidth"),i=s.hasShrinkWidth(e.cols);return{hasShrinkCol:i,totalColWidth:t,totalColMinWidth:l,allowXScrolling:"shrink"!==e.width&&Boolean(t||l||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:s.isArraysEqual,scrollerClientWidths:s.isPropsEqual,scrollerClientHeights:s.isPropsEqual});const E={cols:s.isColPropsEqual};function W(e,t){return s.compareObjs(e,t,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=t.createPlugin({name:"@fullcalendar/scrollgrid",premiumReleaseDate:"2023-02-07",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,FullCalendar.PremiumCommon,FullCalendar.Internal,FullCalendar.Preact);
|
package/index.js
CHANGED
|
@@ -1,22 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
import { createPlugin } from '@fullcalendar/core';
|
|
2
|
+
import premiumCommonPlugin from '@fullcalendar/premium-common';
|
|
3
|
+
import { ScrollGrid } from './internal.js';
|
|
4
|
+
import '@fullcalendar/core/internal';
|
|
5
|
+
import '@fullcalendar/core/preact';
|
|
2
6
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var core = require('@fullcalendar/core');
|
|
6
|
-
var premiumCommonPlugin = require('@fullcalendar/premium-common');
|
|
7
|
-
var internalCommon = require('./internal.js');
|
|
8
|
-
require('@fullcalendar/core/internal');
|
|
9
|
-
require('@fullcalendar/core/preact');
|
|
10
|
-
|
|
11
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
12
|
-
|
|
13
|
-
var premiumCommonPlugin__default = /*#__PURE__*/_interopDefaultLegacy(premiumCommonPlugin);
|
|
14
|
-
|
|
15
|
-
var index = core.createPlugin({
|
|
7
|
+
var index = createPlugin({
|
|
16
8
|
name: '@fullcalendar/scrollgrid',
|
|
17
|
-
premiumReleaseDate: '2023-
|
|
18
|
-
deps: [
|
|
19
|
-
scrollGridImpl:
|
|
9
|
+
premiumReleaseDate: '2023-02-07',
|
|
10
|
+
deps: [premiumCommonPlugin],
|
|
11
|
+
scrollGridImpl: ScrollGrid,
|
|
20
12
|
});
|
|
21
13
|
|
|
22
|
-
|
|
14
|
+
export { index as default };
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var internal_cjs = require('@fullcalendar/core/internal.cjs');
|
|
6
|
+
var preact_cjs = require('@fullcalendar/core/preact.cjs');
|
|
3
7
|
|
|
4
8
|
// TODO: assume the el has no borders?
|
|
5
9
|
function getScrollCanvasOrigin(scrollEl) {
|
|
6
10
|
let rect = scrollEl.getBoundingClientRect();
|
|
7
|
-
let edges = computeEdges(scrollEl); // TODO: pass in isRtl?
|
|
11
|
+
let edges = internal_cjs.computeEdges(scrollEl); // TODO: pass in isRtl?
|
|
8
12
|
return {
|
|
9
13
|
left: rect.left + edges.borderLeft + edges.scrollbarLeft - getScrollFromLeftEdge(scrollEl),
|
|
10
14
|
top: rect.top + edges.borderTop - scrollEl.scrollTop,
|
|
@@ -67,7 +71,7 @@ function detectRtlScrollSystem() {
|
|
|
67
71
|
system = 'negative'; // scroll is a negative number from the right edge
|
|
68
72
|
}
|
|
69
73
|
}
|
|
70
|
-
removeElement(el);
|
|
74
|
+
internal_cjs.removeElement(el);
|
|
71
75
|
return system;
|
|
72
76
|
}
|
|
73
77
|
|
|
@@ -86,7 +90,7 @@ class StickyScrolling {
|
|
|
86
90
|
this.isRtl = isRtl;
|
|
87
91
|
this.updateSize = () => {
|
|
88
92
|
let { scrollEl } = this;
|
|
89
|
-
let els = findElements(scrollEl, STICKY_SELECTOR);
|
|
93
|
+
let els = internal_cjs.findElements(scrollEl, STICKY_SELECTOR);
|
|
90
94
|
let elGeoms = this.queryElGeoms(els);
|
|
91
95
|
let viewportWidth = scrollEl.clientWidth;
|
|
92
96
|
assignStickyPositions(els, elGeoms, viewportWidth);
|
|
@@ -97,7 +101,7 @@ class StickyScrolling {
|
|
|
97
101
|
let canvasOrigin = getScrollCanvasOrigin(scrollEl);
|
|
98
102
|
let elGeoms = [];
|
|
99
103
|
for (let el of els) {
|
|
100
|
-
let parentBound = translateRect(computeInnerRect(el.parentNode, true, true), // weird way to call this!!!
|
|
104
|
+
let parentBound = internal_cjs.translateRect(internal_cjs.computeInnerRect(el.parentNode, true, true), // weird way to call this!!!
|
|
101
105
|
-canvasOrigin.left, -canvasOrigin.top);
|
|
102
106
|
let elRect = el.getBoundingClientRect();
|
|
103
107
|
let computedStyles = window.getComputedStyle(el);
|
|
@@ -110,7 +114,7 @@ class StickyScrolling {
|
|
|
110
114
|
textAlign = isRtl ? 'left' : 'right';
|
|
111
115
|
}
|
|
112
116
|
if (computedStyles.position !== 'sticky') {
|
|
113
|
-
naturalBound = translateRect(elRect, -canvasOrigin.left - (parseFloat(computedStyles.left) || 0), // could be 'auto'
|
|
117
|
+
naturalBound = internal_cjs.translateRect(elRect, -canvasOrigin.left - (parseFloat(computedStyles.left) || 0), // could be 'auto'
|
|
114
118
|
-canvasOrigin.top - (parseFloat(computedStyles.top) || 0));
|
|
115
119
|
}
|
|
116
120
|
elGeoms.push({
|
|
@@ -136,7 +140,7 @@ function assignStickyPositions(els, elGeoms, viewportWidth) {
|
|
|
136
140
|
else { // if parent container can be completely in view, we don't need stickiness
|
|
137
141
|
left = '';
|
|
138
142
|
}
|
|
139
|
-
applyStyle(el, {
|
|
143
|
+
internal_cjs.applyStyle(el, {
|
|
140
144
|
left,
|
|
141
145
|
right: left,
|
|
142
146
|
top: 0,
|
|
@@ -144,17 +148,17 @@ function assignStickyPositions(els, elGeoms, viewportWidth) {
|
|
|
144
148
|
});
|
|
145
149
|
}
|
|
146
150
|
|
|
147
|
-
class ClippedScroller extends BaseComponent {
|
|
151
|
+
class ClippedScroller extends internal_cjs.BaseComponent {
|
|
148
152
|
constructor() {
|
|
149
153
|
super(...arguments);
|
|
150
|
-
this.elRef = createRef();
|
|
154
|
+
this.elRef = preact_cjs.createRef();
|
|
151
155
|
this.state = {
|
|
152
156
|
xScrollbarWidth: 0,
|
|
153
157
|
yScrollbarWidth: 0,
|
|
154
158
|
};
|
|
155
159
|
this.handleScroller = (scroller) => {
|
|
156
160
|
this.scroller = scroller;
|
|
157
|
-
setRef(this.props.scrollerRef, scroller);
|
|
161
|
+
internal_cjs.setRef(this.props.scrollerRef, scroller);
|
|
158
162
|
};
|
|
159
163
|
this.handleSizing = () => {
|
|
160
164
|
let { props } = this;
|
|
@@ -168,7 +172,7 @@ class ClippedScroller extends BaseComponent {
|
|
|
168
172
|
}
|
|
169
173
|
render() {
|
|
170
174
|
let { props, state, context } = this;
|
|
171
|
-
let isScrollbarOnLeft = context.isRtl && getIsRtlScrollbarOnLeft();
|
|
175
|
+
let isScrollbarOnLeft = context.isRtl && internal_cjs.getIsRtlScrollbarOnLeft();
|
|
172
176
|
let overcomeLeft = 0;
|
|
173
177
|
let overcomeRight = 0;
|
|
174
178
|
let overcomeBottom = 0;
|
|
@@ -185,8 +189,8 @@ class ClippedScroller extends BaseComponent {
|
|
|
185
189
|
}
|
|
186
190
|
}
|
|
187
191
|
}
|
|
188
|
-
return (createElement("div", { ref: this.elRef, className: 'fc-scroller-harness' + (props.liquid ? ' fc-scroller-harness-liquid' : '') },
|
|
189
|
-
createElement(Scroller, { ref: this.handleScroller, elRef: this.props.scrollerElRef, overflowX: props.overflowX === 'scroll-hidden' ? 'scroll' : props.overflowX, overflowY: props.overflowY === 'scroll-hidden' ? 'scroll' : props.overflowY, overcomeLeft: overcomeLeft, overcomeRight: overcomeRight, overcomeBottom: overcomeBottom, maxHeight: typeof props.maxHeight === 'number'
|
|
192
|
+
return (preact_cjs.createElement("div", { ref: this.elRef, className: 'fc-scroller-harness' + (props.liquid ? ' fc-scroller-harness-liquid' : '') },
|
|
193
|
+
preact_cjs.createElement(internal_cjs.Scroller, { ref: this.handleScroller, elRef: this.props.scrollerElRef, overflowX: props.overflowX === 'scroll-hidden' ? 'scroll' : props.overflowX, overflowY: props.overflowY === 'scroll-hidden' ? 'scroll' : props.overflowY, overcomeLeft: overcomeLeft, overcomeRight: overcomeRight, overcomeBottom: overcomeBottom, maxHeight: typeof props.maxHeight === 'number'
|
|
190
194
|
? (props.maxHeight + (props.overflowX === 'scroll-hidden' ? state.xScrollbarWidth : 0))
|
|
191
195
|
: '', liquid: props.liquid, liquidIsAbsolute: true }, props.children)));
|
|
192
196
|
}
|
|
@@ -195,7 +199,7 @@ class ClippedScroller extends BaseComponent {
|
|
|
195
199
|
this.context.addResizeHandler(this.handleSizing);
|
|
196
200
|
}
|
|
197
201
|
componentDidUpdate(prevProps) {
|
|
198
|
-
if (!isPropsEqual(prevProps, this.props)) { // an external change?
|
|
202
|
+
if (!internal_cjs.isPropsEqual(prevProps, this.props)) { // an external change?
|
|
199
203
|
this.handleSizing();
|
|
200
204
|
}
|
|
201
205
|
}
|
|
@@ -217,13 +221,13 @@ ALSO, with the ability to disable touch
|
|
|
217
221
|
class ScrollListener {
|
|
218
222
|
constructor(el) {
|
|
219
223
|
this.el = el;
|
|
220
|
-
this.emitter = new Emitter();
|
|
224
|
+
this.emitter = new internal_cjs.Emitter();
|
|
221
225
|
this.isScrolling = false;
|
|
222
226
|
this.isTouching = false; // user currently has finger down?
|
|
223
227
|
this.isRecentlyWheeled = false;
|
|
224
228
|
this.isRecentlyScrolled = false;
|
|
225
|
-
this.wheelWaiter = new DelayedRunner(this._handleWheelWaited.bind(this));
|
|
226
|
-
this.scrollWaiter = new DelayedRunner(this._handleScrollWaited.bind(this));
|
|
229
|
+
this.wheelWaiter = new internal_cjs.DelayedRunner(this._handleWheelWaited.bind(this));
|
|
230
|
+
this.scrollWaiter = new internal_cjs.DelayedRunner(this._handleScrollWaited.bind(this));
|
|
227
231
|
// Handlers
|
|
228
232
|
// ----------------------------------------------------------------------------------------------
|
|
229
233
|
this.handleScroll = () => {
|
|
@@ -366,20 +370,20 @@ class ScrollSyncer {
|
|
|
366
370
|
}
|
|
367
371
|
}
|
|
368
372
|
|
|
369
|
-
config.SCROLLGRID_RESIZE_INTERVAL = 500;
|
|
373
|
+
internal_cjs.config.SCROLLGRID_RESIZE_INTERVAL = 500;
|
|
370
374
|
/*
|
|
371
375
|
TODO: make <ScrollGridSection> subcomponent
|
|
372
376
|
NOTE: doesn't support collapsibleWidth (which is sortof a hack anyway)
|
|
373
377
|
*/
|
|
374
|
-
class ScrollGrid extends BaseComponent {
|
|
378
|
+
class ScrollGrid extends internal_cjs.BaseComponent {
|
|
375
379
|
constructor() {
|
|
376
380
|
super(...arguments);
|
|
377
|
-
this.compileColGroupStats = memoizeArraylike(compileColGroupStat, isColGroupStatsEqual);
|
|
378
|
-
this.renderMicroColGroups = memoizeArraylike(renderMicroColGroup); // yucky to memoize VNodes, but much more efficient for consumers
|
|
379
|
-
this.clippedScrollerRefs = new RefMap();
|
|
381
|
+
this.compileColGroupStats = internal_cjs.memoizeArraylike(compileColGroupStat, isColGroupStatsEqual);
|
|
382
|
+
this.renderMicroColGroups = internal_cjs.memoizeArraylike(internal_cjs.renderMicroColGroup); // yucky to memoize VNodes, but much more efficient for consumers
|
|
383
|
+
this.clippedScrollerRefs = new internal_cjs.RefMap();
|
|
380
384
|
// doesn't hold non-scrolling els used just for padding
|
|
381
|
-
this.scrollerElRefs = new RefMap(this._handleScrollerEl.bind(this));
|
|
382
|
-
this.chunkElRefs = new RefMap(this._handleChunkEl.bind(this));
|
|
385
|
+
this.scrollerElRefs = new internal_cjs.RefMap(this._handleScrollerEl.bind(this));
|
|
386
|
+
this.chunkElRefs = new internal_cjs.RefMap(this._handleChunkEl.bind(this));
|
|
383
387
|
this.scrollSyncersBySection = {};
|
|
384
388
|
this.scrollSyncersByColumn = {};
|
|
385
389
|
// for row-height-syncing
|
|
@@ -439,7 +443,7 @@ class ScrollGrid extends BaseComponent {
|
|
|
439
443
|
let { shrinkWidths } = state;
|
|
440
444
|
let colGroupStats = this.compileColGroupStats(props.colGroups.map((colGroup) => [colGroup]));
|
|
441
445
|
let microColGroupNodes = this.renderMicroColGroups(colGroupStats.map((stat, i) => [stat.cols, shrinkWidths[i]]));
|
|
442
|
-
let classNames = getScrollGridClassNames(props.liquid, context);
|
|
446
|
+
let classNames = internal_cjs.getScrollGridClassNames(props.liquid, context);
|
|
443
447
|
this.getDims();
|
|
444
448
|
// TODO: make DRY
|
|
445
449
|
let sectionConfigs = props.sections;
|
|
@@ -461,39 +465,39 @@ class ScrollGrid extends BaseComponent {
|
|
|
461
465
|
footSectionNodes.push(this.renderSection(currentConfig, configI, colGroupStats, microColGroupNodes, state.sectionRowMaxHeights, true));
|
|
462
466
|
configI += 1;
|
|
463
467
|
}
|
|
464
|
-
const isBuggy = !getCanVGrowWithinCell(); // see NOTE in SimpleScrollGrid
|
|
468
|
+
const isBuggy = !internal_cjs.getCanVGrowWithinCell(); // see NOTE in SimpleScrollGrid
|
|
465
469
|
const roleAttrs = { role: 'rowgroup' };
|
|
466
|
-
return createElement('table', {
|
|
470
|
+
return preact_cjs.createElement('table', {
|
|
467
471
|
ref: props.elRef,
|
|
468
472
|
role: 'grid',
|
|
469
473
|
className: classNames.join(' '),
|
|
470
|
-
}, renderMacroColGroup(colGroupStats, shrinkWidths), Boolean(!isBuggy && headSectionNodes.length) && createElement('thead', roleAttrs, ...headSectionNodes), Boolean(!isBuggy && bodySectionNodes.length) && createElement('tbody', roleAttrs, ...bodySectionNodes), Boolean(!isBuggy && footSectionNodes.length) && createElement('tfoot', roleAttrs, ...footSectionNodes), isBuggy && createElement('tbody', roleAttrs, ...headSectionNodes, ...bodySectionNodes, ...footSectionNodes));
|
|
474
|
+
}, renderMacroColGroup(colGroupStats, shrinkWidths), Boolean(!isBuggy && headSectionNodes.length) && preact_cjs.createElement('thead', roleAttrs, ...headSectionNodes), Boolean(!isBuggy && bodySectionNodes.length) && preact_cjs.createElement('tbody', roleAttrs, ...bodySectionNodes), Boolean(!isBuggy && footSectionNodes.length) && preact_cjs.createElement('tfoot', roleAttrs, ...footSectionNodes), isBuggy && preact_cjs.createElement('tbody', roleAttrs, ...headSectionNodes, ...bodySectionNodes, ...footSectionNodes));
|
|
471
475
|
}
|
|
472
476
|
renderSection(sectionConfig, sectionIndex, colGroupStats, microColGroupNodes, sectionRowMaxHeights, isHeader) {
|
|
473
477
|
if ('outerContent' in sectionConfig) {
|
|
474
|
-
return (createElement(Fragment, { key: sectionConfig.key }, sectionConfig.outerContent));
|
|
478
|
+
return (preact_cjs.createElement(preact_cjs.Fragment, { key: sectionConfig.key }, sectionConfig.outerContent));
|
|
475
479
|
}
|
|
476
|
-
return (createElement("tr", { key: sectionConfig.key, role: "presentation", className: getSectionClassNames(sectionConfig, this.props.liquid).join(' ') }, sectionConfig.chunks.map((chunkConfig, i) => this.renderChunk(sectionConfig, sectionIndex, colGroupStats[i], microColGroupNodes[i], chunkConfig, i, (sectionRowMaxHeights[sectionIndex] || [])[i] || [], isHeader))));
|
|
480
|
+
return (preact_cjs.createElement("tr", { key: sectionConfig.key, role: "presentation", className: internal_cjs.getSectionClassNames(sectionConfig, this.props.liquid).join(' ') }, sectionConfig.chunks.map((chunkConfig, i) => this.renderChunk(sectionConfig, sectionIndex, colGroupStats[i], microColGroupNodes[i], chunkConfig, i, (sectionRowMaxHeights[sectionIndex] || [])[i] || [], isHeader))));
|
|
477
481
|
}
|
|
478
482
|
renderChunk(sectionConfig, sectionIndex, colGroupStat, microColGroupNode, chunkConfig, chunkIndex, rowHeights, isHeader) {
|
|
479
483
|
if ('outerContent' in chunkConfig) {
|
|
480
|
-
return (createElement(Fragment, { key: chunkConfig.key }, chunkConfig.outerContent));
|
|
484
|
+
return (preact_cjs.createElement(preact_cjs.Fragment, { key: chunkConfig.key }, chunkConfig.outerContent));
|
|
481
485
|
}
|
|
482
486
|
let { state } = this;
|
|
483
487
|
let { scrollerClientWidths, scrollerClientHeights } = state;
|
|
484
488
|
let [sectionCnt, chunksPerSection] = this.getDims();
|
|
485
489
|
let index = sectionIndex * chunksPerSection + chunkIndex;
|
|
486
|
-
let sideScrollIndex = (!this.context.isRtl || getIsRtlScrollbarOnLeft()) ? chunksPerSection - 1 : 0;
|
|
490
|
+
let sideScrollIndex = (!this.context.isRtl || internal_cjs.getIsRtlScrollbarOnLeft()) ? chunksPerSection - 1 : 0;
|
|
487
491
|
let isVScrollSide = chunkIndex === sideScrollIndex;
|
|
488
492
|
let isLastSection = sectionIndex === sectionCnt - 1;
|
|
489
493
|
let forceXScrollbars = isLastSection && state.forceXScrollbars; // NOOOO can result in `null`
|
|
490
494
|
let forceYScrollbars = isVScrollSide && state.forceYScrollbars; // NOOOO can result in `null`
|
|
491
495
|
let allowXScrolling = colGroupStat && colGroupStat.allowXScrolling; // rename?
|
|
492
|
-
let allowYScrolling = getAllowYScrolling(this.props, sectionConfig); // rename? do in section func?
|
|
493
|
-
let chunkVGrow = getSectionHasLiquidHeight(this.props, sectionConfig); // do in section func?
|
|
496
|
+
let allowYScrolling = internal_cjs.getAllowYScrolling(this.props, sectionConfig); // rename? do in section func?
|
|
497
|
+
let chunkVGrow = internal_cjs.getSectionHasLiquidHeight(this.props, sectionConfig); // do in section func?
|
|
494
498
|
let expandRows = sectionConfig.expandRows && chunkVGrow;
|
|
495
499
|
let tableMinWidth = (colGroupStat && colGroupStat.totalColMinWidth) || '';
|
|
496
|
-
let content = renderChunkContent(sectionConfig, chunkConfig, {
|
|
500
|
+
let content = internal_cjs.renderChunkContent(sectionConfig, chunkConfig, {
|
|
497
501
|
tableColGroupNode: microColGroupNode,
|
|
498
502
|
tableMinWidth,
|
|
499
503
|
clientWidth: scrollerClientWidths[index] !== undefined ? scrollerClientWidths[index] : null,
|
|
@@ -511,17 +515,17 @@ class ScrollGrid extends BaseComponent {
|
|
|
511
515
|
(isVScrollSide ? 'auto' : 'scroll-hidden');
|
|
512
516
|
// it *could* be possible to reduce DOM wrappers by only doing a ClippedScroller when allowXScrolling or allowYScrolling,
|
|
513
517
|
// but if these values were to change, the inner components would be unmounted/remounted because of the parent change.
|
|
514
|
-
content = (createElement(ClippedScroller, { ref: this.clippedScrollerRefs.createRef(index), scrollerElRef: this.scrollerElRefs.createRef(index), overflowX: overflowX, overflowY: overflowY, liquid: chunkVGrow, maxHeight: sectionConfig.maxHeight }, content));
|
|
515
|
-
return createElement(isHeader ? 'th' : 'td', {
|
|
518
|
+
content = (preact_cjs.createElement(ClippedScroller, { ref: this.clippedScrollerRefs.createRef(index), scrollerElRef: this.scrollerElRefs.createRef(index), overflowX: overflowX, overflowY: overflowY, liquid: chunkVGrow, maxHeight: sectionConfig.maxHeight }, content));
|
|
519
|
+
return preact_cjs.createElement(isHeader ? 'th' : 'td', {
|
|
516
520
|
key: chunkConfig.key,
|
|
517
521
|
ref: this.chunkElRefs.createRef(index),
|
|
518
522
|
role: 'presentation',
|
|
519
523
|
}, content);
|
|
520
524
|
}
|
|
521
525
|
componentDidMount() {
|
|
522
|
-
this.getStickyScrolling = memoizeArraylike(initStickyScrolling);
|
|
523
|
-
this.getScrollSyncersBySection = memoizeHashlike(initScrollSyncer.bind(this, true), null, destroyScrollSyncer);
|
|
524
|
-
this.getScrollSyncersByColumn = memoizeHashlike(initScrollSyncer.bind(this, false), null, destroyScrollSyncer);
|
|
526
|
+
this.getStickyScrolling = internal_cjs.memoizeArraylike(initStickyScrolling);
|
|
527
|
+
this.getScrollSyncersBySection = internal_cjs.memoizeHashlike(initScrollSyncer.bind(this, true), null, destroyScrollSyncer);
|
|
528
|
+
this.getScrollSyncersByColumn = internal_cjs.memoizeHashlike(initScrollSyncer.bind(this, false), null, destroyScrollSyncer);
|
|
525
529
|
this.updateScrollSyncers();
|
|
526
530
|
this.handleSizing(false);
|
|
527
531
|
this.context.addResizeHandler(this.handleSizing);
|
|
@@ -538,7 +542,7 @@ class ScrollGrid extends BaseComponent {
|
|
|
538
542
|
allowSizing() {
|
|
539
543
|
let now = new Date();
|
|
540
544
|
if (!this.lastSizingDate ||
|
|
541
|
-
now.valueOf() > this.lastSizingDate.valueOf() + config.SCROLLGRID_RESIZE_INTERVAL) {
|
|
545
|
+
now.valueOf() > this.lastSizingDate.valueOf() + internal_cjs.config.SCROLLGRID_RESIZE_INTERVAL) {
|
|
542
546
|
this.lastSizingDate = now;
|
|
543
547
|
this.recentSizingCnt = 0;
|
|
544
548
|
return true;
|
|
@@ -553,7 +557,7 @@ class ScrollGrid extends BaseComponent {
|
|
|
553
557
|
colGroupStats.forEach((colGroupStat, i) => {
|
|
554
558
|
if (colGroupStat.hasShrinkCol) {
|
|
555
559
|
let chunkEls = this.chunkElRefs.collect(i, cnt, chunksPerSection); // in one col
|
|
556
|
-
shrinkWidths[i] = computeShrinkWidth(chunkEls);
|
|
560
|
+
shrinkWidths[i] = internal_cjs.computeShrinkWidth(chunkEls);
|
|
557
561
|
}
|
|
558
562
|
});
|
|
559
563
|
return shrinkWidths;
|
|
@@ -574,7 +578,7 @@ class ScrollGrid extends BaseComponent {
|
|
|
574
578
|
let rowHeights = [];
|
|
575
579
|
let chunkEl = this.chunkElRefs.currentMap[index];
|
|
576
580
|
if (chunkEl) {
|
|
577
|
-
rowHeights = findElements(chunkEl, '.fc-scrollgrid-sync-table tr').map((rowEl) => {
|
|
581
|
+
rowHeights = internal_cjs.findElements(chunkEl, '.fc-scrollgrid-sync-table tr').map((rowEl) => {
|
|
578
582
|
let max = getRowInnerMaxHeight(rowEl);
|
|
579
583
|
newHeightMap.set(rowEl, max);
|
|
580
584
|
return max;
|
|
@@ -645,9 +649,9 @@ class ScrollGrid extends BaseComponent {
|
|
|
645
649
|
return sectionRowMaxHeights;
|
|
646
650
|
}
|
|
647
651
|
computeScrollerDims() {
|
|
648
|
-
let scrollbarWidth = getScrollbarWidths();
|
|
652
|
+
let scrollbarWidth = internal_cjs.getScrollbarWidths();
|
|
649
653
|
let [sectionCnt, chunksPerSection] = this.getDims();
|
|
650
|
-
let sideScrollI = (!this.context.isRtl || getIsRtlScrollbarOnLeft()) ? chunksPerSection - 1 : 0;
|
|
654
|
+
let sideScrollI = (!this.context.isRtl || internal_cjs.getIsRtlScrollbarOnLeft()) ? chunksPerSection - 1 : 0;
|
|
651
655
|
let lastSectionI = sectionCnt - 1;
|
|
652
656
|
let currentScrollers = this.clippedScrollerRefs.currentMap;
|
|
653
657
|
let scrollerEls = this.scrollerElRefs.currentMap;
|
|
@@ -704,7 +708,7 @@ class ScrollGrid extends BaseComponent {
|
|
|
704
708
|
for (let sectionI = 0; sectionI < sectionCnt; sectionI += 1) {
|
|
705
709
|
let startIndex = sectionI * chunksPerSection;
|
|
706
710
|
let endIndex = startIndex + chunksPerSection;
|
|
707
|
-
scrollElsBySection[sectionI] = collectFromHash(scrollElMap, startIndex, endIndex, 1); // use the filtered
|
|
711
|
+
scrollElsBySection[sectionI] = internal_cjs.collectFromHash(scrollElMap, startIndex, endIndex, 1); // use the filtered
|
|
708
712
|
}
|
|
709
713
|
for (let col = 0; col < chunksPerSection; col += 1) {
|
|
710
714
|
scrollElsByColumn[col] = this.scrollerElRefs.collect(col, cnt, chunksPerSection); // DON'T use the filtered
|
|
@@ -713,8 +717,8 @@ class ScrollGrid extends BaseComponent {
|
|
|
713
717
|
this.scrollSyncersByColumn = this.getScrollSyncersByColumn(scrollElsByColumn);
|
|
714
718
|
}
|
|
715
719
|
destroyScrollSyncers() {
|
|
716
|
-
mapHash(this.scrollSyncersBySection, destroyScrollSyncer);
|
|
717
|
-
mapHash(this.scrollSyncersByColumn, destroyScrollSyncer);
|
|
720
|
+
internal_cjs.mapHash(this.scrollSyncersBySection, destroyScrollSyncer);
|
|
721
|
+
internal_cjs.mapHash(this.scrollSyncersByColumn, destroyScrollSyncer);
|
|
718
722
|
}
|
|
719
723
|
getChunkConfigByIndex(index) {
|
|
720
724
|
let chunksPerSection = this.getDims()[1];
|
|
@@ -738,13 +742,13 @@ class ScrollGrid extends BaseComponent {
|
|
|
738
742
|
_handleChunkEl(chunkEl, key) {
|
|
739
743
|
let chunkConfig = this.getChunkConfigByIndex(parseInt(key, 10));
|
|
740
744
|
if (chunkConfig) { // null if section disappeared. bad, b/c won't null-set the elRef
|
|
741
|
-
setRef(chunkConfig.elRef, chunkEl);
|
|
745
|
+
internal_cjs.setRef(chunkConfig.elRef, chunkEl);
|
|
742
746
|
}
|
|
743
747
|
}
|
|
744
748
|
_handleScrollerEl(scrollerEl, key) {
|
|
745
749
|
let chunkConfig = this.getChunkConfigByIndex(parseInt(key, 10));
|
|
746
750
|
if (chunkConfig) { // null if section disappeared. bad, b/c won't null-set the elRef
|
|
747
|
-
setRef(chunkConfig.scrollerElRef, scrollerEl);
|
|
751
|
+
internal_cjs.setRef(chunkConfig.scrollerElRef, scrollerEl);
|
|
748
752
|
}
|
|
749
753
|
}
|
|
750
754
|
getDims() {
|
|
@@ -754,9 +758,9 @@ class ScrollGrid extends BaseComponent {
|
|
|
754
758
|
}
|
|
755
759
|
}
|
|
756
760
|
ScrollGrid.addStateEquality({
|
|
757
|
-
shrinkWidths: isArraysEqual,
|
|
758
|
-
scrollerClientWidths: isPropsEqual,
|
|
759
|
-
scrollerClientHeights: isPropsEqual,
|
|
761
|
+
shrinkWidths: internal_cjs.isArraysEqual,
|
|
762
|
+
scrollerClientWidths: internal_cjs.isPropsEqual,
|
|
763
|
+
scrollerClientHeights: internal_cjs.isPropsEqual,
|
|
760
764
|
});
|
|
761
765
|
function sumNumbers(numbers) {
|
|
762
766
|
let sum = 0;
|
|
@@ -766,7 +770,7 @@ function sumNumbers(numbers) {
|
|
|
766
770
|
return sum;
|
|
767
771
|
}
|
|
768
772
|
function getRowInnerMaxHeight(rowEl) {
|
|
769
|
-
let innerHeights = findElements(rowEl, '.fc-scrollgrid-sync-inner').map(getElHeight);
|
|
773
|
+
let innerHeights = internal_cjs.findElements(rowEl, '.fc-scrollgrid-sync-inner').map(getElHeight);
|
|
770
774
|
if (innerHeights.length) {
|
|
771
775
|
return Math.max(...innerHeights);
|
|
772
776
|
}
|
|
@@ -779,17 +783,17 @@ function renderMacroColGroup(colGroupStats, shrinkWidths) {
|
|
|
779
783
|
let children = colGroupStats.map((colGroupStat, i) => {
|
|
780
784
|
let width = colGroupStat.width;
|
|
781
785
|
if (width === 'shrink') {
|
|
782
|
-
width = colGroupStat.totalColWidth + sanitizeShrinkWidth(shrinkWidths[i]) + 1; // +1 for border :(
|
|
786
|
+
width = colGroupStat.totalColWidth + internal_cjs.sanitizeShrinkWidth(shrinkWidths[i]) + 1; // +1 for border :(
|
|
783
787
|
}
|
|
784
788
|
return ( // eslint-disable-next-line react/jsx-key
|
|
785
|
-
createElement("col", { style: { width } }));
|
|
789
|
+
preact_cjs.createElement("col", { style: { width } }));
|
|
786
790
|
});
|
|
787
|
-
return createElement('colgroup', {}, ...children);
|
|
791
|
+
return preact_cjs.createElement('colgroup', {}, ...children);
|
|
788
792
|
}
|
|
789
793
|
function compileColGroupStat(colGroupConfig) {
|
|
790
794
|
let totalColWidth = sumColProp(colGroupConfig.cols, 'width'); // excludes "shrink"
|
|
791
795
|
let totalColMinWidth = sumColProp(colGroupConfig.cols, 'minWidth');
|
|
792
|
-
let hasShrinkCol = hasShrinkWidth(colGroupConfig.cols);
|
|
796
|
+
let hasShrinkCol = internal_cjs.hasShrinkWidth(colGroupConfig.cols);
|
|
793
797
|
let allowXScrolling = colGroupConfig.width !== 'shrink' && Boolean(totalColWidth || totalColMinWidth || hasShrinkCol);
|
|
794
798
|
return {
|
|
795
799
|
hasShrinkCol,
|
|
@@ -811,10 +815,10 @@ function sumColProp(cols, propName) {
|
|
|
811
815
|
return total;
|
|
812
816
|
}
|
|
813
817
|
const COL_GROUP_STAT_EQUALITY = {
|
|
814
|
-
cols: isColPropsEqual,
|
|
818
|
+
cols: internal_cjs.isColPropsEqual,
|
|
815
819
|
};
|
|
816
820
|
function isColGroupStatsEqual(stat0, stat1) {
|
|
817
|
-
return compareObjs(stat0, stat1, COL_GROUP_STAT_EQUALITY);
|
|
821
|
+
return internal_cjs.compareObjs(stat0, stat1, COL_GROUP_STAT_EQUALITY);
|
|
818
822
|
}
|
|
819
823
|
// for memoizers...
|
|
820
824
|
function initScrollSyncer(isVertical, ...scrollEls) {
|
|
@@ -827,4 +831,4 @@ function initStickyScrolling(scrollEl, isRtl) {
|
|
|
827
831
|
return new StickyScrolling(scrollEl, isRtl);
|
|
828
832
|
}
|
|
829
833
|
|
|
830
|
-
|
|
834
|
+
exports.ScrollGrid = ScrollGrid;
|
package/internal.js
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var internal = require('@fullcalendar/core/internal');
|
|
6
|
-
var preact = require('@fullcalendar/core/preact');
|
|
1
|
+
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';
|
|
2
|
+
import { createRef, createElement, Fragment } from '@fullcalendar/core/preact';
|
|
7
3
|
|
|
8
4
|
// TODO: assume the el has no borders?
|
|
9
5
|
function getScrollCanvasOrigin(scrollEl) {
|
|
10
6
|
let rect = scrollEl.getBoundingClientRect();
|
|
11
|
-
let edges =
|
|
7
|
+
let edges = computeEdges(scrollEl); // TODO: pass in isRtl?
|
|
12
8
|
return {
|
|
13
9
|
left: rect.left + edges.borderLeft + edges.scrollbarLeft - getScrollFromLeftEdge(scrollEl),
|
|
14
10
|
top: rect.top + edges.borderTop - scrollEl.scrollTop,
|
|
@@ -71,7 +67,7 @@ function detectRtlScrollSystem() {
|
|
|
71
67
|
system = 'negative'; // scroll is a negative number from the right edge
|
|
72
68
|
}
|
|
73
69
|
}
|
|
74
|
-
|
|
70
|
+
removeElement(el);
|
|
75
71
|
return system;
|
|
76
72
|
}
|
|
77
73
|
|
|
@@ -90,7 +86,7 @@ class StickyScrolling {
|
|
|
90
86
|
this.isRtl = isRtl;
|
|
91
87
|
this.updateSize = () => {
|
|
92
88
|
let { scrollEl } = this;
|
|
93
|
-
let els =
|
|
89
|
+
let els = findElements(scrollEl, STICKY_SELECTOR);
|
|
94
90
|
let elGeoms = this.queryElGeoms(els);
|
|
95
91
|
let viewportWidth = scrollEl.clientWidth;
|
|
96
92
|
assignStickyPositions(els, elGeoms, viewportWidth);
|
|
@@ -101,7 +97,7 @@ class StickyScrolling {
|
|
|
101
97
|
let canvasOrigin = getScrollCanvasOrigin(scrollEl);
|
|
102
98
|
let elGeoms = [];
|
|
103
99
|
for (let el of els) {
|
|
104
|
-
let parentBound =
|
|
100
|
+
let parentBound = translateRect(computeInnerRect(el.parentNode, true, true), // weird way to call this!!!
|
|
105
101
|
-canvasOrigin.left, -canvasOrigin.top);
|
|
106
102
|
let elRect = el.getBoundingClientRect();
|
|
107
103
|
let computedStyles = window.getComputedStyle(el);
|
|
@@ -114,7 +110,7 @@ class StickyScrolling {
|
|
|
114
110
|
textAlign = isRtl ? 'left' : 'right';
|
|
115
111
|
}
|
|
116
112
|
if (computedStyles.position !== 'sticky') {
|
|
117
|
-
naturalBound =
|
|
113
|
+
naturalBound = translateRect(elRect, -canvasOrigin.left - (parseFloat(computedStyles.left) || 0), // could be 'auto'
|
|
118
114
|
-canvasOrigin.top - (parseFloat(computedStyles.top) || 0));
|
|
119
115
|
}
|
|
120
116
|
elGeoms.push({
|
|
@@ -140,7 +136,7 @@ function assignStickyPositions(els, elGeoms, viewportWidth) {
|
|
|
140
136
|
else { // if parent container can be completely in view, we don't need stickiness
|
|
141
137
|
left = '';
|
|
142
138
|
}
|
|
143
|
-
|
|
139
|
+
applyStyle(el, {
|
|
144
140
|
left,
|
|
145
141
|
right: left,
|
|
146
142
|
top: 0,
|
|
@@ -148,17 +144,17 @@ function assignStickyPositions(els, elGeoms, viewportWidth) {
|
|
|
148
144
|
});
|
|
149
145
|
}
|
|
150
146
|
|
|
151
|
-
class ClippedScroller extends
|
|
147
|
+
class ClippedScroller extends BaseComponent {
|
|
152
148
|
constructor() {
|
|
153
149
|
super(...arguments);
|
|
154
|
-
this.elRef =
|
|
150
|
+
this.elRef = createRef();
|
|
155
151
|
this.state = {
|
|
156
152
|
xScrollbarWidth: 0,
|
|
157
153
|
yScrollbarWidth: 0,
|
|
158
154
|
};
|
|
159
155
|
this.handleScroller = (scroller) => {
|
|
160
156
|
this.scroller = scroller;
|
|
161
|
-
|
|
157
|
+
setRef(this.props.scrollerRef, scroller);
|
|
162
158
|
};
|
|
163
159
|
this.handleSizing = () => {
|
|
164
160
|
let { props } = this;
|
|
@@ -172,7 +168,7 @@ class ClippedScroller extends internal.BaseComponent {
|
|
|
172
168
|
}
|
|
173
169
|
render() {
|
|
174
170
|
let { props, state, context } = this;
|
|
175
|
-
let isScrollbarOnLeft = context.isRtl &&
|
|
171
|
+
let isScrollbarOnLeft = context.isRtl && getIsRtlScrollbarOnLeft();
|
|
176
172
|
let overcomeLeft = 0;
|
|
177
173
|
let overcomeRight = 0;
|
|
178
174
|
let overcomeBottom = 0;
|
|
@@ -189,8 +185,8 @@ class ClippedScroller extends internal.BaseComponent {
|
|
|
189
185
|
}
|
|
190
186
|
}
|
|
191
187
|
}
|
|
192
|
-
return (
|
|
193
|
-
|
|
188
|
+
return (createElement("div", { ref: this.elRef, className: 'fc-scroller-harness' + (props.liquid ? ' fc-scroller-harness-liquid' : '') },
|
|
189
|
+
createElement(Scroller, { ref: this.handleScroller, elRef: this.props.scrollerElRef, overflowX: props.overflowX === 'scroll-hidden' ? 'scroll' : props.overflowX, overflowY: props.overflowY === 'scroll-hidden' ? 'scroll' : props.overflowY, overcomeLeft: overcomeLeft, overcomeRight: overcomeRight, overcomeBottom: overcomeBottom, maxHeight: typeof props.maxHeight === 'number'
|
|
194
190
|
? (props.maxHeight + (props.overflowX === 'scroll-hidden' ? state.xScrollbarWidth : 0))
|
|
195
191
|
: '', liquid: props.liquid, liquidIsAbsolute: true }, props.children)));
|
|
196
192
|
}
|
|
@@ -199,7 +195,7 @@ class ClippedScroller extends internal.BaseComponent {
|
|
|
199
195
|
this.context.addResizeHandler(this.handleSizing);
|
|
200
196
|
}
|
|
201
197
|
componentDidUpdate(prevProps) {
|
|
202
|
-
if (!
|
|
198
|
+
if (!isPropsEqual(prevProps, this.props)) { // an external change?
|
|
203
199
|
this.handleSizing();
|
|
204
200
|
}
|
|
205
201
|
}
|
|
@@ -221,13 +217,13 @@ ALSO, with the ability to disable touch
|
|
|
221
217
|
class ScrollListener {
|
|
222
218
|
constructor(el) {
|
|
223
219
|
this.el = el;
|
|
224
|
-
this.emitter = new
|
|
220
|
+
this.emitter = new Emitter();
|
|
225
221
|
this.isScrolling = false;
|
|
226
222
|
this.isTouching = false; // user currently has finger down?
|
|
227
223
|
this.isRecentlyWheeled = false;
|
|
228
224
|
this.isRecentlyScrolled = false;
|
|
229
|
-
this.wheelWaiter = new
|
|
230
|
-
this.scrollWaiter = new
|
|
225
|
+
this.wheelWaiter = new DelayedRunner(this._handleWheelWaited.bind(this));
|
|
226
|
+
this.scrollWaiter = new DelayedRunner(this._handleScrollWaited.bind(this));
|
|
231
227
|
// Handlers
|
|
232
228
|
// ----------------------------------------------------------------------------------------------
|
|
233
229
|
this.handleScroll = () => {
|
|
@@ -370,20 +366,20 @@ class ScrollSyncer {
|
|
|
370
366
|
}
|
|
371
367
|
}
|
|
372
368
|
|
|
373
|
-
|
|
369
|
+
config.SCROLLGRID_RESIZE_INTERVAL = 500;
|
|
374
370
|
/*
|
|
375
371
|
TODO: make <ScrollGridSection> subcomponent
|
|
376
372
|
NOTE: doesn't support collapsibleWidth (which is sortof a hack anyway)
|
|
377
373
|
*/
|
|
378
|
-
class ScrollGrid extends
|
|
374
|
+
class ScrollGrid extends BaseComponent {
|
|
379
375
|
constructor() {
|
|
380
376
|
super(...arguments);
|
|
381
|
-
this.compileColGroupStats =
|
|
382
|
-
this.renderMicroColGroups =
|
|
383
|
-
this.clippedScrollerRefs = new
|
|
377
|
+
this.compileColGroupStats = memoizeArraylike(compileColGroupStat, isColGroupStatsEqual);
|
|
378
|
+
this.renderMicroColGroups = memoizeArraylike(renderMicroColGroup); // yucky to memoize VNodes, but much more efficient for consumers
|
|
379
|
+
this.clippedScrollerRefs = new RefMap();
|
|
384
380
|
// doesn't hold non-scrolling els used just for padding
|
|
385
|
-
this.scrollerElRefs = new
|
|
386
|
-
this.chunkElRefs = new
|
|
381
|
+
this.scrollerElRefs = new RefMap(this._handleScrollerEl.bind(this));
|
|
382
|
+
this.chunkElRefs = new RefMap(this._handleChunkEl.bind(this));
|
|
387
383
|
this.scrollSyncersBySection = {};
|
|
388
384
|
this.scrollSyncersByColumn = {};
|
|
389
385
|
// for row-height-syncing
|
|
@@ -443,7 +439,7 @@ class ScrollGrid extends internal.BaseComponent {
|
|
|
443
439
|
let { shrinkWidths } = state;
|
|
444
440
|
let colGroupStats = this.compileColGroupStats(props.colGroups.map((colGroup) => [colGroup]));
|
|
445
441
|
let microColGroupNodes = this.renderMicroColGroups(colGroupStats.map((stat, i) => [stat.cols, shrinkWidths[i]]));
|
|
446
|
-
let classNames =
|
|
442
|
+
let classNames = getScrollGridClassNames(props.liquid, context);
|
|
447
443
|
this.getDims();
|
|
448
444
|
// TODO: make DRY
|
|
449
445
|
let sectionConfigs = props.sections;
|
|
@@ -465,39 +461,39 @@ class ScrollGrid extends internal.BaseComponent {
|
|
|
465
461
|
footSectionNodes.push(this.renderSection(currentConfig, configI, colGroupStats, microColGroupNodes, state.sectionRowMaxHeights, true));
|
|
466
462
|
configI += 1;
|
|
467
463
|
}
|
|
468
|
-
const isBuggy = !
|
|
464
|
+
const isBuggy = !getCanVGrowWithinCell(); // see NOTE in SimpleScrollGrid
|
|
469
465
|
const roleAttrs = { role: 'rowgroup' };
|
|
470
|
-
return
|
|
466
|
+
return createElement('table', {
|
|
471
467
|
ref: props.elRef,
|
|
472
468
|
role: 'grid',
|
|
473
469
|
className: classNames.join(' '),
|
|
474
|
-
}, renderMacroColGroup(colGroupStats, shrinkWidths), Boolean(!isBuggy && headSectionNodes.length) &&
|
|
470
|
+
}, renderMacroColGroup(colGroupStats, shrinkWidths), Boolean(!isBuggy && headSectionNodes.length) && createElement('thead', roleAttrs, ...headSectionNodes), Boolean(!isBuggy && bodySectionNodes.length) && createElement('tbody', roleAttrs, ...bodySectionNodes), Boolean(!isBuggy && footSectionNodes.length) && createElement('tfoot', roleAttrs, ...footSectionNodes), isBuggy && createElement('tbody', roleAttrs, ...headSectionNodes, ...bodySectionNodes, ...footSectionNodes));
|
|
475
471
|
}
|
|
476
472
|
renderSection(sectionConfig, sectionIndex, colGroupStats, microColGroupNodes, sectionRowMaxHeights, isHeader) {
|
|
477
473
|
if ('outerContent' in sectionConfig) {
|
|
478
|
-
return (
|
|
474
|
+
return (createElement(Fragment, { key: sectionConfig.key }, sectionConfig.outerContent));
|
|
479
475
|
}
|
|
480
|
-
return (
|
|
476
|
+
return (createElement("tr", { key: sectionConfig.key, role: "presentation", className: getSectionClassNames(sectionConfig, this.props.liquid).join(' ') }, sectionConfig.chunks.map((chunkConfig, i) => this.renderChunk(sectionConfig, sectionIndex, colGroupStats[i], microColGroupNodes[i], chunkConfig, i, (sectionRowMaxHeights[sectionIndex] || [])[i] || [], isHeader))));
|
|
481
477
|
}
|
|
482
478
|
renderChunk(sectionConfig, sectionIndex, colGroupStat, microColGroupNode, chunkConfig, chunkIndex, rowHeights, isHeader) {
|
|
483
479
|
if ('outerContent' in chunkConfig) {
|
|
484
|
-
return (
|
|
480
|
+
return (createElement(Fragment, { key: chunkConfig.key }, chunkConfig.outerContent));
|
|
485
481
|
}
|
|
486
482
|
let { state } = this;
|
|
487
483
|
let { scrollerClientWidths, scrollerClientHeights } = state;
|
|
488
484
|
let [sectionCnt, chunksPerSection] = this.getDims();
|
|
489
485
|
let index = sectionIndex * chunksPerSection + chunkIndex;
|
|
490
|
-
let sideScrollIndex = (!this.context.isRtl ||
|
|
486
|
+
let sideScrollIndex = (!this.context.isRtl || getIsRtlScrollbarOnLeft()) ? chunksPerSection - 1 : 0;
|
|
491
487
|
let isVScrollSide = chunkIndex === sideScrollIndex;
|
|
492
488
|
let isLastSection = sectionIndex === sectionCnt - 1;
|
|
493
489
|
let forceXScrollbars = isLastSection && state.forceXScrollbars; // NOOOO can result in `null`
|
|
494
490
|
let forceYScrollbars = isVScrollSide && state.forceYScrollbars; // NOOOO can result in `null`
|
|
495
491
|
let allowXScrolling = colGroupStat && colGroupStat.allowXScrolling; // rename?
|
|
496
|
-
let allowYScrolling =
|
|
497
|
-
let chunkVGrow =
|
|
492
|
+
let allowYScrolling = getAllowYScrolling(this.props, sectionConfig); // rename? do in section func?
|
|
493
|
+
let chunkVGrow = getSectionHasLiquidHeight(this.props, sectionConfig); // do in section func?
|
|
498
494
|
let expandRows = sectionConfig.expandRows && chunkVGrow;
|
|
499
495
|
let tableMinWidth = (colGroupStat && colGroupStat.totalColMinWidth) || '';
|
|
500
|
-
let content =
|
|
496
|
+
let content = renderChunkContent(sectionConfig, chunkConfig, {
|
|
501
497
|
tableColGroupNode: microColGroupNode,
|
|
502
498
|
tableMinWidth,
|
|
503
499
|
clientWidth: scrollerClientWidths[index] !== undefined ? scrollerClientWidths[index] : null,
|
|
@@ -515,17 +511,17 @@ class ScrollGrid extends internal.BaseComponent {
|
|
|
515
511
|
(isVScrollSide ? 'auto' : 'scroll-hidden');
|
|
516
512
|
// it *could* be possible to reduce DOM wrappers by only doing a ClippedScroller when allowXScrolling or allowYScrolling,
|
|
517
513
|
// but if these values were to change, the inner components would be unmounted/remounted because of the parent change.
|
|
518
|
-
content = (
|
|
519
|
-
return
|
|
514
|
+
content = (createElement(ClippedScroller, { ref: this.clippedScrollerRefs.createRef(index), scrollerElRef: this.scrollerElRefs.createRef(index), overflowX: overflowX, overflowY: overflowY, liquid: chunkVGrow, maxHeight: sectionConfig.maxHeight }, content));
|
|
515
|
+
return createElement(isHeader ? 'th' : 'td', {
|
|
520
516
|
key: chunkConfig.key,
|
|
521
517
|
ref: this.chunkElRefs.createRef(index),
|
|
522
518
|
role: 'presentation',
|
|
523
519
|
}, content);
|
|
524
520
|
}
|
|
525
521
|
componentDidMount() {
|
|
526
|
-
this.getStickyScrolling =
|
|
527
|
-
this.getScrollSyncersBySection =
|
|
528
|
-
this.getScrollSyncersByColumn =
|
|
522
|
+
this.getStickyScrolling = memoizeArraylike(initStickyScrolling);
|
|
523
|
+
this.getScrollSyncersBySection = memoizeHashlike(initScrollSyncer.bind(this, true), null, destroyScrollSyncer);
|
|
524
|
+
this.getScrollSyncersByColumn = memoizeHashlike(initScrollSyncer.bind(this, false), null, destroyScrollSyncer);
|
|
529
525
|
this.updateScrollSyncers();
|
|
530
526
|
this.handleSizing(false);
|
|
531
527
|
this.context.addResizeHandler(this.handleSizing);
|
|
@@ -542,7 +538,7 @@ class ScrollGrid extends internal.BaseComponent {
|
|
|
542
538
|
allowSizing() {
|
|
543
539
|
let now = new Date();
|
|
544
540
|
if (!this.lastSizingDate ||
|
|
545
|
-
now.valueOf() > this.lastSizingDate.valueOf() +
|
|
541
|
+
now.valueOf() > this.lastSizingDate.valueOf() + config.SCROLLGRID_RESIZE_INTERVAL) {
|
|
546
542
|
this.lastSizingDate = now;
|
|
547
543
|
this.recentSizingCnt = 0;
|
|
548
544
|
return true;
|
|
@@ -557,7 +553,7 @@ class ScrollGrid extends internal.BaseComponent {
|
|
|
557
553
|
colGroupStats.forEach((colGroupStat, i) => {
|
|
558
554
|
if (colGroupStat.hasShrinkCol) {
|
|
559
555
|
let chunkEls = this.chunkElRefs.collect(i, cnt, chunksPerSection); // in one col
|
|
560
|
-
shrinkWidths[i] =
|
|
556
|
+
shrinkWidths[i] = computeShrinkWidth(chunkEls);
|
|
561
557
|
}
|
|
562
558
|
});
|
|
563
559
|
return shrinkWidths;
|
|
@@ -578,7 +574,7 @@ class ScrollGrid extends internal.BaseComponent {
|
|
|
578
574
|
let rowHeights = [];
|
|
579
575
|
let chunkEl = this.chunkElRefs.currentMap[index];
|
|
580
576
|
if (chunkEl) {
|
|
581
|
-
rowHeights =
|
|
577
|
+
rowHeights = findElements(chunkEl, '.fc-scrollgrid-sync-table tr').map((rowEl) => {
|
|
582
578
|
let max = getRowInnerMaxHeight(rowEl);
|
|
583
579
|
newHeightMap.set(rowEl, max);
|
|
584
580
|
return max;
|
|
@@ -649,9 +645,9 @@ class ScrollGrid extends internal.BaseComponent {
|
|
|
649
645
|
return sectionRowMaxHeights;
|
|
650
646
|
}
|
|
651
647
|
computeScrollerDims() {
|
|
652
|
-
let scrollbarWidth =
|
|
648
|
+
let scrollbarWidth = getScrollbarWidths();
|
|
653
649
|
let [sectionCnt, chunksPerSection] = this.getDims();
|
|
654
|
-
let sideScrollI = (!this.context.isRtl ||
|
|
650
|
+
let sideScrollI = (!this.context.isRtl || getIsRtlScrollbarOnLeft()) ? chunksPerSection - 1 : 0;
|
|
655
651
|
let lastSectionI = sectionCnt - 1;
|
|
656
652
|
let currentScrollers = this.clippedScrollerRefs.currentMap;
|
|
657
653
|
let scrollerEls = this.scrollerElRefs.currentMap;
|
|
@@ -708,7 +704,7 @@ class ScrollGrid extends internal.BaseComponent {
|
|
|
708
704
|
for (let sectionI = 0; sectionI < sectionCnt; sectionI += 1) {
|
|
709
705
|
let startIndex = sectionI * chunksPerSection;
|
|
710
706
|
let endIndex = startIndex + chunksPerSection;
|
|
711
|
-
scrollElsBySection[sectionI] =
|
|
707
|
+
scrollElsBySection[sectionI] = collectFromHash(scrollElMap, startIndex, endIndex, 1); // use the filtered
|
|
712
708
|
}
|
|
713
709
|
for (let col = 0; col < chunksPerSection; col += 1) {
|
|
714
710
|
scrollElsByColumn[col] = this.scrollerElRefs.collect(col, cnt, chunksPerSection); // DON'T use the filtered
|
|
@@ -717,8 +713,8 @@ class ScrollGrid extends internal.BaseComponent {
|
|
|
717
713
|
this.scrollSyncersByColumn = this.getScrollSyncersByColumn(scrollElsByColumn);
|
|
718
714
|
}
|
|
719
715
|
destroyScrollSyncers() {
|
|
720
|
-
|
|
721
|
-
|
|
716
|
+
mapHash(this.scrollSyncersBySection, destroyScrollSyncer);
|
|
717
|
+
mapHash(this.scrollSyncersByColumn, destroyScrollSyncer);
|
|
722
718
|
}
|
|
723
719
|
getChunkConfigByIndex(index) {
|
|
724
720
|
let chunksPerSection = this.getDims()[1];
|
|
@@ -742,13 +738,13 @@ class ScrollGrid extends internal.BaseComponent {
|
|
|
742
738
|
_handleChunkEl(chunkEl, key) {
|
|
743
739
|
let chunkConfig = this.getChunkConfigByIndex(parseInt(key, 10));
|
|
744
740
|
if (chunkConfig) { // null if section disappeared. bad, b/c won't null-set the elRef
|
|
745
|
-
|
|
741
|
+
setRef(chunkConfig.elRef, chunkEl);
|
|
746
742
|
}
|
|
747
743
|
}
|
|
748
744
|
_handleScrollerEl(scrollerEl, key) {
|
|
749
745
|
let chunkConfig = this.getChunkConfigByIndex(parseInt(key, 10));
|
|
750
746
|
if (chunkConfig) { // null if section disappeared. bad, b/c won't null-set the elRef
|
|
751
|
-
|
|
747
|
+
setRef(chunkConfig.scrollerElRef, scrollerEl);
|
|
752
748
|
}
|
|
753
749
|
}
|
|
754
750
|
getDims() {
|
|
@@ -758,9 +754,9 @@ class ScrollGrid extends internal.BaseComponent {
|
|
|
758
754
|
}
|
|
759
755
|
}
|
|
760
756
|
ScrollGrid.addStateEquality({
|
|
761
|
-
shrinkWidths:
|
|
762
|
-
scrollerClientWidths:
|
|
763
|
-
scrollerClientHeights:
|
|
757
|
+
shrinkWidths: isArraysEqual,
|
|
758
|
+
scrollerClientWidths: isPropsEqual,
|
|
759
|
+
scrollerClientHeights: isPropsEqual,
|
|
764
760
|
});
|
|
765
761
|
function sumNumbers(numbers) {
|
|
766
762
|
let sum = 0;
|
|
@@ -770,7 +766,7 @@ function sumNumbers(numbers) {
|
|
|
770
766
|
return sum;
|
|
771
767
|
}
|
|
772
768
|
function getRowInnerMaxHeight(rowEl) {
|
|
773
|
-
let innerHeights =
|
|
769
|
+
let innerHeights = findElements(rowEl, '.fc-scrollgrid-sync-inner').map(getElHeight);
|
|
774
770
|
if (innerHeights.length) {
|
|
775
771
|
return Math.max(...innerHeights);
|
|
776
772
|
}
|
|
@@ -783,17 +779,17 @@ function renderMacroColGroup(colGroupStats, shrinkWidths) {
|
|
|
783
779
|
let children = colGroupStats.map((colGroupStat, i) => {
|
|
784
780
|
let width = colGroupStat.width;
|
|
785
781
|
if (width === 'shrink') {
|
|
786
|
-
width = colGroupStat.totalColWidth +
|
|
782
|
+
width = colGroupStat.totalColWidth + sanitizeShrinkWidth(shrinkWidths[i]) + 1; // +1 for border :(
|
|
787
783
|
}
|
|
788
784
|
return ( // eslint-disable-next-line react/jsx-key
|
|
789
|
-
|
|
785
|
+
createElement("col", { style: { width } }));
|
|
790
786
|
});
|
|
791
|
-
return
|
|
787
|
+
return createElement('colgroup', {}, ...children);
|
|
792
788
|
}
|
|
793
789
|
function compileColGroupStat(colGroupConfig) {
|
|
794
790
|
let totalColWidth = sumColProp(colGroupConfig.cols, 'width'); // excludes "shrink"
|
|
795
791
|
let totalColMinWidth = sumColProp(colGroupConfig.cols, 'minWidth');
|
|
796
|
-
let hasShrinkCol =
|
|
792
|
+
let hasShrinkCol = hasShrinkWidth(colGroupConfig.cols);
|
|
797
793
|
let allowXScrolling = colGroupConfig.width !== 'shrink' && Boolean(totalColWidth || totalColMinWidth || hasShrinkCol);
|
|
798
794
|
return {
|
|
799
795
|
hasShrinkCol,
|
|
@@ -815,10 +811,10 @@ function sumColProp(cols, propName) {
|
|
|
815
811
|
return total;
|
|
816
812
|
}
|
|
817
813
|
const COL_GROUP_STAT_EQUALITY = {
|
|
818
|
-
cols:
|
|
814
|
+
cols: isColPropsEqual,
|
|
819
815
|
};
|
|
820
816
|
function isColGroupStatsEqual(stat0, stat1) {
|
|
821
|
-
return
|
|
817
|
+
return compareObjs(stat0, stat1, COL_GROUP_STAT_EQUALITY);
|
|
822
818
|
}
|
|
823
819
|
// for memoizers...
|
|
824
820
|
function initScrollSyncer(isVertical, ...scrollEls) {
|
|
@@ -831,4 +827,4 @@ function initStickyScrolling(scrollEl, isRtl) {
|
|
|
831
827
|
return new StickyScrolling(scrollEl, isRtl);
|
|
832
828
|
}
|
|
833
829
|
|
|
834
|
-
|
|
830
|
+
export { ScrollGrid };
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fullcalendar/scrollgrid",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.3",
|
|
4
4
|
"title": "FullCalendar ScrollGrid Plugin",
|
|
5
5
|
"description": "Tabular data chunked into scrollable panes",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@fullcalendar/premium-common": "~6.1.
|
|
7
|
+
"@fullcalendar/premium-common": "~6.1.3"
|
|
8
8
|
},
|
|
9
9
|
"peerDependencies": {
|
|
10
|
-
"@fullcalendar/core": "~6.1.
|
|
10
|
+
"@fullcalendar/core": "~6.1.3"
|
|
11
11
|
},
|
|
12
12
|
"type": "module",
|
|
13
13
|
"keywords": [
|
|
@@ -31,23 +31,25 @@
|
|
|
31
31
|
"email": "arshaw@arshaw.com",
|
|
32
32
|
"url": "http://arshaw.com/"
|
|
33
33
|
},
|
|
34
|
-
"copyright": "
|
|
34
|
+
"copyright": "2023 Adam Shaw",
|
|
35
35
|
"types": "./index.d.ts",
|
|
36
|
-
"main": "./index.
|
|
37
|
-
"module": "./index.
|
|
36
|
+
"main": "./index.cjs",
|
|
37
|
+
"module": "./index.js",
|
|
38
38
|
"unpkg": "./index.global.min.js",
|
|
39
39
|
"jsdelivr": "./index.global.min.js",
|
|
40
40
|
"exports": {
|
|
41
41
|
"./package.json": "./package.json",
|
|
42
|
+
"./index.cjs": "./index.cjs",
|
|
42
43
|
".": {
|
|
43
44
|
"types": "./index.d.ts",
|
|
44
|
-
"require": "./index.
|
|
45
|
-
"import": "./index.
|
|
45
|
+
"require": "./index.cjs",
|
|
46
|
+
"import": "./index.js"
|
|
46
47
|
},
|
|
48
|
+
"./internal.cjs": "./internal.cjs",
|
|
47
49
|
"./internal": {
|
|
48
50
|
"types": "./internal.d.ts",
|
|
49
|
-
"require": "./internal.
|
|
50
|
-
"import": "./internal.
|
|
51
|
+
"require": "./internal.cjs",
|
|
52
|
+
"import": "./internal.js"
|
|
51
53
|
}
|
|
52
54
|
},
|
|
53
55
|
"sideEffects": false
|
package/index.esm.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { createPlugin } from '@fullcalendar/core';
|
|
2
|
-
import premiumCommonPlugin from '@fullcalendar/premium-common';
|
|
3
|
-
import { ScrollGrid } from './internal.esm.js';
|
|
4
|
-
import '@fullcalendar/core/internal';
|
|
5
|
-
import '@fullcalendar/core/preact';
|
|
6
|
-
|
|
7
|
-
var index = createPlugin({
|
|
8
|
-
name: '@fullcalendar/scrollgrid',
|
|
9
|
-
premiumReleaseDate: '2023-01-30',
|
|
10
|
-
deps: [premiumCommonPlugin],
|
|
11
|
-
scrollGridImpl: ScrollGrid,
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
export { index as default };
|