@event-calendar/core 3.7.0 → 3.7.2

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
@@ -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 & timeline views:
6
6
 
7
- * Lightweight (36kb [br](https://en.wikipedia.org/wiki/Brotli) compressed)
7
+ * Lightweight (37kb [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
 
@@ -203,8 +203,8 @@ Or in your Svelte component, use the calendar like this:
203
203
  ### Pre-built browser ready bundle
204
204
  Include the following lines of code in the `<head>` section of your page:
205
205
  ```html
206
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@event-calendar/build@3.7.0/event-calendar.min.css">
207
- <script src="https://cdn.jsdelivr.net/npm/@event-calendar/build@3.7.0/event-calendar.min.js"></script>
206
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@event-calendar/build@3.7.2/event-calendar.min.css">
207
+ <script src="https://cdn.jsdelivr.net/npm/@event-calendar/build@3.7.2/event-calendar.min.js"></script>
208
208
  ```
209
209
 
210
210
  <details>
package/index.css CHANGED
@@ -593,6 +593,7 @@
593
593
  white-space: nowrap;
594
594
  margin: 0 0 1px 0;
595
595
  flex-shrink: 0;
596
+ max-height: 100%;
596
597
  }
597
598
  .ec-day-grid .ec-event-time, .ec-timeline .ec-event-time {
598
599
  margin: 0 3px 0 0;
package/index.js CHANGED
@@ -307,10 +307,6 @@ function getPayload(obj) {
307
307
  return obj[payloadProp];
308
308
  }
309
309
 
310
- function removePayload(obj) {
311
- delete obj?.[payloadProp];
312
- }
313
-
314
310
  function createElement(tag, className, content, attrs = []) {
315
311
  let el = document.createElement(tag);
316
312
  el.className = className;
@@ -465,7 +461,7 @@ function sortEventChunks(chunks) {
465
461
  function createEventContent(chunk, displayEventEnd, eventContent, theme, _intlEventTime, _view) {
466
462
  let timeText = _intlEventTime.formatRange(
467
463
  chunk.start,
468
- displayEventEnd && chunk.event.display !== 'pointer'
464
+ displayEventEnd && chunk.event.display !== 'pointer' && !chunk.zeroDuration
469
465
  ? copyTime(cloneDate(chunk.start), chunk.end) // make Intl.formatRange output only the time part
470
466
  : chunk.start
471
467
  );
@@ -502,6 +498,13 @@ function createEventContent(chunk, displayEventEnd, eventContent, theme, _intlEv
502
498
  return [timeText, content];
503
499
  }
504
500
 
501
+ function handleZeroDurationChunk(chunk, preferredDuration) {
502
+ if (datesEqual(chunk.start, chunk.end)) {
503
+ chunk.zeroDuration = true;
504
+ chunk.end = addDuration(cloneDate(chunk.end), preferredDuration);
505
+ }
506
+ }
507
+
505
508
  function createTimeElement(timeText, chunk, theme) {
506
509
  return createElement(
507
510
  'time',
@@ -2936,4 +2939,4 @@ class index extends Calendar {
2936
2939
  }
2937
2940
  }
2938
2941
 
2939
- 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, createResource, createResources, createSlotTimeLimits, createTimes, createView, datesEqual, debounce, index as default, eventIntersects, floor, flushDebounce, getElementWithPayload, getPayload, ghostEvent, hasPayload, hasYScroll, height, helperEvent, identity, intl, intlRange, isArray, isFunction, keyEnter, keys, listView, listen, max, min, nextClosestDay, nextDate, noTimePart, noop, outsideEvent, pointerEvent, prepareEventChunks, prevClosestDay, prevDate, previewEvent, rect, removePayload, repositionEvent, resourceBackgroundColor, resourceTextColor, run, runAll, runReposition, setContent, setMidnight, setPayload, sortEventChunks, subtractDay, subtractDuration, symbol, task, themeView, timelineView, toEventWithLocalDates, toISOString, toLocalDate, toSeconds, toViewWithLocalDates, viewResources };
2942
+ 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, createResource, createResources, createSlotTimeLimits, createTimes, createView, datesEqual, debounce, index as default, eventIntersects, floor, flushDebounce, getElementWithPayload, getPayload, ghostEvent, handleZeroDurationChunk, hasPayload, hasYScroll, height, helperEvent, identity, intl, intlRange, isArray, isFunction, keyEnter, keys, listView, listen, max, min, nextClosestDay, nextDate, noTimePart, noop, outsideEvent, pointerEvent, prepareEventChunks, prevClosestDay, prevDate, previewEvent, rect, repositionEvent, resourceBackgroundColor, resourceTextColor, run, runAll, 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.7.0",
3
+ "version": "3.7.2",
4
4
  "title": "Event Calendar Core package",
5
5
  "description": "Full-sized drag & drop event calendar with resource & timeline views",
6
6
  "keywords": [
package/src/lib/events.js CHANGED
@@ -1,4 +1,4 @@
1
- import {addDay, datesEqual, createDate, cloneDate, setMidnight, toLocalDate, toISOString, noTimePart, copyTime} from './date';
1
+ import {addDay, addDuration, datesEqual, createDate, cloneDate, setMidnight, toLocalDate, toISOString, noTimePart, copyTime} from './date';
2
2
  import {createElement} from './dom';
3
3
  import {assign, isArray, isFunction} from './utils';
4
4
  import {toViewWithLocalDates} from './view';
@@ -71,7 +71,7 @@ export function sortEventChunks(chunks) {
71
71
  export function createEventContent(chunk, displayEventEnd, eventContent, theme, _intlEventTime, _view) {
72
72
  let timeText = _intlEventTime.formatRange(
73
73
  chunk.start,
74
- displayEventEnd && chunk.event.display !== 'pointer'
74
+ displayEventEnd && chunk.event.display !== 'pointer' && !chunk.zeroDuration
75
75
  ? copyTime(cloneDate(chunk.start), chunk.end) // make Intl.formatRange output only the time part
76
76
  : chunk.start
77
77
  );
@@ -108,6 +108,13 @@ export function createEventContent(chunk, displayEventEnd, eventContent, theme,
108
108
  return [timeText, content];
109
109
  }
110
110
 
111
+ export function handleZeroDurationChunk(chunk, preferredDuration) {
112
+ if (datesEqual(chunk.start, chunk.end)) {
113
+ chunk.zeroDuration = true;
114
+ chunk.end = addDuration(cloneDate(chunk.end), preferredDuration);
115
+ }
116
+ }
117
+
111
118
  function createTimeElement(timeText, chunk, theme) {
112
119
  return createElement(
113
120
  'time',
@@ -12,7 +12,3 @@ export function hasPayload(obj) {
12
12
  export function getPayload(obj) {
13
13
  return obj[payloadProp];
14
14
  }
15
-
16
- export function removePayload(obj) {
17
- delete obj?.[payloadProp];
18
- }
@@ -371,6 +371,7 @@
371
371
  white-space: nowrap;
372
372
  margin: 0 0 1px 0;
373
373
  flex-shrink: 0;
374
+ max-height: 100%;
374
375
 
375
376
  .ec-day-grid &,
376
377
  .ec-timeline & {