@event-calendar/day-grid
Advanced tools
Comparing version 0.16.0 to 0.16.1
391
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, tick, onMount, afterUpdate, setContext } from 'svelte'; | ||
import { derived, writable } from 'svelte/store'; | ||
import { cloneDate, subtractDay, addDay, hasYScroll, setContent, maybeIgnore, toEventWithLocalDates, toViewWithLocalDates, createEventContent, height, ancestor, outsideEvent, rect, datesEqual, setMidnight, createDate, 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, toLocalDate, toISOString, assign, createEventChunk, setFn, prepareEventChunks, intl } from '@event-calendar/common'; | ||
@@ -390,3 +390,3 @@ function days(state) { | ||
if (switch_instance) mount_component(switch_instance, div1, null); | ||
/*div1_binding*/ ctx[44](div1); | ||
/*div1_binding*/ ctx[43](div1); | ||
current = true; | ||
@@ -396,3 +396,2 @@ | ||
dispose = [ | ||
listen(window, "resize", /*reposition*/ ctx[30]), | ||
action_destroyer(setContent_action = setContent.call(null, div0, /*content*/ ctx[5])), | ||
@@ -476,3 +475,3 @@ listen(div1, "click", function () { | ||
if (switch_instance) destroy_component(switch_instance); | ||
/*div1_binding*/ ctx[44](null); | ||
/*div1_binding*/ ctx[43](null); | ||
mounted = false; | ||
@@ -506,7 +505,7 @@ run_all(dispose); | ||
component_subscribe($$self, dayMaxEvents, value => $$invalidate(46, $dayMaxEvents = value)); | ||
component_subscribe($$self, displayEventEnd, value => $$invalidate(40, $displayEventEnd = value)); | ||
component_subscribe($$self, eventBackgroundColor, value => $$invalidate(43, $eventBackgroundColor = value)); | ||
component_subscribe($$self, displayEventEnd, value => $$invalidate(39, $displayEventEnd = value)); | ||
component_subscribe($$self, eventBackgroundColor, value => $$invalidate(42, $eventBackgroundColor = value)); | ||
component_subscribe($$self, eventClick, value => $$invalidate(8, $eventClick = value)); | ||
component_subscribe($$self, eventColor, value => $$invalidate(42, $eventColor = value)); | ||
component_subscribe($$self, eventContent, value => $$invalidate(39, $eventContent = 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)); | ||
@@ -516,9 +515,9 @@ component_subscribe($$self, eventMouseEnter, value => $$invalidate(9, $eventMouseEnter = value)); | ||
component_subscribe($$self, theme, value => $$invalidate(1, $theme = value)); | ||
component_subscribe($$self, _view, value => $$invalidate(37, $_view = value)); | ||
component_subscribe($$self, _intlEventTime, value => $$invalidate(38, $_intlEventTime = value)); | ||
component_subscribe($$self, _view, value => $$invalidate(36, $_view = value)); | ||
component_subscribe($$self, _intlEventTime, value => $$invalidate(37, $_intlEventTime = value)); | ||
component_subscribe($$self, _interaction, value => $$invalidate(7, $_interaction = value)); | ||
component_subscribe($$self, _classes, value => $$invalidate(41, $_classes = value)); | ||
component_subscribe($$self, _classes, value => $$invalidate(40, $_classes = value)); | ||
component_subscribe($$self, _draggable, value => $$invalidate(11, $_draggable = value)); | ||
let { _hiddenEvents } = getContext('view-state'); | ||
component_subscribe($$self, _hiddenEvents, value => $$invalidate(36, $_hiddenEvents = value)); | ||
component_subscribe($$self, _hiddenEvents, value => $$invalidate(45, $_hiddenEvents = value)); | ||
let el; | ||
@@ -545,4 +544,2 @@ let event; | ||
afterUpdate(reposition); | ||
function createHandler(fn, display) { | ||
@@ -568,40 +565,4 @@ return display !== 'preview' && is_function(fn) | ||
$$invalidate(31, chunk.ready = false, chunk); | ||
$$invalidate(31, chunk.top = 0, chunk); | ||
$$invalidate(34, margin = repositionEvent(chunk, longChunks, height(el))); | ||
if (chunk.prev) { | ||
if (!chunk.prev.ready) { | ||
// 'prev' is not ready yet, try again later | ||
tick().then(reposition); | ||
return; | ||
} | ||
$$invalidate(31, chunk.top = chunk.prev.bottom + 1, chunk); | ||
} | ||
$$invalidate(31, chunk.bottom = chunk.top + height(el), chunk); | ||
let m = 1; | ||
let key = chunk.date.getTime(); | ||
if (longChunks[key]) { | ||
for (let longChunk of longChunks[key]) { | ||
if (!longChunk.ready) { | ||
// 'longChunk' is not ready yet, try again later | ||
tick().then(reposition); | ||
return; | ||
} | ||
if (chunk.top < longChunk.bottom && chunk.bottom > longChunk.top) { | ||
let offset = longChunk.bottom - chunk.top + 1; | ||
m += offset; | ||
$$invalidate(31, chunk.top += offset, chunk); | ||
$$invalidate(31, chunk.bottom += offset, chunk); | ||
} | ||
} | ||
} | ||
$$invalidate(34, margin = m); | ||
if ($dayMaxEvents === true) { | ||
@@ -612,15 +573,8 @@ hide(); | ||
} | ||
$$invalidate(31, chunk.ready = true, chunk); | ||
} | ||
function hide() { | ||
if (!el) { | ||
return; | ||
} | ||
let dayEl = ancestor(el, 2); | ||
let h = height(dayEl) - height(dayEl.firstElementChild) - footHeight(dayEl); | ||
$$invalidate(35, hidden = chunk.bottom > h); | ||
cloneDate(chunk.date); | ||
let update = false; | ||
@@ -675,13 +629,13 @@ | ||
$$self.$$set = $$props => { | ||
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); | ||
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); | ||
}; | ||
$$self.$$.update = () => { | ||
if ($$self.$$.dirty[1] & /*chunk*/ 1) { | ||
if ($$self.$$.dirty[0] & /*chunk*/ 1073741824) { | ||
$$invalidate(0, event = chunk.event); | ||
} | ||
if ($$self.$$.dirty[0] & /*event, style, $theme*/ 19 | $$self.$$.dirty[1] & /*$eventBackgroundColor, $eventColor, chunk, margin, hidden, $_classes*/ 7193) { | ||
if ($$self.$$.dirty[0] & /*event, chunk, style, $theme*/ 1073741843 | $$self.$$.dirty[1] & /*$eventBackgroundColor, $eventColor, margin, hidden, $_classes*/ 3608) { | ||
{ | ||
@@ -707,12 +661,6 @@ $$invalidate(6, display = event.display); | ||
if ($$self.$$.dirty[0] & /*$theme*/ 2 | $$self.$$.dirty[1] & /*chunk, $displayEventEnd, $eventContent, $_intlEventTime, $_view*/ 961) { | ||
if ($$self.$$.dirty[0] & /*chunk, $theme*/ 1073741826 | $$self.$$.dirty[1] & /*$displayEventEnd, $eventContent, $_intlEventTime, $_view*/ 480) { | ||
// Content | ||
$$invalidate(5, [timeText, content] = createEventContent(chunk, $displayEventEnd, $eventContent, $theme, $_intlEventTime, $_view), content); | ||
} | ||
if ($$self.$$.dirty[1] & /*$_hiddenEvents*/ 32) { | ||
if ($_hiddenEvents) { | ||
tick().then(reposition); | ||
} | ||
} | ||
}; | ||
@@ -751,9 +699,8 @@ | ||
createDragHandler, | ||
reposition, | ||
chunk, | ||
longChunks, | ||
inPopup, | ||
reposition, | ||
margin, | ||
hidden, | ||
$_hiddenEvents, | ||
$_view, | ||
@@ -773,4 +720,23 @@ $_intlEventTime, | ||
super(); | ||
init(this, options, instance$4, create_fragment$4, safe_not_equal, { chunk: 31, longChunks: 32, inPopup: 33 }, null, [-1, -1]); | ||
init( | ||
this, | ||
options, | ||
instance$4, | ||
create_fragment$4, | ||
safe_not_equal, | ||
{ | ||
chunk: 30, | ||
longChunks: 31, | ||
inPopup: 32, | ||
reposition: 33 | ||
}, | ||
null, | ||
[-1, -1] | ||
); | ||
} | ||
get reposition() { | ||
return this.$$.ctx[33]; | ||
} | ||
} | ||
@@ -782,7 +748,7 @@ | ||
const child_ctx = ctx.slice(); | ||
child_ctx[16] = list[i]; | ||
child_ctx[18] = list[i]; | ||
return child_ctx; | ||
} | ||
// (61:8) {#each $_popupChunks as chunk (chunk.event)} | ||
// (84:8) {#each $_popupChunks as chunk (chunk.event)} | ||
function create_each_block$3(key_1, ctx) { | ||
@@ -794,3 +760,3 @@ let first; | ||
event = new Event({ | ||
props: { chunk: /*chunk*/ ctx[16], inPopup: true } | ||
props: { chunk: /*chunk*/ ctx[18], inPopup: true } | ||
}); | ||
@@ -814,3 +780,3 @@ | ||
const event_changes = {}; | ||
if (dirty & /*$_popupChunks*/ 32) event_changes.chunk = /*chunk*/ ctx[16]; | ||
if (dirty & /*$_popupChunks*/ 1) event_changes.chunk = /*chunk*/ ctx[18]; | ||
event.$set(event_changes); | ||
@@ -837,3 +803,3 @@ }, | ||
let div0; | ||
let t0_value = /*$_intlDayPopover*/ ctx[4].format(/*$_popupDate*/ ctx[2]) + ""; | ||
let t0_value = /*$_intlDayPopover*/ ctx[5].format(/*$_popupDate*/ ctx[3]) + ""; | ||
let t0; | ||
@@ -852,4 +818,4 @@ let t1; | ||
let dispose; | ||
let each_value = /*$_popupChunks*/ ctx[5]; | ||
const get_key = ctx => /*chunk*/ ctx[16].event; | ||
let each_value = /*$_popupChunks*/ ctx[0]; | ||
const get_key = ctx => /*chunk*/ ctx[18].event; | ||
@@ -877,6 +843,6 @@ for (let i = 0; i < each_value.length; i += 1) { | ||
attr(div0, "class", div0_class_value = /*$theme*/ ctx[3].dayHead); | ||
attr(div1, "class", div1_class_value = /*$theme*/ ctx[3].events); | ||
attr(div2, "class", div2_class_value = /*$theme*/ ctx[3].popup); | ||
attr(div2, "style", /*style*/ ctx[1]); | ||
attr(div0, "class", div0_class_value = /*$theme*/ ctx[4].dayHead); | ||
attr(div1, "class", div1_class_value = /*$theme*/ ctx[4].events); | ||
attr(div2, "class", div2_class_value = /*$theme*/ ctx[4].popup); | ||
attr(div2, "style", /*style*/ ctx[2]); | ||
}, | ||
@@ -911,10 +877,10 @@ m(target, anchor) { | ||
p(ctx, [dirty]) { | ||
if ((!current || dirty & /*$_intlDayPopover, $_popupDate*/ 20) && t0_value !== (t0_value = /*$_intlDayPopover*/ ctx[4].format(/*$_popupDate*/ ctx[2]) + "")) set_data(t0, t0_value); | ||
if ((!current || dirty & /*$_intlDayPopover, $_popupDate*/ 40) && t0_value !== (t0_value = /*$_intlDayPopover*/ ctx[5].format(/*$_popupDate*/ ctx[3]) + "")) set_data(t0, t0_value); | ||
if (!current || dirty & /*$theme*/ 8 && div0_class_value !== (div0_class_value = /*$theme*/ ctx[3].dayHead)) { | ||
if (!current || dirty & /*$theme*/ 16 && div0_class_value !== (div0_class_value = /*$theme*/ ctx[4].dayHead)) { | ||
attr(div0, "class", div0_class_value); | ||
} | ||
if (dirty & /*$_popupChunks*/ 32) { | ||
each_value = /*$_popupChunks*/ ctx[5]; | ||
if (dirty & /*$_popupChunks*/ 1) { | ||
each_value = /*$_popupChunks*/ ctx[0]; | ||
group_outros(); | ||
@@ -925,12 +891,12 @@ each_blocks = update_keyed_each(each_blocks, dirty, get_key, 1, ctx, each_value, each_1_lookup, div1, outro_and_destroy_block, create_each_block$3, null, get_each_context$3); | ||
if (!current || dirty & /*$theme*/ 8 && div1_class_value !== (div1_class_value = /*$theme*/ ctx[3].events)) { | ||
if (!current || dirty & /*$theme*/ 16 && div1_class_value !== (div1_class_value = /*$theme*/ ctx[4].events)) { | ||
attr(div1, "class", div1_class_value); | ||
} | ||
if (!current || dirty & /*$theme*/ 8 && div2_class_value !== (div2_class_value = /*$theme*/ ctx[3].popup)) { | ||
if (!current || dirty & /*$theme*/ 16 && div2_class_value !== (div2_class_value = /*$theme*/ ctx[4].popup)) { | ||
attr(div2, "class", div2_class_value); | ||
} | ||
if (!current || dirty & /*style*/ 2) { | ||
attr(div2, "style", /*style*/ ctx[1]); | ||
if (!current || dirty & /*style*/ 4) { | ||
attr(div2, "style", /*style*/ ctx[2]); | ||
} | ||
@@ -971,45 +937,65 @@ }, | ||
let $_popupDate; | ||
let $_popupChunks; | ||
let $theme; | ||
let $_intlDayPopover; | ||
let $_popupChunks; | ||
let { theme, _ignoreClick, _intlDayPopover } = getContext('state'); | ||
component_subscribe($$self, theme, value => $$invalidate(3, $theme = value)); | ||
component_subscribe($$self, theme, value => $$invalidate(4, $theme = value)); | ||
component_subscribe($$self, _ignoreClick, value => $$invalidate(15, $_ignoreClick = value)); | ||
component_subscribe($$self, _intlDayPopover, value => $$invalidate(4, $_intlDayPopover = value)); | ||
component_subscribe($$self, _intlDayPopover, value => $$invalidate(5, $_intlDayPopover = value)); | ||
let { _popupDate, _popupChunks } = getContext('view-state'); | ||
component_subscribe($$self, _popupDate, value => $$invalidate(2, $_popupDate = value)); | ||
component_subscribe($$self, _popupChunks, value => $$invalidate(5, $_popupChunks = value)); | ||
component_subscribe($$self, _popupDate, value => $$invalidate(3, $_popupDate = value)); | ||
component_subscribe($$self, _popupChunks, value => $$invalidate(0, $_popupChunks = value)); | ||
let el; | ||
let style = ''; | ||
onMount(() => { | ||
function position() { | ||
let dayEl = ancestor(el, 1); | ||
let bodyEl = ancestor(dayEl, 3); | ||
let popupRect = rect(el); | ||
let dayRect = rect(dayEl); | ||
let bodyRect = rect(bodyEl); | ||
if (!dayEl.previousElementSibling) { | ||
$$invalidate(1, style = 'left:0;'); | ||
$$invalidate(2, style = 'left:0;'); | ||
} else if (!dayEl.nextElementSibling) { | ||
$$invalidate(1, style = 'right:0;'); | ||
$$invalidate(2, style = 'right:0;'); | ||
} else { | ||
let left = (dayEl.offsetWidth - popupRect.width) / 2; | ||
$$invalidate(1, style = `left:${left}px;`); | ||
$$invalidate(2, style = `left:${left}px;`); | ||
} | ||
let top = (dayEl.offsetHeight - popupRect.height) / 2; | ||
let top; | ||
if (popupRect.top + top < bodyRect.top) { | ||
top = bodyRect.top - popupRect.top; | ||
} else if (popupRect.bottom + top > bodyRect.bottom) { | ||
top = bodyRect.bottom - popupRect.bottom; | ||
if (popupRect.height >= bodyRect.height) { | ||
top = bodyRect.top - dayRect.top; | ||
let bottom = dayRect.bottom - bodyRect.bottom; | ||
$$invalidate(2, style += `bottom:${bottom}px;`); | ||
} else { | ||
top = (dayRect.height - popupRect.height) / 2; | ||
if (dayRect.top + top < bodyRect.top) { | ||
top = bodyRect.top - dayRect.top; | ||
} else if (dayRect.top + top + popupRect.height > bodyRect.bottom) { | ||
top = bodyRect.bottom - dayRect.top - popupRect.height; | ||
} | ||
} | ||
$$invalidate(1, style += `top:${top}px;`); | ||
$$invalidate(2, style += `top:${top}px;`); | ||
} | ||
if (popupRect.top + top + popupRect.height > bodyRect.bottom) { | ||
let bottom = popupRect.top + dayEl.offsetHeight - bodyRect.bottom; | ||
$$invalidate(1, style += `bottom:${bottom}px;`); | ||
function reposition() { | ||
// Skip the first call (el is not defined at this time) | ||
if (el) { | ||
$$invalidate(2, style = ''); | ||
// Let chunks to update/mount then position the popup | ||
tick().then(() => { | ||
if ($_popupChunks.length) { | ||
position(); | ||
} else { | ||
close(); | ||
} | ||
}); | ||
} | ||
}); | ||
} | ||
@@ -1032,7 +1018,17 @@ function close(e) { | ||
el = $$value; | ||
$$invalidate(0, el); | ||
$$invalidate(1, el); | ||
}); | ||
} | ||
$$self.$$.update = () => { | ||
if ($$self.$$.dirty & /*$_popupChunks*/ 1) { | ||
if ($_popupChunks) { | ||
// Fire reposition only on popup chunks change | ||
reposition(); | ||
} | ||
} | ||
}; | ||
return [ | ||
$_popupChunks, | ||
el, | ||
@@ -1043,3 +1039,2 @@ style, | ||
$_intlDayPopover, | ||
$_popupChunks, | ||
theme, | ||
@@ -1068,7 +1063,9 @@ _ignoreClick, | ||
const child_ctx = ctx.slice(); | ||
child_ctx[43] = list[i]; | ||
child_ctx[46] = list[i]; | ||
child_ctx[47] = list; | ||
child_ctx[48] = i; | ||
return child_ctx; | ||
} | ||
// (129:4) {#if iChunks[1] && datesEqual(iChunks[1].date, date)} | ||
// (140:4) {#if iChunks[1] && datesEqual(iChunks[1].date, date)} | ||
function create_if_block_3(ctx) { | ||
@@ -1085,3 +1082,3 @@ let div; | ||
create_component(event.$$.fragment); | ||
attr(div, "class", div_class_value = /*$theme*/ ctx[11].events); | ||
attr(div, "class", div_class_value = /*$theme*/ ctx[12].events); | ||
}, | ||
@@ -1098,3 +1095,3 @@ m(target, anchor) { | ||
if (!current || dirty[0] & /*$theme*/ 2048 && div_class_value !== (div_class_value = /*$theme*/ ctx[11].events)) { | ||
if (!current || dirty[0] & /*$theme*/ 4096 && div_class_value !== (div_class_value = /*$theme*/ ctx[12].events)) { | ||
attr(div, "class", div_class_value); | ||
@@ -1119,3 +1116,3 @@ } | ||
// (135:4) {#if iChunks[0] && datesEqual(iChunks[0].date, date)} | ||
// (146:4) {#if iChunks[0] && datesEqual(iChunks[0].date, date)} | ||
function create_if_block_2(ctx) { | ||
@@ -1132,3 +1129,3 @@ let div; | ||
create_component(event.$$.fragment); | ||
attr(div, "class", div_class_value = "" + (/*$theme*/ ctx[11].events + " " + /*$theme*/ ctx[11].preview)); | ||
attr(div, "class", div_class_value = "" + (/*$theme*/ ctx[12].events + " " + /*$theme*/ ctx[12].preview)); | ||
}, | ||
@@ -1145,3 +1142,3 @@ m(target, anchor) { | ||
if (!current || dirty[0] & /*$theme*/ 2048 && div_class_value !== (div_class_value = "" + (/*$theme*/ ctx[11].events + " " + /*$theme*/ ctx[11].preview))) { | ||
if (!current || dirty[0] & /*$theme*/ 4096 && div_class_value !== (div_class_value = "" + (/*$theme*/ ctx[12].events + " " + /*$theme*/ ctx[12].preview))) { | ||
attr(div, "class", div_class_value); | ||
@@ -1166,15 +1163,19 @@ } | ||
// (141:8) {#each dayChunks as chunk (chunk.event)} | ||
// (152:8) {#each dayChunks as chunk, i (chunk.event)} | ||
function create_each_block$2(key_1, ctx) { | ||
let first; | ||
let event; | ||
let i = /*i*/ ctx[48]; | ||
let current; | ||
const assign_event = () => /*event_binding*/ ctx[39](event, i); | ||
const unassign_event = () => /*event_binding*/ ctx[39](null, i); | ||
event = new Event({ | ||
props: { | ||
chunk: /*chunk*/ ctx[43], | ||
longChunks: /*longChunks*/ ctx[1] | ||
} | ||
}); | ||
let event_props = { | ||
chunk: /*chunk*/ ctx[46], | ||
longChunks: /*longChunks*/ ctx[1] | ||
}; | ||
event = new Event({ props: event_props }); | ||
assign_event(); | ||
return { | ||
@@ -1195,4 +1196,11 @@ key: key_1, | ||
ctx = new_ctx; | ||
if (i !== /*i*/ ctx[48]) { | ||
unassign_event(); | ||
i = /*i*/ ctx[48]; | ||
assign_event(); | ||
} | ||
const event_changes = {}; | ||
if (dirty[0] & /*dayChunks*/ 16) event_changes.chunk = /*chunk*/ ctx[43]; | ||
if (dirty[0] & /*dayChunks*/ 16) event_changes.chunk = /*chunk*/ ctx[46]; | ||
if (dirty[0] & /*longChunks*/ 2) event_changes.longChunks = /*longChunks*/ ctx[1]; | ||
@@ -1212,2 +1220,3 @@ event.$set(event_changes); | ||
if (detaching) detach(first); | ||
unassign_event(); | ||
destroy_component(event, detaching); | ||
@@ -1218,3 +1227,3 @@ } | ||
// (145:4) {#if showPopup} | ||
// (156:4) {#if showPopup} | ||
function create_if_block_1(ctx) { | ||
@@ -1248,3 +1257,3 @@ let popup; | ||
// (149:8) {#if hiddenEvents.size} | ||
// (160:8) {#if hiddenEvents.size} | ||
function create_if_block(ctx) { | ||
@@ -1265,4 +1274,4 @@ let a; | ||
dispose = [ | ||
listen(a, "click", stop_propagation(/*showMore*/ ctx[28])), | ||
listen(a, "pointerdown", stop_propagation(/*pointerdown_handler*/ ctx[36])), | ||
listen(a, "click", stop_propagation(/*showMore*/ ctx[29])), | ||
listen(a, "pointerdown", stop_propagation(/*pointerdown_handler*/ ctx[38])), | ||
action_destroyer(setContent_action = setContent.call(null, a, /*moreLink*/ ctx[6])) | ||
@@ -1311,3 +1320,3 @@ ]; | ||
let each_value = /*dayChunks*/ ctx[4]; | ||
const get_key = ctx => /*chunk*/ ctx[43].event; | ||
const get_key = ctx => /*chunk*/ ctx[46].event; | ||
@@ -1344,10 +1353,10 @@ for (let i = 0; i < each_value.length; i += 1) { | ||
if (if_block3) if_block3.c(); | ||
attr(div0, "class", div0_class_value = /*$theme*/ ctx[11].dayHead); | ||
attr(div1, "class", div1_class_value = /*$theme*/ ctx[11].events); | ||
attr(div2, "class", div2_class_value = /*$theme*/ ctx[11].dayFoot); | ||
attr(div0, "class", div0_class_value = /*$theme*/ ctx[12].dayHead); | ||
attr(div1, "class", div1_class_value = /*$theme*/ ctx[12].events); | ||
attr(div2, "class", div2_class_value = /*$theme*/ ctx[12].dayFoot); | ||
attr(div3, "class", div3_class_value = "" + (/*$theme*/ ctx[11].day + (/*isToday*/ ctx[8] ? ' ' + /*$theme*/ ctx[11].today : '') + (/*otherMonth*/ ctx[9] | ||
? ' ' + /*$theme*/ ctx[11].otherMonth | ||
attr(div3, "class", div3_class_value = "" + (/*$theme*/ ctx[12].day + (/*isToday*/ ctx[8] ? ' ' + /*$theme*/ ctx[12].today : '') + (/*otherMonth*/ ctx[9] | ||
? ' ' + /*$theme*/ ctx[12].otherMonth | ||
: '') + (/*highlight*/ ctx[10] | ||
? ' ' + /*$theme*/ ctx[11].highlight | ||
? ' ' + /*$theme*/ ctx[12].highlight | ||
: ''))); | ||
@@ -1375,3 +1384,3 @@ }, | ||
if (if_block3) if_block3.m(div2, null); | ||
/*div3_binding*/ ctx[37](div3); | ||
/*div3_binding*/ ctx[40](div3); | ||
current = true; | ||
@@ -1381,13 +1390,14 @@ | ||
dispose = [ | ||
listen(window, "resize", /*reposition*/ ctx[31]), | ||
listen(div3, "click", function () { | ||
if (is_function(maybeIgnore(/*createClickHandler*/ ctx[26](/*$dateClick*/ ctx[12])))) maybeIgnore(/*createClickHandler*/ ctx[26](/*$dateClick*/ ctx[12])).apply(this, arguments); | ||
if (is_function(maybeIgnore(/*createClickHandler*/ ctx[27](/*$dateClick*/ ctx[13])))) maybeIgnore(/*createClickHandler*/ ctx[27](/*$dateClick*/ ctx[13])).apply(this, arguments); | ||
}), | ||
listen(div3, "pointerenter", function () { | ||
if (is_function(/*createPointerEnterHandler*/ ctx[27](/*$_interaction*/ ctx[13]))) /*createPointerEnterHandler*/ ctx[27](/*$_interaction*/ ctx[13]).apply(this, arguments); | ||
if (is_function(/*createPointerEnterHandler*/ ctx[28](/*$_interaction*/ ctx[14]))) /*createPointerEnterHandler*/ ctx[28](/*$_interaction*/ ctx[14]).apply(this, arguments); | ||
}), | ||
listen(div3, "pointerleave", function () { | ||
if (is_function(createPointerLeaveHandler(/*$_interaction*/ ctx[13]))) createPointerLeaveHandler(/*$_interaction*/ ctx[13]).apply(this, arguments); | ||
if (is_function(createPointerLeaveHandler(/*$_interaction*/ ctx[14]))) createPointerLeaveHandler(/*$_interaction*/ ctx[14]).apply(this, arguments); | ||
}), | ||
listen(div3, "pointerdown", function () { | ||
if (is_function(/*createPointerDownHandler*/ ctx[29](/*$_interaction*/ ctx[13], /*$selectable*/ ctx[14]))) /*createPointerDownHandler*/ ctx[29](/*$_interaction*/ ctx[13], /*$selectable*/ ctx[14]).apply(this, arguments); | ||
if (is_function(/*createPointerDownHandler*/ ctx[30](/*$_interaction*/ ctx[14], /*$selectable*/ ctx[15]))) /*createPointerDownHandler*/ ctx[30](/*$_interaction*/ ctx[14], /*$selectable*/ ctx[15]).apply(this, arguments); | ||
}) | ||
@@ -1403,3 +1413,3 @@ ]; | ||
if (!current || dirty[0] & /*$theme*/ 2048 && div0_class_value !== (div0_class_value = /*$theme*/ ctx[11].dayHead)) { | ||
if (!current || dirty[0] & /*$theme*/ 4096 && div0_class_value !== (div0_class_value = /*$theme*/ ctx[12].dayHead)) { | ||
attr(div0, "class", div0_class_value); | ||
@@ -1458,3 +1468,3 @@ } | ||
if (dirty[0] & /*dayChunks, longChunks*/ 18) { | ||
if (dirty[0] & /*dayChunks, longChunks, refs*/ 2066) { | ||
each_value = /*dayChunks*/ ctx[4]; | ||
@@ -1466,3 +1476,3 @@ group_outros(); | ||
if (!current || dirty[0] & /*$theme*/ 2048 && div1_class_value !== (div1_class_value = /*$theme*/ ctx[11].events)) { | ||
if (!current || dirty[0] & /*$theme*/ 4096 && div1_class_value !== (div1_class_value = /*$theme*/ ctx[12].events)) { | ||
attr(div1, "class", div1_class_value); | ||
@@ -1505,10 +1515,10 @@ } | ||
if (!current || dirty[0] & /*$theme*/ 2048 && div2_class_value !== (div2_class_value = /*$theme*/ ctx[11].dayFoot)) { | ||
if (!current || dirty[0] & /*$theme*/ 4096 && div2_class_value !== (div2_class_value = /*$theme*/ ctx[12].dayFoot)) { | ||
attr(div2, "class", div2_class_value); | ||
} | ||
if (!current || dirty[0] & /*$theme, isToday, otherMonth, highlight*/ 3840 && div3_class_value !== (div3_class_value = "" + (/*$theme*/ ctx[11].day + (/*isToday*/ ctx[8] ? ' ' + /*$theme*/ ctx[11].today : '') + (/*otherMonth*/ ctx[9] | ||
? ' ' + /*$theme*/ ctx[11].otherMonth | ||
if (!current || dirty[0] & /*$theme, isToday, otherMonth, highlight*/ 5888 && div3_class_value !== (div3_class_value = "" + (/*$theme*/ ctx[12].day + (/*isToday*/ ctx[8] ? ' ' + /*$theme*/ ctx[12].today : '') + (/*otherMonth*/ ctx[9] | ||
? ' ' + /*$theme*/ ctx[12].otherMonth | ||
: '') + (/*highlight*/ ctx[10] | ||
? ' ' + /*$theme*/ ctx[11].highlight | ||
? ' ' + /*$theme*/ ctx[12].highlight | ||
: '')))) { | ||
@@ -1552,3 +1562,3 @@ attr(div3, "class", div3_class_value); | ||
if (if_block3) if_block3.d(); | ||
/*div3_binding*/ ctx[37](null); | ||
/*div3_binding*/ ctx[40](null); | ||
mounted = false; | ||
@@ -1567,2 +1577,3 @@ run_all(dispose); | ||
function instance$2($$self, $$props, $$invalidate) { | ||
let $_hiddenEvents; | ||
let $_popupChunks; | ||
@@ -1572,3 +1583,2 @@ let $_popupDate; | ||
let $moreLinkContent; | ||
let $_hiddenEvents; | ||
let $highlightedDates; | ||
@@ -1585,14 +1595,14 @@ let $currentDate; | ||
let { date: currentDate, dateClick, dayMaxEvents, highlightedDates, moreLinkContent, theme, _view, _interaction, selectable } = getContext('state'); | ||
component_subscribe($$self, currentDate, value => $$invalidate(35, $currentDate = value)); | ||
component_subscribe($$self, dateClick, value => $$invalidate(12, $dateClick = value)); | ||
component_subscribe($$self, highlightedDates, value => $$invalidate(34, $highlightedDates = value)); | ||
component_subscribe($$self, moreLinkContent, value => $$invalidate(32, $moreLinkContent = value)); | ||
component_subscribe($$self, theme, value => $$invalidate(11, $theme = value)); | ||
component_subscribe($$self, _view, value => $$invalidate(39, $_view = value)); | ||
component_subscribe($$self, _interaction, value => $$invalidate(13, $_interaction = value)); | ||
component_subscribe($$self, selectable, value => $$invalidate(14, $selectable = value)); | ||
component_subscribe($$self, currentDate, value => $$invalidate(37, $currentDate = value)); | ||
component_subscribe($$self, dateClick, value => $$invalidate(13, $dateClick = value)); | ||
component_subscribe($$self, highlightedDates, value => $$invalidate(36, $highlightedDates = value)); | ||
component_subscribe($$self, moreLinkContent, value => $$invalidate(35, $moreLinkContent = value)); | ||
component_subscribe($$self, theme, value => $$invalidate(12, $theme = value)); | ||
component_subscribe($$self, _view, value => $$invalidate(42, $_view = value)); | ||
component_subscribe($$self, _interaction, value => $$invalidate(14, $_interaction = value)); | ||
component_subscribe($$self, selectable, value => $$invalidate(15, $selectable = value)); | ||
let { _hiddenEvents, _popupDate, _popupChunks } = getContext('view-state'); | ||
component_subscribe($$self, _hiddenEvents, value => $$invalidate(33, $_hiddenEvents = value)); | ||
component_subscribe($$self, _popupDate, value => $$invalidate(31, $_popupDate = value)); | ||
component_subscribe($$self, _popupChunks, value => $$invalidate(38, $_popupChunks = value)); | ||
component_subscribe($$self, _popupDate, value => $$invalidate(34, $_popupDate = value)); | ||
component_subscribe($$self, _popupChunks, value => $$invalidate(41, $_popupChunks = value)); | ||
let el; | ||
@@ -1607,2 +1617,3 @@ let dayChunks; | ||
let showPopup; | ||
let refs = []; | ||
@@ -1634,9 +1645,4 @@ function createClickHandler(fn) { | ||
let nextDay = addDay(cloneDate(date)); | ||
let chunks = dayChunks.concat(longChunks[date.getTime()] || []); | ||
if (chunks.every(chunk => chunk.ready)) { | ||
set_store_value(_popupChunks, $_popupChunks = chunks.map(chunk => assign({}, chunk, createEventChunk(chunk.event, date, nextDay), { days: 1, dates: [date] })).sort((a, b) => a.top - b.top), $_popupChunks); | ||
} else { | ||
tick().then(setPopupChunks); | ||
} | ||
let chunks = dayChunks.concat(longChunks[date.getTime()]?.chunks || []); | ||
set_store_value(_popupChunks, $_popupChunks = chunks.map(chunk => assign({}, chunk, createEventChunk(chunk.event, date, nextDay), { days: 1, dates: [date] })).sort((a, b) => a.top - b.top), $_popupChunks); | ||
} | ||
@@ -1650,2 +1656,12 @@ | ||
function reposition() { | ||
$$invalidate(11, refs.length = dayChunks.length, refs); | ||
for (let ref of refs) { | ||
ref && ref.reposition && ref.reposition(); | ||
} | ||
} | ||
afterUpdate(reposition); | ||
function pointerdown_handler(event) { | ||
@@ -1655,2 +1671,9 @@ bubble.call(this, $$self, event); | ||
function event_binding($$value, i) { | ||
binding_callbacks[$$value ? 'unshift' : 'push'](() => { | ||
refs[i] = $$value; | ||
$$invalidate(11, refs); | ||
}); | ||
} | ||
function div3_binding($$value) { | ||
@@ -1665,3 +1688,3 @@ binding_callbacks[$$value ? 'unshift' : 'push'](() => { | ||
if ('date' in $$props) $$invalidate(0, date = $$props.date); | ||
if ('chunks' in $$props) $$invalidate(30, chunks = $$props.chunks); | ||
if ('chunks' in $$props) $$invalidate(32, chunks = $$props.chunks); | ||
if ('longChunks' in $$props) $$invalidate(1, longChunks = $$props.longChunks); | ||
@@ -1672,7 +1695,7 @@ if ('iChunks' in $$props) $$invalidate(2, iChunks = $$props.iChunks); | ||
$$self.$$.update = () => { | ||
if ($$self.$$.dirty[0] & /*hiddenEvents, chunks, date, dayChunks*/ 1073741873) { | ||
if ($$self.$$.dirty[0] & /*hiddenEvents, date, dayChunks*/ 49 | $$self.$$.dirty[1] & /*chunks*/ 2) { | ||
{ | ||
$$invalidate(4, dayChunks = []); | ||
hiddenEvents.clear(); | ||
((($$invalidate(5, hiddenEvents), $$invalidate(30, chunks)), $$invalidate(0, date)), $$invalidate(4, dayChunks)); | ||
((($$invalidate(5, hiddenEvents), $$invalidate(32, chunks)), $$invalidate(0, date)), $$invalidate(4, dayChunks)); | ||
@@ -1692,3 +1715,3 @@ for (let chunk of chunks) { | ||
if ($$self.$$.dirty[0] & /*date*/ 1 | $$self.$$.dirty[1] & /*$currentDate, $highlightedDates*/ 24) { | ||
if ($$self.$$.dirty[0] & /*date*/ 1 | $$self.$$.dirty[1] & /*$currentDate, $highlightedDates*/ 96) { | ||
{ | ||
@@ -1701,3 +1724,3 @@ $$invalidate(8, isToday = datesEqual(date, today)); | ||
if ($$self.$$.dirty[0] & /*hiddenEvents, moreLink*/ 96 | $$self.$$.dirty[1] & /*$_hiddenEvents, $moreLinkContent*/ 6) { | ||
if ($$self.$$.dirty[0] & /*hiddenEvents, moreLink*/ 96 | $$self.$$.dirty[1] & /*$_hiddenEvents, $moreLinkContent*/ 20) { | ||
if ($_hiddenEvents && hiddenEvents.size) { | ||
@@ -1721,3 +1744,3 @@ // make Svelte update this block on $_hiddenEvents update | ||
if ($$self.$$.dirty[0] & /*date*/ 1 | $$self.$$.dirty[1] & /*$_popupDate*/ 1) { | ||
if ($$self.$$.dirty[0] & /*date*/ 1 | $$self.$$.dirty[1] & /*$_popupDate*/ 8) { | ||
$$invalidate(7, showPopup = $_popupDate && datesEqual(date, $_popupDate)); | ||
@@ -1728,3 +1751,4 @@ } | ||
if (showPopup && longChunks && dayChunks) { | ||
setPopupChunks(); | ||
// Let chunks to reposition then set popup chunks | ||
tick().then(setPopupChunks); | ||
} | ||
@@ -1739,2 +1763,8 @@ } | ||
} | ||
if ($$self.$$.dirty[1] & /*$_hiddenEvents*/ 4) { | ||
if ($_hiddenEvents) { | ||
tick().then(reposition); | ||
} | ||
} | ||
}; | ||
@@ -1754,2 +1784,3 @@ | ||
highlight, | ||
refs, | ||
$theme, | ||
@@ -1774,9 +1805,11 @@ $dateClick, | ||
createPointerDownHandler, | ||
reposition, | ||
chunks, | ||
$_hiddenEvents, | ||
$_popupDate, | ||
$moreLinkContent, | ||
$_hiddenEvents, | ||
$highlightedDates, | ||
$currentDate, | ||
pointerdown_handler, | ||
event_binding, | ||
div3_binding | ||
@@ -1798,3 +1831,3 @@ ]; | ||
date: 0, | ||
chunks: 30, | ||
chunks: 32, | ||
longChunks: 1, | ||
@@ -1801,0 +1834,0 @@ iChunks: 2 |
{ | ||
"name": "@event-calendar/day-grid", | ||
"version": "0.16.0", | ||
"version": "0.16.1", | ||
"title": "Event Calendar DayGrid plugin", | ||
@@ -39,5 +39,5 @@ "description": "Full-sized drag & drop event calendar with resource view", | ||
"dependencies": { | ||
"@event-calendar/common": "~0.16.0", | ||
"@event-calendar/common": "~0.16.1", | ||
"svelte": "^3.55.1" | ||
} | ||
} |
@@ -119,3 +119,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) [![Sponsor](https://img.shields.io/badge/Sponsor-$10-blue.svg?style=flat-square&logo=paypal)](https://www.paypal.me/vkurko/10usd) | ||
- [dateFromPoint](#datefrompoint) | ||
- [dateFromPoint](#datefrompoint-x-y-) | ||
- [getView](#getview) | ||
@@ -195,4 +195,4 @@ - [unselect](#unselect-1) | ||
```html | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@event-calendar/build@0.16.0/event-calendar.min.css"> | ||
<script src="https://cdn.jsdelivr.net/npm/@event-calendar/build@0.16.0/event-calendar.min.js"></script> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@event-calendar/build@0.16.1/event-calendar.min.css"> | ||
<script src="https://cdn.jsdelivr.net/npm/@event-calendar/build@0.16.1/event-calendar.min.js"></script> | ||
``` | ||
@@ -1995,5 +1995,5 @@ | ||
Returns the date and time that would be determined if a click was made on the specified coordinates within the application's [viewport](https://developer.mozilla.org/en-US/docs/Glossary/Viewport). | ||
Returns the date and time as if the [dateClick](#dateclick) event had fired for that point. | ||
Using this method, you can get the date and time for any point inside the calendar, as if it was clicked. For example, you want to know, when you click on a multi-day event, which day the click happened on. To do this, inside [eventClick](#eventclick), pass the `jsEvent.clientX` and `jsEvent.clientY` coordinates to `dateFromPoint` and get the date that corresponds to the place in the calendar where the click was. | ||
Using this method, you can, for example, find out on which day a click occurred inside a multi-day event. To do this, inside [eventClick](#eventclick), pass the `jsEvent.clientX` and `jsEvent.clientY` coordinates to `dateFromPoint` and get the desired date. | ||
@@ -2003,3 +2003,3 @@ <details> | ||
> In the `'listDay'`, `'listWeek'`, `'listMonth'` and `'listYear'` views, the events are rendered outside of the day container, so the method will return `null` for the coordinates that are inside the events. | ||
> In the `'listDay'`, `'listWeek'`, `'listMonth'` and `'listYear'` views, the events are rendered outside the day container, so the method will return `null` for the coordinates that are inside the events. | ||
@@ -2006,0 +2006,0 @@ </details> |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2054
134615