mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 02:11:05 +00:00
fix(tree-view): make TreeView
children prop type work recursively (#1566)
This commit is contained in:
parent
ae34451583
commit
21d841feeb
4 changed files with 9 additions and 7 deletions
|
@ -4658,6 +4658,7 @@ export interface TreeNode {
|
|||
icon?: typeof import("svelte").SvelteComponent;
|
||||
disabled?: boolean;
|
||||
expanded?: boolean;
|
||||
children?: TreeNode[];
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -4668,7 +4669,7 @@ export interface TreeNode {
|
|||
| expandedIds | No | <code>let</code> | Yes | <code>ReadonlyArray<TreeNodeId></code> | <code>[]</code> | Set the node ids to be expanded |
|
||||
| selectedIds | No | <code>let</code> | Yes | <code>ReadonlyArray<TreeNodeId></code> | <code>[]</code> | Set the node ids to be selected |
|
||||
| activeId | No | <code>let</code> | Yes | <code>TreeNodeId</code> | <code>""</code> | Set the current active node id<br />Only one node can be active |
|
||||
| children | No | <code>let</code> | No | <code>Array<TreeNode & { children?: TreeNode[] }></code> | <code>[]</code> | Provide an array of children nodes to render |
|
||||
| children | No | <code>let</code> | No | <code>Array<TreeNode></code> | <code>[]</code> | Provide an array of children nodes to render |
|
||||
| size | No | <code>let</code> | No | <code>"default" | "compact"</code> | <code>"default"</code> | Specify the TreeView size |
|
||||
| labelText | No | <code>let</code> | No | <code>string</code> | <code>""</code> | Specify the label text |
|
||||
| hideLabel | No | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to visually hide the label text |
|
||||
|
|
|
@ -14320,7 +14320,7 @@
|
|||
"name": "children",
|
||||
"kind": "let",
|
||||
"description": "Provide an array of children nodes to render",
|
||||
"type": "Array<TreeNode & { children?: TreeNode[] }>",
|
||||
"type": "Array<TreeNode>",
|
||||
"value": "[]",
|
||||
"isFunction": false,
|
||||
"isFunctionDeclaration": false,
|
||||
|
@ -14483,9 +14483,9 @@
|
|||
"ts": "type TreeNodeId = string | number"
|
||||
},
|
||||
{
|
||||
"type": "{ id: TreeNodeId; text: string; icon?: typeof import(\"svelte\").SvelteComponent; disabled?: boolean; expanded?: boolean; }",
|
||||
"type": "{ id: TreeNodeId; text: string; icon?: typeof import(\"svelte\").SvelteComponent; disabled?: boolean; expanded?: boolean; children?: TreeNode[]; }",
|
||||
"name": "TreeNode",
|
||||
"ts": "interface TreeNode { id: TreeNodeId; text: string; icon?: typeof import(\"svelte\").SvelteComponent; disabled?: boolean; expanded?: boolean; }"
|
||||
"ts": "interface TreeNode { id: TreeNodeId; text: string; icon?: typeof import(\"svelte\").SvelteComponent; disabled?: boolean; expanded?: boolean; children?: TreeNode[]; }"
|
||||
}
|
||||
],
|
||||
"rest_props": { "type": "Element", "name": "ul" }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<script>
|
||||
/**
|
||||
* @typedef {string | number} TreeNodeId
|
||||
* @typedef {{ id: TreeNodeId; text: string; icon?: typeof import("svelte").SvelteComponent; disabled?: boolean; expanded?: boolean; }} TreeNode
|
||||
* @typedef {{ id: TreeNodeId; text: string; icon?: typeof import("svelte").SvelteComponent; disabled?: boolean; expanded?: boolean; children?: TreeNode[]; }} TreeNode
|
||||
* @event {TreeNode & { expanded: boolean; leaf: boolean; }} select
|
||||
* @event {TreeNode & { expanded: boolean; leaf: boolean; }} toggle
|
||||
* @event {TreeNode & { expanded: boolean; leaf: boolean; }} focus
|
||||
|
@ -9,7 +9,7 @@
|
|||
|
||||
/**
|
||||
* Provide an array of children nodes to render
|
||||
* @type {Array<TreeNode & { children?: TreeNode[] }>}
|
||||
* @type {Array<TreeNode>}
|
||||
*/
|
||||
export let children = [];
|
||||
|
||||
|
|
3
types/TreeView/TreeView.svelte.d.ts
vendored
3
types/TreeView/TreeView.svelte.d.ts
vendored
|
@ -9,6 +9,7 @@ export interface TreeNode {
|
|||
icon?: typeof import("svelte").SvelteComponent;
|
||||
disabled?: boolean;
|
||||
expanded?: boolean;
|
||||
children?: TreeNode[];
|
||||
}
|
||||
|
||||
export interface TreeViewProps
|
||||
|
@ -17,7 +18,7 @@ export interface TreeViewProps
|
|||
* Provide an array of children nodes to render
|
||||
* @default []
|
||||
*/
|
||||
children?: Array<TreeNode & { children?: TreeNode[] }>;
|
||||
children?: Array<TreeNode>;
|
||||
|
||||
/**
|
||||
* Set the current active node id
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue