libs/core/dynamic-form/rating/src/rating.component.ts
DfBaseComponent<DfRatingConfig>
| changeDetection | ChangeDetectionStrategy.OnPush |
| selector | df-rating |
| standalone | true |
| imports | |
| styleUrls | ./rating.component.css |
| templateUrl | ./rating.component.html |
| styleUrl | ./rating.component.css |
No results matching.
Properties |
Inputs |
Outputs |
| control | |
Type : UntypedFormControl
|
|
Default value : new UntypedFormControl()
|
|
|
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 |
|
| 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
|
|
| 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. |
|
| 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 { DfBaseComponent, DfBaseModule } from '@allianz/taly-core/dynamic-form';
import { ChangeDetectionStrategy, Component, input, OnInit } from '@angular/core';
import { ReactiveFormsModule, UntypedFormControl } from '@angular/forms';
import { NxLabelModule } from '@allianz/ng-aquila/base';
import { NxFormfieldModule } from '@allianz/ng-aquila/formfield';
import { NxRatingModule } from '@allianz/ng-aquila/rating';
import { DfRatingConfig } from './rating.model';
@Component({
selector: 'df-rating',
templateUrl: './rating.component.html',
imports: [DfBaseModule, NxRatingModule, NxLabelModule, ReactiveFormsModule, NxFormfieldModule],
styleUrl: './rating.component.css',
changeDetection: ChangeDetectionStrategy.OnPush
})
export class DfRatingComponent extends DfBaseComponent<DfRatingConfig> implements OnInit {
override control = input<UntypedFormControl>(new UntypedFormControl());
override ngOnInit(): void {
super.ngOnInit();
this.emitFormControlEventOnValueChanges();
}
}
<div class="df-rating__container">
@if (config().label) {
<nx-label
[size]="this.isRetailChannel() ? 'large' : 'small'"
[ngClass]="{
'nx-font-weight-regular': isRetailChannel()
}"
>{{ config().label | interpolateFromStore | async }}
</nx-label>
}
<nx-rating
[formControl]="control()"
[endLabel]="config().endLabel ?? ''"
[startLabel]="config().startLabel ?? ''"
[value]="config().value"
[attr.data-testid]="config().testId"
>
</nx-rating>
</div>
@for (message$ of errorMessages(); track $index) {
<nx-error class="nx-margin-top-xs" [appearance]="nxErrorAppearance">{{
message$ | async
}}</nx-error>
}
./rating.component.css
:host {
display: block;
}
.df-rating__container {
display: flex;
flex-direction: column;
align-items: start;
}
nx-label {
margin-bottom: var(--vertical-inner-section-spacing);
}