rc-dialog
Advanced tools
Comparing version 4.3.5 to 4.4.0
# History | ||
---- | ||
## 4.4.0 2015-07-03 | ||
support esc to close | ||
## 4.2.0 / 2015-06-09 | ||
@@ -4,0 +8,0 @@ |
@@ -8,2 +8,3 @@ 'use strict'; | ||
var RcUtil = require('rc-util'); | ||
var KeyCode = RcUtil.KeyCode; | ||
var Dom = RcUtil.Dom; | ||
@@ -71,4 +72,2 @@ var assign = require('object-assign'); | ||
componentDidUpdate: function componentDidUpdate(prevProps) { | ||
var _this = this; | ||
var props = this.props; | ||
@@ -85,3 +84,3 @@ var dialogDomNode = React.findDOMNode(this.refs.dialog); | ||
this.anim(dialogDomNode, props.transitionName, props.animation, true, function () { | ||
_this.props.onShow(); | ||
props.onShow(); | ||
}); | ||
@@ -96,3 +95,3 @@ dialogDomNode.focus(); | ||
this.anim(dialogDomNode, props.transitionName, props.animation, false, function () { | ||
_this.props.onClose(); | ||
props.onClose(); | ||
}); | ||
@@ -108,2 +107,8 @@ } | ||
handleKeyDown: function handleKeyDown(e) { | ||
if (e.keyCode === KeyCode.ESC) { | ||
this.props.onRequestClose(); | ||
} | ||
}, | ||
render: function render() { | ||
@@ -132,4 +137,12 @@ var props = this.props; | ||
var maskProps = {}; | ||
var dialogProps = { | ||
className: [prefixCls, props.className].join(' '), | ||
tabIndex: '0', | ||
role: 'dialog', | ||
ref: 'dialog', | ||
style: style | ||
}; | ||
if (closable) { | ||
maskProps.onClick = this.props.onRequestClose; | ||
maskProps.onClick = props.onRequestClose; | ||
dialogProps.onKeyDown = this.handleKeyDown; | ||
} | ||
@@ -154,3 +167,3 @@ if (style.zIndex) { | ||
'a', | ||
{ tabIndex: '0', onClick: this.props.onRequestClose, className: [prefixClsFn(prefixCls, 'close')].join('') }, | ||
{ tabIndex: '0', onClick: props.onRequestClose, className: [prefixClsFn(prefixCls, 'close')].join('') }, | ||
React.createElement('span', { className: prefixClsFn(prefixCls, 'close-x') }) | ||
@@ -171,3 +184,3 @@ ) : null, | ||
'div', | ||
{ className: [prefixClsFn(prefixCls, ''), props.className].join(' '), tabIndex: '0', role: 'dialog', ref: 'dialog', style: style }, | ||
dialogProps, | ||
React.createElement( | ||
@@ -174,0 +187,0 @@ 'div', |
{ | ||
"name": "rc-dialog", | ||
"version": "4.3.5", | ||
"version": "4.4.0", | ||
"description": "dialog ui component for react", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
25754
684