@tagplus/components 4.7.16 → 4.8.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
@@ -8,7 +8,7 @@
8
8
  "email": "bruno@tagplus.com.br"
9
9
  }
10
10
  ],
11
- "version": "4.7.16",
11
+ "version": "4.8.0",
12
12
  "main": "./dist/tp.common.js",
13
13
  "directories": {
14
14
  "lib": "src/lib"
@@ -279,7 +279,8 @@ export default {
279
279
 
280
280
  data () {
281
281
  return {
282
- tooltipVisible: false
282
+ tooltipVisible: false,
283
+ modifiedLabel: null
283
284
  }
284
285
  },
285
286
 
@@ -327,7 +328,10 @@ export default {
327
328
 
328
329
  return this.filterable && this.allowCreate && !hasExistingOption
329
330
  },
330
- rawSuggestionsList () {
331
+ // Monta a lista com ou sem "Cadastrar Novo Item"
332
+ suggestionsList () {
333
+ if (this.loading) return []
334
+
331
335
  // transformando em Array
332
336
  const list =
333
337
  typeof this.suggestions === 'object'
@@ -344,12 +348,6 @@ export default {
344
348
 
345
349
  return list
346
350
  },
347
- // Monta a lista com ou sem "Cadastrar Novo Item"
348
- suggestionsList () {
349
- if (this.loading) return []
350
-
351
- return this.rawSuggestionsList
352
- },
353
351
 
354
352
  emptyText () {
355
353
  if (this.loading) {
@@ -481,11 +479,6 @@ export default {
481
479
  }
482
480
  },
483
481
 
484
- /** Atualiza a label de algum dos elementos da listagem do altosuggest */
485
- atualizarLabelOpcao (index, val) {
486
- this.rawSuggestionsList[index].label = val
487
- },
488
-
489
482
  /**
490
483
  * Sobrescreve o getOption do select para mostrar o labelValue em vez do idValue
491
484
  */
@@ -527,16 +520,13 @@ export default {
527
520
 
528
521
  for (let i = 0; i <= this.cachedOptions.length - 1; i++) {
529
522
  const cachedOption = this.cachedOptions[i]
530
-
531
523
  let isEqual = false
532
-
533
524
  if (isObject) {
534
525
  isEqual = getValueByPath(cachedOption.value, this.valueKey) === getValueByPath(value, this.valueKey)
535
526
  } else {
536
527
  isEqual = cachedOption.value === value
537
-
538
- if (initialLabel && isEqual) {
539
- this.atualizarLabelOpcao(i, initialLabel)
528
+ if (initialLabel) {
529
+ this.modifiedLabel = initialLabel
540
530
  }
541
531
  }
542
532
 
@@ -551,7 +541,7 @@ export default {
551
541
  const label = !isObject && !isNull && !isUndefined ? value : ''
552
542
  const newOption = {
553
543
  value,
554
- currentLabel: initialLabel || label
544
+ currentLabel: this.modifiedLabel || label
555
545
  }
556
546
 
557
547
  if (this.multiple) {
@@ -560,6 +550,7 @@ export default {
560
550
 
561
551
  return newOption
562
552
  },
553
+
563
554
  checkDefaultFirstOption () {
564
555
  this.$nextTick(() => {
565
556
  this.hoverIndex = -1