-
Notifications
You must be signed in to change notification settings - Fork 0
/
angular-input-masks.min.js
1 lines (1 loc) · 16.1 KB
/
angular-input-masks.min.js
1
require=function e(r,a,n){function t(s,u){if(!a[s]){if(!r[s]){var o="function"==typeof require&&require;if(!u&&o)return o(s,!0);if(i)return i(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var l=a[s]={exports:{}};r[s][0].call(l.exports,function(e){var a=r[s][1][e];return t(a?a:e)},l,l.exports,e,r,a,n)}return a[s].exports}for(var i="function"==typeof require&&require,s=0;s<n.length;s++)t(n[s]);return t}({1:[function(e,r,a){r.exports=angular.module("ui.utils.masks",[e("./global/global-masks"),e("./br/br-masks"),e("./us/us-masks")]).name},{"./br/br-masks":3,"./global/global-masks":12,"./us/us-masks":20}],2:[function(e,r,a){var n=e("string-mask"),t=e("mask-factory"),i=new n("00000.00000 00000.000000 00000.000000 0 00000000000000");r.exports=t({clearValue:function(e){return e.replace(/[^0-9]/g,"").slice(0,47)},format:function(e){return 0===e.length?e:i.apply(e).replace(/[^0-9]$/,"")},validations:{brBoletoBancario:function(e){return 47===e.length}}})},{"mask-factory":"mask-factory","string-mask":void 0}],3:[function(e,r,a){var n=angular.module("ui.utils.masks.br",[e("../helpers")]).directive("uiBrBoletoBancarioMask",e("./boleto-bancario/boleto-bancario")).directive("uiBrCepMask",e("./cep/cep")).directive("uiBrCnpjMask",e("./cnpj/cnpj")).directive("uiBrCpfMask",e("./cpf/cpf")).directive("uiBrCpfcnpjMask",e("./cpf-cnpj/cpf-cnpj")).directive("uiBrIeMask",e("./inscricao-estadual/ie")).directive("uiNfeAccessKeyMask",e("./nfe/nfe")).directive("uiBrPhoneNumber",e("./phone/br-phone"));r.exports=n.name},{"../helpers":18,"./boleto-bancario/boleto-bancario":2,"./cep/cep":4,"./cnpj/cnpj":5,"./cpf-cnpj/cpf-cnpj":6,"./cpf/cpf":7,"./inscricao-estadual/ie":8,"./nfe/nfe":9,"./phone/br-phone":10}],4:[function(e,r,a){var n=e("string-mask"),t=e("mask-factory"),i=new n("00000-000");r.exports=t({clearValue:function(e){return e.replace(/[^0-9]/g,"").slice(0,8)},format:function(e){return(i.apply(e)||"").replace(/[^0-9]$/,"")},validations:{cep:function(e){return 8===e.length}}})},{"mask-factory":"mask-factory","string-mask":void 0}],5:[function(e,r,a){var n=e("string-mask"),t=e("br-validations"),i=e("mask-factory"),s=new n("00.000.000/0000-00");r.exports=i({clearValue:function(e){return e.replace(/[^\d]/g,"").slice(0,14)},format:function(e){return(s.apply(e)||"").trim().replace(/[^0-9]$/,"")},validations:{cnpj:function(e){return t.cnpj.validate(e)}}})},{"br-validations":void 0,"mask-factory":"mask-factory","string-mask":void 0}],6:[function(e,r,a){var n=e("string-mask"),t=e("br-validations"),i=e("mask-factory"),s=new n("00.000.000/0000-00"),u=new n("000.000.000-00");r.exports=i({clearValue:function(e){return e.replace(/[^\d]/g,"").slice(0,14)},format:function(e){var r;return r=e.length>11?s.apply(e):u.apply(e)||"",r.trim().replace(/[^0-9]$/,"")},validations:{cpf:function(e){return e.length>11||t.cpf.validate(e)},cnpj:function(e){return e.length<=11||t.cnpj.validate(e)}}})},{"br-validations":void 0,"mask-factory":"mask-factory","string-mask":void 0}],7:[function(e,r,a){var n=e("string-mask"),t=e("br-validations"),i=e("mask-factory"),s=new n("000.000.000-00");r.exports=i({clearValue:function(e){return e.replace(/[^\d]/g,"").slice(0,11)},format:function(e){return(s.apply(e)||"").trim().replace(/[^0-9]$/,"")},validations:{cpf:function(e){return t.cpf.validate(e)}}})},{"br-validations":void 0,"mask-factory":"mask-factory","string-mask":void 0}],8:[function(e,r,a){function n(e){function r(e){return e?e.replace(/[^0-9]/g,""):e}function a(e,a){if(!e||!s[e])return void 0;if("SP"===e&&/^P/i.test(a))return s.SP[1].mask;for(var n=s[e],t=0;n[t].chars&&n[t].chars<r(a).length&&t<n.length-1;)t++;return n[t].mask}function n(e,n){var t=a(n,e);if(!t)return e;var i=t.process(r(e)),s=i.result||"";return s=s.trim().replace(/[^0-9]$/,""),"SP"===n&&/^p/i.test(e)?"P"+s:s}var s={AC:[{mask:new t("00.000.000/000-00")}],AL:[{mask:new t("000000000")}],AM:[{mask:new t("00.000.000-0")}],AP:[{mask:new t("000000000")}],BA:[{chars:8,mask:new t("000000-00")},{mask:new t("0000000-00")}],CE:[{mask:new t("00000000-0")}],DF:[{mask:new t("00000000000-00")}],ES:[{mask:new t("00000000-0")}],GO:[{mask:new t("00.000.000-0")}],MA:[{mask:new t("000000000")}],MG:[{mask:new t("000.000.000/0000")}],MS:[{mask:new t("000000000")}],MT:[{mask:new t("0000000000-0")}],PA:[{mask:new t("00-000000-0")}],PB:[{mask:new t("00000000-0")}],PE:[{chars:9,mask:new t("0000000-00")},{mask:new t("00.0.000.0000000-0")}],PI:[{mask:new t("000000000")}],PR:[{mask:new t("000.00000-00")}],RJ:[{mask:new t("00.000.00-0")}],RN:[{chars:9,mask:new t("00.000.000-0")},{mask:new t("00.0.000.000-0")}],RO:[{mask:new t("0000000000000-0")}],RR:[{mask:new t("00000000-0")}],RS:[{mask:new t("000/0000000")}],SC:[{mask:new t("000.000.000")}],SE:[{mask:new t("00000000-0")}],SP:[{mask:new t("000.000.000.000")},{mask:new t("-00000000.0/000")}],TO:[{mask:new t("00000000000")}]};return{restrict:"A",require:"ngModel",link:function(a,t,s,u){function o(e){return u.$isEmpty(e)?e:n(e,l)}function c(e){if(u.$isEmpty(e))return e;var a=n(e,l),t=r(a);return u.$viewValue!==a&&(u.$setViewValue(a),u.$render()),l&&"SP"===l.toUpperCase()&&/^p/i.test(e)?"P"+t:t}var l=(e(s.uiBrIeMask)(a)||"").toUpperCase();u.$formatters.push(o),u.$parsers.push(c),u.$validators.ie=function(e){return u.$isEmpty(e)||i.ie(l).validate(e)},a.$watch(s.uiBrIeMask,function(e){l=(e||"").toUpperCase(),c(u.$viewValue),u.$validate()})}}}var t=e("string-mask"),i=e("br-validations");n.$inject=["$parse"],r.exports=n},{"br-validations":void 0,"string-mask":void 0}],9:[function(e,r,a){var n=e("string-mask"),t=e("mask-factory"),i=new n("0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000");r.exports=t({clearValue:function(e){return e.replace(/[^0-9]/g,"").slice(0,44)},format:function(e){return(i.apply(e)||"").replace(/[^0-9]$/,"")},validations:{nfeAccessKey:function(e){return 44===e.length}}})},{"mask-factory":"mask-factory","string-mask":void 0}],10:[function(e,r,a){var n=e("string-mask"),t=e("mask-factory"),i=new n("(00) 0000-0000"),s=new n("(00) 00000-0000"),u=new n("0000-000-0000");r.exports=t({clearValue:function(e){return e.toString().replace(/[^0-9]/g,"").slice(0,11)},format:function(e){var r;return r=0===e.indexOf("0800")?u.apply(e):e.length<11?i.apply(e)||"":s.apply(e),r.trim().replace(/[^0-9]$/,"")},getModelValue:function(e,r){var a=this.clearValue(e);return"number"===r?parseInt(a):a},validations:{brPhoneNumber:function(e){var r=e&&e.toString().length;return 10===r||11===r}}})},{"mask-factory":"mask-factory","string-mask":void 0}],11:[function(e,r,a){function n(e){var r={"pt-br":"DD/MM/YYYY"},a=r[e.id]||"YYYY-MM-DD";return{restrict:"A",require:"ngModel",link:function(e,r,n,s){function u(e){if(s.$isEmpty(e))return e;var r=e;"object"==typeof e&&(r=t(e).format(a)),r=r.replace(/[^0-9]/g,"");var n=o.apply(r)||"";return n.trim().replace(/[^0-9]$/,"")}var o=new i(a.replace(/[YMD]/g,"0"));s.$formatters.push(u),s.$parsers.push(function(e){if(s.$isEmpty(e))return e;var r=u(e);return s.$viewValue!==r&&(s.$setViewValue(r),s.$render()),t(r,a).toDate()}),s.$validators.date=function(e,r){return s.$isEmpty(e)?!0:t(r,a).isValid()&&r.length===a.length}}}}var t=e("moment"),i=e("string-mask");n.$inject=["$locale"],r.exports=n},{moment:void 0,"string-mask":void 0}],12:[function(e,r,a){var n=angular.module("ui.utils.masks.global",[e("../helpers")]).directive("uiDateMask",e("./date/date")).directive("uiMoneyMask",e("./money/money")).directive("uiNumberMask",e("./number/number")).directive("uiPercentageMask",e("./percentage/percentage")).directive("uiScientificNotationMask",e("./scientific-notation/scientific-notation")).directive("uiTimeMask",e("./time/time"));r.exports=n.name},{"../helpers":18,"./date/date":11,"./money/money":13,"./number/number":14,"./percentage/percentage":15,"./scientific-notation/scientific-notation":16,"./time/time":17}],13:[function(e,r,a){function n(e,r,a){return{restrict:"A",require:"ngModel",link:function(n,s,u,o){function c(e){var r=e>0?m+new Array(e+1).join("0"):"",a=v+" #"+p+"##0"+r;return new t(a,{reverse:!0})}function l(e){if(o.$isEmpty(e))return e;var r=angular.isDefined(u.uiNegativeNumber)&&0>e?"-":"",n=a.prepareNumberToFormatter(e,d);return r+k.apply(n)}function f(e){if(o.$isEmpty(e))return e;var r=e.replace(/[^\d]+/g,"");r=r.replace(/^[0]+([1-9])/,"$1");var a=k.apply(r);if(angular.isDefined(u.uiNegativeNumber)){var n="-"===e[0],t="-"===e.slice(-1);t^n&&r&&(r*=-1,a="-"+a)}return e!==a&&(o.$setViewValue(a),o.$render()),a?parseInt(a.replace(/[^\d\-]+/g,""))/Math.pow(10,d):null}var m=e.NUMBER_FORMATS.DECIMAL_SEP,p=e.NUMBER_FORMATS.GROUP_SEP,v=e.NUMBER_FORMATS.CURRENCY_SYM,d=r(u.uiMoneyMask)(n);angular.isDefined(u.uiHideGroupSep)&&(p=""),isNaN(d)&&(d=2);var k=c(d);if(o.$formatters.push(l),o.$parsers.push(f),u.uiMoneyMask&&n.$watch(u.uiMoneyMask,function(e){d=isNaN(e)?2:e,k=c(d),f(o.$viewValue)}),u.min){var g;o.$validators.min=function(e){return i.minNumber(o,e,g)},n.$watch(u.min,function(e){g=e,o.$validate()})}if(u.max){var $;o.$validators.max=function(e){return i.maxNumber(o,e,$)},n.$watch(u.max,function(e){$=e,o.$validate()})}}}}var t=e("string-mask"),i=e("validators");n.$inject=["$locale","$parse","PreFormatters"],r.exports=n},{"string-mask":void 0,validators:"validators"}],14:[function(e,r,a){function n(e,r,a,n){return{restrict:"A",require:"ngModel",link:function(i,s,u,o){function c(e){if(o.$isEmpty(e))return null;var r=a.clearDelimitersAndLeadingZeros(e)||"0",n=v.apply(r),t=parseFloat(d.apply(r));if(angular.isDefined(u.uiNegativeNumber)){var i="-"===e[0],s="-"===e.slice(-1);s^i&&t&&(t*=-1,n="-"+n)}return o.$viewValue!==n&&(o.$setViewValue(n),o.$render()),t}function l(e){if(o.$isEmpty(e))return e;var r=angular.isDefined(u.uiNegativeNumber)&&0>e?"-":"",n=a.prepareNumberToFormatter(e,p);return r+v.apply(n)}var f=e.NUMBER_FORMATS.DECIMAL_SEP,m=e.NUMBER_FORMATS.GROUP_SEP,p=r(u.uiNumberMask)(i);angular.isDefined(u.uiHideGroupSep)&&(m=""),isNaN(p)&&(p=2);var v=n.viewMask(p,f,m),d=n.modelMask(p);if(o.$formatters.push(l),o.$parsers.push(c),u.uiNumberMask&&i.$watch(u.uiNumberMask,function(e){p=isNaN(e)?2:e,v=n.viewMask(p,f,m),d=n.modelMask(p),c(o.$viewValue)}),u.min){var k;o.$validators.min=function(e){return t.minNumber(o,e,k)},i.$watch(u.min,function(e){k=e,o.$validate()})}if(u.max){var g;o.$validators.max=function(e){return t.maxNumber(o,e,g)},i.$watch(u.max,function(e){g=e,o.$validate()})}}}}var t=e("validators");n.$inject=["$locale","$parse","PreFormatters","NumberMasks"],r.exports=n},{validators:"validators"}],15:[function(e,r,a){function n(e,r,a,n){function i(e,r,n){return a.clearDelimitersAndLeadingZeros((parseFloat(e)*n).toFixed(r))}return{restrict:"A",require:"ngModel",link:function(r,s,u,o){function c(e){if(o.$isEmpty(e))return e;var r=i(e,p,v.multiplier);return k.apply(r)+" %"}function l(e){if(o.$isEmpty(e))return null;var r=a.clearDelimitersAndLeadingZeros(e)||"0";e.length>1&&-1===e.indexOf("%")&&(r=r.slice(0,r.length-1));var n=k.apply(r)+" %",t=parseFloat(g.apply(r));return o.$viewValue!==n&&(o.$setViewValue(n),o.$render()),t}var f=e.NUMBER_FORMATS.DECIMAL_SEP,m=e.NUMBER_FORMATS.GROUP_SEP,p=parseInt(u.uiPercentageMask),v={multiplier:100,decimalMask:2};angular.isDefined(u.uiHideGroupSep)&&(m=""),angular.isDefined(u.uiPercentageValue)&&(v.multiplier=1,v.decimalMask=0),isNaN(p)&&(p=2);var d=p+v.decimalMask,k=n.viewMask(p,f,m),g=n.modelMask(d);if(o.$formatters.push(c),o.$parsers.push(l),u.uiPercentageMask&&r.$watch(u.uiPercentageMask,function(e){p=isNaN(e)?2:e,angular.isDefined(u.uiPercentageValue)&&(v.multiplier=1,v.decimalMask=0),d=p+v.decimalMask,k=n.viewMask(p,f,m),g=n.modelMask(d),l(o.$viewValue)}),u.min){var $;o.$validators.min=function(e){return t.minNumber(o,e,$)},r.$watch(u.min,function(e){$=e,o.$validate()})}if(u.max){var y;o.$validators.max=function(e){return t.maxNumber(o,e,y)},r.$watch(u.max,function(e){y=e,o.$validate()})}}}}var t=e("validators");n.$inject=["$locale","$parse","PreFormatters","NumberMasks"],r.exports=n},{validators:"validators"}],16:[function(e,r,a){function n(e,r){function a(e){var r="0";if(e>0){r+=n;for(var a=0;e>a;a++)r+="0"}return new t(r,{reverse:!0})}var n=e.NUMBER_FORMATS.DECIMAL_SEP,i=2;return{restrict:"A",require:"ngModel",link:function(e,t,s,u){function o(e){var r=e.toString(),a=r.match(/(-?[0-9]*)[\.]?([0-9]*)?[Ee]?([\+-]?[0-9]*)?/);return{integerPartOfSignificand:a[1],decimalPartOfSignificand:a[2],exponent:0|a[3]}}function c(e){if(u.$isEmpty(e))return e;"string"==typeof e?e=e.replace(n,"."):"number"==typeof e&&(e=e.toExponential(f));var r,a,t=o(e),i=t.integerPartOfSignificand||0,s=i.toString();angular.isDefined(t.decimalPartOfSignificand)&&(s+=t.decimalPartOfSignificand);var c=(i>=1||-1>=i)&&(angular.isDefined(t.decimalPartOfSignificand)&&t.decimalPartOfSignificand.length>f||0===f&&s.length>=2);return c&&(a=s.slice(f+1,s.length),s=s.slice(0,f+1)),r=m.apply(s),0!==t.exponent&&(a=t.exponent),angular.isDefined(a)&&(r+="e"+a),r}function l(e){if(u.$isEmpty(e))return e;var r=c(e),a=parseFloat(r.replace(n,"."));return u.$viewValue!==r&&(u.$setViewValue(r),u.$render()),a}var f=r(s.uiScientificNotationMask)(e);isNaN(f)&&(f=i);var m=a(f);u.$formatters.push(c),u.$parsers.push(l),u.$validators.max=function(e){return u.$isEmpty(e)||e<Number.MAX_VALUE}}}}var t=e("string-mask");n.$inject=["$locale","$parse"],r.exports=n},{"string-mask":void 0}],17:[function(e,r,a){var n=e("string-mask");r.exports=function(){return{restrict:"A",require:"ngModel",link:function(e,r,a,t){function i(e){if(t.$isEmpty(e))return e;var r=e.replace(/[^0-9]/g,"").slice(0,o)||"";return(c.apply(r)||"").replace(/[^0-9]$/,"")}var s="00:00:00";angular.isDefined(a.uiTimeMask)&&"short"===a.uiTimeMask&&(s="00:00");var u=s.length,o=s.replace(":","").length,c=new n(s);t.$formatters.push(i),t.$parsers.push(function(e){if(t.$isEmpty(e))return e;var r=i(e),a=r;return t.$viewValue!==r&&(t.$setViewValue(r),t.$render()),a}),t.$validators.time=function(e){if(t.$isEmpty(e))return!0;var r=e.toString().split(/:/).filter(function(e){return!!e}),a=parseInt(r[0]),n=parseInt(r[1]),i=parseInt(r[2]||0);return e.toString().length===u&&24>a&&60>n&&60>i}}}}},{"string-mask":void 0}],18:[function(e,r,a){var n=e("string-mask"),t=angular.module("ui.utils.masks.helpers",[]);r.exports=t.name,t.factory("PreFormatters",[function(){function e(e){if("0"===e)return"0";var r=e.replace(/^-/,"").replace(/^0*/,"");return r.replace(/[^0-9]/g,"")}function r(r,a){return e(parseFloat(r).toFixed(a))}return{clearDelimitersAndLeadingZeros:e,prepareNumberToFormatter:r}}]).factory("NumberValidators",[function(){return{maxNumber:function(e,r,a){var n=parseFloat(a),t=e.$isEmpty(r)||isNaN(n)||n>=r;return e.$setValidity("max",t),r},minNumber:function(e,r,a){var n=parseFloat(a),t=e.$isEmpty(r)||isNaN(n)||r>=n;return e.$setValidity("min",t),r}}}]).factory("NumberMasks",[function(){return{viewMask:function(e,r,a){var t="#"+a+"##0";if(e>0){t+=r;for(var i=0;e>i;i++)t+="0"}return new n(t,{reverse:!0})},modelMask:function(e){var r="###0";if(e>0){r+=".";for(var a=0;e>a;a++)r+="0"}return new n(r,{reverse:!0})}}}])},{"string-mask":void 0}],19:[function(e,r,a){var n=e("string-mask"),t=e("mask-factory"),i=new n("(000) 000-0000"),s=new n("+00-00-000-000000");r.exports=t({clearValue:function(e){return e.toString().replace(/[^0-9]/g,"")},format:function(e){var r;return r=e.length<11?i.apply(e)||"":s.apply(e),r.trim().replace(/[^0-9]$/,"")},validations:{usPhoneNumber:function(e){return e.length>9}}})},{"mask-factory":"mask-factory","string-mask":void 0}],20:[function(e,r,a){var n=angular.module("ui.utils.masks.us",[e("../helpers")]).directive("uiUsPhoneNumber",e("./phone/us-phone"));r.exports=n.name},{"../helpers":18,"./phone/us-phone":19}],"mask-factory":[function(e,r,a){r.exports=function(e){return function(){return{restrict:"A",require:"ngModel",link:function(r,a,n,t){t.$formatters.push(function(r){if(t.$isEmpty(r))return r;var a=e.clearValue(r);return e.format(a)}),t.$parsers.push(function(r){if(t.$isEmpty(r))return r;var a=e.clearValue(r),n=e.format(a);if(t.$viewValue!==n&&(t.$setViewValue(n),t.$render()),angular.isUndefined(e.getModelValue))return a;var i=typeof t.$modelValue;return e.getModelValue(n,i)}),angular.forEach(e.validations,function(e,r){t.$validators[r]=function(r,a){return t.$isEmpty(r)||e(r,a)}})}}}}},{}],validators:[function(e,r,a){r.exports={maxNumber:function(e,r,a){var n=parseFloat(a,10);return e.$isEmpty(r)||isNaN(n)||n>=r},minNumber:function(e,r,a){var n=parseFloat(a,10);return e.$isEmpty(r)||isNaN(n)||r>=n}}},{}]},{},[1]);