Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: tune Table readme #1215

Merged
merged 1 commit into from
Dec 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 27 additions & 27 deletions src/components/Table/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,36 +24,36 @@ Additional functionality is enabled via HOCs:

## Properties

| Name | Description | Type | Default |
| :--------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------: | :---------: |
| data | Data | `any[]` | |
| columns | Column parameters | `TableColumnConfig[]` | |
| verticalAlign | Vertical alignment of contents | `"top"` `"middle"` | |
| getRowId | The row ID, used when selecting and sorting rows. If you skip a row, its ID will be the value of the field in the row data with the same name as the column ID | `string` `((item: any, index: number) => string)` | |
| getRowClassNames | Row CSS classes | `(item: any, index: number) => string[]` | |
| isRowDisabled | Condition for disabling columns | `(item: any, index: number) => boolean` | |
| onRowClick | Row click handler | `(item: any, index: number, event: React.MouseEvent<HTMLTableRowElement>) => void` | |
| onRowMouseEnter | Row mouseenter handler | `(item: any, index: number, event: React.MouseEvent<HTMLTableRowElement>) => void` | |
| onRowMouseLeave | Row mouseleave handler | `(item: any, index: number, event: React.MouseEvent<HTMLTableRowElement>) => void` | |
| emptyMessage | The message returned if data is missing. | `string` | `"No data"` |
| className | Table CSS class | `string` | |
| edgePadding | Adds horizontal padding for edge cells | `boolean` | |
| Name | Description | Type | Default |
| :------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :--------------------------------------------------------------------------------: | :---------: |
| data | Data | `any[]` | |
| columns | Column parameters | `TableColumnConfig[]` | |
| verticalAlign | Vertical alignment of contents | `"top"` `"middle"` | |
| getRowId | The row ID, used when selecting and sorting rows. If you skip a row, its ID will be the value of the field in the row data with the same name as the column ID | `string` `((item: any, index: number) => string)` | |
| getRowClassNames | Row CSS classes | `(item: any, index: number) => string[]` | |
| isRowDisabled | Condition for disabling columns | `(item: any, index: number) => boolean` | |
| onRowClick | Row click handler | `(item: any, index: number, event: React.MouseEvent<HTMLTableRowElement>) => void` | |
| onRowMouseEnter | Row mouseenter handler | `(item: any, index: number, event: React.MouseEvent<HTMLTableRowElement>) => void` | |
| onRowMouseLeave | Row mouseleave handler | `(item: any, index: number, event: React.MouseEvent<HTMLTableRowElement>) => void` | |
| emptyMessage | The message returned if data is missing. | `string` | `"No data"` |
| className | Table CSS class | `string` | |
| edgePadding | Adds horizontal padding for edge cells | `boolean` | |
| stickyHorizontalScroll | A horizontal sticky scroll in a table. NB: A table cannot have a fixed height and a sticky scroll at the same time. A sticky scroll will not work if the table has an overflow. | `boolean` | `false` |
| stickyHorizontalScrollBreakpoint | The threshold that the parent block should reach before making a scroll sticky. This is useful in the console, for example, when the groupActions bar closes the scroll. | `number` | `0` |

### TableColumnConfig

| Name | Description | Type | Default |
| :------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :--------------------------------------------------------: | :---------------------------------------------------------: |
| id | Column ID | `any[]` | |
| name | Column name (header) | `string` `(() => React.ReactNode)` | column ID |
| placeholder | The stub when there is no data in a cell | `string` `((item: any, index: number) => React.ReactNode)` | `— (&mdash;)` |
| template | Cell contents. If you skip a row, the cell contents will be the value of the field with the same name as this row. | `string` `((item: any, index: number) => React.ReactNode)` | The value of the field with the name equal to the column ID |
| align | Content alignment | `"left"` `"center"` `"right"` | |
| sticky | Sticky column | `"left"` `"right"` | |
| primary | Distinguishes a column among other | `boolean` | |
| width | Column width in px | `number` | |
| stickyHorizontalScroll | A horizontal sticky scroll in a table. NB: A table cannot have a fixed height and a sticky scroll at the same time. A sticky scroll will not work if the table has an overflow. | `boolean` | `false` |
| stickyHorizontalScrollBreakpoint | The threshold that the parent block should reach before making a scroll sticky. This is useful in the console, for example, when the groupActions bar closes the scroll. | `number` | `0` |
| meta | Various data, HOC settings | `Record<string, any>` | |
| Name | Description | Type | Default |
| :---------- | :----------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------: | :---------------------------------------------------------: |
| id | Column ID | `any[]` | |
| name | Column name (header) | `string` `(() => React.ReactNode)` | column ID |
| placeholder | The stub when there is no data in a cell | `string` `((item: any, index: number) => React.ReactNode)` | `— (&mdash;)` |
| template | Cell contents. If you skip a row, the cell contents will be the value of the field with the same name as this row. | `string` `((item: any, index: number) => React.ReactNode)` | The value of the field with the name equal to the column ID |
| align | Content alignment | `"left"` `"center"` `"right"` | |
| sticky | Sticky column | `"left"` `"right"` | |
| primary | Distinguishes a column among other | `boolean` | |
| width | Column width in px | `number` | |
| meta | Various data, HOC settings | `Record<string, any>` | |

## Usage with HOC `withTableActions`

Expand Down
Loading