UNPKG

first-npm-package-nicule

Version:

This isi first npm package

34 lines (26 loc) 1.18 kB
import { Component, ViewChildren } from '@angular/core'; import { BaseInputComponent } from 'first-npm-package-nicule/forms'; import { ControlContainer, NgForm } from '@angular/forms'; @Component({ templateUrl: 'group-field.component.html', styleUrls: ['../mat-field.scss', 'group-field.component.scss'], viewProviders: [{ provide: ControlContainer, useExisting: NgForm }] }) export class DefaultGroupInputComponent extends BaseInputComponent { get minHeight(): number { const nestedComponents = this.nestedComponents || []; const height = Math.max.apply(null, nestedComponents.map(({nativeElement}) => { const { scrollHeight } = nativeElement; return scrollHeight; })); return height; } @ViewChildren('nestedComponents') nestedComponents; get hasTranslatedLabel(): boolean { const label = this.label; return this.translateService.instant(label) !== label && this.translateService.instant(label) !== 'label'; } isAnyFieldRequired(): boolean { return this.field.fields.filter(field => field.required).length > 0; } }