@fullcalendar/list
Advanced tools
Comparing version 4.3.0 to 4.4.0
@@ -13,3 +13,3 @@ // Generated by dts-bundle v0.7.3-fork.1 | ||
declare module '@fullcalendar/list/ListView' { | ||
import { View, ViewProps, ScrollComponent, DateMarker, DateRange, DateProfileGenerator, ComponentContext, ViewSpec, EventUiHash, EventRenderRange, EventStore, Seg } from '@fullcalendar/core'; | ||
import { View, ViewProps, ScrollComponent, DateMarker, DateRange, ComponentContext, EventUiHash, EventRenderRange, EventStore, Seg, ViewSpec } from '@fullcalendar/core'; | ||
export { ListView as default, ListView }; | ||
@@ -20,5 +20,8 @@ class ListView extends View { | ||
dayDates: DateMarker[]; | ||
constructor(context: ComponentContext, viewSpec: ViewSpec, dateProfileGenerator: DateProfileGenerator, parentEl: HTMLElement); | ||
render(props: ViewProps): void; | ||
constructor(viewSpec: ViewSpec, parentEl: HTMLElement); | ||
firstContext(context: ComponentContext): void; | ||
render(props: ViewProps, context: ComponentContext): void; | ||
destroy(): void; | ||
_renderSkeleton(context: ComponentContext): void; | ||
_unrenderSkeleton(): void; | ||
updateSize(isResize: any, viewHeight: any, isAuto: any): void; | ||
@@ -25,0 +28,0 @@ computeScrollerHeight(viewHeight: any): number; |
/*! | ||
FullCalendar List View Plugin v4.3.0 | ||
FullCalendar List View Plugin v4.4.0 | ||
Docs & License: https://fullcalendar.io/ | ||
@@ -41,3 +41,3 @@ (c) 2019 Adam Shaw | ||
function ListEventRenderer(listView) { | ||
var _this = _super.call(this, listView.context) || this; | ||
var _this = _super.call(this) || this; | ||
_this.listView = listView; | ||
@@ -58,3 +58,3 @@ return _this; | ||
ListEventRenderer.prototype.renderSegHtml = function (seg) { | ||
var _a = this.context, view = _a.view, theme = _a.theme; | ||
var _a = this.context, theme = _a.theme, options = _a.options; | ||
var eventRange = seg.eventRange; | ||
@@ -69,3 +69,3 @@ var eventDef = eventRange.def; | ||
if (eventDef.allDay) { | ||
timeHtml = getAllDayHtml(view); | ||
timeHtml = getAllDayHtml(options); | ||
} | ||
@@ -82,3 +82,3 @@ else if (isMultiDayRange(eventRange.range)) { | ||
else { // inner segment that lasts the whole day | ||
timeHtml = getAllDayHtml(view); | ||
timeHtml = getAllDayHtml(options); | ||
} | ||
@@ -129,37 +129,49 @@ } | ||
__extends(ListView, _super); | ||
function ListView(context, viewSpec, dateProfileGenerator, parentEl) { | ||
var _this = _super.call(this, context, viewSpec, dateProfileGenerator, parentEl) || this; | ||
function ListView(viewSpec, parentEl) { | ||
var _this = _super.call(this, viewSpec, parentEl) || this; | ||
_this.computeDateVars = memoize(computeDateVars); | ||
_this.eventStoreToSegs = memoize(_this._eventStoreToSegs); | ||
_this.renderSkeleton = memoizeRendering(_this._renderSkeleton, _this._unrenderSkeleton); | ||
var eventRenderer = _this.eventRenderer = new ListEventRenderer(_this); | ||
_this.renderContent = memoizeRendering(eventRenderer.renderSegs.bind(eventRenderer), eventRenderer.unrender.bind(eventRenderer)); | ||
_this.el.classList.add('fc-list-view'); | ||
var listViewClassNames = (_this.theme.getClass('listView') || '').split(' '); // wish we didn't have to do this | ||
_this.renderContent = memoizeRendering(eventRenderer.renderSegs.bind(eventRenderer), eventRenderer.unrender.bind(eventRenderer), [_this.renderSkeleton]); | ||
return _this; | ||
} | ||
ListView.prototype.firstContext = function (context) { | ||
context.calendar.registerInteractiveComponent(this, { | ||
el: this.el | ||
// TODO: make aware that it doesn't do Hits | ||
}); | ||
}; | ||
ListView.prototype.render = function (props, context) { | ||
_super.prototype.render.call(this, props, context); | ||
var _a = this.computeDateVars(props.dateProfile), dayDates = _a.dayDates, dayRanges = _a.dayRanges; | ||
this.dayDates = dayDates; | ||
this.renderSkeleton(context); | ||
this.renderContent(context, this.eventStoreToSegs(props.eventStore, props.eventUiBases, dayRanges)); | ||
}; | ||
ListView.prototype.destroy = function () { | ||
_super.prototype.destroy.call(this); | ||
this.renderSkeleton.unrender(); | ||
this.renderContent.unrender(); | ||
this.context.calendar.unregisterInteractiveComponent(this); | ||
}; | ||
ListView.prototype._renderSkeleton = function (context) { | ||
var theme = context.theme; | ||
this.el.classList.add('fc-list-view'); | ||
var listViewClassNames = (theme.getClass('listView') || '').split(' '); // wish we didn't have to do this | ||
for (var _i = 0, listViewClassNames_1 = listViewClassNames; _i < listViewClassNames_1.length; _i++) { | ||
var listViewClassName = listViewClassNames_1[_i]; | ||
if (listViewClassName) { // in case input was empty string | ||
_this.el.classList.add(listViewClassName); | ||
this.el.classList.add(listViewClassName); | ||
} | ||
} | ||
_this.scroller = new ScrollComponent('hidden', // overflow x | ||
this.scroller = new ScrollComponent('hidden', // overflow x | ||
'auto' // overflow y | ||
); | ||
_this.el.appendChild(_this.scroller.el); | ||
_this.contentEl = _this.scroller.el; // shortcut | ||
context.calendar.registerInteractiveComponent(_this, { | ||
el: _this.el | ||
// TODO: make aware that it doesn't do Hits | ||
}); | ||
return _this; | ||
} | ||
ListView.prototype.render = function (props) { | ||
var _a = this.computeDateVars(props.dateProfile), dayDates = _a.dayDates, dayRanges = _a.dayRanges; | ||
this.dayDates = dayDates; | ||
this.renderContent(this.eventStoreToSegs(props.eventStore, props.eventUiBases, dayRanges)); | ||
this.el.appendChild(this.scroller.el); | ||
this.contentEl = this.scroller.el; // shortcut | ||
}; | ||
ListView.prototype.destroy = function () { | ||
_super.prototype.destroy.call(this); | ||
this.renderContent.unrender(); | ||
ListView.prototype._unrenderSkeleton = function () { | ||
// TODO: remove classNames | ||
this.scroller.destroy(); // will remove the Grid too | ||
this.calendar.unregisterInteractiveComponent(this); | ||
}; | ||
@@ -180,3 +192,3 @@ ListView.prototype.updateSize = function (isResize, viewHeight, isAuto) { | ||
ListView.prototype._eventStoreToSegs = function (eventStore, eventUiBases, dayRanges) { | ||
return this.eventRangesToSegs(sliceEventStore(eventStore, eventUiBases, this.props.dateProfile.activeRange, this.nextDayThreshold).fg, dayRanges); | ||
return this.eventRangesToSegs(sliceEventStore(eventStore, eventUiBases, this.props.dateProfile.activeRange, this.context.nextDayThreshold).fg, dayRanges); | ||
}; | ||
@@ -192,3 +204,3 @@ ListView.prototype.eventRangesToSegs = function (eventRanges, dayRanges) { | ||
ListView.prototype.eventRangeToSegs = function (eventRange, dayRanges) { | ||
var _a = this, dateEnv = _a.dateEnv, nextDayThreshold = _a.nextDayThreshold; | ||
var _a = this.context, dateEnv = _a.dateEnv, nextDayThreshold = _a.nextDayThreshold; | ||
var range = eventRange.range; | ||
@@ -232,3 +244,3 @@ var allDay = eventRange.def.allDay; | ||
'<div class="fc-list-empty">' + | ||
htmlEscape(this.opt('noEventsMessage')) + | ||
htmlEscape(this.context.options.noEventsMessage) + | ||
'</div>' + | ||
@@ -240,2 +252,3 @@ '</div>' + | ||
ListView.prototype.renderSegList = function (allSegs) { | ||
var theme = this.context.theme; | ||
var segsByDay = this.groupSegsByDay(allSegs); // sparse array | ||
@@ -245,3 +258,3 @@ var dayIndex; | ||
var i; | ||
var tableEl = htmlToElement('<table class="fc-list-table ' + this.calendar.theme.getClass('tableList') + '"><tbody></tbody></table>'); | ||
var tableEl = htmlToElement('<table class="fc-list-table ' + theme.getClass('tableList') + '"><tbody></tbody></table>'); | ||
var tbodyEl = tableEl.querySelector('tbody'); | ||
@@ -276,16 +289,16 @@ for (dayIndex = 0; dayIndex < segsByDay.length; dayIndex++) { | ||
ListView.prototype.buildDayHeaderRow = function (dayDate) { | ||
var dateEnv = this.dateEnv; | ||
var mainFormat = createFormatter(this.opt('listDayFormat')); // TODO: cache | ||
var altFormat = createFormatter(this.opt('listDayAltFormat')); // TODO: cache | ||
var _a = this.context, theme = _a.theme, dateEnv = _a.dateEnv, options = _a.options; | ||
var mainFormat = createFormatter(options.listDayFormat); // TODO: cache | ||
var altFormat = createFormatter(options.listDayAltFormat); // TODO: cache | ||
return createElement('tr', { | ||
className: 'fc-list-heading', | ||
'data-date': dateEnv.formatIso(dayDate, { omitTime: true }) | ||
}, '<td class="' + (this.calendar.theme.getClass('tableListHeading') || | ||
this.calendar.theme.getClass('widgetHeader')) + '" colspan="3">' + | ||
}, '<td class="' + (theme.getClass('tableListHeading') || | ||
theme.getClass('widgetHeader')) + '" colspan="3">' + | ||
(mainFormat ? | ||
buildGotoAnchorHtml(this, dayDate, { 'class': 'fc-list-heading-main' }, htmlEscape(dateEnv.format(dayDate, mainFormat)) // inner HTML | ||
buildGotoAnchorHtml(options, dateEnv, dayDate, { 'class': 'fc-list-heading-main' }, htmlEscape(dateEnv.format(dayDate, mainFormat)) // inner HTML | ||
) : | ||
'') + | ||
(altFormat ? | ||
buildGotoAnchorHtml(this, dayDate, { 'class': 'fc-list-heading-alt' }, htmlEscape(dateEnv.format(dayDate, altFormat)) // inner HTML | ||
buildGotoAnchorHtml(options, dateEnv, dayDate, { 'class': 'fc-list-heading-alt' }, htmlEscape(dateEnv.format(dayDate, altFormat)) // inner HTML | ||
) : | ||
@@ -292,0 +305,0 @@ '') + |
91
main.js
/*! | ||
FullCalendar List View Plugin v4.3.0 | ||
FullCalendar List View Plugin v4.4.0 | ||
Docs & License: https://fullcalendar.io/ | ||
@@ -45,3 +45,3 @@ (c) 2019 Adam Shaw | ||
function ListEventRenderer(listView) { | ||
var _this = _super.call(this, listView.context) || this; | ||
var _this = _super.call(this) || this; | ||
_this.listView = listView; | ||
@@ -62,3 +62,3 @@ return _this; | ||
ListEventRenderer.prototype.renderSegHtml = function (seg) { | ||
var _a = this.context, view = _a.view, theme = _a.theme; | ||
var _a = this.context, theme = _a.theme, options = _a.options; | ||
var eventRange = seg.eventRange; | ||
@@ -73,3 +73,3 @@ var eventDef = eventRange.def; | ||
if (eventDef.allDay) { | ||
timeHtml = core.getAllDayHtml(view); | ||
timeHtml = core.getAllDayHtml(options); | ||
} | ||
@@ -86,3 +86,3 @@ else if (core.isMultiDayRange(eventRange.range)) { | ||
else { // inner segment that lasts the whole day | ||
timeHtml = core.getAllDayHtml(view); | ||
timeHtml = core.getAllDayHtml(options); | ||
} | ||
@@ -133,37 +133,49 @@ } | ||
__extends(ListView, _super); | ||
function ListView(context, viewSpec, dateProfileGenerator, parentEl) { | ||
var _this = _super.call(this, context, viewSpec, dateProfileGenerator, parentEl) || this; | ||
function ListView(viewSpec, parentEl) { | ||
var _this = _super.call(this, viewSpec, parentEl) || this; | ||
_this.computeDateVars = core.memoize(computeDateVars); | ||
_this.eventStoreToSegs = core.memoize(_this._eventStoreToSegs); | ||
_this.renderSkeleton = core.memoizeRendering(_this._renderSkeleton, _this._unrenderSkeleton); | ||
var eventRenderer = _this.eventRenderer = new ListEventRenderer(_this); | ||
_this.renderContent = core.memoizeRendering(eventRenderer.renderSegs.bind(eventRenderer), eventRenderer.unrender.bind(eventRenderer)); | ||
_this.el.classList.add('fc-list-view'); | ||
var listViewClassNames = (_this.theme.getClass('listView') || '').split(' '); // wish we didn't have to do this | ||
_this.renderContent = core.memoizeRendering(eventRenderer.renderSegs.bind(eventRenderer), eventRenderer.unrender.bind(eventRenderer), [_this.renderSkeleton]); | ||
return _this; | ||
} | ||
ListView.prototype.firstContext = function (context) { | ||
context.calendar.registerInteractiveComponent(this, { | ||
el: this.el | ||
// TODO: make aware that it doesn't do Hits | ||
}); | ||
}; | ||
ListView.prototype.render = function (props, context) { | ||
_super.prototype.render.call(this, props, context); | ||
var _a = this.computeDateVars(props.dateProfile), dayDates = _a.dayDates, dayRanges = _a.dayRanges; | ||
this.dayDates = dayDates; | ||
this.renderSkeleton(context); | ||
this.renderContent(context, this.eventStoreToSegs(props.eventStore, props.eventUiBases, dayRanges)); | ||
}; | ||
ListView.prototype.destroy = function () { | ||
_super.prototype.destroy.call(this); | ||
this.renderSkeleton.unrender(); | ||
this.renderContent.unrender(); | ||
this.context.calendar.unregisterInteractiveComponent(this); | ||
}; | ||
ListView.prototype._renderSkeleton = function (context) { | ||
var theme = context.theme; | ||
this.el.classList.add('fc-list-view'); | ||
var listViewClassNames = (theme.getClass('listView') || '').split(' '); // wish we didn't have to do this | ||
for (var _i = 0, listViewClassNames_1 = listViewClassNames; _i < listViewClassNames_1.length; _i++) { | ||
var listViewClassName = listViewClassNames_1[_i]; | ||
if (listViewClassName) { // in case input was empty string | ||
_this.el.classList.add(listViewClassName); | ||
this.el.classList.add(listViewClassName); | ||
} | ||
} | ||
_this.scroller = new core.ScrollComponent('hidden', // overflow x | ||
this.scroller = new core.ScrollComponent('hidden', // overflow x | ||
'auto' // overflow y | ||
); | ||
_this.el.appendChild(_this.scroller.el); | ||
_this.contentEl = _this.scroller.el; // shortcut | ||
context.calendar.registerInteractiveComponent(_this, { | ||
el: _this.el | ||
// TODO: make aware that it doesn't do Hits | ||
}); | ||
return _this; | ||
} | ||
ListView.prototype.render = function (props) { | ||
var _a = this.computeDateVars(props.dateProfile), dayDates = _a.dayDates, dayRanges = _a.dayRanges; | ||
this.dayDates = dayDates; | ||
this.renderContent(this.eventStoreToSegs(props.eventStore, props.eventUiBases, dayRanges)); | ||
this.el.appendChild(this.scroller.el); | ||
this.contentEl = this.scroller.el; // shortcut | ||
}; | ||
ListView.prototype.destroy = function () { | ||
_super.prototype.destroy.call(this); | ||
this.renderContent.unrender(); | ||
ListView.prototype._unrenderSkeleton = function () { | ||
// TODO: remove classNames | ||
this.scroller.destroy(); // will remove the Grid too | ||
this.calendar.unregisterInteractiveComponent(this); | ||
}; | ||
@@ -184,3 +196,3 @@ ListView.prototype.updateSize = function (isResize, viewHeight, isAuto) { | ||
ListView.prototype._eventStoreToSegs = function (eventStore, eventUiBases, dayRanges) { | ||
return this.eventRangesToSegs(core.sliceEventStore(eventStore, eventUiBases, this.props.dateProfile.activeRange, this.nextDayThreshold).fg, dayRanges); | ||
return this.eventRangesToSegs(core.sliceEventStore(eventStore, eventUiBases, this.props.dateProfile.activeRange, this.context.nextDayThreshold).fg, dayRanges); | ||
}; | ||
@@ -196,3 +208,3 @@ ListView.prototype.eventRangesToSegs = function (eventRanges, dayRanges) { | ||
ListView.prototype.eventRangeToSegs = function (eventRange, dayRanges) { | ||
var _a = this, dateEnv = _a.dateEnv, nextDayThreshold = _a.nextDayThreshold; | ||
var _a = this.context, dateEnv = _a.dateEnv, nextDayThreshold = _a.nextDayThreshold; | ||
var range = eventRange.range; | ||
@@ -236,3 +248,3 @@ var allDay = eventRange.def.allDay; | ||
'<div class="fc-list-empty">' + | ||
core.htmlEscape(this.opt('noEventsMessage')) + | ||
core.htmlEscape(this.context.options.noEventsMessage) + | ||
'</div>' + | ||
@@ -244,2 +256,3 @@ '</div>' + | ||
ListView.prototype.renderSegList = function (allSegs) { | ||
var theme = this.context.theme; | ||
var segsByDay = this.groupSegsByDay(allSegs); // sparse array | ||
@@ -249,3 +262,3 @@ var dayIndex; | ||
var i; | ||
var tableEl = core.htmlToElement('<table class="fc-list-table ' + this.calendar.theme.getClass('tableList') + '"><tbody></tbody></table>'); | ||
var tableEl = core.htmlToElement('<table class="fc-list-table ' + theme.getClass('tableList') + '"><tbody></tbody></table>'); | ||
var tbodyEl = tableEl.querySelector('tbody'); | ||
@@ -280,16 +293,16 @@ for (dayIndex = 0; dayIndex < segsByDay.length; dayIndex++) { | ||
ListView.prototype.buildDayHeaderRow = function (dayDate) { | ||
var dateEnv = this.dateEnv; | ||
var mainFormat = core.createFormatter(this.opt('listDayFormat')); // TODO: cache | ||
var altFormat = core.createFormatter(this.opt('listDayAltFormat')); // TODO: cache | ||
var _a = this.context, theme = _a.theme, dateEnv = _a.dateEnv, options = _a.options; | ||
var mainFormat = core.createFormatter(options.listDayFormat); // TODO: cache | ||
var altFormat = core.createFormatter(options.listDayAltFormat); // TODO: cache | ||
return core.createElement('tr', { | ||
className: 'fc-list-heading', | ||
'data-date': dateEnv.formatIso(dayDate, { omitTime: true }) | ||
}, '<td class="' + (this.calendar.theme.getClass('tableListHeading') || | ||
this.calendar.theme.getClass('widgetHeader')) + '" colspan="3">' + | ||
}, '<td class="' + (theme.getClass('tableListHeading') || | ||
theme.getClass('widgetHeader')) + '" colspan="3">' + | ||
(mainFormat ? | ||
core.buildGotoAnchorHtml(this, dayDate, { 'class': 'fc-list-heading-main' }, core.htmlEscape(dateEnv.format(dayDate, mainFormat)) // inner HTML | ||
core.buildGotoAnchorHtml(options, dateEnv, dayDate, { 'class': 'fc-list-heading-main' }, core.htmlEscape(dateEnv.format(dayDate, mainFormat)) // inner HTML | ||
) : | ||
'') + | ||
(altFormat ? | ||
core.buildGotoAnchorHtml(this, dayDate, { 'class': 'fc-list-heading-alt' }, core.htmlEscape(dateEnv.format(dayDate, altFormat)) // inner HTML | ||
core.buildGotoAnchorHtml(options, dateEnv, dayDate, { 'class': 'fc-list-heading-alt' }, core.htmlEscape(dateEnv.format(dayDate, altFormat)) // inner HTML | ||
) : | ||
@@ -296,0 +309,0 @@ '') + |
/*! | ||
FullCalendar List View Plugin v4.3.0 | ||
FullCalendar List View Plugin v4.4.0 | ||
Docs & License: https://fullcalendar.io/ | ||
(c) 2019 Adam Shaw | ||
*/ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@fullcalendar/core")):"function"==typeof define&&define.amd?define(["exports","@fullcalendar/core"],t):t((e=e||self).FullCalendarList={},e.FullCalendar)}(this,function(e,t){"use strict";var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function r(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var s=function(e){function n(t){var n=e.call(this,t.context)||this;return n.listView=t,n}return r(n,e),n.prototype.attachSegs=function(e){e.length?this.listView.renderSegList(e):this.listView.renderEmptyMessage()},n.prototype.detachSegs=function(){},n.prototype.renderSegHtml=function(e){var n,r=this.context,s=r.view,a=r.theme,i=e.eventRange,o=i.def,l=i.instance,d=i.ui,c=o.url,p=["fc-list-item"].concat(d.classNames),h=d.backgroundColor;return n=o.allDay?t.getAllDayHtml(s):t.isMultiDayRange(i.range)?e.isStart?t.htmlEscape(this._getTimeText(l.range.start,e.end,!1)):e.isEnd?t.htmlEscape(this._getTimeText(e.start,l.range.end,!1)):t.getAllDayHtml(s):t.htmlEscape(this.getTimeText(i)),c&&p.push("fc-has-url"),'<tr class="'+p.join(" ")+'">'+(this.displayEventTime?'<td class="fc-list-item-time '+a.getClass("widgetContent")+'">'+(n||"")+"</td>":"")+'<td class="fc-list-item-marker '+a.getClass("widgetContent")+'"><span class="fc-event-dot"'+(h?' style="background-color:'+h+'"':"")+'></span></td><td class="fc-list-item-title '+a.getClass("widgetContent")+'"><a'+(c?' href="'+t.htmlEscape(c)+'"':"")+">"+t.htmlEscape(o.title||"")+"</a></td></tr>"},n.prototype.computeEventTimeFormat=function(){return{hour:"numeric",minute:"2-digit",meridiem:"short"}},n}(t.FgEventRenderer),a=function(e){function n(n,r,a,o){var l=e.call(this,n,r,a,o)||this;l.computeDateVars=t.memoize(i),l.eventStoreToSegs=t.memoize(l._eventStoreToSegs);var d=l.eventRenderer=new s(l);l.renderContent=t.memoizeRendering(d.renderSegs.bind(d),d.unrender.bind(d)),l.el.classList.add("fc-list-view");for(var c=0,p=(l.theme.getClass("listView")||"").split(" ");c<p.length;c++){var h=p[c];h&&l.el.classList.add(h)}return l.scroller=new t.ScrollComponent("hidden","auto"),l.el.appendChild(l.scroller.el),l.contentEl=l.scroller.el,n.calendar.registerInteractiveComponent(l,{el:l.el}),l}return r(n,e),n.prototype.render=function(e){var t=this.computeDateVars(e.dateProfile),n=t.dayDates,r=t.dayRanges;this.dayDates=n,this.renderContent(this.eventStoreToSegs(e.eventStore,e.eventUiBases,r))},n.prototype.destroy=function(){e.prototype.destroy.call(this),this.renderContent.unrender(),this.scroller.destroy(),this.calendar.unregisterInteractiveComponent(this)},n.prototype.updateSize=function(t,n,r){e.prototype.updateSize.call(this,t,n,r),this.eventRenderer.computeSizes(t),this.eventRenderer.assignSizes(t),this.scroller.clear(),r||this.scroller.setHeight(this.computeScrollerHeight(n))},n.prototype.computeScrollerHeight=function(e){return e-t.subtractInnerElHeight(this.el,this.scroller.el)},n.prototype._eventStoreToSegs=function(e,n,r){return this.eventRangesToSegs(t.sliceEventStore(e,n,this.props.dateProfile.activeRange,this.nextDayThreshold).fg,r)},n.prototype.eventRangesToSegs=function(e,t){for(var n=[],r=0,s=e;r<s.length;r++){var a=s[r];n.push.apply(n,this.eventRangeToSegs(a,t))}return n},n.prototype.eventRangeToSegs=function(e,n){var r,s,a,i=this.dateEnv,o=this.nextDayThreshold,l=e.range,d=e.def.allDay,c=[];for(r=0;r<n.length;r++)if((s=t.intersectRanges(l,n[r]))&&(a={component:this,eventRange:e,start:s.start,end:s.end,isStart:e.isStart&&s.start.valueOf()===l.start.valueOf(),isEnd:e.isEnd&&s.end.valueOf()===l.end.valueOf(),dayIndex:r},c.push(a),!a.isEnd&&!d&&r+1<n.length&&l.end<i.add(n[r+1].start,o))){a.end=l.end,a.isEnd=!0;break}return c},n.prototype.renderEmptyMessage=function(){this.contentEl.innerHTML='<div class="fc-list-empty-wrap2"><div class="fc-list-empty-wrap1"><div class="fc-list-empty">'+t.htmlEscape(this.opt("noEventsMessage"))+"</div></div></div>"},n.prototype.renderSegList=function(e){var n,r,s,a=this.groupSegsByDay(e),i=t.htmlToElement('<table class="fc-list-table '+this.calendar.theme.getClass("tableList")+'"><tbody></tbody></table>'),o=i.querySelector("tbody");for(n=0;n<a.length;n++)if(r=a[n])for(o.appendChild(this.buildDayHeaderRow(this.dayDates[n])),r=this.eventRenderer.sortEventSegs(r),s=0;s<r.length;s++)o.appendChild(r[s].el);this.contentEl.innerHTML="",this.contentEl.appendChild(i)},n.prototype.groupSegsByDay=function(e){var t,n,r=[];for(t=0;t<e.length;t++)(r[(n=e[t]).dayIndex]||(r[n.dayIndex]=[])).push(n);return r},n.prototype.buildDayHeaderRow=function(e){var n=this.dateEnv,r=t.createFormatter(this.opt("listDayFormat")),s=t.createFormatter(this.opt("listDayAltFormat"));return t.createElement("tr",{className:"fc-list-heading","data-date":n.formatIso(e,{omitTime:!0})},'<td class="'+(this.calendar.theme.getClass("tableListHeading")||this.calendar.theme.getClass("widgetHeader"))+'" colspan="3">'+(r?t.buildGotoAnchorHtml(this,e,{class:"fc-list-heading-main"},t.htmlEscape(n.format(e,r))):"")+(s?t.buildGotoAnchorHtml(this,e,{class:"fc-list-heading-alt"},t.htmlEscape(n.format(e,s))):"")+"</td>")},n}(t.View);function i(e){for(var n=t.startOfDay(e.renderRange.start),r=e.renderRange.end,s=[],a=[];n<r;)s.push(n),a.push({start:n,end:t.addDays(n,1)}),n=t.addDays(n,1);return{dayDates:s,dayRanges:a}}a.prototype.fgSegSelector=".fc-list-item";var o=t.createPlugin({views:{list:{class:a,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"},listDayAltFormat:{month:"long",day:"numeric",year:"numeric"}},listMonth:{type:"list",duration:{month:1},listDayAltFormat:{weekday:"long"}},listYear:{type:"list",duration:{year:1},listDayAltFormat:{weekday:"long"}}}});e.ListView=a,e.default=o,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@fullcalendar/core")):"function"==typeof define&&define.amd?define(["exports","@fullcalendar/core"],t):t((e=e||self).FullCalendarList={},e.FullCalendar)}(this,function(e,t){"use strict";var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function r(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var s=function(e){function n(t){var n=e.call(this)||this;return n.listView=t,n}return r(n,e),n.prototype.attachSegs=function(e){e.length?this.listView.renderSegList(e):this.listView.renderEmptyMessage()},n.prototype.detachSegs=function(){},n.prototype.renderSegHtml=function(e){var n,r=this.context,s=r.theme,o=r.options,i=e.eventRange,a=i.def,l=i.instance,d=i.ui,c=a.url,p=["fc-list-item"].concat(d.classNames),h=d.backgroundColor;return n=a.allDay?t.getAllDayHtml(o):t.isMultiDayRange(i.range)?e.isStart?t.htmlEscape(this._getTimeText(l.range.start,e.end,!1)):e.isEnd?t.htmlEscape(this._getTimeText(e.start,l.range.end,!1)):t.getAllDayHtml(o):t.htmlEscape(this.getTimeText(i)),c&&p.push("fc-has-url"),'<tr class="'+p.join(" ")+'">'+(this.displayEventTime?'<td class="fc-list-item-time '+s.getClass("widgetContent")+'">'+(n||"")+"</td>":"")+'<td class="fc-list-item-marker '+s.getClass("widgetContent")+'"><span class="fc-event-dot"'+(h?' style="background-color:'+h+'"':"")+'></span></td><td class="fc-list-item-title '+s.getClass("widgetContent")+'"><a'+(c?' href="'+t.htmlEscape(c)+'"':"")+">"+t.htmlEscape(a.title||"")+"</a></td></tr>"},n.prototype.computeEventTimeFormat=function(){return{hour:"numeric",minute:"2-digit",meridiem:"short"}},n}(t.FgEventRenderer),o=function(e){function n(n,r){var o=e.call(this,n,r)||this;o.computeDateVars=t.memoize(i),o.eventStoreToSegs=t.memoize(o._eventStoreToSegs),o.renderSkeleton=t.memoizeRendering(o._renderSkeleton,o._unrenderSkeleton);var a=o.eventRenderer=new s(o);return o.renderContent=t.memoizeRendering(a.renderSegs.bind(a),a.unrender.bind(a),[o.renderSkeleton]),o}return r(n,e),n.prototype.firstContext=function(e){e.calendar.registerInteractiveComponent(this,{el:this.el})},n.prototype.render=function(t,n){e.prototype.render.call(this,t,n);var r=this.computeDateVars(t.dateProfile),s=r.dayDates,o=r.dayRanges;this.dayDates=s,this.renderSkeleton(n),this.renderContent(n,this.eventStoreToSegs(t.eventStore,t.eventUiBases,o))},n.prototype.destroy=function(){e.prototype.destroy.call(this),this.renderSkeleton.unrender(),this.renderContent.unrender(),this.context.calendar.unregisterInteractiveComponent(this)},n.prototype._renderSkeleton=function(e){var n=e.theme;this.el.classList.add("fc-list-view");for(var r=0,s=(n.getClass("listView")||"").split(" ");r<s.length;r++){var o=s[r];o&&this.el.classList.add(o)}this.scroller=new t.ScrollComponent("hidden","auto"),this.el.appendChild(this.scroller.el),this.contentEl=this.scroller.el},n.prototype._unrenderSkeleton=function(){this.scroller.destroy()},n.prototype.updateSize=function(t,n,r){e.prototype.updateSize.call(this,t,n,r),this.eventRenderer.computeSizes(t),this.eventRenderer.assignSizes(t),this.scroller.clear(),r||this.scroller.setHeight(this.computeScrollerHeight(n))},n.prototype.computeScrollerHeight=function(e){return e-t.subtractInnerElHeight(this.el,this.scroller.el)},n.prototype._eventStoreToSegs=function(e,n,r){return this.eventRangesToSegs(t.sliceEventStore(e,n,this.props.dateProfile.activeRange,this.context.nextDayThreshold).fg,r)},n.prototype.eventRangesToSegs=function(e,t){for(var n=[],r=0,s=e;r<s.length;r++){var o=s[r];n.push.apply(n,this.eventRangeToSegs(o,t))}return n},n.prototype.eventRangeToSegs=function(e,n){var r,s,o,i=this.context,a=i.dateEnv,l=i.nextDayThreshold,d=e.range,c=e.def.allDay,p=[];for(r=0;r<n.length;r++)if((s=t.intersectRanges(d,n[r]))&&(o={component:this,eventRange:e,start:s.start,end:s.end,isStart:e.isStart&&s.start.valueOf()===d.start.valueOf(),isEnd:e.isEnd&&s.end.valueOf()===d.end.valueOf(),dayIndex:r},p.push(o),!o.isEnd&&!c&&r+1<n.length&&d.end<a.add(n[r+1].start,l))){o.end=d.end,o.isEnd=!0;break}return p},n.prototype.renderEmptyMessage=function(){this.contentEl.innerHTML='<div class="fc-list-empty-wrap2"><div class="fc-list-empty-wrap1"><div class="fc-list-empty">'+t.htmlEscape(this.context.options.noEventsMessage)+"</div></div></div>"},n.prototype.renderSegList=function(e){var n,r,s,o=this.context.theme,i=this.groupSegsByDay(e),a=t.htmlToElement('<table class="fc-list-table '+o.getClass("tableList")+'"><tbody></tbody></table>'),l=a.querySelector("tbody");for(n=0;n<i.length;n++)if(r=i[n])for(l.appendChild(this.buildDayHeaderRow(this.dayDates[n])),r=this.eventRenderer.sortEventSegs(r),s=0;s<r.length;s++)l.appendChild(r[s].el);this.contentEl.innerHTML="",this.contentEl.appendChild(a)},n.prototype.groupSegsByDay=function(e){var t,n,r=[];for(t=0;t<e.length;t++)(r[(n=e[t]).dayIndex]||(r[n.dayIndex]=[])).push(n);return r},n.prototype.buildDayHeaderRow=function(e){var n=this.context,r=n.theme,s=n.dateEnv,o=n.options,i=t.createFormatter(o.listDayFormat),a=t.createFormatter(o.listDayAltFormat);return t.createElement("tr",{className:"fc-list-heading","data-date":s.formatIso(e,{omitTime:!0})},'<td class="'+(r.getClass("tableListHeading")||r.getClass("widgetHeader"))+'" colspan="3">'+(i?t.buildGotoAnchorHtml(o,s,e,{class:"fc-list-heading-main"},t.htmlEscape(s.format(e,i))):"")+(a?t.buildGotoAnchorHtml(o,s,e,{class:"fc-list-heading-alt"},t.htmlEscape(s.format(e,a))):"")+"</td>")},n}(t.View);function i(e){for(var n=t.startOfDay(e.renderRange.start),r=e.renderRange.end,s=[],o=[];n<r;)s.push(n),o.push({start:n,end:t.addDays(n,1)}),n=t.addDays(n,1);return{dayDates:s,dayRanges:o}}o.prototype.fgSegSelector=".fc-list-item";var a=t.createPlugin({views:{list:{class:o,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"},listDayAltFormat:{month:"long",day:"numeric",year:"numeric"}},listMonth:{type:"list",duration:{month:1},listDayAltFormat:{weekday:"long"}},listYear:{type:"list",duration:{year:1},listDayAltFormat:{weekday:"long"}}}});e.ListView=o,e.default=a,Object.defineProperty(e,"__esModule",{value:!0})}); |
{ | ||
"name": "@fullcalendar/list", | ||
"version": "4.3.0", | ||
"version": "4.4.0", | ||
"title": "FullCalendar List View Plugin", | ||
@@ -27,3 +27,3 @@ "description": "View your events as a bulleted list", | ||
"peerDependencies": { | ||
"@fullcalendar/core": "~4.3.0" | ||
"@fullcalendar/core": "~4.4.0" | ||
}, | ||
@@ -30,0 +30,0 @@ "main": "main.js", |
Sorry, the diff of this file is not supported yet
71948
10
817