@bildvitta/quasar-ui-asteroid 3.13.0-beta.8 → 3.13.0

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 (65) hide show
  1. package/package.json +1 -1
  2. package/src/components/actions/QasActions.vue +54 -47
  3. package/src/components/actions-menu/QasActionsMenu.vue +147 -149
  4. package/src/components/actions-menu/QasActionsMenu.yml +13 -0
  5. package/src/components/app-bar/QasAppBar.vue +59 -87
  6. package/src/components/app-menu/QasAppMenu.vue +128 -256
  7. package/src/components/app-menu/composables/use-app-menu-dropdown.js +71 -0
  8. package/src/components/app-menu/composables/use-app-user.js +46 -0
  9. package/src/components/app-menu/composables/use-development-badge.js +23 -0
  10. package/src/components/app-menu/private/PvAppMenuDropdown.vue +33 -39
  11. package/src/components/app-user/QasAppUser.vue +94 -92
  12. package/src/components/avatar/QasAvatar.vue +67 -85
  13. package/src/components/avatar/enums/AvatarColors.js +9 -0
  14. package/src/components/badge/QasBadge.vue +21 -22
  15. package/src/components/badge/QasBadge.yml +1 -1
  16. package/src/components/box/QasBox.vue +17 -19
  17. package/src/components/btn/QasBtn.vue +132 -135
  18. package/src/components/btn/QasBtn.yml +3 -3
  19. package/src/components/btn-dropdown/QasBtnDropdown.vue +2 -2
  20. package/src/components/chart-view/QasChartView.vue +2 -2
  21. package/src/components/date/QasDate.vue +3 -3
  22. package/src/components/date-time-input/QasDateTimeInput.vue +2 -2
  23. package/src/components/delete/QasDelete.vue +1 -1
  24. package/src/components/dialog/QasDialog.vue +135 -244
  25. package/src/components/dialog/composables/use-cancel.js +40 -0
  26. package/src/components/dialog/composables/use-dynamic-components.js +86 -0
  27. package/src/components/dialog/composables/use-ok.js +45 -0
  28. package/src/components/filters/QasFilters.vue +1 -1
  29. package/src/components/filters/private/PvFiltersButton.vue +2 -2
  30. package/src/components/form-generator/QasFormGenerator.yml +1 -1
  31. package/src/components/gallery/QasGallery.vue +1 -1
  32. package/src/components/gallery/private/PvGalleryCarouselDialog.vue +2 -2
  33. package/src/components/gallery-card/QasGalleryCard.vue +2 -2
  34. package/src/components/label/QasLabel.vue +1 -1
  35. package/src/components/label/QasLabel.yml +1 -1
  36. package/src/components/nested-fields/QasNestedFields.vue +37 -14
  37. package/src/components/nested-fields/QasNestedFields.yml +63 -17
  38. package/src/components/page-header/QasPageHeader.vue +1 -11
  39. package/src/components/pagination/QasPagination.vue +1 -1
  40. package/src/components/search-input/QasSearchInput.vue +2 -2
  41. package/src/components/select-list-dialog/QasSelectListDialog.vue +3 -3
  42. package/src/components/table-generator/QasTableGenerator.vue +8 -4
  43. package/src/components/tabs-generator/QasTabsGenerator.vue +1 -1
  44. package/src/components/timeline/QasTimeline.vue +2 -2
  45. package/src/components/tree-generator/QasTreeGenerator.vue +1 -1
  46. package/src/components/uploader/QasUploader.vue +1 -1
  47. package/src/components/uploader/private/PvUploaderGalleryCard.vue +1 -1
  48. package/src/components/welcome/QasWelcome.vue +2 -2
  49. package/src/composables/use-history.js +4 -4
  50. package/src/css/components/base.scss +1 -0
  51. package/src/css/components/button.scss +2 -2
  52. package/src/css/components/checkbox.scss +12 -0
  53. package/src/css/components/editor.scss +7 -0
  54. package/src/css/components/field.scss +23 -3
  55. package/src/css/components/index.scss +3 -0
  56. package/src/css/components/item.scss +1 -1
  57. package/src/css/components/radio.scss +15 -2
  58. package/src/css/components/toggle.scss +11 -0
  59. package/src/css/variables/typography.scss +11 -1
  60. package/src/enums/Align.js +7 -0
  61. package/src/index.scss +4 -4
  62. package/src/pages/ErrorComponent.vue +1 -2
  63. package/src/plugins/dialog/Dialog.js +1 -1
  64. package/src/shared/notify-config.js +1 -1
  65. package/src/vue-plugin.js +4 -0
@@ -16,53 +16,47 @@
16
16
  </div>
17
17
  </template>
18
18
 
19
- <script>
20
- export default {
21
- name: 'PvAppMenuDropdown',
19
+ <script setup>
20
+ import { computed } from 'vue'
22
21
 
23
- props: {
24
- buttonDropdownProps: {
25
- type: Object,
26
- default: () => ({})
27
- },
22
+ defineOptions({ name: 'PvAppMenuDropdown' })
28
23
 
29
- currentModule: {
30
- type: Object,
31
- default: () => ({})
32
- },
33
-
34
- modules: {
35
- type: Array,
36
- default: () => []
37
- }
24
+ const props = defineProps({
25
+ buttonDropdownProps: {
26
+ type: Object,
27
+ default: () => ({})
38
28
  },
39
29
 
40
- computed: {
41
- defaultButtonDropdownProps () {
42
- return {
43
- ...this.buttonDropdownProps,
44
-
45
- buttonProps: {
46
- align: 'between',
47
- class: 'text-subtitle2',
48
- color: 'primary',
49
- iconRight: 'sym_r_expand_more',
50
- label: this.currentModule.label,
51
- useEllipsis: true,
52
- useLabelOnSmallScreen: true
53
- }
54
- }
55
- }
30
+ currentModule: {
31
+ type: Object,
32
+ default: () => ({})
56
33
  },
57
34
 
58
- methods: {
59
- isActive ({ value }) {
60
- const { host, protocol } = window.location
61
- const url = `${protocol}//${host}`
35
+ modules: {
36
+ type: Array,
37
+ default: () => []
38
+ }
39
+ })
40
+
41
+ const defaultButtonDropdownProps = computed(() => ({
42
+ ...props.buttonDropdownProps,
62
43
 
63
- return url.includes(value)
64
- }
44
+ buttonProps: {
45
+ align: 'between',
46
+ class: 'text-subtitle2',
47
+ color: 'primary',
48
+ iconRight: 'sym_r_expand_more',
49
+ label: props.currentModule.label,
50
+ useEllipsis: true,
51
+ useLabelOnSmallScreen: true
65
52
  }
53
+ }))
54
+
55
+ function isActive ({ value }) {
56
+ const { host, protocol } = window.location
57
+ const url = `${protocol}//${host}`
58
+
59
+ return url.includes(value)
66
60
  }
67
61
  </script>
68
62
 
@@ -2,20 +2,33 @@
2
2
  <div class="cursor-pointer items-center no-wrap q-gutter-sm qas-app-user row" data-cy="app-user">
3
3
  <div class="relative-position">
4
4
  <qas-avatar :image="user.photo" :size="avatarSize" :title="userName" />
5
- <q-badge v-if="hasNotifications" color="red" floating>{{ notifications.count }}</q-badge>
5
+
6
+ <q-badge v-if="hasNotifications" color="red" floating>
7
+ {{ notifications.count }}
8
+ </q-badge>
6
9
  </div>
7
10
 
8
11
  <div class="ellipsis qas-app-user__data">
9
- <div class="ellipsis qas-app-user__name text-grey-9">{{ userName }}</div>
10
- <div class="ellipsis qas-app-user__email text-grey-8">{{ user.email }}</div>
12
+ <div class="ellipsis qas-app-user__name text-grey-10">
13
+ {{ userName }}
14
+ </div>
15
+
16
+ <div class="ellipsis qas-app-user__email text-grey-8">
17
+ {{ user.email }}
18
+ </div>
11
19
  </div>
12
20
 
13
- <q-menu class="shadow-2 text-grey-9" max-height="400px" v-bind="menuProps">
21
+ <q-menu class="shadow-2 text-grey-10" max-height="400px" v-bind="menuProps">
14
22
  <div class="q-pb-sm q-pt-md q-px-md qas-app-user__menu">
15
- <qas-avatar class="q-mb-md" :image="user.photo" size="96px" :title="userName" />
23
+ <qas-avatar class="q-mb-md" :image="user.photo" size="64px" :title="userName" />
24
+
25
+ <div class="ellipsis qas-app-user__menu-name">
26
+ {{ userName }}
27
+ </div>
16
28
 
17
- <div class="ellipsis qas-app-user__menu-name">{{ userName }}</div>
18
- <div class="ellipsis">{{ user.email }}</div>
29
+ <div class="ellipsis">
30
+ {{ user.email }}
31
+ </div>
19
32
 
20
33
  <qas-select v-if="hasCompaniesSelect" v-model="companiesModel" class="q-my-md" v-bind="defaultCompanyProps" data-cy="app-user-companies-select" @update:model-value="setCompanies" />
21
34
 
@@ -25,7 +38,9 @@
25
38
  <q-icon name="sym_r_person" />
26
39
  </q-item-section>
27
40
 
28
- <q-item-section>Editar</q-item-section>
41
+ <q-item-section>
42
+ Editar
43
+ </q-item-section>
29
44
  </q-item>
30
45
 
31
46
  <q-item v-if="hasNotifications" v-close-popup class="qas-app-user__menu-item" clickable>
@@ -33,10 +48,14 @@
33
48
  <q-icon name="sym_r_notifications" />
34
49
  </q-item-section>
35
50
 
36
- <q-item-section>Notificações</q-item-section>
51
+ <q-item-section>
52
+ Notificações
53
+ </q-item-section>
37
54
 
38
55
  <q-item-section side>
39
- <q-badge color="red">{{ notifications.count }}</q-badge>
56
+ <q-badge color="red">
57
+ {{ notifications.count }}
58
+ </q-badge>
40
59
  </q-item-section>
41
60
  </q-item>
42
61
 
@@ -45,7 +64,9 @@
45
64
  <q-icon name="sym_r_logout" />
46
65
  </q-item-section>
47
66
 
48
- <q-item-section>Sair</q-item-section>
67
+ <q-item-section>
68
+ Sair
69
+ </q-item-section>
49
70
  </q-item>
50
71
  </q-list>
51
72
  </div>
@@ -53,110 +74,91 @@
53
74
  </div>
54
75
  </template>
55
76
 
56
- <script>
77
+ <script setup>
57
78
  import QasAvatar from '../avatar/QasAvatar.vue'
58
79
 
59
- export default {
60
- name: 'QasAppUser',
80
+ import { NotifySuccess, NotifyError } from '../../plugins'
81
+
82
+ import { ref, computed, watch, inject } from 'vue'
61
83
 
62
- components: {
63
- QasAvatar
84
+ defineOptions({ name: 'QasAppUser' })
85
+
86
+ const props = defineProps({
87
+ avatarSize: {
88
+ default: '40px',
89
+ type: String
64
90
  },
65
91
 
66
- props: {
67
- avatarSize: {
68
- default: '36px',
69
- type: String
70
- },
71
-
72
- companyProps: {
73
- default: () => ({}),
74
- type: Object
75
- },
76
-
77
- menuProps: {
78
- default: () => ({}),
79
- type: Object
80
- },
81
-
82
- notifications: {
83
- default: () => ({}),
84
- type: Object
85
- },
86
-
87
- user: {
88
- default: () => ({}),
89
- required: true,
90
- type: Object
91
- }
92
+ companyProps: {
93
+ default: () => ({}),
94
+ type: Object
92
95
  },
93
96
 
94
- emits: ['sign-out'],
97
+ menuProps: {
98
+ default: () => ({}),
99
+ type: Object
100
+ },
95
101
 
96
- data () {
97
- return {
98
- companiesModel: '',
99
- loading: false
100
- }
102
+ notifications: {
103
+ default: () => ({}),
104
+ type: Object
101
105
  },
102
106
 
103
- computed: {
104
- defaultCompanyProps () {
105
- return {
106
- loading: this.loading,
107
+ user: {
108
+ default: () => ({}),
109
+ required: true,
110
+ type: Object
111
+ }
112
+ })
107
113
 
108
- ...this.companyProps,
114
+ const emits = defineEmits(['sign-out'])
109
115
 
110
- // não é possível alterar o label.
111
- label: 'Vínculo'
112
- }
113
- },
116
+ // vindo direto do boot api.js
117
+ const axios = inject('axios')
114
118
 
115
- hasNotifications () {
116
- return !!Object.keys(this.notifications).length
117
- },
119
+ const companiesModel = ref('')
120
+ const loading = ref(false)
118
121
 
119
- userName () {
120
- return this.user.name || this.user.givenName
121
- },
122
+ const defaultCompanyProps = computed(() => {
123
+ return {
124
+ loading: loading.value,
122
125
 
123
- hasCompaniesSelect () {
124
- return !!this.companyProps.options?.length
125
- }
126
- },
126
+ ...props.companyProps,
127
127
 
128
- watch: {
129
- 'companyProps.modelValue': {
130
- handler (value) {
131
- this.companiesModel = value
132
- },
128
+ // não é possível alterar o label.
129
+ label: 'Vínculo'
130
+ }
131
+ })
133
132
 
134
- immediate: true
135
- }
136
- },
133
+ const hasCompaniesSelect = computed(() => !!props.companyProps.options?.length)
134
+ const hasNotifications = computed(() => !!Object.keys(props.notifications).length)
137
135
 
138
- methods: {
139
- signOut () {
140
- this.$emit('sign-out')
141
- },
136
+ const userName = computed(() => props.user.name || props.user.givenName)
142
137
 
143
- async setCompanies (value) {
144
- this.loading = true
138
+ // watch
139
+ watch(() => props.companyProps.modelValue, value => {
140
+ companiesModel.value = value
141
+ }, { immediate: true })
145
142
 
146
- try {
147
- await this.$axios.patch('users/me', { companies: value })
143
+ // métodos
144
+ function signOut () {
145
+ emits('sign-out')
146
+ }
148
147
 
149
- this.$qas.success('Vínculo alterado com sucesso.')
148
+ async function setCompanies (value) {
149
+ loading.value = true
150
150
 
151
- setTimeout(() => location.reload(), 1500)
152
- } catch {
153
- this.companiesModel = this.companyProps.modelValue
151
+ try {
152
+ await axios.patch('users/me', { companies: value })
153
+ setTimeout(() => location.reload(), 1500)
154
154
 
155
- this.$qas.error('Falha ao alterar vínculo.')
156
- } finally {
157
- this.loading = false
158
- }
159
- }
155
+ NotifySuccess('Vínculo alterado com sucesso.')
156
+ } catch {
157
+ companiesModel.value = props.companyProps.modelValue
158
+
159
+ NotifyError('Falha ao alterar vínculo.')
160
+ } finally {
161
+ loading.value = false
160
162
  }
161
163
  }
162
164
  </script>
@@ -6,103 +6,85 @@
6
6
  </q-avatar>
7
7
  </template>
8
8
 
9
- <script>
10
- const AvatarColors = {
11
- Primary: 'primary',
12
- SecondaryContrast: 'secondary-contrast',
13
- Grey4: 'grey-4'
14
- }
9
+ <script setup>
10
+ import { AvatarColors } from './enums/AvatarColors'
11
+
12
+ import { ref, computed, watch, useAttrs } from 'vue'
15
13
 
16
- export default {
14
+ defineOptions({
17
15
  name: 'QasAvatar',
16
+ inheritAttrs: false
17
+ })
18
+
19
+ const props = defineProps({
20
+ color: {
21
+ type: String,
22
+ default: AvatarColors.Primary,
23
+ validator: value => {
24
+ const availableColors = Object.values(AvatarColors)
18
25
 
19
- inheritAttrs: false,
20
-
21
- props: {
22
- color: {
23
- type: String,
24
- default: AvatarColors.Primary,
25
- validator: value => {
26
- const availableColors = Object.values(AvatarColors)
27
-
28
- return availableColors.includes(value)
29
- }
30
- },
31
-
32
- size: {
33
- type: String,
34
- default: ''
35
- },
36
-
37
- icon: {
38
- default: 'sym_r_error',
39
- type: String
40
- },
41
-
42
- image: {
43
- default: '',
44
- type: String
45
- },
46
-
47
- title: {
48
- default: '',
49
- type: String
26
+ return availableColors.includes(value)
50
27
  }
51
28
  },
52
29
 
53
- data () {
54
- return {
55
- hasImageError: false
56
- }
30
+ size: {
31
+ type: String,
32
+ default: ''
57
33
  },
58
34
 
59
- computed: {
60
- firstLetter () {
61
- return this.title[0].toUpperCase()
62
- },
63
-
64
- hasImage () {
65
- return !this.hasImageError && !!this.image
66
- },
67
-
68
- hasTitle () {
69
- return !!this.title
70
- },
71
-
72
- attributes () {
73
- const {
74
- rounded,
75
- square,
76
- fontSize,
77
- textColor,
78
- ...attributes
79
- } = this.$attrs
80
-
81
- const colors = {
82
- [AvatarColors.Primary]: 'white',
83
- [AvatarColors.SecondaryContrast]: 'primary',
84
- [AvatarColors.Grey4]: 'grey-8'
85
- }
86
-
87
- return {
88
- size: this.size,
89
- color: this.color,
90
- textColor: colors[this.color],
91
- ...attributes
92
- }
93
- }
35
+ icon: {
36
+ default: 'sym_r_error',
37
+ type: String
94
38
  },
95
39
 
96
- watch: {
97
- image () {
98
- this.hasImageError = false
99
- }
40
+ image: {
41
+ default: '',
42
+ type: String
100
43
  },
101
44
 
102
- methods: {
103
- onImageLoadedError () {
104
- this.hasImageError = true
105
- }
45
+ title: {
46
+ default: '',
47
+ type: String
48
+ }
49
+ })
50
+
51
+ const attrs = useAttrs()
52
+
53
+ const hasImageError = ref(false)
54
+
55
+ const attributes = computed(() => {
56
+ const {
57
+ rounded,
58
+ square,
59
+ fontSize,
60
+ textColor,
61
+ ...attributes
62
+ } = attrs
63
+
64
+ const colors = {
65
+ [AvatarColors.Primary]: 'white',
66
+ [AvatarColors.SecondaryContrast]: 'primary',
67
+ [AvatarColors.Grey4]: 'grey-8'
68
+ }
69
+
70
+ return {
71
+ size: props.size,
72
+ color: props.color,
73
+ textColor: colors[props.color],
74
+ ...attributes
106
75
  }
76
+ })
77
+
78
+ const firstLetter = computed(() => props.title[0].toUpperCase())
79
+
80
+ const hasImage = computed(() => !hasImageError.value && !!props.image)
81
+ const hasTitle = computed(() => !!props.title)
82
+
83
+ watch(() => props.image, () => {
84
+ hasImageError.value = false
85
+ })
86
+
87
+ function onImageLoadedError () {
88
+ hasImageError.value = true
107
89
  }
108
90
  </script>
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Para utilizar este enum dentro do defineProps, é necessário externalizar e importar
3
+ * ou definir este enum em outro "<script>" fora do "<script setup>".
4
+ */
5
+ export const AvatarColors = {
6
+ Primary: 'primary',
7
+ SecondaryContrast: 'secondary-contrast',
8
+ Grey4: 'grey-4'
9
+ }
@@ -1,36 +1,35 @@
1
1
  <template>
2
- <q-badge v-bind="$props" :aria-multiline="multiLine" class="q-px-sm q-py-xs qas-badge text-caption">
2
+ <q-badge v-bind="props" :aria-multiline="props.multiLine" class="q-px-sm q-py-xs qas-badge text-caption">
3
3
  <slot />
4
4
  </q-badge>
5
5
  </template>
6
6
 
7
- <script>
8
- export default {
7
+ <script setup>
8
+ defineOptions({
9
9
  name: 'QasBadge',
10
+ inheritAttrs: false
11
+ })
10
12
 
11
- inheritAttrs: false,
13
+ const props = defineProps({
14
+ color: {
15
+ type: String,
16
+ default: 'light-blue-2'
17
+ },
12
18
 
13
- props: {
14
- color: {
15
- type: String,
16
- default: 'light-blue-2'
17
- },
19
+ label: {
20
+ type: String,
21
+ default: ''
22
+ },
18
23
 
19
- label: {
20
- type: String,
21
- default: ''
22
- },
24
+ multiLine: {
25
+ type: Boolean
26
+ },
23
27
 
24
- multiLine: {
25
- type: Boolean
26
- },
27
-
28
- textColor: {
29
- type: String,
30
- default: 'grey-9'
31
- }
28
+ textColor: {
29
+ type: String,
30
+ default: 'black'
32
31
  }
33
- }
32
+ })
34
33
  </script>
35
34
 
36
35
  <style lang="scss">
@@ -20,7 +20,7 @@ props:
20
20
 
21
21
  text-color:
22
22
  desc: Cor do texto.
23
- default: grey-9
23
+ default: black
24
24
  type: String
25
25
 
26
26
  slots:
@@ -1,30 +1,28 @@
1
1
  <template>
2
- <div class="bg-white q-pa-md rounded-borders" :class="boxClass">
2
+ <div class="bg-white q-pa-md rounded-borders" :class="boxClasses">
3
3
  <slot />
4
4
  </div>
5
5
  </template>
6
6
 
7
- <script>
8
- export default {
9
- name: 'QasBox',
7
+ <script setup>
8
+ import { computed } from 'vue'
10
9
 
11
- props: {
12
- outlined: {
13
- type: Boolean
14
- },
10
+ defineOptions({ name: 'QasBox' })
15
11
 
16
- unelevated: {
17
- type: Boolean
18
- }
12
+ const props = defineProps({
13
+ outlined: {
14
+ type: Boolean
19
15
  },
20
16
 
21
- computed: {
22
- boxClass () {
23
- return {
24
- 'border-grey': this.outlined,
25
- 'shadow-2': !this.unelevated
26
- }
27
- }
17
+ unelevated: {
18
+ type: Boolean
28
19
  }
29
- }
20
+ })
21
+
22
+ const boxClasses = computed(() => {
23
+ return {
24
+ 'border-grey': props.outlined,
25
+ 'shadow-2': !props.unelevated
26
+ }
27
+ })
30
28
  </script>