import ResizableTitle from './ResizableTitle'; export const components = { header: { cell: ResizableTitle, }, }; export const handleResize = (index: number, columns: any, setColumns: (l: any[]) => void) => (__: any, { size }) => { const newColumns = [...columns]; newColumns[index] = { ...newColumns[index], width: size.width, }; setColumns(newColumns); }; export const getMergeColumns = (columns: any[], setColumns: (l: any[]) => void) => { const mergeColumns = columns.map((col, index) => ({ ...col, onHeaderCell: (column: any) => ({ width: column.width, onResize: handleResize(index, columns, (value) => setColumns(value)), }), })); return mergeColumns; };