@bildvitta/quasar-ui-asteroid 3.20.0-beta.13 → 3.20.0-beta.14-alpha.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bildvitta/quasar-ui-asteroid",
3
3
  "description": "Asteroid",
4
- "version": "3.20.0-beta.13",
4
+ "version": "3.20.0-beta.14-alpha.0",
5
5
  "author": "Bild & Vitta <systemteam@bild.com.br>",
6
6
  "license": "MIT",
7
7
  "main": "./src/asteroid.js",
@@ -1,35 +1,23 @@
1
1
  <template>
2
- <q-dialog ref="dialogRef" class="qas-dialog" :class="classes" data-cy="dialog" v-bind="dialogProps" :persistent="props.persistent" @update:model-value="updateModelValue">
3
- <div class="bg-white q-pa-md" :style="style">
4
- <header v-if="hasHeader" class="q-mb-md">
5
- <slot name="header">
6
- <div class="items-center justify-between row">
7
- <qas-label data-cy="dialog-title" :label="props.card.title" margin="none" />
8
-
9
- <qas-btn v-if="isInfoDialog" v-close-popup color="grey-10" data-cy="dialog-close-btn" icon="sym_r_close" variant="tertiary" />
10
- </div>
11
- </slot>
2
+ <q-dialog ref="dialogRef" v-model="model" class="qas-dialog" :class="classes" data-cy="dialog" v-bind="dialogProps" @update:model-value="updateModelValue">
3
+ <div class="bg-white full-width q-pa-md qas-dialog__container" :style="containerStyles">
4
+ <header v-if="hasHeaderSlot" class="q-mb-md">
5
+ <slot name="header" />
12
6
  </header>
13
7
 
8
+ <qas-header v-else-if="props.title" v-bind="headerProps" />
9
+
14
10
  <section class="relative-position text-body1 text-grey-8">
15
11
  <component :is="mainComponent.is" ref="form" v-bind="mainComponent.props">
16
12
  <slot name="description">
17
- <component :is="descriptionComponent" data-cy="dialog-description">{{ props.card.description }}</component>
13
+ <div v-if="props.useHtmlDescription" data-cy="dialog-description" v-html="props.description" />
14
+
15
+ <component :is="descriptionComponent" v-else data-cy="dialog-description">
16
+ {{ props.description }}
17
+ </component>
18
18
  </slot>
19
19
 
20
- <div v-if="!isInfoDialog">
21
- <slot name="actions">
22
- <qas-actions v-bind="defaultActionsProps">
23
- <template v-if="hasOk" #primary>
24
- <qas-btn v-close-popup="!props.useForm" class="full-width" data-cy="dialog-ok-btn" size="lg" variant="primary" v-bind="defaultOk" />
25
- </template>
26
-
27
- <template v-if="hasCancel" #secondary>
28
- <qas-btn v-close-popup class="full-width" data-cy="dialog-cancel-btn" size="lg" v-bind="defaultCancel" variant="secondary" />
29
- </template>
30
- </qas-actions>
31
- </slot>
32
- </div>
20
+ <qas-actions v-if="hasActions" class="qas-dialog__actions" v-bind="defaultActionsProps" />
33
21
  </component>
34
22
  </section>
35
23
  </div>
@@ -38,23 +26,17 @@
38
26
 
39
27
  <script setup>
40
28
  import QasActions from '../actions/QasActions.vue'
41
- import QasBtn from '../btn/QasBtn.vue'
42
- import QasLabel from '../label/QasLabel.vue'
29
+ import QasHeader from '../header/QasHeader.vue'
43
30
 
44
- import useCancel from './composables/use-cancel'
45
- import useDynamicComponents from './composables/use-dynamic-components'
46
- import useOk from './composables/use-ok'
47
- import { useScreen } from '../../composables'
48
-
49
- import { computed, ref, useAttrs, useSlots, provide } from 'vue'
50
- import { useDialogPluginComponent } from 'quasar'
31
+ import { computed, ref, useAttrs, provide, useSlots, inject } from 'vue'
32
+ import { useDialogPluginComponent, QForm } from 'quasar'
51
33
 
52
34
  defineOptions({ name: 'QasDialog' })
53
35
 
54
36
  const props = defineProps({
55
- actionsProps: {
56
- default: () => ({}),
57
- type: Object
37
+ badges: {
38
+ default: () => [],
39
+ type: [Array, Object]
58
40
  },
59
41
 
60
42
  cancel: {
@@ -62,19 +44,13 @@ const props = defineProps({
62
44
  type: [Object, Boolean]
63
45
  },
64
46
 
65
- card: {
66
- default: () => ({}),
67
- type: Object
47
+ description: {
48
+ type: [String, Object],
49
+ default: ''
68
50
  },
69
51
 
70
- maxWidth: {
71
- default: '',
72
- type: String
73
- },
74
-
75
- minWidth: {
76
- default: '',
77
- type: String
52
+ disableCloseButton: {
53
+ type: Boolean
78
54
  },
79
55
 
80
56
  ok: {
@@ -82,16 +58,23 @@ const props = defineProps({
82
58
  type: [Object, Boolean]
83
59
  },
84
60
 
85
- persistent: {
86
- default: true,
87
- type: Boolean
61
+ size: {
62
+ type: String,
63
+ default: 'sm',
64
+ validator: value => ['sm', 'md', 'lg', 'xl'].includes(value)
88
65
  },
89
66
 
90
- useForm: {
91
- type: Boolean
67
+ title: {
68
+ type: String,
69
+ default: ''
92
70
  },
93
71
 
94
- modelValue: {
72
+ tertiary: {
73
+ default: () => ({}),
74
+ type: Object
75
+ },
76
+
77
+ useForm: {
95
78
  type: Boolean
96
79
  },
97
80
 
@@ -99,7 +82,17 @@ const props = defineProps({
99
82
  type: Boolean
100
83
  },
101
84
 
102
- useFullMaxWidth: {
85
+ useAutoCloseOnActions: {
86
+ type: Boolean,
87
+ default: true
88
+ },
89
+
90
+ useCloseButton: {
91
+ type: Boolean,
92
+ default: true
93
+ },
94
+
95
+ useHtmlDescription: {
103
96
  type: Boolean
104
97
  },
105
98
 
@@ -108,10 +101,8 @@ const props = defineProps({
108
101
  }
109
102
  })
110
103
 
104
+ // emtis
111
105
  const emit = defineEmits([
112
- // model
113
- 'update:modelValue',
114
-
115
106
  // actions
116
107
  'cancel',
117
108
  'ok',
@@ -121,24 +112,35 @@ const emit = defineEmits([
121
112
  ...useDialogPluginComponent.emits
122
113
  ])
123
114
 
115
+ // models
116
+ const model = defineModel({ type: Boolean })
117
+
118
+ // globals
124
119
  provide('isDialog', true)
120
+ provide('btnPropsDefaults', { size: 'md' }) // define o tamanho padrão para os botões dentro do dialog
125
121
 
126
- const attrs = useAttrs()
127
- const screen = useScreen()
128
- const slots = useSlots()
122
+ // necessário para pegar as props default do dialog quando usado no QasDrawer
123
+ const defaultProps = inject('dialogDefaultProps', null)
129
124
 
130
- // usado para o plugin
131
- const { dialogRef, onDialogHide } = useDialogPluginComponent()
125
+ // composables
126
+ const slots = useSlots()
127
+ const attrs = useAttrs()
128
+ const { dialogRef, onDialogHide } = useDialogPluginComponent() // usado para o plugin
132
129
 
133
- // QForm template
130
+ // refs
134
131
  const form = ref(null)
135
132
 
136
- const composablesParams = { emit, form, props, screen, slots }
133
+ // composables
134
+ const { defaultCancel, hasCancel } = useCancel()
135
+ const { defaultOk, hasOk, onOk } = useOk()
136
+ const { descriptionComponent, mainComponent } = useDynamicComponents()
137
137
 
138
- const { defaultCancel, hasCancel } = useCancel(composablesParams)
139
- const { defaultOk, hasOk, onOk } = useOk(composablesParams)
140
- const { descriptionComponent, mainComponent } = useDynamicComponents({ ...composablesParams, onOk, hasOk })
138
+ /**
139
+ * Necessária logica via provide para controle interno no componente QasDrawer.
140
+ */
141
+ const hasDefaultMaxWidth = computed(() => !!defaultProps?.value.maxWidth)
141
142
 
143
+ // computeds
142
144
  /**
143
145
  * Classes criadas para serem utilizadas quando usado com a prop "position", pois
144
146
  * o comportamento do dialog muda, e não é possível usar em conjunto com a prop
@@ -148,60 +150,240 @@ const classes = computed(() => {
148
150
  const isRightPosition = attrs.position === 'right'
149
151
  const isLeftPosition = attrs.position === 'left'
150
152
 
153
+ const sizes = {
154
+ sm: 'qas-dialog--sm', // 450px
155
+ md: 'qas-dialog--md', // 550px
156
+ lg: 'qas-dialog--lg', // 800px
157
+ xl: 'qas-dialog--xl' // 1100px
158
+ }
159
+
160
+ return [
161
+ {
162
+ [sizes[props.size]]: !hasDefaultMaxWidth.value,
163
+ 'qas-dialog--right': isRightPosition,
164
+ 'qas-dialog--left': isLeftPosition
165
+ }
166
+ ]
167
+ })
168
+
169
+ /**
170
+ * Manter dessa forma até issue #1431 ser resolvida.
171
+ */
172
+ const containerStyles = computed(() => {
173
+ if (!hasDefaultMaxWidth.value) return
174
+
151
175
  return {
152
- 'qas-dialog--right': isRightPosition,
153
- 'qas-dialog--left': isLeftPosition
176
+ maxWidth: defaultProps?.value?.maxWidth
154
177
  }
155
178
  })
156
179
 
157
180
  const dialogProps = computed(() => {
181
+ const { title, ...attributes } = attrs
182
+
158
183
  return {
159
184
  ...(!props.usePlugin && { modelValue: props.modelValue }),
160
- ...attrs,
185
+ ...attributes,
186
+ persistent: defaultProps?.value?.persistent ?? hasActions.value,
161
187
 
162
188
  onHide: onDialogHide
163
189
  }
164
190
  })
165
191
 
166
- const style = computed(() => {
192
+ const hasActions = computed(() => hasOk.value || hasCancel.value || !!Object.keys(props.tertiary).length)
193
+
194
+ const headerProps = computed(() => {
195
+ return {
196
+ labelProps: {
197
+ label: props.title
198
+ },
199
+
200
+ badges: props.badges,
201
+
202
+ buttonProps: {
203
+ ...(props.useCloseButton && {
204
+ color: 'grey-10',
205
+ disable: props.disableCloseButton,
206
+ icon: 'sym_r_close',
207
+ variant: 'tertiary',
208
+ 'data-cy': 'dialog-close-btn',
209
+ onClick: () => updateModelValue(false)
210
+ })
211
+ }
212
+ }
213
+ })
214
+
215
+ const defaultActionsProps = computed(() => {
167
216
  return {
168
- ...(props.useFullMaxWidth && { width: '100%' }),
217
+ ...(hasOk.value && { primaryButtonProps: defaultOk.value }),
218
+ ...(hasCancel.value && { secondaryButtonProps: defaultCancel.value }),
219
+
220
+ tertiaryButtonProps: {
221
+ ...props.tertiary,
222
+ 'data-cy': 'dialog-tertiary-btn'
223
+ },
169
224
 
170
- maxWidth: props.maxWidth || '470px',
171
- minWidth: props.minWidth || (screen.isSmall ? '' : '366px')
225
+ spacingTop: 'lg',
226
+ gutter: 'md'
172
227
  }
173
228
  })
174
229
 
175
- const hasHeader = computed(() => !!slots.header || props.card.title)
176
- const isInfoDialog = computed(() => !hasOk.value && !hasCancel.value)
230
+ const hasHeaderSlot = computed(() => !!slots.header)
177
231
 
178
- const defaultActionsProps = computed(() => {
179
- const { useFullWidth, useEqualWidth } = props.actionsProps
232
+ // functions
233
+ function updateModelValue (value) {
234
+ model.value = value
235
+ }
236
+
237
+ // composable definitions
238
+ function useOk () {
239
+ // computeds
240
+ const defaultOk = computed(() => {
241
+ const { onClick, ...attrs } = props.ok
242
+
243
+ return {
244
+ label: 'Ok',
245
+ type: (props.ok?.type || props.useForm) ? 'submit' : 'button',
246
+ 'data-cy': 'dialog-ok-btn',
247
+
248
+ ...attrs,
249
+
250
+ // adiciona somente se não estiver usando useForm pois o controle ficará no submit.
251
+ ...(!props.useForm && { onClick: onOk })
252
+ }
253
+ })
254
+
255
+ const hasOk = computed(() => typeof props.ok === 'boolean' ? props.ok : !!Object.keys(props.ok))
256
+
257
+ // functions
258
+ function onOk () {
259
+ if (!props.useForm && props.useAutoCloseOnActions) {
260
+ updateModelValue(false)
261
+ }
180
262
 
181
- if (useFullWidth || useEqualWidth) return props.actionsProps
263
+ props.ok.onClick?.()
182
264
 
183
- const hasAllActions = hasOk.value && hasCancel.value
184
- const hasSingleAction = (hasOk.value && !hasCancel.value) || (!hasOk.value && hasCancel.value)
265
+ emit('ok')
266
+ }
185
267
 
186
268
  return {
187
- useFullWidth: hasSingleAction,
188
- useEqualWidth: hasAllActions,
269
+ defaultOk,
270
+ hasOk,
271
+ onOk
272
+ }
273
+ }
274
+
275
+ function useCancel () {
276
+ // computeds
277
+ const defaultCancel = computed(() => {
278
+ return {
279
+ label: 'Cancelar',
280
+ 'data-cy': 'dialog-cancel-btn',
281
+
282
+ ...props.cancel,
283
+
284
+ onClick: onCancel
285
+ }
286
+ })
189
287
 
190
- ...props.actionsProps
288
+ const hasCancel = computed(() => typeof props.cancel === 'boolean' ? props.cancel : !!Object.keys(props.cancel))
289
+
290
+ // functions
291
+ function onCancel () {
292
+ props.cancel.onClick?.()
293
+
294
+ if (props.useAutoCloseOnActions) {
295
+ updateModelValue(false)
296
+ }
297
+
298
+ emit('cancel')
191
299
  }
192
- })
193
300
 
194
- function updateModelValue (value) {
195
- emit('update:modelValue', value)
301
+ return {
302
+ defaultCancel,
303
+ hasCancel
304
+ }
305
+ }
306
+
307
+ function useDynamicComponents () {
308
+ // computeds
309
+ const mainComponent = computed(() => {
310
+ return {
311
+ is: props.useForm ? QForm : 'div',
312
+
313
+ /**
314
+ * adiciona evento de submit caso useForm seja true,
315
+ * uma vez que somente o q-form possui este evento.
316
+ */
317
+ props: {
318
+ ...(props.useForm && { onSubmit })
319
+ }
320
+ }
321
+ })
322
+
323
+ const hasRenderFunction = computed(() => {
324
+ const description = props.description
325
+
326
+ return typeof description === 'object' && description !== null && !Array.isArray(description)
327
+ })
328
+
329
+ const descriptionComponent = computed(() => hasRenderFunction.value ? props.description : 'div')
330
+
331
+ // functions
332
+ function submitHandler () {
333
+ if (!props.useForm) return
334
+
335
+ if (props.useValidationAllAtOnce) {
336
+ let isAllComponentValid = true
337
+ const components = form.value.getValidationComponents() || []
338
+
339
+ for (const component of components) {
340
+ const isValid = component?.validate?.()
341
+
342
+ if (!isValid) {
343
+ isAllComponentValid = false
344
+ }
345
+ }
346
+
347
+ emit('validate', isAllComponentValid)
348
+
349
+ return
350
+ }
351
+
352
+ emit('validate', form.value.validate())
353
+ }
354
+
355
+ /**
356
+ * Sem este método, ao clicar enter com a prop useForm ativada a tela era recarregada,
357
+ * e a ação de click do botão não era chamada pois ele não esta dentro do form.
358
+ */
359
+ function onSubmit (event) {
360
+ event.preventDefault()
361
+
362
+ if (hasOk.value) {
363
+ onOk()
364
+ submitHandler()
365
+ }
366
+ }
367
+
368
+ return {
369
+ mainComponent,
370
+ descriptionComponent
371
+ }
196
372
  }
197
373
  </script>
198
374
 
199
375
  <style lang="scss">
200
376
  .qas-dialog {
377
+ $root: &;
378
+
201
379
  .q-dialog__inner > div {
202
380
  box-shadow: $shadow-2;
203
381
  }
204
382
 
383
+ .q-dialog__inner--minimized {
384
+ padding: var(--qas-spacing-md);
385
+ }
386
+
205
387
  &--right {
206
388
  .q-dialog__inner {
207
389
  width: 100%;
@@ -214,5 +396,39 @@ function updateModelValue (value) {
214
396
  width: 100%;
215
397
  }
216
398
  }
399
+
400
+ // tamanhos
401
+ &--sm {
402
+ #{$root}__container {
403
+ max-width: 450px !important;
404
+ }
405
+ }
406
+
407
+ &--md {
408
+ #{$root}__container {
409
+ max-width: 550px !important;
410
+ }
411
+ }
412
+
413
+ &--lg {
414
+ #{$root}__container {
415
+ max-width: 800px !important;
416
+ }
417
+ }
418
+
419
+ &--xl {
420
+ #{$root}__container {
421
+ max-width: 1100px !important;
422
+ }
423
+ }
424
+
425
+ // tamanho mínimo dos botões de ação (primário e secundário)
426
+ &__actions {
427
+ .qas-btn--primary,
428
+ .qas-btn--secondary {
429
+ min-width: 120px;
430
+ width: 100%;
431
+ }
432
+ }
217
433
  }
218
434
  </style>
@@ -4,10 +4,10 @@ meta:
4
4
  desc: Componente de dialog.
5
5
 
6
6
  props:
7
- actions-props:
8
- desc: Props repassadas para o "QasActions".
9
- default: {}
10
- type: Object
7
+ badges:
8
+ desc: Badges que aparecem no canto superior direito do dialog.
9
+ type: [Array, Object]
10
+ default: []
11
11
 
12
12
  cancel:
13
13
  desc: Props para o botão de cancelar, pode ser objeto com as propriedades ou um boolean, caso for "false", remove o botão de cancelar.
@@ -15,19 +15,13 @@ props:
15
15
  type: [Object, Boolean]
16
16
  examples: ["{ label: 'Meu botão de cancelar', onClick: () => alert('fui clicado!') }"]
17
17
 
18
- card:
19
- desc: Objeto contendo as informações para serem exibidas dentro do dialog como "title" e "description".
20
- default: {}
21
- type: Object
22
- examples: ["{ title: 'Meu título', description: 'Minha descrição' }"]
23
-
24
- max-width:
25
- desc: Tamanho máximo do dialog.
26
- type: String
18
+ description:
19
+ desc: Descrição do dialog, pode ser uma string ou um componente ou uma string com HTML (passando a prop useHtmlDescription).
20
+ type: [String, Object]
27
21
 
28
- min-width:
29
- desc: Tamanho mínimo do dialog.
30
- type: String
22
+ disable-close-button:
23
+ desc: Define se o botão de fechar no canto superior direito estará desabilitado.
24
+ type: Boolean
31
25
 
32
26
  model-value:
33
27
  desc: Model do componente, abre ou fecha o dialog.
@@ -42,27 +36,43 @@ props:
42
36
  type: [Object, Boolean]
43
37
  examples: ["{ label: 'Meu botão de confirmar', onClick: () => alert('fui clicado!') }"]
44
38
 
45
- persistent:
46
- desc: Define se o dialog vai fechar ou não após clicar fora do dialog.
39
+ size:
40
+ desc: Tamanho do dialog.
41
+ type: String
42
+ default: 'md'
43
+ options: ['xs', 'sm', 'md', 'lg', 'xl']
44
+
45
+ use-auto-close-on-actions:
46
+ desc: Define se o dialog vai fechar automaticamente ao clicar nos botões de ação (ok ou cancelar).
47
+ type: Boolean
47
48
  default: true
49
+
50
+ use-close-button:
51
+ desc: Define se o dialog vai ter um botão de fechar no canto superior direito.
48
52
  type: Boolean
49
53
 
50
54
  use-form:
51
55
  desc: Define se a tag onde fica a descrição no dialog vai ser um "<q-form />" ou "<div />".
52
56
  type: Boolean
53
57
 
54
- use-full-max-width:
55
- desc: propriedade para utilizar `100% do maxWidth`.
58
+ use-html-description:
59
+ desc: Define se a descrição aceita HTML (utilize com cuidado para evitar XSS).
56
60
  type: Boolean
57
61
 
58
62
  use-validation-all-at-once:
59
63
  desc: Valida todos os campos de uma única vez, ao invés de ser um por vez (que é o padrão).
60
64
  type: Boolean
61
65
 
62
- slots:
63
- actions:
64
- desc: Slot para ações (botões por exemplo).
66
+ tertiary:
67
+ desc: Props para o botão terciário
68
+ type: Object
69
+ default: {}
70
+
71
+ title:
72
+ desc: Título do dialog.
73
+ type: String
65
74
 
75
+ slots:
66
76
  description:
67
77
  desc: Slot para descrição.
68
78
 
@@ -99,6 +109,10 @@ selectors:
99
109
  desc: Seletor do botão de cancelar do componente.
100
110
  examples: ['data-cy="dialog-cancel-btn"']
101
111
 
112
+ dialog-tertiary-btn:
113
+ desc: Seletor do botão terciário do componente.
114
+ examples: ['data-cy="dialog-tertiary-btn"']
115
+
102
116
  dialog-close-btn:
103
117
  desc: Seletor do botão de fechar do componente.
104
118
  examples: ['data-cy="dialog-close-btn"']
@@ -15,7 +15,7 @@ export default function useCancel (config = {}) {
15
15
  const defaultCancel = computed(() => {
16
16
  return {
17
17
  label: 'Cancelar',
18
- outline: true,
18
+ 'data-cy': 'dialog-cancel-btn',
19
19
 
20
20
  ...props.cancel,
21
21
 
@@ -35,12 +35,12 @@ export default function useDynamicComponents (config = {}) {
35
35
  })
36
36
 
37
37
  const hasRenderFunction = computed(() => {
38
- const description = props.card.description
38
+ const description = props.description
39
39
 
40
40
  return typeof description === 'object' && description !== null && !Array.isArray(description)
41
41
  })
42
42
 
43
- const descriptionComponent = computed(() => hasRenderFunction.value ? props.card.description : 'div')
43
+ const descriptionComponent = computed(() => hasRenderFunction.value ? props.description : 'div')
44
44
 
45
45
  // métodos
46
46
  function submitHandler () {
@@ -18,6 +18,7 @@ export default function useOk (config = {}) {
18
18
  return {
19
19
  label: 'Ok',
20
20
  type: (props.ok?.type || props.useForm) ? 'submit' : 'button',
21
+ 'data-cy': 'dialog-ok-btn',
21
22
 
22
23
  ...attrs,
23
24
 
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <qas-dialog class="qas-drawer" v-bind="attributes" @update:model-value="onUpdateModelValue">
2
+ <qas-dialog v-model="model" class="qas-drawer" v-bind="attributes">
3
3
  <template #header>
4
4
  <slot name="header">
5
5
  <div class="items-center justify-between row">
@@ -11,7 +11,7 @@
11
11
  </slot>
12
12
  </span>
13
13
 
14
- <qas-btn v-close-popup class="z-max" color="grey-10" data-cy="drawer-close-btn" icon="sym_r_close" variant="tertiary" @click="emit('update:modelValue', false)" />
14
+ <qas-btn class="z-max" color="grey-10" data-cy="drawer-close-btn" icon="sym_r_close" variant="tertiary" @click="close" />
15
15
  </div>
16
16
  </slot>
17
17
  </template>
@@ -40,7 +40,7 @@ import QasBtn from '../btn/QasBtn.vue'
40
40
 
41
41
  import useScreen from '../../composables/use-screen.js'
42
42
 
43
- import { computed, useAttrs } from 'vue'
43
+ import { computed, provide } from 'vue'
44
44
 
45
45
  defineOptions({
46
46
  name: 'QasDrawer',
@@ -58,6 +58,10 @@ const props = defineProps({
58
58
  default: '60%'
59
59
  },
60
60
 
61
+ persistent: {
62
+ type: Boolean
63
+ },
64
+
61
65
  position: {
62
66
  type: String,
63
67
  default: 'left',
@@ -74,9 +78,10 @@ const props = defineProps({
74
78
  }
75
79
  })
76
80
 
77
- const emit = defineEmits(['update:modelValue'])
81
+ // emits
82
+ const model = defineModel({ type: Boolean })
78
83
 
79
- const attrs = useAttrs()
84
+ // composables
80
85
  const screen = useScreen()
81
86
 
82
87
  // computed
@@ -89,25 +94,31 @@ const loadingStyle = computed(() => {
89
94
  })
90
95
 
91
96
  const attributes = computed(() => {
92
- const { modelValue } = attrs
93
-
94
97
  return {
95
- persistent: false,
96
- modelValue,
97
-
98
98
  ...props.dialogProps,
99
99
 
100
+ title: props.title,
100
101
  cancel: false,
101
- maxWidth: normalizedMaxWidth.value,
102
102
  maximized: true,
103
103
  ok: false,
104
- position: props.position,
105
- useFullMaxWidth: true
104
+ position: props.position
106
105
  }
107
106
  })
108
107
 
109
- function onUpdateModelValue (value) {
110
- emit('update:modelValue', value)
108
+ // globals
109
+ /**
110
+ * Manter dessa forma até issue #1431 ser resolvida.
111
+ */
112
+ provide('dialogDefaultProps', computed(() => {
113
+ return {
114
+ maxWidth: normalizedMaxWidth.value,
115
+ persistent: props.persistent
116
+ }
117
+ }))
118
+
119
+ // functions
120
+ function close () {
121
+ model.value = false
111
122
  }
112
123
  </script>
113
124
 
@@ -20,6 +20,11 @@ props:
20
20
  examples: [v-model="value"]
21
21
  model: true
22
22
 
23
+ persistent:
24
+ desc: Define se o drawer pode ser fechado clicando fora dele ou pressionando a tecla ESC.
25
+ default: false
26
+ type: Boolean
27
+
23
28
  position:
24
29
  desc: 'Posição do drawer, sendo possível apenas 2 opções: [left, right].'
25
30
  default: left
@@ -190,9 +190,7 @@ export default {
190
190
  ignoreRouterGuard: false,
191
191
 
192
192
  defaultDialogProps: {
193
- card: {
194
- description: 'Você está deixando a página e suas alterações serão perdidas. Tem certeza que deseja sair sem salvar?'
195
- },
193
+ description: 'Você está deixando a página e suas alterações serão perdidas. Tem certeza que deseja sair sem salvar?',
196
194
 
197
195
  ok: { label: 'Continuar editando' },
198
196
 
@@ -28,9 +28,7 @@ export default function useDelete ({ props, destroyFn, emit }) {
28
28
 
29
29
  const defaultDialogProps = computed(() => {
30
30
  return {
31
- card: {
32
- description: 'Tem certeza que deseja excluir este item?'
33
- },
31
+ description: 'Tem certeza que deseja excluir este item?',
34
32
 
35
33
  ok: {
36
34
  label: 'Excluir',
@@ -1,12 +1,6 @@
1
1
  <template>
2
2
  <div class="pv-gallery-carousel-dialog">
3
- <qas-dialog v-model="model" :cancel="false" class="q-pa-xl" max-width="1100px" :ok="false" :persistent="false" use-full-max-width>
4
- <template #header>
5
- <div class="text-right">
6
- <qas-btn v-close-popup color="grey-10" icon="sym_r_close" variant="tertiary" @click="close" />
7
- </div>
8
- </template>
9
-
3
+ <qas-dialog v-model="model" v-bind="dialogProps">
10
4
  <template #description>
11
5
  <q-carousel v-model="imageIndexModel" animated :arrows="!screen.isSmall" class="pv-gallery-carousel-dialog__carousel" control-text-color="primary" data-cy="gallery-carousel" :fullscreen="screen.isSmall" :height="carouselImageHeight" next-icon="sym_r_chevron_right" prev-icon="sym_r_chevron_left" swipeable :thumbnails="!isSingleImage">
12
6
  <q-carousel-slide v-for="(image, index) in props.images" :key="index" class="bg-no-repeat bg-size-contain" :data-cy="`gallery-carousel-slide-${index}`" :img-src="image.url" :name="index">
@@ -52,6 +46,13 @@ const screen = useScreen()
52
46
 
53
47
  const carouselImageHeight = 'calc((500/976) * 100vh)'
54
48
 
49
+ const dialogProps = {
50
+ cancel: false,
51
+ ok: false,
52
+ size: 'xl',
53
+ title: 'Galeria de imagens'
54
+ }
55
+
55
56
  const model = computed({
56
57
  get () {
57
58
  return props.modelValue
@@ -15,7 +15,7 @@
15
15
  </slot>
16
16
 
17
17
  <div v-if="hasBadges" class="col-auto items-center q-col-gutter-sm row">
18
- <div v-for="(badge, badgeIndex) in props.badges" :key="badgeIndex">
18
+ <div v-for="(badge, badgeIndex) in normalizedBadges" :key="badgeIndex">
19
19
  <qas-skeleton v-if="props.skeleton" type="QasBadge" />
20
20
 
21
21
  <qas-badge v-else v-bind="badge" />
@@ -73,7 +73,7 @@ const props = defineProps({
73
73
  },
74
74
 
75
75
  badges: {
76
- type: Array,
76
+ type: [Array, Object],
77
77
  default: () => []
78
78
  },
79
79
 
@@ -203,13 +203,15 @@ const actionsComponent = computed(() => {
203
203
  return component.true
204
204
  })
205
205
 
206
+ const normalizedBadges = computed(() => Array.isArray(props.badges) ? props.badges : [props.badges])
207
+
206
208
  const hasActionsComponent = computed(() => {
207
209
  return hasDefaultButton.value || hasDefaultActionsMenu.value || hasDefaultFilters.value
208
210
  })
209
211
 
210
212
  const hasActionsSection = computed(() => !!slots.actions || hasActionsComponent.value)
211
213
 
212
- const hasBadges = computed(() => !!props.badges.length)
214
+ const hasBadges = computed(() => !!normalizedBadges.value.length)
213
215
  const hasLabel = computed(() => !!Object.keys(props.labelProps).length)
214
216
  const hasDefaultButton = computed(() => !!Object.keys(props.buttonProps).length)
215
217
  const hasDefaultFilters = computed(() => !!Object.keys(props.filtersProps).length)
@@ -12,7 +12,7 @@ props:
12
12
  badges:
13
13
  desc: Adiciona badges ao lado do titulo (QasLabel), caso não tenha titulo fica somente as bages acima da descrição.
14
14
  default: []
15
- type: Array
15
+ type: [Array, Object]
16
16
 
17
17
  button-props:
18
18
  desc: Propriedades do QasBtn.
@@ -325,8 +325,7 @@ function useSelectDialog () {
325
325
 
326
326
  const defaultDialogProps = computed(() => {
327
327
  return {
328
- useFullMaxWidth: true,
329
-
328
+ size: 'md',
330
329
  ...props.dialogProps,
331
330
 
332
331
  onBeforeShow: event => {
@@ -3,12 +3,8 @@
3
3
  <qas-uploader ref="uploader" v-model="model" :add-button-fn="openDialog" :use-resize="false" v-bind="defaultUploaderProps" />
4
4
 
5
5
  <qas-dialog v-model="isOpenedDialog" v-bind="defaultDialogProps">
6
- <template #header>
7
- <div class="text-bold text-center">Insira sua assinatura digital no campo abaixo</div>
8
- </template>
9
-
10
6
  <template #description>
11
- <div :style="signaturePadWidth">
7
+ <div>
12
8
  <qas-signature-pad ref="signaturePadModal" v-model:empty="isEmpty" :height="signaturePadHeight" />
13
9
  </div>
14
10
  </template>
@@ -82,10 +78,11 @@ export default {
82
78
 
83
79
  defaultDialogProps () {
84
80
  return {
85
- maxWidth: '620px',
81
+ title: 'Assinatura digital',
82
+ size: 'md',
86
83
  ...this.dialogProps,
87
84
  ok: {
88
- label: 'Salvar',
85
+ label: 'Assinar',
89
86
  onClick: () => this.getSignatureData()
90
87
  }
91
88
  }
@@ -111,16 +108,6 @@ export default {
111
108
  return sizes.true
112
109
  },
113
110
 
114
- signaturePadWidth () {
115
- const sizes = {
116
- [this.$qas.screen.isSmall]: { width: '100%' },
117
- [this.$qas.screen.isMedium]: { width: '570px' },
118
- [this.$qas.screen.isLarge]: { width: '350px' }
119
- }
120
-
121
- return sizes.true
122
- },
123
-
124
111
  uploaderScope () {
125
112
  return this.$refs?.uploader?.uploader
126
113
  }
@@ -19,7 +19,7 @@
19
19
  <qas-btn v-if="hasButton" class="q-ml-xs" :label="buttonLabel" @click.stop.prevent="toggle" />
20
20
  </div>
21
21
 
22
- <qas-dialog v-model="show" v-bind="defaultProps" aria-label="Diálogo de texto completo" role="dialog">
22
+ <qas-dialog v-model="show" v-bind="defaultProps" aria-label="Diálogo de texto completo" role="dialog" size="md">
23
23
  <template v-if="showDescriptionSlot" #description>
24
24
  <component :is="dialogComponent.is" v-bind="dialogComponent.props" v-model:results="searchModel">
25
25
  <q-list separator>
@@ -225,10 +225,8 @@ function useDialog ({ props, textContent }) {
225
225
 
226
226
  ...props.dialogProps,
227
227
 
228
- card: {
229
- title: props.dialogTitle,
230
- description: description.value
231
- }
228
+ title: props.dialogTitle,
229
+ description: description.value
232
230
  }
233
231
  })
234
232
 
@@ -201,9 +201,7 @@ export default {
201
201
 
202
202
  formDialogConfig () {
203
203
  return {
204
- card: {
205
- title: this.isAdd ? 'Adicionar ramo' : 'Editar ramo'
206
- },
204
+ title: this.isAdd ? 'Adicionar ramo' : 'Editar ramo',
207
205
  ok: {
208
206
  label: 'Salvar',
209
207
  loading: this.isSubmitting
@@ -317,7 +317,11 @@ export default {
317
317
  } = this.$props
318
318
 
319
319
  return {
320
- dialogProps,
320
+ dialogProps: {
321
+ ...dialogProps,
322
+ size: 'md'
323
+ },
324
+
321
325
  fields,
322
326
  formGeneratorProps,
323
327
  galleryCardProps,