diff --git a/packages/components/data-table/README.md b/packages/components/data-table/README.md index 704191f207..71224a7b30 100644 --- a/packages/components/data-table/README.md +++ b/packages/components/data-table/README.md @@ -59,44 +59,28 @@ export default Example; ## Properties -| Props | Type | Required | Default | Description | -| --------- | ---------------------------------------------------------------- | :------: | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `rows` | `Array: Row[]` | ✅ | | The list of data that needs to be rendered in the table. Each object in the list can have any shape as long as it has a unique identifier. The data is rendered by using the callback render function `itemRenderer`. | -| `columns` | `Array: TColumn[]`
[See signature.](#signature-columns) | | `[]` | Each object requires a unique `key` which should correspond to property key of the items of `rows` that you want to render under this column, and a `label` which defines the name shown on the header. The list of columns to be rendered.Column item shape:``` | - -{ -key: string; -label: ReactNode; -width?: string; -align?: 'left' | 'center' | 'right'; -onClick?: (event: MouseEventHandler) => void; -renderItem?: (row: Row, isRowCollapsed: boolean) => ReactNode; -headerIcon?: ReactNode; -isTruncated?: boolean; -isSortable?: boolean; -disableResizing?: boolean; -shouldIgnoreRowClick?: boolean; -} - -````[Colum signatures with description](/?path=/docs/components-datatable-readme--props#signatures) | -| `customColumns` | `Array: TColumn[]`
[See signature.](#signature-customColumns) | | | The columns of the nested items to be rendered in the table. Just like the columns, Each object requires a unique `key` which should correspond to property key of the items of `rows` that you want to render under this column, and a `label` which defines the name shown on the header. The list of columns to be rendered. | -| `footer` | `ReactNode` | | | Element to render within the `tfoot` (footer) element of the table. | -| `maxWidth` | `union`
Possible values:
`number , string` | | | The max width (a number of pixels or a css value string with units) for which the table is allowed to grow. If unset, the table will grow horizontally to fill its parent. | -| `maxHeight` | `union`
Possible values:
`number , string` | | | The max height (a number of pixels or a css value string with units) for which the table is allowed to grow. If unset, the table will grow vertically to fill its parent and we are able to have a sticky header. | -| `onRowClick` | `Function`
[See signature.](#signature-onRowClick) | | | A callback function, called when a user clicks on a row. | -| `isCondensed` | `boolean` | | `true` | Set this to `true` to reduce the paddings of all cells, allowing the table to display more data in less space. | -| `onColumnResized` | `Function`
[See signature.](#signature-onColumnResized) | | | A callback function, called when a column has been resized. Use this callback to get the resized column widths and save them, to be able to restore the value once the user comes back to the page. | -| `disableSelfContainment` | `boolean` | | `false` | Set this to `true` to take control of the containment of the table and doing it on a parent element. This means that the table will grow in size without adding scrollbars on itself, both vertically and horizontally and, as a consequence, the `maxHeight` and `maxWidth` props are ignored. If you need to enforce these constraints, you must also apply them on the parent element. Additionally, the sticky behaviour of the header will get fixed relatively to the closest parent element with `position: relative`. | -| `disableHeaderStickiness` | `boolean` | | | Set this to `true` to prevent the header from being sticky. The header can be sticky only if the table does not have a `maxHeight` set. | -| `itemRenderer` | `Function`
[See signature.](#signature-itemRenderer) | | `(row, column) => row[column.key]` | The default function used to render the content of each item in a cell. In case a column has its own `renderItem` render function, it will take precedence over this function. | -| `wrapHeaderLabels` | `boolean` | | `true` | Set this to `false` to ensure that every column can render their label in one line. By default the header cell grows in height in case the label does not fit in one line. | -| `verticalCellAlignment` | `union`
Possible values:
`'top' , 'center' , 'bottom'` | | `'top'` | The default cell vertical alignment of each row (not the table header). | -| `horizontalCellAlignment` | `union`
Possible values:
`'left' , 'center' , 'right'` | | `'left'` | The default cell horizontal alignment. In case a column has its own `align` property, it will take precedence over this value. | -| `sortedBy` | `string` | | | The key of the column for which the data is currently sorted by. | -| `onSortChange` | `Function`
[See signature.](#signature-onSortChange) | | | A callback function, called when a sortable column's header is clicked. It's required when the `isSortable` flag is set on at least one column. | -| `sortDirection` | `union`
Possible values:
`'desc' , 'asc'` | | | The sorting direction. | -| `renderNestedRow` | `Function`
[See signature.](#signature-renderNestedRow) | | | Custom row renderer for nested rows. | -| `maxExpandableHeight` | `number` | | | If this is provided, then it should control the height of the expanded rows. In the event where there is more content than the maxHeight, a scrollbar should make provision for the overflow. | +| Props | Type | Required | Default | Description | +| ------------------------- | ---------------------------------------------------------------------- | :------: | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `rows` | `Array: Row[]` | ✅ | | The list of data that needs to be rendered in the table. Each object in the list can have any shape as long as it has a unique identifier. The data is rendered by using the callback render function `itemRenderer`. | +| `columns` | `Array: TColumn[]`
[See signature.](#signature-columns) | | `[]` | Each object requires a unique `key` which should correspond to property key of the items of `rows` that you want to render under this column, and a `label` which defines the name shown on the header. The list of columns to be rendered.Column item shape: [See signature.](#signature-columns). | +| `customColumns` | `Array: TColumn[]`
[See signature.](#signature-customColumns) | | | The columns of the nested items to be rendered in the table. Just like the columns, Each object requires a unique `key` which should correspond to property key of the items of `rows` that you want to render under this column, and a `label` which defines the name shown on the header. The list of columns to be rendered. | +| `footer` | `ReactNode` | | | Element to render within the `tfoot` (footer) element of the table. | +| `maxWidth` | `union`
Possible values:
`number , string` | | | The max width (a number of pixels or a css value string with units) for which the table is allowed to grow. If unset, the table will grow horizontally to fill its parent. | +| `maxHeight` | `union`
Possible values:
`number , string` | | | The max height (a number of pixels or a css value string with units) for which the table is allowed to grow. If unset, the table will grow vertically to fill its parent and we are able to have a sticky header. | +| `onRowClick` | `Function`
[See signature.](#signature-onRowClick) | | | A callback function, called when a user clicks on a row. | +| `isCondensed` | `boolean` | | `true` | Set this to `true` to reduce the paddings of all cells, allowing the table to display more data in less space. | +| `onColumnResized` | `Function`
[See signature.](#signature-onColumnResized) | | | A callback function, called when a column has been resized. Use this callback to get the resized column widths and save them, to be able to restore the value once the user comes back to the page. | +| `disableSelfContainment` | `boolean` | | `false` | Set this to `true` to take control of the containment of the table and doing it on a parent element. This means that the table will grow in size without adding scrollbars on itself, both vertically and horizontally and, as a consequence, the `maxHeight` and `maxWidth` props are ignored. If you need to enforce these constraints, you must also apply them on the parent element. Additionally, the sticky behaviour of the header will get fixed relatively to the closest parent element with `position: relative`. | +| `disableHeaderStickiness` | `boolean` | | | Set this to `true` to prevent the header from being sticky. The header can be sticky only if the table does not have a `maxHeight` set. | +| `itemRenderer` | `Function`
[See signature.](#signature-itemRenderer) | | `(row, column) => row[column.key]` | The default function used to render the content of each item in a cell. In case a column has its own `renderItem` render function, it will take precedence over this function. | +| `wrapHeaderLabels` | `boolean` | | `true` | Set this to `false` to ensure that every column can render their label in one line. By default the header cell grows in height in case the label does not fit in one line. | +| `verticalCellAlignment` | `union`
Possible values:
`'top' , 'center' , 'bottom'` | | `'top'` | The default cell vertical alignment of each row (not the table header). | +| `horizontalCellAlignment` | `union`
Possible values:
`'left' , 'center' , 'right'` | | `'left'` | The default cell horizontal alignment. In case a column has its own `align` property, it will take precedence over this value. | +| `sortedBy` | `string` | | | The key of the column for which the data is currently sorted by. | +| `onSortChange` | `Function`
[See signature.](#signature-onSortChange) | | | A callback function, called when a sortable column's header is clicked. It's required when the `isSortable` flag is set on at least one column. | +| `sortDirection` | `union`
Possible values:
`'desc' , 'asc'` | | | The sorting direction. | +| `renderNestedRow` | `Function`
[See signature.](#signature-renderNestedRow) | | | Custom row renderer for nested rows. | +| `maxExpandableHeight` | `number` | | | If this is provided, then it should control the height of the expanded rows. In the event where there is more content than the maxHeight, a scrollbar should make provision for the overflow. | ## Signatures @@ -178,7 +162,7 @@ shouldIgnoreRowClick?: boolean; */ shouldIgnoreRowClick?: boolean; } -```` +``` ### Signature `customColumns`