UNPKG

ngx-mask

Version:
1 lines 113 kB
{"version":3,"file":"ngx-mask.js","sources":["../../../projects/ngx-mask-lib/src/lib/config.ts","../../../projects/ngx-mask-lib/src/lib/mask-applier.service.ts","../../../projects/ngx-mask-lib/src/lib/mask.service.ts","../../../projects/ngx-mask-lib/src/lib/mask.directive.ts","../../../projects/ngx-mask-lib/src/lib/mask.pipe.ts","../../../projects/ngx-mask-lib/src/lib/ngx-mask.module.ts","../../../projects/ngx-mask-lib/src/lib/custom-keyboard-event.ts","../../../projects/ngx-mask-lib/src/ngx-mask.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nexport interface IConfig {\n suffix: string;\n prefix: string;\n thousandSeparator: string;\n decimalMarker: '.' | ',';\n clearIfNotMatch: boolean;\n showTemplate: boolean;\n showMaskTyped: boolean;\n placeHolderCharacter: string;\n shownMaskExpression: string;\n dropSpecialCharacters: boolean | string[];\n specialCharacters: string[];\n hiddenInput: boolean | undefined;\n validation: boolean;\n separatorLimit: string;\n allowNegativeNumbers: boolean;\n leadZeroDateTime: boolean;\n patterns: {\n [character: string]: {\n pattern: RegExp;\n optional?: boolean;\n symbol?: string;\n };\n };\n}\n\nexport type optionsConfig = Partial<IConfig>;\nexport const config: InjectionToken<IConfig> = new InjectionToken('config');\nexport const NEW_CONFIG: InjectionToken<IConfig> = new InjectionToken('NEW_CONFIG');\nexport const INITIAL_CONFIG: InjectionToken<IConfig> = new InjectionToken('INITIAL_CONFIG');\n\nexport const initialConfig: IConfig = {\n suffix: '',\n prefix: '',\n thousandSeparator: ' ',\n decimalMarker: '.',\n clearIfNotMatch: false,\n showTemplate: false,\n showMaskTyped: false,\n placeHolderCharacter: '_',\n dropSpecialCharacters: true,\n hiddenInput: undefined,\n shownMaskExpression: '',\n separatorLimit: '',\n allowNegativeNumbers: false,\n validation: true,\n // tslint:disable-next-line: quotemark\n specialCharacters: ['-', '/', '(', ')', '.', ':', ' ', '+', ',', '@', '[', ']', '\"', \"'\"],\n leadZeroDateTime: false,\n patterns: {\n '0': {\n pattern: new RegExp('\\\\d'),\n },\n '9': {\n pattern: new RegExp('\\\\d'),\n optional: true,\n },\n X: {\n pattern: new RegExp('\\\\d'),\n symbol: '*',\n },\n A: {\n pattern: new RegExp('[a-zA-Z0-9]'),\n },\n S: {\n pattern: new RegExp('[a-zA-Z]'),\n },\n d: {\n pattern: new RegExp('\\\\d'),\n },\n m: {\n pattern: new RegExp('\\\\d'),\n },\n M: {\n pattern: new RegExp('\\\\d'),\n },\n H: {\n pattern: new RegExp('\\\\d'),\n },\n h: {\n pattern: new RegExp('\\\\d'),\n },\n s: {\n pattern: new RegExp('\\\\d'),\n },\n },\n};\n\nexport const timeMasks: string[] = ['Hh:m0:s0', 'Hh:m0', 'm0:s0'];\n\nexport const withoutValidation: string[] = [\n 'percent',\n 'Hh',\n 's0',\n 'm0',\n 'separator',\n 'd0/M0/0000',\n 'd0/M0',\n 'd0',\n 'M0',\n];\n","import { Inject, Injectable } from '@angular/core';\nimport { config, IConfig } from './config';\n\n@Injectable()\nexport class MaskApplierService {\n public dropSpecialCharacters: IConfig['dropSpecialCharacters'];\n public hiddenInput: IConfig['hiddenInput'];\n public showTemplate!: IConfig['showTemplate'];\n public clearIfNotMatch!: IConfig['clearIfNotMatch'];\n public maskExpression: string = '';\n public actualValue: string = '';\n public shownMaskExpression: string = '';\n public maskSpecialCharacters!: IConfig['specialCharacters'];\n public maskAvailablePatterns!: IConfig['patterns'];\n public prefix!: IConfig['prefix'];\n public suffix!: IConfig['suffix'];\n public thousandSeparator!: IConfig['thousandSeparator'];\n public decimalMarker!: IConfig['decimalMarker'];\n public customPattern!: IConfig['patterns'];\n public ipError?: boolean;\n public cpfCnpjError?: boolean;\n public showMaskTyped!: IConfig['showMaskTyped'];\n public placeHolderCharacter!: IConfig['placeHolderCharacter'];\n public validation: IConfig['validation'];\n public separatorLimit: IConfig['separatorLimit'];\n public allowNegativeNumbers: IConfig['allowNegativeNumbers'];\n public leadZeroDateTime: IConfig['leadZeroDateTime'];\n\n private _shift!: Set<number>;\n\n public constructor(@Inject(config) protected _config: IConfig) {\n this._shift = new Set();\n this.clearIfNotMatch = this._config.clearIfNotMatch;\n this.dropSpecialCharacters = this._config.dropSpecialCharacters;\n this.maskSpecialCharacters = this._config.specialCharacters;\n this.maskAvailablePatterns = this._config.patterns;\n this.prefix = this._config.prefix;\n this.suffix = this._config.suffix;\n this.thousandSeparator = this._config.thousandSeparator;\n this.decimalMarker = this._config.decimalMarker;\n this.hiddenInput = this._config.hiddenInput;\n this.showMaskTyped = this._config.showMaskTyped;\n this.placeHolderCharacter = this._config.placeHolderCharacter;\n this.validation = this._config.validation;\n this.separatorLimit = this._config.separatorLimit;\n this.allowNegativeNumbers = this._config.allowNegativeNumbers;\n this.leadZeroDateTime = this._config.leadZeroDateTime;\n }\n\n public applyMaskWithPattern(inputValue: string, maskAndPattern: [string, IConfig['patterns']]): string {\n const [mask, customPattern] = maskAndPattern;\n this.customPattern = customPattern;\n return this.applyMask(inputValue, mask);\n }\n\n public applyMask(\n inputValue: string,\n maskExpression: string,\n position: number = 0,\n justPasted: boolean = false,\n backspaced: boolean = false,\n cb: Function = () => {}\n ): string {\n if (inputValue === undefined || inputValue === null || maskExpression === undefined) {\n return '';\n }\n let cursor = 0;\n let result = '';\n let multi = false;\n let backspaceShift = false;\n let shift = 1;\n let stepBack = false;\n if (inputValue.slice(0, this.prefix.length) === this.prefix) {\n inputValue = inputValue.slice(this.prefix.length, inputValue.length);\n }\n if (!!this.suffix && inputValue?.length > 0) {\n inputValue = this.checkAndRemoveSuffix(inputValue);\n }\n const inputArray: string[] = inputValue.toString().split('');\n if (maskExpression === 'IP') {\n this.ipError = !!(inputArray.filter((i: string) => i === '.').length < 3 && inputArray.length < 7);\n maskExpression = '099.099.099.099';\n }\n const arr: string[] = [];\n for (let i = 0; i < inputValue.length; i++) {\n if (inputValue[i].match('\\\\d')) {\n arr.push(inputValue[i]);\n }\n }\n if (maskExpression === 'CPF_CNPJ') {\n this.cpfCnpjError = !!(arr.length !== 11 && arr.length !== 14);\n if (arr.length > 11) {\n maskExpression = '00.000.000/0000-00';\n } else {\n maskExpression = '000.000.000-00';\n }\n }\n if (maskExpression.startsWith('percent')) {\n if (inputValue.match('[a-z]|[A-Z]') || inputValue.match(/[-!$%^&*()_+|~=`{}\\[\\]:\";'<>?,\\/.]/)) {\n inputValue = this._stripToDecimal(inputValue);\n const precision: number = this.getPrecision(maskExpression);\n inputValue = this.checkInputPrecision(inputValue, precision, this.decimalMarker);\n }\n if (inputValue.indexOf('.') > 0 && !this.percentage(inputValue.substring(0, inputValue.indexOf('.')))) {\n const base: string = inputValue.substring(0, inputValue.indexOf('.') - 1);\n inputValue = `${base}${inputValue.substring(inputValue.indexOf('.'), inputValue.length)}`;\n }\n if (this.percentage(inputValue)) {\n result = inputValue;\n } else {\n result = inputValue.substring(0, inputValue.length - 1);\n }\n } else if (maskExpression.startsWith('separator')) {\n if (\n inputValue.match('[wа-яА-Я]') ||\n inputValue.match('[ЁёА-я]') ||\n inputValue.match('[a-z]|[A-Z]') ||\n inputValue.match(/[-@#!$%\\\\^&*()_£¬'+|~=`{}\\[\\]:\";<>.?\\/]/) ||\n inputValue.match('[^A-Za-z0-9,]')\n ) {\n inputValue = this._stripToDecimal(inputValue);\n }\n\n inputValue =\n inputValue.length > 1 && inputValue[0] === '0' && inputValue[1] !== this.decimalMarker\n ? inputValue.slice(1, inputValue.length)\n : inputValue;\n\n // TODO: we had different rexexps here for the different cases... but tests dont seam to bother - check this\n // separator: no COMMA, dot-sep: no SPACE, COMMA OK, comma-sep: no SPACE, COMMA OK\n\n const thousandSeperatorCharEscaped: string = this._charToRegExpExpression(this.thousandSeparator);\n const decimalMarkerEscaped: string = this._charToRegExpExpression(this.decimalMarker);\n const invalidChars: string = '@#!$%^&*()_+|~=`{}\\\\[\\\\]:\\\\s,\\\\.\";<>?\\\\/'\n .replace(thousandSeperatorCharEscaped, '')\n .replace(decimalMarkerEscaped, '');\n\n const invalidCharRegexp: RegExp = new RegExp('[' + invalidChars + ']');\n\n if (inputValue.match(invalidCharRegexp)) {\n inputValue = inputValue.substring(0, inputValue.length - 1);\n }\n\n const precision: number = this.getPrecision(maskExpression);\n inputValue = this.checkInputPrecision(inputValue, precision, this.decimalMarker);\n const strForSep: string = inputValue.replace(new RegExp(thousandSeperatorCharEscaped, 'g'), '');\n result = this._formatWithSeparators(strForSep, this.thousandSeparator, this.decimalMarker, precision);\n\n const commaShift: number = result.indexOf(',') - inputValue.indexOf(',');\n const shiftStep: number = result.length - inputValue.length;\n\n if (shiftStep > 0 && result[position] !== ',') {\n backspaceShift = true;\n let _shift = 0;\n do {\n this._shift.add(position + _shift);\n _shift++;\n } while (_shift < shiftStep);\n } else if (\n (commaShift !== 0 && position > 0 && !(result.indexOf(',') >= position && position > 3)) ||\n (!(result.indexOf('.') >= position && position > 3) && shiftStep <= 0)\n ) {\n this._shift.clear();\n backspaceShift = true;\n shift = shiftStep;\n position += shiftStep;\n this._shift.add(position);\n } else {\n this._shift.clear();\n }\n } else {\n for (\n // tslint:disable-next-line\n let i: number = 0, inputSymbol: string = inputArray[0];\n i < inputArray.length;\n i++, inputSymbol = inputArray[i]\n ) {\n if (cursor === maskExpression.length) {\n break;\n }\n if (this._checkSymbolMask(inputSymbol, maskExpression[cursor]) && maskExpression[cursor + 1] === '?') {\n result += inputSymbol;\n cursor += 2;\n } else if (\n maskExpression[cursor + 1] === '*' &&\n multi &&\n this._checkSymbolMask(inputSymbol, maskExpression[cursor + 2])\n ) {\n result += inputSymbol;\n cursor += 3;\n multi = false;\n } else if (this._checkSymbolMask(inputSymbol, maskExpression[cursor]) && maskExpression[cursor + 1] === '*') {\n result += inputSymbol;\n multi = true;\n } else if (\n maskExpression[cursor + 1] === '?' &&\n this._checkSymbolMask(inputSymbol, maskExpression[cursor + 2])\n ) {\n result += inputSymbol;\n cursor += 3;\n } else if (this._checkSymbolMask(inputSymbol, maskExpression[cursor])) {\n if (maskExpression[cursor] === 'H') {\n if (Number(inputSymbol) > 2) {\n cursor += 1;\n this._shiftStep(maskExpression, cursor, inputArray.length);\n i--;\n if (this.leadZeroDateTime) {\n result += '0';\n }\n continue;\n }\n }\n if (maskExpression[cursor] === 'h') {\n if (result === '2' && Number(inputSymbol) > 3) {\n cursor += 1;\n i--;\n continue;\n }\n }\n if (maskExpression[cursor] === 'm') {\n if (Number(inputSymbol) > 5) {\n cursor += 1;\n this._shiftStep(maskExpression, cursor, inputArray.length);\n i--;\n if (this.leadZeroDateTime) {\n result += '0';\n }\n continue;\n }\n }\n if (maskExpression[cursor] === 's') {\n if (Number(inputSymbol) > 5) {\n cursor += 1;\n this._shiftStep(maskExpression, cursor, inputArray.length);\n i--;\n if (this.leadZeroDateTime) {\n result += '0';\n }\n continue;\n }\n }\n const daysCount = 31;\n if (maskExpression[cursor] === 'd') {\n if (\n (Number(inputSymbol) > 3 && this.leadZeroDateTime) ||\n Number(inputValue.slice(cursor, cursor + 2)) > daysCount ||\n inputValue[cursor + 1] === '/'\n ) {\n cursor += 1;\n this._shiftStep(maskExpression, cursor, inputArray.length);\n i--;\n if (this.leadZeroDateTime) {\n result += '0';\n }\n continue;\n }\n }\n if (maskExpression[cursor] === 'M') {\n const monthsCount = 12;\n // mask without day\n const withoutDays: boolean =\n cursor === 0 &&\n (Number(inputSymbol) > 2 ||\n Number(inputValue.slice(cursor, cursor + 2)) > monthsCount ||\n inputValue[cursor + 1] === '/');\n // day<10 && month<12 for input\n const day1monthInput: boolean =\n inputValue.slice(cursor - 3, cursor - 1).includes('/') &&\n ((inputValue[cursor - 2] === '/' &&\n Number(inputValue.slice(cursor - 1, cursor + 1)) > monthsCount &&\n inputValue[cursor] !== '/') ||\n inputValue[cursor] === '/' ||\n (inputValue[cursor - 3] === '/' &&\n Number(inputValue.slice(cursor - 2, cursor)) > monthsCount &&\n inputValue[cursor - 1] !== '/') ||\n inputValue[cursor - 1] === '/');\n // 10<day<31 && month<12 for input\n const day2monthInput: boolean =\n Number(inputValue.slice(cursor - 3, cursor - 1)) <= daysCount &&\n !inputValue.slice(cursor - 3, cursor - 1).includes('/') &&\n inputValue[cursor - 1] === '/' &&\n (Number(inputValue.slice(cursor, cursor + 2)) > monthsCount || inputValue[cursor + 1] === '/');\n // day<10 && month<12 for paste whole data\n const day1monthPaste: boolean =\n Number(inputValue.slice(cursor - 3, cursor - 1)) > daysCount &&\n !inputValue.slice(cursor - 3, cursor - 1).includes('/') &&\n !inputValue.slice(cursor - 2, cursor).includes('/') &&\n Number(inputValue.slice(cursor - 2, cursor)) > monthsCount;\n // 10<day<31 && month<12 for paste whole data\n const day2monthPaste: boolean =\n Number(inputValue.slice(cursor - 3, cursor - 1)) <= daysCount &&\n !inputValue.slice(cursor - 3, cursor - 1).includes('/') &&\n inputValue[cursor - 1] !== '/' &&\n Number(inputValue.slice(cursor - 1, cursor + 1)) > monthsCount;\n\n if (\n (Number(inputSymbol) > 1 && this.leadZeroDateTime) ||\n withoutDays ||\n day1monthInput ||\n day2monthInput ||\n day1monthPaste ||\n day2monthPaste\n ) {\n cursor += 1;\n this._shiftStep(maskExpression, cursor, inputArray.length);\n i--;\n if (this.leadZeroDateTime) {\n result += '0';\n }\n continue;\n }\n }\n result += inputSymbol;\n cursor++;\n } else if (this.maskSpecialCharacters.indexOf(maskExpression[cursor]) !== -1) {\n result += maskExpression[cursor];\n cursor++;\n this._shiftStep(maskExpression, cursor, inputArray.length);\n i--;\n } else if (\n this.maskSpecialCharacters.indexOf(inputSymbol) > -1 &&\n this.maskAvailablePatterns[maskExpression[cursor]] &&\n this.maskAvailablePatterns[maskExpression[cursor]].optional\n ) {\n if (\n !!inputArray[cursor] &&\n maskExpression !== '099.099.099.099' &&\n maskExpression !== '000.000.000-00' &&\n maskExpression !== '00.000.000/0000-00'\n ) {\n result += inputArray[cursor];\n }\n cursor++;\n i--;\n } else if (\n this.maskExpression[cursor + 1] === '*' &&\n this._findSpecialChar(this.maskExpression[cursor + 2]) &&\n this._findSpecialChar(inputSymbol) === this.maskExpression[cursor + 2] &&\n multi\n ) {\n cursor += 3;\n result += inputSymbol;\n } else if (\n this.maskExpression[cursor + 1] === '?' &&\n this._findSpecialChar(this.maskExpression[cursor + 2]) &&\n this._findSpecialChar(inputSymbol) === this.maskExpression[cursor + 2] &&\n multi\n ) {\n cursor += 3;\n result += inputSymbol;\n } else if (\n this.showMaskTyped &&\n this.maskSpecialCharacters.indexOf(inputSymbol) < 0 &&\n inputSymbol !== this.placeHolderCharacter\n ) {\n stepBack = true;\n }\n }\n }\n if (\n result.length + 1 === maskExpression.length &&\n this.maskSpecialCharacters.indexOf(maskExpression[maskExpression.length - 1]) !== -1\n ) {\n result += maskExpression[maskExpression.length - 1];\n }\n\n let newPosition: number = position + 1;\n\n while (this._shift.has(newPosition)) {\n shift++;\n newPosition++;\n }\n\n let actualShift: number = justPasted ? cursor : this._shift.has(position) ? shift : 0;\n if (stepBack) {\n actualShift--;\n }\n\n cb(actualShift, backspaceShift);\n if (shift < 0) {\n this._shift.clear();\n }\n let onlySpecial = false;\n if (backspaced) {\n onlySpecial = inputArray.every((char) => this.maskSpecialCharacters.includes(char));\n }\n let res = `${this.prefix}${onlySpecial ? '' : result}${this.suffix}`;\n if (result.length === 0) {\n res = `${this.prefix}${result}`;\n }\n return res;\n }\n\n public _findSpecialChar(inputSymbol: string): undefined | string {\n return this.maskSpecialCharacters.find((val: string) => val === inputSymbol);\n }\n\n protected _checkSymbolMask(inputSymbol: string, maskSymbol: string): boolean {\n this.maskAvailablePatterns = this.customPattern ? this.customPattern : this.maskAvailablePatterns;\n return (\n this.maskAvailablePatterns[maskSymbol] &&\n this.maskAvailablePatterns[maskSymbol].pattern &&\n this.maskAvailablePatterns[maskSymbol].pattern.test(inputSymbol)\n );\n }\n\n private _formatWithSeparators = (\n str: string,\n thousandSeparatorChar: string,\n decimalChar: string,\n precision: number\n ) => {\n const x: string[] = str.split(decimalChar);\n const decimals: string = x.length > 1 ? `${decimalChar}${x[1]}` : '';\n let res: string = x[0];\n const separatorLimit: string = this.separatorLimit.replace(/\\s/g, '');\n if (separatorLimit && +separatorLimit) {\n if (res[0] === '-') {\n res = `-${res.slice(1, res.length).slice(0, separatorLimit.length)}`;\n } else {\n res = res.slice(0, separatorLimit.length);\n }\n }\n const rgx: RegExp = /(\\d+)(\\d{3})/;\n\n while (thousandSeparatorChar && rgx.test(res)) {\n res = res.replace(rgx, '$1' + thousandSeparatorChar + '$2');\n }\n\n if (precision === undefined) {\n return res + decimals;\n } else if (precision === 0) {\n return res;\n }\n return res + decimals.substr(0, precision + 1);\n };\n\n private percentage = (str: string): boolean => {\n return Number(str) >= 0 && Number(str) <= 100;\n };\n\n private getPrecision = (maskExpression: string): number => {\n const x: string[] = maskExpression.split('.');\n if (x.length > 1) {\n return Number(x[x.length - 1]);\n }\n\n return Infinity;\n };\n\n private checkAndRemoveSuffix = (inputValue: string): string => {\n for (let i = this.suffix?.length - 1; i >= 0; i--) {\n const substr = this.suffix.substr(i, this.suffix?.length);\n if (\n inputValue.includes(substr) &&\n (i - 1 < 0 || !inputValue.includes(this.suffix.substr(i - 1, this.suffix?.length)))\n ) {\n return inputValue.replace(substr, '');\n }\n }\n return inputValue;\n };\n\n private checkInputPrecision = (\n inputValue: string,\n precision: number,\n decimalMarker: IConfig['decimalMarker']\n ): string => {\n if (precision < Infinity) {\n const precisionRegEx: RegExp = new RegExp(this._charToRegExpExpression(decimalMarker) + `\\\\d{${precision}}.*$`);\n\n const precisionMatch: RegExpMatchArray | null = inputValue.match(precisionRegEx);\n if (precisionMatch && precisionMatch[0].length - 1 > precision) {\n const diff = precisionMatch[0].length - 1 - precision;\n inputValue = inputValue.substring(0, inputValue.length - diff);\n }\n if (precision === 0 && inputValue.endsWith(decimalMarker)) {\n inputValue = inputValue.substring(0, inputValue.length - 1);\n }\n }\n return inputValue;\n };\n\n private _stripToDecimal(str: string): string {\n return str\n .split('')\n .filter((i: string, idx: number) => {\n return (\n i.match('^-?\\\\d') ||\n i.match('\\\\s') ||\n i === '.' ||\n i === ',' ||\n (i === '-' && idx === 0 && this.allowNegativeNumbers)\n );\n })\n .join('');\n }\n\n private _charToRegExpExpression(char: string): string {\n if (char) {\n const charsToEscape = '[\\\\^$.|?*+()';\n return char === ' ' ? '\\\\s' : charsToEscape.indexOf(char) >= 0 ? '\\\\' + char : char;\n }\n return char;\n }\n\n private _shiftStep(maskExpression: string, cursor: number, inputLength: number) {\n const shiftStep: number = /[*?]/g.test(maskExpression.slice(0, cursor)) ? inputLength : cursor;\n this._shift.add(shiftStep + this.prefix.length || 0);\n }\n}\n","import { ElementRef, Inject, Injectable, Renderer2 } from '@angular/core';\nimport { DOCUMENT } from '@angular/common';\n\nimport { config, IConfig } from './config';\nimport { MaskApplierService } from './mask-applier.service';\n\n@Injectable()\nexport class MaskService extends MaskApplierService {\n public maskExpression: string = '';\n public isNumberValue: boolean = false;\n public placeHolderCharacter: string = '_';\n public maskIsShown: string = '';\n public selStart: number | null = null;\n public selEnd: number | null = null;\n\n /**\n * Whether we are currently in writeValue function, in this case when applying the mask we don't want to trigger onChange function,\n * since writeValue should be a one way only process of writing the DOM value based on the Angular model value.\n */\n public writingValue: boolean = false;\n\n public onChange = (_: any) => {};\n\n public constructor(\n @Inject(DOCUMENT) private document: any,\n @Inject(config) protected _config: IConfig,\n private _elementRef: ElementRef,\n private _renderer: Renderer2\n ) {\n super(_config);\n }\n\n // tslint:disable-next-line:cyclomatic-complexity\n public applyMask(\n inputValue: string,\n maskExpression: string,\n position: number = 0,\n justPasted = false,\n backspaced = false,\n cb: Function = () => {}\n ): string {\n if (!maskExpression) {\n return inputValue;\n }\n this.maskIsShown = this.showMaskTyped ? this.showMaskInInput() : '';\n if (this.maskExpression === 'IP' && this.showMaskTyped) {\n this.maskIsShown = this.showMaskInInput(inputValue || '#');\n }\n if (this.maskExpression === 'CPF_CNPJ' && this.showMaskTyped) {\n this.maskIsShown = this.showMaskInInput(inputValue || '#');\n }\n if (!inputValue && this.showMaskTyped) {\n this.formControlResult(this.prefix);\n return this.prefix + this.maskIsShown;\n }\n const getSymbol: string = !!inputValue && typeof this.selStart === 'number' ? inputValue[this.selStart] : '';\n let newInputValue = '';\n if (this.hiddenInput && !this.writingValue) {\n let actualResult: string[] = this.actualValue.split('');\n // tslint:disable no-unused-expression\n inputValue !== '' && actualResult.length\n ? typeof this.selStart === 'number' && typeof this.selEnd === 'number'\n ? inputValue.length > actualResult.length\n ? actualResult.splice(this.selStart, 0, getSymbol)\n : inputValue.length < actualResult.length\n ? actualResult.length - inputValue.length === 1\n ? actualResult.splice(this.selStart - 1, 1)\n : actualResult.splice(this.selStart, this.selEnd - this.selStart)\n : null\n : null\n : (actualResult = []);\n // tslint:enable no-unused-expression\n newInputValue =\n this.actualValue.length && actualResult.length <= inputValue.length\n ? this.shiftTypedSymbols(actualResult.join(''))\n : inputValue;\n }\n newInputValue = Boolean(newInputValue) && newInputValue.length ? newInputValue : inputValue;\n const result: string = super.applyMask(newInputValue, maskExpression, position, justPasted, backspaced, cb);\n this.actualValue = this.getActualValue(result);\n\n // handle some separator implications:\n // a.) adjust decimalMarker default (. -> ,) if thousandSeparator is a dot\n if (this.thousandSeparator === '.' && this.decimalMarker === '.') {\n this.decimalMarker = ',';\n }\n\n // b) remove decimal marker from list of special characters to mask\n if (this.maskExpression.startsWith('separator') && this.dropSpecialCharacters === true) {\n this.maskSpecialCharacters = this.maskSpecialCharacters.filter((item: string) => item !== this.decimalMarker);\n }\n\n this.formControlResult(result);\n\n if (!this.showMaskTyped) {\n if (this.hiddenInput) {\n return result && result.length ? this.hideInput(result, this.maskExpression) : result;\n }\n return result;\n }\n const resLen: number = result.length;\n const prefNmask: string = this.prefix + this.maskIsShown;\n\n if (this.maskExpression.includes('H')) {\n const countSkipedSymbol = this._numberSkipedSymbols(result);\n return result + prefNmask.slice(resLen + countSkipedSymbol);\n } else if (this.maskExpression === 'IP' || this.maskExpression === 'CPF_CNPJ') {\n return result + prefNmask;\n }\n return result + prefNmask.slice(resLen);\n }\n\n // get the number of characters that were shifted\n private _numberSkipedSymbols(value: string): number {\n const regex = /(^|\\D)(\\d\\D)/g;\n let match = regex.exec(value);\n let countSkipedSymbol = 0;\n while (match != null) {\n countSkipedSymbol += 1;\n match = regex.exec(value);\n }\n return countSkipedSymbol;\n }\n\n public applyValueChanges(\n position: number = 0,\n justPasted: boolean,\n backspaced: boolean,\n cb: Function = () => {}\n ): void {\n const formElement = this._elementRef.nativeElement;\n formElement.value = this.applyMask(formElement.value, this.maskExpression, position, justPasted, backspaced, cb);\n if (formElement === this.document.activeElement) {\n return;\n }\n this.clearIfNotMatchFn();\n }\n\n public hideInput(inputValue: string, maskExpression: string): string {\n return inputValue\n .split('')\n .map((curr: string, index: number) => {\n if (\n this.maskAvailablePatterns &&\n this.maskAvailablePatterns[maskExpression[index]] &&\n this.maskAvailablePatterns[maskExpression[index]].symbol\n ) {\n return this.maskAvailablePatterns[maskExpression[index]].symbol;\n }\n return curr;\n })\n .join('');\n }\n\n // this function is not necessary, it checks result against maskExpression\n public getActualValue(res: string): string {\n const compare: string[] = res\n .split('')\n .filter(\n (symbol: string, i: number) =>\n this._checkSymbolMask(symbol, this.maskExpression[i]) ||\n (this.maskSpecialCharacters.includes(this.maskExpression[i]) && symbol === this.maskExpression[i])\n );\n if (compare.join('') === res) {\n return compare.join('');\n }\n return res;\n }\n\n public shiftTypedSymbols(inputValue: string): string {\n let symbolToReplace = '';\n const newInputValue: string[] =\n (inputValue &&\n inputValue.split('').map((currSymbol: string, index: number) => {\n if (\n this.maskSpecialCharacters.includes(inputValue[index + 1]) &&\n inputValue[index + 1] !== this.maskExpression[index + 1]\n ) {\n symbolToReplace = currSymbol;\n return inputValue[index + 1];\n }\n if (symbolToReplace.length) {\n const replaceSymbol: string = symbolToReplace;\n symbolToReplace = '';\n return replaceSymbol;\n }\n return currSymbol;\n })) ||\n [];\n return newInputValue.join('');\n }\n\n public showMaskInInput(inputVal?: string): string {\n if (this.showMaskTyped && !!this.shownMaskExpression) {\n if (this.maskExpression.length !== this.shownMaskExpression.length) {\n throw new Error('Mask expression must match mask placeholder length');\n } else {\n return this.shownMaskExpression;\n }\n } else if (this.showMaskTyped) {\n if (inputVal) {\n if (this.maskExpression === 'IP') {\n return this._checkForIp(inputVal);\n }\n if (this.maskExpression === 'CPF_CNPJ') {\n return this._checkForCpfCnpj(inputVal);\n }\n }\n return this.maskExpression.replace(/\\w/g, this.placeHolderCharacter);\n }\n return '';\n }\n\n public clearIfNotMatchFn(): void {\n const formElement = this._elementRef.nativeElement;\n if (\n this.clearIfNotMatch &&\n this.prefix.length + this.maskExpression.length + this.suffix.length !==\n formElement.value.replace(/_/g, '').length\n ) {\n this.formElementProperty = ['value', ''];\n this.applyMask(formElement.value, this.maskExpression);\n }\n }\n\n public set formElementProperty([name, value]: [string, string | boolean]) {\n Promise.resolve().then(() => this._renderer.setProperty(this._elementRef.nativeElement, name, value));\n }\n\n public checkSpecialCharAmount(mask: string): number {\n const chars: string[] = mask.split('').filter((item: string) => this._findSpecialChar(item));\n return chars.length;\n }\n\n public removeMask(inputValue: string): string {\n return this._removeMask(\n this._removeSuffix(this._removePrefix(inputValue)),\n this.maskSpecialCharacters.concat('_').concat(this.placeHolderCharacter)\n );\n }\n\n private _checkForIp(inputVal: string): string {\n if (inputVal === '#') {\n return `${this.placeHolderCharacter}.${this.placeHolderCharacter}.${this.placeHolderCharacter}.${this.placeHolderCharacter}`;\n }\n const arr: string[] = [];\n for (let i = 0; i < inputVal.length; i++) {\n if (inputVal[i].match('\\\\d')) {\n arr.push(inputVal[i]);\n }\n }\n if (arr.length <= 3) {\n return `${this.placeHolderCharacter}.${this.placeHolderCharacter}.${this.placeHolderCharacter}`;\n }\n if (arr.length > 3 && arr.length <= 6) {\n return `${this.placeHolderCharacter}.${this.placeHolderCharacter}`;\n }\n if (arr.length > 6 && arr.length <= 9) {\n return this.placeHolderCharacter;\n }\n if (arr.length > 9 && arr.length <= 12) {\n return '';\n }\n return '';\n }\n\n private _checkForCpfCnpj(inputVal: string): string {\n const cpf =\n `${this.placeHolderCharacter}${this.placeHolderCharacter}${this.placeHolderCharacter}` +\n `.${this.placeHolderCharacter}${this.placeHolderCharacter}${this.placeHolderCharacter}` +\n `.${this.placeHolderCharacter}${this.placeHolderCharacter}${this.placeHolderCharacter}` +\n `-${this.placeHolderCharacter}${this.placeHolderCharacter}`;\n const cnpj =\n `${this.placeHolderCharacter}${this.placeHolderCharacter}` +\n `.${this.placeHolderCharacter}${this.placeHolderCharacter}${this.placeHolderCharacter}` +\n `.${this.placeHolderCharacter}${this.placeHolderCharacter}${this.placeHolderCharacter}` +\n `/${this.placeHolderCharacter}${this.placeHolderCharacter}${this.placeHolderCharacter}${this.placeHolderCharacter}` +\n `-${this.placeHolderCharacter}${this.placeHolderCharacter}`;\n\n if (inputVal === '#') {\n return cpf;\n }\n const arr: string[] = [];\n for (let i = 0; i < inputVal.length; i++) {\n if (inputVal[i].match('\\\\d')) {\n arr.push(inputVal[i]);\n }\n }\n if (arr.length <= 3) {\n return cpf.slice(arr.length, cpf.length);\n }\n if (arr.length > 3 && arr.length <= 6) {\n return cpf.slice(arr.length + 1, cpf.length);\n }\n if (arr.length > 6 && arr.length <= 9) {\n return cpf.slice(arr.length + 2, cpf.length);\n }\n if (arr.length > 9 && arr.length < 11) {\n return cpf.slice(arr.length + 3, cpf.length);\n }\n if (arr.length === 11) {\n return '';\n }\n if (arr.length === 12) {\n if (inputVal.length === 17) {\n return cnpj.slice(16, cnpj.length);\n }\n return cnpj.slice(15, cnpj.length);\n }\n if (arr.length > 12 && arr.length <= 14) {\n return cnpj.slice(arr.length + 4, cnpj.length);\n }\n return '';\n }\n\n /**\n * Propogates the input value back to the Angular model by triggering the onChange function. It won't do this if writingValue\n * is true. If that is true it means we are currently in the writeValue function, which is supposed to only update the actual\n * DOM element based on the Angular model value. It should be a one way process, i.e. writeValue should not be modifying the Angular\n * model value too. Therefore, we don't trigger onChange in this scenario.\n * @param inputValue the current form input value\n */\n private formControlResult(inputValue: string): void {\n if (this.writingValue) {\n return;\n }\n if (Array.isArray(this.dropSpecialCharacters)) {\n this.onChange(\n this._toNumber(this._removeMask(this._removeSuffix(this._removePrefix(inputValue)), this.dropSpecialCharacters))\n );\n } else if (this.dropSpecialCharacters) {\n this.onChange(this._toNumber(this._checkSymbols(inputValue)));\n } else {\n this.onChange(this._removeSuffix(inputValue));\n }\n }\n\n private _toNumber(value: string | number | undefined | null) {\n if (!this.isNumberValue || value === '') {\n return value;\n }\n const num = Number(value);\n return Number.isNaN(num) ? value : num;\n }\n\n private _removeMask(value: string, specialCharactersForRemove: string[]): string {\n return value ? value.replace(this._regExpForRemove(specialCharactersForRemove), '') : value;\n }\n\n private _removePrefix(value: string): string {\n if (!this.prefix) {\n return value;\n }\n return value ? value.replace(this.prefix, '') : value;\n }\n\n private _removeSuffix(value: string): string {\n if (!this.suffix) {\n return value;\n }\n return value ? value.replace(this.suffix, '') : value;\n }\n\n private _retrieveSeparatorValue(result: string): string {\n return this._removeMask(this._removeSuffix(this._removePrefix(result)), this.maskSpecialCharacters);\n }\n\n private _regExpForRemove(specialCharactersForRemove: string[]): RegExp {\n return new RegExp(specialCharactersForRemove.map((item: string) => `\\\\${item}`).join('|'), 'gi');\n }\n\n private _checkSymbols(result: string): string | number | undefined | null {\n if (result === '') {\n return result;\n }\n\n const separatorPrecision: number | null = this._retrieveSeparatorPrecision(this.maskExpression);\n let separatorValue: string = this._retrieveSeparatorValue(result);\n if (this.decimalMarker !== '.') {\n separatorValue = separatorValue.replace(this.decimalMarker, '.');\n }\n\n if (!this.isNumberValue) {\n return separatorValue;\n }\n if (separatorPrecision) {\n if (result === this.decimalMarker) {\n return null;\n }\n return this._checkPrecision(this.maskExpression, separatorValue);\n } else {\n return Number(separatorValue);\n }\n }\n\n // TODO should think about helpers or separting decimal precision to own property\n private _retrieveSeparatorPrecision(maskExpretion: string): number | null {\n const matcher: RegExpMatchArray | null = maskExpretion.match(new RegExp(`^separator\\\\.([^d]*)`));\n return matcher ? Number(matcher[1]) : null;\n }\n\n private _checkPrecision(separatorExpression: string, separatorValue: string): number | string {\n if (separatorExpression.indexOf('2') > 0) {\n return Number(separatorValue).toFixed(2);\n }\n return Number(separatorValue);\n }\n}\n","import {\n ControlValueAccessor,\n FormControl,\n NG_VALIDATORS,\n NG_VALUE_ACCESSOR,\n ValidationErrors,\n Validator,\n} from '@angular/forms';\nimport { Directive, forwardRef, HostListener, Inject, Input, OnChanges, SimpleChanges } from '@angular/core';\nimport { DOCUMENT } from '@angular/common';\n\nimport { CustomKeyboardEvent } from './custom-keyboard-event';\nimport { config, IConfig, timeMasks, withoutValidation } from './config';\nimport { MaskService } from './mask.service';\n\n// tslint:disable deprecation\n// tslint:disable no-input-rename\n@Directive({\n selector: 'input[mask], textarea[mask]',\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => MaskDirective),\n multi: true,\n },\n {\n provide: NG_VALIDATORS,\n useExisting: forwardRef(() => MaskDirective),\n multi: true,\n },\n MaskService,\n ],\n})\nexport class MaskDirective implements ControlValueAccessor, OnChanges, Validator {\n @Input('mask') public maskExpression: string = '';\n @Input() public specialCharacters: IConfig['specialCharacters'] = [];\n @Input() public patterns: IConfig['patterns'] = {};\n @Input() public prefix: IConfig['prefix'] = '';\n @Input() public suffix: IConfig['suffix'] = '';\n @Input() public thousandSeparator: IConfig['thousandSeparator'] = ' ';\n @Input() public decimalMarker: IConfig['decimalMarker'] = '.';\n @Input() public dropSpecialCharacters: IConfig['dropSpecialCharacters'] | null = null;\n @Input() public hiddenInput: IConfig['hiddenInput'] | null = null;\n @Input() public showMaskTyped: IConfig['showMaskTyped'] | null = null;\n @Input() public placeHolderCharacter: IConfig['placeHolderCharacter'] | null = null;\n @Input() public shownMaskExpression: IConfig['shownMaskExpression'] | null = null;\n @Input() public showTemplate: IConfig['showTemplate'] | null = null;\n @Input() public clearIfNotMatch: IConfig['clearIfNotMatch'] | null = null;\n @Input() public validation: IConfig['validation'] | null = null;\n @Input() public separatorLimit: IConfig['separatorLimit'] | null = null;\n @Input() public allowNegativeNumbers: IConfig['allowNegativeNumbers'] | null = null;\n @Input() public leadZeroDateTime: IConfig['leadZeroDateTime'] | null = null;\n private _maskValue: string = '';\n private _inputValue!: string;\n private _position: number | null = null;\n private _start!: number;\n private _end!: number;\n private _code!: string;\n private _maskExpressionArray: string[] = [];\n private _justPasted: boolean = false;\n\n public constructor(\n @Inject(DOCUMENT) private document: any,\n private _maskService: MaskService,\n @Inject(config) protected _config: IConfig\n ) {}\n\n public onChange = (_: any) => {};\n public onTouch = () => {};\n\n public ngOnChanges(changes: SimpleChanges): void {\n const {\n maskExpression,\n specialCharacters,\n patterns,\n prefix,\n suffix,\n thousandSeparator,\n decimalMarker,\n dropSpecialCharacters,\n hiddenInput,\n showMaskTyped,\n placeHolderCharacter,\n shownMaskExpression,\n showTemplate,\n clearIfNotMatch,\n validation,\n separatorLimit,\n allowNegativeNumbers,\n leadZeroDateTime,\n } = changes;\n if (maskExpression) {\n this._maskValue = maskExpression.currentValue || '';\n if (maskExpression.currentValue && maskExpression.currentValue.split('||').length > 1) {\n this._maskExpressionArray = maskExpression.currentValue.split('||').sort((a: string, b: string) => {\n return a.length - b.length;\n });\n this._maskValue = this._maskExpressionArray[0];\n this.maskExpression = this._maskExpressionArray[0];\n this._maskService.maskExpression = this._maskExpressionArray[0];\n }\n }\n if (specialCharacters) {\n if (!specialCharacters.currentValue || !Array.isArray(specialCharacters.currentValue)) {\n return;\n } else {\n this._maskService.maskSpecialCharacters = specialCharacters.currentValue || [];\n }\n }\n // Only overwrite the mask available patterns if a pattern has actually been passed in\n if (patterns && patterns.currentValue) {\n this._maskService.maskAvailablePatterns = patterns.currentValue;\n }\n if (prefix) {\n this._maskService.prefix = prefix.currentValue;\n }\n if (suffix) {\n this._maskService.suffix = suffix.currentValue;\n }\n if (thousandSeparator) {\n this._maskService.thousandSeparator = thousandSeparator.currentValue;\n }\n if (decimalMarker) {\n this._maskService.decimalMarker = decimalMarker.currentValue;\n }\n if (dropSpecialCharacters) {\n this._maskService.dropSpecialCharacters = dropSpecialCharacters.currentValue;\n }\n if (hiddenInput) {\n this._maskService.hiddenInput = hiddenInput.currentValue;\n }\n if (showMaskTyped) {\n this._maskService.showMaskTyped = showMaskTyped.currentValue;\n }\n if (placeHolderCharacter) {\n this._maskService.placeHolderCharacter = placeHolderCharacter.currentValue;\n }\n if (shownMaskExpression) {\n this._maskService.shownMaskExpression = shownMaskExpression.currentValue;\n }\n if (showTemplate) {\n this._maskService.showTemplate = showTemplate.currentValue;\n }\n if (clearIfNotMatch) {\n this._maskService.clearIfNotMatch = clearIfNotMatch.currentValue;\n }\n if (validation) {\n this._maskService.validation = validation.currentValue;\n }\n if (separatorLimit) {\n this._maskService.separatorLimit = separatorLimit.currentValue;\n }\n if (allowNegativeNumbers) {\n this._maskService.allowNegativeNumbers = allowNegativeNumbers.currentValue;\n if (this._maskService.allowNegativeNumbers) {\n this._maskService.maskSpecialCharacters = this._maskService.maskSpecialCharacters.filter(\n (c: string) => c !== '-'\n );\n }\n }\n if (leadZeroDateTime) {\n this._maskService.leadZeroDateTime = leadZeroDateTime.currentValue;\n }\n this._applyMask();\n }\n\n // tslint:disable-next-line: cyclomatic-complexity\n public validate({ value }: FormControl): ValidationErrors | null {\n if (!this._maskService.validation || !this._maskValue) {\n return null;\n }\n if (this._maskService.ipError) {\n return this._createValidationError(value);\n }\n if (this._maskService.cpfCnpjError) {\n return this._createValidationError(value);\n }\n if (this._maskValue.startsWith('separator')) {\n return null;\n }\n if (withoutValidation.includes(this._maskValue)) {\n return null;\n }\n if (this._maskService.clearIfNotMatch) {\n return null;\n }\n if (timeMasks.includes(this._maskValue)) {\n return this._validateTime(value);\n }\n if (value && value.toString().length >= 1) {\n let counterOfOpt = 0;\n for (const key in this._maskService.maskAvailablePatterns) {\n if (\n this._maskService.maskAvailablePatterns[key].optional &&\n this._maskService.maskAvailablePatterns[key].optional === true\n ) {\n if (this._maskValue.indexOf(key) !== this._maskValue.lastIndexOf(key)) {\n const opt: string = this._maskValue\n .split('')\n .filter((i: string) => i === key)\n .join('');\n counterOfOpt += opt.length;\n } else if (this._maskValue.indexOf(key) !== -1) {\n counterOfOpt++;\n }\n if (this._maskValue.indexOf(key) !== -1 && value.toString().length >= this._maskValue.indexOf(key)) {\n return null;\n }\n if (counterOfOpt === this._maskValue.length) {\n return null;\n }\n }\n }\n if (\n this._maskValue.indexOf('{') === 1 &&\n value.toString().length === this._maskValue.length + Number(this._maskValue.split('{')[1].split('}')[0]) - 4\n ) {\n return null;\n }\n if (this._maskValue.indexOf('*') === 1 || this._maskValue.indexOf('?') === 1) {\n return null;\n } else if (\n (this._maskValue.indexOf('*') > 1 && value.toString().length < this._maskValue.indexOf('*')) ||\n (this._maskValue.indexOf('?') > 1 && value.toString().length < this._maskValue.indexOf('?')) ||\n this._maskValue.indexOf('{') === 1\n ) {\n return this._createValidationError(value);\n }\n if (this._maskValue.indexOf('*') === -1 || this._maskValue.indexOf('?') === -1) {\n const length: number = this._maskService.dropSpecialCharacters\n ? this._maskValue.length - this._maskService.checkSpecialCharAmount(this._maskValue) - counterOfOpt\n : this._maskValue.length - counterOfOpt;\n if (value.toString().length < length) {\n return this._createValidationError(value);\n }\n }\n }\n return null;\n }\n @HostListener('paste')\n public onPaste() {\n this._justPasted = true;\n }\n\n @HostListener('input', ['$event'])\n public onInput(e: CustomKeyboardEvent): void {\n const el: HTMLInputElement = e.target as HTMLInputElement;\n this._inputValue = el.value;\n\n this._setMask();\n\n if (!this._maskValue) {\n this.onChange(el.value);\n return;\n }\n const position: number =\n el.selectionStart === 1\n ? (el.selectionStart as number) + this._maskService.prefix.length\n : (el.selectionStart as number);\n let caretShift = 0;\n let backspaceShift = false;\n this._maskService.applyValueChanges(\n position,\n this._justPasted,\n this._code === 'Backspace',\n (shift: number, _backspaceShift: boolean) => {\n this._justPasted = false;\n caretShift = shift;\n backspaceShift = _backspaceShift;\n }\n );\n // only set the selection if the element is active\n if (this.document.activeElement !== el) {\n return;\n }\n this._position = this._position === 1 && this._inputValue.length === 1 ? null : this._position;\n let positionToApply: number = this._position\n ? this._inputValue.length + position + caretShift\n : position + (this._code === 'Backspace' && !backspaceShift ? 0 : caretShift);\n if (positionToApply > this._getActualInputLength()) {\n positionToApply = this._getActualInputLength();\n }\n el.setSelectionRange(positionToApply, positionToApply);\n this._position = null;\n }\n\n @HostListener('blur')\n public onBlur(): void {\n if (this._maskValue) {\n this._maskService.clearIfNotMatchFn();\n }\n this.onTouch();\n }\n\n @HostListener('click', ['$event'])\n public onFocus(e: MouseEvent | CustomKeyboardEvent): void {\n if (!this._maskValue) {\n return;\n }\n const el: HTMLInputElement = e.target as HTMLInputElement;\n const posStart = 0;\n const posEnd = 0;\n if (\n el !== null &&\n el.selectionStart !== null &&\n el.selectionStart === el.selectionEnd &&\n el.selectionStart > this._maskService.prefix.length &&\n // tslint:disable-next-line\n (e as any).keyCode !== 38\n ) {\n if (this._maskService.showMaskTyped) {\n // We are showing the mask in the input\n this._maskService.maskIsShown = this._maskService.showMaskInInput();\n if (el.setSelectionRange && this._maskService.prefix + this._maskService.maskIsShown === el.value) {\n // the input ONLY contains the mask, so position the cursor at the start\n el.focus();\n el.setSelectionRange(posStart, posEnd);\n } else {\n // the input contains some characters already\n if (el.selectionStart > this._maskService.actualValue.length) {\n // if the user clicked beyond our value's length, position the cursor at the end of our value\n el.setSelectionRange(this._maskService.actualValue.length, this._maskService.actualValue.length);\n }\n }\n }\n }\n const nextValue: string | null =\n !el.value || el.value === this._maskService.prefix\n ? this._maskService.prefix + this._maskService.maskIsShown\n : el.value;\n\n /** Fix of cursor position jumping to end in most browsers no matter where cursor is inserted onFocus */\n if (el.value !== nextValue) {\n el.value = nextValue;\n }\n\n /** fix of cursor position with prefix when mouse click occur */\n if (((el.selectionStart as number) || (el.selectionEnd as number)) <= this._maskService.prefix.length) {\n el.selectionStart = this._maskService.prefix.length;\n return;\n }\n\n /** select only inserted text */\n if ((el.selectionEnd as number) > this._getActualInputLength()) {\n el.selectionEnd = this._getActualInputLength();\n }\n }\n\n // tslint:disable-next-line: cyclomatic-complexity\n @HostListener('keydown', ['$event'])\n public onKeyDown(e: CustomKeyboardEvent): void {\n if (!this._maskValue) {\n return;\n }\n this._code = e.code ? e.code : e.key;\n const el: HTMLInputElement = e.target as HTMLInputElement;\n this._inputValue = el.value;\n\n this._setMask();\n\n if (e.keyCode === 38) {\n e.preventDefault();\n }\n if (e.keyCode === 37 || e.keyCode === 8 || e.keyCode === 46) {\n if (e.keyCode === 8 && el.value.length === 0) {\n el.selectionStart = el.selectionEnd;\n }\n if (e.keyCode === 8 && (el.selectionStart as number) !== 0) {\n // If specialChars is false, (shouldn't ever happen) then set to the defaults\n this.specialCharacters = this.specialCharacters?.length\n ? this.specialCharacters\n : this._config.specialCharacters;\n if (this.prefix.length > 1 && (el.selectionStart as number) <= this.prefix.length) {\n el.setSelectionRange(this.prefix.length, this.prefix.length);\n } else {\n if (this._inputValue.length !== (el.selectionStart as number) && (el.selectionStart as number) !== 1) {\n while (\n this.specialCharacters.includes(this._inputValue[(el.selectionStart as number) - 1].toString()) &&\n ((this.prefix.length >= 1 && (el.selectionStart as number) > this.prefix.length) ||\n this.prefix.length === 0)\n ) {\n el.setSelectionRange((el.selectionStart as number) - 1, (el.selectionStart as number) - 1);\n }\n }\n this.suffixCheckOnPressDelete(e.keyCode, el);\n }\n }\n this.suffixCheckOnPressDelete(e.keyCode, el);\n if (\n this._maskService.prefix.length &&\n (el.selectionStart as number) <= this._maskService.prefix.length &&\n (el.selectionEnd as number) <= this._maskService.prefix.length\n ) {\n e.preventDefault();\n }\n const cursorStart: number | null = el.selectionStart;\n // this.onFocus(e);\n if (\n e.keyCode === 8 &&\n !el.readOnly &&\n cursorStart === 0 &&\n el.selectionEnd === el.value.length &&\n el.value.length !== 0\n ) {\n this._position = this._maskService.prefix ? this._maskService.prefix.length : 0;\n this._maskService.applyMask(this._maskService.prefix, this._maskService.maskExpression, this._position);\n }\n }\n if (\n !!this.suffix &&\n this.suffix.length > 1 &&\n this._inputValue.length - this.suffix.length < (el.selectionStart as number)\n ) {\n el.setSelectionRange(this._inputValue.length - this.suffix.length, this._inputValue.length);\n } else if (\n (e.keyCode === 65 && e.ctrlKey === true) || // Ctrl+ A\n (e.keyCode === 65 && e.metaKey === true) // Cmd + A (Mac)\n ) {\n el.setSelectionRange(0, this._getActualInputLength());\n e.preventDefault();\n }\n this._maskService.selStart = el.selectionStart;\n this._maskService.selEnd = el.selectionEnd;\n }\n\n /** It writes the value in the input */\n public async writeValue(inputValue: string | number | { value: string | number; disable?: boolean }): Promise<void> {\n if (typeof inputValue === 'object' && inputValue !== null && 'value' in inputValue) {\n if ('disable' in inputValue) {\n this.setDisabledState(Boolean(inputValue.disable));\n }\n inputValue = inputValue.value;\n }\n\n if (inputValue === undefined) {\n inputValue = '';\n }\n if (typeof inputValue === 'number') {\n inputValue = String(inputValue);\n inputValue = this.decimalMarker !== '.' ? inputValue.replace('.', this.decimalMarker) : inputValue;\n this._maskService.isNumberValue = true;\n }\n\n this._inputValue = inputValue;\n this._setMask();\n\n if (\n (inputValue && this._maskService.maskExpression) ||\n (this._maskService.maskExpression && (this._maskService.prefix || this._maskService.showMaskTyped))\n ) {\n // Let the service we know we are writing value so that triggering onChange function wont happen during applyMask\n this._maskService.writingValue = true;\n this._maskService.formElementProperty = [\n 'value',\n this._maskService.applyMask(inputValue, this._maskService.maskExpression),\n ];\n // Let the service know we've finished writing value\n this._maskService.writingValue = false;\n } else {\n this._maskService.formElementProperty = ['value', inputValue];\n }\n this._inputValue = inputValue;\n }\n\n public registerOnChange(fn: any): void {\n this.onChange = fn;\n this._maskService.onChange = this.onChange;\n }\n\n public registerOnTouched(fn: any): void {\n this.onTouch = fn;\n }\n\n public suffixCheckOnPressDelete(keyCode: number, el: HTMLInputElement): void {\n if (keyCode === 46 && this.suffix.length > 0) {\n if (this._inputValue.length - this.suffix.length <= (el.selectionStart as number)) {\n el.setSelectionRange(this._inputValue.length - this.suffix.length, this._inputValue.length);\n }\n }\n if (keyCode === 8) {\n if (this.suffix.length > 1 && this._inputValue.length - this.suffix.length < (el.selectionStart as number)) {\n el.setSelectionRange(this._inputValue.length - this.suffix.length, this._inputValue.length);\n }\n if (this.suffix.length === 1 && this._inputValue.length === (el.selectionStart as number)) {\n el.setSelectionRange((el.selectionStart as number) - 1, (el.selectionStart as number) - 1);\n }\n }\n }\n\n /** It disables the input element */\n public setDisabledState(isDisabled: boolean): void {\n this._maskService.formElementProperty = ['disabled', isDisabled];\n }\n\n private _repeatPatternSymbols(maskExp: string): string {\n return (\n (maskExp.match(/{[0-9]+}/) &&\n maskExp.split('').reduce((accum: string, currval: string, index: number): string => {\n this._start = currval === '{' ? index : this._start;\n\n if (currval !== '}') {\n return this._maskService._findSpecialChar(currval) ? accum + currval : accum;\n }\n this._end = index;\n const repeatNumber: number = Number(maskExp.slice(this._start + 1, this._end));\n const replaceWith: string = new Array(repeatNumber + 1).join(maskExp[this._start - 1]);\n return accum + replaceWith;\n }, '')) ||\n maskExp\n );\n }\n\n // tslint:disable-next-line:no-any\n private _applyMask(): any {\n this._maskService.maskExpression = this._repeatPatternSymbols(this._maskValue || '');\n this._maskService.formElementProperty = [\n 'value',\n this._maskService.applyMask(this._inputValue, this._maskService.maskExpression),\n ];\n }\n\n private _validateTime(value: string): ValidationErrors | null {\n const rowMaskLen: number = this._maskValue.split('').filter((s: string) => s !== ':').length;\n if (value === null || value.length === 0) {\n return null; // Don't validate empty values to allow for optional form control\n }\n\n if ((+value[value.length - 1] === 0 && value.length < rowMaskLen) || value.length <= rowMaskLen - 2) {\n return this._createValidationError(value);\n }\n\n return null;\n }\n\n private _getActualInputLength() {\n return (\n this._maskService.actualValue.length || this._maskService.actualValue.length + this._maskService.prefix.length\n );\n }\n\n private _createValidationError(actualValue: string): ValidationErrors {\n return {\n mask: {\n requiredMask: this._maskValue,\n actualValue,\n },\n };\n }\n\n private _setMask() {\n if (this._maskExpressionArray.length > 0) {\n this._maskExpressionArray.some((mask) => {\n const test = this._maskService.removeMask(this._inputValue).length <= this._maskService.removeMask(mask).length;\n if (this._inputValue && test) {\n this._maskValue = mask;\n this.maskExpression = mask;\n this._maskService.maskExpression = mask;\n return test;\n } else {\n this._maskValue = this._maskExpressionArray[this._maskExpressionArray.length - 1];\n this.maskExpression = this._maskExpressionArray[this._maskExpressionArray.length - 1];\n this._maskService.maskExpression = this._maskExpressionArray[this._maskExpressionArray.length - 1];\n }\n });\n }\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\n\nimport { MaskApplierService } from './mask-applier.service';\nimport { IConfig } from './config';\n\n@Pipe({\n name: 'mask',\n pure: true,\n})\nexport class MaskPipe implements PipeTransform {\n public constructor(private _maskService: MaskApplierService) {}\n\n public transform(\n value: string | number,\n mask: string | [string, IConfig['patterns']],\n thousandSeparator: string | null = null\n ): string {\n if (!value && typeof value !== 'number') {\n return '';\n }\n if (thousandSeparator) {\n this._maskService.thousandSeparator = thousandSeparator;\n }\n if (typeof mask === 'string') {\n return this._maskService.applyMask(`${value}`, mask);\n }\n return this._maskService.applyMaskWithPattern(`${value}`, mask);\n }\n}\n","import { ModuleWithProviders, NgModule } from '@angular/core';\n\nimport { config, INITIAL_CONFIG, initialConfig, NEW_CONFIG, optionsConfig } from './config';\nimport { MaskApplierService } from './mask-applier.service';\nimport { MaskDirective } from './mask.directive';\nimport { MaskPipe } from './mask.pipe';\n\n@NgModule({\n exports: [MaskDirective, MaskPipe],\n declarations: [MaskDirective, MaskPipe],\n})\nexport class NgxMaskModule {\n public static forRoot(configValue?: optionsConfig | (() => optionsConfig)): ModuleWithProviders<NgxMaskModule> {\n return {\n ngModule: NgxMaskModule,\n providers: [\n {\n provide: NEW_CONFIG,\n useValue: configValue,\n },\n {\n provide: INITIAL_CONFIG,\n useValue: initialConfig,\n },\n {\n provide: config,\n useFactory: _configFactory,\n deps: [INITIAL_CONFIG, NEW_CONFIG],\n },\n MaskApplierService,\n ],\n };\n }\n public static forChild(): ModuleWithProviders<NgxMaskModule> {\n return {\n ngModule: NgxMaskModule,\n };\n }\n}\n\n/**\n * @internal\n */\nexport function _configFactory(\n initConfig: optionsConfig,\n configValue: optionsConfig | (() => optionsConfig)\n): optionsConfig {\n return configValue instanceof Function ? { ...initConfig, ...configValue() } : { ...initConfig, ...configValue };\n}\n","// tslint:disable: no-any typedef\ndeclare var global: any;\n\nconst commonjsGlobal =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : typeof self !== 'undefined'\n ? self\n : {};\n\n(function () {\n if (!commonjsGlobal.KeyboardEvent) {\n commonjsGlobal.KeyboardEvent = function (_eventType: any, _init: any) {};\n }\n})();\n\nexport type CustomKeyboardEvent = KeyboardEvent;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;MA6Ba,MAAM,GAA4B,IAAI,cAAc,CAAC,QAAQ,EAAE;MAC/D,UAAU,GAA4B,IAAI,cAAc,CAAC,YAAY,EAAE;MACvE,cAAc,GAA4B,IAAI,cAAc,CAAC,gBAAgB,EAAE;MAE/E,aAAa,GAAY;IACpC,MAAM,EAAE,EAAE;IACV,MAAM,EAAE,EAAE;IACV,iBAAiB,EAAE,GAAG;IACtB,aAAa,EAAE,GAAG;IAClB,eAAe,EAAE,KAAK;IACtB,YAAY,EAAE,KAAK;IACnB,aAAa,EAAE,KAAK;IACpB,oBAAoB,EAAE,GAAG;IACzB,qBAAqB,EAAE,IAAI;IAC3B,WAAW,EAAE,SAAS;IACtB,mBAAmB,EAAE,EAAE;IACvB,cAAc,EAAE,EAAE;IAClB,oBAAoB,EAAE,KAAK;IAC3B,UAAU,EAAE,IAAI;;IAEhB,iBAAiB,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAA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