File

projects/wvr-elements/src/lib/wvr-message-manifest/wvr-message-manifest.component.ts

Description

The WvrMessageManifestComponent is used to express a potential remote data source. To be used with the wvr-data input.

Extends

WvrBaseComponent

Metadata

Index

Properties
Methods
Inputs
Outputs
HostBindings

Constructor

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

Inputs

brokerUrl
Type : string

The broker URL to be prepended to all paths expressed on MessageManifestEntries.

description
Type : string

A human description of this manifes.

mappingStrategy
Type : any

The strategy to be employed to unwrap response data.

name
Type : string

The name by which this message manifest can be referenced.

options
Type : any

Additional configuration options.

protocol
Type : any

The protocol to use.

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
themeVariant
Type : ThemeVariantName
Inherited from WvrBaseComponent

Used to define the class type of an alert component.

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

addEntry
addEntry(entry: WvrMessageManifestEntryComponent)
Parameters :
Name Type Optional
entry WvrMessageManifestEntryComponent No
Returns : void
Private buildEntries
buildEntries()

Converts this message manifests WvrMessageManifestEntryComponents into MessageManifestEntries.

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
ngOnInit
ngOnInit()
Inherited from WvrBaseComponent

Used to setup this component for animating.

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

Private Readonly messageManifestEntries
Default value : new Array<WvrMessageManifestEntryComponent>()

A collection of the child WvrMessageManifestEntryComponent.

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

variantTypes
Type : []
Default value : []
Inherited from WvrBaseComponent
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 { ChangeDetectionStrategy, Component, Injector, Input } from '@angular/core';
import * as JSON5 from 'json5';
import { MessageClientOptions, MessageClientProtocol, MessageManifest, MessageManifestActions, MessageManifestEntry, MessageManifestReducers, MessageMappingStrategy } from '../core/message-manifest';
import { wvrTimeout } from '../shared/utility';
import { WvrBaseComponent } from '../shared/wvr-base.component';
import { WvrMessageManifestEntryComponent } from './wvr-message-manifest-entry/wvr-message-manifest-entry.component';

/**
 * The WvrMessageManifestComponent is used to express a potential remote data source. To be used
 * with the `wvr-data` input.
 */
@Component({
  selector: 'wvr-message-manifest-component',
  template: '<ng-content></ng-content>',
  changeDetection: ChangeDetectionStrategy.Default
})
export class WvrMessageManifestComponent extends WvrBaseComponent {

  /** The name by which this message manifest can be referenced. */
  // tslint:disable-next-line: prefer-readonly
  @Input() name: string;

  /** A human description of this manifes. */
  // tslint:disable-next-line: prefer-readonly
  @Input() description: string;

  /** The broker URL to be prepended to all paths expressed on MessageManifestEntries. */
  // tslint:disable-next-line: prefer-readonly
  @Input() brokerUrl: string;

  /** The protocol to use. */
  @Input() protocol;

  /** Additional configuration options. */
  @Input() options;

  /** The strategy to be employed to unwrap response data. */
  // tslint:disable-next-line: prefer-readonly
  @Input() mappingStrategy;

  /** A collection of the child WvrMessageManifestEntryComponent. */
  private readonly messageManifestEntries = new Array<WvrMessageManifestEntryComponent>();

  // tslint:disable-next-line:no-empty
  constructor(injector: Injector) {
    super(injector);
  }

  addEntry(entry: WvrMessageManifestEntryComponent): void {
    this.messageManifestEntries.push(entry);

    wvrTimeout(() => {
      this.buildEntries();
    });
  }

  /**
   * Converts this message manifests WvrMessageManifestEntryComponents into MessageManifestEntries.
   */
  private buildEntries(): void {
    const ms = this.mappingStrategy ? this.mappingStrategy.toUpperCase() : 'NONE';

    const entries: Array<MessageManifestEntry> = this.messageManifestEntries.map(e => ({
      name: e.name,
      description: e.description,
      destination: e.destination,
      mappingStrategy: e.mappingStrategy ? e.mappingStrategy.toUpperCase() : ms
    }));

    const manifest: MessageManifest = {
      name: this.name,
      description: this.description,
      brokerUrl: this.brokerUrl,
      entries,
      connection: {
        status: MessageManifestReducers.ConnectionStatus.DISCONNECTED
      },
      protocol: this.protocol ? this.protocol.toUpperCase() : undefined,
      options: this.options ? JSON5.parse(this.options) : undefined
    };

    this.store.dispatch(MessageManifestActions.addManifest({
      manifest
    }));
  }

}
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""