import { KeyOf } from 'codekit'; import { BaseComponentProps } from '../../types'; export interface TableLoading { isLoading: boolean; type: 'flat' | 'detailed'; } export interface TableDataType { id: string; } export interface TableStyle { columns: string; borderRadius: string; foreground: string; rowsGap: string; rowMinHeight: string; rowHorizontalPadding: string; rowVerticalPadding: string; columnsGap: string; columnTextColor: string; columnTextSize: string; columnTextWeight: string; } export interface TableAction { content: ((data: T) => string | JSX.Element) | string | JSX.Element; linkTo?: ((data: T) => string) | string; onClick?: (data: T) => void; disabled?: ((data: T) => boolean) | boolean; destructive?: ((data: T) => boolean) | boolean; } export interface TableProps extends BaseComponentProps { data: T[]; columns: Partial>; loading?: boolean | TableLoading; selectable?: boolean; sortable?: boolean; searchable?: boolean; pageable?: boolean; noDataAvailable?: boolean; style?: Partial; pagination?: { size: number; }; actions?: TableAction[]; sort?: (keyof T)[]; search?: KeyOf[]; searchQuery?: string; customColumns?: Partial any>>; customColumnsHeader?: Partial any>>; handlers?: (props: TableProps) => JSX.Element; onCompleteSelection?: (selected: T[]) => void; labels?: { selectionConfirm?: string; }; } export interface TablePropsCompiled extends TableProps { data: Required>['data']; columns: Required>['columns']; loading: Required>['loading']; selectable: Required>['selectable']; sortable: Required>['sortable']; actions: Required>['actions']; pagination: Required>['pagination']; style: Required>['style']; }