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

Cds 114 allow set index of table item #163

Merged
merged 6 commits into from
Jan 27, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
/.svgrrc
/.eslintrc.js
/.prettierrc.js
/commitlint.config.js
/commitlint.config.ts
/rollup.config.mjs
/.github
/LICENSES
Expand Down
9 changes: 0 additions & 9 deletions commitlint.config.js

This file was deleted.

17 changes: 17 additions & 0 deletions commitlint.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* SPDX-FileCopyrightText: 2021 Zextras <https://www.zextras.com>
*
* SPDX-License-Identifier: AGPL-3.0-only
*/

import type { UserConfig } from '@commitlint/types';

const Configuration: UserConfig = {
/*
* Resolve and load @commitlint/config-conventional from node_modules.
* Referenced packages must be installed
*/
extends: ['@commitlint/config-conventional']
};

export default Configuration;
30 changes: 17 additions & 13 deletions src/components/display/Table.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,25 @@ The Table component can be used to list long lists.
Each element of *headers* property represent a column in the head section of the table.
If *items* is provided the column will render the *label* provided as a **Select** component, otherwise as a string.

The *HeaderFactory* is responsible of rendering the head of the Table and it receives these parameters:
The *HeaderFactory* is responsible for rendering the head of the Table, and it receives these parameters:

- items: array - Each item of items represent a column of the header
- items: array - Each item of items represents a column of the header
- onChange: func - Callback of select all rows
- allSelected: bool - Whether or not all elements of the table are selected
- selectionMode: bool - Whether or not the table is in selection mode
- multiSelect: bool - Whether or not multiple rows are selectable
- allSelected: bool - Whether all elements of the table are selected
- selectionMode: bool - Whether the table is in selection mode
- multiSelect: bool - Whether multiple rows are selectable

The *RowFactory* is responsible of rendering a single row of table and it receives these parameters:
The *RowFactory* is responsible for rendering a single row of table, and it receives these parameters:

- index: int - Index of the row, starting from 1
- index: int - Index of the row, starting from 1 if not specified in the row item itself
- item: object - Object representing the row
- onChange: func - callback of row selection
- selected: bool - Whether or not the row is selected
- selectionMode: bool - Whether or not the table is in selection mode
- clickable: bool - Whether or not the row is clickable
- multiSelect: bool - Whether or not multiple rows are selectable
- selected: bool - Whether the row is selected
- selectionMode: bool - Whether the table is in selection mode
- clickable: bool - Whether the row is clickable
- multiSelect: bool - Whether multiple rows are selectable

```jsx
```tsx
import { useState } from 'react';
import { Button, Container, Icon, Padding, Row, Text, Tooltip } from '@zextras/carbonio-design-system';

Expand Down Expand Up @@ -219,7 +219,7 @@ const items = [
/>
</>
```
### Hide checkboxes
### Hide checkboxes and show custom indexes
```jsx
import { useState } from 'react';
import { Button, Container, Icon, Padding, Row, Text, Tooltip } from '@zextras/carbonio-design-system';
Expand Down Expand Up @@ -278,23 +278,27 @@ const items = [
columns: ["30 nov 2020, 06:01 AM", "Servernamerverylong", <Container><Icon icon="Info" color="primary" /></Container>, "Zextras Backup Notifcation, Lorem ipsum dolor sit amet, consectetur adipiscing elit."],
onClick: (e) => console.log("Row clicked", e),
clickable: true,
index: 10
},
{
id: "2",
columns: ["30 nov 2020, 06:01 AM", "Servernamerverylong", <Container><Icon icon="AlertTriangle" color="warning" /></Container>, <Tooltip label="Zextras Backup Notifcation, Lorem ipsum dolor sit amet, consectetur adipiscing elit."><Text>Zextras Backup Notifcation, Lorem ipsum dolor sit amet, consectetur adipiscing elit.</Text></Tooltip>],
onClick: (e) => console.log("Row clicked", e),
index: 20
},
{
id: "3",
columns: ["30 nov 2020, 06:01 AM", "Servernamerverylong", <Container><Icon icon="CloseSquare" color="error" /></Container>, "Zextras Backup Notifcation, Lorem ipsum dolor sit amet, consectetur adipiscing elit."],
onClick: (e) => console.log("Row clicked", e),
clickable: true,
index: 30
},
{
id: "4",
columns: ["30 nov 2020, 06:01 AM", "Servernamerverylong", <Container><Icon icon="CloseSquare" color="error" /></Container>, "Zextras Backup Notifcation, Lorem ipsum dolor sit amet, consectetur adipiscing elit."],
onClick: (e) => console.log("Row clicked", e),
clickable: true,
index: 40
},
];

Expand Down
Loading