@tagplus/components 1.2.0 → 1.2.3

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.0",
11
+ "version": "1.2.3",
12
12
  "main": "./dist/tp.common.js",
13
13
  "directories": {
14
14
  "lib": "src/lib"
@@ -45,7 +45,7 @@
45
45
  "axios": "^0.27.0",
46
46
  "core-js": "^3.21.1",
47
47
  "element-theme-chalk": "^2.13",
48
- "element-ui": "^2.15.9",
48
+ "element-ui": "2.15.8",
49
49
  "js-cookie": "^3.0.1",
50
50
  "vue": "^2.6.14",
51
51
  "vue-axios": "^2.1.5",
@@ -151,25 +151,28 @@ export default {
151
151
  visible: {
152
152
  immediate: true,
153
153
  handler (val, oldValue) {
154
- if (val) {
155
- this.closed = false
156
- this.$emit('open')
157
- this.$el.addEventListener('scroll', this.updatePopper)
158
- this.$nextTick(() => {
159
- this.$refs.dialog.scrollTop = 0
160
- })
161
- if (this.appendToBody) {
162
- document.body.appendChild(this.$el)
163
- }
164
- } else {
165
- this.$el.removeEventListener('scroll', this.updatePopper)
166
- if (!this.closed) this.$emit('close')
167
- if (this.destroyOnClose) {
154
+ // Fixing undefined reference of $el with next tick.
155
+ this.$nextTick(() => {
156
+ if (val) {
157
+ this.closed = false
158
+ this.$emit('open')
159
+ this.$el.addEventListener('scroll', this.updatePopper)
168
160
  this.$nextTick(() => {
169
- this.key++
161
+ this.$refs.dialog.scrollTop = 0
170
162
  })
163
+ if (this.appendToBody) {
164
+ document.body.appendChild(this.$el)
165
+ }
166
+ } else {
167
+ this.$el.removeEventListener('scroll', this.updatePopper)
168
+ if (!this.closed) this.$emit('close')
169
+ if (this.destroyOnClose) {
170
+ this.$nextTick(() => {
171
+ this.key++
172
+ })
173
+ }
171
174
  }
172
- }
175
+ })
173
176
  }
174
177
  }
175
178
  },
@@ -22,10 +22,20 @@ export const toCurrency = (val) => {
22
22
  if (val === '') {
23
23
  return val
24
24
  }
25
- return (parseInt(val * 100) / 100).toLocaleString(t('locale.prefix'), {
26
- minimumFractionDigits: 2,
27
- maximumFractionDigits: 2
28
- })
25
+
26
+ try {
27
+ let with2Decimals = val.toString().match(/^-?\d+(?:\.\d{0,2})?/)[0]
28
+ with2Decimals = Number(with2Decimals.toLocaleString(t('locale.prefix'), {
29
+ minimumFractionDigits: 2,
30
+ maximumFractionDigits: 2
31
+ }))
32
+ return with2Decimals
33
+ } catch (Exception) {
34
+ return val.toLocaleString(t('locale.prefix'), {
35
+ minimumFractionDigits: 2,
36
+ maximumFractionDigits: 2
37
+ })
38
+ }
29
39
  }
30
40
 
31
41
  /**