Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@event-calendar/common

Package Overview
Dependencies
Maintainers
1
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@event-calendar/common - npm Package Compare versions

Comparing version 0.19.0 to 1.0.0

83

index.js

@@ -8,2 +8,14 @@ import { run_all, is_function } from 'svelte/internal';

function floor(value) {
return Math.floor(value);
}
function min(...args) {
return Math.min(...args);
}
function max(...args) {
return Math.max(...args);
}
function isObject(test) {

@@ -61,3 +73,3 @@ return typeof test === 'object' && test !== null;

function createDate(input) {
function createDate(input = undefined) {
if (input !== undefined) {

@@ -101,6 +113,3 @@ return input instanceof Date ? _fromLocalDate(input) : _fromISOString(input);

function addDuration(date, duration, x) {
if (x === undefined) {
x = 1;
}
function addDuration(date, duration, x = 1) {
date.setUTCFullYear(date.getUTCFullYear() + x * duration.years);

@@ -122,8 +131,8 @@ let month = date.getUTCMonth() + x * duration.months;

function subtractDuration(date, duration, x) {
return addDuration(date, duration, x === undefined ? -1 : -x);
function subtractDuration(date, duration, x = 1) {
return addDuration(date, duration, -x);
}
function addDay(date, x) {
date.setUTCDate(date.getUTCDate() + (x === undefined ? 1 : x));
function addDay(date, x = 1) {
date.setUTCDate(date.getUTCDate() + x);

@@ -133,4 +142,4 @@ return date;

function subtractDay(date, x) {
return addDay(date, x === undefined ? -1 : -x);
function subtractDay(date, x = 1) {
return addDay(date, -x);
}

@@ -325,15 +334,24 @@

let fnProp = symbol();
function setFn(el, fn) {
el[fnProp] = fn;
let payloadProp = symbol();
function setPayload(el, payload) {
el[payloadProp] = payload;
}
function hasFn(el) {
return !!el[fnProp];
function hasPayload(el) {
return !!el?.[payloadProp];
}
function runFn(el, ...args) {
return el[fnProp](...args);
function getPayload(el) {
return el[payloadProp];
}
function getElementWithPayload(x, y) {
for (let el of document.elementsFromPoint(x, y)) {
if (hasPayload(el)) {
return el;
}
}
return null;
}
function createView(view, _viewTitle, _currentRange, _activeRange) {

@@ -361,4 +379,2 @@ return {

const display = ['background'];
let eventId = 1;

@@ -379,3 +395,3 @@ function createEvents(input) {

durationEditable: event.durationEditable,
display: display.includes(event.display) ? event.display : 'auto',
display: event.display || 'auto',
extendedProps: event.extendedProps || {},

@@ -567,17 +583,18 @@ backgroundColor: event.backgroundColor || event.color

let ignoreProp = symbol();
function ignore(jsEvent) {
jsEvent[ignoreProp] = true;
function helperEvent(display) {
return display === 'preview' || display === 'ghost' || display === 'pointer';
}
function maybeIgnore(fn) {
return jsEvent => {
if (!jsEvent[ignoreProp]) {
fn && fn(jsEvent);
// Make upper listeners ignore the event
ignore(jsEvent);
}
};
function bgEvent(display) {
return display === 'background';
}
function previewEvent(display) {
return display === 'preview';
}
function ghostEvent(display) {
return display === 'ghost';
}
function writable2(value, parser, start) {

@@ -634,2 +651,2 @@ return {

export { DAY_IN_SECONDS, addDay, addDuration, ancestor, assign, cloneDate, cloneEvent, createDate, createDuration, createElement, createEventChunk, createEventContent, createEventSources, createEvents, createView, datesEqual, debounce, derived2, eventIntersects, flushDebounce, formatRange, hasFn, hasYScroll, height, ignore, intl, intlRange, isObject, maybeIgnore, nextClosestDay, noTimePart, outsideEvent, prepareEventChunks, prevClosestDay, rect, repositionEvent, runFn, setContent, setFn, setMidnight, sortEventChunks, subtractDay, subtractDuration, symbol, toEventWithLocalDates, toISOString, toLocalDate, toViewWithLocalDates, writable2 };
export { DAY_IN_SECONDS, addDay, addDuration, ancestor, assign, bgEvent, cloneDate, cloneEvent, createDate, createDuration, createElement, createEventChunk, createEventContent, createEventSources, createEvents, createView, datesEqual, debounce, derived2, eventIntersects, floor, flushDebounce, formatRange, getElementWithPayload, getPayload, ghostEvent, hasPayload, hasYScroll, height, helperEvent, intl, intlRange, isObject, max, min, nextClosestDay, noTimePart, outsideEvent, prepareEventChunks, prevClosestDay, previewEvent, rect, repositionEvent, setContent, setMidnight, setPayload, sortEventChunks, subtractDay, subtractDuration, symbol, toEventWithLocalDates, toISOString, toLocalDate, toViewWithLocalDates, writable2 };
{
"name": "@event-calendar/common",
"version": "0.19.0",
"version": "1.0.0",
"title": "Event Calendar Common package",

@@ -5,0 +5,0 @@ "description": "Full-sized drag & drop event calendar with resource view",

@@ -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) [![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)

* Lightweight (38kb [br](https://en.wikipedia.org/wiki/Brotli) compressed)
* Lightweight (34kb [br](https://en.wikipedia.org/wiki/Brotli) compressed)
* Zero-dependency (pre-built bundle)

@@ -72,8 +72,7 @@ * Used on over 60,000 websites with [Bookly](https://wordpress.org/plugins/bookly-responsive-appointment-booking-tool/)

- [longPressDelay](#longpressdelay)
- [monthMode](#monthmode)
- [moreLinkContent](#morelinkcontent)
- [noEventsClick](#noeventsclick)
- [noEventsContent](#noeventscontent)
</td><td>
- [noEventsContent](#noeventscontent)
- [nowIndicator](#nowindicator)

@@ -198,4 +197,4 @@ - [pointer](#pointer)

```html
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@event-calendar/build@0.19.0/event-calendar.min.css">
<script src="https://cdn.jsdelivr.net/npm/@event-calendar/build@0.19.0/event-calendar.min.js"></script>
<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>
```

@@ -304,2 +303,3 @@

- Default `undefined`
- Requires `Interaction` plugin

@@ -334,3 +334,3 @@ Callback function that is triggered when the user clicks on a date or a time.

`true` or `false`. Determines if the click has occurred in the `all-day` slot. Clicks in month and list views are treated as all-day too</td>
`true` or `false`. Determines if the click has occurred in the `all-day` slot. Month and list views are also considered as all-day slots</td>
</tr>

@@ -1433,10 +1433,2 @@ <tr>

### monthMode
- Type `boolean`
- Default `false`
> Views override the default value as follows:
> - dayGridMonth `true`
Tells the calendar that visible dates should start from the [firstDay](#firstday) of the week, even if it will display days outside the current range (this is a common case for a month calendar when you can see days from adjacent months).
### moreLinkContent

@@ -1797,3 +1789,3 @@ - Type `string`, `object`or `function`

- Type `object` or `function`
- Default `{active: 'ec-active', allDay: 'ec-all-day', bgEvent: 'ec-bg-event', bgEvents: 'ec-bg-events', body: 'ec-body', button: 'ec-button', buttonGroup: 'ec-button-group', calendar: 'ec', compact: 'ec-compact', content: 'ec-content', day: 'ec-day', dayFoot: 'ec-day-foot', dayHead: 'ec-day-head', daySide: 'ec-day-side', days: 'ec-days', draggable: 'ec-draggable', dragging: 'ec-dragging', event: 'ec-event', eventBody: 'ec-event-body', eventTag: 'ec-event-tag', eventTime: 'ec-event-time', eventTitle: 'ec-event-title', events: 'ec-events', extra: 'ec-extra', ghost: 'ec-ghost', handle: 'ec-handle', header: 'ec-header', hiddenScroll: 'ec-hidden-scroll', hiddenTimes: 'ec-hidden-times', highlight: 'ec-highlight', icon: 'ec-icon', line: 'ec-line', lines: 'ec-lines', list: 'ec-list', month: 'ec-month', noEvents: 'ec-no-events', nowIndicator: 'ec-now-indicator', otherMonth: 'ec-other-month', pointer: 'ec-pointer', popup: 'ec-popup', preview: 'ec-preview', resizer: 'ec-resizer', resizingX: 'ec-resizing-x', resizingY: 'ec-resizing-y', resource: 'ec-resource', resourceTitle: 'ec-resource-title', selecting: 'ec-selecting', sidebar: 'ec-sidebar', sidebarTitle: 'ec-sidebar-title', time: 'ec-time', title: 'ec-title', today: 'ec-today', toolbar: 'ec-toolbar', uniform: 'ec-uniform', week: 'ec-week', withScroll: 'ec-with-scroll'}`
- Default `{active: 'ec-active', allDay: 'ec-all-day', bgEvent: 'ec-bg-event', bgEvents: 'ec-bg-events', body: 'ec-body', button: 'ec-button', buttonGroup: 'ec-button-group', calendar: 'ec', compact: 'ec-compact', content: 'ec-content', day: 'ec-day', dayFoot: 'ec-day-foot', dayHead: 'ec-day-head', daySide: 'ec-day-side', days: 'ec-days', draggable: 'ec-draggable', dragging: 'ec-dragging', event: 'ec-event', eventBody: 'ec-event-body', eventTag: 'ec-event-tag', eventTime: 'ec-event-time', eventTitle: 'ec-event-title', events: 'ec-events', extra: 'ec-extra', ghost: 'ec-ghost', handle: 'ec-handle', header: 'ec-header', hiddenScroll: 'ec-hidden-scroll', highlight: 'ec-highlight', icon: 'ec-icon', line: 'ec-line', lines: 'ec-lines', list: 'ec-list', month: 'ec-month', noEvents: 'ec-no-events', nowIndicator: 'ec-now-indicator', otherMonth: 'ec-other-month', pointer: 'ec-pointer', popup: 'ec-popup', preview: 'ec-preview', resizer: 'ec-resizer', resizingX: 'ec-resizing-x', resizingY: 'ec-resizing-y', resource: 'ec-resource', resourceTitle: 'ec-resource-title', selecting: 'ec-selecting', sidebar: 'ec-sidebar', sidebarTitle: 'ec-sidebar-title', time: 'ec-time', title: 'ec-title', today: 'ec-today', toolbar: 'ec-toolbar', uniform: 'ec-uniform', week: 'ec-week', withScroll: 'ec-with-scroll'}`

@@ -2029,6 +2021,43 @@ Defines the CSS classes that the Event Calendar uses to generate HTML markup.

### dateFromPoint( x, y )
- Return value `Date` or `null`
- Return value `object` or `null`
Returns the date and time as if the [dateClick](#dateclick) event had fired for that point.
Returns an `info` object with data as if the [dateClick](#dateclick) event had fired for that point.
`info` object contains the following properties:
<table>
<tr>
<td>
`date`
</td>
<td>JavaScript Date object for the date and time</td>
</tr>
<tr>
<td>
`allDay`
</td>
<td>
`true` or `false`. Determines if the point is in the `all-day` slot. Month and list views are also considered as all-day slots</td>
</tr>
<tr>
<td>
`dayEl`
</td>
<td>HTML element that represents the whole-day that contains the point</td>
</tr>
<tr>
<td>
`resource`
</td>
<td>
If the current view is a resource view, the [Resource](#resource-object) object that owns this date
</td>
</tr>
</table>
Using this method, you can, for example, find out on which day a click occurred inside a multi-day event. To do this, inside [eventClick](#eventclick), pass the `jsEvent.clientX` and `jsEvent.clientY` coordinates to `dateFromPoint` and get the desired date.

@@ -2035,0 +2064,0 @@

export const DAY_IN_SECONDS = 86400;
export function createDate(input) {
export function createDate(input = undefined) {
if (input !== undefined) {

@@ -42,6 +42,3 @@ return input instanceof Date ? _fromLocalDate(input) : _fromISOString(input);

export function addDuration(date, duration, x) {
if (x === undefined) {
x = 1;
}
export function addDuration(date, duration, x = 1) {
date.setUTCFullYear(date.getUTCFullYear() + x * duration.years);

@@ -63,8 +60,8 @@ let month = date.getUTCMonth() + x * duration.months;

export function subtractDuration(date, duration, x) {
return addDuration(date, duration, x === undefined ? -1 : -x);
export function subtractDuration(date, duration, x = 1) {
return addDuration(date, duration, -x);
}
export function addDay(date, x) {
date.setUTCDate(date.getUTCDate() + (x === undefined ? 1 : x));
export function addDay(date, x = 1) {
date.setUTCDate(date.getUTCDate() + x);

@@ -74,4 +71,4 @@ return date;

export function subtractDay(date, x) {
return addDay(date, x === undefined ? -1 : -x);
export function subtractDay(date, x = 1) {
return addDay(date, -x);
}

@@ -78,0 +75,0 @@

@@ -33,13 +33,22 @@ import {symbol} from './utils.js';

let fnProp = symbol();
export function setFn(el, fn) {
el[fnProp] = fn;
let payloadProp = symbol();
export function setPayload(el, payload) {
el[payloadProp] = payload;
}
export function hasFn(el) {
return !!el[fnProp];
export function hasPayload(el) {
return !!el?.[payloadProp];
}
export function runFn(el, ...args) {
return el[fnProp](...args);
export function getPayload(el) {
return el[payloadProp];
}
export function getElementWithPayload(x, y) {
for (let el of document.elementsFromPoint(x, y)) {
if (hasPayload(el)) {
return el;
}
}
return null;
}

@@ -7,4 +7,2 @@ import {addDay, datesEqual, createDate, cloneDate, setMidnight, toLocalDate, noTimePart} from './date';

const display = ['background'];
let eventId = 1;

@@ -25,3 +23,3 @@ export function createEvents(input) {

durationEditable: event.durationEditable,
display: display.includes(event.display) ? event.display : 'auto',
display: event.display || 'auto',
extendedProps: event.extendedProps || {},

@@ -212,1 +210,17 @@ backgroundColor: event.backgroundColor || event.color

}
export function helperEvent(display) {
return display === 'preview' || display === 'ghost' || display === 'pointer';
}
export function bgEvent(display) {
return display === 'background';
}
export function previewEvent(display) {
return display === 'preview';
}
export function ghostEvent(display) {
return display === 'ghost';
}

@@ -6,5 +6,4 @@ export * from './actions';

export * from './events';
export * from './jsevents';
export * from './stores';
export * from './utils';
export * from './view';

@@ -5,2 +5,14 @@ export function assign(...args) {

export function floor(value) {
return Math.floor(value);
}
export function min(...args) {
return Math.min(...args);
}
export function max(...args) {
return Math.max(...args);
}
export function isObject(test) {

@@ -7,0 +19,0 @@ return typeof test === 'object' && test !== null;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc