@bildvitta/quasar-ui-asteroid 3.14.0-beta.1 → 3.14.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.14.0-beta.1",
4
+ "version": "3.14.0-beta.2",
5
5
  "author": "Bild & Vitta <systemteam@bild.com.br>",
6
6
  "license": "MIT",
7
7
  "main": "dist/asteroid.cjs.min.js",
@@ -11,7 +11,7 @@
11
11
  </template>
12
12
 
13
13
  <template #right>
14
- <qas-filters v-bind="chartFiltersProps" v-model:currentFilters="filters" />
14
+ <qas-filters v-bind="chartFiltersProps" />
15
15
  </template>
16
16
  </qas-header-actions>
17
17
 
@@ -74,6 +74,11 @@ export default {
74
74
  },
75
75
 
76
76
  props: {
77
+ beforeFetch: {
78
+ default: null,
79
+ type: Function
80
+ },
81
+
77
82
  entity: {
78
83
  required: true,
79
84
  type: String
@@ -137,6 +142,7 @@ export default {
137
142
 
138
143
  data () {
139
144
  return {
145
+ cancelBeforeFetch: false,
140
146
  data: [],
141
147
  filters: {},
142
148
  isFetched: false,
@@ -199,7 +205,12 @@ export default {
199
205
  useSpacing: false,
200
206
  useUpdateRoute: false,
201
207
 
202
- ...this.filtersProps
208
+ ...this.filtersProps,
209
+
210
+ 'onUpdate:currentFilters': filters => {
211
+ this.filters = filters
212
+ this.filtersProps['onUpdate:currentFilters']?.(filters)
213
+ }
203
214
  }
204
215
  },
205
216
 
@@ -296,7 +307,7 @@ export default {
296
307
 
297
308
  watch: {
298
309
  filters () {
299
- this.fetchData()
310
+ this.handleFetchData()
300
311
  },
301
312
 
302
313
  isFetching (value) {
@@ -306,7 +317,7 @@ export default {
306
317
 
307
318
  created () {
308
319
  this.registerChartJS()
309
- this.fetchData()
320
+ this.handleFetchData()
310
321
  },
311
322
 
312
323
  unmounted () {
@@ -314,17 +325,34 @@ export default {
314
325
  },
315
326
 
316
327
  methods: {
317
- async fetchData () {
328
+ handleFetchData () {
329
+ const hasBeforeFetch = typeof this.beforeFetch === 'function'
330
+ const payload = {
331
+ url: this.url,
332
+ filters: this.filters
333
+ }
334
+
335
+ if (hasBeforeFetch && !this.cancelBeforeFetch) {
336
+ return this.beforeFetch({
337
+ payload,
338
+ resolve: this.fetchData,
339
+ done: () => {
340
+ this.cancelBeforeFetch = true
341
+ }
342
+ })
343
+ }
344
+
345
+ this.fetchData(payload)
346
+ },
347
+
348
+ async fetchData (payload = {}) {
318
349
  try {
319
350
  this.isFetching = true
320
351
 
321
352
  const response = await getAction.call(this, {
322
353
  entity: this.entity,
323
354
  key: 'fetchList',
324
- payload: {
325
- url: this.url,
326
- filters: this.filters
327
- }
355
+ payload
328
356
  })
329
357
 
330
358
  const { results } = response.data
@@ -4,6 +4,12 @@ meta:
4
4
  desc: Componente responsável pela renderização de gráficos
5
5
 
6
6
  props:
7
+ before-fetch:
8
+ desc: Callback para controlar o fetch de dados interno do componente.
9
+ default: null
10
+ type: Function
11
+ examples: ['beforeFetch({ payload, resolve, done })']
12
+
7
13
  entity:
8
14
  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".
9
15
  required: true
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <q-field :label="formattedLabel" :model-value="modelValue" outlined>
3
- <template #control="{ floatingLabel, id }">
4
- <input v-show="floatingLabel" :id="id" ref="input" class="q-field__input" inputmode="numeric" @blur="emitValue" @click="setSelect" @input="emitUpdateModel($event.target.value)">
3
+ <template #control="{ floatingLabel, id, editable }">
4
+ <input v-show="floatingLabel" :id="id" ref="input" class="q-field__input" :disabled="!editable" inputmode="numeric" @blur="emitValue" @click="setSelect" @input="emitUpdateModel($event.target.value)">
5
5
  </template>
6
6
  </q-field>
7
7
  </template>
@@ -317,7 +317,7 @@ export default {
317
317
  },
318
318
 
319
319
  url () {
320
- return this.defaultGalleryCardProps?.card?.url
320
+ return this.normalizedCardGalleryProps?.card?.url
321
321
  }
322
322
  },
323
323
 
@@ -0,0 +1,34 @@
1
+ <template>
2
+ <qas-btn :href="whatsappLink" :icon="fabWhatsapp" target="_blank" />
3
+ </template>
4
+
5
+ <script setup>
6
+ import { computed } from 'vue'
7
+ import { fabWhatsapp } from '@quasar/extras/fontawesome-v5'
8
+
9
+ defineOptions({ name: 'QasWhatsappLink' })
10
+
11
+ const props = defineProps({
12
+ callingCode: {
13
+ type: String,
14
+ default: '55'
15
+ },
16
+
17
+ phone: {
18
+ type: String,
19
+ default: ''
20
+ },
21
+
22
+ text: {
23
+ type: String,
24
+ default: ''
25
+ }
26
+ })
27
+
28
+ const whatsappLink = computed(() => {
29
+ const formattedPhone = props.phone.replace(/[^a-zA-Z0-9]/g, '')
30
+ const formattedText = props.text ? props.text.replace(/\n/g, '%0a') : ''
31
+
32
+ return `https://wa.me/${props.callingCode}${formattedPhone}?text=${formattedText}`
33
+ })
34
+ </script>
@@ -0,0 +1,18 @@
1
+ type: component
2
+
3
+ meta:
4
+ desc: Componente de link para o Whatsapp.
5
+
6
+ props:
7
+ calling-code:
8
+ desc: Propriedade para passar o DDI.
9
+ default: 55
10
+ type: String
11
+
12
+ phone:
13
+ desc: Propriedade para passar o telefone.
14
+ type: String
15
+
16
+ text:
17
+ desc: Propriedade para passar o texto que será enviado na mensagem do Whatsapp.
18
+ type: String
package/src/vue-plugin.js CHANGED
@@ -61,6 +61,7 @@ import QasTransfer from './components/transfer/QasTransfer.vue'
61
61
  import QasTreeGenerator from './components/tree-generator/QasTreeGenerator.vue'
62
62
  import QasUploader from './components/uploader/QasUploader.vue'
63
63
  import QasWelcome from './components/welcome/QasWelcome.vue'
64
+ import QasWhatsappLink from './components/whatsapp-link/QasWhatsappLink.vue'
64
65
 
65
66
  import { Notify, Loading, Quasar, Dialog as QuasarDialog } from 'quasar'
66
67
 
@@ -146,6 +147,7 @@ async function install (app) {
146
147
  app.component('QasTreeGenerator', QasTreeGenerator)
147
148
  app.component('QasUploader', QasUploader)
148
149
  app.component('QasWelcome', QasWelcome)
150
+ app.component('QasWhatsappLink', QasWhatsappLink)
149
151
 
150
152
  app.use(Quasar, { plugins: { Notify, Loading, QuasarDialog, Dialog } })
151
153