diff --git a/src/FormBuilder/Components/NumericFieldPropertyEditor.razor b/src/FormBuilder/Components/NumericFieldPropertyEditor.razor new file mode 100644 index 0000000..cc43492 --- /dev/null +++ b/src/FormBuilder/Components/NumericFieldPropertyEditor.razor @@ -0,0 +1,19 @@ +@typeparam TValue where TValue : struct + + + + + + + + + + +
+ + +
+ + + + diff --git a/src/FormBuilder/Components/NumericFieldPropertyEditor.razor.cs b/src/FormBuilder/Components/NumericFieldPropertyEditor.razor.cs new file mode 100644 index 0000000..4a2afb8 --- /dev/null +++ b/src/FormBuilder/Components/NumericFieldPropertyEditor.razor.cs @@ -0,0 +1,43 @@ +using FormBuilder.Models; +using Microsoft.AspNetCore.Components; + +namespace FormBuilder.Components; + +public partial class NumericFieldPropertyEditor : ComponentBase where TValue : struct +{ + [Parameter, EditorRequired] + public NumericField Field { get; set; } = default!; + + [Parameter] + public EventCallback> FieldChanged { get; set; } + + private void OnMinChanged(decimal? value) + { + Field.Min = value; + FieldChanged.InvokeAsync(Field); + } + + private void OnMaxChanged(decimal? value) + { + Field.Max = value; + FieldChanged.InvokeAsync(Field); + } + + private void OnStepChanged(string value) + { + Field.Step = value; + FieldChanged.InvokeAsync(Field); + } + + private void OnShowUpDownChanged(bool value) + { + Field.ShowUpDown = value; + FieldChanged.InvokeAsync(Field); + } + + private void OnFormatChanged(string? value) + { + Field.Format = value; + FieldChanged.InvokeAsync(Field); + } +}