libs/core/dynamic-form/headline/src/headline.component.ts

Extends

DfBaseComponent<DfHeadlineConfig>

Metadata

Relationships

Index

Properties
Inputs
Outputs

Inputs

control
Default value : undefined
Inherited from DfBaseComponent
config
Type : C
Required :  true
Inherited from DfBaseComponent

The configuration object for this formfield.

Note that derived formfield components should extend the DfBaseConfig config interface as needed and expose that their own config interface.

formAclPath
Type : string
Inherited from DfBaseComponent
isAclHandled
Type : boolean
Default value : false
Inherited from DfBaseComponent
isRetailChannel
Type : boolean
Inherited from DfBaseComponent
validationConfigs
Type : ValidationConfig[] | undefined
Inherited from DfBaseComponent

Outputs

formEvent
Type : DfEventPayload
Inherited from DfBaseComponent

Emits when events associated to the form control happen.

The emitted object contains the data necessary to uniquely identify the event (field id and event type). It also contains the event data.

Properties

Readonly Headline
Type : unknown
Default value : HeaderType
componentOrControlInitFinished
Type : unknown
Default value : new ReplaySubject<AbstractControl | undefined>(1)
Inherited from DfBaseComponent

This ReplaySubject is provided to emit the control once it is initialized.

errorMessages
Type : WritableSignal<Observable[]>
Default value : signal([])
Inherited from DfBaseComponent

The resolved validation error messages for the current control state.

Readonly nxErrorAppearance
Type : ErrorStyleType
Default value : inject(ERROR_DEFAULT_OPTIONS, { optional: true })?.appearance || (inject<CHANNEL>(CHANNEL_TOKEN) === CHANNEL.EXPERT ? 'text' : 'message')
Inherited from DfBaseComponent
import { IS_A1 } from '@allianz/taly-core';
import { DfBaseComponent } from '@allianz/taly-core/dynamic-form';
import { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core';
import { DfHeadlineConfig, HeaderType } from './headline.model';

@Component({
  selector: 'df-headline',
  templateUrl: './headline.component.html',
  styleUrls: ['./headline.component.scss'],
  standalone: false,
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class DfHeadlineComponent extends DfBaseComponent<DfHeadlineConfig> {
  readonly Headline = HeaderType;
  protected isA1 = inject(IS_A1);

  protected headlineType = computed(() => {
    switch (this.config().headerType) {
      case HeaderType.h1:
        return 'page';
      case HeaderType.h2:
        return 'section';
      case HeaderType.h3:
        return 'subsection';
    }
  });

  // Override some of the DfBaseComponent functionality
  // that is not needed in this component
  override control = input(undefined);
}
<div
  class="dynamic-heading"
  [attr.data-testid]="config().testId"
  [ngClass]="{
    'is-centered': isRetailChannel() && !isA1,
    'is-retail': isRetailChannel(),
    'is-a1': isRetailChannel() && isA1
  }"
>
  <taly-internal-headline
    [type]="headlineType()"
    [subline]="config().subline | interpolateFromStore | async"
  >
    {{ config().label | interpolateFromStore | async }}
    <ng-container *ngTemplateOutlet="infoicon"></ng-container>
  </taly-internal-headline>
  <ng-template #infoicon>
    @if (config().infoIcon) {
    <df-info-icon nxFormfieldAppendix [config]="config().infoIcon"></df-info-icon>
    }
  </ng-template>
</div>

./headline.component.scss

:host {
  .dynamic-heading {
    display: flex;
    flex-direction: row;
  }

  df-info-icon {
    ::ng-deep {
      padding-left: 8px;
      display: inline-flex;
      vertical-align: middle;
      margin-top: -0.15em;
    }
  }
}

.is-centered {
  justify-content: center;
  text-align: center;
}

.is-a1 {
  justify-content: flex-start;
  text-align: left;
}
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""