type SortFunction = (_a: any, _b: any) => number; type OnSort = (_column: string, _sorting: 'default' | 'desc' | 'asc') => SortFunction; interface Column { /** value of this key `props.data[key]` will be rendered into `` */ key: string; /** for display as column title */ label: string; /** align column. `left|right|center|justify`
* @see https://www.w3schools.com/tags/att_td_align.asp */ align?: 'left' | 'center' | 'right' | 'justify'; /** column render function
* if not provide will simply render the value of that key
* * @param {any} columnData value of `props.data[i][key]`
* @param {object} allColumns `props.data[i]`
* @param {array} allRows `props.data`
*/ render?: (_columnData: any, _allColumns: Record, _allRows: any[]) => void; /** `` become sortable when provided, * get called when user click on the column title
* you can choose to take care of the sorting yourself * and update `props.data`
* optionally returns a sorting function that will get passed into * `Array.proptotype.sort()`.
* e.g. `(a, b) => b - a`
* * @param {string} column key
* @param {string} sorting order, one of: `default`, `desc`, `asc`
* @returns {func} [optional] this function will be use as the sorting function (frontend only)
*/ onSort?: OnSort; } interface Props { /** enable hover style for row */ hoverable?: boolean; /** enable alternate style for row */ alternate?: boolean; /** columns controls */ columns: Column[]; /** table data */ data: Record[]; /** the unique property (usually id) of individual object in `props.data` */ uniqueKey?: string; /** get called when row is clicked * @param {object} data contains row data `props.data[i]`
* @param {string} key the value of the `uniqueKey` set
*/ onRowClick?: (_data: Record, _key: string) => void; /** Rest Props */ [rest: string]: any; } declare const Table: ({ hoverable, alternate, columns, data, uniqueKey, onRowClick, ...rest }: Props) => import("@emotion/react/jsx-runtime").JSX.Element; export default Table;