publish 1.6.25
This commit is contained in:
parent
0c28eb87aa
commit
6f568562f5
|
@ -169,17 +169,24 @@ var Table = function (_Component) {
|
|||
);
|
||||
};
|
||||
|
||||
_this.onFocus = function (e) {
|
||||
_this.props.onKeyTab && _this.props.onKeyTab();
|
||||
};
|
||||
|
||||
_this.onKeyDown = function (e) {
|
||||
var event = _utils.Event.getEvent(e);
|
||||
// event.preventDefault&&event.preventDefault();
|
||||
// event.preventDefault?event.preventDefault():event.returnValue = false;
|
||||
if (event.keyCode === 9) {
|
||||
//tab
|
||||
_this.props.onKeyTab && _this.props.onKeyTab();
|
||||
} else if (event.keyCode === 38) {
|
||||
// if (event.keyCode === 9){//tab
|
||||
// // this.props.onKeyTab&&this.props.onKeyTab();
|
||||
// }else
|
||||
if (event.keyCode === 38) {
|
||||
//up
|
||||
event.preventDefault && event.preventDefault();
|
||||
_this.props.onKeyUp && _this.props.onKeyUp();
|
||||
} else if (event.keyCode === 40) {
|
||||
//down
|
||||
event.preventDefault && event.preventDefault();
|
||||
_this.props.onKeyDown && _this.props.onKeyDown();
|
||||
}
|
||||
_this.props.onTableKeyDown && _this.props.onTableKeyDown();
|
||||
|
@ -242,11 +249,9 @@ var Table = function (_Component) {
|
|||
return _this;
|
||||
}
|
||||
|
||||
Table.prototype.componentWillMount = function componentWillMount() {
|
||||
_utils.EventUtil.addHandler(document, 'keydown', this.onKeyDown);
|
||||
};
|
||||
|
||||
Table.prototype.componentDidMount = function componentDidMount() {
|
||||
_utils.EventUtil.addHandler(this.contentTable, 'keydown', this.onKeyDown);
|
||||
_utils.EventUtil.addHandler(this.contentTable, 'focus', this.onFocus);
|
||||
setTimeout(this.resetScrollY, 300);
|
||||
//含有纵向滚动条
|
||||
if (this.props.scroll.y) {
|
||||
|
@ -311,7 +316,8 @@ var Table = function (_Component) {
|
|||
};
|
||||
|
||||
Table.prototype.componentWillUnmount = function componentWillUnmount() {
|
||||
_utils.EventUtil.removeHandler(document, 'keydown', this.onKeyDown);
|
||||
_utils.EventUtil.removeHandler(this.contentTable, 'keydown', this.onKeyDown);
|
||||
_utils.EventUtil.removeHandler(this.contentTable, 'focus', this.onFocus);
|
||||
if (this.resizeEvent) {
|
||||
this.resizeEvent.remove();
|
||||
}
|
||||
|
@ -1195,7 +1201,8 @@ var Table = function (_Component) {
|
|||
'div',
|
||||
{ className: className, style: props.style, ref: function ref(el) {
|
||||
return _this6.contentTable = el;
|
||||
}, tabIndex: props.tabIndex ? props.tabIndex : '0' },
|
||||
},
|
||||
tabIndex: props.tabIndex ? props.tabIndex : '0' },
|
||||
this.getTitle(),
|
||||
_react2["default"].createElement(
|
||||
'div',
|
||||
|
|
|
@ -85,7 +85,8 @@ class Demo33 extends Component {
|
|||
|
||||
render() {
|
||||
return (
|
||||
<div><input />
|
||||
<div>
|
||||
<input />
|
||||
<Table
|
||||
columns={columns}
|
||||
data={data}
|
||||
|
@ -106,7 +107,9 @@ class Demo33 extends Component {
|
|||
onKeyDown={this.onKeyDown}
|
||||
onTableKeyDown={this.onTableKeyDown}
|
||||
scroll={{ x: "110%", y: 140 }}
|
||||
/> </div>
|
||||
/>
|
||||
<input />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "bee-table",
|
||||
"version": "1.6.24",
|
||||
"version": "1.6.25",
|
||||
"description": "Table ui component for react",
|
||||
"keywords": [
|
||||
"react",
|
||||
|
|
27
src/Table.js
27
src/Table.js
|
@ -137,11 +137,9 @@ class Table extends Component {
|
|||
this.computeTableWidth = this.computeTableWidth.bind(this);
|
||||
}
|
||||
|
||||
componentWillMount() {
|
||||
EventUtil.addHandler(document,'keydown',this.onKeyDown);
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
EventUtil.addHandler(this.contentTable,'keydown',this.onKeyDown);
|
||||
EventUtil.addHandler(this.contentTable,'focus',this.onFocus);
|
||||
setTimeout(this.resetScrollY, 300);
|
||||
//含有纵向滚动条
|
||||
if(this.props.scroll.y){
|
||||
|
@ -212,7 +210,8 @@ class Table extends Component {
|
|||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
EventUtil.removeHandler(document,'keydown',this.onKeyDown);
|
||||
EventUtil.removeHandler(this.contentTable,'keydown',this.onKeyDown);
|
||||
EventUtil.removeHandler(this.contentTable,'focus',this.onFocus);
|
||||
if (this.resizeEvent) {
|
||||
this.resizeEvent.remove();
|
||||
}
|
||||
|
@ -1015,14 +1014,23 @@ class Table extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
onFocus=(e)=>{
|
||||
this.props.onKeyTab&&this.props.onKeyTab();
|
||||
}
|
||||
|
||||
onKeyDown=(e)=>{
|
||||
let event = Event.getEvent(e);
|
||||
// event.preventDefault&&event.preventDefault();
|
||||
// event.preventDefault?event.preventDefault():event.returnValue = false;
|
||||
if (event.keyCode === 9){//tab
|
||||
this.props.onKeyTab&&this.props.onKeyTab();
|
||||
}else if(event.keyCode === 38){//up
|
||||
// if (event.keyCode === 9){//tab
|
||||
// // this.props.onKeyTab&&this.props.onKeyTab();
|
||||
// }else
|
||||
if(event.keyCode === 38){//up
|
||||
event.preventDefault&&event.preventDefault();
|
||||
this.props.onKeyUp&&this.props.onKeyUp();
|
||||
}else if(event.keyCode === 40){//down
|
||||
event.preventDefault&&event.preventDefault();
|
||||
this.props.onKeyDown&&this.props.onKeyDown();
|
||||
}
|
||||
this.props.onTableKeyDown&&this.props.onTableKeyDown();
|
||||
|
@ -1063,7 +1071,8 @@ class Table extends Component {
|
|||
}
|
||||
|
||||
return (
|
||||
<div className={className} style={props.style} ref={el => this.contentTable = el} tabIndex={props.tabIndex?props.tabIndex:'0'} >
|
||||
<div className={className} style={props.style} ref={el => this.contentTable = el}
|
||||
tabIndex={props.tabIndex?props.tabIndex:'0'} >
|
||||
{this.getTitle()}
|
||||
<div className={`${clsPrefix}-content`}>
|
||||
|
||||
|
|
Loading…
Reference in New Issue