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

@fullcalendar/vue

Package Overview
Dependencies
Maintainers
1
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fullcalendar/vue - npm Package Compare versions

Comparing version 4.1.1 to 4.2.0

218

main.esm.js
/*
FullCalendar Vue Component v4.1.1
FullCalendar Vue Component v4.2.0
Docs: https://fullcalendar.io/docs/vue
License: MIT
*/
import deepEqual from 'fast-deep-equal';
import deepCopy from 'deep-copy';
import { Calendar } from '@fullcalendar/core';
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === 'function') {
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys.forEach(function (key) {
_defineProperty(target, key, source[key]);
});
}
return target;
}
/*

@@ -51,3 +19,3 @@ the docs point to this file as an index of options.

*/
var INPUT_DEFS = {
var PROP_DEFS = {
header: {},

@@ -158,2 +126,13 @@ footer: {},

timeGridEventMinHeight: {},
allDayHtml: {},
eventDragMinDistance: {},
eventResourceEditable: {},
eventSourceFailure: {},
eventSourceSuccess: {},
forceEventDuration: {},
progressiveEventRendering: {},
selectLongPressDelay: {},
selectMinDistance: {},
timeZoneParam: {},
titleRangeSeparator: {},
// compound OptionsInput...

@@ -177,11 +156,52 @@ buttonText: {},

datesAboveResources: {},
googleCalendarApiKey: {}
googleCalendarApiKey: {},
refetchResourcesOnNavigate: {},
// used to be emissions but are now props...
datesRender: {},
datesDestroy: {},
dayRender: {},
eventRender: {},
eventDestroy: {},
viewSkeletonRender: {},
viewSkeletonDestroy: {},
resourceRender: {}
};
var EVENT_NAMES = ['datesRender', 'datesDestroy', 'dayRender', 'windowResize', 'dateClick', 'eventClick', 'eventMouseEnter', 'eventMouseLeave', 'select', 'unselect', 'loading', 'eventRender', 'eventPositioned', '_eventsPositioned', 'eventDestroy', 'eventDragStart', 'eventDragStop', 'eventDrop', 'eventResizeStart', 'eventResizeStop', 'eventResize', 'drop', 'eventReceive', 'eventLeave', 'viewSkeletonRender', 'viewSkeletonDestroy', '_destroyed', // scheduler...
'resourceRender'];
var PROP_IS_DEEP = {
header: true,
footer: true,
events: true,
eventSources: true,
resources: true
};
var EMISSION_NAMES = ['windowResize', 'dateClick', 'eventClick', 'eventMouseEnter', 'eventMouseLeave', 'select', 'unselect', 'loading', 'eventPositioned', '_eventsPositioned', 'eventDragStart', 'eventDragStop', 'eventDrop', 'eventResizeStart', 'eventResizeStop', 'eventResize', 'drop', 'eventReceive', 'eventLeave', '_destroyed', // should now be props... (TODO: eventually remove)
'datesRender', 'datesDestroy', 'dayRender', 'eventRender', 'eventDestroy', 'viewSkeletonRender', 'viewSkeletonDestroy', 'resourceRender']; // identify deprecated emissions (TODO: eventually remove)
var EMISSION_USE_PROP = {
datesRender: true,
datesDestroy: true,
dayRender: true,
eventRender: true,
eventDestroy: true,
viewSkeletonRender: true,
viewSkeletonDestroy: true,
resourceRender: true
};
/*
VOCAB:
"props" are the values passed in from the parent (they are NOT listeners/emissions)
"emissions" are another way to say "events that will fire"
"options" are the options that the FullCalendar API accepts
NOTE: "deep" props are complex objects that we want to watch for internal changes.
Vue allows a reference to be internally mutated. Each time we detect a mutation,
we use deepCopy to freeze the state. This has the added benefit of stripping the
getter/setter methods that Vue embeds.
*/
var FullCalendarComponent = {
props: INPUT_DEFS,
calendar: null,
// accessed via this.$options.calendar
props: PROP_DEFS,
// INTERNALS
// this.$options.calendar
// this.$options.dirtyOptions - null means no dirty options
render: function render(createElement) {

@@ -191,35 +211,18 @@ return createElement('div');

mounted: function mounted() {
this.$options.calendar = new Calendar(this.$el, this.fullCalendarOptions);
warnDeprecatedListeners(this.$listeners);
this.$options.calendar = new Calendar(this.$el, this.buildOptions());
this.$options.calendar.render();
},
beforeUpdate: function beforeUpdate() {
this.renderDirty();
},
beforeDestroy: function beforeDestroy() {
this.$options.calendar.destroy();
},
watch: {
fullCalendarOptions: function fullCalendarOptions(options) {
this.$options.calendar.resetOptions(options);
}
},
computed: {
fullCalendarOptions: function fullCalendarOptions() {
return _objectSpread({}, this.fullCalendarInputs, this.fullCalendarEvents);
},
fullCalendarInputs: function fullCalendarInputs() {
var inputHash = {};
for (var inputName in INPUT_DEFS) {
var val = this[inputName];
if (val !== undefined) {
// unfortunately FC chokes when some props are set to undefined
inputHash[inputName] = val;
}
}
return inputHash;
},
fullCalendarEvents: function fullCalendarEvents() {
watch: buildWatchers(),
methods: {
buildOptions: function buildOptions() {
var _this = this;
var handlerHash = {};
var options = {};
var _iteratorNormalCompletion = true;

@@ -231,5 +234,5 @@ var _didIteratorError = false;

var _loop = function _loop() {
var eventName = _step.value;
var emissionName = _step.value;
handlerHash[eventName] = function () {
options[emissionName] = function () {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {

@@ -239,9 +242,10 @@ args[_key] = arguments[_key];

_this.$emit.apply(_this, [eventName].concat(args));
_this.$emit.apply(_this, [emissionName].concat(args));
};
};
for (var _iterator = EVENT_NAMES[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
for (var _iterator = EMISSION_NAMES[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
_loop();
}
} // do after emissions. these props will override emissions with same name
} catch (err) {

@@ -262,6 +266,23 @@ _didIteratorError = true;

return handlerHash;
}
},
methods: {
for (var propName in PROP_DEFS) {
var propVal = this[propName];
if (propVal !== undefined) {
// NOTE: FullCalendar's API often chokes on undefines
options[propName] = PROP_IS_DEEP[propName] ? deepCopy(propVal) // NOTE: deepCopy will choke on undefined as well
: propVal;
}
}
return options;
},
renderDirty: function renderDirty() {
var dirtyOptions = this.$options.dirtyOptions;
if (dirtyOptions) {
this.$options.dirtyOptions = null; // clear before rendering. might trigger new dirtiness
this.$options.calendar.mutateOptions(dirtyOptions, [], false, deepEqual);
}
},
getApi: function getApi() {

@@ -273,2 +294,45 @@ return this.$options.calendar;

function buildWatchers() {
var watchers = {};
var _loop2 = function _loop2(propName) {
if (PROP_IS_DEEP[propName]) {
watchers[propName] = {
deep: true,
// listen to children as well
handler: function handler(newVal, oldVal) {
recordDirtyOption(this, propName, deepCopy(newVal)); // if the reference is the same, it's an add, remove, or internal mutation. the beforeUpdate hook WON'T fire.
// otherwise, the beforeUpdate hook WILL fire and cause a rerender
if (newVal === oldVal) {
this.renderDirty();
}
}
};
} else {
watchers[propName] = function (newVal) {
recordDirtyOption(this, propName, newVal); // the beforeUpdate hook will render the dirtiness
};
}
};
for (var propName in PROP_DEFS) {
_loop2(propName);
}
return watchers;
}
function recordDirtyOption(vm, optionName, newVal) {
(vm.$options.dirtyOptions || (vm.$options.dirtyOptions = {}))[optionName] = newVal;
}
function warnDeprecatedListeners(listenerHash) {
for (var emissionName in listenerHash) {
if (EMISSION_USE_PROP[emissionName]) {
console.warn('Use of ' + emissionName + ' as an event is deprecated. Please convert to a prop.');
}
}
}
/*

@@ -275,0 +339,0 @@ Registers the component globally if appropriate.

/*
FullCalendar Vue Component v4.1.1
FullCalendar Vue Component v4.2.0
Docs: https://fullcalendar.io/docs/vue

@@ -12,36 +12,145 @@ License: MIT

function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
function _typeof(obj) {
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function (obj) {
return typeof obj;
};
} else {
obj[key] = value;
_typeof = function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}
return obj;
return _typeof(obj);
}
function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
var ownKeys = Object.keys(source);
var isArray = Array.isArray;
var keyList = Object.keys;
var hasProp = Object.prototype.hasOwnProperty;
if (typeof Object.getOwnPropertySymbols === 'function') {
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
var fastDeepEqual = function equal(a, b) {
if (a === b) return true;
if (a && b && _typeof(a) == 'object' && _typeof(b) == 'object') {
var arrA = isArray(a),
arrB = isArray(b),
i,
length,
key;
if (arrA && arrB) {
length = a.length;
if (length != b.length) return false;
for (i = length; i-- !== 0;) {
if (!equal(a[i], b[i])) return false;
}
return true;
}
ownKeys.forEach(function (key) {
_defineProperty(target, key, source[key]);
});
if (arrA != arrB) return false;
var dateA = a instanceof Date,
dateB = b instanceof Date;
if (dateA != dateB) return false;
if (dateA && dateB) return a.getTime() == b.getTime();
var regexpA = a instanceof RegExp,
regexpB = b instanceof RegExp;
if (regexpA != regexpB) return false;
if (regexpA && regexpB) return a.toString() == b.toString();
var keys = keyList(a);
length = keys.length;
if (length !== keyList(b).length) return false;
for (i = length; i-- !== 0;) {
if (!hasProp.call(b, keys[i])) return false;
}
for (i = length; i-- !== 0;) {
key = keys[i];
if (!equal(a[key], b[key])) return false;
}
return true;
}
return target;
return a !== a && b !== b;
};
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
function createCommonjsModule(fn, module) {
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
var deepCopy = createCommonjsModule(function (module, exports) {
(function (name, root, factory) {
{
module.exports = factory();
}
})('dcopy', commonjsGlobal, function () {
/**
* Deep copy objects and arrays
*
* @param {Object/Array} target
* @return {Object/Array} copy
* @api public
*/
return function (target) {
if (/number|string|boolean/.test(_typeof(target))) {
return target;
}
if (target instanceof Date) {
return new Date(target.getTime());
}
var copy = target instanceof Array ? [] : {};
walk(target, copy);
return copy;
function walk(target, copy) {
for (var key in target) {
var obj = target[key];
if (obj instanceof Date) {
var value = new Date(obj.getTime());
add(copy, key, value);
} else if (obj instanceof Function) {
var value = obj;
add(copy, key, value);
} else if (obj instanceof Array) {
var value = [];
var last = add(copy, key, value);
walk(obj, last);
} else if (obj instanceof Object) {
var value = {};
var last = add(copy, key, value);
walk(obj, last);
} else {
var value = obj;
add(copy, key, value);
}
}
}
};
/**
* Adds a value to the copy object based on its type
*
* @api private
*/
function add(copy, key, value) {
if (copy instanceof Array) {
copy.push(value);
return copy[copy.length - 1];
} else if (copy instanceof Object) {
copy[key] = value;
return copy[key];
}
}
});
});
/*

@@ -56,3 +165,3 @@ the docs point to this file as an index of options.

*/
var INPUT_DEFS = {
var PROP_DEFS = {
header: {},

@@ -163,2 +272,13 @@ footer: {},

timeGridEventMinHeight: {},
allDayHtml: {},
eventDragMinDistance: {},
eventResourceEditable: {},
eventSourceFailure: {},
eventSourceSuccess: {},
forceEventDuration: {},
progressiveEventRendering: {},
selectLongPressDelay: {},
selectMinDistance: {},
timeZoneParam: {},
titleRangeSeparator: {},
// compound OptionsInput...

@@ -182,11 +302,52 @@ buttonText: {},

datesAboveResources: {},
googleCalendarApiKey: {}
googleCalendarApiKey: {},
refetchResourcesOnNavigate: {},
// used to be emissions but are now props...
datesRender: {},
datesDestroy: {},
dayRender: {},
eventRender: {},
eventDestroy: {},
viewSkeletonRender: {},
viewSkeletonDestroy: {},
resourceRender: {}
};
var EVENT_NAMES = ['datesRender', 'datesDestroy', 'dayRender', 'windowResize', 'dateClick', 'eventClick', 'eventMouseEnter', 'eventMouseLeave', 'select', 'unselect', 'loading', 'eventRender', 'eventPositioned', '_eventsPositioned', 'eventDestroy', 'eventDragStart', 'eventDragStop', 'eventDrop', 'eventResizeStart', 'eventResizeStop', 'eventResize', 'drop', 'eventReceive', 'eventLeave', 'viewSkeletonRender', 'viewSkeletonDestroy', '_destroyed', // scheduler...
'resourceRender'];
var PROP_IS_DEEP = {
header: true,
footer: true,
events: true,
eventSources: true,
resources: true
};
var EMISSION_NAMES = ['windowResize', 'dateClick', 'eventClick', 'eventMouseEnter', 'eventMouseLeave', 'select', 'unselect', 'loading', 'eventPositioned', '_eventsPositioned', 'eventDragStart', 'eventDragStop', 'eventDrop', 'eventResizeStart', 'eventResizeStop', 'eventResize', 'drop', 'eventReceive', 'eventLeave', '_destroyed', // should now be props... (TODO: eventually remove)
'datesRender', 'datesDestroy', 'dayRender', 'eventRender', 'eventDestroy', 'viewSkeletonRender', 'viewSkeletonDestroy', 'resourceRender']; // identify deprecated emissions (TODO: eventually remove)
var EMISSION_USE_PROP = {
datesRender: true,
datesDestroy: true,
dayRender: true,
eventRender: true,
eventDestroy: true,
viewSkeletonRender: true,
viewSkeletonDestroy: true,
resourceRender: true
};
/*
VOCAB:
"props" are the values passed in from the parent (they are NOT listeners/emissions)
"emissions" are another way to say "events that will fire"
"options" are the options that the FullCalendar API accepts
NOTE: "deep" props are complex objects that we want to watch for internal changes.
Vue allows a reference to be internally mutated. Each time we detect a mutation,
we use deepCopy to freeze the state. This has the added benefit of stripping the
getter/setter methods that Vue embeds.
*/
var FullCalendarComponent = {
props: INPUT_DEFS,
calendar: null,
// accessed via this.$options.calendar
props: PROP_DEFS,
// INTERNALS
// this.$options.calendar
// this.$options.dirtyOptions - null means no dirty options
render: function render(createElement) {

@@ -196,35 +357,18 @@ return createElement('div');

mounted: function mounted() {
this.$options.calendar = new core.Calendar(this.$el, this.fullCalendarOptions);
warnDeprecatedListeners(this.$listeners);
this.$options.calendar = new core.Calendar(this.$el, this.buildOptions());
this.$options.calendar.render();
},
beforeUpdate: function beforeUpdate() {
this.renderDirty();
},
beforeDestroy: function beforeDestroy() {
this.$options.calendar.destroy();
},
watch: {
fullCalendarOptions: function fullCalendarOptions(options) {
this.$options.calendar.resetOptions(options);
}
},
computed: {
fullCalendarOptions: function fullCalendarOptions() {
return _objectSpread({}, this.fullCalendarInputs, this.fullCalendarEvents);
},
fullCalendarInputs: function fullCalendarInputs() {
var inputHash = {};
for (var inputName in INPUT_DEFS) {
var val = this[inputName];
if (val !== undefined) {
// unfortunately FC chokes when some props are set to undefined
inputHash[inputName] = val;
}
}
return inputHash;
},
fullCalendarEvents: function fullCalendarEvents() {
watch: buildWatchers(),
methods: {
buildOptions: function buildOptions() {
var _this = this;
var handlerHash = {};
var options = {};
var _iteratorNormalCompletion = true;

@@ -236,5 +380,5 @@ var _didIteratorError = false;

var _loop = function _loop() {
var eventName = _step.value;
var emissionName = _step.value;
handlerHash[eventName] = function () {
options[emissionName] = function () {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {

@@ -244,9 +388,10 @@ args[_key] = arguments[_key];

_this.$emit.apply(_this, [eventName].concat(args));
_this.$emit.apply(_this, [emissionName].concat(args));
};
};
for (var _iterator = EVENT_NAMES[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
for (var _iterator = EMISSION_NAMES[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
_loop();
}
} // do after emissions. these props will override emissions with same name
} catch (err) {

@@ -267,6 +412,23 @@ _didIteratorError = true;

return handlerHash;
}
},
methods: {
for (var propName in PROP_DEFS) {
var propVal = this[propName];
if (propVal !== undefined) {
// NOTE: FullCalendar's API often chokes on undefines
options[propName] = PROP_IS_DEEP[propName] ? deepCopy(propVal) // NOTE: deepCopy will choke on undefined as well
: propVal;
}
}
return options;
},
renderDirty: function renderDirty() {
var dirtyOptions = this.$options.dirtyOptions;
if (dirtyOptions) {
this.$options.dirtyOptions = null; // clear before rendering. might trigger new dirtiness
this.$options.calendar.mutateOptions(dirtyOptions, [], false, fastDeepEqual);
}
},
getApi: function getApi() {

@@ -278,2 +440,45 @@ return this.$options.calendar;

function buildWatchers() {
var watchers = {};
var _loop2 = function _loop2(propName) {
if (PROP_IS_DEEP[propName]) {
watchers[propName] = {
deep: true,
// listen to children as well
handler: function handler(newVal, oldVal) {
recordDirtyOption(this, propName, deepCopy(newVal)); // if the reference is the same, it's an add, remove, or internal mutation. the beforeUpdate hook WON'T fire.
// otherwise, the beforeUpdate hook WILL fire and cause a rerender
if (newVal === oldVal) {
this.renderDirty();
}
}
};
} else {
watchers[propName] = function (newVal) {
recordDirtyOption(this, propName, newVal); // the beforeUpdate hook will render the dirtiness
};
}
};
for (var propName in PROP_DEFS) {
_loop2(propName);
}
return watchers;
}
function recordDirtyOption(vm, optionName, newVal) {
(vm.$options.dirtyOptions || (vm.$options.dirtyOptions = {}))[optionName] = newVal;
}
function warnDeprecatedListeners(listenerHash) {
for (var emissionName in listenerHash) {
if (EMISSION_USE_PROP[emissionName]) {
console.warn('Use of ' + emissionName + ' as an event is deprecated. Please convert to a prop.');
}
}
}
/*

@@ -280,0 +485,0 @@ Registers the component globally if appropriate.

{
"name": "@fullcalendar/vue",
"version": "4.1.1",
"version": "4.2.0",
"title": "FullCalendar Vue Component",

@@ -18,3 +18,5 @@ "description": "An official FullCalendar component for Vue",

"dependencies": {
"@fullcalendar/core": "~4.1.0"
"@fullcalendar/core": "~4.2.0",
"deep-copy": "^1.4.2",
"fast-deep-equal": "^2.0.1"
},

@@ -21,0 +23,0 @@ "peerDependencies": {

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