File

libs/playground-test-bbs/src/lib/pgr-banner/pgr-banner.component.ts

Extends

AbstractBuildingBlock

Metadata

Index

Properties
Methods
Inputs
Outputs

Inputs

id
Type : any
Default value : dasherize(this.constructor.name)
Inherited from AbstractBuildingBlock

can be changed during runtime and given as a default by the implemented Building Block

resources
Type : BuildingBlockResources
Inherited from AbstractBuildingBlock

The method will be called by the facade and is marked as an @Input. Derived Building Blocks need to list the input in the @Component decorator under inputs:[] to make it available to the template (View Engine limitation).

state
Type : NoArray<BuildingBlockState>
Inherited from AbstractBuildingBlock

The method will be called by the facade and is marked as an @Input. Derived Building Blocks need to list the input in the @Component decorator under inputs:[] to make it available to the template (View Engine limitation).

Outputs

completed
Type : EventEmitter
Inherited from AbstractBuildingBlock

Mark this Building Block as complete. That way a workflow engine can determine the overall completion state of any given pages. This method can be actively triggered by the user (say a button is clicked) or indirectly by a form being changed.

The author of a Building Block needs to make sure that this function is called during the lifetime of a Building Block. If the Building Block is purely presentational this method can be called during initialization.

Methods

onPageConnection
onPageConnection()
Inherited from AbstractBuildingBlock
Returns : void
callBusinessEvent
callBusinessEvent(event: string)
Inherited from AbstractBuildingBlock

This method creates a Deferred object for the business event given. This will have a newly created promise and their executor parameters resolve & reject. This deferred object is then emitted along with the business event name

The Store Integration(Facade) can then decide when to resolve or reject the underlying promise based on the service activator call attached to the business event.

call's status.

Parameters :
Name Type Optional Description
event string No

name of the business event

Returns : Promise<>

the promise from the deferred. The building block can then be notified on the respective service activator call's status.

commitCompletion
commitCompletion()
Inherited from AbstractBuildingBlock
Returns : void
getForm
getForm()
Inherited from AbstractBuildingBlock

This is supposed to return the building block's form. Leave this untouched if your building block implementation does not have a form.

getState
getState()
Inherited from AbstractBuildingBlock

⚠️ If this function shows an error that contains Type '<some-type>[]' is not assignable to type 'never'., it means that you are trying to use an Array as your BB's State. This is not allowed. Please use an object instead.

Retrieve the current state of this Building Block. It's an empty object by default. The state should only include data that is useful to the outside world. Don't expose internal states like scroll position, button press states etc. Think of it as data that is useful in an overall business process and that you would also recognize in written insurance contracts for example.

The author of a Building Block needs to implement this function in order to deliver a proper snapshot of the current state of all components and/or forms.

navigate
navigate(type: BUILDING_BLOCK_NAVIGATION_TYPE, payload?: string)
Inherited from AbstractBuildingBlock
Parameters :
Name Type Optional
type BUILDING_BLOCK_NAVIGATION_TYPE No
payload string Yes
Returns : void
onPageDisconnected
onPageDisconnected()
Inherited from AbstractBuildingBlock
Returns : void
revertCompletion
revertCompletion()
Inherited from AbstractBuildingBlock
Returns : void
setResources
setResources(data: BuildingBlockResources | undefined)
Inherited from AbstractBuildingBlock
Parameters :
Name Type Optional
data BuildingBlockResources | undefined No
Returns : void
setState
setState(state: NoArray<BuildingBlockState>)
Inherited from AbstractBuildingBlock
Parameters :
Name Type Optional
state NoArray<BuildingBlockState> No
Returns : void
setValidationConfiguration
setValidationConfiguration(data: ValidationConfigItem[])
Inherited from AbstractBuildingBlock
Parameters :
Name Type Optional
data ValidationConfigItem[] No
Returns : void
stateChanged
stateChanged()
Inherited from AbstractBuildingBlock
Returns : void
transformResources
transformResources(data: BuildingBlockResources)
Inherited from AbstractBuildingBlock

Override if you need to pre process the incoming resource data and if you want to establish some default values. The return value will arrive in setResources and stored in the 'resources' variable. Needs to match the Resource Generic of the given Building Block

Parameters :
Name Type Optional
data BuildingBlockResources No
transformState
transformState(data: NoArray<BuildingBlockState>)
Inherited from AbstractBuildingBlock

Override if you need to pre process the incoming state data and if you want to establish some default values. The return value will arrive in setState and stored in the 'state' variable. Needs to match the State Generic of the given Building Block

Parameters :
Name Type Optional
data NoArray<BuildingBlockState> No

Properties

_aclService
Type : AclService
Inherited from AbstractBuildingBlock
aclTag
Type : AclTag | null
Inherited from AbstractBuildingBlock
businesssEventCall$
Default value : new EventEmitter<BusinessEvent>()
Inherited from AbstractBuildingBlock
Readonly channel
Type : CHANNEL
Inherited from AbstractBuildingBlock
completion$
Default value : new BehaviorSubject(false)
Inherited from AbstractBuildingBlock
connected$
Default value : new Subject<void>()
Inherited from AbstractBuildingBlock

Lifecycle Event called once the Building Block is connected to the page. This can only happen when the Building Block is embed in a Building Block Page This is not intended to be used standalone.

At this point you can be sure that:

  1. The Building Block is ready (AfterViewInit)
  2. The initial state and resources has been set
disconnected$
Default value : new Subject<void>()
Inherited from AbstractBuildingBlock
Readonly isExpertChannel
Type : boolean
Inherited from AbstractBuildingBlock
Readonly isRetailChannel
Type : boolean
Inherited from AbstractBuildingBlock
loadingStatus$
Default value : this._loadingStatus$ .asObservable() .pipe( scan(accumulateBusinessEvents, []), map(groupEventStatusesByName), distinctUntilChanged(isEqual) )
Inherited from AbstractBuildingBlock
navigateEvent$
Default value : new EventEmitter<BuildingBlockNavigationEvent>()
Inherited from AbstractBuildingBlock
stateChange$
Default value : new BehaviorSubject({} as BuildingBlockState)
Inherited from AbstractBuildingBlock

Call this function to grab the current state and forward it any time your internal state is ready to be forwarded. It's a BehaviorSubject to always deliver the latest state on subscription. TODO: Evaluate if a multicast could help maintaining an more coordiated data stream

trackForm$
Default value : new EventEmitter<UntypedFormGroup>()
Inherited from AbstractBuildingBlock

Can be used to add automatic tracking to a form. Keep in mind that the form that is returned by getForm() is tracked automatically during the initialization.

This only has to be called if there are other forms that should be tracked or if the form is created after the initialization.

import { AbstractBuildingBlock, createBuildingBlockProvider } from '@allianz/taly-core';
import { Component, forwardRef } from '@angular/core';

@Component({
  selector: 'bb-pgr-banner',
  template: `<div nxLayout="grid nopadding">
    <div nxRow [rowJustify]="isExpertChannel ? 'start' : 'center'">
      <div [nxCol]="isExpertChannel ? '12,12' : '12,12,8'">
        <div
          style="display: flex; justify-content: space-between; align-items: center; color: white; font-size: 1.7em; min-height: 50px"
        >
          <div *aclTag="'description'">Sticky Banner</div>
          <div *aclTag="'icon'">🐛</div>
          <div *aclTag="'amount'">1.234,00 €</div>
        </div>
      </div>
    </div>
  </div>`,
  providers: [createBuildingBlockProvider(forwardRef(() => PgrBannerComponent))],
  standalone: false
})
export class PgrBannerComponent extends AbstractBuildingBlock<undefined, undefined> {
  override onPageConnection(): void {
    console.log('The Building Block PgrLoremIpsum got connected to the page');
    this.commitCompletion();
  }
}
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""