import React from 'react'; import type { MenuItemType } from '../../navigation/menu/menu.component'; /** * Interface for a table's column */ export interface Column { /** * The text that appears at the header cell of the column */ title?: string; /** * The name of the field for this column */ field?: keyof DataType; /** * The Link component of your router library of choice. If set, text within cells in this column, becomes a link. */ routerLink?: any; /** * If set, when text in this cell is clicked, it will be copied to clipboard */ enableCopyToClipboard?: boolean; /** * If true, a checkbox is shown */ checkbox?: boolean; } /** * Adds "to" property in the data provided to the table, so it can be used as a link */ export declare type TableData = (DataType & { to?: string; } & { handleCopy?: React.MouseEventHandler; })[]; export interface TableProps { /** * If set, a menu with a list of actions is shown per row. * It must be an array of objects with the following properties: * * * `handleClick`: A function that will be executed on item's `onClick` method, * e.g. `(e) => console.log(e)`. Except for `e`, the React's synthetic event, `rowId` * is also available. * * `icon`: If set, an icon is showed before text. * * `text`: Item's text. */ actions?: MenuItemType[]; /** * An array of objects with the following properties: * * Name | Type | Description | Default * --- | --- | --- | --- * title* | string | The text that appears at the header cell of the column. | - * field* | keyof DataType | The name of the field for this column. | - * link | boolean | If set, text within cells in this column, becomes a link. | - * enableCopyToClipboard | boolean | If set, when text in this cell is clicked, it will be copied to clipboard. | - * */ columns: Column[]; /** * An array of objects representing the rows of the table. For example: * `{ index: 1, name: 'Daenerys', surname: 'Targaryen', birthYear: 1977 }`. * Each property of this object must exist as `field` in `columns`. If `link` * is set in `columns`, `to` must be given a url to follow. If an empty string * is passed to `to` the link will be disabled. If `enableCopyToClipboard` * is set in `columns`, `handleOnCopy` must be passed a method to handle `onCopy` event. * Full example: `{ index: 1, name: 'Daenerys', surname: 'Targaryen', birthYear: 1977, to: '#', handleCopy: e => console.log(e) }` */ data: TableData; /** * If `true`, the table row will shade on hover. */ hover?: boolean; /** * If `true`, odd rows will have a background color. Avoid using this with hover. */ striped?: boolean; /** * A function to be invoked when the checkbox is checked in the header */ handleSelectAll?: (e: React.ChangeEvent) => void; /** * An array to hold the index of the rows the checkbox is checked for */ selected?: number[]; } /** * Tables display information in a grid-like format of rows and columns and provide * ways to query and manipulate data so that users can look for patterns and insights. */ export declare const Table: ({ actions, columns, data, hover, striped, handleSelectAll, selected, }: TableProps) => JSX.Element;