Skip to content

Commit

Permalink
Update AntDesign 0.16.2 and Add ReuseTabs (#162)
Browse files Browse the repository at this point in the history
* update to AntDesign 0.16.2

* add reuse tabs

* fix the reusetabs issue

* update template

* update action
  • Loading branch information
ElderJames authored Nov 19, 2023
1 parent c3ea33b commit 11a2d41
Show file tree
Hide file tree
Showing 12 changed files with 72 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

- uses: actions/setup-dotnet@v1
with:
dotnet-version: 7.0.100
dotnet-version: 8.0.100

- uses: actions/setup-node@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 7.0.100
dotnet-version: 8.0.100

- uses: actions/setup-node@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 7.0.100
dotnet-version: 8.0.100

- uses: actions/setup-node@v1
with:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AntDesign.Charts" Version="0.3.1" />
<PackageReference Include="AntDesign.ProLayout" Version="0.14.4" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="7.0.0" />
<PackageReference Include="System.Net.Http.Json" Version="7.0.0" />
<PackageReference Include="AntDesign.Charts" Version="0.4.0" />
<PackageReference Include="AntDesign.ProLayout" Version="0.16.2" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" />
<PackageReference Include="System.Net.Http.Json" Version="8.0.0" />
</ItemGroup>

<!--#if (UseNodeJS) -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="7.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AntDesign.Charts" Version="0.3.1" />
<PackageReference Include="AntDesign.ProLayout" Version="0.14.4" />
<PackageReference Include="System.Net.Http.Json" Version="7.0.0" />
<PackageReference Include="AntDesign.Charts" Version="0.4.0" />
<PackageReference Include="AntDesign.ProLayout" Version="0.16.2" />
<PackageReference Include="System.Net.Http.Json" Version="8.0.0" />
</ItemGroup>

<!--#if (UseNodeJS) -->
Expand Down
14 changes: 7 additions & 7 deletions .template.config/templates/wasm/AntDesign.Pro.Template.csproj
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RazorLangVersion>3.0</RazorLangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AntDesign.Charts" Version="0.3.1" />
<PackageReference Include="AntDesign.ProLayout" Version="0.14.4" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="7.0.0" />
<PackageReference Include="System.Net.Http.Json" Version="7.0.0" />
<PackageReference Include="AntDesign.Charts" Version="0.4.0" />
<PackageReference Include="AntDesign.ProLayout" Version="0.16.2" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" />
<PackageReference Include="System.Net.Http.Json" Version="8.0.0" />
</ItemGroup>

<!--#if (UseNodeJS) -->
Expand Down
14 changes: 7 additions & 7 deletions src/AntDesign.Pro/AntDesign.Pro.csproj
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

<PropertyGroup>
<TargetFramework>net7</TargetFramework>
<TargetFramework>net8</TargetFramework>
<RazorLangVersion>3.0</RazorLangVersion>
<AssemblyName>AntDesign.Pro.Template</AssemblyName>
<RootNamespace>AntDesign.Pro.Template</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AntDesign.Charts" Version="0.3.1" />
<PackageReference Include="AntDesign.ProLayout" Version="0.14.4" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="7.0.0" />
<PackageReference Include="System.Net.Http.Json" Version="7.0.0" />
<PackageReference Include="AntDesign.Charts" Version="0.4.0" />
<PackageReference Include="AntDesign.ProLayout" Version="0.16.2" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" />
<PackageReference Include="System.Net.Http.Json" Version="8.0.0" />
</ItemGroup>

<PropertyGroup Condition=" '$(SolutionDir)'==''">
Expand Down
4 changes: 3 additions & 1 deletion src/AntDesign.Pro/App.razor
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<Router AppAssembly="@typeof(Program).Assembly">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(BasicLayout)" />
<CascadingValue Value="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(BasicLayout)" />
</CascadingValue>
</Found>
<NotFound>
<LayoutView Layout="@typeof(BasicLayout)">
Expand Down
38 changes: 34 additions & 4 deletions src/AntDesign.Pro/Layouts/BasicLayout.razor
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
@namespace AntDesign.Pro.Template
@inherits LayoutComponentBase

<AntDesign.ProLayout.BasicLayout
Logo="@("https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg")"
MenuData="MenuData">
<AntDesign.ProLayout.BasicLayout Logo="@("https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg")"
MenuData="MenuData"
MenuAccordion
Collapsed="collapsed"
OnCollapse="e=>collapsed=e">
<HeaderContentRender>
<Space Size="@("24")">
<SpaceItem>
<Icon Class="action" Type="@(collapsed?"menu-unfold":"menu-fold")" OnClick="Toggle" />
</SpaceItem>
<SpaceItem>
<Icon Class="action" Type="reload" Theme="outline" OnClick="Reload" />
</SpaceItem>
</Space>
</HeaderContentRender>
<RightContentRender>
<AntDesign.Pro.Template.Components.RightContent />
</RightContentRender>
<ChildContent>
@Body
<ReuseTabs></ReuseTabs>
@* @Body *@
</ChildContent>
<FooterRender>
<FooterView Copyright="2021 Ant Design Blazor" Links="Links"></FooterView>
Expand All @@ -17,14 +30,21 @@
<SettingDrawer />

@inject HttpClient HttpClient
@inject ReuseTabsService TabService;
@code
{
bool collapsed;

private MenuDataItem[] MenuData { get; set; } = { };

protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();
MenuData = await HttpClient.GetFromJsonAsync<MenuDataItem[]>("data/menu.json");

// workaround for the reusetabs issue that can't open the default page.
// will fix in next release. https://github.com/ant-design-blazor/ant-design-blazor/pull/3519
TabService.ReloadPage();
}

public LinkItem[] Links { get; set; } =
Expand All @@ -51,4 +71,14 @@
BlankTarget = true,
}
};

void Toggle()
{
collapsed = !collapsed;
}

void Reload()
{
TabService.ReloadPage();
}
}
1 change: 1 addition & 0 deletions src/AntDesign.Pro/Pages/Dashboard/Analysis/Index.razor
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@namespace AntDesign.Pro.Template.Pages.Dashboard.Analysis
@page "/"
@attribute [ReuseTabsPage(Title ="Home", Pin =true, Closable =false, Order =0)]

<GridContent>
<Row Type="flex" Gutter="24">
Expand Down
4 changes: 4 additions & 0 deletions src/AntDesign.Pro/styles/global.less
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ ol {
list-style: none;
}

.action {
cursor: pointer;
}

@media (max-width: @screen-xs) {
.ant-table {
width: 100%;
Expand Down

0 comments on commit 11a2d41

Please sign in to comment.