All files / element-ng/form/si-form-field si-form-field.component.html

100% Statements 39/39
100% Branches 10/10
100% Functions 0/0
100% Lines 24/24

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 4163x 49x     7x   43x 43x 63x 14x   63x 57x   43x   43x 43x   63x     63x 2x   61x   43x 43x       57x 57x 18x 18x 18x   37x    
@if (!isFormCheck()) {
  <ng-container [ngTemplateOutlet]="labelTemplate" />
} @else if (!fieldset) {
  <!-- Empty spacer so the control aligns with the label column in form-col-layout. -->
  <div class="form-label"></div>
}
<div class="form-item-content">
  <ng-content />
  @if (isFormCheck()) {
    <ng-container [ngTemplateOutlet]="labelTemplate" />
  }
  @if (!isPartOfRadioGroup()) {
    <ng-container [ngTemplateOutlet]="feedbackTemplate" />
  }
</div>
 
<ng-template #labelTemplate>
  <div
    class="d-flex gap-2"
    [class.form-label]="!isFormCheck()"
    [class.form-check-label]="isFormCheck()"
  >
    @if (labelledby()) {
      <span [id]="labelledby()" [class.required]="showRequired()">{{ label() | translate }}</span>
    } @else {
      <label [for]="controlId()" [class.required]="showRequired()">{{ label() | translate }}</label>
    }
    <ng-content select="[si-help-button]" />
  </div>
</ng-template>
 
<ng-template #feedbackTemplate>
  <div class="invalid-feedback" [class.d-block]="errors().length" [attr.id]="errormessageId()">
    @for (error of errors(); track $index) {
      <div>
        {{ error.message ?? error.key | translate: error.params }}
      </div>
    }
  </div>
</ng-template>