Completely updated React, fixed #11, (hopefully)
This commit is contained in:
70
goTorrentWebUI/node_modules/react-bootstrap-table/lib/TableBody.js
generated
vendored
70
goTorrentWebUI/node_modules/react-bootstrap-table/lib/TableBody.js
generated
vendored
@@ -197,6 +197,8 @@ var TableBody = function (_Component) {
|
||||
}, {
|
||||
key: 'render',
|
||||
value: function render() {
|
||||
var _this2 = this;
|
||||
|
||||
var _props = this.props,
|
||||
cellEdit = _props.cellEdit,
|
||||
beforeShowError = _props.beforeShowError,
|
||||
@@ -337,14 +339,15 @@ var TableBody = function (_Component) {
|
||||
var expandedRowColumn = this.renderExpandRowColumn(this.props.expandableRow && this.props.expandableRow(data), this.props.expanding.indexOf(key) > -1, ExpandColumnCustomComponent, r);
|
||||
var haveExpandContent = this.props.expandableRow && this.props.expandableRow(data);
|
||||
var isExpanding = haveExpandContent && this.props.expanding.indexOf(key) > -1;
|
||||
|
||||
var hideRowOnExpand = this.props.hideRowOnExpand;
|
||||
// add by bluespring for className customize
|
||||
|
||||
var trClassName = this.props.trClassName;
|
||||
if (_util2.default.isFunction(this.props.trClassName)) {
|
||||
trClassName = this.props.trClassName(data, r);
|
||||
}
|
||||
if (isExpanding && this.props.expandParentClass) {
|
||||
trClassName += _util2.default.isFunction(this.props.expandParentClass) ? this.props.expandParentClass(data, r) : this.props.expandParentClass;
|
||||
trClassName += _util2.default.isFunction(this.props.expandParentClass) ? ' ' + this.props.expandParentClass(data, r) : ' ' + this.props.expandParentClass;
|
||||
}
|
||||
var result = [_react2.default.createElement(
|
||||
_TableRow2.default,
|
||||
@@ -361,6 +364,7 @@ var TableBody = function (_Component) {
|
||||
onExpandRow: this.handleClickCell,
|
||||
unselectableRow: disable,
|
||||
style: trStyle,
|
||||
hidden: isExpanding && hideRowOnExpand,
|
||||
dbClickToEdit: cellEdit.mode === _Const2.default.CELL_EDIT_DBCLICK },
|
||||
this.props.expandColumnOptions.expandColumnVisible && this.props.expandColumnOptions.expandColumnBeforeSelectColumn && expandedRowColumn,
|
||||
selectRowColumn,
|
||||
@@ -405,16 +409,23 @@ var TableBody = function (_Component) {
|
||||
|
||||
return _react2.default.createElement(
|
||||
'div',
|
||||
{ ref: 'container',
|
||||
{
|
||||
ref: function ref(node) {
|
||||
return _this2.container = node;
|
||||
},
|
||||
className: (0, _classnames2.default)('react-bs-container-body', this.props.bodyContainerClass),
|
||||
style: this.props.style },
|
||||
_react2.default.createElement(
|
||||
'table',
|
||||
{ className: tableClasses },
|
||||
_react2.default.cloneElement(tableHeader, { ref: 'header' }),
|
||||
_react2.default.cloneElement(tableHeader, { ref: function ref(node) {
|
||||
return _this2.header = node;
|
||||
} }),
|
||||
_react2.default.createElement(
|
||||
'tbody',
|
||||
{ ref: 'tbody' },
|
||||
{ ref: function ref(node) {
|
||||
return _this2.tbody = node;
|
||||
} },
|
||||
tableRows
|
||||
)
|
||||
)
|
||||
@@ -427,7 +438,8 @@ var TableBody = function (_Component) {
|
||||
var _props2 = this.props,
|
||||
keyBoardNav = _props2.keyBoardNav,
|
||||
onNavigateCell = _props2.onNavigateCell,
|
||||
cellEdit = _props2.cellEdit;
|
||||
cellEdit = _props2.cellEdit,
|
||||
selectedRowKeys = _props2.selectedRowKeys;
|
||||
|
||||
var offset = void 0;
|
||||
if (e.keyCode === 37) {
|
||||
@@ -444,15 +456,22 @@ var TableBody = function (_Component) {
|
||||
} else if (e.keyCode === 40) {
|
||||
offset = { x: 0, y: 1 };
|
||||
} else if (e.keyCode === 13) {
|
||||
var rowIndex = e.target.parentElement.rowIndex + 1;
|
||||
var enterToEdit = (typeof keyBoardNav === 'undefined' ? 'undefined' : _typeof(keyBoardNav)) === 'object' ? keyBoardNav.enterToEdit : false;
|
||||
var enterToExpand = (typeof keyBoardNav === 'undefined' ? 'undefined' : _typeof(keyBoardNav)) === 'object' ? keyBoardNav.enterToExpand : false;
|
||||
var enterToSelect = (typeof keyBoardNav === 'undefined' ? 'undefined' : _typeof(keyBoardNav)) === 'object' ? keyBoardNav.enterToSelect : false;
|
||||
|
||||
if (cellEdit && enterToEdit) {
|
||||
this.handleEditCell(e.target.parentElement.rowIndex + 1, e.currentTarget.cellIndex, '', e);
|
||||
this.handleEditCell(rowIndex, e.currentTarget.cellIndex, '', e);
|
||||
}
|
||||
|
||||
if (enterToExpand) {
|
||||
this.handleClickCell(this.props.y + 1, this.props.x);
|
||||
this.handleClickCell(e, this.props.y + 1, this.props.x);
|
||||
}
|
||||
|
||||
if (enterToSelect) {
|
||||
var isSelected = selectedRowKeys.indexOf(this.props.data[rowIndex - 1][this.props.keyField]) !== -1;
|
||||
this.handleSelectRow(rowIndex, !isSelected, e);
|
||||
}
|
||||
}
|
||||
if (offset && keyBoardNav) {
|
||||
@@ -473,22 +492,22 @@ var TableBody = function (_Component) {
|
||||
}
|
||||
}, {
|
||||
key: '__handleRowClick__REACT_HOT_LOADER__',
|
||||
value: function __handleRowClick__REACT_HOT_LOADER__(rowIndex, cellIndex) {
|
||||
value: function __handleRowClick__REACT_HOT_LOADER__(rowIndex, cellIndex, event) {
|
||||
var _props3 = this.props,
|
||||
onRowClick = _props3.onRowClick,
|
||||
selectRow = _props3.selectRow;
|
||||
|
||||
if (_util2.default.isSelectRowDefined(selectRow.mode)) cellIndex--;
|
||||
if (this._isExpandColumnVisible()) cellIndex--;
|
||||
onRowClick(this.props.data[rowIndex - 1], rowIndex - 1, cellIndex);
|
||||
onRowClick(this.props.data[rowIndex - 1], rowIndex - 1, cellIndex, event);
|
||||
}
|
||||
}, {
|
||||
key: '__handleRowDoubleClick__REACT_HOT_LOADER__',
|
||||
value: function __handleRowDoubleClick__REACT_HOT_LOADER__(rowIndex) {
|
||||
value: function __handleRowDoubleClick__REACT_HOT_LOADER__(rowIndex, event) {
|
||||
var onRowDoubleClick = this.props.onRowDoubleClick;
|
||||
|
||||
var targetRow = this.props.data[rowIndex];
|
||||
onRowDoubleClick(targetRow);
|
||||
onRowDoubleClick(targetRow, event);
|
||||
}
|
||||
}, {
|
||||
key: '__handleSelectRow__REACT_HOT_LOADER__',
|
||||
@@ -515,8 +534,8 @@ var TableBody = function (_Component) {
|
||||
}
|
||||
}, {
|
||||
key: '__handleClickCell__REACT_HOT_LOADER__',
|
||||
value: function __handleClickCell__REACT_HOT_LOADER__(rowIndex) {
|
||||
var columnIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -1;
|
||||
value: function __handleClickCell__REACT_HOT_LOADER__(event, rowIndex) {
|
||||
var columnIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : -1;
|
||||
var _props5 = this.props,
|
||||
columns = _props5.columns,
|
||||
keyField = _props5.keyField,
|
||||
@@ -549,7 +568,7 @@ var TableBody = function (_Component) {
|
||||
// expand
|
||||
if (onlyOneExpanding) expanding = [rowKey];else expanding.push(rowKey);
|
||||
}
|
||||
this.props.onExpand(expanding, rowKey, isRowExpanding);
|
||||
this.props.onExpand(expanding, rowKey, isRowExpanding, event);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
@@ -661,7 +680,7 @@ var TableBody = function (_Component) {
|
||||
var unselectable = this.props.selectRow.unselectable || [];
|
||||
if (unselectable.indexOf(row[this.props.keyField]) === -1) {
|
||||
this.handleSelectRow(rowIndex + 1, isSelect, e);
|
||||
this.handleClickCell(rowIndex + 1);
|
||||
this.handleClickCell(e, rowIndex + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -670,7 +689,7 @@ var TableBody = function (_Component) {
|
||||
value: function renderSelectRowColumn(selected, inputType, disabled) {
|
||||
var CustomComponent = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
||||
|
||||
var _this2 = this;
|
||||
var _this3 = this;
|
||||
|
||||
var rowIndex = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
|
||||
var row = arguments[5];
|
||||
@@ -678,22 +697,22 @@ var TableBody = function (_Component) {
|
||||
return _react2.default.createElement(
|
||||
'td',
|
||||
{ onClick: function onClick(e) {
|
||||
_this2.handleClickonSelectColumn(e, !selected, rowIndex, row);
|
||||
_this3.handleClickonSelectColumn(e, !selected, rowIndex, row);
|
||||
}, style: { textAlign: 'center' } },
|
||||
CustomComponent ? _react2.default.createElement(CustomComponent, { type: inputType, checked: selected, disabled: disabled,
|
||||
rowIndex: rowIndex,
|
||||
onChange: function onChange(e) {
|
||||
return _this2.handleSelectRowColumChange(e, rowIndex);
|
||||
return _this3.handleSelectRowColumChange(e, rowIndex);
|
||||
} }) : _react2.default.createElement('input', { type: inputType, checked: selected, disabled: disabled,
|
||||
onChange: function onChange(e) {
|
||||
return _this2.handleSelectRowColumChange(e, rowIndex);
|
||||
return _this3.handleSelectRowColumChange(e, rowIndex);
|
||||
} })
|
||||
);
|
||||
}
|
||||
}, {
|
||||
key: 'renderExpandRowColumn',
|
||||
value: function renderExpandRowColumn(isExpandableRow, isExpanded, CustomComponent) {
|
||||
var _this3 = this;
|
||||
var _this4 = this;
|
||||
|
||||
var rowIndex = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
||||
|
||||
@@ -710,8 +729,8 @@ var TableBody = function (_Component) {
|
||||
'td',
|
||||
{
|
||||
className: 'react-bs-table-expand-cell',
|
||||
onClick: function onClick() {
|
||||
return _this3.handleClickCell(rowIndex + 1);
|
||||
onClick: function onClick(e) {
|
||||
return _this4.handleClickCell(e, rowIndex + 1);
|
||||
} },
|
||||
content
|
||||
);
|
||||
@@ -724,7 +743,7 @@ var TableBody = function (_Component) {
|
||||
}, {
|
||||
key: '__getHeaderColGrouop__REACT_HOT_LOADER__',
|
||||
value: function __getHeaderColGrouop__REACT_HOT_LOADER__() {
|
||||
return this.refs.header.childNodes;
|
||||
return this.header.childNodes;
|
||||
}
|
||||
}]);
|
||||
|
||||
@@ -763,7 +782,8 @@ TableBody.propTypes = {
|
||||
x: _propTypes2.default.number,
|
||||
y: _propTypes2.default.number,
|
||||
onNavigateCell: _propTypes2.default.func,
|
||||
withoutTabIndex: _propTypes2.default.bool
|
||||
withoutTabIndex: _propTypes2.default.bool,
|
||||
hideRowOnExpand: _propTypes2.default.bool
|
||||
};
|
||||
var _default = TableBody;
|
||||
exports.default = _default;
|
||||
|
Reference in New Issue
Block a user