UNPKG

truly-ui

Version:
91 lines (90 loc) 2.69 kB
import { OnInit, EventEmitter, OnDestroy } from '@angular/core'; import { ComponentDefaultBase } from './component-default.base'; import { ControlValueAccessor } from '@angular/forms/src/forms'; import { TabIndexService } from '../../form/tabIndex.service'; import { IdGeneratorService } from '../helper/idgenerator.service'; import { NameGeneratorService } from '../helper/namegenerator.service'; import { Validations } from '../validations/validations'; /** * Class that controls all Components that have Models. */ export declare class ComponentHasModelBase extends ComponentDefaultBase implements OnInit, ControlValueAccessor, OnDestroy { /** * Input that receive name attribute. * @type {string} */ name: string; /** * Object of validations (receive a bunch of validations). */ validations: typeof Validations; /** * Text to display in Input Placeholder. * @type {string} */ placeholder: string; /** * ViewChild of ngModel input. */ componentModel: any; /** * Output of Event on Blur element. * @type {EventEmitter} */ blur: EventEmitter<any>; /** * Output of Event on Focus element. * @type {EventEmitter} */ focus: EventEmitter<any>; /** * Variable of ngModel value. */ ngValue: string; constructor(tabIndexService: TabIndexService, idService: IdGeneratorService, nameService: NameGeneratorService); /** * Callback of control value accessor to register touched changes */ onTouchedCallback: Function; /** * Callback of control value accessor to register changes */ onChangeCallback: Function; /** * Lifehook of OnInit Angular. */ ngOnInit(): void; modelValue: any; /** * Function that writes value on ngModel. * @param value Value received to write value on ngModel */ writeValue(value: any): void; /** * Function that register change event on input. * @param callback Value received to write value on ngModel */ registerOnChange(callback: any): void; /** * Function that register touched change event on input. * @param callback Value received to write value on ngModel */ registerOnTouched(callback: any): void; /** * Method that validate if has Validations; * @returns {boolean} */ hasValidation(): boolean; /** * Function called when input lost it focus. */ onBlur(): void; /** * Function called when input receive focus; */ onFocus(): void; /** * Lifehook called when Angular destroy the class. */ ngOnDestroy(): void; }