vue-currency-input
Advanced tools
Comparing version 1.14.0 to 1.14.1
/** | ||
* Vue Currency Input 1.14.0 | ||
* Vue Currency Input 1.14.1 | ||
* (c) 2019 Matthias Stiller | ||
@@ -332,27 +332,31 @@ * @license MIT | ||
var updateInputValue = function (el, value) { | ||
var ref = el.$ci; | ||
var options = ref.options; | ||
var currencyFormat = ref.currencyFormat; | ||
var previousConformedValue = ref.previousConformedValue; | ||
var formatConfig = Object.assign({}, currencyFormat); | ||
if (hideCurrencySymbolOnFocus(el)) { | ||
formatConfig.prefix = ''; | ||
formatConfig.negativePrefix = '-'; | ||
formatConfig.suffix = ''; | ||
} | ||
var ref$1 = conformToMask(value, formatConfig, options, previousConformedValue); | ||
var conformedValue = ref$1.conformedValue; | ||
var fractionDigits = ref$1.fractionDigits; | ||
if (typeof conformedValue === 'number') { | ||
var formattedValue = new Intl.NumberFormat(options.locale, { | ||
useGrouping: !hideGroupingSymbolOnFocus(el), | ||
minimumFractionDigits: hideNegligibleDecimalDigitsOnFocus(el) ? fractionDigits.replace(/0+$/, '').length : Math.min(formatConfig.minimumFractionDigits, fractionDigits.length), | ||
maximumFractionDigits: formatConfig.maximumFractionDigits | ||
}).format(Math.abs(conformedValue)); | ||
var isNegativeZero = conformedValue === 0 && (1 / conformedValue < 0); | ||
el.value = "" + (isNegativeZero || conformedValue < 0 ? formatConfig.negativePrefix : formatConfig.prefix) + formattedValue + (formatConfig.suffix); | ||
el.$ci.numberValue = conformedValue; | ||
if (value != null) { | ||
var ref = el.$ci; | ||
var options = ref.options; | ||
var currencyFormat = ref.currencyFormat; | ||
var previousConformedValue = ref.previousConformedValue; | ||
var formatConfig = Object.assign({}, currencyFormat); | ||
if (hideCurrencySymbolOnFocus(el)) { | ||
formatConfig.prefix = ''; | ||
formatConfig.negativePrefix = '-'; | ||
formatConfig.suffix = ''; | ||
} | ||
var ref$1 = conformToMask(value, formatConfig, options, previousConformedValue); | ||
var conformedValue = ref$1.conformedValue; | ||
var fractionDigits = ref$1.fractionDigits; | ||
if (typeof conformedValue === 'number') { | ||
var formattedValue = new Intl.NumberFormat(options.locale, { | ||
useGrouping: !hideGroupingSymbolOnFocus(el), | ||
minimumFractionDigits: hideNegligibleDecimalDigitsOnFocus(el) ? fractionDigits.replace(/0+$/, '').length : Math.min(formatConfig.minimumFractionDigits, fractionDigits.length), | ||
maximumFractionDigits: formatConfig.maximumFractionDigits | ||
}).format(Math.abs(conformedValue)); | ||
var isNegativeZero = conformedValue === 0 && (1 / conformedValue < 0); | ||
el.value = "" + (isNegativeZero || conformedValue < 0 ? formatConfig.negativePrefix : formatConfig.prefix) + formattedValue + (formatConfig.suffix); | ||
el.$ci.numberValue = conformedValue; | ||
} else { | ||
el.value = conformedValue; | ||
el.$ci.numberValue = parse(el.value, formatConfig, false); | ||
} | ||
} else { | ||
el.value = conformedValue; | ||
el.$ci.numberValue = parse(el.value, formatConfig, false); | ||
el.value = el.$ci.numberValue = null; | ||
} | ||
@@ -359,0 +363,0 @@ el.$ci.previousConformedValue = el.value; |
/** | ||
* Vue Currency Input 1.14.0 | ||
* Vue Currency Input 1.14.1 | ||
* (c) 2019 Matthias Stiller | ||
@@ -338,27 +338,31 @@ * @license MIT | ||
var updateInputValue = function (el, value) { | ||
var ref = el.$ci; | ||
var options = ref.options; | ||
var currencyFormat = ref.currencyFormat; | ||
var previousConformedValue = ref.previousConformedValue; | ||
var formatConfig = Object.assign({}, currencyFormat); | ||
if (hideCurrencySymbolOnFocus(el)) { | ||
formatConfig.prefix = ''; | ||
formatConfig.negativePrefix = '-'; | ||
formatConfig.suffix = ''; | ||
} | ||
var ref$1 = conformToMask(value, formatConfig, options, previousConformedValue); | ||
var conformedValue = ref$1.conformedValue; | ||
var fractionDigits = ref$1.fractionDigits; | ||
if (typeof conformedValue === 'number') { | ||
var formattedValue = new Intl.NumberFormat(options.locale, { | ||
useGrouping: !hideGroupingSymbolOnFocus(el), | ||
minimumFractionDigits: hideNegligibleDecimalDigitsOnFocus(el) ? fractionDigits.replace(/0+$/, '').length : Math.min(formatConfig.minimumFractionDigits, fractionDigits.length), | ||
maximumFractionDigits: formatConfig.maximumFractionDigits | ||
}).format(Math.abs(conformedValue)); | ||
var isNegativeZero = conformedValue === 0 && (1 / conformedValue < 0); | ||
el.value = "" + (isNegativeZero || conformedValue < 0 ? formatConfig.negativePrefix : formatConfig.prefix) + formattedValue + (formatConfig.suffix); | ||
el.$ci.numberValue = conformedValue; | ||
if (value != null) { | ||
var ref = el.$ci; | ||
var options = ref.options; | ||
var currencyFormat = ref.currencyFormat; | ||
var previousConformedValue = ref.previousConformedValue; | ||
var formatConfig = Object.assign({}, currencyFormat); | ||
if (hideCurrencySymbolOnFocus(el)) { | ||
formatConfig.prefix = ''; | ||
formatConfig.negativePrefix = '-'; | ||
formatConfig.suffix = ''; | ||
} | ||
var ref$1 = conformToMask(value, formatConfig, options, previousConformedValue); | ||
var conformedValue = ref$1.conformedValue; | ||
var fractionDigits = ref$1.fractionDigits; | ||
if (typeof conformedValue === 'number') { | ||
var formattedValue = new Intl.NumberFormat(options.locale, { | ||
useGrouping: !hideGroupingSymbolOnFocus(el), | ||
minimumFractionDigits: hideNegligibleDecimalDigitsOnFocus(el) ? fractionDigits.replace(/0+$/, '').length : Math.min(formatConfig.minimumFractionDigits, fractionDigits.length), | ||
maximumFractionDigits: formatConfig.maximumFractionDigits | ||
}).format(Math.abs(conformedValue)); | ||
var isNegativeZero = conformedValue === 0 && (1 / conformedValue < 0); | ||
el.value = "" + (isNegativeZero || conformedValue < 0 ? formatConfig.negativePrefix : formatConfig.prefix) + formattedValue + (formatConfig.suffix); | ||
el.$ci.numberValue = conformedValue; | ||
} else { | ||
el.value = conformedValue; | ||
el.$ci.numberValue = parse(el.value, formatConfig, false); | ||
} | ||
} else { | ||
el.value = conformedValue; | ||
el.$ci.numberValue = parse(el.value, formatConfig, false); | ||
el.value = el.$ci.numberValue = null; | ||
} | ||
@@ -365,0 +369,0 @@ el.$ci.previousConformedValue = el.value; |
{ | ||
"name": "vue-currency-input", | ||
"description": "Easy input of currency formatted numbers for Vue.js.", | ||
"version": "1.14.0", | ||
"version": "1.14.1", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "unpkg": "dist/vue-currency-input.umd.js", |
@@ -65,22 +65,26 @@ import Vue from 'vue' | ||
const updateInputValue = (el, value) => { | ||
const { options, currencyFormat, previousConformedValue } = el.$ci | ||
const formatConfig = { ...currencyFormat } | ||
if (hideCurrencySymbolOnFocus(el)) { | ||
formatConfig.prefix = '' | ||
formatConfig.negativePrefix = '-' | ||
formatConfig.suffix = '' | ||
} | ||
const { conformedValue, fractionDigits } = conformToMask(value, formatConfig, options, previousConformedValue) | ||
if (typeof conformedValue === 'number') { | ||
const formattedValue = new Intl.NumberFormat(options.locale, { | ||
useGrouping: !hideGroupingSymbolOnFocus(el), | ||
minimumFractionDigits: hideNegligibleDecimalDigitsOnFocus(el) ? fractionDigits.replace(/0+$/, '').length : Math.min(formatConfig.minimumFractionDigits, fractionDigits.length), | ||
maximumFractionDigits: formatConfig.maximumFractionDigits | ||
}).format(Math.abs(conformedValue)) | ||
const isNegativeZero = conformedValue === 0 && (1 / conformedValue < 0) | ||
el.value = `${isNegativeZero || conformedValue < 0 ? formatConfig.negativePrefix : formatConfig.prefix}${formattedValue}${formatConfig.suffix}` | ||
el.$ci.numberValue = conformedValue | ||
if (value != null) { | ||
const { options, currencyFormat, previousConformedValue } = el.$ci | ||
const formatConfig = { ...currencyFormat } | ||
if (hideCurrencySymbolOnFocus(el)) { | ||
formatConfig.prefix = '' | ||
formatConfig.negativePrefix = '-' | ||
formatConfig.suffix = '' | ||
} | ||
const { conformedValue, fractionDigits } = conformToMask(value, formatConfig, options, previousConformedValue) | ||
if (typeof conformedValue === 'number') { | ||
const formattedValue = new Intl.NumberFormat(options.locale, { | ||
useGrouping: !hideGroupingSymbolOnFocus(el), | ||
minimumFractionDigits: hideNegligibleDecimalDigitsOnFocus(el) ? fractionDigits.replace(/0+$/, '').length : Math.min(formatConfig.minimumFractionDigits, fractionDigits.length), | ||
maximumFractionDigits: formatConfig.maximumFractionDigits | ||
}).format(Math.abs(conformedValue)) | ||
const isNegativeZero = conformedValue === 0 && (1 / conformedValue < 0) | ||
el.value = `${isNegativeZero || conformedValue < 0 ? formatConfig.negativePrefix : formatConfig.prefix}${formattedValue}${formatConfig.suffix}` | ||
el.$ci.numberValue = conformedValue | ||
} else { | ||
el.value = conformedValue | ||
el.$ci.numberValue = parse(el.value, formatConfig, false) | ||
} | ||
} else { | ||
el.value = conformedValue | ||
el.$ci.numberValue = parse(el.value, formatConfig, false) | ||
el.value = el.$ci.numberValue = null | ||
} | ||
@@ -87,0 +91,0 @@ el.$ci.previousConformedValue = el.value |
70803
82272
1699