@bildvitta/quasar-ui-asteroid 3.5.0-beta.1 → 3.5.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bildvitta/quasar-ui-asteroid",
3
3
  "description": "Asteroid",
4
- "version": "3.5.0-beta.1",
4
+ "version": "3.5.0-beta.2",
5
5
  "author": "Bild & Vitta <systemteam@bild.com.br>",
6
6
  "license": "MIT",
7
7
  "main": "dist/asteroid.cjs.min.js",
@@ -92,6 +92,13 @@ export default {
92
92
 
93
93
  id () {
94
94
  return this.customId || this.$route.params.id
95
+ },
96
+
97
+ defaultNotifyMessages () {
98
+ return {
99
+ error: 'Não conseguimos excluir as informações. Por favor, tente novamente em alguns minutos.',
100
+ success: 'Informações excluídas com sucesso.'
101
+ }
95
102
  }
96
103
  },
97
104
 
@@ -105,8 +112,6 @@ export default {
105
112
  this.$emit('update:deleting', true)
106
113
 
107
114
  try {
108
- const { destroyRoutes, history } = useHistory()
109
-
110
115
  const payload = { id: this.id, url: this.url }
111
116
 
112
117
  this.$qas.logger.group(
@@ -119,9 +124,11 @@ export default {
119
124
  payload
120
125
  })
121
126
 
122
- NotifySuccess('Item deletado com sucesso!')
127
+ NotifySuccess(this.defaultNotifyMessages.success)
123
128
 
124
129
  if (this.useAutoDeleteRoute) {
130
+ const { destroyRoutes, history } = useHistory()
131
+
125
132
  // remove todas rotas que possuem o id do item excluído.
126
133
  const routesToBeDeleted = this.getRoutesToBeDeletedById(history.list)
127
134
  destroyRoutes(routesToBeDeleted)
@@ -134,7 +141,7 @@ export default {
134
141
 
135
142
  this.$qas.logger.info('QasDelete - destroy -> item deletado com sucesso!')
136
143
  } catch (error) {
137
- NotifyError('Ops! Não foi possível deletar o item.')
144
+ NotifyError(this.defaultNotifyMessages.error)
138
145
  this.$emit('error', error)
139
146
 
140
147
  this.$qas.logger.group(
@@ -58,7 +58,7 @@ export default {
58
58
 
59
59
  props: {
60
60
  cancelButtonLabel: {
61
- default: 'Cancelar',
61
+ default: 'Voltar',
62
62
  type: String
63
63
  },
64
64
 
@@ -196,6 +196,14 @@ export default {
196
196
 
197
197
  isCancelButtonDisabled () {
198
198
  return this.disable || this.isSubmitting
199
+ },
200
+
201
+ defaultNotifyMessages () {
202
+ return {
203
+ validationError: 'Existem campos no formulário que ainda não foram preenchidos. Complete todas as informações para avançar.',
204
+ error: 'Não conseguimos salvar as informações. Por favor, tente novamente em alguns minutos.',
205
+ success: 'Informações salvas com sucesso.'
206
+ }
199
207
  }
200
208
  },
201
209
 
@@ -420,7 +428,7 @@ export default {
420
428
  }
421
429
 
422
430
  this.mx_setErrors()
423
- NotifySuccess(response.data.status.text || 'Item salvo com sucesso!')
431
+ NotifySuccess(response.data.status.text || this.defaultNotifyMessages.success)
424
432
  this.$emit('submit-success', response, this.modelValue)
425
433
 
426
434
  this.$qas.logger.group(
@@ -429,16 +437,15 @@ export default {
429
437
  } catch (error) {
430
438
  const errors = error?.response?.data?.errors
431
439
  const message = error?.response?.data?.status?.text
432
- const exceptionResponse = error?.response?.data?.exception
433
440
 
434
- const exception = errors
435
- ? 'Existem erros de validação no formulário.'
436
- : exceptionResponse || error.message
441
+ const defaultMessage = error
442
+ ? this.defaultNotifyMessages.validationError
443
+ : this.defaultNotifyMessages.error
437
444
 
438
445
  this.mx_setErrors(errors)
439
446
  this.$emit('update:errors', this.mx_errors)
440
447
 
441
- NotifyError(message || 'Ops! Erro ao salvar item.', exception)
448
+ NotifyError(message || defaultMessage)
442
449
 
443
450
  this.$emit('submit-error', error)
444
451
 
@@ -17,8 +17,8 @@ props:
17
17
  examples: ['beforeSubmit({ payload, resolve })']
18
18
 
19
19
  cancel-button-label:
20
- desc: Rótulo do botão "cancelar".
21
- default: Cancelar
20
+ desc: Rótulo do botão "voltar".
21
+ default: Voltar
22
22
  type: String
23
23
 
24
24
  cancel-route:
@@ -281,8 +281,8 @@ export default {
281
281
  }
282
282
  },
283
283
 
284
- showDestroyBtn () {
285
- return this.nested.filter(item => !item[this.destroyKey]).length > 1 || this.useDestroyAlways
284
+ showDestroyButton () {
285
+ return this.nested.filter(item => !item[this.destroyKey]).length > 1 || this.hasDestroyAlways
286
286
  },
287
287
 
288
288
  transformedErrors () {
@@ -329,7 +329,7 @@ export default {
329
329
  }
330
330
  }
331
331
 
332
- if (this.showDestroyBtn) {
332
+ if (this.showDestroyButton) {
333
333
  list.destroy = {
334
334
  ...this.buttonDestroyProps,
335
335
  handler: () => this.destroy(index, row)
@@ -2,7 +2,6 @@
2
2
  <q-toolbar class="justify-between q-mb-lg q-px-none">
3
3
  <div class="ellipsis">
4
4
  <q-toolbar-title v-if="title" class="text-bold text-h5">
5
- <q-icon v-if="hasPreviousRoute" class="cursor-pointer vertical-baseline" name="o_arrow_back" size="18px" @click="back" />
6
5
  {{ title }}
7
6
  </q-toolbar-title>
8
7
 
@@ -19,7 +18,7 @@ import { castArray } from 'lodash-es'
19
18
  import { useHistory } from '../../composables'
20
19
  import { createMetaMixin } from 'quasar'
21
20
 
22
- const { hasPreviousRoute, history, getPreviousRoute } = useHistory()
21
+ const { history } = useHistory()
23
22
 
24
23
  export default {
25
24
  name: 'QasPageHeader',
@@ -55,10 +54,6 @@ export default {
55
54
  },
56
55
 
57
56
  computed: {
58
- hasPreviousRoute () {
59
- return hasPreviousRoute.value
60
- },
61
-
62
57
  transformedBreadcrumbs () {
63
58
  const list = [...castArray(this.breadcrumbs || this.title)]
64
59
  this.root && list.unshift(this.root)
@@ -85,10 +80,6 @@ export default {
85
80
  },
86
81
 
87
82
  methods: {
88
- back () {
89
- this.$router.push(getPreviousRoute(this.$route))
90
- },
91
-
92
83
  getBreadcrumbsClass (index) {
93
84
  const lastIndex = this.transformedBreadcrumbs.length - 1
94
85
 
@@ -1,9 +1,7 @@
1
1
  <template>
2
2
  <q-select v-model="model" v-bind="attributes">
3
- <template #append>
4
- <slot name="append">
5
- <q-icon v-if="isSearchable" name="o_search" />
6
- </slot>
3
+ <template v-if="isSearchable" #prepend>
4
+ <q-icon name="o_search" />
7
5
  </template>
8
6
 
9
7
  <template #no-option>
@@ -1,5 +1,6 @@
1
1
  .q-notification {
2
2
  margin-top: 80px;
3
+ max-width: 560px;
3
4
 
4
5
  &__content {
5
6
  .q-icon {
@@ -81,13 +81,16 @@ export default {
81
81
 
82
82
  mx_hasHeaderSlot () {
83
83
  return !!(this.$slots.header)
84
+ },
85
+
86
+ mx_fetchErrorMessage () {
87
+ return 'Ops… Não conseguimos acessar as informações. Por favor, tente novamente em alguns minutos.'
84
88
  }
85
89
  },
86
90
 
87
91
  methods: {
88
92
  mx_fetchError (error) {
89
93
  const { response } = error
90
- const exception = response?.data?.exception || error.message
91
94
 
92
95
  const status = response?.status
93
96
 
@@ -102,7 +105,7 @@ export default {
102
105
  return
103
106
  }
104
107
 
105
- this.$qas.error('Ops! Erro ao obter os dados.', exception)
108
+ this.$qas.error(this.mx_fetchErrorMessage)
106
109
  },
107
110
 
108
111
  mx_setErrors (errors = {}) {