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

Update documentation with metadata. #125

Merged
merged 1 commit into from
Jun 15, 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
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,14 @@ A react component that implements the treeview pattern as described by the [WAI-

An array of nodes. Nodes are objects with the following structure:

| Property | Type | Default | Description |
| ---------- | -------------------- | -------- | ------------------------------------------------------------------------------------------------ |
| `id` | `number` or `string` | required | A nonnegative integer or string that uniquely identifies the node |
| `name` | `string` | required | Used to match on key press |
| `children` | `array[id]` | required | An array with the ids of the children nodes. |
| `parent` | `id` | required | The parent of the node. `null` for the root node |
| `isBranch` | `boolean` | optional | Used to indicated whether a node is branch to be able load async data onExpand, default is false |
| Property | Type | Default | Description |
| ---------- | -------------------- | -------- | --------------------------------------------------------------------------------------------------- |
| `id` | `number` or `string` | required | A nonnegative integer or string that uniquely identifies the node |
| `name` | `string` | required | Used to match on key press |
| `children` | `array[id]` | required | An array with the ids of the children nodes. |
| `parent` | `id` | required | The parent of the node. `null` for the root node |
| `isBranch` | `boolean` | optional | Used to indicated whether a node is branch to be able load async data onExpand, default is false |
| `metadata` | `object` | optional | Used to add metadata into node object. We do not currently support metadata that is a nested object |

The item with `parent:null` of the array represents the root node and won't be displayed.

Expand All @@ -73,7 +74,7 @@ const data = [
];
```

The array can also be generated from a nested object using the `flattenTree` helper (see the examples below).
The array can also be generated from a nested object using the `flattenTree` helper (see the examples below). `flattenTree` preserves `metadata`.

Data supports non-sequential ids provided by user.

Expand Down
17 changes: 9 additions & 8 deletions src/TreeView/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,14 @@ A react component that implements the treeview pattern as described by the [WAI-

An array of nodes. Nodes are objects with the following structure:

| Property | Type | Default | Description |
| ---------- | -------------------- | -------- | ------------------------------------------------------------------------------------------------ |
| `id` | `number` or `string` | required | A nonnegative integer or string that uniquely identifies the node |
| `name` | `string` | required | Used to match on key press |
| `children` | `array[id]` | required | An array with the ids of the children nodes. |
| `parent` | `id` | required | The parent of the node. `null` for the root node |
| `isBranch` | `boolean` | optional | Used to indicated whether a node is branch to be able load async data onExpand, default is false |
| Property | Type | Default | Description |
| ---------- | -------------------- | -------- | --------------------------------------------------------------------------------------------------- |
| `id` | `number` or `string` | required | A nonnegative integer or string that uniquely identifies the node |
| `name` | `string` | required | Used to match on key press |
| `children` | `array[id]` | required | An array with the ids of the children nodes. |
| `parent` | `id` | required | The parent of the node. `null` for the root node |
| `isBranch` | `boolean` | optional | Used to indicated whether a node is branch to be able load async data onExpand, default is false |
| `metadata` | `object` | optional | Used to add metadata into node object. We do not currently support metadata that is a nested object |

The item with `parent:null` of the array represents the root node and won't be displayed.

Expand All @@ -66,7 +67,7 @@ const data = [
];
```

The array can also be generated from a nested object using the <code>flattenTree</code> helper (see the examples below).
The array can also be generated from a nested object using the <code>flattenTree</code> helper (see the examples below). <code>flattenTree</code> preserves <code>metadata</code>.

Data supports non-sequential ids provided by user.

Expand Down
3 changes: 2 additions & 1 deletion website/docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ An array of nodes. Nodes are objects with the following structure:
| `children` | `array[id]` | required | An array with the ids of the children nodes. |
| `parent` | `id` | required | The parent of the node. `null` for the root node |
| `isBranch` | `boolean` | optional | Used to indicated whether a node is branch to be able load async data onExpand, default is false |
| `metadata` | `object` | optional | Used to add metadata into node object. We do not currently support metadata that is a nested object |

The item with `parent:null` of the array represents the root node and won't be displayed.

Expand All @@ -61,7 +62,7 @@ const data = [
];
```

The array can also be generated from a nested object using the `flattenTree` helper (see the examples below).
The array can also be generated from a nested object using the `flattenTree` helper (see the examples below). `flattenTree` preserves `metadata`.

Data supports non-sequential ids provided by user.

Expand Down