vue-currency-input
Advanced tools
Comparing version 2.0.1 to 2.0.2
/** | ||
* Vue Currency Input 2.0.1 | ||
* Vue Currency Input 2.0.2 | ||
* (c) 2018-2021 Matthias Stiller | ||
@@ -37,14 +37,2 @@ * @license MIT | ||
class CurrencyFormat { | ||
locale; | ||
currency; | ||
currencyDisplay; | ||
digits; | ||
decimalSymbol; | ||
groupingSymbol; | ||
minusSymbol; | ||
minimumFractionDigits; | ||
maximumFractionDigits; | ||
prefix; | ||
negativePrefix; | ||
suffix; | ||
constructor(options) { | ||
@@ -159,3 +147,2 @@ const { currency, currencyDisplay, locale, precision } = options; | ||
class AbstractInputMask { | ||
currencyFormat; | ||
constructor(currencyFormat) { | ||
@@ -241,12 +228,2 @@ this.currencyFormat = currencyFormat; | ||
class CurrencyInput { | ||
el; | ||
options; | ||
numberValue; | ||
currencyFormat; | ||
decimalSymbolInsertedAt; | ||
numberMask; | ||
formattedValue; | ||
focus; | ||
minValue; | ||
maxValue; | ||
constructor(el, options) { | ||
@@ -294,5 +271,6 @@ this.el = el; | ||
getMinValue() { | ||
var _a, _b; | ||
let min = this.toFloat(-Number.MAX_SAFE_INTEGER); | ||
if (this.options.valueRange?.min !== undefined) { | ||
min = Math.max(this.options.valueRange?.min, this.toFloat(-Number.MAX_SAFE_INTEGER)); | ||
if (((_a = this.options.valueRange) === null || _a === void 0 ? void 0 : _a.min) !== undefined) { | ||
min = Math.max((_b = this.options.valueRange) === null || _b === void 0 ? void 0 : _b.min, this.toFloat(-Number.MAX_SAFE_INTEGER)); | ||
} | ||
@@ -305,5 +283,6 @@ if (!this.options.autoSign && min < 0) { | ||
getMaxValue() { | ||
var _a, _b; | ||
let max = this.toFloat(Number.MAX_SAFE_INTEGER); | ||
if (this.options.valueRange?.max !== undefined) { | ||
max = Math.min(this.options.valueRange?.max, this.toFloat(Number.MAX_SAFE_INTEGER)); | ||
if (((_a = this.options.valueRange) === null || _a === void 0 ? void 0 : _a.max) !== undefined) { | ||
max = Math.min((_b = this.options.valueRange) === null || _b === void 0 ? void 0 : _b.max, this.toFloat(Number.MAX_SAFE_INTEGER)); | ||
} | ||
@@ -473,2 +452,3 @@ if (!this.options.autoSign && max < 0) { | ||
var useCurrencyInput = (options) => { | ||
var _a, _b; | ||
let numberInput, input; | ||
@@ -481,8 +461,8 @@ const inputRef = vueDemi.ref(null); | ||
} | ||
const emit = (event, value) => (vueDemi.isVue3 ? instance.emit(event, value) : instance.proxy?.$emit(event, value)); | ||
const lazyModel = vueDemi.isVue3 && instance.attrs.modelModifiers?.lazy; | ||
const emit = (event, value) => { var _a; return (vueDemi.isVue3 ? instance.emit(event, value) : (_a = instance.proxy) === null || _a === void 0 ? void 0 : _a.$emit(event, value)); }; | ||
const lazyModel = vueDemi.isVue3 && ((_a = instance.attrs.modelModifiers) === null || _a === void 0 ? void 0 : _a.lazy); | ||
const numberValue = vueDemi.computed(() => (vueDemi.isVue3 ? instance.props.modelValue : instance.props.value)); | ||
const inputEvent = vueDemi.isVue3 ? 'update:modelValue' : 'input'; | ||
const changeEvent = vueDemi.isVue3 && lazyModel ? 'update:modelValue' : 'change'; | ||
const hasInputEventListener = vueDemi.isVue3 ? !!instance.attrs['onUpdate:modelValue'] && !lazyModel : !!instance.proxy?.$listeners[inputEvent]; | ||
const hasInputEventListener = vueDemi.isVue3 ? !!instance.attrs['onUpdate:modelValue'] && !lazyModel : !!((_b = instance.proxy) === null || _b === void 0 ? void 0 : _b.$listeners[inputEvent]); | ||
const hasChangeEventListener = vueDemi.isVue3 ? lazyModel || !!instance.attrs.onChange : !!instance.proxy.$listeners[changeEvent]; | ||
@@ -538,1 +518,2 @@ const onInput = (e) => { | ||
exports['default'] = useCurrencyInput; | ||
exports.useCurrencyInput = useCurrencyInput; |
@@ -41,2 +41,2 @@ import { Ref } from 'vue-demi'; | ||
export { CurrencyDisplay, CurrencyInputOptions, CurrencyInputValue, NumberRange, UseCurrencyInput, _default as default }; | ||
export { CurrencyDisplay, CurrencyInputOptions, CurrencyInputValue, NumberRange, UseCurrencyInput, _default as default, _default as useCurrencyInput }; |
/** | ||
* Vue Currency Input 2.0.1 | ||
* Vue Currency Input 2.0.2 | ||
* (c) 2018-2021 Matthias Stiller | ||
@@ -33,14 +33,2 @@ * @license MIT | ||
class CurrencyFormat { | ||
locale; | ||
currency; | ||
currencyDisplay; | ||
digits; | ||
decimalSymbol; | ||
groupingSymbol; | ||
minusSymbol; | ||
minimumFractionDigits; | ||
maximumFractionDigits; | ||
prefix; | ||
negativePrefix; | ||
suffix; | ||
constructor(options) { | ||
@@ -155,3 +143,2 @@ const { currency, currencyDisplay, locale, precision } = options; | ||
class AbstractInputMask { | ||
currencyFormat; | ||
constructor(currencyFormat) { | ||
@@ -237,12 +224,2 @@ this.currencyFormat = currencyFormat; | ||
class CurrencyInput { | ||
el; | ||
options; | ||
numberValue; | ||
currencyFormat; | ||
decimalSymbolInsertedAt; | ||
numberMask; | ||
formattedValue; | ||
focus; | ||
minValue; | ||
maxValue; | ||
constructor(el, options) { | ||
@@ -290,5 +267,6 @@ this.el = el; | ||
getMinValue() { | ||
var _a, _b; | ||
let min = this.toFloat(-Number.MAX_SAFE_INTEGER); | ||
if (this.options.valueRange?.min !== undefined) { | ||
min = Math.max(this.options.valueRange?.min, this.toFloat(-Number.MAX_SAFE_INTEGER)); | ||
if (((_a = this.options.valueRange) === null || _a === void 0 ? void 0 : _a.min) !== undefined) { | ||
min = Math.max((_b = this.options.valueRange) === null || _b === void 0 ? void 0 : _b.min, this.toFloat(-Number.MAX_SAFE_INTEGER)); | ||
} | ||
@@ -301,5 +279,6 @@ if (!this.options.autoSign && min < 0) { | ||
getMaxValue() { | ||
var _a, _b; | ||
let max = this.toFloat(Number.MAX_SAFE_INTEGER); | ||
if (this.options.valueRange?.max !== undefined) { | ||
max = Math.min(this.options.valueRange?.max, this.toFloat(Number.MAX_SAFE_INTEGER)); | ||
if (((_a = this.options.valueRange) === null || _a === void 0 ? void 0 : _a.max) !== undefined) { | ||
max = Math.min((_b = this.options.valueRange) === null || _b === void 0 ? void 0 : _b.max, this.toFloat(Number.MAX_SAFE_INTEGER)); | ||
} | ||
@@ -469,2 +448,3 @@ if (!this.options.autoSign && max < 0) { | ||
var useCurrencyInput = (options) => { | ||
var _a, _b; | ||
let numberInput, input; | ||
@@ -477,8 +457,8 @@ const inputRef = ref(null); | ||
} | ||
const emit = (event, value) => (isVue3 ? instance.emit(event, value) : instance.proxy?.$emit(event, value)); | ||
const lazyModel = isVue3 && instance.attrs.modelModifiers?.lazy; | ||
const emit = (event, value) => { var _a; return (isVue3 ? instance.emit(event, value) : (_a = instance.proxy) === null || _a === void 0 ? void 0 : _a.$emit(event, value)); }; | ||
const lazyModel = isVue3 && ((_a = instance.attrs.modelModifiers) === null || _a === void 0 ? void 0 : _a.lazy); | ||
const numberValue = computed(() => (isVue3 ? instance.props.modelValue : instance.props.value)); | ||
const inputEvent = isVue3 ? 'update:modelValue' : 'input'; | ||
const changeEvent = isVue3 && lazyModel ? 'update:modelValue' : 'change'; | ||
const hasInputEventListener = isVue3 ? !!instance.attrs['onUpdate:modelValue'] && !lazyModel : !!instance.proxy?.$listeners[inputEvent]; | ||
const hasInputEventListener = isVue3 ? !!instance.attrs['onUpdate:modelValue'] && !lazyModel : !!((_b = instance.proxy) === null || _b === void 0 ? void 0 : _b.$listeners[inputEvent]); | ||
const hasChangeEventListener = isVue3 ? lazyModel || !!instance.attrs.onChange : !!instance.proxy.$listeners[changeEvent]; | ||
@@ -533,2 +513,2 @@ const onInput = (e) => { | ||
export { CurrencyDisplay, useCurrencyInput as default }; | ||
export { CurrencyDisplay, useCurrencyInput as default, useCurrencyInput }; |
{ | ||
"name": "vue-currency-input", | ||
"description": "Easy input of currency formatted numbers for Vue.js.", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"license": "MIT", | ||
"unpkg": "./dist/index.iife.js", | ||
"jsdelivr": "./dist/index.iife.js", | ||
"module": "./dist/index.esm.js", | ||
@@ -9,0 +7,0 @@ "main": "./dist/index.cjs.js", |
53634
6
1039