All files / src/app/shared/formly/wrappers/horizontal-wrapper horizontal-wrapper.component.ts

100% Statements 6/6
100% Branches 0/0
100% Functions 2/2
100% Lines 5/5

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 311x 1x                                       1x 2x         2x      
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { FieldWrapper } from '@ngx-formly/core';
 
/**
 * The default wrapper for displaying fields with labels.
 *
 * @props **label** - the label to be displayed
 * @props **labelClass** - the css class to be applied to the ``<label>`` tag.
 * @props **fieldClass** - the css class to be applied to a div around the ``#fieldComponent`` template.
 * @props **required** - apart from formly-internal validation logic, the required option is used here to display a star marker.
 * @props **hideRequiredMarker** - used to not show the required star while still marking the field as required.
 *
 * @usageNotes
 * While validation is mostly handled by the validation wrapper, the label still needs to be styled according to error state.
 * This is why this wrapper uses the showError attribute to conditionally apply a class.
 */
@Component({
  selector: 'ish-horizontal-wrapper',
  templateUrl: './horizontal-wrapper.component.html',
  changeDetection: ChangeDetectionStrategy.Default,
})
export class HorizontalWrapperComponent extends FieldWrapper {
  dprops = {
    labelClass: 'col-md-4',
    fieldClass: 'col-md-8',
  };
  get keyString() {
    return this.field.key as string;
  }
}