@@ -1556,34 +1556,32 @@ return /******/ (function(modules) { // webpackBootstrap
1556
1556
1557
1557
var scrollBarWidth = isScroll ? _util2.default.getScrollBarWidth() : 0;
1558
1558
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;
1587
1585
}
1588
1586
}
1589
1587
} else {
@@ -1673,7 +1671,7 @@ return /******/ (function(modules) { // webpackBootstrap
1673
1671
selectRow: _react.PropTypes.shape({
1674
1672
mode: _react.PropTypes.oneOf([_Const2.default.ROW_SELECT_NONE, _Const2.default.ROW_SELECT_SINGLE, _Const2.default.ROW_SELECT_MULTI]),
1675
1673
customComponent: _react.PropTypes.func,
1676
- bgColor: _react.PropTypes.string,
1674
+ bgColor: _react.PropTypes.oneOfType([_react.PropTypes. string, _react.PropTypes.func]) ,
1677
1675
selected: _react.PropTypes.array,
1678
1676
onSelect: _react.PropTypes.func,
1679
1677
onSelectAll: _react.PropTypes.func,
@@ -2546,6 +2544,10 @@ return /******/ (function(modules) { // webpackBootstrap
2546
2544
return _this.__handleEditCell__REACT_HOT_LOADER__.apply(_this, arguments);
2547
2545
};
2548
2546
2547
+ _this.nextEditableCell = function () {
2548
+ return _this.__nextEditableCell__REACT_HOT_LOADER__.apply(_this, arguments);
2549
+ };
2550
+
2549
2551
_this.handleCompleteEditCell = function () {
2550
2552
return _this.__handleCompleteEditCell__REACT_HOT_LOADER__.apply(_this, arguments);
2551
2553
};
@@ -2693,6 +2695,7 @@ return /******/ (function(modules) { // webpackBootstrap
2693
2695
_TableRow2.default,
2694
2696
{ isSelected: selected, key: key, className: trClassName,
2695
2697
index: r,
2698
+ row: data,
2696
2699
selectRow: isSelectRowDefined ? this.props.selectRow : undefined,
2697
2700
enableCellEdit: cellEdit.mode !== _Const2.default.CELL_EDIT_NONE,
2698
2701
onRowClick: this.handleRowClick,
@@ -2896,12 +2899,17 @@ return /******/ (function(modules) { // webpackBootstrap
2896
2899
if (expandColumnVisible) columnIndex++;
2897
2900
this.handleCompleteEditCell(e.target.value, rowIndex, columnIndex - 1);
2898
2901
if (columnIndex >= this.props.columns.length) {
2899
- rowIndex = rowIndex + 1;
2900
- columnIndex = 1;
2901
2902
this.handleCellKeyDown(e, true);
2902
2903
} else {
2903
2904
this.handleCellKeyDown(e);
2904
2905
}
2906
+
2907
+ var _nextEditableCell = this.nextEditableCell(rowIndex, columnIndex),
2908
+ nextRIndex = _nextEditableCell.nextRIndex,
2909
+ nextCIndex = _nextEditableCell.nextCIndex;
2910
+
2911
+ rowIndex = nextRIndex;
2912
+ columnIndex = nextCIndex;
2905
2913
}
2906
2914
2907
2915
var stateObj = {
@@ -2917,6 +2925,33 @@ return /******/ (function(modules) { // webpackBootstrap
2917
2925
}
2918
2926
this.setState(stateObj);
2919
2927
}
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
+ }
2920
2955
}, {
2921
2956
key: '__handleCompleteEditCell__REACT_HOT_LOADER__',
2922
2957
value: function __handleCompleteEditCell__REACT_HOT_LOADER__(newVal, rowIndex, columnIndex) {
@@ -3207,7 +3242,8 @@ return /******/ (function(modules) { // webpackBootstrap
3207
3242
3208
3243
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; }
3209
3244
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
+
3211
3247
3212
3248
var TableRow = function (_Component) {
3213
3249
_inherits(TableRow, _Component);
@@ -3319,11 +3355,20 @@ return /******/ (function(modules) { // webpackBootstrap
3319
3355
key: 'render',
3320
3356
value: function render() {
3321
3357
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
+
3322
3369
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)
3327
3372
};
3328
3373
3329
3374
return _react2.default.createElement(
@@ -3343,6 +3388,7 @@ return /******/ (function(modules) { // webpackBootstrap
3343
3388
3344
3389
TableRow.propTypes = {
3345
3390
index: _react.PropTypes.number,
3391
+ row: _react.PropTypes.any,
3346
3392
isSelected: _react.PropTypes.bool,
3347
3393
enableCellEdit: _react.PropTypes.bool,
3348
3394
onRowClick: _react.PropTypes.func,
0 commit comments