@zealicsolutions/web-ui 1.0.60-test.2 → 1.0.60-test.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.
Files changed (32) hide show
  1. package/dist/cjs/index.js +247 -247
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/molecules/Calendar/CalendarMolecule.d.ts +0 -6
  4. package/dist/cjs/molecules/Calendar/ResourceTimelineCalendar.d.ts +95 -2
  5. package/dist/cjs/molecules/Calendar/SimpleCalendar.d.ts +98 -2
  6. package/dist/cjs/molecules/Calendar/YearViewCalendar.d.ts +85 -2
  7. package/dist/cjs/molecules/Calendar/hooks/useCalendarCore.d.ts +14 -0
  8. package/dist/cjs/molecules/Calendar/hooks/useCalendarStyling.d.ts +229 -0
  9. package/dist/esm/molecules/Calendar/CalendarMolecule.d.ts +0 -6
  10. package/dist/esm/molecules/Calendar/ResourceTimelineCalendar.d.ts +95 -2
  11. package/dist/esm/molecules/Calendar/ResourceTimelineCalendar.js +1 -1
  12. package/dist/esm/molecules/Calendar/ResourceTimelineCalendar.js.map +1 -1
  13. package/dist/esm/molecules/Calendar/SimpleCalendar.d.ts +98 -2
  14. package/dist/esm/molecules/Calendar/SimpleCalendar.js +1 -1
  15. package/dist/esm/molecules/Calendar/SimpleCalendar.js.map +1 -1
  16. package/dist/esm/molecules/Calendar/YearViewCalendar.d.ts +85 -2
  17. package/dist/esm/molecules/Calendar/YearViewCalendar.js +1 -1
  18. package/dist/esm/molecules/Calendar/YearViewCalendar.js.map +1 -1
  19. package/dist/esm/molecules/Calendar/hooks/useCalendarCore.d.ts +14 -0
  20. package/dist/esm/molecules/Calendar/hooks/useCalendarCore.js +2 -0
  21. package/dist/esm/molecules/Calendar/hooks/useCalendarCore.js.map +1 -0
  22. package/dist/esm/molecules/Calendar/hooks/useCalendarStyling.d.ts +229 -0
  23. package/dist/esm/molecules/Calendar/hooks/useCalendarStyling.js +2 -0
  24. package/dist/esm/molecules/Calendar/hooks/useCalendarStyling.js.map +1 -0
  25. package/dist/esm/node_modules/@fullcalendar/premium-common/index.js +1 -1
  26. package/dist/esm/node_modules/@fullcalendar/premium-common/index.js.map +1 -1
  27. package/dist/esm/node_modules/@fullcalendar/timeline/internal.js +1 -1
  28. package/dist/esm/node_modules/@fullcalendar/timeline/internal.js.map +1 -1
  29. package/dist/index.d.ts +0 -6
  30. package/package.json +1 -1
  31. package/dist/esm/molecules/Calendar/CalendarMolecule.js +0 -2
  32. package/dist/esm/molecules/Calendar/CalendarMolecule.js.map +0 -1
@@ -1,2 +1,2 @@
1
- import{ScrollGrid as e}from"../scrollgrid/internal.js";import{ct as t,bG as n,x as i,E as s,bc as o,z as r,ca as l,c9 as a,cq as d,c,bl as h,d as f,br as u,bq as m,t as p,q as g,bp as v,bo as b,y as S,al as R,B as D,ch as y,a6 as w,aK as C,bP as x,cd as k,a as P,bu as M,cp as T,bQ as E,c8 as I,ak as W,bm as z,bC as L,cm as H,cl as N,bR as O,bU as U,o as A,be as G,cg as j,co as B,aw as q,A as F,aY as _,aZ as Z,aX as X,C as Y,a_ as K,b8 as Q,aL as J,G as V,by as $}from"../core/internal-common.js";import{createRef as ee,createElement as te,Fragment as ne}from"../../preact/dist/preact.mjs.js";t('.fc .fc-timeline-body{min-height:100%;position:relative;z-index:1}.fc .fc-timeline-slots{bottom:0;position:absolute;top:0;z-index:1}.fc .fc-timeline-slots>table{height:100%}.fc .fc-timeline-slot-minor{border-style:dotted}.fc .fc-timeline-slot-frame{align-items:center;display:flex;justify-content:center}.fc .fc-timeline-header-row-chrono .fc-timeline-slot-frame{justify-content:flex-start}.fc .fc-timeline-header-row:last-child .fc-timeline-slot-frame{overflow:hidden}.fc .fc-timeline-slot-cushion{padding:4px 5px;white-space:nowrap}.fc-direction-ltr .fc-timeline-slot{border-right:0!important}.fc-direction-rtl .fc-timeline-slot{border-left:0!important}.fc .fc-timeline-now-indicator-container{bottom:0;left:0;position:absolute;right:0;top:0;width:0;z-index:4}.fc .fc-timeline-now-indicator-arrow,.fc .fc-timeline-now-indicator-line{border-color:var(--fc-now-indicator-color);border-style:solid;pointer-events:none;position:absolute;top:0}.fc .fc-timeline-now-indicator-arrow{border-left-color:transparent;border-right-color:transparent;border-width:6px 5px 0;margin:0 -6px}.fc .fc-timeline-now-indicator-line{border-width:0 0 0 1px;bottom:0;margin:0 -1px}.fc .fc-timeline-events{position:relative;width:0;z-index:3}.fc .fc-timeline-event-harness,.fc .fc-timeline-more-link{position:absolute;top:0}.fc-timeline-event{z-index:1}.fc-timeline-event.fc-event-mirror{z-index:2}.fc-timeline-event{align-items:center;border-radius:0;display:flex;font-size:var(--fc-small-font-size);margin-bottom:1px;padding:2px 1px;position:relative}.fc-timeline-event .fc-event-main{flex-grow:1;flex-shrink:1;min-width:0}.fc-timeline-event .fc-event-time{font-weight:700}.fc-timeline-event .fc-event-time,.fc-timeline-event .fc-event-title{padding:0 2px;white-space:nowrap}.fc-direction-ltr .fc-timeline-event.fc-event-end,.fc-direction-ltr .fc-timeline-more-link{margin-right:1px}.fc-direction-rtl .fc-timeline-event.fc-event-end,.fc-direction-rtl .fc-timeline-more-link{margin-left:1px}.fc-timeline-overlap-disabled .fc-timeline-event{margin-bottom:0;padding-bottom:5px;padding-top:5px}.fc-timeline-event:not(.fc-event-end):after,.fc-timeline-event:not(.fc-event-start):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):before,.fc-direction-rtl .fc-timeline-event:not(.fc-event-end):after{border-left:0}.fc-direction-ltr .fc-timeline-event:not(.fc-event-end):after,.fc-direction-rtl .fc-timeline-event:not(.fc-event-start):before{border-right:0}.fc-timeline-more-link{background:var(--fc-more-link-bg-color);color:var(--fc-more-link-text-color);cursor:pointer;font-size:var(--fc-small-font-size);padding:1px}.fc-timeline-more-link-inner{display:inline-block;left:0;padding:2px;right:0}.fc .fc-timeline-bg{bottom:0;left:0;position:absolute;right:0;top:0;width:0;z-index:2}.fc .fc-timeline-bg .fc-non-business{z-index:1}.fc .fc-timeline-bg .fc-bg-event{z-index:2}.fc .fc-timeline-bg .fc-highlight{z-index:3}.fc .fc-timeline-bg-harness{bottom:0;position:absolute;top:0}');n.MAX_TIMELINE_SLOTS=1e3;const ie=[{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 se(e,t,s,o){let r={labelInterval:s.slotLabelInterval,slotDuration:s.slotDuration};!function(e,t,i){const{currentRange:s}=t;if(e.labelInterval){i.countDurationsBetween(s.start,s.end,e.labelInterval)>n.MAX_TIMELINE_SLOTS&&(console.warn("slotLabelInterval results in too many cells"),e.labelInterval=null)}if(e.slotDuration){i.countDurationsBetween(s.start,s.end,e.slotDuration)>n.MAX_TIMELINE_SLOTS&&(console.warn("slotDuration results in too many cells"),e.slotDuration=null)}if(e.labelInterval&&e.slotDuration){const t=u(e.labelInterval,e.slotDuration);(null===t||t<1)&&(console.warn("slotLabelInterval must be a multiple of slotDuration"),e.slotDuration=null)}}(r,e,t),le(r,e,t),function(e,t,n){const{currentRange:i}=t;let{slotDuration:s}=e;if(!s){const o=le(e,t,n);for(let e of ie){const t=f(e),n=u(o,t);if(null!==n&&n>1&&n<=6){s=t;break}}if(s){n.countDurationsBetween(i.start,i.end,s)>200&&(s=null)}s||(s=o),e.slotDuration=s}}(r,e,t);let l=s.slotLabelFormat,a=Array.isArray(l)?l:null!=l?[l]:function(e,t,n,i){let s,o;const{labelInterval:r}=e;let l=c(r).unit;const a=i.weekNumbers;let d=s=o=null;"week"!==l||a||(l="day");switch(l){case"year":d={year:"numeric"};break;case"month":ae("years",t,n)>1&&(d={year:"numeric"}),s={month:"short"};break;case"week":ae("years",t,n)>1&&(d={year:"numeric"}),s={week:"narrow"};break;case"day":ae("years",t,n)>1?d={year:"numeric",month:"long"}:ae("months",t,n)>1&&(d={month:"long"}),a&&(s={week:"short"}),o={weekday:"narrow",day:"numeric"};break;case"hour":a&&(d={week:"short"}),ae("days",t,n)>1&&(s={weekday:"short",day:"numeric",month:"numeric",omitCommas:!0}),o={hour:"numeric",minute:"2-digit",omitZeroMinute:!0,meridiem:"short"};break;case"minute":b(r)/60>=6?(d={hour:"numeric",meridiem:"short"},s=e=>":"+W(e.date.minute,2)):d={hour:"numeric",minute:"numeric",meridiem:"short"};break;case"second":v(r)/60>=6?(d={hour:"numeric",minute:"2-digit",meridiem:"lowercase"},s=e=>":"+W(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=>"."+W(e.millisecond,3)}return[].concat(d||[],s||[],o||[])}(r,e,t,s);r.headerFormats=a.map((e=>i(e))),r.isTimeScale=Boolean(r.slotDuration.milliseconds);let d=null;if(!r.isTimeScale){const e=c(r.slotDuration).unit;/year|month|week/.test(e)&&(d=e)}r.largeUnit=d,r.emphasizeWeeks=1===h(r.slotDuration)&&ae("weeks",e,t)>=2&&!s.businessHours;let g,S,D=s.snapDuration;D&&(g=f(D),S=u(r.slotDuration,g)),null==S&&(g=r.slotDuration,S=1),r.snapDuration=g,r.snapsPerSlot=S;let y=m(e.slotMaxTime)-m(e.slotMinTime),w=oe(e.renderRange.start,r,t),C=oe(e.renderRange.end,r,t);r.isTimeScale&&(w=t.add(w,e.slotMinTime),C=t.add(p(C,-1),e.slotMaxTime)),r.timeWindowMs=y,r.normalizedRange={start:w,end:C};let x=[],k=w;for(;k<C;)re(k,r,e,o)&&x.push(k),k=t.add(k,r.slotDuration);r.slotDates=x;let P=-1,M=0;const T=[],E=[];for(k=w;k<C;)re(k,r,e,o)?(P+=1,T.push(P),E.push(M)):T.push(P+.5),k=t.add(k,r.snapDuration),M+=1;return r.snapDiffToIndex=T,r.snapIndexToDiff=E,r.snapCnt=P+1,r.slotCnt=r.snapCnt/r.snapsPerSlot,r.isWeekStarts=function(e,t){let{slotDates:n,emphasizeWeeks:i}=e,s=null,o=[];for(let e of n){let n=t.computeWeekNumber(e),r=i&&null!==s&&s!==n;s=n,o.push(r)}return o}(r,t),r.cellRows=function(e,t){let n=e.slotDates,i=e.headerFormats,s=i.map((()=>[])),o=h(e.slotDuration),r=7===o?"week":1===o?"day":null,l=i.map((e=>e.getSmallestUnit?e.getSmallestUnit():null));for(let o=0;o<n.length;o+=1){let a=n[o],d=e.isWeekStarts[o];for(let n=0;n<i.length;n+=1){let o=i[n],c=s[n],h=c[c.length-1],f=n===i.length-1,u=i.length>1&&!f,m=null,p=l[n]||(f?r:null);if(u){let e=t.format(a,o);h&&h.text===e?h.colspan+=1:m=de(a,e,p)}else if(!h||R(t.countDurationsBetween(e.normalizedRange.start,a,e.labelInterval))){m=de(a,t.format(a,o),p)}else h.colspan+=1;m&&(m.weekStart=d,c.push(m))}}return s}(r,t),r.slotsPerLabel=u(r.labelInterval,r.slotDuration),r}function oe(e,t,n){let i=e;return t.isTimeScale||(i=g(i),t.largeUnit&&(i=n.startOf(i,t.largeUnit))),i}function re(e,t,n,i){if(i.isHiddenDay(e))return!1;if(t.isTimeScale){let i=g(e),s=e.valueOf()-i.valueOf()-m(n.slotMinTime);return s=(s%864e5+864e5)%864e5,s<t.timeWindowMs}return!0}function le(e,t,n){const{currentRange:i}=t;let{labelInterval:s}=e;if(!s){let t;if(e.slotDuration){for(t of ie){const n=f(t),i=u(n,e.slotDuration);if(null!==i&&i<=6){s=n;break}}s||(s=e.slotDuration)}else for(t of ie){s=f(t);if(n.countDurationsBetween(i.start,i.end,s)>=18)break}e.labelInterval=s}return s}function ae(e,t,n){let i=t.currentRange,s=null;return"years"===e?s=n.diffWholeYears(i.start,i.end):"months"===e||"weeks"===e?s=n.diffWholeMonths(i.start,i.end):"days"===e&&(s=S(i.start,i.end)),s||0}function de(e,t,n){return{date:e,text:t,rowUnit:n,colspan:1,isWeekStart:!1}}class ce extends D{constructor(){super(...arguments),this.refineRenderProps=F(ue),this.buildCellNavLinkAttrs=r(he)}render(){let{props:e,context:t}=this,{dateEnv:n,options:i}=t,{cell:s,dateProfile:o,tDateProfile:r}=e,l=_(s.date,e.todayRange,e.nowDate,o),a=this.refineRenderProps({level:e.rowLevel,dateMarker:s.date,text:s.text,dateEnv:t.dateEnv,viewApi:t.viewApi});return te(Y,{elTag:"th",elClasses:["fc-timeline-slot","fc-timeline-slot-label",s.isWeekStart&&"fc-timeline-slot-em",..."time"===s.rowUnit?Z(l,t.theme):X(l,t.theme)],elAttrs:{colSpan:s.colspan,"data-date":n.formatIso(s.date,{omitTime:!r.isTimeScale,omitTimeZoneOffset:!0})},renderProps:a,generatorName:"slotLabelContent",customGenerator:i.slotLabelContent,defaultGenerator:fe,classNameGenerator:i.slotLabelClassNames,didMount:i.slotLabelDidMount,willUnmount:i.slotLabelWillUnmount},(n=>te("div",{className:"fc-timeline-slot-frame",style:{height:e.rowInnerHeight}},te(n,{elTag:"a",elClasses:["fc-timeline-slot-cushion","fc-scrollgrid-sync-inner",e.isSticky&&"fc-sticky"],elAttrs:this.buildCellNavLinkAttrs(t,s.date,s.rowUnit)}))))}}function he(e,t,n){return n&&"time"!==n?K(e,t,n):{}}function fe(e){return e.text}function ue(e){return{level:e.level,date:e.dateEnv.toDate(e.dateMarker),view:e.viewApi,text:e.text}}class me extends D{render(){let{dateProfile:e,tDateProfile:t,rowInnerHeights:n,todayRange:i,nowDate:s}=this.props,{cellRows:o}=t;return te(ne,null,o.map(((r,l)=>{let a=l===o.length-1,d=t.isTimeScale&&a;return te("tr",{key:l,className:["fc-timeline-header-row",d?"fc-timeline-header-row-chrono":""].join(" ")},r.map((o=>te(ce,{key:o.date.toISOString(),cell:o,rowLevel:l,dateProfile:e,tDateProfile:t,todayRange:i,nowDate:s,rowInnerHeight:n&&n[l],isSticky:!a}))))})))}}class pe{constructor(e,t,n,i,s,o){this.slatRootEl=e,this.dateProfile=n,this.tDateProfile=i,this.dateEnv=s,this.isRtl=o,this.outerCoordCache=new Q(e,t,!0,!1),this.innerCoordCache=new Q(e,J(t,"div"),!0,!1)}isDateInRange(e){return V(this.dateProfile.currentRange,e)}dateToCoord(e){let{tDateProfile:t}=this,n=this.computeDateSnapCoverage(e)/t.snapsPerSlot,i=Math.floor(n);i=Math.min(i,t.slotCnt-1);let s=n-i,{innerCoordCache:o,outerCoordCache:r}=this;return this.isRtl?r.originClientRect.width-(r.rights[i]-o.getWidth(i)*s):r.lefts[i]+o.getWidth(i)*s}rangeToCoords(e){return{start:this.dateToCoord(e.start),end:this.dateToCoord(e.end)}}durationToCoord(e){let{dateProfile:t,tDateProfile:n,dateEnv:i,isRtl:s}=this,o=0;if(t){let r=i.add(t.activeRange.start,e);n.isTimeScale||(r=g(r)),o=this.dateToCoord(r),!s&&o&&(o+=1)}return o}coordFromLeft(e){return this.isRtl?this.outerCoordCache.originClientRect.width-e:e}computeDateSnapCoverage(e){return ge(e,this.tDateProfile,this.dateEnv)}}function ge(e,t,n){let i=n.countDurationsBetween(t.normalizedRange.start,e,t.snapDuration);if(i<0)return 0;if(i>=t.snapDiffToIndex.length)return t.snapCnt;let s=Math.floor(i),o=t.snapDiffToIndex[s];return R(o)?o+=i-s:o=Math.ceil(o),o}function ve(e,t){return null===e?{left:"",right:""}:t?{right:e,left:""}:{left:e,right:""}}function be(e,t){return e?t?{right:e.start,left:-e.end}:{left:e.start,right:-e.end}:{left:"",right:""}}class Se extends D{constructor(){super(...arguments),this.rootElRef=ee()}render(){let{props:e,context:t}=this,n=c(e.tDateProfile.slotDuration).unit,i=e.slatCoords&&e.slatCoords.dateProfile===e.dateProfile?e.slatCoords:null;return te(w,{unit:n},((n,s)=>te("div",{className:"fc-timeline-header",ref:this.rootElRef},te("table",{"aria-hidden":!0,className:"fc-scrollgrid-sync-table",style:{minWidth:e.tableMinWidth,width:e.clientWidth}},e.tableColGroupNode,te("tbody",null,te(me,{dateProfile:e.dateProfile,tDateProfile:e.tDateProfile,nowDate:n,todayRange:s,rowInnerHeights:e.rowInnerHeights}))),t.options.nowIndicator&&te("div",{className:"fc-timeline-now-indicator-container"},i&&i.isDateInRange(n)&&te(y,{elClasses:["fc-timeline-now-indicator-arrow"],elStyle:ve(i.dateToCoord(n),t.isRtl),isAxis:!0,date:n})))))}componentDidMount(){this.updateSize()}componentDidUpdate(){this.updateSize()}updateSize(){this.props.onMaxCushionWidth&&this.props.onMaxCushionWidth(this.computeMaxCushionWidth())}computeMaxCushionWidth(){return Math.max(...C(this.rootElRef.current,".fc-timeline-header-row:last-child .fc-timeline-slot-cushion").map((e=>e.getBoundingClientRect().width)))}}class Re extends D{render(){let{props:e,context:t}=this,{dateEnv:n,options:i,theme:s}=t,{date:o,tDateProfile:r,isEm:l}=e,a=_(e.date,e.todayRange,e.nowDate,e.dateProfile),d=Object.assign(Object.assign({date:n.toDate(e.date)},a),{view:t.viewApi});return te(Y,{elTag:"td",elRef:e.elRef,elClasses:["fc-timeline-slot","fc-timeline-slot-lane",l&&"fc-timeline-slot-em",r.isTimeScale?R(n.countDurationsBetween(r.normalizedRange.start,e.date,r.labelInterval))?"fc-timeline-slot-major":"fc-timeline-slot-minor":"",...e.isDay?X(a,s):Z(a,s)],elAttrs:{"data-date":n.formatIso(o,{omitTimeZoneOffset:!0,omitTime:!r.isTimeScale})},renderProps:d,generatorName:"slotLaneContent",customGenerator:i.slotLaneContent,classNameGenerator:i.slotLaneClassNames,didMount:i.slotLaneDidMount,willUnmount:i.slotLaneWillUnmount},(e=>te(e,{elTag:"div"})))}}class De extends D{render(){let{props:e}=this,{tDateProfile:t,cellElRefs:n}=e,{slotDates:i,isWeekStarts:s}=t,o=!t.isTimeScale&&!t.largeUnit;return te("tbody",null,te("tr",null,i.map(((i,r)=>{let l=i.toISOString();return te(Re,{key:l,elRef:n.createRef(l),date:i,dateProfile:e.dateProfile,tDateProfile:t,nowDate:e.nowDate,todayRange:e.todayRange,isEm:s[r],isDay:o})}))))}}class ye extends D{constructor(){super(...arguments),this.rootElRef=ee(),this.cellElRefs=new k,this.handleScrollRequest=e=>{let{onScrollLeftRequest:t}=this.props,{coords:n}=this;if(t&&n){if(e.time){t(n.coordFromLeft(n.durationToCoord(e.time)))}return!0}return null}}render(){let{props:e,context:t}=this;return te("div",{className:"fc-timeline-slots",ref:this.rootElRef},te("table",{"aria-hidden":!0,className:t.theme.getClass("table"),style:{minWidth:e.tableMinWidth,width:e.clientWidth}},e.tableColGroupNode,te(De,{cellElRefs:this.cellElRefs,dateProfile:e.dateProfile,tDateProfile:e.tDateProfile,nowDate:e.nowDate,todayRange:e.todayRange})))}componentDidMount(){this.updateSizing(),this.scrollResponder=this.context.createScrollResponder(this.handleScrollRequest)}componentDidUpdate(e){this.updateSizing(),this.scrollResponder.update(e.dateProfile!==this.props.dateProfile)}componentWillUnmount(){this.scrollResponder.detach(),this.props.onCoords&&this.props.onCoords(null)}updateSizing(){let{props:e,context:t}=this;if(null!==e.clientWidth&&this.scrollResponder){this.rootElRef.current.offsetWidth&&(this.coords=new pe(this.rootElRef.current,(n=this.cellElRefs.currentMap,e.tDateProfile.slotDates.map((e=>{let t=e.toISOString();return n[t]}))),e.dateProfile,e.tDateProfile,t.dateEnv,t.isRtl),e.onCoords&&e.onCoords(this.coords),this.scrollResponder.update(!1))}var n}positionToHit(e){let{outerCoordCache:t}=this.coords,{dateEnv:n,isRtl:i}=this.context,{tDateProfile:s}=this.props,o=t.leftToIndex(e);if(null!=o){let r=t.getWidth(o),l=i?(t.rights[o]-e)/r:(e-t.lefts[o])/r,a=Math.floor(l*s.snapsPerSlot),d=n.add(s.slotDates[o],z(s.snapDuration,a));return{dateSpan:{range:{start:d,end:n.add(d,s.snapDuration)},allDay:!this.props.tDateProfile.isTimeScale},dayEl:this.cellElRefs.currentMap[o],left:t.lefts[o],right:t.rights[o]}}return null}}function we(e,t,n){let i=[];if(n)for(let s of e){let e=n.rangeToCoords(s),o=Math.round(e.start),r=Math.round(e.end);r-o<t&&(r=o+t),i.push({start:o,end:r})}return i}class Ce extends D{render(){let{props:e}=this,t=[].concat(e.eventResizeSegs,e.dateSelectionSegs);return e.timelineCoords&&te("div",{className:"fc-timeline-bg"},this.renderSegs(e.businessHourSegs||[],e.timelineCoords,"non-business"),this.renderSegs(e.bgEventSegs||[],e.timelineCoords,"bg-event"),this.renderSegs(t,e.timelineCoords,"highlight"))}renderSegs(e,t,n){let{todayRange:i,nowDate:s}=this.props,{isRtl:o}=this.context,r=we(e,0,t),l=e.map(((e,t)=>{let l=be(r[t],o);return te("div",{key:O(e.eventRange),className:"fc-timeline-bg-harness",style:l},"bg-event"===n?te(H,Object.assign({seg:e},E(e,i,s))):N(n))}));return te(ne,null,l)}}class xe extends U{sliceRange(e,t,n,i,s){let o=function(e,t,n){if(!t.isTimeScale&&(e=q(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,i,s),r=[];if(ge(o.start,i,s)<ge(o.end,i,s)){let e=A(o,i.normalizedRange);e&&r.push({start:e.start,end:e.end,isStart:e.start.valueOf()===o.start.valueOf()&&re(e.start,i,t,n),isEnd:e.end.valueOf()===o.end.valueOf()&&re(G(e.end,-1),i,t,n)})}return r}}const ke=i({hour:"numeric",minute:"2-digit",omitZeroMinute:!0,meridiem:"narrow"});class Pe extends D{render(){let{props:e}=this;return te(j,Object.assign({},e,{elClasses:["fc-timeline-event","fc-h-event"],defaultTimeFormat:ke,defaultDisplayEventTime:!e.isTimeScale}))}}class Me extends D{render(){let{props:e,context:t}=this,{hiddenSegs:n,placement:i,resourceId:s}=e,{top:o,hcoords:r}=i,l=r&&null!==o,a=be(r,t.isRtl),d=s?{resourceId:s}:{};return te(B,{elRef:e.elRef,elClasses:["fc-timeline-more-link"],elStyle:Object.assign({visibility:l?"":"hidden",top:o||0},a),allDayDate:null,moreCnt:n.length,allSegs:n,hiddenSegs:n,dateProfile:e.dateProfile,todayRange:e.todayRange,extraDateSpan:d,popoverContent:()=>te(ne,null,n.map((t=>{let n=t.eventRange.instance.instanceId;return te("div",{key:n,style:{visibility:e.isForcedInvisible[n]?"hidden":""}},te(Pe,Object.assign({isTimeScale:e.isTimeScale,seg:t,isDragging:!1,isResizing:!1,isDateSelecting:!1,isSelected:n===e.eventSelection},E(t,e.todayRange,e.nowDate))))})))},(e=>te(e,{elTag:"div",elClasses:["fc-timeline-more-link-inner","fc-sticky"]})))}}class Te extends D{constructor(){super(...arguments),this.slicer=new xe,this.sortEventSegs=r(x),this.harnessElRefs=new k,this.moreElRefs=new k,this.innerElRef=ee(),this.state={eventInstanceHeights:{},moreLinkHeights:{}},this.handleResize=e=>{e&&this.updateSize()}}render(){let{props:e,state:t,context:n}=this,{options:i}=n,{dateProfile:s,tDateProfile:o}=e,r=this.slicer.sliceProps(e,s,o.isTimeScale?null:e.nextDayThreshold,n,s,n.dateProfileGenerator,o,n.dateEnv),l=(r.eventDrag?r.eventDrag.segs:null)||(r.eventResize?r.eventResize.segs:null)||[],a=this.sortEventSegs(r.fgEventSegs,i.eventOrder),d=we(a,i.eventMinWidth,e.timelineCoords),[c,h]=function(e,t,n,i,s,o){let r=[],l=[];for(let i=0;i<e.length;i+=1){let s=e[i],o=n[s.eventRange.instance.instanceId],a=t[i];o&&a?r.push({index:i,span:a,thickness:o}):l.push({seg:s,hcoords:a,top:null})}let a=new $;null!=s&&(a.strictOrder=s),null!=o&&(a.maxStackCnt=o);let d=a.addSegs(r),c=d.map((t=>({seg:e[t.index],hcoords:t.span,top:null}))),h=L(d),f=[],u=[];const m=t=>e[t.index];for(let t=0;t<h.length;t+=1){let n=h[t],s=n.entries.map(m),o=i[M(T(s))];null!=o?f.push({index:e.length+t,thickness:o,span:n.span}):u.push({seg:s,hcoords:n.span,top:null})}a.maxStackCnt=-1,a.addSegs(f);let p=a.toRects(),g=[],v=0;for(let t of p){let n=t.index;g.push({seg:n<e.length?e[n]:h[n-e.length].entries.map(m),hcoords:t.span,top:t.levelCoord}),v=Math.max(v,t.levelCoord+t.thickness)}return[g.concat(l,c,u),v]}(a,d,t.eventInstanceHeights,t.moreLinkHeights,i.eventOrderStrict,i.eventMaxStack),f=(r.eventDrag?r.eventDrag.affectedInstances:null)||(r.eventResize?r.eventResize.affectedInstances:null)||{};return te(ne,null,te(Ce,{businessHourSegs:r.businessHourSegs,bgEventSegs:r.bgEventSegs,timelineCoords:e.timelineCoords,eventResizeSegs:r.eventResize?r.eventResize.segs:[],dateSelectionSegs:r.dateSelectionSegs,nowDate:e.nowDate,todayRange:e.todayRange}),te("div",{className:"fc-timeline-events fc-scrollgrid-sync-inner",ref:this.innerElRef,style:{height:h}},this.renderFgSegs(c,f,!1,!1,!1),this.renderFgSegs(function(e,t,n){if(!e.length||!t)return[];let i=function(e){let t={};for(let n of e){let{seg:e}=n;Array.isArray(e)||(t[e.eventRange.instance.instanceId]=n.top)}return t}(n);return e.map((e=>({seg:e,hcoords:t.rangeToCoords(e),top:i[e.eventRange.instance.instanceId]})))}(l,e.timelineCoords,c),{},Boolean(r.eventDrag),Boolean(r.eventResize),!1)))}componentDidMount(){this.updateSize(),this.context.addResizeHandler(this.handleResize)}componentDidUpdate(e,t){e.eventStore===this.props.eventStore&&e.timelineCoords===this.props.timelineCoords&&t.moreLinkHeights===this.state.moreLinkHeights||this.updateSize()}componentWillUnmount(){this.context.removeResizeHandler(this.handleResize)}updateSize(){let{props:e}=this,{timelineCoords:t}=e;const n=this.innerElRef.current;e.onHeightChange&&e.onHeightChange(n,!1),t&&this.setState({eventInstanceHeights:P(this.harnessElRefs.currentMap,(e=>Math.round(e.getBoundingClientRect().height))),moreLinkHeights:P(this.moreElRefs.currentMap,(e=>Math.round(e.getBoundingClientRect().height)))},(()=>{e.onHeightChange&&e.onHeightChange(n,!0)})),e.syncParentMinHeight&&(n.parentElement.style.minHeight=n.style.height)}renderFgSegs(e,t,n,i,s){let{harnessElRefs:o,moreElRefs:r,props:l,context:a}=this,d=n||i||s;return te(ne,null,e.map((e=>{let{seg:c,hcoords:h,top:f}=e;if(Array.isArray(c)){let n=M(T(c));return te(Me,{key:"m:"+n,elRef:r.createRef(n),hiddenSegs:c,placement:e,dateProfile:l.dateProfile,nowDate:l.nowDate,todayRange:l.todayRange,isTimeScale:l.tDateProfile.isTimeScale,eventSelection:l.eventSelection,resourceId:l.resourceId,isForcedInvisible:t})}let u=c.eventRange.instance.instanceId,m=d||Boolean(!t[u]&&h&&null!==f),p=be(h,a.isRtl);return te("div",{key:"e:"+u,ref:d?null:o.createRef(u),className:"fc-timeline-event-harness",style:Object.assign({visibility:m?"":"hidden",top:f||0},p)},te(Pe,Object.assign({isTimeScale:l.tDateProfile.isTimeScale,seg:c,isDragging:n,isResizing:i,isDateSelecting:s,isSelected:u===l.eventSelection},E(c,l.todayRange,l.nowDate))))})))}}Te.addStateEquality({eventInstanceHeights:s,moreLinkHeights:s});class Ee extends o{constructor(){super(...arguments),this.slatsRef=ee(),this.state={coords:null},this.handeEl=e=>{e?this.context.registerInteractiveComponent(this,{el:e}):this.context.unregisterInteractiveComponent(this)},this.handleCoords=e=>{this.setState({coords:e}),this.props.onSlatCoords&&this.props.onSlatCoords(e)}}render(){let{props:e,state:t,context:n}=this,{options:i}=n,{dateProfile:s,tDateProfile:o}=e,r=c(o.slotDuration).unit;return te("div",{className:"fc-timeline-body",ref:this.handeEl,style:{minWidth:e.tableMinWidth,height:e.clientHeight,width:e.clientWidth}},te(w,{unit:r},((r,l)=>te(ne,null,te(ye,{ref:this.slatsRef,dateProfile:s,tDateProfile:o,nowDate:r,todayRange:l,clientWidth:e.clientWidth,tableColGroupNode:e.tableColGroupNode,tableMinWidth:e.tableMinWidth,onCoords:this.handleCoords,onScrollLeftRequest:e.onScrollLeftRequest}),te(Te,{dateProfile:s,tDateProfile:e.tDateProfile,nowDate:r,todayRange:l,nextDayThreshold:i.nextDayThreshold,businessHours:e.businessHours,eventStore:e.eventStore,eventUiBases:e.eventUiBases,dateSelection:e.dateSelection,eventSelection:e.eventSelection,eventDrag:e.eventDrag,eventResize:e.eventResize,timelineCoords:t.coords,syncParentMinHeight:!0}),i.nowIndicator&&t.coords&&t.coords.isDateInRange(r)&&te("div",{className:"fc-timeline-now-indicator-container"},te(y,{elClasses:["fc-timeline-now-indicator-line"],elStyle:ve(t.coords.dateToCoord(r),n.isRtl),isAxis:!1,date:r}))))))}queryHit(e,t,n,i){let s=this.slatsRef.current.positionToHit(e);return s?{dateProfile:this.props.dateProfile,dateSpan:s.dateSpan,rect:{left:s.left,right:s.right,top:0,bottom:i},dayEl:s.dayEl,layer:0}:null}}class Ie extends o{constructor(){super(...arguments),this.buildTimelineDateProfile=r(se),this.scrollGridRef=ee(),this.state={slatCoords:null,slotCushionMaxWidth:null},this.handleSlatCoords=e=>{this.setState({slatCoords:e})},this.handleScrollLeftRequest=e=>{this.scrollGridRef.current.forceScrollLeft(0,e)},this.handleMaxCushionWidth=e=>{this.setState({slotCushionMaxWidth:Math.ceil(e)})}}render(){let{props:t,state:n,context:i}=this,{options:s}=i,o=!t.forPrint&&l(s),r=!t.forPrint&&a(s),c=this.buildTimelineDateProfile(t.dateProfile,i.dateEnv,s,i.dateProfileGenerator),{slotMinWidth:h}=s,f=We(c,h||this.computeFallbackSlotMinWidth(c)),u=[{type:"header",key:"header",isSticky:o,chunks:[{key:"timeline",content:e=>te(Se,{dateProfile:t.dateProfile,clientWidth:e.clientWidth,clientHeight:e.clientHeight,tableMinWidth:e.tableMinWidth,tableColGroupNode:e.tableColGroupNode,tDateProfile:c,slatCoords:n.slatCoords,onMaxCushionWidth:h?null:this.handleMaxCushionWidth})}]},{type:"body",key:"body",liquid:!0,chunks:[{key:"timeline",content:e=>te(Ee,Object.assign({},t,{clientWidth:e.clientWidth,clientHeight:e.clientHeight,tableMinWidth:e.tableMinWidth,tableColGroupNode:e.tableColGroupNode,tDateProfile:c,onSlatCoords:this.handleSlatCoords,onScrollLeftRequest:this.handleScrollLeftRequest}))}]}];return r&&u.push({type:"footer",key:"footer",isSticky:!0,chunks:[{key:"timeline",content:I}]}),te(d,{elClasses:["fc-timeline",!1===s.eventOverlap?"fc-timeline-overlap-disabled":""],viewSpec:i.viewSpec},te(e,{ref:this.scrollGridRef,liquid:!t.isHeightAuto&&!t.forPrint,forPrint:t.forPrint,collapsibleWidth:!1,colGroups:[{cols:f}],sections:u}))}computeFallbackSlotMinWidth(e){return Math.max(30,(this.state.slotCushionMaxWidth||0)/e.slotsPerLabel)}}function We(e,t){return[{span:e.slotCnt,minWidth:t||1}]}export{pe as TimelineCoords,Se as TimelineHeader,me as TimelineHeaderRows,Te as TimelineLane,Ce as TimelineLaneBg,xe as TimelineLaneSlicer,ye as TimelineSlats,Ie as TimelineView,We as buildSlatCols,se as buildTimelineDateProfile,ve as coordToCss,be as coordsToCss};
1
+ import{ScrollGrid as e}from"../scrollgrid/internal.js";import{ct as t,bG as n,x as i,c as s,bl as o,d as r,br as l,bq as a,t as d,q as c,bp as h,bo as f,y as u,al as m,B as p,ch as g,a6 as v,aK as b,E as S,bc as R,z as D,ca as y,c9 as w,cq as C,ak as x,cd as k,bm as P,cm as M,bQ as T,cl as E,bR as I,bU as W,o as z,be as L,bP as H,a as N,bu as O,cp as U,c8 as A,aw as G,A as j,aY as B,aZ as q,aX as F,C as _,a_ as Z,b8 as X,aL as Y,G as K,by as Q,bC as J,cg as V,co as $}from"../core/internal-common.js";import{createRef as ee,createElement as te,Fragment as ne}from"../../preact/dist/preact.mjs.js";t('.fc .fc-timeline-body{min-height:100%;position:relative;z-index:1}.fc .fc-timeline-slots{bottom:0;position:absolute;top:0;z-index:1}.fc .fc-timeline-slots>table{height:100%}.fc .fc-timeline-slot-minor{border-style:dotted}.fc .fc-timeline-slot-frame{align-items:center;display:flex;justify-content:center}.fc .fc-timeline-header-row-chrono .fc-timeline-slot-frame{justify-content:flex-start}.fc .fc-timeline-header-row:last-child .fc-timeline-slot-frame{overflow:hidden}.fc .fc-timeline-slot-cushion{padding:4px 5px;white-space:nowrap}.fc-direction-ltr .fc-timeline-slot{border-right:0!important}.fc-direction-rtl .fc-timeline-slot{border-left:0!important}.fc .fc-timeline-now-indicator-container{bottom:0;left:0;position:absolute;right:0;top:0;width:0;z-index:4}.fc .fc-timeline-now-indicator-arrow,.fc .fc-timeline-now-indicator-line{border-color:var(--fc-now-indicator-color);border-style:solid;pointer-events:none;position:absolute;top:0}.fc .fc-timeline-now-indicator-arrow{border-left-color:transparent;border-right-color:transparent;border-width:6px 5px 0;margin:0 -6px}.fc .fc-timeline-now-indicator-line{border-width:0 0 0 1px;bottom:0;margin:0 -1px}.fc .fc-timeline-events{position:relative;width:0;z-index:3}.fc .fc-timeline-event-harness,.fc .fc-timeline-more-link{position:absolute;top:0}.fc-timeline-event{z-index:1}.fc-timeline-event.fc-event-mirror{z-index:2}.fc-timeline-event{align-items:center;border-radius:0;display:flex;font-size:var(--fc-small-font-size);margin-bottom:1px;padding:2px 1px;position:relative}.fc-timeline-event .fc-event-main{flex-grow:1;flex-shrink:1;min-width:0}.fc-timeline-event .fc-event-time{font-weight:700}.fc-timeline-event .fc-event-time,.fc-timeline-event .fc-event-title{padding:0 2px;white-space:nowrap}.fc-direction-ltr .fc-timeline-event.fc-event-end,.fc-direction-ltr .fc-timeline-more-link{margin-right:1px}.fc-direction-rtl .fc-timeline-event.fc-event-end,.fc-direction-rtl .fc-timeline-more-link{margin-left:1px}.fc-timeline-overlap-disabled .fc-timeline-event{margin-bottom:0;padding-bottom:5px;padding-top:5px}.fc-timeline-event:not(.fc-event-end):after,.fc-timeline-event:not(.fc-event-start):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):before,.fc-direction-rtl .fc-timeline-event:not(.fc-event-end):after{border-left:0}.fc-direction-ltr .fc-timeline-event:not(.fc-event-end):after,.fc-direction-rtl .fc-timeline-event:not(.fc-event-start):before{border-right:0}.fc-timeline-more-link{background:var(--fc-more-link-bg-color);color:var(--fc-more-link-text-color);cursor:pointer;font-size:var(--fc-small-font-size);padding:1px}.fc-timeline-more-link-inner{display:inline-block;left:0;padding:2px;right:0}.fc .fc-timeline-bg{bottom:0;left:0;position:absolute;right:0;top:0;width:0;z-index:2}.fc .fc-timeline-bg .fc-non-business{z-index:1}.fc .fc-timeline-bg .fc-bg-event{z-index:2}.fc .fc-timeline-bg .fc-highlight{z-index:3}.fc .fc-timeline-bg-harness{bottom:0;position:absolute;top:0}');n.MAX_TIMELINE_SLOTS=1e3;const ie=[{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 se(e,t,c,u){let p={labelInterval:c.slotLabelInterval,slotDuration:c.slotDuration};!function(e,t,i){const{currentRange:s}=t;if(e.labelInterval){i.countDurationsBetween(s.start,s.end,e.labelInterval)>n.MAX_TIMELINE_SLOTS&&(console.warn("slotLabelInterval results in too many cells"),e.labelInterval=null)}if(e.slotDuration){i.countDurationsBetween(s.start,s.end,e.slotDuration)>n.MAX_TIMELINE_SLOTS&&(console.warn("slotDuration results in too many cells"),e.slotDuration=null)}if(e.labelInterval&&e.slotDuration){const t=l(e.labelInterval,e.slotDuration);(null===t||t<1)&&(console.warn("slotLabelInterval must be a multiple of slotDuration"),e.slotDuration=null)}}(p,e,t),le(p,e,t),function(e,t,n){const{currentRange:i}=t;let{slotDuration:s}=e;if(!s){const o=le(e,t,n);for(let e of ie){const t=r(e),n=l(o,t);if(null!==n&&n>1&&n<=6){s=t;break}}if(s){n.countDurationsBetween(i.start,i.end,s)>200&&(s=null)}s||(s=o),e.slotDuration=s}}(p,e,t);let g=c.slotLabelFormat,v=Array.isArray(g)?g:null!=g?[g]:function(e,t,n,i){let o,r;const{labelInterval:l}=e;let a=s(l).unit;const d=i.weekNumbers;let c=o=r=null;"week"!==a||d||(a="day");switch(a){case"year":c={year:"numeric"};break;case"month":ae("years",t,n)>1&&(c={year:"numeric"}),o={month:"short"};break;case"week":ae("years",t,n)>1&&(c={year:"numeric"}),o={week:"narrow"};break;case"day":ae("years",t,n)>1?c={year:"numeric",month:"long"}:ae("months",t,n)>1&&(c={month:"long"}),d&&(o={week:"short"}),r={weekday:"narrow",day:"numeric"};break;case"hour":d&&(c={week:"short"}),ae("days",t,n)>1&&(o={weekday:"short",day:"numeric",month:"numeric",omitCommas:!0}),r={hour:"numeric",minute:"2-digit",omitZeroMinute:!0,meridiem:"short"};break;case"minute":f(l)/60>=6?(c={hour:"numeric",meridiem:"short"},o=e=>":"+x(e.date.minute,2)):c={hour:"numeric",minute:"numeric",meridiem:"short"};break;case"second":h(l)/60>=6?(c={hour:"numeric",minute:"2-digit",meridiem:"lowercase"},o=e=>":"+x(e.date.second,2)):c={hour:"numeric",minute:"2-digit",second:"2-digit",meridiem:"lowercase"};break;case"millisecond":c={hour:"numeric",minute:"2-digit",second:"2-digit",meridiem:"lowercase"},o=e=>"."+x(e.millisecond,3)}return[].concat(c||[],o||[],r||[])}(p,e,t,c);p.headerFormats=v.map((e=>i(e))),p.isTimeScale=Boolean(p.slotDuration.milliseconds);let b=null;if(!p.isTimeScale){const e=s(p.slotDuration).unit;/year|month|week/.test(e)&&(b=e)}p.largeUnit=b,p.emphasizeWeeks=1===o(p.slotDuration)&&ae("weeks",e,t)>=2&&!c.businessHours;let S,R,D=c.snapDuration;D&&(S=r(D),R=l(p.slotDuration,S)),null==R&&(S=p.slotDuration,R=1),p.snapDuration=S,p.snapsPerSlot=R;let y=a(e.slotMaxTime)-a(e.slotMinTime),w=oe(e.renderRange.start,p,t),C=oe(e.renderRange.end,p,t);p.isTimeScale&&(w=t.add(w,e.slotMinTime),C=t.add(d(C,-1),e.slotMaxTime)),p.timeWindowMs=y,p.normalizedRange={start:w,end:C};let k=[],P=w;for(;P<C;)re(P,p,e,u)&&k.push(P),P=t.add(P,p.slotDuration);p.slotDates=k;let M=-1,T=0;const E=[],I=[];for(P=w;P<C;)re(P,p,e,u)?(M+=1,E.push(M),I.push(T)):E.push(M+.5),P=t.add(P,p.snapDuration),T+=1;return p.snapDiffToIndex=E,p.snapIndexToDiff=I,p.snapCnt=M+1,p.slotCnt=p.snapCnt/p.snapsPerSlot,p.isWeekStarts=function(e,t){let{slotDates:n,emphasizeWeeks:i}=e,s=null,o=[];for(let e of n){let n=t.computeWeekNumber(e),r=i&&null!==s&&s!==n;s=n,o.push(r)}return o}(p,t),p.cellRows=function(e,t){let n=e.slotDates,i=e.headerFormats,s=i.map((()=>[])),r=o(e.slotDuration),l=7===r?"week":1===r?"day":null,a=i.map((e=>e.getSmallestUnit?e.getSmallestUnit():null));for(let o=0;o<n.length;o+=1){let r=n[o],d=e.isWeekStarts[o];for(let n=0;n<i.length;n+=1){let o=i[n],c=s[n],h=c[c.length-1],f=n===i.length-1,u=i.length>1&&!f,p=null,g=a[n]||(f?l:null);if(u){let e=t.format(r,o);h&&h.text===e?h.colspan+=1:p=de(r,e,g)}else if(!h||m(t.countDurationsBetween(e.normalizedRange.start,r,e.labelInterval))){p=de(r,t.format(r,o),g)}else h.colspan+=1;p&&(p.weekStart=d,c.push(p))}}return s}(p,t),p.slotsPerLabel=l(p.labelInterval,p.slotDuration),p}function oe(e,t,n){let i=e;return t.isTimeScale||(i=c(i),t.largeUnit&&(i=n.startOf(i,t.largeUnit))),i}function re(e,t,n,i){if(i.isHiddenDay(e))return!1;if(t.isTimeScale){let i=c(e),s=e.valueOf()-i.valueOf()-a(n.slotMinTime);return s=(s%864e5+864e5)%864e5,s<t.timeWindowMs}return!0}function le(e,t,n){const{currentRange:i}=t;let{labelInterval:s}=e;if(!s){let t;if(e.slotDuration){for(t of ie){const n=r(t),i=l(n,e.slotDuration);if(null!==i&&i<=6){s=n;break}}s||(s=e.slotDuration)}else for(t of ie){s=r(t);if(n.countDurationsBetween(i.start,i.end,s)>=18)break}e.labelInterval=s}return s}function ae(e,t,n){let i=t.currentRange,s=null;return"years"===e?s=n.diffWholeYears(i.start,i.end):"months"===e||"weeks"===e?s=n.diffWholeMonths(i.start,i.end):"days"===e&&(s=u(i.start,i.end)),s||0}function de(e,t,n){return{date:e,text:t,rowUnit:n,colspan:1,isWeekStart:!1}}class ce extends p{constructor(){super(...arguments),this.refineRenderProps=j(ue),this.buildCellNavLinkAttrs=D(he)}render(){let{props:e,context:t}=this,{dateEnv:n,options:i}=t,{cell:s,dateProfile:o,tDateProfile:r}=e,l=B(s.date,e.todayRange,e.nowDate,o),a=this.refineRenderProps({level:e.rowLevel,dateMarker:s.date,text:s.text,dateEnv:t.dateEnv,viewApi:t.viewApi});return te(_,{elTag:"th",elClasses:["fc-timeline-slot","fc-timeline-slot-label",s.isWeekStart&&"fc-timeline-slot-em",..."time"===s.rowUnit?q(l,t.theme):F(l,t.theme)],elAttrs:{colSpan:s.colspan,"data-date":n.formatIso(s.date,{omitTime:!r.isTimeScale,omitTimeZoneOffset:!0})},renderProps:a,generatorName:"slotLabelContent",customGenerator:i.slotLabelContent,defaultGenerator:fe,classNameGenerator:i.slotLabelClassNames,didMount:i.slotLabelDidMount,willUnmount:i.slotLabelWillUnmount},(n=>te("div",{className:"fc-timeline-slot-frame",style:{height:e.rowInnerHeight}},te(n,{elTag:"a",elClasses:["fc-timeline-slot-cushion","fc-scrollgrid-sync-inner",e.isSticky&&"fc-sticky"],elAttrs:this.buildCellNavLinkAttrs(t,s.date,s.rowUnit)}))))}}function he(e,t,n){return n&&"time"!==n?Z(e,t,n):{}}function fe(e){return e.text}function ue(e){return{level:e.level,date:e.dateEnv.toDate(e.dateMarker),view:e.viewApi,text:e.text}}class me extends p{render(){let{dateProfile:e,tDateProfile:t,rowInnerHeights:n,todayRange:i,nowDate:s}=this.props,{cellRows:o}=t;return te(ne,null,o.map(((r,l)=>{let a=l===o.length-1,d=t.isTimeScale&&a;return te("tr",{key:l,className:["fc-timeline-header-row",d?"fc-timeline-header-row-chrono":""].join(" ")},r.map((o=>te(ce,{key:o.date.toISOString(),cell:o,rowLevel:l,dateProfile:e,tDateProfile:t,todayRange:i,nowDate:s,rowInnerHeight:n&&n[l],isSticky:!a}))))})))}}class pe{constructor(e,t,n,i,s,o){this.slatRootEl=e,this.dateProfile=n,this.tDateProfile=i,this.dateEnv=s,this.isRtl=o,this.outerCoordCache=new X(e,t,!0,!1),this.innerCoordCache=new X(e,Y(t,"div"),!0,!1)}isDateInRange(e){return K(this.dateProfile.currentRange,e)}dateToCoord(e){let{tDateProfile:t}=this,n=this.computeDateSnapCoverage(e)/t.snapsPerSlot,i=Math.floor(n);i=Math.min(i,t.slotCnt-1);let s=n-i,{innerCoordCache:o,outerCoordCache:r}=this;return this.isRtl?r.originClientRect.width-(r.rights[i]-o.getWidth(i)*s):r.lefts[i]+o.getWidth(i)*s}rangeToCoords(e){return{start:this.dateToCoord(e.start),end:this.dateToCoord(e.end)}}durationToCoord(e){let{dateProfile:t,tDateProfile:n,dateEnv:i,isRtl:s}=this,o=0;if(t){let r=i.add(t.activeRange.start,e);n.isTimeScale||(r=c(r)),o=this.dateToCoord(r),!s&&o&&(o+=1)}return o}coordFromLeft(e){return this.isRtl?this.outerCoordCache.originClientRect.width-e:e}computeDateSnapCoverage(e){return ge(e,this.tDateProfile,this.dateEnv)}}function ge(e,t,n){let i=n.countDurationsBetween(t.normalizedRange.start,e,t.snapDuration);if(i<0)return 0;if(i>=t.snapDiffToIndex.length)return t.snapCnt;let s=Math.floor(i),o=t.snapDiffToIndex[s];return m(o)?o+=i-s:o=Math.ceil(o),o}function ve(e,t){return null===e?{left:"",right:""}:t?{right:e,left:""}:{left:e,right:""}}function be(e,t){return e?t?{right:e.start,left:-e.end}:{left:e.start,right:-e.end}:{left:"",right:""}}class Se extends p{constructor(){super(...arguments),this.rootElRef=ee()}render(){let{props:e,context:t}=this,n=s(e.tDateProfile.slotDuration).unit,i=e.slatCoords&&e.slatCoords.dateProfile===e.dateProfile?e.slatCoords:null;return te(v,{unit:n},((n,s)=>te("div",{className:"fc-timeline-header",ref:this.rootElRef},te("table",{"aria-hidden":!0,className:"fc-scrollgrid-sync-table",style:{minWidth:e.tableMinWidth,width:e.clientWidth}},e.tableColGroupNode,te("tbody",null,te(me,{dateProfile:e.dateProfile,tDateProfile:e.tDateProfile,nowDate:n,todayRange:s,rowInnerHeights:e.rowInnerHeights}))),t.options.nowIndicator&&te("div",{className:"fc-timeline-now-indicator-container"},i&&i.isDateInRange(n)&&te(g,{elClasses:["fc-timeline-now-indicator-arrow"],elStyle:ve(i.dateToCoord(n),t.isRtl),isAxis:!0,date:n})))))}componentDidMount(){this.updateSize()}componentDidUpdate(){this.updateSize()}updateSize(){this.props.onMaxCushionWidth&&this.props.onMaxCushionWidth(this.computeMaxCushionWidth())}computeMaxCushionWidth(){return Math.max(...b(this.rootElRef.current,".fc-timeline-header-row:last-child .fc-timeline-slot-cushion").map((e=>e.getBoundingClientRect().width)))}}class Re extends p{render(){let{props:e,context:t}=this,{dateEnv:n,options:i,theme:s}=t,{date:o,tDateProfile:r,isEm:l}=e,a=B(e.date,e.todayRange,e.nowDate,e.dateProfile),d=Object.assign(Object.assign({date:n.toDate(e.date)},a),{view:t.viewApi});return te(_,{elTag:"td",elRef:e.elRef,elClasses:["fc-timeline-slot","fc-timeline-slot-lane",l&&"fc-timeline-slot-em",r.isTimeScale?m(n.countDurationsBetween(r.normalizedRange.start,e.date,r.labelInterval))?"fc-timeline-slot-major":"fc-timeline-slot-minor":"",...e.isDay?F(a,s):q(a,s)],elAttrs:{"data-date":n.formatIso(o,{omitTimeZoneOffset:!0,omitTime:!r.isTimeScale})},renderProps:d,generatorName:"slotLaneContent",customGenerator:i.slotLaneContent,classNameGenerator:i.slotLaneClassNames,didMount:i.slotLaneDidMount,willUnmount:i.slotLaneWillUnmount},(e=>te(e,{elTag:"div"})))}}class De extends p{render(){let{props:e}=this,{tDateProfile:t,cellElRefs:n}=e,{slotDates:i,isWeekStarts:s}=t,o=!t.isTimeScale&&!t.largeUnit;return te("tbody",null,te("tr",null,i.map(((i,r)=>{let l=i.toISOString();return te(Re,{key:l,elRef:n.createRef(l),date:i,dateProfile:e.dateProfile,tDateProfile:t,nowDate:e.nowDate,todayRange:e.todayRange,isEm:s[r],isDay:o})}))))}}class ye extends p{constructor(){super(...arguments),this.rootElRef=ee(),this.cellElRefs=new k,this.handleScrollRequest=e=>{let{onScrollLeftRequest:t}=this.props,{coords:n}=this;if(t&&n){if(e.time){t(n.coordFromLeft(n.durationToCoord(e.time)))}return!0}return null}}render(){let{props:e,context:t}=this;return te("div",{className:"fc-timeline-slots",ref:this.rootElRef},te("table",{"aria-hidden":!0,className:t.theme.getClass("table"),style:{minWidth:e.tableMinWidth,width:e.clientWidth}},e.tableColGroupNode,te(De,{cellElRefs:this.cellElRefs,dateProfile:e.dateProfile,tDateProfile:e.tDateProfile,nowDate:e.nowDate,todayRange:e.todayRange})))}componentDidMount(){this.updateSizing(),this.scrollResponder=this.context.createScrollResponder(this.handleScrollRequest)}componentDidUpdate(e){this.updateSizing(),this.scrollResponder.update(e.dateProfile!==this.props.dateProfile)}componentWillUnmount(){this.scrollResponder.detach(),this.props.onCoords&&this.props.onCoords(null)}updateSizing(){let{props:e,context:t}=this;if(null!==e.clientWidth&&this.scrollResponder){this.rootElRef.current.offsetWidth&&(this.coords=new pe(this.rootElRef.current,(n=this.cellElRefs.currentMap,e.tDateProfile.slotDates.map((e=>{let t=e.toISOString();return n[t]}))),e.dateProfile,e.tDateProfile,t.dateEnv,t.isRtl),e.onCoords&&e.onCoords(this.coords),this.scrollResponder.update(!1))}var n}positionToHit(e){let{outerCoordCache:t}=this.coords,{dateEnv:n,isRtl:i}=this.context,{tDateProfile:s}=this.props,o=t.leftToIndex(e);if(null!=o){let r=t.getWidth(o),l=i?(t.rights[o]-e)/r:(e-t.lefts[o])/r,a=Math.floor(l*s.snapsPerSlot),d=n.add(s.slotDates[o],P(s.snapDuration,a));return{dateSpan:{range:{start:d,end:n.add(d,s.snapDuration)},allDay:!this.props.tDateProfile.isTimeScale},dayEl:this.cellElRefs.currentMap[o],left:t.lefts[o],right:t.rights[o]}}return null}}function we(e,t,n){let i=[];if(n)for(let s of e){let e=n.rangeToCoords(s),o=Math.round(e.start),r=Math.round(e.end);r-o<t&&(r=o+t),i.push({start:o,end:r})}return i}class Ce extends p{render(){let{props:e}=this,t=[].concat(e.eventResizeSegs,e.dateSelectionSegs);return e.timelineCoords&&te("div",{className:"fc-timeline-bg"},this.renderSegs(e.businessHourSegs||[],e.timelineCoords,"non-business"),this.renderSegs(e.bgEventSegs||[],e.timelineCoords,"bg-event"),this.renderSegs(t,e.timelineCoords,"highlight"))}renderSegs(e,t,n){let{todayRange:i,nowDate:s}=this.props,{isRtl:o}=this.context,r=we(e,0,t),l=e.map(((e,t)=>{let l=be(r[t],o);return te("div",{key:I(e.eventRange),className:"fc-timeline-bg-harness",style:l},"bg-event"===n?te(M,Object.assign({seg:e},T(e,i,s))):E(n))}));return te(ne,null,l)}}class xe extends W{sliceRange(e,t,n,i,s){let o=function(e,t,n){if(!t.isTimeScale&&(e=G(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,i,s),r=[];if(ge(o.start,i,s)<ge(o.end,i,s)){let e=z(o,i.normalizedRange);e&&r.push({start:e.start,end:e.end,isStart:e.start.valueOf()===o.start.valueOf()&&re(e.start,i,t,n),isEnd:e.end.valueOf()===o.end.valueOf()&&re(L(e.end,-1),i,t,n)})}return r}}const ke=i({hour:"numeric",minute:"2-digit",omitZeroMinute:!0,meridiem:"narrow"});class Pe extends p{render(){let{props:e}=this;return te(V,Object.assign({},e,{elClasses:["fc-timeline-event","fc-h-event"],defaultTimeFormat:ke,defaultDisplayEventTime:!e.isTimeScale}))}}class Me extends p{render(){let{props:e,context:t}=this,{hiddenSegs:n,placement:i,resourceId:s}=e,{top:o,hcoords:r}=i,l=r&&null!==o,a=be(r,t.isRtl),d=s?{resourceId:s}:{};return te($,{elRef:e.elRef,elClasses:["fc-timeline-more-link"],elStyle:Object.assign({visibility:l?"":"hidden",top:o||0},a),allDayDate:null,moreCnt:n.length,allSegs:n,hiddenSegs:n,dateProfile:e.dateProfile,todayRange:e.todayRange,extraDateSpan:d,popoverContent:()=>te(ne,null,n.map((t=>{let n=t.eventRange.instance.instanceId;return te("div",{key:n,style:{visibility:e.isForcedInvisible[n]?"hidden":""}},te(Pe,Object.assign({isTimeScale:e.isTimeScale,seg:t,isDragging:!1,isResizing:!1,isDateSelecting:!1,isSelected:n===e.eventSelection},T(t,e.todayRange,e.nowDate))))})))},(e=>te(e,{elTag:"div",elClasses:["fc-timeline-more-link-inner","fc-sticky"]})))}}class Te extends p{constructor(){super(...arguments),this.slicer=new xe,this.sortEventSegs=D(H),this.harnessElRefs=new k,this.moreElRefs=new k,this.innerElRef=ee(),this.state={eventInstanceHeights:{},moreLinkHeights:{}},this.handleResize=e=>{e&&this.updateSize()}}render(){let{props:e,state:t,context:n}=this,{options:i}=n,{dateProfile:s,tDateProfile:o}=e,r=this.slicer.sliceProps(e,s,o.isTimeScale?null:e.nextDayThreshold,n,s,n.dateProfileGenerator,o,n.dateEnv),l=(r.eventDrag?r.eventDrag.segs:null)||(r.eventResize?r.eventResize.segs:null)||[],a=this.sortEventSegs(r.fgEventSegs,i.eventOrder),d=we(a,i.eventMinWidth,e.timelineCoords),[c,h]=function(e,t,n,i,s,o){let r=[],l=[];for(let i=0;i<e.length;i+=1){let s=e[i],o=n[s.eventRange.instance.instanceId],a=t[i];o&&a?r.push({index:i,span:a,thickness:o}):l.push({seg:s,hcoords:a,top:null})}let a=new Q;null!=s&&(a.strictOrder=s),null!=o&&(a.maxStackCnt=o);let d=a.addSegs(r),c=d.map((t=>({seg:e[t.index],hcoords:t.span,top:null}))),h=J(d),f=[],u=[];const m=t=>e[t.index];for(let t=0;t<h.length;t+=1){let n=h[t],s=n.entries.map(m),o=i[O(U(s))];null!=o?f.push({index:e.length+t,thickness:o,span:n.span}):u.push({seg:s,hcoords:n.span,top:null})}a.maxStackCnt=-1,a.addSegs(f);let p=a.toRects(),g=[],v=0;for(let t of p){let n=t.index;g.push({seg:n<e.length?e[n]:h[n-e.length].entries.map(m),hcoords:t.span,top:t.levelCoord}),v=Math.max(v,t.levelCoord+t.thickness)}return[g.concat(l,c,u),v]}(a,d,t.eventInstanceHeights,t.moreLinkHeights,i.eventOrderStrict,i.eventMaxStack),f=(r.eventDrag?r.eventDrag.affectedInstances:null)||(r.eventResize?r.eventResize.affectedInstances:null)||{};return te(ne,null,te(Ce,{businessHourSegs:r.businessHourSegs,bgEventSegs:r.bgEventSegs,timelineCoords:e.timelineCoords,eventResizeSegs:r.eventResize?r.eventResize.segs:[],dateSelectionSegs:r.dateSelectionSegs,nowDate:e.nowDate,todayRange:e.todayRange}),te("div",{className:"fc-timeline-events fc-scrollgrid-sync-inner",ref:this.innerElRef,style:{height:h}},this.renderFgSegs(c,f,!1,!1,!1),this.renderFgSegs(function(e,t,n){if(!e.length||!t)return[];let i=function(e){let t={};for(let n of e){let{seg:e}=n;Array.isArray(e)||(t[e.eventRange.instance.instanceId]=n.top)}return t}(n);return e.map((e=>({seg:e,hcoords:t.rangeToCoords(e),top:i[e.eventRange.instance.instanceId]})))}(l,e.timelineCoords,c),{},Boolean(r.eventDrag),Boolean(r.eventResize),!1)))}componentDidMount(){this.updateSize(),this.context.addResizeHandler(this.handleResize)}componentDidUpdate(e,t){e.eventStore===this.props.eventStore&&e.timelineCoords===this.props.timelineCoords&&t.moreLinkHeights===this.state.moreLinkHeights||this.updateSize()}componentWillUnmount(){this.context.removeResizeHandler(this.handleResize)}updateSize(){let{props:e}=this,{timelineCoords:t}=e;const n=this.innerElRef.current;e.onHeightChange&&e.onHeightChange(n,!1),t&&this.setState({eventInstanceHeights:N(this.harnessElRefs.currentMap,(e=>Math.round(e.getBoundingClientRect().height))),moreLinkHeights:N(this.moreElRefs.currentMap,(e=>Math.round(e.getBoundingClientRect().height)))},(()=>{e.onHeightChange&&e.onHeightChange(n,!0)})),e.syncParentMinHeight&&(n.parentElement.style.minHeight=n.style.height)}renderFgSegs(e,t,n,i,s){let{harnessElRefs:o,moreElRefs:r,props:l,context:a}=this,d=n||i||s;return te(ne,null,e.map((e=>{let{seg:c,hcoords:h,top:f}=e;if(Array.isArray(c)){let n=O(U(c));return te(Me,{key:"m:"+n,elRef:r.createRef(n),hiddenSegs:c,placement:e,dateProfile:l.dateProfile,nowDate:l.nowDate,todayRange:l.todayRange,isTimeScale:l.tDateProfile.isTimeScale,eventSelection:l.eventSelection,resourceId:l.resourceId,isForcedInvisible:t})}let u=c.eventRange.instance.instanceId,m=d||Boolean(!t[u]&&h&&null!==f),p=be(h,a.isRtl);return te("div",{key:"e:"+u,ref:d?null:o.createRef(u),className:"fc-timeline-event-harness",style:Object.assign({visibility:m?"":"hidden",top:f||0},p)},te(Pe,Object.assign({isTimeScale:l.tDateProfile.isTimeScale,seg:c,isDragging:n,isResizing:i,isDateSelecting:s,isSelected:u===l.eventSelection},T(c,l.todayRange,l.nowDate))))})))}}Te.addStateEquality({eventInstanceHeights:S,moreLinkHeights:S});class Ee extends R{constructor(){super(...arguments),this.slatsRef=ee(),this.state={coords:null},this.handeEl=e=>{e?this.context.registerInteractiveComponent(this,{el:e}):this.context.unregisterInteractiveComponent(this)},this.handleCoords=e=>{this.setState({coords:e}),this.props.onSlatCoords&&this.props.onSlatCoords(e)}}render(){let{props:e,state:t,context:n}=this,{options:i}=n,{dateProfile:o,tDateProfile:r}=e,l=s(r.slotDuration).unit;return te("div",{className:"fc-timeline-body",ref:this.handeEl,style:{minWidth:e.tableMinWidth,height:e.clientHeight,width:e.clientWidth}},te(v,{unit:l},((s,l)=>te(ne,null,te(ye,{ref:this.slatsRef,dateProfile:o,tDateProfile:r,nowDate:s,todayRange:l,clientWidth:e.clientWidth,tableColGroupNode:e.tableColGroupNode,tableMinWidth:e.tableMinWidth,onCoords:this.handleCoords,onScrollLeftRequest:e.onScrollLeftRequest}),te(Te,{dateProfile:o,tDateProfile:e.tDateProfile,nowDate:s,todayRange:l,nextDayThreshold:i.nextDayThreshold,businessHours:e.businessHours,eventStore:e.eventStore,eventUiBases:e.eventUiBases,dateSelection:e.dateSelection,eventSelection:e.eventSelection,eventDrag:e.eventDrag,eventResize:e.eventResize,timelineCoords:t.coords,syncParentMinHeight:!0}),i.nowIndicator&&t.coords&&t.coords.isDateInRange(s)&&te("div",{className:"fc-timeline-now-indicator-container"},te(g,{elClasses:["fc-timeline-now-indicator-line"],elStyle:ve(t.coords.dateToCoord(s),n.isRtl),isAxis:!1,date:s}))))))}queryHit(e,t,n,i){let s=this.slatsRef.current.positionToHit(e);return s?{dateProfile:this.props.dateProfile,dateSpan:s.dateSpan,rect:{left:s.left,right:s.right,top:0,bottom:i},dayEl:s.dayEl,layer:0}:null}}class Ie extends R{constructor(){super(...arguments),this.buildTimelineDateProfile=D(se),this.scrollGridRef=ee(),this.state={slatCoords:null,slotCushionMaxWidth:null},this.handleSlatCoords=e=>{this.setState({slatCoords:e})},this.handleScrollLeftRequest=e=>{this.scrollGridRef.current.forceScrollLeft(0,e)},this.handleMaxCushionWidth=e=>{this.setState({slotCushionMaxWidth:Math.ceil(e)})}}render(){let{props:t,state:n,context:i}=this,{options:s}=i,o=!t.forPrint&&y(s),r=!t.forPrint&&w(s),l=this.buildTimelineDateProfile(t.dateProfile,i.dateEnv,s,i.dateProfileGenerator),{slotMinWidth:a}=s,d=We(l,a||this.computeFallbackSlotMinWidth(l)),c=[{type:"header",key:"header",isSticky:o,chunks:[{key:"timeline",content:e=>te(Se,{dateProfile:t.dateProfile,clientWidth:e.clientWidth,clientHeight:e.clientHeight,tableMinWidth:e.tableMinWidth,tableColGroupNode:e.tableColGroupNode,tDateProfile:l,slatCoords:n.slatCoords,onMaxCushionWidth:a?null:this.handleMaxCushionWidth})}]},{type:"body",key:"body",liquid:!0,chunks:[{key:"timeline",content:e=>te(Ee,Object.assign({},t,{clientWidth:e.clientWidth,clientHeight:e.clientHeight,tableMinWidth:e.tableMinWidth,tableColGroupNode:e.tableColGroupNode,tDateProfile:l,onSlatCoords:this.handleSlatCoords,onScrollLeftRequest:this.handleScrollLeftRequest}))}]}];return r&&c.push({type:"footer",key:"footer",isSticky:!0,chunks:[{key:"timeline",content:A}]}),te(C,{elClasses:["fc-timeline",!1===s.eventOverlap?"fc-timeline-overlap-disabled":""],viewSpec:i.viewSpec},te(e,{ref:this.scrollGridRef,liquid:!t.isHeightAuto&&!t.forPrint,forPrint:t.forPrint,collapsibleWidth:!1,colGroups:[{cols:d}],sections:c}))}computeFallbackSlotMinWidth(e){return Math.max(30,(this.state.slotCushionMaxWidth||0)/e.slotsPerLabel)}}function We(e,t){return[{span:e.slotCnt,minWidth:t||1}]}export{pe as TimelineCoords,Se as TimelineHeader,me as TimelineHeaderRows,Te as TimelineLane,Ce as TimelineLaneBg,xe as TimelineLaneSlicer,ye as TimelineSlats,Ie as TimelineView,We as buildSlatCols,se as buildTimelineDateProfile,ve as coordToCss,be as coordsToCss};
2
2
  //# sourceMappingURL=internal.js.map