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
491b319078
commit
048c10a6ab
11 changed files with 70 additions and 47 deletions
11
types/TreeView/TreeView.svelte.d.ts
vendored
11
types/TreeView/TreeView.svelte.d.ts
vendored
|
@ -20,12 +20,6 @@ type $Props = {
|
|||
*/
|
||||
nodes?: Array<TreeNode>;
|
||||
|
||||
/**
|
||||
* Provide a flat array of nodes to render
|
||||
* @default []
|
||||
*/
|
||||
nodesFlat?: Array<TreeNode & { pid?: any }>;
|
||||
|
||||
/**
|
||||
* Set the current active node id
|
||||
* Only one node can be active
|
||||
|
@ -100,6 +94,11 @@ export default class TreeView extends SvelteComponentTyped<
|
|||
*/
|
||||
collapseAll: () => void;
|
||||
|
||||
/**
|
||||
* Create a nested array from a flat array
|
||||
*/
|
||||
toHierarchy: (flatArray: TreeNode[] & { pid?: any }[]) => TreeNode[];
|
||||
|
||||
/**
|
||||
* Programmatically expand a subset of nodes.
|
||||
* Expands all nodes if no argument is provided
|
||||
|
|
2
types/TreeView/index.d.ts
vendored
Normal file
2
types/TreeView/index.d.ts
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
export { default as TreeView } from "./TreeView.svelte";
|
||||
export { toHierarchy } from "./treeview";
|
9
types/TreeView/treeview.d.ts
vendored
Normal file
9
types/TreeView/treeview.d.ts
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
import { type TreeNode } from "carbon-components-svelte/TreeView/TreeView.svelte";
|
||||
/**
|
||||
* Create a nested array from a flat array
|
||||
*/
|
||||
export function toHierarchy(
|
||||
flatArray: TreeNode[] & { pid?: any }[],
|
||||
): TreeNode[];
|
||||
|
||||
export default toHierarchy;
|
Loading…
Add table
Add a link
Reference in a new issue