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