@tagplus/components 4.0.1 → 4.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tp.common.js +1 -1
- package/dist/tp.common.js.map +1 -1
- package/dist/tp.umd.js +1 -1
- package/dist/tp.umd.js.map +1 -1
- package/dist/tp.umd.min.js +1 -1
- package/dist/tp.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Steps/Steps.vue +0 -1
- package/src/mixins/floatFormatter.js +7 -7
- package/src/utils/currency.js +2 -2
package/package.json
CHANGED
|
@@ -16,9 +16,9 @@ export default {
|
|
|
16
16
|
default: false
|
|
17
17
|
},
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
type:
|
|
21
|
-
default:
|
|
19
|
+
customPrecision: {
|
|
20
|
+
type: Number,
|
|
21
|
+
default: 2
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
|
|
@@ -33,21 +33,21 @@ export default {
|
|
|
33
33
|
immediate: true,
|
|
34
34
|
handler (newValue, oldValue) {
|
|
35
35
|
if (newValue === '' && this.allowEmpty) { this.formattedValue = ''; return }
|
|
36
|
-
this.formattedValue = formatMoney(newValue, true, this.locale, this.
|
|
36
|
+
this.formattedValue = formatMoney(newValue, true, this.locale, this.customPrecision)
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
|
|
41
41
|
methods: {
|
|
42
42
|
input (evt) {
|
|
43
|
-
this.formattedValue = formatMoney(evt, true, this.locale, this.
|
|
44
|
-
const moneyFormatado = formatMoney(evt, false, this.locale, this.
|
|
43
|
+
this.formattedValue = formatMoney(evt, true, this.locale, this.customPrecision)
|
|
44
|
+
const moneyFormatado = formatMoney(evt, false, this.locale, this.customPrecision)
|
|
45
45
|
|
|
46
46
|
this.$emit('input', moneyFormatado)
|
|
47
47
|
},
|
|
48
48
|
|
|
49
49
|
handleChange (evt) {
|
|
50
|
-
this.$emit('change', formatMoney(evt, false, this.locale, this.
|
|
50
|
+
this.$emit('change', formatMoney(evt, false, this.locale, this.customPrecision))
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
|
package/src/utils/currency.js
CHANGED
|
@@ -36,7 +36,7 @@ function unformat (input, precision = defaults.precision) {
|
|
|
36
36
|
* @param {Object} locale Configuração de localidade para saber número de casas decimais (precision) e caracter de decimal (decimal)
|
|
37
37
|
* @returns
|
|
38
38
|
*/
|
|
39
|
-
function formatMoney (input, toString = false, locale = defaults,
|
|
39
|
+
function formatMoney (input, toString = false, locale = defaults, customPrecision = false) {
|
|
40
40
|
let inputString = (`${input}`)
|
|
41
41
|
|
|
42
42
|
// Impede de digitar . ou , porque o formatador já adiciona
|
|
@@ -50,7 +50,7 @@ function formatMoney (input, toString = false, locale = defaults, valorCusto = f
|
|
|
50
50
|
input = completeZeros(inputString, locale)
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
const precision =
|
|
53
|
+
const precision = customPrecision || locale.number.precision
|
|
54
54
|
const numbers = onlyNumbers(input, precision)
|
|
55
55
|
const currency = numbersToCurrency(numbers, precision)
|
|
56
56
|
|