@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
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<q-dialog ref="
|
|
2
|
+
<q-dialog ref="dialogRef" class="qas-dialog" data-cy="dialog" :persistent="persistent" v-bind="dialogProps" @update:model-value="updateModelValue">
|
|
3
3
|
<div class="bg-white q-pa-lg" :style="style">
|
|
4
4
|
<header v-if="hasHeader" class="q-mb-lg">
|
|
5
5
|
<slot name="header">
|
|
6
6
|
<div class="items-center justify-between row">
|
|
7
|
-
<h5 class="text-
|
|
7
|
+
<h5 class="text-h5" data-cy="dialog-title">{{ card.title }}</h5>
|
|
8
8
|
|
|
9
|
-
<qas-btn v-if="isInfoDialog" v-close-popup color="grey-
|
|
9
|
+
<qas-btn v-if="isInfoDialog" v-close-popup color="grey-10" data-cy="dialog-close-btn" icon="sym_r_close" variant="tertiary" />
|
|
10
10
|
</div>
|
|
11
11
|
</slot>
|
|
12
12
|
</header>
|
|
13
13
|
|
|
14
14
|
<section class="text-body1 text-grey-8">
|
|
15
|
-
<component :is="
|
|
15
|
+
<component :is="mainComponent.is" ref="form" v-bind="mainComponent.props">
|
|
16
16
|
<slot name="description">
|
|
17
|
-
<component :is="
|
|
17
|
+
<component :is="descriptionComponent" data-cy="dialog-description">{{ card.description }}</component>
|
|
18
18
|
</slot>
|
|
19
19
|
|
|
20
20
|
<div v-if="!isInfoDialog">
|
|
21
21
|
<slot name="actions">
|
|
22
|
-
<qas-actions v-bind="
|
|
22
|
+
<qas-actions v-bind="defaultActionsProps">
|
|
23
23
|
<template v-if="hasOk" #primary>
|
|
24
24
|
<qas-btn v-close-popup="!useForm" class="full-width" data-cy="dialog-ok-btn" variant="primary" v-bind="defaultOk" />
|
|
25
25
|
</template>
|
|
@@ -36,254 +36,145 @@
|
|
|
36
36
|
</q-dialog>
|
|
37
37
|
</template>
|
|
38
38
|
|
|
39
|
-
<script>
|
|
40
|
-
import QasBtn from '../btn/QasBtn.vue'
|
|
39
|
+
<script setup>
|
|
41
40
|
import QasActions from '../actions/QasActions.vue'
|
|
41
|
+
import QasBtn from '../btn/QasBtn.vue'
|
|
42
|
+
|
|
43
|
+
import useCancel from './composables/use-cancel'
|
|
44
|
+
import useDynamicComponents from './composables/use-dynamic-components'
|
|
45
|
+
import useOk from './composables/use-ok'
|
|
46
|
+
import { useScreen } from '../../composables'
|
|
42
47
|
|
|
43
|
-
|
|
44
|
-
|
|
48
|
+
import { computed, ref, useAttrs, useSlots } from 'vue'
|
|
49
|
+
import { useDialogPluginComponent } from 'quasar'
|
|
50
|
+
|
|
51
|
+
defineOptions({ name: 'QasDialog' })
|
|
52
|
+
|
|
53
|
+
const props = defineProps({
|
|
54
|
+
actionsProps: {
|
|
55
|
+
default: () => ({}),
|
|
56
|
+
type: Object
|
|
57
|
+
},
|
|
45
58
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
59
|
+
cancel: {
|
|
60
|
+
default: () => ({}),
|
|
61
|
+
type: [Object, Boolean]
|
|
49
62
|
},
|
|
50
63
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
type: Object
|
|
55
|
-
},
|
|
56
|
-
|
|
57
|
-
cancel: {
|
|
58
|
-
default: () => ({}),
|
|
59
|
-
type: [Object, Boolean]
|
|
60
|
-
},
|
|
61
|
-
|
|
62
|
-
card: {
|
|
63
|
-
default: () => ({}),
|
|
64
|
-
type: Object
|
|
65
|
-
},
|
|
66
|
-
|
|
67
|
-
maxWidth: {
|
|
68
|
-
default: '',
|
|
69
|
-
type: String
|
|
70
|
-
},
|
|
71
|
-
|
|
72
|
-
minWidth: {
|
|
73
|
-
default: '',
|
|
74
|
-
type: String
|
|
75
|
-
},
|
|
76
|
-
|
|
77
|
-
ok: {
|
|
78
|
-
default: () => ({}),
|
|
79
|
-
type: [Object, Boolean]
|
|
80
|
-
},
|
|
81
|
-
|
|
82
|
-
persistent: {
|
|
83
|
-
default: true,
|
|
84
|
-
type: Boolean
|
|
85
|
-
},
|
|
86
|
-
|
|
87
|
-
useForm: {
|
|
88
|
-
type: Boolean
|
|
89
|
-
},
|
|
90
|
-
|
|
91
|
-
modelValue: {
|
|
92
|
-
type: Boolean
|
|
93
|
-
},
|
|
94
|
-
|
|
95
|
-
usePlugin: {
|
|
96
|
-
type: Boolean
|
|
97
|
-
},
|
|
98
|
-
|
|
99
|
-
useFullMaxWidth: {
|
|
100
|
-
type: Boolean
|
|
101
|
-
},
|
|
102
|
-
|
|
103
|
-
useValidationAllAtOnce: {
|
|
104
|
-
type: Boolean
|
|
105
|
-
}
|
|
64
|
+
card: {
|
|
65
|
+
default: () => ({}),
|
|
66
|
+
type: Object
|
|
106
67
|
},
|
|
107
68
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
// actions
|
|
113
|
-
'validate',
|
|
114
|
-
'ok',
|
|
115
|
-
'cancel'
|
|
116
|
-
],
|
|
117
|
-
|
|
118
|
-
computed: {
|
|
119
|
-
defaultCancel () {
|
|
120
|
-
return {
|
|
121
|
-
label: 'Cancelar',
|
|
122
|
-
outline: true,
|
|
123
|
-
|
|
124
|
-
...this.cancel,
|
|
125
|
-
|
|
126
|
-
onClick: this.onCancel
|
|
127
|
-
}
|
|
128
|
-
},
|
|
129
|
-
|
|
130
|
-
defaultOk () {
|
|
131
|
-
const { onClick, ...attrs } = this.ok
|
|
132
|
-
|
|
133
|
-
return {
|
|
134
|
-
label: 'Ok',
|
|
135
|
-
type: this.ok?.type || this.useForm ? 'submit' : 'button',
|
|
136
|
-
|
|
137
|
-
...attrs,
|
|
138
|
-
|
|
139
|
-
// adiciona somente se não estiver usando useForm pois o controle ficará no submit.
|
|
140
|
-
...(!this.useForm && { onClick: this.onOk })
|
|
141
|
-
}
|
|
142
|
-
},
|
|
143
|
-
|
|
144
|
-
style () {
|
|
145
|
-
return {
|
|
146
|
-
...(this.useFullMaxWidth && { width: '100%' }),
|
|
147
|
-
maxWidth: this.maxWidth || '470px',
|
|
148
|
-
minWidth: this.minWidth || (this.$qas.screen.isSmall ? '' : '366px')
|
|
149
|
-
}
|
|
150
|
-
},
|
|
151
|
-
|
|
152
|
-
componentTag () {
|
|
153
|
-
return this.useForm ? 'q-form' : 'div'
|
|
154
|
-
},
|
|
155
|
-
|
|
156
|
-
componentProps () {
|
|
157
|
-
/**
|
|
158
|
-
* adiciona evento de submit caso useForm seja true,
|
|
159
|
-
* uma vez que somente o q-form possui este evento.
|
|
160
|
-
*/
|
|
161
|
-
return {
|
|
162
|
-
...(this.useForm && { onSubmit: this.onSubmit })
|
|
163
|
-
}
|
|
164
|
-
},
|
|
165
|
-
|
|
166
|
-
dialogProps () {
|
|
167
|
-
return {
|
|
168
|
-
...(!this.usePlugin && { modelValue: this.modelValue }),
|
|
169
|
-
...this.$attrs
|
|
170
|
-
}
|
|
171
|
-
},
|
|
172
|
-
|
|
173
|
-
hasOk () {
|
|
174
|
-
return typeof this.ok === 'boolean' ? this.ok : !!Object.keys(this.ok)
|
|
175
|
-
},
|
|
176
|
-
|
|
177
|
-
hasCancel () {
|
|
178
|
-
return typeof this.cancel === 'boolean' ? this.cancel : !!Object.keys(this.cancel)
|
|
179
|
-
},
|
|
180
|
-
|
|
181
|
-
hasAllActions () {
|
|
182
|
-
return this.hasOk && this.hasCancel
|
|
183
|
-
},
|
|
184
|
-
|
|
185
|
-
hasSingleAction () {
|
|
186
|
-
return (this.hasOk && !this.hasCancel) || (!this.hasOk && this.hasCancel)
|
|
187
|
-
},
|
|
188
|
-
|
|
189
|
-
hasHeaderSlot () {
|
|
190
|
-
return !!this.$slots.header
|
|
191
|
-
},
|
|
192
|
-
|
|
193
|
-
hasHeader () {
|
|
194
|
-
return this.hasHeaderSlot || this.card.title
|
|
195
|
-
},
|
|
196
|
-
|
|
197
|
-
isInfoDialog () {
|
|
198
|
-
return !this.hasOk && !this.hasCancel
|
|
199
|
-
},
|
|
200
|
-
|
|
201
|
-
formattedActionsProps () {
|
|
202
|
-
const { useFullWidth, useEqualWidth } = this.actionsProps
|
|
203
|
-
|
|
204
|
-
if (useFullWidth || useEqualWidth) {
|
|
205
|
-
return this.actionsProps
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
return {
|
|
209
|
-
useFullWidth: this.hasSingleAction,
|
|
210
|
-
useEqualWidth: this.hasAllActions,
|
|
211
|
-
...this.actionsProps
|
|
212
|
-
}
|
|
213
|
-
},
|
|
214
|
-
|
|
215
|
-
hasRenderFunction () {
|
|
216
|
-
const description = this.card.description
|
|
217
|
-
|
|
218
|
-
return typeof description === 'object' && description !== null && !Array.isArray(description)
|
|
219
|
-
},
|
|
220
|
-
|
|
221
|
-
descriptionComponentTag () {
|
|
222
|
-
return this.hasRenderFunction ? this.card.description : 'div'
|
|
223
|
-
}
|
|
69
|
+
maxWidth: {
|
|
70
|
+
default: '',
|
|
71
|
+
type: String
|
|
224
72
|
},
|
|
225
73
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
74
|
+
minWidth: {
|
|
75
|
+
default: '',
|
|
76
|
+
type: String
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
ok: {
|
|
80
|
+
default: () => ({}),
|
|
81
|
+
type: [Object, Boolean]
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
persistent: {
|
|
85
|
+
default: true,
|
|
86
|
+
type: Boolean
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
useForm: {
|
|
90
|
+
type: Boolean
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
modelValue: {
|
|
94
|
+
type: Boolean
|
|
95
|
+
},
|
|
96
|
+
|
|
97
|
+
usePlugin: {
|
|
98
|
+
type: Boolean
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
useFullMaxWidth: {
|
|
102
|
+
type: Boolean
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
useValidationAllAtOnce: {
|
|
106
|
+
type: Boolean
|
|
107
|
+
}
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
const emits = defineEmits([
|
|
111
|
+
// model
|
|
112
|
+
'update:modelValue',
|
|
113
|
+
|
|
114
|
+
// actions
|
|
115
|
+
'cancel',
|
|
116
|
+
'ok',
|
|
117
|
+
'validate',
|
|
118
|
+
|
|
119
|
+
// eventos do plugin
|
|
120
|
+
...useDialogPluginComponent.emits
|
|
121
|
+
])
|
|
122
|
+
|
|
123
|
+
const attrs = useAttrs()
|
|
124
|
+
const screen = useScreen()
|
|
125
|
+
const slots = useSlots()
|
|
126
|
+
|
|
127
|
+
// usado para o plugin
|
|
128
|
+
const { dialogRef, onDialogHide } = useDialogPluginComponent()
|
|
129
|
+
|
|
130
|
+
// QForm template
|
|
131
|
+
const form = ref(null)
|
|
132
|
+
|
|
133
|
+
const composablesParams = { emits, form, props, screen, slots }
|
|
134
|
+
|
|
135
|
+
const { defaultCancel, hasCancel } = useCancel(composablesParams)
|
|
136
|
+
const { defaultOk, hasOk, onOk } = useOk(composablesParams)
|
|
137
|
+
const { descriptionComponent, mainComponent } = useDynamicComponents({ ...composablesParams, onOk, hasOk })
|
|
138
|
+
|
|
139
|
+
const dialogProps = computed(() => {
|
|
140
|
+
return {
|
|
141
|
+
...(!props.usePlugin && { modelValue: props.modelValue }),
|
|
142
|
+
...attrs,
|
|
143
|
+
|
|
144
|
+
onHide: onDialogHide
|
|
286
145
|
}
|
|
146
|
+
})
|
|
147
|
+
|
|
148
|
+
const style = computed(() => {
|
|
149
|
+
return {
|
|
150
|
+
...(props.useFullMaxWidth && { width: '100%' }),
|
|
151
|
+
|
|
152
|
+
maxWidth: props.maxWidth || '470px',
|
|
153
|
+
minWidth: props.minWidth || (screen.isSmall ? '' : '366px')
|
|
154
|
+
}
|
|
155
|
+
})
|
|
156
|
+
|
|
157
|
+
const hasHeader = computed(() => !!slots.header || props.card.title)
|
|
158
|
+
const isInfoDialog = computed(() => !hasOk.value && !hasCancel.value)
|
|
159
|
+
|
|
160
|
+
const defaultActionsProps = computed(() => {
|
|
161
|
+
const { useFullWidth, useEqualWidth } = props.actionsProps
|
|
162
|
+
|
|
163
|
+
if (useFullWidth || useEqualWidth) return props.actionsProps
|
|
164
|
+
|
|
165
|
+
const hasAllActions = hasOk.value && hasCancel.value
|
|
166
|
+
const hasSingleAction = (hasOk.value && !hasCancel.value) || (!hasOk.value && hasCancel.value)
|
|
167
|
+
|
|
168
|
+
return {
|
|
169
|
+
useFullWidth: hasSingleAction,
|
|
170
|
+
useEqualWidth: hasAllActions,
|
|
171
|
+
|
|
172
|
+
...props.actionsProps
|
|
173
|
+
}
|
|
174
|
+
})
|
|
175
|
+
|
|
176
|
+
function updateModelValue (value) {
|
|
177
|
+
emits('update:modelValue', value)
|
|
287
178
|
}
|
|
288
179
|
</script>
|
|
289
180
|
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { computed } from 'vue'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @param {{
|
|
5
|
+
* props: { cancel: object },
|
|
6
|
+
* emits: (event: 'cancel') => void
|
|
7
|
+
* }} config
|
|
8
|
+
*/
|
|
9
|
+
export default function useCancel (config = {}) {
|
|
10
|
+
const {
|
|
11
|
+
props,
|
|
12
|
+
emits
|
|
13
|
+
} = config
|
|
14
|
+
|
|
15
|
+
const defaultCancel = computed(() => {
|
|
16
|
+
return {
|
|
17
|
+
label: 'Cancelar',
|
|
18
|
+
outline: true,
|
|
19
|
+
|
|
20
|
+
...props.cancel,
|
|
21
|
+
|
|
22
|
+
onClick: onCancel
|
|
23
|
+
}
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
const hasCancel = computed(() => {
|
|
27
|
+
return typeof props.cancel === 'boolean' ? props.cancel : !!Object.keys(props.cancel)
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
function onCancel () {
|
|
31
|
+
props.cancel.onClick?.()
|
|
32
|
+
|
|
33
|
+
emits('cancel')
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return {
|
|
37
|
+
defaultCancel,
|
|
38
|
+
hasCancel
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { computed } from 'vue'
|
|
2
|
+
import { QForm } from 'quasar'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @param {{
|
|
6
|
+
* props: { card: object, useForm: boolean, useValidationAllAtOnce: boolean },
|
|
7
|
+
* form: import('vue').Ref<HTMLInputElement | null>,
|
|
8
|
+
* hasOk: import('vue').ComputedRef<boolean>,
|
|
9
|
+
* emits: (event: 'validate', payload: Promise<boolean> | boolean) => void,
|
|
10
|
+
* onOk: Function
|
|
11
|
+
* }} config
|
|
12
|
+
*/
|
|
13
|
+
export default function useDynamicComponents (config = {}) {
|
|
14
|
+
const {
|
|
15
|
+
props,
|
|
16
|
+
form,
|
|
17
|
+
hasOk,
|
|
18
|
+
|
|
19
|
+
onOk = () => {},
|
|
20
|
+
emits
|
|
21
|
+
} = config
|
|
22
|
+
|
|
23
|
+
const mainComponent = computed(() => {
|
|
24
|
+
return {
|
|
25
|
+
is: props.useForm ? QForm : 'div',
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* adiciona evento de submit caso useForm seja true,
|
|
29
|
+
* uma vez que somente o q-form possui este evento.
|
|
30
|
+
*/
|
|
31
|
+
props: {
|
|
32
|
+
...(props.useForm && { onSubmit })
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
const hasRenderFunction = computed(() => {
|
|
38
|
+
const description = props.card.description
|
|
39
|
+
|
|
40
|
+
return typeof description === 'object' && description !== null && !Array.isArray(description)
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
const descriptionComponent = computed(() => hasRenderFunction.value ? props.card.description : 'div')
|
|
44
|
+
|
|
45
|
+
// métodos
|
|
46
|
+
function submitHandler () {
|
|
47
|
+
if (!props.useForm) return
|
|
48
|
+
|
|
49
|
+
if (props.useValidationAllAtOnce) {
|
|
50
|
+
let isAllComponentValid = true
|
|
51
|
+
const components = form.value.getValidationComponents() || []
|
|
52
|
+
|
|
53
|
+
for (const component of components) {
|
|
54
|
+
const isValid = component?.validate?.()
|
|
55
|
+
|
|
56
|
+
if (!isValid) {
|
|
57
|
+
isAllComponentValid = false
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
emits('validate', isAllComponentValid)
|
|
62
|
+
|
|
63
|
+
return
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
emits('validate', form.value.validate())
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Sem este método, ao clicar enter com a prop useForm ativada a tela era recarregada,
|
|
71
|
+
* e a ação de click do botão não era chamada pois ele não esta dentro do form.
|
|
72
|
+
*/
|
|
73
|
+
function onSubmit (event) {
|
|
74
|
+
event.preventDefault()
|
|
75
|
+
|
|
76
|
+
if (hasOk.value) {
|
|
77
|
+
onOk()
|
|
78
|
+
submitHandler()
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return {
|
|
83
|
+
mainComponent,
|
|
84
|
+
descriptionComponent
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { computed } from 'vue'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @param {{
|
|
5
|
+
* props: { ok: object, useForm: boolean },
|
|
6
|
+
* emits: (event: 'ok') => void
|
|
7
|
+
* }} config
|
|
8
|
+
*/
|
|
9
|
+
export default function useOk (config = {}) {
|
|
10
|
+
const {
|
|
11
|
+
props,
|
|
12
|
+
emits
|
|
13
|
+
} = config
|
|
14
|
+
|
|
15
|
+
const defaultOk = computed(() => {
|
|
16
|
+
const { onClick, ...attrs } = props.ok
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
label: 'Ok',
|
|
20
|
+
type: (props.ok?.type || props.useForm) ? 'submit' : 'button',
|
|
21
|
+
|
|
22
|
+
...attrs,
|
|
23
|
+
|
|
24
|
+
// adiciona somente se não estiver usando useForm pois o controle ficará no submit.
|
|
25
|
+
...(!props.useForm && { onClick: onOk })
|
|
26
|
+
}
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
const hasOk = computed(() => {
|
|
30
|
+
return typeof props.ok === 'boolean' ? props.ok : !!Object.keys(props.ok)
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
function onOk () {
|
|
34
|
+
props.ok.onClick?.()
|
|
35
|
+
|
|
36
|
+
emits('ok')
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
defaultOk,
|
|
41
|
+
hasOk,
|
|
42
|
+
|
|
43
|
+
onOk
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -44,8 +44,8 @@ export default {
|
|
|
44
44
|
props: {
|
|
45
45
|
color: {
|
|
46
46
|
type: String,
|
|
47
|
-
default: 'grey-
|
|
48
|
-
validator: value => ['grey-
|
|
47
|
+
default: 'grey-10',
|
|
48
|
+
validator: value => ['grey-10', 'primary', 'white'].includes(value)
|
|
49
49
|
},
|
|
50
50
|
|
|
51
51
|
error: {
|
|
@@ -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: ["{
|
|
11
|
+
examples: ["[{ sm: 6, md: 12 }]", "{ name: { sm: 6, md: 12 } }", "12"]
|
|
12
12
|
|
|
13
13
|
disable:
|
|
14
14
|
desc: Deixa os campos desabilitados enviando a prop "disable" para cada campo.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<qas-dialog v-model="model" :cancel="false" class="q-pa-xl" max-width="1100px" :ok="false" :persistent="false" use-full-max-width>
|
|
4
4
|
<template #header>
|
|
5
5
|
<div class="text-right">
|
|
6
|
-
<qas-btn v-close-popup color="grey-
|
|
6
|
+
<qas-btn v-close-popup color="grey-10" icon="sym_r_close" variant="tertiary" @click="close" />
|
|
7
7
|
</div>
|
|
8
8
|
</template>
|
|
9
9
|
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<q-carousel v-model="imageIndexModel" animated :arrows="!$qas.screen.isSmall" class="pv-gallery-carousel-dialog__carousel" control-text-color="primary" data-cy="gallery-carousel" :fullscreen="$qas.screen.isSmall" :height="carouselImageHeight" next-icon="sym_r_chevron_right" prev-icon="sym_r_chevron_left" swipeable :thumbnails="!isSingleImage">
|
|
12
12
|
<q-carousel-slide v-for="(image, index) in images" :key="index" class="bg-no-repeat bg-size-contain" :data-cy="`gallery-carousel-slide-${index}`" :img-src="image.url" :name="index">
|
|
13
13
|
<div v-if="$qas.screen.isSmall" class="full-width justify-end row">
|
|
14
|
-
<qas-btn color="grey-
|
|
14
|
+
<qas-btn color="grey-10" icon="sym_r_close" variant="tertiary" @click="close" />
|
|
15
15
|
</div>
|
|
16
16
|
</q-carousel-slide>
|
|
17
17
|
</q-carousel>
|
|
@@ -129,7 +129,7 @@ export default {
|
|
|
129
129
|
return {
|
|
130
130
|
'justify-between': this.card.name,
|
|
131
131
|
'justify-right': !this.card.name,
|
|
132
|
-
'text-grey-
|
|
132
|
+
'text-grey-10': !this.disable,
|
|
133
133
|
'q-mb-md': this.hasActions || this.card.name
|
|
134
134
|
}
|
|
135
135
|
},
|
|
@@ -142,7 +142,7 @@ export default {
|
|
|
142
142
|
'full-width',
|
|
143
143
|
'items-center',
|
|
144
144
|
'justify-center',
|
|
145
|
-
'text-grey-
|
|
145
|
+
'text-grey-10',
|
|
146
146
|
'text-subtitle2'
|
|
147
147
|
]
|
|
148
148
|
}
|