@event-calendar/day-grid
Advanced tools
Comparing version 2.1.0 to 2.2.0
116
index.js
import { derived, writable } from 'svelte/store'; | ||
import { cloneDate, subtractDay, addDay, setContent, helperEvent, toEventWithLocalDates, toViewWithLocalDates, createEventClasses, createEventContent, previewEvent, repositionEvent, height, ancestor, max, keyEnter, outsideEvent, rect, datesEqual, setMidnight, createDate, debounce, assign, createEventChunk, setPayload, bgEvent, eventIntersects, prepareEventChunks, btnTextMonth, themeView, intl } from '@event-calendar/core'; | ||
import { SvelteComponent, init, safe_not_equal, ensure_array_like, element, space, attr, insert, append, noop, detach, destroy_each, component_subscribe, action_destroyer, is_function, create_slot, update_slot_base, get_all_dirty_from_scope, get_slot_changes, transition_in, transition_out, binding_callbacks, construct_svelte_component, create_component, mount_component, listen, group_outros, destroy_component, check_outros, run_all, text, stop_propagation, update_keyed_each, outro_and_destroy_block, empty, set_store_value, bubble, set_data } from 'svelte/internal'; | ||
import { SvelteComponent, init, safe_not_equal, ensure_array_like, element, space, attr, insert, append, noop, detach, destroy_each, component_subscribe, action_destroyer, is_function, create_slot, update_slot_base, get_all_dirty_from_scope, get_slot_changes, transition_in, transition_out, binding_callbacks, construct_svelte_component, create_component, mount_component, listen, group_outros, destroy_component, check_outros, run_all, text, stop_propagation, update_keyed_each, outro_and_destroy_block, empty, set_store_value, bubble } from 'svelte/internal'; | ||
import { getContext, onMount, tick, afterUpdate } from 'svelte'; | ||
@@ -1046,5 +1046,5 @@ | ||
const child_ctx = ctx.slice(); | ||
child_ctx[40] = list[i]; | ||
child_ctx[41] = list; | ||
child_ctx[42] = i; | ||
child_ctx[42] = list[i]; | ||
child_ctx[43] = list; | ||
child_ctx[44] = i; | ||
return child_ctx; | ||
@@ -1151,9 +1151,9 @@ } | ||
let event; | ||
let i = /*i*/ ctx[42]; | ||
let i = /*i*/ ctx[44]; | ||
let current; | ||
const assign_event = () => /*event_binding*/ ctx[32](event, i); | ||
const unassign_event = () => /*event_binding*/ ctx[32](null, i); | ||
const assign_event = () => /*event_binding*/ ctx[34](event, i); | ||
const unassign_event = () => /*event_binding*/ ctx[34](null, i); | ||
let event_props = { | ||
chunk: /*chunk*/ ctx[40], | ||
chunk: /*chunk*/ ctx[42], | ||
longChunks: /*longChunks*/ ctx[1] | ||
@@ -1181,5 +1181,5 @@ }; | ||
if (i !== /*i*/ ctx[42]) { | ||
if (i !== /*i*/ ctx[44]) { | ||
unassign_event(); | ||
i = /*i*/ ctx[42]; | ||
i = /*i*/ ctx[44]; | ||
assign_event(); | ||
@@ -1189,3 +1189,3 @@ } | ||
const event_changes = {}; | ||
if (dirty[0] & /*dayChunks*/ 16) event_changes.chunk = /*chunk*/ ctx[40]; | ||
if (dirty[0] & /*dayChunks*/ 16) event_changes.chunk = /*chunk*/ ctx[42]; | ||
if (dirty[0] & /*longChunks*/ 2) event_changes.longChunks = /*longChunks*/ ctx[1]; | ||
@@ -1262,5 +1262,5 @@ event.$set(event_changes); | ||
dispose = [ | ||
listen(a, "click", stop_propagation(/*showMore*/ ctx[23])), | ||
listen(a, "keydown", keyEnter(/*showMore*/ ctx[23])), | ||
listen(a, "pointerdown", stop_propagation(/*pointerdown_handler*/ ctx[31])), | ||
listen(a, "click", stop_propagation(/*showMore*/ ctx[25])), | ||
listen(a, "keydown", keyEnter(/*showMore*/ ctx[25])), | ||
listen(a, "pointerdown", stop_propagation(/*pointerdown_handler*/ ctx[33])), | ||
action_destroyer(setContent_action = setContent.call(null, a, /*moreLink*/ ctx[6])) | ||
@@ -1289,10 +1289,9 @@ ]; | ||
let div0; | ||
let t0_value = /*date*/ ctx[0].getUTCDate() + ""; | ||
let div0_class_value; | ||
let setContent_action; | ||
let t0; | ||
let div0_class_value; | ||
let show_if_1 = /*iChunks*/ ctx[2][1] && datesEqual(/*iChunks*/ ctx[2][1].date, /*date*/ ctx[0]); | ||
let t1; | ||
let show_if_1 = /*iChunks*/ ctx[2][1] && datesEqual(/*iChunks*/ ctx[2][1].date, /*date*/ ctx[0]); | ||
let show_if = /*iChunks*/ ctx[2][0] && datesEqual(/*iChunks*/ ctx[2][0].date, /*date*/ ctx[0]); | ||
let t2; | ||
let show_if = /*iChunks*/ ctx[2][0] && datesEqual(/*iChunks*/ ctx[2][0].date, /*date*/ ctx[0]); | ||
let t3; | ||
let div1; | ||
@@ -1302,4 +1301,4 @@ let each_blocks = []; | ||
let div1_class_value; | ||
let t3; | ||
let t4; | ||
let t5; | ||
let div2; | ||
@@ -1314,3 +1313,3 @@ let div2_class_value; | ||
let each_value = ensure_array_like(/*dayChunks*/ ctx[4]); | ||
const get_key = ctx => /*chunk*/ ctx[40].event; | ||
const get_key = ctx => /*chunk*/ ctx[42].event; | ||
@@ -1330,8 +1329,7 @@ for (let i = 0; i < each_value.length; i += 1) { | ||
div0 = element("div"); | ||
t0 = text(t0_value); | ||
t0 = space(); | ||
if (if_block0) if_block0.c(); | ||
t1 = space(); | ||
if (if_block0) if_block0.c(); | ||
if (if_block1) if_block1.c(); | ||
t2 = space(); | ||
if (if_block1) if_block1.c(); | ||
t3 = space(); | ||
div1 = element("div"); | ||
@@ -1343,5 +1341,5 @@ | ||
t3 = space(); | ||
if (if_block2) if_block2.c(); | ||
t4 = space(); | ||
if (if_block2) if_block2.c(); | ||
t5 = space(); | ||
div2 = element("div"); | ||
@@ -1362,8 +1360,7 @@ if (if_block3) if_block3.c(); | ||
append(div3, div0); | ||
append(div0, t0); | ||
append(div3, t0); | ||
if (if_block0) if_block0.m(div3, null); | ||
append(div3, t1); | ||
if (if_block0) if_block0.m(div3, null); | ||
if (if_block1) if_block1.m(div3, null); | ||
append(div3, t2); | ||
if (if_block1) if_block1.m(div3, null); | ||
append(div3, t3); | ||
append(div3, div1); | ||
@@ -1377,8 +1374,8 @@ | ||
append(div3, t3); | ||
if (if_block2) if_block2.m(div3, null); | ||
append(div3, t4); | ||
if (if_block2) if_block2.m(div3, null); | ||
append(div3, t5); | ||
append(div3, div2); | ||
if (if_block3) if_block3.m(div2, null); | ||
/*div3_binding*/ ctx[33](div3); | ||
/*div3_binding*/ ctx[35](div3); | ||
current = true; | ||
@@ -1388,5 +1385,6 @@ | ||
dispose = [ | ||
listen(window, "resize", /*reposition*/ ctx[24]), | ||
listen(window, "resize", /*reposition*/ ctx[26]), | ||
action_destroyer(setContent_action = setContent.call(null, div0, /*$_intlDayCell*/ ctx[14].format(/*date*/ ctx[0]))), | ||
listen(div3, "pointerenter", function () { | ||
if (is_function(/*createPointerEnterHandler*/ ctx[22](/*$_interaction*/ ctx[13]))) /*createPointerEnterHandler*/ ctx[22](/*$_interaction*/ ctx[13]).apply(this, arguments); | ||
if (is_function(/*createPointerEnterHandler*/ ctx[24](/*$_interaction*/ ctx[13]))) /*createPointerEnterHandler*/ ctx[24](/*$_interaction*/ ctx[13]).apply(this, arguments); | ||
}), | ||
@@ -1406,3 +1404,2 @@ listen(div3, "pointerleave", function () { | ||
ctx = new_ctx; | ||
if ((!current || dirty[0] & /*date*/ 1) && t0_value !== (t0_value = /*date*/ ctx[0].getUTCDate() + "")) set_data(t0, t0_value); | ||
@@ -1413,2 +1410,3 @@ if (!current || dirty[0] & /*$theme*/ 4096 && div0_class_value !== (div0_class_value = /*$theme*/ ctx[12].dayHead)) { | ||
if (setContent_action && is_function(setContent_action.update) && dirty[0] & /*$_intlDayCell, date*/ 16385) setContent_action.update.call(null, /*$_intlDayCell*/ ctx[14].format(/*date*/ ctx[0])); | ||
if (dirty[0] & /*iChunks, date*/ 5) show_if_1 = /*iChunks*/ ctx[2][1] && datesEqual(/*iChunks*/ ctx[2][1].date, /*date*/ ctx[0]); | ||
@@ -1427,3 +1425,3 @@ | ||
transition_in(if_block0, 1); | ||
if_block0.m(div3, t2); | ||
if_block0.m(div3, t1); | ||
} | ||
@@ -1453,3 +1451,3 @@ } else if (if_block0) { | ||
transition_in(if_block1, 1); | ||
if_block1.m(div3, t3); | ||
if_block1.m(div3, t2); | ||
} | ||
@@ -1486,3 +1484,3 @@ } else if (if_block1) { | ||
transition_in(if_block2, 1); | ||
if_block2.m(div3, t5); | ||
if_block2.m(div3, t4); | ||
} | ||
@@ -1561,3 +1559,3 @@ } else if (if_block2) { | ||
if (if_block3) if_block3.d(); | ||
/*div3_binding*/ ctx[33](null); | ||
/*div3_binding*/ ctx[35](null); | ||
mounted = false; | ||
@@ -1578,2 +1576,3 @@ run_all(dispose); | ||
let $_interaction; | ||
let $_intlDayCell; | ||
let { date } = $$props; | ||
@@ -1583,10 +1582,11 @@ let { chunks } = $$props; | ||
let { iChunks = [] } = $$props; | ||
let { date: currentDate, dayMaxEvents, highlightedDates, moreLinkContent, theme, _hiddenEvents, _popupDate, _popupChunks, _interaction, _queue } = getContext('state'); | ||
component_subscribe($$self, currentDate, value => $$invalidate(30, $currentDate = value)); | ||
component_subscribe($$self, highlightedDates, value => $$invalidate(29, $highlightedDates = value)); | ||
component_subscribe($$self, moreLinkContent, value => $$invalidate(28, $moreLinkContent = value)); | ||
let { date: currentDate, dayMaxEvents, highlightedDates, moreLinkContent, theme, _hiddenEvents, _intlDayCell, _popupDate, _popupChunks, _interaction, _queue } = getContext('state'); | ||
component_subscribe($$self, currentDate, value => $$invalidate(32, $currentDate = value)); | ||
component_subscribe($$self, highlightedDates, value => $$invalidate(31, $highlightedDates = value)); | ||
component_subscribe($$self, moreLinkContent, value => $$invalidate(30, $moreLinkContent = value)); | ||
component_subscribe($$self, theme, value => $$invalidate(12, $theme = value)); | ||
component_subscribe($$self, _hiddenEvents, value => $$invalidate(26, $_hiddenEvents = value)); | ||
component_subscribe($$self, _popupDate, value => $$invalidate(27, $_popupDate = value)); | ||
component_subscribe($$self, _popupChunks, value => $$invalidate(34, $_popupChunks = value)); | ||
component_subscribe($$self, _hiddenEvents, value => $$invalidate(28, $_hiddenEvents = value)); | ||
component_subscribe($$self, _intlDayCell, value => $$invalidate(14, $_intlDayCell = value)); | ||
component_subscribe($$self, _popupDate, value => $$invalidate(29, $_popupDate = value)); | ||
component_subscribe($$self, _popupChunks, value => $$invalidate(36, $_popupChunks = value)); | ||
component_subscribe($$self, _interaction, value => $$invalidate(13, $_interaction = value)); | ||
@@ -1651,3 +1651,3 @@ let el; | ||
if ('date' in $$props) $$invalidate(0, date = $$props.date); | ||
if ('chunks' in $$props) $$invalidate(25, chunks = $$props.chunks); | ||
if ('chunks' in $$props) $$invalidate(27, chunks = $$props.chunks); | ||
if ('longChunks' in $$props) $$invalidate(1, longChunks = $$props.longChunks); | ||
@@ -1658,7 +1658,7 @@ if ('iChunks' in $$props) $$invalidate(2, iChunks = $$props.iChunks); | ||
$$self.$$.update = () => { | ||
if ($$self.$$.dirty[0] & /*hiddenEvents, chunks, date, dayChunks*/ 33554481) { | ||
if ($$self.$$.dirty[0] & /*hiddenEvents, chunks, date, dayChunks*/ 134217777) { | ||
{ | ||
$$invalidate(4, dayChunks = []); | ||
hiddenEvents.clear(); | ||
((($$invalidate(5, hiddenEvents), $$invalidate(25, chunks)), $$invalidate(0, date)), $$invalidate(4, dayChunks)); | ||
((($$invalidate(5, hiddenEvents), $$invalidate(27, chunks)), $$invalidate(0, date)), $$invalidate(4, dayChunks)); | ||
@@ -1678,3 +1678,3 @@ for (let chunk of chunks) { | ||
if ($$self.$$.dirty[0] & /*date, $currentDate, $highlightedDates*/ 1610612737) { | ||
if ($$self.$$.dirty[0] & /*date*/ 1 | $$self.$$.dirty[1] & /*$currentDate, $highlightedDates*/ 3) { | ||
{ | ||
@@ -1687,3 +1687,3 @@ $$invalidate(8, isToday = datesEqual(date, today)); | ||
if ($$self.$$.dirty[0] & /*$_hiddenEvents, hiddenEvents, $moreLinkContent, moreLink*/ 335544416) { | ||
if ($$self.$$.dirty[0] & /*$_hiddenEvents, hiddenEvents, $moreLinkContent, moreLink*/ 1342177376) { | ||
if ($_hiddenEvents && hiddenEvents.size) { | ||
@@ -1707,3 +1707,3 @@ // make Svelte update this block on $_hiddenEvents update | ||
if ($$self.$$.dirty[0] & /*$_popupDate, date*/ 134217729) { | ||
if ($$self.$$.dirty[0] & /*$_popupDate, date*/ 536870913) { | ||
$$invalidate(7, showPopup = $_popupDate && datesEqual(date, $_popupDate)); | ||
@@ -1731,3 +1731,3 @@ } | ||
if ($$self.$$.dirty[0] & /*$_hiddenEvents*/ 67108864) { | ||
if ($$self.$$.dirty[0] & /*$_hiddenEvents*/ 268435456) { | ||
if ($_hiddenEvents) { | ||
@@ -1754,2 +1754,3 @@ debounce(reposition, debounceHandle, _queue); | ||
$_interaction, | ||
$_intlDayCell, | ||
currentDate, | ||
@@ -1760,2 +1761,3 @@ highlightedDates, | ||
_hiddenEvents, | ||
_intlDayCell, | ||
_popupDate, | ||
@@ -1791,3 +1793,3 @@ _popupChunks, | ||
date: 0, | ||
chunks: 25, | ||
chunks: 27, | ||
longChunks: 1, | ||
@@ -2278,2 +2280,3 @@ iChunks: 2 | ||
options.dayMaxEvents = false; | ||
options.dayCellFormat = {day: 'numeric'}; | ||
options.dayPopoverFormat = {month: 'long', day: 'numeric', year: 'numeric'}; | ||
@@ -2301,2 +2304,3 @@ options.moreLinkContent = undefined; | ||
state._days = days(state); | ||
state._intlDayCell = intl(state.locale, state.dayCellFormat); | ||
state._intlDayPopover = intl(state.locale, state.dayPopoverFormat); | ||
@@ -2303,0 +2307,0 @@ state._hiddenEvents = writable({}); |
{ | ||
"name": "@event-calendar/day-grid", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"title": "Event Calendar DayGrid plugin", | ||
@@ -29,5 +29,5 @@ "description": "Full-sized drag & drop event calendar with resource view", | ||
"dependencies": { | ||
"@event-calendar/core": "~2.1.0", | ||
"@event-calendar/core": "~2.2.0", | ||
"svelte": "^4.1.1" | ||
} | ||
} |
@@ -29,2 +29,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) | ||
- [datesSet](#datesset) | ||
- [dayCellFormat](#daycellformat) | ||
- [dayHeaderFormat](#dayheaderformat) | ||
@@ -48,5 +49,5 @@ - [dayMaxEvents](#daymaxevents) | ||
- [eventDrop](#eventdrop) | ||
- [eventDurationEditable](#eventdurationeditable) | ||
</td><td> | ||
- [eventDurationEditable](#eventdurationeditable) | ||
- [eventLongPressDelay](#eventlongpressdelay) | ||
@@ -77,5 +78,5 @@ - [eventMouseEnter](#eventmouseenter) | ||
- [noEventsClick](#noeventsclick) | ||
- [noEventsContent](#noeventscontent) | ||
</td><td> | ||
- [noEventsContent](#noeventscontent) | ||
- [nowIndicator](#nowindicator) | ||
@@ -201,4 +202,4 @@ - [pointer](#pointer) | ||
```html | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@event-calendar/build@2.1.0/event-calendar.min.css"> | ||
<script src="https://cdn.jsdelivr.net/npm/@event-calendar/build@2.1.0/event-calendar.min.js"></script> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@event-calendar/build@2.2.0/event-calendar.min.css"> | ||
<script src="https://cdn.jsdelivr.net/npm/@event-calendar/build@2.2.0/event-calendar.min.js"></script> | ||
``` | ||
@@ -460,2 +461,25 @@ | ||
### dayCellFormat | ||
- Type `object` or `function` | ||
- Default `{day: 'numeric'}` | ||
Defines the text that is displayed inside the day cell in the `dayGrid` view. | ||
This value can be either an object with options for the native JavaScript [Intl.DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat) object, or a callback function that returns a [Content](#content) with the formatted string: | ||
```js | ||
function (date) { | ||
// return Content with the formatted date string | ||
} | ||
``` | ||
<table> | ||
<tr> | ||
<td> | ||
`date` | ||
</td> | ||
<td>JavaScript Date object that needs to be formatted</td> | ||
</tr> | ||
</table> | ||
### dayHeaderFormat | ||
@@ -462,0 +486,0 @@ - Type `object` or `function` |
@@ -9,2 +9,3 @@ import {writable} from 'svelte/store'; | ||
options.dayMaxEvents = false; | ||
options.dayCellFormat = {day: 'numeric'}; | ||
options.dayPopoverFormat = {month: 'long', day: 'numeric', year: 'numeric'}; | ||
@@ -32,2 +33,3 @@ options.moreLinkContent = undefined; | ||
state._days = days(state); | ||
state._intlDayCell = intl(state.locale, state.dayCellFormat); | ||
state._intlDayPopover = intl(state.locale, state.dayPopoverFormat); | ||
@@ -34,0 +36,0 @@ state._hiddenEvents = writable({}); |
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
140544
2051
2727
+ Added@event-calendar/core@2.2.0(transitive)
- Removed@event-calendar/core@2.1.0(transitive)
Updated@event-calendar/core@~2.2.0