UNPKG

@jigoooo/shared-ui

Version:

A reusable React component library and design system with TypeScript support, built on Vite for seamless integration and optimized performance.

41 lines (40 loc) 1.65 kB
import { THeader } from './table-type.ts'; export declare function useTableSorting<TData>({ headers, dataList, isMultipleSorting, }: { headers: THeader<TData>[]; dataList: TData[]; isMultipleSorting?: boolean; }): { sortedDataList: TData[]; sortedHeaders: { sorter: { direction: "desc" | "asc" | null; sortable: boolean; }; id: "button" | "index" | "check" | Extract<keyof TData, string>; label: string; width: number; cell?: (({ cellData, rowData, setCellData, handleRowData, deleteRow, tableStyle, }: { cellData: any; rowData: TData; handleRowData: (key: keyof TData, value: any) => void; deleteRow: () => void; setCellData: (value: any) => void; tableStyle: import('./table-type.ts').TTableStyle; }) => import('react').ReactNode) | undefined; editCell?: (({ inputRef, cellData, rowData, setCellData, handleRowData, tableStyle, exitEditMode, }: import('./table-type.ts').TEditCell<TData>) => import('react').ReactNode) | undefined; formatter?: (({ cellData, rowData }: { cellData: any; rowData: TData; }) => string | number) | undefined; pin: "view" | "left" | "right"; headerAlign?: "left" | "center" | "right"; dataAlign: "left" | "center" | "right"; filter?: { filterType: "text" | "select"; filterCondition?: (filterValue: string) => boolean; filterValue: string; }; }[]; handleSort: (key: string) => void; resetSort: () => void; };