@zzwing/react-table
Version:
A react fixed table component
29 lines (25 loc) • 769 B
TypeScript
import { HTMLAttributes } from 'react'
export type PlainObject = {
[key: string]: any
}
export interface ColumnProps<T extends PlainObject = PlainObject> {
title?: React.ReactNode
key?: React.Key
dataIndex?: keyof T | string
render?: (text: any, record: T, index: number) => React.ReactNode
align?: 'left' | 'right' | 'center'
className?: string
fixed?: boolean | ('left' | 'right')
}
export type TableRowProp = Partial<HTMLAttributes<HTMLTableRowElement>>
export interface TableProp<T extends PlainObject = PlainObject> {
columns?: ColumnProps<T>[]
dataSource?: T[]
rowKey?: string
className?: string
style?: React.CSSProperties
multiLine?: boolean
offsetTop?: number
scrollBarOffset?: number
onRow?: (record: T) => TableRowProp
}