@bildvitta/quasar-ui-asteroid 3.0.0-beta.7 → 3.0.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/dist/api/QasAppBar.json +0 -4
- package/dist/api/QasBtn.json +2 -1
- package/dist/api/QasCard.json +13 -9
- package/dist/api/QasDateTimeInput.json +12 -12
- package/dist/api/QasDialog.json +6 -2
- package/dist/api/QasFilters.json +4 -4
- package/dist/api/QasFormGenerator.json +33 -2
- package/dist/api/QasFormView.json +43 -15
- package/dist/api/QasGridGenerator.json +5 -4
- package/dist/api/QasInput.json +1 -1
- package/dist/api/QasListItems.json +18 -17
- package/dist/api/QasListView.json +21 -7
- package/dist/api/QasNestedFields.json +13 -3
- package/dist/api/QasNumericInput.json +10 -10
- package/dist/api/QasPasswordInput.json +1 -1
- package/dist/api/QasSearchBox.json +85 -3
- package/dist/api/QasSelect.json +81 -14
- package/dist/api/QasSelectList.json +16 -14
- package/dist/api/QasSignaturePad.json +1 -1
- package/dist/api/QasSingleView.json +13 -4
- package/dist/api/QasTabsGenerator.json +5 -2
- package/dist/api/QasUploader.json +5 -0
- package/dist/asteroid.cjs.css +1 -1
- package/dist/asteroid.cjs.js +1522 -706
- package/dist/asteroid.cjs.min.js +2 -2
- package/dist/asteroid.esm.css +1 -1
- package/dist/asteroid.esm.js +1525 -709
- package/dist/asteroid.esm.min.js +2 -2
- package/dist/asteroid.umd.css +1 -1
- package/dist/asteroid.umd.js +1525 -710
- package/dist/asteroid.umd.min.js +2 -2
- package/dist/vetur/asteroid-attributes.json +176 -100
- package/dist/vetur/asteroid-tags.json +60 -41
- package/package.json +1 -1
- package/src/components/actions-menu/QasActionsMenu.vue +2 -8
- package/src/components/app-bar/QasAppBar.vue +16 -12
- package/src/components/app-bar/QasAppBar.yml +0 -4
- package/src/components/avatar/QasAvatar.vue +0 -4
- package/src/components/btn/QasBtn.vue +5 -8
- package/src/components/btn/QasBtn.yml +2 -1
- package/src/components/card/QasCard.vue +18 -9
- package/src/components/card/QasCard.yml +13 -9
- package/src/components/date-time-input/QasDateTimeInput.vue +39 -41
- package/src/components/date-time-input/QasDateTimeInput.yml +11 -12
- package/src/components/delete/QasDelete.vue +15 -1
- package/src/components/dialog/QasDialog.vue +26 -3
- package/src/components/dialog/QasDialog.yml +6 -3
- package/src/components/dialog-router/QasDialogRouter.vue +1 -1
- package/src/components/field/QasField.vue +15 -14
- package/src/components/filters/QasFilters.vue +27 -10
- package/src/components/filters/QasFilters.yml +4 -4
- package/src/components/form-generator/QasFormGenerator.vue +87 -12
- package/src/components/form-generator/QasFormGenerator.yml +16 -2
- package/src/components/form-view/QasFormView.vue +138 -56
- package/src/components/form-view/QasFormView.yml +39 -15
- package/src/components/grid-generator/QasGridGenerator.vue +23 -7
- package/src/components/grid-generator/QasGridGenerator.yml +5 -4
- package/src/components/input/QasInput.vue +37 -21
- package/src/components/input/QasInput.yml +1 -1
- package/src/components/layout/QasLayout.vue +4 -0
- package/src/components/list-items/QasListItems.vue +15 -23
- package/src/components/list-items/QasListItems.yml +14 -15
- package/src/components/list-view/QasListView.vue +45 -24
- package/src/components/list-view/QasListView.yml +19 -7
- package/src/components/map/QasMap.vue +5 -5
- package/src/components/nested-fields/QasNestedFields.vue +29 -21
- package/src/components/nested-fields/QasNestedFields.yml +9 -3
- package/src/components/numeric-input/QasNumericInput.vue +14 -14
- package/src/components/numeric-input/QasNumericInput.yml +10 -10
- package/src/components/page-header/QasPageHeader.vue +14 -11
- package/src/components/password-input/QasPasswordInput.vue +17 -16
- package/src/components/password-input/QasPasswordInput.yml +1 -1
- package/src/components/profile/QasProfile.vue +1 -1
- package/src/components/search-box/QasSearchBox.vue +138 -42
- package/src/components/search-box/QasSearchBox.yml +69 -2
- package/src/components/select/QasSelect.vue +63 -53
- package/src/components/select/QasSelect.yml +64 -13
- package/src/components/select-list/QasSelectList.vue +11 -27
- package/src/components/select-list/QasSelectList.yml +13 -14
- package/src/components/signature-pad/QasSignaturePad.yml +1 -1
- package/src/components/signature-uploader/QasSignatureUploader.vue +7 -5
- package/src/components/single-view/QasSingleView.vue +22 -6
- package/src/components/single-view/QasSingleView.yml +11 -4
- package/src/components/table-generator/QasTableGenerator.vue +13 -2
- package/src/components/tabs-generator/QasTabsGenerator.vue +2 -2
- package/src/components/tabs-generator/QasTabsGenerator.yml +2 -2
- package/src/components/text-truncate/QasTextTruncate.vue +1 -1
- package/src/components/uploader/QasUploader.vue +62 -15
- package/src/components/uploader/QasUploader.yml +5 -0
- package/src/helpers/camelize-fields-name.js +15 -0
- package/src/helpers/filters.js +2 -0
- package/src/helpers/get-normalized-options.js +20 -0
- package/src/helpers/handle-process.js +13 -0
- package/src/helpers/index.js +3 -0
- package/src/mixins/generator.js +10 -2
- package/src/mixins/index.js +2 -0
- package/src/mixins/search-filter.js +227 -0
- package/src/mixins/view.js +35 -13
- package/src/pages/Forbidden.vue +3 -1
- package/src/pages/NotFound.vue +3 -1
- package/src/pages/ServerError.vue +3 -1
- package/src/pages/Unauthorized.vue +28 -0
- package/src/plugins/index.js +4 -2
- package/src/plugins/logger/Logger.js +44 -0
- package/src/plugins/logger/Logger.yml +9 -0
- package/src/vue-plugin.js +6 -3
|
@@ -7,33 +7,55 @@ meta:
|
|
|
7
7
|
desc: Componente para select que implementa o "QSelect" repassando propriedades, slots e eventos.
|
|
8
8
|
|
|
9
9
|
props:
|
|
10
|
+
entity:
|
|
11
|
+
desc: Entidade enviada para a action "fetchFieldOptions" (usar somente quando "useLazyLoading" estiver habilitada).
|
|
12
|
+
default: ''
|
|
13
|
+
type: String
|
|
14
|
+
examples: [users]
|
|
15
|
+
|
|
16
|
+
fetching:
|
|
17
|
+
desc: Usado para saber quando o componente está fazendo fetching (usar somente quando "useLazyLoading" estiver habilitada).
|
|
18
|
+
default: false
|
|
19
|
+
type: Boolean
|
|
20
|
+
model: true
|
|
21
|
+
examples: [v-model:fetching="isFetching"]
|
|
22
|
+
|
|
10
23
|
fuse-options:
|
|
11
24
|
desc: Opções do Fuse.js (https://fusejs.io/api/options.html).
|
|
12
25
|
type: Object
|
|
13
26
|
debugger: true
|
|
14
27
|
default:
|
|
15
|
-
|
|
16
|
-
includeScore: true
|
|
28
|
+
ignoreLocation: true
|
|
17
29
|
keys: [label, value]
|
|
18
|
-
location: 0
|
|
19
|
-
maxPatternLength: 32
|
|
20
|
-
minMatchCharLength: 1
|
|
21
|
-
shouldSort: true
|
|
22
30
|
threshold: 0.1
|
|
23
|
-
tokenize: true
|
|
24
31
|
|
|
25
32
|
label-key:
|
|
26
33
|
desc: O componente internamente espera receber na propriedade "options" um array de objeto contendo "label" e "value", caso o seu objeto não tenha "label" mas um "name" por exemplo, você pode definir esta prop "label-key" como "name".
|
|
27
34
|
type: String
|
|
28
35
|
examples: [label-key="name"]
|
|
29
36
|
|
|
37
|
+
lazy-loading-props:
|
|
38
|
+
desc: Propriedades para o lazy loading (usar somente quando "useLazyLoading" estiver habilitada).
|
|
39
|
+
type: Object
|
|
40
|
+
debugger: true
|
|
41
|
+
default:
|
|
42
|
+
decamelizeFieldName: true
|
|
43
|
+
url: ''
|
|
44
|
+
params:
|
|
45
|
+
limit: 48
|
|
46
|
+
|
|
30
47
|
model-value:
|
|
31
48
|
desc: Model do componente.
|
|
32
49
|
default: []
|
|
33
|
-
type: [Array, Object, String, Number]
|
|
50
|
+
type: [Array, Object, String, Number, Boolean]
|
|
34
51
|
examples: [v-model="value"]
|
|
35
52
|
model: true
|
|
36
53
|
|
|
54
|
+
name:
|
|
55
|
+
desc: Nome do campo a ser enviado para a action "fetchFieldOptions" (usar somente quando "useLazyLoading" estiver habilitada).
|
|
56
|
+
type: String
|
|
57
|
+
examples: [cities]
|
|
58
|
+
|
|
37
59
|
no-option-label:
|
|
38
60
|
desc: Rótulo padrão de quando os options estão vazios.
|
|
39
61
|
default: Nenhum resultado foi encontrado.
|
|
@@ -44,19 +66,48 @@ props:
|
|
|
44
66
|
default: []
|
|
45
67
|
type: Array
|
|
46
68
|
|
|
47
|
-
searchable:
|
|
48
|
-
desc: Controla se vai ou não ter campo de busca no select.
|
|
49
|
-
type: Boolean
|
|
50
|
-
|
|
51
69
|
value-key:
|
|
52
70
|
desc: O componente internamente espera receber na propriedade "options" um array de objeto contendo "label" e "value", caso o seu objeto não tenha "value" mas um "uuid" por exemplo, você pode definir esta prop "label-value" como "uuid".
|
|
53
71
|
type: String
|
|
54
72
|
examples: [value-key="uuid"]
|
|
55
73
|
|
|
74
|
+
use-search:
|
|
75
|
+
desc: Controla se vai ou não ter campo de busca no select.
|
|
76
|
+
type: Boolean
|
|
77
|
+
|
|
78
|
+
use-lazy-loading:
|
|
79
|
+
desc: Controla a busca pela store "fetchFieldOptions".
|
|
80
|
+
default: false
|
|
81
|
+
type: Boolean
|
|
82
|
+
|
|
56
83
|
events:
|
|
57
84
|
'@update:model-value -> function (value)':
|
|
58
85
|
desc: Dispara toda vez que o model é atualizado, também utilizado para v-model.
|
|
59
86
|
params:
|
|
60
87
|
value:
|
|
61
88
|
desc: Novo valor do v-model
|
|
62
|
-
type: [Array, Object, String, Number]
|
|
89
|
+
type: [Array, Object, String, Number, Boolean]
|
|
90
|
+
|
|
91
|
+
'@update:fetching -> function (value)':
|
|
92
|
+
desc: Dispara toda vez que o campo de busca faz o fetch do lazy loading
|
|
93
|
+
params:
|
|
94
|
+
value:
|
|
95
|
+
desc: Novo valor do v-model:fetching
|
|
96
|
+
default: false
|
|
97
|
+
type: Boolean
|
|
98
|
+
|
|
99
|
+
'@fetch-options-success -> function (value)':
|
|
100
|
+
desc: Dispara toda vez que o campo de busca faz o fetch do lazy loading com sucesso.
|
|
101
|
+
params:
|
|
102
|
+
value:
|
|
103
|
+
desc: Valor retornado pela action "fetchFieldOptions"
|
|
104
|
+
default: {}
|
|
105
|
+
type: Object
|
|
106
|
+
|
|
107
|
+
'@fetch-options-error -> function (value)':
|
|
108
|
+
desc: Dispara toda vez que o campo de busca faz o fetch do lazy loading e cai em uma exceção.
|
|
109
|
+
params:
|
|
110
|
+
value:
|
|
111
|
+
desc: Valor retornado pela action "fetchFieldOptions"
|
|
112
|
+
default: {}
|
|
113
|
+
type: Object
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<slot v-bind="slotData" :item="result" name="item">
|
|
7
7
|
<slot name="item-section" :result="result">
|
|
8
8
|
<q-item-section class="items-start text-bold">
|
|
9
|
-
<div :class="labelClass" @click="
|
|
9
|
+
<div :class="labelClass" @click="onClickLabel({ item: result, index })">{{ result.label }}</div>
|
|
10
10
|
</q-item-section>
|
|
11
11
|
</slot>
|
|
12
12
|
|
|
@@ -56,26 +56,16 @@ export default {
|
|
|
56
56
|
default: () => []
|
|
57
57
|
},
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
type: Object
|
|
62
|
-
},
|
|
63
|
-
|
|
64
|
-
redirectKey: {
|
|
65
|
-
default: 'uuid',
|
|
66
|
-
type: String
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
paramKey: {
|
|
70
|
-
default: 'id',
|
|
71
|
-
type: String
|
|
59
|
+
useClickableLabel: {
|
|
60
|
+
type: Boolean
|
|
72
61
|
}
|
|
73
62
|
},
|
|
74
63
|
|
|
75
64
|
emits: [
|
|
76
65
|
'added',
|
|
77
|
-
'
|
|
78
|
-
'removed'
|
|
66
|
+
'click-label',
|
|
67
|
+
'removed',
|
|
68
|
+
'update:modelValue'
|
|
79
69
|
],
|
|
80
70
|
|
|
81
71
|
data () {
|
|
@@ -87,12 +77,8 @@ export default {
|
|
|
87
77
|
},
|
|
88
78
|
|
|
89
79
|
computed: {
|
|
90
|
-
isRedirectEnabled () {
|
|
91
|
-
return Object.keys(this.to).length
|
|
92
|
-
},
|
|
93
|
-
|
|
94
80
|
labelClass () {
|
|
95
|
-
return this.
|
|
81
|
+
return this.useClickableLabel && 'cursor-pointer'
|
|
96
82
|
},
|
|
97
83
|
|
|
98
84
|
slotData () {
|
|
@@ -121,6 +107,7 @@ export default {
|
|
|
121
107
|
this.values = [...value]
|
|
122
108
|
},
|
|
123
109
|
|
|
110
|
+
deep: true,
|
|
124
111
|
immediate: true
|
|
125
112
|
}
|
|
126
113
|
},
|
|
@@ -142,7 +129,7 @@ export default {
|
|
|
142
129
|
|
|
143
130
|
return {
|
|
144
131
|
dense: this.$qas.screen.isSmall,
|
|
145
|
-
|
|
132
|
+
useLabelOnSmallScreen: false,
|
|
146
133
|
icon: !this.$qas.screen.isSmall ? undefined : isSelected ? 'o_close' : 'o_add',
|
|
147
134
|
label: isSelected ? 'Remover' : 'Adicionar',
|
|
148
135
|
outline: isSelected,
|
|
@@ -167,11 +154,8 @@ export default {
|
|
|
167
154
|
})
|
|
168
155
|
},
|
|
169
156
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
params: { [this.paramKey]: item[this.redirectKey] },
|
|
173
|
-
...this.to
|
|
174
|
-
})
|
|
157
|
+
onClickLabel ({ item, index }) {
|
|
158
|
+
this.useClickableLabel && this.$emit('click-label', { item, index })
|
|
175
159
|
},
|
|
176
160
|
|
|
177
161
|
remove (item) {
|
|
@@ -28,20 +28,9 @@ props:
|
|
|
28
28
|
examples: [v-model="value"]
|
|
29
29
|
model: true
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
desc:
|
|
33
|
-
|
|
34
|
-
type: String
|
|
35
|
-
|
|
36
|
-
redirect-key:
|
|
37
|
-
desc: Controla qual propriedade será a chave primaria para fazer o redirecionamento.
|
|
38
|
-
default: uuid
|
|
39
|
-
type: String
|
|
40
|
-
|
|
41
|
-
to:
|
|
42
|
-
desc: 'Configuração do vue-router para enviar no $route.push({ ...to, params: {...} }).'
|
|
43
|
-
default: Pesquisar
|
|
44
|
-
type: String
|
|
31
|
+
use-clickable-label:
|
|
32
|
+
desc: Habilita "cursor-pointer" no label e evento "click-label".
|
|
33
|
+
type: Boolean
|
|
45
34
|
|
|
46
35
|
slots:
|
|
47
36
|
item:
|
|
@@ -98,6 +87,16 @@ events:
|
|
|
98
87
|
desc: Item adicionado
|
|
99
88
|
type: String
|
|
100
89
|
|
|
90
|
+
'@click-label -> function ({ item, index })':
|
|
91
|
+
desc: Dispara toda vez que o label do item é clicado **SE** a propriedade "useClickableLabel" for "true".
|
|
92
|
+
params:
|
|
93
|
+
item:
|
|
94
|
+
desc: Item clicado
|
|
95
|
+
type: Object
|
|
96
|
+
index:
|
|
97
|
+
desc: Posição do item
|
|
98
|
+
type: Number
|
|
99
|
+
|
|
101
100
|
'@removed -> function (item, index)':
|
|
102
101
|
desc: Dispara toda vez que um item é removido do v-model.
|
|
103
102
|
params:
|
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
<div v-if="uploadLabel" class="q-uploader__title">{{ uploadLabel }}</div>
|
|
8
8
|
</div>
|
|
9
9
|
|
|
10
|
-
<
|
|
10
|
+
<qas-btn v-if="!readonly" color="white" dense flat icon="o_add" round @click="openDialog" />
|
|
11
11
|
|
|
12
|
-
<
|
|
13
|
-
<
|
|
12
|
+
<qas-btn ref="forceUpload" class="hidden" @click="upload(scope)" />
|
|
13
|
+
<qas-btn ref="buttonCleanFiles" class="hidden" @click="scope.removeUploadedFiles" />
|
|
14
14
|
</div>
|
|
15
15
|
</template>
|
|
16
16
|
</qas-uploader>
|
|
@@ -27,14 +27,15 @@
|
|
|
27
27
|
</template>
|
|
28
28
|
|
|
29
29
|
<template #actions>
|
|
30
|
-
<
|
|
31
|
-
<
|
|
30
|
+
<qas-btn class="full-width" color="primary" :disable="isEmpty" label="Salvar" no-caps @click="getSignatureData" />
|
|
31
|
+
<qas-btn class="full-width q-mt-sm" color="primary" flat label="Cancelar" no-caps @click="closeSignature" />
|
|
32
32
|
</template>
|
|
33
33
|
</qas-dialog>
|
|
34
34
|
</div>
|
|
35
35
|
</template>
|
|
36
36
|
|
|
37
37
|
<script>
|
|
38
|
+
import QasBtn from '../btn/QasBtn.vue'
|
|
38
39
|
import QasDialog from '../dialog/QasDialog.vue'
|
|
39
40
|
import QasUploader from '../uploader/QasUploader.vue'
|
|
40
41
|
import QasSignaturePad from '../signature-pad/QasSignaturePad.vue'
|
|
@@ -45,6 +46,7 @@ export default {
|
|
|
45
46
|
name: 'QasSignatureUploader',
|
|
46
47
|
|
|
47
48
|
components: {
|
|
49
|
+
QasBtn,
|
|
48
50
|
QasDialog,
|
|
49
51
|
QasUploader,
|
|
50
52
|
QasSignaturePad
|
|
@@ -66,7 +66,9 @@ export default {
|
|
|
66
66
|
|
|
67
67
|
watch: {
|
|
68
68
|
$route (to, from) {
|
|
69
|
-
to.name === from.name
|
|
69
|
+
if (to.name === from.name) {
|
|
70
|
+
this.mx_fetchHandler({ id: this.id, url: this.url }, this.fetchSingle)
|
|
71
|
+
}
|
|
70
72
|
},
|
|
71
73
|
|
|
72
74
|
resultModel (value) {
|
|
@@ -75,19 +77,23 @@ export default {
|
|
|
75
77
|
},
|
|
76
78
|
|
|
77
79
|
created () {
|
|
78
|
-
this.fetchSingle
|
|
80
|
+
this.mx_fetchHandler({ id: this.id, url: this.url }, this.fetchSingle)
|
|
79
81
|
},
|
|
80
82
|
|
|
81
83
|
methods: {
|
|
82
|
-
async fetchSingle (
|
|
84
|
+
async fetchSingle (externalPayload = {}) {
|
|
83
85
|
this.mx_isFetching = true
|
|
84
86
|
|
|
85
87
|
try {
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
88
|
+
const payload = { id: this.id, url: this.url, ...externalPayload }
|
|
89
|
+
|
|
90
|
+
this.$qas.logger.group(
|
|
91
|
+
`QasSingleView - fetchSingle -> payload do parâmetro do ${this.entity}/fetchSingle`,
|
|
92
|
+
[payload]
|
|
89
93
|
)
|
|
90
94
|
|
|
95
|
+
const response = await this.$store.dispatch(`${this.entity}/fetchSingle`, payload)
|
|
96
|
+
|
|
91
97
|
const { errors, fields, metadata } = response.data
|
|
92
98
|
|
|
93
99
|
this.mx_setErrors(errors)
|
|
@@ -100,10 +106,20 @@ export default {
|
|
|
100
106
|
metadata: this.mx_metadata
|
|
101
107
|
})
|
|
102
108
|
|
|
109
|
+
this.$qas.logger.group(
|
|
110
|
+
`QasSingleView - fetchSingle -> resposta da action ${this.entity}/fetchSingle`, [response]
|
|
111
|
+
)
|
|
112
|
+
|
|
103
113
|
this.$emit('fetch-success', response)
|
|
104
114
|
} catch (error) {
|
|
105
115
|
this.mx_fetchError(error)
|
|
106
116
|
this.$emit('fetch-error', error)
|
|
117
|
+
|
|
118
|
+
this.$qas.logger.group(
|
|
119
|
+
`QasSingleView - fetchSingle -> exceção da action ${this.entity}/fetchSingle`,
|
|
120
|
+
[error],
|
|
121
|
+
{ error: true }
|
|
122
|
+
)
|
|
107
123
|
} finally {
|
|
108
124
|
this.mx_isFetching = false
|
|
109
125
|
}
|
|
@@ -4,15 +4,17 @@ meta:
|
|
|
4
4
|
desc: Componente para C.R.U.D. responsável pela visualização (Read) ou conhecido também como "show".
|
|
5
5
|
|
|
6
6
|
props:
|
|
7
|
+
before-fetch:
|
|
8
|
+
desc: Callback para controlar como funciona o comportamento do fetchSingle.
|
|
9
|
+
default: null
|
|
10
|
+
type: Function
|
|
11
|
+
examples: ['beforeFetch({ payload, resolve, done })']
|
|
12
|
+
|
|
7
13
|
custom-id:
|
|
8
14
|
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.
|
|
9
15
|
type: String
|
|
10
16
|
examples: ['my-custom-id']
|
|
11
17
|
|
|
12
|
-
dialog:
|
|
13
|
-
desc: Este componente pode ser utilizado dentro de um dialog, neste caso o componente pai não pode ser um "QPage" e sim uma "div", esta prop cuida disto.
|
|
14
|
-
type: Boolean
|
|
15
|
-
|
|
16
18
|
entity:
|
|
17
19
|
desc: Entidade da store, por exemplo se tiver que trabalhar com modulo de usuários, teremos o model "users" na store, que vai ser nossa "entity".
|
|
18
20
|
required: true
|
|
@@ -55,6 +57,11 @@ props:
|
|
|
55
57
|
desc: Envia como parâmetro para a action "fetchSingle" do modulo correspondente a "entity".
|
|
56
58
|
type: String
|
|
57
59
|
|
|
60
|
+
use-boundary:
|
|
61
|
+
desc: Controla o limite que o FormView terá, quando é "false", a tag pai deixa de ser um "QPage" para ser uma "div" e é removido as classes "container" e "spaced", comumente utilizando quando precisa usar o QasFormView dentro de um dialog.
|
|
62
|
+
default: true
|
|
63
|
+
type: Boolean
|
|
64
|
+
|
|
58
65
|
slots:
|
|
59
66
|
default:
|
|
60
67
|
desc: 'Slot para ter o conteúdo principal (dentro do main).'
|
|
@@ -101,6 +101,8 @@ export default {
|
|
|
101
101
|
columnByField(this.fields[index])
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
+
this.$qas.logger.group('QasTableGenerator - Automatic columns', [columns])
|
|
105
|
+
|
|
104
106
|
return columns
|
|
105
107
|
}
|
|
106
108
|
|
|
@@ -113,6 +115,8 @@ export default {
|
|
|
113
115
|
}
|
|
114
116
|
})
|
|
115
117
|
|
|
118
|
+
this.$qas.logger.group('QasTableGenerator - columns', [columns])
|
|
119
|
+
|
|
116
120
|
return columns
|
|
117
121
|
},
|
|
118
122
|
|
|
@@ -129,9 +133,11 @@ export default {
|
|
|
129
133
|
},
|
|
130
134
|
|
|
131
135
|
resultsByFields () {
|
|
136
|
+
if (!Object.keys(this.fields).length) return []
|
|
137
|
+
|
|
132
138
|
const results = extend(true, [], this.results)
|
|
133
139
|
|
|
134
|
-
|
|
140
|
+
const mappedResults = results.map((result, index) => {
|
|
135
141
|
for (const key in result) {
|
|
136
142
|
result.default = this.results[index]
|
|
137
143
|
result[key] = humanize(this.fields[key], result[key]) || this.emptyResultText
|
|
@@ -139,6 +145,10 @@ export default {
|
|
|
139
145
|
|
|
140
146
|
return result
|
|
141
147
|
})
|
|
148
|
+
|
|
149
|
+
this.$qas.logger.group('QasTableGenerator - resultsByFields', [mappedResults])
|
|
150
|
+
|
|
151
|
+
return mappedResults
|
|
142
152
|
},
|
|
143
153
|
|
|
144
154
|
rowsPerPage () {
|
|
@@ -199,10 +209,11 @@ export default {
|
|
|
199
209
|
handleScrollOnGrab () {
|
|
200
210
|
const fullTableWidth = this.getFullTableWidth()
|
|
201
211
|
const containerTableWidth = this.getContainerTableWidth()
|
|
212
|
+
const hasScrollOnGrab = !!Object.keys(this.scrollOnGrab).length
|
|
202
213
|
|
|
203
214
|
if (fullTableWidth > containerTableWidth) {
|
|
204
215
|
this.initializeScrollOnGrab()
|
|
205
|
-
} else if (
|
|
216
|
+
} else if (hasScrollOnGrab) {
|
|
206
217
|
this.scrollOnGrab.destroyEvents()
|
|
207
218
|
this.scrollOnGrab.element.style.cursor = 'auto'
|
|
208
219
|
this.scrollOnGrab = {}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<q-tabs v-model="model" :active-color="activeColor" :indicator-color="indicatorColor" outside-arrows>
|
|
3
3
|
<slot v-for="(tab, key) in formattedTabs" :item="tab" :name="`tab-${tab.value}`">
|
|
4
|
-
<q-tab :key="key" v-bind="tab" :class="tabClass" :label="tab.label" :name="
|
|
4
|
+
<q-tab :key="key" v-bind="tab" :class="tabClass" :label="tab.label" :name="tab.value">
|
|
5
5
|
<slot :item="tab" :name="`tab-after-${tab.value}`">
|
|
6
6
|
<q-badge v-if="counters[key]" :label="counters[key]" v-bind="defaultCounterProps" />
|
|
7
7
|
</slot>
|
|
@@ -50,7 +50,7 @@ export default {
|
|
|
50
50
|
tabs: {
|
|
51
51
|
default: () => ({}),
|
|
52
52
|
required: true,
|
|
53
|
-
type: Object
|
|
53
|
+
type: [Object, Array]
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
56
|
|
|
@@ -38,9 +38,9 @@ props:
|
|
|
38
38
|
type: String
|
|
39
39
|
|
|
40
40
|
tabs:
|
|
41
|
-
desc: Objeto contendo todas as tabs a serem geradas.
|
|
41
|
+
desc: Objeto ou Array contendo todas as tabs a serem geradas.
|
|
42
42
|
default: {}
|
|
43
|
-
type: Object
|
|
43
|
+
type: [Object, Array]
|
|
44
44
|
examples: ["{ tab1: 'tab1', tab2: 'tab2' }"]
|
|
45
45
|
|
|
46
46
|
slots:
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
<qas-btn v-if="showAddFile" ref="buttonUpload" color="white" dense flat icon="o_add" round @click="$refs.hiddenInput.click()" />
|
|
17
17
|
|
|
18
|
-
<input ref="hiddenInput" class="qas-uploader__input" :multiple="isMultiple" type="file">
|
|
18
|
+
<input ref="hiddenInput" :accept="attributes.accept" class="qas-uploader__input" :multiple="isMultiple" type="file">
|
|
19
19
|
|
|
20
20
|
<qas-btn ref="buttonCleanFiles" class="hidden" color="white" @click="scope.removeUploadedFiles" />
|
|
21
21
|
<qas-btn v-if="scope.canUpload" color="white" dense flat icon="o_cloud_upload" round @click="scope.upload" />
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
<slot name="list" :scope="scope">
|
|
29
29
|
<div class="col-12 q-col-gutter-md row">
|
|
30
30
|
<div v-for="(file, index) in getFilesList(scope.files, scope)" :key="index" class="row" :class="itemClass">
|
|
31
|
-
<qas-avatar class="q-mr-sm" color="contrast-primary" icon="o_attach_file" :image="file.
|
|
31
|
+
<qas-avatar class="q-mr-sm" color="contrast-primary" icon="o_attach_file" :image="file.url" rounded :text-color="getColorFileIcon(file)" />
|
|
32
32
|
|
|
33
33
|
<div class="col items-center no-wrap row">
|
|
34
34
|
<div class="column no-wrap" :class="{ col: isMultiple }">
|
|
@@ -131,6 +131,10 @@ export default {
|
|
|
131
131
|
|
|
132
132
|
uploading: {
|
|
133
133
|
type: Boolean
|
|
134
|
+
},
|
|
135
|
+
|
|
136
|
+
useObjectModel: {
|
|
137
|
+
type: Boolean
|
|
134
138
|
}
|
|
135
139
|
},
|
|
136
140
|
|
|
@@ -244,12 +248,19 @@ export default {
|
|
|
244
248
|
uploaded (response) {
|
|
245
249
|
const fullPath = response.xhr.responseURL.split('?').shift()
|
|
246
250
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
+
const objectValue = {
|
|
252
|
+
format: response.files[0].type,
|
|
253
|
+
url: fullPath,
|
|
254
|
+
name: response.files[0].name
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
const model = this.useObjectModel ? objectValue : fullPath
|
|
258
|
+
|
|
259
|
+
this.$emit('update:modelValue', this.isMultiple ? [...this.modelValue, model] : model || '')
|
|
251
260
|
|
|
252
261
|
this.updateUploading(false)
|
|
262
|
+
|
|
263
|
+
this.$qas.logger.group('QasUploader - uploaded', [this.modelValue])
|
|
253
264
|
},
|
|
254
265
|
|
|
255
266
|
async fetchCredentials (filename) {
|
|
@@ -260,6 +271,12 @@ export default {
|
|
|
260
271
|
entity: this.entity,
|
|
261
272
|
filename
|
|
262
273
|
})
|
|
274
|
+
|
|
275
|
+
this.$qas.logger.group(
|
|
276
|
+
'QasUploader - fetchCredentials -> resposta de /upload-credentials/',
|
|
277
|
+
[data]
|
|
278
|
+
)
|
|
279
|
+
|
|
263
280
|
return data
|
|
264
281
|
} finally {
|
|
265
282
|
this.isFetching = false
|
|
@@ -278,8 +295,16 @@ export default {
|
|
|
278
295
|
}
|
|
279
296
|
|
|
280
297
|
const clonedValue = extend(true, [], this.modelValue)
|
|
281
|
-
const numberIndex = this.modelValue.findIndex(file =>
|
|
298
|
+
const numberIndex = this.modelValue.findIndex(file => {
|
|
299
|
+
if (this.useObjectModel) {
|
|
300
|
+
return file.uuid === index || file.url.includes(index)
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
return this.getFileName(file) === index
|
|
304
|
+
})
|
|
305
|
+
|
|
282
306
|
clonedValue.splice(numberIndex, 1)
|
|
307
|
+
|
|
283
308
|
this.$emit('update:modelValue', clonedValue)
|
|
284
309
|
},
|
|
285
310
|
|
|
@@ -288,12 +313,10 @@ export default {
|
|
|
288
313
|
},
|
|
289
314
|
|
|
290
315
|
getFilesList (uploadedFiles) {
|
|
291
|
-
const pathsList = Array.isArray(this.modelValue) ? this.modelValue : (this.modelValue ? [this.modelValue] : [])
|
|
292
|
-
|
|
293
316
|
uploadedFiles = uploadedFiles.map((file, indexToDelete) => {
|
|
294
317
|
return {
|
|
295
318
|
isUploaded: true,
|
|
296
|
-
|
|
319
|
+
url: file.xhr ? file.xhr.responseURL.split('?').shift() : '',
|
|
297
320
|
name: file.name,
|
|
298
321
|
progressLabel: file.__progressLabel,
|
|
299
322
|
sizeLabel: file.__sizeLabel,
|
|
@@ -302,11 +325,20 @@ export default {
|
|
|
302
325
|
}
|
|
303
326
|
})
|
|
304
327
|
|
|
328
|
+
const pathsList = Array.isArray(this.modelValue)
|
|
329
|
+
? this.modelValue
|
|
330
|
+
: (this.modelValue ? [this.modelValue] : [])
|
|
331
|
+
|
|
305
332
|
const mergedList = [...pathsList, ...uploadedFiles]
|
|
306
333
|
|
|
307
334
|
const files = {}
|
|
308
335
|
|
|
309
336
|
mergedList.forEach(file => {
|
|
337
|
+
if (this.useObjectModel && file.uuid) {
|
|
338
|
+
files[file.uuid] = file
|
|
339
|
+
return
|
|
340
|
+
}
|
|
341
|
+
|
|
310
342
|
if (file.isFailed) {
|
|
311
343
|
files[file.name] = file
|
|
312
344
|
return
|
|
@@ -314,16 +346,18 @@ export default {
|
|
|
314
346
|
|
|
315
347
|
if (typeof file === 'string') {
|
|
316
348
|
const fileName = this.getFileName(file)
|
|
317
|
-
files[fileName] = {
|
|
349
|
+
files[fileName] = { url: file, isUploaded: false, name: fileName }
|
|
318
350
|
return
|
|
319
351
|
}
|
|
320
352
|
|
|
321
|
-
if (file.
|
|
322
|
-
const fileName = this.getFileName(file.
|
|
353
|
+
if (file.url) {
|
|
354
|
+
const fileName = this.getFileName(file.url)
|
|
323
355
|
files[fileName] = file
|
|
324
356
|
}
|
|
325
357
|
})
|
|
326
358
|
|
|
359
|
+
this.$qas.logger.group('QasUploader - getFilesList', [files])
|
|
360
|
+
|
|
327
361
|
return files
|
|
328
362
|
},
|
|
329
363
|
|
|
@@ -343,6 +377,8 @@ export default {
|
|
|
343
377
|
const filesList = Array.from(this.hiddenInputElement.files)
|
|
344
378
|
const processedFiles = []
|
|
345
379
|
|
|
380
|
+
this.$refs.hiddenInput.value = ''
|
|
381
|
+
|
|
346
382
|
filesList.forEach(file => processedFiles.push(this.resizeImage(file)))
|
|
347
383
|
this.uploader.addFiles(await Promise.all(processedFiles))
|
|
348
384
|
},
|
|
@@ -362,7 +398,14 @@ export default {
|
|
|
362
398
|
// Retorna largura e altura da original da imagem
|
|
363
399
|
const { width, height } = await getImageSize(image)
|
|
364
400
|
|
|
365
|
-
if (width <= this.sizeLimit)
|
|
401
|
+
if (width <= this.sizeLimit) {
|
|
402
|
+
this.$qas.logger.info(`
|
|
403
|
+
QasUploader - resizeImage -> Tamanho da imagem menor que o tamanho limite,
|
|
404
|
+
sendo assim, não faz o resize
|
|
405
|
+
`)
|
|
406
|
+
|
|
407
|
+
return file
|
|
408
|
+
}
|
|
366
409
|
|
|
367
410
|
// Retorna os novos tamanhos redimensionados
|
|
368
411
|
const resizedDimensions = getResizeDimensions(this.sizeLimit, width, height)
|
|
@@ -380,7 +423,11 @@ export default {
|
|
|
380
423
|
const resizedImage = await pica.resize(image, canvas, this.defaultPicaResizeOptions)
|
|
381
424
|
const blob = await pica.toBlob(resizedImage, type, 0.90)
|
|
382
425
|
|
|
383
|
-
|
|
426
|
+
const newFile = new File([blob], file.name, { type })
|
|
427
|
+
|
|
428
|
+
this.$qas.logger.group('QasUploader - resizeImage -> nova imagem', [newFile])
|
|
429
|
+
|
|
430
|
+
return newFile
|
|
384
431
|
} catch {
|
|
385
432
|
// Caso não consiga redimensionar retorna o arquivo original
|
|
386
433
|
return file
|