diff --git a/docs/src/pages/components/RecursiveList.svx b/docs/src/pages/components/RecursiveList.svx index d5941bdafe..fba581d110 100644 --- a/docs/src/pages/components/RecursiveList.svx +++ b/docs/src/pages/components/RecursiveList.svx @@ -37,4 +37,11 @@ Set `type` to `"ordered"` to use the ordered list variant. Set `type` to `"ordered-native"` to use the native styles for an ordered list. - \ No newline at end of file + + +## Flat data structure + +If working with a flat data structure, use the `toHierarchy` utility +to convert a flat data structure into a hierarchical array accepted by the `nodes` prop. + + diff --git a/docs/src/pages/framed/RecursiveList/RecursiveListFlatArray.svelte b/docs/src/pages/framed/RecursiveList/RecursiveListFlatArray.svelte new file mode 100644 index 0000000000..356ffb45d1 --- /dev/null +++ b/docs/src/pages/framed/RecursiveList/RecursiveListFlatArray.svelte @@ -0,0 +1,20 @@ + + + node.pid)} /> diff --git a/src/TreeView/index.d.ts b/src/TreeView/index.d.ts index 52e3204e61..59f96be0f3 100644 --- a/src/TreeView/index.d.ts +++ b/src/TreeView/index.d.ts @@ -1,2 +1 @@ export { default as TreeView } from "./TreeView.svelte"; -export { toHierarchy } from "./treeview"; diff --git a/src/TreeView/index.js b/src/TreeView/index.js index 52e3204e61..59f96be0f3 100644 --- a/src/TreeView/index.js +++ b/src/TreeView/index.js @@ -1,2 +1 @@ export { default as TreeView } from "./TreeView.svelte"; -export { toHierarchy } from "./treeview"; diff --git a/src/index.js b/src/index.js index 75a2c8dcc9..e28120a430 100644 --- a/src/index.js +++ b/src/index.js @@ -127,7 +127,6 @@ export { Tooltip, TooltipFooter } from "./Tooltip"; export { TooltipDefinition } from "./TooltipDefinition"; export { TooltipIcon } from "./TooltipIcon"; export { TreeView } from "./TreeView"; -export { toHierarchy } from "./TreeView/treeview"; export { Truncate } from "./Truncate"; export { default as truncate } from "./Truncate/truncate"; export { @@ -153,3 +152,4 @@ export { HeaderSearch, } from "./UIShell"; export { UnorderedList } from "./UnorderedList"; +export { toHierarchy } from "./utils/toHierarchy"; diff --git a/src/TreeView/treeview.d.ts b/src/utils/toHierarchy.d.ts similarity index 100% rename from src/TreeView/treeview.d.ts rename to src/utils/toHierarchy.d.ts diff --git a/src/TreeView/treeview.js b/src/utils/toHierarchy.js similarity index 100% rename from src/TreeView/treeview.js rename to src/utils/toHierarchy.js diff --git a/tests/TreeView/TreeView.hierarchy.test.svelte b/tests/TreeView/TreeView.hierarchy.test.svelte index 86d2c62fe7..492a33e38b 100644 --- a/tests/TreeView/TreeView.hierarchy.test.svelte +++ b/tests/TreeView/TreeView.hierarchy.test.svelte @@ -1,6 +1,6 @@