react-flatpickr
Advanced tools
Comparing version 3.6.0 to 3.6.1
@@ -45,11 +45,8 @@ 'use strict'; | ||
_createClass(DateTimePicker, [{ | ||
key: 'componentWillReceiveProps', | ||
value: function componentWillReceiveProps(props) { | ||
key: 'componentDidReceiveProps', | ||
value: function componentDidReceiveProps(props, prevProps) { | ||
var options = props.options; | ||
var prevOptions = prevProps.options; | ||
if (props.hasOwnProperty('value')) { | ||
this.flatpickr.setDate(props.value, false); | ||
} | ||
// Add prop hooks to options | ||
@@ -64,5 +61,9 @@ var _iteratorNormalCompletion = true; | ||
if (props[hook]) { | ||
if (props.hasOwnProperty(hook)) { | ||
options[hook] = props[hook]; | ||
} | ||
// Add prev ones too so we can compare against them later | ||
if (prevProps.hasOwnProperty(hook)) { | ||
prevOptions[hook] = prevProps[hook]; | ||
} | ||
} | ||
@@ -84,14 +85,20 @@ } catch (err) { | ||
var optionsKeys = Object.getOwnPropertyNames(props.options); | ||
var optionsKeys = Object.getOwnPropertyNames(options); | ||
for (var index = optionsKeys.length - 1; index >= 0; index--) { | ||
var key = optionsKeys[index]; | ||
var value = props.options[key]; | ||
var value = options[key]; | ||
// Hook handlers must be set as an array | ||
if (hooks.indexOf(key) !== -1 && !Array.isArray(value)) { | ||
value = [value]; | ||
if (value !== prevOptions[key]) { | ||
// Hook handlers must be set as an array | ||
if (hooks.indexOf(key) !== -1 && !Array.isArray(value)) { | ||
value = [value]; | ||
} | ||
this.flatpickr.set(key, value); | ||
} | ||
} | ||
this.flatpickr.set(key, value); | ||
if (props.hasOwnProperty('value') && props.value !== prevProps.value) { | ||
this.flatpickr.setDate(props.value, false); | ||
} | ||
@@ -98,0 +105,0 @@ } |
@@ -42,28 +42,35 @@ | ||
componentWillReceiveProps(props) { | ||
componentDidReceiveProps(props, prevProps) { | ||
const { options } = props | ||
const prevOptions = prevProps.options | ||
if (props.hasOwnProperty('value')) { | ||
this.flatpickr.setDate(props.value, false) | ||
} | ||
// Add prop hooks to options | ||
for (let hook of hooks) { | ||
if (props[hook]) { | ||
if (props.hasOwnProperty(hook)) { | ||
options[hook] = props[hook] | ||
} | ||
// Add prev ones too so we can compare against them later | ||
if (prevProps.hasOwnProperty(hook)) { | ||
prevOptions[hook] = prevProps[hook] | ||
} | ||
} | ||
const optionsKeys = Object.getOwnPropertyNames(props.options) | ||
const optionsKeys = Object.getOwnPropertyNames(options) | ||
for (let index = optionsKeys.length - 1; index >= 0; index--) { | ||
const key = optionsKeys[index] | ||
let value = props.options[key] | ||
let value = options[key] | ||
// Hook handlers must be set as an array | ||
if (hooks.indexOf(key) !== -1 && !Array.isArray(value)) { | ||
value = [value] | ||
if (value !== prevOptions[key]) { | ||
// Hook handlers must be set as an array | ||
if (hooks.indexOf(key) !== -1 && !Array.isArray(value)) { | ||
value = [value] | ||
} | ||
this.flatpickr.set(key, value) | ||
} | ||
} | ||
this.flatpickr.set(key, value) | ||
if (props.hasOwnProperty('value') && props.value !== prevProps.value) { | ||
this.flatpickr.setDate(props.value, false) | ||
} | ||
@@ -70,0 +77,0 @@ } |
{ | ||
"name": "react-flatpickr", | ||
"version": "3.6.0", | ||
"version": "3.6.1", | ||
"description": "flatpickr for React", | ||
@@ -26,3 +26,3 @@ "main": "build/index.js", | ||
"dependencies": { | ||
"flatpickr": "^4.0.1", | ||
"flatpickr": "^4.0.5", | ||
"prop-types": "^15.5.10" | ||
@@ -29,0 +29,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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
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
2143387
6
22224
15
1
Updatedflatpickr@^4.0.5