Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ public partial class MudChipField<T> : MudTextFieldExtended<T>
/// <returns></returns>
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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public MudCodeInput() : base(new DefaultConverter<T>()) { }
/// </summary>
[Parameter]
[Category(CategoryTypes.FormComponent.Behavior)]
public string ClassInput { get; set; }
public string? ClassInput { get; set; }

/// <summary>
/// Type of the input element. It should be a valid HTML5 input type.
Expand All @@ -46,14 +46,14 @@ public MudCodeInput() : base(new DefaultConverter<T>()) { }
[Category(CategoryTypes.FormComponent.Behavior)]
public InputType InputType { get; set; } = InputType.Text;

private T _theValue;
private T? _theValue;

/// <summary>
/// The value of the input.
/// </summary>
[Parameter]
[Category(CategoryTypes.FormComponent.Behavior)]
public T Value
public T? Value
{
get => _theValue;
set
Expand All @@ -72,7 +72,7 @@ public T Value
/// </summary>
[Parameter]
[Category(CategoryTypes.FormComponent.Behavior)]
public EventCallback<T> ValueChanged { get; set; }
public EventCallback<T?> ValueChanged { get; set; }

private int _count;
/// <summary>
Expand Down Expand Up @@ -167,6 +167,10 @@ protected async Task HandleKeyDown(KeyboardEventArgs arg)
}

private int _lastFocusedIndex = 0;
/// <summary>
///
/// </summary>
/// <param name="count"></param>
protected void CheckFocus(int count)
{
_lastFocusedIndex = count;
Expand Down Expand Up @@ -242,17 +246,22 @@ public async Task SetValue()
await ValueChanged.InvokeAsync(Value);
}

public async Task SetValueFromOutside(T value)
/// <summary>
///
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
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());
}
Expand Down