"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "packages/common/src/ToolbarSection.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.

ToolbarSection.tsx  (fullcalendar-5.9.0):ToolbarSection.tsx  (fullcalendar-5.10.0)
import { createElement, VNode } from './vdom' import { createElement, VNode } from './vdom'
import { BaseComponent } from './vdom-util' import { BaseComponent } from './vdom-util'
import { ToolbarWidget } from './toolbar-struct' import { ToolbarWidget } from './toolbar-struct'
export interface ToolbarContent { export interface ToolbarContent {
title: string title: string
titleId: string
navUnit: string
activeButton: string activeButton: string
isTodayEnabled: boolean isTodayEnabled: boolean
isPrevEnabled: boolean isPrevEnabled: boolean
isNextEnabled: boolean isNextEnabled: boolean
} }
export interface ToolbarSectionProps extends ToolbarContent { export interface ToolbarSectionProps extends ToolbarContent {
widgetGroups: ToolbarWidget[][] widgetGroups: ToolbarWidget[][]
} }
skipping to change at line 31 skipping to change at line 33
return createElement('div', { className: 'fc-toolbar-chunk' }, ...children) return createElement('div', { className: 'fc-toolbar-chunk' }, ...children)
} }
renderWidgetGroup(widgetGroup: ToolbarWidget[]) { renderWidgetGroup(widgetGroup: ToolbarWidget[]) {
let { props } = this let { props } = this
let { theme } = this.context let { theme } = this.context
let children: VNode[] = [] let children: VNode[] = []
let isOnlyButtons = true let isOnlyButtons = true
for (let widget of widgetGroup) { for (let widget of widgetGroup) {
let { buttonName, buttonClick, buttonText, buttonIcon } = widget let { buttonName, buttonClick, buttonText, buttonIcon, buttonHint } = widg et
if (buttonName === 'title') { if (buttonName === 'title') {
isOnlyButtons = false isOnlyButtons = false
children.push( children.push(
<h2 className="fc-toolbar-title">{props.title}</h2>, <h2 className="fc-toolbar-title" id={props.titleId}>{props.title}</h2> ,
) )
} else { } else {
let ariaAttrs = buttonIcon ? { 'aria-label': buttonName } : {} let isPressed = buttonName === props.activeButton
let buttonClasses = [`fc-${buttonName}-button`, theme.getClass('button')
]
if (buttonName === props.activeButton) {
buttonClasses.push(theme.getClass('buttonActive'))
}
let isDisabled = let isDisabled =
(!props.isTodayEnabled && buttonName === 'today') || (!props.isTodayEnabled && buttonName === 'today') ||
(!props.isPrevEnabled && buttonName === 'prev') || (!props.isPrevEnabled && buttonName === 'prev') ||
(!props.isNextEnabled && buttonName === 'next') (!props.isNextEnabled && buttonName === 'next')
let buttonClasses = [`fc-${buttonName}-button`, theme.getClass('button')
]
if (isPressed) {
buttonClasses.push(theme.getClass('buttonActive'))
}
children.push( children.push(
<button <button
type="button"
title={typeof buttonHint === 'function' ? buttonHint(props.navUnit)
: buttonHint}
disabled={isDisabled} disabled={isDisabled}
aria-pressed={isPressed}
className={buttonClasses.join(' ')} className={buttonClasses.join(' ')}
onClick={buttonClick} onClick={buttonClick}
type="button"
{...ariaAttrs}
> >
{buttonText || (buttonIcon ? <span className={buttonIcon} /> : '')} {buttonText || (buttonIcon ? <span className={buttonIcon} /> : '')}
</button>, </button>,
) )
} }
} }
if (children.length > 1) { if (children.length > 1) {
let groupClassName = (isOnlyButtons && theme.getClass('buttonGroup')) || ' ' let groupClassName = (isOnlyButtons && theme.getClass('buttonGroup')) || ' '
 End of changes. 8 change blocks. 
12 lines changed or deleted 15 lines changed or added

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