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.
//<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 nextdatePickerwidget). - (
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
Configs
124Common
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.
Content
CSS
DOM
Float & align
Layout
misc
Misc
Scrolling
Properties
98
Properties
98Class hierarchy
CSS
DOM
Layout
Misc
Other
State
Widget hierarchy
Functions
76
Functions
76Other
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.
| Parameter | Type | Description |
|---|---|---|
calendar | CalendarModel | Target calendar to save changes to. If not provided the changes are save to the loaded calendar. |
Returns an array of records
saved to the calendar or false if changes are not saved.
Configuration
Events
Misc
Widget hierarchy
Events
22
Events
22Event handlers
22
Event handlers
22Typedefs
8
Typedefs
8Type 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
}
| Parameter | Type | Description |
|---|---|---|
0 | Boolean | Indicates if Sunday is a working day |
1 | Boolean | Indicates if Monday is a working day |
2 | Boolean | Indicates if Tuesday is a working day |
3 | Boolean | Indicates if Wednesday is a working day |
4 | Boolean | Indicates if Thursday is a working day |
5 | Boolean | Indicates if Friday is a working day |
6 | Boolean | Indicates if Saturday is a working day |
CSS variables
62
CSS variables
62| Name | Description |
|---|---|
--b-calendar-editor-non-working-day-background | Calendar editor non-working day background color |
--b-calendar-editor-working-day-background | Calendar editor working day background color |