@event-calendar/core
Advanced tools
Comparing version 0.11.2 to 0.12.0
136
index.js
@@ -1,2 +0,2 @@ | ||
import { is_function, tick, noop, identity, SvelteComponent, init, safe_not_equal, empty, insert, destroy_each, detach, component_subscribe, set_store_value, element, text, attr, append, listen, set_data, transition_in, group_outros, check_outros, transition_out, space, create_component, mount_component, destroy_component, set_style } from 'svelte/internal'; | ||
import { is_function, tick, noop, identity, SvelteComponent, init, safe_not_equal, empty, insert, destroy_each, detach, component_subscribe, set_store_value, element, text, attr, append, listen, set_data, transition_in, group_outros, check_outros, transition_out, space, create_component, mount_component, destroy_component, construct_svelte_component, set_style } from 'svelte/internal'; | ||
import { getContext, setContext } from 'svelte'; | ||
@@ -51,2 +51,3 @@ import { derived, writable, get } from 'svelte/store'; | ||
nowIndicator: false, | ||
selectable: false, | ||
scrollTime: '06:00:00', | ||
@@ -451,3 +452,3 @@ slotDuration: '00:30:00', | ||
/* packages/core/src/Buttons.svelte generated by Svelte v3.49.0 */ | ||
/* packages/core/src/Buttons.svelte generated by Svelte v3.51.0 */ | ||
@@ -855,3 +856,3 @@ function get_each_context$1(ctx, list, i) { | ||
/* packages/core/src/Toolbar.svelte generated by Svelte v3.49.0 */ | ||
/* packages/core/src/Toolbar.svelte generated by Svelte v3.51.0 */ | ||
@@ -1226,3 +1227,3 @@ function get_each_context(ctx, list, i) { | ||
/* packages/core/src/Calendar.svelte generated by Svelte v3.49.0 */ | ||
/* packages/core/src/Calendar.svelte generated by Svelte v3.51.0 */ | ||
@@ -1239,3 +1240,3 @@ function create_fragment(ctx) { | ||
toolbar = new Toolbar({}); | ||
var switch_value = /*$_viewComponent*/ ctx[4]; | ||
var switch_value = /*$_viewComponent*/ ctx[5]; | ||
@@ -1247,6 +1248,6 @@ function switch_props(ctx) { | ||
if (switch_value) { | ||
switch_instance0 = new switch_value(switch_props()); | ||
switch_instance0 = construct_svelte_component(switch_value, switch_props()); | ||
} | ||
var switch_value_1 = /*$_interaction*/ ctx[5].component; | ||
var switch_value_1 = /*$_interaction*/ ctx[0].component; | ||
@@ -1258,3 +1259,3 @@ function switch_props_1(ctx) { | ||
if (switch_value_1) { | ||
switch_instance1 = new switch_value_1(switch_props_1()); | ||
switch_instance1 = construct_svelte_component(switch_value_1, switch_props_1()); | ||
} | ||
@@ -1271,9 +1272,9 @@ | ||
attr(div, "class", div_class_value = "" + (/*$theme*/ ctx[0].calendar + (/*$_viewClass*/ ctx[1] | ||
? ' ' + /*$theme*/ ctx[0][/*$_viewClass*/ ctx[1]] | ||
: '') + (/*$_iClass*/ ctx[2] | ||
? ' ' + /*$theme*/ ctx[0][/*$_iClass*/ ctx[2]] | ||
attr(div, "class", div_class_value = "" + (/*$theme*/ ctx[1].calendar + (/*$_viewClass*/ ctx[2] | ||
? ' ' + /*$theme*/ ctx[1][/*$_viewClass*/ ctx[2]] | ||
: '') + (/*$_iClass*/ ctx[3] | ||
? ' ' + /*$theme*/ ctx[1][/*$_iClass*/ ctx[3]] | ||
: ''))); | ||
set_style(div, "height", /*$height*/ ctx[3]); | ||
set_style(div, "height", /*$height*/ ctx[4]); | ||
}, | ||
@@ -1284,17 +1285,9 @@ m(target, anchor) { | ||
append(div, t0); | ||
if (switch_instance0) { | ||
mount_component(switch_instance0, div, null); | ||
} | ||
if (switch_instance0) mount_component(switch_instance0, div, null); | ||
append(div, t1); | ||
if (switch_instance1) { | ||
mount_component(switch_instance1, div, null); | ||
} | ||
if (switch_instance1) mount_component(switch_instance1, div, null); | ||
current = true; | ||
}, | ||
p(ctx, [dirty]) { | ||
if (switch_value !== (switch_value = /*$_viewComponent*/ ctx[4])) { | ||
p(ctx, dirty) { | ||
if (switch_value !== (switch_value = /*$_viewComponent*/ ctx[5])) { | ||
if (switch_instance0) { | ||
@@ -1312,3 +1305,3 @@ group_outros(); | ||
if (switch_value) { | ||
switch_instance0 = new switch_value(switch_props()); | ||
switch_instance0 = construct_svelte_component(switch_value, switch_props()); | ||
create_component(switch_instance0.$$.fragment); | ||
@@ -1322,3 +1315,3 @@ transition_in(switch_instance0.$$.fragment, 1); | ||
if (switch_value_1 !== (switch_value_1 = /*$_interaction*/ ctx[5].component)) { | ||
if (switch_value_1 !== (switch_value_1 = /*$_interaction*/ ctx[0].component)) { | ||
if (switch_instance1) { | ||
@@ -1336,3 +1329,3 @@ group_outros(); | ||
if (switch_value_1) { | ||
switch_instance1 = new switch_value_1(switch_props_1()); | ||
switch_instance1 = construct_svelte_component(switch_value_1, switch_props_1()); | ||
create_component(switch_instance1.$$.fragment); | ||
@@ -1346,6 +1339,6 @@ transition_in(switch_instance1.$$.fragment, 1); | ||
if (!current || dirty & /*$theme, $_viewClass, $_iClass*/ 7 && div_class_value !== (div_class_value = "" + (/*$theme*/ ctx[0].calendar + (/*$_viewClass*/ ctx[1] | ||
? ' ' + /*$theme*/ ctx[0][/*$_viewClass*/ ctx[1]] | ||
: '') + (/*$_iClass*/ ctx[2] | ||
? ' ' + /*$theme*/ ctx[0][/*$_iClass*/ ctx[2]] | ||
if (!current || dirty[0] & /*$theme, $_viewClass, $_iClass*/ 14 && div_class_value !== (div_class_value = "" + (/*$theme*/ ctx[1].calendar + (/*$_viewClass*/ ctx[2] | ||
? ' ' + /*$theme*/ ctx[1][/*$_viewClass*/ ctx[2]] | ||
: '') + (/*$_iClass*/ ctx[3] | ||
? ' ' + /*$theme*/ ctx[1][/*$_iClass*/ ctx[3]] | ||
: '')))) { | ||
@@ -1355,4 +1348,4 @@ attr(div, "class", div_class_value); | ||
if (!current || dirty & /*$height*/ 8) { | ||
set_style(div, "height", /*$height*/ ctx[3]); | ||
if (!current || dirty[0] & /*$height*/ 16) { | ||
set_style(div, "height", /*$height*/ ctx[4]); | ||
} | ||
@@ -1386,2 +1379,3 @@ }, | ||
let $eventSources; | ||
let $_interaction; | ||
let $theme; | ||
@@ -1392,3 +1386,2 @@ let $_viewClass; | ||
let $_viewComponent; | ||
let $_interaction; | ||
let { plugins = [] } = $$props; | ||
@@ -1399,11 +1392,11 @@ let { options = {} } = $$props; | ||
let { _viewComponent, _viewClass, _interaction, _iClass, _events, events, eventSources, height, theme } = state; | ||
component_subscribe($$self, _viewComponent, value => $$invalidate(4, $_viewComponent = value)); | ||
component_subscribe($$self, _viewClass, value => $$invalidate(1, $_viewClass = value)); | ||
component_subscribe($$self, _interaction, value => $$invalidate(5, $_interaction = value)); | ||
component_subscribe($$self, _iClass, value => $$invalidate(2, $_iClass = value)); | ||
component_subscribe($$self, _events, value => $$invalidate(27, $_events = value)); | ||
component_subscribe($$self, events, value => $$invalidate(26, $events = value)); | ||
component_subscribe($$self, eventSources, value => $$invalidate(28, $eventSources = value)); | ||
component_subscribe($$self, height, value => $$invalidate(3, $height = value)); | ||
component_subscribe($$self, theme, value => $$invalidate(0, $theme = value)); | ||
component_subscribe($$self, _viewComponent, value => $$invalidate(5, $_viewComponent = value)); | ||
component_subscribe($$self, _viewClass, value => $$invalidate(2, $_viewClass = value)); | ||
component_subscribe($$self, _interaction, value => $$invalidate(0, $_interaction = value)); | ||
component_subscribe($$self, _iClass, value => $$invalidate(3, $_iClass = value)); | ||
component_subscribe($$self, _events, value => $$invalidate(28, $_events = value)); | ||
component_subscribe($$self, events, value => $$invalidate(27, $events = value)); | ||
component_subscribe($$self, eventSources, value => $$invalidate(29, $eventSources = value)); | ||
component_subscribe($$self, height, value => $$invalidate(4, $height = value)); | ||
component_subscribe($$self, theme, value => $$invalidate(1, $theme = value)); | ||
@@ -1476,2 +1469,10 @@ function setOption(name, value) { | ||
function unselect() { | ||
if ($_interaction.action) { | ||
$_interaction.action.clearSelection(); | ||
} | ||
return this; | ||
} | ||
function updateEvents(func) { | ||
@@ -1491,3 +1492,3 @@ if ($eventSources.length) { | ||
$$self.$$.update = () => { | ||
if ($$self.$$.dirty & /*options*/ 65536) { | ||
if ($$self.$$.dirty[0] & /*options*/ 65536) { | ||
// Reactively update options that did change | ||
@@ -1501,2 +1502,3 @@ for (let [name, value] of diff(options)) { | ||
return [ | ||
$_interaction, | ||
$theme, | ||
@@ -1507,3 +1509,2 @@ $_viewClass, | ||
$_viewComponent, | ||
$_interaction, | ||
_viewComponent, | ||
@@ -1528,3 +1529,4 @@ _viewClass, | ||
removeEventById, | ||
getView | ||
getView, | ||
unselect | ||
]; | ||
@@ -1537,15 +1539,25 @@ } | ||
init(this, options, instance, create_fragment, safe_not_equal, { | ||
plugins: 15, | ||
options: 16, | ||
setOption: 17, | ||
getOption: 18, | ||
refetchEvents: 19, | ||
getEvents: 20, | ||
getEventById: 21, | ||
addEvent: 22, | ||
updateEvent: 23, | ||
removeEventById: 24, | ||
getView: 25 | ||
}); | ||
init( | ||
this, | ||
options, | ||
instance, | ||
create_fragment, | ||
safe_not_equal, | ||
{ | ||
plugins: 15, | ||
options: 16, | ||
setOption: 17, | ||
getOption: 18, | ||
refetchEvents: 19, | ||
getEvents: 20, | ||
getEventById: 21, | ||
addEvent: 22, | ||
updateEvent: 23, | ||
removeEventById: 24, | ||
getView: 25, | ||
unselect: 26 | ||
}, | ||
null, | ||
[-1, -1] | ||
); | ||
} | ||
@@ -1588,4 +1600,8 @@ | ||
} | ||
get unselect() { | ||
return this.$$.ctx[26]; | ||
} | ||
} | ||
export { Calendar as default }; |
{ | ||
"name": "@event-calendar/core", | ||
"version": "0.11.2", | ||
"version": "0.12.0", | ||
"title": "Event Calendar Core package", | ||
@@ -37,5 +37,5 @@ "description": "Full-sized drag & drop event calendar with resource view", | ||
"dependencies": { | ||
"@event-calendar/common": "~0.11.2", | ||
"svelte": "^3.47.0" | ||
"@event-calendar/common": "~0.12.0", | ||
"svelte": "^3.51.0" | ||
} | ||
} |
180
README.md
@@ -1,2 +0,2 @@ | ||
# Event Calendar [![](https://data.jsdelivr.com/v1/package/npm/@event-calendar/build/badge)](https://www.jsdelivr.com/package/npm/@event-calendar/build) [![Sponsor](https://img.shields.io/badge/Sponsor-$10-green.svg)](https://www.paypal.me/vkurko/10usd) [![Sponsor](https://img.shields.io/badge/Sponsor-$1-green.svg)](https://www.paypal.me/vkurko/1usd) | ||
# 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) | ||
@@ -7,3 +7,3 @@ See [demo](https://vkurko.github.io/calendar/). | ||
* Lightweight (51kb [br](https://en.wikipedia.org/wiki/Brotli) compressed `modern` version) | ||
* Lightweight (52kb [br](https://en.wikipedia.org/wiki/Brotli) compressed `modern` version) | ||
* Zero-dependency (pre-built bundle) | ||
@@ -44,6 +44,6 @@ * Used by [Bookly](https://wordpress.org/plugins/bookly-responsive-appointment-booking-tool/) | ||
- [eventDragMinDistance](#eventdragmindistance) | ||
- [eventDragStart](#eventdragstart) | ||
- [eventDragStop](#eventdragstop) | ||
</td><td> | ||
- [eventDragStart](#eventdragstart) | ||
- [eventDragStop](#eventdragstop) | ||
- [eventDrop](#eventdrop) | ||
@@ -68,4 +68,2 @@ - [eventDurationEditable](#eventdurationeditable) | ||
- [listDayFormat](#listdayformat) | ||
</td><td> | ||
- [listDaySideFormat](#listdaysideformat) | ||
@@ -75,2 +73,4 @@ - [loading](#loading) | ||
- [monthMode](#monthmode) | ||
</td><td> | ||
- [moreLinkContent](#morelinkcontent) | ||
@@ -82,2 +82,6 @@ - [noEventsClick](#noeventsclick) | ||
- [resources](#resources) | ||
- [select](#select) | ||
- [selectable](#selectable) | ||
- [selectBackgroundColor](#selectbackgroundcolor) | ||
- [selectMinDistance](#selectmindistance) | ||
- [scrollTime](#scrolltime) | ||
@@ -90,2 +94,6 @@ - [slotDuration](#slotduration) | ||
- [theme](#theme) | ||
- [titleFormat](#titleformat) | ||
- [unselect](#unselect) | ||
- [unselectAuto](#unselectauto) | ||
- [unselectCancel](#unselectcancel) | ||
- [view](#view) | ||
@@ -113,2 +121,5 @@ - [viewDidMount](#viewdidmount) | ||
- [getView](#getview) | ||
</td><td> | ||
- [unselect](#unselect-1) | ||
</td></tr> | ||
@@ -1470,2 +1481,99 @@ </table> | ||
### select | ||
- Type `function` | ||
- Default `undefined` | ||
Callback function that is triggered when a date/time selection is made. | ||
```js | ||
function (selectInfo) { } | ||
``` | ||
`selectInfo` is an object with the following properties: | ||
<table> | ||
<tr> | ||
<td> | ||
`start` | ||
</td> | ||
<td>JavaScript Date object indicating the start of the selection</td> | ||
</tr> | ||
<tr> | ||
<td> | ||
`end` | ||
</td> | ||
<td>JavaScript Date object indicating the end of the selection</td> | ||
</tr> | ||
<tr> | ||
<td> | ||
`startStr` | ||
</td> | ||
<td>ISO8601 string representation of the start date</td> | ||
</tr> | ||
<tr> | ||
<td> | ||
`endStr` | ||
</td> | ||
<td>ISO8601 string representation of the end date</td> | ||
</tr> | ||
<tr> | ||
<td> | ||
`allDay` | ||
</td> | ||
<td> | ||
Boolean (`true` or `false`). Determines if the selection has occurred in the `all-day` slot</td> | ||
</tr> | ||
<tr> | ||
<td> | ||
`jsEvent` | ||
</td> | ||
<td>JavaScript native event object with low-level information such as click coordinates</td> | ||
</tr> | ||
<tr> | ||
<td> | ||
`view` | ||
</td> | ||
<td> | ||
The current [View](#view-object) object | ||
</td> | ||
</tr> | ||
<tr> | ||
<td> | ||
`resource` | ||
</td> | ||
<td> | ||
If the current view is a resource view, the [Resource](#resource-object) object that was selected | ||
</td> | ||
</tr> | ||
</table> | ||
### selectable | ||
- Type `boolean` | ||
- Default `false` | ||
Determines whether the user is allowed to highlight multiple days or time slots by clicking and moving the pointer. | ||
### selectBackgroundColor | ||
- Type `string` | ||
- Default `undefined` | ||
Sets the background color for the event indicating the current selection. See [selectable](#selectable). | ||
You can use any of the CSS color formats such `'#f00'`, `'#ff0000'`, `'rgb(255,0,0)'`, or `'red'`. | ||
### selectMinDistance | ||
- Type `integer` | ||
- Default `0` | ||
Defines how many pixels the user’s mouse must move before the selection begins. | ||
### scrollTime | ||
@@ -1587,2 +1695,57 @@ - Type `string`, `integer` or `object` | ||
### unselect | ||
- Type `function` | ||
- Default `undefined` | ||
Callback function that is triggered when the current selection is cleared. | ||
A selection can be cleared for a number of reasons: | ||
- The user clicks away from the current selection (this does not happen when [unselectAuto](#unselectauto) is `false`). | ||
- The user makes a new selection. The unselect callback will be fired before the new selection occurs. | ||
- The user navigates forward or backward in the current view, or switches to a new view. | ||
- The [unselect](#unselect-1) method is called via the API. | ||
```js | ||
function (info) { } | ||
``` | ||
`info` is an object with the following properties: | ||
<table> | ||
<tr> | ||
<td> | ||
`jsEvent` | ||
</td> | ||
<td> | ||
JavaScript native event object with low-level information such as click coordinates. | ||
If unselect has been triggered via the [unselect](#unselect-1) method, jsEvent will be `undefined`</td> | ||
</tr> | ||
<tr> | ||
<td> | ||
`view` | ||
</td> | ||
<td> | ||
The current [View](#view-object) object | ||
</td> | ||
</tr> | ||
</table> | ||
### unselectAuto | ||
- Type `boolean` | ||
- Default `true` | ||
Determines whether clicking elsewhere on the page will clear the current selection. See [selectable](#selectable). | ||
### unselectCancel | ||
- Type `string` | ||
- Default `''` | ||
A CSS selector that specifies elements that will ignore the [unselectAuto](#unselectauto) option. | ||
Clicking on elements that match this CSS selector will prevent the current selection from being cleared (because of the [unselectAuto](#unselectauto) option). | ||
### view | ||
@@ -1718,2 +1881,7 @@ - Type `string` | ||
### unselect() | ||
- Return value `EventCalendar` The calendar instance for chaining | ||
Clears the current selection. See [selectable](#selectable). | ||
## Event object | ||
@@ -1720,0 +1888,0 @@ This is a JavaScript object that the Event Calendar uses to store information about a calendar event. |
@@ -50,2 +50,3 @@ import {assign, createDate, createDuration, setMidnight} from '@event-calendar/common'; | ||
nowIndicator: false, | ||
selectable: false, | ||
scrollTime: '06:00:00', | ||
@@ -52,0 +53,0 @@ slotDuration: '00:30:00', |
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
133691
1842
2281
+ Added@event-calendar/common@0.12.0(transitive)
- Removed@event-calendar/common@0.11.2(transitive)
Updatedsvelte@^3.51.0