@@ -1556,34 +1556,32 @@ return /******/ (function(modules) { // webpackBootstrap
15561556
15571557 var scrollBarWidth = isScroll ? _util2.default.getScrollBarWidth() : 0;
15581558 if (firstRow && this.store.getDataNum()) {
1559- if (isScroll) {
1560- var cells = firstRow.childNodes;
1561- for (var i = 0; i < cells.length; i++) {
1562- var cell = cells[i];
1563- var computedStyle = window.getComputedStyle(cell);
1564- var width = parseFloat(computedStyle.width.replace('px', ''));
1565- if (this.isIE) {
1566- var paddingLeftWidth = parseFloat(computedStyle.paddingLeft.replace('px', ''));
1567- var paddingRightWidth = parseFloat(computedStyle.paddingRight.replace('px', ''));
1568- var borderRightWidth = parseFloat(computedStyle.borderRightWidth.replace('px', ''));
1569- var borderLeftWidth = parseFloat(computedStyle.borderLeftWidth.replace('px', ''));
1570- width = width + paddingLeftWidth + paddingRightWidth + borderRightWidth + borderLeftWidth;
1571- }
1572- var lastPadding = cells.length - 1 === i ? scrollBarWidth : 0;
1573- if (width <= 0) {
1574- width = 120;
1575- cell.width = width + lastPadding + 'px';
1576- }
1577- var result = width + lastPadding + 'px';
1578- header[i].style.width = result;
1579- header[i].style.minWidth = result;
1580- if (cells.length - 1 === i) {
1581- bodyHeader[i].style.width = width + 'px';
1582- bodyHeader[i].style.minWidth = width + 'px';
1583- } else {
1584- bodyHeader[i].style.width = result;
1585- bodyHeader[i].style.minWidth = result;
1586- }
1559+ var cells = firstRow.childNodes;
1560+ for (var i = 0; i < cells.length; i++) {
1561+ var cell = cells[i];
1562+ var computedStyle = window.getComputedStyle(cell);
1563+ var width = parseFloat(computedStyle.width.replace('px', ''));
1564+ if (this.isIE) {
1565+ var paddingLeftWidth = parseFloat(computedStyle.paddingLeft.replace('px', ''));
1566+ var paddingRightWidth = parseFloat(computedStyle.paddingRight.replace('px', ''));
1567+ var borderRightWidth = parseFloat(computedStyle.borderRightWidth.replace('px', ''));
1568+ var borderLeftWidth = parseFloat(computedStyle.borderLeftWidth.replace('px', ''));
1569+ width = width + paddingLeftWidth + paddingRightWidth + borderRightWidth + borderLeftWidth;
1570+ }
1571+ var lastPadding = cells.length - 1 === i ? scrollBarWidth : 0;
1572+ if (width <= 0) {
1573+ width = 120;
1574+ cell.width = width + lastPadding + 'px';
1575+ }
1576+ var result = width + lastPadding + 'px';
1577+ header[i].style.width = result;
1578+ header[i].style.minWidth = result;
1579+ if (cells.length - 1 === i) {
1580+ bodyHeader[i].style.width = width + 'px';
1581+ bodyHeader[i].style.minWidth = width + 'px';
1582+ } else {
1583+ bodyHeader[i].style.width = result;
1584+ bodyHeader[i].style.minWidth = result;
15871585 }
15881586 }
15891587 } else {
@@ -1673,7 +1671,7 @@ return /******/ (function(modules) { // webpackBootstrap
16731671 selectRow: _react.PropTypes.shape({
16741672 mode: _react.PropTypes.oneOf([_Const2.default.ROW_SELECT_NONE, _Const2.default.ROW_SELECT_SINGLE, _Const2.default.ROW_SELECT_MULTI]),
16751673 customComponent: _react.PropTypes.func,
1676- bgColor: _react.PropTypes.string,
1674+ bgColor: _react.PropTypes.oneOfType([_react.PropTypes. string, _react.PropTypes.func]) ,
16771675 selected: _react.PropTypes.array,
16781676 onSelect: _react.PropTypes.func,
16791677 onSelectAll: _react.PropTypes.func,
@@ -2546,6 +2544,10 @@ return /******/ (function(modules) { // webpackBootstrap
25462544 return _this.__handleEditCell__REACT_HOT_LOADER__.apply(_this, arguments);
25472545 };
25482546
2547+ _this.nextEditableCell = function () {
2548+ return _this.__nextEditableCell__REACT_HOT_LOADER__.apply(_this, arguments);
2549+ };
2550+
25492551 _this.handleCompleteEditCell = function () {
25502552 return _this.__handleCompleteEditCell__REACT_HOT_LOADER__.apply(_this, arguments);
25512553 };
@@ -2693,6 +2695,7 @@ return /******/ (function(modules) { // webpackBootstrap
26932695 _TableRow2.default,
26942696 { isSelected: selected, key: key, className: trClassName,
26952697 index: r,
2698+ row: data,
26962699 selectRow: isSelectRowDefined ? this.props.selectRow : undefined,
26972700 enableCellEdit: cellEdit.mode !== _Const2.default.CELL_EDIT_NONE,
26982701 onRowClick: this.handleRowClick,
@@ -2896,12 +2899,17 @@ return /******/ (function(modules) { // webpackBootstrap
28962899 if (expandColumnVisible) columnIndex++;
28972900 this.handleCompleteEditCell(e.target.value, rowIndex, columnIndex - 1);
28982901 if (columnIndex >= this.props.columns.length) {
2899- rowIndex = rowIndex + 1;
2900- columnIndex = 1;
29012902 this.handleCellKeyDown(e, true);
29022903 } else {
29032904 this.handleCellKeyDown(e);
29042905 }
2906+
2907+ var _nextEditableCell = this.nextEditableCell(rowIndex, columnIndex),
2908+ nextRIndex = _nextEditableCell.nextRIndex,
2909+ nextCIndex = _nextEditableCell.nextCIndex;
2910+
2911+ rowIndex = nextRIndex;
2912+ columnIndex = nextCIndex;
29052913 }
29062914
29072915 var stateObj = {
@@ -2917,6 +2925,33 @@ return /******/ (function(modules) { // webpackBootstrap
29172925 }
29182926 this.setState(stateObj);
29192927 }
2928+ }, {
2929+ key: '__nextEditableCell__REACT_HOT_LOADER__',
2930+ value: function __nextEditableCell__REACT_HOT_LOADER__(rIndex, cIndex) {
2931+ var keyField = this.props.keyField;
2932+
2933+ var nextRIndex = rIndex;
2934+ var nextCIndex = cIndex;
2935+ var row = void 0;
2936+ var column = void 0;
2937+ do {
2938+ if (nextCIndex >= this.props.columns.length) {
2939+ nextRIndex++;
2940+ nextCIndex = 0;
2941+ }
2942+ row = this.props.data[nextRIndex];
2943+ column = this.props.columns[nextCIndex];
2944+ if (!row) break;
2945+ var editable = column.editable;
2946+ if (isFun(column.editable)) {
2947+ editable = column.editable(column, row, nextRIndex, nextCIndex);
2948+ }
2949+ if (editable && !column.hidden && keyField !== column.name) break;else {
2950+ nextCIndex++;
2951+ }
2952+ } while (row);
2953+ return { nextRIndex: nextRIndex, nextCIndex: nextCIndex };
2954+ }
29202955 }, {
29212956 key: '__handleCompleteEditCell__REACT_HOT_LOADER__',
29222957 value: function __handleCompleteEditCell__REACT_HOT_LOADER__(newVal, rowIndex, columnIndex) {
@@ -3207,7 +3242,8 @@ return /******/ (function(modules) { // webpackBootstrap
32073242
32083243 function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
32093244
3210- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
3245+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /* eslint no-nested-ternary: 0 */
3246+
32113247
32123248 var TableRow = function (_Component) {
32133249 _inherits(TableRow, _Component);
@@ -3319,11 +3355,20 @@ return /******/ (function(modules) { // webpackBootstrap
33193355 key: 'render',
33203356 value: function render() {
33213357 this.clickNum = 0;
3358+ var _props2 = this.props,
3359+ selectRow = _props2.selectRow,
3360+ row = _props2.row,
3361+ isSelected = _props2.isSelected;
3362+
3363+ var backgroundColor = null;
3364+
3365+ if (selectRow) {
3366+ backgroundColor = typeof selectRow.bgColor === 'function' ? selectRow.bgColor(row, isSelected) : isSelected ? selectRow.bgColor : null;
3367+ }
3368+
33223369 var trCss = {
3323- style: {
3324- backgroundColor: this.props.isSelected ? this.props.selectRow.bgColor : null
3325- },
3326- className: (0, _classnames2.default)(this.props.isSelected ? this.props.selectRow.className : null, this.props.className)
3370+ style: { backgroundColor: backgroundColor },
3371+ className: (0, _classnames2.default)(isSelected ? selectRow.className : null, this.props.className)
33273372 };
33283373
33293374 return _react2.default.createElement(
@@ -3343,6 +3388,7 @@ return /******/ (function(modules) { // webpackBootstrap
33433388
33443389 TableRow.propTypes = {
33453390 index: _react.PropTypes.number,
3391+ row: _react.PropTypes.any,
33463392 isSelected: _react.PropTypes.bool,
33473393 enableCellEdit: _react.PropTypes.bool,
33483394 onRowClick: _react.PropTypes.func,
0 commit comments