YearView

This is normally used as a mode of a Calendar (as seen in the live demo below) but may be used standalone as a regular Widget.

Calendar year view
//<code-header>
fiddle.title = 'Calendar year view';
//</code-header>
const calendar = new Calendar({
    appendTo : targetElement,
    height   : 500,
    date     : new Date(2021, 0, 1),
    modes    : {
        day    : null,
        week   : null,
        month  : null,
        year   : true,
        agenda : null
    },
    events : [
        { startDate : '2021-01-02T07:00', duration : 5, durationUnit : 'h', name : 'Walk the dog', eventColor : 'yellow' },
        { startDate : '2021-02-03T09:00', duration : 2, durationUnit : 'h', name : 'Buy masks', eventColor : 'orange' },
        { startDate : '2021-03-04T07:00', duration : 1, durationUnit : 'h', name : 'Zoom meeting', eventColor : 'deep-orange' },
        { startDate : '2021-04-05T09:00', duration : 1, durationUnit : 'h', name : 'Get a haircut', eventColor : 'gray' }
    ]
});

As a standalone widget, it will lack the capabilities of the Calendar class, such as keyboard-based event to event navigation and drag/drop features. As seen in this demo:

Year view
//<code-header>
fiddle.title = 'Year view';
//</code-header>
new YearView({
    appendTo  : targetElement,
    height    : 500,
    startDate : new Date(2021, 0, 1),
    events    : [
        { startDate : '2021-01-02T07:00', duration : 5, durationUnit : 'h', name : 'Walk the dog', eventColor : 'yellow' },
        { startDate : '2021-02-03T09:00', duration : 2, durationUnit : 'h', name : 'Buy masks', eventColor : 'orange' },
        { startDate : '2021-03-04T07:00', duration : 1, durationUnit : 'h', name : 'Zoom meeting', eventColor : 'deep-orange' },
        { startDate : '2021-04-05T09:00', duration : 1, durationUnit : 'h', name : 'Get a haircut', eventColor : 'gray' }
    ]
});

A Panel which displays a year's worth of months with days which have events highlighted.

Configs

157

Common

listenersEvents

Other

date: Date

A date which specifies the year to display. All types of calendar view have a date config which they use to set their visible date range according to their configuration and type.

eventCountTip: Boolean | Object<String, (Boolean|String)>Also a property

When overflowPopupTrigger is not a mouseover gesture, setting this to a truthy value means that a tooltip containing the event count will be shown on hover of a day cell.

It may be specified as an Object which contains Tooltip config options, and also the following option:

  • showNoEvents - When set to true, a tooltip containing "No events" is shown when hovering empty day cells.

For example:

{
    modes : {
        year : {
            // We want it to show if there are no visible events for that date.
            // And we want the tip showing to the right of the cell
            eventCountTip : {
                showNoEvents : true,
                align        : 'l-r
            }
        }
    }
}

When showEvents is 'dots', this controls the layout of the dots below the day number.

If the max property is 1, the dots will be coloured using the default event colour, not the colour of the event. This is to create a consistent appearance.

ParameterTypeDescription
marginTopNumber

The margin above the dots. Default is 4.

maxNumber

The maximum number of dots to show. Default is 4.

gapNumber

The gap between dots. Default is 3.

sizeNumber

The size of the dots. Default is 5.

stripeBoolean

If true, the dots will be striped, meaning they will be joined together with no gap between them and rounded at each end. Default is false.

showEvents: Boolean | heatmap | dots= heatmapAlso a property

How to indicate the presence of events for a date. The default is heatmap which adds classes depending on how many events intersect the date.Values may be:

  • false - Do not show events in cells.
  • true - Show a heatmap of colours the intensity of which indicates event load.
  • 'heatmap' - Show a heatmap of colours the intensity of which indicates event load.
  • 'count' - Show a themeable badge containing the event count for a date.
  • 'dots' - Show small event-coloured bullets up to a maximum of eventDots.max to indicate event presence. to indicate event presence.
sixWeeks: Boolean

By default, all months show six week rows. Pass false to only render as many rows as needed.

year: Number

The year to display

activationKeyCalendarMixin
allowDragCreateCalendarMixin
allowDragMoveCalendarMixin
allowDragResizeCalendarMixin
animateTimeShiftCalendarMixin
autoCreateCalendarMixin
columnWidget
dayCellNameFormatDayCellRenderer
defaultFocusContainer
descriptionRendererCalendarMixin
dragUnitCalendarMixin
drawerPanel
emptyCellRendererDayCellRenderer
eventFilterDayCellCollecter
eventHeightCalendarMixin
eventSorterCalendarMixin
eventSpacingDayCellRenderer
extendAllDayEndDayCalendarMixin
hideNonWorkingDaysCalendarMixin
labelPositionContainer
maxDateCalendarMixin
minDateCalendarMixin
nonWorkingDaysCalendarMixin
overflowButtonRendererDayCellRenderer
overflowPopupDayCellRenderer
overflowPopupTriggerDayCellRenderer
pastEventClsCalendarMixin
renditionContainer
resourceImagePathCalendarMixin
responsiveResponsive
responsiveRootResponsive
responsiveStateResponsive
rtlRTL
selectorButtonCalendarMixin
selectorMenuItemCalendarMixin
shortDateFormatCalendarMixin
shortDateTimeFormatCalendarMixin
shortEventClsCalendarMixin
shortEventDurationCalendarMixin
showBulletCalendarMixin
showResourceAvatarsCalendarMixin
spanWidget
stackMultiDayEventsDayCellCollecter
syncCalendarDateCalendarMixin
syncViewDateCalendarMixin
timeFormatCalendarMixin
weekStartDayCalendarMixin

Rendering

dayCellRenderer: function

An empty function by default, but provided so that you can override it.

This function is called for each cell rendered to allow developers to mutate the cell metadata, or the CSS classes to be applied to the cell.

The cellConfig (a DomConfig) definition passed as part of the single parameter may be mutated to add style and className.

dayCellRenderer : function(cellData) {
    // I don't like Mondays!
    if (cellData.date === 1) {
        cellData.cls['dayoff'] = true;
    }
}

A non-null return value from the renderer is used as the content of the day cell element.

ParameterTypeDescription
cellDataYearCell

A DayCell object that contains data about the cell.

Returns: DomConfig | String | null

Accessibility

ariaLabelWidget
keyMapKeyMap

Content

bbarPanel
defaultsContainer
footerPanel
headerPanel
itemsContainer
lazyItemsContainer
namedItemsContainer
stripsPanel
tbarPanel
textContentContainer
toolsPanel

CSS

bodyClsPanel
borderContainer
clsWidget
colorWidget
htmlClsWidget
itemClsContainer
styleWidget
uiPanel

DOM

adoptWidget
appendToWidget
contentWidget
datasetWidget
htmlWidget
idWidget
tagWidget

Float & align

alignWidget
anchorWidget
centeredWidget
draggableWidget
floatingWidget
xWidget
yWidget

Layout

alignSelfWidget
dockWidget
flexWidget
heightWidget
hiddenWidget
hideWhenEmptyContainer
layoutContainer
layoutStyleContainer
marginWidget
maxHeightWidget
maxWidthWidget
minHeightWidget
minWidthWidget
textAlignWidget
weightWidget
widthWidget

misc

tabBarItemsContainer

Misc

dataFieldWidget
disabledWidget
iconPanel
localeClassLocalizable
localizableLocalizable
maskedWidget
ownerWidget
readOnlyWidget
refWidget
rippleWidget
tabWidget
titlePanel
tooltipWidget

Record

recordContainer

Scrolling

State

stateIdState

Properties

134

Class hierarchy

isYearView: Boolean= truereadonly
Identifies an object as an instance of YearView class, or subclass thereof.
isYearView: Boolean= truereadonlystatic
Identifies an object as an instance of YearView class, or subclass thereof.
isCalendarMixinCalendarMixin
isContainerContainer
isDayCellCollecterDayCellCollecter
isDayCellRendererDayCellRenderer
isDelayableDelayable
isEventsEvents
isKeyMapKeyMap
isLocalizableLocalizable
isPanelPanel
isResponsiveResponsive
isStateState
isToolableToolable
isWidgetWidget

Other

eventCountTip: Boolean | Object<String, (Boolean|String)>Also a config

When overflowPopupTrigger is not a mouseover gesture, setting this to a truthy value means that a tooltip containing the event count will be shown on hover of a day cell.

It may be specified as an Object which contains Tooltip config options, and also the following option:

  • showNoEvents - When set to true, a tooltip containing "No events" is shown when hovering empty day cells.

For example:

{
    modes : {
        year : {
            // We want it to show if there are no visible events for that date.
            // And we want the tip showing to the right of the cell
            eventCountTip : {
                showNoEvents : true,
                align        : 'l-r
            }
        }
    }
}

When showEvents is 'dots', this controls the layout of the dots below the day number.

If the max property is 1, the dots will be coloured using the default event colour, not the colour of the event. This is to create a consistent appearance.

ParameterTypeDescription
marginTopNumber

The margin above the dots. Default is 4.

maxNumber

The maximum number of dots to show. Default is 4.

gapNumber

The gap between dots. Default is 3.

sizeNumber

The size of the dots. Default is 5.

stripeBoolean

If true, the dots will be striped, meaning they will be joined together with no gap between them and rounded at each end. Default is false.

Returns the resource associated with this year view when used inside a ResourceView

showEvents: Boolean | heatmap | dots= heatmapAlso a config

How to indicate the presence of events for a date. The default is heatmap which adds classes depending on how many events intersect the date.Values may be:

  • false - Do not show events in cells.
  • true - Show a heatmap of colours the intensity of which indicates event load.
  • 'heatmap' - Show a heatmap of colours the intensity of which indicates event load.
  • 'count' - Show a themeable badge containing the event count for a date.
  • 'dots' - Show small event-coloured bullets up to a maximum of eventDots.max to indicate event presence. to indicate event presence.
$namestaticWidget
allowDragCreateCalendarMixin
allowDragMoveCalendarMixin
allowDragResizeCalendarMixin
animateTimeShiftCalendarMixin
autoCreateCalendarMixin
cellMapDayCellRenderer
columnWidget
dayCellClsCalendarMixin
dragUnitCalendarMixin
durationCalendarMixin
eventCountCalendarMixin
eventSpacingDayCellRenderer
extendAllDayEndDayCalendarMixin
firstItemContainer
firstVisibleCellCalendarMixin
firstVisibleDateCalendarMixin
hasChangesContainer
hideNonWorkingDaysCalendarMixin
isValidContainer
itemsContainer
labelPositionContainer
lastItemContainer
lastVisibleCellCalendarMixin
lastVisibleDateCalendarMixin
maxDateCalendarMixin
minDateCalendarMixin
modeNameCalendarMixin
nonWorkingDaysCalendarMixin
overflowPopupDayCellRenderer
pastEventClsCalendarMixin
renditionContainer
rtlRTL
shortDateFormatCalendarMixin
shortDateTimeFormatCalendarMixin
spanWidget
stackMultiDayEventsDayCellCollecter
stepUnitCalendarMixin
syncCalendarDateCalendarMixin
syncViewDateCalendarMixin
toolsPanel
typestaticWidget
valuesContainer
visibleCellSelectorCalendarMixin

Accessibility

keyMapKeyMap

Content

bbarPanel
tbarPanel

CSS

clsWidget

DOM

appendToWidget
contentWidget
datasetWidget
elementWidget
htmlWidget
idWidget
styleWidget

Float & align

xWidget
yWidget

Layout

alignSelfWidget
flexWidget
heightWidget
layoutContainer
layoutStyleContainer
marginWidget
maxHeightWidget
maxWidthWidget
minHeightWidget
minWidthWidget
widthWidget

Lifecycle

configBase

Misc

cellInfoWidget
disabledWidget
localeHelperLocalizable
localeManagerLocalizable
readOnlyWidget
refWidget
tabWidget
titlePanel
tooltipWidget

Record

recordContainer

State

stateState

Visibility

hiddenWidget
isVisibleWidget

Widget hierarchy

ownerWidget
parentWidget
widgetMapContainer

Functions

90

Configuration

applyDefaultsstaticBase

Events

Float & align

alignToWidget
setXYWidget
showByWidget
toFrontWidget

Lifecycle

createstaticWidget
destroystaticBase
initClassstaticWidget

Misc

attachTooltipstaticWidget
fromElementstaticWidget
fromSelectorstaticWidget
getByIdstaticWidget
isOfTypeNamestaticBase
mixinstaticBase
optionalLstaticLocalizable

Other

addContainer
calendarHitTestCalendarMixin
composeWidget
createEventCalendarMixin
createOnFrameDelayable
disableWidget
enableWidget
focusWidget
getAtContainer
getDayElementCalendarMixin
getEventElementCalendarMixin
getEventElementsCalendarMixin
getEventRecordCalendarMixin
getResourceRecordCalendarMixin
getTimeRangesCalendarMixin
getWidgetByIdContainer
insertContainer
isTodayCalendarMixin
LstaticLocalizable
maskWidget
nextCalendarMixin
onEvents
onEventCreatedCalendarMixin
previousCalendarMixin
recomposeWidget
refreshCalendarMixin
refreshSoonCalendarMixin
relayAllEvents
removeContainer
removeAllContainer
resetValuesContainer
resolveEventRecordCalendarMixin
scrollToCalendarMixin
setValuesContainer
triggerEvents
unEvents
unmaskWidget

State

Visibility

hideWidget
showWidget

Widget hierarchy

closestWidget
containsWidget
ownsWidget
queryWidget
queryAllWidget
upWidget

Events

34

Fires when this YearView refreshes.

// Adding a listener using the "on" method
yearView.on('refresh', ({ source }) => {

});
ParameterTypeDescription
sourceYearView

The triggering instance.

beforeAutoCreateCalendarMixin
beforeChangeDateCalendarMixin
catchAllEvents
cellMapPopulatedDayCellCollecter
dayCellPopulatedDayCellCollecter
destroyEvents
emptyCellClickDayCellRenderer
eventAutoCreatedCalendarMixin
eventPropagateDayCellCollecter
eventsPerCellChangeDayCellRenderer
expandPanel
focusInWidget
focusOutWidget
hideWidget
paintWidget
readOnlyWidget
recomposeWidget
resizeWidget
showWidget
showOverflowPopupDayCellRenderer

Event handlers

34

Called when this YearView refreshes.

new YearView({
    onRefresh({ source }) {

    }
});
ParameterTypeDescription
sourceYearView

The triggering instance.

onBeforeAutoCreateCalendarMixin
onBeforeChangeDateCalendarMixin
onCellMapPopulatedDayCellCollecter
onDayCellPopulatedDayCellCollecter
onDestroyEvents
onEmptyCellClickDayCellRenderer
onEventAutoCreatedCalendarMixin
onEventPropagateDayCellCollecter
onEventsPerCellChangeDayCellRenderer
onFocusInWidget
onHideWidget
onPaintWidget
onResizeWidget
onShowWidget
onShowOverflowPopupDayCellRenderer

Typedefs

11

A data block created by all DayCellCollecter Calendar views to encapsulate occupied year cells and the events which intersect with each date to be shown in the UI. All useful data about the date and the shape of the UI is included.

ParameterTypeDescription
cellConfigDomConfig

A DomConfig object that contains data about the cells element.

cellConfig.styleString

The style property is an object containing style properties for the cell header element.

cellConfig.clsString

The cls property is an object whose property names will be added to the cell element if the property value is truthy.

AlignSpecWidget
ColorWidget
DayCellDayCellCollecter
EventBarDayCellCollecter
ResponsiveStateResponsive

CSS variables

92
NameDescription
--b-year-view-font-sizeFont size for the year view.
--b-year-view-font-size-bigFont size when the year view is in big mode (responsive).
--b-year-view-foreground-font-weightFont weight for the foreground elements in the year view.
--b-year-view-backgroundBackground color for the year view.
--b-year-view-foreground-colorForeground color for the year view.
--b-year-view-row-gapGap between month rows in the year view.
--b-year-view-column-gapGap between month columns in the year view.
--b-year-view-content-paddingPadding for the content in the year view.
--b-year-view-day-cell-sizeSize of the day cells in the year view.
--b-year-view-day-cell-colorColor of the day cells in the year view.
--b-year-view-month-max-widthMaximum width for a month view in the year view.
--b-year-view-month-min-widthMinimum width for a month view in the year view.
--b-year-view-month-name-font-sizeFont size for the month names in the year view.
--b-year-view-month-name-max-widthMaximum width for the month name in the year view.
--b-year-view-month-name-cell-backgroundBackground color for the month names in the year view.
--b-year-view-month-name-cell-colorColor for the month names in the year view.
--b-year-view-week-cell-backgroundBackground color for week numbers in the year view.
--b-year-view-week-cell-colorColor for week numbers in the year view.
--b-year-view-cell-backgroundBackground color for the day cells in the year view.
--b-year-view-cell-colorColor for the day cells in the year view.
--b-year-view-other-month-cell-colorColor for the day cells of other months in the year view.
--b-year-view-1-to-3-events-colorHeatmap color for 1 to 3 events in the year view.
--b-year-view-4-to-6-events-colorHeatmap color for 4 to 6 events in the year view.
--b-year-view-7-or-more-events-colorHeatmap color for 7 or more events in the year view.
--b-year-view-dragproxy-backgroundBackground for the drag proxy in the year view.
--b-year-view-heatmap-backgroundHeatmap background (a shade of the heatmaps color)
--b-year-view-tentative-event-colorColor for tentative events in the year view.
--b-year-view-tentative-event-color2Secondary color for tentative events in the year view.
--b-year-view-today-cell-font-weightFont weight for the "today" cell in the year view.
--b-year-view-today-cell-backgroundBackground color for the "today" cell in the year view.
--b-year-view-today-cell-colorColor for the "today" cell in the year view.
--b-year-view-today-cell-borderBorder for the "today" cell in the year view.
Hovered
--b-year-view-month-name-cell-hover-backgroundBackground color for the month names on hover in the year view.
--b-year-view-month-name-cell-hover-colorColor for the month name on hover in the year view.
--b-year-view-week-cell-hover-backgroundBackground color for week numbers on hover in the year view.
--b-year-view-week-cell-hover-colorColor for week numbers on hover in the year view.
--b-year-view-cell-hover-backgroundBackground color for the day cells on hover in the year view.
--b-year-view-cell-hover-colorColor for the day cells on hover in the year view.
--b-year-view-events-hover-blend-modeBlend mode for events on hover in the year view.
--b-year-view-heatmap-hover-backgroundHeatmap hover background (a shade of the heatmaps color)

Inherited