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

react-flatpickr

Package Overview
Dependencies
Maintainers
2
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-flatpickr - npm Package Compare versions

Comparing version 3.6.2 to 3.6.3

build/example.js

103

build/index.js

@@ -47,2 +47,4 @@ 'use strict';

value: function componentWillReceiveProps(props) {
var _this2 = this;
var options = props.options;

@@ -53,32 +55,11 @@

// Add prop hooks to options
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = hooks[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var hook = _step.value;
if (props.hasOwnProperty(hook)) {
options[hook] = props[hook];
}
// Add prev ones too so we can compare against them later
if (this.props.hasOwnProperty(hook)) {
prevOptions[hook] = this.props[hook];
}
hooks.forEach(function (hook) {
if (props.hasOwnProperty(hook)) {
options[hook] = props[hook];
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
// Add prev ones too so we can compare against them later
if (_this2.props.hasOwnProperty(hook)) {
prevOptions[hook] = _this2.props[hook];
}
}
});

@@ -108,7 +89,7 @@ var optionsKeys = Object.getOwnPropertyNames(options);

value: function componentDidMount() {
var _this2 = this;
var _this3 = this;
var options = _extends({
onClose: function onClose() {
_this2.node.blur && _this2.node.blur();
_this3.node.blur && _this3.node.blur();
}

@@ -118,28 +99,7 @@ }, this.props.options);

// Add prop hooks to options
var _iteratorNormalCompletion2 = true;
var _didIteratorError2 = false;
var _iteratorError2 = undefined;
try {
for (var _iterator2 = hooks[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
var hook = _step2.value;
if (this.props[hook]) {
options[hook] = this.props[hook];
}
hooks.forEach(function (hook) {
if (_this3.props[hook]) {
options[hook] = _this3.props[hook];
}
} catch (err) {
_didIteratorError2 = true;
_iteratorError2 = err;
} finally {
try {
if (!_iteratorNormalCompletion2 && _iterator2.return) {
_iterator2.return();
}
} finally {
if (_didIteratorError2) {
throw _iteratorError2;
}
}
}
});

@@ -160,3 +120,3 @@ this.flatpickr = new _flatpickr2.default(this.node, options);

value: function render() {
var _this3 = this;
var _this4 = this;

@@ -174,31 +134,10 @@ // eslint-disable-next-line no-unused-vars

var _iteratorNormalCompletion3 = true;
var _didIteratorError3 = false;
var _iteratorError3 = undefined;
hooks.forEach(function (hook) {
delete props[hook];
});
try {
for (var _iterator3 = hooks[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
var hook = _step3.value;
delete props[hook];
}
} catch (err) {
_didIteratorError3 = true;
_iteratorError3 = err;
} finally {
try {
if (!_iteratorNormalCompletion3 && _iterator3.return) {
_iterator3.return();
}
} finally {
if (_didIteratorError3) {
throw _iteratorError3;
}
}
}
return options.wrap ? _react2.default.createElement(
'div',
_extends({}, props, { ref: function ref(node) {
_this3.node = node;
_this4.node = node;
} }),

@@ -208,3 +147,3 @@ children

ref: function ref(node) {
_this3.node = node;
_this4.node = node;
} }));

@@ -211,0 +150,0 @@ }

@@ -47,3 +47,3 @@

// Add prop hooks to options
for (let hook of hooks) {
hooks.forEach(hook => {
if (props.hasOwnProperty(hook)) {

@@ -56,3 +56,3 @@ options[hook] = props[hook]

}
}
})

@@ -89,7 +89,7 @@ const optionsKeys = Object.getOwnPropertyNames(options)

// Add prop hooks to options
for (let hook of hooks) {
hooks.forEach(hook => {
if (this.props[hook]) {
options[hook] = this.props[hook]
}
}
})

@@ -112,5 +112,5 @@ this.flatpickr = new Flatpickr(this.node, options)

// Don't pass hooks to dom node
for (let hook of hooks) {
hooks.forEach(hook => {
delete props[hook]
}
})

@@ -117,0 +117,0 @@ return options.wrap

{
"name": "react-flatpickr",
"version": "3.6.2",
"version": "3.6.3",
"description": "flatpickr for React",

@@ -5,0 +5,0 @@ "main": "build/index.js",

@@ -6,7 +6,7 @@

### react-flatpickr
# react-flatpickr
[Flatpickr](https://github.com/chmln/flatpickr) for React.
### Usage
## Usage

@@ -20,6 +20,16 @@ ```jsx

class App extends Component {
constructor() {
super();
this.state = {
date: new Date()
};
}
render() {
const { date } = this.state;
return (
<Flatpickr data-enable-time
onChange={v => console.info(v)} />
value={date}
onChange={date => { this.setState({date}) }} />
)

@@ -29,3 +39,2 @@ }

```
* `flatpickr options`: you can pass all `flatpickr parameters` to `props.options`

@@ -41,3 +50,3 @@ * All flatpickr [hooks][hooks] can be passed as a react prop, or to `props.options`

### License
## License
MIT

@@ -44,0 +53,0 @@

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