CalendarPanel

A Panel which displays a month of date cells.

This is a base class for UI widgets like DatePicker which need to display a calendar layout.

Configs

134

Common

listenersEvents

Other

By default, when navigating through time, the next time block will be animated in from the appropriate direction.

Configure this as false to disable this.

cellRenderer: function | String

A function (or the name of a function) which creates content in, and may mutate a day cell element.

ParameterTypeDescription
renderDataObject
renderData.cellHTMLElement

The cell element.

renderData.dateDate

The date for the cell

renderData.dayNumber

The day for the cell (0 to 6 for Sunday to Saturday)

renderData.rowIndexNumber[]

The row index, 0 to month row count (6 if sixWeeks is true)

renderData.rowHTMLElement

The row element encapsulating the week which the cell is a part of

renderData.sourceCalendarPanel

The widget being rendered

renderData.cellIndexNumber[]

The cell index in the whole panel. May be from 0 to up to 42

renderData.columnIndexNumber[]

The column index, 0 to 6

renderData.visibleColumnIndexNumber[]

The visible column index taking hidden non working days into account

Returns: String | DomConfig | null
date: Date | StringAlso a property

The date which this CalendarPanel encapsulates.

dayNameFormat: String= ddd

The DateHelper format string to format the day names in the header row above the calendar cells.

disabledCls: String

The class name to add to disabled calendar cells.

disabledDates: function | String | Date[] | String[]

Either an array of Date objects which are to be disabled (or date strings), or a function (or the name of a function), which, when passed a Date returns true if the date is disabled. Disabled dates cannot be interacted with.

ParameterTypeDescription
dateDate

Date to check

Returns: Boolean -

Returns true if the provided date is disabled

Configure as true to render non working days as disabledDates.

Note, that by default, non working days are read from the locale, and are normally Saturday and Sunday. But they can be set to other days than weekend days.

Configure this as true to disable pointer interaction with cells which are outside the range of the current month.

Configure as true to render Saturdays and Sundays as disabledDates.

headerRenderer: function | String

A function (or the name of a function) which creates content in, and may mutate a day header element.

The cell element may be mutated, or an HTML string or DomConfig object may be returned.

ParameterTypeDescription
cellHTMLElement

The header element

columnIndexNumber

The day column. Will be in the range 0 to 6

weekDayNumber

The canonical day number where Monday is 0 and Sunday is 6

Returns: String | DomConfig | null

Configure this as true to hide cells which are outside the range of the current month.

By default, day cells flex to share available Panel width equally.

Set this config if the available width is too small, and the cell width needs to be larger to show events.

Setting this config causes the month grid to become scrollable in the X axis.

minRowHeight: Number | String

By default, week rows flex to share available Panel height equally.

Set this config if the available height is too small, and the cell height needs to be larger to show events.

Setting this config causes the month grid to become scrollable in the Y axis.

May be specified as a number in which case it will be taken to mean pixels, or a length in standard CSS units.

A Month Month utility object which encapsulates this Panel's month and provides contextual information and navigation services.

The class name to add to calendar cells which are nonWorkingDays.

nonWorkingDays: Object<Number, Boolean>

Non-working days as an object where keys are day indices, 0-6 (Sunday-Saturday), and the value is true. Defaults to nonWorkingDays.

The class name to add to calendar cells which are in the previous or next month.

Configure as true to render past dates in a lighter text color.

Configure as true to show a week number column at the start of the calendar block.

sixWeeks: Boolean= true

Configure as true to always show a six-week calendar.

A config object to create a tooltip which will show on hover of a date cell including disabled, weekend, and "other month" cells.

It is the developer's responsibility to hook the beforeshow event to either veto the show by returning false or provide contextual content for the date.

The tip instance will be primed with a date property.

todayCls: String

The class name to add to the calendar cell which contains today's date.

The header text for the week number column, if shown.

weekendCls: String

The class name to add to calendar cells which are weekend dates.

weekRenderer: function | String

A function (or the name of a function) which creates content in, and may mutate the week cell element at the start of a week row.

weekRenderer(wekkCell, week) {
    // week[0] is the year
    // week[1] is the week number
    cell.innerText = week[1];
}

The cell element may be mutated, or an HTML string or DomConfig object may be returned.

ParameterTypeDescription
weekCellHTMLElement

The header element

weekNumber[]

An array containing [year, weekNumber]

Returns: String | DomConfig | null
weekStartDay: Number

The week start day, 0 meaning Sunday, 6 meaning Saturday. Defaults to weekStartDay.

columnWidget
defaultFocusContainer
drawerPanel
labelPositionContainer
renditionContainer
rtlRTL
spanWidget

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

102

Class hierarchy

isCalendarPanel: Boolean= truereadonly
Identifies an object as an instance of CalendarPanel class, or subclass thereof.
isCalendarPanel: Boolean= truereadonlystatic
Identifies an object as an instance of CalendarPanel class, or subclass thereof.
isContainerContainer
isDelayableDelayable
isEventsEvents
isKeyMapKeyMap
isLocalizableLocalizable
isPanelPanel
isStateState
isToolableToolable
isWidgetWidget

Other

By default, when navigating through time, the next time block will be animated in from the appropriate direction.

Configure this as false to disable this.

Gets or sets the date that orientates the panel to display a particular month. Changing this causes the content to be refreshed.

endDate: Datereadonly

The end date of this view. Note that in terms of full days, this is exclusive, ie: 2020-01-012 to 2020-01-08 is seven days. The end is 00:00:00 on the 8th.

Note that this may not be the last date of this panel's current month.

Configure as true to render past dates in a lighter text color.

Configure as true to show a week number column at the start of the calendar block.

startDate: Datereadonly

The date of the first day cell in this panel. Note that this may not be the first of this panel's current month.

visibleWeekCount: Numberreadonly

The number of rows displayed in this month. If sixWeeks is not set, this may be from 4 to 6.

The header text for the week number column, if shown.

$namestaticWidget
columnWidget
firstItemContainer
hasChangesContainer
isValidContainer
itemsContainer
labelPositionContainer
lastItemContainer
renditionContainer
rtlRTL
spanWidget
toolsPanel
typestaticWidget
valuesContainer

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

78

Other

Returns the cell associated with the passed date.

To exclude dates which are outside of the panel's current month, pass the strict parameter as true

ParameterTypeDescription
dateDate | String

The date to find the element for or a key in the format YYYY-MM-DD

strictBoolean

Only return the element if this view owns the date.

Returns: HTMLElement -

The cell for the passed date if it exists

Refreshes the UI after changing a config that would affect the UI.

The date which this CalendarPanel encapsulates. Setting this causes the content to be refreshed.

Set to 0 for Sunday (the default), 1 for Monday etc.

Set to null to use the default value from DateHelper.

addContainer
composeWidget
createOnFrameDelayable
disableWidget
enableWidget
focusWidget
getAtContainer
getWidgetByIdContainer
insertContainer
LstaticLocalizable
maskWidget
onEvents
recomposeWidget
relayAllEvents
removeContainer
removeAllContainer
resetValuesContainer
setValuesContainer
triggerEvents
unEvents
unmaskWidget

Configuration

applyDefaultsstaticBase

Events

Float & align

alignToWidget
setXYWidget
showByWidget
toFrontWidget

Lifecycle

createstaticWidget
destroystaticBase
initClassstaticWidget

Misc

attachTooltipstaticWidget
fromElementstaticWidget
fromSelectorstaticWidget
getByIdstaticWidget
isOfTypeNamestaticBase
mixinstaticBase
optionalLstaticLocalizable

State

Visibility

hideWidget
showWidget

Widget hierarchy

closestWidget
containsWidget
ownsWidget
queryWidget
queryAllWidget
upWidget

Events

26

Fires before this CalendarPanel refreshes in response to changes in its month.

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

});
ParameterTypeDescription
sourceDatePicker

This DatePicker.

Fired when a date cell is clicked.

// Adding a listener using the "on" method
calendarPanel.on('cellClick', ({ cell, date, week, domEvent }) => {

});
ParameterTypeDescription
cellHTMLElement

The clicked cell element.

dateDate

The date represented by the cell.

weekNumber[]

The week array [year, weekNumber].

domEventEvent

The original DOM event.

Fires when the date of this CalendarPanel is set.

// Adding a listener using the "on" method
calendarPanel.on('dateChange', ({ value, oldValue, changes, changes.d, changes.w, changes.m, changes.y }) => {

});
ParameterTypeDescription
valueDate

The new date.

oldValueDate

The old date.

changesObject

An object which contains properties which indicate what part of the date changed.

changes.dBoolean

True if the date changed in any way.

changes.wBoolean

True if the week changed (including same week in a different year).

changes.mBoolean

True if the month changed (including same month in a different year).

changes.yBoolean

True if the year changed.

Fires when this CalendarPanel refreshes.

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

});

Fired when a week number cell is clicked.

// Adding a listener using the "on" method
calendarPanel.on('weekCellClick', ({ date, week, domEvent }) => {

});
ParameterTypeDescription
dateDate

The start date of the week.

weekNumber[]

The week array [year, weekNumber].

domEventEvent

The original DOM event.

catchAllEvents
destroyEvents
expandPanel
focusInWidget
focusOutWidget
hideWidget
paintWidget
readOnlyWidget
recomposeWidget
resizeWidget
showWidget

Event handlers

26

Called before this CalendarPanel refreshes in response to changes in its month.

new CalendarPanel({
    onBeforeRefresh({ source }) {

    }
});
ParameterTypeDescription
sourceDatePicker

This DatePicker.

Called when a date cell is clicked.

new CalendarPanel({
    onCellClick({ cell, date, week, domEvent }) {

    }
});
ParameterTypeDescription
cellHTMLElement

The clicked cell element.

dateDate

The date represented by the cell.

weekNumber[]

The week array [year, weekNumber].

domEventEvent

The original DOM event.

Called when the date of this CalendarPanel is set.

new CalendarPanel({
    onDateChange({ value, oldValue, changes }) {

    }
});
ParameterTypeDescription
valueDate

The new date.

oldValueDate

The old date.

changesObject

An object which contains properties which indicate what part of the date changed.

changes.dBoolean

True if the date changed in any way.

changes.wBoolean

True if the week changed (including same week in a different year).

changes.mBoolean

True if the month changed (including same month in a different year).

changes.yBoolean

True if the year changed.

Called when this CalendarPanel refreshes.

new CalendarPanel({
    onRefresh({  }) {

    }
});

Called when a week number cell is clicked.

new CalendarPanel({
    onWeekCellClick({ date, week, domEvent }) {

    }
});
ParameterTypeDescription
dateDate

The start date of the week.

weekNumber[]

The week array [year, weekNumber].

domEventEvent

The original DOM event.

onDestroyEvents
onFocusInWidget
onHideWidget
onPaintWidget
onResizeWidget
onShowWidget

Typedefs

7

CSS variables

69
NameDescription
--b-calendar-panel-day-font-sizeFont-size used for day name letters and week numbers
--b-calendar-panel-day-header-font-weightFont-weight used for day name letters
--b-calendar-panel-week-widthWidth of the week number column
--b-calendar-panel-week-number-displayDisplay property for the week number column
--b-calendar-panel-cell-displayDisplay property for date cells
--b-calendar-panel-cell-paddingDate cell padding
--b-calendar-panel-cell-font-sizeDate cell font size
--b-calendar-panel-cell-backgroundDate cell background
--b-calendar-panel-cell-font-weightDate cell font-weight
--b-calendar-panel-disabled-cell-opacityDisabled date cell opacity
--b-calendar-panel-non-working-cell-displayNon-working day & date cell display
--b-calendar-panel-gapGap between day and date cells (must have a unit for calculations to work)
--b-calendar-panel-day-colorColor used for day name letters
--b-calendar-panel-colorDate cell color
--b-calendar-panel-other-month-colorOther month (last dates of the month before, first dates of the month after) cell color
--b-calendar-panel-weeks-gapGap between weeks. Also used as block padding for the weeks container to give even spacing
--b-calendar-panel-week-number-colorThe color of text in week number cells

Inherited