UNPKG

5.05 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 _justPasted;
39 private _isFocused;
40 /**For IME composition event */
41 private _isComposing;
42 private readonly document;
43 _maskService: NgxMaskService;
44 protected _config: IConfig;
45 onChange: (_: any) => void;
46 onTouch: () => void;
47 ngOnChanges(changes: SimpleChanges): void;
48 validate({ value }: FormControl): ValidationErrors | null;
49 onPaste(): void;
50 onFocus(): void;
51 onModelChange(value: string | undefined | null | number): void;
52 onInput(e: CustomKeyboardEvent): void;
53 onCompositionStart(): void;
54 onCompositionEnd(e: CustomKeyboardEvent): void;
55 onBlur(e: CustomKeyboardEvent): void;
56 onClick(e: MouseEvent | CustomKeyboardEvent): void;
57 onKeyDown(e: CustomKeyboardEvent): void;
58 /** It writes the value in the input */
59 writeValue(controlValue: unknown): Promise<void>;
60 registerOnChange(fn: typeof this.onChange): void;
61 registerOnTouched(fn: typeof this.onTouch): void;
62 private _getActiveElement;
63 checkSelectionOnDeletion(el: HTMLInputElement): void;
64 /** It disables the input element */
65 setDisabledState(isDisabled: boolean): void;
66 private _applyMask;
67 private _validateTime;
68 private _getActualInputLength;
69 private _createValidationError;
70 private _setMask;
71 static ɵfac: i0.ɵɵFactoryDeclaration<NgxMaskDirective, never>;
72 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>;
73}