Skip to content

Commit 252d616

Browse files
Fixes #24 VueAutonumeric value prop validator should accept strings
Signed-off-by: Alexandre Bonneau <[email protected]>
1 parent b8f777b commit 252d616

File tree

7 files changed

+20
-8
lines changed

7 files changed

+20
-8
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
## Changelog for vue-autoNumeric
22

3+
### 1.2.6
4+
+ Fixes #24 VueAutonumeric value prop validator should accept strings
5+
36
### 1.2.5
47
+ Fixes #14 The `readOnly` option is not respected for non-input tags (`contenteditable` is always set to `true`)
58

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ Huge Thanks :)
225225

226226
### License
227227

228-
`vue-autoNumeric` is open source and released under the [MIT License](https://github.com/autoNumeric/vue-autoNumeric/blob/master/LICENSE).
228+
`vue-autoNumeric` is open-source and released under the [MIT License](https://github.com/autoNumeric/vue-autoNumeric/blob/master/LICENSE).
229229

230230
<br>Copyright © 2016-2018 Alexandre Bonneau
231231

dist/vue-autonumeric.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* vue-autonumeric v1.2.5 (https://github.com/autoNumeric/vue-autoNumeric)
2+
* vue-autonumeric v1.2.6 (https://github.com/autoNumeric/vue-autoNumeric)
33
* © 2018 Alexandre Bonneau <[email protected]>
44
* Released under the MIT License.
55
*/
@@ -346,7 +346,7 @@ exports.default = {
346346
value: {
347347
required: false,
348348
validator: function validator(val) {
349-
return typeof val === 'number' || val === '' || val === null;
349+
return typeof val === 'number' || typeof val === 'string' || val === '' || val === null;
350350
}
351351
},
352352

dist/vue-autonumeric.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples-src/App.vue

+9
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,14 @@
279279
<div class="rawValue">{{ externalTracker }}</div>
280280
</div>
281281
</div>
282+
283+
<div :class="boxClasses" :style="boxStyle">
284+
<div :class="labelClasses">Text variable for the value (cf. issue #24)</div>
285+
<div class="inputAndRawValue">
286+
<vue-autonumeric :options="''" v-model="textAnModel"/>
287+
<div class="rawValue">{{ textAnModel }}</div>
288+
</div>
289+
</div>
282290
</div>
283291
</div>
284292
</div>
@@ -300,6 +308,7 @@
300308
autoNumericModel : 221456.72, // Default value for the examples
301309
autoNumericModel2: 12468.642,
302310
autoNumericModel3: 221226.44,
311+
textAnModel : '12468.02',
303312
anModel : 42.01,
304313
emptyValue : '',
305314
externalTracker : 1222114.66,

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-autonumeric",
3-
"version": "1.2.5",
3+
"version": "1.2.6",
44
"description": "An AutoNumeric wrapper for Vue.js",
55
"author": "Alexandre Bonneau <[email protected]>",
66
"license": "MIT",

src/components/VueAutonumeric.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<!--
22
vue-autonumeric
33

4-
@version 1.2.5
5-
@date 2018-05-25 UTC 19:50
4+
@version 1.2.6
5+
@date 2018-09-14 UTC 19:06
66

77
@author Alexandre Bonneau
88
@copyright 2018 © Alexandre Bonneau <alexandre.bonneau@linuxfr.eu>
@@ -102,7 +102,7 @@ OTHER DEALINGS IN THE SOFTWARE.
102102
value: {
103103
required: false,
104104
validator(val) {
105-
return typeof val === 'number' || val === '' || val === null;
105+
return typeof val === 'number' || typeof val === 'string' || val === '' || val === null;
106106
},
107107
},
108108

0 commit comments

Comments
 (0)