Skip to content

Commit

Permalink
Upgrade to MudBlazor 7.0.0-rc.2 and Latest Blazor Project Templates (#…
Browse files Browse the repository at this point in the history
…465)

Co-authored-by: Artyom M <[email protected]>
  • Loading branch information
jperson2000 and ScarletKuro authored Jun 24, 2024
1 parent 0b738ee commit 5cd2b40
Show file tree
Hide file tree
Showing 51 changed files with 762 additions and 543 deletions.
2 changes: 1 addition & 1 deletion InstallAndBuildAllTemplates.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dotnet new install $(Join-Path $PSScriptRoot '/src/mudblazor') --force
dotnet new mudblazor --interactivity None --output $(Join-Path $tests 'InteractivityNone')
dotnet build $(Join-Path $tests '/InteractivityNone') /warnaserror

dotnet new mudblazor --interactivity Auto --output $(Join-Path $tests '/InteractivityAuto')
dotnet new mudblazor --interactivity Auto --output $(Join-Path $tests 'InteractivityAuto')
dotnet build $(Join-Path $tests '/InteractivityAuto') /warnaserror

dotnet new mudblazor --interactivity Server --output $(Join-Path $tests 'InteractivityServer')
Expand Down
8 changes: 8 additions & 0 deletions src/MudBlazor.Templates.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,12 @@
<Compile Remove="**\*" />
</ItemGroup>

<ItemGroup>
<None Remove="mudblazor\mudblazor.template.client\pages\Weather.razor" />
</ItemGroup>

<ItemGroup>
<Folder Include="mudblazor\MudBlazor.Template.Client\wwwroot\" />
</ItemGroup>

</Project>
25 changes: 25 additions & 0 deletions src/MudBlazor.Templates.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.9.34902.65
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MudBlazor.Templates", "MudBlazor.Templates.csproj", "{7EAFF69B-A5AD-4A6C-A70D-DA61C3278F20}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7EAFF69B-A5AD-4A6C-A70D-DA61C3278F20}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7EAFF69B-A5AD-4A6C-A70D-DA61C3278F20}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7EAFF69B-A5AD-4A6C-A70D-DA61C3278F20}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7EAFF69B-A5AD-4A6C-A70D-DA61C3278F20}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6F2CB990-E8D8-4534-9AFE-676348D0341F}
EndGlobalSection
EndGlobal
42 changes: 16 additions & 26 deletions src/mudblazor/.template.config/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,15 @@
"MudBlazor"
],
"name": "MudBlazor Web App",
"shortName": "mudblazor",
"defaultName": "MudBlazorWebApp",
"description": "A project template for creating a MudBlazor web app that supports both server-side rendering and client interactivity. This template can be used for web apps with rich dynamic user interfaces (UIs).",
"groupIdentity": "MudBlazor.Web.Blazor",

"precedence": "9800",
"guids": [
"4C26868E-5E7C-458D-82E3-040509D0C71F",
"650B3CE7-2E93-4CC4-9F46-466686815EAA",
"53bc9b9d-9d6a-45d4-8429-2a2761773502",
"9A19103F-16F7-4668-BE54-9A1E7A4F7557",
"650B3CE7-2E93-4CC4-9F46-466686815EA1",
"5990939C-7E7B-4CFA-86FF-44CA57564981",
"5990939C-7E7B-4CFA-86FF-44CA5756498A",
"4C26868E-5E7C-458D-82E3-040509D0C710"
"650B3CE7-2E93-4CC4-9F46-466686815EAA",
"53bc9b9d-9d6a-45d4-8429-2a2761773502"
],
"identity": "MudBlazorWebApp.CSharp.8.0",
"thirdPartyNotices": "",
Expand All @@ -44,20 +39,19 @@
"path": "MudBlazor.Template.Client/MudBlazor.Template.Client.csproj"
}
],
"shortName": "mudblazor",
"sourceName": "MudBlazor.Template",
"sources": [
{
"source": "./",
"target": "./",
"exclude": [
".template.config/**",
"CreateAllTemplatesForTests.bat"
".template.config/**"
],
"copyOnly": [
"**/wwwroot/bootstrap/**"
],
"modifiers": [

{
"condition": "(!IndividualLocalAuth)",
"exclude": [
Expand All @@ -79,35 +73,31 @@
"rename": {
"MudBlazor.Template/Components/Layout/": "./MudBlazor.Template.Client/Layout/",
"MudBlazor.Template/Components/Pages/Home.razor": "./MudBlazor.Template.Client/Pages/Home.razor",
"MudBlazor.Template/Components/Pages/Weather.razor": "./MudBlazor.Template.Client/Pages/Weather.razor",
"MudBlazor.Template/Components/Routes.razor": "./MudBlazor.Template.Client/Routes.razor"
}
},
{
"condition": "(UseWebAssembly && !InteractiveAtRoot)",
"rename": {
"MudBlazor.Template/Components/Pages/Weather.razor": "./MudBlazor.Template.Client/Pages/Weather.razor"
}
},
{
"condition": "(!UseProgramMain)",
"exclude": [
"MudBlazor.Template/Program.Main.cs"
"MudBlazor.Template/Program.Main.cs",
"MudBlazor.Template.Client/Program.Main.cs"
]
},
{
"condition": "(UseProgramMain)",
"exclude": [
"MudBlazor.Template/Program.cs"
"MudBlazor.Template/Program.cs",
"MudBlazor.Template.Client/Program.cs"
],
"rename": {
"Program.Main.cs": "Program.cs"
}
},
{
"condition": "(!(UseServer && !UseWebAssembly))",
"condition": "(UseWebAssembly || (!UseWebAssembly && !UseServer))",
"exclude": [
"MudBlazor.Template/Components/Pages/Counter.razor"
"MudBlazor.Template/Components/Pages/Counter.razor",
"MudBlazor.Template/Components/Pages/Weather.razor"
]
},
{
Expand All @@ -121,7 +111,7 @@
"exclude": [
"MudBlazor.Template/Components/Pages/Auth.*",
"MudBlazor.Template/Components/Pages/Counter.*",
"MudBlazor.Template.Client/Pages/Weather.*",
"MudBlazor.Template/Components/Pages/Weather.*",
"MudBlazor.Template/Components/Layout/NavMenu.*",
"MudBlazor.Template/wwwroot/bootstrap/**",
"MudBlazor.Template/wwwroot/favicon.*",
Expand Down Expand Up @@ -344,7 +334,7 @@
"InteractivityPlatform": {
"type": "parameter",
"datatype": "choice",
"defaultValue": "Server",
"defaultValue": "WebAssembly",
"displayName": "_Interactive render mode",
"description": "Chooses which interactive render mode to use for interactive components",
"choices": [
Expand Down Expand Up @@ -373,7 +363,7 @@
"InteractivityLocation": {
"type": "parameter",
"datatype": "choice",
"defaultValue": "InteractivePerPage",
"defaultValue": "InteractiveGlobal",
"displayName": "_Interactivity location",
"description": "Chooses which components will have interactive rendering enabled",
"isEnabled": "(InteractivityPlatform != \"None\")",
Expand Down Expand Up @@ -505,4 +495,4 @@
"continueOnError": true
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
<NoDefaultLaunchSettingsFile>true</NoDefaultLaunchSettingsFile>
<StaticWebAssetProjectMode>Default</StaticWebAssetProjectMode>
<RootNamespace Condition="'$(name)' != '$(name{-VALUE-FORMS-}safe_namespace)'">MudBlazor.Template.Client</RootNamespace>
<AssemblyName Condition="'$(name)' != '$(name{-VALUE-FORMS-}safe_namespace)'">$(AssemblyName.Replace(' ', '_'))</AssemblyName>
<AssemblyName Condition="'$(name)' != '$(name{-VALUE-FORMS-}safe_namespace)'">`$(AssemblyName.Replace(' ', '_'))</AssemblyName>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.*" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="8.*" Condition="'$(IndividualLocalAuth)' == 'True'" />
<PackageReference Include="MudBlazor" Version="6.*" />
<PackageReference Include="MudBlazor" Version="7.0.0-rc.2" />
</ItemGroup>

</Project>
2 changes: 2 additions & 0 deletions src/mudblazor/MudBlazor.Template.Client/Pages/Counter.razor
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
<PageTitle>Counter</PageTitle>

<MudText Typo="Typo.h3" GutterBottom="true">Counter</MudText>

<MudText Class="mb-4">Current count: @currentCount</MudText>

<MudButton Color="Color.Primary" Variant="Variant.Filled" @onclick="IncrementCount">Click me</MudButton>

@code {
Expand Down
77 changes: 77 additions & 0 deletions src/mudblazor/MudBlazor.Template.Client/Pages/Weather.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
@page "/weather"
@*#if (UseServer && !InteractiveAtRoot)
@rendermode InteractiveAuto
##elseif (!InteractiveAtRoot)
@rendermode InteractiveWebAssembly
##endif*@

@*#if (!InteractiveAtRoot)
<MudPopoverProvider />
<MudDialogProvider />
<MudSnackbarProvider />
##endif*@

@*#if (!InteractiveAtRoot) -->
@attribute [StreamRendering]
##endif*@

<PageTitle>Weather</PageTitle>

<MudText Typo="Typo.h3" GutterBottom="true">Weather forecast</MudText>
<MudText Class="mb-8">This component demonstrates fetching data from the server.</MudText>

@if (forecasts == null)
{
<MudProgressCircular Color="Color.Default" Indeterminate="true" />
}
else
{
<MudTable Items="forecasts" Hover="true" SortLabel="Sort By" Elevation="0" AllowUnsorted="false">
<HeaderContent>
<MudTh><MudTableSortLabel InitialDirection="SortDirection.Ascending" SortBy="new Func<WeatherForecast, object>(x=>x.Date)">Date</MudTableSortLabel></MudTh>
<MudTh><MudTableSortLabel SortBy="new Func<WeatherForecast, object>(x=>x.TemperatureC)">Temp. (C)</MudTableSortLabel></MudTh>
<MudTh><MudTableSortLabel SortBy="new Func<WeatherForecast, object>(x=>x.TemperatureF)">Temp. (F)</MudTableSortLabel></MudTh>
<MudTh><MudTableSortLabel SortBy="new Func<WeatherForecast, object>(x=>x.Summary!)">Summary</MudTableSortLabel></MudTh>
</HeaderContent>
<RowTemplate>
<MudTd DataLabel="Date">@context.Date</MudTd>
<MudTd DataLabel="Temp. (C)">@context.TemperatureC</MudTd>
<MudTd DataLabel="Temp. (F)">@context.TemperatureF</MudTd>
<MudTd DataLabel="Summary">@context.Summary</MudTd>
</RowTemplate>
<PagerContent>
<MudTablePager PageSizeOptions="new int[]{50, 100}" />
</PagerContent>
</MudTable>
}

@code {
private WeatherForecast[]? forecasts;

protected override async Task OnInitializedAsync()
{
@*#if (InteractiveAtRoot) -->
// Simulate asynchronous loading to demonstrate a loading indicator
##else
// Simulate asynchronous loading to demonstrate streaming rendering
##endif*@
await Task.Delay(500);

var startDate = DateOnly.FromDateTime(DateTime.Now);
var summaries = new[] { "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" };
forecasts = Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Date = startDate.AddDays(index),
TemperatureC = Random.Shared.Next(-20, 55),
Summary = summaries[Random.Shared.Next(summaries.Length)]
}).ToArray();
}

private class WeatherForecast
{
public DateOnly Date { get; set; }
public int TemperatureC { get; set; }
public string? Summary { get; set; }
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
}
}
27 changes: 27 additions & 0 deletions src/mudblazor/MudBlazor.Template.Client/Program.Main.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#if (IndividualLocalAuth)
using MudBlazor.Template.Client;
using Microsoft.AspNetCore.Components.Authorization;
#endif
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using MudBlazor.Services;

namespace MudBlazor.Template.Client;

class Program
{
static async Task Main(string[] args)
{
var builder = WebAssemblyHostBuilder.CreateDefault(args);

builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
builder.Services.AddMudServices();

#if (IndividualLocalAuth)
builder.Services.AddAuthorizationCore();
builder.Services.AddCascadingAuthenticationState();
builder.Services.AddSingleton<AuthenticationStateProvider, PersistentAuthenticationStateProvider>();
#endif

await builder.Build().RunAsync();
}
}
3 changes: 1 addition & 2 deletions src/mudblazor/MudBlazor.Template.Client/_Imports.razor
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@
@using static Microsoft.AspNetCore.Components.Web.RenderMode
@using Microsoft.AspNetCore.Components.Web.Virtualization
@using Microsoft.JSInterop
@using MudBlazor.Template.Client
@using MudBlazor
@using MudBlazor.Services
@using MudBlazor.Services
54 changes: 27 additions & 27 deletions src/mudblazor/MudBlazor.Template.sln
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.0.0
MinimumVisualStudioVersion = 16.0.0.0
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7557}") = "MudBlazor.Template", "MudBlazor.Template\MudBlazor.Template.csproj", "{650B3CE7-2E93-4CC4-9F46-466686815EA1}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MudBlazor.Template", "MudBlazor.Template\MudBlazor.Template.csproj", "{650B3CE7-2E93-4CC4-9F46-466686815EAA}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7557}") = "MudBlazor.Template.Client", "MudBlazor.Template.Client\MudBlazor.Template.Client.csproj", "{5990939C-7E7B-4CFA-86FF-44CA57564981}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MudBlazor.Template.Client", "MudBlazor.Template.Client\MudBlazor.Template.Client.csproj", "{5990939C-7E7B-4CFA-86FF-44CA5756498A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -16,35 +16,35 @@ Global
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{650B3CE7-2E93-4CC4-9F46-466686815EA1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{650B3CE7-2E93-4CC4-9F46-466686815EA1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{650B3CE7-2E93-4CC4-9F46-466686815EA1}.Debug|x64.ActiveCfg = Debug|Any CPU
{650B3CE7-2E93-4CC4-9F46-466686815EA1}.Debug|x64.Build.0 = Debug|Any CPU
{650B3CE7-2E93-4CC4-9F46-466686815EA1}.Debug|x86.ActiveCfg = Debug|Any CPU
{650B3CE7-2E93-4CC4-9F46-466686815EA1}.Debug|x86.Build.0 = Debug|Any CPU
{650B3CE7-2E93-4CC4-9F46-466686815EA1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{650B3CE7-2E93-4CC4-9F46-466686815EA1}.Release|Any CPU.Build.0 = Release|Any CPU
{650B3CE7-2E93-4CC4-9F46-466686815EA1}.Release|x64.ActiveCfg = Release|Any CPU
{650B3CE7-2E93-4CC4-9F46-466686815EA1}.Release|x64.Build.0 = Release|Any CPU
{650B3CE7-2E93-4CC4-9F46-466686815EA1}.Release|x86.ActiveCfg = Release|Any CPU
{650B3CE7-2E93-4CC4-9F46-466686815EA1}.Release|x86.Build.0 = Release|Any CPU
{5990939C-7E7B-4CFA-86FF-44CA57564981}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5990939C-7E7B-4CFA-86FF-44CA57564981}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5990939C-7E7B-4CFA-86FF-44CA57564981}.Debug|x64.ActiveCfg = Debug|Any CPU
{5990939C-7E7B-4CFA-86FF-44CA57564981}.Debug|x64.Build.0 = Debug|Any CPU
{5990939C-7E7B-4CFA-86FF-44CA57564981}.Debug|x86.ActiveCfg = Debug|Any CPU
{5990939C-7E7B-4CFA-86FF-44CA57564981}.Debug|x86.Build.0 = Debug|Any CPU
{5990939C-7E7B-4CFA-86FF-44CA57564981}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5990939C-7E7B-4CFA-86FF-44CA57564981}.Release|Any CPU.Build.0 = Release|Any CPU
{5990939C-7E7B-4CFA-86FF-44CA57564981}.Release|x64.ActiveCfg = Release|Any CPU
{5990939C-7E7B-4CFA-86FF-44CA57564981}.Release|x64.Build.0 = Release|Any CPU
{5990939C-7E7B-4CFA-86FF-44CA57564981}.Release|x86.ActiveCfg = Release|Any CPU
{5990939C-7E7B-4CFA-86FF-44CA57564981}.Release|x86.Build.0 = Release|Any CPU
{5990939C-7E7B-4CFA-86FF-44CA5756498A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5990939C-7E7B-4CFA-86FF-44CA5756498A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5990939C-7E7B-4CFA-86FF-44CA5756498A}.Debug|x64.ActiveCfg = Debug|Any CPU
{5990939C-7E7B-4CFA-86FF-44CA5756498A}.Debug|x64.Build.0 = Debug|Any CPU
{5990939C-7E7B-4CFA-86FF-44CA5756498A}.Debug|x86.ActiveCfg = Debug|Any CPU
{5990939C-7E7B-4CFA-86FF-44CA5756498A}.Debug|x86.Build.0 = Debug|Any CPU
{5990939C-7E7B-4CFA-86FF-44CA5756498A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5990939C-7E7B-4CFA-86FF-44CA5756498A}.Release|Any CPU.Build.0 = Release|Any CPU
{5990939C-7E7B-4CFA-86FF-44CA5756498A}.Release|x64.ActiveCfg = Release|Any CPU
{5990939C-7E7B-4CFA-86FF-44CA5756498A}.Release|x64.Build.0 = Release|Any CPU
{5990939C-7E7B-4CFA-86FF-44CA5756498A}.Release|x86.ActiveCfg = Release|Any CPU
{5990939C-7E7B-4CFA-86FF-44CA5756498A}.Release|x86.Build.0 = Release|Any CPU
{650B3CE7-2E93-4CC4-9F46-466686815EAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{650B3CE7-2E93-4CC4-9F46-466686815EAA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{650B3CE7-2E93-4CC4-9F46-466686815EAA}.Debug|x64.ActiveCfg = Debug|Any CPU
{650B3CE7-2E93-4CC4-9F46-466686815EAA}.Debug|x64.Build.0 = Debug|Any CPU
{650B3CE7-2E93-4CC4-9F46-466686815EAA}.Debug|x86.ActiveCfg = Debug|Any CPU
{650B3CE7-2E93-4CC4-9F46-466686815EAA}.Debug|x86.Build.0 = Debug|Any CPU
{650B3CE7-2E93-4CC4-9F46-466686815EAA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{650B3CE7-2E93-4CC4-9F46-466686815EAA}.Release|Any CPU.Build.0 = Release|Any CPU
{650B3CE7-2E93-4CC4-9F46-466686815EAA}.Release|x64.ActiveCfg = Release|Any CPU
{650B3CE7-2E93-4CC4-9F46-466686815EAA}.Release|x64.Build.0 = Release|Any CPU
{650B3CE7-2E93-4CC4-9F46-466686815EAA}.Release|x86.ActiveCfg = Release|Any CPU
{650B3CE7-2E93-4CC4-9F46-466686815EAA}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4C26868E-5E7C-458D-82E3-040509D0C710}
SolutionGuid = {4C26868E-5E7C-458D-82E3-040509D0C71F}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@page "/Account/AccessDenied"

<PageTitle>Access denied</PageTitle>

<MudAlert Severity="Severity.Error">You do not have access to this resource.</MudAlert>
Loading

0 comments on commit 5cd2b40

Please sign in to comment.