Comparing version 8.1.3 to 8.1.4
@@ -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 l(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function h(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=new t.InjectionToken("config"),u=new t.InjectionToken("NEW_CONFIG"),f=new t.InjectionToken("INITIAL_CONFIG"),m={suffix:"",prefix:"",thousandSeparator:" ",decimalMarker:".",clearIfNotMatch:!1,showTemplate:!1,showMaskTyped:!1,placeHolderCharacter:"_",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")}}},d=["Hh:m0:s0","Hh:m0","m0:s0"],g=["percent","Hh","s0","m0","separator","d0/M0/0000","d0/M0","d0","M0"],k=function(){function e(e){var t=this;this._config=e,this.maskExpression="",this.actualValue="",this.shownMaskExpression="",this._formatWithSeparators=function(e,i,s,r){var n=e.split(s),a=n.length>1?""+s+n[1]:"",o=n[0],l=t.separatorLimit.replace(/\s/g,"");l&&+l&&(o=o.slice(0,l.length));for(var h=/(\d+)(\d{3})/;h.test(o);)o=o.replace(h,"$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,i,s){if(i<1/0){var r=new RegExp(t._charToRegExpExpression(s)+"\\d{"+i+"}.*$"),n=e.match(r);n&&n[0].length-1>i?e=e.substring(0,e.length-1):0===i&&e.endsWith(s)&&(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.thousandSeparator=this._config.thousandSeparator,this.decimalMarker=this._config.decimalMarker,this.hiddenInput=this._config.hiddenInput,this.showMaskTyped=this._config.showMaskTyped,this.placeHolderCharacter=this._config.placeHolderCharacter,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,l=1,h=!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._stripToDecimal(e);var p=this.getPrecision(t);e=this.checkInputPrecision(e,p,".")}if(e.indexOf(".")>0&&!this.percentage(e.substring(0,e.indexOf(".")))){var u=e.substring(0,e.indexOf(".")-1);e=""+u+e.substring(e.indexOf("."),e.length)}n=this.percentage(e)?e:e.substring(0,e.length-1)}else if(t.startsWith("separator")){(e.match("[wа-яА-Я]")||e.match("[ЁёА-я]")||e.match("[a-z]|[A-Z]")||e.match(/[-@#!$%\\^&*()_£¬'+|~=`{}\[\]:";<>.?\/]/)||e.match("[^A-Za-z0-9,]"))&&(e=this._stripToDecimal(e)),e=e.length>1&&"0"===e[0]&&e[1]!==this.decimalMarker?e.slice(1,e.length):e;var f=this._charToRegExpExpression(this.thousandSeparator),m=this._charToRegExpExpression(this.decimalMarker),d='@#!$%^&*()_+|~=`{}\\[\\]:\\s,";<>?\\/'.replace(f,"").replace(m,""),g=new RegExp("["+d+"]");e.match(g)&&(e=e.substring(0,e.length-1));p=this.getPrecision(t);var k=(e=this.checkInputPrecision(e,p,this.decimalMarker)).replace(new RegExp(f,"g"),""),v=(n=this._formatWithSeparators(k,this.thousandSeparator,this.decimalMarker,p)).indexOf(",")-e.indexOf(",");if((x=n.length-e.length)>0&&","!==n[i]){o=!0;var _=0;do{this._shift.add(i+_),_++}while(_<x)}else 0!==v&&i>0&&!(n.indexOf(",")>=i&&i>3)||!(n.indexOf(".")>=i&&i>3)&&x<=0?(this._shift.clear(),o=!0,l=x,i+=x,this._shift.add(i)):this._shift.clear()}else for(var y=0,S=c[0];y<c.length&&r!==t.length;S=c[++y])if(this._checkSymbolMask(S,t[r])&&"?"===t[r+1])n+=S,r+=2;else if("*"===t[r+1]&&a&&this._checkSymbolMask(S,t[r+2]))n+=S,r+=3,a=!1;else if(this._checkSymbolMask(S,t[r])&&"*"===t[r+1])n+=S,a=!0;else if("?"===t[r+1]&&this._checkSymbolMask(S,t[r+2]))n+=S,r+=3;else if(this._checkSymbolMask(S,t[r])||this.hiddenInput&&this.maskAvailablePatterns[t[r]]&&this.maskAvailablePatterns[t[r]].symbol===S){if("H"===t[r]&&Number(S)>2){r+=1;var x=/[*?]/g.test(t.slice(0,r))?c.length:r;this._shift.add(x+this.prefix.length||0),y--;continue}if("h"===t[r]&&"2"===n&&Number(S)>3){r+=1,y--;continue}if("m"===t[r]&&Number(S)>5){r+=1;x=/[*?]/g.test(t.slice(0,r))?c.length:r;this._shift.add(x+this.prefix.length||0),y--;continue}if("s"===t[r]&&Number(S)>5){r+=1;x=/[*?]/g.test(t.slice(0,r))?c.length:r;this._shift.add(x+this.prefix.length||0),y--;continue}if("d"===t[r]&&(Number(e.slice(r,r+2))>31||"/"===e[r+1])){r+=1;x=/[*?]/g.test(t.slice(0,r))?c.length:r;this._shift.add(x+this.prefix.length||0),y--;continue}if("M"===t[r]){var b=0===r&&(Number(S)>2||Number(e.slice(r,r+2))>12||"/"===e[r+1]),M=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]),E=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]),C=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,I=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(b||M||E||C||I){r+=1;x=/[*?]/g.test(t.slice(0,r))?c.length:r;this._shift.add(x+this.prefix.length||0),y--;continue}}n+=S,r++}else if(-1!==this.maskSpecialCharacters.indexOf(t[r])){n+=t[r],r++;x=/[*?]/g.test(t.slice(0,r))?c.length:r;this._shift.add(x+this.prefix.length||0),y--}else this.maskSpecialCharacters.indexOf(S)>-1&&this.maskAvailablePatterns[t[r]]&&this.maskAvailablePatterns[t[r]].optional?(c[r]&&"099.099.099.099"!==t&&(n+=c[r]),r++,y--):"*"===this.maskExpression[r+1]&&this._findSpecialChar(this.maskExpression[r+2])&&this._findSpecialChar(S)===this.maskExpression[r+2]&&a?(r+=3,n+=S):"?"===this.maskExpression[r+1]&&this._findSpecialChar(this.maskExpression[r+2])&&this._findSpecialChar(S)===this.maskExpression[r+2]&&a?(r+=3,n+=S):this.showMaskTyped&&this.maskSpecialCharacters.indexOf(S)<0&&S!==this.placeHolderCharacter&&(h=!0);n.length+1===t.length&&-1!==this.maskSpecialCharacters.indexOf(t[t.length-1])&&(n+=t[t.length-1]);for(var w=i+1;this._shift.has(w);)l++,w++;var V=this._shift.has(i)?l:0;h&&V--,s(V,o),l<0&&this._shift.clear();var O=""+this.prefix+n+this.suffix;return 0===n.length&&(O=""+this.prefix+n),O},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._stripToDecimal=function(e){return e.split("").filter(function(e){return e.match("\\d")||"."===e||","===e}).join("")},e.prototype._charToRegExpExpression=function(e){return" "===e?"\\s":"[\\^$.|?*+()".indexOf(e)>=0?"\\"+e:e},e.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[p]}]}]},e=a([t.Injectable(),o(0,t.Inject(p)),l("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.placeHolderCharacter="_",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){var n=this;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 a=t&&"number"==typeof this.selStart?t[this.selStart]:"",o="";if(void 0!==this.hiddenInput){var l=this.actualValue.split("");""!==t&&l.length?"number"==typeof this.selStart&&"number"==typeof this.selEnd&&(t.length>l.length?l.splice(this.selStart,0,a):t.length<l.length&&(l.length-t.length==1?l.splice(this.selStart-1,1):l.splice(this.selStart,this.selEnd-this.selStart))):l=[],o=this.actualValue.length?this.shiftTypedSymbols(l.join("")):t}o=Boolean(o)&&o.length?o:t;var h=e.prototype.applyMask.call(this,o,i,s,r);if(this.actualValue=this.getActualValue(h),"."===this.thousandSeparator&&"."===this.decimalMarker&&(this.decimalMarker=","),this.maskExpression.startsWith("separator")&&!0===this.dropSpecialCharacters&&(this.maskSpecialCharacters=this.maskSpecialCharacters.filter(function(e){return e!==n.decimalMarker})),this.formControlResult(h),!this.showMaskTyped)return this.hiddenInput&&h&&h.length?this.hideInput(h,this.maskExpression):h;var c=h.length,p=this.prefix+this.maskIsShown;return h+("IP"===this.maskExpression?p:p.slice(c))},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,this.placeHolderCharacter):""},i.prototype.clearIfNotMatchFn=function(){this.clearIfNotMatch&&this.prefix.length+this.maskExpression.length+this.suffix.length!==this._formElement.value.replace(/_/g,"").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 this.placeHolderCharacter+"."+this.placeHolderCharacter+"."+this.placeHolderCharacter+"."+this.placeHolderCharacter;for(var t=[],i=0;i<e.length;i++)e[i].match("\\d")&&t.push(e[i]);return t.length<=3?this.placeHolderCharacter+"."+this.placeHolderCharacter+"."+this.placeHolderCharacter:t.length>3&&t.length<=6?this.placeHolderCharacter+"."+this.placeHolderCharacter:t.length>6&&t.length<=9?""+this.placeHolderCharacter:(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._retrieveSeparatorValue=function(e){return this._removeMask(this._removeSuffix(this._removePrefix(e)),this.maskSpecialCharacters)},i.prototype._regExpForRemove=function(e){return new RegExp(e.map(function(e){return"\\"+e}).join("|"),"gi")},i.prototype._checkSymbols=function(e){if(""===e)return e;var t=this._retrieveSeparatorPrecision(this.maskExpression),i=this._retrieveSeparatorValue(e);return"."!==this.decimalMarker&&(i=i.replace(this.decimalMarker,".")),this.isNumberValue?t?e===this.decimalMarker?null:this._checkPrecision(this.maskExpression,i):Number(i):i},i.prototype._retrieveSeparatorPrecision=function(e){var t=e.match(new RegExp("^separator\\.([^d]*)"));return t?Number(t[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)),l("design:paramtypes",[Object,Object,t.ElementRef,t.Renderer2])],i)}(k),_=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.thousandSeparator=" ",this.decimalMarker=".",this.dropSpecialCharacters=null,this.hiddenInput=null,this.showMaskTyped=null,this.placeHolderCharacter=null,this.shownMaskExpression=null,this.showTemplate=null,this.clearIfNotMatch=null,this.validation=null,this.separatorLimit=null,this._maskValue="",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.thousandSeparator,o=e.decimalMarker,l=e.dropSpecialCharacters,h=e.hiddenInput,c=e.showMaskTyped,p=e.placeHolderCharacter,u=e.shownMaskExpression,f=e.showTemplate,m=e.clearIfNotMatch,d=e.validation,g=e.separatorLimit;if(t&&(this._maskValue=e.maskExpression.currentValue||""),i){if(!i.currentValue||!Array.isArray(i.currentValue))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.thousandSeparator=a.currentValue),o&&(this._maskService.decimalMarker=o.currentValue),l&&(this._maskService.dropSpecialCharacters=l.currentValue),h&&(this._maskService.hiddenInput=h.currentValue),c&&(this._maskService.showMaskTyped=c.currentValue),p&&(this._maskService.placeHolderCharacter=p.currentValue),u&&(this._maskService.shownMaskExpression=u.currentValue),f&&(this._maskService.showTemplate=f.currentValue),m&&(this._maskService.clearIfNotMatch=m.currentValue),d&&(this._maskService.validation=d.currentValue),g&&(this._maskService.separatorLimit=g.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("separator"))return null;if(g.includes(this._maskValue))return null;if(this._maskService.clearIfNotMatch)return null;if(d.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.onKeyDown=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.prefix.length>1&&t.selectionStart<=this.prefix.length)t.setSelectionRange(this.prefix.length,this.prefix.length);else{if(this._inputValue.length!==t.selectionStart&&1!==t.selectionStart)for(;this.specialCharacters.includes(this._inputValue[t.selectionStart-1].toString())&&(this.prefix.length>=1&&t.selectionStart>this.prefix.length||0===this.prefix.length);)t.setSelectionRange(t.selectionStart-1,t.selectionStart-1);this.suffixCheckOnPressDelete(e.keyCode,t)}this.suffixCheckOnPressDelete(e.keyCode,t),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 h(this,function(t){return void 0===e&&(e=""),"number"==typeof e&&(e=String(e),e="."!==this.decimalMarker?e.replace(".",this.decimalMarker):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{l(r.next(e))}catch(e){n(e)}}function o(e){try{l(r.throw(e))}catch(e){n(e)}}function l(t){t.done?e(t.value):new s(function(e){e(t.value)}).then(a,o)}l((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.suffixCheckOnPressDelete=function(e,t){46===e&&this.suffix.length>0&&this._inputValue.length-this.suffix.length<=t.selectionStart&&t.setSelectionRange(this._inputValue.length-this.suffix.length,this._inputValue.length),8===e&&(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))},e.prototype.setDisabledState=function(e){this._maskService.formElementProperty=["disabled",e]},e.prototype.onModelChange=function(e){e||(this._maskService.actualValue="")},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"),l("design:type",String)],e.prototype,"maskExpression",void 0),a([t.Input(),l("design:type",Object)],e.prototype,"specialCharacters",void 0),a([t.Input(),l("design:type",Object)],e.prototype,"patterns",void 0),a([t.Input(),l("design:type",Object)],e.prototype,"prefix",void 0),a([t.Input(),l("design:type",Object)],e.prototype,"suffix",void 0),a([t.Input(),l("design:type",Object)],e.prototype,"thousandSeparator",void 0),a([t.Input(),l("design:type",Object)],e.prototype,"decimalMarker",void 0),a([t.Input(),l("design:type",Object)],e.prototype,"dropSpecialCharacters",void 0),a([t.Input(),l("design:type",Object)],e.prototype,"hiddenInput",void 0),a([t.Input(),l("design:type",Object)],e.prototype,"showMaskTyped",void 0),a([t.Input(),l("design:type",Object)],e.prototype,"placeHolderCharacter",void 0),a([t.Input(),l("design:type",Object)],e.prototype,"shownMaskExpression",void 0),a([t.Input(),l("design:type",Object)],e.prototype,"showTemplate",void 0),a([t.Input(),l("design:type",Object)],e.prototype,"clearIfNotMatch",void 0),a([t.Input(),l("design:type",Object)],e.prototype,"validation",void 0),a([t.Input(),l("design:type",Object)],e.prototype,"separatorLimit",void 0),a([t.HostListener("input",["$event"]),l("design:type",Function),l("design:paramtypes",[Object]),l("design:returntype",void 0)],e.prototype,"onInput",null),a([t.HostListener("blur"),l("design:type",Function),l("design:paramtypes",[]),l("design:returntype",void 0)],e.prototype,"onBlur",null),a([t.HostListener("click",["$event"]),l("design:type",Function),l("design:paramtypes",[Object]),l("design:returntype",void 0)],e.prototype,"onFocus",null),a([t.HostListener("keydown",["$event"]),l("design:type",Function),l("design:paramtypes",[Object]),l("design:returntype",void 0)],e.prototype,"onKeyDown",null),a([t.HostListener("ngModelChange",["$event"]),l("design:type",Function),l("design:paramtypes",[Object]),l("design:returntype",void 0)],e.prototype,"onModelChange",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)),l("design:paramtypes",[Object,v,Object])],e)}(),y=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:k}]},e=a([t.Pipe({name:"mask",pure:!0}),l("design:paramtypes",[k])],e)}(),S=function(){function e(){}var i;return i=e,e.forRoot=function(e){return{ngModule:i,providers:[{provide:u,useValue:e},{provide:f,useValue:m},{provide:p,useFactory:x,deps:[f,u]},k]}},e.forChild=function(e){return{ngModule:i}},e=i=a([t.NgModule({exports:[_,y],declarations:[_,y]})],e)}();function x(e,t){return t instanceof Function?n({},e,t()):n({},e,t)}e.INITIAL_CONFIG=f,e.MaskDirective=_,e.MaskPipe=y,e.MaskService=v,e.NEW_CONFIG=u,e.NgxMaskModule=S,e._configFactory=x,e.config=p,e.initialConfig=m,e.timeMasks=d,e.withoutValidation=g,e.ɵa=k,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 a=function(){return(a=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 n(e,t){var i,s,r,a,n={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function o(a){return function(o){return function(a){if(i)throw new TypeError("Generator is already executing.");for(;n;)try{if(i=1,s&&(r=2&a[0]?s.return:a[0]?s.throw||((r=s.return)&&r.call(s),0):s.next)&&!(r=r.call(s,a[1])).done)return r;switch(s=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return n.label++,{value:a[1],done:!1};case 5:n.label++,s=a[1],a=[0];continue;case 7:a=n.ops.pop(),n.trys.pop();continue;default:if(!(r=(r=n.trys).length>0&&r[r.length-1])&&(6===a[0]||2===a[0])){n=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){n.label=a[1];break}if(6===a[0]&&n.label<r[1]){n.label=r[1],r=a;break}if(r&&n.label<r[2]){n.label=r[2],n.ops.push(a);break}r[2]&&n.ops.pop(),n.trys.pop();continue}a=t.call(e,n)}catch(e){a=[6,e],s=0}finally{i=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,o])}}}function o(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var s,r,a=i.call(e),n=[];try{for(;(void 0===t||t-- >0)&&!(s=a.next()).done;)n.push(s.value)}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return n}var h=new t.InjectionToken("config"),l=new t.InjectionToken("NEW_CONFIG"),c=new t.InjectionToken("INITIAL_CONFIG"),p={suffix:"",prefix:"",thousandSeparator:" ",decimalMarker:".",clearIfNotMatch:!1,showTemplate:!1,showMaskTyped:!1,placeHolderCharacter:"_",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")}}},u=["Hh:m0:s0","Hh:m0","m0:s0"],f=["percent","Hh","s0","m0","separator","d0/M0/0000","d0/M0","d0","M0"],m=function(){function e(e){var t=this;this._config=e,this.maskExpression="",this.actualValue="",this.shownMaskExpression="",this._formatWithSeparators=function(e,i,s,r){var a=e.split(s),n=a.length>1?""+s+a[1]:"",o=a[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+n:0===r?o:o+n.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,i,s){if(i<1/0){var r=new RegExp(t._charToRegExpExpression(s)+"\\d{"+i+"}.*$"),a=e.match(r);a&&a[0].length-1>i?e=e.substring(0,e.length-1):0===i&&e.endsWith(s)&&(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.thousandSeparator=this._config.thousandSeparator,this.decimalMarker=this._config.decimalMarker,this.hiddenInput=this._config.hiddenInput,this.showMaskTyped=this._config.showMaskTyped,this.placeHolderCharacter=this._config.placeHolderCharacter,this.validation=this._config.validation,this.separatorLimit=this._config.separatorLimit}return e.prototype.applyMaskWithPattern=function(e,t){var i=o(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,a="",n=!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._stripToDecimal(e);var p=this.getPrecision(t);e=this.checkInputPrecision(e,p,".")}if(e.indexOf(".")>0&&!this.percentage(e.substring(0,e.indexOf(".")))){var u=e.substring(0,e.indexOf(".")-1);e=""+u+e.substring(e.indexOf("."),e.length)}a=this.percentage(e)?e:e.substring(0,e.length-1)}else if(t.startsWith("separator")){(e.match("[wа-яА-Я]")||e.match("[ЁёА-я]")||e.match("[a-z]|[A-Z]")||e.match(/[-@#!$%\\^&*()_£¬'+|~=`{}\[\]:";<>.?\/]/)||e.match("[^A-Za-z0-9,]"))&&(e=this._stripToDecimal(e)),e=e.length>1&&"0"===e[0]&&e[1]!==this.decimalMarker?e.slice(1,e.length):e;var f=this._charToRegExpExpression(this.thousandSeparator),m=this._charToRegExpExpression(this.decimalMarker),d='@#!$%^&*()_+|~=`{}\\[\\]:\\s,";<>?\\/'.replace(f,"").replace(m,""),k=new RegExp("["+d+"]");e.match(k)&&(e=e.substring(0,e.length-1));p=this.getPrecision(t);var g=(e=this.checkInputPrecision(e,p,this.decimalMarker)).replace(new RegExp(f,"g"),""),v=(a=this._formatWithSeparators(g,this.thousandSeparator,this.decimalMarker,p)).indexOf(",")-e.indexOf(",");if((x=a.length-e.length)>0&&","!==a[i]){o=!0;var _=0;do{this._shift.add(i+_),_++}while(_<x)}else 0!==v&&i>0&&!(a.indexOf(",")>=i&&i>3)||!(a.indexOf(".")>=i&&i>3)&&x<=0?(this._shift.clear(),o=!0,h=x,i+=x,this._shift.add(i)):this._shift.clear()}else for(var S=0,y=c[0];S<c.length&&r!==t.length;y=c[++S])if(this._checkSymbolMask(y,t[r])&&"?"===t[r+1])a+=y,r+=2;else if("*"===t[r+1]&&n&&this._checkSymbolMask(y,t[r+2]))a+=y,r+=3,n=!1;else if(this._checkSymbolMask(y,t[r])&&"*"===t[r+1])a+=y,n=!0;else if("?"===t[r+1]&&this._checkSymbolMask(y,t[r+2]))a+=y,r+=3;else if(this._checkSymbolMask(y,t[r])||this.hiddenInput&&this.maskAvailablePatterns[t[r]]&&this.maskAvailablePatterns[t[r]].symbol===y){if("H"===t[r]&&Number(y)>2){r+=1;var x=/[*?]/g.test(t.slice(0,r))?c.length:r;this._shift.add(x+this.prefix.length||0),S--;continue}if("h"===t[r]&&"2"===a&&Number(y)>3){r+=1,S--;continue}if("m"===t[r]&&Number(y)>5){r+=1;x=/[*?]/g.test(t.slice(0,r))?c.length:r;this._shift.add(x+this.prefix.length||0),S--;continue}if("s"===t[r]&&Number(y)>5){r+=1;x=/[*?]/g.test(t.slice(0,r))?c.length:r;this._shift.add(x+this.prefix.length||0),S--;continue}if("d"===t[r]&&(Number(e.slice(r,r+2))>31||"/"===e[r+1])){r+=1;x=/[*?]/g.test(t.slice(0,r))?c.length:r;this._shift.add(x+this.prefix.length||0),S--;continue}if("M"===t[r]){var M=0===r&&(Number(y)>2||Number(e.slice(r,r+2))>12||"/"===e[r+1]),E=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]),b=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]),C=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,w=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(M||E||b||C||w){r+=1;x=/[*?]/g.test(t.slice(0,r))?c.length:r;this._shift.add(x+this.prefix.length||0),S--;continue}}a+=y,r++}else if(-1!==this.maskSpecialCharacters.indexOf(t[r])){a+=t[r],r++;x=/[*?]/g.test(t.slice(0,r))?c.length:r;this._shift.add(x+this.prefix.length||0),S--}else this.maskSpecialCharacters.indexOf(y)>-1&&this.maskAvailablePatterns[t[r]]&&this.maskAvailablePatterns[t[r]].optional?(c[r]&&"099.099.099.099"!==t&&(a+=c[r]),r++,S--):"*"===this.maskExpression[r+1]&&this._findSpecialChar(this.maskExpression[r+2])&&this._findSpecialChar(y)===this.maskExpression[r+2]&&n?(r+=3,a+=y):"?"===this.maskExpression[r+1]&&this._findSpecialChar(this.maskExpression[r+2])&&this._findSpecialChar(y)===this.maskExpression[r+2]&&n?(r+=3,a+=y):this.showMaskTyped&&this.maskSpecialCharacters.indexOf(y)<0&&y!==this.placeHolderCharacter&&(l=!0);a.length+1===t.length&&-1!==this.maskSpecialCharacters.indexOf(t[t.length-1])&&(a+=t[t.length-1]);for(var V=i+1;this._shift.has(V);)h++,V++;var I=this._shift.has(i)?h:0;l&&I--,s(I,o),h<0&&this._shift.clear();var P=""+this.prefix+a+this.suffix;return 0===a.length&&(P=""+this.prefix+a),P},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._stripToDecimal=function(e){return e.split("").filter(function(e){return e.match("\\d")||"."===e||","===e}).join("")},e.prototype._charToRegExpExpression=function(e){return" "===e?"\\s":"[\\^$.|?*+()".indexOf(e)>=0?"\\"+e:e},e.decorators=[{type:t.Injectable}],e.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[h]}]}]},e}();var d=function(e){function i(t,i,s,r){var a=e.call(this,i)||this;return a.document=t,a._config=i,a._elementRef=s,a._renderer=r,a.validation=!0,a.maskExpression="",a.isNumberValue=!1,a.showMaskTyped=!1,a.placeHolderCharacter="_",a.maskIsShown="",a.selStart=null,a.selEnd=null,a.onChange=function(e){},a._formElement=a._elementRef.nativeElement,a}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){var a=this;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]:"",o="";if(void 0!==this.hiddenInput){var h=this.actualValue.split("");""!==t&&h.length?"number"==typeof this.selStart&&"number"==typeof this.selEnd&&(t.length>h.length?h.splice(this.selStart,0,n):t.length<h.length&&(h.length-t.length==1?h.splice(this.selStart-1,1):h.splice(this.selStart,this.selEnd-this.selStart))):h=[],o=this.actualValue.length?this.shiftTypedSymbols(h.join("")):t}o=Boolean(o)&&o.length?o:t;var l=e.prototype.applyMask.call(this,o,i,s,r);if(this.actualValue=this.getActualValue(l),"."===this.thousandSeparator&&"."===this.decimalMarker&&(this.decimalMarker=","),this.maskExpression.startsWith("separator")&&!0===this.dropSpecialCharacters&&(this.maskSpecialCharacters=this.maskSpecialCharacters.filter(function(e){return e!==a.decimalMarker})),this.formControlResult(l),!this.showMaskTyped)return this.hiddenInput&&l&&l.length?this.hideInput(l,this.maskExpression):l;var c=l.length,p=this.prefix+this.maskIsShown;return l+("IP"===this.maskExpression?p:p.slice(c))},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 a=i;return i="",a}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,this.placeHolderCharacter):""},i.prototype.clearIfNotMatchFn=function(){this.clearIfNotMatch&&this.prefix.length+this.maskExpression.length+this.suffix.length!==this._formElement.value.replace(/_/g,"").length&&(this.formElementProperty=["value",""],this.applyMask(this._formElement.value,this.maskExpression))},Object.defineProperty(i.prototype,"formElementProperty",{set:function(e){var t=o(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 this.placeHolderCharacter+"."+this.placeHolderCharacter+"."+this.placeHolderCharacter+"."+this.placeHolderCharacter;for(var t=[],i=0;i<e.length;i++)e[i].match("\\d")&&t.push(e[i]);return t.length<=3?this.placeHolderCharacter+"."+this.placeHolderCharacter+"."+this.placeHolderCharacter:t.length>3&&t.length<=6?this.placeHolderCharacter+"."+this.placeHolderCharacter:t.length>6&&t.length<=9?this.placeHolderCharacter:(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._retrieveSeparatorValue=function(e){return this._removeMask(this._removeSuffix(this._removePrefix(e)),this.maskSpecialCharacters)},i.prototype._regExpForRemove=function(e){return new RegExp(e.map(function(e){return"\\"+e}).join("|"),"gi")},i.prototype._checkSymbols=function(e){if(""===e)return e;var t=this._retrieveSeparatorPrecision(this.maskExpression),i=this._retrieveSeparatorValue(e);return"."!==this.decimalMarker&&(i=i.replace(this.decimalMarker,".")),this.isNumberValue?t?e===this.decimalMarker?null:this._checkPrecision(this.maskExpression,i):Number(i):i},i.prototype._retrieveSeparatorPrecision=function(e){var t=e.match(new RegExp("^separator\\.([^d]*)"));return t?Number(t[1]):null},i.prototype._checkPrecision=function(e,t){return e.indexOf("2")>0?Number(t).toFixed(2):Number(t)},i.decorators=[{type:t.Injectable}],i.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[s.DOCUMENT]}]},{type:void 0,decorators:[{type:t.Inject,args:[h]}]},{type:t.ElementRef},{type:t.Renderer2}]},i}(m);var k=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.thousandSeparator=" ",this.decimalMarker=".",this.dropSpecialCharacters=null,this.hiddenInput=null,this.showMaskTyped=null,this.placeHolderCharacter=null,this.shownMaskExpression=null,this.showTemplate=null,this.clearIfNotMatch=null,this.validation=null,this.separatorLimit=null,this._maskValue="",this._position=null,this.onChange=function(e){},this.onTouch=function(){}}return e.prototype.ngOnChanges=function(e){var t=e.maskExpression,i=e.specialCharacters,s=e.patterns,r=e.prefix,a=e.suffix,n=e.thousandSeparator,o=e.decimalMarker,h=e.dropSpecialCharacters,l=e.hiddenInput,c=e.showMaskTyped,p=e.placeHolderCharacter,u=e.shownMaskExpression,f=e.showTemplate,m=e.clearIfNotMatch,d=e.validation,k=e.separatorLimit;if(t&&(this._maskValue=e.maskExpression.currentValue||""),i){if(!i.currentValue||!Array.isArray(i.currentValue))return;this._maskService.maskSpecialCharacters=e.specialCharacters.currentValue||[]}s&&(this._maskService.maskAvailablePatterns=s.currentValue),r&&(this._maskService.prefix=r.currentValue),a&&(this._maskService.suffix=a.currentValue),n&&(this._maskService.thousandSeparator=n.currentValue),o&&(this._maskService.decimalMarker=o.currentValue),h&&(this._maskService.dropSpecialCharacters=h.currentValue),l&&(this._maskService.hiddenInput=l.currentValue),c&&(this._maskService.showMaskTyped=c.currentValue),p&&(this._maskService.placeHolderCharacter=p.currentValue),u&&(this._maskService.shownMaskExpression=u.currentValue),f&&(this._maskService.showTemplate=f.currentValue),m&&(this._maskService.clearIfNotMatch=m.currentValue),d&&(this._maskService.validation=d.currentValue),k&&(this._maskService.separatorLimit=k.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("separator"))return null;if(f.includes(this._maskValue))return null;if(this._maskService.clearIfNotMatch)return null;if(u.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 a in this._maskService.maskAvailablePatterns){var n=s(a);if("object"==typeof n)return n.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 a=this._position?this._inputValue.length+i+s:i+("Backspace"!==this._code||r?s:0);t.setSelectionRange(a,a),(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.onKeyDown=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.specialCharacters||this._config.specialCharacters,this.prefix.length>1&&t.selectionStart<=this.prefix.length)t.setSelectionRange(this.prefix.length,this.prefix.length);else{if(this._inputValue.length!==t.selectionStart&&1!==t.selectionStart)for(;this.specialCharacters.includes(this._inputValue[t.selectionStart-1].toString())&&(this.prefix.length>=1&&t.selectionStart>this.prefix.length||0===this.prefix.length);)t.setSelectionRange(t.selectionStart-1,t.selectionStart-1);this.suffixCheckOnPressDelete(e.keyCode,t)}this.suffixCheckOnPressDelete(e.keyCode,t),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 n(this,function(t){return void 0===e&&(e=""),"number"==typeof e&&(e=String(e),e="."!==this.decimalMarker?e.replace(".",this.decimalMarker):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,a){function n(e){try{h(r.next(e))}catch(e){a(e)}}function o(e){try{h(r.throw(e))}catch(e){a(e)}}function h(t){t.done?e(t.value):new s(function(e){e(t.value)}).then(n,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.suffixCheckOnPressDelete=function(e,t){46===e&&this.suffix.length>0&&this._inputValue.length-this.suffix.length<=t.selectionStart&&t.setSelectionRange(this._inputValue.length-this.suffix.length,this._inputValue.length),8===e&&(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))},e.prototype.setDisabledState=function(e){this._maskService.formElementProperty=["disabled",e]},e.prototype.onModelChange=function(e){e||(this._maskService.actualValue="")},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 a=Number(e.slice(t._start+1,t._end));return i+new Array(a+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.decorators=[{type:t.Directive,args:[{selector:"[mask]",providers:[{provide:i.NG_VALUE_ACCESSOR,useExisting:t.forwardRef(function(){return e}),multi:!0},{provide:i.NG_VALIDATORS,useExisting:t.forwardRef(function(){return e}),multi:!0},d]}]}],e.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[s.DOCUMENT]}]},{type:d},{type:void 0,decorators:[{type:t.Inject,args:[h]}]}]},e.propDecorators={maskExpression:[{type:t.Input,args:["mask"]}],specialCharacters:[{type:t.Input}],patterns:[{type:t.Input}],prefix:[{type:t.Input}],suffix:[{type:t.Input}],thousandSeparator:[{type:t.Input}],decimalMarker:[{type:t.Input}],dropSpecialCharacters:[{type:t.Input}],hiddenInput:[{type:t.Input}],showMaskTyped:[{type:t.Input}],placeHolderCharacter:[{type:t.Input}],shownMaskExpression:[{type:t.Input}],showTemplate:[{type:t.Input}],clearIfNotMatch:[{type:t.Input}],validation:[{type:t.Input}],separatorLimit:[{type:t.Input}],onInput:[{type:t.HostListener,args:["input",["$event"]]}],onBlur:[{type:t.HostListener,args:["blur"]}],onFocus:[{type:t.HostListener,args:["click",["$event"]]}],onKeyDown:[{type:t.HostListener,args:["keydown",["$event"]]}],onModelChange:[{type:t.HostListener,args:["ngModelChange",["$event"]]}]},e}();var g=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.decorators=[{type:t.Pipe,args:[{name:"mask",pure:!0}]}],e.ctorParameters=function(){return[{type:m}]},e}();var v=function(){function e(){}return e.forRoot=function(t){return{ngModule:e,providers:[{provide:l,useValue:t},{provide:c,useValue:p},{provide:h,useFactory:_,deps:[c,l]},m]}},e.forChild=function(t){return{ngModule:e}},e.decorators=[{type:t.NgModule,args:[{exports:[k,g],declarations:[k,g]}]}],e}();function _(e,t){return t instanceof Function?a({},e,t()):a({},e,t)}e.MaskApplierService=m,e.MaskDirective=k,e.MaskPipe=g,e.MaskService=d,e.NgxMaskModule=v,e._configFactory=_,e.ɵb=h,e.ɵc=l,e.ɵd=c,e.ɵe=p,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=ngx-mask.umd.min.js.map |
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc | ||
*/ | ||
/** | ||
* Generated bundle index. Do not edit. | ||
*/ | ||
export * from './public_api'; | ||
export { MaskApplierService as ɵa } from './app/ngx-mask/mask-applier.service'; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmd4LW1hc2suanMiLCJzb3VyY2VSb290Ijoibmc6Ly9uZ3gtbWFzay8iLCJzb3VyY2VzIjpbIm5neC1tYXNrLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBRUgsY0FBYyxjQUFjLENBQUM7QUFFN0IsT0FBTyxFQUFDLGtCQUFrQixJQUFJLEVBQUUsRUFBQyxNQUFNLHFDQUFxQyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBHZW5lcmF0ZWQgYnVuZGxlIGluZGV4LiBEbyBub3QgZWRpdC5cbiAqL1xuXG5leHBvcnQgKiBmcm9tICcuL3B1YmxpY19hcGknO1xuXG5leHBvcnQge01hc2tBcHBsaWVyU2VydmljZSBhcyDJtWF9IGZyb20gJy4vYXBwL25neC1tYXNrL21hc2stYXBwbGllci5zZXJ2aWNlJzsiXX0= | ||
export { _configFactory, NgxMaskModule, MaskDirective, MaskPipe, MaskService, MaskApplierService } from './index'; | ||
export { INITIAL_CONFIG as ɵd, NEW_CONFIG as ɵc, config as ɵb, initialConfig as ɵe } from './lib/config'; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmd4LW1hc2suanMiLCJzb3VyY2VSb290Ijoibmc6Ly9uZ3gtbWFzay8iLCJzb3VyY2VzIjpbIm5neC1tYXNrLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFJQSx3R0FBYyxTQUFTLENBQUM7QUFFeEIsT0FBTyxFQUFlLGNBQWMsSUFBSSxFQUFFLEVBQUMsVUFBVSxJQUFJLEVBQUUsRUFBQyxNQUFNLElBQUksRUFBRSxFQUFDLGFBQWEsSUFBSSxFQUFFLEVBQUMsTUFBTSxjQUFjLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEdlbmVyYXRlZCBidW5kbGUgaW5kZXguIERvIG5vdCBlZGl0LlxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vaW5kZXgnO1xuXG5leHBvcnQge0lDb25maWcgYXMgybVhLElOSVRJQUxfQ09ORklHIGFzIMm1ZCxORVdfQ09ORklHIGFzIMm1Yyxjb25maWcgYXMgybViLGluaXRpYWxDb25maWcgYXMgybVlfSBmcm9tICcuL2xpYi9jb25maWcnOyJdfQ== |
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc | ||
*/ | ||
/** | ||
* Generated bundle index. Do not edit. | ||
*/ | ||
export * from './public_api'; | ||
export { MaskApplierService as ɵa } from './app/ngx-mask/mask-applier.service'; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmd4LW1hc2suanMiLCJzb3VyY2VSb290Ijoibmc6Ly9uZ3gtbWFzay8iLCJzb3VyY2VzIjpbIm5neC1tYXNrLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBRUgsY0FBYyxjQUFjLENBQUM7QUFFN0IsT0FBTyxFQUFDLGtCQUFrQixJQUFJLEVBQUUsRUFBQyxNQUFNLHFDQUFxQyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBHZW5lcmF0ZWQgYnVuZGxlIGluZGV4LiBEbyBub3QgZWRpdC5cbiAqL1xuXG5leHBvcnQgKiBmcm9tICcuL3B1YmxpY19hcGknO1xuXG5leHBvcnQge01hc2tBcHBsaWVyU2VydmljZSBhcyDJtWF9IGZyb20gJy4vYXBwL25neC1tYXNrL21hc2stYXBwbGllci5zZXJ2aWNlJzsiXX0= | ||
export { _configFactory, NgxMaskModule, MaskDirective, MaskPipe, MaskService, MaskApplierService } from './index'; | ||
export { INITIAL_CONFIG as ɵd, NEW_CONFIG as ɵc, config as ɵb, initialConfig as ɵe } from './lib/config'; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmd4LW1hc2suanMiLCJzb3VyY2VSb290Ijoibmc6Ly9uZ3gtbWFzay8iLCJzb3VyY2VzIjpbIm5neC1tYXNrLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFJQSx3R0FBYyxTQUFTLENBQUM7QUFFeEIsT0FBTyxFQUFlLGNBQWMsSUFBSSxFQUFFLEVBQUMsVUFBVSxJQUFJLEVBQUUsRUFBQyxNQUFNLElBQUksRUFBRSxFQUFDLGFBQWEsSUFBSSxFQUFFLEVBQUMsTUFBTSxjQUFjLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEdlbmVyYXRlZCBidW5kbGUgaW5kZXguIERvIG5vdCBlZGl0LlxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vaW5kZXgnO1xuXG5leHBvcnQge0lDb25maWcgYXMgybVhLElOSVRJQUxfQ09ORklHIGFzIMm1ZCxORVdfQ09ORklHIGFzIMm1Yyxjb25maWcgYXMgybViLGluaXRpYWxDb25maWcgYXMgybVlfSBmcm9tICcuL2xpYi9jb25maWcnOyJdfQ== |
/** | ||
* Generated bundle index. Do not edit. | ||
*/ | ||
export * from './public_api'; | ||
export { MaskApplierService as ɵa } from './app/ngx-mask/mask-applier.service'; | ||
export * from './index'; | ||
export { IConfig as ɵa, INITIAL_CONFIG as ɵd, NEW_CONFIG as ɵc, config as ɵb, initialConfig as ɵe } from './lib/config'; |
@@ -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":27,"character":51},"arguments":["config"]},"NEW_CONFIG":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":28,"character":55},"arguments":["NEW_CONFIG"]},"INITIAL_CONFIG":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":29,"character":59},"arguments":["INITIAL_CONFIG"]},"initialConfig":{"suffix":"","prefix":"","thousandSeparator":" ","decimalMarker":".","clearIfNotMatch":false,"showTemplate":false,"showMaskTyped":false,"placeHolderCharacter":"_","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","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}}]}],"thousandSeparator":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":29,"character":5}}]}],"decimalMarker":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":30,"character":5}}]}],"dropSpecialCharacters":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":31,"character":5}}]}],"hiddenInput":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":32,"character":5}}]}],"showMaskTyped":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":33,"character":5}}]}],"placeHolderCharacter":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":34,"character":5}}]}],"shownMaskExpression":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":35,"character":5}}]}],"showTemplate":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":36,"character":5}}]}],"clearIfNotMatch":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":37,"character":5}}]}],"validation":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":38,"character":5}}]}],"separatorLimit":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":39,"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":208,"character":5},"arguments":["input",["$event"]]}]}],"onBlur":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener","line":241,"character":5},"arguments":["blur"]}]}],"onFocus":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener","line":247,"character":5},"arguments":["click",["$event"]]}]}],"onKeyDown":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener","line":296,"character":5},"arguments":["keydown",["$event"]]}]}],"writeValue":[{"__symbolic":"method"}],"registerOnChange":[{"__symbolic":"method"}],"registerOnTouched":[{"__symbolic":"method"}],"suffixCheckOnPressDelete":[{"__symbolic":"method"}],"setDisabledState":[{"__symbolic":"method"}],"onModelChange":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener","line":416,"character":5},"arguments":["ngModelChange",["$event"]]}]}],"_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":21,"character":9},"arguments":[{"__symbolic":"reference","module":"@angular/common","name":"DOCUMENT","line":21,"character":16}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":22,"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":23,"character":29},{"__symbolic":"reference","module":"@angular/core","name":"Renderer2","line":24,"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"}],"_retrieveSeparatorValue":[{"__symbolic":"method"}],"_regExpForRemove":[{"__symbolic":"method"}],"_checkSymbols":[{"__symbolic":"method"}],"_retrieveSeparatorPrecision":[{"__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":3,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":27,"character":24},"arguments":[{"__symbolic":"reference","name":"config"}]}]],"parameters":[{"__symbolic":"reference","name":"IConfig"}]}],"applyMaskWithPattern":[{"__symbolic":"method"}],"applyMask":[{"__symbolic":"method"}],"_findSpecialChar":[{"__symbolic":"method"}],"_checkSymbolMask":[{"__symbolic":"method"}],"_stripToDecimal":[{"__symbolic":"method"}],"_charToRegExpExpression":[{"__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":{"NgxMaskModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":7,"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":"ɵc"},"useValue":{"__symbolic":"reference","name":"configValue"}},{"provide":{"__symbolic":"reference","name":"ɵd"},"useValue":{"__symbolic":"reference","name":"ɵe"}},{"provide":{"__symbolic":"reference","name":"ɵb"},"useFactory":{"__symbolic":"reference","name":"_configFactory"},"deps":[{"__symbolic":"reference","name":"ɵd"},{"__symbolic":"reference","name":"ɵc"}]},{"__symbolic":"reference","name":"MaskApplierService"}]}},"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":{}}},"MaskDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":9,"character":1},"arguments":[{"selector":"[mask]","providers":[{"provide":{"__symbolic":"reference","module":"@angular/forms","name":"NG_VALUE_ACCESSOR","line":13,"character":15},"useExisting":{"__symbolic":"reference","name":"MaskDirective"},"multi":true},{"provide":{"__symbolic":"reference","module":"@angular/forms","name":"NG_VALIDATORS","line":18,"character":15},"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":26,"character":3},"arguments":["mask"]}]}],"specialCharacters":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":27,"character":3}}]}],"patterns":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":28,"character":3}}]}],"prefix":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":29,"character":3}}]}],"suffix":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":30,"character":3}}]}],"thousandSeparator":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":31,"character":3}}]}],"decimalMarker":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":32,"character":3}}]}],"dropSpecialCharacters":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":33,"character":3}}]}],"hiddenInput":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":34,"character":3}}]}],"showMaskTyped":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":35,"character":3}}]}],"placeHolderCharacter":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":36,"character":3}}]}],"shownMaskExpression":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":37,"character":3}}]}],"showTemplate":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":38,"character":3}}]}],"clearIfNotMatch":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":39,"character":3}}]}],"validation":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":40,"character":3}}]}],"separatorLimit":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":41,"character":3}}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":51,"character":5},"arguments":[{"__symbolic":"reference","module":"@angular/common","name":"DOCUMENT","line":51,"character":12}]}],null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":53,"character":5},"arguments":[{"__symbolic":"reference","name":"ɵb"}]}]],"parameters":[{"__symbolic":"reference","name":"any"},{"__symbolic":"reference","name":"MaskService"},{"__symbolic":"reference","name":"ɵa"}]}],"ngOnChanges":[{"__symbolic":"method"}],"validate":[{"__symbolic":"method"}],"onInput":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener","line":204,"character":3},"arguments":["input",["$event"]]}]}],"onBlur":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener","line":237,"character":3},"arguments":["blur"]}]}],"onFocus":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener","line":243,"character":3},"arguments":["click",["$event"]]}]}],"onKeyDown":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener","line":289,"character":3},"arguments":["keydown",["$event"]]}]}],"writeValue":[{"__symbolic":"method"}],"registerOnChange":[{"__symbolic":"method"}],"registerOnTouched":[{"__symbolic":"method"}],"suffixCheckOnPressDelete":[{"__symbolic":"method"}],"setDisabledState":[{"__symbolic":"method"}],"onModelChange":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener","line":408,"character":3},"arguments":["ngModelChange",["$event"]]}]}],"_repeatPatternSymbols":[{"__symbolic":"method"}],"_applyMask":[{"__symbolic":"method"}],"_validateTime":[{"__symbolic":"method"}]}},"MaskPipe":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Pipe","line":5,"character":1},"arguments":[{"name":"mask","pure":true}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"MaskApplierService"}]}],"transform":[{"__symbolic":"method"}]}},"MaskService":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"MaskApplierService"},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":6,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":22,"character":5},"arguments":[{"__symbolic":"reference","module":"@angular/common","name":"DOCUMENT","line":22,"character":12}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":23,"character":5},"arguments":[{"__symbolic":"reference","name":"ɵb"}]}],null,null],"parameters":[{"__symbolic":"reference","name":"any"},{"__symbolic":"reference","name":"ɵa"},{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":24,"character":25},{"__symbolic":"reference","module":"@angular/core","name":"Renderer2","line":25,"character":23}]}],"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"}],"_retrieveSeparatorValue":[{"__symbolic":"method"}],"_regExpForRemove":[{"__symbolic":"method"}],"_checkSymbols":[{"__symbolic":"method"}],"_retrieveSeparatorPrecision":[{"__symbolic":"method"}],"_checkPrecision":[{"__symbolic":"method"}]}},"MaskApplierService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":4,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":28,"character":22},"arguments":[{"__symbolic":"reference","name":"ɵb"}]}]],"parameters":[{"__symbolic":"reference","name":"ɵa"}]}],"applyMaskWithPattern":[{"__symbolic":"method"}],"applyMask":[{"__symbolic":"method"}],"_findSpecialChar":[{"__symbolic":"method"}],"_checkSymbolMask":[{"__symbolic":"method"}],"_stripToDecimal":[{"__symbolic":"method"}],"_charToRegExpExpression":[{"__symbolic":"method"}]}},"ɵa":{"__symbolic":"interface"},"ɵb":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":27,"character":51},"arguments":["config"]},"ɵc":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":28,"character":55},"arguments":["NEW_CONFIG"]},"ɵd":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":29,"character":59},"arguments":["INITIAL_CONFIG"]},"ɵe":{"suffix":"","prefix":"","thousandSeparator":" ","decimalMarker":".","clearIfNotMatch":false,"showTemplate":false,"showMaskTyped":false,"placeHolderCharacter":"_","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"]}}},"origins":{"NgxMaskModule":"./lib/ngx-mask.module","_configFactory":"./lib/ngx-mask.module","MaskDirective":"./lib/mask.directive","MaskPipe":"./lib/mask.pipe","MaskService":"./lib/mask.service","MaskApplierService":"./lib/mask-applier.service","ɵa":"./lib/config","ɵb":"./lib/config","ɵc":"./lib/config","ɵd":"./lib/config","ɵe":"./lib/config"},"importAs":"ngx-mask"} |
{ | ||
"name": "ngx-mask", | ||
"version": "8.1.3", | ||
"version": "8.1.4", | ||
"description": "awesome ngx mask", | ||
"license": "MIT", | ||
"angular-cli": {}, | ||
"keywords": [ | ||
@@ -19,6 +17,19 @@ "ng2-mask", | ||
], | ||
"license": "MIT", | ||
"author": "ngx-mask", | ||
"contributors": [ | ||
"ngx-mask" | ||
], | ||
"homepage": "https://github.com/JsDaddy/ngx-mask", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/NepipenkoIgor/ngx-mask.git" | ||
"url": "git@github.com:JsDaddy/ngx-mask.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/JsDaddy/ngx-mask/issues" | ||
}, | ||
"main": "bundles/ngx-mask.umd.js", | ||
"module": "fesm5/ngx-mask.js", | ||
"es2015": "fesm2015/ngx-mask.js", | ||
"typings": "ngx-mask.d.ts", | ||
"peerDependencies": { | ||
@@ -29,9 +40,5 @@ "@angular/common": "^6.0.0 || ^7.0.0 || ^8.0.0", | ||
}, | ||
"pre-commit": [ | ||
"lint", | ||
"test" | ||
], | ||
"main": "bundles/ngx-mask.umd.js", | ||
"module": "fesm5/ngx-mask.js", | ||
"es2015": "fesm2015/ngx-mask.js", | ||
"dependencies": { | ||
"tslib": "^1.9.0" | ||
}, | ||
"esm5": "esm5/ngx-mask.js", | ||
@@ -41,8 +48,4 @@ "esm2015": "esm2015/ngx-mask.js", | ||
"fesm2015": "fesm2015/ngx-mask.js", | ||
"typings": "ngx-mask.d.ts", | ||
"metadata": "ngx-mask.metadata.json", | ||
"sideEffects": false, | ||
"dependencies": { | ||
"tslib": "^1.9.0" | ||
} | ||
"sideEffects": false | ||
} |
198
README.md
@@ -17,9 +17,9 @@ <a href="https://jsdaddy.github.io/ngx-mask"> | ||
You can also try our [NGX LOADER INDICATOR](https://www.npmjs.com/package/ngx-loader-indicator). | ||
You can also try our [NGX COPYPASTE](https://www.npmjs.com/package/ngx-copypaste). | ||
### You can see the full [documentation](https://jsdaddy.github.io/ngx-mask-page/) with examples. | ||
### You can see the full [documentation](https://jsdaddy.github.io/ngx-mask-page/) with examples | ||
## Installing | ||
```bash | ||
@@ -30,2 +30,3 @@ $ npm install --save ngx-mask | ||
## Quickstart | ||
Import **ngx-mask** module in Angular app. | ||
@@ -49,5 +50,6 @@ | ||
#### Usage | ||
### Usage | ||
```html | ||
<input type="text" mask="{here comes your mask}"> | ||
<input type="text" mask="{here comes your mask}" /> | ||
``` | ||
@@ -57,3 +59,4 @@ | ||
#### Usage | ||
### Usage | ||
```html | ||
@@ -64,2 +67,3 @@ <span>{{phone | mask: '(000) 000-0000'}}</span> | ||
#### Examples | ||
| mask | example | | ||
@@ -74,35 +78,45 @@ | -------------- | -------------- | | ||
## Mask Options | ||
You can define your custom options for all directives (as object in the mask module) or for each (as attributes for directive). If you override this parameter, you have to provide all the special characters (default one are not included). | ||
You can define your custom options for all directives (as object in the mask module) or for each (as attributes for directive). If you override this parameter, you have to provide all the special characters (default one are not included). | ||
### specialCharacters (string[ ]) | ||
We have next default characters: | ||
| character | | ||
|-----------| | ||
| / | | ||
| ( | | ||
| ) | | ||
| . | | ||
| : | | ||
| - | | ||
| **space** | | ||
| + | | ||
| , | | ||
| @ | | ||
| character | | ||
|-----------| | ||
| - | | ||
| / | | ||
| ( | | ||
| ) | | ||
| . | | ||
| : | | ||
| **space** | | ||
| + | | ||
| , | | ||
| @ | | ||
| [ | | ||
| ] | | ||
| " | | ||
| ' | | ||
##### Usage | ||
#### Usage | ||
```html | ||
<input type="text" [specialCharacters]="[ '[' ,']' , '\\' ]" mask="[00]\[000]"> | ||
<input type="text" [specialCharacters]="[ '[' ,']' , '\\' ]" mask="[00]\[000]" /> | ||
``` | ||
##### Then | ||
``` | ||
```text | ||
Input value: 789-874.98 | ||
Masked value: [78]\[987] | ||
``` | ||
```typescript | ||
patterns ({ [character: string]: { pattern: RegExp, optional?: boolean}) | ||
``` | ||
We have next default patterns: | ||
We have next default patterns: | ||
| code | meaning | | ||
@@ -116,4 +130,5 @@ | ----- | ------------------------------------------- | | ||
##### Usage | ||
```html | ||
<input type="text" [patterns]="customPatterns" mask="(000-000)"> | ||
<input type="text" [patterns]="customPatterns" mask="(000-000)" /> | ||
``` | ||
@@ -128,3 +143,4 @@ | ||
##### Then | ||
``` | ||
```text | ||
Input value: 789HelloWorld | ||
@@ -135,4 +151,5 @@ Masked value: (Hel-loW) | ||
### Custom pattern for this | ||
You can define custom pattern and specify symbol to be rendered in input field. | ||
```typescript | ||
@@ -148,27 +165,34 @@ pattern = { | ||
### prefix (string) | ||
You can add prefix to you masked value | ||
##### Usage | ||
#### Usage | ||
```html | ||
<input type="text" prefix="+7 " mask="(000) 000 00 00"> | ||
<input type="text" prefix="+7" mask="(000) 000 00 00" /> | ||
``` | ||
### suffix (string) | ||
You can add suffix to you masked value | ||
##### Usage | ||
#### Usage | ||
```html | ||
<input type="text" suffix=" $" mask="0000"> | ||
<input type="text" suffix="$" mask="0000" /> | ||
``` | ||
### dropSpecialCharacters (boolean) | ||
### dropSpecialCharacters (boolean | string[]) | ||
You can choose if mask will drop special character in the model, or not, default value is `true`. | ||
##### Usage | ||
#### Usage | ||
```html | ||
<input type="text" [dropSpecialCharacters]="false" mask="000-000.00"> | ||
<input type="text" [dropSpecialCharacters]="false" mask="000-000.00" /> | ||
``` | ||
##### Then | ||
``` | ||
```text | ||
Input value: 789-874.98 | ||
@@ -179,24 +203,31 @@ Model value: 789-874.98 | ||
### showMaskTyped (boolean) | ||
You can choose if mask is shown while typing, or not, default value is `false`. | ||
##### Usage | ||
#### Usage | ||
```html | ||
<input mask="(000) 000-0000" prefix="+7" [showMaskTyped]="true"> | ||
<input mask="(000) 000-0000" prefix="+7" [showMaskTyped]="true" /> | ||
``` | ||
### placeHolderCharacter (string) | ||
If the `showMaskTyped` parameter is enabled, this setting customizes the character used as placeholder. Default value is `_`. | ||
##### Usage | ||
#### Usage | ||
```html | ||
<input mask="(000) 000-0000" prefix="+7" [showMaskTyped]="true" placeHolderCharacter="*"> | ||
<input mask="(000) 000-0000" prefix="+7" [showMaskTyped]="true" placeHolderCharacter="*" /> | ||
``` | ||
### clearIfNotMatch (boolean) | ||
You can choose clear the input if the input value **not match** the mask, default value is `false`. | ||
### Pipe with mask expression and custom Pattern ([string, pattern]) | ||
You can pass array of expression and custom Pattern to pipe. | ||
##### Usage | ||
#### Usage | ||
```html | ||
@@ -207,2 +238,3 @@ <span>{{phone | mask: customMask}}</span> | ||
and in your component | ||
```typescript | ||
@@ -221,37 +253,54 @@ customMask: [string, pattern]; | ||
### Repeat mask | ||
You can pass into mask pattern with brackets. | ||
##### Usage | ||
#### Usage | ||
```html | ||
<input type="text" mask="A{4}"> | ||
<input type="text" mask="A{4}" /> | ||
``` | ||
### Thousand separator | ||
You can divide your input by thousands. | ||
##### Usage | ||
You can divide your input by thousands, by default will seperate with a space. | ||
#### Usage | ||
```html | ||
<input type="text" mask="separator"> | ||
<input type="text" mask="separator" /> | ||
``` | ||
For separate input with dots | ||
For separate input with dots. | ||
```html | ||
<input type="text" mask="dot_separator"> | ||
<input type="text" mask="separator" thousandSeparator="." /> | ||
``` | ||
For separate input with commas | ||
For using decimals enter `.` and how many decimals to the end of your input to `separator` mask. | ||
```html | ||
<input type="text" mask="comma_separator"> | ||
<input type="text" mask="separator.2" /> | ||
``` | ||
For using decimals enter `.` to the end of your input to 'separator' or 'dot_separator' mask and `,` to 'comma_separator'. | ||
```text | ||
Input value: 1234.56 | ||
Masked value: 1 234.56 | ||
Input value: 1234,56 | ||
Masked value: 1.234,56 | ||
Input value: 1234.56 | ||
Masked value: 1,234.56 | ||
``` | ||
```html | ||
<input type="text" mask="dot_separator.2"> | ||
<input type="text" mask="comma_separator.2"> | ||
<input type="text" mask="dot_separator.0"> | ||
<input type="text" mask="comma_separator.0"> | ||
<input type="text" mask="separator.2" thousandSeparator="." /> | ||
<input type="text" mask="separator.2" thousandSeparator="," /> | ||
<input type="text" mask="separator.0" thousandSeparator="." /> | ||
<input type="text" mask="separator.0" thousandSeparator="," /> | ||
``` | ||
For limiting decimal precision add `.` and the precision you want to limit too on the input. **2** is useful for currency. **0** will prevent decimals completely. | ||
``` | ||
For limiting decimal precision add `.` and the precision you want to limit too on the input. **2** is useful for currency. **0** will prevent decimals completely. | ||
```text | ||
Input value: 1234,56 | ||
@@ -270,7 +319,9 @@ Masked value: 1.234,56 | ||
For limiting the number of digits before the decimal point you can set `separatorLimit` value to _10_, _100_, _1000_, etc. | ||
```html | ||
<input type="text" mask="dot_separator.2" separatorLimit="1000"> | ||
<input type="text" mask="separator.2" separatorLimit="1000" /> | ||
``` | ||
``` | ||
For limiting the number of digits before the decimal point you can set `separatorLimit` value to _10_, _100_, _1000_ etc. | ||
```text | ||
Input value: 12345678,56 | ||
@@ -281,31 +332,39 @@ Masked value: 1.234,56 | ||
### Time validation | ||
You can validate your input as 24-hour format. | ||
##### Usage | ||
You can validate your input as 24 hour format. | ||
#### Usage | ||
```html | ||
<input type="text" mask="Hh:m0:s0"> | ||
<input type="text" mask="Hh:m0:s0" /> | ||
``` | ||
### Percent validation | ||
You can validate your input for percents. | ||
##### Usage | ||
#### Usage | ||
```html | ||
<input type="text" mask="percent" suffix="%"> | ||
<input type="text" mask="percent" suffix="%" /> | ||
``` | ||
### FormControl validation | ||
You can validate your `formControl`, default value is `true`. | ||
##### Usage | ||
#### Usage | ||
```html | ||
<input type="text" mask="00 00" [validation]="true"> | ||
<input type="text" mask="00 00" [validation]="true" /> | ||
``` | ||
### Secure input | ||
You can hide symbols in input field and get the actual value in `formControl`. | ||
##### Usage | ||
You can hide symbols in input field and get the actual value in `formcontrol`. | ||
#### Usage | ||
```html | ||
<input matInput placeholder="Secure input" [hiddenInput]="true" mask="XXX/X0/0000"> | ||
<input placeholder="Secure input" [hiddenInput]="true" mask="XXX/X0/0000" /> | ||
``` | ||
@@ -315,5 +374,6 @@ | ||
##### Usage | ||
#### Usage | ||
```html | ||
<input mask="IP"> | ||
<input mask="IP" /> | ||
``` |
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 not supported yet
Sorry, the diff of this file is too big to display
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
1101984
10492
0
1
364
39
1