@event-calendar/core 0.13.4 → 0.14.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
@@ -43,9 +43,9 @@ Inspired by [FullCalendar](https://fullcalendar.io/), implements similar options
43
43
  - [eventDragStart](#eventdragstart)
44
44
  - [eventDragStop](#eventdragstop)
45
45
  - [eventDrop](#eventdrop)
46
+ - [eventDurationEditable](#eventdurationeditable)
46
47
  </td><td>
47
48
 
48
- - [eventDurationEditable](#eventdurationeditable)
49
49
  - [eventLongPressDelay](#eventlongpressdelay)
50
50
  - [eventMouseEnter](#eventmouseenter)
51
51
  - [eventMouseLeave](#eventmouseleave)
@@ -69,14 +69,16 @@ Inspired by [FullCalendar](https://fullcalendar.io/), implements similar options
69
69
  - [locale](#locale)
70
70
  - [longPressDelay](#longpressdelay)
71
71
  - [monthMode](#monthmode)
72
- </td><td>
73
-
74
72
  - [moreLinkContent](#morelinkcontent)
75
73
  - [noEventsClick](#noeventsclick)
74
+ </td><td>
75
+
76
76
  - [noEventsContent](#noeventscontent)
77
77
  - [nowIndicator](#nowindicator)
78
78
  - [pointer](#pointer)
79
79
  - [resources](#resources)
80
+ - [resourceLabelContent](#resourcelabelcontent)
81
+ - [resourceLabelDidMount](#resourcelabeldidmount)
80
82
  - [select](#select)
81
83
  - [selectable](#selectable)
82
84
  - [selectBackgroundColor](#selectbackgroundcolor)
@@ -182,6 +184,10 @@ let ec = new Calendar({
182
184
  }
183
185
  });
184
186
  ```
187
+ The CSS is located at `@event-calendar/core/index.css`. If your build tool supports CSS processing, you can import it like this:
188
+ ```js
189
+ import '@event-calendar/core/index.css';
190
+ ```
185
191
 
186
192
  ### Pre-built browser ready bundle
187
193
  Include the following lines of code in the `<head>` section of your page:
@@ -234,7 +240,7 @@ In Svelte, you can simply update the original `options` object.
234
240
 
235
241
  Defines the content that is displayed as a title of the `all-day` slot.
236
242
 
237
- This value can be either a string containing HTML `'<p>...</p>'`, an object containing the HTML string `{html: '<p>...</p>'}`, an object containing an array of DOM nodes `{domNodes: [node1, node2, ...]}` or a function that returns any of the above formats:
243
+ This value can be either a string containing text `'...'`, an object containing the HTML string `{html: '<p>...</p>'}`, an object containing an array of DOM nodes `{domNodes: [node1, node2, ...]}` or a function that returns any of the above formats:
238
244
 
239
245
  ```js
240
246
  function (arg) {
@@ -284,9 +290,9 @@ This value can be either a JavaScript Date object, or an ISO8601 date string lik
284
290
  Callback function that is triggered when the user clicks on a date or a time.
285
291
 
286
292
  ```js
287
- function (dateClickInfo) {}
293
+ function (info) {}
288
294
  ```
289
- `dateClickInfo` is an object with the following properties:
295
+ `info` is an object with the following properties:
290
296
  <table>
291
297
  <tr>
292
298
  <td>
@@ -305,6 +311,15 @@ function (dateClickInfo) {}
305
311
  <tr>
306
312
  <td>
307
313
 
314
+ `allDay`
315
+ </td>
316
+ <td>
317
+
318
+ `true` or `false`. Determines if the click has occurred in the `all-day` slot. Clicks in month and list views are treated as all-day too</td>
319
+ </tr>
320
+ <tr>
321
+ <td>
322
+
308
323
  `dayEl`
309
324
  </td>
310
325
  <td>HTML element that represents the whole-day that was clicked on</td>
@@ -502,9 +517,9 @@ You can use any of the CSS color formats such `'#f00'`, `'#ff0000'`, `'rgb(255,0
502
517
  Callback function that is triggered when the user clicks an event.
503
518
 
504
519
  ```js
505
- function (eventClickInfo) { }
520
+ function (info) { }
506
521
  ```
507
- `eventClickInfo` is an object with the following properties:
522
+ `info` is an object with the following properties:
508
523
  <table>
509
524
  <tr>
510
525
  <td>
@@ -554,14 +569,14 @@ This is currently an alias for the `eventBackgroundColor`.
554
569
 
555
570
  Defines the content that is rendered inside an event’s element.
556
571
 
557
- This value can be either a string containing HTML `'<p>...</p>'`, an object containing the HTML string `{html: '<p>...</p>'}`, an object containing an array of DOM nodes `{domNodes: [node1, node2, ...]}` or a function that returns any of the above formats:
572
+ This value can be either a string containing text `'...'`, an object containing the HTML string `{html: '<p>...</p>'}`, an object containing an array of DOM nodes `{domNodes: [node1, node2, ...]}` or a function that returns any of the above formats:
558
573
 
559
574
  ```js
560
- function (eventInfo) {
575
+ function (info) {
561
576
  // return string or object
562
577
  }
563
578
  ```
564
- `eventInfo` is an object with the following properties:
579
+ `info` is an object with the following properties:
565
580
  <table>
566
581
  <tr>
567
582
  <td>
@@ -599,9 +614,9 @@ The current [View](#view-object) object
599
614
  Callback function that is triggered right after the element has been added to the DOM. If the event data changes, this is not called again.
600
615
 
601
616
  ```js
602
- function (mountInfo) { }
617
+ function (info) { }
603
618
  ```
604
- `mountInfo` is an object with the following properties:
619
+ `info` is an object with the following properties:
605
620
  <table>
606
621
  <tr>
607
622
  <td>
@@ -840,9 +855,9 @@ If not specified, it falls back to [longPressDelay](#longpressdelay).
840
855
  Callback function that is triggered when the user hovers over an event with the cursor (mouse pointer).
841
856
 
842
857
  ```js
843
- function (mouseEnterInfo) { }
858
+ function (info) { }
844
859
  ```
845
- `mouseEnterInfo` is an object with the following properties:
860
+ `info` is an object with the following properties:
846
861
  <table>
847
862
  <tr>
848
863
  <td>
@@ -887,9 +902,9 @@ The current [View](#view-object) object
887
902
  Callback function that is triggered when the cursor (mouse pointer) is moved out of an event.
888
903
 
889
904
  ```js
890
- function (mouseLeaveInfo) { }
905
+ function (info) { }
891
906
  ```
892
- `mouseLeaveInfo` is an object with the following properties:
907
+ `info` is an object with the following properties:
893
908
  <table>
894
909
  <tr>
895
910
  <td>
@@ -1400,7 +1415,7 @@ Tells the calendar that visible dates should start from the [firstDay](#firstday
1400
1415
 
1401
1416
  Defines the text that is displayed instead of the default `+2 more` created by the [dayMaxEvents](#daymaxevents) option.
1402
1417
 
1403
- This value can be either a string containing HTML `'<p>...</p>'`, an object containing the HTML string `{html: '<p>...</p>'}`, an object containing an array of DOM nodes `{domNodes: [node1, node2, ...]}` or a function that returns any of the above formats:
1418
+ This value can be either a string containing text `'...'`, an object containing the HTML string `{html: '<p>...</p>'}`, an object containing an array of DOM nodes `{domNodes: [node1, node2, ...]}` or a function that returns any of the above formats:
1404
1419
 
1405
1420
  ```js
1406
1421
  function (arg) {
@@ -1435,9 +1450,9 @@ The default text like `+2 more`
1435
1450
  Callback function that is triggered when the user clicks _No events_ area in list view.
1436
1451
 
1437
1452
  ```js
1438
- function (clickInfo) { }
1453
+ function (info) { }
1439
1454
  ```
1440
- `clickInfo` is an object with the following properties:
1455
+ `info` is an object with the following properties:
1441
1456
  <table>
1442
1457
  <tr>
1443
1458
  <td>
@@ -1464,7 +1479,7 @@ The current [View](#view-object) object
1464
1479
 
1465
1480
  Defines the text that is displayed in list view when there are no events to display.
1466
1481
 
1467
- This value can be either a string containing HTML `'<p>...</p>'`, an object containing the HTML string `{html: '<p>...</p>'}`, an object containing an array of DOM nodes `{domNodes: [node1, node2, ...]}` or a function that returns any of the above formats:
1482
+ This value can be either a string containing text `'...'`, an object containing the HTML string `{html: '<p>...</p>'}`, an object containing an array of DOM nodes `{domNodes: [node1, node2, ...]}` or a function that returns any of the above formats:
1468
1483
 
1469
1484
  ```js
1470
1485
  function () {
@@ -1490,6 +1505,77 @@ Enables mouse cursor pointer in `timeGrid`/`resourceTimeGrid` views.
1490
1505
 
1491
1506
  Array of plain objects that will be parsed into [Resource](#resource-object) objects for displaying in the resource view.
1492
1507
 
1508
+ ### resourceLabelContent
1509
+ - Type `string`, `object`or `function`
1510
+ - Default `undefined`
1511
+
1512
+ Defines the content that is rendered inside an element with a resource title.
1513
+
1514
+ This value can be either a string containing text `'...'`, an object containing the HTML string `{html: '<p>...</p>'}`, an object containing an array of DOM nodes `{domNodes: [node1, node2, ...]}` or a function that returns any of the above formats:
1515
+
1516
+ ```js
1517
+ function (info) {
1518
+ // return string or object
1519
+ }
1520
+ ```
1521
+ `info` is an object with the following properties:
1522
+ <table>
1523
+ <tr>
1524
+ <td>
1525
+
1526
+ `resource`
1527
+ </td>
1528
+ <td>
1529
+
1530
+ The associated [Resource](#resource-object) object
1531
+ </td>
1532
+ </tr>
1533
+ <tr>
1534
+ <td>
1535
+
1536
+ `date`
1537
+ </td>
1538
+ <td>If it is a column that is within a specific date, this will be a Date object</td>
1539
+ </tr>
1540
+ </table>
1541
+
1542
+ ### resourceLabelDidMount
1543
+ - Type `function`
1544
+ - Default `undefined`
1545
+
1546
+ Callback function that is triggered right after the element has been added to the DOM. If the resource data changes, this is not called again.
1547
+
1548
+ ```js
1549
+ function (info) { }
1550
+ ```
1551
+ `info` is an object with the following properties:
1552
+ <table>
1553
+ <tr>
1554
+ <td>
1555
+
1556
+ `el`
1557
+ </td>
1558
+ <td>The HTML element for the label</td>
1559
+ </tr>
1560
+ <tr>
1561
+ <td>
1562
+
1563
+ `resource`
1564
+ </td>
1565
+ <td>
1566
+
1567
+ The associated [Resource](#resource-object) object
1568
+ </td>
1569
+ </tr>
1570
+ <tr>
1571
+ <td>
1572
+
1573
+ `date`
1574
+ </td>
1575
+ <td>If it is a column that is within a specific date, this will be a Date object</td>
1576
+ </tr>
1577
+ </table>
1578
+
1493
1579
  ### select
1494
1580
  - Type `function`
1495
1581
  - Default `undefined`
@@ -1497,9 +1583,9 @@ Array of plain objects that will be parsed into [Resource](#resource-object) obj
1497
1583
  Callback function that is triggered when a date/time selection is made.
1498
1584
 
1499
1585
  ```js
1500
- function (selectInfo) { }
1586
+ function (info) { }
1501
1587
  ```
1502
- `selectInfo` is an object with the following properties:
1588
+ `info` is an object with the following properties:
1503
1589
  <table>
1504
1590
  <tr>
1505
1591
  <td>
@@ -1536,7 +1622,7 @@ function (selectInfo) { }
1536
1622
  </td>
1537
1623
  <td>
1538
1624
 
1539
- Boolean (`true` or `false`). Determines if the selection has occurred in the `all-day` slot</td>
1625
+ `true` or `false`. Determines if the selection has occurred in the `all-day` slot</td>
1540
1626
  </tr>
1541
1627
  <tr>
1542
1628
  <td>
@@ -1591,7 +1677,7 @@ If not specified, it falls back to [longPressDelay](#longpressdelay).
1591
1677
 
1592
1678
  ### selectMinDistance
1593
1679
  - Type `integer`
1594
- - Default `0`
1680
+ - Default `5`
1595
1681
 
1596
1682
  Defines how many pixels the user’s mouse must move before the selection begins.
1597
1683
 
@@ -1779,9 +1865,9 @@ The view that is displayed in the calendar. Can be `'dayGridMonth'`, `'listDay'`
1779
1865
  Callback function that is triggered right after the view has been added to the DOM.
1780
1866
 
1781
1867
  ```js
1782
- function (mountInfo) { }
1868
+ function (info) { }
1783
1869
  ```
1784
- `mountInfo` is an object with the following properties:
1870
+ `info` is an object with the following properties:
1785
1871
  <table>
1786
1872
  <tr>
1787
1873
  <td>
@@ -1927,7 +2013,7 @@ Here are all properties that exist in Event object:
1927
2013
  </td>
1928
2014
  <td>
1929
2015
 
1930
- Boolean (`true` or `false`). Determines if the event is shown in the `all-day` slot</td>
2016
+ `true` or `false`. Determines if the event is shown in the `all-day` slot</td>
1931
2017
  </tr>
1932
2018
  <tr>
1933
2019
  <td>
@@ -1953,11 +2039,18 @@ Boolean (`true` or `false`). Determines if the event is shown in the `all-day` s
1953
2039
  <tr>
1954
2040
  <td>
1955
2041
 
2042
+ `titleHTML`
2043
+ </td>
2044
+ <td>The HTML version of the title</td>
2045
+ </tr>
2046
+ <tr>
2047
+ <td>
2048
+
1956
2049
  `editable`
1957
2050
  </td>
1958
2051
  <td>
1959
2052
 
1960
- Boolean (`true` or `false`) or `undefined`. The value overriding the [editable](#editable) setting for this specific event
2053
+ `true`, `false` or `undefined`. The value overriding the [editable](#editable) setting for this specific event
1961
2054
  </td>
1962
2055
  </tr>
1963
2056
  <tr>
@@ -1967,7 +2060,7 @@ Boolean (`true` or `false`) or `undefined`. The value overriding the [editable](
1967
2060
  </td>
1968
2061
  <td>
1969
2062
 
1970
- Boolean (`true` or `false`) or `undefined`. The value overriding the [eventStartEditable](#eventstarteditable) setting for this specific event
2063
+ `true`, `false` or `undefined`. The value overriding the [eventStartEditable](#eventstarteditable) setting for this specific event
1971
2064
  </td>
1972
2065
  </tr>
1973
2066
  <tr>
@@ -1977,7 +2070,7 @@ Boolean (`true` or `false`) or `undefined`. The value overriding the [eventStart
1977
2070
  </td>
1978
2071
  <td>
1979
2072
 
1980
- Boolean (`true` or `false`) or `undefined`. The value overriding the [eventDurationEditable](#eventdurationeditable) setting for this specific event
2073
+ `true`, `false` or `undefined`. The value overriding the [eventDurationEditable](#eventdurationeditable) setting for this specific event
1981
2074
  </td>
1982
2075
  </tr>
1983
2076
  <tr>
@@ -2092,6 +2185,16 @@ Here are all admissible fields for the event’s input object:
2092
2185
  <tr>
2093
2186
  <td>
2094
2187
 
2188
+ `titleHTML`
2189
+ </td>
2190
+ <td>
2191
+
2192
+ `string` The HTML version of the title to be displayed instead of the text version. Default `''`
2193
+ </td>
2194
+ </tr>
2195
+ <tr>
2196
+ <td>
2197
+
2095
2198
  `editable`
2096
2199
  </td>
2097
2200
  <td>
@@ -2220,6 +2323,13 @@ Here are all properties that exist in Resource object:
2220
2323
  </td>
2221
2324
  <td>The title of the resource</td>
2222
2325
  </tr>
2326
+ <tr>
2327
+ <td>
2328
+
2329
+ `titleHTML`
2330
+ </td>
2331
+ <td>The HTML version of the title</td>
2332
+ </tr>
2223
2333
  </table>
2224
2334
 
2225
2335
  ### Parsing resource from a plain object
@@ -2247,6 +2357,16 @@ Here are all admissible fields for the resource’s input object:
2247
2357
  `string` Text that will be displayed on the resource when it is rendered. Default `''`
2248
2358
  </td>
2249
2359
  </tr>
2360
+ <tr>
2361
+ <td>
2362
+
2363
+ `titleHTML`
2364
+ </td>
2365
+ <td>
2366
+
2367
+ `string` The HTML version of the title to be displayed instead of the text version. Default `''`
2368
+ </td>
2369
+ </tr>
2250
2370
  </table>
2251
2371
 
2252
2372
  ## View object
package/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { is_function, tick, noop, identity, SvelteComponent, init, safe_not_equal, empty, insert, destroy_each, detach, component_subscribe, set_store_value, element, text, attr, append, listen, set_data, transition_in, group_outros, check_outros, transition_out, space, create_component, mount_component, destroy_component, construct_svelte_component, set_style } from 'svelte/internal';
2
2
  import { getContext, setContext } from 'svelte';
3
3
  import { derived, writable, readable, get } from 'svelte/store';
4
- import { assign, setMidnight, createDate, createDuration, createEvents, createEventSources, cloneDate, prevClosestDay, nextClosestDay, DAY_IN_SECONDS, addDuration, subtractDay, toLocalDate, toISOString, derived2, addDay, createView, writable2, intl, intlRange, subtractDuration, toEventWithLocalDates, toViewWithLocalDates } from '@event-calendar/common';
4
+ import { assign, setMidnight, createDate, createDuration, createEvents, createEventSources, cloneDate, prevClosestDay, nextClosestDay, DAY_IN_SECONDS, addDuration, subtractDay, toLocalDate, toISOString, derived2, addDay, createView, writable2, intl, intlRange, subtractDuration, toEventWithLocalDates, toViewWithLocalDates, ignore } from '@event-calendar/common';
5
5
 
6
6
  function createOptions(plugins) {
7
7
  let options = {
@@ -378,6 +378,7 @@ class State {
378
378
  this._events = events(this);
379
379
  this._now = now();
380
380
  this._today = today(this);
381
+ this._ignoreClick = writable(false);
381
382
  this._intlEventTime = intl(this.locale, this.eventTimeFormat);
382
383
  this._intlSlotLabel = intl(this.locale, this.slotLabelFormat);
383
384
  this._intlDayHeader = intl(this.locale, this.dayHeaderFormat);
@@ -1248,6 +1249,8 @@ function create_fragment(ctx) {
1248
1249
  let switch_instance1;
1249
1250
  let div_class_value;
1250
1251
  let current;
1252
+ let mounted;
1253
+ let dispose;
1251
1254
  toolbar = new Toolbar({});
1252
1255
  var switch_value = /*$_viewComponent*/ ctx[5];
1253
1256
 
@@ -1294,6 +1297,11 @@ function create_fragment(ctx) {
1294
1297
  append(div, t1);
1295
1298
  if (switch_instance1) mount_component(switch_instance1, div, null);
1296
1299
  current = true;
1300
+
1301
+ if (!mounted) {
1302
+ dispose = listen(window, "click", /*handleClick*/ ctx[16], true);
1303
+ mounted = true;
1304
+ }
1297
1305
  },
1298
1306
  p(ctx, dirty) {
1299
1307
  if (switch_value !== (switch_value = /*$_viewComponent*/ ctx[5])) {
@@ -1370,11 +1378,14 @@ function create_fragment(ctx) {
1370
1378
  destroy_component(toolbar);
1371
1379
  if (switch_instance0) destroy_component(switch_instance0);
1372
1380
  if (switch_instance1) destroy_component(switch_instance1);
1381
+ mounted = false;
1382
+ dispose();
1373
1383
  }
1374
1384
  };
1375
1385
  }
1376
1386
 
1377
1387
  function instance($$self, $$props, $$invalidate) {
1388
+ let $_ignoreClick;
1378
1389
  let $events;
1379
1390
  let $_events;
1380
1391
  let $eventSources;
@@ -1388,14 +1399,15 @@ function instance($$self, $$props, $$invalidate) {
1388
1399
  let { options = {} } = $$props;
1389
1400
  let state = new State(plugins, options);
1390
1401
  setContext('state', state);
1391
- let { _viewComponent, _viewClass, _interaction, _iClass, _events, events, eventSources, height, theme } = state;
1402
+ let { _viewComponent, _viewClass, _ignoreClick, _interaction, _iClass, _events, events, eventSources, height, theme } = state;
1392
1403
  component_subscribe($$self, _viewComponent, value => $$invalidate(5, $_viewComponent = value));
1393
1404
  component_subscribe($$self, _viewClass, value => $$invalidate(2, $_viewClass = value));
1405
+ component_subscribe($$self, _ignoreClick, value => $$invalidate(29, $_ignoreClick = value));
1394
1406
  component_subscribe($$self, _interaction, value => $$invalidate(0, $_interaction = value));
1395
1407
  component_subscribe($$self, _iClass, value => $$invalidate(3, $_iClass = value));
1396
- component_subscribe($$self, _events, value => $$invalidate(28, $_events = value));
1397
- component_subscribe($$self, events, value => $$invalidate(27, $events = value));
1398
- component_subscribe($$self, eventSources, value => $$invalidate(29, $eventSources = value));
1408
+ component_subscribe($$self, _events, value => $$invalidate(31, $_events = value));
1409
+ component_subscribe($$self, events, value => $$invalidate(30, $events = value));
1410
+ component_subscribe($$self, eventSources, value => $$invalidate(32, $eventSources = value));
1399
1411
  component_subscribe($$self, height, value => $$invalidate(4, $height = value));
1400
1412
  component_subscribe($$self, theme, value => $$invalidate(1, $theme = value));
1401
1413
 
@@ -1412,9 +1424,11 @@ function instance($$self, $$props, $$invalidate) {
1412
1424
  }
1413
1425
 
1414
1426
  function getOption(name) {
1415
- return state.hasOwnProperty(name)
1427
+ let value = state.hasOwnProperty(name)
1416
1428
  ? get(state[name])
1417
1429
  : undefined;
1430
+
1431
+ return value instanceof Date ? toLocalDate(value) : value;
1418
1432
  }
1419
1433
 
1420
1434
  function refetchEvents() {
@@ -1481,13 +1495,20 @@ function instance($$self, $$props, $$invalidate) {
1481
1495
  }
1482
1496
  }
1483
1497
 
1498
+ function handleClick(jsEvent) {
1499
+ if ($_ignoreClick) {
1500
+ ignore(jsEvent);
1501
+ set_store_value(_ignoreClick, $_ignoreClick = false, $_ignoreClick);
1502
+ }
1503
+ }
1504
+
1484
1505
  $$self.$$set = $$props => {
1485
- if ('plugins' in $$props) $$invalidate(15, plugins = $$props.plugins);
1486
- if ('options' in $$props) $$invalidate(16, options = $$props.options);
1506
+ if ('plugins' in $$props) $$invalidate(17, plugins = $$props.plugins);
1507
+ if ('options' in $$props) $$invalidate(18, options = $$props.options);
1487
1508
  };
1488
1509
 
1489
1510
  $$self.$$.update = () => {
1490
- if ($$self.$$.dirty[0] & /*options*/ 65536) {
1511
+ if ($$self.$$.dirty[0] & /*options*/ 262144) {
1491
1512
  // Reactively update options that did change
1492
1513
  for (let [name, value] of diff(options)) {
1493
1514
  setOption(name, value);
@@ -1504,6 +1525,7 @@ function instance($$self, $$props, $$invalidate) {
1504
1525
  $_viewComponent,
1505
1526
  _viewComponent,
1506
1527
  _viewClass,
1528
+ _ignoreClick,
1507
1529
  _interaction,
1508
1530
  _iClass,
1509
1531
  _events,
@@ -1511,6 +1533,7 @@ function instance($$self, $$props, $$invalidate) {
1511
1533
  eventSources,
1512
1534
  height,
1513
1535
  theme,
1536
+ handleClick,
1514
1537
  plugins,
1515
1538
  options,
1516
1539
  setOption,
@@ -1537,18 +1560,18 @@ class Calendar extends SvelteComponent {
1537
1560
  create_fragment,
1538
1561
  safe_not_equal,
1539
1562
  {
1540
- plugins: 15,
1541
- options: 16,
1542
- setOption: 17,
1543
- getOption: 18,
1544
- refetchEvents: 19,
1545
- getEvents: 20,
1546
- getEventById: 21,
1547
- addEvent: 22,
1548
- updateEvent: 23,
1549
- removeEventById: 24,
1550
- getView: 25,
1551
- unselect: 26
1563
+ plugins: 17,
1564
+ options: 18,
1565
+ setOption: 19,
1566
+ getOption: 20,
1567
+ refetchEvents: 21,
1568
+ getEvents: 22,
1569
+ getEventById: 23,
1570
+ addEvent: 24,
1571
+ updateEvent: 25,
1572
+ removeEventById: 26,
1573
+ getView: 27,
1574
+ unselect: 28
1552
1575
  },
1553
1576
  null,
1554
1577
  [-1, -1]
@@ -1556,43 +1579,43 @@ class Calendar extends SvelteComponent {
1556
1579
  }
1557
1580
 
1558
1581
  get setOption() {
1559
- return this.$$.ctx[17];
1582
+ return this.$$.ctx[19];
1560
1583
  }
1561
1584
 
1562
1585
  get getOption() {
1563
- return this.$$.ctx[18];
1586
+ return this.$$.ctx[20];
1564
1587
  }
1565
1588
 
1566
1589
  get refetchEvents() {
1567
- return this.$$.ctx[19];
1590
+ return this.$$.ctx[21];
1568
1591
  }
1569
1592
 
1570
1593
  get getEvents() {
1571
- return this.$$.ctx[20];
1594
+ return this.$$.ctx[22];
1572
1595
  }
1573
1596
 
1574
1597
  get getEventById() {
1575
- return this.$$.ctx[21];
1598
+ return this.$$.ctx[23];
1576
1599
  }
1577
1600
 
1578
1601
  get addEvent() {
1579
- return this.$$.ctx[22];
1602
+ return this.$$.ctx[24];
1580
1603
  }
1581
1604
 
1582
1605
  get updateEvent() {
1583
- return this.$$.ctx[23];
1606
+ return this.$$.ctx[25];
1584
1607
  }
1585
1608
 
1586
1609
  get removeEventById() {
1587
- return this.$$.ctx[24];
1610
+ return this.$$.ctx[26];
1588
1611
  }
1589
1612
 
1590
1613
  get getView() {
1591
- return this.$$.ctx[25];
1614
+ return this.$$.ctx[27];
1592
1615
  }
1593
1616
 
1594
1617
  get unselect() {
1595
- return this.$$.ctx[26];
1618
+ return this.$$.ctx[28];
1596
1619
  }
1597
1620
  }
1598
1621
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@event-calendar/core",
3
- "version": "0.13.4",
3
+ "version": "0.14.1",
4
4
  "title": "Event Calendar Core package",
5
5
  "description": "Full-sized drag & drop event calendar with resource view",
6
6
  "keywords": [
@@ -34,7 +34,7 @@
34
34
  "./package.json": "./package.json"
35
35
  },
36
36
  "dependencies": {
37
- "@event-calendar/common": "~0.13.4",
37
+ "@event-calendar/common": "~0.14.1",
38
38
  "svelte": "^3.51.0"
39
39
  }
40
40
  }
@@ -5,7 +5,7 @@
5
5
  import {diff} from './storage/options';
6
6
  import State from './storage/state';
7
7
  import Toolbar from './Toolbar.svelte';
8
- import {assign, toEventWithLocalDates, toViewWithLocalDates} from '@event-calendar/common';
8
+ import {assign, toEventWithLocalDates, toViewWithLocalDates, toLocalDate, ignore} from '@event-calendar/common';
9
9
 
10
10
  export let plugins = [];
11
11
  export let options = {};
@@ -13,7 +13,8 @@
13
13
  let state = new State(plugins, options);
14
14
  setContext('state', state);
15
15
 
16
- let {_viewComponent, _viewClass, _interaction, _iClass, _events, events, eventSources, height, theme} = state;
16
+ let {_viewComponent, _viewClass, _ignoreClick, _interaction, _iClass, _events,
17
+ events, eventSources, height, theme} = state;
17
18
 
18
19
  // Reactively update options that did change
19
20
  $: for (let [name, value] of diff(options)) {
@@ -31,7 +32,8 @@
31
32
  }
32
33
 
33
34
  export function getOption(name) {
34
- return state.hasOwnProperty(name) ? get(state[name]) : undefined;
35
+ let value = state.hasOwnProperty(name) ? get(state[name]) : undefined;
36
+ return value instanceof Date ? toLocalDate(value) : value;
35
37
  }
36
38
 
37
39
  export function refetchEvents() {
@@ -93,6 +95,13 @@
93
95
  $events = func($events);
94
96
  }
95
97
  }
98
+
99
+ function handleClick(jsEvent) {
100
+ if ($_ignoreClick) {
101
+ ignore(jsEvent);
102
+ $_ignoreClick = false;
103
+ }
104
+ }
96
105
  </script>
97
106
 
98
107
  <div
@@ -103,3 +112,4 @@
103
112
  <svelte:component this={$_viewComponent}/>
104
113
  <svelte:component this={$_interaction.component}/>
105
114
  </div>
115
+ <svelte:window on:click|capture={handleClick}/>
@@ -34,6 +34,7 @@ export default class {
34
34
  this._events = events(this);
35
35
  this._now = now();
36
36
  this._today = today(this);
37
+ this._ignoreClick = writable(false);
37
38
  this._intlEventTime = intl(this.locale, this.eventTimeFormat);
38
39
  this._intlSlotLabel = intl(this.locale, this.slotLabelFormat);
39
40
  this._intlDayHeader = intl(this.locale, this.dayHeaderFormat);