mirror of
https://github.com/gosticks/react-table.git
synced 2026-06-01 13:10:02 +00:00
Fixes for useExtended in useTable plus small bug (#1279)
* undefined error in GroupBy row specific hooks and correct pathing for nested rows * Ensuring correct git user
This commit is contained in:
committed by
Tanner Linsley
parent
33f30c7b7f
commit
a9971e66af
2
dist/index.js
vendored
2
dist/index.js
vendored
File diff suppressed because one or more lines are too long
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
@@ -64,7 +64,7 @@ export const useGroupBy = props => {
|
||||
const toggleGroupBy = (id, toggle) => {
|
||||
return setState(old => {
|
||||
const resolvedToggle =
|
||||
typeof set !== 'undefined' ? toggle : !groupBy.includes(id)
|
||||
typeof toggle !== 'undefined' ? toggle : !groupBy.includes(id)
|
||||
if (resolvedToggle) {
|
||||
return {
|
||||
...old,
|
||||
|
||||
@@ -139,14 +139,17 @@ export const useTable = (props, ...plugins) => {
|
||||
// This function is absolutely necessary and MUST be called on
|
||||
// any rows the user wishes to be displayed.
|
||||
api.prepareRow = row => {
|
||||
const { index } = row
|
||||
const { path } = row
|
||||
row.getRowProps = props =>
|
||||
mergeProps(
|
||||
{ key: ['row', index].join('_') },
|
||||
{ key: ['row', path].join('_') },
|
||||
applyHooks(api.hooks.getRowProps, row, api),
|
||||
props
|
||||
)
|
||||
|
||||
// need to apply any row specific hooks (useExpanded requires this)
|
||||
applyHooks(api.hooks.row, row, api)
|
||||
|
||||
row.cells = row.cells.filter(cell => cell.column.visible)
|
||||
|
||||
row.cells.forEach(cell => {
|
||||
@@ -157,7 +160,7 @@ export const useTable = (props, ...plugins) => {
|
||||
const { column } = cell
|
||||
|
||||
cell.getCellProps = props => {
|
||||
const columnPathStr = [index, column.id].join('_')
|
||||
const columnPathStr = [path, column.id].join('_')
|
||||
return mergeProps(
|
||||
{
|
||||
key: ['cell', columnPathStr].join('_')
|
||||
@@ -167,6 +170,7 @@ export const useTable = (props, ...plugins) => {
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
cell.render = (type, userProps = {}) => {
|
||||
if (!type) {
|
||||
throw new Error(
|
||||
|
||||
Reference in New Issue
Block a user