react-date-picker
Advanced tools
Comparing version 7.3.0 to 7.4.0
@@ -24,2 +24,4 @@ "use strict"; | ||
var _utils = require("./shared/utils"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -168,2 +170,14 @@ | ||
}, { | ||
key: "componentDidUpdate", | ||
value: function componentDidUpdate(prevProps, prevState) { | ||
var isOpen = this.state.isOpen; | ||
var _this$props2 = this.props, | ||
onCalendarClose = _this$props2.onCalendarClose, | ||
onCalendarOpen = _this$props2.onCalendarOpen; | ||
if (isOpen !== prevState.isOpen) { | ||
(0, _utils.callIfDefined)(isOpen ? onCalendarOpen : onCalendarClose); | ||
} | ||
} | ||
}, { | ||
key: "componentWillUnmount", | ||
@@ -177,15 +191,15 @@ value: function componentWillUnmount() { | ||
value: function renderInputs() { | ||
var _this$props2 = this.props, | ||
calendarIcon = _this$props2.calendarIcon, | ||
clearIcon = _this$props2.clearIcon, | ||
disabled = _this$props2.disabled, | ||
locale = _this$props2.locale, | ||
maxDate = _this$props2.maxDate, | ||
maxDetail = _this$props2.maxDetail, | ||
minDate = _this$props2.minDate, | ||
name = _this$props2.name, | ||
returnValue = _this$props2.returnValue, | ||
required = _this$props2.required, | ||
showLeadingZeros = _this$props2.showLeadingZeros, | ||
value = _this$props2.value; | ||
var _this$props3 = this.props, | ||
calendarIcon = _this$props3.calendarIcon, | ||
clearIcon = _this$props3.clearIcon, | ||
disabled = _this$props3.disabled, | ||
locale = _this$props3.locale, | ||
maxDate = _this$props3.maxDate, | ||
maxDetail = _this$props3.maxDetail, | ||
minDate = _this$props3.minDate, | ||
name = _this$props3.name, | ||
returnValue = _this$props3.returnValue, | ||
required = _this$props3.required, | ||
showLeadingZeros = _this$props3.showLeadingZeros, | ||
value = _this$props3.value; | ||
var isOpen = this.state.isOpen; | ||
@@ -237,8 +251,8 @@ | ||
var _this$props3 = this.props, | ||
calendarClassName = _this$props3.calendarClassName, | ||
datePickerClassName = _this$props3.className, | ||
onChange = _this$props3.onChange, | ||
value = _this$props3.value, | ||
calendarProps = _objectWithoutProperties(_this$props3, ["calendarClassName", "className", "onChange", "value"]); | ||
var _this$props4 = this.props, | ||
calendarClassName = _this$props4.calendarClassName, | ||
datePickerClassName = _this$props4.className, | ||
onChange = _this$props4.onChange, | ||
value = _this$props4.value, | ||
calendarProps = _objectWithoutProperties(_this$props4, ["calendarClassName", "className", "onChange", "value"]); | ||
@@ -259,5 +273,5 @@ var className = "".concat(baseClassName, "__calendar"); | ||
var _this$props4 = this.props, | ||
className = _this$props4.className, | ||
disabled = _this$props4.disabled; | ||
var _this$props5 = this.props, | ||
className = _this$props5.className, | ||
disabled = _this$props5.disabled; | ||
var isOpen = this.state.isOpen; | ||
@@ -264,0 +278,0 @@ return _react.default.createElement("div", _extends({ |
@@ -12,2 +12,8 @@ "use strict"; | ||
}); | ||
Object.defineProperty(exports, "callIfDefined", { | ||
enumerable: true, | ||
get: function get() { | ||
return _utils.callIfDefined; | ||
} | ||
}); | ||
exports.updateInputWidth = exports.max = exports.min = void 0; | ||
@@ -14,0 +20,0 @@ |
{ | ||
"name": "react-date-picker", | ||
"version": "7.3.0", | ||
"version": "7.4.0", | ||
"description": "A date picker for your React app.", | ||
@@ -5,0 +5,0 @@ "main": "dist/entry.js", |
@@ -109,2 +109,4 @@ [![npm](https://img.shields.io/npm/v/react-date-picker.svg)](https://www.npmjs.com/package/react-date-picker) ![downloads](https://img.shields.io/npm/dt/react-date-picker.svg) ![build](https://img.shields.io/travis/wojtekmaj/react-date-picker/master.svg) ![dependencies](https://img.shields.io/david/wojtekmaj/react-date-picker.svg) ![dev dependencies](https://img.shields.io/david/dev/wojtekmaj/react-date-picker.svg) [![tested with jest](https://img.shields.io/badge/tested_with-jest-99424f.svg)](https://github.com/facebook/jest) | ||
|name|Defines input name. Defaults to "date".|`"myCustomName"`| | ||
|onCalendarClose|Function called when the calendar closes.|`() => alert('Calendar closed')`| | ||
|onCalendarOpen|Function called when the calendar opens.|`() => alert('Calendar opened')`| | ||
|onChange|Function called when the user clicks an item on the most detailed view available.|`(value) => alert('New date is: ', value)`| | ||
@@ -111,0 +113,0 @@ |returnValue|Defines which dates shall be passed by the calendar to the onChange function and onClick{Period} functions. Can be "start", "end" or "range". The latter will cause an array with start and end values to be passed. Defaults to "start".|`"range"`| |
@@ -12,2 +12,4 @@ import React, { PureComponent } from 'react'; | ||
import { callIfDefined } from './shared/utils'; | ||
const baseClassName = 'react-date-picker'; | ||
@@ -38,2 +40,11 @@ | ||
componentDidUpdate(prevProps, prevState) { | ||
const { isOpen } = this.state; | ||
const { onCalendarClose, onCalendarOpen } = this.props; | ||
if (isOpen !== prevState.isOpen) { | ||
callIfDefined(isOpen ? onCalendarOpen : onCalendarClose); | ||
} | ||
} | ||
componentWillUnmount() { | ||
@@ -40,0 +51,0 @@ document.removeEventListener('mousedown', this.onOutsideAction); |
export { | ||
between, | ||
callIfDefined, | ||
} from 'react-calendar/dist/shared/utils'; | ||
@@ -4,0 +5,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
148133
3532
159