mirror of
https://github.com/gosticks/react-table.git
synced 2026-06-28 17:10:01 +00:00
Merge branch 'master' of https://github.com/react-tools/react-table
This commit is contained in:
@@ -191,7 +191,7 @@ import {
|
||||
- [Row Selection](https://codesandbox.io/s/github/tannerlinsley/react-table/tree/master/examples/row-selection)
|
||||
- [Expanding](https://codesandbox.io/s/github/tannerlinsley/react-table/tree/master/examples/expanding)
|
||||
- [Sub Components](https://codesandbox.io/s/github/tannerlinsley/react-table/tree/master/examples/sub-components)
|
||||
- [Editable Data](https://codesandbox.io/s/github/tannerlinsley/react-table/tree/master/examples/editable-cells)
|
||||
- [Editable Data](https://codesandbox.io/s/github/tannerlinsley/react-table/tree/master/examples/editable-data)
|
||||
- Controlled
|
||||
- [Pagination (Controlled)](https://codesandbox.io/s/github/tannerlinsley/react-table/tree/master/examples/pagination-controlled)
|
||||
|
||||
@@ -591,6 +591,11 @@ The following options are supported via the main options object passed to `useTa
|
||||
- Disables sorting for every column in the entire table.
|
||||
- `disableMultiSort: Bool`
|
||||
- Disables multi-sorting for the entire table.
|
||||
- `isMultiSortEvent: Function`
|
||||
- Allows to override default multisort behaviour(i.e. multisort applies when shift key is presssed), if this function is provided then returned boolean value from this function will make decision whether newly applied sort action will be considered as multisort or not.
|
||||
- Receives `event` as argument.
|
||||
- `maxMultiSortColCount: Number`
|
||||
- Limit on max number of columns for multisort, e.g. if set to 3, and suppose table is sorted by `[A, B, C]` and then clicking `D` for sorting should result in table sorted by `[B, C , D]`
|
||||
- `disableSortRemove: Bool`
|
||||
- If true, the un-sorted state will not be available to columns once they have been sorted.
|
||||
- `disableMultiRemove: Bool`
|
||||
|
||||
@@ -2,5 +2,5 @@ This project was bootstrapped with [Create React App](https://github.com/faceboo
|
||||
|
||||
You can:
|
||||
|
||||
- [Open this example in a new CodeSandbox](https://codesandbox.io/s/github/tannerlinsley/react-table/tree/master/examples/basic)
|
||||
- [Open this example in a new CodeSandbox](https://codesandbox.io/s/github/tannerlinsley/react-table/tree/master/examples/editable-data)
|
||||
- `yarn` and `yarn start` to run and edit the example
|
||||
|
||||
@@ -2,5 +2,5 @@ This project was bootstrapped with [Create React App](https://github.com/faceboo
|
||||
|
||||
You can:
|
||||
|
||||
- [Open this example in a new CodeSandbox](https://codesandbox.io/s/github/tannerlinsley/react-table/tree/master/examples/basic)
|
||||
- [Open this example in a new CodeSandbox](https://codesandbox.io/s/github/tannerlinsley/react-table/tree/master/examples/expanding)
|
||||
- `yarn` and `yarn start` to run and edit the example
|
||||
|
||||
@@ -2,5 +2,5 @@ This project was bootstrapped with [Create React App](https://github.com/faceboo
|
||||
|
||||
You can:
|
||||
|
||||
- [Open this example in a new CodeSandbox](https://codesandbox.io/s/github/tannerlinsley/react-table/tree/master/examples/basic)
|
||||
- [Open this example in a new CodeSandbox](https://codesandbox.io/s/github/tannerlinsley/react-table/tree/master/examples/filtering)
|
||||
- `yarn` and `yarn start` to run and edit the example
|
||||
|
||||
@@ -2,5 +2,5 @@ This project was bootstrapped with [Create React App](https://github.com/faceboo
|
||||
|
||||
You can:
|
||||
|
||||
- [Open this example in a new CodeSandbox](https://codesandbox.io/s/github/tannerlinsley/react-table/tree/master/examples/basic)
|
||||
- [Open this example in a new CodeSandbox](https://codesandbox.io/s/github/tannerlinsley/react-table/tree/master/examples/grouping)
|
||||
- `yarn` and `yarn start` to run and edit the example
|
||||
|
||||
@@ -2,5 +2,5 @@ This project was bootstrapped with [Create React App](https://github.com/faceboo
|
||||
|
||||
You can:
|
||||
|
||||
- [Open this example in a new CodeSandbox](https://codesandbox.io/s/github/tannerlinsley/react-table/tree/master/examples/basic)
|
||||
- [Open this example in a new CodeSandbox](https://codesandbox.io/s/github/tannerlinsley/react-table/tree/master/examples/pagination-controlled)
|
||||
- `yarn` and `yarn start` to run and edit the example
|
||||
|
||||
@@ -2,5 +2,5 @@ This project was bootstrapped with [Create React App](https://github.com/faceboo
|
||||
|
||||
You can:
|
||||
|
||||
- [Open this example in a new CodeSandbox](https://codesandbox.io/s/github/tannerlinsley/react-table/tree/master/examples/basic)
|
||||
- [Open this example in a new CodeSandbox](https://codesandbox.io/s/github/tannerlinsley/react-table/tree/master/examples/pagination)
|
||||
- `yarn` and `yarn start` to run and edit the example
|
||||
|
||||
@@ -2,5 +2,5 @@ This project was bootstrapped with [Create React App](https://github.com/faceboo
|
||||
|
||||
You can:
|
||||
|
||||
- [Open this example in a new CodeSandbox](https://codesandbox.io/s/github/tannerlinsley/react-table/tree/master/examples/basic)
|
||||
- [Open this example in a new CodeSandbox](https://codesandbox.io/s/github/tannerlinsley/react-table/tree/master/examples/row-selection)
|
||||
- `yarn` and `yarn start` to run and edit the example
|
||||
|
||||
@@ -2,5 +2,5 @@ This project was bootstrapped with [Create React App](https://github.com/faceboo
|
||||
|
||||
You can:
|
||||
|
||||
- [Open this example in a new CodeSandbox](https://codesandbox.io/s/github/tannerlinsley/react-table/tree/master/examples/basic)
|
||||
- [Open this example in a new CodeSandbox](https://codesandbox.io/s/github/tannerlinsley/react-table/tree/master/examples/sorting)
|
||||
- `yarn` and `yarn start` to run and edit the example
|
||||
|
||||
@@ -2,5 +2,5 @@ This project was bootstrapped with [Create React App](https://github.com/faceboo
|
||||
|
||||
You can:
|
||||
|
||||
- [Open this example in a new CodeSandbox](https://codesandbox.io/s/github/tannerlinsley/react-table/tree/master/examples/basic)
|
||||
- [Open this example in a new CodeSandbox](https://codesandbox.io/s/github/tannerlinsley/react-table/tree/master/examples/sub-components)
|
||||
- `yarn` and `yarn start` to run and edit the example
|
||||
|
||||
@@ -31,6 +31,8 @@ const propTypes = {
|
||||
manualSorting: PropTypes.bool,
|
||||
disableSorting: PropTypes.bool,
|
||||
disableMultiSort: PropTypes.bool,
|
||||
isMultiSortEvent: PropTypes.func,
|
||||
maxMultiSortColCount: PropTypes.number,
|
||||
disableSortRemove: PropTypes.bool,
|
||||
disableMultiRemove: PropTypes.bool,
|
||||
}
|
||||
@@ -55,6 +57,8 @@ function useMain(instance) {
|
||||
disableSortRemove,
|
||||
disableMultiRemove,
|
||||
disableMultiSort,
|
||||
isMultiSortEvent = (e) => e.shiftKey,
|
||||
maxMultiSortColCount = Number.MAX_SAFE_INTEGER,
|
||||
hooks,
|
||||
state: [{ sortBy }, setState],
|
||||
plugins,
|
||||
@@ -128,6 +132,8 @@ function useMain(instance) {
|
||||
desc: hasDescDefined ? desc : sortDescFirst,
|
||||
},
|
||||
]
|
||||
// Take latest n columns
|
||||
newSortBy.splice(0, newSortBy.length - maxMultiSortColCount);
|
||||
} else if (action === 'toggle') {
|
||||
// This flips (or sets) the
|
||||
newSortBy = sortBy.map(d => {
|
||||
@@ -177,7 +183,7 @@ function useMain(instance) {
|
||||
e.persist()
|
||||
column.toggleSortBy(
|
||||
undefined,
|
||||
!instance.disableMultiSort && e.shiftKey
|
||||
!instance.disableMultiSort && isMultiSortEvent(e)
|
||||
)
|
||||
}
|
||||
: undefined,
|
||||
@@ -246,7 +252,7 @@ function useMain(instance) {
|
||||
|
||||
// If there are sub-rows, sort them
|
||||
sortedData.forEach(row => {
|
||||
if (!row.subRows) {
|
||||
if (!row.subRows || row.subRows.length <= 1) {
|
||||
return
|
||||
}
|
||||
row.subRows = sortData(row.subRows)
|
||||
|
||||
Reference in New Issue
Block a user