@@ -283,6 +283,10 @@ return /******/ (function(modules) { // webpackBootstrap
283
283
return _this.__handleSelectRow__REACT_HOT_LOADER__.apply(_this, arguments);
284
284
};
285
285
286
+ _this.handleEditCell = function () {
287
+ return _this.__handleEditCell__REACT_HOT_LOADER__.apply(_this, arguments);
288
+ };
289
+
286
290
_this.handleAddRow = function () {
287
291
return _this.__handleAddRow__REACT_HOT_LOADER__.apply(_this, arguments);
288
292
};
@@ -316,7 +320,6 @@ return /******/ (function(modules) { // webpackBootstrap
316
320
};
317
321
318
322
_this.isIE = false;
319
- _this._attachCellEditFunc();
320
323
if (_util2.default.canUseDOM()) {
321
324
_this.isIE = document.documentMode;
322
325
}
@@ -656,23 +659,10 @@ return /******/ (function(modules) { // webpackBootstrap
656
659
key: 'componentDidUpdate',
657
660
value: function componentDidUpdate() {
658
661
this._adjustTable();
659
- this._attachCellEditFunc();
660
662
if (this.props.options.afterTableComplete) {
661
663
this.props.options.afterTableComplete();
662
664
}
663
665
}
664
- }, {
665
- key: '_attachCellEditFunc',
666
- value: function _attachCellEditFunc() {
667
- var cellEdit = this.props.cellEdit;
668
-
669
- if (cellEdit) {
670
- this.props.cellEdit.__onCompleteEdit__ = this.handleEditCell.bind(this);
671
- if (cellEdit.mode !== _Const2.default.CELL_EDIT_NONE) {
672
- this.props.selectRow.clickToSelect = false;
673
- }
674
- }
675
- }
676
666
677
667
/**
678
668
* Returns true if in the current configuration,
@@ -739,6 +729,10 @@ return /******/ (function(modules) { // webpackBootstrap
739
729
740
730
var showPaginationOnTop = paginationPosition !== _Const2.default.PAGINATION_POS_BOTTOM;
741
731
var showPaginationOnBottom = paginationPosition !== _Const2.default.PAGINATION_POS_TOP;
732
+ var selectRow = _extends({}, this.props.selectRow);
733
+ if (this.props.cellEdit && this.props.cellEdit.mode !== _Const2.default.CELL_EDIT_NONE) {
734
+ selectRow.clickToSelect = false;
735
+ }
742
736
743
737
return _react2.default.createElement(
744
738
'div',
@@ -791,12 +785,13 @@ return /******/ (function(modules) { // webpackBootstrap
791
785
expandParentClass: this.props.options.expandParentClass,
792
786
columns: columns,
793
787
trClassName: this.props.trClassName,
788
+ trStyle: this.props.trStyle,
794
789
striped: this.props.striped,
795
790
bordered: this.props.bordered,
796
791
hover: this.props.hover,
797
792
keyField: this.store.getKeyField(),
798
793
condensed: this.props.condensed,
799
- selectRow: this.props. selectRow,
794
+ selectRow: selectRow,
800
795
expandColumnOptions: this.props.expandColumnOptions,
801
796
cellEdit: this.props.cellEdit,
802
797
selectedRowKeys: this.state.selectedRowKeys,
@@ -815,7 +810,8 @@ return /******/ (function(modules) { // webpackBootstrap
815
810
onNavigateCell: this.handleNavigateCell,
816
811
x: this.state.x,
817
812
y: this.state.y,
818
- withoutTabIndex: this.props.withoutTabIndex })
813
+ withoutTabIndex: this.props.withoutTabIndex,
814
+ onEditCell: this.handleEditCell })
819
815
),
820
816
tableFilter,
821
817
showPaginationOnBottom ? pagination : null
@@ -1206,8 +1202,8 @@ return /******/ (function(modules) { // webpackBootstrap
1206
1202
}
1207
1203
}
1208
1204
}, {
1209
- key: 'handleEditCell ',
1210
- value: function handleEditCell (newVal, rowIndex, colIndex) {
1205
+ key: '__handleEditCell__REACT_HOT_LOADER__ ',
1206
+ value: function __handleEditCell__REACT_HOT_LOADER__ (newVal, rowIndex, colIndex) {
1211
1207
var _this6 = this;
1212
1208
1213
1209
var beforeSaveCell = this.props.cellEdit.beforeSaveCell;
@@ -1951,6 +1947,7 @@ return /******/ (function(modules) { // webpackBootstrap
1951
1947
strictSearch: _react.PropTypes.bool,
1952
1948
columnFilter: _react.PropTypes.bool,
1953
1949
trClassName: _react.PropTypes.any,
1950
+ trStyle: _react.PropTypes.any,
1954
1951
tableStyle: _react.PropTypes.object,
1955
1952
containerStyle: _react.PropTypes.object,
1956
1953
headerStyle: _react.PropTypes.object,
@@ -2109,6 +2106,7 @@ return /******/ (function(modules) { // webpackBootstrap
2109
2106
multiColumnSort: 1,
2110
2107
columnFilter: false,
2111
2108
trClassName: '',
2109
+ trStyle: undefined,
2112
2110
tableStyle: undefined,
2113
2111
containerStyle: undefined,
2114
2112
headerStyle: undefined,
@@ -2921,7 +2919,8 @@ return /******/ (function(modules) { // webpackBootstrap
2921
2919
beforeShowError = _props.beforeShowError,
2922
2920
x = _props.x,
2923
2921
y = _props.y,
2924
- keyBoardNav = _props.keyBoardNav;
2922
+ keyBoardNav = _props.keyBoardNav,
2923
+ trStyle = _props.trStyle;
2925
2924
2926
2925
var tableClasses = (0, _classnames2.default)('table', {
2927
2926
'table-striped': this.props.striped,
@@ -3060,7 +3059,8 @@ return /******/ (function(modules) { // webpackBootstrap
3060
3059
onRowMouseOut: this.handleRowMouseOut,
3061
3060
onSelectRow: this.handleSelectRow,
3062
3061
onExpandRow: this.handleClickCell,
3063
- unselectableRow: disable },
3062
+ unselectableRow: disable,
3063
+ style: trStyle },
3064
3064
this.props.expandColumnOptions.expandColumnVisible && this.props.expandColumnOptions.expandColumnBeforeSelectColumn && expandedRowColumn,
3065
3065
selectRowColumn,
3066
3066
this.props.expandColumnOptions.expandColumnVisible && !this.props.expandColumnOptions.expandColumnBeforeSelectColumn && expandedRowColumn,
@@ -3091,7 +3091,7 @@ return /******/ (function(modules) { // webpackBootstrap
3091
3091
}).length + (isSelectRowDefined && !this.props.selectRow.hideSelectColumn ? 1 : 0) + (this.props.expandColumnOptions.expandColumnVisible ? 1 : 0);
3092
3092
tableRows = [_react2.default.createElement(
3093
3093
_TableRow2.default,
3094
- { key: '##table-empty##' },
3094
+ { key: '##table-empty##', style: trStyle },
3095
3095
_react2.default.createElement(
3096
3096
'td',
3097
3097
{ 'data-toggle': 'collapse',
@@ -3333,7 +3333,7 @@ return /******/ (function(modules) { // webpackBootstrap
3333
3333
key: '__handleCompleteEditCell__REACT_HOT_LOADER__',
3334
3334
value: function __handleCompleteEditCell__REACT_HOT_LOADER__(newVal, rowIndex, columnIndex) {
3335
3335
if (newVal !== null) {
3336
- var result = this.props.cellEdit.__onCompleteEdit__ (newVal, rowIndex, columnIndex);
3336
+ var result = this.props.onEditCell (newVal, rowIndex, columnIndex);
3337
3337
if (result !== _Const2.default.AWAIT_BEFORE_CELL_EDIT) {
3338
3338
this.setState(function () {
3339
3339
return { currEditCell: null };
@@ -3773,7 +3773,9 @@ return /******/ (function(modules) { // webpackBootstrap
3773
3773
selectRow = _props2.selectRow,
3774
3774
row = _props2.row,
3775
3775
isSelected = _props2.isSelected,
3776
- className = _props2.className;
3776
+ className = _props2.className,
3777
+ index = _props2.index;
3778
+ var style = this.props.style;
3777
3779
3778
3780
var backgroundColor = null;
3779
3781
var selectRowClass = null;
@@ -3784,8 +3786,17 @@ return /******/ (function(modules) { // webpackBootstrap
3784
3786
selectRowClass = _util2.default.isFunction(selectRow.className) ? selectRow.className(row, isSelected) : isSelected ? selectRow.className : null;
3785
3787
}
3786
3788
3789
+ if (_util2.default.isFunction(style)) {
3790
+ style = style(row, index);
3791
+ } else {
3792
+ style = _extends({}, style) || {};
3793
+ }
3794
+ // the bgcolor of row selection always overwrite the bgcolor defined by global.
3795
+ if (style && backgroundColor && isSelected) {
3796
+ style.backgroundColor = backgroundColor;
3797
+ }
3787
3798
var trCss = {
3788
- style: { backgroundColor: backgroundColor } ,
3799
+ style: _extends({}, style) ,
3789
3800
className: (0, _classnames2.default)(selectRowClass, className)
3790
3801
};
3791
3802
@@ -3807,6 +3818,7 @@ return /******/ (function(modules) { // webpackBootstrap
3807
3818
TableRow.propTypes = {
3808
3819
index: _react.PropTypes.number,
3809
3820
row: _react.PropTypes.any,
3821
+ style: _react.PropTypes.any,
3810
3822
isSelected: _react.PropTypes.bool,
3811
3823
enableCellEdit: _react.PropTypes.bool,
3812
3824
onRowClick: _react.PropTypes.func,
0 commit comments