@bildvitta/quasar-ui-asteroid 3.15.0-beta.8 → 3.15.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-menu/QasActionsMenu.vue +138 -102
- package/src/components/actions-menu/QasActionsMenu.yml +6 -2
- package/src/components/actions-menu/composables/use-delete.js +30 -0
- package/src/components/actions-menu/composables/use-double-split-actions.js +42 -0
- package/src/components/actions-menu/composables/use-options-actions.js +27 -0
- package/src/components/actions-menu/composables/use-single-action.js +17 -0
- package/src/components/actions-menu/composables/use-single-split-actions.js +35 -0
- package/src/components/actions-menu/composables/use-tooltips.js +43 -0
- package/src/components/actions-menu/utils/get-label.js +3 -0
- package/src/components/actions-menu/utils/set-click-handler.js +6 -0
- package/src/components/app-menu/private/PvAppMenuDropdown.vue +10 -8
- package/src/components/app-user/QasAppUser.vue +14 -0
- package/src/components/btn-dropdown/QasBtnDropdown.vue +46 -44
- package/src/components/btn-dropdown/QasBtnDropdown.yml +13 -9
- package/src/components/card/QasCard.vue +5 -1
- package/src/components/chart-view/QasChartView.vue +7 -1
- package/src/components/chart-view/QasChartView.yml +6 -0
- package/src/components/expansion-item/QasExpansionItem.vue +100 -0
- package/src/components/expansion-item/QasExpansionItem.yml +35 -0
- package/src/components/form-generator/QasFormGenerator.vue +7 -2
- package/src/components/form-generator/QasFormGenerator.yml +6 -3
- package/src/components/grid-generator/QasGridGenerator.vue +56 -5
- package/src/components/grid-generator/QasGridGenerator.yml +14 -2
- package/src/components/nested-fields/QasNestedFields.yml +1 -1
- package/src/components/stepper/QasStepper.vue +152 -0
- package/src/components/stepper/QasStepper.yml +36 -0
- package/src/components/stepper-form-view/QasStepperFormView.vue +84 -0
- package/src/components/stepper-form-view/QasStepperFormView.yml +58 -0
- package/src/components/uploader/QasUploader.vue +9 -1
- package/src/components/uploader/QasUploader.yml +4 -0
- package/src/composables/private/use-generator.js +23 -15
- package/src/composables/use-query-cache.js +9 -2
- package/src/css/variables/spacing.scss +19 -3
- package/src/enums/Spacing.js +12 -4
- package/src/helpers/private/gutter-validator.js +15 -0
- package/src/vue-plugin.js +9 -0
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div v-if="
|
|
3
|
-
<
|
|
4
|
-
<q-list
|
|
5
|
-
<slot v-for="(item, key) in
|
|
6
|
-
<q-item v-bind="item
|
|
2
|
+
<div v-if="hasList" class="qas-actions-menu" data-cy="actions-menu">
|
|
3
|
+
<qas-btn-dropdown v-bind="btnDropdownProps">
|
|
4
|
+
<q-list data-cy="actions-menu-list">
|
|
5
|
+
<slot v-for="(item, key) in formattedList.dropdownList" :item="item" :name="key">
|
|
6
|
+
<q-item v-bind="getItemProps(item)" :key="key" clickable data-cy="actions-menu-list-item" @click="setClickHandler(item)">
|
|
7
7
|
<q-item-section avatar>
|
|
8
8
|
<q-icon :name="item.icon" />
|
|
9
9
|
</q-item-section>
|
|
@@ -17,21 +17,35 @@
|
|
|
17
17
|
</slot>
|
|
18
18
|
</q-list>
|
|
19
19
|
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
<template v-for="(item, name) in tooltipLabels" :key="name" #[`bottom-${name}`]>
|
|
21
|
+
<q-tooltip v-if="showTooltip(item)">
|
|
22
|
+
{{ item.label }}
|
|
23
|
+
</q-tooltip>
|
|
24
|
+
</template>
|
|
25
|
+
</qas-btn-dropdown>
|
|
24
26
|
</div>
|
|
25
27
|
</template>
|
|
26
28
|
|
|
27
29
|
<script setup>
|
|
28
|
-
import QasBtn from '../btn/QasBtn.vue'
|
|
29
30
|
import QasBtnDropdown from '../btn-dropdown/QasBtnDropdown.vue'
|
|
30
31
|
|
|
31
32
|
import useScreen from '../../composables/use-screen'
|
|
32
33
|
|
|
34
|
+
import useDelete from './composables/use-delete'
|
|
35
|
+
import useTooltips from './composables/use-tooltips'
|
|
36
|
+
import useOptionsActions from './composables/use-options-actions'
|
|
37
|
+
import useSingleAction from './composables/use-single-action'
|
|
38
|
+
import useDoubleSplitActions from './composables/use-double-split-actions'
|
|
39
|
+
import useSingleSplitActions from './composables/use-single-split-actions'
|
|
40
|
+
|
|
41
|
+
import getLabel from './utils/get-label'
|
|
42
|
+
import setClickHandler from './utils/set-click-handler'
|
|
43
|
+
|
|
33
44
|
import { computed, inject } from 'vue'
|
|
34
45
|
|
|
46
|
+
const DEFAULT_COLOR = 'grey-10'
|
|
47
|
+
const SPLIT_SIZE = 2
|
|
48
|
+
|
|
35
49
|
defineOptions({ name: 'QasActionsMenu' })
|
|
36
50
|
|
|
37
51
|
const qas = inject('qas')
|
|
@@ -42,6 +56,10 @@ const props = defineProps({
|
|
|
42
56
|
type: Object
|
|
43
57
|
},
|
|
44
58
|
|
|
59
|
+
disable: {
|
|
60
|
+
type: Boolean
|
|
61
|
+
},
|
|
62
|
+
|
|
45
63
|
deleteLabel: {
|
|
46
64
|
default: 'Excluir',
|
|
47
65
|
type: String
|
|
@@ -57,11 +75,6 @@ const props = defineProps({
|
|
|
57
75
|
type: Object
|
|
58
76
|
},
|
|
59
77
|
|
|
60
|
-
dropdownIcon: {
|
|
61
|
-
default: 'sym_r_more_vert',
|
|
62
|
-
type: String
|
|
63
|
-
},
|
|
64
|
-
|
|
65
78
|
list: {
|
|
66
79
|
default: () => ({}),
|
|
67
80
|
type: Object
|
|
@@ -83,8 +96,33 @@ const props = defineProps({
|
|
|
83
96
|
})
|
|
84
97
|
|
|
85
98
|
const screen = useScreen()
|
|
86
|
-
const { deleteBtnProps, hasDelete } = useDelete()
|
|
87
99
|
|
|
100
|
+
const { deleteBtnProps, hasDelete } = useDelete({ color: DEFAULT_COLOR, props, qas })
|
|
101
|
+
|
|
102
|
+
const hasSplitName = computed(() => !!props.splitName)
|
|
103
|
+
const hasList = computed(() => !!Object.keys(fullList.value).length)
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Tamanho total da lista, considerando ação de deletar caso exista.
|
|
107
|
+
*/
|
|
108
|
+
const listSize = computed(() => Object.keys(fullList.value).length)
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Só existe split caso tenha a propriedade "splitName" e o tamanho da lista seja
|
|
112
|
+
* maior que o tamanho permitido no SPLIT_SIZE (no caso 2).
|
|
113
|
+
*/
|
|
114
|
+
const hasSplit = computed(() => hasSplitName.value && listSize.value > SPLIT_SIZE)
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Quando existe apenas i item na lista, neste caso é mostrado o botão direto,
|
|
118
|
+
* mesmo que não tenha a propriedade "splitName".
|
|
119
|
+
*/
|
|
120
|
+
const isSingle = computed(() => Object.keys(fullList.value).length === 1)
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Lista englobando as que vem por propriedade "list" mergeadas com a do
|
|
124
|
+
* delete, caso exista.
|
|
125
|
+
*/
|
|
88
126
|
const fullList = computed(() => {
|
|
89
127
|
return {
|
|
90
128
|
...props.list,
|
|
@@ -92,123 +130,121 @@ const fullList = computed(() => {
|
|
|
92
130
|
}
|
|
93
131
|
})
|
|
94
132
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
133
|
+
/**
|
|
134
|
+
* chave do primaria do objeto, é considerado sendo a splitName caso exista no
|
|
135
|
+
* objeto, porém pode acontecer deste item deixar de existir por algum motivo
|
|
136
|
+
* então consideramos a chave primaria sendo o primeiro item da computada fullList.
|
|
137
|
+
*/
|
|
138
|
+
const primaryKey = computed(() => {
|
|
139
|
+
return props.splitName in fullList.value ? props.splitName : Object.keys(fullList.value)?.[0]
|
|
140
|
+
})
|
|
100
141
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
142
|
+
const defaultButtonPropsList = computed(() => {
|
|
143
|
+
const defaultButtonPropsList = {
|
|
144
|
+
useHoverOnWhiteColor: true,
|
|
145
|
+
useLabelOnSmallScreen: false
|
|
105
146
|
}
|
|
106
147
|
|
|
107
|
-
|
|
108
|
-
})
|
|
148
|
+
const normalizedButtonPropsList = {}
|
|
109
149
|
|
|
110
|
-
const
|
|
111
|
-
|
|
150
|
+
for (const key in formattedList.value.buttonsList) {
|
|
151
|
+
normalizedButtonPropsList[key] = {
|
|
152
|
+
...defaultButtonPropsList,
|
|
153
|
+
...formattedList.value.buttonsList[key]
|
|
154
|
+
}
|
|
155
|
+
}
|
|
112
156
|
|
|
113
|
-
|
|
114
|
-
const tooltipLabel = computed(() => actions.value[firstItemKey.value]?.label)
|
|
115
|
-
const hasTooltip = computed(() => {
|
|
116
|
-
return !isBtnDropdown.value && !props.useLabel && props.useTooltip
|
|
157
|
+
return normalizedButtonPropsList
|
|
117
158
|
})
|
|
118
159
|
|
|
119
|
-
|
|
120
|
-
const defaultButtonProps = computed(() => {
|
|
121
|
-
const { label, variant, ...buttonProps } = props.buttonProps
|
|
122
|
-
|
|
160
|
+
const btnDropdownProps = computed(() => {
|
|
123
161
|
return {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
162
|
+
buttonsPropsList: defaultButtonPropsList.value,
|
|
163
|
+
disable: props.disable,
|
|
164
|
+
useSplit: hasSplit.value
|
|
127
165
|
}
|
|
128
166
|
})
|
|
129
167
|
|
|
130
|
-
const
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
const {
|
|
134
|
-
icon: defaultIcon,
|
|
135
|
-
...defaultBtnProps
|
|
136
|
-
} = defaultButtonProps.value
|
|
168
|
+
const primaryButtonProps = computed(() => {
|
|
169
|
+
const buttonProps = fullList.value[primaryKey.value] || {}
|
|
137
170
|
|
|
138
171
|
return {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
172
|
+
/**
|
|
173
|
+
* Caso seja "isSingle" e tenha a opção de deletar, significa que único botão
|
|
174
|
+
* que existe é o de deletar, então a cor precisa ser "DEFAULT_COLOR", em todos
|
|
175
|
+
* os outros cenários, é primary.
|
|
176
|
+
*/
|
|
177
|
+
color: isSingle.value && hasDelete.value ? DEFAULT_COLOR : 'primary',
|
|
144
178
|
|
|
145
|
-
|
|
146
|
-
useSplit: hasSplit.value,
|
|
179
|
+
...buttonProps,
|
|
147
180
|
|
|
148
|
-
|
|
181
|
+
label: getLabel({ useLabel: props.useLabel, label: buttonProps.label }),
|
|
182
|
+
onClick: () => setClickHandler(buttonProps)
|
|
149
183
|
}
|
|
150
184
|
})
|
|
151
185
|
|
|
152
|
-
const
|
|
153
|
-
const
|
|
154
|
-
const { color: defaultColor, ...defaultBtnProps } = defaultButtonProps.value
|
|
186
|
+
const formattedList = computed(() => {
|
|
187
|
+
const buttonsPropsList = { ...fullList.value }
|
|
155
188
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
189
|
+
/**
|
|
190
|
+
* dropdownList: lista que ficará no menu dropdown.
|
|
191
|
+
* buttonsList: lista de botões que ficará **fora** do menu dropdown.
|
|
192
|
+
*/
|
|
193
|
+
const payload = { dropdownList: {}, buttonsList: {} }
|
|
194
|
+
|
|
195
|
+
if ((!hasSplitName.value || screen.isSmall) && !isSingle.value) {
|
|
196
|
+
const { buttonsList } = useOptionsActions({ color: DEFAULT_COLOR, props })
|
|
197
|
+
|
|
198
|
+
payload.buttonsList = buttonsList.value
|
|
199
|
+
payload.dropdownList = buttonsPropsList
|
|
200
|
+
|
|
201
|
+
return payload
|
|
162
202
|
}
|
|
163
|
-
})
|
|
164
203
|
|
|
165
|
-
|
|
204
|
+
if (isSingle.value) {
|
|
205
|
+
const { buttonsList } = useSingleAction({ primaryButtonProps, primaryKey })
|
|
166
206
|
|
|
167
|
-
|
|
168
|
-
const component = computed(() => {
|
|
169
|
-
const is = isBtnDropdown.value ? QasBtnDropdown : QasBtn
|
|
207
|
+
payload.buttonsList = buttonsList.value
|
|
170
208
|
|
|
171
|
-
|
|
172
|
-
is,
|
|
173
|
-
props: {
|
|
174
|
-
...(isBtnDropdown.value ? btnDropdownProps.value : btnProps.value),
|
|
175
|
-
...(hasDelete.value && props.deleteProps)
|
|
176
|
-
}
|
|
209
|
+
return payload
|
|
177
210
|
}
|
|
178
|
-
})
|
|
179
211
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
212
|
+
if (listSize.value === SPLIT_SIZE) {
|
|
213
|
+
const { buttonsList } = useDoubleSplitActions({
|
|
214
|
+
buttonsPropsList,
|
|
215
|
+
color: DEFAULT_COLOR,
|
|
216
|
+
primaryButtonProps,
|
|
217
|
+
primaryKey,
|
|
218
|
+
props
|
|
219
|
+
})
|
|
220
|
+
|
|
221
|
+
payload.buttonsList = buttonsList.value
|
|
184
222
|
}
|
|
185
223
|
|
|
186
|
-
if (
|
|
187
|
-
const {
|
|
188
|
-
|
|
224
|
+
if (listSize.value > SPLIT_SIZE) {
|
|
225
|
+
const { list } = useSingleSplitActions({
|
|
226
|
+
buttonsPropsList,
|
|
227
|
+
primaryButtonProps,
|
|
228
|
+
primaryKey,
|
|
229
|
+
props
|
|
230
|
+
})
|
|
231
|
+
|
|
232
|
+
payload.buttonsList = list.value.buttonsList
|
|
233
|
+
payload.dropdownList = list.value.dropdownList
|
|
189
234
|
}
|
|
190
|
-
}
|
|
191
235
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
color: 'grey-10',
|
|
201
|
-
icon: props.deleteIcon,
|
|
202
|
-
label: props.deleteLabel,
|
|
203
|
-
handler: () => qas.delete(props.deleteProps)
|
|
204
|
-
}
|
|
205
|
-
})
|
|
206
|
-
}
|
|
207
|
-
})
|
|
236
|
+
return payload
|
|
237
|
+
})
|
|
238
|
+
|
|
239
|
+
const { showTooltip, tooltipLabels } = useTooltips({ formattedList, fullList, props })
|
|
240
|
+
|
|
241
|
+
// functions
|
|
242
|
+
function getItemProps (item) {
|
|
243
|
+
const { disable, props: itemProps } = item
|
|
208
244
|
|
|
209
245
|
return {
|
|
210
|
-
|
|
211
|
-
|
|
246
|
+
disable,
|
|
247
|
+
...itemProps
|
|
212
248
|
}
|
|
213
249
|
}
|
|
214
250
|
</script>
|
|
@@ -5,10 +5,14 @@ meta:
|
|
|
5
5
|
|
|
6
6
|
props:
|
|
7
7
|
button-props:
|
|
8
|
-
desc: Propriedades
|
|
8
|
+
desc: Propriedades que são usadas no modo "Opções", que é quando não é usado a propriedade "splitName" ou esteja no mobile;
|
|
9
9
|
default: {}
|
|
10
10
|
type: Object
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
disable:
|
|
13
|
+
desc: Desabilita o componente como um todo.
|
|
14
|
+
default: false
|
|
15
|
+
type: Boolean
|
|
12
16
|
|
|
13
17
|
delete-icon:
|
|
14
18
|
desc: Ícone do botão de deletar.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { computed } from 'vue'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @param {{
|
|
5
|
+
* color: string,
|
|
6
|
+
* props: { deleteIcon: string, deleteLabel: string, deleteProps: object },
|
|
7
|
+
* qas: { delete: function(object) }
|
|
8
|
+
* }}
|
|
9
|
+
*/
|
|
10
|
+
export default function useDelete ({ color, props, qas }) {
|
|
11
|
+
const hasDelete = computed(() => !!Object.keys(props.deleteProps).length)
|
|
12
|
+
|
|
13
|
+
const deleteBtnProps = computed(() => {
|
|
14
|
+
return {
|
|
15
|
+
...(hasDelete.value && {
|
|
16
|
+
delete: {
|
|
17
|
+
color,
|
|
18
|
+
icon: props.deleteIcon,
|
|
19
|
+
label: props.deleteLabel,
|
|
20
|
+
handler: () => qas.delete(props.deleteProps)
|
|
21
|
+
}
|
|
22
|
+
})
|
|
23
|
+
}
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
return {
|
|
27
|
+
deleteBtnProps,
|
|
28
|
+
hasDelete
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import setClickHandler from '../utils/set-click-handler'
|
|
2
|
+
import getLabel from '../utils/get-label'
|
|
3
|
+
|
|
4
|
+
import { computed } from 'vue'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Cenário onde ficará um botão ao lado do outro "Ação primaria | Ação secundaria".
|
|
8
|
+
*
|
|
9
|
+
* @param {{
|
|
10
|
+
* color: string,
|
|
11
|
+
* props: { useLabel: boolean },
|
|
12
|
+
* primaryKey: import('vue').ComputedRef<string>,
|
|
13
|
+
* buttonsPropsList: import('vue').ComputedRef<object>
|
|
14
|
+
* primaryButtonProps: import('vue').ComputedRef<primaryButtonProps>
|
|
15
|
+
* }} config
|
|
16
|
+
*/
|
|
17
|
+
export default function useDoubleSplitActions (config = {}) {
|
|
18
|
+
const { color, props, primaryKey, buttonsPropsList, primaryButtonProps } = config
|
|
19
|
+
|
|
20
|
+
const buttonsList = computed(() => {
|
|
21
|
+
const secondaryKey = Object.keys(buttonsPropsList).find(key => key !== primaryKey.value)
|
|
22
|
+
const secondaryButton = buttonsPropsList[secondaryKey]
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
[primaryKey.value]: {
|
|
26
|
+
...primaryButtonProps.value,
|
|
27
|
+
label: getLabel({ useLabel: props.useLabel, label: primaryButtonProps.value.label })
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
[secondaryKey]: {
|
|
31
|
+
...secondaryButton,
|
|
32
|
+
color,
|
|
33
|
+
label: getLabel({ useLabel: props.useLabel, label: secondaryButton.label }),
|
|
34
|
+
onClick: () => setClickHandler(secondaryButton)
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
buttonsList
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import getLabel from '../utils/get-label'
|
|
2
|
+
|
|
3
|
+
import { computed } from 'vue'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Cenário onde não é utilizado com split e tenha mais de 1 item na lista,
|
|
7
|
+
* neste caso, ele se torna o botão de "opções" onde será usado em casos como
|
|
8
|
+
* dentro de cards, etc.
|
|
9
|
+
*
|
|
10
|
+
* @param {{ color: string, props: { buttonProps: object, useLabel: boolean } }}
|
|
11
|
+
*/
|
|
12
|
+
export default function useOptionsActions ({ props, color }) {
|
|
13
|
+
const buttonsList = computed(() => {
|
|
14
|
+
return {
|
|
15
|
+
options: {
|
|
16
|
+
color,
|
|
17
|
+
iconRight: 'sym_r_more_vert',
|
|
18
|
+
...props.buttonProps,
|
|
19
|
+
label: getLabel({ useLabel: props.useLabel, label: 'Opções' }) // label não pode ser sobrescrita.
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
buttonsList
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { computed } from 'vue'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Cenário para quando existir apenas 1 item na lista.
|
|
5
|
+
*
|
|
6
|
+
* @param {{
|
|
7
|
+
* primaryKey: import('vue').ComputedRef<string>,
|
|
8
|
+
* primaryButtonProps: import('vue').ComputedRef<primaryButtonProps>
|
|
9
|
+
* }}
|
|
10
|
+
*/
|
|
11
|
+
export default function useSingleAction ({ primaryKey, primaryButtonProps }) {
|
|
12
|
+
const buttonsList = computed(() => ({ [primaryKey.value]: { ...primaryButtonProps.value } }))
|
|
13
|
+
|
|
14
|
+
return {
|
|
15
|
+
buttonsList
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { computed } from 'vue'
|
|
2
|
+
|
|
3
|
+
import getLabel from '../utils/get-label'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Cenário onde vai ter mais de 2 itens na lista, então precisa ficar
|
|
7
|
+
* o botão primário fora do dropdown e o restante dentro do dropdown.
|
|
8
|
+
*
|
|
9
|
+
* @param {{
|
|
10
|
+
* props: { useLabel: boolean },
|
|
11
|
+
* primaryKey: import('vue').ComputedRef<string>,
|
|
12
|
+
* buttonsPropsList: import('vue').ComputedRef<object>
|
|
13
|
+
* primaryButtonProps: import('vue').ComputedRef<primaryButtonProps>
|
|
14
|
+
* }} config
|
|
15
|
+
*/
|
|
16
|
+
export default function useSingleSplitActions ({ buttonsPropsList, props, primaryKey, primaryButtonProps }) {
|
|
17
|
+
delete buttonsPropsList[primaryKey.value]
|
|
18
|
+
|
|
19
|
+
const list = computed(() => {
|
|
20
|
+
return {
|
|
21
|
+
buttonsList: {
|
|
22
|
+
[primaryKey.value]: {
|
|
23
|
+
...primaryButtonProps.value,
|
|
24
|
+
label: getLabel({ useLabel: props.useLabel, label: primaryButtonProps.value.label })
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
dropdownList: buttonsPropsList
|
|
29
|
+
}
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
list
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { computed } from 'vue'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Composable responsável pelo tooltip
|
|
5
|
+
*
|
|
6
|
+
* @param {{
|
|
7
|
+
* props: { useTooltip: boolean, useLabel: boolean },
|
|
8
|
+
* formattedList: import('vue').ComputedRef<object>
|
|
9
|
+
* fullList: import('vue').ComputedRef<object>
|
|
10
|
+
* }}
|
|
11
|
+
*/
|
|
12
|
+
export default function useTooltip ({ props, formattedList, fullList }) {
|
|
13
|
+
const hasTooltip = computed(() => !props.useLabel && props.useTooltip)
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Precisa existir um tooltip para item de "formattedList.value.buttonsList",
|
|
17
|
+
* então é preciso fazer um tratamento, uma vez que dentro de "formattedList.value.buttonsList"
|
|
18
|
+
* não existe mais "labels", então recuperamos elas de "fullList".
|
|
19
|
+
*/
|
|
20
|
+
const tooltipLabels = computed(() => {
|
|
21
|
+
if (!hasTooltip.value) return {}
|
|
22
|
+
|
|
23
|
+
const formattedProps = {}
|
|
24
|
+
|
|
25
|
+
for (const key in formattedList.value.buttonsList) {
|
|
26
|
+
formattedProps[key] = {
|
|
27
|
+
label: fullList.value[key]?.label
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return formattedProps
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
function showTooltip ({ label }) {
|
|
35
|
+
return hasTooltip.value && label
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return {
|
|
39
|
+
tooltipLabels,
|
|
40
|
+
|
|
41
|
+
showTooltip
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -41,14 +41,16 @@ const props = defineProps({
|
|
|
41
41
|
const defaultButtonDropdownProps = computed(() => ({
|
|
42
42
|
...props.buttonDropdownProps,
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
44
|
+
buttonsPropsList: {
|
|
45
|
+
modules: {
|
|
46
|
+
align: 'between',
|
|
47
|
+
class: 'text-subtitle2',
|
|
48
|
+
color: 'primary',
|
|
49
|
+
iconRight: 'sym_r_expand_more',
|
|
50
|
+
label: props.currentModule.label,
|
|
51
|
+
useEllipsis: true,
|
|
52
|
+
useLabelOnSmallScreen: true
|
|
53
|
+
}
|
|
52
54
|
}
|
|
53
55
|
}))
|
|
54
56
|
|
|
@@ -72,9 +72,11 @@
|
|
|
72
72
|
import QasAvatar from '../avatar/QasAvatar.vue'
|
|
73
73
|
|
|
74
74
|
import useNotifications from '../../composables/use-notifications'
|
|
75
|
+
import useQueryCache from '../../composables/use-query-cache'
|
|
75
76
|
import { NotifySuccess, NotifyError } from '../../plugins'
|
|
76
77
|
|
|
77
78
|
import { ref, computed, watch, inject } from 'vue'
|
|
79
|
+
import { useRouter } from 'vue-router'
|
|
78
80
|
|
|
79
81
|
defineOptions({ name: 'QasAppUser' })
|
|
80
82
|
|
|
@@ -111,8 +113,12 @@ const emit = defineEmits(['sign-out', 'toggle-notifications'])
|
|
|
111
113
|
// vindo direto do boot api.js
|
|
112
114
|
const axios = inject('axios')
|
|
113
115
|
|
|
116
|
+
const router = useRouter()
|
|
117
|
+
|
|
114
118
|
const { isNotificationsEnabled, unreadNotificationsCount } = useNotifications()
|
|
115
119
|
|
|
120
|
+
const { reset } = useQueryCache()
|
|
121
|
+
|
|
116
122
|
const companiesModel = ref('')
|
|
117
123
|
const loading = ref(false)
|
|
118
124
|
|
|
@@ -198,9 +204,17 @@ async function setCompanies (value) {
|
|
|
198
204
|
NotifyError('Falha ao alterar vínculo.')
|
|
199
205
|
} finally {
|
|
200
206
|
loading.value = false
|
|
207
|
+
|
|
208
|
+
clearCachedFilters()
|
|
201
209
|
}
|
|
202
210
|
}
|
|
203
211
|
|
|
212
|
+
function clearCachedFilters () {
|
|
213
|
+
reset()
|
|
214
|
+
|
|
215
|
+
router.push({ query: {} })
|
|
216
|
+
}
|
|
217
|
+
|
|
204
218
|
function onMenuHide () {
|
|
205
219
|
if (!companiesModel.value) {
|
|
206
220
|
companiesModel.value = props.companyProps.modelValue
|