@event-calendar/list
Advanced tools
Comparing version 1.0.0 to 1.1.0
115
index.js
import { SvelteComponent, init, safe_not_equal, create_slot, element, attr, insert, append, update_slot_base, get_all_dirty_from_scope, get_slot_changes, transition_in, transition_out, detach, component_subscribe, binding_callbacks, space, action_destroyer, listen, is_function, noop, run_all, empty, group_outros, check_outros, text, set_data, update_keyed_each, outro_and_destroy_block, create_component, mount_component, destroy_component, set_store_value, destroy_each } from 'svelte/internal'; | ||
import { getContext, onMount, setContext } from 'svelte'; | ||
import { setContent, toEventWithLocalDates, toViewWithLocalDates, createEventContent, setMidnight, createDate, addDay, cloneDate, bgEvent, eventIntersects, createEventChunk, sortEventChunks, datesEqual, toLocalDate, toISOString, setPayload, intl } from '@event-calendar/common'; | ||
import { setContent, toEventWithLocalDates, toViewWithLocalDates, createEventContent, setMidnight, createDate, addDay, cloneDate, bgEvent, eventIntersects, createEventChunk, sortEventChunks, datesEqual, setPayload, intl } from '@event-calendar/common'; | ||
@@ -135,3 +135,3 @@ /* packages/list/src/Body.svelte generated by Svelte v3.58.0 */ | ||
append(div2, div1); | ||
/*div2_binding*/ ctx[29](div2); | ||
/*div2_binding*/ ctx[33](div2); | ||
@@ -142,9 +142,9 @@ if (!mounted) { | ||
listen(div2, "click", function () { | ||
if (is_function(/*createHandler*/ ctx[19](/*$eventClick*/ ctx[4]))) /*createHandler*/ ctx[19](/*$eventClick*/ ctx[4]).apply(this, arguments); | ||
if (is_function(/*createHandler*/ ctx[21](/*$eventClick*/ ctx[4]))) /*createHandler*/ ctx[21](/*$eventClick*/ ctx[4]).apply(this, arguments); | ||
}), | ||
listen(div2, "mouseenter", function () { | ||
if (is_function(/*createHandler*/ ctx[19](/*$eventMouseEnter*/ ctx[5]))) /*createHandler*/ ctx[19](/*$eventMouseEnter*/ ctx[5]).apply(this, arguments); | ||
if (is_function(/*createHandler*/ ctx[21](/*$eventMouseEnter*/ ctx[5]))) /*createHandler*/ ctx[21](/*$eventMouseEnter*/ ctx[5]).apply(this, arguments); | ||
}), | ||
listen(div2, "mouseleave", function () { | ||
if (is_function(/*createHandler*/ ctx[19](/*$eventMouseLeave*/ ctx[6]))) /*createHandler*/ ctx[19](/*$eventMouseLeave*/ ctx[6]).apply(this, arguments); | ||
if (is_function(/*createHandler*/ ctx[21](/*$eventMouseLeave*/ ctx[6]))) /*createHandler*/ ctx[21](/*$eventMouseLeave*/ ctx[6]).apply(this, arguments); | ||
}) | ||
@@ -181,3 +181,3 @@ ]; | ||
if (detaching) detach(div2); | ||
/*div2_binding*/ ctx[29](null); | ||
/*div2_binding*/ ctx[33](null); | ||
mounted = false; | ||
@@ -196,2 +196,4 @@ run_all(dispose); | ||
let $displayEventEnd; | ||
let $eventTextColor; | ||
let $_resTxtColor; | ||
let $eventColor; | ||
@@ -204,15 +206,17 @@ let $eventBackgroundColor; | ||
let { chunk } = $$props; | ||
let { displayEventEnd, eventBackgroundColor, eventColor, eventContent, eventClick, eventDidMount, eventMouseEnter, eventMouseLeave, theme, _view, _intlEventTime, _resBgColor } = getContext('state'); | ||
component_subscribe($$self, displayEventEnd, value => $$invalidate(25, $displayEventEnd = value)); | ||
component_subscribe($$self, eventBackgroundColor, value => $$invalidate(27, $eventBackgroundColor = value)); | ||
component_subscribe($$self, eventColor, value => $$invalidate(26, $eventColor = value)); | ||
component_subscribe($$self, eventContent, value => $$invalidate(24, $eventContent = value)); | ||
let { displayEventEnd, eventBackgroundColor, eventTextColor, eventColor, eventContent, eventClick, eventDidMount, eventMouseEnter, eventMouseLeave, theme, _view, _intlEventTime, _resBgColor, _resTxtColor } = getContext('state'); | ||
component_subscribe($$self, displayEventEnd, value => $$invalidate(27, $displayEventEnd = value)); | ||
component_subscribe($$self, eventBackgroundColor, value => $$invalidate(31, $eventBackgroundColor = value)); | ||
component_subscribe($$self, eventTextColor, value => $$invalidate(28, $eventTextColor = value)); | ||
component_subscribe($$self, eventColor, value => $$invalidate(30, $eventColor = value)); | ||
component_subscribe($$self, eventContent, value => $$invalidate(26, $eventContent = value)); | ||
component_subscribe($$self, eventClick, value => $$invalidate(4, $eventClick = value)); | ||
component_subscribe($$self, eventDidMount, value => $$invalidate(31, $eventDidMount = value)); | ||
component_subscribe($$self, eventDidMount, value => $$invalidate(35, $eventDidMount = value)); | ||
component_subscribe($$self, eventMouseEnter, value => $$invalidate(5, $eventMouseEnter = value)); | ||
component_subscribe($$self, eventMouseLeave, value => $$invalidate(6, $eventMouseLeave = value)); | ||
component_subscribe($$self, theme, value => $$invalidate(0, $theme = value)); | ||
component_subscribe($$self, _view, value => $$invalidate(22, $_view = value)); | ||
component_subscribe($$self, _intlEventTime, value => $$invalidate(23, $_intlEventTime = value)); | ||
component_subscribe($$self, _resBgColor, value => $$invalidate(28, $_resBgColor = value)); | ||
component_subscribe($$self, _view, value => $$invalidate(24, $_view = value)); | ||
component_subscribe($$self, _intlEventTime, value => $$invalidate(25, $_intlEventTime = value)); | ||
component_subscribe($$self, _resBgColor, value => $$invalidate(32, $_resBgColor = value)); | ||
component_subscribe($$self, _resTxtColor, value => $$invalidate(29, $_resTxtColor = value)); | ||
let el; | ||
@@ -256,13 +260,15 @@ let event; | ||
$$self.$$set = $$props => { | ||
if ('chunk' in $$props) $$invalidate(20, chunk = $$props.chunk); | ||
if ('chunk' in $$props) $$invalidate(22, chunk = $$props.chunk); | ||
}; | ||
$$self.$$.update = () => { | ||
if ($$self.$$.dirty[0] & /*chunk*/ 1048576) { | ||
$$invalidate(21, event = chunk.event); | ||
if ($$self.$$.dirty[0] & /*chunk*/ 4194304) { | ||
$$invalidate(23, event = chunk.event); | ||
} | ||
if ($$self.$$.dirty[0] & /*event, $_resBgColor, $eventBackgroundColor, $eventColor*/ 471859200) { | ||
if ($$self.$$.dirty[0] & /*event, $eventColor, $_resTxtColor, $eventTextColor, style*/ 1887436804 | $$self.$$.dirty[1] & /*$_resBgColor, $eventBackgroundColor*/ 3) { | ||
{ | ||
// Class & Style | ||
$$invalidate(2, style = ''); | ||
let bgColor = event.backgroundColor || $_resBgColor(event) || $eventBackgroundColor || $eventColor; | ||
@@ -273,6 +279,12 @@ | ||
} | ||
let txtColor = event.textColor || $_resTxtColor(event) || $eventTextColor; | ||
if (txtColor) { | ||
$$invalidate(2, style += `color:${txtColor};`); | ||
} | ||
} | ||
} | ||
if ($$self.$$.dirty[0] & /*chunk, $displayEventEnd, $eventContent, $theme, $_intlEventTime, $_view*/ 63963137) { | ||
if ($$self.$$.dirty[0] & /*chunk, $displayEventEnd, $eventContent, $theme, $_intlEventTime, $_view*/ 255852545) { | ||
{ | ||
@@ -295,2 +307,3 @@ // Content | ||
eventBackgroundColor, | ||
eventTextColor, | ||
eventColor, | ||
@@ -306,2 +319,3 @@ eventContent, | ||
_resBgColor, | ||
_resTxtColor, | ||
createHandler, | ||
@@ -314,2 +328,4 @@ chunk, | ||
$displayEventEnd, | ||
$eventTextColor, | ||
$_resTxtColor, | ||
$eventColor, | ||
@@ -325,3 +341,3 @@ $eventBackgroundColor, | ||
super(); | ||
init(this, options, instance$2, create_fragment$2, safe_not_equal, { chunk: 20 }, null, [-1, -1]); | ||
init(this, options, instance$2, create_fragment$2, safe_not_equal, { chunk: 22 }, null, [-1, -1]); | ||
} | ||
@@ -334,7 +350,7 @@ } | ||
const child_ctx = ctx.slice(); | ||
child_ctx[24] = list[i]; | ||
child_ctx[19] = list[i]; | ||
return child_ctx; | ||
} | ||
// (69:0) {#if chunks.length} | ||
// (51:0) {#if chunks.length} | ||
function create_if_block$1(ctx) { | ||
@@ -358,3 +374,3 @@ let div; | ||
let each_value = /*chunks*/ ctx[2]; | ||
const get_key = ctx => /*chunk*/ ctx[24].event; | ||
const get_key = ctx => /*chunk*/ ctx[19].event; | ||
@@ -393,3 +409,3 @@ for (let i = 0; i < each_value.length; i += 1) { | ||
append(span, t2); | ||
/*div_binding*/ ctx[19](div); | ||
/*div_binding*/ ctx[17](div); | ||
insert(target, t3, anchor); | ||
@@ -407,4 +423,4 @@ | ||
if (!mounted) { | ||
dispose = listen(div, "click", function () { | ||
if (is_function(/*createClickHandler*/ ctx[16](/*$dateClick*/ ctx[6]))) /*createClickHandler*/ ctx[16](/*$dateClick*/ ctx[6]).apply(this, arguments); | ||
dispose = listen(div, "pointerdown", function () { | ||
if (is_function(/*$_interaction*/ ctx[6].action?.select)) /*$_interaction*/ ctx[6].action?.select.apply(this, arguments); | ||
}); | ||
@@ -455,3 +471,3 @@ | ||
if (detaching) detach(div); | ||
/*div_binding*/ ctx[19](null); | ||
/*div_binding*/ ctx[17](null); | ||
if (detaching) detach(t3); | ||
@@ -470,3 +486,3 @@ | ||
// (78:4) {#each chunks as chunk (chunk.event)} | ||
// (60:4) {#each chunks as chunk (chunk.event)} | ||
function create_each_block$1(key_1, ctx) { | ||
@@ -476,3 +492,3 @@ let first; | ||
let current; | ||
event = new Event({ props: { chunk: /*chunk*/ ctx[24] } }); | ||
event = new Event({ props: { chunk: /*chunk*/ ctx[19] } }); | ||
@@ -495,3 +511,3 @@ return { | ||
const event_changes = {}; | ||
if (dirty & /*chunks*/ 4) event_changes.chunk = /*chunk*/ ctx[24]; | ||
if (dirty & /*chunks*/ 4) event_changes.chunk = /*chunk*/ ctx[19]; | ||
event.$set(event_changes); | ||
@@ -571,15 +587,13 @@ }, | ||
function instance$1($$self, $$props, $$invalidate) { | ||
let $_view; | ||
let $highlightedDates; | ||
let $_events; | ||
let $theme; | ||
let $dateClick; | ||
let $_interaction; | ||
let $_intlListDayFormat; | ||
let $_intlListDaySideFormat; | ||
let { date } = $$props; | ||
let { _events, _intlDayHeader, _view, date: currentDate, dateClick, highlightedDates, theme } = getContext('state'); | ||
component_subscribe($$self, _events, value => $$invalidate(18, $_events = value)); | ||
component_subscribe($$self, _view, value => $$invalidate(20, $_view = value)); | ||
component_subscribe($$self, dateClick, value => $$invalidate(6, $dateClick = value)); | ||
component_subscribe($$self, highlightedDates, value => $$invalidate(17, $highlightedDates = value)); | ||
let { _events, _interaction, highlightedDates, theme } = getContext('state'); | ||
component_subscribe($$self, _events, value => $$invalidate(16, $_events = value)); | ||
component_subscribe($$self, _interaction, value => $$invalidate(6, $_interaction = value)); | ||
component_subscribe($$self, highlightedDates, value => $$invalidate(15, $highlightedDates = value)); | ||
component_subscribe($$self, theme, value => $$invalidate(5, $theme = value)); | ||
@@ -593,17 +607,2 @@ let { _intlListDayFormat, _intlListDaySideFormat } = getContext('view-state'); | ||
function createClickHandler(fn) { | ||
return is_function(fn) | ||
? jsEvent => { | ||
fn({ | ||
allDay: true, | ||
date: toLocalDate(date), | ||
dateStr: toISOString(date), | ||
dayEl: el, | ||
jsEvent, | ||
view: toViewWithLocalDates($_view) | ||
}); | ||
} | ||
: undefined; | ||
} | ||
function div_binding($$value) { | ||
@@ -621,3 +620,3 @@ binding_callbacks[$$value ? 'unshift' : 'push'](() => { | ||
$$self.$$.update = () => { | ||
if ($$self.$$.dirty & /*date, $_events, chunks*/ 262149) { | ||
if ($$self.$$.dirty & /*date, $_events, chunks*/ 65541) { | ||
{ | ||
@@ -639,3 +638,3 @@ $$invalidate(2, chunks = []); | ||
if ($$self.$$.dirty & /*date, $highlightedDates*/ 131073) { | ||
if ($$self.$$.dirty & /*date, $highlightedDates*/ 32769) { | ||
{ | ||
@@ -667,8 +666,7 @@ $$invalidate(3, isToday = datesEqual(date, today)); | ||
$theme, | ||
$dateClick, | ||
$_interaction, | ||
$_intlListDayFormat, | ||
$_intlListDaySideFormat, | ||
_events, | ||
_view, | ||
dateClick, | ||
_interaction, | ||
highlightedDates, | ||
@@ -678,3 +676,2 @@ theme, | ||
_intlListDaySideFormat, | ||
createClickHandler, | ||
$highlightedDates, | ||
@@ -681,0 +678,0 @@ $_events, |
{ | ||
"name": "@event-calendar/list", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"title": "Event Calendar List plugin", | ||
@@ -39,5 +39,5 @@ "description": "Full-sized drag & drop event calendar with resource view", | ||
"dependencies": { | ||
"@event-calendar/common": "~1.0.0", | ||
"@event-calendar/common": "~1.1.0", | ||
"svelte": "^3.55.1" | ||
} | ||
} |
@@ -7,3 +7,3 @@ # Event Calendar [](https://www.jsdelivr.com/package/npm/@event-calendar/build) [](https://www.npmjs.com/package/@event-calendar/core) | ||
* Lightweight (34kb [br](https://en.wikipedia.org/wiki/Brotli) compressed) | ||
* Lightweight (29kb [br](https://en.wikipedia.org/wiki/Brotli) compressed) | ||
* Zero-dependency (pre-built bundle) | ||
@@ -58,2 +58,3 @@ * Used on over 60,000 websites with [Bookly](https://wordpress.org/plugins/bookly-responsive-appointment-booking-tool/) | ||
- [eventStartEditable](#eventstarteditable) | ||
- [eventTextColor](#eventtextcolor) | ||
- [eventTimeFormat](#eventtimeformat) | ||
@@ -197,4 +198,4 @@ - [filterResourcesWithEvents](#filterresourceswithevents) | ||
```html | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@event-calendar/build@1.0.0/event-calendar.min.css"> | ||
<script src="https://cdn.jsdelivr.net/npm/@event-calendar/build@1.0.0/event-calendar.min.js"></script> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@event-calendar/build@1.1.0/event-calendar.min.css"> | ||
<script src="https://cdn.jsdelivr.net/npm/@event-calendar/build@1.1.0/event-calendar.min.js"></script> | ||
``` | ||
@@ -1254,2 +1255,10 @@ | ||
### eventTextColor | ||
- Type `string` | ||
- Default `undefined` | ||
Sets the default text color for events on the calendar. | ||
You can use any of the CSS color formats such `'#f00'`, `'#ff0000'`, `'rgb(255,0,0)'`, or `'red'`. | ||
### filterResourcesWithEvents | ||
@@ -2194,2 +2203,12 @@ - Type `boolean` | ||
`textColor` | ||
</td> | ||
<td> | ||
The [eventTextColor](#eventtextcolor) override for this specific event | ||
</td> | ||
</tr> | ||
<tr> | ||
<td> | ||
`extendedProps` | ||
@@ -2332,2 +2351,12 @@ </td> | ||
`textColor` | ||
</td> | ||
<td> | ||
`string` Sets the event’s text color just like the calendar-wide [eventTextColor](#eventtextcolor) option. Default `undefined` | ||
</td> | ||
</tr> | ||
<tr> | ||
<td> | ||
`color` | ||
@@ -2435,2 +2464,9 @@ </td> | ||
</tr> | ||
<tr> | ||
<td> | ||
`eventTextColor` | ||
</td> | ||
<td>Default text color for this resource's events</td> | ||
</tr> | ||
</table> | ||
@@ -2483,2 +2519,12 @@ | ||
</tr> | ||
<tr> | ||
<td> | ||
`eventTextColor` | ||
</td> | ||
<td> | ||
`string` Sets the default text color for this resource's events just like the calendar-wide [eventTextColor](#eventtextcolor) option. Default `undefined` | ||
</td> | ||
</tr> | ||
</table> | ||
@@ -2485,0 +2531,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
94653
2577
995
+ Added@event-calendar/common@1.1.1(transitive)
- Removed@event-calendar/common@1.0.0(transitive)