@fullcalendar/timeline 7.0.0-beta.4 → 7.0.0-rc.0
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/LICENSE.md +2 -2
- package/index.cjs +1 -1
- package/index.global.js +348 -315
- package/index.global.min.js +2 -2
- package/index.js +1 -1
- package/internal.cjs +345 -312
- package/internal.d.ts +21 -18
- package/internal.js +344 -312
- package/package.json +4 -4
package/index.global.min.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
FullCalendar Timeline Plugin v7.0.0-
|
|
2
|
+
FullCalendar Timeline Plugin v7.0.0-rc.0
|
|
3
3
|
Docs & License: https://fullcalendar.io/docs/timeline-view-no-resources
|
|
4
4
|
(c) 2024 Adam Shaw
|
|
5
5
|
*/
|
|
6
|
-
FullCalendar.Timeline=function(e,t,n,i,r,s){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}var l=a(n);i.config.MAX_TIMELINE_SLOTS=1e3;const o=[{years:1},{months:1},{days:1},{hours:1},{minutes:30},{minutes:15},{minutes:10},{minutes:5},{minutes:1},{seconds:30},{seconds:15},{seconds:10},{seconds:5},{seconds:1},{milliseconds:500},{milliseconds:100},{milliseconds:10},{milliseconds:1}];function c(e,t,n,r){let s={labelInterval:n.slotLabelInterval,slotDuration:n.slotDuration};!function(e,t,n){const{currentRange:r}=t;if(e.labelInterval){n.countDurationsBetween(r.start,r.end,e.labelInterval)>i.config.MAX_TIMELINE_SLOTS&&(console.warn("slotLabelInterval results in too many cells"),e.labelInterval=null)}if(e.slotDuration){n.countDurationsBetween(r.start,r.end,e.slotDuration)>i.config.MAX_TIMELINE_SLOTS&&(console.warn("slotDuration results in too many cells"),e.slotDuration=null)}if(e.labelInterval&&e.slotDuration){const t=i.wholeDivideDurations(e.labelInterval,e.slotDuration);(null===t||t<1)&&(console.warn("slotLabelInterval must be a multiple of slotDuration"),e.slotDuration=null)}}(s,e,t),h(s,e,t),function(e,t,n){const{currentRange:r}=t;let{slotDuration:s}=e;if(!s){const a=h(e,t,n);for(let e of o){const t=i.createDuration(e),n=i.wholeDivideDurations(a,t);if(null!==n&&n>1&&n<=6){s=t;break}}if(s){n.countDurationsBetween(r.start,r.end,s)>200&&(s=null)}s||(s=a),e.slotDuration=s}}(s,e,t);let a=n.slotLabelFormat,l=Array.isArray(a)?a:null!=a?[a]:function(e,t,n,r){let s,a;const{labelInterval:l}=e;let o=i.greatestDurationDenominator(l).unit;const c=r.weekNumbers;let d=s=a=null;"week"!==o||c||(o="day");switch(o){case"year":d={year:"numeric"};break;case"month":m("years",t,n)>1&&(d={year:"numeric"}),s={month:"short"};break;case"week":m("years",t,n)>1&&(d={year:"numeric"}),s={week:"narrow"};break;case"day":m("years",t,n)>1?d={year:"numeric",month:"long"}:m("months",t,n)>1&&(d={month:"long"}),c&&(s={week:"short"}),a={weekday:"narrow",day:"numeric"};break;case"hour":c&&(d={week:"short"}),m("days",t,n)>1&&(s={weekday:"short",day:"numeric",month:"numeric",omitCommas:!0}),a={hour:"numeric",minute:"2-digit",omitZeroMinute:!0,meridiem:"short"};break;case"minute":i.asRoughMinutes(l)/60>=6?(d={hour:"numeric",meridiem:"short"},s=e=>":"+i.padStart(e.date.minute,2)):d={hour:"numeric",minute:"numeric",meridiem:"short"};break;case"second":i.asRoughSeconds(l)/60>=6?(d={hour:"numeric",minute:"2-digit",meridiem:"lowercase"},s=e=>":"+i.padStart(e.date.second,2)):d={hour:"numeric",minute:"2-digit",second:"2-digit",meridiem:"lowercase"};break;case"millisecond":d={hour:"numeric",minute:"2-digit",second:"2-digit",meridiem:"lowercase"},s=e=>"."+i.padStart(e.millisecond,3)}return[].concat(d||[],s||[],a||[])}(s,e,t,n);s.headerFormats=l.map(e=>i.createFormatter(e)),s.isTimeScale=Boolean(s.slotDuration.milliseconds);let c=null;if(!s.isTimeScale){const e=i.greatestDurationDenominator(s.slotDuration).unit;/year|month|week/.test(e)&&(c=e)}s.largeUnit=c,s.emphasizeWeeks=1===i.asCleanDays(s.slotDuration)&&m("weeks",e,t)>=2&&!n.businessHours;let g,p,v=n.snapDuration;v&&(g=i.createDuration(v),p=i.wholeDivideDurations(s.slotDuration,g)),null==p&&(g=s.slotDuration,p=1),s.snapDuration=g,s.snapsPerSlot=p;let S=i.asRoughMs(e.slotMaxTime)-i.asRoughMs(e.slotMinTime),R=d(e.renderRange.start,s,t),D=d(e.renderRange.end,s,t);s.isTimeScale&&(R=t.add(R,e.slotMinTime),D=t.add(i.addDays(D,-1),e.slotMaxTime)),s.timeWindowMs=S,s.normalizedRange={start:R,end:D};let y=[],w=R;for(;w<D;)f(w,s,e,r)&&y.push(w),w=t.add(w,s.slotDuration);s.slotDates=y;let b=-1,E=0;const x=[],W=[];for(w=R;w<D;)f(w,s,e,r)?(b+=1,x.push(b),W.push(E)):x.push(b+.5),w=t.add(w,s.snapDuration),E+=1;return s.snapDiffToIndex=x,s.snapIndexToDiff=W,s.snapCnt=b+1,s.slotCnt=s.snapCnt/s.snapsPerSlot,s.isWeekStarts=function(e,t){let{slotDates:n,emphasizeWeeks:i}=e,r=null,s=[];for(let e of n){let n=t.computeWeekNumber(e),a=i&&null!==r&&r!==n;r=n,s.push(a)}return s}(s,t),s.cellRows=function(e,t){let n=e.slotDates,r=e.headerFormats,s=r.map(()=>[]),a=i.asCleanDays(e.slotDuration),l=7===a?"week":1===a?"day":null,o=r.map(e=>e.getLargestUnit?e.getLargestUnit():null);for(let a=0;a<n.length;a+=1){let c=n[a],d=e.isWeekStarts[a];for(let n=0;n<r.length;n+=1){let a=r[n],f=s[n],h=f[f.length-1],m=n===r.length-1,g=r.length>1&&!m,p=null,v=o[n]||(m?l:null);if(g){let e=t.format(c,a);h&&h.text===e?h.colspan+=1:p=u(c,e,v)}else if(!h||i.isInt(t.countDurationsBetween(e.normalizedRange.start,c,e.labelInterval))){let e=t.format(c,a);p=u(c,e,v)}else h.colspan+=1;p&&(p.weekStart=d,f.push(p))}}return s}(s,t),s.slotsPerLabel=i.wholeDivideDurations(s.labelInterval,s.slotDuration),s}function d(e,t,n){let r=e;return t.isTimeScale||(r=i.startOfDay(r),t.largeUnit&&(r=n.startOf(r,t.largeUnit))),r}function f(e,t,n,r){if(r.isHiddenDay(e))return!1;if(t.isTimeScale){let r=i.startOfDay(e),s=e.valueOf()-r.valueOf()-i.asRoughMs(n.slotMinTime);return s=(s%864e5+864e5)%864e5,s<t.timeWindowMs}return!0}function h(e,t,n){const{currentRange:r}=t;let{labelInterval:s}=e;if(!s){let t;if(e.slotDuration){for(t of o){const n=i.createDuration(t),r=i.wholeDivideDurations(n,e.slotDuration);if(null!==r&&r<=6){s=n;break}}s||(s=e.slotDuration)}else for(t of o){s=i.createDuration(t);if(n.countDurationsBetween(r.start,r.end,s)>=18)break}e.labelInterval=s}return s}function m(e,t,n){let r=t.currentRange,s=null;return"years"===e?s=n.diffWholeYears(r.start,r.end):"months"===e||"weeks"===e?s=n.diffWholeMonths(r.start,r.end):"days"===e&&(s=i.diffWholeDays(r.start,r.end)),s||0}function u(e,t,n){return{date:e,text:t,rowUnit:n,colspan:1,isWeekStart:!1}}class g extends i.BaseComponent{constructor(){super(...arguments),this.innerElRef=r.createRef()}render(){let{props:e,context:t}=this,{dateEnv:n,options:s}=t,{date:a,tDateProfile:l,isEm:o}=e,c=i.getDateMeta(e.date,e.todayRange,e.nowDate,e.dateProfile),d=Object.assign(Object.assign({date:n.toDate(e.date)},c),{view:t.viewApi});return r.createElement(i.ContentContainer,{tag:"div",className:i.joinClassNames("fc-timeline-slot",o&&"fc-timeline-slot-em",l.isTimeScale&&(i.isInt(n.countDurationsBetween(l.normalizedRange.start,e.date,l.labelInterval))?"fc-timeline-slot-major":"fc-timeline-slot-minor"),"fc-timeline-slot-lane fc-cell fc-flex-col fc-align-start",e.borderStart&&"fc-border-s",e.isDay?i.getDayClassName(c):i.getSlotClassName(c)),attrs:Object.assign({"data-date":n.formatIso(a,{omitTimeZoneOffset:!0,omitTime:!l.isTimeScale})},c.isToday?{"aria-current":"date"}:{}),style:{width:e.width},renderProps:d,generatorName:"slotLaneContent",customGenerator:s.slotLaneContent,classNameGenerator:s.slotLaneClassNames,didMount:s.slotLaneDidMount,willUnmount:s.slotLaneWillUnmount},e=>r.createElement(e,{tag:"div",className:"fc-cell-inner",elRef:this.innerElRef}))}componentDidMount(){const e=this.innerElRef.current;this.disconnectInnerWidth=i.watchWidth(e,e=>{i.setRef(this.props.innerWidthRef,e)})}componentWillUnmount(){this.disconnectInnerWidth(),i.setRef(this.props.innerWidthRef,null)}}class p extends i.BaseComponent{constructor(){super(...arguments),this.innerWidthRefMap=new i.RefMap(()=>{i.afterSize(this.handleInnerWidths)}),this.handleInnerWidths=()=>{const e=this.innerWidthRefMap.current;let t=0;for(const n of e.values())t=Math.max(t,n);i.setRef(this.props.innerWidthRef,t)}}render(){let{props:e,innerWidthRefMap:t}=this,{tDateProfile:n,slotWidth:i}=e,{slotDates:s,isWeekStarts:a}=n,l=!n.isTimeScale&&!n.largeUnit;return r.createElement("div",{"aria-hidden":!0,className:"fc-timeline-slots fc-fill fc-flex-row",style:{height:e.height}},s.map((s,o)=>{let c=s.toISOString();return r.createElement(g,{key:c,date:s,dateProfile:e.dateProfile,tDateProfile:n,nowDate:e.nowDate,todayRange:e.todayRange,isEm:a[o],isDay:l,borderStart:Boolean(o),innerWidthRef:t.createRef(c),width:i})}))}}function v(e,t,n){let r=n.countDurationsBetween(t.normalizedRange.start,e,t.snapDuration);if(r<0)return 0;if(r>=t.snapDiffToIndex.length)return t.snapCnt;let s=Math.floor(r),a=t.snapDiffToIndex[s];return i.isInt(a)?a+=r-s:a=Math.ceil(a),a}function S(e,t){return e?t?{right:e.start,width:e.size}:{left:e.start,width:e.size}:{}}function R(e,t){return t?{right:e}:{left:e}}function D(e,t,n,i,r){if(null==i||null==r)return[void 0,void 0,!1];const s=r/e;let a,l;return s>=(n=Math.max(n||0,(i+1)/t,30))?(a=!0,l=s):(a=!1,l=Math.max(n,s)),[l*e,l,a]}function y(e,t,n,r,s){let a=t.add(n.activeRange.start,e);return r.isTimeScale||(a=i.startOfDay(a)),w(a,t,r,s)}function w(e,t,n,r){return function(e,t,n){let r=n.countDurationsBetween(t.normalizedRange.start,e,t.snapDuration);if(r<0)return 0;if(r>=t.snapDiffToIndex.length)return t.snapCnt;let s=Math.floor(r),a=t.snapDiffToIndex[s];i.isInt(a)?a+=r-s:a=Math.ceil(a);return a}(e,n,t)/n.snapsPerSlot*r}function b(e,t,n,r,s){const a={};for(const l of e)a[i.getEventKey(l)]=E(l,t,n,r,s);return a}function E(e,t,n,i,r){const s=w(e.startDate,n,i,r);let a=w(e.endDate,n,i,r)-s;return t&&(a=Math.max(a,t)),{start:s,size:a}}class x extends i.BaseComponent{render(){let{props:e}=this,t=[].concat(e.eventResizeSegs,e.dateSelectionSegs);return r.createElement(r.Fragment,null,this.renderSegs(e.businessHourSegs||[],"non-business"),this.renderSegs(e.bgEventSegs||[],"bg-event"),this.renderSegs(t,"highlight"))}renderSegs(e,t){let{tDateProfile:n,todayRange:s,nowDate:a,slotWidth:l}=this.props,{dateEnv:o,isRtl:c}=this.context;return r.createElement(r.Fragment,null,e.map(e=>{let d;if(null!=l){d=S(E(e,void 0,o,n,l),c)}return r.createElement("div",{key:i.buildEventRangeKey(e.eventRange),className:"fc-fill-y",style:d},"bg-event"===t?r.createElement(i.BgEvent,Object.assign({eventRange:e.eventRange,isStart:e.isStart,isEnd:e.isEnd},i.getEventRangeMeta(e.eventRange,s,a))):i.renderFill(t))}))}}class W extends i.Slicer{sliceRange(e,t,n,r,s){let a=function(e,t,n){if(!t.isTimeScale&&(e=i.computeVisibleDayRange(e),t.largeUnit)){let i=e;((e={start:n.startOf(e.start,t.largeUnit),end:n.startOf(e.end,t.largeUnit)}).end.valueOf()!==i.end.valueOf()||e.end<=e.start)&&(e={start:e.start,end:n.add(e.end,t.slotDuration)})}return e}(e,r,s),l=[];if(v(a.start,r,s)<v(a.end,r,s)){let e=i.intersectRanges(a,r.normalizedRange);e&&l.push({startDate:e.start,endDate:e.end,isStart:e.start.valueOf()===a.start.valueOf()&&f(e.start,r,t,n),isEnd:e.end.valueOf()===a.end.valueOf()&&f(i.addMs(e.end,-1),r,t,n)})}return l}}const M=i.createFormatter({hour:"numeric",minute:"2-digit",omitZeroMinute:!0,meridiem:"narrow"});class T extends i.BaseComponent{render(){let{props:e,context:t}=this,{options:n}=t;return r.createElement(i.StandardEvent,Object.assign({},e,{className:i.joinClassNames("fc-timeline-event",!1===n.eventOverlap&&"fc-timeline-event-spacious","fc-h-event"),defaultTimeFormat:M,defaultDisplayEventTime:!e.isTimeScale}))}}class I extends i.BaseComponent{render(){let{props:e}=this,{hiddenSegs:t,resourceId:n,forcedInvisibleMap:s}=e,a=n?{resourceId:n}:{};return r.createElement(i.MoreLinkContainer,{className:"fc-timeline-more-link",allDayDate:null,segs:t,hiddenSegs:t,dateProfile:e.dateProfile,todayRange:e.todayRange,dateSpanProps:a,popoverContent:()=>r.createElement(r.Fragment,null,t.map(t=>{let{eventRange:n}=t,a=n.instance.instanceId;return r.createElement("div",{key:a,style:{visibility:s[a]?"hidden":""}},r.createElement(T,Object.assign({isTimeScale:e.isTimeScale,eventRange:n,isStart:t.isStart,isEnd:t.isEnd,isDragging:!1,isResizing:!1,isDateSelecting:!1,isSelected:a===e.eventSelection},i.getEventRangeMeta(n,e.todayRange,e.nowDate))))}))},e=>r.createElement(e,{tag:"div",className:"fc-timeline-more-link-inner fc-sticky-s"}))}}class k extends r.Component{constructor(){super(...arguments),this.rootElRef=r.createRef()}render(){const{props:e}=this;return r.createElement("div",{className:"fc-abs",style:e.style,ref:this.rootElRef},e.children)}componentDidMount(){const e=this.rootElRef.current;this.disconnectHeight=i.watchHeight(e,e=>{i.setRef(this.props.heightRef,e)})}componentWillUnmount(){this.disconnectHeight(),i.setRef(this.props.heightRef,null)}}class P extends i.BaseComponent{constructor(){super(...arguments),this.sortEventSegs=i.memoize(i.sortEventSegs),this.segHeightRefMap=new i.RefMap(()=>{i.afterSize(this.handleSegHeights)}),this.moreLinkHeightRefMap=new i.RefMap(()=>{i.afterSize(this.handleMoreLinkHeights)}),this.slicer=new W,this.handleMoreLinkHeights=()=>{this.setState({moreLinkHeightRev:this.moreLinkHeightRefMap.rev})},this.handleSegHeights=()=>{this.setState({segHeightRev:this.segHeightRefMap.rev})}}render(){let{props:e,context:t,segHeightRefMap:n,moreLinkHeightRefMap:s}=this,{options:a}=t,{dateProfile:l,tDateProfile:o}=e,c=this.slicer.sliceProps(e,l,o.isTimeScale?null:e.nextDayThreshold,t,l,t.dateProfileGenerator,o,t.dateEnv),d=(c.eventDrag?c.eventDrag.segs:null)||(c.eventResize?c.eventResize.segs:null)||[],f=this.sortEventSegs(c.fgEventSegs,a.eventOrder),h=null!=e.slotWidth?b(f,a.eventMinWidth,t.dateEnv,o,e.slotWidth):{},[m,u,g,p]=function(e,t,n,r,s,a){const l=[];for(const n of e){const e=t[i.getEventKey(n)];e&&l.push(Object.assign(Object.assign({},n),{start:e.start,end:e.start+e.size}))}const o=new i.SegHierarchy(l,e=>n.get(i.getEventKey(e)),s,void 0,a),c=new Map;o.traverseSegs((e,t)=>{c.set(i.getEventKey(e),t)});const{hiddenSegs:d}=o;let f=0;for(const e of l){const t=i.getEventKey(e),r=n.get(t),s=c.get(t);null!=r&&null!=s&&(f=Math.max(f,s+r))}const h=i.groupIntersectingSegs(d),m=new Map;o.strictOrder=!0;for(const e of h){const{levelCoord:t}=o.findInsertion(e,0),n=r.get(e.key)||0;m.set(e.key,t),f=Math.max(f,t+n)}return[c,h,m,f]}(f,h,n.current,s.current,a.eventOrderStrict,a.eventMaxStack),v=(c.eventDrag?c.eventDrag.affectedInstances:null)||(c.eventResize?c.eventResize.affectedInstances:null)||{};return r.createElement(r.Fragment,null,r.createElement(x,{tDateProfile:o,nowDate:e.nowDate,todayRange:e.todayRange,bgEventSegs:c.bgEventSegs,businessHourSegs:c.businessHourSegs,dateSelectionSegs:c.dateSelectionSegs,eventResizeSegs:c.eventResize?c.eventResize.segs:[],slotWidth:e.slotWidth}),r.createElement("div",{className:i.joinClassNames("fc-timeline-events",!1===a.eventOverlap?"fc-timeline-events-overlap-disabled":"fc-timeline-events-overlap-enabled","fc-content-box"),style:{height:p}},this.renderFgSegs(f,h,m,v,u,g,!1,!1,!1),this.renderFgSegs(d,e.slotWidth?b(d,a.eventMinWidth,t.dateEnv,o,e.slotWidth):{},m,{},[],new Map,Boolean(c.eventDrag),Boolean(c.eventResize),!1)))}renderFgSegs(e,t,n,s,a,l,o,c,d){let{props:f,context:h,segHeightRefMap:m,moreLinkHeightRefMap:u}=this,g=o||c||d;return r.createElement(r.Fragment,null,e.map(e=>{const{eventRange:a}=e,{instanceId:l}=a.instance,u=n.get(l),p=t[l],v=g||p&&null!=u&&!s[l];return r.createElement(k,{key:l,style:Object.assign({visibility:v?"":"hidden",top:u||0},S(p,h.isRtl)),heightRef:g?void 0:m.createRef(l)},r.createElement(T,Object.assign({isTimeScale:f.tDateProfile.isTimeScale,eventRange:a,isStart:e.isStart,isEnd:e.isEnd,isDragging:o,isResizing:c,isDateSelecting:d,isSelected:l===f.eventSelection},i.getEventRangeMeta(a,f.todayRange,f.nowDate))))}),a.map(e=>r.createElement(k,{key:e.key,style:Object.assign({top:l.get(e.key)||0},S({start:e.start,size:e.end-e.start},h.isRtl)),heightRef:u.createRef(e.key)},r.createElement(I,{hiddenSegs:e.segs,dateProfile:f.dateProfile,nowDate:f.nowDate,todayRange:f.todayRange,isTimeScale:f.tDateProfile.isTimeScale,eventSelection:f.eventSelection,resourceId:f.resourceId,forcedInvisibleMap:s}))))}}class C extends i.BaseComponent{constructor(){super(...arguments),this.refineRenderProps=i.memoizeObjArg(N),this.innerElRef=r.createRef()}render(){let{props:e,context:t}=this,{dateEnv:n,options:s}=t,{cell:a,dateProfile:l,tDateProfile:o}=e,c=i.getDateMeta(a.date,e.todayRange,e.nowDate,l),d=this.refineRenderProps({level:e.rowLevel,dateMarker:a.date,text:a.text,dateEnv:t.dateEnv,viewApi:t.viewApi}),f=!c.isDisabled&&a.rowUnit&&"time"!==a.rowUnit;return r.createElement(i.ContentContainer,{tag:"div",className:i.joinClassNames("fc-timeline-slot-label fc-timeline-slot",a.isWeekStart&&"fc-timeline-slot-em","fc-header-cell fc-cell fc-flex-col fc-justify-center",e.borderStart&&"fc-border-s",e.isCentered?"fc-align-center":"fc-align-start","time"===a.rowUnit?i.getSlotClassName(c):i.getDayClassName(c)),attrs:Object.assign({"data-date":n.formatIso(a.date,{omitTime:!o.isTimeScale,omitTimeZoneOffset:!0})},c.isToday?{"aria-current":"date"}:{}),style:{width:null!=e.slotWidth?e.slotWidth*a.colspan:void 0},renderProps:d,generatorName:"slotLabelContent",customGenerator:s.slotLabelContent,defaultGenerator:z,classNameGenerator:s.slotLabelClassNames,didMount:s.slotLabelDidMount,willUnmount:s.slotLabelWillUnmount},n=>r.createElement(n,{tag:"div",attrs:f?i.buildNavLinkAttrs(t,a.date,a.rowUnit,void 0,!1):{},className:i.joinClassNames("fc-cell-inner fc-padding-md",e.isSticky&&"fc-sticky-s"),elRef:this.innerElRef}))}componentDidMount(){const{props:e}=this,t=this.innerElRef.current;this.detachSize=i.watchSize(t,(n,r)=>{i.setRef(e.innerWidthRef,n),i.setRef(e.innerHeightRef,r),t.style.left=t.style.right=e.isCentered&&e.isSticky?`calc(50% - ${n/2}px)`:""})}componentWillUnmount(){const{props:e}=this;this.detachSize(),i.setRef(e.innerWidthRef,null),i.setRef(e.innerHeightRef,null)}}function z(e){return e.text}function N(e){return{level:e.level,date:e.dateEnv.toDate(e.dateMarker),view:e.viewApi,text:e.text}}class L extends i.BaseComponent{constructor(){super(...arguments),this.innerWidthRefMap=new i.RefMap(()=>{i.afterSize(this.handleInnerWidths)}),this.innerHeightRefMap=new i.RefMap(()=>{i.afterSize(this.handleInnerHeights)}),this.handleInnerWidths=()=>{const e=this.innerWidthRefMap.current;let t=0;for(const n of e.values())t=Math.max(t,n);i.setRef(this.props.innerWidthRef,t)},this.handleInnerHeights=()=>{const e=this.innerHeightRefMap.current;let t=0;for(const n of e.values())t=Math.max(t,n);i.setRef(this.props.innerHeighRef,t)}}render(){const{props:e,innerWidthRefMap:t,innerHeightRefMap:n}=this,s=!(e.tDateProfile.isTimeScale&&e.isLastRow),a=!e.isLastRow;return r.createElement("div",{className:i.joinClassNames("fc-flex-row fc-grow",!e.isLastRow&&"fc-border-b")},e.cells.map((i,l)=>{const o=i.rowUnit+":"+i.date.toISOString();return r.createElement(C,{key:o,cell:i,rowLevel:e.rowLevel,dateProfile:e.dateProfile,tDateProfile:e.tDateProfile,todayRange:e.todayRange,nowDate:e.nowDate,isCentered:s,isSticky:a,borderStart:Boolean(l),innerWidthRef:t.createRef(o),innerHeightRef:n.createRef(o),slotWidth:e.slotWidth})}))}componentWillUnmount(){i.setRef(this.props.innerWidthRef,null),i.setRef(this.props.innerHeighRef,null)}}class H extends i.BaseComponent{render(){const{props:e,context:t}=this;return r.createElement("div",{className:"fc-timeline-now-indicator-container"},r.createElement(i.NowIndicatorContainer,{className:"fc-timeline-now-indicator-line",style:null!=e.slotWidth?R(w(e.nowDate,t.dateEnv,e.tDateProfile,e.slotWidth),t.isRtl):{},isAxis:!1,date:e.nowDate}))}}class O extends i.BaseComponent{render(){const{props:e,context:t}=this;return r.createElement("div",{className:"fc-timeline-now-indicator-container"},r.createElement(i.NowIndicatorContainer,{className:"fc-timeline-now-indicator-arrow",style:null!=e.slotWidth?R(w(e.nowDate,t.dateEnv,e.tDateProfile,e.slotWidth),t.isRtl):{},isAxis:!0,date:e.nowDate}))}}class B extends i.DateComponent{constructor(){super(...arguments),this.buildTimelineDateProfile=i.memoize(c),this.computeSlotWidth=i.memoize(D),this.headerScrollerRef=r.createRef(),this.bodyScrollerRef=r.createRef(),this.footerScrollerRef=r.createRef(),this.headerRowInnerWidthMap=new i.RefMap(()=>{i.afterSize(this.handleSlotInnerWidths)}),this.scrollTime=null,this.handleBodySlotInnerWidth=e=>{this.bodySlotInnerWidth=e,i.afterSize(this.handleSlotInnerWidths)},this.handleSlotInnerWidths=()=>{const{state:e}=this,t=Math.max(this.headerRowInnerWidthMap.current.get(this.tDateProfile.cellRows.length-1)||0,this.bodySlotInnerWidth);e.slotInnerWidth!==t&&this.setState({slotInnerWidth:t})},this.handleClientWidth=e=>{this.setState({clientWidth:e})},this.handleEndScrollbarWidth=e=>{this.setState({endScrollbarWidth:e})},this.handleTimeScrollRequest=e=>{this.scrollTime=e,this.applyTimeScroll()},this.handleTimeScrollEnd=({isUser:e})=>{e&&(this.scrollTime=null)},this.handeBodyEl=e=>{this.bodyEl=e,e?this.context.registerInteractiveComponent(this,{el:e}):this.context.unregisterInteractiveComponent(this)}}render(){const{props:e,state:t,context:n}=this,{options:s}=n,a=this.tDateProfile=this.buildTimelineDateProfile(e.dateProfile,n.dateEnv,s,n.dateProfileGenerator),{cellRows:l}=a,o=i.greatestDurationDenominator(a.slotDuration).unit,c=!e.forPrint&&!i.getIsHeightAuto(s),d=!e.forPrint&&i.getStickyHeaderDates(s),f=!e.forPrint&&i.getStickyFooterScrollbar(s),[h,m]=this.computeSlotWidth(a.slotCnt,a.slotsPerLabel,s.slotMinWidth,t.slotInnerWidth,t.clientWidth);return this.slotWidth=m,r.createElement(i.NowTimer,{unit:o},(o,u)=>{const g=s.nowIndicator&&null!=m&&i.rangeContainsMarker(e.dateProfile.currentRange,o);return r.createElement(i.ViewContainer,{viewSpec:n.viewSpec,className:i.joinClassNames("fc-timeline fc-border",!e.forPrint&&"fc-flex-col")},r.createElement(i.Scroller,{horizontal:!0,hideScrollbars:!0,className:i.joinClassNames("fc-timeline-header fc-flex-row fc-border-b",d&&"fc-table-header-sticky"),ref:this.headerScrollerRef},r.createElement("div",{className:i.joinClassNames("fc-rel",null==h&&"fc-liquid"),style:{width:h}},l.map((t,n)=>{const i=n===l.length-1;return r.createElement(L,{key:n,dateProfile:e.dateProfile,tDateProfile:a,nowDate:o,todayRange:u,rowLevel:n,isLastRow:i,cells:t,slotWidth:m,innerWidthRef:this.headerRowInnerWidthMap.createRef(n)})}),g&&r.createElement(O,{tDateProfile:a,nowDate:o,slotWidth:m})),Boolean(t.endScrollbarWidth)&&r.createElement("div",{className:"fc-border-s fc-filler",style:{minWidth:t.endScrollbarWidth}})),r.createElement(i.Scroller,{vertical:c,horizontal:!0,hideScrollbars:e.forPrint,className:i.joinClassNames("fc-timeline-body fc-flex-col",c&&"fc-liquid"),ref:this.bodyScrollerRef,clientWidthRef:this.handleClientWidth,endScrollbarWidthRef:this.handleEndScrollbarWidth},r.createElement("div",{"aria-label":s.eventsHint,className:"fc-rel fc-grow",style:{width:h},ref:this.handeBodyEl},r.createElement(p,{dateProfile:e.dateProfile,tDateProfile:a,nowDate:o,todayRange:u,innerWidthRef:this.handleBodySlotInnerWidth,slotWidth:m}),r.createElement(P,{dateProfile:e.dateProfile,tDateProfile:a,nowDate:o,todayRange:u,nextDayThreshold:s.nextDayThreshold,eventStore:e.eventStore,eventUiBases:e.eventUiBases,businessHours:e.businessHours,dateSelection:e.dateSelection,eventDrag:e.eventDrag,eventResize:e.eventResize,eventSelection:e.eventSelection,slotWidth:m}),g&&r.createElement(H,{tDateProfile:a,nowDate:o,slotWidth:m}))),f&&r.createElement(i.Scroller,{ref:this.footerScrollerRef,horizontal:!0},r.createElement("div",{style:{width:h}})))})}componentDidMount(){this.syncedScroller=new s.ScrollerSyncer(!0),this.updateSyncedScroller(),this.resetScroll(),this.context.emitter.on("_timeScrollRequest",this.handleTimeScrollRequest),this.syncedScroller.addScrollEndListener(this.handleTimeScrollEnd)}componentDidUpdate(e){this.updateSyncedScroller(),e.dateProfile!==this.props.dateProfile&&this.context.options.scrollTimeReset?this.resetScroll():this.applyTimeScroll()}componentWillUnmount(){this.syncedScroller.destroy(),this.context.emitter.off("_timeScrollRequest",this.handleTimeScrollRequest),this.syncedScroller.removeScrollEndListener(this.handleTimeScrollEnd)}updateSyncedScroller(){this.syncedScroller.handleChildren([this.headerScrollerRef.current,this.bodyScrollerRef.current,this.footerScrollerRef.current])}resetScroll(){this.handleTimeScrollRequest(this.context.options.scrollTime)}applyTimeScroll(){const{props:e,context:t,tDateProfile:n,scrollTime:i,slotWidth:r}=this;if(null!=i&&null!=r){let s=y(i,t.dateEnv,e.dateProfile,n,r);s&&(s+=1),this.syncedScroller.scrollTo({x:s})}}queryHit(e,t,n,r){const{props:s,context:a,tDateProfile:l,slotWidth:o}=this,{dateEnv:c}=a;if(o){const t=a.isRtl?n-e:e,d=Math.floor(t/o),f=(t-d*o)/o,h=Math.floor(f*l.snapsPerSlot);let m,u,g=c.add(l.slotDates[d],i.multiplyDuration(l.snapDuration,h)),p=c.add(g,l.snapDuration),v=o/l.snapsPerSlot,S=d*o+v*h,R=S+v;return a.isRtl?(m=n-R,u=n-S):(m=S,u=R),{dateProfile:s.dateProfile,dateSpan:{range:{start:g,end:p},allDay:!l.isTimeScale},rect:{left:m,right:u,top:0,bottom:r},dayEl:this.bodyEl.querySelectorAll(".fc-timeline-slot")[d],layer:0}}return null}}i.injectStyles('.fc-timeline-slots{z-index:1}.fc-timeline-events{position:relative;z-index:2}.fc-timeline-slot-minor{border-style:dotted}.fc-timeline-events-overlap-enabled{padding-bottom:10px}.fc-timeline-event{border-radius:0;font-size:var(--fc-small-font-size);margin-bottom:1px}.fc-direction-ltr .fc-timeline-event.fc-event-end{margin-right:1px}.fc-direction-rtl .fc-timeline-event.fc-event-end{margin-left:1px}.fc-timeline-event .fc-event-inner{align-items:center;display:flex;flex-direction:row;padding:2px 1px}.fc-timeline-event-spacious .fc-event-inner{padding-bottom:5px;padding-top:5px}.fc-timeline-event .fc-event-time{font-weight:700}.fc-timeline-event .fc-event-time,.fc-timeline-event .fc-event-title{padding:0 2px}.fc-timeline-event:not(.fc-event-end) .fc-event-inner:after,.fc-timeline-event:not(.fc-event-start) .fc-event-inner:before{border-color:transparent #000;border-style:solid;border-width:5px;content:"";flex-grow:0;flex-shrink:0;height:0;margin:0 1px;opacity:.5;width:0}.fc-direction-ltr .fc-timeline-event:not(.fc-event-start) .fc-event-inner:before,.fc-direction-rtl .fc-timeline-event:not(.fc-event-end) .fc-event-inner:after{border-left:0}.fc-direction-ltr .fc-timeline-event:not(.fc-event-end) .fc-event-inner:after,.fc-direction-rtl .fc-timeline-event:not(.fc-event-start) .fc-event-inner:before{border-right:0}.fc-timeline-more-link{align-items:flex-start;background:var(--fc-more-link-bg-color);color:var(--fc-more-link-text-color);cursor:pointer;display:flex;flex-direction:column;font-size:var(--fc-small-font-size);padding:1px}.fc-direction-ltr .fc-timeline-more-link{margin-right:1px}.fc-direction-rtl .fc-timeline-more-link{margin-left:1px}.fc-timeline-more-link-inner{padding:2px}.fc-timeline-now-indicator-container{bottom:0;left:0;overflow:hidden;pointer-events:none;position:absolute;right:0;top:0;z-index:4}.fc-timeline-now-indicator-arrow{border-bottom-style:solid;border-bottom-width:0;border-color:var(--fc-now-indicator-color);border-left:5px solid transparent;border-right:5px solid transparent;border-top-style:solid;border-top-width:6px;height:0;margin:0 -5px;position:absolute;top:0;width:0}.fc-timeline-now-indicator-line{border-left:1px solid var(--fc-now-indicator-color);bottom:0;position:absolute;top:0}');var U=t.createPlugin({name:"@fullcalendar/timeline",premiumReleaseDate:"2025-01-09",deps:[l.default],initialView:"timelineDay",views:{timeline:{component:B,usesMinMaxTime:!0,eventResizableFromStart:!0},timelineDay:{type:"timeline",duration:{days:1}},timelineWeek:{type:"timeline",duration:{weeks:1}},timelineMonth:{type:"timeline",duration:{months:1}},timelineYear:{type:"timeline",duration:{years:1}}}}),j={__proto__:null,TimelineView:B,TimelineLane:P,TimelineLaneBg:x,TimelineSlats:p,buildTimelineDateProfile:c,createVerticalStyle:function(e){if(e)return{top:e.start,height:e.size}},createHorizontalStyle:function(e,t){if(e)return{[t?"right":"left"]:e.start,width:e.size}},computeSlotWidth:D,timeToCoord:y,TimelineLaneSlicer:W,TimelineHeaderRow:L,TimelineNowIndicatorArrow:O,TimelineNowIndicatorLine:H};return t.globalPlugins.push(U),e.Internal=j,e.default=U,Object.defineProperty(e,"__esModule",{value:!0}),e}({},FullCalendar,FullCalendar.PremiumCommon,FullCalendar.Internal,FullCalendar.Preact,FullCalendar.ScrollGrid.Internal);
|
|
6
|
+
FullCalendar.Timeline=function(e,t,n,i,r,s){"use strict";function l(e){return e&&e.__esModule?e:{default:e}}var a=l(n);i.config.MAX_TIMELINE_SLOTS=1e3;const o=[{years:1},{months:1},{days:1},{hours:1},{minutes:30},{minutes:15},{minutes:10},{minutes:5},{minutes:1},{seconds:30},{seconds:15},{seconds:10},{seconds:5},{seconds:1},{milliseconds:500},{milliseconds:100},{milliseconds:10},{milliseconds:1}];function c(e,t,n,r){let s={labelInterval:n.slotLabelInterval,slotDuration:n.slotDuration};!function(e,t,n){const{currentRange:r}=t;if(e.labelInterval){n.countDurationsBetween(r.start,r.end,e.labelInterval)>i.config.MAX_TIMELINE_SLOTS&&(console.warn("slotLabelInterval results in too many cells"),e.labelInterval=null)}if(e.slotDuration){n.countDurationsBetween(r.start,r.end,e.slotDuration)>i.config.MAX_TIMELINE_SLOTS&&(console.warn("slotDuration results in too many cells"),e.slotDuration=null)}if(e.labelInterval&&e.slotDuration){const t=i.wholeDivideDurations(e.labelInterval,e.slotDuration);(null===t||t<1)&&(console.warn("slotLabelInterval must be a multiple of slotDuration"),e.slotDuration=null)}}(s,e,t),h(s,e,t),function(e,t,n){const{currentRange:r}=t;let{slotDuration:s}=e;if(!s){const l=h(e,t,n);for(let e of o){const t=i.createDuration(e),n=i.wholeDivideDurations(l,t);if(null!==n&&n>1&&n<=6){s=t;break}}if(s){n.countDurationsBetween(r.start,r.end,s)>200&&(s=null)}s||(s=l),e.slotDuration=s}}(s,e,t);let l=n.slotLabelFormat,a=Array.isArray(l)?l:null!=l?[l]:function(e,t,n,r){let s,l;const{labelInterval:a}=e;let o=i.greatestDurationDenominator(a).unit;const c=r.weekNumbers;let d=s=l=null;"week"!==o||c||(o="day");switch(o){case"year":d={year:"numeric"};break;case"month":m("years",t,n)>1&&(d={year:"numeric"}),s={month:"short"};break;case"week":m("years",t,n)>1&&(d={year:"numeric"}),s={week:"narrow"};break;case"day":m("years",t,n)>1?d={year:"numeric",month:"long"}:m("months",t,n)>1&&(d={month:"long"}),c&&(s={week:"short"}),l={weekday:"narrow",day:"numeric"};break;case"hour":c&&(d={week:"short"}),m("days",t,n)>1&&(s={weekday:"short",day:"numeric",month:"numeric",omitCommas:!0}),l={hour:"numeric",minute:"2-digit",omitZeroMinute:!0,meridiem:"short"};break;case"minute":i.asRoughMinutes(a)/60>=6?(d={hour:"numeric",meridiem:"short"},s=e=>":"+i.padStart(e.date.minute,2)):d={hour:"numeric",minute:"numeric",meridiem:"short"};break;case"second":i.asRoughSeconds(a)/60>=6?(d={hour:"numeric",minute:"2-digit",meridiem:"lowercase"},s=e=>":"+i.padStart(e.date.second,2)):d={hour:"numeric",minute:"2-digit",second:"2-digit",meridiem:"lowercase"};break;case"millisecond":d={hour:"numeric",minute:"2-digit",second:"2-digit",meridiem:"lowercase"},s=e=>"."+i.padStart(e.millisecond,3)}return[].concat(d||[],s||[],l||[])}(s,e,t,n);s.headerFormats=a.map(e=>i.createFormatter(e)),s.isTimeScale=Boolean(s.slotDuration.milliseconds);let c=null;if(!s.isTimeScale){const e=i.greatestDurationDenominator(s.slotDuration).unit;/year|month|week/.test(e)&&(c=e)}s.largeUnit=c,s.emphasizeWeeks=1===i.asCleanDays(s.slotDuration)&&m("weeks",e,t)>=2&&!n.businessHours;let g,p,v=n.snapDuration;v&&(g=i.createDuration(v),p=i.wholeDivideDurations(s.slotDuration,g)),null==p&&(g=s.slotDuration,p=1),s.snapDuration=g,s.snapsPerSlot=p;let S=i.asRoughMs(e.slotMaxTime)-i.asRoughMs(e.slotMinTime),R=d(e.renderRange.start,s,t),D=d(e.renderRange.end,s,t);s.isTimeScale&&(R=t.add(R,e.slotMinTime),D=t.add(i.addDays(D,-1),e.slotMaxTime)),s.timeWindowMs=S,s.normalizedRange={start:R,end:D};let y=[],w=R;for(;w<D;)f(w,s,e,r)&&y.push(w),w=t.add(w,s.slotDuration);s.slotDates=y;let b=-1,E=0;const W=[],x=[];for(w=R;w<D;)f(w,s,e,r)?(b+=1,W.push(b),x.push(E)):W.push(b+.5),w=t.add(w,s.snapDuration),E+=1;return s.snapDiffToIndex=W,s.snapIndexToDiff=x,s.snapCnt=b+1,s.slotCnt=s.snapCnt/s.snapsPerSlot,s.isWeekStarts=function(e,t){let{slotDates:n,emphasizeWeeks:i}=e,r=null,s=[];for(let e of n){let n=t.computeWeekNumber(e),l=i&&null!==r&&r!==n;r=n,s.push(l)}return s}(s,t),s.cellRows=function(e,t){let n=e.slotDates,r=e.headerFormats,s=r.map(()=>[]),l=i.asCleanDays(e.slotDuration),a=7===l?"week":1===l?"day":null,o=r.map(e=>e.getLargestUnit?e.getLargestUnit():null);for(let l=0;l<n.length;l+=1){let c=n[l],d=e.isWeekStarts[l];for(let n=0;n<r.length;n+=1){let l=r[n],f=s[n],h=f[f.length-1],m=n===r.length-1,g=r.length>1&&!m,p=null,v=o[n]||(m?a:null);if(g){let e=t.format(c,l);h&&h.text===e?h.colspan+=1:p=u(c,e,v)}else if(!h||i.isInt(t.countDurationsBetween(e.normalizedRange.start,c,e.labelInterval))){let e=t.format(c,l);p=u(c,e,v)}else h.colspan+=1;p&&(p.weekStart=d,f.push(p))}}return s}(s,t),s.slotsPerLabel=i.wholeDivideDurations(s.labelInterval,s.slotDuration),s}function d(e,t,n){let r=e;return t.isTimeScale||(r=i.startOfDay(r),t.largeUnit&&(r=n.startOf(r,t.largeUnit))),r}function f(e,t,n,r){if(r.isHiddenDay(e))return!1;if(t.isTimeScale){let r=i.startOfDay(e),s=e.valueOf()-r.valueOf()-i.asRoughMs(n.slotMinTime);return s=(s%864e5+864e5)%864e5,s<t.timeWindowMs}return!0}function h(e,t,n){const{currentRange:r}=t;let{labelInterval:s}=e;if(!s){let t;if(e.slotDuration){for(t of o){const n=i.createDuration(t),r=i.wholeDivideDurations(n,e.slotDuration);if(null!==r&&r<=6){s=n;break}}s||(s=e.slotDuration)}else for(t of o){s=i.createDuration(t);if(n.countDurationsBetween(r.start,r.end,s)>=18)break}e.labelInterval=s}return s}function m(e,t,n){let r=t.currentRange,s=null;return"years"===e?s=n.diffWholeYears(r.start,r.end):"months"===e||"weeks"===e?s=n.diffWholeMonths(r.start,r.end):"days"===e&&(s=i.diffWholeDays(r.start,r.end)),s||0}function u(e,t,n){return{date:e,text:t,rowUnit:n,colspan:1,isWeekStart:!1}}class g extends i.BaseComponent{constructor(){super(...arguments),this.getPublicDate=i.memoize((e,t)=>e.toDate(t)),this.innerElRef=r.createRef()}render(){let{props:e,context:t}=this,{dateEnv:n,options:s}=t,{date:l,tDateProfile:a,isEm:o}=e,c=i.getDateMeta(e.date,e.todayRange,e.nowDate,e.dateProfile),d=Object.assign(Object.assign({date:this.getPublicDate(n,e.date)},c),{view:t.viewApi});return r.createElement(i.ContentContainer,{tag:"div",className:i.joinClassNames("fc-timeline-slot",o&&"fc-timeline-slot-em",a.isTimeScale&&(i.isInt(n.countDurationsBetween(a.normalizedRange.start,e.date,a.labelInterval))?"fc-timeline-slot-major":"fc-timeline-slot-minor"),"fc-timeline-slot-lane fc-cell fc-flex-col fc-align-start",e.borderStart&&"fc-border-s",e.isDay?i.getDayClassName(c):i.getSlotClassName(c)),attrs:Object.assign({"data-date":n.formatIso(l,{omitTimeZoneOffset:!0,omitTime:!a.isTimeScale})},c.isToday?{"aria-current":"date"}:{}),style:{width:e.width},renderProps:d,generatorName:"slotLaneContent",customGenerator:s.slotLaneContent,classNameGenerator:s.slotLaneClassNames,didMount:s.slotLaneDidMount,willUnmount:s.slotLaneWillUnmount},e=>r.createElement(e,{tag:"div",className:"fc-cell-inner",style:{minWidth:1},elRef:this.innerElRef}))}componentDidMount(){const e=this.innerElRef.current;this.disconnectInnerWidth=i.watchWidth(e,e=>{i.setRef(this.props.innerWidthRef,e)})}componentWillUnmount(){this.disconnectInnerWidth(),i.setRef(this.props.innerWidthRef,null)}}class p extends i.BaseComponent{constructor(){super(...arguments),this.innerWidthRefMap=new i.RefMap(()=>{i.afterSize(this.handleInnerWidths)}),this.handleInnerWidths=()=>{const e=this.innerWidthRefMap.current;let t=0;for(const n of e.values())t=Math.max(t,n);i.setRef(this.props.innerWidthRef,t)}}render(){let{props:e,innerWidthRefMap:t}=this,{tDateProfile:n,slotWidth:i}=e,{slotDates:s,isWeekStarts:l}=n,a=!n.isTimeScale&&!n.largeUnit;return r.createElement("div",{"aria-hidden":!0,className:"fc-timeline-slots fc-flex-row fc-fill",style:{height:e.height}},s.map((s,o)=>{let c=s.toISOString();return r.createElement(g,{key:c,date:s,dateProfile:e.dateProfile,tDateProfile:n,nowDate:e.nowDate,todayRange:e.todayRange,isEm:l[o],isDay:a,borderStart:Boolean(o),innerWidthRef:t.createRef(c),width:i})}))}}class v extends i.BaseComponent{constructor(){super(...arguments),this.refineRenderProps=i.memoizeObjArg(R),this.innerElRef=r.createRef()}render(){let{props:e,context:t}=this,{dateEnv:n,options:s}=t,{cell:l,dateProfile:a,tDateProfile:o}=e,c=i.getDateMeta(l.date,e.todayRange,e.nowDate,a),d=this.refineRenderProps({level:e.rowLevel,dateMarker:l.date,text:l.text,dateEnv:t.dateEnv,viewApi:t.viewApi}),f=!c.isDisabled&&l.rowUnit&&"time"!==l.rowUnit;return r.createElement(i.ContentContainer,{tag:"div",className:i.joinClassNames("fc-timeline-slot-label fc-timeline-slot",l.isWeekStart&&"fc-timeline-slot-em","fc-header-cell fc-cell fc-flex-col fc-justify-center",e.borderStart&&"fc-border-s",e.isCentered?"fc-align-center":"fc-align-start","time"===l.rowUnit?i.getSlotClassName(c):i.getDayClassName(c)),attrs:Object.assign({"data-date":n.formatIso(l.date,{omitTime:!o.isTimeScale,omitTimeZoneOffset:!0})},c.isToday?{"aria-current":"date"}:{}),style:{width:null!=e.slotWidth?e.slotWidth*l.colspan:void 0},renderProps:d,generatorName:"slotLabelContent",customGenerator:s.slotLabelContent,defaultGenerator:S,classNameGenerator:s.slotLabelClassNames,didMount:s.slotLabelDidMount,willUnmount:s.slotLabelWillUnmount},n=>r.createElement(n,{tag:"div",attrs:f?i.buildNavLinkAttrs(t,l.date,l.rowUnit,void 0,!1):{},className:i.joinClassNames("fc-cell-inner fc-padding-md",e.isSticky&&"fc-sticky-s"),elRef:this.innerElRef}))}componentDidMount(){const{props:e}=this,t=this.innerElRef.current;this.detachSize=i.watchSize(t,(n,r)=>{i.setRef(e.innerWidthRef,n),i.setRef(e.innerHeightRef,r),t.style.left=t.style.right=e.isCentered&&e.isSticky?`calc(50% - ${n/2}px)`:""})}componentWillUnmount(){const{props:e}=this;this.detachSize(),i.setRef(e.innerWidthRef,null),i.setRef(e.innerHeightRef,null)}}function S(e){return e.text}function R(e){return{level:e.level,date:e.dateEnv.toDate(e.dateMarker),view:e.viewApi,text:e.text}}class D extends i.BaseComponent{constructor(){super(...arguments),this.innerWidthRefMap=new i.RefMap(()=>{i.afterSize(this.handleInnerWidths)}),this.innerHeightRefMap=new i.RefMap(()=>{i.afterSize(this.handleInnerHeights)}),this.handleInnerWidths=()=>{const e=this.innerWidthRefMap.current;let t=0;for(const n of e.values())t=Math.max(t,n);i.setRef(this.props.innerWidthRef,t)},this.handleInnerHeights=()=>{const e=this.innerHeightRefMap.current;let t=0;for(const n of e.values())t=Math.max(t,n);i.setRef(this.props.innerHeighRef,t)}}render(){const{props:e,innerWidthRefMap:t,innerHeightRefMap:n}=this,s=!(e.tDateProfile.isTimeScale&&e.isLastRow),l=!e.isLastRow;return r.createElement("div",{className:i.joinClassNames("fc-flex-row fc-grow",!e.isLastRow&&"fc-border-b")},e.cells.map((i,a)=>{const o=i.rowUnit+":"+i.date.toISOString();return r.createElement(v,{key:o,cell:i,rowLevel:e.rowLevel,dateProfile:e.dateProfile,tDateProfile:e.tDateProfile,todayRange:e.todayRange,nowDate:e.nowDate,isCentered:s,isSticky:l,borderStart:Boolean(a),innerWidthRef:t.createRef(o),innerHeightRef:n.createRef(o),slotWidth:e.slotWidth})}))}componentWillUnmount(){i.setRef(this.props.innerWidthRef,null),i.setRef(this.props.innerHeighRef,null)}}function y(e,t,n,i,r){if(null==i||null==r)return[void 0,void 0,!1];const s=r/e;let l,a;return s>=(n=Math.max(n||0,(i+1)/t,30))?(l=!0,a=s):(l=!1,a=Math.max(n,s)),[a*e,a,l]}function w(e,t,n,r,s){let l=t.add(n.activeRange.start,e);return r.isTimeScale||(l=i.startOfDay(l)),b(l,t,r,s)}function b(e,t,n,r){return function(e,t,n){let r=n.countDurationsBetween(t.normalizedRange.start,e,t.snapDuration);if(r<0)return 0;if(r>=t.snapDiffToIndex.length)return t.snapCnt;let s=Math.floor(r),l=t.snapDiffToIndex[s];i.isInt(l)?l+=r-s:l=Math.ceil(l);return l}(e,n,t)/n.snapsPerSlot*r}function E(e,t,n){let r=n.countDurationsBetween(t.normalizedRange.start,e,t.snapDuration);if(r<0)return 0;if(r>=t.snapDiffToIndex.length)return t.snapCnt;let s=Math.floor(r),l=t.snapDiffToIndex[s];return i.isInt(l)?l+=r-s:l=Math.ceil(l),l}function W(e,t){return e?t?{right:e.start,width:e.size}:{left:e.start,width:e.size}:{}}function x(e,t){return t?{right:e}:{left:e}}class M extends i.BaseComponent{render(){const{props:e,context:t}=this;return r.createElement("div",{className:"fc-timeline-now-indicator-container"},r.createElement(i.NowIndicatorContainer,{className:"fc-timeline-now-indicator-line",style:null!=e.slotWidth?x(b(e.nowDate,t.dateEnv,e.tDateProfile,e.slotWidth),t.isRtl):{},isAxis:!1,date:e.nowDate}))}}class T extends i.BaseComponent{render(){const{props:e,context:t}=this;return r.createElement("div",{className:"fc-timeline-now-indicator-container"},r.createElement(i.NowIndicatorContainer,{className:"fc-timeline-now-indicator-arrow",style:null!=e.slotWidth?x(b(e.nowDate,t.dateEnv,e.tDateProfile,e.slotWidth),t.isRtl):{},isAxis:!0,date:e.nowDate}))}}function I(e,t){return e.querySelectorAll(".fc-timeline-slot")[t]}class P extends i.Slicer{sliceRange(e,t,n,r,s){let l=function(e,t,n){if(!t.isTimeScale&&(e=i.computeVisibleDayRange(e),t.largeUnit)){let i=e;((e={start:n.startOf(e.start,t.largeUnit),end:n.startOf(e.end,t.largeUnit)}).end.valueOf()!==i.end.valueOf()||e.end<=e.start)&&(e={start:e.start,end:n.add(e.end,t.slotDuration)})}return e}(e,r,s),a=[];if(E(l.start,r,s)<E(l.end,r,s)){let e=i.intersectRanges(l,r.normalizedRange);e&&a.push({startDate:e.start,endDate:e.end,isStart:e.start.valueOf()===l.start.valueOf()&&f(e.start,r,t,n),isEnd:e.end.valueOf()===l.end.valueOf()&&f(i.addMs(e.end,-1),r,t,n)})}return a}}const k=i.createFormatter({hour:"numeric",minute:"2-digit",omitZeroMinute:!0,meridiem:"narrow"});class C extends i.BaseComponent{render(){let{props:e,context:t}=this,{options:n}=t;return r.createElement(i.StandardEvent,Object.assign({},e,{className:i.joinClassNames("fc-timeline-event",!1===n.eventOverlap&&"fc-timeline-event-spacious","fc-h-event"),defaultTimeFormat:k,defaultDisplayEventTime:!e.isTimeScale}))}}class N extends i.BaseComponent{render(){let{props:e}=this,{hiddenSegs:t,resourceId:n,forcedInvisibleMap:s}=e,l=n?{resourceId:n}:{};return r.createElement(i.MoreLinkContainer,{className:"fc-timeline-more-link",allDayDate:null,segs:t,hiddenSegs:t,dateProfile:e.dateProfile,todayRange:e.todayRange,dateSpanProps:l,popoverContent:()=>r.createElement(r.Fragment,null,t.map(t=>{let{eventRange:n}=t,l=n.instance.instanceId;return r.createElement("div",{key:l,style:{visibility:s[l]?"hidden":""}},r.createElement(C,Object.assign({isTimeScale:e.isTimeScale,eventRange:n,isStart:t.isStart,isEnd:t.isEnd,isDragging:!1,isResizing:!1,isDateSelecting:!1,isSelected:l===e.eventSelection},i.getEventRangeMeta(n,e.todayRange,e.nowDate))))}))},e=>r.createElement(e,{tag:"div",className:"fc-timeline-more-link-inner fc-sticky-s"}))}}function z(e,t,n,r,s){const l={};for(const a of e)l[i.getEventKey(a)]=H(a,t,n,r,s);return l}function H(e,t,n,i,r){const s=b(e.startDate,n,i,r);let l=b(e.endDate,n,i,r)-s;return t&&(l=Math.max(l,t)),{start:s,size:l}}class L extends r.Component{constructor(){super(...arguments),this.rootElRef=r.createRef()}render(){const{props:e}=this;return r.createElement("div",{className:"fc-abs",style:e.style,ref:this.rootElRef},e.children)}componentDidMount(){const e=this.rootElRef.current;this.disconnectHeight=i.watchHeight(e,e=>{i.setRef(this.props.heightRef,e)})}componentWillUnmount(){this.disconnectHeight(),i.setRef(this.props.heightRef,null)}}class O extends i.BaseComponent{constructor(){super(...arguments),this.sortEventSegs=i.memoize(i.sortEventSegs),this.segHeightRefMap=new i.RefMap(()=>{i.afterSize(this.handleSegHeights)}),this.moreLinkHeightRefMap=new i.RefMap(()=>{i.afterSize(this.handleMoreLinkHeights)}),this.handleMoreLinkHeights=()=>{this.setState({moreLinkHeightRev:this.moreLinkHeightRefMap.rev})},this.handleSegHeights=()=>{this.setState({segHeightRev:this.segHeightRefMap.rev})}}render(){let{props:e,context:t,segHeightRefMap:n,moreLinkHeightRefMap:s}=this,{options:l}=t,{tDateProfile:a}=e,o=(e.eventDrag?e.eventDrag.segs:null)||(e.eventResize?e.eventResize.segs:null)||[],c=this.sortEventSegs(e.fgEventSegs,l.eventOrder),d=null!=e.slotWidth?z(c,l.eventMinWidth,t.dateEnv,a,e.slotWidth):{},[f,h,m,u]=function(e,t,n,r,s,l){const a=[];for(const n of e){const e=t[i.getEventKey(n)];e&&a.push(Object.assign(Object.assign({},n),{start:e.start,end:e.start+e.size}))}const o=new i.SegHierarchy(a,e=>n.get(i.getEventKey(e)),s,void 0,l),c=new Map;o.traverseSegs((e,t)=>{c.set(i.getEventKey(e),t)});const{hiddenSegs:d}=o;let f=0;for(const e of a){const t=i.getEventKey(e),r=n.get(t),s=c.get(t);null!=r&&null!=s&&(f=Math.max(f,s+r))}const h=i.groupIntersectingSegs(d),m=new Map;o.strictOrder=!0;for(const e of h){const{levelCoord:t}=o.findInsertion(e,0),n=r.get(e.key)||0;m.set(e.key,t),f=Math.max(f,t+n)}return[c,h,m,f]}(c,d,n.current,s.current,l.eventOrderStrict,l.eventMaxStack);this.totalHeight=u;let g=(e.eventDrag?e.eventDrag.affectedInstances:null)||(e.eventResize?e.eventResize.affectedInstances:null)||{};return r.createElement("div",{className:"fc-timeline-events fc-rel",style:{height:u}},this.renderFgSegs(c,d,f,g,h,m,!1,!1,!1),this.renderFgSegs(o,e.slotWidth?z(o,l.eventMinWidth,t.dateEnv,a,e.slotWidth):{},f,{},[],new Map,Boolean(e.eventDrag),Boolean(e.eventResize),!1))}renderFgSegs(e,t,n,s,l,a,o,c,d){let{props:f,context:h,segHeightRefMap:m,moreLinkHeightRefMap:u}=this,g=o||c||d;return r.createElement(r.Fragment,null,e.map(e=>{const{eventRange:l}=e,{instanceId:a}=l.instance,u=n.get(a),p=t[a],v=g||p&&null!=u&&!s[a];return r.createElement(L,{key:a,style:Object.assign({visibility:v?"":"hidden",top:u||0},W(p,h.isRtl)),heightRef:g?void 0:m.createRef(a)},r.createElement(C,Object.assign({isTimeScale:f.tDateProfile.isTimeScale,eventRange:l,isStart:e.isStart,isEnd:e.isEnd,isDragging:o,isResizing:c,isDateSelecting:d,isSelected:a===f.eventSelection},i.getEventRangeMeta(l,f.todayRange,f.nowDate))))}),l.map(e=>r.createElement(L,{key:e.key,style:Object.assign({top:a.get(e.key)||0},W({start:e.start,size:e.end-e.start},h.isRtl)),heightRef:u.createRef(e.key)},r.createElement(N,{hiddenSegs:e.segs,dateProfile:f.dateProfile,nowDate:f.nowDate,todayRange:f.todayRange,isTimeScale:f.tDateProfile.isTimeScale,eventSelection:f.eventSelection,resourceId:f.resourceId,forcedInvisibleMap:s}))))}componentDidUpdate(){this.totalHeight!==this.firedTotalHeight&&(this.firedTotalHeight=this.totalHeight,i.setRef(this.props.heightRef,this.totalHeight))}componentWillUnmount(){i.setRef(this.props.heightRef,null)}}class B extends i.BaseComponent{render(){let{props:e}=this,t=[].concat(e.eventResizeSegs||[],e.dateSelectionSegs);return r.createElement(r.Fragment,null,this.renderSegs(e.businessHourSegs||[],"non-business"),this.renderSegs(e.bgEventSegs||[],"bg-event"),this.renderSegs(t,"highlight"))}renderSegs(e,t){let{tDateProfile:n,todayRange:s,nowDate:l,slotWidth:a}=this.props,{dateEnv:o,isRtl:c}=this.context;return r.createElement(r.Fragment,null,e.map(e=>{let d;if(null!=a){d=W(H(e,void 0,o,n,a),c)}return r.createElement("div",{key:i.buildEventRangeKey(e.eventRange),className:"fc-fill-y",style:d},"bg-event"===t?r.createElement(i.BgEvent,Object.assign({eventRange:e.eventRange,isStart:e.isStart,isEnd:e.isEnd},i.getEventRangeMeta(e.eventRange,s,l))):i.renderFill(t))}))}}class U extends i.DateComponent{constructor(){super(...arguments),this.buildTimelineDateProfile=i.memoize(c),this.computeSlotWidth=i.memoize(y),this.headerScrollerRef=r.createRef(),this.bodyScrollerRef=r.createRef(),this.footerScrollerRef=r.createRef(),this.headerRowInnerWidthMap=new i.RefMap(()=>{i.afterSize(this.handleSlotInnerWidths)}),this.scrollTime=null,this.slicer=new P,this.handleBodySlotInnerWidth=e=>{this.bodySlotInnerWidth=e,i.afterSize(this.handleSlotInnerWidths)},this.handleSlotInnerWidths=()=>{const e=this.headerRowInnerWidthMap.current.get(this.tDateProfile.cellRows.length-1),{bodySlotInnerWidth:t}=this;if(null!=e&&null!=t){const n=Math.max(e,t);n!==this.state.slotInnerWidth&&this.setState({slotInnerWidth:n})}},this.handleTotalWidth=e=>{this.setState({totalWidth:e})},this.handleClientWidth=e=>{this.setState({clientWidth:e})},this.handleTimeScrollRequest=e=>{this.scrollTime=e,this.applyTimeScroll()},this.handleTimeScrollEnd=e=>{e&&(this.scrollTime=null)},this.handeBodyEl=e=>{this.bodyEl=e,e?this.context.registerInteractiveComponent(this,{el:e}):this.context.unregisterInteractiveComponent(this)}}render(){const{props:e,state:t,context:n}=this,{options:s}=n,{totalWidth:l,clientWidth:a}=t,o=null!=l&&null!=a?l-a:void 0,c=this.tDateProfile=this.buildTimelineDateProfile(e.dateProfile,n.dateEnv,s,n.dateProfileGenerator),{cellRows:d}=c,f=i.greatestDurationDenominator(c.slotDuration).unit,h=!e.forPrint&&!i.getIsHeightAuto(s),m=!e.forPrint&&i.getStickyHeaderDates(s),u=!e.forPrint&&i.getStickyFooterScrollbar(s),[g,v]=this.computeSlotWidth(c.slotCnt,c.slotsPerLabel,s.slotMinWidth,t.slotInnerWidth,a);this.slotWidth=v;let S=this.slicer.sliceProps(e,e.dateProfile,c.isTimeScale?null:s.nextDayThreshold,n,e.dateProfile,n.dateProfileGenerator,c,n.dateEnv);return r.createElement(i.NowTimer,{unit:f},(t,l)=>{const a=s.nowIndicator&&null!=v&&i.rangeContainsMarker(e.dateProfile.currentRange,t);return r.createElement(i.ViewContainer,{viewSpec:n.viewSpec,className:i.joinClassNames("fc-timeline fc-border",!e.forPrint&&"fc-flex-col")},r.createElement(i.Scroller,{horizontal:!0,hideScrollbars:!0,className:i.joinClassNames("fc-timeline-header fc-flex-row fc-border-b",m&&"fc-table-header-sticky"),ref:this.headerScrollerRef},r.createElement("div",{className:i.joinClassNames("fc-rel",null==g&&"fc-liquid"),style:{width:g}},d.map((n,i)=>{const s=i===d.length-1;return r.createElement(D,{key:i,dateProfile:e.dateProfile,tDateProfile:c,nowDate:t,todayRange:l,rowLevel:i,isLastRow:s,cells:n,slotWidth:v,innerWidthRef:this.headerRowInnerWidthMap.createRef(i)})}),a&&r.createElement(T,{tDateProfile:c,nowDate:t,slotWidth:v})),Boolean(o)&&r.createElement("div",{className:"fc-border-s fc-filler",style:{minWidth:o}})),r.createElement(i.Scroller,{vertical:h,horizontal:!0,hideScrollbars:u||e.forPrint,className:i.joinClassNames("fc-timeline-body fc-flex-col",h&&"fc-liquid"),ref:this.bodyScrollerRef,clientWidthRef:this.handleClientWidth},r.createElement("div",{"aria-label":s.eventsHint,className:"fc-rel fc-grow",style:{width:g},ref:this.handeBodyEl},r.createElement(p,{dateProfile:e.dateProfile,tDateProfile:c,nowDate:t,todayRange:l,innerWidthRef:this.handleBodySlotInnerWidth,slotWidth:v}),r.createElement(B,{tDateProfile:c,nowDate:t,todayRange:l,bgEventSegs:S.bgEventSegs,businessHourSegs:S.businessHourSegs,dateSelectionSegs:S.dateSelectionSegs,eventResizeSegs:S.eventResize?S.eventResize.segs:null,slotWidth:v}),r.createElement(O,{dateProfile:e.dateProfile,tDateProfile:c,nowDate:t,todayRange:l,fgEventSegs:S.fgEventSegs,eventDrag:S.eventDrag,eventResize:S.eventResize,eventSelection:S.eventSelection,slotWidth:v}),r.createElement("div",{className:"fc-timeline-lane-footer"}),a&&r.createElement(M,{tDateProfile:c,nowDate:t,slotWidth:v}))),Boolean(u)&&r.createElement(i.FooterScrollbar,{isSticky:!0,canvasWidth:g,scrollerRef:this.footerScrollerRef}),r.createElement(i.Ruler,{widthRef:this.handleTotalWidth}))})}componentDidMount(){this.syncedScroller=new s.ScrollerSyncer(!0),this.updateSyncedScroller(),this.resetScroll(),this.context.emitter.on("_timeScrollRequest",this.handleTimeScrollRequest),this.syncedScroller.addScrollEndListener(this.handleTimeScrollEnd)}componentDidUpdate(e){this.updateSyncedScroller(),e.dateProfile!==this.props.dateProfile&&this.context.options.scrollTimeReset?this.resetScroll():this.applyTimeScroll()}componentWillUnmount(){this.syncedScroller.destroy(),this.context.emitter.off("_timeScrollRequest",this.handleTimeScrollRequest),this.syncedScroller.removeScrollEndListener(this.handleTimeScrollEnd)}updateSyncedScroller(){this.syncedScroller.handleChildren([this.headerScrollerRef.current,this.bodyScrollerRef.current,this.footerScrollerRef.current])}resetScroll(){this.handleTimeScrollRequest(this.context.options.scrollTime)}applyTimeScroll(){const{props:e,context:t,tDateProfile:n,scrollTime:i,slotWidth:r}=this;if(null!=i&&null!=r){let s=w(i,t.dateEnv,e.dateProfile,n,r);s&&(s+=1),this.syncedScroller.scrollTo({x:s})}}queryHit(e,t,n,r){const{props:s,context:l,tDateProfile:a,slotWidth:o}=this,{dateEnv:c}=l;if(o){const t=l.isRtl?n-e:e,d=Math.floor(t/o),f=(t-d*o)/o,h=Math.floor(f*a.snapsPerSlot);let m,u,g=c.add(a.slotDates[d],i.multiplyDuration(a.snapDuration,h)),p=c.add(g,a.snapDuration),v=o/a.snapsPerSlot,S=d*o+v*h,R=S+v;return l.isRtl?(m=n-R,u=n-S):(m=S,u=R),{dateProfile:s.dateProfile,dateSpan:{range:{start:g,end:p},allDay:!a.isTimeScale},rect:{left:m,right:u,top:0,bottom:r},getDayEl:()=>I(this.bodyEl,d),layer:0}}return null}}i.injectStyles('.fc-timeline-lane-footer{padding-bottom:10px}.fc-timeline-overlap-disabled .fc-timeline-lane-footer{padding-bottom:0}.fc-timeline-slot-minor{border-style:dotted}.fc-timeline-event{border-radius:0;font-size:var(--fc-small-font-size);margin-bottom:1px}.fc-direction-ltr .fc-timeline-event.fc-event-end{margin-right:1px}.fc-direction-rtl .fc-timeline-event.fc-event-end{margin-left:1px}.fc-timeline-event .fc-event-inner{align-items:center;display:flex;flex-direction:row;padding:2px 1px}.fc-timeline-event-spacious .fc-event-inner{padding-bottom:5px;padding-top:5px}.fc-timeline-event .fc-event-time{font-weight:700}.fc-timeline-event .fc-event-time,.fc-timeline-event .fc-event-title{padding:0 2px}.fc-timeline-event:not(.fc-event-end) .fc-event-inner:after,.fc-timeline-event:not(.fc-event-start) .fc-event-inner:before{border-color:transparent #000;border-style:solid;border-width:5px;content:"";flex-grow:0;flex-shrink:0;height:0;margin:0 1px;opacity:.5;width:0}.fc-direction-ltr .fc-timeline-event:not(.fc-event-start) .fc-event-inner:before,.fc-direction-rtl .fc-timeline-event:not(.fc-event-end) .fc-event-inner:after{border-left:0}.fc-direction-ltr .fc-timeline-event:not(.fc-event-end) .fc-event-inner:after,.fc-direction-rtl .fc-timeline-event:not(.fc-event-start) .fc-event-inner:before{border-right:0}.fc-timeline-more-link{align-items:flex-start;background:var(--fc-more-link-bg-color);color:var(--fc-more-link-text-color);cursor:pointer;display:flex;flex-direction:column;font-size:var(--fc-small-font-size);padding:1px}.fc-direction-ltr .fc-timeline-more-link{margin-right:1px}.fc-direction-rtl .fc-timeline-more-link{margin-left:1px}.fc-timeline-more-link-inner{padding:2px}.fc-timeline-now-indicator-container{bottom:0;left:0;overflow:hidden;pointer-events:none;position:absolute;right:0;top:0;z-index:2}.fc-timeline-now-indicator-arrow{border-bottom-style:solid;border-bottom-width:0;border-color:var(--fc-now-indicator-color);border-left:5px solid transparent;border-right:5px solid transparent;border-top-style:solid;border-top-width:6px;height:0;margin:0 -5px;position:absolute;top:0;width:0}.fc-timeline-now-indicator-line{border-left:1px solid var(--fc-now-indicator-color);bottom:0;position:absolute;top:0}');var j=t.createPlugin({name:"@fullcalendar/timeline",premiumReleaseDate:"2025-02-21",deps:[a.default],initialView:"timelineDay",views:{timeline:{component:U,usesMinMaxTime:!0,eventResizableFromStart:!0},timelineDay:{type:"timeline",duration:{days:1}},timelineWeek:{type:"timeline",duration:{weeks:1}},timelineMonth:{type:"timeline",duration:{months:1}},timelineYear:{type:"timeline",duration:{years:1}}}}),F={__proto__:null,TimelineView:U,TimelineFg:O,TimelineBg:B,TimelineSlats:p,buildTimelineDateProfile:c,createVerticalStyle:function(e){if(e)return{top:e.start,height:e.size}},createHorizontalStyle:function(e,t){if(e)return{[t?"right":"left"]:e.start,width:e.size}},computeSlotWidth:y,timeToCoord:w,TimelineLaneSlicer:P,TimelineHeaderRow:D,TimelineNowIndicatorArrow:T,TimelineNowIndicatorLine:M,getTimelineSlotEl:I};return t.globalPlugins.push(j),e.Internal=F,e.default=j,Object.defineProperty(e,"__esModule",{value:!0}),e}({},FullCalendar,FullCalendar.PremiumCommon,FullCalendar.Internal,FullCalendar.Preact,FullCalendar.ScrollGrid.Internal);
|
package/index.js
CHANGED