|
|
|
@ -3,9 +3,10 @@ using Connected.Utilities;
|
|
|
|
|
using Microsoft.AspNetCore.Components;
|
|
|
|
|
using Microsoft.AspNetCore.Components.Web;
|
|
|
|
|
using System.Numerics;
|
|
|
|
|
using static Connected.Colors;
|
|
|
|
|
|
|
|
|
|
namespace Connected.Components;
|
|
|
|
|
public partial class InputNumber<NumberType>:InputBase where NumberType : INumber<NumberType>
|
|
|
|
|
public partial class NumberInput<NumberType>:InputBase where NumberType : INumber<NumberType>
|
|
|
|
|
{
|
|
|
|
|
private double _step =1;
|
|
|
|
|
[Parameter]
|
|
|
|
@ -40,7 +41,7 @@ public partial class InputNumber<NumberType>:InputBase where NumberType : INumbe
|
|
|
|
|
}
|
|
|
|
|
protected async Task OnMouseWheel(WheelEventArgs obj)
|
|
|
|
|
{
|
|
|
|
|
if (!DisableMouseWheel)
|
|
|
|
|
if (DisableMouseWheel==false)
|
|
|
|
|
{
|
|
|
|
|
if (!obj.ShiftKey || Disabled || Readonly)
|
|
|
|
|
return;
|
|
|
|
@ -55,19 +56,12 @@ public partial class InputNumber<NumberType>:InputBase where NumberType : INumbe
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private NumberType _value;
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
|
public NumberType Value
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return _value;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_value = AdjustDecimalPlaces(value);
|
|
|
|
|
}
|
|
|
|
|
get;
|
|
|
|
|
set;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
@ -81,13 +75,13 @@ public partial class InputNumber<NumberType>:InputBase where NumberType : INumbe
|
|
|
|
|
{
|
|
|
|
|
if (args.Value is not null)
|
|
|
|
|
{
|
|
|
|
|
NumberType value = (NumberType)Convert.ChangeType(args.Value, typeof(NumberType));
|
|
|
|
|
if (value.ToString().Length <= 0)
|
|
|
|
|
{
|
|
|
|
|
NumberType value = (NumberType)Convert.ChangeType(args.Value, typeof(NumberType));
|
|
|
|
|
if (value.ToString().Length <= 0)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
value = (NumberType)Convert.ChangeType(0, typeof(NumberType));
|
|
|
|
|
}
|
|
|
|
|
await ValueChanged.InvokeAsync((NumberType)Convert.ChangeType(AdjustDecimalPlaces(value), typeof(NumberType)));
|
|
|
|
|
value = (NumberType)Convert.ChangeType(0, typeof(NumberType));
|
|
|
|
|
}
|
|
|
|
|
await ValueChanged.InvokeAsync((NumberType)Convert.ChangeType(AdjustDecimalPlaces(value), typeof(NumberType)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|