|
|
@ -31,6 +31,8 @@ BnAsDecimalInput.prototype.render = function () { |
|
|
|
const suffix = props.suffix |
|
|
|
const suffix = props.suffix |
|
|
|
const style = props.style |
|
|
|
const style = props.style |
|
|
|
const valueString = value.toString(10) |
|
|
|
const valueString = value.toString(10) |
|
|
|
|
|
|
|
const newMin = min && this.downsize(min.toString(10), scale) |
|
|
|
|
|
|
|
const newMax = max && this.downsize(max.toString(10), scale) |
|
|
|
const newValue = this.downsize(valueString, scale) |
|
|
|
const newValue = this.downsize(valueString, scale) |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
@ -47,8 +49,8 @@ BnAsDecimalInput.prototype.render = function () { |
|
|
|
type: 'number', |
|
|
|
type: 'number', |
|
|
|
step: 'any', |
|
|
|
step: 'any', |
|
|
|
required: true, |
|
|
|
required: true, |
|
|
|
min, |
|
|
|
min: newMin, |
|
|
|
max, |
|
|
|
max: newMax, |
|
|
|
style: extend({ |
|
|
|
style: extend({ |
|
|
|
display: 'block', |
|
|
|
display: 'block', |
|
|
|
textAlign: 'right', |
|
|
|
textAlign: 'right', |
|
|
@ -128,15 +130,17 @@ BnAsDecimalInput.prototype.updateValidity = function (event) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
BnAsDecimalInput.prototype.constructWarning = function () { |
|
|
|
BnAsDecimalInput.prototype.constructWarning = function () { |
|
|
|
const { name, min, max } = this.props |
|
|
|
const { name, min, max, scale, suffix } = this.props |
|
|
|
|
|
|
|
const newMin = min && this.downsize(min.toString(10), scale) |
|
|
|
|
|
|
|
const newMax = max && this.downsize(max.toString(10), scale) |
|
|
|
let message = name ? name + ' ' : '' |
|
|
|
let message = name ? name + ' ' : '' |
|
|
|
|
|
|
|
|
|
|
|
if (min && max) { |
|
|
|
if (min && max) { |
|
|
|
message += `must be greater than or equal to ${min} and less than or equal to ${max}.` |
|
|
|
message += `must be greater than or equal to ${newMin} ${suffix} and less than or equal to ${newMax} ${suffix}.` |
|
|
|
} else if (min) { |
|
|
|
} else if (min) { |
|
|
|
message += `must be greater than or equal to ${min}.` |
|
|
|
message += `must be greater than or equal to ${newMin} ${suffix}.` |
|
|
|
} else if (max) { |
|
|
|
} else if (max) { |
|
|
|
message += `must be less than or equal to ${max}.` |
|
|
|
message += `must be less than or equal to ${newMax} ${suffix}.` |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
message += 'Invalid input.' |
|
|
|
message += 'Invalid input.' |
|
|
|
} |
|
|
|
} |
|
|
|