Skip to content

Commit

Permalink
Fixed #1789 - Disabled buttons on InputNumber v2 when value reach min…
Browse files Browse the repository at this point in the history
…, max
  • Loading branch information
tugcekucukoglu committed Nov 19, 2021
1 parent 068f472 commit 432c685
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions src/components/inputnumber/InputNumber.vue
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,14 @@ export default {
timer: null,
data() {
return {
d_value: null,
focused: false
}
},
watch: {
value(newValue) {
this.d_value = newValue;
},
locale(newValue, oldValue) {
this.updateConstructParser(newValue, oldValue);
},
Expand Down Expand Up @@ -889,6 +893,7 @@ export default {
return 0;
},
updateModel(event, value) {
this.d_value = value;
this.$emit('input', value);
},
onInputFocus() {
Expand All @@ -907,7 +912,13 @@ export default {
if (this.timer) {
clearInterval(this.timer);
}
}
},
maxBoundry() {
return this.d_value >= this.max;
},
minBoundry() {
return this.d_value <= this.min;
},
},
computed: {
containerClass() {
Expand All @@ -919,11 +930,15 @@ export default {
'p-inputnumber-buttons-vertical': this.showButtons && this.buttonLayout === 'vertical'
}];
},
upButtonClass() {
return ['p-inputnumber-button p-inputnumber-button-up', this.incrementButtonClass];
upButtonClass() {console.log('up')
return ['p-inputnumber-button p-inputnumber-button-up', this.incrementButtonClass, {
'p-disabled': this.showButtons && this.max !== null && this.maxBoundry()
}];
},
downButtonClass() {
return ['p-inputnumber-button p-inputnumber-button-down', this.decrementButtonClass];
downButtonClass() {console.log('down')
return ['p-inputnumber-button p-inputnumber-button-down', this.decrementButtonClass, {
'p-disabled': this.showButtons && this.min !== null && this.minBoundry()
}];
},
filled() {
return (this.value != null && this.value.toString().length > 0)
Expand Down

0 comments on commit 432c685

Please sign in to comment.