|
7 | 7 | */ |
8 | 8 |
|
9 | 9 | import {computed, signal} from '@angular/core'; |
10 | | -import {SignalLike} from '../behaviors/signal-like/signal-like'; |
| 10 | +import {SignalLike, WritableSignalLike} from '../behaviors/signal-like/signal-like'; |
11 | 11 | import {List, ListInputs, ListItem} from '../behaviors/list/list'; |
12 | 12 | import {ExpansionItem, ExpansionControl, ListExpansion} from '../behaviors/expansion/expansion'; |
13 | 13 | import {KeyboardEventManager, PointerEventManager, Modifier} from '../behaviors/event-manager'; |
@@ -84,6 +84,30 @@ export class TreeItemPattern<V> implements ExpansionItem { |
84 | 84 | return this.tree().value().includes(this.value()) ? this.tree().currentType() : undefined; |
85 | 85 | }); |
86 | 86 |
|
| 87 | + /** A unique identifier for this item. */ |
| 88 | + id: SignalLike<string>; |
| 89 | + |
| 90 | + /** The value of this item. */ |
| 91 | + value: SignalLike<V>; |
| 92 | + |
| 93 | + /** A reference to the item element. */ |
| 94 | + element: SignalLike<HTMLElement>; |
| 95 | + |
| 96 | + /** Whether the item is disabled. */ |
| 97 | + disabled: SignalLike<boolean>; |
| 98 | + |
| 99 | + /** The text used by the typeahead search. */ |
| 100 | + searchTerm: SignalLike<string>; |
| 101 | + |
| 102 | + /** The tree pattern this item belongs to. */ |
| 103 | + tree: SignalLike<TreePattern<V>>; |
| 104 | + |
| 105 | + /** The parent item. */ |
| 106 | + parent: SignalLike<TreeItemPattern<V> | TreePattern<V>>; |
| 107 | + |
| 108 | + /** The children items. */ |
| 109 | + children: SignalLike<TreeItemPattern<V>[]>; |
| 110 | + |
87 | 111 | constructor(readonly inputs: TreeItemInputs<V>) { |
88 | 112 | this.id = inputs.id; |
89 | 113 | this.value = inputs.value; |
@@ -295,6 +319,48 @@ export class TreePattern<V> { |
295 | 319 | return manager; |
296 | 320 | }); |
297 | 321 |
|
| 322 | + /** A unique identifier for the tree. */ |
| 323 | + id: SignalLike<string>; |
| 324 | + |
| 325 | + /** Whether the tree is in navigation mode. */ |
| 326 | + nav: SignalLike<boolean>; |
| 327 | + |
| 328 | + /** The aria-current type. */ |
| 329 | + currentType: SignalLike<'page' | 'step' | 'location' | 'date' | 'time' | 'true' | 'false'>; |
| 330 | + |
| 331 | + /** All items in the tree, in document order (DFS-like, a flattened list). */ |
| 332 | + allItems: SignalLike<TreeItemPattern<V>[]>; |
| 333 | + |
| 334 | + /** Whether the tree is disabled. */ |
| 335 | + disabled: SignalLike<boolean>; |
| 336 | + |
| 337 | + /** The currently active item in the tree. */ |
| 338 | + activeItem: WritableSignalLike<TreeItemPattern<V> | undefined> = signal(undefined); |
| 339 | + |
| 340 | + /** Whether disabled items should be skipped when navigating. */ |
| 341 | + skipDisabled: SignalLike<boolean>; |
| 342 | + |
| 343 | + /** Whether the focus should wrap when navigating past the first or last item. */ |
| 344 | + wrap: SignalLike<boolean>; |
| 345 | + |
| 346 | + /** The orientation of the tree. */ |
| 347 | + orientation: SignalLike<'vertical' | 'horizontal'>; |
| 348 | + |
| 349 | + /** The text direction of the tree. */ |
| 350 | + textDirection: SignalLike<'ltr' | 'rtl'>; |
| 351 | + |
| 352 | + /** Whether multiple items can be selected at the same time. */ |
| 353 | + multi: SignalLike<boolean>; |
| 354 | + |
| 355 | + /** The selection mode of the tree. */ |
| 356 | + selectionMode: SignalLike<'follow' | 'explicit'>; |
| 357 | + |
| 358 | + /** The delay in milliseconds to wait before clearing the typeahead buffer. */ |
| 359 | + typeaheadDelay: SignalLike<number>; |
| 360 | + |
| 361 | + /** The current value of the tree (the selected items). */ |
| 362 | + value: WritableSignalLike<V[]>; |
| 363 | + |
298 | 364 | constructor(readonly inputs: TreeInputs<V>) { |
299 | 365 | this.id = inputs.id; |
300 | 366 | this.nav = inputs.nav; |
|
0 commit comments