@bildvitta/quasar-ui-asteroid 2.14.1 → 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/components/grid-generator/QasGridGenerator.stories.js +4 -0
- package/src/components/grid-generator/QasGridGenerator.vue +6 -3
- package/src/components/list-items/QasListItems.stories.js +6 -1
- package/src/components/list-items/QasListItems.vue +6 -1
- package/src/components/resizer/QasResizer.vue +1 -1
- package/src/components/table-generator/QasTableGenerator.stories.js +4 -0
- package/src/components/table-generator/QasTableGenerator.vue +6 -1
- package/src/helpers/filters.js +8 -2
- package/src/helpers/index.js +2 -0
package/package.json
CHANGED
|
@@ -38,6 +38,11 @@ export default {
|
|
|
38
38
|
type: Boolean
|
|
39
39
|
},
|
|
40
40
|
|
|
41
|
+
emptyResultText: {
|
|
42
|
+
default: '-',
|
|
43
|
+
type: String
|
|
44
|
+
},
|
|
45
|
+
|
|
41
46
|
result: {
|
|
42
47
|
default: () => ({}),
|
|
43
48
|
type: Object
|
|
@@ -76,16 +81,14 @@ export default {
|
|
|
76
81
|
resultsByFields () {
|
|
77
82
|
const formattedResult = {}
|
|
78
83
|
const result = extend(true, {}, this.result)
|
|
79
|
-
|
|
80
84
|
for (const key in result) {
|
|
81
85
|
if (this.formattedFields[key]?.type) {
|
|
82
|
-
formattedResult[key] = humanize(this.formattedFields[key], result[key])
|
|
86
|
+
formattedResult[key] = humanize(this.formattedFields[key], result[key]) || this.emptyResultText
|
|
83
87
|
// TODO: Rever.
|
|
84
88
|
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
|
85
89
|
this.slotValue[key] = { ...this.formattedFields[key], formattedResult: formattedResult[key] }
|
|
86
90
|
}
|
|
87
91
|
}
|
|
88
|
-
|
|
89
92
|
return formattedResult
|
|
90
93
|
}
|
|
91
94
|
}
|
|
@@ -38,7 +38,12 @@ export default {
|
|
|
38
38
|
|
|
39
39
|
redirectKey: {
|
|
40
40
|
control: null,
|
|
41
|
-
description: '
|
|
41
|
+
description: 'Item key that will be the value of the redirect.'
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
paramKey: {
|
|
45
|
+
control: null,
|
|
46
|
+
description: 'Redirect parameter key.'
|
|
42
47
|
},
|
|
43
48
|
|
|
44
49
|
useIconRedirect: {
|
|
@@ -44,6 +44,11 @@ export default {
|
|
|
44
44
|
type: String
|
|
45
45
|
},
|
|
46
46
|
|
|
47
|
+
paramKey: {
|
|
48
|
+
default: 'id',
|
|
49
|
+
type: String
|
|
50
|
+
},
|
|
51
|
+
|
|
47
52
|
to: {
|
|
48
53
|
default: () => ({}),
|
|
49
54
|
type: Object
|
|
@@ -61,7 +66,7 @@ export default {
|
|
|
61
66
|
|
|
62
67
|
getRedirectPayload (item) {
|
|
63
68
|
return {
|
|
64
|
-
params: { [this.
|
|
69
|
+
params: { [this.paramKey]: item[this.redirectKey] },
|
|
65
70
|
...this.to
|
|
66
71
|
}
|
|
67
72
|
}
|
|
@@ -43,6 +43,11 @@ export default {
|
|
|
43
43
|
rowKey: {
|
|
44
44
|
default: 'name',
|
|
45
45
|
type: String
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
emptyResultText: {
|
|
49
|
+
default: '-',
|
|
50
|
+
type: String
|
|
46
51
|
}
|
|
47
52
|
},
|
|
48
53
|
|
|
@@ -114,7 +119,7 @@ export default {
|
|
|
114
119
|
return results.map((result, index) => {
|
|
115
120
|
for (const key in result) {
|
|
116
121
|
result.default = this.results[index]
|
|
117
|
-
result[key] = humanize(this.fields[key], result[key])
|
|
122
|
+
result[key] = humanize(this.fields[key], result[key]) || this.emptyResultText
|
|
118
123
|
}
|
|
119
124
|
|
|
120
125
|
return result
|
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}` : ''
|
|
@@ -96,8 +101,7 @@ function handleMasks (value) {
|
|
|
96
101
|
|
|
97
102
|
// Labels
|
|
98
103
|
function humanize (field = {}, value) {
|
|
99
|
-
if (!value) return value
|
|
100
|
-
|
|
104
|
+
if (field.mask && !value) return value
|
|
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,
|