@commercetools-uikit/data-table 19.22.0 → 19.22.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -59,28 +59,44 @@ export default Example;
59
59
 
60
60
  ## Properties
61
61
 
62
- | Props | Type | Required | Default | Description |
63
- | ------------------------- | ---------------------------------------------------------------------- | :------: | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
64
- | `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`. |
65
- | `columns` | `Array: TColumn<Row>[]`<br/>[See signature.](#signature-columns) | | `[]` | Each object requires a unique `key` which should correspond to property key of&#xA;the items of `rows` that you want to render under this column, and a `label`&#xA;which defines the name shown on the header.&#xA;The list of columns to be rendered.Column item shape: [See signature.](#signature-columns). |
66
- | `customColumns` | `Array: TColumn<Row>[]`<br/>[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&#xA;the items of `rows` that you want to render under this column, and a `label`&#xA;which defines the name shown on the header.&#xA;The list of columns to be rendered. |
67
- | `footer` | `ReactNode` | | | Element to render within the `tfoot` (footer) element of the table. |
68
- | `maxWidth` | `union`<br/>Possible values:<br/>`number , string` | | | The max width (a number of pixels or a css value string with units) for which the table&#xA;is allowed to grow. If unset, the table will grow horizontally to fill its parent. |
69
- | `maxHeight` | `union`<br/>Possible values:<br/>`number , string` | | | The max height (a number of pixels or a css value string with units) for which the table&#xA;is allowed to grow. If unset, the table will grow vertically to fill its parent and we are able to have a sticky header. |
70
- | `onRowClick` | `Function`<br/>[See signature.](#signature-onRowClick) | | | A callback function, called when a user clicks on a row. |
71
- | `isCondensed` | `boolean` | | `true` | Set this to `true` to reduce the paddings of all cells, allowing the table to display&#xA;more data in less space. |
72
- | `onColumnResized` | `Function`<br/>[See signature.](#signature-onColumnResized) | | | A callback function, called when a column has been resized.&#xA;Use this callback to get the resized column widths and save them, to be able to restore the&#xA;value once the user comes back to the page. |
73
- | `disableSelfContainment` | `boolean` | | `false` | Set this to `true` to take control of the containment of the table and doing it on a parent element.&#xA;This means that the table will grow in size without adding scrollbars on itself,&#xA;both vertically and horizontally and, as a consequence, the `maxHeight` and `maxWidth` props are ignored.&#xA;If you need to enforce these constraints, you must also apply them on the parent element.&#xA;Additionally, the sticky behaviour of the header will get fixed relatively to the closest&#xA;parent element with `position: relative`. |
74
- | `disableHeaderStickiness` | `boolean` | | | Set this to `true` to prevent the header from being sticky.&#xA;The header can be sticky only if the table does not have a `maxHeight` set. |
75
- | `itemRenderer` | `Function`<br/>[See signature.](#signature-itemRenderer) | | `(row, column) => row[column.key]` | The default function used to render the content of each item in a cell.&#xA;In case a column has its own `renderItem` render function, it will take precedence over this function. |
76
- | `wrapHeaderLabels` | `boolean` | | `true` | Set this to `false` to ensure that every column can render their label in one line.&#xA;By default the header cell grows in height in case the label does not fit in one line. |
77
- | `verticalCellAlignment` | `union`<br/>Possible values:<br/>`'top' , 'center' , 'bottom'` | | `'top'` | The default cell vertical alignment of each row (not the table header). |
78
- | `horizontalCellAlignment` | `union`<br/>Possible values:<br/>`'left' , 'center' , 'right'` | | `'left'` | The default cell horizontal alignment.&#xA;In case a column has its own `align` property, it will take precedence over this value. |
79
- | `sortedBy` | `string` | | | The key of the column for which the data is currently sorted by. |
80
- | `onSortChange` | `Function`<br/>[See signature.](#signature-onSortChange) | | | A callback function, called when a sortable column's header is clicked.&#xA;It's required when the `isSortable` flag is set on at least one column. |
81
- | `sortDirection` | `union`<br/>Possible values:<br/>`'desc' , 'asc'` | | | The sorting direction. |
82
- | `renderNestedRow` | `Function`<br/>[See signature.](#signature-renderNestedRow) | | | Custom row renderer for nested rows. |
83
- | `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,&#xA;a scrollbar should make provision for the overflow. |
62
+ | Props | Type | Required | Default | Description |
63
+ | --------- | ---------------------------------------------------------------- | :------: | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
64
+ | `rows` | `Array: Row[]` | ✅ | | The list of data that needs to be rendered in the table. Each object in the list can&#xA;have any shape as long as it has a unique identifier.&#xA;The data is rendered by using the callback render function `itemRenderer`. |
65
+ | `columns` | `Array: TColumn<Row>[]`<br/>[See signature.](#signature-columns) | | `[]` | Each object requires a unique `key` which should correspond to property key of&#xA;the items of `rows` that you want to render under this column, and a `label`&#xA;which defines the name shown on the header.&#xA;The list of columns to be rendered.Column item shape:``` |
66
+
67
+ {
68
+ key: string;
69
+ label: ReactNode;
70
+ width?: string;
71
+ align?: 'left' | 'center' | 'right';
72
+ onClick?: (event: MouseEventHandler) => void;
73
+ renderItem?: (row: Row, isRowCollapsed: boolean) => ReactNode;
74
+ headerIcon?: ReactNode;
75
+ isTruncated?: boolean;
76
+ isSortable?: boolean;
77
+ disableResizing?: boolean;
78
+ shouldIgnoreRowClick?: boolean;
79
+ }
80
+
81
+ ````[Colum signatures with description](/?path=/docs/components-datatable-readme--props#signatures) |
82
+ | `customColumns` | `Array: TColumn<Row>[]`<br/>[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&#xA;the items of `rows` that you want to render under this column, and a `label`&#xA;which defines the name shown on the header.&#xA;The list of columns to be rendered. |
83
+ | `footer` | `ReactNode` | | | Element to render within the `tfoot` (footer) element of the table. |
84
+ | `maxWidth` | `union`<br/>Possible values:<br/>`number , string` | | | The max width (a number of pixels or a css value string with units) for which the table&#xA;is allowed to grow. If unset, the table will grow horizontally to fill its parent. |
85
+ | `maxHeight` | `union`<br/>Possible values:<br/>`number , string` | | | The max height (a number of pixels or a css value string with units) for which the table&#xA;is allowed to grow. If unset, the table will grow vertically to fill its parent and we are able to have a sticky header. |
86
+ | `onRowClick` | `Function`<br/>[See signature.](#signature-onRowClick) | | | A callback function, called when a user clicks on a row. |
87
+ | `isCondensed` | `boolean` | | `true` | Set this to `true` to reduce the paddings of all cells, allowing the table to display&#xA;more data in less space. |
88
+ | `onColumnResized` | `Function`<br/>[See signature.](#signature-onColumnResized) | | | A callback function, called when a column has been resized.&#xA;Use this callback to get the resized column widths and save them, to be able to restore the&#xA;value once the user comes back to the page. |
89
+ | `disableSelfContainment` | `boolean` | | `false` | Set this to `true` to take control of the containment of the table and doing it on a parent element.&#xA;This means that the table will grow in size without adding scrollbars on itself,&#xA;both vertically and horizontally and, as a consequence, the `maxHeight` and `maxWidth` props are ignored.&#xA;If you need to enforce these constraints, you must also apply them on the parent element.&#xA;Additionally, the sticky behaviour of the header will get fixed relatively to the closest&#xA;parent element with `position: relative`. |
90
+ | `disableHeaderStickiness` | `boolean` | | | Set this to `true` to prevent the header from being sticky.&#xA;The header can be sticky only if the table does not have a `maxHeight` set. |
91
+ | `itemRenderer` | `Function`<br/>[See signature.](#signature-itemRenderer) | | `(row, column) => row[column.key]` | The default function used to render the content of each item in a cell.&#xA;In case a column has its own `renderItem` render function, it will take precedence over this function. |
92
+ | `wrapHeaderLabels` | `boolean` | | `true` | Set this to `false` to ensure that every column can render their label in one line.&#xA;By default the header cell grows in height in case the label does not fit in one line. |
93
+ | `verticalCellAlignment` | `union`<br/>Possible values:<br/>`'top' , 'center' , 'bottom'` | | `'top'` | The default cell vertical alignment of each row (not the table header). |
94
+ | `horizontalCellAlignment` | `union`<br/>Possible values:<br/>`'left' , 'center' , 'right'` | | `'left'` | The default cell horizontal alignment.&#xA;In case a column has its own `align` property, it will take precedence over this value. |
95
+ | `sortedBy` | `string` | | | The key of the column for which the data is currently sorted by. |
96
+ | `onSortChange` | `Function`<br/>[See signature.](#signature-onSortChange) | | | A callback function, called when a sortable column's header is clicked.&#xA;It's required when the `isSortable` flag is set on at least one column. |
97
+ | `sortDirection` | `union`<br/>Possible values:<br/>`'desc' , 'asc'` | | | The sorting direction. |
98
+ | `renderNestedRow` | `Function`<br/>[See signature.](#signature-renderNestedRow) | | | Custom row renderer for nested rows. |
99
+ | `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,&#xA;a scrollbar should make provision for the overflow. |
84
100
 
85
101
  ## Signatures
86
102
 
@@ -273,3 +289,4 @@ export default Example;
273
289
  ```ts
274
290
  (row: Row) => ReactNode;
275
291
  ```
292
+ ````