@tagplus/components 4.3.0 → 4.3.1
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/utils/currency.js +3 -5
package/package.json
CHANGED
package/src/utils/currency.js
CHANGED
|
@@ -38,13 +38,9 @@ function unformat (input, precision = defaults.precision) {
|
|
|
38
38
|
* @returns
|
|
39
39
|
*/
|
|
40
40
|
function formatMoney (input, toString = false, locale = defaults, customPrecision = false) {
|
|
41
|
+
console.log(' customPrecision-> ', customPrecision)
|
|
41
42
|
let inputString = (`${input}`)
|
|
42
43
|
|
|
43
|
-
// Caso componente receba props de precisão customizada (ex.: tp-money com precisão diferente da locale padrão).
|
|
44
|
-
if (customPrecision) {
|
|
45
|
-
locale.number.precision = customPrecision
|
|
46
|
-
}
|
|
47
|
-
|
|
48
44
|
// Impede de digitar . ou , porque o formatador já adiciona
|
|
49
45
|
if ((inputString.slice(-1).match(/[.,]/))) {
|
|
50
46
|
inputString = inputString.substring(0, inputString.length - 1)
|
|
@@ -57,6 +53,8 @@ function formatMoney (input, toString = false, locale = defaults, customPrecisio
|
|
|
57
53
|
}
|
|
58
54
|
|
|
59
55
|
const precision = customPrecision || locale.number.precision
|
|
56
|
+
console.log(' precision-> ', precision)
|
|
57
|
+
|
|
60
58
|
const numbers = onlyNumbers(input, precision)
|
|
61
59
|
const currency = numbersToCurrency(numbers, precision)
|
|
62
60
|
|