@bildvitta/quasar-ui-asteroid 3.16.0-beta.8 → 3.16.0-beta.9
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/expansion-item/QasExpansionItem.vue +31 -3
- package/src/components/expansion-item/QasExpansionItem.yml +5 -0
- package/src/components/form-view/QasFormView.vue +3 -1
- package/src/components/form-view/QasFormView.yml +3 -0
- package/src/components/grid-generator/QasGridGenerator.vue +2 -10
- package/src/components/label/QasLabel.vue +2 -2
- package/src/components/list-view/QasListView.vue +3 -1
- package/src/components/list-view/QasListView.yml +3 -0
- package/src/components/single-view/QasSingleView.vue +7 -2
- package/src/components/single-view/QasSingleView.yml +3 -0
- package/src/components/table-generator/QasTableGenerator.vue +16 -2
- package/src/components/table-generator/QasTableGenerator.yml +5 -0
- package/src/composables/private/use-generator.js +9 -3
- package/src/composables/private/use-view.js +6 -0
- package/src/mixins/view.js +12 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div ref="expansionItem" class="full-width qas-expansion-item" :class="errorClasses" v-bind="expansionProps.parent">
|
|
3
3
|
<component :is="component.is" class="qas-expansion-item__box">
|
|
4
|
-
<q-expansion-item header-class="text-bold q-mt-sm q-pa-none" :label="props.label" v-bind="expansionProps.item">
|
|
4
|
+
<q-expansion-item header-class="text-bold q-mt-sm q-pa-none qas-expansion-item__header" :label="props.label" v-bind="expansionProps.item">
|
|
5
5
|
<template #header>
|
|
6
6
|
<slot name="header">
|
|
7
7
|
<div class="full-width">
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
</slot>
|
|
27
27
|
</template>
|
|
28
28
|
|
|
29
|
-
<q-separator v-if="
|
|
29
|
+
<q-separator v-if="hasHeaderSeparator" class="q-my-md" />
|
|
30
30
|
|
|
31
31
|
<div :class="contentClasses">
|
|
32
32
|
<slot name="content">
|
|
@@ -77,6 +77,11 @@ const props = defineProps({
|
|
|
77
77
|
gridGeneratorProps: {
|
|
78
78
|
type: Object,
|
|
79
79
|
default: () => ({})
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
useHeaderSeparator: {
|
|
83
|
+
type: Boolean,
|
|
84
|
+
default: undefined
|
|
80
85
|
}
|
|
81
86
|
})
|
|
82
87
|
|
|
@@ -105,8 +110,25 @@ const hasGridGenerator = computed(() => !!Object.keys(props.gridGeneratorProps).
|
|
|
105
110
|
const hasBottomSeparator = computed(() => isNestedExpansionItem && hasNextSibling.value)
|
|
106
111
|
const hasHeaderBottom = computed(() => !!slots['header-bottom'])
|
|
107
112
|
|
|
113
|
+
/**
|
|
114
|
+
* Verifica se o componente deve adicionar um separador no header.
|
|
115
|
+
*
|
|
116
|
+
* - Se a propriedade useHeaderSeparator for true, retorna separador.
|
|
117
|
+
* - Se a propriedade useHeaderSeparator for undefined, retorna separador apenas se não for um componente aninhado.
|
|
118
|
+
* - Se a propriedade useHeaderSeparator for false, não retorna separador.
|
|
119
|
+
*/
|
|
120
|
+
const hasHeaderSeparator = computed(() => {
|
|
121
|
+
return typeof props.useHeaderSeparator === 'undefined' ? !isNestedExpansionItem : props.useHeaderSeparator
|
|
122
|
+
})
|
|
123
|
+
|
|
108
124
|
const errorClasses = computed(() => ({ 'qas-expansion-item--error': hasError.value }))
|
|
109
|
-
|
|
125
|
+
|
|
126
|
+
const contentClasses = computed(() => {
|
|
127
|
+
return {
|
|
128
|
+
'q-mt-sm': isNestedExpansionItem,
|
|
129
|
+
'q-mt-md': !isNestedExpansionItem && !props.useHeaderSeparator
|
|
130
|
+
}
|
|
131
|
+
})
|
|
110
132
|
|
|
111
133
|
const expansionProps = computed(() => {
|
|
112
134
|
const {
|
|
@@ -155,6 +177,12 @@ function setHasNextSibling (value) {
|
|
|
155
177
|
.qas-expansion-item {
|
|
156
178
|
$root: &;
|
|
157
179
|
|
|
180
|
+
// em alguns casos quando usado com grid, o espaçamento afetava o header, com z-index o problema é resolvido
|
|
181
|
+
&__header {
|
|
182
|
+
position: relative;
|
|
183
|
+
z-index: 1;
|
|
184
|
+
}
|
|
185
|
+
|
|
158
186
|
&--error {
|
|
159
187
|
#{$root}__box {
|
|
160
188
|
border: 2px solid $negative;
|
|
@@ -24,6 +24,11 @@ props:
|
|
|
24
24
|
desc: Propriedades que serão repassadas para o QasGridGenerator.
|
|
25
25
|
type: Object
|
|
26
26
|
|
|
27
|
+
use-header-separator:
|
|
28
|
+
desc: Propriedade para forçar o QSeparator no header.
|
|
29
|
+
type: Boolean
|
|
30
|
+
default: undefined
|
|
31
|
+
|
|
27
32
|
slots:
|
|
28
33
|
header:
|
|
29
34
|
desc: 'Slot para substituir o conteúdo do header'
|
|
@@ -70,7 +70,7 @@ const props = defineProps({
|
|
|
70
70
|
})
|
|
71
71
|
|
|
72
72
|
// composables
|
|
73
|
-
const { classes
|
|
73
|
+
const { classes, getFieldClass } = useGenerator({ props })
|
|
74
74
|
|
|
75
75
|
// computed
|
|
76
76
|
const hasResult = computed(() => Object.keys(props.result).length)
|
|
@@ -97,12 +97,6 @@ const headerClass = computed(() => {
|
|
|
97
97
|
]
|
|
98
98
|
})
|
|
99
99
|
|
|
100
|
-
const classes = computed(() => {
|
|
101
|
-
if (props.useInline) return 'row q-col-gutter-md'
|
|
102
|
-
|
|
103
|
-
return useGeneratorClasses.value
|
|
104
|
-
})
|
|
105
|
-
|
|
106
100
|
const fieldsByResult = ref({})
|
|
107
101
|
|
|
108
102
|
/**
|
|
@@ -163,9 +157,7 @@ function setFieldsByResult () {
|
|
|
163
157
|
}
|
|
164
158
|
|
|
165
159
|
function getContainerClass ({ key }) {
|
|
166
|
-
if (props.useInline)
|
|
167
|
-
return 'row justify-between col-12'
|
|
168
|
-
}
|
|
160
|
+
if (props.useInline) return 'row justify-between col-12'
|
|
169
161
|
|
|
170
162
|
return getFieldClass({ index: key, isGridGenerator: true })
|
|
171
163
|
}
|
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
<slot />
|
|
9
9
|
</template>
|
|
10
10
|
|
|
11
|
-
<
|
|
11
|
+
<div v-else-if="!viewState.fetching">
|
|
12
|
+
<slot v-if="canShowFetchErrorSlot" name="fetch-error" />
|
|
13
|
+
|
|
14
|
+
<qas-empty-result-text v-else class="q-my-xl" />
|
|
15
|
+
</div>
|
|
12
16
|
|
|
13
17
|
<footer v-if="hasFooterSlot">
|
|
14
18
|
<slot name="footer" />
|
|
@@ -71,6 +75,7 @@ const {
|
|
|
71
75
|
componentClass,
|
|
72
76
|
hasHeaderSlot,
|
|
73
77
|
hasFooterSlot,
|
|
78
|
+
canShowFetchErrorSlot,
|
|
74
79
|
|
|
75
80
|
// functions
|
|
76
81
|
errorHandler,
|
|
@@ -94,7 +99,7 @@ const resultModel = computed(() => {
|
|
|
94
99
|
return viewState.value.result || {}
|
|
95
100
|
})
|
|
96
101
|
|
|
97
|
-
const hasResult = computed(() => !!resultModel.value)
|
|
102
|
+
const hasResult = computed(() => !!Object.keys(resultModel.value).length)
|
|
98
103
|
|
|
99
104
|
// watch
|
|
100
105
|
watch(() => route, (to, from) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<component :is="parentComponent.is" v-bind="parentComponent.props">
|
|
3
3
|
<q-table ref="table" class="bg-white qas-table-generator text-grey-8" v-bind="attributes">
|
|
4
4
|
<template v-for="(_, name) in slots" #[name]="context">
|
|
5
5
|
<slot :name="name" v-bind="context" />
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
</q-td>
|
|
16
16
|
</template>
|
|
17
17
|
</q-table>
|
|
18
|
-
</
|
|
18
|
+
</component>
|
|
19
19
|
</template>
|
|
20
20
|
|
|
21
21
|
<script>
|
|
@@ -57,6 +57,11 @@ export default {
|
|
|
57
57
|
type: String
|
|
58
58
|
},
|
|
59
59
|
|
|
60
|
+
useBox: {
|
|
61
|
+
type: Boolean,
|
|
62
|
+
default: true
|
|
63
|
+
},
|
|
64
|
+
|
|
60
65
|
useScrollOnGrab: {
|
|
61
66
|
type: Boolean,
|
|
62
67
|
default: true
|
|
@@ -217,6 +222,15 @@ export default {
|
|
|
217
222
|
|
|
218
223
|
hasScrollOnGrab () {
|
|
219
224
|
return !!Object.keys(this.scrollOnGrab).length
|
|
225
|
+
},
|
|
226
|
+
|
|
227
|
+
parentComponent () {
|
|
228
|
+
return {
|
|
229
|
+
is: this.useBox ? 'qas-box' : 'div',
|
|
230
|
+
props: {
|
|
231
|
+
class: this.useBox ? 'q-px-lg q-py-md' : ''
|
|
232
|
+
}
|
|
233
|
+
}
|
|
220
234
|
}
|
|
221
235
|
},
|
|
222
236
|
|
|
@@ -36,6 +36,11 @@ props:
|
|
|
36
36
|
type: Function
|
|
37
37
|
examples: ["(row) => ({ path: 'table-generator', params: { id: row.uuid } })"]
|
|
38
38
|
|
|
39
|
+
use-box:
|
|
40
|
+
desc: Controla se o componente vai usar QasBox ou div.
|
|
41
|
+
default: true
|
|
42
|
+
type: Boolean
|
|
43
|
+
|
|
39
44
|
use-external-link:
|
|
40
45
|
desc: Usado em conjunto com a prop "row-route-fn" quando há a necessidade da rota ser um link externo.
|
|
41
46
|
default: false
|
|
@@ -21,7 +21,7 @@ export const baseProps = {
|
|
|
21
21
|
},
|
|
22
22
|
|
|
23
23
|
gutter: {
|
|
24
|
-
default:
|
|
24
|
+
default: undefined,
|
|
25
25
|
type: [String, Boolean],
|
|
26
26
|
validator: gutterValidator
|
|
27
27
|
}
|
|
@@ -46,13 +46,19 @@ export default function ({ props = {} }) {
|
|
|
46
46
|
const classes = computed(() => {
|
|
47
47
|
const classesList = ['row']
|
|
48
48
|
|
|
49
|
-
if (
|
|
50
|
-
classesList.push(`q-col-gutter-${
|
|
49
|
+
if (defaultGutter.value) {
|
|
50
|
+
classesList.push(`q-col-gutter-${defaultGutter.value}`)
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
return classesList
|
|
54
54
|
})
|
|
55
55
|
|
|
56
|
+
const defaultGutter = computed(() => {
|
|
57
|
+
if (props.gutter) return props.gutter
|
|
58
|
+
|
|
59
|
+
return props.useInline ? Spacing.Md : Spacing.Lg
|
|
60
|
+
})
|
|
61
|
+
|
|
56
62
|
/**
|
|
57
63
|
* @function
|
|
58
64
|
* @param {Object} options
|
|
@@ -80,6 +80,7 @@ export default function useView (config) {
|
|
|
80
80
|
|
|
81
81
|
// refs
|
|
82
82
|
const cancelBeforeFetch = ref(false)
|
|
83
|
+
const hasFetchError = ref(false)
|
|
83
84
|
|
|
84
85
|
// constants
|
|
85
86
|
const fetchErrorMessage = 'Ops… Não conseguimos acessar as informações. Por favor, tente novamente em alguns minutos.'
|
|
@@ -88,6 +89,8 @@ export default function useView (config) {
|
|
|
88
89
|
const componentClass = computed(() => props.useBoundary && 'container spaced')
|
|
89
90
|
const hasFooterSlot = computed(() => !!slots.footer)
|
|
90
91
|
const hasHeaderSlot = computed(() => !!slots.header)
|
|
92
|
+
const hasFetchErrorSlot = computed(() => !!slots.fetchError)
|
|
93
|
+
const canShowFetchErrorSlot = computed(() => hasFetchErrorSlot.value && hasFetchError.value)
|
|
91
94
|
|
|
92
95
|
// watch
|
|
93
96
|
watch(() => viewState.value.fetching, value => emit('update:fetching', value))
|
|
@@ -111,6 +114,8 @@ export default function useView (config) {
|
|
|
111
114
|
return
|
|
112
115
|
}
|
|
113
116
|
|
|
117
|
+
hasFetchError.value = true
|
|
118
|
+
|
|
114
119
|
NotifyError(fetchErrorMessage)
|
|
115
120
|
}
|
|
116
121
|
|
|
@@ -167,6 +172,7 @@ export default function useView (config) {
|
|
|
167
172
|
componentClass,
|
|
168
173
|
hasFooterSlot,
|
|
169
174
|
hasHeaderSlot,
|
|
175
|
+
canShowFetchErrorSlot,
|
|
170
176
|
|
|
171
177
|
// functions
|
|
172
178
|
errorHandler,
|
package/src/mixins/view.js
CHANGED
|
@@ -56,7 +56,8 @@ export default {
|
|
|
56
56
|
mx_fields: {},
|
|
57
57
|
mx_metadata: {},
|
|
58
58
|
mx_cancelBeforeFetch: false,
|
|
59
|
-
mx_isFetching: false
|
|
59
|
+
mx_isFetching: false,
|
|
60
|
+
mx_hasFetchError: false
|
|
60
61
|
}
|
|
61
62
|
},
|
|
62
63
|
|
|
@@ -79,8 +80,16 @@ export default {
|
|
|
79
80
|
return !!(this.$slots.header)
|
|
80
81
|
},
|
|
81
82
|
|
|
83
|
+
mx_hasFetchErrorSlot () {
|
|
84
|
+
return !!(this.$slots.fetchError)
|
|
85
|
+
},
|
|
86
|
+
|
|
82
87
|
mx_fetchErrorMessage () {
|
|
83
88
|
return 'Ops… Não conseguimos acessar as informações. Por favor, tente novamente em alguns minutos.'
|
|
89
|
+
},
|
|
90
|
+
|
|
91
|
+
mx_canShowFetchErrorSlot () {
|
|
92
|
+
return this.mx_hasFetchError && this.mx_hasFetchErrorSlot
|
|
84
93
|
}
|
|
85
94
|
},
|
|
86
95
|
|
|
@@ -101,6 +110,8 @@ export default {
|
|
|
101
110
|
return
|
|
102
111
|
}
|
|
103
112
|
|
|
113
|
+
this.mx_hasFetchError = true
|
|
114
|
+
|
|
104
115
|
this.$qas.error(this.mx_fetchErrorMessage)
|
|
105
116
|
},
|
|
106
117
|
|