@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.
- package/package.json +1 -1
- package/src/components/actions/QasActions.vue +54 -47
- package/src/components/actions-menu/QasActionsMenu.vue +147 -149
- package/src/components/actions-menu/QasActionsMenu.yml +13 -0
- package/src/components/app-bar/QasAppBar.vue +59 -87
- package/src/components/app-menu/QasAppMenu.vue +128 -256
- package/src/components/app-menu/composables/use-app-menu-dropdown.js +71 -0
- package/src/components/app-menu/composables/use-app-user.js +46 -0
- package/src/components/app-menu/composables/use-development-badge.js +23 -0
- package/src/components/app-menu/private/PvAppMenuDropdown.vue +33 -39
- package/src/components/app-user/QasAppUser.vue +94 -92
- package/src/components/avatar/QasAvatar.vue +67 -85
- package/src/components/avatar/enums/AvatarColors.js +9 -0
- package/src/components/badge/QasBadge.vue +21 -22
- package/src/components/badge/QasBadge.yml +1 -1
- package/src/components/box/QasBox.vue +17 -19
- package/src/components/btn/QasBtn.vue +132 -135
- package/src/components/btn/QasBtn.yml +3 -3
- package/src/components/btn-dropdown/QasBtnDropdown.vue +2 -2
- package/src/components/chart-view/QasChartView.vue +2 -2
- package/src/components/date/QasDate.vue +3 -3
- package/src/components/date-time-input/QasDateTimeInput.vue +2 -2
- package/src/components/delete/QasDelete.vue +1 -1
- package/src/components/dialog/QasDialog.vue +135 -244
- package/src/components/dialog/composables/use-cancel.js +40 -0
- package/src/components/dialog/composables/use-dynamic-components.js +86 -0
- package/src/components/dialog/composables/use-ok.js +45 -0
- package/src/components/filters/QasFilters.vue +1 -1
- package/src/components/filters/private/PvFiltersButton.vue +2 -2
- package/src/components/form-generator/QasFormGenerator.yml +1 -1
- package/src/components/gallery/QasGallery.vue +1 -1
- package/src/components/gallery/private/PvGalleryCarouselDialog.vue +2 -2
- package/src/components/gallery-card/QasGalleryCard.vue +2 -2
- package/src/components/label/QasLabel.vue +1 -1
- package/src/components/label/QasLabel.yml +1 -1
- package/src/components/nested-fields/QasNestedFields.vue +37 -14
- package/src/components/nested-fields/QasNestedFields.yml +63 -17
- package/src/components/page-header/QasPageHeader.vue +1 -11
- package/src/components/pagination/QasPagination.vue +1 -1
- package/src/components/search-input/QasSearchInput.vue +2 -2
- package/src/components/select-list-dialog/QasSelectListDialog.vue +3 -3
- package/src/components/table-generator/QasTableGenerator.vue +8 -4
- package/src/components/tabs-generator/QasTabsGenerator.vue +1 -1
- package/src/components/timeline/QasTimeline.vue +2 -2
- package/src/components/tree-generator/QasTreeGenerator.vue +1 -1
- package/src/components/uploader/QasUploader.vue +1 -1
- package/src/components/uploader/private/PvUploaderGalleryCard.vue +1 -1
- package/src/components/welcome/QasWelcome.vue +2 -2
- package/src/composables/use-history.js +4 -4
- package/src/css/components/base.scss +1 -0
- package/src/css/components/button.scss +2 -2
- package/src/css/components/checkbox.scss +12 -0
- package/src/css/components/editor.scss +7 -0
- package/src/css/components/field.scss +23 -3
- package/src/css/components/index.scss +3 -0
- package/src/css/components/item.scss +1 -1
- package/src/css/components/radio.scss +15 -2
- package/src/css/components/toggle.scss +11 -0
- package/src/css/variables/typography.scss +11 -1
- package/src/enums/Align.js +7 -0
- package/src/index.scss +4 -4
- package/src/pages/ErrorComponent.vue +1 -2
- package/src/plugins/dialog/Dialog.js +1 -1
- package/src/shared/notify-config.js +1 -1
- package/src/vue-plugin.js +4 -0
package/package.json
CHANGED
|
@@ -10,58 +10,65 @@
|
|
|
10
10
|
</div>
|
|
11
11
|
</template>
|
|
12
12
|
|
|
13
|
-
<script>
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
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
|
-
|
|
49
|
-
return this.gutter || this.$qas.screen.isSmall ? 'md' : 'lg'
|
|
50
|
-
},
|
|
20
|
+
defineOptions({ name: 'QasActions' })
|
|
51
21
|
|
|
52
|
-
|
|
53
|
-
|
|
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
|
-
|
|
56
|
-
|
|
29
|
+
gutter: {
|
|
30
|
+
default: '',
|
|
31
|
+
type: String,
|
|
32
|
+
validator: value => !value || Object.values(Spacing).includes(value)
|
|
33
|
+
},
|
|
57
34
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
35
|
+
useFullWidth: {
|
|
36
|
+
type: Boolean
|
|
37
|
+
},
|
|
61
38
|
|
|
62
|
-
|
|
63
|
-
|
|
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>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div v-if="hasActions" class="qas-actions-menu">
|
|
2
|
+
<div v-if="hasActions" class="qas-actions-menu" data-cy="actions-menu">
|
|
3
3
|
<component :is="component.is" v-bind="component.props" variant="tertiary" @click.stop.prevent>
|
|
4
|
-
<q-list v-if="isBtnDropdown">
|
|
4
|
+
<q-list v-if="isBtnDropdown" data-cy="actions-menu-list">
|
|
5
5
|
<slot v-for="(item, key) in actions" :item="item" :name="key">
|
|
6
|
-
<q-item v-bind="item.props" :key="key" clickable @click="onClick(item)">
|
|
6
|
+
<q-item v-bind="item.props" :key="key" clickable data-cy="actions-menu-list-item" @click="onClick(item)">
|
|
7
7
|
<q-item-section avatar>
|
|
8
8
|
<q-icon :name="item.icon" />
|
|
9
9
|
</q-item-section>
|
|
@@ -22,193 +22,191 @@
|
|
|
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
|
-
|
|
30
|
-
name: 'QasActionsMenu',
|
|
29
|
+
import useScreen from '../../composables/use-screen'
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
QasBtn,
|
|
34
|
-
QasBtnDropdown
|
|
35
|
-
},
|
|
31
|
+
import { computed, inject } from 'vue'
|
|
36
32
|
|
|
37
|
-
|
|
38
|
-
buttonProps: {
|
|
39
|
-
default: () => ({}),
|
|
40
|
-
type: Object
|
|
41
|
-
},
|
|
33
|
+
defineOptions({ name: 'QasActionsMenu' })
|
|
42
34
|
|
|
43
|
-
|
|
44
|
-
type: String,
|
|
45
|
-
default: 'Excluir'
|
|
46
|
-
},
|
|
35
|
+
const qas = inject('qas')
|
|
47
36
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
37
|
+
const props = defineProps({
|
|
38
|
+
buttonProps: {
|
|
39
|
+
default: () => ({}),
|
|
40
|
+
type: Object
|
|
41
|
+
},
|
|
52
42
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
43
|
+
deleteLabel: {
|
|
44
|
+
default: 'Excluir',
|
|
45
|
+
type: String
|
|
46
|
+
},
|
|
57
47
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
48
|
+
deleteIcon: {
|
|
49
|
+
default: 'sym_r_delete',
|
|
50
|
+
type: String
|
|
51
|
+
},
|
|
62
52
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
53
|
+
deleteProps: {
|
|
54
|
+
default: () => ({}),
|
|
55
|
+
type: Object
|
|
56
|
+
},
|
|
67
57
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
58
|
+
dropdownIcon: {
|
|
59
|
+
default: 'sym_r_more_vert',
|
|
60
|
+
type: String
|
|
61
|
+
},
|
|
72
62
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
63
|
+
list: {
|
|
64
|
+
default: () => ({}),
|
|
65
|
+
type: Object
|
|
66
|
+
},
|
|
77
67
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
68
|
+
splitName: {
|
|
69
|
+
default: '',
|
|
70
|
+
type: String
|
|
81
71
|
},
|
|
82
72
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
73
|
+
useLabel: {
|
|
74
|
+
default: true,
|
|
75
|
+
type: Boolean
|
|
76
|
+
},
|
|
86
77
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
78
|
+
useTooltip: {
|
|
79
|
+
type: Boolean
|
|
80
|
+
}
|
|
81
|
+
})
|
|
92
82
|
|
|
93
|
-
|
|
94
|
-
|
|
83
|
+
const screen = useScreen()
|
|
84
|
+
const { deleteBtnProps, hasDelete } = useDelete()
|
|
95
85
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
icon: this.deleteIcon,
|
|
103
|
-
label: this.deleteLabel,
|
|
104
|
-
handler: () => this.$qas.delete(this.deleteProps)
|
|
105
|
-
}
|
|
106
|
-
})
|
|
107
|
-
}
|
|
108
|
-
},
|
|
86
|
+
const fullList = computed(() => {
|
|
87
|
+
return {
|
|
88
|
+
...props.list,
|
|
89
|
+
...deleteBtnProps
|
|
90
|
+
}
|
|
91
|
+
})
|
|
109
92
|
|
|
110
|
-
|
|
111
|
-
const is = this.isBtnDropdown ? 'qas-btn-dropdown' : 'qas-btn'
|
|
93
|
+
const hasSplit = computed(() => !!props.splitName)
|
|
112
94
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
...(this.isBtnDropdown ? this.btnDropdownProps : this.btnProps),
|
|
117
|
-
...(this.hasDelete && this.deleteProps)
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
},
|
|
95
|
+
// --------------------------------- actions -----------------------------------
|
|
96
|
+
const actions = computed(() => {
|
|
97
|
+
const list = { ...fullList.value }
|
|
121
98
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
99
|
+
if (hasSplit.value && list[props.splitName] && isBtnDropdown.value) {
|
|
100
|
+
screen.isSmall
|
|
101
|
+
? Object.assign(list, { [props.splitName]: list[props.splitName] })
|
|
102
|
+
: delete list[props.splitName]
|
|
103
|
+
}
|
|
125
104
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
},
|
|
105
|
+
return list
|
|
106
|
+
})
|
|
129
107
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
},
|
|
108
|
+
const hasActions = computed(() => !!Object.keys(actions.value).length)
|
|
109
|
+
const firstItemKey = computed(() => Object.keys(actions.value)?.[0])
|
|
133
110
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
111
|
+
// -------------------------------- tooltip ------------------------------------
|
|
112
|
+
const tooltipLabel = computed(() => actions.value[firstItemKey.value]?.label)
|
|
113
|
+
const hasTooltip = computed(() => {
|
|
114
|
+
return !isBtnDropdown.value && !props.useLabel && props.useTooltip
|
|
115
|
+
})
|
|
137
116
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
117
|
+
// --------------------------------- button ------------------------------------
|
|
118
|
+
const defaultButtonProps = computed(() => {
|
|
119
|
+
const { label, variant, ...buttonProps } = props.buttonProps
|
|
141
120
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
121
|
+
return {
|
|
122
|
+
useHoverOnWhiteColor: true,
|
|
123
|
+
useLabelOnSmallScreen: false,
|
|
124
|
+
...buttonProps
|
|
125
|
+
}
|
|
126
|
+
})
|
|
145
127
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
},
|
|
128
|
+
const btnDropdownProps = computed(() => {
|
|
129
|
+
const { icon, label } = fullList.value[props.splitName] || {}
|
|
149
130
|
|
|
150
|
-
|
|
151
|
-
|
|
131
|
+
const {
|
|
132
|
+
icon: defaultIcon,
|
|
133
|
+
...defaultBtnProps
|
|
134
|
+
} = defaultButtonProps.value
|
|
152
135
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
136
|
+
return {
|
|
137
|
+
buttonProps: {
|
|
138
|
+
...(props.useLabel && { label: hasSplit.value ? label : 'Opções' }),
|
|
139
|
+
...defaultBtnProps,
|
|
140
|
+
icon: icon || defaultIcon
|
|
158
141
|
},
|
|
159
142
|
|
|
160
|
-
|
|
161
|
-
|
|
143
|
+
dropdownIcon: props.dropdownIcon,
|
|
144
|
+
useSplit: hasSplit.value,
|
|
162
145
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
146
|
+
onClick: () => onClick(fullList.value[props.splitName])
|
|
147
|
+
}
|
|
148
|
+
})
|
|
149
|
+
|
|
150
|
+
const btnProps = computed(() => {
|
|
151
|
+
const { color, icon } = actions.value[firstItemKey.value] || {}
|
|
152
|
+
const { color: defaultColor, ...defaultBtnProps } = defaultButtonProps.value
|
|
153
|
+
|
|
154
|
+
return {
|
|
155
|
+
color: color || defaultColor,
|
|
156
|
+
icon,
|
|
157
|
+
label: props.useLabel ? tooltipLabel.value : '',
|
|
158
|
+
onClick,
|
|
159
|
+
...defaultBtnProps
|
|
160
|
+
}
|
|
161
|
+
})
|
|
167
162
|
|
|
168
|
-
|
|
169
|
-
buttonProps: {
|
|
170
|
-
...(this.useLabel && { label: this.hasSplit ? label : 'Opções' }),
|
|
171
|
-
...defaultButtonProps,
|
|
172
|
-
icon: icon || defaultIcon
|
|
173
|
-
},
|
|
163
|
+
const isBtnDropdown = computed(() => Object.keys(fullList.value || {}).length > 1)
|
|
174
164
|
|
|
175
|
-
|
|
176
|
-
|
|
165
|
+
// -------------------------------- component ----------------------------------
|
|
166
|
+
const component = computed(() => {
|
|
167
|
+
const is = isBtnDropdown.value ? QasBtnDropdown : QasBtn
|
|
177
168
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
169
|
+
return {
|
|
170
|
+
is,
|
|
171
|
+
props: {
|
|
172
|
+
...(isBtnDropdown.value ? btnDropdownProps.value : btnProps.value),
|
|
173
|
+
...(hasDelete.value && props.deleteProps)
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
})
|
|
182
177
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
178
|
+
// --------------------------------- methods -----------------------------------
|
|
179
|
+
function onClick (item = {}) {
|
|
180
|
+
if (!isBtnDropdown.value) {
|
|
181
|
+
item = actions.value[firstItemKey.value]
|
|
182
|
+
}
|
|
186
183
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
...defaultButtonProps
|
|
193
|
-
}
|
|
194
|
-
},
|
|
184
|
+
if (typeof item.handler === 'function') {
|
|
185
|
+
const { handler, ...filtered } = item
|
|
186
|
+
item.handler(filtered)
|
|
187
|
+
}
|
|
188
|
+
}
|
|
195
189
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
},
|
|
190
|
+
// ------------------------------- composables ---------------------------------
|
|
191
|
+
function useDelete () {
|
|
192
|
+
const deleteBtnProps = {}
|
|
200
193
|
|
|
201
|
-
|
|
202
|
-
onClick (item = {}) {
|
|
203
|
-
if (!this.isBtnDropdown) {
|
|
204
|
-
item = this.actions[this.firstItemKey]
|
|
205
|
-
}
|
|
194
|
+
const hasDelete = computed(() => !!Object.keys(props.deleteProps).length)
|
|
206
195
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
196
|
+
if (hasDelete.value) {
|
|
197
|
+
Object.assign(deleteBtnProps, {
|
|
198
|
+
delete: {
|
|
199
|
+
color: 'grey-10',
|
|
200
|
+
icon: props.deleteIcon,
|
|
201
|
+
label: props.deleteLabel,
|
|
202
|
+
handler: () => qas.delete(props.deleteProps)
|
|
210
203
|
}
|
|
211
|
-
}
|
|
204
|
+
})
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
return {
|
|
208
|
+
deleteBtnProps,
|
|
209
|
+
hasDelete
|
|
212
210
|
}
|
|
213
211
|
}
|
|
214
212
|
</script>
|
|
@@ -70,3 +70,16 @@ slots:
|
|
|
70
70
|
}
|
|
71
71
|
"
|
|
72
72
|
]
|
|
73
|
+
|
|
74
|
+
selectors:
|
|
75
|
+
'actions-menu':
|
|
76
|
+
desc: Seletor do componente.
|
|
77
|
+
examples: ['data-cy="actions-menu"']
|
|
78
|
+
|
|
79
|
+
'actions-menu-list':
|
|
80
|
+
desc: Seletor da lista de ações.
|
|
81
|
+
examples: ['data-cy="actions-menu-list"']
|
|
82
|
+
|
|
83
|
+
'actions-menu-list-item':
|
|
84
|
+
desc: Seletor para cada item da lista de ações.
|
|
85
|
+
examples: ['data-cy="actions-menu-list-item"']
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<q-header class="qas-app-bar shadow-2" height-hint="56">
|
|
3
|
-
<q-toolbar class="bg-white qas-app-bar__toolbar text-grey-
|
|
4
|
-
<qas-btn color="grey-
|
|
3
|
+
<q-toolbar class="bg-white qas-app-bar__toolbar text-grey-10">
|
|
4
|
+
<qas-btn color="grey-10" icon="sym_r_menu" variant="tertiary" @click="toggleMenuDrawer" />
|
|
5
5
|
|
|
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
|
-
|
|
26
|
-
name: 'QasAppBar',
|
|
27
|
+
import { useScreen } from '../../composables'
|
|
27
28
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
QasBtn
|
|
31
|
-
},
|
|
29
|
+
import { computed } from 'vue'
|
|
30
|
+
import { useRouter } from 'vue-router'
|
|
32
31
|
|
|
33
|
-
|
|
34
|
-
appUserProps: {
|
|
35
|
-
type: Object,
|
|
36
|
-
required: true,
|
|
37
|
-
default: () => ({})
|
|
38
|
-
},
|
|
32
|
+
defineOptions({ name: 'QasAppBar' })
|
|
39
33
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
34
|
+
const props = defineProps({
|
|
35
|
+
appUserProps: {
|
|
36
|
+
type: Object,
|
|
37
|
+
required: true,
|
|
38
|
+
default: () => ({})
|
|
39
|
+
},
|
|
44
40
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
41
|
+
brand: {
|
|
42
|
+
default: '',
|
|
43
|
+
type: String
|
|
44
|
+
},
|
|
49
45
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
46
|
+
notifications: {
|
|
47
|
+
default: () => ({}),
|
|
48
|
+
type: Object
|
|
54
49
|
},
|
|
55
50
|
|
|
56
|
-
|
|
51
|
+
title: {
|
|
52
|
+
required: true,
|
|
53
|
+
type: String
|
|
54
|
+
}
|
|
55
|
+
})
|
|
57
56
|
|
|
58
|
-
|
|
59
|
-
return {
|
|
60
|
-
menuDrawer: true
|
|
61
|
-
}
|
|
62
|
-
},
|
|
57
|
+
const emits = defineEmits(['sign-out', 'toggle-menu'])
|
|
63
58
|
|
|
64
|
-
|
|
65
|
-
|
|
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
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
70
|
+
onSignOut: signOut,
|
|
71
|
+
...props.appUserProps
|
|
72
|
+
}
|
|
73
|
+
})
|
|
91
74
|
|
|
92
|
-
|
|
93
|
-
return hosts.localhost
|
|
94
|
-
}
|
|
75
|
+
const rootRoute = router.hasRoute('Root') ? { name: 'Root' } : { path: '/' }
|
|
95
76
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
77
|
+
const developmentBadgeLabel = computed(() => {
|
|
78
|
+
const hosts = {
|
|
79
|
+
localhost: 'Local',
|
|
80
|
+
'.dev.': 'Develop'
|
|
81
|
+
}
|
|
99
82
|
|
|
100
|
-
|
|
101
|
-
},
|
|
83
|
+
if (process.env.DEV) return hosts.localhost
|
|
102
84
|
|
|
103
|
-
|
|
104
|
-
return !!this.developmentBadgeLabel
|
|
105
|
-
},
|
|
85
|
+
const current = Object.keys(hosts).find(host => location.hostname.includes(host))
|
|
106
86
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
},
|
|
87
|
+
return current ? hosts[current] : ''
|
|
88
|
+
})
|
|
110
89
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
},
|
|
90
|
+
const hasDevelopmentBadge = computed(() => !!developmentBadgeLabel.value)
|
|
91
|
+
const hasUser = computed(() => !!Object.keys(defaultAppUserProps.value.user || {}).length)
|
|
114
92
|
|
|
115
|
-
|
|
116
|
-
return this.$qas.screen.isSmall && 'justify-center'
|
|
117
|
-
}
|
|
118
|
-
},
|
|
93
|
+
const routerLinkClass = computed(() => screen.isSmall && 'justify-center')
|
|
119
94
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
},
|
|
95
|
+
function signOut () {
|
|
96
|
+
emits('sign-out')
|
|
97
|
+
}
|
|
124
98
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
}
|
|
99
|
+
function toggleMenuDrawer () {
|
|
100
|
+
emits('toggle-menu')
|
|
129
101
|
}
|
|
130
102
|
</script>
|
|
131
103
|
|
|
@@ -136,7 +108,7 @@ export default {
|
|
|
136
108
|
}
|
|
137
109
|
|
|
138
110
|
&__brand {
|
|
139
|
-
max-width:
|
|
111
|
+
max-width: 115px;
|
|
140
112
|
}
|
|
141
113
|
}
|
|
142
114
|
</style>
|