fix(增加快捷键):
This commit is contained in:
parent
b5a54dc5f9
commit
834749e301
|
@ -448,6 +448,10 @@
|
|||
display: none;
|
||||
pointer-events: none; }
|
||||
|
||||
.u-table:focus {
|
||||
outline: none;
|
||||
box-shadow: 0 0 0; }
|
||||
|
||||
.u-table.bordered table {
|
||||
border-collapse: collapse; }
|
||||
|
||||
|
|
|
@ -168,6 +168,27 @@ var Table = function (_Component) {
|
|||
);
|
||||
};
|
||||
|
||||
_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) {
|
||||
//up
|
||||
_this.props.onKeyUp && _this.props.onKeyUp();
|
||||
} else if (event.keyCode === 40) {
|
||||
//down
|
||||
_this.props.onKeyDown && _this.props.onKeyDown();
|
||||
}
|
||||
_this.props.onTabkeKeyDown && _this.props.onTabkeKeyDown();
|
||||
// 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 rows = [].concat(_toConsumableArray(props.data));
|
||||
_this.columnManager = new _ColumnManager2["default"](props.columns, props.children, props.originWidth);
|
||||
|
@ -220,6 +241,14 @@ var Table = function (_Component) {
|
|||
return _this;
|
||||
}
|
||||
|
||||
Table.prototype.componentWillMount = function componentWillMount() {
|
||||
_utils.EventUtil.addHandler(document, 'keydown', this.onKeyDown);
|
||||
};
|
||||
|
||||
Table.prototype.componentWillUnmount = function componentWillUnmount() {
|
||||
_utils.EventUtil.removeHandler(document, 'keydown', this.onKeyDown);
|
||||
};
|
||||
|
||||
Table.prototype.componentDidMount = function componentDidMount() {
|
||||
setTimeout(this.resetScrollY, 300);
|
||||
//含有纵向滚动条
|
||||
|
@ -1141,7 +1170,7 @@ var Table = function (_Component) {
|
|||
'div',
|
||||
{ className: className, style: props.style, ref: function ref(el) {
|
||||
return _this6.contentTable = el;
|
||||
} },
|
||||
}, tabIndex: '0' },
|
||||
this.getTitle(),
|
||||
_react2["default"].createElement(
|
||||
'div',
|
||||
|
|
Loading…
Reference in New Issue