API overview
Event Calendar constructor
new eventCalendar.EventCalendar("#root", {
// configuration parameters
});
Parameters:
- an HTML container (the ID of the HTML container)
- an object of the configuration parameters (check here)
Event Calendar methods
| Name | Description |
|---|---|
| addCalendar() | Adds a new calendar |
| addEvent() | Adds a new event (without opening an editor) |
| closeEditor() | Closes an editor |
| createEvent() | Creates a new event and opens an editor |
| deleteCalendar() | Removes a calendar by its ID |
| deleteEvent() | Removes an event by its ID |
| destructor() | Removes all HTML elements of Event Calendar, and detaches all related events |
| getCalendar() | Gets an object of the calendar data by its ID |
| getEvent() | Gets an object of the event data by its ID |
| hideEventInfo() | Hides an info popup window |
| openEditor() | Opens an editor for an event by its ID |
| parse() | Parses data into Event Calendar (for events and calendars) |
| serialize() | Serializes Event Calendar data to JSON |
| setConfig() | Sets the config parameters of Event Calendar |
| setDate() | Sets a current date of Event Calendar |
| setLocale() | Applies a new locale to Event Calendar |
| setMode() | Sets a view mode of Event Calendar |
| setTheme() | Sets a theme of Event Calendar |
| showEventInfo() | Shows an info popup for the event by its ID |
| toggleSidebar() | Shows/hides a sidebar |
| updateCalendar() | Updates the calendar data by its ID |
| updateEvent() | Updates the event data by its ID |
Event Calendar internal API
Event Bus methods
| Name | Description |
|---|---|
| api.exec() | Allows triggering the inner events |
| api.intercept() | Allows intercepting and preventing the inner events |
| api.on() | Allows attaching a handler to the inner events |
| api.setNext() | Allows adding some action into the Event Bus order |
State methods
| Name | Description |
|---|---|
| api.getReactiveState() | Gets an object with the reactive properties of the Event Calendar StateStore |
| api.getState() | Gets an object with the current properties of the Event Calendar StateStore |
| api.getStores() | Gets an object with the DataStore of Event Calendar |
Event Calendar events
| Name | Description |
|---|---|
| add-calendar | Fires when adding a new calendar |
| add-event | Fires when adding a new event |
| close-event-info | Fires when closing an event info popup window |
| delete-calendar | Fires when removing a calendar |
| delete-event | Fires when removing an event |
| edit-event | Fires when editing an event |
| select-event | Fires when showing an info popup window |
| set-bound | Fires when making a next/previous step (date) in a calendar |
| set-date | Fires when setting a new date |
| set-mode | Fires when setting a view mode |
| toggle-sidebar | Fires when showing/hiding a sidebar |
| update-calendar | Fires when updating the calendar data |
| update-event | Fires when updating the event data |
Event Calendar properties
| Name | Description |
|---|---|
| calendars | Optional. An array of objects containing the calendars (event types) data |
| colors | Optional. An array of objects containing the parameters of colors used in colorpicker |
| config | Optional. An object of the Event Calendar configuration |
| date | Optional. A selected date of Event Calendar |
| editorShape | Optional. An array of objects containing settings for managing the appearance and functionality of the Event Calendar editor |
| events | Optional. An array of objects containing the events data |
| locale | Optional. An object of the built-in or custom locale |
| mode | Optional. An initial view mode of Event Calendar |
| sidebar | Optional. An object of the sidebar configuration |
| templates | Optional. An object with custom templates of the Event Calendar visual elements |
| theme | Optional. An initial theme of Event Calendar |
RestDataProvider API
RestDataProvider methods
| Name | Description |
|---|---|
| getCalendars() | Gets a promise with the calendars data |
| getEvents() | Gets a promise with the events data |
| send() | Sends a necessary HTTP request to the server and returns a promise with or without data depending on the request |
RestDataProvider routes
| Name | Description |
|---|---|
| GET /calendars | Gets data on all calendars and returns a json object with an array of calendars objects |
| GET /events | Gets data on all events and returns a json object with an array of events objects |
| GET /uploads | Gets the requested binary file from the server |
| POST /events | Creates a new event and returns a json object with the event ID in it |
| POST /calendars | Creates a new calendar (event type) and returns a json object with the calendar ID in it |
| POST /uploads | Uploads a binary file to the server and returns a json object with the file id, name, and url |
| PUT /events | Updates data on an event |
| PUT /calendars | Updates data on a calendar (event type) |
| DELETE /events | Deletes data on an event |
| DELETE /calendars | Deletes data on a calendar (event type) |