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