ng-otp-input
Version:
A fully customizable, one-time password input component for the web built with Angular.
57 lines (56 loc) • 2.35 kB
TypeScript
import { OnInit, AfterViewInit, Injector } from '@angular/core';
import { FormGroup, FormControl, ControlValueAccessor, NgControl } from '@angular/forms';
import { Config } from '../../models/config';
import { Subject } from 'rxjs';
import { OnDestroy } from '@angular/core';
import * as i0 from "@angular/core";
export declare class NgOtpInputComponent implements OnInit, AfterViewInit, OnDestroy, ControlValueAccessor {
private document;
private inj;
config: Config;
/**
* @deprecated formCtrl is deprecated and will be removed soon. Use `FormControl` instead.
*/
formCtrl: FormControl;
set disabled(isDisabled: boolean);
onBlur: Subject<void>;
onInputChange: Subject<string>;
otpForm: FormGroup;
currentVal: string;
inputControls: FormControl[];
componentKey: string;
get inputType(): "password" | "tel" | "text";
get controlKeys(): string[];
private destroy$;
private activeFocusCount;
private onChange;
private onTouched;
private _isDisabled;
get formControl(): FormControl<any> | NgControl;
constructor(document: Document, inj: Injector);
ngOnInit(): void;
setDisabledState(isDisabled: boolean): void;
writeValue(value: string): void;
registerOnChange(fn: any): void;
registerOnTouched(fn: any): void;
onFocusIn(): void;
onFocusOut(): void;
ngAfterViewInit(): void;
private getControlName;
onKeyDown($event: any, inputIdx: any): boolean;
hasVal(val: any): boolean;
onInput($event: any, inputIdx: any): void;
onKeyUp($event: any, inputIdx: any): void;
validateNumber(val: any): boolean;
getBoxId(idx: string | number): string;
private clearInput;
private setSelected;
private ifValidKeyCode;
focusTo(eleId: any): void;
setValue(value: any): void;
private rebuildValue;
handlePaste(e: any): void;
ngOnDestroy(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<NgOtpInputComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<NgOtpInputComponent, "ng-otp-input, ngx-otp-input", never, { "config": { "alias": "config"; "required": false; }; "formCtrl": { "alias": "formCtrl"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; }, { "onBlur": "onBlur"; "onInputChange": "onInputChange"; }, never, never, true, never>;
}