@event-calendar/build 1.5.1 → 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 +74 -53
- 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:
|
|
@@ -461,11 +461,11 @@ The current [View](#view-object) object
|
|
|
461
461
|
|
|
462
462
|
Defines the text that is displayed on the calendar’s column headings.
|
|
463
463
|
|
|
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 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:
|
|
465
465
|
|
|
466
466
|
```js
|
|
467
467
|
function (date) {
|
|
468
|
-
// return formatted date string
|
|
468
|
+
// return Content with the formatted date string
|
|
469
469
|
}
|
|
470
470
|
```
|
|
471
471
|
<table>
|
|
@@ -494,8 +494,13 @@ Currently, only the value `true` is supported, which limits the number of events
|
|
|
494
494
|
|
|
495
495
|
Defines the date format of title of the popover created by the [dayMaxEvents](#daymaxevents) option.
|
|
496
496
|
|
|
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 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:
|
|
498
498
|
|
|
499
|
+
```js
|
|
500
|
+
function (date) {
|
|
501
|
+
// return Content with the formatted date string
|
|
502
|
+
}
|
|
503
|
+
```
|
|
499
504
|
### displayEventEnd
|
|
500
505
|
- Type `boolean`
|
|
501
506
|
- Default `true`
|
|
@@ -645,16 +650,16 @@ The current [View](#view-object) object
|
|
|
645
650
|
This is currently an alias for the `eventBackgroundColor`.
|
|
646
651
|
|
|
647
652
|
### eventContent
|
|
648
|
-
- Type `
|
|
653
|
+
- Type `Content` or `function`
|
|
649
654
|
- Default `undefined`
|
|
650
655
|
|
|
651
656
|
Defines the content that is rendered inside an event’s element.
|
|
652
657
|
|
|
653
|
-
This value can be either a
|
|
658
|
+
This value can be either a [Content](#content) or a function that returns content:
|
|
654
659
|
|
|
655
660
|
```js
|
|
656
661
|
function (info) {
|
|
657
|
-
// return
|
|
662
|
+
// return Content
|
|
658
663
|
}
|
|
659
664
|
```
|
|
660
665
|
`info` is an object with the following properties:
|
|
@@ -1298,20 +1303,27 @@ Determines whether the events on the calendar can be dragged.
|
|
|
1298
1303
|
|
|
1299
1304
|
Defines the time-text that is displayed on each event.
|
|
1300
1305
|
|
|
1301
|
-
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:
|
|
1302
1307
|
|
|
1303
1308
|
```js
|
|
1304
|
-
function (
|
|
1305
|
-
// return formatted time string
|
|
1309
|
+
function (start, end) {
|
|
1310
|
+
// return Content with the formatted time string
|
|
1306
1311
|
}
|
|
1307
1312
|
```
|
|
1308
1313
|
<table>
|
|
1309
1314
|
<tr>
|
|
1310
1315
|
<td>
|
|
1311
1316
|
|
|
1312
|
-
`
|
|
1317
|
+
`start`
|
|
1313
1318
|
</td>
|
|
1314
|
-
<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>
|
|
1315
1327
|
</tr>
|
|
1316
1328
|
</table>
|
|
1317
1329
|
|
|
@@ -1462,11 +1474,11 @@ When set to `false`, the calendar will fetch events any time the view is switche
|
|
|
1462
1474
|
|
|
1463
1475
|
Defines the text on the left side of the day headings in list view.
|
|
1464
1476
|
|
|
1465
|
-
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:
|
|
1466
1478
|
|
|
1467
1479
|
```js
|
|
1468
1480
|
function (date) {
|
|
1469
|
-
// return formatted date string
|
|
1481
|
+
// return Content with the formatted date string
|
|
1470
1482
|
}
|
|
1471
1483
|
```
|
|
1472
1484
|
<table>
|
|
@@ -1485,11 +1497,11 @@ function (date) {
|
|
|
1485
1497
|
|
|
1486
1498
|
Defines the text on the right side of the day headings in list view.
|
|
1487
1499
|
|
|
1488
|
-
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:
|
|
1489
1501
|
|
|
1490
1502
|
```js
|
|
1491
1503
|
function (date) {
|
|
1492
|
-
// return formatted date string
|
|
1504
|
+
// return Content with the formatted date string
|
|
1493
1505
|
}
|
|
1494
1506
|
```
|
|
1495
1507
|
<table>
|
|
@@ -1539,16 +1551,16 @@ For touch devices, the amount of time (in milliseconds) the user must hold down
|
|
|
1539
1551
|
For a more granular configuration, see [eventLongPressDelay](#eventlongpressdelay) and [selectLongPressDelay](#selectlongpressdelay).
|
|
1540
1552
|
|
|
1541
1553
|
### moreLinkContent
|
|
1542
|
-
- Type `
|
|
1554
|
+
- Type `Content` or `function`
|
|
1543
1555
|
- Default `undefined`
|
|
1544
1556
|
|
|
1545
1557
|
Defines the text that is displayed instead of the default `+2 more` created by the [dayMaxEvents](#daymaxevents) option.
|
|
1546
1558
|
|
|
1547
|
-
This value can be either a
|
|
1559
|
+
This value can be either a [Content](#content) or a function that returns content:
|
|
1548
1560
|
|
|
1549
1561
|
```js
|
|
1550
1562
|
function (arg) {
|
|
1551
|
-
// return
|
|
1563
|
+
// return Content
|
|
1552
1564
|
}
|
|
1553
1565
|
```
|
|
1554
1566
|
`arg` is an object with the following properties:
|
|
@@ -1603,16 +1615,16 @@ The current [View](#view-object) object
|
|
|
1603
1615
|
</table>
|
|
1604
1616
|
|
|
1605
1617
|
### noEventsContent
|
|
1606
|
-
- Type `
|
|
1618
|
+
- Type `Content` or `function`
|
|
1607
1619
|
- Default `'No events'`
|
|
1608
1620
|
|
|
1609
1621
|
Defines the text that is displayed in list view when there are no events to display.
|
|
1610
1622
|
|
|
1611
|
-
This value can be either a
|
|
1623
|
+
This value can be either a [Content](#content) or a function that returns content:
|
|
1612
1624
|
|
|
1613
1625
|
```js
|
|
1614
1626
|
function () {
|
|
1615
|
-
// return
|
|
1627
|
+
// return Content
|
|
1616
1628
|
}
|
|
1617
1629
|
```
|
|
1618
1630
|
|
|
@@ -1641,11 +1653,11 @@ Array of plain objects that will be parsed into [Resource](#resource-object) obj
|
|
|
1641
1653
|
|
|
1642
1654
|
Defines the content that is rendered inside an element with a resource title.
|
|
1643
1655
|
|
|
1644
|
-
This value can be either a
|
|
1656
|
+
This value can be either a [Content](#content) or a function that returns content:
|
|
1645
1657
|
|
|
1646
1658
|
```js
|
|
1647
1659
|
function (info) {
|
|
1648
|
-
// return
|
|
1660
|
+
// return Content
|
|
1649
1661
|
}
|
|
1650
1662
|
```
|
|
1651
1663
|
`info` is an object with the following properties:
|
|
@@ -1858,11 +1870,11 @@ Defines the time slot height in pixels. When changing the setting, you must addi
|
|
|
1858
1870
|
|
|
1859
1871
|
Defines the text that will be displayed within a time slot.
|
|
1860
1872
|
|
|
1861
|
-
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:
|
|
1862
1874
|
|
|
1863
1875
|
```js
|
|
1864
1876
|
function (time) {
|
|
1865
|
-
// return formatted time string
|
|
1877
|
+
// return Content with the formatted time string
|
|
1866
1878
|
}
|
|
1867
1879
|
```
|
|
1868
1880
|
<table>
|
|
@@ -1923,23 +1935,40 @@ function (theme) {
|
|
|
1923
1935
|
|
|
1924
1936
|
Defines the text that is displayed in the header toolbar’s title.
|
|
1925
1937
|
|
|
1926
|
-
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:
|
|
1927
1939
|
|
|
1928
1940
|
```js
|
|
1929
|
-
function (
|
|
1930
|
-
// return formatted date string
|
|
1941
|
+
function (start, end) {
|
|
1942
|
+
// return Content with the formatted date string
|
|
1931
1943
|
}
|
|
1932
1944
|
```
|
|
1933
1945
|
<table>
|
|
1934
1946
|
<tr>
|
|
1935
1947
|
<td>
|
|
1936
1948
|
|
|
1937
|
-
`
|
|
1949
|
+
`start`
|
|
1938
1950
|
</td>
|
|
1939
|
-
<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>
|
|
1940
1959
|
</tr>
|
|
1941
1960
|
</table>
|
|
1942
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
|
+
|
|
1943
1972
|
### unselect
|
|
1944
1973
|
- Type `function`
|
|
1945
1974
|
- Default `undefined`
|
|
@@ -2189,6 +2218,13 @@ Returns the [View](#view-object) object for the current view.
|
|
|
2189
2218
|
|
|
2190
2219
|
Clears the current selection. See [selectable](#selectable).
|
|
2191
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
|
+
|
|
2192
2228
|
## Event object
|
|
2193
2229
|
This is a JavaScript object that the Event Calendar uses to store information about a calendar event.
|
|
2194
2230
|
|
|
@@ -2236,14 +2272,9 @@ Here are all properties that exist in Event object:
|
|
|
2236
2272
|
|
|
2237
2273
|
`title`
|
|
2238
2274
|
</td>
|
|
2239
|
-
<td>The text appearing on the event</td>
|
|
2240
|
-
</tr>
|
|
2241
|
-
<tr>
|
|
2242
2275
|
<td>
|
|
2243
2276
|
|
|
2244
|
-
|
|
2245
|
-
</td>
|
|
2246
|
-
<td>The HTML version of the title</td>
|
|
2277
|
+
The text appearing on the event. See [Content](#content)</td>
|
|
2247
2278
|
</tr>
|
|
2248
2279
|
<tr>
|
|
2249
2280
|
<td>
|
|
@@ -2391,17 +2422,7 @@ Here are all admissible fields for the event’s input object:
|
|
|
2391
2422
|
</td>
|
|
2392
2423
|
<td>
|
|
2393
2424
|
|
|
2394
|
-
`
|
|
2395
|
-
</td>
|
|
2396
|
-
</tr>
|
|
2397
|
-
<tr>
|
|
2398
|
-
<td>
|
|
2399
|
-
|
|
2400
|
-
`titleHTML`
|
|
2401
|
-
</td>
|
|
2402
|
-
<td>
|
|
2403
|
-
|
|
2404
|
-
`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 `''`
|
|
2405
2426
|
</td>
|
|
2406
2427
|
</tr>
|
|
2407
2428
|
<tr>
|