File

projects/wvr-elements/src/lib/wvr-list/wvr-list-item/wvr-list-item.component.ts

Description

A sub component to the WvrListComponent.

Extends

WvrBaseComponent

Implements

OnInit AfterViewInit

Metadata

Index

Properties
Methods
Inputs
Outputs
HostBindings

Constructor

constructor(injector: Injector)
Parameters :
Name Type Optional
injector Injector No

Inputs

customContentHeadingSmallText
Type : string

A subtext to be displayed beneath the heading for list items with custom content.

customContentItemHeading
Type : string

A heading to be displayed for list items with custom content.

customContentSmallText
Type : string

A subtext to be displayed beneath the main content for list items with custom content.

description
Type : string

Attribute input used with descriptive lists as the text of the DT element.

themeVariant
Type : ThemeVariantName
Inherited from WvrBaseComponent

The visual contextualization for this list item.

animate
Type : string
Inherited from WvrBaseComponent

A setter which parses a json string describing animation instructions and stores the derived object in _animationSettings.

animateConfig
Type : string
Inherited from WvrBaseComponent

A setter which parses a json string describing animation setting and stores the derived object in _animationConfig.

animateId
Type : string
Inherited from WvrBaseComponent

An attribute input allowing for the designation of an animation identifier for the purpose of animation targeting.

animateTarget
Type : string
Inherited from WvrBaseComponent

An attribute input allowing for the designation of an animation target for animation events.

hiddenInMobile
Type : boolean
Default value : false
Inherited from WvrBaseComponent

An attribute input specifying if this component should be hidden in the mobile layout.

ngBindings
Type : string
Inherited from WvrBaseComponent
wvrData
Type : string
Inherited from WvrBaseComponent
wvrTheme
Type : string
Inherited from WvrBaseComponent

Allows for the override of theme for the particular component.

Outputs

animationEventTrigger
Type : EventEmitter
Inherited from WvrBaseComponent

An Output biding used for triggering animations.

HostBindings

class.wvr-bootstrap
Type : boolean
Default value : true
Inherited from WvrBaseComponent

A host binding used to ensure the presense of the wvr-bootstrap class.

class.wvr-hidden
Type : boolean
Inherited from WvrBaseComponent

A host bound accessor which applies the wvr-hidden class if both isMobileLayout and hiddenInMobile evaluate to true.

style
Type : any
Inherited from WvrBaseComponent

Methods

ngAfterViewInit
ngAfterViewInit()
Returns : void
ngOnInit
ngOnInit()
Inherited from WvrBaseComponent

Registers this list item with the parent list.

Returns : void
applyThemeOverride
applyThemeOverride(customProperty: string, value: string)
Inherited from WvrBaseComponent
Parameters :
Name Type Optional
customProperty string No
value string No
Returns : void
bootstrapNgBindings
bootstrapNgBindings()
Inherited from WvrBaseComponent
Returns : void
getWvrData
getWvrData()
Inherited from WvrBaseComponent
Returns : string
hasWvrData
hasWvrData()
Inherited from WvrBaseComponent
Returns : boolean
initializeAnimationElement
initializeAnimationElement()
Inherited from WvrBaseComponent
Returns : void
initializeAnimationRegistration
initializeAnimationRegistration()
Inherited from WvrBaseComponent
Returns : void
ngAfterContentInit
ngAfterContentInit()
Inherited from WvrBaseComponent

Used for post content initialization animation setup.

Returns : void
ngOnDestroy
ngOnDestroy()
Inherited from WvrBaseComponent

Handles the the unregistering of this component with the component registry.

Returns : void
onAnimationEvent
onAnimationEvent($event: Event)
Inherited from WvrBaseComponent

Trigger's the animation specified by the incoming event.

Parameters :
Name Type Optional
$event Event No
Returns : void
Private processData
processData()
Inherited from WvrBaseComponent
Returns : void
triggerAnimations
triggerAnimations(animationTriggerType: string)
Inherited from WvrBaseComponent

Plays the animation specified by the incoming animation trigger.

Parameters :
Name Type Optional
animationTriggerType string No
Returns : void

Properties

htmlId
Default value : `wvr-li-${this.id}`

A contructed identifier dervied from this comonents id and the prefix wvr-li

listType
Type : string

The type of list which contains this list item.

variantTypes
Type : []
Default value : ['list-group-item']
Inherited from WvrBaseComponent
Private _animationConfig
Type : any
Default value : {}
Inherited from WvrBaseComponent

An object representation of the settings specifying the specific behavior of the animation for this component.

Private Readonly _animationService
Type : AnimationService<WvrBaseComponent>
Inherited from WvrBaseComponent

A reference to the AnimationService

Private _animationSettings
Type : any
Default value : {}
Inherited from WvrBaseComponent

An object representation of the animation instructions for this component.

Private _ngBindings
Type : literal type
Inherited from WvrBaseComponent
animationRootElem
Type : ElementRef
Decorators :
@ViewChild('animationRoot')
Inherited from WvrBaseComponent

A view child of the template element containing the #animationRoot identifier.

Private animationStateId
Type : number
Inherited from WvrBaseComponent

An identifier used to access the animation state for this component.

Readonly appConfig
Type : AppConfig
Inherited from WvrBaseComponent

A reference to the AppConfig

Readonly cdRef
Type : ChangeDetectorRef
Inherited from WvrBaseComponent

A reference to the ChangeDetectorRef

Readonly componentRegistry
Type : ComponentRegistryService<WvrBaseComponent>
Inherited from WvrBaseComponent

A reference to the ComponentRegistryService

data
Type : literal type
Default value : {}
Inherited from WvrBaseComponent
Readonly eRef
Type : ElementRef
Inherited from WvrBaseComponent

A reference to the ElementRef

Readonly id
Type : number
Inherited from WvrBaseComponent

A generated unique identifier for this comonent.

isMobile
Type : Observable<boolean>
Inherited from WvrBaseComponent
isMobileLayout
Type : boolean
Inherited from WvrBaseComponent
Private Readonly kebabize
Default value : () => {...}
Inherited from WvrBaseComponent
Private Readonly ngBindingsService
Type : NgBindingsService
Inherited from WvrBaseComponent

A reference to the NgBindingsService

Readonly store
Type : Store<RootState>
Inherited from WvrBaseComponent

A reference to the Store

style
Decorators :
@HostBinding('style')
Inherited from WvrBaseComponent
Protected subscriptions
Type : Array<Subscription>
Inherited from WvrBaseComponent
themeOverrides
Type : object
Default value : {}
Inherited from WvrBaseComponent
Private Readonly themeService
Type : ThemeService
Inherited from WvrBaseComponent

A reference to the ThemeService

wvrBootstrap
Default value : true
Decorators :
@HostBinding('class.wvr-bootstrap')
Inherited from WvrBaseComponent

A host binding used to ensure the presense of the wvr-bootstrap class.

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);
  }

}
<li [id]="htmlId" *ngIf="listType==='unordered' || listType==='unstyled' || listType==='ordered'">
  <ng-container *ngTemplateOutlet="content"></ng-container>
</li>

<dt [id]="htmlId" *ngIf="listType==='described'">
  {{description}}
</dt>
<dd *ngIf="listType==='described'">
  <ng-container *ngTemplateOutlet="content"></ng-container>
</dd>

<li class="list-group-item d-flex justify-content-between align-items-center list-group-item-{{themeVariant}}"
    *ngIf="listType==='group-ul' || listType==='group'"
    [id]="htmlId">
  <ng-container *ngTemplateOutlet="content"></ng-container>
</li>

<button class="list-group-item list-group-item-action list-group-item-{{themeVariant}}"
        *ngIf="listType==='group-div'"
        [id]="htmlId">
  <ng-container *ngTemplateOutlet="content"></ng-container>
</button>

<li [id]="htmlId" class="list-group-item" *ngIf="listType==='group-flush'">
  <ng-container *ngTemplateOutlet="content"></ng-container>
</li>

<a [id]="htmlId"
    class="list-group-item list-group-item-action flex-column align-items-start"
    *ngIf="listType==='group-custom-content'">
  <div class="d-flex w-100 justify-content-between">
    <h5 class="mb-1">{{customContentItemHeading}}</h5>
    <small>{{customContentHeadingSmallText}}</small>
  </div>
  <p class="mb-1">
    <ng-container *ngTemplateOutlet="content"></ng-container>
  </p>
  <small>{{customContentSmallText}}</small>
</a>

<ng-template #content>
  <ng-content></ng-content>
</ng-template>

./wvr-list-item.component.scss

@import "../../shared/styles/variables";

:host {
  
  @extend .variables;

  // list-item default colors
  --wvr-list-group-item-primary-color-default: #004085;
  --wvr-list-group-item-secondary-color-default: #383d41;
  --wvr-list-group-item-success-color-default: #155724;
  --wvr-list-group-item-danger-color-default: #721c24;
  --wvr-list-group-item-warning-color-default: #856404;
  --wvr-list-group-item-info-color-default: #0c5460;
  --wvr-list-group-item-light-color-default: #818182;
  --wvr-list-group-item-dark-color-default: #1b1e21;

  --wvr-list-group-item-primary-background-color-default: #b8daff;
  --wvr-list-group-item-secondary-background-color-default: #d6d8db;
  --wvr-list-group-item-success-background-color-default: #c3e6cb;
  --wvr-list-group-item-danger-background-color-default: #f5c6cb;
  --wvr-list-group-item-warning-background-color-default: #ffeeba;
  --wvr-list-group-item-info-background-color-default: #bee5eb;
  --wvr-list-group-item-light-background-color-default: #fdfdfe;
  --wvr-list-group-item-dark-background-color-default: #c6c8ca;

  // list-group-item-primary
  --wvr-list-group-item-primary-color: var(--wvr-list-group-item-primary-color-default);
  --wvr-list-group-item-primary-background-color: var(--wvr-list-group-item-primary-background-color-default);
  // list-group-item-secondary
  --wvr-list-group-item-secondary-color: var(--wvr-list-group-item-secondary-color-default);
  --wvr-list-group-item-secondary-background-color: var(--wvr-list-group-item-secondary-background-color-default);
  // list-group-item-success
  --wvr-list-group-item-success-color: var(--wvr-list-group-item-success-color-default);
  --wvr-list-group-item-success-background-color: var(--wvr-list-group-item-success-background-color-default);
  // list-group-item-danger
  --wvr-list-group-item-danger-color: var(--wvr-list-group-item-danger-color-default);
  --wvr-list-group-item-danger-background-color: var(--wvr-list-group-item-danger-background-color-default);
  // list-group-item-warning
  --wvr-list-group-item-warning-color: var(--wvr-list-group-item-warning-color-default);
  --wvr-list-group-item-warning-background-color: var(--wvr-list-group-item-warning-background-color-default);
  // list-group-item-info
  --wvr-list-group-item-info-color: var(--wvr-list-group-item-info-color-default);
  --wvr-list-group-item-info-background-color: var(--wvr-list-group-item-info-background-color-default);
  // list-group-item-light
  --wvr-list-group-item-light-color: var(--wvr-list-group-item-light-color-default);
  --wvr-list-group-item-light-background-color: var(--wvr-list-group-item-light-background-color-default);
  // list-group-item-dark
  --wvr-list-group-item-dark-color: var(--wvr-list-group-item-dark-color-default);
  --wvr-list-group-item-dark-background-color: var(--wvr-list-group-item-dark-background-color-default);

  wvre-list-wrapper {
    display: inline-block;
  }

  .list-group-item {
    position: relative;
    display: block;
    padding: .75rem 1.25rem;
    margin-bottom: -1px;
    border: 1px solid rgba(0,0,0,.125);
  }

  .list-group-item.active,
  .list-group-item:active {
    z-index: 2;
    color: var(--wvr-white);
    background-color: #007bff;
    border-color: #007bff;
  }

  .list-group-item:focus, .list-group-item:hover {
    z-index: 1;
    text-decoration: none;
  }

  wvre-list-item:first-child > .list-group-item {
    margin-top: 0;
    border-top-right-radius: .25rem;
    border-top-left-radius: .25rem;
  }

  wvre-list-item:last-child > .list-group-item {
    margin-bottom: 0;
    border-bottom-right-radius: .25rem;
    border-bottom-left-radius: .25rem;
  }

  .list-group-item-primary {
    color: var(--wvr-list-group-item-primary-color);
    background-color: var(--wvr-list-group-item-primary-background-color);
  }

  .list-group-item-secondary {
    color: var(--wvr-list-group-item-secondary-color);
    background-color: var(--wvr-list-group-item-secondary-background-color);
  }

  .list-group-item-success {
    color: var(--wvr-list-group-item-success-color);
    background-color: var(--wvr-list-group-item-success-background-color);
  }

  .list-group-item-danger {
    color: var(--wvr-list-group-item-danger-color);
    background-color: var(--wvr-list-group-item-danger-background-color);
  }

  .list-group-item-warning {
    color: var(--wvr-list-group-item-warning-color);
    background-color: var(--wvr-list-group-item-warning-background-color);
  }

  .list-group-item-info {
    color: var(--wvr-list-group-item-info-color);
    background-color: var(--wvr-list-group-item-info-background-color);
  }

  .list-group-item-light {
    color: var(--wvr-list-group-item-light-color);
    background-color: var(--wvr-list-group-item-light-background-color);
  }

  .list-group-item-dark {
    color: var(--wvr-list-group-item-dark-color);
    background-color: var(--wvr-list-group-item-dark-background-color);
  }

  ::ng-deep {
    .badge {
      display: inline-block;
      padding: .25em .4em;
      font-size: 75%;
      font-weight: 700;
      line-height: 1;
      text-align: center;
      white-space: nowrap;
      vertical-align: baseline;
    }

    .badge-pill {
      padding-right: .6em;
      padding-left: .6em;
      border-radius: 10rem;
    }

    .badge-primary {
      color: var(--wvr-white);
      background-color: var(--wvr-primary);
    }

    .badge-secondary {
      color: var(--wvr-white);
      background-color: var(--wvr-secondary);
    }

    .badge-success {
      color: var(--wvr-white);
      background-color: var(--wvr-success);
    }

    .badge-danger {
      color: var(--wvr-white);
      background-color: var(--wvr-danger);
    }

    .badge-info {
      color: var(--wvr-white);
      background-color: var(--wvr-info);
    }

    .badge-warning {
      color: var(--wvr-gray-dark);
      background-color: var(--wvr-warning);
    }

    .badge-light {
      color: var(--wvr-gray-dark);
      background-color: var(--wvr-light);
    }

    .badge-dark {
      color: var(--wvr-white);
      background-color: var(--wvr-dark);
    }

    // custom-content
    h5 {
      font-family: var(--wvr-font-family-sans-serif);
      font-weight: 500;
      line-height: 1.2;
    }

    .small, small {
      font-size: 80%;
      font-weight: 400;
    }

    .mb-1, .my-1 {
      margin-bottom: .25rem!important;
    }

    p {
      margin-top: 0;
    }

  }

}
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""