@fullcalendar/list
Advanced tools
Comparing version 6.0.2 to 6.0.3
/*! | ||
FullCalendar List View Plugin v6.0.2 | ||
FullCalendar List View Plugin v6.0.3 | ||
Docs & License: https://fullcalendar.io/docs/list-view | ||
@@ -4,0 +4,0 @@ (c) 2022 Adam Shaw |
/*! | ||
FullCalendar List View Plugin v6.0.2 | ||
FullCalendar List View Plugin v6.0.3 | ||
Docs & License: https://fullcalendar.io/docs/list-view | ||
@@ -4,0 +4,0 @@ (c) 2022 Adam Shaw |
30
index.js
@@ -1,23 +0,27 @@ | ||
import { createPlugin } from '@fullcalendar/core/index.js'; | ||
import { ListView } from './internal.js'; | ||
import { identity, createFormatter, injectStyles } from '@fullcalendar/core/internal.js'; | ||
import '@fullcalendar/core/preact.js'; | ||
'use strict'; | ||
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: identity, | ||
noEventsContent: identity, | ||
noEventsDidMount: identity, | ||
noEventsWillUnmount: identity, | ||
noEventsClassNames: internal.identity, | ||
noEventsContent: internal.identity, | ||
noEventsDidMount: internal.identity, | ||
noEventsWillUnmount: internal.identity, | ||
// noEventsText is defined in base options | ||
}; | ||
function createFalsableFormatter(input) { | ||
return input === false ? null : createFormatter(input); | ||
return input === false ? null : internal.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}"; | ||
injectStyles(css_248z); | ||
internal.injectStyles(css_248z); | ||
var index = createPlugin({ | ||
var index = core.createPlugin({ | ||
name: '@fullcalendar/list', | ||
@@ -27,3 +31,3 @@ optionRefiners: OPTION_REFINERS, | ||
list: { | ||
component: ListView, | ||
component: internalCommon.ListView, | ||
buttonTextKey: 'list', | ||
@@ -56,2 +60,2 @@ listDayFormat: { month: 'long', day: 'numeric', year: 'numeric' }, // like "January 1, 2016" | ||
export { index as default }; | ||
exports["default"] = index; |
116
internal.js
@@ -1,9 +0,13 @@ | ||
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.js'; | ||
import { createElement, Fragment } from '@fullcalendar/core/preact.js'; | ||
'use strict'; | ||
class ListViewHeaderRow extends BaseComponent { | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
var internal = require('@fullcalendar/core/internal'); | ||
var preact = require('@fullcalendar/core/preact'); | ||
class ListViewHeaderRow extends internal.BaseComponent { | ||
constructor() { | ||
super(...arguments); | ||
this.state = { | ||
textId: getUniqueDomId(), | ||
textId: internal.getUniqueDomId(), | ||
}; | ||
@@ -15,3 +19,3 @@ } | ||
let { textId } = this.state; | ||
let dayMeta = getDateMeta(dayDate, todayRange); | ||
let dayMeta = internal.getDateMeta(dayDate, todayRange); | ||
// will ever be falsy? | ||
@@ -23,12 +27,12 @@ let text = options.listDayFormat ? dateEnv.format(dayDate, options.listDayFormat) : ''; | ||
text, | ||
sideText, navLinkAttrs: buildNavLinkAttrs(this.context, dayDate), sideNavLinkAttrs: buildNavLinkAttrs(this.context, dayDate, 'day', false) }, dayMeta); | ||
sideText, navLinkAttrs: internal.buildNavLinkAttrs(this.context, dayDate), sideNavLinkAttrs: internal.buildNavLinkAttrs(this.context, dayDate, 'day', false) }, dayMeta); | ||
// TODO: make a reusable HOC for dayHeader (used in daygrid/timegrid too) | ||
return (createElement(ContentContainer, { elTag: "tr", elClasses: [ | ||
return (preact.createElement(internal.ContentContainer, { elTag: "tr", elClasses: [ | ||
'fc-list-day', | ||
...getDayClassNames(dayMeta, theme), | ||
...internal.getDayClassNames(dayMeta, theme), | ||
], elAttrs: { | ||
'data-date': formatDayString(dayDate), | ||
'data-date': internal.formatDayString(dayDate), | ||
}, renderProps: renderProps, generatorName: "dayHeaderContent", generator: options.dayHeaderContent || renderInnerContent, classNameGenerator: options.dayHeaderClassNames, didMount: options.dayHeaderDidMount, willUnmount: options.dayHeaderWillUnmount }, (InnerContent) => ( // TODO: force-hide top border based on :first-child | ||
createElement("th", { scope: "colgroup", colSpan: 3, id: cellId, "aria-labelledby": textId }, | ||
createElement(InnerContent, { elTag: "div", elClasses: [ | ||
preact.createElement("th", { scope: "colgroup", colSpan: 3, id: cellId, "aria-labelledby": textId }, | ||
preact.createElement(InnerContent, { elTag: "div", elClasses: [ | ||
'fc-list-day-cushion', | ||
@@ -40,8 +44,8 @@ theme.getClass('tableCellShaded'), | ||
function renderInnerContent(props) { | ||
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)))); | ||
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)))); | ||
} | ||
const DEFAULT_TIME_FORMAT = createFormatter({ | ||
const DEFAULT_TIME_FORMAT = internal.createFormatter({ | ||
hour: 'numeric', | ||
@@ -51,3 +55,3 @@ minute: '2-digit', | ||
}); | ||
class ListViewEventRow extends BaseComponent { | ||
class ListViewEventRow extends internal.BaseComponent { | ||
render() { | ||
@@ -58,17 +62,17 @@ let { props, context } = this; | ||
let timeFormat = options.eventTimeFormat || DEFAULT_TIME_FORMAT; | ||
return (createElement(EventContainer, Object.assign({}, props, { elTag: "tr", elClasses: [ | ||
return (preact.createElement(internal.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) => (createElement(Fragment, null, | ||
], defaultGenerator: () => renderEventInnerContent(seg, context) /* weird */, seg: seg, timeText: "", disableDragging: true, disableResizing: true }), (InnerContent, eventContentArg) => (preact.createElement(preact.Fragment, null, | ||
buildTimeContent(seg, timeFormat, context, timeHeaderId, dateHeaderId), | ||
createElement("td", { "aria-hidden": true, className: "fc-list-event-graphic" }, | ||
createElement("span", { className: "fc-list-event-dot", style: { | ||
preact.createElement("td", { "aria-hidden": true, className: "fc-list-event-graphic" }, | ||
preact.createElement("span", { className: "fc-list-event-dot", style: { | ||
borderColor: eventContentArg.borderColor || eventContentArg.backgroundColor, | ||
} })), | ||
createElement(InnerContent, { elTag: "td", elClasses: ['fc-list-event-title'], elAttrs: { headers: `${eventHeaderId} ${dateHeaderId}` } }))))); | ||
preact.createElement(InnerContent, { elTag: "td", elClasses: ['fc-list-event-title'], elAttrs: { headers: `${eventHeaderId} ${dateHeaderId}` } }))))); | ||
} | ||
} | ||
function renderEventInnerContent(seg, context) { | ||
let interactiveAttrs = getSegAnchorAttrs(seg, context); | ||
return (createElement("a", Object.assign({}, interactiveAttrs), seg.eventRange.def.title)); | ||
let interactiveAttrs = internal.getSegAnchorAttrs(seg, context); | ||
return (preact.createElement("a", Object.assign({}, interactiveAttrs), seg.eventRange.def.title)); | ||
} | ||
@@ -85,8 +89,8 @@ function buildTimeContent(seg, timeFormat, context, timeHeaderId, dateHeaderId) { | ||
} | ||
else if (isMultiDayRange(seg.eventRange.range)) { // TODO: use (!isStart || !isEnd) instead? | ||
else if (internal.isMultiDayRange(seg.eventRange.range)) { // TODO: use (!isStart || !isEnd) instead? | ||
if (seg.isStart) { | ||
timeText = buildSegTimeText(seg, timeFormat, context, null, null, eventInstance.range.start, seg.end); | ||
timeText = internal.buildSegTimeText(seg, timeFormat, context, null, null, eventInstance.range.start, seg.end); | ||
} | ||
else if (seg.isEnd) { | ||
timeText = buildSegTimeText(seg, timeFormat, context, null, null, seg.start, eventInstance.range.end); | ||
timeText = internal.buildSegTimeText(seg, timeFormat, context, null, null, seg.start, eventInstance.range.end); | ||
} | ||
@@ -98,3 +102,3 @@ else { | ||
else { | ||
timeText = buildSegTimeText(seg, timeFormat, context); | ||
timeText = internal.buildSegTimeText(seg, timeFormat, context); | ||
} | ||
@@ -106,7 +110,7 @@ if (doAllDay) { | ||
}; | ||
return (createElement(ContentContainer, { elTag: "td", elClasses: ['fc-list-event-time'], elAttrs: { | ||
return (preact.createElement(internal.ContentContainer, { elTag: "td", elClasses: ['fc-list-event-time'], elAttrs: { | ||
headers: `${timeHeaderId} ${dateHeaderId}`, | ||
}, renderProps: renderProps, generatorName: "allDayContent", generator: options.allDayContent || renderAllDayInner, classNameGenerator: options.allDayClassNames, didMount: options.allDayDidMount, willUnmount: options.allDayWillUnmount })); | ||
} | ||
return (createElement("td", { className: "fc-list-event-time" }, timeText)); | ||
return (preact.createElement("td", { className: "fc-list-event-time" }, timeText)); | ||
} | ||
@@ -122,11 +126,11 @@ return null; | ||
*/ | ||
class ListView extends DateComponent { | ||
class ListView extends internal.DateComponent { | ||
constructor() { | ||
super(...arguments); | ||
this.computeDateVars = memoize(computeDateVars); | ||
this.eventStoreToSegs = memoize(this._eventStoreToSegs); | ||
this.computeDateVars = internal.memoize(computeDateVars); | ||
this.eventStoreToSegs = internal.memoize(this._eventStoreToSegs); | ||
this.state = { | ||
timeHeaderId: getUniqueDomId(), | ||
eventHeaderId: getUniqueDomId(), | ||
dateHeaderIdRoot: getUniqueDomId(), | ||
timeHeaderId: internal.getUniqueDomId(), | ||
eventHeaderId: internal.getUniqueDomId(), | ||
dateHeaderIdRoot: internal.getUniqueDomId(), | ||
}; | ||
@@ -148,3 +152,3 @@ this.setRootEl = (rootEl) => { | ||
let eventSegs = this.eventStoreToSegs(props.eventStore, props.eventUiBases, dayRanges); | ||
return (createElement(ViewContainer, { elRef: this.setRootEl, elClasses: [ | ||
return (preact.createElement(internal.ViewContainer, { elRef: this.setRootEl, elClasses: [ | ||
'fc-list', | ||
@@ -156,3 +160,3 @@ context.theme.getClass('table'), | ||
], viewSpec: context.viewSpec }, | ||
createElement(Scroller, { liquid: !props.isHeightAuto, overflowX: props.isHeightAuto ? 'visible' : 'hidden', overflowY: props.isHeightAuto ? 'visible' : 'auto' }, eventSegs.length > 0 ? | ||
preact.createElement(internal.Scroller, { liquid: !props.isHeightAuto, overflowX: props.isHeightAuto ? 'visible' : 'hidden', overflowY: props.isHeightAuto ? 'visible' : 'auto' }, eventSegs.length > 0 ? | ||
this.renderSegList(eventSegs, dayDates) : | ||
@@ -167,3 +171,3 @@ this.renderEmptyMessage()))); | ||
}; | ||
return (createElement(ContentContainer, { elTag: "div", elClasses: ['fc-list-empty'], renderProps: renderProps, generatorName: "noEventsContent", generator: options.noEventsContent || renderNoEventsInner, classNameGenerator: options.noEventsClassNames, didMount: options.noEventsDidMount, willUnmount: options.noEventsWillUnmount }, (InnerContent) => (createElement(InnerContent, { elTag: "div", elClasses: ['fc-list-empty-cushion'] })))); | ||
return (preact.createElement(internal.ContentContainer, { elTag: "div", elClasses: ['fc-list-empty'], renderProps: renderProps, generatorName: "noEventsContent", generator: options.noEventsContent || renderNoEventsInner, classNameGenerator: options.noEventsClassNames, didMount: options.noEventsDidMount, willUnmount: options.noEventsWillUnmount }, (InnerContent) => (preact.createElement(InnerContent, { elTag: "div", elClasses: ['fc-list-empty-cushion'] })))); | ||
} | ||
@@ -174,3 +178,3 @@ renderSegList(allSegs, dayDates) { | ||
let segsByDay = groupSegsByDay(allSegs); // sparse array | ||
return (createElement(NowTimer, { unit: "day" }, (nowDate, todayRange) => { | ||
return (preact.createElement(internal.NowTimer, { unit: "day" }, (nowDate, todayRange) => { | ||
let innerNodes = []; | ||
@@ -180,23 +184,23 @@ for (let dayIndex = 0; dayIndex < segsByDay.length; dayIndex += 1) { | ||
if (daySegs) { // sparse array, so might be undefined | ||
let dayStr = formatDayString(dayDates[dayIndex]); | ||
let dayStr = internal.formatDayString(dayDates[dayIndex]); | ||
let dateHeaderId = dateHeaderIdRoot + '-' + dayStr; | ||
// append a day header | ||
innerNodes.push(createElement(ListViewHeaderRow, { key: dayStr, cellId: dateHeaderId, dayDate: dayDates[dayIndex], todayRange: todayRange })); | ||
daySegs = sortEventSegs(daySegs, options.eventOrder); | ||
innerNodes.push(preact.createElement(ListViewHeaderRow, { key: dayStr, cellId: dateHeaderId, dayDate: dayDates[dayIndex], todayRange: todayRange })); | ||
daySegs = internal.sortEventSegs(daySegs, options.eventOrder); | ||
for (let seg of daySegs) { | ||
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)))); | ||
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)))); | ||
} | ||
} | ||
} | ||
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))); | ||
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))); | ||
})); | ||
} | ||
_eventStoreToSegs(eventStore, eventUiBases, dayRanges) { | ||
return this.eventRangesToSegs(sliceEventStore(eventStore, eventUiBases, this.props.dateProfile.activeRange, this.context.options.nextDayThreshold).fg, dayRanges); | ||
return this.eventRangesToSegs(internal.sliceEventStore(eventStore, eventUiBases, this.props.dateProfile.activeRange, this.context.options.nextDayThreshold).fg, dayRanges); | ||
} | ||
@@ -220,3 +224,3 @@ eventRangesToSegs(eventRanges, dayRanges) { | ||
for (dayIndex = 0; dayIndex < dayRanges.length; dayIndex += 1) { | ||
segRange = intersectRanges(range, dayRanges[dayIndex]); | ||
segRange = internal.intersectRanges(range, dayRanges[dayIndex]); | ||
if (segRange) { | ||
@@ -252,3 +256,3 @@ seg = { | ||
function computeDateVars(dateProfile) { | ||
let dayStart = startOfDay(dateProfile.renderRange.start); | ||
let dayStart = internal.startOfDay(dateProfile.renderRange.start); | ||
let viewEnd = dateProfile.renderRange.end; | ||
@@ -261,5 +265,5 @@ let dayDates = []; | ||
start: dayStart, | ||
end: addDays(dayStart, 1), | ||
end: internal.addDays(dayStart, 1), | ||
}); | ||
dayStart = addDays(dayStart, 1); | ||
dayStart = internal.addDays(dayStart, 1); | ||
} | ||
@@ -281,2 +285,2 @@ return { dayDates, dayRanges }; | ||
export { ListView }; | ||
exports.ListView = ListView; |
{ | ||
"name": "@fullcalendar/list", | ||
"version": "6.0.2", | ||
"version": "6.0.3", | ||
"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.0.2" | ||
"@fullcalendar/core": "~6.0.3" | ||
}, | ||
@@ -32,5 +32,5 @@ "type": "module", | ||
"copyright": "2022 Adam Shaw", | ||
"main": "./index.cjs", | ||
"module": "./index.js", | ||
"types": "./index.d.ts", | ||
"main": "./index.js", | ||
"module": "./index.esm.js", | ||
"unpkg": "./index.global.min.js", | ||
@@ -40,15 +40,11 @@ "jsdelivr": "./index.global.min.js", | ||
"./package.json": "./package.json", | ||
"./index.cjs": "./index.cjs", | ||
"./index.js": "./index.js", | ||
".": { | ||
"types": "./index.d.ts", | ||
"require": "./index.cjs", | ||
"import": "./index.js" | ||
"require": "./index.js", | ||
"import": "./index.esm.js" | ||
}, | ||
"./internal.cjs": "./internal.cjs", | ||
"./internal.js": "./internal.js", | ||
"./internal": { | ||
"types": "./internal.d.ts", | ||
"require": "./internal.cjs", | ||
"import": "./internal.js" | ||
"require": "./internal.js", | ||
"import": "./internal.esm.js" | ||
} | ||
@@ -55,0 +51,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
67540
12