Handle NumberFilter value when changing rule type.

This commit is contained in:
Jeff Stieler 2018-12-12 22:40:22 -07:00
parent 38bb06d39b
commit de53c50514
1 changed files with 9 additions and 1 deletions

View File

@ -77,9 +77,17 @@ class NumberFilter extends Component {
return this.getRangeInput();
}
let inputValue = value;
if ( value && value.indexOf( ',' ) > -1 ) {
const [ moreThan, lessThan ] = value.split( ',' );
inputValue = 'lessthan' === rule ? lessThan : moreThan;
onFilterChange( filter.key, 'value', inputValue );
}
return this.getFormControl(
inputType,
value,
inputValue,
partial( onFilterChange, filter.key, 'value' )
);
}