@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
@@ -1,110 +1,100 @@
1
1
  <template>
2
- <component v-bind="attributes" :is="tag" @click.stop.prevent="onDelete">
3
- <template v-for="(_, name) in $slots" #[name]="context">
2
+ <component v-bind="attributes" :is="props.tag" @click.stop.prevent="onDelete">
3
+ <template v-for="(_, name) in slots" #[name]="context">
4
4
  <slot :name="name" v-bind="context || {}" />
5
5
  </template>
6
6
  </component>
7
7
  </template>
8
8
 
9
- <script>
10
- import QasBtn from '../btn/QasBtn.vue'
9
+ <script setup>
10
+ import { inject, computed, useAttrs, useSlots } from 'vue'
11
+ import { useRoute } from 'vue-router'
11
12
 
12
- export default {
13
+ defineOptions({
13
14
  name: 'QasDelete',
15
+ inheritAttrs: false
16
+ })
14
17
 
15
- components: {
16
- QasBtn
18
+ const props = defineProps({
19
+ customId: {
20
+ default: '',
21
+ type: [Number, String]
17
22
  },
18
23
 
19
- inheritAttrs: false,
20
-
21
- props: {
22
- customId: {
23
- default: '',
24
- type: [Number, String]
25
- },
24
+ dialogProps: {
25
+ default: () => ({}),
26
+ type: Object
27
+ },
26
28
 
27
- dialogProps: {
28
- default: () => ({}),
29
- type: Object
30
- },
29
+ entity: {
30
+ required: true,
31
+ type: String
32
+ },
31
33
 
32
- entity: {
33
- required: true,
34
- type: String
35
- },
34
+ tag: {
35
+ default: 'qas-btn',
36
+ type: String
37
+ },
36
38
 
37
- tag: {
38
- default: 'qas-btn',
39
- type: String
40
- },
39
+ url: {
40
+ default: '',
41
+ type: String
42
+ },
41
43
 
42
- url: {
43
- default: '',
44
- type: String
45
- },
44
+ deleting: {
45
+ type: Boolean
46
+ },
46
47
 
47
- deleting: {
48
- type: Boolean
49
- },
48
+ useAutoDeleteRoute: {
49
+ default: true,
50
+ type: Boolean
51
+ },
50
52
 
51
- useAutoDeleteRoute: {
52
- default: true,
53
- type: Boolean
54
- },
53
+ redirectRoute: {
54
+ type: [Object, String],
55
+ default: ''
56
+ }
57
+ })
55
58
 
56
- redirectRoute: {
57
- type: [Object, String],
58
- default: ''
59
- }
60
- },
59
+ const emit = defineEmits(['success', 'error', 'update:deleting'])
61
60
 
62
- emits: [
63
- 'success',
64
- 'error',
65
- 'update:deleting'
66
- ],
67
-
68
- computed: {
69
- attributes () {
70
- return {
71
- ...this.$attrs,
72
- color: this.isButton ? 'grey-10' : this.$attrs.color
73
- }
74
- },
61
+ const slots = useSlots()
62
+ const attrs = useAttrs()
63
+ const route = useRoute()
75
64
 
76
- id () {
77
- return this.customId || this.$route.params.id
78
- },
65
+ // global
66
+ const qas = inject('qas')
79
67
 
80
- isButton () {
81
- return this.tag === 'qas-btn'
82
- }
83
- },
68
+ const id = computed(() => props.customId || route.params.id)
69
+ const isButton = computed(() => props.tag === 'qas-btn')
84
70
 
85
- methods: {
86
- onDelete () {
87
- this.$qas.delete({
88
- deleteActionParams: {
89
- entity: this.entity,
90
- id: this.id,
91
- url: this.url
92
- },
71
+ const attributes = computed(() => {
72
+ return {
73
+ ...attrs,
74
+ color: isButton.value ? 'grey-10' : attrs.color
75
+ }
76
+ })
77
+
78
+ function onDelete () {
79
+ qas.delete({
80
+ deleteActionParams: {
81
+ entity: props.entity,
82
+ id: id.value,
83
+ url: props.url
84
+ },
93
85
 
94
- dialogProps: this.dialogProps,
86
+ dialogProps: props.dialogProps,
95
87
 
96
- useAutoDeleteRoute: this.useAutoDeleteRoute,
88
+ useAutoDeleteRoute: props.useAutoDeleteRoute,
97
89
 
98
- redirectRoute: this.redirectRoute,
90
+ redirectRoute: props.redirectRoute,
99
91
 
100
- // callbacks
101
- onDelete: isDeleting => this.$emit('update:deleting', isDeleting),
92
+ // callbacks
93
+ onDelete: isDeleting => emit('update:deleting', isDeleting),
102
94
 
103
- onDeleteError: error => this.$emit('error', error),
95
+ onDeleteError: error => emit('error', error),
104
96
 
105
- onDeleteSuccess: response => this.$emit('success', response)
106
- })
107
- }
108
- }
97
+ onDeleteSuccess: response => emit('success', response)
98
+ })
109
99
  }
110
100
  </script>
@@ -1,10 +1,10 @@
1
1
  <template>
2
- <q-dialog ref="dialogRef" class="qas-dialog" data-cy="dialog" :persistent="persistent" v-bind="dialogProps" @update:model-value="updateModelValue">
2
+ <q-dialog ref="dialogRef" class="qas-dialog" data-cy="dialog" :persistent="props.persistent" v-bind="dialogProps" @update:model-value="updateModelValue">
3
3
  <div class="bg-white q-pa-lg" :style="style">
4
4
  <header v-if="hasHeader" class="q-mb-lg">
5
5
  <slot name="header">
6
6
  <div class="items-center justify-between row">
7
- <h5 class="text-h5" data-cy="dialog-title">{{ card.title }}</h5>
7
+ <h5 class="text-h5" data-cy="dialog-title">{{ props.card.title }}</h5>
8
8
 
9
9
  <qas-btn v-if="isInfoDialog" v-close-popup color="grey-10" data-cy="dialog-close-btn" icon="sym_r_close" variant="tertiary" />
10
10
  </div>
@@ -14,14 +14,14 @@
14
14
  <section class="text-body1 text-grey-8">
15
15
  <component :is="mainComponent.is" ref="form" v-bind="mainComponent.props">
16
16
  <slot name="description">
17
- <component :is="descriptionComponent" data-cy="dialog-description">{{ card.description }}</component>
17
+ <component :is="descriptionComponent" data-cy="dialog-description">{{ props.card.description }}</component>
18
18
  </slot>
19
19
 
20
20
  <div v-if="!isInfoDialog">
21
21
  <slot name="actions">
22
22
  <qas-actions v-bind="defaultActionsProps">
23
23
  <template v-if="hasOk" #primary>
24
- <qas-btn v-close-popup="!useForm" class="full-width" data-cy="dialog-ok-btn" variant="primary" v-bind="defaultOk" />
24
+ <qas-btn v-close-popup="!props.useForm" class="full-width" data-cy="dialog-ok-btn" variant="primary" v-bind="defaultOk" />
25
25
  </template>
26
26
 
27
27
  <template v-if="hasCancel" #secondary>
@@ -107,7 +107,7 @@ const props = defineProps({
107
107
  }
108
108
  })
109
109
 
110
- const emits = defineEmits([
110
+ const emit = defineEmits([
111
111
  // model
112
112
  'update:modelValue',
113
113
 
@@ -130,7 +130,7 @@ const { dialogRef, onDialogHide } = useDialogPluginComponent()
130
130
  // QForm template
131
131
  const form = ref(null)
132
132
 
133
- const composablesParams = { emits, form, props, screen, slots }
133
+ const composablesParams = { emit, form, props, screen, slots }
134
134
 
135
135
  const { defaultCancel, hasCancel } = useCancel(composablesParams)
136
136
  const { defaultOk, hasOk, onOk } = useOk(composablesParams)
@@ -174,7 +174,7 @@ const defaultActionsProps = computed(() => {
174
174
  })
175
175
 
176
176
  function updateModelValue (value) {
177
- emits('update:modelValue', value)
177
+ emit('update:modelValue', value)
178
178
  }
179
179
  </script>
180
180
 
@@ -3,13 +3,13 @@ import { computed } from 'vue'
3
3
  /**
4
4
  * @param {{
5
5
  * props: { cancel: object },
6
- * emits: (event: 'cancel') => void
6
+ * emit: (event: 'cancel') => void
7
7
  * }} config
8
8
  */
9
9
  export default function useCancel (config = {}) {
10
10
  const {
11
11
  props,
12
- emits
12
+ emit
13
13
  } = config
14
14
 
15
15
  const defaultCancel = computed(() => {
@@ -30,7 +30,7 @@ export default function useCancel (config = {}) {
30
30
  function onCancel () {
31
31
  props.cancel.onClick?.()
32
32
 
33
- emits('cancel')
33
+ emit('cancel')
34
34
  }
35
35
 
36
36
  return {
@@ -6,7 +6,7 @@ import { QForm } from 'quasar'
6
6
  * props: { card: object, useForm: boolean, useValidationAllAtOnce: boolean },
7
7
  * form: import('vue').Ref<HTMLInputElement | null>,
8
8
  * hasOk: import('vue').ComputedRef<boolean>,
9
- * emits: (event: 'validate', payload: Promise<boolean> | boolean) => void,
9
+ * emit: (event: 'validate', payload: Promise<boolean> | boolean) => void,
10
10
  * onOk: Function
11
11
  * }} config
12
12
  */
@@ -17,7 +17,7 @@ export default function useDynamicComponents (config = {}) {
17
17
  hasOk,
18
18
 
19
19
  onOk = () => {},
20
- emits
20
+ emit
21
21
  } = config
22
22
 
23
23
  const mainComponent = computed(() => {
@@ -58,12 +58,12 @@ export default function useDynamicComponents (config = {}) {
58
58
  }
59
59
  }
60
60
 
61
- emits('validate', isAllComponentValid)
61
+ emit('validate', isAllComponentValid)
62
62
 
63
63
  return
64
64
  }
65
65
 
66
- emits('validate', form.value.validate())
66
+ emit('validate', form.value.validate())
67
67
  }
68
68
 
69
69
  /**
@@ -3,13 +3,13 @@ import { computed } from 'vue'
3
3
  /**
4
4
  * @param {{
5
5
  * props: { ok: object, useForm: boolean },
6
- * emits: (event: 'ok') => void
6
+ * emit: (event: 'ok') => void
7
7
  * }} config
8
8
  */
9
9
  export default function useOk (config = {}) {
10
10
  const {
11
11
  props,
12
- emits
12
+ emit
13
13
  } = config
14
14
 
15
15
  const defaultOk = computed(() => {
@@ -33,7 +33,7 @@ export default function useOk (config = {}) {
33
33
  function onOk () {
34
34
  props.ok.onClick?.()
35
35
 
36
- emits('ok')
36
+ emit('ok')
37
37
  }
38
38
 
39
39
  return {
@@ -2,84 +2,85 @@
2
2
  <q-dialog ref="dialog" persistent @hide="onDialogHide">
3
3
  <q-card class="full-width" style="max-width: 80vw;">
4
4
  <q-card-section>
5
- <component :is="component" v-if="component" :route="route" :use-boundary="false" @hide="hide" />
5
+ <component :is="component" v-if="component" :route="normalizedRoute" :use-boundary="false" @hide="hide" />
6
6
  </q-card-section>
7
7
  </q-card>
8
8
  </q-dialog>
9
9
  </template>
10
10
 
11
- <script>
12
- import { markRaw } from 'vue'
13
- import { Loading, extend } from 'quasar'
11
+ <script setup>
14
12
  import { NotifyError } from '../../plugins'
15
13
 
16
- export default {
17
- name: 'QasDialogRouter',
14
+ import { Loading, extend } from 'quasar'
15
+ import { ref, markRaw } from 'vue'
16
+ import { useRouter, useRoute } from 'vue-router'
18
17
 
19
- emits: ['error', 'hide'],
18
+ defineOptions({ name: 'QasDialogRouter' })
20
19
 
21
- expose: ['show', 'hide'],
20
+ const emit = defineEmits(['error', 'hide'])
22
21
 
23
- data () {
24
- return {
25
- component: null,
26
- parentRoute: '',
27
- route: null
28
- }
29
- },
30
-
31
- methods: {
32
- hide () {
33
- this.$refs.dialog.hide()
34
- },
35
-
36
- onDialogHide () {
37
- if (history && this.parentRoute) {
38
- history.replaceState(null, null, this.parentRoute)
39
- }
40
-
41
- this.component = ''
42
- this.parentRoute = ''
43
- this.route = null
44
-
45
- this.$emit('hide')
46
- },
47
-
48
- resolveRoute (path) {
49
- return this.$router.resolve(path)
50
- },
51
-
52
- async show (route) {
53
- this.parentRoute = this.$route.fullPath
54
- this.route = this.resolveRoute(route)
55
-
56
- if (history) {
57
- history.replaceState(null, null, this.route.fullPath)
58
- }
59
-
60
- try {
61
- Loading.show()
62
-
63
- const component = markRaw(
64
- extend(true, {}, [...this.route.matched].pop().components.default)
65
- )
66
-
67
- if (typeof component.value !== 'function') {
68
- this.component = component
69
- this.$refs.dialog.show()
70
- } else {
71
- const componentFn = (await component()).default
72
- this.component = componentFn
73
-
74
- this.$refs.dialog.show()
75
- }
76
- } catch (error) {
77
- NotifyError('Ops! Erro ao carregar item.')
78
- this.$emit('error', error)
79
- } finally {
80
- Loading.hide()
81
- }
22
+ defineExpose({ show, hide })
23
+
24
+ const router = useRouter()
25
+ const route = useRoute()
26
+
27
+ // template refs
28
+ const dialog = ref(null)
29
+
30
+ const component = ref(null)
31
+ const parentRoute = ref('')
32
+ const normalizedRoute = ref(null)
33
+
34
+ // functions
35
+ function hide () {
36
+ dialog.value.hide()
37
+ }
38
+
39
+ function onDialogHide () {
40
+ if (history && parentRoute.value) {
41
+ history.replaceState(null, null, parentRoute.value)
42
+ }
43
+
44
+ component.value = ''
45
+ parentRoute.value = ''
46
+ normalizedRoute.value = null
47
+
48
+ emit('hide')
49
+ }
50
+
51
+ function getResolvedRoute (path) {
52
+ return router.resolve(path)
53
+ }
54
+
55
+ async function show (routeParam) {
56
+ parentRoute.value = route.fullPath
57
+ normalizedRoute.value = getResolvedRoute(routeParam)
58
+
59
+ if (history) {
60
+ history.replaceState(null, null, normalizedRoute.value.fullPath)
61
+ }
62
+
63
+ try {
64
+ Loading.show()
65
+
66
+ const component = markRaw(
67
+ extend(true, {}, [...normalizedRoute.value.matched].pop().components.default)
68
+ )
69
+
70
+ if (typeof component.value !== 'function') {
71
+ component.value = component
72
+ dialog.value.show()
73
+ } else {
74
+ const componentFn = (await component()).default
75
+ component.value = componentFn
76
+
77
+ dialog.value.show()
82
78
  }
79
+ } catch (error) {
80
+ NotifyError('Ops! Erro ao carregar item.')
81
+ emit('error', error)
82
+ } finally {
83
+ Loading.hide()
83
84
  }
84
85
  }
85
86
  </script>
@@ -1,20 +1,18 @@
1
1
  <template>
2
2
  <div class="text-body1 text-grey-8">
3
3
  <slot>
4
- {{ text }}
4
+ {{ props.text }}
5
5
  </slot>
6
6
  </div>
7
7
  </template>
8
8
 
9
- <script>
10
- export default {
11
- name: 'QasEmptyResultText',
9
+ <script setup>
10
+ defineOptions({ name: 'QasEmptyResultText' })
12
11
 
13
- props: {
14
- text: {
15
- default: 'Não há itens para serem exibidos.',
16
- type: String
17
- }
12
+ const props = defineProps({
13
+ text: {
14
+ default: 'Não há itens para serem exibidos.',
15
+ type: String
18
16
  }
19
- }
17
+ })
20
18
  </script>
@@ -10,14 +10,14 @@
10
10
  <div :class="classes">
11
11
  <div v-for="(field, key) in fieldsetItem.fields.visible" :key="key" :class="getFieldClass({ index: key, fields: normalizedFields })">
12
12
  <slot :field="field" :name="`field-${field.name}`">
13
- <qas-field :disable="isFieldDisabled(field)" v-bind="fieldsProps[field.name]" :error="errors[key]" :field="field" :model-value="modelValue[field.name]" @update:model-value="updateModelValue({ key: field.name, value: $event })" />
13
+ <qas-field :disable="isFieldDisabled(field)" v-bind="props.fieldsProps[field.name]" :error="props.errors[key]" :field="field" :model-value="props.modelValue[field.name]" @update:model-value="updateModelValue({ key: field.name, value: $event })" />
14
14
  </slot>
15
15
  </div>
16
16
  </div>
17
17
 
18
18
  <div v-for="(field, key) in fieldsetItem.fields.hidden" :key="key">
19
19
  <slot :field="field" :name="`field-${field.name}`">
20
- <qas-field :disable="isFieldDisabled(field)" v-bind="fieldsProps[field.name]" :field="field" :model-value="modelValue[field.name]" @update:model-value="updateModelValue({ key: field.name, value: $event })" />
20
+ <qas-field :disable="isFieldDisabled(field)" v-bind="props.fieldsProps[field.name]" :field="field" :model-value="props.modelValue[field.name]" @update:model-value="updateModelValue({ key: field.name, value: $event })" />
21
21
  </slot>
22
22
  </div>
23
23
  </div>