|
@@ -11,6 +11,7 @@ import {handleEnter,getPageCoordinate} from '@utils/tools.js';
|
|
* placeholder:灰显文字
|
|
* placeholder:灰显文字
|
|
* handleSelect: 选中事件
|
|
* handleSelect: 选中事件
|
|
* show: 是否显示下拉
|
|
* show: 是否显示下拉
|
|
|
|
+ * allClick:是否前后缀也可唤出数字键盘
|
|
*
|
|
*
|
|
* ***/
|
|
* ***/
|
|
class NumberDrop extends Component{
|
|
class NumberDrop extends Component{
|
|
@@ -57,8 +58,9 @@ class NumberDrop extends Component{
|
|
}
|
|
}
|
|
e.stopPropagation();
|
|
e.stopPropagation();
|
|
}
|
|
}
|
|
- handleNumClick(e){ //数字框不可编辑的状态时点击事件,点击将数字框变为可输入且下拉不再显示直到失焦后再次聚集
|
|
|
|
|
|
+ handleNumClick(e){ //数字框不可编辑的状态时点击事件,点击将数字框变为可输入且下拉不再显示直到失焦后再次聚集
|
|
const {show,handleShow,ikey,id,patId,handleHide,value} = this.props;
|
|
const {show,handleShow,ikey,id,patId,handleHide,value} = this.props;
|
|
|
|
+ this.$span.current.focus();
|
|
if(show) {
|
|
if(show) {
|
|
handleHide && handleHide();
|
|
handleHide && handleHide();
|
|
return;
|
|
return;
|
|
@@ -175,17 +177,18 @@ class NumberDrop extends Component{
|
|
this.$span.current.style.minWidth=spanWidth;
|
|
this.$span.current.style.minWidth=spanWidth;
|
|
}
|
|
}
|
|
render(){
|
|
render(){
|
|
- const {prefix,suffix,show,value,handleHide} = this.props;
|
|
|
|
|
|
+ const {prefix,suffix,show,value,handleHide,allClick} = this.props;
|
|
const {numEditable,placeholder,editable,hasSelect,boxTop,boxLeft} = this.state;
|
|
const {numEditable,placeholder,editable,hasSelect,boxTop,boxLeft} = this.state;
|
|
return <div className={this.getClasses()}
|
|
return <div className={this.getClasses()}
|
|
ref={this.$cont}
|
|
ref={this.$cont}
|
|
onDoubleClick={this.changeToEdit}
|
|
onDoubleClick={this.changeToEdit}
|
|
|
|
+ onClick={allClick?this.handleNumClick:null}
|
|
contentEditable={editable}
|
|
contentEditable={editable}
|
|
onBlur={this.handleBlur}
|
|
onBlur={this.handleBlur}
|
|
onkeydown={handleEnter}>
|
|
onkeydown={handleEnter}>
|
|
<span ref = {this.$pre}> {prefix}</span>
|
|
<span ref = {this.$pre}> {prefix}</span>
|
|
<span onFocus={this.handleNumFocus}
|
|
<span onFocus={this.handleNumFocus}
|
|
- onClick={this.handleNumClick}
|
|
|
|
|
|
+ onClick={allClick?null:this.handleNumClick}
|
|
contentEditable={true}
|
|
contentEditable={true}
|
|
style={{minWidth:'10px',display:'inline-block'}}
|
|
style={{minWidth:'10px',display:'inline-block'}}
|
|
ref = {this.$span}
|
|
ref = {this.$span}
|