diff --git a/src/ColumnFilter.tsx b/src/ColumnFilter.tsx index d9d8e0e..1a0b9f2 100644 --- a/src/ColumnFilter.tsx +++ b/src/ColumnFilter.tsx @@ -12,7 +12,7 @@ export interface ColumnFilterProps { color: string; } -export const ColumnFilter = function ColumnFilter({ column, className, color, filterFn }: ColumnFilterProps) { +export const DefaultColumnFilter = function ColumnFilter({ column, className, color, filterFn }: ColumnFilterProps) { const [state, setState] = useSetState({ open: false, value: null as unknown }); const handleOpen = () => diff --git a/src/ColumnSorter.tsx b/src/ColumnSorter.tsx index b7443d8..cddd5c6 100644 --- a/src/ColumnSorter.tsx +++ b/src/ColumnSorter.tsx @@ -8,7 +8,7 @@ export interface ColumnSorterProps { color: string; } -export const ColumnSorter = ({ column, className, color }: ColumnSorterProps) => { +export const DefaultColumnSorter = ({ column, className, color }: ColumnSorterProps) => { const sorted = column.getIsSorted(); return ( ({ empty, locale, // component overrides - components: { headerWrapper, headerRow, headerCell, bodyWrapper, bodyRow, bodyCell, pagination } = {}, + components: { + headerWrapper, + headerRow, + headerCell, + bodyWrapper, + bodyRow, + bodyCell, + pagination, + columnFilter, + columnSorter, + } = {}, // table option ovverides options, // rest @@ -109,6 +119,8 @@ export function DataGrid({ const BodyRow = bodyRow ?? DefaultBodyRow; const BodyCell = bodyCell ?? DefaultBodyCell; const Pagination = pagination ?? DefaultPagination; + const ColumnFilter = columnFilter ?? DefaultColumnFilter; + const ColumnSorter = columnSorter ?? DefaultColumnSorter; const { classes, theme, cx } = useStyles( { height, diff --git a/src/types.ts b/src/types.ts index c7e8d22..df331f5 100644 --- a/src/types.ts +++ b/src/types.ts @@ -16,6 +16,8 @@ import { TableState, } from '@tanstack/react-table'; import { ComponentPropsWithoutRef, ComponentType, HTMLAttributes, ReactElement, ReactNode, Ref } from 'react'; +import { ColumnFilterProps } from './ColumnFilter'; +import { ColumnSorterProps } from './ColumnSorter'; import useStyles from './DataGrid.styles'; import { PaginationProps } from './Pagination'; import { @@ -229,4 +231,6 @@ export type DataGridComponents = { bodyRow: ComponentType>; bodyCell: ComponentType>; pagination: ComponentType>; + columnFilter: ComponentType; + columnSorter: ComponentType; };