@bildvitta/quasar-ui-asteroid 3.14.0-beta.0 → 3.14.0-beta.10
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-menu/QasActionsMenu.vue +16 -14
- package/src/components/alert/QasAlert.vue +1 -1
- package/src/components/app-bar/QasAppBar.vue +10 -5
- package/src/components/app-bar/QasAppBar.yml +3 -0
- package/src/components/app-menu/QasAppMenu.vue +9 -8
- package/src/components/app-menu/QasAppMenu.yml +3 -0
- package/src/components/app-menu/composables/use-app-user.js +3 -0
- package/src/components/app-menu/private/PvAppMenuDropdown.vue +1 -1
- package/src/components/app-user/QasAppUser.vue +75 -20
- package/src/components/app-user/QasAppUser.yml +3 -0
- package/src/components/avatar/QasAvatar.vue +11 -5
- package/src/components/avatar/QasAvatar.yml +1 -1
- package/src/components/avatar/enums/AvatarColors.js +2 -1
- package/src/components/breakline/QasBreakline.vue +5 -6
- package/src/components/btn-dropdown/QasBtnDropdown.vue +74 -95
- package/src/components/card/QasCard.vue +57 -75
- package/src/components/chart-view/QasChartView.vue +37 -9
- package/src/components/chart-view/QasChartView.yml +6 -0
- package/src/components/checkbox-group/QasCheckboxGroup.vue +81 -92
- package/src/components/copy/QasCopy.vue +20 -27
- package/src/components/date/QasDate.vue +349 -392
- package/src/components/date/QasDate.yml +0 -5
- package/src/components/date/enums/DateMaskOptions.js +6 -0
- package/src/components/date-time-input/QasDateTimeInput.vue +198 -209
- package/src/components/debugger/QasDebugger.vue +20 -12
- package/src/components/delete/QasDelete.vue +70 -80
- package/src/components/dialog/QasDialog.vue +35 -7
- package/src/components/dialog/composables/use-cancel.js +3 -3
- package/src/components/dialog/composables/use-dynamic-components.js +4 -4
- package/src/components/dialog/composables/use-ok.js +3 -3
- package/src/components/dialog-router/QasDialogRouter.vue +68 -67
- package/src/components/drawer/QasDrawer.vue +118 -0
- package/src/components/drawer/QasDrawer.yml +58 -0
- package/src/components/empty-result-text/QasEmptyResultText.vue +8 -10
- package/src/components/form-generator/QasFormGenerator.vue +2 -2
- package/src/components/gallery/QasGallery.vue +175 -196
- package/src/components/gallery/composables/use-delete.js +54 -0
- package/src/components/gallery/private/PvGalleryCarouselDialog.vue +48 -55
- package/src/components/gallery/private/PvGalleryDeleteDialog.vue +41 -50
- package/src/components/gallery-card/QasGalleryCard.vue +90 -103
- package/src/components/grid-generator/QasGridGenerator.vue +2 -2
- package/src/components/header-actions/QasHeaderActions.vue +35 -50
- package/src/components/header-actions/QasHeaderActions.yml +1 -1
- package/src/components/infinite-scroll/QasInfiniteScroll.vue +7 -3
- package/src/components/infinite-scroll/QasInfiniteScroll.yml +22 -0
- package/src/components/label/QasLabel.vue +42 -54
- package/src/components/layout/QasLayout.vue +65 -52
- package/src/components/layout/QasLayout.yml +5 -0
- package/src/components/layout/private/PvLayoutNotificationCard.vue +86 -0
- package/src/components/layout/private/PvLayoutNotificationsDrawer.vue +140 -0
- package/src/components/list-items/QasListItems.vue +67 -44
- package/src/components/list-items/QasListItems.yml +5 -0
- package/src/components/map/QasMap.vue +44 -46
- package/src/components/numeric-input/QasNumericInput.vue +2 -2
- package/src/components/page-header/QasPageHeader.vue +74 -87
- package/src/components/pagination/QasPagination.vue +21 -21
- package/src/components/select-list-dialog/QasSelectListDialog.vue +4 -2
- package/src/components/tabs-generator/QasTabsGenerator.vue +55 -63
- package/src/components/timeline/QasTimeline.vue +1 -1
- package/src/components/uploader/private/PvUploaderGalleryCard.vue +1 -1
- package/src/components/whatsapp-link/QasWhatsappLink.vue +34 -0
- package/src/components/whatsapp-link/QasWhatsappLink.yml +18 -0
- package/src/composables/index.js +3 -0
- package/src/composables/private/use-generator.js +0 -8
- package/src/composables/use-notifications.js +114 -0
- package/src/css/plugins/notify.scss +40 -2
- package/src/helpers/private/has-parent-by-class-name.js +15 -0
- package/src/vue-plugin.js +10 -1
package/package.json
CHANGED
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
</q-item-section>
|
|
10
10
|
|
|
11
11
|
<q-item-section>
|
|
12
|
-
<div>
|
|
12
|
+
<div>
|
|
13
|
+
{{ item.label }}
|
|
14
|
+
</div>
|
|
13
15
|
</q-item-section>
|
|
14
16
|
</q-item>
|
|
15
17
|
</slot>
|
|
@@ -86,7 +88,7 @@ const { deleteBtnProps, hasDelete } = useDelete()
|
|
|
86
88
|
const fullList = computed(() => {
|
|
87
89
|
return {
|
|
88
90
|
...props.list,
|
|
89
|
-
...deleteBtnProps
|
|
91
|
+
...deleteBtnProps.value
|
|
90
92
|
}
|
|
91
93
|
})
|
|
92
94
|
|
|
@@ -189,20 +191,20 @@ function onClick (item = {}) {
|
|
|
189
191
|
|
|
190
192
|
// ------------------------------- composables ---------------------------------
|
|
191
193
|
function useDelete () {
|
|
192
|
-
const deleteBtnProps = {}
|
|
193
|
-
|
|
194
194
|
const hasDelete = computed(() => !!Object.keys(props.deleteProps).length)
|
|
195
195
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
196
|
+
const deleteBtnProps = computed(() => {
|
|
197
|
+
return {
|
|
198
|
+
...(hasDelete.value && {
|
|
199
|
+
delete: {
|
|
200
|
+
color: 'grey-10',
|
|
201
|
+
icon: props.deleteIcon,
|
|
202
|
+
label: props.deleteLabel,
|
|
203
|
+
handler: () => qas.delete(props.deleteProps)
|
|
204
|
+
}
|
|
205
|
+
})
|
|
206
|
+
}
|
|
207
|
+
})
|
|
206
208
|
|
|
207
209
|
return {
|
|
208
210
|
deleteBtnProps,
|
|
@@ -5,9 +5,9 @@
|
|
|
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
|
-
<img v-if="brand" :alt="title" class="qas-app-bar__brand" :src="brand">
|
|
8
|
+
<img v-if="props.brand" :alt="props.title" class="qas-app-bar__brand" :src="props.brand">
|
|
9
9
|
|
|
10
|
-
<span v-else class="ellipsis text-bold text-primary">{{ title }}</span>
|
|
10
|
+
<span v-else class="ellipsis text-bold text-primary">{{ props.title }}</span>
|
|
11
11
|
|
|
12
12
|
<q-badge v-if="hasDevelopmentBadge" class="q-ml-sm" color="red" :label="developmentBadgeLabel" />
|
|
13
13
|
</router-link>
|
|
@@ -54,7 +54,7 @@ const props = defineProps({
|
|
|
54
54
|
}
|
|
55
55
|
})
|
|
56
56
|
|
|
57
|
-
const
|
|
57
|
+
const emit = defineEmits(['sign-out', 'toggle-menu', 'toggle-notifications'])
|
|
58
58
|
|
|
59
59
|
const router = useRouter()
|
|
60
60
|
const screen = useScreen()
|
|
@@ -68,6 +68,7 @@ const defaultAppUserProps = computed(() => {
|
|
|
68
68
|
},
|
|
69
69
|
|
|
70
70
|
onSignOut: signOut,
|
|
71
|
+
onToggleNotifications: toggleNotifications,
|
|
71
72
|
...props.appUserProps
|
|
72
73
|
}
|
|
73
74
|
})
|
|
@@ -93,11 +94,15 @@ const hasUser = computed(() => !!Object.keys(defaultAppUserProps.value.user || {
|
|
|
93
94
|
const routerLinkClass = computed(() => screen.isSmall && 'justify-center')
|
|
94
95
|
|
|
95
96
|
function signOut () {
|
|
96
|
-
|
|
97
|
+
emit('sign-out')
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function toggleNotifications () {
|
|
101
|
+
emit('toggle-notifications')
|
|
97
102
|
}
|
|
98
103
|
|
|
99
104
|
function toggleMenuDrawer () {
|
|
100
|
-
|
|
105
|
+
emit('toggle-menu')
|
|
101
106
|
}
|
|
102
107
|
</script>
|
|
103
108
|
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
<!-- Brand -->
|
|
7
7
|
<div v-if="!screen.untilLarge" class="q-mb-xl q-pt-xl qas-app-menu__label" :class="classes.spacedItem">
|
|
8
8
|
<router-link class="column flex items-center justify-center relative-position text-no-decoration" :to="rootRoute">
|
|
9
|
-
<q-img v-if="normalizedBrand" :alt="title" class="qas-app-menu__brand qas-app-menu__label" fit="contain" height="27px" img-class="qas-app-menu__brand-img" no-spinner :src="normalizedBrand" />
|
|
9
|
+
<q-img v-if="normalizedBrand" :alt="props.title" class="qas-app-menu__brand qas-app-menu__label" fit="contain" height="27px" img-class="qas-app-menu__brand-img" no-spinner :src="normalizedBrand" />
|
|
10
10
|
|
|
11
|
-
<span v-else-if="!isMiniMode" class="ellipsis text-bold text-primary text-subtitle2">{{ title }}</span>
|
|
11
|
+
<span v-else-if="!isMiniMode" class="ellipsis text-bold text-primary text-subtitle2">{{ props.title }}</span>
|
|
12
12
|
|
|
13
13
|
<q-badge v-if="hasDevelopmentBadge" class="q-mt-sm" color="red" :label="developmentBadgeLabel" />
|
|
14
14
|
</router-link>
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
</div>
|
|
31
31
|
|
|
32
32
|
<!-- List -->
|
|
33
|
-
<q-list v-if="items.length" class="q-mt-xl qas-app-menu__menu text-grey-10">
|
|
34
|
-
<template v-for="(menuItem, index) in items">
|
|
33
|
+
<q-list v-if="props.items.length" class="q-mt-xl qas-app-menu__menu text-grey-10">
|
|
34
|
+
<template v-for="(menuItem, index) in props.items">
|
|
35
35
|
<div v-if="hasChildren(menuItem)" :key="`children-${index}`" class="qas-app-menu__content" :class="classes.content">
|
|
36
36
|
<q-item class="ellipsis items-center q-py-none qas-app-menu__item qas-app-menu__item--label-mini text-weight-bold">
|
|
37
37
|
<div class="ellipsis qas-app-menu__label text-grey-10 text-subtitle2" :class="classes.spacedItem">
|
|
@@ -146,7 +146,7 @@ const props = defineProps({
|
|
|
146
146
|
}
|
|
147
147
|
})
|
|
148
148
|
|
|
149
|
-
const
|
|
149
|
+
const emit = defineEmits(['sign-out', 'update:modelValue', 'toggle-notifications'])
|
|
150
150
|
|
|
151
151
|
const screen = useScreen()
|
|
152
152
|
const router = useRouter()
|
|
@@ -159,7 +159,8 @@ const isMini = ref(screen.isLarge)
|
|
|
159
159
|
const composableParams = {
|
|
160
160
|
props,
|
|
161
161
|
onMenuUpdate: setHasOpenedMenu,
|
|
162
|
-
onSignOut: () =>
|
|
162
|
+
onSignOut: () => emit('sign-out'),
|
|
163
|
+
onToggleNotifications: () => emit('toggle-notifications')
|
|
163
164
|
}
|
|
164
165
|
|
|
165
166
|
const { defaultAppUserProps, showAppUser } = useAppUser(composableParams)
|
|
@@ -172,7 +173,7 @@ const model = computed({
|
|
|
172
173
|
},
|
|
173
174
|
|
|
174
175
|
set (value) {
|
|
175
|
-
|
|
176
|
+
emit('update:modelValue', value)
|
|
176
177
|
}
|
|
177
178
|
})
|
|
178
179
|
|
|
@@ -195,7 +196,7 @@ const classes = computed(() => {
|
|
|
195
196
|
|
|
196
197
|
// métodos
|
|
197
198
|
function closeDrawer () {
|
|
198
|
-
|
|
199
|
+
emit('update:modelValue', false)
|
|
199
200
|
}
|
|
200
201
|
|
|
201
202
|
function getNormalizedPath (path) {
|
|
@@ -57,6 +57,9 @@ events:
|
|
|
57
57
|
'@sign-out -> function()':
|
|
58
58
|
desc: Dispara quando o botão de "sair" é clicado.
|
|
59
59
|
|
|
60
|
+
'@toggle-notifications -> function()':
|
|
61
|
+
desc: Dispara quando o botão de "Notificações" é clicado.
|
|
62
|
+
|
|
60
63
|
'@update:model-value -> function(value)':
|
|
61
64
|
desc: Dispara quando o model-value altera, também usado para v-model.
|
|
62
65
|
params:
|
|
@@ -6,6 +6,7 @@ import { computed } from 'vue'
|
|
|
6
6
|
* @param {{
|
|
7
7
|
* props: { appUserProps: {} }
|
|
8
8
|
* onSignOut: () => void
|
|
9
|
+
* onToggleNotifications: () => void
|
|
9
10
|
* onMenuUpdate: () => void
|
|
10
11
|
* }} config
|
|
11
12
|
*/
|
|
@@ -14,6 +15,7 @@ export default function useAppUser (config = {}) {
|
|
|
14
15
|
props,
|
|
15
16
|
|
|
16
17
|
onSignOut,
|
|
18
|
+
onToggleNotifications,
|
|
17
19
|
onMenuUpdate
|
|
18
20
|
} = config
|
|
19
21
|
|
|
@@ -29,6 +31,7 @@ export default function useAppUser (config = {}) {
|
|
|
29
31
|
|
|
30
32
|
// eventos
|
|
31
33
|
onSignOut,
|
|
34
|
+
onToggleNotifications,
|
|
32
35
|
...props.appUserProps
|
|
33
36
|
}
|
|
34
37
|
})
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<div class="pv-app-menu-dropdown">
|
|
3
3
|
<qas-btn-dropdown v-bind="defaultButtonDropdownProps">
|
|
4
4
|
<q-list>
|
|
5
|
-
<q-item v-for="item in modules" :key="item" :active="isActive(item)" active-class="text-primary" :href="item.value">
|
|
5
|
+
<q-item v-for="item in props.modules" :key="item" :active="isActive(item)" active-class="text-primary" :href="item.value">
|
|
6
6
|
<q-item-section v-if="item.icon" avatar>
|
|
7
7
|
<q-icon :name="item.icon" />
|
|
8
8
|
</q-item-section>
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
<template>
|
|
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
|
-
<qas-avatar :image="user.photo" :size="avatarSize" :title="userName" />
|
|
4
|
+
<qas-avatar :image="props.user.photo" :size="props.avatarSize" :title="userName" />
|
|
5
5
|
|
|
6
|
-
<
|
|
7
|
-
{{ notifications.count }}
|
|
8
|
-
</q-badge>
|
|
6
|
+
<qas-avatar v-if="hasNotificationInUserAvatar" v-bind="avatarNotificationCountProps" />
|
|
9
7
|
</div>
|
|
10
8
|
|
|
11
9
|
<div class="ellipsis qas-app-user__data">
|
|
@@ -14,26 +12,26 @@
|
|
|
14
12
|
</div>
|
|
15
13
|
|
|
16
14
|
<div class="ellipsis qas-app-user__email text-grey-8">
|
|
17
|
-
{{ user.email }}
|
|
15
|
+
{{ props.user.email }}
|
|
18
16
|
</div>
|
|
19
17
|
</div>
|
|
20
18
|
|
|
21
|
-
<q-menu class="shadow-2 text-grey-10" max-height="400px" v-bind="menuProps" @hide="onMenuHide">
|
|
19
|
+
<q-menu class="shadow-2 text-grey-10" max-height="400px" v-bind="props.menuProps" @hide="onMenuHide">
|
|
22
20
|
<div class="q-pb-sm q-pt-md q-px-md qas-app-user__menu">
|
|
23
|
-
<qas-avatar class="q-mb-md" :image="user.photo" size="64px" :title="userName" />
|
|
21
|
+
<qas-avatar class="q-mb-md" :image="props.user.photo" size="64px" :title="userName" />
|
|
24
22
|
|
|
25
23
|
<div class="ellipsis qas-app-user__menu-name">
|
|
26
24
|
{{ userName }}
|
|
27
25
|
</div>
|
|
28
26
|
|
|
29
27
|
<div class="ellipsis">
|
|
30
|
-
{{ user.email }}
|
|
28
|
+
{{ props.user.email }}
|
|
31
29
|
</div>
|
|
32
30
|
|
|
33
31
|
<qas-select v-if="hasCompaniesSelect" v-bind="defaultCompanyProps" v-model="companiesModel" class="q-my-md" data-cy="app-user-companies-select" @update:model-value="setCompanies" />
|
|
34
32
|
|
|
35
33
|
<q-list class="q-mt-md">
|
|
36
|
-
<q-item v-close-popup :active="false" class="qas-app-user__menu-item" clickable :to="user.to">
|
|
34
|
+
<q-item v-close-popup :active="false" class="qas-app-user__menu-item" clickable :to="props.user.to">
|
|
37
35
|
<q-item-section avatar>
|
|
38
36
|
<q-icon name="sym_r_person" />
|
|
39
37
|
</q-item-section>
|
|
@@ -43,20 +41,16 @@
|
|
|
43
41
|
</q-item-section>
|
|
44
42
|
</q-item>
|
|
45
43
|
|
|
46
|
-
<q-item v-if="
|
|
47
|
-
<q-item-section avatar>
|
|
44
|
+
<q-item v-if="isNotificationsEnabled" v-close-popup class="qas-app-user__menu-item" clickable @click="toggleNotificationsDrawer">
|
|
45
|
+
<q-item-section avatar class="relative-position">
|
|
48
46
|
<q-icon name="sym_r_notifications" />
|
|
47
|
+
|
|
48
|
+
<qas-avatar v-if="hasUnreadNotifications" class="qas-app-user__notification-avatar--icon" v-bind="avatarNotificationCountProps" />
|
|
49
49
|
</q-item-section>
|
|
50
50
|
|
|
51
51
|
<q-item-section>
|
|
52
52
|
Notificações
|
|
53
53
|
</q-item-section>
|
|
54
|
-
|
|
55
|
-
<q-item-section side>
|
|
56
|
-
<q-badge color="red">
|
|
57
|
-
{{ notifications.count }}
|
|
58
|
-
</q-badge>
|
|
59
|
-
</q-item-section>
|
|
60
54
|
</q-item>
|
|
61
55
|
|
|
62
56
|
<q-item v-close-popup class="qas-app-user__menu-item" clickable @click="signOut">
|
|
@@ -77,6 +71,7 @@
|
|
|
77
71
|
<script setup>
|
|
78
72
|
import QasAvatar from '../avatar/QasAvatar.vue'
|
|
79
73
|
|
|
74
|
+
import useNotifications from '../../composables/use-notifications'
|
|
80
75
|
import { NotifySuccess, NotifyError } from '../../plugins'
|
|
81
76
|
|
|
82
77
|
import { ref, computed, watch, inject } from 'vue'
|
|
@@ -111,14 +106,19 @@ const props = defineProps({
|
|
|
111
106
|
}
|
|
112
107
|
})
|
|
113
108
|
|
|
114
|
-
const
|
|
109
|
+
const emit = defineEmits(['sign-out', 'toggle-notifications'])
|
|
115
110
|
|
|
116
111
|
// vindo direto do boot api.js
|
|
117
112
|
const axios = inject('axios')
|
|
118
113
|
|
|
114
|
+
const { isNotificationsEnabled, unreadNotificationsCount } = useNotifications()
|
|
115
|
+
|
|
119
116
|
const companiesModel = ref('')
|
|
120
117
|
const loading = ref(false)
|
|
121
118
|
|
|
119
|
+
const { avatarNotificationCountProps } = useAvatarNotifications()
|
|
120
|
+
|
|
121
|
+
// computed
|
|
122
122
|
const defaultCompanyProps = computed(() => {
|
|
123
123
|
return {
|
|
124
124
|
loading: loading.value,
|
|
@@ -131,8 +131,10 @@ const defaultCompanyProps = computed(() => {
|
|
|
131
131
|
})
|
|
132
132
|
|
|
133
133
|
const hasCompaniesSelect = computed(() => !!props.companyProps.options?.length)
|
|
134
|
-
const
|
|
134
|
+
const hasUnreadNotifications = computed(() => unreadNotificationsCount.value > 0)
|
|
135
|
+
const hasNotificationInUserAvatar = computed(() => isNotificationsEnabled && hasUnreadNotifications.value)
|
|
135
136
|
|
|
137
|
+
const unreadNotificationsToString = computed(() => String(unreadNotificationsCount.value))
|
|
136
138
|
const userName = computed(() => props.user.name || props.user.givenName)
|
|
137
139
|
|
|
138
140
|
// watch
|
|
@@ -140,9 +142,44 @@ watch(() => props.companyProps.modelValue, value => {
|
|
|
140
142
|
companiesModel.value = value
|
|
141
143
|
}, { immediate: true })
|
|
142
144
|
|
|
145
|
+
// composable
|
|
146
|
+
function useAvatarNotifications () {
|
|
147
|
+
const hasAnimated = ref(false)
|
|
148
|
+
|
|
149
|
+
watch(() => unreadNotificationsCount.value, () => {
|
|
150
|
+
hasAnimated.value = true
|
|
151
|
+
|
|
152
|
+
setTimeout(() => {
|
|
153
|
+
hasAnimated.value = false
|
|
154
|
+
}, 1000)
|
|
155
|
+
})
|
|
156
|
+
|
|
157
|
+
const avatarNotificationCountProps = computed(() => {
|
|
158
|
+
const classes = [
|
|
159
|
+
'qas-app-user__notification-avatar',
|
|
160
|
+
'animated',
|
|
161
|
+
{
|
|
162
|
+
rubberBand: hasAnimated.value
|
|
163
|
+
}
|
|
164
|
+
]
|
|
165
|
+
|
|
166
|
+
return {
|
|
167
|
+
class: classes,
|
|
168
|
+
color: 'red-14',
|
|
169
|
+
size: 'xs',
|
|
170
|
+
title: unreadNotificationsToString.value,
|
|
171
|
+
useCropTitle: false
|
|
172
|
+
}
|
|
173
|
+
})
|
|
174
|
+
|
|
175
|
+
return {
|
|
176
|
+
avatarNotificationCountProps
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
143
180
|
// métodos
|
|
144
181
|
function signOut () {
|
|
145
|
-
|
|
182
|
+
emit('sign-out')
|
|
146
183
|
}
|
|
147
184
|
|
|
148
185
|
async function setCompanies (value) {
|
|
@@ -169,10 +206,28 @@ function onMenuHide () {
|
|
|
169
206
|
companiesModel.value = props.companyProps.modelValue
|
|
170
207
|
}
|
|
171
208
|
}
|
|
209
|
+
|
|
210
|
+
function toggleNotificationsDrawer () {
|
|
211
|
+
emit('toggle-notifications')
|
|
212
|
+
}
|
|
172
213
|
</script>
|
|
173
214
|
|
|
174
215
|
<style lang="scss">
|
|
175
216
|
.qas-app-user {
|
|
217
|
+
&__notification-avatar {
|
|
218
|
+
animation-duration: 1s;
|
|
219
|
+
position: absolute;
|
|
220
|
+
top: 0;
|
|
221
|
+
|
|
222
|
+
&:not(&--icon) {
|
|
223
|
+
right: -4px;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
&--icon {
|
|
227
|
+
right: 4px;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
176
231
|
&__data {
|
|
177
232
|
line-height: 1.1;
|
|
178
233
|
}
|
|
@@ -43,6 +43,9 @@ events:
|
|
|
43
43
|
'@sign-out -> function()':
|
|
44
44
|
desc: Dispara quando o botão de "sair" é clicado.
|
|
45
45
|
|
|
46
|
+
'@toggle-notifications -> function()':
|
|
47
|
+
desc: Dispara quando o botão de "Notificações" é clicado.
|
|
48
|
+
|
|
46
49
|
selectors:
|
|
47
50
|
app-user:
|
|
48
51
|
desc: Seletor do componente.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<q-avatar class="text-bold" v-bind="attributes">
|
|
3
|
-
<q-img v-if="hasImage" :alt="title" :ratio="1" spinner-color="primary" spinner-size="16px" :src="image" @error="onImageLoadedError" />
|
|
4
|
-
<template v-else-if="hasTitle">{{
|
|
5
|
-
<q-icon v-else :name="icon" />
|
|
3
|
+
<q-img v-if="hasImage" :alt="props.title" :ratio="1" spinner-color="primary" spinner-size="16px" :src="props.image" @error="onImageLoadedError" />
|
|
4
|
+
<template v-else-if="hasTitle">{{ label }}</template>
|
|
5
|
+
<q-icon v-else :name="props.icon" />
|
|
6
6
|
</q-avatar>
|
|
7
7
|
</template>
|
|
8
8
|
|
|
@@ -45,6 +45,11 @@ const props = defineProps({
|
|
|
45
45
|
title: {
|
|
46
46
|
default: '',
|
|
47
47
|
type: String
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
useCropTitle: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
default: true
|
|
48
53
|
}
|
|
49
54
|
})
|
|
50
55
|
|
|
@@ -64,7 +69,8 @@ const attributes = computed(() => {
|
|
|
64
69
|
const colors = {
|
|
65
70
|
[AvatarColors.Primary]: 'white',
|
|
66
71
|
[AvatarColors.SecondaryContrast]: 'primary',
|
|
67
|
-
[AvatarColors.Grey4]: 'grey-8'
|
|
72
|
+
[AvatarColors.Grey4]: 'grey-8',
|
|
73
|
+
[AvatarColors.Red14]: 'white'
|
|
68
74
|
}
|
|
69
75
|
|
|
70
76
|
return {
|
|
@@ -75,7 +81,7 @@ const attributes = computed(() => {
|
|
|
75
81
|
}
|
|
76
82
|
})
|
|
77
83
|
|
|
78
|
-
const
|
|
84
|
+
const label = computed(() => props.useCropTitle ? props.title[0]?.toUpperCase?.() : props.title)
|
|
79
85
|
|
|
80
86
|
const hasImage = computed(() => !hasImageError.value && !!props.image)
|
|
81
87
|
const hasTitle = computed(() => !!props.title)
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<component :is="tag" v-for="(line, index) in lines" :key="index" v-bind="
|
|
2
|
+
<component :is="props.tag" v-for="(line, index) in lines" :key="index" v-bind="attrs">
|
|
3
3
|
{{ line }}
|
|
4
4
|
</component>
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
7
|
<script setup>
|
|
8
|
-
import { computed } from 'vue'
|
|
8
|
+
import { computed, useAttrs, useSlots } from 'vue'
|
|
9
9
|
import { getSlotChildrenText } from '../../helpers'
|
|
10
10
|
|
|
11
|
-
defineOptions({
|
|
12
|
-
name: 'QasBreakline'
|
|
13
|
-
})
|
|
11
|
+
defineOptions({ name: 'QasBreakline' })
|
|
14
12
|
|
|
15
13
|
const props = defineProps({
|
|
16
14
|
split: {
|
|
@@ -29,7 +27,8 @@ const props = defineProps({
|
|
|
29
27
|
}
|
|
30
28
|
})
|
|
31
29
|
|
|
32
|
-
const
|
|
30
|
+
const attrs = useAttrs()
|
|
31
|
+
const slots = useSlots()
|
|
33
32
|
|
|
34
33
|
const lines = computed(() => {
|
|
35
34
|
const text = props.text || getSlotChildrenText(slots.default())
|