mirror of
https://github.com/Prowlarr/Prowlarr
synced 2025-12-06 08:34:28 +01:00
Allow decimals in number inputs
(cherry picked from commit 7f5ddff568ce9f87bd45420cbd36690b190bd633)
This commit is contained in:
parent
b0162ccc5b
commit
b36d793d85
4 changed files with 9 additions and 1 deletions
|
|
@ -41,7 +41,7 @@ class NumberInput extends Component {
|
|||
componentDidUpdate(prevProps, prevState) {
|
||||
const { value } = this.props;
|
||||
|
||||
if (value !== prevProps.value && !this.state.isFocused) {
|
||||
if (!isNaN(value) && value !== prevProps.value && !this.state.isFocused) {
|
||||
this.setState({
|
||||
value: value == null ? '' : value.toString()
|
||||
});
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ export const INFO = 'info';
|
|||
export const MOVIE_MONITORED_SELECT = 'movieMonitoredSelect';
|
||||
export const CATEGORY_SELECT = 'newznabCategorySelect';
|
||||
export const DOWNLOAD_CLIENT_SELECT = 'downloadClientSelect';
|
||||
export const FLOAT = 'float';
|
||||
export const NUMBER = 'number';
|
||||
export const OAUTH = 'oauth';
|
||||
export const PASSWORD = 'password';
|
||||
|
|
@ -35,6 +36,7 @@ export const all = [
|
|||
INFO,
|
||||
MOVIE_MONITORED_SELECT,
|
||||
CATEGORY_SELECT,
|
||||
FLOAT,
|
||||
NUMBER,
|
||||
OAUTH,
|
||||
PASSWORD,
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ public class Field
|
|||
public string Section { get; set; }
|
||||
public string Hidden { get; set; }
|
||||
public string Placeholder { get; set; }
|
||||
public bool IsFloat { get; set; }
|
||||
|
||||
public Field Clone()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -125,6 +125,11 @@ private static FieldMapping[] GetFieldMapping(Type type, string prefix, Func<obj
|
|||
field.Hidden = fieldAttribute.Hidden.ToString().FirstCharToLower();
|
||||
}
|
||||
|
||||
if (fieldAttribute.Type is FieldType.Number && propertyInfo.PropertyType == typeof(double))
|
||||
{
|
||||
field.IsFloat = true;
|
||||
}
|
||||
|
||||
var valueConverter = GetValueConverter(propertyInfo.PropertyType);
|
||||
|
||||
result.Add(new FieldMapping
|
||||
|
|
|
|||
Loading…
Reference in a new issue