@event-calendar/time-grid
Advanced tools
Comparing version 1.2.0 to 1.3.0
{ | ||
"name": "@event-calendar/time-grid", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"title": "Event Calendar TimeGrid plugin", | ||
@@ -29,5 +29,5 @@ "description": "Full-sized drag & drop event calendar with resource view", | ||
"dependencies": { | ||
"@event-calendar/core": "~1.2.0", | ||
"@event-calendar/core": "~1.3.0", | ||
"svelte": "^3.59.1" | ||
} | ||
} |
@@ -196,4 +196,4 @@ # 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) | ||
```html | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@event-calendar/build@1.2.0/event-calendar.min.css"> | ||
<script src="https://cdn.jsdelivr.net/npm/@event-calendar/build@1.2.0/event-calendar.min.js"></script> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@event-calendar/build@1.3.0/event-calendar.min.css"> | ||
<script src="https://cdn.jsdelivr.net/npm/@event-calendar/build@1.3.0/event-calendar.min.js"></script> | ||
``` | ||
@@ -286,3 +286,3 @@ | ||
### buttonText | ||
- Type `object` | ||
- Type `object` or `function` | ||
- Default `{today: 'today', dayGridMonth: 'month', listDay: 'list', listWeek: 'list', listMonth: 'list', listYear: 'list', resourceTimeGridDay: 'day', resourceTimeGridWeek: 'week', timeGridDay: 'day', timeGridWeek: 'week'}` | ||
@@ -292,2 +292,19 @@ | ||
This value can be either a plain object with all necessary properties, or a callback function that receives default button texts object and should return a new one: | ||
```js | ||
function (texts) { | ||
// return new button texts object | ||
} | ||
``` | ||
<table> | ||
<tr> | ||
<td> | ||
`texts` | ||
</td> | ||
<td>An object with default button texts</td> | ||
</tr> | ||
</table> | ||
### date | ||
@@ -1276,3 +1293,3 @@ - Type `Date` or `string` | ||
### flexibleSlotTimeLimits | ||
- Type `boolean` | ||
- Type `boolean` or `object` | ||
- Default `false` | ||
@@ -1282,2 +1299,38 @@ | ||
If set to `true`, then the decision on whether to expand the limits will be made based on the analysis of currently displayed events, but excluding background events. | ||
If you want background events not to be ignored, then instead of `true` you can pass an object with the following properties: | ||
<table> | ||
<tr> | ||
<td> | ||
`eventFilter` | ||
</td> | ||
<td> | ||
A function to determine whether a given event should be taken into account or not. | ||
```js | ||
function(event) { | ||
// return true or false | ||
} | ||
``` | ||
<table> | ||
<tr> | ||
<td> | ||
`event` | ||
</td> | ||
<td> | ||
[Event](#event-object) object to be analyzed. The function must return `true` to have this event counted, or `false` to ignore it | ||
</td> | ||
</tr> | ||
</table> | ||
</td> | ||
</tr> | ||
</table> | ||
### headerToolbar | ||
@@ -1801,3 +1854,3 @@ - Type `object` | ||
This value can be either a plain object with all necessary properties, or a callback function that receives default theme object and should return an actual one: | ||
This value can be either a plain object with all necessary properties, or a callback function that receives default theme object and should return a new one: | ||
@@ -1804,0 +1857,0 @@ ```js |
import {derived} from 'svelte/store'; | ||
import {is_function} from 'svelte/internal'; | ||
import { | ||
@@ -8,3 +9,4 @@ DAY_IN_SECONDS, | ||
createDuration, | ||
min as minFn, max as maxFn | ||
min as minFn, max as maxFn, | ||
bgEvent | ||
} from '@event-calendar/core'; | ||
@@ -44,2 +46,5 @@ | ||
let maxMax = createDuration(maxFn(max.seconds, minMin.seconds + DAY_IN_SECONDS)); | ||
let filter = is_function($flexibleSlotTimeLimits?.eventFilter) | ||
? $flexibleSlotTimeLimits.eventFilter | ||
: event => !bgEvent(event.display); | ||
loop: for (let date of $_viewDates) { | ||
@@ -51,3 +56,3 @@ let start = addDuration(cloneDate(date), min); | ||
for (let event of $_events) { | ||
if (event.display === 'auto' && event.start < maxEnd && event.end > minStart) { | ||
if (!event.allDay && filter(event) && event.start < maxEnd && event.end > minStart) { | ||
if (event.start < start) { | ||
@@ -54,0 +59,0 @@ let seconds = maxFn((event.start - date) / 1000, minMin.seconds); |
Sorry, the diff of this file is too big to display
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
169798
2980
2630
+ Added@event-calendar/core@1.3.1(transitive)
- Removed@event-calendar/core@1.2.0(transitive)
Updated@event-calendar/core@~1.3.0