react-bootstrap-table-next
Advanced tools
Comparing version 3.3.2 to 3.3.3
@@ -153,3 +153,3 @@ 'use strict'; | ||
_caption2.default, | ||
null, | ||
{ bootstrap4: bootstrap4 }, | ||
caption | ||
@@ -171,2 +171,3 @@ ); | ||
onSort: this.props.onSort, | ||
globalSortCaret: this.props.sort && this.props.sort.sortCaret, | ||
onFilter: this.props.onFilter, | ||
@@ -288,2 +289,8 @@ currFilters: this.props.currFilters, | ||
})), | ||
sort: _propTypes2.default.shape({ | ||
dataField: _propTypes2.default.string, | ||
order: _propTypes2.default.oneOf([_const2.default.SORT_DESC, _const2.default.SORT_ASC]), | ||
sortFunc: _propTypes2.default.func, | ||
sortCaret: _propTypes2.default.func | ||
}), | ||
defaultSortDirection: _propTypes2.default.oneOf([_const2.default.SORT_DESC, _const2.default.SORT_ASC]), | ||
@@ -290,0 +297,0 @@ overlay: _propTypes2.default.func, |
@@ -20,13 +20,21 @@ 'use strict'; | ||
if (!props.children) return null; | ||
return _react2.default.createElement( | ||
var caption = props.bootstrap4 ? _react2.default.createElement( | ||
'caption', | ||
{ style: { captionSide: 'top' } }, | ||
props.children | ||
) : _react2.default.createElement( | ||
'caption', | ||
null, | ||
props.children | ||
); | ||
return caption; | ||
}; | ||
Caption.propTypes = { | ||
children: _propTypes2.default.oneOfType([_propTypes2.default.node, _propTypes2.default.string]) | ||
children: _propTypes2.default.oneOfType([_propTypes2.default.node, _propTypes2.default.string]), | ||
bootstrap4: _propTypes2.default.bool | ||
}; | ||
exports.default = Caption; |
@@ -275,2 +275,3 @@ 'use strict'; | ||
defaultSortDirection: _this7.props.defaultSortDirection, | ||
sort: _this7.props.sort, | ||
data: rootProps.getData(filterProps, searchProps) | ||
@@ -277,0 +278,0 @@ }), |
@@ -7,2 +7,4 @@ '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; }; | ||
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; }; }(); | ||
@@ -28,3 +30,4 @@ | ||
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 */ | ||
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/require-default-props: 0 */ | ||
@@ -47,20 +50,13 @@ | ||
var sortColumn = void 0; | ||
var columns = props.columns, | ||
defaultSorted = props.defaultSorted, | ||
defaultSortDirection = props.defaultSortDirection; | ||
var defaultSorted = props.defaultSorted, | ||
defaultSortDirection = props.defaultSortDirection, | ||
sort = props.sort; | ||
if (defaultSorted && defaultSorted.length > 0) { | ||
var sortField = defaultSorted[0].dataField; | ||
sortOrder = defaultSorted[0].order || defaultSortDirection; | ||
var sortColumns = columns.filter(function (col) { | ||
return col.dataField === sortField; | ||
}); | ||
if (sortColumns.length > 0) { | ||
sortColumn = sortColumns[0]; | ||
if (sortColumn.onSort) { | ||
sortColumn.onSort(sortField, sortOrder); | ||
} | ||
} | ||
sortColumn = _this.initSort(defaultSorted[0].dataField, sortOrder); | ||
} else if (sort && sort.dataField && sort.order) { | ||
sortOrder = sort.order; | ||
sortColumn = _this.initSort(sort.dataField, sortOrder); | ||
} | ||
@@ -83,5 +79,39 @@ _this.state = { sortOrder: sortOrder, sortColumn: sortColumn }; | ||
}, { | ||
key: 'UNSAFE_componentWillReceiveProps', | ||
value: function UNSAFE_componentWillReceiveProps(nextProps) { | ||
var sort = nextProps.sort, | ||
columns = nextProps.columns; | ||
if (sort && sort.dataField && sort.order) { | ||
this.setState({ | ||
sortOrder: sort.order, | ||
sortColumn: columns.find(function (col) { | ||
return col.dataField === sort.dataField; | ||
}) | ||
}); | ||
} | ||
} | ||
}, { | ||
key: 'initSort', | ||
value: function initSort(sortField, sortOrder) { | ||
var sortColumn = void 0; | ||
var columns = this.props.columns; | ||
var sortColumns = columns.filter(function (col) { | ||
return col.dataField === sortField; | ||
}); | ||
if (sortColumns.length > 0) { | ||
sortColumn = sortColumns[0]; | ||
if (sortColumn.onSort) { | ||
sortColumn.onSort(sortField, sortOrder); | ||
} | ||
} | ||
return sortColumn; | ||
} | ||
}, { | ||
key: 'render', | ||
value: function render() { | ||
var data = this.props.data; | ||
var sort = this.props.sort; | ||
var _state2 = this.state, | ||
@@ -92,3 +122,4 @@ sortOrder = _state2.sortOrder, | ||
if (!isRemoteSort() && sortColumn) { | ||
data = dataOperator.sort(data, sortOrder, sortColumn); | ||
var sortFunc = sortColumn.sortFunc ? sortColumn.sortFunc : sort && sort.sortFunc; | ||
data = dataOperator.sort(data, sortOrder, _extends({}, sortColumn, { sortFunc: sortFunc })); | ||
} | ||
@@ -122,2 +153,7 @@ | ||
})), | ||
sort: _propTypes2.default.shape({ | ||
dataField: _propTypes2.default.string, | ||
order: _propTypes2.default.oneOf([_const2.default.SORT_DESC, _const2.default.SORT_ASC]), | ||
sortFunc: _propTypes2.default.func | ||
}), | ||
defaultSortDirection: _propTypes2.default.oneOf([_const2.default.SORT_DESC, _const2.default.SORT_ASC]) | ||
@@ -124,0 +160,0 @@ }; |
@@ -74,3 +74,4 @@ 'use strict'; | ||
filterPosition = _props.filterPosition, | ||
onExternalFilter = _props.onExternalFilter; | ||
onExternalFilter = _props.onExternalFilter, | ||
globalSortCaret = _props.globalSortCaret; | ||
var text = column.text, | ||
@@ -92,2 +93,4 @@ sort = column.sort, | ||
var sortCaretfunc = sortCaret || globalSortCaret; | ||
var delegateEvents = this.delegate(headerEvents); | ||
@@ -128,3 +131,3 @@ | ||
if (sorting) { | ||
sortSymbol = sortCaret ? sortCaret(sortOrder, column) : _react2.default.createElement(_caret2.default, { order: sortOrder }); | ||
sortSymbol = sortCaretfunc ? sortCaretfunc(sortOrder, column) : _react2.default.createElement(_caret2.default, { order: sortOrder }); | ||
@@ -136,3 +139,3 @@ // append customized classes or style if table was sorting based on the current column. | ||
} else { | ||
sortSymbol = sortCaret ? sortCaret(undefined, column) : _react2.default.createElement(_symbol2.default, null); | ||
sortSymbol = sortCaretfunc ? sortCaretfunc(undefined, column) : _react2.default.createElement(_symbol2.default, null); | ||
} | ||
@@ -139,0 +142,0 @@ } |
@@ -53,3 +53,4 @@ 'use strict'; | ||
onExternalFilter = props.onExternalFilter, | ||
filterPosition = props.filterPosition; | ||
filterPosition = props.filterPosition, | ||
globalSortCaret = props.globalSortCaret; | ||
@@ -88,2 +89,3 @@ | ||
sortOrder: sortOrder, | ||
globalSortCaret: globalSortCaret, | ||
isLastSorting: isLastSorting, | ||
@@ -133,2 +135,3 @@ onFilter: onFilter, | ||
onExternalFilter: _propTypes2.default.func, | ||
globalSortCaret: _propTypes2.default.func, | ||
className: _propTypes2.default.string, | ||
@@ -135,0 +138,0 @@ expandRow: _propTypes2.default.object, |
{ | ||
"name": "react-bootstrap-table-next", | ||
"version": "3.3.2", | ||
"version": "3.3.3", | ||
"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
1152129
13341