diff --git a/COMPONENT_INDEX.md b/COMPONENT_INDEX.md index 1b666eba68..4ce17d312a 100644 --- a/COMPONENT_INDEX.md +++ b/COMPONENT_INDEX.md @@ -4707,9 +4707,10 @@ export interface TreeNode { ### Slots -| Slot name | Default | Props | Fallback | -| :-------- | :------ | :---- | :----------------------- | -| labelText | No | -- | {labelText} | +| Slot name | Default | Props | Fallback | +| :-------- | :------ | :-------------------------------------------------------------------------------------------------------------------------------- | :----------------------- | +| -- | Yes | { node: { id: TreeNodeId; text: string; expanded: boolean, leaf: boolean; disabled: boolean; selected: boolean; } } | {node.text} | +| labelText | No | -- | {labelText} | ### Events diff --git a/docs/src/COMPONENT_API.json b/docs/src/COMPONENT_API.json index dbc78008e9..d631b8eed6 100644 --- a/docs/src/COMPONENT_API.json +++ b/docs/src/COMPONENT_API.json @@ -14668,6 +14668,12 @@ ], "moduleExports": [], "slots": [ + { + "name": "__default__", + "default": true, + "fallback": "{node.text}", + "slot_props": "{ node: { id: TreeNodeId; text: string; expanded: boolean, leaf: boolean; disabled: boolean; selected: boolean; } }" + }, { "name": "labelText", "default": false, diff --git a/tests/TreeView.test.svelte b/tests/TreeView.test.svelte index 2aacf2d262..82e1c2a5ed 100644 --- a/tests/TreeView.test.svelte +++ b/tests/TreeView.test.svelte @@ -72,4 +72,12 @@ on:select="{({ detail }) => console.log('select', detail)}" on:toggle="{({ detail }) => console.log('toggle', detail)}" on:focus="{({ detail }) => console.log('focus', detail)}" -/> + let:node +> + {node.id} + {node.disabled} + {node.expanded} + {node.leaf} + {node.selected} + {node.text} + diff --git a/types/TreeView/TreeView.svelte.d.ts b/types/TreeView/TreeView.svelte.d.ts index dc7f575736..afabd0f1f0 100644 --- a/types/TreeView/TreeView.svelte.d.ts +++ b/types/TreeView/TreeView.svelte.d.ts @@ -68,7 +68,19 @@ export default class TreeView extends SvelteComponentTyped< focus: CustomEvent; keydown: WindowEventMap["keydown"]; }, - { labelText: {} } + { + default: { + node: { + id: TreeNodeId; + text: string; + expanded: boolean; + leaf: boolean; + disabled: boolean; + selected: boolean; + }; + }; + labelText: {}; + } > { /** * Programmatically expand all nodes