@event-calendar/core
Advanced tools
Comparing version 1.4.1 to 1.5.0
{ | ||
"name": "@event-calendar/core", | ||
"version": "1.4.1", | ||
"version": "1.5.0", | ||
"title": "Event Calendar Core package", | ||
@@ -5,0 +5,0 @@ "description": "Full-sized drag & drop event calendar with resource view", |
@@ -38,2 +38,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) | ||
- [eventBackgroundColor](#eventbackgroundcolor) | ||
- [eventClassNames](#eventclassnames) | ||
- [eventClick](#eventclick) | ||
@@ -197,4 +198,4 @@ - [eventColor](#eventcolor) | ||
```html | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@event-calendar/build@1.4.1/event-calendar.min.css"> | ||
<script src="https://cdn.jsdelivr.net/npm/@event-calendar/build@1.4.1/event-calendar.min.js"></script> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@event-calendar/build@1.5.0/event-calendar.min.css"> | ||
<script src="https://cdn.jsdelivr.net/npm/@event-calendar/build@1.5.0/event-calendar.min.js"></script> | ||
``` | ||
@@ -547,2 +548,39 @@ | ||
### eventClassNames | ||
- Type `string`, `array` or `function` | ||
- Default `undefined` | ||
Sets additional CSS classes for events. | ||
This value can be either a string containing class names `'class-1 class-2 ...'`, an array of strings `['class-1', 'class-2', ...]` or a function that returns any of the above formats: | ||
```js | ||
function (info) { | ||
// return string or array | ||
} | ||
``` | ||
`info` is an object with the following properties: | ||
<table> | ||
<tr> | ||
<td> | ||
`event` | ||
</td> | ||
<td> | ||
The associated [Event](#event-object) object | ||
</td> | ||
</tr> | ||
<tr> | ||
<td> | ||
`view` | ||
</td> | ||
<td> | ||
The current [View](#view-object) object | ||
</td> | ||
</tr> | ||
</table> | ||
### eventClick | ||
@@ -602,3 +640,3 @@ - Type `function` | ||
### eventContent | ||
- Type `string`, `object`or `function` | ||
- Type `string`, `object` or `function` | ||
- Default `undefined` | ||
@@ -605,0 +643,0 @@ |
@@ -169,2 +169,15 @@ import {addDay, datesEqual, createDate, cloneDate, setMidnight, toLocalDate, noTimePart} from './date'; | ||
export function createEventClasses(eventClassNames, event, _view) { | ||
if (eventClassNames) { | ||
if (is_function(eventClassNames)) { | ||
eventClassNames = eventClassNames({ | ||
event: toEventWithLocalDates(event), | ||
view: toViewWithLocalDates(_view) | ||
}); | ||
} | ||
return Array.isArray(eventClassNames) ? eventClassNames : [eventClassNames]; | ||
} | ||
return []; | ||
} | ||
export function toEventWithLocalDates(event) { | ||
@@ -204,3 +217,3 @@ return _cloneEvent(event, toLocalDate); | ||
export function helperEvent(display) { | ||
return display === 'preview' || display === 'ghost' || display === 'pointer'; | ||
return previewEvent(display) || ghostEvent(display) || pointerEvent(display); | ||
} | ||
@@ -219,1 +232,5 @@ | ||
} | ||
export function pointerEvent(display) { | ||
return display === 'pointer'; | ||
} |
@@ -23,2 +23,3 @@ import {assign, createDate, createDuration, setMidnight, createEvents, createEventSources} from '../lib.js'; | ||
eventTextColor: undefined, | ||
eventClassNames: undefined, | ||
eventClick: undefined, | ||
@@ -109,5 +110,3 @@ eventColor: undefined, | ||
for (let plugin of plugins) { | ||
if ('createOptions' in plugin) { | ||
plugin.createOptions(options); | ||
} | ||
plugin.createOptions?.(options); | ||
} | ||
@@ -135,5 +134,3 @@ | ||
for (let plugin of plugins) { | ||
if ('createParsers' in plugin) { | ||
plugin.createParsers(parsers, options); | ||
} | ||
plugin.createParsers?.(parsers, options); | ||
} | ||
@@ -140,0 +137,0 @@ |
@@ -57,10 +57,8 @@ import {writable} from 'svelte/store'; | ||
this._iEvents = writable([null, null]); // interaction events: [drag/resize, pointer] | ||
this._classes = writable(identity); | ||
this._iClass = writable(undefined); | ||
this._iClasses = writable(identity); // interaction event css classes | ||
this._iClass = writable(undefined); // interaction css class for entire calendar | ||
// Let plugins create their private stores | ||
for (let plugin of plugins) { | ||
if ('createStores' in plugin) { | ||
plugin.createStores(this); | ||
} | ||
plugin.createStores?.(this); | ||
} | ||
@@ -67,0 +65,0 @@ |
Sorry, the diff of this file is too big to display
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
188630
3676
2670