UNPKG

primeng

Version:

[![npm version](https://badge.fury.io/js/primeng.svg)](https://badge.fury.io/js/primeng) [![npm downloads](https://img.shields.io/npm/dm/primeng.svg)](https://www.npmjs.com/package/primeng) [![Actions CI](https://github.com/primefaces/primeng/workflows/No

274 lines (273 loc) 10.4 kB
import { ChangeDetectorRef, ElementRef, EventEmitter, OnInit, QueryList, TemplateRef } from '@angular/core'; import { ControlValueAccessor } from '@angular/forms'; import { PrimeNGConfig, PrimeTemplate } from 'primeng/api'; import { Nullable } from 'primeng/ts-helpers'; import { Caret } from './inputmask.interface'; import * as i0 from "@angular/core"; import * as i1 from "@angular/common"; import * as i2 from "primeng/inputtext"; import * as i3 from "primeng/autofocus"; import * as i4 from "primeng/icons/times"; import * as i5 from "primeng/api"; export declare const INPUTMASK_VALUE_ACCESSOR: any; /** * InputMask component is used to enter input in a certain format such as numeric, date, currency, email and phone. * @group Components */ export declare class InputMask implements OnInit, ControlValueAccessor { private document; private platformId; el: ElementRef; cd: ChangeDetectorRef; config: PrimeNGConfig; /** * HTML5 input type. * @group Props */ type: string; /** * Placeholder character in mask, default is underscore. * @group Props */ slotChar: string; /** * Clears the incomplete value on blur. * @group Props */ autoClear: boolean; /** * When enabled, a clear icon is displayed to clear the value. * @group Props */ showClear: boolean; /** * Inline style of the input field. * @group Props */ style: { [klass: string]: any; } | null | undefined; /** * Identifier of the focus input to match a label defined for the component. * @group Props */ inputId: string | undefined; /** * Style class of the input field. * @group Props */ styleClass: string | undefined; /** * Advisory information to display on input. * @group Props */ placeholder: string | undefined; /** * Size of the input field. * @group Props */ size: number | undefined; /** * Maximum number of character allows in the input field. * @group Props */ maxlength: number | undefined; /** * Specifies tab order of the element. * @group Props */ tabindex: string | undefined; /** * Title text of the input text. * @group Props */ title: string | undefined; /** * Specifies the input variant of the component. * @group Props */ variant: 'filled' | 'outlined'; /** * Used to define a string that labels the input element. * @group Props */ ariaLabel: string | undefined; /** * Establishes relationships between the component and label(s) where its value should be one or more element IDs. * @group Props */ ariaLabelledBy: string | undefined; /** * Used to indicate that user input is required on an element before a form can be submitted. * @group Props */ ariaRequired: boolean | undefined; /** * When present, it specifies that the element value cannot be altered. * @group Props */ disabled: boolean | undefined; /** * When present, it specifies that an input field is read-only. * @group Props */ readonly: boolean | undefined; /** * Defines if ngModel sets the raw unmasked value to bound value or the formatted mask value. * @group Props */ unmask: boolean | undefined; /** * Name of the input field. * @group Props */ name: string | undefined; /** * When present, it specifies that an input field must be filled out before submitting the form. * @group Props */ required: boolean | undefined; /** * Regex pattern for alpha characters * @group Props */ characterPattern: string; /** * When present, the input gets a focus automatically on load. * @group Props */ autofocus: boolean | undefined; /** * When present, the input gets a focus automatically on load. * @group Props * @deprecated Use autofocus property instead. */ set autoFocus(value: boolean | undefined); /** * Used to define a string that autocomplete attribute the current element. * @group Props */ autocomplete: string | undefined; /** * When present, it specifies that whether to clean buffer value from model. * @group Props */ keepBuffer: boolean; /** * Mask pattern. * @group Props */ get mask(): string | undefined | null; set mask(val: string | undefined | null); /** * Callback to invoke when the mask is completed. * @group Emits */ onComplete: EventEmitter<any>; /** * Callback to invoke when the component receives focus. * @param {Event} event - Browser event. * @group Emits */ onFocus: EventEmitter<Event>; /** * Callback to invoke when the component loses focus. * @param {Event} event - Browser event. * @group Emits */ onBlur: EventEmitter<Event>; /** * Callback to invoke on input. * @param {Event} event - Browser event. * @group Emits */ onInput: EventEmitter<Event>; /** * Callback to invoke on input key press. * @param {Event} event - Browser event. * @group Emits */ onKeydown: EventEmitter<Event>; /** * Callback to invoke when input field is cleared. * @group Emits */ onClear: EventEmitter<any>; inputViewChild: Nullable<ElementRef>; templates: QueryList<PrimeTemplate>; clearIconTemplate: Nullable<TemplateRef<any>>; value: Nullable<string>; _mask: Nullable<string>; onModelChange: Function; onModelTouched: Function; input: Nullable<HTMLInputElement>; filled: Nullable<boolean>; defs: Nullable<{ [klass: string]: any; }>; tests: RegExp[] | any; partialPosition: Nullable<number>; firstNonMaskPos: Nullable<number>; lastRequiredNonMaskPos: Nullable<number>; len: Nullable<number>; oldVal: Nullable<string>; buffer: string[] | any; defaultBuffer: Nullable<string>; focusText: Nullable<string>; caretTimeoutId: any; androidChrome: boolean; focused: Nullable<boolean>; _variant: 'filled' | 'outlined'; get inputClass(): { 'p-inputmask': boolean; }; constructor(document: Document, platformId: any, el: ElementRef, cd: ChangeDetectorRef, config: PrimeNGConfig); ngOnInit(): void; ngAfterContentInit(): void; initMask(): void; writeValue(value: any): void; registerOnChange(fn: Function): void; registerOnTouched(fn: Function): void; setDisabledState(val: boolean): void; caret(first?: number, last?: number): Caret | undefined; isCompleted(): boolean; getPlaceholder(i: number): string; seekNext(pos: number): number; seekPrev(pos: number): number; shiftL(begin: number, end: number): void; shiftR(pos: number): void; handleAndroidInput(e: Event): void; onInputBlur(e: Event): void; onInputKeydown(e: KeyboardEvent): void; onKeyPress(e: KeyboardEvent): void; clearBuffer(start: number, end: number): void; writeBuffer(): void; checkVal(allow?: boolean): number; onInputFocus(event: Event): void; onInputChange(event: Event): void; handleInputChange(event: Event): void; getUnmaskedValue(): string; updateModel(e: Event): void; updateFilledState(): void; focus(): void; clear(): void; static ɵfac: i0.ɵɵFactoryDeclaration<InputMask, never>; static ɵcmp: i0.ɵɵComponentDeclaration<InputMask, "p-inputMask", never, { "type": { "alias": "type"; "required": false; }; "slotChar": { "alias": "slotChar"; "required": false; }; "autoClear": { "alias": "autoClear"; "required": false; }; "showClear": { "alias": "showClear"; "required": false; }; "style": { "alias": "style"; "required": false; }; "inputId": { "alias": "inputId"; "required": false; }; "styleClass": { "alias": "styleClass"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "size": { "alias": "size"; "required": false; }; "maxlength": { "alias": "maxlength"; "required": false; }; "tabindex": { "alias": "tabindex"; "required": false; }; "title": { "alias": "title"; "required": false; }; "variant": { "alias": "variant"; "required": false; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; }; "ariaLabelledBy": { "alias": "ariaLabelledBy"; "required": false; }; "ariaRequired": { "alias": "ariaRequired"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "readonly": { "alias": "readonly"; "required": false; }; "unmask": { "alias": "unmask"; "required": false; }; "name": { "alias": "name"; "required": false; }; "required": { "alias": "required"; "required": false; }; "characterPattern": { "alias": "characterPattern"; "required": false; }; "autofocus": { "alias": "autofocus"; "required": false; }; "autoFocus": { "alias": "autoFocus"; "required": false; }; "autocomplete": { "alias": "autocomplete"; "required": false; }; "keepBuffer": { "alias": "keepBuffer"; "required": false; }; "mask": { "alias": "mask"; "required": false; }; }, { "onComplete": "onComplete"; "onFocus": "onFocus"; "onBlur": "onBlur"; "onInput": "onInput"; "onKeydown": "onKeydown"; "onClear": "onClear"; }, ["templates"], never, false, never>; static ngAcceptInputType_autoClear: unknown; static ngAcceptInputType_showClear: unknown; static ngAcceptInputType_size: unknown; static ngAcceptInputType_maxlength: unknown; static ngAcceptInputType_ariaRequired: unknown; static ngAcceptInputType_disabled: unknown; static ngAcceptInputType_readonly: unknown; static ngAcceptInputType_unmask: unknown; static ngAcceptInputType_required: unknown; static ngAcceptInputType_autofocus: unknown; static ngAcceptInputType_autoFocus: unknown; static ngAcceptInputType_keepBuffer: unknown; } export declare class InputMaskModule { static ɵfac: i0.ɵɵFactoryDeclaration<InputMaskModule, never>; static ɵmod: i0.ɵɵNgModuleDeclaration<InputMaskModule, [typeof InputMask], [typeof i1.CommonModule, typeof i2.InputTextModule, typeof i3.AutoFocusModule, typeof i4.TimesIcon], [typeof InputMask, typeof i5.SharedModule]>; static ɵinj: i0.ɵɵInjectorDeclaration<InputMaskModule>; }