@bildvitta/quasar-ui-asteroid 3.0.0-beta.10 → 3.0.0-beta.13
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/QasCard.json +13 -9
- package/dist/asteroid.cjs.css +1 -1
- package/dist/asteroid.cjs.js +292 -57
- package/dist/asteroid.cjs.min.js +2 -2
- package/dist/asteroid.esm.css +1 -1
- package/dist/asteroid.esm.js +294 -59
- package/dist/asteroid.esm.min.js +2 -2
- package/dist/asteroid.umd.css +1 -1
- package/dist/asteroid.umd.js +292 -57
- package/dist/asteroid.umd.min.js +2 -2
- package/dist/vetur/asteroid-attributes.json +12 -12
- package/dist/vetur/asteroid-tags.json +3 -3
- package/package.json +1 -1
- package/src/components/app-bar/QasAppBar.yml +0 -4
- package/src/components/card/QasCard.yml +13 -9
- package/src/components/date-time-input/QasDateTimeInput.vue +1 -1
- package/src/components/delete/QasDelete.vue +15 -1
- package/src/components/filters/QasFilters.vue +19 -4
- package/src/components/form-view/QasFormView.vue +51 -8
- package/src/components/grid-generator/QasGridGenerator.vue +17 -2
- package/src/components/input/QasInput.vue +20 -2
- package/src/components/list-view/QasListView.vue +20 -7
- package/src/components/nested-fields/QasNestedFields.vue +8 -9
- package/src/components/page-header/QasPageHeader.vue +9 -6
- package/src/components/search-box/QasSearchBox.vue +2 -2
- package/src/components/single-view/QasSingleView.vue +17 -3
- package/src/components/table-generator/QasTableGenerator.vue +11 -1
- package/src/components/uploader/QasUploader.vue +28 -3
- package/src/helpers/camelize-fields-name.js +15 -0
- package/src/helpers/index.js +1 -0
- package/src/mixins/view.js +3 -5
- 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
|
@@ -43,10 +43,6 @@
|
|
|
43
43
|
"description": "Texto do componente.",
|
|
44
44
|
"type": "string"
|
|
45
45
|
},
|
|
46
|
-
"qas-app-bar/is-auth": {
|
|
47
|
-
"description": "Controla se mostra ou não o menu de usuário.",
|
|
48
|
-
"type": "boolean"
|
|
49
|
-
},
|
|
50
46
|
"qas-app-bar/notifications": {
|
|
51
47
|
"description": "Ícone de notificação que fica ao lado do menu de usuário.",
|
|
52
48
|
"type": "object"
|
|
@@ -131,14 +127,6 @@
|
|
|
131
127
|
"description": "Rótulo do botão.",
|
|
132
128
|
"type": "string"
|
|
133
129
|
},
|
|
134
|
-
"qas-card/image-position": {
|
|
135
|
-
"description": "Posição da imagem \"background-position\".",
|
|
136
|
-
"type": "string"
|
|
137
|
-
},
|
|
138
|
-
"qas-card/form-mode": {
|
|
139
|
-
"description": "Modo de formulário, altera o estilo quando está em uma pagina de formulário.",
|
|
140
|
-
"type": "boolean"
|
|
141
|
-
},
|
|
142
130
|
"qas-card/gutter": {
|
|
143
131
|
"description": "Espaçamento dentro <q-card-section /> onde fica o slot \"default\".",
|
|
144
132
|
"type": "string"
|
|
@@ -147,6 +135,18 @@
|
|
|
147
135
|
"description": "Imagens do carousel.",
|
|
148
136
|
"type": "array"
|
|
149
137
|
},
|
|
138
|
+
"qas-card/image-position": {
|
|
139
|
+
"description": "Posição da imagem \"background-position\".",
|
|
140
|
+
"type": "string"
|
|
141
|
+
},
|
|
142
|
+
"qas-card/outlined": {
|
|
143
|
+
"description": "Insere uma borda sólida em volta do componente.",
|
|
144
|
+
"type": "boolean"
|
|
145
|
+
},
|
|
146
|
+
"qas-card/unelevated": {
|
|
147
|
+
"description": "Remove a sombra do componente.",
|
|
148
|
+
"type": "boolean"
|
|
149
|
+
},
|
|
150
150
|
"qas-card/use-header": {
|
|
151
151
|
"description": "Controla se vai ter ou não o header com carousel.",
|
|
152
152
|
"type": "boolean"
|
|
@@ -27,7 +27,6 @@
|
|
|
27
27
|
},
|
|
28
28
|
"qas-app-bar": {
|
|
29
29
|
"attributes": [
|
|
30
|
-
"is-auth",
|
|
31
30
|
"notifications",
|
|
32
31
|
"title",
|
|
33
32
|
"user"
|
|
@@ -79,10 +78,11 @@
|
|
|
79
78
|
},
|
|
80
79
|
"qas-card": {
|
|
81
80
|
"attributes": [
|
|
82
|
-
"image-position",
|
|
83
|
-
"form-mode",
|
|
84
81
|
"gutter",
|
|
85
82
|
"images",
|
|
83
|
+
"image-position",
|
|
84
|
+
"outlined",
|
|
85
|
+
"unelevated",
|
|
86
86
|
"use-header"
|
|
87
87
|
],
|
|
88
88
|
"description": "Componente de card."
|
package/package.json
CHANGED
|
@@ -4,15 +4,6 @@ meta:
|
|
|
4
4
|
desc: Componente de card.
|
|
5
5
|
|
|
6
6
|
props:
|
|
7
|
-
image-position:
|
|
8
|
-
desc: Posição da imagem "background-position".
|
|
9
|
-
default: center
|
|
10
|
-
type: String
|
|
11
|
-
|
|
12
|
-
form-mode:
|
|
13
|
-
desc: Modo de formulário, altera o estilo quando está em uma pagina de formulário.
|
|
14
|
-
type: Boolean
|
|
15
|
-
|
|
16
7
|
gutter:
|
|
17
8
|
desc: Espaçamento dentro <q-card-section /> onde fica o slot "default".
|
|
18
9
|
default: sm
|
|
@@ -24,6 +15,19 @@ props:
|
|
|
24
15
|
default: []
|
|
25
16
|
type: Array
|
|
26
17
|
|
|
18
|
+
image-position:
|
|
19
|
+
desc: Posição da imagem "background-position".
|
|
20
|
+
default: center
|
|
21
|
+
type: String
|
|
22
|
+
|
|
23
|
+
outlined:
|
|
24
|
+
desc: Insere uma borda sólida em volta do componente.
|
|
25
|
+
type: Boolean
|
|
26
|
+
|
|
27
|
+
unelevated:
|
|
28
|
+
desc: Remove a sombra do componente.
|
|
29
|
+
type: Boolean
|
|
30
|
+
|
|
27
31
|
use-header:
|
|
28
32
|
desc: Controla se vai ter ou não o header com carousel.
|
|
29
33
|
type: Boolean
|
|
@@ -106,7 +106,13 @@ export default {
|
|
|
106
106
|
try {
|
|
107
107
|
const { destroyRoutes, history } = useHistory()
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
const payload = { id: this.id, url: this.url }
|
|
110
|
+
|
|
111
|
+
this.$qas.logger.group(
|
|
112
|
+
`QasDelete - destroy -> Payload do parâmetro do ${this.entity}/destroy`, [payload]
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
await this.$store.dispatch(`${this.entity}/destroy`, payload)
|
|
110
116
|
|
|
111
117
|
NotifySuccess('Item deletado com sucesso!')
|
|
112
118
|
|
|
@@ -120,9 +126,17 @@ export default {
|
|
|
120
126
|
this.createDeleteSuccessEvent()
|
|
121
127
|
|
|
122
128
|
this.$emit('success')
|
|
129
|
+
|
|
130
|
+
this.$qas.logger.info('QasDelete - destroy -> item deletado com sucesso!')
|
|
123
131
|
} catch (error) {
|
|
124
132
|
NotifyError('Ops! Não foi possível deletar o item.')
|
|
125
133
|
this.$emit('error', error)
|
|
134
|
+
|
|
135
|
+
this.$qas.logger.group(
|
|
136
|
+
`QasDelete - destroy -> exceção da action ${this.entity}/destroy`,
|
|
137
|
+
[error],
|
|
138
|
+
{ error: true }
|
|
139
|
+
)
|
|
126
140
|
} finally {
|
|
127
141
|
Loading.hide()
|
|
128
142
|
this.$emit('update:deleting', false)
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
<div v-if="showSearch" class="col">
|
|
5
5
|
<slot :filter="filter" name="search">
|
|
6
6
|
<q-form v-if="useSearch" @submit.prevent="filter()">
|
|
7
|
-
<
|
|
7
|
+
<qas-input v-model="search" :debounce="debounce" dense hide-bottom-space :outlined="false" :placeholder="searchPlaceholder" type="search">
|
|
8
8
|
<template #append>
|
|
9
|
-
<qas-btn v-if="hasSearch" icon="o_clear" unelevated @click="clearSearch" />
|
|
10
|
-
<qas-btn v-if="!debounce" icon="o_search" type="submit" unelevated @click="filter()" />
|
|
9
|
+
<qas-btn v-if="hasSearch" color="grey-9" flat icon="o_clear" unelevated @click="clearSearch" />
|
|
10
|
+
<qas-btn v-if="!debounce" color="grey-9" flat icon="o_search" type="submit" unelevated @click="filter()" />
|
|
11
11
|
</template>
|
|
12
|
-
</
|
|
12
|
+
</qas-input>
|
|
13
13
|
</q-form>
|
|
14
14
|
</slot>
|
|
15
15
|
</div>
|
|
@@ -241,11 +241,26 @@ export default {
|
|
|
241
241
|
this.isFetching = true
|
|
242
242
|
|
|
243
243
|
try {
|
|
244
|
+
this.$qas.logger.group(
|
|
245
|
+
`QasFilters - fetchFilters -> Payload do parâmetro do ${this.entity}/fetchFilters`,
|
|
246
|
+
[{ url: this.url }]
|
|
247
|
+
)
|
|
248
|
+
|
|
244
249
|
const response = await this.$store.dispatch(`${this.entity}/fetchFilters`, { url: this.url })
|
|
245
250
|
this.$emit('fetch-success', response)
|
|
251
|
+
|
|
252
|
+
this.$qas.logger.group(
|
|
253
|
+
`QasFilters - fetchFilters -> resposta da action ${this.entity}/fetchFilters`, [response]
|
|
254
|
+
)
|
|
246
255
|
} catch (error) {
|
|
247
256
|
this.hasFetchError = true
|
|
248
257
|
this.$emit('fetch-error', error)
|
|
258
|
+
|
|
259
|
+
this.$qas.logger.group(
|
|
260
|
+
`QasFilters - fetchFilters -> exceção da action ${this.entity}/fetchFilters`,
|
|
261
|
+
[error],
|
|
262
|
+
{ error: true }
|
|
263
|
+
)
|
|
249
264
|
} finally {
|
|
250
265
|
this.isFetching = false
|
|
251
266
|
}
|
|
@@ -211,8 +211,10 @@ export default {
|
|
|
211
211
|
},
|
|
212
212
|
|
|
213
213
|
created () {
|
|
214
|
-
onBeforeRouteLeave(this.beforeRouteLeave)
|
|
214
|
+
this.useDialogOnUnsavedChanges && onBeforeRouteLeave(this.beforeRouteLeave)
|
|
215
|
+
|
|
215
216
|
window.addEventListener('delete-success', this.setIgnoreRouterGuard)
|
|
217
|
+
|
|
216
218
|
this.fetch()
|
|
217
219
|
},
|
|
218
220
|
|
|
@@ -243,6 +245,11 @@ export default {
|
|
|
243
245
|
return next()
|
|
244
246
|
}
|
|
245
247
|
|
|
248
|
+
this.$qas.logger.group(
|
|
249
|
+
'QasFormView - beforeRouteLeave -> dialog chamado, modelValue diferente do cachedResult',
|
|
250
|
+
[{ modelValue: clonedModelValue, cachedResult: clonedCachedResult }]
|
|
251
|
+
)
|
|
252
|
+
|
|
246
253
|
this.handleDialog(() => {
|
|
247
254
|
this.ignoreRouterGuard = true
|
|
248
255
|
next()
|
|
@@ -257,10 +264,14 @@ export default {
|
|
|
257
264
|
this.mx_isFetching = true
|
|
258
265
|
|
|
259
266
|
try {
|
|
260
|
-
const
|
|
261
|
-
|
|
267
|
+
const payload = { form: true, id: this.id, params, url: this.fetchURL }
|
|
268
|
+
|
|
269
|
+
this.$qas.logger.group(
|
|
270
|
+
`QasFormView - fetch -> payload do parâmetro do ${this.entity}/fetchSingle`, [payload]
|
|
262
271
|
)
|
|
263
272
|
|
|
273
|
+
const response = await this.$store.dispatch(`${this.entity}/fetchSingle`, payload)
|
|
274
|
+
|
|
264
275
|
const { errors, fields, metadata, result } = response.data
|
|
265
276
|
|
|
266
277
|
this.mx_setErrors(errors)
|
|
@@ -273,20 +284,36 @@ export default {
|
|
|
273
284
|
metadata
|
|
274
285
|
})
|
|
275
286
|
|
|
287
|
+
this.$qas.logger.group(
|
|
288
|
+
`QasFormView - fetch -> resposta da action ${this.entity}/fetchSingle`, [response]
|
|
289
|
+
)
|
|
290
|
+
|
|
276
291
|
if (result) {
|
|
277
292
|
this.hasResult = true
|
|
278
293
|
|
|
279
294
|
this.$nextTick(() => {
|
|
280
|
-
|
|
295
|
+
const modelValue = { ...this.modelValue, ...result }
|
|
296
|
+
|
|
297
|
+
this.$emit('update:modelValue', modelValue)
|
|
298
|
+
|
|
299
|
+
this.$qas.logger.group('QasFormView - fetch -> modelValue', [modelValue])
|
|
281
300
|
})
|
|
282
301
|
|
|
283
302
|
this.cachedResult = this.useDialogOnUnsavedChanges && extend(true, {}, result)
|
|
303
|
+
|
|
304
|
+
this.$qas.logger.group('QasFormView - fetch -> cachedResult', [this.cachedResult])
|
|
284
305
|
}
|
|
285
306
|
|
|
286
307
|
this.$emit('fetch-success', response, this.modelValue)
|
|
287
308
|
} catch (error) {
|
|
288
309
|
this.mx_fetchError(error)
|
|
289
310
|
this.$emit('fetch-error', error)
|
|
311
|
+
|
|
312
|
+
this.$qas.logger.group(
|
|
313
|
+
`QasFormView - fetch -> exceção da action ${this.entity}/fetchSingle`,
|
|
314
|
+
[error],
|
|
315
|
+
{ error: true }
|
|
316
|
+
)
|
|
290
317
|
} finally {
|
|
291
318
|
this.mx_isFetching = false
|
|
292
319
|
}
|
|
@@ -352,11 +379,14 @@ export default {
|
|
|
352
379
|
this.isSubmitting = true
|
|
353
380
|
|
|
354
381
|
try {
|
|
355
|
-
const
|
|
356
|
-
|
|
357
|
-
|
|
382
|
+
const payload = { id: this.id, payload: this.modelValue, url: this.url }
|
|
383
|
+
|
|
384
|
+
this.$qas.logger.group(
|
|
385
|
+
`QasFormView - submit -> payload do ${this.entity}/${this.mode}`, [payload]
|
|
358
386
|
)
|
|
359
387
|
|
|
388
|
+
const response = await this.$store.dispatch(`${this.entity}/${this.mode}`, payload)
|
|
389
|
+
|
|
360
390
|
if (this.useDialogOnUnsavedChanges) {
|
|
361
391
|
this.cachedResult = extend(true, {}, this.modelValue)
|
|
362
392
|
}
|
|
@@ -364,11 +394,18 @@ export default {
|
|
|
364
394
|
this.mx_setErrors()
|
|
365
395
|
NotifySuccess(response.data.status.text || 'Item salvo com sucesso!')
|
|
366
396
|
this.$emit('submit-success', response, this.modelValue)
|
|
397
|
+
|
|
398
|
+
this.$qas.logger.group(
|
|
399
|
+
`QasFormView - submit -> resposta da action ${this.entity}/${this.mode}`, [response]
|
|
400
|
+
)
|
|
367
401
|
} catch (error) {
|
|
368
402
|
const errors = error?.response?.data?.errors
|
|
369
403
|
const message = error?.response?.data?.status?.text
|
|
370
404
|
const exceptionResponse = error?.response?.data?.exception
|
|
371
|
-
|
|
405
|
+
|
|
406
|
+
const exception = errors
|
|
407
|
+
? 'Existem erros de validação no formulário.'
|
|
408
|
+
: exceptionResponse || error.message
|
|
372
409
|
|
|
373
410
|
this.mx_setErrors(errors)
|
|
374
411
|
this.$emit('update:errors', this.mx_errors)
|
|
@@ -376,6 +413,12 @@ export default {
|
|
|
376
413
|
NotifyError(message || 'Ops! Erro ao salvar item.', exception)
|
|
377
414
|
|
|
378
415
|
this.$emit('submit-error', error)
|
|
416
|
+
|
|
417
|
+
this.$qas.logger.group(
|
|
418
|
+
`QasFormView - fetch -> exceção da action ${this.entity}/${this.mode}`,
|
|
419
|
+
[error],
|
|
420
|
+
{ error: true }
|
|
421
|
+
)
|
|
379
422
|
} finally {
|
|
380
423
|
this.isSubmitting = false
|
|
381
424
|
}
|
|
@@ -61,6 +61,11 @@ export default {
|
|
|
61
61
|
computed: {
|
|
62
62
|
formattedFields () {
|
|
63
63
|
if (this.useEmptyResult) {
|
|
64
|
+
this.$qas.logger.group(
|
|
65
|
+
'QasGridGenerator - formattedFields -> this.useEmptyResult tem valor "true"',
|
|
66
|
+
[this.fields]
|
|
67
|
+
)
|
|
68
|
+
|
|
64
69
|
return this.fields
|
|
65
70
|
}
|
|
66
71
|
|
|
@@ -78,6 +83,8 @@ export default {
|
|
|
78
83
|
}
|
|
79
84
|
}
|
|
80
85
|
|
|
86
|
+
this.$qas.logger.group('QasGridGenerator - formattedFields', [fields])
|
|
87
|
+
|
|
81
88
|
return fields
|
|
82
89
|
},
|
|
83
90
|
|
|
@@ -93,11 +100,19 @@ export default {
|
|
|
93
100
|
|
|
94
101
|
for (const key in result) {
|
|
95
102
|
if (this.formattedFields[key]?.type) {
|
|
96
|
-
formattedResult[key] =
|
|
97
|
-
|
|
103
|
+
formattedResult[key] = (
|
|
104
|
+
humanize(this.formattedFields[key], result[key]) || this.emptyResultText
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
this.slotValue[key] = {
|
|
108
|
+
...this.formattedFields[key],
|
|
109
|
+
formattedResult: formattedResult[key]
|
|
110
|
+
}
|
|
98
111
|
}
|
|
99
112
|
}
|
|
100
113
|
|
|
114
|
+
this.$qas.logger.group('QasGridGenerator - getResultsByFields', [formattedResult])
|
|
115
|
+
|
|
101
116
|
return formattedResult
|
|
102
117
|
}
|
|
103
118
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
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">
|
|
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" @paste="onPaste">
|
|
4
4
|
<template v-for="(_, name) in $slots" #[name]="context">
|
|
5
5
|
<slot :name="name" v-bind="context || {}" />
|
|
6
6
|
</template>
|
|
@@ -97,7 +97,7 @@ export default {
|
|
|
97
97
|
|
|
98
98
|
watch: {
|
|
99
99
|
mask () {
|
|
100
|
-
const input = this.
|
|
100
|
+
const input = this.getInput()
|
|
101
101
|
|
|
102
102
|
requestAnimationFrame(() => {
|
|
103
103
|
input.selectionStart = input.value ? input.value.length : ''
|
|
@@ -131,12 +131,30 @@ export default {
|
|
|
131
131
|
},
|
|
132
132
|
|
|
133
133
|
toggleMask (first, second) {
|
|
134
|
+
if (!this.modelValue.length) return
|
|
135
|
+
|
|
134
136
|
const length = first.split('#').length - 2
|
|
135
137
|
return this.modelValue?.length > length ? second : first
|
|
136
138
|
},
|
|
137
139
|
|
|
138
140
|
validate (value) {
|
|
139
141
|
return this.inputReference.validate(value)
|
|
142
|
+
},
|
|
143
|
+
|
|
144
|
+
onPaste (event) {
|
|
145
|
+
if (!this.mask) return
|
|
146
|
+
|
|
147
|
+
const value = event.clipboardData.getData('text')
|
|
148
|
+
const input = this.getInput()
|
|
149
|
+
|
|
150
|
+
requestAnimationFrame(() => {
|
|
151
|
+
this.$emit('update:modelValue', value)
|
|
152
|
+
input.selectionStart = input.value ? input.value.length : ''
|
|
153
|
+
})
|
|
154
|
+
},
|
|
155
|
+
|
|
156
|
+
getInput () {
|
|
157
|
+
return this.inputReference.$el?.querySelector('input')
|
|
140
158
|
}
|
|
141
159
|
}
|
|
142
160
|
}
|
|
@@ -144,15 +144,18 @@ export default {
|
|
|
144
144
|
const hasFilters = !!Object.keys(filters).length
|
|
145
145
|
|
|
146
146
|
try {
|
|
147
|
-
const
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
147
|
+
const payload = {
|
|
148
|
+
...this.mx_context,
|
|
149
|
+
url: this.url,
|
|
150
|
+
...(hasFilters && { filters })
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
this.$qas.logger.group(
|
|
154
|
+
`QasListView - fetchList -> Payload do parâmetro do ${this.entity}/fetchList`, [payload]
|
|
154
155
|
)
|
|
155
156
|
|
|
157
|
+
const response = await this.$store.dispatch(`${this.entity}/fetchList`, payload)
|
|
158
|
+
|
|
156
159
|
const { errors, fields, metadata } = response.data
|
|
157
160
|
|
|
158
161
|
this.mx_setErrors(errors)
|
|
@@ -166,10 +169,20 @@ export default {
|
|
|
166
169
|
})
|
|
167
170
|
|
|
168
171
|
this.$emit('fetch-success', response)
|
|
172
|
+
|
|
173
|
+
this.$qas.logger.group(
|
|
174
|
+
`QasListView - fetchSingle -> resposta da action ${this.entity}/fetchList`, [response]
|
|
175
|
+
)
|
|
169
176
|
} catch (error) {
|
|
170
177
|
this.mx_fetchError(error)
|
|
171
178
|
this.$emit('update:errors', error)
|
|
172
179
|
this.$emit('fetch-error', error)
|
|
180
|
+
|
|
181
|
+
this.$qas.logger.group(
|
|
182
|
+
`QasListView - fetchSingle -> exceção da action ${this.entity}/fetchList`,
|
|
183
|
+
[error],
|
|
184
|
+
{ error: true }
|
|
185
|
+
)
|
|
173
186
|
} finally {
|
|
174
187
|
this.mx_isFetching = false
|
|
175
188
|
}
|
|
@@ -75,7 +75,6 @@ import { TransitionGroup } from 'vue'
|
|
|
75
75
|
|
|
76
76
|
import { constructObject } from '../../helpers'
|
|
77
77
|
import { extend } from 'quasar'
|
|
78
|
-
import { camelize } from 'humps'
|
|
79
78
|
|
|
80
79
|
export default {
|
|
81
80
|
name: 'QasNestedFields',
|
|
@@ -225,13 +224,7 @@ export default {
|
|
|
225
224
|
},
|
|
226
225
|
|
|
227
226
|
children () {
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
for (const key in field?.children) {
|
|
231
|
-
field.children[key].name = camelize(field?.children[key].name)
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
return field?.children
|
|
227
|
+
return this.field?.children
|
|
235
228
|
},
|
|
236
229
|
|
|
237
230
|
showDestroyBtn () {
|
|
@@ -282,13 +275,17 @@ export default {
|
|
|
282
275
|
|
|
283
276
|
methods: {
|
|
284
277
|
add (row = {}) {
|
|
285
|
-
|
|
278
|
+
const payload = { ...this.rowObject, ...row }
|
|
279
|
+
|
|
280
|
+
this.nested.push(payload)
|
|
286
281
|
|
|
287
282
|
this.$nextTick(() => {
|
|
288
283
|
this.useAnimation && this.setScroll()
|
|
289
284
|
this.setFocus()
|
|
290
285
|
})
|
|
291
286
|
|
|
287
|
+
this.$qas.logger.group('QasNestedFields - add', [payload])
|
|
288
|
+
|
|
292
289
|
return this.updateModelValue()
|
|
293
290
|
},
|
|
294
291
|
|
|
@@ -308,6 +305,8 @@ export default {
|
|
|
308
305
|
? this.nested.splice(index, 1)
|
|
309
306
|
: this.nested.splice(index, 1, { [this.destroyKey]: true, ...row })
|
|
310
307
|
|
|
308
|
+
this.$qas.logger.group('QasNestedFields - destroy', [{ index, row }])
|
|
309
|
+
|
|
311
310
|
return this.updateModelValue()
|
|
312
311
|
},
|
|
313
312
|
|
|
@@ -17,12 +17,21 @@
|
|
|
17
17
|
<script>
|
|
18
18
|
import { castArray } from 'lodash-es'
|
|
19
19
|
import { useHistory } from '../../composables'
|
|
20
|
+
import { createMetaMixin } from 'quasar'
|
|
20
21
|
|
|
21
22
|
const { hasPreviousRoute, history, getPreviousRoute } = useHistory()
|
|
22
23
|
|
|
23
24
|
export default {
|
|
24
25
|
name: 'QasPageHeader',
|
|
25
26
|
|
|
27
|
+
mixins: [
|
|
28
|
+
createMetaMixin(function () {
|
|
29
|
+
return {
|
|
30
|
+
title: this.title
|
|
31
|
+
}
|
|
32
|
+
})
|
|
33
|
+
],
|
|
34
|
+
|
|
26
35
|
props: {
|
|
27
36
|
breadcrumbs: {
|
|
28
37
|
default: '',
|
|
@@ -85,12 +94,6 @@ export default {
|
|
|
85
94
|
|
|
86
95
|
return lastIndex === index ? 'text-grey-7' : 'text-primary'
|
|
87
96
|
}
|
|
88
|
-
},
|
|
89
|
-
|
|
90
|
-
meta () {
|
|
91
|
-
return {
|
|
92
|
-
title: this.title
|
|
93
|
-
}
|
|
94
97
|
}
|
|
95
98
|
}
|
|
96
99
|
</script>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<qas-box>
|
|
3
|
-
<
|
|
3
|
+
<qas-input v-model="search" clearable :disable="!list.length" hide-bottom-space :placeholder="placeholder">
|
|
4
4
|
<template #append>
|
|
5
5
|
<q-icon color="primary" name="o_search" />
|
|
6
6
|
</template>
|
|
7
|
-
</
|
|
7
|
+
</qas-input>
|
|
8
8
|
|
|
9
9
|
<div class="overflow-auto q-mt-xs relative-position" :style="contentStyle">
|
|
10
10
|
<slot v-if="hasResults" />
|
|
@@ -83,11 +83,15 @@ export default {
|
|
|
83
83
|
this.mx_isFetching = true
|
|
84
84
|
|
|
85
85
|
try {
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
const payload = { id: this.id, url: this.url, params }
|
|
87
|
+
|
|
88
|
+
this.$qas.logger.group(
|
|
89
|
+
`QasSingleView - fetchSingle -> payload do parâmetro do ${this.entity}/fetchSingle`,
|
|
90
|
+
[payload]
|
|
89
91
|
)
|
|
90
92
|
|
|
93
|
+
const response = await this.$store.dispatch(`${this.entity}/fetchSingle`, payload)
|
|
94
|
+
|
|
91
95
|
const { errors, fields, metadata } = response.data
|
|
92
96
|
|
|
93
97
|
this.mx_setErrors(errors)
|
|
@@ -100,10 +104,20 @@ export default {
|
|
|
100
104
|
metadata: this.mx_metadata
|
|
101
105
|
})
|
|
102
106
|
|
|
107
|
+
this.$qas.logger.group(
|
|
108
|
+
`QasSingleView - fetchSingle -> resposta da action ${this.entity}/fetchSingle`, [response]
|
|
109
|
+
)
|
|
110
|
+
|
|
103
111
|
this.$emit('fetch-success', response)
|
|
104
112
|
} catch (error) {
|
|
105
113
|
this.mx_fetchError(error)
|
|
106
114
|
this.$emit('fetch-error', error)
|
|
115
|
+
|
|
116
|
+
this.$qas.logger.group(
|
|
117
|
+
`QasSingleView - fetchSingle -> exceção da action ${this.entity}/fetchSingle`,
|
|
118
|
+
[error],
|
|
119
|
+
{ error: true }
|
|
120
|
+
)
|
|
107
121
|
} finally {
|
|
108
122
|
this.mx_isFetching = false
|
|
109
123
|
}
|
|
@@ -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 () {
|