UNPKG

@uiowa/digit-only

Version:

This package includes two Angular directives. The digitOnly directive only allows numbers in the input box when typing, pasting or drag/dropping. The mask directive checks the input pattern attribute.

35 lines (34 loc) 1.39 kB
import { ElementRef, OnChanges, SimpleChanges } from '@angular/core'; import * as i0 from "@angular/core"; export declare class DigitOnlyDirective implements OnChanges { el: ElementRef; private hasDecimalPoint; private hasNegativeSign; private navigationKeys; decimal: boolean; decimalSeparator: string; allowNegatives: boolean; allowPaste: boolean; negativeSign: string; min: number; max: number; pattern?: string | RegExp; private regex; inputElement: HTMLInputElement; constructor(el: ElementRef); ngOnChanges(changes: SimpleChanges): void; onBeforeInput(e: InputEvent): any; onKeyDown(e: KeyboardEvent): any; onPaste(event: any): void; onDrop(event: DragEvent): void; private pasteData; private insertAtCursor; private triggerEvent; private sanitizeInput; private getNegativeSignRegExp; private isValidDecimal; private getSelection; private forecastValue; static ɵfac: i0.ɵɵFactoryDeclaration<DigitOnlyDirective, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<DigitOnlyDirective, "[digitOnly]", never, { "decimal": "decimal"; "decimalSeparator": "decimalSeparator"; "allowNegatives": "allowNegatives"; "allowPaste": "allowPaste"; "negativeSign": "negativeSign"; "min": "min"; "max": "max"; "pattern": "pattern"; }, {}, never>; }