|
@@ -1,5 +1,6 @@
|
|
|
import React,{Component} from 'react';
|
|
|
import style from './index.less';
|
|
|
+import ReactDom from "react-dom";
|
|
|
|
|
|
class NumberPan extends Component{
|
|
|
constructor(props){
|
|
@@ -46,39 +47,50 @@ class NumberPan extends Component{
|
|
|
});
|
|
|
onSelect&&onSelect(text);
|
|
|
}
|
|
|
- render(){
|
|
|
- const select = this.handleSelect.bind(this);
|
|
|
- const {show} = this.props; //table onBlur阻止冒泡是为了修复multSpread中数字键盘点击触发最外层数字组件onBlur事件
|
|
|
- return <div className={style['panBox']}
|
|
|
- onBlur={(e)=>e.stopPropagation()} style={{display:show?'table':'none'}}
|
|
|
+ getStyle(){
|
|
|
+ const {left,top,show} = this.props;
|
|
|
+ return {
|
|
|
+ left:left?left:'0',
|
|
|
+ top:top?top:'0',
|
|
|
+ display:show?'table':'none' //table onBlur阻止冒泡是为了修复multSpread中数字键盘点击触发最外层数字组件onBlur事件
|
|
|
+ }
|
|
|
+ }
|
|
|
+ render(){
|
|
|
+ const select = this.handleSelect.bind(this);
|
|
|
+ const domNode = document.getElementById('root');
|
|
|
+ return ReactDom.createPortal(
|
|
|
+ <div className={style['panBox']}
|
|
|
+ style={this.getStyle()}
|
|
|
+ onBlur={(e)=>e.stopPropagation()}
|
|
|
onDoubleClick={(e)=>e.stopPropagation()}>
|
|
|
- <table className={style['pan']} >
|
|
|
- <tr>
|
|
|
- <td><button onClick={select}>1</button></td>
|
|
|
- <td><button onClick={select}>2</button></td>
|
|
|
- <td><button onClick={select}>3</button></td>
|
|
|
- <td><button onClick={select}>/</button></td>
|
|
|
- </tr>
|
|
|
- <tr>
|
|
|
- <td><button onClick={select}>4</button></td>
|
|
|
- <td><button onClick={select}>5</button></td>
|
|
|
- <td><button onClick={select}>6</button></td>
|
|
|
- <td><button onClick={this.handleBack.bind(this)}>回退</button></td>
|
|
|
- </tr>
|
|
|
- <tr>
|
|
|
- <td><button onClick={select}>7</button></td>
|
|
|
- <td><button onClick={select}>8</button></td>
|
|
|
- <td><button onClick={select}>9</button></td>
|
|
|
- <td><button onClick={this.handleClear.bind(this)}>清空</button></td>
|
|
|
- </tr>
|
|
|
- <tr>
|
|
|
- <td><button onClick={select}>.</button></td>
|
|
|
- <td><button onClick={select}>0</button></td>
|
|
|
- <td><button onClick={select}>~</button></td>
|
|
|
- <td><button onClick={this.handleClose.bind(this)}>确定</button></td>
|
|
|
- </tr>
|
|
|
- </table>
|
|
|
- </div>
|
|
|
+ <table className={style['pan']} >
|
|
|
+ <tr>
|
|
|
+ <td><button onClick={select}>1</button></td>
|
|
|
+ <td><button onClick={select}>2</button></td>
|
|
|
+ <td><button onClick={select}>3</button></td>
|
|
|
+ <td><button onClick={select}>/</button></td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <td><button onClick={select}>4</button></td>
|
|
|
+ <td><button onClick={select}>5</button></td>
|
|
|
+ <td><button onClick={select}>6</button></td>
|
|
|
+ <td><button onClick={this.handleBack.bind(this)}>回退</button></td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <td><button onClick={select}>7</button></td>
|
|
|
+ <td><button onClick={select}>8</button></td>
|
|
|
+ <td><button onClick={select}>9</button></td>
|
|
|
+ <td><button onClick={this.handleClear.bind(this)}>清空</button></td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <td><button onClick={select}>.</button></td>
|
|
|
+ <td><button onClick={select}>0</button></td>
|
|
|
+ <td><button onClick={select}>~</button></td>
|
|
|
+ <td><button onClick={this.handleClose.bind(this)}>确定</button></td>
|
|
|
+ </tr>
|
|
|
+ </table>
|
|
|
+ </div>
|
|
|
+ ,domNode)
|
|
|
}
|
|
|
}
|
|
|
|