@bildvitta/quasar-ui-asteroid 3.14.0-beta.0 → 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.
Files changed (51) hide show
  1. package/package.json +1 -1
  2. package/src/components/actions-menu/QasActionsMenu.vue +16 -14
  3. package/src/components/alert/QasAlert.vue +1 -1
  4. package/src/components/app-bar/QasAppBar.vue +5 -5
  5. package/src/components/app-menu/QasAppMenu.vue +8 -8
  6. package/src/components/app-menu/private/PvAppMenuDropdown.vue +1 -1
  7. package/src/components/app-user/QasAppUser.vue +10 -10
  8. package/src/components/avatar/QasAvatar.vue +2 -2
  9. package/src/components/breakline/QasBreakline.vue +5 -6
  10. package/src/components/btn-dropdown/QasBtnDropdown.vue +74 -95
  11. package/src/components/card/QasCard.vue +55 -73
  12. package/src/components/chart-view/QasChartView.vue +37 -9
  13. package/src/components/chart-view/QasChartView.yml +6 -0
  14. package/src/components/checkbox-group/QasCheckboxGroup.vue +81 -92
  15. package/src/components/copy/QasCopy.vue +20 -27
  16. package/src/components/date/QasDate.vue +316 -355
  17. package/src/components/date/QasDate.yml +0 -5
  18. package/src/components/date/enums/DateMaskOptions.js +6 -0
  19. package/src/components/date-time-input/QasDateTimeInput.vue +198 -209
  20. package/src/components/debugger/QasDebugger.vue +20 -12
  21. package/src/components/delete/QasDelete.vue +70 -80
  22. package/src/components/dialog/QasDialog.vue +7 -7
  23. package/src/components/dialog/composables/use-cancel.js +3 -3
  24. package/src/components/dialog/composables/use-dynamic-components.js +4 -4
  25. package/src/components/dialog/composables/use-ok.js +3 -3
  26. package/src/components/dialog-router/QasDialogRouter.vue +68 -67
  27. package/src/components/empty-result-text/QasEmptyResultText.vue +8 -10
  28. package/src/components/form-generator/QasFormGenerator.vue +2 -2
  29. package/src/components/gallery/QasGallery.vue +175 -196
  30. package/src/components/gallery/composables/use-delete.js +54 -0
  31. package/src/components/gallery/private/PvGalleryCarouselDialog.vue +48 -55
  32. package/src/components/gallery/private/PvGalleryDeleteDialog.vue +41 -50
  33. package/src/components/gallery-card/QasGalleryCard.vue +90 -103
  34. package/src/components/grid-generator/QasGridGenerator.vue +2 -2
  35. package/src/components/header-actions/QasHeaderActions.vue +35 -50
  36. package/src/components/header-actions/QasHeaderActions.yml +1 -1
  37. package/src/components/infinite-scroll/QasInfiniteScroll.vue +2 -2
  38. package/src/components/label/QasLabel.vue +42 -54
  39. package/src/components/list-items/QasListItems.vue +32 -41
  40. package/src/components/map/QasMap.vue +44 -46
  41. package/src/components/numeric-input/QasNumericInput.vue +2 -2
  42. package/src/components/page-header/QasPageHeader.vue +74 -87
  43. package/src/components/pagination/QasPagination.vue +21 -21
  44. package/src/components/select-list-dialog/QasSelectListDialog.vue +4 -2
  45. package/src/components/tabs-generator/QasTabsGenerator.vue +55 -63
  46. package/src/components/timeline/QasTimeline.vue +1 -1
  47. package/src/components/uploader/private/PvUploaderGalleryCard.vue +1 -1
  48. package/src/components/whatsapp-link/QasWhatsappLink.vue +34 -0
  49. package/src/components/whatsapp-link/QasWhatsappLink.yml +18 -0
  50. package/src/composables/private/use-generator.js +0 -8
  51. package/src/vue-plugin.js +7 -1
@@ -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,118 +1,107 @@
1
1
  <template>
2
2
  <div :class="classes">
3
- <div v-for="(option, index) in options" :key="index">
3
+ <div v-for="(option, index) in props.options" :key="index">
4
4
  <q-checkbox v-if="hasChildren(option)" :class="getCheckboxClass(option)" :label="option.label" :model-value="getModelValue(index)" @update:model-value="updateCheckbox($event, option, index)" />
5
5
 
6
- <q-option-group v-if="hasChildren(option)" class="q-ml-sm" :inline="inline" :model-value="modelValue" :options="option.children" type="checkbox" @update:model-value="updateChildren($event, option, index)" />
6
+ <q-option-group v-if="hasChildren(option)" class="q-ml-sm" :inline="props.inline" :model-value="props.modelValue" :options="option.children" type="checkbox" @update:model-value="updateChildren($event, option, index)" />
7
7
 
8
- <q-option-group v-else v-model="model" v-bind="$attrs" :options="[option]" type="checkbox" />
8
+ <q-option-group v-else v-model="model" v-bind="attrs" :options="[option]" type="checkbox" />
9
9
  </div>
10
10
  </div>
11
11
  </template>
12
12
 
13
- <script>
14
- export default {
15
- name: 'QasCheckboxGroup',
13
+ <script setup>
14
+ import { watch, computed, ref, onMounted, useAttrs } from 'vue'
16
15
 
17
- props: {
18
- options: {
19
- default: () => [],
20
- type: Array
21
- },
16
+ defineOptions({ name: 'QasCheckboxGroup' })
22
17
 
23
- modelValue: {
24
- default: () => [],
25
- type: Array
26
- },
18
+ const props = defineProps({
19
+ options: {
20
+ default: () => [],
21
+ type: Array
22
+ },
27
23
 
28
- inline: {
29
- default: true,
30
- type: Boolean
31
- }
24
+ modelValue: {
25
+ default: () => [],
26
+ type: Array
32
27
  },
33
28
 
34
- emits: ['update:modelValue'],
29
+ inline: {
30
+ default: true,
31
+ type: Boolean
32
+ }
33
+ })
35
34
 
36
- data () {
37
- return {
38
- group: {}
39
- }
40
- },
35
+ const emit = defineEmits(['update:modelValue'])
41
36
 
42
- computed: {
43
- model: {
44
- get () {
45
- return this.modelValue
46
- },
37
+ const attrs = useAttrs()
47
38
 
48
- set (value) {
49
- this.$emit('update:modelValue', value)
50
- }
51
- },
39
+ onMounted(handleParent)
52
40
 
53
- classes () {
54
- return this.inline && 'flex q-gutter-x-sm'
55
- }
56
- },
41
+ const group = ref({})
57
42
 
58
- watch: {
59
- options () {
60
- this.handleParent()
61
- }
62
- },
43
+ const classes = computed(() => props.inline && 'flex q-gutter-x-sm')
63
44
 
64
- created () {
65
- this.handleParent()
45
+ const model = computed({
46
+ get () {
47
+ return props.modelValue
66
48
  },
67
49
 
68
- methods: {
69
- handleParent () {
70
- for (const index in this.options) {
71
- const option = this.options[index]
72
- if (this.hasChildren(option)) {
73
- this.setGroupIntersection(this.modelValue, option, index)
74
- }
75
- }
76
- },
77
-
78
- hasChildren (option) {
79
- return Object.prototype.hasOwnProperty.call(option, 'children')
80
- },
81
-
82
- setGroupIntersection (value, option, index) {
83
- const options = option.children.map(item => item.value)
84
- const intersection = options.filter(item => value.includes(item))
85
-
86
- this.group[index] = intersection.length && (intersection.length === options.length ? true : null)
87
- },
88
-
89
- updateCheckbox (value, option, index) {
90
- this.group[index] = value
91
- const groupValues = option.children.map(item => item.value)
92
-
93
- const updatedValue = value
94
- ? [...new Set([...this.modelValue, ...groupValues])]
95
- : this.modelValue.filter(item => !groupValues.includes(item))
96
-
97
- this.updateModelValue(updatedValue)
98
- },
99
-
100
- updateChildren (value, option, index) {
101
- this.setGroupIntersection(value, option, index)
102
- this.updateModelValue(value)
103
- },
104
-
105
- getCheckboxClass (option) {
106
- return this.hasChildren(option) && 'text-weight-bold'
107
- },
108
-
109
- getModelValue (index) {
110
- return this.group[index]
111
- },
112
-
113
- updateModelValue (value) {
114
- this.$emit('update:modelValue', value)
50
+ set (value) {
51
+ updateModelValue(value)
52
+ }
53
+ })
54
+
55
+ watch(() => props.options, handleParent)
56
+
57
+ // functions
58
+ function handleParent () {
59
+ for (const index in props.options) {
60
+ const option = props.options[index]
61
+ if (hasChildren(option)) {
62
+ setGroupIntersection(props.modelValue, option, index)
115
63
  }
116
64
  }
117
65
  }
66
+
67
+ function hasChildren (option) {
68
+ return Object.prototype.hasOwnProperty.call(option, 'children')
69
+ }
70
+
71
+ function setGroupIntersection (value, option, index) {
72
+ const options = option.children.map(item => item.value)
73
+ const intersection = options.filter(item => value.includes(item))
74
+
75
+ group.value[index] = intersection.length && (intersection.length === options.length ? true : null)
76
+ }
77
+
78
+ function updateCheckbox (value, option, index) {
79
+ group.value[index] = value
80
+
81
+ const groupValues = option.children.map(item => item.value)
82
+
83
+ const updatedValue = value
84
+ ? [...new Set([...props.modelValue, ...groupValues])]
85
+ : props.modelValue.filter(item => !groupValues.includes(item))
86
+
87
+ updateModelValue(updatedValue)
88
+ }
89
+
90
+ function updateChildren (value, option, index) {
91
+ setGroupIntersection(value, option, index)
92
+ updateModelValue(value)
93
+ }
94
+
95
+ function updateModelValue (value) {
96
+ emit('update:modelValue', value)
97
+ }
98
+
99
+ function getCheckboxClass (option) {
100
+ return hasChildren(option) && 'text-weight-bold'
101
+ }
102
+
103
+ function getModelValue (index) {
104
+ return group.value[index]
105
+ }
106
+
118
107
  </script>
@@ -1,43 +1,36 @@
1
1
  <template>
2
2
  <span>
3
- <slot>{{ text }}</slot>
3
+ <slot>{{ props.text }}</slot>
4
4
 
5
- <qas-btn class="q-ml-xs" color="primary" :icon="icon" :loading="isLoading" variant="tertiary" @click.stop.prevent="copy">
5
+ <qas-btn class="q-ml-xs" color="primary" :icon="props.icon" :loading="isLoading" variant="tertiary" @click.stop.prevent="copy">
6
6
  <q-tooltip>Copiar</q-tooltip>
7
7
  </qas-btn>
8
8
  </span>
9
9
  </template>
10
10
 
11
- <script>
11
+ <script setup>
12
12
  import { copyToClipboard } from '../../helpers'
13
+ import { ref } from 'vue'
13
14
 
14
- export default {
15
- name: 'QasCopy',
15
+ defineOptions({ name: 'QasCopy' })
16
16
 
17
- props: {
18
- icon: {
19
- default: 'sym_r_file_copy',
20
- type: String
21
- },
22
-
23
- text: {
24
- required: true,
25
- type: String
26
- }
27
- },
28
-
29
- data () {
30
- return {
31
- isLoading: false
32
- }
17
+ const props = defineProps({
18
+ icon: {
19
+ default: 'sym_r_file_copy',
20
+ type: String
33
21
  },
34
22
 
35
- methods: {
36
- copy () {
37
- copyToClipboard(this.text, isLoading => {
38
- this.isLoading = isLoading
39
- })
40
- }
23
+ text: {
24
+ required: true,
25
+ type: String
41
26
  }
27
+ })
28
+
29
+ const isLoading = ref(false)
30
+
31
+ function copy () {
32
+ copyToClipboard(props.text, value => {
33
+ isLoading.value = value
34
+ })
42
35
  }
43
36
  </script>