"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "packages/list/src/ListViewHeaderRow.tsx" between
fullcalendar-5.9.0.tar.gz and fullcalendar-5.10.0.tar.gz

About: FullCalendar is a full-sized drag & drop JavaScript event calendar.

ListViewHeaderRow.tsx  (fullcalendar-5.9.0):ListViewHeaderRow.tsx  (fullcalendar-5.10.0)
import { import {
BaseComponent, DateMarker, createElement, DateRange, getDateMeta, BaseComponent, DateMarker, createElement, DateRange, getDateMeta,
RenderHook, buildNavLinkData, DayHeaderContentArg, getDayClassNames, formatDay String, Fragment, RenderHook, DayHeaderContentArg, getDayClassNames, formatDayString, Fragment, buildNavLinkAttrs, getUniqueDomId,
} from '@fullcalendar/common' } from '@fullcalendar/common'
export interface ListViewHeaderRowProps { export interface ListViewHeaderRowProps {
cellId: string
dayDate: DateMarker dayDate: DateMarker
todayRange: DateRange todayRange: DateRange
} }
interface HookProps extends DayHeaderContentArg { // doesn't enforce much since DayCellContentArg allow extra props interface HookProps extends DayHeaderContentArg { // doesn't enforce much since DayCellContentArg allow extra props
textId: string // for aria-labelledby
text: string text: string
sideText: string sideText: string
} }
export class ListViewHeaderRow extends BaseComponent<ListViewHeaderRowProps> { export class ListViewHeaderRow extends BaseComponent<ListViewHeaderRowProps> {
state = {
textId: getUniqueDomId(),
}
render() { render() {
let { dayDate, todayRange } = this.props
let { theme, dateEnv, options, viewApi } = this.context let { theme, dateEnv, options, viewApi } = this.context
let { cellId, dayDate, todayRange } = this.props
let { textId } = this.state
let dayMeta = getDateMeta(dayDate, todayRange) let dayMeta = getDateMeta(dayDate, todayRange)
// will ever be falsy? // will ever be falsy?
let text = options.listDayFormat ? dateEnv.format(dayDate, options.listDayFo rmat) : '' let text = options.listDayFormat ? dateEnv.format(dayDate, options.listDayFo rmat) : ''
// will ever be falsy? also, BAD NAME "alt" // will ever be falsy? also, BAD NAME "alt"
let sideText = options.listDaySideFormat ? dateEnv.format(dayDate, options.l istDaySideFormat) : '' let sideText = options.listDaySideFormat ? dateEnv.format(dayDate, options.l istDaySideFormat) : ''
let navLinkData = options.navLinks
? buildNavLinkData(dayDate)
: null
let hookProps: HookProps = { let hookProps: HookProps = {
date: dateEnv.toDate(dayDate), date: dateEnv.toDate(dayDate),
view: viewApi, view: viewApi,
textId,
text, text,
sideText, sideText,
navLinkData, navLinkAttrs: buildNavLinkAttrs(this.context, dayDate),
sideNavLinkAttrs: buildNavLinkAttrs(this.context, dayDate, 'day', false),
...dayMeta, ...dayMeta,
} }
let classNames = ['fc-list-day'].concat( let classNames = ['fc-list-day'].concat(
getDayClassNames(dayMeta, theme), getDayClassNames(dayMeta, theme),
) )
// TODO: make a reusable HOC for dayHeader (used in daygrid/timegrid too) // TODO: make a reusable HOC for dayHeader (used in daygrid/timegrid too)
return ( return (
<RenderHook<HookProps> <RenderHook<HookProps>
skipping to change at line 61 skipping to change at line 66
defaultContent={renderInnerContent} defaultContent={renderInnerContent}
didMount={options.dayHeaderDidMount} didMount={options.dayHeaderDidMount}
willUnmount={options.dayHeaderWillUnmount} willUnmount={options.dayHeaderWillUnmount}
> >
{(rootElRef, customClassNames, innerElRef, innerContent) => ( {(rootElRef, customClassNames, innerElRef, innerContent) => (
<tr <tr
ref={rootElRef} ref={rootElRef}
className={classNames.concat(customClassNames).join(' ')} className={classNames.concat(customClassNames).join(' ')}
data-date={formatDayString(dayDate)} data-date={formatDayString(dayDate)}
> >
<th colSpan={3}> {/* TODO: force-hide top border based on :first-child */}
<th scope="colgroup" colSpan={3} id={cellId} aria-labelledby={textId
}>
<div className={'fc-list-day-cushion ' + theme.getClass('tableCell Shaded')} ref={innerElRef}> <div className={'fc-list-day-cushion ' + theme.getClass('tableCell Shaded')} ref={innerElRef}>
{innerContent} {innerContent}
</div> </div>
</th> </th>
</tr> </tr>
)} )}
</RenderHook> </RenderHook>
) )
} }
} }
function renderInnerContent(props: HookProps) { function renderInnerContent(props: HookProps) {
let navLinkAttrs = props.navLinkData // is there a type for this?
? { 'data-navlink': props.navLinkData, tabIndex: 0 }
: {}
return ( return (
<Fragment> <Fragment>
{props.text && ( {props.text && (
<a className="fc-list-day-text" {...navLinkAttrs}> <a id={props.textId} className="fc-list-day-text" {...props.navLinkAttrs }>
{props.text} {props.text}
</a> </a>
)} )}
{props.sideText && ( {props.sideText && (/* not keyboard tabbable */
<a className="fc-list-day-side-text" {...navLinkAttrs}> <a aria-hidden className="fc-list-day-side-text" {...props.sideNavLinkAt
trs}>
{props.sideText} {props.sideText}
</a> </a>
)} )}
</Fragment> </Fragment>
) )
} }
 End of changes. 13 change blocks. 
15 lines changed or deleted 19 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)