angular-dynamic-number
Advanced tools
Comparing version 1.1.1 to 1.1.3
{ | ||
"name": "angular-dynamic-number", | ||
"version": "1.1.1", | ||
"version": "1.1.3", | ||
"homepage": "https://github.com/uhlryk/angular-dynamic-number", | ||
@@ -5,0 +5,0 @@ "authors": [ |
{ | ||
"name": "angular-dynamic-number", | ||
"version": "1.1.1", | ||
"version": "1.1.3", | ||
"description": "Highly customizable angular directive for numbers", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -90,3 +90,5 @@ /*jslint node: true */ | ||
function changeViewValue(ngModelController, value){ | ||
ngModelController.$viewValue = value; | ||
// https://github.com/angular/angular.js/issues/13068 | ||
// ngModelController.$viewValue = value; | ||
ngModelController.$setViewValue(value); | ||
ngModelController.$render(); | ||
@@ -93,0 +95,0 @@ } |
@@ -1,1 +0,1 @@ | ||
!function(n,r,t){"use strict";function e(n,r){return","===r?String(n).replace(".",","):n}function u(n,r){return","===r?String(n).replace(",","."):n}function i(n,r){if(n>=0){var t=parseInt(n,10);if(isNaN(t)===!1&&isFinite(t)&&t>=0)return t}return r}function o(n,r){if(n>=0){var t=parseInt(n,10);if(isNaN(t)===!1&&isFinite(t)&&t>=0)return t}return r}function a(n,r){return","===n?",":"."===n?".":r}function c(n,r){return"false"===n?!1:"true"===n?!0:r}function f(n,r){return"false"===n?!1:"true"===n?!0:r}function s(n,r){return"floor"===n?Math.floor:"ceil"===n?Math.ceil:"round"===n?Math.round:r}function m(n,r,t,e,u){var i="-?";e===!1&&u===!0?i="-":e===!0&&u===!1&&(i="");var o="[0-9]{0,"+n+"}";0===n&&(o="0");var a="(\\"+t+"([0-9]){0,"+r+"})";return 0===r&&(a=""),new RegExp("^"+i+o+a+"?$")}function l(n){return n.replace(/^0+/g,"").replace(/^-00+/g,"-0").replace(/-0+\[\.,]/,"-0$&").replace(/^[\.,]/g,"0$&")}function d(n,r){n.$viewValue=r,n.$render()}function p(n,r,t,u){if(n=Number(n),!isNaN(n)&&isFinite(n)){var i=Math.pow(10,r);return e(String(u(n*i)/i),t)}return"0"}function g(){return{restrict:"A",require:"?ngModel",scope:{numInt:"@",numFract:"@",numSep:"@",numPos:"@",numNeg:"@",numRound:"@"},link:function(n,r,g,v){var h=i(n.numInt,6),w=o(n.numFract,2),N=a(n.numSep,"."),$=c(n.numPos,!0),M=f(n.numNeg,!0),b=s(n.numRound,Math.round);if($===!1&&M===!1)throw new Error("Number is set to not be positive and not be negative. Change num_pos attr or/and num_neg attr to true");var F=m(h,w,N,$,M);v.$parsers.unshift(function(n){var r=n;return r=l(r),""===r&&"0"===n.charAt(0)?(d(v,0),0):r===t||""===r?0:"-"===r?(d(v,r),0):F.test(r)===!1?(d(v,e(v.$modelValue,N)),v.$modelValue):(d(v,r),u(r,N))}),v.$formatters.push(function(n){return p(n,w,N,b)})}}}function v(){return function(n,r,t,e){var u=o(r,2),i=a(t,"."),c=s(e,Math.round);return p(n,u,i,c)}}r.module("dynamicNumber",[]).directive("awnum",g).filter("awnum",v)}(window,window.angular); | ||
!function(n,r,t){"use strict";function e(n,r){return","===r?String(n).replace(".",","):n}function u(n,r){return","===r?String(n).replace(",","."):n}function i(n,r){if(n>=0){var t=parseInt(n,10);if(isNaN(t)===!1&&isFinite(t)&&t>=0)return t}return r}function o(n,r){if(n>=0){var t=parseInt(n,10);if(isNaN(t)===!1&&isFinite(t)&&t>=0)return t}return r}function a(n,r){return","===n?",":"."===n?".":r}function c(n,r){return"false"===n?!1:"true"===n?!0:r}function f(n,r){return"false"===n?!1:"true"===n?!0:r}function s(n,r){return"floor"===n?Math.floor:"ceil"===n?Math.ceil:"round"===n?Math.round:r}function m(n,r,t,e,u){var i="-?";e===!1&&u===!0?i="-":e===!0&&u===!1&&(i="");var o="[0-9]{0,"+n+"}";0===n&&(o="0");var a="(\\"+t+"([0-9]){0,"+r+"})";return 0===r&&(a=""),new RegExp("^"+i+o+a+"?$")}function l(n){return n.replace(/^0+/g,"").replace(/^-00+/g,"-0").replace(/-0+\[\.,]/,"-0$&").replace(/^[\.,]/g,"0$&")}function d(n,r){n.$setViewValue(r),n.$render()}function p(n,r,t,u){if(n=Number(n),!isNaN(n)&&isFinite(n)){var i=Math.pow(10,r);return e(String(u(n*i)/i),t)}return"0"}function g(){return{restrict:"A",require:"?ngModel",scope:{numInt:"@",numFract:"@",numSep:"@",numPos:"@",numNeg:"@",numRound:"@"},link:function(n,r,g,v){var h=i(n.numInt,6),w=o(n.numFract,2),N=a(n.numSep,"."),$=c(n.numPos,!0),M=f(n.numNeg,!0),b=s(n.numRound,Math.round);if($===!1&&M===!1)throw new Error("Number is set to not be positive and not be negative. Change num_pos attr or/and num_neg attr to true");var F=m(h,w,N,$,M);v.$parsers.unshift(function(n){var r=n;return r=l(r),""===r&&"0"===n.charAt(0)?(d(v,0),0):r===t||""===r?0:"-"===r?(d(v,r),0):F.test(r)===!1?(d(v,e(v.$modelValue,N)),v.$modelValue):(d(v,r),u(r,N))}),v.$formatters.push(function(n){return p(n,w,N,b)})}}}function v(){return function(n,r,t,e){var u=o(r,2),i=a(t,"."),c=s(e,Math.round);return p(n,u,i,c)}}r.module("dynamicNumber",[]).directive("awnum",g).filter("awnum",v)}(window,window.angular); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14102
215