diff --git a/CodeBeam.MudBlazor.Extensions/Components/ChipField/MudChipField.razor.cs b/CodeBeam.MudBlazor.Extensions/Components/ChipField/MudChipField.razor.cs index 5e2c40fd..e0cf2af6 100644 --- a/CodeBeam.MudBlazor.Extensions/Components/ChipField/MudChipField.razor.cs +++ b/CodeBeam.MudBlazor.Extensions/Components/ChipField/MudChipField.razor.cs @@ -110,8 +110,8 @@ public partial class MudChipField : MudTextFieldExtended /// protected async Task HandleKeyDown(KeyboardEventArgs args) { - - if (args.Key == Delimiter.ToString() && _internalValue != null) + var result = args.Code == "Space" ? " " : args.Key; + if (result == Delimiter.ToString() && _internalValue != null) { await SetChips(); StateHasChanged(); diff --git a/CodeBeam.MudBlazor.Extensions/Components/CodeInput/MudCodeInput.razor.cs b/CodeBeam.MudBlazor.Extensions/Components/CodeInput/MudCodeInput.razor.cs index bd01ee93..4a8aa801 100644 --- a/CodeBeam.MudBlazor.Extensions/Components/CodeInput/MudCodeInput.razor.cs +++ b/CodeBeam.MudBlazor.Extensions/Components/CodeInput/MudCodeInput.razor.cs @@ -37,7 +37,7 @@ public MudCodeInput() : base(new DefaultConverter()) { } /// [Parameter] [Category(CategoryTypes.FormComponent.Behavior)] - public string ClassInput { get; set; } + public string? ClassInput { get; set; } /// /// Type of the input element. It should be a valid HTML5 input type. @@ -46,14 +46,14 @@ public MudCodeInput() : base(new DefaultConverter()) { } [Category(CategoryTypes.FormComponent.Behavior)] public InputType InputType { get; set; } = InputType.Text; - private T _theValue; + private T? _theValue; /// /// The value of the input. /// [Parameter] [Category(CategoryTypes.FormComponent.Behavior)] - public T Value + public T? Value { get => _theValue; set @@ -72,7 +72,7 @@ public T Value /// [Parameter] [Category(CategoryTypes.FormComponent.Behavior)] - public EventCallback ValueChanged { get; set; } + public EventCallback ValueChanged { get; set; } private int _count; /// @@ -167,6 +167,10 @@ protected async Task HandleKeyDown(KeyboardEventArgs arg) } private int _lastFocusedIndex = 0; + /// + /// + /// + /// protected void CheckFocus(int count) { _lastFocusedIndex = count; @@ -242,17 +246,22 @@ public async Task SetValue() await ValueChanged.InvokeAsync(Value); } - public async Task SetValueFromOutside(T value) + /// + /// + /// + /// + /// + public async Task SetValueFromOutside(T? value) { - string val = Converter.Set(value); - if (Count < val.Length) + string? val = Converter.Set(value); + if (Count < val?.Length) { val = val.Substring(0, Count); } Value = Converter.Get(val); for (int i = 0; i < Count; i++) { - if (i < val.Length) + if (i < val?.Length) { await _elementReferences[i].SetText(val[i].ToString()); }