Fixed #1621 - [Feature Request] Disable +- Button on InputNumber when value reach min, max
parent
4547fe5e5c
commit
0d049b4ca0
|
@ -129,10 +129,14 @@ export default {
|
||||||
timer: null,
|
timer: null,
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
d_modelValue: this.modelValue,
|
||||||
focused: false
|
focused: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
modelValue(newValue) {
|
||||||
|
this.d_modelValue = newValue;
|
||||||
|
},
|
||||||
locale(newValue, oldValue) {
|
locale(newValue, oldValue) {
|
||||||
this.updateConstructParser(newValue, oldValue);
|
this.updateConstructParser(newValue, oldValue);
|
||||||
},
|
},
|
||||||
|
@ -891,6 +895,7 @@ export default {
|
||||||
return 0;
|
return 0;
|
||||||
},
|
},
|
||||||
updateModel(event, value) {
|
updateModel(event, value) {
|
||||||
|
this.d_modelValue = value;
|
||||||
this.$emit('update:modelValue', value);
|
this.$emit('update:modelValue', value);
|
||||||
},
|
},
|
||||||
onInputFocus() {
|
onInputFocus() {
|
||||||
|
@ -909,7 +914,13 @@ export default {
|
||||||
if (this.timer) {
|
if (this.timer) {
|
||||||
clearInterval(this.timer);
|
clearInterval(this.timer);
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
maxBoundry() {
|
||||||
|
return this.d_modelValue >= this.max;
|
||||||
|
},
|
||||||
|
minBoundry() {
|
||||||
|
return this.d_modelValue <= this.min;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
containerClass() {
|
containerClass() {
|
||||||
|
@ -921,11 +932,16 @@ export default {
|
||||||
'p-inputnumber-buttons-vertical': this.showButtons && this.buttonLayout === 'vertical'
|
'p-inputnumber-buttons-vertical': this.showButtons && this.buttonLayout === 'vertical'
|
||||||
}];
|
}];
|
||||||
},
|
},
|
||||||
|
|
||||||
upButtonClass() {
|
upButtonClass() {
|
||||||
return ['p-inputnumber-button p-inputnumber-button-up', this.incrementButtonClass];
|
return ['p-inputnumber-button p-inputnumber-button-up', this.incrementButtonClass, {
|
||||||
|
'p-disabled': this.showButtons && this.max !== null && this.maxBoundry()
|
||||||
|
}];
|
||||||
},
|
},
|
||||||
downButtonClass() {
|
downButtonClass() {
|
||||||
return ['p-inputnumber-button p-inputnumber-button-down', this.decrementButtonClass];
|
return ['p-inputnumber-button p-inputnumber-button-down', this.decrementButtonClass, {
|
||||||
|
'p-disabled': this.showButtons && this.min !== null && this.minBoundry()
|
||||||
|
}];
|
||||||
},
|
},
|
||||||
filled() {
|
filled() {
|
||||||
return (this.modelValue != null && this.modelValue.toString().length > 0)
|
return (this.modelValue != null && this.modelValue.toString().length > 0)
|
||||||
|
|
Loading…
Reference in New Issue