react-bootstrap-table-next
Advanced tools
Comparing version 3.1.9 to 3.2.0
@@ -57,3 +57,4 @@ 'use strict'; | ||
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 arrow-body-style: 0 */ | ||
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 camelcase: 0 */ | ||
/* eslint arrow-body-style: 0 */ | ||
@@ -77,4 +78,4 @@ var BootstrapTable = function (_PropsBaseResolver) { | ||
_createClass(BootstrapTable, [{ | ||
key: 'componentWillReceiveProps', | ||
value: function componentWillReceiveProps(nextProps) { | ||
key: 'UNSAFE_componentWillReceiveProps', | ||
value: function UNSAFE_componentWillReceiveProps(nextProps) { | ||
if (nextProps.onDataSizeChange && !nextProps.pagination) { | ||
@@ -81,0 +82,0 @@ if (nextProps.data.length !== this.props.data.length) { |
@@ -46,5 +46,6 @@ 'use strict'; | ||
column = _props.column, | ||
columnIndex = _props.columnIndex; | ||
columnIndex = _props.columnIndex, | ||
index = _props.index; | ||
cb(e, column, columnIndex); | ||
cb(e, column, typeof columnIndex !== 'undefined' ? columnIndex : index); | ||
}; | ||
@@ -51,0 +52,0 @@ } |
@@ -23,4 +23,5 @@ 'use strict'; | ||
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; } | ||
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 camelcase: 0 */ | ||
exports.default = function () { | ||
@@ -50,4 +51,4 @@ var DataContext = _react2.default.createContext(); | ||
_createClass(DataProvider, [{ | ||
key: 'componentWillReceiveProps', | ||
value: function componentWillReceiveProps(nextProps) { | ||
key: 'UNSAFE_componentWillReceiveProps', | ||
value: function UNSAFE_componentWillReceiveProps(nextProps) { | ||
this.setState(function () { | ||
@@ -54,0 +55,0 @@ return { data: nextProps.data }; |
@@ -59,3 +59,4 @@ 'use strict'; | ||
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-return-assign: 0 */ | ||
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 camelcase: 0 */ | ||
/* eslint no-return-assign: 0 */ | ||
/* eslint no-param-reassign: 0 */ | ||
@@ -143,4 +144,4 @@ /* eslint class-methods-use-this: 0 */ | ||
_createClass(BootstrapTableContainer, [{ | ||
key: 'componentWillReceiveProps', | ||
value: function componentWillReceiveProps(nextProps) { | ||
key: 'UNSAFE_componentWillReceiveProps', | ||
value: function UNSAFE_componentWillReceiveProps(nextProps) { | ||
if (!nextProps.pagination && this.props.pagination) { | ||
@@ -147,0 +148,0 @@ this.PaginationContext = null; |
@@ -35,3 +35,4 @@ 'use strict'; | ||
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 react/prop-types: 0 */ | ||
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 camelcase: 0 */ | ||
/* eslint react/prop-types: 0 */ | ||
@@ -128,4 +129,4 @@ | ||
_createClass(RowExpandProvider, [{ | ||
key: 'componentWillReceiveProps', | ||
value: function componentWillReceiveProps(nextProps) { | ||
key: 'UNSAFE_componentWillReceiveProps', | ||
value: function UNSAFE_componentWillReceiveProps(nextProps) { | ||
var _this2 = this; | ||
@@ -132,0 +133,0 @@ |
@@ -37,3 +37,4 @@ 'use strict'; | ||
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 react/prop-types: 0 */ | ||
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 camelcase: 0 */ | ||
/* eslint react/prop-types: 0 */ | ||
@@ -123,13 +124,6 @@ | ||
_createClass(SelectionProvider, [{ | ||
key: 'componentWillReceiveProps', | ||
value: function componentWillReceiveProps(nextProps) { | ||
if (nextProps.selectRow) { | ||
this.selected = nextProps.selectRow.selected || this.selected; | ||
} | ||
} | ||
// exposed API | ||
// exposed API | ||
}, { | ||
_createClass(SelectionProvider, [{ | ||
key: 'getSelected', | ||
@@ -140,2 +134,9 @@ value: function getSelected() { | ||
}, { | ||
key: 'UNSAFE_componentWillReceiveProps', | ||
value: function UNSAFE_componentWillReceiveProps(nextProps) { | ||
if (nextProps.selectRow) { | ||
this.selected = nextProps.selectRow.selected || this.selected; | ||
} | ||
} | ||
}, { | ||
key: 'render', | ||
@@ -142,0 +143,0 @@ value: function render() { |
@@ -7,4 +7,5 @@ 'use strict'; | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; /* eslint react/require-default-props: 0 */ | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
@@ -27,51 +28,79 @@ var _react = require('react'); | ||
var _cellEventDelegater = require('./cell-event-delegater'); | ||
var _cellEventDelegater2 = _interopRequireDefault(_cellEventDelegater); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var FooterCell = function FooterCell(props) { | ||
var index = props.index, | ||
column = props.column, | ||
columnData = props.columnData; | ||
var footer = column.footer, | ||
footerTitle = column.footerTitle, | ||
footerAlign = column.footerAlign, | ||
footerFormatter = column.footerFormatter, | ||
footerEvents = column.footerEvents, | ||
footerClasses = column.footerClasses, | ||
footerStyle = column.footerStyle, | ||
footerAttrs = column.footerAttrs; | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
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; } | ||
var cellAttrs = _extends({}, _utils2.default.isFunction(footerAttrs) ? footerAttrs(column, index) : footerAttrs, footerEvents); | ||
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 react/require-default-props: 0 */ | ||
var text = ''; | ||
if (_utils2.default.isString(footer)) { | ||
text = footer; | ||
} else if (_utils2.default.isFunction(footer)) { | ||
text = footer(columnData, column, index); | ||
} | ||
var cellStyle = {}; | ||
var cellClasses = _utils2.default.isFunction(footerClasses) ? footerClasses(column, index) : footerClasses; | ||
var FooterCell = function (_eventDelegater) { | ||
_inherits(FooterCell, _eventDelegater); | ||
if (footerStyle) { | ||
cellStyle = _utils2.default.isFunction(footerStyle) ? footerStyle(column, index) : footerStyle; | ||
cellStyle = cellStyle ? _extends({}, cellStyle) : cellStyle; | ||
} | ||
function FooterCell() { | ||
_classCallCheck(this, FooterCell); | ||
if (footerTitle) { | ||
cellAttrs.title = _utils2.default.isFunction(footerTitle) ? footerTitle(column, index) : text; | ||
return _possibleConstructorReturn(this, (FooterCell.__proto__ || Object.getPrototypeOf(FooterCell)).apply(this, arguments)); | ||
} | ||
if (footerAlign) { | ||
cellStyle.textAlign = _utils2.default.isFunction(footerAlign) ? footerAlign(column, index) : footerAlign; | ||
} | ||
_createClass(FooterCell, [{ | ||
key: 'render', | ||
value: function render() { | ||
var _props = this.props, | ||
index = _props.index, | ||
column = _props.column, | ||
columnData = _props.columnData; | ||
var footer = column.footer, | ||
footerTitle = column.footerTitle, | ||
footerAlign = column.footerAlign, | ||
footerFormatter = column.footerFormatter, | ||
footerEvents = column.footerEvents, | ||
footerClasses = column.footerClasses, | ||
footerStyle = column.footerStyle, | ||
footerAttrs = column.footerAttrs; | ||
if (cellClasses) cellAttrs.className = (0, _classnames2.default)(cellAttrs.className, cellClasses); | ||
if (!_utils2.default.isEmptyObject(cellStyle)) cellAttrs.style = cellStyle; | ||
var children = footerFormatter ? footerFormatter(column, index) : text; | ||
var delegateEvents = this.delegate(footerEvents); | ||
var cellAttrs = _extends({}, _utils2.default.isFunction(footerAttrs) ? footerAttrs(column, index) : footerAttrs, delegateEvents); | ||
return _react2.default.createElement('th', cellAttrs, children); | ||
}; | ||
var text = ''; | ||
if (_utils2.default.isString(footer)) { | ||
text = footer; | ||
} else if (_utils2.default.isFunction(footer)) { | ||
text = footer(columnData, column, index); | ||
} | ||
var cellStyle = {}; | ||
var cellClasses = _utils2.default.isFunction(footerClasses) ? footerClasses(column, index) : footerClasses; | ||
if (footerStyle) { | ||
cellStyle = _utils2.default.isFunction(footerStyle) ? footerStyle(column, index) : footerStyle; | ||
cellStyle = cellStyle ? _extends({}, cellStyle) : cellStyle; | ||
} | ||
if (footerTitle) { | ||
cellAttrs.title = _utils2.default.isFunction(footerTitle) ? footerTitle(column, index) : text; | ||
} | ||
if (footerAlign) { | ||
cellStyle.textAlign = _utils2.default.isFunction(footerAlign) ? footerAlign(column, index) : footerAlign; | ||
} | ||
if (cellClasses) cellAttrs.className = (0, _classnames2.default)(cellAttrs.className, cellClasses); | ||
if (!_utils2.default.isEmptyObject(cellStyle)) cellAttrs.style = cellStyle; | ||
var children = footerFormatter ? footerFormatter(column, index) : text; | ||
return _react2.default.createElement('th', cellAttrs, children); | ||
} | ||
}]); | ||
return FooterCell; | ||
}((0, _cellEventDelegater2.default)(_react2.default.Component)); | ||
FooterCell.propTypes = { | ||
@@ -78,0 +107,0 @@ columnData: _propTypes2.default.array, |
@@ -7,4 +7,5 @@ 'use strict'; | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; /* eslint react/require-default-props: 0 */ | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
@@ -39,95 +40,124 @@ var _react = require('react'); | ||
var _cellEventDelegater = require('./cell-event-delegater'); | ||
var _cellEventDelegater2 = _interopRequireDefault(_cellEventDelegater); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var HeaderCell = function HeaderCell(props) { | ||
var column = props.column, | ||
index = props.index, | ||
onSort = props.onSort, | ||
sorting = props.sorting, | ||
sortOrder = props.sortOrder, | ||
isLastSorting = props.isLastSorting, | ||
onFilter = props.onFilter, | ||
currFilters = props.currFilters, | ||
onExternalFilter = props.onExternalFilter; | ||
var text = column.text, | ||
sort = column.sort, | ||
sortCaret = column.sortCaret, | ||
filter = column.filter, | ||
filterRenderer = column.filterRenderer, | ||
headerTitle = column.headerTitle, | ||
headerAlign = column.headerAlign, | ||
headerFormatter = column.headerFormatter, | ||
headerEvents = column.headerEvents, | ||
headerClasses = column.headerClasses, | ||
headerStyle = column.headerStyle, | ||
headerAttrs = column.headerAttrs, | ||
headerSortingClasses = column.headerSortingClasses, | ||
headerSortingStyle = column.headerSortingStyle; | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
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; } | ||
var cellAttrs = _extends({}, _utils2.default.isFunction(headerAttrs) ? headerAttrs(column, index) : headerAttrs, headerEvents, { | ||
tabIndex: 0 | ||
}); | ||
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 react/require-default-props: 0 */ | ||
var sortSymbol = void 0; | ||
var filterElm = void 0; | ||
var cellStyle = {}; | ||
var cellClasses = _utils2.default.isFunction(headerClasses) ? headerClasses(column, index) : headerClasses; | ||
if (headerStyle) { | ||
cellStyle = _utils2.default.isFunction(headerStyle) ? headerStyle(column, index) : headerStyle; | ||
cellStyle = cellStyle ? _extends({}, cellStyle) : cellStyle; | ||
} | ||
var HeaderCell = function (_eventDelegater) { | ||
_inherits(HeaderCell, _eventDelegater); | ||
if (headerTitle) { | ||
cellAttrs.title = _utils2.default.isFunction(headerTitle) ? headerTitle(column, index) : text; | ||
} | ||
function HeaderCell() { | ||
_classCallCheck(this, HeaderCell); | ||
if (headerAlign) { | ||
cellStyle.textAlign = _utils2.default.isFunction(headerAlign) ? headerAlign(column, index) : headerAlign; | ||
return _possibleConstructorReturn(this, (HeaderCell.__proto__ || Object.getPrototypeOf(HeaderCell)).apply(this, arguments)); | ||
} | ||
if (sort) { | ||
var customClick = cellAttrs.onClick; | ||
cellAttrs.onClick = function (e) { | ||
onSort(column); | ||
if (_utils2.default.isFunction(customClick)) customClick(e); | ||
}; | ||
cellAttrs.className = (0, _classnames2.default)(cellAttrs.className, 'sortable'); | ||
_createClass(HeaderCell, [{ | ||
key: 'render', | ||
value: function render() { | ||
var _props = this.props, | ||
column = _props.column, | ||
index = _props.index, | ||
onSort = _props.onSort, | ||
sorting = _props.sorting, | ||
sortOrder = _props.sortOrder, | ||
isLastSorting = _props.isLastSorting, | ||
onFilter = _props.onFilter, | ||
currFilters = _props.currFilters, | ||
onExternalFilter = _props.onExternalFilter; | ||
var text = column.text, | ||
sort = column.sort, | ||
sortCaret = column.sortCaret, | ||
filter = column.filter, | ||
filterRenderer = column.filterRenderer, | ||
headerTitle = column.headerTitle, | ||
headerAlign = column.headerAlign, | ||
headerFormatter = column.headerFormatter, | ||
headerEvents = column.headerEvents, | ||
headerClasses = column.headerClasses, | ||
headerStyle = column.headerStyle, | ||
headerAttrs = column.headerAttrs, | ||
headerSortingClasses = column.headerSortingClasses, | ||
headerSortingStyle = column.headerSortingStyle; | ||
if (sorting) { | ||
sortSymbol = sortCaret ? sortCaret(sortOrder, column) : _react2.default.createElement(_caret2.default, { order: sortOrder }); | ||
// append customized classes or style if table was sorting based on the current column. | ||
cellClasses = (0, _classnames2.default)(cellClasses, _utils2.default.isFunction(headerSortingClasses) ? headerSortingClasses(column, sortOrder, isLastSorting, index) : headerSortingClasses); | ||
var delegateEvents = this.delegate(headerEvents); | ||
cellStyle = _extends({}, cellStyle, _utils2.default.isFunction(headerSortingStyle) ? headerSortingStyle(column, sortOrder, isLastSorting, index) : headerSortingStyle); | ||
} else { | ||
sortSymbol = sortCaret ? sortCaret(undefined, column) : _react2.default.createElement(_symbol2.default, null); | ||
} | ||
} | ||
var cellAttrs = _extends({}, _utils2.default.isFunction(headerAttrs) ? headerAttrs(column, index) : headerAttrs, delegateEvents, { | ||
tabIndex: 0 | ||
}); | ||
if (cellClasses) cellAttrs.className = (0, _classnames2.default)(cellAttrs.className, cellClasses); | ||
if (!_utils2.default.isEmptyObject(cellStyle)) cellAttrs.style = cellStyle; | ||
var sortSymbol = void 0; | ||
var filterElm = void 0; | ||
var cellStyle = {}; | ||
var cellClasses = _utils2.default.isFunction(headerClasses) ? headerClasses(column, index) : headerClasses; | ||
if (filterRenderer) { | ||
var onCustomFilter = onExternalFilter(column, filter.props.type); | ||
filterElm = filterRenderer(onCustomFilter, column); | ||
} else if (filter) { | ||
filterElm = _react2.default.createElement(filter.Filter, _extends({}, filter.props, { | ||
filterState: currFilters[column.dataField], | ||
onFilter: onFilter, | ||
column: column | ||
})); | ||
} | ||
if (headerStyle) { | ||
cellStyle = _utils2.default.isFunction(headerStyle) ? headerStyle(column, index) : headerStyle; | ||
cellStyle = cellStyle ? _extends({}, cellStyle) : cellStyle; | ||
} | ||
var children = headerFormatter ? headerFormatter(column, index, { sortElement: sortSymbol, filterElement: filterElm }) : text; | ||
if (headerTitle) { | ||
cellAttrs.title = _utils2.default.isFunction(headerTitle) ? headerTitle(column, index) : text; | ||
} | ||
if (headerFormatter) { | ||
return _react2.default.createElement('th', cellAttrs, children); | ||
} | ||
if (headerAlign) { | ||
cellStyle.textAlign = _utils2.default.isFunction(headerAlign) ? headerAlign(column, index) : headerAlign; | ||
} | ||
return _react2.default.createElement('th', cellAttrs, children, sortSymbol, filterElm); | ||
}; | ||
if (sort) { | ||
var customClick = cellAttrs.onClick; | ||
cellAttrs.onClick = function (e) { | ||
onSort(column); | ||
if (_utils2.default.isFunction(customClick)) customClick(e); | ||
}; | ||
cellAttrs.className = (0, _classnames2.default)(cellAttrs.className, 'sortable'); | ||
if (sorting) { | ||
sortSymbol = sortCaret ? sortCaret(sortOrder, column) : _react2.default.createElement(_caret2.default, { order: sortOrder }); | ||
// append customized classes or style if table was sorting based on the current column. | ||
cellClasses = (0, _classnames2.default)(cellClasses, _utils2.default.isFunction(headerSortingClasses) ? headerSortingClasses(column, sortOrder, isLastSorting, index) : headerSortingClasses); | ||
cellStyle = _extends({}, cellStyle, _utils2.default.isFunction(headerSortingStyle) ? headerSortingStyle(column, sortOrder, isLastSorting, index) : headerSortingStyle); | ||
} else { | ||
sortSymbol = sortCaret ? sortCaret(undefined, column) : _react2.default.createElement(_symbol2.default, null); | ||
} | ||
} | ||
if (cellClasses) cellAttrs.className = (0, _classnames2.default)(cellAttrs.className, cellClasses); | ||
if (!_utils2.default.isEmptyObject(cellStyle)) cellAttrs.style = cellStyle; | ||
if (filterRenderer) { | ||
var onCustomFilter = onExternalFilter(column, filter.props.type); | ||
filterElm = filterRenderer(onCustomFilter, column); | ||
} else if (filter) { | ||
filterElm = _react2.default.createElement(filter.Filter, _extends({}, filter.props, { | ||
filterState: currFilters[column.dataField], | ||
onFilter: onFilter, | ||
column: column | ||
})); | ||
} | ||
var children = headerFormatter ? headerFormatter(column, index, { sortElement: sortSymbol, filterElement: filterElm }) : text; | ||
if (headerFormatter) { | ||
return _react2.default.createElement('th', cellAttrs, children); | ||
} | ||
return _react2.default.createElement('th', cellAttrs, children, sortSymbol, filterElm); | ||
} | ||
}]); | ||
return HeaderCell; | ||
}((0, _cellEventDelegater2.default)(_react2.default.Component)); | ||
HeaderCell.propTypes = { | ||
@@ -134,0 +164,0 @@ column: _propTypes2.default.shape({ |
@@ -35,3 +35,4 @@ 'use strict'; | ||
var dataField = _ref.dataField, | ||
sortFunc = _ref.sortFunc; | ||
sortFunc = _ref.sortFunc, | ||
sortValue = _ref.sortValue; | ||
@@ -43,4 +44,9 @@ var _data = [].concat(_toConsumableArray(data)); | ||
var valueB = _utils2.default.get(b, dataField); | ||
valueA = _utils2.default.isDefined(valueA) ? valueA : ''; | ||
valueB = _utils2.default.isDefined(valueB) ? valueB : ''; | ||
if (sortValue) { | ||
valueA = sortValue(valueA, a); | ||
valueB = sortValue(valueB, b); | ||
} else { | ||
valueA = _utils2.default.isDefined(valueA) ? valueA : ''; | ||
valueB = _utils2.default.isDefined(valueB) ? valueB : ''; | ||
} | ||
@@ -47,0 +53,0 @@ if (sortFunc) { |
{ | ||
"name": "react-bootstrap-table-next", | ||
"version": "3.1.9", | ||
"version": "3.2.0", | ||
"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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1099226
12718