useNested
Commons
stable
Manages a tree of selectable and openable items via provide/inject. Maintains a parent→child registry, applies a configurable open strategy (single / list / multiple) and a select strategy (classic / leaf / independent / single-leaf / single-independent). Used internally by OrigamTreeview, OrigamList, and OrigamExpansionPanels.
API
Signature
Signature TypeScript complète extraite du fichier du composable.
Interfaces consommées
INestedProps
API
Paramètres
Paramètres d'entrée acceptés par ce composable.
- propsrequisINestedProps
- Props including `opened` (initial open set), `selected` (initial selection map), `selectStrategy` (string or custom object), `openStrategy` (string or custom object), and `mandatory`.
API
Valeurs de retour
Propriétés et méthodes exposées par l'objet retourné par le composable.
- opened
- Reactive set of currently open node IDs. Synced to v-model:opened via useVModel.
- selected
- Reactive selection map. Values are "on", "off", or "indeterminate" (for classic strategy parent nodes).
- selectedValues
- Flat array of IDs whose selection state is "on". Convenient for v-model:selected binding.
- register
- Registers a node in the parent/children maps. Called automatically by useNestedItem on mount.
- unregister
- Removes a node from all maps and closes it. Called automatically by useNestedItem on unmount.
- open
- Toggles the open state of a node according to the active open strategy. Emits click:open and update:opened.
- select
- Applies the active select strategy for the given node. Emits click:select and update:selected.
Usage
Exemples
Extraits de code prêts à coller.
Treeview with classic select strategy
Single-open expansion panel list