@tagplus/components 4.7.13 → 4.7.16

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.13",
11
+ "version": "4.7.16",
12
12
  "main": "./dist/tp.common.js",
13
13
  "directories": {
14
14
  "lib": "src/lib"
@@ -327,10 +327,7 @@ export default {
327
327
 
328
328
  return this.filterable && this.allowCreate && !hasExistingOption
329
329
  },
330
- // Monta a lista com ou sem "Cadastrar Novo Item"
331
- suggestionsList () {
332
- if (this.loading) return []
333
-
330
+ rawSuggestionsList () {
334
331
  // transformando em Array
335
332
  const list =
336
333
  typeof this.suggestions === 'object'
@@ -347,6 +344,12 @@ export default {
347
344
 
348
345
  return list
349
346
  },
347
+ // Monta a lista com ou sem "Cadastrar Novo Item"
348
+ suggestionsList () {
349
+ if (this.loading) return []
350
+
351
+ return this.rawSuggestionsList
352
+ },
350
353
 
351
354
  emptyText () {
352
355
  if (this.loading) {
@@ -478,6 +481,11 @@ export default {
478
481
  }
479
482
  },
480
483
 
484
+ /** Atualiza a label de algum dos elementos da listagem do altosuggest */
485
+ atualizarLabelOpcao (index, val) {
486
+ this.rawSuggestionsList[index].label = val
487
+ },
488
+
481
489
  /**
482
490
  * Sobrescreve o getOption do select para mostrar o labelValue em vez do idValue
483
491
  */
@@ -519,13 +527,16 @@ export default {
519
527
 
520
528
  for (let i = 0; i <= this.cachedOptions.length - 1; i++) {
521
529
  const cachedOption = this.cachedOptions[i]
530
+
522
531
  let isEqual = false
532
+
523
533
  if (isObject) {
524
534
  isEqual = getValueByPath(cachedOption.value, this.valueKey) === getValueByPath(value, this.valueKey)
525
535
  } else {
526
536
  isEqual = cachedOption.value === value
527
- if (initialLabel) {
528
- cachedOption.label = initialLabel
537
+
538
+ if (initialLabel && isEqual) {
539
+ this.atualizarLabelOpcao(i, initialLabel)
529
540
  }
530
541
  }
531
542