Skip to content

Commit

Permalink
Update documentation with metadata.
Browse files Browse the repository at this point in the history
  • Loading branch information
kpustakhod committed Jun 12, 2023
1 parent 3826ee4 commit 4dc9778
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 17 deletions.
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

0 comments on commit 4dc9778

Please sign in to comment.