@event-calendar/core 3.2.2 → 3.4.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 CHANGED
@@ -204,8 +204,8 @@ import '@event-calendar/core/index.css';
204
204
  ### Pre-built browser ready bundle
205
205
  Include the following lines of code in the `<head>` section of your page:
206
206
  ```html
207
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@event-calendar/build@3.2.2/event-calendar.min.css">
208
- <script src="https://cdn.jsdelivr.net/npm/@event-calendar/build@3.2.2/event-calendar.min.js"></script>
207
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@event-calendar/build@3.4.0/event-calendar.min.css">
208
+ <script src="https://cdn.jsdelivr.net/npm/@event-calendar/build@3.4.0/event-calendar.min.js"></script>
209
209
  ```
210
210
 
211
211
  <details>
@@ -668,7 +668,7 @@ Determines whether the events on the calendar can be dragged and resized (both a
668
668
  If you don't need both, use the more specific [eventStartEditable](#eventstarteditable) and [eventDurationEditable](#eventdurationeditable) instead.
669
669
 
670
670
  ### events
671
- - Type `Array`
671
+ - Type `array`
672
672
  - Default `[]`
673
673
 
674
674
  Array of plain objects that will be parsed into [Event](#event-object) objects and displayed on the calendar.
@@ -804,11 +804,11 @@ This is currently an alias for the `eventBackgroundColor`.
804
804
 
805
805
  Defines the content that is rendered inside an event’s element.
806
806
 
807
- This value can be either a [Content](#content) or a function that returns content:
807
+ This value can be either a [Content](#content) or a function that returns content or `undefined`:
808
808
 
809
809
  ```js
810
810
  function (info) {
811
- // return Content
811
+ // return Content or undefined
812
812
  }
813
813
  ```
814
814
  `info` is an object with the following properties:
@@ -842,6 +842,8 @@ The current [View](#view-object) object
842
842
  </tr>
843
843
  </table>
844
844
 
845
+ In case the function returns `undefined`, the event will be rendered in the default way.
846
+
845
847
  ### eventDidMount
846
848
  - Type `function`
847
849
  - Default `undefined`
@@ -1614,13 +1616,13 @@ Defines the height of the entire calendar.
1614
1616
  This should be a valid CSS value like `'100%'` or `'600px'`.
1615
1617
 
1616
1618
  ### hiddenDays
1617
- - Type `Array`
1619
+ - Type `array`
1618
1620
  - Default `[]`
1619
1621
 
1620
1622
  Exclude certain days-of-the-week from being displayed, where Sunday is `0`, Monday is `1`, etc. Saturday is `6`.
1621
1623
 
1622
1624
  ### highlightedDates
1623
- - Type `Array`
1625
+ - Type `array`
1624
1626
  - Default `[]`
1625
1627
 
1626
1628
  Array of dates that need to be highlighted in the calendar.
@@ -1811,7 +1813,7 @@ Enables a marker indicating the current time in `timeGrid`/`resourceTimeGrid` vi
1811
1813
  Enables mouse cursor pointer in `timeGrid`/`resourceTimeGrid` and other views.
1812
1814
 
1813
1815
  ### resources
1814
- - Type `Array`
1816
+ - Type `array`
1815
1817
  - Default `[]`
1816
1818
 
1817
1819
  Array of plain objects that will be parsed into [Resource](#resource-object) objects for displaying in the resource view.
@@ -2076,13 +2078,13 @@ This should be a value that can be parsed into a [Duration](#duration-object) ob
2076
2078
 
2077
2079
  ### slotWidth
2078
2080
  - Type `integer`
2079
- - Default `52`
2081
+ - Default `72`
2080
2082
 
2081
2083
  Defines the time slot width in pixels in `ResourceTimeline` views. When changing the setting, you must additionally override the following CSS styles:
2082
2084
 
2083
2085
  ```css
2084
2086
  .ec-timeline .ec-time, .ec-timeline .ec-line {
2085
- width: 52px; /* override this value */
2087
+ width: 72px; /* override this value */
2086
2088
  }
2087
2089
  ```
2088
2090
 
@@ -2531,48 +2533,48 @@ The [eventTextColor](#eventtextcolor) override for this specific event
2531
2533
  <tr>
2532
2534
  <td>
2533
2535
 
2534
- `extendedProps`
2536
+ `classNames`
2535
2537
  </td>
2536
2538
  <td>
2537
2539
 
2538
- A plain object holding miscellaneous properties specified during parsing in the explicitly given `extendedProps` field
2540
+ An array of additional CSS classes for this specific event
2539
2541
  </td>
2540
2542
  </tr>
2541
- </table>
2542
-
2543
- ### Parsing event from a plain object
2544
- When Event Calendar receives an array of plain event’s objects either from the `events` option or as a result of an HTTP request to a URL of an event source, it parses the input objects into proper Event objects.
2545
-
2546
- Here are all admissible fields for the event’s input object:
2547
- <table>
2548
2543
  <tr>
2549
2544
  <td>
2550
2545
 
2551
- `id`
2546
+ `styles`
2552
2547
  </td>
2553
2548
  <td>
2554
2549
 
2555
- `string` or `integer` A unique identifier of the event. Default `auto-generated value`
2550
+ An array of additional inline styling declarations for this specific event
2556
2551
  </td>
2557
2552
  </tr>
2558
2553
  <tr>
2559
2554
  <td>
2560
2555
 
2561
- `resourceId`
2556
+ `extendedProps`
2562
2557
  </td>
2563
2558
  <td>
2564
2559
 
2565
- `string` or `integer` An ID of a resource that the event is associated with. This field is not used if `resourceIds` is provided. Default `undefined`
2560
+ A plain object holding miscellaneous properties specified during parsing in the explicitly given `extendedProps` field
2566
2561
  </td>
2567
2562
  </tr>
2563
+ </table>
2564
+
2565
+ ### Parsing event from a plain object
2566
+ When Event Calendar receives an array of plain event’s objects either from the `events` option or as a result of an HTTP request to a URL of an event source, it parses the input objects into proper Event objects.
2567
+
2568
+ Here are all admissible fields for the event’s input object:
2569
+ <table>
2568
2570
  <tr>
2569
2571
  <td>
2570
2572
 
2571
- `resourceIds`
2573
+ `id`
2572
2574
  </td>
2573
2575
  <td>
2574
2576
 
2575
- `Array` An array of resource IDs that the event is associated with. This field is used instead of `resourceId`. Default `[]`
2577
+ `string` or `integer` A unique identifier of the event. Default `auto-generated value`
2576
2578
  </td>
2577
2579
  </tr>
2578
2580
  <tr>
@@ -2638,6 +2640,26 @@ Here are all admissible fields for the event’s input object:
2638
2640
  <tr>
2639
2641
  <td>
2640
2642
 
2643
+ `durationEditable`
2644
+ </td>
2645
+ <td>
2646
+
2647
+ `boolean` Overrides the master [eventDurationEditable](#eventdurationeditable) option for this single event. Default `undefined`
2648
+ </td>
2649
+ </tr>
2650
+ <tr>
2651
+ <td>
2652
+
2653
+ `resourceIds` or `resourceId`
2654
+ </td>
2655
+ <td>
2656
+
2657
+ `string`, `integer` or `array` An ID of a resource or an array of resource IDs that the event is associated with. Default `[]`
2658
+ </td>
2659
+ </tr>
2660
+ <tr>
2661
+ <td>
2662
+
2641
2663
  `display`
2642
2664
  </td>
2643
2665
  <td>
@@ -2678,6 +2700,26 @@ Here are all admissible fields for the event’s input object:
2678
2700
  <tr>
2679
2701
  <td>
2680
2702
 
2703
+ `classNames` or `className`
2704
+ </td>
2705
+ <td>
2706
+
2707
+ `string` or `array` Sets additional CSS classes for this single event. See [eventClassNames](#eventclassnames). Default `[]`
2708
+ </td>
2709
+ </tr>
2710
+ <tr>
2711
+ <td>
2712
+
2713
+ `styles` or `style`
2714
+ </td>
2715
+ <td>
2716
+
2717
+ `string` or `array` Sets additional inline styling declarations for this single event. This value can be either a string containing styles `'font-size: 24px; border-radius: 4px; ...'` or an array of strings `['font-size: 24px', 'border-radius: 4px', ...]`. Default `[]`
2718
+ </td>
2719
+ </tr>
2720
+ <tr>
2721
+ <td>
2722
+
2681
2723
  `extendedProps`
2682
2724
  </td>
2683
2725
  <td>
package/index.css CHANGED
@@ -236,6 +236,46 @@
236
236
  padding: 8px 0;
237
237
  }
238
238
 
239
+ .ec-day-grid .ec-body {
240
+ flex: 1 1 auto;
241
+ }
242
+ .ec-day-grid .ec-body .ec-day {
243
+ min-height: 5em;
244
+ position: relative;
245
+ }
246
+ .ec-day-grid .ec-content {
247
+ flex-direction: column;
248
+ height: 100%;
249
+ }
250
+ .ec-day-grid .ec-uniform .ec-content {
251
+ overflow: hidden;
252
+ }
253
+ .ec-day-grid .ec-uniform .ec-days {
254
+ flex: 1 1 0%;
255
+ min-height: 0;
256
+ }
257
+ .ec-day-grid .ec-uniform .ec-day {
258
+ min-height: 0;
259
+ }
260
+ .ec-day-grid .ec-day:first-child {
261
+ border-left: none;
262
+ }
263
+ .ec-day-grid .ec-day-head {
264
+ display: block;
265
+ border: none;
266
+ text-align: right;
267
+ padding: 4px 4px 3px;
268
+ }
269
+ .ec-day-grid .ec-day-foot {
270
+ position: absolute;
271
+ bottom: 0;
272
+ padding: 2px;
273
+ font-size: 0.85em;
274
+ }
275
+ .ec-day-grid .ec-day-foot a {
276
+ cursor: pointer;
277
+ }
278
+
239
279
  /* Grid */
240
280
  .ec-days,
241
281
  .ec-day,
@@ -393,6 +433,7 @@
393
433
  }
394
434
  .ec-all-day .ec-day {
395
435
  padding-bottom: 4px;
436
+ position: relative;
396
437
  }
397
438
 
398
439
  /* Body */
@@ -404,9 +445,6 @@
404
445
  .ec:not(.ec-list) .ec-body {
405
446
  border-top: none;
406
447
  }
407
- .ec-day-grid .ec-body {
408
- flex: 1 1 auto;
409
- }
410
448
 
411
449
  .ec-sidebar {
412
450
  flex: 0 0 auto;
@@ -420,13 +458,6 @@
420
458
  .ec-content {
421
459
  display: flex;
422
460
  }
423
- .ec-day-grid .ec-content {
424
- flex-direction: column;
425
- height: 100%;
426
- }
427
- .ec-day-grid .ec-uniform .ec-content {
428
- overflow: hidden;
429
- }
430
461
  .ec-list .ec-content {
431
462
  flex-direction: column;
432
463
  }
@@ -445,10 +476,6 @@
445
476
  .ec-day-grid .ec-days, .ec-resource .ec-days {
446
477
  flex: 1 0 auto;
447
478
  }
448
- .ec-day-grid .ec-uniform .ec-days {
449
- flex: 1 1 0%;
450
- min-height: 0;
451
- }
452
479
 
453
480
  .ec-day {
454
481
  border-style: none none none solid;
@@ -459,16 +486,6 @@
459
486
  .ec-day.ec-highlight {
460
487
  background-color: var(--ec-highlight-color);
461
488
  }
462
- .ec-day-grid .ec-body .ec-day {
463
- min-height: 5em;
464
- position: relative;
465
- }
466
- .ec-day-grid .ec-uniform .ec-day {
467
- min-height: 0;
468
- }
469
- .ec-day-grid .ec-day:first-child {
470
- border-left: none;
471
- }
472
489
  .ec-day.ec-other-month .ec-day-head {
473
490
  opacity: 0.3;
474
491
  }
@@ -476,22 +493,6 @@
476
493
  border: none;
477
494
  }
478
495
 
479
- .ec-day-grid .ec-day-head {
480
- display: block;
481
- border: none;
482
- text-align: right;
483
- padding: 4px 4px 3px;
484
- }
485
- .ec-day-grid .ec-day-foot {
486
- position: absolute;
487
- bottom: 0;
488
- padding: 2px;
489
- font-size: 0.85em;
490
- }
491
- .ec-day-grid .ec-day-foot a {
492
- cursor: pointer;
493
- }
494
-
495
496
  .ec-list .ec-day-head {
496
497
  background-color: var(--ec-list-day-bg-color);
497
498
  border-style: solid none;
@@ -616,12 +617,20 @@
616
617
  .ec-bg-events {
617
618
  position: relative;
618
619
  }
620
+ .ec-day-grid .ec-bg-events, .ec-all-day .ec-bg-events {
621
+ position: absolute;
622
+ inset: 0;
623
+ }
619
624
 
620
625
  .ec-bg-event {
621
626
  position: absolute;
622
627
  background-color: var(--ec-bg-event-color);
623
628
  opacity: var(--ec-bg-event-opacity);
624
629
  }
630
+ .ec-day-grid .ec-bg-event, .ec-all-day .ec-bg-event {
631
+ height: 100%;
632
+ z-index: auto;
633
+ }
625
634
 
626
635
  .ec-time {
627
636
  white-space: nowrap;
package/index.js CHANGED
@@ -274,6 +274,10 @@ function symbol() {
274
274
  return Symbol('ec');
275
275
  }
276
276
 
277
+ function isArray(value) {
278
+ return Array.isArray(value);
279
+ }
280
+
277
281
  function createElement(tag, className, content, attrs = []) {
278
282
  let el = document.createElement(tag);
279
283
  el.className = className;
@@ -373,21 +377,20 @@ function createEvents(input) {
373
377
  return input.map(event => {
374
378
  let result = {
375
379
  id: 'id' in event ? String(event.id) : `{generated-${eventId++}}`,
376
- resourceIds: Array.isArray(event.resourceIds)
377
- ? event.resourceIds.map(String)
378
- : ('resourceId' in event ? [String(event.resourceId)] : []),
380
+ resourceIds: toArrayProp(event, 'resourceId').map(String),
379
381
  allDay: event.allDay ?? (noTimePart(event.start) && noTimePart(event.end)),
380
382
  start: createDate(event.start),
381
383
  end: createDate(event.end),
382
- title: event.title || '',
383
- titleHTML: event.titleHTML || '',
384
+ title: event.title ?? '',
384
385
  editable: event.editable,
385
386
  startEditable: event.startEditable,
386
387
  durationEditable: event.durationEditable,
387
- display: event.display || 'auto',
388
- extendedProps: event.extendedProps || {},
389
- backgroundColor: event.backgroundColor || event.color,
390
- textColor: event.textColor
388
+ display: event.display ?? 'auto',
389
+ extendedProps: event.extendedProps ?? {},
390
+ backgroundColor: event.backgroundColor ?? event.color,
391
+ textColor: event.textColor,
392
+ classNames: toArrayProp(event, 'className'),
393
+ styles: toArrayProp(event, 'style')
391
394
  };
392
395
 
393
396
  if (result.allDay) {
@@ -407,6 +410,11 @@ function createEvents(input) {
407
410
  });
408
411
  }
409
412
 
413
+ function toArrayProp(input, propName) {
414
+ let result = input[propName + 's'] ?? input[propName] ?? [];
415
+ return isArray(result) ? result : [result];
416
+ }
417
+
410
418
  function createEventSources(input) {
411
419
  return input.map(source => ({
412
420
  events: source.events,
@@ -446,7 +454,9 @@ function createEventContent(chunk, displayEventEnd, eventContent, theme, _intlEv
446
454
  view: toViewWithLocalDates(_view)
447
455
  })
448
456
  : eventContent;
449
- } else {
457
+ }
458
+
459
+ if (content === undefined) {
450
460
  let domNodes;
451
461
  switch (chunk.event.display) {
452
462
  case 'background':
@@ -477,6 +487,7 @@ function createTimeElement(timeText, chunk, theme) {
477
487
  }
478
488
 
479
489
  function createEventClasses(eventClassNames, event, _view) {
490
+ let result = event.classNames;
480
491
  if (eventClassNames) {
481
492
  if (is_function(eventClassNames)) {
482
493
  eventClassNames = eventClassNames({
@@ -484,9 +495,12 @@ function createEventClasses(eventClassNames, event, _view) {
484
495
  view: toViewWithLocalDates(_view)
485
496
  });
486
497
  }
487
- return Array.isArray(eventClassNames) ? eventClassNames : [eventClassNames];
498
+ result = [
499
+ ...isArray(eventClassNames) ? eventClassNames : [eventClassNames],
500
+ ...result
501
+ ];
488
502
  }
489
- return [];
503
+ return result;
490
504
  }
491
505
 
492
506
  function toEventWithLocalDates(event) {
@@ -539,6 +553,14 @@ function prepareEventChunks(chunks, hiddenDays) {
539
553
  chunk.date = dates[0];
540
554
  chunk.days = dates.length;
541
555
  chunk.dates = dates;
556
+ // Adjust the start and end dates of the chunk if hidden days affected them
557
+ if (chunk.start < dates[0]) {
558
+ chunk.start = dates[0];
559
+ }
560
+ let maxEnd = addDay(cloneDate(dates.at(-1)));
561
+ if (chunk.end > maxEnd) {
562
+ chunk.end = maxEnd;
563
+ }
542
564
  } else {
543
565
  chunk.date = setMidnight(cloneDate(chunk.start));
544
566
  chunk.days = 1;
@@ -656,7 +678,6 @@ function createResources(input) {
656
678
  return input.map(resource => ({
657
679
  id: String(resource.id),
658
680
  title: resource.title || '',
659
- titleHTML: resource.titleHTML || '',
660
681
  eventBackgroundColor: resource.eventBackgroundColor,
661
682
  eventTextColor: resource.eventTextColor
662
683
  }));
@@ -2632,21 +2653,23 @@ function instance($$self, $$props, $$invalidate) {
2632
2653
  }
2633
2654
 
2634
2655
  function addEvent(event) {
2635
- $_events.push(createEvents([event])[0]);
2656
+ event = createEvents([event])[0];
2657
+ $_events.push(event);
2636
2658
  _events.set($_events);
2637
- return this;
2659
+ return event;
2638
2660
  }
2639
2661
 
2640
2662
  function updateEvent(event) {
2641
2663
  for (let e of $_events) {
2642
2664
  if (e.id == event.id) {
2643
- assign(e, createEvents([event])[0]);
2665
+ event = createEvents([event])[0];
2666
+ assign(e, event);
2644
2667
  _events.set($_events);
2645
- break;
2668
+ return event;
2646
2669
  }
2647
2670
  }
2648
2671
 
2649
- return this;
2672
+ return null;
2650
2673
  }
2651
2674
 
2652
2675
  function removeEventById(id) {
@@ -2854,4 +2877,4 @@ class Calendar extends SvelteComponent {
2854
2877
  }
2855
2878
  }
2856
2879
 
2857
- export { DAY_IN_SECONDS, addDay, addDuration, ancestor, assign, bgEvent, btnTextDay, btnTextMonth, btnTextWeek, btnTextYear, ceil, cloneDate, cloneEvent, copyTime, createDate, createDuration, createElement, createEventChunk, createEventClasses, createEventContent, createEventSources, createEvents, createResources, createSlotTimeLimits, createTimes, createView, datesEqual, debounce, Calendar as default, eventIntersects, floor, flushDebounce, getElementWithPayload, getPayload, ghostEvent, hasPayload, hasYScroll, height, helperEvent, intl, intlRange, keyEnter, keys, listView, max, min, nextClosestDay, nextDate, noTimePart, outsideEvent, pointerEvent, prepareEventChunks, prevClosestDay, prevDate, previewEvent, rect, repositionEvent, resourceBackgroundColor, resourceTextColor, runReposition, setContent, setMidnight, setPayload, sortEventChunks, subtractDay, subtractDuration, symbol, task, themeView, timelineView, toEventWithLocalDates, toISOString, toLocalDate, toSeconds, toViewWithLocalDates, viewResources };
2880
+ export { DAY_IN_SECONDS, addDay, addDuration, ancestor, assign, bgEvent, btnTextDay, btnTextMonth, btnTextWeek, btnTextYear, ceil, cloneDate, cloneEvent, copyTime, createDate, createDuration, createElement, createEventChunk, createEventClasses, createEventContent, createEventSources, createEvents, createResources, createSlotTimeLimits, createTimes, createView, datesEqual, debounce, Calendar as default, eventIntersects, floor, flushDebounce, getElementWithPayload, getPayload, ghostEvent, hasPayload, hasYScroll, height, helperEvent, intl, intlRange, isArray, keyEnter, keys, listView, max, min, nextClosestDay, nextDate, noTimePart, outsideEvent, pointerEvent, prepareEventChunks, prevClosestDay, prevDate, previewEvent, rect, repositionEvent, resourceBackgroundColor, resourceTextColor, runReposition, setContent, setMidnight, setPayload, sortEventChunks, subtractDay, subtractDuration, symbol, task, themeView, timelineView, toEventWithLocalDates, toISOString, toLocalDate, toSeconds, toViewWithLocalDates, viewResources };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@event-calendar/core",
3
- "version": "3.2.2",
3
+ "version": "3.4.0",
4
4
  "title": "Event Calendar Core package",
5
5
  "description": "Full-sized drag & drop event calendar with resource & timeline views",
6
6
  "keywords": [
@@ -67,20 +67,22 @@
67
67
  }
68
68
 
69
69
  export function addEvent(event) {
70
- $_events.push(createEvents([event])[0]);
70
+ event = createEvents([event])[0];
71
+ $_events.push(event);
71
72
  $_events = $_events;
72
- return this;
73
+ return event;
73
74
  }
74
75
 
75
76
  export function updateEvent(event) {
76
77
  for (let e of $_events) {
77
78
  if (e.id == event.id) {
78
- assign(e, createEvents([event])[0]);
79
+ event = createEvents([event])[0];
80
+ assign(e, event);
79
81
  $_events = $_events;
80
- break;
82
+ return event;
81
83
  }
82
84
  }
83
- return this;
85
+ return null;
84
86
  }
85
87
 
86
88
  export function removeEventById(id) {
package/src/lib/events.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {addDay, datesEqual, createDate, cloneDate, setMidnight, toLocalDate, toISOString, noTimePart, copyTime} from './date';
2
2
  import {createElement} from './dom';
3
- import {assign} from './utils';
3
+ import {assign, isArray} from './utils';
4
4
  import {toViewWithLocalDates} from './view';
5
5
  import {is_function} from 'svelte/internal';
6
6
 
@@ -9,21 +9,20 @@ export function createEvents(input) {
9
9
  return input.map(event => {
10
10
  let result = {
11
11
  id: 'id' in event ? String(event.id) : `{generated-${eventId++}}`,
12
- resourceIds: Array.isArray(event.resourceIds)
13
- ? event.resourceIds.map(String)
14
- : ('resourceId' in event ? [String(event.resourceId)] : []),
12
+ resourceIds: toArrayProp(event, 'resourceId').map(String),
15
13
  allDay: event.allDay ?? (noTimePart(event.start) && noTimePart(event.end)),
16
14
  start: createDate(event.start),
17
15
  end: createDate(event.end),
18
- title: event.title || '',
19
- titleHTML: event.titleHTML || '',
16
+ title: event.title ?? '',
20
17
  editable: event.editable,
21
18
  startEditable: event.startEditable,
22
19
  durationEditable: event.durationEditable,
23
- display: event.display || 'auto',
24
- extendedProps: event.extendedProps || {},
25
- backgroundColor: event.backgroundColor || event.color,
26
- textColor: event.textColor
20
+ display: event.display ?? 'auto',
21
+ extendedProps: event.extendedProps ?? {},
22
+ backgroundColor: event.backgroundColor ?? event.color,
23
+ textColor: event.textColor,
24
+ classNames: toArrayProp(event, 'className'),
25
+ styles: toArrayProp(event, 'style')
27
26
  };
28
27
 
29
28
  if (result.allDay) {
@@ -43,6 +42,11 @@ export function createEvents(input) {
43
42
  });
44
43
  }
45
44
 
45
+ function toArrayProp(input, propName) {
46
+ let result = input[propName + 's'] ?? input[propName] ?? [];
47
+ return isArray(result) ? result : [result];
48
+ }
49
+
46
50
  export function createEventSources(input) {
47
51
  return input.map(source => ({
48
52
  events: source.events,
@@ -82,7 +86,9 @@ export function createEventContent(chunk, displayEventEnd, eventContent, theme,
82
86
  view: toViewWithLocalDates(_view)
83
87
  })
84
88
  : eventContent;
85
- } else {
89
+ }
90
+
91
+ if (content === undefined) {
86
92
  let domNodes;
87
93
  switch (chunk.event.display) {
88
94
  case 'background':
@@ -113,6 +119,7 @@ function createTimeElement(timeText, chunk, theme) {
113
119
  }
114
120
 
115
121
  export function createEventClasses(eventClassNames, event, _view) {
122
+ let result = event.classNames;
116
123
  if (eventClassNames) {
117
124
  if (is_function(eventClassNames)) {
118
125
  eventClassNames = eventClassNames({
@@ -120,9 +127,12 @@ export function createEventClasses(eventClassNames, event, _view) {
120
127
  view: toViewWithLocalDates(_view)
121
128
  });
122
129
  }
123
- return Array.isArray(eventClassNames) ? eventClassNames : [eventClassNames];
130
+ result = [
131
+ ...isArray(eventClassNames) ? eventClassNames : [eventClassNames],
132
+ ...result
133
+ ];
124
134
  }
125
- return [];
135
+ return result;
126
136
  }
127
137
 
128
138
  export function toEventWithLocalDates(event) {
@@ -175,6 +185,14 @@ export function prepareEventChunks(chunks, hiddenDays) {
175
185
  chunk.date = dates[0];
176
186
  chunk.days = dates.length;
177
187
  chunk.dates = dates;
188
+ // Adjust the start and end dates of the chunk if hidden days affected them
189
+ if (chunk.start < dates[0]) {
190
+ chunk.start = dates[0];
191
+ }
192
+ let maxEnd = addDay(cloneDate(dates.at(-1)));
193
+ if (chunk.end > maxEnd) {
194
+ chunk.end = maxEnd;
195
+ }
178
196
  } else {
179
197
  chunk.date = setMidnight(cloneDate(chunk.start));
180
198
  chunk.days = 1;
@@ -2,7 +2,6 @@ export function createResources(input) {
2
2
  return input.map(resource => ({
3
3
  id: String(resource.id),
4
4
  title: resource.title || '',
5
- titleHTML: resource.titleHTML || '',
6
5
  eventBackgroundColor: resource.eventBackgroundColor,
7
6
  eventTextColor: resource.eventTextColor
8
7
  }));
package/src/lib/utils.js CHANGED
@@ -25,3 +25,7 @@ export function max(...args) {
25
25
  export function symbol() {
26
26
  return Symbol('ec');
27
27
  }
28
+
29
+ export function isArray(value) {
30
+ return Array.isArray(value);
31
+ }
@@ -0,0 +1,50 @@
1
+ .ec-day-grid {
2
+ .ec-body {
3
+ flex: 1 1 auto;
4
+
5
+ .ec-day {
6
+ min-height: 5em;
7
+ position: relative;
8
+ }
9
+ }
10
+
11
+ .ec-content {
12
+ flex-direction: column;
13
+ height: 100%;
14
+ }
15
+
16
+ .ec-uniform {
17
+ .ec-content {
18
+ overflow: hidden; // remove scrolling due to hidden events
19
+ }
20
+ .ec-days {
21
+ flex: 1 1 0%; // % is required to work properly for both auto and fixed calendar height
22
+ min-height: 0;
23
+ }
24
+ .ec-day {
25
+ min-height: 0;
26
+ }
27
+ }
28
+
29
+ .ec-day:first-child {
30
+ border-left: none;
31
+ }
32
+
33
+ .ec-day-head {
34
+ display: block;
35
+ border: none;
36
+ text-align: right;
37
+ padding: 4px 4px 3px;
38
+ }
39
+
40
+ .ec-day-foot {
41
+ position: absolute;
42
+ bottom: 0;
43
+ padding: 2px;
44
+ font-size: .85em;
45
+
46
+ a {
47
+ cursor: pointer;
48
+ }
49
+ }
50
+ }
@@ -1,6 +1,7 @@
1
1
  @use "theme";
2
2
  @use "timeline";
3
3
  @use "time-grid";
4
+ @use "day-grid";
4
5
 
5
6
  /* Grid */
6
7
  .ec-days,
@@ -180,6 +181,7 @@
180
181
 
181
182
  .ec-day {
182
183
  padding-bottom: 4px;
184
+ position: relative;
183
185
  }
184
186
  }
185
187
 
@@ -192,10 +194,6 @@
192
194
  .ec:not(.ec-list) & {
193
195
  border-top: none;
194
196
  }
195
-
196
- .ec-day-grid & {
197
- flex: 1 1 auto;
198
- }
199
197
  }
200
198
 
201
199
  .ec-sidebar {
@@ -210,15 +208,6 @@
210
208
  .ec-content {
211
209
  display: flex;
212
210
 
213
- .ec-day-grid & {
214
- flex-direction: column;
215
- height: 100%;
216
- }
217
-
218
- .ec-day-grid .ec-uniform & {
219
- overflow: hidden; // remove scrolling due to hidden events
220
- }
221
-
222
211
  .ec-list & {
223
212
  flex-direction: column;
224
213
  }
@@ -240,11 +229,6 @@
240
229
  .ec-resource & {
241
230
  flex: 1 0 auto;
242
231
  }
243
-
244
- .ec-day-grid .ec-uniform & {
245
- flex: 1 1 0%; // % is required to work properly for both auto and fixed calendar height
246
- min-height: 0;
247
- }
248
232
  }
249
233
 
250
234
  .ec-day {
@@ -258,18 +242,7 @@
258
242
  background-color: var(--ec-highlight-color);
259
243
  }
260
244
 
261
- .ec-day-grid .ec-body & {
262
- min-height: 5em;
263
- position: relative;
264
- }
265
-
266
- .ec-day-grid .ec-uniform & {
267
- min-height: 0;
268
- }
269
245
 
270
- .ec-day-grid &:first-child {
271
- border-left: none;
272
- }
273
246
 
274
247
  &.ec-other-month .ec-day-head {
275
248
  opacity: .3;
@@ -280,26 +253,6 @@
280
253
  }
281
254
  }
282
255
 
283
- .ec-day-grid {
284
- .ec-day-head {
285
- display: block;
286
- border: none;
287
- text-align: right;
288
- padding: 4px 4px 3px;
289
- }
290
-
291
- .ec-day-foot {
292
- position: absolute;
293
- bottom: 0;
294
- padding: 2px;
295
- font-size: .85em;
296
-
297
- a {
298
- cursor: pointer;
299
- }
300
- }
301
- }
302
-
303
256
  .ec-list {
304
257
  .ec-day-head {
305
258
  background-color: var(--ec-list-day-bg-color);
@@ -446,12 +399,24 @@
446
399
 
447
400
  .ec-bg-events {
448
401
  position: relative;
402
+
403
+ .ec-day-grid &,
404
+ .ec-all-day & {
405
+ position: absolute;
406
+ inset: 0;
407
+ }
449
408
  }
450
409
 
451
410
  .ec-bg-event {
452
411
  position: absolute;
453
412
  background-color: var(--ec-bg-event-color);
454
413
  opacity: var(--ec-bg-event-opacity);
414
+
415
+ .ec-day-grid &,
416
+ .ec-all-day & {
417
+ height: 100%;
418
+ z-index: auto;
419
+ }
455
420
  }
456
421
 
457
422
  .ec-time {