merge
This commit is contained in:
commit
ddb0313826
|
@ -171,25 +171,23 @@ 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.returnValue = false;
|
||||
if (event.keyCode === 9) {
|
||||
//tab
|
||||
_this.props.onKeyTab && _this.props.onKeyTab();
|
||||
} else if (event.keyCode === 38) {
|
||||
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();
|
||||
// else if(event.altKey && event.keyCode === 38){
|
||||
// this.props.onKeyMove&&this.props.onKeyMove('up');
|
||||
// }else if(event.altKey && event.keyCode === 40){
|
||||
// this.props.onKeyMove&&this.props.onKeyMove('down');
|
||||
// }
|
||||
};
|
||||
|
||||
var expandedRowKeys = [];
|
||||
|
@ -244,11 +242,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) {
|
||||
|
@ -296,7 +292,11 @@ var Table = function (_Component) {
|
|||
this.firstDid = true; //避免重复update
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
// console.log('this.scrollTop**********',this.scrollTop);
|
||||
=======
|
||||
console.log('this.scrollTop**********', this.scrollTop);
|
||||
>>>>>>> d5f55ca081b922fb7a34cb4bddf74a797256d50b
|
||||
};
|
||||
|
||||
Table.prototype.componentDidUpdate = function componentDidUpdate() {
|
||||
|
@ -317,7 +317,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();
|
||||
}
|
||||
|
@ -1230,7 +1231,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',
|
||||
|
|
|
@ -115,9 +115,14 @@ function bigData(Table) {
|
|||
var data = this.props.data;
|
||||
|
||||
var rs = false;
|
||||
<<<<<<< HEAD
|
||||
var len = data.length > 30 ? 30 : data.length;
|
||||
//取前三十个看看是否有children属性,有则为树形结构
|
||||
for (var i = 0; i < len; i++) {
|
||||
=======
|
||||
//取前三十个看看是否有children属性,有则为树形结构
|
||||
for (var i = 0; i < 30; i++) {
|
||||
>>>>>>> d5f55ca081b922fb7a34cb4bddf74a797256d50b
|
||||
if (data[i].children) {
|
||||
rs = true;
|
||||
break;
|
||||
|
@ -254,7 +259,11 @@ function bigData(Table) {
|
|||
lazyLoad.preHeight = this.getSumHeight(0, startIndex);
|
||||
lazyLoad.sufHeight = this.getSumHeight(endIndex, data.length);
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
// console.log('*******ScrollTop*****'+scrollTop);
|
||||
=======
|
||||
console.log('*******ScrollTop*****' + scrollTop);
|
||||
>>>>>>> d5f55ca081b922fb7a34cb4bddf74a797256d50b
|
||||
return _react2["default"].createElement(Table, _extends({}, this.props, {
|
||||
data: data.slice(startIndex, endIndex),
|
||||
lazyLoad: lazyLoad,
|
||||
|
|
|
@ -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.26",
|
||||
"description": "Table ui component for react",
|
||||
"keywords": [
|
||||
"react",
|
||||
|
|
30
src/Table.js
30
src/Table.js
|
@ -139,11 +139,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){
|
||||
|
@ -218,7 +216,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();
|
||||
}
|
||||
|
@ -1043,22 +1042,22 @@ class Table extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
onFocus=(e)=>{
|
||||
this.props.onKeyTab&&this.props.onKeyTab();
|
||||
}
|
||||
|
||||
onKeyDown=(e)=>{
|
||||
let event = Event.getEvent(e);
|
||||
let event = Event.getEvent(e);
|
||||
// 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 === 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();
|
||||
// else if(event.altKey && event.keyCode === 38){
|
||||
// this.props.onKeyMove&&this.props.onKeyMove('up');
|
||||
// }else if(event.altKey && event.keyCode === 40){
|
||||
// this.props.onKeyMove&&this.props.onKeyMove('down');
|
||||
// }
|
||||
}
|
||||
|
||||
render() {
|
||||
|
@ -1091,7 +1090,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