UNPKG

data-table-material

Version:

A dynamic and customizable table component for React, built with Material UI & TypeScript.

30 lines (29 loc) 2.18 kB
import { IDataTable } from '../types'; /** * A generic, reusable DataTable component for rendering tabular data with optional features * such as pagination, expandable rows, and additional columns. The component is highly customizable * and supports localization, dynamic column visibility, and resizable columns. * * @template T - The type of the data rows, extending `Record<string, any>`. * * @param {IDataTable.Props<T>} props - The props for the DataTable component. * @param {boolean} [props.serialNumber] - Whether to display a serial number column. * @param {T[]} props.rows - The data rows to be displayed in the table. * @param {IDataTable.Column[]} props.columns - The column definitions for the table. * @param {boolean} [props.pagination=false] - Whether to enable pagination. * @param {IDataTable.PaginationData} [props.paginationData] - The pagination data, if pagination is enabled. * @param {(data: IDataTable.PaginationData) => void} [props.onChangePaginationData] - Callback for handling pagination changes. * @param {IDataTable.AdditionalColumn[]} [props.additionalColumns] - Additional columns to be appended to the table. * @param {(row: T) => void} [props.onRowClick] - Callback for handling row click events. * @param {React.CSSProperties} [props.containerStyle={}] - Custom styles for the table container. * @param {React.CSSProperties} [props.paperStyle={}] - Custom styles for the paper container. * @param {string[]} [props.visibleColumns] - A list of column keys to control column visibility. * @param {IDataTable.ExpandableTableConfig<T>} [props.getExpandableTableConfig] - Configuration for expandable rows. * @param {"small" | "medium"} [props.size="small"] - The size of the table rows. * @param {(key: string) => string} [props.getLocalizedText] - Function to retrieve localized text for column headers and labels. * @param {object} [props.rest] - Additional props to be passed to the underlying `<Table>` component. * * @returns {React.JSX.Element} The rendered DataTable component. */ declare const DataTable: <T extends IDataTable.GenericRecord>(props: IDataTable.Props<T>) => React.JSX.Element; export default DataTable;