@bildvitta/quasar-ui-asteroid 3.13.0-beta.1 → 3.13.0-beta.11

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 (48) hide show
  1. package/package.json +2 -1
  2. package/src/components/actions/QasActions.vue +54 -47
  3. package/src/components/actions-menu/QasActionsMenu.vue +144 -147
  4. package/src/components/app-bar/QasAppBar.vue +56 -84
  5. package/src/components/app-menu/QasAppMenu.vue +127 -245
  6. package/src/components/app-menu/composables/use-app-menu-dropdown.js +72 -0
  7. package/src/components/app-menu/composables/use-app-user.js +46 -0
  8. package/src/components/app-menu/composables/use-development-badge.js +23 -0
  9. package/src/components/app-menu/private/PvAppMenuDropdown.vue +33 -39
  10. package/src/components/app-user/QasAppUser.vue +97 -88
  11. package/src/components/app-user/QasAppUser.yml +13 -9
  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/box/QasBox.vue +17 -19
  16. package/src/components/btn/QasBtn.vue +132 -135
  17. package/src/components/dialog/QasDialog.vue +135 -246
  18. package/src/components/dialog/QasDialog.yml +25 -0
  19. package/src/components/dialog/composables/use-cancel.js +40 -0
  20. package/src/components/dialog/composables/use-dynamic-components.js +86 -0
  21. package/src/components/dialog/composables/use-ok.js +45 -0
  22. package/src/components/field/QasField.yml +5 -0
  23. package/src/components/filters/QasFilters.vue +5 -13
  24. package/src/components/filters/QasFilters.yml +21 -0
  25. package/src/components/form-generator/QasFormGenerator.yml +1 -1
  26. package/src/components/form-view/QasFormView.vue +29 -48
  27. package/src/components/form-view/QasFormView.yml +12 -0
  28. package/src/components/gallery/QasGallery.yml +17 -0
  29. package/src/components/gallery-card/QasGalleryCard.vue +38 -1
  30. package/src/components/gallery-card/QasGalleryCard.yml +13 -0
  31. package/src/components/grid-generator/QasGridGenerator.yml +8 -0
  32. package/src/components/list-view/QasListView.vue +6 -13
  33. package/src/components/nested-fields/QasNestedFields.vue +38 -11
  34. package/src/components/nested-fields/QasNestedFields.yml +50 -16
  35. package/src/components/search-input/QasSearchInput.yml +6 -1
  36. package/src/components/single-view/QasSingleView.vue +7 -14
  37. package/src/components/table-generator/QasTableGenerator.vue +0 -6
  38. package/src/components/uploader/QasUploader.vue +1 -1
  39. package/src/components/uploader/private/PvUploaderGalleryCard.vue +68 -43
  40. package/src/css/plugins/notify.scss +26 -26
  41. package/src/enums/Align.js +7 -0
  42. package/src/helpers/promise-handler.js +7 -4
  43. package/src/plugins/index.js +0 -2
  44. package/src/plugins/notify-error/NotifyError.js +1 -1
  45. package/src/plugins/notify-success/NotifySuccess.js +1 -1
  46. package/src/vue-plugin.js +1 -4
  47. package/src/plugins/logger/Logger.js +0 -44
  48. package/src/plugins/logger/Logger.yml +0 -9
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bildvitta/quasar-ui-asteroid",
3
3
  "description": "Asteroid",
4
- "version": "3.13.0-beta.1",
4
+ "version": "3.13.0-beta.11",
5
5
  "author": "Bild & Vitta <systemteam@bild.com.br>",
6
6
  "license": "MIT",
7
7
  "main": "dist/asteroid.cjs.min.js",
@@ -47,6 +47,7 @@
47
47
  "autonumeric": "^4.9.0",
48
48
  "axios": "^1.4.0",
49
49
  "date-fns": "^2.30.0",
50
+ "debug": "^4.3.4",
50
51
  "fuse.js": "^6.6.2",
51
52
  "humps": "^2.0.1",
52
53
  "lodash-es": "^4.17.21",
@@ -10,58 +10,65 @@
10
10
  </div>
11
11
  </template>
12
12
 
13
- <script>
14
- export default {
15
- name: 'QasActions',
16
-
17
- props: {
18
- align: {
19
- default: 'end',
20
- type: String,
21
- validator: value => ['start', 'around', 'between', 'center', 'end'].includes(value)
22
- },
23
-
24
- gutter: {
25
- default: '',
26
- type: String,
27
- validator: value => !value || ['xs', 'sm', 'md', 'lg', 'xl'].includes(value)
28
- },
29
-
30
- useFullWidth: {
31
- type: Boolean
32
- },
33
-
34
- useEqualWidth: {
35
- type: Boolean
36
- }
37
- },
13
+ <script setup>
14
+ import useScreen from '../../composables/use-screen'
15
+ import { FlexAlign } from '../../enums/Align'
16
+ import { Spacing } from '../../enums/Spacing'
38
17
 
39
- computed: {
40
- classes () {
41
- return [
42
- `justify-${this.align}`,
43
- `q-col-gutter-${this.defaultGutter}`,
44
- (this.$qas.screen.isSmall || this.useFullWidth) ? 'column reverse' : 'row'
45
- ]
46
- },
18
+ import { computed, useSlots } from 'vue'
47
19
 
48
- defaultGutter () {
49
- return this.gutter || this.$qas.screen.isSmall ? 'md' : 'lg'
50
- },
20
+ defineOptions({ name: 'QasActions' })
51
21
 
52
- columnClasses () {
53
- if (this.useEqualWidth) return 'col-12 col-sm-6'
22
+ const props = defineProps({
23
+ align: {
24
+ default: FlexAlign.End,
25
+ type: String,
26
+ validator: value => Object.values(FlexAlign).includes(value)
27
+ },
54
28
 
55
- return this.useFullWidth ? 'col-12' : 'col-12 col-sm-auto'
56
- },
29
+ gutter: {
30
+ default: '',
31
+ type: String,
32
+ validator: value => !value || Object.values(Spacing).includes(value)
33
+ },
57
34
 
58
- hasPrimarySlot () {
59
- return !!this.$slots.primary
60
- },
35
+ useFullWidth: {
36
+ type: Boolean
37
+ },
61
38
 
62
- hasSecondarySlot () {
63
- return !!this.$slots.secondary
64
- }
39
+ useEqualWidth: {
40
+ type: Boolean
65
41
  }
66
- }
42
+ })
43
+
44
+ const slots = useSlots()
45
+ const screen = useScreen()
46
+
47
+ const defaultGutter = computed(() => {
48
+ return props.gutter || (screen.isSmall ? 'md' : 'lg')
49
+ })
50
+
51
+ const classes = computed(() => {
52
+ const isSmallOrFullWidth = screen.isSmall || props.useFullWidth
53
+
54
+ return [
55
+ // alinhamento
56
+ `justify-${props.align}`,
57
+
58
+ // espaçamento
59
+ `q-col-gutter-${defaultGutter.value}`,
60
+
61
+ // disposição
62
+ isSmallOrFullWidth ? 'column reverse' : 'row'
63
+ ]
64
+ })
65
+
66
+ const columnClasses = computed(() => {
67
+ if (props.useEqualWidth) return 'col-12 col-sm-6'
68
+
69
+ return props.useFullWidth ? 'col-12' : 'col-12 col-sm-auto'
70
+ })
71
+
72
+ const hasPrimarySlot = computed(() => !!slots.primary)
73
+ const hasSecondarySlot = computed(() => !!slots.secondary)
67
74
  </script>
@@ -22,193 +22,190 @@
22
22
  </div>
23
23
  </template>
24
24
 
25
- <script>
25
+ <script setup>
26
26
  import QasBtn from '../btn/QasBtn.vue'
27
27
  import QasBtnDropdown from '../btn-dropdown/QasBtnDropdown.vue'
28
28
 
29
- export default {
30
- name: 'QasActionsMenu',
29
+ import Delete from '../../plugins/delete/Delete'
30
+ import useScreen from '../../composables/use-screen'
31
31
 
32
- components: {
33
- QasBtn,
34
- QasBtnDropdown
35
- },
32
+ import { computed } from 'vue'
36
33
 
37
- props: {
38
- buttonProps: {
39
- default: () => ({}),
40
- type: Object
41
- },
34
+ defineOptions({ name: 'QasActionsMenu' })
42
35
 
43
- deleteLabel: {
44
- type: String,
45
- default: 'Excluir'
46
- },
47
-
48
- deleteIcon: {
49
- type: String,
50
- default: 'sym_r_delete'
51
- },
36
+ const props = defineProps({
37
+ buttonProps: {
38
+ default: () => ({}),
39
+ type: Object
40
+ },
52
41
 
53
- deleteProps: {
54
- default: () => ({}),
55
- type: Object
56
- },
42
+ deleteLabel: {
43
+ default: 'Excluir',
44
+ type: String
45
+ },
57
46
 
58
- dropdownIcon: {
59
- default: 'sym_r_more_vert',
60
- type: String
61
- },
47
+ deleteIcon: {
48
+ default: 'sym_r_delete',
49
+ type: String
50
+ },
62
51
 
63
- list: {
64
- default: () => ({}),
65
- type: Object
66
- },
52
+ deleteProps: {
53
+ default: () => ({}),
54
+ type: Object
55
+ },
67
56
 
68
- splitName: {
69
- type: String,
70
- default: ''
71
- },
57
+ dropdownIcon: {
58
+ default: 'sym_r_more_vert',
59
+ type: String
60
+ },
72
61
 
73
- useLabel: {
74
- default: true,
75
- type: Boolean
76
- },
62
+ list: {
63
+ default: () => ({}),
64
+ type: Object
65
+ },
77
66
 
78
- useTooltip: {
79
- type: Boolean
80
- }
67
+ splitName: {
68
+ default: '',
69
+ type: String
81
70
  },
82
71
 
83
- computed: {
84
- actions () {
85
- const list = { ...this.fullList }
72
+ useLabel: {
73
+ default: true,
74
+ type: Boolean
75
+ },
86
76
 
87
- if (this.hasSplit && list[this.splitName] && this.isBtnDropdown) {
88
- this.isSmall
89
- ? Object.assign(list, { [this.splitName]: list[this.splitName] })
90
- : delete list[this.splitName]
91
- }
77
+ useTooltip: {
78
+ type: Boolean
79
+ }
80
+ })
92
81
 
93
- return list
94
- },
82
+ const screen = useScreen()
83
+ const { deleteBtnProps, hasDelete } = useDelete()
95
84
 
96
- fullList () {
97
- return {
98
- ...this.list,
99
- ...(this.hasDelete && {
100
- delete: {
101
- color: 'grey-9',
102
- icon: this.deleteIcon,
103
- label: this.deleteLabel,
104
- handler: () => this.$qas.delete(this.deleteProps)
105
- }
106
- })
107
- }
108
- },
85
+ const fullList = computed(() => {
86
+ return {
87
+ ...props.list,
88
+ ...deleteBtnProps
89
+ }
90
+ })
109
91
 
110
- component () {
111
- const is = this.isBtnDropdown ? 'qas-btn-dropdown' : 'qas-btn'
92
+ const hasSplit = computed(() => !!props.splitName)
112
93
 
113
- return {
114
- is,
115
- props: {
116
- ...(this.isBtnDropdown ? this.btnDropdownProps : this.btnProps),
117
- ...(this.hasDelete && this.deleteProps)
118
- }
119
- }
120
- },
94
+ // --------------------------------- actions -----------------------------------
95
+ const actions = computed(() => {
96
+ const list = { ...fullList.value }
121
97
 
122
- firstItemKey () {
123
- return Object.keys(this.actions)?.[0]
124
- },
98
+ if (hasSplit.value && list[props.splitName] && isBtnDropdown.value) {
99
+ screen.isSmall
100
+ ? Object.assign(list, { [props.splitName]: list[props.splitName] })
101
+ : delete list[props.splitName]
102
+ }
125
103
 
126
- hasActions () {
127
- return !!Object.keys(this.actions).length
128
- },
104
+ return list
105
+ })
129
106
 
130
- hasDelete () {
131
- return !!Object.keys(this.deleteProps).length
132
- },
107
+ const hasActions = computed(() => !!Object.keys(actions.value).length)
108
+ const firstItemKey = computed(() => Object.keys(actions.value)?.[0])
133
109
 
134
- hasSplit () {
135
- return !!this.splitName
136
- },
110
+ // -------------------------------- tooltip ------------------------------------
111
+ const tooltipLabel = computed(() => actions.value[firstItemKey.value]?.label)
112
+ const hasTooltip = computed(() => {
113
+ return !isBtnDropdown.value && !props.useLabel && props.useTooltip
114
+ })
137
115
 
138
- isBtnDropdown () {
139
- return Object.keys(this.fullList || {}).length > 1
140
- },
116
+ // --------------------------------- button ------------------------------------
117
+ const defaultButtonProps = computed(() => {
118
+ const { label, variant, ...buttonProps } = props.buttonProps
141
119
 
142
- hasTooltip () {
143
- return !this.isBtnDropdown && !this.useLabel && this.useTooltip
144
- },
120
+ return {
121
+ useHoverOnWhiteColor: true,
122
+ useLabelOnSmallScreen: false,
123
+ ...buttonProps
124
+ }
125
+ })
145
126
 
146
- tooltipLabel () {
147
- return this.actions[this.firstItemKey]?.label
148
- },
127
+ const btnDropdownProps = computed(() => {
128
+ const { icon, label } = fullList.value[props.splitName] || {}
149
129
 
150
- defaultButtonProps () {
151
- const { label, variant, ...buttonProps } = this.buttonProps
130
+ const {
131
+ icon: defaultIcon,
132
+ ...defaultBtnProps
133
+ } = defaultButtonProps.value
152
134
 
153
- return {
154
- useHoverOnWhiteColor: true,
155
- useLabelOnSmallScreen: false,
156
- ...buttonProps
157
- }
135
+ return {
136
+ buttonProps: {
137
+ ...(props.useLabel && { label: hasSplit.value ? label : 'Opções' }),
138
+ ...defaultBtnProps,
139
+ icon: icon || defaultIcon
158
140
  },
159
141
 
160
- btnDropdownProps () {
161
- const { icon, label } = this.fullList[this.splitName] || {}
142
+ dropdownIcon: props.dropdownIcon,
143
+ useSplit: hasSplit.value,
162
144
 
163
- const {
164
- icon: defaultIcon,
165
- ...defaultButtonProps
166
- } = this.defaultButtonProps
145
+ onClick: () => onClick(fullList.value[props.splitName])
146
+ }
147
+ })
148
+
149
+ const btnProps = computed(() => {
150
+ const { color, icon } = actions.value[firstItemKey.value] || {}
151
+ const { color: defaultColor, ...defaultBtnProps } = defaultButtonProps.value
152
+
153
+ return {
154
+ color: color || defaultColor,
155
+ icon,
156
+ label: props.useLabel ? tooltipLabel.value : '',
157
+ onClick,
158
+ ...defaultBtnProps
159
+ }
160
+ })
167
161
 
168
- return {
169
- buttonProps: {
170
- ...(this.useLabel && { label: this.hasSplit ? label : 'Opções' }),
171
- ...defaultButtonProps,
172
- icon: icon || defaultIcon
173
- },
162
+ const isBtnDropdown = computed(() => Object.keys(fullList.value || {}).length > 1)
174
163
 
175
- dropdownIcon: this.dropdownIcon,
176
- useSplit: this.hasSplit,
164
+ // -------------------------------- component ----------------------------------
165
+ const component = computed(() => {
166
+ const is = isBtnDropdown.value ? QasBtnDropdown : QasBtn
177
167
 
178
- // evento
179
- onClick: () => this.onClick(this.fullList[this.splitName])
180
- }
181
- },
168
+ return {
169
+ is,
170
+ props: {
171
+ ...(isBtnDropdown.value ? btnDropdownProps.value : btnProps.value),
172
+ ...(hasDelete.value && props.deleteProps)
173
+ }
174
+ }
175
+ })
182
176
 
183
- btnProps () {
184
- const { color, icon } = this.actions[this.firstItemKey] || {}
185
- const { color: defaultColor, ...defaultButtonProps } = this.defaultButtonProps
177
+ // --------------------------------- methods -----------------------------------
178
+ function onClick (item = {}) {
179
+ if (!isBtnDropdown.value) {
180
+ item = actions.value[firstItemKey.value]
181
+ }
186
182
 
187
- return {
188
- color: color || defaultColor,
189
- icon,
190
- label: this.useLabel ? this.tooltipLabel : '',
191
- onClick: this.onClick,
192
- ...defaultButtonProps
193
- }
194
- },
183
+ if (typeof item.handler === 'function') {
184
+ const { handler, ...filtered } = item
185
+ item.handler(filtered)
186
+ }
187
+ }
195
188
 
196
- isSmall () {
197
- return this.$qas.screen.isSmall
198
- }
199
- },
189
+ // ------------------------------- composables ---------------------------------
190
+ function useDelete () {
191
+ const deleteBtnProps = {}
200
192
 
201
- methods: {
202
- onClick (item = {}) {
203
- if (!this.isBtnDropdown) {
204
- item = this.actions[this.firstItemKey]
205
- }
193
+ const hasDelete = computed(() => !!Object.keys(props.deleteProps).length)
206
194
 
207
- if (typeof item.handler === 'function') {
208
- const { handler, ...filtered } = item
209
- item.handler(filtered)
195
+ if (hasDelete.value) {
196
+ Object.assign(deleteBtnProps, {
197
+ delete: {
198
+ color: 'grey-9',
199
+ icon: props.deleteIcon,
200
+ label: props.deleteLabel,
201
+ handler: () => Delete(props.deleteProps)
210
202
  }
211
- }
203
+ })
204
+ }
205
+
206
+ return {
207
+ deleteBtnProps,
208
+ hasDelete
212
209
  }
213
210
  }
214
211
  </script>
@@ -6,7 +6,9 @@
6
6
  <q-toolbar-title>
7
7
  <router-link class="flex items-center no-wrap text-no-decoration" :class="routerLinkClass" :to="rootRoute">
8
8
  <img v-if="brand" :alt="title" class="qas-app-bar__brand" :src="brand">
9
+
9
10
  <span v-else class="ellipsis text-bold text-primary">{{ title }}</span>
11
+
10
12
  <q-badge v-if="hasDevelopmentBadge" class="q-ml-sm" color="red" :label="developmentBadgeLabel" />
11
13
  </router-link>
12
14
  </q-toolbar-title>
@@ -18,114 +20,84 @@
18
20
  </q-header>
19
21
  </template>
20
22
 
21
- <script>
23
+ <script setup>
22
24
  import QasAppUser from '../app-user/QasAppUser.vue'
23
25
  import QasBtn from '../btn/QasBtn.vue'
24
26
 
25
- export default {
26
- name: 'QasAppBar',
27
+ import { useScreen } from '../../composables'
27
28
 
28
- components: {
29
- QasAppUser,
30
- QasBtn
31
- },
29
+ import { computed } from 'vue'
30
+ import { useRouter } from 'vue-router'
32
31
 
33
- props: {
34
- appUserProps: {
35
- type: Object,
36
- required: true,
37
- default: () => ({})
38
- },
32
+ defineOptions({ name: 'QasAppBar' })
39
33
 
40
- brand: {
41
- default: '',
42
- type: String
43
- },
34
+ const props = defineProps({
35
+ appUserProps: {
36
+ type: Object,
37
+ required: true,
38
+ default: () => ({})
39
+ },
44
40
 
45
- notifications: {
46
- default: () => ({}),
47
- type: Object
48
- },
41
+ brand: {
42
+ default: '',
43
+ type: String
44
+ },
49
45
 
50
- title: {
51
- required: true,
52
- type: String
53
- }
46
+ notifications: {
47
+ default: () => ({}),
48
+ type: Object
54
49
  },
55
50
 
56
- emits: ['sign-out', 'toggle-menu'],
51
+ title: {
52
+ required: true,
53
+ type: String
54
+ }
55
+ })
57
56
 
58
- data () {
59
- return {
60
- menuDrawer: true
61
- }
62
- },
57
+ const emits = defineEmits(['sign-out', 'toggle-menu'])
63
58
 
64
- computed: {
65
- appUserMenuProps () {
66
- return {
67
- anchor: 'bottom end',
68
- offset: [0, 5],
69
- self: 'top end'
70
- }
71
- },
59
+ const router = useRouter()
60
+ const screen = useScreen()
72
61
 
73
- defaultAppUserProps () {
74
- return {
75
- menuProps: {
76
- anchor: 'bottom end',
77
- offset: [0, 5],
78
- self: 'top end'
79
- },
80
-
81
- onSignOut: this.signOut,
82
- ...this.appUserProps
83
- }
62
+ const defaultAppUserProps = computed(() => {
63
+ return {
64
+ menuProps: {
65
+ anchor: 'bottom end',
66
+ offset: [0, 5],
67
+ self: 'top end'
84
68
  },
85
69
 
86
- developmentBadgeLabel () {
87
- const hosts = {
88
- localhost: 'Local',
89
- '.dev.': 'Develop'
90
- }
70
+ onSignOut: signOut,
71
+ ...props.appUserProps
72
+ }
73
+ })
91
74
 
92
- if (process.env.DEV) {
93
- return hosts.localhost
94
- }
75
+ const rootRoute = router.hasRoute('Root') ? { name: 'Root' } : { path: '/' }
95
76
 
96
- const current = Object.keys(hosts).find(
97
- host => location.hostname.includes(host)
98
- )
77
+ const developmentBadgeLabel = computed(() => {
78
+ const hosts = {
79
+ localhost: 'Local',
80
+ '.dev.': 'Develop'
81
+ }
99
82
 
100
- return current ? hosts[current] : ''
101
- },
83
+ if (process.env.DEV) return hosts.localhost
102
84
 
103
- hasDevelopmentBadge () {
104
- return !!this.developmentBadgeLabel
105
- },
85
+ const current = Object.keys(hosts).find(host => location.hostname.includes(host))
106
86
 
107
- hasUser () {
108
- return !!Object.keys(this.defaultAppUserProps.user || {}).length
109
- },
87
+ return current ? hosts[current] : ''
88
+ })
110
89
 
111
- rootRoute () {
112
- return this.$router.hasRoute('Root') ? { name: 'Root' } : { path: '/' }
113
- },
90
+ const hasDevelopmentBadge = computed(() => !!developmentBadgeLabel.value)
91
+ const hasUser = computed(() => !!Object.keys(defaultAppUserProps.value.user || {}).length)
114
92
 
115
- routerLinkClass () {
116
- return this.$qas.screen.isSmall && 'justify-center'
117
- }
118
- },
93
+ const routerLinkClass = computed(() => screen.isSmall && 'justify-center')
119
94
 
120
- methods: {
121
- signOut () {
122
- this.$emit('sign-out')
123
- },
95
+ function signOut () {
96
+ emits('sign-out')
97
+ }
124
98
 
125
- toggleMenuDrawer () {
126
- this.$emit('toggle-menu')
127
- }
128
- }
99
+ function toggleMenuDrawer () {
100
+ emits('toggle-menu')
129
101
  }
130
102
  </script>
131
103