@tagplus/components 1.2.11 → 1.2.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": "1.2.11",
11
+ "version": "1.2.14",
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,24 +477,7 @@ export default {
473
477
  }
474
478
  })
475
479
 
476
- if (Array.isArray(this.value)) {
477
- this.value.forEach((item, key) => {
478
- this.suggestionsList.forEach(suggestion => {
479
- if (suggestion[this.valueKey] === item) {
480
- this.selectedLabelsArray.push(suggestion)
481
- }
482
- })
483
- })
484
- } else if (process.env.DEBUG === 'true') {
485
- console.log(`'${this.$options.name}' recebeu valor em formato inválido.`)
486
- console.log(this.value)
487
- }
488
-
489
- this.selectedLabels = this.selectedLabelsArray
490
- .map(item => {
491
- return item[this.labelKey]
492
- })
493
- .join(', ')
480
+ this.setSelectedLabel()
494
481
  },
495
482
 
496
483
  beforeMount () {
@@ -515,6 +502,26 @@ export default {
515
502
  }
516
503
  },
517
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
+
518
525
  // eslint-disable-next-line no-unused-vars
519
526
  clearTags (event) {
520
527
  // Faz uma requisição limpa
@@ -1,4 +1,5 @@
1
- import { messages } from 'tp-ui/locale'
1
+ import { messages, t } from 'tp-ui/locale'
2
+
2
3
  const defaults = messages().locale.number
3
4
 
4
5
  function format (input, opt = defaults) {
@@ -31,7 +32,8 @@ function formatMoney (input, toString = false, precision = defaults.precision) {
31
32
  const numbers = onlyNumbers(input, precision)
32
33
  const currency = numbersToCurrency(numbers, precision)
33
34
  if (toString) {
34
- return negative === -1 ? '-' + currency : '' + currency
35
+ const num = negative === -1 ? '-' + currency : '' + currency
36
+ return num.replaceAll(',', t('locale.number.decimal')).replaceAll('.', t('locale.number.decimal'))
35
37
  } else {
36
38
  return currency * negative
37
39
  }