mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-16 10:51:06 +00:00
Fix that toHierarchy couldn't be found. Updated docs and test.
This commit is contained in:
parent
a29196c4a2
commit
21d599c8b6
11 changed files with 70 additions and 47 deletions
|
@ -1,7 +1,9 @@
|
|||
<script lang="ts">
|
||||
import type { ComponentProps } from "svelte";
|
||||
import { Button, TreeView } from "carbon-components-svelte";
|
||||
import type { TreeNodeId } from "carbon-components-svelte/TreeView/TreeView.svelte";
|
||||
import type {
|
||||
TreeNode,
|
||||
TreeNodeId,
|
||||
} from "carbon-components-svelte/TreeView/TreeView.svelte";
|
||||
import Analytics from "carbon-icons-svelte/lib/Analytics.svelte";
|
||||
import WatsonMachineLearning from "carbon-icons-svelte/lib/WatsonMachineLearning.svelte";
|
||||
import Blockchain from "carbon-icons-svelte/lib/Blockchain.svelte";
|
||||
|
@ -13,7 +15,7 @@
|
|||
let selectedIds: TreeNodeId[] = [];
|
||||
let expandedIds: TreeNodeId[] = [1];
|
||||
|
||||
let nodesFlat: ComponentProps<TreeView>["nodesFlat"] = [
|
||||
let nodesFlat: TreeNode[] & { pid?: any }[] = [
|
||||
{ id: 0, text: "AI / Machine learning", icon: WatsonMachineLearning },
|
||||
{ id: 1, text: "Analytics", icon: Analytics },
|
||||
{ id: 2, text: "IBM Analytics Engine", pid: 1, icon: Analytics },
|
||||
|
@ -60,7 +62,7 @@
|
|||
bind:this={treeview}
|
||||
size="compact"
|
||||
labelText="Cloud Products"
|
||||
{nodesFlat}
|
||||
nodes={treeview?.toHierarchy(nodesFlat)}
|
||||
bind:activeId
|
||||
bind:selectedIds
|
||||
bind:expandedIds
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue