diff --git a/COMPONENT_INDEX.md b/COMPONENT_INDEX.md index 190f7e9a..85d95461 100644 --- a/COMPONENT_INDEX.md +++ b/COMPONENT_INDEX.md @@ -4749,6 +4749,7 @@ export interface TreeNode { | Prop name | Kind | Reactive | Type | Default value | Description | | :---------- | :--------------- | :------- | :------------------------------------------------------- | ---------------------- | --------------------------------------------------------------- | +| expandedIds | let | Yes | TreeNodeId[] | [] | Set the node ids to be expanded | | selectedIds | let | Yes | TreeNodeId[] | [] | Set the node ids to be selected | | activeId | let | Yes | TreeNodeId | "" | Set the current active node id
Only one node can be active | | children | let | No | Array | [] | Provide an array of children nodes to render | diff --git a/docs/src/COMPONENT_API.json b/docs/src/COMPONENT_API.json index d4aab212..2d4834cb 100644 --- a/docs/src/COMPONENT_API.json +++ b/docs/src/COMPONENT_API.json @@ -13057,6 +13057,17 @@ "constant": false, "reactive": true }, + { + "name": "expandedIds", + "kind": "let", + "description": "Set the node ids to be expanded", + "type": "TreeNodeId[]", + "value": "[]", + "isFunction": false, + "isFunctionDeclaration": false, + "constant": false, + "reactive": true + }, { "name": "size", "kind": "let", diff --git a/docs/src/pages/framed/TreeView/TreeViewExpanded.svelte b/docs/src/pages/framed/TreeView/TreeViewExpanded.svelte index 819babd2..90743621 100644 --- a/docs/src/pages/framed/TreeView/TreeViewExpanded.svelte +++ b/docs/src/pages/framed/TreeView/TreeViewExpanded.svelte @@ -3,17 +3,16 @@ let activeId = 1; let selectedIds = []; + let expandedIds = [1, 2, 14]; let children = [ { id: 0, text: "AI / Machine learning" }, { id: 1, text: "Analytics", - expanded: true, children: [ { id: 2, text: "IBM Analytics Engine", - expanded: true, children: [ { id: 3, text: "Apache Spark" }, { id: 4, text: "Hadoop" }, @@ -52,6 +51,7 @@ children="{children}" bind:activeId bind:selectedIds + bind:expandedIds on:select="{({ detail }) => console.log('select', detail)}" on:toggle="{({ detail }) => console.log('toggle', detail)}" on:focus="{({ detail }) => console.log('focus', detail)}" @@ -59,6 +59,7 @@
Active node id: {activeId}
Selected ids: {JSON.stringify(selectedIds)}
+
Expanded ids: {JSON.stringify(expandedIds)}