UNPKG

@appbuckets/react-ui

Version:
32 lines (31 loc) 908 B
import { RxTableColumnProps } from '../RxTable.types'; export interface UseColumnsConfig<Data> { /** Columns Array */ columns: RxTableColumnProps<Data>[]; /** Set if data will be selectable */ selectable?: boolean; /** Select Column Props */ selectColumnProps?: Partial< Pick< RxTableColumnProps<Data>, 'className' | 'headerClassName' | 'key' | 'textAlign' > >; /** The entire table width */ width: number; } export interface Columns<Data> { /** Arranged Columns */ columns: RxTableColumnProps<Data>[]; /** Columns width object */ columnsWidth: Record<string, number>; /** The effective table width */ effectiveTableWidth: number; /** Get single column width */ getWidth: (key: string) => number; /** The total columns width */ totalColumnsWidth: number; } export default function useColumns<Data>( config: UseColumnsConfig<Data> ): Columns<Data>;