@tagplus/components 1.2.5 → 1.2.6

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.5",
11
+ "version": "1.2.6",
12
12
  "main": "./dist/tp.common.js",
13
13
  "directories": {
14
14
  "lib": "src/lib"
@@ -2,7 +2,7 @@
2
2
  <el-input
3
3
  :id="`${_id}`"
4
4
  class="tp-money"
5
- :value="value | formatM"
5
+ :value="formattedValue"
6
6
  v-bind="$attrs"
7
7
  :maxlength="maxlength"
8
8
  @input="input"
@@ -34,11 +34,6 @@ import { formatMoney } from 'tp-ui/utils/currency'
34
34
 
35
35
  export default {
36
36
  name: 'TpMoney',
37
- filters: {
38
- formatM: (val) => {
39
- return formatMoney(val, true)
40
- }
41
- },
42
37
 
43
38
  mixins: [Locale],
44
39
  props: {
@@ -66,6 +61,12 @@ export default {
66
61
  }
67
62
  },
68
63
 
64
+ data () {
65
+ return {
66
+ formattedValue: this.value
67
+ }
68
+ },
69
+
69
70
  computed: {
70
71
  _id () {
71
72
  return this.id || this.$options.name
@@ -78,6 +79,7 @@ export default {
78
79
 
79
80
  methods: {
80
81
  input (evt) {
82
+ this.formattedValue = formatMoney(evt, true)
81
83
  this.$emit('input', formatMoney(evt, false))
82
84
  },
83
85
 
@@ -2,7 +2,7 @@
2
2
  <el-input
3
3
  :id="`${_id}`"
4
4
  class="tp-percent"
5
- :value="value | formatM"
5
+ :value="formattedValue"
6
6
  v-bind="$attrs"
7
7
  :maxlength="maxlength"
8
8
  @input="input"
@@ -26,16 +26,10 @@
26
26
 
27
27
  <script>
28
28
  import Locale from 'tp-ui/mixins/locale'
29
- import { formatMoney } from 'tp-ui/utils/filters'
30
- import { unformat } from 'tp-ui/utils/currency'
29
+ import { formatMoney } from 'tp-ui/utils/currency'
31
30
 
32
31
  export default {
33
32
  name: 'TpPercent',
34
- filters: {
35
- formatM: (val) => {
36
- return formatMoney(val, true)
37
- }
38
- },
39
33
  mixins: [Locale],
40
34
  props: {
41
35
  id: {
@@ -69,6 +63,12 @@ export default {
69
63
  }
70
64
  },
71
65
 
66
+ data () {
67
+ return {
68
+ formattedValue: this.value
69
+ }
70
+ },
71
+
72
72
  computed: {
73
73
  _id () {
74
74
  return this.id || this.$options.name
@@ -77,11 +77,12 @@ export default {
77
77
 
78
78
  methods: {
79
79
  input (evt) {
80
- this.$emit('input', formatMoney(evt))
80
+ this.formattedValue = formatMoney(evt, true)
81
+ this.$emit('input', formatMoney(evt, false))
81
82
  },
82
83
 
83
84
  handleChange (evt) {
84
- this.$emit('change', formatMoney(evt))
85
+ this.$emit('change', formatMoney(evt, false))
85
86
  }
86
87
  }
87
88
  }