Overview
Declaration
class CollectionStore<T extends CollectionItem>
Properties
| Name |
Type |
Description |
readonly items |
Signal<T[]> |
|
readonly enabledItems |
Signal<T[]> |
|
readonly activeItem |
Signal<T | null> |
|
readonly activeId |
Signal<string | null> |
|
Public methods
configure(config: Partial<CollectionConfig>): void
| Parameter |
Type |
Optional |
Description |
config |
Partial<CollectionConfig> |
|
|
register
register(item: T): void
Registers item in DOM order. Registering the same object (or another object with the
same id) again replaces the earlier entry instead of duplicating it.
| Parameter |
Type |
Optional |
Description |
item |
T |
|
|
unregister
unregister(item: T): void
Removes item. If it was active, activation moves to the nearest enabled neighbour:
the item that now occupies its position (its next sibling) first, otherwise the previous
one, otherwise nothing.
| Parameter |
Type |
Optional |
Description |
item |
T |
|
|
refreshOrder
refreshOrder(): void
setActive
setActive(id: string | null, options?: { focus?: boolean; }): void
| Parameter |
Type |
Optional |
Description |
id |
string | null |
|
|
options |
{ focus?: boolean } |
Yes |
|
first
first(options?: { focus?: boolean; }): T | null
| Parameter |
Type |
Optional |
Description |
options |
{ focus?: boolean } |
Yes |
|
last
last(options?: { focus?: boolean; }): T | null
| Parameter |
Type |
Optional |
Description |
options |
{ focus?: boolean } |
Yes |
|
next
next(options?: { focus?: boolean; wrap?: boolean; }): T | null
| Parameter |
Type |
Optional |
Description |
options |
{ focus?: boolean; wrap?: boolean } |
Yes |
|
previous
previous(options?: { focus?: boolean; wrap?: boolean; }): T | null
| Parameter |
Type |
Optional |
Description |
options |
{ focus?: boolean; wrap?: boolean } |
Yes |
|
handleKeydown
handleKeydown(event: KeyboardEvent, options?: { focus?: boolean; }): boolean
| Parameter |
Type |
Optional |
Description |
event |
KeyboardEvent |
|
|
options |
{ focus?: boolean } |
Yes |
|
typeahead
typeahead(character: string, options?: { focus?: boolean; }): T | null
| Parameter |
Type |
Optional |
Description |
character |
string |
|
|
options |
{ focus?: boolean } |
Yes |
|
activeTabIndex
activeTabIndex(id: string): 0 | -1
| Parameter |
Type |
Optional |
Description |
id |
string |
|
|
focusActive
focusActive(): void
destroy
destroy(): void