-
Notifications
You must be signed in to change notification settings - Fork 38
/
angular-input-masks.ch.min.js
1 lines (1 loc) · 11.7 KB
/
angular-input-masks.ch.min.js
1
require=function e(r,i,t){function n(u,s){if(!i[u]){if(!r[u]){var o="function"==typeof require&&require;if(!s&&o)return o(u,!0);if(a)return a(u,!0);var c=new Error("Cannot find module '"+u+"'");throw c.code="MODULE_NOT_FOUND",c}var l=i[u]={exports:{}};r[u][0].call(l.exports,function(e){var i=r[u][1][e];return n(i?i:e)},l,l.exports,e,r,i,t)}return i[u].exports}for(var a="function"==typeof require&&require,u=0;u<t.length;u++)n(t[u]);return n}({1:[function(e,r,i){"use strict";r.exports=angular.module("ui.utils.masks",[e("./global/global-masks"),e("./ch/ch-masks")]).name},{"./ch/ch-masks":2,"./global/global-masks":6}],2:[function(e,r,i){"use strict";var t=angular.module("ui.utils.masks.ch",[e("../helpers")]).directive("uiChPhoneNumber",e("./phone/ch-phone"));r.exports=t.name},{"../helpers":12,"./phone/ch-phone":3}],3:[function(e,r,i){"use strict";var t=e("string-mask"),n=e("mask-factory"),a=new t("+00 00 000 00 00");r.exports=n({clearValue:function(e){return e.toString().replace(/[^0-9]/g,"").slice(0,11)},format:function(e){var r;return r=a.apply(e)||"",r.trim().replace(/[^0-9]$/,"")},validations:{chPhoneNumber:function(e){var r=e&&e.toString().length;return 11===r}}})},{"mask-factory":"mask-factory","string-mask":void 0}],4:[function(e,r,i){"use strict";var t=e("string-mask"),n=e("mask-factory"),a=16,u=new t("0000 0000 0000 0000");r.exports=n({clearValue:function(e){return e.toString().replace(/[^0-9]/g,"").slice(0,a)},format:function(e){var r;return r=u.apply(e)||"",r.trim().replace(/[^0-9]$/,"")},validations:{creditCard:function(e){var r=e&&e.toString().length;return r===a}}})},{"mask-factory":"mask-factory","string-mask":void 0}],5:[function(e,r,i){"use strict";function t(e){return/^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}([-+][0-9]{2}:[0-9]{2}|Z)$/.test(e.toString())}function n(e){var r={"pt-br":"DD/MM/YYYY",ru:"DD.MM.YYYY"},i=r[e.id]||"YYYY-MM-DD";return{restrict:"A",require:"ngModel",link:function(e,r,n,s){function o(e){if(s.$isEmpty(e))return e;var r=e;("object"==typeof e||t(e))&&(r=a(e).format(i)),r=r.replace(/[^0-9]/g,"");var n=c.apply(r)||"";return n.trim().replace(/[^0-9]$/,"")}n.parse=n.parse||"true",i=n.uiDateMask||i;var c=new u(i.replace(/[YMD]/g,"0"));s.$formatters.push(o),s.$parsers.push(function(e){if(s.$isEmpty(e))return e;var r=o(e);return s.$viewValue!==r&&(s.$setViewValue(r),s.$render()),"false"===n.parse?r:a(r,i).toDate()}),s.$validators.date=function(e,r){return!!s.$isEmpty(e)||a(r,i).isValid()&&r.length===i.length}}}}var a=e("moment"),u=e("string-mask");n.$inject=["$locale"],r.exports=n},{moment:void 0,"string-mask":void 0}],6:[function(e,r,i){"use strict";var t=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")).directive("uiCreditCard",e("./credit-card/credit-card"));r.exports=t.name},{"../helpers":12,"./credit-card/credit-card":4,"./date/date":5,"./money/money":7,"./number/number":8,"./percentage/percentage":9,"./scientific-notation/scientific-notation":10,"./time/time":11}],7:[function(e,r,i){"use strict";function t(e,r,i){return{restrict:"A",require:"ngModel",link:function(t,u,s,o){function c(e){var r=e>0?m+new Array(e+1).join("0"):"",i="#"+p+"##0"+r;return angular.isDefined(s.uiCurrencyAfter)?i+=v:i=v+i,new n(i,{reverse:!0})}function l(e){if(o.$isEmpty(e))return e;var r=angular.isDefined(s.uiNegativeNumber)&&e<0?"-":"",t=i.prepareNumberToFormatter(e,g);return angular.isDefined(s.uiCurrencyAfter)?r+M.apply(t)+d:r+d+M.apply(t)}function f(e){if(o.$isEmpty(e))return e;var r,i=e.replace(/[^\d]+/g,"");if(i=i.replace(/^[0]+([1-9])/,"$1"),i=i||"0",$&&angular.isDefined(s.uiCurrencyAfter)&&0!==i&&(i=i.substring(0,i.length-1),$=!1),r=angular.isDefined(s.uiCurrencyAfter)?M.apply(i)+d:d+M.apply(i),angular.isDefined(s.uiNegativeNumber)){var t="-"===e[0],n="-"===e.slice(-1);n^t&&i&&(i*=-1,r="-"+r)}return e!==r&&(o.$setViewValue(r),o.$render()),r?parseInt(r.replace(/[^\d\-]+/g,""))/Math.pow(10,g):null}var m=e.NUMBER_FORMATS.DECIMAL_SEP,p=e.NUMBER_FORMATS.GROUP_SEP,d=e.NUMBER_FORMATS.CURRENCY_SYM,v=" ",g=r(s.uiMoneyMask)(t),$=!1;u.bind("keydown keypress",function(e){$=8===e.which}),angular.isDefined(s.uiDecimalDelimiter)&&(m=s.uiDecimalDelimiter),angular.isDefined(s.uiThousandsDelimiter)&&(p=s.uiThousandsDelimiter),angular.isDefined(s.uiHideGroupSep)&&(p=""),angular.isDefined(s.uiHideSpace)&&(v=""),angular.isDefined(s.currencySymbol)&&(d=s.currencySymbol,0===s.currencySymbol.length&&(v="")),isNaN(g)&&(g=2),g=parseInt(g);var M=c(g);if(o.$formatters.push(l),o.$parsers.push(f),s.uiMoneyMask&&t.$watch(s.uiMoneyMask,function(e){g=isNaN(e)?2:e,g=parseInt(g),M=c(g),f(o.$viewValue)}),s.min){var k;o.$validators.min=function(e){return a.minNumber(o,e,k)},t.$watch(s.min,function(e){k=e,o.$validate()})}if(s.max){var y;o.$validators.max=function(e){return a.maxNumber(o,e,y)},t.$watch(s.max,function(e){y=e,o.$validate()})}}}}var n=e("string-mask"),a=e("validators");t.$inject=["$locale","$parse","PreFormatters"],r.exports=t},{"string-mask":void 0,validators:"validators"}],8:[function(e,r,i){"use strict";function t(e,r,i,t){return{restrict:"A",require:"ngModel",link:function(a,u,s,o){function c(e){if(o.$isEmpty(e))return null;var r=i.clearDelimitersAndLeadingZeros(e)||"0",t=v.apply(r),n=parseFloat(g.apply(r));if(angular.isDefined(s.uiNegativeNumber)){var a="-"===e[0],u="-"===e.slice(-1);(u^a||"-"===e)&&(n*=-1,t="-"+(0!==n?t:""))}return o.$viewValue!==t&&(o.$setViewValue(t),o.$render()),n}function l(e){if(o.$isEmpty(e))return e;var r=angular.isDefined(s.uiNegativeNumber)&&e<0?"-":"",t=i.prepareNumberToFormatter(e,d);return r+v.apply(t)}function f(){"-"===o.$viewValue&&(o.$setViewValue(""),o.$render())}var m=e.NUMBER_FORMATS.DECIMAL_SEP,p=e.NUMBER_FORMATS.GROUP_SEP,d=r(s.uiNumberMask)(a);angular.isDefined(s.uiHideGroupSep)&&(p=""),isNaN(d)&&(d=2);var v=t.viewMask(d,m,p),g=t.modelMask(d);if(u.on("blur",f),o.$formatters.push(l),o.$parsers.push(c),s.uiNumberMask&&a.$watch(s.uiNumberMask,function(e){d=isNaN(e)?2:e,v=t.viewMask(d,m,p),g=t.modelMask(d),c(o.$viewValue)}),s.min){var $;o.$validators.min=function(e){return n.minNumber(o,e,$)},a.$watch(s.min,function(e){$=e,o.$validate()})}if(s.max){var M;o.$validators.max=function(e){return n.maxNumber(o,e,M)},a.$watch(s.max,function(e){M=e,o.$validate()})}}}}var n=e("validators");t.$inject=["$locale","$parse","PreFormatters","NumberMasks"],r.exports=t},{validators:"validators"}],9:[function(e,r,i){"use strict";function t(e,r,i,t){function a(e,r,t){return i.clearDelimitersAndLeadingZeros((parseFloat(e)*t).toFixed(r))}return{restrict:"A",require:"ngModel",link:function(r,u,s,o){function c(e){if(o.$isEmpty(e))return e;var r=a(e,p,g.multiplier);return M.apply(r)+(d?"%":" %")}function l(e){if(o.$isEmpty(e))return null;var r=i.clearDelimitersAndLeadingZeros(e)||"0";e.length>1&&e.indexOf("%")===-1&&(r=r.slice(0,r.length-1)),v&&1===e.length&&"%"!==e&&(r="0");var t=d?"%":" %",n=M.apply(r)+t,a=parseFloat(k.apply(r));return o.$viewValue!==n&&(o.$setViewValue(n),o.$render()),a}var f=e.NUMBER_FORMATS.DECIMAL_SEP,m=e.NUMBER_FORMATS.GROUP_SEP,p=parseInt(s.uiPercentageMask),d=!1,v=!1;u.bind("keydown keypress",function(e){v=8===e.which});var g={multiplier:100,decimalMask:2};angular.isDefined(s.uiHideGroupSep)&&(m=""),angular.isDefined(s.uiHideSpace)&&(d=!0),angular.isDefined(s.uiPercentageValue)&&(g.multiplier=1,g.decimalMask=0),isNaN(p)&&(p=2);var $=p+g.decimalMask,M=t.viewMask(p,f,m),k=t.modelMask($);if(o.$formatters.push(c),o.$parsers.push(l),s.uiPercentageMask&&r.$watch(s.uiPercentageMask,function(e){p=isNaN(e)?2:e,angular.isDefined(s.uiPercentageValue)&&(g.multiplier=1,g.decimalMask=0),$=p+g.decimalMask,M=t.viewMask(p,f,m),k=t.modelMask($),l(o.$viewValue)}),s.min){var y;o.$validators.min=function(e){return n.minNumber(o,e,y)},r.$watch(s.min,function(e){y=e,o.$validate()})}if(s.max){var h;o.$validators.max=function(e){return n.maxNumber(o,e,h)},r.$watch(s.max,function(e){h=e,o.$validate()})}}}}var n=e("validators");t.$inject=["$locale","$parse","PreFormatters","NumberMasks"],r.exports=t},{validators:"validators"}],10:[function(e,r,i){"use strict";function t(e,r){function i(e){var r="0";if(e>0){r+=t;for(var i=0;i<e;i++)r+="0"}return new n(r,{reverse:!0})}var t=e.NUMBER_FORMATS.DECIMAL_SEP,a=2;return{restrict:"A",require:"ngModel",link:function(e,n,u,s){function o(e){var r=e.toString(),i=r.match(/(-?[0-9]*)[\.]?([0-9]*)?[Ee]?([\+-]?[0-9]*)?/);return{integerPartOfSignificand:i[1],decimalPartOfSignificand:i[2],exponent:0|i[3]}}function c(e){if(s.$isEmpty(e))return e;"string"==typeof e?e=e.replace(t,"."):"number"==typeof e&&(e=e.toExponential(f));var r,i,n=o(e),a=n.integerPartOfSignificand||0,u=a.toString();angular.isDefined(n.decimalPartOfSignificand)&&(u+=n.decimalPartOfSignificand);var c=(a>=1||a<=-1)&&(angular.isDefined(n.decimalPartOfSignificand)&&n.decimalPartOfSignificand.length>f||0===f&&u.length>=2);return c&&(i=u.slice(f+1,u.length),u=u.slice(0,f+1)),r=m.apply(u),0!==n.exponent&&(i=n.exponent),angular.isDefined(i)&&(r+="e"+i),r}function l(e){if(s.$isEmpty(e))return e;var r=c(e),i=parseFloat(r.replace(t,"."));return s.$viewValue!==r&&(s.$setViewValue(r),s.$render()),i}var f=r(u.uiScientificNotationMask)(e);isNaN(f)&&(f=a);var m=i(f);s.$formatters.push(c),s.$parsers.push(l),s.$validators.max=function(e){return s.$isEmpty(e)||e<Number.MAX_VALUE}}}}var n=e("string-mask");t.$inject=["$locale","$parse"],r.exports=t},{"string-mask":void 0}],11:[function(e,r,i){"use strict";var t=e("string-mask");r.exports=function(){return{restrict:"A",require:"ngModel",link:function(e,r,i,n){function a(e){if(n.$isEmpty(e))return e;var r=e.replace(/[^0-9]/g,"").slice(0,o)||"";return(c.apply(r)||"").replace(/[^0-9]$/,"")}var u="00:00:00";angular.isDefined(i.uiTimeMask)&&"short"===i.uiTimeMask&&(u="00:00");var s=u.length,o=u.replace(":","").length,c=new t(u);n.$formatters.push(a),n.$parsers.push(function(e){if(n.$isEmpty(e))return e;var r=a(e),i=r;return n.$viewValue!==r&&(n.$setViewValue(r),n.$render()),i}),n.$validators.time=function(e){if(n.$isEmpty(e))return!0;var r=e.toString().split(/:/).filter(function(e){return!!e}),i=parseInt(r[0]),t=parseInt(r[1]),a=parseInt(r[2]||0);return e.toString().length===s&&i<24&&t<60&&a<60}}}}},{"string-mask":void 0}],12:[function(e,r,i){"use strict";var t=e("string-mask"),n=angular.module("ui.utils.masks.helpers",[]);r.exports=n.name,n.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,i){return e(parseFloat(r).toFixed(i))}return{clearDelimitersAndLeadingZeros:e,prepareNumberToFormatter:r}}]).factory("NumberMasks",[function(){return{viewMask:function(e,r,i){var n="#"+i+"##0";if(e>0){n+=r;for(var a=0;a<e;a++)n+="0"}return new t(n,{reverse:!0})},modelMask:function(e){var r="###0";if(e>0){r+=".";for(var i=0;i<e;i++)r+="0"}return new t(r,{reverse:!0})}}}])},{"string-mask":void 0}],"mask-factory":[function(e,r,i){"use strict";r.exports=function(e){return function(){return{restrict:"A",require:"ngModel",link:function(r,i,t,n){n.$formatters.push(function(r){if(n.$isEmpty(r))return r;var i=e.clearValue(r);return e.format(i)}),n.$parsers.push(function(r){if(n.$isEmpty(r))return r;var i=e.clearValue(r),t=e.format(i);if(n.$viewValue!==t&&(n.$setViewValue(t),n.$render()),angular.isUndefined(e.getModelValue))return i;var a=typeof n.$modelValue;return e.getModelValue(t,a)}),angular.forEach(e.validations,function(e,r){n.$validators[r]=function(r,i){return n.$isEmpty(r)||e(r,i)}})}}}}},{}],validators:[function(e,r,i){"use strict";r.exports={maxNumber:function(e,r,i){var t=parseFloat(i,10);return e.$isEmpty(r)||isNaN(t)||r<=t},minNumber:function(e,r,i){var t=parseFloat(i,10);return e.$isEmpty(r)||isNaN(t)||r>=t}}},{}]},{},[1]);