@event-calendar/day-grid
Advanced tools
Comparing version 0.3.0 to 0.3.1
17
index.js
@@ -33,3 +33,3 @@ import { SvelteComponent, init, safe_not_equal, element, text, attr, insert, append, set_data, detach, space, noop, destroy_each, component_subscribe, create_slot, listen, update_slot_base, get_all_dirty_from_scope, get_slot_changes, transition_in, transition_out, run_all, set_store_value, binding_callbacks, action_destroyer, is_function, create_component, mount_component, destroy_component, group_outros, check_outros, empty } from 'svelte/internal'; | ||
/* packages/day-grid/src/Header.svelte generated by Svelte v3.42.1 */ | ||
/* packages/day-grid/src/Header.svelte generated by Svelte v3.42.3 */ | ||
@@ -194,3 +194,3 @@ function get_each_context$3(ctx, list, i) { | ||
/* packages/day-grid/src/Body.svelte generated by Svelte v3.42.1 */ | ||
/* packages/day-grid/src/Body.svelte generated by Svelte v3.42.3 */ | ||
@@ -384,3 +384,3 @@ function create_fragment$4(ctx) { | ||
/* packages/day-grid/src/Event.svelte generated by Svelte v3.42.1 */ | ||
/* packages/day-grid/src/Event.svelte generated by Svelte v3.42.3 */ | ||
@@ -416,7 +416,4 @@ function create_fragment$3(ctx) { | ||
}), | ||
listen(div, "mousedown", function () { | ||
listen(div, "pointerdown", function () { | ||
if (is_function(/*createDragStartHandler*/ ctx[23](/*$_interaction*/ ctx[1], /*display*/ ctx[0]))) /*createDragStartHandler*/ ctx[23](/*$_interaction*/ ctx[1], /*display*/ ctx[0]).apply(this, arguments); | ||
}), | ||
listen(div, "touchstart", function () { | ||
if (is_function(/*createDragStartHandler*/ ctx[23](/*$_interaction*/ ctx[1], /*display*/ ctx[0]))) /*createDragStartHandler*/ ctx[23](/*$_interaction*/ ctx[1], /*display*/ ctx[0]).apply(this, arguments); | ||
}) | ||
@@ -649,3 +646,3 @@ ]; | ||
/* packages/day-grid/src/Day.svelte generated by Svelte v3.42.1 */ | ||
/* packages/day-grid/src/Day.svelte generated by Svelte v3.42.3 */ | ||
@@ -1011,3 +1008,3 @@ function get_each_context$2(ctx, list, i) { | ||
/* packages/day-grid/src/Week.svelte generated by Svelte v3.42.1 */ | ||
/* packages/day-grid/src/Week.svelte generated by Svelte v3.42.3 */ | ||
@@ -1240,3 +1237,3 @@ function get_each_context$1(ctx, list, i) { | ||
/* packages/day-grid/src/View.svelte generated by Svelte v3.42.1 */ | ||
/* packages/day-grid/src/View.svelte generated by Svelte v3.42.3 */ | ||
@@ -1243,0 +1240,0 @@ function get_each_context(ctx, list, i) { |
{ | ||
"name": "@event-calendar/day-grid", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"title": "Event Calendar DayGrid plugin", | ||
"description": "Full-sized event calendar with resource view", | ||
"description": "Full-sized drag & drop event calendar with resource view", | ||
"keywords": ["calendar", "event", "resource", "full-sized"], | ||
@@ -20,5 +20,5 @@ "homepage": "https://vkurko.github.io/calendar/", | ||
"dependencies": { | ||
"@event-calendar/common": "~0.3.0", | ||
"svelte": "^3.42.1" | ||
"@event-calendar/common": "~0.3.1", | ||
"svelte": "^3.42.3" | ||
} | ||
} |
141
README.md
@@ -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) | ||
* Lightweight (37.8kb [br](https://en.wikipedia.org/wiki/Brotli) compressed `modern` version) | ||
* Lightweight (40.7kb [br](https://en.wikipedia.org/wiki/Brotli) compressed `modern` version) | ||
* Zero-dependency (pre-built bundle) | ||
@@ -28,2 +28,3 @@ * Used by [Bookly](https://wordpress.org/plugins/bookly-responsive-appointment-booking-tool/) | ||
- [displayEventEnd](#displayeventend) | ||
- [dragScroll](#dragscroll) | ||
- [duration](#duration) | ||
@@ -39,5 +40,5 @@ - [editable](#editable) | ||
- [eventDragStart](#eventdragstart) | ||
- [eventDragStop](#eventdragstop) | ||
</td><td> | ||
- [eventDragStop](#eventdragstop) | ||
- [eventDrop](#eventdrop) | ||
@@ -59,5 +60,5 @@ - [eventMouseEnter](#eventmouseenter) | ||
- [listDaySideFormat](#listdaysideformat) | ||
- [loading](#loading) | ||
</td><td> | ||
- [loading](#loading) | ||
- [locale](#locale) | ||
@@ -80,2 +81,20 @@ - [monthMode](#monthmode) | ||
</table> | ||
- [Methods](#methods) | ||
<table> | ||
<tr><td> | ||
- [getOption](#getoption-name-) | ||
- [setOption](#setoption-name-value-) | ||
</td><td> | ||
- [getEventById](#geteventbyid-id-) | ||
- [removeEventById](#removeeventbyid-id-) | ||
- [addEvent](#addevent-event-) | ||
- [updateEvent](#updateevent-event-) | ||
- [refetchEvents](#refetchevents) | ||
</td><td> | ||
- [getView](#getview) | ||
</td></tr> | ||
</table> | ||
- [Event object](#event-object) | ||
@@ -106,2 +125,3 @@ - [Parsing event from a plain object](#parsing-event-from-a-plain-object) | ||
* `@event-calendar/time-grid` | ||
* `@event-calendar/interaction` (doesn't provide a view) | ||
@@ -162,2 +182,27 @@ Then, in your Svelte component, use the calendar something like this: | ||
### Modifying options after initialization | ||
You can modify the calendar options after initialization using the [setOption](#setoption-name-value-) method. | ||
```js | ||
ec.setOption('slotDuration', '01:00'); | ||
``` | ||
In Svelte, you can simply update the original `options` object. | ||
```html | ||
<script> | ||
import Calendar from '@event-calendar/core'; | ||
import TimeGrid from '@event-calendar/time-grid'; | ||
let plugins = [TimeGrid]; | ||
let options = { | ||
view: 'timeGridWeek' | ||
}; | ||
function updateOptions() { | ||
options.slotDuration = '01:00'; | ||
} | ||
</script> | ||
<button on:click={updateOptions}>Change slot duration</button> | ||
<Calendar {plugins} {options} /> | ||
``` | ||
## Options | ||
@@ -1224,2 +1269,92 @@ | ||
## Methods | ||
Methods allow you to manipulate the Event Calendar after initialization. They are accessible from the calendar instance. | ||
In Svelte, methods are available from a component instance: | ||
```html | ||
<script> | ||
import Calendar from '@event-calendar/core'; | ||
import TimeGrid from '@event-calendar/time-grid'; | ||
let ec; | ||
let plugins = [TimeGrid]; | ||
let options = { | ||
view: 'timeGridWeek', | ||
eventSources: [{events: function() { | ||
console.log('fetching...'); | ||
return []; | ||
}}] | ||
}; | ||
function invokeMethod() { | ||
ec.refetchEvents(); | ||
} | ||
</script> | ||
<button on:click={invokeMethod}>Refetch events</button> | ||
<Calendar bind:this={ec} {plugins} {options} /> | ||
``` | ||
### getOption( name ) | ||
- Parameters | ||
- `name` `string` The option name | ||
- Return value `mixed` or `undefined` | ||
This method allows you to get the current value of any calendar option. | ||
```js | ||
// E.g. Get current date | ||
let date = ec.getOption('date'); | ||
``` | ||
### setOption( name, value ) | ||
- Parameters | ||
- `name` `string` The option name | ||
- `value` `mixed` The new option value | ||
- Return value `EventCalendar` The calendar instance for chaining | ||
This method allows you to set new value to any calendar option. | ||
```js | ||
// E.g. Change the current date | ||
ec.setOption('date', new Date()); | ||
``` | ||
### getEventById( id ) | ||
- Parameters | ||
- `id` `string|integer` The ID of the event | ||
- Return value [Event](#event-object) object or `null` | ||
Returns a single event with the matching `id`. | ||
### removeEventById( id ) | ||
- Parameters | ||
- `id` `string|integer` The ID of the event | ||
- Return value `EventCalendar` The calendar instance for chaining | ||
Removes a single event with the matching `id`. | ||
### addEvent( event ) | ||
- Parameters | ||
- `event` `object` A plain object that will be parsed into an [Event](#event-object) object | ||
- Return value [Event](#event-object) object or `null` | ||
Adds a new event to the calendar. | ||
### updateEvent( event ) | ||
- Parameters | ||
- `event` `object` A plain object or [Event](#event-object) object | ||
- Return value `EventCalendar` The calendar instance for chaining | ||
Updates a single event with the matching `event`.`id`. | ||
### refetchEvents() | ||
- Return value `EventCalendar` The calendar instance for chaining | ||
Refetches events from all sources. | ||
### getView() | ||
- Return value `View` | ||
Returns the [View](#view-object) object for the current view. | ||
## Event object | ||
@@ -1226,0 +1361,0 @@ This is a JavaScript object that the Event Calendar uses to store information about a calendar event. |
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
77548
1687
1277
Updatedsvelte@^3.42.3