@tagplus/components 2.0.10 → 2.0.14

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
@@ -8,7 +8,7 @@
8
8
  "email": "bruno@tagplus.com.br"
9
9
  }
10
10
  ],
11
- "version": "2.0.10",
11
+ "version": "2.0.14",
12
12
  "main": "./dist/tp.common.js",
13
13
  "directories": {
14
14
  "lib": "src/lib"
@@ -298,14 +298,17 @@ export default {
298
298
  */
299
299
  formatedValue () {
300
300
  let newVal = ''
301
-
302
301
  if (typeof this.value === 'boolean') {
303
302
  newVal = ''
304
303
  } else if (Array.isArray(this.value)) {
305
304
  newVal = this.value
306
305
  } else if (this.value && typeof this.value === 'object') {
306
+ if (!Object.keys(newVal).length) { return {} }
307
307
  if (!this.value[this.valueKey]) {
308
308
  if (process.env.DEBUG === 'true') {
309
+ console.error(
310
+ `formatedValue this.value '${this.value}'`
311
+ )
309
312
  console.error(
310
313
  `Autosuggest '${this.$options.name}' option doesn't have a valueKey '${this.valueKey}' key`
311
314
  )
@@ -484,14 +487,17 @@ export default {
484
487
  getOption (val) {
485
488
  let value = ''
486
489
  let initialLabel = false
487
-
488
490
  if (typeof this.value === 'boolean') {
489
491
  value = ''
490
492
  } else if (Array.isArray(val)) {
491
493
  value = val
492
494
  } else if (val && typeof val === 'object') {
495
+ if (!Object.keys(val).length) { return {} }
493
496
  // Se val for Object converte para outro tipo
494
497
  if (!this.value[this.valueKey]) {
498
+ console.error(
499
+ ` getOption this.value '${this.value}'`
500
+ )
495
501
  console.error(
496
502
  `Autosuggest '${this.$options.name}' option doesn't have a valueKey '${this.valueKey}' key`
497
503
  )
@@ -361,7 +361,6 @@ export default {
361
361
  */
362
362
  formatedValue () {
363
363
  let newVal = ''
364
-
365
364
  if (typeof this.value === 'boolean') {
366
365
  newVal = ''
367
366
  } else if (Array.isArray(this.value)) {
@@ -444,8 +443,8 @@ export default {
444
443
  this.selectedLabelsArray.push(item)
445
444
  }
446
445
  })
447
- } else {
448
- const itemApagado = oldValue.filter(x => !newValue.includes(x))
446
+ } else if (newValue && Object.keys(newValue).length) {
447
+ const itemApagado = oldValue.filter(x => !newValue?.includes(x))
449
448
 
450
449
  this.selectedLabelsArray.forEach((item, index) => {
451
450
  if (item.id === itemApagado[0]) {
@@ -563,6 +562,7 @@ export default {
563
562
  } else if (Array.isArray(val)) {
564
563
  value = val
565
564
  } else if (val && typeof val === 'object') {
565
+ if (!Object.keys(val).length) { return {} }
566
566
  // Se val for Object converte para outro tipo
567
567
  if (!val[this.valueKey]) {
568
568
  console.error(`Multisuggest '${this.$options.name}' option doesn't have a valueKey '${this.valueKey}' key`)