Skip to content

Commit 0d9a651

Browse files
committed
Migrate to Mud 9 and .NET 10
1 parent 8576e5c commit 0d9a651

File tree

28 files changed

+395
-310
lines changed

28 files changed

+395
-310
lines changed

CodeBeam.MudBlazor.Extensions.Docs.Wasm/wwwroot/CodeBeam.MudBlazor.Extensions.xml

Lines changed: 42 additions & 56 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CodeBeam.MudBlazor.Extensions.Docs/CodeBeam.MudBlazor.Extensions.Docs.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
<ItemGroup>
1616
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="9.0.*" />
17-
<PackageReference Include="MudBlazor" Version="8.0.0" />
17+
<PackageReference Include="MudBlazor" Version="9.0.0-preview.1" />
1818
</ItemGroup>
1919

2020
<ItemGroup>

CodeBeam.MudBlazor.Extensions.Docs/Pages/Components/StepperExtended/Examples/StepperExtendedExample3.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@
161161

162162
private async Task<bool> BeforeFinishedAsync()
163163
{
164-
var result = await DialogService.ShowMessageBox(
164+
var result = await DialogService.ShowMessageBoxAsync(
165165
"Confirm",
166166
"All steps are completed. Do you want to finish?",
167167
yesText: "Finish",

CodeBeam.MudBlazor.Extensions.UnitTests/Components/SelectExtendedTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,7 @@ public async Task TextField_Should_Validate_Data_Attribute_Fail()
863863
select.Value.Should().Be("Quux");
864864
select.Text.Should().Be("Quux");
865865
// check validity
866-
await comp.InvokeAsync(() => select.Validate());
866+
await comp.InvokeAsync(() => select.ValidateAsync());
867867
select.ValidationErrors.Should().NotBeEmpty();
868868
select.ValidationErrors.Should().HaveCount(1);
869869
select.ValidationErrors[0].Should().Be("Should not be longer than 3");
@@ -882,7 +882,7 @@ public async Task TextField_Should_Validate_Data_Attribute_Success()
882882
select.Value.Should().Be("Qux");
883883
select.Text.Should().Be("Qux");
884884
// check validity
885-
await comp.InvokeAsync(() => select.Validate());
885+
await comp.InvokeAsync(() => select.ValidateAsync());
886886
select.ValidationErrors.Should().BeEmpty();
887887
}
888888
#endregion
@@ -896,7 +896,7 @@ public async Task Select_Should_SetRequiredTrue()
896896
var comp = Context.RenderComponent<SelectRequiredTest>();
897897
var select = comp.FindComponent<MudSelectExtended<string>>().Instance;
898898
select.Required.Should().BeTrue();
899-
await comp.InvokeAsync(() => select.Validate());
899+
await comp.InvokeAsync(() => select.ValidateAsync());
900900
select.ValidationErrors.First().Should().Be("Required");
901901
}
902902

CodeBeam.MudBlazor.Extensions.UnitTests/Mocks/MockScrollServices.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ public class MockScrollManager : IScrollManager
6565
public ValueTask ScrollToYearAsync(string elementId) => ValueTask.CompletedTask;
6666

6767
public ValueTask UnlockScrollAsync(string elementId, string cssClass) => ValueTask.CompletedTask;
68+
69+
public ValueTask ScrollToVirtualizedItemAsync(string containerId, int itemIndex, double itemHeight, string targetItemId, ScrollBehavior scrollBehavior = ScrollBehavior.Auto) => ValueTask.CompletedTask;
6870
}
6971

7072
public class MockScrollManagerExtended : IScrollManagerExtended
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace MudExtensions.Base
8+
{
9+
/// <summary>
10+
/// Provides methods to create unique identifiers with optional prefixes.
11+
/// </summary>
12+
internal static class Identifier
13+
{
14+
private const string Chars = "abcdefghijklmnopqrstuvwxyz0123456789";
15+
private const int CharsLength = 35;
16+
private const int RandomStringLength = 8;
17+
18+
/// <summary>
19+
/// Creates a unique identifier with the specified prefix.
20+
/// </summary>
21+
/// <param name="prefix">The prefix to prepend to the unique identifier.</param>
22+
/// <returns>A unique identifier string with the specified prefix.</returns>
23+
/// <example><code>prefixdb54bcd0</code></example>
24+
internal static string Create(ReadOnlySpan<char> prefix)
25+
{
26+
Span<char> identifierSpan = stackalloc char[prefix.Length + RandomStringLength];
27+
prefix.CopyTo(identifierSpan);
28+
for (var i = 0; i < RandomStringLength; i++)
29+
{
30+
var index = Random.Shared.Next(CharsLength);
31+
identifierSpan[prefix.Length + i] = Chars[index];
32+
}
33+
34+
return identifierSpan.ToString();
35+
}
36+
37+
/// <summary>
38+
/// Creates a unique identifier.
39+
/// </summary>
40+
/// <returns>A unique identifier string.</returns>
41+
/// <example><code>adb54bcd0</code></example>
42+
internal static string Create() => Create(['a']);
43+
}
44+
}

0 commit comments

Comments
 (0)