@event-calendar/day-grid
Advanced tools
Comparing version 0.17.1 to 0.18.0
92
index.js
import { SvelteComponent, init, safe_not_equal, element, space, attr, insert, append, noop, detach, destroy_each, component_subscribe, text, set_data, create_slot, listen, is_function, update_slot_base, get_all_dirty_from_scope, get_slot_changes, transition_in, transition_out, run_all, set_store_value, binding_callbacks, construct_svelte_component, create_component, mount_component, action_destroyer, group_outros, destroy_component, check_outros, stop_propagation, update_keyed_each, outro_and_destroy_block, empty, bubble } from 'svelte/internal'; | ||
import { getContext, onMount, tick, afterUpdate, setContext } from 'svelte'; | ||
import { derived, writable } from 'svelte/store'; | ||
import { cloneDate, subtractDay, addDay, hasYScroll, setContent, maybeIgnore, toEventWithLocalDates, toViewWithLocalDates, createEventContent, repositionEvent, height, ancestor, outsideEvent, rect, datesEqual, setMidnight, createDate, debounce, toLocalDate, toISOString, assign, createEventChunk, setFn, prepareEventChunks, intl } from '@event-calendar/common'; | ||
import { cloneDate, subtractDay, addDay, hasYScroll, setContent, maybeIgnore, toEventWithLocalDates, toViewWithLocalDates, createEventContent, repositionEvent, height, ancestor, outsideEvent, rect, datesEqual, setMidnight, createDate, debounce, toLocalDate, toISOString, assign, createEventChunk, setFn, eventIntersects, prepareEventChunks, intl } from '@event-calendar/common'; | ||
@@ -372,3 +372,3 @@ function days(state) { | ||
switch_instance = construct_svelte_component(switch_value, switch_props(ctx)); | ||
switch_instance.$on("pointerdown", /*createDragHandler*/ ctx[29](true)); | ||
switch_instance.$on("pointerdown", /*createDragHandler*/ ctx[30](true)); | ||
} | ||
@@ -391,3 +391,3 @@ | ||
if (switch_instance) mount_component(switch_instance, div1, null); | ||
/*div1_binding*/ ctx[43](div1); | ||
/*div1_binding*/ ctx[45](div1); | ||
current = true; | ||
@@ -399,15 +399,15 @@ | ||
listen(div1, "click", function () { | ||
if (is_function(maybeIgnore(/*createHandler*/ ctx[28](/*$eventClick*/ ctx[8], /*display*/ ctx[6])))) maybeIgnore(/*createHandler*/ ctx[28](/*$eventClick*/ ctx[8], /*display*/ ctx[6])).apply(this, arguments); | ||
if (is_function(maybeIgnore(/*createHandler*/ ctx[29](/*$eventClick*/ ctx[8], /*display*/ ctx[6])))) maybeIgnore(/*createHandler*/ ctx[29](/*$eventClick*/ ctx[8], /*display*/ ctx[6])).apply(this, arguments); | ||
}), | ||
listen(div1, "mouseenter", function () { | ||
if (is_function(/*createHandler*/ ctx[28](/*$eventMouseEnter*/ ctx[9], /*display*/ ctx[6]))) /*createHandler*/ ctx[28](/*$eventMouseEnter*/ ctx[9], /*display*/ ctx[6]).apply(this, arguments); | ||
if (is_function(/*createHandler*/ ctx[29](/*$eventMouseEnter*/ ctx[9], /*display*/ ctx[6]))) /*createHandler*/ ctx[29](/*$eventMouseEnter*/ ctx[9], /*display*/ ctx[6]).apply(this, arguments); | ||
}), | ||
listen(div1, "mouseleave", function () { | ||
if (is_function(/*createHandler*/ ctx[28](/*$eventMouseLeave*/ ctx[10], /*display*/ ctx[6]))) /*createHandler*/ ctx[28](/*$eventMouseLeave*/ ctx[10], /*display*/ ctx[6]).apply(this, arguments); | ||
if (is_function(/*createHandler*/ ctx[29](/*$eventMouseLeave*/ ctx[10], /*display*/ ctx[6]))) /*createHandler*/ ctx[29](/*$eventMouseLeave*/ ctx[10], /*display*/ ctx[6]).apply(this, arguments); | ||
}), | ||
listen(div1, "pointerdown", function () { | ||
if (is_function(/*display*/ ctx[6] === 'auto' && /*$_draggable*/ ctx[11](/*event*/ ctx[0]) | ||
? /*createDragHandler*/ ctx[29]() | ||
? /*createDragHandler*/ ctx[30]() | ||
: undefined)) (/*display*/ ctx[6] === 'auto' && /*$_draggable*/ ctx[11](/*event*/ ctx[0]) | ||
? /*createDragHandler*/ ctx[29]() | ||
? /*createDragHandler*/ ctx[30]() | ||
: undefined).apply(this, arguments); | ||
@@ -445,3 +445,3 @@ }) | ||
switch_instance = construct_svelte_component(switch_value, switch_props(ctx)); | ||
switch_instance.$on("pointerdown", /*createDragHandler*/ ctx[29](true)); | ||
switch_instance.$on("pointerdown", /*createDragHandler*/ ctx[30](true)); | ||
create_component(switch_instance.$$.fragment); | ||
@@ -477,3 +477,3 @@ transition_in(switch_instance.$$.fragment, 1); | ||
if (switch_instance) destroy_component(switch_instance); | ||
/*div1_binding*/ ctx[43](null); | ||
/*div1_binding*/ ctx[45](null); | ||
mounted = false; | ||
@@ -498,2 +498,3 @@ run_all(dispose); | ||
let $eventBackgroundColor; | ||
let $_resBgColor; | ||
let $eventClick; | ||
@@ -506,20 +507,21 @@ let $eventMouseEnter; | ||
let { inPopup = false } = $$props; | ||
let { dayMaxEvents, displayEventEnd, eventBackgroundColor, eventClick, eventColor, eventContent, eventDidMount, eventMouseEnter, eventMouseLeave, theme, _view, _intlEventTime, _interaction, _classes, _draggable } = getContext('state'); | ||
component_subscribe($$self, dayMaxEvents, value => $$invalidate(46, $dayMaxEvents = value)); | ||
component_subscribe($$self, displayEventEnd, value => $$invalidate(39, $displayEventEnd = value)); | ||
component_subscribe($$self, eventBackgroundColor, value => $$invalidate(42, $eventBackgroundColor = value)); | ||
let { dayMaxEvents, displayEventEnd, eventBackgroundColor, eventClick, eventColor, eventContent, eventDidMount, eventMouseEnter, eventMouseLeave, theme, _view, _intlEventTime, _interaction, _classes, _draggable, _resBgColor } = getContext('state'); | ||
component_subscribe($$self, dayMaxEvents, value => $$invalidate(48, $dayMaxEvents = value)); | ||
component_subscribe($$self, displayEventEnd, value => $$invalidate(40, $displayEventEnd = value)); | ||
component_subscribe($$self, eventBackgroundColor, value => $$invalidate(43, $eventBackgroundColor = value)); | ||
component_subscribe($$self, eventClick, value => $$invalidate(8, $eventClick = value)); | ||
component_subscribe($$self, eventColor, value => $$invalidate(41, $eventColor = value)); | ||
component_subscribe($$self, eventContent, value => $$invalidate(38, $eventContent = value)); | ||
component_subscribe($$self, eventDidMount, value => $$invalidate(47, $eventDidMount = value)); | ||
component_subscribe($$self, eventColor, value => $$invalidate(42, $eventColor = value)); | ||
component_subscribe($$self, eventContent, value => $$invalidate(39, $eventContent = value)); | ||
component_subscribe($$self, eventDidMount, value => $$invalidate(49, $eventDidMount = value)); | ||
component_subscribe($$self, eventMouseEnter, value => $$invalidate(9, $eventMouseEnter = value)); | ||
component_subscribe($$self, eventMouseLeave, value => $$invalidate(10, $eventMouseLeave = value)); | ||
component_subscribe($$self, theme, value => $$invalidate(1, $theme = value)); | ||
component_subscribe($$self, _view, value => $$invalidate(36, $_view = value)); | ||
component_subscribe($$self, _intlEventTime, value => $$invalidate(37, $_intlEventTime = value)); | ||
component_subscribe($$self, _view, value => $$invalidate(37, $_view = value)); | ||
component_subscribe($$self, _intlEventTime, value => $$invalidate(38, $_intlEventTime = value)); | ||
component_subscribe($$self, _interaction, value => $$invalidate(7, $_interaction = value)); | ||
component_subscribe($$self, _classes, value => $$invalidate(40, $_classes = value)); | ||
component_subscribe($$self, _classes, value => $$invalidate(41, $_classes = value)); | ||
component_subscribe($$self, _draggable, value => $$invalidate(11, $_draggable = value)); | ||
component_subscribe($$self, _resBgColor, value => $$invalidate(44, $_resBgColor = value)); | ||
let { _hiddenEvents } = getContext('view-state'); | ||
component_subscribe($$self, _hiddenEvents, value => $$invalidate(45, $_hiddenEvents = value)); | ||
component_subscribe($$self, _hiddenEvents, value => $$invalidate(47, $_hiddenEvents = value)); | ||
let el; | ||
@@ -566,3 +568,3 @@ let event; | ||
$$invalidate(34, margin = repositionEvent(chunk, longChunks, height(el))); | ||
$$invalidate(35, margin = repositionEvent(chunk, longChunks, height(el))); | ||
@@ -572,3 +574,3 @@ if ($dayMaxEvents === true) { | ||
} else { | ||
$$invalidate(35, hidden = false); | ||
$$invalidate(36, hidden = false); | ||
} | ||
@@ -580,3 +582,3 @@ } | ||
let h = height(dayEl) - height(dayEl.firstElementChild) - footHeight(dayEl); | ||
$$invalidate(35, hidden = chunk.bottom > h); | ||
$$invalidate(36, hidden = chunk.bottom > h); | ||
let update = false; | ||
@@ -631,13 +633,13 @@ | ||
$$self.$$set = $$props => { | ||
if ('chunk' in $$props) $$invalidate(30, chunk = $$props.chunk); | ||
if ('longChunks' in $$props) $$invalidate(31, longChunks = $$props.longChunks); | ||
if ('inPopup' in $$props) $$invalidate(32, inPopup = $$props.inPopup); | ||
if ('chunk' in $$props) $$invalidate(31, chunk = $$props.chunk); | ||
if ('longChunks' in $$props) $$invalidate(32, longChunks = $$props.longChunks); | ||
if ('inPopup' in $$props) $$invalidate(33, inPopup = $$props.inPopup); | ||
}; | ||
$$self.$$.update = () => { | ||
if ($$self.$$.dirty[0] & /*chunk*/ 1073741824) { | ||
if ($$self.$$.dirty[1] & /*chunk*/ 1) { | ||
$$invalidate(0, event = chunk.event); | ||
} | ||
if ($$self.$$.dirty[0] & /*event, chunk, style, $theme*/ 1073741843 | $$self.$$.dirty[1] & /*$eventBackgroundColor, $eventColor, margin, hidden, $_classes*/ 3608) { | ||
if ($$self.$$.dirty[0] & /*event, style, $theme*/ 19 | $$self.$$.dirty[1] & /*$_resBgColor, $eventBackgroundColor, $eventColor, chunk, margin, hidden, $_classes*/ 15409) { | ||
{ | ||
@@ -647,3 +649,3 @@ $$invalidate(6, display = event.display); | ||
// Class & Style | ||
let bgColor = event.backgroundColor || $eventBackgroundColor || $eventColor; | ||
let bgColor = event.backgroundColor || $_resBgColor(event) || $eventBackgroundColor || $eventColor; | ||
@@ -664,3 +666,3 @@ $$invalidate(4, style = `width:calc(${chunk.days * 100}% + ${(chunk.days - 1) * 7}px);` + `margin-top:${margin}px;`); | ||
if ($$self.$$.dirty[0] & /*chunk, $theme*/ 1073741826 | $$self.$$.dirty[1] & /*$displayEventEnd, $eventContent, $_intlEventTime, $_view*/ 480) { | ||
if ($$self.$$.dirty[0] & /*$theme*/ 2 | $$self.$$.dirty[1] & /*chunk, $displayEventEnd, $eventContent, $_intlEventTime, $_view*/ 961) { | ||
// Content | ||
@@ -699,2 +701,3 @@ $$invalidate(5, [timeText, content] = createEventContent(chunk, $displayEventEnd, $eventContent, $theme, $_intlEventTime, $_view), content); | ||
_draggable, | ||
_resBgColor, | ||
_hiddenEvents, | ||
@@ -716,2 +719,3 @@ createHandler, | ||
$eventBackgroundColor, | ||
$_resBgColor, | ||
div1_binding | ||
@@ -732,6 +736,6 @@ ]; | ||
{ | ||
chunk: 30, | ||
longChunks: 31, | ||
inPopup: 32, | ||
reposition: 33 | ||
chunk: 31, | ||
longChunks: 32, | ||
inPopup: 33, | ||
reposition: 34 | ||
}, | ||
@@ -744,3 +748,3 @@ null, | ||
get reposition() { | ||
return this.$$.ctx[33]; | ||
return this.$$.ctx[34]; | ||
} | ||
@@ -1803,7 +1807,7 @@ } | ||
const child_ctx = ctx.slice(); | ||
child_ctx[15] = list[i]; | ||
child_ctx[14] = list[i]; | ||
return child_ctx; | ||
} | ||
// (49:4) {#each dates as date} | ||
// (45:4) {#each dates as date} | ||
function create_each_block$1(ctx) { | ||
@@ -1815,3 +1819,3 @@ let day; | ||
props: { | ||
date: /*date*/ ctx[15], | ||
date: /*date*/ ctx[14], | ||
chunks: /*chunks*/ ctx[1], | ||
@@ -1833,3 +1837,3 @@ longChunks: /*longChunks*/ ctx[2], | ||
const day_changes = {}; | ||
if (dirty & /*dates*/ 1) day_changes.date = /*date*/ ctx[15]; | ||
if (dirty & /*dates*/ 1) day_changes.date = /*date*/ ctx[14]; | ||
if (dirty & /*chunks*/ 2) day_changes.chunks = /*chunks*/ ctx[1]; | ||
@@ -1961,6 +1965,2 @@ if (dirty & /*longChunks*/ 4) day_changes.longChunks = /*longChunks*/ ctx[2]; | ||
function intersects(event) { | ||
return event.start < end && event.end > start || datesEqual(event.start, event.end, start); | ||
} | ||
$$self.$$set = $$props => { | ||
@@ -1983,3 +1983,3 @@ if ('dates' in $$props) $$invalidate(0, dates = $$props.dates); | ||
for (let event of $_events) { | ||
if (event.display !== 'background' && intersects(event)) { | ||
if (event.display !== 'background' && eventIntersects(event, start, end)) { | ||
let chunk = createEventChunk(event, start, end); | ||
@@ -1998,3 +1998,3 @@ chunks.push(chunk); | ||
if (event && intersects(event)) { | ||
if (event && eventIntersects(event, start, end)) { | ||
chunk = createEventChunk(event, start, end); | ||
@@ -2001,0 +2001,0 @@ prepareEventChunks([chunk], $hiddenDays); |
{ | ||
"name": "@event-calendar/day-grid", | ||
"version": "0.17.1", | ||
"version": "0.18.0", | ||
"title": "Event Calendar DayGrid plugin", | ||
@@ -39,5 +39,5 @@ "description": "Full-sized drag & drop event calendar with resource view", | ||
"dependencies": { | ||
"@event-calendar/common": "~0.17.1", | ||
"@event-calendar/common": "~0.18.0", | ||
"svelte": "^3.55.1" | ||
} | ||
} |
@@ -7,3 +7,3 @@ # Event Calendar [![](https://data.jsdelivr.com/v1/package/npm/@event-calendar/build/badge)](https://www.jsdelivr.com/package/npm/@event-calendar/build) [![npm](https://img.shields.io/npm/dm/@event-calendar/core?color=red&label=npm&style=flat-square)](https://www.npmjs.com/package/@event-calendar/core) | ||
* Lightweight (37kb [br](https://en.wikipedia.org/wiki/Brotli) compressed) | ||
* Lightweight (38kb [br](https://en.wikipedia.org/wiki/Brotli) compressed) | ||
* Zero-dependency (pre-built bundle) | ||
@@ -196,4 +196,4 @@ * Used on over 60,000 websites with [Bookly](https://wordpress.org/plugins/bookly-responsive-appointment-booking-tool/) | ||
```html | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@event-calendar/build@0.17.1/event-calendar.min.css"> | ||
<script src="https://cdn.jsdelivr.net/npm/@event-calendar/build@0.17.1/event-calendar.min.js"></script> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@event-calendar/build@0.18.0/event-calendar.min.css"> | ||
<script src="https://cdn.jsdelivr.net/npm/@event-calendar/build@0.18.0/event-calendar.min.js"></script> | ||
``` | ||
@@ -2205,3 +2205,3 @@ | ||
`boolean` Determines if the event is shown in the all-day slot. Default `false` | ||
`boolean` Determines if the event is shown in the all-day slot. Defaults to `true` if `start` and `end` are both passed without a time part, `false` otherwise | ||
</td> | ||
@@ -2387,2 +2387,9 @@ </tr> | ||
</tr> | ||
<tr> | ||
<td> | ||
`eventBackgroundColor` | ||
</td> | ||
<td>Default background color for this resource's events</td> | ||
</tr> | ||
</table> | ||
@@ -2425,2 +2432,12 @@ | ||
</tr> | ||
<tr> | ||
<td> | ||
`eventBackgroundColor` | ||
</td> | ||
<td> | ||
`string` Sets the default background color for this resource's events just like the calendar-wide [eventBackgroundColor](#eventbackgroundcolor) option. Default `undefined` | ||
</td> | ||
</tr> | ||
</table> | ||
@@ -2427,0 +2444,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
135901
2056
2493
+ Added@event-calendar/common@0.18.1(transitive)
- Removed@event-calendar/common@0.17.1(transitive)