From 24d0cab4fe96b8a01a58ea8d34dd0b529914db94 Mon Sep 17 00:00:00 2001 From: metonym Date: Wed, 13 Oct 2021 08:29:48 -0700 Subject: [PATCH] docs(tree-view): document TreeView accessors --- docs/src/pages/components/TreeView.svx | 32 ++++++++- .../TreeView/TreeViewCollapseAll.svelte | 63 ++++++++++++++++ .../TreeView/TreeViewCollapseNodes.svelte | 71 +++++++++++++++++++ .../framed/TreeView/TreeViewExpandAll.svelte | 61 ++++++++++++++++ .../TreeView/TreeViewExpandNodes.svelte | 67 +++++++++++++++++ 5 files changed, 293 insertions(+), 1 deletion(-) create mode 100644 docs/src/pages/framed/TreeView/TreeViewCollapseAll.svelte create mode 100644 docs/src/pages/framed/TreeView/TreeViewCollapseNodes.svelte create mode 100644 docs/src/pages/framed/TreeView/TreeViewExpandAll.svelte create mode 100644 docs/src/pages/framed/TreeView/TreeViewExpandNodes.svelte diff --git a/docs/src/pages/components/TreeView.svx b/docs/src/pages/components/TreeView.svx index 4cd34e29..daaf5205 100644 --- a/docs/src/pages/components/TreeView.svx +++ b/docs/src/pages/components/TreeView.svx @@ -45,4 +45,34 @@ Expanded nodes can be set using `expandedIds`. Initial multiple selected nodes can be set using `selectedIds`. - \ No newline at end of file + + +### Expand all nodes + +To programmatically expand all nodes, access the component instance using the [bind:this](https://svelte.dev/docs#bind_element) directive and invoke the `TreeView.expandAll()` method to expand all nodes. + + + +### Collapse all nodes + +Similarly, invoke `TreeView.collapseAll()` to collapse all nodes. + + + +### Expand a subset of nodes + +Use the `TreeView.expandNodes` method to expand only a subset of nodes. + +The method accepts an argument that takes a node and returns a boolean. + +If no argument is provided, all nodes will be expanded. + + + +### Collapse a subset of nodes + +Use the `TreeView.collapseNodes` method to collapse a subset of nodes. + +If no argument is provided, all nodes will be collapsed. + + \ No newline at end of file diff --git a/docs/src/pages/framed/TreeView/TreeViewCollapseAll.svelte b/docs/src/pages/framed/TreeView/TreeViewCollapseAll.svelte new file mode 100644 index 00000000..abbd09e0 --- /dev/null +++ b/docs/src/pages/framed/TreeView/TreeViewCollapseAll.svelte @@ -0,0 +1,63 @@ + + +
+ +
+ + + + diff --git a/docs/src/pages/framed/TreeView/TreeViewCollapseNodes.svelte b/docs/src/pages/framed/TreeView/TreeViewCollapseNodes.svelte new file mode 100644 index 00000000..69bda008 --- /dev/null +++ b/docs/src/pages/framed/TreeView/TreeViewCollapseNodes.svelte @@ -0,0 +1,71 @@ + + +
+ +
+ + + + diff --git a/docs/src/pages/framed/TreeView/TreeViewExpandAll.svelte b/docs/src/pages/framed/TreeView/TreeViewExpandAll.svelte new file mode 100644 index 00000000..ea10f4ac --- /dev/null +++ b/docs/src/pages/framed/TreeView/TreeViewExpandAll.svelte @@ -0,0 +1,61 @@ + + +
+ +
+ + + + diff --git a/docs/src/pages/framed/TreeView/TreeViewExpandNodes.svelte b/docs/src/pages/framed/TreeView/TreeViewExpandNodes.svelte new file mode 100644 index 00000000..0c1efeb3 --- /dev/null +++ b/docs/src/pages/framed/TreeView/TreeViewExpandNodes.svelte @@ -0,0 +1,67 @@ + + +
+ +
+ + + +