@bildvitta/quasar-ui-asteroid 3.12.0-beta.9 → 3.12.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.12.0-beta.9",
4
+ "version": "3.12.0",
5
5
  "author": "Bild & Vitta <systemteam@bild.com.br>",
6
6
  "license": "MIT",
7
7
  "main": "dist/asteroid.cjs.min.js",
@@ -243,7 +243,7 @@ function useList () {
243
243
 
244
244
  model.value.push(...newModel)
245
245
 
246
- emit('add', newModel)
246
+ emit('add', normalizedItems)
247
247
 
248
248
  updateModel()
249
249
  }
@@ -76,21 +76,21 @@ slots:
76
76
  desc: Slot para substituir cabeçalho do dialog.
77
77
 
78
78
  events:
79
- 'add -> function(list)':
79
+ '@add -> function(items)':
80
80
  desc: Dispara toda vez que é adicionado novos itens.
81
81
  params:
82
- list:
82
+ items:
83
83
  desc: Lista de itens adicionados.
84
84
  type: Array
85
85
 
86
- 'remove -> function(value)':
86
+ '@remove -> function(value)':
87
87
  desc: Dispara toda vez que é removido um item.
88
88
  params:
89
89
  value:
90
90
  desc: Valor do item (uuid/id/slug).
91
91
  type: String
92
92
 
93
- 'update:model-value -> function(list)':
93
+ '@update:model-value -> function(list)':
94
94
  desc: Dispara toda vez que o model é atualizado.
95
95
  params:
96
96
  list:
@@ -154,6 +154,11 @@ export default {
154
154
  type: Number
155
155
  },
156
156
 
157
+ uploadCredentialsParams: {
158
+ type: Object,
159
+ default: () => ({})
160
+ },
161
+
157
162
  uploading: {
158
163
  type: Boolean
159
164
  },
@@ -170,6 +175,11 @@ export default {
170
175
  useResize: {
171
176
  default: true,
172
177
  type: Boolean
178
+ },
179
+
180
+ useUrlPath: {
181
+ type: Boolean,
182
+ default: true
173
183
  }
174
184
  },
175
185
 
@@ -366,7 +376,8 @@ export default {
366
376
  try {
367
377
  const { data } = await this.$axios.post('/upload-credentials/', {
368
378
  entity: this.entity,
369
- filename
379
+ filename,
380
+ ...this.uploadCredentialsParams
370
381
  })
371
382
 
372
383
  return data
@@ -377,7 +388,7 @@ export default {
377
388
  uploadedFiles = uploadedFiles.map((file, indexToDelete) => {
378
389
  return {
379
390
  isUploaded: true,
380
- url: file.xhr ? file.xhr.responseURL.split('?').shift() : '',
391
+ url: file.xhr ? this.getURLValue(file.xhr) : '',
381
392
  name: file.name,
382
393
  indexToDelete,
383
394
  isFailed: this.isFailed(file)
@@ -421,6 +432,16 @@ export default {
421
432
  return value.split('/').pop()
422
433
  },
423
434
 
435
+ /**
436
+ * Caso useUrlPath seja true, retorna de responseURL, senão tenta retornar o response
437
+ * que pode ser um base64, caso não tenha o response, retorna a responseURL.
438
+ */
439
+ getURLValue (xhr) {
440
+ const responseURL = xhr.responseURL.split('?').shift()
441
+
442
+ return this.useUrlPath ? responseURL : (xhr.response || responseURL)
443
+ },
444
+
424
445
  getModelValue (index) {
425
446
  if (!this.useObjectModel) return {}
426
447
 
@@ -571,7 +592,7 @@ export default {
571
592
  uploaded (response) {
572
593
  this.hasError = false
573
594
 
574
- const fullPath = response.xhr.responseURL.split('?').shift()
595
+ const fullPath = this.getURLValue(response.xhr)
575
596
 
576
597
  const objectValue = {
577
598
  format: response.files[0].type,
@@ -33,7 +33,7 @@ props:
33
33
  'image/webp',
34
34
  'image/jpg'
35
35
  ]
36
-
36
+
37
37
  columns:
38
38
  desc: Seta as colunas (grid cols), valor default depende se o componente é múltiplo ou não.
39
39
  default:
@@ -118,6 +118,11 @@ props:
118
118
  default: 1280
119
119
  type: Number
120
120
 
121
+ upload-credentials-params:
122
+ desc: Parâmetros enviados para a API do `/upload-credentials/`.
123
+ default: {}
124
+ type: Object
125
+
121
126
  uploading:
122
127
  desc: Model que retorna se o componente está fazendo algum upload.
123
128
  type: Boolean
@@ -139,6 +144,11 @@ props:
139
144
  default: true
140
145
  type: Boolean
141
146
 
147
+ use-url-path:
148
+ desc: Controla se o componente vai salvar o path url no model ou por exemplo um base64.
149
+ default: true
150
+ type: Boolean
151
+
142
152
  slots:
143
153
  header:
144
154
  desc: Acesso ao header do <q-uploader />.