@awes-io/ui 2.63.3 → 2.63.4

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/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.63.4](https://github.com/awes-io/client/compare/@awes-io/ui@2.63.3...@awes-io/ui@2.63.4) (2023-06-22)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **aw-money:** money formatting fixed ([b0555d2](https://github.com/awes-io/client/commit/b0555d2a69ea67641cd926616ba5b5eb3b8d403f))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [2.63.3](https://github.com/awes-io/client/compare/@awes-io/ui@2.63.2...@awes-io/ui@2.63.3) (2023-06-22)
7
18
 
8
19
 
@@ -111,20 +111,51 @@ export default {
111
111
  this.$refs.input.setError('')
112
112
  }
113
113
 
114
- if ((this.$refs.element.$ci.numberValue || 0) * 100 !== value) {
115
- this.$refs.element.$ci.setValue(value / 100)
114
+ const newValue = this._getIntValue(
115
+ value,
116
+ this.$refs.element.$ci.currencyFormat.minimumFractionDigits
117
+ )
118
+
119
+ if (newValue !== this.$refs.element.$ci.getValue()) {
120
+ this.$refs.element.$ci.setValue(newValue)
116
121
  }
117
122
  },
118
123
 
119
- currencyValue(value) {
124
+ currencyValue(valueFormatted) {
120
125
  if (!this.$refs.element) return
121
126
 
122
- const intValue = this.$refs.element.$ci.numberValue * 100
127
+ const value = this._getCoinsValue(
128
+ this.$refs.element.$ci.getValue(),
129
+ this.$refs.element.$ci.currencyFormat.minimumFractionDigits
130
+ )
123
131
 
124
132
  if (this.value !== value) {
125
- this.$emit('input', intValue, value)
133
+ this.$emit('input', value, valueFormatted)
126
134
  }
127
135
  }
136
+ },
137
+
138
+ mounted() {
139
+ if (isNaN(this.value) || this.value === null) return
140
+
141
+ this.$nextTick(() => {
142
+ this.$refs.element.$ci.setValue(
143
+ this._getIntValue(
144
+ this.value,
145
+ this.$refs.element.$ci.currencyFormat.minimumFractionDigits
146
+ )
147
+ )
148
+ })
149
+ },
150
+
151
+ methods: {
152
+ _getCoinsValue(intValue, minimumFractionDigits) {
153
+ return intValue * Math.pow(10, 2 - minimumFractionDigits)
154
+ },
155
+
156
+ _getIntValue(value, minimumFractionDigits) {
157
+ return value / Math.pow(10, 2 - minimumFractionDigits)
158
+ }
128
159
  }
129
160
  }
130
161
  </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awes-io/ui",
3
- "version": "2.63.3",
3
+ "version": "2.63.4",
4
4
  "description": "User Interface (UI) components",
5
5
  "keywords": [
6
6
  "ui",
@@ -122,5 +122,5 @@
122
122
  "vue-template-compiler": "^2.6.10",
123
123
  "webfonts-generator": "^0.4.0"
124
124
  },
125
- "gitHead": "6087442bc6cf0fda0ee242e283b451adc989bd42"
125
+ "gitHead": "76e2dc0760efe75ecc3f1a7329561fdf86fbe3fd"
126
126
  }