IGroupProvide

interface
Group & Selection

Runtime injection provided by a group component to all its item descendants — exposes registration, selection control, navigation and the full item list.

TypeScript

Définition

La définition TypeScript de l'interface telle que trouvée dans le code source d'origam. Cliquez sur l'icône de copie pour copier l'extrait.

typescript

API

Propriétés

Chaque propriété déclarée par cette interface, avec son type, son caractère optionnel et sa valeur par défaut.

register
requis
(item: IGroupItem, cmp: ComponentInternalInstance) => void
Registers a new item in the group; called by each item on mount.
unregister
requis
(id: number) => void
Removes an item from the group by its numeric id; called on unmount.
select
requis
(id: number, value: boolean) => void
Sets the selected state of a specific item by id.
selected
requis
Ref<Readonly<Array<number>>>
Reactive list of currently selected item ids.
isSelected
requis
(id: number) => boolean
Returns true if the item with the given id is currently selected.
prev
requis
() => number | undefined
Selects the previous item in registration order (wraps around).
next
requis
() => number | undefined
Selects the next item in registration order (wraps around).
selectedClass
requis
Ref<string | undefined>
CSS class applied to selected items, reactive to the group-level prop.
items
requis
ComputedRef<Array<{ id: number value: unknown disabled: boolean | undefined domId?: string }>>
Computed list of all registered items with their id, value and disabled state.
disabled
requis
Ref<boolean | undefined>
Whether the entire group is disabled.
getItemIndex
requis
(value: unknown) => number
Returns the registration index of the item whose value matches the argument, or -1.

Usage

Exemples

Extraits de code prêts à coller utilisant cette interface.

Injecting the group provide in an item component

typescript