@bildvitta/quasar-ui-asteroid 3.8.0-beta.7 → 3.9.0-beta.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.8.0-beta.7",
4
+ "version": "3.9.0-beta.0",
5
5
  "author": "Bild & Vitta <systemteam@bild.com.br>",
6
6
  "license": "MIT",
7
7
  "main": "dist/asteroid.cjs.min.js",
@@ -73,6 +73,10 @@ export default {
73
73
  useLabel: {
74
74
  default: true,
75
75
  type: Boolean
76
+ },
77
+
78
+ useTooltip: {
79
+ type: Boolean
76
80
  }
77
81
  },
78
82
 
@@ -136,7 +140,7 @@ export default {
136
140
  },
137
141
 
138
142
  hasTooltip () {
139
- return !this.isBtnDropdown && !this.useLabel
143
+ return !this.isBtnDropdown && !this.useLabel && this.useTooltip
140
144
  },
141
145
 
142
146
  tooltipLabel () {
@@ -45,6 +45,9 @@ props:
45
45
  type: String
46
46
  examples: [visibility]
47
47
 
48
+ use-tooltip:
49
+ desc: Controla se vai ter o tooltip caso passe nas regras de exibição de tooltip
50
+
48
51
  use-label:
49
52
  desc: Habilita ou não o label no botão.
50
53
  default: true
@@ -3,23 +3,11 @@
3
3
  <div class="qas-gallery">
4
4
  <div class="q-col-gutter-md row">
5
5
  <div v-for="(image, index) in getInitialImages()" :key="index" :class="galleryColumnsClasses" :data-cy="`gallery-image-${index}`">
6
- <div class="bg-white q-pa-md rounded-borders shadow-2">
7
- <div class="flat items-center justify-between no-wrap q-mb-xs row text-grey-9">
8
- <div class="ellipsis q-mr-xs qas-gallery__name">
9
- <slot v-if="image.name" :image="image" :index="index" name="header">
10
- {{ image.name }}
11
- </slot>
12
- </div>
13
-
14
- <div v-if="useDestroy">
15
- <slot :destroy="onDestroy" :image="image" :index="index" name="destroy">
16
- <qas-btn color="grey-9" :disabled="isDestroyDisabled(image)" icon="sym_r_delete" variant="tertiary" @click="onDestroy(image, index)" />
17
- </slot>
18
- </div>
19
- </div>
20
-
21
- <q-img class="cursor-pointer rounded-borders" height="150px" :src="image.url" @click="toggleCarouselDialog(index)" @error="onError(image.url)" />
22
- </div>
6
+ <qas-gallery-card v-bind="getGalleryCardProps({ image, index })">
7
+ <template v-for="(_, name) in $slots" #[name]="context">
8
+ <slot v-bind="context" :image="image" :index="index" :name="name" />
9
+ </template>
10
+ </qas-gallery-card>
23
11
  </div>
24
12
 
25
13
  <slot>
@@ -64,6 +52,11 @@ export default {
64
52
  default: 'sym_r_chevron_left'
65
53
  },
66
54
 
55
+ galleryCardProps: {
56
+ type: Object,
57
+ default: () => ({})
58
+ },
59
+
67
60
  initialSize: {
68
61
  type: Number,
69
62
  default: 4,
@@ -184,6 +177,46 @@ export default {
184
177
  }
185
178
  },
186
179
 
180
+ getGalleryCardProps ({ image, index }) {
181
+ return {
182
+ card: image,
183
+ imageProps: this.getImageProps({ image, index }),
184
+ actionsMenuProps: this.getActionsMenuProps({ image, index }),
185
+ ...this.galleryCardProps
186
+ }
187
+ },
188
+
189
+ getActionsMenuProps ({ image, index }) {
190
+ if (!this.useDestroy) return {}
191
+
192
+ return {
193
+ useLabel: false,
194
+
195
+ buttonProps: {
196
+ disable: this.isDestroyDisabled(image)
197
+ },
198
+
199
+ list: {
200
+ destroy: {
201
+ label: 'Excluir',
202
+ color: 'grey-9',
203
+ icon: 'sym_r_delete',
204
+
205
+ handler: () => this.onDestroy(image, index)
206
+ }
207
+ }
208
+ }
209
+ },
210
+
211
+ getImageProps ({ image, index }) {
212
+ return {
213
+ class: 'cursor-pointer',
214
+
215
+ onClick: () => this.toggleCarouselDialog(index),
216
+ onError: () => this.onError(image.url)
217
+ }
218
+ },
219
+
187
220
  getInitialImages () {
188
221
  return this.useLoadAll
189
222
  ? this.normalizedImages
@@ -230,13 +263,3 @@ export default {
230
263
  }
231
264
  }
232
265
  </script>
233
-
234
- <!-- TODO rever tipografia -->
235
- <style lang="scss">
236
- .qas-gallery {
237
- &__name {
238
- font-size: 16px;
239
- font-weight: 600;
240
- }
241
- }
242
- </style>
@@ -21,6 +21,11 @@ props:
21
21
  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" (utilizado para remover imagem).
22
22
  type: String
23
23
 
24
+ gallery-card-props:
25
+ desc: Propriedades repassadas para o QasGalleryCard
26
+ default: {}
27
+ type: Object
28
+
24
29
  initial-size:
25
30
  desc: Quantidade de imagens iniciais.
26
31
  default: 6
@@ -61,17 +66,39 @@ props:
61
66
  type: Boolean
62
67
 
63
68
  slots:
69
+ actions:
70
+ desc: Slot para ações do cabeçalho.
71
+ scope:
72
+ index:
73
+ desc: index atual.
74
+ default: 0
75
+ type: Number
76
+
77
+ image:
78
+ desc: imagem atual.
79
+ default: {}
80
+ type: Object
81
+
82
+ bottom:
83
+ desc: Slot para acessar o conteúdo abaixo da imagem.
84
+ scope:
85
+ index:
86
+ desc: index atual.
87
+ default: 0
88
+ type: Number
89
+
90
+ image:
91
+ desc: imagem atual.
92
+ default: {}
93
+ type: Object
94
+
95
+
64
96
  default:
65
97
  desc: Slot para todo conteúdo onde fica o botão "mostrar mais".
66
98
 
67
- destroy:
68
- desc: Slot para o ícone de remover.
99
+ image:
100
+ desc: Slot para acessar o conteúdo da imagem (onde fica o QasGridGenerator).
69
101
  scope:
70
- destroy:
71
- desc: Função para remover e atualizar o model.
72
- default: undefined
73
- type: Function
74
-
75
102
  index:
76
103
  desc: index atual.
77
104
  default: 0
@@ -83,7 +110,20 @@ slots:
83
110
  type: Object
84
111
 
85
112
  header:
86
- desc: Slot para o header.
113
+ desc: Slot para acessar o conteúdo do cabeçalho.
114
+ scope:
115
+ index:
116
+ desc: index atual.
117
+ default: 0
118
+ type: Number
119
+
120
+ image:
121
+ desc: imagem atual.
122
+ default: {}
123
+ type: Object
124
+
125
+ name:
126
+ desc: Slot para acessar o conteúdo do nome, acima da imagem.
87
127
  scope:
88
128
  index:
89
129
  desc: index atual.
@@ -1,16 +1,17 @@
1
- <!-- TODO: componente adaptado somente para o uso do QasUploader, precisa ser revisitado para ser implementado no QasGallery -->
2
1
  <template>
3
2
  <div class="bg-white q-pa-md qas-gallery-card rounded-borders shadow-2" :class="classes">
4
- <header class="flat items-center no-wrap q-mb-md row" :class="headerClasses">
3
+ <header class="flat items-center no-wrap row" :class="headerClasses">
5
4
  <slot name="header">
6
- <div class="ellipsis q-mr-xs qas-gallery__name">
5
+ <div class="ellipsis q-mr-xs qas-gallery__name text-subtitle1">
7
6
  <slot v-if="card.name" name="name">
8
7
  {{ card.name }}
9
8
  </slot>
10
9
  </div>
11
10
 
12
- <div v-if="hasActionsMenu">
13
- <qas-actions-menu v-bind="defaultActionsMenuProps" />
11
+ <div v-if="hasActions">
12
+ <slot name="actions">
13
+ <qas-actions-menu v-bind="defaultActionsMenuProps" />
14
+ </slot>
14
15
  </div>
15
16
  </slot>
16
17
  </header>
@@ -84,8 +85,12 @@ export default {
84
85
  }
85
86
  },
86
87
 
87
- hasActionsMenu () {
88
- return !!Object.keys(this.actionsMenuProps).length
88
+ hasActions () {
89
+ return !!Object.keys(this.actionsMenuProps).length || this.hasActionsSlot
90
+ },
91
+
92
+ hasActionsSlot () {
93
+ return !!this.$slots.actions
89
94
  },
90
95
 
91
96
  hasBottom () {
@@ -100,7 +105,8 @@ export default {
100
105
  return {
101
106
  'justify-between': this.card.name,
102
107
  'justify-right': !this.card.name,
103
- 'text-grey-9': !this.disable
108
+ 'text-grey-9': !this.disable,
109
+ 'q-mb-md': this.hasActions || this.card.name
104
110
  }
105
111
  }
106
112
  }
@@ -29,6 +29,9 @@ props:
29
29
  type: Object
30
30
 
31
31
  slots:
32
+ actions:
33
+ desc: Slot para ações do cabeçalho.
34
+
32
35
  bottom:
33
36
  desc: Slot para acessar o conteúdo abaixo da imagem.
34
37
 
@@ -70,6 +70,10 @@ export default {
70
70
  type: Boolean
71
71
  },
72
72
 
73
+ useAutoRefetchOnDelete: {
74
+ type: Boolean
75
+ },
76
+
73
77
  useRefresh: {
74
78
  default: true,
75
79
  type: Boolean
@@ -100,6 +104,10 @@ export default {
100
104
  },
101
105
 
102
106
  computed: {
107
+ hasDeleteEventListener () {
108
+ return this.useAutoHandleOnDelete || this.useAutoRefetchOnDelete
109
+ },
110
+
103
111
  hasHeaderSlot () {
104
112
  return !!this.$slots.header
105
113
  },
@@ -153,13 +161,13 @@ export default {
153
161
  },
154
162
 
155
163
  mounted () {
156
- if (!this.useAutoHandleOnDelete) return
164
+ if (!this.hasDeleteEventListener) return
157
165
 
158
166
  window.addEventListener('delete-success', this.onDeleteResult)
159
167
  },
160
168
 
161
169
  unmounted () {
162
- if (!this.useAutoHandleOnDelete) return
170
+ if (!this.hasDeleteEventListener) return
163
171
 
164
172
  window.removeEventListener('delete-success', this.onDeleteResult)
165
173
  },
@@ -235,7 +243,7 @@ export default {
235
243
  this.page = parseInt(this.$route.query.page || 1)
236
244
  },
237
245
 
238
- onDeleteResult ({ detail: { entity } }) {
246
+ onAutoHandleDelete ({ detail: { entity } }) {
239
247
  const { page } = this.mx_context
240
248
 
241
249
  /*
@@ -269,6 +277,15 @@ export default {
269
277
  * ex: estou na pagina 2 e existem 3 paginas, removo um item da pagina 2, então chamo o método fetchList
270
278
  */
271
279
  this.mx_fetchHandler({ ...this.mx_context, url: this.url }, this.fetchList)
280
+ },
281
+
282
+ onDeleteResult (event) {
283
+ if (this.useAutoRefetchOnDelete) {
284
+ this.mx_fetchHandler({ ...this.mx_context, url: this.url }, this.fetchList)
285
+ return
286
+ }
287
+
288
+ this.onAutoHandleDelete(event)
272
289
  }
273
290
  }
274
291
  }
@@ -62,6 +62,10 @@ props:
62
62
  desc: Controla se o componente vai lidar automaticamente quando acontecer algum delete compatível com a listagem.
63
63
  type: Boolean
64
64
 
65
+ use-auto-refetch-on-delete:
66
+ desc: Controla se o componente vai fazer o fetch novamente quando acontecer algum delete compatível com a listagem.
67
+ type: Boolean
68
+
65
69
  use-boundary:
66
70
  desc: Controla o limite que o FormView terá, quando é "false", a tag pai deixa de ser um "QPage" para ser uma "div" e é removido as classes "container" e "spaced", comumente utilizando quando precisa usar o QasFormView dentro de um dialog.
67
71
  default: true
@@ -6,9 +6,9 @@ export default async (text, onLoading = () => {}) => {
6
6
 
7
7
  try {
8
8
  await copyToClipboard(text)
9
- NotifySuccess('Copiado!', text)
9
+ NotifySuccess('Item copiado com sucesso.')
10
10
  } catch {
11
- NotifyError('Não foi possível copiar.', text)
11
+ NotifyError('Não foi possível copiar o item.')
12
12
  } finally {
13
13
  setTimeout(() => { onLoading(false) }, 500)
14
14
  }