@event-calendar/core 5.2.4 → 5.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -105,6 +105,7 @@ Inspired by [FullCalendar](https://fullcalendar.io/), it implements similar opti
105
105
  </td><td>
106
106
 
107
107
  - [pointer](#pointer)
108
+ - [refetchResourcesOnNavigate](#refetchresourcesonnavigate)
108
109
  - [resizeConstraint](#resizeconstraint)
109
110
  - [resources](#resources)
110
111
  - [resourceLabelContent](#resourcelabelcontent)
@@ -151,7 +152,10 @@ Inspired by [FullCalendar](https://fullcalendar.io/), it implements similar opti
151
152
  - [getEvents](#getevents)
152
153
  - [removeEventById](#removeeventbyid-id-)
153
154
  - [updateEvent](#updateevent-event-)
155
+ </td><td>
156
+
154
157
  - [refetchEvents](#refetchevents)
158
+ - [refetchResources](#refetchresources)
155
159
  </td><td>
156
160
 
157
161
  - [dateFromPoint](#datefrompoint-x-y-)
@@ -247,8 +251,8 @@ This bundle contains a version of the calendar that includes all plugins and is
247
251
 
248
252
  The first step is to include the following lines of code in the `<head>` section of your page:
249
253
  ```html
250
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@event-calendar/build@5.2.4/dist/event-calendar.min.css">
251
- <script src="https://cdn.jsdelivr.net/npm/@event-calendar/build@5.2.4/dist/event-calendar.min.js"></script>
254
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@event-calendar/build@5.3.1/dist/event-calendar.min.css">
255
+ <script src="https://cdn.jsdelivr.net/npm/@event-calendar/build@5.3.1/dist/event-calendar.min.js"></script>
252
256
  ```
253
257
 
254
258
  <details>
@@ -774,7 +778,7 @@ If you don't need both, use the more specific [eventStartEditable](#eventstarted
774
778
  - Type `array`
775
779
  - Default `[]`
776
780
 
777
- Array of plain objects that will be parsed into [Event](#event-object) objects and displayed on the calendar.
781
+ Array of plain objects that will be [parsed](#parsing-event-from-a-plain-object) into [Event](#event-object) objects and displayed on the calendar.
778
782
 
779
783
  This option is not used if the `eventSources` option is provided.
780
784
 
@@ -1551,7 +1555,7 @@ This option is used instead of the `events` option.
1551
1555
  </td>
1552
1556
  <td>
1553
1557
 
1554
- A URL that the calendar will fetch [Event](#event-object) objects from. HTTP requests with the following parameters will be sent to this URL whenever the calendar needs new event data:
1558
+ A URL from which the calendar will fetch an array of [parsable](#parsing-event-from-a-plain-object) [Event](#event-object) objects in JSON format. HTTP requests with the following parameters will be sent to this URL whenever the calendar needs new event data:
1555
1559
  <table>
1556
1560
  <tr>
1557
1561
  <td>
@@ -1642,7 +1646,7 @@ function(fetchInfo, successCallback, failureCallback) { }
1642
1646
  </tr>
1643
1647
  </table>
1644
1648
 
1645
- The `successCallback` function must be called by the custom function with an array of parsable [Event](#event-object) objects.
1649
+ The `successCallback` function must be called by the custom function with an array of [parsable](#parsing-event-from-a-plain-object) [Event](#event-object) objects.
1646
1650
 
1647
1651
  If there is any failure (e.g., if an AJAX request fails), then call the `failureCallback` instead. It accepts an argument with information about the failure.
1648
1652
 
@@ -1706,7 +1710,7 @@ Determines whether events that do not belong to the current array of [resources]
1706
1710
  - Type `boolean`
1707
1711
  - Default `false`
1708
1712
 
1709
- Determines whether resources with no events for the current range should be hidden in the resource view.
1713
+ Determines whether resources with no events for the current range should be hidden in the resource view. Background events are not taken into account.
1710
1714
 
1711
1715
  ### firstDay
1712
1716
  - Type `integer`
@@ -1829,11 +1833,13 @@ Each date can be either an ISO8601 date string like `'2026-12-31'`, or a JavaScr
1829
1833
  - Type `boolean`
1830
1834
  - Default `true`
1831
1835
 
1832
- Determines when event fetching should occur.
1836
+ Determines when event and resource fetching should occur.
1833
1837
 
1834
1838
  When set to `true` (the default), the calendar will only fetch events when it absolutely needs to, minimizing HTTP requests. For example, say your calendar starts out in month view, in February. EventCalendar will fetch events for the entire month of February and store them in its internal storage. Then, say the user switches to week view and begins browsing the weeks in February. The calendar will avoid fetching events because it already has this information stored.
1835
1839
 
1836
- When set to `false`, the calendar will fetch events any time the view is switched, or any time the current date changes (for example, as a result of the user clicking prev/next).
1840
+ When set to `false`, the calendar will fetch events any time the current date changes (for example, as a result of the user clicking prev/next).
1841
+
1842
+ This also applies to resources if [refetchResourcesOnNavigate](#refetchresourcesonnavigate) is enabled.
1837
1843
 
1838
1844
  ### listDayFormat
1839
1845
  - Type `object` or `function`
@@ -1885,7 +1891,7 @@ function (date) {
1885
1891
  - Type `function`
1886
1892
  - Default `undefined`
1887
1893
 
1888
- Callback function that is triggered when event fetching starts/stops.
1894
+ Callback function that is triggered when event or resource fetching starts/stops.
1889
1895
 
1890
1896
  ```js
1891
1897
  function (isLoading) { }
@@ -1898,7 +1904,7 @@ function (isLoading) { }
1898
1904
  </td>
1899
1905
  <td>
1900
1906
 
1901
- `true` when the calendar begins fetching events, `false` when it’s done.
1907
+ `true` when the calendar begins fetching events or resources, `false` when it’s done.
1902
1908
  </td>
1903
1909
  </tr>
1904
1910
  </table>
@@ -2008,6 +2014,12 @@ Enables a marker indicating the current time in `timeGrid`/`resourceTimeGrid` vi
2008
2014
 
2009
2015
  Enables mouse cursor pointer in `timeGrid`/`resourceTimeGrid` and other views.
2010
2016
 
2017
+ ### refetchResourcesOnNavigate
2018
+ - Type `boolean`
2019
+ - Default `false`
2020
+
2021
+ Determines whether to refetch [resources](#resources) when the user navigates to a different date.
2022
+
2011
2023
  ### resizeConstraint
2012
2024
  - Type `function`
2013
2025
  - Default `undefined`
@@ -2018,10 +2030,112 @@ Callback function that limits the date/time range within which the event is allo
2018
2030
  The function is triggered during resizing for each cursor movement and takes the same parameters as [eventResize](#eventresize). The function should return `true` if the new size is allowed, and `false` otherwise.
2019
2031
 
2020
2032
  ### resources
2021
- - Type `array`
2033
+ - Type `array`, `object` or `function`
2022
2034
  - Default `[]`
2023
2035
 
2024
- Array of plain objects that will be parsed into [Resource](#resource-object) objects for displaying in the resource view.
2036
+ Defines the source of resource data displayed in resource views. It can be provided in one of three ways:
2037
+
2038
+ #### 1. Array of plain objects
2039
+ If the resources are predefined and do not change, then pass them as an array of plain objects. The provided plain objects will be [parsed]((#parsing-resource-from-a-plain-object)) into [Resource](#resource-object) objects.
2040
+
2041
+ #### 2. Fetch resources from a URL
2042
+ To make the calendar load resources from a URL, specify `resources` option as an object with the following properties:
2043
+ <table>
2044
+ <tr>
2045
+ <td>
2046
+
2047
+ `url`
2048
+ </td>
2049
+ <td>
2050
+
2051
+ A URL from which the calendar will fetch an array of [parsable](#parsing-resource-from-a-plain-object) [Resource](#resource-object) objects in JSON format. If [refetchResourcesOnNavigate](#refetchresourcesonnavigate) is enabled then HTTP requests with the following parameters will be sent to the URL whenever the user navigates to a different date:
2052
+ <table>
2053
+ <tr>
2054
+ <td>
2055
+
2056
+ `start`
2057
+ </td>
2058
+ <td>
2059
+ Start date of the range the calendar needs resources for
2060
+ </td>
2061
+ </tr>
2062
+ <tr>
2063
+ <td>
2064
+
2065
+ `end`
2066
+ </td>
2067
+ <td>
2068
+ End date of the range the calendar needs resources for
2069
+ </td>
2070
+ </tr>
2071
+ </table>
2072
+ </td>
2073
+ </tr>
2074
+ <tr>
2075
+ <td>
2076
+
2077
+ `method`
2078
+ </td>
2079
+ <td>
2080
+
2081
+ HTTP request method. Default `'GET'`
2082
+ </td>
2083
+ </tr>
2084
+ <tr>
2085
+ <td>
2086
+
2087
+ `extraParams`
2088
+ </td>
2089
+ <td>
2090
+
2091
+ Other GET/POST data you want to send to the server. Can be a plain object or a function that returns an object. Default `{}`
2092
+ </td>
2093
+ </tr>
2094
+ </table>
2095
+
2096
+ #### 3. Execute custom function
2097
+ You can also specify `resources` as a custom function that provides resource data.
2098
+ ```js
2099
+ function(fetchInfo, successCallback, failureCallback) { }
2100
+ ```
2101
+ If [refetchResourcesOnNavigate](#refetchresourcesonnavigate) is enabled, the function will be called every time the user navigates to a different date. In this case,
2102
+ `fetchInfo` will be an object with the following properties (it is an empty object otherwise):
2103
+ <table>
2104
+ <tr>
2105
+ <td>
2106
+
2107
+ `start`
2108
+ </td>
2109
+ <td>JavaScript Date object for the beginning of the range the calendar needs resources for</td>
2110
+ </tr>
2111
+ <tr>
2112
+ <td>
2113
+
2114
+ `end`
2115
+ </td>
2116
+ <td>JavaScript Date object for the end of the range the calendar needs resources for. Note: This value is exclusive</td>
2117
+ </tr>
2118
+ <tr>
2119
+ <td>
2120
+
2121
+ `startStr`
2122
+ </td>
2123
+ <td>ISO8601 string representation of the start date</td>
2124
+ </tr>
2125
+ <tr>
2126
+ <td>
2127
+
2128
+ `endStr`
2129
+ </td>
2130
+ <td>ISO8601 string representation of the end date</td>
2131
+ </tr>
2132
+ </table>
2133
+
2134
+ The `successCallback` function must be called by the custom function with an array of [parsable](#parsing-resource-from-a-plain-object) [Resource](#resource-object) objects.
2135
+
2136
+ If there is any failure (e.g., if an AJAX request fails), then call the `failureCallback` instead. It accepts an argument with information about the failure.
2137
+
2138
+ Instead of calling `successCallback` and `failureCallback`, you may return the resulting array of resources or return a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) (or [thenable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/resolve)) object instead.
2025
2139
 
2026
2140
  ### resourceLabelContent
2027
2141
  - Type `string`, `object`or `function`
@@ -2670,7 +2784,12 @@ Updates a single event with the matching `event`.`id`.
2670
2784
  ### refetchEvents()
2671
2785
  - Return value `EventCalendar` The calendar instance for chaining
2672
2786
 
2673
- Refetches events from all sources.
2787
+ Refetches events from all [sources](#eventsources).
2788
+
2789
+ ### refetchResources()
2790
+ - Return value `EventCalendar` The calendar instance for chaining
2791
+
2792
+ Refetches [resources](#resources) from URL or custom function.
2674
2793
 
2675
2794
  ### dateFromPoint( x, y )
2676
2795
  - Return value `object` or `null`
package/dist/index.css CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * EventCalendar v5.2.4
2
+ * EventCalendar v5.3.1
3
3
  * https://github.com/vkurko/calendar
4
4
  */
5
5
  .ec {