Skip to content

Commit

Permalink
fix: autoDecimalMode with decimalLength zero
Browse files Browse the repository at this point in the history
  • Loading branch information
phiny1 committed Nov 15, 2019
1 parent ca99128 commit c176756
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 20 deletions.
2 changes: 1 addition & 1 deletion demo/Demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<v-layout>
<v-card>
<v-card-text>
<v-currency-field label="Solo" locale="pt-BR" :auto-decimal-mode="false" :max="100" :min="-100" :decimal-length="2" :default-value="0" flat v-model="value"/>
<v-currency-field label="Solo" locale="pt-BR" :auto-decimal-mode="true" :decimal-length="0" :default-value="0" flat v-model="value"/>
{{ value }}
</v-card-text>
</v-card>
Expand Down
19 changes: 15 additions & 4 deletions dist/v-currency-field.common.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* v-currency-field v3.0.1
* v-currency-field v3.0.3
* (c) 2019 Philipe Augusto <[email protected]>
* Released under the MIT License.
*/
Expand Down Expand Up @@ -734,7 +734,18 @@ var script = {
return attrs;
},
distractionFree: function distractionFree() {
return !this.autoDecimalMode;
if (this.decimalLength > 0) {
return !this.autoDecimalMode;
} else {
return false;
}
},
decimalMode: function decimalMode() {
if (this.decimalLength > 0) {
return this.autoDecimalMode;
} else {
return false;
}
}
},
methods: {
Expand Down Expand Up @@ -891,7 +902,7 @@ var normalizeComponent_1 = normalizeComponent;
const __vue_script__ = script;

/* template */
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('v-text-field',_vm._g(_vm._b({directives:[{name:"currency-directive",rawName:"v-currency-directive",value:({currency: _vm.currency, locale: _vm.locale, distractionFree: _vm.distractionFree, decimalLength: _vm.decimalLength, autoDecimalMode: _vm.autoDecimalMode, min: _vm.min, max: _vm.max}),expression:"{currency, locale, distractionFree, decimalLength, autoDecimalMode, min, max}"}],ref:"textfield",attrs:{"type":"tel"},model:{value:(_vm.formattedValue),callback:function ($$v) {_vm.formattedValue=$$v;},expression:"formattedValue"}},'v-text-field',_vm.attrs,false),_vm.listeners()))};
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('v-text-field',_vm._g(_vm._b({directives:[{name:"currency-directive",rawName:"v-currency-directive",value:({currency: _vm.currency, locale: _vm.locale, distractionFree: _vm.distractionFree, decimalLength: _vm.decimalLength, autoDecimalMode: _vm.decimalMode, min: _vm.min, max: _vm.max}),expression:"{currency, locale, distractionFree, decimalLength, autoDecimalMode: decimalMode, min, max}"}],ref:"textfield",attrs:{"type":"tel"},model:{value:(_vm.formattedValue),callback:function ($$v) {_vm.formattedValue=$$v;},expression:"formattedValue"}},'v-text-field',_vm.attrs,false),_vm.listeners()))};
var __vue_staticRenderFns__ = [];

/* style */
Expand Down Expand Up @@ -919,7 +930,7 @@ var __vue_staticRenderFns__ = [];
undefined
);

var version = '3.0.1';
var version = '3.0.3';

function install(Vue, globalOptions) {
if (globalOptions) {
Expand Down
19 changes: 15 additions & 4 deletions dist/v-currency-field.esm.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* v-currency-field v3.0.1
* v-currency-field v3.0.3
* (c) 2019 Philipe Augusto <[email protected]>
* Released under the MIT License.
*/
Expand Down Expand Up @@ -728,7 +728,18 @@ var script = {
return attrs;
},
distractionFree: function distractionFree() {
return !this.autoDecimalMode;
if (this.decimalLength > 0) {
return !this.autoDecimalMode;
} else {
return false;
}
},
decimalMode: function decimalMode() {
if (this.decimalLength > 0) {
return this.autoDecimalMode;
} else {
return false;
}
}
},
methods: {
Expand Down Expand Up @@ -885,7 +896,7 @@ var normalizeComponent_1 = normalizeComponent;
const __vue_script__ = script;

/* template */
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('v-text-field',_vm._g(_vm._b({directives:[{name:"currency-directive",rawName:"v-currency-directive",value:({currency: _vm.currency, locale: _vm.locale, distractionFree: _vm.distractionFree, decimalLength: _vm.decimalLength, autoDecimalMode: _vm.autoDecimalMode, min: _vm.min, max: _vm.max}),expression:"{currency, locale, distractionFree, decimalLength, autoDecimalMode, min, max}"}],ref:"textfield",attrs:{"type":"tel"},model:{value:(_vm.formattedValue),callback:function ($$v) {_vm.formattedValue=$$v;},expression:"formattedValue"}},'v-text-field',_vm.attrs,false),_vm.listeners()))};
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('v-text-field',_vm._g(_vm._b({directives:[{name:"currency-directive",rawName:"v-currency-directive",value:({currency: _vm.currency, locale: _vm.locale, distractionFree: _vm.distractionFree, decimalLength: _vm.decimalLength, autoDecimalMode: _vm.decimalMode, min: _vm.min, max: _vm.max}),expression:"{currency, locale, distractionFree, decimalLength, autoDecimalMode: decimalMode, min, max}"}],ref:"textfield",attrs:{"type":"tel"},model:{value:(_vm.formattedValue),callback:function ($$v) {_vm.formattedValue=$$v;},expression:"formattedValue"}},'v-text-field',_vm.attrs,false),_vm.listeners()))};
var __vue_staticRenderFns__ = [];

/* style */
Expand Down Expand Up @@ -913,7 +924,7 @@ var __vue_staticRenderFns__ = [];
undefined
);

var version = '3.0.1';
var version = '3.0.3';

function install(Vue, globalOptions) {
if (globalOptions) {
Expand Down
19 changes: 15 additions & 4 deletions dist/v-currency-field.umd.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* v-currency-field v3.0.1
* v-currency-field v3.0.3
* (c) 2019 Philipe Augusto <[email protected]>
* Released under the MIT License.
*/
Expand Down Expand Up @@ -734,7 +734,18 @@
return attrs;
},
distractionFree: function distractionFree() {
return !this.autoDecimalMode;
if (this.decimalLength > 0) {
return !this.autoDecimalMode;
} else {
return false;
}
},
decimalMode: function decimalMode() {
if (this.decimalLength > 0) {
return this.autoDecimalMode;
} else {
return false;
}
}
},
methods: {
Expand Down Expand Up @@ -891,7 +902,7 @@
const __vue_script__ = script;

/* template */
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('v-text-field',_vm._g(_vm._b({directives:[{name:"currency-directive",rawName:"v-currency-directive",value:({currency: _vm.currency, locale: _vm.locale, distractionFree: _vm.distractionFree, decimalLength: _vm.decimalLength, autoDecimalMode: _vm.autoDecimalMode, min: _vm.min, max: _vm.max}),expression:"{currency, locale, distractionFree, decimalLength, autoDecimalMode, min, max}"}],ref:"textfield",attrs:{"type":"tel"},model:{value:(_vm.formattedValue),callback:function ($$v) {_vm.formattedValue=$$v;},expression:"formattedValue"}},'v-text-field',_vm.attrs,false),_vm.listeners()))};
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('v-text-field',_vm._g(_vm._b({directives:[{name:"currency-directive",rawName:"v-currency-directive",value:({currency: _vm.currency, locale: _vm.locale, distractionFree: _vm.distractionFree, decimalLength: _vm.decimalLength, autoDecimalMode: _vm.decimalMode, min: _vm.min, max: _vm.max}),expression:"{currency, locale, distractionFree, decimalLength, autoDecimalMode: decimalMode, min, max}"}],ref:"textfield",attrs:{"type":"tel"},model:{value:(_vm.formattedValue),callback:function ($$v) {_vm.formattedValue=$$v;},expression:"formattedValue"}},'v-text-field',_vm.attrs,false),_vm.listeners()))};
var __vue_staticRenderFns__ = [];

/* style */
Expand Down Expand Up @@ -919,7 +930,7 @@
undefined
);

var version = '3.0.1';
var version = '3.0.3';

function install(Vue, globalOptions) {
if (globalOptions) {
Expand Down
4 changes: 2 additions & 2 deletions dist/v-currency-field.umd.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion nuxt-treeshaking/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { resolve } = require('path')

module.exports = function nuxtVueCurrencyInput(options) {
module.exports = function nuxtVCurrencyField(options) {
this.addPlugin({
src: resolve(__dirname, 'plugin.js'),
fileName: 'v-currency-field.js',
Expand Down
2 changes: 1 addition & 1 deletion nuxt/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { resolve } = require('path')

module.exports = function nuxtVueCurrencyInput(options) {
module.exports = function nuxtVCurrencyField(options) {
this.addPlugin({
src: resolve(__dirname, 'plugin.js'),
fileName: 'v-currency-field.js',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "v-currency-field",
"version": "3.0.2",
"version": "3.0.3",
"description": "Currency component for vuetify v-text-field",
"author": "Philipe Augusto <[email protected]>",
"license": "MIT",
Expand Down
15 changes: 13 additions & 2 deletions src/VCurrencyField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
v-bind="attrs"
v-on="listeners()"
type="tel"
v-currency-directive="{currency, locale, distractionFree, decimalLength, autoDecimalMode, min, max}"/>
v-currency-directive="{currency, locale, distractionFree, decimalLength, autoDecimalMode: decimalMode, min, max}"/>
</template>

<script>
Expand Down Expand Up @@ -61,7 +61,18 @@ export default {
return attrs;
},
distractionFree(){
return !this.autoDecimalMode;
if (this.decimalLength > 0) {
return !this.autoDecimalMode;
} else {
return false;
}
},
decimalMode(){
if (this.decimalLength > 0) {
return this.autoDecimalMode;
} else {
return false;
}
}
},
methods: {
Expand Down

0 comments on commit c176756

Please sign in to comment.