@tagplus/components 1.2.8 → 1.2.13

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": "1.2.8",
11
+ "version": "1.2.13",
12
12
  "main": "./dist/tp.common.js",
13
13
  "directories": {
14
14
  "lib": "src/lib"
@@ -27,6 +27,7 @@
27
27
  "license": "MIT",
28
28
  "scripts": {
29
29
  "build": "NODE_ENV=production && vue-cli-service build --target lib --name tp ./src/main.js",
30
+ "build:dev": "NODE_ENV=development && vue-cli-service build --mode development --target lib --name tp ./src/main.js",
30
31
  "doc": "yarn docs",
31
32
  "docs": "nodemon --exec \"vuese gen && vuese serve\" --watch ./src -e js,vue,scss",
32
33
  "docs:gen": "vuese gen",
@@ -448,6 +448,10 @@ export default {
448
448
  return item[this.labelKey]
449
449
  })
450
450
  .join(', ')
451
+ },
452
+
453
+ suggestionsList(_newValue, _oldValue){
454
+ this.setSelectedLabel()
451
455
  }
452
456
  },
453
457
 
@@ -473,25 +477,7 @@ export default {
473
477
  }
474
478
  })
475
479
 
476
- if (Array.isArray(this.value)) {
477
- this.value.forEach((item, key) => {
478
- if (item[this.valueKey]) {
479
- this.value[key] = item[this.valueKey]
480
- if (item[this.labelKey]) {
481
- this.selectedLabelsArray.push(item)
482
- }
483
- }
484
- })
485
- } else if (process.env.DEBUG === 'true') {
486
- console.log(`'${this.$options.name}' recebeu valor em formato inválido.`)
487
- console.log(this.value)
488
- }
489
-
490
- this.selectedLabels = this.selectedLabelsArray
491
- .map(item => {
492
- return item[this.labelKey]
493
- })
494
- .join(', ')
480
+ this.setSelectedLabel()
495
481
  },
496
482
 
497
483
  beforeMount () {
@@ -516,6 +502,26 @@ export default {
516
502
  }
517
503
  },
518
504
 
505
+ setSelectedLabel () {
506
+ if (Array.isArray(this.value)) {
507
+ this.value.forEach((item, key) => {
508
+ this.suggestionsList.forEach(suggestion => {
509
+ if (suggestion[this.valueKey] === item) {
510
+ this.selectedLabelsArray.push(suggestion)
511
+ }
512
+ })
513
+ })
514
+ } else if (process.env.DEBUG === 'true') {
515
+ console.log(`'${this.$options.name}' recebeu valor em formato inválido.`)
516
+ }
517
+
518
+ this.selectedLabels = this.selectedLabelsArray
519
+ .map(item => {
520
+ return item[this.labelKey]
521
+ })
522
+ .join(', ')
523
+ },
524
+
519
525
  // eslint-disable-next-line no-unused-vars
520
526
  clearTags (event) {
521
527
  // Faz uma requisição limpa