@bildvitta/quasar-ui-asteroid 3.0.0-alpha.2 → 3.0.0-beta.2
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/dist/api/QasDelete.json +5 -0
- package/dist/api/QasFilters.json +4 -0
- package/dist/api/QasFormView.json +6 -4
- package/dist/api/QasInput.json +16 -1
- package/dist/api/QasPasswordInput.json +2 -1
- package/dist/api/QasSignatureUploader.json +7 -0
- package/dist/asteroid.cjs.css +1 -1
- package/dist/asteroid.cjs.js +469 -281
- package/dist/asteroid.cjs.min.js +2 -2
- package/dist/asteroid.esm.css +1 -1
- package/dist/asteroid.esm.js +472 -283
- package/dist/asteroid.esm.min.js +2 -2
- package/dist/asteroid.umd.css +1 -1
- package/dist/asteroid.umd.js +472 -283
- package/dist/asteroid.umd.min.js +2 -2
- package/dist/vetur/asteroid-attributes.json +27 -3
- package/dist/vetur/asteroid-tags.json +9 -3
- package/package.json +1 -1
- package/src/asteroid.js +1 -0
- package/src/components/actions-menu/QasActionsMenu.vue +3 -5
- package/src/components/btn/QasBtn.vue +6 -4
- package/src/components/delete/QasDelete.vue +23 -1
- package/src/components/delete/QasDelete.yml +4 -0
- package/src/components/dialog/QasDialog.vue +2 -2
- package/src/components/field/QasField.vue +1 -2
- package/src/components/filters/QasFilters.vue +6 -2
- package/src/components/filters/QasFilters.yml +4 -0
- package/src/components/form-view/QasFormView.vue +10 -10
- package/src/components/form-view/QasFormView.yml +8 -3
- package/src/components/input/QasInput.vue +43 -2
- package/src/components/input/QasInput.yml +13 -1
- package/src/components/nested-fields/QasNestedFields.vue +47 -35
- package/src/components/page-header/QasPageHeader.vue +4 -2
- package/src/components/password-input/QasPasswordInput.vue +17 -26
- package/src/components/password-input/QasPasswordInput.yml +1 -1
- package/src/components/search-box/QasSearchBox.vue +6 -1
- package/src/components/select-list/QasSelectList.vue +10 -8
- package/src/components/signature-uploader/QasSignatureUploader.vue +38 -2
- package/src/components/signature-uploader/QasSignatureUploader.yml +5 -0
- package/src/components/table-generator/QasTableGenerator.vue +2 -2
- package/src/components/transfer/QasTransfer.vue +9 -7
- package/src/components/uploader/QasUploader.vue +1 -2
- package/src/composables/index.js +1 -0
- package/src/composables/useHistory.js +46 -0
- package/src/directives/Test.js +13 -0
- package/src/helpers/filter-list-by-handle.js +31 -0
- package/src/helpers/filter-object-to-array.js +29 -0
- package/src/helpers/filter-object.js +2 -3
- package/src/helpers/index.js +2 -0
- package/src/index.scss +3 -2
- package/src/mixins/view.js +2 -0
- package/src/pages/Forbidden.vue +12 -0
- package/src/pages/NotFound.vue +12 -0
- package/src/plugins/index.js +2 -0
- package/src/plugins/screen/Screen.js +30 -0
- package/src/plugins/screen/Screen.yml +16 -0
- package/src/vue-plugin.js +12 -3
- package/src/css/transitions.scss +0 -12
- package/src/store/history.js +0 -43
- package/src/store/index.js +0 -1
|
@@ -227,6 +227,10 @@
|
|
|
227
227
|
"description": "Model para saber se está deletando.",
|
|
228
228
|
"type": "boolean"
|
|
229
229
|
},
|
|
230
|
+
"qas-delete/use-auto-delete-route": {
|
|
231
|
+
"description": "Controla se sempre que deletar com sucesso um item, remove todas as rotas do histórico de rotas que contenha id do item deletado.",
|
|
232
|
+
"type": "boolean"
|
|
233
|
+
},
|
|
230
234
|
"qas-dialog/actions-props": {
|
|
231
235
|
"description": "Props repassadas para o \"QasActions\".",
|
|
232
236
|
"type": "object"
|
|
@@ -311,6 +315,10 @@
|
|
|
311
315
|
"description": "Envia como parâmetro para a action \"fetchFilters\" do modulo correspondente a \"entity\".",
|
|
312
316
|
"type": "string"
|
|
313
317
|
},
|
|
318
|
+
"qas-filters/force-refetch": {
|
|
319
|
+
"description": "Força refazer o \"fetch\" mesmo caso já exista dados na store de filters.",
|
|
320
|
+
"type": "boolean"
|
|
321
|
+
},
|
|
314
322
|
"qas-form-generator/error": {
|
|
315
323
|
"description": "Objeto contendo propriedades contendo a mensagem de erro.",
|
|
316
324
|
"type": "object"
|
|
@@ -344,8 +352,8 @@
|
|
|
344
352
|
"type": "string"
|
|
345
353
|
},
|
|
346
354
|
"qas-form-view/cancel-route": {
|
|
347
|
-
"description": "Configuração do botão de \"cancelar\", caso seja \"false\", não exibe o botão, caso precise passar uma path direto use como string,
|
|
348
|
-
"type": "boolean|object|string"
|
|
355
|
+
"description": "Configuração do botão de \"cancelar\", caso seja \"false\", não exibe o botão, caso precise passar uma path direto use como string, caso precisar passar uma configuração como \"name\" ou \"params\" passe como objeto, agora se precisar de uma logica especifica quando clicar no botão de cancelar, você pode passar uma função que ela será executado.",
|
|
356
|
+
"type": "boolean|object|string|function"
|
|
349
357
|
},
|
|
350
358
|
"qas-form-view/custom-id": {
|
|
351
359
|
"description": "Por padrão, o componente vai pegar o \"id\" que vem como parâmetro na url, caso queira que o id seja diferente da url, use esta prop.",
|
|
@@ -481,7 +489,7 @@
|
|
|
481
489
|
},
|
|
482
490
|
"qas-input/model-value": {
|
|
483
491
|
"description": "Model do componente.",
|
|
484
|
-
"type": "string"
|
|
492
|
+
"type": "string|input"
|
|
485
493
|
},
|
|
486
494
|
"qas-input/unmasked-value": {
|
|
487
495
|
"description": "Remove a mascara do v-model.",
|
|
@@ -491,6 +499,18 @@
|
|
|
491
499
|
"description": "Controla borda do input.",
|
|
492
500
|
"type": "boolean"
|
|
493
501
|
},
|
|
502
|
+
"qas-input/error": {
|
|
503
|
+
"description": "Controla cor da borda do input.",
|
|
504
|
+
"type": "boolean"
|
|
505
|
+
},
|
|
506
|
+
"qas-input/error-message": {
|
|
507
|
+
"description": "Controla mensagem de erro (apenas quando \"error\" for \"true\").",
|
|
508
|
+
"type": "string"
|
|
509
|
+
},
|
|
510
|
+
"qas-input/remove-error-on-type": {
|
|
511
|
+
"description": "Limpa os erros do campo caso os mesmos existam toda vez que o model atualiza.",
|
|
512
|
+
"type": "boolean"
|
|
513
|
+
},
|
|
494
514
|
"qas-label/count": {
|
|
495
515
|
"description": "Contador que vai ficar ao lado do texto.",
|
|
496
516
|
"type": "number"
|
|
@@ -947,6 +967,10 @@
|
|
|
947
967
|
"description": "Tipo da imagem gerada.",
|
|
948
968
|
"type": "string"
|
|
949
969
|
},
|
|
970
|
+
"qas-signature-uploader/dialog-props": {
|
|
971
|
+
"description": "Repassa propriedades para o \"QasDialog\".",
|
|
972
|
+
"type": "object"
|
|
973
|
+
},
|
|
950
974
|
"qas-signature-uploader/upload-label": {
|
|
951
975
|
"description": "Rótulo do uploader.",
|
|
952
976
|
"type": "string"
|
|
@@ -127,7 +127,8 @@
|
|
|
127
127
|
"dialog-props",
|
|
128
128
|
"url",
|
|
129
129
|
"tag",
|
|
130
|
-
"deleting"
|
|
130
|
+
"deleting",
|
|
131
|
+
"use-auto-delete-route"
|
|
131
132
|
],
|
|
132
133
|
"description": "Componente para C.R.U.D. responsável por deletar (Delete)."
|
|
133
134
|
},
|
|
@@ -167,7 +168,8 @@
|
|
|
167
168
|
"use-search",
|
|
168
169
|
"use-search-on-type",
|
|
169
170
|
"search-placeholder",
|
|
170
|
-
"url"
|
|
171
|
+
"url",
|
|
172
|
+
"force-refetch"
|
|
171
173
|
],
|
|
172
174
|
"description": "Componente para criação de filtros dinâmicos."
|
|
173
175
|
},
|
|
@@ -237,7 +239,10 @@
|
|
|
237
239
|
"attributes": [
|
|
238
240
|
"model-value",
|
|
239
241
|
"unmasked-value",
|
|
240
|
-
"outlined"
|
|
242
|
+
"outlined",
|
|
243
|
+
"error",
|
|
244
|
+
"error-message",
|
|
245
|
+
"remove-error-on-type"
|
|
241
246
|
],
|
|
242
247
|
"description": "Componente para input que implementa o \"QInput\" repassando propriedades, slots e eventos."
|
|
243
248
|
},
|
|
@@ -437,6 +442,7 @@
|
|
|
437
442
|
},
|
|
438
443
|
"qas-signature-uploader": {
|
|
439
444
|
"attributes": [
|
|
445
|
+
"dialog-props",
|
|
440
446
|
"upload-label",
|
|
441
447
|
"signature-label",
|
|
442
448
|
"model-value",
|
package/package.json
CHANGED
package/src/asteroid.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<qas-btn class="qas-actions-menu" color="primary" hide-label-on-small-screen :icon="icon" :label="label" outline>
|
|
3
|
-
<span>{{ label }}</span>
|
|
4
|
-
|
|
2
|
+
<qas-btn class="qas-actions-menu" color="primary" hide-label-on-small-screen :icon="icon" :label="label" outline padding="md">
|
|
5
3
|
<q-menu class="qas-actions-menu__menu">
|
|
6
4
|
<q-list class="qas-actions-menu__list" separator>
|
|
7
5
|
<slot v-for="(item, key) in list" :item="item" :name="key">
|
|
8
6
|
<q-item :key="key" class="text-bold text-primary" clickable v-bind="item.props" @click="onClick(item)">
|
|
9
7
|
<q-item-section>
|
|
10
8
|
<div class="flex items-center justify-center q-gutter-x-md">
|
|
11
|
-
<q-icon :name="item.icon"
|
|
9
|
+
<q-icon :name="item.icon" size="sm" />
|
|
12
10
|
<div>{{ item.label }}</div>
|
|
13
11
|
</div>
|
|
14
12
|
</q-item-section>
|
|
@@ -18,7 +16,7 @@
|
|
|
18
16
|
<qas-delete v-if="hasDelete" v-bind="deleteProps" class="text-negative" clickable tag="q-item" @success="onDeleteSuccess">
|
|
19
17
|
<q-item-section>
|
|
20
18
|
<div class="flex items-center justify-center q-gutter-x-sm text-bold">
|
|
21
|
-
<q-icon :name="deleteIcon" />
|
|
19
|
+
<q-icon :name="deleteIcon" size="sm" />
|
|
22
20
|
<div>{{ deleteLabel }}</div>
|
|
23
21
|
</div>
|
|
24
22
|
</q-item-section>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<q-btn color="primary" no-caps unelevated v-bind="attributes">
|
|
3
|
-
<slot v-if="showLabel"
|
|
3
|
+
<slot v-if="showLabel" />
|
|
4
4
|
|
|
5
5
|
<template v-for="(_, name) in slots" #[name]="context">
|
|
6
6
|
<slot :name="name" v-bind="context || {}" />
|
|
@@ -16,8 +16,6 @@ export default {
|
|
|
16
16
|
|
|
17
17
|
mixins: [screenMixin],
|
|
18
18
|
|
|
19
|
-
inheritAttrs: false,
|
|
20
|
-
|
|
21
19
|
props: {
|
|
22
20
|
hideLabelOnSmallScreen: {
|
|
23
21
|
type: Boolean
|
|
@@ -27,7 +25,11 @@ export default {
|
|
|
27
25
|
computed: {
|
|
28
26
|
attributes () {
|
|
29
27
|
const { label, ...attributes } = this.$attrs
|
|
30
|
-
|
|
28
|
+
|
|
29
|
+
return {
|
|
30
|
+
...(this.showLabel && { label }),
|
|
31
|
+
...attributes
|
|
32
|
+
}
|
|
31
33
|
},
|
|
32
34
|
|
|
33
35
|
hasLabel () {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<component
|
|
2
|
+
<component v-bind="$attrs" :is="tag" @click="openConfirmDialog">
|
|
3
3
|
<template v-for="(_, name) in $slots" #[name]="context">
|
|
4
4
|
<slot :name="name" v-bind="context || {}" />
|
|
5
5
|
</template>
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
<script>
|
|
12
12
|
import { Loading } from 'quasar'
|
|
13
13
|
import { NotifyError, NotifySuccess } from '../../plugins'
|
|
14
|
+
import { useHistory } from '../../composables'
|
|
14
15
|
|
|
15
16
|
import QasBtn from '../btn/QasBtn.vue'
|
|
16
17
|
import QasDialog from '../dialog/QasDialog.vue'
|
|
@@ -51,6 +52,11 @@ export default {
|
|
|
51
52
|
|
|
52
53
|
deleting: {
|
|
53
54
|
type: Boolean
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
useAutoDeleteRoute: {
|
|
58
|
+
default: true,
|
|
59
|
+
type: Boolean
|
|
54
60
|
}
|
|
55
61
|
},
|
|
56
62
|
|
|
@@ -98,9 +104,21 @@ export default {
|
|
|
98
104
|
this.$emit('update:deleting', true)
|
|
99
105
|
|
|
100
106
|
try {
|
|
107
|
+
const { destroyRoutes, history } = useHistory()
|
|
108
|
+
|
|
101
109
|
await this.$store.dispatch(`${this.entity}/destroy`, { id: this.id, url: this.url })
|
|
110
|
+
|
|
102
111
|
NotifySuccess('Item deletado com sucesso!')
|
|
112
|
+
|
|
113
|
+
if (this.useAutoDeleteRoute) {
|
|
114
|
+
// remove todas rotas que possuem o id do item excluído.
|
|
115
|
+
const routesToBeDeleted = this.getRoutesToBeDeletedById(history.list)
|
|
116
|
+
destroyRoutes(routesToBeDeleted)
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// cria um evento para notificar que o item foi excluído no "window".
|
|
103
120
|
this.createDeleteSuccessEvent()
|
|
121
|
+
|
|
104
122
|
this.$emit('success')
|
|
105
123
|
} catch (error) {
|
|
106
124
|
NotifyError('Ops! Não foi possível deletar o item.')
|
|
@@ -111,6 +129,10 @@ export default {
|
|
|
111
129
|
}
|
|
112
130
|
},
|
|
113
131
|
|
|
132
|
+
getRoutesToBeDeletedById (routes = []) {
|
|
133
|
+
return routes.filter(({ params }) => params.id === this.id)
|
|
134
|
+
},
|
|
135
|
+
|
|
114
136
|
createDeleteSuccessEvent () {
|
|
115
137
|
const event = new CustomEvent('delete-success', {
|
|
116
138
|
bubbles: false,
|
|
@@ -35,6 +35,10 @@ props:
|
|
|
35
35
|
examples: [v-model:deleting="isDeleting"]
|
|
36
36
|
model: true
|
|
37
37
|
|
|
38
|
+
use-auto-delete-route:
|
|
39
|
+
desc: Controla se sempre que deletar com sucesso um item, remove todas as rotas do histórico de rotas que contenha id do item deletado.
|
|
40
|
+
default: true
|
|
41
|
+
type: Boolean
|
|
38
42
|
|
|
39
43
|
slots:
|
|
40
44
|
default:
|
|
@@ -155,12 +155,12 @@ export default {
|
|
|
155
155
|
this.useForm && this.$emit('validate', await this.$refs.form.validate())
|
|
156
156
|
},
|
|
157
157
|
|
|
158
|
-
//
|
|
158
|
+
// método para funcionar como plugin
|
|
159
159
|
show () {
|
|
160
160
|
this.$refs.dialog.show()
|
|
161
161
|
},
|
|
162
162
|
|
|
163
|
-
//
|
|
163
|
+
// método para funcionar como plugin
|
|
164
164
|
hide () {
|
|
165
165
|
this.$refs.dialog.hide()
|
|
166
166
|
},
|
|
@@ -74,7 +74,6 @@ export default {
|
|
|
74
74
|
prefix,
|
|
75
75
|
type,
|
|
76
76
|
mask,
|
|
77
|
-
pattern,
|
|
78
77
|
maxFiles,
|
|
79
78
|
searchable,
|
|
80
79
|
gmt
|
|
@@ -125,7 +124,7 @@ export default {
|
|
|
125
124
|
number: { is: 'qas-input', type: 'number', ...input },
|
|
126
125
|
hidden: { is: 'input', name, type },
|
|
127
126
|
email: { is: 'qas-input', type, ...input },
|
|
128
|
-
password: { is: 'qas-password-input',
|
|
127
|
+
password: { is: 'qas-password-input', ...input },
|
|
129
128
|
|
|
130
129
|
decimal: { ...numericInput, mode: 'decimal' },
|
|
131
130
|
money: { ...numericInput, mode: 'money' },
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
<slot v-if="showFilterButton" :filter="filter" name="filter-button">
|
|
18
18
|
<q-btn v-if="useFilterButton" :color="filterButtonColor" flat icon="o_filter_list" :label="filterButtonLabel">
|
|
19
|
-
<q-menu
|
|
19
|
+
<q-menu>
|
|
20
20
|
<div v-if="isFetching" class="q-pa-xl text-center">
|
|
21
21
|
<q-spinner color="grey" size="2em" />
|
|
22
22
|
</div>
|
|
@@ -98,6 +98,10 @@ export default {
|
|
|
98
98
|
url: {
|
|
99
99
|
default: '',
|
|
100
100
|
type: String
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
forceRefetch: {
|
|
104
|
+
type: Boolean
|
|
101
105
|
}
|
|
102
106
|
},
|
|
103
107
|
|
|
@@ -227,7 +231,7 @@ export default {
|
|
|
227
231
|
},
|
|
228
232
|
|
|
229
233
|
async fetchFilters () {
|
|
230
|
-
if (this.hasFields || !this.useFilterButton) {
|
|
234
|
+
if (!this.forceRefetch && (this.hasFields || !this.useFilterButton)) {
|
|
231
235
|
return null
|
|
232
236
|
}
|
|
233
237
|
|
|
@@ -38,6 +38,10 @@ props:
|
|
|
38
38
|
desc: Envia como parâmetro para a action "fetchFilters" do modulo correspondente a "entity".
|
|
39
39
|
type: String
|
|
40
40
|
|
|
41
|
+
force-refetch:
|
|
42
|
+
desc: Força refazer o "fetch" mesmo caso já exista dados na store de filters.
|
|
43
|
+
type: Boolean
|
|
44
|
+
|
|
41
45
|
slots:
|
|
42
46
|
search:
|
|
43
47
|
desc: Slot para seção do campo de busca.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<component :is="mx_componentTag">
|
|
2
|
+
<component :is="mx_componentTag" :class="mx_componentClass">
|
|
3
3
|
<header v-if="mx_hasHeaderSlot">
|
|
4
4
|
<slot name="header" />
|
|
5
5
|
</header>
|
|
@@ -36,7 +36,7 @@ import { isEqualWith } from 'lodash-es'
|
|
|
36
36
|
import { extend } from 'quasar'
|
|
37
37
|
import { onBeforeRouteLeave } from 'vue-router'
|
|
38
38
|
|
|
39
|
-
import {
|
|
39
|
+
import { useHistory } from '../../composables'
|
|
40
40
|
import { NotifyError, NotifySuccess } from '../../plugins'
|
|
41
41
|
|
|
42
42
|
import QasBtn from '../btn/QasBtn.vue'
|
|
@@ -62,7 +62,7 @@ export default {
|
|
|
62
62
|
|
|
63
63
|
cancelRoute: {
|
|
64
64
|
default: '',
|
|
65
|
-
type: [Boolean, Object, String]
|
|
65
|
+
type: [Boolean, Object, String, Function]
|
|
66
66
|
},
|
|
67
67
|
|
|
68
68
|
customId: {
|
|
@@ -181,10 +181,6 @@ export default {
|
|
|
181
181
|
return this.disable || this.isSubmitting
|
|
182
182
|
},
|
|
183
183
|
|
|
184
|
-
history () {
|
|
185
|
-
return history.list
|
|
186
|
-
},
|
|
187
|
-
|
|
188
184
|
fieldsNameWithDefaultValue () {
|
|
189
185
|
return Object.keys(this.fields).filter(field => 'default' in this.fields[field])
|
|
190
186
|
}
|
|
@@ -253,7 +249,7 @@ export default {
|
|
|
253
249
|
this.mx_updateModels({
|
|
254
250
|
errors: errors,
|
|
255
251
|
fields: this.mx_fields,
|
|
256
|
-
metadata
|
|
252
|
+
metadata
|
|
257
253
|
})
|
|
258
254
|
|
|
259
255
|
if (result) {
|
|
@@ -282,9 +278,11 @@ export default {
|
|
|
282
278
|
},
|
|
283
279
|
|
|
284
280
|
handleCancelRoute () {
|
|
285
|
-
|
|
281
|
+
if (typeof this.cancelRoute === 'function') {
|
|
282
|
+
return this.cancelRoute()
|
|
283
|
+
}
|
|
286
284
|
|
|
287
|
-
if (this.cancelRoute &&
|
|
285
|
+
if (this.cancelRoute && ['string', 'object'].includes(typeof this.cancelRoute)) {
|
|
288
286
|
return this.$router.push(this.cancelRoute)
|
|
289
287
|
}
|
|
290
288
|
|
|
@@ -297,6 +295,8 @@ export default {
|
|
|
297
295
|
handleDialog (next) {
|
|
298
296
|
this.openDialog()
|
|
299
297
|
|
|
298
|
+
const { addRoute } = useHistory()
|
|
299
|
+
|
|
300
300
|
this.defaultDialogProps.ok.onClick = () => addRoute(this.$route)
|
|
301
301
|
this.defaultDialogProps.cancel.onClick = next
|
|
302
302
|
},
|
|
@@ -10,10 +10,15 @@ props:
|
|
|
10
10
|
type: String
|
|
11
11
|
|
|
12
12
|
cancel-route:
|
|
13
|
-
desc: Configuração do botão de "cancelar", caso seja "false", não exibe o botão, caso precise passar uma path direto use como string,
|
|
13
|
+
desc: Configuração do botão de "cancelar", caso seja "false", não exibe o botão, caso precise passar uma path direto use como string, caso precisar passar uma configuração como "name" ou "params" passe como objeto, agora se precisar de uma logica especifica quando clicar no botão de cancelar, você pode passar uma função que ela será executado.
|
|
14
14
|
default: "''"
|
|
15
|
-
type: [Boolean, Object, String]
|
|
16
|
-
examples: [
|
|
15
|
+
type: [Boolean, Object, String, Function]
|
|
16
|
+
examples: [
|
|
17
|
+
/users,
|
|
18
|
+
false,
|
|
19
|
+
"{ name: 'UsersForm', params: { id: 'uuid-1' } }",
|
|
20
|
+
() => alert('Lógica especifica.')
|
|
21
|
+
]
|
|
17
22
|
|
|
18
23
|
custom-id:
|
|
19
24
|
desc: Por padrão, o componente vai pegar o "id" que vem como parâmetro na url, caso queira que o id seja diferente da url, use esta prop.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
|
-
<q-input ref="input" v-model="model" bottom-slots v-bind="$attrs" :mask="mask" :outlined="outlined" :unmasked-value="unmaskedValue">
|
|
3
|
+
<q-input ref="input" v-model="model" bottom-slots :error="errorData" v-bind="$attrs" :error-message="errorMessageData" :mask="mask" :outlined="outlined" :unmasked-value="unmaskedValue">
|
|
4
4
|
<template v-for="(_, name) in $slots" #[name]="context">
|
|
5
5
|
<slot :name="name" v-bind="context || {}" />
|
|
6
6
|
</template>
|
|
@@ -17,7 +17,7 @@ export default {
|
|
|
17
17
|
props: {
|
|
18
18
|
modelValue: {
|
|
19
19
|
default: '',
|
|
20
|
-
type: String
|
|
20
|
+
type: [String, Number]
|
|
21
21
|
},
|
|
22
22
|
|
|
23
23
|
unmaskedValue: {
|
|
@@ -28,11 +28,31 @@ export default {
|
|
|
28
28
|
outlined: {
|
|
29
29
|
default: true,
|
|
30
30
|
type: Boolean
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
removeErrorOnType: {
|
|
34
|
+
type: Boolean
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
error: {
|
|
38
|
+
type: Boolean
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
errorMessage: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: ''
|
|
31
44
|
}
|
|
32
45
|
},
|
|
33
46
|
|
|
34
47
|
emits: ['update:modelValue'],
|
|
35
48
|
|
|
49
|
+
data () {
|
|
50
|
+
return {
|
|
51
|
+
errorData: false,
|
|
52
|
+
messageErrorData: ''
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
|
|
36
56
|
computed: {
|
|
37
57
|
hasError () {
|
|
38
58
|
return this.inputReference.hasError
|
|
@@ -65,6 +85,11 @@ export default {
|
|
|
65
85
|
},
|
|
66
86
|
|
|
67
87
|
set (value) {
|
|
88
|
+
if (this.removeErrorOnType && this.error) {
|
|
89
|
+
this.errorData = false
|
|
90
|
+
this.errorMessageData = ''
|
|
91
|
+
}
|
|
92
|
+
|
|
68
93
|
return this.$emit('update:modelValue', value)
|
|
69
94
|
}
|
|
70
95
|
}
|
|
@@ -77,6 +102,22 @@ export default {
|
|
|
77
102
|
requestAnimationFrame(() => {
|
|
78
103
|
input.selectionStart = input.value ? input.value.length : ''
|
|
79
104
|
})
|
|
105
|
+
},
|
|
106
|
+
|
|
107
|
+
error: {
|
|
108
|
+
handler (value) {
|
|
109
|
+
this.errorData = value
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
immediate: true
|
|
113
|
+
},
|
|
114
|
+
|
|
115
|
+
errorMessage: {
|
|
116
|
+
handler (value) {
|
|
117
|
+
this.errorMessageData = value
|
|
118
|
+
},
|
|
119
|
+
|
|
120
|
+
immediate: true
|
|
80
121
|
}
|
|
81
122
|
},
|
|
82
123
|
|
|
@@ -9,7 +9,7 @@ meta:
|
|
|
9
9
|
props:
|
|
10
10
|
model-value:
|
|
11
11
|
desc: Model do componente.
|
|
12
|
-
type: String
|
|
12
|
+
type: [String, Input]
|
|
13
13
|
examples: [v-model="value"]
|
|
14
14
|
model: true
|
|
15
15
|
|
|
@@ -23,6 +23,18 @@ props:
|
|
|
23
23
|
default: true
|
|
24
24
|
type: Boolean
|
|
25
25
|
|
|
26
|
+
error:
|
|
27
|
+
desc: Controla cor da borda do input.
|
|
28
|
+
type: Boolean
|
|
29
|
+
|
|
30
|
+
error-message:
|
|
31
|
+
desc: Controla mensagem de erro (apenas quando "error" for "true").
|
|
32
|
+
type: String
|
|
33
|
+
|
|
34
|
+
remove-error-on-type:
|
|
35
|
+
desc: Limpa os erros do campo caso os mesmos existam toda vez que o model atualiza.
|
|
36
|
+
type: Boolean
|
|
37
|
+
|
|
26
38
|
events:
|
|
27
39
|
'@update:model-value -> function (value)':
|
|
28
40
|
desc: Dispara toda vez que o model é atualizado, também utilizado para v-model.
|
|
@@ -4,46 +4,44 @@
|
|
|
4
4
|
<qas-label v-if="useSingleLabel" :label="fieldLabel" />
|
|
5
5
|
</div>
|
|
6
6
|
|
|
7
|
-
<div>
|
|
8
|
-
<component :is="componentTag"
|
|
9
|
-
<div v-for="(row, index) in nested" :id="`row-${index}`" :key="index" class="full-width">
|
|
10
|
-
<
|
|
11
|
-
<div
|
|
12
|
-
<div>
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
<qas-btn v-if="showDestroyBtn" v-bind="btnDestroyProps" @click="destroy(index, row)" />
|
|
19
|
-
</div>
|
|
7
|
+
<div ref="inputContent">
|
|
8
|
+
<component :is="componentTag" v-bind="componentProps">
|
|
9
|
+
<div v-for="(row, index) in nested" :id="`row-${index}`" :key="`row-${index}`" class="full-width">
|
|
10
|
+
<div v-if="!row[destroyKey]" :key="index" class="col-12 q-mt-md">
|
|
11
|
+
<div>
|
|
12
|
+
<div class="flex items-center justify-between q-py-xs">
|
|
13
|
+
<qas-label v-if="!useSingleLabel" :label="setRowLabel(index)" />
|
|
14
|
+
|
|
15
|
+
<div v-if="!useInlineActions" class="q-gutter-x-sm">
|
|
16
|
+
<qas-btn v-if="useDuplicate" v-bind="btnDuplicateProps" @click="add(row)" />
|
|
17
|
+
<qas-btn v-if="showDestroyBtn" v-bind="btnDestroyProps" @click="destroy(index, row)" />
|
|
20
18
|
</div>
|
|
19
|
+
</div>
|
|
21
20
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
</div>
|
|
21
|
+
<div ref="formGenerator" class="col-12 justify-between q-col-gutter-x-md row">
|
|
22
|
+
<slot :errors="transformedErrors" :fields="children" :index="index" name="fields" :update-value="updateValuesFromInput">
|
|
23
|
+
<qas-form-generator v-model="nested[index]" :class="formClasses" :columns="formColumns" :errors="transformedErrors[index]" :fields="children" :fields-props="fieldsProps" @update:model-value="updateValuesFromInput($event, index)">
|
|
24
|
+
<template v-for="(slot, key) in $slots" #[key]="scope">
|
|
25
|
+
<slot v-bind="scope" :errors="transformedErrors" :index="index" :name="key" />
|
|
26
|
+
</template>
|
|
27
|
+
</qas-form-generator>
|
|
28
|
+
</slot>
|
|
29
|
+
|
|
30
|
+
<div v-if="useInlineActions" class="flex items-center qas-nested-fields__actions">
|
|
31
|
+
<div class="col-auto">
|
|
32
|
+
<qas-btn v-if="useDuplicate" color="primary" flat icon="o_content_copy" round @click="add(row)" />
|
|
33
|
+
</div>
|
|
34
|
+
<div class="col-auto">
|
|
35
|
+
<qas-btn v-if="showDestroyBtn" color="negative" flat icon="o_cancel" round @click="destroy(index, row)" />
|
|
38
36
|
</div>
|
|
39
37
|
</div>
|
|
38
|
+
</div>
|
|
40
39
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
</div>
|
|
40
|
+
<div class="col-12">
|
|
41
|
+
<slot :fields="children" :index="index" :model="nested[index]" name="custom-fields" :update-value="updateValuesFromInput" />
|
|
44
42
|
</div>
|
|
45
43
|
</div>
|
|
46
|
-
</
|
|
44
|
+
</div>
|
|
47
45
|
</div>
|
|
48
46
|
</component>
|
|
49
47
|
|
|
@@ -60,7 +58,7 @@
|
|
|
60
58
|
</div>
|
|
61
59
|
|
|
62
60
|
<div v-else class="q-mt-lg">
|
|
63
|
-
<qas-btn class="full-width q-py-
|
|
61
|
+
<qas-btn class="full-width q-py-md" icon="o_add" outline @click="add()">{{ addInputLabel }}</qas-btn>
|
|
64
62
|
</div>
|
|
65
63
|
</slot>
|
|
66
64
|
</div>
|
|
@@ -73,6 +71,7 @@ import QasBtn from '../btn/QasBtn.vue'
|
|
|
73
71
|
import QasFormGenerator from '../form-generator/QasFormGenerator.vue'
|
|
74
72
|
import QasInput from '../input/QasInput.vue'
|
|
75
73
|
import QasLabel from '../label/QasLabel.vue'
|
|
74
|
+
import { TransitionGroup } from 'vue'
|
|
76
75
|
|
|
77
76
|
import { constructObject } from '../../helpers'
|
|
78
77
|
import { extend } from 'quasar'
|
|
@@ -85,7 +84,10 @@ export default {
|
|
|
85
84
|
QasBtn,
|
|
86
85
|
QasFormGenerator,
|
|
87
86
|
QasInput,
|
|
88
|
-
QasLabel
|
|
87
|
+
QasLabel,
|
|
88
|
+
|
|
89
|
+
// vue
|
|
90
|
+
TransitionGroup
|
|
89
91
|
},
|
|
90
92
|
|
|
91
93
|
props: {
|
|
@@ -249,6 +251,16 @@ export default {
|
|
|
249
251
|
|
|
250
252
|
componentTag () {
|
|
251
253
|
return this.useAnimation ? 'transition-group' : 'div'
|
|
254
|
+
},
|
|
255
|
+
|
|
256
|
+
componentProps () {
|
|
257
|
+
if (!this.useAnimation) return {}
|
|
258
|
+
|
|
259
|
+
return {
|
|
260
|
+
tag: 'div',
|
|
261
|
+
enterActiveClass: 'animated slideInDown',
|
|
262
|
+
leaveActiveClass: 'animated slideOutUp'
|
|
263
|
+
}
|
|
252
264
|
}
|
|
253
265
|
},
|
|
254
266
|
|