Skip to content

Commit

Permalink
fix(table): updated column type definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
hirotomoyamada committed Nov 25, 2023
1 parent e26110e commit 6523622
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .changeset/silly-roses-notice.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@yamada-ui/table": patch
---

Updated column type definitions.
22 changes: 12 additions & 10 deletions packages/components/table/src/use-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import type {
OnChangeFn,
PaginationOptions,
HeaderContext,
DisplayColumnDef,
AccessorColumnDef,
} from "@tanstack/react-table"
import {
getCoreRowModel,
Expand Down Expand Up @@ -48,25 +50,25 @@ export const [TableProvider, useTableContext] = createContext<TableContext>({
name: "TableContext",
})

export type ColumnStyles = {
export type PropsColumnDef = {
className?: string
style?: CSSProperties
sx?: CSSUIObject
css?: CSSUIObject
}

type UIColumn<Y extends RowData, M = any> = {
colSpan?: number
rowSpan?: number
}

export type GroupColumnDef<Y extends RowData, M = any> = {
columns?: Column<Y, M>[]
}

export type Column<Y extends RowData, M = any> = Omit<
ColumnDef<Y, M>,
"columns"
> &
UIColumn<Y, M> &
ColumnStyles
export type Column<Y extends RowData, M = any> = (
| DisplayColumnDef<Y, M>
| AccessorColumnDef<Y, M>
) &
GroupColumnDef<Y, M> &
PropsColumnDef

type SelectColumn<Y extends RowData, M = any> = Omit<
Column<Y, M>,
Expand Down

0 comments on commit 6523622

Please sign in to comment.