mirror of
https://github.com/gosticks/react-table.git
synced 2026-08-19 08:20:30 +00:00
Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4b2d0eb187 | ||
|
|
5369051b05 | ||
|
|
58d38b668b | ||
|
|
9de149cf3c | ||
|
|
289dca1caf | ||
|
|
c6167566da | ||
|
|
5b0e68aead |
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "react-table",
|
||||
"version": "7.0.0-alpha.4",
|
||||
"version": "7.0.0-alpha.6",
|
||||
"description": "A fast, lightweight, opinionated table and datagrid built on React",
|
||||
"license": "MIT",
|
||||
"homepage": "https://github.com/tannerlinsley/react-table#readme",
|
||||
|
||||
@@ -22,14 +22,15 @@ const propTypes = {
|
||||
columns: PropTypes.arrayOf(
|
||||
PropTypes.shape({
|
||||
sortByFn: PropTypes.func,
|
||||
efaultSortDesc: PropTypes.bool
|
||||
defaultSortDesc: PropTypes.bool
|
||||
})
|
||||
),
|
||||
sortByFn: PropTypes.func,
|
||||
manualSorting: PropTypes.bool,
|
||||
disableSorting: PropTypes.bool,
|
||||
defaultSortDesc: PropTypes.bool,
|
||||
disableMultiSort: PropTypes.bool
|
||||
disableMultiSort: PropTypes.bool,
|
||||
disableSortRemove: PropTypes.bool
|
||||
}
|
||||
|
||||
export const useSortBy = props => {
|
||||
@@ -44,6 +45,7 @@ export const useSortBy = props => {
|
||||
manualSorting,
|
||||
disableSorting,
|
||||
defaultSortDesc,
|
||||
disableSortRemove,
|
||||
hooks,
|
||||
state: [{ sortBy }, setState]
|
||||
} = props
|
||||
@@ -82,8 +84,9 @@ export const useSortBy = props => {
|
||||
|
||||
if (!multi) {
|
||||
if (sortBy.length <= 1 && existingSortBy) {
|
||||
if (existingSortBy.desc) {
|
||||
action = 'remove'
|
||||
if ((existingSortBy.desc && !resolvedDefaultSortDesc) ||
|
||||
(!existingSortBy.desc && resolvedDefaultSortDesc)) {
|
||||
action = disableSortRemove? 'toggle' : 'remove'
|
||||
} else {
|
||||
action = 'toggle'
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ export const useTable = (props, ...plugins) => {
|
||||
row.getRowProps = props =>
|
||||
mergeProps(
|
||||
{ key: ['row', ...path].join('_') },
|
||||
applyHooks(api.hooks.getRowProps, row, api),
|
||||
applyPropHooks(api.hooks.getRowProps, row, api),
|
||||
props
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user