mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-16 19:01:05 +00:00
Re-work toHierarchy
utility
Refactor `toHiearchy` to be more generic, performant - Use callback to "pick" generic parent ID property instead of requiring that `pid` be hardcoded` - Account for edge cases of an invalid parent ID - Use Map to store node children for lookups - Use one pass instead of removing empty nodes at the very end - DX: use generics to type `toHierarchy` - Make `toHierarchy` even more generic (reusable with `RecursiveList`) Co-Authored-By: Bram <bramhavers@gmail.com>
This commit is contained in:
parent
651779d602
commit
5f1e8de1e1
29 changed files with 414 additions and 273 deletions
|
@ -1,6 +1,7 @@
|
|||
<script lang="ts">
|
||||
import { TreeView as TreeViewNav } from "carbon-components-svelte";
|
||||
import TreeView from "./TreeView/TreeView.test.svelte";
|
||||
import TreeViewHierarchy from "./TreeView/TreeView.hierarchy.test.svelte";
|
||||
import { onMount } from "svelte";
|
||||
|
||||
const routes = [
|
||||
|
@ -9,6 +10,11 @@
|
|||
name: "TreeView",
|
||||
component: TreeView,
|
||||
},
|
||||
{
|
||||
path: "/treeview-hierarchy",
|
||||
name: "TreeViewHierarchy",
|
||||
component: TreeViewHierarchy,
|
||||
},
|
||||
] as const;
|
||||
|
||||
let currentPath = window.location.pathname;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue