@fullcalendar/vue
Advanced tools
Comparing version 4.2.0 to 4.2.1
117
main.esm.js
/* | ||
FullCalendar Vue Component v4.2.0 | ||
FullCalendar Vue Component v4.2.1 | ||
Docs: https://fullcalendar.io/docs/vue | ||
@@ -7,6 +7,48 @@ License: MIT | ||
import deepEqual from 'fast-deep-equal'; | ||
import deepCopy from 'deep-copy'; | ||
import { Calendar } from '@fullcalendar/core'; | ||
function _typeof(obj) { | ||
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { | ||
_typeof = function (obj) { | ||
return typeof obj; | ||
}; | ||
} else { | ||
_typeof = function (obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | ||
}; | ||
} | ||
return _typeof(obj); | ||
} | ||
var hasOwnProperty = Object.prototype.hasOwnProperty; | ||
/* | ||
Really simple clone utility. Only copies plain arrays and objects. Transfers everything else as-is. | ||
Wanted to use a third-party lib, but none did exactly this. | ||
*/ | ||
function deepCopy(input) { | ||
if (Array.isArray(input)) { | ||
return input.map(deepCopy); | ||
} else if (_typeof(input) === 'object' && input) { | ||
// non-null object | ||
return mapHash(input, deepCopy); | ||
} else { | ||
// everything else (null, function, etc) | ||
return input; | ||
} | ||
} | ||
function mapHash(input, func) { | ||
var output = {}; | ||
for (var key in input) { | ||
if (hasOwnProperty.call(input, key)) { | ||
output[key] = func(input[key], key); | ||
} | ||
} | ||
return output; | ||
} | ||
/* | ||
the docs point to this file as an index of options. | ||
@@ -204,5 +246,15 @@ when this files is moved, update the docs. | ||
// this.$options.calendar | ||
// this.$options.dirtyOptions - null means no dirty options | ||
// this.$options.dirtyOptions - null/undefined means nothing dirty | ||
data: function data() { | ||
return { | ||
renderId: 0 | ||
}; | ||
}, | ||
render: function render(createElement) { | ||
return createElement('div'); | ||
return createElement('div', { | ||
// when renderId is changed, Vue will trigger a real-DOM async rerender, calling beforeUpdate/updated | ||
attrs: { | ||
'data-fc-render-id': this.renderId | ||
} | ||
}); | ||
}, | ||
@@ -220,3 +272,3 @@ mounted: function mounted() { | ||
}, | ||
watch: buildWatchers(), | ||
watch: mapHash(PROP_DEFS, buildPropWatcher), | ||
methods: { | ||
@@ -264,8 +316,6 @@ buildOptions: function buildOptions() { | ||
for (var propName in PROP_DEFS) { | ||
var propVal = this[propName]; | ||
var propVal = this[propName]; // protect against FullCalendar choking on undefined options | ||
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; | ||
options[propName] = PROP_IS_DEEP[propName] ? deepCopy(propVal) : propVal; | ||
} | ||
@@ -276,2 +326,6 @@ } | ||
}, | ||
recordDirtyOption: function recordDirtyOption(optionName, newVal) { | ||
(this.$options.dirtyOptions || (this.$options.dirtyOptions = {}))[optionName] = newVal; | ||
this.renderId++; // triggers a render eventually | ||
}, | ||
renderDirty: function renderDirty() { | ||
@@ -292,37 +346,18 @@ var dirtyOptions = this.$options.dirtyOptions; | ||
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); | ||
function buildPropWatcher(propDef, propName) { | ||
if (PROP_IS_DEEP[propName]) { | ||
return { | ||
deep: true, | ||
// listen to children as well | ||
handler: function handler(newVal) { | ||
this.recordDirtyOption(propName, deepCopy(newVal)); | ||
} | ||
}; | ||
} else { | ||
return function (newVal) { | ||
this.recordDirtyOption(propName, newVal); | ||
}; | ||
} | ||
return watchers; | ||
} | ||
function recordDirtyOption(vm, optionName, newVal) { | ||
(vm.$options.dirtyOptions || (vm.$options.dirtyOptions = {}))[optionName] = newVal; | ||
} | ||
function warnDeprecatedListeners(listenerHash) { | ||
@@ -329,0 +364,0 @@ for (var emissionName in listenerHash) { |
166
main.umd.js
/* | ||
FullCalendar Vue Component v4.2.0 | ||
FullCalendar Vue Component v4.2.1 | ||
Docs: https://fullcalendar.io/docs/vue | ||
@@ -79,78 +79,31 @@ License: MIT | ||
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; | ||
var hasOwnProperty = Object.prototype.hasOwnProperty; | ||
/* | ||
Really simple clone utility. Only copies plain arrays and objects. Transfers everything else as-is. | ||
Wanted to use a third-party lib, but none did exactly this. | ||
*/ | ||
function createCommonjsModule(fn, module) { | ||
return module = { exports: {} }, fn(module, module.exports), module.exports; | ||
function deepCopy(input) { | ||
if (Array.isArray(input)) { | ||
return input.map(deepCopy); | ||
} else if (_typeof(input) === 'object' && input) { | ||
// non-null object | ||
return mapHash(input, deepCopy); | ||
} else { | ||
// everything else (null, function, etc) | ||
return input; | ||
} | ||
} | ||
function mapHash(input, func) { | ||
var output = {}; | ||
var deepCopy = createCommonjsModule(function (module, exports) { | ||
(function (name, root, factory) { | ||
{ | ||
module.exports = factory(); | ||
for (var key in input) { | ||
if (hasOwnProperty.call(input, key)) { | ||
output[key] = func(input[key], key); | ||
} | ||
})('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()); | ||
} | ||
return output; | ||
} | ||
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]; | ||
} | ||
} | ||
}); | ||
}); | ||
/* | ||
@@ -349,5 +302,15 @@ the docs point to this file as an index of options. | ||
// this.$options.calendar | ||
// this.$options.dirtyOptions - null means no dirty options | ||
// this.$options.dirtyOptions - null/undefined means nothing dirty | ||
data: function data() { | ||
return { | ||
renderId: 0 | ||
}; | ||
}, | ||
render: function render(createElement) { | ||
return createElement('div'); | ||
return createElement('div', { | ||
// when renderId is changed, Vue will trigger a real-DOM async rerender, calling beforeUpdate/updated | ||
attrs: { | ||
'data-fc-render-id': this.renderId | ||
} | ||
}); | ||
}, | ||
@@ -365,3 +328,3 @@ mounted: function mounted() { | ||
}, | ||
watch: buildWatchers(), | ||
watch: mapHash(PROP_DEFS, buildPropWatcher), | ||
methods: { | ||
@@ -409,8 +372,6 @@ buildOptions: function buildOptions() { | ||
for (var propName in PROP_DEFS) { | ||
var propVal = this[propName]; | ||
var propVal = this[propName]; // protect against FullCalendar choking on undefined options | ||
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; | ||
options[propName] = PROP_IS_DEEP[propName] ? deepCopy(propVal) : propVal; | ||
} | ||
@@ -421,2 +382,6 @@ } | ||
}, | ||
recordDirtyOption: function recordDirtyOption(optionName, newVal) { | ||
(this.$options.dirtyOptions || (this.$options.dirtyOptions = {}))[optionName] = newVal; | ||
this.renderId++; // triggers a render eventually | ||
}, | ||
renderDirty: function renderDirty() { | ||
@@ -437,37 +402,18 @@ var dirtyOptions = this.$options.dirtyOptions; | ||
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); | ||
function buildPropWatcher(propDef, propName) { | ||
if (PROP_IS_DEEP[propName]) { | ||
return { | ||
deep: true, | ||
// listen to children as well | ||
handler: function handler(newVal) { | ||
this.recordDirtyOption(propName, deepCopy(newVal)); | ||
} | ||
}; | ||
} else { | ||
return function (newVal) { | ||
this.recordDirtyOption(propName, newVal); | ||
}; | ||
} | ||
return watchers; | ||
} | ||
function recordDirtyOption(vm, optionName, newVal) { | ||
(vm.$options.dirtyOptions || (vm.$options.dirtyOptions = {}))[optionName] = newVal; | ||
} | ||
function warnDeprecatedListeners(listenerHash) { | ||
@@ -474,0 +420,0 @@ for (var emissionName in listenerHash) { |
{ | ||
"name": "@fullcalendar/vue", | ||
"version": "4.2.0", | ||
"version": "4.2.1", | ||
"title": "FullCalendar Vue Component", | ||
@@ -19,3 +19,2 @@ "description": "An official FullCalendar component for Vue", | ||
"@fullcalendar/core": "~4.2.0", | ||
"deep-copy": "^1.4.2", | ||
"fast-deep-equal": "^2.0.1" | ||
@@ -22,0 +21,0 @@ }, |
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
3
25864
777
- Removeddeep-copy@^1.4.2
- Removeddeep-copy@1.4.2(transitive)