UNPKG

6.15 kBTypeScriptView Raw
1import type { OnChanges, SimpleChanges } from '@angular/core';
2import type { ControlValueAccessor, FormControl, ValidationErrors, Validator } from '@angular/forms';
3import type { CustomKeyboardEvent } from './custom-keyboard-event';
4import type { NgxMaskConfig } 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 mask: import("@angular/core").InputSignal<string | null | undefined>;
9 specialCharacters: import("@angular/core").InputSignal<string[] | readonly string[]>;
10 patterns: import("@angular/core").InputSignal<Record<string, {
11 pattern: RegExp;
12 optional?: boolean;
13 symbol?: string;
14 }>>;
15 prefix: import("@angular/core").InputSignal<string>;
16 suffix: import("@angular/core").InputSignal<string>;
17 thousandSeparator: import("@angular/core").InputSignal<string>;
18 decimalMarker: import("@angular/core").InputSignal<"." | "," | [".", ","]>;
19 dropSpecialCharacters: import("@angular/core").InputSignal<boolean | string[] | readonly string[] | null>;
20 hiddenInput: import("@angular/core").InputSignal<boolean | null>;
21 showMaskTyped: import("@angular/core").InputSignal<boolean | null>;
22 placeHolderCharacter: import("@angular/core").InputSignal<string | null>;
23 shownMaskExpression: import("@angular/core").InputSignal<string | null>;
24 clearIfNotMatch: import("@angular/core").InputSignal<boolean | null>;
25 validation: import("@angular/core").InputSignal<boolean | null>;
26 separatorLimit: import("@angular/core").InputSignal<string | null>;
27 allowNegativeNumbers: import("@angular/core").InputSignal<boolean | null>;
28 leadZeroDateTime: import("@angular/core").InputSignal<boolean | null>;
29 leadZero: import("@angular/core").InputSignal<boolean | null>;
30 triggerOnMaskChange: import("@angular/core").InputSignal<boolean | null>;
31 apm: import("@angular/core").InputSignal<boolean | null>;
32 inputTransformFn: import("@angular/core").InputSignal<import("./ngx-mask.config").InputTransformFn | null>;
33 outputTransformFn: import("@angular/core").InputSignal<import("./ngx-mask.config").OutputTransformFn | null>;
34 keepCharacterPositions: import("@angular/core").InputSignal<boolean | null>;
35 instantPrefix: import("@angular/core").InputSignal<boolean | null>;
36 maskFilled: import("@angular/core").OutputEmitterRef<void>;
37 private _maskValue;
38 private _inputValue;
39 private _position;
40 private _code;
41 private _maskExpressionArray;
42 private _justPasted;
43 private _isFocused;
44 private _isComposing;
45 _maskService: NgxMaskService;
46 private readonly document;
47 protected _config: NgxMaskConfig;
48 onChange: (_: any) => void;
49 onTouch: () => void;
50 ngOnChanges(changes: SimpleChanges): void;
51 validate({ value }: FormControl): ValidationErrors | null;
52 onPaste(): void;
53 onFocus(): void;
54 onModelChange(value: string | undefined | null | number): void;
55 onInput(e: CustomKeyboardEvent): void;
56 onCompositionStart(): void;
57 onCompositionEnd(e: CustomKeyboardEvent): void;
58 onBlur(e: CustomKeyboardEvent): void;
59 onClick(e: MouseEvent | CustomKeyboardEvent): void;
60 onKeyDown(e: CustomKeyboardEvent): void;
61 writeValue(controlValue: unknown): Promise<void>;
62 registerOnChange(fn: typeof this.onChange): void;
63 registerOnTouched(fn: typeof this.onTouch): void;
64 private _getActiveElement;
65 checkSelectionOnDeletion(el: HTMLInputElement): void;
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"], { "mask": { "alias": "mask"; "required": false; "isSignal": true; }; "specialCharacters": { "alias": "specialCharacters"; "required": false; "isSignal": true; }; "patterns": { "alias": "patterns"; "required": false; "isSignal": true; }; "prefix": { "alias": "prefix"; "required": false; "isSignal": true; }; "suffix": { "alias": "suffix"; "required": false; "isSignal": true; }; "thousandSeparator": { "alias": "thousandSeparator"; "required": false; "isSignal": true; }; "decimalMarker": { "alias": "decimalMarker"; "required": false; "isSignal": true; }; "dropSpecialCharacters": { "alias": "dropSpecialCharacters"; "required": false; "isSignal": true; }; "hiddenInput": { "alias": "hiddenInput"; "required": false; "isSignal": true; }; "showMaskTyped": { "alias": "showMaskTyped"; "required": false; "isSignal": true; }; "placeHolderCharacter": { "alias": "placeHolderCharacter"; "required": false; "isSignal": true; }; "shownMaskExpression": { "alias": "shownMaskExpression"; "required": false; "isSignal": true; }; "clearIfNotMatch": { "alias": "clearIfNotMatch"; "required": false; "isSignal": true; }; "validation": { "alias": "validation"; "required": false; "isSignal": true; }; "separatorLimit": { "alias": "separatorLimit"; "required": false; "isSignal": true; }; "allowNegativeNumbers": { "alias": "allowNegativeNumbers"; "required": false; "isSignal": true; }; "leadZeroDateTime": { "alias": "leadZeroDateTime"; "required": false; "isSignal": true; }; "leadZero": { "alias": "leadZero"; "required": false; "isSignal": true; }; "triggerOnMaskChange": { "alias": "triggerOnMaskChange"; "required": false; "isSignal": true; }; "apm": { "alias": "apm"; "required": false; "isSignal": true; }; "inputTransformFn": { "alias": "inputTransformFn"; "required": false; "isSignal": true; }; "outputTransformFn": { "alias": "outputTransformFn"; "required": false; "isSignal": true; }; "keepCharacterPositions": { "alias": "keepCharacterPositions"; "required": false; "isSignal": true; }; "instantPrefix": { "alias": "instantPrefix"; "required": false; "isSignal": true; }; }, { "maskFilled": "maskFilled"; }, never, never, true, never>;
75}