import React from 'react'; import { BusterListColumn } from './interfaces'; import { CheckboxColumn } from './CheckboxColumn'; import { Text } from '@/components/ui'; import { cn } from '@/lib/classMerge'; import { HEIGHT_OF_HEADER } from './config'; export const BusterListHeader: React.FC<{ columns: BusterListColumn[]; onGlobalSelectChange?: (v: boolean) => void; globalCheckStatus?: 'checked' | 'unchecked' | 'indeterminate'; showSelectAll?: boolean; rowsLength: number; rowClassName: string; }> = React.memo( ({ columns, rowClassName, showSelectAll = true, onGlobalSelectChange, globalCheckStatus, rowsLength }) => { const showCheckboxColumn = !!onGlobalSelectChange; const showGlobalCheckbox = globalCheckStatus === 'indeterminate' || globalCheckStatus === 'checked'; return (
{showCheckboxColumn && ( )} {columns.map((column, index) => (
{column.headerRender ? ( column.headerRender(column.title) ) : ( {column.title} )}
))}
); } ); BusterListHeader.displayName = 'BusterListHeader';