@event-calendar/build 1.5.0 → 2.0.0
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 +91 -59
- package/event-calendar.min.js +2 -2
- package/event-calendar.min.js.map +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ See [demo](https://vkurko.github.io/calendar/) and [changelog](CHANGELOG.md).
|
|
|
4
4
|
|
|
5
5
|
Full-sized drag & drop JavaScript event calendar with resource view:
|
|
6
6
|
|
|
7
|
-
* Lightweight (
|
|
7
|
+
* Lightweight (31kb [br](https://en.wikipedia.org/wiki/Brotli) compressed)
|
|
8
8
|
* Zero-dependency (pre-built bundle)
|
|
9
9
|
* Used on over 70,000 websites with [Bookly](https://wordpress.org/plugins/bookly-responsive-appointment-booking-tool/)
|
|
10
10
|
|
|
@@ -194,8 +194,8 @@ import '@event-calendar/core/index.css';
|
|
|
194
194
|
### Pre-built browser ready bundle
|
|
195
195
|
Include the following lines of code in the `<head>` section of your page:
|
|
196
196
|
```html
|
|
197
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@event-calendar/build@
|
|
198
|
-
<script src="https://cdn.jsdelivr.net/npm/@event-calendar/build@
|
|
197
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@event-calendar/build@2.0.0/event-calendar.min.css">
|
|
198
|
+
<script src="https://cdn.jsdelivr.net/npm/@event-calendar/build@2.0.0/event-calendar.min.js"></script>
|
|
199
199
|
```
|
|
200
200
|
|
|
201
201
|
<details>
|
|
@@ -248,16 +248,16 @@ In Svelte, you can simply update the original `options` object.
|
|
|
248
248
|
## Options
|
|
249
249
|
|
|
250
250
|
### allDayContent
|
|
251
|
-
- Type `
|
|
251
|
+
- Type `Content` or `function`
|
|
252
252
|
- Default `'all-day'`
|
|
253
253
|
|
|
254
254
|
Defines the content that is displayed as a title of the `all-day` slot.
|
|
255
255
|
|
|
256
|
-
This value can be either a
|
|
256
|
+
This value can be either a [Content](#content) or a function that returns content:
|
|
257
257
|
|
|
258
258
|
```js
|
|
259
259
|
function (arg) {
|
|
260
|
-
// return
|
|
260
|
+
// return Content
|
|
261
261
|
}
|
|
262
262
|
```
|
|
263
263
|
`arg` is an object with the following properties:
|
|
@@ -284,24 +284,35 @@ When hidden with `false`, all-day events will not be displayed in `timeGrid`/`re
|
|
|
284
284
|
|
|
285
285
|
### buttonText
|
|
286
286
|
- Type `object` or `function`
|
|
287
|
-
- Default `{
|
|
287
|
+
- Default `{close: 'Close', dayGridMonth: 'month', listDay: 'list', listMonth: 'list', listWeek: 'list', listYear: 'list', resourceTimeGridDay: 'day', resourceTimeGridWeek: 'week', timeGridDay: 'day', timeGridWeek: 'week', today: 'today'}`
|
|
288
|
+
> Views override the default value as follows:
|
|
289
|
+
> - dayGridMonth `function (text) { return {...text, next: 'Next month', prev: 'Previous month'}; }`
|
|
290
|
+
> - listDay `function (text) { return {...text, next: 'Next day', prev: 'Previous day'}; }`
|
|
291
|
+
> - listMonth `function (text) { return {...text, next: 'Next month', prev: 'Previous month'}; }`
|
|
292
|
+
> - listWeek `function (text) { return {...text, next: 'Next week', prev: 'Previous week'}; }`
|
|
293
|
+
> - listYear `function (text) { return {...text, next: 'Next year', prev: 'Previous year'}; }`
|
|
294
|
+
> - resourceTimeGridDay `function (text) { return {...text, next: 'Next day', prev: 'Previous day'}; }`
|
|
295
|
+
> - resourceTimeGridWeek `function (text) { return {...text, next: 'Next week', prev: 'Previous week'}; }`
|
|
296
|
+
> - timeGridDay `function (text) { return {...text, next: 'Next day', prev: 'Previous day'}; }`
|
|
297
|
+
> - timeGridWeek `function (text) { return {...text, next: 'Next week', prev: 'Previous week'}; }`
|
|
298
|
+
|
|
288
299
|
|
|
289
300
|
Text that is displayed in buttons of the header toolbar.
|
|
290
301
|
|
|
291
|
-
This value can be either a plain object with all necessary properties, or a callback function that receives default button
|
|
302
|
+
This value can be either a plain object with all necessary properties, or a callback function that receives default button text object and should return a new one:
|
|
292
303
|
|
|
293
304
|
```js
|
|
294
|
-
function (
|
|
295
|
-
// return new button
|
|
305
|
+
function (text) {
|
|
306
|
+
// return new button text object
|
|
296
307
|
}
|
|
297
308
|
```
|
|
298
309
|
<table>
|
|
299
310
|
<tr>
|
|
300
311
|
<td>
|
|
301
312
|
|
|
302
|
-
`
|
|
313
|
+
`text`
|
|
303
314
|
</td>
|
|
304
|
-
<td>An object with default button
|
|
315
|
+
<td>An object with default button text</td>
|
|
305
316
|
</tr>
|
|
306
317
|
</table>
|
|
307
318
|
|
|
@@ -450,11 +461,11 @@ The current [View](#view-object) object
|
|
|
450
461
|
|
|
451
462
|
Defines the text that is displayed on the calendar’s column headings.
|
|
452
463
|
|
|
453
|
-
This value can be either an object with options for the native JavaScript [Intl.DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat) object, or a callback function that returns formatted string:
|
|
464
|
+
This value can be either an object with options for the native JavaScript [Intl.DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat) object, or a callback function that returns a [Content](#content) with the formatted string:
|
|
454
465
|
|
|
455
466
|
```js
|
|
456
467
|
function (date) {
|
|
457
|
-
// return formatted date string
|
|
468
|
+
// return Content with the formatted date string
|
|
458
469
|
}
|
|
459
470
|
```
|
|
460
471
|
<table>
|
|
@@ -483,8 +494,13 @@ Currently, only the value `true` is supported, which limits the number of events
|
|
|
483
494
|
|
|
484
495
|
Defines the date format of title of the popover created by the [dayMaxEvents](#daymaxevents) option.
|
|
485
496
|
|
|
486
|
-
This value can be either an object with options for the native JavaScript [Intl.DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat) object, or a callback function that returns formatted string:
|
|
497
|
+
This value can be either an object with options for the native JavaScript [Intl.DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat) object, or a callback function that returns a [Content](#content) with the formatted string:
|
|
487
498
|
|
|
499
|
+
```js
|
|
500
|
+
function (date) {
|
|
501
|
+
// return Content with the formatted date string
|
|
502
|
+
}
|
|
503
|
+
```
|
|
488
504
|
### displayEventEnd
|
|
489
505
|
- Type `boolean`
|
|
490
506
|
- Default `true`
|
|
@@ -634,16 +650,16 @@ The current [View](#view-object) object
|
|
|
634
650
|
This is currently an alias for the `eventBackgroundColor`.
|
|
635
651
|
|
|
636
652
|
### eventContent
|
|
637
|
-
- Type `
|
|
653
|
+
- Type `Content` or `function`
|
|
638
654
|
- Default `undefined`
|
|
639
655
|
|
|
640
656
|
Defines the content that is rendered inside an event’s element.
|
|
641
657
|
|
|
642
|
-
This value can be either a
|
|
658
|
+
This value can be either a [Content](#content) or a function that returns content:
|
|
643
659
|
|
|
644
660
|
```js
|
|
645
661
|
function (info) {
|
|
646
|
-
// return
|
|
662
|
+
// return Content
|
|
647
663
|
}
|
|
648
664
|
```
|
|
649
665
|
`info` is an object with the following properties:
|
|
@@ -1287,20 +1303,27 @@ Determines whether the events on the calendar can be dragged.
|
|
|
1287
1303
|
|
|
1288
1304
|
Defines the time-text that is displayed on each event.
|
|
1289
1305
|
|
|
1290
|
-
This value can be either an object with options for the native JavaScript [Intl.DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat) object, or a callback function that returns formatted string:
|
|
1306
|
+
This value can be either an object with options for the native JavaScript [Intl.DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat) object, or a callback function that returns a [Content](#content) with formatted string:
|
|
1291
1307
|
|
|
1292
1308
|
```js
|
|
1293
|
-
function (
|
|
1294
|
-
// return formatted time string
|
|
1309
|
+
function (start, end) {
|
|
1310
|
+
// return Content with the formatted time string
|
|
1295
1311
|
}
|
|
1296
1312
|
```
|
|
1297
1313
|
<table>
|
|
1298
1314
|
<tr>
|
|
1299
1315
|
<td>
|
|
1300
1316
|
|
|
1301
|
-
`
|
|
1317
|
+
`start`
|
|
1302
1318
|
</td>
|
|
1303
|
-
<td>JavaScript Date object
|
|
1319
|
+
<td>JavaScript Date object containing the beginning of the time span to be formatted</td>
|
|
1320
|
+
</tr>
|
|
1321
|
+
<tr>
|
|
1322
|
+
<td>
|
|
1323
|
+
|
|
1324
|
+
`end`
|
|
1325
|
+
</td>
|
|
1326
|
+
<td>JavaScript Date object containing the end of the time span to be formatted</td>
|
|
1304
1327
|
</tr>
|
|
1305
1328
|
</table>
|
|
1306
1329
|
|
|
@@ -1451,11 +1474,11 @@ When set to `false`, the calendar will fetch events any time the view is switche
|
|
|
1451
1474
|
|
|
1452
1475
|
Defines the text on the left side of the day headings in list view.
|
|
1453
1476
|
|
|
1454
|
-
This value can be either an object with options for the native JavaScript [Intl.DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat) object, or a callback function that returns formatted string:
|
|
1477
|
+
This value can be either an object with options for the native JavaScript [Intl.DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat) object, or a callback function that returns a [Content](#content) with the formatted string:
|
|
1455
1478
|
|
|
1456
1479
|
```js
|
|
1457
1480
|
function (date) {
|
|
1458
|
-
// return formatted date string
|
|
1481
|
+
// return Content with the formatted date string
|
|
1459
1482
|
}
|
|
1460
1483
|
```
|
|
1461
1484
|
<table>
|
|
@@ -1474,11 +1497,11 @@ function (date) {
|
|
|
1474
1497
|
|
|
1475
1498
|
Defines the text on the right side of the day headings in list view.
|
|
1476
1499
|
|
|
1477
|
-
This value can be either an object with options for the native JavaScript [Intl.DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat) object, or a callback function that returns formatted string:
|
|
1500
|
+
This value can be either an object with options for the native JavaScript [Intl.DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat) object, or a callback function that returns a [Content](#content) with the formatted string:
|
|
1478
1501
|
|
|
1479
1502
|
```js
|
|
1480
1503
|
function (date) {
|
|
1481
|
-
// return formatted date string
|
|
1504
|
+
// return Content with the formatted date string
|
|
1482
1505
|
}
|
|
1483
1506
|
```
|
|
1484
1507
|
<table>
|
|
@@ -1528,16 +1551,16 @@ For touch devices, the amount of time (in milliseconds) the user must hold down
|
|
|
1528
1551
|
For a more granular configuration, see [eventLongPressDelay](#eventlongpressdelay) and [selectLongPressDelay](#selectlongpressdelay).
|
|
1529
1552
|
|
|
1530
1553
|
### moreLinkContent
|
|
1531
|
-
- Type `
|
|
1554
|
+
- Type `Content` or `function`
|
|
1532
1555
|
- Default `undefined`
|
|
1533
1556
|
|
|
1534
1557
|
Defines the text that is displayed instead of the default `+2 more` created by the [dayMaxEvents](#daymaxevents) option.
|
|
1535
1558
|
|
|
1536
|
-
This value can be either a
|
|
1559
|
+
This value can be either a [Content](#content) or a function that returns content:
|
|
1537
1560
|
|
|
1538
1561
|
```js
|
|
1539
1562
|
function (arg) {
|
|
1540
|
-
// return
|
|
1563
|
+
// return Content
|
|
1541
1564
|
}
|
|
1542
1565
|
```
|
|
1543
1566
|
`arg` is an object with the following properties:
|
|
@@ -1592,16 +1615,16 @@ The current [View](#view-object) object
|
|
|
1592
1615
|
</table>
|
|
1593
1616
|
|
|
1594
1617
|
### noEventsContent
|
|
1595
|
-
- Type `
|
|
1618
|
+
- Type `Content` or `function`
|
|
1596
1619
|
- Default `'No events'`
|
|
1597
1620
|
|
|
1598
1621
|
Defines the text that is displayed in list view when there are no events to display.
|
|
1599
1622
|
|
|
1600
|
-
This value can be either a
|
|
1623
|
+
This value can be either a [Content](#content) or a function that returns content:
|
|
1601
1624
|
|
|
1602
1625
|
```js
|
|
1603
1626
|
function () {
|
|
1604
|
-
// return
|
|
1627
|
+
// return Content
|
|
1605
1628
|
}
|
|
1606
1629
|
```
|
|
1607
1630
|
|
|
@@ -1630,11 +1653,11 @@ Array of plain objects that will be parsed into [Resource](#resource-object) obj
|
|
|
1630
1653
|
|
|
1631
1654
|
Defines the content that is rendered inside an element with a resource title.
|
|
1632
1655
|
|
|
1633
|
-
This value can be either a
|
|
1656
|
+
This value can be either a [Content](#content) or a function that returns content:
|
|
1634
1657
|
|
|
1635
1658
|
```js
|
|
1636
1659
|
function (info) {
|
|
1637
|
-
// return
|
|
1660
|
+
// return Content
|
|
1638
1661
|
}
|
|
1639
1662
|
```
|
|
1640
1663
|
`info` is an object with the following properties:
|
|
@@ -1847,11 +1870,11 @@ Defines the time slot height in pixels. When changing the setting, you must addi
|
|
|
1847
1870
|
|
|
1848
1871
|
Defines the text that will be displayed within a time slot.
|
|
1849
1872
|
|
|
1850
|
-
This value can be either an object with options for the native JavaScript [Intl.DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat) object, or a callback function that returns formatted string:
|
|
1873
|
+
This value can be either an object with options for the native JavaScript [Intl.DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat) object, or a callback function that returns a [Content](#content) with the formatted string:
|
|
1851
1874
|
|
|
1852
1875
|
```js
|
|
1853
1876
|
function (time) {
|
|
1854
|
-
// return formatted time string
|
|
1877
|
+
// return Content with the formatted time string
|
|
1855
1878
|
}
|
|
1856
1879
|
```
|
|
1857
1880
|
<table>
|
|
@@ -1912,23 +1935,40 @@ function (theme) {
|
|
|
1912
1935
|
|
|
1913
1936
|
Defines the text that is displayed in the header toolbar’s title.
|
|
1914
1937
|
|
|
1915
|
-
This value can be either an object with options for the native JavaScript [Intl.DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat) object, or a callback function that returns formatted string:
|
|
1938
|
+
This value can be either an object with options for the native JavaScript [Intl.DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat) object, or a callback function that returns a [Content](#content) with the formatted string:
|
|
1916
1939
|
|
|
1917
1940
|
```js
|
|
1918
|
-
function (
|
|
1919
|
-
// return formatted date string
|
|
1941
|
+
function (start, end) {
|
|
1942
|
+
// return Content with the formatted date string
|
|
1920
1943
|
}
|
|
1921
1944
|
```
|
|
1922
1945
|
<table>
|
|
1923
1946
|
<tr>
|
|
1924
1947
|
<td>
|
|
1925
1948
|
|
|
1926
|
-
`
|
|
1949
|
+
`start`
|
|
1927
1950
|
</td>
|
|
1928
|
-
<td>JavaScript Date object
|
|
1951
|
+
<td>JavaScript Date object containing the beginning of the time span to be formatted</td>
|
|
1952
|
+
</tr>
|
|
1953
|
+
<tr>
|
|
1954
|
+
<td>
|
|
1955
|
+
|
|
1956
|
+
`end`
|
|
1957
|
+
</td>
|
|
1958
|
+
<td>JavaScript Date object containing the end of the time span to be formatted</td>
|
|
1929
1959
|
</tr>
|
|
1930
1960
|
</table>
|
|
1931
1961
|
|
|
1962
|
+
The callback function can return HTML markup. If you want to use HTML entities in the title, you must use the callback function:
|
|
1963
|
+
|
|
1964
|
+
```js
|
|
1965
|
+
function (date) {
|
|
1966
|
+
let month = date.toLocaleDateString('en-US', { month: 'long' })
|
|
1967
|
+
let year = date.toLocaleDateString('en-US', { year: 'numeric' })
|
|
1968
|
+
return `<span class="month">${month}</span> <span class="year">${year}</span>`
|
|
1969
|
+
}
|
|
1970
|
+
```
|
|
1971
|
+
|
|
1932
1972
|
### unselect
|
|
1933
1973
|
- Type `function`
|
|
1934
1974
|
- Default `undefined`
|
|
@@ -2178,6 +2218,13 @@ Returns the [View](#view-object) object for the current view.
|
|
|
2178
2218
|
|
|
2179
2219
|
Clears the current selection. See [selectable](#selectable).
|
|
2180
2220
|
|
|
2221
|
+
## Content
|
|
2222
|
+
The content can be presented in the following forms:
|
|
2223
|
+
|
|
2224
|
+
* a string containing text `'some text'`
|
|
2225
|
+
* an object containing the HTML string `{html: '<p>some HTML</p>'}`
|
|
2226
|
+
* an object containing an array of DOM nodes `{domNodes: [node1, node2, ...]}`
|
|
2227
|
+
|
|
2181
2228
|
## Event object
|
|
2182
2229
|
This is a JavaScript object that the Event Calendar uses to store information about a calendar event.
|
|
2183
2230
|
|
|
@@ -2225,14 +2272,9 @@ Here are all properties that exist in Event object:
|
|
|
2225
2272
|
|
|
2226
2273
|
`title`
|
|
2227
2274
|
</td>
|
|
2228
|
-
<td>The text appearing on the event</td>
|
|
2229
|
-
</tr>
|
|
2230
|
-
<tr>
|
|
2231
2275
|
<td>
|
|
2232
2276
|
|
|
2233
|
-
|
|
2234
|
-
</td>
|
|
2235
|
-
<td>The HTML version of the title</td>
|
|
2277
|
+
The text appearing on the event. See [Content](#content)</td>
|
|
2236
2278
|
</tr>
|
|
2237
2279
|
<tr>
|
|
2238
2280
|
<td>
|
|
@@ -2380,17 +2422,7 @@ Here are all admissible fields for the event’s input object:
|
|
|
2380
2422
|
</td>
|
|
2381
2423
|
<td>
|
|
2382
2424
|
|
|
2383
|
-
`
|
|
2384
|
-
</td>
|
|
2385
|
-
</tr>
|
|
2386
|
-
<tr>
|
|
2387
|
-
<td>
|
|
2388
|
-
|
|
2389
|
-
`titleHTML`
|
|
2390
|
-
</td>
|
|
2391
|
-
<td>
|
|
2392
|
-
|
|
2393
|
-
`string` The HTML version of the title to be displayed instead of the text version. Default `''`
|
|
2425
|
+
`Content` The text that will appear on the event. See [Content](#content). Default `''`
|
|
2394
2426
|
</td>
|
|
2395
2427
|
</tr>
|
|
2396
2428
|
<tr>
|