Comparing version 8.0.8 to 8.0.9
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/forms"),require("@angular/common")):"function"==typeof define&&define.amd?define("ngx-mask",["exports","@angular/core","@angular/forms","@angular/common"],t):t((e=e||self)["ngx-mask"]={},e.ng.core,e.ng.forms,e.ng.common)}(this,function(e,t,i,s){"use strict";var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)};var n=function(){return(n=Object.assign||function(e){for(var t,i=1,s=arguments.length;i<s;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};function a(e,t,i,s){var r,n=arguments.length,a=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,s);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(a=(n<3?r(a):n>3?r(t,i,a):r(t,i))||a);return n>3&&a&&Object.defineProperty(t,i,a),a}function o(e,t){return function(i,s){t(i,s,e)}}function h(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function l(e,t){var i,s,r,n,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return n={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(n[Symbol.iterator]=function(){return this}),n;function o(n){return function(o){return function(n){if(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,s&&(r=2&n[0]?s.return:n[0]?s.throw||((r=s.return)&&r.call(s),0):s.next)&&!(r=r.call(s,n[1])).done)return r;switch(s=0,r&&(n=[2&n[0],r.value]),n[0]){case 0:case 1:r=n;break;case 4:return a.label++,{value:n[1],done:!1};case 5:a.label++,s=n[1],n=[0];continue;case 7:n=a.ops.pop(),a.trys.pop();continue;default:if(!(r=(r=a.trys).length>0&&r[r.length-1])&&(6===n[0]||2===n[0])){a=0;continue}if(3===n[0]&&(!r||n[1]>r[0]&&n[1]<r[3])){a.label=n[1];break}if(6===n[0]&&a.label<r[1]){a.label=r[1],r=n;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(n);break}r[2]&&a.ops.pop(),a.trys.pop();continue}n=t.call(e,a)}catch(e){n=[6,e],s=0}finally{i=r=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}([n,o])}}}function c(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var s,r,n=i.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=n.return)&&i.call(n)}finally{if(r)throw r.error}}return a}var p,u=new t.InjectionToken("config"),f=new t.InjectionToken("NEW_CONFIG"),m=new t.InjectionToken("INITIAL_CONFIG"),d={suffix:"",prefix:"",clearIfNotMatch:!1,showTemplate:!1,showMaskTyped:!1,dropSpecialCharacters:!0,hiddenInput:void 0,shownMaskExpression:"",separatorLimit:"",validation:!0,specialCharacters:["-","/","(",")",".",":"," ","+",",","@","[","]",'"',"'"],patterns:{0:{pattern:new RegExp("\\d")},9:{pattern:new RegExp("\\d"),optional:!0},X:{pattern:new RegExp("\\d"),symbol:"*"},A:{pattern:new RegExp("[a-zA-Z0-9]")},S:{pattern:new RegExp("[a-zA-Z]")},d:{pattern:new RegExp("\\d")},m:{pattern:new RegExp("\\d")},M:{pattern:new RegExp("\\d")},H:{pattern:new RegExp("\\d")},h:{pattern:new RegExp("\\d")},s:{pattern:new RegExp("\\d")}}},k=["Hh:m0:s0","Hh:m0","m0:s0"],v=["percent","Hh","s0","m0","separator","dot_separator","comma_separator","d0/M0/0000","d0/M0","d0","M0"];!function(e){e.SEPARATOR="separator",e.COMMA_SEPARATOR="comma_separator",e.DOT_SEPARATOR="dot_separator"}(p||(p={}));var _=function(){function e(e){var t=this;this._config=e,this.maskExpression="",this.actualValue="",this.shownMaskExpression="",this.separator=function(e,i,s,r){var n=(e+="").split(s),a=n.length>1?""+s+n[1]:"",o=n[0],h=t.separatorLimit.replace(/\s/g,"");h&&+h&&(o=o.slice(0,h.length));for(var l=/(\d+)(\d{3})/;l.test(o);)o=o.replace(l,"$1"+i+"$2");return void 0===r?o+a:0===r?o:o+a.substr(0,r+1)},this.percentage=function(e){return Number(e)>=0&&Number(e)<=100},this.getPrecision=function(e){var t=e.split(".");return t.length>1?Number(t[t.length-1]):1/0},this.checkInputPrecision=function(e,t,i){if(t<1/0){var s=void 0;s="."===i?new RegExp("\\.\\d{"+t+"}.*$"):new RegExp(",\\d{"+t+"}.*$");var r=e.match(s);r&&r[0].length-1>t?e=e.substring(0,e.length-1):0===t&&e.endsWith(i)&&(e=e.substring(0,e.length-1))}return e},this._shift=new Set,this.clearIfNotMatch=this._config.clearIfNotMatch,this.dropSpecialCharacters=this._config.dropSpecialCharacters,this.maskSpecialCharacters=this._config.specialCharacters,this.maskAvailablePatterns=this._config.patterns,this.prefix=this._config.prefix,this.suffix=this._config.suffix,this.hiddenInput=this._config.hiddenInput,this.showMaskTyped=this._config.showMaskTyped,this.validation=this._config.validation,this.separatorLimit=this._config.separatorLimit}return e.prototype.applyMaskWithPattern=function(e,t){var i=c(t,2),s=i[0],r=i[1];return this.customPattern=r,this.applyMask(e,s)},e.prototype.applyMask=function(e,t,i,s){if(void 0===i&&(i=0),void 0===s&&(s=function(){}),null==e||void 0===t)return"";var r=0,n="",a=!1,o=!1,h=1,l=!1;e.slice(0,this.prefix.length)===this.prefix&&(e=e.slice(this.prefix.length,e.length)),this.suffix&&e.endsWith(this.suffix)&&(e=e.slice(0,e.length-this.suffix.length));var c=e.toString().split("");if("IP"===t&&(this.ipError=!!(c.filter(function(e){return"."===e}).length<3&&c.length<7),t="099.099.099.099"),t.startsWith("percent")){if(e.match("[a-z]|[A-Z]")||e.match(/[-!$%^&*()_+|~=`{}\[\]:";'<>?,\/]/)){e=this._checkInput(e);var u=this.getPrecision(t);e=this.checkInputPrecision(e,u,".")}if(e.indexOf(".")>0&&!this.percentage(e.substring(0,e.indexOf(".")))){var f=e.substring(0,e.indexOf(".")-1);e=""+f+e.substring(e.indexOf("."),e.length)}n=this.percentage(e)?e:e.substring(0,e.length-1)}else if(t.startsWith(p.SEPARATOR)||t.startsWith(p.DOT_SEPARATOR)||t.startsWith(p.COMMA_SEPARATOR)){(e.match("[wа-яА-Я]")||e.match("[ЁёА-я]")||e.match("[a-z]|[A-Z]")||e.match(/[-@#!$%\\^&*()_£¬'+|~=`{}\[\]:";<>.?\/]/)||e.match("[^A-Za-z0-9,]"))&&(e=this._checkInput(e));u=this.getPrecision(t);var m=void 0;t.startsWith(p.SEPARATOR)&&e.includes(".")&&e.endsWith(".")&&e.indexOf(".")!==e.lastIndexOf(".")&&(e=e.substring(0,e.length-1)),t.startsWith(p.DOT_SEPARATOR)&&(e=e.length>1&&"0"===e[0]&&","!==e[1]?e.slice(1,e.length):e),t.startsWith(p.COMMA_SEPARATOR)&&(e=e.length>1&&"0"===e[0]&&"."!==e[1]?e.slice(1,e.length):e),t.startsWith(p.SEPARATOR)?(e.match(/[@#!$%^&*()_+|~=`{}\[\]:,";<>?\/]/)&&(e=e.substring(0,e.length-1)),m=(e=this.checkInputPrecision(e,u,".")).replace(/\s/g,""),n=this.separator(m," ",".",u)):t.startsWith(p.DOT_SEPARATOR)?(e.match(/[@#!$%^&*()_+|~=`{}\[\]:\s";<>?\/]/)&&(e=e.substring(0,e.length-1)),m=(e=this.checkInputPrecision(e,u,",")).replace(/\./g,""),n=this.separator(m,".",",",u)):t.startsWith(p.COMMA_SEPARATOR)&&(e.match(/[@#!$%^&*()_+|~=`{}\[\]:\s";<>?\/]/)&&(e=e.substring(0,e.length-1)),m=e.replace(/,/g,""),n=this.separator(m,",",".",u));var d=n.indexOf(",")-e.indexOf(",");if((g=n.length-e.length)>0&&","!==n[i]){o=!0;var k=0;do{this._shift.add(i+k),k++}while(k<g)}else 0!==d&&i>0&&!(n.indexOf(",")>=i&&i>3)||!(n.indexOf(".")>=i&&i>3)&&g<=0?(this._shift.clear(),o=!0,h=g,i+=g,this._shift.add(i)):this._shift.clear()}else for(var v=0,_=c[0];v<c.length&&r!==t.length;_=c[++v])if(this._checkSymbolMask(_,t[r])&&"?"===t[r+1])n+=_,r+=2;else if("*"===t[r+1]&&a&&this._checkSymbolMask(_,t[r+2]))n+=_,r+=3,a=!1;else if(this._checkSymbolMask(_,t[r])&&"*"===t[r+1])n+=_,a=!0;else if("?"===t[r+1]&&this._checkSymbolMask(_,t[r+2]))n+=_,r+=3;else if(this._checkSymbolMask(_,t[r])||this.hiddenInput&&this.maskAvailablePatterns[t[r]]&&this.maskAvailablePatterns[t[r]].symbol===_){if("H"===t[r]&&Number(_)>2){r+=1;var g=/[*?]/g.test(t.slice(0,r))?c.length:r;this._shift.add(g+this.prefix.length||0),v--;continue}if("h"===t[r]&&"2"===n&&Number(_)>3){r+=1,v--;continue}if("m"===t[r]&&Number(_)>5){r+=1;g=/[*?]/g.test(t.slice(0,r))?c.length:r;this._shift.add(g+this.prefix.length||0),v--;continue}if("s"===t[r]&&Number(_)>5){r+=1;g=/[*?]/g.test(t.slice(0,r))?c.length:r;this._shift.add(g+this.prefix.length||0),v--;continue}if("d"===t[r]&&(Number(e.slice(r,r+2))>31||"/"===e[r+1])){r+=1;g=/[*?]/g.test(t.slice(0,r))?c.length:r;this._shift.add(g+this.prefix.length||0),v--;continue}if("M"===t[r]){var y=0===r&&(Number(_)>2||Number(e.slice(r,r+2))>12||"/"===e[r+1]),S=e.slice(r-3,r-1).includes("/")&&("/"===e[r-2]&&Number(e.slice(r-1,r+1))>12&&"/"!==e[r]||"/"===e[r]||"/"===e[r-3]&&Number(e.slice(r-2,r))>12&&"/"!==e[r-1]||"/"===e[r-1]),x=Number(e.slice(r-3,r-1))<=31&&!e.slice(r-3,r-1).includes("/")&&"/"===e[r-1]&&(Number(e.slice(r,r+2))>12||"/"===e[r+1]),b=Number(e.slice(r-3,r-1))>31&&!e.slice(r-3,r-1).includes("/")&&!e.slice(r-2,r).includes("/")&&Number(e.slice(r-2,r))>12,E=Number(e.slice(r-3,r-1))<=31&&!e.slice(r-3,r-1).includes("/")&&"/"!==e[r-1]&&Number(e.slice(r-1,r+1))>12;if(y||S||x||b||E){r+=1;g=/[*?]/g.test(t.slice(0,r))?c.length:r;this._shift.add(g+this.prefix.length||0),v--;continue}}n+=_,r++}else if(-1!==this.maskSpecialCharacters.indexOf(t[r])){n+=t[r],r++;g=/[*?]/g.test(t.slice(0,r))?c.length:r;this._shift.add(g+this.prefix.length||0),v--}else this.maskSpecialCharacters.indexOf(_)>-1&&this.maskAvailablePatterns[t[r]]&&this.maskAvailablePatterns[t[r]].optional?(c[r]&&"099.099.099.099"!==t&&(n+=c[r]),r++,v--):"*"===this.maskExpression[r+1]&&this._findSpecialChar(this.maskExpression[r+2])&&this._findSpecialChar(_)===this.maskExpression[r+2]&&a?(r+=3,n+=_):"?"===this.maskExpression[r+1]&&this._findSpecialChar(this.maskExpression[r+2])&&this._findSpecialChar(_)===this.maskExpression[r+2]&&a?(r+=3,n+=_):this.showMaskTyped&&this.maskSpecialCharacters.indexOf(_)<0&&"_"!==_&&(l=!0);n.length+1===t.length&&-1!==this.maskSpecialCharacters.indexOf(t[t.length-1])&&(n+=t[t.length-1]);for(var M=i+1;this._shift.has(M);)h++,M++;var O=this._shift.has(i)?h:0;l&&O--,s(O,o),h<0&&this._shift.clear();var I=this.suffix?""+this.prefix+n+this.suffix:""+this.prefix+n;return 0===n.length&&(I=""+this.prefix+n),I},e.prototype._findSpecialChar=function(e){return this.maskSpecialCharacters.find(function(t){return t===e})},e.prototype._checkSymbolMask=function(e,t){return this.maskAvailablePatterns=this.customPattern?this.customPattern:this.maskAvailablePatterns,this.maskAvailablePatterns[t]&&this.maskAvailablePatterns[t].pattern&&this.maskAvailablePatterns[t].pattern.test(e)},e.prototype._checkInput=function(e){return e.split("").filter(function(e){return e.match("\\d")||"."===e||","===e}).join("")},e.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[u]}]}]},e=a([t.Injectable(),o(0,t.Inject(u)),h("design:paramtypes",[Object])],e)}(),g=function(e){function i(t,i,s,r){var n=e.call(this,i)||this;return n.document=t,n._config=i,n._elementRef=s,n._renderer=r,n.validation=!0,n.maskExpression="",n.isNumberValue=!1,n.showMaskTyped=!1,n.maskIsShown="",n.selStart=null,n.selEnd=null,n.onChange=function(e){},n._formElement=n._elementRef.nativeElement,n}return function(e,t){function i(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}(i,e),i.prototype.applyMask=function(t,i,s,r){if(void 0===s&&(s=0),void 0===r&&(r=function(){}),!i)return t;if(this.maskIsShown=this.showMaskTyped?this.showMaskInInput():"","IP"===this.maskExpression&&this.showMaskTyped&&(this.maskIsShown=this.showMaskInInput(t||"#")),!t&&this.showMaskTyped)return this.formControlResult(this.prefix),this.prefix+this.maskIsShown;var n=t&&"number"==typeof this.selStart?t[this.selStart]:"",a="";if(void 0!==this.hiddenInput){var o=this.actualValue.split("");""!==t&&o.length?"number"==typeof this.selStart&&"number"==typeof this.selEnd&&(t.length>o.length?o.splice(this.selStart,0,n):t.length<o.length&&(o.length-t.length==1?o.splice(this.selStart-1,1):o.splice(this.selStart,this.selEnd-this.selStart))):o=[],a=this.actualValue.length?this.shiftTypedSymbols(o.join("")):t}a=Boolean(a)&&a.length?a:t;var h=e.prototype.applyMask.call(this,a,i,s,r);if(this.actualValue=this.getActualValue(h),(this.maskExpression.startsWith(p.SEPARATOR)||this.maskExpression.startsWith(p.DOT_SEPARATOR))&&!0===this.dropSpecialCharacters&&(this.maskSpecialCharacters=this.maskSpecialCharacters.filter(function(e){return","!==e})),this.maskExpression.startsWith(p.COMMA_SEPARATOR)&&!0===this.dropSpecialCharacters&&(this.maskSpecialCharacters=this.maskSpecialCharacters.filter(function(e){return"."!==e})),this.formControlResult(h),!this.showMaskTyped)return this.hiddenInput&&h&&h.length?this.hideInput(h,this.maskExpression):h;var l=h.length,c=this.prefix+this.maskIsShown;return h+("IP"===this.maskExpression?c:c.slice(l))},i.prototype.applyValueChanges=function(e,t){void 0===e&&(e=0),void 0===t&&(t=function(){}),this._formElement.value=this.applyMask(this._formElement.value,this.maskExpression,e,t),this._formElement!==this.document.activeElement&&this.clearIfNotMatchFn()},i.prototype.hideInput=function(e,t){var i=this;return e.split("").map(function(e,s){return i.maskAvailablePatterns&&i.maskAvailablePatterns[t[s]]&&i.maskAvailablePatterns[t[s]].symbol?i.maskAvailablePatterns[t[s]].symbol:e}).join("")},i.prototype.getActualValue=function(e){var t=this,i=e.split("").filter(function(e,i){return t._checkSymbolMask(e,t.maskExpression[i])||t.maskSpecialCharacters.includes(t.maskExpression[i])&&e===t.maskExpression[i]});return i.join("")===e?i.join(""):e},i.prototype.shiftTypedSymbols=function(e){var t=this,i="";return(e&&e.split("").map(function(s,r){if(t.maskSpecialCharacters.includes(e[r+1])&&e[r+1]!==t.maskExpression[r+1])return i=s,e[r+1];if(i.length){var n=i;return i="",n}return s})||[]).join("")},i.prototype.showMaskInInput=function(e){if(this.showMaskTyped&&this.shownMaskExpression){if(this.maskExpression.length!==this.shownMaskExpression.length)throw new Error("Mask expression must match mask placeholder length");return this.shownMaskExpression}return this.showMaskTyped?e?this._checkForIp(e):this.maskExpression.replace(/\w/g,"_"):""},i.prototype.clearIfNotMatchFn=function(){this.clearIfNotMatch&&this.prefix.length+this.maskExpression.length+this.suffix.length!==this._formElement.value.length&&(this.formElementProperty=["value",""],this.applyMask(this._formElement.value,this.maskExpression))},Object.defineProperty(i.prototype,"formElementProperty",{set:function(e){var t=c(e,2),i=t[0],s=t[1];this._renderer.setProperty(this._formElement,i,s)},enumerable:!0,configurable:!0}),i.prototype.checkSpecialCharAmount=function(e){var t=this;return e.split("").filter(function(e){return t._findSpecialChar(e)}).length},i.prototype._checkForIp=function(e){if("#"===e)return"_._._._";for(var t=[],i=0;i<e.length;i++)e[i].match("\\d")&&t.push(e[i]);return t.length<=3?"_._._":t.length>3&&t.length<=6?"_._":t.length>6&&t.length<=9?"_":(t.length>9&&t.length,"")},i.prototype.formControlResult=function(e){Array.isArray(this.dropSpecialCharacters)?this.onChange(this._removeMask(this._removeSuffix(this._removePrefix(e)),this.dropSpecialCharacters)):this.dropSpecialCharacters?this.onChange(this._checkSymbols(e)):this.onChange(this._removeSuffix(this._removePrefix(e)))},i.prototype._removeMask=function(e,t){return e?e.replace(this._regExpForRemove(t),""):e},i.prototype._removePrefix=function(e){return this.prefix&&e?e.replace(this.prefix,""):e},i.prototype._removeSuffix=function(e){return this.suffix&&e?e.replace(this.suffix,""):e},i.prototype._regExpForRemove=function(e){return new RegExp(e.map(function(e){return"\\"+e}).join("|"),"gi")},i.prototype._checkSymbols=function(e){var t=this.testFn(p.SEPARATOR,this.maskExpression);return t&&this.isNumberValue?""===e?e:"."===e?null:this._checkPrecision(this.maskExpression,this._removeMask(this._removeSuffix(this._removePrefix(e)),this.maskSpecialCharacters)):(t=this.testFn(p.DOT_SEPARATOR,this.maskExpression))&&this.isNumberValue?""===e?e:","===e?null:this._checkPrecision(this.maskExpression,this._removeMask(this._removeSuffix(this._removePrefix(e)),this.maskSpecialCharacters).replace(",",".")):(t=this.testFn(p.COMMA_SEPARATOR,this.maskExpression))&&this.isNumberValue?""===e?e:"."===e?null:this._checkPrecision(this.maskExpression,this._removeMask(this._removeSuffix(this._removePrefix(e)),this.maskSpecialCharacters)):this.isNumberValue?""===e?e:Number(this._removeMask(this._removeSuffix(this._removePrefix(e)),this.maskSpecialCharacters)):-1!==this._removeMask(this._removeSuffix(this._removePrefix(e)),this.maskSpecialCharacters).indexOf(",")?this._removeMask(this._removeSuffix(this._removePrefix(e)),this.maskSpecialCharacters).replace(",","."):this._removeMask(this._removeSuffix(this._removePrefix(e)),this.maskSpecialCharacters)},i.prototype.testFn=function(e,t){var i=t.match(new RegExp("^"+e+"\\.([^d]*)"));return i?Number(i[1]):null},i.prototype._checkPrecision=function(e,t){return e.indexOf("2")>0?Number(t).toFixed(2):Number(t)},i.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[s.DOCUMENT]}]},{type:void 0,decorators:[{type:t.Inject,args:[u]}]},{type:t.ElementRef},{type:t.Renderer2}]},i=a([t.Injectable(),o(0,t.Inject(s.DOCUMENT)),o(1,t.Inject(u)),h("design:paramtypes",[Object,Object,t.ElementRef,t.Renderer2])],i)}(_),y=function(){function e(e,t,i){this.document=e,this._maskService=t,this._config=i,this.maskExpression="",this.specialCharacters=[],this.patterns={},this.prefix="",this.suffix="",this.dropSpecialCharacters=null,this.hiddenInput=null,this.showMaskTyped=null,this.shownMaskExpression=null,this.showTemplate=null,this.clearIfNotMatch=null,this.validation=null,this.separatorLimit=null,this._position=null,this.onChange=function(e){},this.onTouch=function(){}}var r;return r=e,e.prototype.ngOnChanges=function(e){var t=e.maskExpression,i=e.specialCharacters,s=e.patterns,r=e.prefix,n=e.suffix,a=e.dropSpecialCharacters,o=e.hiddenInput,h=e.showMaskTyped,l=e.shownMaskExpression,c=e.showTemplate,p=e.clearIfNotMatch,u=e.validation,f=e.separatorLimit;if(t&&(this._maskValue=e.maskExpression.currentValue||""),i){if(!i.currentValue||!Array.isArray(i.currentValue)||Array.isArray(i.currentValue)&&!i.currentValue.length)return;this._maskService.maskSpecialCharacters=e.specialCharacters.currentValue||""}s&&(this._maskService.maskAvailablePatterns=s.currentValue),r&&(this._maskService.prefix=r.currentValue),n&&(this._maskService.suffix=n.currentValue),a&&(this._maskService.dropSpecialCharacters=a.currentValue),o&&(this._maskService.hiddenInput=o.currentValue),h&&(this._maskService.showMaskTyped=h.currentValue),l&&(this._maskService.shownMaskExpression=l.currentValue),c&&(this._maskService.showTemplate=c.currentValue),p&&(this._maskService.clearIfNotMatch=p.currentValue),u&&(this._maskService.validation=u.currentValue),f&&(this._maskService.separatorLimit=f.currentValue),this._applyMask()},e.prototype.validate=function(e){var t=e.value;if(!this._maskService.validation)return null;if(this._maskService.ipError)return{"Mask error":!0};if(this._maskValue.startsWith("dot_separator")||this._maskValue.startsWith("comma_separator")||this._maskValue.startsWith("separator"))return null;if(v.includes(this._maskValue))return null;if(this._maskService.clearIfNotMatch)return null;if(k.includes(this._maskValue))return this._validateTime(t);if(t&&t.toString().length>=1){var i=0,s=function(e){if(r._maskService.maskAvailablePatterns[e].optional&&!0===r._maskService.maskAvailablePatterns[e].optional){if(r._maskValue.indexOf(e)!==r._maskValue.lastIndexOf(e)){var s=r._maskValue.split("").filter(function(t){return t===e}).join("");i+=s.length}else-1!==r._maskValue.indexOf(e)&&i++;if(-1!==r._maskValue.indexOf(e)&&t.toString().length>=r._maskValue.indexOf(e))return{value:null};if(i===r._maskValue.length)return{value:null}}},r=this;for(var n in this._maskService.maskAvailablePatterns){var a=s(n);if("object"==typeof a)return a.value}if(1===this._maskValue.indexOf("*")||1===this._maskValue.indexOf("?")||1===this._maskValue.indexOf("{"))return null;if(this._maskValue.indexOf("*")>1&&t.toString().length<this._maskValue.indexOf("*")||this._maskValue.indexOf("?")>1&&t.toString().length<this._maskValue.indexOf("?"))return{"Mask error":!0};if(-1===this._maskValue.indexOf("*")||-1===this._maskValue.indexOf("?")){var o=this._maskService.dropSpecialCharacters?this._maskValue.length-this._maskService.checkSpecialCharAmount(this._maskValue)-i:this._maskValue.length-i;if(t.toString().length<o)return{"Mask error":!0}}}return null},e.prototype.onInput=function(e){var t=e.target;if(this._inputValue=t.value,this._maskValue){var i=1===t.selectionStart?t.selectionStart+this._maskService.prefix.length:t.selectionStart,s=0,r=!1;if(this._maskService.applyValueChanges(i,function(e,t){s=e,r=t}),this.document.activeElement===t){this._position=1===this._position&&1===this._inputValue.length?null:this._position;var n=this._position?this._inputValue.length+i+s:i+("Backspace"!==this._code||r?s:0);t.setSelectionRange(n,n),(this.maskExpression.includes("H")||this.maskExpression.includes("M"))&&0===s&&t.setSelectionRange(t.selectionStart+1,t.selectionStart+1),this._position=null}}else this.onChange(t.value)},e.prototype.onBlur=function(){this._maskService.clearIfNotMatchFn(),this.onTouch()},e.prototype.onFocus=function(e){var t=e.target;null!==t&&null!==t.selectionStart&&t.selectionStart===t.selectionEnd&&t.selectionStart>this._maskService.prefix.length&&38!==e.keyCode&&this._maskService.showMaskTyped&&(this._maskService.maskIsShown=this._maskService.showMaskInInput(),t.setSelectionRange&&this._maskService.prefix+this._maskService.maskIsShown===t.value?(t.focus(),t.setSelectionRange(0,0)):t.selectionStart>this._maskService.actualValue.length&&t.setSelectionRange(this._maskService.actualValue.length,this._maskService.actualValue.length));var i=t.value&&t.value!==this._maskService.prefix?t.value:this._maskService.prefix+this._maskService.maskIsShown;t.value!==i&&(t.value=i),(t.selectionStart||t.selectionEnd)<=this._maskService.prefix.length&&(t.selectionStart=this._maskService.prefix.length)},e.prototype.a=function(e){this._code=e.code?e.code:e.key;var t=e.target;if(this._inputValue=t.value,38===e.keyCode&&e.preventDefault(),37===e.keyCode||8===e.keyCode){if(8===e.keyCode&&0===t.value.length&&(t.selectionStart=t.selectionEnd),8===e.keyCode&&0!==t.selectionStart){if(this.specialCharacters=this._config.specialCharacters,this._inputValue.length!==t.selectionStart)for(;this.specialCharacters.includes(this._inputValue[t.selectionStart-1].toString());)t.setSelectionRange(t.selectionStart-1,t.selectionStart-1);this.suffix.length>1&&this._inputValue.length-this.suffix.length<t.selectionStart&&t.setSelectionRange(this._inputValue.length-this.suffix.length,this._inputValue.length),1===this.suffix.length&&this._inputValue.length===t.selectionStart&&t.setSelectionRange(t.selectionStart-1,t.selectionStart-1)}t.selectionStart<=this._maskService.prefix.length&&t.selectionEnd<=this._maskService.prefix.length&&e.preventDefault();var i=t.selectionStart;8!==e.keyCode||t.readOnly||0!==i||t.selectionEnd!==t.value.length||0===t.value.length||(this._position=this._maskService.prefix?this._maskService.prefix.length:0,this._maskService.applyMask(this._maskService.prefix,this._maskService.maskExpression,this._position))}this.suffix&&this.suffix.length>1&&this._inputValue.length-this.suffix.length<t.selectionStart&&t.setSelectionRange(this._inputValue.length-this.suffix.length,this._inputValue.length),this._maskService.selStart=t.selectionStart,this._maskService.selEnd=t.selectionEnd},e.prototype.writeValue=function(e){return t=this,i=void 0,r=function(){return l(this,function(t){return void 0===e&&(e=""),"number"==typeof e&&(e=String(e),e=this._maskValue.startsWith("dot_separator")?e.replace(".",","):e,this._maskService.isNumberValue=!0),e&&this._maskService.maskExpression||this._maskService.maskExpression&&(this._maskService.prefix||this._maskService.showMaskTyped)?this._maskService.formElementProperty=["value",this._maskService.applyMask(e,this._maskService.maskExpression)]:this._maskService.formElementProperty=["value",e],this._inputValue=e,[2]})},new((s=void 0)||(s=Promise))(function(e,n){function a(e){try{h(r.next(e))}catch(e){n(e)}}function o(e){try{h(r.throw(e))}catch(e){n(e)}}function h(t){t.done?e(t.value):new s(function(e){e(t.value)}).then(a,o)}h((r=r.apply(t,i||[])).next())});var t,i,s,r},e.prototype.registerOnChange=function(e){this.onChange=e,this._maskService.onChange=this.onChange},e.prototype.registerOnTouched=function(e){this.onTouch=e},e.prototype.setDisabledState=function(e){this._maskService.formElementProperty=["disabled",e]},e.prototype._repeatPatternSymbols=function(e){var t=this;return e.match(/{[0-9]+}/)&&e.split("").reduce(function(i,s,r){if(t._start="{"===s?r:t._start,"}"!==s)return t._maskService._findSpecialChar(s)?i+s:i;t._end=r;var n=Number(e.slice(t._start+1,t._end));return i+new Array(n+1).join(e[t._start-1])},"")||e},e.prototype._applyMask=function(){this._maskService.maskExpression=this._repeatPatternSymbols(this._maskValue||""),this._maskService.formElementProperty=["value",this._maskService.applyMask(this._inputValue,this._maskService.maskExpression)]},e.prototype._validateTime=function(e){var t=this._maskValue.split("").filter(function(e){return":"!==e}).length;return 0==+e[e.length-1]&&e.length<t?{"Mask error":!0}:e.length<=t-2?{"Mask error":!0}:null},e.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[s.DOCUMENT]}]},{type:g},{type:void 0,decorators:[{type:t.Inject,args:[u]}]}]},a([t.Input("mask"),h("design:type",String)],e.prototype,"maskExpression",void 0),a([t.Input(),h("design:type",Object)],e.prototype,"specialCharacters",void 0),a([t.Input(),h("design:type",Object)],e.prototype,"patterns",void 0),a([t.Input(),h("design:type",Object)],e.prototype,"prefix",void 0),a([t.Input(),h("design:type",Object)],e.prototype,"suffix",void 0),a([t.Input(),h("design:type",Object)],e.prototype,"dropSpecialCharacters",void 0),a([t.Input(),h("design:type",Object)],e.prototype,"hiddenInput",void 0),a([t.Input(),h("design:type",Object)],e.prototype,"showMaskTyped",void 0),a([t.Input(),h("design:type",Object)],e.prototype,"shownMaskExpression",void 0),a([t.Input(),h("design:type",Object)],e.prototype,"showTemplate",void 0),a([t.Input(),h("design:type",Object)],e.prototype,"clearIfNotMatch",void 0),a([t.Input(),h("design:type",Object)],e.prototype,"validation",void 0),a([t.Input(),h("design:type",Object)],e.prototype,"separatorLimit",void 0),a([t.HostListener("input",["$event"]),h("design:type",Function),h("design:paramtypes",[Object]),h("design:returntype",void 0)],e.prototype,"onInput",null),a([t.HostListener("blur"),h("design:type",Function),h("design:paramtypes",[]),h("design:returntype",void 0)],e.prototype,"onBlur",null),a([t.HostListener("click",["$event"]),h("design:type",Function),h("design:paramtypes",[Object]),h("design:returntype",void 0)],e.prototype,"onFocus",null),a([t.HostListener("keydown",["$event"]),h("design:type",Function),h("design:paramtypes",[Object]),h("design:returntype",void 0)],e.prototype,"a",null),e=r=a([t.Directive({selector:"[mask]",providers:[{provide:i.NG_VALUE_ACCESSOR,useExisting:t.forwardRef(function(){return r}),multi:!0},{provide:i.NG_VALIDATORS,useExisting:t.forwardRef(function(){return r}),multi:!0},g]}),o(0,t.Inject(s.DOCUMENT)),o(2,t.Inject(u)),h("design:paramtypes",[Object,g,Object])],e)}(),S=function(){function e(e){this._maskService=e}return e.prototype.transform=function(e,t){return e||"number"==typeof e?"string"==typeof t?this._maskService.applyMask(""+e,t):this._maskService.applyMaskWithPattern(""+e,t):""},e.ctorParameters=function(){return[{type:_}]},e=a([t.Pipe({name:"mask",pure:!0}),h("design:paramtypes",[_])],e)}(),x=function(){function e(){}var i;return i=e,e.forRoot=function(e){return{ngModule:i,providers:[{provide:f,useValue:e},{provide:m,useValue:d},{provide:u,useFactory:b,deps:[m,f]},_]}},e.forChild=function(e){return{ngModule:i}},e=i=a([t.NgModule({exports:[y,S],declarations:[y,S]})],e)}();function b(e,t){return t instanceof Function?n({},e,t()):n({},e,t)}e.INITIAL_CONFIG=m,e.MaskDirective=y,e.MaskPipe=S,e.MaskService=g,e.NEW_CONFIG=f,e.NgxMaskModule=x,e._configFactory=b,e.config=u,e.initialConfig=d,e.timeMasks=k,e.withoutValidation=v,e.ɵa=_,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/forms"),require("@angular/common")):"function"==typeof define&&define.amd?define("ngx-mask",["exports","@angular/core","@angular/forms","@angular/common"],t):t((e=e||self)["ngx-mask"]={},e.ng.core,e.ng.forms,e.ng.common)}(this,function(e,t,i,s){"use strict";var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)};var n=function(){return(n=Object.assign||function(e){for(var t,i=1,s=arguments.length;i<s;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};function a(e,t,i,s){var r,n=arguments.length,a=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,s);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(a=(n<3?r(a):n>3?r(t,i,a):r(t,i))||a);return n>3&&a&&Object.defineProperty(t,i,a),a}function o(e,t){return function(i,s){t(i,s,e)}}function h(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function l(e,t){var i,s,r,n,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return n={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(n[Symbol.iterator]=function(){return this}),n;function o(n){return function(o){return function(n){if(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,s&&(r=2&n[0]?s.return:n[0]?s.throw||((r=s.return)&&r.call(s),0):s.next)&&!(r=r.call(s,n[1])).done)return r;switch(s=0,r&&(n=[2&n[0],r.value]),n[0]){case 0:case 1:r=n;break;case 4:return a.label++,{value:n[1],done:!1};case 5:a.label++,s=n[1],n=[0];continue;case 7:n=a.ops.pop(),a.trys.pop();continue;default:if(!(r=(r=a.trys).length>0&&r[r.length-1])&&(6===n[0]||2===n[0])){a=0;continue}if(3===n[0]&&(!r||n[1]>r[0]&&n[1]<r[3])){a.label=n[1];break}if(6===n[0]&&a.label<r[1]){a.label=r[1],r=n;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(n);break}r[2]&&a.ops.pop(),a.trys.pop();continue}n=t.call(e,a)}catch(e){n=[6,e],s=0}finally{i=r=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}([n,o])}}}function c(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var s,r,n=i.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=n.return)&&i.call(n)}finally{if(r)throw r.error}}return a}var u,p=new t.InjectionToken("config"),f=new t.InjectionToken("NEW_CONFIG"),m=new t.InjectionToken("INITIAL_CONFIG"),d={suffix:"",prefix:"",clearIfNotMatch:!1,showTemplate:!1,showMaskTyped:!1,dropSpecialCharacters:!0,hiddenInput:void 0,shownMaskExpression:"",separatorLimit:"",validation:!0,specialCharacters:["-","/","(",")",".",":"," ","+",",","@","[","]",'"',"'"],patterns:{0:{pattern:new RegExp("\\d")},9:{pattern:new RegExp("\\d"),optional:!0},X:{pattern:new RegExp("\\d"),symbol:"*"},A:{pattern:new RegExp("[a-zA-Z0-9]")},S:{pattern:new RegExp("[a-zA-Z]")},d:{pattern:new RegExp("\\d")},m:{pattern:new RegExp("\\d")},M:{pattern:new RegExp("\\d")},H:{pattern:new RegExp("\\d")},h:{pattern:new RegExp("\\d")},s:{pattern:new RegExp("\\d")}}},k=["Hh:m0:s0","Hh:m0","m0:s0"],g=["percent","Hh","s0","m0","separator","dot_separator","comma_separator","d0/M0/0000","d0/M0","d0","M0"];!function(e){e.SEPARATOR="separator",e.COMMA_SEPARATOR="comma_separator",e.DOT_SEPARATOR="dot_separator"}(u||(u={}));var _=function(){function e(e){var t=this;this._config=e,this.maskExpression="",this.actualValue="",this.shownMaskExpression="",this.separator=function(e,i,s,r){var n=(e+="").split(s),a=n.length>1?""+s+n[1]:"",o=n[0],h=t.separatorLimit.replace(/\s/g,"");h&&+h&&(o=o.slice(0,h.length));for(var l=/(\d+)(\d{3})/;l.test(o);)o=o.replace(l,"$1"+i+"$2");return void 0===r?o+a:0===r?o:o+a.substr(0,r+1)},this.percentage=function(e){return Number(e)>=0&&Number(e)<=100},this.getPrecision=function(e){var t=e.split(".");return t.length>1?Number(t[t.length-1]):1/0},this.checkInputPrecision=function(e,t,i){if(t<1/0){var s=void 0;s="."===i?new RegExp("\\.\\d{"+t+"}.*$"):new RegExp(",\\d{"+t+"}.*$");var r=e.match(s);r&&r[0].length-1>t?e=e.substring(0,e.length-1):0===t&&e.endsWith(i)&&(e=e.substring(0,e.length-1))}return e},this._shift=new Set,this.clearIfNotMatch=this._config.clearIfNotMatch,this.dropSpecialCharacters=this._config.dropSpecialCharacters,this.maskSpecialCharacters=this._config.specialCharacters,this.maskAvailablePatterns=this._config.patterns,this.prefix=this._config.prefix,this.suffix=this._config.suffix,this.hiddenInput=this._config.hiddenInput,this.showMaskTyped=this._config.showMaskTyped,this.validation=this._config.validation,this.separatorLimit=this._config.separatorLimit}return e.prototype.applyMaskWithPattern=function(e,t){var i=c(t,2),s=i[0],r=i[1];return this.customPattern=r,this.applyMask(e,s)},e.prototype.applyMask=function(e,t,i,s){if(void 0===i&&(i=0),void 0===s&&(s=function(){}),null==e||void 0===t)return"";var r=0,n="",a=!1,o=!1,h=1,l=!1;e.slice(0,this.prefix.length)===this.prefix&&(e=e.slice(this.prefix.length,e.length)),this.suffix&&e.endsWith(this.suffix)&&(e=e.slice(0,e.length-this.suffix.length));var c=e.toString().split("");if("IP"===t&&(this.ipError=!!(c.filter(function(e){return"."===e}).length<3&&c.length<7),t="099.099.099.099"),t.startsWith("percent")){if(e.match("[a-z]|[A-Z]")||e.match(/[-!$%^&*()_+|~=`{}\[\]:";'<>?,\/]/)){e=this._checkInput(e);var p=this.getPrecision(t);e=this.checkInputPrecision(e,p,".")}if(e.indexOf(".")>0&&!this.percentage(e.substring(0,e.indexOf(".")))){var f=e.substring(0,e.indexOf(".")-1);e=""+f+e.substring(e.indexOf("."),e.length)}n=this.percentage(e)?e:e.substring(0,e.length-1)}else if(t.startsWith(u.SEPARATOR)||t.startsWith(u.DOT_SEPARATOR)||t.startsWith(u.COMMA_SEPARATOR)){(e.match("[wа-яА-Я]")||e.match("[ЁёА-я]")||e.match("[a-z]|[A-Z]")||e.match(/[-@#!$%\\^&*()_£¬'+|~=`{}\[\]:";<>.?\/]/)||e.match("[^A-Za-z0-9,]"))&&(e=this._checkInput(e));p=this.getPrecision(t);var m=void 0;t.startsWith(u.SEPARATOR)&&e.includes(".")&&e.endsWith(".")&&e.indexOf(".")!==e.lastIndexOf(".")&&(e=e.substring(0,e.length-1)),t.startsWith(u.DOT_SEPARATOR)&&(e=e.length>1&&"0"===e[0]&&","!==e[1]?e.slice(1,e.length):e),t.startsWith(u.COMMA_SEPARATOR)&&(e=e.length>1&&"0"===e[0]&&"."!==e[1]?e.slice(1,e.length):e),t.startsWith(u.SEPARATOR)?(e.match(/[@#!$%^&*()_+|~=`{}\[\]:,";<>?\/]/)&&(e=e.substring(0,e.length-1)),m=(e=this.checkInputPrecision(e,p,".")).replace(/\s/g,""),n=this.separator(m," ",".",p)):t.startsWith(u.DOT_SEPARATOR)?(e.match(/[@#!$%^&*()_+|~=`{}\[\]:\s";<>?\/]/)&&(e=e.substring(0,e.length-1)),m=(e=this.checkInputPrecision(e,p,",")).replace(/\./g,""),n=this.separator(m,".",",",p)):t.startsWith(u.COMMA_SEPARATOR)&&(e.match(/[@#!$%^&*()_+|~=`{}\[\]:\s";<>?\/]/)&&(e=e.substring(0,e.length-1)),m=e.replace(/,/g,""),n=this.separator(m,",",".",p));var d=n.indexOf(",")-e.indexOf(",");if((v=n.length-e.length)>0&&","!==n[i]){o=!0;var k=0;do{this._shift.add(i+k),k++}while(k<v)}else 0!==d&&i>0&&!(n.indexOf(",")>=i&&i>3)||!(n.indexOf(".")>=i&&i>3)&&v<=0?(this._shift.clear(),o=!0,h=v,i+=v,this._shift.add(i)):this._shift.clear()}else for(var g=0,_=c[0];g<c.length&&r!==t.length;_=c[++g])if(this._checkSymbolMask(_,t[r])&&"?"===t[r+1])n+=_,r+=2;else if("*"===t[r+1]&&a&&this._checkSymbolMask(_,t[r+2]))n+=_,r+=3,a=!1;else if(this._checkSymbolMask(_,t[r])&&"*"===t[r+1])n+=_,a=!0;else if("?"===t[r+1]&&this._checkSymbolMask(_,t[r+2]))n+=_,r+=3;else if(this._checkSymbolMask(_,t[r])||this.hiddenInput&&this.maskAvailablePatterns[t[r]]&&this.maskAvailablePatterns[t[r]].symbol===_){if("H"===t[r]&&Number(_)>2){r+=1;var v=/[*?]/g.test(t.slice(0,r))?c.length:r;this._shift.add(v+this.prefix.length||0),g--;continue}if("h"===t[r]&&"2"===n&&Number(_)>3){r+=1,g--;continue}if("m"===t[r]&&Number(_)>5){r+=1;v=/[*?]/g.test(t.slice(0,r))?c.length:r;this._shift.add(v+this.prefix.length||0),g--;continue}if("s"===t[r]&&Number(_)>5){r+=1;v=/[*?]/g.test(t.slice(0,r))?c.length:r;this._shift.add(v+this.prefix.length||0),g--;continue}if("d"===t[r]&&(Number(e.slice(r,r+2))>31||"/"===e[r+1])){r+=1;v=/[*?]/g.test(t.slice(0,r))?c.length:r;this._shift.add(v+this.prefix.length||0),g--;continue}if("M"===t[r]){var y=0===r&&(Number(_)>2||Number(e.slice(r,r+2))>12||"/"===e[r+1]),S=e.slice(r-3,r-1).includes("/")&&("/"===e[r-2]&&Number(e.slice(r-1,r+1))>12&&"/"!==e[r]||"/"===e[r]||"/"===e[r-3]&&Number(e.slice(r-2,r))>12&&"/"!==e[r-1]||"/"===e[r-1]),x=Number(e.slice(r-3,r-1))<=31&&!e.slice(r-3,r-1).includes("/")&&"/"===e[r-1]&&(Number(e.slice(r,r+2))>12||"/"===e[r+1]),b=Number(e.slice(r-3,r-1))>31&&!e.slice(r-3,r-1).includes("/")&&!e.slice(r-2,r).includes("/")&&Number(e.slice(r-2,r))>12,E=Number(e.slice(r-3,r-1))<=31&&!e.slice(r-3,r-1).includes("/")&&"/"!==e[r-1]&&Number(e.slice(r-1,r+1))>12;if(y||S||x||b||E){r+=1;v=/[*?]/g.test(t.slice(0,r))?c.length:r;this._shift.add(v+this.prefix.length||0),g--;continue}}n+=_,r++}else if(-1!==this.maskSpecialCharacters.indexOf(t[r])){n+=t[r],r++;v=/[*?]/g.test(t.slice(0,r))?c.length:r;this._shift.add(v+this.prefix.length||0),g--}else this.maskSpecialCharacters.indexOf(_)>-1&&this.maskAvailablePatterns[t[r]]&&this.maskAvailablePatterns[t[r]].optional?(c[r]&&"099.099.099.099"!==t&&(n+=c[r]),r++,g--):"*"===this.maskExpression[r+1]&&this._findSpecialChar(this.maskExpression[r+2])&&this._findSpecialChar(_)===this.maskExpression[r+2]&&a?(r+=3,n+=_):"?"===this.maskExpression[r+1]&&this._findSpecialChar(this.maskExpression[r+2])&&this._findSpecialChar(_)===this.maskExpression[r+2]&&a?(r+=3,n+=_):this.showMaskTyped&&this.maskSpecialCharacters.indexOf(_)<0&&"_"!==_&&(l=!0);n.length+1===t.length&&-1!==this.maskSpecialCharacters.indexOf(t[t.length-1])&&(n+=t[t.length-1]);for(var M=i+1;this._shift.has(M);)h++,M++;var O=this._shift.has(i)?h:0;l&&O--,s(O,o),h<0&&this._shift.clear();var I=this.suffix?""+this.prefix+n+this.suffix:""+this.prefix+n;return 0===n.length&&(I=""+this.prefix+n),I},e.prototype._findSpecialChar=function(e){return this.maskSpecialCharacters.find(function(t){return t===e})},e.prototype._checkSymbolMask=function(e,t){return this.maskAvailablePatterns=this.customPattern?this.customPattern:this.maskAvailablePatterns,this.maskAvailablePatterns[t]&&this.maskAvailablePatterns[t].pattern&&this.maskAvailablePatterns[t].pattern.test(e)},e.prototype._checkInput=function(e){return e.split("").filter(function(e){return e.match("\\d")||"."===e||","===e}).join("")},e.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[p]}]}]},e=a([t.Injectable(),o(0,t.Inject(p)),h("design:paramtypes",[Object])],e)}(),v=function(e){function i(t,i,s,r){var n=e.call(this,i)||this;return n.document=t,n._config=i,n._elementRef=s,n._renderer=r,n.validation=!0,n.maskExpression="",n.isNumberValue=!1,n.showMaskTyped=!1,n.maskIsShown="",n.selStart=null,n.selEnd=null,n.onChange=function(e){},n._formElement=n._elementRef.nativeElement,n}return function(e,t){function i(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}(i,e),i.prototype.applyMask=function(t,i,s,r){if(void 0===s&&(s=0),void 0===r&&(r=function(){}),!i)return t;if(this.maskIsShown=this.showMaskTyped?this.showMaskInInput():"","IP"===this.maskExpression&&this.showMaskTyped&&(this.maskIsShown=this.showMaskInInput(t||"#")),!t&&this.showMaskTyped)return this.formControlResult(this.prefix),this.prefix+this.maskIsShown;var n=t&&"number"==typeof this.selStart?t[this.selStart]:"",a="";if(void 0!==this.hiddenInput){var o=this.actualValue.split("");""!==t&&o.length?"number"==typeof this.selStart&&"number"==typeof this.selEnd&&(t.length>o.length?o.splice(this.selStart,0,n):t.length<o.length&&(o.length-t.length==1?o.splice(this.selStart-1,1):o.splice(this.selStart,this.selEnd-this.selStart))):o=[],a=this.actualValue.length?this.shiftTypedSymbols(o.join("")):t}a=Boolean(a)&&a.length?a:t;var h=e.prototype.applyMask.call(this,a,i,s,r);if(this.actualValue=this.getActualValue(h),(this.maskExpression.startsWith(u.SEPARATOR)||this.maskExpression.startsWith(u.DOT_SEPARATOR))&&!0===this.dropSpecialCharacters&&(this.maskSpecialCharacters=this.maskSpecialCharacters.filter(function(e){return","!==e})),this.maskExpression.startsWith(u.COMMA_SEPARATOR)&&!0===this.dropSpecialCharacters&&(this.maskSpecialCharacters=this.maskSpecialCharacters.filter(function(e){return"."!==e})),this.formControlResult(h),!this.showMaskTyped)return this.hiddenInput&&h&&h.length?this.hideInput(h,this.maskExpression):h;var l=h.length,c=this.prefix+this.maskIsShown;return h+("IP"===this.maskExpression?c:c.slice(l))},i.prototype.applyValueChanges=function(e,t){void 0===e&&(e=0),void 0===t&&(t=function(){}),this._formElement.value=this.applyMask(this._formElement.value,this.maskExpression,e,t),this._formElement!==this.document.activeElement&&this.clearIfNotMatchFn()},i.prototype.hideInput=function(e,t){var i=this;return e.split("").map(function(e,s){return i.maskAvailablePatterns&&i.maskAvailablePatterns[t[s]]&&i.maskAvailablePatterns[t[s]].symbol?i.maskAvailablePatterns[t[s]].symbol:e}).join("")},i.prototype.getActualValue=function(e){var t=this,i=e.split("").filter(function(e,i){return t._checkSymbolMask(e,t.maskExpression[i])||t.maskSpecialCharacters.includes(t.maskExpression[i])&&e===t.maskExpression[i]});return i.join("")===e?i.join(""):e},i.prototype.shiftTypedSymbols=function(e){var t=this,i="";return(e&&e.split("").map(function(s,r){if(t.maskSpecialCharacters.includes(e[r+1])&&e[r+1]!==t.maskExpression[r+1])return i=s,e[r+1];if(i.length){var n=i;return i="",n}return s})||[]).join("")},i.prototype.showMaskInInput=function(e){if(this.showMaskTyped&&this.shownMaskExpression){if(this.maskExpression.length!==this.shownMaskExpression.length)throw new Error("Mask expression must match mask placeholder length");return this.shownMaskExpression}return this.showMaskTyped?e?this._checkForIp(e):this.maskExpression.replace(/\w/g,"_"):""},i.prototype.clearIfNotMatchFn=function(){this.clearIfNotMatch&&this.prefix.length+this.maskExpression.length+this.suffix.length!==this._formElement.value.length&&(this.formElementProperty=["value",""],this.applyMask(this._formElement.value,this.maskExpression))},Object.defineProperty(i.prototype,"formElementProperty",{set:function(e){var t=c(e,2),i=t[0],s=t[1];this._renderer.setProperty(this._formElement,i,s)},enumerable:!0,configurable:!0}),i.prototype.checkSpecialCharAmount=function(e){var t=this;return e.split("").filter(function(e){return t._findSpecialChar(e)}).length},i.prototype._checkForIp=function(e){if("#"===e)return"_._._._";for(var t=[],i=0;i<e.length;i++)e[i].match("\\d")&&t.push(e[i]);return t.length<=3?"_._._":t.length>3&&t.length<=6?"_._":t.length>6&&t.length<=9?"_":(t.length>9&&t.length,"")},i.prototype.formControlResult=function(e){Array.isArray(this.dropSpecialCharacters)?this.onChange(this._removeMask(this._removeSuffix(this._removePrefix(e)),this.dropSpecialCharacters)):this.dropSpecialCharacters?this.onChange(this._checkSymbols(e)):this.onChange(this._removeSuffix(this._removePrefix(e)))},i.prototype._removeMask=function(e,t){return e?e.replace(this._regExpForRemove(t),""):e},i.prototype._removePrefix=function(e){return this.prefix&&e?e.replace(this.prefix,""):e},i.prototype._removeSuffix=function(e){return this.suffix&&e?e.replace(this.suffix,""):e},i.prototype._regExpForRemove=function(e){return new RegExp(e.map(function(e){return"\\"+e}).join("|"),"gi")},i.prototype._checkSymbols=function(e){var t=this.testFn(u.SEPARATOR,this.maskExpression);return t&&this.isNumberValue?""===e?e:"."===e?null:this._checkPrecision(this.maskExpression,this._removeMask(this._removeSuffix(this._removePrefix(e)),this.maskSpecialCharacters)):(t=this.testFn(u.DOT_SEPARATOR,this.maskExpression))&&this.isNumberValue?""===e?e:","===e?null:this._checkPrecision(this.maskExpression,this._removeMask(this._removeSuffix(this._removePrefix(e)),this.maskSpecialCharacters).replace(",",".")):(t=this.testFn(u.COMMA_SEPARATOR,this.maskExpression))&&this.isNumberValue?""===e?e:"."===e?null:this._checkPrecision(this.maskExpression,this._removeMask(this._removeSuffix(this._removePrefix(e)),this.maskSpecialCharacters)):this.isNumberValue?""===e?e:Number(this._removeMask(this._removeSuffix(this._removePrefix(e)),this.maskSpecialCharacters)):-1!==this._removeMask(this._removeSuffix(this._removePrefix(e)),this.maskSpecialCharacters).indexOf(",")?this._removeMask(this._removeSuffix(this._removePrefix(e)),this.maskSpecialCharacters).replace(",","."):this._removeMask(this._removeSuffix(this._removePrefix(e)),this.maskSpecialCharacters)},i.prototype.testFn=function(e,t){var i=t.match(new RegExp("^"+e+"\\.([^d]*)"));return i?Number(i[1]):null},i.prototype._checkPrecision=function(e,t){return e.indexOf("2")>0?Number(t).toFixed(2):Number(t)},i.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[s.DOCUMENT]}]},{type:void 0,decorators:[{type:t.Inject,args:[p]}]},{type:t.ElementRef},{type:t.Renderer2}]},i=a([t.Injectable(),o(0,t.Inject(s.DOCUMENT)),o(1,t.Inject(p)),h("design:paramtypes",[Object,Object,t.ElementRef,t.Renderer2])],i)}(_),y=function(){function e(e,t,i){this.document=e,this._maskService=t,this._config=i,this.maskExpression="",this.specialCharacters=[],this.patterns={},this.prefix="",this.suffix="",this.dropSpecialCharacters=null,this.hiddenInput=null,this.showMaskTyped=null,this.shownMaskExpression=null,this.showTemplate=null,this.clearIfNotMatch=null,this.validation=null,this.separatorLimit=null,this._position=null,this.onChange=function(e){},this.onTouch=function(){}}var r;return r=e,e.prototype.ngOnChanges=function(e){var t=e.maskExpression,i=e.specialCharacters,s=e.patterns,r=e.prefix,n=e.suffix,a=e.dropSpecialCharacters,o=e.hiddenInput,h=e.showMaskTyped,l=e.shownMaskExpression,c=e.showTemplate,u=e.clearIfNotMatch,p=e.validation,f=e.separatorLimit;if(t&&(this._maskValue=e.maskExpression.currentValue||""),i){if(!i.currentValue||!Array.isArray(i.currentValue)||Array.isArray(i.currentValue)&&!i.currentValue.length)return;this._maskService.maskSpecialCharacters=e.specialCharacters.currentValue||""}s&&(this._maskService.maskAvailablePatterns=s.currentValue),r&&(this._maskService.prefix=r.currentValue),n&&(this._maskService.suffix=n.currentValue),a&&(this._maskService.dropSpecialCharacters=a.currentValue),o&&(this._maskService.hiddenInput=o.currentValue),h&&(this._maskService.showMaskTyped=h.currentValue),l&&(this._maskService.shownMaskExpression=l.currentValue),c&&(this._maskService.showTemplate=c.currentValue),u&&(this._maskService.clearIfNotMatch=u.currentValue),p&&(this._maskService.validation=p.currentValue),f&&(this._maskService.separatorLimit=f.currentValue),this._applyMask()},e.prototype.validate=function(e){var t=e.value;if(!this._maskService.validation)return null;if(this._maskService.ipError)return{"Mask error":!0};if(this._maskValue.startsWith("dot_separator")||this._maskValue.startsWith("comma_separator")||this._maskValue.startsWith("separator"))return null;if(g.includes(this._maskValue))return null;if(this._maskService.clearIfNotMatch)return null;if(k.includes(this._maskValue))return this._validateTime(t);if(t&&t.toString().length>=1){var i=0,s=function(e){if(r._maskService.maskAvailablePatterns[e].optional&&!0===r._maskService.maskAvailablePatterns[e].optional){if(r._maskValue.indexOf(e)!==r._maskValue.lastIndexOf(e)){var s=r._maskValue.split("").filter(function(t){return t===e}).join("");i+=s.length}else-1!==r._maskValue.indexOf(e)&&i++;if(-1!==r._maskValue.indexOf(e)&&t.toString().length>=r._maskValue.indexOf(e))return{value:null};if(i===r._maskValue.length)return{value:null}}},r=this;for(var n in this._maskService.maskAvailablePatterns){var a=s(n);if("object"==typeof a)return a.value}if(1===this._maskValue.indexOf("{")&&t.toString().length===this._maskValue.length+Number(this._maskValue.split("{")[1].split("}")[0])-4)return null;if(1===this._maskValue.indexOf("*")||1===this._maskValue.indexOf("?"))return null;if(this._maskValue.indexOf("*")>1&&t.toString().length<this._maskValue.indexOf("*")||this._maskValue.indexOf("?")>1&&t.toString().length<this._maskValue.indexOf("?")||1===this._maskValue.indexOf("{"))return{"Mask error":!0};if(-1===this._maskValue.indexOf("*")||-1===this._maskValue.indexOf("?")){var o=this._maskService.dropSpecialCharacters?this._maskValue.length-this._maskService.checkSpecialCharAmount(this._maskValue)-i:this._maskValue.length-i;if(t.toString().length<o)return{"Mask error":!0}}}return null},e.prototype.onInput=function(e){var t=e.target;if(this._inputValue=t.value,this._maskValue){var i=1===t.selectionStart?t.selectionStart+this._maskService.prefix.length:t.selectionStart,s=0,r=!1;if(this._maskService.applyValueChanges(i,function(e,t){s=e,r=t}),this.document.activeElement===t){this._position=1===this._position&&1===this._inputValue.length?null:this._position;var n=this._position?this._inputValue.length+i+s:i+("Backspace"!==this._code||r?s:0);t.setSelectionRange(n,n),(this.maskExpression.includes("H")||this.maskExpression.includes("M"))&&0===s&&t.setSelectionRange(t.selectionStart+1,t.selectionStart+1),this._position=null}}else this.onChange(t.value)},e.prototype.onBlur=function(){this._maskService.clearIfNotMatchFn(),this.onTouch()},e.prototype.onFocus=function(e){var t=e.target;null!==t&&null!==t.selectionStart&&t.selectionStart===t.selectionEnd&&t.selectionStart>this._maskService.prefix.length&&38!==e.keyCode&&this._maskService.showMaskTyped&&(this._maskService.maskIsShown=this._maskService.showMaskInInput(),t.setSelectionRange&&this._maskService.prefix+this._maskService.maskIsShown===t.value?(t.focus(),t.setSelectionRange(0,0)):t.selectionStart>this._maskService.actualValue.length&&t.setSelectionRange(this._maskService.actualValue.length,this._maskService.actualValue.length));var i=t.value&&t.value!==this._maskService.prefix?t.value:this._maskService.prefix+this._maskService.maskIsShown;t.value!==i&&(t.value=i),(t.selectionStart||t.selectionEnd)<=this._maskService.prefix.length&&(t.selectionStart=this._maskService.prefix.length)},e.prototype.a=function(e){this._code=e.code?e.code:e.key;var t=e.target;if(this._inputValue=t.value,38===e.keyCode&&e.preventDefault(),37===e.keyCode||8===e.keyCode||46===e.keyCode){if(8===e.keyCode&&0===t.value.length&&(t.selectionStart=t.selectionEnd),8===e.keyCode&&0!==t.selectionStart){if(this.specialCharacters=this._config.specialCharacters,this._inputValue.length!==t.selectionStart&&1!==t.selectionStart)for(;this.specialCharacters.includes(this._inputValue[t.selectionStart-1].toString());)t.setSelectionRange(t.selectionStart-1,t.selectionStart-1);this.suffix.length>1&&this._inputValue.length-this.suffix.length<t.selectionStart&&t.setSelectionRange(this._inputValue.length-this.suffix.length,this._inputValue.length),1===this.suffix.length&&this._inputValue.length===t.selectionStart&&t.setSelectionRange(t.selectionStart-1,t.selectionStart-1)}46===e.keyCode&&this.suffix.length>0&&this._inputValue.length-this.suffix.length<=t.selectionStart&&t.setSelectionRange(this._inputValue.length-this.suffix.length,this._inputValue.length),t.selectionStart<=this._maskService.prefix.length&&t.selectionEnd<=this._maskService.prefix.length&&e.preventDefault();var i=t.selectionStart;8!==e.keyCode||t.readOnly||0!==i||t.selectionEnd!==t.value.length||0===t.value.length||(this._position=this._maskService.prefix?this._maskService.prefix.length:0,this._maskService.applyMask(this._maskService.prefix,this._maskService.maskExpression,this._position))}this.suffix&&this.suffix.length>1&&this._inputValue.length-this.suffix.length<t.selectionStart&&t.setSelectionRange(this._inputValue.length-this.suffix.length,this._inputValue.length),this._maskService.selStart=t.selectionStart,this._maskService.selEnd=t.selectionEnd},e.prototype.writeValue=function(e){return t=this,i=void 0,r=function(){return l(this,function(t){return void 0===e&&(e=""),"number"==typeof e&&(e=String(e),e=this._maskValue.startsWith("dot_separator")?e.replace(".",","):e,this._maskService.isNumberValue=!0),e&&this._maskService.maskExpression||this._maskService.maskExpression&&(this._maskService.prefix||this._maskService.showMaskTyped)?this._maskService.formElementProperty=["value",this._maskService.applyMask(e,this._maskService.maskExpression)]:this._maskService.formElementProperty=["value",e],this._inputValue=e,[2]})},new((s=void 0)||(s=Promise))(function(e,n){function a(e){try{h(r.next(e))}catch(e){n(e)}}function o(e){try{h(r.throw(e))}catch(e){n(e)}}function h(t){t.done?e(t.value):new s(function(e){e(t.value)}).then(a,o)}h((r=r.apply(t,i||[])).next())});var t,i,s,r},e.prototype.registerOnChange=function(e){this.onChange=e,this._maskService.onChange=this.onChange},e.prototype.registerOnTouched=function(e){this.onTouch=e},e.prototype.setDisabledState=function(e){this._maskService.formElementProperty=["disabled",e]},e.prototype._repeatPatternSymbols=function(e){var t=this;return e.match(/{[0-9]+}/)&&e.split("").reduce(function(i,s,r){if(t._start="{"===s?r:t._start,"}"!==s)return t._maskService._findSpecialChar(s)?i+s:i;t._end=r;var n=Number(e.slice(t._start+1,t._end));return i+new Array(n+1).join(e[t._start-1])},"")||e},e.prototype._applyMask=function(){this._maskService.maskExpression=this._repeatPatternSymbols(this._maskValue||""),this._maskService.formElementProperty=["value",this._maskService.applyMask(this._inputValue,this._maskService.maskExpression)]},e.prototype._validateTime=function(e){var t=this._maskValue.split("").filter(function(e){return":"!==e}).length;return 0==+e[e.length-1]&&e.length<t?{"Mask error":!0}:e.length<=t-2?{"Mask error":!0}:null},e.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[s.DOCUMENT]}]},{type:v},{type:void 0,decorators:[{type:t.Inject,args:[p]}]}]},a([t.Input("mask"),h("design:type",String)],e.prototype,"maskExpression",void 0),a([t.Input(),h("design:type",Object)],e.prototype,"specialCharacters",void 0),a([t.Input(),h("design:type",Object)],e.prototype,"patterns",void 0),a([t.Input(),h("design:type",Object)],e.prototype,"prefix",void 0),a([t.Input(),h("design:type",Object)],e.prototype,"suffix",void 0),a([t.Input(),h("design:type",Object)],e.prototype,"dropSpecialCharacters",void 0),a([t.Input(),h("design:type",Object)],e.prototype,"hiddenInput",void 0),a([t.Input(),h("design:type",Object)],e.prototype,"showMaskTyped",void 0),a([t.Input(),h("design:type",Object)],e.prototype,"shownMaskExpression",void 0),a([t.Input(),h("design:type",Object)],e.prototype,"showTemplate",void 0),a([t.Input(),h("design:type",Object)],e.prototype,"clearIfNotMatch",void 0),a([t.Input(),h("design:type",Object)],e.prototype,"validation",void 0),a([t.Input(),h("design:type",Object)],e.prototype,"separatorLimit",void 0),a([t.HostListener("input",["$event"]),h("design:type",Function),h("design:paramtypes",[Object]),h("design:returntype",void 0)],e.prototype,"onInput",null),a([t.HostListener("blur"),h("design:type",Function),h("design:paramtypes",[]),h("design:returntype",void 0)],e.prototype,"onBlur",null),a([t.HostListener("click",["$event"]),h("design:type",Function),h("design:paramtypes",[Object]),h("design:returntype",void 0)],e.prototype,"onFocus",null),a([t.HostListener("keydown",["$event"]),h("design:type",Function),h("design:paramtypes",[Object]),h("design:returntype",void 0)],e.prototype,"a",null),e=r=a([t.Directive({selector:"[mask]",providers:[{provide:i.NG_VALUE_ACCESSOR,useExisting:t.forwardRef(function(){return r}),multi:!0},{provide:i.NG_VALIDATORS,useExisting:t.forwardRef(function(){return r}),multi:!0},v]}),o(0,t.Inject(s.DOCUMENT)),o(2,t.Inject(p)),h("design:paramtypes",[Object,v,Object])],e)}(),S=function(){function e(e){this._maskService=e}return e.prototype.transform=function(e,t){return e||"number"==typeof e?"string"==typeof t?this._maskService.applyMask(""+e,t):this._maskService.applyMaskWithPattern(""+e,t):""},e.ctorParameters=function(){return[{type:_}]},e=a([t.Pipe({name:"mask",pure:!0}),h("design:paramtypes",[_])],e)}(),x=function(){function e(){}var i;return i=e,e.forRoot=function(e){return{ngModule:i,providers:[{provide:f,useValue:e},{provide:m,useValue:d},{provide:p,useFactory:b,deps:[m,f]},_]}},e.forChild=function(e){return{ngModule:i}},e=i=a([t.NgModule({exports:[y,S],declarations:[y,S]})],e)}();function b(e,t){return t instanceof Function?n({},e,t()):n({},e,t)}e.INITIAL_CONFIG=m,e.MaskDirective=y,e.MaskPipe=S,e.MaskService=v,e.NEW_CONFIG=f,e.NgxMaskModule=x,e._configFactory=b,e.config=p,e.initialConfig=d,e.timeMasks=k,e.withoutValidation=g,e.ɵa=_,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=ngx-mask.umd.min.js.map |
@@ -877,9 +877,13 @@ import { InjectionToken, Inject, Injectable, ElementRef, Renderer2, Input, HostListener, Directive, forwardRef, Pipe, NgModule } from '@angular/core'; | ||
} | ||
if (this._maskValue.indexOf('*') === 1 || | ||
this._maskValue.indexOf('?') === 1 || | ||
this._maskValue.indexOf('{') === 1) { | ||
if (this._maskValue.indexOf('{') === 1 && | ||
value.toString().length === | ||
this._maskValue.length + Number(this._maskValue.split('{')[1].split('}')[0]) - 4) { | ||
return null; | ||
} | ||
if (this._maskValue.indexOf('*') === 1 || this._maskValue.indexOf('?') === 1) { | ||
return null; | ||
} | ||
else if ((this._maskValue.indexOf('*') > 1 && value.toString().length < this._maskValue.indexOf('*')) || | ||
(this._maskValue.indexOf('?') > 1 && value.toString().length < this._maskValue.indexOf('?'))) { | ||
(this._maskValue.indexOf('?') > 1 && value.toString().length < this._maskValue.indexOf('?')) || | ||
this._maskValue.indexOf('{') === 1) { | ||
return { 'Mask error': true }; | ||
@@ -979,3 +983,3 @@ } | ||
} | ||
if (e.keyCode === 37 || e.keyCode === 8) { | ||
if (e.keyCode === 37 || e.keyCode === 8 || e.keyCode === 46) { | ||
// if (e.keyCode === 37) { | ||
@@ -989,3 +993,3 @@ // el.selectionStart = (el.selectionEnd as number) - 1; | ||
this.specialCharacters = this._config.specialCharacters; | ||
if (this._inputValue.length !== el.selectionStart) { | ||
if (this._inputValue.length !== el.selectionStart && el.selectionStart !== 1) { | ||
while (this.specialCharacters.includes(this._inputValue[el.selectionStart - 1].toString())) { | ||
@@ -1003,2 +1007,7 @@ el.setSelectionRange(el.selectionStart - 1, el.selectionStart - 1); | ||
} | ||
if (e.keyCode === 46 && this.suffix.length > 0) { | ||
if (this._inputValue.length - this.suffix.length <= el.selectionStart) { | ||
el.setSelectionRange(this._inputValue.length - this.suffix.length, this._inputValue.length); | ||
} | ||
} | ||
if (el.selectionStart <= this._maskService.prefix.length && | ||
@@ -1005,0 +1014,0 @@ el.selectionEnd <= this._maskService.prefix.length) { |
@@ -906,9 +906,13 @@ import { InjectionToken, Inject, Injectable, ElementRef, Renderer2, Input, HostListener, Directive, forwardRef, Pipe, NgModule } from '@angular/core'; | ||
} | ||
if (this._maskValue.indexOf('*') === 1 || | ||
this._maskValue.indexOf('?') === 1 || | ||
this._maskValue.indexOf('{') === 1) { | ||
if (this._maskValue.indexOf('{') === 1 && | ||
value.toString().length === | ||
this._maskValue.length + Number(this._maskValue.split('{')[1].split('}')[0]) - 4) { | ||
return null; | ||
} | ||
if (this._maskValue.indexOf('*') === 1 || this._maskValue.indexOf('?') === 1) { | ||
return null; | ||
} | ||
else if ((this._maskValue.indexOf('*') > 1 && value.toString().length < this._maskValue.indexOf('*')) || | ||
(this._maskValue.indexOf('?') > 1 && value.toString().length < this._maskValue.indexOf('?'))) { | ||
(this._maskValue.indexOf('?') > 1 && value.toString().length < this._maskValue.indexOf('?')) || | ||
this._maskValue.indexOf('{') === 1) { | ||
return { 'Mask error': true }; | ||
@@ -1008,3 +1012,3 @@ } | ||
} | ||
if (e.keyCode === 37 || e.keyCode === 8) { | ||
if (e.keyCode === 37 || e.keyCode === 8 || e.keyCode === 46) { | ||
// if (e.keyCode === 37) { | ||
@@ -1018,3 +1022,3 @@ // el.selectionStart = (el.selectionEnd as number) - 1; | ||
this.specialCharacters = this._config.specialCharacters; | ||
if (this._inputValue.length !== el.selectionStart) { | ||
if (this._inputValue.length !== el.selectionStart && el.selectionStart !== 1) { | ||
while (this.specialCharacters.includes(this._inputValue[el.selectionStart - 1].toString())) { | ||
@@ -1032,2 +1036,7 @@ el.setSelectionRange(el.selectionStart - 1, el.selectionStart - 1); | ||
} | ||
if (e.keyCode === 46 && this.suffix.length > 0) { | ||
if (this._inputValue.length - this.suffix.length <= el.selectionStart) { | ||
el.setSelectionRange(this._inputValue.length - this.suffix.length, this._inputValue.length); | ||
} | ||
} | ||
if (el.selectionStart <= this._maskService.prefix.length && | ||
@@ -1034,0 +1043,0 @@ el.selectionEnd <= this._maskService.prefix.length) { |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":4,"metadata":{"IConfig":{"__symbolic":"interface"},"optionsConfig":{"__symbolic":"interface"},"config":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":24,"character":51},"arguments":["config"]},"NEW_CONFIG":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":25,"character":55},"arguments":["NEW_CONFIG"]},"INITIAL_CONFIG":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":26,"character":59},"arguments":["INITIAL_CONFIG"]},"initialConfig":{"suffix":"","prefix":"","clearIfNotMatch":false,"showTemplate":false,"showMaskTyped":false,"dropSpecialCharacters":true,"hiddenInput":{"__symbolic":"reference","name":"undefined"},"shownMaskExpression":"","separatorLimit":"","validation":true,"specialCharacters":["-","/","(",")",".",":"," ","+",",","@","[","]","\"","'"],"patterns":{"0":{"pattern":{"__symbolic":"new","expression":{"__symbolic":"reference","name":"RegExp"},"arguments":["\\d"]}},"9":{"pattern":{"__symbolic":"new","expression":{"__symbolic":"reference","name":"RegExp"},"arguments":["\\d"]},"optional":true},"X":{"pattern":{"__symbolic":"new","expression":{"__symbolic":"reference","name":"RegExp"},"arguments":["\\d"]},"symbol":"*"},"A":{"pattern":{"__symbolic":"new","expression":{"__symbolic":"reference","name":"RegExp"},"arguments":["[a-zA-Z0-9]"]}},"S":{"pattern":{"__symbolic":"new","expression":{"__symbolic":"reference","name":"RegExp"},"arguments":["[a-zA-Z]"]}},"d":{"pattern":{"__symbolic":"new","expression":{"__symbolic":"reference","name":"RegExp"},"arguments":["\\d"]}},"m":{"pattern":{"__symbolic":"new","expression":{"__symbolic":"reference","name":"RegExp"},"arguments":["\\d"]}},"M":{"pattern":{"__symbolic":"new","expression":{"__symbolic":"reference","name":"RegExp"},"arguments":["\\d"]}},"H":{"pattern":{"__symbolic":"new","expression":{"__symbolic":"reference","name":"RegExp"},"arguments":["\\d"]}},"h":{"pattern":{"__symbolic":"new","expression":{"__symbolic":"reference","name":"RegExp"},"arguments":["\\d"]}},"s":{"pattern":{"__symbolic":"new","expression":{"__symbolic":"reference","name":"RegExp"},"arguments":["\\d"]}},"$quoted$":["0","9"]}},"timeMasks":["Hh:m0:s0","Hh:m0","m0:s0"],"withoutValidation":["percent","Hh","s0","m0","separator","dot_separator","comma_separator","d0/M0/0000","d0/M0","d0","M0"],"MaskDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":7,"character":1},"arguments":[{"selector":"[mask]","providers":[{"provide":{"__symbolic":"reference","module":"@angular/forms","name":"NG_VALUE_ACCESSOR","line":11,"character":21},"useExisting":{"__symbolic":"reference","name":"MaskDirective"},"multi":true},{"provide":{"__symbolic":"reference","module":"@angular/forms","name":"NG_VALIDATORS","line":16,"character":21},"useExisting":{"__symbolic":"reference","name":"MaskDirective"},"multi":true},{"__symbolic":"reference","name":"MaskService"}]}]}],"members":{"maskExpression":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":24,"character":5},"arguments":["mask"]}]}],"specialCharacters":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":25,"character":5}}]}],"patterns":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":26,"character":5}}]}],"prefix":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":27,"character":5}}]}],"suffix":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":28,"character":5}}]}],"dropSpecialCharacters":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":29,"character":5}}]}],"hiddenInput":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":30,"character":5}}]}],"showMaskTyped":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":31,"character":5}}]}],"shownMaskExpression":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":32,"character":5}}]}],"showTemplate":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":33,"character":5}}]}],"clearIfNotMatch":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":34,"character":5}}]}],"validation":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":35,"character":5}}]}],"separatorLimit":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":36,"character":5}}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":50,"character":9},"arguments":[{"__symbolic":"reference","module":"@angular/common","name":"DOCUMENT","line":50,"character":16}]}],null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":52,"character":9},"arguments":[{"__symbolic":"reference","name":"config"}]}]],"parameters":[{"__symbolic":"reference","name":"any"},{"__symbolic":"reference","name":"MaskService"},{"__symbolic":"reference","name":"IConfig"}]}],"ngOnChanges":[{"__symbolic":"method"}],"validate":[{"__symbolic":"method"}],"onInput":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener","line":196,"character":5},"arguments":["input",["$event"]]}]}],"onBlur":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener","line":229,"character":5},"arguments":["blur"]}]}],"onFocus":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener","line":235,"character":5},"arguments":["click",["$event"]]}]}],"a":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener","line":284,"character":5},"arguments":["keydown",["$event"]]}]}],"writeValue":[{"__symbolic":"method"}],"registerOnChange":[{"__symbolic":"method"}],"registerOnTouched":[{"__symbolic":"method"}],"setDisabledState":[{"__symbolic":"method"}],"_repeatPatternSymbols":[{"__symbolic":"method"}],"_applyMask":[{"__symbolic":"method"}],"_validateTime":[{"__symbolic":"method"}]}},"MaskService":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"ɵa"},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":5,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":20,"character":9},"arguments":[{"__symbolic":"reference","module":"@angular/common","name":"DOCUMENT","line":20,"character":16}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":21,"character":9},"arguments":[{"__symbolic":"reference","name":"config"}]}],null,null],"parameters":[{"__symbolic":"reference","name":"any"},{"__symbolic":"reference","name":"IConfig"},{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":22,"character":29},{"__symbolic":"reference","module":"@angular/core","name":"Renderer2","line":23,"character":27}]}],"applyMask":[{"__symbolic":"method"}],"applyValueChanges":[{"__symbolic":"method"}],"hideInput":[{"__symbolic":"method"}],"getActualValue":[{"__symbolic":"method"}],"shiftTypedSymbols":[{"__symbolic":"method"}],"showMaskInInput":[{"__symbolic":"method"}],"clearIfNotMatchFn":[{"__symbolic":"method"}],"checkSpecialCharAmount":[{"__symbolic":"method"}],"_checkForIp":[{"__symbolic":"method"}],"formControlResult":[{"__symbolic":"method"}],"_removeMask":[{"__symbolic":"method"}],"_removePrefix":[{"__symbolic":"method"}],"_removeSuffix":[{"__symbolic":"method"}],"_regExpForRemove":[{"__symbolic":"method"}],"_checkSymbols":[{"__symbolic":"method"}],"testFn":[{"__symbolic":"method"}],"_checkPrecision":[{"__symbolic":"method"}]}},"NgxMaskModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":6,"character":1},"arguments":[{"exports":[{"__symbolic":"reference","name":"MaskDirective"},{"__symbolic":"reference","name":"MaskPipe"}],"declarations":[{"__symbolic":"reference","name":"MaskDirective"},{"__symbolic":"reference","name":"MaskPipe"}]}]}],"members":{},"statics":{"forRoot":{"__symbolic":"function","parameters":["configValue"],"value":{"ngModule":{"__symbolic":"reference","name":"NgxMaskModule"},"providers":[{"provide":{"__symbolic":"reference","name":"NEW_CONFIG"},"useValue":{"__symbolic":"reference","name":"configValue"}},{"provide":{"__symbolic":"reference","name":"INITIAL_CONFIG"},"useValue":{"__symbolic":"reference","name":"initialConfig"}},{"provide":{"__symbolic":"reference","name":"config"},"useFactory":{"__symbolic":"reference","name":"_configFactory"},"deps":[{"__symbolic":"reference","name":"INITIAL_CONFIG"},{"__symbolic":"reference","name":"NEW_CONFIG"}]},{"__symbolic":"reference","name":"ɵa"}]}},"forChild":{"__symbolic":"function","parameters":["_configValue"],"value":{"ngModule":{"__symbolic":"reference","name":"NgxMaskModule"}}}}},"_configFactory":{"__symbolic":"function","parameters":["initConfig","configValue"],"value":{"__symbolic":"if","condition":{"__symbolic":"binop","operator":"instanceof","left":{"__symbolic":"reference","name":"configValue"},"right":{"__symbolic":"reference","name":"Function"}},"thenExpression":{},"elseExpression":{}}},"MaskPipe":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Pipe","line":4,"character":1},"arguments":[{"name":"mask","pure":true}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"ɵa"}]}],"transform":[{"__symbolic":"method"}]}},"ɵa":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":9,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":30,"character":24},"arguments":[{"__symbolic":"reference","name":"config"}]}]],"parameters":[{"__symbolic":"reference","name":"IConfig"}]}],"applyMaskWithPattern":[{"__symbolic":"method"}],"applyMask":[{"__symbolic":"method"}],"_findSpecialChar":[{"__symbolic":"method"}],"_checkSymbolMask":[{"__symbolic":"method"}],"_checkInput":[{"__symbolic":"method"}]}}},"origins":{"IConfig":"./app/ngx-mask/config","optionsConfig":"./app/ngx-mask/config","config":"./app/ngx-mask/config","NEW_CONFIG":"./app/ngx-mask/config","INITIAL_CONFIG":"./app/ngx-mask/config","initialConfig":"./app/ngx-mask/config","timeMasks":"./app/ngx-mask/config","withoutValidation":"./app/ngx-mask/config","MaskDirective":"./app/ngx-mask/mask.directive","MaskService":"./app/ngx-mask/mask.service","NgxMaskModule":"./app/ngx-mask/ngx-mask.module","_configFactory":"./app/ngx-mask/ngx-mask.module","MaskPipe":"./app/ngx-mask/mask.pipe","ɵa":"./app/ngx-mask/mask-applier.service"},"importAs":"ngx-mask"} | ||
{"__symbolic":"module","version":4,"metadata":{"IConfig":{"__symbolic":"interface"},"optionsConfig":{"__symbolic":"interface"},"config":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":24,"character":51},"arguments":["config"]},"NEW_CONFIG":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":25,"character":55},"arguments":["NEW_CONFIG"]},"INITIAL_CONFIG":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":26,"character":59},"arguments":["INITIAL_CONFIG"]},"initialConfig":{"suffix":"","prefix":"","clearIfNotMatch":false,"showTemplate":false,"showMaskTyped":false,"dropSpecialCharacters":true,"hiddenInput":{"__symbolic":"reference","name":"undefined"},"shownMaskExpression":"","separatorLimit":"","validation":true,"specialCharacters":["-","/","(",")",".",":"," ","+",",","@","[","]","\"","'"],"patterns":{"0":{"pattern":{"__symbolic":"new","expression":{"__symbolic":"reference","name":"RegExp"},"arguments":["\\d"]}},"9":{"pattern":{"__symbolic":"new","expression":{"__symbolic":"reference","name":"RegExp"},"arguments":["\\d"]},"optional":true},"X":{"pattern":{"__symbolic":"new","expression":{"__symbolic":"reference","name":"RegExp"},"arguments":["\\d"]},"symbol":"*"},"A":{"pattern":{"__symbolic":"new","expression":{"__symbolic":"reference","name":"RegExp"},"arguments":["[a-zA-Z0-9]"]}},"S":{"pattern":{"__symbolic":"new","expression":{"__symbolic":"reference","name":"RegExp"},"arguments":["[a-zA-Z]"]}},"d":{"pattern":{"__symbolic":"new","expression":{"__symbolic":"reference","name":"RegExp"},"arguments":["\\d"]}},"m":{"pattern":{"__symbolic":"new","expression":{"__symbolic":"reference","name":"RegExp"},"arguments":["\\d"]}},"M":{"pattern":{"__symbolic":"new","expression":{"__symbolic":"reference","name":"RegExp"},"arguments":["\\d"]}},"H":{"pattern":{"__symbolic":"new","expression":{"__symbolic":"reference","name":"RegExp"},"arguments":["\\d"]}},"h":{"pattern":{"__symbolic":"new","expression":{"__symbolic":"reference","name":"RegExp"},"arguments":["\\d"]}},"s":{"pattern":{"__symbolic":"new","expression":{"__symbolic":"reference","name":"RegExp"},"arguments":["\\d"]}},"$quoted$":["0","9"]}},"timeMasks":["Hh:m0:s0","Hh:m0","m0:s0"],"withoutValidation":["percent","Hh","s0","m0","separator","dot_separator","comma_separator","d0/M0/0000","d0/M0","d0","M0"],"MaskDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":7,"character":1},"arguments":[{"selector":"[mask]","providers":[{"provide":{"__symbolic":"reference","module":"@angular/forms","name":"NG_VALUE_ACCESSOR","line":11,"character":21},"useExisting":{"__symbolic":"reference","name":"MaskDirective"},"multi":true},{"provide":{"__symbolic":"reference","module":"@angular/forms","name":"NG_VALIDATORS","line":16,"character":21},"useExisting":{"__symbolic":"reference","name":"MaskDirective"},"multi":true},{"__symbolic":"reference","name":"MaskService"}]}]}],"members":{"maskExpression":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":24,"character":5},"arguments":["mask"]}]}],"specialCharacters":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":25,"character":5}}]}],"patterns":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":26,"character":5}}]}],"prefix":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":27,"character":5}}]}],"suffix":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":28,"character":5}}]}],"dropSpecialCharacters":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":29,"character":5}}]}],"hiddenInput":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":30,"character":5}}]}],"showMaskTyped":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":31,"character":5}}]}],"shownMaskExpression":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":32,"character":5}}]}],"showTemplate":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":33,"character":5}}]}],"clearIfNotMatch":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":34,"character":5}}]}],"validation":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":35,"character":5}}]}],"separatorLimit":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":36,"character":5}}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":50,"character":9},"arguments":[{"__symbolic":"reference","module":"@angular/common","name":"DOCUMENT","line":50,"character":16}]}],null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":52,"character":9},"arguments":[{"__symbolic":"reference","name":"config"}]}]],"parameters":[{"__symbolic":"reference","name":"any"},{"__symbolic":"reference","name":"MaskService"},{"__symbolic":"reference","name":"IConfig"}]}],"ngOnChanges":[{"__symbolic":"method"}],"validate":[{"__symbolic":"method"}],"onInput":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener","line":200,"character":5},"arguments":["input",["$event"]]}]}],"onBlur":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener","line":233,"character":5},"arguments":["blur"]}]}],"onFocus":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener","line":239,"character":5},"arguments":["click",["$event"]]}]}],"a":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener","line":288,"character":5},"arguments":["keydown",["$event"]]}]}],"writeValue":[{"__symbolic":"method"}],"registerOnChange":[{"__symbolic":"method"}],"registerOnTouched":[{"__symbolic":"method"}],"setDisabledState":[{"__symbolic":"method"}],"_repeatPatternSymbols":[{"__symbolic":"method"}],"_applyMask":[{"__symbolic":"method"}],"_validateTime":[{"__symbolic":"method"}]}},"MaskService":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"ɵa"},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":5,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":20,"character":9},"arguments":[{"__symbolic":"reference","module":"@angular/common","name":"DOCUMENT","line":20,"character":16}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":21,"character":9},"arguments":[{"__symbolic":"reference","name":"config"}]}],null,null],"parameters":[{"__symbolic":"reference","name":"any"},{"__symbolic":"reference","name":"IConfig"},{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":22,"character":29},{"__symbolic":"reference","module":"@angular/core","name":"Renderer2","line":23,"character":27}]}],"applyMask":[{"__symbolic":"method"}],"applyValueChanges":[{"__symbolic":"method"}],"hideInput":[{"__symbolic":"method"}],"getActualValue":[{"__symbolic":"method"}],"shiftTypedSymbols":[{"__symbolic":"method"}],"showMaskInInput":[{"__symbolic":"method"}],"clearIfNotMatchFn":[{"__symbolic":"method"}],"checkSpecialCharAmount":[{"__symbolic":"method"}],"_checkForIp":[{"__symbolic":"method"}],"formControlResult":[{"__symbolic":"method"}],"_removeMask":[{"__symbolic":"method"}],"_removePrefix":[{"__symbolic":"method"}],"_removeSuffix":[{"__symbolic":"method"}],"_regExpForRemove":[{"__symbolic":"method"}],"_checkSymbols":[{"__symbolic":"method"}],"testFn":[{"__symbolic":"method"}],"_checkPrecision":[{"__symbolic":"method"}]}},"NgxMaskModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":6,"character":1},"arguments":[{"exports":[{"__symbolic":"reference","name":"MaskDirective"},{"__symbolic":"reference","name":"MaskPipe"}],"declarations":[{"__symbolic":"reference","name":"MaskDirective"},{"__symbolic":"reference","name":"MaskPipe"}]}]}],"members":{},"statics":{"forRoot":{"__symbolic":"function","parameters":["configValue"],"value":{"ngModule":{"__symbolic":"reference","name":"NgxMaskModule"},"providers":[{"provide":{"__symbolic":"reference","name":"NEW_CONFIG"},"useValue":{"__symbolic":"reference","name":"configValue"}},{"provide":{"__symbolic":"reference","name":"INITIAL_CONFIG"},"useValue":{"__symbolic":"reference","name":"initialConfig"}},{"provide":{"__symbolic":"reference","name":"config"},"useFactory":{"__symbolic":"reference","name":"_configFactory"},"deps":[{"__symbolic":"reference","name":"INITIAL_CONFIG"},{"__symbolic":"reference","name":"NEW_CONFIG"}]},{"__symbolic":"reference","name":"ɵa"}]}},"forChild":{"__symbolic":"function","parameters":["_configValue"],"value":{"ngModule":{"__symbolic":"reference","name":"NgxMaskModule"}}}}},"_configFactory":{"__symbolic":"function","parameters":["initConfig","configValue"],"value":{"__symbolic":"if","condition":{"__symbolic":"binop","operator":"instanceof","left":{"__symbolic":"reference","name":"configValue"},"right":{"__symbolic":"reference","name":"Function"}},"thenExpression":{},"elseExpression":{}}},"MaskPipe":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Pipe","line":4,"character":1},"arguments":[{"name":"mask","pure":true}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"ɵa"}]}],"transform":[{"__symbolic":"method"}]}},"ɵa":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":9,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":30,"character":24},"arguments":[{"__symbolic":"reference","name":"config"}]}]],"parameters":[{"__symbolic":"reference","name":"IConfig"}]}],"applyMaskWithPattern":[{"__symbolic":"method"}],"applyMask":[{"__symbolic":"method"}],"_findSpecialChar":[{"__symbolic":"method"}],"_checkSymbolMask":[{"__symbolic":"method"}],"_checkInput":[{"__symbolic":"method"}]}}},"origins":{"IConfig":"./app/ngx-mask/config","optionsConfig":"./app/ngx-mask/config","config":"./app/ngx-mask/config","NEW_CONFIG":"./app/ngx-mask/config","INITIAL_CONFIG":"./app/ngx-mask/config","initialConfig":"./app/ngx-mask/config","timeMasks":"./app/ngx-mask/config","withoutValidation":"./app/ngx-mask/config","MaskDirective":"./app/ngx-mask/mask.directive","MaskService":"./app/ngx-mask/mask.service","NgxMaskModule":"./app/ngx-mask/ngx-mask.module","_configFactory":"./app/ngx-mask/ngx-mask.module","MaskPipe":"./app/ngx-mask/mask.pipe","ɵa":"./app/ngx-mask/mask-applier.service"},"importAs":"ngx-mask"} |
{ | ||
"name": "ngx-mask", | ||
"version": "8.0.8", | ||
"version": "8.0.9", | ||
"description": "awesome ngx mask", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1086344
7001