From 867c4f2a85478c6e4e1a5885744e2419e2105395 Mon Sep 17 00:00:00 2001 From: yiminghe Date: Mon, 17 Aug 2015 23:42:52 +0800 Subject: [PATCH] support mousePosition --- components/modal/confirm.jsx | 1 - components/modal/demo/basic.md | 6 ++++-- components/modal/demo/custom.md | 6 ++++-- components/modal/demo/footer.md | 5 +++-- components/modal/index.jsx | 6 +++--- components/modal/index.md | 1 + package.json | 2 +- style/core/motion/zoom.less | 4 ---- 8 files changed, 16 insertions(+), 15 deletions(-) diff --git a/components/modal/confirm.jsx b/components/modal/confirm.jsx index 1242a4ca9c..953455b958 100644 --- a/components/modal/confirm.jsx +++ b/components/modal/confirm.jsx @@ -72,7 +72,6 @@ export default function (props) { React.render(显示对话框

对话框的内容

diff --git a/components/modal/demo/custom.md b/components/modal/demo/custom.md index 0d5c13e1c2..6d713ce32f 100644 --- a/components/modal/demo/custom.md +++ b/components/modal/demo/custom.md @@ -17,9 +17,10 @@ var Test = React.createClass({ visible: false }; }, - showModal() { + showModal(e) { this.setState({ - visible: true + visible: true, + mousePosition:{x:e.pageX,y:e.pageY} }); }, handleOk() { @@ -42,6 +43,7 @@ var Test = React.createClass({ return
diff --git a/components/modal/demo/footer.md b/components/modal/demo/footer.md index acbc47beb9..dcc5657c39 100644 --- a/components/modal/demo/footer.md +++ b/components/modal/demo/footer.md @@ -16,8 +16,8 @@ var Test = React.createClass({ visible: false }; }, - showModal() { - this.setState({ visible: true }); + showModal(e) { + this.setState({ visible: true,mousePosition:{x:e.pageX,y:e.pageY} }); }, handleOk() { this.setState({ loading: true }); @@ -35,6 +35,7 @@ var Test = React.createClass({ 返 回, diff --git a/components/modal/index.jsx b/components/modal/index.jsx index 5d5d8d8d1a..892f0de524 100644 --- a/components/modal/index.jsx +++ b/components/modal/index.jsx @@ -12,8 +12,7 @@ export default React.createClass({ }, handleCancel() { - var d = this.refs.d; - d.requestClose(); + this.props.onCancel(); }, getDefaultProps() { @@ -54,6 +53,7 @@ export default React.createClass({ 确 定 {loadingIcon} ]; - return ; + return ; } }); diff --git a/components/modal/index.md b/components/modal/index.md index b635f2e3a2..56c93b4503 100644 --- a/components/modal/index.md +++ b/components/modal/index.md @@ -21,6 +21,7 @@ | 参数 | 说明 | 类型 | 默认值 | |------------|----------------|------------------|--------------| | title | 标题 | React.Element | 无 | +| mousePosition | 鼠标位置,设置弹窗初始位置 | {x:number,y:number} | 无 | | onOk | 点击确定回调 | function | 无 | | onCancel | 点击遮罩层或右上角叉或取消按钮的回调 | function | 无 | | width | 宽度 | String or Number | 500 | diff --git a/package.json b/package.json index 2ecfe3021c..e8c6e18859 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "rc-calendar": "~3.13.0", "rc-checkbox": "~1.1.1", "rc-collapse": "~1.2.3", - "rc-dialog": "~4.5.0", + "rc-dialog": "~5.0.1", "rc-dropdown": "~1.2.0", "rc-form-validation": "~2.4.7", "rc-input-number": "~2.0.1", diff --git a/style/core/motion/zoom.less b/style/core/motion/zoom.less index 9c4319afad..7a833754a0 100644 --- a/style/core/motion/zoom.less +++ b/style/core/motion/zoom.less @@ -18,23 +18,19 @@ @keyframes zoomIn { 0% { opacity: 0; - transform-origin: 50% 50%; transform: scale(0, 0); } 100% { - transform-origin: 50% 50%; transform: scale(1, 1); } } @keyframes zoomOut { 0% { - transform-origin: 50% 50%; transform: scale(1, 1); } 100% { opacity: 0; - transform-origin: 50% 50%; transform: scale(0, 0); } }