SINGLE_OPEN_STRATEGY
const
Overlay & Positioning
Nested-open strategy that enforces a single-open-at-a-time policy: opening a node closes any previously open sibling, while parents of the newly opened node are kept open. The `select` hook is a no-op (returns null). Used as the default strategy for ExpansionPanel.
TypeScript
Définition
La définition TypeScript telle qu'elle apparaît dans le code source d'origam. Cliquez sur l'icône de copie pour copier l'extrait.
Entrées
Valeurs
Toutes les entrées de cette constante. Cliquez sur une valeur pour la copier dans le presse-papiers.
- open: ({id, value, opened, parents}) => { if (value) { const newOpened = new Set<unknown>() newOpened.add(id) let parent = parents.get(id) while (parent != null) { newOpened.add(parent) parent = parents.get(parent) } return newOpened } else { opened.delete(id) return opened } }
- select: () => null
Écosystème
Utilisé par
Composables et composants qui consomment cette constante.
useNested
OrigamExpansionPanel
Usage
Exemples
Extraits de code prêts à coller utilisant cette constante.
Passing the strategy to an OrigamExpansionPanels