@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
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="qas-btn-dropdown" :class="classes.parent">
|
|
3
|
-
<div v-if="
|
|
4
|
-
<
|
|
5
|
-
<
|
|
6
|
-
<
|
|
7
|
-
<
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
<div v-if="hasButtons" :class="classes.list">
|
|
4
|
+
<div v-for="(buttonProps, key, index) in props.buttonsPropsList" :key="key">
|
|
5
|
+
<div class="flex">
|
|
6
|
+
<qas-btn :disable="props.disable" v-bind="buttonProps" variant="tertiary" @click="onClick">
|
|
7
|
+
<q-menu v-if="hasMenuOnLeftSide" v-model="isMenuOpened" anchor="bottom right" auto-close self="top right" @update:model-value="onUpdateMenuValue">
|
|
8
|
+
<div :class="classes.menuContent">
|
|
9
|
+
<slot />
|
|
10
|
+
</div>
|
|
11
|
+
</q-menu>
|
|
12
|
+
</qas-btn>
|
|
13
|
+
|
|
14
|
+
<slot :name="`bottom-${key}`" />
|
|
15
|
+
|
|
16
|
+
<q-separator v-if="hasSeparator(index)" class="q-mx-sm qas-btn-dropdown__separator self-center" dark vertical />
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
13
19
|
</div>
|
|
14
20
|
|
|
15
|
-
<q-separator v-if="hasSeparator" class="q-mr-sm qas-btn-dropdown__separator self-center" dark vertical />
|
|
16
|
-
|
|
17
21
|
<div v-if="props.useSplit">
|
|
18
|
-
<qas-btn color="grey-10" :icon="props.dropdownIcon" variant="tertiary">
|
|
22
|
+
<qas-btn color="grey-10" :disable="disable" :icon="props.dropdownIcon" variant="tertiary">
|
|
19
23
|
<q-menu v-if="hasDefaultSlot" anchor="bottom right" auto-close self="top right">
|
|
20
24
|
<div :class="classes.menuContent">
|
|
21
25
|
<slot />
|
|
@@ -37,7 +41,7 @@ defineOptions({
|
|
|
37
41
|
})
|
|
38
42
|
|
|
39
43
|
const props = defineProps({
|
|
40
|
-
|
|
44
|
+
buttonsPropsList: {
|
|
41
45
|
default: () => ({}),
|
|
42
46
|
type: Object
|
|
43
47
|
},
|
|
@@ -47,7 +51,11 @@ const props = defineProps({
|
|
|
47
51
|
type: String
|
|
48
52
|
},
|
|
49
53
|
|
|
50
|
-
|
|
54
|
+
disable: {
|
|
55
|
+
type: Boolean
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
menu: {
|
|
51
59
|
type: Boolean
|
|
52
60
|
},
|
|
53
61
|
|
|
@@ -55,8 +63,13 @@ const props = defineProps({
|
|
|
55
63
|
type: Boolean
|
|
56
64
|
},
|
|
57
65
|
|
|
58
|
-
|
|
66
|
+
useSplit: {
|
|
59
67
|
type: Boolean
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
useTooltip: {
|
|
71
|
+
type: Boolean,
|
|
72
|
+
default: true
|
|
60
73
|
}
|
|
61
74
|
})
|
|
62
75
|
|
|
@@ -67,47 +80,28 @@ const screen = useScreen()
|
|
|
67
80
|
|
|
68
81
|
const isMenuOpened = ref(false)
|
|
69
82
|
|
|
70
|
-
const defaultButtonProps = computed(() => {
|
|
71
|
-
const {
|
|
72
|
-
icon,
|
|
73
|
-
iconRight,
|
|
74
|
-
color,
|
|
75
|
-
...defaultProps
|
|
76
|
-
} = props.buttonProps
|
|
77
|
-
|
|
78
|
-
const defaultIconRight = iconRight || props.dropdownIcon
|
|
79
|
-
|
|
80
|
-
return {
|
|
81
|
-
useLabelOnSmallScreen: false,
|
|
82
|
-
|
|
83
|
-
...defaultProps,
|
|
84
|
-
|
|
85
|
-
color: color || (!props.useSplit ? 'grey-10' : 'primary'),
|
|
86
|
-
...(!props.useSplit && { iconRight: defaultIconRight }),
|
|
87
|
-
...(props.useSplit && { icon })
|
|
88
|
-
}
|
|
89
|
-
})
|
|
90
|
-
|
|
91
83
|
const classes = computed(() => {
|
|
92
84
|
return {
|
|
93
85
|
parent: {
|
|
94
86
|
'flex inline items-center': props.useSplit
|
|
95
87
|
},
|
|
96
88
|
|
|
97
|
-
leftSide: {
|
|
98
|
-
'q-mr-sm': props.useSplit
|
|
99
|
-
},
|
|
100
|
-
|
|
101
89
|
menuContent: {
|
|
102
90
|
'q-pa-md': props.useMenuPadding
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
list: {
|
|
94
|
+
flex: !isSingleButton.value
|
|
103
95
|
}
|
|
104
96
|
}
|
|
105
97
|
})
|
|
106
98
|
|
|
99
|
+
const buttonsPropsListSize = computed(() => Object.keys(props.buttonsPropsList).length)
|
|
100
|
+
const isSingleButton = computed(() => buttonsPropsListSize.value === 1)
|
|
101
|
+
|
|
102
|
+
const hasButtons = computed(() => !screen.isSmall || !props.useSplit)
|
|
107
103
|
const hasDefaultSlot = computed(() => !!slots.default)
|
|
108
|
-
const
|
|
109
|
-
const hasMenuOnLeftSide = computed(() => hasDefaultSlot.value && !props.useSplit)
|
|
110
|
-
const hasSeparator = computed(() => !screen.isSmall && props.useSplit)
|
|
104
|
+
const hasMenuOnLeftSide = computed(() => hasDefaultSlot.value && !props.useSplit && isSingleButton.value)
|
|
111
105
|
|
|
112
106
|
watch(() => props.menu, value => {
|
|
113
107
|
isMenuOpened.value = value
|
|
@@ -120,6 +114,14 @@ function onUpdateMenuValue (value) {
|
|
|
120
114
|
function onClick (event) {
|
|
121
115
|
emit('click', event)
|
|
122
116
|
}
|
|
117
|
+
|
|
118
|
+
function isLast (index) {
|
|
119
|
+
return index + 1 === buttonsPropsListSize.value
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function hasSeparator (index) {
|
|
123
|
+
return props.useSplit || !isLast(index)
|
|
124
|
+
}
|
|
123
125
|
</script>
|
|
124
126
|
|
|
125
127
|
<style lang="scss">
|
|
@@ -4,11 +4,16 @@ meta:
|
|
|
4
4
|
desc: Componente semelhante ao QBtnDropdown porém utilizando o QasBtn e QSeparator para aplicar estilos padrões do Design System.
|
|
5
5
|
|
|
6
6
|
props:
|
|
7
|
-
|
|
8
|
-
desc:
|
|
9
|
-
default:
|
|
10
|
-
type:
|
|
11
|
-
examples: ["{ color: 'white', icon: 'sym_r_person' }"]
|
|
7
|
+
buttons-props-list:
|
|
8
|
+
desc: Lista de propriedades repassadas para os botões.
|
|
9
|
+
default: []
|
|
10
|
+
type: Array
|
|
11
|
+
examples: ["[{ color: 'white', icon: 'sym_r_person' }]"]
|
|
12
|
+
|
|
13
|
+
disable:
|
|
14
|
+
desc: Desabilita o componente como um todo.
|
|
15
|
+
default: false
|
|
16
|
+
type: Boolean
|
|
12
17
|
|
|
13
18
|
dropdown-icon:
|
|
14
19
|
desc: Ícone a direita do dropdown.
|
|
@@ -33,10 +38,9 @@ props:
|
|
|
33
38
|
|
|
34
39
|
slots:
|
|
35
40
|
default:
|
|
36
|
-
desc: Slot para passar o conteúdo do dropdown (menu)
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
desc: Slot para substituir o botão a esquerda.
|
|
41
|
+
desc: Slot para passar o conteúdo do dropdown (menu).
|
|
42
|
+
bottom-[buttons-props-list-key]:
|
|
43
|
+
desc: Slot unitário para acessar abaixo de cada botão (normalmente utilizado para tooltip).
|
|
40
44
|
|
|
41
45
|
events:
|
|
42
46
|
'@click -> function (event)':
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<qas-actions-menu v-if="hasActions" :list="actionsMenuProps" :use-label="false" />
|
|
12
12
|
</div>
|
|
13
13
|
|
|
14
|
-
<div class="q-my-sm">
|
|
14
|
+
<div class="q-my-sm qas-card__content">
|
|
15
15
|
<slot name="default" />
|
|
16
16
|
</div>
|
|
17
17
|
|
|
@@ -97,6 +97,10 @@ const hasFooter = computed(() => hasFooterSlot.value || hasExpansion.value)
|
|
|
97
97
|
|
|
98
98
|
<style lang="scss">
|
|
99
99
|
.qas-card {
|
|
100
|
+
&__content {
|
|
101
|
+
max-width: 100%;
|
|
102
|
+
}
|
|
103
|
+
|
|
100
104
|
&__router {
|
|
101
105
|
&:hover {
|
|
102
106
|
color: $primary;
|
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
import { Bar as BarChart, Doughnut as DoughnutChart, Line as LineChart } from 'vue-chartjs'
|
|
48
48
|
|
|
49
49
|
// Configurações padrões
|
|
50
|
-
import { charts, colors, font } from './config'
|
|
50
|
+
import { charts, colors as defaultColors, font } from './config'
|
|
51
51
|
|
|
52
52
|
// Plugins
|
|
53
53
|
import zoomPlugin from 'chartjs-plugin-zoom'
|
|
@@ -79,6 +79,11 @@ export default {
|
|
|
79
79
|
type: Function
|
|
80
80
|
},
|
|
81
81
|
|
|
82
|
+
colorsList: {
|
|
83
|
+
type: Array,
|
|
84
|
+
default: () => []
|
|
85
|
+
},
|
|
86
|
+
|
|
82
87
|
entity: {
|
|
83
88
|
required: true,
|
|
84
89
|
type: String
|
|
@@ -161,6 +166,7 @@ export default {
|
|
|
161
166
|
|
|
162
167
|
const [dataset] = this.data
|
|
163
168
|
const labels = this.getXAxisData(dataset.data.map(item => item.x))
|
|
169
|
+
const colors = this.colorsList.length ? this.colorsList : defaultColors
|
|
164
170
|
|
|
165
171
|
const datasets = this.data.map(({ label, data }, index) => {
|
|
166
172
|
const backgroundColor = this.isDoughnut ? colors : colors.at(index)
|
|
@@ -10,6 +10,12 @@ props:
|
|
|
10
10
|
type: Function
|
|
11
11
|
examples: ['beforeFetch({ payload, resolve, done })']
|
|
12
12
|
|
|
13
|
+
colors-list:
|
|
14
|
+
desc: Lista de cores personalizadas para utilizar nos gráficos
|
|
15
|
+
default: []
|
|
16
|
+
type: Array,
|
|
17
|
+
examples: ['#34B53A', '#016DD9', '#FFB200', '#F62D1B']
|
|
18
|
+
|
|
13
19
|
entity:
|
|
14
20
|
desc: Entidade da store, por exemplo se tiver que trabalhar com modulo de usuários, teremos o model "users" na store, que vai ser nossa "entity".
|
|
15
21
|
required: true
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="qas-expansion-item" :class="errorClasses">
|
|
3
|
+
<qas-box class="qas-expansion-item__box">
|
|
4
|
+
<q-expansion-item header-class="text-bold q-mt-sm q-pa-none" :label="props.label">
|
|
5
|
+
<template #header>
|
|
6
|
+
<slot name="header">
|
|
7
|
+
<div class="full-width">
|
|
8
|
+
<div class="items-center q-col-gutter-sm row">
|
|
9
|
+
<slot name="label">
|
|
10
|
+
<h5 class="col-auto text-h5 text-weight-medium">
|
|
11
|
+
{{ props.label }}
|
|
12
|
+
</h5>
|
|
13
|
+
</slot>
|
|
14
|
+
|
|
15
|
+
<div class="col-auto items-center q-col-gutter-sm row">
|
|
16
|
+
<div v-for="(badge, badgeIndex) in props.badges" :key="badgeIndex" class="col-auto">
|
|
17
|
+
<qas-badge v-bind="badge" />
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
</slot>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<q-separator class="q-my-md" />
|
|
26
|
+
|
|
27
|
+
<slot name="content">
|
|
28
|
+
<qas-grid-generator v-if="hasGridGenerator" v-bind="gridGeneratorProps" use-inline />
|
|
29
|
+
</slot>
|
|
30
|
+
</q-expansion-item>
|
|
31
|
+
</qas-box>
|
|
32
|
+
|
|
33
|
+
<div v-if="hasError" class="q-pt-sm qas-expansion-item__error-message text-caption text-negative">
|
|
34
|
+
{{ props.errorMessage }}
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
</template>
|
|
38
|
+
|
|
39
|
+
<script setup>
|
|
40
|
+
import { computed } from 'vue'
|
|
41
|
+
|
|
42
|
+
defineOptions({ name: 'QasExpansionItem' })
|
|
43
|
+
|
|
44
|
+
const props = defineProps({
|
|
45
|
+
badges: {
|
|
46
|
+
type: Array,
|
|
47
|
+
default: () => []
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
error: {
|
|
51
|
+
type: Boolean
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
errorMessage: {
|
|
55
|
+
type: String,
|
|
56
|
+
default: ''
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
label: {
|
|
60
|
+
type: String,
|
|
61
|
+
default: ''
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
gridGeneratorProps: {
|
|
65
|
+
type: Object,
|
|
66
|
+
default: () => ({})
|
|
67
|
+
}
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
const hasError = computed(() => props.error || !!props.errorMessage)
|
|
71
|
+
|
|
72
|
+
const errorClasses = computed(() => ({ 'qas-expansion-item--error': hasError.value }))
|
|
73
|
+
|
|
74
|
+
const hasGridGenerator = computed(() => !!Object.keys(props.gridGeneratorProps).length)
|
|
75
|
+
</script>
|
|
76
|
+
|
|
77
|
+
<style lang="scss">
|
|
78
|
+
.qas-expansion-item {
|
|
79
|
+
$root: &;
|
|
80
|
+
|
|
81
|
+
&--error {
|
|
82
|
+
#{$root}__box {
|
|
83
|
+
border: 2px solid $negative;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
#{$root}__error-message {
|
|
87
|
+
padding-left: 12px; // espaçamento igual ao de erro do quasar.
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.q-item {
|
|
92
|
+
margin-top: 0;
|
|
93
|
+
min-height: auto;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.q-item:hover {
|
|
97
|
+
color: initial !important;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
</style>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
type: component
|
|
2
|
+
|
|
3
|
+
meta:
|
|
4
|
+
desc: Componente de card expansivo, wrapper do QExpansionItem(https://quasar.dev/vue-components/expansion-item)
|
|
5
|
+
|
|
6
|
+
props:
|
|
7
|
+
badges:
|
|
8
|
+
desc: Lista de badges que serão exibidas na parte superior do card.
|
|
9
|
+
type: Array
|
|
10
|
+
|
|
11
|
+
error:
|
|
12
|
+
desc: Booleano que caso seja true o card passa a ter uma borda vermelha.
|
|
13
|
+
type: Boolean
|
|
14
|
+
|
|
15
|
+
error-message:
|
|
16
|
+
desc: Mensagem de erro onde será exibida na parte inferior do card.
|
|
17
|
+
type: String
|
|
18
|
+
|
|
19
|
+
label:
|
|
20
|
+
desc: Titulo exibido na parte superior do card.
|
|
21
|
+
type: String
|
|
22
|
+
|
|
23
|
+
grid-generator-props:
|
|
24
|
+
desc: Propriedades que serão repassadas para o QasGridGenerator.
|
|
25
|
+
type: Object
|
|
26
|
+
|
|
27
|
+
slots:
|
|
28
|
+
header:
|
|
29
|
+
desc: 'Slot para substituir o conteúdo do header'
|
|
30
|
+
|
|
31
|
+
label:
|
|
32
|
+
desc: 'Slot para substituir o conteúdo da label do header.'
|
|
33
|
+
|
|
34
|
+
content:
|
|
35
|
+
desc: 'Slot para substituir o conteúdo principal do card.'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<div :class="fieldsetClasses">
|
|
3
3
|
<div v-for="(fieldsetItem, fieldsetItemKey) in normalizedFields" :key="fieldsetItemKey" class="full-width">
|
|
4
4
|
<slot v-if="fieldsetItem.label" :name="`legend-${fieldsetItemKey}`">
|
|
5
|
-
<qas-label :label="fieldsetItem.label" />
|
|
5
|
+
<qas-label :label="fieldsetItem.label" :margin="getLabelMargin(fieldsetItem)" />
|
|
6
6
|
<div v-if="fieldsetItem.description" class="q-mb-md text-body1 text-grey-8">{{ fieldsetItem.description }}</div>
|
|
7
7
|
</slot>
|
|
8
8
|
|
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
</template>
|
|
27
27
|
|
|
28
28
|
<script setup>
|
|
29
|
-
import
|
|
29
|
+
import { gutterValidator } from '../../helpers/private/gutter-validator'
|
|
30
|
+
import useGenerator, { baseProps } from '../../composables/private/use-generator'
|
|
30
31
|
import { Spacing } from '../../enums/Spacing'
|
|
31
32
|
import { computed } from 'vue'
|
|
32
33
|
|
|
@@ -179,4 +180,8 @@ function useFieldset ({ props }) {
|
|
|
179
180
|
hasFieldset
|
|
180
181
|
}
|
|
181
182
|
}
|
|
183
|
+
|
|
184
|
+
function getLabelMargin (fieldsetItem) {
|
|
185
|
+
return fieldsetItem.description ? 'sm' : 'md'
|
|
186
|
+
}
|
|
182
187
|
</script>
|
|
@@ -8,7 +8,7 @@ props:
|
|
|
8
8
|
desc: Colunas do grid de cada campo.
|
|
9
9
|
default: col-6
|
|
10
10
|
type: [Array, String, Object]
|
|
11
|
-
examples: ["[{ sm: 6, md: 12 }]", "{ name: { sm: 6, md: 12 } }", "12"]
|
|
11
|
+
examples: ["[{ sm: 6, md: 12 }]", "{ name: { sm: 6, md: 12 } }", "12", "{ sm: 6, md: 12 }"]
|
|
12
12
|
|
|
13
13
|
disable:
|
|
14
14
|
desc: Deixa os campos desabilitados enviando a prop "disable" para cada campo.
|
|
@@ -42,13 +42,13 @@ props:
|
|
|
42
42
|
desc: Espaçamento entre rótulos (label).
|
|
43
43
|
default: lg
|
|
44
44
|
type: [String, Boolean]
|
|
45
|
-
examples: [xs, sm, md, lg, xl, false]
|
|
45
|
+
examples: [xs, sm, md, lg, xl, '2xl', '3xl', '4xl', '5xl', false]
|
|
46
46
|
|
|
47
47
|
gutter:
|
|
48
48
|
desc: Espaçamento entre colunas.
|
|
49
49
|
default: lg
|
|
50
50
|
type: [String, Boolean]
|
|
51
|
-
examples: [xs, sm, md, lg, xl, false]
|
|
51
|
+
examples: [xs, sm, md, lg, xl, '2xl', '3xl', '4xl', '5xl', false]
|
|
52
52
|
|
|
53
53
|
model-value:
|
|
54
54
|
desc: Model do componente, usado para o v-model.
|
|
@@ -63,6 +63,9 @@ props:
|
|
|
63
63
|
default: []
|
|
64
64
|
type: Array
|
|
65
65
|
|
|
66
|
+
use-common-columns:
|
|
67
|
+
desc: Utilizado quando passar a estrutura da prop "columns" sendo um objeto onde seus breakpoints serão replicados para todos fields.
|
|
68
|
+
|
|
66
69
|
slots:
|
|
67
70
|
'field-[nome-da-chave]':
|
|
68
71
|
desc: Acessa o slot de um campo especifico.
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div :class="classes">
|
|
3
|
-
<div v-for="(field, key) in fieldsByResult" :key="key" :class="
|
|
3
|
+
<div v-for="(field, key) in fieldsByResult" :key="key" :class="getContainerClass({ key })">
|
|
4
4
|
<slot :field="field" :name="`field-${field.name}`">
|
|
5
5
|
<slot :field="field" name="header">
|
|
6
|
-
<header :class="
|
|
6
|
+
<header :class="headerClass" :data-cy="`grid-generator-${field.name}-field`" :title="getTitle(field, 'label')">
|
|
7
7
|
{{ field.label }}
|
|
8
8
|
</header>
|
|
9
9
|
</slot>
|
|
10
10
|
|
|
11
11
|
<slot :field="field" name="content">
|
|
12
|
-
<div :class="
|
|
12
|
+
<div :class="contentClass" :data-cy="`grid-generator-${field.name}-result`" :title="getTitle(field, 'formattedResult')">
|
|
13
13
|
{{ field.formattedResult }}
|
|
14
14
|
</div>
|
|
15
15
|
</slot>
|
|
@@ -21,12 +21,15 @@
|
|
|
21
21
|
<script setup>
|
|
22
22
|
import useGenerator, { baseProps } from '../../composables/private/use-generator'
|
|
23
23
|
import { isEmpty, humanize } from '../../helpers'
|
|
24
|
+
import { useScreen } from '../../composables'
|
|
24
25
|
import { isObject } from 'lodash-es'
|
|
25
26
|
import { ref, computed, watch } from 'vue'
|
|
26
27
|
|
|
27
28
|
// define component name
|
|
28
29
|
defineOptions({ name: 'QasGridGenerator' })
|
|
29
30
|
|
|
31
|
+
const screen = useScreen()
|
|
32
|
+
|
|
30
33
|
// props
|
|
31
34
|
const props = defineProps({
|
|
32
35
|
...baseProps,
|
|
@@ -37,7 +40,7 @@ const props = defineProps({
|
|
|
37
40
|
},
|
|
38
41
|
|
|
39
42
|
headerClass: {
|
|
40
|
-
default: '
|
|
43
|
+
default: '',
|
|
41
44
|
type: [Array, Object, String]
|
|
42
45
|
},
|
|
43
46
|
|
|
@@ -54,16 +57,52 @@ const props = defineProps({
|
|
|
54
57
|
useEmptyResult: {
|
|
55
58
|
default: true,
|
|
56
59
|
type: Boolean
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
useEllipsis: {
|
|
63
|
+
default: true,
|
|
64
|
+
type: Boolean
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
useInline: {
|
|
68
|
+
type: Boolean
|
|
57
69
|
}
|
|
58
70
|
})
|
|
59
71
|
|
|
60
72
|
// composables
|
|
61
|
-
const { classes, getFieldClass } = useGenerator({ props })
|
|
73
|
+
const { classes: useGeneratorClasses, getFieldClass } = useGenerator({ props })
|
|
62
74
|
|
|
63
75
|
// computed
|
|
64
76
|
const hasResult = computed(() => Object.keys(props.result).length)
|
|
65
77
|
const hasFields = computed(() => Object.keys(props.fields).length)
|
|
66
78
|
|
|
79
|
+
const contentClass = computed(() => {
|
|
80
|
+
return [
|
|
81
|
+
props.contentClass,
|
|
82
|
+
|
|
83
|
+
{
|
|
84
|
+
ellipsis: !screen.isSmall && props.useEllipsis
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
const headerClass = computed(() => {
|
|
90
|
+
return [
|
|
91
|
+
props.headerClass,
|
|
92
|
+
|
|
93
|
+
{
|
|
94
|
+
ellipsis: !screen.isSmall && props.useEllipsis,
|
|
95
|
+
'text-bold': screen.isSmall || !props.useInline
|
|
96
|
+
}
|
|
97
|
+
]
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
const classes = computed(() => {
|
|
101
|
+
if (props.useInline) return 'row q-col-gutter-md'
|
|
102
|
+
|
|
103
|
+
return useGeneratorClasses.value
|
|
104
|
+
})
|
|
105
|
+
|
|
67
106
|
const fieldsByResult = ref({})
|
|
68
107
|
|
|
69
108
|
/**
|
|
@@ -122,4 +161,16 @@ function getFieldsByResult () {
|
|
|
122
161
|
function setFieldsByResult () {
|
|
123
162
|
fieldsByResult.value = getFieldsByResult()
|
|
124
163
|
}
|
|
164
|
+
|
|
165
|
+
function getContainerClass ({ key }) {
|
|
166
|
+
if (props.useInline) {
|
|
167
|
+
return 'row justify-between col-12'
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
return getFieldClass({ index: key, isGridGenerator: true })
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function getTitle (field, key) {
|
|
174
|
+
return props.useEllipsis ? field[key] : ''
|
|
175
|
+
}
|
|
125
176
|
</script>
|
|
@@ -8,7 +8,7 @@ props:
|
|
|
8
8
|
desc: Colunas do grid de cada campo.
|
|
9
9
|
default: col-6
|
|
10
10
|
type: [Array, String, Object]
|
|
11
|
-
examples: ["{ name: { sm: 6, md: 12 } }", "[{ sm: 6, md: 12 }]"]
|
|
11
|
+
examples: ["{ name: { sm: 6, md: 12 } }", "[{ sm: 6, md: 12 }]", "{ sm: 6, md: 12 }"]
|
|
12
12
|
|
|
13
13
|
content-class:
|
|
14
14
|
desc: Classe de cada "div" pai referente ao resultado.
|
|
@@ -30,7 +30,7 @@ props:
|
|
|
30
30
|
desc: Espaçamento entre colunas.
|
|
31
31
|
default: lg
|
|
32
32
|
type: String
|
|
33
|
-
examples: [xs, sm, md, lg, xl]
|
|
33
|
+
examples: [xs, sm, md, lg, xl, 2xl, 3xl, 4xl, 5xl]
|
|
34
34
|
|
|
35
35
|
header-class:
|
|
36
36
|
desc: Classe de cada "header" pai referente ao "label".
|
|
@@ -48,6 +48,18 @@ props:
|
|
|
48
48
|
default: true
|
|
49
49
|
type: Boolean
|
|
50
50
|
|
|
51
|
+
use-ellipsis:
|
|
52
|
+
desc: Adiciona a classe "ellipsis" para o elemento do conteúdo.
|
|
53
|
+
default: true
|
|
54
|
+
type: Boolean
|
|
55
|
+
|
|
56
|
+
use-inline:
|
|
57
|
+
desc: Adiciona a disposição dos campos por linha, ou seja, header e content ocupando a linha toda.
|
|
58
|
+
type: Boolean
|
|
59
|
+
|
|
60
|
+
use-common-columns:
|
|
61
|
+
desc: Usado quando precisa passar a prop "columns" como objeto sendo que será o valor comum para todos fields
|
|
62
|
+
|
|
51
63
|
slots:
|
|
52
64
|
content:
|
|
53
65
|
desc: Slot para o conteúdo (content).
|
|
@@ -78,7 +78,7 @@ props:
|
|
|
78
78
|
desc: Espaçamento entre colunas do formulário.
|
|
79
79
|
default: lg
|
|
80
80
|
type: [String, Boolean]
|
|
81
|
-
examples: [xs, sm, md, lg, xl, false]
|
|
81
|
+
examples: [xs, sm, md, lg, xl, 2xl, 3xl, 4xl, 5xl, false]
|
|
82
82
|
|
|
83
83
|
identifier-item-key:
|
|
84
84
|
desc: Define um identificador para o item. O identificador será utilizado para validar exclusão do item, por exemplo.
|