@bildvitta/quasar-ui-asteroid 2.16.0 → 2.17.0
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/package.json +1 -1
- package/src/helpers/filters.js +7 -1
- package/src/helpers/index.js +2 -0
package/package.json
CHANGED
package/src/helpers/filters.js
CHANGED
|
@@ -54,6 +54,11 @@ function percent (value = 0, places = 2) {
|
|
|
54
54
|
return value ? (value / 100).toLocaleString('pt-BR', { style: 'percent', minimumFractionDigits: places }) : ''
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
function formatPercent (value = 0, places = 2) {
|
|
58
|
+
value = Number(value)
|
|
59
|
+
return value ? value.toLocaleString('pt-BR', { style: 'percent', minimumFractionDigits: places }) : ''
|
|
60
|
+
}
|
|
61
|
+
|
|
57
62
|
function squareArea (value = 0, suffix = 'm²') {
|
|
58
63
|
value = decimal(value)
|
|
59
64
|
return value ? `${value} ${suffix}` : ''
|
|
@@ -97,7 +102,6 @@ function handleMasks (value) {
|
|
|
97
102
|
// Labels
|
|
98
103
|
function humanize (field = {}, value) {
|
|
99
104
|
if (field.mask && !value) return value
|
|
100
|
-
|
|
101
105
|
const mappedMasks = handleMasks(value)
|
|
102
106
|
|
|
103
107
|
if (mappedMasks[field.mask]) {
|
|
@@ -111,6 +115,7 @@ function humanize (field = {}, value) {
|
|
|
111
115
|
case 'datetime': return dateTime(value)
|
|
112
116
|
case 'time': return time(value)
|
|
113
117
|
case 'radio': return selectLabel(field.options, value)
|
|
118
|
+
case 'percent': return formatPercent(value)
|
|
114
119
|
default: return value
|
|
115
120
|
}
|
|
116
121
|
}
|
|
@@ -143,6 +148,7 @@ export {
|
|
|
143
148
|
decimal,
|
|
144
149
|
formatCompanyDocument,
|
|
145
150
|
formatDocument,
|
|
151
|
+
formatPercent,
|
|
146
152
|
formatPersonalDocument,
|
|
147
153
|
formatPhone,
|
|
148
154
|
formatPostalCode,
|
package/src/helpers/index.js
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
decimal,
|
|
14
14
|
formatCompanyDocument,
|
|
15
15
|
formatDocument,
|
|
16
|
+
formatPercent,
|
|
16
17
|
formatPersonalDocument,
|
|
17
18
|
formatPhone,
|
|
18
19
|
formatPostalCode,
|
|
@@ -36,6 +37,7 @@ export {
|
|
|
36
37
|
decimal,
|
|
37
38
|
formatCompanyDocument,
|
|
38
39
|
formatDocument,
|
|
40
|
+
formatPercent,
|
|
39
41
|
formatPersonalDocument,
|
|
40
42
|
formatPhone,
|
|
41
43
|
formatPostalCode,
|