react-bootstrap-table-next
Advanced tools
Comparing version 3.1.1 to 3.1.2
@@ -230,3 +230,4 @@ 'use strict'; | ||
selectionRenderer: _propTypes2.default.func, | ||
selectionHeaderRenderer: _propTypes2.default.func | ||
selectionHeaderRenderer: _propTypes2.default.func, | ||
headerColumnStyle: _propTypes2.default.oneOfType([_propTypes2.default.object, _propTypes2.default.func]) | ||
}), | ||
@@ -233,0 +234,0 @@ expandRow: _propTypes2.default.shape({ |
@@ -46,3 +46,21 @@ 'use strict'; | ||
_this.handleEditingCell = _this.handleEditingCell.bind(_this); | ||
_this.createHandleEditingCell = function (originFunc) { | ||
return function (e) { | ||
var _this$props = _this.props, | ||
onStart = _this$props.onStart, | ||
rowIndex = _this$props.rowIndex, | ||
columnIndex = _this$props.columnIndex, | ||
clickToEdit = _this$props.clickToEdit, | ||
dbclickToEdit = _this$props.dbclickToEdit; | ||
if ((clickToEdit || dbclickToEdit) && _utils2.default.isFunction(originFunc)) { | ||
originFunc(e); | ||
} | ||
if (onStart) { | ||
onStart(rowIndex, columnIndex); | ||
} | ||
}; | ||
}; | ||
_this.createHandleEditingCell = _this.createHandleEditingCell.bind(_this); | ||
return _this; | ||
@@ -69,40 +87,15 @@ } | ||
}, { | ||
key: 'handleEditingCell', | ||
value: function handleEditingCell(e) { | ||
key: 'render', | ||
value: function render() { | ||
var _props = this.props, | ||
row = _props.row, | ||
rowIndex = _props.rowIndex, | ||
column = _props.column, | ||
columnIndex = _props.columnIndex, | ||
onStart = _props.onStart, | ||
rowIndex = _props.rowIndex, | ||
columnIndex = _props.columnIndex, | ||
editable = _props.editable, | ||
clickToEdit = _props.clickToEdit, | ||
dbclickToEdit = _props.dbclickToEdit; | ||
var events = column.events; | ||
dbclickToEdit = _props.dbclickToEdit, | ||
rest = _objectWithoutProperties(_props, ['row', 'rowIndex', 'column', 'columnIndex', 'onStart', 'editable', 'clickToEdit', 'dbclickToEdit']); | ||
if (events) { | ||
if (clickToEdit) { | ||
var customClick = events.onClick; | ||
if (_utils2.default.isFunction(customClick)) customClick(e); | ||
} else if (dbclickToEdit) { | ||
var customDbClick = events.onDoubleClick; | ||
if (_utils2.default.isFunction(customDbClick)) customDbClick(e); | ||
} | ||
} | ||
if (onStart) { | ||
onStart(rowIndex, columnIndex); | ||
} | ||
} | ||
}, { | ||
key: 'render', | ||
value: function render() { | ||
var _props2 = this.props, | ||
row = _props2.row, | ||
rowIndex = _props2.rowIndex, | ||
column = _props2.column, | ||
columnIndex = _props2.columnIndex, | ||
onStart = _props2.onStart, | ||
editable = _props2.editable, | ||
clickToEdit = _props2.clickToEdit, | ||
dbclickToEdit = _props2.dbclickToEdit, | ||
rest = _objectWithoutProperties(_props2, ['row', 'rowIndex', 'column', 'columnIndex', 'onStart', 'editable', 'clickToEdit', 'dbclickToEdit']); | ||
var dataField = column.dataField, | ||
@@ -120,5 +113,5 @@ formatter = column.formatter, | ||
if (clickToEdit && editable) { | ||
attrs.onClick = this.handleEditingCell; | ||
attrs.onClick = this.createHandleEditingCell(attrs.onClick); | ||
} else if (dbclickToEdit && editable) { | ||
attrs.onDoubleClick = this.handleEditingCell; | ||
attrs.onDoubleClick = this.createHandleEditingCell(attrs.onDoubleClick); | ||
} | ||
@@ -125,0 +118,0 @@ |
@@ -23,2 +23,6 @@ 'use strict'; | ||
var _utils = require('../utils'); | ||
var _utils2 = _interopRequireDefault(_utils); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -108,3 +112,3 @@ | ||
return typeof data.find(function (d) { | ||
return d[keyField] === s; | ||
return _utils2.default.get(d, keyField) === s; | ||
}) === 'undefined'; | ||
@@ -111,0 +115,0 @@ }); |
@@ -26,2 +26,6 @@ 'use strict'; | ||
var _utils = require('../utils'); | ||
var _utils2 = _interopRequireDefault(_utils); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -112,3 +116,4 @@ | ||
selectionHeaderRenderer = _props3.selectionHeaderRenderer, | ||
hideSelectAll = _props3.hideSelectAll; | ||
hideSelectAll = _props3.hideSelectAll, | ||
headerColumnStyle = _props3.headerColumnStyle; | ||
@@ -129,2 +134,4 @@ if (hideSelectAll) { | ||
attrs.style = _utils2.default.isFunction(headerColumnStyle) ? headerColumnStyle(checkedStatus) : headerColumnStyle; | ||
return _react2.default.createElement( | ||
@@ -167,4 +174,5 @@ _bootstrap.BootstrapContext.Consumer, | ||
hideSelectAll: _propTypes2.default.bool, | ||
selectionHeaderRenderer: _propTypes2.default.func | ||
selectionHeaderRenderer: _propTypes2.default.func, | ||
headerColumnStyle: _propTypes2.default.oneOfType([_propTypes2.default.object, _propTypes2.default.func]) | ||
}; | ||
exports.default = SelectionHeaderCell; |
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
'use strict'; | ||
@@ -6,5 +6,13 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports.getRowByRowId = exports.matchRow = undefined; | ||
var _utils = require('../utils'); | ||
var _utils2 = _interopRequireDefault(_utils); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var matchRow = exports.matchRow = function matchRow(keyField, id) { | ||
return function (row) { | ||
return row[keyField] === id; | ||
return _utils2.default.get(row, keyField) === id; | ||
}; | ||
@@ -11,0 +19,0 @@ }; |
{ | ||
"name": "react-bootstrap-table-next", | ||
"version": "3.1.1", | ||
"version": "3.1.2", | ||
"description": "Next generation of react-bootstrap-table", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
1062660
12357