@bildvitta/quasar-ui-asteroid 3.20.0-beta.18-alpha.0 → 3.20.0-beta.18

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.18-alpha.0",
4
+ "version": "3.20.0-beta.18",
5
5
  "author": "Bild & Vitta <systemteam@bild.com.br>",
6
6
  "license": "MIT",
7
7
  "main": "./src/asteroid.js",
@@ -388,6 +388,8 @@ const hasColumnsLength = computed(() => !!Object.keys(columnsResultsModel.value)
388
388
 
389
389
  const containerStyle = computed(() => `width: ${props.columnWidth};`)
390
390
 
391
+ const hasConfirmDialogProps = computed(() => !!Object.keys(props.confirmDialogProps).length)
392
+
391
393
  const defaultConfirmDialogProps = computed(() => {
392
394
  const defaultProps = {
393
395
  ok: {
@@ -1122,7 +1124,7 @@ function onDropCard (event) {
1122
1124
  return
1123
1125
  }
1124
1126
 
1125
- props.useConfirmDialog
1127
+ hasConfirmDialogProps.value
1126
1128
  ? openConfirmDialog()
1127
1129
  : confirmDrop(event)
1128
1130
  }
@@ -1141,7 +1143,7 @@ function closeConfirmDialog () {
1141
1143
  function cancelDrop (event) {
1142
1144
  revertDomDrag(event)
1143
1145
 
1144
- if (props.useConfirmDialog) closeConfirmDialog()
1146
+ if (hasConfirmDialogProps.value) closeConfirmDialog()
1145
1147
 
1146
1148
  stopDragging()
1147
1149
  }
@@ -1280,10 +1282,7 @@ async function updatePosition ({ newHeaderKey, oldHeaderKey, itemId, event, opti
1280
1282
  : `${props.updatePositionUrl}/${itemId}/update-position`
1281
1283
 
1282
1284
  const { data, error } = await promiseHandler(
1283
- axios.patch(url, params, {
1284
- adapter: 'fetch',
1285
- fetchOptions: { priority: 'low' }
1286
- }),
1285
+ axios.patch(url, params),
1287
1286
  {
1288
1287
  errorMessage: 'Ocorreu um erro ao atualizar a posição de seu item.',
1289
1288
  useLoading: false,
@@ -115,10 +115,6 @@ props:
115
115
  default: "{ animation: 500, swapThreshold: 1, delay: 50, delayOnTouchOnly: true, emptyInsertThreshold: 0 }"
116
116
  debugger: true
117
117
 
118
- use-confirm-dialog:
119
- desc: Controla se o dialog de confirmação para o drag and drop será utilizado. Caso seja "true", o dialog é aberto utilizando as props passadas em "confirm-dialog-props" e as ações de confirmar e cancelar são feitas por padrão no componente. Caso seja "false", o drag and drop é realizado sem confirmação.
120
- type: Boolean
121
-
122
118
  use-drag-and-drop-x:
123
119
  desc: Controla se irá ter drag and drop no eixo X (entre colunas).
124
120
  type: Boolean
@@ -1,29 +1,37 @@
1
1
  <template>
2
- <q-dialog ref="dialogRef" v-model="model" class="qas-dialog" :class="classes" data-cy="dialog" v-bind="dialogProps">
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" />
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
+ <slot name="title" />
9
+ </qas-label>
10
+
11
+ <qas-btn v-if="isInfoDialog" v-close-popup color="grey-10" data-cy="dialog-close-btn" icon="sym_r_close" variant="tertiary" />
12
+ </div>
13
+ </slot>
6
14
  </header>
7
15
 
8
- <qas-header v-else-if="props.title" v-bind="headerProps">
9
- <template v-if="hasTitleSlot" #label>
10
- <qas-label>
11
- <slot name="title" />
12
- </qas-label>
13
- </template>
14
- </qas-header>
15
-
16
16
  <section class="relative-position text-body1 text-grey-8">
17
17
  <component :is="mainComponent.is" ref="form" v-bind="mainComponent.props">
18
18
  <slot name="description">
19
- <div v-if="props.useHtmlDescription" data-cy="dialog-description" v-html="props.description" />
20
-
21
- <component :is="descriptionComponent" v-else data-cy="dialog-description">
22
- {{ props.description }}
23
- </component>
19
+ <component :is="descriptionComponent" data-cy="dialog-description">{{ props.card.description }}</component>
24
20
  </slot>
25
21
 
26
- <qas-actions v-if="hasActions" class="qas-dialog__actions" v-bind="defaultActionsProps" />
22
+ <div v-if="!isInfoDialog">
23
+ <slot name="actions">
24
+ <qas-actions v-bind="defaultActionsProps">
25
+ <template v-if="hasOk" #primary>
26
+ <qas-btn v-close-popup="!props.useForm" class="full-width" data-cy="dialog-ok-btn" size="lg" variant="primary" v-bind="defaultOk" />
27
+ </template>
28
+
29
+ <template v-if="hasCancel" #secondary>
30
+ <qas-btn v-close-popup class="full-width" data-cy="dialog-cancel-btn" size="lg" v-bind="defaultCancel" variant="secondary" />
31
+ </template>
32
+ </qas-actions>
33
+ </slot>
34
+ </div>
27
35
  </component>
28
36
  </section>
29
37
  </div>
@@ -31,19 +39,24 @@
31
39
  </template>
32
40
 
33
41
  <script setup>
34
- import QasLabel from '../label/QasLabel.vue'
35
42
  import QasActions from '../actions/QasActions.vue'
36
- import QasHeader from '../header/QasHeader.vue'
43
+ import QasBtn from '../btn/QasBtn.vue'
44
+ import QasLabel from '../label/QasLabel.vue'
37
45
 
38
- import { computed, ref, useAttrs, provide, useSlots, inject } from 'vue'
39
- import { useDialogPluginComponent, QForm } from 'quasar'
46
+ import useCancel from './composables/use-cancel'
47
+ import useDynamicComponents from './composables/use-dynamic-components'
48
+ import useOk from './composables/use-ok'
49
+ import { useScreen } from '../../composables'
50
+
51
+ import { computed, ref, useAttrs, useSlots, provide } from 'vue'
52
+ import { useDialogPluginComponent } from 'quasar'
40
53
 
41
54
  defineOptions({ name: 'QasDialog' })
42
55
 
43
56
  const props = defineProps({
44
- badges: {
45
- default: () => [],
46
- type: [Array, Object]
57
+ actionsProps: {
58
+ default: () => ({}),
59
+ type: Object
47
60
  },
48
61
 
49
62
  cancel: {
@@ -51,60 +64,44 @@ const props = defineProps({
51
64
  type: [Object, Boolean]
52
65
  },
53
66
 
54
- description: {
55
- type: [String, Object],
56
- default: ''
57
- },
58
-
59
- disableCloseButton: {
60
- type: Boolean
61
- },
62
-
63
- ok: {
67
+ card: {
64
68
  default: () => ({}),
65
- type: [Object, Boolean]
69
+ type: Object
66
70
  },
67
71
 
68
- size: {
69
- type: String,
70
- default: 'sm',
71
- validator: value => ['sm', 'md', 'lg', 'xl'].includes(value)
72
+ maxWidth: {
73
+ default: '',
74
+ type: String
72
75
  },
73
76
 
74
- title: {
75
- type: String,
76
- required: true
77
+ minWidth: {
78
+ default: '',
79
+ type: String
77
80
  },
78
81
 
79
- tertiary: {
82
+ ok: {
80
83
  default: () => ({}),
81
- type: Object
84
+ type: [Object, Boolean]
82
85
  },
83
86
 
84
- useForm: {
87
+ persistent: {
88
+ default: true,
85
89
  type: Boolean
86
90
  },
87
91
 
88
- usePlugin: {
92
+ useForm: {
89
93
  type: Boolean
90
94
  },
91
95
 
92
- useAutoCloseOnCancel: {
93
- type: Boolean,
94
- default: true
95
- },
96
-
97
- useAutoCloseOnOk: {
98
- type: Boolean,
99
- default: true
96
+ modelValue: {
97
+ type: Boolean
100
98
  },
101
99
 
102
- useCloseButton: {
103
- type: Boolean,
104
- default: true
100
+ usePlugin: {
101
+ type: Boolean
105
102
  },
106
103
 
107
- useHtmlDescription: {
104
+ useFullMaxWidth: {
108
105
  type: Boolean
109
106
  },
110
107
 
@@ -113,8 +110,10 @@ const props = defineProps({
113
110
  }
114
111
  })
115
112
 
116
- // emtis
117
113
  const emit = defineEmits([
114
+ // model
115
+ 'update:modelValue',
116
+
118
117
  // actions
119
118
  'cancel',
120
119
  'ok',
@@ -124,32 +123,23 @@ const emit = defineEmits([
124
123
  ...useDialogPluginComponent.emits
125
124
  ])
126
125
 
127
- // models
128
- const model = defineModel({ type: Boolean })
129
-
130
- // globals
131
126
  provide('isDialog', true)
132
- provide('btnPropsDefaults', { size: 'md' }) // define o tamanho padrão para os botões dentro do dialog
133
127
 
134
- // necessário para pegar as props default do dialog quando usado no QasDrawer
135
- const defaultProps = inject('dialogDefaultProps', null)
128
+ const attrs = useAttrs()
129
+ const screen = useScreen()
130
+ const slots = useSlots()
131
+
132
+ // usado para o plugin
133
+ const { dialogRef, onDialogHide } = useDialogPluginComponent()
136
134
 
137
- // refs
135
+ // QForm template
138
136
  const form = ref(null)
139
137
 
140
- // composables
141
- const slots = useSlots()
142
- const attrs = useAttrs()
143
- const { dialogRef, onDialogHide } = useDialogPluginComponent() // usado para o plugin
144
- const { defaultCancel, hasCancel } = useCancel()
145
- const { defaultOk, hasOk, onOk } = useOk()
146
- const { descriptionComponent, mainComponent } = useDynamicComponents()
138
+ const composablesParams = { emit, form, props, screen, slots }
147
139
 
148
- // computeds
149
- /**
150
- * Necessária logica via provide para controle interno no componente QasDrawer.
151
- */
152
- const hasDefaultMaxWidth = computed(() => !!defaultProps?.value.maxWidth)
140
+ const { defaultCancel, hasCancel } = useCancel(composablesParams)
141
+ const { defaultOk, hasOk, onOk } = useOk(composablesParams)
142
+ const { descriptionComponent, mainComponent } = useDynamicComponents({ ...composablesParams, onOk, hasOk })
153
143
 
154
144
  /**
155
145
  * Classes criadas para serem utilizadas quando usado com a prop "position", pois
@@ -160,241 +150,60 @@ const classes = computed(() => {
160
150
  const isRightPosition = attrs.position === 'right'
161
151
  const isLeftPosition = attrs.position === 'left'
162
152
 
163
- const sizes = {
164
- sm: 'qas-dialog--sm', // 450px
165
- md: 'qas-dialog--md', // 550px
166
- lg: 'qas-dialog--lg', // 800px
167
- xl: 'qas-dialog--xl' // 1100px
168
- }
169
-
170
- return [
171
- {
172
- [sizes[props.size]]: !hasDefaultMaxWidth.value,
173
- 'qas-dialog--right': isRightPosition,
174
- 'qas-dialog--left': isLeftPosition
175
- }
176
- ]
177
- })
178
-
179
- /**
180
- * TODO-ISSUE: Manter dessa forma até issue #1431 ser resolvida.
181
- */
182
- const containerStyles = computed(() => {
183
- if (!hasDefaultMaxWidth.value) return
184
-
185
153
  return {
186
- maxWidth: defaultProps?.value?.maxWidth
154
+ 'qas-dialog--right': isRightPosition,
155
+ 'qas-dialog--left': isLeftPosition
187
156
  }
188
157
  })
189
158
 
190
159
  const dialogProps = computed(() => {
191
- const { title, ...attributes } = attrs
192
-
193
160
  return {
194
161
  ...(!props.usePlugin && { modelValue: props.modelValue }),
195
- ...attributes,
196
- persistent: defaultProps?.value?.persistent ?? hasActions.value,
162
+ ...attrs,
197
163
 
198
164
  onHide: onDialogHide
199
165
  }
200
166
  })
201
167
 
202
- const hasActions = computed(() => hasOk.value || hasCancel.value || !!Object.keys(props.tertiary).length)
203
-
204
- const headerProps = computed(() => {
205
- return {
206
- labelProps: {
207
- label: props.title
208
- },
209
-
210
- badges: props.badges,
211
-
212
- buttonProps: {
213
- ...(props.useCloseButton && {
214
- color: 'grey-10',
215
- disable: props.disableCloseButton,
216
- icon: 'sym_r_close',
217
- variant: 'tertiary',
218
- 'data-cy': 'dialog-close-btn',
219
- onClick: () => updateModelValue(false)
220
- })
221
- }
222
- }
223
- })
224
-
225
- const defaultActionsProps = computed(() => {
168
+ const style = computed(() => {
226
169
  return {
227
- ...(hasOk.value && { primaryButtonProps: defaultOk.value }),
228
- ...(hasCancel.value && { secondaryButtonProps: defaultCancel.value }),
170
+ ...(props.useFullMaxWidth && { width: '100%' }),
229
171
 
230
- tertiaryButtonProps: {
231
- ...props.tertiary,
232
- 'data-cy': 'dialog-tertiary-btn'
233
- },
234
-
235
- spacingTop: 'lg',
236
- gutter: 'md'
172
+ maxWidth: props.maxWidth || '470px',
173
+ minWidth: props.minWidth || (screen.isSmall ? '' : '366px')
237
174
  }
238
175
  })
239
176
 
240
- const hasHeaderSlot = computed(() => !!slots.header)
241
- const hasTitleSlot = computed(() => !!slots.title)
242
-
243
- // functions
244
- function updateModelValue (value) {
245
- model.value = value
246
- }
247
-
248
- // composable definitions
249
- function useOk () {
250
- // computeds
251
- const defaultOk = computed(() => {
252
- const { onClick, ...attrs } = props.ok
253
-
254
- return {
255
- label: 'Ok',
256
- type: (props.ok?.type || props.useForm) ? 'submit' : 'button',
257
- 'data-cy': 'dialog-ok-btn',
258
-
259
- ...attrs,
260
-
261
- // adiciona somente se não estiver usando useForm pois o controle ficará no submit.
262
- ...(!props.useForm && { onClick: onOk })
263
- }
264
- })
177
+ const hasHeader = computed(() => !!slots.header || props.card.title)
178
+ const isInfoDialog = computed(() => !hasOk.value && !hasCancel.value)
265
179
 
266
- const hasOk = computed(() => typeof props.ok === 'boolean' ? props.ok : !!Object.keys(props.ok))
267
-
268
- // functions
269
- function onOk () {
270
- if (!props.useForm && props.useAutoCloseOnOk) {
271
- updateModelValue(false)
272
- }
180
+ const defaultActionsProps = computed(() => {
181
+ const { useFullWidth, useEqualWidth } = props.actionsProps
273
182
 
274
- props.ok.onClick?.()
183
+ if (useFullWidth || useEqualWidth) return props.actionsProps
275
184
 
276
- emit('ok')
277
- }
185
+ const hasAllActions = hasOk.value && hasCancel.value
186
+ const hasSingleAction = (hasOk.value && !hasCancel.value) || (!hasOk.value && hasCancel.value)
278
187
 
279
188
  return {
280
- defaultOk,
281
- hasOk,
282
- onOk
283
- }
284
- }
285
-
286
- function useCancel () {
287
- // computeds
288
- const defaultCancel = computed(() => {
289
- return {
290
- label: 'Cancelar',
291
- 'data-cy': 'dialog-cancel-btn',
292
-
293
- ...props.cancel,
294
-
295
- onClick: onCancel
296
- }
297
- })
298
-
299
- const hasCancel = computed(() => typeof props.cancel === 'boolean' ? props.cancel : !!Object.keys(props.cancel))
300
-
301
- // functions
302
- function onCancel () {
303
- props.cancel.onClick?.()
304
-
305
- if (props.useAutoCloseOnAction || props.useAutoCloseOnCancel) {
306
- updateModelValue(false)
307
- }
308
-
309
- emit('cancel')
310
- }
189
+ useFullWidth: hasSingleAction,
190
+ useEqualWidth: hasAllActions,
311
191
 
312
- return {
313
- defaultCancel,
314
- hasCancel
315
- }
316
- }
317
-
318
- function useDynamicComponents () {
319
- // computeds
320
- const mainComponent = computed(() => {
321
- return {
322
- is: props.useForm ? QForm : 'div',
323
-
324
- /**
325
- * adiciona evento de submit caso useForm seja true,
326
- * uma vez que somente o q-form possui este evento.
327
- */
328
- props: {
329
- ...(props.useForm && { onSubmit })
330
- }
331
- }
332
- })
333
-
334
- const hasRenderFunction = computed(() => {
335
- const description = props.description
336
-
337
- return typeof description === 'object' && description !== null && !Array.isArray(description)
338
- })
339
-
340
- const descriptionComponent = computed(() => hasRenderFunction.value ? props.description : 'div')
341
-
342
- // functions
343
- function submitHandler () {
344
- if (!props.useForm) return
345
-
346
- if (props.useValidationAllAtOnce) {
347
- let isAllComponentValid = true
348
- const components = form.value.getValidationComponents() || []
349
-
350
- for (const component of components) {
351
- const isValid = component?.validate?.()
352
-
353
- if (!isValid) {
354
- isAllComponentValid = false
355
- }
356
- }
357
-
358
- emit('validate', isAllComponentValid)
359
-
360
- return
361
- }
362
-
363
- emit('validate', form.value.validate())
364
- }
365
-
366
- /**
367
- * Sem este método, ao clicar enter com a prop useForm ativada a tela era recarregada,
368
- * e a ação de click do botão não era chamada pois ele não esta dentro do form.
369
- */
370
- function onSubmit (event) {
371
- event.preventDefault()
372
-
373
- if (hasOk.value) {
374
- onOk()
375
- submitHandler()
376
- }
192
+ ...props.actionsProps
377
193
  }
194
+ })
378
195
 
379
- return {
380
- mainComponent,
381
- descriptionComponent
382
- }
196
+ function updateModelValue (value) {
197
+ emit('update:modelValue', value)
383
198
  }
384
199
  </script>
385
200
 
386
201
  <style lang="scss">
387
202
  .qas-dialog {
388
- $root: &;
389
-
390
203
  .q-dialog__inner > div {
391
204
  box-shadow: $shadow-2;
392
205
  }
393
206
 
394
- .q-dialog__inner--minimized {
395
- padding: var(--qas-spacing-md);
396
- }
397
-
398
207
  &--right {
399
208
  .q-dialog__inner {
400
209
  width: 100%;
@@ -407,39 +216,5 @@ function useDynamicComponents () {
407
216
  width: 100%;
408
217
  }
409
218
  }
410
-
411
- // tamanhos
412
- &--sm {
413
- #{$root}__container {
414
- max-width: 450px !important;
415
- }
416
- }
417
-
418
- &--md {
419
- #{$root}__container {
420
- max-width: 550px !important;
421
- }
422
- }
423
-
424
- &--lg {
425
- #{$root}__container {
426
- max-width: 800px !important;
427
- }
428
- }
429
-
430
- &--xl {
431
- #{$root}__container {
432
- max-width: 1100px !important;
433
- }
434
- }
435
-
436
- // tamanho mínimo dos botões de ação (primário e secundário)
437
- &__actions {
438
- .qas-btn--primary,
439
- .qas-btn--secondary {
440
- min-width: 120px;
441
- width: 100%;
442
- }
443
- }
444
219
  }
445
220
  </style>
@@ -4,10 +4,10 @@ meta:
4
4
  desc: Componente de dialog.
5
5
 
6
6
  props:
7
- badges:
8
- desc: Badges que aparecem no canto superior direito do dialog.
9
- type: [Array, Object]
10
- default: []
7
+ actions-props:
8
+ desc: Props repassadas para o "QasActions".
9
+ default: {}
10
+ type: Object
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,13 +15,19 @@ props:
15
15
  type: [Object, Boolean]
16
16
  examples: ["{ label: 'Meu botão de cancelar', onClick: () => alert('fui clicado!') }"]
17
17
 
18
- description:
19
- desc: Descrição do dialog, pode ser uma string, um componente ou uma string com HTML (passando a prop useHtmlDescription).
20
- type: [String, Object]
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' }"]
21
23
 
22
- disable-close-button:
23
- desc: Define se o botão de fechar no canto superior direito estará desabilitado.
24
- type: Boolean
24
+ max-width:
25
+ desc: Tamanho máximo do dialog.
26
+ type: String
27
+
28
+ min-width:
29
+ desc: Tamanho mínimo do dialog.
30
+ type: String
25
31
 
26
32
  model-value:
27
33
  desc: Model do componente, abre ou fecha o dialog.
@@ -36,49 +42,27 @@ props:
36
42
  type: [Object, Boolean]
37
43
  examples: ["{ label: 'Meu botão de confirmar', onClick: () => alert('fui clicado!') }"]
38
44
 
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-cancel:
46
- desc: Define se o dialog vai fechar automaticamente ao clicar no botão de cancelar.
47
- type: Boolean
48
- default: true
49
-
50
- use-auto-close-on-ok:
51
- desc: Define se o dialog vai fechar automaticamente ao clicar no botão de confirmar (ok).
52
- type: Boolean
45
+ persistent:
46
+ desc: Define se o dialog vai fechar ou não após clicar fora do dialog.
53
47
  default: true
54
-
55
- use-close-button:
56
- desc: Define se o dialog vai ter um botão de fechar no canto superior direito.
57
48
  type: Boolean
58
49
 
59
50
  use-form:
60
51
  desc: Define se a tag onde fica a descrição no dialog vai ser um "<q-form />" ou "<div />".
61
52
  type: Boolean
62
53
 
63
- use-html-description:
64
- desc: Define se a descrição aceita HTML (utilize com cuidado para evitar XSS).
54
+ use-full-max-width:
55
+ desc: propriedade para utilizar `100% do maxWidth`.
65
56
  type: Boolean
66
57
 
67
58
  use-validation-all-at-once:
68
59
  desc: Valida todos os campos de uma única vez, ao invés de ser um por vez (que é o padrão).
69
60
  type: Boolean
70
61
 
71
- tertiary:
72
- desc: Props para o botão terciário
73
- type: Object
74
- default: {}
75
-
76
- title:
77
- desc: Título do dialog.
78
- type: String
79
- required: true
80
-
81
62
  slots:
63
+ actions:
64
+ desc: Slot para ações (botões por exemplo).
65
+
82
66
  description:
83
67
  desc: Slot para descrição.
84
68
 
@@ -120,10 +104,6 @@ selectors:
120
104
  desc: Seletor do botão de cancelar do componente.
121
105
  examples: ['data-cy="dialog-cancel-btn"']
122
106
 
123
- dialog-tertiary-btn:
124
- desc: Seletor do botão terciário do componente.
125
- examples: ['data-cy="dialog-tertiary-btn"']
126
-
127
107
  dialog-close-btn:
128
108
  desc: Seletor do botão de fechar do componente.
129
109
  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
- 'data-cy': 'dialog-cancel-btn',
18
+ outline: true,
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.description
38
+ const description = props.card.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.description : 'div')
43
+ const descriptionComponent = computed(() => hasRenderFunction.value ? props.card.description : 'div')
44
44
 
45
45
  // métodos
46
46
  function submitHandler () {
@@ -18,7 +18,6 @@ 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',
22
21
 
23
22
  ...attrs,
24
23
 
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <qas-dialog v-model="model" class="qas-drawer" v-bind="attributes">
2
+ <qas-dialog class="qas-drawer" v-bind="attributes" @update:model-value="onUpdateModelValue">
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 class="z-max" color="grey-10" data-cy="drawer-close-btn" icon="sym_r_close" variant="tertiary" @click="close" />
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)" />
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, provide } from 'vue'
43
+ import { computed, useAttrs } from 'vue'
44
44
 
45
45
  defineOptions({
46
46
  name: 'QasDrawer',
@@ -58,10 +58,6 @@ const props = defineProps({
58
58
  default: '60%'
59
59
  },
60
60
 
61
- persistent: {
62
- type: Boolean
63
- },
64
-
65
61
  position: {
66
62
  type: String,
67
63
  default: 'left',
@@ -78,10 +74,9 @@ const props = defineProps({
78
74
  }
79
75
  })
80
76
 
81
- // emits
82
- const model = defineModel({ type: Boolean })
77
+ const emit = defineEmits(['update:modelValue'])
83
78
 
84
- // composables
79
+ const attrs = useAttrs()
85
80
  const screen = useScreen()
86
81
 
87
82
  // computed
@@ -94,31 +89,25 @@ const loadingStyle = computed(() => {
94
89
  })
95
90
 
96
91
  const attributes = computed(() => {
92
+ const { modelValue } = attrs
93
+
97
94
  return {
95
+ persistent: false,
96
+ modelValue,
97
+
98
98
  ...props.dialogProps,
99
99
 
100
- title: props.title,
101
100
  cancel: false,
101
+ maxWidth: normalizedMaxWidth.value,
102
102
  maximized: true,
103
103
  ok: false,
104
- position: props.position
104
+ position: props.position,
105
+ useFullMaxWidth: true
105
106
  }
106
107
  })
107
108
 
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
109
+ function onUpdateModelValue (value) {
110
+ emit('update:modelValue', value)
122
111
  }
123
112
  </script>
124
113
 
@@ -20,11 +20,6 @@ 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
-
28
23
  position:
29
24
  desc: 'Posição do drawer, sendo possível apenas 2 opções: [left, right].'
30
25
  default: left
@@ -190,9 +190,9 @@ export default {
190
190
  ignoreRouterGuard: false,
191
191
 
192
192
  defaultDialogProps: {
193
- title: 'Alterações não salvas',
194
- description: 'Você está deixando a página e suas alterações serão perdidas. Tem certeza que deseja sair sem salvar?',
195
- size: 'md',
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
+ },
196
196
 
197
197
  ok: { label: 'Continuar editando' },
198
198
 
@@ -28,8 +28,9 @@ export default function useDelete ({ props, destroyFn, emit }) {
28
28
 
29
29
  const defaultDialogProps = computed(() => {
30
30
  return {
31
- title: 'Excluir',
32
- description: 'Tem certeza que deseja excluir este item?',
31
+ card: {
32
+ description: 'Tem certeza que deseja excluir este item?'
33
+ },
33
34
 
34
35
  ok: {
35
36
  label: 'Excluir',
@@ -1,6 +1,12 @@
1
1
  <template>
2
2
  <div class="pv-gallery-carousel-dialog">
3
- <qas-dialog v-model="model" v-bind="dialogProps">
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
+
4
10
  <template #description>
5
11
  <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">
6
12
  <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">
@@ -46,13 +52,6 @@ const screen = useScreen()
46
52
 
47
53
  const carouselImageHeight = 'calc((500/976) * 100vh)'
48
54
 
49
- const dialogProps = {
50
- cancel: false,
51
- ok: false,
52
- size: 'xl',
53
- title: 'Galeria de imagens'
54
- }
55
-
56
55
  const model = computed({
57
56
  get () {
58
57
  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 normalizedBadges" :key="badgeIndex">
18
+ <div v-for="(badge, badgeIndex) in props.badges" :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, Object],
76
+ type: Array,
77
77
  default: () => []
78
78
  },
79
79
 
@@ -203,15 +203,13 @@ 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
-
208
206
  const hasActionsComponent = computed(() => {
209
207
  return hasDefaultButton.value || hasDefaultActionsMenu.value || hasDefaultFilters.value
210
208
  })
211
209
 
212
210
  const hasActionsSection = computed(() => !!slots.actions || hasActionsComponent.value)
213
211
 
214
- const hasBadges = computed(() => !!normalizedBadges.value.length)
212
+ const hasBadges = computed(() => !!props.badges.length)
215
213
  const hasLabel = computed(() => !!Object.keys(props.labelProps).length)
216
214
  const hasDefaultButton = computed(() => !!Object.keys(props.buttonProps).length)
217
215
  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, Object]
15
+ type: Array
16
16
 
17
17
  button-props:
18
18
  desc: Propriedades do QasBtn.
@@ -54,7 +54,7 @@
54
54
 
55
55
  <template #description>
56
56
  <slot name="dialog-description">
57
- <div v-if="dialogDescription" class="q-mb-md">
57
+ <div v-if="dialogDescription" class="q-mb-xl text-center">
58
58
  {{ dialogDescription }}
59
59
  </div>
60
60
 
@@ -342,8 +342,8 @@ function useSelectDialog () {
342
342
 
343
343
  const defaultDialogProps = computed(() => {
344
344
  return {
345
- size: 'md',
346
- title: 'Adicionar itens',
345
+ useFullMaxWidth: true,
346
+
347
347
  ...props.dialogProps,
348
348
 
349
349
  onBeforeShow: event => {
@@ -3,8 +3,12 @@
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
+
6
10
  <template #description>
7
- <div>
11
+ <div :style="signaturePadWidth">
8
12
  <qas-signature-pad ref="signaturePadModal" v-model:empty="isEmpty" :height="signaturePadHeight" />
9
13
  </div>
10
14
  </template>
@@ -78,11 +82,10 @@ export default {
78
82
 
79
83
  defaultDialogProps () {
80
84
  return {
81
- title: 'Assinatura digital',
82
- size: 'md',
85
+ maxWidth: '620px',
83
86
  ...this.dialogProps,
84
87
  ok: {
85
- label: 'Assinar',
88
+ label: 'Salvar',
86
89
  onClick: () => this.getSignatureData()
87
90
  }
88
91
  }
@@ -108,6 +111,16 @@ export default {
108
111
  return sizes.true
109
112
  },
110
113
 
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
+
111
124
  uploaderScope () {
112
125
  return this.$refs?.uploader?.uploader
113
126
  }
@@ -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" size="md">
22
+ <qas-dialog v-model="show" v-bind="defaultProps" aria-label="Diálogo de texto completo" role="dialog">
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,8 +225,10 @@ function useDialog ({ props, textContent }) {
225
225
 
226
226
  ...props.dialogProps,
227
227
 
228
- title: props.dialogTitle,
229
- description: description.value
228
+ card: {
229
+ title: props.dialogTitle,
230
+ description: description.value
231
+ }
230
232
  }
231
233
  })
232
234
 
@@ -186,9 +186,9 @@ export default {
186
186
 
187
187
  destroyDialogConfig () {
188
188
  return {
189
- title: 'Excluir',
190
- description: 'Todas as informações serão perdidas. Deseja realmente continuar?',
191
- size: 'md',
189
+ card: {
190
+ description: 'Todas as informações serão perdidas. Deseja realmente continuar?'
191
+ },
192
192
  ok: {
193
193
  label: 'Excluir',
194
194
  onClick: this.destroy
@@ -201,7 +201,9 @@ export default {
201
201
 
202
202
  formDialogConfig () {
203
203
  return {
204
- title: this.isAdd ? 'Adicionar ramo' : 'Editar ramo',
204
+ card: {
205
+ title: this.isAdd ? 'Adicionar ramo' : 'Editar ramo'
206
+ },
205
207
  ok: {
206
208
  label: 'Salvar',
207
209
  loading: this.isSubmitting
@@ -317,17 +317,7 @@ export default {
317
317
  } = this.$props
318
318
 
319
319
  return {
320
- dialogProps: {
321
- title: 'Editar arquivo',
322
-
323
- ok: {
324
- label: 'Salvar',
325
- ...dialogProps.ok
326
- },
327
-
328
- ...dialogProps
329
- },
330
-
320
+ dialogProps,
331
321
  fields,
332
322
  formGeneratorProps,
333
323
  galleryCardProps,
@@ -21,13 +21,17 @@ export default function (config = {}) {
21
21
  const { entity, id, url } = deleteActionParams
22
22
 
23
23
  const defaultDialogProps = {
24
- useAutoCloseOnOk: false,
25
-
26
- title: 'Excluir',
27
- description: 'Tem certeza que deseja excluir este item?',
24
+ useForm: true,
28
25
 
29
26
  ...dialogProps,
30
27
 
28
+ card: {
29
+ title: 'Excluir',
30
+ description: 'Tem certeza que deseja excluir este item?',
31
+
32
+ ...dialogProps.card
33
+ },
34
+
31
35
  ok: {
32
36
  label: 'Excluir',
33
37
  onClick: () => destroy.call(this),