Press n or j to go to the next uncovered block, b, p or k for the previous block.
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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 8x 1x | import { AfterViewInit, ChangeDetectionStrategy, Component, Injector, Input, OnInit } from '@angular/core'; import { ThemeVariantName } from '../../shared/theme'; import { WvrBaseComponent } from '../../shared/wvr-base.component'; /** * A sub component to the WvrListComponent. */ @Component({ selector: 'wvr-list-item-component', templateUrl: './wvr-list-item.component.html', styleUrls: ['./wvr-list-item.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush }) export class WvrListItemComponent extends WvrBaseComponent implements OnInit, AfterViewInit { /** The type of list which contains this list item. */ listType: string; /** Attribute input used with descriptive lists as the text of the DT element. */ @Input() description: string; /** The visual contextualization for this list item. */ @Input() themeVariant: ThemeVariantName; /** A heading to be displayed for list items with custom content. */ @Input() customContentItemHeading: string; /** A subtext to be displayed beneath the heading for list items with custom content. */ @Input() customContentHeadingSmallText: string; /** A subtext to be displayed beneath the main content for list items with custom content. */ @Input() customContentSmallText: string; /** A contructed identifier dervied from this comonents id and the prefix `wvr-li` */ htmlId = `wvr-li-${this.id}`; variantTypes = ['list-group-item']; constructor(injector: Injector) { super(injector); } /** Registers this list item with the parent list. */ ngOnInit(): void { super.ngOnInit(); const parent = this.eRef.nativeElement.parentNode.parentNode.parentNode; this.listType = parent.listType; this.themeVariant = this.themeVariant ? this.themeVariant : parent.themeVariant ? parent.themeVariant : undefined; } ngAfterViewInit(): void { // get the element's parent node const parent = this.eRef.nativeElement.parentNode; // move all children out of the element while (this.eRef.nativeElement.firstChild) { parent.insertBefore(this.eRef.nativeElement.firstChild, this.eRef.nativeElement); } // remove the empty element parent.removeChild(this.eRef.nativeElement); } } |