rc-calendar
Advanced tools
Comparing version 9.12.3 to 9.13.0
@@ -228,3 +228,4 @@ import _extends from 'babel-runtime/helpers/extends'; | ||
clearIcon: PropTypes.node, | ||
focusablePanel: PropTypes.bool | ||
focusablePanel: PropTypes.bool, | ||
onBlur: PropTypes.func | ||
}); | ||
@@ -365,2 +366,18 @@ Calendar.defaultProps = _extends({}, calendarMixinDefaultProps, defaultProp, { | ||
this.onBlur = function (event) { | ||
setTimeout(function () { | ||
var dateInput = DateInput.getInstance(); | ||
var rootInstance = _this2.rootInstance; | ||
if (!rootInstance || rootInstance.contains(document.activeElement) || dateInput && dateInput.contains(document.activeElement)) { | ||
// focused element is still part of Calendar | ||
return; | ||
} | ||
if (_this2.props.onBlur) { | ||
_this2.props.onBlur(event); | ||
} | ||
}, 0); | ||
}; | ||
this.getRootDOMNode = function () { | ||
@@ -367,0 +384,0 @@ return ReactDOM.findDOMNode(_this2); |
@@ -67,3 +67,4 @@ import _classCallCheck from 'babel-runtime/helpers/classCallCheck'; | ||
tabIndex: '0', | ||
onKeyDown: _this.onKeyDown | ||
onKeyDown: _this.onKeyDown, | ||
onBlur: _this.onBlur | ||
}, | ||
@@ -70,0 +71,0 @@ newProps.children |
@@ -125,3 +125,4 @@ import _classCallCheck from 'babel-runtime/helpers/classCallCheck'; | ||
defaultValue: PropTypes.oneOfType([PropTypes.object, PropTypes.array]), | ||
align: PropTypes.object | ||
align: PropTypes.object, | ||
onBlur: PropTypes.func | ||
}; | ||
@@ -135,3 +136,4 @@ Picker.defaultProps = { | ||
onChange: noop, | ||
onOpenChange: noop | ||
onOpenChange: noop, | ||
onBlur: noop | ||
}; | ||
@@ -179,2 +181,6 @@ | ||
this.onCalendarBlur = function () { | ||
_this2.setOpen(false); | ||
}; | ||
this.onVisibleChange = function (open) { | ||
@@ -198,3 +204,4 @@ _this2.setOpen(open); | ||
onSelect: createChainedFunction(calendarProps.onSelect, _this2.onCalendarSelect), | ||
onClear: createChainedFunction(calendarProps.onClear, _this2.onCalendarClear) | ||
onClear: createChainedFunction(calendarProps.onClear, _this2.onCalendarClear), | ||
onBlur: createChainedFunction(calendarProps.onBlur, _this2.onCalendarBlur) | ||
}; | ||
@@ -201,0 +208,0 @@ |
# History | ||
---- | ||
## 9.13.0 / 2019-04-02 | ||
- Support close onBlur | ||
## 9.12.0 / 2019-03-16 | ||
@@ -5,0 +9,0 @@ |
@@ -277,3 +277,4 @@ 'use strict'; | ||
clearIcon: _propTypes2['default'].node, | ||
focusablePanel: _propTypes2['default'].bool | ||
focusablePanel: _propTypes2['default'].bool, | ||
onBlur: _propTypes2['default'].func | ||
}); | ||
@@ -414,2 +415,18 @@ Calendar.defaultProps = (0, _extends3['default'])({}, _CalendarMixin.calendarMixinDefaultProps, _CommonMixin.defaultProp, { | ||
this.onBlur = function (event) { | ||
setTimeout(function () { | ||
var dateInput = _DateInput2['default'].getInstance(); | ||
var rootInstance = _this2.rootInstance; | ||
if (!rootInstance || rootInstance.contains(document.activeElement) || dateInput && dateInput.contains(document.activeElement)) { | ||
// focused element is still part of Calendar | ||
return; | ||
} | ||
if (_this2.props.onBlur) { | ||
_this2.props.onBlur(event); | ||
} | ||
}, 0); | ||
}; | ||
this.getRootDOMNode = function () { | ||
@@ -416,0 +433,0 @@ return _reactDom2['default'].findDOMNode(_this2); |
@@ -97,3 +97,4 @@ 'use strict'; | ||
tabIndex: '0', | ||
onKeyDown: _this.onKeyDown | ||
onKeyDown: _this.onKeyDown, | ||
onBlur: _this.onBlur | ||
}, | ||
@@ -100,0 +101,0 @@ newProps.children |
@@ -161,3 +161,4 @@ 'use strict'; | ||
defaultValue: _propTypes2['default'].oneOfType([_propTypes2['default'].object, _propTypes2['default'].array]), | ||
align: _propTypes2['default'].object | ||
align: _propTypes2['default'].object, | ||
onBlur: _propTypes2['default'].func | ||
}; | ||
@@ -171,3 +172,4 @@ Picker.defaultProps = { | ||
onChange: noop, | ||
onOpenChange: noop | ||
onOpenChange: noop, | ||
onBlur: noop | ||
}; | ||
@@ -215,2 +217,6 @@ | ||
this.onCalendarBlur = function () { | ||
_this2.setOpen(false); | ||
}; | ||
this.onVisibleChange = function (open) { | ||
@@ -234,3 +240,4 @@ _this2.setOpen(open); | ||
onSelect: (0, _createChainedFunction2['default'])(calendarProps.onSelect, _this2.onCalendarSelect), | ||
onClear: (0, _createChainedFunction2['default'])(calendarProps.onClear, _this2.onCalendarClear) | ||
onClear: (0, _createChainedFunction2['default'])(calendarProps.onClear, _this2.onCalendarClear), | ||
onBlur: (0, _createChainedFunction2['default'])(calendarProps.onBlur, _this2.onCalendarBlur) | ||
}; | ||
@@ -237,0 +244,0 @@ |
{ | ||
"name": "rc-calendar", | ||
"version": "9.12.3", | ||
"version": "9.13.0", | ||
"description": "React Calendar", | ||
@@ -87,3 +87,3 @@ "keywords": [ | ||
"tslint": "^5.9.1", | ||
"typescript": "^2.8.3" | ||
"typescript": "^3.4.1" | ||
}, | ||
@@ -90,0 +90,0 @@ "pre-commit": [ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
1529315
23256