@bildvitta/quasar-ui-asteroid 3.5.0-beta.4 → 3.5.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/field/QasField.vue +18 -8
- package/src/components/filters/QasFilters.vue +93 -33
- package/src/components/filters/QasFilters.yml +0 -7
- package/src/components/form-view/QasFormView.vue +3 -5
- package/src/components/page-header/QasPageHeader.vue +1 -1
- package/src/components/select/QasSelect.yml +5 -0
- package/src/index.scss +1 -0
package/package.json
CHANGED
|
@@ -149,28 +149,38 @@ export default {
|
|
|
149
149
|
select: { is: 'qas-select', entity, name, multiple, options, useLazyLoading, ...input }
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
-
return {
|
|
152
|
+
return {
|
|
153
|
+
...(profiles[type] || profiles.default),
|
|
154
|
+
...this.$attrs,
|
|
155
|
+
label: this.formattedLabel
|
|
156
|
+
}
|
|
153
157
|
},
|
|
154
158
|
|
|
155
159
|
errorMessage () {
|
|
156
160
|
return Array.isArray(this.error) ? this.error.join(' ') : this.error
|
|
157
161
|
},
|
|
158
162
|
|
|
163
|
+
formattedLabel () {
|
|
164
|
+
const nonRequiredFieldsLabel = ['boolean', 'checkbox', 'radio']
|
|
165
|
+
|
|
166
|
+
const label = this.$attrs.label || this.formattedField.label
|
|
167
|
+
const { required, type } = this.formattedField
|
|
168
|
+
|
|
169
|
+
if (required && label && !nonRequiredFieldsLabel.includes(type)) {
|
|
170
|
+
return `${label}*`
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return label
|
|
174
|
+
},
|
|
175
|
+
|
|
159
176
|
// This computed will change the key name when the server sends different key.
|
|
160
177
|
formattedField () {
|
|
161
178
|
const field = {}
|
|
162
|
-
const nonRequiredFieldsLabel = ['boolean', 'checkbox', 'radio']
|
|
163
179
|
|
|
164
180
|
for (const key in this.field) {
|
|
165
181
|
field[attributesProfile[key] || key] = this.field[key]
|
|
166
182
|
}
|
|
167
183
|
|
|
168
|
-
const { label, required, type } = field
|
|
169
|
-
|
|
170
|
-
if (required && label && !nonRequiredFieldsLabel.includes(type)) {
|
|
171
|
-
field.label = `${label}*`
|
|
172
|
-
}
|
|
173
|
-
|
|
174
184
|
return field
|
|
175
185
|
},
|
|
176
186
|
|
|
@@ -1,47 +1,59 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<section class="q-mb-
|
|
3
|
-
<div v-if="showFilters" class="q-gutter-x-md row">
|
|
4
|
-
<div v-if="showSearch" class="col">
|
|
2
|
+
<section class="q-mb-xl qas-filters">
|
|
3
|
+
<div v-if="showFilters" class="q-col-gutter-x-md row">
|
|
4
|
+
<div v-if="showSearch" class="col-12 col-md-6">
|
|
5
5
|
<slot :filter="filter" name="search">
|
|
6
6
|
<q-form v-if="useSearch" @submit.prevent="filter()">
|
|
7
|
-
<qas-input v-model="search" data-cy="filters-search-input" :debounce="debounce" dense hide-bottom-space :outlined="false" :placeholder="searchPlaceholder" type="search">
|
|
7
|
+
<qas-input v-model="search" class="bg-white q-px-sm qas-filters__input rounded-borders-sm shadow-2" data-cy="filters-search-input" :debounce="debounce" dense hide-bottom-space input-class="ellipsis text-grey-8" :outlined="false" :placeholder="searchPlaceholder" type="search">
|
|
8
|
+
<template #prepend>
|
|
9
|
+
<q-icon v-if="useSearchOnType" color="grey-8" name="o_search" />
|
|
10
|
+
<qas-btn v-else color="grey-9" flat icon="o_search" padding="0" @click="filter()" />
|
|
11
|
+
</template>
|
|
12
|
+
|
|
8
13
|
<template #append>
|
|
9
|
-
<qas-btn v-if="hasSearch" color="grey-9" flat icon="o_clear"
|
|
10
|
-
|
|
14
|
+
<qas-btn v-if="hasSearch" class="q-mr-sm" color="grey-9" flat icon="o_clear" padding="0" size="sm" @click="clearSearch" />
|
|
15
|
+
|
|
16
|
+
<qas-btn v-if="useFilterButton" :color="filterButtonColor" data-cy="filters-btn" flat icon="o_tune" padding="0">
|
|
17
|
+
<q-menu anchor="center right" class="full-width" max-width="270px" self="top right">
|
|
18
|
+
<div v-if="isFetching" class="q-pa-xl text-center">
|
|
19
|
+
<q-spinner color="grey" size="2em" />
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
<div v-else-if="hasFetchError" class="q-pa-xl text-center">
|
|
23
|
+
<q-icon color="negative" name="o_warning" size="2em" />
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
<q-form v-else class="q-gutter-y-md q-pa-md" @submit.prevent="filter()">
|
|
27
|
+
<div v-for="(field, index) in fields" :key="index">
|
|
28
|
+
<qas-field v-model="filters[field.name]" :data-cy="`filters-${field.name}-field`" :field="field" v-bind="fieldsProps[field.name]" />
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
<div class="q-col-gutter-x-md q-mt-xl row">
|
|
32
|
+
<div class="col-6">
|
|
33
|
+
<qas-btn class="full-width" data-cy="filters-clear-btn" label="Limpar" outline size="12px" @click="clearFilters" />
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<div class="col-6">
|
|
37
|
+
<qas-btn class="full-width" color="primary" data-cy="filters-submit-btn" label="Filtrar" size="12px" type="submit" />
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
</q-form>
|
|
41
|
+
</q-menu>
|
|
42
|
+
</qas-btn>
|
|
11
43
|
</template>
|
|
12
44
|
</qas-input>
|
|
13
45
|
</q-form>
|
|
14
46
|
</slot>
|
|
15
47
|
</div>
|
|
16
48
|
|
|
17
|
-
<
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
<div v-if="isFetching" class="q-pa-xl text-center">
|
|
21
|
-
<q-spinner color="grey" size="2em" />
|
|
22
|
-
</div>
|
|
23
|
-
|
|
24
|
-
<div v-else-if="hasFetchError" class="q-pa-xl text-center">
|
|
25
|
-
<q-icon color="negative" name="o_warning" size="2em" />
|
|
26
|
-
</div>
|
|
27
|
-
|
|
28
|
-
<q-form v-else class="q-gutter-y-md q-pa-md" @submit.prevent="filter()">
|
|
29
|
-
<div v-for="(field, index) in fields" :key="index">
|
|
30
|
-
<qas-field v-model="filters[field.name]" :data-cy="`filters-${field.name}-field`" dense :field="field" v-bind="fieldsProps[field.name]" />
|
|
31
|
-
</div>
|
|
32
|
-
|
|
33
|
-
<div class="text-right">
|
|
34
|
-
<qas-btn class="q-mr-sm" data-cy="filters-clear-btn" flat label="Limpar" :no-caps="false" size="12px" unelevated @click="clearFilters" />
|
|
35
|
-
<qas-btn color="primary" data-cy="filters-submit-btn" label="Filtrar" :no-caps="false" size="12px" type="submit" unelevated />
|
|
36
|
-
</div>
|
|
37
|
-
</q-form>
|
|
38
|
-
</q-menu>
|
|
39
|
-
</qas-btn>
|
|
40
|
-
</slot>
|
|
49
|
+
<div class="col-12 col-md-6">
|
|
50
|
+
<slot name="right-side" />
|
|
51
|
+
</div>
|
|
41
52
|
</div>
|
|
42
53
|
|
|
43
|
-
<div v-if="
|
|
44
|
-
|
|
54
|
+
<div v-if="hasChip" class="q-mt-md">
|
|
55
|
+
<!-- TODO rever com novo estilo -->
|
|
56
|
+
<q-chip v-for="(filterItem, key) in activeFilters" :key="key" color="white" :data-cy="`filters-${filterItem.value}-chip`" dense icon-remove="o_close" removable size="md" text-color="grey-8" @remove="removeFilter(filterItem)">{{ getChipValue(filterItem.value) }}</q-chip>
|
|
45
57
|
</div>
|
|
46
58
|
|
|
47
59
|
<slot :context="mx_context" :filter="filter" :filters="activeFilters" :remove-filter="removeFilter" />
|
|
@@ -150,7 +162,7 @@ export default {
|
|
|
150
162
|
},
|
|
151
163
|
|
|
152
164
|
debounce () {
|
|
153
|
-
return this.useSearchOnType ? '
|
|
165
|
+
return this.useSearchOnType ? '800' : ''
|
|
154
166
|
},
|
|
155
167
|
|
|
156
168
|
fields () {
|
|
@@ -161,6 +173,7 @@ export default {
|
|
|
161
173
|
return this.hasActiveFilters ? 'primary' : 'grey-9'
|
|
162
174
|
},
|
|
163
175
|
|
|
176
|
+
// TODO: remover
|
|
164
177
|
filterButtonLabel () {
|
|
165
178
|
return this.$q.screen.gt.xs ? 'Filtrar' : undefined
|
|
166
179
|
},
|
|
@@ -187,6 +200,10 @@ export default {
|
|
|
187
200
|
|
|
188
201
|
showSearch () {
|
|
189
202
|
return !!this.$slots.search || this.useSearch
|
|
203
|
+
},
|
|
204
|
+
|
|
205
|
+
hasChip () {
|
|
206
|
+
return this.useChip && this.hasActiveFilters
|
|
190
207
|
}
|
|
191
208
|
},
|
|
192
209
|
|
|
@@ -330,3 +347,46 @@ export default {
|
|
|
330
347
|
}
|
|
331
348
|
}
|
|
332
349
|
</script>
|
|
350
|
+
|
|
351
|
+
<style lang="scss">
|
|
352
|
+
// TODO rever
|
|
353
|
+
.qas-filters {
|
|
354
|
+
.q-field::before {
|
|
355
|
+
border: 2px solid transparent;
|
|
356
|
+
border-radius: 4px;
|
|
357
|
+
bottom: 0;
|
|
358
|
+
content: '';
|
|
359
|
+
left: 0;
|
|
360
|
+
pointer-events: none;
|
|
361
|
+
position: absolute;
|
|
362
|
+
right: 0;
|
|
363
|
+
top: 0;
|
|
364
|
+
transition: border-color var(--qas-generic-transition);
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
.q-field--focused::before {
|
|
368
|
+
border-color: var(--q-primary);
|
|
369
|
+
color: var(--q-primary);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
.q-field--dense .q-field__prepend {
|
|
373
|
+
padding-right: var(--qas-spacing-xs);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
.q-field--dense .q-field__append {
|
|
377
|
+
padding-left: var(--qas-spacing-sm);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
&__input {
|
|
381
|
+
.q-field__control::before,
|
|
382
|
+
.q-field__control::after {
|
|
383
|
+
display: none;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
.q-field__native {
|
|
387
|
+
padding-bottom: var(--qas-spacing-sm);
|
|
388
|
+
padding-top: var(--qas-spacing-sm);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
</style>
|
|
@@ -56,13 +56,6 @@ slots:
|
|
|
56
56
|
desc: função usada para fazer o filtro
|
|
57
57
|
type: Function
|
|
58
58
|
|
|
59
|
-
filter-button:
|
|
60
|
-
desc: Slot para seção do botão do menu lateral.
|
|
61
|
-
scope:
|
|
62
|
-
filter:
|
|
63
|
-
desc: função usada para fazer o filtro
|
|
64
|
-
type: Function
|
|
65
|
-
|
|
66
59
|
default:
|
|
67
60
|
desc: Slot para acessar o final do componente.
|
|
68
61
|
scope:
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<slot v-if="useActions" name="actions">
|
|
11
11
|
<div class="justify-end q-col-gutter-md q-my-lg row">
|
|
12
12
|
<div v-if="hasCancelButton" class="col-12 col-sm-2" :class="cancelButtonClass">
|
|
13
|
-
<qas-btn v-close-popup class="full-width" :data-cy="`btnCancel-${entity}`" :disable="
|
|
13
|
+
<qas-btn v-close-popup class="full-width" :data-cy="`btnCancel-${entity}`" :disable="isSubmitting" :label="cancelButtonLabel" outline type="button" @click="cancel" />
|
|
14
14
|
</div>
|
|
15
15
|
|
|
16
16
|
<div v-if="useSubmitButton" class="col-12 col-sm-2" :class="submitButtonClass">
|
|
@@ -194,10 +194,6 @@ export default {
|
|
|
194
194
|
return this.$qas.screen.isSmall && 'order-first'
|
|
195
195
|
},
|
|
196
196
|
|
|
197
|
-
isCancelButtonDisabled () {
|
|
198
|
-
return this.disable || this.isSubmitting
|
|
199
|
-
},
|
|
200
|
-
|
|
201
197
|
defaultNotifyMessages () {
|
|
202
198
|
return {
|
|
203
199
|
validationError: 'Existem campos no formulário que ainda não foram preenchidos. Complete todas as informações para avançar.',
|
|
@@ -428,6 +424,8 @@ export default {
|
|
|
428
424
|
}
|
|
429
425
|
|
|
430
426
|
this.mx_setErrors()
|
|
427
|
+
this.$emit('update:errors', this.mx_errors)
|
|
428
|
+
|
|
431
429
|
NotifySuccess(response.data.status.text || this.defaultNotifyMessages.success)
|
|
432
430
|
this.$emit('submit-success', response, this.modelValue)
|
|
433
431
|
|
|
@@ -71,6 +71,11 @@ props:
|
|
|
71
71
|
type: String
|
|
72
72
|
examples: [value-key="uuid"]
|
|
73
73
|
|
|
74
|
+
use-search:
|
|
75
|
+
desc: Controla se vai ou não ter campo de busca no select.
|
|
76
|
+
default: undefined
|
|
77
|
+
type: Boolean
|
|
78
|
+
|
|
74
79
|
use-lazy-loading:
|
|
75
80
|
desc: Controla a busca pela store "fetchFieldOptions".
|
|
76
81
|
default: false
|