Skip to content

Commit

Permalink
feat(Cell): make CellProps and InnerCellProps generic
Browse files Browse the repository at this point in the history
This will allow to pass a type for `rowData` (currently it resolves to `never`).
  • Loading branch information
b1rdex committed Sep 13, 2023
1 parent dc78cee commit f7cb269
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/Cell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,31 @@ import ArrowDown from '@rsuite/icons/ArrowDown';
import { StandardProps, RowDataType } from './@types/common';
import { columnHandledProps } from './Column';

export interface CellProps extends StandardProps {
export interface CellProps<T = any> extends StandardProps {
/** Data binding key, but also a sort of key */
dataKey?: string;

/** Row Number */
rowIndex?: number;

/** Row Data */
rowData?: any;
rowData?: T;
}

export interface InnerCellProps extends Omit<CellProps, 'children'> {
export interface InnerCellProps<T = any> extends Omit<CellProps<T>, 'children'> {
align?: 'left' | 'center' | 'right';
verticalAlign?: 'top' | 'middle' | 'bottom';
isHeaderCell?: boolean;
width?: number;
height?: number | ((rowData: RowDataType) => number);
height?: number | ((rowData: RowDataType<T>) => number);
left?: number;
headerHeight?: number;
style?: React.CSSProperties;
fullText?: boolean;
firstColumn?: boolean;
lastColumn?: boolean;
hasChildren?: boolean;
children?: React.ReactNode | ((rowData: RowDataType, rowIndex?: number) => React.ReactNode);
children?: React.ReactNode | ((rowData: RowDataType<T>, rowIndex?: number) => React.ReactNode);
rowKey?: string | number;
rowSpan?: number;
depth?: number;
Expand All @@ -48,13 +48,13 @@ export interface InnerCellProps extends Omit<CellProps, 'children'> {
onTreeToggle?: (
rowKey?: string | number,
rowIndex?: number,
rowData?: RowDataType,
rowData?: RowDataType<T>,
event?: React.MouseEvent
) => void;

renderTreeToggle?: (
expandButton: React.ReactNode,
rowData?: RowDataType,
rowData?: RowDataType<T>,
expanded?: boolean
) => React.ReactNode;
renderCell?: (contentChildren: any) => React.ReactNode;
Expand Down

0 comments on commit f7cb269

Please sign in to comment.