DayView
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.
A Panel which displays one or more columns of days with events for each day arranged in ascending time order in each column.
This view is not limited to showing a single day. The date and range or startDate and endDate may be configured to cover any range.
By default, a narrow band of whitespace is left on the inline-end side of day columns to allow the
user to click or drag to create events. This gutter may be configured using the eventLayout's
gutterWidth property as shown in the examples below.
//<code-header>
fiddle.title = 'Calendar day view';
//</code-header>
const calendar = new Calendar({
appendTo : targetElement,
height : 500,
date : new Date(2020, 8, 2),
modes : {
day : {
dayStartTime : 6,
dayEndTime : 19,
visibleStartTime : 6,
allDayEvents : {
fullWeek : false
}
},
week : null,
month : null,
year : null,
agenda : null
},
events : [
{ startDate : '2020-09-02T00:00', duration : 5, durationUnit : 'd', name : 'Boss vacation', eventColor : 'red' },
{ startDate : '2020-09-02T07:00', duration : 5, durationUnit : 'h', name : 'Walk the dog', eventColor : 'yellow' },
{ startDate : '2020-09-03T09:00', duration : 2, durationUnit : 'h', name : 'Buy masks', eventColor : 'orange' },
{ startDate : '2020-09-04T07:00', duration : 1, durationUnit : 'h', name : 'Zoom meeting', eventColor : 'deep-orange' },
{ startDate : '2020-09-05T09:00', duration : 1, durationUnit : 'h', name : 'Get a haircut', eventColor : 'gray' }
],
tbar : {
items : {
showAllDayHeader : {
type : 'checkbox',
label : 'Show all day header',
checked : true,
onChange({ checked }) {
calendar.activeView.showAllDayHeader = checked;
}
},
showFullWeek : {
type : 'checkbox',
label : 'Show week header',
checked : false,
onChange({ checked }) {
calendar.activeView.allDayEvents.fullWeek = checked;
}
}
}
},
bbar : {
items : {
gutterWidth : {
type : 'slider',
label : 'Gutter width',
min : 5,
max : 100,
value : 5,
triggerChangeOnInput : true,
onChange({ value }) {
calendar.activeView.eventLayout.gutterWidth = value;
}
}
}
}
});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:
//<code-header>
fiddle.title = 'Day view';
//</code-header>
const dayView = new DayView({
appendTo : targetElement,
height : 500,
startDate : new Date(2020, 8, 2),
endDate : new Date(2020, 8, 7),
dayStartTime : 6,
dayEndTime : 19,
visibleStartTime : 6,
events : [
{ startDate : '2020-09-02T00:00', duration : 5, durationUnit : 'd', name : 'Boss vacation', eventColor : 'red' },
{ startDate : '2020-09-02T07:00', duration : 5, durationUnit : 'h', name : 'Walk the dog', eventColor : 'yellow' },
{ startDate : '2020-09-03T09:00', duration : 2, durationUnit : 'h', name : 'Buy masks', eventColor : 'orange' },
{ startDate : '2020-09-04T07:00', duration : 1, durationUnit : 'h', name : 'Zoom meeting', eventColor : 'deep-orange' },
{ startDate : '2020-09-05T09:00', duration : 1, durationUnit : 'h', name : 'Get a haircut', eventColor : 'gray' }
],
bbar : {
items : {
showAllDayHeader : {
type : 'checkbox',
label : 'Show all day header',
checked : true,
onChange({ checked }) {
dayView.showAllDayHeader = checked;
}
},
gutterWidth : {
type : 'slider',
label : 'Gutter width',
min : 5,
max : 100,
value : 5,
triggerChangeOnInput : true,
onChange({ value }) {
dayView.eventLayout.gutterWidth = value;
}
}
}
}
});When using range, setting the date snaps the view to the start of a range
(for example '1 week') which encapsulates the requested date.
When the startDate is changed dynamically, the duration remains the same.
This view can be configured to scroll to the specific time on first render, which defaults to 7 AM. This behavior is controlled by the visibleStartTime config.
A WeekView is a subclass of this view which is tied to showing weeks as defined by the weekStartDay.
By default, the view scrolls vertically to 7am on first render. This can be configured using the visibleStartTime config.
Keyboard shortcuts when focused inside a DayView (or WeekView)
- ← - Move to the previous day.
- → - Move to the next day.
- + - Zoom in (Increase hourHeight by 2).
- - - Zoom out (Decrease hourHeight by 2).
Multi day events.
All day events, and multi day events are displayed in a row at the top.
Intraday events are arranged in ascending time order down day columns from the dayStartTime to the dayEndTime.
The showAllDayHeader config option can be used to not show multi day events at the top, but have them wrap across multiple day columns.
The following configs which apply to the all day row are passed into the configuration of the allDayEvents widget:
Event rendering can be customized using the eventRenderer method.
Configs
190
Configs
190Common
Text or HTML, or a DomConfig block to display when all dates in the range have been filtered out.
Other
An object or an array of button specifications which add clickable icon buttons to the rendered event blocks which contain the following properties.
For example, the calendar may be configured like this:
modes : {
day : {
actionButtons : {
delete : {
tooltip : 'Delete event',
cls : 'b-icon-trash',
handler : 'up.onDeleteAction'
}
}
}
},
onDeleteAction({ eventRecord }) {
this.removeEvents([eventRecord]);
}
A CalendarRow widget containing the horizontal series of calendar cells with the day headers and any all-day, or day-spanning events which fall inside this view's time range.
Note that this component calculates its height depending on its
eventHeight,
defaultEventRowCount and
autoHeight settings, therefore any configured height
and flex values will be ignored.
modes : {
day : {
// Do not show the whole week in the header for the one day view
allDayEvents : {
fullWeek : false
}
}
}
By default, when mousewheel zooming out from overflowing the client height, it is not permitted to zoom further out so that the hours underflow the client height.
When zooming out, the view normally stops when the hours exactly fit the client height.
Configure this as true to allow mousewheel zooming out to cause the hours to underflow the client height.
A function, or name of a function which is passed the DayCellWithEvents object which describes the events and details of the day.
This function must return either an HTML string, or a DomConfig object to create a column header for the passed date.
columnHeaderRenderer({ events }) {
return `${events.length ? events.length : 'No'} Events`;
}
| Parameter | Type | Description |
|---|---|---|
cellData | DayCellWithEvents | A data block describing the date and the events for that date. |
Configure this property as true to show the day name and date headers in a more compact style.
When this is set, the day name and date are displayed side by side instead of on separate lines and with a smaller font size.
This applies the b-compact-header CSS class to this widget which may be styled as required.
An object containing two properties, start and end representing the start and
end of core working hours.
This causes the non core hours to be covered by a themeable translucent grey mask in the time axis.
This may be configured to also mask the non core hours in the day part of the view
by setting the overlayDay property.
{
coreHours : {
start : 9,
end : 17,
overlayDay : true
}
}
If this is configured as an array of less than seven elements, it is taken to be describing multiple core hours blocks within one day, so it could be
{
coreHours : [{
start : 8,
end : 12,
}, {
start : 14,
end : 18
}
}
This may also be a seven element array so as to have different core hours for
each JavaScript day of the week (Meaning 0 for Sunday to 6 for Saturday).
This causes only the hours in the day columns to be masked:
{
coreHours : [{
start : 10,
end : 15
},{
start : 9,
end : 17
},{
start : 9,
end : 17
},{
start : 9,
end : 17
},{
start : 9,
end : 17
},{
start : 9,
end : 17
},{
start : 10,
end : 15
}]
}
This may also be a function to return calculated core hours for every date. This causes only the hours in the day columns to be masked:
{
coreHours : function(date) {
// Shorter core hours at weekends
if (date.getDay() === 0 || date.getDay() === 6) {
return {
start : '10:00',
end : '15:00'
};
}
// Pre-lunch and post-lunch working blocks in the week
return [{
start : '08:00',
end : '12:00'
}, {
start : '14:00',
end : '18:00'
};
}
}
This may also be a seven element array which contains separate core hours
specification for each day of the week as returned from the Date class.
This may also be a function, which, when passed a Date, returns a core hours
specification for that date.
In the simplest case an object containing two properties, start and end:
coreHours.start- The start hour or start time stringHH:MMof the core working hours.DateorStringvalue allowed.coreHours.end- The end hour or start time stringHH:MMof the core working hours.DateorStringvalue allowedcoreHours.overlayDay- Set totrueto have the greyed zone cover the day part of the view.
Only valid when this config is specified as a simple Object.
| Parameter | Type | Description |
|---|---|---|
date | Date | Date for hours calculation |
A function, or name of a function which produces a DomConfig block to create the current time indicator which is displayed in a day column which represents the current date. It is the developer's responsibility to add CSS classes and the appropriate CSS rules to produce the desire appearance.
currentTimeIndicatorRenderer : function() {
return {
className : 'my-current-time',
text : 'NOW'
};
}
The result is used to sync the DOM of the day column.
An object which describes the DOM structure of the today indicator element.
By default, half hour, fifteen minute tick lines are rendered in a lower contrast colour than hour lines.
Configure this as true to instead render the minor tick lines as dashed lines
at the same contrast level as the hour lines.
A callback function, or the name of a function in the ownership hierarchy which an application may provide to filter out day columns for individual dates.
| Parameter | Type | Description |
|---|---|---|
context | DayCell | Information about the day column to be created. |
Return false to not display a column for the passed date.
A function, or name of a function which is passed the DomConfig object which will be used to sync with a day column.
dayCellRenderer : function(domConfig, cellData) {
if (this.isSpecialDate(cellData.date)) {
domConfig.className['fa'] =
domConfig.className['fa-birthday-cake'] = 1;
}
return domConfig;
}
The result is used to sync the DOM of the day column.
| Parameter | Type | Description |
|---|---|---|
domConfig | DomConfig | Object | A DomConfig config object which is used to sync the day column element. |
domConfig.className | Object | An object who's truthy property names will be applied as class names. |
domConfig.style | Object | A CSS style definition object. |
domConfig.dataset | Object | The DOM data properties to set. |
children | DomConfig[] | The DomConfig definitions for the events in the day. |
cellData | DayCell | A |
Either the end hour of the day, or a 24 hour HH:MM string denoting the end date of the last rendered time block.
You can also set this value to a ms timestamp representing time from midnight.
This config, along with dayStartTime determines which hours are displayed in a day column.
Note that this is only granular to the hour level. The value will be rounded up to the ending hour of the configured time.
A function, or name of a function which is passed the DomConfig object which will be used to sync with a day cell header in the all day row.
dayHeaderRenderer : function(headerDomConfig, cellData) {
if (this.isSpecialDate(cellData.date)) {
headerDomConfig.className['b-is-special-date'] = 1;
// Add to the content element's children
headerDomConfig.children.push({
text : 'Special day',
className : 'b-special-day
});
}
}
The result is used to sync the DOM of the day column in the all day row.
| Parameter | Type | Description |
|---|---|---|
headerDomConfig | DomConfig | Object | A DomConfig config object which is used to sync the day header element. |
headerDomConfig.className | Object | An object who's truthy property names will be applied as class names. |
headerDomConfig.style | Object | A CSS style definition object. |
headerDomConfig.dataset | Object | The DOM data properties to set. |
headerDomConfig.children | DomConfig[] | The DomConfig definitions the header content.
There will be 2 |
cellData | DayCell | A |
The DateHelper format string/function for day names in the header row (e.g., "ddd" for "Mon", "Tue", ...)
| Parameter | Type | Description |
|---|---|---|
date | Date | The date to format. |
The formatted date.
Either the start hour of the day, or a 24 hour HH:MM string denoting the start time for days. This
is midnight by default.
Setting this value to 12, for example, indicates that the 24 hour "day" runs from noon on one day, to noon on the following day. This causes events in this span of time to layout in the same day column. In this example, a two hour event that spanned midnight would be rendered in the same way a normal, 2 hour event spanning noon would be rendered without this option.
When this config is non-zero, the headings that display the day name and number are adjusted to indicate the range of days for the column. For example, the "Wed" column for the 12th of the month will now show "Wed-Thu" for the day name and "12-13" for the day number.
Either the start hour of the day, or a 24 hour HH:MM string denoting the start of the first rendered
daily time block. You can also set this value to a ms timestamp representing time from midnight.
This config, along with dayEndTime determines which hours are displayed in a day column.
Note that this is only granular to the hour level. The value will be rounded down to the starting hour of the configured time.
Configuration to manage event layout class. See FluidDayLayout class docs to see all possible configurations.
Defaults to { type : 'fluid' }.
Number of pixels to reduce the height of events by, to leave a gap between them.
When set to true, the hours in the day will be sized so that they fit in the available
height.
In the Object form, the value may contain minHeight as the minimum hour height to which
the hour cells may shrink:
fitHours : {
minHeight : 31
}
Note that if the all day events row at the top changes size, the space available for the hours will change too, and the hour cell height will change.
| Parameter | Type | Description |
|---|---|---|
minHeight | Number | The minimum height in pixels to which the hour cells may shrink. |
By default, reconfiguring the startDate maintains the current duration of the view and moves the endDate.
But for flexibility, reconfiguring the endDate changes the duration.
Setting fixedDuration to true locks this down to changing either end just moves
the view.
This flag also signals that when using multiSelect in the date picker, the selected range does not get applied to this view.
Configure this as true to hide day columns which contain no events.
The height in pixels of one hour cell in a day column.
Hour cells are bounded by lines, and there are fainter subtick lines between hour lines. These subtick change as zooming passes the hourHeightBreakpoints.
An array which encapsulates a set of hourHeight breakpoints which dictate when subticks - intervening time indicators - are introduced into the DayView's time axis.
Entries are in ascending granularity order, so the values must ascend.
Subtick visibility is updated dynamically during zooming.
When an hourHeight change causes a change of sub tick granularity, a tickChange event is fired.
A millisecond value to which to snap pointer times when clicking or dragging within a day column and when calculating the hovered time for the ScheduleTooltip tooltip.
May be specified in string form eg: '15 minutes'
By default, the pointer position is rounded to the nearest increment, but this can be
configured using the timeSnapType option.
By default, drag-moving an event allows the drag gesture to move the event into other day columns.
To limit drag-moving an event to only operating within the same day column, set this to false.
Note that this setting is only valid for multi-day DayView instances. For other view types, all drag gestures
are inter day, so use allowDragMove for other views.
By default, drag-resizing an event (including creating a new event) allows the drag gesture to span multiple day columns to make the event an inter day event.
To limit drag-resizing an event to only operating within the same day column, set this to false.
Note that this setting is only valid for multi-day DayView instances. For other view types, all drag gestures
are inter day, so use allowDragResize and allowDragCreate for other views.
The maximum height the all day event row is allowed to grow within this view when it is expanded to show all its "all day" events.
This defaults to 50%, but can also be set to any CSS size value. A numeric
value will be taken as pixels.
The minimum width of a day column.
If this is set, and the day columns overflow the horizontal space available, the columns will be scrollable horizontally in the normal way.
There is a horizontalScroller property which handles scrolling in this dimension.
The minimum height to which event blocks in a day cell may shrink. If an event has very short duration, whatever the hourHeight, and regardless of timeline zooming, the event block will never drop below this height.
The minimum height in pixels to allow a zoom request to zoom out to.
A config object used to create the OverflowPopup that the allDayEvents may show when events for one day overflow the available space.
For example
modes : {
week : {
overflowPopup : {
closable : false,
dateFormat : 'dddd, MMM M',
eventRenderer({ eventRecord, renderData }) {
if (calendarUtils.isImportantEvent(eventRecord)) {
// Add CSS class to important events
renderData.cls['b-important'] = 1;
}
}
}
}
}
Shows an all day header above the main schedule for All Day events.
Set to false to not show all day, or multi-day events in an all day header, but
to have them showing wrapping through the day cells.
By default today's date shows a current time line to indicate the current time. This line is confined to the day cell for today.
Configure this property as false to disable this.
This also may have more granular options when specified as an Object:
| Parameter | Type | Description |
|---|---|---|
fullWidth | Boolean | When |
showTime | Boolean | When |
onTop | Boolean | Set to |
trueAlso a propertyConfigure as false to hide the start time normally shown at the top of the events.
Configuring as true (The default) means only show the start time.
Both start and end time may be selected separately:
{
startTime : true,
endTime : true
}
Or start time and duration resulting in the duration being shown in the form (HH:mm) after the start time:
{
startTime : true,
duration : true
}
The duration option may also be a function or the name of a function in the ownership hierarchy
which is passed the event's duration in milliseconds, and must return a string to display.
By default, the most granular time tick level in the DayView's time axis is five minutes.
Set this property to true to have the hour split into six minute ticks.
Affects drag drop and moving of events with regard to the increment
If set to true, startDate will be snapped relative to event's original start. e.g. if the
increment is 15 minutes, an event that starts at 10:03 and is dragged forwards
would snap its start date to 10:18, 10:33 etc.
When set to false (the default), startDate will be snapped relative to the day start, eg
- 10:03 -> 10:15, 10:20 etc.
A function, or name of a function which yields a DomConfig object to use as a tick background element for the tick context passed.
tickRenderer({ startTime, tickIndex, subtickIndex, resourceRecord }) {
// Skip subticks in the 13:00 hour
if (!(startTime.getHours() === 13 && startTime.getMinutes())) {
const result = {
className : {
'afternoon-shift' : startTime.getHours() >= 12
},
text : DateHelper.format(startTime, 'hh:mm a');
};
// And make the 13:00 cell span the whole hour
if (startTime.getHours() === 13 && !startTime.getMinutes()) {
result.rowspan = subTickCount;
}
return result;
}
}
With some application styling:
.b-day-view-subtick {
padding : 0.5em;
font-size : 0.7em;
color : #999;
}
.b-day-view-subtick:hover {
background-color : rgba(0, 0, 0, 0.1);
cursor : pointer;
}
This is called for every visible subtick. So if the view is not tall, and only hour cells are visible, this will be called for every hour.
If half hour ticks are visible too, this will be called for every half hour, if fifteen minutes ticks are visible this will be called for every fifteen minutes etc.
By default, these ticks are sized and positioned to exactly fit the subtick cell. You may use inline style in the
DomConfig return value, or a className property in the DomConfig return value to style the ticks.
Returning null will cause no tick to be rendered for that time.
The rendered element will have the class b-day-view-subtick added to it.
If the rendered element is the last subtick in an hour, the class b-last-in-hour will be added.
The rendered element's dataset will have the following properties:
hour- The date of the tick.minute- The minute of the tick.index- The index of the subtick within the hour.
| Parameter | Type | Description |
|---|---|---|
tickContext | Object | An object containing the context for the tick being rendered. |
tickContext.startTime | Date | The start time of the tick. |
tickContext.endTime | Date | The end time of the tick. |
tickContext.events | EventModel[] | The events that visually intersect with the tick. |
tickContext.tickIndex | Number | The zero-based overall tick index. |
tickContext.subtickIndex | Number | The zero-based subtick index within the hour. |
tickContext.subtickCount | Number | The total number of visible subticks in an hour. |
tickContext.resourceRecord | ResourceModel | If this view is a resource view, the resource record. |
The DOM config object to use for the tick.
A DateHelper format string/function used to format the time displayed in the time axis at the left side of the view.
| Parameter | Type | Description |
|---|---|---|
date | Date | The date to format. |
The formatted date.
The type of rounding to apply when calculating a date from a pointer position in a day column.
This defaults to 'round', but may also be 'floor' or 'ceil'. A pointer position will
be snapped to the appropriate increment.
Configure this as null to disable snapping so that drag and drop operations and
tooltips show exact times.
Either the start hour of the day, or a 24 hour HH:MM string denoting the initially visible start
time of the day. Defaults to 7am.
Configure this as null to not have the view scroll to an initial position.
This may also be configured as an object to control how the view scrolls to the target time, with
the target time specified as the time option. For example:
{
visibleStartTime : {
time : '7:30',
block : 'closest',
edgeOffset : 10,
animate : true
}
}
The default is to scroll the time to block : 'start' with no animation.
| Parameter | Type | Description |
|---|---|---|
time | String | Number | The time to which to scroll the view on first render as either an hour of the day,
or a 24 hour |
block | start | end | center | nearest | How far to scroll the target time. |
edgeOffset | Number | edgeOffset A margin around the target to bring into view. |
animate | Object | Boolean | Number | Set to |
animate.duration | Number | The number of milliseconds to animate over. |
animate.easing | String | The name of an easing function. |
You can zoom in and out on the time axis using CTRL-key + mouse wheel on mouse-based devices or pinch-zoom on touch devices. See also the hourHeightBreakpoints config option.
You cannot zoom so far out that the day height falls below the available height.
The rate at which zoom proceeeds can be changed by configuring this value as a number which will be used as a multiplier.
Note that zooming necessarily sets fitHours to false.
Configure this as false to disable this behaviour.
Content
CSS
DOM
Float & align
Layout
misc
Misc
Scrolling
Properties
161
Properties
161Common
Text or HTML, or a DomConfig block to display when all dates in the range have been filtered out.
Class hierarchy
Other
If showAllDayHeader is not set to false, then this will be an instance
of CalendarRow which encapsulates the all day events at the top
of this view.
By default, when mousewheel zooming out from overflowing the client height, it is not permitted to zoom further out so that the hours underflow the client height.
When zooming out, the view normally stops when the hours exactly fit the client height.
Configure this as true to allow mousewheel zooming out to cause the hours to underflow the client height.
Yields a Map which contains the cell data for each date in the current view.
This is a Map where the keys are the date strings in the format
YYYY-MM-DD and the values are DayCell objects which contain the data for that cell.
Configure this property as true to show the day name and date headers in a more compact style.
When this is set, the day name and date are displayed side by side instead of on separate lines and with a smaller font size.
This applies the b-compact-header CSS class to this widget which may be styled as required.
An object containing two properties, start and end representing the start and
end of core working hours.
This causes the non core hours to be covered by a themeable translucent grey mask in the time axis.
This may be configured to also mask the non core hours in the day part of the view
by setting the overlayDay property.
{
coreHours : {
start : 9,
end : 17,
overlayDay : true
}
}
If this is configured as an array of less than seven elements, it is taken to be describing multiple core hours blocks within one day, so it could be
{
coreHours : [{
start : 8,
end : 12,
}, {
start : 14,
end : 18
}
}
This may also be a seven element array so as to have different core hours for
each JavaScript day of the week (Meaning 0 for Sunday to 6 for Saturday).
This causes only the hours in the day columns to be masked:
{
coreHours : [{
start : 10,
end : 15
},{
start : 9,
end : 17
},{
start : 9,
end : 17
},{
start : 9,
end : 17
},{
start : 9,
end : 17
},{
start : 9,
end : 17
},{
start : 10,
end : 15
}]
}
This may also be a function to return calculated core hours for every date. This causes only the hours in the day columns to be masked:
{
coreHours : function(date) {
// Shorter core hours at weekends
if (date.getDay() === 0 || date.getDay() === 6) {
return {
start : '10:00',
end : '15:00'
};
}
// Pre-lunch and post-lunch working blocks in the week
return [{
start : '08:00',
end : '12:00'
}, {
start : '14:00',
end : '18:00'
};
}
}
This may also be a seven element array which contains separate core hours
specification for each day of the week as returned from the Date class.
This may also be a function, which, when passed a Date, returns a core hours
specification for that date.
In the simplest case an object containing two properties, start and end:
coreHours.start- The start hour or start time stringHH:MMof the core working hours.DateorStringvalue allowed.coreHours.end- The end hour or start time stringHH:MMof the core working hours.DateorStringvalue allowedcoreHours.overlayDay- Set totrueto have the greyed zone cover the day part of the view.
Only valid when this config is specified as a simple Object.
| Parameter | Type | Description |
|---|---|---|
date | Date | Date for hours calculation |
By default, half hour, fifteen minute tick lines are rendered in a lower contrast colour than hour lines.
Configure this as true to instead render the minor tick lines as dashed lines
at the same contrast level as the hour lines.
A callback function, or the name of a function in the ownership hierarchy which an application may provide to filter out day columns for individual dates.
| Parameter | Type | Description |
|---|---|---|
context | DayCell | Information about the day column to be created. |
Return false to not display a column for the passed date.
When read, this is the end time of the day, expressed in ms (6pm would be represented as 18 * 60 * 60 * 1000).
You can set this value to either an hour value (1-24), a 24 hour HH:MM string denoting the end of
the last rendered daily time block or to a ms timestamp representing time from midnight.
Note that this is only granular to the hour level. The value will be rounded up to the ending hour of the specified time.
When read, this is the start time of the day, expressed in ms (7am would be represented as 7 * 60 * 60 * 1000).
You can set this value to either an hour value (0-23), a 24 hour HH:MM string denoting the start of
the first rendered daily time block or to a ms timestamp representing time from midnight.
Note that this is only granular to the hour level. The value will be rounded down to the starting hour of the specified time.
When set to true, the hours in the day will be sized so that they fit in the available
height.
In the Object form, the value may contain minHeight as the minimum hour height to which
the hour cells may shrink:
fitHours : {
minHeight : 31
}
Note that if the all day events row at the top changes size, the space available for the hours will change too, and the hour cell height will change.
| Parameter | Type | Description |
|---|---|---|
minHeight | Number | The minimum height in pixels to which the hour cells may shrink. |
By default, reconfiguring the startDate maintains the current duration of the view and moves the endDate.
But for flexibility, reconfiguring the endDate changes the duration.
Setting fixedDuration to true locks this down to changing either end just moves
the view.
This flag also signals that when using multiSelect in the date picker, the selected range does not get applied to this view.
Configure this as true to hide day columns which contain no events.
A Scroller which encapsulates horizontal scrolling of the view in case a minDayWidth setting causes the days to overflow the available width.
The height in pixels of one hour cell in a day column.
Hour cells are bounded by lines, and there are fainter subtick lines between hour lines. These subtick change as zooming passes the hourHeightBreakpoints.
An array which encapsulates a set of hourHeight breakpoints which dictate when subticks - intervening time indicators - are introduced into the DayView's time axis.
Entries are in ascending granularity order, so the values must ascend.
Subtick visibility is updated dynamically during zooming.
When an hourHeight change causes a change of sub tick granularity, a tickChange event is fired.
A millisecond value to which to snap pointer times when clicking or dragging within a day column and when calculating the hovered time for the ScheduleTooltip tooltip.
May be specified in string form eg: '15 minutes'
By default, the pointer position is rounded to the nearest increment, but this can be
configured using the timeSnapType option.
By default, drag-moving an event allows the drag gesture to move the event into other day columns.
To limit drag-moving an event to only operating within the same day column, set this to false.
Note that this setting is only valid for multi-day DayView instances. For other view types, all drag gestures
are inter day, so use allowDragMove for other views.
By default, drag-resizing an event (including creating a new event) allows the drag gesture to span multiple day columns to make the event an inter day event.
To limit drag-resizing an event to only operating within the same day column, set this to false.
Note that this setting is only valid for multi-day DayView instances. For other view types, all drag gestures
are inter day, so use allowDragResize and allowDragCreate for other views.
The minimum width of a day column.
If this is set, and the day columns overflow the horizontal space available, the columns will be scrollable horizontally in the normal way.
There is a horizontalScroller property which handles scrolling in this dimension.
The minimum height to which event blocks in a day cell may shrink. If an event has very short duration, whatever the hourHeight, and regardless of timeline zooming, the event block will never drop below this height.
The minimum height in pixels to allow a zoom request to zoom out to.
The OverflowPopup instance that the allDayEvents may show when events for one day overflow the available space.
Returns the resource associated with this day view when used inside a ResourceView
By default today's date shows a current time line to indicate the current time. This line is confined to the day cell for today.
Configure this property as false to disable this.
This also may have more granular options when specified as an Object:
| Parameter | Type | Description |
|---|---|---|
fullWidth | Boolean | When |
showTime | Boolean | When |
onTop | Boolean | Set to |
trueAlso a configConfigure as false to hide the start time normally shown at the top of the events.
Configuring as true (The default) means only show the start time.
Both start and end time may be selected separately:
{
startTime : true,
endTime : true
}
Or start time and duration resulting in the duration being shown in the form (HH:mm) after the start time:
{
startTime : true,
duration : true
}
The duration option may also be a function or the name of a function in the ownership hierarchy
which is passed the event's duration in milliseconds, and must return a string to display.
By default, the most granular time tick level in the DayView's time axis is five minutes.
Set this property to true to have the hour split into six minute ticks.
Affects drag drop and moving of events with regard to the increment
If set to true, startDate will be snapped relative to event's original start. e.g. if the
increment is 15 minutes, an event that starts at 10:03 and is dragged forwards
would snap its start date to 10:18, 10:33 etc.
When set to false (the default), startDate will be snapped relative to the day start, eg
- 10:03 -> 10:15, 10:20 etc.
The type of rounding to apply when calculating a date from a pointer position in a day column.
This defaults to 'round', but may also be 'floor' or 'ceil'. A pointer position will
be snapped to the appropriate increment.
Configure this as null to disable snapping so that drag and drop operations and
tooltips show exact times.
CSS
DOM
Layout
Misc
State
Widget hierarchy
Functions
94
Functions
94Other
Iterates the hours in the configured day, starting from the configured start hour, calling the passed callback.
| Parameter | Type | Description |
|---|---|---|
fn | function | String | A function or the name of a function in the ownershop hierarchy to call. |
fn.hour | Number | The hour being visited. |
fn.date | Date | A Date object encapsulating the hour being visited. |
fn.i | Number | Zero based loop counter. |
contextDate | Date | A Date object representing the day whose hours are to be visited. |
Scrolls vertically to bring an event or a time into view.
| Parameter | Type | Description |
|---|---|---|
target | EventModel | Date | Number | The event to scroll to or
a |
options | Object | How to scroll. |
options.block | start | end | center | nearest | How far to scroll the target. |
options.edgeOffset | Number | edgeOffset A margin around the target to bring into view. |
options.animate | Object | Boolean | Number | Set to |
options.animate.duration | Number | The number of milliseconds to animate over. |
options.animate.easing | String | The name of an easing function. |
options.highlight | Boolean | Set to |
options.focus | Boolean | Set to |
options.x | Boolean | Pass as |
options.y | Boolean | Pass as |
A promise which is resolved when the target has been scrolled into view.
Zooms the timeline by incrementing the hourHeight by the requested pixel delta.
| Parameter | Type | Description |
|---|---|---|
reqDelta | Number | The number of pixels by which to increment the hourHeight |
zoomCenter | Number | String | The center time to zoom in to. This may be a number of pixels
down the DayView viewport, or it may be a time to use as the center in the format Note that this will usually require a layout update which happens in the next animation frame so to postprocess the new state of the view, the returned Promise must be awaited. |
Zooms the timeline by setting the hourHeight to the requested pixel value.
| Parameter | Type | Description |
|---|---|---|
newHourHeight | Number | The new hourHeight in pixels. |
zoomCenter | Number | String | The center time to zoom in to. This may be a number of pixels
down the DayView viewport, or it may be a time to use as the center in the format Note that this will usually require a layout update which happens in the next animation frame so to postprocess the new state of the view, the returned Promise must be awaited. |
Zooms to fit all visible events within the vertical scroll viewport.
| Parameter | Type | Description |
|---|---|---|
options | Object | How to scroll. |
options.edgeOffset | Number | edgeOffset A margin around the target to bring into view. |
options.animate | Object | Boolean | Number | Set to |
options.animate.duration | Number | The number of milliseconds to animate over. |
options.animate.easing | String | The name of an easing function. |
A promise which is resolved when the target has been scrolled into view.
Configuration
Events
Misc
Widget hierarchy
Events
35
Events
35Fires when this DayView changes an aspect of its layout. This happens when changing hourHeight, minDayWidth, and when the available day container height changes.
// Adding a listener using the "on" method
dayView.on('layoutUpdate', ({ source }) => {
});| Parameter | Type | Description |
|---|---|---|
source | DayView | The triggering instance. |
Fires when this DayView refreshes.
// Adding a listener using the "on" method
dayView.on('refresh', ({ source }) => {
});| Parameter | Type | Description |
|---|---|---|
source | DayView | The triggering instance. |
Triggered when changing the hourHeight causes an hour height breakpoint to be crossed and the displayed subTick intervals in the time axis change.
// Adding a listener using the "on" method
dayView.on('tickChange', ({ old, old.level, old.step, new, new.level, new.step }) => {
});| Parameter | Type | Description |
|---|---|---|
old | Object | The old hour height tick resolution object. |
old.level | Number | The level |
old.step | String | The time duration of visible subTicks. This is a string in the format required by parseDuration |
new | Object | The new hour height tick resolution object. |
new.level | Number | The level |
new.step | String | The time duration of visible subTicks. This is a string in the format required by parseDuration |
Fired when a time axis is clicked on. If the handler returns
false the current pointer event is not processed further.
// Adding a listener using the "on" method
dayView.on('timeAxisClick', ({ domEvent, preciseTime, time }) => {
});| Parameter | Type | Description |
|---|---|---|
domEvent | Event | The triggering DOM event. |
preciseTime | Date | The exact date and time at the clicked position |
time | Date | The date and time at the clicked position snapped according to the increment and timeSnapType |
Event handlers
35
Event handlers
35Called when this DayView changes an aspect of its layout. This happens when changing hourHeight, minDayWidth, and when the available day container height changes.
new DayView({
onLayoutUpdate({ source }) {
}
});| Parameter | Type | Description |
|---|---|---|
source | DayView | The triggering instance. |
Called when this DayView refreshes.
new DayView({
onRefresh({ source }) {
}
});| Parameter | Type | Description |
|---|---|---|
source | DayView | The triggering instance. |
Called when changing the hourHeight causes an hour height breakpoint to be crossed and the displayed subTick intervals in the time axis change.
new DayView({
onTickChange({ old, new }) {
}
});| Parameter | Type | Description |
|---|---|---|
old | Object | The old hour height tick resolution object. |
old.level | Number | The level |
old.step | String | The time duration of visible subTicks. This is a string in the format required by parseDuration |
new | Object | The new hour height tick resolution object. |
new.level | Number | The level |
new.step | String | The time duration of visible subTicks. This is a string in the format required by parseDuration |
Called when a time axis is clicked on. If the handler returns
false the current pointer event is not processed further.
new DayView({
onTimeAxisClick({ domEvent, preciseTime, time }) {
}
});| Parameter | Type | Description |
|---|---|---|
domEvent | Event | The triggering DOM event. |
preciseTime | Date | The exact date and time at the clicked position |
time | Date | The date and time at the clicked position snapped according to the increment and timeSnapType |
Typedefs
13
Typedefs
13An object which describes the properties of action buttons injected into event blocks.
| Parameter | Type | Description |
|---|---|---|
cls | String | A class name to add to the button element. It may be of the form
|
tooltip | String | The tooltip to show when the button is hovered. |
handler | String | function | A function, or the name of a function in the ownership hierarchy to call when the button is clicked. |
| Parameter | Type | Description |
|---|---|---|
intraDayEvents | EventModel[] | The events that occur within a single day (not spanning multiple days). These are the events that have specific start and end times within the same day. |
allEvents | EventModel[] | A combined array containing both intraDayEvents and allDayEvents. This provides a complete list of all events for the given date. |
allDayEvents | EventModel[] | The events that span the entire day (all-day events). These are events that are marked as all-day events or events that span multiple days. |
An object which contains properties which encapsulate hour height breakpoints which dictate when intervening time indicators are introduced into the DayView's time axis.
| Parameter | Type | Description |
|---|---|---|
thirty | Number | The height at which half hour time is displayed. |
fifteen | Number | The height at which all fifteen minute times are displayed. |
ten | Number | The height at which all ten minute times are displayed. |
five | Number | The height at which all five minute times are displayed. |
CSS variables
82
CSS variables
82| Name | Description |
|---|---|
--b-day-view-event-desc-line-height | Line height for the event description in the day view. |
--b-day-view-event-body-padding | Padding for the event body in the day view. |
--b-day-view-event-border-inline-start-width | Width of the border at the start of the event in the day view. |
--b-day-view-event-border-radius | Border radius for events in the day view. |
--b-day-view-event-name-line-height | Line height for the event name in the day view. |
--b-day-view-split-width | Width of the split line in the day view. |
--b-day-view-all-day-height-transition-duration | Transition duration for the height of all-day view. |
--b-day-view-border-color | Border color for the day view. |
--b-day-view-hour-line-color | Color for hour lines in the day view. |
--b-day-view-half-hour-line-color | Color for half-hour lines in the day view. |
--b-day-view-outside-core-hours-color | Color for outside core hours in the day view. |
--b-day-view-foreground-color | Foreground color for the day view. |
--b-day-view-inset-background | Background color for insets in the day view. |
--b-day-view-time-axis-color | Color for the time axis in the day view. |
--b-day-view-time-axis-hour-color | Color for the hour markers on the time axis in the day view. |
--b-day-view-non-working-day-background | Background for non-working days in the day view. |
--b-day-view-time-indicator-color | Color for the current time indicator in the day view. |
--b-day-view-background | Background color for the day view. |
--b-day-view-today-background | Background color for today in the day view. |
--b-day-view-day-change-line-color | Color of the day change line when dayStartShift is used |
--b-day-view-event-color | Default color for events in the day view. |
--b-day-view-event-border-inline-start-color | Color of the border at the start of the event in the day view. |
--b-day-view-body-background | Background color for the body of an event in the day view. |
| Focused | |
--b-day-view-focus-outline-color | Color of the focus outline for an event in the day view, when using keyboard navigation. |
| Hovered | |
--b-day-view-body-hover-mask-color | Color used to darken the body of an event on hover in the day view. |
--b-day-view-resource-avatar-hover-scale | Scale factor for resource avatars on hover in the day view. |
--b-day-view-event-hover-body-background | Background color for the body of an hovered event in the day view. |
| Selected | |
--b-day-view-body-selected-mask-color | Color used to darken the body of an event using custom coloring when selected in the day view. |
--b-day-view-event-selected-color | Text color for an event in the day view when selected |
--b-day-view-event-selected-body-background | Background color for the body of a selected event in the day view. |