Skip to content

Commit

Permalink
🐛 fix(MTextfield): OnClearClick should be invoked after value updated (
Browse files Browse the repository at this point in the history
  • Loading branch information
capdiem authored May 10, 2022
1 parent 9aa104d commit 96e938f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
5 changes: 5 additions & 0 deletions src/Masa.Blazor/Components/FileInput/MFileInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,11 @@ public override async Task HandleOnClearClickAsync(MouseEventArgs args)
{
await SetInternalValueAsync(default);
}

if (OnClearClick.HasDelegate)
{
await OnClearClick.InvokeAsync(args);
}
}
}
}
10 changes: 5 additions & 5 deletions src/Masa.Blazor/Components/Select/MSelect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -445,11 +445,6 @@ public override Task HandleOnBlurAsync(FocusEventArgs args)

public override async Task HandleOnClearClickAsync(MouseEventArgs args)
{
if (OnClearClick.HasDelegate)
{
await OnClearClick.InvokeAsync(args);
}

if (Multiple)
{
IList<TItemValue> values = new List<TItemValue>();
Expand All @@ -460,6 +455,11 @@ public override async Task HandleOnClearClickAsync(MouseEventArgs args)
await SetInternalValueAsync(default);
}

if (OnClearClick.HasDelegate)
{
await OnClearClick.InvokeAsync(args);
}

// TODO: setMenuIndex(-1)

// whether to need NextTick?
Expand Down
5 changes: 2 additions & 3 deletions src/Masa.Blazor/Components/TextField/MTextField.cs
Original file line number Diff line number Diff line change
Expand Up @@ -787,14 +787,13 @@ public virtual async Task HandleOnKeyDownAsync(KeyboardEventArgs args)

public virtual async Task HandleOnClearClickAsync(MouseEventArgs args)
{
await SetInternalValueAsync(default);

if (OnClearClick.HasDelegate)
{
await OnClearClick.InvokeAsync(args);
}

// whether to need NextTick?
await SetInternalValueAsync(default);

await InputElement.FocusAsync();
}
}
Expand Down

0 comments on commit 96e938f

Please sign in to comment.