Skip to content

Commit

Permalink
*feat upgrade react-table from 7 to 8
Browse files Browse the repository at this point in the history
  • Loading branch information
Sodik committed Jan 15, 2025
1 parent 3519e5f commit b84717a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/ui/src/Table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,8 @@ export const Table = <D extends RowData & { subRows?: D[] }>({
getSubRows: useCallback((row: D) => row.subRows, []),
getRowCanExpand: useCallback(
(row: TableRow<D>) => {
if (!getRenderRowSubComponent() && !row.subRows) {
return false
if (getRenderRowSubComponent()) {
return true
}

const cb = getCanExpand()
Expand Down
1 change: 1 addition & 0 deletions packages/ui/src/Table/tableTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export type RowType<D extends RowData, K = any> = {
original: D
subRows: RowType<D, K>[]
index: number
getValue: <T = K>(columnId: string) => T
}

export type CellType<D extends RowData, V = any> = {
Expand Down
2 changes: 2 additions & 0 deletions packages/ui/src/Table/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ export const prepareRow = <D extends RowData>({
subRows,
id,
index,
getValue,
}: TableRow<D>): RowType<D> => ({
id,
getCanExpand,
getIsExpanded,
getToggleExpandedHandler,
original,
index,
getValue,
subRows: subRows.map(prepareRow),
})

Expand Down

0 comments on commit b84717a

Please sign in to comment.