vue-currency-input
Advanced tools
Comparing version 1.17.1 to 1.17.2
/** | ||
* Vue Currency Input 1.17.1 | ||
* Vue Currency Input 1.17.2 | ||
* (c) 2020 Matthias Stiller | ||
@@ -222,4 +222,2 @@ * @license MIT | ||
if ( previousConformedValue === void 0 ) previousConformedValue = ''; | ||
if ( hideCurrencySymbol === void 0 ) hideCurrencySymbol = false; | ||
if ( autoDecimalMode === void 0 ) autoDecimalMode = false; | ||
if ( allowNegative === void 0 ) allowNegative = true; | ||
@@ -231,3 +229,3 @@ if (typeof str === 'string') { | ||
} | ||
var negative = isNegative(value); | ||
var negative = startsWith(str, currencyFormat.negativePrefix) || isNegative(value); | ||
if (negative) { | ||
@@ -234,0 +232,0 @@ value = value.substring(1); |
/** | ||
* Vue Currency Input 1.17.1 | ||
* Vue Currency Input 1.17.2 | ||
* (c) 2020 Matthias Stiller | ||
@@ -228,4 +228,2 @@ * @license MIT | ||
if ( previousConformedValue === void 0 ) previousConformedValue = ''; | ||
if ( hideCurrencySymbol === void 0 ) hideCurrencySymbol = false; | ||
if ( autoDecimalMode === void 0 ) autoDecimalMode = false; | ||
if ( allowNegative === void 0 ) allowNegative = true; | ||
@@ -237,3 +235,3 @@ if (typeof str === 'string') { | ||
} | ||
var negative = isNegative(value); | ||
var negative = startsWith(str, currencyFormat.negativePrefix) || isNegative(value); | ||
if (negative) { | ||
@@ -240,0 +238,0 @@ value = value.substring(1); |
{ | ||
"name": "vue-currency-input", | ||
"description": "Easy input of currency formatted numbers for Vue.js.", | ||
"version": "1.17.1", | ||
"version": "1.17.2", | ||
"license": "MIT", | ||
@@ -65,3 +65,6 @@ "unpkg": "dist/vue-currency-input.umd.js", | ||
"vuetify": "^2.1.15" | ||
}, | ||
"engines": { | ||
"node": ">=13" | ||
} | ||
} |
@@ -16,8 +16,9 @@ [](https://travis-ci.com/dm4t2/vue-currency-input) | ||
* Format as you type | ||
* Locale dependent, ISO-compliant currency formatting | ||
* Locale dependent, ISO-compliant currency formatting based on [Intl.NumberFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat) | ||
* Distraction free (hides the formatting on focus for easier input) | ||
* Customizable currency symbols and precision ranges | ||
* Allows handling values as integer numbers for full precision | ||
* Auto decimal mode (automatically inserts the decimal symbol, using the last inputted digits as decimal digits) | ||
* Built-in value range validation | ||
* Works with input components of popular frameworks like [Vuetify](https://vuetifyjs.com/en/components/text-fields) or [Element](https://element.eleme.io/#/en-US/component/input)) | ||
* Supports IE 11 (sadly it's not a feature 🤮) | ||
* Works with input components of popular frameworks like [Vuetify](https://vuetifyjs.com/en/components/text-fields) or [Element](https://element.eleme.io/#/en-US/component/input) | ||
* Supports all major browsers (including IE 11) | ||
@@ -24,0 +25,0 @@ ## Live Demo |
@@ -54,4 +54,4 @@ import { Component, DirectiveOptions, PluginFunction } from 'vue' | ||
interface Vue { | ||
$parseCurrency (formattedValue: string, options: CurrencyInputOptions): number | ||
$parseCurrency (formattedValue: string, options?: CurrencyInputOptions): number | ||
} | ||
} |
@@ -39,3 +39,3 @@ import { endsWith, insertCurrencySymbol, isNegative, isNumber, onlyDigits, removeLeadingZeros, startsWith, stripCurrencySymbol } from './stringUtils' | ||
export default (str, currencyFormat, previousConformedValue = '', hideCurrencySymbol = false, autoDecimalMode = false, allowNegative = true) => { | ||
export default (str, currencyFormat, previousConformedValue = '', hideCurrencySymbol, autoDecimalMode, allowNegative = true) => { | ||
if (typeof str === 'string') { | ||
@@ -47,3 +47,3 @@ let value = stripCurrencySymbol(str, currencyFormat) | ||
let negative = isNegative(value) | ||
let negative = startsWith(str, currencyFormat.negativePrefix) || isNegative(value) | ||
if (negative) { | ||
@@ -50,0 +50,0 @@ value = value.substring(1) |
76325
63
1733