@@ -137,29 +137,29 @@ export class FloatEditor implements Editor {
137
137
if ( ! validationResults . valid ) {
138
138
return validationResults ;
139
139
}
140
- } else if ( isNaN ( elmValue as number ) || ( decPlaces === 0 && ! / ^ ( \d + ( \. ) ? ( \d ) * ) $ / . test ( elmValue ) ) ) {
140
+ } else if ( isNaN ( elmValue as number ) || ( decPlaces === 0 && ! / ^ [ - + ] ? ( \d + ( \. ) ? ( \d ) * ) $ / . test ( elmValue ) ) ) {
141
141
// when decimal value is 0 (which is the default), we accept 0 or more decimal values
142
142
return {
143
143
valid : false ,
144
144
msg : errorMsg || Constants . VALIDATION_EDITOR_VALID_NUMBER
145
145
} ;
146
- } else if ( minValue !== undefined && minValue !== undefined && ( floatNumber < minValue || floatNumber > maxValue ) ) {
146
+ } else if ( minValue !== undefined && maxValue !== undefined && floatNumber !== null && ( floatNumber < minValue || floatNumber > maxValue ) ) {
147
147
// MIN & MAX Values provided
148
148
// when decimal value is bigger than 0, we only accept the decimal values as that value set
149
149
// for example if we set decimalPlaces to 2, we will only accept numbers between 0 and 2 decimals
150
150
return {
151
151
valid : false ,
152
152
msg : errorMsg || Constants . VALIDATION_EDITOR_NUMBER_BETWEEN . replace ( / { { minValue} } | { { maxValue} } / gi, ( matched ) => mapValidation [ matched ] )
153
153
} ;
154
- } else if ( minValue !== undefined && floatNumber <= minValue ) {
154
+ } else if ( minValue !== undefined && floatNumber !== null && floatNumber <= minValue ) {
155
155
// MIN VALUE ONLY
156
156
// when decimal value is bigger than 0, we only accept the decimal values as that value set
157
157
// for example if we set decimalPlaces to 2, we will only accept numbers between 0 and 2 decimals
158
158
return {
159
159
valid : false ,
160
160
msg : errorMsg || Constants . VALIDATION_EDITOR_NUMBER_MIN . replace ( / { { minValue} } / gi, ( matched ) => mapValidation [ matched ] )
161
161
} ;
162
- } else if ( maxValue !== undefined && floatNumber >= maxValue ) {
162
+ } else if ( maxValue !== undefined && floatNumber !== null && floatNumber >= maxValue ) {
163
163
// MAX VALUE ONLY
164
164
// when decimal value is bigger than 0, we only accept the decimal values as that value set
165
165
// for example if we set decimalPlaces to 2, we will only accept numbers between 0 and 2 decimals
0 commit comments