CalendarEditor

A widget allowing to edit the provided calendar.

The widget contains a tab panel with three tabs "General", "Exceptions" and "Weeks" (the tab panel itself has mainTabs widget ref).

Tab ref Type Text Weight Description
generalTab Container General 100 Calendar name, parent fields and a date picker displaying dates availability.
exceptionTab CalendarEditorExceptionTab Exceptions 200 Contains the calendar exception grid and editor.
weekTab CalendarEditorWeekTab Weeks 300 Contains the calendar week grid and editor.

Besides that, there is a bottom toolbar with Save, Delete and Cancel buttons having (ref : saveButton, weight : 200), (ref : removeButton, weight : 300) and (ref : cancelButton, weight : 400) respectively.

Calendar editor
//<code-header>
fiddle.title = 'Calendar editor';
//</code-header>
const schedulerPro = new SchedulerPro({
    appendTo : targetElement,
    flex     : '1 0 100%',
    // Project contains all the data and is responsible for correct scheduling
    project  : {
        calendar : 1,

        calendars : [{
            id                       : 1,
            name                     : 'Project Calendar',
            unspecifiedTimeIsWorking : true,
            intervals                : [
                {
                    recurrentStartDate : 'on Sat',
                    recurrentEndDate   : 'on Mon',
                    isWorking          : false
                },
                {
                    name      : 'Day-off',
                    startDate : '2023-12-13',
                    endDate   : '2023-12-14',
                    isWorking : false
                }
            ]
        }],

        events : [{
            id       : 1,
            name     : 'Write docs',
            expanded : true,
            children : [
                { id : 2, name : 'Proof-read docs', startDate : '2023-12-12', duration : 3 },
                { id : 3, name : 'Release docs', startDate : '2023-12-19', duration : 5 }
            ]
        }],

        resources : [
            { id : 1, name : 'Albert' },
            { id : 2, name : 'Bill' }
        ],

        assignments : [
            { event : 2, resource : 1 },
            { event : 3, resource : 2 }
        ]
    },
    startDate : new Date(2023, 11, 11),
    endDate   : new Date(2023, 11, 31),
    height    : 250,
    tbar      : [{
        type : 'button',
        icon : 'fa-calendar',
        text : 'Edit Project Calendar',
        async onAction() {
            // wait till project finished its calculations
            await schedulerPro.project.commitAsync();
            // scheduler might be destroyed during the commit
            if (schedulerPro.isDestroyed) {
                return;
            }

            let editor = this.calendarEditor;

            // create calendar editor
            if (!editor)  {
                this.calendarEditor = editor = new CalendarEditor({
                    owner    : schedulerPro,
                    // don't show it right away
                    autoShow : false,
                    modal    : true
                });
            }

            // edit project calendar
            editor.calendar   = schedulerPro.project.calendar;
            editor.activeDate = schedulerPro.visibleDateRange.startDate;
            editor.show();
        }
    }],
    columns : [
        { field : 'name', text : 'Name' }
    ]
});

General tab

"General" tab contains widgets for basic configurations and controls to oversee certain dates availability. The tab contains the following widgets:

  • "Name" (ref : nameField, type : TextField, weight : 10) A text field for editing the calendar name.
  • "Parent" (ref : parentField, type : Combo, weight : 20) A combobox field for editing the calendar parent.
  • "Days are working by default" (ref : unspecifiedTimeIsWorkingField, type : Checkbox, weight : 30) A checkbox allowing to specify whether the calendar allows to work any time by default.
  • (ref : datePickerLegend, type : CalendarEditorLegend, weight : 50) A container displaying legend for the date picker (see next datePicker widget).
  • (ref : datePicker, type : CalendarEditorDatePicker, weight : 60) A special date picker displaying the calendar effect on shown dates. The control basically highlights dates by adding color badges representing the calendar intervals. It does that for the dates affected by the corresponding intervals.
  • (ref : dateInfo, type : CalendarEditorDateInfo, weight : 70) A container that shows availability info for the date selected in the date picker. For the selected date the widget displays both availability and the interval providing it.

Exceptions tab

The "Exceptions" tab allows to specify calendar exceptions - special availability overrides for particular date ranges (like holiday or vacations). The tab contains a grid listing registered exceptions on the left side and a panel allowing to edit the selected exception on the right side.

Widget ref Type Weight Description
grid Grid 10 Exception grid.
panel CalendarEditorExceptionPanel 20 Exception editor.

Weeks tab

The "Weeks" tab allows to specify default weekly availability or weekly availability for specific date ranges. The tab contains a grid listing registered week availability intervals on the left side and a panel allowing to edit the selected interval on the right side.

Widget ref Type Weight Description
grid Grid 10 Week grid.
panel CalendarEditorWeekPanel 20 Week editor.

Configs

124

Common

listenersEvents

Other

A date to display in the date picker.

A calendar to edit.

Default availability ranges to be assigned to a day (or an exception) once it's made working. By default uses 08:00-12:00, 13:00-17:00 ranges.

Specifies days treated as working by default. The config is used when adding a new week. In this case the widget sets the week working days availability with defaultWorkingDayAvailability value.

The value is an object with day indexes (0 - Sunday, 1 - Monday, 2 - Tuesday, 3 - Wednesday, 4 - Thursday, 5 - Friday and 6 - Saturday) used as keys and boolean values (true if the corresponding day is working and false otherwise).

For example:

new CalendarEditor({
    // Sunday is the only non-working day by default
    defaultWorkingDays : {
        0 : false,
        1 : true,
        2 : true,
        3 : true,
        4 : true,
        5 : true,
        6 : true
    },
    ...
});

By default, the config sets 5 working days Monday - Friday with non-working Saturday and Sunday.

columnWidget
defaultFocusContainer
drawerPanel
labelPositionContainer
modalPopup
renditionContainer
resizableResizable
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
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

98

Class hierarchy

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

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

Other

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

Record

recordContainer

State

stateState

Visibility

hiddenWidget
isVisibleWidget

Widget hierarchy

ownerWidget
parentWidget
widgetMapContainer

Functions

76

Other

Saves changes to the calendar. The changes saving could be prevented by the widget if it finds some of the child controls are in invalid state. In that case the method displays a message asking user to fix the data before saving.

ParameterTypeDescription
calendarCalendarModel

Target calendar to save changes to. If not provided the changes are save to the loaded calendar.

Returns: CalendarIntervalModel[] | Boolean -

Returns an array of records saved to the calendar or false if changes are not saved.

addContainer
closePopup
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

22

Event handlers

22

Typedefs

8
WorkingDays: Object<(0|1|2|3|4|5|6), Boolean>

Type object containing working days settings.

Example: Set Sunday and Monday as non-working days:

const workingDays = {
    0 : false,
    1 : false,
    2 : true,
    3 : true,
    4 : true,
    5 : true,
    6 : true
}
ParameterTypeDescription
0Boolean

Indicates if Sunday is a working day

1Boolean

Indicates if Monday is a working day

2Boolean

Indicates if Tuesday is a working day

3Boolean

Indicates if Wednesday is a working day

4Boolean

Indicates if Thursday is a working day

5Boolean

Indicates if Friday is a working day

6Boolean

Indicates if Saturday is a working day

AlignSpecWidget
ColorWidget

CSS variables

62
NameDescription
--b-calendar-editor-non-working-day-backgroundCalendar editor non-working day background color
--b-calendar-editor-working-day-backgroundCalendar editor working day background color