UNPKG

5.13 kBTypeScriptView Raw
1import { OnChanges, SimpleChanges } from '@angular/core';
2import { ControlValueAccessor, FormControl, ValidationErrors, Validator } from '@angular/forms';
3import { CustomKeyboardEvent } from './custom-keyboard-event';
4import { IConfig } from './ngx-mask.config';
5import { NgxMaskService } from './ngx-mask.service';
6import * as i0 from "@angular/core";
7export declare class NgxMaskDirective implements ControlValueAccessor, OnChanges, Validator {
8 maskExpression: string | undefined | null;
9 specialCharacters: IConfig['specialCharacters'];
10 patterns: IConfig['patterns'];
11 prefix: IConfig['prefix'];
12 suffix: IConfig['suffix'];
13 thousandSeparator: IConfig['thousandSeparator'];
14 decimalMarker: IConfig['decimalMarker'];
15 dropSpecialCharacters: IConfig['dropSpecialCharacters'] | null;
16 hiddenInput: IConfig['hiddenInput'] | null;
17 showMaskTyped: IConfig['showMaskTyped'] | null;
18 placeHolderCharacter: IConfig['placeHolderCharacter'] | null;
19 shownMaskExpression: IConfig['shownMaskExpression'] | null;
20 showTemplate: IConfig['showTemplate'] | null;
21 clearIfNotMatch: IConfig['clearIfNotMatch'] | null;
22 validation: IConfig['validation'] | null;
23 separatorLimit: IConfig['separatorLimit'] | null;
24 allowNegativeNumbers: IConfig['allowNegativeNumbers'] | null;
25 leadZeroDateTime: IConfig['leadZeroDateTime'] | null;
26 leadZero: IConfig['leadZero'] | null;
27 triggerOnMaskChange: IConfig['triggerOnMaskChange'] | null;
28 apm: IConfig['apm'] | null;
29 inputTransformFn: IConfig['inputTransformFn'] | null;
30 outputTransformFn: IConfig['outputTransformFn'] | null;
31 keepCharacterPositions: IConfig['keepCharacterPositions'] | null;
32 maskFilled: IConfig['maskFilled'];
33 private _maskValue;
34 private _inputValue;
35 private _position;
36 private _code;
37 private _maskExpressionArray;
38 private _allowFewMaskChangeMask;
39 private _justPasted;
40 private _isFocused;
41 /**For IME composition event */
42 private _isComposing;
43 private readonly document;
44 _maskService: NgxMaskService;
45 protected _config: IConfig;
46 onChange: (_: any) => void;
47 onTouch: () => void;
48 ngOnChanges(changes: SimpleChanges): void;
49 validate({ value }: FormControl): ValidationErrors | null;
50 onPaste(): void;
51 onFocus(): void;
52 onModelChange(value: string | undefined | null | number): void;
53 onInput(e: CustomKeyboardEvent): void;
54 onCompositionStart(): void;
55 onCompositionEnd(e: CustomKeyboardEvent): void;
56 onBlur(e: CustomKeyboardEvent): void;
57 onClick(e: MouseEvent | CustomKeyboardEvent): void;
58 onKeyDown(e: CustomKeyboardEvent): void;
59 /** It writes the value in the input */
60 writeValue(controlValue: unknown): Promise<void>;
61 registerOnChange(fn: typeof this.onChange): void;
62 registerOnTouched(fn: typeof this.onTouch): void;
63 private _getActiveElement;
64 checkSelectionOnDeletion(el: HTMLInputElement): void;
65 /** It disables the input element */
66 setDisabledState(isDisabled: boolean): void;
67 private _applyMask;
68 private _validateTime;
69 private _getActualInputLength;
70 private _createValidationError;
71 private _setMask;
72 private _areAllCharactersInEachStringSame;
73 static ɵfac: i0.ɵɵFactoryDeclaration<NgxMaskDirective, never>;
74 static ɵdir: i0.ɵɵDirectiveDeclaration<NgxMaskDirective, "input[mask], textarea[mask]", ["mask", "ngxMask"], { "maskExpression": { "alias": "mask"; "required": false; }; "specialCharacters": { "alias": "specialCharacters"; "required": false; }; "patterns": { "alias": "patterns"; "required": false; }; "prefix": { "alias": "prefix"; "required": false; }; "suffix": { "alias": "suffix"; "required": false; }; "thousandSeparator": { "alias": "thousandSeparator"; "required": false; }; "decimalMarker": { "alias": "decimalMarker"; "required": false; }; "dropSpecialCharacters": { "alias": "dropSpecialCharacters"; "required": false; }; "hiddenInput": { "alias": "hiddenInput"; "required": false; }; "showMaskTyped": { "alias": "showMaskTyped"; "required": false; }; "placeHolderCharacter": { "alias": "placeHolderCharacter"; "required": false; }; "shownMaskExpression": { "alias": "shownMaskExpression"; "required": false; }; "showTemplate": { "alias": "showTemplate"; "required": false; }; "clearIfNotMatch": { "alias": "clearIfNotMatch"; "required": false; }; "validation": { "alias": "validation"; "required": false; }; "separatorLimit": { "alias": "separatorLimit"; "required": false; }; "allowNegativeNumbers": { "alias": "allowNegativeNumbers"; "required": false; }; "leadZeroDateTime": { "alias": "leadZeroDateTime"; "required": false; }; "leadZero": { "alias": "leadZero"; "required": false; }; "triggerOnMaskChange": { "alias": "triggerOnMaskChange"; "required": false; }; "apm": { "alias": "apm"; "required": false; }; "inputTransformFn": { "alias": "inputTransformFn"; "required": false; }; "outputTransformFn": { "alias": "outputTransformFn"; "required": false; }; "keepCharacterPositions": { "alias": "keepCharacterPositions"; "required": false; }; }, { "maskFilled": "maskFilled"; }, never, never, true, never>;
75}