@fullcalendar/list
Advanced tools
Comparing version 6.1.0 to 6.1.1
/*! | ||
FullCalendar List View Plugin v6.1.0 | ||
FullCalendar List View Plugin v6.1.1 | ||
Docs & License: https://fullcalendar.io/docs/list-view | ||
(c) 2022 Adam Shaw | ||
(c) 2023 Adam Shaw | ||
*/ | ||
@@ -6,0 +6,0 @@ FullCalendar.List = (function (exports, core, internal$1, preact) { |
/*! | ||
FullCalendar List View Plugin v6.1.0 | ||
FullCalendar List View Plugin v6.1.1 | ||
Docs & License: https://fullcalendar.io/docs/list-view | ||
(c) 2022 Adam Shaw | ||
(c) 2023 Adam Shaw | ||
*/ | ||
FullCalendar.List=function(e,t,n,a){"use strict";class r extends n.BaseComponent{constructor(){super(...arguments),this.state={textId:n.getUniqueDomId()}}render(){let{theme:e,dateEnv:t,options:r,viewApi:s}=this.context,{cellId:l,dayDate:o,todayRange:d}=this.props,{textId:c}=this.state,f=n.getDateMeta(o,d),u=r.listDayFormat?t.format(o,r.listDayFormat):"",g=r.listDaySideFormat?t.format(o,r.listDaySideFormat):"",m=Object.assign({date:t.toDate(o),view:s,textId:c,text:u,sideText:g,navLinkAttrs:n.buildNavLinkAttrs(this.context,o),sideNavLinkAttrs:n.buildNavLinkAttrs(this.context,o,"day",!1)},f);return a.createElement(n.ContentContainer,{elTag:"tr",elClasses:["fc-list-day",...n.getDayClassNames(f,e)],elAttrs:{"data-date":n.formatDayString(o)},renderProps:m,generatorName:"dayHeaderContent",customGenerator:r.dayHeaderContent,defaultGenerator:i,classNameGenerator:r.dayHeaderClassNames,didMount:r.dayHeaderDidMount,willUnmount:r.dayHeaderWillUnmount},t=>a.createElement("th",{scope:"colgroup",colSpan:3,id:l,"aria-labelledby":c},a.createElement(t,{elTag:"div",elClasses:["fc-list-day-cushion",e.getClass("tableCellShaded")]})))}}function i(e){return a.createElement(a.Fragment,null,e.text&&a.createElement("a",Object.assign({id:e.textId,className:"fc-list-day-text"},e.navLinkAttrs),e.text),e.sideText&&a.createElement("a",Object.assign({"aria-hidden":!0,className:"fc-list-day-side-text"},e.sideNavLinkAttrs),e.sideText))}const s=n.createFormatter({hour:"numeric",minute:"2-digit",meridiem:"short"});class l extends n.BaseComponent{render(){let{props:e,context:t}=this,{options:r}=t,{seg:i,timeHeaderId:l,eventHeaderId:d,dateHeaderId:c}=e,f=r.eventTimeFormat||s;return a.createElement(n.EventContainer,Object.assign({},e,{elTag:"tr",elClasses:["fc-list-event",i.eventRange.def.url&&"fc-event-forced-url"],defaultGenerator:()=>function(e,t){let r=n.getSegAnchorAttrs(e,t);return a.createElement("a",Object.assign({},r),e.eventRange.def.title)}(i,t),seg:i,timeText:"",disableDragging:!0,disableResizing:!0}),(e,r)=>a.createElement(a.Fragment,null,function(e,t,r,i,s){let{options:l}=r;if(!1!==l.displayEventTime){let d,c=e.eventRange.def,f=e.eventRange.instance,u=!1;if(c.allDay?u=!0:n.isMultiDayRange(e.eventRange.range)?e.isStart?d=n.buildSegTimeText(e,t,r,null,null,f.range.start,e.end):e.isEnd?d=n.buildSegTimeText(e,t,r,null,null,e.start,f.range.end):u=!0:d=n.buildSegTimeText(e,t,r),u){let e={text:r.options.allDayText,view:r.viewApi};return a.createElement(n.ContentContainer,{elTag:"td",elClasses:["fc-list-event-time"],elAttrs:{headers:`${i} ${s}`},renderProps:e,generatorName:"allDayContent",customGenerator:l.allDayContent,defaultGenerator:o,classNameGenerator:l.allDayClassNames,didMount:l.allDayDidMount,willUnmount:l.allDayWillUnmount})}return a.createElement("td",{className:"fc-list-event-time"},d)}return null}(i,f,t,l,c),a.createElement("td",{"aria-hidden":!0,className:"fc-list-event-graphic"},a.createElement("span",{className:"fc-list-event-dot",style:{borderColor:r.borderColor||r.backgroundColor}})),a.createElement(e,{elTag:"td",elClasses:["fc-list-event-title"],elAttrs:{headers:`${d} ${c}`}})))}}function o(e){return e.text}class d extends n.DateComponent{constructor(){super(...arguments),this.computeDateVars=n.memoize(f),this.eventStoreToSegs=n.memoize(this._eventStoreToSegs),this.state={timeHeaderId:n.getUniqueDomId(),eventHeaderId:n.getUniqueDomId(),dateHeaderIdRoot:n.getUniqueDomId()},this.setRootEl=e=>{e?this.context.registerInteractiveComponent(this,{el:e}):this.context.unregisterInteractiveComponent(this)}}render(){let{props:e,context:t}=this,{dayDates:r,dayRanges:i}=this.computeDateVars(e.dateProfile),s=this.eventStoreToSegs(e.eventStore,e.eventUiBases,i);return a.createElement(n.ViewContainer,{elRef:this.setRootEl,elClasses:["fc-list",t.theme.getClass("table"),!1!==t.options.stickyHeaderDates?"fc-list-sticky":""],viewSpec:t.viewSpec},a.createElement(n.Scroller,{liquid:!e.isHeightAuto,overflowX:e.isHeightAuto?"visible":"hidden",overflowY:e.isHeightAuto?"visible":"auto"},s.length>0?this.renderSegList(s,r):this.renderEmptyMessage()))}renderEmptyMessage(){let{options:e,viewApi:t}=this.context,r={text:e.noEventsText,view:t};return a.createElement(n.ContentContainer,{elTag:"div",elClasses:["fc-list-empty"],renderProps:r,generatorName:"noEventsContent",customGenerator:e.noEventsContent,defaultGenerator:c,classNameGenerator:e.noEventsClassNames,didMount:e.noEventsDidMount,willUnmount:e.noEventsWillUnmount},e=>a.createElement(e,{elTag:"div",elClasses:["fc-list-empty-cushion"]}))}renderSegList(e,t){let{theme:i,options:s}=this.context,{timeHeaderId:o,eventHeaderId:d,dateHeaderIdRoot:c}=this.state,f=function(e){let t,n,a=[];for(t=0;t<e.length;t+=1)n=e[t],(a[n.dayIndex]||(a[n.dayIndex]=[])).push(n);return a}(e);return a.createElement(n.NowTimer,{unit:"day"},(e,u)=>{let g=[];for(let i=0;i<f.length;i+=1){let m=f[i];if(m){let f=n.formatDayString(t[i]),h=c+"-"+f;g.push(a.createElement(r,{key:f,cellId:h,dayDate:t[i],todayRange:u})),m=n.sortEventSegs(m,s.eventOrder);for(let t of m)g.push(a.createElement(l,Object.assign({key:f+":"+t.eventRange.instance.instanceId,seg:t,isDragging:!1,isResizing:!1,isDateSelecting:!1,isSelected:!1,timeHeaderId:o,eventHeaderId:d,dateHeaderId:h},n.getSegMeta(t,u,e))))}}return a.createElement("table",{className:"fc-list-table "+i.getClass("table")},a.createElement("thead",null,a.createElement("tr",null,a.createElement("th",{scope:"col",id:o},s.timeHint),a.createElement("th",{scope:"col","aria-hidden":!0}),a.createElement("th",{scope:"col",id:d},s.eventHint))),a.createElement("tbody",null,g))})}_eventStoreToSegs(e,t,a){return this.eventRangesToSegs(n.sliceEventStore(e,t,this.props.dateProfile.activeRange,this.context.options.nextDayThreshold).fg,a)}eventRangesToSegs(e,t){let n=[];for(let a of e)n.push(...this.eventRangeToSegs(a,t));return n}eventRangeToSegs(e,t){let a,r,i,{dateEnv:s}=this.context,{nextDayThreshold:l}=this.context.options,o=e.range,d=e.def.allDay,c=[];for(a=0;a<t.length;a+=1)if(r=n.intersectRanges(o,t[a]),r&&(i={component:this,eventRange:e,start:r.start,end:r.end,isStart:e.isStart&&r.start.valueOf()===o.start.valueOf(),isEnd:e.isEnd&&r.end.valueOf()===o.end.valueOf(),dayIndex:a},c.push(i),!i.isEnd&&!d&&a+1<t.length&&o.end<s.add(t[a+1].start,l))){i.end=o.end,i.isEnd=!0;break}return c}}function c(e){return e.text}function f(e){let t=n.startOfDay(e.renderRange.start),a=e.renderRange.end,r=[],i=[];for(;t<a;)r.push(t),i.push({start:t,end:n.addDays(t,1)}),t=n.addDays(t,1);return{dayDates:r,dayRanges:i}}const u={listDayFormat:g,listDaySideFormat:g,noEventsClassNames:n.identity,noEventsContent:n.identity,noEventsDidMount:n.identity,noEventsWillUnmount:n.identity};function g(e){return!1===e?null:n.createFormatter(e)}n.injectStyles(':root{--fc-list-event-dot-width:10px;--fc-list-event-hover-bg-color:#f5f5f5}.fc-theme-standard .fc-list{border:1px solid var(--fc-border-color)}.fc .fc-list-empty{align-items:center;background-color:var(--fc-neutral-bg-color);display:flex;height:100%;justify-content:center}.fc .fc-list-empty-cushion{margin:5em 0}.fc .fc-list-table{border-style:hidden;width:100%}.fc .fc-list-table tr>*{border-left:0;border-right:0}.fc .fc-list-sticky .fc-list-day>*{background:var(--fc-page-bg-color);position:sticky;top:0}.fc .fc-list-table thead{left:-10000px;position:absolute}.fc .fc-list-table tbody>tr:first-child th{border-top:0}.fc .fc-list-table th{padding:0}.fc .fc-list-day-cushion,.fc .fc-list-table td{padding:8px 14px}.fc .fc-list-day-cushion:after{clear:both;content:"";display:table}.fc-theme-standard .fc-list-day-cushion{background-color:var(--fc-neutral-bg-color)}.fc-direction-ltr .fc-list-day-text,.fc-direction-rtl .fc-list-day-side-text{float:left}.fc-direction-ltr .fc-list-day-side-text,.fc-direction-rtl .fc-list-day-text{float:right}.fc-direction-ltr .fc-list-table .fc-list-event-graphic{padding-right:0}.fc-direction-rtl .fc-list-table .fc-list-event-graphic{padding-left:0}.fc .fc-list-event.fc-event-forced-url{cursor:pointer}.fc .fc-list-event:hover td{background-color:var(--fc-list-event-hover-bg-color)}.fc .fc-list-event-graphic,.fc .fc-list-event-time{white-space:nowrap;width:1px}.fc .fc-list-event-dot{border:calc(var(--fc-list-event-dot-width)/2) solid var(--fc-event-border-color);border-radius:calc(var(--fc-list-event-dot-width)/2);box-sizing:content-box;display:inline-block;height:0;width:0}.fc .fc-list-event-title a{color:inherit;text-decoration:none}.fc .fc-list-event.fc-event-forced-url:hover a{text-decoration:underline}');var m=t.createPlugin({name:"@fullcalendar/list",optionRefiners:u,views:{list:{component:d,buttonTextKey:"list",listDayFormat:{month:"long",day:"numeric",year:"numeric"}},listDay:{type:"list",duration:{days:1},listDayFormat:{weekday:"long"}},listWeek:{type:"list",duration:{weeks:1},listDayFormat:{weekday:"long"},listDaySideFormat:{month:"long",day:"numeric",year:"numeric"}},listMonth:{type:"list",duration:{month:1},listDaySideFormat:{weekday:"long"}},listYear:{type:"list",duration:{year:1},listDaySideFormat:{weekday:"long"}}}}),h={__proto__:null,ListView:d};return t.globalPlugins.push(m),e.Internal=h,e.default=m,Object.defineProperty(e,"__esModule",{value:!0}),e}({},FullCalendar,FullCalendar.Internal,FullCalendar.Preact); |
30
index.js
@@ -1,27 +0,23 @@ | ||
'use strict'; | ||
import { createPlugin } from '@fullcalendar/core'; | ||
import { ListView } from './internal.js'; | ||
import { identity, createFormatter, injectStyles } from '@fullcalendar/core/internal'; | ||
import '@fullcalendar/core/preact'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
var core = require('@fullcalendar/core'); | ||
var internalCommon = require('./internal.js'); | ||
var internal = require('@fullcalendar/core/internal'); | ||
require('@fullcalendar/core/preact'); | ||
const OPTION_REFINERS = { | ||
listDayFormat: createFalsableFormatter, | ||
listDaySideFormat: createFalsableFormatter, | ||
noEventsClassNames: internal.identity, | ||
noEventsContent: internal.identity, | ||
noEventsDidMount: internal.identity, | ||
noEventsWillUnmount: internal.identity, | ||
noEventsClassNames: identity, | ||
noEventsContent: identity, | ||
noEventsDidMount: identity, | ||
noEventsWillUnmount: identity, | ||
// noEventsText is defined in base options | ||
}; | ||
function createFalsableFormatter(input) { | ||
return input === false ? null : internal.createFormatter(input); | ||
return input === false ? null : createFormatter(input); | ||
} | ||
var css_248z = ":root{--fc-list-event-dot-width:10px;--fc-list-event-hover-bg-color:#f5f5f5}.fc-theme-standard .fc-list{border:1px solid var(--fc-border-color)}.fc .fc-list-empty{align-items:center;background-color:var(--fc-neutral-bg-color);display:flex;height:100%;justify-content:center}.fc .fc-list-empty-cushion{margin:5em 0}.fc .fc-list-table{border-style:hidden;width:100%}.fc .fc-list-table tr>*{border-left:0;border-right:0}.fc .fc-list-sticky .fc-list-day>*{background:var(--fc-page-bg-color);position:sticky;top:0}.fc .fc-list-table thead{left:-10000px;position:absolute}.fc .fc-list-table tbody>tr:first-child th{border-top:0}.fc .fc-list-table th{padding:0}.fc .fc-list-day-cushion,.fc .fc-list-table td{padding:8px 14px}.fc .fc-list-day-cushion:after{clear:both;content:\"\";display:table}.fc-theme-standard .fc-list-day-cushion{background-color:var(--fc-neutral-bg-color)}.fc-direction-ltr .fc-list-day-text,.fc-direction-rtl .fc-list-day-side-text{float:left}.fc-direction-ltr .fc-list-day-side-text,.fc-direction-rtl .fc-list-day-text{float:right}.fc-direction-ltr .fc-list-table .fc-list-event-graphic{padding-right:0}.fc-direction-rtl .fc-list-table .fc-list-event-graphic{padding-left:0}.fc .fc-list-event.fc-event-forced-url{cursor:pointer}.fc .fc-list-event:hover td{background-color:var(--fc-list-event-hover-bg-color)}.fc .fc-list-event-graphic,.fc .fc-list-event-time{white-space:nowrap;width:1px}.fc .fc-list-event-dot{border:calc(var(--fc-list-event-dot-width)/2) solid var(--fc-event-border-color);border-radius:calc(var(--fc-list-event-dot-width)/2);box-sizing:content-box;display:inline-block;height:0;width:0}.fc .fc-list-event-title a{color:inherit;text-decoration:none}.fc .fc-list-event.fc-event-forced-url:hover a{text-decoration:underline}"; | ||
internal.injectStyles(css_248z); | ||
injectStyles(css_248z); | ||
var index = core.createPlugin({ | ||
var index = createPlugin({ | ||
name: '@fullcalendar/list', | ||
@@ -31,3 +27,3 @@ optionRefiners: OPTION_REFINERS, | ||
list: { | ||
component: internalCommon.ListView, | ||
component: ListView, | ||
buttonTextKey: 'list', | ||
@@ -60,2 +56,2 @@ listDayFormat: { month: 'long', day: 'numeric', year: 'numeric' }, // like "January 1, 2016" | ||
exports["default"] = index; | ||
export { index as default }; |
116
internal.js
@@ -1,13 +0,9 @@ | ||
'use strict'; | ||
import { BaseComponent, getUniqueDomId, getDateMeta, buildNavLinkAttrs, ContentContainer, getDayClassNames, formatDayString, createFormatter, EventContainer, getSegAnchorAttrs, isMultiDayRange, buildSegTimeText, DateComponent, memoize, ViewContainer, Scroller, NowTimer, sortEventSegs, getSegMeta, sliceEventStore, intersectRanges, startOfDay, addDays } from '@fullcalendar/core/internal'; | ||
import { createElement, Fragment } from '@fullcalendar/core/preact'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
var internal = require('@fullcalendar/core/internal'); | ||
var preact = require('@fullcalendar/core/preact'); | ||
class ListViewHeaderRow extends internal.BaseComponent { | ||
class ListViewHeaderRow extends BaseComponent { | ||
constructor() { | ||
super(...arguments); | ||
this.state = { | ||
textId: internal.getUniqueDomId(), | ||
textId: getUniqueDomId(), | ||
}; | ||
@@ -19,3 +15,3 @@ } | ||
let { textId } = this.state; | ||
let dayMeta = internal.getDateMeta(dayDate, todayRange); | ||
let dayMeta = getDateMeta(dayDate, todayRange); | ||
// will ever be falsy? | ||
@@ -27,12 +23,12 @@ let text = options.listDayFormat ? dateEnv.format(dayDate, options.listDayFormat) : ''; | ||
text, | ||
sideText, navLinkAttrs: internal.buildNavLinkAttrs(this.context, dayDate), sideNavLinkAttrs: internal.buildNavLinkAttrs(this.context, dayDate, 'day', false) }, dayMeta); | ||
sideText, navLinkAttrs: buildNavLinkAttrs(this.context, dayDate), sideNavLinkAttrs: buildNavLinkAttrs(this.context, dayDate, 'day', false) }, dayMeta); | ||
// TODO: make a reusable HOC for dayHeader (used in daygrid/timegrid too) | ||
return (preact.createElement(internal.ContentContainer, { elTag: "tr", elClasses: [ | ||
return (createElement(ContentContainer, { elTag: "tr", elClasses: [ | ||
'fc-list-day', | ||
...internal.getDayClassNames(dayMeta, theme), | ||
...getDayClassNames(dayMeta, theme), | ||
], elAttrs: { | ||
'data-date': internal.formatDayString(dayDate), | ||
'data-date': formatDayString(dayDate), | ||
}, renderProps: renderProps, generatorName: "dayHeaderContent", customGenerator: options.dayHeaderContent, defaultGenerator: renderInnerContent, classNameGenerator: options.dayHeaderClassNames, didMount: options.dayHeaderDidMount, willUnmount: options.dayHeaderWillUnmount }, (InnerContent) => ( // TODO: force-hide top border based on :first-child | ||
preact.createElement("th", { scope: "colgroup", colSpan: 3, id: cellId, "aria-labelledby": textId }, | ||
preact.createElement(InnerContent, { elTag: "div", elClasses: [ | ||
createElement("th", { scope: "colgroup", colSpan: 3, id: cellId, "aria-labelledby": textId }, | ||
createElement(InnerContent, { elTag: "div", elClasses: [ | ||
'fc-list-day-cushion', | ||
@@ -44,8 +40,8 @@ theme.getClass('tableCellShaded'), | ||
function renderInnerContent(props) { | ||
return (preact.createElement(preact.Fragment, null, | ||
props.text && (preact.createElement("a", Object.assign({ id: props.textId, className: "fc-list-day-text" }, props.navLinkAttrs), props.text)), | ||
props.sideText && ( /* not keyboard tabbable */preact.createElement("a", Object.assign({ "aria-hidden": true, className: "fc-list-day-side-text" }, props.sideNavLinkAttrs), props.sideText)))); | ||
return (createElement(Fragment, null, | ||
props.text && (createElement("a", Object.assign({ id: props.textId, className: "fc-list-day-text" }, props.navLinkAttrs), props.text)), | ||
props.sideText && ( /* not keyboard tabbable */createElement("a", Object.assign({ "aria-hidden": true, className: "fc-list-day-side-text" }, props.sideNavLinkAttrs), props.sideText)))); | ||
} | ||
const DEFAULT_TIME_FORMAT = internal.createFormatter({ | ||
const DEFAULT_TIME_FORMAT = createFormatter({ | ||
hour: 'numeric', | ||
@@ -55,3 +51,3 @@ minute: '2-digit', | ||
}); | ||
class ListViewEventRow extends internal.BaseComponent { | ||
class ListViewEventRow extends BaseComponent { | ||
render() { | ||
@@ -62,17 +58,17 @@ let { props, context } = this; | ||
let timeFormat = options.eventTimeFormat || DEFAULT_TIME_FORMAT; | ||
return (preact.createElement(internal.EventContainer, Object.assign({}, props, { elTag: "tr", elClasses: [ | ||
return (createElement(EventContainer, Object.assign({}, props, { elTag: "tr", elClasses: [ | ||
'fc-list-event', | ||
seg.eventRange.def.url && 'fc-event-forced-url', | ||
], defaultGenerator: () => renderEventInnerContent(seg, context) /* weird */, seg: seg, timeText: "", disableDragging: true, disableResizing: true }), (InnerContent, eventContentArg) => (preact.createElement(preact.Fragment, null, | ||
], defaultGenerator: () => renderEventInnerContent(seg, context) /* weird */, seg: seg, timeText: "", disableDragging: true, disableResizing: true }), (InnerContent, eventContentArg) => (createElement(Fragment, null, | ||
buildTimeContent(seg, timeFormat, context, timeHeaderId, dateHeaderId), | ||
preact.createElement("td", { "aria-hidden": true, className: "fc-list-event-graphic" }, | ||
preact.createElement("span", { className: "fc-list-event-dot", style: { | ||
createElement("td", { "aria-hidden": true, className: "fc-list-event-graphic" }, | ||
createElement("span", { className: "fc-list-event-dot", style: { | ||
borderColor: eventContentArg.borderColor || eventContentArg.backgroundColor, | ||
} })), | ||
preact.createElement(InnerContent, { elTag: "td", elClasses: ['fc-list-event-title'], elAttrs: { headers: `${eventHeaderId} ${dateHeaderId}` } }))))); | ||
createElement(InnerContent, { elTag: "td", elClasses: ['fc-list-event-title'], elAttrs: { headers: `${eventHeaderId} ${dateHeaderId}` } }))))); | ||
} | ||
} | ||
function renderEventInnerContent(seg, context) { | ||
let interactiveAttrs = internal.getSegAnchorAttrs(seg, context); | ||
return (preact.createElement("a", Object.assign({}, interactiveAttrs), seg.eventRange.def.title)); | ||
let interactiveAttrs = getSegAnchorAttrs(seg, context); | ||
return (createElement("a", Object.assign({}, interactiveAttrs), seg.eventRange.def.title)); | ||
} | ||
@@ -89,8 +85,8 @@ function buildTimeContent(seg, timeFormat, context, timeHeaderId, dateHeaderId) { | ||
} | ||
else if (internal.isMultiDayRange(seg.eventRange.range)) { // TODO: use (!isStart || !isEnd) instead? | ||
else if (isMultiDayRange(seg.eventRange.range)) { // TODO: use (!isStart || !isEnd) instead? | ||
if (seg.isStart) { | ||
timeText = internal.buildSegTimeText(seg, timeFormat, context, null, null, eventInstance.range.start, seg.end); | ||
timeText = buildSegTimeText(seg, timeFormat, context, null, null, eventInstance.range.start, seg.end); | ||
} | ||
else if (seg.isEnd) { | ||
timeText = internal.buildSegTimeText(seg, timeFormat, context, null, null, seg.start, eventInstance.range.end); | ||
timeText = buildSegTimeText(seg, timeFormat, context, null, null, seg.start, eventInstance.range.end); | ||
} | ||
@@ -102,3 +98,3 @@ else { | ||
else { | ||
timeText = internal.buildSegTimeText(seg, timeFormat, context); | ||
timeText = buildSegTimeText(seg, timeFormat, context); | ||
} | ||
@@ -110,7 +106,7 @@ if (doAllDay) { | ||
}; | ||
return (preact.createElement(internal.ContentContainer, { elTag: "td", elClasses: ['fc-list-event-time'], elAttrs: { | ||
return (createElement(ContentContainer, { elTag: "td", elClasses: ['fc-list-event-time'], elAttrs: { | ||
headers: `${timeHeaderId} ${dateHeaderId}`, | ||
}, renderProps: renderProps, generatorName: "allDayContent", customGenerator: options.allDayContent, defaultGenerator: renderAllDayInner, classNameGenerator: options.allDayClassNames, didMount: options.allDayDidMount, willUnmount: options.allDayWillUnmount })); | ||
} | ||
return (preact.createElement("td", { className: "fc-list-event-time" }, timeText)); | ||
return (createElement("td", { className: "fc-list-event-time" }, timeText)); | ||
} | ||
@@ -126,11 +122,11 @@ return null; | ||
*/ | ||
class ListView extends internal.DateComponent { | ||
class ListView extends DateComponent { | ||
constructor() { | ||
super(...arguments); | ||
this.computeDateVars = internal.memoize(computeDateVars); | ||
this.eventStoreToSegs = internal.memoize(this._eventStoreToSegs); | ||
this.computeDateVars = memoize(computeDateVars); | ||
this.eventStoreToSegs = memoize(this._eventStoreToSegs); | ||
this.state = { | ||
timeHeaderId: internal.getUniqueDomId(), | ||
eventHeaderId: internal.getUniqueDomId(), | ||
dateHeaderIdRoot: internal.getUniqueDomId(), | ||
timeHeaderId: getUniqueDomId(), | ||
eventHeaderId: getUniqueDomId(), | ||
dateHeaderIdRoot: getUniqueDomId(), | ||
}; | ||
@@ -152,3 +148,3 @@ this.setRootEl = (rootEl) => { | ||
let eventSegs = this.eventStoreToSegs(props.eventStore, props.eventUiBases, dayRanges); | ||
return (preact.createElement(internal.ViewContainer, { elRef: this.setRootEl, elClasses: [ | ||
return (createElement(ViewContainer, { elRef: this.setRootEl, elClasses: [ | ||
'fc-list', | ||
@@ -160,3 +156,3 @@ context.theme.getClass('table'), | ||
], viewSpec: context.viewSpec }, | ||
preact.createElement(internal.Scroller, { liquid: !props.isHeightAuto, overflowX: props.isHeightAuto ? 'visible' : 'hidden', overflowY: props.isHeightAuto ? 'visible' : 'auto' }, eventSegs.length > 0 ? | ||
createElement(Scroller, { liquid: !props.isHeightAuto, overflowX: props.isHeightAuto ? 'visible' : 'hidden', overflowY: props.isHeightAuto ? 'visible' : 'auto' }, eventSegs.length > 0 ? | ||
this.renderSegList(eventSegs, dayDates) : | ||
@@ -171,3 +167,3 @@ this.renderEmptyMessage()))); | ||
}; | ||
return (preact.createElement(internal.ContentContainer, { elTag: "div", elClasses: ['fc-list-empty'], renderProps: renderProps, generatorName: "noEventsContent", customGenerator: options.noEventsContent, defaultGenerator: renderNoEventsInner, classNameGenerator: options.noEventsClassNames, didMount: options.noEventsDidMount, willUnmount: options.noEventsWillUnmount }, (InnerContent) => (preact.createElement(InnerContent, { elTag: "div", elClasses: ['fc-list-empty-cushion'] })))); | ||
return (createElement(ContentContainer, { elTag: "div", elClasses: ['fc-list-empty'], renderProps: renderProps, generatorName: "noEventsContent", customGenerator: options.noEventsContent, defaultGenerator: renderNoEventsInner, classNameGenerator: options.noEventsClassNames, didMount: options.noEventsDidMount, willUnmount: options.noEventsWillUnmount }, (InnerContent) => (createElement(InnerContent, { elTag: "div", elClasses: ['fc-list-empty-cushion'] })))); | ||
} | ||
@@ -178,3 +174,3 @@ renderSegList(allSegs, dayDates) { | ||
let segsByDay = groupSegsByDay(allSegs); // sparse array | ||
return (preact.createElement(internal.NowTimer, { unit: "day" }, (nowDate, todayRange) => { | ||
return (createElement(NowTimer, { unit: "day" }, (nowDate, todayRange) => { | ||
let innerNodes = []; | ||
@@ -184,23 +180,23 @@ for (let dayIndex = 0; dayIndex < segsByDay.length; dayIndex += 1) { | ||
if (daySegs) { // sparse array, so might be undefined | ||
let dayStr = internal.formatDayString(dayDates[dayIndex]); | ||
let dayStr = formatDayString(dayDates[dayIndex]); | ||
let dateHeaderId = dateHeaderIdRoot + '-' + dayStr; | ||
// append a day header | ||
innerNodes.push(preact.createElement(ListViewHeaderRow, { key: dayStr, cellId: dateHeaderId, dayDate: dayDates[dayIndex], todayRange: todayRange })); | ||
daySegs = internal.sortEventSegs(daySegs, options.eventOrder); | ||
innerNodes.push(createElement(ListViewHeaderRow, { key: dayStr, cellId: dateHeaderId, dayDate: dayDates[dayIndex], todayRange: todayRange })); | ||
daySegs = sortEventSegs(daySegs, options.eventOrder); | ||
for (let seg of daySegs) { | ||
innerNodes.push(preact.createElement(ListViewEventRow, Object.assign({ key: dayStr + ':' + seg.eventRange.instance.instanceId /* are multiple segs for an instanceId */, seg: seg, isDragging: false, isResizing: false, isDateSelecting: false, isSelected: false, timeHeaderId: timeHeaderId, eventHeaderId: eventHeaderId, dateHeaderId: dateHeaderId }, internal.getSegMeta(seg, todayRange, nowDate)))); | ||
innerNodes.push(createElement(ListViewEventRow, Object.assign({ key: dayStr + ':' + seg.eventRange.instance.instanceId /* are multiple segs for an instanceId */, seg: seg, isDragging: false, isResizing: false, isDateSelecting: false, isSelected: false, timeHeaderId: timeHeaderId, eventHeaderId: eventHeaderId, dateHeaderId: dateHeaderId }, getSegMeta(seg, todayRange, nowDate)))); | ||
} | ||
} | ||
} | ||
return (preact.createElement("table", { className: 'fc-list-table ' + theme.getClass('table') }, | ||
preact.createElement("thead", null, | ||
preact.createElement("tr", null, | ||
preact.createElement("th", { scope: "col", id: timeHeaderId }, options.timeHint), | ||
preact.createElement("th", { scope: "col", "aria-hidden": true }), | ||
preact.createElement("th", { scope: "col", id: eventHeaderId }, options.eventHint))), | ||
preact.createElement("tbody", null, innerNodes))); | ||
return (createElement("table", { className: 'fc-list-table ' + theme.getClass('table') }, | ||
createElement("thead", null, | ||
createElement("tr", null, | ||
createElement("th", { scope: "col", id: timeHeaderId }, options.timeHint), | ||
createElement("th", { scope: "col", "aria-hidden": true }), | ||
createElement("th", { scope: "col", id: eventHeaderId }, options.eventHint))), | ||
createElement("tbody", null, innerNodes))); | ||
})); | ||
} | ||
_eventStoreToSegs(eventStore, eventUiBases, dayRanges) { | ||
return this.eventRangesToSegs(internal.sliceEventStore(eventStore, eventUiBases, this.props.dateProfile.activeRange, this.context.options.nextDayThreshold).fg, dayRanges); | ||
return this.eventRangesToSegs(sliceEventStore(eventStore, eventUiBases, this.props.dateProfile.activeRange, this.context.options.nextDayThreshold).fg, dayRanges); | ||
} | ||
@@ -224,3 +220,3 @@ eventRangesToSegs(eventRanges, dayRanges) { | ||
for (dayIndex = 0; dayIndex < dayRanges.length; dayIndex += 1) { | ||
segRange = internal.intersectRanges(range, dayRanges[dayIndex]); | ||
segRange = intersectRanges(range, dayRanges[dayIndex]); | ||
if (segRange) { | ||
@@ -256,3 +252,3 @@ seg = { | ||
function computeDateVars(dateProfile) { | ||
let dayStart = internal.startOfDay(dateProfile.renderRange.start); | ||
let dayStart = startOfDay(dateProfile.renderRange.start); | ||
let viewEnd = dateProfile.renderRange.end; | ||
@@ -265,5 +261,5 @@ let dayDates = []; | ||
start: dayStart, | ||
end: internal.addDays(dayStart, 1), | ||
end: addDays(dayStart, 1), | ||
}); | ||
dayStart = internal.addDays(dayStart, 1); | ||
dayStart = addDays(dayStart, 1); | ||
} | ||
@@ -285,2 +281,2 @@ return { dayDates, dayRanges }; | ||
exports.ListView = ListView; | ||
export { ListView }; |
{ | ||
"name": "@fullcalendar/list", | ||
"version": "6.1.0", | ||
"version": "6.1.1", | ||
"title": "FullCalendar List View Plugin", | ||
@@ -15,3 +15,3 @@ "description": "Display events on a calendar view that looks like a bulleted list", | ||
"peerDependencies": { | ||
"@fullcalendar/core": "~6.1.0" | ||
"@fullcalendar/core": "~6.1.1" | ||
}, | ||
@@ -31,6 +31,6 @@ "type": "module", | ||
}, | ||
"copyright": "2022 Adam Shaw", | ||
"copyright": "2023 Adam Shaw", | ||
"types": "./index.d.ts", | ||
"main": "./index.js", | ||
"module": "./index.esm.js", | ||
"main": "./index.cjs", | ||
"module": "./index.js", | ||
"unpkg": "./index.global.min.js", | ||
@@ -40,11 +40,13 @@ "jsdelivr": "./index.global.min.js", | ||
"./package.json": "./package.json", | ||
"./index.cjs": "./index.cjs", | ||
".": { | ||
"types": "./index.d.ts", | ||
"require": "./index.js", | ||
"import": "./index.esm.js" | ||
"require": "./index.cjs", | ||
"import": "./index.js" | ||
}, | ||
"./internal.cjs": "./internal.cjs", | ||
"./internal": { | ||
"types": "./internal.d.ts", | ||
"require": "./internal.js", | ||
"import": "./internal.esm.js" | ||
"require": "./internal.cjs", | ||
"import": "./internal.js" | ||
} | ||
@@ -51,0 +53,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
68198