@coders-tm/vue-number-format
Advanced tools
Comparing version 3.3.1 to 3.3.3
/** | ||
* Vue Number Format 3.2.0 | ||
* (c) 2021-2022 Dipak Sarkar <hello@dipaksarkar.in> (https://dipaksarkar.in/) | ||
* (c) 2021-2023 Dipak Sarkar <hello@dipaksarkar.in> (https://dipaksarkar.in/) | ||
* @license MIT | ||
@@ -23,3 +23,3 @@ */ | ||
max: false, | ||
nullValue: '' | ||
nullValue: '', | ||
}; | ||
@@ -57,8 +57,7 @@ | ||
this.sign = () => { | ||
const hasMinus = this.input.toString().indexOf('-') >= 0; | ||
if (this.isClean) { | ||
return this.input.toString().indexOf('-') >= 0 && this.realNumber() > 0 | ||
? '-' | ||
: '' | ||
return hasMinus && this.realNumber() > 0 ? '-' : '' | ||
} | ||
return this.input.toString().indexOf('-') >= 0 ? '-' : '' | ||
return hasMinus ? '-' : '' | ||
}; | ||
@@ -160,8 +159,8 @@ | ||
return this.options.nullValue | ||
return ( | ||
this.sign() + | ||
this.options.prefix + | ||
this.addSeparator() + | ||
this.options.suffix | ||
) | ||
return [ | ||
this.sign(), | ||
this.options.prefix, | ||
this.addSeparator(), | ||
this.options.suffix, | ||
].join('') | ||
}; | ||
@@ -389,2 +388,3 @@ | ||
let newValue = target.value.replace(regExp, ''); | ||
const canNegativeInput = config.min && config.min < 0; | ||
if ( | ||
@@ -395,2 +395,4 @@ ([110, 190].includes(e.keyCode) || e.key === config.decimal) && | ||
e.preventDefault(); | ||
} else if ([109].includes(e.keyCode) && !canNegativeInput) { | ||
e.preventDefault(); | ||
} else if ([8].includes(e.keyCode)) { | ||
@@ -402,3 +404,2 @@ // check current cursor position is after separator when backspace key down | ||
e.preventDefault(); | ||
let positionFromEnd = el.value.length - el.selectionEnd; | ||
@@ -405,0 +406,0 @@ // remove separator and before character |
/** | ||
* Vue Number Format 3.2.0 | ||
* (c) 2021-2022 Dipak Sarkar <hello@dipaksarkar.in> (https://dipaksarkar.in/) | ||
* (c) 2021-2023 Dipak Sarkar <hello@dipaksarkar.in> (https://dipaksarkar.in/) | ||
* @license MIT | ||
@@ -19,3 +19,3 @@ */ | ||
max: false, | ||
nullValue: '' | ||
nullValue: '', | ||
}; | ||
@@ -53,8 +53,7 @@ | ||
this.sign = () => { | ||
const hasMinus = this.input.toString().indexOf('-') >= 0; | ||
if (this.isClean) { | ||
return this.input.toString().indexOf('-') >= 0 && this.realNumber() > 0 | ||
? '-' | ||
: '' | ||
return hasMinus && this.realNumber() > 0 ? '-' : '' | ||
} | ||
return this.input.toString().indexOf('-') >= 0 ? '-' : '' | ||
return hasMinus ? '-' : '' | ||
}; | ||
@@ -156,8 +155,8 @@ | ||
return this.options.nullValue | ||
return ( | ||
this.sign() + | ||
this.options.prefix + | ||
this.addSeparator() + | ||
this.options.suffix | ||
) | ||
return [ | ||
this.sign(), | ||
this.options.prefix, | ||
this.addSeparator(), | ||
this.options.suffix, | ||
].join('') | ||
}; | ||
@@ -385,2 +384,3 @@ | ||
let newValue = target.value.replace(regExp, ''); | ||
const canNegativeInput = config.min && config.min < 0; | ||
if ( | ||
@@ -391,2 +391,4 @@ ([110, 190].includes(e.keyCode) || e.key === config.decimal) && | ||
e.preventDefault(); | ||
} else if ([109].includes(e.keyCode) && !canNegativeInput) { | ||
e.preventDefault(); | ||
} else if ([8].includes(e.keyCode)) { | ||
@@ -398,3 +400,2 @@ // check current cursor position is after separator when backspace key down | ||
e.preventDefault(); | ||
let positionFromEnd = el.value.length - el.selectionEnd; | ||
@@ -401,0 +402,0 @@ // remove separator and before character |
/** | ||
* Vue Number Format 3.2.0 | ||
* (c) 2021-2022 Dipak Sarkar <hello@dipaksarkar.in> (https://dipaksarkar.in/) | ||
* (c) 2021-2023 Dipak Sarkar <hello@dipaksarkar.in> (https://dipaksarkar.in/) | ||
* @license MIT | ||
@@ -20,3 +20,3 @@ */ | ||
max: false, | ||
nullValue: '' | ||
nullValue: '', | ||
}; | ||
@@ -54,8 +54,7 @@ | ||
this.sign = () => { | ||
const hasMinus = this.input.toString().indexOf('-') >= 0; | ||
if (this.isClean) { | ||
return this.input.toString().indexOf('-') >= 0 && this.realNumber() > 0 | ||
? '-' | ||
: '' | ||
return hasMinus && this.realNumber() > 0 ? '-' : '' | ||
} | ||
return this.input.toString().indexOf('-') >= 0 ? '-' : '' | ||
return hasMinus ? '-' : '' | ||
}; | ||
@@ -157,8 +156,8 @@ | ||
return this.options.nullValue | ||
return ( | ||
this.sign() + | ||
this.options.prefix + | ||
this.addSeparator() + | ||
this.options.suffix | ||
) | ||
return [ | ||
this.sign(), | ||
this.options.prefix, | ||
this.addSeparator(), | ||
this.options.suffix, | ||
].join('') | ||
}; | ||
@@ -386,2 +385,3 @@ | ||
let newValue = target.value.replace(regExp, ''); | ||
const canNegativeInput = config.min && config.min < 0; | ||
if ( | ||
@@ -392,2 +392,4 @@ ([110, 190].includes(e.keyCode) || e.key === config.decimal) && | ||
e.preventDefault(); | ||
} else if ([109].includes(e.keyCode) && !canNegativeInput) { | ||
e.preventDefault(); | ||
} else if ([8].includes(e.keyCode)) { | ||
@@ -399,3 +401,2 @@ // check current cursor position is after separator when backspace key down | ||
e.preventDefault(); | ||
let positionFromEnd = el.value.length - el.selectionEnd; | ||
@@ -402,0 +403,0 @@ // remove separator and before character |
{ | ||
"name": "@coders-tm/vue-number-format", | ||
"version": "3.3.1", | ||
"version": "3.3.3", | ||
"private": false, | ||
@@ -64,7 +64,8 @@ "description": "Easy formatted numbers, currency and percentage with input/directive mask for Vue.js", | ||
"core-js": "^3.6.5", | ||
"eslint": "^7.32.0", | ||
"eslint": "^8.33.0", | ||
"eslint-plugin-import": "^2.24.2", | ||
"eslint-plugin-vue": "^7.18.0", | ||
"eslint-plugin-vue": "^9.9.0", | ||
"jest": "^27.2.0", | ||
"prettier-config-vuepress": "^1.4.0", | ||
"prettier": "2.8.3", | ||
"prettier-config-vuepress": "^4.0.0", | ||
"rollup": "^2.79.0", | ||
@@ -71,0 +72,0 @@ "rollup-plugin-filesize": "^9.1.1", |
56393
1508
27