@bildvitta/quasar-ui-asteroid 3.11.0-beta.5 → 3.11.0-beta.6
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.vue +6 -3
- package/src/components/grid-generator/QasGridGenerator.yml +1 -1
- package/src/components/select-list/QasSelectList.yml +7 -0
- package/src/components/table-generator/QasTableGenerator.vue +5 -3
- package/src/components/table-generator/QasTableGenerator.yml +1 -1
- package/src/helpers/index.js +1 -0
- package/src/helpers/is-empty.js +3 -0
- package/src/helpers/rules.js +1 -1
- package/src/mixins/search-filter.js +26 -1
package/package.json
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
<script setup>
|
|
22
22
|
import useGenerator, { baseProps } from '../../composables/private/use-generator'
|
|
23
|
-
import { humanize } from '../../helpers
|
|
23
|
+
import { isEmpty, humanize } from '../../helpers'
|
|
24
24
|
import { isObject } from 'lodash-es'
|
|
25
25
|
import { ref, computed, watch } from 'vue'
|
|
26
26
|
|
|
@@ -102,14 +102,17 @@ function getFieldsByResult () {
|
|
|
102
102
|
const result = { ...props.result }
|
|
103
103
|
const fieldsByResult = {}
|
|
104
104
|
|
|
105
|
-
for (const key in
|
|
105
|
+
for (const key in formattedFields.value) {
|
|
106
106
|
const field = formattedFields.value[key] || {}
|
|
107
107
|
|
|
108
108
|
if (!field.type) continue
|
|
109
109
|
|
|
110
|
+
const humanizedResult = humanize(field, result[key])
|
|
111
|
+
const formattedResult = isEmpty({ value: humanizedResult }) ? props.emptyResultText : humanizedResult
|
|
112
|
+
|
|
110
113
|
fieldsByResult[key] = {
|
|
111
114
|
...field,
|
|
112
|
-
formattedResult
|
|
115
|
+
formattedResult
|
|
113
116
|
}
|
|
114
117
|
}
|
|
115
118
|
|
|
@@ -16,7 +16,7 @@ props:
|
|
|
16
16
|
type: [Array, Object, String]
|
|
17
17
|
|
|
18
18
|
empty-result-text:
|
|
19
|
-
desc: Se o resultado de algum campo for vazio, esta prop define qual será o valor padrão.
|
|
19
|
+
desc: Se o resultado de algum campo for vazio (null, undefined, ''), esta prop define qual será o valor padrão.
|
|
20
20
|
default: '-'
|
|
21
21
|
type: String
|
|
22
22
|
|
|
@@ -33,6 +33,13 @@ props:
|
|
|
33
33
|
examples: [v-model="value"]
|
|
34
34
|
model: true
|
|
35
35
|
|
|
36
|
+
options-to-exclude:
|
|
37
|
+
desc: Lista de valores que não serão exibidos na lista de resultados (options/list) que pode ser uuid/id/slug.
|
|
38
|
+
default: []
|
|
39
|
+
type: Array
|
|
40
|
+
examples:
|
|
41
|
+
- options-to-exclude="['uuid1', 'uuid2', 'uuid3']"
|
|
42
|
+
|
|
36
43
|
readonly:
|
|
37
44
|
desc: Habilita modo visualização.
|
|
38
45
|
default: false
|
|
@@ -20,8 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
<script>
|
|
22
22
|
import { extend } from 'quasar'
|
|
23
|
-
import { humanize } from '../../helpers
|
|
24
|
-
import { setScrollOnGrab } from '../../helpers'
|
|
23
|
+
import { isEmpty, humanize, setScrollOnGrab } from '../../helpers'
|
|
25
24
|
|
|
26
25
|
export default {
|
|
27
26
|
name: 'QasTableGenerator',
|
|
@@ -190,8 +189,11 @@ export default {
|
|
|
190
189
|
|
|
191
190
|
const mappedResults = results.map((result, index) => {
|
|
192
191
|
for (const key in result) {
|
|
192
|
+
const humanizedResult = humanize(this.fields[key], result[key])
|
|
193
|
+
const formattedResult = isEmpty({ value: humanizedResult }) ? this.emptyResultText : humanizedResult
|
|
194
|
+
|
|
193
195
|
result.default = this.results[index]
|
|
194
|
-
result[key] =
|
|
196
|
+
result[key] = formattedResult
|
|
195
197
|
}
|
|
196
198
|
|
|
197
199
|
return result
|
|
@@ -10,7 +10,7 @@ props:
|
|
|
10
10
|
type: Array
|
|
11
11
|
|
|
12
12
|
empty-result-text:
|
|
13
|
-
desc: Quando uma célula da tabela está vazia, esta prop define qual será o valor padrão.
|
|
13
|
+
desc: Quando uma célula da tabela está vazia (null, undefined, ''), esta prop define qual será o valor padrão.
|
|
14
14
|
default: '-'
|
|
15
15
|
type: String
|
|
16
16
|
|
package/src/helpers/index.js
CHANGED
|
@@ -13,6 +13,7 @@ export { default as getGreatestCommonDivisor } from './get-greatest-common-divis
|
|
|
13
13
|
export { default as getNormalizedOptions } from './get-normalized-options.js'
|
|
14
14
|
export { default as getSlotChildrenText } from './get-slot-children-text.js'
|
|
15
15
|
export { default as handleProcess } from './handle-process.js'
|
|
16
|
+
export { default as isEmpty } from './is-empty.js'
|
|
16
17
|
export { default as isLocalDevelopment } from './is-local-development.js'
|
|
17
18
|
export { default as promiseHandler } from './promise-handler.js'
|
|
18
19
|
export { default as setScrollOnGrab } from './set-scroll-on-grab.js'
|
package/src/helpers/rules.js
CHANGED
|
@@ -25,6 +25,11 @@ export default {
|
|
|
25
25
|
|
|
26
26
|
useLazyLoading: {
|
|
27
27
|
type: Boolean
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
optionsToExclude: {
|
|
31
|
+
default: () => [],
|
|
32
|
+
type: Array
|
|
28
33
|
}
|
|
29
34
|
},
|
|
30
35
|
|
|
@@ -77,6 +82,10 @@ export default {
|
|
|
77
82
|
|
|
78
83
|
mx_hasFilteredOptions () {
|
|
79
84
|
return !!this.mx_filteredOptions.length
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
mx_hasOptionsToExclude () {
|
|
88
|
+
return !!this.optionsToExclude.length
|
|
80
89
|
}
|
|
81
90
|
},
|
|
82
91
|
|
|
@@ -192,7 +201,9 @@ export default {
|
|
|
192
201
|
|
|
193
202
|
this.$emit('fetch-options-success', data)
|
|
194
203
|
|
|
195
|
-
|
|
204
|
+
const options = this.mx_getOptions(results)
|
|
205
|
+
|
|
206
|
+
return this.mx_getNonDuplicatedOptions(options)
|
|
196
207
|
} catch (error) {
|
|
197
208
|
this.mx_hasFetchError = true
|
|
198
209
|
this.$emit('fetch-options-error', error)
|
|
@@ -273,6 +284,8 @@ export default {
|
|
|
273
284
|
this.$watch(model, options => {
|
|
274
285
|
if (!options?.length) return
|
|
275
286
|
|
|
287
|
+
options = this.mx_getOptions(options)
|
|
288
|
+
|
|
276
289
|
/*
|
|
277
290
|
* pode ser que as opções sejam inicializadas após o primeiro fetch de opções
|
|
278
291
|
* fazendo com que as opções sobrescreva as que vieram através do fetch, então é
|
|
@@ -297,6 +310,18 @@ export default {
|
|
|
297
310
|
|
|
298
311
|
this.mx_cachedOptions = [...options]
|
|
299
312
|
}, { immediate: true })
|
|
313
|
+
},
|
|
314
|
+
|
|
315
|
+
mx_getOptions (options = []) {
|
|
316
|
+
if (this.mx_hasOptionsToExclude) {
|
|
317
|
+
this.optionsToExclude.forEach(option => {
|
|
318
|
+
const index = options.findIndex(({ value }) => value === option)
|
|
319
|
+
|
|
320
|
+
if (~index) options.splice(index, 1)
|
|
321
|
+
})
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
return options
|
|
300
325
|
}
|
|
301
326
|
}
|
|
302
327
|
}
|