-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathlist-item.component.ts
More file actions
35 lines (31 loc) · 916 Bytes
/
list-item.component.ts
File metadata and controls
35 lines (31 loc) · 916 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { ChangeDetectionStrategy, Component, input } from '@angular/core';
import { IconDefinition } from '@fortawesome/angular-fontawesome';
export interface CodeListItem<T extends CodeListItem<T>> {
key: string;
label: string;
children?: T[];
isDisabled?: boolean;
}
@Component({
selector: '[code-list-item]',
imports: [],
templateUrl: './list-item.component.html',
styleUrl: './list-item.component.scss',
changeDetection: ChangeDetectionStrategy.OnPush,
host: {
'[attr.aria-disabled]': 'entry().isDisabled',
'[style.paddingLeft.em]': '0.5 + depth() * 1.5'
}
})
export class CodeListItemComponent<T extends CodeListItem<T>> {
/**
* The menu entry to render.
*/
entry = input.required<T>();
/**
* How deeply nested the menu item is.
* Base level is 0, each nesting level increases depth by 1.
*/
depth = input<number>(0);
icon = input<IconDefinition>();
}